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 and return a clone
122  virtual tmp<faPatchField<Type>> clone() const
123  {
124  return tmp<faPatchField<Type>>
125  (
126  new cyclicFaPatchField<Type>(*this)
127  );
128  }
129 
130  //- Construct as copy setting internal field reference
132  (
135  );
136 
137  //- Construct and return a clone setting internal field reference
139  (
141  ) const
142  {
143  return tmp<faPatchField<Type>>
144  (
145  new cyclicFaPatchField<Type>(*this, iF)
146  );
147  }
148 
149 
150  // Member functions
151 
152  // Access
153 
154  //- Return local reference cast into the cyclic patch
155  const cyclicFaPatch& cyclicPatch() const
156  {
157  return cyclicPatch_;
158  }
159 
160 
161  // Evaluation functions
162 
163  //- Return neighbour coupled given internal cell data
164  virtual tmp<Field<Type>> patchNeighbourField() const;
165 
166 
167  // Coupled interface functionality
168 
169  //- Update result field based on interface functionality
170  virtual void updateInterfaceMatrix
171  (
173  const bool add,
174  const lduAddressing& lduAddr,
175  const label patchId,
176  const solveScalarField& psiInternal,
177  const scalarField& coeffs,
178  const direction cmpt,
179  const Pstream::commsTypes commsType
180  ) const;
181 
182  //- Update result field based on interface functionality
183  virtual void updateInterfaceMatrix
184  (
185  Field<Type>& result,
186  const bool add,
187  const lduAddressing& lduAddr,
188  const label patchId,
189  const Field<Type>&,
190  const scalarField& coeffs,
191  const Pstream::commsTypes commsType
192  ) const;
193 
194 
195  //- Cyclic coupled interface functions
196 
197  //- Does the patch field perform the transformation
198  virtual bool doTransform() const
199  {
200  return (pTraits<Type>::rank && !cyclicPatch_.parallel());
201  }
202 
203  //- Return face transformation tensor
204  virtual const tensorField& forwardT() const
205  {
206  return cyclicPatch_.forwardT();
207  }
208 
209  //- Return neighbour-cell transformation tensor
210  virtual const tensorField& reverseT() const
211  {
212  return cyclicPatch_.reverseT();
213  }
214 
215  //- Return rank of component for transform
216  virtual int rank() const
217  {
218  return pTraits<Type>::rank;
219  }
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
230  #include "cyclicFaPatchField.C"
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
label patchId(-1)
virtual tmp< faPatchField< Type > > clone() const
Construct and return a 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:72
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.
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...
Definition: areaFieldsFwd.H:42
::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.