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  )
80  );
81 
82  }
83  else if (CType == "field")
84  {
85  CIO.readOpt() = IOobject::MUST_READ;
86 
87  CPtr.reset
88  (
89  new volScalarField
90  (
91  CIO,
92  mesh
93  )
94  );
95  }
96  else
97  {
99  << "Valid type entries are uniform or field for C"
100  << abort(FatalError);
101  }
102 
104 
105  autoPtr<volScalarField> rhoKPtr;
106 
107  IOobject rhoKIO
108  (
109  "k",
110  runTime.timeName(0),
111  mesh,
112  IOobject::NO_READ,
113  IOobject::NO_WRITE
114  );
115 
116  const dictionary& kDict(thermalProperties.subDict("k"));
117  word kType(kDict.lookup("type"));
118  if (kType == "uniform")
119  {
120  scalar rhoKValue(readScalar(kDict.lookup("value")));
121 
122  rhoKPtr.reset
123  (
124  new volScalarField
125  (
126  rhoKIO,
127  mesh,
129  (
130  "rhoK",
131  dimensionSet(1, 1, -3 , -1, 0),
132  rhoKValue
133  )
134  )
135  );
136 
137  }
138  else if (kType == "field")
139  {
140  rhoKIO.readOpt() = IOobject::MUST_READ;
141 
142  rhoKPtr.reset
143  (
144  new volScalarField
145  (
146  rhoKIO,
147  mesh
148  )
149  );
150  }
151  else
152  {
154  << "Valid type entries are uniform or field for K"
155  << abort(FatalError);
156  }
157 
159 
160  autoPtr<volScalarField> alphaPtr;
161 
162  IOobject alphaIO
163  (
164  "alpha",
165  runTime.timeName(0),
166  mesh,
167  IOobject::NO_READ,
168  IOobject::NO_WRITE
169  );
170 
171 
172  const dictionary& alphaDict(thermalProperties.subDict("alpha"));
173  word alphaType(alphaDict.lookup("type"));
174 
175  if (alphaType == "uniform")
176  {
177  scalar alphaValue(readScalar(alphaDict.lookup("value")));
178  alphaPtr.reset
179  (
180  new volScalarField
181  (
182  alphaIO,
183  mesh,
185  (
186  "alpha",
188  alphaValue
189  )
190  )
191  );
192  }
193  else if (alphaType == "field")
194  {
195  alphaIO.readOpt() = IOobject::MUST_READ;
196 
197  alphaPtr.reset
198  (
199  new volScalarField
200  (
201  alphaIO,
202  mesh
203  )
204  );
205  }
206  else
207  {
209  << "Valid type entries are uniform or field for alpha"
210  << abort(FatalError);
211  }
212 
214 
215  Info<< "Normalising k : k/rho\n" << endl;
216  volScalarField k(rhoK/rho);
217 
218  Info<< "Calculating thermal coefficients\n" << endl;
219 
220  threeKalpha = threeK*alpha;
221  DT = k/C;
222 }
#define readScalar
Definition: doubleScalar.C:38
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
const dictionary & alphaDict(thermalProperties.subDict("alpha"))
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
IOobject alphaIO("alpha", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
label k
Boltzmann constant.
Info<< "Reading thermal properties\"<< 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
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
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: [].
IOobject CIO("C", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
errorManip< error > abort(error &err)
Definition: errorManip.H:131
IOobject rhoKIO("k", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
volScalarField & C
word CType(CDict.lookup("type"))
word kType(kDict.lookup("type"))
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
autoPtr< volScalarField > alphaPtr
messageStream Info
word alphaType(alphaDict.lookup("type"))
const dictionary & kDict(thermalProperties.subDict("k"))
const dictionary & CDict(thermalProperties.subDict("C"))