-
Notifications
You must be signed in to change notification settings - Fork 140
Fix numerical Schlieren for single fluid IGR + add case validation guard for schlieren_alpha #1477
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
base: master
Are you sure you want to change the base?
Changes from all commits
8320e55
7c27856
c6bfbe2
8d4a8bb
76be6a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1558,14 +1558,24 @@ def check_schlieren(self): | |
| n = self.get("n", 0) | ||
| fd_order = self.get("fd_order") | ||
| num_fluids = self.get("num_fluids") | ||
| model_eqns = self.get("model_eqns") | ||
|
|
||
| self.prohibit(n is not None and n == 0 and schlieren_wrt, "schlieren_wrt requires n > 0 (at least 2D)") | ||
| self.prohibit(schlieren_wrt and fd_order is None, "fd_order must be set for schlieren_wrt") | ||
|
|
||
| # The volume-fraction model (model_eqns /= 1) weights the Schlieren field by schlieren_alpha(i) for every fluid; an unset | ||
| # value stays at the -1e6 sentinel and produces nonsensical output. Under IGR the last fluid's volume fraction is | ||
| # reconstructed (not stored), so schlieren_alpha must still be set for all num_fluids components, including the single | ||
| # fluid of a single-fluid IGR case. The gamma/pi_inf model (model_eqns == 1) does not use schlieren_alpha. | ||
| if num_fluids is not None: | ||
| for i in range(1, num_fluids + 1): | ||
| schlieren_alpha = self.get(f"schlieren_alpha({i})") | ||
| if schlieren_alpha is not None: | ||
| if schlieren_alpha is None: | ||
| self.prohibit( | ||
| schlieren_wrt and model_eqns is not None and model_eqns != 1, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The guard correctly excludes Minor: if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Irrelevant, IGR is blocked to run for model_eqn /= 2 |
||
| f"schlieren_alpha({i}) must be set for every fluid when schlieren_wrt is enabled (unless model_eqns == 1)", | ||
| ) | ||
| else: | ||
| self.prohibit(schlieren_alpha <= 0, f"schlieren_alpha({i}) must be greater than zero") | ||
| self.prohibit(not schlieren_wrt, f"schlieren_alpha({i}) should be set only with schlieren_wrt enabled") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional (efficiency/clarity): both
if (igr)checks (here and the one inside theiloop at line 504) test a loop-invariant flag evaluated on every(j,k,l)cell. Sinceigris constant for the whole run, you could hoist the IGR/non-IGR split outside the triple loop — e.g. keep the inneralpha_lastaccumulation only whenigr, or branch once above the loops. Negligible cost in post-processing, so not blocking, just a readability note.Also note this new term divides by
gm_rho_max(1), which is 0 for a perfectly uniform density field — the same pre-existing risk as line 502, so no regression, just flagging.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix.