FreeFOAM The Cross-Platform CFD Toolkit
fvPatch.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 
26 #include "fvPatch.H"
29 #include <finiteVolume/fvMesh.H>
30 #include <OpenFOAM/primitiveMesh.H>
31 #include <finiteVolume/volFields.H>
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 
41 defineTypeNameAndDebug(fvPatch, 0);
42 defineRunTimeSelectionTable(fvPatch, polyPatch);
43 addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch);
44 
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
48 fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm)
49 :
50  polyPatch_(p),
51  boundaryMesh_(bm)
52 {}
53 
54 
55 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
56 
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62 
64 {
66 }
67 
68 
70 {
71  wordList cTypes(polyPatchConstructorTablePtr_->size());
72 
73  label i = 0;
74 
75  for
76  (
77  polyPatchConstructorTable::iterator cstrIter =
78  polyPatchConstructorTablePtr_->begin();
79  cstrIter != polyPatchConstructorTablePtr_->end();
80  ++cstrIter
81  )
82  {
83  if (constraintType(cstrIter.key()))
84  {
85  cTypes[i++] = cstrIter.key();
86  }
87  }
88 
89  cTypes.setSize(i);
90 
91  return cTypes;
92 }
93 
94 
96 {
97  return polyPatch_.faceCells();
98 }
99 
100 
101 const vectorField& fvPatch::Cf() const
102 {
103  return boundaryMesh().mesh().Cf().boundaryField()[index()];
104 }
105 
106 
108 {
109  tmp<vectorField> tcc(new vectorField(size()));
110  vectorField& cc = tcc();
111 
112  const unallocLabelList& faceCells = this->faceCells();
113 
114  // get reference to global cell centres
115  const vectorField& gcc = boundaryMesh().mesh().cellCentres();
116 
117  forAll (faceCells, faceI)
118  {
119  cc[faceI] = gcc[faceCells[faceI]];
120  }
121 
122  return tcc;
123 }
124 
125 
127 {
128  return Sf()/magSf();
129 }
130 
131 
132 const vectorField& fvPatch::Sf() const
133 {
134  return boundaryMesh().mesh().Sf().boundaryField()[index()];
135 }
136 
137 
139 {
140  return boundaryMesh().mesh().magSf().boundaryField()[index()];
141 }
142 
143 
145 {
146  return Cf() - Cn();
147 }
148 
149 
151 {
152  w = 1.0;
153 }
154 
155 
157 {
158  dc = 1.0/(nf() & delta());
159 }
160 
161 
163 {}
164 
165 
167 {}
168 
169 
171 {
172  return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];
173 }
174 
175 
177 {
178  return boundaryMesh().mesh().weights().boundaryField()[index()];
179 }
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // ************************ vim: set sw=4 sts=4 et: ************************ //