Loading...
Searching...
No Matches
localMax.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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::localMax
28
29Group
30 grpFvSurfaceInterpolationSchemes
31
32Description
33 LocalMax-mean differencing scheme class.
34
35 This scheme interpolates 1/field using a scheme specified at run-time
36 and return the reciprocal of the interpolate.
37
38SourceFiles
39 localMax.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef localMax_H
44#define localMax_H
45
47#include "volFields.H"
48#include "surfaceFields.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class localMax Declaration
57\*---------------------------------------------------------------------------*/
58
59template<class Type>
60class localMax
61:
62 public surfaceInterpolationScheme<Type>
63{
64 // Private Member Functions
65
66 //- No copy assignment
67 void operator=(const localMax&) = delete;
68
69
70public:
71
72 //- Runtime type information
73 TypeName("localMax");
74
75
76 // Constructors
77
78 //- Construct from mesh
79 localMax(const fvMesh& mesh)
80 :
81 surfaceInterpolationScheme<Type>(mesh)
82 {}
83
84 //- Construct from Istream.
85 // The name of the flux field is read from the Istream and looked-up
86 // from the mesh objectRegistry
88 (
89 const fvMesh& mesh,
90 Istream& is
91 )
92 :
93 surfaceInterpolationScheme<Type>(mesh)
94 {}
95
96 //- Construct from faceFlux and Istream
98 (
99 const fvMesh& mesh,
100 const surfaceScalarField& faceFlux,
101 Istream& is
102 )
104 surfaceInterpolationScheme<Type>(mesh)
105 {}
106
107
108 // Member Functions
109
110 //- Return the interpolation weighting factors
112 (
114 ) const
115 {
117 return nullptr;
118 }
120 //- Return the face-interpolate of the given cell field
123 (
125 ) const
126 {
127 const fvMesh& mesh = vf.mesh();
128
130 (
134 (
135 "localMax::interpolate(" + vf.name() + ')',
136 mesh.time().timeName(),
137 mesh
138 ),
139 mesh,
140 vf.dimensions()
141 )
142 );
144
145 const labelUList& own = mesh.owner();
146 const labelUList& nei = mesh.neighbour();
147
148 forAll(vff, facei)
149 {
150 vff[facei] = max(vf[own[facei]], vf[nei[facei]]);
151 }
152
154 Boundary& bff = vff.boundaryFieldRef();
155
156 forAll(bff, patchi)
157 {
158 const fvPatchField<Type>& pf = vf.boundaryField()[patchi];
159 Field<Type>& pff = bff[patchi];
160
161 if (pf.coupled())
162 {
164 const Field<Type>& pif = tpif();
165
167 const Field<Type>& pnf = tpnf();
168
169 forAll(pff, i)
170 {
171 pff[i] = max(pif[i], pnf[i]);
172 }
173 }
174 else
175 {
176 pff = pf;
177 }
178 }
179
180 return tvff;
181 }
182};
183
184
185// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187} // End namespace Foam
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191#endif
192
193// ************************************************************************* //
const Mesh & mesh() const noexcept
Return const reference to mesh.
const dimensionSet & dimensions() const noexcept
Return dimensions.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
Generic GeometricField class.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef().
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
virtual bool coupled() const
True if the patch field is coupled.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField on the opposite patch of a coupled patch.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch.
virtual tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Definition localMax.H:120
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf) const
Return the face-interpolate of the given cell field.
Definition localMax.H:133
TypeName("localMax")
Runtime type information.
localMax(const fvMesh &mesh, const surfaceScalarField &faceFlux, Istream &is)
Construct from faceFlux and Istream.
Definition localMax.H:104
localMax(const fvMesh &mesh)
Construct from mesh.
Definition localMax.H:80
localMax(const fvMesh &mesh, Istream &is)
Construct from Istream.
Definition localMax.H:92
const fvMesh & mesh() const
Return mesh reference.
A class for managing temporary objects.
Definition tmp.H:75
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
dynamicFvMesh & mesh
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
Foam::surfaceFields.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68