Skip to content

Add option to write restart logs to restart directory - #174

Open
dpsarmie wants to merge 2 commits into
NOAA-EMC:emc/developfrom
dpsarmie:feature/logging_to_outputdir
Open

Add option to write restart logs to restart directory#174
dpsarmie wants to merge 2 commits into
NOAA-EMC:emc/developfrom
dpsarmie:feature/logging_to_outputdir

Conversation

@dpsarmie

Copy link
Copy Markdown
Collaborator

Description of changes

There was a feature request made by NCO for GFSv17 production to have the logs moved to the restart folder for each component. This change was made for production (#169), however the production changes had no way to allow the user to turn the feature on or off. This PR will add a new option to ufs.configure that will allow the user to specify whether or not they want the logs to be written to the CMEPS restart directory or the run directory. The default (if the option is not declared) will be to have the logs in the run directory.

Specific notes

Contributors other than yourself, if any:

CMEPS Issues Fixed (include github issue #):

Are changes expected to change answers? (specify if bfb, different at roundoff, more substantial)
No changes expected
Any User Interface Changes (namelist or namelist defaults changes)?
Yes, a new option will be added to ufs.configure

Testing performed

Please describe the tests along with the target model and machine(s)
If possible, please also added hashes that were used in the testing
A full RT run will be performed and the option will be turned on for a select set of tests.

@DeniseWorthen

Copy link
Copy Markdown
Collaborator

I'm not sure this is the correct fix. What exactly is "the restart log" in this case?

@dpsarmie

dpsarmie commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

I didn't know what the correct naming is, but it's the log.cmeps.fHHHH files that are written in the run directories.

@DeniseWorthen

Copy link
Copy Markdown
Collaborator

It seems like this is getting changed in all the components, so I'll keep the conversation here rather than scattered. Was the request to put only logs in a special named directory, or that the logs would be the same place that the output was going?

isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if(isPresent .and. isSet) log_to_restart=(trim(value)=="true")

@DeniseWorthen DeniseWorthen Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMEPS provides an optional output dir

    if (maintask) then
       call NUOPC_CompAttributeGet(gcomp, name="diro", value=diro, isPresent=isPresent, isSet=isSet, rc=rc)
       if (chkerr(rc,__LINE__,u_FILE_u)) return
       if (.not. isPresent .and. .not. isSet) then
          diro = './'
       end if

I think this makes more sense than grabbing a logical and then if true you do one thing, otherwise something else. Set a config variable like "logdir"; CESM will never have that config variable present, and we (optionally) might not; if it is present, then it uses it, otherwise it will be output to cwd.

@dpsarmie

Copy link
Copy Markdown
Collaborator Author

It seems like this is getting changed in all the components, so I'll keep the conversation here rather than scattered. Was the request to put only logs in a special named directory, or that the logs would be the same place that the output was going?

Yes, the components are set up in a similar way so we can just chat in here.

The request was for the log.component.fHHHH to go into their respective directories:
log.cmeps.fHHHH --> CMEPS_RESTART
log.ice.fHHHH --> CICE_OUTPUT or history
mom6.res, mom6.lstop, mom6.f06 --> MOM6_OUTPUT

I do like your idea of bypassing the logical and just setting the logdir directly.

Setting the logdir as allocatable was just to allow it to be passed as a blank into log_restart_fh without triggering any warnings or errors, but just grabbing the value for logdir from the config and setting it to the cwd if the option is not defined will clean that all up.

@DeniseWorthen

Copy link
Copy Markdown
Collaborator

CMEPS already reads a "diro" configuration variable. I think you should be able to use that combined w/ the optional arugment to the restart_fh file.

This will also write the main mediator.log file into that directory though. Hopefully that isn't a problem.

@DeniseWorthen

DeniseWorthen commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

For MOM6, I'm about to start creating a PR for the first part of the refactor. I'm moving configuration of the MOM6 outputlog feature from ufs.configure to input.nml. The new feature will obtain the directory specified for MOM6-output and restarts directly from MOM6, and use that for the output log logging, so we should not need to specify it.

@dpsarmie

Copy link
Copy Markdown
Collaborator Author

Ok, the CMEPS change shouldn't be a problem. I can also wait for the MOM6 refactor since this change isn't urgent. Thanks for the input!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants