Beispiel #1
0
def Ueqn( mesh, pimple, phi, U, p, turbulence, sources ):

    UEqn = man.fvm.ddt(U) + man.fvm.div(phi, U) + man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) ) \
           == man.fvVectorMatrix( sources(U), man.Deps( U ) )
    
    UEqn.relax()
    sources.constrain( UEqn )
    
    rAU = man.volScalarField( 1.0/UEqn.A(), man.Deps( UEqn ) )

    if pimple.momentumPredictor():
       ref.solve( UEqn == -man.fvc.grad( p ) )
       pass
    
    return UEqn, rAU
def _UEqn( phi, U, p, rho, turbulence, mrfZones, pZones, pressureImplicitPorosity, nUCorr ):
    # Solve the Momentum equation
    UEqn = man.fvVectorMatrix( turbulence.divDevRhoReff( U ), man.Deps( turbulence ) )  + man.fvm.div( phi, U )
    
    UEqn.relax()
    
    mrfZones.addCoriolis( rho, UEqn )
    
    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" ) )

        gradp = ref.fvc.grad(p)

        for UCorr in range( nUCorr ):
            U << ( trTU() & ( UEqn.H() - gradp ) ) # mixed calculations
            pass
        U.correctBoundaryConditions()
        pass
    else:
        pZones.addResistance( UEqn )
        ref.solve( UEqn == -ref.fvc.grad( p ) )
        trAU = man.volScalarField( 1.0 / UEqn.A(), man.Deps( UEqn ) )
        trAU.rename( ref.word( "rAU" ) )
        pass
    
    return UEqn, trAU, trTU
Beispiel #3
0
def _UEqn( phi, U, p, rho, turbulence ):
    # Solve the Momentum equation
    UEqn = man.fvVectorMatrix( turbulence.divDevRhoReff( U ), man.Deps( turbulence ) )  + man.fvm.div( phi, U )
    
    UEqn.relax()
    
    ref.solve( UEqn == -ref.fvc.grad( p ) )
    
    return UEqn
def fun_UEqn( rho, U, phi, ghf, p_rgh, turb, mesh ):
    # Solve the Momentum equation
    
    UEqn = man.fvm.div( phi, U ) + man.fvVectorMatrix( turb.divDevRhoReff( U ), man.Deps( turb, U ) )

    UEqn.relax()
    
    ref.solve( UEqn() == ref.fvc.reconstruct( ( -ghf * ref.fvc.snGrad( rho ) - ref.fvc.snGrad( p_rgh ) ) * mesh.magSf() ) )
    
    return UEqn
Beispiel #5
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
Beispiel #6
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 fun_Ueqn(pimple, mesh, rho, U, phi, turbulence, ghf, p_rgh):
    # Solve the Momentum equation

    UEqn = man.fvm.ddt(rho, U) + man.fvm.div(phi, U) + man.fvVectorMatrix(
        turbulence.divDevRhoReff(U()), man.Deps(turbulence, U))
    UEqn.relax()

    if pimple.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
def fun_UEqn( rho, U, phi, ghf, p_rgh, turb, mesh, momentumPredictor, finalIter ) :
    # Solve the Momentum equation
    
    UEqn = man.fvm.ddt( rho, U ) + man.fvm.div( phi, U ) + man.fvVectorMatrix( turb.divDevRhoReff( U ), man.Deps( turb, U ) )

    UEqn.relax()
    
    if momentumPredictor :
        ref.solve( UEqn() == ref.fvc.reconstruct( ( -ghf * ref.fvc.snGrad( rho ) - ref.fvc.snGrad( p_rgh ) ) * mesh.magSf() ), 
                   mesh.solver( U.select( finalIter ) ) )
        pass
    
    return UEqn
Beispiel #9
0
def fun_UEqn( rho, U, K, phi, ghf, p_rgh, turb, mesh, momentumPredictor, finalIter ):
    # Solve the Momentum equation
    
    UEqn = man.fvm.ddt( rho, U ) + man.fvm.div( phi, U ) + man.fvVectorMatrix( turb.divDevRhoReff( U ), man.Deps( turb, U ) )

    UEqn.relax()
    
    if momentumPredictor :
        ref.solve( UEqn() == ref.fvc.reconstruct( ( -ghf * ref.fvc.snGrad( rho ) - ref.fvc.snGrad( p_rgh ) ) * mesh.magSf() ), 
                   mesh.solver( U.select( finalIter ) ) )
        K << 0.5 * U.magSqr()
        pass
    
    return UEqn
Beispiel #10
0
def Ueqn( mesh, pimple, phi, U, p, turbulence, sources ):
    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    #UEqn = man.fvm.ddt(U) + man.fvm.div(phi, U) + man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) )           
    UEqn = man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) )  + ( man.fvm.ddt(U) + man.fvm.div(phi, U) )
    UEqn.relax()
    sources.constrain( UEqn )
    
    rAU = man.volScalarField( 1.0/UEqn.A(), man.Deps( UEqn ) )

    if pimple.momentumPredictor():
       ref.solve( UEqn == -ref.fvc.grad( p ) + sources( U ) )
       pass
    
    return UEqn, rAU
Beispiel #11
0
def fun_UEqn( mesh, phi, U, p, rAU, turbulence, pimple ):
    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    # UEqn = man.fvm.ddt(U) + man.fvm.div(phi, U) + man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) ) 
    UEqn = man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) )  + ( man.fvm.ddt(U) + man.fvm.div(phi, U) )
    
    UEqn.relax()
    
    rAU << 1.0 / UEqn.A()

    if pimple.momentumPredictor():
        ref.solve( UEqn() == -ref.fvc.grad( p ) )
        pass

    return UEqn
Beispiel #12
0
def fun_UEqn(mesh, phi, U, p, rAU, turbulence, pimple):
    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    # UEqn = man.fvm.ddt(U) + man.fvm.div(phi, U) + man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) )
    UEqn = man.fvVectorMatrix(turbulence.divDevReff(U), man.Deps(
        turbulence, U)) + (man.fvm.ddt(U) + man.fvm.div(phi, U))

    UEqn.relax()

    rAU << 1.0 / UEqn.A()

    if pimple.momentumPredictor():
        ref.solve(UEqn() == -ref.fvc.grad(p))
        pass

    return UEqn
Beispiel #13
0
def Ueqn( mesh, pimple, phi, U, p, turbulence ):

    UEqn = man.fvm.ddt(U) + man.fvm.div(phi, U) + man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) )
    
    UEqn.relax()
    
    rAU = man.volScalarField( 1.0/UEqn.A(), man.Deps( UEqn ) )

    if pimple.momentumPredictor():
       ref.solve( UEqn == -man.fvc.grad( p ) )
       pass
    else:
       U << rAU * ( UEqn.H() - ref.fvc.grad( p ) )
       U.correctBoundaryConditions()
       pass
    
    return UEqn, rAU
Beispiel #14
0
def Ueqn(mesh, pimple, phi, U, p, turbulence, sources):
    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    #UEqn = man.fvm.ddt(U) + man.fvm.div(phi, U) + man.fvVectorMatrix( turbulence.divDevReff( U ), man.Deps( turbulence, U ) )
    UEqn = man.fvVectorMatrix(turbulence.divDevReff(U), man.Deps(
        turbulence, U)) + (man.fvm.ddt(U) + man.fvm.div(phi, U))
    UEqn.relax()
    sources.constrain(UEqn)

    rAU = man.volScalarField(1.0 / UEqn.A(), man.Deps(UEqn))

    if pimple.momentumPredictor():
        ref.solve(UEqn == -ref.fvc.grad(p) + sources(U))
        pass

    return UEqn, rAU
Beispiel #15
0
def fun_UEqn( mesh, phi, U, p, turbulence, pZones, nUCorr, pressureImplicitPorosity ):
    
    # Construct the Momentum equation

    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    #UEqn = fvm.div( phi, U ) + turbulence.divDevReff( U ) 

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

    UEqn.relax()

    # 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
Beispiel #16
0
def _UrelEqn( mesh, pimple, phi, Urel, p, turbulence, SRF, sources ):

    # Relative momentum predictor
    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    # UrelEqn = man.fvVectorMatrix( ref.fvm.ddt( Urel ) + ref.fvm.div( phi, Urel ) + turbulence.divDevReff( Urel )  + SRF.Su(), \
    #                              man.Deps( phi, Urel, turbulence, SRF ) );
    UrelEqn = man.fvVectorMatrix( turbulence.divDevReff( Urel )  + ref.fvm.div( phi, Urel ) + ref.fvm.ddt( Urel ) + SRF.Su(), \
                                  man.Deps( phi, Urel, turbulence, SRF ) );

    UrelEqn.relax()

    sources.constrain( UrelEqn )

    ref.solve( UrelEqn == -ref.fvc.grad( p ) + sources( Urel ) )
    
    return UrelEqn
Beispiel #17
0
def Ueqn(mesh, pimple, phi, U, p, turbulence):

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

    UEqn.relax()

    rAU = man.volScalarField(1.0 / UEqn.A(), man.Deps(UEqn))

    if pimple.momentumPredictor():
        ref.solve(UEqn == -man.fvc.grad(p))
        pass
    else:
        U << rAU * (UEqn.H() - ref.fvc.grad(p))
        U.correctBoundaryConditions()
        pass

    return UEqn, rAU
Beispiel #18
0
def fun_Ueqn(pimple, mesh, rho, U, phi, turbulence, ghf, p_rgh):
    # Solve the Momentum equation

    UEqn = (
        man.fvm.ddt(rho, U)
        + man.fvm.div(phi, U)
        + man.fvVectorMatrix(turbulence.divDevRhoReff(U()), man.Deps(turbulence, U))
    )
    UEqn.relax()

    if pimple.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
def fun_Ueqn( pimple, rho, p, U, phi, turbulence, mrfZones, pZones ):
    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    # UEqn = man.fvm.ddt( rho, U ) + man.fvm.div( phi, U ) + man.fvVectorMatrix( turbulence.divDevRhoReff( U ), man.Deps( turbulence, U ) )
    
    UEqn = man.fvVectorMatrix( turbulence.divDevRhoReff( U ), man.Deps( turbulence, U ) ) + ( man.fvm.div( phi, U ) + man.fvm.ddt( rho, U ) )
  
    UEqn.relax()
    
    mrfZones.addCoriolis( rho, UEqn )
    pZones.addResistance( UEqn )
  
    rAU = 1.0 / UEqn.A()
  
    if pimple.momentumPredictor():
        ref.solve( UEqn == -man.fvc.grad( p ) )
        pass
 
    return UEqn
Beispiel #20
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
Beispiel #21
0
def fun_Ueqn( pimple, rho, p, U, phi, turbulence ):
    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    # UEqn = man.fvm.ddt( rho, U ) + man.fvm.div( phi, U ) + man.fvVectorMatrix( turbulence.divDevRhoReff( U ), man.Deps( turbulence, U ) )
    
    UEqn = man.fvVectorMatrix( turbulence.divDevRhoReff( U ), man.Deps( turbulence, U ) ) + ( man.fvm.div( phi, U ) + man.fvm.ddt( rho, U ) )
  
    UEqn.relax()
  
    rAU = 1.0 / UEqn.A()
  
    if pimple.momentumPredictor():
        ref.solve( UEqn == -man.fvc.grad( p ) )
        pass
    else:
        U << rAU * ( UEqn.H() - ref.fvc.grad( p ) )
        U.correctBoundaryConditions()
        pass
  
    return UEqn, rAU
Beispiel #22
0
def fun_Ueqn(pimple, rho, p, U, phi, turbulence, mrfZones, pZones):
    # The initial C++ expression does not work properly, because of
    #  1. turbulence.divDevRhoReff( U ) - changes values for the U boundaries
    #  2. the order of expression arguments computation differs with C++
    # UEqn = man.fvm.ddt( rho, U ) + man.fvm.div( phi, U ) + man.fvVectorMatrix( turbulence.divDevRhoReff( U ), man.Deps( turbulence, U ) )

    UEqn = man.fvVectorMatrix(
        turbulence.divDevRhoReff(U), man.Deps(
            turbulence, U)) + (man.fvm.div(phi, U) + man.fvm.ddt(rho, U))

    UEqn.relax()

    mrfZones.addCoriolis(rho, UEqn)
    pZones.addResistance(UEqn)

    rAU = 1.0 / UEqn.A()

    if pimple.momentumPredictor():
        ref.solve(UEqn == -man.fvc.grad(p))
        pass

    return UEqn