1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvBoundaryMesh.H"
31 #include "primitiveMesh.H"
32 #include "volFields.H"
33 #include "surfaceFields.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(fvPatch, 0);
43 defineRunTimeSelectionTable(fvPatch, polyPatch);
44 addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch);
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm)
56 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
64 bool fvPatch::constraintType(const word& pt)
66 return fvPatchField<scalar>::patchConstructorTablePtr_->found(pt);
70 wordList fvPatch::constraintTypes()
72 wordList cTypes(polyPatchConstructorTablePtr_->size());
78 polyPatchConstructorTable::iterator cstrIter =
79 polyPatchConstructorTablePtr_->begin();
80 cstrIter != polyPatchConstructorTablePtr_->end();
84 if (constraintType(cstrIter.key()))
86 cTypes[i++] = cstrIter.key();
96 const unallocLabelList& fvPatch::faceCells() const
98 return polyPatch_.faceCells();
102 const vectorField& fvPatch::Cf() const
104 return boundaryMesh().mesh().Cf().boundaryField()[index()];
108 tmp<vectorField> fvPatch::Cn() const
110 tmp<vectorField> tcc(new vectorField(size()));
111 vectorField& cc = tcc();
113 const unallocLabelList& faceCells = this->faceCells();
115 // get reference to global cell centres
116 const vectorField& gcc = boundaryMesh().mesh().cellCentres();
118 forAll (faceCells, faceI)
120 cc[faceI] = gcc[faceCells[faceI]];
127 tmp<vectorField> fvPatch::nf() const
133 const vectorField& fvPatch::Sf() const
135 return boundaryMesh().mesh().Sf().boundaryField()[index()];
139 const scalarField& fvPatch::magSf() const
141 return boundaryMesh().mesh().magSf().boundaryField()[index()];
145 tmp<vectorField> fvPatch::delta() const
151 void fvPatch::makeWeights(scalarField& w) const
157 void fvPatch::makeDeltaCoeffs(scalarField& dc) const
159 dc = 1.0/(nf() & delta());
163 void fvPatch::initMovePoints()
167 void fvPatch::movePoints()
171 const scalarField& fvPatch::deltaCoeffs() const
173 return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];
177 const scalarField& fvPatch::weights() const
179 return boundaryMesh().mesh().weights().boundaryField()[index()];
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // ************************************************************************* //