From 0f7b7144a22bbb8b4c40b2234d76d5e5f5b6e6ef Mon Sep 17 00:00:00 2001 From: Daniel Sarmiento Date: Tue, 30 Jun 2026 15:03:40 +0000 Subject: [PATCH 1/3] Initial logging changes --- config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 b/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 index ef62ac0cda..00ca525641 100644 --- a/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 @@ -348,7 +348,7 @@ subroutine outputlog_run(mclock, atStopTime, rc) olog(n)%time_lastrestart = lastrestart if (is_root_pe()) then call log_restart_fh(currTime-olog(n)%fhoffset, startTime, 'mom6.'//chour, prefixtime=.true., & - lastrestart=olog(n)%time_lastrestart, lastoutput=olog(n)%filename, rc=rc) + lastrestart=olog(n)%time_lastrestart, lastoutput=olog(n)%filename, output_dir=outputdir, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif endif @@ -375,7 +375,7 @@ subroutine outputlog_run(mclock, atStopTime, rc) olog(n)%time_lastrestart = lastrestart if (is_root_pe()) then call log_restart_fh(prevring, startTime, 'mom6.lstop.'//chour, prefixtime=.true., & - lastrestart=olog(n)%time_lastrestart, lastoutput=olog(n)%filename, rc=rc) + lastrestart=olog(n)%time_lastrestart, lastoutput=olog(n)%filename, output_dir=outputdir, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif endif @@ -462,7 +462,7 @@ subroutine outputlog_restart(mclock, num_rest_files, rc) if (all(allDone) .eqv. .true.) then lastrestart = nextTime if (is_root_pe()) then - call log_restart_fh(nextTime, startTime, 'mom6.res', prefixtime=.true., rc=rc) + call log_restart_fh(nextTime, startTime, 'mom6.res', prefixtime=.true., output_dir=outputdir, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif endif From d3155a7b2dd711597d120c002301d3721cd107e4 Mon Sep 17 00:00:00 2001 From: Daniel Sarmiento Date: Tue, 30 Jun 2026 16:51:33 +0000 Subject: [PATCH 2/3] Add user option --- config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 b/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 index 00ca525641..b5b872486f 100644 --- a/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 @@ -114,7 +114,7 @@ end subroutine outputlog_restart integer :: toffset logical :: debug -logical :: existflag +logical :: existflag, log_to_output character(len=256) :: restartdir character(len=256) :: outputdir character(len=2) :: output_fh @@ -148,6 +148,12 @@ subroutine outputlog_init(gcomp, mclock, rc) call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + log_to_output = .false. + call NUOPC_CompAttributeGet(gcomp, name="mom6_write_log_to_output_dir", value=value, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) log_to_output=(trim(value)=="true") + call NUOPC_CompAttributeGet(gcomp, name="mom6_restart_dir", value=value, & isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From bb9b9b48b321c4e05764d5ea06311e595c6d1145 Mon Sep 17 00:00:00 2001 From: Daniel Sarmiento Date: Wed, 1 Jul 2026 13:13:17 +0000 Subject: [PATCH 3/3] Add user config option --- config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 b/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 index b5b872486f..1a8d6c1420 100644 --- a/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap_outputlog.F90 @@ -282,6 +282,7 @@ subroutine outputlog_run(mclock, atStopTime, rc) character(len=16) :: timestr character(len=256) :: fname character(len=256) :: subname='MOM_cap:(outputlog_run)' + character(len=256), allocatable :: logdir !---------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -302,6 +303,8 @@ subroutine outputlog_run(mclock, atStopTime, rc) fsize(1) = nf90_fill_int nlen(1) = nf90_fill_int + if (log_to_output) logdir=outputdir + do n = 1,n_freq write(chour,'(I2.2,A)')freq(n),'h' if (chour(1:2) == output_fh(1:2)) then @@ -354,7 +357,7 @@ subroutine outputlog_run(mclock, atStopTime, rc) olog(n)%time_lastrestart = lastrestart if (is_root_pe()) then call log_restart_fh(currTime-olog(n)%fhoffset, startTime, 'mom6.'//chour, prefixtime=.true., & - lastrestart=olog(n)%time_lastrestart, lastoutput=olog(n)%filename, output_dir=outputdir, rc=rc) + lastrestart=olog(n)%time_lastrestart, lastoutput=olog(n)%filename, output_dir=logdir, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif endif @@ -381,7 +384,7 @@ subroutine outputlog_run(mclock, atStopTime, rc) olog(n)%time_lastrestart = lastrestart if (is_root_pe()) then call log_restart_fh(prevring, startTime, 'mom6.lstop.'//chour, prefixtime=.true., & - lastrestart=olog(n)%time_lastrestart, lastoutput=olog(n)%filename, output_dir=outputdir, rc=rc) + lastrestart=olog(n)%time_lastrestart, lastoutput=olog(n)%filename, output_dir=logdir, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif endif @@ -413,6 +416,7 @@ subroutine outputlog_restart(mclock, num_rest_files, rc) logical, allocatable :: allDone(:) character(len=8) :: suffix character(len=256) :: subname='MOM_cap:(outputlog_restart)' + character(len=256), allocatable :: logdir !---------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -431,6 +435,8 @@ subroutine outputlog_restart(mclock, num_rest_files, rc) allocate(allDone(1:num_rest_files)) allDone = .false. + if (log_to_output) logdir=outputdir + do n = 1,num_rest_files if (n == 1) then suffix = '' @@ -468,7 +474,7 @@ subroutine outputlog_restart(mclock, num_rest_files, rc) if (all(allDone) .eqv. .true.) then lastrestart = nextTime if (is_root_pe()) then - call log_restart_fh(nextTime, startTime, 'mom6.res', prefixtime=.true., output_dir=outputdir, rc=rc) + call log_restart_fh(nextTime, startTime, 'mom6.res', prefixtime=.true., output_dir=logdir, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif endif