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

perfect_gas.test - Fixes to decrease false failure rates. #129

Merged
merged 1 commit into from
May 12, 2022

Conversation

dreamer2368
Copy link
Contributor

perfect_gas.test sets a random state and gradient to test PerfectMixture class methods.
This state and gradient are occasionally set to outliers and cause a false failure for ComputePressureDerivative test, mainly for two reasons:

  • When the randomly chosen pressure gradient is too small compared to pressure magnitude, its relative error goes beyond a threshold by losing digits in arithmetic operations.
  • When the randomly chosen gradient is large, the initial step size for finite-difference approximation is too large to perturb the state unto an unnatural state (mainly negative densities).

These are false failures, not due to actual malfunctioning of class methods. To decrease false-failure rates, following fixes are made:

  • If the relative error is larger than threshold (1e-13), it also checks the absolute error (<1e-8). For a reference, minimum pressure gradient magnitude is around 1e2.
  • The initial step size for finite-difference approximation is chosen dynamically based on the state and gradient, so that the perturbed state wouldn't violate necessary conditions.

After this fix, no false failure was found from 100 tests. (used to be ~10).

@koomie koomie merged commit 03a0b04 into main May 12, 2022
@koomie koomie deleted the fix-perfect-gas-test branch June 6, 2022 20:14
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

Successfully merging this pull request may close these issues.

2 participants