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 Switch thermalStress(thermalProperties.lookup("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("0", dimensionSet(0, 2, -2 , -1, 0), 0.0)
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("0", dimensionSet(0, 2, -1 , 0, 0), 0.0)
44 );
45 
46 
47 if (thermalStress)
48 {
49 
50  autoPtr<volScalarField> CPtr;
51 
52  IOobject CIO
53  (
54  "C",
55  runTime.timeName(0),
56  mesh,
57  IOobject::NO_READ,
58  IOobject::NO_WRITE
59  );
60 
61  const dictionary& CDict(thermalProperties.subDict("C"));
62  word CType(CDict.lookup("type"));
63  if (CType == "uniform")
64  {
65  scalar CValue(readScalar(CDict.lookup("value")));
66 
67  CPtr.reset
68  (
69  new volScalarField
70  (
71  CIO,
72  mesh,
74  (
75  "C",
76  dimensionSet(0, 2, -2 , -1, 0),
77  CValue
78  ),
79  zeroGradientFvPatchField<scalar>::typeName
80  )
81  );
82 
83  }
84  else if (CType == "field")
85  {
86  CIO.readOpt() = IOobject::MUST_READ;
87 
88  CPtr.reset
89  (
90  new volScalarField
91  (
92  CIO,
93  mesh
94  )
95  );
96  }
97  else
98  {
100  << "Valid type entries are uniform or field for C"
101  << abort(FatalError);
102  }
103 
105 
106  autoPtr<volScalarField> rhoKPtr;
107 
108  IOobject rhoKIO
109  (
110  "k",
111  runTime.timeName(0),
112  mesh,
113  IOobject::NO_READ,
114  IOobject::NO_WRITE
115  );
116 
117  const dictionary& kDict(thermalProperties.subDict("k"));
118  word kType(kDict.lookup("type"));
119  if (kType == "uniform")
120  {
121  scalar rhoKValue(readScalar(kDict.lookup("value")));
122 
123  rhoKPtr.reset
124  (
125  new volScalarField
126  (
127  rhoKIO,
128  mesh,
130  (
131  "rhoK",
132  dimensionSet(1, 1, -3 , -1, 0),
133  rhoKValue
134  ),
135  zeroGradientFvPatchField<scalar>::typeName
136  )
137  );
138 
139  }
140  else if (kType == "field")
141  {
142  rhoKIO.readOpt() = IOobject::MUST_READ;
143 
144  rhoKPtr.reset
145  (
146  new volScalarField
147  (
148  rhoKIO,
149  mesh
150  )
151  );
152  }
153  else
154  {
156  << "Valid type entries are uniform or field for K"
157  << abort(FatalError);
158  }
159 
161 
162  autoPtr<volScalarField> alphaPtr;
163 
164  IOobject alphaIO
165  (
166  "alpha",
167  runTime.timeName(0),
168  mesh,
169  IOobject::NO_READ,
170  IOobject::NO_WRITE
171  );
172 
173 
174  const dictionary& alphaDict(thermalProperties.subDict("alpha"));
175  word alphaType(alphaDict.lookup("type"));
176 
177  if (alphaType == "uniform")
178  {
179  scalar alphaValue(readScalar(alphaDict.lookup("value")));
180  alphaPtr.reset
181  (
182  new volScalarField
183  (
184  alphaIO,
185  mesh,
187  (
188  "alpha",
190  alphaValue
191  ),
192  zeroGradientFvPatchField<scalar>::typeName
193  )
194  );
195  }
196  else if (alphaType == "field")
197  {
198  alphaIO.readOpt() = IOobject::MUST_READ;
199 
200  alphaPtr.reset
201  (
202  new volScalarField
203  (
204  alphaIO,
205  mesh
206  )
207  );
208  }
209  else
210  {
212  << "Valid type entries are uniform or field for alpha"
213  << abort(FatalError);
214  }
215 
217 
218  Info<< "Normalising k : k/rho\n" << endl;
220 
221  Info<< "Calculating thermal coefficients\n" << endl;
222 
223  threeKalpha = threeK*alpha;
224  DT = k/C;
225 }
kType
word kType(kDict.lookup("type"))
alphaPtr
autoPtr< volScalarField > alphaPtr
Definition: readThermalProperties.H:162
alphaType
word alphaType(alphaDict.lookup("type"))
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
C
volScalarField & C
Definition: readThermalProperties.H:104
CType
word CType(CDict.lookup("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:71
Foam::Info
messageStream Info
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
rhoKPtr
autoPtr< volScalarField > rhoKPtr
Definition: readThermalProperties.H:106
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
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:18
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
readScalar
#define readScalar
Definition: doubleScalar.C:38
rho
rho
Definition: pEqn.H:3
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
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:216
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:52
rhoK
volScalarField & rhoK
Definition: readThermalProperties.H:160
CIO
IOobject CIO("C", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
CPtr
Info<< "Reading thermal properties\n"<< endl;IOdictionary thermalProperties(IOobject("thermalProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE));Switch thermalStress(thermalProperties.lookup("thermalStress"));volScalarField threeKalpha(IOobject("threeKalpha", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedScalar("0", dimensionSet(0, 2, -2, -1, 0), 0.0));volScalarField DT(IOobject("DT", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedScalar("0", dimensionSet(0, 2, -1, 0, 0), 0.0));if(thermalStress){ autoPtr< volScalarField > CPtr
Definition: readThermalProperties.H:50
kDict
const dictionary & kDict(thermalProperties.subDict("k"))