예제 #1
0
def fun_UEqn(U, phi, turbulence, p, sources):
    # Solve the Momentum equation

    UEqn = man.fvm.div(phi, U) + man(turbulence.divDevReff(U),
                                     man.Deps(turbulence, U)) == man(
                                         sources(U), man.Deps(U))

    UEqn.relax()

    sources.constrain(UEqn)

    ref.solve(UEqn == -man.fvc.grad(p))

    return UEqn
예제 #2
0
def fun_UEqn( U, phi, turbulence, p ):
  # Solve the Momentum equation
  
  UEqn = man.fvm.div( phi, U ) + man( turbulence.divDevReff( U ), man.Deps( turbulence, U ) ) 

  UEqn.relax()
  ref.solve( UEqn == -man.fvc.grad( p ) )

  return UEqn
def fun_Ueqn( simple, mesh, rho, U, phi, turbulence, ghf, p_rgh ):
    UEqn = man.fvm.div( phi, U ) + man( turbulence.divDevRhoReff( U ), man.Deps( turbulence, U) )
    
    UEqn.relax()
 
    if simple.momentumPredictor():
     ref.solve( UEqn == man.fvc.reconstruct( ( ( - ghf * man.fvc.snGrad( rho ) - man.fvc.snGrad( p_rgh ) ) * man.surfaceScalarField( mesh.magSf(), man.Deps( mesh ) ) ) ) )

    return UEqn
예제 #4
0
def fun_UEqn(U, phi, turbulence, p):
    # Solve the Momentum equation

    UEqn = man.fvm.div(phi, U) + man(turbulence.divDevReff(U),
                                     man.Deps(turbulence, U))

    UEqn.relax()
    ref.solve(UEqn == -man.fvc.grad(p))

    return UEqn
def fun_UEqn( mesh, simple, U, phi, turbulence, p, rhok, p_rgh, ghf ):
   
  UEqn = man.fvm.div(phi, U) + man( turbulence.divDevReff( U ) , man.Deps( U ) ) 

  UEqn.relax()

  if  simple.momentumPredictor():
    ref.solve( UEqn == man.fvc.reconstruct( ( - ghf * man.fvc.snGrad( rhok ) - man.fvc.snGrad( p_rgh ) ) * man.surfaceScalarField( mesh.magSf(), mesh ) ) )
    pass
  return UEqn
def fun_UEqn( mesh, pimple, U, phi, turbulence, p, rhok, p_rgh, ghf ):
   
    UEqn = man.fvm.ddt( U ) + man.fvm.div(phi, U) + man( turbulence.divDevReff( U ) , man.Deps( U ) ) 

    UEqn.relax()

    if  pimple.momentumPredictor():
        ref.solve( UEqn == man.fvc.reconstruct( ( - ghf * man.fvc.snGrad( rhok ) - man.fvc.snGrad( p_rgh ) ) * man.surfaceScalarField( mesh.magSf(), mesh ) ) )
        pass
    return UEqn
예제 #7
0
def fun_UEqn( U, phi, turbulence, p, sources ):
  # Solve the Momentum equation
  
  UEqn = man.fvm.div( phi, U ) + man( turbulence.divDevReff( U ), man.Deps( turbulence, U ) ) == man( sources( U ), man.Deps( U ) )

  UEqn.relax()

  sources.constrain( UEqn )

  ref.solve( UEqn == -man.fvc.grad( p ) )

  return UEqn
예제 #8
0
def fun_UrelEqn( Urel, phi, turbulence, p, sources, SRF ):
    # Solve the Momentum equation
    
    UrelEqn = man.fvVectorMatrix( ref.fvm.div( phi, Urel ) + turbulence.divDevReff( Urel ) + SRF.Su(), man.Deps( turbulence, Urel, phi, SRF ) )    \
                 == man( sources( Urel ), man.Deps( Urel ) )

    UrelEqn.relax()

    sources.constrain( UrelEqn )

    ref.solve( UrelEqn == -man.fvc.grad( p ) )

    return UrelEqn
예제 #9
0
def fun_UrelEqn(Urel, phi, turbulence, p, sources, SRF):
    # Solve the Momentum equation

    UrelEqn = man.fvVectorMatrix( ref.fvm.div( phi, Urel ) + turbulence.divDevReff( Urel ) + SRF.Su(), man.Deps( turbulence, Urel, phi, SRF ) )    \
                 == man( sources( Urel ), man.Deps( Urel ) )

    UrelEqn.relax()

    sources.constrain(UrelEqn)

    ref.solve(UrelEqn == -man.fvc.grad(p))

    return UrelEqn
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
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
예제 #12
0
def compressibleCreatePhiHolder(runTime, mesh, rho, U):
    from Foam import man

    return man(compressibleCreatePhi(runTime, mesh, rho, U),
               man.Deps(runTime, mesh, rho, U))
예제 #13
0
def compressibleCreatePhiHolder( runTime, mesh, rho, U ):
     from Foam import man
     
     return man( compressibleCreatePhi( runTime, mesh, rho, U ), man.Deps( runTime, mesh, rho, U ) )
예제 #14
0
def readGravitationalAccelerationHolder( runTime, mesh ):
    from Foam import man
    return man( readGravitationalAcceleration( runTime, mesh ), man.Deps() )
예제 #15
0
def createPhiHolder(runTime, mesh, U):
    from Foam import man

    return man(createPhi(runTime, mesh, U), man.Deps(runTime, mesh, U))
def createFields( runTime, mesh, g ):
  
  ref.ext_Info() << "Reading thermophysical properties\n" << ref.nl
  
  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 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 )
  
  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 )
    
  laminarTransport, beta, TRef, Pr, Prt = readTransportProperties( U, phi )
  
  ref.ext_Info()<< "Creating turbulence model\n" << ref.nl
  turbulence = man.incompressible.RASModel.New(U, phi, laminarTransport)

  # Kinematic density for buoyancy force
  rhok = man.volScalarField( man.IOobject( ref.word( "rhok" ),
                                           ref.fileName( runTime.timeName() ),
                                           mesh ), man( 1.0 - beta * ( T() - TRef ), man.Deps( T ) ) )
  
  # kinematic turbulent thermal thermal conductivity m2/s
  ref.ext_Info() << "Reading field kappat\n" << ref.nl
  kappat = man.volScalarField( man.IOobject( ref.word( "kappat" ),
                                             ref.fileName( runTime.timeName() ),
                                             mesh,
                                             ref.IOobject.MUST_READ,
                                             ref.IOobject.AUTO_WRITE ), mesh )

  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 ) ) )

  p = man.volScalarField( man.IOobject( ref.word( "p" ),
                                        ref.fileName( runTime.timeName() ),
                                        mesh,
                                        ref.IOobject.NO_READ,
                                        ref.IOobject.AUTO_WRITE ), p_rgh + rhok * gh )

  pRefCell = 0
  pRefValue = 0.0

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

  if p_rgh.needReference():
    p += ref.dimensionedScalar( ref.word( "p" ),p.dimensions(), pRefValue - ref.getRefCellValue( p, pRefCell ) )
    pass
  
  return T, p_rgh, U, phi, laminarTransport, turbulence, rhok, kappat, gh, ghf, p, pRefCell, pRefValue, beta, TRef, Pr, Prt
예제 #17
0
def createPhiHolder( runTime, mesh, U ):
    from Foam import man
    
    return man( createPhi( runTime, mesh, U ), man.Deps( runTime, mesh, U ) )
예제 #18
0
def createMeshHolder(runTime):
    from Foam import man

    return man(createMesh(runTime), man.Deps(runTime))
예제 #19
0
def createTimeHolder(args):
    from Foam import man
    return man(createTime(args), man.Deps())
예제 #20
0
def createDynamicFvMeshHolder(runTime):
    from Foam import man

    autoPtrMesh = createDynamicFvMesh(runTime)

    return man(autoPtrMesh.ptr(), man.Deps(runTime))
예제 #21
0
def fun_Ueqn( rho, U, phi, turbulence, p ):
    UEqn = man.fvm.ddt( rho, U ) + man.fvm.div( phi, U ) + man( turbulence.divDevRhoReff( U() ), man.Deps( turbulence, U ) )
  
    ref.solve( UEqn == -man.fvc.grad( p ) );
    return UEqn
예제 #22
0
def readGravitationalAccelerationHolder(runTime, mesh):
    from Foam import man
    return man(readGravitationalAcceleration(runTime, mesh), man.Deps())
예제 #23
0
def createTimeHolder( args ):
    from Foam import man
    return man( createTime( args ), man.Deps() )
예제 #24
0
def fun_UEqn( mesh, phi, U, p, turbulence, pZones, nUCorr, pressureImplicitPorosity, sources ):
    
    # Construct the Momentum equation
    UEqn = man.fvm.div( phi, U ) + man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) ) == man( sources( U ), man.Deps( U ) )

    UEqn.relax()
    
    sources.constrain( UEqn )

    # Include the porous media resistance and solve the momentum equation
    # either implicit in the tensorial resistance or transport using by
    # including the spherical part of the resistance in the momentum diagonal

    trAU = None
    trTU = None
    if pressureImplicitPorosity :
        tTU = man.volTensorField( ref.tensor( ref.I ) * UEqn.A(), man.Deps( UEqn ) )

        pZones.addResistance( UEqn, tTU )
    
        trTU = man.volTensorField( tTU.inv(), man.Deps( tTU ) )
               
        trTU.rename( ref.word( "rAU" ) )
        
        for UCorr in range ( nUCorr ):
            U << ( trTU() & ( UEqn.H() - ref.fvc.grad( p ) ) ) # mixed calculations
            pass
        
        U.correctBoundaryConditions()
        pass
    else:
        pZones.addResistance( UEqn )
        
        ref.solve( UEqn == -man.fvc.grad( p ) )
        
        trAU = man.volScalarField( 1.0 / UEqn.A(), man.Deps( UEqn ) )
        
        trAU.rename( ref.word( "rAU" ) )
        pass
    
    return UEqn, trTU, trAU
예제 #25
0
def fun_Ueqn(rho, U, phi, turbulence, p):
    UEqn = man.fvm.ddt(rho, U) + man.fvm.div(phi, U) + man(
        turbulence.divDevRhoReff(U()), man.Deps(turbulence, U))

    ref.solve(UEqn == -man.fvc.grad(p))
    return UEqn
예제 #26
0
def createMeshHolder( runTime ):
    from Foam import man

    return man( createMesh( runTime ), man.Deps( runTime ) )
예제 #27
0
def createDynamicFvMeshHolder(runTime):
    from Foam import man

    autoPtrMesh = createDynamicFvMesh(runTime)

    return man(autoPtrMesh.ptr(), man.Deps(runTime))