コード例 #1
0
def _createFields( runTime, mesh ):
        
    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField( man.IOobject( ref.word( "p" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )
    
    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )
    
    phi = man.createPhi( runTime, mesh, U )
    
    fluid = man.singlePhaseTransportModel( U, phi )
    
    pRefCell = 0
    pRefValue = 0.0
    
    pRefCell, pRefValue = ref.setRefCell( p, mesh.solutionDict().subDict( ref.word( "PISO" ) ), pRefCell, pRefValue )

        
    return p, U, phi, fluid, pRefCell, pRefValue
コード例 #2
0
ファイル: __init__.py プロジェクト: asimurzin/sonicLiquidFlux
def createFields( runTime, mesh, rhoO, psi ):
    ref.ext_Info()<< "Reading field p\n" << ref.nl
    p = man.volScalarField( man.IOobject( ref.word( "p" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )


    ref.ext_Info()<< "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )
    
    rho = man.volScalarField( man.IOobject( ref.word( "rho" ),
                                            ref.fileName( runTime.timeName() ),
                                            mesh,
                                            ref.IOobject.NO_READ,
                                            ref.IOobject.AUTO_WRITE ),
                              rhoO + psi * p )
  
    phi = man.compressibleCreatePhi( runTime, mesh, U, rho )
  
    return p, U, rho, phi
コード例 #3
0
ファイル: __init__.py プロジェクト: asimurzin/icoFlux
def createFields( runTime, mesh ):
    ref.ext_Info() << "Reading transportProperties\n"

    transportProperties = man.IOdictionary( man.IOobject( ref.word( "transportProperties" ),
                                                          ref.fileName( runTime.constant() ),
                                                          mesh,
                                                          ref.IOobject.MUST_READ_IF_MODIFIED,
                                                          ref.IOobject.NO_WRITE ) )

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

    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField( man.IOobject( ref.word( "p" ),
                                          ref.fileName( runTime.timeName() ), 
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ), mesh );


    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ), mesh );

    phi = man.createPhi( runTime, mesh, U )

    pRefCell = 0
    pRefValue = 0.0
   
    pRefCell, pRefValue = ref.setRefCell( p, mesh.solutionDict().subDict( ref.word( "PISO" ) ), pRefCell, pRefValue )

    return transportProperties, nu, p, U, phi, pRefCell, pRefValue
コード例 #4
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleDyMFlux
def _createFields(runTime, mesh):

    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField(
        man.IOobject(ref.word("p"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    phi = man.createPhi(runTime, mesh, U)

    pRefCell = 0
    pRefValue = 0.0

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

    laminarTransport = man.singlePhaseTransportModel(U, phi)

    turbulence = man.incompressible.turbulenceModel.New(
        U, phi, laminarTransport)

    ref.ext_Info() << "Reading field rAU if present\n" << ref.nl
    rAU = man.volScalarField(
        man.IOobject(ref.word("rAU"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.READ_IF_PRESENT, ref.IOobject.AUTO_WRITE),
        mesh, runTime.deltaT(), ref.zeroGradientFvPatchScalarField.typeName)

    sources = man.IObasicSourceList(mesh)

    return p, U, phi, laminarTransport, turbulence, rAU, pRefCell, pRefValue, sources
コード例 #5
0
ファイル: __init__.py プロジェクト: asimurzin/sonicFlux
def createFields( runTime, mesh):
    
    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl
  
    pThermo = man.basicPsiThermo.New( mesh )
  
    p = man.volScalarField( pThermo.p(), man.Deps( pThermo ) )
    e = man.volScalarField( pThermo.e(), man.Deps( pThermo ) )
    psi = man.volScalarField( pThermo.psi(), man.Deps( pThermo ) )

    rho = man.volScalarField( man.IOobject( ref.word( "rho" ),
                                            ref.fileName( runTime.timeName() ),
                                            mesh ),
                              man.volScalarField( pThermo.rho(), man.Deps( pThermo ) ) )

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ), mesh );

    phi = man.compressibleCreatePhi( runTime, mesh, rho, U )
 
    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.turbulenceModel.New( rho, U, phi, pThermo )
    
    return pThermo, p, e, psi, rho, U, phi, turbulence
コード例 #6
0
def createFields(runTime, mesh, pimple):
    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl

    pThermo = man.basicPsiThermo.New(mesh)

    p = man.volScalarField(pThermo.p(), man.Deps(pThermo))
    h = man.volScalarField(pThermo.h(), man.Deps(pThermo))
    psi = man.volScalarField(pThermo.psi(), man.Deps(pThermo))

    rho = man.volScalarField(
        man.IOobject(ref.word("rho"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.READ_IF_PRESENT, ref.IOobject.AUTO_WRITE),
        man.volScalarField(pThermo.rho(), man.Deps(pThermo)))

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

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

    rhoMax = ref.dimensionedScalar(pimple.dict().lookup(ref.word("rhoMax")))
    rhoMin = ref.dimensionedScalar(pimple.dict().lookup(ref.word("rhoMin")))

    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.turbulenceModel.New(rho, U, phi, pThermo)

    ref.ext_Info() << "Creating field dpdt\n" << ref.nl
    dpdt = man.volScalarField(ref.word("dpdt"), man.fvc.ddt(p))

    ref.ext_Info() << "Creating field kinetic energy K\n" << ref.nl
    K = man.volScalarField(ref.word("K"),
                           man.volScalarField(0.5 * U.magSqr(), man.Deps(U)))

    return pThermo, p, h, psi, rho, U, phi, rhoMax, rhoMin, turbulence, dpdt, K
コード例 #7
0
ファイル: __init__.py プロジェクト: asimurzin/potentialFlux
def _createFields(runTime, mesh, potentialFlow):

    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField(
        man.IOobject(
            ref.word("p"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE
        ),
        mesh,
    )

    p << ref.dimensionedScalar(ref.word("zero"), p.dimensions(), 0.0)

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(
            ref.word("U"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE
        ),
        mesh,
    )

    U << ref.dimensionedVector(ref.word("0"), U.dimensions(), ref.vector.zero)

    phi = man.surfaceScalarField(
        man.IOobject(
            ref.word("phi"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE
        ),
        man.fvc.interpolate(U) & man.surfaceVectorField(mesh.Sf(), man.Deps(mesh)),
    )

    pRefCell = 0
    pRefValue = 0.0

    pRefCell, pRefValue = ref.setRefCell(p, potentialFlow, pRefCell, pRefValue)

    return p, U, phi, pRefCell, pRefValue
コード例 #8
0
ファイル: __init__.py プロジェクト: asimurzin/potentialFlux
def _createFields(runTime, mesh, potentialFlow, args):

    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField(
        man.IOobject(ref.word("p"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE), mesh)

    p << ref.dimensionedScalar(ref.word("zero"), p.dimensions(), 0.0)

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    U << ref.dimensionedVector(ref.word("0"), U.dimensions(), ref.vector.zero)

    phi = man.surfaceScalarField(
        man.IOobject(ref.word("phi"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
        man.fvc.interpolate(U)
        & man.surfaceVectorField(mesh.Sf(), man.Deps(mesh)))

    if args.optionFound(ref.word("initialiseUBCs")):
        U.correctBoundaryConditions()
        phi << (ref.fvc.interpolate(U) & mesh.Sf())
        pass

    pRefCell = 0
    pRefValue = 0.0

    pRefCell, pRefValue = ref.setRefCell(p, potentialFlow, pRefCell, pRefValue)

    return p, U, phi, pRefCell, pRefValue
コード例 #9
0
def _createFields( runTime, mesh ):
    ref.ext_Info() << "Reading field T\n" << ref.nl
    T = man.volScalarField( man.IOobject( ref.word( "T" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                             mesh )

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )


    ref.ext_Info() << "Reading transportProperties\n" << ref.nl
    transportProperties = man.IOdictionary( man.IOobject( ref.word( "transportProperties" ),
                                                          ref.fileName( runTime.constant() ),
                                                          mesh,
                                                          ref.IOobject.MUST_READ_IF_MODIFIED,
                                                          ref.IOobject.NO_WRITE ) )


    ref.ext_Info() << "Reading diffusivity D\n" << ref.nl

    DT = ref.dimensionedScalar( transportProperties.lookup( ref.word( "DT" ) ) )

    phi = man.createPhi( runTime, mesh, U )
           
    return T, U, transportProperties, DT, phi 
コード例 #10
0
def _createFields(runTime, mesh):
    ref.ext_Info() << "Reading field T\n" << ref.nl
    T = man.volScalarField(
        man.IOobject(ref.word("T"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    ref.ext_Info() << "Reading transportProperties\n" << ref.nl
    transportProperties = man.IOdictionary(
        man.IOobject(ref.word("transportProperties"),
                     ref.fileName(runTime.constant()), mesh,
                     ref.IOobject.MUST_READ_IF_MODIFIED,
                     ref.IOobject.NO_WRITE))

    ref.ext_Info() << "Reading diffusivity D\n" << ref.nl

    DT = ref.dimensionedScalar(transportProperties.lookup(ref.word("DT")))

    phi = man.createPhi(runTime, mesh, U)

    return T, U, transportProperties, DT, phi
コード例 #11
0
ファイル: __init__.py プロジェクト: asimurzin/boundaryFlux
def _createFields(runTime, mesh):

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    ref.ext_Info() << "Creating face flux\n" << ref.nl
    phi = man.surfaceScalarField(
        man.IOobject(ref.word("phi"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), mesh,
        ref.dimensionedScalar(ref.word("zero"),
                              mesh.Sf().dimensions() * U.dimensions(), 0.0))

    laminarTransport = man.singlePhaseTransportModel(U, phi)

    turbulence = man.incompressible.RASModel.New(U, phi, laminarTransport)

    transportProperties = man.IOdictionary(
        man.IOobject(ref.word("transportProperties"),
                     ref.fileName(runTime.constant()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE))
    Ubar = ref.dimensionedVector(transportProperties.lookup(ref.word("Ubar")))

    flowDirection = (Ubar / Ubar.mag()).ext_value()
    flowMask = flowDirection.sqr()

    gradP = ref.dimensionedVector(ref.word("gradP"),
                                  ref.dimensionSet(0.0, 1.0, -2.0, 0.0, 0.0),
                                  ref.vector(0.0, 0.0, 0.0))

    return U, phi, laminarTransport, turbulence, Ubar, gradP, flowDirection, flowMask
コード例 #12
0
def _createFields(runTime, mesh):

    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField(
        man.IOobject(ref.word("p"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    ref.ext_Info() << "Reading field U\n" << ref.nl

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

    phi = man.createPhi(runTime, mesh, U)

    pRefCell = 0
    pRefValue = 0.0

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

    laminarTransport = man.singlePhaseTransportModel(U, phi)

    turbulence = man.incompressible.turbulenceModel.New(
        U, phi, laminarTransport)

    return p, U, phi, turbulence, pRefCell, pRefValue, laminarTransport
コード例 #13
0
ファイル: __init__.py プロジェクト: asimurzin/pisoFlux
def _createFields(runTime, mesh):

    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField(
        man.IOobject(
            ref.word("p"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE
        ),
        mesh,
    )

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(
            ref.word("U"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE
        ),
        mesh,
    )

    phi = man.createPhi(runTime, mesh, U)

    pRefCell = 0
    pRefValue = 0.0

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

    laminarTransport = man.singlePhaseTransportModel(U, phi)

    turbulence = man.incompressible.turbulenceModel.New(U, phi, laminarTransport)

    return p, U, phi, turbulence, pRefCell, pRefValue, laminarTransport
コード例 #14
0
ファイル: __init__.py プロジェクト: asimurzin/laplacianFlux
def write( runTime, mesh, T ):
    if runTime.outputTime():
        gradT = ref.fvc.grad(T)
       
        gradTx = ref.volScalarField( ref.IOobject( ref.word( "gradTx" ), 
                                                   ref.fileName( runTime.timeName() ),
                                                   mesh,
                                                   ref.IOobject.NO_READ,
                                                   ref.IOobject.AUTO_WRITE ),
                                     gradT.component( ref.vector.X ) )
      
        gradTy = ref.volScalarField( ref.IOobject( ref.word( "gradTy" ),
                                                   ref.fileName( runTime.timeName() ),
                                                   mesh,
                                                   ref.IOobject.NO_READ,
                                                   ref.IOobject.AUTO_WRITE ),
                                     gradT.component( ref.vector.Y ) )

        gradTz = ref.volScalarField( ref.IOobject( ref.word( "gradTz" ),
                                           ref.fileName( runTime.timeName() ),
                                           mesh,
                                           ref.IOobject.NO_READ,
                                           ref.IOobject.AUTO_WRITE ),
                                 gradT.component( ref.vector.Z ) )
        runTime.write()
        pass
コード例 #15
0
def createFields(runTime, mesh):

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

    pThermo = man.basicPsiThermo.New(mesh)

    p = man.volScalarField(pThermo.p(), man.Deps(pThermo))
    e = man.volScalarField(pThermo.e(), man.Deps(pThermo))
    psi = man.volScalarField(pThermo.psi(), man.Deps(pThermo))

    rho = man.volScalarField(
        man.IOobject(ref.word("rho"), ref.fileName(runTime.timeName()), mesh),
        man.volScalarField(pThermo.rho(), man.Deps(pThermo)))

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

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

    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.turbulenceModel.New(rho, U, phi, pThermo)

    return pThermo, p, e, psi, rho, U, phi, turbulence
コード例 #16
0
ファイル: __init__.py プロジェクト: asimurzin/channelFlux
def writeGradP( runTime, gradP ):
    if runTime.outputTime():
       gradPFile = ref.OFstream( runTime.path()/ref.fileName( runTime.timeName() )/ref.fileName( "uniform" )/ref.fileName( "gradP.raw" ) )
       
       if gradPFile.good():
          gradPFile << gradP << ref.nl
          pass
       else:
          ref.ext_Info() << "Cannot open file " << runTime.path()/ref.fileName( runTime.timeName() )/ref.fileName( "uniform" )/ref.fileName( "gradP.raw" )
          import os
          os.abort()
コード例 #17
0
def createFields( runTime, mesh, g ):
    
    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl
    
    pThermo = man.basicPsiThermo.New( mesh );

    rho = man.volScalarField( man.IOobject( ref.word( "rho" ), 
                                            ref.fileName( runTime.timeName() ),
                                            mesh, 
                                            ref.IOobject.NO_READ, 
                                            ref.IOobject.NO_WRITE ),
                              man( pThermo.rho(), man.Deps( pThermo ) ) );
    
    p = man( pThermo.p(), man.Deps( pThermo ) )
    h = man( pThermo.h(), man.Deps( pThermo ) )
    psi = man( pThermo.psi(), man.Deps( pThermo ) )
    
    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                              mesh )
    
    phi = man.compressibleCreatePhi( runTime, mesh, rho, U );

    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.RASModel.New( rho, U,  phi, pThermo );

    ref.ext_Info()<< "Calculating field g.h\n" << ref.nl
    
    gh = man.volScalarField( ref.word( "gh" ), man( g & mesh.C(), man.Deps( mesh ) ) )
    ghf = man.surfaceScalarField( ref.word( "ghf" ), man( g & mesh.Cf(), man.Deps( mesh ) ) )
    
    ref.ext_Info() << "Reading field p_rgh\n" << ref.nl
    p_rgh = man.volScalarField( man.IOobject( ref.word( "p_rgh" ),
                                              ref.fileName( runTime.timeName() ),
                                              mesh,
                                              ref.IOobject.MUST_READ,
                                              ref.IOobject.AUTO_WRITE ),
                                mesh );
    # Force p_rgh to be consistent with p
    p_rgh << p - rho * gh
    
    pRefCell = 0
    pRefValue = 0.0
    
    pRefCell, pRefValue = ref.setRefCell( p, p_rgh, mesh.solutionDict().subDict( ref.word( "SIMPLE" ) ), pRefCell, pRefValue );

    initialMass = ref.fvc.domainIntegrate( rho )
    totalVolume = mesh.V().ext_sum()
    
    return pThermo, rho, p, h, psi, U, phi, turbulence, gh, ghf, p_rgh, pRefCell, pRefValue, initialMass, totalVolume
コード例 #18
0
def createFields(runTime, mesh, g):
    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl

    pThermo = man.basicRhoThermo.New(mesh)

    rho = man.volScalarField(
        man.IOobject(
            ref.word("rho"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.NO_READ, ref.IOobject.NO_WRITE
        ),
        man.volScalarField(pThermo.rho(), man.Deps(pThermo)),
    )

    p = man.volScalarField(pThermo.p(), man.Deps(pThermo))
    h = man.volScalarField(pThermo.h(), man.Deps(pThermo))
    psi = man.volScalarField(pThermo.psi(), man.Deps(pThermo))

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(
            ref.word("U"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE
        ),
        mesh,
    )

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

    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.turbulenceModel.New(rho, U, phi, pThermo)

    ref.ext_Info() << "Calculating field g.h\n" << ref.nl
    gh = man.volScalarField(ref.word("gh"), man.volScalarField(g & mesh.C(), man.Deps(mesh)))
    ghf = man.surfaceScalarField(ref.word("ghf"), man.surfaceScalarField(g & mesh.Cf(), man.Deps(mesh)))

    ref.ext_Info() << "Reading field p_rgh\n" << ref.nl
    p_rgh = man.volScalarField(
        man.IOobject(
            ref.word("p_rgh"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE
        ),
        mesh,
    )

    # Force p_rgh to be consistent with p
    p_rgh << p - rho * gh

    ref.ext_Info() << "Creating field DpDt\n" << ref.nl

    DpDt = man.volScalarField(
        ref.word("DpDt"), man.fvc.DDt(man.surfaceScalarField(ref.word("phiU"), phi / man.fvc.interpolate(rho)), p)
    )

    return pThermo, p, rho, h, psi, U, phi, turbulence, gh, ghf, p_rgh, DpDt
コード例 #19
0
def _createFields( runTime, mesh ):
    
    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField( man.IOobject( ref.word( "p" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )
    
    ref.ext_Info() << "Reading field Urel\n" << ref.nl

    Urel = man.volVectorField( man.IOobject( ref.word( "Urel" ),
                                             ref.fileName( runTime.timeName() ),
                                             mesh,
                                             ref.IOobject.MUST_READ,
                                             ref.IOobject.AUTO_WRITE ),
                               mesh )
  
    ref.ext_Info() << "Reading/calculating face flux field phi\n" << ref.nl
    phi = man.surfaceScalarField( man.IOobject( ref.word( "phi" ),
                                                ref.fileName( runTime.timeName() ),
                                                mesh,
                                                ref.IOobject.READ_IF_PRESENT,
                                                ref.IOobject.AUTO_WRITE ), 
                                  man.surfaceScalarField( ref.linearInterpolate( Urel ) & mesh.Sf(), man.Deps( mesh, Urel ) ) )
    
    pRefCell = 0
    pRefValue = 0.0
    
    pRefCell, pRefValue = ref.setRefCell( p, mesh.solutionDict().subDict( ref.word( "PIMPLE" ) ), pRefCell, pRefValue )
    
    laminarTransport = man.singlePhaseTransportModel( Urel, phi )
    
    turbulence = man.incompressible.turbulenceModel.New( Urel, phi, laminarTransport )
    
    ref.ext_Info() << "Creating SRF model\n" << ref.nl
    SRF = man.SRF.SRFModel.New( Urel ) 
    
    sources = man.IObasicSourceList( mesh )
    
    # Create the absolute velocity
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.NO_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            man.volVectorField( Urel() + SRF.U(), man.Deps( Urel, SRF ) ) ) # mixed  calculations

    return p, U, Urel, SRF, phi, turbulence, pRefCell, pRefValue, laminarTransport, sources
コード例 #20
0
def createFields(runTime, mesh, g):

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

    pThermo = man.basicPsiThermo.New(mesh)

    rho = man.volScalarField(
        man.IOobject(ref.word("rho"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE),
        man(pThermo.rho(), man.Deps(pThermo)))

    p = man(pThermo.p(), man.Deps(pThermo))
    h = man(pThermo.h(), man.Deps(pThermo))
    psi = man(pThermo.psi(), man.Deps(pThermo))

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

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

    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.RASModel.New(rho, U, phi, pThermo)

    ref.ext_Info() << "Calculating field g.h\n" << ref.nl

    gh = man.volScalarField(ref.word("gh"), man(g & mesh.C(), man.Deps(mesh)))
    ghf = man.surfaceScalarField(ref.word("ghf"),
                                 man(g & mesh.Cf(), man.Deps(mesh)))

    ref.ext_Info() << "Reading field p_rgh\n" << ref.nl
    p_rgh = man.volScalarField(
        man.IOobject(ref.word("p_rgh"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)
    # Force p_rgh to be consistent with p
    p_rgh << p - rho * gh

    pRefCell = 0
    pRefValue = 0.0

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

    initialMass = ref.fvc.domainIntegrate(rho)
    totalVolume = mesh.V().ext_sum()

    return pThermo, rho, p, h, psi, U, phi, turbulence, gh, ghf, p_rgh, pRefCell, pRefValue, initialMass, totalVolume
コード例 #21
0
def _createFields(runTime, mesh):

    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField(
        man.IOobject(ref.word("p"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    phi = man.createPhi(runTime, mesh, U)

    return p, U, phi
コード例 #22
0
def alphaEqns(runTime, mesh, rho1, rho2, rhoPhi, phic, dgdt, divU, alpha1,
              alpha2, phi, interface, nAlphaCorr):

    alphaScheme = ref.word("div(phi,alpha)")
    alpharScheme = ref.word("div(phirb,alpha)")

    phir = phic * interface.nHatf()

    for gCorr in range(nAlphaCorr):
        Sp = ref.volScalarField.DimensionedInternalField(
            ref.IOobject(ref.word("Sp"), ref.fileName(runTime.timeName()),
                         mesh), mesh,
            ref.dimensionedScalar(ref.word("Sp"), dgdt.dimensions(), 0.0))

        Su = ref.volScalarField.DimensionedInternalField(
            ref.IOobject(ref.word("Su"), ref.fileName(runTime.timeName()),
                         mesh),
            # Divergence term is handled explicitly to be
            # consistent with the explicit transport solution
            divU * alpha1.ext_min(1.0))
        for celli in range(dgdt.size()):
            if dgdt[celli] > 0.0 and alpha1[celli] > 0.0:
                Sp[celli] -= dgdt[celli] * alpha1[celli]
                Su[celli] += dgdt[celli] * alpha1[celli]
                pass
            elif dgdt[celli] < 0.0 and alpha1[celli] < 1.0:
                Sp[celli] += dgdt[celli] * (1.0 - alpha1[celli])
                pass
            pass

        phiAlpha1 = ref.fvc.flux(phi, alpha1, alphaScheme) + ref.fvc.flux(
            -ref.fvc.flux(-phir, alpha2, alpharScheme), alpha1, alpharScheme)

        ref.MULES.explicitSolve(ref.geometricOneField(), alpha1, phi,
                                phiAlpha1, Sp, Su, 1.0, 0.0)

        rho1f = ref.fvc.interpolate(rho1)
        rho2f = ref.fvc.interpolate(rho2)
        rhoPhi << phiAlpha1 * (rho1f - rho2f) + phi * rho2f

        alpha2 << 1.0 - alpha1

        pass

    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "Liquid phase volume fraction = " << alpha1.weightedAverage( mesh.V() ).value() \
               << "  Min(alpha1) = " << alpha1.ext_min().value() << "  Min(alpha2) = " << alpha2.ext_min().value() << nl
    pass
コード例 #23
0
    def _createFvSolution(self):
        """
        Creates fvSolution dictionary
        Currently not fully functional, format of "solvers" entries currently
        can't be written to file unless using stream objects. We need a
        workaround for this.
        """
        USolver = ref.dictionary()
        USolver.add(ref.word("preconditioner"), ref.word("DILU"))
        USolver.add(ref.word("minIter"), 0)
        USolver.add(ref.word("maxIter"), 1000)
        USolver.add(ref.word("tolerance"), 1e-5)
        USolver.add(ref.word("relTol"), 0)

        pSolver = ref.dictionary()
        pSolver.add(ref.word("preconditioner"), ref.word("DIC"))
        pSolver.add(ref.word("minIter"), 0)
        pSolver.add(ref.word("maxIter"), 1000)
        pSolver.add(ref.word("tolerance"), 1e-6)
        pSolver.add(ref.word("relTol"), 0)

        piso = ref.dictionary()
        piso.add(ref.word("nCorrectors"), 2)
        piso.add(ref.word("nNonOrthogonalCorrectors"), 0)

        fvSolnDict = ref.dictionary()
        fvSolnDict.add(ref.word("PISO"), piso)

        soln = ref.ext_solution(self.run_time, ref.fileName("fvSolution"), fvSolnDict)
        soln.setWriteOpt(ref.IOobject.AUTO_WRITE)

        soln.addSolver(ref.word("U"), ref.word("PBiCG"), USolver)
        soln.addSolver(ref.word("p"), ref.word("PCG"), pSolver)

        return soln
コード例 #24
0
ファイル: __init__.py プロジェクト: asimurzin/boundaryFlux
def makeGraphs( runTime, mesh, U, turbulence, faceId, patchId, nWallFaces, wallNormal, cellId, flowDirection, y ):
    R = ref.volSymmTensorField( ref.IOobject( ref.word( "R" ),
                                              ref.fileName( runTime.timeName() ),
                                              mesh(),
                                              ref.IOobject.NO_READ,
                                              ref.IOobject.AUTO_WRITE ),
                                turbulence.R() )

    runTime.write()
    
    gFormat = runTime.graphFormat()
    
    ref.makeGraph( y, flowDirection & U(), ref.word( "Uf" ), gFormat )
    
    ref.makeGraph( y, turbulence.ext_nu(), gFormat )
    ref.makeGraph( y, turbulence.ext_k(), gFormat )
    ref.makeGraph( y, turbulence.ext_epsilon(), gFormat )

    ref.makeGraph( y, flowDirection & R & flowDirection, ref.word( "Rff" ), gFormat )
    ref.makeGraph( y, wallNormal & R & wallNormal, ref.word( "Rww" ), gFormat )
    ref.makeGraph( y, flowDirection & R & wallNormal, ref.word( "Rfw" ), gFormat )

    ref.makeGraph( y, R.component( ref.symmTensor.XX ).mag().sqrt(), ref.word( "u" ), gFormat )
    ref.makeGraph( y, R.component( ref.symmTensor.YY ).mag().sqrt(), ref.word( "v" ), gFormat )
    ref.makeGraph( y, R.component( ref.symmTensor.ZZ ).mag().sqrt(), ref.word( "w" ), gFormat )
    ref.makeGraph( y, R.component( ref.symmTensor.XY ), ref.word( "uv" ), gFormat )

    ref.makeGraph( y, ref.fvc.grad( U ).mag(), ref.word( "gammaDot" ), gFormat )
    
    pass
コード例 #25
0
def readGravitationalAcceleration(runTime, mesh):
    ref.ext_Info() << "\nReading gravitationalProperties" << ref.nl

    gravitationalProperties = man.IOdictionary(
        man.IOobject(
            ref.word("gravitationalProperties"),
            ref.fileName(runTime.constant()),
            mesh,
            ref.IOobject.MUST_READ_IF_MODIFIED,
            ref.IOobject.NO_WRITE,
        )
    )

    g = ref.dimensionedVector(gravitationalProperties.lookup(ref.word("g")))
    rotating = ref.Switch(gravitationalProperties.lookup(ref.word("rotating")))

    if rotating:
        Omega = ref.dimensionedVector(gravitationalProperties.lookup(ref.word("Omega")))
    else:
        Omega = ref.dimensionedVector(ref.word("Omega"), -ref.dimTime, ref.vector(0, 0, 0))

    magg = g.mag()
    gHat = g / magg

    return gravitationalProperties, g, rotating, Omega, magg, gHat
コード例 #26
0
ファイル: __init__.py プロジェクト: asimurzin/channelFlux
def createGradP( runTime ):
    gradP = ref.dimensionedScalar( ref.word( "gradP" ),
                                   ref.dimensionSet( 0.0, 1.0, -2.0, 0.0, 0.0 ),
                                   0.0 )

    gradPFile = ref.IFstream( runTime.path()/ref.fileName( runTime.timeName() )/ref.fileName( "uniform" )/ ref.fileName( "gradP.raw" ) )
    
    if gradPFile.good():
       gradPFile >> gradP
       ref.ext_Info() << "Reading average pressure gradient" << ref.nl << ref.nl
       pass
    else:
       ref.ext_Info() << "Initializing with 0 pressure gradient" << ref.nl << ref.nl
       pass
    
    return gradP, gradPFile
コード例 #27
0
def createFvSolution(runTime):
    USolver = ref.dictionary()
    USolver.add(ref.word("preconditioner"), ref.word("DILU"))
    USolver.add(ref.word("minIter"), 0)
    USolver.add(ref.word("maxIter"), 1000)
    USolver.add(ref.word("tolerance"), 1E-5)
    USolver.add(ref.word("relTol"), 0)
    
    pSolver = ref.dictionary()
    pSolver.add(ref.word("preconditioner"), ref.word("DIC"))
    pSolver.add(ref.word("minIter"), 0)
    pSolver.add(ref.word("maxIter"), 1000)
    pSolver.add(ref.word("tolerance"), 1E-6)
    pSolver.add(ref.word("relTol"), 0)
    
    piso = ref.dictionary()
    piso.add(ref.word("nCorrectors"), 2)
    piso.add(ref.word("nNonOrthogonalCorrectors"), 0)
    
    fvSolnDict = ref.dictionary()
    fvSolnDict.add(ref.word("PISO"), piso)
    
    soln=ref.ext_solution(runTime, ref.fileName("fvSolution"), fvSolnDict)
    soln.setWriteOpt(ref.IOobject.AUTO_WRITE)
    soln.addSolver(ref.word("U"), ref.word("PBiCG"), USolver)
    soln.addSolver(ref.word("p"), ref.word("PCG"), pSolver)
    
    return soln
コード例 #28
0
def readGravitationalAcceleration(runTime, mesh):
    ref.ext_Info() << "\nReading g" << ref.nl

    g = ref.uniformDimensionedVectorField(
        ref.IOobject(ref.word("g"), ref.fileName(runTime.constant()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE))
    return g
コード例 #29
0
def createFields(runTime, mesh, g):
    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl

    pThermo = man.basicRhoThermo.New(mesh)

    rho = man.volScalarField(
        man.IOobject(ref.word("rho"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE),
        man.volScalarField(pThermo.rho(), man.Deps(pThermo)))

    p = man.volScalarField(pThermo.p(), man.Deps(pThermo))
    h = man.volScalarField(pThermo.h(), man.Deps(pThermo))
    psi = man.volScalarField(pThermo.psi(), man.Deps(pThermo))

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

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

    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.turbulenceModel.New(rho, U, phi, pThermo)

    ref.ext_Info() << "Calculating field g.h\n" << ref.nl
    gh = man.volScalarField(ref.word("gh"),
                            man.volScalarField(g & mesh.C(), man.Deps(mesh)))
    ghf = man.surfaceScalarField(
        ref.word("ghf"), man.surfaceScalarField(g & mesh.Cf(), man.Deps(mesh)))

    ref.ext_Info() << "Reading field p_rgh\n" << ref.nl
    p_rgh = man.volScalarField(
        man.IOobject(ref.word("p_rgh"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    # Force p_rgh to be consistent with p
    p_rgh << p - rho * gh

    ref.ext_Info() << "Creating field DpDt\n" << ref.nl

    DpDt = man.volScalarField(
        ref.word("DpDt"),
        man.fvc.DDt(
            man.surfaceScalarField(ref.word("phiU"),
                                   phi / man.fvc.interpolate(rho)), p))

    return pThermo, p, rho, h, psi, U, phi, turbulence, gh, ghf, p_rgh, DpDt
コード例 #30
0
def alphaEqns( runTime, mesh, rho1, rho2, rhoPhi, phic, dgdt, divU, alpha1, alpha2, phi, interface, nAlphaCorr ):

    alphaScheme = ref.word( "div(phi,alpha)" )
    alpharScheme = ref.word( "div(phirb,alpha)" )

    phir = phic*interface.nHatf()
    
    for gCorr in range( nAlphaCorr ):
        Sp = ref.volScalarField.DimensionedInternalField( ref.IOobject( ref.word( "Sp" ),
                                                                        ref.fileName( runTime.timeName() ),
                                                                        mesh ),
                                                           mesh,
                                                           ref.dimensionedScalar( ref.word( "Sp" ), dgdt.dimensions(), 0.0 ) )

        Su = ref.volScalarField.DimensionedInternalField( ref.IOobject( ref.word( "Su" ),
                                                                        ref.fileName( runTime.timeName() ),
                                                                        mesh ),
                                                          # Divergence term is handled explicitly to be
                                                          # consistent with the explicit transport solution
                                                          divU * alpha1.ext_min( 1.0 ) )
        for celli in range( dgdt.size() ):
            if dgdt[ celli ] > 0.0 and alpha1[ celli ] > 0.0:
                Sp[ celli ] -= dgdt[ celli ] * alpha1[ celli ]
                Su[ celli ] += dgdt[ celli ] * alpha1[ celli ]
                pass
            elif dgdt[ celli ] < 0.0 and alpha1[ celli ] < 1.0:
                Sp[ celli ] += dgdt[ celli ] * ( 1.0 - alpha1[ celli ] )
                pass
            pass

        phiAlpha1 = ref.fvc.flux( phi, alpha1, alphaScheme ) + ref.fvc.flux( - ref.fvc.flux( -phir, alpha2, alpharScheme ), alpha1, alpharScheme )
        
        ref.MULES.explicitSolve( ref.geometricOneField(), alpha1, phi, phiAlpha1, Sp, Su, 1.0, 0.0 )
        
        rho1f = ref.fvc.interpolate( rho1 )
        rho2f = ref.fvc.interpolate( rho2 )
        rhoPhi << phiAlpha1 * ( rho1f - rho2f ) + phi * rho2f

        alpha2 << 1.0 - alpha1

        pass

    
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "Liquid phase volume fraction = " << alpha1.weightedAverage( mesh.V() ).value() \
               << "  Min(alpha1) = " << alpha1.ext_min().value() << "  Min(alpha2) = " << alpha2.ext_min().value() << nl
    pass
コード例 #31
0
def createDynamicFvMesh_020000( runTime ):
    from Foam import ref
    ref.ext_Info() << "Create mesh for time = " << runTime.timeName() << ref.nl << ref.nl
    mesh = ref.dynamicFvMesh.New( ref.IOobject( ref.dynamicFvMesh.defaultRegion.fget(),
                                                ref.fileName( runTime.timeName() ),
                                                runTime,
                                                ref.IOobject.MUST_READ ) )

    return mesh
コード例 #32
0
def readGravitationalAcceleration( runTime, mesh ):
    ref.ext_Info() << "\nReading g" << ref.nl
    
    g= ref.uniformDimensionedVectorField( ref.IOobject( ref.word("g"),
                                                        ref.fileName( runTime.constant() ),
                                                        mesh,
                                                        ref.IOobject.MUST_READ,
                                                        ref.IOobject.NO_WRITE ) )
    return g
コード例 #33
0
def createDynamicFvMesh_020000(runTime):
    from Foam import ref
    ref.ext_Info() << "Create mesh for time = " << runTime.timeName(
    ) << ref.nl << ref.nl
    mesh = ref.dynamicFvMesh.New(
        ref.IOobject(ref.dynamicFvMesh.defaultRegion.fget(),
                     ref.fileName(runTime.timeName()), runTime,
                     ref.IOobject.MUST_READ))

    return mesh
コード例 #34
0
ファイル: __init__.py プロジェクト: asimurzin/rhoPimpleFlux
def createFields(runTime, mesh, pimple):
    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl

    pThermo = man.basicPsiThermo.New(mesh)

    p = man.volScalarField(pThermo.p(), man.Deps(pThermo))
    h = man.volScalarField(pThermo.h(), man.Deps(pThermo))
    psi = man.volScalarField(pThermo.psi(), man.Deps(pThermo))

    rho = man.volScalarField(
        man.IOobject(
            ref.word("rho"),
            ref.fileName(runTime.timeName()),
            mesh,
            ref.IOobject.READ_IF_PRESENT,
            ref.IOobject.AUTO_WRITE,
        ),
        man.volScalarField(pThermo.rho(), man.Deps(pThermo)),
    )

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(
            ref.word("U"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE
        ),
        mesh,
    )

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

    rhoMax = ref.dimensionedScalar(pimple.dict().lookup(ref.word("rhoMax")))
    rhoMin = ref.dimensionedScalar(pimple.dict().lookup(ref.word("rhoMin")))

    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.turbulenceModel.New(rho, U, phi, pThermo)

    ref.ext_Info() << "Creating field dpdt\n" << ref.nl
    dpdt = man.volScalarField(ref.word("dpdt"), man.fvc.ddt(p))

    ref.ext_Info() << "Creating field kinetic energy K\n" << ref.nl
    K = man.volScalarField(ref.word("K"), man.volScalarField(0.5 * U.magSqr(), man.Deps(U)))

    return pThermo, p, h, psi, rho, U, phi, rhoMax, rhoMin, turbulence, dpdt, K
コード例 #35
0
def createPhia(runTime, mesh, Ua):
    ref.ext_Info() << "Reading/calculating face flux field phia\n" << ref.nl

    phia = man.surfaceScalarField(
        man.IOobject(ref.word("phia"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.READ_IF_PRESENT, ref.IOobject.AUTO_WRITE),
        man.surfaceScalarField(
            ref.linearInterpolate(Ua) & mesh.Sf(), man.Deps(Ua, mesh)))

    return phia
コード例 #36
0
def setInitialrDeltaT(runTime, mesh, pimple):
    maxDeltaT = pimple.dict().lookupOrDefault(ref.word("maxDeltaT"), ref.GREAT)
    rDeltaT = man.volScalarField(
        man.IOobject(ref.word("rDeltaT"), ref.fileName(runTime.timeName()),
                     mesh, ref.IOobject.NO_READ,
                     ref.IOobject.AUTO_WRITE), mesh, 1.0 /
        ref.dimensionedScalar(ref.word("maxDeltaT"), ref.dimTime, maxDeltaT),
        ref.zeroGradientFvPatchScalarField.typeName)

    return maxDeltaT, rDeltaT
コード例 #37
0
def _createFields( runTime, mesh, simple ):
    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl
    
    thermo = man.basicPsiThermo.New( mesh )

    rho = man.volScalarField( man.IOobject( ref.word( "rho" ),
                                            ref.fileName( runTime.timeName() ),
                                            mesh,
                                            ref.IOobject.READ_IF_PRESENT,
                                            ref.IOobject.AUTO_WRITE ),
                              man.volScalarField( thermo.rho(), man.Deps( thermo ) ) )

    p = man.volScalarField( thermo.p(), man.Deps( thermo ) )
    h = man.volScalarField( thermo.h(), man.Deps( thermo ) )
    psi = man.volScalarField( thermo.psi(), man.Deps( thermo ) )
   
    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )

    phi = man.compressibleCreatePhi( runTime, mesh, rho, U )
    
    pRefCell = 0
    pRefValue = 0.0
    
    pRefCell, pRefValue = ref.setRefCell( p, simple.dict(), pRefCell, pRefValue )
    
    rhoMax = ref.dimensionedScalar( simple.dict().lookup( ref.word( "rhoMax" ) ) )
    rhoMin = ref.dimensionedScalar( simple.dict().lookup( ref.word( "rhoMin" ) ) )
    
    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.RASModel.New( rho,
                                                U,
                                                phi,
                                                thermo )
    
    initialMass = ref.fvc.domainIntegrate( rho )
    
    return thermo, rho, p, h, psi, U, phi, pRefCell, pRefValue, turbulence, initialMass, rhoMax, rhoMin
コード例 #38
0
def _createFields( runTime, mesh, simple ):
    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl
    
    thermo = man.basicPsiThermo.New( mesh )

    rho = man.volScalarField( man.IOobject( ref.word( "rho" ),
                                            ref.fileName( runTime.timeName() ),
                                            mesh,
                                            ref.IOobject.READ_IF_PRESENT,
                                            ref.IOobject.AUTO_WRITE ),
                              man.volScalarField( thermo.rho(), man.Deps( thermo ) ) )

    p = man.volScalarField( thermo.p(), man.Deps( thermo ) )
    h = man.volScalarField( thermo.h(), man.Deps( thermo ) )
    psi = man.volScalarField( thermo.psi(), man.Deps( thermo ) )
   
    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )

    phi = man.compressibleCreatePhi( runTime, mesh, rho, U )
    
    pRefCell = 0
    pRefValue = 0.0
    
    pRefCell, pRefValue = ref.setRefCell( p, simple.dict(), pRefCell, pRefValue )
    
    rhoMax = ref.dimensionedScalar( simple.dict().lookup( ref.word( "rhoMax" ) ) )
    rhoMin = ref.dimensionedScalar( simple.dict().lookup( ref.word( "rhoMin" ) ) )
    
    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.RASModel.New( rho,
                                                U,
                                                phi,
                                                thermo )
    
    initialMass = ref.fvc.domainIntegrate( rho )
    
    return thermo, rho, p, h, psi, U, phi, pRefCell, pRefValue, turbulence, initialMass, rhoMax, rhoMin
コード例 #39
0
def createFields(runTime, mesh, rhoO, psi):
    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField(
        man.IOobject(ref.word("p"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    rho = man.volScalarField(
        man.IOobject(ref.word("rho"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
        rhoO + psi * p)

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

    return p, U, rho, phi
コード例 #40
0
ファイル: __init__.py プロジェクト: asimurzin/boundaryFlux
def _createFields( runTime, mesh ):
        
    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh ) 
    
    ref.ext_Info() << "Creating face flux\n" << ref.nl
    phi = man.surfaceScalarField( man.IOobject( ref.word( "phi" ),
                                                ref.fileName( runTime.timeName() ),
                                                mesh,
                                                ref.IOobject.NO_READ,
                                                ref.IOobject.NO_WRITE ),
                                  mesh,
                                  ref.dimensionedScalar( ref.word( "zero" ), mesh.Sf().dimensions()*U.dimensions(), 0.0) )

    
    laminarTransport = man.singlePhaseTransportModel( U, phi )
    
    turbulence = man.incompressible.RASModel.New( U, phi, laminarTransport )
    
    transportProperties = man.IOdictionary( man.IOobject( ref.word( "transportProperties" ),
                                                          ref.fileName( runTime.constant() ),
                                                          mesh,
                                                          ref.IOobject.MUST_READ,
                                                          ref.IOobject.NO_WRITE ) )
    Ubar = ref.dimensionedVector( transportProperties.lookup( ref.word( "Ubar" ) ) )
    
    flowDirection = ( Ubar / Ubar.mag() ).ext_value()
    flowMask = flowDirection.sqr()
    
    gradP = ref.dimensionedVector( ref.word( "gradP" ),
                                   ref.dimensionSet( 0.0, 1.0, -2.0, 0.0, 0.0 ),
                                   ref.vector( 0.0, 0.0, 0.0) )

    
    
              
    return U, phi, laminarTransport, turbulence, Ubar, gradP, flowDirection, flowMask
コード例 #41
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleDyMFlux
def _createFields( runTime, mesh ):
    
    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField( man.IOobject( ref.word( "p" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )
    
    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )
    
    phi = man.createPhi( runTime, mesh, U )
    
    pRefCell = 0
    pRefValue = 0.0
    
    pRefCell, pRefValue = ref.setRefCell( p, mesh.solutionDict().subDict( ref.word( "PIMPLE" ) ), pRefCell, pRefValue )
    
    laminarTransport = man.singlePhaseTransportModel( U, phi )
    
    turbulence = man.incompressible.turbulenceModel.New( U, phi, laminarTransport )
    
    ref.ext_Info() << "Reading field rAU if present\n" << ref.nl
    rAU = man.volScalarField( man.IOobject( ref.word( "rAU" ),
                                            ref.fileName( runTime.timeName() ),
                                            mesh,
                                            ref.IOobject.READ_IF_PRESENT,
                                            ref.IOobject.AUTO_WRITE ),
                              mesh,
                              runTime.deltaT(),
                              ref.zeroGradientFvPatchScalarField.typeName )
                              
    sources = man.IObasicSourceList(mesh)
    
    return p, U, phi, laminarTransport, turbulence, rAU, pRefCell, pRefValue, sources
コード例 #42
0
def createPhi( runTime, hU, mesh ):

    ref.ext_Info() << "Reading/calculating face flux field phi\n" << ref.nl
    
    phi = man.surfaceScalarField( man.IOobject( ref.word( "phi" ),
                                                ref.fileName( runTime.timeName() ),
                                                mesh,
                                                ref.IOobject.READ_IF_PRESENT,
                                                ref.IOobject.AUTO_WRITE ),
                                  man.linearInterpolate( hU ) & man.surfaceVectorField( mesh.Sf(), man.Deps( mesh ) ) )
    return phi
コード例 #43
0
def write(runTime, mesh, T):
    if runTime.outputTime():
        gradT = ref.fvc.grad(T)

        gradTx = ref.volScalarField(
            ref.IOobject(ref.word("gradTx"), ref.fileName(runTime.timeName()),
                         mesh, ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
            gradT.component(ref.vector.X))

        gradTy = ref.volScalarField(
            ref.IOobject(ref.word("gradTy"), ref.fileName(runTime.timeName()),
                         mesh, ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
            gradT.component(ref.vector.Y))

        gradTz = ref.volScalarField(
            ref.IOobject(ref.word("gradTz"), ref.fileName(runTime.timeName()),
                         mesh, ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
            gradT.component(ref.vector.Z))
        runTime.write()
        pass
コード例 #44
0
ファイル: __init__.py プロジェクト: asimurzin/dnsFlux
def _createFields( runTime, mesh ):
        
    ref.ext_Info() << "Reading field p\n" << ref.nl
    p = man.volScalarField( man.IOobject( ref.word( "p" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )

    phi = man.createPhi( runTime, mesh, U )

    return p, U, phi
コード例 #45
0
ファイル: __init__.py プロジェクト: asimurzin/dnsFlux
def readTransportProperties( runTime, mesh ):
    
    ref.ext_Info() << "Reading transportProperties\n" << ref.nl
    transportProperties = man.IOdictionary( man.IOobject( ref.word( "transportProperties" ),
                                                          ref.fileName( runTime.constant() ),
                                                           mesh,
                                                          ref.IOobject.MUST_READ_IF_MODIFIED,
                                                          ref.IOobject.NO_WRITE ) )

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

    return transportProperties, nu
コード例 #46
0
def readTransportProperties(runTime, mesh):
    ref.ext_Info() << "Reading transportProperties\n" << ref.nl

    transportProperties = man.IOdictionary(
        man.IOobject(ref.word("transportProperties"),
                     ref.fileName(runTime.constant()), mesh,
                     ref.IOobject.MUST_READ_IF_MODIFIED,
                     ref.IOobject.NO_WRITE))

    mu = ref.dimensionedScalar(transportProperties.lookup(ref.word("mu")))

    return transportProperties, mu
コード例 #47
0
def setInitialrDeltaT ( runTime, mesh, pimple ):
    maxDeltaT = pimple.dict().lookupOrDefault( ref.word( "maxDeltaT" ), ref.GREAT ); 
    rDeltaT = man.volScalarField( man.IOobject( ref.word( "rDeltaT" ),
                                                ref.fileName( runTime.timeName() ),
                                                mesh,
                                                ref.IOobject.NO_READ,
                                                ref.IOobject.AUTO_WRITE ),
                                  mesh,
                                  1.0 / ref.dimensionedScalar( ref.word( "maxDeltaT" ), ref.dimTime, maxDeltaT ),
                                  ref.zeroGradientFvPatchScalarField.typeName )
    
    return maxDeltaT, rDeltaT
コード例 #48
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
コード例 #49
0
ファイル: __init__.py プロジェクト: asimurzin/rhoCentralFlux
def readThermophysicalProperties( runTime, mesh ):
    ref.ext_Info() << "Reading thermophysicalProperties\n" << ref.nl
    
    # Pr defined as a separate constant to enable calculation of k, currently
    # inaccessible through thermo
    thermophysicalProperties = man.IOdictionary( man.IOobject( ref.word( "thermophysicalProperties" ),
                                                               ref.fileName( runTime.constant() ),
                                                               mesh,
                                                               ref.IOobject.MUST_READ,
                                                               ref.IOobject.NO_WRITE ) )
    
    Pr = ref.dimensionedScalar.lookupOrDefault( ref.word( "Pr" ), thermophysicalProperties(), 1.0 )
    
    return thermophysicalProperties, Pr
コード例 #50
0
def readThermophysicalProperties(runTime, mesh):
    ref.ext_Info() << "Reading thermophysicalProperties\n" << ref.nl

    # Pr defined as a separate constant to enable calculation of k, currently
    # inaccessible through thermo
    thermophysicalProperties = man.IOdictionary(
        man.IOobject(ref.word("thermophysicalProperties"),
                     ref.fileName(runTime.constant()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.NO_WRITE))

    Pr = ref.dimensionedScalar.lookupOrDefault(ref.word("Pr"),
                                               thermophysicalProperties(), 1.0)

    return thermophysicalProperties, Pr
コード例 #51
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
コード例 #52
0
ファイル: __init__.py プロジェクト: asimurzin/SRFSimpleFlux
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    p, Urel, phi, pRefCell, pRefValue, laminarTransport, turbulence, SRF, sources = createFields(
        runTime, mesh)

    cumulativeContErr = ref.initContinuityErrs()

    simple = man.simpleControl(mesh)

    # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
    ref.ext_Info() << "\nStarting time loop\n" << ref.nl

    while simple.loop():
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl

        # --- Pressure-velocity SIMPLE corrector
        UrelEqn = fun_UrelEqn(Urel, phi, turbulence, p, sources, SRF)
        cumulativeContErr = fun_pEqn(mesh, runTime, simple, Urel, phi,
                                     turbulence, p, UrelEqn, pRefCell,
                                     pRefValue, cumulativeContErr, sources)

        turbulence.correct()

        Uabs = None
        if runTime.outputTime():
            Uabs = ref.volVectorField(
                ref.IOobject(ref.word("Uabs"),
                             ref.fileName(runTime.timeName()), mesh,
                             ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
                Urel() + SRF.U())  # mixed calculations
            pass

        runTime.write()

        ref.ext_Info() << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" \
                        << "    ClockTime = " << runTime.elapsedClockTime() << " s" \
                        << ref.nl << ref.nl
        pass

    ref.ext_Info() << "End\n" << ref.nl

    import os
    return os.EX_OK
コード例 #53
0
def createFields( runTime, mesh ):
    ref.ext_Info()<< "Reading thermophysical properties\n" << ref.nl
    
    pThermo = man.basicPsiThermo.New( mesh )
    
    p = man.volScalarField( pThermo.p(), man.Deps( pThermo ) )
    h = man.volScalarField( pThermo.h(), man.Deps( pThermo ) )
    psi = man.volScalarField( pThermo.psi(), man.Deps( pThermo ) )
    
    rho = man.volScalarField( man.IOobject( ref.word( "rho" ),
                                            ref.fileName( runTime.timeName() ),
                                            mesh,
                                            ref.IOobject.READ_IF_PRESENT,
                                            ref.IOobject.AUTO_WRITE ),
                              man.volScalarField( pThermo.rho(), man.Deps( pThermo ) ) )
    
    ref.ext_Info()<< "Reading field U\n" << ref.nl
    U = man.volVectorField( man.IOobject( ref.word( "U" ),
                                          ref.fileName( runTime.timeName() ),
                                          mesh,
                                          ref.IOobject.MUST_READ,
                                          ref.IOobject.AUTO_WRITE ),
                            mesh )

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

    rhoMax = ref.dimensionedScalar( mesh.solutionDict().subDict( ref.word( "PIMPLE" ) ).lookup( ref.word( "rhoMax" ) ) )
    rhoMin = ref.dimensionedScalar( mesh.solutionDict().subDict( ref.word( "PIMPLE" ) ).lookup( ref.word( "rhoMin" ) ) )

    ref.ext_Info()<< "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.turbulenceModel.New( rho, U, phi, pThermo );
  
    ref.ext_Info()<< "Creating field DpDt\n" << ref.nl;
    DpDt = man.fvc.DDt( man.surfaceScalarField( ref.word( "phiU" ), phi / man.fvc.interpolate( rho ) ), p )
  
    return pThermo, p, h, psi, rho, U, phi, rhoMax, rhoMin, turbulence, DpDt
コード例 #54
0
def readTurbulenceProperties(runTime, mesh, U):

    ref.ext_Info() << "Reading turbulenceProperties\n" << ref.nl
    turbulenceProperties = man.IOdictionary(
        man.IOobject(ref.word("turbulenceProperties"),
                     ref.fileName(runTime.constant()), mesh,
                     ref.IOobject.MUST_READ_IF_MODIFIED,
                     ref.IOobject.NO_WRITE))

    force = U / ref.dimensionedScalar(ref.word("dt"), ref.dimTime,
                                      runTime.deltaTValue())

    K = man.Kmesh(mesh)
    forceGen = man.UOprocess(K, runTime.deltaTValue(), turbulenceProperties)

    return turbulenceProperties, force, K, forceGen
コード例 #55
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleDyMFlux
def _correctPhi(runTime, mesh, pimple, p, U, rAU, phi, pRefCell, pRefValue,
                cumulativeContErr):
    if mesh.changing():
        for patchi in range(U.ext_boundaryField().size()):
            if U.ext_boundaryField()[patchi].fixesValue():
                U.ext_boundaryField()[patchi].initEvaluate()
                pass
            pass
        for patchi in range(U.ext_boundaryField().size()):
            if U.ext_boundaryField()[patchi].fixesValue():
                U.ext_boundaryField()[patchi].evaluate()
                phi.ext_boundaryField()[patchi] << (
                    U.ext_boundaryField()[patchi]
                    & mesh.Sf().ext_boundaryField()[patchi])
                pass
            pass
        pass

    pcorrTypes = ref.wordList(p.ext_boundaryField().size(),
                              ref.zeroGradientFvPatchScalarField.typeName)

    for i in range(p.ext_boundaryField().size()):
        if p.ext_boundaryField()[i].fixesValue():
            pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName
            pass
        pass

    pcorr = ref.volScalarField(
        ref.IOobject(ref.word("pcorr"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), mesh,
        ref.dimensionedScalar(ref.word("pcorr"), p.dimensions(), 0.0),
        pcorrTypes)

    while pimple.correctNonOrthogonal():
        pcorrEqn = (ref.fvm.laplacian(rAU, pcorr) == ref.fvc.div(phi))

        pcorrEqn.setReference(pRefCell, pRefValue)
        pcorrEqn.solve()

        if pimple.finalNonOrthogonalIter():
            phi << phi() - pcorrEqn.flux()  # mixed calculations
            pass
        pass
    cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh,
                                           cumulativeContErr)

    return cumulativeContErr
コード例 #56
0
def _createFields(runTime, mesh):
    # Load boundary condition
    from BCs import rho

    ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl
    thermo = man.basicPsiThermo.New(mesh)

    p = man.volScalarField(thermo.p(), man.Deps(thermo))
    e = man.volScalarField(thermo.e(), man.Deps(thermo))
    T = man.volScalarField(thermo.T(), man.Deps(thermo))
    psi = man.volScalarField(thermo.psi(), man.Deps(thermo))
    mu = man.volScalarField(thermo.mu(), man.Deps(thermo))

    inviscid = True
    if mu.internalField().max() > 0.0:
        inviscid = False
        pass

    ref.ext_Info() << "Reading field U\n" << ref.nl
    U = man.volVectorField(
        man.IOobject(ref.word("U"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.MUST_READ, ref.IOobject.AUTO_WRITE), mesh)

    pbf, rhoBoundaryTypes = _rhoBoundaryTypes(p)

    rho = man.volScalarField(
        man.IOobject(ref.word("rho"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
        man.volScalarField(thermo.rho(), man.Deps(thermo)), rhoBoundaryTypes)
    rhoU = man.volVectorField(
        man.IOobject(ref.word("rhoU"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), rho * U)
    rhoE = man.volScalarField(
        man.IOobject(ref.word("rhoE"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE),
        rho * (e + man.volScalarField(0.5 * U.magSqr(), man.Deps(U))))

    pos = man.surfaceScalarField(
        man.IOobject(ref.word("pos"), ref.fileName(runTime.timeName()), mesh),
        mesh, ref.dimensionedScalar(ref.word("pos"), ref.dimless, 1.0))

    neg = man.surfaceScalarField(
        man.IOobject(ref.word("neg"), ref.fileName(runTime.timeName()), mesh),
        mesh, ref.dimensionedScalar(ref.word("neg"), ref.dimless, -1.0))

    phi = man.surfaceScalarField(
        ref.word("phi"),
        man.surfaceVectorField(mesh.Sf(), man.Deps(mesh))
        & man.fvc.interpolate(rhoU))

    ref.ext_Info() << "Creating turbulence model\n" << ref.nl
    turbulence = man.compressible.turbulenceModel.New(rho, U, phi, thermo)

    return thermo, p, e, T, psi, mu, U, pbf, rhoBoundaryTypes, rho, rhoU, rhoE, pos, neg, inviscid, phi, turbulence
コード例 #57
0
def readThermodynamicProperties(runTime, mesh):
    ref.ext_Info() << "Reading thermodynamicProperties\n" << ref.nl

    thermodynamicProperties = man.IOdictionary(
        man.IOobject(ref.word("thermodynamicProperties"),
                     ref.fileName(runTime.constant()), mesh,
                     ref.IOobject.MUST_READ_IF_MODIFIED,
                     ref.IOobject.NO_WRITE))
    rho0 = ref.dimensionedScalar(
        thermodynamicProperties.lookup(ref.word("rho0")))
    p0 = ref.dimensionedScalar(thermodynamicProperties.lookup(ref.word("p0")))
    psi = ref.dimensionedScalar(thermodynamicProperties.lookup(
        ref.word("psi")))
    # Density offset, i.e. the constant part of the density
    rhoO = ref.dimensionedScalar(ref.word("rhoO"), rho0 - psi * p0)

    return thermodynamicProperties, rho0, p0, psi, rhoO
コード例 #58
0
ファイル: __init__.py プロジェクト: asimurzin/interFlux
def correctPhi(runTime, mesh, phi, p, p_rgh, rho, U, cumulativeContErr, pimple,
               pRefCell, pRefValue):

    cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh,
                                           cumulativeContErr)

    pcorrTypes = ref.wordList(p_rgh.ext_boundaryField().size(),
                              ref.zeroGradientFvPatchScalarField.typeName)

    for i in range(p.ext_boundaryField().size()):
        if p_rgh.ext_boundaryField()[i].fixesValue():
            pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName
            pass
        pass

    pcorr = ref.volScalarField(
        ref.IOobject(ref.word("pcorr"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), mesh(),
        ref.dimensionedScalar(ref.word("pcorr"), p_rgh.dimensions(), 0.0),
        pcorrTypes)

    rAUf = ref.dimensionedScalar(ref.word("(1|A(U))"),
                                 ref.dimTime / rho.dimensions(), 1.0)

    ref.adjustPhi(phi, U, pcorr)

    while pimple.correctNonOrthogonal():
        pcorrEqn = ref.fvm.laplacian(rAUf, pcorr) == ref.fvc.div(phi)

        pcorrEqn.setReference(pRefCell, pRefValue)
        pcorrEqn.solve()

        if pimple.finalNonOrthogonalIter():
            phi -= pcorrEqn.flux()
            pass

    cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh,
                                           cumulativeContErr)

    return cumulativeContErr