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 
46  Info<< "Reading transportProperties\n" << endl;
47  twoPhaseMixture twoPhaseProperties(U, phi);
48 
51 
52 
53  // Need to store rho for ddt(rho, U)
55  (
56  IOobject
57  (
58  "rho",
59  runTime.timeName(),
60  mesh,
61  IOobject::READ_IF_PRESENT
62  ),
63  alpha1*rho1 + (scalar(1) - alpha1)*rho2,
64  alpha1.boundaryField().types()
65  );
66  rho.oldTime();
67 
68 
69  // Mass flux
70  // Initialisation does not matter because rhoPhi is reset after the
71  // alpha1 solution before it is used in the U equation.
73  (
74  IOobject
75  (
76  "rho*phi",
77  runTime.timeName(),
78  mesh,
79  IOobject::NO_READ,
80  IOobject::NO_WRITE
81  ),
82  rho1*phi
83  );
84 
85 
86  // Construct interface from alpha1 distribution
87  interfaceProperties interface(alpha1, U, twoPhaseProperties);
88 
89 
90  // Construct incompressible turbulence model
91  autoPtr<incompressible::turbulenceModel> turbulence
92  (
93  incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
94  );
95 
97 
98  /*
99  dimensionedVector g0(g);
100 
101  // Read the data file and initialise the interpolation table
102  interpolationTable<vector> timeSeriesAcceleration
103  (
104  runTime.path()/runTime.caseConstant()/"acceleration.dat"
105  );
106  */
107 
108  Info<< "Calculating field g.h\n" << endl;
109  volScalarField gh("gh", g & mesh.C());
110  surfaceScalarField ghf("ghf", g & mesh.Cf());
111 
113  (
114  IOobject
115  (
116  "p",
117  runTime.timeName(),
118  mesh,
119  IOobject::NO_READ,
120  IOobject::AUTO_WRITE
121  ),
122  p_rgh + rho*gh
123  );
124 
125  label pRefCell = 0;
126  scalar pRefValue = 0.0;
127  setRefCell
128  (
129  p,
130  p_rgh,
131  mesh.solutionDict().subDict("PISO"),
132  pRefCell,
133  pRefValue
134  );
135 
136  if (p_rgh.needReference())
137  {
139  (
140  "p",
141  p.dimensions(),
142  pRefValue - getRefCellValue(p, pRefCell)
143  );
144  p_rgh = p - rho*gh;
145  }