jumpCyclicAMIFvPatchField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "transformField.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
34  const fvPatch& p,
36 )
37 :
39 {}
40 
41 
42 template<class Type>
44 (
45  const fvPatch& p,
47  const dictionary& dict
48 )
49 :
51 {
52  // Call this evaluation in derived classes
53  // this->evaluate(Pstream::commsTypes::blocking);
54 }
55 
56 
57 template<class Type>
59 (
61  const fvPatch& p,
63  const fvPatchFieldMapper& mapper
64 )
65 :
66  cyclicAMIFvPatchField<Type>(ptf, p, iF, mapper)
67 {}
68 
69 
70 template<class Type>
72 (
75 )
76 :
78 {}
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
83 template<class Type>
86 (
88 ) const
89 {
90  const Field<Type>& iField = this->primitiveField();
91  const labelUList& nbrFaceCells =
92  this->cyclicAMIPatch().cyclicAMIPatch().nbrPatch().faceCells();
93 
94  Field<Type> pnf(iField, nbrFaceCells);
95  tmp<Field<Type>> tpnf;
96 
97  if (this->cyclicAMIPatch().applyLowWeightCorrection())
98  {
99  tpnf =
100  this->cyclicAMIPatch().interpolate
101  (
102  pnf,
103  this->patchInternalField()()
104  );
105  }
106  else
107  {
108  tpnf = this->cyclicAMIPatch().interpolate(pnf);
109  }
110 
111  this->transform().transform(tpnf.ref(), tpnf());
112 
113  tmp<Field<Type>> tjf = jump();
114  if (!this->cyclicAMIPatch().owner())
115  {
116  tjf = -tjf;
117  }
118 
119  return tpnf - tjf;
120 }
121 
122 
123 template<class Type>
125 (
126  scalarField& result,
127  const scalarField& psiInternal,
128  const scalarField& coeffs,
129  const direction cmpt,
130  const Pstream::commsTypes
131 ) const
132 {
134 }
135 
136 
137 template<class Type>
139 (
140  Field<Type>& result,
141  const Field<Type>& psiInternal,
142  const scalarField& coeffs,
143  const Pstream::commsTypes
144 ) const
145 {
146  const labelUList& nbrFaceCells =
147  this->cyclicAMIPatch().cyclicAMIPatch().nbrPatch().faceCells();
148 
149  Field<Type> pnf(psiInternal, nbrFaceCells);
150 
151  if (this->cyclicAMIPatch().applyLowWeightCorrection())
152  {
153  pnf =
154  this->cyclicAMIPatch().interpolate
155  (
156  pnf,
157  this->patchInternalField()()
158  );
159 
160  }
161  else
162  {
163  pnf = this->cyclicAMIPatch().interpolate(pnf);
164  }
165 
166  // only apply jump to original field
167  if (&psiInternal == &this->primitiveField())
168  {
169  Field<Type> jf(this->jump());
170  if (!this->cyclicAMIPatch().owner())
171  {
172  jf *= -1.0;
173  }
174 
175  pnf -= jf;
176  }
177 
178  // Transform according to the transformation tensors
179  this->transformCoupleField(pnf);
180 
181  // Multiply the field by coefficients and add into the result
182  const labelUList& faceCells = this->cyclicAMIPatch().faceCells();
183  forAll(faceCells, elemI)
184  {
185  result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
186  }
187 }
188 
189 
190 // ************************************************************************* //
This boundary condition provides a base class that enforces a cyclic condition with a specified &#39;jump...
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
commsTypes
Types of communications.
Definition: UPstream.H:64
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
uint8_t direction
Definition: direction.H:45
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
jumpCyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void updateInterfaceMatrix(scalarField &result, const scalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
Spatial transformation functions for primitive fields.
Pre-declare SubField and related Field type.
Definition: Field.H:56
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes) const
Return neighbour coupled given internal cell data.
Foam::fvPatchFieldMapper.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
friend dimensionSet transform(const dimensionSet &)
Return the argument; transformations do not change the dimensions.
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:483