Ejemplo n.º 1
0
def alphaEqnSubCycle(runTime, pimple, mesh, phi, alpha1, rho, rhoPhi, rho1,
                     rho2, interface):

    nAlphaCorr = ref.readLabel(pimple.dict().lookup(ref.word("nAlphaCorr")))
    nAlphaSubCycles = ref.readLabel(pimple.dict().lookup(
        ref.word("nAlphaSubCycles")))
    if (nAlphaSubCycles > 1):
        totalDeltaT = runTime.deltaT()
        rhoPhiSum = 0.0 * rhoPhi

        alphaSubCycle = ref.subCycle_volScalarField(alpha1, nAlphaSubCycles)
        for item in alphaSubCycle:
            alphaEqn(mesh, phi, alpha1, rhoPhi, rho1, rho2, interface,
                     nAlphaCorr)
            rhoPhiSum += (runTime.deltaT() / totalDeltaT) * rhoPhi
            pass
        # To make sure that variable in the local scope will be destroyed
        # - during destruction of this variable it performs some important actions
        # - there is a difference between C++ and Python memory management, namely
        # if C++ automatically destroys stack variables when they exit the scope,
        # Python relay its memory management of some "garbage collection" algorithm
        # that do not provide predictable behavior on the "exit of scope"
        del alphaSubCycle

        rhoPhi << rhoPhiSum
    else:
        alphaEqn(mesh, phi, alpha1, rhoPhi, rho1, rho2, interface, nAlphaCorr)
        pass
    interface.correct()

    rho == alpha1 * rho1 + (1.0 - alpha1) * rho2

    pass
Ejemplo n.º 2
0
def alphaEqnSubCycle(runTime, pimple, mesh, phi, alpha1, rho, rhoPhi, rho1, rho2, interface):

    nAlphaCorr = ref.readLabel(pimple.dict().lookup(ref.word("nAlphaCorr")))
    nAlphaSubCycles = ref.readLabel(pimple.dict().lookup(ref.word("nAlphaSubCycles")))
    if nAlphaSubCycles > 1:
        totalDeltaT = runTime.deltaT()
        rhoPhiSum = 0.0 * rhoPhi
        alphaSubCycle = ref.subCycle_volScalarField(alpha1, nAlphaSubCycles)
        for item in alphaSubCycle:
            alphaEqn(mesh, phi, alpha1, rhoPhi, rho1, rho2, interface, nAlphaCorr)
            rhoPhiSum << rhoPhiSum + (runTime.deltaT() / totalDeltaT) * rhoPhi
            pass
        # To make sure that variable in the local scope will be destroyed
        # - during destruction of this variable it performs some important actions
        # - there is a difference between C++ and Python memory management, namely
        # if C++ automatically destroys stack variables when they exit the scope,
        # Python relay its memory management of some "garbage collection" algorithm
        # that do not provide predictable behavior on the "exit of scope"
        del alphaSubCycle

        rhoPhi << rhoPhiSum
    else:
        alphaEqn(mesh, phi, alpha1, rhoPhi, rho1, rho2, interface, nAlphaCorr)
        pass
    interface.correct()

    rho == alpha1 * rho1 + (1.0 - alpha1) * rho2

    pass
Ejemplo n.º 3
0
def alphaEqnsSubCycle(runTime, pimple, mesh, phi, alpha1, alpha2, rho, rho1,
                      rho2, rhoPhi, dgdt, interface):

    nAlphaCorr = ref.readLabel(pimple.dict().lookup(ref.word("nAlphaCorr")))
    nAlphaSubCycles = ref.readLabel(pimple.dict().lookup(
        ref.word("nAlphaSubCycles")))

    phic = (phi() / mesh.magSf()).mag()  # mixed calculations
    phic << (interface.cAlpha() * phic).ext_min(phic.ext_max())

    divU = ref.fvc.div(phi)

    if nAlphaSubCycles > 1:

        totalDeltaT = runTime.deltaT()
        rhoPhiSum = 0.0 * rhoPhi

        alphaSubCycle = ref.subCycle_volScalarField(alpha1, nAlphaSubCycles)
        for item in alphaSubCycle:
            alphaEqns(runTime, mesh, rho1, rho2, rhoPhi, phic, dgdt, divU,
                      alpha1, alpha2, phi, interface, nAlphaCorr)
            rhoPhiSum += (runTime.deltaT() / totalDeltaT) * rhoPhi
            pass
    # To make sure that variable in the local scope will be destroyed
    # - during destruction of this variable it performs some important actions
    # - there is a difference between C++ and Python memory management, namely
    # if C++ automatically destroys stack variables when they exit the scope,
    # Python relay its memory management of some "garbage collection" algorithm
    # that do not provide predictable behavior on the "exit of scope"
        del alphaSubCycle

        rhoPhi << rhoPhiSum
        pass
    else:
        alphaEqns(runTime, mesh, rho1, rho2, rhoPhi, phic, dgdt, divU, alpha1,
                  alpha2, phi, interface, nAlphaCorr)
        pass

    if pimple.corr() == 0:
        interface.correct()
        pass

    pass
Ejemplo n.º 4
0
def alphaEqnsSubCycle( runTime, pimple, mesh, phi, alpha1, alpha2, rho, rho1, rho2, rhoPhi, dgdt, interface ):
    
    nAlphaCorr = ref.readLabel( pimple.dict().lookup( ref.word( "nAlphaCorr" ) ) )
    nAlphaSubCycles = ref.readLabel( pimple.dict().lookup( ref.word( "nAlphaSubCycles" ) ) )
    
    phic = ( phi() / mesh.magSf() ).mag() # mixed calculations
    phic << ( interface.cAlpha() * phic ).ext_min( phic.ext_max() )
    
    divU = ref.fvc.div( phi )
    
    if nAlphaSubCycles > 1:

        totalDeltaT = runTime.deltaT()
        rhoPhiSum = 0.0 * rhoPhi

        alphaSubCycle = ref.subCycle_volScalarField( alpha1, nAlphaSubCycles )
        for item in alphaSubCycle: 
            alphaEqns( runTime, mesh, rho1, rho2, rhoPhi, phic, dgdt, divU, alpha1, alpha2, phi, interface, nAlphaCorr )
            rhoPhiSum += ( runTime.deltaT() / totalDeltaT ) * rhoPhi
            pass
       # To make sure that variable in the local scope will be destroyed
       # - during destruction of this variable it performs some important actions
       # - there is a difference between C++ and Python memory management, namely
       # if C++ automatically destroys stack variables when they exit the scope,
       # Python relay its memory management of some "garbage collection" algorithm
       # that do not provide predictable behavior on the "exit of scope"
        del alphaSubCycle

        rhoPhi << rhoPhiSum
        pass
    else:
        alphaEqns( runTime, mesh, rho1, rho2, rhoPhi, phic, dgdt, divU, alpha1, alpha2, phi, interface, nAlphaCorr )
        pass

    if pimple.corr() == 1:
       interface.correct()
       pass
    
    pass