readThermalProperties.H
Go to the documentation of this file.
1Info<< "Reading thermal properties\n" << endl;
2
3IOdictionary thermalProperties
4(
5 IOobject
6 (
7 "thermalProperties",
8 runTime.constant(),
9 mesh,
10 IOobject::MUST_READ_IF_MODIFIED,
11 IOobject::NO_WRITE
12 )
13);
14
15bool thermalStress(thermalProperties.get<bool>("thermalStress"));
16
17volScalarField threeKalpha
18(
19 IOobject
20 (
21 "threeKalpha",
22 runTime.timeName(),
23 mesh,
24 IOobject::NO_READ,
25 IOobject::NO_WRITE
26 ),
27 mesh,
28 dimensionedScalar(dimensionSet(0, 2, -2 , -1, 0), Zero)
29);
30
31
33(
34 IOobject
35 (
36 "DT",
37 runTime.timeName(),
38 mesh,
39 IOobject::NO_READ,
40 IOobject::NO_WRITE
41 ),
42 mesh,
43 dimensionedScalar(dimensionSet(0, 2, -1 , 0, 0), Zero)
44);
45
46
47if (thermalStress)
48{
49 autoPtr<volScalarField> CPtr;
50
51 IOobject CIO
52 (
53 "C",
54 runTime.timeName(0),
55 mesh,
56 IOobject::NO_READ,
57 IOobject::NO_WRITE
58 );
59
60 const dictionary& CDict(thermalProperties.subDict("C"));
61 word CType(CDict.get<word>("type"));
62 if (CType == "uniform")
63 {
64 scalar CValue(CDict.get<scalar>("value"));
65
66 CPtr.reset
67 (
68 new volScalarField
69 (
70 CIO,
71 mesh,
72 dimensionedScalar
73 (
74 "C",
75 dimensionSet(0, 2, -2 , -1, 0),
76 CValue
77 )
78 )
79 );
80
81 }
82 else if (CType == "field")
83 {
84 CIO.readOpt(IOobject::MUST_READ);
85
86 CPtr.reset
87 (
88 new volScalarField
89 (
90 CIO,
91 mesh
92 )
93 );
94 }
95 else
96 {
98 << "Valid type entries are uniform or field for C"
99 << abort(FatalError);
100 }
101
102 volScalarField& C = CPtr();
103
104 autoPtr<volScalarField> rhoKPtr;
105
106 IOobject rhoKIO
107 (
108 "k",
109 runTime.timeName(0),
110 mesh,
111 IOobject::NO_READ,
112 IOobject::NO_WRITE
113 );
114
115 const dictionary& kDict(thermalProperties.subDict("k"));
116 word kType(kDict.get<word>("type"));
117 if (kType == "uniform")
118 {
119 scalar rhoKValue(kDict.get<scalar>("value"));
120
121 rhoKPtr.reset
122 (
123 new volScalarField
124 (
125 rhoKIO,
126 mesh,
127 dimensionedScalar
128 (
129 "rhoK",
130 dimensionSet(1, 1, -3 , -1, 0),
131 rhoKValue
132 )
133 )
134 );
135
136 }
137 else if (kType == "field")
138 {
139 rhoKIO.readOpt(IOobject::MUST_READ);
140
141 rhoKPtr.reset
142 (
143 new volScalarField
144 (
145 rhoKIO,
146 mesh
147 )
148 );
149 }
150 else
151 {
153 << "Valid type entries are uniform or field for K"
154 << abort(FatalError);
155 }
156
157 volScalarField& rhoK = rhoKPtr();
158
159 autoPtr<volScalarField> alphaPtr;
160
161 IOobject alphaIO
162 (
163 "alpha",
164 runTime.timeName(0),
165 mesh,
166 IOobject::NO_READ,
167 IOobject::NO_WRITE
168 );
169
170
171 const dictionary& alphaDict(thermalProperties.subDict("alpha"));
172 word alphaType(alphaDict.get<word>("type"));
173
174 if (alphaType == "uniform")
175 {
176 scalar alphaValue(alphaDict.get<scalar>("value"));
177 alphaPtr.reset
178 (
179 new volScalarField
180 (
181 alphaIO,
182 mesh,
183 dimensionedScalar
184 (
185 "alpha",
186 inv(dimTemperature),
187 alphaValue
188 )
189 )
190 );
191 }
192 else if (alphaType == "field")
193 {
194 alphaIO.readOpt(IOobject::MUST_READ);
195
196 alphaPtr.reset
197 (
198 new volScalarField
199 (
200 alphaIO,
201 mesh
202 )
203 );
204 }
205 else
206 {
208 << "Valid type entries are uniform or field for alpha"
209 << abort(FatalError);
210 }
211
212 volScalarField& alpha = alphaPtr();
213
214 Info<< "Normalising k : k/rho\n" << endl;
215 volScalarField k(rhoK/rho);
216
217 Info<< "Calculating thermal coefficients\n" << endl;
218
219 threeKalpha = threeK*alpha;
220 DT = k/C;
221}
label k
dynamicFvMesh & mesh
engineTime & runTime
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
errorManip< error > abort(error &err)
Definition: errorManip.H:144
IOobject alphaIO("alpha", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
autoPtr< volScalarField > rhoKPtr
const dictionary & alphaDict(thermalProperties.subDict("alpha"))
IOobject rhoKIO("k", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
word CType(CDict.get< word >("type"))
const dictionary & kDict(thermalProperties.subDict("k"))
volScalarField & alpha
IOobject CIO("C", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
Info<< "Reading thermal properties\n"<< endl;IOdictionary thermalProperties(IOobject("thermalProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE));bool thermalStress(thermalProperties.get< bool >("thermalStress"));volScalarField threeKalpha(IOobject("threeKalpha", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedScalar(dimensionSet(0, 2, -2, -1, 0), Zero));volScalarField DT(IOobject("DT", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero));if(thermalStress){ autoPtr< volScalarField > CPtr
const dictionary & CDict(thermalProperties.subDict("C"))
autoPtr< volScalarField > alphaPtr
word kType(kDict.get< word >("type"))
volScalarField & C
word alphaType(alphaDict.get< word >("type"))
volScalarField & rhoK