From 8d126d302bc4652f5eedbb24689ed3db346ea51e Mon Sep 17 00:00:00 2001 From: Spencer Clark Date: Tue, 17 Oct 2023 18:33:45 +0000 Subject: [PATCH 1/2] Split update_atmos_radiation_physics --- SHiELD/atmos_model.F90 | 48 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/SHiELD/atmos_model.F90 b/SHiELD/atmos_model.F90 index a87e06a..1891c90 100644 --- a/SHiELD/atmos_model.F90 +++ b/SHiELD/atmos_model.F90 @@ -111,6 +111,9 @@ module atmos_model_mod public update_atmos_radiation_physics public update_atmos_model_state public update_atmos_model_dynamics +public update_atmos_pre_radiation +public update_atmos_radiation +public update_atmos_physics public atmos_model_init, atmos_model_end, atmos_data_type public atmos_model_restart public Atm_block, IPD_Control, IPD_Data @@ -221,8 +224,19 @@ module atmos_model_mod ! compute/exchange fluxes with other component models. All fields in this ! variable type are allocated for the global grid (without halo regions). ! +subroutine update_atmos_radiation_physics(Atmos) + type (atmos_data_type), intent(in) :: Atmos + + call update_atmos_pre_radiation(Atmos) + + if (.not. dycore_only) then + call update_atmos_radiation(Atmos) + call update_atmos_physics(Atmos) + end if -subroutine update_atmos_radiation_physics (Atmos) +end subroutine update_atmos_radiation_physics + +subroutine update_atmos_pre_radiation (Atmos) !----------------------------------------------------------------------- type (atmos_data_type), intent(in) :: Atmos !--- local variables--- @@ -278,6 +292,20 @@ subroutine update_atmos_radiation_physics (Atmos) #endif call mpp_clock_end(setupClock) + endif + end subroutine update_atmos_pre_radiation + + subroutine update_atmos_radiation (Atmos) +!----------------------------------------------------------------------- + type (atmos_data_type), intent(in) :: Atmos +!--- local variables--- + integer :: nb, jdat(8), rc + integer :: nthrds +#ifdef OPENMP + nthrds = omp_get_max_threads() +#else + nthrds = 1 +#endif if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "radiation driver" !--- execute the IPD atmospheric radiation subcomponent (RRTM) @@ -296,6 +324,21 @@ subroutine update_atmos_radiation_physics (Atmos) call FV3GFS_IPD_checksum(IPD_Control, IPD_Data, Atm_block) endif + end subroutine update_atmos_radiation + + subroutine update_atmos_physics (Atmos) +!----------------------------------------------------------------------- + type (atmos_data_type), intent(in) :: Atmos +!--- local variables--- + integer :: nb, jdat(8), rc + integer :: nthrds + +#ifdef OPENMP + nthrds = omp_get_max_threads() +#else + nthrds = 1 +#endif + if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "physics driver" !--- execute the IPD atmospheric physics step1 subcomponent (main physics driver) call mpp_clock_begin(physClock) @@ -331,12 +374,11 @@ subroutine update_atmos_radiation_physics (Atmos) endif call getiauforcing(IPD_Control,IAU_data) if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "end of radiation and physics step" - endif call mpp_clock_end(shieldClock) !----------------------------------------------------------------------- - end subroutine update_atmos_radiation_physics + end subroutine update_atmos_physics ! From 68832a8141600023bce280134ae8b8a0c4102efd Mon Sep 17 00:00:00 2001 From: Spencer Clark Date: Wed, 1 Nov 2023 14:24:39 +0000 Subject: [PATCH 2/2] Address comments from Rusty --- SHiELD/atmos_model.F90 | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/SHiELD/atmos_model.F90 b/SHiELD/atmos_model.F90 index 1891c90..838372a 100644 --- a/SHiELD/atmos_model.F90 +++ b/SHiELD/atmos_model.F90 @@ -225,6 +225,9 @@ module atmos_model_mod ! variable type are allocated for the global grid (without halo regions). ! subroutine update_atmos_radiation_physics(Atmos) +!--- This subroutine, which merely combines calls to finer-grained subroutines, +! is only required for backwards compatibility with +! FMScoupler/SHiELD/coupler_main.F90. type (atmos_data_type), intent(in) :: Atmos call update_atmos_pre_radiation(Atmos) @@ -300,12 +303,6 @@ subroutine update_atmos_radiation (Atmos) type (atmos_data_type), intent(in) :: Atmos !--- local variables--- integer :: nb, jdat(8), rc - integer :: nthrds -#ifdef OPENMP - nthrds = omp_get_max_threads() -#else - nthrds = 1 -#endif if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "radiation driver" !--- execute the IPD atmospheric radiation subcomponent (RRTM) @@ -331,13 +328,6 @@ subroutine update_atmos_physics (Atmos) type (atmos_data_type), intent(in) :: Atmos !--- local variables--- integer :: nb, jdat(8), rc - integer :: nthrds - -#ifdef OPENMP - nthrds = omp_get_max_threads() -#else - nthrds = 1 -#endif if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "physics driver" !--- execute the IPD atmospheric physics step1 subcomponent (main physics driver)