Exemple #1
0
def write( runTime, mesh, T ):
    if runTime.outputTime():
        gradT = ref.fvc.grad(T)
       
        gradTx = ref.volScalarField( ref.IOobject( ref.word( "gradTx" ), 
                                                   ref.fileName( runTime.timeName() ),
                                                   mesh,
                                                   ref.IOobject.NO_READ,
                                                   ref.IOobject.AUTO_WRITE ),
                                     gradT.component( ref.vector.X ) )
      
        gradTy = ref.volScalarField( ref.IOobject( ref.word( "gradTy" ),
                                                   ref.fileName( runTime.timeName() ),
                                                   mesh,
                                                   ref.IOobject.NO_READ,
                                                   ref.IOobject.AUTO_WRITE ),
                                     gradT.component( ref.vector.Y ) )

        gradTz = ref.volScalarField( ref.IOobject( ref.word( "gradTz" ),
                                           ref.fileName( runTime.timeName() ),
                                           mesh,
                                           ref.IOobject.NO_READ,
                                           ref.IOobject.AUTO_WRITE ),
                                 gradT.component( ref.vector.Z ) )
        runTime.write()
        pass
Exemple #2
0
def write(runTime, mesh, T):
    if runTime.outputTime():
        gradT = ref.fvc.grad(T)

        gradTx = ref.volScalarField(
            ref.IOobject(ref.word("gradTx"), ref.fileName(runTime.timeName()),
                         mesh, ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
            gradT.component(ref.vector.X))

        gradTy = ref.volScalarField(
            ref.IOobject(ref.word("gradTy"), ref.fileName(runTime.timeName()),
                         mesh, ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
            gradT.component(ref.vector.Y))

        gradTz = ref.volScalarField(
            ref.IOobject(ref.word("gradTz"), ref.fileName(runTime.timeName()),
                         mesh, ref.IOobject.NO_READ, ref.IOobject.AUTO_WRITE),
            gradT.component(ref.vector.Z))
        runTime.write()
        pass
def fun_pEqn(mesh, runTime, simple, p, rhok, U, phi, turbulence, gh, ghf,
             p_rgh, UEqn, pRefCell, pRefValue, cumulativeContErr):

    rAU = ref.volScalarField(ref.word("rAU"), 1.0 / UEqn.A())

    rAUf = ref.surfaceScalarField(ref.word("(1|A(U))"),
                                  ref.fvc.interpolate(rAU))

    U << rAU * UEqn.H()

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

    ref.adjustPhi(phi, U, p_rgh)

    buoyancyPhi = rAUf * ghf() * ref.fvc.snGrad(rhok) * mesh.magSf()
    phi -= buoyancyPhi

    for nonOrth in range(simple.nNonOrthCorr() + 1):
        p_rghEqn = ref.fvm.laplacian(rAUf, p_rgh) == ref.fvc.div(phi)

        p_rghEqn.setReference(pRefCell, ref.getRefCellValue(p_rgh, pRefCell))

        p_rghEqn.solve()

        if nonOrth == simple.nNonOrthCorr():
            # Calculate the conservative fluxes
            phi -= p_rghEqn.flux()

            # Explicitly relax pressure for momentum corrector
            p_rgh.relax()

            # Correct the momentum source with the pressure gradient flux
            # calculated from the relaxed pressure
            U -= rAU * ref.fvc.reconstruct(
                (buoyancyPhi + p_rghEqn.flux()) / rAUf)
            U.correctBoundaryConditions()
            pass
        pass

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

    p << p_rgh + rhok * gh

    if p_rgh.needReference():
        p += ref.dimensionedScalar(
            ref.word("p"), p.dimensions(),
            pRefValue - ref.getRefCellValue(p, pRefCell))
        p_rgh << p - rhok * gh
        pass

    return cumulativeContErr
def fun_TEqn( phi, turbulence, kappat, T, rhok, beta, TRef, Prt, Pr ):
  
  kappat << turbulence.ext_nut() / Prt
  
  kappat.correctBoundaryConditions()
  
  kappaEff = ref.volScalarField ( ref.word( "kappaEff" ) , turbulence.ext_nu() / Pr  + kappat )
  TEqn = ref.fvm.div( phi, T ) - ref.fvm.Sp( ref.fvc.div( phi ), T ) - ref.fvm.laplacian( kappaEff, T ) 

  TEqn.relax()
  TEqn.solve()

  rhok << 1.0 - beta * ( T() - TRef )
  pass
def setrDeltaT( runTime, mesh, pimple, phi, psi, U, rho, rDeltaT, maxDeltaT ):
    pimpleDict = pimple.dict()

    maxCo = pimpleDict.lookupOrDefault( ref.word( "maxCo" ), ref.scalar( 0.8 ) ) 
    rDeltaTSmoothingCoeff = pimpleDict.lookupOrDefault( ref.word( "rDeltaTSmoothingCoeff" ) , ref.scalar( 0.02 ) )
    rDeltaTDampingCoeff = pimpleDict.lookupOrDefault( ref.word( "rDeltaTDampingCoeff" ), ref.scalar( 1.0 ) )

    maxDeltaT = pimpleDict.lookupOrDefault( ref.word( "maxDeltaT" ), ref.GREAT )

    rDeltaT0 = ref.volScalarField( ref.word( "rDeltaT0" ), rDeltaT )

    # Set the reciprocal time-step from the local Courant number
    tmp = ref.fvc.surfaceSum( phi.mag() )
    tmp1= ( tmp.dimensionedInternalField() / ( ( 2 * maxCo ) * mesh.V() * rho.dimensionedInternalField() ) )
    print tmp1

    rDeltaT.dimensionedInternalField() << tmp1().max( 1.0 / ref.dimensionedScalar( ref.word( "maxDeltaT" ), ref.dimTime, maxDeltaT ) )
    

    if pimple.transonic():
        phid = ref.surfaceScalarField( ref.word( "phid" ),
                                       ref.fvc.interpolate( psi ) * ( ref.fvc.interpolate( U ) & mesh.Sf() ) )

        rDeltaT.dimensionedInternalField() << rDeltaT.dimensionedInternalField().max( ref.fvc.surfaceSum( phid.mag() ).dimensionedInternalField() / 
                                                                                      ( ( 2 * maxCo ) * mesh.V() * psi.dimensionedInternalField() ) )
        pass

    # Update tho boundary values of the reciprocal time-step
    rDeltaT.correctBoundaryConditions()

    ref.ext_Info() << "Flow time scale min/max = " << ( 1 / rDeltaT.internalField() ).gMin() << ", " << ( 1 / rDeltaT.internalField() ).gMax() << ref.nl

    if rDeltaTSmoothingCoeff < 1.0:
        ref.fvc.smooth( rDeltaT, rDeltaTSmoothingCoeff )
        pass

    ref.ext_Info() << "Smoothed flow time scale min/max = " << ( 1 / rDeltaT.internalField() ).gMin() << ", " << ( 1 / rDeltaT.internalField() ).gMax() << ref.nl

    # Limit rate of change of time scale
    # - reduce as much as required
    # - only increase at a fraction of old time scale
    if rDeltaTDampingCoeff < 1.0 and runTime.timeIndex() > ( runTime.startTimeIndex() + 1 ) :
        rDeltaT = rDeltaT0 * ( rDeltaT / rDeltaT0 ).max( ref.scalar( 1.0 ) - rDeltaTDampingCoeff )

        Info<< "Damped flow time scale min/max = " << ( 1 / rDeltaT.internalField() ).gMin() << ", " << ( 1 / rDeltaT.internalField() ).gMax() << ref.nl
        pass
    pass
Exemple #6
0
def _correctPhi(runTime, mesh, pimple, p, U, rAU, phi, pRefCell, pRefValue,
                cumulativeContErr):
    if mesh.changing():
        for patchi in range(U.ext_boundaryField().size()):
            if U.ext_boundaryField()[patchi].fixesValue():
                U.ext_boundaryField()[patchi].initEvaluate()
                pass
            pass
        for patchi in range(U.ext_boundaryField().size()):
            if U.ext_boundaryField()[patchi].fixesValue():
                U.ext_boundaryField()[patchi].evaluate()
                phi.ext_boundaryField()[patchi] << (
                    U.ext_boundaryField()[patchi]
                    & mesh.Sf().ext_boundaryField()[patchi])
                pass
            pass
        pass

    pcorrTypes = ref.wordList(p.ext_boundaryField().size(),
                              ref.zeroGradientFvPatchScalarField.typeName)

    for i in range(p.ext_boundaryField().size()):
        if p.ext_boundaryField()[i].fixesValue():
            pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName
            pass
        pass

    pcorr = ref.volScalarField(
        ref.IOobject(ref.word("pcorr"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), mesh,
        ref.dimensionedScalar(ref.word("pcorr"), p.dimensions(), 0.0),
        pcorrTypes)

    while pimple.correctNonOrthogonal():
        pcorrEqn = (ref.fvm.laplacian(rAU, pcorr) == ref.fvc.div(phi))

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

        if pimple.finalNonOrthogonalIter():
            phi << phi() - pcorrEqn.flux()  # mixed calculations
            pass
        pass
    cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh,
                                           cumulativeContErr)

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

  rAU = ref.volScalarField( ref.word( "rAU" ), 1.0 / UEqn.A() )
  
  rAUf = ref.surfaceScalarField( ref.word( "(1|A(U))" ), ref.fvc.interpolate( rAU ) )

  U << rAU * UEqn.H()

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

  ref.adjustPhi( phi, U, p_rgh );

  buoyancyPhi = rAUf * ghf() * ref.fvc.snGrad( rhok ) * mesh.magSf()
  phi -= buoyancyPhi

  while simple.correctNonOrthogonal():
    p_rghEqn = ref.fvm.laplacian( rAUf, p_rgh ) == ref.fvc.div( phi )

    p_rghEqn.setReference( pRefCell, ref.getRefCellValue( p_rgh, pRefCell ) )
    
    p_rghEqn.solve()

    if simple.finalNonOrthogonalIter():
      # Calculate the conservative fluxes
      phi -= p_rghEqn.flux()
      
      # Explicitly relax pressure for momentum corrector
      p_rgh.relax()

      # Correct the momentum source with the pressure gradient flux
      # calculated from the relaxed pressure
      U -= rAU * ref.fvc.reconstruct( ( buoyancyPhi + p_rghEqn.flux() ) / rAUf )
      U.correctBoundaryConditions()
      pass
    pass

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

  p << p_rgh + rhok * gh

  if p_rgh.needReference():
    p += ref.dimensionedScalar( ref.word( "p" ), p.dimensions(), pRefValue - ref.getRefCellValue( p, pRefCell ) )
    p_rgh << p - rhok * gh
    pass
  
  return cumulativeContErr
Exemple #8
0
def _correctPhi( runTime, mesh, pimple, p, U, rAU, phi, pRefCell, pRefValue, cumulativeContErr ):
    if mesh.changing():
       for patchi in range( U.ext_boundaryField().size() ):
           if U.ext_boundaryField()[patchi].fixesValue():
              U.ext_boundaryField()[patchi].initEvaluate()
              pass
           pass
       for patchi in range( U.ext_boundaryField().size() ):
           if U.ext_boundaryField()[patchi].fixesValue():
              U.ext_boundaryField()[patchi].evaluate()
              phi.ext_boundaryField()[patchi] << ( U.ext_boundaryField()[patchi] & mesh.Sf().ext_boundaryField()[patchi] )
              pass
           pass
       pass
       
    pcorrTypes = ref.wordList( p.ext_boundaryField().size(), ref.zeroGradientFvPatchScalarField.typeName )
    
    for i in range( p.ext_boundaryField().size() ):
        if p.ext_boundaryField()[i].fixesValue():
           pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName
           pass
        pass
    
    pcorr = ref.volScalarField( ref.IOobject( ref.word( "pcorr" ),
                                              ref.fileName( runTime.timeName() ),
                                              mesh,
                                              ref.IOobject.NO_READ,
                                              ref.IOobject.NO_WRITE ),
                                mesh,
                                ref.dimensionedScalar( ref.word( "pcorr" ), p.dimensions(), 0.0),
                                pcorrTypes )
     
    while pimple.correctNonOrthogonal():
        pcorrEqn = ( ref.fvm.laplacian( rAU, pcorr ) == ref.fvc.div( phi ) )

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

        if pimple.finalNonOrthogonalIter():
           phi << phi() - pcorrEqn.flux() # mixed calculations
           pass
        pass
    cumulativeContErr = ref.ContinuityErrs( phi, runTime, mesh, cumulativeContErr )     

    return cumulativeContErr
Exemple #9
0
def fun_correctPhi(runTime, mesh, phi, phiAbs, p, p_rgh, rho, U, cumulativeContErr, pimple, pRefCell, pRefValue):

    cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh, cumulativeContErr)
    pcorrTypes = ref.wordList(p_rgh.ext_boundaryField().size(), ref.zeroGradientFvPatchScalarField.typeName)

    for i in range(p.ext_boundaryField().size()):
        if p_rgh.ext_boundaryField()[i].fixesValue():
            pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName
            pass
        pass

    pcorr = ref.volScalarField(
        ref.IOobject(
            ref.word("pcorr"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.NO_READ, ref.IOobject.NO_WRITE
        ),
        mesh,
        ref.dimensionedScalar(ref.word("pcorr"), p_rgh.dimensions(), 0.0),
        pcorrTypes,
    )

    rAUf = ref.dimensionedScalar(ref.word("(1|A(U))"), ref.dimTime / rho.dimensions(), 1.0)

    ref.adjustPhi(phi, U, pcorr)

    ref.fvc.makeAbsolute(phi, U)

    while pimple.correctNonOrthogonal():
        pcorrEqn = ref.fvm.laplacian(rAUf, pcorr) == ref.fvc.div(phi)

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

        if pimple.finalNonOrthogonalIter():
            phi -= pcorrEqn.flux()
            phiAbs << phi
            ref.fvc.makeRelative(phi, U)
            pass

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

    return cumulativeContErr
Exemple #10
0
def correctPhi(runTime, mesh, phi, p, p_rgh, rho, U, cumulativeContErr, pimple,
               pRefCell, pRefValue):

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

    pcorrTypes = ref.wordList(p_rgh.ext_boundaryField().size(),
                              ref.zeroGradientFvPatchScalarField.typeName)

    for i in range(p.ext_boundaryField().size()):
        if p_rgh.ext_boundaryField()[i].fixesValue():
            pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName
            pass
        pass

    pcorr = ref.volScalarField(
        ref.IOobject(ref.word("pcorr"), ref.fileName(runTime.timeName()), mesh,
                     ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), mesh(),
        ref.dimensionedScalar(ref.word("pcorr"), p_rgh.dimensions(), 0.0),
        pcorrTypes)

    rAUf = ref.dimensionedScalar(ref.word("(1|A(U))"),
                                 ref.dimTime / rho.dimensions(), 1.0)

    ref.adjustPhi(phi, U, pcorr)

    while pimple.correctNonOrthogonal():
        pcorrEqn = ref.fvm.laplacian(rAUf, pcorr) == ref.fvc.div(phi)

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

        if pimple.finalNonOrthogonalIter():
            phi -= pcorrEqn.flux()
            pass

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

    return cumulativeContErr
Exemple #11
0
def setrDeltaT(runTime, mesh, pimple, phi, psi, U, rho, rDeltaT, maxDeltaT):
    pimpleDict = pimple.dict()

    maxCo = pimpleDict.lookupOrDefault(ref.word("maxCo"), ref.scalar(0.8))
    rDeltaTSmoothingCoeff = pimpleDict.lookupOrDefault(
        ref.word("rDeltaTSmoothingCoeff"), ref.scalar(0.02))
    rDeltaTDampingCoeff = pimpleDict.lookupOrDefault(
        ref.word("rDeltaTDampingCoeff"), ref.scalar(1.0))

    maxDeltaT = pimpleDict.lookupOrDefault(ref.word("maxDeltaT"), ref.GREAT)

    rDeltaT0 = ref.volScalarField(ref.word("rDeltaT0"), rDeltaT)

    # Set the reciprocal time-step from the local Courant number
    tmp = ref.fvc.surfaceSum(phi.mag())
    tmp1 = (tmp.dimensionedInternalField() /
            ((2 * maxCo) * mesh.V() * rho.dimensionedInternalField()))
    print tmp1

    rDeltaT.dimensionedInternalField() << tmp1().max(
        1.0 /
        ref.dimensionedScalar(ref.word("maxDeltaT"), ref.dimTime, maxDeltaT))

    if pimple.transonic():
        phid = ref.surfaceScalarField(
            ref.word("phid"),
            ref.fvc.interpolate(psi) * (ref.fvc.interpolate(U) & mesh.Sf()))

        rDeltaT.dimensionedInternalField() << rDeltaT.dimensionedInternalField(
        ).max(
            ref.fvc.surfaceSum(phid.mag()).dimensionedInternalField() /
            ((2 * maxCo) * mesh.V() * psi.dimensionedInternalField()))
        pass

    # Update tho boundary values of the reciprocal time-step
    rDeltaT.correctBoundaryConditions()

    ref.ext_Info() << "Flow time scale min/max = " << (
        1 / rDeltaT.internalField()).gMin() << ", " << (
            1 / rDeltaT.internalField()).gMax() << ref.nl

    if rDeltaTSmoothingCoeff < 1.0:
        ref.fvc.smooth(rDeltaT, rDeltaTSmoothingCoeff)
        pass

    ref.ext_Info() << "Smoothed flow time scale min/max = " << (
        1 / rDeltaT.internalField()).gMin() << ", " << (
            1 / rDeltaT.internalField()).gMax() << ref.nl

    # Limit rate of change of time scale
    # - reduce as much as required
    # - only increase at a fraction of old time scale
    if rDeltaTDampingCoeff < 1.0 and runTime.timeIndex() > (
            runTime.startTimeIndex() + 1):
        rDeltaT = rDeltaT0 * (
            rDeltaT / rDeltaT0).max(ref.scalar(1.0) - rDeltaTDampingCoeff)

        Info << "Damped flow time scale min/max = " << (
            1 / rDeltaT.internalField()).gMin() << ", " << (
                1 / rDeltaT.internalField()).gMax() << ref.nl
        pass
    pass
Exemple #12
0
def _pEqn( runTime,mesh, UEqn, rho, thermo, psi, U, p, phi, \
           pRefCell, pRefValue, cumulativeContErr, simple, rhoMin, rhoMax  ):
   
    rho << thermo.rho()
    rho << rho.ext_max( rhoMin )
    rho << rho.ext_min( rhoMax )
    rho.relax()

    p0 = ref.volScalarField(p)
    
    AU = ref.volScalarField( UEqn.A() )
    AtU = AU - UEqn.H1()
    U << UEqn.H() / AU
    
    # UEqn.clear()
    
    closedVolume = False
    
    if simple.transonic(): 
       while simple.correctNonOrthogonal():
           phid = ref.surfaceScalarField( ref.word( "phid" ),
                                          ref.fvc.interpolate( psi * U ) & mesh.Sf() )

           phic = ref.surfaceScalarField( ref.word( "phic" ),
                                          ref.fvc.interpolate( rho() / AtU - rho() / AU ) * ref.fvc.snGrad( p ) * mesh.magSf() + \
                                          phid * ( ref.fvc.interpolate( p ) - ref.fvc.interpolate( p, ref.word( "UD" ) ) ) ) # mixed calcutions

           #refCast<mixedFvPatchScalarField>(p.boundaryField()[1]).refValue()
           #    = p.boundaryField()[1];
           
           pEqn = ref.fvm.div( phid, p ) + ref.fvc.div( phic ) - ref.fvm.Sp( ref.fvc.div( phid ), p ) + \
                  ref.fvc.div( phid ) * p - ref.fvm.laplacian( rho() / AtU, p ) # mixed calcutions
           # pEqn.relax();

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

           if simple.finalNonOrthogonalIter():
               phi == phic + pEqn.flux()
               pass
           pass
    else:
        
        while simple.correctNonOrthogonal():
            phi << ( ref.fvc.interpolate( rho * U ) & mesh.Sf() )
            closedVolume = ref.adjustPhi( phi, U, p )
            
            phi += ref.fvc.interpolate( rho / AtU - rho / AU ) * ref.fvc.snGrad( p ) * mesh.magSf()
            pEqn = ref.fvc.div( phi ) - ref.fvm.laplacian( rho / AtU, p )
            pEqn.setReference( pRefCell, pRefValue )
            
            pEqn.solve()
            if simple.finalNonOrthogonalIter():
                phi += pEqn.flux()
                pass
            pass
            
    # The incompressibe for of the continuity error check is appropriate for
    # steady-state compressible also.
    cumulativeContErr = ref.ContinuityErrs( phi, runTime, mesh, cumulativeContErr )
    
    # Explicitly relax pressure for momentum corrector
    p.relax()
    
    U -= ( ref.fvc.grad( p0 ) * ( 1.0 / AU - 1.0 / AtU ) + ref.fvc.grad( p ) / AtU )
    # U -= fvc::grad(p)/AU;
    
    U.correctBoundaryConditions()
    
    # For closed-volume cases adjust the pressure and density levels
    # to obey overall mass continuity
    if closedVolume:
        p += ( initialMass - ref.fvc.domainIntegrate( psi * p ) ) / ref.fvc.domainIntegrate( psi )
        pass
    
    rho << thermo.rho()
    rho << rho.ext_max( rhoMin )
    rho << rho.ext_min( rhoMax )
    
    if not simple.transonic():
        rho.relax()
        pass

    ref.ext_Info() << "rho max/min : " << rho.ext_max().value() << " " << rho.ext_min().value() << ref.nl
    
    pass
    
    return cumulativeContErr
    def __init__(self, the_case_dir, the_post_processor=None):
        """
        Constructs instance of this class
        """
        import os, os.path

        #  To identify the canonical pathes of the specified filenames,
        # eliminating any symbolic links encountered in the pathes
        the_case_dir = os.path.realpath(the_case_dir)

        # Definiton of the "root" and OpenFOAM "case"
        a_root_dir, a_case = os.path.split(the_case_dir)
        print_d('a_root_dir = "%s", a_case = "%s"' % (a_root_dir, a_case))

        a_controlDict = self._createControlDict()
        # Create time - without reading controlDict from file
        # Note - controlDict not written to file using this method

        self.run_time = ref.Time(a_controlDict, ref.fileName(a_root_dir), ref.fileName(a_case))

        print_d("self.run_time.caseConstant() = %s" % self.run_time.caseConstant())

        # Create transport properties
        self.transportProperties = ref.IOdictionary(
            ref.IOobject(
                ref.word("transportProperties"),
                self.run_time.caseConstant(),
                self.run_time,
                ref.IOobject.NO_READ,
                ref.IOobject.NO_WRITE,
            )
        )

        nu = ref.dimensionedScalar(ref.word("nu"), ref.dimensionSet(0.0, 2.0, -1.0, 0.0, 0.0, 0.0, 0.0), 1e-6)
        self.transportProperties.add(ref.word("nu"), nu)

        # Create fvSchemes and fvSolution dictionaries
        fvSchemesDict = self._createFvSchemesDict()
        fvSoln = self._createFvSolution()

        # Write all dictionaries to file
        # Note, we currently need fvSchemes and fvSolution to reside in the case directory
        # since it is used during the solution... so we now write them to file
        self.run_time.writeNow()

        # Clean up unused variables
        fvSchemesDict = 0
        fvSoln = 0

        # Create mesh
        self.mesh, self.patches = self._createFvMesh()
        # mesh.write()

        # Create pressure field
        pPatchTypes = pyWordList(["zeroGradient", "fixedValue", "fixedValue", "zeroGradient"])

        a_value = ref.dimensionedScalar(ref.word(), ref.dimensionSet(0.0, 2.0, -2.0, 0.0, 0.0, 0.0, 0.0), 101.325)

        self.p = ref.volScalarField(
            ref.IOobject(
                ref.word("p"),
                ref.fileName(self.run_time.timeName()),
                self.mesh,
                ref.IOobject.NO_READ,
                ref.IOobject.AUTO_WRITE,
            ),
            self.mesh,
            a_value,
            pPatchTypes,
        )

        self.p.ext_boundaryField()[1] << 101.325
        self.p.ext_boundaryField()[2] << 101.325

        # Create velocity field
        UPatchTypes = pyWordList(["fixedValue", "zeroGradient", "zeroGradient", "fixedValue"])

        a_value = ref.dimensionedVector(
            ref.word(), ref.dimensionSet(0.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0), ref.vector(0.0, 0.0, 0.0)
        )

        self.U = ref.volVectorField(
            ref.IOobject(
                ref.word("U"),
                ref.fileName(self.run_time.timeName()),
                self.mesh,
                ref.IOobject.NO_READ,
                ref.IOobject.AUTO_WRITE,
            ),
            self.mesh,
            a_value,
            UPatchTypes,
        )

        self.U.ext_boundaryField()[0] << ref.vector(0.0, 0.1, 0.0)
        self.U.ext_boundaryField()[3] << ref.vector(0.0, 0.0, 0.0)

        self.phi = ref.createPhi(self.run_time, self.mesh, self.U)

        # Write all dictionaries to file
        self.run_time.writeNow()

        # Define the post processor engine
        if the_post_processor == None:
            the_post_processor = TDummyPostProcessor
            pass

        # Construction of the post processor engine
        self.post_processor = the_post_processor(the_case_dir, a_case)

        # To dump controlDict to be able to run "foamToVTK" utility
        self._writeControlDict(a_controlDict)

        # Post processing of the first step
        self.post_processor.process(self.run_time.value())

        # Initialization of the engine
        self.solver = icoFoam(self.run_time, self.U, self.p, self.phi, self.transportProperties)
        pass