CentredFitData.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "CentredFitData.H"
29 #include "surfaceFields.H"
30 #include "volFields.H"
31 #include "SVD.H"
32 #include "syncTools.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
37 template<class Polynomial>
39 (
40  const fvMesh& mesh,
41  const extendedCentredCellToFaceStencil& stencil,
42  const scalar linearLimitFactor,
43  const scalar centralWeight
44 )
45 :
46  FitData
47  <
51  >
52  (
53  mesh, stencil, true, linearLimitFactor, centralWeight
54  ),
55  coeffs_(mesh.nFaces())
56 {
57  if (debug)
58  {
59  InfoInFunction << "Contructing CentredFitData<Polynomial>" << endl;
60  }
61 
62  calcFit();
63 
64  if (debug)
65  {
66  Info<< "Finished constructing polynomialFit data" << endl;
67  }
68 }
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
73 template<class Polynomial>
75 {
76  const fvMesh& mesh = this->mesh();
77 
78  // Get the cell/face centres in stencil order.
79  // Centred face stencils no good for triangles or tets.
80  // Need bigger stencils
81  List<List<point>> stencilPoints(mesh.nFaces());
82  this->stencil().collectData(mesh.C(), stencilPoints);
83 
84  // find the fit coefficients for every face in the mesh
85 
86  const surfaceScalarField& w = mesh.surfaceInterpolation::weights();
87 
88  for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
89  {
90  FitData
91  <
95  >::calcFit(coeffs_[facei], stencilPoints[facei], w[facei], facei);
96  }
97 
98  const surfaceScalarField::Boundary& bw = w.boundaryField();
99 
100  forAll(bw, patchi)
101  {
102  const fvsPatchScalarField& pw = bw[patchi];
103 
104  if (pw.coupled())
105  {
106  label facei = pw.patch().start();
107 
108  forAll(pw, i)
109  {
110  FitData
111  <
112  CentredFitData<Polynomial>,
113  extendedCentredCellToFaceStencil,
114  Polynomial
115  >::calcFit(coeffs_[facei], stencilPoints[facei], pw[i], facei);
116  facei++;
117  }
118  }
119  }
120 }
121 
122 
123 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
volFields.H
InfoInFunction
#define InfoInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:316
Foam::FitData
Data for the upwinded and centred polynomial fit interpolation schemes. The linearCorrection_ determi...
Definition: FitData.H:57
SVD.H
Foam::extendedCentredCellToFaceStencil
Definition: extendedCentredCellToFaceStencil.H:51
Foam::fvsPatchScalarField
fvsPatchField< scalar > fvsPatchScalarField
Definition: fvsPatchFieldsFwd.H:45
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
surfaceFields.H
Foam::surfaceFields.
syncTools.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::CentredFitData
Data for the quadratic fit correction interpolation scheme.
Definition: CentredFitData.H:54
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
CentredFitData.H
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
extendedCentredCellToFaceStencil.H
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam::Polynomial
Polynomial templated on size (order):
Definition: Polynomial.H:67
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:102
Foam::GeometricField< scalar, fvsPatchField, surfaceMesh >
Foam::CentredFitData::CentredFitData
CentredFitData(const fvMesh &mesh, const extendedCentredCellToFaceStencil &stencil, const scalar linearLimitFactor, const scalar centralWeight)
Construct from components.
Definition: CentredFitData.C:39
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62