Skip to content

Commit 37dd0f4

Browse files
authored
Hotfix: Allow certain case parameters to be analytic expressions again (#473)
1 parent ae76acf commit 37dd0f4

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ function(MFC_SETUP_TARGET)
465465
PRIVATE -gpu=unified
466466
)
467467
endif()
468+
468469
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
469470
target_compile_options(${ARGS_TARGET}
470471
PRIVATE -gpu=autocompare,debug

toolchain/mfc/case.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ def __get_ndims(self) -> int:
8383
return 1 + min(int(self.params.get("n", 0)), 1) + min(int(self.params.get("p", 0)), 1)
8484

8585
def __is_ic_analytical(self, key: str, val: str) -> bool:
86+
'''Is this initial condition analytical?
87+
More precisely, is this an arbitrary expression or a string representing a number?'''
8688
if common.is_number(val) or not isinstance(val, str):
8789
return False
8890

toolchain/mfc/run/case_dicts.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from enum import Enum
2-
32
from ..state import ARG
43

54
class ParamType(Enum):
@@ -8,6 +7,16 @@ class ParamType(Enum):
87
LOG = {"enum": ["T", "F"]}
98
STR = {"type": "string"}
109

10+
_ANALYTIC_INT = {"type": ["integer", "string"]}
11+
_ANALYTIC_REAL = {"type": ["number", "string"]}
12+
13+
def analytic(self):
14+
if self == self.INT:
15+
return self._ANALYTIC_INT
16+
if self == self.REAL:
17+
return self._ANALYTIC_REAL
18+
return self.STR
19+
1120
COMMON = {
1221
'hypoelasticity': ParamType.LOG,
1322
'cyl_coord': ParamType.LOG,
@@ -105,9 +114,10 @@ class ParamType(Enum):
105114
PRE_PROCESS[f"patch_icpp({p_id})%{attribute}"] = ty
106115

107116
for real_attr in ["radius", "radii", "epsilon", "beta", "normal", "alpha_rho",
108-
"smooth_coeff", "rho", "vel", "pres", "alpha", "gamma",
117+
"smooth_coeff", "rho", "vel", "alpha", "gamma",
109118
"pi_inf", "r0", "v0", "p0", "m0", "cv", "qv", "qvp", "cf_val"]:
110119
PRE_PROCESS[f"patch_icpp({p_id})%{real_attr}"] = ParamType.REAL
120+
PRE_PROCESS[f"patch_icpp({p_id})%pres"] = ParamType.REAL.analytic()
111121

112122
# (cameron): This parameter has since been removed.
113123
# for i in range(100):
@@ -127,15 +137,16 @@ class ParamType(Enum):
127137
PRE_PROCESS[f'patch_icpp({p_id})%{cmp}_centroid'] = ParamType.REAL
128138
PRE_PROCESS[f'patch_icpp({p_id})%length_{cmp}'] = ParamType.REAL
129139

130-
for append in ["radii", "normal", "vel"]:
140+
for append in ["radii", "normal"]:
131141
PRE_PROCESS[f'patch_icpp({p_id})%{append}({cmp_id})'] = ParamType.REAL
142+
PRE_PROCESS[f'patch_icpp({p_id})%vel({cmp_id})'] = ParamType.REAL.analytic()
132143

133144
for arho_id in range(1, 10+1):
134-
PRE_PROCESS[f'patch_icpp({p_id})%alpha({arho_id})'] = ParamType.REAL
135-
PRE_PROCESS[f'patch_icpp({p_id})%alpha_rho({arho_id})'] = ParamType.REAL
145+
PRE_PROCESS[f'patch_icpp({p_id})%alpha({arho_id})'] = ParamType.REAL.analytic()
146+
PRE_PROCESS[f'patch_icpp({p_id})%alpha_rho({arho_id})'] = ParamType.REAL.analytic()
136147

137148
for taue_id in range(1, 6+1):
138-
PRE_PROCESS[f'patch_icpp({p_id})%tau_e({taue_id})'] = ParamType.REAL
149+
PRE_PROCESS[f'patch_icpp({p_id})%tau_e({taue_id})'] = ParamType.REAL.analytic()
139150

140151
if p_id >= 2:
141152
PRE_PROCESS[f'patch_icpp({p_id})%alter_patch'] = ParamType.LOG

0 commit comments

Comments
 (0)