fvmLaplacian.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) 2011-2016 OpenFOAM Foundation
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 "volFields.H"
29 #include "surfaceFields.H"
30 #include "fvMatrix.H"
31 #include "laplacianScheme.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace fvm
41 {
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 template<class Type>
46 tmp<fvMatrix<Type>>
48 (
50  const word& name
51 )
52 {
53  surfaceScalarField Gamma
54  (
55  IOobject
56  (
57  "1",
58  vf.time().constant(),
59  vf.mesh(),
61  ),
62  vf.mesh(),
63  dimensionedScalar("1", dimless, 1.0)
64  );
65 
66  return fvm::laplacian(Gamma, vf, name);
67 }
68 
69 
70 template<class Type>
73 (
75 )
76 {
77  surfaceScalarField Gamma
78  (
79  IOobject
80  (
81  "1",
82  vf.time().constant(),
83  vf.mesh(),
85  ),
86  vf.mesh(),
87  dimensionedScalar("1", dimless, 1.0)
88  );
89 
90  return fvm::laplacian
91  (
92  Gamma,
93  vf,
94  "laplacian(" + vf.name() + ')'
95  );
96 }
97 
98 
99 template<class Type>
101 laplacian
102 (
103  const zero&,
105  const word& name
106 )
107 {
108  return tmp<fvMatrix<Type>>
109  (
110  new fvMatrix<Type>(vf, dimensionSet(0, 0, -2, 0, 0))
111  );
112 }
113 
114 
115 template<class Type>
117 laplacian
118 (
119  const zero&,
121 )
122 {
123  return tmp<fvMatrix<Type>>
124  (
125  new fvMatrix<Type>(vf, dimensionSet(0, 0, -2, 0, 0))
126  );
127 }
128 
129 
130 template<class Type>
132 laplacian
133 (
134  const one&,
136  const word& name
137 )
138 {
139  return fvm::laplacian(vf, name);
140 }
141 
142 
143 template<class Type>
145 laplacian
146 (
147  const one&,
149 )
150 {
151  return fvm::laplacian(vf);
152 }
153 
154 
155 template<class Type, class GType>
157 laplacian
158 (
159  const dimensioned<GType>& gamma,
161  const word& name
162 )
163 {
165  (
166  IOobject
167  (
168  gamma.name(),
169  vf.instance(),
170  vf.mesh(),
172  ),
173  vf.mesh(),
174  gamma
175  );
176 
177  return fvm::laplacian(Gamma, vf, name);
178 }
179 
180 
181 template<class Type, class GType>
183 laplacian
184 (
185  const dimensioned<GType>& gamma,
187 )
188 {
190  (
191  IOobject
192  (
193  gamma.name(),
194  vf.instance(),
195  vf.mesh(),
197  ),
198  vf.mesh(),
199  gamma
200  );
201 
202  return fvm::laplacian(Gamma, vf);
203 }
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 template<class Type, class GType>
210 laplacian
211 (
214  const word& name
215 )
216 {
218  (
219  vf.mesh(),
220  vf.mesh().laplacianScheme(name)
221  ).ref().fvmLaplacian(gamma, vf);
222 }
223 
224 
225 template<class Type, class GType>
227 laplacian
228 (
231  const word& name
232 )
233 {
234  tmp<fvMatrix<Type>> Laplacian(fvm::laplacian(tgamma(), vf, name));
235  tgamma.clear();
236  return Laplacian;
237 }
238 
239 
240 template<class Type, class GType>
242 laplacian
243 (
246 )
247 {
248  return fvm::laplacian
249  (
250  gamma,
251  vf,
252  "laplacian(" + gamma.name() + ',' + vf.name() + ')'
253  );
254 }
255 
256 
257 template<class Type, class GType>
259 laplacian
260 (
263 )
264 {
265  tmp<fvMatrix<Type>> Laplacian(fvm::laplacian(tgamma(), vf));
266  tgamma.clear();
267  return Laplacian;
268 }
269 
270 
271 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272 
273 template<class Type, class GType>
275 laplacian
276 (
279  const word& name
280 )
281 {
283  (
284  vf.mesh(),
285  vf.mesh().laplacianScheme(name)
286  ).ref().fvmLaplacian(gamma, vf);
287 }
288 
289 
290 template<class Type, class GType>
292 laplacian
293 (
296  const word& name
297 )
298 {
299  tmp<fvMatrix<Type>> tLaplacian = fvm::laplacian(tgamma(), vf, name);
300  tgamma.clear();
301  return tLaplacian;
302 }
303 
304 
305 template<class Type, class GType>
307 laplacian
308 (
311 )
312 {
313  return fvm::laplacian
314  (
315  gamma,
316  vf,
317  "laplacian(" + gamma.name() + ',' + vf.name() + ')'
318  );
319 }
320 
321 
322 template<class Type, class GType>
324 laplacian
325 (
328 )
329 {
330  tmp<fvMatrix<Type>> tfvm(fvm::laplacian(tGamma(), vf));
331  tGamma.clear();
332  return tfvm;
333 }
334 
335 
336 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
337 
338 } // End namespace fvm
339 
340 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
341 
342 } // End namespace Foam
343 
344 // ************************************************************************* //
volFields.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::fv::laplacianScheme::New
static tmp< laplacianScheme< Type, GType > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
Definition: laplacianScheme.C:48
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::one
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:61
fvMatrix.H
surfaceFields.H
Foam::surfaceFields.
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:108
laplacianScheme.H
ref
rDeltaT ref()
Foam::fvm::laplacian
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:48
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
gamma
const scalar gamma
Definition: EEqn.H:9
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62