Commit a9bf5adc authored by Lukas Riedel's avatar Lukas Riedel
Browse files

Fix error in computing linear stress for visualization

parent b94f8d20
......@@ -68,19 +68,17 @@ public:
// Evaluate the strain tensor
using RF = typename Traits::RangeFieldType;
Dune::FieldMatrix<RF, dim, dim> strain;
RF strain_trace{ 0.0 };
for (size_t i = 0; i < dim; ++i)
{
for (size_t j = 0; j <= i; ++j)
{
RF sum = displacement_grad[i][j] + displacement_grad[j][i];
for (size_t k = 0; k < dim; ++k)
{
sum += displacement_grad[i][k] + displacement_grad[j][k];
}
sum = 0.5 * sum;
strain[i][j] = sum;
if (i != j)
strain[j][i] = sum;
strain[i][j] =
0.5 * (displacement_grad[i][j] + displacement_grad[j][i]);
if (i == j)
strain_trace += strain[i][i];
else
strain[j][i] = strain[i][j];
}
}
......@@ -97,7 +95,7 @@ public:
stress[i][j] = 2 * lame2 * strain[i][j];
if (i == j)
{
stress[i][i] += lame1 * strain[i][i];
stress[i][i] += lame1 * strain_trace;
}
else
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment