1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvBoundaryMesh.H"
30 #include "primitiveMesh.H"
31 #include "volFields.H"
32 #include "surfaceFields.H"
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(fvPatch, 0);
39 defineRunTimeSelectionTable(fvPatch, polyPatch);
40 addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch);
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 Foam::fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm)
52 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54 Foam::fvPatch::~fvPatch()
58 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
60 bool Foam::fvPatch::constraintType(const word& pt)
62 return fvPatchField<scalar>::patchConstructorTablePtr_->found(pt);
66 Foam::wordList Foam::fvPatch::constraintTypes()
68 wordList cTypes(polyPatchConstructorTablePtr_->size());
74 polyPatchConstructorTable::iterator cstrIter =
75 polyPatchConstructorTablePtr_->begin();
76 cstrIter != polyPatchConstructorTablePtr_->end();
80 if (constraintType(cstrIter.key()))
82 cTypes[i++] = cstrIter.key();
92 const Foam::labelUList& Foam::fvPatch::faceCells() const
94 return polyPatch_.faceCells();
98 const Foam::vectorField& Foam::fvPatch::Cf() const
100 return boundaryMesh().mesh().Cf().boundaryField()[index()];
104 Foam::tmp<Foam::vectorField> Foam::fvPatch::Cn() const
106 tmp<vectorField> tcc(new vectorField(size()));
107 vectorField& cc = tcc();
109 const labelUList& faceCells = this->faceCells();
111 // get reference to global cell centres
112 const vectorField& gcc = boundaryMesh().mesh().cellCentres();
114 forAll(faceCells, faceI)
116 cc[faceI] = gcc[faceCells[faceI]];
123 Foam::tmp<Foam::vectorField> Foam::fvPatch::nf() const
129 const Foam::vectorField& Foam::fvPatch::Sf() const
131 return boundaryMesh().mesh().Sf().boundaryField()[index()];
135 const Foam::scalarField& Foam::fvPatch::magSf() const
137 return boundaryMesh().mesh().magSf().boundaryField()[index()];
141 Foam::tmp<Foam::vectorField> Foam::fvPatch::delta() const
147 void Foam::fvPatch::makeWeights(scalarField& w) const
153 void Foam::fvPatch::makeDeltaCoeffs(scalarField& dc) const
155 dc = 1.0/(nf() & delta());
159 void Foam::fvPatch::initMovePoints()
163 void Foam::fvPatch::movePoints()
167 const Foam::scalarField& Foam::fvPatch::deltaCoeffs() const
169 return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];
173 const Foam::scalarField& Foam::fvPatch::weights() const
175 return boundaryMesh().mesh().weights().boundaryField()[index()];
179 // ************************************************************************* //