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 \*---------------------------------------------------------------------------*/
26 #include "processorFvPatch.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "transformField.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(processorFvPatch, 0);
38 addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
41 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
43 void processorFvPatch::makeWeights(scalarField& w) const
45 if (Pstream::parRun())
47 // The face normals point in the opposite direction on the other side
48 scalarField neighbFaceCentresCn
51 procPolyPatch_.neighbFaceAreas()
52 /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
55 procPolyPatch_.neighbFaceCentres()
56 - procPolyPatch_.neighbFaceCellCentres())
59 w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn);
68 void processorFvPatch::makeDeltaCoeffs(scalarField& dc) const
70 if (Pstream::parRun())
72 dc = (1.0 - weights())/(nf() & fvPatch::delta());
76 dc = 1.0/(nf() & fvPatch::delta());
81 tmp<vectorField> processorFvPatch::delta() const
83 if (Pstream::parRun())
85 // To the transformation if necessary
91 procPolyPatch_.neighbFaceCentres()
92 - procPolyPatch_.neighbFaceCellCentres()
103 procPolyPatch_.neighbFaceCentres()
104 - procPolyPatch_.neighbFaceCellCentres()
111 return fvPatch::delta();
116 tmp<labelField> processorFvPatch::interfaceInternalField
118 const labelUList& internalData
121 return patchInternalField(internalData);
125 void processorFvPatch::initInternalFieldTransfer
127 const Pstream::commsTypes commsType,
131 send(commsType, patchInternalField(iF)());
135 tmp<labelField> processorFvPatch::internalFieldTransfer
137 const Pstream::commsTypes commsType,
141 return receive<label>(commsType, this->size());
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace Foam
149 // ************************************************************************* //