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