On 15 May 2017, at 10:13, Andrew McRae <A.T.T.McRae@bath.ac.uk> wrote:
_______________________________________________AndrewUnless I'm being dumb, this really should work as you've written it (using assign/interpolate definitely won't do what you want).Can you send a fuller version of your code as I suspect the error is caused by something else?
On 15 May 2017 at 09:48, Anna Kalogirou <A.Kalogirou@leeds.ac.uk> wrote:
Hi Colin,
Thanks, indeed I had forgotten a trial function in my residual.
Yes I do need the the u-dependence in the maximum during the solve. If I substitute the definition of maximum into the residual, i.e. writeF = v*(u + 0.5*(u + abs(u)))*dxgives the errorufl.log.UFLException: UFL conditions cannot be evaluated as bool in a Python context.
Will it work if I use assign instead of interpolate?
Best, Anna.
On 15 May 2017, at 07:59, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:
Hi Anna,Are you intending that the u-dependence in maximum should be maintained during the solve? After doing the interpolation, there will be no symbolic record of where maximum's values came from.
That's probably not the cause of the error message though. It says that the form is not a linear form. This might mean that you accidentally included some TrialFunction (which turns it into a bilinear form) or perhaps forgot a factor of dx or dS somewhere (which stops it from being a form).
all the best--cjc______________________________
On 14 May 2017 at 21:30, Anna Kalogirou <A.Kalogirou@leeds.ac.uk> wrote:
Following up on my previous email, I have found a workaround to those issues, but now I have a problem with the solvers:
Traceback (most recent call last):File "/Users/matak/Downloads/Inequality-constraint-Rockafellar/so lvers.py", line 32, in solver_F F_problem = NonlinearVariationalProblem(F_solve, w)#, aP=Ap) File "/Users/matak/firedrake/src/firedrake/firedrake/variational_ solver.py", line 47, in __init__ raise ValueError("Provided residual is not a linear form")ValueError: Provided residual is not a linear form
There two issues here:1. I cannot give a preconditioning matrix aP -- is this not possible for nonlinear problems?2. I suspect the error above is because I have functions that depend on the solution, and I don’t know if that is acceptable in firedrake. I have something like the following:
u = Function(V)v = TestFunction(V)maximum = interpolate(0.5*(u + abs(u)), V)F = v*(u + maximum)*dx
Best wishes,
Anna.
--
_________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake