MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
createFields.H
Go to the documentation of this file.
1 
6  Info<< "Reading field p_rgh\n" << endl;
8  volScalarField p_rgh
9  (
10  IOobject
11  (
12  "p_rgh",
13  runTime.timeName(),
14  mesh,
15  IOobject::MUST_READ,
16  IOobject::AUTO_WRITE
17  ),
18  mesh
19  );
20 
21  Info<< "Reading field U\n" << endl;
22  volVectorField U
23  (
24  IOobject
25  (
26  "U",
27  runTime.timeName(),
28  mesh,
29  IOobject::MUST_READ,
30  IOobject::AUTO_WRITE
31  ),
32  mesh
33  );
34 
35  #include "createPhi.H"
36 
37  Info<< "Constructing twoPhaseMixtureThermo\n" << endl;
38  twoPhaseMixtureThermo mixture(mesh);
39 
40  volScalarField& alpha1(mixture.alpha1());
41  volScalarField& alpha2(mixture.alpha2());
42 
43  Info<< "Reading thermophysical properties\n" << endl;
44 
45  volScalarField& p = mixture.p();
46  volScalarField& T = mixture.T();
47 
48  Info<< "Reading field rho_foam \n" << endl;
49  volScalarField rho_foam
50  (
51  IOobject
52  (
53  "rho_foam",
54  runTime.timeName(),
55  mesh,
56  IOobject::MUST_READ,
57  IOobject::AUTO_WRITE
58  ),
59  mesh
60  );
61 
62  Info<< "Reading field rho_gas \n" << endl;
63  volScalarField rho_gas
64  (
65  IOobject
66  (
67  "rho_gas",
68  runTime.timeName(),
69  mesh,
70  IOobject::MUST_READ,
71  IOobject::AUTO_WRITE
72  ),
73  mesh
74  );
75  volScalarField rho
76  (
77  IOobject
78  (
79  "rho",
80  runTime.timeName(),
81  mesh,
82  IOobject::READ_IF_PRESENT,
83  IOobject::AUTO_WRITE
84  ),
85  alpha1*rho_gas + (1-alpha1)*rho_foam
86  );
87  volScalarField Psi1
88  (
89  IOobject
90  (
91  "Psi1",
92  runTime.timeName(),
93  mesh,
94  IOobject::READ_IF_PRESENT,
95  IOobject::AUTO_WRITE
96  ),
97  mesh,
98  dimensionedScalar("Psi1", dimensionSet(0,-2,2,0,0,0,0), 1e-5)
99  );
100 
101  volScalarField Psi2
102  (
103  IOobject
104  (
105  "Psi2",
106  runTime.timeName(),
107  mesh,
108  IOobject::READ_IF_PRESENT,
109  IOobject::AUTO_WRITE
110  ),
111  mesh,
112  dimensionedScalar("Psi2", dimensionSet(0,-2,2,0,0,0,0), 1e-2)
113  );
114 
115  volScalarField Psi_bubble
116  (
117  IOobject
118  (
119  "Psi_bubble",
120  runTime.timeName(),
121  mesh,
122  IOobject::READ_IF_PRESENT,
123  IOobject::AUTO_WRITE
124  ),
125  mesh,
126  dimensionedScalar("Psi_bubble", dimensionSet(0,-2,2,0,0,0,0), 1e-2)
127  );
128 
129  volScalarField Psi_foam
130  (
131  IOobject
132  (
133  "Psi_foam",
134  runTime.timeName(),
135  mesh,
136  IOobject::READ_IF_PRESENT,
137  IOobject::AUTO_WRITE
138  ),
139  mesh,
140  dimensionedScalar("Psi_foam", dimensionSet(0,-2,2,0,0,0,0), 1e-2)
141  );
142 
143  dimensionedScalar pMin(mixture.lookup("pMin"));
144 
145  Info<< "Calculating field g.h\n" << endl;
146  volScalarField gh("gh", g & mesh.C());
147  surfaceScalarField ghf("ghf", g & mesh.Cf());
148 
149  // Mass flux
150  // Initialisation does not matter because rhoPhi is reset after the
151  // alpha1 solution before it is used in the U equation.
152  surfaceScalarField rhoPhi
153  (
154  IOobject
155  (
156  "rhoPhi",
157  runTime.timeName(),
158  mesh,
159  IOobject::NO_READ,
160  IOobject::NO_WRITE
161  ),
162  fvc::interpolate(rho)*phi
163  );
164 
165  volScalarField dgdt
166  (
167  pos(alpha2)*fvc::div(phi)/max(alpha2, scalar(0.0001))
168  );
169 
170 
171  // Construct interface from alpha1 distribution
172  interfaceProperties interface(alpha1, U, mixture);
173  #include "MomFields.H"
174  #include "KineticsFields.H"
175  #include "rheologyFields.H"
176  #include "thermalFields.H"
177  #include "simulationMode.H"
178  // Construct compressible turbulence model
179  autoPtr<compressible::turbulenceModel> turbulence
180  (
181  compressible::turbulenceModel::New(rho, U, rhoPhi, mixture)
182  );
183 
184  Info<< "Creating field kinetic energy K\n" << endl;
185  volScalarField K("K", 0.5*magSqr(U));
186 
187  dimensionedScalar densityDimension ("densityDimension", dimensionSet(1,-3,0,0,0,0,0), 1.0);
188  dimensionedScalar initialFoamMass =
189  (
190  fvc::domainIntegrate(rho_foam*alpha2)
191  + densityDimension*L0*rhoPoly*fvc::domainIntegrate(alpha2)
192  );
193  dimensionedScalar cumulativeContinuityError = 0.0;
194 ///@endcond
creates the field variables related to the PU kinetics
double rhoPoly
density of the liquid polymer, kg/m3
defines mold-filling and validation as two simulation modes
double L0
Initial weight fraction of blowing agent in the liquid, -.
creates the field variables related to the moments
creates the field variables for the temperature equation
creates the field variables for the rheology