Commit fa151a36 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Remove the trEps method

Instead, simply sum the eigenvalues to get the trace
of the strain matrix.
parent 7e59fd36
Pipeline #8684 passed with stage
in 4 minutes and 51 seconds
......@@ -3,6 +3,8 @@
#ifndef DUNE_FRACTUREPHASEFIELDS_DAMAGEDELASTICENERGYDENSITY_DECOMPOSED_HH
#define DUNE_FRACTUREPHASEFIELDS_DAMAGEDELASTICENERGYDENSITY_DECOMPOSED_HH
#include <numeric>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
......@@ -147,7 +149,7 @@ public:
std::tuple<DomainDim,DomainDim> sigSpec(const Domain& state, const DomainDim &eigenValues) const
{
// mechanical part of gradient psi,{eps} in spectral space
const double trEps = f_->traceEps(state);
const double trEps = std::accumulate(eigenValues.begin(), eigenValues.end(), 0.0);
DomainDim sigP(0);
DomainDim sigM(0);
for (std::size_t i=0; i<dim; i++)
......@@ -235,7 +237,7 @@ public:
// psi,{eps eps} in spectral space
FieldMatrix<double, dim,dim> hessianSpecP;
FieldMatrix<double, dim,dim> hessianSpecM;
const double trEps = f__->traceEps(state);
const double trEps = std::accumulate(eigen.begin(), eigen.end(), 0.0);
if (trEps>0) {
hessianSpecP = f__->lambda_;
......@@ -290,7 +292,7 @@ public:
// psi,{eps eps} in spectral space
FieldMatrix<double, dim,dim> hessianSpecP;
FieldMatrix<double, dim,dim> hessianSpecM;
const double trEps = f__->traceEps(jet);
const double trEps = std::accumulate(eigen.begin(), eigen.end(), 0.0);
if (trEps>0) {
hessianSpecP = f__->lambda_;
......@@ -495,7 +497,7 @@ public:
// The Hesse matrix in spectral space
FieldMatrix<double, dim,dim> hessianSpecP;
FieldMatrix<double, dim,dim> hessianSpecM;
const double trEps = traceEps(state);
const double trEps = std::accumulate(eigenValues.begin(), eigenValues.end(), 0.0);
if (trEps>0) {
hessianSpecP = lambda_;
......@@ -563,7 +565,7 @@ public:
// First, the Hesse matrix in spectral space
FieldMatrix<double, dim,dim> hessianSpecP;
FieldMatrix<double, dim,dim> hessianSpecM;
const double trEps = traceEps(state);
const double trEps = std::accumulate(eigenValues.begin(), eigenValues.end(), 0.0);
if (trEps>0) {
hessianSpecP = lambda_;
......@@ -653,19 +655,6 @@ private:
return std::make_tuple(eigenValues, eigenVectors);
}
/** \brief Compute the trace of the strain tensor
*/
RangeField traceEps(const FieldVector<RangeField, size>& stateVector) const
{
auto state = matrixView(stateVector);
double result = 0.0;
for (std::size_t i=0;i < dim; ++i)
result += state(i,i);
return result;
}
RangeField degradation(const FieldVector<RangeField, size>& state) const
{
return ((1.0 - state[size-1])*(1.0-state[size-1]) + k_);
......@@ -674,7 +663,7 @@ private:
std::array<RangeField,2> psiSpec(const FieldVector<RangeField, size>& stateVector,
const FieldVector<RangeField, dim>& eigenValues) const
{
const double trEps(traceEps(stateVector));
const double trEps = std::accumulate(eigenValues.begin(), eigenValues.end(), 0.0);
RangeField psiP = 0.0;
RangeField psiM = 0.0;
......
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