From 8fe0d77f30d594806bdccb91d899f72651c1033f Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 18 Sep 2018 18:58:23 -0700 Subject: [PATCH 1/7] Added the parteh_model index for fates --- src/main/clm_varctl.F90 | 3 +++ src/utils/clmfates_interfaceMod.F90 | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 938155c5dd..e0ae6fc0fc 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -196,6 +196,9 @@ module clm_varctl logical, public :: use_fates = .false. ! true => use fates ! These are INTERNAL to the FATES module + integer, public :: fates_parteh_model = -9 ! 1 => carbon only + ! 2 => C+N+P + ! no others enabled logical, public :: use_fates_spitfire = .false. ! true => use spitfire model logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 18b0d5ca53..51921b5d25 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -43,7 +43,8 @@ module CLMFatesInterfaceMod use SoilStateType , only : soilstate_type use clm_varctl , only : iulog - use clm_varctl , only : use_vertsoilc + use clm_varctl , only : use_vertsoilc + use clm_varctl , only : fates_parteh_model use clm_varctl , only : use_fates_spitfire use clm_varctl , only : use_fates_planthydro use clm_varctl , only : use_fates_ed_st3 @@ -236,7 +237,7 @@ subroutine init(this, bounds_proc ) logical :: verbose_output integer :: pass_masterproc integer :: pass_vertsoilc - integer :: pass_spitfire + integer :: pass_spitfire integer :: pass_ed_st3 integer :: pass_ed_prescribed_phys integer :: pass_logging @@ -291,6 +292,8 @@ subroutine init(this, bounds_proc ) call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) ! RGK: FATES IGNORES ! AND DOESNT TOUCH ! THE BARE SOIL PATCH + call set_fates_ctrlparms('parteh_model',ival=fates_parteh_model) + if(is_restart()) then pass_is_restart = 1 From 77388485a0b03b8710e3191de534939ca617e722 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 24 Sep 2018 12:43:19 -0700 Subject: [PATCH 2/7] Added call to initialize the PARTEH global mappings in FATES --- src/utils/clmfates_interfaceMod.F90 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 51921b5d25..525a796c4a 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -102,6 +102,7 @@ module CLMFatesInterfaceMod use FatesInterfaceMod , only : allocate_bcout use FatesInterfaceMod , only : SetFatesTime use FatesInterfaceMod , only : set_fates_ctrlparms + use FatesInterfaceMod , only : InitPARTEHGlobals use FatesHistoryInterfaceMod, only : fates_history_interface_type use FatesRestartInterfaceMod, only : fates_restart_interface_type @@ -463,6 +464,7 @@ subroutine init(this, bounds_proc ) end do + ! Initialize site-level static quantities dictated by the HLM ! currently ground layering depth @@ -494,8 +496,17 @@ subroutine init(this, bounds_proc ) end do !$OMP END PARALLEL DO + + ! This will initialize all globals associated with the chosen + ! Plant Allocation and Reactive Transport hypothesis. This includes + ! mapping tables and global variables. These will be read-only + ! and only required once per machine instance (thus no requirements + ! to have it instanced on each thread + + call InitPARTEHGlobals() + call this%init_history_io(bounds_proc) ! Report Fates Parameters (debug flag in lower level routines) From 57c14b2084453c9c7ec0458fe7c31aada54aedc8 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 28 Sep 2018 14:59:43 -0700 Subject: [PATCH 3/7] Added fates_parteh_mode to more nl memory structures. --- src/main/clm_varctl.F90 | 2 +- src/main/controlMod.F90 | 5 ++++- src/utils/clmfates_interfaceMod.F90 | 5 ++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index e0ae6fc0fc..f3938af858 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -196,7 +196,7 @@ module clm_varctl logical, public :: use_fates = .false. ! true => use fates ! These are INTERNAL to the FATES module - integer, public :: fates_parteh_model = -9 ! 1 => carbon only + integer, public :: fates_parteh_mode = -9 ! 1 => carbon only ! 2 => C+N+P ! no others enabled logical, public :: use_fates_spitfire = .false. ! true => use spitfire model diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 9cc442d026..91f10e2828 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -216,7 +216,8 @@ subroutine control_init( ) use_fates_planthydro, use_fates_ed_st3, & use_fates_ed_prescribed_phys, & use_fates_inventory_init, & - fates_inventory_ctrl_filename + fates_inventory_ctrl_filename, & + fates_parteh_mode ! CLM 5.0 nitrogen flags @@ -630,6 +631,7 @@ subroutine control_spmd() call mpi_bcast (use_fates_inventory_init, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (fates_inventory_ctrl_filename, len(fates_inventory_ctrl_filename), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fates_paramfile, len(fates_paramfile) , MPI_CHARACTER, 0, mpicom, ier) + call mpi_bcast (fates_parteh_mode, 1, MPI_INTEGER, 0, mpicom, ier) ! flexibleCN nitrogen model call mpi_bcast (use_flexibleCN, 1, MPI_LOGICAL, 0, mpicom, ier) @@ -956,6 +958,7 @@ subroutine control_print () write(iulog, *) ' use_fates_spitfire = ', use_fates_spitfire write(iulog, *) ' use_fates_logging = ', use_fates_logging write(iulog, *) ' fates_paramfile = ', fates_paramfile + write(iulog, *) ' fates_parteh_mode = ', fates_parteh_mode write(iulog, *) ' use_fates_planthydro = ', use_fates_planthydro write(iulog, *) ' use_fates_ed_st3 = ',use_fates_ed_st3 write(iulog, *) ' use_fates_ed_prescribed_phys = ',use_fates_ed_prescribed_phys diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 525a796c4a..a8fa67f48e 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -44,7 +44,7 @@ module CLMFatesInterfaceMod use SoilStateType , only : soilstate_type use clm_varctl , only : iulog use clm_varctl , only : use_vertsoilc - use clm_varctl , only : fates_parteh_model + use clm_varctl , only : fates_parteh_mode use clm_varctl , only : use_fates_spitfire use clm_varctl , only : use_fates_planthydro use clm_varctl , only : use_fates_ed_st3 @@ -293,7 +293,7 @@ subroutine init(this, bounds_proc ) call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) ! RGK: FATES IGNORES ! AND DOESNT TOUCH ! THE BARE SOIL PATCH - call set_fates_ctrlparms('parteh_model',ival=fates_parteh_model) + call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) if(is_restart()) then @@ -463,7 +463,6 @@ subroutine init(this, bounds_proc ) this%fates(nc)%sites(s)%lon = grc%londeg(g) end do - ! Initialize site-level static quantities dictated by the HLM From 539b2ece2b1b6c6e5182c0585e1c498e799d1b08 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 18 Sep 2018 18:58:23 -0700 Subject: [PATCH 4/7] Added the parteh_model index for fates --- src/main/clm_varctl.F90 | 3 +++ src/utils/clmfates_interfaceMod.F90 | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 938155c5dd..e0ae6fc0fc 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -196,6 +196,9 @@ module clm_varctl logical, public :: use_fates = .false. ! true => use fates ! These are INTERNAL to the FATES module + integer, public :: fates_parteh_model = -9 ! 1 => carbon only + ! 2 => C+N+P + ! no others enabled logical, public :: use_fates_spitfire = .false. ! true => use spitfire model logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 18b0d5ca53..51921b5d25 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -43,7 +43,8 @@ module CLMFatesInterfaceMod use SoilStateType , only : soilstate_type use clm_varctl , only : iulog - use clm_varctl , only : use_vertsoilc + use clm_varctl , only : use_vertsoilc + use clm_varctl , only : fates_parteh_model use clm_varctl , only : use_fates_spitfire use clm_varctl , only : use_fates_planthydro use clm_varctl , only : use_fates_ed_st3 @@ -236,7 +237,7 @@ subroutine init(this, bounds_proc ) logical :: verbose_output integer :: pass_masterproc integer :: pass_vertsoilc - integer :: pass_spitfire + integer :: pass_spitfire integer :: pass_ed_st3 integer :: pass_ed_prescribed_phys integer :: pass_logging @@ -291,6 +292,8 @@ subroutine init(this, bounds_proc ) call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) ! RGK: FATES IGNORES ! AND DOESNT TOUCH ! THE BARE SOIL PATCH + call set_fates_ctrlparms('parteh_model',ival=fates_parteh_model) + if(is_restart()) then pass_is_restart = 1 From 82f18946bb46cf91504d3ac62b6b59d9c4dc0677 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 24 Sep 2018 12:43:19 -0700 Subject: [PATCH 5/7] Added call to initialize the PARTEH global mappings in FATES --- src/utils/clmfates_interfaceMod.F90 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 51921b5d25..525a796c4a 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -102,6 +102,7 @@ module CLMFatesInterfaceMod use FatesInterfaceMod , only : allocate_bcout use FatesInterfaceMod , only : SetFatesTime use FatesInterfaceMod , only : set_fates_ctrlparms + use FatesInterfaceMod , only : InitPARTEHGlobals use FatesHistoryInterfaceMod, only : fates_history_interface_type use FatesRestartInterfaceMod, only : fates_restart_interface_type @@ -463,6 +464,7 @@ subroutine init(this, bounds_proc ) end do + ! Initialize site-level static quantities dictated by the HLM ! currently ground layering depth @@ -494,8 +496,17 @@ subroutine init(this, bounds_proc ) end do !$OMP END PARALLEL DO + + ! This will initialize all globals associated with the chosen + ! Plant Allocation and Reactive Transport hypothesis. This includes + ! mapping tables and global variables. These will be read-only + ! and only required once per machine instance (thus no requirements + ! to have it instanced on each thread + + call InitPARTEHGlobals() + call this%init_history_io(bounds_proc) ! Report Fates Parameters (debug flag in lower level routines) From 7ac383dba9cb3300b86abbcb05601fe146c98cd5 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 28 Sep 2018 14:59:43 -0700 Subject: [PATCH 6/7] Added fates_parteh_mode to more nl memory structures. --- src/main/clm_varctl.F90 | 2 +- src/main/controlMod.F90 | 5 ++++- src/utils/clmfates_interfaceMod.F90 | 5 ++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index e0ae6fc0fc..f3938af858 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -196,7 +196,7 @@ module clm_varctl logical, public :: use_fates = .false. ! true => use fates ! These are INTERNAL to the FATES module - integer, public :: fates_parteh_model = -9 ! 1 => carbon only + integer, public :: fates_parteh_mode = -9 ! 1 => carbon only ! 2 => C+N+P ! no others enabled logical, public :: use_fates_spitfire = .false. ! true => use spitfire model diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 9cc442d026..91f10e2828 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -216,7 +216,8 @@ subroutine control_init( ) use_fates_planthydro, use_fates_ed_st3, & use_fates_ed_prescribed_phys, & use_fates_inventory_init, & - fates_inventory_ctrl_filename + fates_inventory_ctrl_filename, & + fates_parteh_mode ! CLM 5.0 nitrogen flags @@ -630,6 +631,7 @@ subroutine control_spmd() call mpi_bcast (use_fates_inventory_init, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (fates_inventory_ctrl_filename, len(fates_inventory_ctrl_filename), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fates_paramfile, len(fates_paramfile) , MPI_CHARACTER, 0, mpicom, ier) + call mpi_bcast (fates_parteh_mode, 1, MPI_INTEGER, 0, mpicom, ier) ! flexibleCN nitrogen model call mpi_bcast (use_flexibleCN, 1, MPI_LOGICAL, 0, mpicom, ier) @@ -956,6 +958,7 @@ subroutine control_print () write(iulog, *) ' use_fates_spitfire = ', use_fates_spitfire write(iulog, *) ' use_fates_logging = ', use_fates_logging write(iulog, *) ' fates_paramfile = ', fates_paramfile + write(iulog, *) ' fates_parteh_mode = ', fates_parteh_mode write(iulog, *) ' use_fates_planthydro = ', use_fates_planthydro write(iulog, *) ' use_fates_ed_st3 = ',use_fates_ed_st3 write(iulog, *) ' use_fates_ed_prescribed_phys = ',use_fates_ed_prescribed_phys diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 525a796c4a..a8fa67f48e 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -44,7 +44,7 @@ module CLMFatesInterfaceMod use SoilStateType , only : soilstate_type use clm_varctl , only : iulog use clm_varctl , only : use_vertsoilc - use clm_varctl , only : fates_parteh_model + use clm_varctl , only : fates_parteh_mode use clm_varctl , only : use_fates_spitfire use clm_varctl , only : use_fates_planthydro use clm_varctl , only : use_fates_ed_st3 @@ -293,7 +293,7 @@ subroutine init(this, bounds_proc ) call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) ! RGK: FATES IGNORES ! AND DOESNT TOUCH ! THE BARE SOIL PATCH - call set_fates_ctrlparms('parteh_model',ival=fates_parteh_model) + call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) if(is_restart()) then @@ -463,7 +463,6 @@ subroutine init(this, bounds_proc ) this%fates(nc)%sites(s)%lon = grc%londeg(g) end do - ! Initialize site-level static quantities dictated by the HLM From a4d012f59b13997b0c2343eb46b26c0ad1316a95 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 23 Oct 2018 11:01:52 -0600 Subject: [PATCH 7/7] Updated test lists for fates-parteh changes. --- src/main/clm_varctl.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index f3938af858..b0e93f2f9d 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -197,7 +197,7 @@ module clm_varctl ! These are INTERNAL to the FATES module integer, public :: fates_parteh_mode = -9 ! 1 => carbon only - ! 2 => C+N+P + ! 2 => C+N+P (not enabled yet) ! no others enabled logical, public :: use_fates_spitfire = .false. ! true => use spitfire model logical, public :: use_fates_logging = .false. ! true => turn on logging module