コード例 #1
0
def main_standalone( argc, argv ):

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

    from Foam.OpenFOAM.include import createTime
    runTime = createTime( args )
    
    from regionProperties import regionProperties
    rp = regionProperties( runTime )
    
    from fluid import createFluidMeshes
    fluidRegions = createFluidMeshes( rp, runTime )

    from solid import createSolidMeshes,createSolidField
    solidRegions=createSolidMeshes( rp,runTime )

    from fluid import createFluidFields

    thermoFluid, rhoFluid, KFluid, UFluid, phiFluid, gFluid, turbulence, DpDtFluid, initialMassFluid = createFluidFields( fluidRegions, runTime )

    from solid import createSolidField
    rhos, cps, rhosCps, Ks, Ts = createSolidField( solidRegions, runTime )
    
    from fluid import initContinuityErrs
    cumulativeContErr = initContinuityErrs( fluidRegions.size() )
    
    from Foam.finiteVolume.cfdTools.general.include import readTimeControls
    adjustTimeStep, maxCo, maxDeltaT = readTimeControls( runTime )
    
    from Foam.OpenFOAM import ext_Info, nl

    if fluidRegions.size() :
        from fluid import compressubibleMultiRegionCourantNo
        CoNum = compressubibleMultiRegionCourantNo( fluidRegions, runTime, rhoFluid, phiFluid )
                
        from Foam.finiteVolume.cfdTools.general.include import setInitialDeltaT
        runTime = setInitialDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
        pass
    
    while runTime.run() :
        adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

        nOuterCorr = readPIMPLEControls( runTime )
        
        if fluidRegions.size() :
            from fluid import compressubibleMultiRegionCourantNo
            CoNum = compressubibleMultiRegionCourantNo( fluidRegions, runTime, rhoFluid, phiFluid )

            from Foam.finiteVolume.cfdTools.general.include import setDeltaT   
            runTime = setDeltaT( runTime, adjustTimeStep, maxCo, maxDeltaT, CoNum )
            pass
        
        runTime.increment()
        ext_Info()<< "Time = " << runTime.timeName() << nl << nl      
                
        if nOuterCorr != 1 :
            for i in range( fluidRegions.size() ):
                from fluid import setRegionFluidFields
                mesh, thermo, rho, K, U, phi, g, turb, DpDt, p, psi, h, massIni = \
                      setRegionFluidFields( i, fluidRegions, thermoFluid, rhoFluid, KFluid, UFluid, \
                                            phiFluid, gFluid, turbulence, DpDtFluid, initialMassFluid )
                
                from fluid import storeOldFluidFields
                storeOldFluidFields( p, rho )
                pass
            pass
        
        # --- PIMPLE loop
        for oCorr in range( nOuterCorr ):
            for i in range( fluidRegions.size() ):
                ext_Info() << "\nSolving for fluid region " << fluidRegions[ i ].name() << nl

                from fluid import setRegionFluidFields
                mesh, thermo, rho, K, U, phi, g, turb, DpDt, p, psi, h, massIni = \
                      setRegionFluidFields( i, fluidRegions, thermoFluid, rhoFluid, KFluid, UFluid, \
                                            phiFluid, gFluid, turbulence, DpDtFluid, initialMassFluid )
                
                from fluid import readFluidMultiRegionPIMPLEControls
                pimple, nCorr, nNonOrthCorr, momentumPredictor = readFluidMultiRegionPIMPLEControls( mesh ) 
                
                from fluid import solveFluid
                cumulativeContErr = solveFluid( i, mesh, thermo, thermoFluid, rho, K, U, phi, g, h, turb, DpDt, p, psi, \
                                                massIni, oCorr, nCorr, nOuterCorr, nNonOrthCorr, momentumPredictor, cumulativeContErr )
                
                pass
                
            for i in range( solidRegions.size() ):
               ext_Info() << "\nSolving for solid region " << solidRegions[ i ].name() << nl
               
               from solid import setRegionSolidFields
               mesh, rho, cp, K, T = setRegionSolidFields( i, solidRegions, rhos, cps, Ks, Ts )
               
               from solid import readSolidMultiRegionPIMPLEControls
               pimple, nNonOrthCorr = readSolidMultiRegionPIMPLEControls( mesh )
               
               from solid import solveSolid
               solveSolid( mesh, rho, cp, K, T, nNonOrthCorr )
               pass                
            pass
        pass
        runTime.write()

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

    ext_Info() << "End\n"
    
    import os
    return os.EX_OK
コード例 #2
0
def main_standalone(argc, argv):

    args = ref.setRootCase(argc, argv)

    runTime = man.createTime(args)

    rp = ref.compressible.regionProperties(runTime)

    from fluid import createFluidMeshes
    fluidRegions = createFluidMeshes(rp, runTime)

    from solid import createSolidMeshes, createSolidField
    solidRegions = createSolidMeshes(rp, runTime)

    from fluid import createFluidFields
    thermoFluid, rhoFluid, kappaFluid, UFluid, phiFluid, gFluid, turbulence, KFluid, \
                 dpdtFluid, initialMassFluid, ghFluid, ghfFluid, p_rghFluid, radiation = createFluidFields( fluidRegions, runTime )

    from solid import createSolidField
    thermos = createSolidField(solidRegions, runTime)

    from fluid import initContinuityErrs
    cumulativeContErr = initContinuityErrs(fluidRegions)

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

    from solid import readSolidTimeControls
    maxDi = readSolidTimeControls(runTime)

    from fluid import compressubibleMultiRegionCourantNo
    CoNum = compressubibleMultiRegionCourantNo(fluidRegions, runTime, rhoFluid,
                                               phiFluid)

    from solid import solidRegionDiffusionNo
    DiNum = solidRegionDiffusionNo(solidRegions, runTime, thermos)

    runTime, CoNum, DiNum = setInitialMultiRegionDeltaT(
        adjustTimeStep, runTime, CoNum, DiNum, maxCo, maxDi, maxDeltaT)

    while runTime.run():
        adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls(runTime)

        maxDi = readSolidTimeControls(runTime)

        nOuterCorr = readPIMPLEControls(runTime)

        CoNum = compressubibleMultiRegionCourantNo(fluidRegions, runTime,
                                                   rhoFluid, phiFluid)

        DiNum = solidRegionDiffusionNo(solidRegions, runTime, thermos)

        runTime, CoNum, DiNum = setMultiRegionDeltaT(adjustTimeStep, runTime,
                                                     CoNum, DiNum, maxCo,
                                                     maxDi, maxDeltaT)

        runTime.increment()

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

        if nOuterCorr != 1:
            for i in range(fluidRegions.__len__()):
                from fluid import setRegionFluidFields
                mesh, thermo, rho, kappa, K, U, phi, turb, dpdt, p, psi, h, initialMass, p_rgh, gh, ghf, rad = \
                                     setRegionFluidFields( i, fluidRegions, thermoFluid, rhoFluid, kappaFluid, UFluid, \
                                                           phiFluid, turbulence, KFluid, dpdtFluid, initialMassFluid, ghFluid, ghfFluid, p_rghFluid, radiation )

                from fluid import storeOldFluidFields
                storeOldFluidFields(p, rho)
                pass
            pass

        # --- PIMPLE loop
        for oCorr in range(nOuterCorr):
            finalIter = (oCorr == nOuterCorr - 1)
            for i in range(fluidRegions.__len__()):
                ref.ext_Info(
                ) << "\nSolving for fluid region " << fluidRegions[i].name(
                ) << ref.nl

                from fluid import setRegionFluidFields
                mesh, thermo, rho, kappa, K, U, phi, turb, dpdt, p, psi, h, initialMass, p_rgh, gh, ghf, rad = \
                      setRegionFluidFields( i, fluidRegions, thermoFluid, rhoFluid, kappaFluid, UFluid, \
                                            phiFluid, turbulence, KFluid, dpdtFluid, initialMassFluid, ghFluid, ghfFluid, p_rghFluid, radiation )

                from fluid import readFluidMultiRegionPIMPLEControls
                pimple, nCorr, nNonOrthCorr, momentumPredictor = readFluidMultiRegionPIMPLEControls(
                    mesh)

                from fluid import solveFluid
                cumulativeContErr = solveFluid( i, mesh, thermo, rad, thermoFluid, rho, kappa, K, U, phi, h, turb, dpdt, p, psi, initialMass, p_rgh, gh, \
                                                ghf, oCorr, nCorr, nOuterCorr, nNonOrthCorr, momentumPredictor, cumulativeContErr, finalIter )

                pass

            for i in range(solidRegions.__len__()):
                ref.ext_Info(
                ) << "\nSolving for solid region " << solidRegions[i].name(
                ) << ref.nl

                from solid import setRegionSolidFields
                mesh, thermo, rho, cp, tkappa, kappa = setRegionSolidFields(
                    i, solidRegions, thermos)

                from solid import readSolidMultiRegionPIMPLEControls
                pimple, nNonOrthCorr = readSolidMultiRegionPIMPLEControls(mesh)

                from solid import solveSolid
                solveSolid(mesh, thermo, rho, cp, tkappa, kappa, nNonOrthCorr,
                           finalIter)
                pass
            pass
        pass
        runTime.write()

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

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

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

    args = ref.setRootCase( argc, argv )

    runTime = man.createTime( args )
    
    rp = ref.compressible.regionProperties( runTime )
    
    from fluid import createFluidMeshes
    fluidRegions = createFluidMeshes( rp, runTime )
    
    from solid import createSolidMeshes,createSolidField
    solidRegions = createSolidMeshes( rp,runTime )
    

    from fluid import createFluidFields
    thermoFluid, rhoFluid, kappaFluid, UFluid, phiFluid, gFluid, turbulence, KFluid, \
                 dpdtFluid, initialMassFluid, ghFluid, ghfFluid, p_rghFluid, radiation = createFluidFields( fluidRegions, runTime )

    from solid import createSolidField
    thermos = createSolidField( solidRegions, runTime )
    
    from fluid import initContinuityErrs
    cumulativeContErr = initContinuityErrs( fluidRegions )
    
    adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls( runTime )
    
    from solid import readSolidTimeControls
    maxDi= readSolidTimeControls( runTime )
    
    from fluid import compressubibleMultiRegionCourantNo
    CoNum = compressubibleMultiRegionCourantNo( fluidRegions, runTime, rhoFluid, phiFluid )
    
    from solid import solidRegionDiffusionNo
    DiNum = solidRegionDiffusionNo( solidRegions, runTime, thermos )
    
    runTime, CoNum, DiNum = setInitialMultiRegionDeltaT( adjustTimeStep, runTime, CoNum, DiNum, maxCo, maxDi, maxDeltaT )

    while runTime.run() :
        adjustTimeStep, maxCo, maxDeltaT = ref.readTimeControls(runTime)
        
        maxDi= readSolidTimeControls( runTime )
        
        nOuterCorr = readPIMPLEControls( runTime )
        
        CoNum = compressubibleMultiRegionCourantNo( fluidRegions, runTime, rhoFluid, phiFluid )

        DiNum = solidRegionDiffusionNo( solidRegions, runTime, thermos )
           
        runTime, CoNum, DiNum = setMultiRegionDeltaT( adjustTimeStep, runTime, CoNum, DiNum, maxCo, maxDi, maxDeltaT )
                
        runTime.increment()
        
        ref.ext_Info()<< "Time = " << runTime.timeName() << ref.nl << ref.nl
                
        if nOuterCorr != 1 :
            for i in range( fluidRegions.__len__() ):
                from fluid import setRegionFluidFields
                mesh, thermo, rho, kappa, K, U, phi, turb, dpdt, p, psi, h, initialMass, p_rgh, gh, ghf, rad = \
                                     setRegionFluidFields( i, fluidRegions, thermoFluid, rhoFluid, kappaFluid, UFluid, \
                                                           phiFluid, turbulence, KFluid, dpdtFluid, initialMassFluid, ghFluid, ghfFluid, p_rghFluid, radiation )
                
                from fluid import storeOldFluidFields
                storeOldFluidFields( p, rho )
                pass
            pass
        
        # --- PIMPLE loop
        for oCorr in range( nOuterCorr ):
            finalIter = ( oCorr == nOuterCorr-1 )
            for i in range( fluidRegions.__len__() ):
                ref.ext_Info() << "\nSolving for fluid region " << fluidRegions[ i ].name() << ref.nl

                from fluid import setRegionFluidFields
                mesh, thermo, rho, kappa, K, U, phi, turb, dpdt, p, psi, h, initialMass, p_rgh, gh, ghf, rad = \
                      setRegionFluidFields( i, fluidRegions, thermoFluid, rhoFluid, kappaFluid, UFluid, \
                                            phiFluid, turbulence, KFluid, dpdtFluid, initialMassFluid, ghFluid, ghfFluid, p_rghFluid, radiation )
                
                from fluid import readFluidMultiRegionPIMPLEControls
                pimple, nCorr, nNonOrthCorr, momentumPredictor = readFluidMultiRegionPIMPLEControls( mesh ) 
                
                from fluid import solveFluid
                cumulativeContErr = solveFluid( i, mesh, thermo, rad, thermoFluid, rho, kappa, K, U, phi, h, turb, dpdt, p, psi, initialMass, p_rgh, gh, \
                                                ghf, oCorr, nCorr, nOuterCorr, nNonOrthCorr, momentumPredictor, cumulativeContErr, finalIter )
                
                pass
                
            for i in range( solidRegions.__len__() ):
               ref.ext_Info() << "\nSolving for solid region " << solidRegions[ i ].name() << ref.nl
               
               from solid import setRegionSolidFields
               mesh, thermo, rho, cp, tkappa, kappa = setRegionSolidFields( i, solidRegions, thermos )
               
               from solid import readSolidMultiRegionPIMPLEControls
               pimple, nNonOrthCorr = readSolidMultiRegionPIMPLEControls( mesh )
               
               from solid import solveSolid
               solveSolid( mesh, thermo, rho, cp, tkappa, kappa, nNonOrthCorr, finalIter )
               pass                
            pass
        pass
        runTime.write()

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

    ref.ext_Info() << "End\n"
    
    import os
    return os.EX_OK
コード例 #4
0
def main_standalone(argc, argv):

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

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

    from regionProperties import regionProperties
    rp = regionProperties(runTime)

    from fluid import createFluidMeshes
    fluidRegions = createFluidMeshes(rp, runTime)

    from solid import createSolidMeshes, createSolidField
    solidRegions = createSolidMeshes(rp, runTime)

    from fluid import createFluidFields

    thermoFluid, rhoFluid, KFluid, UFluid, phiFluid, gFluid, turbulence, DpDtFluid, initialMassFluid = createFluidFields(
        fluidRegions, runTime)

    from solid import createSolidField
    rhos, cps, rhosCps, Ks, Ts = createSolidField(solidRegions, runTime)

    from fluid import initContinuityErrs
    cumulativeContErr = initContinuityErrs(fluidRegions.size())

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

    from Foam.OpenFOAM import ext_Info, nl

    if fluidRegions.size():
        from fluid import compressubibleMultiRegionCourantNo
        CoNum = compressubibleMultiRegionCourantNo(fluidRegions, runTime,
                                                   rhoFluid, phiFluid)

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

    while runTime.run():
        adjustTimeStep, maxCo, maxDeltaT = readTimeControls(runTime)

        nOuterCorr = readPIMPLEControls(runTime)

        if fluidRegions.size():
            from fluid import compressubibleMultiRegionCourantNo
            CoNum = compressubibleMultiRegionCourantNo(fluidRegions, runTime,
                                                       rhoFluid, phiFluid)

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

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

        if nOuterCorr != 1:
            for i in range(fluidRegions.size()):
                from fluid import setRegionFluidFields
                mesh, thermo, rho, K, U, phi, g, turb, DpDt, p, psi, h, massIni = \
                      setRegionFluidFields( i, fluidRegions, thermoFluid, rhoFluid, KFluid, UFluid, \
                                            phiFluid, gFluid, turbulence, DpDtFluid, initialMassFluid )

                from fluid import storeOldFluidFields
                storeOldFluidFields(p, rho)
                pass
            pass

        # --- PIMPLE loop
        for oCorr in range(nOuterCorr):
            for i in range(fluidRegions.size()):
                ext_Info() << "\nSolving for fluid region " << fluidRegions[
                    i].name() << nl

                from fluid import setRegionFluidFields
                mesh, thermo, rho, K, U, phi, g, turb, DpDt, p, psi, h, massIni = \
                      setRegionFluidFields( i, fluidRegions, thermoFluid, rhoFluid, KFluid, UFluid, \
                                            phiFluid, gFluid, turbulence, DpDtFluid, initialMassFluid )

                from fluid import readFluidMultiRegionPIMPLEControls
                pimple, nCorr, nNonOrthCorr, momentumPredictor = readFluidMultiRegionPIMPLEControls(
                    mesh)

                from fluid import solveFluid
                cumulativeContErr = solveFluid( i, mesh, thermo, thermoFluid, rho, K, U, phi, g, h, turb, DpDt, p, psi, \
                                                massIni, oCorr, nCorr, nOuterCorr, nNonOrthCorr, momentumPredictor, cumulativeContErr )

                pass

            for i in range(solidRegions.size()):
                ext_Info() << "\nSolving for solid region " << solidRegions[
                    i].name() << nl

                from solid import setRegionSolidFields
                mesh, rho, cp, K, T = setRegionSolidFields(
                    i, solidRegions, rhos, cps, Ks, Ts)

                from solid import readSolidMultiRegionPIMPLEControls
                pimple, nNonOrthCorr = readSolidMultiRegionPIMPLEControls(mesh)

                from solid import solveSolid
                solveSolid(mesh, rho, cp, K, T, nNonOrthCorr)
                pass
            pass
        pass
        runTime.write()

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

    ext_Info() << "End\n"

    import os
    return os.EX_OK