diff --git a/CMakeLists.txt b/CMakeLists.txt index a186c1f27..ab3793bf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,6 +219,8 @@ else() src/shared/casa_offline_inout.F90 src/shared/casa_ncdf.F90 src/offline/cable_iovars.F90 + src/offline/temp_module.F90 + src/shared/read_namelists_mod_cbl.F90 src/offline/cable_surface_types.F90 src/offline/cable_define_types.F90 src/shared/cable_phenology.F90 diff --git a/namelists/cable.nml b/namelists/cable.nml new file mode 100644 index 000000000..cc5603955 --- /dev/null +++ b/namelists/cable.nml @@ -0,0 +1,30 @@ +&cable + +!BGC +l_casacnp = .FALSE. ! using casaCNP with CABLE +l_laiFeedbk = .FALSE. ! using prognostic LAI +l_vcmaxFeedbk = .FALSE. ! using prognostic Vcmax +icycle = 0 ! [0 (=NO casaCNP), 1 (=C), 2 (=C+N), 3 (=C+N+P) ] +cable_user%DIAG_SOIL_RESP = 'ON ' +cable_user%LEAF_RESPIRATION = 'ON ' + +!canopy +wiltParam = 0.5 ! +satuParam = 0.8 ! +cable_user%FWSOIL_SWITCH = 'standard' ! ['standard', 'non-linear extrapolation', + 'Lai and Ktaul' 2000, 'Haverd2013' ] +cable_user%GS_SWITCH = 'leuning' ! stomata model ['leuning', 'Medlyn'] +cable_user%SSNOW_POTEV = 'HDM' ! ['HDM' (Humidity Deficit Method), + 'P-M' (Penmann-Monteith model) ] +!soilsnow +redistrb = .FALSE. ! Execute hydraulic redistribution model +snmin = 1.0 ! minimum snow depth to use 3 layer model + +! offline ONLY +cable_user%l_ice_consistency = .FALSE. ! TRUE add QA step for ice tiles input. +cable_user%RUN_DIAG_LEVEL = 'BASIC' ! [ 'BASIC', 'NONE' ] +cable_user%CONSISTENCY_CHECK = .TRUE. ! TRUE outputs combined fluxes at each timestep for comparisson to A control run +cable_user%CASA_DUMP_READ = .FALSE. ! TRUE reads CASA forcing from netcdf format +cable_user%CASA_DUMP_WRITE = .FALSE. ! TRUE outputs CASA forcing in netcdf format + +&end diff --git a/src/offline/cable_soilparm.nml b/namelists/cable_soilparm.nml similarity index 100% rename from src/offline/cable_soilparm.nml rename to namelists/cable_soilparm.nml diff --git a/namelists/offline.nml b/namelists/offline.nml new file mode 100644 index 000000000..7df4adbba --- /dev/null +++ b/namelists/offline.nml @@ -0,0 +1,48 @@ +&offline + +filename%met = 'TumbaFluxnet.1.3_met.nc' +filename%out = 'out_cable.nc' +filename%log = 'log_cable.txt' +filename%restart_in = ' ' +filename%restart_out = './restart_out.nc' +filename%type = 'gridinfo_CSIRO_1x1.nc' + +vegparmnew = .TRUE. ! using new format when true +soilparmnew = .TRUE. ! using new format when true + +spinup = .FALSE. ! do we spin up the model? +delsoilM = 0.001 ! threshold variation in soil moisture for spin up +delsoilT = 0.01 ! threshold variation in soil temperature for spin up +spincasa = .FALSE. ! spin casa before running the model if TRUE + +output%restart = .TRUE. ! should a restart file be created? +output%met = .TRUE. ! input met data +output%flux = .TRUE. ! convective, runoff, NEE +output%soil = .FALSE. !see #354 soil statescrews up dimensions for ferret +output%snow = .TRUE. ! snow states +output%radiation = .TRUE. ! net rad, albedo +output%carbon = .TRUE. ! NEE, GPP, NPP, stores +output%veg = .TRUE. ! vegetation states +output%params = .TRUE. ! input parameters used to produce run +output%patch = .TRUE. ! write per patch +output%balances = .TRUE. ! energy and water balances +check%ranges = 0 ! variable ranges, input and output +check%energy_bal = .TRUE. ! energy balance +check%mass_bal = .TRUE. ! water/mass balance + +verbose = .TRUE. ! write details of every grid cell init and params to log? +leaps = .TRUE. ! calculate timing with leap years? +logn = 88 ! log file number - declared in input module +fixedCO2 = 350.0 ! if not found in met file, in ppmv + +ncciy = 0 ! 0 = NO GSWP2; 4-digit year input for year of GSWP2 met +gswpfile%rainf = 'gswp/Rainf_gswp1987.nc' +gswpfile%snowf = 'gswp/Snowf_gswp1987.nc' +gswpfile%LWdown= 'gswp/LWdown_srb1987.nc' +gswpfile%SWdown= 'gswp/SWdown_srb1987.nc' +gswpfile%PSurf = 'gswp/PSurf_ecor1987.nc' +gswpfile%Qair = 'gswp/Qair_cru1987.nc' +gswpfile%Tair = 'gswp/Tair_cru1987.nc' +gswpfile%wind = 'gswp/Wind_ncep1987.nc' + +&end diff --git a/src/offline/pft_params.nml b/namelists/pft_params.nml similarity index 100% rename from src/offline/pft_params.nml rename to namelists/pft_params.nml diff --git a/src/offline/cable.nml b/src/offline/cable.nml deleted file mode 100644 index 196869489..000000000 --- a/src/offline/cable.nml +++ /dev/null @@ -1,73 +0,0 @@ -&cable - filename%met = 'TumbaFluxnet.1.3_met.nc' - filename%out = 'out_cable.nc' - filename%log = 'log_cable.txt' - filename%restart_in = ' ' - filename%restart_out = './restart_out.nc' - filename%type = 'gridinfo_CSIRO_1x1.nc' - filename%veg = '' - filename%soil ='' - vegparmnew = .TRUE. ! using new format when true - soilparmnew = .TRUE. ! using new format when true - spinup = .FALSE. ! do we spin up the model? - delsoilM = 0.001 ! allowed variation in soil moisture for spin up - delsoilT = 0.01 ! allowed variation in soil temperature for spin up - output%restart = .TRUE. ! should a restart file be created? - output%met = .TRUE. ! input met data - output%flux = .TRUE. ! convective, runoff, NEE - output%soil = .FALSE. !see #354 soil statescrews up dimensions for ferret - output%snow = .TRUE. ! snow states - output%radiation = .TRUE. ! net rad, albedo - output%carbon = .TRUE. ! NEE, GPP, NPP, stores - output%veg = .TRUE. ! vegetation states - output%params = .TRUE. ! input parameters used to produce run - output%patch = .TRUE. ! write per patch - output%balances = .TRUE. ! energy and water balances - check%ranges = 0 ! variable ranges, input and output - check%energy_bal = .TRUE. ! energy balance - check%mass_bal = .TRUE. ! water/mass balance - verbose = .TRUE. ! write details of every grid cell init and params to log? - leaps = .TRUE. ! calculate timing with leap years? - logn = 88 ! log file number - declared in input module - fixedCO2 = 350.0 ! if not found in met file, in ppmv - spincasa = .FALSE. ! spin casa before running the model if TRUE - l_casacnp = .FALSE. ! using casaCNP with CABLE - l_laiFeedbk = .FALSE. ! using prognostic LAI - l_vcmaxFeedbk = .FALSE. ! using prognostic Vcmax - icycle = 0 ! BP pull it out from casadimension and put here; 0 for not using casaCNP, 1 for C, 2 for C+N, 3 for C+N+P - casafile%cnpipool='/projects/access/from_raijin/CABLE-AUX/core/biogeochem/poolcnpInTumbarumba.csv' ! - casafile%cnpbiome='pftlookup.csv' ! biome specific BGC parameters - casafile%cnpepool='poolcnpOut.csv' ! end of run pool size - casafile%cnpmetout='casamet.nc' ! output daily met forcing for spinning casacnp - casafile%cnpmetin='' ! list of daily met files for spinning casacnp - casafile%phen='/projects/access/from_raijin/CABLE-AUX/core/biogeochem/modis_phenology_csiro.txt' ! modis phenology - casafile%cnpflux='cnpfluxOut.csv' - ncciy = 0 ! 0 for not using gswp; 4-digit year input for year of gswp met - gswpfile%rainf = 'gswp/Rainf_gswp1987.nc' - gswpfile%snowf = 'gswp/Snowf_gswp1987.nc' - gswpfile%LWdown= 'gswp/LWdown_srb1987.nc' - gswpfile%SWdown= 'gswp/SWdown_srb1987.nc' - gswpfile%PSurf = 'gswp/PSurf_ecor1987.nc' - gswpfile%Qair = 'gswp/Qair_cru1987.nc' - gswpfile%Tair = 'gswp/Tair_cru1987.nc' - gswpfile%wind = 'gswp/Wind_ncep1987.nc' - redistrb = .FALSE. ! Turn on/off the hydraulic redistribution - wiltParam = 0.5 - satuParam = 0.8 - snmin = 1.0 - cable_user%FWSOIL_SWITCH = 'standard' ! choices are: - ! 1. standard - ! 2. non-linear extrapolation - ! 3. Lai and Ktaul 2000 - cable_user%GS_SWITCH = 'leuning' - cable_user%DIAG_SOIL_RESP = 'ON ' - cable_user%LEAF_RESPIRATION = 'ON ' - cable_user%RUN_DIAG_LEVEL= 'BASIC' ! choices are: - ! 1. BASIC - ! 1. NONE - cable_user%CONSISTENCY_CHECK= .TRUE. ! TRUE outputs combined fluxes at each timestep for comparisson to A control run - cable_user%CASA_DUMP_READ = .FALSE. ! TRUE reads CASA forcing from netcdf format - cable_user%CASA_DUMP_WRITE = .FALSE. ! TRUE outputs CASA forcing in netcdf format - cable_user%SSNOW_POTEV= 'HDM' ! Humidity Deficit Method - cable_user%l_ice_consistency = .FALSE. ! TRUE add QA step for ice tiles input. -&end diff --git a/src/offline/cable_driver_common.F90 b/src/offline/cable_driver_common.F90 index 9fc5b92c0..2be61d075 100644 --- a/src/offline/cable_driver_common.F90 +++ b/src/offline/cable_driver_common.F90 @@ -22,7 +22,6 @@ MODULE cable_driver_common_mod verbose, & leaps, & logn, & - fixedCO2, & ncciy, & gswpfile, & globalMetfile, & @@ -42,6 +41,16 @@ MODULE cable_driver_common_mod USE CABLE_PLUME_MIP, ONLY : PLUME_MIP_TYPE, PLUME_MIP_INIT USE CABLE_CRU, ONLY : CRU_TYPE, CRU_INIT USE CABLE_site, ONLY : site_TYPE, site_INIT +USE read_namelists_mod_cbl, ONLY: read_cable_namelists + +USE temp_module, ONLY: spincasa, & + spinup, & + CASAONLY, & + l_casacnp, & + l_laiFeedbk, & + l_vcmaxFeedbk, & + LALLOC + IMPLICIT NONE PRIVATE @@ -50,56 +59,8 @@ MODULE cable_driver_common_mod !! Number of GSWP met forcing variables (rain, snow, lw, sw, ps, qa, ta, wd) REAL, PARAMETER :: CONSISTENCY_CHECK_TOLERANCE = 1.e-7 !! Max tolerance value for quasi-bit reproducibility checks - - LOGICAL, SAVE, PUBLIC :: vegparmnew = .FALSE. ! using new format input file (BP dec 2007) - LOGICAL, SAVE, PUBLIC :: spinup = .FALSE. ! model spinup to soil state equilibrium? - LOGICAL, SAVE, PUBLIC :: spincasa = .FALSE. ! TRUE: CASA-CNP Will spin mloop times, FALSE: no spin up - LOGICAL, SAVE, PUBLIC :: CASAONLY = .FALSE. ! ONLY Run CASA-CNP - LOGICAL, SAVE, PUBLIC :: l_casacnp = .FALSE. ! using CASA-CNP with CABLE - LOGICAL, SAVE, PUBLIC :: l_landuse = .FALSE. ! using CASA-CNP with CABLE - LOGICAL, SAVE, PUBLIC :: l_laiFeedbk = .FALSE. ! using prognostic LAI - LOGICAL, SAVE, PUBLIC :: l_vcmaxFeedbk = .FALSE. ! using prognostic Vcmax - - REAL, SAVE, PUBLIC :: delsoilM ! allowed variation in soil moisture for spin up - REAL, SAVE, PUBLIC :: delsoilT ! allowed variation in soil temperature for spin up - REAL, SAVE, PUBLIC :: delgwM = 1e-4 - - INTEGER, SAVE, PUBLIC :: LALLOC = 0 ! allocation coefficient for passing to spincasa - - NAMELIST /CABLE/ & - filename, & ! TYPE, containing input filenames - vegparmnew, & ! use new soil param. method - soilparmnew, & ! use new soil param. method - calcsoilalbedo, & ! albedo considers soil color Ticket #27 - spinup, & ! spinup model (soil) to steady state - delsoilM, & - delsoilT, & - delgwM, & - output, & - patchout, & - check, & - verbose, & - leaps, & - logn, & - fixedCO2, & - spincasa, & - l_casacnp, & - l_landuse, & - l_laiFeedbk, & - l_vcmaxFeedbk, & - CASAONLY, & - icycle, & - casafile, & - ncciy, & - gswpfile, & - globalMetfile, & - redistrb, & - wiltParam, & - satuParam, & - snmin, & - cable_user, & ! additional USER switches - gw_params - +INTEGER, PARAMETER :: nmlunitnumber = 88813 ! this is to satisfy UM method + ! where a shared_unitnumber is used PUBLIC :: cable_driver_init PUBLIC :: cable_driver_init_gswp PUBLIC :: cable_driver_init_plume @@ -131,13 +92,10 @@ SUBROUTINE cable_driver_init(mpi_grp, NRRRR) WRITE(*,*) "THE NAME LIST IS ", CABLE_NAMELIST END IF - ! Open, read and close the namelist file. - OPEN(NEWUNIT=unit, FILE=CABLE_NAMELIST, STATUS="OLD", ACTION="READ") - READ(unit, NML=CABLE) - CLOSE(unit) - cable_runtime%offline = .TRUE. + CALL read_cable_namelists( nmlunitnumber ) + ! Open log file: IF (mpi_grp%rank == 0) THEN OPEN(logn, FILE=filename%log) diff --git a/src/offline/cable_serial.F90 b/src/offline/cable_serial.F90 index 366aa58de..973c2ca29 100644 --- a/src/offline/cable_serial.F90 +++ b/src/offline/cable_serial.F90 @@ -62,18 +62,6 @@ MODULE cable_serial !! Offline serial driver for CABLE. USE cable_driver_common_mod, ONLY : & cable_driver_init, & - vegparmnew, & - spinup, & - spincasa, & - CASAONLY, & - l_casacnp, & - l_landuse, & - l_laiFeedbk, & - l_vcmaxFeedbk, & - delsoilM, & - delsoilT, & - delgwM, & - LALLOC, & prepareFiles, & prepareFiles_princeton, & LUCdriver, & @@ -150,6 +138,19 @@ MODULE cable_serial USE landuse_variable USE bgcdriver_mod, ONLY : bgcdriver USE casa_offline_inout_module, ONLY : WRITE_CASA_RESTART_NC, WRITE_CASA_OUTPUT_NC +USE temp_module, ONLY: vegparmnew, & + spinup, & + spincasa, & + CASAONLY, & + l_landuse, & + l_casacnp, & + l_laiFeedbk, & + l_vcmaxFeedbk, & + delsoilM, & + delsoilT, & + delgwM, & + LALLOC + IMPLICIT NONE PRIVATE diff --git a/src/offline/temp_module.F90 b/src/offline/temp_module.F90 new file mode 100644 index 000000000..6ff9d5bd9 --- /dev/null +++ b/src/offline/temp_module.F90 @@ -0,0 +1,18 @@ +MODULE temp_module + +LOGICAL, SAVE, PUBLIC :: vegparmnew = .FALSE. ! using new format input file (BP dec 2007) +LOGICAL, SAVE, PUBLIC :: spinup = .FALSE. ! model spinup to soil state equilibrium? +LOGICAL, SAVE, PUBLIC :: spincasa = .FALSE. ! TRUE: CASA-CNP Will spin mloop times, FALSE: no spin up +LOGICAL, SAVE, PUBLIC :: CASAONLY = .FALSE. ! ONLY Run CASA-CNP +LOGICAL, SAVE, PUBLIC :: l_casacnp = .FALSE. ! using CASA-CNP with CABLE +LOGICAL, SAVE, PUBLIC :: l_landuse = .FALSE. ! using CASA-CNP with CABLE +LOGICAL, SAVE, PUBLIC :: l_laiFeedbk = .FALSE. ! using prognostic LAI +LOGICAL, SAVE, PUBLIC :: l_vcmaxFeedbk = .FALSE. ! using prognostic Vcmax + +REAL, SAVE, PUBLIC :: delsoilM ! allowed variation in soil moisture for spin up +REAL, SAVE, PUBLIC :: delsoilT ! allowed variation in soil temperature for spin up +REAL, SAVE, PUBLIC :: delgwM = 1e-4 + +INTEGER, SAVE, PUBLIC :: LALLOC = 0 ! alloc coeff passed to spincasa + +END MODULE temp_module diff --git a/src/shared/read_namelists_mod_cbl.F90 b/src/shared/read_namelists_mod_cbl.F90 new file mode 100644 index 000000000..64e9332ae --- /dev/null +++ b/src/shared/read_namelists_mod_cbl.F90 @@ -0,0 +1,181 @@ +MODULE read_namelists_mod_cbl + +IMPLICIT NONE + +CHARACTER(LEN=*), PARAMETER, PRIVATE :: ModuleName='READ_NAMELISTS_MOD_CBL' + +CONTAINS + +SUBROUTINE read_cable_namelists( unitnumber ) + +! Description: +! Organize reading ALL cable namelists + +USE cable_common_module, ONLY: cable_runtime +USE cable_namelist_util, ONLY: cable_namelist + +IMPLICIT NONE + +! Subroutine arguments +INTEGER, INTENT(IN) :: unitnumber + +CHARACTER(LEN=*), PARAMETER :: RoutineName='read_cable_namelists' + +CALL read_cable_namelist( unitnumber, cable_namelist ) + +IF( cable_runtime%offline ) THEN + CALL read_offline_namelist( "offline.nml" ) +ENDIF + +RETURN +END SUBROUTINE read_cable_namelists + + + +SUBROUTINE read_cable_namelist( unitnumber, cable_namelist ) +! Description: +! Read the cable namelist + +!!USE cable_common_module_temp, ONLY: calcsoilalbedo, redistrb, wiltParam, & +!! satuParam, snmin, cable_user, gw_params + +USE cable_common_module, ONLY: & + calcsoilalbedo, & + redistrb, & + wiltParam, & + satuParam, & + snmin, & + cable_user, & + gw_params + +USE temp_module, ONLY: l_casacnp, & + l_landuse, & + l_laiFeedbk, & + l_vcmaxFeedbk + +USE casadimension, ONLY: icycle +USE casavariable, ONLY: casafile + +IMPLICIT NONE + +! Subroutine arguments +INTEGER, INTENT(IN) :: unitnumber +CHARACTER(LEN=*), INTENT(IN) :: cable_namelist + +CHARACTER(LEN=*), PARAMETER :: RoutineName='read_cable_namelist' + +NAMELIST /CABLE/ & +calcsoilalbedo, & ! albedo considers soil color Ticket #27 +l_casacnp, & +l_landuse, & +l_laiFeedbk, & +l_vcmaxFeedbk, & +icycle, & +redistrb, & +wiltParam, & +satuParam, & +snmin, & +cable_user, & +gw_params + +! Open, read and close the namelist file. +OPEN( UNIT=unitnumber, FILE=CABLE_NAMELIST, STATUS="OLD", ACTION="READ" ) + READ( unitnumber, NML=CABLE ) +CLOSE( unitnumber ) + +RETURN +END SUBROUTINE read_cable_namelist + + + +SUBROUTINE read_offline_namelist( offline_namelist ) +! Description: +! Read the cable namelist for offline apps only + +USE cable_common_module, ONLY: filename +USE casavariable, ONLY: casafile + +USE cable_IO_vars_module, ONLY: & + soilparmnew, & + fixedCO2, & + output, & + patchout, & + check, & + verbose, & + leaps, & + logn, & + ncciy, & + gswpfile, & + globalMetfile + +USE temp_module, ONLY: vegparmnew, & + spinup, & + spincasa, & + CASAONLY, & + delsoilM, & + delsoilT, & + delgwM, & + LALLOC +IMPLICIT NONE + +! Subroutine arguments +CHARACTER(LEN=*), INTENT(IN) :: offline_namelist + +INTEGER :: unitnumber +CHARACTER(LEN=*), PARAMETER :: RoutineName='read_offline_cable_namelist' + +NAMELIST /offline/ & +filename, & ! TYPE, containing input filenames +vegparmnew, & ! use new soil param. method +soilparmnew, & ! use new soil param. method +spinup, & ! spinup model (soil) to steady state +delsoilM, & +delsoilT, & +delgwM, & +fixedCO2, & +output, & +patchout, & +check, & +verbose, & +leaps, & +logn, & +spincasa, & +CASAONLY, & +casafile, & +ncciy, & +gswpfile, & +globalMetfile + +! Open, read and close the namelist file. +OPEN( NEWUNIT=unitnumber, FILE=offline_namelist, STATUS="OLD", ACTION="READ" ) + READ( unitnumber, NML=offline) +CLOSE( unitnumber ) + +RETURN +END SUBROUTINE read_offline_namelist + + + +!SUBROUTINE read_cable_model_environment(unitnumber) +! +!! Description: +!! Read the cable namelist +! +!USE cable_model_env_mod, ONLY: read_nml_cable_model_env +!USE cable_model_env_mod, ONLY: set_derived_variables_cable_model_env +! +!IMPLICIT NONE +! +!! Subroutine arguments +!INTEGER, INTENT(IN) :: unitnumber +! +!CHARACTER(LEN=*), PARAMETER :: RoutineName='READ_CABLE_MODEL_ENVIRONMENT' +! +!CALL read_nml_cable_model_env(unitnumber) +! +!CALL set_derived_variables_cable_model_env() +! +!RETURN +!END SUBROUTINE read_cable_model_environment + +END MODULE read_namelists_mod_cbl