@@ -553,6 +553,123 @@ using a ``parameters`` dict, accepting the following keys:
553
553
release.
554
554
* Domains may be visualized assuming periodicity.
555
555
556
+ .. _loading-parthenon-data :
557
+
558
+ Parthenon Data
559
+ --------------
560
+
561
+ Parthenon HDF5 data is supported and cared for by Forrest Glines and Philipp Grete.
562
+ The Parthenon framework is the basis for various downstream codes, e.g.,
563
+ `AthenaPK <https://github.com/parthenon-hpc-lab/athenapk >`_,
564
+ `Phoebus <https://github.com/lanl/phoebus >`_,
565
+ `KHARMA <https://github.com/AFD-Illinois/kharma >`_,
566
+ RIOT, and the
567
+ `parthenon-hydro <https://github.com/parthenon-hpc-lab/parthenon-hydro >`_ miniapp.
568
+ Support for these codes is handled through the common Parthenon frontend with
569
+ specifics described in the following.
570
+ Note that only AthenaPK data is currently automatically converted to the
571
+ standard fields known by yt.
572
+ For other codes, the raw data of the fields stored in the output file is accessible
573
+ and a conversion between those fields and yt standard fields needs to be done manually.
574
+
575
+ .. rubric :: Caveats
576
+
577
+ * Reading particle data from Parthenon output is currently not supported.
578
+ * Spherical and cylindrical coordinates only work for AthenaPK data.
579
+ * Only periodic boundary conditions are properly handled. Calculating quantities requiring
580
+ larger stencils (like derivatives) will be incorrect at mesh boundaries that are not periodic.
581
+
582
+ AthenaPK
583
+ ^^^^^^^^
584
+
585
+ Fluid data on uniform-grid, SMR, and AMR datasets in Cartesian coordinates are fully supported.
586
+
587
+ AthenaPK data may contain information on units in the output (when specified
588
+ via the ``<units> `` block in the input file when the simulation was originally run).
589
+ If that information is present, it will be used by yt.
590
+ Otherwise the default unit system will be the code unit
591
+ system with conversion of 1 ``code_length `` equalling 1 cm, and so on (given yt's default
592
+ cgs/"Gaussian" unit system). If you would like to provided different
593
+ conversions, you may supply conversions for length, time, and mass to ``load ``
594
+ using the ``units_override `` functionality:
595
+
596
+ .. code-block :: python
597
+
598
+ import yt
599
+
600
+ units_override = {
601
+ " length_unit" : (1.0 , " Mpc" ),
602
+ " time_unit" : (1.0 , " Myr" ),
603
+ " mass_unit" : (1.0e14 , " Msun" ),
604
+ }
605
+
606
+ ds = yt.load(" parthenon.restart.final.rhdf" , units_override = units_override)
607
+
608
+ This means that the yt fields, e.g. ``("gas","density") ``,
609
+ ``("gas","velocity_x") ``, ``("gas","magnetic_field_x") ``, will be in cgs units
610
+ (or whatever unit system was specified), but the AthenaPK fields, e.g.,
611
+ ``("parthenon","prim_density") ``, ``("parthenon","prim_velocity_1") ``,
612
+ ``("parthenon","prim_magnetic_field_1") ``, will be in code units.
613
+
614
+ The default normalization for various magnetic-related quantities such as
615
+ magnetic pressure, Alfven speed, etc., as well as the conversion between
616
+ magnetic code units and other units, is Gaussian/CGS, meaning that factors
617
+ of :math: `4 \pi ` or :math: `\sqrt {4 \pi }` will appear in these quantities, e.g.
618
+ :math: `p_B = B^2 /8 \pi `. To use the Lorentz-Heaviside normalization instead,
619
+ in which the factors of :math: `4 \pi ` are dropped (:math: `p_B = B^2 /2 ), for
620
+ example), set ``magnetic_normalization="lorentz_heaviside"`` in the call to
621
+ ``yt.load ``:
622
+
623
+ .. code-block :: python
624
+
625
+ ds = yt.load(
626
+ " parthenon.restart.final.rhdf" ,
627
+ units_override = units_override,
628
+ magnetic_normalization = " lorentz_heaviside" ,
629
+ )
630
+
631
+ Alternative values (i.e., overriding the default ones stored in the simulation
632
+ output) for the following simulation parameters may be specified
633
+ using a ``parameters `` dict, accepting the following keys:
634
+
635
+ * ``gamma ``: ratio of specific heats, Type: Float. If not specified,
636
+ :math: `\gamma = 5 /3 ` is assumed.
637
+ * ``mu ``: mean molecular weight, Type: Float. If not specified, :math: `\mu = 0.6 `
638
+ (for a fully ionized primordial plasma) is assumed.
639
+
640
+ Other Parthenon based codes
641
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
642
+
643
+ As mentioned above, a default conversion from code fields to yt fields (e.g.,
644
+ from a density field to ``("gas","density") ``) is currently not available --
645
+ though more specialized frontends may be added in the future.
646
+
647
+ All raw data of a Parthenon-based simulation output is available through
648
+ the ``("parthenon","NAME") `` fields where ``NAME `` varies between codes
649
+ and the respective code documentation should be consulted.
650
+
651
+ One option to manually convert those raw fields to the standard yt fields
652
+ is by adding derived fields, e.g., for the field named "``mass.density ``"
653
+ that is stored in cgs units on disk:
654
+
655
+ .. code-block :: python
656
+
657
+ from yt import derived_field
658
+
659
+
660
+ @derived_field (name = " density" , units = " g*cm**-3" , sampling_type = " cell" )
661
+ def _density (field , data ):
662
+ return data[(" parthenon" , " mass.density" )] * yt.units.g / yt.units.cm** 3
663
+
664
+ Moreover, an ideal equation of state is assumed with the following parameters,
665
+ which may be specified using a ``parameters `` dict, accepting the following keys:
666
+
667
+ * ``gamma ``: ratio of specific heats, Type: Float. If not specified,
668
+ :math: `\gamma = 5 /3 ` is assumed.
669
+ * ``mu ``: mean molecular weight, Type: Float. If not specified, :math: `\mu = 0.6 `
670
+ (for a fully ionized primordial plasma) is assumed.
671
+
672
+
556
673
.. _loading-orion-data :
557
674
558
675
AMReX / BoxLib Data
0 commit comments