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
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -316,6 +316,16 @@ public:
//- Return a list of all the constraint patch types
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
template<class T>
const typename List<T>::subList patchSlice(const UList<T>& l) const
@ -343,7 +353,7 @@ public:
//- Return face normals
const vectorField::subField faceAreas() const;
//- Return face neighbour cell centres
//- Return face cell centres
tmp<vectorField> faceCellCentres() const;

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -123,7 +123,18 @@ Foam::tmp<Foam::Field<Type> > Foam::fixedJumpAMIFvPatchField<Type>::jump() const
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 nbrDeltas
(
interpolate
(
nbrPatch.nf() & nbrPatch.fvPatch::delta(),
scalarField(this->size(), 1.0)
)
);
tmp<scalarField> tnbrDeltas;
if (applyLowWeightCorrection())
{
tnbrDeltas =
interpolate
(
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)
{
@ -86,14 +94,22 @@ Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
{
const vectorField patchD(fvPatch::delta());
const vectorField nbrPatchD
(
interpolate
(
nbrPatch.fvPatch::delta(),
vectorField(this->size(), vector::zero)
)
);
tmp<vectorField> tnbrPatchD;
if (applyLowWeightCorrection())
{
tnbrPatchD =
interpolate
(
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()));
vectorField& pdv = tpdv();

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -111,7 +111,7 @@ public:
//- Cyclic interface functions
//- Return neigbour processor number
//- Return neighbour processor number
virtual label neighbPatchID() const
{
return fineCyclicAMIInterface_.neighbPatchID();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -746,7 +746,20 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
// Transfer sendInfo to 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