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
84 
85 
86  // Private Member Functions
87 
88  //- Return neighbour side field given internal fields
89  template<class Type2>
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
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 // ************************************************************************* //
Foam::cyclicAMIFvPatchField::doTransform
virtual bool doTransform() const
Does the patch field perform the transformation.
Definition: cyclicAMIFvPatchField.H:205
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::cyclicAMIFvPatchField::neighbourSideField
tmp< Field< Type2 > > neighbourSideField(const Field< Type2 > &) const
Return neighbour side field given internal fields.
Foam::cyclicAMILduInterfaceField
Abstract base class for cyclic AMI coupled interfaces.
Definition: cyclicAMILduInterfaceField.H:48
Foam::cyclicAMIFvPatchField::cyclicAMIPatch_
const cyclicAMIFvPatch & cyclicAMIPatch_
Local reference cast into the cyclic patch.
Definition: cyclicAMIFvPatchField.H:82
cyclicAMIFvPatchField.C
Foam::cyclicAMIFvPatchField::updateInterfaceMatrix
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.
Definition: cyclicAMIFvPatchField.C:180
Foam::cyclicAMIFvPatchField::write
virtual void write(Ostream &os) const
Write.
Definition: cyclicAMIFvPatchField.C:254
Foam::cyclicAMIFvPatchField::rank
virtual int rank() const
Return rank of component for transform.
Definition: cyclicAMIFvPatchField.H:224
Foam::cyclicAMIFvPatchField
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
Definition: cyclicAMIFvPatchField.H:74
cyclicAMILduInterfaceField.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::cyclicAMIFvPatchField::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicAMIFvPatchField.H:212
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::cyclicAMIFvPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicAMIFvPatch.H:142
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::cyclicAMIFvPatchField::cyclicAMIPatch
const cyclicAMIFvPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic AMI patch.
Definition: cyclicAMIFvPatchField.H:164
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::cyclicAMIFvPatchField::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicAMIFvPatchField.H:218
Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField
cyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: cyclicAMIFvPatchField.C:30
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:64
Foam::coupledFvPatchField
Abstract base class for coupled patches.
Definition: coupledFvPatchField.H:54
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
Foam::cyclicAMIFvPatchField::coupled
virtual bool coupled() const
Return true if coupled. Note that the underlying patch.
Definition: cyclicAMIFvPatchField.C:126
Foam::cyclicAMIFvPatchField::TypeName
TypeName(cyclicAMIFvPatch::typeName_())
Runtime type information.
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::cyclicAMIFvPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIFvPatch.H:51
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::cyclicAMIFvPatchField::patchNeighbourField
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled internal cell data.
Definition: cyclicAMIFvPatchField.C:134
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
coupledFvPatchField.H
Foam::cyclicAMIFvPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicAMIFvPatch.H:136
Foam::cyclicAMIFvPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: cyclicAMIFvPatch.H:130
Foam::cyclicAMIFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: cyclicAMIFvPatchField.H:131
cyclicAMIFvPatch.H
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
Foam::cyclicAMIFvPatchField::neighbourPatchField
const cyclicAMIFvPatchField< Type > & neighbourPatchField() const
Return reference to neighbour patchField.
Definition: cyclicAMIFvPatchField.C:163