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 -------------------------------------------------------------------------------
11 License
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 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
40 makePatchFieldTypeNames(jumpCyclicAMI);
41 
42 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 
44 template<>
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 // ************************************************************************* //
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
volFields.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
jumpCyclicAMIFvPatchFields.H
Foam::Field< solveScalar >
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::makePatchFieldTypeNames
makePatchFieldTypeNames(coupled)
Foam::UList< label >
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::lduAddressing::patchAddr
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
patchId
label patchId(-1)
Foam::jumpCyclicAMIFvPatchField::updateInterfaceMatrix
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.
Definition: jumpCyclicAMIFvPatchField.C:138
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56