carried.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::clouds::carried
26 
27 Description
28  Base class for clouds which are carried by a fluid
29 
30 SourceFiles
31  carried.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef carried_H
36 #define carried_H
37 
38 #include "cloud.H"
39 #include "HashPtrTable.H"
40 #include "volFieldsFwd.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 template<class Type>
48 class CarrierField;
49 
50 namespace clouds
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class carried Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class carried
58 {
59 private:
60 
61  // Private Data
62 
63  //- Reference to the cloud
64  const cloud& cloud_;
65 
66  //- The name of the carrier phase
67  const word carrierPhaseName_;
68 
69  //- The name of the corresponding Eulerian phase
70  const word phaseName_;
71 
72  //- Carrier fields
73  #define DECLARE_CARRIER_FIELDS(Type, nullArg) \
74  mutable HashPtrTable<CarrierField<Type>> \
75  CAT3(carrier, CAPITALIZE(Type), Fields_);
76  FOR_ALL_FIELD_TYPES(DECLARE_CARRIER_FIELDS);
77  #undef DECLARE_CARRIER_FIELDS
78 
79 
80  // Private Member Functions
81 
82  //- Access the carrier fields. Only specialisations are defined.
83  template<class Type>
84  HashPtrTable<CarrierField<Type>>& carrierFields() const;
85 
86  //- Read the carrier velocity time derivative
87  autoPtr<volVectorField> readDUdtc(const cloud& c) const;
88 
89  //- Access the carrier velocity time derivative
90  const volVectorField& dUdtc() const;
91 
92 
93 protected:
94 
95  // Protected Member Functions
96 
97  //- Clear the carrier fields
98  void clearCarrierFields();
99 
100  //- Reset the carrier fields
101  void resetCarrierFields(const bool initial);
102 
103 
104 public:
105 
106  // Public Static Data
107 
108  //- Run-time type information
109  TypeName("carried");
110 
111 
112  // Public Data
113 
114  //- Carrier velocity
115  const CarrierField<vector>& Uc;
116 
117  //- Carrier velocity curl
119 
120  //- Carrier velocity time derivative
121  private: mutable autoPtr<volVectorField> dUdtcPtr_; public:
122 
123  //- Carrier advective derivative
125 
126  //- Corresponding Eulerian phase velocity
128 
129 
130  // Constructors
131 
132  //- Construct from a reference to the cloud
133  carried(const cloud& c, const dictionary& dict);
134 
135 
136  //- Destructor
137  virtual ~carried();
138 
139 
140  // Member Functions
141 
142  //- Return the name of the carrier phase
143  const word& carrierPhaseName() const;
144 
145  //- Return the name of the corresponding Eulerian phase
146  const word& phaseName(const bool strict = true) const;
147 
148  //- Return whether this cloud has a corresponding Eulerian phase
149  bool hasPhase() const;
150 
151  //- Convert a name to its disambiguated carrier equivalent name. I.e.,
152  // add a 'c' suffix to the member.
153  static word nameToCarrierName(const word& name);
154 
155  //- Convert a name to its disambiguated carrier equivalent name. I.e.,
156  // add a 'c' suffix to the member.
157  static word nameToCarrierName(const word& name, const word& group);
158 
159  //- Convert a disambiguated carrier name to its equivalent name. I.e.,
160  // remove the 'c' suffix from the member.
161  static word carrierNameToName(const word& namec);
162 
163  //- Construct the name of a field associated with the carrier. I.e.,
164  // add a 'c' suffix and add the carrier phase group
165  const word carrierPhaseFieldName(const word& name);
166 
167  //- Construct the name of a field associated with the carrier. I.e.,
168  // add a 'c' suffix and add the corresponding Eulerian phase group
169  const word phaseFieldName(const word& name);
170 
171 
172  // Fields
173 
174  //- Add/get a carrier field to/from the cache
175  template<class Type>
176  const CarrierField<Type>& carrierField(const VolField<Type>&) const;
177 
178  //- Add/get a carrier field to/from the cache
179  template<class Type, class ... Args>
180  const CarrierField<Type>& carrierField(const Args& ... args) const;
181 
182  //- Generate a carrier field reference using a functor that raises
183  // an error to say that the field is not available
184  template<class Type>
186  (
187  const word& symbolicName,
188  const word& descriptiveName,
189  const bool isPhase
190  ) const;
191 };
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace clouds
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #ifdef NoRepository
201  #include "carriedTemplates.C"
202 #endif
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
#define DECLARE_CARRIER_FIELDS(Type, nullArg)
Carrier fields.
Definition: carried.H:72
A field interpolated from the carrier to the cloud. Uses CloudDerivedField to provide flexible access...
Definition: CarrierField.H:207
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
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 carried by a fluid.
Definition: carried.H:57
carried(const cloud &c, const dictionary &dict)
Construct from a reference to the cloud.
Definition: carried.C:151
void clearCarrierFields()
Clear the carrier fields.
Definition: carried.C:115
void resetCarrierFields(const bool initial)
Reset the carrier fields.
Definition: carried.C:132
const CarrierField< Type > & carrierField(const VolField< Type > &) const
Add/get a carrier field to/from the cache.
const word phaseFieldName(const word &name)
Construct the name of a field associated with the carrier. I.e.,.
const CarrierField< vector > & UcPhase
Corresponding Eulerian phase velocity.
Definition: carried.H:126
const CarrierField< vector > & DUDtc
Carrier advective derivative.
Definition: carried.H:123
static word carrierNameToName(const word &namec)
Convert a disambiguated carrier name to its equivalent name. I.e.,.
Definition: carried.C:307
const word & carrierPhaseName() const
Return the name of the carrier phase.
Definition: carried.C:242
const CarrierField< Type > & noCarrierField(const word &symbolicName, const word &descriptiveName, const bool isPhase) const
Generate a carrier field reference using a functor that raises.
bool hasPhase() const
Return whether this cloud has a corresponding Eulerian phase.
Definition: carried.C:267
static word nameToCarrierName(const word &name)
Convert a name to its disambiguated carrier equivalent name. I.e.,.
Definition: carried.C:273
const word & phaseName(const bool strict=true) const
Return the name of the corresponding Eulerian phase.
Definition: carried.C:248
TypeName("carried")
Run-time type information.
const CarrierField< vector > & Uc
Carrier velocity.
Definition: carried.H:114
virtual ~carried()
Destructor.
Definition: carried.C:236
const CarrierField< vector > & curlUc
Carrier velocity curl.
Definition: carried.H:117
const word carrierPhaseFieldName(const word &name)
Construct the name of a field associated with the carrier. I.e.,.
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
const char *const group
Group name for atomic constants.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
VolField< vector > volVectorField
Definition: volFieldsFwd.H:63
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict
Foam::argList args(argc, argv)