SimState *should* be capable of simulating either ex/ey/bz or bx/by/ez type planes

Have not actually tested it with a bx/by/ez plane yet.
This commit is contained in:
2020-09-17 23:02:28 -07:00
parent a1f5b96ae1
commit 7029c8bcfa

View File

@@ -170,16 +170,25 @@ pub struct Cell<M> {
impl<M> Cell<M> { impl<M> Cell<M> {
pub fn ex(&self) -> Flt { pub fn ex(&self) -> Flt {
self.state.ex() self.state.e().x()
} }
pub fn ey(&self) -> Flt { pub fn ey(&self) -> Flt {
self.state.ey() self.state.e().y()
}
pub fn ez(&self) -> Flt {
self.state.e().z()
} }
pub fn e(&self) -> Point { pub fn e(&self) -> Point {
Point::new(self.ex(), self.ey()) Point::new(self.ex(), self.ey())
} }
pub fn hx(&self) -> Flt {
self.state.h().x()
}
pub fn hy(&self) -> Flt {
self.state.h().y()
}
pub fn hz(&self) -> Flt { pub fn hz(&self) -> Flt {
self.state.hz() self.state.h().z()
} }
pub fn h(&self) -> Vec3 { pub fn h(&self) -> Vec3 {
self.state.h() self.state.h()
@@ -224,10 +233,10 @@ impl<M: Material> Cell<M> {
// ``` // ```
let inv_feature_size = Real::from_inner(1.0) / feature_size; let inv_feature_size = Real::from_inner(1.0) / feature_size;
let delta_ez_y = inv_feature_size * 0.0; let delta_ez_y = inv_feature_size * (down.ez() - self.ez());
let delta_ey_z = inv_feature_size * 0.0; let delta_ey_z = inv_feature_size * 0.0;
let delta_ex_z = inv_feature_size * 0.0; let delta_ex_z = inv_feature_size * 0.0;
let delta_ez_x = inv_feature_size * 0.0; let delta_ez_x = inv_feature_size * (right.ez() - self.ez());
let delta_ey_x = inv_feature_size * (right.ey() - self.ey()); let delta_ey_x = inv_feature_size * (right.ey() - self.ey());
let delta_ex_y = inv_feature_size * (down.ex() - self.ex()); let delta_ex_y = inv_feature_size * (down.ex() - self.ex());
let nabla_e = Vec3::from((delta_ez_y - delta_ey_z, delta_ex_z - delta_ez_x, delta_ey_x - delta_ex_y)); let nabla_e = Vec3::from((delta_ez_y - delta_ey_z, delta_ex_z - delta_ez_x, delta_ey_x - delta_ex_y));
@@ -278,8 +287,8 @@ impl<M: Material> Cell<M> {
let delta_hy_z = inv_feature_size * 0.0; let delta_hy_z = inv_feature_size * 0.0;
let delta_hx_z = inv_feature_size * 0.0; let delta_hx_z = inv_feature_size * 0.0;
let delta_hz_x = inv_feature_size * (self.hz() - left.hz()); let delta_hz_x = inv_feature_size * (self.hz() - left.hz());
let delta_hy_x = inv_feature_size * 0.0; let delta_hy_x = inv_feature_size * (self.hy() - left.hy());
let delta_hx_y = inv_feature_size * 0.0; let delta_hx_y = inv_feature_size * (self.hx() - up.hx());
let nabla_h = Vec3::from((delta_hz_y - delta_hy_z, delta_hx_z - delta_hz_x, delta_hy_x - delta_hx_y)); let nabla_h = Vec3::from((delta_hz_y - delta_hy_z, delta_hx_z - delta_hz_x, delta_hy_x - delta_hx_y));
let delta_t_eps = delta_t/EPS0(); let delta_t_eps = delta_t/EPS0();
@@ -304,15 +313,6 @@ pub struct CellState {
} }
impl CellState { impl CellState {
pub fn ex(&self) -> Flt {
self.e.x()
}
pub fn ey(&self) -> Flt {
self.e.y()
}
pub fn hz(&self) -> Flt {
self.h.z().into()
}
pub fn h(&self) -> Vec3 { pub fn h(&self) -> Vec3 {
self.h self.h
} }