Module FoamFiles
In: openfoam.rb

Methods

Public Instance methods

Create dirs

[Source]

# File openfoam.rb, line 109
   def foamDirs(rootdir, casename)
   end

[Source]

# File openfoam.rb, line 84
   def foamEpsilonHeader(rootdir, casename, epsilon)
      return foamHeader(rootdir, casename, "volScalarField", "epsilon", "[0 2 -3 0 0 0 0]", epsilon)
   end

[Source]

# File openfoam.rb, line 77
   def foamFooter
      return "}


// ************************************************************************* //
"
   end

Create epsilon file

[Source]

# File openfoam.rb, line 26
   def foamHeader(rootdir, casename, field, variabel, dimensions, internalfield)
      return "/*---------------------------------------------------------------------------*\\
| =========                 |                                                 |
| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\\\    /   O peration     | Version:  1.4                                   |
|   \\\\  /    A nd           | Web:      http://www.openfoam.org               |
|    \\\\/     M anipulation  |                                                 |
\\*---------------------------------------------------------------------------*/

// Field Dictionary

FoamFile
{
    version         2.0;
    format          ascii;

    root            \"#{rootdir}\";
    case            \"#{casename}\";
    instance        \"0\";
    local           \"\";

    class           #{field};
    object          #{variabel};
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


dimensions      #{dimensions};

internalField   uniform #{internalfield};

boundaryField
{
"
   end

Create k file

[Source]

# File openfoam.rb, line 88
   def foamKHeader(rootdir, casename, kval)
      return foamHeader(rootdir, casename, "volScalarField", "k", "[0 2 -2 0 0 0 0]", kval)
   end

Create nuTilda file

[Source]

# File openfoam.rb, line 92
   def foamNuTildaHeader(rootdir, casename, nutilda)
      return foamHeader(rootdir, casename, "volScalarField", "nuTilda", "[0 2 -1 0 0 0 0]", nutilda)
   end

Create p file

[Source]

# File openfoam.rb, line 96
   def foamPHeader(rootdir, casename, pval)
      return foamHeader(rootdir, casename, "volScalarField", "p", "[0 2 -2 0 0 0 0]", pval)
   end

Create R file

[Source]

# File openfoam.rb, line 100
   def foamRHeader(rootdir, casename, rval)
      return foamHeader(rootdir, casename, "volTensorField", "R", "[0 2 -2 0 0 0 0]", rval)
   end

[Source]

# File openfoam.rb, line 62
   def foamString(name, bctype, bcvalue )
      # type is zeroGradient, fixedValue 
      if bcvalue == nil
         return "    #{name}           
    {
        type            #{bctype};
    }\n"
      else
         return "    #{name}           
    {
        type            #{bctype};
        value           uniform #{bcvalue};
    }\n"
      end
   end

Create U file

[Source]

# File openfoam.rb, line 104
   def foamUHeader(rootdir, casename, uval)
      return foamHeader(rootdir, casename, "volVectorField", "U", "[0 1 -1 0 0 0 0]", uval)
   end

Create controlDict file

[Source]

# File openfoam.rb, line 112
   def getFoamFile(whichfile, rootdir, casename)
      case whichfile
         when "controlDict"
            return "/*---------------------------------------------------------------------------*\\
| =========                 |                                                 |
| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\\\    /   O peration     | Version:  1.4                                   |
|   \\\\  /    A nd           | Web:      http://www.openfoam.org               |
|    \\\\/     M anipulation  |                                                 |
\\*---------------------------------------------------------------------------*/

// FoamX Case Dictionary.

FoamFile
{
    version         2.0;
    format          ascii;

    root            \"#{rootdir}\";
    case            \"#{casename}\";
    instance        \"system\";
    local           \"\";

    class           dictionary;
    object          controlDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     simpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         100;

deltaT          1;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

graphFormat     raw;

runTimeModifiable yes;

functions       
(
);


// ************************************************************************* //\n"
         when "fvSchemes"
            return "/*---------------------------------------------------------------------------*\\
| =========                 |                                                 |
| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\\\    /   O peration     | Version:  1.4                                   |
|   \\\\  /    A nd           | Web:      http://www.openfoam.org               |
|    \\\\/     M anipulation  |                                                 |
\\*---------------------------------------------------------------------------*/

// FoamX Case Dictionary.

FoamFile
{
    version         2.0;
    format          ascii;

    root            \"#{rootdir}\";
    case            \"#{casename}\";
    instance        \"system\";
    local           \"\";

    class           dictionary;
    object          fvSchemes;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default         steadyState;
}

gradSchemes
{
    default         Gauss linear;
    grad(p)         Gauss linear;
    grad(U)         Gauss linear;
}

divSchemes
{
    default         Gauss upwind;
    div(phi,U)      Gauss upwind;
    div(phi,k)      Gauss upwind;
    div(phi,epsilon) Gauss upwind;
    div(phi,R)      Gauss upwind;
    div(R)          Gauss linear;
    div(phi,nuTilda) Gauss upwind;
    div((nuEff*dev(grad(U).T()))) Gauss linear;
}

laplacianSchemes
{
    default         none;
    laplacian(nuEff,U) Gauss linear corrected;
    laplacian((1|A(U)),p) Gauss linear corrected;
    laplacian(DkEff,k) Gauss linear corrected;
    laplacian(DepsilonEff,epsilon) Gauss linear corrected;
    laplacian(DREff,R) Gauss linear corrected;
    laplacian(DnuTildaEff,nuTilda) Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
    interpolate(U)  linear;
}

snGradSchemes
{
    default         corrected;
}

fluxRequired
{
    default         no;
    p;
}


// ************************************************************************* //\n"
         when "fvSolution"
            return "/*---------------------------------------------------------------------------*\\
| =========                 |                                                 |
| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\\\    /   O peration     | Version:  1.4                                   |
|   \\\\  /    A nd           | Web:      http://www.openfoam.org               |
|    \\\\/     M anipulation  |                                                 |
\\*---------------------------------------------------------------------------*/

// FoamX Case Dictionary.

FoamFile
{
    version         2.0;
    format          ascii;

    root            \"#{rootdir}\";
    case            \"#{casename}\";
    instance        \"system\";
    local           \"\";

    class           dictionary;
    object          fvSolution;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    p               PCG 
    {
        tolerance       1e-06;
        relTol          0;
        preconditioner  DIC;
    };
    U               PBiCG 
    {
        tolerance       1e-05;
        relTol          0;
        preconditioner  DILU;
    };
    k               PBiCG 
    {
        tolerance       1e-05;
        relTol          0;
        preconditioner  DILU;
    };
    epsilon         PBiCG 
    {
        tolerance       1e-05;
        relTol          0;
        preconditioner  DILU;
    };
    R               PBiCG 
    {
        tolerance       1e-05;
        relTol          0;
        preconditioner  DILU;
    };
    nuTilda         PBiCG 
    {
        tolerance       1e-05;
        relTol          0;
        preconditioner  DILU;
    };
}

SIMPLE
{
    nNonOrthogonalCorrectors 0;
    pRefCell        0;
    pRefValue       0;
}

relaxationFactors
{
    p               0.3;
    U               0.7;
    k               0.7;
    epsilon         0.7;
    R               0.7;
    nuTilda         0.7;
}


// ************************************************************************* //\n"
         when "transportProperties"
            return "/*---------------------------------------------------------------------------*\\
| =========                 |                                                 |
| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\\\    /   O peration     | Version:  1.4                                   |
|   \\\\  /    A nd           | Web:      http://www.openfoam.org               |
|    \\\\/     M anipulation  |                                                 |
\\*---------------------------------------------------------------------------*/

// FoamX Case Dictionary.

FoamFile
{
    version         2.0;
    format          ascii;

    root            \"#{rootdir}\";
    case            \"#{casename}\";
    instance        \"constant\";
    local           \"\";

    class           dictionary;
    object          transportProperties;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

transportModel  Newtonian;

nu              nu [0 2 -1 0 0 0 0] 1.46e-05;

CrossPowerLawCoeffs
{
    nu0             nu0 [0 2 -1 0 0 0 0] 1.48e-05;
    nuInf           nuInf [0 2 -1 0 0 0 0] 1.48e-05;
    m               m [0 0 1 0 0 0 0] 1.225;
    n               n [0 0 0 0 0 0 0] 1;
}

BirdCarreauCoeffs
{
    nu0             nu0 [0 2 -1 0 0 0 0] 1e-06;
    nuInf           nuInf [0 2 -1 0 0 0 0] 1e-06;
    k               k [0 0 1 0 0 0 0] 0;
    n               n [0 0 0 0 0 0 0] 1;
}


// ************************************************************************* //\n"
         when "turbulenceProperties"
            return "/*---------------------------------------------------------------------------*\\
| =========                 |                                                 |
| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\\\    /   O peration     | Version:  1.4                                   |
|   \\\\  /    A nd           | Web:      http://www.openfoam.org               |
|    \\\\/     M anipulation  |                                                 |
\\*---------------------------------------------------------------------------*/

// FoamX Case Dictionary.

FoamFile
{
    version         2.0;
    format          ascii;

    root            \"#{rootdir}\";
    case            \"#{casename}\";
    instance        \"constant\";
    local           \"\";

    class           dictionary;
    object          turbulenceProperties;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

turbulenceModel kEpsilon;

turbulence      on;

laminarCoeffs
{
}

kEpsilonCoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76923;
}

RNGkEpsilonCoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.0845;
    C1              C1 [0 0 0 0 0 0 0] 1.42;
    C2              C2 [0 0 0 0 0 0 0] 1.68;
    alphak          alphaK [0 0 0 0 0 0 0] 1.39;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 1.39;
    eta0            eta0 [0 0 0 0 0 0 0] 4.38;
    beta            beta [0 0 0 0 0 0 0] 0.012;
}

NonlinearKEShihCoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    alphak          alphak [0 0 0 0 0 0 0] 1;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76932;
    A1              A1 [0 0 0 0 0 0 0] 1.25;
    A2              A2 [0 0 0 0 0 0 0] 1000;
    Ctau1           Ctau1 [0 0 0 0 0 0 0] -4;
    Ctau2           Ctau2 [0 0 0 0 0 0 0] 13;
    Ctau3           Ctau3 [0 0 0 0 0 0 0] -2;
    alphaKsi        alphaKsi [0 0 0 0 0 0 0] 0.9;
}

LienCubicKECoeffs
{
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    alphak          alphak [0 0 0 0 0 0 0] 1;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76923;
    A1              A1 [0 0 0 0 0 0 0] 1.25;
    A2              A2 [0 0 0 0 0 0 0] 1000;
    Ctau1           Ctau1 [0 0 0 0 0 0 0] -4;
    Ctau2           Ctau2 [0 0 0 0 0 0 0] 13;
    Ctau3           Ctau3 [0 0 0 0 0 0 0] -2;
    alphaKsi        alphaKsi [0 0 0 0 0 0 0] 0.9;
}

QZetaCoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    alphaZeta       alphaZeta [0 0 0 0 0 0 0] 0.76923;
    anisotropic     no;
}

LaunderSharmaKECoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76923;
}

LamBremhorstKECoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76923;
}

LienCubicKELowReCoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    alphak          alphak [0 0 0 0 0 0 0] 1;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76923;
    A1              A1 [0 0 0 0 0 0 0] 1.25;
    A2              A2 [0 0 0 0 0 0 0] 1000;
    Ctau1           Ctau1 [0 0 0 0 0 0 0] -4;
    Ctau2           Ctau2 [0 0 0 0 0 0 0] 13;
    Ctau3           Ctau3 [0 0 0 0 0 0 0] -2;
    alphaKsi        alphaKsi [0 0 0 0 0 0 0] 0.9;
    Am              Am [0 0 0 0 0 0 0] 0.016;
    Aepsilon        Aepsilon [0 0 0 0 0 0 0] 0.263;
    Amu             Amu [0 0 0 0 0 0 0] 0.00222;
}

LienLeschzinerLowReCoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    alphak          alphak [0 0 0 0 0 0 0] 1;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76923;
    Am              Am [0 0 0 0 0 0 0] 0.016;
    Aepsilon        Aepsilon [0 0 0 0 0 0 0] 0.263;
    Amu             Amu [0 0 0 0 0 0 0] 0.00222;
}

LRRCoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    Clrr1           Clrr1 [0 0 0 0 0 0 0] 1.8;
    Clrr2           Clrr2 [0 0 0 0 0 0 0] 0.6;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    Cs              Cs [0 0 0 0 0 0 0] 0.25;
    Ceps            Ceps [0 0 0 0 0 0 0] 0.15;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76923;
}

LaunderGibsonRSTMCoeffs
{
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
    Clg1            Clg1 [0 0 0 0 0 0 0] 1.8;
    Clg2            Clg2 [0 0 0 0 0 0 0] 0.6;
    C1              C1 [0 0 0 0 0 0 0] 1.44;
    C2              C2 [0 0 0 0 0 0 0] 1.92;
    C1Ref           C1Ref [0 0 0 0 0 0 0] 0.5;
    C2Ref           C2Ref [0 0 0 0 0 0 0] 0.3;
    Cs              Cs [0 0 0 0 0 0 0] 0.25;
    Ceps            Ceps [0 0 0 0 0 0 0] 0.15;
    alphaEps        alphaEps [0 0 0 0 0 0 0] 0.76923;
    alphaR          alphaR [0 0 0 0 0 0 0] 1.22;
}

SpalartAllmarasCoeffs
{
    alphaNut        alphaNut [0 0 0 0 0 0 0] 1.5;
    Cb1             Cb1 [0 0 0 0 0 0 0] 0.1355;
    Cb2             Cb2 [0 0 0 0 0 0 0] 0.622;
    Cw2             Cw2 [0 0 0 0 0 0 0] 0.3;
    Cw3             Cw3 [0 0 0 0 0 0 0] 2;
    Cv1             Cv1 [0 0 0 0 0 0 0] 7.1;
    Cv2             Cv2 [0 0 0 0 0 0 0] 5;
}

kOmegaSSTCoeffs
{
    alphaK1         alphaK1 [0 0 0 0 0 0 0] 0.85034;
    alphaK2         alphaK1 [0 0 0 0 0 0 0] 1;
    alphaOmega1     alphaOmega1 [0 0 0 0 0 0 0] 0.5;
    alphaOmega2     alphaOmega2 [0 0 0 0 0 0 0] 0.85616;
    gamma1          gamma1 [0 0 0 0 0 0 0] 0.5532;
    gamma2          gamma2 [0 0 0 0 0 0 0] 0.4403;
    beta1           beta1 [0 0 0 0 0 0 0] 0.075;
    beta2           beta2 [0 0 0 0 0 0 0] 0.0828;
    betaStar        betaStar [0 0 0 0 0 0 0] 0.09;
    a1              a1 [0 0 0 0 0 0 0] 0.31;
    c1              c1 [0 0 0 0 0 0 0] 10;
    Cmu             Cmu [0 0 0 0 0 0 0] 0.09;
}

wallFunctionCoeffs
{
    kappa           kappa [0 0 0 0 0 0 0] 0.4187;
    E               E [0 0 0 0 0 0 0] 9;
}


// ************************************************************************* //\n"
      end
   end

[Validate]