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

createFields.H

Go to the documentation of this file.
00001     Info<< "Reading field p_rgh\n" << endl;
00002     volScalarField p_rgh
00003     (
00004         IOobject
00005         (
00006             "p_rgh",
00007             runTime.timeName(),
00008             mesh,
00009             IOobject::MUST_READ,
00010             IOobject::AUTO_WRITE
00011         ),
00012         mesh
00013     );
00014 
00015     Info<< "Reading field alpha1\n" << endl;
00016     volScalarField alpha1
00017     (
00018         IOobject
00019         (
00020             "alpha1",
00021             runTime.timeName(),
00022             mesh,
00023             IOobject::MUST_READ,
00024             IOobject::AUTO_WRITE
00025         ),
00026         mesh
00027     );
00028 
00029     Info<< "Reading field U\n" << endl;
00030     volVectorField U
00031     (
00032         IOobject
00033         (
00034             "U",
00035             runTime.timeName(),
00036             mesh,
00037             IOobject::MUST_READ,
00038             IOobject::AUTO_WRITE
00039         ),
00040         mesh
00041     );
00042 
00043     #include <finiteVolume/createPhi.H>
00044 
00045     Info<< "Reading transportProperties\n" << endl;
00046     twoPhaseMixture twoPhaseProperties(U, phi);
00047 
00048     const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
00049     const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
00050 
00051     dimensionedScalar Dab(twoPhaseProperties.lookup("Dab"));
00052 
00053     // Read the reciprocal of the turbulent Schmidt number
00054     dimensionedScalar alphatab(twoPhaseProperties.lookup("alphatab"));
00055 
00056     // Need to store rho for ddt(rho, U)
00057     volScalarField rho("rho", alpha1*rho1 + (scalar(1) - alpha1)*rho2);
00058     rho.oldTime();
00059 
00060 
00061     // Mass flux
00062     // Initialisation does not matter because rhoPhi is reset after the
00063     // alpha1 solution before it is used in the U equation.
00064     surfaceScalarField rhoPhi
00065     (
00066         IOobject
00067         (
00068             "rho*phi",
00069             runTime.timeName(),
00070             mesh,
00071             IOobject::NO_READ,
00072             IOobject::NO_WRITE
00073         ),
00074         rho1*phi
00075     );
00076 
00077     // Construct incompressible turbulence model
00078     autoPtr<incompressible::turbulenceModel> turbulence
00079     (
00080         incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
00081     );
00082 
00083     Info<< "Calculating field g.h\n" << endl;
00084     volScalarField gh("gh", g & mesh.C());
00085     surfaceScalarField ghf("ghf", g & mesh.Cf());
00086 
00087     volScalarField p
00088     (
00089         IOobject
00090         (
00091             "p",
00092             runTime.timeName(),
00093             mesh,
00094             IOobject::NO_READ,
00095             IOobject::AUTO_WRITE
00096         ),
00097         p_rgh + rho*gh
00098     );
00099 
00100     label pRefCell = 0;
00101     scalar pRefValue = 0.0;
00102     setRefCell
00103     (
00104         p,
00105         p_rgh,
00106         mesh.solutionDict().subDict("PIMPLE"),
00107         pRefCell,
00108         pRefValue
00109     );
00110 
00111     if (p_rgh.needReference())
00112     {
00113         p += dimensionedScalar
00114         (
00115             "p",
00116             p.dimensions(),
00117             pRefValue - getRefCellValue(p, pRefCell)
00118         );
00119         p_rgh = p - rho*gh;
00120     }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines