FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/lduMatrix.H>
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(cyclicGAMGInterfaceField, 0);
36  (
37  GAMGInterfaceField,
38  cyclicGAMGInterfaceField,
39  lduInterface
40  );
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
46 Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
47 (
48  const GAMGInterface& GAMGCp,
49  const lduInterfaceField& fineInterface
50 )
51 :
52  GAMGInterfaceField(GAMGCp, fineInterface),
53  cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
54  doTransform_(false),
55  rank_(0)
56 {
57  const cyclicLduInterfaceField& p =
58  refCast<const cyclicLduInterfaceField>(fineInterface);
59 
60  doTransform_ = p.doTransform();
61  rank_ = p.rank();
62 }
63 
64 
65 // * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
66 
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
74 (
75  const scalarField& psiInternal,
76  scalarField& result,
77  const lduMatrix&,
78  const scalarField& coeffs,
79  const direction cmpt,
81 ) const
82 {
83  scalarField pnf(size());
84 
85  label sizeby2 = size()/2;
86 
87  const unallocLabelList& faceCells = cyclicInterface_.faceCells();
88 
89  for (label facei=0; facei<sizeby2; facei++)
90  {
91  pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
92  pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
93  }
94 
95  transformCoupleField(pnf, cmpt);
96 
97  forAll(faceCells, elemI)
98  {
99  result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
100  }
101 }
102 
103 
104 // ************************ vim: set sw=4 sts=4 et: ************************ //