famLaplacian.C
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) 2016-2017 Wikki Ltd
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 \*---------------------------------------------------------------------------*/
27 
28 #include "areaFields.H"
29 #include "edgeFields.H"
30 #include "faMatrix.H"
31 #include "faLaplacianScheme.H"
32 #include "edgeInterpolate.H"
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace fam
42 {
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 template<class Type>
47 tmp<faMatrix<Type>>
49 (
51 )
52 {
53  edgeScalarField Gamma
54  (
55  IOobject
56  (
57  "gamma",
58  vf.time().constant(),
59  vf.db(),
61  ),
62  vf.mesh(),
63  dimensionedScalar("1", dimless, 1.0)
64  );
65 
66  return fam::laplacian(Gamma, vf);
67 }
68 
69 
70 template<class Type>
73 (
75  const word& name
76 )
77 {
78  edgeScalarField Gamma
79  (
80  IOobject
81  (
82  "gamma",
83  vf.time().constant(),
84  vf.db(),
86  ),
87  vf.mesh(),
88  dimensionedScalar("1", dimless, 1.0)
89  );
90 
91  return fam::laplacian(Gamma, vf, name);
92 }
93 
94 
95 template<class Type>
98 (
99  const dimensionedScalar& gamma,
101 )
102 {
103  edgeScalarField Gamma
104  (
105  IOobject
106  (
107  gamma.name(),
108  vf.instance(),
109  vf.db(),
111  ),
112  vf.mesh(),
113  gamma
114  );
115 
116  return fam::laplacian(Gamma, vf);
117 }
118 
119 
120 template<class Type>
122 laplacian
123 (
124  const dimensionedScalar& gamma,
126  const word& name
127 )
128 {
129  edgeScalarField Gamma
130  (
131  IOobject
132  (
133  gamma.name(),
134  vf.instance(),
135  vf.db(),
137  ),
138  vf.mesh(),
139  gamma
140  );
141 
142  return fam::laplacian(Gamma, vf, name);
143 }
144 
145 
146 template<class Type>
148 laplacian
149 (
150  const areaScalarField& gamma,
152 )
153 {
154  return fam::laplacian
155  (
156  gamma,
157  vf,
158  "laplacian(" + gamma.name() + ',' + vf.name() + ')'
159  );
160 }
161 
162 
163 template<class Type>
165 laplacian
166 (
167  const areaScalarField& gamma,
169  const word& name
170 )
171 {
173  (
174  vf.mesh(),
175  vf.mesh().laplacianScheme(name)
176  ).ref().famLaplacian(gamma, vf);
177 }
178 
179 
180 template<class Type>
182 laplacian
183 (
184  const tmp<areaScalarField>& tgamma,
186 )
187 {
188  tmp<faMatrix<Type>> Laplacian(fam::laplacian(tgamma(), vf));
189  tgamma.clear();
190  return Laplacian;
191 }
192 
193 
194 template<class Type>
196 laplacian
197 (
198  const tmp<areaScalarField>& tgamma,
200  const word& name
201 )
202 {
203  tmp<faMatrix<Type>> Laplacian(fam::laplacian(tgamma(), vf, name));
204  tgamma.clear();
205  return Laplacian;
206 }
207 
208 
209 template<class Type>
211 laplacian
212 (
213  const edgeScalarField& gamma,
215  const word& name
216 )
217 {
219  (
220  vf.mesh(),
221  vf.mesh().laplacianScheme(name)
222  ).ref().famLaplacian(gamma, vf);
223 }
224 
225 
226 template<class Type>
228 laplacian
229 (
230  const tmp<edgeScalarField>& tgamma,
232  const word& name
233 )
234 {
235  tmp<faMatrix<Type>> tLaplacian = fam::laplacian(tgamma(), vf, name);
236  tgamma.clear();
237  return tLaplacian;
238 }
239 
240 
241 template<class Type>
243 laplacian
244 (
245  const edgeScalarField& gamma,
247 )
248 {
249  return fam::laplacian
250  (
251  gamma,
252  vf,
253  "laplacian(" + gamma.name() + ',' + vf.name() + ')'
254  );
255 }
256 
257 template<class Type>
259 laplacian
260 (
261  const tmp<edgeScalarField>& tgamma,
263 )
264 {
265  tmp<faMatrix<Type>> tfam(fam::laplacian(tgamma(), vf));
266  tgamma.clear();
267  return tfam;
268 }
269 
270 
271 template<class Type>
273 laplacian
274 (
275  const areaTensorField& gamma,
277 )
278 {
279  const faMesh& mesh = vf.mesh();
280 
281  return fam::laplacian
282  (
283  (mesh.Le() & fac::interpolate(gamma) & mesh.Le())
284  /sqr(mesh.magLe()),
285  vf
286  );
287 }
288 
289 template<class Type>
290 tmp<faMatrix<Type>>
291 laplacian
292 (
293  const tmp<areaTensorField>& tgamma,
294  const GeometricField<Type, faPatchField, areaMesh>& vf
295 )
296 {
297  tmp<faMatrix<Type>> Laplacian = fam::laplacian(tgamma(), vf);
298  tgamma.clear();
299  return Laplacian;
300 }
301 
302 
303 template<class Type>
304 tmp<faMatrix<Type>>
305 laplacian
306 (
307  const edgeTensorField& gamma,
308  const GeometricField<Type, faPatchField, areaMesh>& vf
309 )
310 {
311  const faMesh& mesh = vf.mesh();
312 
313  return fam::laplacian
314  (
315  (mesh.Le() & gamma & mesh.Le())/sqr(mesh.magLe()),
316  vf
317  );
318 }
319 
320 template<class Type>
321 tmp<faMatrix<Type>>
322 laplacian
323 (
324  const tmp<edgeTensorField>& tgamma,
325  const GeometricField<Type, faPatchField, areaMesh>& vf
326 )
327 {
328  tmp<faMatrix<Type>> Laplacian = fam::laplacian(tgamma(), vf);
329  tgamma.clear();
330  return Laplacian;
331 }
332 
333 
334 template<class Type>
335 tmp<faMatrix<Type>>
336 laplacian
337 (
338  const edgeTensorField& gamma,
339  const GeometricField<Type, faPatchField, areaMesh>& vf,
340  const word& name
341 )
342 {
343  const faMesh& mesh = vf.mesh();
344 
345  return fam::laplacian
346  (
347  (mesh.Le() & gamma & mesh.Le())/sqr(mesh.magLe()),
348  vf,
349  name
350  );
351 }
352 
353 template<class Type>
354 tmp<faMatrix<Type>>
355 laplacian
356 (
357  const tmp<edgeTensorField>& tgamma,
358  const GeometricField<Type, faPatchField, areaMesh>& vf,
359  const word& name
360 )
361 {
362  tmp<faMatrix<Type>> Laplacian = fam::laplacian(tgamma(), vf, name);
363  tgamma.clear();
364  return Laplacian;
365 }
366 
367 
368 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
369 
370 } // End namespace fam
371 
372 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
373 
374 } // End namespace Foam
375 
376 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp::clear
void clear() const noexcept
Definition: tmpI.H:287
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fam::laplacian
tmp< faMatrix< Type > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf)
Definition: famLaplacian.C:49
edgeInterpolate.H
ref
rDeltaT ref()
Foam::fa::laplacianScheme::New
static tmp< laplacianScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
Definition: faLaplacianScheme.C:47
edgeFields.H
Foam::edgeTensorField
GeometricField< tensor, faePatchField, edgeMesh > edgeTensorField
Definition: edgeFieldsFwd.H:61
faMatrix.H
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
faLaplacianScheme.H
areaFields.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
gamma
const scalar gamma
Definition: EEqn.H:9
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
fam
Calculate the matrix for the second temporal derivative.
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::fac::interpolate
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189