All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gaussLaplacianSchemes.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-2018 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 "gaussLaplacianScheme.H"
27 #include "fvMesh.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 makeFvLaplacianScheme(gaussLaplacianScheme)
32 
33 #define declareFvmLaplacianScalarGamma(Type) \
34  \
35 template<> \
36 Foam::tmp<Foam::fvMatrix<Foam::Type>> \
37 Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvmLaplacian \
38 ( \
39  const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
40  const GeometricField<Type, fvPatchField, volMesh>& vf \
41 ) \
42 { \
43  const fvMesh& mesh = this->mesh(); \
44  \
45  GeometricField<scalar, fvsPatchField, surfaceMesh> gammaMagSf \
46  ( \
47  gamma*mesh.magSf() \
48  ); \
49  \
50  tmp<fvMatrix<Type>> tfvm = fvmLaplacianUncorrected \
51  ( \
52  gammaMagSf, \
53  this->tsnGradScheme_().deltaCoeffs(vf), \
54  vf \
55  ); \
56  fvMatrix<Type>& fvm = tfvm.ref(); \
57  \
58  if (this->tsnGradScheme_().corrected()) \
59  { \
60  if (mesh.fluxRequired(vf.name())) \
61  { \
62  fvm.faceFluxCorrectionPtr() = new \
63  GeometricField<Type, fvsPatchField, surfaceMesh> \
64  ( \
65  gammaMagSf*this->tsnGradScheme_().correction(vf) \
66  ); \
67  \
68  fvm.source() -= \
69  mesh.V()* \
70  fvc::div \
71  ( \
72  *fvm.faceFluxCorrectionPtr() \
73  )().primitiveField(); \
74  } \
75  else \
76  { \
77  fvm.source() -= \
78  mesh.V()* \
79  fvc::div \
80  ( \
81  gammaMagSf*this->tsnGradScheme_().correction(vf) \
82  )().primitiveField(); \
83  } \
84  } \
85  \
86  return tfvm; \
87 } \
88  \
89  \
90 template<> \
91 Foam::tmp<Foam::GeometricField<Foam::Type, Foam::fvPatchField, Foam::volMesh>> \
92 Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvcLaplacian \
93 ( \
94  const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
95  const GeometricField<Type, fvPatchField, volMesh>& vf \
96 ) \
97 { \
98  const fvMesh& mesh = this->mesh(); \
99  \
100  tmp<GeometricField<Type, fvPatchField, volMesh>> tLaplacian \
101  ( \
102  fvc::div(gamma*this->tsnGradScheme_().snGrad(vf)*mesh.magSf()) \
103  ); \
104  \
105  tLaplacian.ref().rename \
106  ( \
107  "laplacian(" + gamma.name() + ',' + vf.name() + ')' \
108  ); \
109  \
110  return tLaplacian; \
111 }
112 
113 
119 
120 
121 // ************************************************************************* //
#define declareFvmLaplacianScalarGamma(Type)
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component, element access using th ii() member function and the inner-product (dot-product) and outer-product operators.
makeFvLaplacianScheme(gaussLaplacianScheme)