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-2025 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.txx
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 {
67 
68  // Private Data
69 
70  //- Local reference cast into the cyclic patch
71  const cyclicFaPatch& cyclicPatch_;
72 
73 public:
74 
75  //- Runtime type information
76  TypeName(cyclicFaPatch::typeName_());
77 
78 
79  // Constructors
80 
81  //- Construct from patch and internal field
83  (
84  const faPatch&,
86  );
87 
88  //- Construct from patch, internal field and dictionary
90  (
91  const faPatch&,
93  const dictionary& dict,
96  );
97 
98  //- Construct by mapping onto a new patch
100  (
101  const this_bctype&,
102  const faPatch&,
104  const faPatchFieldMapper&
105  );
106 
107  //- Construct as copy setting internal field reference
109  (
110  const this_bctype&,
112  );
113 
114  //- No copy without an internal field
115  cyclicFaPatchField(const this_bctype&) = delete;
116 
117  //- Clone with an internal field reference
119  (
121  ) const
122  {
123  return faPatchField<Type>::Clone(*this, iF);
124  }
125 
126 
127  // Member Functions
128 
129  // Access
131  //- Return local reference cast into the cyclic patch
132  const cyclicFaPatch& cyclicPatch() const noexcept
133  {
134  return cyclicPatch_;
135  }
136 
137 
138  // Evaluation Functions
139 
140  //- Return neighbour coupled given internal cell data
141  virtual tmp<Field<Type>> patchNeighbourField() const;
142 
143  //- Retrieve neighbour coupled given internal cell data
144  virtual void patchNeighbourField(UList<Type>& pnf) const;
146 
147  // Coupled interface functionality
148 
149  //- Update result field based on interface functionality
150  virtual void updateInterfaceMatrix
151  (
152  solveScalarField& result,
153  const bool add,
154  const lduAddressing& lduAddr,
155  const label patchId,
156  const solveScalarField& psiInternal,
157  const scalarField& coeffs,
158  const direction cmpt,
159  const Pstream::commsTypes commsType
160  ) const;
161 
162  //- Update result field based on interface functionality
163  virtual void updateInterfaceMatrix
164  (
165  Field<Type>& result,
166  const bool add,
167  const lduAddressing& lduAddr,
168  const label patchId,
169  const Field<Type>&,
170  const scalarField& coeffs,
171  const Pstream::commsTypes commsType
172  ) const;
173 
174 
175  //- Cyclic coupled interface functions
176 
177  //- Does the patch field perform the transformation
178  virtual bool doTransform() const
179  {
180  return
181  (
182  is_rotational_vectorspace_v<Type>
183  && !cyclicPatch_.parallel()
184  );
185  }
186 
187  //- Return face transformation tensor
188  virtual const tensorField& forwardT() const
189  {
190  return cyclicPatch_.forwardT();
191  }
192 
193  //- Return neighbour-cell transformation tensor
194  virtual const tensorField& reverseT() const
195  {
196  return cyclicPatch_.reverseT();
197  }
198 
199  //- Return rank of component for transform
200  virtual int rank() const
201  {
202  return pTraits<Type>::rank;
203  }
204 
205 
206  // Member Operators
207 
208  //- Inherit assignment
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #ifdef NoRepository
220  #include "cyclicFaPatchField.txx"
221 #endif
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
label patchId(-1)
dictionary dict
uint8_t direction
Definition: direction.H:46
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
commsTypes
Communications types.
Definition: UPstream.H:81
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
TypeName(cyclicFaPatch::typeName_())
Runtime type information.
virtual tmp< faPatchField< Type > > clone() const
No clone without an internal field reference.
Definition: faPatchField.H:534
friend Ostream & operator(Ostream &, const faPatchField< Type > &)
virtual int rank() const
Return rank of component for transform.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:41
virtual const tensorField & forwardT() const
Return face transformation tensor.
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.
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled given internal cell data.
const direction noexcept
Definition: scalarImpl.H:265
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:73
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.
static tmp< faPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: faPatchField.H:559
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
const cyclicFaPatch & cyclicPatch() const noexcept
Return local reference cast into the cyclic patch.
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.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.