diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 06ea82d99b..54487ec087 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -994,7 +994,7 @@ sub setup_cmdl_bgc { # Set soil matrix (which is needed later for spinup) $var = "use_soil_matrixcn"; add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - , 'use_fates'=>$nl_flags->{'use_fates'}, + , 'use_fates'=>$nl_flags->{'use_fates'}, , 'soil_decomp_method'=>$nl_flags->{'soil_decomp_method'}, , 'phys'=>$nl_flags->{'phys'}, clm_accelerated_spinup=>$nl_flags->{'clm_accelerated_spinup'} ); if ( &value_is_true($nl->get_value($var)) ) { @@ -1230,7 +1230,7 @@ sub setup_cmdl_spinup { if ( &value_is_true($nl_flags->{'use_cn'}) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "spinup_state", clm_accelerated_spinup=>$nl_flags->{'clm_accelerated_spinup'}, - use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'}, + use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'}, use_soil_matrixcn=>$nl_flags->{"use_soil_matrixcn"} ); if ( $nl->get_value("spinup_state") ne 0 ) { $nl_flags->{'bgc_spinup'} = "on"; @@ -1803,6 +1803,7 @@ sub process_namelist_inline_logic { # NOTE: After setup_logic_dust_emis # ##################################### setup_logic_megan($opts, $nl_flags, $definition, $defaults, $nl); + setup_logic_megan_opts($opts, $nl_flags, $definition, $defaults, $nl); ################################## # namelist group: lai_streams # @@ -4152,6 +4153,7 @@ sub setup_logic_dust_emis { sub setup_logic_megan { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + # Setup megan_emis_nl namelist for drv_flds_in my $var = "megan"; @@ -4181,6 +4183,29 @@ sub setup_logic_megan { #------------------------------------------------------------------------------- +sub setup_logic_megan_opts { + my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + # Setup megan_opts namelist + # This should be set when megan is turned on by CTSM, but also when CAM has turned it on + + if ($nl_flags->{'megan'} ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_use_gamma_sm'); + if ( &value_is_true( $nl->get_value('megan_use_gamma_sm') ) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_min_gamma_sm'); + } elsif ( defined($nl->get_value('megan_min_gamma_sm')) ) { + $log->fatal_error("megan_min_gamma_sm should NOT be set when megan_use_gamma_sm NOT TRUE.\n" ); + } + } + else { + if ( defined($nl->get_value('megan_use_gamma_sm')) || + defined($nl->get_value('megan_min_gamma_sm')) ) { + $log->fatal_error("MEGAN options should NOT be set when MEGAN is NOT in use.\n" ); + } + } +} + +#------------------------------------------------------------------------------- + sub setup_logic_soilm_streams { my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; @@ -4992,7 +5017,7 @@ sub setup_logic_exice { # excess ice streams, must be set before initial conditions # my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice', 'phys'=>$physv->as_string()); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice', 'phys'=>$physv->as_string()); my $use_exice = $nl->get_value( 'use_excess_ice' ); # Put use_exice into nl_flags so can be referenced later if ( value_is_true($use_exice) ) { @@ -5206,7 +5231,7 @@ sub write_output_files { @groups = qw(clm_inparm ndepdyn_nml popd_streams urbantv_streams light_streams soil_moisture_streams lai_streams atm2lnd_inparm lnd2atm_inparm clm_canopyhydrology_inparm cnphenology - cropcal_streams + cropcal_streams megan_opts clm_soilhydrology_inparm dynamic_subgrid cnvegcarbonstate finidat_consistency_checks dynpft_consistency_checks clm_initinterp_inparm century_soilbgcdecompcascade diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 50e3cf68ad..f7a516ffc4 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -152,6 +152,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0 0 + +.true. +0.0d00 + NONE ALL diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 64b6fc6522..e7fe712d6e 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -8,11 +8,11 @@ - Full pathname of initial conditions file. If blank CLM will startup from arbitrary initial conditions. @@ -29,30 +29,30 @@ creating the output file specified by finidat_interp_dest. This requires that finidat be non-blank. - Full pathname of master restart file for a branch run. (only used if RUN_TYPE=branch) (Set with RUN_REFCASE and RUN_REFDATE) - Component name to use in history and restart files - Full pathname of land fraction data file. @@ -78,8 +78,8 @@ Type of CO2 feedback. -Supplemental Nitrogen mode and for what type of vegetation it's turned on for. -In this mode Nitrogen is unlimited rather than prognosed and in general vegetation is +Supplemental Nitrogen mode and for what type of vegetation it's turned on for. +In this mode Nitrogen is unlimited rather than prognosed and in general vegetation is over-productive. NONE = No vegetation types get supplemental Nitrogen ALL = Supplemental Nitrogen is active for all vegetation types @@ -123,7 +123,7 @@ Otherwise use the fraction straight up (the default for CLM5.0) 10SL_3.5m = standard CLM4 and CLM4.5 version -23SL_3.5m = more vertical layers for permafrost simulations +23SL_3.5m = more vertical layers for permafrost simulations 49SL_10m = 49 layer soil column, 10m of soil, 5 bedrock layers 20SL_8.5m = 20 layer soil column, 8m of soil, 5 bedrock layers 4SL_2m = 4 layer soil column, 2m of soil, 0 bedrock layers @@ -427,7 +427,7 @@ Index of solution method of Richards equation. Change method for richards equation solution and boundary conditions. -CLM 4.5 - soilwater_movement_method = 0 (Zeng and Decker, 2009, method). +CLM 4.5 - soilwater_movement_method = 0 (Zeng and Decker, 2009, method). CLM 5.0 - soilwater_movement_method = 1 (adaptive time stepping moisture form from Martyn Clark). 1 (adaptive time stepping moisture form @@ -447,7 +447,7 @@ lower_boundary_condition = 2 : zero-flux lower boundary condition lower_boundary_condition = 3 : water table head-based lower boundary condition w/ aquifer layer. (use with soilwater_movement_method=adaptive time stepping) lower_boundary_condition = 4 : 11-layer solution w/ aquifer layer (only used with soilwater_movement_method=Zeng&Decker 2009) -TODO(bja, 2015-09) these should be strings so they have meaningful names instead of ints. +TODO(bja, 2015-09) these should be strings so they have meaningful names instead of ints. If TRUE, irrigation will be active. - + If TRUE, fsat will be set to zero for crop columns. - + @@ -731,7 +731,7 @@ feature on will result in more memory usage. + group="clm_inparm" valid_values="" value=".false."> Toggle to turn on the tree damage module in FATES (Only relevant if FATES is on) @@ -742,7 +742,7 @@ Turn on spitfire module to simulate fire by setting fates_spitfire_mode > 0. Allowed values are: 0 : Simulations of fire are off 1 : use a global constant lightning rate found in fates_params. - 2 : use an external lightning dataset. + 2 : use an external lightning dataset. 3 : use an external confirmed ignitions dataset (not available through standard CSEM dataset collection). 4 : use external lightning and population datasets to simulate both natural and anthropogenic 5 : use gross domestic production and population datasets to simulate anthropogenic fire supression @@ -751,20 +751,20 @@ ignitions. + group="clm_inparm" valid_values="" value=".false."> Toggle to turn on fixed biogeography mode (Only relevant if FATES is on) -Toggle to turn on no competition mode (only relevant if FATES is being used). + group="clm_inparm" valid_values="" value=".false."> +Toggle to turn on no competition mode (only relevant if FATES is being used). -Toggle to turn on FATES satellite phenology mode (only relevant if FATES is being used). + group="clm_inparm" valid_values="" value=".false."> +Toggle to turn on FATES satellite phenology mode (only relevant if FATES is being used). -Full pathname of fates landuse x pft association static data map. +Full pathname of fates landuse x pft association static data map. The file associates land use types with pfts across a static global map. -This file is necessary for running FATES with use_fates_luh, +This file is necessary for running FATES with use_fates_luh, use_fates_nocomp, and use_fates_fixedbiogeo engaged (note that use_fates_lupft is provided as a namelist option to engage all necessary options). The file is output by the FATES land use data tool (https://github.com/NGEET/tools-fates-landusedata) @@ -1014,12 +1014,12 @@ Full pathname of surface data file. Full pathname of hillslope data file. - SNICAR (SNow, ICe, and Aerosol Radiative model) optical data file name - SNICAR (SNow, ICe, and Aerosol Radiative model) snow aging data file name @@ -1167,7 +1167,7 @@ Per tape series maximum number of time samples. -Per tape series history file density (i.e. output precision) +Per tape series history file density (i.e. output precision) 1=double precision 2=single precision Default: 2,2,2,2,2,2,2,2,2,2 @@ -1175,7 +1175,7 @@ Per tape series history file density (i.e. output precision) -Per tape series history write frequency. +Per tape series history write frequency. positive means in time steps 0=monthly negative means hours @@ -1227,7 +1227,7 @@ If TRUE, urban traffic flux will be activated (Currently NOT implemented). group="clm_humanindex_inparm" valid_values="ALL,FAST,NONE" > Human heat stress indices: ALL = All indices will be calculated - FAST = A subset of indices will be calculated (will not include the computationally + FAST = A subset of indices will be calculated (will not include the computationally expensive wet bulb calculation and associated indices) NONE = No indices will be calculated @@ -1316,7 +1316,7 @@ nyr_SASU=1: the fastest SASU, but inaccurate; nyr_SASU=nyr_forcing(eg. 20): the -The restart file will be based on the average of all analytic solutions within the iloop_avg^th loop. +The restart file will be based on the average of all analytic solutions within the iloop_avg^th loop. eg. if nyr_forcing = 20, iloop_avg = 8, the restart file in yr 160 will be based on analytic solutions from yr 141 to 160. The number of the analytic solutions within one loop depends on ratio between nyr_forcing and nyr_SASU. eg. if nyr_forcing = 20, nyr_SASU = 5, number of analytic solutions is 20/5=4 @@ -1332,7 +1332,7 @@ Turn on methane model. Standard part of CLM45BGC model. -CLM Biogeochemistry mode : Carbon Nitrogen model (CN) +CLM Biogeochemistry mode : Carbon Nitrogen model (CN) (or CLM45BGC if phys=clm4_5, vsoilc_centbgc='on', and clm4me='on') @@ -1350,7 +1350,7 @@ Requires the CN model to work (either CN or CNDV). -Nitrification/denitrification splits the prognostic mineral N pool into two +Nitrification/denitrification splits the prognostic mineral N pool into two mineral N pools: NO3 and NH4, and includes the transformations between them. Turned on for BGC FATES currently allows it to be true or false, but will be hardwired to true later @@ -1390,17 +1390,17 @@ Toggle to turn on the prognostic crop model -Toggle to turn on the prognostic fertilizer for crop model +Toggle to turn on the prognostic fertilizer for crop model -Toggle to turn on the 1-year grain product pool in the crop model +Toggle to turn on the 1-year grain product pool in the crop model -Fraction of post-harvest crop residues (leaf and stem) to move to +Fraction of post-harvest crop residues (leaf and stem) to move to 1-year product pool instead of letting them fall as litter. Default: 0.0 @@ -1409,7 +1409,7 @@ Fraction of post-harvest crop residues (leaf and stem) to move to group="crop_inparm" valid_values="constant,varytropicsbylat" value="constant"> Type of mapping to use for base temperature for prognostic crop model constant = Just use baset from the PFT parameter file -varytropicsbylat = Vary the tropics by latitude +varytropicsbylat = Vary the tropics by latitude - Parameter to set the type of ozone vegetation stress method - unset = (default) ozone stress vegetation method is off + Parameter to set the type of ozone vegetation stress method + unset = (default) ozone stress vegetation method is off stress_lombardozzi2015 = ozone stress vegetation functions from Danica Lombardozzi 2015 stress_falk = ozone stress vegetation functions from Stefanie Falk (issue #1224) Default: "unset" - - + + Phenology onset depends on the vegetation type @@ -1631,7 +1631,7 @@ by getco2_historical.ncl - Aerosol deposition file name (only used for aerdepregrid.ncl) @@ -1855,13 +1855,13 @@ mesh filename of input stream data for Zender's soil erodibility source function -Filename of input stream data for finundated inversion of observed (from Prigent dataset) +Filename of input stream data for finundated inversion of observed (from Prigent dataset) to hydrologic variables (either TWS or ZWT) -mesh filename of input stream data for finundated inversion of observed (from Prigent dataset) +mesh filename of input stream data for finundated inversion of observed (from Prigent dataset) to hydrologic variables (either TWS or ZWT) @@ -1959,7 +1959,7 @@ Filename of input stream data for LAI -dtlimit (ratio of max/min stream delta times) for LAI streams, which allows for cycling over a year of data +dtlimit (ratio of max/min stream delta times) for LAI streams, which allows for cycling over a year of data @@ -2242,10 +2242,10 @@ Mapping file to go from one resolution/land-mask to another resolution/land-mask Land mask description for mksurfdata input files - + @@ -2257,7 +2257,7 @@ Resolution of finundated inversion streams dataset (stream_fldfilename_ch4finund to use for methane model (only applies when CN and methane model are turned on) - + Resolution of Lightning dataset to use for CN or FATES fire model @@ -2276,46 +2276,56 @@ Add a note to the output namelist about the options given to build-namelist -CLM run type. +CLM run type. 'default' use the default type of clm_start type for this configuration 'cold' is a run from arbitrary initial conditions 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found - 'startup' is an initial run with initial conditions provided. + 'startup' is an initial run with initial conditions provided. 'continue' is a restart run. 'branch' is a restart run in which properties of the output history files may be changed. -Shared Socioeconomic Pathway (SSP) and Representative Concentration Pathway (RCP) combination for future scenarios +Shared Socioeconomic Pathway (SSP) and Representative Concentration Pathway (RCP) combination for future scenarios The form is SSPn-m.m Where n is the SSP number and m.m is RCP radiative forcing at peak or 2100 in W/m^2 n is just the whole number of the specific SSP scenario. The lower numbers have higher mitigation - the higher numbers less mitigation, more than one SSP can result in the same RCP forcing hist means do NOT use a future scenario, just use historical data. - + Land mask description - + General configuration of model version and atmospheric forcing to tune the model to run under. -This sets the model to run with constants and initial conditions that were set to run well under +This sets the model to run with constants and initial conditions that were set to run well under the configuration of model version and atmospheric forcing. To run well constants would need to be changed to run with a different type of atmospheric forcing. (Some options for the newest physics will be based on previous tuning, and buildnml will let you know about this) - + -If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) - +If 1, turn on the MEGAN model for BVOC's (Biogenic Volatile Organic Compounds) + + + +If TRUE, use activity factor for soil moisture for MEGAN isoprene emissions. + + + +Minimum activity factor for soil moisture for MEGAN isoprene emissions. + + + @@ -2377,8 +2387,8 @@ NOTE: THIS CORRESPONDS DIRECTLY TO THE env_run.xml VARIABLE OF THE SAME NAME. group="default_settings" valid_values="sp,bgc,fates" > Command line arguement for biogeochemistry mode for CLM4.5 sp = Satellitte Phenology - bgc = CLM4.5 BGC model with: - CENTURY model pools + bgc = CLM4.5 BGC model with: + CENTURY model pools Nitrification/De-nitrification Methane model Vertically resolved Carbon @@ -2396,8 +2406,8 @@ Flag for overriding the crash that should occur if user tries to start the model -Flag for setting the state of the Accelerated decomposition spinup state for the BGC model. - 0 = normal model behavior; +Flag for setting the state of the Accelerated decomposition spinup state for the BGC model. + 0 = normal model behavior; 1 = AD spinup (standard) 2 = AD spinup (accelerated spinup from Ricciuto, doesn't work for CNDV and not implemented for CN soil decomposition) Entering and exiting spinup mode occurs automatically by comparing the namelist and restart file values for this variable. @@ -2457,7 +2467,7 @@ Soil decomposition method CENTURYKoven2013 -- CENTURY model in CTSM from Koven et. al. 2013 MIMICSWieder2015 -- MIMICS model in CTSM from Wieder et. al. 2015 -An active soil decomposition method requires the BGC or FATES model to work +An active soil decomposition method requires the BGC or FATES model to work And both BGC and FATES models require an active soil decomposition model @@ -2605,7 +2615,7 @@ Minimum lake depth to increase non-molecular thermal diffusivities by the factor group="clm_inparm" valid_values="" > Factor to increase non-molecular thermal diffusivities for lakes deeper than deepmixing_depthcrit to account for unresolved 3D processes. -Set to 1 to +Set to 1 to -Allows user to tune the value of aereoxid. If set to FALSE, then use the value of aereoxid from +Allows user to tune the value of aereoxid. If set to FALSE, then use the value of aereoxid from the parameter file (set to 0.0, but may be tuned with values in the range {0.0,1.0}. If set to TRUE, then don't fix aere (see ch4Mod.F90). Default: .true. @@ -2664,7 +2674,7 @@ so the coupled system will NOT conserve carbon in this mode if the methane model -Inundated fraction method type to use for the CH4 submodel (possibly affecting soil +Inundated fraction method type to use for the CH4 submodel (possibly affecting soil heterotrophic respiration and denitrification depending on the configuration), h2osfc ----------- Use prognostic saturated fraction h2osfc value calculated in Soil Hydrology @@ -2841,7 +2851,7 @@ Values less than 5 are mainly useful for testing, and should not be used for sci -Maximum snow depth in mm H2O equivalent. Additional mass gains will be capped when this depth +Maximum snow depth in mm H2O equivalent. Additional mass gains will be capped when this depth is exceeded. Changes in this value should possibly be accompanied by changes in: - nlevsno: larger values of h2osno_max should be accompanied by increases in nlevsno @@ -2960,8 +2970,8 @@ differently in areas below and above reset_snow_glc_ela. Only relevant if reset_snow_glc is .true. When resetting snow pack over glacier columns, one can choose to do this over all glacier -columns, or only those below a certain elevation. A typical use case is to reset only those -columns that have a seasonal snow pack in the real world, i.e. SMB less than 0, also known as +columns, or only those below a certain elevation. A typical use case is to reset only those +columns that have a seasonal snow pack in the real world, i.e. SMB less than 0, also known as the equilibrium line altitude (ELA). This parameter sets a single global ELA value. By setting this parameter to a large value (i.e. 10000 m), all glacier columns will be reset. @@ -3008,7 +3018,7 @@ the related bulk quantities. If .true., run with water isotopes - + @@ -3105,7 +3115,7 @@ Initial soil temperature to use for gridcells with excess ice present during a r -Soil depth below which initial excess ice concentration will be applied during a run starting with coldstart (m). Value only applys if use_excess_ice is true. +Soil depth below which initial excess ice concentration will be applied during a run starting with coldstart (m). Value only applys if use_excess_ice is true. If this is set below depth of the soil depth, only the last soil layer will get excess ice. diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 948e68ff29..eb0c343d38 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -163,10 +163,10 @@ sub cat_and_create_namelistinfile { # # Figure out number of tests that will run # -my $ntests = 3391; +my $ntests = 3393; if ( defined($opts{'compare'}) ) { - $ntests += 2161; + $ntests += 2061; } plan( tests=>$ntests ); @@ -323,7 +323,7 @@ sub cat_and_create_namelistinfile { "-res 0.9x1.25 -namelist '&a use_lai_streams=.true.,use_soil_moisture_streams=.true./'", "-res 0.9x1.25 -namelist '&a use_excess_ice=.true. use_excess_ice_streams=.true./'", "-res 0.9x1.25 --clm_start_type cold -namelist '&a use_excess_ice=.true. use_excess_ice_streams=.true./'", - "-res 0.9x1.25 --bgc bgc --namelist \"&a urbantvmapalgo='redist' ndepmapalgo='mapconsd' popdensmapalgo='mapconsf'\"", + "-res 0.9x1.25 --bgc bgc --namelist \"&a urbantvmapalgo='redist' ndepmapalgo='consd' popdensmapalgo='consf'\"", "-res 0.9x1.25 -use_case 1850_control", "-res 1x1pt_US-UMB -clm_usr_name 1x1pt_US-UMB -namelist '&a fsurdat=\"/dev/null\"/'", "-res 1x1_brazil", @@ -1314,6 +1314,14 @@ sub cat_and_create_namelistinfile { namelst=>"use_lai_streams=.true.", phys=>"clm5_0", }, + "megan_opts_wo_megan" =>{ options=>"--envxml_dir . --bgc bgc --no-megan", + namelst=>"megan_use_gamma_sm=TRUE, megan_min_gamma_sm=1.0", + phys=>"clm6_0", + }, + "megan_min_wo_megan_use" =>{ options=>"--envxml_dir . --bgc bgc --megan", + namelst=>"megan_use_gamma_sm=FALSE, megan_min_gamma_sm=1.0", + phys=>"clm6_0", + }, "soil_erod_wo_Zender" =>{ options=>"--envxml_dir . --ignore_warnings", namelst=>"dust_emis_method='Leung_2023', stream_meshfile_zendersoilerod = '/dev/null'", phys=>"clm6_0", diff --git a/src/biogeochem/VOCEmissionMod.F90 b/src/biogeochem/VOCEmissionMod.F90 index 7ef81ea281..45866e2632 100644 --- a/src/biogeochem/VOCEmissionMod.F90 +++ b/src/biogeochem/VOCEmissionMod.F90 @@ -75,6 +75,8 @@ module VOCEmissionMod type(megan_out_type), private, pointer :: meg_out(:) ! (n_megan_comps) points to output fluxes ! logical, parameter :: debug = .false. + logical :: megan_use_gamma_sm = .false. + real(r8) :: megan_min_gamma_sm = 0._r8 character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -83,11 +85,65 @@ module VOCEmissionMod contains !------------------------------------------------------------------------ - subroutine Init(this, bounds) + subroutine VOCReadNML(NLFilename) + ! + ! !DESCRIPTION: + ! Read the namelist for CropType + ! + ! !USES: + use fileutils , only : getavu, relavu, opnfil + use shr_nl_mod , only : shr_nl_find_group_name + use spmdMod , only : masterproc, mpicom + use shr_mpi_mod , only : shr_mpi_bcast + use clm_varctl , only : iulog + ! + ! !ARGUMENTS: + character(len=*), intent(in) :: NLFilename ! Namelist filename + ! + ! !LOCAL VARIABLES: + integer :: ierr ! error code + integer :: unitn ! unit for namelist file + + character(len=*), parameter :: subname = 'VOCReadNML' + character(len=*), parameter :: nmlname = 'megan_opts' + + namelist /megan_opts/ megan_use_gamma_sm, megan_min_gamma_sm + + if (masterproc) then + unitn = getavu() + write(iulog,*) 'Read in '//nmlname//' namelist' + call opnfil (NLFilename, unitn, 'F') + call shr_nl_find_group_name(unitn, nmlname, status=ierr) + if (ierr == 0) then + read(unitn, nml=megan_opts, iostat=ierr) + if (ierr /= 0) then + call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + end if + !else + ! call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + end if + call relavu( unitn ) + end if + + call shr_mpi_bcast(megan_use_gamma_sm, mpicom) + call shr_mpi_bcast(megan_min_gamma_sm, mpicom) + + if (masterproc) then + write(iulog,*) ' ' + write(iulog,*) nmlname//' settings:' + write(iulog,nml=megan_opts) + write(iulog,*) ' ' + end if + + end subroutine VOCReadNML + + !------------------------------------------------------------------------ + subroutine Init(this, bounds, NLFilename) use clm_varctl , only : use_fates, use_fates_sp class(vocemis_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds + character(len=*) , intent(in) :: NLFilename ! Namelist filename if ( shr_megan_mechcomps_n > 0) then if ( use_fates .and. (.not. use_fates_sp) ) then @@ -97,6 +153,10 @@ subroutine Init(this, bounds) call this%InitAllocate(bounds) call this%InitHistory(bounds) call this%InitCold(bounds) + + ! read run-time options + call VOCReadNML(NLFilename) + end if end subroutine Init @@ -112,7 +172,7 @@ subroutine InitAllocate(this, bounds) ! ! !ARGUMENTS: class(vocemis_type) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: i, imeg @@ -124,7 +184,6 @@ subroutine InitAllocate(this, bounds) type(shr_megan_megcomp_t), pointer :: meg_cmp !----------------------------------------------------------------------- - begg = bounds%begg; endg = bounds%endg begp = bounds%begp; endp = bounds%endp @@ -566,7 +625,11 @@ subroutine VOCEmission (bounds, num_soilp, filter_soilp, & gamma_l = get_gamma_L(fsun240(p), elai(p)) ! Impact of soil moisture on isoprene emission - gamma_sm = get_gamma_SM(btran(p)) + if (megan_use_gamma_sm) then + gamma_sm = get_gamma_SM(btran(p)) + else + gamma_sm = 1._r8 + end if ! Loop through VOCs for light, temperature and leaf age activity factor & apply ! all final activity factors to baseline emission factors @@ -844,6 +907,8 @@ function get_gamma_SM(btran_in) get_gamma_SM = 1._r8 / (1._r8 + b1 * exp(a1 * (btran_in - btran_threshold))) endif + get_gamma_SM = max(get_gamma_SM, megan_min_gamma_sm) + end function get_gamma_SM !----------------------------------------------------------------------- diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 210cff2c2e..7d9a0f6ad2 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -24,14 +24,14 @@ module clm_instMod ! Constants !----------------------------------------- - use UrbanParamsType , only : urbanparams_type ! Constants + use UrbanParamsType , only : urbanparams_type ! Constants use UrbanParamsType , only : IsSimpleBuildTemp, IsProgBuildTemp use UrbanTimeVarType , only : urbantv_type use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use CNDVType , only : dgv_ecophyscon ! Constants + use CNDVType , only : dgv_ecophyscon ! Constants !----------------------------------------- - ! Definition of component types + ! Definition of component types !----------------------------------------- use ActiveLayerMod , only : active_layer_type @@ -71,14 +71,14 @@ module clm_instMod use CNFireEmissionsMod , only : fireemis_type use atm2lndType , only : atm2lnd_type use lnd2atmType , only : lnd2atm_type - use lnd2glcMod , only : lnd2glc_type + use lnd2glcMod , only : lnd2glc_type use glc2lndMod , only : glc2lnd_type use glcBehaviorMod , only : glc_behavior_type use TopoMod , only : topo_type use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch + use LandunitType , only : lun + use ColumnType , only : col + use PatchType , only : patch use CLMFatesInterfaceMod , only : hlm_fates_interface_type use SnowCoverFractionBaseMod , only : snow_cover_fraction_base_type use SnowCoverFractionFactoryMod , only : CreateAndInitSnowCoverFraction @@ -87,8 +87,8 @@ module clm_instMod ! use SoilStateInitTimeConstMod , only : SoilStateInitTimeConst use SoilHydrologyInitTimeConstMod , only : SoilHydrologyInitTimeConst - use SurfaceAlbedoMod , only : SurfaceAlbedoInitTimeConst - use LakeCon , only : LakeConInit + use SurfaceAlbedoMod , only : SurfaceAlbedoInitTimeConst + use LakeCon , only : LakeConInit use SoilBiogeochemPrecisionControlMod, only: SoilBiogeochemPrecisionControlInit use SoilWaterMovementMod , only : use_aquifer_layer ! @@ -99,7 +99,7 @@ module clm_instMod ! Instances of component types !----------------------------------------- - ! Physics types + ! Physics types type(active_layer_type), public :: active_layer_inst type(aerosol_type), public :: aerosol_inst type(canopystate_type), public :: canopystate_inst @@ -138,7 +138,7 @@ module clm_instMod class(nutrient_competition_method_type), public, allocatable :: nutrient_competition_method - ! Soil biogeochem types + ! Soil biogeochem types type(soilbiogeochem_state_type) , public :: soilbiogeochem_state_inst type(soilbiogeochem_carbonstate_type) , public :: soilbiogeochem_carbonstate_inst type(soilbiogeochem_carbonstate_type) , public :: c13_soilbiogeochem_carbonstate_inst @@ -171,7 +171,7 @@ module clm_instMod !----------------------------------------------------------------------- subroutine clm_instReadNML( NLFilename ) ! - ! !ARGUMENTS + ! !ARGUMENTS implicit none character(len=*), intent(IN) :: NLFilename ! Namelist filename ! Read in any namelists that must be read for any clm object instances that need it @@ -186,7 +186,7 @@ end subroutine clm_instReadNML !----------------------------------------------------------------------- subroutine clm_instInit(bounds) ! - ! !USES: + ! !USES: use clm_varpar , only : nlevsno use controlMod , only : nlfilename, fsurdat, hillslope_file use domainMod , only : ldomain @@ -196,10 +196,10 @@ subroutine clm_instInit(bounds) use SoilBiogeochemCompetitionMod , only : SoilBiogeochemCompetitionInit use clm_varctl , only : use_excess_ice use ExcessIceStreamType , only : excessicestream_type, UseExcessIceStreams - + use initVerticalMod , only : initVertical use SnowHydrologyMod , only : InitSnowLayers - use accumulMod , only : print_accum_fields + use accumulMod , only : print_accum_fields use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve use decompMod , only : get_proc_bounds use BalanceCheckMod , only : GetBalanceCheckSkipSteps @@ -209,7 +209,7 @@ subroutine clm_instInit(bounds) use initVerticalMod , only : setSoilLayerClass use DustEmisFactory , only : create_dust_emissions ! - ! !ARGUMENTS + ! !ARGUMENTS type(bounds_type), intent(in) :: bounds ! processor bounds ! ! !LOCAL VARIABLES: @@ -230,10 +230,10 @@ subroutine clm_instInit(bounds) !---------------------------------------------------------------------- ! Note: h2osno_col and snow_depth_col are initialized as local variables - ! since they are needed to initialize vertical data structures + ! since they are needed to initialize vertical data structures - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc + begp = bounds%begp; endp = bounds%endp + begc = bounds%begc; endc = bounds%endc begl = bounds%begl; endl = bounds%endl call getfil (paramfile, locfn, 0) @@ -255,7 +255,7 @@ subroutine clm_instInit(bounds) ! all of the year. if (lun%itype(l)==istice) then h2osno_col(c) = 100._r8 - else if (lun%itype(l)==istsoil .and. abs(grc%latdeg(g)) >= 60._r8) then + else if (lun%itype(l)==istsoil .and. abs(grc%latdeg(g)) >= 60._r8) then h2osno_col(c) = 100._r8 else h2osno_col(c) = 0._r8 @@ -271,7 +271,7 @@ subroutine clm_instInit(bounds) ! Initialize urban time varying data call urbantv_inst%Init(bounds, NLFilename) - ! Initialize vertical data components + ! Initialize vertical data components call initVertical(bounds, & glc_behavior, & @@ -287,7 +287,7 @@ subroutine clm_instInit(bounds) endif !----------------------------------------------- - ! Set cold-start values for snow levels, snow layers and snow interfaces + ! Set cold-start values for snow levels, snow layers and snow interfaces !----------------------------------------------- call InitSnowLayers(bounds, snow_depth_col(bounds%begc:bounds%endc)) @@ -395,7 +395,7 @@ subroutine clm_instInit(bounds) ! Note - always initialize the memory for ch4_inst call ch4_inst%Init(bounds, soilstate_inst%cellorg_col(begc:endc, 1:), fsurdat, nlfilename) - call vocemis_inst%Init(bounds) + call vocemis_inst%Init(bounds, NLFilename) call fireemis_inst%Init(bounds) @@ -408,7 +408,7 @@ subroutine clm_instInit(bounds) call soilbiogeochem_state_inst%Init(bounds) ! Initialize decompcascade constants - ! Note that init_decompcascade_bgc need + ! Note that init_decompcascade_bgc need ! soilbiogeochem_state_inst to be initialized call init_decomp_cascade_constants( ) @@ -432,7 +432,7 @@ subroutine clm_instInit(bounds) c12_soilbiogeochem_carbonstate_inst=soilbiogeochem_carbonstate_inst) end if - call soilbiogeochem_carbonflux_inst%Init(bounds, carbon_type='c12') + call soilbiogeochem_carbonflux_inst%Init(bounds, carbon_type='c12') if (use_c13) then call c13_soilbiogeochem_carbonflux_inst%Init(bounds, carbon_type='c13') end if @@ -447,7 +447,7 @@ subroutine clm_instInit(bounds) soilbiogeochem_carbonstate_inst%decomp_cpools_col(begc:endc,1:ndecomp_pools), & soilbiogeochem_carbonstate_inst%decomp_cpools_1m_col(begc:endc, 1:ndecomp_pools)) - call soilbiogeochem_nitrogenflux_inst%Init(bounds) + call soilbiogeochem_nitrogenflux_inst%Init(bounds) ! Initialize precision control for soil biogeochemistry call SoilBiogeochemPrecisionControlInit( soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & @@ -463,9 +463,9 @@ subroutine clm_instInit(bounds) call crop_inst%Init(bounds) end if - + ! Initialize the Functionaly Assembled Terrestrial Ecosystem Simulator (FATES) - ! + ! if (use_fates) then call clm_fates%Init(bounds, flandusepftdat) end if @@ -479,14 +479,14 @@ subroutine clm_instInit(bounds) ! ------------------------------------------------------------------------ ! The time manager needs to be initialized before this called is made, since - ! the step size is needed. + ! the step size is needed. call t_startf('init_accflds') call atm2lnd_inst%InitAccBuffer(bounds) call temperature_inst%InitAccBuffer(bounds) - + call water_inst%InitAccBuffer(bounds) call energyflux_inst%InitAccBuffer(bounds) @@ -525,10 +525,10 @@ subroutine clm_instRest(bounds, ncid, flag, writing_finidat_interp_dest_file) ! Define/write/read CLM restart file. ! ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - + type(bounds_type) , intent(in) :: bounds + type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'define', 'write', 'read' + character(len=*) , intent(in) :: flag ! 'define', 'write', 'read' logical , intent(in) :: writing_finidat_interp_dest_file ! true if we are writing a finidat_interp_dest file (ignored for flag=='read') ! Local variables @@ -566,7 +566,7 @@ subroutine clm_instRest(bounds, ncid, flag, writing_finidat_interp_dest_file) call water_inst%restart(bounds, ncid, flag=flag, & writing_finidat_interp_dest_file = writing_finidat_interp_dest_file, & watsat_col = soilstate_inst%watsat_col(bounds%begc:bounds%endc,:), & - t_soisno_col=temperature_inst%t_soisno_col(bounds%begc:bounds%endc, -nlevsno+1:), & + t_soisno_col=temperature_inst%t_soisno_col(bounds%begc:bounds%endc, -nlevsno+1:), & altmax_lastyear_indx=active_layer_inst%altmax_lastyear_indx_col(bounds%begc:bounds%endc)) call irrigation_inst%restart (bounds, ncid, flag=flag) @@ -623,7 +623,7 @@ subroutine clm_instRest(bounds, ncid, flag, writing_finidat_interp_dest_file) canopystate_inst=canopystate_inst, & soilstate_inst=soilstate_inst, & active_layer_inst=active_layer_inst, & - soilbiogeochem_carbonflux_inst=soilbiogeochem_carbonflux_inst, & + soilbiogeochem_carbonflux_inst=soilbiogeochem_carbonflux_inst, & soilbiogeochem_nitrogenflux_inst=soilbiogeochem_nitrogenflux_inst) end if @@ -631,4 +631,3 @@ subroutine clm_instRest(bounds, ncid, flag, writing_finidat_interp_dest_file) end subroutine clm_instRest end module clm_instMod -