Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
36namespace Foam
37{
38
39// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40
41namespace fam
42{
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46template<class Type>
49(
51)
52{
53 edgeScalarField Gamma
54 (
56 (
57 "gamma",
58 vf.time().constant(),
59 vf.db(),
61 ),
62 vf.mesh(),
63 dimensionedScalar("1", dimless, 1.0)
64 );
66 return fam::laplacian(Gamma, vf);
67}
68
69
70template<class Type>
73(
75 const word& name
76)
77{
78 edgeScalarField Gamma
79 (
81 (
82 "gamma",
83 vf.time().constant(),
84 vf.db(),
86 ),
87 vf.mesh(),
88 dimensionedScalar("1", dimless, 1.0)
89 );
91 return fam::laplacian(Gamma, vf, name);
92}
93
94
95template<class Type>
98(
101)
102{
103 edgeScalarField Gamma
104 (
106 (
107 gamma.name(),
108 vf.instance(),
109 vf.db(),
111 ),
112 vf.mesh(),
113 gamma
114 );
116 return fam::laplacian(Gamma, vf);
117}
118
119
120template<class Type>
123(
126 const word& name
127)
128{
129 edgeScalarField Gamma
130 (
132 (
133 gamma.name(),
134 vf.instance(),
135 vf.db(),
137 ),
138 vf.mesh(),
139 gamma
140 );
142 return fam::laplacian(Gamma, vf, name);
143}
144
145
146template<class Type>
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
163template<class Type>
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
180template<class Type>
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
194template<class Type>
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
209template<class Type>
210tmp<faMatrix<Type>>
212(
213 const edgeScalarField& gamma,
214 const GeometricField<Type, faPatchField, areaMesh>& vf,
215 const word& name
216)
217{
219 (
220 vf.mesh(),
221 vf.mesh().laplacianScheme(name)
222 ).ref().famLaplacian(gamma, vf);
223}
224
225
226template<class Type>
227tmp<faMatrix<Type>>
229(
230 const tmp<edgeScalarField>& tgamma,
231 const GeometricField<Type, faPatchField, areaMesh>& vf,
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
241template<class Type>
242tmp<faMatrix<Type>>
244(
245 const edgeScalarField& gamma,
246 const GeometricField<Type, faPatchField, areaMesh>& vf
247)
248{
249 return fam::laplacian
250 (
251 gamma,
252 vf,
253 "laplacian(" + gamma.name() + ',' + vf.name() + ')'
254 );
255}
256
257template<class Type>
258tmp<faMatrix<Type>>
260(
261 const tmp<edgeScalarField>& tgamma,
262 const GeometricField<Type, faPatchField, areaMesh>& vf
263)
264{
265 tmp<faMatrix<Type>> tfam(fam::laplacian(tgamma(), vf));
266 tgamma.clear();
267 return tfam;
268}
269
270
271template<class Type>
272tmp<faMatrix<Type>>
274(
275 const areaTensorField& gamma,
276 const GeometricField<Type, faPatchField, areaMesh>& vf
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
289template<class Type>
290tmp<faMatrix<Type>>
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
303template<class Type>
304tmp<faMatrix<Type>>
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
320template<class Type>
321tmp<faMatrix<Type>>
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
334template<class Type>
335tmp<faMatrix<Type>>
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
353template<class Type>
354tmp<faMatrix<Type>>
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// ************************************************************************* //
const Mesh & mesh() const noexcept
Return const reference to mesh.
Generic GeometricField class.
@ NO_READ
Nothing to be read.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Definition IOobject.C:456
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition IOobject.C:450
const fileName & instance() const noexcept
Read access to instance path component.
Definition IOobjectI.H:289
const word & constant() const noexcept
Return constant name.
Definition TimePathsI.H:131
static tmp< laplacianScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
A class for managing temporary objects.
Definition tmp.H:75
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
Definition tmpI.H:289
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
A class for handling words, derived from Foam::string.
Definition word.H:66
const scalar gamma
Definition EEqn.H:9
dynamicFvMesh & mesh
auto & name
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.
tmp< faMatrix< Type > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf)
Namespace for OpenFOAM.
const dimensionSet dimless
Dimensionless.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
GeometricField< tensor, faPatchField, areaMesh > areaTensorField
GeometricField< scalar, faePatchField, edgeMesh > edgeScalarField
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
GeometricField< tensor, faePatchField, edgeMesh > edgeTensorField
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Calculate the matrix for the second temporal derivative.