Skip to content

Commit

Permalink
Add an assertion to the computation of the SPD factor.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed Jun 1, 2024
1 parent ecc67a9 commit ab01337
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions source/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2521,6 +2521,23 @@ namespace aspect
if ((strain_rate.norm() == 0) || (dviscosities_dstrain_rate.norm() == 0))
return 1;

// The following algorithm for computing the algorithm assumes that
// strain_rate and dviscosities_dstrain_rate are parallel or
// antiparallel vectors (tensors). Check that this is indeed so, to
// within a tolerance.
Assert (std::abs(std::abs(strain_rate*dviscosities_dstrain_rate
/ strain_rate.norm()
/ dviscosities_dstrain_rate.norm())
-1) < 1e-6,
ExcMessage("This function assumes that the strain rate and "
"the derivative of the viscosity with regard to "
"the strain rate are parallel, but they are not. "
"The relative deviation from parallelity is " +
std::to_string(std::abs(std::abs(strain_rate*dviscosities_dstrain_rate
/ strain_rate.norm()
/ dviscosities_dstrain_rate.norm())
-1)) +
"."));

// The factor in the Newton matrix is going to be of the form
// 2*eta I + (a \otimes b + b \otimes a)
Expand Down

0 comments on commit ab01337

Please sign in to comment.