Skip to content

Commit 683d620

Browse files
author
Archith Iyer
committed
fix issues with first merge
1 parent 8952248 commit 683d620

File tree

8 files changed

+31
-20
lines changed

8 files changed

+31
-20
lines changed

src/common/m_variables_conversion.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,9 +1424,9 @@ contains
14241424

14251425
if (chemistry) then
14261426
if (avg_state == 1 .and. abs(c_c) > Tolerance) then
1427-
c = sqrt(c_c - (gamma - 1.0._wp)*(vel_sum - H))
1427+
c = sqrt(c_c - (gamma - 1.0_wp)*(vel_sum - H))
14281428
else
1429-
c = sqrt((1.0._wp + 1.0._wp/gamma)*pres/rho)
1429+
c = sqrt((1.0_wp + 1.0_wp/gamma)*pres/rho)
14301430
end if
14311431
else
14321432
if (alt_soundspeed) then

src/simulation/m_cbc.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ contains
805805
end do
806806

807807

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

811811
! Compute mixture sound speed

src/simulation/m_checker.fpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,14 @@ contains
6464
@:PROHIBIT(p + 1 < min(1, p)*num_stcls_min*weno_order, &
6565
"For 3D simulation, p must be greater than or equal to (num_stcls_min*weno_order - 1), whose value is "//trim(numStr))
6666
@:PROHIBIT(weno_order /= 1 .and. f_is_default(weno_eps), &
67-
"weno_order != 1, but weno_eps is not set. A typical value of weno_eps is 1e-6")
68-
@:PROHIBIT(weno_eps <= 0d0, "weno_eps must be positive. A typical value of weno_eps is 1e-6")
69-
@:PROHIBIT(wenoz .and. weno_order == 7 .and. f_is_default(wenoz_q), &
70-
"wenoz is used at 7th order, but wenoz_q is not set. It should be either 2, 3, or 4")
71-
@: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)), &
72-
"wenoz_q must be either 2, 3, or 4")
73-
@: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")
74-
@:PROHIBIT(teno .and. teno_CT <= 0._wp, "teno_CT must be positive. A typical value of teno_CT is 1e-6")
67+
"weno_order != 1, but weno_eps is not set. A typical value of weno_eps is 1e-6_wp")
68+
@:PROHIBIT(weno_eps <= 0._wp, "weno_eps must be positive. A typical value of weno_eps is 1e-6_wp")
69+
@: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")
70+
@:PROHIBIT(teno .and. teno_CT <= 0._wp, "teno_CT must be positive. A typical value of teno_CT is 1e-6_wp")
7571
@:PROHIBIT(count([mapped_weno, wenoz, teno]) >= 2, "Only one of mapped_weno, wenoz, or teno can be set to true")
7672
@:PROHIBIT(weno_order == 1 .and. mapped_weno)
7773
@:PROHIBIT(weno_order == 1 .and. wenoz)
78-
@:PROHIBIT((weno_order == 1 .or. weno_order == 3) .and. teno)
74+
@:PROHIBIT(weno_order /= 5 .and. teno)
7975
@:PROHIBIT(weno_order /= 5 .and. mp_weno)
8076
@:PROHIBIT(model_eqns == 1 .and. weno_avg)
8177
end subroutine s_check_inputs_weno
@@ -295,4 +291,4 @@ contains
295291
@:PROHIBIT(integral_wrt .and. (.not. bubbles))
296292
end subroutine s_check_inputs_misc
297293
298-
end module m_checker
294+
end module m_checker

src/simulation/m_riemann_solvers.fpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,10 +2258,10 @@ contains
22582258
@:compute_average_state()
22592259
22602260
call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, &
2261-
vel_L_rms, 0_wp, c_L)
2261+
vel_L_rms, 0._wp, c_L)
22622262
22632263
call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, &
2264-
vel_R_rms, 0_wp, c_R)
2264+
vel_R_rms, 0._wp, c_R)
22652265
22662266
!> The computation of c_avg does not require all the variables, and therefore the non '_avg'
22672267
! variables are placeholders to call the subroutine.
@@ -4416,4 +4416,4 @@ contains
44164416
44174417
end subroutine s_finalize_riemann_solvers_module
44184418
4419-
end module m_riemann_solvers
4419+
end module m_riemann_solvers

src/simulation/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ contains
11101110

11111111
if (t_step == 0) dt_init = dt
11121112

1113-
if (dt < 1e-3*dt_init .and. cfl_adap_dt .and. proc_rank == 0) then
1113+
if (dt < 1e-3_wp*dt_init .and. cfl_adap_dt .and. proc_rank == 0) then
11141114
print*, "Delta t = ", dt
11151115
call s_mpi_abort("Delta t has become too small")
11161116
end if

toolchain/mfc/run/input.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from ..printer import cons
77
from .. import common, build
8-
from ..state import ARGS
8+
from ..state import ARGS, ARG
99
from ..case import Case
1010

1111
@dataclasses.dataclass(init=False)
@@ -69,17 +69,24 @@ def generate_fpp(self, target) -> None:
6969
# (Thermo)Chemistry source file
7070
modules_dir = os.path.join(target.get_staging_dirpath(self), "modules", target.name)
7171
common.create_directory(modules_dir)
72+
73+
# Determine the real type based on the single precision flag
74+
real_type = 'real(sp)' if ARG('single') else 'real(dp)'
75+
76+
# Write the generated Fortran code to the m_thermochem.f90 file with the chosen precision
7277
common.file_write(
7378
os.path.join(modules_dir, "m_thermochem.f90"),
7479
pyro.codegen.fortran90.gen_thermochem_code(
7580
self.get_cantera_solution(),
76-
module_name="m_thermochem"
81+
module_name="m_thermochem",
82+
real_type=real_type
7783
),
7884
True
7985
)
8086

8187
cons.unindent()
8288

89+
8390
# Generate case.fpp & [target.name].inp
8491
def generate(self, target) -> None:
8592
self.generate_inp(target)

toolchain/mfc/test/case.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,19 @@ def create_directory(self):
216216
def __str__(self) -> str:
217217
return f"tests/[bold magenta]{self.get_uuid()}[/bold magenta]: {self.trace}"
218218

219+
def to_input_file(self) -> input.MFCInputFile:
220+
return input.MFCInputFile(
221+
os.path.basename(self.get_filepath()),
222+
self.get_dirpath(),
223+
self.get_parameters())
224+
219225

220226
def compute_tolerance(self) -> float:
221227
single = ARG("single")
222228
if self.params.get("hypoelasticity", 'F') == 'T':
223229
tol = 1e-7
230+
elif self.params.get("weno_order") == 7:
231+
tol = 1e-9
224232
elif any(self.params.get(key, 'F') == 'T' for key in ['relax', 'ib', 'qbmm', 'bubbles']):
225233
tol = 1e-10
226234
elif self.params.get("low_Mach", 'F') == 1 or self.params.get("low_Mach", 'F') == 2:

toolchain/mfc/test/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def handle_case(case: TestCase, devices: typing.Set[int]):
233233
try:
234234
_handle_case(case, devices)
235235
nPASS += 1
236-
except Exception as exc:
236+
except MFCException as exc:
237237
if nAttempts < max_attempts:
238238
continue
239239
nFAIL += 1

0 commit comments

Comments
 (0)