Skip to content

Commit

Permalink
Updated restart saving when coupled with SWMF
Browse files Browse the repository at this point in the history
Replaced the PathRestartOut parameter with a variable that changes when
coupled with the framework so that restart files are saved in the
same place as they are for RCM.

This change allows the Restart.pl perl script from the SWMF to handle
RAM correctly, so there is no more need to copy files from restartOUT to
restartIN.
  • Loading branch information
Miles A. Engel authored and drsteve committed Oct 24, 2019
1 parent d041ba4 commit 4225cfd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ModRamMain.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module ModRamMain
!!!!! PATHS
! File paths for restarts
character(len=*), parameter :: PathRestartIn = 'IM/restartIN'
character(len=*), parameter :: PathRestartOut= 'IM/restartOUT'
character(len=999) :: PathRestartOut= 'IM/restartOUT'

! File paths to fix hardcoding of path issues.
character(len=*), parameter :: PathRAMOut = 'IM/output/ram/'
Expand Down
10 changes: 5 additions & 5 deletions src/ModRamRestart.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ subroutine write_restart
nZetaDim
integer, parameter :: iDeflate = 2, yDeflate = 1

character(len=200) :: NameFile
character(len=999) :: NameFile

character(len=*), parameter :: NameSub='write_restart'
logical :: DoTest, DoTestMe
Expand All @@ -59,9 +59,9 @@ subroutine write_restart

! Write ascii portion of restart.
if (TimedRestarts) then
NameFile=RamFileName(PathRestartOut//'/restart_info','txt',TimeRamNow)
NameFile=RamFileName(trim(PathRestartOut)//'/restart_info','txt',TimeRamNow)
else
NameFile=PathRestartOut//'/restart_info.txt'
NameFile=trim(PathRestartOut)//'/restart_info.txt'
endif
open(unit=UnitTMP_, file=trim(NameFile), status='replace')
write(UnitTMP_, *) 'TIMING:'
Expand All @@ -76,9 +76,9 @@ subroutine write_restart

! OPEN FILE
if (TimedRestarts) then
NameFile = RamFileName(PathRestartOut//'/restart','nc',TimeRamNow)
NameFile = RamFileName(trim(PathRestartOut)//'/restart','nc',TimeRamNow)
else
NameFile = PathRestartOut//'/restart.nc'
NameFile = trim(PathRestartOut)//'/restart.nc'
endif
iStatus = nf90_create(trim(NameFile), nf90_HDF5, iFileID)
call ncdf_check(iStatus, NameSub)
Expand Down
11 changes: 9 additions & 2 deletions srcInterface/IM_wrapper.f90
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,10 @@ end subroutine IM_finalize
!=============================================================================

subroutine IM_save_restart(TimeSimulation)


use CON_coupler, ONLY: NameRestartOutDirComp
use ModRamParams, ONLY: TimedRestarts
use ModRamMain, ONLY: PathRestartOut
use ModRamRestart, ONLY: write_restart

implicit none
Expand All @@ -751,7 +754,11 @@ subroutine IM_save_restart(TimeSimulation)
real, intent(in) :: TimeSimulation ! seconds from start time
character(len=*), parameter :: NameSub='IM_save_restart'
!---------------------------------------------------------------------------


if (NameRestartOutDirComp /= '') then
PathRestartOut = NameRestartOutDirComp
TimedRestarts = .false.
endif
call write_restart

end subroutine IM_save_restart
Expand Down

0 comments on commit 4225cfd

Please sign in to comment.