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

Ballast and remin/clean code #79

Merged
merged 4 commits into from
Jul 9, 2024
Merged

Conversation

charliestock
Copy link
Contributor

This pull request cleans up the mineral ballasting, remineralization of sinking detritus and iron scavenging sections of COBALTv3. It gets rid of one redundant local variable (z_remin_ramp) and introduces a parameter for the augmentation of scavenging when free iron exceeds fe solubility (fast_fescav_fac).

For fast_fescav_fac have been using a factor of 2 for this in the regional runs, but previous global coarse resolution runs used a factor of 10. I think this parameter is somewhat scale dependent. I used a higher value in prior global runs to try and erode coastal iron signals that were propagating too far into the ocean interior, probably because shelf residence times were under-estimated with coarse resolution. Higher resolution addressed this problem and a factor of 2 seems to work better. I have thus made 2 the default.

Most of this pull request is commenting and clean up. Perhaps most significantly, the comments now include a detailed description of the ligand binding derivation used to calculate the free iron (feprime). This involves solving a system of three equations and results in a quadratic equation for feprime. The comments should now provide enough information for users to be able to understand and verify the derivation.

One thing I did not have time to do yet is to enhance all the variable definitions associated with this pull request. I will handle this in a follow on pull request soon.

This pull request should not change answers!

@charliestock charliestock added documentation Improvements or additions to documentation CodeCleanUp labels Jul 5, 2024
@charliestock charliestock requested review from jessluo and gabyneg July 5, 2024 04:03
Copy link
Collaborator

@jessluo jessluo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need some time to go through this in detail. But to start with, here are just a couple typos I caught in my first read through.

generic_tracers/generic_COBALT.F90 Outdated Show resolved Hide resolved
generic_tracers/generic_COBALT.F90 Outdated Show resolved Hide resolved
! The ligand concentration includes a background concentration (felig_bkg) and an additional amount proportional
! to dissolved organic matter (felig_2_don). When the free iron (feprime) exceeds solubility limits defined as
! a function of temperature and salinity according to Liu and Millero (2002), scavenging is increased by the factor
! fast_scav_fac to mimic rapd precipitation. In coarse resolution global simulations, fast_scav_fac was generally
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"rapid"

generic_tracers/generic_COBALT.F90 Outdated Show resolved Hide resolved
cobalt%jprod_cadet_arag(i,j,k) = (zoo(2)%jzloss_n(i,j,k)*zoo(3)%phi_det + &
(zoo(2)%jhploss_n(i,j,k) + zoo(3)%jhploss_n(i,j,k))*cobalt%hp_phi_det)* &
cobalt%ca_2_n_arag*min(cobalt%caco3_sat_max, max(0.0,cobalt%omega_arag(i,j,k) - 1.0)) + epsln
! Forams and coccolithophores are assumed to the primary calcite shell formers. Forams fall into the small
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are assumed to be the primary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching these Jessica.

else !}{
cobalt%jremin_ndet(i,j,k) = cobalt%gamma_ndet * cobalt%o2_min / &
(cobalt%k_o2 + cobalt%o2_min)* &
cobalt%f_no3(i,j,k) / (phyto(SMALL)%k_no3 + cobalt%f_no3(i,j,k))* &
cobalt%f_no3(i,j,k) / (cobalt%k_no3_denit + cobalt%f_no3(i,j,k))* &
Copy link
Collaborator

@yichengt900 yichengt900 Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the new code makes sense to me, it changes our baseline in the NWA12-RT case. I checked COBALTv2 and found that we also used small phytoplankton's k_no3. @charliestock just wants to confirm if this is the change we want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it? I think cobalt(SMALL)%k_no3 and cobalt%k_no3_denit have the same value. We just introduced k_no3_denit to be explicit that this was a different paramater.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stand corrected. These parameters are different. This will change answers, but in a minimal way. The parameter is only has a significant effect when both oxygen and nitrate have been exhausted which rarely, if ever, happens. Even in such cases, the impact will be small.

In general, I suggest we remove uses of the phytoplankton parameters beyond their explicit definition. It looks like we used phyto(SMALL)%k_no3, for example, for the anammox dependence on NO3. Thus, changing phyto(SMALL)%k_no3 risks unintentionally changing multiple factors. I think we should adopt k_no3_denit for denitrification and define k_no2_anammox for anammox and set both to 1e-6. What do you folks think?

@yichengt900 @jessluo

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I completely agree. It was just a quick shorthand to use phyto(SMALL)%k_no3 but doing so poses risks where a user may come in and change what they think is just the small phytoplankton nitrate half saturation constant and end up changing values for other processes as well.

@charliestock
Copy link
Contributor Author

This new commit fixes typos in the comments (thanks Jessica), eliminates omegaa and omegac from cobalt_types.F90, and retains the k_no3_denit change in the water column remin (which will change answers very slightly), and introduces k_no3_amx. The last of these changes will have no impact since anammox isn't turned on but, line k_no3_denit, establishes a clear separation between this parameter and the phytoplankton uptake parameters. @jessluo @yichengt900

@yichengt900
Copy link
Collaborator

@charliestock, I like the idea of removing the uses of the phytoplankton parameters beyond their explicit definition. The new commit looks good to me. I will wait a bit for others' comments.

Copy link

@gabyneg gabyneg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes, and the added descriptions look good to me, and make it easier to follow.

Copy link
Collaborator

@yichengt900 yichengt900 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charliestock, overall the changes look good, and the comments are straightforward and easy to understand. Although this PR will change our baselines due to the introduction of the new runtime parameter k_no3_denit with a slightly different value (we also added k_no3_amx, but it is not yet in use), we expect the impact to be minor. Please approve this PR.

Copy link
Collaborator

@jessluo jessluo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@yichengt900 yichengt900 merged commit 1bc8466 into dev/cefi Jul 9, 2024
1 check passed
@yichengt900 yichengt900 deleted the ballast_and_remin/clean_code branch August 1, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CodeCleanUp documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants