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-2022 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  // Add under name nonConformalCyclic
66  (
67  GAMGInterfaceField,
68  cyclicGAMGInterfaceField,
69  lduInterface,
70  nonConformalCyclic
71  );
73  (
74  GAMGInterfaceField,
75  cyclicGAMGInterfaceField,
76  lduInterfaceField,
77  nonConformalCyclic
78  );
79 }
80 
81 
82 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
83 
85 (
86  const GAMGInterface& GAMGCp,
87  const lduInterfaceField& fineInterface
88 )
89 :
90  GAMGInterfaceField(GAMGCp, fineInterface),
91  cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
92  rank_(0)
93 {
94  const cyclicLduInterfaceField& p =
95  refCast<const cyclicLduInterfaceField>(fineInterface);
96 
97  rank_ = p.rank();
98 }
99 
100 
102 (
103  const GAMGInterface& GAMGCp,
104  const int rank
105 )
106 :
107  GAMGInterfaceField(GAMGCp, rank),
108  cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
109  rank_(rank)
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
114 
116 {}
117 
118 
119 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
120 
122 (
123  scalarField& result,
124  const scalarField& psiInternal,
125  const scalarField& coeffs,
126  const direction cmpt,
127  const Pstream::commsTypes
128 ) const
129 {
130  // Get neighbouring field
131  scalarField pnf
132  (
133  cyclicInterface_.nbrPatch().interfaceInternalField(psiInternal)
134  );
135 
136  transformCoupleField(pnf, cmpt);
137 
138  const labelUList& faceCells = cyclicInterface_.faceCells();
139 
140  forAll(faceCells, elemI)
141  {
142  result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
143  }
144 }
145 
146 
147 // ************************************************************************* //
#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.