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 cyclicFaPatchField_H
43 #define 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&
102  );
103 
104  //- Construct by mapping given cyclicFaPatchField onto a new patch
106  (
108  const faPatch&,
110  const faPatchFieldMapper&
111  );
112 
113  //- Construct as copy
115  (
117  );
118 
119  //- Construct and return a clone
120  virtual tmp<faPatchField<Type>> clone() const
121  {
122  return tmp<faPatchField<Type>>
123  (
124  new cyclicFaPatchField<Type>(*this)
125  );
126  }
127 
128  //- Construct as copy setting internal field reference
130  (
133  );
134 
135  //- Construct and return a clone setting internal field reference
137  (
139  ) const
140  {
141  return tmp<faPatchField<Type>>
142  (
143  new cyclicFaPatchField<Type>(*this, iF)
144  );
145  }
146 
147 
148  // Member functions
149 
150  // Access
151 
152  //- Return local reference cast into the cyclic patch
153  const cyclicFaPatch& cyclicPatch() const
154  {
155  return cyclicPatch_;
156  }
157 
158 
159  // Evaluation functions
160 
161  //- Return neighbour coupled given internal cell data
162  virtual tmp<Field<Type>> patchNeighbourField() const;
163 
164 
165  // Coupled interface functionality
166 
167  //- Transform neighbour field
168  virtual void transformCoupleField
169  (
171  const direction cmpt
172  ) const
173  {
175  }
176 
177  //- Update result field based on interface functionality
178  virtual void updateInterfaceMatrix
179  (
180  solveScalarField& result,
181  const bool add,
182  const lduAddressing& lduAddr,
183  const label patchId,
184  const solveScalarField& psiInternal,
185  const scalarField& coeffs,
186  const direction cmpt,
187  const Pstream::commsTypes commsType
188  ) const;
189 
190  //- Update result field based on interface functionality
191  virtual void updateInterfaceMatrix
192  (
193  Field<Type>& result,
194  const bool add,
195  const lduAddressing& lduAddr,
196  const label patchId,
197  const Field<Type>&,
198  const scalarField& coeffs,
199  const Pstream::commsTypes commsType
200  ) const;
201 
202 
203  //- Cyclic coupled interface functions
204 
205  //- Does the patch field perform the transformation
206  virtual bool doTransform() const
207  {
208  return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
209  }
210 
211  //- Return face transformation tensor
212  virtual const tensorField& forwardT() const
213  {
214  return cyclicPatch_.forwardT();
215  }
216 
217  //- Return neighbour-cell transformation tensor
218  virtual const tensorField& reverseT() const
219  {
220  return cyclicPatch_.reverseT();
221  }
222 
223  //- Return rank of component for transform
224  virtual int rank() const
225  {
226  return pTraits<Type>::rank;
227  }
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #ifdef NoRepository
238  #include "cyclicFaPatchField.C"
239 #endif
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::cyclicFaPatchField::transformCoupleField
virtual void transformCoupleField(solveScalarField &f, const direction cmpt) const
Transform neighbour field.
Definition: cyclicFaPatchField.H:168
Foam::cyclicFaPatchField::TypeName
TypeName(cyclicFaPatch::typeName_())
Runtime type information.
Foam::cyclicLduInterfaceField::transformCoupleField
void transformCoupleField(Field< Type > &f) const
Transform given patch field.
Definition: cyclicLduInterfaceField.H:111
Foam::coupledFaPatch::parallel
bool parallel() const
Are the cyclic planes parallel.
Definition: coupledFaPatch.H:198
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
cyclicFaPatch.H
cyclicFaPatchField.C
Foam::faPatchFieldMapper
Definition: faPatchFieldMapper.H:44
Foam::cyclicFaPatchField::cyclicFaPatchField
cyclicFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
Definition: cyclicFaPatchField.C:35
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::cyclicFaPatchField::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicFaPatchField.H:217
coupledFaPatchField.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
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
Foam::cyclicFaPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicFaPatch.H:139
Foam::cyclicFaPatchField::doTransform
virtual bool doTransform() const
Cyclic coupled interface functions.
Definition: cyclicFaPatchField.H:205
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cyclicFaPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicFaPatch.H:145
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
areaFaMesh.H
Foam::coupledFaPatchField
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Definition: coupledFaPatchField.H:57
Foam::cyclicFaPatchField::patchNeighbourField
virtual tmp< Field< Type > > patchNeighbourField() const
Return neighbour coupled given internal cell data.
Definition: cyclicFaPatchField.C:124
Foam::cyclicLduInterfaceField
Abstract base class for cyclic coupled interfaces.
Definition: cyclicLduInterfaceField.H:52
f
labelList f(nPoints)
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::cyclicFaPatchField::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicFaPatchField.H:211
cyclicLduInterfaceField.H
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::cyclicFaPatch
Cyclic-plane patch.
Definition: cyclicFaPatch.H:57
patchId
label patchId(-1)
Foam::cyclicFaPatchField
Foam::cyclicFaPatchField.
Definition: cyclicFaPatchField.H:59
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
Foam::cyclicFaPatchField::cyclicPatch
const cyclicFaPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
Definition: cyclicFaPatchField.H:152
Foam::cyclicFaPatchField::updateInterfaceMatrix
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.
Definition: cyclicFaPatchField.C:164
Foam::cyclicFaPatchField::clone
virtual tmp< faPatchField< Type > > clone() const
Construct and return a clone.
Definition: cyclicFaPatchField.H:119
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::cyclicFaPatchField::rank
virtual int rank() const
Return rank of component for transform.
Definition: cyclicFaPatchField.H:223