Bugfix for mixing up Rho0 and rho_ref in Boussinesq PGF#837
Bugfix for mixing up Rho0 and rho_ref in Boussinesq PGF#837Hallberg-NOAA merged 3 commits intoNOAA-GFDL:dev/gfdlfrom
Rho0 and rho_ref in Boussinesq PGF#837Conversation
Hallberg-NOAA
left a comment
There was a problem hiding this comment.
Having carefully examined these proposed changes, I am convinced that they are correct. In particular, any choosing any value of RHO_PGF_REF should give mathematically equivalent answers, and these changes should recover this property.
However, in examining these changes, I think that I have spotted a separate bug related to a missing reference geopotential height (G%Z_ref) correction. Please take a look at the relevant line, @herrwang0, and let me know what you think. In particular, answers should be mathematically equivalent when different values of REFERENCE_HEIGHT are used. I leave it up to you, though, @herrwang0, to decide whether this additional bug (if it does exist) should be dealt with in this same PR or whether it should be dealt with separately. Note that in every case I could find, REFERENCE_HEIGHT = 0.0, so such a bug seems very unlikely to change answers.
Hallberg-NOAA
left a comment
There was a problem hiding this comment.
With the recent minor update, I think that everything in this PR looks correct. Thank you for this valuable contribution.
I_Rho = 1.0/rho_0 is never used and therefore removed.
This new parameter addresses a bug in Boussinesq finite volume pressure gradient forces (MOM_PressureForce_FV) that the mean seawater density Rho_0 and reference density Rho_ref are used incorrectly in several instances. It should be noted that by default Rho_ref is Rho_0 and Rho_ref is rarely set to other than Rho_0.
Recover reference height offset (Z_ref) in calculating bottom pressure for self-attraction and loading in Boussinesq mode.
9850319 to
7e00daa
Compare
|
This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/26508 with the expected warnings about a new runtime parameter. |
…L#837) * Remove unused local variable I_Rho in int_density I_Rho = 1.0/rho_0 is never used and therefore removed. * Add runtime flag RHO_PGF_REF_BUG This new parameter addresses a bug in Boussinesq finite volume pressure gradient forces (MOM_PressureForce_FV) that the mean seawater density Rho_0 and reference density Rho_ref are used incorrectly in several instances. It should be noted that by default Rho_ref is Rho_0 and Rho_ref is rarely set to other than Rho_0. * Bugfix: reference height offset for SAL using bpa Recover reference height offset (Z_ref) in calculating bottom pressure for self-attraction and loading in Boussinesq mode.
This PR fixes a bug in Boussinesq finite volume pressure gradient force that
GV%Rho0, mean seawater density andCS%Rho0, reference density are incorrectly interchanged in a number of instances. The bug probably has zero effect on any existing runs, as I am unaware of cases whereRHO_PGF_REFis set different fromRHO_0, otherwise, this bug would have been detected. So the fix here is just for future-proof purpose.RHO_PGF_REF_BUGis added.CS%Rho0is renamed toCS%rho_reffor clarification.GxRho_refis added to distinguish fromGxRho0.GxRho_refis used to offset reference density in interface heights inpa. AndGxRho0is used to calculate surface pressure. PreviouslyGxRho0was incorrectly using reference densityrho_ref(i.e.CS%Rho0).rho_refinstead ofGV%rho0. Two local variablesrho0_int_densityandrho0_set_pbceare added to maintain and fix this issue.This PR does not change answers.
054354f: Remove unused variable
I_Rhoin threeint_density_dzsubroutines93a86dc: Add runtime flag
RHO_PGF_REF_BUG