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

Add ice shelf pressure initialisation bug fix #800

Conversation

claireyung
Copy link

This commit adds a new parameter FRAC_DP_AT_POS_NEGATIVE_P_BUGFIX and associated bug fix. This bug occurs when TRIM_IC_FOR_P_SURF pressure initialisation is used for ice shelf, whilst in Boussinesq mode and a nonlinear equation of state. The subroutine trim_for_ice calls cut_off_column_top. This routine in Boussinesq mode calls find_depth_of_pressure_in_cell in MOM_density_integrals.F90. This subsequently calls the function frac_dp_at_pos which calls the density equation of state based on given salinity, temperature and depth, which is incorrectly converted into pressure by z position (which is negative) multiplied by g and rho0, therefore resulting in a large negative pressure. The bug results in incorrect densities from the equation of state and therefore an imperfect initialisation of layer thicknesses and sea surface height due to the displacement of water by the ice.

The bug is fixed by multiplying the pressure by -1.

This commit introduces parameter FRAC_DP_AT_POS_NEGATIVE_P_BUGFIX with default value False to preserve answers. If true, the ice shelf initialisation is accurate to a high degree with a nonlinear equation of state. Furthermore, in spurious velocity inverse seamount (icemount) test cases I now get very low velocities with the Wright eqn of state.

Answers should not change, except for the added parameter in MOM_parameter_doc.

Note the same functions are called by a unit test in MOM_state_initialization; in this commit I set the MOM_state_initialization unit test to use the existing bug (with the .false. flag). Please let me know if I should do something differently.

Copy link
Member

@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.

Very well done in identifying this bug, @claireyung, and thank you for this contribution. I think that this PR will be ready to go once some very minor white-space formatting issues are addressed in 5 places, as identified in separate comments.

@MJHarrison-GFDL
Copy link

Great work finding this long-standing bug @claireyung This explains why there were residual initialization problems with TRIM_IC_FOR_PSURF when using the non-linear equation of state. This fix should allow us to clean-up the initialization code and get rid of the alternate initialization routine calc_sfc_displacement, which was a workaround for what was apparently the bug you are identifying with this patch.

@Hallberg-NOAA Hallberg-NOAA added the bug Something isn't working label Jan 13, 2025
@claireyung
Copy link
Author

Thanks @Hallberg-NOAA and @MJHarrison-GFDL :) Hopefully my new commit resolves the style issues!

Copy link
Member

@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.

This PR is now looking good. Thank you for this fix to a long-standing bug when an ice-shelf is being used with a pressure-dependent equation of state.

This commit adds a new parameter FRAC_DP_AT_POS_NEGATIVE_P_BUGFIX
and associated bug fix. This bug occurs when TRIM_IC_FOR_P_SURF
pressure initialisation is used for ice shelf, whilst in
Boussinesq mode and a nonlinear equation of state. The subroutine
trim_for_ice calls cut_off_column_top. This routine in Boussinesq
mode calls find_depth_of_pressure_in_cell in
MOM_density_integrals.F90. This subsequently calls the function
frac_dp_at_pos which calls the density equation of state based on
given salinity, temperature and depth, which is incorrectly converted
into pressure by z position (which is negative) multiplied by g and
rho0. The bug results in incorrect densities from the equation of state
and therefore an imperfect initialisation of layer thicknesses and sea
surface height due to the displacement of water by the ice.

The bug is fixed by multiplying the pressure by -1.

This commit introduces parameter FRAC_DP_AT_POS_NEGATIVE_P_BUGFIX with
default value False to preserve answers. If true, the ice shelf
initialisation is accurate to a high degree with a nonlinear
equation of state.

Answers should not change, except for the added parameter in
MOM_parameter_doc.

The same functions are called by a unit test in MOM_state_initialization;
in this commit I set the MOM_state_initialization unit test to
use the existing bug (with a false flag).
for ice shelf pressure initialisation bug fix FRAC_DP_AT_POS_NEGATIVE_P_BUGFIX
@Hallberg-NOAA Hallberg-NOAA force-pushed the dev/gfdl-jan13_2025+negative_pressure_bug branch from fdfbb2a to 5c6f47a Compare January 14, 2025 18:26
@Hallberg-NOAA
Copy link
Member

This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/26048.

@Hallberg-NOAA Hallberg-NOAA merged commit dd1f3f5 into NOAA-GFDL:dev/gfdl Jan 14, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants