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