Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into hdrake_addhistogramandscalarcoord
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Drake committed Jan 14, 2025
2 parents a1df48f + 585d24d commit 10e3cb5
Show file tree
Hide file tree
Showing 40 changed files with 3,153 additions and 1,411 deletions.
336 changes: 205 additions & 131 deletions config_src/drivers/solo_driver/MOM_surface_forcing.F90

Large diffs are not rendered by default.

File renamed without changes.
10 changes: 7 additions & 3 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,11 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
do j=js,je ; do i=is,ie
CS%ssh_rint(i,j) = CS%ssh_rint(i,j) + dt*ssh(i,j)
enddo ; enddo
if (CS%IDs%id_ssh_inst > 0) call post_data(CS%IDs%id_ssh_inst, ssh, CS%diag)
if (CS%IDs%id_ssh_inst > 0) then
call enable_averages(dt, Time_local, CS%diag)
call post_data(CS%IDs%id_ssh_inst, ssh, CS%diag)
call disable_averaging(CS%diag)
endif
call cpu_clock_end(id_clock_dynamics)
endif

Expand Down Expand Up @@ -4014,7 +4018,7 @@ subroutine extract_surface_state(CS, sfc_state_in)
numberOfErrors=0 ! count number of errors
do j=js,je ; do i=is,ie
if (G%mask2dT(i,j)>0.) then
localError = sfc_state%sea_lev(i,j) <= -G%bathyT(i,j) - G%Z_ref &
localError = sfc_state%sea_lev(i,j) < -G%bathyT(i,j) - G%Z_ref &
.or. sfc_state%sea_lev(i,j) >= CS%bad_val_ssh_max &
.or. sfc_state%sea_lev(i,j) <= -CS%bad_val_ssh_max &
.or. sfc_state%sea_lev(i,j) + G%bathyT(i,j) + G%Z_ref < CS%bad_val_col_thick
Expand All @@ -4041,7 +4045,7 @@ subroutine extract_surface_state(CS, sfc_state_in)
write(msg(1:240),'(2(a,i4,1x),4(a,f8.3,1x),6(a,es11.4))') &
'Extreme surface sfc_state detected: i=',ig,'j=',jg, &
'lon=',G%geoLonT(i,j), 'lat=',G%geoLatT(i,j), &
'x=',G%gridLonT(i), 'y=',G%gridLatT(j), &
'x=',G%gridLonT(ig), 'y=',G%gridLatT(jg), &
'D=',US%Z_to_m*(G%bathyT(i,j)+G%Z_ref), 'SSH=',US%Z_to_m*sfc_state%sea_lev(i,j), &
'U-=',US%L_T_to_m_s*sfc_state%u(I-1,j), 'U+=',US%L_T_to_m_s*sfc_state%u(I,j), &
'V-=',US%L_T_to_m_s*sfc_state%v(i,J-1), 'V+=',US%L_T_to_m_s*sfc_state%v(i,J)
Expand Down
322 changes: 198 additions & 124 deletions src/core/MOM_PressureForce_FV.F90

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4959,15 +4959,10 @@ subroutine barotropic_init(u, v, h, eta, Time, G, GV, US, param_file, diag, CS,

if (len_trim(wave_drag_u) > 0 .and. len_trim(wave_drag_v) > 0) then
call MOM_read_data(wave_drag_file, wave_drag_u, CS%lin_drag_u, G%Domain, &
position=EAST_FACE, scale=GV%m_to_H*US%T_to_s)
call pass_var(CS%lin_drag_u, G%Domain)
CS%lin_drag_u(:,:) = wave_drag_scale * CS%lin_drag_u(:,:)

position=EAST_FACE, scale=wave_drag_scale*GV%m_to_H*US%T_to_s)
call MOM_read_data(wave_drag_file, wave_drag_v, CS%lin_drag_v, G%Domain, &
position=NORTH_FACE, scale=GV%m_to_H*US%T_to_s)
call pass_var(CS%lin_drag_v, G%Domain)
CS%lin_drag_v(:,:) = wave_drag_scale * CS%lin_drag_v(:,:)

position=NORTH_FACE, scale=wave_drag_scale*GV%m_to_H*US%T_to_s)
call pass_vector(CS%lin_drag_u, CS%lin_drag_v, G%domain, direction=To_All+SCALAR_PAIR)
else
allocate(lin_drag_h(isd:ied,jsd:jed), source=0.0)

Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_dynamics_split_RK2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p
call continuity_init(Time, G, GV, US, param_file, diag, CS%continuity_CSp)
cont_stencil = continuity_stencil(CS%continuity_CSp)
call CoriolisAdv_init(Time, G, GV, US, param_file, diag, CS%ADp, CS%CoriolisAdv)
if (CS%calculate_SAL) call SAL_init(G, US, param_file, CS%SAL_CSp)
if (CS%calculate_SAL) call SAL_init(G, GV, US, param_file, CS%SAL_CSp)
if (CS%use_tides) then
call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp, CS%HA_CSp)
HA_CSp => CS%HA_CSp
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_dynamics_split_RK2b.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ subroutine initialize_dyn_split_RK2b(u, v, h, tv, uh, vh, eta, Time, G, GV, US,
call continuity_init(Time, G, GV, US, param_file, diag, CS%continuity_CSp)
cont_stencil = continuity_stencil(CS%continuity_CSp)
call CoriolisAdv_init(Time, G, GV, US, param_file, diag, CS%ADp, CS%CoriolisAdv)
if (CS%calculate_SAL) call SAL_init(G, US, param_file, CS%SAL_CSp)
if (CS%calculate_SAL) call SAL_init(G, GV, US, param_file, CS%SAL_CSp)
if (CS%use_tides) then
call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp, CS%HA_CSp)
HA_CSp => CS%HA_CSp
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_dynamics_unsplit.F90
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ subroutine initialize_dyn_unsplit(u, v, h, Time, G, GV, US, param_file, diag, CS
call continuity_init(Time, G, GV, US, param_file, diag, CS%continuity_CSp)
cont_stencil = continuity_stencil(CS%continuity_CSp)
call CoriolisAdv_init(Time, G, GV, US, param_file, diag, CS%ADp, CS%CoriolisAdv)
if (CS%calculate_SAL) call SAL_init(G, US, param_file, CS%SAL_CSp)
if (CS%calculate_SAL) call SAL_init(G, GV, US, param_file, CS%SAL_CSp)
if (CS%use_tides) call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp)
call PressureForce_init(Time, G, GV, US, param_file, diag, CS%PressureForce_CSp, &
CS%SAL_CSp, CS%tides_CSp)
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_dynamics_unsplit_RK2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ subroutine initialize_dyn_unsplit_RK2(u, v, h, Time, G, GV, US, param_file, diag
call continuity_init(Time, G, GV, US, param_file, diag, CS%continuity_CSp)
cont_stencil = continuity_stencil(CS%continuity_CSp)
call CoriolisAdv_init(Time, G, GV, US, param_file, diag, CS%ADp, CS%CoriolisAdv)
if (CS%calculate_SAL) call SAL_init(G, US, param_file, CS%SAL_CSp)
if (CS%calculate_SAL) call SAL_init(G, GV, US, param_file, CS%SAL_CSp)
if (CS%use_tides) call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp)
call PressureForce_init(Time, G, GV, US, param_file, diag, CS%PressureForce_CSp, &
CS%SAL_CSp, CS%tides_CSp)
Expand Down
8 changes: 4 additions & 4 deletions src/core/MOM_open_boundary.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ subroutine initialize_obc_tides(OBC, US, param_file)

call get_param(param_file, mdl, "OBC_TIDE_NODAL_REF_DATE", nodal_ref_date, &
"Fixed reference date to use for nodal modulation of boundary tides.", &
fail_if_missing=.false., default=0)
fail_if_missing=.false., defaults=(/0, 0, 0/))

if (.not. OBC%add_eq_phase) then
! If equilibrium phase argument is not added, the input phases
Expand All @@ -1200,7 +1200,7 @@ subroutine initialize_obc_tides(OBC, US, param_file)
read(tide_constituent_str, *) OBC%tide_names

! Set reference time (t = 0) for boundary tidal forcing.
OBC%time_ref = set_date(tide_ref_date(1), tide_ref_date(2), tide_ref_date(3))
OBC%time_ref = set_date(tide_ref_date(1), tide_ref_date(2), tide_ref_date(3), 0, 0, 0)

! Find relevant lunar and solar longitudes at the reference time
if (OBC%add_eq_phase) call astro_longitudes_init(OBC%time_ref, OBC%tidal_longitudes)
Expand All @@ -1210,7 +1210,7 @@ subroutine initialize_obc_tides(OBC, US, param_file)
if (OBC%add_nodal_terms) then
if (sum(nodal_ref_date) /= 0) then
! A reference date was provided for the nodal correction
nodal_time = set_date(nodal_ref_date(1), nodal_ref_date(2), nodal_ref_date(3))
nodal_time = set_date(nodal_ref_date(1), nodal_ref_date(2), nodal_ref_date(3), 0, 0, 0)
call astro_longitudes_init(nodal_time, nodal_longitudes)
elseif (OBC%add_eq_phase) then
! Astronomical longitudes were already calculated for use in equilibrium phases,
Expand Down Expand Up @@ -5470,7 +5470,7 @@ subroutine update_segment_tracer_reservoirs(G, GV, uhr, vhr, h, OBC, dt, Reg)
endif
I_scale = 1.0 ; if (segment%tr_Reg%Tr(m)%scale /= 0.0) I_scale = 1.0 / segment%tr_Reg%Tr(m)%scale
if (allocated(segment%tr_Reg%Tr(m)%tres)) then ; do k=1,nz
! Calculate weights. Both a and u_L are nodim. Adding them together has no meaning.
! Calculate weights. Both a and u_L are nondim. Adding them together has no meaning.
! However, since they cannot be both non-zero, adding them works like a switch.
! When InvLscale_out is 0 and outflow, only interior data is applied to reservoirs
! When InvLscale_in is 0 and inflow, only nudged data is applied to reservoirs
Expand Down
9 changes: 5 additions & 4 deletions src/diagnostics/MOM_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ subroutine calculate_diagnostic_fields(u, v, h, uh, vh, tv, ADp, CDp, p_surf, &
if (CS%id_masso > 0) then
mass_cell(:,:) = 0.0
do k=1,nz ; do j=js,je ; do i=is,ie
mass_cell(i,j) = mass_cell(i,j) + (GV%H_to_kg_m2*h(i,j,k)) * US%L_to_m**2*G%areaT(i,j)
mass_cell(i,j) = mass_cell(i,j) + (GV%H_to_RZ*h(i,j,k)) * G%areaT(i,j)
enddo ; enddo ; enddo
masso = reproducing_sum(mass_cell)
masso = reproducing_sum(mass_cell, unscale=US%RZL2_to_kg)
call post_data(CS%id_masso, masso, CS%diag)
endif

Expand Down Expand Up @@ -1644,8 +1644,9 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag
Time, 'Mass per unit area of liquid ocean grid cell', 'kg m-2', conversion=GV%H_to_kg_m2, &
standard_name='sea_water_mass_per_unit_area', v_extensive=.true.)

CS%id_masso = register_scalar_field('ocean_model', 'masso', Time, &
diag, 'Mass of liquid ocean', 'kg', standard_name='sea_water_mass')
CS%id_masso = register_scalar_field('ocean_model', 'masso', Time, diag, &
'Mass of liquid ocean', units='kg', conversion=US%RZL2_to_kg, &
standard_name='sea_water_mass')

CS%id_thkcello = register_diag_field('ocean_model', 'thkcello', diag%axesTL, Time, &
long_name='Cell Thickness', standard_name='cell_thickness', &
Expand Down
Loading

0 comments on commit 10e3cb5

Please sign in to comment.