LagrangianDdtScheme.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 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::ddtScheme
26 
27 Description
28  Abstract base class for Lagrangian ddt schemes
29 
30 SourceFiles
31  LagrangianDdtScheme.C
32  LagrangianDdtSchemes.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef LagrangianDdtScheme_H
37 #define LagrangianDdtScheme_H
38 
39 #include "tmp.H"
40 #include "dimensionedType.H"
41 #include "LagrangianFieldsFwd.H"
42 #include "LagrangianSubFieldsFwd.H"
43 #include "runTimeSelectionTables.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 class LagrangianMesh;
51 
52 template<class Type>
53 class LagrangianEqn;
54 
55 namespace Lagrangian
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class ddtScheme Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class Type>
63 class ddtScheme
64 :
65  public tmp<ddtScheme<Type>>::refCount
66 {
67 protected:
68 
69  // Protected Data
70 
71  //- Reference to the mesh
72  const LagrangianMesh& mesh_;
73 
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("ddtScheme");
79 
80 
81  //- Declare run-time constructor selection tables
83  (
84  tmp,
85  ddtScheme,
86  Istream,
87  (const LagrangianMesh& mesh, Istream& is),
88  (mesh, is)
89  );
90 
91 
92  // Constructors
93 
94  //- Construct from a mesh
96  :
97  mesh_(mesh)
98  {}
99 
100  //- Construct from a mesh and a stream
102  :
103  mesh_(mesh)
104  {}
105 
106  //- Disallow default bitwise copy construction
107  ddtScheme(const ddtScheme&) = delete;
108 
109 
110  // Selectors
111 
112  //- Return a pointer to a new ddtScheme
113  static tmp<ddtScheme<Type>> New
114  (
115  const LagrangianMesh& mesh,
116  Istream& is
117  );
118 
119 
120  //- Destructor
121  virtual ~ddtScheme();
122 
123 
124  // Member Functions
125 
126  //- Return mesh reference
127  const LagrangianMesh& mesh() const
128  {
129  return mesh_;
130  }
131 
132  //- Initialise time-derivative information. Registers fields used to
133  // construct for higher-order schemes and to evaluate instantaneous
134  // time derivatives.
135  virtual bool LagrangianmInitDdt
136  (
137  const dimensionSet& mDims,
139  const bool instantaneousDdt
140  ) = 0;
141 
142  //- Return the no-time-derivative matrix containing higher-order
143  // modifications to source terms
145  (
146  const LagrangianSubScalarField& deltaT,
147  const dimensionSet& mDims,
149  ) = 0;
150 
151  //- Return the time-derivative matrix
153  (
154  const LagrangianSubScalarField& deltaT,
156  ) = 0;
157 
158  //- Return the time-derivative matrix
160  (
161  const LagrangianSubScalarField& deltaT,
164  ) = 0;
165 
166  //- Return the instantaneous time-derivative
168  (
170  ) = 0;
171 
172  //- Return the instantaneous time-derivative
174  (
177  ) = 0;
178 
179  //- Return a Euler implicit time derivative matrix
181  (
183  );
184 
185  //- Return a Euler implicit time derivative matrix
187  (
190  );
191 
192  //- Return a Euler explicit/forward time-derivative matrix
194  (
196  );
197 
198  //- Return a Euler explicit/forward time-derivative matrix
200  (
203  );
204 
205  //- Return the Euler explicit/forward time-derivative multiplied by the
206  // time-step
208  (
210  );
211 
212  //- Return the Euler explicit/forward time-derivative multiplied by the
213  // time-step
215  (
218  );
219 
220 
221  // Member Operators
222 
223  //- Disallow default bitwise assignment
224  void operator=(const ddtScheme&) = delete;
225 };
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Lagrangian
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #define defineLagrangianDdtScheme(Type, nullArg) \
236  \
237  namespace Foam \
238  { \
239  namespace Lagrangian \
240  { \
241  typedef ddtScheme<Type> Type##DdtScheme; \
242  \
243  defineNamedTemplateTypeNameAndDebug(Type##DdtScheme, 0); \
244  \
245  defineTemplateRunTimeSelectionTable(Type##DdtScheme, Istream); \
246  } \
247  }
248 
249 
250 #define makeLagrangianDdtScheme(Type, DdtSchemeType) \
251  \
252  namespace Foam \
253  { \
254  namespace Lagrangian \
255  { \
256  typedef ddtScheme<Type> Type##DdtScheme; \
257  \
258  namespace ddtSchemes \
259  { \
260  typedef DdtSchemeType<Type> Type##DdtSchemeType; \
261  \
262  defineNamedTemplateTypeNameAndDebug(Type##DdtSchemeType, 0); \
263  \
264  addToRunTimeSelectionTable \
265  ( \
266  Type##DdtScheme, \
267  Type##DdtSchemeType, \
268  Istream \
269  ); \
270  } \
271  } \
272  }
273 
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 #ifdef NoRepository
278  #include "LagrangianDdtScheme.C"
279 #endif
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 #endif
284 
285 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
Class containing Lagrangian geometry and topology.
Abstract base class for Lagrangian ddt schemes.
virtual tmp< LagrangianEqn< Type > > LagrangianmNoDdt(const LagrangianSubScalarField &deltaT, const dimensionSet &mDims, const LagrangianSubSubField< Type > &psi)=0
Return the no-time-derivative matrix containing higher-order.
virtual ~ddtScheme()
Destructor.
static tmp< ddtScheme< Type > > New(const LagrangianMesh &mesh, Istream &is)
Return a pointer to a new ddtScheme.
static tmp< LagrangianEqn< Type > > Lagrangianmddt(const LagrangianSubSubField< Type > &psi)
Return a Euler implicit time derivative matrix.
ddtScheme(const LagrangianMesh &mesh)
Construct from a mesh.
declareRunTimeSelectionTable(tmp, ddtScheme, Istream,(const LagrangianMesh &mesh, Istream &is),(mesh, is))
Declare run-time constructor selection tables.
static tmp< LagrangianSubField< Type > > LagrangiancdeltaTddt0(const LagrangianSubSubField< Type > &psi)
Return the Euler explicit/forward time-derivative multiplied by the.
virtual tmp< LagrangianEqn< Type > > LagrangianmDdt(const LagrangianSubScalarField &deltaT, LagrangianSubSubField< Type > &psi)=0
Return the time-derivative matrix.
static tmp< LagrangianEqn< Type > > Lagrangianmddt0(const LagrangianSubSubField< Type > &psi)
Return a Euler explicit/forward time-derivative matrix.
void operator=(const ddtScheme &)=delete
Disallow default bitwise assignment.
virtual bool LagrangianmInitDdt(const dimensionSet &mDims, const LagrangianSubSubField< Type > &psi, const bool instantaneousDdt)=0
Initialise time-derivative information. Registers fields used to.
virtual tmp< LagrangianSubField< Type > > LagrangiancDdt(const LagrangianSubSubField< Type > &psi)=0
Return the instantaneous time-derivative.
const LagrangianMesh & mesh_
Reference to the mesh.
TypeName("ddtScheme")
Runtime type information.
const LagrangianMesh & mesh() const
Return mesh reference.
Dimension set for the base types.
Definition: dimensionSet.H:125
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
A class for managing temporary objects.
Definition: tmp.H:55
const volScalarField & psi
Namespace for OpenFOAM.
Macros to ease declaration of run-time selection tables.