slicedFvPatchField.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-2018 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::slicedFvPatchField
26 
27 Description
28  Specialization of fvPatchField which creates the underlying
29  fvPatchField as a slice of the given complete field.
30 
31  The destructor is wrapped to avoid deallocation of the storage of the
32  complete fields when this is destroyed.
33 
34  Should only used as a template argument for SlicedGeometricField.
35 
36 See also
37  Foam::fvPatchField
38 
39 SourceFiles
40  slicedFvPatchField.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef slicedFvPatchField_H
45 #define slicedFvPatchField_H
46 
47 #include "fvPatchField.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class slicedFvPatch Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class Type>
60 :
61  public fvPatchField<Type>
62 {
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("sliced");
68 
69 
70  // Constructors
71 
72  //- Construct from patch, internal field and field to slice
74  (
75  const fvPatch&,
77  const Field<Type>&
78  );
79 
80  //- Construct from patch and internal field. Assign value later.
82  (
83  const fvPatch&,
85  );
86 
87  //- Construct from patch, internal field and dictionary
89  (
90  const fvPatch&,
92  const dictionary&
93  );
94 
95  //- Construct by mapping the given slicedFvPatchField<Type>
96  // onto a new patch
98  (
100  const fvPatch&,
102  const fvPatchFieldMapper&
103  );
104 
105  //- Construct as copy
107 
108  //- Construct and return a clone
109  virtual tmp<fvPatchField<Type>> clone() const;
110 
111  //- Construct as copy setting internal field reference
113  (
116  );
117 
118  //- Construct and return a clone setting internal field reference
120  (
122  ) const;
123 
124 
125  //- Destructor
126  virtual ~slicedFvPatchField<Type>();
127 
128 
129  // Member functions
130 
131  // Attributes
132 
133  //- Return true if this patch field fixes a value.
134  // Needed to check if a level has to be specified while solving
135  // Poissons equations.
136  virtual bool fixesValue() const
137  {
138  return true;
139  }
140 
141  //- Return false: this patch field is not altered by assignment
142  virtual bool assignable() const
143  {
144  return false;
145  }
146 
147 
148  // Evaluation functions
149 
150  //- Return patch-normal gradient
151  virtual tmp<Field<Type>> snGrad() const;
152 
153  //- Update the coefficients associated with the patch field
154  // Sets Updated to true
155  virtual void updateCoeffs();
156 
157  //- Return internal field next to patch as patch field
158  virtual tmp<Field<Type>> patchInternalField() const;
159 
160  //- Return internal field next to patch as patch field
161  virtual void patchInternalField(Field<Type>&) const;
162 
163  //- Return neighbour coupled given internal cell data
165  (
166  const Field<Type>& iField
167  ) const;
168 
169  //- Return patchField of the values on the patch or on the
170  // opposite patch
171  virtual tmp<Field<Type>> patchNeighbourField() const;
172 
173  //- Initialise the evaluation of the patch field
174  virtual void initEvaluate
175  (
176  const Pstream::commsTypes commsType =
178  )
179  {}
180 
181  //- Evaluate the patch field, sets Updated to false
182  virtual void evaluate
183  (
184  const Pstream::commsTypes commsType =
186  )
187  {}
188 
189  //- Return the matrix diagonal coefficients corresponding to the
190  // evaluation of the value of this patchField with given weights
192  (
193  const tmp<scalarField>&
194  ) const;
195 
196  //- Return the matrix source coefficients corresponding to the
197  // evaluation of the value of this patchField with given weights
199  (
200  const tmp<scalarField>&
201  ) const;
202 
203  //- Return the matrix diagonal coefficients corresponding to the
204  // evaluation of the gradient of this patchField
205  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
206 
207  //- Return the matrix source coefficients corresponding to the
208  // evaluation of the gradient of this patchField
209  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
210 
211 
212  //- Write
213  virtual void write(Ostream&) const;
214 
215 
216  // Member operators
218  virtual void operator=(const UList<Type>&) {}
220  virtual void operator=(const fvPatchField<Type>&) {}
221  virtual void operator+=(const fvPatchField<Type>&) {}
222  virtual void operator-=(const fvPatchField<Type>&) {}
223  virtual void operator*=(const fvPatchField<scalar>&) {}
224  virtual void operator/=(const fvPatchField<scalar>&) {}
226  virtual void operator+=(const Field<Type>&) {}
227  virtual void operator-=(const Field<Type>&) {}
229  virtual void operator*=(const Field<scalar>&) {}
230  virtual void operator/=(const Field<scalar>&) {}
232  virtual void operator=(const Type&) {}
233  virtual void operator+=(const Type&) {}
234  virtual void operator-=(const Type&) {}
235  virtual void operator*=(const scalar) {}
236  virtual void operator/=(const scalar) {}
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #ifdef NoRepository
247  #include "slicedFvPatchField.C"
248 #endif
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #endif
253 
254 // ************************************************************************* //
Specialization of fvPatchField which creates the underlying fvPatchField as a slice of the given comp...
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets Updated to false.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
commsTypes
Types of communications.
Definition: UPstream.H:64
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField of the values on the patch or on the.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatchFieldMapper.
virtual void operator+=(const fvPatchField< Type > &)
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual void operator-=(const fvPatchField< Type > &)
virtual void write(Ostream &) const
Write.
TypeName("sliced")
Runtime type information.
virtual void operator*=(const fvPatchField< scalar > &)
virtual void operator/=(const fvPatchField< scalar > &)
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
slicedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const Field< Type > &)
Construct from patch, internal field and field to slice.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void initEvaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Initialise the evaluation of the patch field.
Namespace for OpenFOAM.
virtual void operator=(const UList< Type > &)