Skip to content

Commit 257e52d

Browse files
authored
Merge branch 'master' into remove-airfoil-and-stl-paramters
2 parents 14f579e + 9d866bd commit 257e52d

5 files changed

Lines changed: 35 additions & 6 deletions

File tree

docs/documentation/case.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ If `file_per_process` is true, then pre_process, simulation, and post_process mu
709709

710710
- ``[variable's name]_wrt`` activates the output of each specified variable into the database.
711711

712-
- `schlieren_alpha(i)` specifies the intensity of the numerical Schlieren of $i$-th component.
712+
- `schlieren_alpha(i)` specifies the intensity of the numerical Schlieren of $i$-th component. It must be specified for every fluid when `schlieren_wrt` is enabled.
713713

714714
- `fd_order` specifies the order of the finite difference scheme used to compute the vorticity from the velocity field and the numerical schlieren from the density field using an integer of 1, 2, and 4.
715715
`fd_order = 1`, `2`, and `4` correspond to the first, second, and fourth-order finite difference schemes.

src/common/m_variables_conversion.fpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,11 @@ contains
13321332
#ifdef MFC_DEBUG
13331333
if (disc < 0._wp) then
13341334
print *, 'rho, c, Bx, By, Bz, h, term, disc:', rho, c, B(1), B(2), B(3), h, term, disc
1335+
! s_mpi_abort is a host routine and cannot be called from device code
1336+
! (this is a GPU routine); on GPU builds, emit the diagnostic print only.
1337+
#ifndef MFC_GPU
13351338
call s_mpi_abort('Error: negative discriminant in s_compute_fast_magnetosonic_speed')
1339+
#endif
13361340
end if
13371341
#endif
13381342

src/post_process/m_derived_variables.fpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ contains
438438

439439
real(wp) :: drho_dx, drho_dy, drho_dz !< Spatial derivatives of the density in the x-, y- and z-directions
440440
real(wp), dimension(2) :: gm_rho_max !< Global (max gradient magnitude, rank) pair for density
441+
real(wp) :: alpha_last !< Volume fraction of the fluid not explicitly stored (IGR)
441442
integer :: i, j, k, l
442443

443444
do l = -offset_z%beg, p + offset_z%end
@@ -495,10 +496,24 @@ contains
495496
do j = -offset_x%beg, m + offset_x%end
496497
q_sf(j, k, l) = 0._wp
497498
498-
do i = 1, eqn_idx%adv%end - eqn_idx%E
499-
q_sf(j, k, l) = q_sf(j, k, l) - schlieren_alpha(i)*q_cons_vf(i + eqn_idx%E)%sf(j, k, l)*gm_rho_sf(j, &
500-
& k, l)/gm_rho_max(1)
501-
end do
499+
! Tracks the volume fraction of the fluid not explicitly stored (IGR reconstructs it as 1 - sum)
500+
if (igr) then
501+
! IGR stores only num_fluids-1 volume fractions; the last fluid's volume fraction is untracked.
502+
! For a single fluid this is simply 1.0 everywhere. Without this term, the entire single-fluid
503+
! Schlieren field is dropped, leaving exp(0) = 1 everywhere. Compute that term below.
504+
alpha_last = 1._wp
505+
do i = 1, eqn_idx%adv%end - eqn_idx%E
506+
q_sf(j, k, l) = q_sf(j, k, l) - schlieren_alpha(i)*q_cons_vf(i + eqn_idx%E)%sf(j, k, &
507+
& l)*gm_rho_sf(j, k, l)/gm_rho_max(1)
508+
alpha_last = alpha_last - q_cons_vf(i + eqn_idx%E)%sf(j, k, l)
509+
end do
510+
q_sf(j, k, l) = q_sf(j, k, l) - schlieren_alpha(num_fluids)*alpha_last*gm_rho_sf(j, k, l)/gm_rho_max(1)
511+
else
512+
do i = 1, eqn_idx%adv%end - eqn_idx%E
513+
q_sf(j, k, l) = q_sf(j, k, l) - schlieren_alpha(i)*q_cons_vf(i + eqn_idx%E)%sf(j, k, &
514+
& l)*gm_rho_sf(j, k, l)/gm_rho_max(1)
515+
end do
516+
end if
502517
end do
503518
end do
504519
end do

tests/coverage_map.json.gz

-40 Bytes
Binary file not shown.

toolchain/mfc/case_validator.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,14 +1604,24 @@ def check_schlieren(self):
16041604
n = self.get("n", 0)
16051605
fd_order = self.get("fd_order")
16061606
num_fluids = self.get("num_fluids")
1607+
model_eqns = self.get("model_eqns")
16071608

16081609
self.prohibit(n is not None and n == 0 and schlieren_wrt, "schlieren_wrt requires n > 0 (at least 2D)")
16091610
self.prohibit(schlieren_wrt and fd_order is None, "fd_order must be set for schlieren_wrt")
16101611

1612+
# The volume-fraction model (model_eqns /= 1) weights the Schlieren field by schlieren_alpha(i) for every fluid; an unset
1613+
# value stays at the -1e6 sentinel and produces nonsensical output. Under IGR the last fluid's volume fraction is
1614+
# reconstructed (not stored), so schlieren_alpha must still be set for all num_fluids components, including the single
1615+
# fluid of a single-fluid IGR case. The gamma/pi_inf model (model_eqns == 1) does not use schlieren_alpha.
16111616
if num_fluids is not None:
16121617
for i in range(1, num_fluids + 1):
16131618
schlieren_alpha = self.get(f"schlieren_alpha({i})")
1614-
if schlieren_alpha is not None:
1619+
if schlieren_alpha is None:
1620+
self.prohibit(
1621+
schlieren_wrt and model_eqns is not None and model_eqns != 1,
1622+
f"schlieren_alpha({i}) must be set for every fluid when schlieren_wrt is enabled (unless model_eqns == 1)",
1623+
)
1624+
else:
16151625
self.prohibit(schlieren_alpha <= 0, f"schlieren_alpha({i}) must be greater than zero")
16161626
self.prohibit(not schlieren_wrt, f"schlieren_alpha({i}) should be set only with schlieren_wrt enabled")
16171627

0 commit comments

Comments
 (0)