Skip to content

Commit

Permalink
Dimension scaling of massout_flux, tracers
Browse files Browse the repository at this point in the history
This patch fixes the dimensional scaling of the following diagnostics:

- massout_flux
- ideal_age
- various DOME derived tracers
- Derived tracer diagnostics:
    - *_adx
    - *_ady
    - *_dfx
    - *_dfx
    - *h_tendency_2d

Many tracer fixes rely on the "flux_" and "conv_" arguments for
rescaling, which is probably not the original intended use, and should
probably be revised in the future.
  • Loading branch information
marshallward committed Sep 19, 2019
1 parent cf4b1bc commit a045278
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/core/MOM_forcing_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ subroutine register_forcing_type_diags(Time, diag, US, use_temperature, handles,

handles%id_massout_flux = register_diag_field('ocean_model', 'massout_flux', diag%axesT1, Time, &
'Net mass flux of freshwater out of the ocean (used in the boundary flux calculation)', &
'kg m-2')
'kg m-2', conversion=diag%GV%H_to_kg_m2)

handles%id_massin_flux = register_diag_field('ocean_model', 'massin_flux', diag%axesT1, Time, &
'Net mass flux of freshwater into the ocean (used in boundary flux calculation)', 'kg m-2')
Expand Down
4 changes: 2 additions & 2 deletions src/tracer/DOME_tracer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ function register_DOME_tracer(HI, GV, param_file, CS, tr_Reg, restart_CS)
! Register the tracer for horizontal advection, diffusion, and restarts.
call register_tracer(tr_ptr, tr_Reg, param_file, HI, GV, &
name=name, longname=longname, units="kg kg-1", &
registry_diags=.true., flux_units=flux_units, &
restart_CS=restart_CS)
registry_diags=.true., restart_CS=restart_CS, &
flux_units=trim(flux_units), flux_scale=GV%H_to_MKS)

! Set coupled_tracers to be true (hard-coded above) to provide the surface
! values to the coupler (if any). This is meta-code and its arguments will
Expand Down
20 changes: 12 additions & 8 deletions src/tracer/MOM_tracer_registry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -392,18 +392,20 @@ subroutine register_tracer_diagnostics(Reg, h, Time, diag, G, GV, US, use_ALE)
if (Tr%diag_form == 1) then
Tr%id_adx = register_diag_field("ocean_model", trim(shortnm)//"_adx", &
diag%axesCuL, Time, trim(flux_longname)//" advective zonal flux" , &
trim(flux_units), v_extensive = .true., y_cell_method = 'sum')
trim(flux_units), v_extensive = .true., y_cell_method = 'sum', &
conversion=Tr%flux_scale)
Tr%id_ady = register_diag_field("ocean_model", trim(shortnm)//"_ady", &
diag%axesCvL, Time, trim(flux_longname)//" advective meridional flux" , &
trim(flux_units), v_extensive = .true., x_cell_method = 'sum')
trim(flux_units), v_extensive = .true., x_cell_method = 'sum', &
conversion=Tr%flux_scale)
Tr%id_dfx = register_diag_field("ocean_model", trim(shortnm)//"_dfx", &
diag%axesCuL, Time, trim(flux_longname)//" diffusive zonal flux" , &
trim(flux_units), v_extensive = .true., conversion=US%L_to_m**2, &
y_cell_method = 'sum')
trim(flux_units), v_extensive = .true., y_cell_method = 'sum', &
conversion=(US%L_to_m**2)*Tr%flux_scale)
Tr%id_dfy = register_diag_field("ocean_model", trim(shortnm)//"_dfy", &
diag%axesCvL, Time, trim(flux_longname)//" diffusive zonal flux" , &
trim(flux_units), v_extensive = .true., conversion=US%L_to_m**2, &
x_cell_method = 'sum')
trim(flux_units), v_extensive = .true., x_cell_method = 'sum', &
conversion=(US%L_to_m**2)*Tr%flux_scale)
else
Tr%id_adx = register_diag_field("ocean_model", trim(shortnm)//"_adx", &
diag%axesCuL, Time, "Advective (by residual mean) Zonal Flux of "//trim(flux_longname), &
Expand Down Expand Up @@ -508,9 +510,11 @@ subroutine register_tracer_diagnostics(Reg, h, Time, diag, G, GV, US, use_ALE)
var_lname = "Net time tendency for "//lowercase(flux_longname)
if (len_trim(Tr%cmor_tendprefix) == 0) then
Tr%id_trxh_tendency = register_diag_field('ocean_model', trim(shortnm)//'h_tendency', &
diag%axesTL, Time, var_lname, conv_units, v_extensive=.true.)
diag%axesTL, Time, var_lname, conv_units, v_extensive=.true., &
conversion=Tr%conv_scale)
Tr%id_trxh_tendency_2d = register_diag_field('ocean_model', trim(shortnm)//'h_tendency_2d', &
diag%axesT1, Time, "Vertical sum of "//trim(lowercase(var_lname)), conv_units)
diag%axesT1, Time, "Vertical sum of "//trim(lowercase(var_lname)), conv_units, &
conversion=Tr%conv_scale)
else
cmor_var_lname = "Tendency of "//trim(cmor_longname)//" Expressed as "//&
trim(flux_longname)//" Content"
Expand Down
3 changes: 2 additions & 1 deletion src/tracer/ideal_age_example.F90
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ function register_ideal_age_tracer(HI, GV, param_file, CS, tr_Reg, restart_CS)
! Register the tracer for horizontal advection, diffusion, and restarts.
call register_tracer(tr_ptr, tr_Reg, param_file, HI, GV, tr_desc=CS%tr_desc(m), &
registry_diags=.true., restart_CS=restart_CS, &
mandatory=.not.CS%tracers_may_reinit)
mandatory=.not.CS%tracers_may_reinit, &
flux_scale=GV%H_to_m)

! Set coupled_tracers to be true (hard-coded above) to provide the surface
! values to the coupler (if any). This is meta-code and its arguments will
Expand Down

0 comments on commit a045278

Please sign in to comment.