Skip to content

User/bgr/homogenize iob#1480

Closed
breichl wants to merge 2 commits into
mom-ocean:dev/gfdlfrom
breichl:user/bgr/homogenize_IOB
Closed

User/bgr/homogenize iob#1480
breichl wants to merge 2 commits into
mom-ocean:dev/gfdlfrom
breichl:user/bgr/homogenize_IOB

Conversation

@breichl
Copy link
Copy Markdown
Collaborator

@breichl breichl commented Aug 26, 2021

These changes are necessary to run a single-column like configuration in ice-ocean mode. It is difficult to guarantee that the coupler passes perfectly homogeneous fields back to MOM, so it is more straightforward to force the IOB fields to be homogeneous inside of MOM.

Presently there are no test cases that utilize this code, so everything should be unchanged. A new test case will be added shortly to take advantage of this new option in a SCM OM4-like configuration.

@Hallberg-NOAA , looking for some advice if the homogenize_IOB and homogenize_field routines would be better in another module, or if they are okay here.

brandon.reichl added 2 commits August 26, 2021 11:06
- With new option HOMOGENIZE_IOB_FORCINGS = True, a copy of the IOB structure is created with horizontally homogenized fields across all processor elements.
- This new feature is primarily for running in single column like configurations with the coupler, which requires perfectly equal forcing across all cells.
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 26, 2021

Codecov Report

Merging #1480 (101c26e) into dev/gfdl (817217e) will not change coverage.
The diff coverage is n/a.

❗ Current head 101c26e differs from pull request most recent head 40368f9. Consider uploading reports for the commit 40368f9 to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##           dev/gfdl    #1480   +/-   ##
=========================================
  Coverage     29.13%   29.13%           
=========================================
  Files           235      235           
  Lines         71061    71061           
=========================================
  Hits          20707    20707           
  Misses        50354    50354           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 817217e...40368f9. Read the comment docs.

Copy link
Copy Markdown
Collaborator

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

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

I like the spirit of where this PR is going, and it looks like it should work as written although I do not think that this code will be rotationally invariant. I have two specific questions about the implementation here:

  1. Why is there the choice to homogenize the Ice_ocean_boudary_type, rather than the forces and fluxes types? The former requires the creation of a separate structure, and it is specific to the FMS_cap, whereas if the homogenization had been to forcing and mech_forcing types, it could have been done in place, and this capability would have occurred in MOM6/src code that would have been shared across all the various drivers for MOM6.

  2. When taking the global means in homogenize_field(), why not use the order-invariant sums via something like the function global_area_mean() in src/diagnostics/MOM_spatial_means.F90, which would be rotationally invariant?

@breichl
Copy link
Copy Markdown
Collaborator Author

breichl commented Aug 30, 2021

Thanks @Hallberg-NOAA for looking at this and making comments. I will take suggestion in the second comment and update this PR. We can continue the conversation here or offline about your first comment.

  1. I planned to homogenize the fields in the forces/fluxes types, there were two reasons I changed my mind. First, it requires some care to ensure that all the homogenized fields are self-consistent due to non-commuting operators in the forces/fluxes extractions (ustar/tau being a primary example where the homogenized tau would need to be computed multiple times or stored). Second, there are many more fields that would need to be homogenized in the forces/fluxes type. It became clear it would be significantly less effort both now and in the future to homogenize the IOB type, and it also ensures that the boundary conditions that MOM sees are self-consistent. I'm happy to discuss more if you think the additional effort is worthwhile to find a more general approach.
  2. I was not aware of this function, but will look at replacing this. I wasn't positive that this would satisfy the rotational invariance, hopefully this simplifies that concern. FYI, I modeled this code after a function to homogenize the T&S initialization (following the homogenize flag in MOM_state_initialization). That code might therefore also be improved by taking advantage of this function.

allocate(IOB_h%ice_rigidity (isc_bnd:iec_bnd,jsc_bnd:jec_bnd) ) ; IOB_h%ice_rigidity = 0.0
call homogenize_field(IOB%ice_rigidity,IOB_h%ice_rigidity, G, index_bounds)
endif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@breichl , what about other IOBs? When I run this code change with "generic tracers" turned on the model crashes with

FATAL: extract_coupler_values: The requested boundary condition is not associated.

Image              PC                Routine            Line        Source             
MOM6SIS2           00000000026A4A77  Unknown               Unknown  Unknown
MOM6SIS2           0000000001A421EC  mpp_mod_mp_mpp_er          68  mpp_util_mpi.inc
MOM6SIS2           00000000017767FC  fms_coupler_util_          53  FMS_coupler_util.F90
MOM6SIS2           00000000004E20B6  g_tracer_utils_mp        1429  generic_tracer_utils.F90
MOM6SIS2           00000000011995D0  ocean_model_mod_m         551  ocean_model_MOM.F90
MOM6SIS2           00000000013E3A6F  MAIN__                   1041  coupler_main.F90

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.

I think that this issue that Niki is encountering suggests that it might be worth revisiting whether it would be simpler to homogenize the fields in the forcing and mech_forcing types, even if we had to add the option to recalculate the dependent fields (e.g., ustar) based on the primary fields (like taux and tauy). We should not be changing the intent on the various types.

call get_domain_extent(Ocean_sfc%Domain, index_bnds(1), index_bnds(2), index_bnds(3), index_bnds(4))

if (OS%use_homogenized_IOB) &
call homogenize_IOB(Ice_ocean_boundary, Ice_ocean_boundary_homogenized, OS%grid, index_bnds)
Copy link
Copy Markdown
Contributor

@nikizadehgfdl nikizadehgfdl Sep 3, 2021

Choose a reason for hiding this comment

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

@breichl , what is the reason for doing this on an extra copy of IOB? I think if we homogenize the fields on the original Ice_ocean_boundary (rather than the new Ice_ocean_boundary_homogenized ) everything would work fine, including the (generic) tracer fluxes. The problem with Ice_ocean_boundary_homogenized is that it does not have the hidden member "fluxes" allocated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One issue with modifying IOB itself is that it is intent(in) in update_ocean_model, I had to make it intent(inout). But after that all seem to have worked fine, including the homogenization and the generic tracers.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Okay, thanks Niki. I made the copy to avoid modifying this structure since it is intent(in). If we are comfortable making it intent(inout) then this solution works for me. Do the generic tracers fields also need to be homogenized? I'm not sure how difficult that would be or if it is necessary here.

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.

I am very uncomfortable making the IOB type intent(inout). The intent is there for a reason, as it helps to document which fields are coming from where, and it does so in a way that the compiler can take advantage of for performance.

nikizadehgfdl referenced this pull request in nikizadehgfdl/MOM6_OBGC_examples Sep 15, 2021
- This commit uses a MOMr branch code developed by B. Raichl to homogenize the
forcings over the column that avoids sst drifts in the physical model.
- The code is modified by Niki to make it work for generic tracers.
- For more info refer to https://github.com/NOAA-GFDL/MOM6/pull/1480
- Also in this commit are included the parameter changes from B. Reichl
for the physical model.
@marshallward
Copy link
Copy Markdown
Collaborator

@breichl Have you had a chance to review the comments here?

@breichl
Copy link
Copy Markdown
Collaborator Author

breichl commented Nov 8, 2021

Provided @Hallberg-NOAA thinks #1541 is a better solution I will close this PR

@breichl
Copy link
Copy Markdown
Collaborator Author

breichl commented Nov 10, 2021

Closing in favor of #1541.

@breichl breichl closed this Nov 10, 2021
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.

4 participants