Skip to content

Commit

Permalink
Hotfix: Allow certain case parameters to be analytic expressions again (
Browse files Browse the repository at this point in the history
  • Loading branch information
AiredaleDev authored Jun 19, 2024
1 parent ae76acf commit 37dd0f4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ function(MFC_SETUP_TARGET)
PRIVATE -gpu=unified
)
endif()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${ARGS_TARGET}
PRIVATE -gpu=autocompare,debug
Expand Down
2 changes: 2 additions & 0 deletions toolchain/mfc/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def __get_ndims(self) -> int:
return 1 + min(int(self.params.get("n", 0)), 1) + min(int(self.params.get("p", 0)), 1)

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

Expand Down
23 changes: 17 additions & 6 deletions toolchain/mfc/run/case_dicts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from enum import Enum

from ..state import ARG

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

_ANALYTIC_INT = {"type": ["integer", "string"]}
_ANALYTIC_REAL = {"type": ["number", "string"]}

def analytic(self):
if self == self.INT:
return self._ANALYTIC_INT
if self == self.REAL:
return self._ANALYTIC_REAL
return self.STR

COMMON = {
'hypoelasticity': ParamType.LOG,
'cyl_coord': ParamType.LOG,
Expand Down Expand Up @@ -105,9 +114,10 @@ class ParamType(Enum):
PRE_PROCESS[f"patch_icpp({p_id})%{attribute}"] = ty

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

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

for append in ["radii", "normal", "vel"]:
for append in ["radii", "normal"]:
PRE_PROCESS[f'patch_icpp({p_id})%{append}({cmp_id})'] = ParamType.REAL
PRE_PROCESS[f'patch_icpp({p_id})%vel({cmp_id})'] = ParamType.REAL.analytic()

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

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

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

0 comments on commit 37dd0f4

Please sign in to comment.