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 
00046     Info<< "Reading transportProperties\n" << endl;
00047     twoPhaseMixture twoPhaseProperties(U, phi);
00048 
00049     const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
00050     const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
00051 
00052 
00053     // Need to store rho for ddt(rho, U)
00054     volScalarField rho
00055     (
00056         IOobject
00057         (
00058             "rho",
00059             runTime.timeName(),
00060             mesh,
00061             IOobject::READ_IF_PRESENT
00062         ),
00063         alpha1*rho1 + (scalar(1) - alpha1)*rho2,
00064         alpha1.boundaryField().types()
00065     );
00066     rho.oldTime();
00067 
00068 
00069     // Mass flux
00070     // Initialisation does not matter because rhoPhi is reset after the
00071     // alpha1 solution before it is used in the U equation.
00072     surfaceScalarField rhoPhi
00073     (
00074         IOobject
00075         (
00076             "rho*phi",
00077             runTime.timeName(),
00078             mesh,
00079             IOobject::NO_READ,
00080             IOobject::NO_WRITE
00081         ),
00082         rho1*phi
00083     );
00084 
00085 
00086     // Construct interface from alpha1 distribution
00087     interfaceProperties interface(alpha1, U, twoPhaseProperties);
00088 
00089 
00090     // Construct incompressible turbulence model
00091     autoPtr<incompressible::turbulenceModel> turbulence
00092     (
00093         incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
00094     );
00095 
00096     #include <finiteVolume/readGravitationalAcceleration.H>
00097 
00098     /*
00099     dimensionedVector g0(g);
00100 
00101     // Read the data file and initialise the interpolation table
00102     interpolationTable<vector> timeSeriesAcceleration
00103     (
00104         runTime.path()/runTime.caseConstant()/"acceleration.dat"
00105     );
00106     */
00107 
00108     Info<< "Calculating field g.h\n" << endl;
00109     volScalarField gh("gh", g & mesh.C());
00110     surfaceScalarField ghf("ghf", g & mesh.Cf());
00111 
00112     volScalarField p
00113     (
00114         IOobject
00115         (
00116             "p",
00117             runTime.timeName(),
00118             mesh,
00119             IOobject::NO_READ,
00120             IOobject::AUTO_WRITE
00121         ),
00122         p_rgh + rho*gh
00123     );
00124 
00125     label pRefCell = 0;
00126     scalar pRefValue = 0.0;
00127     setRefCell
00128     (
00129         p,
00130         p_rgh,
00131         mesh.solutionDict().subDict("PISO"),
00132         pRefCell,
00133         pRefValue
00134     );
00135 
00136     if (p_rgh.needReference())
00137     {
00138         p += dimensionedScalar
00139         (
00140             "p",
00141             p.dimensions(),
00142             pRefValue - getRefCellValue(p, pRefCell)
00143         );
00144         p_rgh = p - rho*gh;
00145     }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines