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 -------------------------------------------------------------------------------
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::localMax
28 
29 Group
30  grpFvSurfaceInterpolationSchemes
31 
32 Description
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 
38 SourceFiles
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 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class localMax Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class Type>
60 class localMax
61 :
62  public surfaceInterpolationScheme<Type>
63 {
64  // Private Member Functions
65 
66  //- No copy assignment
67  void operator=(const localMax&) = delete;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("localMax");
74 
75 
76  // Constructors
77 
78  //- Construct from mesh
79  localMax(const fvMesh& mesh)
80  :
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  :
94  {}
95 
96  //- Construct from faceFlux and Istream
98  (
99  const fvMesh& mesh,
100  const surfaceScalarField& faceFlux,
101  Istream& is
102  )
103  :
105  {}
106 
107 
108  // Member Functions
109 
110  //- Return the interpolation weighting factors
112  (
114  ) const
115  {
117 
118  return tmp<surfaceScalarField>(nullptr);
119  }
120 
121  //- Return the face-interpolate of the given cell field
124  (
126  ) const
127  {
128  const fvMesh& mesh = vf.mesh();
129 
131  (
133  (
134  IOobject
135  (
136  "localMax::interpolate(" + vf.name() + ')',
137  mesh.time().timeName(),
138  mesh
139  ),
140  mesh,
141  vf.dimensions()
142  )
143  );
145 
146  const labelUList& own = mesh.owner();
147  const labelUList& nei = mesh.neighbour();
148 
149  forAll(vff, facei)
150  {
151  vff[facei] = max(vf[own[facei]], vf[nei[facei]]);
152  }
153 
155  Boundary& bff = vff.boundaryFieldRef();
156 
157  forAll(bff, patchi)
158  {
159  const fvPatchField<Type>& pf = vf.boundaryField()[patchi];
160  Field<Type>& pff = bff[patchi];
161 
162  if (pf.coupled())
163  {
165  const Field<Type>& pif = tpif();
166 
168  const Field<Type>& pnf = tpnf();
169 
170  forAll(pff, i)
171  {
172  pff[i] = max(pif[i], pnf[i]);
173  }
174  }
175  else
176  {
177  pff = pf;
178  }
179  }
180 
181  return tvff;
182  }
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
Foam::localMax::localMax
localMax(const fvMesh &mesh)
Construct from mesh.
Definition: localMax.H:78
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
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::localMax::weights
virtual tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Definition: localMax.H:111
surfaceFields.H
Foam::surfaceFields.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::fvPatchField::coupled
virtual bool coupled() const
Return true if this patch field is coupled.
Definition: fvPatchField.H:345
Foam::localMax
LocalMax-mean differencing scheme class.
Definition: localMax.H:59
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:227
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::fvPatchField::patchInternalField
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Definition: fvPatchField.C:233
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::fvMesh::neighbour
const labelUList & neighbour() const
Internal face neighbour.
Definition: fvMesh.H:413
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::owner
const labelUList & owner() const
Internal face owner. Note bypassing virtual mechanism so.
Definition: fvMesh.H:407
Foam::fvPatchField::patchNeighbourField
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField on the opposite patch of a coupled patch.
Definition: fvPatchField.H:448
Foam::GeometricField::boundaryFieldRef
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Definition: GeometricField.C:783
Foam::UList< label >
Foam::surfaceInterpolationScheme
Abstract base class for surface interpolation schemes.
Definition: surfaceInterpolationScheme.H:57
Foam::localMax::interpolate
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:123
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
Foam::localMax::TypeName
TypeName("localMax")
Runtime type information.
Foam::GeometricField< scalar, fvsPatchField, surfaceMesh >
surfaceInterpolationScheme.H
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62