initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fvMesh / fvPatches / constraint / processor / processorFvPatch.C
blob237e99a61f2a070259475796d1e97d4284b44795
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace Foam
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(processorFvPatch, 0);
39 addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
42 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
44 void processorFvPatch::makeWeights(scalarField& w) const
46     if (Pstream::parRun())
47     {
48         // The face normals point in the opposite direction on the other side
49         scalarField neighbFaceCentresCn
50         (
51             (
52                 procPolyPatch_.neighbFaceAreas()
53                /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
54             )
55           & (
56               procPolyPatch_.neighbFaceCentres()
57             - procPolyPatch_.neighbFaceCellCentres())
58         );
60         w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn);
61     }
62     else
63     {
64         w = 1.0;
65     }
69 void processorFvPatch::makeDeltaCoeffs(scalarField& dc) const
71     if (Pstream::parRun())
72     {
73         dc = (1.0 - weights())/(nf() & fvPatch::delta());
74     }
75     else
76     {
77         dc = 1.0/(nf() & fvPatch::delta());
78     }
82 tmp<vectorField> processorFvPatch::delta() const
84     if (Pstream::parRun())
85     {
86         // To the transformation if necessary
87         if (parallel())
88         {
89             return
90                 fvPatch::delta()
91               - (
92                     procPolyPatch_.neighbFaceCentres()
93                   - procPolyPatch_.neighbFaceCellCentres()
94                 );
95         }
96         else
97         {
98             return
99                 fvPatch::delta()
100               - transform
101                 (
102                     forwardT(),
103                     (
104                         procPolyPatch_.neighbFaceCentres()
105                       - procPolyPatch_.neighbFaceCellCentres()
106                     )
107                 );
108         }
109     }
110     else
111     {
112         return fvPatch::delta();
113     }
117 tmp<labelField> processorFvPatch::interfaceInternalField
119     const unallocLabelList& internalData
120 ) const
122     return patchInternalField(internalData);
126 void processorFvPatch::initTransfer
128     const Pstream::commsTypes commsType,
129     const unallocLabelList& interfaceData
130 ) const
132     send(commsType, interfaceData);
136 tmp<labelField> processorFvPatch::transfer
138     const Pstream::commsTypes commsType,
139     const unallocLabelList&
140 ) const
142     return receive<label>(commsType, this->size());
146 void processorFvPatch::initInternalFieldTransfer
148     const Pstream::commsTypes commsType,
149     const unallocLabelList& iF
150 ) const
152     send(commsType, patchInternalField(iF)());
156 tmp<labelField> processorFvPatch::internalFieldTransfer
158     const Pstream::commsTypes commsType,
159     const unallocLabelList&
160 ) const
162     return receive<label>(commsType, this->size());
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 } // End namespace Foam
170 // ************************************************************************* //