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 
00030     Info<< "Reading field alpha2\n" << endl;
00031     volScalarField alpha2
00032     (
00033         IOobject
00034         (
00035             "alpha2",
00036             runTime.timeName(),
00037             mesh,
00038             IOobject::MUST_READ,
00039             IOobject::AUTO_WRITE
00040         ),
00041         mesh
00042     );
00043 
00044 
00045     Info<< "Reading field alpha3\n" << endl;
00046     volScalarField alpha3
00047     (
00048         IOobject
00049         (
00050             "alpha3",
00051             runTime.timeName(),
00052             mesh,
00053             IOobject::MUST_READ,
00054             IOobject::AUTO_WRITE
00055         ),
00056         mesh
00057     );
00058 
00059     alpha3 == 1.0 - alpha1 - alpha2;
00060 
00061 
00062     Info<< "Reading field U\n" << endl;
00063     volVectorField U
00064     (
00065         IOobject
00066         (
00067             "U",
00068             runTime.timeName(),
00069             mesh,
00070             IOobject::MUST_READ,
00071             IOobject::AUTO_WRITE
00072         ),
00073         mesh
00074     );
00075 
00076     #include <finiteVolume/createPhi.H>
00077 
00078     threePhaseMixture threePhaseProperties(U, phi);
00079 
00080     const dimensionedScalar& rho1 = threePhaseProperties.rho1();
00081     const dimensionedScalar& rho2 = threePhaseProperties.rho2();
00082     const dimensionedScalar& rho3 = threePhaseProperties.rho3();
00083 
00084     dimensionedScalar D23(threePhaseProperties.lookup("D23"));
00085 
00086     // Need to store rho for ddt(rho, U)
00087     volScalarField rho
00088     (
00089         IOobject
00090         (
00091             "rho",
00092             runTime.timeName(),
00093             mesh,
00094             IOobject::READ_IF_PRESENT
00095         ),
00096         alpha1*rho1 + alpha2*rho2 + alpha3*rho3,
00097         alpha1.boundaryField().types()
00098     );
00099     rho.oldTime();
00100 
00101 
00102     // Mass flux
00103     // Initialisation does not matter because rhoPhi is reset after the
00104     // alpha solution before it is used in the U equation.
00105     surfaceScalarField rhoPhi
00106     (
00107         IOobject
00108         (
00109             "rho*phi",
00110             runTime.timeName(),
00111             mesh,
00112             IOobject::NO_READ,
00113             IOobject::NO_WRITE
00114         ),
00115         rho1*phi
00116     );
00117 
00118 
00119     // Construct interface from alpha distribution
00120     threePhaseInterfaceProperties interface(threePhaseProperties);
00121 
00122 
00123     // Construct incompressible turbulence model
00124     autoPtr<incompressible::turbulenceModel> turbulence
00125     (
00126         incompressible::turbulenceModel::New(U, phi, threePhaseProperties)
00127     );
00128 
00129 
00130     Info<< "Calculating field g.h\n" << endl;
00131     volScalarField gh("gh", g & mesh.C());
00132     surfaceScalarField ghf("ghf", g & mesh.Cf());
00133 
00134     volScalarField p
00135     (
00136         IOobject
00137         (
00138             "p",
00139             runTime.timeName(),
00140             mesh,
00141             IOobject::NO_READ,
00142             IOobject::AUTO_WRITE
00143         ),
00144         p_rgh + rho*gh
00145     );
00146 
00147     label pRefCell = 0;
00148     scalar pRefValue = 0.0;
00149     setRefCell
00150     (
00151         p,
00152         p_rgh,
00153         mesh.solutionDict().subDict("PISO"),
00154         pRefCell,
00155         pRefValue
00156     );
00157 
00158     if (p_rgh.needReference())
00159     {
00160         p += dimensionedScalar
00161         (
00162             "p",
00163             p.dimensions(),
00164             pRefValue - getRefCellValue(p, pRefCell)
00165         );
00166         p_rgh = p - rho*gh;
00167     }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines