ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / applications / solvers / heatTransfer / chtMultiRegionFoam / fluid / createFluidFields.H
blobf6788d26eb3ecccb2bea1484949a781e7f3010a3
1     // Initialise fluid field pointer lists
2     PtrList<basicRhoThermo> thermoFluid(fluidRegions.size());
3     PtrList<volScalarField> rhoFluid(fluidRegions.size());
4     PtrList<volScalarField> KFluid(fluidRegions.size());
5     PtrList<volVectorField> UFluid(fluidRegions.size());
6     PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
7     PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
8     PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
9     PtrList<volScalarField> p_rghFluid(fluidRegions.size());
10     PtrList<volScalarField> ghFluid(fluidRegions.size());
11     PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
12     PtrList<radiation::radiationModel> radiation(fluidRegions.size());
13     PtrList<volScalarField> DpDtFluid(fluidRegions.size());
15     List<scalar> initialMassFluid(fluidRegions.size());
17     // Populate fluid field pointer lists
18     forAll(fluidRegions, i)
19     {
20         Info<< "*** Reading fluid mesh thermophysical properties for region "
21             << fluidRegions[i].name() << nl << endl;
23         Info<< "    Adding to thermoFluid\n" << endl;
24         thermoFluid.set
25         (
26             i,
27             basicRhoThermo::New(fluidRegions[i]).ptr()
28         );
30         Info<< "    Adding to rhoFluid\n" << endl;
31         rhoFluid.set
32         (
33             i,
34             new volScalarField
35             (
36                 IOobject
37                 (
38                     "rho",
39                     runTime.timeName(),
40                     fluidRegions[i],
41                     IOobject::NO_READ,
42                     IOobject::AUTO_WRITE
43                 ),
44                 thermoFluid[i].rho()
45             )
46         );
48         Info<< "    Adding to KFluid\n" << endl;
49         KFluid.set
50         (
51             i,
52             new volScalarField
53             (
54                 IOobject
55                 (
56                     "K",
57                     runTime.timeName(),
58                     fluidRegions[i],
59                     IOobject::NO_READ,
60                     IOobject::NO_WRITE
61                 ),
62                 thermoFluid[i].Cp()*thermoFluid[i].alpha()
63             )
64         );
66         Info<< "    Adding to UFluid\n" << endl;
67         UFluid.set
68         (
69             i,
70             new volVectorField
71             (
72                 IOobject
73                 (
74                     "U",
75                     runTime.timeName(),
76                     fluidRegions[i],
77                     IOobject::MUST_READ,
78                     IOobject::AUTO_WRITE
79                 ),
80                 fluidRegions[i]
81             )
82         );
84         Info<< "    Adding to phiFluid\n" << endl;
85         phiFluid.set
86         (
87             i,
88             new surfaceScalarField
89             (
90                 IOobject
91                 (
92                     "phi",
93                     runTime.timeName(),
94                     fluidRegions[i],
95                     IOobject::READ_IF_PRESENT,
96                     IOobject::AUTO_WRITE
97                 ),
98                 linearInterpolate(rhoFluid[i]*UFluid[i])
99                     & fluidRegions[i].Sf()
100             )
101         );
103         Info<< "    Adding to gFluid\n" << endl;
104         gFluid.set
105         (
106             i,
107             new uniformDimensionedVectorField
108             (
109                 IOobject
110                 (
111                     "g",
112                     runTime.constant(),
113                     fluidRegions[i],
114                     IOobject::MUST_READ,
115                     IOobject::NO_WRITE
116                 )
117             )
118         );
120         Info<< "    Adding to turbulence\n" << endl;
121         turbulence.set
122         (
123             i,
124             autoPtr<compressible::turbulenceModel>
125             (
126                 compressible::turbulenceModel::New
127                 (
128                     rhoFluid[i],
129                     UFluid[i],
130                     phiFluid[i],
131                     thermoFluid[i]
132                 )
133             ).ptr()
134         );
136         Info<< "    Adding to ghFluid\n" << endl;
137         ghFluid.set
138         (
139             i,
140             new volScalarField("gh", gFluid[i] & fluidRegions[i].C())
141         );
143         Info<< "    Adding to ghfFluid\n" << endl;
144         ghfFluid.set
145         (
146             i,
147             new surfaceScalarField("ghf", gFluid[i] & fluidRegions[i].Cf())
148         );
150         p_rghFluid.set
151         (
152             i,
153             new volScalarField
154             (
155                 IOobject
156                 (
157                     "p_rgh",
158                     runTime.timeName(),
159                     fluidRegions[i],
160                     IOobject::MUST_READ,
161                     IOobject::AUTO_WRITE
162                 ),
163                 fluidRegions[i]
164             )
165         );
167         // Force p_rgh to be consistent with p
168         p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i];
170         radiation.set
171         (
172             i,
173             radiation::radiationModel::New(thermoFluid[i].T())
174         );
176         initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
178         Info<< "    Adding to DpDtFluid\n" << endl;
179         DpDtFluid.set
180         (
181             i,
182             new volScalarField
183             (
184                 "DpDt",
185                 fvc::DDt
186                 (
187                     surfaceScalarField
188                     (
189                         "phiU",
190                         phiFluid[i]/fvc::interpolate(rhoFluid[i])
191                     ),
192                     thermoFluid[i].p()
193                 )
194             )
195         );
196     }