collisionPhaseTransfer.H
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 Class
25  Foam::Lagrangian::collisionPhaseTransfer
26 
27 Description
28  Model to represent the absorption of droplets or bubbles into a
29  corresponding Eulerian phase as a result of collisions with that phase (and
30  potentially other non-carrier Eulerian phases). This can be used to
31  represent (e.g.) a spray of droplets hitting and being absorbed by a VoF
32  interface. The collision probability is calculated as proportional to the
33  Eulerian phase's surface area per unit volume and the distance travelled by
34  the particle.
35 
36 Usage
37  Example specification:
38  \verbatim
39  <LagrangianModelName>
40  {
41  type collisionPhaseTransfer;
42 
43  minFraction 10 [%]; // <-- only needed for parcel clouds
44  }
45  \endverbatim
46 
47 SourceFiles
48  collisionPhaseTransfer.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef collisionPhaseTransfer_H
53 #define collisionPhaseTransfer_H
54 
55 #include "cloudLagrangianModel.H"
56 #include "LagrangianSource.H"
57 #include "CarrierField.H"
59 #include "sharedRegIOobject.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 namespace Lagrangian
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class collisionPhaseTransfer Declaration
70 \*---------------------------------------------------------------------------*/
71 
73 :
74  public LagrangianSource,
75  private cloudLagrangianModel
76 {
77  // Private Data
78 
79  //- Minimum fraction of a particle or parcel (whichever is the smaller)
80  // that can be transferred. This prevents small amounts of transfer
81  // occurring in regions with negligible phase fraction. And it
82  // prevents positive-feedback loops (i.e., where the transfer creates
83  // fraction which then drives collisions and further transfer) from
84  // being initialised in such regions.
85  const scalar minFraction_;
86 
87  //- Carrier phase fraction
88  const CarrierField<scalar>& alphac_;
89 
90  //- Random generator
92 
93  //- Cached hit probability for this step
95 
96  //- Sum of the implicit coefficients of the mass transfer models
98 
99 
100  // Private Member Functions
101 
102  //- Add a source term to the volume or mass equation
103  void addSupType
104  (
105  const LagrangianSubScalarField& deltaT,
106  const LagrangianSubScalarSubField& vOrM,
108  ) const;
109 
110  //- Add a source term to an equation
111  template<class Type>
112  void addSupType
113  (
114  const LagrangianSubScalarField& deltaT,
115  const LagrangianSubSubField<Type>& field,
117  ) const;
118 
119  //- Add a source term to a volume or mass-weighted equation
120  template<class Type>
121  void addSupType
122  (
123  const LagrangianSubScalarField& deltaT,
124  const LagrangianSubScalarSubField& vOrM,
125  const LagrangianSubSubField<Type>& field,
127  ) const;
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("collisionPhaseTransfer");
134 
135 
136  // Constructors
137 
138  //- Construct from components
140  (
141  const word& name,
142  const LagrangianMesh& mesh,
143  const dictionary& modelDict,
144  const dictionary& stateDict
145  );
146 
147 
148  // Member Functions
149 
150  //- Return the name of the volume or mass field
151  virtual wordList addSupFields() const;
152 
153  //- Return true if this is a Lagrangian field or a field of the
154  // corresponding Eulerian phase
155  virtual bool addsSupToField
156  (
157  const word& fieldName,
158  const word& eqnFieldName
159  ) const;
160 
161  //- Update the transfer rate and remove any consumed particles
162  virtual void calculate
163  (
164  const LagrangianSubScalarField& deltaT,
165  const bool final
166  );
167 
168  //- Return the source value
170  (
171  const word& fieldName,
172  const LagrangianSubMesh& subMesh
173  ) const;
174 
175  //- Hook before source evaluation
176  virtual void preAddSup
177  (
178  const LagrangianSubScalarField& deltaT,
179  const bool final
180  );
181 
182  //- Add a fractional source term
183  virtual void addSup
184  (
185  const LagrangianSubScalarField& deltaT,
187  ) const;
188 
189  //- Add a source term to an equation
191 
192  //- Add a source term to a volume or mass-weighted equation
194 
195  //- Hook after source evaluation
196  virtual void postAddSup
197  (
198  const LagrangianSubScalarField& deltaT,
199  const bool final
200  );
201 
202  //- Write state
203  virtual void writeProcessorState(Ostream& os) const;
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Lagrangian
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
#define DEFINE_LAGRANGIAN_MODEL_ADD_V_OR_M_FIELD_SUP(Type, nullArg)
#define DEFINE_LAGRANGIAN_MODEL_ADD_FIELD_SUP(Type, nullArg)
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
Class containing Lagrangian geometry and topology.
const LagrangianMesh & mesh() const
The mesh.
static word fieldName(const AlphaRhoFieldType &alphaRhoField, const AlphaRhoFieldTypes &... alphaRhoFields)
Return the name of the field associated with a source term.
const word & name() const
The source name.
Base class for Lagrangian sources. Minimal wrapper over LagrangianModel that provides an interface to...
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
Model to represent the absorption of droplets or bubbles into a corresponding Eulerian phase as a res...
virtual void addSup(const LagrangianSubScalarField &deltaT, LagrangianEqn< scalar > &eqn) const
Add a fractional source term.
TypeName("collisionPhaseTransfer")
Runtime type information.
virtual wordList addSupFields() const
Return the name of the volume or mass field.
virtual bool addsSupToField(const word &fieldName, const word &eqnFieldName) const
Return true if this is a Lagrangian field or a field of the.
virtual tmp< LagrangianSubScalarField > source(const word &fieldName, const LagrangianSubMesh &subMesh) const
Return the source value.
collisionPhaseTransfer(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
virtual void writeProcessorState(Ostream &os) const
Write state.
virtual void preAddSup(const LagrangianSubScalarField &deltaT, const bool final)
Hook before source evaluation.
virtual void postAddSup(const LagrangianSubScalarField &deltaT, const bool final)
Add a source term to an equation.
virtual void calculate(const LagrangianSubScalarField &deltaT, const bool final)
Update the transfer rate and remove any consumed particles.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Mix-in for Lagrangian models that refer to a cloud.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Random number generator with the additional ability to go back to an earlier stored state....
Container for a pointer to a shared object, who's memory is managed by an object registry....
static dictionary stateDict(const word &name, const objectRegistry &db)
Construct and return the state dictionary for reading.
Definition: stateModel.C:137
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)