readThermalProperties.H
Go to the documentation of this file.
1 Info<< "Reading thermal properties\n" << endl;
2 
3 IOdictionary 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 
15 bool thermalStress(thermalProperties.get<bool>("thermalStress"));
16 
17 volScalarField 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 
47 if (thermalStress)
48 {
49  autoPtr<volScalarField> CPtr;
50 
51  IOobject CIO
52  (
53  "C",
54  Time::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,
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 
103 
104  autoPtr<volScalarField> rhoKPtr;
105 
106  IOobject rhoKIO
107  (
108  "k",
109  Time::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,
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 
158 
159  autoPtr<volScalarField> alphaPtr;
160 
161  IOobject alphaIO
162  (
163  "alpha",
164  Time::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,
184  (
185  "alpha",
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 
213 
214  Info<< "Normalising k : k/rho\n" << endl;
216 
217  Info<< "Calculating thermal coefficients\n" << endl;
218 
219  threeKalpha = threeK*alpha;
220  DT = k/C;
221 }
word CType(CDict.get< word >("type"))
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
Info<< "Reading thermal properties\"<< 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
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
IOobject rhoKIO("k", Time::timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
const dictionary & alphaDict(thermalProperties.subDict("alpha"))
IOobject alphaIO("alpha", Time::timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
label k
Boltzmann constant.
volScalarField & rhoK
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
word timeName
Definition: getTimeIndex.H:3
autoPtr< volScalarField > rhoKPtr
dynamicFvMesh & mesh
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:52
volScalarField & alpha
Fine-structure constant: default SI units: [].
word alphaType(alphaDict.get< word >("type"))
errorManip< error > abort(error &err)
Definition: errorManip.H:139
volScalarField & C
IOobject CIO("C", Time::timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
autoPtr< volScalarField > alphaPtr
messageStream Info
Information stream (stdout output on master, null elsewhere)
const dictionary & kDict(thermalProperties.subDict("k"))
const dictionary & CDict(thermalProperties.subDict("C"))
word kType(kDict.get< word >("type"))
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127