gaussLaplacianSchemes.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 "gaussLaplacianScheme.H"
29 #include "fvMesh.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 makeFvLaplacianScheme(gaussLaplacianScheme)
34 
35 #define declareFvmLaplacianScalarGamma(Type) \
36  \
37 template<> \
38 Foam::tmp<Foam::fvMatrix<Foam::Type>> \
39 Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvmLaplacian \
40 ( \
41  const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
42  const GeometricField<Type, fvPatchField, volMesh>& vf \
43 ) \
44 { \
45  const fvMesh& mesh = this->mesh(); \
46  \
47  GeometricField<scalar, fvsPatchField, surfaceMesh> gammaMagSf \
48  ( \
49  gamma*mesh.magSf() \
50  ); \
51  \
52  tmp<fvMatrix<Type>> tfvm = fvmLaplacianUncorrected \
53  ( \
54  gammaMagSf, \
55  this->tsnGradScheme_().deltaCoeffs(vf), \
56  vf \
57  ); \
58  fvMatrix<Type>& fvm = tfvm.ref(); \
59  \
60  if (this->tsnGradScheme_().corrected()) \
61  { \
62  if (mesh.fluxRequired(vf.name())) \
63  { \
64  fvm.faceFluxCorrectionPtr() = new \
65  GeometricField<Type, fvsPatchField, surfaceMesh> \
66  ( \
67  gammaMagSf*this->tsnGradScheme_().correction(vf) \
68  ); \
69  \
70  fvm.source() -= \
71  mesh.V()* \
72  fvc::div \
73  ( \
74  *fvm.faceFluxCorrectionPtr() \
75  )().primitiveField(); \
76  } \
77  else \
78  { \
79  fvm.source() -= \
80  mesh.V()* \
81  fvc::div \
82  ( \
83  gammaMagSf*this->tsnGradScheme_().correction(vf) \
84  )().primitiveField(); \
85  } \
86  } \
87  \
88  return tfvm; \
89 } \
90  \
91  \
92 template<> \
93 Foam::tmp<Foam::GeometricField<Foam::Type, Foam::fvPatchField, Foam::volMesh>> \
94 Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvcLaplacian \
95 ( \
96  const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
97  const GeometricField<Type, fvPatchField, volMesh>& vf \
98 ) \
99 { \
100  const fvMesh& mesh = this->mesh(); \
101  \
102  tmp<GeometricField<Type, fvPatchField, volMesh>> tLaplacian \
103  ( \
104  fvc::div(gamma*this->tsnGradScheme_().snGrad(vf)*mesh.magSf()) \
105  ); \
106  \
107  tLaplacian.ref().rename \
108  ( \
109  "laplacian(" + gamma.name() + ',' + vf.name() + ')' \
110  ); \
111  \
112  return tLaplacian; \
113 }
114 
115 
121 
122 
123 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::SymmTensor< scalar >
declareFvmLaplacianScalarGamma
#define declareFvmLaplacianScalarGamma(Type)
makeFvLaplacianScheme
makeFvLaplacianScheme(gaussLaplacianScheme)
Definition: gaussLaplacianSchemes.C:33
fvMesh.H
Foam::SphericalTensor< scalar >
Foam::Vector< scalar >
gaussLaplacianScheme.H