slicedFvPatchField.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-2017 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 Group
28  grpGenericBoundaryConditions
29 
30 Description
31  Specialization of fvPatchField which creates the underlying
32  fvPatchField as a slice of the given complete field.
33 
34  The destructor is wrapped to avoid deallocation of the storage of the
35  complete fields when this is destroyed.
36 
37  Should only used as a template argument for SlicedGeometricField.
38 
39 See also
40  Foam::fvPatchField
41 
42 SourceFiles
43  slicedFvPatchField.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef slicedFvPatchField_H
48 #define slicedFvPatchField_H
49 
50 #include "fvPatchField.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class slicedFvPatch Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Type>
63 :
64  public fvPatchField<Type>
65 {
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("sliced");
71 
72 
73  // Constructors
74 
75  //- Construct from patch, internal field and field to slice
77  (
78  const fvPatch&,
80  const Field<Type>&
81  );
82 
83  //- Construct from patch and internal field. Assign value later.
85  (
86  const fvPatch&,
88  );
89 
90  //- Construct from patch, internal field and dictionary
92  (
93  const fvPatch&,
95  const dictionary&
96  );
97 
98  //- Construct by mapping the given slicedFvPatchField<Type>
99  // onto a new patch
101  (
103  const fvPatch&,
105  const fvPatchFieldMapper&
106  );
107 
108  //- Construct as copy
110 
111  //- Construct and return a clone
112  virtual tmp<fvPatchField<Type>> clone() const;
113 
114  //- Construct as copy setting internal field reference
116  (
119  );
120 
121  //- Construct and return a clone setting internal field reference
123  (
125  ) const;
126 
127 
128  //- Destructor
129  virtual ~slicedFvPatchField<Type>();
130 
131 
132  // Member functions
133 
134  // Attributes
135 
136  //- Return true if this patch field fixes a value.
137  // Needed to check if a level has to be specified while solving
138  // Poissons equations.
139  virtual bool fixesValue() const
140  {
141  return true;
142  }
143 
144  //- Return false: this patch field is not altered by assignment
145  virtual bool assignable() const
146  {
147  return false;
148  }
149 
150 
151  // Evaluation functions
152 
153  //- Return patch-normal gradient
154  virtual tmp<Field<Type>> snGrad() const;
155 
156  //- Update the coefficients associated with the patch field
157  // Sets Updated to true
158  virtual void updateCoeffs();
159 
160  //- Return internal field next to patch as patch field
161  virtual tmp<Field<Type>> patchInternalField() const;
162 
163  //- Return internal field next to patch as patch field
164  virtual void patchInternalField(Field<Type>&) const;
165 
166  //- Return neighbour coupled given internal cell data
168  (
169  const Field<Type>& iField
170  ) const;
171 
172  //- Return patchField of the values on the patch or on the
173  // opposite patch
174  virtual tmp<Field<Type>> patchNeighbourField() const;
175 
176  //- Initialise the evaluation of the patch field
177  virtual void initEvaluate
178  (
179  const Pstream::commsTypes commsType =
181  )
182  {}
183 
184  //- Evaluate the patch field, sets Updated to false
185  virtual void evaluate
186  (
187  const Pstream::commsTypes commsType =
189  )
190  {}
191 
192  //- Return the matrix diagonal coefficients corresponding to the
193  // evaluation of the value of this patchField with given weights
195  (
196  const tmp<scalarField>&
197  ) const;
198 
199  //- Return the matrix source coefficients corresponding to the
200  // evaluation of the value of this patchField with given weights
202  (
203  const tmp<scalarField>&
204  ) const;
205 
206  //- Return the matrix diagonal coefficients corresponding to the
207  // evaluation of the gradient of this patchField
208  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
209 
210  //- Return the matrix source coefficients corresponding to the
211  // evaluation of the gradient of this patchField
212  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
213 
214 
215  //- Write
216  virtual void write(Ostream&) const;
217 
218 
219  // Member operators
221  virtual void operator=(const UList<Type>&) {}
223  virtual void operator=(const fvPatchField<Type>&) {}
224  virtual void operator+=(const fvPatchField<Type>&) {}
225  virtual void operator-=(const fvPatchField<Type>&) {}
226  virtual void operator*=(const fvPatchField<scalar>&) {}
227  virtual void operator/=(const fvPatchField<scalar>&) {}
229  virtual void operator+=(const Field<Type>&) {}
230  virtual void operator-=(const Field<Type>&) {}
232  virtual void operator*=(const Field<scalar>&) {}
233  virtual void operator/=(const Field<scalar>&) {}
235  virtual void operator=(const Type&) {}
236  virtual void operator+=(const Type&) {}
237  virtual void operator-=(const Type&) {}
238  virtual void operator*=(const scalar) {}
239  virtual void operator/=(const scalar) {}
240 };
241 
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 } // End namespace Foam
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #ifdef NoRepository
250  #include "slicedFvPatchField.C"
251 #endif
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 #endif
256 
257 // ************************************************************************* //
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 > &)