localMin.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-2019 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::localMin
26 
27 Description
28  LocalMin-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  localMin.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef localMin_H
39 #define localMin_H
40 
42 #include "volFields.H"
43 #include "surfaceFields.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class localMin Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
55 class localMin
56 :
57  public surfaceInterpolationScheme<Type>
58 {
59 
60 public:
61 
62  //- Runtime type information
63  TypeName("localMin");
64 
65 
66  // Constructors
67 
68  //- Construct from mesh
69  localMin(const fvMesh& mesh)
70  :
71  surfaceInterpolationScheme<Type>(mesh)
72  {}
73 
74  //- Construct from Istream.
75  // The name of the flux field is read from the Istream and looked-up
76  // from the mesh objectRegistry
78  (
79  const fvMesh& mesh,
80  Istream& is
81  )
82  :
83  surfaceInterpolationScheme<Type>(mesh)
84  {}
85 
86  //- Construct from faceFlux and Istream
88  (
89  const fvMesh& mesh,
90  const surfaceScalarField& faceFlux,
91  Istream& is
92  )
93  :
94  surfaceInterpolationScheme<Type>(mesh)
95  {}
96 
97 
98  // Member Functions
99 
100  //- Return the interpolation weighting factors
102  (
104  ) const
105  {
107 
108  return tmp<surfaceScalarField>(nullptr);
109  }
110 
111  //- Return the face-interpolate of the given cell field
114  (
116  ) const
117  {
118  const fvMesh& mesh = vf.mesh();
119 
121  (
123  (
124  IOobject
125  (
126  "localMin::interpolate(" + vf.name() + ')',
127  mesh.time().timeName(),
128  mesh
129  ),
130  mesh,
131  vf.dimensions()
132  )
133  );
135 
136  const labelUList& own = mesh.owner();
137  const labelUList& nei = mesh.neighbour();
138 
139  forAll(vff, facei)
140  {
141  vff[facei] = minMod(vf[own[facei]], vf[nei[facei]]);
142  }
143 
145  Boundary& bff = vff.boundaryFieldRef();
146 
147  forAll(bff, patchi)
148  {
149  const fvPatchField<Type>& pf = vf.boundaryField()[patchi];
150  Field<Type>& pff = bff[patchi];
151 
152  if (pf.coupled())
153  {
155  const Field<Type>& pif = tpif();
156 
158  const Field<Type>& pnf = tpnf();
159 
160  forAll(pff, i)
161  {
162  pff[i] = minMod(pif[i], pnf[i]);
163  }
164  }
165  else
166  {
167  pff = pf;
168  }
169  }
170 
171  return tvff;
172  }
173 
174 
175  // Member Operators
176 
177  //- Disallow default bitwise assignment
178  void operator=(const localMin&) = delete;
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
Foam::surfaceFields.
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf) const
Return the face-interpolate of the given cell field.
Definition: localMin.H:113
TypeName("localMin")
Runtime type information.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
const word & name() const
Return name.
Definition: IOobject.H:295
const Boundary & boundaryField() const
Return const-reference to the boundary field.
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:626
const fvMesh & mesh() const
Return mesh reference.
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:239
void operator=(const localMin &)=delete
Disallow default bitwise assignment.
const labelUList & neighbour() const
Internal face neighbour.
Definition: fvMesh.H:284
virtual tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Definition: localMin.H:101
const dimensionSet & dimensions() const
Return dimensions.
Pre-declare SubField and related Field type.
Definition: Field.H:56
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField on the opposite patch of a coupled patch.
Definition: fvPatchField.H:412
virtual bool coupled() const
Return true if this patch field is coupled.
Definition: fvPatchField.H:313
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
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Definition: fvPatchField.C:194
const Mesh & mesh() const
Return mesh.
const labelUList & owner() const
Internal face owner.
Definition: fvMesh.H:278
Scalar minMod(const Scalar s1, const Scalar s2)
Definition: Scalar.H:227
label patchi
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
localMin(const fvMesh &mesh)
Construct from mesh.
Definition: localMin.H:68
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
A class for managing temporary objects.
Definition: PtrList.H:53
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
LocalMin-mean differencing scheme class.
Definition: localMin.H:54
Abstract base class for surface interpolation schemes.
Namespace for OpenFOAM.