-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Factorization failure for certain conditionals #246
Comments
@mrambausek Can you include also an error message? Thanks! |
|
this fails as well:
which is quite surprising since the only change is from a float "0" to a float "1e-6" |
What seems imporant, is that at least one of the derivatives wrt. (u1, u2) has to vanish. This conditional, for example, works:
|
At least for the MW(F)E, a possible workaround seems to be
|
Just note that taking a (!distributional) derivative of a conditional is in most use cases mathematical non-sense, unless you add an extra delta measure which comes from the differentiation of a discontinuous function. What UFL and FFC do is that they differentiate piecewise, which is not always correct. But I'll have a better look at why this issue appeared. I rewrote some factorization parts a while ago when allowing tensor-valued expressions to be factorized. So the issue originated probably at that point. |
Thanks a lot for looking into that -- if you find the time. I would say, a valid use case for a distributional derivative of a conditional is when you have an energy density of which the derivative exists and is smooth, but has an unstable numerical evaluation (e.g., one needs to take limits). Antiderivatives of sigmoidal functions are candidates for such potentials. As a remedy, one can -- by means of a conditional -- replace the original energy density by a quadratic approximation around certain points. Now, in case of coupled problems, e.g., magneto-mechanics, problems as described here could appear in certain situations. Of course, this is still a corner case, given the special case that triggered the problem. I am happy with my current workaround, but I would highly appreciate a fix or at least a warning if it really is an unsupported operation. |
While probably quite a corner case, I managed to stumble into that...
The text was updated successfully, but these errors were encountered: