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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::cyclicAMIFvPatchField
29 
30 Group
31  grpCoupledBoundaryConditions
32 
33 Description
34  This boundary condition enforces a cyclic condition between a pair of
35  boundaries, whereby communication between the patches is performed using
36  an arbitrary mesh interface (AMI) interpolation.
37 
38 Usage
39  Example of the boundary condition specification:
40  \verbatim
41  <patchName>
42  {
43  type cyclicAMI;
44  }
45  \endverbatim
46 
47 Note
48  The outer boundary of the patch pairs must be similar, i.e. if the owner
49  patch is transformed to the neighbour patch, the outer perimiter of each
50  patch should be identical (or very similar).
51 
52 See also
53  Foam::AMIInterpolation
54 
55 SourceFiles
56  cyclicAMIFvPatchField.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef cyclicAMIFvPatchField_H
61 #define cyclicAMIFvPatchField_H
62 
63 #include "coupledFvPatchField.H"
65 #include "cyclicAMIFvPatch.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class cyclicAMIFvPatchField Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class Type>
78 :
79  virtual public cyclicAMILduInterfaceField,
80  public coupledFvPatchField<Type>
81 {
82  // Private data
83 
84  //- Local reference cast into the cyclic patch
85  const cyclicAMIFvPatch& cyclicAMIPatch_;
86 
87 
88  // Private Member Functions
89 
90  //- Return neighbour side field given internal fields
91  template<class Type2>
92  tmp<Field<Type2>> neighbourSideField
93  (
94  const Field<Type2>&
95  ) const;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName(cyclicAMIFvPatch::typeName_());
102 
103 
104  // Constructors
105 
106  //- Construct from patch and internal field
108  (
109  const fvPatch&,
111  );
112 
113  //- Construct from patch, internal field and dictionary
115  (
116  const fvPatch&,
118  const dictionary&
119  );
120 
121  //- Construct by mapping given cyclicAMIFvPatchField onto a new patch
123  (
125  const fvPatch&,
127  const fvPatchFieldMapper&
128  );
129 
130  //- Construct as copy
132 
133  //- Construct and return a clone
134  virtual tmp<fvPatchField<Type>> clone() const
135  {
136  return tmp<fvPatchField<Type>>
137  (
138  new cyclicAMIFvPatchField<Type>(*this)
139  );
140  }
141 
142  //- Construct as copy setting internal field reference
144  (
147  );
148 
149  //- Construct and return a clone setting internal field reference
151  (
153  ) const
154  {
155  return tmp<fvPatchField<Type>>
156  (
157  new cyclicAMIFvPatchField<Type>(*this, iF)
158  );
159  }
160 
161 
162  // Member functions
163 
164  // Access
165 
166  //- Return local reference cast into the cyclic AMI patch
167  const cyclicAMIFvPatch& cyclicAMIPatch() const
168  {
169  return cyclicAMIPatch_;
170  }
171 
172 
173  // Evaluation functions
174 
175  //- Return true if coupled. Note that the underlying patch
176  // is not coupled() - the points don't align.
177  virtual bool coupled() const;
178 
179  //- Return neighbour coupled internal cell data
180  virtual tmp<Field<Type>> patchNeighbourField() const;
181 
182  //- Return reference to neighbour patchField
184 
185  //- Update result field based on interface functionality
186  virtual void updateInterfaceMatrix
187  (
188  solveScalarField& result,
189  const bool add,
190  const solveScalarField& psiInternal,
191  const scalarField& coeffs,
192  const direction cmpt,
193  const Pstream::commsTypes commsType
194  ) const;
195 
196  //- Update result field based on interface functionality
197  virtual void updateInterfaceMatrix
198  (
199  Field<Type>&,
200  const bool add,
201  const Field<Type>&,
202  const scalarField&,
203  const Pstream::commsTypes commsType
204  ) const;
205 
206 
207  // Cyclic AMI coupled interface functions
208 
209  //- Does the patch field perform the transformation
210  virtual bool doTransform() const
211  {
212  return
213  !(cyclicAMIPatch_.parallel() || pTraits<Type>::rank == 0);
214  }
215 
216  //- Return face transformation tensor
217  virtual const tensorField& forwardT() const
218  {
219  return cyclicAMIPatch_.forwardT();
220  }
221 
222  //- Return neighbour-cell transformation tensor
223  virtual const tensorField& reverseT() const
224  {
225  return cyclicAMIPatch_.reverseT();
226  }
227 
228  //- Return rank of component for transform
229  virtual int rank() const
230  {
231  return pTraits<Type>::rank;
232  }
233 
234 
235  // I-O
236 
237  //- Write
238  virtual void write(Ostream& os) const;
239 };
240 
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 } // End namespace Foam
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #ifdef NoRepository
249  #include "cyclicAMIFvPatchField.C"
250 #endif
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #endif
255 
256 // ************************************************************************* //
Foam::cyclicAMIFvPatchField::doTransform
virtual bool doTransform() const
Does the patch field perform the transformation.
Definition: cyclicAMIFvPatchField.H:209
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::cyclicAMILduInterfaceField
Abstract base class for cyclic AMI coupled interfaces.
Definition: cyclicAMILduInterfaceField.H:51
cyclicAMIFvPatchField.C
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:228
Foam::cyclicAMIFvPatchField
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
Definition: cyclicAMIFvPatchField.H:76
cyclicAMILduInterfaceField.H
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::cyclicAMIFvPatchField::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicAMIFvPatchField.H:216
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::cyclicAMIFvPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicAMIFvPatch.H:156
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam::cyclicAMIFvPatchField::cyclicAMIPatch
const cyclicAMIFvPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic AMI patch.
Definition: cyclicAMIFvPatchField.H:166
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cyclicAMIFvPatchField::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicAMIFvPatchField.H:222
Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField
cyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: cyclicAMIFvPatchField.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::coupledFvPatchField
Abstract base class for coupled patches.
Definition: coupledFvPatchField.H:57
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:54
Foam::cyclicAMIFvPatchField::updateInterfaceMatrix
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
Definition: cyclicAMIFvPatchField.C:188
Foam::cyclicAMIFvPatchField::coupled
virtual bool coupled() const
Return true if coupled. Note that the underlying patch.
Definition: cyclicAMIFvPatchField.C:134
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::cyclicAMIFvPatchField::TypeName
TypeName(cyclicAMIFvPatch::typeName_())
Runtime type information.
Foam::cyclicAMIFvPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIFvPatch.H:53
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::cyclicAMIFvPatchField::patchNeighbourField
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled internal cell data.
Definition: cyclicAMIFvPatchField.C:142
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
coupledFvPatchField.H
Foam::cyclicAMIFvPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicAMIFvPatch.H:150
Foam::cyclicAMIFvPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: cyclicAMIFvPatch.H:144
Foam::cyclicAMIFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: cyclicAMIFvPatchField.H:133
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:54
Foam::cyclicAMIFvPatchField::neighbourPatchField
const cyclicAMIFvPatchField< Type > & neighbourPatchField() const
Return reference to neighbour patchField.
Definition: cyclicAMIFvPatchField.C:171