FreeFOAM The Cross-Platform CFD Toolkit
cubic.H
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 Class
25  Foam::cubic
26 
27 Description
28  Cubic interpolation scheme class derived from linear and returns
29  linear weighting factors but also applies an explicit correction.
30 
31 SourceFiles
32  cubic.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef cubic_H
37 #define cubic_H
38 
39 #include <finiteVolume/linear.H>
40 #include <finiteVolume/gaussGrad.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class cubic Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class Type>
52 class cubic
53 :
54  public linear<Type>
55 {
56  // Private Member Functions
57 
58  //- Disallow default bitwise copy construct
59  cubic(const cubic&);
60 
61  //- Disallow default bitwise assignment
62  void operator=(const cubic&);
63 
64 
65 public:
66 
67  //- Runtime type information
68  TypeName("cubic");
69 
70 
71  // Constructors
72 
73  //- Construct from mesh
74  cubic(const fvMesh& mesh)
75  :
76  linear<Type>(mesh)
77  {}
78 
79  //- Construct from mesh and Istream
80  cubic
81  (
82  const fvMesh& mesh,
83  Istream&
84  )
85  :
87  {}
88 
89  //- Construct from mesh, faceFlux and Istream
90  cubic
91  (
92  const fvMesh& mesh,
93  const surfaceScalarField&,
94  Istream&
95  )
96  :
98  {}
99 
100 
101  // Member Functions
102 
103  //- Return true if this scheme uses an explicit correction
104  virtual bool corrected() const
105  {
106  return true;
107  }
108 
109  //- Return the explicit correction to the face-interpolate
111  correction
112  (
114  ) const
115  {
116  const fvMesh& mesh = this->mesh();
117 
118  // calculate the appropriate interpolation factors
119  const surfaceScalarField& lambda = mesh.weights();
120 
121  surfaceScalarField kSc =
122  lambda*(scalar(1) - lambda*(scalar(3) - scalar(2)*lambda));
123 
124  surfaceScalarField kVecP = sqr(scalar(1) - lambda)*lambda;
125  surfaceScalarField kVecN = sqr(lambda)*(lambda - scalar(1));
126 
128  (
130  (
131  IOobject
132  (
133  vf.name(),
134  mesh.time().timeName(),
135  mesh
136  ),
138  )
139  );
140 
142 
143  for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
144  {
145  sfCorr.replace
146  (
147  cmpt,
148  sfCorr.component(cmpt)
149  + (
151  <
152  typename outerProduct
153  <
154  vector,
155  typename pTraits<Type>::cmptType
156  >::type
158  (
160  <typename pTraits<Type>::cmptType>(mesh)
161  .grad(vf.component(cmpt)),
162  kVecP,
163  kVecN
164  ) & mesh.Sf()
165  )/mesh.magSf()/mesh.surfaceInterpolation::deltaCoeffs()
166  );
167  }
168 
169  forAll (sfCorr.boundaryField(), pi)
170  {
171  if (!sfCorr.boundaryField()[pi].coupled())
172  {
174  }
175  }
176 
177  return tsfCorr;
178  }
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************ vim: set sw=4 sts=4 et: ************************ //