fvcFluxTemplates.C
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) 2011-2023 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 \*---------------------------------------------------------------------------*/
25 
26 #include "fvcFlux.H"
27 #include "surfaceInterpolate.H"
28 #include "convectionScheme.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace fvc
38 {
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 template<class Type>
44 (
45  const VolField<Type>& vf
46 )
47 {
48  return scheme<Type>
49  (
50  vf.mesh(),
51  "flux(" + vf.name() + ')'
52  )().dotInterpolate(vf.mesh().Sf(), vf);
53 }
54 
55 
56 template<class Type>
58 (
59  const tmp<VolField<Type>>& tvf
60 )
61 {
63  (
64  fvc::flux(tvf())
65  );
66  tvf.clear();
67  return Flux;
68 }
69 
70 
71 template<class Type>
74 (
75  const surfaceScalarField& phi,
76  const VolField<Type>& vf,
77  Istream& schemeData
78 )
79 {
81  (
82  vf.mesh(),
83  phi,
84  schemeData
85  )().flux(phi, vf);
86 }
87 
88 
89 template<class Type>
92 (
93  const surfaceScalarField& phi,
94  const VolField<Type>& vf,
95  const word& name
96 )
97 {
98  return fvc::flux(phi, vf, vf.mesh().schemes().div(name));
99 }
100 
101 
102 template<class Type>
105 (
106  const tmp<surfaceScalarField>& tphi,
107  const VolField<Type>& vf,
108  const word& name
109 )
110 {
112  (
113  fvc::flux(tphi(), vf, name)
114  );
115  tphi.clear();
116  return Flux;
117 }
118 
119 
120 template<class Type>
123 (
124  const surfaceScalarField& phi,
125  const tmp<VolField<Type>>& tvf,
126  const word& name
127 )
128 {
130  (
131  fvc::flux(phi, tvf(), name)
132  );
133  tvf.clear();
134  return Flux;
135 }
136 
137 
138 template<class Type>
141 (
142  const tmp<surfaceScalarField>& tphi,
143  const tmp<VolField<Type>>& tvf,
144  const word& name
145 )
146 {
148  (
149  fvc::flux(tphi(), tvf(), name)
150  );
151  tphi.clear();
152  tvf.clear();
153  return Flux;
154 }
155 
156 
157 template<class Type>
160 (
161  const surfaceScalarField& phi,
162  const VolField<Type>& vf
163 )
164 {
165  return fvc::flux
166  (
167  phi, vf, "flux("+phi.name()+','+vf.name()+')'
168  );
169 }
170 
171 
172 template<class Type>
175 (
176  const tmp<surfaceScalarField>& tphi,
177  const VolField<Type>& vf
178 )
179 {
181  (
182  fvc::flux(tphi(), vf)
183  );
184  tphi.clear();
185  return Flux;
186 }
187 
188 
189 template<class Type>
192 (
193  const surfaceScalarField& phi,
194  const tmp<VolField<Type>>& tvf
195 )
196 {
198  (
199  fvc::flux(phi, tvf())
200  );
201  tvf.clear();
202  return Flux;
203 }
204 
205 
206 template<class Type>
209 (
210  const tmp<surfaceScalarField>& tphi,
211  const tmp<VolField<Type>>& tvf
212 )
213 {
215  (
216  fvc::flux(tphi(), tvf())
217  );
218  tphi.clear();
219  tvf.clear();
220  return Flux;
221 }
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace fvc
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // ************************************************************************* //
const Mesh & mesh() const
Return mesh.
Function objects which generate the number, volume or mass flux of particles in a cloud.
Definition: Flux.H:65
Generic GeometricField class.
const word & name() const
Return name.
Definition: IOobject.H:310
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
static tmp< convectionScheme< Type > > New(const fvMesh &mesh, const surfaceScalarField &faceFlux, Istream &schemeData)
Return a pointer to a new convectionScheme created on freestore.
A class for managing temporary objects.
Definition: tmp.H:55
void clear() const
If object pointer points to valid object:
Definition: tmpI.H:237
A class for handling words, derived from string.
Definition: word.H:62
Calculate the face-flux of the given field.
tmp< SurfaceField< typename innerProduct< vector, Type >::type > > flux(const VolField< Type > &vf)
Return the face-flux field obtained from the given volVectorField.
static tmp< SurfaceField< typename innerProduct< vector, Type >::type > > dotInterpolate(const surfaceVectorField &Sf, const VolField< Type > &tvf)
Interpolate field onto faces.
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39