Forward compatibility: flex
[foam-extend-3.2.git] / applications / solvers / solidMechanics / viscoElasticSolidFoam / calculateSigmaDSigmaCorr.H
blobd86527f568a03ae2a0477dc7cb09e5c3ecd9c72a
2     scalar t = runTime.value();
3     scalar tNext = t + runTime.deltaT().value();
5     instantList Times = runTime.times();
7     sigma = dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero);
8     DSigmaCorr =
9         dimensionedSymmTensor
10         (
11             "zero",
12             dimForce/dimArea,
13             symmTensor::zero
14         );
16     for (label i=1; i<Times.size(); i++)
17     {
18         runTime.setTime(Times[i], i);
20         if(runTime.timeIndex() != i)
21         {
22             FatalErrorIn(args.executable())
23                 << "The strain increment DEpsilon must be stored for "
24                 << "each calculated time step. "
25                 << exit(FatalError);
26         }
28         IOobject DEpsilonHeader
29         (
30             "DEpsilon",
31             runTime.timeName(),
32             mesh,
33             IOobject::MUST_READ
34         );
36         // Check DEpsilon exists
37         if (DEpsilonHeader.headerOk())
38         {
39             volSymmTensorField DEpsilonOld(DEpsilonHeader, mesh);
41             scalar tau = runTime.value() - m*runTime.deltaT().value();
43             if(tau < 0)
44             {
45                 sigma += 2.0*rheology.mu(t)*DEpsilonOld
46                     + rheology.lambda(t)*(I*tr(DEpsilonOld));
48                 DSigmaCorr += 2.0*rheology.mu(tNext)*DEpsilonOld
49                     + rheology.lambda(tNext)*(I*tr(DEpsilonOld));
50             }
51             else
52             {
53                 sigma += 2.0*rheology.mu(t - tau)*DEpsilonOld
54                     + rheology.lambda(t - tau)*(I*tr(DEpsilonOld));
56                 DSigmaCorr += 2.0*rheology.mu(tNext - tau)*DEpsilonOld
57                     + rheology.lambda(tNext - tau)*(I*tr(DEpsilonOld));
58             }
59         }
60         else
61         {
62             Info << "No DEpsilon" << endl;
63         }
64     }
66     if(Times.size()>=2)
67     {
68         runTime++;
69     }
71     scalar tau = runTime.value() - m*runTime.deltaT().value();
73     sigma += 2.0*rheology.mu(t - tau)*DEpsilon
74         + rheology.lambda(t - tau)*(I*tr(DEpsilon));
76     DSigmaCorr += 2.0*rheology.mu(tNext - tau)*DEpsilon
77         + rheology.lambda(tNext - tau)*(I*tr(DEpsilon));
79     DSigmaCorr -= sigma;