1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 Two-scheme localBlended differencing scheme.
33 \*---------------------------------------------------------------------------*/
35 #ifndef localBlended_H
36 #define localBlended_H
38 #include "surfaceInterpolationScheme.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 /*---------------------------------------------------------------------------*\
46 Class localBlended Declaration
47 \*---------------------------------------------------------------------------*/
52 public surfaceInterpolationScheme<Type>
54 // Private Member Functions
57 tmp<surfaceInterpolationScheme<Type> > tScheme1_;
60 tmp<surfaceInterpolationScheme<Type> > tScheme2_;
63 //- Disallow default bitwise copy construct
64 localBlended(const localBlended&);
66 //- Disallow default bitwise assignment
67 void operator=(const localBlended&);
72 //- Runtime type information
73 TypeName("localBlended");
78 //- Construct from mesh and Istream.
79 // The name of the flux field is read from the Istream and looked-up
80 // from the mesh objectRegistry
87 surfaceInterpolationScheme<Type>(mesh),
90 surfaceInterpolationScheme<Type>::New(mesh, is)
94 surfaceInterpolationScheme<Type>::New(mesh, is)
98 //- Construct from mesh, faceFlux and Istream
102 const surfaceScalarField& faceFlux,
106 surfaceInterpolationScheme<Type>(mesh),
109 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
113 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
120 //- Return the interpolation weighting factors
121 tmp<surfaceScalarField> weights
123 const GeometricField<Type, fvPatchField, volMesh>& vf
126 const surfaceScalarField& blendingFactor =
127 this->mesh().objectRegistry::template
128 lookupObject<const surfaceScalarField>
130 word(vf.name() + "BlendingFactor")
134 blendingFactor*tScheme1_().weights(vf)
135 + (scalar(1) - blendingFactor)*tScheme2_().weights(vf);
138 //- Return the face-interpolate of the given cell field
139 // with explicit correction
140 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
141 interpolate(const GeometricField<Type, fvPatchField, volMesh>& vf) const
143 const surfaceScalarField& blendingFactor =
145 this->mesh().objectRegistry::template
146 lookupObject<const surfaceScalarField>
148 word(vf.name() + "BlendingFactor")
153 blendingFactor*tScheme1_().interpolate(vf)
154 + (scalar(1) - blendingFactor)*tScheme2_().interpolate(vf);
158 //- Return true if this scheme uses an explicit correction
159 virtual bool corrected() const
161 return tScheme1_().corrected() || tScheme2_().corrected();
165 //- Return the explicit correction to the face-interpolate
166 // for the given field
167 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
170 const GeometricField<Type, fvPatchField, volMesh>& vf
173 const surfaceScalarField& blendingFactor =
174 this->mesh().objectRegistry::template
175 lookupObject<const surfaceScalarField>
177 word(vf.name() + "BlendingFactor")
180 if (tScheme1_().corrected())
182 if (tScheme2_().corrected())
187 * tScheme1_().correction(vf)
188 + (scalar(1.0) - blendingFactor)
189 * tScheme2_().correction(vf)
197 * tScheme1_().correction(vf)
201 else if (tScheme2_().corrected())
205 (scalar(1.0) - blendingFactor)
206 * tScheme2_().correction(vf)
211 return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 } // End namespace Foam
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 // ************************************************************************* //