Skip to content

Commit

Permalink
Introduce new bury_coeff test
Browse files Browse the repository at this point in the history
Sets lgcm_has_global_ops = .true. during init, and runs with ladjust_bury_coeff
= .true.; it then prints out requested forcings (because we add three new
surface flux forcings) and also prints out short names of all the running means
that MARBL wants the GCM to track
  • Loading branch information
mnlevy1981 committed Sep 17, 2024
1 parent ece907b commit 6152237
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 4 deletions.
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 6152237

Please sign in to comment.