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 \*---------------------------------------------------------------------------*/
27 #include "processorFvPatch.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "transformField.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(processorFvPatch, 0);
39 addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
42 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
44 void processorFvPatch::makeWeights(scalarField& w) const
46 if (Pstream::parRun())
48 // The face normals point in the opposite direction on the other side
49 scalarField neighbFaceCentresCn
52 procPolyPatch_.neighbFaceAreas()
53 /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
56 procPolyPatch_.neighbFaceCentres()
57 - procPolyPatch_.neighbFaceCellCentres())
60 w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn);
69 void processorFvPatch::makeDeltaCoeffs(scalarField& dc) const
71 if (Pstream::parRun())
73 dc = (1.0 - weights())/(nf() & fvPatch::delta());
77 dc = 1.0/(nf() & fvPatch::delta());
82 tmp<vectorField> processorFvPatch::delta() const
84 if (Pstream::parRun())
86 // To the transformation if necessary
92 procPolyPatch_.neighbFaceCentres()
93 - procPolyPatch_.neighbFaceCellCentres()
104 procPolyPatch_.neighbFaceCentres()
105 - procPolyPatch_.neighbFaceCellCentres()
112 return fvPatch::delta();
117 tmp<labelField> processorFvPatch::interfaceInternalField
119 const unallocLabelList& internalData
122 return patchInternalField(internalData);
126 void processorFvPatch::initTransfer
128 const Pstream::commsTypes commsType,
129 const unallocLabelList& interfaceData
132 send(commsType, interfaceData);
136 tmp<labelField> processorFvPatch::transfer
138 const Pstream::commsTypes commsType,
139 const unallocLabelList&
142 return receive<label>(commsType, this->size());
146 void processorFvPatch::initInternalFieldTransfer
148 const Pstream::commsTypes commsType,
149 const unallocLabelList& iF
152 send(commsType, patchInternalField(iF)());
156 tmp<labelField> processorFvPatch::internalFieldTransfer
158 const Pstream::commsTypes commsType,
159 const unallocLabelList&
162 return receive<label>(commsType, this->size());
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 } // End namespace Foam
170 // ************************************************************************* //