diff --git a/components/elm/src/external_models/fates b/components/elm/src/external_models/fates index 44ba97a81e72..0b105bec7a90 160000 --- a/components/elm/src/external_models/fates +++ b/components/elm/src/external_models/fates @@ -1 +1 @@ -Subproject commit 44ba97a81e72cfa83b1f9fdc57b9bcde3406af4a +Subproject commit 0b105bec7a90c5e02d1098f9bbdcf255f358aaa4 diff --git a/components/elm/src/main/elm_initializeMod.F90 b/components/elm/src/main/elm_initializeMod.F90 index ca8946d1a9dc..2a8079692379 100755 --- a/components/elm/src/main/elm_initializeMod.F90 +++ b/components/elm/src/main/elm_initializeMod.F90 @@ -21,7 +21,7 @@ module elm_initializeMod use readParamsMod , only : readSharedParameters, readPrivateParameters use ncdio_pio , only : file_desc_t use ELMFatesInterfaceMod , only : ELMFatesGlobals1,ELMFatesGlobals2 - use CLMFatesParamInterfaceMod, only: FatesReadPFTs + use ELMFatesParamInterfaceMod, only: FatesReadPFTs use BeTRSimulationELM, only : create_betr_simulation_elm ! !----------------------------------------- diff --git a/components/elm/src/main/elmfates_interfaceMod.F90 b/components/elm/src/main/elmfates_interfaceMod.F90 index 25139102fa03..a7aec9e85933 100644 --- a/components/elm/src/main/elmfates_interfaceMod.F90 +++ b/components/elm/src/main/elmfates_interfaceMod.F90 @@ -7,11 +7,9 @@ module ELMFatesInterfaceMod ! ! This is also the only location where CLM code is allowed to see FATES memory ! structures. - ! The routines here, that call FATES library routines, will not pass any types defined - ! by the driving land model (HLM). - ! - ! either native type arrays (int,real,log, etc) or packed into ED boundary condition - ! structures. + ! The routines here, that call FATES library routines, cannot pass most types defined + ! by the driving land model (HLM), only native type arrays (int,real,log, etc), implementations + ! of fates abstract classes, and references into fates boundary condition structures. ! ! Note that CLM/ALM does use Shared Memory Parallelism (SMP), where processes such as ! the update of state variables are forked. However, IO is not assumed to be @@ -176,7 +174,10 @@ module ELMFatesInterfaceMod use dynSubgridControlMod, only : get_do_harvest ! this gets the namelist value use FatesInterfaceTypesMod , only : bc_in_type, bc_out_type - use CLMFatesParamInterfaceMod , only : FatesReadParameters + + use ELMFatesParamInterfaceMod, only : fates_param_reader_ctsm_impl + use FatesParametersInterface, only : fates_param_reader_type + use FatesParametersInterface, only : fates_parameters_type use perf_mod , only : t_startf, t_stopf @@ -292,6 +293,7 @@ subroutine ELMFatesGlobals1() integer :: pass_sp integer :: pass_masterproc logical :: verbose_output + type(fates_param_reader_ctsm_impl) :: var_reader if (use_fates) then @@ -346,7 +348,7 @@ subroutine ELMFatesGlobals1() ! want fates to handle crops, so again, it should be ignored. ! (RGK 07-2022) - call SetFatesGlobalElements1(use_fates,natpft_size,0) + call SetFatesGlobalElements1(use_fates,natpft_size,0,var_reader) natpft_size = fates_maxPatchesPerSite @@ -3452,6 +3454,6 @@ subroutine GetAndSetTime() end subroutine GetAndSetTime - + !----------------------------------------------------------------------- end module ELMFatesInterfaceMod diff --git a/components/elm/src/main/elmfates_paraminterfaceMod.F90 b/components/elm/src/main/elmfates_paraminterfaceMod.F90 index a62c1f75fe7c..deb069260835 100644 --- a/components/elm/src/main/elmfates_paraminterfaceMod.F90 +++ b/components/elm/src/main/elmfates_paraminterfaceMod.F90 @@ -1,20 +1,29 @@ -module CLMFatesParamInterfaceMod +module ELMFatesParamInterfaceMod ! NOTE(bja, 2017-01) this code can not go into the main clm-fates ! interface module because of circular dependancies with pftvarcon. use FatesGlobals, only : fates_log + use FatesParametersInterface, only : fates_parameters_type + use FatesParametersInterface, only : fates_param_reader_type use shr_kind_mod, only : r8 => shr_kind_r8 implicit none + private - ! NOTE(bja, 2017-01) these methods can NOT be part of the clmi-fates - ! nterface type because they are called before the instance is + ! Extend the fates parameter reader type with Read parameter function + type, extends(fates_param_reader_type) :: fates_param_reader_ctsm_impl + ! !PRIVATE MEMBER DATA: + contains + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: Read ! Read params from disk + end type + + public :: fates_param_reader_ctsm_impl + + ! NOTE(bja, 2017-01) these methods can NOT be part of the hlm-fates + ! interface type because they are called before the instance is ! initialized. - public :: FatesReadParameters public :: FatesReadPFTs - private :: ParametersFromNetCDF - private :: SetParameterDimensions - private :: GetUsedDimensionSizes logical :: DEBUG = .false. @@ -23,53 +32,6 @@ module CLMFatesParamInterfaceMod contains - !----------------------------------------------------------------------- - subroutine FatesReadParameters() - - use elm_varctl, only : use_fates, paramfile, fates_paramfile - use spmdMod, only : masterproc - - use FatesParametersInterface, only : fates_parameters_type - - use EDParamsMod, only : FatesRegisterParams, FatesReceiveParams - use SFParamsMod, only : SpitFireRegisterParams, SpitFireReceiveParams - use PRTInitParamsFATESMod, only : PRTRegisterParams, PRTReceiveParams - use FatesSynchronizedParamsMod, only : FatesSynchronizedParamsInst - - implicit none - - character(len=32) :: subname = 'FatesReadParameters' - class(fates_parameters_type), allocatable :: fates_params - logical :: is_host_file - - if (use_fates) then - if (masterproc) then - write(fates_log(), *) 'clmfates_parameterinterfaceMod.F90::'//trim(subname)//' :: CLM reading ED/FATES '//' parameters ' - end if - - allocate(fates_params) - call fates_params%Init() - call FatesRegisterParams(fates_params) - call SpitFireRegisterParams(fates_params) - call PRTRegisterParams(fates_params) - call FatesSynchronizedParamsInst%RegisterParams(fates_params) - - is_host_file = .false. - call ParametersFromNetCDF(fates_paramfile, is_host_file, fates_params) - - is_host_file = .true. - call ParametersFromNetCDF(paramfile, is_host_file, fates_params) - - call FatesReceiveParams(fates_params) - call SpitFireReceiveParams(fates_params) - call PRTReceiveParams(fates_params) - call FatesSynchronizedParamsInst%ReceiveParams(fates_params) - - call fates_params%Destroy() - deallocate(fates_params) - end if - - end subroutine FatesReadParameters !----------------------------------------------------------------------- subroutine FatesReadPFTs() @@ -77,7 +39,6 @@ subroutine FatesReadPFTs() use elm_varctl, only : use_fates, paramfile, fates_paramfile use spmdMod, only : masterproc - use FatesParametersInterface, only : fates_parameters_type use EDPftvarcon , only : EDPftvarcon_inst use fileutils , only : getfil @@ -239,6 +200,26 @@ subroutine ParametersFromNetCDF(filename, is_host_file, fates_params) deallocate(data) call ncd_pio_closefile(ncid) end subroutine ParametersFromNetCDF + + !----------------------------------------------------------------------- + + subroutine Read(this, fates_params ) + ! + ! !DESCRIPTION: + ! Read 'fates_params' parameters from storage. + ! + ! USES + use elm_varctl, only : fname_len, paramfile, fates_paramfile + ! !ARGUMENTS: + class(fates_param_reader_ctsm_impl) :: this + class(fates_parameters_type), intent(inout) :: fates_params + !----------------------------------------------------------------------- + logical :: is_host_file = .false. + + call ParametersFromNetCDF(fates_paramfile, is_host_file, fates_params) + + end subroutine Read + !----------------------------------------------------------------------- -end module CLMFatesParamInterfaceMod +end module ELMFatesParamInterfaceMod