Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "pointLinear.H"
00027 #include <finiteVolume/fvMesh.H>
00028 #include <finiteVolume/volPointInterpolation.H>
00029
00030
00031
00032 template<class Type>
00033 Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
00034 Foam::pointLinear<Type>::
00035 correction
00036 (
00037 const GeometricField<Type, fvPatchField, volMesh>& vf
00038 ) const
00039 {
00040 const fvMesh& mesh = this->mesh();
00041
00042 GeometricField<Type, pointPatchField, pointMesh> pvf =
00043 volPointInterpolation::New(mesh).interpolate(vf);
00044
00045 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr =
00046 linearInterpolate(vf);
00047
00048 Field<Type>& sfCorr = tsfCorr().internalField();
00049
00050 const pointField& points = mesh.points();
00051 const pointField& C = mesh.C().internalField();
00052 const faceList& faces = mesh.faces();
00053 const scalarField& w = mesh.weights().internalField();
00054 const labelList& owner = mesh.owner();
00055 const labelList& neighbour = mesh.neighbour();
00056
00057 forAll(sfCorr, facei)
00058 {
00059 point pi =
00060 w[owner[facei]]*C[owner[facei]]
00061 + (1.0 - w[owner[facei]])*C[neighbour[facei]];
00062
00063 scalar at = triangle<point, const point&>
00064 (
00065 pi,
00066 points[faces[facei][0]],
00067 points[faces[facei][faces[facei].size()-1]]
00068 ).mag();
00069
00070 scalar sumAt = at;
00071 Type sumPsip = at*(1.0/3.0)*
00072 (
00073 sfCorr[facei]
00074 + pvf[faces[facei][0]]
00075 + pvf[faces[facei][faces[facei].size()-1]]
00076 );
00077
00078 for (label pointi=1; pointi<faces[facei].size(); pointi++)
00079 {
00080 at = triangle<point, const point&>
00081 (
00082 pi,
00083 points[faces[facei][pointi]],
00084 points[faces[facei][pointi-1]]
00085 ).mag();
00086
00087 sumAt += at;
00088 sumPsip += at*(1.0/3.0)*
00089 (
00090 sfCorr[facei]
00091 + pvf[faces[facei][pointi]]
00092 + pvf[faces[facei][pointi-1]]
00093 );
00094
00095 }
00096
00097 sfCorr[facei] = sumPsip/sumAt - sfCorr[facei];
00098 }
00099
00100 tsfCorr().boundaryField() = pTraits<Type>::zero;
00101
00102 return tsfCorr;
00103 }
00104
00105
00106 namespace Foam
00107 {
00108 makeSurfaceInterpolationScheme(pointLinear);
00109 }
00110
00111