CarrierField.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::CarrierField
26 
27 Description
28  A field interpolated from the carrier to the cloud. Uses CloudDerivedField
29  to provide flexible access and caching.
30 
31 See also
32  Foam::CloudDerivedField
33 
34 SourceFiles
35  CarrierField.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef CarrierField_H
40 #define CarrierField_H
41 
42 #include "CloudDerivedField.H"
43 #include "interpolation.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class CarrierField Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
55 class CarrierField
56 :
57  public CloudDerivedField<Type>
58 {
59  // Private Classes
60 
61  //- Class to virtualise an evaluation procedure
62  class Functor;
63 
64  //- Class to store an evaluation function
65  template<class F>
66  class Function;
67 
68 
69  // Private Data
70 
71  //- The carrier field name
72  const word name_;
73 
74  //- The function
75  const autoPtr<Functor> functorPtr_;
76 
77  //- Field reference or cache
78  mutable tmp<VolField<Type>> tpsi_;
79 
80  //- Interpolation engine
81  mutable autoPtr<interpolation<Type>> psiInterpolationPtr_;
82 
83  //- Old-time interpolation engine
84  mutable autoPtr<interpolation<Type>> psi0InterpolationPtr_;
85 
86 
87  // Private Member Functions
88 
89  //- Interpolate and return the result
91  (
92  const LagrangianModelRef&,
93  const LagrangianSubMesh& subMesh
94  ) const;
95 
96 
97 public:
98 
99  // Constructors
100 
101  //- Construct from a reference to a carrier field
103 
104  //- Construct from a name and an evaluation function
105  template<class F>
106  CarrierField(const word& name, const F& f);
107 
108 
109  // Member Functions
110 
111  //- Access the carrier field
112  const VolField<Type>& psi() const;
113 
114  //- Carrier field name
115  const word& name() const;
116 
117  //- Reset
118  void reset(const bool predict);
119 };
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 } // End namespace Foam
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 #ifdef NoRepository
128  #include "CarrierField.C"
129 #endif
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
Class to store an evaluation function.
Definition: CarrierField.C:66
A field interpolated from the carrier to the cloud. Uses CloudDerivedField to provide flexible access...
Definition: CarrierField.H:57
const VolField< Type > & psi() const
Access the carrier field.
Definition: CarrierField.C:243
void reset(const bool predict)
Reset.
Definition: CarrierField.C:262
const word & name() const
Carrier field name.
Definition: CarrierField.C:255
CarrierField(const VolField< Type > &)
Construct from a reference to a carrier field.
Definition: CarrierField.C:216
A field derived from other state fields of the cloud. Stores and virtualises a function or a method w...
Generic GeometricField class.
Simple wrapper to provide an optional reference to a Lagrangian model.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
const dimensionedScalar F
Faraday constant: default SI units: [C/mol].
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Namespace for OpenFOAM.
labelList f(nPoints)