FreeFOAM The Cross-Platform CFD Toolkit
createFields.H
Go to the documentation of this file.
1  Info<< "Reading field p_rgh\n" << endl;
3  (
4  IOobject
5  (
6  "p_rgh",
7  runTime.timeName(),
8  mesh,
9  IOobject::MUST_READ,
10  IOobject::AUTO_WRITE
11  ),
12  mesh
13  );
14 
15  Info<< "Reading field alpha1\n" << endl;
16  volScalarField alpha1
17  (
18  IOobject
19  (
20  "alpha1",
21  runTime.timeName(),
22  mesh,
23  IOobject::MUST_READ,
24  IOobject::AUTO_WRITE
25  ),
26  mesh
27  );
28 
29  Info<< "Reading field U\n" << endl;
31  (
32  IOobject
33  (
34  "U",
35  runTime.timeName(),
36  mesh,
37  IOobject::MUST_READ,
38  IOobject::AUTO_WRITE
39  ),
40  mesh
41  );
42 
43  #include <finiteVolume/createPhi.H>
44 
45  Info<< "Reading transportProperties\n" << endl;
46  twoPhaseMixture twoPhaseProperties(U, phi);
47 
50 
51  dimensionedScalar Dab(twoPhaseProperties.lookup("Dab"));
52 
53  // Read the reciprocal of the turbulent Schmidt number
54  dimensionedScalar alphatab(twoPhaseProperties.lookup("alphatab"));
55 
56  // Need to store rho for ddt(rho, U)
57  volScalarField rho("rho", alpha1*rho1 + (scalar(1) - alpha1)*rho2);
58  rho.oldTime();
59 
60 
61  // Mass flux
62  // Initialisation does not matter because rhoPhi is reset after the
63  // alpha1 solution before it is used in the U equation.
65  (
66  IOobject
67  (
68  "rho*phi",
69  runTime.timeName(),
70  mesh,
71  IOobject::NO_READ,
72  IOobject::NO_WRITE
73  ),
74  rho1*phi
75  );
76 
77  // Construct incompressible turbulence model
78  autoPtr<incompressible::turbulenceModel> turbulence
79  (
80  incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
81  );
82 
83  Info<< "Calculating field g.h\n" << endl;
84  volScalarField gh("gh", g & mesh.C());
85  surfaceScalarField ghf("ghf", g & mesh.Cf());
86 
88  (
89  IOobject
90  (
91  "p",
92  runTime.timeName(),
93  mesh,
94  IOobject::NO_READ,
95  IOobject::AUTO_WRITE
96  ),
97  p_rgh + rho*gh
98  );
99 
100  label pRefCell = 0;
101  scalar pRefValue = 0.0;
102  setRefCell
103  (
104  p,
105  p_rgh,
106  mesh.solutionDict().subDict("PIMPLE"),
107  pRefCell,
108  pRefValue
109  );
110 
111  if (p_rgh.needReference())
112  {
114  (
115  "p",
116  p.dimensions(),
117  pRefValue - getRefCellValue(p, pRefCell)
118  );
119  p_rgh = p - rho*gh;
120  }