1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "CentredFitData.H"
28 #include "surfaceFields.H"
29 #include "volFields.H"
31 #include "syncTools.H"
32 #include "extendedCentredCellToFaceStencil.H"
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 template<class Polynomial>
37 Foam::CentredFitData<Polynomial>::CentredFitData
40 const extendedCentredCellToFaceStencil& stencil,
41 const scalar linearLimitFactor,
42 const scalar centralWeight
47 CentredFitData<Polynomial>,
48 extendedCentredCellToFaceStencil,
52 mesh, stencil, true, linearLimitFactor, centralWeight
54 coeffs_(mesh.nFaces())
58 Info<< "Contructing CentredFitData<Polynomial>" << endl;
65 Info<< "CentredFitData<Polynomial>::CentredFitData() :"
66 << "Finished constructing polynomialFit data"
72 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 template<class Polynomial>
75 void Foam::CentredFitData<Polynomial>::calcFit()
77 const fvMesh& mesh = this->mesh();
79 // Get the cell/face centres in stencil order.
80 // Centred face stencils no good for triangles or tets.
81 // Need bigger stencils
82 List<List<point> > stencilPoints(mesh.nFaces());
83 this->stencil().collectData(mesh.C(), stencilPoints);
85 // find the fit coefficients for every face in the mesh
87 const surfaceScalarField& w = mesh.surfaceInterpolation::weights();
89 for(label facei = 0; facei < mesh.nInternalFaces(); facei++)
93 CentredFitData<Polynomial>,
94 extendedCentredCellToFaceStencil,
96 >::calcFit(coeffs_[facei], stencilPoints[facei], w[facei], facei);
99 const surfaceScalarField::GeometricBoundaryField& bw = w.boundaryField();
103 const fvsPatchScalarField& pw = bw[patchi];
107 label facei = pw.patch().patch().start();
113 CentredFitData<Polynomial>,
114 extendedCentredCellToFaceStencil,
116 >::calcFit(coeffs_[facei], stencilPoints[facei], pw[i], facei);
124 // ************************************************************************* //