diff --git a/src/lib.rs b/src/lib.rs index 1057a92..e7df38b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -202,17 +202,15 @@ impl Cell { // Discretize (2): (\delta E_y)/(\delta t) = c^2 (-\delta B_z / \delta x - S_y) // Rearrange: \delta E_y = c (-\delta B_z / 2 - c \delta_t S_y) - use consts::real::{C, MU0}; + use consts::real::{C, HALF, MU0}; - let half = R64::from_inner(0.5); - let delta_bz_y = self.bz - up.bz; let static_ex: R64 = MU0() * self.mat.conductivity() * self.ex; - let delta_ex: R64 = C() * (half * delta_bz_y - C() * delta_t * static_ex); + let delta_ex: R64 = C() * (HALF() * delta_bz_y - C() * delta_t * static_ex); let delta_bz_x = self.bz - left.bz; let static_ey: R64 = MU0() * self.mat.conductivity() * self.ey; - let delta_ey: R64 = C() * (-half * delta_bz_x - C() * delta_t * static_ey); + let delta_ey: R64 = C() * (-HALF() * delta_bz_x - C() * delta_t * static_ey); Cell { ex: self.ex + delta_ex,