Skip to content

Final MARBL modifications for CESM3#434

Draft
mnlevy1981 wants to merge 5 commits into
NCAR:dev/ncarfrom
mnlevy1981:final_CESM3_updates
Draft

Final MARBL modifications for CESM3#434
mnlevy1981 wants to merge 5 commits into
NCAR:dev/ncarfrom
mnlevy1981:final_CESM3_updates

Conversation

@mnlevy1981
Copy link
Copy Markdown
Collaborator

@mnlevy1981 mnlevy1981 commented May 21, 2026

This PR will eventually address all issues in https://github.com/NCAR/MOM6/milestone/6 but for now it

  1. Adds optional print_lev argument to print_marbl_log()

Fixes #432
Fixes #433

If optional print_lev argument is present and true, include "Level: k" when
printing (i,j) location.
@mnlevy1981 mnlevy1981 requested a review from klindsay28 May 21, 2026 22:52
@klindsay28
Copy link
Copy Markdown
Collaborator

According to an answer on Stack Overflow, it is not okay to write to an internal file, i.e., a character string, and include that string on the right-hand of write statement.

@mnlevy1981
Copy link
Copy Markdown
Collaborator Author

According to an answer on Stack Overflow, it is not okay to write to an internal file, i.e., a character string, and include that string on the right-hand of write statement.

bummer! I guess the options are to either have very similar write() statements in both branches of the if statement, write the string without the level number to a temporary string and then either copy it or write it + level information, or to use the // concatenate operator (which might not format the integer level number as nicely as write)

@klindsay28
Copy link
Copy Markdown
Collaborator

In my sandbox, my adhoc implementation had very similar write() statements in both branches of an if statement, but I think this is an invitation to trouble down the road if the format gets edited in one branch and and not the other. How about something like the following untested pseudocode, which might be what you're suggesting as your option 2:

if (print_lev_loc) then
  write(message_suffix, "(A,I0)") ', Level: ', tmp%ElementInd
else
  message_suffix = ''
endif
write(message_location, "(A,F8.3,A,F7.3,A,I0,A,I0,A,I0,A)") &
  ...
  trim(message_suffix)

This is cleaner than overloading log_message. Also, message_suffix only needs
to be O(10) characters (same with message_prefix), so I was made both variables
character(len=16) instead of 256
One of my most frequent typos is including a , between the write(_,_) and the
list of items to write. Unlike most cases, this was just a flat-out mistake and
not changing print*, -> write(_,_), which is how it usually gets introduced
shortened the message a little bit, changed presentation of level info
FE_BIOAVAIL_FRAC_OFFSET was still in the MARBL forcing control structure but
had been removed from MOM_input; it is back replacing a hard-coded "- 0.0134"
in the code. Also added a minimum dust ratio (9.903) and an offset for dust
ratio (replacing a hard-coded "- 5.5")
@mnlevy1981
Copy link
Copy Markdown
Collaborator Author

44a9940 fixes #433 (adding previously hard-coded variables to control structure and letting us modify them via MOM_input or MOM_interface changes)

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.

Finalize MARBL tunings print_marbl_log() does not handle surface flux log messages correctly

2 participants