fvmLaplacian.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-2022 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 "volFields.H"
27 #include "surfaceFields.H"
28 #include "fvMatrix.H"
29 #include "laplacianScheme.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 namespace fvm
39 {
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 template<class Type>
44 tmp<fvMatrix<Type>>
46 (
48  const word& name
49 )
50 {
51  surfaceScalarField Gamma
52  (
53  IOobject
54  (
55  "1",
56  vf.time().constant(),
57  vf.mesh(),
59  ),
60  vf.mesh(),
62  );
63 
64  return fvm::laplacian(Gamma, vf, name);
65 }
66 
67 
68 template<class Type>
71 (
73 )
74 {
75  surfaceScalarField Gamma
76  (
77  IOobject
78  (
79  "1",
80  vf.time().constant(),
81  vf.mesh(),
83  ),
84  vf.mesh(),
86  );
87 
88  return fvm::laplacian
89  (
90  Gamma,
91  vf,
92  "laplacian(" + vf.name() + ')'
93  );
94 }
95 
96 
97 template<class Type>
100 (
101  const zero&,
103  const word& name
104 )
105 {
106  return tmp<fvMatrix<Type>>
107  (
108  new fvMatrix<Type>(vf, dimensionSet(0, 0, -2, 0, 0))
109  );
110 }
111 
112 
113 template<class Type>
115 laplacian
116 (
117  const zero&,
119 )
120 {
121  return tmp<fvMatrix<Type>>
122  (
123  new fvMatrix<Type>(vf, dimensionSet(0, 0, -2, 0, 0))
124  );
125 }
126 
127 
128 template<class Type>
130 laplacian
131 (
132  const one&,
134  const word& name
135 )
136 {
137  return fvm::laplacian(vf, name);
138 }
139 
140 
141 template<class Type>
143 laplacian
144 (
145  const one&,
147 )
148 {
149  return fvm::laplacian(vf);
150 }
151 
152 
153 template<class Type, class GType>
155 laplacian
156 (
157  const dimensioned<GType>& gamma,
159  const word& name
160 )
161 {
163  (
164  IOobject
165  (
166  gamma.name(),
167  vf.instance(),
168  vf.mesh(),
170  ),
171  vf.mesh(),
172  gamma
173  );
174 
175  return fvm::laplacian(Gamma, vf, name);
176 }
177 
178 
179 template<class Type, class GType>
181 laplacian
182 (
183  const dimensioned<GType>& gamma,
185 )
186 {
188  (
189  IOobject
190  (
191  gamma.name(),
192  vf.instance(),
193  vf.mesh(),
195  ),
196  vf.mesh(),
197  gamma
198  );
199 
200  return fvm::laplacian(Gamma, vf);
201 }
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 template<class Type, class GType>
208 laplacian
209 (
212  const word& name
213 )
214 {
216  (
217  vf.mesh(),
218  vf.mesh().schemes().laplacian(name)
219  ).ref().fvmLaplacian(gamma, vf);
220 }
221 
222 
223 template<class Type, class GType>
225 laplacian
226 (
229  const word& name
230 )
231 {
232  tmp<fvMatrix<Type>> Laplacian(fvm::laplacian(tgamma(), vf, name));
233  tgamma.clear();
234  return Laplacian;
235 }
236 
237 
238 template<class Type, class GType>
240 laplacian
241 (
244 )
245 {
246  return fvm::laplacian
247  (
248  gamma,
249  vf,
250  "laplacian(" + gamma.name() + ',' + vf.name() + ')'
251  );
252 }
253 
254 
255 template<class Type, class GType>
257 laplacian
258 (
261 )
262 {
263  tmp<fvMatrix<Type>> Laplacian(fvm::laplacian(tgamma(), vf));
264  tgamma.clear();
265  return Laplacian;
266 }
267 
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 template<class Type, class GType>
273 laplacian
274 (
277  const word& name
278 )
279 {
281  (
282  vf.mesh(),
283  vf.mesh().schemes().laplacian(name)
284  ).ref().fvmLaplacian(gamma, vf);
285 }
286 
287 
288 template<class Type, class GType>
290 laplacian
291 (
294  const word& name
295 )
296 {
297  tmp<fvMatrix<Type>> tLaplacian = fvm::laplacian(tgamma(), vf, name);
298  tgamma.clear();
299  return tLaplacian;
300 }
301 
302 
303 template<class Type, class GType>
305 laplacian
306 (
309 )
310 {
311  return fvm::laplacian
312  (
313  gamma,
314  vf,
315  "laplacian(" + gamma.name() + ',' + vf.name() + ')'
316  );
317 }
318 
319 
320 template<class Type, class GType>
322 laplacian
323 (
326 )
327 {
328  tmp<fvMatrix<Type>> tfvm(fvm::laplacian(tGamma(), vf));
329  tGamma.clear();
330  return tfvm;
331 }
332 
333 
334 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
335 
336 } // End namespace fvm
337 
338 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
339 
340 } // End namespace Foam
341 
342 // ************************************************************************* //
Foam::surfaceFields.
const word & name() const
Return name.
Definition: IOobject.H:315
Generic GeometricField class.
const dimensionSet dimless
Generic dimensioned Type class.
Dimension set for the base types.
Definition: dimensionSet.H:121
A class for handling words, derived from string.
Definition: word.H:59
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
const Mesh & mesh() const
Return mesh.
const word & name() const
Return const reference to name.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const Time & time() const
Return time.
Definition: IOobject.C:318
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:46
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
Definition: IOobject.C:355
A class for managing temporary objects.
Definition: PtrList.H:53
rDeltaT ref()
static tmp< laplacianScheme< Type, GType > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
Namespace for OpenFOAM.
A class representing the concept of 1 (scalar(1)) used to avoid unnecessary manipulations for objects...
Definition: one.H:50