cyclicACMIGAMGInterfaceField.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) 2013 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 "lduMatrix.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(cyclicACMIGAMGInterfaceField, 0);
39  (
40  GAMGInterfaceField,
41  cyclicACMIGAMGInterfaceField,
42  lduInterface
43  );
45  (
46  GAMGInterfaceField,
47  cyclicACMIGAMGInterfaceField,
48  lduInterfaceField
49  );
50 }
51 
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
55 Foam::cyclicACMIGAMGInterfaceField::cyclicACMIGAMGInterfaceField
56 (
57  const GAMGInterface& GAMGCp,
58  const lduInterfaceField& fineInterface
59 )
60 :
61  GAMGInterfaceField(GAMGCp, fineInterface),
62  cyclicACMIInterface_(refCast<const cyclicACMIGAMGInterface>(GAMGCp)),
63  doTransform_(false),
64  rank_(0)
65 {
67  refCast<const cyclicAMILduInterfaceField>(fineInterface);
68 
69  doTransform_ = p.doTransform();
70  rank_ = p.rank();
71 }
72 
73 
74 Foam::cyclicACMIGAMGInterfaceField::cyclicACMIGAMGInterfaceField
75 (
76  const GAMGInterface& GAMGCp,
77  const bool doTransform,
78  const int rank
79 )
80 :
81  GAMGInterfaceField(GAMGCp, doTransform, rank),
82  cyclicACMIInterface_(refCast<const cyclicACMIGAMGInterface>(GAMGCp)),
83  doTransform_(doTransform),
84  rank_(rank)
85 {}
86 
87 
88 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
89 
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
97 (
98  solveScalarField& result,
99  const bool add,
100  const lduAddressing& lduAddr,
101  const label patchId,
102  const solveScalarField& psiInternal,
103  const scalarField& coeffs,
104  const direction cmpt,
105  const Pstream::commsTypes
106 ) const
107 {
108  // Get neighbouring field
109  const labelList& nbrFaceCells =
110  lduAddr.patchAddr
111  (
112  cyclicACMIInterface_.neighbPatchID()
113  );
114 
115  solveScalarField pnf(psiInternal, nbrFaceCells);
116 
117  // Transform according to the transformation tensors
118  transformCoupleField(pnf, cmpt);
119 
120  if (cyclicACMIInterface_.owner())
121  {
122  pnf = cyclicACMIInterface_.AMI().interpolateToSource(pnf);
123  }
124  else
125  {
126  pnf = cyclicACMIInterface_.neighbPatch().AMI().interpolateToTarget(pnf);
127  }
128 
129  const labelUList& faceCells = lduAddr.patchAddr(patchId);
130 
131  this->addToInternalField(result, !add, faceCells, coeffs, pnf);
132 }
133 
134 
135 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::cyclicACMIGAMGInterfaceField::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: cyclicACMIGAMGInterfaceField.C:97
Foam::cyclicAMILduInterfaceField
Abstract base class for cyclic AMI coupled interfaces.
Definition: cyclicAMILduInterfaceField.H:51
cyclicACMIGAMGInterfaceField.H
lduMatrix.H
Foam::Field< solveScalar >
Foam::GAMGInterface
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:54
Foam::GAMGInterfaceField
Abstract base class for GAMG agglomerated interface fields.
Definition: GAMGInterfaceField.H:54
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::lduInterfaceField
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Definition: lduInterfaceField.H:58
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::List< label >
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::cyclicACMIGAMGInterfaceField::~cyclicACMIGAMGInterfaceField
virtual ~cyclicACMIGAMGInterfaceField()
Destructor.
Definition: cyclicACMIGAMGInterfaceField.C:90
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56