jumpCyclicFvPatchField.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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2021 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\*---------------------------------------------------------------------------*/
28
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class Type>
35(
36 const fvPatch& p,
38)
39:
40 cyclicFvPatchField<Type>(p, iF)
41{}
42
43
44template<class Type>
46(
48 const fvPatch& p,
50 const fvPatchFieldMapper& mapper
51)
52:
53 cyclicFvPatchField<Type>(ptf, p, iF, mapper)
54{}
55
56
57template<class Type>
59(
60 const fvPatch& p,
62 const dictionary& dict,
63 const bool valueRequired
64)
65:
66 cyclicFvPatchField<Type>(p, iF, dict, valueRequired)
67{
68 // Call this evaluation in derived classes
69 //this->evaluate(Pstream::commsTypes::blocking);
70}
71
72
73template<class Type>
75(
77)
78:
79 cyclicFvPatchField<Type>(ptf)
80{}
81
82
83template<class Type>
85(
88)
90 cyclicFvPatchField<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->cyclicPatch().neighbFvPatch().faceCells();
103
104 auto tpnf = tmp<Field<Type>>::New(this->size());
105 auto& pnf = tpnf.ref();
106
107 Field<Type> jf(this->jump());
108 if (!this->cyclicPatch().owner())
109 {
110 jf *= -1.0;
111 }
112
113 if (this->doTransform())
114 {
115 forAll(*this, facei)
116 {
117 pnf[facei] = transform
118 (
119 this->forwardT()[0], iField[nbrFaceCells[facei]]
120 ) - jf[facei];
121 }
122 }
123 else
124 {
125 forAll(*this, facei)
126 {
127 pnf[facei] = iField[nbrFaceCells[facei]] - jf[facei];
129 }
130
131 return tpnf;
132}
133
134
135template<class Type>
137(
138 solveScalarField& result,
139 const bool add,
140 const lduAddressing& lduAddr,
141 const label patchId,
142 const solveScalarField& psiInternal,
143 const scalarField& coeffs,
144 const direction cmpt,
146) const
147{
149}
150
151
152template<class Type>
154(
155 Field<Type>& result,
156 const bool add,
157 const lduAddressing& lduAddr,
158 const label patchId,
159 const Field<Type>& psiInternal,
160 const scalarField& coeffs,
162) const
163{
164 Field<Type> pnf(this->size());
165
166 const labelUList& nbrFaceCells =
167 lduAddr.patchAddr
168 (
169 this->cyclicPatch().neighbPatchID()
170 );
171
172 // only apply jump to original field
173 if (&psiInternal == &this->primitiveField())
174 {
175 Field<Type> jf(this->jump());
176
177 if (!this->cyclicPatch().owner())
178 {
179 jf *= -1.0;
180 }
181
182 forAll(*this, facei)
183 {
184 pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei];
185 }
186 }
187 else
188 {
189 forAll(*this, facei)
190 {
191 pnf[facei] = psiInternal[nbrFaceCells[facei]];
192 }
193 }
194
195 // Transform according to the transformation tensors
196 this->transformCoupleField(pnf);
197
198 const labelUList& faceCells = lduAddr.patchAddr(patchId);
199
200 // Multiply the field by coefficients and add into the result
201 this->addToInternalField(result, !add, faceCells, coeffs, pnf);
202}
203
204
205// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
commsTypes
Types of communications.
Definition: UPstream.H:67
This boundary condition enforces a cyclic condition between a pair of boundaries.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:59
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition provides a base class for coupled-cyclic conditions with a specified 'jump' (...
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.
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.
A class for managing temporary objects.
Definition: tmp.H:65
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
label patchId(-1)
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
uint8_t direction
Definition: direction.H:56
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333