[FLASH-USERS] output files: Getting started guide?

Leland Ellison lee at pacificfusion.energy
Fri Oct 6 14:05:51 EDT 2023


In lieu of a documentation referral, here's a minimal snippet that uses yt
to populate a dictionary with specified fields from a plt file. It makes
use of covering_grid which is helpful for AMR problems.

Apologies to the yt community for willfully ignoring all sorts of nice
built-in features for making these sorts of plots.

~~~~~~~~~~~~~~~~~~~~~

import yt
import matplotlib.pyplot  as plt

def get_yt_data_1d(filename):

    j_idx = 0
    k_idx = 0
    fields_list = ["r", "z", "dens", "pres", "temp"]

    data_yt = yt.load(filename)
    data_yt_map = data_yt.covering_grid(
        level=0, left_edge=[0, 0.0, 0.0], dims=data_yt.domain_dimensions
    )

    data_dict = {}
    for f in fields_list:
        data_dict[f] = data_yt_map[f][:,j_idx,k_idx]
    return data_dict

filename = 'flash_hdf5_plt_cnt_0001'

data_dict = get_yt_data_1d(filename)

plt.figure()

plt.plot(data_dict["r"], data_dict["dens"])
plt.xlabel('radius [cm]')
plt.ylabel('dens [g/cm^3]')
plt.tight_layout()
plt.show()

~~~~~~~~~~~~~~~~~~~~~~

Best,
Lee

On Fri, Oct 6, 2023 at 9:13 AM Blackman David <david.blackman at eli-beams.eu>
wrote:

> Actually to add to the previous question, is there any simple
> documentation on how to process these files? The flash documentation
> doesn't provide a particularly straightforward answer. The yt-project is a
> reasonable choice. I am planning to run a large quantity of flash
> simulations coupled with PIC simulations. For this purpose I would need to
> write some sort of automated script to generate a cartesian or cylindrical
> grid. The yt-project seems like a good place to start, but a simple
> understanding of how to reconstructed the flash grid into an array of
> co-ordinates of vertices would be helpful.
> ------------------------------
> *From:* flash-users <flash-users-bounces at flash.rochester.edu> on behalf
> of Leland Ellison <lee at pacificfusion.energy>
> *Sent:* 06 October 2023 17:42
> *To:* Ryan Farber <rjfarber at umich.edu>
> *Cc:* flash-users at flash.rochester.edu <flash-users at flash.rochester.edu>
> *Subject:* Re: [FLASH-USERS] output files: Getting started guide?
>
> Another good option for visualizing FLASH output is VisIt:
> https://visit-dav.github.io/visit-website/index.html
>
> One hiccup you might encounter is an error when attempting to open FLASH
> files using the default VisIt settings. You can remedy this with either:
> (i) In the Open File menu, look for the  "Open file as type" box and
> choose: FLASH (If this fails, try restarting VisIt. Once the above error
> happens it seems to perpetually fail even if you specify the file type.)
> (ii) If you're launching VisIt from the command line, add the
> argument: -assume_format FLASH
>
> Best,
> Lee
>
> On Fri, Oct 6, 2023 at 6:27 AM Ryan Farber <rjfarber at umich.edu> wrote:
>
> Hi Joe,
>
> 8x8 refers to the number of cells per block.
> The 53 probably refers to the number of blocks.
> Additional details might be in the FLASH user guide.
>
> I'd recommend just using yt. yt is for analysis as well as visualization.
>
> Best,
> --------
> Ryan
>
>
> On Thu, Oct 5, 2023 at 8:05 PM Joe Frisch <joseffrisch at google.com> wrote:
>
> Just getting started with FLASH just got the sedov code (with the default
> parameters) to run, trying to understand the output files.  For example
> there is a hdf5 output file sedov_hdf5_plt_cnt_0000
>
> That contains grid data in 'coordinates"  which has 53 x,y,z locations
>
> There is also "pres' (presumably pressure) , 'temp"
> (presumably temperature)  and desdata.
>
> Those objects are 4-dimensional:   [53,1,8,8]
> where is that defined / described?
> The 53 presumably maps onto the 53 plot coordinates.  But 8X8??  Those
> seem to be either initial or final state, but not in a pattern I can
> decypher
>
> Is the plot file format , or more specifically the fields in the plot file
> defined somewhere?
>
> Maybe this is the wrong approach and I should just use yt?   does yt
> provide access to all the data for analysis or is it just a plotting tool?
>
>
>
>
> _______________________________________________
> flash-users mailing list
> flash-users at flash.rochester.edu
>
> For list info, including unsubscribe:
> https://flash.rochester.edu/mailman/listinfo/flash-users
>
> _______________________________________________
> flash-users mailing list
> flash-users at flash.rochester.edu
>
> For list info, including unsubscribe:
> https://flash.rochester.edu/mailman/listinfo/flash-users
>
> _______________________________________________
> flash-users mailing list
> flash-users at flash.rochester.edu
>
> For list info, including unsubscribe:
> https://flash.rochester.edu/mailman/listinfo/flash-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20231006/e5b9c867/attachment-0001.htm>


More information about the flash-users mailing list