-
Notifications
You must be signed in to change notification settings - Fork 10
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
Sed and coastal/clean code #89
Conversation
Hello @yichengt900, I made the small adjustments we discussed this morning. As expected, it did not seem to fix the cryptic restart issue blocking the pull request. Looking at the code changes, I can't imagine what might be tripping this off. When you get a chance, could you have a look at the restarts and see if they provide any clues? |
Hi @charliestock, I reviewed the differences in the restart files, and the variables showing discrepancies after the model integrated the 3600s time step (the model ran with restart for an hour integration) are listed below:
I will investigate further. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @charliestock,
I think I found the issue that is breaking the reproducibility across restarts.
Please see my comment below.
That seemed to do the trick YC, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@charliestock , this PR looks good after the fix, I just have a few small comments.
generic_tracers/generic_COBALT.F90
Outdated
enddo; enddo; enddo !} i,j,k | ||
|
||
! Calculate the bottom conditions and the fluxes to the bottom for diagnostics and benthic flux calculations. | ||
! MOM4/5 used the bottom grid cell, but MOM6 often has a number of vanishingly thin layers overlying the bottom. | ||
! Grid scale noise in these layers can occur, particularly for quantitities with large bottom fluxes. COBALT thus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be quantities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it.
generic_tracers/generic_COBALT.F90
Outdated
@@ -4313,9 +4321,40 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h | |||
|
|||
! Iron from sediment (Dale, 2015). The maximum release from the sediment is set by ffe_sed_max. The | |||
! hyperbolic tangent requires the flux of carbon to the sediments (as mmoles m-2 day-1) in the numerator | |||
! and the bottom water oxygen concentration (in microMolar units) in the denominator: | |||
! and the bottom water oxygen concentration (in microMolar units) in the denominator. Note that ffe_sed_max | |||
! was converted to moles Fe m-2 sec-1 during parameter input, so ffe_sed has is in moles Fe m-2 sec-1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has is
should be is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks.
generic_tracers/generic_COBALT.F90
Outdated
! the vertical face of the land mass has thus been included. The flux is posed as a fraction (fe_coast) of | ||
! the sediment Fe flux (moles Fe m-2 sec-1) that would have result from the sinking organic matter flux and | ||
! O2 level of the adjacent waters. This then spread across the layer mass (rho_dzt(i,j,k)) to give an input | ||
! in moles Fe kg-1 sec-1. Conceptually, this can be though of as a net iron flux resulting from the fraction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup.
generic_tracers/generic_COBALT.F90
Outdated
@@ -4249,6 +4256,7 @@ subroutine generic_COBALT_update_from_source(tracer_list,Temp,Salt,rho_dzt,dzt,h | |||
! Since burial is highly uncertain and often used in global earth system simulations to balance inputs and | |||
! outputs, a dimensionless scaling factor (cobalt%scale_burial) has also been included. | |||
fpoc_btm = cobalt%fntot_btm(i,j)*cobalt%c_2_n*sperd*1000.0 | |||
! Should we use ztop? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. This depends on how we define our benthic layer. If we consider the model bottom layer as the benthic layer, then using ztop
would be appropriate. However, if we define the benthic layer as one layer below our model's bottom grid, then cobalt%zt
would be suitable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I have looked at this directly before, and maybe I'm just thinking myself in a circle, but am I right in thinking that grid_kmt is equal to the number of vertical tracer grid cells (e.g., 75 for most of our regional applications) in MOM6. So "zt(75)" is the bottom of the 75th grid cell (i.e., the sediment)? I just need a quick sanity check on this.
generic_tracers/generic_COBALT.F90
Outdated
! Coarse resolution models and/or intermediate resolution models in areas with exceptionally steep bathymetry | ||
! can under-represent coastal iron because they don't resolve shallow regions. An option to add iron through | ||
! the vertical face of the land mass has thus been included. The flux is posed as a fraction (fe_coast) of | ||
! the sediment Fe flux (moles Fe m-2 sec-1) that would have result from the sinking organic matter flux and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change "result" to "resulted" or remove "have" in this sentence "the sediment Fe flux (moles Fe m-2 sec-1) that would have result from the sinking organic matter flux and O2 level of the adjacent waters."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Thanks.
generic_tracers/generic_COBALT.F90
Outdated
"nitrate release per kg of ice melt",units="mol N kg-1 ice melt", default= 2.0e-6) | ||
call get_param(param_file, "generic_COBALT", "jpo4_iceberg_ratio", cobalt%jpo4_iceberg_ratio, & | ||
"phosphate release per kg of ice melt",units="mol P kg-1 ice melt", default= 1.1e-7) | ||
! fe_coast is effectively the fraction of the equivalent benthic iron flux that you would have been generated by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "you" after "... flux that" in "fe_coast is effectively the fraction of the equivalent benthic iron flux that you would have been generated by", and change "were it to encounter sediments" to "when encountering sediments".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it.
! the sediment Fe flux (moles Fe m-2 sec-1) that would have result from the sinking organic matter flux and | ||
! O2 level of the adjacent waters. This then spread across the layer mass (rho_dzt(i,j,k)) to give an input | ||
! in moles Fe kg-1 sec-1. Conceptually, this can be though of as a net iron flux resulting from the fraction | ||
! of the sinking flux that would have been intercepted at shallower depths were the model resolution finer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add "is" after model resolution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one might be OK as is, but I did need a "The" after finer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just made a few edits on the comments, and will start working on creating a few model tests to see how this changes the Main Hawaiian island domain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set up 3 experiments with the updated fe_coast
formulation, where fe_coast =0.001, 0.01, and 0.1. Below I show the differences in surface dissolved iron compared to a base run without any changes to fe_coast (fe_coast =0).
(the columns represent base and differences between experiments (exp - base)). I have also looked at how surface chlorophyll
and the deep chlorophyll maximum at station ALOHA were modified by this change.
(DCM doesn't change between experiments). The changes between these three experiments do not seem to look linear, so I am having trouble understanding why the smallest changes in fe_coast (0.001), seem to show the largest differences in dissolved iron along the islands. I have verified my xml and code to make sure I didn't make a mistake plotting the figures.
generic_tracers/generic_COBALT.F90
Outdated
endif !} | ||
enddo; enddo !} i,j | ||
! CAS: Is the necessary? | ||
do k = 2, nk ; do j = jsc, jec ; do i = isc, iec !{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't thinks so, since these are initialized with 0s here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I have deleted. and we will confirm there are no answer changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Gaby. Thank you for adding the figures and sorry it has taken me so long to look at them. I too am a bit surprised to not see a clearer progression from the small to the largest flux, but I think this may be partly due to the prominent boundary condition noise. I will be good to continue testing this in combination with Theresa's boundary nudging fixes.
It looks like this has passed checks. Since the default fe_coast = 0 won't effect any answers, perhaps we can merge it in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @charliestock. The changes look good. I tested them with the NWA12 regression, and the results are identical. Approved.
This pull request cleans up and adds commenting to sections of the sediment code. It also modifies the formulation of a previously used "coastal" iron source (jfe_coast). This source of iron was used in TOPAZ and early versions of COBALT to simulate coastal iron fluxes from the vertical land face. This was done because coarse resolution often prevented significant sediment iron fluxes from being introduced near the ocean surface in shallow waters: the grid was so coarse, even the first grid cell was far deeper than the euphotic zone in most places. Releasing iron from the land edges provided a means of generating "island wakes" even when the model resolution prevented resolution of shallow nearshore areas.
As the resolution of our ocean model configurations has increased, we have moved away from using this "coastal" source, instead relying on the benthic fluxes that are explicitly resolved by the model. This has worked for nearly all of our CEFI runs. Recent Pacific Island simulations done by @gabyneg, however, suggest that there still may be a role for this parameterized flux in areas with particularly narrow shelves and steep bathymetry. However, when I looked back at the old way the flux was formulated I found the underlying rationale lacking. I thus coded an alternative that made the coastal flux proportional to the benthic flux that would have arisen from the organic carbon flux and O2 in the adjacent water. Conceptually, one can think of this as a net flux that would have arisen from unresolved shallow regions within the first grid cell. The parameter "fe_coast" becomes a constant of proportionality which we need to explore but I suspect should be ~0.1 for cases where we feel it is necessary to use this parameterization.
The default value of fe_coast is 0 and I feel it should stay this way. With fe_coast = 0, this pull request should not change answers. In addition to the code review and commenting, it would be great if @gabyneg could run a few test cases in her Pacific Islands domain to see if we are satisfied with the new approach.
I still have a bit more work to do with the commenting of the sediment section, but I will complete this in a subsequent pull request.