BUG: AMI with low-weight correction - further wrapping around interpolation - mantis #1174

This commit is contained in:
andy
2014-02-26 13:44:22 +00:00
committed by Andrew Heather
parent a729ebe8df
commit 042dd8ea3f
7 changed files with 111 additions and 35 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-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -316,6 +316,16 @@ public:
//- Return a list of all the constraint patch types //- Return a list of all the constraint patch types
static wordList constraintTypes(); static wordList constraintTypes();
//- Extract face cell data
template<class T>
const UIndirectList<T> patchInternalList
(
const UList<T>& internalValues
) const
{
return UIndirectList<T>(internalValues, faceCells());
}
//- Slice list to patch //- Slice list to patch
template<class T> template<class T>
const typename List<T>::subList patchSlice(const UList<T>& l) const const typename List<T>::subList patchSlice(const UList<T>& l) const
@ -343,7 +353,7 @@ public:
//- Return face normals //- Return face normals
const vectorField::subField faceAreas() const; const vectorField::subField faceAreas() const;
//- Return face neighbour cell centres //- Return face cell centres
tmp<vectorField> faceCellCentres() const; tmp<vectorField> faceCellCentres() const;

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) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -99,10 +99,21 @@ Foam::jumpCyclicAMIFvPatchField<Type>::patchNeighbourField() const
this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells();
Field<Type> pnf(iField, nbrFaceCells); Field<Type> pnf(iField, nbrFaceCells);
tmp<Field<Type> > tpnf tmp<Field<Type> > tpnf;
(
new Field<Type>(this->cyclicAMIPatch().interpolate(pnf)) if (this->cyclicAMIPatch().applyLowWeightCorrection())
); {
tpnf =
this->cyclicAMIPatch().interpolate
(
pnf,
this->patchInternalField()()
);
}
else
{
tpnf = this->cyclicAMIPatch().interpolate(pnf);
}
if (this->doTransform()) if (this->doTransform())
{ {
@ -157,7 +168,20 @@ void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix
Field<Type> pnf(psiInternal, nbrFaceCells); Field<Type> pnf(psiInternal, nbrFaceCells);
pnf = this->cyclicAMIPatch().interpolate(pnf); if (this->cyclicAMIPatch().applyLowWeightCorrection())
{
pnf =
this->cyclicAMIPatch().interpolate
(
pnf,
this->patchInternalField()()
);
}
else
{
pnf = this->cyclicAMIPatch().interpolate(pnf);
}
// only apply jump to original field // only apply jump to original field
if (&psiInternal == &this->internalField()) if (&psiInternal == &this->internalField())

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) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -123,7 +123,18 @@ Foam::tmp<Foam::Field<Type> > Foam::fixedJumpAMIFvPatchField<Type>::jump() const
this->neighbourPatchField() this->neighbourPatchField()
); );
return this->cyclicAMIPatch().interpolate(nbrPatch.jump()); if (this->cyclicAMIPatch().applyLowWeightCorrection())
{
return this->cyclicAMIPatch().interpolate
(
nbrPatch.jump(),
Field<Type>(this->size(), pTraits<Type>::zero)
);
}
else
{
return this->cyclicAMIPatch().interpolate(nbrPatch.jump());
}
} }
} }

View File

@ -53,14 +53,22 @@ void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
const scalarField deltas(nf() & fvPatch::delta()); const scalarField deltas(nf() & fvPatch::delta());
const scalarField nbrDeltas tmp<scalarField> tnbrDeltas;
( if (applyLowWeightCorrection())
interpolate {
( tnbrDeltas =
nbrPatch.nf() & nbrPatch.fvPatch::delta(), interpolate
scalarField(this->size(), 1.0) (
) nbrPatch.nf() & nbrPatch.fvPatch::delta(),
); scalarField(this->size(), 1.0)
);
}
else
{
tnbrDeltas = interpolate(nbrPatch.nf() & nbrPatch.fvPatch::delta());
}
const scalarField& nbrDeltas = tnbrDeltas();
forAll(deltas, faceI) forAll(deltas, faceI)
{ {
@ -86,14 +94,22 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
{ {
const vectorField patchD(fvPatch::delta()); const vectorField patchD(fvPatch::delta());
const vectorField nbrPatchD tmp<vectorField> tnbrPatchD;
( if (applyLowWeightCorrection())
interpolate {
( tnbrPatchD =
nbrPatch.fvPatch::delta(), interpolate
vectorField(this->size(), vector::zero) (
) nbrPatch.fvPatch::delta(),
); vectorField(this->size(), vector::zero)
);
}
else
{
tnbrPatchD = interpolate(nbrPatch.fvPatch::delta());
}
const vectorField& nbrPatchD = tnbrPatchD();
tmp<vectorField> tpdv(new vectorField(patchD.size())); tmp<vectorField> tpdv(new vectorField(patchD.size()));
vectorField& pdv = tpdv(); vectorField& pdv = tpdv();

View File

@ -120,6 +120,13 @@ public:
return cyclicAMIPolyPatch_.AMI(); return cyclicAMIPolyPatch_.AMI();
} }
//- Return true if applying the low weight correction
virtual bool applyLowWeightCorrection() const
{
return cyclicAMIPolyPatch_.applyLowWeightCorrection();
}
//- Are the cyclic planes parallel //- Are the cyclic planes parallel
virtual bool parallel() const virtual bool parallel() const
{ {
@ -154,11 +161,6 @@ public:
//- Return delta (P to N) vectors across coupled patch //- Return delta (P to N) vectors across coupled patch
virtual tmp<vectorField> delta() const; virtual tmp<vectorField> delta() const;
bool applyLowWeightCorrection() const
{
return cyclicAMIPolyPatch_.applyLowWeightCorrection();
}
template<class Type> template<class Type>
tmp<Field<Type> > interpolate tmp<Field<Type> > interpolate
( (

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
@ -111,7 +111,7 @@ public:
//- Cyclic interface functions //- Cyclic interface functions
//- Return neigbour processor number //- Return neighbour processor number
virtual label neighbPatchID() const virtual label neighbPatchID() const
{ {
return fineCyclicAMIInterface_.neighbPatchID(); return fineCyclicAMIInterface_.neighbPatchID();

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
@ -746,7 +746,20 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
// Transfer sendInfo to cycPatch // Transfer sendInfo to cycPatch
combine<Type, TrackingData> cmb(*this, cycPatch); combine<Type, TrackingData> cmb(*this, cycPatch);
cycPatch.interpolate(sendInfo, cmb, receiveInfo);
if (cycPatch.applyLowWeightCorrection())
{
List<Type> defVals
(
cycPatch.patchInternalList(allCellInfo_)
);
cycPatch.interpolate(sendInfo, cmb, receiveInfo, defVals);
}
else
{
cycPatch.interpolate(sendInfo, cmb, receiveInfo);
}
} }
// Apply transform to received data for non-parallel planes // Apply transform to received data for non-parallel planes