*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit dbbf0dc3 authored by Carl-Martin Pfeiler's avatar Carl-Martin Pfeiler
Browse files

Catch wrong applied field given by user.

parent 9f524b52
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment