Re: [firedrake] Inconsistency between bilinear and residual solve
Dear Fryderyk, The usual advice here would be to build a "minimal failing example". 1) Can you reproduce the error on a 2x2 UnitSquareMesh? Then use that, not 100x100. 2) Run *one* timestep (no need for 100) and verify that the solutions are different (e.g. calculate some diagnostic). You should probably calculate that diagnostic on the initial conditions too, in case they weren't the same... 3) Forget about the full Navier--Stokes + Cahn--Hilliard problem. Throw away everything except one term on each side of the equation. Do 2). If the diagnostics were the same, add a term back in. Etc. Andrew On 2 May 2016 at 10:09, Fryderyk Wilczynski <scfw@leeds.ac.uk> wrote:
Update:
In the residual form case I tried:
try: solve(F(u,u0,u,u0,W,n,myparameters) == 0, u, bcs=[bc0, bc1, bc2, bc3],solver_parameters={'pc_type': 'lu', 'pc_factor_mat_solver_package': 'mumps'} ) # except RuntimeError: pass
that works in the sense that the exception is no longer a problem. However that slight inconsistency in results is still there. Is that to be expected because of the different solvers? If that is the case, how can one minimise that difference?
Thanks,
Fryderyk ------------------------------ *From:* firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Fryderyk Wilczynski <scfw@leeds.ac.uk> *Sent:* 02 May 2016 09:44:16 *To:* firedrake@imperial.ac.uk *Subject:* [firedrake] Inconsistency between bilinear and residual solve
Hello all,
I'm solving a system of pdes that are linear in (n+1) terms (in time disretised system).
When I write the equations in Firedrake as a bilinear form and solve using:
...
solve(a == L, out_u, bcs=[bc0, bc1, bc2, bc3], solver_parameters={'pc_type': 'lu', 'pc_factor_mat_solver_package': 'mumps'})
I get a stable (energy dissipative) scheme, everything seems to be working fine.
If I reformulate the equations so that I am solving the residual form:
...
solve(F == 0, u, bcs=[bc0, bc1, bc2, bc3],solver_parameters={'pc_type': 'lu', 'pc_factor_mat_solver_package': 'mumps'} )
all other things remainimg equal; the scheme breaks down after a number of timesteps, and throws an exception:
Traceback (most recent call last): File "NSCH_residual_form.py", line 149, in <module> solve(F(u,u0,u,u0,W,n,myparameters) == 0, u, bcs=[bc0, bc1, bc2, bc3],solver_parameters={'pc_type': 'lu', 'pc_factor_mat_solver_package': 'mumps'} ) # File "/home/cserv1_a/apps/install/firedrake/2016-03-el7/firedrake/lib/python2.7/site-packages/firedrake/solving.py", line 120, in solve _solve_varproblem(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/2016-03-el7/firedrake/lib/python2.7/site-packages/firedrake/solving.py", line 164, in _solve_varproblem solver.solve() File "<decorator-gen-295>", line 2, in solve File "/home/cserv1_a/apps/install/firedrake/2016-03-el7/firedrake/lib/python2.7/site-packages/pyop2/profiling.py", line 203, in wrapper return f(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/2016-03-el7/firedrake/lib/python2.7/site-packages/firedrake/variational_solver.py", line 190, in solve solving_utils.check_snes_convergence(self.snes) File "/home/cserv1_a/apps/install/firedrake/2016-03-el7/firedrake/lib/python2.7/site-packages/firedrake/solving_utils.py", line 62, in check_snes_convergence %s""" % (snes.getIterationNumber(), msg)) RuntimeError: Nonlinear solve failed to converge after 17 nonlinear iterations. Reason: DIVERGED_LINE_SEARCH
Additionally, the results between the two methods are inconsistent (particularly the min, max ranges). What can I do to fix that?
The scripts and pdf containing weak forms can be found on bitbucket:
https://bitbucket.org/fryderyk216/navierstokes/src/9f0814f99fe23fa57ead87012...
Best wishes,
Fryderyk
participants (1)
-
Andrew McRae