heatTransfer.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 "heatTransfer.H"
28 #include "coupledToThermalFluid.H"
29 #include "LagrangianmSp.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace Lagrangian
36 {
38 }
39 }
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const word& name,
46  const LagrangianMesh& mesh,
47  const dictionary& modelDict,
48  const dictionary& stateDict
49 )
50 :
52  cloudLagrangianModel(static_cast<const LagrangianModel&>(*this)),
53  thermalCloud_(cloud<clouds::thermal>()),
54  H
55  (
56  cloud().derivedField<scalar>
57  (
58  "H",
59  *this,
60  &heatTransfer::calcH
61  )
62  )
63 {}
64 
65 
66 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
67 
69 {
70  return wordList({thermalCloud_.e.name()});
71 }
72 
73 
75 (
76  const word& fieldName,
77  const word& eqnFieldName
78 ) const
79 {
80  return
81  fieldName == thermalCloud_.e.name()
82  && (
83  eqnFieldName == thermalCloud_.e.name()
84  || eqnFieldName == cloud<clouds::coupledToThermalFluid>().hec.name()
85  );
86 }
87 
88 
90 (
91  const LagrangianSubScalarField& deltaT,
92  const LagrangianSubScalarSubField& vOrM,
95 ) const
96 {
97  const clouds::coupledToThermalFluid& cctfCloud =
99 
100  const LagrangianSubMesh& subMesh = deltaT.mesh();
101 
102  const LagrangianSubScalarField& H = this->H(subMesh);
103 
104  const LagrangianSubScalarSubField T(subMesh.sub(thermalCloud_.T));
105  const LagrangianSubScalarField& Tc = cctfCloud.Tc(subMesh);
106 
107  if (eqn.isPsi(e))
108  {
109  const LagrangianSubScalarSubField Cv(subMesh.sub(thermalCloud_.Cv));
110  const LagrangianSubScalarField HbyCv(H/Cv);
111 
112  eqn.Su += H*(Tc - T) + HbyCv*e;
113  eqn -= Lagrangianm::Sp(HbyCv, e);
114  }
115  else
116  {
117  const LagrangianSubScalarField& hec = cctfCloud.hec(subMesh);
118  const LagrangianSubScalarField& Cpvc = cctfCloud.Cpvc(subMesh);
119  const LagrangianSubScalarField HbyCpvc(H/Cpvc);
120 
121  eqn.Su += H*(Tc - T) - HbyCpvc*hec;
122  eqn += Lagrangianm::Sp(HbyCpvc, hec);
123  }
124 }
125 
126 
127 // ************************************************************************* //
scalar Cv(const scalar p, const scalar T) const
Definition: HtoEthermo.H:2
Functions for calculating sources in a Lagrangian equation.
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const GeoMesh & mesh() const
Return mesh.
const word & name() const
Return name.
Definition: IOobject.H:307
This class stores the coefficients of a Lagrangian equation, and facilitates solving that equation an...
Definition: LagrangianEqn.H:56
LagrangianCoeff< Type, false > Su
Explicit coefficient.
bool isPsi(const LagrangianSubField< Type, PrimitiveField > &) const
Return whether the given field is that of the equation.
Class containing Lagrangian geometry and topology.
Base class for Lagrangian models.
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.
Base class for Lagrangian heat transfer models.
Definition: heatTransfer.H:55
heatTransfer(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
Definition: heatTransfer.C:44
virtual wordList addSupFields() const
Return the name of the energy field.
Definition: heatTransfer.C:68
virtual bool addsSupToField(const word &fieldName, const word &eqnFieldName) const
Return true for the energy or carrier energy field.
Definition: heatTransfer.C:75
virtual void addSup(const LagrangianSubScalarField &deltaT, const LagrangianSubScalarSubField &vOrM, const LagrangianSubScalarSubField &e, LagrangianEqn< scalar > &eqn) const
Add a source term to the energy equation.
Definition: heatTransfer.C:90
Mix-in for Lagrangian models that refer to a cloud.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:61
Base class for clouds which are coupled to a fluid with a thermodynamic model.
const CarrierField< scalar > & Tc
Carrier temperature.
const CarrierField< scalar > & hec
Carrier enthalpy/energy.
const CarrierField< scalar > & Cpvc
Carrier heat capacity.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
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)
defineTypeNameAndDebug(collisionPhaseTransfer, 0)
tmp< LagrangianEqn< Type > > Sp(const LagrangianSubField< SpType > &Sp, const LagrangianSubSubField< Type > &psi)
Return a source matrix.
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
const doubleScalar e
Definition: doubleScalar.H:106
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)