コード例 #1
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
コード例 #2
0
ファイル: __init__.py プロジェクト: asimurzin/sonicFlux
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
コード例 #3
0
ファイル: __init__.py プロジェクト: asimurzin/pisoFlux
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
コード例 #4
0
ファイル: __init__.py プロジェクト: asimurzin/dnsFlux
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
コード例 #5
0
ファイル: __init__.py プロジェクト: asimurzin/icoFlux
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
コード例 #6
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
コード例 #7
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
コード例 #8
0
ファイル: __init__.py プロジェクト: asimurzin/pisoFlux
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
コード例 #9
0
ファイル: __init__.py プロジェクト: asimurzin/channelFlux
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
コード例 #10
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
コード例 #11
0
ファイル: __init__.py プロジェクト: asimurzin/sonicLiquidFlux
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