Exemplo n.º 1
0
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
Exemplo n.º 2
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
Exemplo n.º 3
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