SolidLagrangianThermo.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 "SolidLagrangianThermo.H"
27 #include "uniformGeometricFields.H"
28 
29 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
30 
31 template<class BaseThermo>
33 {}
34 
35 
36 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 
38 template<class BaseThermo>
40 (
41  const LagrangianSubMesh& subMesh
42 )
43 {
44  if (BaseThermo::debug) InfoInFunction << endl;
45 
46  const SubField<scalar> e = subMesh.sub(this->e_.primitiveField());
47 
48  const UniformField<scalar>& p = this->p_.primitiveField();
49  SubField<scalar> T = subMesh.sub(this->T_.primitiveFieldRef());
50  SubField<scalar> rho = subMesh.sub(this->rho_.primitiveFieldRef());
51  SubField<scalar> Cv = subMesh.sub(this->Cv_.primitiveFieldRef());
52  SubField<scalar> kappa = subMesh.sub(this->kappa_.primitiveFieldRef());
53 
54  auto Yslicer = this->Yslicer();
55 
56  forAll(T, subi)
57  {
58  const label i = subMesh.start() + subi;
59 
60  auto composition = this->elementComposition(Yslicer, i);
61 
62  const typename BaseThermo::mixtureType::thermoMixtureType&
63  thermoMixture = this->thermoMixture(composition);
64 
65  const typename BaseThermo::mixtureType::transportMixtureType&
66  transportMixture =
67  this->transportMixture(composition, thermoMixture);
68 
69  T[subi] = thermoMixture.Tes(e[subi], p[subi], T[subi]);
70 
71  rho[subi] = thermoMixture.rho(p[subi], T[subi]);
72  Cv[subi] = thermoMixture.Cv(p[subi], T[subi]);
73 
74  kappa[subi] = transportMixture.kappa(p[subi], T[subi]);
75  }
76 
77  if (BaseThermo::debug) Info<< " Finished" << endl;
78 }
79 
80 
81 // ************************************************************************* //
scalar Cv(const scalar p, const scalar T) const
Definition: HtoEthermo.H:2
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
word sub(const word &fieldName) const
Return the name of a field corresponding to this sub-mesh.
label start() const
Return start.
virtual ~SolidLagrangianThermo()
Destructor.
virtual void correct(const LagrangianSubMesh &)
Update cached properties.
Pre-declare related SubField type.
Definition: SubField.H:63
A class representing the concept of a uniform field which stores only the single value and providing ...
Definition: UniformField.H:48
rho
Definition: pEqn.H:1
#define InfoInFunction
Report an information message using Foam::Info.
const dimensionedScalar e
Elementary charge.
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
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
messageStream Info
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
volScalarField & p
Typedefs for UniformGeometricField.