trixi-framework / Trixi.jl

Trixi.jl: Adaptive high-order numerical simulations of conservation laws in Julia
https://trixi-framework.github.io/Trixi.jl
MIT License
535 stars 109 forks source link

Is there an issue with conservation for MHD? #78

Closed ranocha closed 4 years ago

ranocha commented 4 years ago

In GitLab by @sloede on Jun 4, 2020, 11:27

Using !61, it is now possible to calculate the conservation error for all conservative variables. These are the results I get for three of the current MHD tests:

examples/parameters_alfven_wave.toml

 Variable:       rho              rho_v1           rho_v2           rho_v3           rho_e            B1               B2               B3               psi           
 L2 error:       1.11345135e-04   5.88018891e-06   5.88018891e-06   8.43288100e-06   1.29423873e-06   1.22388203e-06   1.22388203e-06   1.83062175e-06   8.08699679e-07
 Linf error:     2.56327902e-04   1.63790212e-05   1.63790212e-05   2.58759953e-05   5.32773229e-06   8.11852027e-06   8.11852027e-06   1.21073548e-05   4.17370701e-06
 |∑U - ∑U₀|:     6.92779167e-14   1.43827628e-10   1.43827604e-10   1.53482370e-18   3.75544040e-12   3.57613938e-12   3.57724961e-12   6.47302578e-18   2.13382203e-10

Here, there is a maximum conservation error of O(1e-10) for momentum.

examples/parameters_rotor.toml

 Variable:       rho              rho_v1           rho_v2           rho_v3           rho_e            B1               B2               B3               psi           
 L2 error:       1.62501348e-01   4.87159543e-01   4.76056428e-01   0.00000000e+00   4.91663426e-01   6.91803585e-02   9.74842029e-02   0.00000000e+00   1.84150845e-02
 Linf error:     2.83748814e+00   5.51486221e+00   5.64570732e+00   0.00000000e+00   7.45649493e+00   1.00886830e+00   1.40554795e+00   0.00000000e+00   2.58441429e-01
 |∑U - ∑U₀|:     4.37427872e-14   4.75268708e-16   2.38043351e-14   0.00000000e+00   2.53478009e-02   1.46724333e-02   7.02282883e-04   0.00000000e+00   1.72847835e-16

Here, there is a maximum conservation error of O(1e-2) for the energy. Also, the simulation crashes after 30 time steps, so this is the result for 20 time steps.

examples/parameters_orszag_tang.toml

 Variable:       rho              rho_v1           rho_v2           rho_v3           rho_e            B1               B2               B3               psi           
 L2 error:       1.90465812e-01   2.52741867e-01   2.99463745e-01   0.00000000e+00   4.59355383e-01   2.13470686e-01   3.21902500e-01   0.00000000e+00   1.21434648e-02
 Linf error:     1.17180962e+00   6.37471708e-01   8.92528730e-01   0.00000000e+00   2.45711356e+00   6.52445348e-01   9.82985901e-01   0.00000000e+00   1.39030929e-01
 |∑U - ∑U₀|:     7.19424520e-14   9.79180081e-18   1.43203594e-16   0.00000000e+00   5.14316143e-03   1.43305931e-16   1.66633009e-17   0.00000000e+00   5.76494184e-05

Here, there is again a maximum conservation error of O(1e-3) for the energy (this time recorded after 100 time steps, since the simulation is too darn long).

I don't know if these conservation errors are expected or reasonable, it's just something I observed when testing the new conservation_error analysis quantity and I wondered if this is cool. What do you think, @andrewwinters5000 or @gregorgassner?

ranocha commented 4 years ago

In GitLab by @andrewwinters5000 on Jun 4, 2020, 11:47

The errors for Alfvén seem decent, although e-10 is not as good as I would think...

The OTV and rotor do not seem correct. My guess, because the "badness" is in the magnetic fields and total energy (total energy is influenced by magnetic and psi energies), is that either:

  1. we forgot to account for these other energies somewhere
  2. the shock capturing (which was designed for compressible Euler) is applied to ideal MHD and is doing something unpredictable
ranocha commented 4 years ago

In GitLab by @ranocha on Jun 4, 2020, 13:29

And you're using a (Powell-like) source term, aren't you? Won't these influence conservation?

ranocha commented 4 years ago

In GitLab by @andrewwinters5000 on Jun 4, 2020, 14:00

Jaha! I forgot about that. The Powell term is included as part of the divergence cleaning. This will have an influence on the conservation because it is, inherently, a non-conservative term

ranocha commented 4 years ago

In GitLab by @sloede on Jun 4, 2020, 14:19

OK, so this is a non-issue then? Feel free to close @andrewwinters5000 if you think all is well in the land of MHD!

ranocha commented 4 years ago

In GitLab by @ranocha on Jun 4, 2020, 14:22

all is well in the land of MHD

That's definitely something I wouldn't sign :wink:

ranocha commented 4 years ago

In GitLab by @andrewwinters5000 on Jun 4, 2020, 14:35

@sloede I can test this to make sure the Powell terms are spoiling the conservation. Stay tuned...

ranocha commented 4 years ago

In GitLab by @andrewwinters5000 on Jun 4, 2020, 14:57

Yes, it is the Powell term. I deactivated the non-conservative terms and the conservation errors are double precision.

Here is the final output for Alfvén wave: alfvén_errs

Here is the final output for OTV: otv_errs

I did not rerun the rotor because I expect it is the same.

ranocha commented 4 years ago

In GitLab by @andrewwinters5000 on Jun 4, 2020, 14:57

closed