Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / solidMechanics / icoFsiElasticNonLinULSolidFoam / solveSolidBackward.H
blob7f3e411df76b96f61c7ef364737b8e435f060474
1     {
2 #       include "readSolidMechanicsControls.H"
4         int iCorr = 0;
5         lduMatrix::solverPerformance solverPerf;
6         scalar initialResidual = 0;
8         lduMatrix::debug = 0;
10 #       include "backwardCoeffs.H"
12         do
13         {
14             DU.storePrevIter();
16             fvVectorMatrix DUEqn
17             (
18                 Cn*rho*fvm::ddt(DU)
19               - Co*rho*DV.oldTime()
20               + Coo*rho*DV.oldTime().oldTime()
21              ==
22                 fvm::laplacian(2*mu + lambda, DU, "laplacian(DDU,DU)")
23               - fvc::laplacian(mu + lambda, DU, "laplacian(DDU,DU)")
24               + fvc::div
25                 (
26                     mu*gradDU.T()
27                   + lambda*(I*tr(gradDU))
28                   + mu*(gradDU&gradDU.T())
29                   + 0.5*lambda*(I*tr(gradDU & gradDU.T()))
30                   + (sigma & DF.T())
31                   + (DSigma & DF.T()),
32                     "div(sigma)"
33                 )
34             );
36             solverPerf = DUEqn.solve();
38             DU.relax();
40             if(iCorr == 0)
41             {
42                 initialResidual = solverPerf.initialResidual();
43             }
45             gradDU = fvc::grad(DU);
47             DF = gradDU.T();
49 #           include "calculateDSigma.H"
50         }
51         while
52         (
53             solverPerf.initialResidual() > convergenceTolerance
54          && ++iCorr < nCorr
55         );
57         Info << "Solving for " << DU.name()
58             << ", Initial residual = " << initialResidual
59             << ", Final residual = " << solverPerf.initialResidual()
60             << ", No outer iterations " << iCorr << endl;
62         DV = fvc::ddt(DU);
64         lduMatrix::debug = 1;
65     }