BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / finiteVolume / fvMesh / fvPatches / constraint / cyclic / cyclicFvPatch.C
blobc453c91910fc20946044580716dae8afbcb0b253
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 "cyclicFvPatch.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvMesh.H"
29 #include "transform.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 namespace Foam
35     defineTypeNameAndDebug(cyclicFvPatch, 0);
36     addToRunTimeSelectionTable(fvPatch, cyclicFvPatch, polyPatch);
40 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
42 // Make patch weighting factors
43 void Foam::cyclicFvPatch::makeWeights(scalarField& w) const
45     const cyclicFvPatch& nbrPatch = neighbFvPatch();
47     const scalarField deltas(nf() & fvPatch::delta());
48     const scalarField nbrDeltas(nbrPatch.nf() & nbrPatch.fvPatch::delta());
50     forAll(deltas, facei)
51     {
52         scalar di = deltas[facei];
53         scalar dni = nbrDeltas[facei];
55         w[facei] = dni/(di + dni);
56     }
60 // Make patch face - neighbour cell distances
61 void Foam::cyclicFvPatch::makeDeltaCoeffs(scalarField& dc) const
63     //const cyclicPolyPatch& nbrPatch = cyclicPolyPatch_.neighbPatch();
64     const cyclicFvPatch& nbrPatch = neighbFvPatch();
66     const scalarField deltas(nf() & fvPatch::delta());
67     const scalarField nbrDeltas(nbrPatch.nf() & nbrPatch.fvPatch::delta());
69     forAll(deltas, facei)
70     {
71         scalar di = deltas[facei];
72         scalar dni = nbrDeltas[facei];
74         dc[facei] = 1.0/(di + dni);
75     }
79 // Return delta (P to N) vectors across coupled patch
80 Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const
82     const vectorField patchD(fvPatch::delta());
83     const vectorField nbrPatchD(neighbFvPatch().fvPatch::delta());
85     tmp<vectorField> tpdv(new vectorField(patchD.size()));
86     vectorField& pdv = tpdv();
88     // To the transformation if necessary
89     if (parallel())
90     {
91         forAll(patchD, facei)
92         {
93             vector ddi = patchD[facei];
94             vector dni = nbrPatchD[facei];
96             pdv[facei] = ddi - dni;
97         }
98     }
99     else
100     {
101         forAll(patchD, facei)
102         {
103             vector ddi = patchD[facei];
104             vector dni = nbrPatchD[facei];
106             pdv[facei] = ddi - transform(forwardT()[0], dni);
107         }
108     }
110     return tpdv;
114 Foam::tmp<Foam::labelField> Foam::cyclicFvPatch::interfaceInternalField
116     const labelUList& internalData
117 ) const
119     return patchInternalField(internalData);
123 Foam::tmp<Foam::labelField> Foam::cyclicFvPatch::internalFieldTransfer
125     const Pstream::commsTypes commsType,
126     const labelUList& iF
127 ) const
129     return neighbFvPatch().patchInternalField(iF);
133 // ************************************************************************* //