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
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.
commsTypes
Types of communications.
Definition: UPstream.H:67
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:59
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.
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.
#define makePatchFieldTypeNames(type)
Definition: fvPatchField.H:708
label patchId(-1)
Namespace for OpenFOAM.
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
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333