1- ! It is a proxy of clm 4.0 and clm 4.5
1+ ! It is a proxy of CNCLM40 and CNCLM51
22
33#include " MAPL_Generic.h"
44
@@ -86,33 +86,39 @@ subroutine SetServices ( GC, RC )
8686 call MAPL_GetResource ( MAPL, CATCHCN_INTERNAL_STATE% CATCH_SPINUP, Label= " CATCHMENT_SPINUP:" , DEFAULT= 0 , RC= STATUS)
8787 VERIFY_(STATUS)
8888
89- ! resource variables from GEOS_SurfaceGridComp.rc
89+ ! put resource variables from rc file into SCF config object (GCM: SURFRC= GEOS_SurfaceGridComp.rc, LDAS: SURFRC=LDAS.rc)
9090 call MAPL_GetResource ( MAPL, SURFRC, label = ' SURFRC:' , default = ' GEOS_SurfaceGridComp.rc' , RC= STATUS) ; VERIFY_(STATUS)
9191 SCF = ESMF_ConfigCreate(rc= status) ; VERIFY_(STATUS)
9292 call ESMF_ConfigLoadFile(SCF,SURFRC,rc= status) ; VERIFY_(STATUS)
9393
94+ ! assemble internal state from SCF config object
9495 call surface_params_to_wrap_state(statePtr, SCF, _RC)
9596
9697 call ESMF_ConfigDestroy(SCF, _RC)
97-
98- call MAPL_Get (MAPL, CF= CF, _RC)
99-
100- call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% CN_CLM51_NML_FILE, Label= ' CN_CLM51_NML_FILE:' , _RC)
101- call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% ATM_CO2, Label= ' ATM_CO2:' , _RC)
102- call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% N_CONST_LAND4SNWALB, Label= ' N_CONST_LAND4SNWALB:' , _RC)
103- call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% RUN_IRRIG, Label= ' RUN_IRRIG:' , _RC)
104- call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% PRESCRIBE_DVG, Label= ' PRESCRIBE_DVG:' , _RC)
105- call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% SNOW_ALBEDO_INFO, Label= ' SNOW_ALBEDO_INFO:' , _RC)
106- call MAPL_Set (MAPL, CF= CF, _RC)
107-
98+
10899 call MAPL_GetResource ( MAPL, LSM_CHOICE, Label= " LSM_CHOICE:" , DEFAULT= 2 , RC= STATUS)
109100 VERIFY_(STATUS)
101+
102+ ! Add select rc variables to [the CF config object within] MAPL so that the Children GridComps (CNCLM40 and CNCLM51) can get
103+ ! them in SetServices() from MAPL. In the Children's SetServices(), "catchcn_internal" is not yet available.
104+ call MAPL_Get (MAPL, CF= CF, _RC)
105+ call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% ATM_CO2, Label= ' ATM_CO2:' , _RC)
106+ call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% N_CONST_LAND4SNWALB, Label= ' N_CONST_LAND4SNWALB:' , _RC)
107+ call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% SNOW_ALBEDO_INFO, Label= ' SNOW_ALBEDO_INFO:' , _RC)
108+ if (LSM_CHOICE== 2 ) then
109+ call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% RUN_IRRIG, Label= ' RUN_IRRIG:' , _RC)
110+ call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% PRESCRIBE_DVG, Label= ' PRESCRIBE_DVG:' , _RC)
111+ elseif (LSM_CHOICE== 4 ) then
112+ call ESMF_ConfigSetAttribute(CF, value= CATCHCN_INTERNAL_STATE% MOSFC_EXTRA_DERIVS_OFFL_LAND, Label= ' MOSFC_EXTRA_DERIVS_OFFL_LAND:' , _RC)
113+ end if
114+ call MAPL_Set (MAPL, CF= CF, _RC)
110115
116+ ! prep CatchCN ensemble and Children
111117 tmp = ' '
112118 if (NUM_LDAS_ENSEMBLE >1 ) then
113- ! catchcn_exxxx
114- tmp(1 :ens_id_width)= COMP_NAME(8 :8 + ens_id_width-1 )
115- endif
119+ ! catchcn_exxxx
120+ tmp(1 :ens_id_width)= COMP_NAME(8 :8 + ens_id_width-1 )
121+ endif
116122
117123 if ( LSM_CHOICE == 2 ) then
118124 CATCHCN = MAPL_AddChild(' CATCHCNCLM40' // trim (tmp), ' setservices_' , parentGC= GC, sharedObj= ' libGEOScatchCNCLM40_GridComp.so' , RC= STATUS)
@@ -131,13 +137,13 @@ subroutine SetServices ( GC, RC )
131137 call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize, RC= STATUS )
132138 VERIFY_(STATUS)
133139
134- call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, RUN1, RC= STATUS )
140+ call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, RUN1, RC= STATUS )
135141 VERIFY_(STATUS)
136142
137- call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, RUN2, RC= STATUS )
143+ call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, RUN2, RC= STATUS )
138144 VERIFY_(STATUS)
139145
140- call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize, RC= status)
146+ call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize, RC= status)
141147 VERIFY_(status)
142148
143149! Set the state variable specs. ( should be the combinations of clm4.0 and clm4.5
0 commit comments