Skip to content

Commit

Permalink
[PL] SDN; Fix allowed damage intvl. Assert.
Browse files Browse the repository at this point in the history
Refer in the possible division by zero to the calculation function.
  • Loading branch information
endJunction committed Dec 18, 2018
1 parent cd7229b commit 555b759
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions ProcessLib/SmallDeformationNonlocal/Damage.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ inline double calculateDamage(double const kappa_d, double const alpha_d,
{
double const damage = (1 - beta_d) * (1 - std::exp(-kappa_d / alpha_d));

if (damage < 0. || damage > 1.)
ERR("Damage value %g outside of [0,1] interval.", damage);
if (damage < 0. || damage >= 1.)
{
ERR("Damage value %g outside of [0,1) interval.", damage);
assert(false && "damage not in [0,1) interval.");
}

return damage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ class SmallDeformationNonlocalLocalAssembler
// Compute sigma_eff from damage total stress sigma
using KelvinVectorType = typename BMatricesType::KelvinVectorType;
KelvinVectorType const sigma_eff_prev =
sigma_prev / (1. - damage_prev);
sigma_prev /
(1. - damage_prev); // damage_prev is in [0,1) range. See
// calculateDamage() function.

auto&& solution = _ip_data[ip].solid_material.integrateStress(
t, x_position, _process_data.dt, eps_prev, eps, sigma_eff_prev,
Expand Down

0 comments on commit 555b759

Please sign in to comment.