This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/solidMechanics/viscoElasticSolidFoam/calculateSigmaDSigmaCorr.H

82 lines
1.8 KiB
C
Raw Normal View History

2012-09-11 15:42:55 +00:00
{
scalar t = runTime.value();
scalar tNext = t + runTime.deltaT().value();
2012-09-11 15:42:55 +00:00
instantList Times = runTime.times();
2012-09-11 15:42:55 +00:00
sigma = dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero);
DSigmaCorr =
2012-09-11 15:42:55 +00:00
dimensionedSymmTensor
(
"zero",
dimForce/dimArea,
2012-09-11 15:42:55 +00:00
symmTensor::zero
);
2012-09-11 15:42:55 +00:00
for (label i=1; i<Times.size(); i++)
{
runTime.setTime(Times[i], i);
2012-09-11 15:42:55 +00:00
if(runTime.timeIndex() != i)
{
FatalErrorIn(args.executable())
<< "The strain increment DEpsilon must be stored for "
<< "each calculated time step. "
<< exit(FatalError);
}
2012-09-11 15:42:55 +00:00
IOobject DEpsilonHeader
(
"DEpsilon",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
2012-09-11 15:42:55 +00:00
// Check DEpsilon exists
if (DEpsilonHeader.headerOk())
{
volSymmTensorField DEpsilonOld(DEpsilonHeader, mesh);
2012-09-11 15:42:55 +00:00
scalar tau = runTime.value() - m*runTime.deltaT().value();
2012-09-11 15:42:55 +00:00
if(tau < 0)
{
sigma += 2.0*rheology.mu(t)*DEpsilonOld
2012-09-11 15:42:55 +00:00
+ rheology.lambda(t)*(I*tr(DEpsilonOld));
2012-09-11 15:42:55 +00:00
DSigmaCorr += 2.0*rheology.mu(tNext)*DEpsilonOld
+ rheology.lambda(tNext)*(I*tr(DEpsilonOld));
}
else
{
sigma += 2.0*rheology.mu(t - tau)*DEpsilonOld
2012-09-11 15:42:55 +00:00
+ rheology.lambda(t - tau)*(I*tr(DEpsilonOld));
2012-09-11 15:42:55 +00:00
DSigmaCorr += 2.0*rheology.mu(tNext - tau)*DEpsilonOld
+ rheology.lambda(tNext - tau)*(I*tr(DEpsilonOld));
}
}
else
{
Info << "No DEpsilon" << endl;
}
}
2012-09-11 15:42:55 +00:00
if(Times.size()>=2)
{
runTime++;
}
2012-09-11 15:42:55 +00:00
scalar tau = runTime.value() - m*runTime.deltaT().value();
2012-09-11 15:42:55 +00:00
sigma += 2.0*rheology.mu(t - tau)*DEpsilon
+ rheology.lambda(t - tau)*(I*tr(DEpsilon));
2012-09-11 15:42:55 +00:00
DSigmaCorr += 2.0*rheology.mu(tNext - tau)*DEpsilon
+ rheology.lambda(tNext - tau)*(I*tr(DEpsilon));
2012-09-11 15:42:55 +00:00
DSigmaCorr -= sigma;
}
2012-09-11 15:42:55 +00:00