Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meshcap update #757

Conversation

DeniseWorthen
Copy link
Contributor

@DeniseWorthen DeniseWorthen commented Aug 12, 2022

Pull Request Summary

Update mesh cap with changes needed for eventual merge to develop.

Description

  • Allows users of the mesh cap to set runtime options for custom restart and history file names and to create netcdf output for gridded fields at run time. For UWM, these can be set in the nems.configure using the settings
  gridded_netcdfout = true
  user_sets_histname = true
  user_sets_restname = true

History file names will then be casename.ww3.hi.YYYY-MM-DD-SSSS.nc and casename.ww3.r.YYYY-MM-DD-SSSS where casename is set from nems.configure for each application (e.g ufs.hafs)

  • Replaces previous set_shel_inp and read_shel_inp routines with the applicable section from ww3_shel.F90 to read either a inp or nml file. When used in UFS, the only required fields in the nml file are the list of forcing fields, the desired output fields, the name of the points file (if desired) and the stride for history and restart files. For example,
&input_nml
  input%forcing%winds = 'T'
  input%forcing%currents  = 'F'
  input%forcing%ice_conc  = 'F'
/
&output_type_nml
  type%field%list     = 'WND HS FP DP PHS PTP PDIR'
  type%point%file     = 'points.list'
/

&output_date_nml
  date%field%outffile  = '1'
  date%field%stride    = '3600'
  date%point%stride    = '3600'
  date%restart2%stride = '3600'
/
  • Enables a set of logical flags to replace a small sub-set of current ifdefs to control program execution as a first step towards to removing ifdefs and using runtime options. These flags are created in wav_shr_flags and implemented at this time primarily in w3wavemd and w3initmd for the various debug messaging and tracing ifdefs. This change was primarily accomplished via python script developed by @mvertens. The script also leverages emacs to use standard F90 if-then-else indenting. This introduces a large number of white-space changes. Neglecting whitespace changes can be view using the ?w=1 modification to the file difference url

  • Streamlines some sections of code which, after implementing logical flags, were found contain a serial string of the same ifdef (eg. SR W3SCAT)

  • Removes wav_tauice fields which are unused when coupling WW3 to CICE6.

Issue(s) addressed

Commit Message

Update mesh cap for custom user filenames, netcdf gridded output and logical control of some ifdef options.

co-authors : @mvertens

Testing

All UFS-WM baselines were run using hera.intel and hera.gnu and were B4B.

DeniseWorthen and others added 30 commits November 6, 2021 06:06
* global winds retrieved w/ correct name
* add stokes variables to exports
* z0 not repro but value exceeds max for atm use so
no impact
* add reset of charn for activated/deactivated ice points
* ran both 6h and 12h restart cases, both passed
* use mod_def.mx100, created using glo_1deg grid.inp except
for turning off k-shifting (broke repro!)
* temp debugging code to be removed
* control restarts using odat ?? make here 3600s
* remove/comment out items that have no impact on ufs (why?)
* tidy up
* turning these off gives all zeros in exported fields
* set inflags(2:4) true, others false. Treat momentum (if used)
like wind in filling global data
* state_diagnose at realize failed in debug mode because of
sum() of uninitialized variables
* remove debug switches
* remove extra 'HK' print statements
DeniseWorthen and others added 12 commits July 26, 2022 14:40
* add msgunit = 740+iaproc for either memcheck or debugint
* replace W3_MEMCHECK with call to print_memcheck
* use ringinterval set from configuration attributes
to set dtout(1) for history and dtout(4 or 8) for
restarts. this allows removal of user_restalarm and
user_histalarm. gridded output and restarts can be
written in w3wave using the native ww3 timer.
* rename user_grdncout to user_netcdf_grdout
* remove outfreq since it is not used
* text alignment and other whitespace changes
* close unit ndsi when reading shel.inp file
* write log message for naprst in w3iorsmd
* cesm needs rstwr control to prevent writing restart
at initial time
* use timen,time0 to set odat in wav_shel_inp
This reverts commit 1bc5a86.
* revert alarm control which broke cesm restart and history writes
* add initial flag control for debug and tracing options in w3wave and w3init primarily
* move implicit none to module default
* remove serial ifdefs which appear once flags control some options
* indent and text align
@JessicaMeixner-NOAA
Copy link
Collaborator

@DeniseWorthen and @mvertens -- WOW! So much great work! I've already started looking through this and look forward to working with you with the restart naming conventions to expand this capability to be a feature usable by standalone WW3 and not just a NUOPC coupled application.

I have some concerns as I look through this:

  1. We have a lot of unrelated work on many topics, when it's preferred to split coherent pieces of work into separate branches/PR when possible. It really seems like this could be a few smaller PRs, but perhaps I do not yet understand the interconnectedness.
  2. There are a lot of updates to the code (Thank you so much for all of the additional only in module use statements!) that seem unrelated to these updates describe in the PR text and will actually diverge this branch further from develop and make it harder to merge it back into develop. Perhaps I can help with some of these updates by seperating them out and putting them through a separate review and test process in the develop branch?
  3. There are some whole-scale style changes such as the #ifdef debug that should really go through it's own review process to make sure the whole WW3 community is on board with some of these changes. @aliabdolali have you scheduled that talk yet? I know you were aiming for September.

I want to emphasize that I personally am really excited about all of these updates and am happy to work with you both to make sure everything gets included and this branch gets back to the develop branch as soon as possible.

@DeniseWorthen
Copy link
Contributor Author

This PR resolves several issues related to getting the mesh cap into develop. The changes are not in fact un-related; they all revolve around file in/out (i.e. using a ww3_shel.nml for CESM, user file names and gridded netcdf output). Keeping the changes together means that the mesh cap can come to develop sooner. It has been extensively tested during development and confirmed to both work for CESM and have no impact on UWM.

In terms of converting ifdefs, since @mvertens and I are doing this work in the mesh cap, there is no way for us to make the changes and also test unless we make the changes in that mesh cap branch. While the text changes are extensive, as seen in this comparison, they specifically touch only a small subset of ifdefs or variable declarations. However, even this limited application we believe demonstrates the advantages in code clarity and readability of moving down this path.

I do have a branch which removes all the mesh cap items but contains the same ifdef changes. I can PR that to develop in order to keep the two branches in sync and perhaps spark the discussion you reference.

However, if the removal of ifdefs and a transition to run-time control of options is desired goal, the work @mvertens and I have done at this point make clear to us that there is no way to do that and not be disruptive.

@JessicaMeixner-NOAA
Copy link
Collaborator

@DeniseWorthen submitting a PR with just the ifdef changes to the develop branch would be great. That will surely start the discussion. Converting the if-defs is not required for the mesh cap to be merged back to the develop branch. In general, If there's a disruptive change coming, it's preferred that it's in a focused PR (to the develop branch) that is not combined with other updates which helps with code management and future debugging.

DeniseWorthen and others added 8 commits August 15, 2022 11:02
* fix name of config variable to enable wave-cice coupling
* in w3sic4, remove cesm ifdefs and icecon variable which is used
for debug message only
* for uwm, need to switch ic0->ic4 in meshcap switch to enable and
use mod_def with &SIC4 IC4METHOD = 8 and enable freq output variable
&OUTS E3D = 1, USSP = 1, IUSSP = 3, STK_WN = 0.04, 0.110, 0.3305
* allows compiler to optimize code w/in if-flag blocks
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.

None yet

4 participants