NOAA-GFDL/MOM6

Question about derived parameters with log_param()

Closed this issue · 2 comments

There are a number of log_param() calls, mostly for derived parameters, never log these parameters anywhere by default. Subroutine log_param_*() only writes parameters to MOM_parameter_doc when description is given. Without descriptions, log_param() calls log parameters, along with all the other parameters, to stdout, but only when SEND_LOG_TO_STDOUT is True (default false).

I think it makes sense to ignore the derived parameters in MOM_parameter_doc, and I suspect this behavior is by design. I wonder if it would of any benefits to make this less opaque, maybe by simply editing the description of SEND_LOG_TO_STDOUT? Or adding another MOM_parameter_doc file for derived parameters?

A few examples:

call log_param(param_file, mdl, "GFS / G_EARTH", CS%GFS_scale, units="nondim")

call log_param(param_file, mdl, "M to THICKNESS", GV%m_to_H*H_rescale_factor, units="H m-1")
call log_param(param_file, mdl, "M to THICKNESS rescaled by 2^-n", GV%m_to_H, units="2^n H m-1")
call log_param(param_file, mdl, "THICKNESS to M rescaled by 2^n", GV%H_to_m, units="2^-n m H-1")

call log_param(param_file, mdl, "DTBT as used", CS%dtbt, units="s", unscale=US%T_to_s)
call log_param(param_file, mdl, "estimated maximum DTBT", CS%dtbt_max, units="s", unscale=US%T_to_s)

After thinking this over, it seems like the solution here is a more explicit description of what gets sent to the log file and stdout in the doxygen comments describing the log_to_stdout and log_open elements of the param_file_type in about lines 78-80 of MOM_file_parser.F90. Would you be willing to give this a try in a PR, @herrwang0 ?

The issue was raised as I did not find MOM parameters (both run-time and derivative) logged anywhere other than MOM_parameter_doc.

By design, MOM parameters are always logged in stdlog. If SEND_LOG_TO_STDOUT is true, they are also logged in stdout.

I reexamined my runs and found that the reason MOM parameters were not logged in stdlog was due to compiler inconsistency between my libfms.a and MOM6.

So, I think there is no need to make changes to the code. It may be helpful to document somewhere about the relationship between MOM_parameter_doc, stdlog and stdout, so that first time and unfamiliar users can be better informed.