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 "cyclicFvPatch.H"
27 #include "addToRunTimeSelectionTable.H"
29 #include "transform.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
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());
52 scalar di = deltas[facei];
53 scalar dni = nbrDeltas[facei];
55 w[facei] = dni/(di + dni);
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());
71 scalar di = deltas[facei];
72 scalar dni = nbrDeltas[facei];
74 dc[facei] = 1.0/(di + dni);
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
93 vector ddi = patchD[facei];
94 vector dni = nbrPatchD[facei];
96 pdv[facei] = ddi - dni;
101 forAll(patchD, facei)
103 vector ddi = patchD[facei];
104 vector dni = nbrPatchD[facei];
106 pdv[facei] = ddi - transform(forwardT()[0], dni);
114 Foam::tmp<Foam::labelField> Foam::cyclicFvPatch::interfaceInternalField
116 const labelUList& internalData
119 return patchInternalField(internalData);
123 Foam::tmp<Foam::labelField> Foam::cyclicFvPatch::internalFieldTransfer
125 const Pstream::commsTypes commsType,
129 return neighbFvPatch().patchInternalField(iF);
133 // ************************************************************************* //