diff --git a/src/cmfd_output.F90 b/src/cmfd_output.F90 index cb93428b35..98dd0fb774 100644 --- a/src/cmfd_output.F90 +++ b/src/cmfd_output.F90 @@ -1,6 +1,6 @@ module cmfd_output -# ifdef PETSC +#ifdef PETSC ! This modules cleans up cmfd objects and echos the results @@ -38,10 +38,14 @@ contains subroutine write_neutron_balance() use cmfd_data, only: neutron_balance - use constants, only: CMFD_BALANCE + use constants, only: CMFD_BALANCE, MAX_FILE_LEN + + character(MAX_FILE_LEN) :: filename + + filename = trim(path_output) // 'neutron_balance.out' ! open file for output - open(unit=CMFD_BALANCE,file="neutron_balance.out") + open(UNIT=CMFD_BALANCE, FILE=filename, ACTION='write') ! write out the tally call neutron_balance(CMFD_BALANCE) @@ -51,6 +55,6 @@ contains end subroutine write_neutron_balance -# endif +#endif end module cmfd_output diff --git a/src/global.F90 b/src/global.F90 index 0327e0fd19..af20c135af 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -259,6 +259,7 @@ module global character(MAX_FILE_LEN) :: path_source = '' ! Path to binary source character(MAX_FILE_LEN) :: path_state_point ! Path to binary state point character(MAX_FILE_LEN) :: path_particle_restart ! Path to particle restart + character(MAX_FILE_LEN) :: path_output = '' ! Path to output directory ! Message used in message/warning/fatal_error character(MAX_LINE_LEN) :: message diff --git a/src/hdf5_interface.F90 b/src/hdf5_interface.F90 index 8189a56edf..2aa5653fe8 100644 --- a/src/hdf5_interface.F90 +++ b/src/hdf5_interface.F90 @@ -831,20 +831,22 @@ contains integer(HID_T) :: dspace ! identifier for dataspace integer(HID_T) :: dset ! identifier for dataset integer, allocatable :: temp_array(:) ! nuclide bin array + character(MAX_FILE_LEN) :: filename ! Path to state point type(c_ptr) :: f_ptr ! Pointer for h5dwrite type(TallyObject), pointer :: t => null() - path_state_point = 'statepoint.' // trim(to_str(current_batch)) // '.h5' + filename = trim(path_output) // 'statepoint.' // & + trim(to_str(current_batch)) // '.h5' ! Write message - message = "Creating HDF5 state point " // trim(path_state_point) // "..." + message = "Creating HDF5 state point " // trim(filename) // "..." call write_message(1) ! Only master process should continue from here if (.not. master) return ! Create a new state point file using default properties. - call h5fcreate_f(path_state_point, H5F_ACC_TRUNC_F, hdf5_state_point, & + call h5fcreate_f(filename, H5F_ACC_TRUNC_F, hdf5_state_point, & hdf5_err) ! Write revision number for state point file diff --git a/src/output.F90 b/src/output.F90 index 12d26ed559..0da1b5a951 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -1077,7 +1077,7 @@ contains type(TallyObject), pointer :: t => null() ! Create filename for log file - path = "summary.out" + path = trim(path_output) // "summary.out" ! Open log file for writing open(UNIT=UNIT_SUMMARY, FILE=path, STATUS='replace', ACTION='write') @@ -1177,7 +1177,7 @@ contains type(SAlphaBeta), pointer :: sab => null() ! Create filename for log file - path = "cross_sections.out" + path = trim(path_output) // "cross_sections.out" ! Open log file for writing open(UNIT=UNIT_XS, FILE=path, STATUS='replace', ACTION='write') @@ -1517,9 +1517,10 @@ contains ! Create filename for tally output if (run_mode == MODE_TALLIES) then - filename = "tallies." // trim(to_str(restart_batch)) // ".out" + filename = trim(path_output) // "tallies." // & + trim(to_str(restart_batch)) // ".out" else - filename = "tallies.out" + filename = trim(path_output) // "tallies.out" end if ! Open tally file for writing diff --git a/src/particle_restart_write.F90 b/src/particle_restart_write.F90 index 4720c9dd49..96cc587a6e 100644 --- a/src/particle_restart_write.F90 +++ b/src/particle_restart_write.F90 @@ -51,7 +51,7 @@ contains type(Bank), pointer :: src => null() ! set up file name - filename = 'particle_'//trim(to_str(rank))//'.h5' + filename = trim(path_output) // 'particle_'//trim(to_str(rank))//'.h5' ! create hdf5 file call h5fcreate_f(filename, H5F_ACC_TRUNC_F, hdf5_particle_file, hdf5_err) @@ -90,7 +90,7 @@ contains type(Bank), pointer :: src => null() ! set up file name - filename = 'particle_'//trim(to_str(rank))//'.binary' + filename = path_output // 'particle_'//trim(to_str(rank))//'.binary' ! create hdf5 file open(UNIT=UNIT_PARTICLE, FILE=filename, STATUS='replace', & diff --git a/src/state_point.F90 b/src/state_point.F90 index e75084c488..cf11676f28 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -51,13 +51,15 @@ contains #else integer :: j, k ! loop indices #endif + character(MAX_FILE_LEN) :: filename type(TallyObject), pointer :: t => null() ! Set filename for binary state point - path_state_point = 'statepoint.' // trim(to_str(current_batch)) // '.binary' + filename = trim(path_output) // 'statepoint.' // & + trim(to_str(current_batch)) // '.binary' ! Write message - message = "Creating state point " // trim(path_state_point) // "..." + message = "Creating state point " // trim(filename) // "..." call write_message(1) #ifdef MPI @@ -65,7 +67,7 @@ contains ! PARALLEL I/O USING MPI-2 ROUTINES ! Open binary source file for reading - call MPI_FILE_OPEN(MPI_COMM_WORLD, path_state_point, MPI_MODE_CREATE + & + call MPI_FILE_OPEN(MPI_COMM_WORLD, filename, MPI_MODE_CREATE + & MPI_MODE_WRONLY, MPI_INFO_NULL, fh, mpi_err) ! ========================================================================== @@ -158,7 +160,7 @@ contains #else ! Open binary state point file for writing - open(UNIT=UNIT_STATE, FILE=path_state_point, STATUS='replace', & + open(UNIT=UNIT_STATE, FILE=filename, STATUS='replace', & ACCESS='stream') ! Write revision number for state point file