cyclicACMIFvPatchField.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) 2013-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::cyclicACMIFvPatchField
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 arbitrarily coupled mesh interface (ACMI) interpolation.
34 
35 Usage
36  Example of the boundary condition specification:
37  \verbatim
38  <patchName>
39  {
40  type cyclicACMI;
41  }
42  \endverbatim
43 
44 See also
45  Foam::AMIInterpolation
46 
47 SourceFiles
48  cyclicACMIFvPatchField.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef cyclicACMIFvPatchField_H
53 #define cyclicACMIFvPatchField_H
54 
55 #include "coupledFvPatchField.H"
57 #include "cyclicACMIFvPatch.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class cyclicACMIFvPatchField Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<class Type>
70 :
71  virtual public cyclicACMILduInterfaceField,
72  public coupledFvPatchField<Type>
73 {
74  // Private data
75 
76  //- Local reference cast into the cyclic patch
77  const cyclicACMIFvPatch& cyclicACMIPatch_;
78 
79 
80  // Private Member Functions
81 
82  //- Return neighbour side field given internal fields
83  template<class Type2>
84  tmp<Field<Type2>> neighbourSideField
85  (
86  const Field<Type2>&
87  ) const;
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName(cyclicACMIFvPatch::typeName_());
94 
95 
96  // Constructors
97 
98  //- Construct from patch and internal field
100  (
101  const fvPatch&,
103  );
104 
105  //- Construct from patch, internal field and dictionary
107  (
108  const fvPatch&,
110  const dictionary&
111  );
112 
113  //- Construct by mapping given cyclicACMIFvPatchField onto a new patch
115  (
117  const fvPatch&,
119  const fvPatchFieldMapper&
120  );
121 
122  //- Construct as copy
124 
125  //- Construct and return a clone
126  virtual tmp<fvPatchField<Type>> clone() const
127  {
128  return tmp<fvPatchField<Type>>
129  (
131  );
132  }
133 
134  //- Construct as copy setting internal field reference
136  (
139  );
140 
141  //- Construct and return a clone setting internal field reference
143  (
145  ) const
146  {
147  return tmp<fvPatchField<Type>>
148  (
149  new cyclicACMIFvPatchField<Type>(*this, iF)
150  );
151  }
152 
153 
154  // Member functions
155 
156  // Access
157 
158  //- Return local reference cast into the cyclic AMI patch
159  const cyclicACMIFvPatch& cyclicACMIPatch() const
160  {
161  return cyclicACMIPatch_;
162  }
163 
164 
165  // Evaluation functions
166 
167  //- Return true if coupled. Note that the underlying patch
168  // is not coupled() - the points don't align
169  virtual bool coupled() const;
170 
171  //- Return true if this patch field fixes a value
172  // Needed to check if a level has to be specified while solving
173  // Poissons equations
174  virtual bool fixesValue() const
175  {
176  const scalarField& mask =
177  cyclicACMIPatch_.cyclicACMIPatch().mask();
178 
179  if (gMax(mask) > 1e-5)
180  {
181  // regions connected
182  return false;
183  }
184  else
185  {
186  // fully separated
187  return nonOverlapPatchField().fixesValue();
188  }
189  }
190 
191 
192  //- Return neighbour coupled internal cell data
193  virtual tmp<Field<Type>> patchNeighbourField() const;
194 
195  //- Return reference to neighbour patchField
197 
198  //- Return reference to non-overlapping patchField
200 
201  //- Update result field based on interface functionality
202  virtual void updateInterfaceMatrix
203  (
204  scalarField& result,
205  const scalarField& psiInternal,
206  const scalarField& coeffs,
207  const direction cmpt,
208  const Pstream::commsTypes commsType
209  ) const;
210 
211  //- Update result field based on interface functionality
212  virtual void updateInterfaceMatrix
213  (
214  Field<Type>&,
215  const Field<Type>&,
216  const scalarField&,
217  const Pstream::commsTypes commsType
218  ) const;
219 
220  //- Manipulate matrix
221  virtual void manipulateMatrix(fvMatrix<Type>& matrix);
222 
223  //- Update the coefficients associated with the patch field
224  virtual void updateCoeffs();
225 
226 
227  // Cyclic AMI coupled interface functions
228 
229  //- Does the patch field perform the transformation
230  virtual bool doTransform() const
231  {
232  return
233  !(cyclicACMIPatch_.parallel() || pTraits<Type>::rank == 0);
234  }
235 
236  //- Return face transformation tensor
237  virtual const tensorField& forwardT() const
238  {
239  return cyclicACMIPatch_.forwardT();
240  }
241 
242  //- Return neighbour-cell transformation tensor
243  virtual const tensorField& reverseT() const
244  {
245  return cyclicACMIPatch_.reverseT();
246  }
247 
248  //- Return rank of component for transform
249  virtual int rank() const
250  {
251  return pTraits<Type>::rank;
252  }
253 
254 
255  // I-O
256 
257  //- Write
258  virtual void write(Ostream& os) const;
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #ifdef NoRepository
269  #include "cyclicACMIFvPatchField.C"
270 #endif
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 #endif
275 
276 // ************************************************************************* //
virtual bool fixesValue() const
Return true if this patch field fixes a value.
const cyclicACMIPolyPatch & cyclicACMIPatch() const
Return local reference cast into the cyclic patch.
uint8_t direction
Definition: direction.H:46
TypeName(cyclicACMIFvPatch::typeName_())
Runtime type information.
const double e
Elementary charge.
Definition: doubleFloat.H:78
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
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Traits class for primitives.
Definition: pTraits.H:50
virtual const tensorField & forwardT() const
Return face transformation tensor.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
const cyclicACMIFvPatch & cyclicACMIPatch() const
Return local reference cast into the cyclic AMI patch.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
const fvPatchField< Type > & nonOverlapPatchField() const
Return reference to non-overlapping patchField.
virtual int rank() const
Return rank of component for transform.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
Pre-declare SubField and related Field type.
Definition: Field.H:57
virtual bool parallel() const
Are the cyclic planes parallel.
Foam::fvPatchFieldMapper.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:71
cyclicACMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Abstract base class for coupled patches.
Abstract base class for cyclic ACMI coupled interfaces.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Type gMax(const FieldField< Field, Type > &f)
virtual void write(Ostream &os) const
Write.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled internal cell data.
const scalarField & mask() const
Mask field where 1 = overlap, 0 = no-overlap.
virtual bool doTransform() const
Does the patch field perform the transformation.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void manipulateMatrix(fvMatrix< Type > &matrix)
Manipulate matrix.
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.
A class for managing temporary objects.
Definition: PtrList.H:54
virtual bool coupled() const
Return true if coupled. Note that the underlying patch.
const cyclicACMIFvPatchField< Type > & neighbourPatchField() const
Return reference to neighbour patchField.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Namespace for OpenFOAM.