Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/simulation/m_ibm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ contains
type(ghost_point) :: gp
type(ghost_point) :: innerp

! set the Moving IBM interior Pressure Values
! set the Moving IBM interior conservative variables
$:GPU_PARALLEL_LOOP(private='[i,j,k,patch_id,rho]', copyin='[E_idx,momxb]', collapse=3)
do l = 0, p
do k = 0, n
Expand Down
2 changes: 1 addition & 1 deletion toolchain/mfc/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_inp(self, _target) -> str:
cons.print(f"Generating [magenta]{target.name}.inp[/magenta]:")
cons.indent()

MASTER_KEYS: list = case_dicts.get_input_dict_keys(target.name)
MASTER_KEYS = case_dicts.get_input_dict_keys(target.name)

ignored = []

Expand Down
4 changes: 2 additions & 2 deletions toolchain/mfc/case_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Dict, List, Set

from .common import MFCException
from .params.definitions import CONSTRAINTS
from .params.definitions import CONSTRAINTS, NI
from .state import CFG

# Physics documentation for check methods.
Expand Down Expand Up @@ -559,7 +559,7 @@ def check_ibm(self):
ib_state_wrt = self.get("ib_state_wrt", "F") == "T"

self.prohibit(ib and n <= 0, "Immersed Boundaries do not work in 1D (requires n > 0)")
self.prohibit(ib and (num_ibs <= 0 or num_ibs > 1000), "num_ibs must be between 1 and num_patches_max (1000)")
self.prohibit(ib and (num_ibs <= 0 or num_ibs > NI), f"num_ibs must be between 1 and {NI}")
self.prohibit(not ib and num_ibs > 0, "num_ibs is set, but ib is not enabled")
self.prohibit(ib_state_wrt and not ib, "ib_state_wrt requires ib to be enabled")

Expand Down
3 changes: 2 additions & 1 deletion toolchain/mfc/params/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
# and freezes it. It must come after REGISTRY is imported and must not be removed.
from . import definitions # noqa: F401
from .definitions import CONSTRAINTS, DEPENDENCIES, get_value_label
from .registry import REGISTRY, RegistryFrozenError
from .registry import REGISTRY, IndexedFamily, RegistryFrozenError
from .schema import ParamDef, ParamType

__all__ = [
"REGISTRY",
"IndexedFamily",
"RegistryFrozenError",
"ParamDef",
"ParamType",
Expand Down
46 changes: 25 additions & 21 deletions toolchain/mfc/params/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import re
from typing import Any, Dict

from .registry import REGISTRY
from .registry import REGISTRY, IndexedFamily
from .schema import ParamDef, ParamType

# Index limits
Expand Down Expand Up @@ -639,7 +639,7 @@ def get_value_label(param_name: str, value: int) -> str:
# Counts (must be positive)
"num_fluids": {"min": 1, "max": 10},
"num_patches": {"min": 0, "max": 10},
"num_ibs": {"min": 0, "max": 1000},
"num_ibs": {"min": 0, "max": NI},
"num_source": {"min": 1},
"num_probes": {"min": 1},
"num_integrals": {"min": 1},
Expand Down Expand Up @@ -1136,26 +1136,30 @@ def _load():
]:
_r(f"bub_pp%{a}", REAL, {"bubbles"}, math=sym)

# patch_ib (10 immersed boundaries)
for i in range(1, NI + 1):
px = f"patch_ib({i})%"
for a in ["geometry", "moving_ibm"]:
_r(f"{px}{a}", INT, {"ib"})
for a, pt in [("radius", REAL), ("theta", REAL), ("slip", LOG), ("c", REAL), ("p", REAL), ("t", REAL), ("m", REAL), ("mass", REAL)]:
_r(f"{px}{a}", pt, {"ib"})
for j in range(1, 4):
_r(f"{px}angles({j})", REAL, {"ib"})
for d in ["x", "y", "z"]:
_r(f"{px}{d}_centroid", REAL, {"ib"})
_r(f"{px}length_{d}", REAL, {"ib"})
for a, pt in [("model_filepath", STR), ("model_spc", INT), ("model_threshold", REAL)]:
_r(f"{px}{a}", pt, {"ib"})
for t in ["translate", "scale", "rotate"]:
for j in range(1, 4):
_r(f"{px}model_{t}({j})", REAL, {"ib"})
# patch_ib (immersed boundaries) — registered as indexed family for O(1) lookup.
# Max index is NI; attributes are pattern-matched, not enumerated.
_ib_tags = {"ib"}
_ib_attrs: Dict[str, tuple] = {}
for a in ["geometry", "moving_ibm"]:
_ib_attrs[a] = (INT, _ib_tags)
for a, pt in [("radius", REAL), ("theta", REAL), ("slip", LOG), ("c", REAL), ("p", REAL), ("t", REAL), ("m", REAL), ("mass", REAL)]:
_ib_attrs[a] = (pt, _ib_tags)
for j in range(1, 4):
_ib_attrs[f"angles({j})"] = (REAL, _ib_tags)
for d in ["x", "y", "z"]:
_ib_attrs[f"{d}_centroid"] = (REAL, _ib_tags)
_ib_attrs[f"length_{d}"] = (REAL, _ib_tags)
for a, pt in [("model_filepath", STR), ("model_spc", INT), ("model_threshold", REAL)]:
_ib_attrs[a] = (pt, _ib_tags)
for t in ["translate", "scale", "rotate"]:
for j in range(1, 4):
_r(f"{px}vel({j})", A_REAL, {"ib"})
_r(f"{px}angular_vel({j})", A_REAL, {"ib"})
_ib_attrs[f"model_{t}({j})"] = (REAL, _ib_tags)
for j in range(1, 4):
_ib_attrs[f"vel({j})"] = (A_REAL, _ib_tags)
_ib_attrs[f"angular_vel({j})"] = (A_REAL, _ib_tags)
REGISTRY.register_family(IndexedFamily(
base_name="patch_ib", attrs=_ib_attrs, tags=_ib_tags, max_index=NI,
))

# acoustic sources (4 sources)
for i in range(1, NA + 1):
Expand Down
Loading
Loading