nonlinear diffusion with space-time Robin condition
Dear Firedrakers, (i) Will & I tried to build a theta-time-step solver including Crank-Nicolson for theta=1/2 but only get it to work for theta=0 (Forward Euler); see the attached code at "HERE2" which matches (32) in the attached pdf. [This is really a test set-up atm for a larger question on dynamic boundary conditions for an elliptic problem, but the system may be amusing by itself as a tentative FD-example.) (ii) The working explicit Forward Euler code for theta=0 is very slow, at least 10x slower than the same algorithm in a FEM matlab code (-). See "HERE1" in the attached code; why is the code so slow? [I have also attached the basic matlab code.] This example may be amusing because of the space-time Robin condition (14) applied to (11), leading to the Firedrake weak form (32) --when time is discretised as well. The question can also be solved, slightly differently wrt the implementation of the Robin boundary condition, using finite differences, which makes for an amusing comparison. I am not even sure whether this space-time bc and nonlinear diffusion eqn is well-posed but the finite difference and FEM numerics seems to be consistent. Thank you and best wishes, Onno
On 13/05/18 13:15, Onno Bokhove wrote:
Dear Firedrakers,
(i) Will & I tried to build a theta-time-step solver including Crank-Nicolson for theta=1/2 but only get it to work for theta=0 (Forward Euler); see the attached code at "HERE2" which matches (32) in the attached pdf.
[This is really a test set-up atm for a larger question on dynamic boundary conditions for an elliptic problem, but the system may be amusing by itself as a tentative FD-example.)
(ii) The working explicit Forward Euler code for theta=0 is very slow, at least 10x slower than the same algorithm in a FEM matlab code (-). See "HERE1" in the attached code; why is the code so slow?
Your mesh is tiny (20 cells in a 1D mesh) and you're asking it to do half a million timesteps. Firedrake is never going to be performant on such tiny problems, simply because the one-off costs per solve, the setup costs that need to happen independent of the problem size are too high. These costs should become negligible for decent problem sizes. Regardless, you can probably make it a lot faster by using a LinearProblem and LinearSolver instead of separate solve() calls. Cheers Stephan
[I have also attached the basic matlab code.]
This example may be amusing because of the space-time Robin condition (14) applied to (11), leading to the Firedrake weak form (32) --when time is discretised as well. The question can also be solved, slightly differently wrt the implementation of the Robin boundary condition, using finite differences, which makes for an amusing comparison.
I am not even sure whether this space-time bc and nonlinear diffusion eqn is well-posed but the finite difference and FEM numerics seems to be consistent.
Thank you and best wishes,
Onno
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
participants (2)
- 
                
                Onno Bokhove
- 
                
                Stephan Kramer