Re: [firedrake] close to fixing my nonlinear QG solver
It's a classic gotcha. We are kind of stuck with it due to wanting to stay close to the Fenics interface, but maybe we should have a specific bit in the docs about it [or a more highlighted one, if it already exists]. all the best --cjc On 30 March 2017 at 12:57, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Houston, we have convergence!
Thank you for the help Lawrence.
I did see there were emails about the split passed around last week, which I clearly should have read more closely.
Now that I have convergence on a course grid I will test a finder grid and let you know how robust this is.
Cheers, Francis
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637
________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Lawrence Mitchell [lawrence.mitchell@imperial.ac.uk] Sent: Thursday, March 30, 2017 7:14 AM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] close to fixing my nonlinear QG solver
Hi Francis,
sorry, I now saw your problem.
You do:
soln1.assign(soln0)
psi1, u1, q1 = soln1.split()
Gnon = F(psi1, u1, q1)
You've been bitten by the "wrong split" bug!! ARGH.
Only use function.split() for output. If you're going to use the split values in a form, you need to use "split(function)"
If you replace your lines:
psi1, u1, q1 = soln1.split() Gnon = ...
with:
psi1, u1, q1 = split(soln1) Gnon = ... psi1, u1, q1 = soln1.split()
Everything works.
Lawrence
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916
I am sorry that I didn't follow the emails more closely last week. I could have saved myself, and everyone, some time for debugging. When trying things out I did try help(split), thinking maybe that was the problem. What I found is copied below. It is, let's say, terse. I agree with Colin, if someone could insert something on the docs spelling out the difference that could be very helpful for other people who might very well come across the same issue. Cheers, Francis P.S. I will go back and reread old emails to understand why this is the correct syntax. Help on function split in module ufl.split_functions: split(v) UFL operator: If v is a Coefficient or Argument in a mixed space, returns a tuple with the function components corresponding to the subelements. ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Colin Cotter [colin.cotter@imperial.ac.uk] Sent: Thursday, March 30, 2017 7:59 AM To: firedrake Subject: Re: [firedrake] close to fixing my nonlinear QG solver It's a classic gotcha. We are kind of stuck with it due to wanting to stay close to the Fenics interface, but maybe we should have a specific bit in the docs about it [or a more highlighted one, if it already exists]. all the best --cjc On 30 March 2017 at 12:57, Francis Poulin <fpoulin@uwaterloo.ca<mailto:fpoulin@uwaterloo.ca>> wrote: Houston, we have convergence! Thank you for the help Lawrence. I did see there were emails about the split passed around last week, which I clearly should have read more closely. Now that I have convergence on a course grid I will test a finder grid and let you know how robust this is. Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca<mailto:fpoulin@uwaterloo.ca> Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637<tel:%2B1%20519%20888%204567%20x32637> ________________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> [firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>] on behalf of Lawrence Mitchell [lawrence.mitchell@imperial.ac.uk<mailto:lawrence.mitchell@imperial.ac.uk>] Sent: Thursday, March 30, 2017 7:14 AM To: firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> Subject: Re: [firedrake] close to fixing my nonlinear QG solver Hi Francis, sorry, I now saw your problem. You do: soln1.assign(soln0) psi1, u1, q1 = soln1.split() Gnon = F(psi1, u1, q1) You've been bitten by the "wrong split" bug!! ARGH. Only use function.split() for output. If you're going to use the split values in a form, you need to use "split(function)" If you replace your lines: psi1, u1, q1 = soln1.split() Gnon = ... with: psi1, u1, q1 = split(soln1) Gnon = ... psi1, u1, q1 = soln1.split() Everything works. Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake -- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916<http://www.cambridge.org/9781107663916> [http://assets.cambridge.org/97811076/63916/cover/9781107663916.jpg]
participants (2)
- 
                
                Colin Cotter
- 
                
                Francis Poulin