kinematicParticle.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) 2025-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 "kinematicParticle.H"
27 #include "cloud_fvModel.H"
28 #include "cloud_functionObject.H"
29 #include "LagrangiancDdt.H"
30 #include "LagrangianmDdt.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace clouds
38 {
41 }
42 namespace fv
43 {
44  makeCloudFvModel(kinematicParticle);
45 }
46 namespace functionObjects
47 {
48  makeCloudFunctionObject(kinematicParticle);
49 }
50 }
51 
52 
53 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
54 
57 (
58  const LagrangianSubMesh& subMesh
59 ) const
60 {
61  const LagrangianSubScalarSubField& v = this->v.ref(subMesh);
62  const LagrangianSubVectorSubField& U = this->U.ref(subMesh);
63 
64  return
68 }
69 
70 
72 {
73  const bool dUdt = tracking == trackingType::parabolic;
74 
75  const LagrangianSubMesh subMesh = this->mesh().subNone();
76 
77  LagrangianSubScalarSubField& v = this->v.ref(subMesh);
78  LagrangianSubVectorSubField& U = this->U.ref(subMesh);
79 
80  bool result = false;
81 
82  if (LagrangianModels().addsSupToField(v))
83  {
84  result = Lagrangianm::initDdt(dimless, v, dUdt) || result;
85 
86  if (context == cloud::contextType::fvModel)
87  {
88  result = initPsicDdt(v, onec) || result;
89  if (hasPhase())
90  {
91  result = initPsicDdt(v, onecPhase) || result;
92  }
93  }
94  }
95 
96  {
97  result = Lagrangianm::initDdt(dimVolume, U, dUdt) || result;
98 
99  if (context == cloud::contextType::fvModel)
100  {
101  result = initPsicDdt(v, Uc) || result;
102  if (hasPhase() && &UcPhase != &Uc)
103  {
104  result = initPsicDdt(v, UcPhase) || result;
105  }
106  }
107  }
108 
109  return result;
110 }
111 
112 
114 (
115  const LagrangianSubScalarField& deltaT,
116  const bool final
117 )
118 {
119  const LagrangianSubMesh& subMesh = deltaT.mesh();
120 
121  LagrangianSubScalarSubField& v = this->v.ref(subMesh);
122  LagrangianSubVectorSubField& U = this->U.ref(subMesh);
123 
124  // Solve the volume equation if a model provides a volume source
125  if (LagrangianModels().addsSupToField(v))
126  {
128  (
129  Lagrangianm::Ddt(deltaT, v)
130  ==
131  LagrangianModels().source(deltaT, v)
132  );
133 
134  vEqn.solve(final);
135 
136  // Correct the diameter
138 
139  // Calculate volume exchanges with the carrier
140  if (context == cloud::contextType::fvModel && final)
141  {
142  carrierEqn(onec) += psicEqn(deltaT, v, onec);
143  if (hasPhase())
144  {
145  carrierEqn(onecPhase) += psicEqn(deltaT, v, onecPhase);
146  }
147  }
148  }
149 
150  // Solve the velocity equation
151  {
153  (
154  Lagrangianm::Ddt(deltaT, v, U)
155  ==
156  LagrangianModels().source(deltaT, v, U)
157  );
158 
159  UEqn.solve(final);
160 
161  // Calculate momentum exchanges with the carrier
162  if (context == cloud::contextType::fvModel && final)
163  {
164  carrierEqn(Uc) += psicEqn(deltaT, v, U, Uc);
165  if (hasPhase() && &UcPhase != &Uc)
166  {
167  carrierEqn(UcPhase) += psicEqn(deltaT, v, U, UcPhase);
168  }
169  }
170  }
171 }
172 
173 
175 {
178 }
179 
180 
181 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
182 
184 (
186  const contextType context,
187  const dictionary& dict
188 )
189 :
190  cloud(mesh, context),
191  carried(*this, dict),
192  spherical(static_cast<const cloud&>(*this)),
193  coupledToConstantDensityFluid(*this, *this),
194  sphericalCoupled(*this, *this, *this, *this)
195 {
197 }
198 
199 
200 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
201 
203 {}
204 
205 
206 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
207 
209 (
210  const bool initial,
211  const bool final
212 )
213 {
214  // Pre-solve operations ...
218 
219  // Solve
220  cloud::solve(initial, final);
221 
222  // Post-solve operations ...
223 }
224 
225 
226 // ************************************************************************* //
Functions for calculating the time derivative for a Lagrangian equation.
Functions for calculating the time derivative for 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.
This class stores the coefficients of a Lagrangian equation, and facilitates solving that equation an...
Definition: LagrangianEqn.H:56
void solve(const bool final)
Solve.
Class containing Lagrangian geometry and topology.
List of Lagrangian models, constructed as a (Lagrangian) mesh object. Provides similar functions to t...
bool addsSupToField(const word &fieldName) const
Return true if the LagrangianModels adds a source term to the.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:61
contextType
Context in which this cloud is used.
Definition: cloud.H:203
virtual void solve(const bool initial, const bool final)
Solve the cloud's evolution over the current time-step.
Definition: cloud.C:608
Foam::LagrangianModels & LagrangianModels() const
Access the models.
Definition: cloud.C:597
virtual void partition()
Partition hook.
Definition: cloud.C:450
CloudStateField< vector > U
Velocity.
Definition: cloud.H:209
Base class for clouds which are carried by a fluid.
Definition: carried.H:57
void clearCarrierFields()
Clear the carrier fields.
Definition: carried.C:115
void resetCarrierFields(const bool initial)
Reset the carrier fields.
Definition: carried.C:132
Base class for clouds which are coupled to a constant density fluid.
void clearCarrierEqns()
Clear the carrier equations.
Definition: coupled.C:110
void updateCarrier()
Update the cached carrier fields.
Definition: coupled.C:101
Cloud with spherical, constant density, particles.
virtual ~kinematicParticle()
Destructor.
virtual void solve(const bool initial, const bool final)
Solve the cloud's evolution over the current time-step.
kinematicParticle(LagrangianMesh &mesh, const contextType context, const dictionary &dict)
Construct from a mesh and context.
virtual bool reCalculateModified()
Do we need to re-calculate particles that are modified?
virtual tmp< LagrangianSubVectorField > dUdt(const LagrangianSubMesh &) const
Return the acceleration with which to do second-order tracking.
virtual void partition()
Partition hook.
virtual void calculate(const LagrangianSubScalarField &deltaT, const bool final)
Update the cloud properties.
const CloudDerivedField< scalar > & v
Volume.
Definition: shaped.H:90
Base class for clouds of spherical particles which are coupled to a carrier.
Base class for clouds with spherical particles.
Definition: spherical.H:53
void correct(const LagrangianSubScalarSubField &v)
Correct the shape to match the given volume.
Definition: spherical.C:90
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 managing temporary objects.
Definition: tmp.H:55
fvVectorMatrix & UEqn
Definition: UEqn.H:11
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
U
Definition: pEqn.H:72
tmp< LagrangianSubField< Type > > Ddt(const LagrangianSubSubField< Type > &psi)
Return the instantaneous time-derivative.
tmp< LagrangianEqn< Type > > Ddt(const LagrangianSubScalarField &deltaT, LagrangianSubSubField< Type > &psi)
Return the time-derivative matrix.
bool initDdt(const dimensionSet &mDims, const LagrangianSubSubField< Type > &psi, const bool instantaneousDdt=false)
Initialise time-derivative information. Registers fields used to.
addToRunTimeSelectionTable(cloud, dynamicParcel, LagrangianMesh)
defineTypeNameAndDebug(carried, 0)
makeCloudFunctionObject(dynamicParcel)
makeCloudFvModel(dynamicParcel)
Namespace for OpenFOAM.
const dimensionSet & dimless
Definition: dimensions.C:138
const dimensionSet & dimVolume
Definition: dimensions.C:150
labelList fv(nPoints)
dictionary dict