def createFvMesh(runTime):
    # Read temporary mesh from file - done only so we can get the list of points, faces and cells
    tmpMesh = man.fvMesh( man.IOobject( ref.word("tmp"),
                                        runTime.caseConstant(),
                                        runTime,
                                        ref.IOobject.NO_READ,
                                        ref.IOobject.NO_WRITE ) )
    
    # Get points, faces & Cells - SFOAM implementation should populate these lists from Salome mesh
    points = tmpMesh.points()
    faces = tmpMesh.faces()
    cells = tmpMesh.cells()
    
    #  Now create the mesh - Nothing read from file, although fvSchemes and fvSolution created above must be present
    #  It is necessary to store tmpMesh, because fvMesh::points(), faces(), and cells() return const T&
    #  and fvMesh in next line will be broken, after exiting from this function (tmpMesh are deleted) 
    mesh = man.fvMesh( ref.fvMesh( ref.IOobject( ref.word("region0"),
                                                 runTime.caseConstant(),
                                                 runTime,
                                                 ref.IOobject.MUST_READ,
                                                 ref.IOobject.AUTO_WRITE),
                                   points, faces, cells ),
                       man.Deps( tmpMesh ) )             
    
    # Create boundary patches
    patches = ref.polyPatchListPtr( 4, ref.polyPatch.nullPtr() )
    patches.set(0, ref.polyPatch.New( ref.word("patch"),
                                      ref.word("inlet_F"),
                                      606,
                                      102308,
                                      0,
                                      mesh.boundaryMesh() ) )
    
    patches.set(1, ref.polyPatch.New( ref.word("patch"),
                                      ref.word("outlet_F1"),
                                      818,
                                      102914,
                                      1,
                                      mesh.boundaryMesh() ) )
    
    patches.set(2, ref.polyPatch.New( ref.word("patch"),
                                      ref.word("outlet_F2"),
                                      522,
                                      103732,
                                      2,
                                      mesh.boundaryMesh() ) )
    
    patches.set(3, ref.polyPatch.New( ref.word("wall"), 
                                      ref.word("pipe"),
                                      5842,
                                      104254,
                                      3,
                                      mesh.boundaryMesh() ) )
    
    mesh.addFvPatches(patches)
    
    return mesh, patches
Esempio n. 2
0
def createFluidMeshes( rp, runTime ) :
    
    fluidRegions = list()
    for index in range( rp.fluidRegionNames().size() ) :
        ref.ext_Info()<< "Create fluid mesh for region " << rp.fluidRegionNames()[ index ] \
                  << " for time = " << runTime.timeName() << ref.nl << ref.nl
        mesh = man.fvMesh( man.IOobject( rp.fluidRegionNames()[ index ],
                                         ref.fileName( runTime.timeName() ),
                                         runTime,
                                         ref.IOobject.MUST_READ ) )
        fluidRegions.append( mesh )
        pass
    
    return fluidRegions
Esempio n. 3
0
def createFluidMeshes(rp, runTime):

    fluidRegions = list()
    for index in range(rp.fluidRegionNames().size()):
        ref.ext_Info()<< "Create fluid mesh for region " << rp.fluidRegionNames()[ index ] \
                  << " for time = " << runTime.timeName() << ref.nl << ref.nl
        mesh = man.fvMesh(
            man.IOobject(rp.fluidRegionNames()[index],
                         ref.fileName(runTime.timeName()), runTime,
                         ref.IOobject.MUST_READ))
        fluidRegions.append(mesh)
        pass

    return fluidRegions
Esempio n. 4
0
# Create time
runTime = man.Time(ref.word("controlDict"), root, case)

runTime.controlDict().remove(ref.word("startTime"))
runTime.controlDict().remove(ref.word("endTime"))
runTime.controlDict().remove(ref.word("deltaT"))
runTime.controlDict().add(ref.word("startTime"), 0)
runTime.controlDict().add(ref.word("endTime"), 0.5)
runTime.controlDict().add(ref.word("deltaT"), 0.005)

runTime.read()

# Create mesh
mesh = man.fvMesh( man.IOobject( ref.word("region0"),
                                 ref.fileName(runTime.timeName()),
                                 runTime,
                                 ref.IOobject.MUST_READ,
                                 ref.IOobject.NO_WRITE))

# Create transport properties
transportProperties = ref.IOdictionary(ref.IOobject( ref.word("transportProperties"),
                                                     ref.fileName(runTime.constant()),
                                                     mesh,
                                                     ref.IOobject.MUST_READ,
                                                     ref.IOobject.AUTO_WRITE))

nu = ref.dimensionedScalar(transportProperties.lookup(ref.word("nu")))
nu.setValue(0.05)

# Create pressure field: read
p = man.volScalarField( man.IOobject( ref.word("p"),