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 
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 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
volFields.H
Foam::boundaryMesh::mesh
const bMesh & mesh() const
Definition: boundaryMesh.H:202
Foam::fvPatch::Sf
const vectorField & Sf() const
Return face area vectors.
Definition: fvPatch.C:130
w
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::fvPatch::~fvPatch
virtual ~fvPatch()
Destructor.
Definition: fvPatch.C:55
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::fvPatch::delta
virtual tmp< vectorField > delta() const
Return cell-centre to face-centre vector.
Definition: fvPatch.C:142
surfaceFields.H
Foam::surfaceFields.
Foam::fvPatch::movePoints
virtual void movePoints()
Correct patches after moving points.
Definition: fvPatch.C:160
Foam::fvPatch::fvPatch
fvPatch(const fvPatch &)
Disallow construct as copy.
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:49
Foam::fvBoundaryMesh
Foam::fvBoundaryMesh.
Definition: fvBoundaryMesh.H:52
Foam::fvPatch::nf
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:124
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::fvPatch::initMovePoints
virtual void initMovePoints()
Initialise the patches for moving points.
Definition: fvPatch.C:156
Foam::fvPatch::constraintType
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
Definition: fvPatch.C:61
Foam::fvPatch::Cf
const vectorField & Cf() const
Return face centres.
Definition: fvPatch.C:99
fvBoundaryMesh.H
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::List::setSize
void setSize(const label)
Reset size of List.
Foam::fvPatch::weights
const scalarField & weights() const
Return patch weighting factors.
Definition: fvPatch.C:170
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::fvPatch::deltaCoeffs
const scalarField & deltaCoeffs() const
Return the face - cell distance coeffient.
Definition: fvPatch.C:164
Foam::UList
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
Foam::fvPatch::faceCells
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:93
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:59
fvPatch.H
Foam::fvPatch::magSf
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:136
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::fvPatch::makeWeights
virtual void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: fvPatch.C:150
Foam::fvPatch::constraintTypes
static wordList constraintTypes()
Return a list of all the constraint patch types.
Definition: fvPatch.C:67
Foam::fvPatch::Cn
tmp< vectorField > Cn() const
Return neighbour cell centres.
Definition: fvPatch.C:105