basicLagrangianThermo.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) 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 
26 #include "basicLagrangianThermo.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
38 }
39 
40 
41 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
42 
44 {
46 
47  wordList eBt = Tbf.types();
48 
49  // !!! There are no boundary conditions for temperature in Lagrangian other
50  // than calculated and constraint types. So the types are the same for the
51  // temperature and energy fields. If in future boundary conditions are
52  // added that affect the temperature (e.g., some sort of wall-heat transfer
53  // model) then corresponding energy conditions will also be needed and this
54  // function will need to translate between the two.
55 
56  return eBt;
57 }
58 
59 
61 {
62  const LagrangianScalarDynamicField::Boundary& Tbf = T().boundaryField();
63 
64  wordList eBbt(Tbf.size(), word::null);
65 
66  // !!! There is no "overrides constraint" mechanism in Lagrangian at
67  // present. So there is currently nothing to be done here.
68 
69  return eBbt;
70 }
71 
72 
73 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
74 
76 (
77  const dictionary& dict,
78  const LagrangianMesh& mesh,
79  const word& phaseName
80 )
81 :
82  mesh_(mesh),
83  phaseName_(phaseName),
84  T_
85  (
86  IOobject
87  (
88  IOobject::groupName("T", phaseName),
89  mesh.time().name(),
90  mesh,
91  IOobject::MUST_READ,
92  IOobject::AUTO_WRITE
93  ),
94  mesh
95  ),
96  rho_
97  (
98  IOobject
99  (
100  IOobject::groupName("rho", phaseName),
101  mesh.time().name(),
102  mesh
103  ),
104  mesh,
105  dimensionedScalar("NaN", dimDensity, NaN),
106  wordList
107  (
108  mesh.boundary().size(),
109  calculatedLagrangianPatchScalarField::typeName
110  ),
111  wordList::null(),
112  sourcesTypes<densityLagrangianScalarFieldSource>(T_),
113  T_.sources().errorLocation()
114  ),
115  Cv_
116  (
117  IOobject
118  (
119  IOobject::groupName("Cv", phaseName),
120  mesh.time().name(),
121  mesh
122  ),
123  mesh,
125  wordList
126  (
127  mesh.boundary().size(),
128  calculatedLagrangianPatchScalarField::typeName
129  ),
130  wordList::null(),
132  T_.sources().errorLocation()
133  ),
134  kappa_
135  (
136  IOobject
137  (
138  IOobject::groupName("kappa", phaseName),
139  mesh.time().name(),
140  mesh
141  ),
142  mesh,
144  wordList
145  (
146  mesh.boundary().size(),
147  calculatedLagrangianPatchScalarField::typeName
148  ),
149  wordList::null(),
151  T_.sources().errorLocation()
152  )
153 {}
154 
155 
156 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
157 
160 (
161  const LagrangianMesh& mesh,
162  const word& phaseName
163 )
164 {
165  return New<basicLagrangianThermo>(mesh, phaseName);
166 }
167 
168 
169 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
170 
172 {}
173 
174 
176 {}
177 
178 
179 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
180 
183 {
184  return mesh_;
185 }
186 
187 
188 const Foam::word&
190 {
191  return phaseName_;
192 }
193 
194 
197 {
198  return T_;
199 }
200 
201 
204 {
205  return T_;
206 }
207 
208 
211 {
212  return rho_;
213 }
214 
215 
218 {
219  return rho_;
220 }
221 
222 
225 {
226  return Cv_;
227 }
228 
229 
232 {
233  return kappa_;
234 }
235 
236 
238 {}
239 
240 
241 // ************************************************************************* //
Generic GeometricBoundaryField class.
wordList types() const
Return a list of the patch field types.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
Class containing Lagrangian geometry and topology.
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
virtual const LagrangianScalarDynamicField & rho() const
Density [kg/m^3].
virtual const LagrangianScalarDynamicField & kappa() const
Thermal conductivity [W/m/K].
virtual const word & phaseName() const
Phase name.
virtual const LagrangianScalarDynamicField & T() const
Temperature [K].
virtual const LagrangianScalarDynamicField & Cv() const
Heat capacity at constant volume [J/kg/K].
virtual void read(const dictionary &)
Read properties dictionary.
virtual const LagrangianMesh & mesh() const
Return const access to the mesh.
implementation(const dictionary &, const LagrangianMesh &, const word &)
Construct from dictionary, mesh and phase name.
Base-class for Lagrangian fluid and solid thermodynamic models.
virtual const LagrangianScalarDynamicField & T() const =0
Temperature [K].
virtual ~basicLagrangianThermo()
Destructor.
wordList eBoundaryBaseTypes() const
Internal energy field boundary base types.
virtual const LagrangianMesh & mesh() const =0
Access the mesh.
virtual const word & phaseName() const =0
Access the phase name.
static autoPtr< Thermo > New(const LagrangianMesh &mesh, const word &phaseName=word::null)
Select thermo of a given derived type.
wordList eBoundaryTypes() const
Internal energy field boundary types.
Source condition for density. Applied to the density field automatically by the Lagrangian thermodyna...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Source condition for specific heat capacity. Applied to the specific heat capacity field automaticall...
Source condition for thermal conductivity. Applied to the thermal conductivity field automatically by...
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:78
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const dimensionSet time
Namespace for OpenFOAM.
const dimensionSet & dimThermalConductivity
Definition: dimensions.C:175
const dimensionSet & dimSpecificHeatCapacity
Definition: dimensions.C:169
defineRunTimeSelectionTable(fvConstraint, dictionary)
const dimensionSet & dimDensity
Definition: dimensions.C:158
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
faceListList boundary(nPatches)
dictionary dict