Remove trailing whitespace systematically
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticThermalSolidFoam / aitkenRelaxation.H
blobd238abeffe9178d5018a6acce65fdfb2120c266d
1 // aitken acceleration
3 // update delta
4 aitkenDelta.storePrevIter();
5 aitkenDelta = (U - U.prevIter()) / aitkenInitialRes;
7 // update relaxation factor
8 if(iCorr == 0)
9   {
10     aitkenTheta = 0.01;
11 //     if(mesh.relax(U.name()))
12 //       {
13 //      aitkenTheta = mesh.relaxationFactor(U.name());
14 //       }
15   }
16  else
17    {
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)
30        /
31        sumMagB;
32    }
34 // correction to the latest U
35 U += aitkenTheta*aitkenDelta*aitkenInitialRes;