fvcSurfaceOps.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2024 M.Janssens
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 InNamespace
27  Foam::fvc
28 
29 Description
30  Surface integrate surfaceField creating a volField.
31  Surface sum a surfaceField creating a volField.
32 
33 SourceFiles
34  fvcSurfaceOps.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 
39 #ifndef fvcSurfaceOps_H
40 #define fvcSurfaceOps_H
41 
42 #include "primitiveFieldsFwd.H"
43 #include "volFieldsFwd.H"
44 #include "surfaceFieldsFwd.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 //- In-place operations on Fields. Add to FieldFunctions.C ?
52 #define INPLACE_PRODUCT_OPERATOR(product, CombineOp, Op, OpFunc) \
53  \
54 template<class Type1, class Type2> \
55 void OpFunc \
56 ( \
57  Field<typename product<Type1, Type2>::type>& result, \
58  const UList<Type1>& f1, \
59  const UList<Type2>& f2 \
60 ) \
61 { \
62  typedef typename product<Type1, Type2>::type resultType; \
63  TFOR_ALL_F_OP_F_OP_F \
64  (resultType, result, CombineOp, Type1, f1, Op, Type2, f2) \
65 }
66 
67 
70 
71 #undef INPLACE_PRODUCT_OPERATOR
72 
73 
74 
75 /*---------------------------------------------------------------------------*\
76  Namespace fvc functions Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 namespace fvc
80 {
81  // Interpolation
82 
83  //- Interpolate to face (using cop) and additional face field
84  template<class Type, class FType, class ResultType, class CellToFaceOp>
85  void interpolate
86  (
87  const surfaceScalarField& lambdas,
90  const CellToFaceOp& cop,
92  );
93 
94  //- Interpolate to face (using cop)
95  template
96  <
97  class Type0,
98  class Type1,
99  class ResultType,
100  class CellToFaceOp
101  >
102  void interpolate
103  (
104  const surfaceScalarField& weights,
107  const CellToFaceOp& cop,
109  );
110 
111 
112  // Interpolation and accumulation
113 
114  //- Interpolate to face (using cop) and accumulate.
115  template<class Type, class ResultType, class CellToFaceOp>
116  void surfaceSum
117  (
118  const surfaceScalarField& lambdas,
120  const CellToFaceOp& cop,
122  const bool doCorrectBoundaryConditions = true
123  );
124 
125  //- Interpolate to face (using cop) and accumulate. Additional
126  //- face field
127  template<class Type, class FType, class ResultType, class CellToFaceOp>
128  void surfaceSum
129  (
130  const surfaceScalarField& lambdas,
133  const CellToFaceOp& cop,
135  const bool doCorrectBoundaryConditions = true
136  );
137 
138  //- Interpolate to face (using cop) and accumulate. Additional
139  //- face fields
140  template
141  <
142  class Type,
143  class FType0,
144  class FType1,
145  class ResultType,
146  class CellToFaceOp
147  >
148  void surfaceSum
149  (
150  const surfaceScalarField& lambdas,
152 
155 
156  const CellToFaceOp& cop,
157 
159  const bool doCorrectBoundaryConditions = true
160  );
161 
162  //- Interpolate to face (using cop) and apply Gauss. Note: uses V(),
163  // not Vsc()
164  template<class Type, class ResultType, class CellToFaceOp>
165  void GaussOp
166  (
167  const surfaceScalarField& lambdas,
169  const CellToFaceOp& cop,
171  );
172 
173 
174  // Difference and accumulation
175 
176  //- sum of snGrad
177  template<class Type, class ResultType, class CellToFaceOp>
178  void surfaceSnSum
179  (
180  const surfaceScalarField& deltaCoeffs,
182 
183  const CellToFaceOp& cop,
184 
186  const bool doCorrectBoundaryConditions
187  );
188  //- sum of snGrad with additional surface field
189  template<class Type, class ResultType, class CellToFaceOp>
190  void surfaceSnSum
191  (
192  const surfaceScalarField& deltaCoeffs,
195 
196  const CellToFaceOp& cop,
197 
199  const bool doCorrectBoundaryConditions
200  );
201 
202  //- sum of snGrad with additional (interpolated) volField
203  template<class Type, class GType, class ResultType, class CellToFaceOp>
204  void surfaceSnSum
205  (
206  const surfaceScalarField& gammaWeights,
208 
209  const surfaceScalarField& deltaCoeffs,
211 
212  const CellToFaceOp& cop,
213 
215  const bool doCorrectBoundaryConditions
216  );
217 
218  //- sum of snGrad with additional (interpolated) volfields
219  template
220  <
221  class Type,
222  class GType0,
223  class GType1,
224  class ResultType,
225  class CellToFaceOp
226  >
227  void surfaceSnSum
228  (
229  const surfaceScalarField& weights,
230 
233 
234  const surfaceScalarField& deltaCoeffs,
236 
237  const CellToFaceOp& cop,
238 
240  const bool doCorrectBoundaryConditions
241  );
242 
243  //- sum of snGrad with additional surface field
244  template<class Type, class GType, class ResultType, class CellToFaceOp>
245  void surfaceSnSum
246  (
247  const surfaceScalarField& gammaWeights,
249 
250  const surfaceScalarField& deltaCoeffs,
252 
254 
255  const CellToFaceOp& cop,
256 
258  const bool doCorrectBoundaryConditions
259  );
260 
261 
262  // Other
263 
264  //- Interpolate to face (using cop) and apply distribution vectors
265  template<class Type, class ResultType, class CellToFaceOp>
266  void surfaceOp
267  (
269  const surfaceVectorField& ownLs,
270  const surfaceVectorField& neiLs,
271  const CellToFaceOp& cop,
273  );
274 }
275 
276 
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
278 
279 } // End namespace Foam
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 #ifdef NoRepository
284  #include "fvcSurfaceOps.C"
285 #endif
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 #endif
290 
291 // ************************************************************************* //
#define INPLACE_PRODUCT_OPERATOR(product, CombineOp, Op, OpFunc)
In-place operations on Fields. Add to FieldFunctions.C ?
Definition: fvcSurfaceOps.H:50
Forwards and collection of common volume field types.
static void doCorrectBoundaryConditions(bool correctBCs, VolumeField< Type > &field)
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
void surfaceOp(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceVectorField &ownLs, const surfaceVectorField &neiLs, const CombineOp &cop, GeometricField< ResultType, fvPatchField, volMesh > &result)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
void surfaceSnSum(const surfaceScalarField &deltaCoeffs, const GeometricField< Type, fvPatchField, volMesh > &vf, const CellToFaceOp &cop, GeometricField< ResultType, fvPatchField, volMesh > &result, const bool doCorrectBoundaryConditions)
sum of snGrad
void multiplySubtract(Field< typename outerProduct< Type1, Type2 >::type > &result, const UList< Type1 > &f1, const UList< Type2 > &f2)
Definition: fvcSurfaceOps.H:67
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
const scalar gamma
Definition: EEqn.H:9
void multiplyAdd(Field< typename outerProduct< Type1, Type2 >::type > &result, const UList< Type1 > &f1, const UList< Type2 > &f2)
Definition: fvcSurfaceOps.H:66
void GaussOp(const surfaceScalarField &lambdas, const GeometricField< Type, fvPatchField, volMesh > &vf, const CombineOp &cop, GeometricField< ResultType, fvPatchField, volMesh > &result)
Namespace for OpenFOAM.