phaseSolidThermophysicalTransportModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "isotropic.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34  (
37  );
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
45 (
46  const word& type,
47  const alphaField& alpha,
48  const solidThermo& thermo
49 )
50 :
52  alpha_(alpha),
53  thermo_(thermo)
54 {}
55 
56 
57 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
58 
61 (
62  const alphaField& alpha,
63  const solidThermo& thermo
64 )
65 {
67  (
69  (
72  ),
73  thermo.mesh().time().constant(),
74  thermo.mesh(),
77  false
78  );
79 
80  if (header.headerOk())
81  {
82  const word modelType(IOdictionary(header).lookup("model"));
83 
84  Info<< indentOrNl << "Selecting solid thermophysical transport model "
85  << modelType << endl;
86 
87  typename dictionaryConstructorTable::iterator cstrIter =
88  dictionaryConstructorTablePtr_->find(modelType);
89 
90  if (cstrIter == dictionaryConstructorTablePtr_->end())
91  {
93  << "Unknown solid thermophysical transport model "
94  << modelType << nl << nl
95  << "Available models:" << endl
96  << dictionaryConstructorTablePtr_->sortedToc()
97  << exit(FatalError);
98  }
99 
101  (
102  cstrIter()(alpha, thermo)
103  );
104  }
105  else
106  {
107  Info<< indentOrNl
108  << "Selecting default solid thermophysical transport model "
111  << endl;
112 
114  (
115  new solidThermophysicalTransportModels::
116  isotropic<phaseSolidThermophysicalTransportModel>(alpha, thermo)
117  );
118  }
119 }
120 
121 
122 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
123 
124 const Foam::dictionary&
126 {
127  return typeDict(type());
128 }
129 
130 
131 const Foam::dictionary&
133 {
134  return optionalTypeDict(type);
135 }
136 
137 
140 {
141  return thermo().kappa();
142 }
143 
144 
147 (
148  const label patchi
149 ) const
150 {
151  return thermo().kappa().boundaryField()[patchi];
152 }
153 
154 
156 {
157  return regIOobject::read();
158 }
159 
160 
162 {}
163 
164 
166 {}
167 
168 
169 // ************************************************************************* //
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
static word groupName(Name name, const word &group)
static const word & constant()
Return constant name.
Definition: TimePaths.H:122
virtual const fvMesh & mesh() const =0
Return const access to the mesh.
virtual const word & phaseName() const =0
Phase name.
virtual const volScalarField & kappa() const =0
Thermal conductivity of mixture [W/m/K].
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:433
Abstract base class for solid thermophysical transport models.
virtual void correct()
Solve the thermophysical transport model equations.
static autoPtr< phaseSolidThermophysicalTransportModel > New(const alphaField &alpha, const solidThermo &thermo)
Return a reference to the selected thermophysical transport model.
virtual bool read()=0
Read model coefficients if they have changed.
phaseSolidThermophysicalTransportModel(const word &type, const alphaField &alpha, const solidThermo &thermo)
Construct from solid thermophysical properties.
const dictionary & typeDict() const
Const access to the coefficients dictionary.
virtual void predict()=0
Predict the thermophysical transport coefficients if possible.
virtual tmp< volScalarField > kappa() const
Thermal conductivity [W/m/K].
virtual bool read()
Read object.
Base-class for solid thermodynamic properties.
Definition: solidThermo.H:59
Abstract base class for all fluid and solid thermophysical transport models.
A class for managing temporary objects.
Definition: tmp.H:55
Templated form of IOobject providing type information for file reading and header type checking.
Definition: IOobject.H:545
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
label patchi
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
messageStream Info
defineRunTimeSelectionTable(fvConstraint, dictionary)
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
error FatalError
static const char nl
Definition: Ostream.H:297
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
fluidMulticomponentThermo & thermo
Definition: createFields.H:15