In generic_tracer_source call, perform unit conversion for internal heat only when it is applicable #688
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 PR is related to another PR made in the NOAA-GFDL/ocean_BGC repo.
In the past, setting
DO_GEOTHERMAL = True
was necessary for COBALT to function correctly. Failure to enable geothermal heating will lead to segmentation faults if someone turned it off accidently.We have now made
internal_heat
an optional argument in thegeneric_COBALT_update_from_source
. Theif(present())
check will determine ifinternal_heating
is a null pointer. However, in the unit conversion case, the scaling operationG%US%RZ_to_kg_m2*US%C_to_degC*tv%internal_heat(:,:)
occurs before passing the data togeneric_tracer_source
. This will cause a segmentation fault ifinternal_heat
is null.This PR (proposed by @andrew-c-ross originally) fixes this issue by omitting this argument if
internal_heat
is not associated.