ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / finiteVolume / fvMesh / fvPatches / constraint / processor / processorFvPatch.C
blobcbd3575ff1681eb048f1ac2b053a792a4c19ac44
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
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
19     for more details.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(processorFvPatch, 0);
38 addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
41 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
43 void processorFvPatch::makeWeights(scalarField& w) const
45     if (Pstream::parRun())
46     {
47         // The face normals point in the opposite direction on the other side
48         scalarField neighbFaceCentresCn
49         (
50             (
51                 procPolyPatch_.neighbFaceAreas()
52                /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
53             )
54           & (
55               procPolyPatch_.neighbFaceCentres()
56             - procPolyPatch_.neighbFaceCellCentres())
57         );
59         w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn);
60     }
61     else
62     {
63         w = 1.0;
64     }
68 void processorFvPatch::makeDeltaCoeffs(scalarField& dc) const
70     if (Pstream::parRun())
71     {
72         dc = (1.0 - weights())/(nf() & fvPatch::delta());
73     }
74     else
75     {
76         dc = 1.0/(nf() & fvPatch::delta());
77     }
81 tmp<vectorField> processorFvPatch::delta() const
83     if (Pstream::parRun())
84     {
85         // To the transformation if necessary
86         if (parallel())
87         {
88             return
89                 fvPatch::delta()
90               - (
91                     procPolyPatch_.neighbFaceCentres()
92                   - procPolyPatch_.neighbFaceCellCentres()
93                 );
94         }
95         else
96         {
97             return
98                 fvPatch::delta()
99               - transform
100                 (
101                     forwardT(),
102                     (
103                         procPolyPatch_.neighbFaceCentres()
104                       - procPolyPatch_.neighbFaceCellCentres()
105                     )
106                 );
107         }
108     }
109     else
110     {
111         return fvPatch::delta();
112     }
116 tmp<labelField> processorFvPatch::interfaceInternalField
118     const labelUList& internalData
119 ) const
121     return patchInternalField(internalData);
125 void processorFvPatch::initInternalFieldTransfer
127     const Pstream::commsTypes commsType,
128     const labelUList& iF
129 ) const
131     send(commsType, patchInternalField(iF)());
135 tmp<labelField> processorFvPatch::internalFieldTransfer
137     const Pstream::commsTypes commsType,
138     const labelUList&
139 ) const
141     return receive<label>(commsType, this->size());
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace Foam
149 // ************************************************************************* //