コード例 #1
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleDyMFlux
def readControls( runTime, mesh ):
    from Foam.finiteVolume.cfdTools.general.include import readTimeControls
    adjustTimeStep, maxCo, maxDeltaT = readTimeControls( runTime )
    
    from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
    pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls( mesh )
    
    correctPhi = False
    from Foam.OpenFOAM import word
    if (pimple.found( word( "correctPhi" ) ) ):
       correctPhi = Switch( pimple.lookup( word( "correctPhi" ) ) )
       pass
  
    checkMeshCourantNo = False
    if ( pimple.found( word( "checkMeshCourantNo" ) ) ):
        checkMeshCourantNo = Switch( pimple.lookup( "checkMeshCourantNo" ) )
        pass

    return adjustTimeStep, maxCo, maxDeltaT, pimple, nOuterCorr, nCorr, nNonOrthCorr, \
           momentumPredictor, transonic, correctPhi, checkMeshCourantNo
コード例 #2
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleDyMFlux
def readControls(runTime, mesh):
    from Foam.finiteVolume.cfdTools.general.include import readTimeControls
    adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

    from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
    pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls(
        mesh)

    correctPhi = False
    from Foam.OpenFOAM import word
    if (pimple.found(word("correctPhi"))):
        correctPhi = Switch(pimple.lookup(word("correctPhi")))
        pass

    checkMeshCourantNo = False
    if (pimple.found(word("checkMeshCourantNo"))):
        checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo"))
        pass

    return adjustTimeStep, maxCo, maxDeltaT, pimple, nOuterCorr, nCorr, nNonOrthCorr, \
           momentumPredictor, transonic, correctPhi, checkMeshCourantNo
コード例 #3
0
def main_standalone(argc, argv):

    from Foam.OpenFOAM.include import setRootCase
    args = setRootCase(argc, argv)

    from Foam.OpenFOAM.include import createTime
    runTime = createTime(args)

    from Foam.OpenFOAM.include import createMesh
    mesh = createMesh(runTime)

    thermo, turbulence, p, h, psi, rho, U, phi, pMin, DpDt, mrfZones, pZones, pressureImplicitPorosity = create_fields(
        runTime, mesh)

    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs
    cumulativeContErr = initContinuityErrs()

    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "\nStarting time loop\n" << nl

    while runTime.run():

        from Foam.finiteVolume.cfdTools.general.include import readTimeControls
        adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

        from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
        pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls(
            mesh)

        from Foam.finiteVolume.cfdTools.compressible import compressibleCourantNo
        CoNum, meanCoNum = compressibleCourantNo(mesh, phi, rho, runTime)

        from Foam.finiteVolume.cfdTools.general.include import setDeltaT
        runTime = setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum)

        runTime.increment()

        ext_Info() << "Time = " << runTime.timeName() << nl << nl

        if nOuterCorr != 1:
            p.storePrevIter()
            rho.storePrevIter()
            pass

        from Foam.finiteVolume.cfdTools.compressible import rhoEqn
        rhoEqn(rho, phi)

        for oCorr in range(nOuterCorr):
            UEqn = fun_UEqn(mesh, pZones, rho, U, phi, turbulence, mrfZones, p,
                            momentumPredictor, oCorr, nOuterCorr)
            hEqn = fun_hEqn(mesh, rho, h, phi, turbulence, DpDt, thermo, oCorr,
                            nOuterCorr)

            for corr in range(nCorr):
                fun_pEqn(mesh, thermo, p, rho, psi, U, phi, DpDt, pMin, UEqn,
                         mrfZones, nNonOrthCorr, nCorr, oCorr, nOuterCorr,
                         corr, transonic, cumulativeContErr)
                pass
            turbulence.correct()
            pass

        runTime.write()

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

        pass

    ext_Info() << "End\n"

    import os
    return os.EX_OK
コード例 #4
0
ファイル: __init__.py プロジェクト: asimurzin/rhoPimpleFlux
def main_standalone(argc, argv):

    from Foam.OpenFOAM.include import setRootCase

    args = setRootCase(argc, argv)

    from Foam.OpenFOAM.include import createTime

    runTime = createTime(args)

    from Foam.OpenFOAM.include import createMesh

    mesh = createMesh(runTime)

    p, h, psi, rho, U, phi, turbulence, thermo, pMin, DpDt = _createFields(runTime, mesh)

    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs

    cumulativeContErr = initContinuityErrs()

    from Foam.OpenFOAM import ext_Info, nl

    ext_Info() << "\nStarting time loop\n" << nl

    while runTime.run():

        from Foam.finiteVolume.cfdTools.general.include import readTimeControls

        adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

        from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls

        pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls(mesh)

        from Foam.finiteVolume.cfdTools.compressible import compressibleCourantNo

        CoNum, meanCoNum, velMag = compressibleCourantNo(mesh, phi, rho, runTime)

        from Foam.finiteVolume.cfdTools.general.include import setDeltaT

        runTime = setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum)

        runTime.increment()
        ext_Info() << "Time = " << runTime.timeName() << nl << nl

        if nOuterCorr != 1:
            p.storePrevIter()
            rho.storePrevIter()
            pass

        from Foam.finiteVolume.cfdTools.compressible import rhoEqn

        rhoEqn(rho, phi)

        # --- Pressure-velocity PIMPLE corrector loop
        for oCorr in range(nOuterCorr):
            UEqn = _UEqn(mesh, U, rho, phi, turbulence, p, oCorr, nOuterCorr, momentumPredictor)

            hEqn = _hEqn(mesh, rho, h, phi, turbulence, DpDt, thermo, oCorr, nOuterCorr)

            # --- PISO loop

            for corr in range(nCorr):
                cumulativeContErr = _pEqn(
                    rho,
                    thermo,
                    UEqn,
                    nNonOrthCorr,
                    psi,
                    U,
                    mesh,
                    phi,
                    p,
                    DpDt,
                    pMin,
                    corr,
                    cumulativeContErr,
                    nCorr,
                    oCorr,
                    nOuterCorr,
                    transonic,
                )
                pass

            turbulence.correct()
            pass

        runTime.write()

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

        pass

    ext_Info() << "End\n"

    import os

    return os.EX_OK
コード例 #5
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleDyMFlux
def main_standalone(argc, argv):

    from Foam.OpenFOAM.include import setRootCase
    args = setRootCase(argc, argv)

    from Foam.OpenFOAM.include import createTime
    runTime = createTime(args)

    from Foam.dynamicFvMesh import createDynamicFvMesh
    mesh = createDynamicFvMesh(runTime)

    from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
    pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls(
        mesh)

    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs
    cumulativeContErr = initContinuityErrs()

    p, U, phi, laminarTransport, turbulence, rAU, pRefCell, pRefValue = _createFields(
        runTime, mesh)

    from Foam.finiteVolume.cfdTools.general.include import readTimeControls
    adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "\nStarting time loop\n" << nl

    while runTime.run():

        adjustTimeStep, maxCo, maxDeltaT, pimple, nOuterCorr, nCorr, nNonOrthCorr, \
                        momentumPredictor, transonic, correctPhi, checkMeshCourantNo = readControls( runTime, mesh )

        from Foam.finiteVolume.cfdTools.general.include import CourantNo
        CoNum, meanCoNum = CourantNo(mesh, phi, runTime)

        # Make the fluxes absolute
        from Foam import fvc
        fvc.makeAbsolute(phi, U)

        from Foam.finiteVolume.cfdTools.general.include import setDeltaT
        runTime = setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum)

        runTime.increment()

        ext_Info() << "Time = " << runTime.timeName() << nl << nl

        mesh.update()

        if mesh.changing() and correctPhi:
            cumulativeContErr = _correctPhi(runTime, mesh, p, rAU, phi,
                                            nNonOrthCorr, pRefCell, pRefValue,
                                            cumulativeContErr)
            pass

        # Make the fluxes relative to the mesh motion
        fvc.makeRelative(phi, U)

        if mesh.changing() and checkMeshCourantNo:
            from Foam.dynamicFvMesh import meshCourantNo
            meshCoNum, meanMeshCoNum = meshCourantNo(runTime, mesh, phi)
            pass

        from Foam import fvm
        #PIMPLE loop
        for ocorr in range(nOuterCorr):
            if nOuterCorr != 1:
                p.storePrevIter()
                pass
            UEqn = _UEqn(mesh, phi, U, p, turbulence, ocorr, nOuterCorr,
                         momentumPredictor)

            # --- PISO loop
            for corr in range(nCorr):
                rAU.ext_assign(1.0 / UEqn.A())

                U.ext_assign(rAU * UEqn.H())
                phi.ext_assign(fvc.interpolate(U) & mesh.Sf())

                if p.needReference():
                    fvc.makeRelative(phi, U)
                    adjustPhi(phi, U, p)
                    fvc.makeAbsolute(phi, U)
                    pass

                for nonOrth in range(nNonOrthCorr + 1):
                    pEqn = (fvm.laplacian(rAU, p) == fvc.div(phi))

                    pEqn.setReference(pRefCell, pRefValue)

                    if ocorr == nOuterCorr - 1 and corr == nCorr - 1 \
                                               and nonOrth == nNonOrthCorr :
                        from Foam.OpenFOAM import word
                        pEqn.solve(mesh.solver(word(str(p.name()) + "Final")))
                        pass
                    else:
                        pEqn.solve(mesh.solver(p.name()))
                        pass

                    if nonOrth == nNonOrthCorr:
                        phi.ext_assign(phi - pEqn.flux())
                        pass

                    pass

                from Foam.finiteVolume.cfdTools.general.include import ContinuityErrs
                cumulativeContErr = ContinuityErrs(phi, runTime, mesh,
                                                   cumulativeContErr)

                # Explicitly relax pressure for momentum corrector
                if ocorr != nOuterCorr - 1:
                    p.relax()
                    pass

                # Make the fluxes relative to the mesh motion
                fvc.makeRelative(phi, U)
                U.ext_assign(U - rAU * fvc.grad(p))
                U.correctBoundaryConditions()
                pass
            pass

        turbulence.correct()

        runTime.write()

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

        pass

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

    import os
    return os.EX_OK
コード例 #6
0
def main_standalone( argc, argv ):

    from Foam.OpenFOAM.include import setRootCase
    args = setRootCase( argc, argv )

    from Foam.OpenFOAM.include import createTime
    runTime = createTime( args )

    from Foam.OpenFOAM.include import createMesh
    mesh = createMesh( runTime )
    
    from Foam.finiteVolume.cfdTools.general.include import readGravitationalAcceleration
    g = readGravitationalAcceleration( runTime, mesh)

    thermo, p, rho, h, psi, U, phi, turbulence, gh, ghf, p_rgh, DpDt = create_fields( runTime, mesh, g )
    
    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs
    cumulativeContErr = initContinuityErrs()
    
    from Foam.finiteVolume.cfdTools.general.include import readTimeControls
    adjustTimeStep, maxCo, maxDeltaT = readTimeControls( runTime )
    
    from Foam.finiteVolume.cfdTools.compressible import compressibleCourantNo
    CoNum, meanCoNum = compressibleCourantNo( mesh, phi, rho, runTime )
    
    from Foam.finiteVolume.cfdTools.general.include import setInitialDeltaT
    runTime = setInitialDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
    
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info()<< "\nStarting time loop\n" << nl
    
    while runTime.run() :
        
        from Foam.finiteVolume.cfdTools.general.include import readTimeControls
        adjustTimeStep, maxCo, maxDeltaT = readTimeControls( runTime )
    
        from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
        pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls( mesh )
        
        from Foam.finiteVolume.cfdTools.compressible import compressibleCourantNo
        CoNum, meanCoNum = compressibleCourantNo( mesh, phi, rho, runTime )
        
        from Foam.finiteVolume.cfdTools.general.include import setDeltaT
        runTime = setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
        
        runTime.increment()
        ext_Info() << "Time = " << runTime.timeName() << nl << nl
        
        from Foam.finiteVolume.cfdTools.compressible import rhoEqn  
        rhoEqn( rho, phi )
        
        # --- Pressure-velocity PIMPLE corrector loop
        for oCorr in range( nOuterCorr ):
            finalIter = oCorr == ( nOuterCorr-1 )

            if nOuterCorr != 1:
                p_rgh.storePrevIter()
                pass

            UEqn = fun_UEqn( mesh, rho, phi, U, p_rgh, ghf, turbulence, finalIter, momentumPredictor )
            fun_hEqn( mesh, rho, h, phi, DpDt, thermo, turbulence, finalIter )

            # --- PISO loop
            for corr in range( nCorr ):
                cumulativeContErr = fun_pEqn( mesh, p, rho, psi, p_rgh, U, phi, ghf, gh, DpDt, UEqn, \
                                              thermo, nNonOrthCorr, corr, nCorr, finalIter, cumulativeContErr )
                pass

            turbulence.correct()

            rho.ext_assign( thermo.rho() )
            pass

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

    import os
    return os.EX_OK
コード例 #7
0
def main_standalone(argc, argv):

    from Foam.OpenFOAM.include import setRootCase

    args = setRootCase(argc, argv)

    from Foam.OpenFOAM.include import createTime

    runTime = createTime(args)

    from Foam.OpenFOAM.include import createMesh

    mesh = createMesh(runTime)

    from Foam.finiteVolume.cfdTools.general.include import readGravitationalAcceleration

    g = readGravitationalAcceleration(runTime, mesh)

    from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls

    pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls(mesh)

    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs

    cumulativeContErr = initContinuityErrs()

    p_rgh, alpha1, U, phi, twoPhaseProperties, rho1, rho2, Dab, alphatab, rho, rhoPhi, turbulence, gh, ghf, p, pRefCell, pRefValue = _createFields(
        runTime, mesh, g
    )

    from Foam.finiteVolume.cfdTools.general.include import readTimeControls

    adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

    from Foam.finiteVolume.cfdTools.incompressible import CourantNo

    CoNum, meanCoNum = CourantNo(mesh, phi, runTime)

    from Foam.finiteVolume.cfdTools.general.include import setInitialDeltaT

    runTime = setInitialDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum)

    from Foam.OpenFOAM import ext_Info, nl

    ext_Info() << "\nStarting time loop\n" << nl

    while runTime.run():
        pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls(mesh)
        adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)
        CoNum, meanCoNum = CourantNo(mesh, phi, runTime)

        from Foam.finiteVolume.cfdTools.general.include import setDeltaT

        runTime = setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum)

        runTime.increment()
        ext_Info() << "Time = " << runTime.timeName() << nl << nl

        # --- Pressure-velocity PIMPLE corrector loop
        for oCorr in range(nOuterCorr):
            finalIter = oCorr == nOuterCorr - 1

            twoPhaseProperties.correct()

            alphaEqn(mesh, phi, alpha1, alphatab, Dab, rhoPhi, rho, rho1, rho2, turbulence)

            UEqn = fun_UEqn(
                mesh, U, p_rgh, ghf, rho, rhoPhi, turbulence, twoPhaseProperties, momentumPredictor, finalIter
            )

            # --- PISO loop
            for corr in range(nCorr):
                cumulativeContErr = fun_pEqn(
                    runTime,
                    mesh,
                    UEqn,
                    U,
                    p,
                    p_rgh,
                    gh,
                    ghf,
                    phi,
                    rho,
                    finalIter,
                    corr,
                    nCorr,
                    nNonOrthCorr,
                    pRefCell,
                    pRefValue,
                    cumulativeContErr,
                )
                pass

            turbulence.correct()
            pass

        runTime.write()
        ext_Info() << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << "  ClockTime = " << runTime.elapsedClockTime() << " s" << nl << nl

        pass

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

    import os

    return os.EX_OK
コード例 #8
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleDyMFlux
def main_standalone( argc, argv ):

    from Foam.OpenFOAM.include import setRootCase
    args = setRootCase( argc, argv )

    from Foam.OpenFOAM.include import createTime
    runTime = createTime( args )

    from Foam.dynamicFvMesh import createDynamicFvMesh
    mesh = createDynamicFvMesh( runTime )
    
    from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
    pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls( mesh )
    
    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs
    cumulativeContErr = initContinuityErrs()

    p, U, phi, laminarTransport, turbulence, rAU, pRefCell, pRefValue = _createFields( runTime, mesh )    
    
    from Foam.finiteVolume.cfdTools.general.include import readTimeControls
    adjustTimeStep, maxCo, maxDeltaT = readTimeControls( runTime )
    
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "\nStarting time loop\n" <<nl
    
    while runTime.run() :
        
        adjustTimeStep, maxCo, maxDeltaT, pimple, nOuterCorr, nCorr, nNonOrthCorr, \
                        momentumPredictor, transonic, correctPhi, checkMeshCourantNo = readControls( runTime, mesh )
        
        from Foam.finiteVolume.cfdTools.general.include import CourantNo
        CoNum, meanCoNum, velMag = CourantNo( mesh, phi, runTime )
        
        # Make the fluxes absolute
        from Foam import fvc
        fvc.makeAbsolute(phi, U)
      
        from Foam.finiteVolume.cfdTools.general.include import setDeltaT
        runTime = setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
        
        runTime.increment()
                
        ext_Info() << "Time = " << runTime.timeName() << nl << nl
        
        meshChanged = mesh.update()
        
        if correctPhi and ( mesh.moving() or meshChanged ) :
           cumulativeContErr = _correctPhi( runTime, mesh, p, rAU, phi, nNonOrthCorr, pRefCell, pRefValue, cumulativeContErr  )
           pass
        
        # Make the fluxes relative to the mesh motion
        fvc.makeRelative( phi, U )
        
        
        if mesh.moving() and checkMeshCourantNo :
           from Foam.dynamicFvMesh import meshCourantNo
           meshCoNum, meanMeshCoNum = meshCourantNo( runTime, mesh, phi )
           pass
        
        from Foam import fvm
        #PIMPLE loop
        for ocorr in range( nOuterCorr ):
           if nOuterCorr != 1:
              p.storePrevIter()
              pass
           UEqn = _UEqn( mesh, phi, U, p, turbulence, ocorr, nOuterCorr, momentumPredictor )
           
           # --- PISO loop
           for corr in range( nCorr ):
              rAU.ext_assign( 1.0 / UEqn.A() )
              
              U.ext_assign( rAU * UEqn.H() )
              phi.ext_assign( fvc.interpolate( U ) & mesh.Sf() )
              
              if p.needReference() :
                 fvc.makeRelative( phi, U )
                 adjustPhi( phi, U, p )
                 fvc.makeAbsolute( phi, U )
                 pass
              
              for nonOrth in range( nNonOrthCorr + 1 ):
                 pEqn = ( fvm.laplacian( rAU, p ) == fvc.div( phi ) )
                 
                 pEqn.setReference( pRefCell, pRefValue )
                 
                 if ocorr == nOuterCorr - 1 and corr == nCorr - 1 \
                                            and nonOrth == nNonOrthCorr :
                    from Foam.OpenFOAM import word
                    pEqn.solve( mesh.solver( word( str( p.name() ) + "Final" ) ) )
                    pass
                 else:
                    pEqn.solve( mesh.solver( p.name() ) )
                    pass
                    
                 if nonOrth == nNonOrthCorr:
                    phi.ext_assign( phi - pEqn.flux() )
                    pass
                 
                 pass
                 
              from Foam.finiteVolume.cfdTools.general.include import ContinuityErrs
              cumulativeContErr = ContinuityErrs( phi, runTime, mesh, cumulativeContErr )
                 
              # Explicitly relax pressure for momentum corrector
              if ocorr != nOuterCorr - 1:
                 p.relax()
                 pass
                 
              # Make the fluxes relative to the mesh motion
              fvc.makeRelative( phi, U )
              U.ext_assign( U - rAU * fvc.grad( p ) )
              U.correctBoundaryConditions()
              pass
           turbulence.correct()   
           pass

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

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

    import os
    return os.EX_OK
コード例 #9
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleFlux
def main_standalone( argc, argv ):

    from Foam.OpenFOAM.include import setRootCase
    args = setRootCase( argc, argv )

    from Foam.OpenFOAM.include import createTime
    runTime = createTime( args )

    from Foam.OpenFOAM.include import createMesh
    mesh = createMesh( runTime )

    p, U, phi, turbulence, pRefCell, pRefValue, laminarTransport = _createFields( runTime, mesh )
    
    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs
    cumulativeContErr = initContinuityErrs()
    
    
    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "\nStarting time loop\n" <<nl
    
    while runTime.run() :
        from Foam.finiteVolume.cfdTools.general.include import readTimeControls
        adjustTimeStep, maxCo, maxDeltaT = readTimeControls( runTime )

        from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
        pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls( mesh )

        from Foam.finiteVolume.cfdTools.general.include import CourantNo
        CoNum, meanCoNum = CourantNo( mesh, phi, runTime )
      
        from Foam.finiteVolume.cfdTools.general.include import setDeltaT
        runTime = setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
        
        runTime.increment()
                
        ext_Info() << "Time = " << runTime.timeName() << nl << nl
        
        # --- Pressure-velocity PIMPLE corrector loop
        for oCorr in range(nOuterCorr):
            if nOuterCorr != 1 :
               p.storePrevIter()
               pass
            
            UEqn, rUA = Ueqn( mesh, phi, U, p, turbulence, oCorr, nOuterCorr, momentumPredictor )
            
            # --- PISO loop
            for corr in range( nCorr ):
               cumulativeContErr = pEqn( runTime, mesh, U, rUA, UEqn, phi, p, nCorr, nOuterCorr,\
                                         nNonOrthCorr, oCorr, corr, pRefCell, pRefValue, cumulativeContErr )
               pass
                                         
            turbulence.correct()
            pass

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

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

    import os
    return os.EX_OK
コード例 #10
0
ファイル: __init__.py プロジェクト: asimurzin/pimpleFlux
def main_standalone(argc, argv):

    from Foam.OpenFOAM.include import setRootCase
    args = setRootCase(argc, argv)

    from Foam.OpenFOAM.include import createTime
    runTime = createTime(args)

    from Foam.OpenFOAM.include import createMesh
    mesh = createMesh(runTime)

    p, U, phi, turbulence, pRefCell, pRefValue, laminarTransport = _createFields(
        runTime, mesh)

    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs
    cumulativeContErr = initContinuityErrs()

    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "\nStarting time loop\n" << nl

    while runTime.run():
        from Foam.finiteVolume.cfdTools.general.include import readTimeControls
        adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

        from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
        pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls(
            mesh)

        from Foam.finiteVolume.cfdTools.general.include import CourantNo
        CoNum, meanCoNum, velMag = CourantNo(mesh, phi, runTime)

        from Foam.finiteVolume.cfdTools.general.include import setDeltaT
        runTime = setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum)

        runTime.increment()

        ext_Info() << "Time = " << runTime.timeName() << nl << nl

        # --- Pressure-velocity PIMPLE corrector loop
        for oCorr in range(nOuterCorr):
            if nOuterCorr != 1:
                p.storePrevIter()
                pass

            UEqn, rUA = Ueqn(mesh, phi, U, p, turbulence, oCorr, nOuterCorr,
                             momentumPredictor)

            # --- PISO loop
            for corr in range(nCorr):
                cumulativeContErr = pEqn( runTime, mesh, U, rUA, UEqn, phi, p, nCorr, nOuterCorr,\
                                          nNonOrthCorr, oCorr, corr, pRefCell, pRefValue, cumulativeContErr )
                pass

            turbulence.correct()
            pass

        runTime.write()

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

        pass

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

    import os
    return os.EX_OK
コード例 #11
0
def main_standalone(argc, argv):

    from Foam.OpenFOAM.include import setRootCase
    args = setRootCase(argc, argv)

    from Foam.OpenFOAM.include import createTime
    runTime = createTime(args)

    from Foam.OpenFOAM.include import createMesh
    mesh = createMesh(runTime)

    from Foam.finiteVolume.cfdTools.general.include import readGravitationalAcceleration
    g = readGravitationalAcceleration(runTime, mesh)

    thermo, p, rho, h, psi, U, phi, turbulence, gh, ghf, p_rgh, DpDt = create_fields(
        runTime, mesh, g)

    from Foam.finiteVolume.cfdTools.general.include import initContinuityErrs
    cumulativeContErr = initContinuityErrs()

    from Foam.finiteVolume.cfdTools.general.include import readTimeControls
    adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

    from Foam.finiteVolume.cfdTools.compressible import compressibleCourantNo
    CoNum, meanCoNum = compressibleCourantNo(mesh, phi, rho, runTime)

    from Foam.finiteVolume.cfdTools.general.include import setInitialDeltaT
    runTime = setInitialDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT,
                               CoNum)

    from Foam.OpenFOAM import ext_Info, nl
    ext_Info() << "\nStarting time loop\n" << nl

    while runTime.run():

        from Foam.finiteVolume.cfdTools.general.include import readTimeControls
        adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

        from Foam.finiteVolume.cfdTools.general.include import readPIMPLEControls
        pimple, nOuterCorr, nCorr, nNonOrthCorr, momentumPredictor, transonic = readPIMPLEControls(
            mesh)

        from Foam.finiteVolume.cfdTools.compressible import compressibleCourantNo
        CoNum, meanCoNum = compressibleCourantNo(mesh, phi, rho, runTime)

        from Foam.finiteVolume.cfdTools.general.include import setDeltaT
        runTime = setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum)

        runTime.increment()
        ext_Info() << "Time = " << runTime.timeName() << nl << nl

        from Foam.finiteVolume.cfdTools.compressible import rhoEqn
        rhoEqn(rho, phi)

        # --- Pressure-velocity PIMPLE corrector loop
        for oCorr in range(nOuterCorr):
            finalIter = oCorr == (nOuterCorr - 1)

            if nOuterCorr != 1:
                p_rgh.storePrevIter()
                pass

            UEqn = fun_UEqn(mesh, rho, phi, U, p_rgh, ghf, turbulence,
                            finalIter, momentumPredictor)
            fun_hEqn(mesh, rho, h, phi, DpDt, thermo, turbulence, finalIter)

            # --- PISO loop
            for corr in range(nCorr):
                cumulativeContErr = fun_pEqn( mesh, p, rho, psi, p_rgh, U, phi, ghf, gh, DpDt, UEqn, \
                                              thermo, nNonOrthCorr, corr, nCorr, finalIter, cumulativeContErr )
                pass

            turbulence.correct()

            rho.ext_assign(thermo.rho())
            pass

        runTime.write()

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

        pass

    ext_Info() << "End\n"

    import os
    return os.EX_OK