From df6733f8bf5ccf5c31fecd3f1b9abfb62ce2e48f Mon Sep 17 00:00:00 2001 From: vahid ansari Date: Sat, 25 Jul 2026 06:32:27 +0200 Subject: [PATCH] fix(palace): omit BoundaryMode Target when set to auto BoundaryModeConfig.to_palace_config() always emitted "Target", so the documented target=0 ("automatic shift") sentinel reached Palace as Target: 0.0. Palace 0.17.0 declares Solver.BoundaryMode.Target with exclusiveMinimum 0.0, so config validation fails and the solver aborts before the solve starts: At ["Solver"]["BoundaryMode"]["Target"]: instance is below or equals minimum of 0.0 MFEM abort: Configuration file validation failed! Target is optional; when omitted Palace derives the shift from material properties. Guard the key the same way MaxSize already is. --- src/gsim/palace/models/problems.py | 3 ++- tests/palace/test_boundarymode_models.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gsim/palace/models/problems.py b/src/gsim/palace/models/problems.py index 65261376..0ba1e6b4 100644 --- a/src/gsim/palace/models/problems.py +++ b/src/gsim/palace/models/problems.py @@ -322,10 +322,11 @@ def to_palace_config(self) -> dict: "Freq": self.freq / 1e9, "N": self.num_modes, "Save": self.save, - "Target": self.target, "Tol": self.tolerance, "Type": self.solver_type, } + if self.target > 0: # Palace requires Target > 0 when present; 0 means auto + config["Target"] = self.target if ( self.max_size > 0 ): # Even when the default is zero, passing it explicitly makes Palace fail diff --git a/tests/palace/test_boundarymode_models.py b/tests/palace/test_boundarymode_models.py index efc6e027..d346d969 100644 --- a/tests/palace/test_boundarymode_models.py +++ b/tests/palace/test_boundarymode_models.py @@ -53,3 +53,9 @@ def test_to_palace_config(self): assert result["MaxSize"] == 80 assert result["Type"] == "SLEPc" assert "Attributes" not in result + + def test_to_palace_config_omits_auto_target(self): + """target=0 means automatic shift, so Target is left out of the config.""" + result = BoundaryModeConfig(freq=50e9, num_modes=2, save=2).to_palace_config() + assert "Target" not in result + assert "MaxSize" not in result