diff --git a/integrators/_details/physicalToMathematical.py b/integrators/_details/physicalToMathematical.py index 5f1b9e05d114b9ec3de13bc2cb4a200b0741b811..8c7f6ab27ee2a4a05322df86bd551adc58becba6 100644 --- a/integrators/_details/physicalToMathematical.py +++ b/integrators/_details/physicalToMathematical.py @@ -107,6 +107,7 @@ def Compute_Cst(self): def ConvertAppliedField(self): import types + from inspect import signature from ngsolve import CoefficientFunction, x, y, z if(self.parameters.H_ext == None): @@ -122,6 +123,11 @@ def ConvertAppliedField(self): hext_mp = [0.0, 0.0, 0.0] for d in range(3): if isinstance(self.parameters.H_ext[d], types.FunctionType): + if(len(signature(self.parameters.H_ext[d]).parameters) != 4): + raise ValueError(("H_ext[" + str(d) + "] is a function with " \ + + str(len(signature(self.parameters.H_ext[d]).parameters)) \ + + " parameter(s)! --> Error: Needs to depend on exactly 4 parameters" \ + + " (t, x, y, z) !")) hext[d] = self.parameters.H_ext[d](self._time_cf / tScale, x, y, z) hext_impl[d] = self.parameters.H_ext[d]( \ (self._time_cf + self._theta*self._k) / tScale, x, y, z)