From e3fdfa79e3551f6bc552465a1ba09529361b73ee Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 4 Jan 2012 17:20:33 -0800 Subject: [PATCH] added hdf5 link and output a sample file --- src/Makefile | 5 ++++- src/cmfd_execute.F90 | 5 ++++- src/cmfd_utils.F90 | 26 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index d1a28a27a1..addfaa4fb3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,6 +20,7 @@ DEBUG = no PROFILE = no OPTIMIZE = no USE_MPI = no +USE_HDF5 = yes #=============================================================================== # Intel Fortran compiler options @@ -79,10 +80,12 @@ endif # use petsc compiler ifeq ($(COMPILER),petsc) F90 = ${FLINKER} - F90FLAGS := -cpp -ffree-form -I ${PETSC_DIR}/include + F90FLAGS := -cpp -ffree-form -I${PETSC_DIR}/include include ${PETSC_DIR}/conf/variables include ${PETSC_DIR}/conf/rules LDFLAGS = ${PETSC_SYS_LIB} + F90FLAGS += -I${HDF5_PREFIX}/include + LDFLAGS += -L${HDF5_PREFIX}/lib ${HDF5_PREFIX}/lib/libhdf5hl_fortran.a ${HDF5_PREFIX}/lib/libhdf5_hl.a ${HDF5_PREFIX}/lib/libhdf5_fortran.a ${HDF5_PREFIX}/lib/libhdf5.a -lz -lrt -lm -Wl,-rpath -Wl,${HDF5_PREFIX}/lib endif #=============================================================================== diff --git a/src/cmfd_execute.F90 b/src/cmfd_execute.F90 index 435d823808..e0bbd01d19 100644 --- a/src/cmfd_execute.F90 +++ b/src/cmfd_execute.F90 @@ -1,7 +1,7 @@ module cmfd_execute use cmfd_utils, only: get_matrix_idx,neutron_balance,set_coremap, & - & get_reflector_albedo + & get_reflector_albedo,write_hdf5 use global use mesh, only: mesh_indices_to_bin use mesh_header, only: StructuredMesh @@ -50,6 +50,9 @@ contains write(107,*) cmfd % dtilde write(108,*) cmfd % dhat + ! write cmfd object to hdf5 file + call write_hdf5() + ! solve diffusion equation call cmfd_solver() diff --git a/src/cmfd_utils.F90 b/src/cmfd_utils.F90 index 743d7c61b8..536cccab7e 100644 --- a/src/cmfd_utils.F90 +++ b/src/cmfd_utils.F90 @@ -509,4 +509,30 @@ contains end function get_reflector_albedo +!=============================================================================== +! WRITE_HDF5 writes an hdf5 output file with the cmfd object for restarts +!=============================================================================== + + subroutine write_hdf5() + + use hdf5 ! This module contains all necessary modules + + character(LEN=8), parameter :: filename = "filef.h5" ! File name + integer(HID_T) :: file_id ! File identifier + integer :: error ! Error flag + +! Initialize FORTRAN interface. + call h5open_f (error) + + ! Create a new file using default properties. + call h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! Terminate access to the file. + call h5fclose_f(file_id, error) + +! Close FORTRAN interface. + call h5close_f(error) + + end subroutine write_hdf5 + end module cmfd_utils