Skip to content

[bug] Yields differ for surfaces with x directed normal and z directed normal #286

@dmonah

Description

@dmonah

Description
Calculated yield results are different for surfaces with x directed normal and z directed normal.

I noticed this when comparing 2 models using the parry3d option. If I orient the surface with a +x normal and bombard with -x directed ions I get one value for yield. If I reorientated the 3d model so that I have a +z normal and bombard with -z directed ions, my yield drops by about 5% to 25%.

I hacking the 1d code in the Mesh0D Geometry implementation (modifying the methods: inside, inside_simulation_boundary, inside_energy_barrier, and closest_point) so that I can select the normal direction, I see the exact same behavior in the 1d code with the yield values predicted exactly matching the equivalent 3d cases.

To Reproduce
I can't upload any toml files, images or patches as uploading is blocked by my work firewall. Therefore to reproduce, you will need to reproduce cases from the description, sorry. I can share the hack I made to the Mesh0D class to reproduce in 1d:

fn inside(&self, x: f64, y: f64, z: f64) -> bool {
        let v: f64;

        #[cfg(not(feature = "mesh0d_z_normal"))]
        {
            v = x;
        }

        #[cfg(feature = "mesh0d_z_normal")]
        {
            v = z;
        }

        #[cfg(not(feature = "mesh0d_positive_normal"))]
        {
            v > 0.0
        }

        #[cfg(feature = "mesh0d_positive_normal")]
        {
            v < 0.0
        }
    }

    fn inside_simulation_boundary(&self, x: f64, y: f64, z: f64) -> bool {
        let v: f64;

        #[cfg(not(feature = "mesh0d_z_normal"))]
        {
            v = x;
        }

        #[cfg(feature = "mesh0d_z_normal")]
        {
            v = z;
        }

        #[cfg(not(feature = "mesh0d_positive_normal"))]
        {
            v > -10.*self.energy_barrier_thickness
        }

        #[cfg(feature = "mesh0d_positive_normal")]
        {
            v < 10.*self.energy_barrier_thickness
        }
    }

    fn inside_energy_barrier(&self, x: f64, y: f64, z: f64) -> bool {
        let v: f64;

        #[cfg(not(feature = "mesh0d_z_normal"))]
        {
            v = x;
        }

        #[cfg(feature = "mesh0d_z_normal")]
        {
            v = z;
        }

        #[cfg(not(feature = "mesh0d_positive_normal"))]
        {
            v > -self.energy_barrier_thickness
        }

        #[cfg(feature = "mesh0d_positive_normal")]
        {
            v < self.energy_barrier_thickness
        }
    }

    fn closest_point(&self, x: f64, y: f64, z: f64) -> (f64, f64, f64) {
        #[cfg(not(feature = "mesh0d_z_normal"))]
        {
            (0., y, z)
        }

        #[cfg(feature = "mesh0d_z_normal")]
        {
            (x, y, 0.)
        }
    }
}

Expected behavior
Yield should be independent of normal direction in 3d (yes?).

Error messages, output files, or figures
Figures attached.

System (please complete the following information):
OS:

Additional context
I've chased the source of the issue down to the following code in choose_collision_partner function:

    //Find recoil location
    let x_recoil: f64 = x + mfp*cosx - impact_parameter*cosphi*sinx;
    let y_recoil: f64 = y + mfp*cosy - impact_parameter*(sinphi*cosz - cosphi*cosy*cosx)/sinx;
    let z_recoil: f64 = z + mfp*cosz + impact_parameter*(sinphi*cosy - cosphi*cosx*cosz)/sinx;

This code attaches significance to the x direction and does not treat all 3 directions equally. I tried applying a fix which does treat all axes the same, and it removes the asymmetry (see bug fix figure), but i do not get expected behavior at glancing angles (yield approaching 0), so I think the specifics of my fix are incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions