Skip to content

Commit

Permalink
Merge branch 'adjust_bury_coeff_test' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlevy1981 committed Oct 3, 2024
2 parents 8cab038 + 564c83f commit 0b340da
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 4 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
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 0b340da

Please sign in to comment.