Removed unneeded lib dependency from mdInitialise
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticSolidFoam / aitkenRelaxation.H
blobe82330f12ff84029258af4b8c79d244d82bbe65c
1 // aitken acceleration 
3 aitkenDelta.storePrevIter();
5 // update delta
6 aitkenDelta = (U - U.prevIter()) / aitkenInitialRes;
8 // update relaxation factor
9 if(iCorr == 0)
10   {
11     aitkenTheta = 0.1;
12   }
13  else
14    {
15      vectorField b = aitkenDelta.internalField() - aitkenDelta.prevIter().internalField();
16      // scalar sumMagB = gSum(mag(b));
17      scalar sumMagB = gSum(magSqr(b));
18      if(sumMagB < SMALL)
19        {
20          // Warning << "Aitken under-relaxation: denominator less then SMALL"
21          // << endl;
22          sumMagB += SMALL;
23        }
24      
25      aitkenTheta = -aitkenTheta*
26        gSum(aitkenDelta.prevIter().internalField() & b)
27        /
28        sumMagB;
29    }
31 // correction to the latest U
32 U += aitkenTheta*aitkenDelta*aitkenInitialRes;