blended.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::blended
26 
27 Description
28  linear/upwind blended interpolation scheme.
29 
30 SourceFiles
31  blended.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef blended_H
36 #define blended_H
37 
39 #include "blendedSchemeBase.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class blended Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class Type>
51 class blended
52 :
54  public blendedSchemeBase<Type>
55 {
56  // Private Data
57 
58  const scalar blendingFactor_;
59 
60 
61 public:
62 
63  //- Runtime type information
64  TypeName("blended");
65 
66 
67  // Constructors
68 
69  //- Construct from mesh, faceFlux and blendingFactor
71  (
72  const fvMesh& mesh,
73  const surfaceScalarField& faceFlux,
74  const scalar blendingFactor
75  )
76  :
77  limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
78  blendingFactor_(blendingFactor)
79  {}
80 
81  //- Construct from mesh and Istream.
82  // The name of the flux field is read from the Istream and looked-up
83  // from the mesh objectRegistry
85  (
86  const fvMesh& mesh,
87  Istream& is
88  )
89  :
90  limitedSurfaceInterpolationScheme<Type>(mesh, is),
91  blendingFactor_(readScalar(is))
92  {}
93 
94  //- Construct from mesh, faceFlux and Istream
96  (
97  const fvMesh& mesh,
98  const surfaceScalarField& faceFlux,
99  Istream& is
100  )
101  :
102  limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
103  blendingFactor_(readScalar(is))
104  {}
105 
106  //- Disallow default bitwise copy construction
107  blended(const blended&) = delete;
108 
109 
110  //- Destructor
111  virtual ~blended()
112  {}
113 
114 
115  // Member Functions
116 
117  //- Return the face-based blending factor
119  (
121  ) const
122  {
124  (
125  vf.name() + "BlendingFactor",
126  this->mesh(),
127  dimensionedScalar(dimless, blendingFactor_)
128  );
129  }
130 
131  //- Return the interpolation limiter
133  (
135  ) const
136  {
138  (
139  "blendedLimiter",
140  this->mesh(),
141  dimensionedScalar(dimless, 1 - blendingFactor_)
142  );
143  }
144 
145  //- Return the interpolation weighting factors
147  (
149  ) const
150  {
151  return
152  blendingFactor_*this->mesh().surfaceInterpolation::weights()
153  + (1 - blendingFactor_)*pos0(this->faceFlux_);
154  }
155 
156 
157  // Member Operators
158 
159  //- Disallow default bitwise assignment
160  void operator=(const blended&) = delete;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
virtual ~blended()
Destructor.
Definition: blended.H:110
const word & name() const
Return name.
Definition: IOobject.H:315
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual tmp< surfaceScalarField > limiter(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation limiter.
Definition: blended.H:132
static tmp< GeometricField< scalar, fvsPatchField, surfaceMesh > > New(const word &name, const Internal &, const PtrList< fvsPatchField< scalar >> &)
Return a temporary field constructed from name,.
TypeName("blended")
Runtime type information.
const dimensionSet dimless
const fvMesh & mesh() const
Return mesh reference.
virtual tmp< surfaceScalarField > blendingFactor(const GeometricField< Type, fvPatchField, volMesh > &vf) const
Return the face-based blending factor.
Definition: blended.H:118
Base class for blended schemes to provide access to the blending factor surface field.
linear/upwind blended interpolation scheme.
Definition: blended.H:50
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
Definition: doubleScalar.H:75
dimensionedScalar pos0(const dimensionedScalar &ds)
void operator=(const blended &)=delete
Disallow default bitwise assignment.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Abstract base class for limited surface interpolation schemes.
A class for managing temporary objects.
Definition: PtrList.H:53
blended(const fvMesh &mesh, const surfaceScalarField &faceFlux, const scalar blendingFactor)
Construct from mesh, faceFlux and blendingFactor.
Definition: blended.H:70
virtual tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &vf) const
Return the interpolation weighting factors.
Definition: blended.H:146
Namespace for OpenFOAM.