Skip to content

Commit 7d99801

Browse files
committed
add 1e-15 to the computation of norm(vel), avoid nan in some special cases
1 parent 7cdc2e2 commit 7d99801

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pinnicle/physics/friction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _pde(self, nn_input_var, nn_output_var): #{{{
5656
taub = slice_column(nn_output_var, tauid)
5757

5858
# compute the basal stress
59-
u_norm = (u**2+v**2)**0.5
59+
u_norm = (u**2+v**2+self.eps**2)**0.5
6060
f1 = C**2*(u_norm)**(1.0/self.m) - taub
6161

6262
return [f1] #}}}

pinnicle/physics/physics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def vel_mag(self, nn_input_var, nn_output_var, X):
7979
vid = self.output_var.index('v')
8080
u = slice_column(nn_output_var, uid)
8181
v = slice_column(nn_output_var, vid)
82-
vel = (u**2.0 + v**2.0) ** 0.5
82+
vel = (u**2.0 + v**2.0 + 1.0e-15**2) ** 0.5
8383
return vel
8484

8585
def surf_x(self, nn_input_var, nn_output_var, X):

0 commit comments

Comments
 (0)