-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
python setup.py clean | ||
rm -rf dist build foam_wrappers.egg-info | ||
pushd . | ||
cd openfoam-interface | ||
wclean | ||
rm -rf build | ||
popd | ||
pushd . | ||
cd openfoam-interface/internal-interface/libs | ||
wclean incompressibleTurbulenceModel/turbulenceModel | ||
wclean incompressibleTurbulenceModel/RAS | ||
#wclean incompressibleTurbulenceModel/LES | ||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,11 @@ Simphony-openfoam is hosted on github: https://github.com/simphony/simphony-open | |
Installation | ||
------------ | ||
|
||
Package foam_controlwrapper requires python 2.7.x, OpenFOAM 2.2.x and pyFoam 0.6.4 | ||
Package foam_controlwrapper requires python 2.7.x, OpenFOAM 2.2.2 and pyFoam 0.6.4 | ||
|
||
Installing the OpenFoam interface wrappers | ||
$ ./install_foam_interface.sh | ||
This comment has been minimized.
Sorry, something went wrong.
khiltunen
Contributor
|
||
|
||
Installation is based on setuptools:: | ||
|
||
# build and install | ||
|
@@ -42,3 +45,4 @@ Subpackages: | |
|
||
|
||
- foam_controlwrapper -- wrapper class and tests for OpenFOAM -wrapping using pyFoam | ||
This comment has been minimized.
Sorry, something went wrong.
khiltunen
Contributor
|
||
- foam_internalwrapper -- wrapper class and tests for OpenFOAM -wrapping using internal interfaces |
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'] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" Provisional CUBA keywords specific for this revision | ||
""" | ||
|
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Example to convert mesh from OpenFoam's format to H5CUDS | ||
""" | ||
|
||
from foam_controlwrapper.foam_controlwrapper import FoamControlWrapper | ||
This comment has been minimized.
Sorry, something went wrong.
khiltunen
Contributor
|
||
from simphony.io.h5_cuds import H5CUDS | ||
|
||
foam_controlwrapper = FoamControlWrapper() | ||
name = 'poiseuille' | ||
path = '.' | ||
mesh_inside_wrapper = foam_controlwrapper.read_foammesh(name, path) | ||
mesh_file = H5CUDS.open("poiseuille.cuds") | ||
print 'Adding mesh ', mesh_inside_wrapper.name | ||
mesh_file.add_mesh(mesh_inside_wrapper) |
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 "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() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*--------------------------------*- C++ -*----------------------------------*\ | ||
| ========= | | | ||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | ||
| \\ / O peration | Version: 2.2.1 | | ||
| \\ / A nd | Web: www.OpenFOAM.org | | ||
| \\/ M anipulation | | | ||
\*---------------------------------------------------------------------------*/ | ||
FoamFile | ||
{ | ||
version 2.0; | ||
format ascii; | ||
class dictionary; | ||
object RASProperties; | ||
} | ||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
RASModel laminar; | ||
|
||
turbulence off; | ||
|
||
printCoeffs on; | ||
|
||
|
||
// ************************************************************************* // |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/*--------------------------------*- C++ -*----------------------------------*\ | ||
| ========= | | | ||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | ||
| \\ / O peration | Version: 2.2.1 | | ||
| \\ / A nd | Web: www.OpenFOAM.org | | ||
| \\/ M anipulation | | | ||
\*---------------------------------------------------------------------------*/ | ||
FoamFile | ||
{ | ||
version 2.0; | ||
format ascii; | ||
class dictionary; | ||
object blockMeshDict; | ||
} | ||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
convertToMeters 1; | ||
|
||
vertices | ||
( | ||
(0 0 0) | ||
(30 0 0) | ||
(30 5 0) | ||
(0 5 0) | ||
(0 0 0.1) | ||
(30 0 0.1) | ||
(30 5 0.1) | ||
(0 5 0.1) | ||
); | ||
|
||
blocks | ||
( | ||
hex (0 1 2 3 4 5 6 7) (500 20 1) simpleGrading (1 1 1) | ||
); | ||
|
||
edges | ||
( | ||
); | ||
|
||
boundary | ||
( | ||
sides | ||
{ | ||
type patch; | ||
faces | ||
( | ||
(3 7 6 2) | ||
(1 5 4 0) | ||
); | ||
} | ||
inlet | ||
{ | ||
type patch; | ||
faces | ||
( | ||
(0 4 7 3) | ||
); | ||
} | ||
outlet | ||
{ | ||
type patch; | ||
faces | ||
( | ||
(2 6 5 1) | ||
); | ||
} | ||
frontAndBack | ||
{ | ||
type empty; | ||
faces | ||
( | ||
(0 3 2 1) | ||
(4 5 6 7) | ||
); | ||
} | ||
); | ||
|
||
mergePatchPairs | ||
( | ||
); | ||
|
||
// ************************************************************************* // |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*--------------------------------*- C++ -*----------------------------------*\ | ||
| ========= | | | ||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | ||
| \\ / O peration | Version: 2.2.x | | ||
| \\ / A nd | Web: www.OpenFOAM.org | | ||
| \\/ M anipulation | | | ||
\*---------------------------------------------------------------------------*/ | ||
FoamFile | ||
{ | ||
version 2.0; | ||
format ascii; | ||
class polyBoundaryMesh; | ||
location "constant/polyMesh"; | ||
object boundary; | ||
} | ||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
4 | ||
( | ||
sides | ||
{ | ||
type patch; | ||
nFaces 1000; | ||
startFace 19480; | ||
} | ||
inlet | ||
{ | ||
type patch; | ||
nFaces 20; | ||
startFace 20480; | ||
} | ||
outlet | ||
{ | ||
type patch; | ||
nFaces 20; | ||
startFace 20500; | ||
} | ||
frontAndBack | ||
{ | ||
type empty; | ||
inGroups 1(empty); | ||
nFaces 20000; | ||
startFace 20520; | ||
} | ||
) | ||
|
||
// ************************************************************************* // |
5 comments
on commit 03a2385
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.
Comments acknowledged, we'll work on that today.
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.
Looked at the tests and i think you should also include tests for FoamMesh and FoamFiles classes (more or less the same tests as in the IO wrapper side)
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.
We added a test for FoamMesh. Test for FoamFiles is not required in internal wrapper.
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.
If the FoamFiles is not needed then you should remove the foam_files.py from the package
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.
We've removed this file and it references in the code
Here the issue number should be #23