Skip to content

Commit 1912974

Browse files
committed
Forgot to subtract surface binding energy from isotropic case.
1 parent 437cb2a commit 1912974

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

src/material.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,13 @@ pub fn surface_binding_energy<T: Geometry>(particle_1: &mut particle::Particle,
326326
let dy = y2 - y;
327327
let dz = z2 - z;
328328
let mag = (dx*dx + dy*dy + dz*dz).sqrt();
329-
330329
let costheta = dx*cosx/mag + dy*cosy/mag + dz*cosz/mag;
331-
//particle_1.E += Es;
332330

333331
match material.surface_binding_model {
334332
SurfaceBindingModel::PLANAR{..} => {
335-
//let delta_theta = particle::refraction_angle(costheta, E, E + Es);
336-
//particle::rotate_particle(particle_1, delta_theta, 0.);
337333
particle::surface_refraction(particle_1, Vector::new(dx/mag, dy/mag, dz/mag), Es);
338334
}
339-
_ => ()
335+
_ => particle.E += Es;
340336
}
341337
}
342338
}
@@ -358,16 +354,11 @@ pub fn surface_binding_energy<T: Geometry>(particle_1: &mut particle::Particle,
358354
if costheta < 0. {
359355
if leaving_energy > Es {
360356

361-
//particle_1.E += -Es;
362-
363357
match material.surface_binding_model {
364358
SurfaceBindingModel::PLANAR{..} => {
365-
//let delta_theta = particle::refraction_angle(costheta, E, E + Es);
366-
//particle::rotate_particle(particle_1, delta_theta, 0.);
367-
//println!("costheta: {}", costheta);
368359
particle::surface_refraction(particle_1, Vector::new(-dx/mag, -dy/mag, -dz/mag), -Es);
369360
}
370-
_ => ()
361+
_ => particle.E += -Es;
371362
}
372363

373364
} else {

src/particle.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,22 +211,17 @@ pub fn particle_advance(particle_1: &mut particle::Particle, mfp: f64, asymptoti
211211
pub fn surface_refraction(particle: &mut Particle, normal: Vector, Es: f64) {
212212
let E = particle.E;
213213
let costheta = particle.dir.dot(&normal);
214-
//println!("costheta: {}", costheta);
215-
214+
216215
let a = (E/(E + Es)).sqrt();
217216
let b = -(E).sqrt()*costheta;
218217
let c = (E*costheta.powi(2) + Es).sqrt();
219-
//println!("0: {} {} {}", particle.dir.x, particle.dir.y, particle.dir.z);
220-
//println!("1: {} {} {}", a, b, c);
221218

222219
let u1x = (E/(E + Es)).sqrt()*particle.dir.x + ((-(E).sqrt()*costheta + (E*costheta.powi(2) + Es).sqrt())/(E + Es).sqrt())*normal.x;
223220
let u1y = (E/(E + Es)).sqrt()*particle.dir.y + ((-(E).sqrt()*costheta + (E*costheta.powi(2) + Es).sqrt())/(E + Es).sqrt())*normal.y;
224221
let u1z = (E/(E + Es)).sqrt()*particle.dir.z + ((-(E).sqrt()*costheta + (E*costheta.powi(2) + Es).sqrt())/(E + Es).sqrt())*normal.z;
225222
particle.dir.x = u1x;
226223
particle.dir.y = u1y;
227224
particle.dir.z = u1z;
228-
//println!("2: {} {} {}", particle.dir.x, particle.dir.y, particle.dir.z);
229-
230225
particle.E += Es;
231226
}
232227

0 commit comments

Comments
 (0)