File size: 5,531 Bytes
5a600cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::FitData
Description
Data for the upwinded and centred polynomial fit interpolation schemes.
The linearCorrection_ determines whether the fit is for a corrected
linear scheme (first two coefficients are corrections for owner and
neighbour) or a pure upwind scheme (first coefficient is correction for
owner; weight on face taken as 1).
SourceFiles
FitData.C
\*---------------------------------------------------------------------------*/
#ifndef FitData_H
#define FitData_H
#include "DemandDrivenMeshObject.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class FitData Declaration
\*---------------------------------------------------------------------------*/
template<class FitDataType, class ExtendedStencil, class Polynomial>
class FitData
:
public DemandDrivenMeshObject<fvMesh, MoveableMeshObject, FitDataType>
{
// Private Data
//- The stencil the fit is based on
const ExtendedStencil& stencil_;
//- Is scheme correction on linear (true) or on upwind (false)
const bool linearCorrection_;
//- Factor the fit is allowed to deviate from the base scheme
// (linear or pure upwind)
// This limits the amount of high-order correction and increases
// stability on bad meshes
const scalar linearLimitFactor_;
//- Weights for central stencil
const scalar centralWeight_;
//- Dimensionality of the geometry
const label dim_;
//- Minimum stencil size
const label minSize_;
protected:
friend class DemandDrivenMeshObject
<
fvMesh,
MoveableMeshObject,
FitDataType
>;
// Protected Constructors
//- Construct from components
FitData
(
const fvMesh& mesh,
const ExtendedStencil& stencil,
const bool linearCorrection,
const scalar linearLimitFactor,
const scalar centralWeight
);
// Protected Member Functions
//- Find the normal direction (i) and j and k directions for face faci
void findFaceDirs
(
vector& idir, // value changed in return
vector& jdir, // value changed in return
vector& kdir, // value changed in return
const label faci
);
public:
//- Destructor
virtual ~FitData()
{}
// Member Functions
//- Return reference to the stencil
const ExtendedStencil& stencil() const
{
return stencil_;
}
//- Factor the fit is allowed to deviate from the base scheme
scalar linearLimitFactor() const
{
return linearLimitFactor_;
}
//- Return weight for central stencil
scalar centralWeight() const
{
return centralWeight_;
}
//- Dimensionality of the geometry
label dim() const
{
return dim_;
}
//- Minimum stencil size
label minSize() const
{
return minSize_;
}
bool linearCorrection() const
{
return linearCorrection_;
}
//- Calculate the fit for the specified face and set the coefficients
void calcFit
(
scalarList& coeffsi, // coefficients to be set
const List<point>&, // Stencil points
const scalar wLin, // Weight for linear approximation (weights
// nearest neighbours)
const label faci // Current face index
);
//- Calculate the fit for all the faces
virtual void calcFit() = 0;
//- Recalculate weights (but not stencil) when the mesh moves
bool movePoints();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "FitData.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
|