+(*)Fix rotation of coupler_type variables #638
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds the necessary information about the turns of the model grid relative to the (unrotated)
coupler_type
data fields that are inside of theforcing
type andsurface_state
type and are used with passive tracers, so that certain tracer packages can now be used with rotated grids. The previous version had problems where the model would not run whenROTATE_INTEX = True
and the CFCs (and probably other passive tracers) were being used, as noted at /issues/621. These problems have now been fixed.There are new calls to
coupler_type_spawn()
inallocate_forcing_by_ref()
andallocate_surface_state()
that manage the creation of thecoupler_2d_bt_types
for unrotated types based on information from their rotated counterparts.There is a new optional
turns
argument toallocate_forcing_by_ref()
and new optionalsfc_state_in
andturns
arguments toallocate_surface_state()
, and these are now being used in at least 6 places where unrotated temporarysurface_state
orforcing
types are being set up.There are also new optional
turns
arguments toextract_coupler_type_data()
andset_coupler_type_data()
that are used to deal with the fact that the internal data arrays in thecoupler_bc_types
are never rotated, unlike the other MOM6 arrays, because they have to be passed directly into the generic tracer code. These new turns arguments are used in 14 calls from various tracer packages, including in 6 calls from the OCMIP2_CFC code.There are 4 new calls to
deallocate_surface_state()
ordeallocate_forcing_type()
that were added to avoid (presumably minor) memory leaks when grid rotation is enabled. These new calls are ininitialize_ice_shelf_fluxes()
,shelf_calc_flux()
and in the surface flux diagnostics section ofstep_MOM()
.All answers are bitwise identical in any cases that worked previously, but some cases with grid rotation that previously were failing with cryptic error messages are now running successfully. There are new optional arguments to several publicly visible routines.