cyclicAMIGAMGInterfaceField.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) 2011-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(cyclicAMIGAMGInterfaceField, 0);
39  (
40  GAMGInterfaceField,
41  cyclicAMIGAMGInterfaceField,
42  lduInterface
43  );
45  (
46  GAMGInterfaceField,
47  cyclicAMIGAMGInterfaceField,
48  lduInterfaceField
49  );
50 }
51 
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
55 Foam::cyclicAMIGAMGInterfaceField::cyclicAMIGAMGInterfaceField
56 (
57  const GAMGInterface& GAMGCp,
58  const lduInterfaceField& fineInterface
59 )
60 :
61  GAMGInterfaceField(GAMGCp, fineInterface),
62  cyclicAMIInterface_(refCast<const cyclicAMIGAMGInterface>(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::cyclicAMIGAMGInterfaceField::cyclicAMIGAMGInterfaceField
75 (
76  const GAMGInterface& GAMGCp,
77  const bool doTransform,
78  const int rank
79 )
80 :
81  GAMGInterfaceField(GAMGCp, doTransform, rank),
82  cyclicAMIInterface_(refCast<const cyclicAMIGAMGInterface>(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 
110  const labelList& nbrFaceCells =
111  lduAddr.patchAddr
112  (
113  cyclicAMIInterface_.neighbPatchID()
114  );
115 
116  solveScalarField pnf(psiInternal, nbrFaceCells);
117 
118  // Transform according to the transformation tensors
119  transformCoupleField(pnf, cmpt);
120 
121  if (cyclicAMIInterface_.owner())
122  {
123  pnf = cyclicAMIInterface_.AMI().interpolateToSource(pnf);
124  }
125  else
126  {
127  pnf = cyclicAMIInterface_.neighbPatch().AMI().interpolateToTarget(pnf);
128  }
129 
130  const labelUList& faceCells = lduAddr.patchAddr(patchId);
131 
132  this->addToInternalField(result, !add, faceCells, coeffs, pnf);
133 }
134 
135 
136 // ************************************************************************* //
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
cyclicAMIGAMGInterfaceField.H
Foam::cyclicAMILduInterfaceField
Abstract base class for cyclic AMI coupled interfaces.
Definition: cyclicAMILduInterfaceField.H:51
Foam::cyclicAMIGAMGInterfaceField::~cyclicAMIGAMGInterfaceField
virtual ~cyclicAMIGAMGInterfaceField()
Destructor.
Definition: cyclicAMIGAMGInterfaceField.C:90
lduMatrix.H
Foam::Field< solveScalar >
Foam::GAMGInterface
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:54
Foam::cyclicAMIGAMGInterfaceField::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: cyclicAMIGAMGInterfaceField.C:97
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::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56