fvPatches: Updated handling for delta() on coupled patches

This commit is contained in:
Henry
2014-07-30 12:37:01 +01:00
committed by Andrew Heather
parent 27bce3b0a1
commit 0fc33b2eda
6 changed files with 48 additions and 54 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -21,32 +21,30 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
coupledFvPatch is an abstract base class for patches that couple regions
of the computational domain e.g. cyclic and processor-processor links.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "coupledFvPatch.H" #include "coupledFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(coupledFvPatch, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // }
defineTypeNameAndDebug(coupledFvPatch, 0);
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
coupledFvPatch::~coupledFvPatch() Foam::coupledFvPatch::~coupledFvPatch()
{} {}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::vectorField> Foam::coupledFvPatch::delta() const
{
return Cf() - Cn();
}
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,13 +39,12 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Make patch weighting factors
void Foam::cyclicFvPatch::makeWeights(scalarField& w) const void Foam::cyclicFvPatch::makeWeights(scalarField& w) const
{ {
const cyclicFvPatch& nbrPatch = neighbFvPatch(); const cyclicFvPatch& nbrPatch = neighbFvPatch();
const scalarField deltas(nf() & fvPatch::delta()); const scalarField deltas(nf()&coupledFvPatch::delta());
const scalarField nbrDeltas(nbrPatch.nf() & nbrPatch.fvPatch::delta()); const scalarField nbrDeltas(nbrPatch.nf()&nbrPatch.coupledFvPatch::delta());
forAll(deltas, facei) forAll(deltas, facei)
{ {
@ -57,11 +56,10 @@ void Foam::cyclicFvPatch::makeWeights(scalarField& w) const
} }
// Return delta (P to N) vectors across coupled patch
Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const
{ {
const vectorField patchD(fvPatch::delta()); const vectorField patchD(coupledFvPatch::delta());
const vectorField nbrPatchD(neighbFvPatch().fvPatch::delta()); const vectorField nbrPatchD(neighbFvPatch().coupledFvPatch::delta());
tmp<vectorField> tpdv(new vectorField(patchD.size())); tmp<vectorField> tpdv(new vectorField(patchD.size()));
vectorField& pdv = tpdv(); vectorField& pdv = tpdv();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,7 @@ namespace Foam
addToRunTimeSelectionTable(fvPatch, cyclicACMIFvPatch, polyPatch); addToRunTimeSelectionTable(fvPatch, cyclicACMIFvPatch, polyPatch);
} }
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::cyclicACMIFvPatch::updateAreas() const void Foam::cyclicACMIFvPatch::updateAreas() const
@ -82,13 +83,13 @@ void Foam::cyclicACMIFvPatch::makeWeights(scalarField& w) const
const cyclicACMIFvPatch& nbrPatch = neighbFvPatch(); const cyclicACMIFvPatch& nbrPatch = neighbFvPatch();
const fvPatch& nbrPatchNonOverlap = nonOverlapPatch(); const fvPatch& nbrPatchNonOverlap = nonOverlapPatch();
const scalarField deltas(nf() & fvPatch::delta()); const scalarField deltas(nf() & coupledFvPatch::delta());
const scalarField nbrDeltas const scalarField nbrDeltas
( (
interpolate interpolate
( (
nbrPatch.nf() & nbrPatch.fvPatch::delta(), nbrPatch.nf() & nbrPatch.coupledFvPatch::delta(),
nbrPatchNonOverlap.nf() & nbrPatchNonOverlap.delta() nbrPatchNonOverlap.nf() & nbrPatchNonOverlap.delta()
) )
); );
@ -124,13 +125,13 @@ Foam::tmp<Foam::vectorField> Foam::cyclicACMIFvPatch::delta() const
const cyclicACMIFvPatch& nbrPatchCoupled = neighbFvPatch(); const cyclicACMIFvPatch& nbrPatchCoupled = neighbFvPatch();
const fvPatch& nbrPatchNonOverlap = nonOverlapPatch(); const fvPatch& nbrPatchNonOverlap = nonOverlapPatch();
const vectorField patchD(fvPatch::delta()); const vectorField patchD(coupledFvPatch::delta());
vectorField nbrPatchD vectorField nbrPatchD
( (
interpolate interpolate
( (
nbrPatchCoupled.fvPatch::delta(), nbrPatchCoupled.coupledFvPatch::delta(),
nbrPatchNonOverlap.delta() nbrPatchNonOverlap.delta()
) )
); );
@ -175,7 +176,7 @@ Foam::tmp<Foam::vectorField> Foam::cyclicACMIFvPatch::delta() const
} }
else else
{ {
return fvPatch::delta(); return coupledFvPatch::delta();
} }
} }

View File

@ -51,7 +51,7 @@ void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
{ {
const cyclicAMIFvPatch& nbrPatch = neighbFvPatch(); const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
const scalarField deltas(nf() & fvPatch::delta()); const scalarField deltas(nf() & coupledFvPatch::delta());
tmp<scalarField> tnbrDeltas; tmp<scalarField> tnbrDeltas;
if (applyLowWeightCorrection()) if (applyLowWeightCorrection())
@ -59,13 +59,14 @@ void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
tnbrDeltas = tnbrDeltas =
interpolate interpolate
( (
nbrPatch.nf() & nbrPatch.fvPatch::delta(), nbrPatch.nf() & nbrPatch.coupledFvPatch::delta(),
scalarField(this->size(), 1.0) scalarField(this->size(), 1.0)
); );
} }
else else
{ {
tnbrDeltas = interpolate(nbrPatch.nf() & nbrPatch.fvPatch::delta()); tnbrDeltas =
interpolate(nbrPatch.nf() & nbrPatch.coupledFvPatch::delta());
} }
const scalarField& nbrDeltas = tnbrDeltas(); const scalarField& nbrDeltas = tnbrDeltas();
@ -92,7 +93,7 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
if (coupled()) if (coupled())
{ {
const vectorField patchD(fvPatch::delta()); const vectorField patchD(coupledFvPatch::delta());
tmp<vectorField> tnbrPatchD; tmp<vectorField> tnbrPatchD;
if (applyLowWeightCorrection()) if (applyLowWeightCorrection())
@ -100,13 +101,13 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
tnbrPatchD = tnbrPatchD =
interpolate interpolate
( (
nbrPatch.fvPatch::delta(), nbrPatch.coupledFvPatch::delta(),
vectorField(this->size(), vector::zero) vectorField(this->size(), vector::zero)
); );
} }
else else
{ {
tnbrPatchD = interpolate(nbrPatch.fvPatch::delta()); tnbrPatchD = interpolate(nbrPatch.coupledFvPatch::delta());
} }
const vectorField& nbrPatchD = tnbrPatchD(); const vectorField& nbrPatchD = tnbrPatchD();
@ -140,7 +141,7 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
} }
else else
{ {
return fvPatch::delta(); return coupledFvPatch::delta();
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,20 +27,18 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "transformField.H" #include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(processorFvPatch, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
}
defineTypeNameAndDebug(processorFvPatch, 0);
addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void processorFvPatch::makeWeights(scalarField& w) const void Foam::processorFvPatch::makeWeights(scalarField& w) const
{ {
if (Pstream::parRun()) if (Pstream::parRun())
{ {
@ -56,7 +54,8 @@ void processorFvPatch::makeWeights(scalarField& w) const
- procPolyPatch_.neighbFaceCellCentres()) - procPolyPatch_.neighbFaceCellCentres())
); );
w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn); w = neighbFaceCentresCn
/((nf()&coupledFvPatch::delta()) + neighbFaceCentresCn);
} }
else else
{ {
@ -65,7 +64,7 @@ void processorFvPatch::makeWeights(scalarField& w) const
} }
tmp<vectorField> processorFvPatch::delta() const Foam::tmp<Foam::vectorField> Foam::processorFvPatch::delta() const
{ {
if (Pstream::parRun()) if (Pstream::parRun())
{ {
@ -73,7 +72,7 @@ tmp<vectorField> processorFvPatch::delta() const
if (parallel()) if (parallel())
{ {
return return
fvPatch::delta() coupledFvPatch::delta()
- ( - (
procPolyPatch_.neighbFaceCentres() procPolyPatch_.neighbFaceCentres()
- procPolyPatch_.neighbFaceCellCentres() - procPolyPatch_.neighbFaceCellCentres()
@ -82,7 +81,7 @@ tmp<vectorField> processorFvPatch::delta() const
else else
{ {
return return
fvPatch::delta() coupledFvPatch::delta()
- transform - transform
( (
forwardT(), forwardT(),
@ -95,12 +94,12 @@ tmp<vectorField> processorFvPatch::delta() const
} }
else else
{ {
return fvPatch::delta(); return coupledFvPatch::delta();
} }
} }
tmp<labelField> processorFvPatch::interfaceInternalField Foam::tmp<Foam::labelField> Foam::processorFvPatch::interfaceInternalField
( (
const labelUList& internalData const labelUList& internalData
) const ) const
@ -109,7 +108,7 @@ tmp<labelField> processorFvPatch::interfaceInternalField
} }
void processorFvPatch::initInternalFieldTransfer void Foam::processorFvPatch::initInternalFieldTransfer
( (
const Pstream::commsTypes commsType, const Pstream::commsTypes commsType,
const labelUList& iF const labelUList& iF
@ -119,7 +118,7 @@ void processorFvPatch::initInternalFieldTransfer
} }
tmp<labelField> processorFvPatch::internalFieldTransfer Foam::tmp<Foam::labelField> Foam::processorFvPatch::internalFieldTransfer
( (
const Pstream::commsTypes commsType, const Pstream::commsTypes commsType,
const labelUList& const labelUList&
@ -129,8 +128,4 @@ tmp<labelField> processorFvPatch::internalFieldTransfer
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,6 +40,7 @@ namespace Foam
addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch); addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm) Foam::fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm)