Make internal_heat optional so it works when geothermal heating is disable in MOM6 #34
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.
As @andrew-c-ross originally reported here, COBALT uses the internal (geothermal) heat argument to calculate an iron flux:
ocean_BGC/generic_tracers/generic_COBALT.F90
Line 7850 in 011b724
However, the
internal_heatis a null pointer by default in MOM6 and is only allocated whenDO_GEOTHERMAL = Trueis set in MOM_input/MOM_override:https://github.com/NOAA-GFDL/MOM6/blob/2c1a9d32fce72828b7091e6f623c0ec20069e637/src/core/MOM.F90#L2812
We will encounter a segmentation fault in COBALT if the user accidentally sets
DO_GEOTHERMAL = false. This PR, proposed by @andrew-c-ross, addresses this issue by checking ifinternal_heatis a null pointer (by making it an optional argument ingeneric_COBALT_update_from_sourcesubroutine and checking if it is present) and assuming zero internal heating/iron flux if it is null.