FreeFOAM The Cross-Platform CFD Toolkit
correctedSnGrad.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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 Description
25  Simple central-difference snGrad scheme with non-orthogonal correction.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "correctedSnGrad.H"
30 #include <finiteVolume/volFields.H>
32 #include <finiteVolume/linear.H>
33 #include <finiteVolume/fvcGrad.H>
34 #include <finiteVolume/gaussGrad.H>
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace fv
44 {
45 
46 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
47 
48 template<class Type>
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 
55 template<class Type>
58 (
60 ) const
61 {
62  const fvMesh& mesh = this->mesh();
63 
64  // construct GeometricField<Type, fvsPatchField, surfaceMesh>
66  (
68  (
69  IOobject
70  (
71  "snGradCorr("+vf.name()+')',
72  vf.instance(),
73  mesh,
76  ),
77  mesh,
78  vf.dimensions()*mesh.deltaCoeffs().dimensions()
79  )
80  );
82 
83  for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
84  {
85  ssf.replace
86  (
87  cmpt,
88  mesh.correctionVectors()
89  & linear
90  <
91  typename
93  >(mesh).interpolate
94  (
95  gradScheme<typename pTraits<Type>::cmptType>::New
96  (
97  mesh,
98  mesh.gradScheme(ssf.name())
99  )()
100  //gaussGrad<typename pTraits<Type>::cmptType>(mesh)
101  .grad(vf.component(cmpt))
102  )
103  );
104  }
105 
106  return tssf;
107 }
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace fv
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 } // End namespace Foam
117 
118 // ************************ vim: set sw=4 sts=4 et: ************************ //