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:
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 :
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 :
97 {}
98
99
100 // Member Functions
101
102 //- Return the interpolation weighting factors
104 (
106 ) const
107 {
108 const fvMesh& mesh = this->mesh();
109
110 tmp<surfaceScalarField> tcdWeights
111 (
112 mesh.surfaceInterpolation::weights()
113 );
114 const surfaceScalarField& cdWeights = tcdWeights();
115
116 tmp<surfaceScalarField> treverseLinearWeights
117 (
119 (
121 (
122 "reverseLinearWeights",
123 mesh.time().timeName(),
124 mesh
125 ),
126 mesh,
127 dimless
128 )
129 );
130 surfaceScalarField& reverseLinearWeights =
131 treverseLinearWeights.ref();
132
133 reverseLinearWeights.primitiveFieldRef() =
134 1.0 - cdWeights.primitiveField();
135
137 reverseLinearWeights.boundaryFieldRef();
138
139
140 forAll(mesh.boundary(), patchi)
141 {
142 if (rlwbf[patchi].coupled())
143 {
144 rlwbf[patchi] = 1.0 - cdWeights.boundaryField()[patchi];
145 }
146 else
147 {
148 rlwbf[patchi] = cdWeights.boundaryField()[patchi];
149 }
150 }
151
152 return treverseLinearWeights;
153 }
154};
155
156
157// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158
159} // End namespace Foam
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
163#endif
164
165// ************************************************************************* //
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:712
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
Inversed weight central-differencing interpolation scheme class.
Definition: reverseLinear.H:60
reverseLinear(const fvMesh &mesh, Istream &)
Construct from Istream.
Definition: reverseLinear.H:82
reverseLinear(const fvMesh &mesh, const surfaceScalarField &, Istream &)
Construct from faceFlux and Istream.
Definition: reverseLinear.H:89
reverseLinear(const fvMesh &mesh)
Construct from mesh.
Definition: reverseLinear.H:76
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:65
T & ref() const
Definition: tmpI.H:227
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
Namespace for OpenFOAM.
const dimensionSet dimless
Dimensionless.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73