cyclicFaPatchField.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) 2016-2017 Wikki Ltd
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::cyclicFaPatchField
29 
30 Description
31  Foam::cyclicFaPatchField
32 
33 Author
34  Zeljko Tukovic, FMENA
35  Hrvoje Jasak, Wikki Ltd.
36 
37 SourceFiles
38  cyclicFaPatchField.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef Foam_cyclicFaPatchField_H
43 #define Foam_cyclicFaPatchField_H
44 
45 #include "coupledFaPatchField.H"
47 #include "cyclicFaPatch.H"
48 #include "areaFaMesh.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class cyclicFaPatchField Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class Type>
61 :
62  virtual public cyclicLduInterfaceField,
63  public coupledFaPatchField<Type>
64 {
65  // Private Data
66 
67  //- Local reference cast into the cyclic patch
68  const cyclicFaPatch& cyclicPatch_;
69 
70 
71  // Private Member Functions
72 
73  //- Return neighbour side field given internal fields
74  template<class Type2>
75  tmp<Field<Type2>> neighbourSideField
76  (
77  const Field<Type2>&
78  ) const;
79 
80 
81 public:
82 
83  //- Runtime type information
84  TypeName(cyclicFaPatch::typeName_());
85 
86 
87  // Constructors
88 
89  //- Construct from patch and internal field
91  (
92  const faPatch&,
94  );
95 
96  //- Construct from patch, internal field and dictionary
98  (
99  const faPatch&,
101  const dictionary& dict,
104  );
105 
106  //- Construct by mapping given cyclicFaPatchField onto a new patch
108  (
110  const faPatch&,
112  const faPatchFieldMapper&
113  );
114 
115  //- Construct as copy
117  (
119  );
120 
121  //- Construct as copy setting internal field reference
123  (
126  );
127 
128  //- Return clone
129  virtual tmp<faPatchField<Type>> clone() const
130  {
131  return faPatchField<Type>::Clone(*this);
132  }
133 
134  //- Clone with an internal field reference
136  (
138  ) const
139  {
140  return faPatchField<Type>::Clone(*this, iF);
141  }
143 
144  // Member functions
145 
146  // Access
147 
148  //- Return local reference cast into the cyclic patch
149  const cyclicFaPatch& cyclicPatch() const
150  {
151  return cyclicPatch_;
152  }
153 
154 
155  // Evaluation functions
156 
157  //- Return neighbour coupled given internal cell data
158  virtual tmp<Field<Type>> patchNeighbourField() const;
159 
160 
161  // Coupled interface functionality
162 
163  //- Update result field based on interface functionality
164  virtual void updateInterfaceMatrix
165  (
167  const bool add,
168  const lduAddressing& lduAddr,
169  const label patchId,
170  const solveScalarField& psiInternal,
171  const scalarField& coeffs,
172  const direction cmpt,
173  const Pstream::commsTypes commsType
174  ) const;
175 
176  //- Update result field based on interface functionality
177  virtual void updateInterfaceMatrix
178  (
179  Field<Type>& result,
180  const bool add,
181  const lduAddressing& lduAddr,
182  const label patchId,
183  const Field<Type>&,
184  const scalarField& coeffs,
185  const Pstream::commsTypes commsType
186  ) const;
187 
188 
189  //- Cyclic coupled interface functions
190 
191  //- Does the patch field perform the transformation
192  virtual bool doTransform() const
193  {
194  return (pTraits<Type>::rank && !cyclicPatch_.parallel());
195  }
196 
197  //- Return face transformation tensor
198  virtual const tensorField& forwardT() const
199  {
200  return cyclicPatch_.forwardT();
201  }
202 
203  //- Return neighbour-cell transformation tensor
204  virtual const tensorField& reverseT() const
205  {
206  return cyclicPatch_.reverseT();
207  }
208 
209  //- Return rank of component for transform
210  virtual int rank() const
211  {
212  return pTraits<Type>::rank;
213  }
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #ifdef NoRepository
224  #include "cyclicFaPatchField.C"
225 #endif
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
label patchId(-1)
virtual tmp< faPatchField< Type > > clone() const
Return clone.
dictionary dict
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
uint8_t direction
Definition: direction.H:46
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
commsTypes
Communications types.
Definition: UPstream.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
TypeName(cyclicFaPatch::typeName_())
Runtime type information.
virtual int rank() const
Return rank of component for transform.
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
virtual const tensorField & forwardT() const
Return face transformation tensor.
Generic templated field type.
Definition: Field.H:62
cyclicFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
static tmp< faPatchField< Type > > Clone(const DerivedPatchField &pf)
Clone a patch field with its own internal field reference.
Definition: faPatchField.H:513
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Foam::cyclicFaPatchField.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
bool parallel() const
Are the cyclic planes parallel.
Cyclic-plane patch.
Definition: cyclicFaPatch.H:53
virtual bool doTransform() const
Cyclic coupled interface functions.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
::Foam::direction rank(const expressions::valueTypeCode) noexcept
The vector-space rank associated with given valueTypeCode.
Definition: exprTraits.C:70
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled given internal cell data.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Abstract base class for cyclic coupled interfaces.
A FieldMapper for finite-area patch fields.
const cyclicFaPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.