Пример #1
0
def createFluidMeshes( rp, runTime ) :

    from Foam.finiteVolume import fvMesh, PtrList_fvMesh
    fluidRegions = PtrList_fvMesh( rp.fluidRegionNames.size() )
    from Foam.OpenFOAM import word, fileName, IOobject
    for index in range( rp.fluidRegionNames.size() ) :

        from Foam.OpenFOAM import ext_Info, nl
        ext_Info()<< "Create fluid mesh for region " << rp.fluidRegionNames[ index ] \
                  << " for time = " << runTime.timeName() << nl << nl
        mesh = fvMesh( IOobject( rp.fluidRegionNames[ index ],
                                 fileName( runTime.timeName() ),
                                 runTime,
                                 IOobject.MUST_READ ) ) 

        fluidRegions.ext_set( index, mesh )
        # Force calculation of geometric properties to prevent it being done
        # later in e.g. some boundary evaluation
        # (void)fluidRegions[i].weights();
        # (void)fluidRegions[i].deltaCoeffs();
        
        from Foam.OpenFOAM import IOdictionary, autoPtr_IOdictionary
        # Attach environmental properties to each region
        environmentalProperties = autoPtr_IOdictionary( IOdictionary( IOobject( word( "environmentalProperties" ),
                                                                                fileName( runTime.constant() ),
                                                                                fluidRegions[ index ],
                                                                                IOobject.MUST_READ,
                                                                                IOobject.NO_WRITE ) ) )
        
        environmentalProperties.ptr().store()
                
    return fluidRegions
Пример #2
0
def createMesh(runTime):
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "Create mesh for time = " << runTime.timeName() << nl << nl

    from Foam.OpenFOAM import Time
    from Foam.OpenFOAM import IOobject
    from Foam.OpenFOAM import fileName
    from Foam.finiteVolume import fvMesh

    mesh = fvMesh(
        IOobject(fvMesh.defaultRegion.fget(), fileName(runTime.timeName()),
                 runTime, IOobject.MUST_READ))

    return mesh
Пример #3
0
def createMeshNoClear( runTime ):
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "Create mesh, no clear-out for time = " << runTime.timeName() << nl << nl

    from Foam.OpenFOAM import Time
    from Foam.OpenFOAM import IOobject
    from Foam.OpenFOAM import fileName
    from Foam.finiteVolume import fvMesh
    
    mesh = fvMesh( IOobject( fvMesh.defaultRegion.fget(),
                             fileName( runTime.timeName() ),
                             runTime,
                             IOobject.MUST_READ ) )

    return mesh
Пример #4
0
def createSolidMeshes( rp, runTime ):
    
    from Foam.finiteVolume import PtrList_fvMesh, fvMesh
    solidRegions = PtrList_fvMesh( rp.solidRegionNames.size() )
    
    from Foam.OpenFOAM import word, fileName, IOobject
    for index in range( solidRegions.size() ):
        from Foam.OpenFOAM import ext_Info, nl
        ext_Info()<< "Create solid mesh for region " << rp.solidRegionNames[ index ] \
            << " for time = " << runTime.timeName() << nl << nl
        
        solidRegions.ext_set(index, fvMesh( IOobject ( word( rp.solidRegionNames[ index ] ),
                                                       fileName( runTime.timeName() ),
                                                       runTime,
                                                       IOobject.MUST_READ ) ) )
        pass

    return solidRegions
Пример #5
0
def createFluidMeshes( rp, runTime ) :
    
    from Foam.finiteVolume import fvMesh, PtrList_fvMesh
    fluidRegions = PtrList_fvMesh( rp.fluidRegionNames().size() )
    
    from Foam.OpenFOAM import word, fileName, IOobject
    for index in range( rp.fluidRegionNames().size() ) :
        from Foam.OpenFOAM import ext_Info, nl
        ext_Info()<< "Create fluid mesh for region " << rp.fluidRegionNames()[ index ] \
                  << " for time = " << runTime.timeName() << nl << nl
        mesh = fvMesh( IOobject( rp.fluidRegionNames()[ index ],
                                 fileName( runTime.timeName() ),
                                 runTime,
                                 IOobject.MUST_READ ) )
        fluidRegions.ext_set( index, mesh )
        pass
    
    return fluidRegions
Пример #6
0
def createFluidMeshes(rp, runTime):

    from Foam.finiteVolume import fvMesh, PtrList_fvMesh
    fluidRegions = PtrList_fvMesh(rp.fluidRegionNames().size())

    from Foam.OpenFOAM import word, fileName, IOobject
    for index in range(rp.fluidRegionNames().size()):
        from Foam.OpenFOAM import ext_Info, nl
        ext_Info()<< "Create fluid mesh for region " << rp.fluidRegionNames()[ index ] \
                  << " for time = " << runTime.timeName() << nl << nl
        mesh = fvMesh(
            IOobject(rp.fluidRegionNames()[index],
                     fileName(runTime.timeName()), runTime,
                     IOobject.MUST_READ))
        fluidRegions.ext_set(index, mesh)
        pass

    return fluidRegions
Пример #7
0
def createSolidMeshes( rp, runTime ):
    
    from Foam.finiteVolume import PtrList_fvMesh, fvMesh
    solidRegions = PtrList_fvMesh( rp.solidRegionNames().size() )
    
    from Foam.OpenFOAM import word, fileName, IOobject
    for index in range( solidRegions.size() ):
        from Foam.OpenFOAM import ext_Info, nl
        ext_Info()<< "Create solid mesh for region " << rp.solidRegionNames()[ index ] \
            << " for time = " << runTime.timeName() << nl << nl
        
        solidRegions.ext_set(index, fvMesh( IOobject ( word( rp.solidRegionNames()[ index ] ),
                                                       fileName( runTime.timeName() ),
                                                       runTime,
                                                       IOobject.MUST_READ ) ) )
        pass

    return solidRegions
Пример #8
0
def createSolidMeshes( rp, runTime ):
    
    from Foam.finiteVolume import PtrList_fvMesh, fvMesh
    solidRegions = PtrList_fvMesh( rp.solidRegionNames.size() )
    
    from Foam.OpenFOAM import word, fileName, IOobject
    for index in range( solidRegions.size() ):
        from Foam.OpenFOAM import ext_Info, nl
        ext_Info()<< "Create solid mesh for region " << rp.solidRegionNames[ index ] \
            << " for time = " << runTime.timeName() << nl << nl
        
        solidRegions.ext_set(index, fvMesh( IOobject ( word( rp.solidRegionNames[ index ] ),
                                                       fileName( runTime.timeName() ),
                                                       runTime,
                                                       IOobject.MUST_READ ) ) )
        pass
    # Force calculation of geometric properties to prevent it being done
    # later in e.g. some boundary evaluation
    # (void)solidRegions[i].weights();
    # (void)solidRegions[i].deltaCoeffs();
    
    return solidRegions
Пример #9
0
def createSolidMeshes(rp, runTime):

    from Foam.finiteVolume import PtrList_fvMesh, fvMesh
    solidRegions = PtrList_fvMesh(rp.solidRegionNames.size())

    from Foam.OpenFOAM import word, fileName, IOobject
    for index in range(solidRegions.size()):
        from Foam.OpenFOAM import ext_Info, nl
        ext_Info()<< "Create solid mesh for region " << rp.solidRegionNames[ index ] \
            << " for time = " << runTime.timeName() << nl << nl

        solidRegions.ext_set(
            index,
            fvMesh(
                IOobject(word(rp.solidRegionNames[index]),
                         fileName(runTime.timeName()), runTime,
                         IOobject.MUST_READ)))
        pass
    # Force calculation of geometric properties to prevent it being done
    # later in e.g. some boundary evaluation
    # (void)solidRegions[i].weights();
    # (void)solidRegions[i].deltaCoeffs();

    return solidRegions