[FLASH-USERS] Output files

Ryan Farber rjfarber at umich.edu
Mon May 18 12:12:04 EDT 2020


Just a quick follow up on Marissa's terrific explanation which briefly
mentioned handling HDF5 outputs using VisIt, IDL, python, etc: I personally
recommend the python package yt. It makes processing FLASH simulations as
easy as

1) import yt
2) ds = yt.load("YOUR_HDF5_FILE")
3) ad = ds.all_data() # or subset of data if you prefer, many options
available
https://yt-project.org/

Best,
--------
Ryan


On Mon, May 18, 2020 at 9:16 AM Marissa B. P. Adams <
marissa at flash.uchicago.edu> wrote:

> If you would like output information for each time step, you can use the
> routine Simulation_adjustEvolution.F90.
>
> If you open any old Simulation_adjustEvolution.F90 from an object
> directory you will find that it is effectively empty. The routine takes in
> the number of blocks as an integer, the block list, current cycle number,
> time step, and current simulation time. From that you can tell that the
> purpose of this routine is to acquire or change block information for each
> time step, hence its name.
>
> Assuming your routine is empty, you may want to do the following:
>
> 1. Loop through the number of blocks.
>
> 2. Call Grid_getBlkIndexLimits, Grid_getCellCoords, Grid_getBlkPtr, and
> Grid_getDeltas. Some of these are crucial (Grid_getBlkIndexLimits,
> Grid_getBlkPtr) if you want to a access the blkPtr, or, as Ryan said, the
> UNK. The other routines are helpful if you would like to a access the
> coordinates and their differences, in the case that you may want to preform
> an integration. If you want to get the coordinates make sure you allocate,
> initialize the arrays, and then deallocate after the step (3) series of
> loops.
> 3. Then you will want to loop over all three block limits for each i, j,k
> direction.
>
> 4. After this third step you can then assign your UNK to variables and
> preform calculations that may be grid based, or require special
> calculations.
>
> 5. Don’t forget to close the four essential loops, and deallocate
> allocated arrays, etc.
>
>
> You can find examples of what I have just described in various parts of
> the code. I tried to provide the “shape” of the code, which can be helpful,
> in the formatting. If you want to create new UNK variables make sure you
> follow the appropriate procedure to do so… edit the configuration file,
> initialize it, etc. You can then access it in whatever routine.
>
> Around this whole operation you could then preform the standard methods of
> file I/O or whatever you please, or within it. Whether it is a .*dat*
> file or a .*txt* file, whatever you want.
>
> If you’re looking to access *all* block to cell information for each UNK
> though I would really recommend just sticking to HDF5, using VisIt, IDL, or
> python’s associated libraries…. Honestly the idea of any other format gives
> me nightmares for post processing purposes… and ASCII file for each output
> dump would probably eat your storage alive.
>
> I know that Flash also has chombo capabilities but I am pretty certain
> that part of the code is not maintained well.
>
> %———————————————————%
> Marissa B. P. Adams
> (she/her/hers)
> Phd Candidate, University of Rochester
> *E-mail:* madams at pas.rochester.edu
> *Website:* https://www.pas.rochester.edu/~madams
> <http://www.pas.rochester.edu/~madams>
> *Twitter:* https://twitter.com/mbpadams
> *Current Location:*
> My 400 sq. ft studio apartment
> 371 Bausch and Lomb Hall
> University of Rochester
> Rochester, NY 14627
>
> On May 17, 2020, at 18:43, Ryan Farber <rjfarber at umich.edu> wrote:
>
> Hi Petr,
>
> While I have not modified the dat file before, note that it should be easy
> to write to stdout.
> For example, if you're debugging and want to know the minimum and maximum
> density before your code crashes you can do
> ==========
> !! some flash file
> use physicaldata, ONLY : unk
> use Driver_data, ONLY : dr_globalMe ! or you can use pt_globalMe if you're
> in a Particle file and want to stay modular for example
>
> if (dr_globalMe == MASTER_PE) then
>   write(*,*) "max dens: ", maxval(unk(DENS_VAR,:,:,:,:)) ! unk has indices
> to variables, i, j, k, blocks
>   write(*,*) "min dens: ", minval(unk(DENS_VAR,:,:,:,:))
> endif
> =========
> Note that it's probably safer (especially for getting the minimum values,
> I don't remember if the above will just yield zero) to loop over list of
> blocks to find the maximum, minimum. Or do an MPI_ALLREDUCE. Many options :)
>
> Best,
> --------
> Ryan
>
>
> On Sun, May 17, 2020 at 2:04 AM petrk <petrk at physics.muni.cz> wrote:
>
>> Hello users,
>>
>> Is there any possibility to write output data (for example for some
>> particular quantities - density, pressure, etc.) explicitly to the ordinary
>> .dat file and not to hdf?
>>
>> Thanks a lot,
>>
>> Petr
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20200518/480a419f/attachment-0001.htm>


More information about the flash-users mailing list