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  (
101  "readThermalProperties.H"
102  ) << "Valid type entries are uniform or field for C"
103  << abort(FatalError);
104  }
105 
107 
108  autoPtr<volScalarField> rhoKPtr;
109 
110  IOobject rhoKIO
111  (
112  "k",
113  runTime.timeName(0),
114  mesh,
115  IOobject::NO_READ,
116  IOobject::NO_WRITE
117  );
118 
119  const dictionary& kDict(thermalProperties.subDict("k"));
120  word kType(kDict.lookup("type"));
121  if (kType == "uniform")
122  {
123  scalar rhoKValue(readScalar(kDict.lookup("value")));
124 
125  rhoKPtr.reset
126  (
127  new volScalarField
128  (
129  rhoKIO,
130  mesh,
132  (
133  "rhoK",
134  dimensionSet(1, 1, -3 , -1, 0),
135  rhoKValue
136  ),
137  zeroGradientFvPatchField<scalar>::typeName
138  )
139  );
140 
141  }
142  else if (kType == "field")
143  {
144  rhoKIO.readOpt() = IOobject::MUST_READ;
145 
146  rhoKPtr.reset
147  (
148  new volScalarField
149  (
150  rhoKIO,
151  mesh
152  )
153  );
154  }
155  else
156  {
158  (
159  "readThermalProperties.H"
160  ) << "Valid type entries are uniform or field for K"
161  << abort(FatalError);
162  }
163 
165 
166  autoPtr<volScalarField> alphaPtr;
167 
168  IOobject alphaIO
169  (
170  "alpha",
171  runTime.timeName(0),
172  mesh,
173  IOobject::NO_READ,
174  IOobject::NO_WRITE
175  );
176 
177 
178  const dictionary& alphaDict(thermalProperties.subDict("alpha"));
179  word alphaType(alphaDict.lookup("type"));
180 
181  if (alphaType == "uniform")
182  {
183  scalar alphaValue(readScalar(alphaDict.lookup("value")));
184  alphaPtr.reset
185  (
186  new volScalarField
187  (
188  alphaIO,
189  mesh,
191  (
192  "alpha",
194  alphaValue
195  ),
196  zeroGradientFvPatchField<scalar>::typeName
197  )
198  );
199  }
200  else if (alphaType == "field")
201  {
202  alphaIO.readOpt() = IOobject::MUST_READ;
203 
204  alphaPtr.reset
205  (
206  new volScalarField
207  (
208  alphaIO,
209  mesh
210  )
211  );
212  }
213  else
214  {
216  (
217  "readThermalProperties.H"
218  ) << "Valid type entries are uniform or field for alpha"
219  << abort(FatalError);
220  }
221 
223 
224  Info<< "Normalising k : k/rho\n" << endl;
225  volScalarField k(rhoK/rho);
226 
227  Info<< "Calculating thermal coefficients\n" << endl;
228 
229  threeKalpha = threeK*alpha;
230  DT = k/C;
231 }
const dictionary & CDict(thermalProperties.subDict("C"))
#define readScalar
Definition: doubleScalar.C:38
autoPtr< volScalarField > rhoKPtr
messageStream Info
dynamicFvMesh & mesh
word kType(kDict.lookup("type"))
IOobject alphaIO("alpha", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
const dictionary & alphaDict(thermalProperties.subDict("alpha"))
word alphaType(alphaDict.lookup("type"))
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
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
label k
Boltzmann constant.
word CType(CDict.lookup("type"))
const dictionary & kDict(thermalProperties.subDict("k"))
IOobject CIO("C", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
errorManip< error > abort(error &err)
Definition: errorManip.H:131
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
IOobject rhoKIO("k", runTime.timeName(0), mesh, IOobject::NO_READ, IOobject::NO_WRITE)
autoPtr< volScalarField > alphaPtr
error FatalError
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:52
volScalarField & alpha
Fine-structure constant: default SI units: [].
volScalarField & C
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.