FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

createFluidFields.H

Go to the documentation of this file.
00001     // Initialise fluid field pointer lists
00002     PtrList<basicRhoThermo> thermoFluid(fluidRegions.size());
00003     PtrList<volScalarField> rhoFluid(fluidRegions.size());
00004     PtrList<volScalarField> KFluid(fluidRegions.size());
00005     PtrList<volVectorField> UFluid(fluidRegions.size());
00006     PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
00007     PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
00008     PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
00009     PtrList<volScalarField> p_rghFluid(fluidRegions.size());
00010     PtrList<volScalarField> ghFluid(fluidRegions.size());
00011     PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
00012 
00013     List<scalar> initialMassFluid(fluidRegions.size());
00014     List<label> pRefCellFluid(fluidRegions.size(),0);
00015     List<scalar> pRefValueFluid(fluidRegions.size(),0.0);
00016 
00017     PtrList<dimensionedScalar> rhoMax(fluidRegions.size());
00018     PtrList<dimensionedScalar> rhoMin(fluidRegions.size());
00019 
00020     // Populate fluid field pointer lists
00021     forAll(fluidRegions, i)
00022     {
00023         Info<< "*** Reading fluid mesh thermophysical properties for region "
00024             << fluidRegions[i].name() << nl << endl;
00025 
00026         Info<< "    Adding to thermoFluid\n" << endl;
00027 
00028         thermoFluid.set
00029         (
00030             i,
00031             basicRhoThermo::New(fluidRegions[i]).ptr()
00032         );
00033 
00034         Info<< "    Adding to rhoFluid\n" << endl;
00035         rhoFluid.set
00036         (
00037             i,
00038             new volScalarField
00039             (
00040                 IOobject
00041                 (
00042                     "rho",
00043                     runTime.timeName(),
00044                     fluidRegions[i],
00045                     IOobject::NO_READ,
00046                     IOobject::AUTO_WRITE
00047                 ),
00048                 thermoFluid[i].rho()
00049             )
00050         );
00051 
00052         Info<< "    Adding to KFluid\n" << endl;
00053         KFluid.set
00054         (
00055             i,
00056             new volScalarField
00057             (
00058                 IOobject
00059                 (
00060                     "Kcond",
00061                     runTime.timeName(),
00062                     fluidRegions[i],
00063                     IOobject::NO_READ,
00064                     IOobject::NO_WRITE
00065                 ),
00066                 thermoFluid[i].Cp()*thermoFluid[i].alpha()
00067             )
00068         );
00069 
00070         Info<< "    Adding to UFluid\n" << endl;
00071         UFluid.set
00072         (
00073             i,
00074             new volVectorField
00075             (
00076                 IOobject
00077                 (
00078                     "U",
00079                     runTime.timeName(),
00080                     fluidRegions[i],
00081                     IOobject::MUST_READ,
00082                     IOobject::AUTO_WRITE
00083                 ),
00084                 fluidRegions[i]
00085             )
00086         );
00087 
00088         Info<< "    Adding to phiFluid\n" << endl;
00089         phiFluid.set
00090         (
00091             i,
00092             new surfaceScalarField
00093             (
00094                 IOobject
00095                 (
00096                     "phi",
00097                     runTime.timeName(),
00098                     fluidRegions[i],
00099                     IOobject::READ_IF_PRESENT,
00100                     IOobject::AUTO_WRITE
00101                 ),
00102                 linearInterpolate(rhoFluid[i]*UFluid[i])
00103                     & fluidRegions[i].Sf()
00104             )
00105         );
00106 
00107         Info<< "    Adding to gFluid\n" << endl;
00108         gFluid.set
00109         (
00110             i,
00111             new uniformDimensionedVectorField
00112             (
00113                 IOobject
00114                 (
00115                     "g",
00116                     runTime.constant(),
00117                     fluidRegions[i],
00118                     IOobject::MUST_READ,
00119                     IOobject::NO_WRITE
00120                 )
00121             )
00122         );
00123 
00124         Info<< "    Adding to turbulence\n" << endl;
00125         turbulence.set
00126         (
00127             i,
00128             compressible::turbulenceModel::New
00129             (
00130                 rhoFluid[i],
00131                 UFluid[i],
00132                 phiFluid[i],
00133                 thermoFluid[i]
00134             ).ptr()
00135         );
00136 
00137         Info<< "    Adding to ghFluid\n" << endl;
00138         ghFluid.set
00139         (
00140             i,
00141             new volScalarField("gh", gFluid[i] & fluidRegions[i].C())
00142         );
00143 
00144         Info<< "    Adding to ghfFluid\n" << endl;
00145         ghfFluid.set
00146         (
00147             i,
00148             new surfaceScalarField("ghf", gFluid[i] & fluidRegions[i].Cf())
00149         );
00150 
00151         p_rghFluid.set
00152         (
00153             i,
00154             new volScalarField
00155             (
00156                 IOobject
00157                 (
00158                     "p_rgh",
00159                     runTime.timeName(),
00160                     fluidRegions[i],
00161                     IOobject::MUST_READ,
00162                     IOobject::AUTO_WRITE
00163                 ),
00164                 fluidRegions[i]
00165             )
00166         );
00167 
00168         // Force p_rgh to be consistent with p
00169         p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i];
00170 
00171         initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
00172 
00173         setRefCell
00174         (
00175             thermoFluid[i].p(),
00176             p_rghFluid[i],
00177             fluidRegions[i].solutionDict().subDict("SIMPLE"),
00178             pRefCellFluid[i],
00179             pRefValueFluid[i]
00180         );
00181 
00182         rhoMax.set
00183         (
00184             i,
00185             new dimensionedScalar
00186             (
00187                 fluidRegions[i].solutionDict().subDict("SIMPLE").lookup("rhoMax")
00188             )
00189         );
00190 
00191         rhoMin.set
00192         (
00193             i,
00194             new dimensionedScalar
00195             (
00196                 fluidRegions[i].solutionDict().subDict("SIMPLE").lookup("rhoMin")
00197             )
00198         );
00199     }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines