FreeFOAM The Cross-Platform CFD Toolkit
pointLinear.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) 2004-2011 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 \*---------------------------------------------------------------------------*/
25 
26 #include "pointLinear.H"
27 #include <finiteVolume/fvMesh.H>
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 template<class Type>
36 (
38 ) const
39 {
40  const fvMesh& mesh = this->mesh();
41 
43  volPointInterpolation::New(mesh).interpolate(vf);
44 
47 
48  Field<Type>& sfCorr = tsfCorr().internalField();
49 
50  const pointField& points = mesh.points();
51  const pointField& C = mesh.C().internalField();
52  const faceList& faces = mesh.faces();
53  const scalarField& w = mesh.weights().internalField();
54  const labelList& owner = mesh.owner();
55  const labelList& neighbour = mesh.neighbour();
56 
57  forAll(sfCorr, facei)
58  {
59  point pi =
60  w[owner[facei]]*C[owner[facei]]
61  + (1.0 - w[owner[facei]])*C[neighbour[facei]];
62 
64  (
65  pi,
66  points[faces[facei][0]],
67  points[faces[facei][faces[facei].size()-1]]
68  ).mag();
69 
70  scalar sumAt = at;
71  Type sumPsip = at*(1.0/3.0)*
72  (
73  sfCorr[facei]
74  + pvf[faces[facei][0]]
75  + pvf[faces[facei][faces[facei].size()-1]]
76  );
77 
78  for (label pointi=1; pointi<faces[facei].size(); pointi++)
79  {
81  (
82  pi,
83  points[faces[facei][pointi]],
84  points[faces[facei][pointi-1]]
85  ).mag();
86 
87  sumAt += at;
88  sumPsip += at*(1.0/3.0)*
89  (
90  sfCorr[facei]
91  + pvf[faces[facei][pointi]]
92  + pvf[faces[facei][pointi-1]]
93  );
94 
95  }
96 
97  sfCorr[facei] = sumPsip/sumAt - sfCorr[facei];
98  }
99 
100  tsfCorr().boundaryField() = pTraits<Type>::zero;
101 
102  return tsfCorr;
103 }
104 
105 
106 namespace Foam
107 {
109 }
110 
111 // ************************ vim: set sw=4 sts=4 et: ************************ //