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-2020 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  //- Copy constructor
116 
117  //- Construct and return a clone
118  virtual tmp<fvPatchField<Type>> clone() const
119  {
120  return tmp<fvPatchField<Type>>
121  (
122  new cyclicAMIFvPatchField<Type>(*this)
123  );
124  }
125 
126  //- Copy constructor setting internal field reference
128  (
131  );
132 
133  //- Construct and return a clone setting internal field reference
135  (
137  ) const
138  {
139  return tmp<fvPatchField<Type>>
140  (
141  new cyclicAMIFvPatchField<Type>(*this, iF)
142  );
143  }
144 
145 
146  // Member Functions
147 
148  // Access
149 
150  //- Return local reference cast into the cyclic AMI patch
151  const cyclicAMIFvPatch& cyclicAMIPatch() const
152  {
153  return cyclicAMIPatch_;
154  }
155 
156 
157  // Evaluation functions
158 
159  //- Return true if coupled. Note that the underlying patch
160  // is not coupled() - the points don't align.
161  virtual bool coupled() const;
162 
163  //- Return neighbour coupled internal cell data
164  virtual tmp<Field<Type>> patchNeighbourField() const;
165 
166  //- Return reference to neighbour patchField
168 
169  //- Update result field based on interface functionality
170  virtual void updateInterfaceMatrix
171  (
172  scalarField& result,
173  const scalarField& psiInternal,
174  const scalarField& coeffs,
175  const direction cmpt,
176  const Pstream::commsTypes commsType
177  ) const;
178 
179  //- Update result field based on interface functionality
180  virtual void updateInterfaceMatrix
181  (
182  Field<Type>&,
183  const Field<Type>&,
184  const scalarField&,
185  const Pstream::commsTypes commsType
186  ) const;
187 
188 
189  // Cyclic AMI coupled interface functions
190 
191  //- Return transformation between the coupled patches
192  virtual const transformer& transform() const
193  {
194  return cyclicAMIPatch_.transform();
195  }
196 
197  //- Return rank of component for transform
198  virtual int rank() const
199  {
200  return pTraits<Type>::rank;
201  }
202 
203 
204  // I-O
205 
206  //- Write
207  virtual void write(Ostream& os) const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #ifdef NoRepository
218  #include "cyclicAMIFvPatchField.C"
219 #endif
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
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 and rotations 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:158
commsTypes
Types of communications.
Definition: UPstream.H:64
Cyclic patch for Arbitrary Mesh Interface (AMI)
uint8_t direction
Definition: direction.H:45
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
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 tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled internal cell data.
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
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
Namespace for OpenFOAM.