On 06/11/15 14:23, Buesing, Henrik wrote:
On 06/11/15 12:40, Buesing, Henrik wrote:
Are you sure the problem isn't that he needs bounds for his solve? AFAICS dS/dh=0 for h<hw or h>hn. Otherwise shouldn't rewriting this with conditionals have worked?
@Stephan: So how can I rewrite the attached saturation.py with conditionals?
Sw=conditional(hin>hn, Constant(0.0), conditional(hin<hw, Constant(1.0), (hin-hn)/(hw-hn)))
This gives you a UFL expression that you can use in a larger system, or project to some function space.
@Stephan: Thank you! Is there also a way to write the attached enthn.py in UFL notation? Basically I failed to do the int(dm), if dm is a UFL expression. And probably the array access might be a problem?
Yes, looks like a piecewise linear interpolation from an arbitrary lookup table?
Yes, exactly!
I don't see how to do this in UFL indeed. You could approximate it with a polynomial but that might not be accurate enough and have nasty under/over shoots if the data is not smooth.
So the best way to do this might indeed be to keep your point-wise evaluation and add a hook for the evaluation of its derivative
Ok. I will see if I get the "coefficient_derivatives" argument to work. Else I just might pass the whole Jacobian. Thank you! Henrik