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) 2011-2014 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 
26 #include "fvPatch.H"
28 #include "fvBoundaryMesh.H"
29 #include "fvMesh.H"
30 #include "primitiveMesh.H"
31 #include "volFields.H"
32 #include "surfaceFields.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38  defineTypeNameAndDebug(fvPatch, 0);
39  defineRunTimeSelectionTable(fvPatch, polyPatch);
40  addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch);
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
46 Foam::fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm)
47 :
48  polyPatch_(p),
49  boundaryMesh_(bm)
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54 
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
60 
62 {
64 }
65 
66 
68 {
69  wordList cTypes(polyPatchConstructorTablePtr_->size());
70 
71  label i = 0;
72 
73  for
74  (
75  polyPatchConstructorTable::iterator cstrIter =
76  polyPatchConstructorTablePtr_->begin();
77  cstrIter != polyPatchConstructorTablePtr_->end();
78  ++cstrIter
79  )
80  {
81  if (constraintType(cstrIter.key()))
82  {
83  cTypes[i++] = cstrIter.key();
84  }
85  }
86 
87  cTypes.setSize(i);
88 
89  return cTypes;
90 }
91 
92 
94 {
95  return polyPatch_.faceCells();
96 }
97 
98 
100 {
101  return boundaryMesh().mesh().Cf().boundaryField()[index()];
102 }
103 
104 
106 {
107  tmp<vectorField> tcc(new vectorField(size()));
108  vectorField& cc = tcc();
109 
110  const labelUList& faceCells = this->faceCells();
111 
112  // get reference to global cell centres
113  const vectorField& gcc = boundaryMesh().mesh().cellCentres();
114 
115  forAll(faceCells, faceI)
116  {
117  cc[faceI] = gcc[faceCells[faceI]];
118  }
119 
120  return tcc;
121 }
122 
123 
125 {
126  return Sf()/magSf();
127 }
128 
129 
131 {
132  return boundaryMesh().mesh().Sf().boundaryField()[index()];
133 }
134 
135 
137 {
138  return boundaryMesh().mesh().magSf().boundaryField()[index()];
139 }
140 
141 
143 {
144  // Use patch-normal delta for all non-coupled BCs
145  const vectorField nHat(nf());
146  return nHat*(nHat & (Cf() - Cn()));
147 }
148 
149 
151 {
152  w = 1.0;
153 }
154 
155 
157 {}
158 
159 
161 {}
162 
163 
165 {
166  return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];
167 }
168 
169 
171 {
172  return boundaryMesh().mesh().weights().boundaryField()[index()];
173 }
174 
175 
176 // ************************************************************************* //
const surfaceScalarField & weights() const
Return reference to linear difference weighting factors.
Foam::surfaceFields.
const scalarField & deltaCoeffs() const
Return the face - cell distance coeffient.
Definition: fvPatch.C:164
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
const surfaceVectorField & Sf() const
Return cell face area vectors.
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:99
const scalarField & weights() const
Return patch weighting factors.
Definition: fvPatch.C:170
virtual tmp< vectorField > delta() const
Return cell-centre to face-centre vector.
Definition: fvPatch.C:142
const labelUList & faceCells() const
Return face-cell addressing.
Definition: polyPatch.C:316
Foam::fvBoundaryMesh.
A class for handling words, derived from string.
Definition: word.H:59
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const vectorField & Sf() const
Return face area vectors.
Definition: fvPatch.C:130
const surfaceScalarField & deltaCoeffs() const
Return reference to cell-centre difference coefficients.
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:93
const vectorField & cellCentres() const
const surfaceVectorField & Cf() const
Return face centres as surfaceVectorField.
Namespace for OpenFOAM.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
void setSize(const label)
Reset size of List.
Definition: List.C:318
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:185
volScalarField & p
Definition: createFields.H:51
tmp< vectorField > Cn() const
Return neighbour cell centres.
Definition: fvPatch.C:105
Field< vector > vectorField
Specialisation of Field<T> for vector.
#define forAll(list, i)
Definition: UList.H:421
Macros for easy insertion into run-time selection tables.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:179
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:124
const fvMesh & mesh() const
Return the mesh reference.
virtual void initMovePoints()
Initialise the patches for moving points.
Definition: fvPatch.C:156
virtual void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: fvPatch.C:150
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
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
virtual void movePoints()
Correct patches after moving points.
Definition: fvPatch.C:160
virtual ~fvPatch()
Destructor.
Definition: fvPatch.C:55
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:136
virtual label size() const
Return size.
Definition: fvPatch.H:161
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
Definition: fvPatch.C:61
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
A class for managing temporary objects.
Definition: PtrList.H:118
static wordList constraintTypes()
Return a list of all the constraint patch types.
Definition: fvPatch.C:67
defineTypeNameAndDebug(combustionModel, 0)