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 solveScalarField& psiInternal,
183  const scalarField& coeffs,
184  const direction cmpt,
185  const Pstream::commsTypes commsType
186  ) const;
187 
188  //- Update result field based on interface functionality
189  virtual void updateInterfaceMatrix
190  (
191  Field<Type>& result,
192  const bool add,
193  const Field<Type>&,
194  const scalarField& coeffs,
195  const Pstream::commsTypes commsType
196  ) const;
197 
198 
199  //- Cyclic coupled interface functions
200 
201  //- Does the patch field perform the transformation
202  virtual bool doTransform() const
203  {
204  return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
205  }
206 
207  //- Return face transformation tensor
208  virtual const tensorField& forwardT() const
209  {
210  return cyclicPatch_.forwardT();
211  }
212 
213  //- Return neighbour-cell transformation tensor
214  virtual const tensorField& reverseT() const
215  {
216  return cyclicPatch_.reverseT();
217  }
218 
219  //- Return rank of component for transform
220  virtual int rank() const
221  {
222  return pTraits<Type>::rank;
223  }
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #ifdef NoRepository
234  #include "cyclicFaPatchField.C"
235 #endif
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
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:213
coupledFaPatchField.H
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
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:201
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
areaFaMesh.H
Foam::coupledFaPatchField
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Definition: coupledFaPatchField.H:57
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
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
Traits class for primitives.
Definition: pTraits.H:54
Foam::cyclicFaPatchField::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicFaPatchField.H:207
cyclicLduInterfaceField.H
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::cyclicFaPatch
Cyclic-plane patch.
Definition: cyclicFaPatch.H:57
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:68
Foam::cyclicFaPatchField::cyclicPatch
const cyclicFaPatch & cyclicPatch() const
Return local reference cast into the cyclic patch.
Definition: cyclicFaPatchField.H:152
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::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: cyclicFaPatchField.C:164
Foam::cyclicFaPatchField::rank
virtual int rank() const
Return rank of component for transform.
Definition: cyclicFaPatchField.H:219