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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::reverseLinear
28 
29 Group
30  grpFvSurfaceInterpolationSchemes
31 
32 Description
33  Inversed weight central-differencing interpolation scheme class.
34 
35  Useful for inverse weighted and harmonic interpolations.
36 
37 SourceFiles
38  reverseLinear.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef reverseLinear_H
43 #define reverseLinear_H
44 
46 #include "volFields.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class reverseLinear Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
58 class reverseLinear
59 :
60  public surfaceInterpolationScheme<Type>
61 {
62  // Private Member Functions
63 
64  //- No copy assignment
65  void operator=(const reverseLinear&) = delete;
66 
67 
68 public:
69 
70  //- Runtime type information
71  TypeName("reverseLinear");
72 
73 
74  // Constructors
75 
76  //- Construct from mesh
77  reverseLinear(const fvMesh& 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  (
120  IOobject
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 noexcept
Return a const-reference to the internal field values.
TypeName("reverseLinear")
Runtime type information.
Inversed weight central-differencing interpolation scheme class.
Definition: reverseLinear.H:53
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
const dimensionSet dimless
Dimensionless.
const fvMesh & mesh() const
Return mesh reference.
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:360
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
reverseLinear(const fvMesh &mesh)
Construct from mesh.
Definition: reverseLinear.H:78
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition: Time.C:714
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Definition: fvMesh.H:395
A class for managing temporary objects.
Definition: HashPtrTable.H:50
bool coupled
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Abstract base class for surface interpolation schemes.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
Namespace for OpenFOAM.