Hello yt users, I'm trying to understand magnetic field units used in yt Since I found something that looks strange to me. As stated on the yt website, it uses cgs units just like FLASH. I'm sending the code bellow, and it does the following: 1) I use yt to trace a ortho ray 2) using that ray I get the magnetic field a gas pressure 3) from the magnetic fiedl I get the magnetic pressure 4) I add gas pressure and magnetic field pressure 5) The answer is wrong, and I don't know why The data file is here: http://use.yt/upload/a95035d4 The code is here: http://paste.yt-project.org/show/178/ Cheers,
Hi Guido,
I won't have time to look at this carefully for a little while, but one
easy thing to try might be to redo your analysis, but use a version of yt
built from source using the yt-4.0 branch. You'll need to clone the yt
repository, checkout the yt-4.0 branch, and build from source by doing
"python setup.py develop", after ensuring that numpy and cython are already
installed.
yt 4.0 will move from using yt.units to a new unit library based on
yt.units called unyt (github.com/yt-project/unyt). When we updated the
yt.units codebase to become unyt, there were some issues with magnetic
field units that were resolved and it's possible that you're hitting a bug
in yt.units and simply using yt-4.0 will fix this issue. Worth a try anyway!
If that doesn't help one of us will hopefully be able to look at this more
closely sometime soon.
-Nathan
On Thu, Nov 14, 2019 at 10:40 AM Guido Granda Muñoz
Hello yt users, I'm trying to understand magnetic field units used in yt Since I found something that looks strange to me. As stated on the yt website, it uses cgs units just like FLASH. I'm sending the code bellow, and it does the following: 1) I use yt to trace a ortho ray 2) using that ray I get the magnetic field a gas pressure 3) from the magnetic fiedl I get the magnetic pressure 4) I add gas pressure and magnetic field pressure 5) The answer is wrong, and I don't know why
The data file is here: http://use.yt/upload/a95035d4 The code is here: http://paste.yt-project.org/show/178/
Cheers, _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hello Nathan, Sorry for the late reply, I've just tried what you suggested (using yt-4.0) and I'm still getting the same results. I also noticed that while using the same code and comparing: ray[(''gas","magnetic_field_y")] with ray[("flash","magy")] you get different answers. ray[(''gas","magnetic_field_y")] = 3.5449077* ray[("flash","magy")] . But if yt units by default is using cgs units like FLASH this shouldn't happen , right? I don't know the yt code well enough to find the bug maybe you can give a hint and I can commit it. Cheers,
Hi Guido, FLASH does not store magnetic field units in strict “cgs” by default. Instead, it stores them in units such that the magnetic pressure = 0.5*B^2. So this is the units of “magy”, etc. But yt converts this to gauss with magnetic pressure = B^2/8*pi for the field “magnetic_field_y”. the problem is that FLASH has two different unit systems, one for most things but another for MHD. I would check the FLASH docs on this.
On Nov 27, 2019, at 7:24 PM, Guido Granda Muñoz
wrote: Hello Nathan, Sorry for the late reply, I've just tried what you suggested (using yt-4.0) and I'm still getting the same results. I also noticed that while using the same code and comparing: ray[(''gas","magnetic_field_y")] with ray[("flash","magy")] you get different answers. ray[(''gas","magnetic_field_y")] = 3.5449077* ray[("flash","magy")] . But if yt units by default is using cgs units like FLASH this shouldn't happen , right? I don't know the yt code well enough to find the bug maybe you can give a hint and I can commit it. Cheers, _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (3)
-
Guido Granda Muñoz
-
John ZuHone
-
Nathan