1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "pointLinear.H"
28 #include "volPointInterpolation.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
34 Foam::pointLinear<Type>::
37 const GeometricField<Type, fvPatchField, volMesh>& vf
40 const fvMesh& mesh = this->mesh();
42 GeometricField<Type, pointPatchField, pointMesh> pvf
44 volPointInterpolation::New(mesh).interpolate(vf)
47 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr =
48 linearInterpolate(vf);
50 Field<Type>& sfCorr = tsfCorr().internalField();
52 const pointField& points = mesh.points();
53 const pointField& C = mesh.C().internalField();
54 const faceList& faces = mesh.faces();
55 const scalarField& w = mesh.weights().internalField();
56 const labelList& owner = mesh.owner();
57 const labelList& neighbour = mesh.neighbour();
62 w[owner[facei]]*C[owner[facei]]
63 + (1.0 - w[owner[facei]])*C[neighbour[facei]];
65 scalar at = triangle<point, const point&>
68 points[faces[facei][0]],
69 points[faces[facei][faces[facei].size()-1]]
73 Type sumPsip = at*(1.0/3.0)*
76 + pvf[faces[facei][0]]
77 + pvf[faces[facei][faces[facei].size()-1]]
80 for (label pointi=1; pointi<faces[facei].size(); pointi++)
82 at = triangle<point, const point&>
85 points[faces[facei][pointi]],
86 points[faces[facei][pointi-1]]
90 sumPsip += at*(1.0/3.0)*
93 + pvf[faces[facei][pointi]]
94 + pvf[faces[facei][pointi-1]]
99 sfCorr[facei] = sumPsip/sumAt - sfCorr[facei];
102 tsfCorr().boundaryField() = pTraits<Type>::zero;
110 makeSurfaceInterpolationScheme(pointLinear);
113 // ************************************************************************* //