Skip to content

Commit

Permalink
adding option to split io files monthly. useful for large meshes and …
Browse files Browse the repository at this point in the history
…high output freq
  • Loading branch information
JanStreffing committed Jul 31, 2023
1 parent 2c049ce commit d9dfcff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/gen_modules_clock.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module g_clock
integer :: ndpyr !number of days in yearnew
integer :: num_day_in_month(0:1,12)
character(4) :: cyearold, cyearnew !year as character string
character(2) :: cmonth !month as character string
data num_day_in_month(0,:) /31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/
data num_day_in_month(1,:) /31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/

Expand Down Expand Up @@ -55,6 +56,7 @@ subroutine clock
aux2=aux1+num_day_in_month(fleapyear,i)
if(daynew>aux1 .and. daynew<=aux2) then
month=i
write(cmonth, '(I2.2)') month
day_in_month=daynew-aux1
exit
end if
Expand Down
12 changes: 9 additions & 3 deletions src/io_meandata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module io_MEANDATA
logical, save :: vec_autorotate=.FALSE.
logical, save :: lnextGEMS=.FALSE.
integer, save :: nlev_upper=1
character(len=1), save :: filesplit_freq='y'
type io_entry
CHARACTER(len=15) :: id ='unknown '
INTEGER :: freq =0
Expand Down Expand Up @@ -134,7 +135,7 @@ subroutine ini_mean_io(ice, dynamics, tracers, partit, mesh)
type(t_tracer), intent(in) , target :: tracers
type(t_dyn) , intent(in) , target :: dynamics
type(t_ice) , intent(in) , target :: ice
namelist /nml_general / io_listsize, vec_autorotate, lnextGEMS, nlev_upper
namelist /nml_general / io_listsize, vec_autorotate, lnextGEMS, nlev_upper, filesplit_freq
namelist /nml_list / io_list

#include "associate_part_def.h"
Expand Down Expand Up @@ -826,6 +827,7 @@ subroutine create_new_file(entry, ice, dynamics, partit, mesh)
if (partit%mype/=entry%root_rank) return
! create an ocean output file
write(*,*) 'initializing I/O file for ', trim(entry%name)
write(*,*) 'filename will be ', trim(entry%filename)

!___________________________________________________________________________
! Create file
Expand Down Expand Up @@ -1200,8 +1202,12 @@ subroutine output(istep, ice, dynamics, tracers, partit, mesh)
entry%thread_running = .false.

! define filepath
filepath = trim(ResultPath)//trim(entry%name)//'.'//trim(runid)//'.'//cyearnew//'.nc'

if (filesplit_freq=='m') then
filepath = trim(ResultPath)//trim(entry%name)//'.'//trim(runid)//'.'//cyearnew//'_'//cmonth//'.nc'
else
filepath = trim(ResultPath)//trim(entry%name)//'.'//trim(runid)//'.'//cyearnew//'.nc'
endif

!___________________________________________________________________
! only root rank task does output
if(partit%mype == entry%root_rank) then
Expand Down

0 comments on commit d9dfcff

Please sign in to comment.