Loading...
Searching...
No Matches
jumpCyclicAMIFvPatchField.C
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) 2012-2017 OpenFOAM Foundation
9 Copyright (C) 2019,2024 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
30#include "transformField.H"
31
32// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33
34template<class Type>
36(
37 const fvPatch& p,
49 const fvPatch& p,
51 const fvPatchFieldMapper& mapper
53:
54 cyclicAMIFvPatchField<Type>(ptf, p, iF, mapper)
55{}
56
57
58template<class Type>
60(
61 const fvPatch& p,
63 const dictionary& dict
64)
65:
66 cyclicAMIFvPatchField<Type>(p, iF, dict)
68 // Call this evaluation in derived classes
69 //this->evaluate(Pstream::commsTypes::buffered);
70}
71
72
73template<class Type>
85(
88)
89:
90 cyclicAMIFvPatchField<Type>(ptf, iF)
91{}
92
93
94// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95
96template<class Type>
99{
100 const Field<Type>& iField = this->primitiveField();
101 const labelUList& nbrFaceCells =
102 this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells();
103
104 Field<Type> pnf(iField, nbrFaceCells);
105 tmp<Field<Type>> tpnf;
106
107 if (this->cyclicAMIPatch().applyLowWeightCorrection())
108 {
109 tpnf =
110 this->cyclicAMIPatch().interpolate
111 (
112 pnf,
113 this->patchInternalField()()
114 );
115 }
116 else
117 {
118 tpnf = this->cyclicAMIPatch().interpolate(pnf);
119 }
120
121 if (this->doTransform())
122 {
123 transform(tpnf.ref(), this->forwardT(), tpnf());
124 }
125
126 tmp<Field<Type>> tjf = jump();
127 if (!this->cyclicAMIPatch().owner())
128 {
129 tjf = -tjf;
131
132 return tpnf - tjf;
133}
134
135
136template<class Type>
138(
139 const Pstream::commsTypes commsType
140)
142 // Bypass cyclicAMI to avoid caching
144}
146
147template<class Type>
149(
150 const Pstream::commsTypes commsType
151)
153 // Bypass cyclicAMI to avoid caching
156
157
158template<class Type>
161 solveScalarField& result,
162 const bool add,
163 const lduAddressing& lduAddr,
164 const label patchId,
165 const solveScalarField& psiInternal,
166 const scalarField& coeffs,
167 const direction cmpt,
168 const Pstream::commsTypes commsType
169) const
170{
171 // Bypass cyclicAMI to avoid caching
173 (
174 result,
175 add,
176 lduAddr,
177 patchId,
178 psiInternal,
179 coeffs,
180 cmpt,
181 commsType
182 );
183}
184
185
186template<class Type>
188(
189 solveScalarField& result,
190 const bool add,
191 const lduAddressing& lduAddr,
192 const label patchId,
193 const solveScalarField& psiInternal,
194 const scalarField& coeffs,
195 const direction cmpt,
197) const
198{
200}
201
202
203template<class Type>
205(
206 Field<Type>& result,
207 const bool add,
208 const lduAddressing& lduAddr,
209 const label patchId,
210 const Field<Type>& psiInternal,
211 const scalarField& coeffs,
212 const Pstream::commsTypes commsType
213) const
214{
215 // Bypass cyclicAMI to avoid caching
217 (
218 result,
219 add,
220 lduAddr,
221 patchId,
222 psiInternal,
223 coeffs,
224 commsType
225 );
226}
227
228
229template<class Type>
231(
232 Field<Type>& result,
233 const bool add,
234 const lduAddressing& lduAddr,
235 const label patchId,
236 const Field<Type>& psiInternal,
237 const scalarField& coeffs,
239) const
240{
241 const labelUList& nbrFaceCells =
242 lduAddr.patchAddr
243 (
244 this->cyclicAMIPatch().neighbPatchID()
245 );
246
247 Field<Type> pnf(psiInternal, nbrFaceCells);
248
249 if (this->cyclicAMIPatch().applyLowWeightCorrection())
250 {
251 pnf =
252 this->cyclicAMIPatch().interpolate
253 (
254 pnf,
255 this->patchInternalField()()
256 );
257
258 }
259 else
260 {
261 pnf = this->cyclicAMIPatch().interpolate(pnf);
262 }
263
264 // only apply jump to original field
265 if (&psiInternal == &this->primitiveField())
266 {
267 Field<Type> jf(this->jump());
268 if (!this->cyclicAMIPatch().owner())
269 {
270 jf *= -1.0;
271 }
272
273 pnf -= jf;
274 }
275
276 // Transform according to the transformation tensors
277 this->transformCoupleField(pnf);
278
279 const labelUList& faceCells = lduAddr.patchAddr(patchId);
280
281 // Multiply the field by coefficients and add into the result
282 this->addToInternalField(result, !add,faceCells, coeffs, pnf);
283}
284
285
286// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
commsTypes
Communications types.
Definition UPstream.H:81
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
This boundary condition enforces a cyclic condition between a pair of boundaries, whereby communicati...
virtual bool doTransform() const
Does the patch field perform the transformation.
cyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
const cyclicAMIFvPatch & cyclicAMIPatch() const noexcept
Return local reference cast into the cyclic AMI patch.
void transformCoupleField(Field< Type > &f) const
Transform given patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
A FieldMapper for finite-volume patch fields.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch.
const Field< Type > & primitiveField() const noexcept
Return const-reference to the internal field values.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
This boundary condition provides a base class that enforces a cyclic condition with a specified 'jump...
virtual void initInterfaceMatrixUpdate(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
Initialise interface functionality.
jumpCyclicAMIFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
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.
virtual void initEvaluate(const Pstream::commsTypes commsType)
Initialise the evaluation of the patch field.
virtual tmp< Field< Type > > jump() const =0
Return the "jump" across the patch as a "half" field.
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
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.
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
virtual void initInterfaceMatrixUpdate(solveScalarField &result, const bool add, const lduAddressing &, const label interfacei, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update. Add/subtract coupled contributions to matrix.
void addToInternalField(Field< Type > &result, const bool add, const labelUList &faceCells, const scalarField &coeffs, const Field< Type > &vals) const
Add/subtract weighted contributions to internal field.
A class for managing temporary objects.
Definition tmp.H:75
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
label patchId(-1)
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
Field< solveScalar > solveScalarField
uint8_t direction
Definition direction.H:49
UList< label > labelUList
A UList of labels.
Definition UList.H:75
dictionary dict
Spatial transformation functions for primitive fields.