Example #1
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    g = ref.readGravitationalAcceleration(runTime, mesh)

    pThermo, rho, p, h, psi, U, phi, turbulence, gh, ghf, p_rgh, \
         pRefCell, pRefValue, initialMass, totalVolume = createFields( runTime, mesh, g )

    cumulativeContErr = ref.initContinuityErrs()
    simple = man.simpleControl(mesh)

    # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    ref.ext_Info() << "\nStarting time loop\n" << ref.nl

    while simple.loop():
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl

        p_rgh.storePrevIter()
        rho.storePrevIter()

        # Pressure-velocity SIMPLE corrector
        UEqn = fun_Ueqn(simple, mesh, rho, U, phi, turbulence, ghf, p_rgh)
        fun_hEqn(pThermo, rho, p, h, phi, turbulence)
        fun_pEqn(mesh, runTime, simple, pThermo, rho, p, h, psi, U, phi,
                 turbulence, gh, ghf, p_rgh, UEqn, pRefCell, pRefValue,
                 cumulativeContErr, initialMass)

        turbulence.correct()

        runTime.write()

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

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

    import os
    return os.EX_OK
Example #2
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    g = ref.readGravitationalAcceleration( runTime, mesh )

    pThermo, rho, p, h, psi, U, phi, turbulence, gh, ghf, p_rgh, \
         pRefCell, pRefValue, initialMass, totalVolume = createFields( runTime, mesh, g )

    cumulativeContErr = ref.initContinuityErrs()
    simple = man.simpleControl( mesh )

    # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    ref.ext_Info() << "\nStarting time loop\n" << ref.nl

    while simple.loop():
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl

        p_rgh.storePrevIter()
        rho.storePrevIter()

        # Pressure-velocity SIMPLE corrector
        UEqn = fun_Ueqn( simple, mesh, rho, U, phi, turbulence, ghf, p_rgh )
        fun_hEqn( pThermo, rho, p, h, phi, turbulence )
        fun_pEqn( mesh, runTime, simple, pThermo, rho, p, h, psi, U, phi, turbulence, 
                  gh, ghf, p_rgh, UEqn, pRefCell, pRefValue, cumulativeContErr, initialMass)

        turbulence.correct()

        runTime.write()

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

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

    import os
    return os.EX_OK
Example #3
0
def main_standalone(argc, argv):
    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    g = ref.readGravitationalAcceleration(runTime, mesh)

    thermo, p, rho, h, psi, U, phi, turbulence, gh, ghf, p_rgh, dpdt, K = createFields(
        runTime, mesh, g)

    cumulativeContErr = ref.initContinuityErrs()

    adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls(runTime)

    CoNum, meanCoNum = ref.compressibleCourantNo(mesh, phi, rho, runTime)

    runTime = ref.setInitialDeltaT(runTime, adjustTimeStep, maxCo, CoNum)

    pimple = man.pimpleControl(mesh)

    # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

    while runTime.run():

        adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls(runTime)
        CoNum, meanCoNum = ref.compressibleCourantNo(mesh, phi, rho, runTime)

        runTime = ref.setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT,
                                CoNum)
        runTime.increment()

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

        ref.rhoEqn(rho, phi)

        # --- Pressure-velocity PIMPLE corrector loop
        while pimple.loop():

            UEqn = fun_Ueqn(pimple, mesh, rho, U, phi, turbulence, ghf, p_rgh,
                            K)
            fun_hEqn(thermo, rho, p, h, phi, turbulence, dpdt, K)

            # --- Pressure corrector loop
            while pimple.correct():
                cumulativeContErr = fun_pEqn(mesh, runTime, pimple, thermo,
                                             rho, p, h, psi, U, phi,
                                             turbulence, gh, ghf, p_rgh, UEqn,
                                             dpdt, K, cumulativeContErr)
                pass
            if pimple.turbCorr():
                turbulence.correct()
                pass

            pass
        rho << thermo.rho()

        runTime.write()

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

    import os
    return os.EX_OK
Example #4
0
def main_standalone(argc, argv):
    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    g = ref.readGravitationalAcceleration(runTime, mesh)

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

    cumulativeContErr = ref.initContinuityErrs()

    adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls(runTime)

    CoNum, meanCoNum = ref.compressibleCourantNo(mesh, phi, rho, runTime)

    runTime = ref.setInitialDeltaT(runTime, adjustTimeStep, maxCo, CoNum)

    pimple = man.pimpleControl(mesh)

    # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

    while runTime.run():

        adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls(runTime)
        CoNum, meanCoNum = ref.compressibleCourantNo(mesh, phi, rho, runTime)

        runTime = ref.setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum)
        runTime.increment()

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

        ref.rhoEqn(rho, phi)

        # --- Pressure-velocity PIMPLE corrector loop
        pimple.start()
        while pimple.loop():
            if pimple.nOuterCorr() != 1:
                p_rgh.storePrevIter()
                pass

            UEqn = fun_Ueqn(pimple, mesh, rho, U, phi, turbulence, ghf, p_rgh)
            fun_hEqn(thermo, rho, p, h, phi, turbulence, DpDt)

            # --- PISO loop
            for corr in range(pimple.nCorr()):
                cumulativeContErr = fun_pEqn(
                    mesh,
                    runTime,
                    pimple,
                    thermo,
                    rho,
                    p,
                    h,
                    psi,
                    U,
                    phi,
                    turbulence,
                    gh,
                    ghf,
                    p_rgh,
                    UEqn,
                    DpDt,
                    cumulativeContErr,
                    corr,
                )
                pass
            if pimple.turbCorr():
                turbulence.correct()
                pass

            pimple.increment()
            pass
        rho << thermo.rho()

        runTime.write()

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

    import os

    return os.EX_OK