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-2016 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=Pstream::blocking
180  )
181  {}
182 
183  //- Evaluate the patch field, sets Updated to false
184  virtual void evaluate
185  (
186  const Pstream::commsTypes commsType=Pstream::blocking
187  )
188  {}
189 
190  //- Return the matrix diagonal coefficients corresponding to the
191  // evaluation of the value of this patchField with given weights
193  (
194  const tmp<scalarField>&
195  ) const;
196 
197  //- Return the matrix source coefficients corresponding to the
198  // evaluation of the value of this patchField with given weights
200  (
201  const tmp<scalarField>&
202  ) const;
203 
204  //- Return the matrix diagonal coefficients corresponding to the
205  // evaluation of the gradient of this patchField
206  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
207 
208  //- Return the matrix source coefficients corresponding to the
209  // evaluation of the gradient of this patchField
210  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
211 
212 
213  //- Write
214  virtual void write(Ostream&) const;
215 
216 
217  // Member operators
219  virtual void operator=(const UList<Type>&) {}
221  virtual void operator=(const fvPatchField<Type>&) {}
222  virtual void operator+=(const fvPatchField<Type>&) {}
223  virtual void operator-=(const fvPatchField<Type>&) {}
224  virtual void operator*=(const fvPatchField<scalar>&) {}
225  virtual void operator/=(const fvPatchField<scalar>&) {}
227  virtual void operator+=(const Field<Type>&) {}
228  virtual void operator-=(const Field<Type>&) {}
230  virtual void operator*=(const Field<scalar>&) {}
231  virtual void operator/=(const Field<scalar>&) {}
233  virtual void operator=(const Type&) {}
234  virtual void operator+=(const Type&) {}
235  virtual void operator-=(const Type&) {}
236  virtual void operator*=(const scalar) {}
237  virtual void operator/=(const scalar) {}
238 };
239 
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 } // End namespace Foam
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #ifdef NoRepository
248  #include "slicedFvPatchField.C"
249 #endif
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 #endif
254 
255 // ************************************************************************* //
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Specialization of fvPatchField which creates the underlying fvPatchField as a slice of the given comp...
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
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::blocking)
Evaluate the patch field, sets Updated to false.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
Pre-declare SubField and related Field type.
Definition: Field.H:57
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
virtual void write(Ostream &) const
Write.
Foam::fvPatchFieldMapper.
virtual void operator+=(const fvPatchField< Type > &)
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) 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 tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual void operator-=(const fvPatchField< Type > &)
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual void initEvaluate(const Pstream::commsTypes commsType=Pstream::blocking)
Initialise the evaluation of the patch field.
TypeName("sliced")
Runtime type information.
virtual void operator*=(const fvPatchField< scalar > &)
virtual void operator/=(const fvPatchField< scalar > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
slicedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const Field< Type > &)
Construct from patch, internal field and field to slice.
A class for managing temporary objects.
Definition: PtrList.H:54
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField of the values on the patch or on the.
Namespace for OpenFOAM.
virtual void operator=(const UList< Type > &)