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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from simphony/use-common-0.2
Use common 0.2
- Loading branch information
Showing
53 changed files
with
1,731 additions
and
122,453 deletions.
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
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# Functions, classes and constants exported here will be available | ||
# when the `openfoam` module is imported. | ||
from .foam_controlwrapper import FoamControlWrapper, read_foammesh | ||
from .foam_controlwrapper import FoamControlWrapper | ||
from .io_utils import read_foammesh | ||
from .blockmesh_utils import create_quad_mesh | ||
from .cuba_extension import CUBAExt | ||
__all__ = ['FoamControlWrapper', 'CUBAExt', 'read_foammesh'] | ||
__all__ = ['FoamControlWrapper', 'CUBAExt', 'read_foammesh', | ||
'create_quad_mesh'] |
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,69 @@ | ||
""" Utility functions for blockMesh | ||
""" | ||
|
||
import os | ||
|
||
|
||
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile | ||
|
||
from .foam_files import write_default_files | ||
from .foam_templates import blockMeshDict | ||
from .foam_runner import FoamRunner | ||
from .io_utils import read_foammesh | ||
|
||
|
||
def create_quad_mesh(path, name, mesh_engine, corner_points, | ||
nex, ney, nez): | ||
""" create and add mesh to engine | ||
Parameters | ||
---------- | ||
path : str | ||
path to mesh parent directory | ||
name : str | ||
name of mesh | ||
mesh_engine : ABCModelingEngine | ||
Mesh engine | ||
corner_points : list | ||
list of 8 [x,y,z] corner points | ||
nex : int | ||
number of elements in x -direction | ||
ney : int | ||
number of elements in y -direction | ||
nez : int | ||
number of elements in z -direction | ||
""" | ||
file_name = 'blockMeshDict' | ||
case = os.path.join(path, name) | ||
templateName = 'simpleFoam' | ||
write_default_files(case, templateName, '0', True) | ||
full_name = os.path.join(os.path.join( | ||
os.path.join(case, 'constant'), 'polyMesh'), file_name) | ||
with open(full_name, 'w') as f: | ||
f.write(blockMeshDict) | ||
|
||
blockMesh = ParsedParameterFile(full_name) | ||
|
||
for i in range(8): | ||
corner_points[i] = str(corner_points[i]).replace(',', ' ') | ||
|
||
blockMesh["vertices"] = corner_points | ||
|
||
blockLines = [""] | ||
blockLines[0] = 'hex (0 1 2 3 4 5 6 7) (%i %i %i) simpleGrading (1 1 1)'\ | ||
% (nex, ney, nez) | ||
blockMesh["blocks"] = blockLines | ||
|
||
blockMesh.writeFile() | ||
|
||
ncores = 1 | ||
solver = 'blockMesh' | ||
runner = FoamRunner(solver, case, ncores) | ||
runner.run() | ||
|
||
foam_mesh = read_foammesh(name, path) | ||
|
||
# add mesh to engine | ||
mesh_engine.add_dataset(foam_mesh) |
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 was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
foam_controlwrapper/examples/foam_mesh_to_simphony_mesh.py
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,11 @@ | ||
"""Example to convert mesh from OpenFoam's format to SimPhony | ||
""" | ||
|
||
from simphony.engine import openfoam_file_io | ||
|
||
wrapper = openfoam_file_io.FoamControlWrapper() | ||
|
||
name = 'poiseuille' | ||
path = '.' | ||
mesh_inside_wrapper = openfoam_file_io.read_foammesh(name, path) |
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,22 @@ | ||
|
||
|
||
FoamFile | ||
{ | ||
version 2.2; | ||
format ascii; | ||
class volVectorField; | ||
location "0"; | ||
object U; | ||
} | ||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
|
||
dimensions [ 0 1 -1 0 0 0 0 ]; | ||
|
||
internalField uniform (0 0 0); | ||
|
||
boundaryField | ||
{ | ||
|
||
} | ||
|
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,22 @@ | ||
|
||
|
||
FoamFile | ||
{ | ||
version 2.2; | ||
format ascii; | ||
class volScalarField; | ||
location "0"; | ||
object p; | ||
} | ||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
|
||
dimensions [ 0 2 -2 0 0 0 0 ]; | ||
|
||
internalField uniform 0; | ||
|
||
boundaryField | ||
{ | ||
|
||
} | ||
|
17 changes: 6 additions & 11 deletions
17
foam_controlwrapper/examples/poiseuille/constant/RASProperties
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 |
---|---|---|
@@ -1,24 +1,19 @@ | ||
/*--------------------------------*- 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; | ||
version 2.2; | ||
format ascii; | ||
class dictionary; | ||
location "constant"; | ||
object RASProperties; | ||
} | ||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
|
||
RASModel laminar; | ||
|
||
turbulence off; | ||
|
||
printCoeffs on; | ||
|
||
|
||
// ************************************************************************* // | ||
|
Oops, something went wrong.