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 | Copyright (C) 2011-2015 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::localMax
26 
27 Description
28  LocalMax-mean differencing scheme class.
29 
30  This scheme interpolates 1/field using a scheme specified at run-time
31  and return the reciprocal of the interpolate.
32 
33 SourceFiles
34  localMax.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef localMax_H
39 #define localMax_H
40 
42 #include "volFields.H"
43 #include "surfaceFields.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class localMax Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
55 class localMax
56 :
57  public surfaceInterpolationScheme<Type>
58 {
59  // Private Member Functions
60 
61  //- Disallow default bitwise assignment
62  void operator=(const localMax&);
63 
64 
65 public:
66 
67  //- Runtime type information
68  TypeName("localMax");
69 
70 
71  // Constructors
72 
73  //- Construct from mesh
74  localMax(const fvMesh& mesh)
75  :
77  {}
78 
79  //- Construct from Istream.
80  // The name of the flux field is read from the Istream and looked-up
81  // from the mesh objectRegistry
83  (
84  const fvMesh& mesh,
85  Istream& is
86  )
87  :
89  {}
90 
91  //- Construct from faceFlux and Istream
93  (
94  const fvMesh& mesh,
95  const surfaceScalarField& faceFlux,
96  Istream& is
97  )
98  :
100  {}
101 
102 
103  // Member Functions
104 
105  //- Return the interpolation weighting factors
107  (
109  ) const
110  {
112 
113  return tmp<surfaceScalarField>(NULL);
114  }
115 
116  //- Return the face-interpolate of the given cell field
119  (
121  ) const
122  {
123  const fvMesh& mesh = vf.mesh();
124 
126  (
128  (
129  IOobject
130  (
131  "localMax::interpolate(" + vf.name() + ')',
132  mesh.time().timeName(),
133  mesh
134  ),
135  mesh,
136  vf.dimensions()
137  )
138  );
140 
141  forAll(vff.boundaryField(), patchi)
142  {
143  vff.boundaryField()[patchi] = vf.boundaryField()[patchi];
144  }
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 
154  return tvff;
155  }
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
Foam::localMax::localMax
localMax(const fvMesh &mesh)
Construct from mesh.
Definition: localMax.H:73
volFields.H
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
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::localMax::weights
virtual tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Definition: localMax.H:106
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
surfaceFields.H
Foam::surfaceFields.
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
Foam::localMax
LocalMax-mean differencing scheme class.
Definition: localMax.H:54
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::fvMesh::neighbour
const labelUList & neighbour() const
Internal face neighbour.
Definition: fvMesh.H:288
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::localMax::operator=
void operator=(const localMax &)
Disallow default bitwise assignment.
Foam::fvMesh::owner
const labelUList & owner() const
Internal face owner.
Definition: fvMesh.H:282
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
patchi
label patchi
Definition: getPatchFieldScalar.H:1
Foam::surfaceInterpolationScheme
Abstract base class for surface interpolation schemes.
Definition: surfaceInterpolationScheme.H:55
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:118
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::localMax::TypeName
TypeName("localMax")
Runtime type information.
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
surfaceInterpolationScheme.H