Menu

Two implementations of Euler time stepping but slightly different solutions

2017-04-06
2017-04-06
  • Sander Rhebergen

    Hi,
    I slightly modified the timeDG-skeleton.py example and implemented the theta-method (and a slightly different convection vector). As a check, I took theta=0 so that my implementation is again an Euler method. I now compare the norm of the final solution of my code with the norm of the final solution of the timeDG-skeleton.py code. In my code: 24.5994557645812. In the timeDG-skeleton.py code: 25.21957468067155. I was wondering if this has to do with the solvers: I'm using Inverse instead of SolveM and I'm not sure if these are direct solvers of iterative solvers with some tolerance?

     
  • Sander Rhebergen

    Attached the slightly modified timeDG-skeleton.py code

     
  • Sander Rhebergen

    And my implementation of the theta-method.
    thanks,
    Sander

     
  • Joachim Schoeberl

    Hi Sander,

    the difference comes from numerical integration. Split the BFI (uv + b u grad(v)) into two seperate ones, and you get the same result.
    NGSolve proposes to use the integration order of order(Trial) + order(Test), and reduces by the order of the differential operator (on simplicial elements).
    So, on the space of order 4, it uses intorder=8 for uv, but only intorder=7 for u grad(v).
    If you combine terms, it uses the maximal order for both.

    Here you find how to use your own integration-rule:
    https://ngsolve.org/news/new-features/3-specify-integrationrule
    or select a predefined via IntegrationRule(TRIG,10)

    Joachim

     
  • Sander Rhebergen

    Thanks - I indeed now get the same!
    Sander

     

Anonymous
Anonymous

Add attachments
Cancel