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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2017-2025 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::slicedFvPatchField
29 
30 Group
31  grpGenericBoundaryConditions
32 
33 Description
34  Specialization of fvPatchField which creates the underlying
35  fvPatchField as a slice of the given complete field.
36 
37  The destructor is wrapped to avoid deallocation of the storage of the
38  complete fields when this is destroyed.
39 
40  Should only used as a template argument for SlicedGeometricField.
41 
42 See also
43  Foam::fvPatchField
44 
45 SourceFiles
46  slicedFvPatchField.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef Foam_slicedFvPatchField_H
51 #define Foam_slicedFvPatchField_H
52 
53 #include "fvPatchField.H"
54 #include "processorFvPatch.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class slicedFvPatchField Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Type>
67 :
68  public fvPatchField<Type>
69 {
70 public:
71 
72  //- The mesh processor patch type
74 
75 
76  //- Runtime type information
77  TypeName("sliced");
78 
79 
80  // Constructors
81 
82  //- Construct from patch, internal field and field to slice
84  (
85  const fvPatch&,
87  const Field<Type>& completeOrBoundaryField,
88  const bool isBoundaryOnly = false
89  );
90 
91  //- Construct from patch and internal field. Assign value later.
93  (
94  const fvPatch&,
96  );
97 
98  //- Construct from patch, internal field and dictionary
100  (
101  const fvPatch&,
103  const dictionary&
104  );
105 
106  //- Construct by mapping the given sliced patch field onto a new patch
108  (
110  const fvPatch&,
112  const fvPatchFieldMapper&
113  );
114 
115  //- Construct as copy
117 
118  //- Construct as copy setting internal field reference
120  (
123  );
124 
125  //- Return a clone
126  virtual tmp<fvPatchField<Type>> clone() const
127  {
128  return fvPatchField<Type>::Clone(*this);
129  }
130 
131  //- Clone with an internal field reference
133  (
135  ) const
136  {
137  return fvPatchField<Type>::Clone(*this, iF);
138  }
140 
141  //- Destructor, resets pointers to avoid deletion of underlying field
142  virtual ~slicedFvPatchField();
143 
144 
145  // Member Functions
146 
147  //- True: this patch field fixes a value.
148  virtual bool fixesValue() const { return true; }
149 
150  //- False: this patch field is not altered by assignment.
151  virtual bool assignable() const { return false; }
152 
153 
154  // Evaluation Functions
155 
156  //- Return patch-normal gradient
157  virtual tmp<Field<Type>> snGrad() const;
158 
159  //- Return internal field next to patch
160  virtual tmp<Field<Type>> patchInternalField() const;
161 
162  //- Retrieve internal field next to patch
163  virtual void patchInternalField(UList<Type>&) const;
164 
165  //- Return patchField on the opposite patch of a coupled patch
166  virtual tmp<Field<Type>> patchNeighbourField() const;
168  //- Retrieve neighbour coupled field
169  virtual void patchNeighbourField(UList<Type>&) const;
170 
171  //- Initialise the evaluation of the patch field
172  virtual void initEvaluate
173  (
174  const Pstream::commsTypes commsType =
176  )
177  {}
178 
179  //- Evaluate the patch field, sets updated() to false
180  virtual void evaluate
181  (
182  const Pstream::commsTypes commsType =
184  )
185  {}
186 
187  //- Return the matrix diagonal coefficients corresponding to the
188  // evaluation of the value of this patchField with given weights
189  virtual tmp<Field<Type>> valueInternalCoeffs
190  (
191  const tmp<scalarField>&
192  ) const;
193 
194  //- Return the matrix source coefficients corresponding to the
195  // evaluation of the value of this patchField with given weights
196  virtual tmp<Field<Type>> valueBoundaryCoeffs
197  (
198  const tmp<scalarField>&
199  ) const;
200 
201  //- Return the matrix diagonal coefficients corresponding to the
202  // evaluation of the gradient of this patchField
203  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
204 
205  //- Return the matrix source coefficients corresponding to the
206  // evaluation of the gradient of this patchField
207  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
208 
209 
210  //- Write
211  virtual void write(Ostream&) const;
212 
213 
214  // Member operators
215 
216  virtual void operator=(const UList<Type>&) {}
217 
218  virtual void operator=(const fvPatchField<Type>&) {}
219  virtual void operator+=(const fvPatchField<Type>&) {}
220  virtual void operator-=(const fvPatchField<Type>&) {}
221  virtual void operator*=(const fvPatchField<scalar>&) {}
222  virtual void operator/=(const fvPatchField<scalar>&) {}
223 
224  virtual void operator+=(const Field<Type>&) {}
225  virtual void operator-=(const Field<Type>&) {}
226 
227  virtual void operator*=(const Field<scalar>&) {}
228  virtual void operator/=(const Field<scalar>&) {}
229 
230  virtual void operator=(const Type&) {}
231  virtual void operator+=(const Type&) {}
232  virtual void operator-=(const Type&) {}
233  virtual void operator*=(const scalar) {}
234  virtual void operator/=(const scalar) {}
235 };
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #ifdef NoRepository
245  #include "slicedFvPatchField.C"
246 #endif
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
virtual ~slicedFvPatchField()
Destructor, resets pointers to avoid deletion of underlying field.
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.
virtual bool assignable() const
False: this patch field is not altered by assignment.
slicedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const Field< Type > &completeOrBoundaryField, const bool isBoundaryOnly=false)
Construct from patch, internal field and field to slice.
processorFvPatch processorPatchType
The mesh processor patch type.
commsTypes
Communications types.
Definition: UPstream.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField on the opposite patch of a coupled patch.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:607
Generic templated field type.
Definition: Field.H:63
A FieldMapper for finite-volume patch fields.
Processor patch.
virtual void operator+=(const fvPatchField< Type > &)
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual void initEvaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Initialise the evaluation of the patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual bool fixesValue() const
True: 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.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
"buffered" : (MPI_Bsend, MPI_Recv)
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field, sets updated() to false.
Namespace for OpenFOAM.
virtual void operator=(const UList< Type > &)