Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inquiries about possible modification of Svk and Spk functions. #18

Open
singhyun90 opened this issue Dec 20, 2024 · 1 comment
Open

Comments

@singhyun90
Copy link
Contributor

singhyun90 commented Dec 20, 2024

def Spk(self):
    """
    Calculates Spk.

    Returns
    -------
    float
    """
    # For now we are using the closest value in the array to ylower
    # This way, we are losing or gaining a bit of area. In the future we might use some
    # additional interpolation. For now this is sufficient.

    # Area enclosed above yupper between y-axis (at x=0) and abbott-firestone curve
    idx = argclosest(self._yupper, self._height)
    A1 = np.abs(trapezoid(self._material_ratio[:idx], x=self._height[:idx]))
    Spk = 2 * A1 / self.Smr1()
    return Spk

def Svk(self):
    """
    Calculates Svk.

    Returns
    -------
    float
    """
    # Area enclosed below ylower between y-axis (at x=100) and abbott-firestone curve
    idx = argclosest(self._ylower, self._height)
    A2 = np.abs(trapezoid(100 - self._material_ratio[idx:], x=self._height[idx:]))
    Svk = 2 * A2 / (100 - self.Smr2())
    return Svk

Hello.
I think the 2 functions need to be modified as below. Please review if what I think is correct.
This is a common warning regarding division.(RuntimeWarning: invalid value encountered in scalar divide)

  1. Spk Function
    When the Smr1() value comes out to zero in the Spk function, warring occurs in the Spk calculation.
    Theoretically, if Smr1 is 0%, I know that Spk height is also 0.
    Therefore, when Smr1 is zero, i propose that the value of the Spk function is also zero.

  2. Svk Function
    For the same reason as above, the Svk function generates a division warning when the Smr2() value is 100%.
    If Smr2() value is 100%, treat Svk as an exception with 0.

@singhyun90 singhyun90 changed the title Inquiries about possible modification of SVk and Spk functions. Inquiries about possible modification of Svk and Spk functions. Dec 20, 2024
@fredericjs
Copy link
Owner

Hi, your reasoning makes sense as far as I can tell. However, I'm wondering which edge case you are looking at to get Smr1 of 0% and Smr2 of 100%. The only surfaces I can think of right now for which that would be the case are either a completely flat surface, a completely flat but inclined surface or a random uniform distribution.

I just checked these and for these edgecases the values seem to be a little bit wrong, e.g. and Smr1 of 0.5 for the inclined flat surface, where it should be 0.

At some point I will try to fix that but the it's not high priority since it make not much sense to calculate functional parameters for these kind of surfaces anyways. I can still implement your fix though, but it's not going to fix the fundamental problems with the current implementation for edgecases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants