This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Mixing io ii #23
Merged
Merged
Mixing io ii #23
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
03a2385
Integration OpenFoam wrappers
jmarcelogimenez 7da1bfe
modification of readme
jmarcelogimenez 33fcced
modification of readm
jmarcelogimenez 058ed86
Corrections for #23
jmarcelogimenez 56de9ed
Fixing travis-ci problem
jmarcelogimenez 50518d4
Fixing travis-ci problem
jmarcelogimenez a501271
Fixing travis-ci problem
jmarcelogimenez 4fd8c5b
Merging with master
jmarcelogimenez d1b09c5
solving bug with OF opt version and controlwrapper test by-passed
jmarcelogimenez 93e573c
fixing some issues
jmarcelogimenez 2373c1f
Fixing linking issues
jmarcelogimenez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
export FOAM_MPI_INCLUDE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI/include | ||
rm -rf dist build foam_wrappers.egg-info | ||
pushd . | ||
cd openfoam-interface | ||
wclean | ||
rm -rf build | ||
popd | ||
pushd . | ||
rm -f openfoam-interface/internal-interface/bin/* | ||
cd openfoam-interface/internal-interface/libs | ||
wclean incompressibleTurbulenceModel/turbulenceModel | ||
wclean incompressibleTurbulenceModel/RAS | ||
rm -rf incompressibleTurbulenceModel | ||
popd | ||
pushd . | ||
cd openfoam-interface/internal-interface/wrapper | ||
python setup.py clean | ||
wclean | ||
rm -rf build | ||
popd | ||
find . -iname "*~" | xargs rm -f | ||
find . -iname "log" | xargs rm -f | ||
find . -iname "*pyc" | xargs rm -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Functions, classes and constants exported here will be available | ||
# when the `openfoam` module is imported. | ||
from .foam_internalwrapper import FoamInternalWrapper | ||
from .cuba_extension import CUBAExt | ||
__all__ = ['FoamInternalWrapper', 'CUBAExt'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" Provisional CUBA keywords specific for this revision | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jmarcelogimenez , this comment has been not addressed. An issue should be opened. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added #34 |
||
|
||
""" | ||
|
||
from enum import IntEnum, unique | ||
|
||
|
||
@unique | ||
class CUBAExt(IntEnum): | ||
|
||
INCOMPRESSIBLE = 1 | ||
COMPRESSIBLE = 2 | ||
VOF = 3 | ||
LAMINAR_MODEL = 4 | ||
GE = 5 | ||
PATCH_TYPE = 6 | ||
PHASE_LIST = 7 | ||
MAX_COURANT_NUMBER = 8 | ||
SURFACE_TENSION = 9 | ||
NUMBER_OF_CORES = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
"""Example to solve 2D poiseuille flow | ||
|
||
""" | ||
|
||
from simphony.core.cuba import CUBA | ||
from simphony.engine import openfoam_internal | ||
from simphony.io.h5_cuds import H5CUDS | ||
import os | ||
|
||
# Only for postprocessing purposes | ||
import matplotlib.pyplot as plt | ||
|
||
wrapper = openfoam_internal.FoamInternalWrapper() | ||
CUBAExt = openfoam_internal.CUBAExt | ||
|
||
name = 'poiseuille' | ||
|
||
wrapper.CM[CUBA.NAME] = name | ||
|
||
wrapper.CM_extensions[CUBAExt.GE] = (CUBAExt.INCOMPRESSIBLE, | ||
CUBAExt.LAMINAR_MODEL) | ||
|
||
wrapper.CM_extensions[CUBAExt.NUMBER_OF_CORES] = 1 | ||
|
||
wrapper.SP[CUBA.TIME_STEP] = 1 | ||
wrapper.SP[CUBA.NUMBER_OF_TIME_STEPS] = 1000 | ||
wrapper.SP[CUBA.DENSITY] = 1.0 | ||
wrapper.SP[CUBA.DYNAMIC_VISCOSITY] = 1.0 | ||
|
||
# this is just an example. It is not enough for general setting of BC's | ||
wrapper.BC[CUBA.VELOCITY] = {'boundary0': (0, 0, 0), | ||
'boundary2': 'zeroGradient', | ||
'boundary1': (0.1, 0, 0), | ||
'boundary3': 'empty'} | ||
wrapper.BC[CUBA.PRESSURE] = {'boundary0': 'zeroGradient', | ||
'boundary2': 0, | ||
'boundary1': 'zeroGradient', | ||
'boundary3': 'empty'} | ||
|
||
mesh_file = H5CUDS.open(os.path.join(name, 'poiseuille.cuds')) | ||
mesh_from_file = mesh_file.get_mesh(name) | ||
|
||
print "Mesh name ", mesh_from_file.name | ||
|
||
mesh_inside_wrapper = wrapper.add_mesh(mesh_from_file) | ||
|
||
print "Case directory ", mesh_inside_wrapper.path | ||
|
||
for cell in mesh_inside_wrapper.iter_cells(): | ||
cell.data[CUBA.PRESSURE] = 1.0 | ||
cell.data[CUBA.VELOCITY] = [0.0, 0.0, 0.0] | ||
mesh_inside_wrapper.update_cell(cell) | ||
|
||
# run returns the latest time | ||
lastTime = wrapper.run() | ||
print "lastTime: " + str(lastTime) | ||
|
||
print "post-processing" | ||
XYZUVW = mesh_inside_wrapper.getXYZUVW() | ||
plt.quiver(XYZUVW[:, 0], XYZUVW[:, 1], XYZUVW[:, 3], XYZUVW[:, 4]) | ||
plt.axis('equal') | ||
plt.savefig("result.png") | ||
plt.show() |
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khiltunen, @jmarcelogimenez , the
foam_controlwrapper/examples/poiseuille.py
andfoam_internalwrapper/examples/poiseuille.py
are also mostly the same. Both types of wrappers support the same functionality, right? When looking at the files, it seems so..except for one minor thing (i.e.CUBAExt.NUMBER_OF_CORES
).I would think that these are examples of using simphony-openfoam (regardless of its its the INTERNAL or FILE-IO version). Therefore,
foam_controlwrapper/examples/poiseuille.py
andfoam_internalwrapper/examples/poiseuille.py
could be replaced by`examples/poiseuille.py``.I would suggest not trying to tackle this in this PR but to address it in a seperate PR and an issue should be opened up now (e.g. "make a single poiseuille.py")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmarcelogimenez , this comment has been not addressed. An issue should be opened if it is not going to be addressed in this PR.