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

81 lines
2.1 KiB
C++
Raw Normal View History

2012-09-11 15:42:55 +00:00
{
scalar t = runTime.value();
scalar tNext = t + runTime.deltaT().value();
instantList Times = runTime.times();
sigma = dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero);
DSigmaCorr =
dimensionedSymmTensor
(
"zero",
dimForce/dimArea,
symmTensor::zero
);
for (label i=1; i<Times.size(); i++)
2012-09-11 15:42:55 +00:00
{
runTime.setTime(Times[i], i);
if(runTime.timeIndex() != i)
2012-09-11 15:42:55 +00:00
{
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
2012-09-11 15:42:55 +00:00
(
"DEpsilon",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check DEpsilon exists
if (DEpsilonHeader.headerOk())
2012-09-11 15:42:55 +00:00
{
volSymmTensorField DEpsilonOld(DEpsilonHeader, mesh);
scalar tau = runTime.value() - m*runTime.deltaT().value();
if(tau < 0)
2012-09-11 15:42:55 +00:00
{
sigma += 2.0*rheology.mu(t)*DEpsilonOld
+ rheology.lambda(t)*(I*tr(DEpsilonOld));
DSigmaCorr += 2.0*rheology.mu(tNext)*DEpsilonOld
+ rheology.lambda(tNext)*(I*tr(DEpsilonOld));
2012-09-11 15:42:55 +00:00
}
else
2012-09-11 15:42:55 +00:00
{
sigma += 2.0*rheology.mu(t - tau)*DEpsilonOld
+ rheology.lambda(t - tau)*(I*tr(DEpsilonOld));
DSigmaCorr += 2.0*rheology.mu(tNext - tau)*DEpsilonOld
+ rheology.lambda(tNext - tau)*(I*tr(DEpsilonOld));
2012-09-11 15:42:55 +00:00
}
}
else
2012-09-11 15:42:55 +00:00
{
Info << "No DEpsilon" << endl;
2012-09-11 15:42:55 +00:00
}
}
if(Times.size()>=2)
2012-09-11 15:42:55 +00:00
{
runTime++;
2012-09-11 15:42:55 +00:00
}
scalar tau = runTime.value() - m*runTime.deltaT().value();
sigma += 2.0*rheology.mu(t - tau)*DEpsilon
+ rheology.lambda(t - tau)*(I*tr(DEpsilon));
DSigmaCorr += 2.0*rheology.mu(tNext - tau)*DEpsilon
+ rheology.lambda(tNext - tau)*(I*tr(DEpsilon));
DSigmaCorr -= sigma;
}