cyclicAMIFvPatchField.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 | Copyright (C) 2011-2016 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 Group
28  grpCoupledBoundaryConditions
29 
30 Description
31  This boundary condition enforces a cyclic condition between a pair of
32  boundaries, whereby communication between the patches is performed using
33  an arbitrary mesh interface (AMI) interpolation.
34 
35 Usage
36  Example of the boundary condition specification:
37  \verbatim
38  <patchName>
39  {
40  type cyclicAMI;
41  }
42  \endverbatim
43 
44 Note
45  The outer boundary of the patch pairs must be similar, i.e. if the owner
46  patch is transformed to the neighbour patch, the outer perimiter of each
47  patch should be identical (or very similar).
48 
49 See also
50  Foam::AMIInterpolation
51 
52 SourceFiles
53  cyclicAMIFvPatchField.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef cyclicAMIFvPatchField_H
58 #define cyclicAMIFvPatchField_H
59 
60 #include "coupledFvPatchField.H"
62 #include "cyclicAMIFvPatch.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class cyclicAMIFvPatchField Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 template<class Type>
75 :
76  virtual public cyclicAMILduInterfaceField,
77  public coupledFvPatchField<Type>
78 {
79  // Private data
80 
81  //- Local reference cast into the cyclic patch
82  const cyclicAMIFvPatch& cyclicAMIPatch_;
83 
84 
85  // Private Member Functions
86 
87  //- Return neighbour side field given internal fields
88  template<class Type2>
89  tmp<Field<Type2>> neighbourSideField
90  (
91  const Field<Type2>&
92  ) const;
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName(cyclicAMIFvPatch::typeName_());
99 
100 
101  // Constructors
102 
103  //- Construct from patch and internal field
105  (
106  const fvPatch&,
108  );
109 
110  //- Construct from patch, internal field and dictionary
112  (
113  const fvPatch&,
115  const dictionary&
116  );
117 
118  //- Construct by mapping given cyclicAMIFvPatchField onto a new patch
120  (
122  const fvPatch&,
124  const fvPatchFieldMapper&
125  );
126 
127  //- Construct as copy
129 
130  //- Construct and return a clone
131  virtual tmp<fvPatchField<Type>> clone() const
132  {
133  return tmp<fvPatchField<Type>>
134  (
135  new cyclicAMIFvPatchField<Type>(*this)
136  );
137  }
138 
139  //- Construct as copy setting internal field reference
141  (
144  );
145 
146  //- Construct and return a clone setting internal field reference
148  (
150  ) const
151  {
152  return tmp<fvPatchField<Type>>
153  (
154  new cyclicAMIFvPatchField<Type>(*this, iF)
155  );
156  }
157 
158 
159  // Member functions
160 
161  // Access
162 
163  //- Return local reference cast into the cyclic AMI patch
164  const cyclicAMIFvPatch& cyclicAMIPatch() const
165  {
166  return cyclicAMIPatch_;
167  }
168 
169 
170  // Evaluation functions
171 
172  //- Return true if coupled. Note that the underlying patch
173  // is not coupled() - the points don't align.
174  virtual bool coupled() const;
175 
176  //- Return neighbour coupled internal cell data
177  virtual tmp<Field<Type>> patchNeighbourField() const;
178 
179  //- Return reference to neighbour patchField
181 
182  //- Update result field based on interface functionality
183  virtual void updateInterfaceMatrix
184  (
185  scalarField& result,
186  const scalarField& psiInternal,
187  const scalarField& coeffs,
188  const direction cmpt,
189  const Pstream::commsTypes commsType
190  ) const;
191 
192  //- Update result field based on interface functionality
193  virtual void updateInterfaceMatrix
194  (
195  Field<Type>&,
196  const Field<Type>&,
197  const scalarField&,
198  const Pstream::commsTypes commsType
199  ) const;
200 
201 
202  // Cyclic AMI coupled interface functions
203 
204  //- Does the patch field perform the transformation
205  virtual bool doTransform() const
206  {
207  return
208  !(cyclicAMIPatch_.parallel() || pTraits<Type>::rank == 0);
209  }
210 
211  //- Return face transformation tensor
212  virtual const tensorField& forwardT() const
213  {
214  return cyclicAMIPatch_.forwardT();
215  }
216 
217  //- Return neighbour-cell transformation tensor
218  virtual const tensorField& reverseT() const
219  {
220  return cyclicAMIPatch_.reverseT();
221  }
222 
223  //- Return rank of component for transform
224  virtual int rank() const
225  {
226  return pTraits<Type>::rank;
227  }
228 
229 
230  // I-O
231 
232  //- Write
233  virtual void write(Ostream& os) const;
234 };
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #ifdef NoRepository
244  #include "cyclicAMIFvPatchField.C"
245 #endif
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
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.
virtual bool parallel() const
Are the cyclic planes parallel.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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.
virtual const tensorField & forwardT() const
Return face transformation tensor.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Traits class for primitives.
Definition: pTraits.H:50
virtual bool doTransform() const
Does the patch field perform the transformation.
Abstract base class for cyclic AMI coupled interfaces.
const cyclicAMIFvPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic AMI patch.
Pre-declare SubField and related Field type.
Definition: Field.H:57
virtual void write(Ostream &os) const
Write.
Foam::fvPatchFieldMapper.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
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:53
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const cyclicAMIFvPatchField< Type > & neighbourPatchField() const
Return reference to neighbour patchField.
cyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
Namespace for OpenFOAM.