gravity.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 "gravity.H"
30 #include "coupledToFluid.H"
31 #include "massive.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace Lagrangian
38 {
41 }
42 }
43 
44 
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 
48 (
49  const word& name,
50  const LagrangianMesh& mesh,
51  const dictionary& modelDict,
52  const dictionary& stateDict
53 )
54 :
56  cloudLagrangianModel(static_cast<const LagrangianModel&>(*this)),
58 {}
59 
60 
61 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
62 
64 {
65  return wordList({cloud().U.name()});
66 }
67 
68 
70 (
71  const word& fieldName,
72  const word& eqnFieldName
73 ) const
74 {
75  return
76  fieldName == cloud().U.name()
77  && eqnFieldName == cloud().U.name();
78 }
79 
80 
82 (
83  const LagrangianSubScalarField& deltaT,
86 ) const
87 {
88  if (isCloud<clouds::coupledToConstantDensityFluid>())
89  {
90  const clouds::coupledToConstantDensityFluid& ctcdfCloud =
92 
93  const dimensionedScalar& rhoByRhoc = ctcdfCloud.rhoByRhoc;
94 
95  eqn.Su += g*(1 - 1/rhoByRhoc);
96  }
97  else
98  {
99  eqn.Su += g;
100  }
101 }
102 
103 
105 (
106  const LagrangianSubScalarField& deltaT,
107  const LagrangianSubScalarSubField& vOrM,
110 ) const
111 {
112  if (isCloud<clouds::coupledToConstantDensityFluid>())
113  {
114  const clouds::coupledToConstantDensityFluid& ctcdfCloud =
116 
117  const dimensionedScalar& rhoByRhoc = ctcdfCloud.rhoByRhoc;
118 
119  eqn.Su += vOrM*g*(1 - 1/rhoByRhoc);
120  }
121  else if (isCloud<clouds::coupledToFluid>() && isCloud<clouds::massive>())
122  {
123  const clouds::massive& mCloud = cloud<clouds::massive>();
124  const clouds::coupledToFluid& ctfCloud =
126 
127  const LagrangianSubScalarSubField& rho = mCloud.rho(U.mesh());
128  const LagrangianSubScalarField& rhoc = ctfCloud.rhoc(U.mesh());
129 
130  eqn.Su += vOrM*g*(1 - rhoc/rho);
131  }
132  else if (isCloud<clouds::coupledToFluid>() && !isCloud<clouds::massive>())
133  {
135  }
136  else
137  {
138  eqn.Su += vOrM*g;
139  }
140 }
141 
142 
143 // ************************************************************************* //
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...
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.
Class containing Lagrangian geometry and topology.
Base class for Lagrangian models.
Gravity force model.
Definition: gravity.H:64
virtual wordList addSupFields() const
Return the name of the velocity field.
Definition: gravity.C:63
virtual bool addsSupToField(const word &fieldName, const word &eqnFieldName) const
Return true for the velocity field.
Definition: gravity.C:70
virtual void addSup(const LagrangianSubScalarField &deltaT, const LagrangianSubVectorSubField &U, LagrangianEqn< vector > &eqn) const
Add a source term to the velocity equation.
Definition: gravity.C:82
gravity(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
Definition: gravity.C:48
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
CloudStateField< vector > U
Velocity.
Definition: cloud.H:209
Base class for clouds which are coupled to a constant density fluid.
const dimensionedScalar rhoByRhoc
Cloud/carrier density ratio.
Base class for clouds which are coupled to a variable density fluid.
const CarrierField< scalar > & rhoc
Carrier density.
Base class for clouds with particles with mass.
Definition: massive.H:51
CloudStateFieldRef< scalar > rho
Density.
Definition: massive.H:75
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)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
U
Definition: pEqn.H:72
rho
Definition: pEqn.H:1
defineTypeNameAndDebug(collisionPhaseTransfer, 0)
addToRunTimeSelectionTable(LagrangianModel, collisionPhaseTransfer, dictionary)
const dimensionSet time
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const UniformDimensionedField< Type > & lookupUniformDimensionedField(const objectRegistry &db, const word &name)