slicedFaPatchField.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 OpenFOAM Foundation
9  Copyright (C) 2023 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::slicedFaPatchField
29 
30 Group
31  grpGenericBoundaryConditions
32 
33 Description
34  Specialization of faPatchField which creates the underlying
35  faPatchField 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::faPatchField
44 
45 SourceFiles
46  slicedFaPatchField.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef Foam_slicedFaPatchField_H
51 #define Foam_slicedFaPatchField_H
52 
53 #include "faPatchField.H"
54 #include "processorFaPatch.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class slicedFaPatchField Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Type>
66 class slicedFaPatchField
67 :
68  public faPatchField<Type>
69 {
70 public:
71 
72  //- Type for the mesh processor patch
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 faPatch&,
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 faPatch&,
96  );
97 
98  //- Construct from patch, internal field and dictionary
100  (
101  const faPatch&,
103  const dictionary&
104  );
105 
106  //- Construct by mapping the given sliced patch field
107  //- onto a new patch
109  (
111  const faPatch&,
113  const faPatchFieldMapper&
114  );
115 
116  //- Construct as copy
118 
119  //- Construct and return a clone
120  virtual tmp<faPatchField<Type>> clone() const;
121 
122  //- Construct as copy setting internal field reference
124  (
127  );
128 
129  //- Construct and return a clone setting internal field reference
131  (
133  ) const;
134 
135 
136  //- Destructor
137  virtual ~slicedFaPatchField<Type>();
138 
139 
140  // Member Functions
141 
142  //- True: this patch field fixes a value.
143  virtual bool fixesValue() const { return true; }
144 
145  //- False: this patch field is not altered by assignment.
146  virtual bool assignable() const { return false; }
147 
148 
149  // Evaluation functions
150 
151  //- Return patch-normal gradient
152  virtual tmp<Field<Type>> snGrad() const;
153 
154  //- Return internal field next to patch as patch field
155  virtual tmp<Field<Type>> patchInternalField() const;
156 
157  //- Return internal field next to patch as patch field
158  virtual void patchInternalField(Field<Type>&) const;
159 
160  //- Return neighbour coupled given internal cell data
161  virtual tmp<Field<Type>> patchNeighbourField
162  (
163  const Field<Type>& iField
164  ) const;
165 
166  //- Return patchField of the values on the patch or on the
167  // opposite patch
168  virtual tmp<Field<Type>> patchNeighbourField() const;
169 
170  //- Initialise the evaluation of the patch field
171  virtual void initEvaluate
172  (
173  const Pstream::commsTypes commsType =
175  )
176  {}
177 
178  //- Evaluate the patch field, sets updated() to false
179  virtual void evaluate
180  (
181  const Pstream::commsTypes commsType =
183  )
184  {}
185 
186  //- Return the matrix diagonal coefficients corresponding to the
187  // evaluation of the value of this patchField with given weights
188  virtual tmp<Field<Type>> valueInternalCoeffs
189  (
190  const tmp<scalarField>&
191  ) const;
192 
193  //- Return the matrix source coefficients corresponding to the
194  // evaluation of the value of this patchField with given weights
195  virtual tmp<Field<Type>> valueBoundaryCoeffs
196  (
197  const tmp<scalarField>&
198  ) const;
199 
200  //- Return the matrix diagonal coefficients corresponding to the
201  // evaluation of the gradient of this patchField
202  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
203 
204  //- Return the matrix source coefficients corresponding to the
205  // evaluation of the gradient of this patchField
207 
208 
209  //- Write
210  virtual void write(Ostream&) const;
211 
212 
213  // Member Operators
214 
215  virtual void operator=(const UList<Type>&) {}
217  virtual void operator=(const faPatchField<Type>&) {}
218  virtual void operator+=(const faPatchField<Type>&) {}
219  virtual void operator-=(const faPatchField<Type>&) {}
220  virtual void operator*=(const faPatchField<scalar>&) {}
221  virtual void operator/=(const faPatchField<scalar>&) {}
222 
223  virtual void operator+=(const Field<Type>&) {}
224  virtual void operator-=(const Field<Type>&) {}
225 
226  virtual void operator*=(const Field<scalar>&) {}
227  virtual void operator/=(const Field<scalar>&) {}
228 
229  virtual void operator=(const Type&) {}
230  virtual void operator+=(const Type&) {}
231  virtual void operator-=(const Type&) {}
232  virtual void operator*=(const scalar) {}
233  virtual void operator/=(const scalar) {}
234 };
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #ifdef NoRepository
244  #include "slicedFaPatchField.C"
245 #endif
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field, sets updated() to false.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
"blocking" : (MPI_Bsend, MPI_Recv)
Specialization of faPatchField which creates the underlying faPatchField as a slice of the given comp...
virtual bool assignable() const
False: this patch field is not altered by assignment.
commsTypes
Communications types.
Definition: UPstream.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField of the values on the patch or on the.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:56
virtual void operator*=(const faPatchField< scalar > &)
virtual tmp< faPatchField< 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.
virtual void operator-=(const faPatchField< Type > &)
Generic templated field type.
Definition: Field.H:62
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual bool fixesValue() const
True: this patch field fixes a value.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
TypeName("sliced")
Runtime type information.
virtual void write(Ostream &) const
Write.
processorFaPatch processorPatchType
Type for the mesh processor patch.
virtual void operator/=(const faPatchField< scalar > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
slicedFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &, const Field< Type > &completeOrBoundaryField, const bool isBoundaryOnly=false)
Construct from patch, internal field and field to slice.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A FieldMapper for finite-area patch fields.
virtual void operator=(const UList< Type > &)
virtual void initEvaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Initialise the evaluation of the patch field.
virtual void operator+=(const faPatchField< Type > &)
Namespace for OpenFOAM.
Processor patch.