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 4a5b0e6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2521,6 +2521,17 @@ 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-10,
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 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 4a5b0e6

Please sign in to comment.