Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / applications / solvers / multiphase / multiphaseInterFoam / createFields.H
blob78fa0ec3098b1bebee455b270da92606c3bcae07
1     Info<< "Reading field p_rgh\n" << endl;
2     volScalarField p_rgh
3     (
4         IOobject
5         (
6             "p_rgh",
7             runTime.timeName(),
8             mesh,
9             IOobject::MUST_READ,
10             IOobject::AUTO_WRITE
11         ),
12         mesh
13     );
15     Info<< "Reading field U\n" << endl;
16     volVectorField U
17     (
18         IOobject
19         (
20             "U",
21             runTime.timeName(),
22             mesh,
23             IOobject::MUST_READ,
24             IOobject::AUTO_WRITE
25         ),
26         mesh
27     );
29     #include "createPhi.H"
31     multiphaseMixture mixture(U, phi);
33     // Need to store rho for ddt(rho, U)
34     volScalarField rho
35     (
36         IOobject
37         (
38             "rho",
39             runTime.timeName(),
40             mesh,
41             IOobject::READ_IF_PRESENT
42         ),
43         mixture.rho()
44     );
45     rho.oldTime();
48     // Construct incompressible turbulence model
49     autoPtr<incompressible::turbulenceModel> turbulence
50     (
51         incompressible::turbulenceModel::New(U, phi, mixture)
52     );
54     #include "readGravitationalAcceleration.H"
56     Info<< "Calculating field g.h\n" << endl;
57     volScalarField gh("gh", g & mesh.C());
58     surfaceScalarField ghf("ghf", g & mesh.Cf());
60     volScalarField p
61     (
62         IOobject
63         (
64             "p",
65             runTime.timeName(),
66             mesh,
67             IOobject::NO_READ,
68             IOobject::AUTO_WRITE
69         ),
70         p_rgh + rho*gh
71     );
73     label pRefCell = 0;
74     scalar pRefValue = 0.0;
75     setRefCell
76     (
77         p,
78         p_rgh,
79         mesh.solutionDict().subDict("PIMPLE"),
80         pRefCell,
81         pRefValue
82     );
84     if (p_rgh.needReference())
85     {
86         p += dimensionedScalar
87         (
88             "p",
89             p.dimensions(),
90             pRefValue - getRefCellValue(p, pRefCell)
91         );
92     }