예제 #1
0
def main_standalone( argc, argv ):
 
    args = ref.setRootCase( argc, argv )
    
    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    pimple = man.pimpleControl(mesh)
    
    pThermo, p, h, psi, rho, U, phi, rhoMax, rhoMin, turbulence, dpdt, K = createFields( runTime, mesh, pimple )
    
    mrfZones, pZones, pressureImplicitPorosity = createZones( mesh, U )
  
    cumulativeContErr = ref.initContinuityErrs()
  
    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, rho, p, U, phi, turbulence, mrfZones, pZones )
      
            fun_hEqn(pThermo, rho, p, h, phi, turbulence, dpdt, K )

            # --- PISO loop
            while (pimple.correct()):
                cumulativeContErr = fun_pEqn( mesh, runTime, pimple, pThermo, rho, p, h, psi, U, phi, mrfZones,
                                              turbulence, UEqn, dpdt, K, cumulativeContErr, rhoMax, rhoMin )
                pass
            
            if pimple.turbCorr():
                turbulence.correct()
                pass
            
            pass
        
        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
예제 #2
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )

    p, U, phi, turbulence, pRefCell, pRefValue, laminarTransport = _createFields( runTime, mesh )
    
    cumulativeContErr = ref.initContinuityErrs()
    
    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.CourantNo( mesh, phi, runTime )
      
        runTime = ref.setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
        
        runTime.increment()
                
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
        
        # --- Pressure-velocity PIMPLE corrector loop
        pimple.start()
        while pimple.loop():
            if pimple.nOuterCorr() != 1 :
               p.storePrevIter()
               pass
            
            UEqn, rAU = Ueqn( mesh, pimple, phi, U, p, turbulence )
            
            # --- PISO loop
            for corr in range( pimple.nCorr() ):
               cumulativeContErr = pEqn( runTime, mesh, pimple, U, rAU, UEqn, phi, p, corr, pRefCell, pRefValue, cumulativeContErr )
               pass
            
            if pimple.turbCorr():                             
                turbulence.correct()
                pass
            pimple.increment()
            pass

        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
예제 #3
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

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

    cumulativeContErr = ref.initContinuityErrs()

    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.CourantNo(mesh, phi, runTime)

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

        runTime.increment()

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

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

            UEqn, rAU = Ueqn(mesh, pimple, phi, U, p, turbulence, sources)

            # --- Pressure corrector loop
            while pimple.correct():
                cumulativeContErr = pEqn(runTime, mesh, pimple, U, rAU, UEqn,
                                         phi, p, pRefCell, pRefValue,
                                         cumulativeContErr, sources)
                pass

            if pimple.turbCorr():
                turbulence.correct()
                pass
            pass

        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
예제 #4
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )

    p, U, Urel, SRF, phi, turbulence, pRefCell, pRefValue, laminarTransport, sources = _createFields( runTime, mesh )
    
    cumulativeContErr = ref.initContinuityErrs()
    
    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.CourantNo( mesh, phi, runTime )
      
        runTime = ref.setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
        
        runTime.increment()
                
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
        
        # --- Pressure-velocity PIMPLE corrector loop
        while pimple.loop():

            UrelEqn = _UrelEqn( mesh, pimple, phi, Urel, p, turbulence, SRF, sources )
            
            # --- Pressure corrector loop
            while pimple.correct():
               cumulativeContErr = pEqn( runTime, mesh, pimple, Urel, UrelEqn, phi, p, pRefCell, pRefValue, cumulativeContErr, sources )
               pass
            
            # Update the absolute velocity
            U << Urel() + SRF.U() # mixed calculations
            
            if pimple.turbCorr():                             
                turbulence.correct()
                pass
            pass

        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
예제 #5
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    pThermo, p, e, psi, rho, U, phi, turbulence = createFields(runTime, mesh)

    cumulativeContErr = ref.initContinuityErrs()

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

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

        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls(
            mesh)

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

        ref.rhoEqn(rho, phi)

        UEqn = fun_Ueqn(rho, U, phi, turbulence, p)

        fun_eEqn(rho, e, phi, turbulence, p, pThermo)

        for corr in range(nCorr):
            cumulativeContErr = fun_pEqn(mesh, runTime, pThermo, rho, p, psi,
                                         U, phi, turbulence, UEqn,
                                         cumulativeContErr, nNonOrthCorr)
            pass

        turbulence.correct()

        rho << pThermo.rho()

        runTime.write()

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

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

    import os
    return os.EX_OK
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    g = readGravitationalAcceleration(runTime, mesh)

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

    radiation = man.radiation.createRadiationModel(pThermo)

    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()

        UEqn = fun_Ueqn(simple, mesh, rho, U, phi, turbulence, ghf, p_rgh)

        fun_hEqn(pThermo, rho, p, h, phi, radiation, turbulence)

        cumulativeContErr = 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"

    import os
    return os.EX_OK
예제 #7
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    p, Urel, phi, pRefCell, pRefValue, laminarTransport, turbulence, SRF, sources = createFields(
        runTime, mesh)

    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

        # --- Pressure-velocity SIMPLE corrector
        UrelEqn = fun_UrelEqn(Urel, phi, turbulence, p, sources, SRF)
        cumulativeContErr = fun_pEqn(mesh, runTime, simple, Urel, phi,
                                     turbulence, p, UrelEqn, pRefCell,
                                     pRefValue, cumulativeContErr, sources)

        turbulence.correct()

        Uabs = None
        if runTime.outputTime():
            Uabs = ref.volVectorField(
                ref.IOobject(ref.word("Uabs"),
                             ref.fileName(runTime.timeName()), mesh,
                             ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
                Urel() + SRF.U())  # mixed calculations
            pass

        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
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    g = readGravitationalAcceleration(runTime, mesh)

    T, p_rgh, U, phi, laminarTransport, turbulence, rhok, \
       kappat, gh, ghf, p, pRefCell, pRefValue, beta, TRef, Pr, Prt  = 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()

        # Pressure-velocity SIMPLE corrector
        UEqn = fun_UEqn(mesh, simple, U, phi, turbulence, p, rhok, p_rgh, ghf)
        fun_TEqn(phi, turbulence, kappat, T, rhok, beta, TRef, Prt, Pr)

        cumulativeContErr = fun_pEqn(mesh, runTime, simple, p, rhok, U, phi,
                                     turbulence, gh, ghf, p_rgh, UEqn,
                                     pRefCell, pRefValue, cumulativeContErr)

        turbulence.correct()
        runTime.write()

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

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

    import os
    return os.EX_OK
def main_standalone( argc, argv ):
  
  args = ref.setRootCase( argc, argv )
  
  runTime=man.createTime( args )
    
  mesh = man.createMesh( runTime )
    
  g = readGravitationalAcceleration( runTime, mesh );

  T, p_rgh, U, phi, laminarTransport, turbulence, rhok, \
     kappat, gh, ghf, p, pRefCell, pRefValue, beta, TRef, Pr, Prt  = 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()

    # Pressure-velocity SIMPLE corrector
    UEqn = fun_UEqn( mesh, simple, U, phi, turbulence, p, rhok, p_rgh, ghf )
    fun_TEqn( phi, turbulence, kappat, T, rhok, beta, TRef, Prt, Pr )

    cumulativeContErr = fun_pEqn( mesh, runTime, simple, p, rhok, U, phi, turbulence, gh, ghf, p_rgh, UEqn, pRefCell, pRefValue, cumulativeContErr )
    
    turbulence.correct()
    runTime.write()
    
    ref.ext_Info() << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" \
               << "  ClockTime = " << runTime.elapsedClockTime() << " s" \
               << ref.nl << ref.nl
    pass
  pass

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

  import os
  return os.EX_OK
예제 #10
0
def main_standalone( argc, argv ):
    
    args = ref.setRootCase( argc, argv )
    
    runTime = man.createTime( args )
    
    mesh = man.createMesh( runTime )
        
    p, Urel, phi, pRefCell, pRefValue, laminarTransport, turbulence, SRF, sources = createFields( runTime, mesh )

    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

        # --- Pressure-velocity SIMPLE corrector
        UrelEqn = fun_UrelEqn( Urel, phi, turbulence, p, sources, SRF )
        cumulativeContErr = fun_pEqn( mesh, runTime, simple, Urel, phi, turbulence, p, UrelEqn, pRefCell, pRefValue, cumulativeContErr, sources )

        turbulence.correct()
        
        Uabs = None
        if runTime.outputTime():
                Uabs = ref.volVectorField( ref.IOobject( ref.word( "Uabs" ),
                                                         ref.fileName( runTime.timeName() ),
                                                         mesh,
                                                         ref.IOobject.NO_READ,
                                                         ref.IOobject.AUTO_WRITE ),
                                           Urel() + SRF.U() ) # mixed calculations
                pass

        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
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

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

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

    radiation = man.radiation.createRadiationModel( pThermo )
    
    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()
        
        UEqn = fun_Ueqn( simple, mesh, rho, U, phi, turbulence, ghf, p_rgh )

        fun_hEqn( pThermo, rho, p, h, phi, radiation, turbulence )

        cumulativeContErr = 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"

    import os
    return os.EX_OK
예제 #12
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

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

    cumulativeContErr = ref.initContinuityErrs()

    simple = man.simpleControl(mesh)

    mrfZones = man.MRFZones(mesh)
    mrfZones.correctBoundaryVelocity(U)

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

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

        # --- Pressure-velocity SIMPLE corrector
        UEqn = fun_UEqn(U, phi, turbulence, p, sources, mrfZones)

        cumulativeContErr = fun_pEqn(mesh, runTime, simple, U, phi, turbulence,
                                     p, UEqn, mrfZones, pRefCell, pRefValue,
                                     cumulativeContErr, sources)

        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
예제 #13
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    pThermo, p, e, psi, rho, U, phi, turbulence = createFields( runTime, mesh )

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

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

        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls( mesh )
        
        CoNum, meanCoNum = ref.compressibleCourantNo( mesh, phi, rho, runTime )
        
        ref.rhoEqn( rho, phi );
        
        UEqn = fun_Ueqn( rho, U, phi, turbulence, p )

        fun_eEqn( rho, e, phi, turbulence, p, pThermo )

        for corr in range( nCorr ) :
            cumulativeContErr = fun_pEqn( mesh, runTime, pThermo, rho, p, psi, U, phi, turbulence, UEqn, cumulativeContErr, nNonOrthCorr )
            pass

        turbulence.correct()

        rho << pThermo.rho()

        runTime.write()

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

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

    import os
    return os.EX_OK
예제 #14
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    simple = man.simpleControl( mesh )

    thermo, rho, p, h, psi, U, phi, pRefCell, pRefValue, turbulence, initialMass, rhoMax, rhoMin = _createFields( runTime, mesh, simple )
    
    mrfZones, pZones, pressureImplicitPorosity, nUCorr = createZones( mesh, U, simple )
    
    cumulativeContErr = ref.initContinuityErrs()

    ref.ext_Info() << "\nStarting time loop\n" << ref.nl
    
    while simple.loop() :
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
                
        # Pressure-velocity SIMPLE corrector
        UEqn, trAU, trTU = _UEqn( phi, U, p, rho, turbulence, mrfZones, pZones, pressureImplicitPorosity, nUCorr )
            
        _hEqn( U, phi, h, turbulence, rho, p, thermo, pZones )
        
        cumulativeContErr = _pEqn( runTime,mesh, UEqn, rho, thermo, psi, U, p, phi, trTU, trAU, mrfZones, \
                                                             pRefCell, pRefValue, pressureImplicitPorosity, cumulativeContErr, simple, rhoMin, rhoMax  )
        
        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"

    import os
    return os.EX_OK
예제 #15
0
def main_standalone( argc, argv ):
    
    args = ref.setRootCase( argc, argv )
    
    runTime = man.createTime( args )
    
    mesh = man.createMesh( runTime )
        
    p, U, phi, pRefCell, pRefValue, laminarTransport, turbulence,sources = createFields( runTime, mesh )

    cumulativeContErr = ref.initContinuityErrs()
    
    simple = man.simpleControl (mesh)
    
    mrfZones =    man.MRFZones( mesh )
    mrfZones.correctBoundaryVelocity( U)

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

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

        # --- Pressure-velocity SIMPLE corrector
        UEqn = fun_UEqn( U, phi, turbulence, p, sources, mrfZones )
        
        cumulativeContErr = fun_pEqn( mesh, runTime, simple, U, phi, turbulence, p, UEqn, mrfZones, pRefCell, pRefValue, cumulativeContErr, sources )

        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
예제 #16
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    simple = man.simpleControl( mesh )

    p, U, phi, pRefCell, pRefValue, laminarTransport, turbulence = create_fields( runTime, mesh )
    
    pZones, pressureImplicitPorosity, nUCorr = createPorousZones( mesh, simple )
    
    cumulativeContErr = ref.initContinuityErrs()
    
    ref.ext_Info()<< "\nStarting time loop\n" << ref.nl
    
    while simple.loop() :
        
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
        
        p.storePrevIter()

        UEqn, trTU, trAU = fun_UEqn( mesh, phi, U, p, turbulence, pZones, nUCorr, pressureImplicitPorosity )

        cumulativeContErr = fun_pEqn( mesh, simple, p, U, trTU, trAU, UEqn, phi, runTime, pressureImplicitPorosity, \
                                             cumulativeContErr, pRefCell, pRefValue, )

        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"

    import os
    return os.EX_OK
예제 #17
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    simple = man.simpleControl( mesh )

    thermo, rho, p, h, psi, U, phi, pRefCell, pRefValue, turbulence, initialMass, rhoMax, rhoMin = _createFields( runTime, mesh, simple )
    
    cumulativeContErr = ref.initContinuityErrs()

    ref.ext_Info() << "\nStarting time loop\n" << ref.nl
    
    while simple.loop() :
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
                
        # Pressure-velocity SIMPLE corrector
        UEqn = _UEqn( phi, U, p, rho, turbulence )
            
        cumulativeContErr = _pEqn( runTime,mesh, UEqn, rho, thermo, psi, U, p, phi, \
                                                             pRefCell, pRefValue, cumulativeContErr, simple, rhoMin, rhoMax  )

        _hEqn( U, phi, h, turbulence, rho, p, thermo )
        
        
        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"

    import os
    return os.EX_OK
예제 #18
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    g = man.readGravitationalAcceleration(runTime, mesh)

    pimple = ref.pimpleControl(mesh)

    adjustTimeStep, maxCo, maxDeltaT, nAlphaCorr, nAlphaSubCycles = read_controls(
        args, runTime, pimple)

    cumulativeContErr = ref.initContinuityErrs()

    p_rgh, alpha1, alpha2, U, phi, twoPhaseProperties, rho10, rho20, psi1, psi2, pMin, \
                      gh, ghf, p, rho1, rho2, rho, rhoPhi, dgdt, interface, turbulence = _createFields( runTime, mesh, g )

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

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

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

    while runTime.run():
        adjustTimeStep, maxCo, maxDeltaT, nAlphaCorr, nAlphaSubCycles = read_controls(
            args, runTime, pimple)

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

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

        runTime.increment()

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

        # --- Outer-corrector loop
        pimple.start()
        while pimple.loop():
            alphaEqnsSubCycle(runTime, pimple, mesh, phi, alpha1, alpha2, rho,
                              rho1, rho2, rhoPhi, dgdt, interface)

            ref.solve(ref.fvm.ddt(rho) + ref.fvc.div(rhoPhi))

            UEqn = fun_UEqn(mesh, alpha1, U, p, p_rgh, ghf, rho, rhoPhi,
                            turbulence, g, twoPhaseProperties, interface,
                            pimple)

            # --- PISO loop
            for corr in range(pimple.nCorr()):
                fun_pEqn( runTime, mesh, pimple, UEqn, p, p_rgh, phi, U, rho, rho1, rho2, rho10, rho20, gh, ghf, dgdt, pMin, \
                          psi1, psi2, alpha1, alpha2, interface, corr )
                pass
            if pimple.turbCorr():
                turbulence.correct()
                pass

            pimple.increment()
            pass
        rho << alpha1 * rho1 + alpha2 * rho2

        runTime.write()

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

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

    import os
    return os.EX_OK
예제 #19
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    thermodynamicProperties, rho0, p0, psi, rhoO = readThermodynamicProperties(
        runTime, mesh)

    transportProperties, mu = readTransportProperties(runTime, mesh)

    p, U, rho, phi = createFields(runTime, mesh, rhoO, psi)

    cumulativeContErr = ref.initContinuityErrs()

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

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

    while runTime.loop():

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

        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls(
            mesh)

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

        ref.rhoEqn(rho, phi)

        UEqn = man.fvm.ddt(rho, U) + man.fvm.div(phi, U) - man.fvm.laplacian(
            mu, U)

        ref.solve(UEqn == -man.fvc.grad(p))

        # --- PISO loop
        for corr in range(nCorr):

            rAU = 1.0 / UEqn.A()
            U << rAU * UEqn.H()

            phid = ref.surfaceScalarField(
                ref.word("phid"),
                psi * ((ref.fvc.interpolate(U) & mesh.Sf()) +
                       ref.fvc.ddtPhiCorr(rAU, rho(), U(), phi())))

            phi << (rhoO / psi) * phid
            pEqn = ref.fvm.ddt(psi, p()) + ref.fvc.div(phi()) + ref.fvm.div(
                phid, p()) - ref.fvm.laplacian(rho() * rAU, p())

            pEqn.solve()

            phi += pEqn.flux()

            cumulativeContErr = compressibleContinuityErrs(
                rho, phi, p, rho0, p0, psi, cumulativeContErr)

            U -= rAU * ref.fvc.grad(p)
            U.correctBoundaryConditions()
            pass
        rho << rhoO + psi * p

        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
예제 #20
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    pimple = man.pimpleControl(mesh)

    maxDeltaT, rDeltaT = setInitialrDeltaT(runTime, mesh, pimple)

    pThermo, p, h, psi, rho, U, phi, rhoMax, rhoMin, turbulence, dpdt, K = createFields(
        runTime, mesh, pimple)

    mrfZones, pZones, pressureImplicitPorosity = createZones(mesh, U)

    cumulativeContErr = ref.initContinuityErrs()

    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

        setrDeltaT(runTime, mesh, pimple, phi, psi, U, rho, rDeltaT, maxDeltaT)

        ref.rhoEqn(rho, phi)

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

            turbulence.correct()

            UEqn = fun_Ueqn(pimple, rho, p, U, phi, turbulence, mrfZones,
                            pZones)

            fun_hEqn(pThermo, rho, p, h, phi, turbulence, dpdt, K)

            # --- PISO loop
            while (pimple.correct()):
                cumulativeContErr = fun_pEqn(mesh, runTime, pimple, pThermo,
                                             rho, p, h, psi, U, phi, mrfZones,
                                             turbulence, UEqn, dpdt, K,
                                             cumulativeContErr, rhoMax, rhoMin)
                pass

            pass

        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
예제 #21
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    transportProperties, nu, Ubar, magUbar, flowDirection = readTransportProperties( runTime, mesh)
    
    p, U, phi, laminarTransport, sgsModel, pRefCell, pRefValue = _createFields( runTime, mesh )
    
    cumulativeContErr = ref.initContinuityErrs()
    
    gradP, gradPFile = createGradP( runTime)
    
    ref.ext_Info() << "\nStarting time loop\n" << ref.nl 

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

        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls( mesh ) 

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

        sgsModel.correct()

        UEqn = ref.fvm.ddt( U ) + ref.fvm.div( phi, U ) + sgsModel.divDevBeff( U ) == flowDirection * gradP

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

        rAU = 1.0 / UEqn.A()

        for corr in range( nCorr ):
            U << rAU * UEqn.H()

            phi << ( ref.fvc.interpolate( U ) & mesh.Sf() ) + ref.fvc.ddtPhiCorr( rAU, U, phi )

            ref.adjustPhi(phi, U, p)

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

                if corr == nCorr-1 and nonOrth == nNonOrthCorr:
                   pEqn.solve( mesh.solver( ref.word( str( p.name() ) + "Final" ) ) )
                   pass
                else:
                   pEqn.solve( mesh.solver( p.name() ) )
                   pass

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

            cumulativeContErr = ref.ContinuityErrs( phi, runTime, mesh, cumulativeContErr )

            U -= rAU * ref.fvc.grad( p )
            U.correctBoundaryConditions()
            pass

        # Correct driving force for a constant mass flow rate

        # Extract the velocity in the flow direction
        magUbarStar = ( flowDirection & U ).weightedAverage( mesh.V() )

        # Calculate the pressure gradient increment needed to
        # adjust the average flow-rate to the correct value
        gragPplus = ( magUbar - magUbarStar ) / rAU.weightedAverage( mesh.V() )

        U << U() + flowDirection * rAU * gragPplus # mixed caculations

        gradP +=gragPplus
        ref.ext_Info() << "Uncorrected Ubar = " << magUbarStar.value() << " " << "pressure gradient = " << gradP.value() << ref.nl

        runTime.write()

        writeGradP( runTime, gradP )

        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
예제 #22
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )
   
    runTime = man.createTime( args )
    
    mesh = man.createMesh( runTime )
  
    thermodynamicProperties, rho0, p0, psi, rhoO =  readThermodynamicProperties( runTime, mesh )
    
    transportProperties, mu = readTransportProperties( runTime, mesh )
    
    p, U, rho, phi = createFields( runTime, mesh, rhoO, psi )
  
    cumulativeContErr = ref.initContinuityErrs()
  
    #// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

    while runTime.loop():
 
        ref.ext_Info()<< "Time = " << runTime.timeName() << ref.nl << ref.nl
       
        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls( mesh )

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

        ref.rhoEqn( rho, phi )

        UEqn = man.fvm.ddt( rho, U ) + man.fvm.div( phi, U ) - man.fvm.laplacian( mu, U )
        
        ref.solve( UEqn == -man.fvc.grad( p ) )

        # --- PISO loop
        for corr in range( nCorr ):
               
            rAU = 1.0 / UEqn.A()
            U << rAU * UEqn.H()

            phid = ref.surfaceScalarField( ref.word( "phid" ), 
                                           psi * ( ( ref.fvc.interpolate( U ) & mesh.Sf() ) + ref.fvc.ddtPhiCorr( rAU, rho(), U(), phi() ) ) )

            phi << ( rhoO / psi ) * phid
            pEqn = ref.fvm.ddt( psi, p() ) + ref.fvc.div( phi() ) + ref.fvm.div( phid, p() ) - ref.fvm.laplacian( rho() * rAU, p() )
 
            pEqn.solve()

            phi += pEqn.flux()
        
            cumulativeContErr = compressibleContinuityErrs( rho, phi,p, rho0, p0, psi, cumulativeContErr )
        
            U -= rAU * ref.fvc.grad( p )
            U.correctBoundaryConditions()
            pass
        rho << rhoO + psi * p

        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
def main_standalone( argc, argv ):
  
    args = ref.setRootCase( argc, argv )
  
    runTime=man.createTime( args )
    
    mesh = man.createMesh( runTime )
    
    g = readGravitationalAcceleration( runTime, mesh );

    T, p_rgh, U, phi, laminarTransport, turbulence, rhok, \
       kappat, gh, ghf, p, pRefCell, pRefValue, beta, TRef, Pr, Prt  = createFields( runTime, mesh, g )
                                                        
    cumulativeContErr = ref.initContinuityErrs()
    
    adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls( runTime )
  
    CoNum, meanCoNum = ref.CourantNo( mesh, phi, runTime )
    
    runTime = ref.setInitialDeltaT( runTime, adjustTimeStep, maxCo, CoNum )

    pimple = man.pimpleControl( mesh )
  
    # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #

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

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

        adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls( runTime )
        CoNum, meanCoNum = ref.CourantNo( mesh, phi, runTime )
        runTime = ref.setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )

        # Pressure-velocity PIMPLE corrector loop
        
        while pimple.loop():
            
            UEqn = fun_UEqn( mesh, pimple, U, phi, turbulence, p, rhok, p_rgh, ghf )
            fun_TEqn( phi, turbulence, kappat, T, rhok, beta, TRef, Prt, Pr )
            
            # --- Pressure corrector loop
            while pimple.correct():
                cumulativeContErr = fun_pEqn( mesh, runTime, pimple, p, rhok, U, phi, turbulence, gh, ghf, p_rgh, UEqn, pRefCell, pRefValue, cumulativeContErr )
                pass
            if pimple.turbCorr():
               turbulence.correct()
               pass
            pass

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

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

    import os
    return os.EX_OK
예제 #24
0
def main_standalone( argc, argv ):
 
    args = ref.setRootCase( argc, argv )
    
    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    pThermo, p, h, psi, rho, U, phi, rhoMax, rhoMin, turbulence, DpDt = createFields( runTime, mesh )
  
    cumulativeContErr = ref.initContinuityErrs()
  
    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.storePrevIter()
                rho.storePrevIter()
                pass
            
            UEqn, rAU = fun_Ueqn( pimple, rho, p, U, phi, turbulence )
      
            fun_hEqn( pThermo, rho, p, h, phi, turbulence, DpDt )

            # --- PISO loop
            for corr in range( pimple.nCorr() ):
                cumulativeContErr = fun_pEqn( mesh, runTime, pimple, pThermo, rho, p, h, psi, U, phi, 
                                              turbulence, UEqn, rAU, DpDt, cumulativeContErr, corr, rhoMax, rhoMin )
                pass
            
            if pimple.turbCorr():
                turbulence.correct()
                pass
            
            pimple.increment()
            pass
        
        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
예제 #25
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    pimple = man.pimpleControl( mesh )
        
    cumulativeContErr = ref.initContinuityErrs()
    
    p_rgh, p, alpha1, U, phi, rho1, rho2, rho, rhoPhi, twoPhaseProperties, pRefCell, \
                                    pRefValue, interface, turbulence, g, gh, ghf = _createFields( runTime, mesh )

    adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls( runTime )
    
    cumulativeContErr = correctPhi( runTime, mesh, phi, p, p_rgh, rho, U, cumulativeContErr, pimple, pRefCell, pRefValue)
    
    CoNum, meanCoNum = ref.CourantNo( mesh, phi, runTime )
    
    runTime = ref.setInitialDeltaT( runTime, adjustTimeStep, maxCo, CoNum )
    
    ref.ext_Info() << "\nStarting time loop\n" << ref.nl
    
    while runTime.run() :
                
        adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls( runTime )
        CoNum, meanCoNum = ref.CourantNo( mesh, phi, runTime )        
        maxAlphaCo, alphaCoNum, meanAlphaCoNum = alphaCourantNo( runTime, mesh, alpha1, phi )
        runTime = setDeltaT(  runTime, adjustTimeStep, maxCo, CoNum, maxAlphaCo, alphaCoNum, maxDeltaT )
        
        runTime.increment()
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
        
        twoPhaseProperties.correct()
     
        alphaEqnSubCycle( runTime, pimple, mesh, phi, alpha1, rho, rhoPhi, rho1, rho2, interface )
        
        while pimple.loop():
            UEqn = _UEqn( mesh, alpha1, U, p, p_rgh, ghf, rho, rhoPhi, turbulence, g, twoPhaseProperties, interface, pimple )

            # --- PISO loop
            while pimple.correct():
                cumulativeContErr = _pEqn( runTime, mesh, UEqn, U, p, p_rgh, gh, ghf, phi, alpha1, rho, g, 
                                           interface, pimple, pRefCell, pRefValue, cumulativeContErr )
                pass
            
            if pimple.turbCorr():
                turbulence.correct()
                pass
            
            pass
            
        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
예제 #26
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )

    p, U, phi, turbulence, pRefCell, pRefValue, laminarTransport = _createFields( runTime, mesh )
    
    cumulativeContErr = ref.initContinuityErrs()

    ref.ext_Info() << "\nStarting time loop\n" <<ref.nl
    
    while runTime.loop() :
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl

        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls( mesh )

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

        # Pressure-velocity PISO corrector

        # 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++
        # UEqn = fvm.ddt( U ) + fvm.div( phi, U ) + turbulence.divDevReff( U )

        UEqn = turbulence.divDevReff( U ) + ( ref.fvm.ddt( U ) + ref.fvm.div( phi, U ) )        

        UEqn.relax()

        if momentumPredictor :
            ref.solve( UEqn == -ref.fvc.grad( p ) )
            pass
           
        # --- PISO loop

        for corr in range( nCorr ) :
            rUA = 1.0 / UEqn.A()
            U << rUA * UEqn.H()

            phi << ( ref.fvc.interpolate(U) & mesh.Sf() ) + ref.fvc.ddtPhiCorr( rUA, U, phi )
         
            ref.adjustPhi( phi, U, p )
            
            # Non-orthogonal pressure corrector loop
            for nonOrth in range( nNonOrthCorr + 1 ):
                # Pressure corrector
                pEqn = ref.fvm.laplacian( rUA, p ) == ref.fvc.div( phi )

                pEqn.setReference( pRefCell, pRefValue )

                if corr == ( nCorr-1 ) and nonOrth == nNonOrthCorr :
                    pEqn.solve( mesh.solver( ref.word( "pFinal" ) ) ) 
                    pass
                else:
                    pEqn.solve()   
                    pass
                   
                if nonOrth == nNonOrthCorr:
                    phi -= pEqn.flux()
                    pass
                
                pass
            cumulativeContErr = ref.ContinuityErrs( phi, runTime, mesh, cumulativeContErr )       

            U -= rUA * ref.fvc.grad( p ) 
            U.correctBoundaryConditions()
            pass

        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
예제 #27
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
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    p, U, phi, pa, Ua, phia, alpha, laminarTransport, turbulence, zeroSensitivity, zeroAlpha, lambda_, alphaMax, inletCells, pRefCell, pRefValue, paRefCell, paRefValue = createFields(
        runTime, mesh
    )

    cumulativeContErr = ref.initContinuityErrs()

    cumulativeAdjointContErr = initAdjointContinuityErrs()

    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

        laminarTransport.lookup(ref.word("lambda")) >> lambda_

        alpha += mesh.fieldRelaxationFactor(ref.word("alpha")) * (
            ((alpha + lambda_ * (Ua & U)).ext_max(zeroAlpha)).ext_min(alphaMax) - alpha
        )

        zeroCells(alpha, inletCells)

        UEqn = ref.fvm.div(phi, U) + turbulence.divDevReff(U) + ref.fvm.Sp(alpha, U)

        UEqn.relax()
        ref.solve(UEqn == -ref.fvc.grad(p))

        p.ext_boundaryField().updateCoeffs()

        rAU = 1.0 / UEqn.A()
        U << rAU * UEqn.H()

        phi << (ref.fvc.interpolate(U) & mesh.Sf())
        ref.adjustPhi(phi, U, p)

        while simple.correctNonOrthogonal():
            pEqn = ref.fvm.laplacian(rAU, p) == ref.fvc.div(phi)

            pEqn.setReference(pRefCell, pRefValue)
            pEqn.solve()

            if simple.finalNonOrthogonalIter():
                phi -= pEqn.flux()
                pass
            pass

        cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh, cumulativeContErr)

        # Explicitly relax pressure for momentum corrector
        p.relax()
        # Momentum corrector
        U -= rAU * ref.fvc.grad(p)
        U.correctBoundaryConditions()

        # Adjoint Pressure-velocity SIMPLE corrector
        # Adjoint Momentum predictor

        adjointTransposeConvection = ref.fvc.grad(Ua) & U
        # adjointTransposeConvection = ref.fvc.reconstruct( mesh.magSf() * ( ref.fvc.snGrad( Ua ) & ref.fvc.interpolate( U ) ) )
        zeroCells(adjointTransposeConvection, inletCells)

        UaEqn = ref.fvm.div(-phi, Ua) - adjointTransposeConvection + turbulence.divDevReff(Ua) + ref.fvm.Sp(alpha, Ua)

        UaEqn.relax()
        ref.solve(UaEqn == -ref.fvc.grad(pa))
        pa.ext_boundaryField().updateCoeffs()

        rAUa = 1.0 / UaEqn.A()
        Ua << rAUa * UaEqn.H()

        UaEqn.clear()
        phia << (ref.fvc.interpolate(Ua) & mesh.Sf())

        ref.adjustPhi(phia, Ua, pa)

        # Non-orthogonal pressure corrector loop
        while simple.correctNonOrthogonal():
            paEqn = ref.fvm.laplacian(rAUa, pa) == ref.fvc.div(phia)
            paEqn.setReference(paRefCell, paRefValue)
            paEqn.solve()

            if simple.finalNonOrthogonalIter():
                phia -= paEqn.flux()
                pass
            pass

        cumulativeAdjointContErr = adjointContinuityErrs(runTime, mesh, phia, cumulativeAdjointContErr)

        # Explicitly relax pressure for adjoint momentum corrector
        pa.relax()

        # Adjoint momentum corrector
        Ua -= rAUa * ref.fvc.grad(pa)
        Ua.correctBoundaryConditions()

        turbulence.correct()

        runTime.write()

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

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

    import os

    return os.EX_OK
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    p, U, phi, pa, Ua, phia, alpha, laminarTransport, turbulence, zeroSensitivity, zeroAlpha, \
           lambda_, alphaMax, inletCells, pRefCell, pRefValue, paRefCell, paRefValue = createFields( runTime, mesh )

    cumulativeContErr = ref.initContinuityErrs()

    cumulativeAdjointContErr = initAdjointContinuityErrs()

    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

        laminarTransport.lookup(ref.word("lambda")) >> lambda_

        alpha += mesh.fieldRelaxationFactor(ref.word("alpha")) * ((
            (alpha + lambda_ *
             (Ua & U)).ext_max(zeroAlpha)).ext_min(alphaMax) - alpha)

        zeroCells(alpha, inletCells)

        UEqn = ref.fvm.div(phi, U) + turbulence.divDevReff(U) + ref.fvm.Sp(
            alpha, U)

        UEqn.relax()
        ref.solve(UEqn == -ref.fvc.grad(p))

        p.ext_boundaryField().updateCoeffs()

        rAU = 1.0 / UEqn.A()
        U << rAU * UEqn.H()

        phi << (ref.fvc.interpolate(U) & mesh.Sf())
        ref.adjustPhi(phi, U, p)

        while simple.correctNonOrthogonal():
            pEqn = ref.fvm.laplacian(rAU, p) == ref.fvc.div(phi)

            pEqn.setReference(pRefCell, pRefValue)
            pEqn.solve()

            if simple.finalNonOrthogonalIter():
                phi -= pEqn.flux()
                pass
            pass

        cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh,
                                               cumulativeContErr)

        # Explicitly relax pressure for momentum corrector
        p.relax()
        # Momentum corrector
        U -= rAU * ref.fvc.grad(p)
        U.correctBoundaryConditions()

        # Adjoint Pressure-velocity SIMPLE corrector
        # Adjoint Momentum predictor

        adjointTransposeConvection = (ref.fvc.grad(Ua) & U)
        # adjointTransposeConvection = ref.fvc.reconstruct( mesh.magSf() * ( ref.fvc.snGrad( Ua ) & ref.fvc.interpolate( U ) ) )
        zeroCells(adjointTransposeConvection, inletCells)

        UaEqn = ref.fvm.div(
            -phi, Ua) - adjointTransposeConvection + turbulence.divDevReff(
                Ua) + ref.fvm.Sp(alpha, Ua)

        UaEqn.relax()
        ref.solve(UaEqn == -ref.fvc.grad(pa))
        pa.ext_boundaryField().updateCoeffs()

        rAUa = 1.0 / UaEqn.A()
        Ua << rAUa * UaEqn.H()

        UaEqn.clear()
        phia << (ref.fvc.interpolate(Ua) & mesh.Sf())

        ref.adjustPhi(phia, Ua, pa)

        # Non-orthogonal pressure corrector loop
        while simple.correctNonOrthogonal():
            paEqn = ref.fvm.laplacian(rAUa, pa) == ref.fvc.div(phia)
            paEqn.setReference(paRefCell, paRefValue)
            paEqn.solve()

            if simple.finalNonOrthogonalIter():
                phia -= paEqn.flux()
                pass
            pass

        cumulativeAdjointContErr = adjointContinuityErrs(
            runTime, mesh, phia, cumulativeAdjointContErr)

        # Explicitly relax pressure for adjoint momentum corrector
        pa.relax()

        # Adjoint momentum corrector
        Ua -= rAUa * ref.fvc.grad(pa)
        Ua.correctBoundaryConditions()

        turbulence.correct()

        runTime.write()

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

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

    import os
    return os.EX_OK
예제 #30
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createDynamicFvMesh(runTime)

    cumulativeContErr = ref.initContinuityErrs()

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

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

    pimple = man.pimpleControl(mesh)

    phiAbs = ref.surfaceScalarField(ref.word("phiAbs"), phi)
    ref.fvc.makeAbsolute(phiAbs, U)

    cumulativeContErr = fun_correctPhi(
        runTime, mesh, phi, phiAbs, p, p_rgh, rho, U, cumulativeContErr, pimple, pRefCell, pRefValue
    )

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

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

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

    while runTime.run():

        adjustTimeStep, maxCo, maxDeltaT, correctPhi, checkMeshCourantNo = readControls(runTime, mesh, pimple)

        maxAlphaCo, alphaCoNum, meanAlphaCoNum = alphaCourantNo(runTime, mesh, alpha1, phi)

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

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

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

        timeBeforeMeshUpdate = runTime.elapsedCpuTime()

        fun_Urel(mesh, U)

        if mesh.changing():
            ref.ext_Info() << "Execution time for mesh.update() = " << runTime.elapsedCpuTime() - timeBeforeMeshUpdate << " s" << ref.nl
            gh << (g & mesh.C())
            ghf << (g & mesh.Cf())
            pass

        if mesh.changing() and correctPhi:
            cumulativeContErr = fun_correctPhi(
                runTime, mesh(), phi, phiAbs, p, p_rgh, rho, U, cumulativeContErr, pimple, pRefCell, pRefValue
            )
            pass

        if mesh.changing() and checkMeshCourantNo:
            meshCoNum, meanMeshCoNum = ref.meshCourantNo(runTime, mesh(), phi)
            pass

        twoPhaseProperties.correct()

        alphaEqnSubCycle(runTime, pimple, mesh, phi, alpha1, rho, rhoPhi, rho1, rho2, interface)

        # --- Pressure-velocity PIMPLE corrector loop
        while pimple.loop():
            UEqn = _UEqn(
                mesh(), alpha1, U, p, p_rgh, ghf, rho, rhoPhi, turbulence, g, twoPhaseProperties, interface, pimple
            )

            # --- PISO loop
            while pimple.correct():
                cumulativeContErr = _pEqn(
                    runTime,
                    mesh,
                    UEqn,
                    U,
                    p,
                    p_rgh,
                    gh,
                    ghf,
                    phi,
                    phiAbs,
                    alpha1,
                    rho,
                    g,
                    interface,
                    pimple,
                    pRefCell,
                    pRefValue,
                    cumulativeContErr,
                )
                pass
            if pimple.turbCorr():
                turbulence.correct()
                pass
            pass

        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
예제 #31
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMeshNoClear( runTime )
    
    transportProperties, nu = readTransportProperties( runTime, mesh )
    
    p, U, phi = _createFields( runTime, mesh )
    
    turbulenceProperties, force, K, forceGen = readTurbulenceProperties( runTime, mesh, U )
    
    cumulativeContErr = ref.initContinuityErrs()

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

    while runTime.loop():
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
       
        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls( mesh )
       
        force.internalField() << ( ref.ReImSum( ref.fft.reverseTransform( K / ( K.mag() + 1.0e-6 ) ^ forceGen.newField(), K.nn() ) ) )
        
        globalProperties( runTime, U, nu, force )
        
        UEqn = ref.fvm.ddt( U ) + ref.fvm.div( phi, U ) - ref.fvm.laplacian( nu, U ) == force 

        ref.solve( UEqn == - man.fvc.grad( p ) )
        
        # --- PISO loop

        for corr  in range( 1 ):
            rUA = 1.0 / UEqn.A()

            U << rUA * UEqn.H()
            phi << ( ref.fvc.interpolate( U ) & mesh.Sf() ) + ref.fvc.ddtPhiCorr( rUA, U, phi )

            pEqn = ref.fvm.laplacian( rUA, p ) == ref.fvc.div( phi )

            pEqn.solve()

            phi -= pEqn.flux()

            cumulativeContErr = ref.ContinuityErrs( phi, runTime, mesh, cumulativeContErr )  

            U -= rUA * ref.fvc.grad( p )
            U.correctBoundaryConditions()
            pass

        runTime.write()
        
        if runTime.outputTime():
            ref.calcEk( U, K ).ext_write( ref.fileName( runTime.path() )/ref.fileName("graphs")/ref.fileName( runTime.timeName() ), 
                                          ref.word( "Ek" ), 
                                          runTime.graphFormat() )
            pass

        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
예제 #32
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )

    transportProperties, nu, p, U, phi, pRefCell, pRefValue = createFields( runTime, mesh )

    cumulativeContErr = ref.initContinuityErrs()
    
    ref.ext_Info() << "\nStarting time loop\n"

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

        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls( mesh )

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

        UEqn = man.fvm.ddt( U ) + man.fvm.div( phi, U ) - man.fvm.laplacian( nu, U )

        ref.solve( UEqn == -man.fvc.grad( p ) )

        # --- PISO loop

        for corr in range( nCorr ) :
            rUA = 1.0 / UEqn.A()
            
            U << rUA * UEqn.H()
            phi << ( ref.fvc.interpolate( U ) & mesh.Sf() ) + ref.fvc.ddtPhiCorr( rUA, U, phi )

            ref.adjustPhi( phi, U, p )

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

                pEqn.setReference( pRefCell, pRefValue ) 
                pEqn.solve()                             

                if nonOrth == nNonOrthCorr:
                    phi -= pEqn.flux()
                    pass
                
                pass
            
            cumulativeContErr = ref.ContinuityErrs( phi, runTime, mesh, cumulativeContErr )

            U -= rUA * ref.fvc.grad( p )
            U.correctBoundaryConditions()    

            pass

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

        pass

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

    import os
    return os.EX_OK
예제 #33
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

    pimple = man.pimpleControl(mesh)

    cumulativeContErr = ref.initContinuityErrs()

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

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

    cumulativeContErr = correctPhi(runTime, mesh, phi, p, p_rgh, rho, U,
                                   cumulativeContErr, pimple, pRefCell,
                                   pRefValue)

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

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

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

    while runTime.run():

        adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls(runTime)
        CoNum, meanCoNum = ref.CourantNo(mesh, phi, runTime)
        maxAlphaCo, alphaCoNum, meanAlphaCoNum = alphaCourantNo(
            runTime, mesh, alpha1, phi)
        runTime = setDeltaT(runTime, adjustTimeStep, maxCo, CoNum, maxAlphaCo,
                            alphaCoNum, maxDeltaT)

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

        twoPhaseProperties.correct()

        alphaEqnSubCycle(runTime, pimple, mesh, phi, alpha1, rho, rhoPhi, rho1,
                         rho2, interface)

        while pimple.loop():
            UEqn = _UEqn(mesh, alpha1, U, p, p_rgh, ghf, rho, rhoPhi,
                         turbulence, g, twoPhaseProperties, interface, pimple)

            # --- PISO loop
            while pimple.correct():
                cumulativeContErr = _pEqn(runTime, mesh, UEqn, U, p, p_rgh, gh,
                                          ghf, phi, alpha1, rho, g, interface,
                                          pimple, pRefCell, pRefValue,
                                          cumulativeContErr)
                pass

            if pimple.turbCorr():
                turbulence.correct()
                pass

            pass

        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
예제 #34
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMeshNoClear(runTime)

    transportProperties, nu = readTransportProperties(runTime, mesh)

    p, U, phi = _createFields(runTime, mesh)

    turbulenceProperties, force, K, forceGen = readTurbulenceProperties(
        runTime, mesh, U)

    cumulativeContErr = ref.initContinuityErrs()

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

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

        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls(
            mesh)

        force.internalField() << (ref.ReImSum(
            ref.fft.reverseTransform(
                K / (K.mag() + 1.0e-6) ^ forceGen.newField(), K.nn())))

        globalProperties(runTime, U, nu, force)

        UEqn = ref.fvm.ddt(U) + ref.fvm.div(phi, U) - ref.fvm.laplacian(
            nu, U) == force

        ref.solve(UEqn == -man.fvc.grad(p))

        # --- PISO loop

        for corr in range(1):
            rUA = 1.0 / UEqn.A()

            U << rUA * UEqn.H()
            phi << (ref.fvc.interpolate(U) & mesh.Sf()) + ref.fvc.ddtPhiCorr(
                rUA, U, phi)

            pEqn = ref.fvm.laplacian(rUA, p) == ref.fvc.div(phi)

            pEqn.solve()

            phi -= pEqn.flux()

            cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh,
                                                   cumulativeContErr)

            U -= rUA * ref.fvc.grad(p)
            U.correctBoundaryConditions()
            pass

        runTime.write()

        if runTime.outputTime():
            ref.calcEk(U, K).ext_write(
                ref.fileName(runTime.path()) / ref.fileName("graphs") /
                ref.fileName(runTime.timeName()), ref.word("Ek"),
                runTime.graphFormat())
            pass

        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
예제 #35
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMesh( runTime )
    
    g = man.readGravitationalAcceleration( runTime, mesh)
    
    pimple = ref.pimpleControl( mesh )
    
    adjustTimeStep, maxCo, maxDeltaT, nAlphaCorr, nAlphaSubCycles = read_controls( args, runTime, pimple )

    cumulativeContErr = ref.initContinuityErrs()

    p_rgh, alpha1, alpha2, U, phi, twoPhaseProperties, rho10, rho20, psi1, psi2, pMin, \
                      gh, ghf, p, rho1, rho2, rho, rhoPhi, dgdt, interface, turbulence = _createFields( runTime, mesh, g )
    
    CoNum, meanCoNum = ref.CourantNo( mesh, phi, runTime )
    
    runTime = ref.setInitialDeltaT( runTime, adjustTimeStep, maxCo, CoNum )

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

    while runTime.run():
        adjustTimeStep, maxCo, maxDeltaT, nAlphaCorr, nAlphaSubCycles = read_controls( args, runTime, pimple )

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

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

        runTime.increment()

        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
        
        # --- Outer-corrector loop
        while pimple.loop():
            alphaEqnsSubCycle( runTime, pimple, mesh, phi, alpha1, alpha2, rho, rho1, rho2, rhoPhi, dgdt, interface )

            ref.solve( ref.fvm.ddt( rho ) + ref.fvc.div( rhoPhi ) )

            UEqn = fun_UEqn( mesh, alpha1, U, p, p_rgh, ghf, rho, rhoPhi, turbulence, g, twoPhaseProperties, interface, pimple )

            # --- Pressure corrector loop
            while pimple.correct(): 
                fun_pEqn( runTime, mesh, pimple, UEqn, p, p_rgh, phi, U, rho, rho1, rho2, rho10, rho20, gh, ghf, dgdt, pMin, \
                          psi1, psi2, alpha1, alpha2, interface )
                pass
            if pimple.turbCorr():
                turbulence.correct()
                pass
            pass
        rho <<  alpha1 * rho1 + alpha2 * rho2

        runTime.write()

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

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

    import os
    return os.EX_OK
예제 #36
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

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

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

    adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls( runTime )
    
    CoNum, meanCoNum = ref.CourantNo( mesh, phi, 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.CourantNo( mesh, phi, runTime )
        
        runTime = ref.setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )

        runTime.increment()
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
        
        # --- Pressure-velocity PIMPLE corrector loop
        pimple.start()
        while pimple.loop():

            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, pimple )
            
            # --- PISO loop
            for corr in range( pimple.nCorr() ):
                cumulativeContErr = fun_pEqn( runTime, mesh, UEqn, U, p, p_rgh, gh, ghf, phi, rho, pimple, \
                                              corr, pRefCell, pRefValue, cumulativeContErr )
                pass

            if pimple.turbCorr():
                turbulence.correct()
                pass
            
            pimple.increment()    
            pass

        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
예제 #37
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createMeshNoClear( runTime )
    
    p, U, phi, fluid, pRefCell, pRefValue = _createFields( runTime, mesh )
    
    cumulativeContErr = ref.initContinuityErrs()
    
    ref.ext_Info() << "\nStarting time loop\n" << ref.nl 
    
    while runTime.loop() :
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
        
        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls( mesh ) 
        
        CoNum, meanCoNum = ref.CourantNo( mesh, phi, runTime )
        
        fluid.correct()
        UEqn = ref.fvm.ddt( U ) + ref.fvm.div( phi, U ) - ref.fvm.laplacian( fluid.ext_nu(), U ) - ( ref.fvc.grad( U )  & ref.fvc.grad( fluid.ext_nu() ) )
        
        ref.solve( UEqn == -ref.fvc.grad( p ) )
        
        # --- PISO loop

        for corr in range( nCorr ):
            rAU = 1.0 / UEqn.A()
            U << rAU * UEqn.H()
            phi << ( ref.fvc.interpolate( U ) & mesh.Sf() ) + ref.fvc.ddtPhiCorr( rAU, U, phi )
            
            ref.adjustPhi(phi, U, p)
            
            for nonOrth in range( nNonOrthCorr + 1): 
                
                pEqn = ( ref.fvm.laplacian( rAU, p ) == ref.fvc.div( phi ) )
                
                pEqn.setReference( pRefCell, pRefValue )
                pEqn.solve()

                if nonOrth == nNonOrthCorr:
                   phi -=  pEqn.flux()
                   pass
                
                pass
                
            cumulativeContErr = ref.ContinuityErrs( phi, runTime, mesh, cumulativeContErr )
               
            U -= rAU * ref.fvc.grad( p )
            U.correctBoundaryConditions()
            pass
        
        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
예제 #38
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createMesh(runTime)

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

    cumulativeContErr = ref.initContinuityErrs()

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

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

        piso, nCorr, nNonOrthCorr, momentumPredictor, transonic, nOuterCorr = ref.readPISOControls(mesh)

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

        # Pressure-velocity PISO corrector

        # 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++
        # UEqn = fvm.ddt( U ) + fvm.div( phi, U ) + turbulence.divDevReff( U )

        UEqn = turbulence.divDevReff(U) + (ref.fvm.ddt(U) + ref.fvm.div(phi, U))

        UEqn.relax()

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

        # --- PISO loop

        for corr in range(nCorr):
            rUA = 1.0 / UEqn.A()
            U << rUA * UEqn.H()

            phi << (ref.fvc.interpolate(U) & mesh.Sf()) + ref.fvc.ddtPhiCorr(rUA, U, phi)

            ref.adjustPhi(phi, U, p)

            # Non-orthogonal pressure corrector loop
            for nonOrth in range(nNonOrthCorr + 1):
                # Pressure corrector
                pEqn = ref.fvm.laplacian(rUA, p) == ref.fvc.div(phi)

                pEqn.setReference(pRefCell, pRefValue)

                if corr == (nCorr - 1) and nonOrth == nNonOrthCorr:
                    pEqn.solve(mesh.solver(ref.word("pFinal")))
                    pass
                else:
                    pEqn.solve()
                    pass

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

                pass
            cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh, cumulativeContErr)

            U -= rUA * ref.fvc.grad(p)
            U.correctBoundaryConditions()
            pass

        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
예제 #39
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    mesh = man.createDynamicFvMesh(runTime)

    cumulativeContErr = ref.initContinuityErrs()

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

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

    pimple = man.pimpleControl(mesh)

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

    while runTime.run():

        adjustTimeStep, maxCo, maxDeltaT, pimpleDic, correctPhi, checkMeshCourantNo, ddtPhiCorr = readControls(
            runTime, mesh, pimple)
        CoNum, meanCoNum = ref.CourantNo(mesh, phi, runTime)

        # Make the fluxes absolute
        ref.fvc.makeAbsolute(phi, U)

        runTime = ref.setDeltaT(runTime, adjustTimeStep, maxCo, maxDeltaT,
                                CoNum)
        runTime.increment()
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl

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

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

        if mesh.changing() and checkMeshCourantNo:
            meshCoNum, meanMeshCoNum = ref.meshCourantNo(runTime, mesh, phi)
            pass

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

            UEqn = fun_UEqn(mesh, phi, U, p, rAU, turbulence, pimple)
            # --- Pressure corrector loop
            while pimple.correct():
                cumulativeContErr = fun_pEqn(mesh, runTime, pimple, U, phi,
                                             turbulence, p, rAU, UEqn,
                                             pRefCell, pRefValue,
                                             cumulativeContErr, ddtPhiCorr)
                pass

            if pimple.turbCorr():
                turbulence.correct()
                pass
            pass
        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
예제 #40
0
def main_standalone( argc, argv ):

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )

    mesh = man.createDynamicFvMesh( runTime )
    
    cumulativeContErr = ref.initContinuityErrs()

    p, U, phi, laminarTransport, turbulence, rAU, pRefCell, pRefValue, sources = _createFields( runTime, mesh )    
    
    adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls( runTime )
    
    pimple = man.pimpleControl( mesh )
    
    ref.ext_Info() << "\nStarting time loop\n" <<ref.nl
    
    while runTime.run() :
        
        adjustTimeStep, maxCo, maxDeltaT, pimpleDic, correctPhi, checkMeshCourantNo, ddtPhiCorr = readControls( runTime, mesh, pimple )
        CoNum, meanCoNum = ref.CourantNo( mesh, phi, runTime )
        
        # Make the fluxes absolute
        ref.fvc.makeAbsolute(phi, U)

        runTime = ref.setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
        runTime.increment()
        ref.ext_Info() << "Time = " << runTime.timeName() << ref.nl << ref.nl
        
        mesh.update()
        if mesh.changing() and correctPhi :
           cumulativeContErr = _correctPhi( runTime, mesh, pimple, p, U, rAU, phi, pRefCell, pRefValue, cumulativeContErr  )
           pass
        
        # Make the fluxes relative to the mesh motion
        ref.fvc.makeRelative( phi, U )
        
        if mesh.changing() and checkMeshCourantNo :
           meshCoNum, meanMeshCoNum = ref.meshCourantNo( runTime, mesh, phi )
           pass
        
        # --- Pressure-velocity PIMPLE corrector loop
        while pimple.loop():

            UEqn = fun_UEqn( mesh, phi, U, p, rAU, turbulence, pimple, sources )
            # --- Pressure corrector loop
            while pimple.correct():
                cumulativeContErr = fun_pEqn( mesh, runTime, pimple, U, phi, turbulence, p, rAU, UEqn, pRefCell, pRefValue, cumulativeContErr, ddtPhiCorr, sources )
                pass
            
            if pimple.turbCorr():
                turbulence.correct()
                pass
            pass
        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
예제 #41
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