cyclicGAMGInterfaceField.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 | Copyright (C) 2011-2013 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 
68 Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
69 (
70  const GAMGInterface& GAMGCp,
71  const lduInterfaceField& fineInterface
72 )
73 :
74  GAMGInterfaceField(GAMGCp, fineInterface),
75  cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
76  doTransform_(false),
77  rank_(0)
78 {
79  const cyclicLduInterfaceField& p =
80  refCast<const cyclicLduInterfaceField>(fineInterface);
81 
82  doTransform_ = p.doTransform();
83  rank_ = p.rank();
84 }
85 
86 
87 Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
88 (
89  const GAMGInterface& GAMGCp,
90  const bool doTransform,
91  const int rank
92 )
93 :
94  GAMGInterfaceField(GAMGCp, doTransform, rank),
95  cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
96  doTransform_(doTransform),
97  rank_(rank)
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
102 
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
110 (
111  scalarField& result,
112  const scalarField& psiInternal,
113  const scalarField& coeffs,
114  const direction cmpt,
115  const Pstream::commsTypes
116 ) const
117 {
118  // Get neighbouring field
119  scalarField pnf
120  (
121  cyclicInterface_.neighbPatch().interfaceInternalField(psiInternal)
122  );
123 
124  transformCoupleField(pnf, cmpt);
125 
126  const labelUList& faceCells = cyclicInterface_.faceCells();
127 
128  forAll(faceCells, elemI)
129  {
130  result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
131  }
132 }
133 
134 
135 // ************************************************************************* //
virtual bool doTransform() const =0
Is the transform required.
unsigned char direction
Definition: direction.H:43
virtual int rank() const =0
Return rank of component for transform.
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.
virtual ~cyclicGAMGInterfaceField()
Destructor.
Namespace for OpenFOAM.
Abstract base class for cyclic coupled interfaces.
Abstract base class for GAMG agglomerated interface fields.
volScalarField & p
Definition: createFields.H:51
commsTypes
Types of communications.
Definition: UPstream.H:64
#define forAll(list, i)
Definition: UList.H:421
Macros for easy insertion into run-time selection tables.
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
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:51
addNamedToRunTimeSelectionTable(GAMGProcAgglomeration, noneGAMGProcAgglomeration, GAMGAgglomeration, none)
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)