This integral is missing an integration domain
Let's consider I want to implement a model with e.g. a source term like
...
b = q * phi * dx
...
Now, if its value is set to zero (q=0), I get the following error from ufl:
Traceback (most recent call last):
File "example.py", line 123, in <module>
b = q * phi * dx
File "/usr/lib/python3/dist-packages/ufl/measure.py", line 441, in __rmul__
error("This integral is missing an integration domain.")
File "/usr/lib/python3/dist-packages/ufl/log.py", line 172, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: This integral is missing an integration domain.
I understand that the integral is evaluated to zero, but I think this is not very viable.
Often I want to have such terms to be able to add a (source) term at some other time, but its annoying to comment this line everytime if I change my models parameters.
Is there a way to change/overcome this?