-
Notifications
You must be signed in to change notification settings - Fork 910
CHG: Replace fatal MPI_Abort with Warning in GetHistoryFieldValue #2664
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
Conversation
|
Can you share a config where you've run into this problem? |
|
Hi @pcarruscag, You can use any standard configuration file (like the The crash is not triggered by the configuration settings themselves, but by the API call when using the Python wrapper (or C++ driver) to request a field that doesn't exist. Steps to Reproduce:
import pysu2
# Use any valid config, e.g., quickstart_inviscid.cfg
driver = pysu2.CSinglezoneDriver("quickstart_inviscid.cfg", 1, MPI_COMM_WORLD)
# ... initialization ...
# CRASH: This triggers MPI_Abort immediately because "NonExistentVar" is not in the map.
# The user has no way to check for existence or catch the error.
val = driver.GetHistoryOutput("NonExistentVar")Context: |
|
The available outputs are the ones listed by |
|
@pcarruscag You are absolutely correct—requesting keys from The issue is specifically about robustness. If a user (or an automated script) accidentally requests a key that isn't in the list (e.g., a typo like "RMS_Denssity"), the current behavior is a Segmentation Fault (hard crash). In a Python environment, this is dangerous. A missing key should raise a Python-level exception (or return an error) rather than terminating the entire process. This PR simply adds that safety guard so the user gets a clear error message instead of a crash. |
|
I don't like silent errors in the C++ side to accomodate python. |
|
@pcarruscag Reverted the changes to As suggested, I moved the safety check to the driver interface layer ( Change Summary:
|
|
I'm getting a bit tired of writing AI prompts for code reviews... So I'll give you one more shot at addressing the entirety of my comments. If the next push is not satisfactory, I'll close this PR. You're welcome for my time. |
7d4e2cc to
29ba6b7
Compare
|
@pcarruscag Sorry about that, I missed the "per-surface" instruction in your previous comment. I've updated |
Problem:
Currently,
GetHistoryFieldValueinCOutput.hpptriggers a fatalSU2_MPI::Error(causing anMPI_Abort) if a requested history field is missing. This behavior is overly aggressive for high-level interfaces (like the Python wrapper) or coupled simulations where a field might be temporarily unavailable or optional.Solution:
Replaced the fatal error with a warning message (
std::cout) and a default return value of0.0. This ensures the simulation continues running while alerting the user.Changes:
COutput.hpp: ReplacedSU2_MPI::Errorwith a warning print and safe return inGetHistoryFieldValue.