Skip to content

Commit

Permalink
Define what happens when β=∞ and u=η (#1842)
Browse files Browse the repository at this point in the history
* define what happens when beta=inf and u=0.5

* use eta not 0.5

* Update src/meepgeom.cpp

Co-authored-by: Steven G. Johnson <stevenj@mit.edu>
  • Loading branch information
smartalecH and stevengj authored Dec 8, 2021
1 parent 3ce82f9 commit 772a672
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/meepgeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ double material_grid_val(vector3 p, material_data *md) {

static double tanh_projection(double u, double beta, double eta) {
if (beta == 0) return u;
if (u == eta) return 0.5; // avoid NaN when beta is Inf
double tanh_beta_eta = tanh(beta*eta);
return (tanh_beta_eta + tanh(beta*(u-eta))) /
(tanh_beta_eta + tanh(beta*(1-eta)));
Expand Down

0 comments on commit 772a672

Please sign in to comment.