This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/solidMechanics/elasticIncrAcpSolidFoam/aitkenRelaxation.H

36 lines
823 B
C
Raw Normal View History

// aitken acceleration
aitkenDelta.storePrevIter();
// update delta
aitkenDelta = (DU - DU.prevIter()) / aitkenInitialRes;
// update relaxation factor
if(iCorr == 0)
{
aitkenTheta = 0.01;
if(mesh.relax(DU.name()))
{
aitkenTheta = mesh.relaxationFactor(DU.name());
}
}
else
{
vectorField b = aitkenDelta.internalField() - aitkenDelta.prevIter().internalField();
//scalar sumMagB = gSum(mag(b));
scalar sumMagB = gSum(magSqr(b));
if(sumMagB < SMALL)
{
//Warning << "Aitken under-relaxation: denominator less then SMALL"
// << endl;
sumMagB += SMALL;
}
aitkenTheta = -aitkenTheta*
gSum(aitkenDelta.prevIter().internalField() & b)
/
sumMagB;
}
// correction to the latest DU
DU += aitkenTheta*aitkenDelta*aitkenInitialRes;