Loading...
Searching...
No Matches
reverseLinear.H
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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::reverseLinear
28
29Group
30 grpFvSurfaceInterpolationSchemes
31
32Description
33 Inversed weight central-differencing interpolation scheme class.
34
35 Useful for inverse weighted and harmonic interpolations.
36
37SourceFiles
38 reverseLinear.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef reverseLinear_H
43#define reverseLinear_H
44
46#include "volFields.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class reverseLinear Declaration
55\*---------------------------------------------------------------------------*/
56
57template<class Type>
58class reverseLinear
59:
60 public surfaceInterpolationScheme<Type>
61{
62 // Private Member Functions
63
64 //- No copy assignment
65 void operator=(const reverseLinear&) = delete;
66
67
68public:
69
70 //- Runtime type information
71 TypeName("reverseLinear");
72
73
74 // Constructors
75
76 //- Construct from mesh
78 :
79 surfaceInterpolationScheme<Type>(mesh)
80 {}
81
82 //- Construct from Istream
84 :
86 {}
87
88 //- Construct from faceFlux and Istream
90 (
91 const fvMesh& mesh,
92 const surfaceScalarField&,
93 Istream&
94 )
95 :
96 surfaceInterpolationScheme<Type>(mesh)
97 {}
98
99
100 // Member Functions
101
102 //- Return the interpolation weighting factors
104 (
106 ) const
107 {
108 const fvMesh& mesh = this->mesh();
109
111 (
112 mesh.surfaceInterpolation::weights()
113 );
114 const surfaceScalarField& cdWeights = tcdWeights();
115
116 auto treverseLinearWeights = surfaceScalarField::New
117 (
118 "reverseLinearWeights",
120 mesh,
121 dimless
122 );
123 auto& reverseLinearWeights = treverseLinearWeights.ref();
124
125 reverseLinearWeights.primitiveFieldRef() =
126 1.0 - cdWeights.primitiveField();
127
128 auto& rlwbf = reverseLinearWeights.boundaryFieldRef();
129
130
131 forAll(mesh.boundary(), patchi)
132 {
133 if (rlwbf[patchi].coupled())
134 {
135 rlwbf[patchi] = 1.0 - cdWeights.boundaryField()[patchi];
136 }
137 else
138 {
139 rlwbf[patchi] = cdWeights.boundaryField()[patchi];
140 }
141 }
142
143 return treverseLinearWeights;
144 }
145};
146
147
148// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150} // End namespace Foam
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154#endif
155
156// ************************************************************************* //
Generic GeometricField class.
static tmp< GeometricField< scalar, fvsPatchField, surfaceMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvsPatchField< scalar >::calculatedType())
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
@ NO_REGISTER
Do not request registration (bool: false).
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
reverseLinear(const fvMesh &mesh, Istream &)
Construct from Istream.
reverseLinear(const fvMesh &mesh, const surfaceScalarField &, Istream &)
Construct from faceFlux and Istream.
reverseLinear(const fvMesh &mesh)
Construct from mesh.
TypeName("reverseLinear")
Runtime type information.
tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Abstract base class for surface interpolation schemes.
const fvMesh & mesh() const
Return mesh reference.
A class for managing temporary objects.
Definition tmp.H:75
bool coupled
dynamicFvMesh & mesh
Namespace for OpenFOAM.
const dimensionSet dimless
Dimensionless.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68