Loading...
Searching...
No Matches
jumpCyclicAMIFvPatchFields.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-2016 OpenFOAM Foundation
9 Copyright (C) 2019 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
31#include "volFields.H"
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35namespace Foam
36{
37
38// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39
40makePatchFieldTypeNames(jumpCyclicAMI);
41
42// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43
44template<>
46(
47 solveScalarField& result,
48 const bool add,
49 const lduAddressing& lduAddr,
50 const label patchId,
51 const solveScalarField& psiInternal,
52 const scalarField& coeffs,
53 const direction cmpt,
55) const
56{
57 const labelUList& nbrFaceCells =
58 lduAddr.patchAddr
59 (
60 this->cyclicAMIPatch().neighbPatchID()
61 );
62
63 solveScalarField pnf(psiInternal, nbrFaceCells);
64
65 pnf = this->cyclicAMIPatch().interpolate(pnf);
66
67 // only apply jump to original field
68 if
69 (
70 reinterpret_cast<const void*>(&psiInternal)
71 == reinterpret_cast<const void*>(&this->primitiveField())
72 )
73 {
74 Field<scalar> jf(this->jump());
75
76 if (!this->cyclicAMIPatch().owner())
77 {
78 jf *= -1.0;
79 }
80
81 //pnf -= jf;
82 forAll(pnf, i)
83 {
84 pnf[i] -= jf[i];
85 }
86 }
87
88 // Transform according to the transformation tensors
89 this->transformCoupleField(pnf, cmpt);
90
91 const labelUList& faceCells = lduAddr.patchAddr(patchId);
92
93 // Multiply the field by coefficients and add into the result
94 this->addToInternalField(result, !add, faceCells, coeffs, pnf);
95}
96
97
98// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99
100} // End namespace Foam
101
102// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
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
const cyclicAMIFvPatch & cyclicAMIPatch() const noexcept
void transformCoupleField(Field< Type > &f) const
Transform given patch field.
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
const Field< scalar > & primitiveField() const noexcept
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 tmp< Field< scalar > > jump() const=0
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.
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.
#define makePatchFieldTypeNames(bcType)
For all standard field types: define a faPatchField type. Example, (calculated).
label patchId(-1)
Namespace for OpenFOAM.
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
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299