From 62c21f6a6e13e337926f84d4fa243f9c410d7320 Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel <lisa_julia.nebel@tu-dresden.de> Date: Tue, 12 May 2020 09:12:31 +0200 Subject: [PATCH] Throw an exception in Mooneyrivlindensity if det(F) < 0 --- dune/elasticity/assemblers/localadolcstiffness.hh | 7 ++++++- dune/elasticity/materials/mooneyrivlindensity.hh | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dune/elasticity/assemblers/localadolcstiffness.hh b/dune/elasticity/assemblers/localadolcstiffness.hh index fa308f5..5c02eb4 100644 --- a/dune/elasticity/assemblers/localadolcstiffness.hh +++ b/dune/elasticity/assemblers/localadolcstiffness.hh @@ -66,7 +66,12 @@ energy(const LocalView& localView, for (size_t i=0; i<localConfiguration.size(); i++) localAConfiguration[i] <<= localConfiguration[i]; - energy = localEnergy_->energy(localView,localAConfiguration); + try { + energy = localEnergy_->energy(localView,localAConfiguration); + } catch (Dune::Exception &e) { + trace_off(rank); + throw e; + } energy >>= pureEnergy; diff --git a/dune/elasticity/materials/mooneyrivlindensity.hh b/dune/elasticity/materials/mooneyrivlindensity.hh index 8069301..a95f758 100644 --- a/dune/elasticity/materials/mooneyrivlindensity.hh +++ b/dune/elasticity/materials/mooneyrivlindensity.hh @@ -67,6 +67,9 @@ public: field_type normFSquared = gradient.frobenius_norm2(); field_type detF = gradient.determinant(); + if (detF < 0) + DUNE_THROW( Dune::Exception, "det(F) < 0, so it is not possible to calculate the MooneyRivlinEnergy."); + field_type normFinvSquared = 0; field_type c2Tilde = 0; -- GitLab