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  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,
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  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,
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  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,
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 }
runTime
engineTime & runTime
Definition: createEngineTime.H:13
CPtr
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
Definition: readThermalProperties.H:49
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
alphaPtr
autoPtr< volScalarField > alphaPtr
Definition: readThermalProperties.H:159
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
rho
rho
Definition: readInitialConditions.H:88
CType
word CType(CDict.get< word >("type"))
C
volScalarField & C
Definition: readThermalProperties.H:102
alphaType
word alphaType(alphaDict.get< word >("type"))
alphaIO
IOobject alphaIO("alpha", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:73
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
rhoKPtr
autoPtr< volScalarField > rhoKPtr
Definition: readThermalProperties.H:104
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
alphaDict
const dictionary & alphaDict(thermalProperties.subDict("alpha"))
Foam::FatalError
error FatalError
rhoKIO
IOobject rhoKIO("k", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
kType
word kType(kDict.get< word >("type"))
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
CDict
const dictionary & CDict(thermalProperties.subDict("C"))
alpha
volScalarField & alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
rhoK
volScalarField & rhoK
Definition: readThermalProperties.H:157
CIO
IOobject CIO("C", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
kDict
const dictionary & kDict(thermalProperties.subDict("k"))