cyclicAMIFvPatchField.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-2022 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::cyclicAMIFvPatchField
26 
27 Description
28  This boundary condition enforces a cyclic condition between a pair of
29  boundaries, whereby communication between the patches is performed using
30  an arbitrary mesh interface (AMI) interpolation.
31 
32 Usage
33  Example of the boundary condition specification:
34  \verbatim
35  <patchName>
36  {
37  type cyclicAMI;
38  }
39  \endverbatim
40 
41  Note:
42  The outer boundary of the patch pairs must be similar, i.e. if the owner
43  patch is transformed to the neighbour patch, the outer perimeter of each
44  patch should be identical (or very similar).
45 
46 See also
47  Foam::AMIInterpolation
48 
49 SourceFiles
50  cyclicAMIFvPatchField.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef cyclicAMIFvPatchField_H
55 #define cyclicAMIFvPatchField_H
56 
57 #include "coupledFvPatchField.H"
59 #include "cyclicAMIFvPatch.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class cyclicAMIFvPatchField Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 template<class Type>
72 :
73  public coupledFvPatchField<Type>,
75 {
76  // Private Data
77 
78  //- Local reference cast into the cyclic patch
79  const cyclicAMIFvPatch& cyclicAMIPatch_;
80 
81 
82 public:
83 
84  //- Runtime type information
85  TypeName(cyclicAMIFvPatch::typeName_());
86 
87 
88  // Constructors
89 
90  //- Construct from patch and internal field
92  (
93  const fvPatch&,
95  );
96 
97  //- Construct from patch, internal field and dictionary
99  (
100  const fvPatch&,
102  const dictionary&
103  );
104 
105  //- Construct by mapping given cyclicAMIFvPatchField onto a new patch
107  (
109  const fvPatch&,
111  const fvPatchFieldMapper&
112  );
113 
114  //- Disallow copy without setting internal field reference
116 
117  //- Copy constructor setting internal field reference
119  (
122  );
123 
124  //- Construct and return a clone setting internal field reference
126  (
128  ) const
129  {
130  return tmp<fvPatchField<Type>>
131  (
132  new cyclicAMIFvPatchField<Type>(*this, iF)
133  );
134  }
135 
136 
137  // Member Functions
138 
139  // Access
140 
141  //- Return local reference cast into the cyclic AMI patch
142  const cyclicAMIFvPatch& cyclicAMIPatch() const
143  {
144  return cyclicAMIPatch_;
145  }
146 
147 
148  // Evaluation functions
149 
150  //- Return true if coupled. Note that the underlying patch
151  // is not coupled() - the points don't align.
152  virtual bool coupled() const;
153 
154  //- Return neighbour coupled internal cell data
156  (
157  const Pstream::commsTypes
158  ) const;
159 
160  //- Return reference to neighbour patchField
162 
163  //- Update result field based on interface functionality
164  virtual void updateInterfaceMatrix
165  (
166  scalarField& result,
167  const scalarField& psiInternal,
168  const scalarField& coeffs,
169  const direction cmpt,
170  const Pstream::commsTypes commsType
171  ) const;
172 
173  //- Update result field based on interface functionality
174  virtual void updateInterfaceMatrix
175  (
176  Field<Type>&,
177  const Field<Type>&,
178  const scalarField&,
179  const Pstream::commsTypes commsType
180  ) const;
181 
182 
183  // Cyclic AMI coupled interface functions
184 
185  //- Return transformation between the coupled patches
186  virtual const transformer& transform() const
187  {
188  return cyclicAMIPatch_.transform();
189  }
190 
191  //- Return rank of component for transform
192  virtual int rank() const
193  {
194  return pTraits<Type>::rank;
195  }
196 
197 
198  // I-O
199 
200  //- Write
201  virtual void write(Ostream& os) const;
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #ifdef NoRepository
212  #include "cyclicAMIFvPatchField.C"
213 #endif
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
virtual bool coupled() const
Return true if coupled. Note that the underlying patch.
virtual void updateInterfaceMatrix(scalarField &result, const scalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
TypeName(cyclicAMIFvPatch::typeName_())
Runtime type information.
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
commsTypes
Types of communications.
Definition: UPstream.H:64
Cyclic patch for Arbitrary Mesh Interface (AMI)
uint8_t direction
Definition: direction.H:45
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Traits class for primitives.
Definition: pTraits.H:50
virtual const transformer & transform() const
Return transformation between the coupled patches.
Abstract base class for cyclic AMI coupled interfaces.
const cyclicAMIFvPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic AMI patch.
const cyclicAMIFvPatchField< Type > & nbrPatchField() const
Return reference to neighbour patchField.
virtual void write(Ostream &os) const
Write.
Foam::fvPatchFieldMapper.
Abstract base class for coupled patches.
virtual int rank() const
Return rank of component for transform.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual const transformer & transform() const
Return transformation between the coupled patches.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
cyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition: PtrList.H:53
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:199
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
Namespace for OpenFOAM.
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes) const
Return neighbour coupled internal cell data.