Replace tabs by 4 spaces in applications/solvers/solidMechanics
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticOrthoAcpSolidFoam / aitkenRelaxation.H
blob129e489b7c1bd874f0c6a8b993e42009a0c31bdf
1 // aitken acceleration
2 aitkenDelta.storePrevIter();
4 // update delta
5 aitkenDelta = (U - U.prevIter()) / aitkenInitialRes;
7 // update relaxation factor
8 if(iCorr == 0)
9   {
10     aitkenTheta = 0.01;
11   }
12  else
13    {
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)
26        /
27        sumMagB;
28    }
30 // correction to the latest U
31 U += aitkenTheta*aitkenDelta*aitkenInitialRes;