SALOME OpenFOAM coupling

SALOME geometric modelling

import geompy L = 0.1; H = 0.08; T = 0.006; R = 0.048; R1 = 0.0385 Vertex_1 = geompy.MakeVertex( 0, -L, 0 ) Vertex_2 = geompy.MakeVertex( 0, 0, 0 ) Vector_y = geompy.MakeVectorDXDYDZ( 0, 1, 0 ) Vector_z = geompy.MakeVectorDXDYDZ( 0, 0, 1 ) Cylinder_1 = geompy.MakeCylinder( Vertex_1, Vector_y, R, 2*L ) Cylinder_2 = geompy.MakeCylinder( Vertex_2, Vector_z, R1, H ) Fuse_1 = geompy.MakeFuse( Cylinder_1, Cylinder_2 )
SALOME meshing

import smesh NETGEN_3D_Parameters = smesh.smesh.CreateHypothesis( "NETGEN_Parameters", "NETGENEngine" ) NETGEN_3D_Parameters.SetMaxSize( 0.05 ) NETGEN_3D_Parameters.SetSecondOrder( 0 ) NETGEN_3D_Parameters.SetOptimize( 1 ) NETGEN_3D_Parameters.SetFineness( 3 ) Mesh_1 = smesh.Mesh( Fuse_1 ) status = Mesh_1.AddHypothesis( NETGEN_3D_Parameters ) Netgen_1D_2D_3D = smesh.smesh.CreateHypothesis( "NETGEN_2D3D", "NETGENEngine" ) status = Mesh_1.AddHypothesis( Netgen_1D_2D_3D ) isDone = Mesh_1.Compute()
pythonFlu case setup

# Create pressure field pPatchTypes = pyWordList( [ "zeroGradient", "fixedValue", "fixedValue", "zeroGradient" ] ) p = volScalarField( IOobject( word( "p" ), fileName( runTime.timeName() ), mesh, IOobject.NO_READ, IOobject.AUTO_WRITE ), mesh, dimensionedScalar( word(), dimensionSet( 0, 2, -2, 0, 0, 0, 0 ), 101.325 ), pPatchTypes ) p.ext_boundaryField()[ 1 ].ext_assign( 101.325 ) p.ext_boundaryField()[ 2 ].ext_assign( 101.325 )
pythonFlu's $\frac{\partial \rho \mathbf{U}}{\partial t} + \nabla \cdot\phi\mathbf{U} - \nabla \cdot\mu\nabla\mathbf{U} = - \nabla p$
while not runTime.end() : UEqn = ( fvm.ddt( U ) + fvm.div( phi, U ) - fvm.laplacian( nu, U ) ) solve( UEqn == -fvc.grad( p ) ) # --- PISO loop for corr in range( nCorr ) : rUA = 1.0 / UEqn.A() U = rUA * UEqn.H() phi = ( fvc.interpolate( U ) & mesh.Sf() ) + fvc.ddtPhiCorr( rUA, U, phi ) for nonOrth in range( nNonOrthCorr + 1 ) : pEqn = ( fvm.laplacian( rUA, p ) == fvc.div( phi ) ) pEqn.solve() if nonOrth == nNonOrthCorr: phi = phi - pEqn.flux() pass pass U = U - rUA * fvc.grad( p ) pass runTime.write() runTime += runTime.deltaT() pass
SALOME post-processing

a_vtk_data = foamToVTK( a_root_dir, the_case_dir) a_med_data = vtk2med( a_vtk_data ) aResult = aVisuGen.CopyAndImportFile( a_med_data ) aScalarMap = aVisuGen.ScalarMapOnField( aResult, a_mesh_name, VISU.NODE, "Point U", 1 ) aScalarMap.SetBarOrientation( VISU.ColoredPrs3d.HORIZONTAL ) aScalarMap.SetPosition( 0.05, 0.01 ) aScalarMap.SetSize( 0.90, 0.15 ) aScalarMap.SetNbColors( 64 ) aScalarMap.SetLabels( 5 ) aViewManager = aVisuGen.GetViewManager() aView3D = aViewManager.Create3DView() aView3D.Display( aScalarMap ); aView3D.FitAll()
page revision: 33, last edited: 01 Jun 2011 11:24