Skip to content

Conversation

@ayush4874
Copy link

Problem

The Pressure Coefficient (Cp) calculation currently divides by ReferenceDynamicPressure without checking if it is zero.
This causes NaN values or crashes when:

  1. The reference velocity is set to 0.0 (e.g., in moving reference frame simulations).
  2. The user inadvertently sets zero free-stream values.

Solution

Added a safety check for GetReferenceDynamicPressure() in:

  • CFlowCompOutput.cpp (Compressible)
  • CFlowIncOutput.cpp (Incompressible)
  • CNEMOCompOutput.cpp (NEMO / Hypersonic)

If the dynamic pressure is effectively zero (abs < 1e-10), the Cp output defaults to 0.0 instead of performing the division.

@pcarruscag
Copy link
Member

Logic for this should be handled in SetReferenceValues of the flow solvers

@ayush4874
Copy link
Author

Done. I have moved the safety logic into SetReferenceValues for the flow solvers (Compressible, Incompressible, and NEMO) to handle zero dynamic pressure case.

@pcarruscag pcarruscag changed the base branch from master to develop December 31, 2025 18:04
@pcarruscag
Copy link
Member

Add the required label to the PR and use the constant EPS instead of hardcoded value

@pcarruscag
Copy link
Member

open future PRs to develop instead of master

@ayush4874
Copy link
Author

Thanks for the review. I have switched the logic to use EPS and synced everything with the develop branch.

I don't have permission to add labels to the repo.

@pcarruscag pcarruscag merged commit 8fc25db into su2code:develop Dec 31, 2025
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants