[cig-commits] [commit] master: Fix zero velocity handling. (eb68c28)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Mon Jun 16 10:45:22 PDT 2014


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/40944f3a0c6a71132cbdf1d431046b3c444f459e...cbc3b2ab6317c0e8dd95a2f58111ede8beadf8d7

>---------------------------------------------------------------

commit eb68c28ca36f0bfc727665ee43969f5ad81ef2c2
Author: Rene Gassmoeller <R.Gassmoeller at mailbox.org>
Date:   Mon Jun 16 17:07:41 2014 +0200

    Fix zero velocity handling.


>---------------------------------------------------------------

eb68c28ca36f0bfc727665ee43969f5ad81ef2c2
 source/velocity_boundary_conditions/gplates.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/source/velocity_boundary_conditions/gplates.cc b/source/velocity_boundary_conditions/gplates.cc
index 0ec9e09..a9d5100 100644
--- a/source/velocity_boundary_conditions/gplates.cc
+++ b/source/velocity_boundary_conditions/gplates.cc
@@ -273,7 +273,9 @@ namespace aspect
                           {
                             // If we are outside of the interpolation circle even without extending phi (j), we have
                             // visited all possible interpolation points. Return current surf_vel.
-                            const double residual_normal_velocity = (surf_vel * position) / (surf_vel.norm() * position.norm());
+                            double residual_normal_velocity(0.0);
+                            if (surf_vel.norm() > 1e-16)
+                              residual_normal_velocity = (surf_vel * position) / (surf_vel.norm() * position.norm());
 
                             AssertThrow(residual_normal_velocity < 1e-11,
                                         ExcMessage("Error in velocity boundary module interpolation. "
@@ -307,7 +309,9 @@ namespace aspect
             while (i < velocity_values->n_rows() / 2);
           }
 
-        const double residual_normal_velocity = (surf_vel * position) / (surf_vel.norm() * position.norm());
+        double residual_normal_velocity(0.0);
+        if (surf_vel.norm() > 1e-16)
+          residual_normal_velocity = (surf_vel * position) / (surf_vel.norm() * position.norm());
 
         AssertThrow( residual_normal_velocity < 1e-11,
                      ExcMessage("Error in velocity boundary module interpolation. "



More information about the CIG-COMMITS mailing list