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/deprecatedSolvers/stressedFoam/calculateStress.H

111 lines
2.5 KiB
C

if (runTime.outputTime())
{
volTensorField gradU = fvc::grad(U);
volSymmTensorField sigma =
rho*(2.0*mu*symm(gradU) + lambda*I*tr(gradU));
if (thermalStress)
{
sigma = sigma - I*(rho*threeKalpha*T);
}
volScalarField sigmaEq
(
IOobject
(
"sigmaEq",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sqrt((3.0/2.0)*magSqr(dev(sigma)))
);
Info<< "Max sigmaEq = " << max(sigmaEq).value()
<< endl;
volScalarField sigmaxx
(
IOobject
(
"sigmaxx",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::XX)
);
volScalarField sigmayy
(
IOobject
(
"sigmayy",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::YY)
);
volScalarField sigmazz
(
IOobject
(
"sigmazz",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::ZZ)
);
Info<< "Max sigmazz = " << max(sigmazz).value()
<< endl;
volScalarField sigmaxy
(
IOobject
(
"sigmaxy",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::XY)
);
volScalarField sigmaxz
(
IOobject
(
"sigmaxz",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::XZ)
);
volScalarField sigmayz
(
IOobject
(
"sigmayz",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::YZ)
);
runTime.write();
}