Skip to content

Commit efe2e8a

Browse files
committed
Merge branch 'atmosphere/dynamics_namelist_checks' into develop (PR #1084)
This merge adds a new routine, mpas_atm_dynamics_checks, that checks for consistency within dynamics options at model start-up, similar in concept to what is done by the existing physics_compatibility_check and mpas_atm_bdy_checks routines. The mpas_atm_dynamics_checks routine is called from the mpas_atm_run_compatibility, and it currently only checks that config_positive_definite is false in the &nhyd_model group; if this check fails, warnings are printed to the log file, but no errors are generated.
2 parents ef01424 + 0e4c552 commit efe2e8a

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

src/core_atmosphere/dynamics/mpas_atm_time_integration.F

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,69 @@ end subroutine halo_exchange_routine
9898
contains
9999

100100

101+
!***********************************************************************
102+
!
103+
! routine mpas_atm_dynamics_checks
104+
!
105+
!> \brief Checks compatibility of dynamics settings
106+
!> \author Michael Duda
107+
!> \date 14 June 2023
108+
!> \details
109+
!> This routine checks that dynamics settings are valid.
110+
!> Specifically,the following are checked by this routine:
111+
!>
112+
!> 1) config_positive_definite == .false.
113+
!>
114+
!> At present only a warning is printed in the case of a failed check,
115+
!> and a value of 0 is always returned by the ierr argument. However,
116+
!> warnings may be escalated to errors in future.
117+
!
118+
!-----------------------------------------------------------------------
119+
subroutine mpas_atm_dynamics_checks(dminfo, blockList, streamManager, ierr)
120+
121+
use mpas_log, only : mpas_log_write
122+
use mpas_derived_types, only : dm_info, block_type, MPAS_LOG_WARN
123+
use mpas_pool_routines, only : mpas_pool_get_config
124+
125+
implicit none
126+
127+
type (dm_info), pointer :: dminfo
128+
type (block_type), pointer :: blockList
129+
type (MPAS_streamManager_type), pointer :: streamManager
130+
integer, intent(out) :: ierr
131+
132+
logical, pointer :: config_positive_definite
133+
134+
135+
call mpas_log_write('')
136+
call mpas_log_write('Checking consistency of dynamics settings...')
137+
138+
!
139+
! Check that config_positive_definite == .false., since the positive-definite advection
140+
! option is currently unimplemented.
141+
!
142+
nullify(config_positive_definite)
143+
call mpas_pool_get_config(blocklist % configs, 'config_positive_definite', config_positive_definite)
144+
145+
if (config_positive_definite) then
146+
call mpas_log_write('The positive definite advection option is currently unimplemented, and', &
147+
messageType=MPAS_LOG_WARN)
148+
call mpas_log_write('setting config_positive_definite = true will enable monotonic advection.', &
149+
messageType=MPAS_LOG_WARN)
150+
call mpas_log_write('Please remove the specification of config_positive_definite from the', &
151+
messageType=MPAS_LOG_WARN)
152+
call mpas_log_write('&nhyd_model namelist group.', &
153+
messageType=MPAS_LOG_WARN)
154+
end if
155+
156+
call mpas_log_write(' ----- done checking dynamics settings -----')
157+
call mpas_log_write('')
158+
159+
ierr = 0
160+
161+
end subroutine mpas_atm_dynamics_checks
162+
163+
101164
!----------------------------------------------------------------------------
102165
! routine MPAS_atm_dynamics_init
103166
!

src/core_atmosphere/mpas_atm_core.F

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,7 @@ subroutine mpas_atm_run_compatibility(dminfo, blockList, streamManager, ierr)
14421442
use mpas_atmphys_control, only : physics_compatibility_check
14431443
#endif
14441444
use mpas_atm_boundaries, only : mpas_atm_bdy_checks
1445+
use atm_time_integration, only : mpas_atm_dynamics_checks
14451446

14461447
implicit none
14471448

@@ -1468,6 +1469,12 @@ subroutine mpas_atm_run_compatibility(dminfo, blockList, streamManager, ierr)
14681469
call mpas_atm_bdy_checks(dminfo, blockList, streamManager, local_ierr)
14691470
ierr = ierr + local_ierr
14701471

1472+
!
1473+
! Checks for dynamics options
1474+
!
1475+
call mpas_atm_dynamics_checks(dminfo, blockList, streamManager, local_ierr)
1476+
ierr = ierr + local_ierr
1477+
14711478
end subroutine mpas_atm_run_compatibility
14721479

14731480

0 commit comments

Comments
 (0)