Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticOrthoAcpSolidFoam / aitkenRelaxation.H
blob4912e983661d4e58e72a8eccdcc391f9f69378dd
1 // aitken acceleration
2 aitkenDelta.storePrevIter();
4 // update delta
5 aitkenDelta = (U - U.prevIter()) / aitkenInitialRes;
7 // update relaxation factor
8 if(iCorr == 0)
10     aitkenTheta = 0.01;
12 else
14     vectorField b = aitkenDelta.internalField() - aitkenDelta.prevIter().internalField();
15     //scalar sumMagB = gSum(mag(b));
16     scalar sumMagB = gSum(magSqr(b));
17     if(sumMagB < SMALL)
18     {
19         //Warning << "Aitken under-relaxation: denominator less then SMALL"
20         //    << endl;
21         sumMagB += SMALL;
22     }
24     aitkenTheta = -aitkenTheta*
25         gSum(aitkenDelta.prevIter().internalField() & b)/sumMagB;
28 // correction to the latest U
29 U += aitkenTheta*aitkenDelta*aitkenInitialRes;