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 | Copyright (C) 2011 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 central-differencing 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  // Private Member Functions
58 
59  //- Disallow default bitwise assignment
60  void operator=(const reverseLinear&);
61 
62 
63 public:
64 
65  //- Runtime type information
66  TypeName("reverseLinear");
67 
68 
69  // Constructors
70 
71  //- Construct from mesh
72  reverseLinear(const fvMesh& mesh)
73  :
75  {}
76 
77  //- Construct from Istream
79  :
81  {}
82 
83  //- Construct from faceFlux and Istream
85  (
86  const fvMesh& mesh,
87  const surfaceScalarField&,
88  Istream&
89  )
90  :
92  {}
93 
94 
95  // Member Functions
96 
97  //- Return the interpolation weighting factors
99  (
101  ) const
102  {
103  const fvMesh& mesh = this->mesh();
104 
105  tmp<surfaceScalarField> tcdWeights
106  (
107  mesh.surfaceInterpolation::weights()
108  );
109  const surfaceScalarField& cdWeights = tcdWeights();
110 
111  tmp<surfaceScalarField> treverseLinearWeights
112  (
114  (
115  IOobject
116  (
117  "reverseLinearWeights",
118  mesh.time().timeName(),
119  mesh
120  ),
121  mesh,
122  dimless
123  )
124  );
125  surfaceScalarField& reverseLinearWeights = treverseLinearWeights();
126 
127  reverseLinearWeights.internalField() =
128  1.0 - cdWeights.internalField();
129 
130  forAll(mesh.boundary(), patchI)
131  {
132  if (reverseLinearWeights.boundaryField()[patchI].coupled())
133  {
134  reverseLinearWeights.boundaryField()[patchI] =
135  1.0 - cdWeights.boundaryField()[patchI];
136  }
137  else
138  {
139  reverseLinearWeights.boundaryField()[patchI] =
140  cdWeights.boundaryField()[patchI];
141  }
142  }
143 
144  return treverseLinearWeights;
145  }
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
volFields.H
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::reverseLinear::TypeName
TypeName("reverseLinear")
Runtime type information.
Foam::reverseLinear::operator=
void operator=(const reverseLinear &)
Disallow default bitwise assignment.
Foam::reverseLinear::reverseLinear
reverseLinear(const fvMesh &mesh, Istream &)
Construct from Istream.
Definition: reverseLinear.H:77
Foam::reverseLinear
Inversed weight central-differencing interpolation scheme class.
Definition: reverseLinear.H:52
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::GeometricField::internalField
InternalField & internalField()
Return internal field.
Definition: GeometricField.C:724
Foam::reverseLinear::weights
tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Definition: reverseLinear.H:98
Foam::reverseLinear::reverseLinear
reverseLinear(const fvMesh &mesh)
Construct from mesh.
Definition: reverseLinear.H:71
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:550
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::surfaceInterpolationScheme
Abstract base class for surface interpolation schemes.
Definition: surfaceInterpolationScheme.H:55
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Foam::surfaceInterpolationScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: surfaceInterpolationScheme.H:142
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
surfaceInterpolationScheme.H