Skip to content

paulinchin/MGCHDF5

Repository files navigation

MGCHDF5

Fortran subroutines and MATLAB scripts to work with HDF5 MAGIC3D output. This README file is for parallel compressed version from MAGIC3Db1.10.4 version.

Current versions:

  1. MAGIC3Dc1.10.4 - parallel output/restart routines with compression working with HDF5 development branch for MAGIC3D2018b version which is compatible with CLAWPACK 5.5.0
  2. MAGIC3Db1.10.4 - parallel output/restart routines with compression working with HDF5 development branch for MAGIC3D2018b version which is compatible with CLAWPACK 5.5.0 (depreciated)
  3. MAGIC3D1.10.4 - parallel output/restart routines with compression working with HDF5 development branch which is compatible with CLAWPACK < 5.5.0 (depreciated)
  4. MAGIC2D - parallel output/restart routines for 2D version of MAGIC with compression working with HDF5 development branch which is compatible with CLAWPACK < 5.5.0

Important note:
Even though MAGIC3D2018b version uses new indexing (m,i,j,k), the output routines still saves data as (i,j,k,m) in order to be compatible with Matlab routines.

Fortran subroutines

  1. out3 (out3_mpi_h5.f90)
    Output full 3D domain of all q to hdf5 format file
    Output filename format: fort.qXXXX.h5

  1. out3h (out3_mpi_h5slicehor.f90)
    Output data only at altitudes of interest.
    Set next parameters in out3_mpi_h5slicehor.f90:
    numberofslices - set number of slices to output
    numslice - set cell number to output
    Output filename format: fort.qhXXXX.h5

  1. out3a (out3_mpi_h5sliceair.f90)
    Output data for the continuous range of altitudes (e.g. airglow output).
    Set next parameters in out3_mpi_h5slicehorr.f90:
    dimsf(3) - set number of slices to output
    k - set range of grids in "z" direction to output
    Output filename format: fort.qaXXXX.h5

  1. out3v (out3_mpi_h5slicever.f90)
    Output data only at altitudes of interest.
    Set next parameters in out3_mpi_h5slicever.f90:
    arraysize
    idarray
    Both parameters can be found using "calcsliceh5.m" script
    Output filename format: fort.qvXXXX.h5

  1. restart (restart3_mpi_hdf.f90)
    Subroutine to restart from needed frame. Note that output used to restart should be output from out3 (out3_mpi_h5.f90) routine

Notes:

  1. In order to use these functions please add them in clawez_mpi.f
  2. If several different outputs are needed (for example full output for every 1 min and slice for every 1 sec) use different conditions in claw3ez_mpi.f for if (iframenstepout .eq. n) then* (updated code with setting flags will be available soon).

Compilation

Compilation on Vega assumes changes in Makefile and used modules:

  1. Executable MAGIC should be compiled with next modules:

module load hdf5/intel-mpi/intel-compiler/1.10.4
module load intel/mpi/64/2018/1.163
module load intel/compiler/64/2018/18.0.1
Be sure to remove other compilers before compiling (module rm ......).

  1. Makefile change: Updated Makefile can be found in /MAGIC3D1.10.4 folder

NOTE
Be sure to compile new routines before running Makefile using:
h5pfc -O3 -xhost -ipo -pthread -c out3_mpi_h5.f90
h5pfc -O3 -xhost -ipo -pthread -c out3_mpi_h5slicehor.f90
h5pfc -O3 -xhost -ipo -pthread -c out3_mpi_h5slicever.f90
h5pfc -O3 -xhost -ipo -pthread -c out3_mpi_h5sliceair.f90
h5pfc -O3 -xhost -ipo -pthread -c restart3_mpi_hdf.f90
Because they are written for f90 and are compiled without all other .f routines

Matlab script

NOTE
There are 2 sets of Matlab scripts: MAGIC3Dc1.10.4 works with MATLABc1.10.4. MAGIC3Db1.10.4 and MAGIC3D1.10.4 work with MATLAB.

Matlab scripts can import the whole 3D domain (mx,my,mz,q) as it was done for earlier versions, however it may take a lot of time and resources, thus this function is depreciated. New functionality allows importing and working with only particular horizontal (in x or y) and horizontal slices.

Current scripts
1. calcsliceh5.m - calculates which threads should be output when out3ver output subroutine is used
2. readmagich5.m - main script to set parameters and run output routines
3. initialization.m - load MSIS profile and reads simulation parameters
4. slicing.m - contains function to retrieving data from h5 binary output files. Current version allows:
a. Retrieve vertical slice in x or y direction setting slice position in meters
b. Retrieve horizontal slice in z direction setting slice position in meters
c. Load full 3D domain of all variables
The script allows working with all types of outputs (out3, out3v, out3h, out3a)
The script allows retrieving only particular variables (in current version: 'u','v','w' (and their scaled values),'rhop','rhorp','doxp','dnit2p','dox2p','dox3p','dhydp','temp')
The script allows make and save plots and video output
5. plotting.m - this routine calculates needed variables, does or does not make plots
6. afterframeh5.m - to calculate and plot airglow (based on afterframe.m)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages