conformedFvPatchField.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-2024 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::conformedFvPatchField
26 
27 Description
28  This vol field boundary condition holds data from both the original
29  faces and any associated non-conformal faces, with the latter mapped to the
30  conformal faces in the original patch. It is used during mesh change
31  (between the un-stitch and stitch steps) to ensure that fields relating to
32  both the original and the non-conformal patches are retained and mapped.
33 
34 SourceFiles
35  conformedFvPatchField.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef conformedFvPatchField_H
40 #define conformedFvPatchField_H
41 
42 #include "fvPatchField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class conformedFvPatch Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class Type>
55 :
56  public fvPatchField<Type>
57 {
58  // Private Data
59 
60  //- The original patch field
61  autoPtr<fvPatchField<Type>> origFieldPtr_;
62 
63  //- The non-conformal patch fields
64  PtrList<fvPatchField<Type>> ncFieldPtrs_;
65 
66  //- The coverage for the non-conformal patch fields
67  PtrList<scalarField> ncCoverages_;
68 
69 
70  // Private Static Member Functions
71 
72  //- Map from the non-conformal patch index to the index stored within
73  // the conformed patch field on the original patch
74  static labelList ncOrigNcField(const fvBoundaryMesh& fvbm);
75 
76 
77  // Private Constructors
78 
79  //- Construct from components
81  (
82  const fvPatch&,
84  autoPtr<fvPatchField<Type>>&& origFieldPtr,
85  PtrList<fvPatchField<Type>>&& ncFieldPtrs,
86  PtrList<scalarField>&& ncCoverages
87  );
88 
89 
90  // Private Member Functions
91 
92  //- Return the indices of the patches associated with the non-conformal
93  // patch fields
94  labelList ncPatchIndices() const;
95 
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("conformed");
102 
103 
104  // Static Member Functions
105 
106  //- Conform the given boundary field
107  static void conform(typename VolField<Type>::Boundary& bF);
108 
109  //- Un-conform the given boundary field
110  static void unconform(typename VolField<Type>::Boundary& bF);
111 
112 
113  // Constructors
114 
115  //- Construct from patch and internal field
117  (
118  const fvPatch&,
120  );
121 
122  //- Construct from patch, internal field and dictionary
124  (
125  const fvPatch&,
127  const dictionary&
128  );
129 
130  //- Construct by mapping the given conformedFvPatchField<Type>
131  // onto a new patch
133  (
135  const fvPatch&,
137  const fieldMapper&
138  );
139 
140  //- Disallow copy without setting internal field reference
142  (
144  ) = delete;
145 
146  //- Copy constructor setting internal field reference
148  (
151  );
152 
153  //- Construct and return a clone setting internal field reference
155  (
157  ) const
158  {
159  return tmp<fvPatchField<Type>>
160  (
161  new conformedFvPatchField<Type>(*this, iF)
162  );
163  }
164 
165 
166  // Member Functions
167 
168  // Mapping functions
169 
170  //- Map the given fvPatchField onto this fvPatchField
171  virtual void map(const fvPatchField<Type>&, const fieldMapper&);
172 
173  //- Reset the fvPatchField to the given fvPatchField
174  // Used for mesh to mesh mapping
175  virtual void reset(const fvPatchField<Type>&);
176 
177 
178  // Attributes
179 
180  //- Return true if this patch field fixes a value.
181  // Needed to check if a level has to be specified while solving
182  // Poissons equations.
183  virtual bool fixesValue() const
184  {
185  return origFieldPtr_->fixesValue();
186  }
187 
188  //- Return true if the value of the patch field
189  // is altered by assignment (the default)
190  virtual bool assignable() const
191  {
192  return origFieldPtr_->assignable();
193  }
194 
195  //- Return true if this patch field is coupled
196  virtual bool coupled() const
197  {
198  return origFieldPtr_->coupled();
199  }
200 
201  //- Return true if this overrides the underlying constraint type
202  bool overridesConstraint() const
203  {
204  return origFieldPtr_->overridesConstraint();
205  }
206 
207 
208  // Evaluation functions
209 
210  //- Return patch-normal gradient
211  virtual tmp<Field<Type>> snGrad() const
212  {
213  return origFieldPtr_->snGrad();
214  }
215 
216  //- Initialise the evaluation of the patch field
217  virtual void initEvaluate
218  (
219  const Pstream::commsTypes commsType =
221  )
222  {
223  origFieldPtr_->initEvaluate(commsType);
224  }
225 
226  //- Evaluate the patch field, sets Updated to false
227  virtual void evaluate
228  (
229  const Pstream::commsTypes commsType =
231  )
232  {
233  origFieldPtr_->evaluate(commsType);
234  }
235 
236  //- Return the matrix diagonal coefficients corresponding to the
237  // evaluation of the value of this patchField with given weights
239  (
240  const tmp<Field<scalar>>& weights
241  ) const
242  {
243  return origFieldPtr_->valueInternalCoeffs(weights);
244  }
245 
246  //- Return the matrix source coefficients corresponding to the
247  // evaluation of the value of this patchField with given weights
249  (
250  const tmp<Field<scalar>>& weights
251  ) const
252  {
253  return origFieldPtr_->valueBoundaryCoeffs(weights);
254  }
255 
256  //- Return the matrix diagonal coefficients corresponding to the
257  // evaluation of the gradient of this patchField
258  virtual tmp<Field<Type>> gradientInternalCoeffs() const
259  {
260  return origFieldPtr_->gradientInternalCoeffs();
261  }
262 
263  //- Return the matrix source coefficients corresponding to the
264  // evaluation of the gradient of this patchField
265  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const
266  {
267  return origFieldPtr_->gradientBoundaryCoeffs();
268  }
269 
270 
271  //- Write
272  virtual void write(Ostream&) const;
273 };
274 
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 } // End namespace Foam
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #ifdef NoRepository
283  #include "conformedFvPatchField.C"
284 #endif
285 
286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 
288 #endif
289 
290 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricBoundaryField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
commsTypes
Types of communications.
Definition: UPstream.H:65
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
This vol field boundary condition holds data from both the original faces and any associated non-conf...
virtual void initEvaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Initialise the evaluation of the patch field.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual void write(Ostream &) const
Write.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking)
Evaluate the patch field, sets Updated to false.
TypeName("conformed")
Runtime type information.
virtual bool coupled() const
Return true if this patch field is coupled.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< Field< scalar >> &weights) const
Return the matrix source coefficients corresponding to the.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< Field< scalar >> &weights) const
Return the matrix diagonal coefficients corresponding to the.
static void conform(typename VolField< Type >::Boundary &bF)
Conform the given boundary field.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
bool overridesConstraint() const
Return true if this overrides the underlying constraint type.
static void unconform(typename VolField< Type >::Boundary &bF)
Un-conform the given boundary field.
virtual bool assignable() const
Return true if the value of the patch field.
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Foam::fvBoundaryMesh.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:204
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.