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

53 lines
1.2 KiB
C

if (runTime.outputTime())
{
// Displacement gradient
tetPointTensorField gradU = tetFec::grad(U);
// Stress tensor
tetPointSymmTensorField sigma =
rho*(2.0*mu*symm(gradU) + lambda*I*tr(gradU));
// sigmaXX
tetPointScalarField sigmaXX
(
IOobject
(
"sigmaXX",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::XX)
);
// sigmaYY
tetPointScalarField sigmaYY
(
IOobject
(
"sigmaYY",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::YY)
);
// sigmaXY
tetPointScalarField sigmaXY
(
IOobject
(
"sigmaXY",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sigma.component(symmTensor::XY)
);
runTime.write();
}