Skip to content

Commit

Permalink
Merge tag 'marbl0.48.2' into fe_updates_from_uci
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlevy1981 committed Dec 26, 2024
2 parents 9733088 + 2c04fb2 commit 1f36f5b
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 23 deletions.
9 changes: 9 additions & 0 deletions MARBL_tools/run_test_suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ if [ "${STATUS}" == "PASS" ]; then
print_status "init.py" >> ${RESULTS_CACHE}
# Initialize MARBL with settings from tests/input_files/settings/
for settingsfile in `find ../../input_files/settings -type f`; do
if [ "`basename $settingsfile`" == "marbl_with_ladjust_bury_coeff.settings" ]; then
continue
fi
(set -x ; ./init.py -s $settingsfile)
STATUS=$(check_return $?)
print_status "init.py ($(basename ${settingsfile}))" >> ${RESULTS_CACHE}
Expand Down Expand Up @@ -362,6 +365,12 @@ if [ "${STATUS}" == "PASS" ]; then
STATUS=$(check_return $?)
print_status "requested_tracers.py" >> ${RESULTS_CACHE}

# Print all fields MARBL needs running means of
cd ${MARBL_ROOT}/tests/regression_tests/bury_coeff
(set -x ; ./bury_coeff.py)
STATUS=$(check_return $?)
print_status "bury_coeff.py" >> ${RESULTS_CACHE}

# Print all output_for_GCM variables
cd ${MARBL_ROOT}/tests/regression_tests/available_output
(set -x ; ./available_output.py)
Expand Down
8 changes: 4 additions & 4 deletions defaults/diagnostics_latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ DUST_FLUX :
longname : Atmospheric Dust Flux
units : g/cm^2/s
vertical_grid : none
frequency : never
frequency : medium
operator : average
diag_mode : minimal
NOx_FLUX :
Expand Down Expand Up @@ -839,7 +839,7 @@ dustToSed :
vertical_grid : none
frequency : medium
operator : average
diag_mode : full
diag_mode : minimal
pfeToSed :
dependencies :
base_bio_on : .true.
Expand All @@ -848,7 +848,7 @@ pfeToSed :
vertical_grid : none
frequency : medium
operator : average
diag_mode : full
diag_mode : minimal
CaCO3_form_zint :
dependencies :
base_bio_on : .true.
Expand Down Expand Up @@ -1407,7 +1407,7 @@ POC_FLUX_IN :
vertical_grid : layer_avg
frequency : medium
operator : average
diag_mode : full
diag_mode : minimal
POC_sFLUX_IN :
dependencies :
base_bio_on : .true.
Expand Down
8 changes: 4 additions & 4 deletions defaults/json/diagnostics_latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@
"base_bio_on": ".true."
},
"diag_mode": "minimal",
"frequency": "never",
"frequency": "medium",
"longname": "Atmospheric Dust Flux",
"operator": "average",
"units": "g/cm^2/s",
Expand Down Expand Up @@ -2210,7 +2210,7 @@
"dependencies": {
"base_bio_on": ".true."
},
"diag_mode": "full",
"diag_mode": "minimal",
"frequency": "medium",
"longname": "POC Flux into Cell",
"operator": "average",
Expand Down Expand Up @@ -2736,7 +2736,7 @@
"dependencies": {
"base_bio_on": ".true."
},
"diag_mode": "full",
"diag_mode": "minimal",
"frequency": "medium",
"longname": "dust Flux to Sediments",
"operator": "average",
Expand Down Expand Up @@ -3053,7 +3053,7 @@
"dependencies": {
"base_bio_on": ".true."
},
"diag_mode": "full",
"diag_mode": "minimal",
"frequency": "medium",
"longname": "pFe Flux to Sediments",
"operator": "average",
Expand Down
14 changes: 14 additions & 0 deletions src/marbl_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ module marbl_interface
procedure, public :: extract_timing
procedure, private :: glo_vars_init
procedure, public :: get_tracer_index
procedure, public :: compute_totChl
procedure, public :: interior_tendency_compute
procedure, public :: surface_flux_compute
procedure, public :: set_global_scalars
Expand Down Expand Up @@ -188,6 +189,7 @@ module marbl_interface
private :: reset_timers
private :: extract_timing
private :: glo_vars_init
private :: compute_totChl
private :: interior_tendency_compute
private :: surface_flux_compute
private :: shutdown
Expand Down Expand Up @@ -972,6 +974,18 @@ end subroutine glo_vars_init

!***********************************************************************

subroutine compute_totChl(this)

use marbl_interior_tendency_mod, only : marbl_interior_tendency_compute_totChl

class(marbl_interface_class), intent(inout) :: this

call marbl_interior_tendency_compute_totChl(this%tracers, this%tracer_indices, this%interior_tendency_output)

end subroutine compute_totChl

!***********************************************************************

subroutine interior_tendency_compute(this)

use marbl_interior_tendency_mod, only : marbl_interior_tendency_compute
Expand Down
36 changes: 26 additions & 10 deletions src/marbl_interior_tendency_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ module marbl_interior_tendency_mod

public :: marbl_interior_tendency_compute
public :: marbl_interior_tendency_adjust_bury_coeff
public :: marbl_interior_tendency_compute_totChl

contains

Expand Down Expand Up @@ -135,7 +136,6 @@ subroutine marbl_interior_tendency_compute( &
use marbl_interface_private_types, only : marbl_internal_timers_type
use marbl_interface_private_types, only : marbl_timer_indexing_type
use marbl_interface_private_types, only : marbl_interior_tendency_saved_state_indexing_type
use marbl_interface_public_types, only : ofg_ind
use marbl_interface_public_types, only : marbl_diagnostics_type
use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_export_variables
use marbl_interior_tendency_share_mod, only : marbl_interior_tendency_share_export_zooplankton
Expand Down Expand Up @@ -183,7 +183,7 @@ subroutine marbl_interior_tendency_compute( &
real(r8), dimension(size(tracers,1), domain%km) :: interior_restore
real(r8), dimension(size(tracers,1), domain%km) :: tracer_local

integer (int_kind) :: auto_ind, k ! indices for loops
integer (int_kind) :: k ! index for loops

real (r8) :: surf_press(domain%km) ! pressure in surface layer
real (r8) :: temperature(domain%km) ! in situ temperature
Expand Down Expand Up @@ -275,14 +275,7 @@ subroutine marbl_interior_tendency_compute( &
! Compute Chlorophyll (if requested by GCM)
!-----------------------------------------------------------------------

if (ofg_ind%total_Chl_id.ne.0) then
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) = c0
do auto_ind = 1,autotroph_cnt
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) = &
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) &
+ tracer_local(marbl_tracer_indices%auto_inds(auto_ind)%Chl_ind,:)
end do
end if
call marbl_interior_tendency_compute_totChl(tracer_local, marbl_tracer_indices, interior_tendency_output)

! Verify forcing is consistent
if (lcheck_forcing) &
Expand Down Expand Up @@ -774,6 +767,29 @@ end subroutine marbl_interior_tendency_adjust_bury_coeff

!***********************************************************************

subroutine marbl_interior_tendency_compute_totChl(tracer_local, marbl_tracer_indices, interior_tendency_output)

use marbl_interface_public_types, only : ofg_ind

real(r8), dimension(:,:), intent(in) :: tracer_local
type(marbl_tracer_index_type), intent(in) :: marbl_tracer_indices
type(marbl_output_for_GCM_type), intent(inout) :: interior_tendency_output

integer (int_kind) :: auto_ind

if (ofg_ind%total_Chl_id.ne.0) then
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) = c0
do auto_ind = 1,autotroph_cnt
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) = &
interior_tendency_output%outputs_for_GCM(ofg_ind%total_Chl_id)%forcing_field_1d(1,:) &
+ tracer_local(marbl_tracer_indices%auto_inds(auto_ind)%Chl_ind,:)
end do
end if

end subroutine marbl_interior_tendency_compute_totChl

!***********************************************************************

subroutine setup_local_tracers(column_kmt, marbl_tracer_indices, tracers, &
autotroph_local, tracer_local, zooplankton_local)

Expand Down
2 changes: 1 addition & 1 deletion src/marbl_nhx_surface_emis_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ subroutine marbl_nhx_surface_emis_compute( &

call marbl_comp_Hstar_nhx(num_elements, ph, sst, sss, Hstar_nhx)

K(:) = c1 / (c1 / kg_nh3(:) + Hstar_nhx / kw_nh3(:))
K(:) = (kg_nh3(:) * kw_nh3(:)) / (kw_nh3(:) + Hstar_nhx * kg_nh3(:))
nhx_surface_emis(:) = (c1 - ifrac(:)) * K(:) * Hstar_nhx(:) * max(nh4(:),c0)

end subroutine marbl_nhx_surface_emis_compute
Expand Down
61 changes: 60 additions & 1 deletion tests/driver_src/marbl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ Program marbl
' (units: ', trim(marbl_instances(1)%interior_tendency_forcings(n)%metadata%field_units),')'
call driver_status_log%log_noerror(log_message, subname)
end do

call marbl_instances(1)%shutdown()
end if

Expand Down Expand Up @@ -439,6 +438,66 @@ Program marbl
call marbl_instances(1)%shutdown()
end if

! -- bury_coeff test -- !
case ('bury_coeff')
call verify_single_instance(num_inst, trim(testname))
lprint_marbl_log = .false.
call marbl_init_test(marbl_instances(1), unit_system_opt, lshutdown = .false., lhas_global_ops=.true.)
if (.not. marbl_instances(1)%StatusLog%labort_marbl) then
! Log requested surface forcing fields
call driver_status_log%log_header('Requested surface forcing fields', subname)
do n=1,size(marbl_instances(1)%surface_flux_forcings)
write(log_message, "(I0, 5A)") n, '. ', &
trim(marbl_instances(1)%surface_flux_forcings(n)%metadata%varname), &
' (units: ', trim(marbl_instances(1)%surface_flux_forcings(n)%metadata%field_units),')'
call driver_status_log%log_noerror(log_message, subname)
end do

! Log requested interior forcing fields
call driver_status_log%log_header('Requested interior forcing fields', subname)
! Provide message if no itnerior tendency forcings are requested
if (size(marbl_instances(1)%interior_tendency_forcings) == 0) &
call driver_status_log%log_noerror('No forcing fields requested for interior_tendency_compute()!', subname)
do n=1,size(marbl_instances(1)%interior_tendency_forcings)
write(log_message, "(I0, 5A)") n, '. ', &
trim(marbl_instances(1)%interior_tendency_forcings(n)%metadata%varname), &
' (units: ', trim(marbl_instances(1)%interior_tendency_forcings(n)%metadata%field_units),')'
call driver_status_log%log_noerror(log_message, subname)
end do

! Print info about burial coefficient vars as well
call driver_status_log%log_header('Size of arrays for running means', subname)
write(log_message, "(A, I0)") "size(glo_avg_rmean_interior_tendency): ", &
size(marbl_instances(1)%glo_avg_rmean_interior_tendency)
call driver_status_log%log_noerror(log_message, subname)
do n=1,size(marbl_instances(1)%glo_avg_rmean_interior_tendency)
write(log_message, "(2A)") " -- ", trim(marbl_instances(1)%glo_avg_rmean_interior_tendency(n)%sname)
call driver_status_log%log_noerror(log_message, subname)
end do
write(log_message, "(A, I0)") "size(glo_avg_rmean_surface_flux): ", &
size(marbl_instances(1)%glo_avg_rmean_surface_flux)
call driver_status_log%log_noerror(log_message, subname)
do n=1,size(marbl_instances(1)%glo_avg_rmean_surface_flux)
write(log_message, "(2A)") " -- ", trim(marbl_instances(1)%glo_avg_rmean_surface_flux(n)%sname)
call driver_status_log%log_noerror(log_message, subname)
end do
write(log_message, "(A, I0)") "size(glo_scalar_rmean_interior_tendency): ", &
size(marbl_instances(1)%glo_scalar_rmean_interior_tendency)
call driver_status_log%log_noerror(log_message, subname)
do n=1,size(marbl_instances(1)%glo_scalar_rmean_interior_tendency)
write(log_message, "(2A)") " -- ", trim(marbl_instances(1)%glo_scalar_rmean_interior_tendency(n)%sname)
call driver_status_log%log_noerror(log_message, subname)
end do
write(log_message, "(A, I0)") "size(glo_scalar_rmean_surface_flux): ", &
size(marbl_instances(1)%glo_scalar_rmean_surface_flux)
call driver_status_log%log_noerror(log_message, subname)
do n=1,size(marbl_instances(1)%glo_scalar_rmean_surface_flux)
write(log_message, "(2A)") " -- ", trim(marbl_instances(1)%glo_scalar_rmean_surface_flux(n)%sname)
call driver_status_log%log_noerror(log_message, subname)
end do
call marbl_instances(1)%shutdown()
end if

! -- available_output test -- !
case ('available_output')
call verify_single_instance(num_inst, trim(testname))
Expand Down
14 changes: 11 additions & 3 deletions tests/driver_src/marbl_init_drv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ module marbl_init_drv

Contains

subroutine test(marbl_instance, unit_system_opt, lshutdown, num_PAR_subcols)
subroutine test(marbl_instance, unit_system_opt, lshutdown, num_PAR_subcols, lhas_global_ops)

type(marbl_interface_class), intent(inout) :: marbl_instance
character(len=*), intent(in) :: unit_system_opt
logical, optional, intent(in) :: lshutdown
integer, optional, intent(in) :: num_PAR_subcols
logical, optional, intent(in) :: lhas_global_ops

character(*), parameter :: subname = 'marbl_init_drv:test'
real(kind=r8), dimension(km) :: delta_z, zw, zt
integer :: k, num_PAR_subcols_loc
logical :: lshutdown_loc
logical :: lshutdown_loc, lhas_global_ops_loc

! Run marbl_instance%shutdown? (Skip when running get_setting() from driver)
if (present(lshutdown)) then
Expand All @@ -39,6 +40,12 @@ subroutine test(marbl_instance, unit_system_opt, lshutdown, num_PAR_subcols)
num_PAR_subcols_loc = 1
end if

if (present(lhas_global_ops)) then
lhas_global_ops_loc = lhas_global_ops
else
lhas_global_ops_loc = .false.
end if

! Initialize levels
delta_z = c1
zw(1) = delta_z(1)
Expand All @@ -57,7 +64,8 @@ subroutine test(marbl_instance, unit_system_opt, lshutdown, num_PAR_subcols)
gcm_delta_z = delta_z, &
gcm_zw = zw, &
gcm_zt = zt, &
unit_system_opt = unit_system_opt)
unit_system_opt = unit_system_opt, &
lgcm_has_global_ops=lhas_global_ops_loc)
if (marbl_instance%StatusLog%labort_marbl) then
call marbl_instance%StatusLog%log_error_trace('marbl%init', subname)
return
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ladjust_bury_coeff = .true.
17 changes: 17 additions & 0 deletions tests/regression_tests/bury_coeff/bury_coeff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python

from sys import path
import os

path.insert(0, os.path.join('..', '..', 'python_for_tests'))
from marbl_testing_class import MARBL_testcase

mt = MARBL_testcase()

mt.parse_args(desc='Run full MARBL setup (config, init, and complete) and print '
'output relating to burial coefficients',
DefaultSettingsFile='../../input_files/settings/marbl_with_ladjust_bury_coeff.settings')

mt.build_exe()

mt.run_exe()
3 changes: 3 additions & 0 deletions tests/regression_tests/bury_coeff/test.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
&marbl_driver_nml
testname="bury_coeff"
/

0 comments on commit 1f36f5b

Please sign in to comment.