cyclicGAMGInterfaceField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 #include "lduMatrix.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(cyclicGAMGInterfaceField, 0);
36  (
37  GAMGInterfaceField,
38  cyclicGAMGInterfaceField,
39  lduInterface
40  );
42  (
43  GAMGInterfaceField,
44  cyclicGAMGInterfaceField,
45  lduInterfaceField
46  );
47 
48  // Add under name cyclicSlip
50  (
51  GAMGInterfaceField,
52  cyclicGAMGInterfaceField,
53  lduInterface,
54  cyclicSlip
55  );
57  (
58  GAMGInterfaceField,
59  cyclicGAMGInterfaceField,
60  lduInterfaceField,
61  cyclicSlip
62  );
63 }
64 
65 
66 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
67 
69 (
70  const GAMGInterface& GAMGCp,
71  const lduInterfaceField& fineInterface
72 )
73 :
74  GAMGInterfaceField(GAMGCp, fineInterface),
75  cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
76  rank_(0)
77 {
78  const cyclicLduInterfaceField& p =
79  refCast<const cyclicLduInterfaceField>(fineInterface);
80 
81  rank_ = p.rank();
82 }
83 
84 
86 (
87  const GAMGInterface& GAMGCp,
88  const int rank
89 )
90 :
91  GAMGInterfaceField(GAMGCp, rank),
92  cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
93  rank_(rank)
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
98 
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 
106 (
107  scalarField& result,
108  const scalarField& psiInternal,
109  const scalarField& coeffs,
110  const direction cmpt,
111  const Pstream::commsTypes
112 ) const
113 {
114  // Get neighbouring field
115  scalarField pnf
116  (
117  cyclicInterface_.nbrPatch().interfaceInternalField(psiInternal)
118  );
119 
120  transformCoupleField(pnf, cmpt);
121 
122  const labelUList& faceCells = cyclicInterface_.faceCells();
123 
124  forAll(faceCells, elemI)
125  {
126  result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
127  }
128 }
129 
130 
131 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
commsTypes
Types of communications.
Definition: UPstream.H:64
virtual int rank() const =0
Return rank of component for transform.
uint8_t direction
Definition: direction.H:45
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Macros for easy insertion into run-time selection tables.
virtual ~cyclicGAMGInterfaceField()
Destructor.
cyclicGAMGInterfaceField(const GAMGInterface &GAMGCp, const lduInterfaceField &fineInterfaceField)
Construct from GAMG interface and fine level interface field.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:51
virtual void updateInterfaceMatrix(scalarField &result, const scalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
Abstract base class for GAMG agglomerated interface fields.
volScalarField & p
Abstract base class for cyclic coupled interfaces.
addNamedToRunTimeSelectionTable(parcelCloud, collidingCloud, viscosity, collidingCloud)
Namespace for OpenFOAM.