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 
136  surfaceScalarField::Boundary& rlwbf =
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 // ************************************************************************* //
volFields.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Foam::reverseLinear::TypeName
TypeName("reverseLinear")
Runtime type information.
Foam::reverseLinear::reverseLinear
reverseLinear(const fvMesh &mesh, Istream &)
Construct from Istream.
Definition: reverseLinear.H:82
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::reverseLinear
Inversed weight central-differencing interpolation scheme class.
Definition: reverseLinear.H:57
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::reverseLinear::weights
tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Definition: reverseLinear.H:103
Foam::reverseLinear::reverseLinear
reverseLinear(const fvMesh &mesh)
Construct from mesh.
Definition: reverseLinear.H:76
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:685
Foam::GeometricField::ref
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
Definition: GeometricField.C:749
Foam::surfaceInterpolationScheme
Abstract base class for surface interpolation schemes.
Definition: surfaceInterpolationScheme.H:57
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:280
Foam::surfaceInterpolationScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: surfaceInterpolationScheme.H:144
coupled
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
Foam::GeometricField< scalar, fvsPatchField, surfaceMesh >
surfaceInterpolationScheme.H
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189