reverseLinear.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::reverseLinear
26 
27 Description
28  Inversed weight centred interpolation interpolation scheme class.
29 
30  Useful for inverse weighted and harmonic interpolations.
31 
32 SourceFiles
33  reverseLinear.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef reverseLinear_H
38 #define reverseLinear_H
39 
41 #include "volFields.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class reverseLinear Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
53 class reverseLinear
54 :
55  public surfaceInterpolationScheme<Type>
56 {
57 public:
58 
59  //- Runtime type information
60  TypeName("reverseLinear");
61 
62 
63  // Constructors
64 
65  //- Construct from mesh
66  reverseLinear(const fvMesh& mesh)
67  :
69  {}
70 
71  //- Construct from Istream
73  :
75  {}
76 
77  //- Construct from faceFlux and Istream
79  (
80  const fvMesh& mesh,
81  const surfaceScalarField&,
82  Istream&
83  )
84  :
86  {}
87 
88 
89  // Member Functions
90 
91  //- Return the interpolation weighting factors
93  (
94  const VolField<Type>&
95  ) const
96  {
97  const fvMesh& mesh = this->mesh();
98 
99  tmp<surfaceScalarField> tcdWeights
100  (
101  mesh.surfaceInterpolation::weights()
102  );
103  const surfaceScalarField& cdWeights = tcdWeights();
104 
105  tmp<surfaceScalarField> treverseLinearWeights
106  (
108  (
109  "reverseLinearWeights",
110  mesh,
111  dimless
112  )
113  );
114  surfaceScalarField& reverseLinearWeights =
115  treverseLinearWeights.ref();
116 
117  reverseLinearWeights.primitiveFieldRef() =
118  1.0 - cdWeights.primitiveField();
119 
121  reverseLinearWeights.boundaryFieldRef();
122 
123 
125  {
126  if (rlwbf[patchi].coupled())
127  {
128  rlwbf[patchi] = 1.0 - cdWeights.boundaryField()[patchi];
129  }
130  else
131  {
132  rlwbf[patchi] = cdWeights.boundaryField()[patchi];
133  }
134  }
135 
136  return treverseLinearWeights;
137  }
138 
139 
140  // Member Operators
141 
142  //- Disallow default bitwise assignment
143  void operator=(const reverseLinear&) = delete;
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Generic GeometricBoundaryField class.
Generic GeometricField class.
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
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:99
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:857
Inversed weight centred interpolation interpolation scheme class.
Definition: reverseLinear.H:55
void operator=(const reverseLinear &)=delete
Disallow default bitwise assignment.
tmp< surfaceScalarField > weights(const VolField< Type > &) const
Return the interpolation weighting factors.
Definition: reverseLinear.H:92
reverseLinear(const fvMesh &mesh)
Construct from mesh.
Definition: reverseLinear.H:65
TypeName("reverseLinear")
Runtime type information.
Abstract base class for surface interpolation schemes.
const fvMesh & mesh() const
Return mesh reference.
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
label patchi
Namespace for OpenFOAM.
const dimensionSet dimless