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 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "CentredFitData.H"
30#include "surfaceFields.H"
31#include "volFields.H"
32#include "SVD.H"
33#include "syncTools.H"
35
36// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37
38template<class Polynomial>
40(
41 const fvMesh& mesh,
43 const scalar linearLimitFactor,
44 const scalar centralWeight
45)
46:
48 <
52 >
53 (
54 mesh, stencil, true, linearLimitFactor, centralWeight
55 ),
56 coeffs_(mesh.nFaces())
57{
58 DebugInFunction << "Constructing CentredFitData<Polynomial>" << nl;
59
60 calcFit();
61
62 DebugInfo << "Finished constructing polynomialFit data" << endl;
63}
64
65
66// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67
68template<class Polynomial>
70{
71 const fvMesh& mesh = this->mesh();
72
73 // Get the cell/face centres in stencil order.
74 // Centred face stencils no good for triangles or tets.
75 // Need bigger stencils
76 List<List<point>> stencilPoints(mesh.nFaces());
77 this->stencil().collectData(mesh.C(), stencilPoints);
78
79 // find the fit coefficients for every face in the mesh
80
81 const surfaceScalarField& w = mesh.surfaceInterpolation::weights();
82
83 for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
84 {
86 <
90 >::calcFit(coeffs_[facei], stencilPoints[facei], w[facei], facei);
91 }
92
94
95 forAll(bw, patchi)
96 {
97 const fvsPatchScalarField& pw = bw[patchi];
98
99 if (pw.coupled())
100 {
101 label facei = pw.patch().start();
102
103 forAll(pw, i)
104 {
105 FitData
106 <
107 CentredFitData<Polynomial>,
108 extendedCentredCellToFaceStencil,
109 Polynomial
110 >::calcFit(coeffs_[facei], stencilPoints[facei], pw[i], facei);
111 facei++;
112 }
113 }
114 }
115}
116
117
118// ************************************************************************* //
Data for the quadratic fit correction interpolation scheme.
Data for the upwinded and centred polynomial fit interpolation schemes. The linearCorrection_ determi...
Definition: FitData.H:60
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
Type of boundary fields.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
Polynomial templated on size (order):
Definition: Polynomial.H:78
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const volVectorField & C() const
Return cell centres as volVectorField.
virtual label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:179
const fvPatch & patch() const
Return patch.
label nInternalFaces() const noexcept
Number of internal faces.
label nFaces() const noexcept
Number of mesh faces.
dynamicFvMesh & mesh
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
#define DebugInfo
Report an information message using Foam::Info.
#define DebugInFunction
Report an information message using Foam::Info.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
fvsPatchField< scalar > fvsPatchScalarField
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
Foam::surfaceFields.