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

Making pseudosalt more like actual salt (real salt? more salt-like? more salty?) #1558

Open
mnlevy1981 opened this issue Mar 1, 2022 · 1 comment

Comments

@mnlevy1981
Copy link
Contributor

I've been working on a fix for #1545 and testing via the MOM_CFC_cap.F90 and pseudo_salt_tracer.F90 modules. I'm in the process of bringing the February changes to main onto my branch, and making sure my branch can pass dimensional scaling tests. In doing so, I noticed a small discrepancy in how units are set when salt and pseudosalt are registered. Here is the register_tracer() call for salt:

      call register_tracer(CS%tv%S, CS%tracer_Reg, param_file, HI, GV, &
                           tr_desc=vd_S, registry_diags=.true., flux_nameroot='S', &
                           flux_units=S_flux_units, flux_longname='Salt', &
                           flux_scale=conv2salt, convergence_units='kg m-2 s-1', &
                           convergence_scale=0.001*GV%H_to_kg_m2, CMOR_tendprefix="osalt", diag_form=2)

vs the same call for pseudosalt:

  call register_tracer(tr_ptr, tr_Reg, param_file, HI, GV, name="pseudo_salt", &
                       longname="Pseudo salt passive tracer", units="psu", &
                       registry_diags=.true., restart_CS=restart_CS, &
                       mandatory=.not.CS%pseudo_salt_may_reinit)

The code mods below bring flux_scale, convergence_units, and convergence_scale into agreement between the two (but I am now noticing that I should also set flux_units):

diff --git a/src/tracer/pseudo_salt_tracer.F90 b/src/tracer/pseudo_salt_tracer.F90
index 579751952..cf3874697 100644
--- a/src/tracer/pseudo_salt_tracer.F90
+++ b/src/tracer/pseudo_salt_tracer.F90
@@ -74,6 +74,7 @@ function register_pseudo_salt_tracer(HI, GV, param_file, CS, tr_Reg, restart_CS)
   real, pointer :: tr_ptr(:,:,:) => NULL()
   logical :: register_pseudo_salt_tracer
   integer :: isd, ied, jsd, jed, nz
+  real :: conv2salt            ! A conversion factor for salt fluxes [m H-1 ~> 1] or [kg m-2 H-1 ~> 1]
   isd = HI%isd ; ied = HI%ied ; jsd = HI%jsd ; jed = HI%jed ; nz = GV%ke

   if (associated(CS)) then
@@ -95,9 +96,16 @@ function register_pseudo_salt_tracer(HI, GV, param_file, CS, tr_Reg, restart_CS)
   tr_ptr => CS%ps(:,:,:)
   call query_vardesc(CS%tr_desc, name=var_name, caller="register_pseudo_salt_tracer")
   ! Register the tracer for horizontal advection, diffusion, and restarts.
+  if (GV%Boussinesq) then
+    conv2salt = GV%H_to_m ! Could change to GV%H_to_kg_m2 * 0.001?
+  else
+    conv2salt = GV%H_to_kg_m2
+  endif
   call register_tracer(tr_ptr, tr_Reg, param_file, HI, GV, name="pseudo_salt", &
                        longname="Pseudo salt passive tracer", units="psu", &
                        registry_diags=.true., restart_CS=restart_CS, &
+                       flux_scale=conv2salt, convergence_units='kg m-2 s-1', &
+                       convergence_scale=0.001*GV%H_to_kg_m2, &
                        mandatory=.not.CS%pseudo_salt_may_reinit, Tr_out=CS%tr_ptr)

   CS%tr_Reg => tr_Reg

I'm happy to include the above diffs (and the additional flux_units argument) in my branch or in a separate PR (either here or to dev/ncar) if this is indeed a bug rather than a feature. If there are edge-cases not accounted for in my fix, I can address those as well.

@Hallberg-NOAA
Copy link
Collaborator

The proposed changes look to me like a good idea. There is one minor simplification, though, that could be made, if we note that the variable GV%H_to_mks takes the two expressions in the proposed new variable conv2salt, which would let us avoid the need to have Boussinesq or non-Boussenesq options in this part of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants