fvcLaplacian.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 "fvcLaplacian.H"
27 #include "fvMesh.H"
28 #include "laplacianScheme.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace fvc
38 {
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 template<class Type>
43 tmp<VolField<Type>>
45 (
46  const VolField<Type>& vf,
47  const word& name
48 )
49 {
51  (
52  vf.mesh(),
53  vf.mesh().schemes().laplacian(name)
54  ).ref().fvcLaplacian(vf);
55 }
56 
57 
58 template<class Type>
61 (
62  const tmp<VolField<Type>>& tvf,
63  const word& name
64 )
65 {
66  tmp<VolField<Type>> Laplacian
67  (
68  fvc::laplacian(tvf(), name)
69  );
70  tvf.clear();
71  return Laplacian;
72 }
73 
74 
75 template<class Type>
78 (
79  const VolField<Type>& vf
80 )
81 {
82  return fvc::laplacian(vf, "laplacian(" + vf.name() + ')');
83 }
84 
85 
86 template<class Type>
89 (
90  const tmp<VolField<Type>>& tvf
91 )
92 {
93  tmp<VolField<Type>> Laplacian
94  (
95  fvc::laplacian(tvf())
96  );
97  tvf.clear();
98  return Laplacian;
99 }
100 
101 
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 
104 template<class Type, class GType>
107 (
108  const dimensioned<GType>& gamma,
109  const VolField<Type>& vf,
110  const word& name
111 )
112 {
113  SurfaceField<GType> Gamma
114  (
115  IOobject
116  (
117  gamma.name(),
118  vf.instance(),
119  vf.mesh(),
121  ),
122  vf.mesh(),
123  gamma
124  );
125 
126  return fvc::laplacian(Gamma, vf, name);
127 }
128 
129 
130 template<class Type, class GType>
133 (
134  const dimensioned<GType>& gamma,
135  const tmp<VolField<Type>>& tvf,
136  const word& name
137 )
138 {
139  tmp<VolField<Type>> Laplacian
140  (
141  fvc::laplacian(gamma, tvf(), name)
142  );
143  tvf.clear();
144  return Laplacian;
145 }
146 
147 
148 template<class Type, class GType>
151 (
152  const dimensioned<GType>& gamma,
153  const VolField<Type>& vf
154 )
155 {
156  SurfaceField<GType> Gamma
157  (
158  IOobject
159  (
160  gamma.name(),
161  vf.instance(),
162  vf.mesh(),
164  ),
165  vf.mesh(),
166  gamma
167  );
168 
169  return fvc::laplacian(Gamma, vf);
170 }
171 
172 
173 template<class Type, class GType>
176 (
177  const dimensioned<GType>& gamma,
178  const tmp<VolField<Type>>& tvf
179 )
180 {
181  tmp<VolField<Type>> Laplacian
182  (
183  fvc::laplacian(gamma, tvf())
184  );
185  tvf.clear();
186  return Laplacian;
187 }
188 
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 template<class Type, class GType>
195 (
196  const VolField<GType>& gamma,
197  const VolField<Type>& vf,
198  const word& name
199 )
200 {
202  (
203  vf.mesh(),
204  vf.mesh().schemes().laplacian(name)
205  ).ref().fvcLaplacian(gamma, vf);
206 }
207 
208 
209 template<class Type, class GType>
212 (
213  const tmp<VolField<GType>>& tgamma,
214  const VolField<Type>& vf,
215  const word& name
216 )
217 {
218  tmp<VolField<Type>> Laplacian
219  (
220  fvc::laplacian(tgamma(), vf, name)
221  );
222  tgamma.clear();
223  return Laplacian;
224 }
225 
226 
227 template<class Type, class GType>
230 (
231  const VolField<GType>& gamma,
232  const tmp<VolField<Type>>& tvf,
233  const word& name
234 )
235 {
236  tmp<VolField<Type>> Laplacian
237  (
238  fvc::laplacian(gamma, tvf(), name)
239  );
240  tvf.clear();
241  return Laplacian;
242 }
243 
244 
245 template<class Type, class GType>
248 (
249  const tmp<VolField<GType>>& tgamma,
250  const tmp<VolField<Type>>& tvf,
251  const word& name
252 )
253 {
254  tmp<VolField<Type>> Laplacian
255  (
256  fvc::laplacian(tgamma(), tvf(), name)
257  );
258  tgamma.clear();
259  tvf.clear();
260  return Laplacian;
261 }
262 
263 
264 template<class Type, class GType>
267 (
268  const VolField<GType>& gamma,
269  const VolField<Type>& vf
270 )
271 {
272  return fvc::laplacian
273  (
274  gamma,
275  vf,
276  "laplacian(" + gamma.name() + ',' + vf.name() + ')'
277  );
278 }
279 
280 
281 template<class Type, class GType>
284 (
285  const tmp<VolField<GType>>& tgamma,
286  const VolField<Type>& vf
287 )
288 {
289  return fvc::laplacian
290  (
291  tgamma,
292  vf,
293  "laplacian(" + tgamma().name() + ',' + vf.name() + ')'
294  );
295 }
296 
297 
298 template<class Type, class GType>
301 (
302  const VolField<GType>& gamma,
303  const tmp<VolField<Type>>& tvf
304 )
305 {
306  return fvc::laplacian
307  (
308  gamma,
309  tvf,
310  "laplacian(" + gamma.name() + ',' + tvf().name() + ')'
311  );
312 }
313 
314 
315 template<class Type, class GType>
318 (
319  const tmp<VolField<GType>>& tgamma,
320  const tmp<VolField<Type>>& tvf
321 )
322 {
323  return fvc::laplacian
324  (
325  tgamma,
326  tvf,
327  "laplacian(" + tgamma().name() + ',' + tvf().name() + ')'
328  );
329 }
330 
331 
332 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
333 
334 template<class Type, class GType>
337 (
338  const SurfaceField<GType>& gamma,
339  const VolField<Type>& vf,
340  const word& name
341 )
342 {
344  (
345  vf.mesh(),
346  vf.mesh().schemes().laplacian(name)
347  ).ref().fvcLaplacian(gamma, vf);
348 }
349 
350 
351 template<class Type, class GType>
354 (
355  const tmp<SurfaceField<GType>>& tgamma,
356  const VolField<Type>& vf,
357  const word& name
358 )
359 {
360  tmp<VolField<Type>> Laplacian
361  (
362  fvc::laplacian(tgamma(), vf, name)
363  );
364  tgamma.clear();
365  return Laplacian;
366 }
367 
368 
369 template<class Type, class GType>
372 (
373  const SurfaceField<GType>& gamma,
374  const tmp<VolField<Type>>& tvf,
375  const word& name
376 )
377 {
378  tmp<VolField<Type>> Laplacian
379  (
380  fvc::laplacian(gamma, tvf(), name)
381  );
382  tvf.clear();
383  return Laplacian;
384 }
385 
386 
387 template<class Type, class GType>
389 (
390  const tmp<SurfaceField<GType>>& tgamma,
391  const tmp<VolField<Type>>& tvf,
392  const word& name
393 )
394 {
395  tmp<VolField<Type>> Laplacian
396  (
397  fvc::laplacian(tgamma(), tvf(), name)
398  );
399  tgamma.clear();
400  tvf.clear();
401  return Laplacian;
402 }
403 
404 
405 template<class Type, class GType>
408 (
409  const SurfaceField<GType>& gamma,
410  const VolField<Type>& vf
411 )
412 {
413  return fvc::laplacian
414  (
415  gamma,
416  vf,
417  "laplacian(" + gamma.name() + ',' + vf.name() + ')'
418  );
419 }
420 
421 
422 template<class Type, class GType>
425 (
426  const tmp<SurfaceField<GType>>& tgamma,
427  const VolField<Type>& vf
428 )
429 {
430  tmp<VolField<Type>> Laplacian
431  (
432  fvc::laplacian(tgamma(), vf)
433  );
434  tgamma.clear();
435  return Laplacian;
436 }
437 
438 
439 template<class Type, class GType>
442 (
443  const SurfaceField<GType>& gamma,
444  const tmp<VolField<Type>>& tvf
445 )
446 {
447  tmp<VolField<Type>> Laplacian
448  (
449  fvc::laplacian(gamma, tvf())
450  );
451  tvf.clear();
452  return Laplacian;
453 }
454 
455 
456 template<class Type, class GType>
458 (
459  const tmp<SurfaceField<GType>>& tgamma,
460  const tmp<VolField<Type>>& tvf
461 )
462 {
463  tmp<VolField<Type>> Laplacian
464  (
465  fvc::laplacian(tgamma(), tvf())
466  );
467  tgamma.clear();
468  tvf.clear();
469  return Laplacian;
470 }
471 
472 
473 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
474 
475 } // End namespace fvc
476 
477 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
478 
479 } // End namespace Foam
480 
481 // ************************************************************************* //
const Mesh & mesh() const
Return mesh.
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
Definition: IOobject.C:355
const word & name() const
Return name.
Definition: IOobject.H:310
Generic dimensioned Type class.
const word & name() const
Return const reference to name.
static tmp< laplacianScheme< Type, GType > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Calculate the laplacian of the given field.
tmp< VolField< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvcLaplacian.C:45
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39