processorFaPatchScalarField.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) 2016-2017 Wikki Ltd
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 
30 
31 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 
33 template<>
35 (
37  const direction cmpt
38 ) const
39 {}
40 
41 
42 template<>
44 (
45  solveScalarField& result,
46  const bool add,
47  const lduAddressing& lduAddr,
48  const label patchId,
49  const solveScalarField& psiInternal,
50  const scalarField& coeffs,
51  const direction,
52  const Pstream::commsTypes commsType
53 ) const
54 {
55  procPatch_.send
56  (
57  commsType,
58  patch().patchInternalField(psiInternal)()
59  );
60 }
61 
62 
63 template<>
65 (
66  solveScalarField& result,
67  const bool add,
68  const lduAddressing& lduAddr,
69  const label patchId,
70  const solveScalarField&,
71  const scalarField& coeffs,
72  const direction,
73  const Pstream::commsTypes commsType
74 ) const
75 {
77  (
78  procPatch_.receive<solveScalar>(commsType, this->size())()
79  );
80 
81  const labelUList& edgeFaces = patch().edgeFaces();
82 
83  if (add)
84  {
85  forAll(edgeFaces, facei)
86  {
87  result[edgeFaces[facei]] -= coeffs[facei]*pnf[facei];
88  }
89  }
90  else
91  {
92  forAll(edgeFaces, facei)
93  {
94  result[edgeFaces[facei]] -= coeffs[facei]*pnf[facei];
95  }
96  }
97 }
98 
99 
100 // ************************************************************************* //
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::processorFaPatchField::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: processorFaPatchField.C:213
processorFaPatchScalarField.H
Foam::processorFaPatchField::initInterfaceMatrixUpdate
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 neighbour matrix update.
Definition: processorFaPatchField.C:192
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
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
Foam::processorFaPatchField::transformCoupleField
virtual void transformCoupleField(solveScalarField &f, const direction cmpt) const
Transform neighbour field.
Definition: processorFaPatchField.H:182
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
f
labelList f(nPoints)
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::UList< label >
Foam::direction
uint8_t direction
Definition: direction.H:52
patchId
label patchId(-1)