def readPISOControls_010500_dev(mesh):
    from Foam.OpenFOAM import dictionary, readInt, Switch, word

    piso = dictionary(mesh.solutionDict().subDict(word("PISO")))

    nCorr = readInt(piso.lookup(word("nCorrectors")))

    nNonOrthCorr = 0
    if piso.found(word("nNonOrthogonalCorrectors")):
        nNonOrthCorr = readInt(piso.lookup(word("nNonOrthogonalCorrectors")))
        pass

    momentumPredictor = True
    if piso.found(word("momentumPredictor")):
        momentumPredictor = Switch(piso.lookup(word("momentumPredictor")))
        pass

    transonic = False
    if piso.found(word("transonic")):
        transonic = Switch(piso.lookup(word("transonic")))
        pass

    nOuterCorr = 1
    if piso.found(word("nOuterCorrectors")):
        nOuterCorr = readInt(piso.lookup(word("nOuterCorrectors")))
        pass

    ddtPhiCorr = False
    if piso.found(word("ddtPhiCorr")):
        ddtPhiCorr = Switch(piso.lookup(word("ddtPhiCorr")))
        pass

    return piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr, ddtPhiCorr
def readPISOControls_010500_dev( mesh ):
    from Foam.OpenFOAM import dictionary, readInt, Switch, word

    piso = dictionary( mesh.solutionDict().subDict( word( "PISO" ) ) )

    nCorr = readInt( piso.lookup( word( "nCorrectors" ) ) )

    nNonOrthCorr = 0;
    if piso.found( word( "nNonOrthogonalCorrectors" ) ) :
       nNonOrthCorr = readInt( piso.lookup( word( "nNonOrthogonalCorrectors" ) ) )
       pass
    
    momentumPredictor = True;
    if piso.found( word( "momentumPredictor" ) ) :
       momentumPredictor = Switch( piso.lookup( word( "momentumPredictor" ) ) )
       pass
   
    transonic = False;
    if piso.found( word( "transonic" ) ) :
       transonic = Switch( piso.lookup( word( "transonic" ) ) )
       pass

    nOuterCorr = 1;
    if piso.found( word( "nOuterCorrectors" ) ) :
       nOuterCorr = readInt( piso.lookup( word( "nOuterCorrectors" ) ) )
       pass
    
    ddtPhiCorr = False
    if piso.found( word( "ddtPhiCorr" ) ) :
       ddtPhiCorr = Switch( piso.lookup( word( "ddtPhiCorr" ) ) )
       pass
    
    
    return piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr, ddtPhiCorr
Esempio n. 3
0
def readFluidMultiRegionPISOControls( mesh ) :
    
    from Foam.OpenFOAM import word, readInt, Switch
    piso = mesh.solutionDict().subDict( word( "PISO" ) )
    
    nCorr = readInt( piso.lookup( word( "nCorrectors" ) ) )

    nNonOrthCorr = 0
    if piso.found( word( "nNonOrthogonalCorrectors" ) ):
       nNonOrthCorr = readInt( piso.lookup( word( "nNonOrthogonalCorrectors" ) ) )
       pass
    
    momentumPredictor = True
    if piso.found( word( "momentumPredictor" ) ):
       momentumPredictor = Switch( piso.lookup( word( "momentumPredictor" ) ) )
       pass
    
    transonic = False
    if piso.found( word( "transonic" ) ):
       transonic = Switch(piso.lookup( word( "transonic" ) ) )
       pass
    
    nOuterCorr = 1
    if piso.found( word( "nOuterCorrectors" ) ):
       nOuterCorr = readInt(piso.lookup( word( "nOuterCorrectors" ) ) )

    return piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr
Esempio n. 4
0
def readSIMPLEControls_010500_dev(mesh):
    from Foam.OpenFOAM import Switch
    from Foam.OpenFOAM import word

    simple = mesh.solutionDict().subDict(word("SIMPLE"))

    from Foam.OpenFOAM import readInt
    nNonOrthCorr = 0
    if (simple.found(word("nNonOrthogonalCorrectors"))):
        nNonOrthCorr = readInt(simple.lookup(word("nNonOrthogonalCorrectors")))
        pass

    momentumPredictor = True
    if (simple.found(word("momentumPredictor"))):
        momentumPredictor = Switch(simple.lookup(word("momentumPredictor")))
        pass

    fluxGradp = False
    if (simple.found(word("fluxGradp"))):
        fluxGradp = Switch(simple.lookup(word("fluxGradp")))
        pass

    transonic = False
    if (simple.found(word("transSonic"))):
        transonic = Switch(simple.lookup(word("transSonic")))
        pass

    return simple, nNonOrthCorr, momentumPredictor, fluxGradp, transonic
def readSIMPLEControls_010500_dev( mesh ):
    from Foam.OpenFOAM import Switch
    from Foam.OpenFOAM import word
    
    simple = mesh.solutionDict().subDict( word( "SIMPLE" ) )
    
    from Foam.OpenFOAM import readInt
    nNonOrthCorr = 0
    if ( simple.found( word( "nNonOrthogonalCorrectors" ) ) ):
       nNonOrthCorr = readInt(simple.lookup( word( "nNonOrthogonalCorrectors" ) ) )
       pass
 
    momentumPredictor = True
    if ( simple.found( word( "momentumPredictor" ) ) ):
       momentumPredictor = Switch(simple.lookup( word( "momentumPredictor" ) ) )
       pass
 
    fluxGradp = False
    if ( simple.found( word( "fluxGradp" ) ) ):
       fluxGradp = Switch( simple.lookup( word( "fluxGradp" ) ) )
       pass
 
    transonic = False
    if ( simple.found( word( "transSonic" ) ) ):
       transonic = Switch( simple.lookup( word( "transSonic" ) ) )
       pass

    return simple, nNonOrthCorr, momentumPredictor, fluxGradp, transonic
Esempio n. 6
0
def readFluidMultiRegionPIMPLEControls( mesh ) :
    
    from Foam.OpenFOAM import word, readInt, Switch
    pimple = mesh.solutionDict().subDict( word( "PIMPLE" ) )
    nCorr = readInt( pimple.lookup( word( "nCorrectors" ) ) )
    nNonOrthCorr = pimple.lookupOrDefault( word( "nNonOrthogonalCorrectors" ), 0 )
    momentumPredictor =pimple.lookupOrDefault( word( "momentumPredictor" ), Switch( True ) )
    
    return pimple, nCorr, nNonOrthCorr, momentumPredictor
Esempio n. 7
0
def readSolidMultiRegionPISOControls( mesh ):
    from Foam.OpenFOAM import word, readInt
    piso = mesh.solutionDict().subDict( word( "PISO" ) )
    
    nNonOrthCorr = 0
    if piso.found( word( "nNonOrthogonalCorrectors" ) ):
       nNonOrthCorr = readInt( piso.lookup( word( "nNonOrthogonalCorrectors" ) ) )

    return piso, nNonOrthCorr
Esempio n. 8
0
def readSolidMultiRegionPISOControls(mesh):
    from Foam.OpenFOAM import word, readInt
    piso = mesh.solutionDict().subDict(word("PISO"))

    nNonOrthCorr = 0
    if piso.found(word("nNonOrthogonalCorrectors")):
        nNonOrthCorr = readInt(piso.lookup(word("nNonOrthogonalCorrectors")))

    return piso, nNonOrthCorr
Esempio n. 9
0
def readPIMPLEControls( mesh ):
    from Foam.OpenFOAM import Switch
    from Foam.OpenFOAM import word
    from Foam.OpenFOAM import readInt
    
    pimple = mesh.solutionDict().subDict( word( "PIMPLE" ) )
    
    nOuterCorr = readInt( pimple.lookup( word( "nOuterCorrectors" ) ) ) 
    
    nCorr =  readInt( pimple.lookup( word( "nCorrectors" ) ) )
    
    nNonOrthCorr = pimple.lookupOrDefault( word( "nNonOrthogonalCorrectors" ), 0 )

    momentumPredictor = pimple.lookupOrDefault( word( "momentumPredictor" ), Switch( True ) )

    transonic = pimple.lookupOrDefault( word( "transonic" ), Switch( False ) )
    
    return pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic
Esempio n. 10
0
def readPIMPLEControls( mesh ):
    from Foam.OpenFOAM import Switch
    from Foam.OpenFOAM import word
    from Foam.OpenFOAM import readInt
    
    pimple = mesh.solutionDict().subDict( word( "PIMPLE" ) )
    
    nOuterCorr = readInt( pimple.lookup( word( "nOuterCorrectors" ) ) ) 
    
    nCorr =  readInt( pimple.lookup( word( "nCorrectors" ) ) )
    
    nNonOrthCorr = pimple.lookupOrDefault( word( "nNonOrthogonalCorrectors" ), 0 )

    momentumPredictor = pimple.lookupOrDefault( word( "momentumPredictor" ), Switch( True ) )

    transonic = pimple.lookupOrDefault( word( "transonic" ), Switch( False ) )
    
    return pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic
Esempio n. 11
0
def readFluidMultiRegionPIMPLEControls( mesh ) :
    
    from Foam.OpenFOAM import word, readInt, Switch
    pimple = mesh.solutionDict().subDict( word( "PIMPLE" ) )
    nCorr = readInt( pimple.lookup( word( "nCorrectors" ) ) )
    nNonOrthCorr = pimple.lookupOrDefault( word( "nNonOrthogonalCorrectors" ), 0 )
    momentumPredictor =pimple.lookupOrDefault( word( "momentumPredictor" ), Switch( True ) )
    
    return pimple, nCorr, nNonOrthCorr, momentumPredictor
Esempio n. 12
0
def create_fields( runTime, mesh ):
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "Reading field p\n" << nl
    
    from Foam.OpenFOAM import IOobject, word, fileName
    from Foam.finiteVolume import volScalarField
    p = volScalarField( IOobject( word( "p" ),
                                  fileName( runTime.timeName() ),
                                  mesh,
                                  IOobject.MUST_READ,
                                  IOobject.AUTO_WRITE ),
                        mesh )

    ext_Info() << "Reading field U\n" << nl
    from Foam.finiteVolume import volVectorField
    U = volVectorField( IOobject( word( "U" ),
                                  fileName( runTime.timeName() ),
                                  mesh,
                                  IOobject.MUST_READ,
                                  IOobject.AUTO_WRITE ),
                        mesh )

    from Foam.finiteVolume.cfdTools.incompressible import createPhi
    phi = createPhi( runTime, mesh, U )

    pRefCell = 0
    pRefValue = 0.0
    
    from Foam.finiteVolume import setRefCell
    pRefCell, pRefValue = setRefCell( p, mesh.solutionDict().subDict( word( "SIMPLE" ) ), pRefCell, pRefValue )

    from Foam.transportModels import singlePhaseTransportModel
    laminarTransport = singlePhaseTransportModel( U, phi )

    from Foam import incompressible
    turbulence = incompressible.RASModel.New( U, phi, laminarTransport )

    from Foam.finiteVolume import porousZones
    pZones = porousZones( mesh )
    
    from Foam.OpenFOAM import Switch
    pressureImplicitPorosity = Switch( False )

    nUCorr = 0
    if pZones.size():
       # nUCorrectors for pressureImplicitPorosity
       if (mesh.solutionDict().subDict( word( "SIMPLE" ) ).found( word( "nUCorrectors" ) ) ) :
          from Foam.OpenFOAM import readInt
          nUCorr = readInt( mesh.solutionDict().subDict( word( "SIMPLE" ) ).lookup( word( "nUCorrectors" ) ) )
          pass
       if nUCorr > 0 :
          pressureImplicitPorosity = True
          pass
       pass

    return p, U, phi, pRefCell, pRefValue, laminarTransport, turbulence, pZones, pressureImplicitPorosity, nUCorr
Esempio n. 13
0
def readPIMPLEControls( runTime ):

    from Foam.finiteVolume import fvSolution
    solutionDict = fvSolution( runTime )
    
    from Foam.OpenFOAM import word,readInt
    pimple = solutionDict.subDict( word( "PIMPLE" ) )
    nOuterCorr = readInt( pimple.lookup( word( "nOuterCorrectors" ) ) )
    
    return nOuterCorr
Esempio n. 14
0
def readPIMPLEControls(runTime):

    from Foam.finiteVolume import fvSolution
    solutionDict = fvSolution(runTime)

    from Foam.OpenFOAM import word, readInt
    pimple = solutionDict.subDict(word("PIMPLE"))
    nOuterCorr = readInt(pimple.lookup(word("nOuterCorrectors")))

    return nOuterCorr
Esempio n. 15
0
def create_fields(runTime, mesh):
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "Reading field p\n" << nl

    from Foam.OpenFOAM import IOobject, word, fileName
    from Foam.finiteVolume import volScalarField
    p = volScalarField(
        IOobject(word("p"), fileName(runTime.timeName()), mesh,
                 IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh)

    ext_Info() << "Reading field U\n" << nl
    from Foam.finiteVolume import volVectorField
    U = volVectorField(
        IOobject(word("U"), fileName(runTime.timeName()), mesh,
                 IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh)

    from Foam.finiteVolume.cfdTools.incompressible import createPhi
    phi = createPhi(runTime, mesh, U)

    pRefCell = 0
    pRefValue = 0.0

    from Foam.finiteVolume import setRefCell
    pRefCell, pRefValue = setRefCell(
        p,
        mesh.solutionDict().subDict(word("SIMPLE")), pRefCell, pRefValue)

    from Foam.transportModels import singlePhaseTransportModel
    laminarTransport = singlePhaseTransportModel(U, phi)

    from Foam import incompressible
    turbulence = incompressible.RASModel.New(U, phi, laminarTransport)

    from Foam.finiteVolume import porousZones
    pZones = porousZones(mesh)

    from Foam.OpenFOAM import Switch
    pressureImplicitPorosity = Switch(False)

    nUCorr = 0
    if pZones.size():
        # nUCorrectors for pressureImplicitPorosity
        if (mesh.solutionDict().subDict(word("SIMPLE")).found(
                word("nUCorrectors"))):
            from Foam.OpenFOAM import readInt
            nUCorr = readInt(mesh.solutionDict().subDict(
                word("SIMPLE")).lookup(word("nUCorrectors")))
            pass
        if nUCorr > 0:
            pressureImplicitPorosity = True
            pass
        pass

    return p, U, phi, pRefCell, pRefValue, laminarTransport, turbulence, pZones, pressureImplicitPorosity, nUCorr
def readPISOControls_010600_dev( mesh ):
    from Foam.OpenFOAM import dictionary, readInt, Switch, word

    piso = dictionary( mesh.solutionDict().subDict( word( "PISO" ) ) )
    nCorr = readInt( piso.lookup( word( "nCorrectors" ) ) )
    
    nNonOrthCorr = piso.lookupOrDefault( word( "nNonOrthogonalCorrectors" ), 0 )
       
    momentumPredictor = piso.lookupOrDefault( word( "momentumPredictor" ), Switch( True ) )
      
    transonic = piso.lookupOrDefault( word( "transonic" ), Switch( False ) )
      
    nOuterCorr = piso.lookupOrDefault( word( "nOuterCorrectors" ), 1 )

    return piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr
def readPISOControls_010600_dev(mesh):
    from Foam.OpenFOAM import dictionary, readInt, Switch, word

    piso = dictionary(mesh.solutionDict().subDict(word("PISO")))
    nCorr = readInt(piso.lookup(word("nCorrectors")))

    nNonOrthCorr = piso.lookupOrDefault(word("nNonOrthogonalCorrectors"), 0)

    momentumPredictor = piso.lookupOrDefault(word("momentumPredictor"),
                                             Switch(True))

    transonic = piso.lookupOrDefault(word("transonic"), Switch(False))

    nOuterCorr = piso.lookupOrDefault(word("nOuterCorrectors"), 1)

    return piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr
Esempio n. 18
0
def readStressedFoamControls( mesh):
    from Foam.OpenFOAM import word
    stressControl = mesh.solutionDict().subDict( word( "stressedFoam" ) )
    
    from Foam.OpenFOAM import readInt
    nCorr = readInt( stressControl.lookup( word( "nCorrectors" ) ) )
    
    from Foam.OpenFOAM import readScalar
    convergenceTolerance = readScalar(stressControl.lookup( word( "U" ) ) )
    
    from materialModels.componentReference import componentReference
#    from Foam.template import PtrList
#    cr = PtrList( componentReference )( stressControl.lookup( word( "componentReference" ) ), componentReference.iNew(mesh) )
    
    from Foam.template import PtrList
    cr = PtrList( stressControl.lookup( word( "componentReference" ) ), componentReference.iNew(mesh) )
    
    return stressControl, nCorr, convergenceTolerance, cr
Esempio n. 19
0
def readStressedFoamControls(mesh):
    from Foam.OpenFOAM import word
    stressControl = mesh.solutionDict().subDict(word("stressedFoam"))

    from Foam.OpenFOAM import readInt
    nCorr = readInt(stressControl.lookup(word("nCorrectors")))

    from Foam.OpenFOAM import readScalar
    convergenceTolerance = readScalar(stressControl.lookup(word("U")))

    from materialModels.componentReference import componentReference
    #    from Foam.template import PtrList
    #    cr = PtrList( componentReference )( stressControl.lookup( word( "componentReference" ) ), componentReference.iNew(mesh) )

    from Foam.template import PtrList
    cr = PtrList(stressControl.lookup(word("componentReference")),
                 componentReference.iNew(mesh))

    return stressControl, nCorr, convergenceTolerance, cr
Esempio n. 20
0
def _createFields(runTime, mesh):
    from Foam.OpenFOAM import ext_Info, nl

    ext_Info() << "Reading thermophysical properties\n" << nl

    from Foam.thermophysicalModels import basicPsiThermo, autoPtr_basicPsiThermo

    thermo = basicPsiThermo.New(mesh)

    from Foam.OpenFOAM import IOdictionary, IOobject, word, fileName
    from Foam.finiteVolume import volScalarField

    rho = volScalarField(
        IOobject(word("rho"), fileName(runTime.timeName()), mesh, IOobject.READ_IF_PRESENT, IOobject.AUTO_WRITE),
        thermo.rho(),
    )
    p = thermo.p()
    h = thermo.h()
    psi = thermo.psi()

    ext_Info() << "Reading field U\n" << nl
    from Foam.finiteVolume import volVectorField

    U = volVectorField(
        IOobject(word("U"), fileName(runTime.timeName()), mesh, IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh
    )

    from Foam.finiteVolume.cfdTools.compressible import compressibleCreatePhi

    phi = compressibleCreatePhi(runTime, mesh, rho, U)

    pRefCell = 0
    pRefValue = 0.0
    from Foam.finiteVolume import setRefCell

    pRefCell, pRefValue = setRefCell(p, mesh.solutionDict().subDict(word("SIMPLE")), pRefCell, pRefValue)

    from Foam.OpenFOAM import dimensionedScalar

    pMin = dimensionedScalar(mesh.solutionDict().subDict(word("SIMPLE")).lookup(word("pMin")))

    ext_Info() << "Creating turbulence model\n" << nl
    from Foam import compressible

    turbulence = compressible.RASModel.New(rho, U, phi, thermo())

    from Foam import fvc

    initialMass = fvc.domainIntegrate(rho)

    from Foam.finiteVolume import porousZones

    pZones = porousZones(mesh)

    from Foam.OpenFOAM import Switch

    pressureImplicitPorosity = Switch(False)

    nUCorr = 0

    if pZones.size():
        # nUCorrectors for pressureImplicitPorosity
        if mesh.solutionDict().subDict(word("SIMPLE")).found(word("nUCorrectors")):
            from Foam.OpenFOAM import readInt

            nUCorr = readInt(mesh.solutionDict().subDict(word("SIMPLE")).lookup(word("nUCorrectors")))
            pass
        if nUCorr > 0:
            pressureImplicitPorosity = True
            pass
        pass

    return (
        p,
        h,
        psi,
        rho,
        U,
        phi,
        turbulence,
        thermo,
        pZones,
        pMin,
        pressureImplicitPorosity,
        initialMass,
        nUCorr,
        pRefCell,
        pRefValue,
    )
Esempio n. 21
0
def _createFields(runTime, mesh):
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "Reading thermophysical properties\n" << nl

    from Foam.thermophysicalModels import basicThermo, autoPtr_basicThermo
    thermo = basicThermo.New(mesh)

    from Foam.OpenFOAM import IOdictionary, IOobject, word, fileName
    from Foam.finiteVolume import volScalarField
    rho = volScalarField(
        IOobject(word("rho"), fileName(runTime.timeName()), mesh,
                 IOobject.READ_IF_PRESENT, IOobject.AUTO_WRITE), thermo.rho())
    p = thermo.p()
    h = thermo.h()

    ext_Info() << "Reading field U\n" << nl
    from Foam.finiteVolume import volVectorField
    U = volVectorField(
        IOobject(word("U"), fileName(runTime.timeName()), mesh,
                 IOobject.MUST_READ, IOobject.AUTO_WRITE), mesh)

    from Foam.finiteVolume.cfdTools.compressible import compressibleCreatePhi
    phi = compressibleCreatePhi(runTime, mesh, rho, U)

    pRefCell = 0
    pRefValue = 0.0
    from Foam.finiteVolume import setRefCell
    pRefCell, pRefValue = setRefCell(
        p,
        mesh.solutionDict().subDict(word("SIMPLE")), pRefCell, pRefValue)

    from Foam.OpenFOAM import dimensionedScalar
    pMin = dimensionedScalar(mesh.solutionDict().subDict(
        word("SIMPLE")).lookup(word("pMin")))

    ext_Info() << "Creating turbulence model\n" << nl
    from Foam import compressible
    turbulence = compressible.RASModel.New(rho, U, phi, thermo())

    from Foam import fvc
    initialMass = fvc.domainIntegrate(rho)

    from Foam.finiteVolume import porousZones
    pZones = porousZones(mesh)

    from Foam.OpenFOAM import Switch
    pressureImplicitPorosity = Switch(False)

    nUCorr = 0

    if pZones.size():
        # nUCorrectors for pressureImplicitPorosity
        if (mesh.solutionDict().subDict(word("SIMPLE")).found(
                word("nUCorrectors"))):
            from Foam.OpenFOAM import readInt
            nUCorr = readInt(mesh.solutionDict().subDict(
                word("SIMPLE")).lookup(word("nUCorrectors")))
            pass
        if nUCorr > 0:
            pressureImplicitPorosity = True
            pass
        pass

    return turbulence, p, h, rho, U, phi, thermo, pZones, pMin, pressureImplicitPorosity, initialMass, nUCorr, pRefCell, pRefValue