Skip to content

Commit

Permalink
fix issues with first merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Archith Iyer committed Nov 8, 2024
1 parent 8952248 commit 683d620
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,9 +1424,9 @@ contains

if (chemistry) then
if (avg_state == 1 .and. abs(c_c) > Tolerance) then
c = sqrt(c_c - (gamma - 1.0._wp)*(vel_sum - H))
c = sqrt(c_c - (gamma - 1.0_wp)*(vel_sum - H))
else
c = sqrt((1.0._wp + 1.0._wp/gamma)*pres/rho)
c = sqrt((1.0_wp + 1.0_wp/gamma)*pres/rho)
end if
else
if (alt_soundspeed) then
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_cbc.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ contains
end do


E = gamma*pres + pi_inf + 5e-1*rho*vel_K_sum
E = gamma*pres + pi_inf + 5e-1_wp*rho*vel_K_sum
H = (E + pres)/rho

! Compute mixture sound speed
Expand Down
16 changes: 6 additions & 10 deletions src/simulation/m_checker.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,14 @@ contains
@:PROHIBIT(p + 1 < min(1, p)*num_stcls_min*weno_order, &
"For 3D simulation, p must be greater than or equal to (num_stcls_min*weno_order - 1), whose value is "//trim(numStr))
@:PROHIBIT(weno_order /= 1 .and. f_is_default(weno_eps), &
"weno_order != 1, but weno_eps is not set. A typical value of weno_eps is 1e-6")
@:PROHIBIT(weno_eps <= 0d0, "weno_eps must be positive. A typical value of weno_eps is 1e-6")
@:PROHIBIT(wenoz .and. weno_order == 7 .and. f_is_default(wenoz_q), &
"wenoz is used at 7th order, but wenoz_q is not set. It should be either 2, 3, or 4")
@:PROHIBIT(wenoz .and. weno_order == 7 .and. .not. (f_approx_equal(wenoz_q, 2._wp) .or. f_approx_equal(wenoz_q, 3._wp) .or. f_approx_equal(wenoz_q, 4d0)), &
"wenoz_q must be either 2, 3, or 4")
@:PROHIBIT(teno .and. f_is_default(teno_CT), "teno is used, but teno_CT is not set. A typical value of teno_CT is 1e-6")
@:PROHIBIT(teno .and. teno_CT <= 0._wp, "teno_CT must be positive. A typical value of teno_CT is 1e-6")
"weno_order != 1, but weno_eps is not set. A typical value of weno_eps is 1e-6_wp")
@:PROHIBIT(weno_eps <= 0._wp, "weno_eps must be positive. A typical value of weno_eps is 1e-6_wp")
@:PROHIBIT(teno .and. f_is_default(teno_CT), "teno is used, but teno_CT is not set. A typical value of teno_CT is 1e-6_wp")
@:PROHIBIT(teno .and. teno_CT <= 0._wp, "teno_CT must be positive. A typical value of teno_CT is 1e-6_wp")
@:PROHIBIT(count([mapped_weno, wenoz, teno]) >= 2, "Only one of mapped_weno, wenoz, or teno can be set to true")
@:PROHIBIT(weno_order == 1 .and. mapped_weno)
@:PROHIBIT(weno_order == 1 .and. wenoz)
@:PROHIBIT((weno_order == 1 .or. weno_order == 3) .and. teno)
@:PROHIBIT(weno_order /= 5 .and. teno)
@:PROHIBIT(weno_order /= 5 .and. mp_weno)
@:PROHIBIT(model_eqns == 1 .and. weno_avg)
end subroutine s_check_inputs_weno
Expand Down Expand Up @@ -295,4 +291,4 @@ contains
@:PROHIBIT(integral_wrt .and. (.not. bubbles))
end subroutine s_check_inputs_misc
end module m_checker
end module m_checker
6 changes: 3 additions & 3 deletions src/simulation/m_riemann_solvers.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -2258,10 +2258,10 @@ contains
@:compute_average_state()
call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, &
vel_L_rms, 0_wp, c_L)
vel_L_rms, 0._wp, c_L)
call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, &
vel_R_rms, 0_wp, c_R)
vel_R_rms, 0._wp, c_R)
!> The computation of c_avg does not require all the variables, and therefore the non '_avg'
! variables are placeholders to call the subroutine.
Expand Down Expand Up @@ -4416,4 +4416,4 @@ contains
end subroutine s_finalize_riemann_solvers_module
end module m_riemann_solvers
end module m_riemann_solvers
2 changes: 1 addition & 1 deletion src/simulation/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ contains

if (t_step == 0) dt_init = dt

if (dt < 1e-3*dt_init .and. cfl_adap_dt .and. proc_rank == 0) then
if (dt < 1e-3_wp*dt_init .and. cfl_adap_dt .and. proc_rank == 0) then
print*, "Delta t = ", dt
call s_mpi_abort("Delta t has become too small")
end if
Expand Down
11 changes: 9 additions & 2 deletions toolchain/mfc/run/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from ..printer import cons
from .. import common, build
from ..state import ARGS
from ..state import ARGS, ARG
from ..case import Case

@dataclasses.dataclass(init=False)
Expand Down Expand Up @@ -69,17 +69,24 @@ def generate_fpp(self, target) -> None:
# (Thermo)Chemistry source file
modules_dir = os.path.join(target.get_staging_dirpath(self), "modules", target.name)
common.create_directory(modules_dir)

# Determine the real type based on the single precision flag
real_type = 'real(sp)' if ARG('single') else 'real(dp)'

# Write the generated Fortran code to the m_thermochem.f90 file with the chosen precision
common.file_write(
os.path.join(modules_dir, "m_thermochem.f90"),
pyro.codegen.fortran90.gen_thermochem_code(
self.get_cantera_solution(),
module_name="m_thermochem"
module_name="m_thermochem",
real_type=real_type
),
True
)

cons.unindent()


# Generate case.fpp & [target.name].inp
def generate(self, target) -> None:
self.generate_inp(target)
Expand Down
8 changes: 8 additions & 0 deletions toolchain/mfc/test/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,19 @@ def create_directory(self):
def __str__(self) -> str:
return f"tests/[bold magenta]{self.get_uuid()}[/bold magenta]: {self.trace}"

def to_input_file(self) -> input.MFCInputFile:
return input.MFCInputFile(
os.path.basename(self.get_filepath()),
self.get_dirpath(),
self.get_parameters())


def compute_tolerance(self) -> float:
single = ARG("single")
if self.params.get("hypoelasticity", 'F') == 'T':
tol = 1e-7
elif self.params.get("weno_order") == 7:
tol = 1e-9
elif any(self.params.get(key, 'F') == 'T' for key in ['relax', 'ib', 'qbmm', 'bubbles']):
tol = 1e-10
elif self.params.get("low_Mach", 'F') == 1 or self.params.get("low_Mach", 'F') == 2:
Expand Down
2 changes: 1 addition & 1 deletion toolchain/mfc/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def handle_case(case: TestCase, devices: typing.Set[int]):
try:
_handle_case(case, devices)
nPASS += 1
except Exception as exc:
except MFCException as exc:
if nAttempts < max_attempts:
continue
nFAIL += 1
Expand Down

0 comments on commit 683d620

Please sign in to comment.