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

createMDFields.H

Go to the documentation of this file.
00001 // Fields for data gathering
00002 
00003 List< scalarField > allSpeciesN_RU
00004 (
00005     molecules.potential().nIds(),
00006     scalarField (mesh.nCells(), 0.0)
00007 );
00008 
00009 List< scalarField > allSpeciesM_RU
00010 (
00011     molecules.potential().nIds(),
00012     scalarField (mesh.nCells(), 0.0)
00013 );
00014 
00015 List< vectorField > allSpeciesVelocitySum_RU
00016 (
00017     molecules.potential().nIds(),
00018     vectorField (mesh.nCells(), vector::zero)
00019 );
00020 
00021 List< scalarField > allSpeciesVelocityMagSquaredSum_RU
00022 (
00023     molecules.potential().nIds(),
00024     scalarField (mesh.nCells(), 0.0)
00025 );
00026 
00027 // Geometric Fields for IO
00028 
00029 Info << nl << "Creating fields." << endl;
00030 
00031 /*---------------------------------------------------------------------------*\
00032     Number density
00033 \*---------------------------------------------------------------------------*/
00034 
00035 PtrList<volScalarField> allSpeciesRhoN
00036 (
00037     molecules.potential().nIds()
00038 );
00039 
00040 forAll (allSpeciesRhoN, rN)
00041 {
00042     Info << "    Creating number density field for "
00043         << molecules.potential().idList()[rN] << endl;
00044 
00045     allSpeciesRhoN.set
00046     (
00047         rN,
00048         new volScalarField
00049         (
00050             IOobject
00051             (
00052                 "rhoN_" + molecules.potential().idList()[rN],
00053                 runTime.timeName(),
00054                 mesh,
00055                 IOobject::NO_READ,
00056                 IOobject::AUTO_WRITE
00057             ),
00058             mesh,
00059             dimless/dimVolume,
00060             "zeroGradient"
00061         )
00062     );
00063     allSpeciesRhoN[rN].internalField() = scalarField (mesh.nCells(), 0.0);
00064     allSpeciesRhoN[rN].correctBoundaryConditions();
00065 }
00066 
00067 Info << "    Creating total number density field" << endl;
00068 
00069 volScalarField totalRhoN
00070 (
00071     IOobject
00072     (
00073         "rhoN_total",
00074         runTime.timeName(),
00075         mesh,
00076         IOobject::NO_READ,
00077         IOobject::AUTO_WRITE
00078     ),
00079     mesh,
00080     dimless/dimVolume,
00081     "zeroGradient"
00082 );
00083 totalRhoN.internalField() = scalarField (mesh.nCells(), 0.0);
00084 totalRhoN.correctBoundaryConditions();
00085 
00086 /*---------------------------------------------------------------------------*\
00087     Mass density
00088 \*---------------------------------------------------------------------------*/
00089 
00090 PtrList<volScalarField> allSpeciesRhoM
00091 (
00092     molecules.potential().nIds()
00093 );
00094 
00095 forAll (allSpeciesRhoM, rM)
00096 {
00097     Info << "    Creating mass density field for "
00098         << molecules.potential().idList()[rM] << endl;
00099 
00100     allSpeciesRhoM.set
00101     (
00102         rM,
00103         new volScalarField
00104         (
00105             IOobject
00106             (
00107                 "rhoM_" + molecules.potential().idList()[rM],
00108                 runTime.timeName(),
00109                 mesh,
00110                 IOobject::NO_READ,
00111                 IOobject::AUTO_WRITE
00112             ),
00113             mesh,
00114             dimMass/dimVolume,
00115             "zeroGradient"
00116         )
00117     );
00118     allSpeciesRhoM[rM].internalField() = scalarField (mesh.nCells(), 0.0);
00119     allSpeciesRhoM[rM].correctBoundaryConditions();
00120 }
00121 
00122 Info << "    Creating total mass density field" << endl;
00123 
00124 volScalarField totalRhoM
00125 (
00126     IOobject
00127     (
00128         "rhoM_total",
00129         runTime.timeName(),
00130         mesh,
00131         IOobject::NO_READ,
00132         IOobject::AUTO_WRITE
00133     ),
00134     mesh,
00135     dimMass/dimVolume,
00136     "zeroGradient"
00137 );
00138 totalRhoM.internalField() = scalarField (mesh.nCells(), 0.0);
00139 totalRhoM.correctBoundaryConditions();
00140 
00141 /*---------------------------------------------------------------------------*\
00142     Bulk velocity
00143 \*---------------------------------------------------------------------------*/
00144 
00145 PtrList<volVectorField> allSpeciesVelocity
00146 (
00147     molecules.potential().nIds()
00148 );
00149 
00150 forAll (allSpeciesVelocity, v)
00151 {
00152     Info << "    Creating velocity field for "
00153         << molecules.potential().idList()[v] << endl;
00154 
00155     allSpeciesVelocity.set
00156     (
00157         v,
00158         new volVectorField
00159         (
00160             IOobject
00161             (
00162                 "velocity_" + molecules.potential().idList()[v],
00163                 runTime.timeName(),
00164                 mesh,
00165                 IOobject::NO_READ,
00166                 IOobject::AUTO_WRITE
00167             ),
00168             mesh,
00169             dimVelocity,
00170             "zeroGradient"
00171         )
00172     );
00173     allSpeciesVelocity[v].internalField() =
00174         vectorField (mesh.nCells(), vector::zero);
00175     allSpeciesVelocity[v].correctBoundaryConditions();
00176 }
00177 
00178 Info << "    Creating total velocity field" << endl;
00179 
00180 // volVectorField totalVelocity
00181 // (
00182 //     IOobject
00183 //     (
00184 //         "velocity_total",
00185 //         runTime.timeName(),
00186 //         mesh,
00187 //         IOobject::NO_READ,
00188 //         IOobject::AUTO_WRITE
00189 //     ),
00190 //     mesh,
00191 //     dimVelocity,
00192 //     "zeroGradient"
00193 // );
00194 // totalVelocity.internalField() = vectorField (mesh.nCells(), vector::zero);
00195 // totalVelocity.correctBoundaryConditions();
00196 
00197 
00198 volVectorField totalVelocity
00199 
00200 (
00201     IOobject
00202     (
00203 
00204     "velocity_total",
00205     runTime.timeName(),
00206     mesh,
00207     IOobject::NO_READ,
00208     IOobject::AUTO_WRITE
00209 
00210     ),
00211     mesh,
00212     dimensionedVector("zero", dimVelocity, vector::zero)
00213 );
00214 
00215 /*---------------------------------------------------------------------------*\
00216     Kinetic temperature
00217 \*---------------------------------------------------------------------------*/
00218 
00219 PtrList<volScalarField> allSpeciesTemperature
00220 (
00221     molecules.potential().nIds()
00222 );
00223 
00224 forAll (allSpeciesTemperature, t)
00225 {
00226     Info << "    Creating temperature field for "
00227         << molecules.potential().idList()[t] << endl;
00228 
00229     allSpeciesTemperature.set
00230     (
00231         t,
00232         new volScalarField
00233         (
00234             IOobject
00235             (
00236                 "temperature_" + molecules.potential().idList()[t],
00237                 runTime.timeName(),
00238                 mesh,
00239                 IOobject::NO_READ,
00240                 IOobject::AUTO_WRITE
00241             ),
00242             mesh,
00243             dimTemperature,
00244             "zeroGradient"
00245         )
00246     );
00247     allSpeciesTemperature[t].internalField() = scalarField (mesh.nCells(), 0.0);
00248     allSpeciesTemperature[t].correctBoundaryConditions();
00249 }
00250 
00251 Info << "    Creating total temperature field" << endl;
00252 
00253 volScalarField totalTemperature
00254 (
00255     IOobject
00256     (
00257         "temperature_total",
00258         runTime.timeName(),
00259         mesh,
00260         IOobject::NO_READ,
00261         IOobject::AUTO_WRITE
00262     ),
00263     mesh,
00264     dimTemperature,
00265     "zeroGradient"
00266 );
00267 totalTemperature.internalField() = scalarField (mesh.nCells(), 0.0);
00268 totalTemperature.correctBoundaryConditions();
00269 
00270 /*---------------------------------------------------------------------------*\
00271     Mean kinetic energy
00272 \*---------------------------------------------------------------------------*/
00273 
00274 
00275 PtrList<volScalarField> allSpeciesMeanKE
00276 (
00277     molecules.potential().nIds()
00278 );
00279 
00280 forAll (allSpeciesMeanKE, mKE)
00281 {
00282     Info << "    Creating mean kinetic energy field for "
00283         << molecules.potential().idList()[mKE] << endl;
00284 
00285     allSpeciesMeanKE.set
00286     (
00287         mKE,
00288         new volScalarField
00289         (
00290             IOobject
00291             (
00292                 "meanKE_" + molecules.potential().idList()[mKE],
00293                 runTime.timeName(),
00294                 mesh,
00295                 IOobject::NO_READ,
00296                 IOobject::AUTO_WRITE
00297             ),
00298             mesh,
00299             dimensionSet(1, 2, -2, 0, 0, 0, 0),
00300             "zeroGradient"
00301         )
00302     );
00303     allSpeciesMeanKE[mKE].internalField() = scalarField (mesh.nCells(), 0.0);
00304     allSpeciesMeanKE[mKE].correctBoundaryConditions();
00305 }
00306 
00307 Info << "    Creating total mean kinetic energy field" << endl;
00308 
00309 volScalarField totalMeanKE
00310 (
00311     IOobject
00312     (
00313         "meanKE_total",
00314         runTime.timeName(),
00315         mesh,
00316         IOobject::NO_READ,
00317         IOobject::AUTO_WRITE
00318     ),
00319     mesh,
00320     dimensionSet(1, 2, -2, 0, 0, 0, 0),
00321     "zeroGradient"
00322 );
00323 totalMeanKE.internalField() = scalarField (mesh.nCells(), 0.0);
00324 totalMeanKE.correctBoundaryConditions();
00325 
00326 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines