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