From f835a2c3c157223b1299e93e04503dfa876e99f4 Mon Sep 17 00:00:00 2001 From: daleihao Date: Tue, 28 May 2024 12:31:54 -0700 Subject: [PATCH 001/197] use std_elev when stdev_elev is not available in fsurdata & remove latitude limit fix a small bug --- components/elm/src/biogeophys/SurfaceAlbedoMod.F90 | 2 +- components/elm/src/main/surfrdMod.F90 | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/elm/src/biogeophys/SurfaceAlbedoMod.F90 b/components/elm/src/biogeophys/SurfaceAlbedoMod.F90 index 073c836c19b..49c6d061d3d 100644 --- a/components/elm/src/biogeophys/SurfaceAlbedoMod.F90 +++ b/components/elm/src/biogeophys/SurfaceAlbedoMod.F90 @@ -1811,7 +1811,7 @@ subroutine Albedo_TOP_Adjustment(bounds, num_pft, filter_pft, & lon_180 = lon(g) if (lon_180 > pi) lon_180 = lon_180-2._r8*pi - if (cosz > 0._r8 .and. abs(lat(g)) < 1.047_r8 .and. stdev_elev(g) > 0._r8) then + if (cosz > 0._r8 .and. stdev_elev(g) > 0._r8) then local_timeofday = next_tod + lon_180 / pi * 180._r8 * 240._r8 if (local_timeofday >= 86400._r8) then diff --git a/components/elm/src/main/surfrdMod.F90 b/components/elm/src/main/surfrdMod.F90 index 9cbcd4b2b8e..31ce8cd5b5f 100755 --- a/components/elm/src/main/surfrdMod.F90 +++ b/components/elm/src/main/surfrdMod.F90 @@ -1702,7 +1702,12 @@ subroutine surfrd_get_topo_for_solar_rad(domain,filename) call ncd_io(ncid=ncid, varname='STDEV_ELEV', flag='read', data=domain%stdev_elev, & dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: STDEV_ELEV NOT on fsurdat file' ) + if (.not. readvar) then + write(iulog,*) trim(subname),' ERROR: STDEV_ELEV NOT on fsurdat file' + call ncd_io(ncid=ncid, varname='STD_ELEV', flag='read', data=domain%stdev_elev, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) call endrun( trim(subname)//' ERROR: BOTH STD_ELEV and STDEV_ELEV NOT on fsurdat file' ) + endif call ncd_io(ncid=ncid, varname='SKY_VIEW', flag='read', data=domain%sky_view, & dim1name=grlnd, readvar=readvar) if (.not. readvar) call endrun( trim(subname)//' ERROR: SKY_VIEW NOT on fsurdat file' ) From e4b362d0269854dd5537e935cf2d94fdf1ac8a1b Mon Sep 17 00:00:00 2001 From: Dalei Hao Date: Tue, 28 May 2024 14:48:55 -0700 Subject: [PATCH 002/197] modidy error message --- components/elm/src/main/surfrdMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/elm/src/main/surfrdMod.F90 b/components/elm/src/main/surfrdMod.F90 index 31ce8cd5b5f..43bb7965314 100755 --- a/components/elm/src/main/surfrdMod.F90 +++ b/components/elm/src/main/surfrdMod.F90 @@ -1703,7 +1703,7 @@ subroutine surfrd_get_topo_for_solar_rad(domain,filename) call ncd_io(ncid=ncid, varname='STDEV_ELEV', flag='read', data=domain%stdev_elev, & dim1name=grlnd, readvar=readvar) if (.not. readvar) then - write(iulog,*) trim(subname),' ERROR: STDEV_ELEV NOT on fsurdat file' + write(iulog,*) trim(subname),' WARNING: STDEV_ELEV NOT on fsurdat file. Try to use STD_ELEV instead.' call ncd_io(ncid=ncid, varname='STD_ELEV', flag='read', data=domain%stdev_elev, & dim1name=grlnd, readvar=readvar) if (.not. readvar) call endrun( trim(subname)//' ERROR: BOTH STD_ELEV and STDEV_ELEV NOT on fsurdat file' ) From 2edf9b3c5649c798f7552e045416fd68b283b96c Mon Sep 17 00:00:00 2001 From: Dalei Hao Date: Thu, 13 Jun 2024 15:44:32 -0700 Subject: [PATCH 003/197] Undo the change related to latitude limits --- components/elm/src/biogeophys/SurfaceAlbedoMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/elm/src/biogeophys/SurfaceAlbedoMod.F90 b/components/elm/src/biogeophys/SurfaceAlbedoMod.F90 index 49c6d061d3d..073c836c19b 100644 --- a/components/elm/src/biogeophys/SurfaceAlbedoMod.F90 +++ b/components/elm/src/biogeophys/SurfaceAlbedoMod.F90 @@ -1811,7 +1811,7 @@ subroutine Albedo_TOP_Adjustment(bounds, num_pft, filter_pft, & lon_180 = lon(g) if (lon_180 > pi) lon_180 = lon_180-2._r8*pi - if (cosz > 0._r8 .and. stdev_elev(g) > 0._r8) then + if (cosz > 0._r8 .and. abs(lat(g)) < 1.047_r8 .and. stdev_elev(g) > 0._r8) then local_timeofday = next_tod + lon_180 / pi * 180._r8 * 240._r8 if (local_timeofday >= 86400._r8) then From 047111c9358244b176cce8543119d727d7c3b7ef Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Fri, 21 Jun 2024 16:01:17 -0600 Subject: [PATCH 004/197] add new mkatmsrffile tool --- .../eam/tools/mkatmsrffile/mkatmsrffile.py | 295 ++++++++++++++++++ .../{ => old_mkatmsrffile}/Makefile | 0 .../{ => old_mkatmsrffile}/README | 0 .../{ => old_mkatmsrffile}/mkatmsrffile.F90 | 0 .../{ => old_mkatmsrffile}/nml_atmsrf | 0 .../test_mkatmsrffile.sh | 0 .../generate-dry-deposition.md | 38 ++- 7 files changed, 331 insertions(+), 2 deletions(-) create mode 100644 components/eam/tools/mkatmsrffile/mkatmsrffile.py rename components/eam/tools/mkatmsrffile/{ => old_mkatmsrffile}/Makefile (100%) rename components/eam/tools/mkatmsrffile/{ => old_mkatmsrffile}/README (100%) rename components/eam/tools/mkatmsrffile/{ => old_mkatmsrffile}/mkatmsrffile.F90 (100%) rename components/eam/tools/mkatmsrffile/{ => old_mkatmsrffile}/nml_atmsrf (100%) rename components/eam/tools/mkatmsrffile/{ => old_mkatmsrffile}/test_mkatmsrffile.sh (100%) diff --git a/components/eam/tools/mkatmsrffile/mkatmsrffile.py b/components/eam/tools/mkatmsrffile/mkatmsrffile.py new file mode 100644 index 00000000000..50999b6e945 --- /dev/null +++ b/components/eam/tools/mkatmsrffile/mkatmsrffile.py @@ -0,0 +1,295 @@ +#!/usr/bin/env python3 +#--------------------------------------------------------------------------------------------------- +''' +This is a replacement for the legacy gen_domain tool created for CESM. +Most legacy functionality is reproduced, with the notable exception of +the pole point latitude adjustment needed for the CESM FV grid. + +Created April, 2024 by Walter Hannah (LLNL) +''' +#--------------------------------------------------------------------------------------------------- +''' +The map file used to generate the atmsrf files can be created a few different ways. +For a typical E3SM configuration we recommend using a conservative, monotone map. +Here is an example command that can be used to generate one as of NCO version 5.2.2 + + SRC_GRID=${DIN_LOC_ROOT}/../mapping/grids/1x1d.nc + DST_GRID=${GRID_ROOT}/ne${NE}pg2_scrip.nc + MAP_FILE=${MAP_ROOT}/map_1x1_to_ne${NE}pg2_traave.nc + ncremap -a traave --src_grd=${SRC_GRID} --dst_grd=${DST_GRID} --map_file=${MAP_FILE} + +''' +#--------------------------------------------------------------------------------------------------- +import datetime, os, numpy as np, xarray as xr, numba, itertools, subprocess as sp +user, host = os.getenv('USER'), os.getenv('HOST') +source_code_meta = 'generate_domain_E3SM.py' +#--------------------------------------------------------------------------------------------------- +class clr:END,RED,GREEN,MAGENTA,CYAN = '\033[0m','\033[31m','\033[32m','\033[35m','\033[36m' +#--------------------------------------------------------------------------------------------------- +usage = ''' +python mkatmsrffile.py --map_file + --dst_grid + [--output-root ] + [--date-stamp ] + +Purpose: + This tool generates a file needed to prescribe atmospheric dry deposition of aerosols at the surface. + +Environment + + This tool requires a few special packages, such as xarray, numba, and itertools. + These are all included in the E3SM unified environment: + https://e3sm.org/resources/tools/other-tools/e3sm-unified-environment/ + + Otherwise a simple conda environment can be created: + conda create --name example_env --channel conda-forge xarray numpy numba scikit-learn netcdf4 + +The following output file is created: + + atmsrf__.nc + ???? + +''' +from optparse import OptionParser +parser = OptionParser(usage=usage) +parser.add_option('--map_file', + dest='map_file', + default=None, + help='Mapping file from a 1x1 degree grid to the target atmosphere grid') +parser.add_option('--vegetation_file', + dest='vegetation_file', + default=None, + help='Path to file containing area fractions of surface types and plant functional type (PFT) data (regrid_vegetation.nc)') +parser.add_option('--soil_water_file', + dest='soil_water_file', + default=None, + help='Path to file containing soil water data (clim_soilw.nc)') +parser.add_option('--dst_grid', + dest='dst_grid', + default=None, + help='destination atmosphere grid name') +parser.add_option('--output_root', + dest='output_root', + default='./', + help='Output path for domain files') +parser.add_option('--date-stamp', + dest='date_stamp', + default=None, + help='Creation date stamp for domain files') +(opts, args) = parser.parse_args() +#--------------------------------------------------------------------------------------------------- +def main(): + #----------------------------------------------------------------------------- + # check for valid input arguments + if opts.map_file is None: + raise ValueError(f'{clr.RED}map_file was not specified{clr.END}') + if opts.vegetation_file is None: + raise ValueError(f'{clr.RED}vegetation_file was not specified{clr.END}') + if opts.soil_water_file is None: + raise ValueError(f'{clr.RED}soil_water_file was not specified{clr.END}') + if opts.dst_grid is None: + raise ValueError(f'{clr.RED}dst_grid was not specified{clr.END}') + #----------------------------------------------------------------------------- + # check existence of input files and output path + if not os.path.exists(opts.vegetation_file) : + raise ValueError(f'{clr.RED}Vegetaion file does not exist:{clr.END} {opts.vegetation_file}') + if not os.path.exists(opts.soil_water_file) : + raise ValueError(f'{clr.RED}Soil water file does not exist:{clr.END} {opts.soil_water_file}') + if not os.path.exists(opts.output_root) : + raise ValueError(f'{clr.RED}Output root path does not exist:{clr.END} {opts.output_root}') + + #----------------------------------------------------------------------------- + # Set date stamp for file name + + if opts.date_stamp is None: + cdate = datetime.datetime.now().strftime('%Y%m%d') + else: + cdate = opts.date_stamp + + #----------------------------------------------------------------------------- + # specify output file name + + output_file = f'{opts.output_root}/atm_srf_{opts.dst_grid}_{cdate}.nc' + + #----------------------------------------------------------------------------- + # open input files as datasets + + ds_map = xr.open_dataset(opts.map_file) + ds_veg = xr.open_dataset(opts.vegetation_file) + ds_slw = xr.open_dataset(opts.soil_water_file) + + #----------------------------------------------------------------------------- + # check that dimension sizes are consistent + + nxy_veg = len(ds_veg.lat) * len(ds_veg.lon) + nxy_slw = len(ds_slw.lat) * len(ds_slw.lon) + n_a = len(ds_map.n_a) + n_b = len(ds_map.n_b) + + if nxy_veg!=nxy_slw or n_a!=nxy_veg or n_a!=nxy_slw: + err_msg = f'{clr.RED}Input file dimension sizes are inconsistent:{clr.END}' + err_msg += f' n_a: {n_a} nxy_veg: {nxy_veg} nxy_slw: {nxy_slw}' + raise ValueError(err_msg) + + ntime = 12 # expected length of time dimension + + if len(ds_veg.time)!=ntime: + err_msg = f'vegetation_file time record error:' + err_msg += f' expected length = {ntime}, actual length = {len(ds_veg.time)}' + raise ValueError(err_msg) + + if len(ds_slw.time)!=ntime: + err_msg = f'soil_water_file time record error:' + err_msg += f' expected length = {ntime}, actual length = {len(ds_slw.time)}' + raise ValueError(err_msg) + + if len(ds_veg.lat)!=len(ds_slw.lat): + err_msg = f'inconsistent latitude coordinate lengths:' + err_msg += f' ds_veg.lat = {len(ds_veg.lat)}' + err_msg += f' ds_slw.lat = {len(ds_slw.lat)}' + raise ValueError(err_msg) + + if len(ds_veg.lon)!=len(ds_slw.lon): + err_msg = f'inconsistent latitude coordinate lengths:' + err_msg += f' ds_veg.lon = {len(ds_veg.lon)}' + err_msg += f' ds_slw.lon = {len(ds_slw.lon)}' + raise ValueError(err_msg) + + #----------------------------------------------------------------------------- + # print some informative stuff + + print(f''' + File and parameter values: + {clr.GREEN}map_file {clr.END}: {opts.map_file} + {clr.GREEN}vegetation_file {clr.END}: {opts.vegetation_file} + {clr.GREEN}soil_water_file {clr.END}: {opts.soil_water_file} + {clr.GREEN}output_root {clr.END}: {opts.output_root} + {clr.GREEN}output_file {clr.END}: {output_file} + {clr.GREEN}dst_grid {clr.END}: {opts.dst_grid} + {clr.GREEN}map_file n_a {clr.END}: {n_a} + {clr.GREEN}map_file n_b {clr.END}: {n_b} + ''') + + #----------------------------------------------------------------------------- + # Load input data + # (also convert percentage to fraction [0,1]) + LANDMASK_in = ds_veg['LANDMASK' ].values + PCT_LAKE_in = ds_veg['PCT_LAKE' ].values/1e2 + PCT_URBAN_in = ds_veg['PCT_URBAN' ].values/1e2 + PCT_WETLAND_in = ds_veg['PCT_WETLAND'].values/1e2 + PCT_PFT_in = ds_veg['PCT_PFT' ].values/1e2 + SOILW_in = ds_slw['SOILW' ].values + #----------------------------------------------------------------------------- + # Adjust input data based on land fraction (for consistency with fortran tool) + nlat = len(ds_veg.lat) + nlon = len(ds_veg.lon) + adjust_inputs(ntime, nlat, nlon, LANDMASK_in, PCT_LAKE_in, PCT_URBAN_in, PCT_WETLAND_in, SOILW_in) + #----------------------------------------------------------------------------- + # Remap data to the atmosphere grid + + n_s = len(ds_map.n_s) + wgt = ds_map.S.values + row = ds_map.row.values-1 + col = ds_map.col.values-1 + + shp_1D = (n_b) + shp_2D = (ntime,n_b) + + SOILW = apply_map_2D( np.zeros(shp_2D), ntime, n_s, wgt, row, col, np.reshape(SOILW_in,(ntime,-1)) ) + + PCT_LAKE = apply_map_1D( np.zeros(shp_1D), n_s, wgt, row, col, np.reshape(PCT_LAKE_in ,-1) ) + PCT_URBAN = apply_map_1D( np.zeros(shp_1D), n_s, wgt, row, col, np.reshape(PCT_URBAN_in ,-1) ) + PCT_WETLAND = apply_map_1D( np.zeros(shp_1D), n_s, wgt, row, col, np.reshape(PCT_WETLAND_in,-1) ) + + npft = len(ds_veg.PCT_PFT[:,0,0]) + PCT_PFT = np.zeros((npft,n_b)) + for p in range(npft): + PCT_PFT[p,:] = apply_map_1D( np.zeros(shp_1D), n_s, wgt, row, col, np.reshape(PCT_PFT_in[p,:,:],-1) ) + + #----------------------------------------------------------------------------- + # Compute fields to output + + nclass_landuse = 11 + fraction_landuse = np.zeros([nclass_landuse,n_b]) + total_soilw = np.zeros([ntime,n_b]) + + for i in range(n_b): + # Calculate total_land as sum as all surface type fractions + total_land = PCT_LAKE[i] + PCT_URBAN[i] + PCT_WETLAND[i] + for p in range(npft): total_land += PCT_PFT[p,i] + # Adjust lake area fraction + if total_land<1.0: + PCT_LAKE[i] = PCT_LAKE[i] + (1.0 - total_land) + # Calculate total_soilw + fraction_soilw = total_land - ( PCT_LAKE[i] + PCT_WETLAND[i] ) + for t in range(ntime): + total_soilw[t,i] = total_soilw[t,i] + SOILW[t,i] * fraction_soilw + + # Calculate fraction_landuse - n-1 indexing is used to correspond to fortran indexing + fraction_landuse[ 1-1,i] = PCT_URBAN[i] + fraction_landuse[ 2-1,i] = np.sum( PCT_PFT[[n-1 for n in [16,17]] ,i], axis=0) + fraction_landuse[ 3-1,i] = np.sum( PCT_PFT[[n-1 for n in [13,14,15]] ,i], axis=0) + fraction_landuse[ 4-1,i] = np.sum( PCT_PFT[[n-1 for n in [5,6,7,8,9]],i], axis=0) + fraction_landuse[ 5-1,i] = np.sum( PCT_PFT[[n-1 for n in [2,3,4]] ,i], axis=0) + fraction_landuse[ 6-1,i] = PCT_WETLAND[i] + fraction_landuse[ 7-1,i] = PCT_LAKE[i] + fraction_landuse[ 8-1,i] = PCT_PFT[1-1,i] + fraction_landuse[11-1,i] = np.sum( PCT_PFT[[n-1 for n in [10,11,12]] ,i], axis=0) + + # Normalize fraction_landuse if it does not sum to 1 +/- tolerance + fraction_landuse_tolerance = 0.001 + fraction_landuse_sum = np.sum(fraction_landuse[:,i]) + fraction_landuse_error = fraction_landuse_sum - 1.0 + if np.absolute(fraction_landuse_error) > fraction_landuse_tolerance: + for c in range(nclass_landuse): + fraction_landuse[c,i] = fraction_landuse[c,i] / fraction_landuse_sum + + #----------------------------------------------------------------------------- + # Create output file and add fields + + ds_out = xr.Dataset() + ds_out['fraction_landuse'] = xr.DataArray(fraction_landuse,dims=['class','ncol']) + ds_out['soilw'] = xr.DataArray(SOILW ,dims=['month','ncol']) + ds_out['lon'] = ds_map.xc_b.rename({'n_b':'ncol'}) + ds_out['lat'] = ds_map.yc_b.rename({'n_b':'ncol'}) + ds_out.to_netcdf(path=output_file,mode='w') + + #----------------------------------------------------------------------------- + # convert to 64bit_data + + cmd = f'ncks -O --fl_fmt=64bit_data {output_file} {output_file} ' + sp.check_call(cmd,shell=True) + + #----------------------------------------------------------------------------- + # print status message + + print(f'\nsuccessfully created atmsrf file: {clr.MAGENTA}{output_file}{clr.END}') + print() + +#--------------------------------------------------------------------------------------------------- +@numba.njit() +def adjust_inputs(ntime, nlat, nlon, LANDMASK, PCT_LAKE, PCT_URBAN, PCT_WETLAND, SOILW): + for j in range(nlat): + for i in range(nlon): + if LANDMASK[j,i]==0: + PCT_LAKE[j,i] = 1.0 + PCT_URBAN[j,i] = 0.0 + PCT_WETLAND[j,i] = 0.0 + for t in range(ntime): SOILW[t,j,i] = 0.0 + +@numba.njit() +def apply_map_1D( data_out, n_s, wgt, row, col, data_in ): + for k in range(n_s): + data_out[row[k]] = data_out[row[k]] + data_in[col[k]] * wgt[k] + return data_out + +@numba.njit() +def apply_map_2D( data_out, ntime, n_s, wgt, row, col, data_in ): + for t in range(ntime): + for k in range(n_s): + data_out[t,row[k]] = data_out[t,row[k]] + data_in[t,col[k]] * wgt[k] + return data_out +#--------------------------------------------------------------------------------------------------- +if __name__ == '__main__': + main() +#--------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/components/eam/tools/mkatmsrffile/Makefile b/components/eam/tools/mkatmsrffile/old_mkatmsrffile/Makefile similarity index 100% rename from components/eam/tools/mkatmsrffile/Makefile rename to components/eam/tools/mkatmsrffile/old_mkatmsrffile/Makefile diff --git a/components/eam/tools/mkatmsrffile/README b/components/eam/tools/mkatmsrffile/old_mkatmsrffile/README similarity index 100% rename from components/eam/tools/mkatmsrffile/README rename to components/eam/tools/mkatmsrffile/old_mkatmsrffile/README diff --git a/components/eam/tools/mkatmsrffile/mkatmsrffile.F90 b/components/eam/tools/mkatmsrffile/old_mkatmsrffile/mkatmsrffile.F90 similarity index 100% rename from components/eam/tools/mkatmsrffile/mkatmsrffile.F90 rename to components/eam/tools/mkatmsrffile/old_mkatmsrffile/mkatmsrffile.F90 diff --git a/components/eam/tools/mkatmsrffile/nml_atmsrf b/components/eam/tools/mkatmsrffile/old_mkatmsrffile/nml_atmsrf similarity index 100% rename from components/eam/tools/mkatmsrffile/nml_atmsrf rename to components/eam/tools/mkatmsrffile/old_mkatmsrffile/nml_atmsrf diff --git a/components/eam/tools/mkatmsrffile/test_mkatmsrffile.sh b/components/eam/tools/mkatmsrffile/old_mkatmsrffile/test_mkatmsrffile.sh similarity index 100% rename from components/eam/tools/mkatmsrffile/test_mkatmsrffile.sh rename to components/eam/tools/mkatmsrffile/old_mkatmsrffile/test_mkatmsrffile.sh diff --git a/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/generate-dry-deposition.md b/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/generate-dry-deposition.md index f9dc7ff9eda..cf777c418a2 100644 --- a/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/generate-dry-deposition.md +++ b/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/generate-dry-deposition.md @@ -1,6 +1,40 @@ # Generate a Dry Deposition File -!!!WARNING - This page is still under construction +Atmospheric dry deposition of aerosols at the surface depends on certain surface properties, such as soil type. In some cases these calculations can be handled in the land model and passed to the atmosphere through the coupler. However, with modal areosols this method is not adequate and we must recalculate these fields in the atmosphere (see subroutine `interp_map` in `components/eam/src/chemistry/mozart/mo_drydep.F90`). + +For unstructured grids it was determined to create this offline interpolation tool rather than generalize the subroutine interp_map. + +Be sure to activate the E3SM unified environment when performing the steps below. + +## Map File Generation + +The destination atmosphere grid file should be on the "pg2" grid. These grid files are easily generated with three TempestRemap commands as follows: + +```shell +NE=30 +GenerateCSMesh --alt --res ${NE} --file ${GRID_ROOT}/ne${NE}.g +GenerateVolumetricMesh --in ${GRID_ROOT}/ne${NE}.g --out ${GRID_ROOT}/ne${NE}pg2.g --np 2 --uniform +ConvertMeshToSCRIP --in ${GRID_ROOT}/ne${NE}pg2.g --out ${GRID_ROOT}/ne${NE}pg2_scrip.nc +``` + +The map file used to generate atmsrf files can be created a few different ways. For a typical E3SM configuration we recommend using a conservative, monotone map. Here is an example command that can be used to generate one (as of NCO version 5.2.2) + +```shell +SRC_GRID=${DIN_LOC_ROOT}/../mapping/grids/1x1d.nc +DST_GRID=${GRID_ROOT}/ne${NE}pg2_scrip.nc +MAP_FILE=${MAP_ROOT}/map_1x1_to_ne${NE}pg2_traave.nc +ncremap -5 -a traave --src_grd=${SRC_GRID} --dst_grd=${DST_GRID} --map_file=${MAP_FILE} +``` + +For RRM grids the last two commands would be used on the exodus file produced by [SQuadGen](https://github.com/ClimateGlobalChange/squadgen) (See the [Adding Support for New Grids](https://docs.e3sm.org/user-guides/adding-grid-support-overview.md) tutorial for more information.). + +## Generating a New Dry Desposition File (atmsrf) + +```shell +VEGE_FILE=${DIN_LOC_ROOT}/atm/cam/chem/trop_mozart/dvel/regrid_vegetation.nc +SOIL_FILE=${DIN_LOC_ROOT}/atm/cam/chem/trop_mozart/dvel/clim_soilw.nc + +python ~/E3SM/mkatmsrffile.py --map_file=${MAP_FILE} --vegetation_file=${VEGE_FILE} --soil_water_file=${SOIL_FILE} --output_root=${atmsrf_root} --dst_grid=ne${NE}pg2 --date-stamp=20240613 +``` Back to step-by-step guide for [Adding Support for New Grids](../adding-grid-support-step-by-step-guide.md) From 51b8482f3ab1a7754471ef713e7bf0629a54cde3 Mon Sep 17 00:00:00 2001 From: mahf708 Date: Mon, 24 Jun 2024 21:38:42 -0400 Subject: [PATCH 005/197] workaround to point to md snippets outside of the docs dir --- components/eam/tools/mkatmsrffile/test.md | 3 +++ docs/dev-guide/adding-grid-support/index.md | 1 + docs/dev-guide/some-tools/mkatmsrffile.md | 2 ++ mkdocs.yaml | 2 ++ 4 files changed, 8 insertions(+) create mode 100644 components/eam/tools/mkatmsrffile/test.md create mode 100644 docs/dev-guide/some-tools/mkatmsrffile.md diff --git a/components/eam/tools/mkatmsrffile/test.md b/components/eam/tools/mkatmsrffile/test.md new file mode 100644 index 00000000000..bc0ef89536e --- /dev/null +++ b/components/eam/tools/mkatmsrffile/test.md @@ -0,0 +1,3 @@ +# test + +Some text goes here. diff --git a/docs/dev-guide/adding-grid-support/index.md b/docs/dev-guide/adding-grid-support/index.md index f7c25043747..4decc3976d3 100644 --- a/docs/dev-guide/adding-grid-support/index.md +++ b/docs/dev-guide/adding-grid-support/index.md @@ -6,3 +6,4 @@ - [Atmosphere Grid Overview ](../../EAM/tech-guide/atmosphere-grid-overview.md) - [Grid Description File Overview ](adding-grid-support-grid-types.md) - [Step-by-Step Guide to Support a New Grid ](adding-grid-support-step-by-step-guide.md) +- [Some test ](../some-tools/mkatmsrffile.md) diff --git a/docs/dev-guide/some-tools/mkatmsrffile.md b/docs/dev-guide/some-tools/mkatmsrffile.md new file mode 100644 index 00000000000..1c0fec1cf2b --- /dev/null +++ b/docs/dev-guide/some-tools/mkatmsrffile.md @@ -0,0 +1,2 @@ + +--8<-- 'components/eam/tools/mkatmsrffile/test.md' diff --git a/mkdocs.yaml b/mkdocs.yaml index 5c57a22993c..66a694115b9 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -9,6 +9,7 @@ nav: - Development: - Introduction: 'dev-guide/index.md' - Adding Support for New Grids: 'dev-guide/adding-grid-support/index.md' + - mkatmsrffile: 'dev-guide/some-tools/mkatmsrffile.md' - Components: '*include ./components/*/mkdocs.yml' - Tools: '*include ./tools/*/mkdocs.yml' - More Information: @@ -57,6 +58,7 @@ markdown_extensions: - pymdownx.details - pymdownx.highlight - pymdownx.superfences + - pymdownx.snippets - pymdownx.tabbed: alternate_style: true - pymdownx.arithmatex: From 52301555cba7c65f0c04d67011c1f73098105d55 Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Tue, 25 Jun 2024 16:18:02 -0600 Subject: [PATCH 006/197] cosmetic fix for consistency --- .../adding-grid-support-step-by-step-guide/add-grid-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/add-grid-config.md b/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/add-grid-config.md index b872658db45..f46a84afa76 100644 --- a/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/add-grid-config.md +++ b/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/add-grid-config.md @@ -1,3 +1,3 @@ # Add New Grid Configuration to E3SM -[Back to Adding Support for New Grids](../adding-grid-support-step-by-step-guide.md) +Back to step-by-step guide for [Adding Support for New Grids](../adding-grid-support-step-by-step-guide.md) From 7cd80e3d82d9748b9ef0a5df8c3760a4aa027976 Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Tue, 25 Jun 2024 16:18:33 -0600 Subject: [PATCH 007/197] add link to unified page --- .../generate-dry-deposition.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/generate-dry-deposition.md b/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/generate-dry-deposition.md index cf777c418a2..79e6fd017a4 100644 --- a/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/generate-dry-deposition.md +++ b/docs/dev-guide/adding-grid-support/adding-grid-support-step-by-step-guide/generate-dry-deposition.md @@ -4,7 +4,7 @@ Atmospheric dry deposition of aerosols at the surface depends on certain surface For unstructured grids it was determined to create this offline interpolation tool rather than generalize the subroutine interp_map. -Be sure to activate the E3SM unified environment when performing the steps below. +Be sure to activate the [E3SM unified environment](https://e3sm.org/resources/tools/other-tools/e3sm-unified-environment/) when performing the steps below. ## Map File Generation From 4f116b40bfa9b2e22b83fdde3606a477729f6ebd Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Tue, 9 Jul 2024 16:21:57 -0600 Subject: [PATCH 008/197] clean up for PR --- docs/dev-guide/adding-grid-support/index.md | 1 - docs/dev-guide/some-tools/mkatmsrffile.md | 2 -- mkdocs.yaml | 2 -- 3 files changed, 5 deletions(-) delete mode 100644 docs/dev-guide/some-tools/mkatmsrffile.md diff --git a/docs/dev-guide/adding-grid-support/index.md b/docs/dev-guide/adding-grid-support/index.md index 4decc3976d3..f7c25043747 100644 --- a/docs/dev-guide/adding-grid-support/index.md +++ b/docs/dev-guide/adding-grid-support/index.md @@ -6,4 +6,3 @@ - [Atmosphere Grid Overview ](../../EAM/tech-guide/atmosphere-grid-overview.md) - [Grid Description File Overview ](adding-grid-support-grid-types.md) - [Step-by-Step Guide to Support a New Grid ](adding-grid-support-step-by-step-guide.md) -- [Some test ](../some-tools/mkatmsrffile.md) diff --git a/docs/dev-guide/some-tools/mkatmsrffile.md b/docs/dev-guide/some-tools/mkatmsrffile.md deleted file mode 100644 index 1c0fec1cf2b..00000000000 --- a/docs/dev-guide/some-tools/mkatmsrffile.md +++ /dev/null @@ -1,2 +0,0 @@ - ---8<-- 'components/eam/tools/mkatmsrffile/test.md' diff --git a/mkdocs.yaml b/mkdocs.yaml index 66a694115b9..5c57a22993c 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -9,7 +9,6 @@ nav: - Development: - Introduction: 'dev-guide/index.md' - Adding Support for New Grids: 'dev-guide/adding-grid-support/index.md' - - mkatmsrffile: 'dev-guide/some-tools/mkatmsrffile.md' - Components: '*include ./components/*/mkdocs.yml' - Tools: '*include ./tools/*/mkdocs.yml' - More Information: @@ -58,7 +57,6 @@ markdown_extensions: - pymdownx.details - pymdownx.highlight - pymdownx.superfences - - pymdownx.snippets - pymdownx.tabbed: alternate_style: true - pymdownx.arithmatex: From d56618a94cc405089b10323334c7a94f6ad854f7 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 12:22:14 -0600 Subject: [PATCH 009/197] resolved: registry topodrag --- components/mpas-ocean/src/Registry.xml | 21 ++++++++++++++- .../src/shared/mpas_ocn_diagnostics.F | 26 ++++++++++++++----- .../mpas-ocean/src/shared/mpas_ocn_forcing.F | 19 +++++++++++++- .../shared/mpas_ocn_surface_bulk_forcing.F | 18 +++++++++---- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 20 ++++++++++---- .../src/shared/mpas_ocn_thick_surface_flux.F | 26 ++++++++++++++----- 6 files changed, 105 insertions(+), 25 deletions(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 825fe607a5b..0ed2b0c4246 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -702,6 +702,10 @@ description="The length scale of exponential decay of river runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> + + @@ -3347,6 +3352,9 @@ + + - + + \date 15 September 2011 !> \details !> This routine computes the horizontal advection tendency for -!> thicknes based on current state and user choices of forcings. +!> thickness based on current state and user choices of forcings. ! !----------------------------------------------------------------------- subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoefficientsRunoff, & - surfaceThicknessFlux, surfaceThicknessFluxRunoff, tend, err)!{{{ + transmissionCoefficientsSubglacialRunoff, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & + surfaceThicknessFluxSubglacialRunoff, tend, err)!{{{ !----------------------------------------------------------------- ! ! input variables @@ -83,11 +84,13 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe real (kind=RKIND), dimension(:,:), intent(in) :: & transmissionCoefficients, &!< Input: Coefficients for the transmission of surface fluxes - transmissionCoefficientsRunoff !< Input: Coefficients for the transmission of surface fluxes due to river runoff + transmissionCoefficientsRunoff, &!< Input: Coefficients for the transmission of surface fluxes due to river runoff + transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to river runoff real (kind=RKIND), dimension(:), intent(in) :: & surfaceThicknessFlux, &!< Input: surface flux of thickness - surfaceThicknessFluxRunoff !< Input: surface flux of thickness due to river runoff + surfaceThicknessFluxRunoff, &!< Input: surface flux of thickness due to river runoff + surfaceThicknessFluxSubglacialRunoff !< Input: surface flux of thickness due to subglacial runoff !----------------------------------------------------------------- @@ -124,10 +127,11 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe call mpas_timer_start("thick surface flux") #ifdef MPAS_OPENACC - !$acc enter data copyin(transmissionCoefficients, transmissionCoefficientsRunoff) + !$acc enter data copyin(transmissionCoefficients, transmissionCoefficientsRunoff, transmissionCoefficientsSubglacialRunoff) !$acc parallel loop & !$acc present(tend, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & + !$acc surfaceThicknessFluxSubglacialRunoff, transmissionCoefficientsSubglacialRunoff, & !$acc transmissionCoefficients, transmissionCoefficientsRunoff, minLevelCell, maxLevelCell) & !$acc private(k, remainingFlux, remainingFluxRunoff) #else @@ -137,12 +141,15 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe do iCell = 1, nCellsOwned remainingFlux = 1.0_RKIND remainingFluxRunoff = 1.0_RKIND + remainingFluxSubglacialRunoff = 1.0_RKIND do k = minLevelCell(iCell), maxLevelCell(iCell) remainingFlux = remainingFlux - transmissionCoefficients(k, iCell) remainingFluxRunoff = remainingFluxRunoff - transmissionCoefficientsRunoff(k, iCell) + remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) tend(k, iCell) = tend(k, iCell) + surfaceThicknessFlux(iCell) * transmissionCoefficients(k, iCell) & - + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) + + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) & + + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) end do if(maxLevelCell(iCell) > 0 .and. remainingFlux > 0.0_RKIND) then @@ -153,6 +160,11 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & + remainingFluxRunoff * surfaceThicknessFluxRunoff(iCell) end if + + if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then + tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & + + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) + end if end do #ifndef MPAS_OPENACC !$omp end do @@ -160,7 +172,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe #endif #ifdef MPAS_OPENACC - !$acc exit data delete(transmissionCoefficients, transmissionCoefficientsRunoff) + !$acc exit data delete(transmissionCoefficients, transmissionCoefficientsRunoff, transmissionCoefficientsSubglacialRunoff) #endif call mpas_timer_stop("thick surface flux") From f57b015c4c3532f94787fca00f3ed1a7a0ddb054 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 12:23:19 -0600 Subject: [PATCH 010/197] resolved: gitignore --- .gitignore | 13 +++++++++++++ .../mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 13 +++++++++++++ .../src/shared/mpas_ocn_diagnostics_variables.F | 13 ++++++++++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d7a1fabfd6b..d2fcc80bbb7 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,16 @@ components/eamxx/docs/common/eamxx_params.md components/eamxx/src/python/build components/eamxx/src/python/build_src components/eamxx/src/python/dist + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# idea folder +.idea/ diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index a8807b99506..0ca331b57b6 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -4442,6 +4442,19 @@ subroutine ocn_validate_state(domain, timeLevel)!{{{ call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) end if + ! Test riverRunoffFlux + fieldName = 'subglacialRunoffFlux' + minValue = HUGE(minValue) + maxValue = -HUGE(maxValue) + call mpas_pool_get_array(forcingPool, fieldName, real1DArr) + if ( associated(real1DArr) ) then + do iCell = 1, nCellsSolve + minValue = min( minValue, real1DArr(iCell) ) + maxValue = max( maxValue, real1DArr(iCell) ) + end do + call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) + end if + ! Test seaIceSalinityFlux fieldName = 'seaIceSalinityFlux' minValue = HUGE(minValue) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F index 30a62f68c8b..38f32f88e17 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F @@ -85,6 +85,7 @@ module ocn_diagnostics_variables real (kind=RKIND), dimension(:), pointer :: sfcFlxAttCoeff real (kind=RKIND), dimension(:), pointer :: surfaceFluxAttenuationCoefficientRunoff + real (kind=RKIND), dimension(:), pointer :: surfaceFluxAttenuationCoefficientSubglacialRunoff real (kind=RKIND), dimension(:), pointer :: landIceFrictionVelocity real (kind=RKIND), dimension(:), pointer :: velocityTidalRMS @@ -680,6 +681,9 @@ subroutine ocn_diagnostics_variables_init(domain, jenkinsOn, hollandJenkinsOn, e call mpas_pool_get_array(diagnosticsPool, & 'surfaceFluxAttenuationCoefficientRunoff', & surfaceFluxAttenuationCoefficientRunoff) + call mpas_pool_get_array(diagnosticsPool, & + 'surfaceFluxAttenuationCoefficientSubglacialRunoff', & + surfaceFluxAttenuationCoefficientSubglacialRunoff) call mpas_pool_get_array(diagnosticsPool, & 'boundaryLayerDepth', & boundaryLayerDepth) @@ -964,7 +968,8 @@ subroutine ocn_diagnostics_variables_init(domain, jenkinsOn, hollandJenkinsOn, e !$acc Time_bnds, & !$acc simulationStartTime, & !$acc boundaryLayerDepthSmooth, & - !$acc surfaceFluxAttenuationCoefficientRunoff & + !$acc surfaceFluxAttenuationCoefficientRunoff, & + !$acc surfaceFluxAttenuationCoefficientSubglacialRunoff & !$acc ) end subroutine ocn_diagnostics_variables_init!}}} @@ -1223,7 +1228,8 @@ subroutine ocn_diagnostics_variables_destroy(err) !{{{ !$acc Time_bnds, & !$acc simulationStartTime, & !$acc boundaryLayerDepthSmooth, & - !$acc surfaceFluxAttenuationCoefficientRunoff & + !$acc surfaceFluxAttenuationCoefficientRunoff, & + !$acc surfaceFluxAttenuationCoefficientSubglacialRunoff & !$acc ) ! Nullify pointers @@ -1425,7 +1431,8 @@ subroutine ocn_diagnostics_variables_destroy(err) !{{{ Time_bnds, & simulationStartTime, & boundaryLayerDepthSmooth, & - surfaceFluxAttenuationCoefficientRunoff) + surfaceFluxAttenuationCoefficientRunoff, & + surfaceFluxAttenuationCoefficientSubglacialRunoff) end subroutine ocn_diagnostics_variables_destroy!}}} From b4198e827e55af9f6c29cfe3510de83de20a1a46 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 18 Oct 2023 17:28:44 -0600 Subject: [PATCH 011/197] subglacial runoff for tracers, part 1 --- .../src/shared/mpas_ocn_diagnostics.F | 22 ++++++++-- .../shared/mpas_ocn_surface_bulk_forcing.F | 21 +++++++--- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 31 +++++++++++--- .../src/shared/mpas_ocn_thick_surface_flux.F | 2 +- .../mpas_ocn_tracer_surface_flux_to_tend.F | 40 ++++++++++++++++++- 5 files changed, 98 insertions(+), 18 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 0ca331b57b6..4e75d743130 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3298,6 +3298,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & real (kind=RKIND) :: & fracAbsorbed, &! fraction of sfc flux absorbed fracAbsorbedRunoff, &! same for runoff + fracAbsorbedSubglacialRunoff, &! same for subglacial runoff sumSurfaceStressSquared ! sum of sfc stress squared ! pointers for variable/pool retrievals @@ -3313,6 +3314,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & penetrativeTemperatureFlux, &! various sfc flux components surfaceThicknessFlux, & surfaceThicknessFluxRunoff, & + surfaceThicknessFluxSubglacialRunoff, & rainTemperatureFlux, & evapTemperatureFlux, & icebergTemperatureFlux, & @@ -3325,6 +3327,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & normalVelocity, &! normal velocity activeTracersSurfaceFlux, &! sfc flux of active tracers (T,S) activeTracersSurfaceFluxRunoff, &! flx of tracers in runoff + activeTracersSurfaceFluxSubglacialRunoff, &! flx of tracers in subglacial runoff nonLocalSurfaceTracerFlux ! non-local flux of tracers real (kind=RKIND), dimension(:,:,:), pointer :: & @@ -3388,11 +3391,16 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & call mpas_pool_get_array(tracersSurfaceFluxPool, & 'activeTracersSurfaceFluxRunoff', & activeTracersSurfaceFluxRunoff) + call mpas_pool_get_array(tracersSurfaceFluxPool, & + 'activeTracersSurfaceFluxSubglacialRunoff', & + activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_array(forcingPool, 'surfaceThicknessFlux', & surfaceThicknessFlux) call mpas_pool_get_array(forcingPool, 'surfaceThicknessFluxRunoff', & surfaceThicknessFluxRunoff) + call mpas_pool_get_array(forcingPool, 'surfaceThicknessFluxSubglacialRunoff', & + surfaceThicknessFluxSubglacialRunoff) call mpas_pool_get_array(forcingPool, 'penetrativeTemperatureFlux', & penetrativeTemperatureFlux) call mpas_pool_get_array(forcingPool, 'surfaceStress', & @@ -3465,7 +3473,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & !$omp parallel !$omp do schedule(runtime) & - !$omp private(kmin, fracAbsorbed, fracAbsorbedRunoff, & + !$omp private(kmin, fracAbsorbed, fracAbsorbedRunoff, fracAbsorbedSubglacialRunoff, & !$omp sumSurfaceStressSquared, i, iEdge) do iCell = 1, nCells @@ -3479,6 +3487,10 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) + fracAbsorbedSubglacialRunoff = 1.0_RKIND & + - exp( max(-100.0_RKIND, & + -layerThickness(kmin, iCell)/ & + config_flux_attenuation_coefficient_subglacial_runoff)) ! Store the total tracer flux below in ! nonLocalSurfaceTemperatureFlux for use in the CVMix nonlocal @@ -3493,13 +3505,17 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & seaIceTemperatureFlux(iCell) + & icebergTemperatureFlux(iCell)) & - fracAbsorbedRunoff* & - activeTracersSurfaceFluxRunoff(indexTempFlux,iCell) + activeTracersSurfaceFluxRunoff(indexTempFlux,iCell) & + - fracAbsorbedSubglacialRunoff* & + activeTracersSurfaceFluxSubglacialRunoff(indexTempFlux,iCell) nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) = & activeTracersSurfaceFlux(indexSaltFlux,iCell) & - fracAbsorbed*surfaceThicknessFlux(iCell)* & activeTracers(indexSaltFlux,kmin,iCell) & - fracAbsorbedRunoff*surfaceThicknessFluxRunoff(iCell)* & + activeTracers(indexSaltFlux,kmin,iCell) & + - fracAbsorbedSubglacialRunoff*surfaceThicknessFluxSubglacialRunoff(iCell)* & activeTracers(indexSaltFlux,kmin,iCell) surfaceBuoyancyForcing(iCell) = & @@ -4442,7 +4458,7 @@ subroutine ocn_validate_state(domain, timeLevel)!{{{ call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) end if - ! Test riverRunoffFlux + ! Test subglacialRunoffFlux fieldName = 'subglacialRunoffFlux' minValue = HUGE(minValue) maxValue = -HUGE(maxValue) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index ca0ca9fc4b8..f3730538179 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -78,7 +78,7 @@ module ocn_surface_bulk_forcing !----------------------------------------------------------------------- subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, dt, layerThickness, err)!{{{ + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, dt, layerThickness, err)!{{{ !----------------------------------------------------------------- ! @@ -98,6 +98,8 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFlux !< Input/Output: Surface flux for tracer group real (kind=RKIND), dimension(:,:), intent(inout) :: & tracersSurfaceFluxRunoff !< Input/Output: Surface flux for tracer group due to river runoff + real (kind=RKIND), dimension(:,:), intent(inout) :: & + tracersSurfaceFluxSubglacialRunoff !< Input/Output: Surface flux for tracer group due to subglacial runoff real (kind=RKIND), dimension(:,:), intent(inout) :: & tracersSurfaceFluxRemoved !< Input/Output: Accumulator for ignored Surface flux for tracer group real (kind=RKIND), dimension(:,:), intent(in) :: layerThickness @@ -122,7 +124,7 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr call mpas_timer_start("bulk_" // trim(groupName)) if ( trim(groupName) == 'activeTracers' ) then call ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) end if call mpas_timer_stop("bulk_" // trim(groupName)) @@ -426,7 +428,7 @@ end subroutine ocn_surface_bulk_forcing_init!}}} !----------------------------------------------------------------------- subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err)!{{{ + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err)!{{{ !----------------------------------------------------------------- ! @@ -443,6 +445,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFlux real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxRunoff + real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxSubglacialRunoff real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxRemoved real (kind=RKIND), dimension(:,:,:), intent(inout) :: tracerGroup real (kind=RKIND), dimension(:,:), intent(in) :: layerThickness @@ -470,7 +473,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer type(mpas_pool_type),pointer :: tracersSurfaceFluxPool real (kind=RKIND), dimension(:), pointer :: latentHeatFlux, sensibleHeatFlux, longWaveHeatFluxUp, longWaveHeatFluxDown, & - seaIceHeatFlux, icebergHeatFlux, evaporationFlux, riverRunoffFlux + seaIceHeatFlux, icebergHeatFlux, evaporationFlux, riverRunoffFlux, subglacialRunoffFlux real (kind=RKIND), dimension(:), pointer :: seaIceFreshWaterFlux, icebergFreshWaterFlux, seaIceSalinityFlux, iceRunoffFlux real (kind=RKIND), dimension(:), pointer :: shortWaveHeatFlux, penetrativeTemperatureFlux real (kind=RKIND), dimension(:), pointer :: snowFlux, rainFlux @@ -572,6 +575,11 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFluxRunoff(index_temperature_flux,iCell) = riverRunoffFlux(iCell) & * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw + ! Subglacial runoff can have temperature below 0.0C, since it can come out at great depth + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + ocn_freezing_temperature(salinity=0.0_RKIND, pressure=interfacePressure(iCell), & + inLandIceCavity=.true.) / rho_sw + ! Accumulate fluxes that use the freezing point ! mrp performance note: should call ocn_freezing_temperature just once here seaIceTemperatureFlux(iCell) = seaIceFreshWaterFlux(iCell) * & @@ -587,9 +595,10 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFlux(index_temperature_flux, iCell) = tracersSurfaceFlux(index_temperature_flux, iCell) & + surfaceTemperatureFluxWithoutRunoff - ! add runoff contribution for sending through coupler + ! add river and subglacial runoff contribution for sending through coupler totalFreshWaterTemperatureFlux(iCell) = surfaceTemperatureFluxWithoutRunoff & - + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) + + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) & + + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) ! Fields with zero temperature are not accumulated. These include: ! snowFlux diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index 10188a3be11..2d3dd66cbdb 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -134,7 +134,8 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ real (kind=RKIND), dimension(:,:), pointer, contiguous :: & tendThick, &! accumulated layer thickness tendency fractionAbsorbed, &! fraction of sfc flux absorbed - fractionAbsorbedRunoff ! fraction of runoff flux absorbed + fractionAbsorbedRunoff, &! fraction of sfc flux absorbed + fractionAbsorbedSubglacialRunoff ! fraction of subglacial runoff flux absorbed !----------------------------------------------------------------- ! local variables @@ -161,6 +162,10 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ fractionAbsorbed) call mpas_pool_get_array(forcingPool, 'fractionAbsorbedRunoff', & fractionAbsorbedRunoff) + call mpas_pool_get_array(forcingPool, 'fractionAbsorbedSubglacialRunoff', & + fractionAbsorbedSubglacialRunoff) + + ! ! layer thickness tendency: @@ -610,9 +615,11 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & real (kind=RKIND), dimension(:,:), pointer, contiguous :: & layerThickness, &! layer thickness tracerGroupSurfaceFlux, &! tracer flux at surface - fractionAbsorbed, &! frac sfc flux aborbed - fractionAbsorbedRunoff, &! frac runoff flux aborbed + fractionAbsorbed, &! frac sfc flux absorbed + fractionAbsorbedRunoff, &! frac runoff flux absorbed + fractionAbsorbedSubglacialRunoff, &! frac subglacial runoff flux absorbed tracerGroupSurfaceFluxRunoff, &! runoff flux + tracerGroupSurfaceFluxSubglacialRunoff, &! subglacial runoff flux tracerGroupSurfaceFluxRemoved,&! total sfc flux absorbed nonLocalSurfaceTracerFlux ! non-local fluxes (eg KPP) @@ -674,6 +681,8 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & fractionAbsorbed) call mpas_pool_get_array(forcingPool, 'fractionAbsorbedRunoff', & fractionAbsorbedRunoff) + call mpas_pool_get_array(forcingPool, 'fractionAbsorbedSubglacialRunoff', & + fractionAbsorbedSubglacialRunoff) ! allocate and transfer data not specific to tracer groups allocate(normalThicknessFlux(nVertLevels, nEdgesAll+1)) @@ -798,6 +807,14 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & modifiedGroupName, & tracerGroupSurfaceFluxRunoff) + ! Get surface flux due to subglacial runoff array + ! only active tracers have subglacial runoff flux for now, + ! but we still need to associate for ALL tracers + modifiedGroupName = groupName // "SurfaceFluxSubglacialRunoff" + call mpas_pool_get_array(tracersSurfaceFluxPool, & + modifiedGroupName, & + tracerGroupSurfaceFluxSubglacialRunoff) + ! Get surface flux removed array to keep track of how much ! flux is ignored modifiedGroupName = groupName // "SurfaceFluxRemoved" @@ -824,6 +841,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & do n=1,nTracersGroup tracerGroupSurfaceFlux (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRunoff (n,iCell) = 0.0_RKIND + tracerGroupSurfaceFluxSubglacialRunoff (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRemoved(n,iCell) = 0.0_RKIND end do end do @@ -839,6 +857,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & forcingPool, tracerGroup, & tracerGroupSurfaceFlux, & tracerGroupSurfaceFluxRunoff, & + tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupSurfaceFluxRemoved, & dt, layerThickness, err) @@ -1198,9 +1217,9 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & endif ! compute budgets call ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, & - fractionAbsorbedRunoff, layerThickness, & - tracerGroupSurfaceFlux, & - tracerGroupSurfaceFluxRunoff, & + fractionAbsorbedRunoff, fractionAbsorbedSubglacialRunoff, & + layerThickness, tracerGroupSurfaceFlux, & + tracerGroupSurfaceFluxRunoff, tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupTend, err) ! diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index 043ed7b2862..180b4f79a75 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -85,7 +85,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe real (kind=RKIND), dimension(:,:), intent(in) :: & transmissionCoefficients, &!< Input: Coefficients for the transmission of surface fluxes transmissionCoefficientsRunoff, &!< Input: Coefficients for the transmission of surface fluxes due to river runoff - transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to river runoff + transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to subglacial runoff real (kind=RKIND), dimension(:), intent(in) :: & surfaceThicknessFlux, &!< Input: surface flux of thickness diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index 57e2949bac9..4303d1b78ff 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -71,8 +71,8 @@ module ocn_tracer_surface_flux_to_tend ! !----------------------------------------------------------------------- - subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbsorbedRunoff, layerThickness, & - surfaceTracerFlux, surfaceTracerFluxRunoff, tend, err)!{{{ + subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbsorbedRunoff, fractionAbsorbedSubglacialRunoff, & + layerThickness, surfaceTracerFlux, surfaceTracerFluxRunoff, surfaceTracerFluxSubglacialRunoff, tend, err)!{{{ !----------------------------------------------------------------- ! ! input variables @@ -97,6 +97,13 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso real (kind=RKIND), dimension(:,:), intent(in) :: & fractionAbsorbedRunoff !< Input: Coefficients for the application of surface fluxes due to river runoff + real (kind=RKIND), dimension(:,:), intent(in), pointer :: & + surfaceTracerFluxSubglacialRunoff !< Input: surface tracer fluxes from subglacial runoff + + real (kind=RKIND), dimension(:,:), intent(in) :: & + fractionAbsorbedSubglacialRunoff !< Input: Coefficients for the application of surface fluxes due to subglacial runoff + + !----------------------------------------------------------------- ! ! input/output variables @@ -197,7 +204,36 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso call mpas_timer_stop("surface_tracer_runoff_flux") end if + ! now do subglacial runoff component + + if (associated(surfaceTracerFluxSubglacialRunoff)) then + call mpas_timer_start("surface_tracer_subglacial_runoff_flux") + + !$omp parallel + !$omp do schedule(runtime) private(remainingFlux, k, iTracer) + do iCell = 1, nCells + remainingFlux = 1.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + remainingFlux = remainingFlux - fractionAbsorbedSubglacialRunoff(k, iCell) + do iTracer = 1, nTracers + tend(iTracer, k, iCell) = tend(iTracer, k, iCell) + & + surfaceTracerFluxSubglacialRunoff(iTracer, iCell) * fractionAbsorbedSubglacialRunoff(k, iCell) + end do + end do + + if(maxLevelCell(iCell) > 0 .and. remainingFlux > 0.0_RKIND) then + do iTracer = 1, nTracers + tend(iTracer, maxLevelCell(iCell), iCell) = tend(iTracer, maxLevelCell(iCell), iCell) & + + surfaceTracerFluxSubglacialRunoff(iTracer, iCell) * remainingFlux + end do + end if + end do + !$omp end do + !$omp end parallel + + call mpas_timer_stop("surface_tracer_subglacial_runoff_flux") + end if !-------------------------------------------------------------------- end subroutine ocn_tracer_surface_flux_tend!}}} From 5cb8a57d5b11a2220b317d28ba2bad76b332457f Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 19 Oct 2023 11:40:43 -0600 Subject: [PATCH 012/197] subglacial runoff for tracers, part 2 - registry --- .../src/tracer_groups/Registry_CFC.xml | 9 ++ .../src/tracer_groups/Registry_DMS.xml | 9 ++ .../tracer_groups/Registry_MacroMolecules.xml | 12 ++ .../tracer_groups/Registry_activeTracers.xml | 8 ++ .../tracer_groups/Registry_debugTracers.xml | 11 ++ .../src/tracer_groups/Registry_ecosys.xml | 128 +++++++++++++++++- .../src/tracer_groups/Registry_idealAge.xml | 5 + 7 files changed, 181 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/tracer_groups/Registry_CFC.xml b/components/mpas-ocean/src/tracer_groups/Registry_CFC.xml index d77859dcef8..b0adb7d595f 100644 --- a/components/mpas-ocean/src/tracer_groups/Registry_CFC.xml +++ b/components/mpas-ocean/src/tracer_groups/Registry_CFC.xml @@ -95,6 +95,15 @@ description="CFC12 Surface Flux Due to Runoff" /> + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/mpas-ocean/src/tracer_groups/Registry_idealAge.xml b/components/mpas-ocean/src/tracer_groups/Registry_idealAge.xml index c6adca3ea63..3a45bc10b79 100644 --- a/components/mpas-ocean/src/tracer_groups/Registry_idealAge.xml +++ b/components/mpas-ocean/src/tracer_groups/Registry_idealAge.xml @@ -69,6 +69,11 @@ description="Flux of iAge through the ocean surface due to river runoff. Positive into ocean." /> + + + Date: Thu, 19 Oct 2023 15:43:37 -0600 Subject: [PATCH 013/197] subglacial runoff freezing temperature at landicepressure --- components/mpas-ocean/src/Registry.xml | 8 ++++++++ .../mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 0ed2b0c4246..3a11826169d 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3787,6 +3787,14 @@ description="Global sum of fresh water flux from river runoff from the coupler that was removed due to config_remove_AIS_coupler_runoff option. Positive into the ocean." packages="thicknessBulkPKG" /> + + Date: Tue, 9 Jul 2024 12:27:07 -0600 Subject: [PATCH 014/197] resolved: compsets tmix --- components/mpas-ocean/bld/build-namelist | 7 +++++ .../mpas-ocean/bld/build-namelist-section | 1 + .../namelist_defaults_mpaso.xml | 1 + .../namelist_definition_mpaso.xml | 8 ++++++ components/mpas-ocean/cime_config/buildnml | 27 +++++++++++++++++++ .../cime_config/config_component.xml | 13 +++++++++ .../cime_config/config_compsets.xml | 10 +++++++ components/mpas-ocean/src/Registry.xml | 2 +- 8 files changed, 68 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 1c55bcb7be1..ad8e268fbb0 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -54,6 +54,9 @@ OPTIONS -ocn_ismf variable for defining how the ocn model will handle ice shelf melt fluxes Options are: none, data, internal, coupled + -ocn_sgr variable for defining how the ocn model will handle subglacial + runoff + Options are: none, data, coupled -decomp_prefix decomp_prefix variable -date_stamp date_stamp variable -cfg_grid Directory containing MPASO configuration scripts. @@ -111,6 +114,7 @@ my %opts = ( help => 0, ocn_forcing => undef, ocn_iceberg => undef, ocn_ismf => undef, + ocn_sgr => undef, decomp_prefix => undef, date_stamp => undef, ocn_bgc => undef, @@ -137,6 +141,7 @@ GetOptions( "ocn_forcing=s" => \$opts{'ocn_forcing'}, "ocn_iceberg=s" => \$opts{'ocn_iceberg'}, "ocn_ismf=s" => \$opts{'ocn_ismf'}, + "ocn_sgr=s" => \$opts{'ocn_sgr'}, "decomp_prefix=s" => \$opts{'decomp_prefix'}, "date_stamp=s" => \$opts{'date_stamp'}, "ocn_bgc=s" => \$opts{'ocn_bgc'}, @@ -180,6 +185,7 @@ my $OCN_GRID = $opts{'ocn_grid'}; my $OCN_FORCING = $opts{'ocn_forcing'}; my $OCN_ICEBERG = $opts{'ocn_iceberg'}; my $OCN_ISMF = $opts{'ocn_ismf'}; +my $OCN_SGR = $opts{'ocn_sgr'}; my $decomp_prefix = $opts{'decomp_prefix'}; my $date_stamp = $opts{'date_stamp'}; my $ocn_bgc = $opts{'ocn_bgc'}; @@ -702,6 +708,7 @@ add_default($nl, 'config_use_bulk_wind_stress'); add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); +add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index cc1695243fa..7a1d06b35a7 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -224,6 +224,7 @@ add_default($nl, 'config_use_bulk_wind_stress'); add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); +add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index c7441c6b221..5686c0e0a01 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -342,6 +342,7 @@ .true. 0.001 10.0 +10.0 .false. diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index f6c2f9c5b76..ac2bfd411e4 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1188,6 +1188,14 @@ Valid values: Any positive real number. Default: Defined in namelist_defaults.xml + +The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$. + +Valid values: Any positive real number. +Default: Defined in namelist_defaults.xml + + diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 4c7ed2c0a31..7ee71aee3a3 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -35,6 +35,7 @@ def buildnml(case, caseroot, compname): ocn_forcing = case.get_value("MPASO_FORCING") ocn_iceberg = case.get_value("MPASO_ICEBERG") ocn_ismf = case.get_value("MPASO_ISMF") + ocn_sgr = case.get_value("MPASO_SGR") ocn_bgc = case.get_value("MPASO_BGC") ocn_wave = case.get_value("MPASO_WAVE") ocn_tidal_mixing = case.get_value("MPASO_TIDAL_MIXING") @@ -76,6 +77,7 @@ def buildnml(case, caseroot, compname): analysis_mask_file = '' eco_forcing_file = '' u_tidal_rms_file = '' + data_sgr_file = '' if ocn_grid == 'oEC60to30v3': decomp_date = '230424' @@ -140,6 +142,8 @@ def buildnml(case, caseroot, compname): data_ismf_file = 'prescribed_ismf_paolo2023.oQU240wLI.20240404.nc' if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.oQU240wLI.20240221.nc' + if ocn_sgr == 'data': + data_sgr_file = 'oQU240wLI_DSGR.nc' elif ocn_grid == 'oQU120': decomp_date = '230424' @@ -352,6 +356,8 @@ def buildnml(case, caseroot, compname): data_ismf_file = 'prescribed_ismf_adusumilli2020.ECwISC30to60E2r1.230429.nc' if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.ECwISC30to60E2r1.20240221.nc' + if ocn_sgr == 'data': + data_sgr_file = 'ECwISC30to60E2r1_DSGR.nc' elif ocn_grid == 'IcoswISC30E3r5': decomp_date = '20231120' @@ -436,6 +442,9 @@ def buildnml(case, caseroot, compname): if u_tidal_rms_file != '': input_list.write("u_tidal_rms = {}/ocn/mpas-o/{}/{}\n".format(din_loc_root, ocn_mask, u_tidal_rms_file)) + if data_sgr_file != '': + input_list.write("subglacial_runoff = {}/ocn/mpas-o/{}/{}\n".format(din_loc_root, ocn_mask, data_sgr_file)) + #-------------------------------------------------------------------- # Invoke mpas build-namelist - output will go in $CASEBUILD/mpasoconf #-------------------------------------------------------------------- @@ -495,6 +504,7 @@ def buildnml(case, caseroot, compname): sysmod += " -ocn_forcing '{}'".format(ocn_forcing) sysmod += " -ocn_iceberg '{}'".format(ocn_iceberg) sysmod += " -ocn_ismf '{}'".format(ocn_ismf) + sysmod += " -ocn_sgr '{}'".format(ocn_sgr) sysmod += " -ocn_bgc '{}'".format(ocn_bgc) sysmod += " -ocn_wave '{}'".format(ocn_wave) sysmod += " -ocn_tidal_mixing '{}'".format(ocn_tidal_mixing) @@ -702,6 +712,19 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') + if data_sgr_file != '': + lines.append('') + lines.append('') + lines.append(' ') + lines.append('') + lines.append('') + if analysis_mask_file != '': lines.append('') lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') @@ -1533,6 +1557,7 @@ def buildnml(case, caseroot, compname): lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') @@ -1598,6 +1623,7 @@ def buildnml(case, caseroot, compname): lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') @@ -1812,6 +1838,7 @@ def buildnml(case, caseroot, compname): lines.append(' ') lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') diff --git a/components/mpas-ocean/cime_config/config_component.xml b/components/mpas-ocean/cime_config/config_component.xml index e95b63682d9..eb8e0951982 100644 --- a/components/mpas-ocean/cime_config/config_component.xml +++ b/components/mpas-ocean/cime_config/config_component.xml @@ -39,6 +39,19 @@ Option to describe the MPASO prescribed tidal mixing + + char + none,data,coupled + none + + none + data + + case_comp + env_case.xml + Option to describe how MPASO will handle subglacial runoff fluxes + + char false,true diff --git a/components/mpas-ocean/cime_config/config_compsets.xml b/components/mpas-ocean/cime_config/config_compsets.xml index 448aa7a82b5..27b0218f4a2 100644 --- a/components/mpas-ocean/cime_config/config_compsets.xml +++ b/components/mpas-ocean/cime_config/config_compsets.xml @@ -87,6 +87,11 @@ 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCED_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DIB-PISMF-DSGR + 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DIB-DISMF 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBDISMFDATMFORCED_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV @@ -97,6 +102,11 @@ 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDTMIX_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DIB-DISMF-DSGR + 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBDISMFDATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p4 2000_DATM%JRA-1p4-2018_SLND_MPASSI_MPASO%DATMFORCED_DROF%JRA-1p4-2018_SGLC_SWAV diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 3a11826169d..5e36e828f32 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -702,7 +702,7 @@ description="The length scale of exponential decay of river runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - From 0fccd7005f50caf729c14c2df81b79224e5c3b11 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Fri, 20 Oct 2023 14:36:43 -0600 Subject: [PATCH 015/197] typo --- components/mpas-ocean/src/Registry.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 5e36e828f32..f56799eaaf0 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -703,7 +703,7 @@ possible_values="Any positive real number." /> From f820afb71ee2e22ae6326f0e7c5bda7bf67c3eef Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Fri, 20 Oct 2023 15:13:14 -0600 Subject: [PATCH 016/197] more compsets --- components/mpas-ocean/cime_config/config_compsets.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/mpas-ocean/cime_config/config_compsets.xml b/components/mpas-ocean/cime_config/config_compsets.xml index 27b0218f4a2..766b1397bcf 100644 --- a/components/mpas-ocean/cime_config/config_compsets.xml +++ b/components/mpas-ocean/cime_config/config_compsets.xml @@ -37,6 +37,11 @@ 2000_DATM%NYF_SLND_MPASSI_MPASO%PISMFDATMFORCED_DROF%NYFAIS45_SGLC_SWAV + + GMPAS-NYF-PISMF-DSGR + 2000_DATM%NYF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV + + GMPAS-NYF-DISMF 2000_DATM%NYF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%NYFAIS45_SGLC_SWAV @@ -142,6 +147,11 @@ 2000_DATM%IAF_SLND_MPASSI_MPASO%PISMFDATMFORCED_DROF%IAFAIS45_SGLC_SWAV + + GMPAS-IAF-PISMF-DSGR + 2000_DATM%IAF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%IAFAIS45_SGLC_SWAV + + GMPAS-IAF-DISMF 2000_DATM%IAF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%IAFAIS45_SGLC_SWAV From 71dc2ee55e2b9beabfd713e421f6fed87301b6b8 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 23 Oct 2023 16:53:14 -0600 Subject: [PATCH 017/197] typo: remainingFluxSubglacialRunoff --- .../mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index 180b4f79a75..1f7c67b88e0 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -118,7 +118,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe integer :: iCell, k - real (kind=RKIND) :: remainingFlux, remainingFluxRunoff + real (kind=RKIND) :: remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff err = 0 @@ -133,10 +133,10 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe !$acc present(tend, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & !$acc surfaceThicknessFluxSubglacialRunoff, transmissionCoefficientsSubglacialRunoff, & !$acc transmissionCoefficients, transmissionCoefficientsRunoff, minLevelCell, maxLevelCell) & - !$acc private(k, remainingFlux, remainingFluxRunoff) + !$acc private(k, remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff) #else !$omp parallel - !$omp do schedule(runtime) private(remainingFlux, remainingFluxRunoff, k) + !$omp do schedule(runtime) private(remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff, k) #endif do iCell = 1, nCellsOwned remainingFlux = 1.0_RKIND From 2637229a9be48f2d82474f961d0dc18132da86c3 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 26 Oct 2023 10:58:22 -0600 Subject: [PATCH 018/197] updated sg units --- components/mpas-ocean/src/Registry.xml | 2 +- .../mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index f56799eaaf0..ad8ce675244 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3775,7 +3775,7 @@ description="Fresh water flux from river runoff at cell centers from coupler. Positive into the ocean." packages="thicknessBulkPKG" /> - diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 4714400951d..c3a8a6691dd 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -351,7 +351,7 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur surfaceThicknessFlux(iCell) = surfaceThicknessFlux(iCell) + ( snowFlux(iCell) + rainFlux(iCell) + evaporationFlux(iCell) & + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw - surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / rho_sw + surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) end do #ifndef MPAS_OPENACC !$omp end do @@ -581,7 +581,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer ! Subglacial runoff can have temperature below 0.0C, since it can come out at great depth tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & - inLandIceCavity=.true.) / rho_sw + inLandIceCavity=.true.) / areaCell(iCell) ! Accumulate fluxes that use the freezing point ! mrp performance note: should call ocn_freezing_temperature just once here From 98dc48b3a0c3f04948e9225f0c7ce808573a35f2 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 31 Oct 2023 14:08:09 -0600 Subject: [PATCH 019/197] change config_flux_attenuation_coefficient_subglacial_runoff default to 1 mm --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- components/mpas-ocean/src/Registry.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 5686c0e0a01..66a6482c54a 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -342,7 +342,7 @@ .true. 0.001 10.0 -10.0 +0.001 .false. diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index ad8ce675244..76e868860a4 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -702,7 +702,7 @@ description="The length scale of exponential decay of river runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - From 239697803ded5efafc22d345fe5fe6adc0d05582 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 31 Oct 2023 14:53:00 -0600 Subject: [PATCH 020/197] add namelist option to include some parts of runoff only: config_use_SGR_opt --- .../mpas-ocean/bld/build-namelist-section | 1 + .../namelist_defaults_mpaso.xml | 1 + .../namelist_definition_mpaso.xml | 8 ++++++++ components/mpas-ocean/src/Registry.xml | 4 ++++ .../shared/mpas_ocn_surface_bulk_forcing.F | 20 +++++++++++++++---- 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 7a1d06b35a7..b8f544edaba 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -225,6 +225,7 @@ add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); +add_default($nl, 'config_use_SGR_opt'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 66a6482c54a..92709a4ee45 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -343,6 +343,7 @@ 0.001 10.0 0.001 +0 .false. diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index ac2bfd411e4..fc6374cc2a7 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1196,6 +1196,14 @@ Valid values: Any positive real number. Default: Defined in namelist_defaults.xml + +Option to use or not subglacial runoff (SGR). + +Valid values: 0 - don't use SGR, 1 - use both mass and TS from SGR, 2 - use mass only from SGR , 3 - use TS only from SGR +Default: Defined in namelist_defaults.xml + + diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 76e868860a4..083db34082e 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -706,6 +706,10 @@ description="The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> + Date: Tue, 31 Oct 2023 14:56:51 -0600 Subject: [PATCH 021/197] more basic compsets --- components/mpas-ocean/cime_config/config_compsets.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/mpas-ocean/cime_config/config_compsets.xml b/components/mpas-ocean/cime_config/config_compsets.xml index 766b1397bcf..6950fd8c217 100644 --- a/components/mpas-ocean/cime_config/config_compsets.xml +++ b/components/mpas-ocean/cime_config/config_compsets.xml @@ -42,6 +42,11 @@ 2000_DATM%NYF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV + + GMPAS-NYF-DSGR + 2000_DATM%NYF_SLND_MPASSI_MPASO%DATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV + + GMPAS-NYF-DISMF 2000_DATM%NYF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%NYFAIS45_SGLC_SWAV @@ -97,6 +102,11 @@ 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DSGR + 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%DATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DIB-DISMF 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBDISMFDATMFORCED_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV From 9b786dd97402994a88eca8c1eaa9a6c5663d06aa Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 31 Oct 2023 15:35:05 -0600 Subject: [PATCH 022/197] forgotten bld --- components/mpas-ocean/bld/build-namelist | 1 + 1 file changed, 1 insertion(+) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index ad8e268fbb0..f70d6204be5 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -709,6 +709,7 @@ add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); +add_default($nl, 'config_use_SGR_opt'); ############################ # Namelist group: coupling # From de04001fe002b961ad230936314e17fc7fbe693d Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 1 Nov 2023 14:31:42 -0600 Subject: [PATCH 023/197] no sg in kpp option --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 4e75d743130..999d69337ab 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3487,10 +3487,14 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) - fracAbsorbedSubglacialRunoff = 1.0_RKIND & + if (config_use_SGR_opt == -1) then + fracAbsorbedSubglacialRunoff = 1.0_RKIND & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_subglacial_runoff)) + else + fracAbsorbedSubglacialRunoff = 0.0_RKIND + end if ! Store the total tracer flux below in ! nonLocalSurfaceTemperatureFlux for use in the CVMix nonlocal From 0ab238461d06ad3d605033731346d955c6bf2799 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 1 Nov 2023 17:50:46 -0600 Subject: [PATCH 024/197] config_use_SGR_opt -1 correction --- .../bld/namelist_files/namelist_definition_mpaso.xml | 2 +- components/mpas-ocean/src/Registry.xml | 2 +- .../mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index fc6374cc2a7..c38d6edd97a 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1200,7 +1200,7 @@ Default: Defined in namelist_defaults.xml category="forcing" group="forcing"> Option to use or not subglacial runoff (SGR). -Valid values: 0 - don't use SGR, 1 - use both mass and TS from SGR, 2 - use mass only from SGR , 3 - use TS only from SGR +Valid values: 0 - don't use SGR, 1 - use both mass and TS from SGR, 2 - use mass only from SGR , 3 - use TS only from SGR, -1 use all + KPP Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 083db34082e..953fa1cb39b 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -708,7 +708,7 @@ /> diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index a12e628b2cc..de9898c6099 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -352,7 +352,7 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw - if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 2)) then + if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 2) .or. (config_use_SGR_opt == -1)) then surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) else surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND @@ -587,7 +587,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw ! Subglacial runoff can have temperature below 0.0C, since it can come out at great depth - if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 3)) then + if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 3) .or. (config_use_SGR_opt == -1)) then tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & inLandIceCavity=.true.) / areaCell(iCell) From 81d948887f769ad72ac92a37ad6d78474b467f2c Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 8 Nov 2023 10:38:13 -0700 Subject: [PATCH 025/197] config read in forcing --- components/mpas-ocean/src/shared/mpas_ocn_forcing.F | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index f530f67dfa6..8617cc4f843 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -27,6 +27,7 @@ module ocn_forcing use mpas_dmpar use ocn_constants use ocn_diagnostics_variables + use ocn_config !IV comment implicit none private @@ -197,6 +198,8 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin end do end do + call mpas_log_write('config_use_SGR_opt: $r', realArgs=(/config_use_SGR_opt/)) + end subroutine ocn_forcing_build_fraction_absorbed_array!}}} !*********************************************************************** From 4745779efa824c568f84e4054e5bbf75f9e45031 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 8 Nov 2023 12:28:44 -0700 Subject: [PATCH 026/197] sgr_flux_vertical_location and SGR to sgr --- components/mpas-ocean/bld/build-namelist | 3 +- .../mpas-ocean/bld/build-namelist-section | 3 +- .../namelist_defaults_mpaso.xml | 3 +- .../namelist_definition_mpaso.xml | 10 +++- components/mpas-ocean/src/Registry.xml | 10 ++-- .../src/shared/mpas_ocn_diagnostics.F | 2 +- .../mpas-ocean/src/shared/mpas_ocn_forcing.F | 53 +++++++++++++------ .../shared/mpas_ocn_surface_bulk_forcing.F | 4 +- 8 files changed, 63 insertions(+), 25 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index f70d6204be5..b413599f177 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -709,7 +709,8 @@ add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); -add_default($nl, 'config_use_SGR_opt'); +add_default($nl, 'config_sgr_flux_vertical_location'); +add_default($nl, 'config_use_sgr_opt'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index b8f544edaba..9c0ad217b91 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -225,7 +225,8 @@ add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); -add_default($nl, 'config_use_SGR_opt'); +add_default($nl, 'config_sgr_flux_vertical_location'); +add_default($nl, 'config_use_sgr_opt'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 92709a4ee45..5b3bf93522a 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -343,7 +343,8 @@ 0.001 10.0 0.001 -0 +'top' +0 .false. diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index c38d6edd97a..7629e5663ef 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1196,7 +1196,15 @@ Valid values: Any positive real number. Default: Defined in namelist_defaults.xml - +Selects the vertical location where subglacial runoff is fluxed + +Valid values: 'top','uniform', 'bottom'. +Default: Defined in namelist_defaults.xml + + + Option to use or not subglacial runoff (SGR). diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 953fa1cb39b..88928169b1c 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -706,9 +706,13 @@ description="The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - + diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 999d69337ab..a7d03f5dcc8 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3487,7 +3487,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) - if (config_use_SGR_opt == -1) then + if (config_use_sgr_opt == -1) then fracAbsorbedSubglacialRunoff = 1.0_RKIND & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index 8617cc4f843..e642e82e2e6 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -184,21 +184,44 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin ! now do subglacial runoff separately - do iCell = 1, nCells - zTop = 0.0_RKIND - transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - do k = minLevelCell(iCell), maxLevelCell(iCell) - zBot = zTop - layerThickness(k,iCell) - transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - - fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot - - zTop = zBot - transmissionCoeffTop = transmissionCoeffBot - end do - end do - - call mpas_log_write('config_use_SGR_opt: $r', realArgs=(/config_use_SGR_opt/)) + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + do iCell = 1, nCells + zTop = 0.0_RKIND + transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + do k = minLevelCell(iCell), maxLevelCell(iCell) + zBot = zTop - layerThickness(k,iCell) + transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot + zTop = zBot + transmissionCoeffTop = transmissionCoeffBot + end do + end do + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + do iCell = 1, nCells + ! calculate total thickness + zTop = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + zTop = zTop + layerThickness(k,iCell) + end do + ! distribute flux evenly throughout water column + zBot = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + fractionAbsorbedSubglacialRunoff(k, iCell) = layerThickness(k,iCell) / zTop + end do + end do + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + do iCell = 1, nCells + zTop = 0.0_RKIND + transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + do k = maxLevelCell(iCell), minLevelCell(iCell), -1 + zBot = zTop - layerThickness(k,iCell) + transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot + zTop = zBot + transmissionCoeffTop = transmissionCoeffBot + end do + end do + end if end subroutine ocn_forcing_build_fraction_absorbed_array!}}} diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index de9898c6099..f6156609df0 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -352,7 +352,7 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw - if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 2) .or. (config_use_SGR_opt == -1)) then + if ((config_use_sgr_opt == 1) .or. (config_use_sgr_opt == 2) .or. (config_use_sgr_opt == -1)) then surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) else surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND @@ -587,7 +587,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw ! Subglacial runoff can have temperature below 0.0C, since it can come out at great depth - if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 3) .or. (config_use_SGR_opt == -1)) then + if ((config_use_sgr_opt == 1) .or. (config_use_sgr_opt == 3) .or. (config_use_sgr_opt == -1)) then tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & inLandIceCavity=.true.) / areaCell(iCell) From e55b516afd33df71a1789b7a32b6f918a5e82b94 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 16 Nov 2023 18:39:57 -0700 Subject: [PATCH 027/197] more sgr testing options for TS separation --- components/mpas-ocean/bld/build-namelist | 6 ++- .../mpas-ocean/bld/build-namelist-section | 6 ++- .../namelist_defaults_mpaso.xml | 7 +++- .../namelist_definition_mpaso.xml | 37 +++++++++++++++++-- components/mpas-ocean/src/Registry.xml | 23 ++++++++++-- .../src/shared/mpas_ocn_diagnostics.F | 2 +- .../shared/mpas_ocn_surface_bulk_forcing.F | 29 ++++++++------- 7 files changed, 87 insertions(+), 23 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index b413599f177..e1d2548dffe 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -710,7 +710,11 @@ add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); -add_default($nl, 'config_use_sgr_opt'); +add_default($nl, 'config_use_sgr_opt_kpp'); +add_default($nl, 'config_use_sgr_opt_temp'); +add_default($nl, 'config_use_sgr_opt_salt'); +add_default($nl, 'config_sgr_temperature'); +add_default($nl, 'config_sgr_salinity'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 9c0ad217b91..0d44d3f328b 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -226,7 +226,11 @@ add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); -add_default($nl, 'config_use_sgr_opt'); +add_default($nl, 'config_use_sgr_opt_kpp'); +add_default($nl, 'config_use_sgr_opt_temp'); +add_default($nl, 'config_use_sgr_opt_salt'); +add_default($nl, 'config_sgr_temperature'); +add_default($nl, 'config_sgr_salinity'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 5b3bf93522a..a2c6465c6d1 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -344,7 +344,12 @@ 10.0 0.001 'top' -0 +0 +'sgr' +'sgr' +0.0 +0.0 + .false. diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 7629e5663ef..8152b1fec72 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1204,14 +1204,45 @@ Valid values: 'top','uniform', 'bottom'. Default: Defined in namelist_defaults.xml - -Option to use or not subglacial runoff (SGR). +Option to use or not subglacial runoff (sgr) in kpp calculation. -Valid values: 0 - don't use SGR, 1 - use both mass and TS from SGR, 2 - use mass only from SGR , 3 - use TS only from SGR, -1 use all + KPP +Valid values: 0 - don't use, 1 - use Default: Defined in namelist_defaults.xml + +Option to choose sgr temperature + +Valid values: 'sgr','current', 'prescribed'. +Default: Defined in namelist_defaults.xml + + + +Option to choose sgr salinity + +Valid values: 'sgr','current', 'prescribed'. +Default: Defined in namelist_defaults.xml + + + +Option to choose sgr temperature, applied when config_use_sgr_opt_temp = 'prescribed' + +Valid values: Any real number. +Default: Defined in namelist_defaults.xml + + + +Option to choose sgr salinity, applied when config_use_sgr_opt_temp = 'prescribed' + +Valid values: Any real number. +Default: Defined in namelist_defaults.xml + diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 88928169b1c..b22a9e7f5b9 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -710,10 +710,27 @@ description="Selects the vertical location where subglacial runoff is fluxed." possible_values="'top','uniform', 'bottom'" /> - + + + + + Date: Tue, 9 Jul 2024 12:31:41 -0600 Subject: [PATCH 028/197] resolved: conservation check --- components/mpas-ocean/cime_config/buildnml | 3 ++ .../Registry_conservation_check.xml | 17 +++++++++++ .../mpas_ocn_conservation_check.F | 28 ++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 7ee71aee3a3..9566cc56bbb 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1192,14 +1192,17 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') diff --git a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml index 0fd2d28d1c6..646daf743ee 100644 --- a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml +++ b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml @@ -106,6 +106,9 @@ + @@ -148,6 +151,10 @@ + + @@ -287,14 +298,17 @@ + + + @@ -343,14 +357,17 @@ + + + diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index bdd07e799b5..612bb2078bf 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -828,8 +828,10 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & + accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & + accumulatedRemovedSubglacialRunoffFlux, & accumulatedRemovedIceRunoffFlux, & accumulatedIcebergFlux, & accumulatedFrazilFlux, & @@ -852,8 +854,10 @@ subroutine mass_conservation(domain, err) evaporationFlux, & seaIceFreshwaterFlux, & riverRunoffFlux, & + subglacialRunoffFlux, & iceRunoffFlux, & removedRiverRunoffFlux, & + removedSubglacialRunoffFlux, & removedIceRunoffFlux, & icebergFreshwaterFlux, & accumulatedFrazilIceMassNew, & @@ -877,7 +881,7 @@ subroutine mass_conservation(domain, err) iCell, ierr, k integer, parameter :: & - nSums = 12 + nSums = 14 integer, dimension(:), pointer :: minLevelCell, maxLevelCell @@ -900,8 +904,10 @@ subroutine mass_conservation(domain, err) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedSubglacialRunoffFlux",accumulatedRemovedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIcebergFlux", accumulatedIcebergFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedFrazilFlux", accumulatedFrazilFlux) @@ -937,8 +943,10 @@ subroutine mass_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'evaporationFlux', evaporationFlux) call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) + call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedRiverRunoffFlux', removedRiverRunoffFlux) + call mpas_pool_get_array(forcingPool, 'removedSubglacialRunoffFlux', removedSubglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedIceRunoffFlux', removedIceRunoffFlux) call mpas_pool_get_array(forcingPool, 'icebergFreshWaterFlux', icebergFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'landIceFreshwaterFlux', landIceFreshwaterFlux) @@ -956,6 +964,8 @@ subroutine mass_conservation(domain, err) sumArray( 7) = sumArray( 7) + areaCell(iCell) * removedRiverRunoffFlux(iCell) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) + sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) + sumArray(14) = sumArray(14) + areaCell(iCell) * removedSubglacialRunoffFlux(iCell) enddo if (config_use_frazil_ice_formation) then @@ -1002,6 +1012,8 @@ subroutine mass_conservation(domain, err) accumulatedFrazilFlux = accumulatedFrazilFlux + sumArrayOut(10) accumulatedLandIceFlux = accumulatedLandIceFlux + sumArrayOut(11) accumulatedLandIceFrazilFlux = accumulatedLandIceFrazilFlux + sumArrayOut(12) + accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux + sumArrayOut(13) + accumulatedRemovedSubglacialRunoffFlux = accumulatedRemovedSubglacialRunoffFlux + sumArrayOut(14) ! cleanup deallocate(sumArray) @@ -1021,8 +1033,10 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux = accumulatedEvaporationFlux /accumulatedFluxCounter accumulatedSeaIceFlux = accumulatedSeaIceFlux /accumulatedFluxCounter accumulatedRiverRunoffFlux = accumulatedRiverRunoffFlux /accumulatedFluxCounter + accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux /accumulatedFluxCounter accumulatedIceRunoffFlux = accumulatedIceRunoffFlux /accumulatedFluxCounter accumulatedRemovedRiverRunoffFlux = accumulatedRemovedRiverRunoffFlux /accumulatedFluxCounter + accumulatedRemovedSubglacialRunoffFlux = accumulatedRemovedSubglacialRunoffFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffFlux = accumulatedRemovedIceRunoffFlux /accumulatedFluxCounter accumulatedIcebergFlux = accumulatedIcebergFlux /accumulatedFluxCounter accumulatedFrazilFlux = accumulatedFrazilFlux /accumulatedFluxCounter @@ -1049,6 +1063,7 @@ subroutine mass_conservation(domain, err) + accumulatedEvaporationFlux & + accumulatedSeaIceFlux & + accumulatedRiverRunoffFlux & + + accumulatedSubglacialRunoffFlux & + accumulatedIceRunoffFlux & + accumulatedIcebergFlux & + accumulatedFrazilFlux & @@ -1083,10 +1098,15 @@ subroutine mass_conservation(domain, err) v=accumulatedIcebergFlux ; write(m,"('icebergFreshwaterFlux ',es16.8,' x2o_Fioi_bergw wberg ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedEvaporationFlux ; write(m,"('evaporationFlux ',es16.8,' x2o_Foxx_evap wevap ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffFlux ; write(m,"('riverRunoffFlux ',es16.8,' x2o_Foxx_rofl wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v +v=accumulatedSubglacialRunoffFlux ; write(m,"('subglacialRunoffFlux ',es16.8,' x2o_Foxx_rofl wsgr ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v + if (landIceFreshwaterFluxesOn) then v=accumulatedRemovedRiverRunoffFlux; write(m,"('removedRiverRunoffFlux ',es16.8,' wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); v=accumulatedRiverRunoffFlux+accumulatedRemovedRiverRunoffFlux; write(m,"(' SUM: river runoff',es16.8,' x2o_Foxx_rofl wrunoff SUM ',f16.8)") v,v*c; call mpas_log_write(m) +v=accumulatedRemovedSubglacialRunoffFlux; write(m,"('removedSubglacialRunoffFlux ',es16.8,' wsgr ',f16.8)") v,v*c; call mpas_log_write(m); +v=accumulatedSubglacialRunoffFlux+accumulatedRemovedSubglacialRunoffFlux; + write(m,"(' SUM: subglacial runoff',es16.8,' x2o_Foxx_rofl wsgr SUM ',f16.8)") v,v*c; call mpas_log_write(m) endif v=accumulatedIceRunoffFlux ; write(m,"('iceRunoffFlux ',es16.8,' x2o_Foxx_rofi wfrzrof ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v if (landIceFreshwaterFluxesOn) then @@ -2240,8 +2260,10 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & + accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & + accumulatedRemovedSubglacialRunoffFlux, & accumulatedRemovedIceRunoffFlux, & accumulatedIcebergFlux, & accumulatedFrazilFlux, & @@ -2310,8 +2332,10 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedSubglacialRunoffFlux",accumulatedRemovedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIcebergFlux", accumulatedIcebergFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedFrazilFlux", accumulatedFrazilFlux) @@ -2323,8 +2347,10 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux = 0.0_RKIND accumulatedSeaIceFlux = 0.0_RKIND accumulatedRiverRunoffFlux = 0.0_RKIND + accumulatedSubglacialRunoffFlux = 0.0_RKIND accumulatedIceRunoffFlux = 0.0_RKIND accumulatedRemovedRiverRunoffFlux = 0.0_RKIND + accumulatedRemovedSubglacialRunoffFlux = 0.0_RKIND accumulatedRemovedIceRunoffFlux = 0.0_RKIND accumulatedIcebergFlux = 0.0_RKIND accumulatedFrazilFlux = 0.0_RKIND From af89287b4221cc4a514ccad511b92b850561f323 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 22 Nov 2023 14:20:29 -0700 Subject: [PATCH 029/197] removed redundant removedSubglacialRunoffFlux --- components/mpas-ocean/cime_config/buildnml | 1 - components/mpas-ocean/src/Registry.xml | 8 -------- .../mpas_ocn_conservation_check.F | 15 +-------------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 9566cc56bbb..fca676ae03d 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1202,7 +1202,6 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') - lines.append('') lines.append('') lines.append('') lines.append('') diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index b22a9e7f5b9..7e3b1d125da 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3812,14 +3812,6 @@ description="Global sum of fresh water flux from river runoff from the coupler that was removed due to config_remove_AIS_coupler_runoff option. Positive into the ocean." packages="thicknessBulkPKG" /> - - Date: Mon, 27 Nov 2023 16:57:56 -0700 Subject: [PATCH 030/197] correct sgr units in flux add up --- .../src/analysis_members/mpas_ocn_conservation_check.F | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index cc1f2f3e288..18ba8d6989d 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -28,6 +28,7 @@ module ocn_conservation_check use ocn_constants use ocn_config + use ocn_mesh implicit none private @@ -960,7 +961,7 @@ subroutine mass_conservation(domain, err) sumArray( 7) = sumArray( 7) + areaCell(iCell) * removedRiverRunoffFlux(iCell) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) - sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) + sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) / areaCell(iCell) * rho_sw enddo if (config_use_frazil_ice_formation) then From 957d8b218d3cf06b2c4d94325d48a8507c0bdcfd Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 27 Nov 2023 17:46:10 -0700 Subject: [PATCH 031/197] energy conservation check --- .../mpas_ocn_conservation_check.F | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 18ba8d6989d..e793babb51a 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -428,6 +428,7 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & + accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), dimension(:), allocatable :: & @@ -464,7 +465,8 @@ subroutine energy_conservation(domain, err) real(kind=RKIND), dimension(:,:), pointer :: & - activeTracersSurfaceFluxRunoff + activeTracersSurfaceFluxRunoff, & + activeTracersSurfaceFluxSubglacialRunoff type (MPAS_timeInterval_type) :: & timeStepESMF @@ -481,7 +483,7 @@ subroutine energy_conservation(domain, err) ierr integer, parameter :: & - nSums = 19 + nSums = 20 character(len=160) :: & m @@ -514,6 +516,7 @@ subroutine energy_conservation(domain, err) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) + call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) !------------------------------------------------------------- @@ -557,6 +560,7 @@ subroutine energy_conservation(domain, err) call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_temperatureSurfaceFlux', index_temperature_flux) call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxRunoff', activeTracersSurfaceFluxRunoff) + call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassNew, 2) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassOld, 1) @@ -581,6 +585,7 @@ subroutine energy_conservation(domain, err) ! river runoff temperature flux sumArray(14) = sumArray(14) + areaCell(iCell) * activeTracersSurfaceFluxRunoff(index_temperature_flux,iCell) sumArray(15) = sumArray(15) + areaCell(iCell) * icebergTemperatureFlux(iCell) + sumArray(20) = sumArray(20) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) enddo ! iCell @@ -635,6 +640,7 @@ subroutine energy_conservation(domain, err) accumulatedLandIceHeatFlux = accumulatedLandIceHeatFlux + sumArrayOut(17) accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux + sumArrayOut(18) accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux + sumArrayOut(19) + accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux + sumArrayOut(20) ! cleanup deallocate(sumArray) @@ -664,6 +670,7 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux = accumulatedEvapTemperatureFlux /accumulatedFluxCounter accumulatedSeaIceTemperatureFlux = accumulatedSeaIceTemperatureFlux /accumulatedFluxCounter accumulatedRiverRunoffTemperatureFlux = accumulatedRiverRunoffTemperatureFlux /accumulatedFluxCounter + accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux /accumulatedFluxCounter accumulatedIcebergTemperatureFlux = accumulatedIcebergTemperatureFlux /accumulatedFluxCounter accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux /accumulatedFluxCounter @@ -698,6 +705,7 @@ subroutine energy_conservation(domain, err) + accumulatedEvapTemperatureFlux *rho_sw*cp_sw & + accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw & + accumulatedRiverRunoffTemperatureFlux *rho_sw*cp_sw & + + accumulatedSubglacialRunoffTemperatureFlux *rho_sw*cp_sw & + accumulatedIcebergTemperatureFlux*rho_sw*cp_sw ! note, accumulatedLandIceFrazilHeatFlux not added because already in accumulatedFrazilHeatFlux @@ -761,6 +769,7 @@ subroutine energy_conservation(domain, err) v=accumulatedEvapTemperatureFlux *rho_sw*cp_sw; write(m,"('EvapTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw; write(m,"('SeaIceTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v +v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedIcebergTemperatureFlux*rho_sw*cp_sw; write(m,"('IcebergTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v write(m,"('SUM IMPLICIT HEAT FLUXES ',es16.8,' hh20temp ',f16.8,es16.8)") s, s/A; call mpas_log_write(m) s = s + explicitHeatFluxSum @@ -2243,6 +2252,7 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & + accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), pointer :: & @@ -2292,6 +2302,7 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) + call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) accumulatedFluxCounter = 0 @@ -2310,6 +2321,7 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux = 0.0_RKIND accumulatedSeaIceTemperatureFlux = 0.0_RKIND accumulatedRiverRunoffTemperatureFlux = 0.0_RKIND + accumulatedSubglacialRunoffTemperatureFlux = 0.0_RKIND accumulatedIcebergTemperatureFlux = 0.0_RKIND accumulatedLandIceFrazilHeatFlux = 0.0_RKIND accumulatedRemovedIceRunoffHeatFlux = 0.0_RKIND From ecb06580badc28a55316eea6caae273eb1fd415b Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 12:34:50 -0600 Subject: [PATCH 032/197] resolved: conservation check #2 --- components/mpas-ocean/cime_config/buildnml | 1 + .../Registry_conservation_check.xml | 5 +++ .../mpas_ocn_conservation_check.F | 32 ++++++++++++++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index fca676ae03d..725c26d2818 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1208,6 +1208,7 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') diff --git a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml index 646daf743ee..8a79ac12629 100644 --- a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml +++ b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml @@ -205,6 +205,9 @@ + + @@ -375,6 +379,7 @@ + diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index e793babb51a..cdba7b357f2 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -1180,10 +1180,14 @@ subroutine salt_conservation(domain, err) absoluteSaltError, & relativeSaltError + real(kind=RKIND), dimension(:,:), pointer :: & + activeTracersSurfaceFluxSubglacialRunoff + real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux ! accumulatedLandIceFrazilSalinityFlux is not present because it is always 0 + accumulatedFrazilSalinityFlux, & + accumulatedSubglacialRunoffSalinityFlux real(kind=RKIND), dimension(:), allocatable :: & sumArray, & @@ -1204,14 +1208,15 @@ subroutine salt_conservation(domain, err) dt, dtAvg, v, A, s, c integer, pointer :: & - nCellsSolve + nCellsSolve, & + index_salinity_flux integer :: & iCell, & ierr integer, parameter :: & - nSums = 3 + nSums = 4 logical, pointer :: & activeTracersBulkRestoringPKG @@ -1229,6 +1234,7 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) !------------------------------------------------------------- ! Net salt flux to ice @@ -1254,11 +1260,17 @@ subroutine salt_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityOld, 1) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityNew, 2) + call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) + call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_salinitySurfaceFlux', index_salinity_flux) + + do iCell = 1, nCellsSolve ! salt flux to ocean sumArray(1) = sumArray(1) + areaCell(iCell) * seaIceSalinityFlux(iCell) + ! subglacial runoff + sumArray(4) = sumArray(4) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) enddo ! iCell if (config_use_frazil_ice_formation) then @@ -1285,6 +1297,7 @@ subroutine salt_conservation(domain, err) ! accumulate fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux + sumArrayOut(1) accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux + sumArrayOut(2) + accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux + sumArrayOut(4) ! cleanup deallocate(sumArray) @@ -1301,6 +1314,7 @@ subroutine salt_conservation(domain, err) ! Average the fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux /accumulatedFluxCounter accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux /accumulatedFluxCounter + accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux /accumulatedFluxCounter ! get initial salt content call MPAS_pool_get_array(conservationCheckSaltAMPool, "initialSalt", initialSalt) @@ -1317,7 +1331,8 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "netSaltFlux", netSaltFlux) netSaltFlux = accumulatedSeaIceSalinityFlux & - + accumulatedFrazilSalinityFlux + + accumulatedFrazilSalinityFlux & + + accumulatedSubglacialRunoffSalinityFlux ! compute the final salt error call MPAS_pool_get_array(conservationCheckSaltAMPool, "absoluteSaltError", absoluteSaltError) @@ -1347,6 +1362,8 @@ subroutine salt_conservation(domain, err) .and.config_frazil_under_land_ice) then v=0; write(m,"('LandIceFrazilSalinityFlux',es16.8,' (already in wmelt, do not sum) ',f16.8)") v,v*c; call mpas_log_write(m); !no sum: s=s+v end if +v=accumulatedSubglacialRunoffSalinityFlux ; write(m,"('SubglacialRunoffSalinityFlux ',es16.8,' x2o_Fioi_salt salt ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v + write(m,"('SUM VOLUME FLUXES ',es16.8,' ',f16.8,es16.8)") s, s*c; call mpas_log_write(m) call mpas_log_write(' ') @@ -2272,7 +2289,8 @@ subroutine reset_accumulated_variables(domain) real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux + accumulatedFrazilSalinityFlux, & + accumulatedSubglacialRunoffSalinityFlux real(kind=RKIND), pointer :: & accumulatedCarbonSourceSink, & @@ -2362,9 +2380,13 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedLandIceFrazilSalinityFlux", accumulatedLandIceFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) + accumulatedSeaIceSalinityFlux = 0.0_RKIND accumulatedFrazilSalinityFlux = 0.0_RKIND + accumulatedSubglacialRunoffSalinityFlux = 0.0_RKIND call MPAS_pool_get_subpool(domain % blocklist % structs, "conservationCheckCarbonAM", conservationCheckCarbonAMPool) From a430272a1d1c41468387cc47e1a3038f2aa7187e Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 28 Nov 2023 09:54:29 -0700 Subject: [PATCH 033/197] salt: added tracersSurfaceFluxPool definition --- .../src/analysis_members/mpas_ocn_conservation_check.F | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index cdba7b357f2..1278342ceb2 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -1170,7 +1170,8 @@ subroutine salt_conservation(domain, err) conservationCheckSaltAMPool, & meshPool, & statePool, & - forcingPool + forcingPool, & + tracersSurfaceFluxPool real(kind=RKIND), pointer :: & initialSalt, & @@ -1260,6 +1261,7 @@ subroutine salt_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityOld, 1) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityNew, 2) + call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_salinitySurfaceFlux', index_salinity_flux) From 7c404b94c7c25415fac6d8e54b10257b4a20c58c Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 28 Nov 2023 18:19:49 -0700 Subject: [PATCH 034/197] typo in print sgheatflux --- .../src/analysis_members/mpas_ocn_conservation_check.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 1278342ceb2..881b53efd5b 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -769,7 +769,7 @@ subroutine energy_conservation(domain, err) v=accumulatedEvapTemperatureFlux *rho_sw*cp_sw; write(m,"('EvapTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw; write(m,"('SeaIceTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v -v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v +v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('SubglacialRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedIcebergTemperatureFlux*rho_sw*cp_sw; write(m,"('IcebergTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v write(m,"('SUM IMPLICIT HEAT FLUXES ',es16.8,' hh20temp ',f16.8,es16.8)") s, s/A; call mpas_log_write(m) s = s + explicitHeatFluxSum From e89e8544f1ef2740cca4e105fff2a3ea98153e82 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 30 Nov 2023 11:52:31 -0700 Subject: [PATCH 035/197] add subglacial to kpp in diagnostics --- .../src/shared/mpas_ocn_diagnostics.F | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index f65749af25f..f04893b671c 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3289,16 +3289,18 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & !----------------------------------------------------------------- integer :: & - iCell, iEdge, i, &! loop indices for cell, edge, neighbors - kmin, &! topmost active cell index - nCells, &! number of cells - err, &! local error code - timeLevel ! time level for state variables (default 1) + iCell, iEdge, i, k, &! loop indices for cell, edge, neighbors + kmin, &! topmost active cell index + nCells, &! number of cells + err, &! local error code + timeLevel ! time level for state variables (default 1) real (kind=RKIND) :: & fracAbsorbed, &! fraction of sfc flux absorbed fracAbsorbedRunoff, &! same for runoff fracAbsorbedSubglacialRunoff, &! same for subglacial runoff + zTop,zBot, &! temporary variables + transmissionCoeffTop,transmissionCoeffBot, &! temporary variables sumSurfaceStressSquared ! sum of sfc stress squared ! pointers for variable/pool retrievals @@ -3488,10 +3490,31 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) if (config_use_sgr_opt_kpp == 1) then - fracAbsorbedSubglacialRunoff = 1.0_RKIND & + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + fracAbsorbedSubglacialRunoff = 1.0_RKIND & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_subglacial_runoff)) + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + ! calculate total thickness into variable zTop + zTop = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + zTop = zTop + layerThickness(k,iCell) + end do + ! distribute flux evenly throughout water column + fracAbsorbedSubglacialRunoff = layerThickness(kmin, iCell) / zTop + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + zTop = 0.0_RKIND + do k = maxLevelCell(iCell), minLevelCell(iCell), -1 + zBot = zTop - layerThickness(k,iCell) + if (k == minLevelCell(iCell)) then + transmissionCoeffTop = exp( max(zTop / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) + transmissionCoeffBot = exp( max(zBot / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) + fracAbsorbedSubglacialRunoff = transmissionCoeffTop - transmissionCoeffBot + end if + zTop = zBot + end do + end if else fracAbsorbedSubglacialRunoff = 0.0_RKIND end if From 52a47584d0f553a65f0f386516cac415c83e2eee Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 12:36:10 -0600 Subject: [PATCH 036/197] resolved: fris meshes --- components/mpas-ocean/cime_config/buildnml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 725c26d2818..f5a05e03aad 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -281,6 +281,8 @@ def buildnml(case, caseroot, compname): data_ismf_file = 'prescribed_ismf_adusumilli2020.SOwISC12to60E2r4.230516.nc' if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.SOwISC12to60E2r4.20210114.nc' + if ocn_sgr == 'data': + data_sgr_file = 'SOwISC12to60E2r4_DSGR.nc' elif ocn_grid == 'FRISwISC08to60E3r1': decomp_date = '20230913' # changed to date of partiotions in ../files_for_e3sm/assembled_files/inputdata/ocn/mpas-o/FRISwISC08to60E3r1/partitions From c6a0104624162cf57cf49241d3655446cb697885 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 1 Feb 2024 10:53:19 -0700 Subject: [PATCH 037/197] cleanup --- components/mpas-ocean/bld/build-namelist | 2 +- .../bld/namelist_files/namelist_definition_mpaso.xml | 4 ++-- components/mpas-ocean/cime_config/config_component.xml | 2 +- components/mpas-ocean/src/Registry.xml | 4 ++-- components/mpas-ocean/src/shared/mpas_ocn_forcing.F | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index e1d2548dffe..e33f4dc1c79 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -56,7 +56,7 @@ OPTIONS Options are: none, data, internal, coupled -ocn_sgr variable for defining how the ocn model will handle subglacial runoff - Options are: none, data, coupled + Options are: none, data -decomp_prefix decomp_prefix variable -date_stamp date_stamp variable -cfg_grid Directory containing MPASO configuration scripts. diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 8152b1fec72..97bd989f06c 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1216,7 +1216,7 @@ Default: Defined in namelist_defaults.xml category="forcing" group="forcing"> Option to choose sgr temperature -Valid values: 'sgr','current', 'prescribed'. +Valid values: 'sgr', 'prescribed'. Default: Defined in namelist_defaults.xml @@ -1224,7 +1224,7 @@ Default: Defined in namelist_defaults.xml category="forcing" group="forcing"> Option to choose sgr salinity -Valid values: 'sgr','current', 'prescribed'. +Valid values: 'sgr', 'prescribed'. Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/cime_config/config_component.xml b/components/mpas-ocean/cime_config/config_component.xml index eb8e0951982..83b4501ee5e 100644 --- a/components/mpas-ocean/cime_config/config_component.xml +++ b/components/mpas-ocean/cime_config/config_component.xml @@ -41,7 +41,7 @@ char - none,data,coupled + none,data none none diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 7e3b1d125da..1ba2259da87 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -716,11 +716,11 @@ /> Date: Tue, 9 Jul 2024 12:37:17 -0600 Subject: [PATCH 038/197] resolved: fris meshes #2 --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- components/mpas-ocean/cime_config/buildnml | 3 ++- components/mpas-ocean/src/Registry.xml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index a2c6465c6d1..9e14fbf04d1 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -343,7 +343,7 @@ 0.001 10.0 0.001 -'top' +'uniform' 0 'sgr' 'sgr' diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index f5a05e03aad..4d5029555af 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -379,6 +379,8 @@ def buildnml(case, caseroot, compname): data_ismf_file = 'prescribed_ismf_paolo2023.IcoswISC30E3r5.20240227.nc' if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' + if ocn_sgr == 'data': + data_sgr_file = 'IcoswISC30E3r5_DSGR.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' @@ -404,7 +406,6 @@ def buildnml(case, caseroot, compname): if ocn_ismf == 'data': data_ismf_file = 'prescribed_ismf_paolo2023.RRSwISC6to18E3r5.20240327.nc' - #-------------------------------------------------------------------- # Set OCN_FORCING = datm_forced_restoring if restoring file is available #-------------------------------------------------------------------- diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 1ba2259da87..e48a84d2437 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -706,7 +706,7 @@ description="The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - From cdc60afb77c6129f2ece53ee85b4d49e7c92f095 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 7 Feb 2024 16:13:31 -0700 Subject: [PATCH 039/197] changed sgr kpp default to 1 = use --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- components/mpas-ocean/src/Registry.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 9e14fbf04d1..40a3b3ca86f 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -344,7 +344,7 @@ 10.0 0.001 'uniform' -0 +1 'sgr' 'sgr' 0.0 diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index e48a84d2437..506dd5772c0 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -710,7 +710,7 @@ description="Selects the vertical location where subglacial runoff is fluxed." possible_values="'top','uniform', 'bottom'" /> - From 1664002c0aba6072e624795f62bb72fa1b185298 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 16:04:08 -0600 Subject: [PATCH 040/197] change config_sgr_flux_vertical_location default to bottom --- components/mpas-ocean/src/Registry.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 506dd5772c0..1ceddac39fc 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -706,7 +706,7 @@ description="The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - From f0e802d4a6d447c9dcadcced6bcb02fc06770438 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 13:07:55 -0600 Subject: [PATCH 041/197] rmv conservation check on sgr --- .../Registry_conservation_check.xml | 22 ----- .../mpas_ocn_conservation_check.F | 96 +++++-------------- 2 files changed, 23 insertions(+), 95 deletions(-) diff --git a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml index 8a79ac12629..0fd2d28d1c6 100644 --- a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml +++ b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml @@ -106,9 +106,6 @@ - @@ -151,10 +148,6 @@ - - @@ -205,9 +194,6 @@ - - - - @@ -319,7 +302,6 @@ - @@ -361,17 +343,14 @@ - - - @@ -379,7 +358,6 @@ - diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 881b53efd5b..5551d5758db 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -28,7 +28,6 @@ module ocn_conservation_check use ocn_constants use ocn_config - use ocn_mesh implicit none private @@ -428,7 +427,6 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & - accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), dimension(:), allocatable :: & @@ -465,8 +463,7 @@ subroutine energy_conservation(domain, err) real(kind=RKIND), dimension(:,:), pointer :: & - activeTracersSurfaceFluxRunoff, & - activeTracersSurfaceFluxSubglacialRunoff + activeTracersSurfaceFluxRunoff type (MPAS_timeInterval_type) :: & timeStepESMF @@ -483,7 +480,7 @@ subroutine energy_conservation(domain, err) ierr integer, parameter :: & - nSums = 20 + nSums = 19 character(len=160) :: & m @@ -516,7 +513,6 @@ subroutine energy_conservation(domain, err) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) - call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) !------------------------------------------------------------- @@ -560,7 +556,6 @@ subroutine energy_conservation(domain, err) call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_temperatureSurfaceFlux', index_temperature_flux) call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxRunoff', activeTracersSurfaceFluxRunoff) - call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassNew, 2) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassOld, 1) @@ -585,7 +580,6 @@ subroutine energy_conservation(domain, err) ! river runoff temperature flux sumArray(14) = sumArray(14) + areaCell(iCell) * activeTracersSurfaceFluxRunoff(index_temperature_flux,iCell) sumArray(15) = sumArray(15) + areaCell(iCell) * icebergTemperatureFlux(iCell) - sumArray(20) = sumArray(20) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) enddo ! iCell @@ -640,7 +634,6 @@ subroutine energy_conservation(domain, err) accumulatedLandIceHeatFlux = accumulatedLandIceHeatFlux + sumArrayOut(17) accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux + sumArrayOut(18) accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux + sumArrayOut(19) - accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux + sumArrayOut(20) ! cleanup deallocate(sumArray) @@ -670,7 +663,6 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux = accumulatedEvapTemperatureFlux /accumulatedFluxCounter accumulatedSeaIceTemperatureFlux = accumulatedSeaIceTemperatureFlux /accumulatedFluxCounter accumulatedRiverRunoffTemperatureFlux = accumulatedRiverRunoffTemperatureFlux /accumulatedFluxCounter - accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux /accumulatedFluxCounter accumulatedIcebergTemperatureFlux = accumulatedIcebergTemperatureFlux /accumulatedFluxCounter accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux /accumulatedFluxCounter @@ -705,7 +697,6 @@ subroutine energy_conservation(domain, err) + accumulatedEvapTemperatureFlux *rho_sw*cp_sw & + accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw & + accumulatedRiverRunoffTemperatureFlux *rho_sw*cp_sw & - + accumulatedSubglacialRunoffTemperatureFlux *rho_sw*cp_sw & + accumulatedIcebergTemperatureFlux*rho_sw*cp_sw ! note, accumulatedLandIceFrazilHeatFlux not added because already in accumulatedFrazilHeatFlux @@ -769,7 +760,6 @@ subroutine energy_conservation(domain, err) v=accumulatedEvapTemperatureFlux *rho_sw*cp_sw; write(m,"('EvapTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw; write(m,"('SeaIceTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v -v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('SubglacialRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedIcebergTemperatureFlux*rho_sw*cp_sw; write(m,"('IcebergTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v write(m,"('SUM IMPLICIT HEAT FLUXES ',es16.8,' hh20temp ',f16.8,es16.8)") s, s/A; call mpas_log_write(m) s = s + explicitHeatFluxSum @@ -838,7 +828,6 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & - accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & accumulatedRemovedIceRunoffFlux, & @@ -863,7 +852,6 @@ subroutine mass_conservation(domain, err) evaporationFlux, & seaIceFreshwaterFlux, & riverRunoffFlux, & - subglacialRunoffFlux, & iceRunoffFlux, & removedRiverRunoffFlux, & removedIceRunoffFlux, & @@ -889,7 +877,7 @@ subroutine mass_conservation(domain, err) iCell, ierr, k integer, parameter :: & - nSums = 13 + nSums = 12 integer, dimension(:), pointer :: minLevelCell, maxLevelCell @@ -912,7 +900,6 @@ subroutine mass_conservation(domain, err) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) - call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) @@ -950,7 +937,6 @@ subroutine mass_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'evaporationFlux', evaporationFlux) call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) - call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedRiverRunoffFlux', removedRiverRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedIceRunoffFlux', removedIceRunoffFlux) @@ -970,7 +956,6 @@ subroutine mass_conservation(domain, err) sumArray( 7) = sumArray( 7) + areaCell(iCell) * removedRiverRunoffFlux(iCell) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) - sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) / areaCell(iCell) * rho_sw enddo if (config_use_frazil_ice_formation) then @@ -1017,7 +1002,6 @@ subroutine mass_conservation(domain, err) accumulatedFrazilFlux = accumulatedFrazilFlux + sumArrayOut(10) accumulatedLandIceFlux = accumulatedLandIceFlux + sumArrayOut(11) accumulatedLandIceFrazilFlux = accumulatedLandIceFrazilFlux + sumArrayOut(12) - accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux + sumArrayOut(13) ! cleanup deallocate(sumArray) @@ -1037,7 +1021,6 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux = accumulatedEvaporationFlux /accumulatedFluxCounter accumulatedSeaIceFlux = accumulatedSeaIceFlux /accumulatedFluxCounter accumulatedRiverRunoffFlux = accumulatedRiverRunoffFlux /accumulatedFluxCounter - accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux /accumulatedFluxCounter accumulatedIceRunoffFlux = accumulatedIceRunoffFlux /accumulatedFluxCounter accumulatedRemovedRiverRunoffFlux = accumulatedRemovedRiverRunoffFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffFlux = accumulatedRemovedIceRunoffFlux /accumulatedFluxCounter @@ -1066,7 +1049,6 @@ subroutine mass_conservation(domain, err) + accumulatedEvaporationFlux & + accumulatedSeaIceFlux & + accumulatedRiverRunoffFlux & - + accumulatedSubglacialRunoffFlux & + accumulatedIceRunoffFlux & + accumulatedIcebergFlux & + accumulatedFrazilFlux & @@ -1101,8 +1083,6 @@ subroutine mass_conservation(domain, err) v=accumulatedIcebergFlux ; write(m,"('icebergFreshwaterFlux ',es16.8,' x2o_Fioi_bergw wberg ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedEvaporationFlux ; write(m,"('evaporationFlux ',es16.8,' x2o_Foxx_evap wevap ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffFlux ; write(m,"('riverRunoffFlux ',es16.8,' x2o_Foxx_rofl wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v -v=accumulatedSubglacialRunoffFlux ; write(m,"('subglacialRunoffFlux ',es16.8,' x2o_Foxx_rofl wsgr ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v - if (landIceFreshwaterFluxesOn) then v=accumulatedRemovedRiverRunoffFlux; write(m,"('removedRiverRunoffFlux ',es16.8,' wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); v=accumulatedRiverRunoffFlux+accumulatedRemovedRiverRunoffFlux; @@ -1170,8 +1150,7 @@ subroutine salt_conservation(domain, err) conservationCheckSaltAMPool, & meshPool, & statePool, & - forcingPool, & - tracersSurfaceFluxPool + forcingPool real(kind=RKIND), pointer :: & initialSalt, & @@ -1181,14 +1160,10 @@ subroutine salt_conservation(domain, err) absoluteSaltError, & relativeSaltError - real(kind=RKIND), dimension(:,:), pointer :: & - activeTracersSurfaceFluxSubglacialRunoff - real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & + accumulatedFrazilSalinityFlux ! accumulatedLandIceFrazilSalinityFlux is not present because it is always 0 - accumulatedFrazilSalinityFlux, & - accumulatedSubglacialRunoffSalinityFlux real(kind=RKIND), dimension(:), allocatable :: & sumArray, & @@ -1209,15 +1184,14 @@ subroutine salt_conservation(domain, err) dt, dtAvg, v, A, s, c integer, pointer :: & - nCellsSolve, & - index_salinity_flux + nCellsSolve integer :: & iCell, & ierr integer, parameter :: & - nSums = 4 + nSums = 3 logical, pointer :: & activeTracersBulkRestoringPKG @@ -1235,7 +1209,6 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) - call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) !------------------------------------------------------------- ! Net salt flux to ice @@ -1261,18 +1234,11 @@ subroutine salt_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityOld, 1) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityNew, 2) - call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) - call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) - call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_salinitySurfaceFlux', index_salinity_flux) - - do iCell = 1, nCellsSolve ! salt flux to ocean sumArray(1) = sumArray(1) + areaCell(iCell) * seaIceSalinityFlux(iCell) - ! subglacial runoff - sumArray(4) = sumArray(4) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) enddo ! iCell if (config_use_frazil_ice_formation) then @@ -1299,7 +1265,6 @@ subroutine salt_conservation(domain, err) ! accumulate fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux + sumArrayOut(1) accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux + sumArrayOut(2) - accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux + sumArrayOut(4) ! cleanup deallocate(sumArray) @@ -1316,7 +1281,6 @@ subroutine salt_conservation(domain, err) ! Average the fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux /accumulatedFluxCounter accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux /accumulatedFluxCounter - accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux /accumulatedFluxCounter ! get initial salt content call MPAS_pool_get_array(conservationCheckSaltAMPool, "initialSalt", initialSalt) @@ -1333,8 +1297,7 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "netSaltFlux", netSaltFlux) netSaltFlux = accumulatedSeaIceSalinityFlux & - + accumulatedFrazilSalinityFlux & - + accumulatedSubglacialRunoffSalinityFlux + + accumulatedFrazilSalinityFlux ! compute the final salt error call MPAS_pool_get_array(conservationCheckSaltAMPool, "absoluteSaltError", absoluteSaltError) @@ -1364,8 +1327,6 @@ subroutine salt_conservation(domain, err) .and.config_frazil_under_land_ice) then v=0; write(m,"('LandIceFrazilSalinityFlux',es16.8,' (already in wmelt, do not sum) ',f16.8)") v,v*c; call mpas_log_write(m); !no sum: s=s+v end if -v=accumulatedSubglacialRunoffSalinityFlux ; write(m,"('SubglacialRunoffSalinityFlux ',es16.8,' x2o_Fioi_salt salt ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v - write(m,"('SUM VOLUME FLUXES ',es16.8,' ',f16.8,es16.8)") s, s*c; call mpas_log_write(m) call mpas_log_write(' ') @@ -1562,11 +1523,11 @@ subroutine carbon_conservation(domain, err) block => domain % blocklist do while (associated(block)) call MPAS_pool_get_dimension(block % dimensions, "nCellsSolve", nCellsSolve) - + call MPAS_pool_get_subpool(block % structs, "mesh", meshPool) call MPAS_pool_get_subpool(block % structs, "forcing", forcingPool) call MPAS_pool_get_subpool(block % structs, "state", statePool) - + call MPAS_pool_get_array(meshPool, "areaCell", areaCell) call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell) @@ -1633,7 +1594,7 @@ subroutine carbon_conservation(domain, err) + ecosysTracersSurfaceFlux(index_spCFlux, iCell) & + ecosysTracersSurfaceFlux(index_diatCFlux, iCell) & + ecosysTracersSurfaceFlux(index_diazCFlux, iCell)) - + do k = 1, maxLevelCell(iCell) sumArray(4) = sumArray(4) + areaCell(iCell) * ( & ecosysTracersTend(index_DICTend, k, iCell) & @@ -1684,7 +1645,7 @@ subroutine carbon_conservation(domain, err) !------------------------------------------------------------- if (MPAS_stream_mgr_ringing_alarms(domain % streamManager, "conservationCheckOutput", ierr=ierr)) then - + ! Average the fluxes accumulatedCarbonSourceSink = accumulatedCarbonSourceSink /accumulatedFluxCounter accumulatedCarbonSedimentFlux = accumulatedCarbonSedimentFlux /accumulatedFluxCounter @@ -1696,7 +1657,7 @@ subroutine carbon_conservation(domain, err) ! get initial carbon call MPAS_pool_get_array(conservationCheckCarbonAMPool, "initialCarbon", initialCarbon) - + ! get final carbon call MPAS_pool_get_array(conservationCheckCarbonAMPool, "finalCarbon", finalCarbon) call compute_total_carbon(domain, finalCarbon) @@ -1733,13 +1694,13 @@ subroutine carbon_conservation(domain, err) relativeCarbonErrorBounds = & relativeCarbonErrorStepBounds*relativeCarbonErrorBoundsFac*totalTimeSteps relativeCarbonErrorPerTimeStep = relativeCarbonError/accumulatedFluxCounter - + !------------------------------------------------------------- ! Output to log file !------------------------------------------------------------- if (config_AM_conservationCheck_write_to_logfile) then - + call mpas_log_write('') call mpas_log_write('----------------------------------------------------------') call mpas_log_write('CARBON CONSERVATION CHECK') @@ -1770,7 +1731,7 @@ subroutine carbon_conservation(domain, err) v=accumulatedIceOceanInorganicCarbonFlux*mmol_to_kg_C write(m,"('Ice-Ocean Inorganic Flux ',es16.8,' ',f16.8)") v,v*c call mpas_log_write(m) - write(m,"('SUM FLUXES (surf + sed) ',es16.8,' ',f16.8,es16.8)") s, s*c; + write(m,"('SUM FLUXES (surf + sed) ',es16.8,' ',f16.8,es16.8)") s, s*c; call mpas_log_write(m) call mpas_log_write(' ') @@ -1790,24 +1751,24 @@ subroutine carbon_conservation(domain, err) write(m,"('Carbon change ', 3es16.8)") & carbonChange*mmol_to_kg_C, & carbonChange*mmol_to_kg_C/dtAvg, & - carbonChange*mmol_to_kg_C/dtAvg*c + carbonChange*mmol_to_kg_C/dtAvg*c call mpas_log_write(m) write(m,"('Net carbon flux ', 3es16.8)") & netCarbonFlux*mmol_to_kg_C*dtAvg, & netCarbonFlux*mmol_to_kg_C, & - netCarbonFlux*mmol_to_kg_C*c + netCarbonFlux*mmol_to_kg_C*c call mpas_log_write(m) write(m,"('Absolute carbon error ', 3es16.8)") & absoluteCarbonError*mmol_to_kg_C, & absoluteCarbonError*mmol_to_kg_C/dtAvg, & - absoluteCarbonError*mmol_to_kg_C/dtAvg*c + absoluteCarbonError*mmol_to_kg_C/dtAvg*c call mpas_log_write(m) call mpas_log_write(' ') write(m,"('RELATIVE CARBON ERROR =', es16.8)") & relativeCarbonError call mpas_log_write(m) call mpas_log_write(' ') - + write(m,"('Relative carbon error per timestep = ', es16.8)") & relativeCarbonErrorPerTimeStep call mpas_log_write(m) @@ -1853,7 +1814,7 @@ subroutine carbon_conservation(domain, err) endif end subroutine carbon_conservation - + !*********************************************************************** ! ! routine compute_total_energy @@ -2229,7 +2190,7 @@ subroutine compute_total_carbon(domain, totalCarbon) call MPAS_dmpar_sum_real(domain % dminfo, carbon, totalCarbon) end subroutine compute_total_carbon - + !*********************************************************************** ! ! routine reset_accumulated_variables @@ -2271,7 +2232,6 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & - accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), pointer :: & @@ -2280,7 +2240,6 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & - accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & accumulatedRemovedIceRunoffFlux, & @@ -2291,8 +2250,7 @@ subroutine reset_accumulated_variables(domain) real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux, & - accumulatedSubglacialRunoffSalinityFlux + accumulatedFrazilSalinityFlux real(kind=RKIND), pointer :: & accumulatedCarbonSourceSink, & @@ -2322,7 +2280,6 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) - call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) accumulatedFluxCounter = 0 @@ -2341,7 +2298,6 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux = 0.0_RKIND accumulatedSeaIceTemperatureFlux = 0.0_RKIND accumulatedRiverRunoffTemperatureFlux = 0.0_RKIND - accumulatedSubglacialRunoffTemperatureFlux = 0.0_RKIND accumulatedIcebergTemperatureFlux = 0.0_RKIND accumulatedLandIceFrazilHeatFlux = 0.0_RKIND accumulatedRemovedIceRunoffHeatFlux = 0.0_RKIND @@ -2354,7 +2310,6 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) - call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) @@ -2368,7 +2323,6 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux = 0.0_RKIND accumulatedSeaIceFlux = 0.0_RKIND accumulatedRiverRunoffFlux = 0.0_RKIND - accumulatedSubglacialRunoffFlux = 0.0_RKIND accumulatedIceRunoffFlux = 0.0_RKIND accumulatedRemovedRiverRunoffFlux = 0.0_RKIND accumulatedRemovedIceRunoffFlux = 0.0_RKIND @@ -2382,13 +2336,9 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) - call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedLandIceFrazilSalinityFlux", accumulatedLandIceFrazilSalinityFlux) - call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) - accumulatedSeaIceSalinityFlux = 0.0_RKIND accumulatedFrazilSalinityFlux = 0.0_RKIND - accumulatedSubglacialRunoffSalinityFlux = 0.0_RKIND call MPAS_pool_get_subpool(domain % blocklist % structs, "conservationCheckCarbonAM", conservationCheckCarbonAMPool) From ea8bb59c4710c99561d0993a57cdfc505ac39216 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 13:32:31 -0600 Subject: [PATCH 042/197] rmv conservation check on sgr buildnml --- components/mpas-ocean/cime_config/buildnml | 1 - 1 file changed, 1 deletion(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 4d5029555af..91c481ad8f5 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1195,7 +1195,6 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') - lines.append('') lines.append('') lines.append('') lines.append('') From e969c31a02875303c5e0f0435195fb7a0ff1edcb Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 13:56:39 -0600 Subject: [PATCH 043/197] rmv conservation check on sgr buildnml #2 --- components/mpas-ocean/cime_config/buildnml | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 91c481ad8f5..d6d40491baa 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1201,7 +1201,6 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') - lines.append('') lines.append('') lines.append('') lines.append('') @@ -1210,7 +1209,6 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') - lines.append('') lines.append('') lines.append('') lines.append('') From 800961c2e6f6efa310da7a00018b91fa51f3ba93 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 12:14:43 -0600 Subject: [PATCH 044/197] pkg change in bld --- components/mpas-ocean/bld/build-namelist | 5 +++++ components/mpas-ocean/bld/build-namelist-section | 1 + .../bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- .../bld/namelist_files/namelist_definition_mpaso.xml | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index e33f4dc1c79..2c5ee97b0df 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -715,6 +715,11 @@ add_default($nl, 'config_use_sgr_opt_temp'); add_default($nl, 'config_use_sgr_opt_salt'); add_default($nl, 'config_sgr_temperature'); add_default($nl, 'config_sgr_salinity'); +if ($OCN_SGR eq 'data') { + add_default($nl, 'config_subglacial_runoff_mode', 'val'=>"data"); +} else { + add_default($nl, 'config_subglacial_runoff_mode'); +} ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 0d44d3f328b..3f2d4ab4839 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -231,6 +231,7 @@ add_default($nl, 'config_use_sgr_opt_temp'); add_default($nl, 'config_use_sgr_opt_salt'); add_default($nl, 'config_sgr_temperature'); add_default($nl, 'config_sgr_salinity'); +add_default($nl, 'config_subglacial_runoff_mode'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 40a3b3ca86f..0514704b951 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -349,7 +349,7 @@ 'sgr' 0.0 0.0 - +'off' .false. diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 97bd989f06c..616ec67d24c 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1244,6 +1244,14 @@ Valid values: Any real number. Default: Defined in namelist_defaults.xml + +Selects the mode in which subglacial runoff fluxes are computed. + +Valid values: 'off', 'data' +Default: Defined in namelist_defaults.xml + + Date: Mon, 8 Jul 2024 12:32:42 -0600 Subject: [PATCH 045/197] pkg in driver and registry --- components/mpas-ocean/src/Registry.xml | 5 +++++ .../mpas-ocean/src/driver/mpas_ocn_core_interface.F | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 1ceddac39fc..bab43073350 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -702,6 +702,10 @@ description="The length scale of exponential decay of river runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> + + diff --git a/components/mpas-ocean/src/driver/mpas_ocn_core_interface.F b/components/mpas-ocean/src/driver/mpas_ocn_core_interface.F index 7d9eb083f90..6d542fb0c3f 100644 --- a/components/mpas-ocean/src/driver/mpas_ocn_core_interface.F +++ b/components/mpas-ocean/src/driver/mpas_ocn_core_interface.F @@ -123,6 +123,7 @@ function ocn_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{ logical, pointer :: dataLandIceFluxesPKGActive logical, pointer :: landIceFluxesPKGActive logical, pointer :: landIceCouplingPKGActive + logical, pointer :: dataSubglacialRunoffFluxPKGActive logical, pointer :: thicknessBulkPKGActive logical, pointer :: frazilIceActive logical, pointer :: tidalForcingActive @@ -186,6 +187,7 @@ function ocn_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{ logical, pointer :: config_use_bulk_thickness_flux logical, pointer :: config_compute_active_tracer_budgets character (len=StrKIND), pointer :: config_land_ice_flux_mode + character (len=StrKIND), pointer :: config_subglacial_runoff_mode type (mpas_pool_iterator_type) :: groupItr character (len=StrKIND) :: tracerGroupName, configName, packageName @@ -319,6 +321,15 @@ function ocn_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{ landIceCouplingPKGActive = .true. end if + ! + ! test for use of subglacial runoff flux, dataSubglacialRunoffFluxPKGActive + ! + call mpas_pool_get_package(packagePool, 'dataSubglacialRunoffFluxPKGActive', dataSubglacialRunoffFluxPKGActive) + call mpas_pool_get_config(configPool, 'config_subglacial_runoff_mode', config_subglacial_runoff_mode) + if ( trim(config_subglacial_runoff_mode) == 'data' ) then + dataSubglacialRunoffFluxPKGActive = .true. + end if + ! ! test for use of frazil ice formation, frazilIceActive ! From b07587b10a5d5f9c767dcbd07ee58a384c5aa09c Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 13:05:43 -0600 Subject: [PATCH 046/197] fix group for sgr in namelist_definition_mpaso --- .../mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 616ec67d24c..43ba139ab65 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1245,7 +1245,7 @@ Default: Defined in namelist_defaults.xml + category="forcing" group="forcing"> Selects the mode in which subglacial runoff fluxes are computed. Valid values: 'off', 'data' From f1b13ba8657dd579a5aae5e2fa18c8fd8a3ccb5a Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 14:10:11 -0600 Subject: [PATCH 047/197] sgr pkg in shared folder, add loops --- .../src/shared/mpas_ocn_diagnostics.F | 100 ++++++++++-------- .../mpas-ocean/src/shared/mpas_ocn_forcing.F | 77 +++++++------- .../shared/mpas_ocn_surface_bulk_forcing.F | 55 ++++++---- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 12 ++- .../src/shared/mpas_ocn_thick_surface_flux.F | 21 ++-- .../mpas_ocn_tracer_surface_flux_to_tend.F | 2 +- 6 files changed, 153 insertions(+), 114 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index f04893b671c..daf9bfcab6d 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -1904,9 +1904,13 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & config_flux_attenuation_coefficient surfaceFluxAttenuationCoefficientRunoff(iCell) = & config_flux_attenuation_coefficient_runoff - surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell) = & - config_flux_attenuation_coefficient_subglacial_runoff end do + if (trim(config_subglacial_runoff_mode) == 'data') then + do iCell = 1, nCells + surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell) = & + config_flux_attenuation_coefficient_subglacial_runoff + end do + end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel @@ -3489,34 +3493,36 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) - if (config_use_sgr_opt_kpp == 1) then - if ( trim(config_sgr_flux_vertical_location) == 'top' ) then - fracAbsorbedSubglacialRunoff = 1.0_RKIND & - - exp( max(-100.0_RKIND, & - -layerThickness(kmin, iCell)/ & - config_flux_attenuation_coefficient_subglacial_runoff)) - else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then - ! calculate total thickness into variable zTop - zTop = 0.0_RKIND - do k = minLevelCell(iCell), maxLevelCell(iCell) - zTop = zTop + layerThickness(k,iCell) - end do - ! distribute flux evenly throughout water column - fracAbsorbedSubglacialRunoff = layerThickness(kmin, iCell) / zTop - else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then - zTop = 0.0_RKIND - do k = maxLevelCell(iCell), minLevelCell(iCell), -1 - zBot = zTop - layerThickness(k,iCell) - if (k == minLevelCell(iCell)) then - transmissionCoeffTop = exp( max(zTop / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) - transmissionCoeffBot = exp( max(zBot / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) - fracAbsorbedSubglacialRunoff = transmissionCoeffTop - transmissionCoeffBot - end if - zTop = zBot - end do - end if - else - fracAbsorbedSubglacialRunoff = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + if (config_use_sgr_opt_kpp == 1) then + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + fracAbsorbedSubglacialRunoff = 1.0_RKIND & + - exp( max(-100.0_RKIND, & + -layerThickness(kmin, iCell)/ & + config_flux_attenuation_coefficient_subglacial_runoff)) + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + ! calculate total thickness into variable zTop + zTop = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + zTop = zTop + layerThickness(k,iCell) + end do + ! distribute flux evenly throughout water column + fracAbsorbedSubglacialRunoff = layerThickness(kmin, iCell) / zTop + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + zTop = 0.0_RKIND + do k = maxLevelCell(iCell), minLevelCell(iCell), -1 + zBot = zTop - layerThickness(k,iCell) + if (k == minLevelCell(iCell)) then + transmissionCoeffTop = exp( max(zTop / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) + transmissionCoeffBot = exp( max(zBot / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) + fracAbsorbedSubglacialRunoff = transmissionCoeffTop - transmissionCoeffBot + end if + zTop = zBot + end do + end if + else + fracAbsorbedSubglacialRunoff = 0.0_RKIND + end if end if ! Store the total tracer flux below in @@ -3532,18 +3538,24 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & seaIceTemperatureFlux(iCell) + & icebergTemperatureFlux(iCell)) & - fracAbsorbedRunoff* & - activeTracersSurfaceFluxRunoff(indexTempFlux,iCell) & + activeTracersSurfaceFluxRunoff(indexTempFlux,iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + nonLocalSurfaceTracerFlux(indexTempFlux, iCell) = nonLocalSurfaceTracerFlux(indexTempFlux, iCell) & - fracAbsorbedSubglacialRunoff* & activeTracersSurfaceFluxSubglacialRunoff(indexTempFlux,iCell) + end if nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) = & activeTracersSurfaceFlux(indexSaltFlux,iCell) & - fracAbsorbed*surfaceThicknessFlux(iCell)* & activeTracers(indexSaltFlux,kmin,iCell) & - fracAbsorbedRunoff*surfaceThicknessFluxRunoff(iCell)* & - activeTracers(indexSaltFlux,kmin,iCell) & + activeTracers(indexSaltFlux,kmin,iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) = nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) & - fracAbsorbedSubglacialRunoff*surfaceThicknessFluxSubglacialRunoff(iCell)* & activeTracers(indexSaltFlux,kmin,iCell) + end if surfaceBuoyancyForcing(iCell) = & thermalExpansionCoeff(kmin,iCell)* & @@ -4485,17 +4497,19 @@ subroutine ocn_validate_state(domain, timeLevel)!{{{ call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) end if - ! Test subglacialRunoffFlux - fieldName = 'subglacialRunoffFlux' - minValue = HUGE(minValue) - maxValue = -HUGE(maxValue) - call mpas_pool_get_array(forcingPool, fieldName, real1DArr) - if ( associated(real1DArr) ) then - do iCell = 1, nCellsSolve - minValue = min( minValue, real1DArr(iCell) ) - maxValue = max( maxValue, real1DArr(iCell) ) - end do - call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) + if (trim(config_subglacial_runoff_mode) == 'data') then + ! Test subglacialRunoffFlux + fieldName = 'subglacialRunoffFlux' + minValue = HUGE(minValue) + maxValue = -HUGE(maxValue) + call mpas_pool_get_array(forcingPool, fieldName, real1DArr) + if ( associated(real1DArr) ) then + do iCell = 1, nCellsSolve + minValue = min( minValue, real1DArr(iCell) ) + maxValue = max( maxValue, real1DArr(iCell) ) + end do + call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) + end if end if ! Test seaIceSalinityFlux diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index 75fc20c8d7e..5cfce4c4e69 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -183,44 +183,45 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin end do ! now do subglacial runoff separately - - if ( trim(config_sgr_flux_vertical_location) == 'top' ) then - do iCell = 1, nCells - zTop = 0.0_RKIND - transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - do k = minLevelCell(iCell), maxLevelCell(iCell) - zBot = zTop - layerThickness(k,iCell) - transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot - zTop = zBot - transmissionCoeffTop = transmissionCoeffBot - end do - end do - else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then - do iCell = 1, nCells - ! calculate total thickness - zTop = 0.0_RKIND - do k = minLevelCell(iCell), maxLevelCell(iCell) - zTop = zTop + layerThickness(k,iCell) - end do - ! distribute flux evenly throughout water column - zBot = 0.0_RKIND - do k = minLevelCell(iCell), maxLevelCell(iCell) - fractionAbsorbedSubglacialRunoff(k, iCell) = layerThickness(k,iCell) / zTop - end do - end do - else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then - do iCell = 1, nCells - zTop = 0.0_RKIND - transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - do k = maxLevelCell(iCell), minLevelCell(iCell), -1 - zBot = zTop - layerThickness(k,iCell) - transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot - zTop = zBot - transmissionCoeffTop = transmissionCoeffBot - end do - end do + if ( trim(config_subglacial_runoff_mode) == 'data' ) then + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + do iCell = 1, nCells + zTop = 0.0_RKIND + transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + do k = minLevelCell(iCell), maxLevelCell(iCell) + zBot = zTop - layerThickness(k,iCell) + transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot + zTop = zBot + transmissionCoeffTop = transmissionCoeffBot + end do + end do + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + do iCell = 1, nCells + ! calculate total thickness + zTop = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + zTop = zTop + layerThickness(k,iCell) + end do + ! distribute flux evenly throughout water column + zBot = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + fractionAbsorbedSubglacialRunoff(k, iCell) = layerThickness(k,iCell) / zTop + end do + end do + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + do iCell = 1, nCells + zTop = 0.0_RKIND + transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + do k = maxLevelCell(iCell), minLevelCell(iCell), -1 + zBot = zTop - layerThickness(k,iCell) + transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot + zTop = zBot + transmissionCoeffTop = transmissionCoeffBot + end do + end do + end if end if end subroutine ocn_forcing_build_fraction_absorbed_array!}}} diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index fe4f2cac5ab..0547f73319d 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -351,8 +351,12 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur surfaceThicknessFlux(iCell) = surfaceThicknessFlux(iCell) + ( snowFlux(iCell) + rainFlux(iCell) + evaporationFlux(iCell) & + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw - surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) end do + if (trim(config_subglacial_runoff_mode) == 'data') then + do iCell = 1, nCells + surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) + end do + end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel @@ -578,28 +582,30 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFluxRunoff(index_temperature_flux,iCell) = riverRunoffFlux(iCell) & * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw - if ( trim(config_use_sgr_opt_temp) == 'prescribed' ) then - !sgr with fixed prescribed temperature (for debugging only) - tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_temperature / areaCell(iCell) - else if ( trim(config_use_sgr_opt_temp) == 'sgr' ) then - !sgr with temperature equal to the local freezing point of freshwater - tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & - inLandIceCavity=.true.) / areaCell(iCell) - end if - - if ( trim(config_use_sgr_opt_salt) == 'prescribed' ) then - !sgr with fixed prescribed temperature (for debugging only) - tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_salinity / areaCell(iCell) - else if ( trim(config_use_sgr_opt_salt) == 'sgr' ) then - !sgr with temperature equal to the local freezing point of freshwater - tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + if ( trim(config_use_sgr_opt_temp) == 'prescribed' ) then + !sgr with fixed prescribed temperature (for debugging only) + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + config_sgr_temperature / areaCell(iCell) + else if ( trim(config_use_sgr_opt_temp) == 'sgr' ) then + !sgr with temperature equal to the local freezing point of freshwater + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & + inLandIceCavity=.true.) / areaCell(iCell) + end if + + if ( trim(config_use_sgr_opt_salt) == 'prescribed' ) then + !sgr with fixed prescribed temperature (for debugging only) + tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & + config_sgr_salinity / areaCell(iCell) + else if ( trim(config_use_sgr_opt_salt) == 'sgr' ) then + !sgr with temperature equal to the local freezing point of freshwater + tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND + end if end if ! Accumulate fluxes that use the freezing point -! mrp performance note: should call ocn_freezing_temperature just once here +! mrp performance note: should call ocn_freezing_temperature just once here seaIceTemperatureFlux(iCell) = seaIceFreshWaterFlux(iCell) * & ocn_freezing_temperature( tracerGroup(index_salinity_flux, minLevelCell(iCell), iCell), pressure=0.0_RKIND, & inLandIceCavity=.false.) / rho_sw @@ -613,10 +619,15 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFlux(index_temperature_flux, iCell) = tracersSurfaceFlux(index_temperature_flux, iCell) & + surfaceTemperatureFluxWithoutRunoff - ! add river and subglacial runoff contribution for sending through coupler + ! add river runoff contribution for sending through coupler totalFreshWaterTemperatureFlux(iCell) = surfaceTemperatureFluxWithoutRunoff & - + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) & + + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) + + ! add subglacial runoff contribution for sending through coupler + if (trim(config_subglacial_runoff_mode) == 'data') then + totalFreshWaterTemperatureFlux(iCell) = totalFreshWaterTemperatureFlux(iCell) & + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) + end if ! Fields with zero temperature are not accumulated. These include: ! snowFlux diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index 2d3dd66cbdb..30584386666 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -186,11 +186,15 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ do iCell = 1, nCellsAll surfaceThicknessFlux(iCell) = 0.0_RKIND surfaceThicknessFluxRunoff(iCell) = 0.0_RKIND - surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND do k=1,nVertLevels tendThick(k, iCell) = 0.0_RKIND end do end do + if (trim(config_subglacial_runoff_mode) == 'data') then + do iCell = 1, nCellsAll + surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND + end do + end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel @@ -841,9 +845,13 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & do n=1,nTracersGroup tracerGroupSurfaceFlux (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRunoff (n,iCell) = 0.0_RKIND - tracerGroupSurfaceFluxSubglacialRunoff (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRemoved(n,iCell) = 0.0_RKIND end do + if (trim(config_subglacial_runoff_mode) == 'data') then + do n=1,nTracersGroup + tracerGroupSurfaceFluxSubglacialRunoff (n,iCell) = 0.0_RKIND + end do + end if end do !$omp end do !$omp end parallel diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index 1f7c67b88e0..eb531a99958 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -141,15 +141,18 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe do iCell = 1, nCellsOwned remainingFlux = 1.0_RKIND remainingFluxRunoff = 1.0_RKIND - remainingFluxSubglacialRunoff = 1.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + remainingFluxSubglacialRunoff = 1.0_RKIND + end if do k = minLevelCell(iCell), maxLevelCell(iCell) remainingFlux = remainingFlux - transmissionCoefficients(k, iCell) remainingFluxRunoff = remainingFluxRunoff - transmissionCoefficientsRunoff(k, iCell) - remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) - tend(k, iCell) = tend(k, iCell) + surfaceThicknessFlux(iCell) * transmissionCoefficients(k, iCell) & - + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) & - + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) + + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) + tend(k, iCell) = tend(k, iCell) + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) + end if end do if(maxLevelCell(iCell) > 0 .and. remainingFlux > 0.0_RKIND) then @@ -161,9 +164,11 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe + remainingFluxRunoff * surfaceThicknessFluxRunoff(iCell) end if - if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then - tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & - + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then + tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & + + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) + end if end if end do #ifndef MPAS_OPENACC diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index 4303d1b78ff..4a1dc5fce09 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -206,7 +206,7 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso ! now do subglacial runoff component - if (associated(surfaceTracerFluxSubglacialRunoff)) then + if (trim(config_subglacial_runoff_mode) == 'data') then call mpas_timer_start("surface_tracer_subglacial_runoff_flux") !$omp parallel From 9b3e339867dfbf0f564be21ef25deb71ce089ffe Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 14:46:56 -0600 Subject: [PATCH 048/197] pkg dataSubglacialRunoffFluxPKG into registry variables --- components/mpas-ocean/src/Registry.xml | 7 ++++--- .../src/tracer_groups/Registry_activeTracers.xml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index bab43073350..79ef88b3318 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3384,6 +3384,7 @@ /> @@ -3807,7 +3808,7 @@ /> - + From 5ea51b28153984ba3c484d453a55cd48181b8edb Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 16:30:12 -0600 Subject: [PATCH 049/197] add conservation registry and streams --- components/mpas-ocean/cime_config/buildnml | 3 +++ .../Registry_conservation_check.xml | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index d6d40491baa..4d5029555af 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1195,12 +1195,14 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') @@ -1209,6 +1211,7 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') diff --git a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml index 0fd2d28d1c6..7870e6fc217 100644 --- a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml +++ b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml @@ -106,6 +106,10 @@ + @@ -145,6 +149,10 @@ description="Fresh water flux from river runoff from coupler. Positive into the ocean." packages="thicknessBulkPKG" /> + @@ -194,6 +202,11 @@ + + + + @@ -302,6 +317,7 @@ + @@ -343,12 +359,14 @@ + + @@ -358,6 +376,7 @@ + From 361900104fd6e9fa284639f73395d5ca04732ffc Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 17:04:01 -0600 Subject: [PATCH 050/197] try copy mpas_ocn_conservation_check.F --- .../mpas_ocn_conservation_check.F | 105 ++++++++++++++++-- 1 file changed, 97 insertions(+), 8 deletions(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 5551d5758db..756328a3d5d 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -28,6 +28,7 @@ module ocn_conservation_check use ocn_constants use ocn_config + use ocn_mesh implicit none private @@ -427,6 +428,7 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & + accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), dimension(:), allocatable :: & @@ -463,7 +465,8 @@ subroutine energy_conservation(domain, err) real(kind=RKIND), dimension(:,:), pointer :: & - activeTracersSurfaceFluxRunoff + activeTracersSurfaceFluxRunoff, & + activeTracersSurfaceFluxSubglacialRunoff type (MPAS_timeInterval_type) :: & timeStepESMF @@ -480,7 +483,7 @@ subroutine energy_conservation(domain, err) ierr integer, parameter :: & - nSums = 19 + nSums = 20 character(len=160) :: & m @@ -513,6 +516,7 @@ subroutine energy_conservation(domain, err) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) + call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) !------------------------------------------------------------- @@ -556,6 +560,7 @@ subroutine energy_conservation(domain, err) call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_temperatureSurfaceFlux', index_temperature_flux) call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxRunoff', activeTracersSurfaceFluxRunoff) + call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassNew, 2) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassOld, 1) @@ -581,6 +586,11 @@ subroutine energy_conservation(domain, err) sumArray(14) = sumArray(14) + areaCell(iCell) * activeTracersSurfaceFluxRunoff(index_temperature_flux,iCell) sumArray(15) = sumArray(15) + areaCell(iCell) * icebergTemperatureFlux(iCell) + ! subglacial river runoff temperature flux + if (trim(config_subglacial_runoff_mode) == 'data') then + sumArray(20) = sumArray(20) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) + end if + enddo ! iCell if (config_use_frazil_ice_formation) then @@ -634,6 +644,9 @@ subroutine energy_conservation(domain, err) accumulatedLandIceHeatFlux = accumulatedLandIceHeatFlux + sumArrayOut(17) accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux + sumArrayOut(18) accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux + sumArrayOut(19) + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux + sumArrayOut(20) + end if ! cleanup deallocate(sumArray) @@ -663,6 +676,9 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux = accumulatedEvapTemperatureFlux /accumulatedFluxCounter accumulatedSeaIceTemperatureFlux = accumulatedSeaIceTemperatureFlux /accumulatedFluxCounter accumulatedRiverRunoffTemperatureFlux = accumulatedRiverRunoffTemperatureFlux /accumulatedFluxCounter + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux /accumulatedFluxCounter + end if accumulatedIcebergTemperatureFlux = accumulatedIcebergTemperatureFlux /accumulatedFluxCounter accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux /accumulatedFluxCounter @@ -699,6 +715,9 @@ subroutine energy_conservation(domain, err) + accumulatedRiverRunoffTemperatureFlux *rho_sw*cp_sw & + accumulatedIcebergTemperatureFlux*rho_sw*cp_sw ! note, accumulatedLandIceFrazilHeatFlux not added because already in accumulatedFrazilHeatFlux + if (trim(config_subglacial_runoff_mode) == 'data') then + netEnergyFlux = netEnergyFlux + accumulatedSubglacialRunoffTemperatureFlux * rho_sw*cp_sw + end if ! compute the final energy error call MPAS_pool_get_array(conservationCheckEnergyAMPool, "absoluteEnergyError", absoluteEnergyError) @@ -760,6 +779,9 @@ subroutine energy_conservation(domain, err) v=accumulatedEvapTemperatureFlux *rho_sw*cp_sw; write(m,"('EvapTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw; write(m,"('SeaIceTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v +if (trim(config_subglacial_runoff_mode) == 'data') then + v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('SubglacialRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v +end if v=accumulatedIcebergTemperatureFlux*rho_sw*cp_sw; write(m,"('IcebergTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v write(m,"('SUM IMPLICIT HEAT FLUXES ',es16.8,' hh20temp ',f16.8,es16.8)") s, s/A; call mpas_log_write(m) s = s + explicitHeatFluxSum @@ -828,6 +850,7 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & + accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & accumulatedRemovedIceRunoffFlux, & @@ -852,6 +875,7 @@ subroutine mass_conservation(domain, err) evaporationFlux, & seaIceFreshwaterFlux, & riverRunoffFlux, & + subglacialRunoffFlux, & iceRunoffFlux, & removedRiverRunoffFlux, & removedIceRunoffFlux, & @@ -877,7 +901,7 @@ subroutine mass_conservation(domain, err) iCell, ierr, k integer, parameter :: & - nSums = 12 + nSums = 13 integer, dimension(:), pointer :: minLevelCell, maxLevelCell @@ -900,6 +924,7 @@ subroutine mass_conservation(domain, err) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) @@ -937,6 +962,7 @@ subroutine mass_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'evaporationFlux', evaporationFlux) call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) + call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedRiverRunoffFlux', removedRiverRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedIceRunoffFlux', removedIceRunoffFlux) @@ -956,6 +982,9 @@ subroutine mass_conservation(domain, err) sumArray( 7) = sumArray( 7) + areaCell(iCell) * removedRiverRunoffFlux(iCell) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) / areaCell(iCell) * rho_sw + end if enddo if (config_use_frazil_ice_formation) then @@ -1002,6 +1031,9 @@ subroutine mass_conservation(domain, err) accumulatedFrazilFlux = accumulatedFrazilFlux + sumArrayOut(10) accumulatedLandIceFlux = accumulatedLandIceFlux + sumArrayOut(11) accumulatedLandIceFrazilFlux = accumulatedLandIceFrazilFlux + sumArrayOut(12) + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux + sumArrayOut(13) + end if ! cleanup deallocate(sumArray) @@ -1021,6 +1053,9 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux = accumulatedEvaporationFlux /accumulatedFluxCounter accumulatedSeaIceFlux = accumulatedSeaIceFlux /accumulatedFluxCounter accumulatedRiverRunoffFlux = accumulatedRiverRunoffFlux /accumulatedFluxCounter + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux /accumulatedFluxCounter + end if accumulatedIceRunoffFlux = accumulatedIceRunoffFlux /accumulatedFluxCounter accumulatedRemovedRiverRunoffFlux = accumulatedRemovedRiverRunoffFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffFlux = accumulatedRemovedIceRunoffFlux /accumulatedFluxCounter @@ -1054,6 +1089,9 @@ subroutine mass_conservation(domain, err) + accumulatedFrazilFlux & + accumulatedLandIceFlux ! note, accumulatedLandIceFrazilFlux not added because already in accumulatedFrazilFlux + if (trim(config_subglacial_runoff_mode) == 'data') then + netMassFlux = netMassFlux + accumulatedSubglacialRunoffFlux + end if ! compute the final mass error call MPAS_pool_get_array(conservationCheckMassAMPool, "absoluteMassError", absoluteMassError) @@ -1083,6 +1121,10 @@ subroutine mass_conservation(domain, err) v=accumulatedIcebergFlux ; write(m,"('icebergFreshwaterFlux ',es16.8,' x2o_Fioi_bergw wberg ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedEvaporationFlux ; write(m,"('evaporationFlux ',es16.8,' x2o_Foxx_evap wevap ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffFlux ; write(m,"('riverRunoffFlux ',es16.8,' x2o_Foxx_rofl wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v +if (trim(config_subglacial_runoff_mode) == 'data') then + v=accumulatedSubglacialRunoffFlux ; write(m,"('subglacialRunoffFlux ',es16.8,' x2o_Foxx_rofl wsgr ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v +end if + if (landIceFreshwaterFluxesOn) then v=accumulatedRemovedRiverRunoffFlux; write(m,"('removedRiverRunoffFlux ',es16.8,' wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); v=accumulatedRiverRunoffFlux+accumulatedRemovedRiverRunoffFlux; @@ -1150,7 +1192,8 @@ subroutine salt_conservation(domain, err) conservationCheckSaltAMPool, & meshPool, & statePool, & - forcingPool + forcingPool, & + tracersSurfaceFluxPool real(kind=RKIND), pointer :: & initialSalt, & @@ -1160,9 +1203,13 @@ subroutine salt_conservation(domain, err) absoluteSaltError, & relativeSaltError + real(kind=RKIND), dimension(:,:), pointer :: & + activeTracersSurfaceFluxSubglacialRunoff + real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux + accumulatedFrazilSalinityFlux, & + accumulatedSubglacialRunoffSalinityFlux ! accumulatedLandIceFrazilSalinityFlux is not present because it is always 0 real(kind=RKIND), dimension(:), allocatable :: & @@ -1184,14 +1231,15 @@ subroutine salt_conservation(domain, err) dt, dtAvg, v, A, s, c integer, pointer :: & - nCellsSolve + nCellsSolve, & + index_salinity_flux integer :: & iCell, & ierr integer, parameter :: & - nSums = 3 + nSums = 4 logical, pointer :: & activeTracersBulkRestoringPKG @@ -1209,6 +1257,7 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) !------------------------------------------------------------- ! Net salt flux to ice @@ -1234,12 +1283,23 @@ subroutine salt_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityOld, 1) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityNew, 2) + call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) + call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) + call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_salinitySurfaceFlux', index_salinity_flux) + + do iCell = 1, nCellsSolve ! salt flux to ocean sumArray(1) = sumArray(1) + areaCell(iCell) * seaIceSalinityFlux(iCell) enddo ! iCell + ! subglacial runoff + if (trim(config_subglacial_runoff_mode) == 'data') then + do iCell = 1, nCellsSolve + sumArray(4) = sumArray(4) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) + enddo ! iCell + end if if (config_use_frazil_ice_formation) then do iCell = 1, nCellsSolve @@ -1265,6 +1325,9 @@ subroutine salt_conservation(domain, err) ! accumulate fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux + sumArrayOut(1) accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux + sumArrayOut(2) + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux + sumArrayOut(4) + end if ! cleanup deallocate(sumArray) @@ -1281,6 +1344,9 @@ subroutine salt_conservation(domain, err) ! Average the fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux /accumulatedFluxCounter accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux /accumulatedFluxCounter + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux /accumulatedFluxCounter + end if ! get initial salt content call MPAS_pool_get_array(conservationCheckSaltAMPool, "initialSalt", initialSalt) @@ -1299,6 +1365,10 @@ subroutine salt_conservation(domain, err) netSaltFlux = accumulatedSeaIceSalinityFlux & + accumulatedFrazilSalinityFlux + if (trim(config_subglacial_runoff_mode) == 'data') then + netSaltFlux = netSaltFlux + accumulatedSubglacialRunoffSalinityFlux + end if + ! compute the final salt error call MPAS_pool_get_array(conservationCheckSaltAMPool, "absoluteSaltError", absoluteSaltError) call MPAS_pool_get_array(conservationCheckSaltAMPool, "relativeSaltError", relativeSaltError) @@ -1327,6 +1397,10 @@ subroutine salt_conservation(domain, err) .and.config_frazil_under_land_ice) then v=0; write(m,"('LandIceFrazilSalinityFlux',es16.8,' (already in wmelt, do not sum) ',f16.8)") v,v*c; call mpas_log_write(m); !no sum: s=s+v end if +if (trim(config_subglacial_runoff_mode) == 'data') then + v=accumulatedSubglacialRunoffSalinityFlux ; write(m,"('SubglacialRunoffSalinityFlux ',es16.8,' x2o_Fioi_salt salt ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v +end if + write(m,"('SUM VOLUME FLUXES ',es16.8,' ',f16.8,es16.8)") s, s*c; call mpas_log_write(m) call mpas_log_write(' ') @@ -2232,6 +2306,7 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & + accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), pointer :: & @@ -2240,6 +2315,7 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & + accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & accumulatedRemovedIceRunoffFlux, & @@ -2250,7 +2326,8 @@ subroutine reset_accumulated_variables(domain) real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux + accumulatedFrazilSalinityFlux, & + accumulatedSubglacialRunoffSalinityFlux real(kind=RKIND), pointer :: & accumulatedCarbonSourceSink, & @@ -2280,6 +2357,7 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) + call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) accumulatedFluxCounter = 0 @@ -2298,6 +2376,9 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux = 0.0_RKIND accumulatedSeaIceTemperatureFlux = 0.0_RKIND accumulatedRiverRunoffTemperatureFlux = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffTemperatureFlux = 0.0_RKIND + end if accumulatedIcebergTemperatureFlux = 0.0_RKIND accumulatedLandIceFrazilHeatFlux = 0.0_RKIND accumulatedRemovedIceRunoffHeatFlux = 0.0_RKIND @@ -2310,6 +2391,7 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) @@ -2323,6 +2405,9 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux = 0.0_RKIND accumulatedSeaIceFlux = 0.0_RKIND accumulatedRiverRunoffFlux = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffFlux = 0.0_RKIND + end if accumulatedIceRunoffFlux = 0.0_RKIND accumulatedRemovedRiverRunoffFlux = 0.0_RKIND accumulatedRemovedIceRunoffFlux = 0.0_RKIND @@ -2336,9 +2421,13 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) accumulatedSeaIceSalinityFlux = 0.0_RKIND accumulatedFrazilSalinityFlux = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffSalinityFlux = 0.0_RKIND + end if call MPAS_pool_get_subpool(domain % blocklist % structs, "conservationCheckCarbonAM", conservationCheckCarbonAMPool) From 26720b56bd801322af5b5cb92bc9f2e491be035a Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 10 Jul 2024 15:45:14 -0600 Subject: [PATCH 051/197] update dsgr files --- components/mpas-ocean/cime_config/buildnml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 4d5029555af..6ac2b043aaf 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -143,7 +143,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.oQU240wLI.20240221.nc' if ocn_sgr == 'data': - data_sgr_file = 'oQU240wLI_DSGR.nc' + data_sgr_file = 'DSGR.MALI.out2055.oQU240wLI.20240328.nc' elif ocn_grid == 'oQU120': decomp_date = '230424' @@ -282,7 +282,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.SOwISC12to60E2r4.20210114.nc' if ocn_sgr == 'data': - data_sgr_file = 'SOwISC12to60E2r4_DSGR.nc' + data_sgr_file = 'DSGR.MALI.out2055.SOwISC12to60E2r4.20240328.nc' elif ocn_grid == 'FRISwISC08to60E3r1': decomp_date = '20230913' # changed to date of partiotions in ../files_for_e3sm/assembled_files/inputdata/ocn/mpas-o/FRISwISC08to60E3r1/partitions @@ -359,7 +359,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.ECwISC30to60E2r1.20240221.nc' if ocn_sgr == 'data': - data_sgr_file = 'ECwISC30to60E2r1_DSGR.nc' + data_sgr_file = 'DSGR.MALI.out2055.ECwISC30to60E2r1.20240328.nc' elif ocn_grid == 'IcoswISC30E3r5': decomp_date = '20231120' @@ -380,7 +380,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' if ocn_sgr == 'data': - data_sgr_file = 'IcoswISC30E3r5_DSGR.nc' + data_sgr_file = 'DSGR.MALI.out2055.IcoswISC30E3r5.20240328.nc.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' From 21a593e20d77166c25ea6b09ec02d0789c9139e7 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 10 Jul 2024 15:51:33 -0600 Subject: [PATCH 052/197] remove redundant compsets --- .../cime_config/config_compsets.xml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/components/mpas-ocean/cime_config/config_compsets.xml b/components/mpas-ocean/cime_config/config_compsets.xml index 6950fd8c217..be36f010347 100644 --- a/components/mpas-ocean/cime_config/config_compsets.xml +++ b/components/mpas-ocean/cime_config/config_compsets.xml @@ -42,11 +42,6 @@ 2000_DATM%NYF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV - - GMPAS-NYF-DSGR - 2000_DATM%NYF_SLND_MPASSI_MPASO%DATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV - - GMPAS-NYF-DISMF 2000_DATM%NYF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%NYFAIS45_SGLC_SWAV @@ -103,8 +98,8 @@ - GMPAS-JRA1p5-DSGR - 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%DATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + GMPAS-JRA1p5-DIB-PISMF-DSGR-TMIX + 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDDSGRTMIX_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV @@ -117,11 +112,6 @@ 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDTMIX_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV - - GMPAS-JRA1p5-DIB-DISMF-DSGR - 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBDISMFDATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV - - GMPAS-JRA1p4 2000_DATM%JRA-1p4-2018_SLND_MPASSI_MPASO%DATMFORCED_DROF%JRA-1p4-2018_SGLC_SWAV @@ -157,11 +147,6 @@ 2000_DATM%IAF_SLND_MPASSI_MPASO%PISMFDATMFORCED_DROF%IAFAIS45_SGLC_SWAV - - GMPAS-IAF-PISMF-DSGR - 2000_DATM%IAF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%IAFAIS45_SGLC_SWAV - - GMPAS-IAF-DISMF 2000_DATM%IAF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%IAFAIS45_SGLC_SWAV From fe4380c621bd7c5ea21c6fe15337c56ed9572c0a Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 10 Jul 2024 16:25:01 -0600 Subject: [PATCH 053/197] fix typo in dsgr filename --- components/mpas-ocean/cime_config/buildnml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 6ac2b043aaf..192fd70bc6a 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -380,7 +380,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.IcoswISC30E3r5.20240328.nc.nc' + data_sgr_file = 'DSGR.MALI.out2055.IcoswISC30E3r5.20240328.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' From 8f147f9101c196801cfcb0663cce9df37cee0043 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 11 Jul 2024 10:44:22 -0600 Subject: [PATCH 054/197] fix omp and acc added loops --- .../src/shared/mpas_ocn_diagnostics.F | 17 ++++++++++--- .../shared/mpas_ocn_surface_bulk_forcing.F | 22 +++++++++++++---- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 24 +++++++++++++++++-- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index daf9bfcab6d..7dc43284a75 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -1893,8 +1893,7 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & #ifdef MPAS_OPENACC !$acc parallel loop & !$acc present(surfaceFluxAttenuationCoefficient, & - !$acc surfaceFluxAttenuationCoefficientRunoff, & - !$acc surfaceFluxAttenuationCoefficientSubglacialRunoff) + !$acc surfaceFluxAttenuationCoefficientRunoff) #else !$omp parallel !$omp do schedule(runtime) @@ -1905,16 +1904,28 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & surfaceFluxAttenuationCoefficientRunoff(iCell) = & config_flux_attenuation_coefficient_runoff end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + if (trim(config_subglacial_runoff_mode) == 'data') then +#ifdef MPAS_OPENACC + !$acc parallel loop & + !$acc present(surfaceFluxAttenuationCoefficientSubglacialRunoff) +#else + !$omp parallel + !$omp do schedule(runtime) +#endif do iCell = 1, nCells surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell) = & config_flux_attenuation_coefficient_subglacial_runoff end do - end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel #endif + end if !-------------------------------------------------------------------- diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 0547f73319d..4375ae8f9ea 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -336,13 +336,13 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur ! Build surface fluxes at cell centers #ifdef MPAS_OPENACC !$acc enter data copyin(evaporationFlux, snowFlux, seaIceFreshWaterFlux, icebergFreshWaterFlux, & - !$acc riverRunoffFlux, subglacialRunoffFlux, iceRunoffFlux, rainFlux) + !$acc riverRunoffFlux, iceRunoffFlux, rainFlux) !$acc parallel loop & !$acc present(surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - !$acc surfaceThicknessFluxSubglacialRunoff, evaporationFlux, snowFlux, & + !$acc evaporationFlux, snowFlux, & !$acc seaIceFreshWaterFlux, icebergFreshWaterFlux, riverRunoffFlux, & - !$acc subglacialRunoffFlux, iceRunoffFlux, rainFlux) + !$acc iceRunoffFlux, rainFlux) #else !$omp parallel !$omp do schedule(runtime) @@ -352,15 +352,29 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + if (trim(config_subglacial_runoff_mode) == 'data') then +#ifdef MPAS_OPENACC + !$acc enter data copyin(subglacialRunoffFlux) + + !$acc parallel loop & + !$acc present(surfaceThicknessFluxSubglacialRunoff, subglacialRunoffFlux, areaCell) +#else + !$omp parallel + !$omp do schedule(runtime) +#endif do iCell = 1, nCells surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) end do - end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel #endif + end if #ifdef MPAS_OPENACC !$acc exit data delete(evaporationFlux, snowFlux, seaIceFreshWaterFlux, icebergFreshWaterFlux, & diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index 30584386666..727b55f4e5b 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -190,15 +190,29 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ tendThick(k, iCell) = 0.0_RKIND end do end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + if (trim(config_subglacial_runoff_mode) == 'data') then +#ifdef MPAS_OPENACC + !$acc enter data create(surfaceThicknessFluxSubglacialRunoff) + + !$acc parallel loop & + !$acc present(surfaceThicknessFluxSubglacialRunoff) +#else + !$omp parallel + !$omp do schedule(runtime) +#endif do iCell = 1, nCellsAll surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND end do - end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel #endif + end if ! If turned off, return with zero fluxes, tendencies ! Otherwise, start time and call routines to accumulate @@ -847,14 +861,20 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & tracerGroupSurfaceFluxRunoff (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRemoved(n,iCell) = 0.0_RKIND end do + end do + !$omp end do + !$omp end parallel + if (trim(config_subglacial_runoff_mode) == 'data') then + !$omp do schedule(runtime) private(n) + do iCell = 1, nCellsAll do n=1,nTracersGroup tracerGroupSurfaceFluxSubglacialRunoff (n,iCell) = 0.0_RKIND end do - end if end do !$omp end do !$omp end parallel + end if ! ! compute surface tracer flux from bulk forcing From 43c3190dd1f0ee672f5e7aba701a914fa452b323 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 11 Jul 2024 11:14:30 -0600 Subject: [PATCH 055/197] fix omp in tendency --- components/mpas-ocean/src/shared/mpas_ocn_tendency.F | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index 727b55f4e5b..c6d9e72f83a 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -172,12 +172,10 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ ! initialize to zero and start accumulating tendency terms ! #ifdef MPAS_OPENACC - !$acc enter data create(tendThick, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - !$acc surfaceThicknessFluxSubglacialRunoff) + !$acc enter data create(tendThick, surfaceThicknessFlux, surfaceThicknessFluxRunoff) !$acc parallel loop & - !$acc present(tendThick, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - !$acc surfaceThicknessFluxSubglacialRunoff) & + !$acc present(tendThick, surfaceThicknessFlux, surfaceThicknessFluxRunoff) & !$acc private(k) #else !$omp parallel @@ -866,6 +864,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & !$omp end parallel if (trim(config_subglacial_runoff_mode) == 'data') then + !$omp parallel !$omp do schedule(runtime) private(n) do iCell = 1, nCellsAll do n=1,nTracersGroup From 89c14b8540fcf1916d92356738361f00fd010950 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 11 Jul 2024 11:42:50 -0600 Subject: [PATCH 056/197] add sgr fail if bad string option --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 2 ++ components/mpas-ocean/src/shared/mpas_ocn_forcing.F | 2 ++ 2 files changed, 4 insertions(+) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 7dc43284a75..3e7f432a415 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3530,6 +3530,8 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & end if zTop = zBot end do + else + call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if else fracAbsorbedSubglacialRunoff = 0.0_RKIND diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index 5cfce4c4e69..afdacc6c942 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -221,6 +221,8 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin transmissionCoeffTop = transmissionCoeffBot end do end do + else + call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if end if From 7491a836e534a13d4ef1d59ae98b6f36b4f92870 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 11 Jul 2024 12:12:34 -0600 Subject: [PATCH 057/197] add line --- components/mpas-ocean/src/Registry.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 79ef88b3318..01e96c635c1 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3740,6 +3740,7 @@ description="Divergence of transmission through interfaces of surface fluxes below the surface layer at cell centers. These are applied only to subglacial runoff." packages="dataSubglacialRunoffFluxPKG" /> + Date: Fri, 12 Jul 2024 10:11:39 -0600 Subject: [PATCH 058/197] Update components/mpas-ocean/src/Registry.xml description Co-authored-by: Carolyn Begeman --- components/mpas-ocean/src/Registry.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 01e96c635c1..8dbd4870dc6 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -707,7 +707,7 @@ possible_values="'off', 'data'" /> Date: Tue, 16 Jul 2024 09:36:47 -0600 Subject: [PATCH 059/197] rename config_sgr_salinity to config_sgr_salinity_prescribed --- components/mpas-ocean/bld/build-namelist | 4 ++-- components/mpas-ocean/bld/build-namelist-section | 4 ++-- .../bld/namelist_files/namelist_defaults_mpaso.xml | 4 ++-- .../bld/namelist_files/namelist_definition_mpaso.xml | 4 ++-- components/mpas-ocean/src/Registry.xml | 8 ++++---- .../mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 2c5ee97b0df..f891c5d089a 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -713,8 +713,8 @@ add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); add_default($nl, 'config_use_sgr_opt_temp'); add_default($nl, 'config_use_sgr_opt_salt'); -add_default($nl, 'config_sgr_temperature'); -add_default($nl, 'config_sgr_salinity'); +add_default($nl, 'config_sgr_temperature_prescribed'); +add_default($nl, 'config_sgr_salinity_prescribed'); if ($OCN_SGR eq 'data') { add_default($nl, 'config_subglacial_runoff_mode', 'val'=>"data"); } else { diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 3f2d4ab4839..9091c1e961c 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -229,8 +229,8 @@ add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); add_default($nl, 'config_use_sgr_opt_temp'); add_default($nl, 'config_use_sgr_opt_salt'); -add_default($nl, 'config_sgr_temperature'); -add_default($nl, 'config_sgr_salinity'); +add_default($nl, 'config_sgr_temperature_prescribed'); +add_default($nl, 'config_sgr_salinity_prescribed'); add_default($nl, 'config_subglacial_runoff_mode'); ############################ diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 0514704b951..4957f2ce60f 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -347,8 +347,8 @@ 1 'sgr' 'sgr' -0.0 -0.0 +0.0 +0.0 'off' diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 43ba139ab65..725308006f5 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1228,7 +1228,7 @@ Valid values: 'sgr', 'prescribed'. Default: Defined in namelist_defaults.xml - Option to choose sgr temperature, applied when config_use_sgr_opt_temp = 'prescribed' @@ -1236,7 +1236,7 @@ Valid values: Any real number. Default: Defined in namelist_defaults.xml - Option to choose sgr salinity, applied when config_use_sgr_opt_temp = 'prescribed' diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 8dbd4870dc6..07afdb0f9af 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -720,17 +720,17 @@ /> - - diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 4375ae8f9ea..1c7cba2f39c 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -600,7 +600,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer if ( trim(config_use_sgr_opt_temp) == 'prescribed' ) then !sgr with fixed prescribed temperature (for debugging only) tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_temperature / areaCell(iCell) + config_sgr_temperature_prescribed / areaCell(iCell) else if ( trim(config_use_sgr_opt_temp) == 'sgr' ) then !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & @@ -611,7 +611,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer if ( trim(config_use_sgr_opt_salt) == 'prescribed' ) then !sgr with fixed prescribed temperature (for debugging only) tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_salinity / areaCell(iCell) + config_sgr_salinity_prescribed / areaCell(iCell) else if ( trim(config_use_sgr_opt_salt) == 'sgr' ) then !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND From 307b4d0e3f5abe341fada74494c86a4d2e1a232a Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 16 Jul 2024 10:51:53 -0600 Subject: [PATCH 060/197] change config_use_sgr_opt_property from character to logical --- components/mpas-ocean/bld/build-namelist | 4 ++-- components/mpas-ocean/bld/build-namelist-section | 4 ++-- .../namelist_files/namelist_defaults_mpaso.xml | 4 ++-- .../namelist_files/namelist_definition_mpaso.xml | 16 ++++++++-------- components/mpas-ocean/src/Registry.xml | 16 ++++++++-------- .../src/shared/mpas_ocn_surface_bulk_forcing.F | 12 ++++++------ 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index f891c5d089a..490100040c0 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -711,8 +711,8 @@ add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); -add_default($nl, 'config_use_sgr_opt_temp'); -add_default($nl, 'config_use_sgr_opt_salt'); +add_default($nl, 'config_use_sgr_opt_temp_prescribed'); +add_default($nl, 'config_use_sgr_opt_salt_prescribed'); add_default($nl, 'config_sgr_temperature_prescribed'); add_default($nl, 'config_sgr_salinity_prescribed'); if ($OCN_SGR eq 'data') { diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 9091c1e961c..189d32fc7b5 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -227,8 +227,8 @@ add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); -add_default($nl, 'config_use_sgr_opt_temp'); -add_default($nl, 'config_use_sgr_opt_salt'); +add_default($nl, 'config_use_sgr_opt_temp_prescribed'); +add_default($nl, 'config_use_sgr_opt_salt_prescribed'); add_default($nl, 'config_sgr_temperature_prescribed'); add_default($nl, 'config_sgr_salinity_prescribed'); add_default($nl, 'config_subglacial_runoff_mode'); diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 4957f2ce60f..3147d1cc92d 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -345,8 +345,8 @@ 0.001 'uniform' 1 -'sgr' -'sgr' +.false. +.false. 0.0 0.0 'off' diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 725308006f5..803b280a124 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1212,25 +1212,25 @@ Valid values: 0 - don't use, 1 - use Default: Defined in namelist_defaults.xml - -Option to choose sgr temperature +If true, subglacial runoff temperature is set to config_sgr_temperature_prescribed. If false, the temperature is set to local freezing point. -Valid values: 'sgr', 'prescribed'. +Valid values: .true. or .false. Default: Defined in namelist_defaults.xml - -Option to choose sgr salinity +If true, subglacial runoff salinity is set to config_sgr_salinity_prescribed. If false, the salinity is set to 0 PSU. -Valid values: 'sgr', 'prescribed'. +Valid values: .true. or .false. Default: Defined in namelist_defaults.xml -Option to choose sgr temperature, applied when config_use_sgr_opt_temp = 'prescribed' +Prescribed subglacial runoff temperature value, applied when config_use_sgr_opt_temp_prescribed = .true. Valid values: Any real number. Default: Defined in namelist_defaults.xml @@ -1238,7 +1238,7 @@ Default: Defined in namelist_defaults.xml -Option to choose sgr salinity, applied when config_use_sgr_opt_temp = 'prescribed' +Prescribed subglacial runoff salinity value, applied when config_use_sgr_opt_salt_prescribed = .true. Valid values: Any real number. Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 07afdb0f9af..3fdfd58ca61 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -718,20 +718,20 @@ description="option to use or not subglacial runoff (sgr) in kpp calculation" possible_values="0 - don't use, 1 - use" /> - - diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 1c7cba2f39c..ce019053fc7 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -597,22 +597,22 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw if (trim(config_subglacial_runoff_mode) == 'data') then - if ( trim(config_use_sgr_opt_temp) == 'prescribed' ) then - !sgr with fixed prescribed temperature (for debugging only) + if ( config_use_sgr_opt_temp_prescribed ) then + !sgr with fixed prescribed temperature tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & config_sgr_temperature_prescribed / areaCell(iCell) - else if ( trim(config_use_sgr_opt_temp) == 'sgr' ) then + else !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & inLandIceCavity=.true.) / areaCell(iCell) end if - if ( trim(config_use_sgr_opt_salt) == 'prescribed' ) then - !sgr with fixed prescribed temperature (for debugging only) + if ( config_use_sgr_opt_salt_prescribed ) then + !sgr with fixed prescribed temperature tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & config_sgr_salinity_prescribed / areaCell(iCell) - else if ( trim(config_use_sgr_opt_salt) == 'sgr' ) then + else !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND end if From f6cbc38e7ef811504d6b90bd45d813d00659aea6 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 16 Jul 2024 11:01:42 -0600 Subject: [PATCH 061/197] change config_use_sgr_opt_kpp to logical variable --- .../bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- .../bld/namelist_files/namelist_definition_mpaso.xml | 6 +++--- components/mpas-ocean/src/Registry.xml | 10 +++++----- .../mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 3147d1cc92d..dce88f0127e 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -344,7 +344,7 @@ 10.0 0.001 'uniform' -1 +.true. .false. .false. 0.0 diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 803b280a124..fed7828e6a8 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1204,11 +1204,11 @@ Valid values: 'top','uniform', 'bottom'. Default: Defined in namelist_defaults.xml - -Option to use or not subglacial runoff (sgr) in kpp calculation. +If true, include subglacial runoff (sgr) contribution in kpp calculation. -Valid values: 0 - don't use, 1 - use +Valid values: .true. or .false. Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 3fdfd58ca61..3e339aefe1a 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -714,16 +714,16 @@ description="Selects the vertical location where subglacial runoff is fluxed." possible_values="'top','uniform', 'bottom'" /> - Date: Tue, 16 Jul 2024 11:18:15 -0600 Subject: [PATCH 062/197] Move checking for valid string in config_sgr_flux_vertical_location to an init routine --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 9 +++++++-- components/mpas-ocean/src/shared/mpas_ocn_forcing.F | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 368e4e9a50d..a6539f520f1 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3530,8 +3530,6 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & end if zTop = zBot end do - else - call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if else fracAbsorbedSubglacialRunoff = 0.0_RKIND @@ -4695,6 +4693,13 @@ subroutine ocn_diagnostics_init(domain, err)!{{{ call ocn_diagnostics_variables_init(domain, jenkinsOn, & hollandJenkinsOn, err) + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + else + call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) + end if + end subroutine ocn_diagnostics_init!}}} !*********************************************************************** diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index afdacc6c942..5cfce4c4e69 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -221,8 +221,6 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin transmissionCoeffTop = transmissionCoeffBot end do end do - else - call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if end if From c1616ddef28349131adedd98741dccc2a19d1b0f Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 16 Jul 2024 11:31:26 -0600 Subject: [PATCH 063/197] set config_sgr_flux_vertical_location to bottom in namelist_defaults_mpaso.xml for consistency with Registry --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index dce88f0127e..c57920e5c38 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -343,7 +343,7 @@ 0.001 10.0 0.001 -'uniform' +'bottom' .true. .false. .false. From b45249581205070d1f39e2400cc574907a4ab6d8 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 16 Jul 2024 12:35:25 -0600 Subject: [PATCH 064/197] Change subglacialRunoffFlux into mass flux from volume flux for consistency with riverRunoffFlux and reference density, update DSGR files --- components/mpas-ocean/cime_config/buildnml | 8 ++++---- components/mpas-ocean/src/Registry.xml | 2 +- .../src/shared/mpas_ocn_surface_bulk_forcing.F | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 192fd70bc6a..f3eb2288168 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -143,7 +143,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.oQU240wLI.20240221.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.oQU240wLI.20240328.nc' + data_sgr_file = 'DSGR.massFlux.MALI.out2055.oQU240wLI.20240328.nc' elif ocn_grid == 'oQU120': decomp_date = '230424' @@ -282,7 +282,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.SOwISC12to60E2r4.20210114.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.SOwISC12to60E2r4.20240328.nc' + data_sgr_file = 'DSGR.massFlux.MALI.out2055.SOwISC12to60E2r4.20240328.nc' elif ocn_grid == 'FRISwISC08to60E3r1': decomp_date = '20230913' # changed to date of partiotions in ../files_for_e3sm/assembled_files/inputdata/ocn/mpas-o/FRISwISC08to60E3r1/partitions @@ -359,7 +359,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.ECwISC30to60E2r1.20240221.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.ECwISC30to60E2r1.20240328.nc' + data_sgr_file = 'DSGR.massFlux.MALI.out2055.ECwISC30to60E2r1.20240328.nc' elif ocn_grid == 'IcoswISC30E3r5': decomp_date = '20231120' @@ -380,7 +380,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.IcoswISC30E3r5.20240328.nc' + data_sgr_file = 'DSGR.massFlux.massFlux.MALI.out2055.IcoswISC30E3r5.20240328.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 3e339aefe1a..bf02edf96b5 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3807,7 +3807,7 @@ description="Fresh water flux from river runoff at cell centers from coupler. Positive into the ocean." packages="thicknessBulkPKG" /> - diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index ce019053fc7..2cf79881a7f 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -362,13 +362,13 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur !$acc enter data copyin(subglacialRunoffFlux) !$acc parallel loop & - !$acc present(surfaceThicknessFluxSubglacialRunoff, subglacialRunoffFlux, areaCell) + !$acc present(surfaceThicknessFluxSubglacialRunoff, subglacialRunoffFlux) #else !$omp parallel !$omp do schedule(runtime) #endif do iCell = 1, nCells - surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) + surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / rho_sw end do #ifndef MPAS_OPENACC !$omp end do @@ -600,18 +600,18 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer if ( config_use_sgr_opt_temp_prescribed ) then !sgr with fixed prescribed temperature tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_temperature_prescribed / areaCell(iCell) + config_sgr_temperature_prescribed / rho_sw else !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & - inLandIceCavity=.true.) / areaCell(iCell) + inLandIceCavity=.true.) / rho_sw end if if ( config_use_sgr_opt_salt_prescribed ) then !sgr with fixed prescribed temperature tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_salinity_prescribed / areaCell(iCell) + config_sgr_salinity_prescribed / rho_sw else !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND From 3b0dca4de256cc4c14c0b907a8371e7074d6aa48 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 17 Jul 2024 10:53:17 -0600 Subject: [PATCH 065/197] introduce separate subroutine ocn_diagnostic_solve_surfaceLayer_subglacialRunoff --- .../src/shared/mpas_ocn_diagnostics.F | 88 ++++++++++++++----- 1 file changed, 68 insertions(+), 20 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index a6539f520f1..82fe1d9a950 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -452,13 +452,16 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe ! ! inputs: layerThickness, activeTracers, layerThicknessEdgeFlux, normalVelocity ! outputs: tracersSurfaceLayerValue, indexSurfaceLayerDepth, normalVelocitySurfaceLayer, - ! surfaceFluxAttenuationCoefficient, surfaceFluxAttenuationCoefficientRunoff, - ! surfaceFluxAttenuationCoefficientSubglacialRunoff + ! surfaceFluxAttenuationCoefficient, surfaceFluxAttenuationCoefficientRunoff call ocn_diagnostic_solve_surfaceLayer(layerThickness, activeTracers, & layerThickEdgeFlux, normalVelocity, tracersSurfaceLayerValue, & indexSurfaceLayerDepth, normalVelocitySurfaceLayer, & - sfcFlxAttCoeff, surfaceFluxAttenuationCoefficientRunoff, & - surfaceFluxAttenuationCoefficientSubglacialRunoff) + sfcFlxAttCoeff, surfaceFluxAttenuationCoefficientRunoff) + + if (trim(config_subglacial_runoff_mode) == 'data') then + ! outputs: surfaceFluxAttenuationCoefficientSubglacialRunoff + call ocn_diagnostic_solve_surfaceLayer_subglacialRunoff(surfaceFluxAttenuationCoefficientSubglacialRunoff) + end if end if ! full_compute @@ -565,8 +568,11 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe ! !$acc indexSurfaceLayerDepth, & ! !$acc normalVelocitySurfaceLayer, & ! !$acc sfcFlxAttCoeff, & -! !$acc surfaceFluxAttenuationCoefficientRunoff, & -! !$acc surfaceFluxAttenuationCoefficientSubglacialRunoff) +! !$acc surfaceFluxAttenuationCoefficientRunoff) +! if (trim(config_subglacial_runoff_mode) == 'data') then +! !$acc update host(surfaceFluxAttenuationCoefficientSubglacialRunoff) +! end if + ! end if ! full_compute ! !$acc exit data delete (atmosphericPressure, seaIcePressure) @@ -1701,9 +1707,7 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & activeTracers, layerThicknessEdgeFlux, normalVelocity, & tracersSurfaceLayerValue, indexSurfaceLayerDepth, & normalVelocitySurfaceLayer, & - surfaceFluxAttenuationCoefficient, & - surfaceFluxAttenuationCoefficientRunoff, & - surfaceFluxAttenuationCoefficientSubglacialRunoff)!{{{ + surfaceFluxAttenuationCoefficient)!{{{ !----------------------------------------------------------------- ! input variables @@ -1728,8 +1732,7 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & indexSurfaceLayerDepth, &!< [out] layer index at sfc lyr depth normalVelocitySurfaceLayer, &!< [out] avg velocity over sfc layer surfaceFluxAttenuationCoefficient, &!< [out] sfc flx attenuation - surfaceFluxAttenuationCoefficientRunoff, &!< [out] sfc flx attenuation - surfaceFluxAttenuationCoefficientSubglacialRunoff !< [out] sfc flx attenuation + surfaceFluxAttenuationCoefficientRunoff &!< [out] sfc flx attenuation !----------------------------------------------------------------- ! local variables @@ -1909,27 +1912,72 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & !$omp end parallel #endif - if (trim(config_subglacial_runoff_mode) == 'data') then + !-------------------------------------------------------------------- + + end subroutine ocn_diagnostic_solve_surfaceLayer !}}} + +!*********************************************************************** +! +! routine ocn_diagnostic_solve_surfaceLayer_subglacialRunoff +! +!> \brief Computes diagnostic subglacialRunoff variables for surface layer +!> \author Irena Vankova +!> \date July 2024 +!> \details +! +!----------------------------------------------------------------------- + + subroutine ocn_diagnostic_solve_surfaceLayer_subglacialRunoff(surfaceFluxAttenuationCoefficientSubglacialRunoff)!{{{ + + !----------------------------------------------------------------- + ! input variables + !----------------------------------------------------------------- + + !----------------------------------------------------------------- + ! output variables + !----------------------------------------------------------------- + + real (kind=RKIND), dimension(:), intent(out) :: & + surfaceFluxAttenuationCoefficientSubglacialRunoff !< [out] sfc flx attenuation + + !----------------------------------------------------------------- + ! local variables + !----------------------------------------------------------------- + + integer :: & + nCells, &! num of cells + iCell ! loop indices for cell + + ! End preamble + !----------------------------------------------------------------- + ! Begin code + + ! compute the attenuation coefficient for subglacial runoff surface fluxes + + nCells = nCellsHalo( 1 ) + #ifdef MPAS_OPENACC - !$acc parallel loop & - !$acc present(surfaceFluxAttenuationCoefficientSubglacialRunoff) + !$acc parallel loop & + !$acc present(surfaceFluxAttenuationCoefficientSubglacialRunoff) #else - !$omp parallel - !$omp do schedule(runtime) + !$omp parallel + !$omp do schedule(runtime) #endif - do iCell = 1, nCells + do iCell = 1, nCells surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell) = & config_flux_attenuation_coefficient_subglacial_runoff - end do + end do #ifndef MPAS_OPENACC !$omp end do !$omp end parallel #endif - end if !-------------------------------------------------------------------- - end subroutine ocn_diagnostic_solve_surfaceLayer !}}} + end subroutine ocn_diagnostic_solve_surfaceLayer_subglacialRunoff !}}} + +!*********************************************************************** + !*********************************************************************** ! From 7fa3a50ebc4d682f52d125ac85874da692665676 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 17 Jul 2024 11:14:07 -0600 Subject: [PATCH 066/197] correct extra delete --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 82fe1d9a950..f50d6bb697a 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -1707,7 +1707,8 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & activeTracers, layerThicknessEdgeFlux, normalVelocity, & tracersSurfaceLayerValue, indexSurfaceLayerDepth, & normalVelocitySurfaceLayer, & - surfaceFluxAttenuationCoefficient)!{{{ + surfaceFluxAttenuationCoefficient, & + surfaceFluxAttenuationCoefficientRunoff)!{{{ !----------------------------------------------------------------- ! input variables From 579e3dd8eab64098afb47109bd6175302eba3fc0 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 17 Jul 2024 13:59:02 -0600 Subject: [PATCH 067/197] remove & --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index f50d6bb697a..5046e19d5d5 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -1733,7 +1733,7 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & indexSurfaceLayerDepth, &!< [out] layer index at sfc lyr depth normalVelocitySurfaceLayer, &!< [out] avg velocity over sfc layer surfaceFluxAttenuationCoefficient, &!< [out] sfc flx attenuation - surfaceFluxAttenuationCoefficientRunoff &!< [out] sfc flx attenuation + surfaceFluxAttenuationCoefficientRunoff !< [out] sfc flx attenuation !----------------------------------------------------------------- ! local variables From f78062d1a993acd389681c7f4445e45cc258f4bf Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 17:56:52 -0600 Subject: [PATCH 068/197] make separate subroutines whenever subglacial needs to be in subroutine argument --- .../shared/mpas_ocn_surface_bulk_forcing.F | 79 ++++++++-- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 20 ++- .../src/shared/mpas_ocn_thick_surface_flux.F | 139 ++++++++++++++---- .../mpas_ocn_tracer_surface_flux_to_tend.F | 116 ++++++++++++--- 4 files changed, 291 insertions(+), 63 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 2cf79881a7f..168f8c31e27 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -49,7 +49,8 @@ module ocn_surface_bulk_forcing public :: ocn_surface_bulk_forcing_tracers, & ocn_surface_bulk_forcing_vel, & ocn_surface_bulk_forcing_thick, & - ocn_surface_bulk_forcing_init + ocn_surface_bulk_forcing_init, & + ocn_surface_bulk_forcing_thick_subglacial_runoff !-------------------------------------------------------------------- ! @@ -281,7 +282,7 @@ end subroutine ocn_surface_bulk_forcing_vel!}}} ! !----------------------------------------------------------------------- - subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, surfaceThicknessFluxRunoff, surfaceThicknessFluxSubglacialRunoff, err)!{{{ + subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, surfaceThicknessFluxRunoff, err)!{{{ !----------------------------------------------------------------- ! @@ -292,8 +293,6 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur real (kind=RKIND), dimension(:), intent(inout) :: surfaceThicknessFlux !< Input/Output: Array for surface thickness flux real (kind=RKIND), dimension(:), intent(inout) :: & surfaceThicknessFluxRunoff !< Input/Output: Array for surface thickness flux due to river runoff - real (kind=RKIND), dimension(:), intent(inout) :: & - surfaceThicknessFluxSubglacialRunoff !< Input/Output: Array for surface thickness flux due to subglacial runoff !----------------------------------------------------------------- ! @@ -313,7 +312,6 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur real (kind=RKIND), dimension(:), pointer :: evaporationFlux, snowFlux real (kind=RKIND), dimension(:), pointer :: seaIceFreshWaterFlux, icebergFreshWaterFlux, riverRunoffFlux, iceRunoffFlux - real (kind=RKIND), dimension(:), pointer :: subglacialRunoffFlux real (kind=RKIND), dimension(:), pointer :: rainFlux err = 0 @@ -327,7 +325,6 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshWaterFlux) call mpas_pool_get_array(forcingPool, 'icebergFreshWaterFlux', icebergFreshWaterFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) - call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'rainFlux', rainFlux) @@ -357,7 +354,68 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur !$omp end parallel #endif - if (trim(config_subglacial_runoff_mode) == 'data') then +#ifdef MPAS_OPENACC + !$acc exit data delete(evaporationFlux, snowFlux, seaIceFreshWaterFlux, icebergFreshWaterFlux, & + !$acc riverRunoffFlux, iceRunoffFlux, rainFlux) +#endif + + call mpas_timer_stop("bulk_thick") + + end subroutine ocn_surface_bulk_forcing_thick!}}} + +!*********************************************************************** +! +! routine ocn_surface_bulk_forcing_thick_subglacial_runoff +! +!> \brief Determines the thickness forcing array used for the bulk forcing. +!> \author Doug Jacobsen +!> \date 04/25/12 +!> \details +!> This routine computes the thickness forcing arrays used later in MPAS. +! +!----------------------------------------------------------------------- + + subroutine ocn_surface_bulk_forcing_thick_subglacial_runoff(forcingPool, surfaceThicknessFluxSubglacialRunoff, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information + real (kind=RKIND), dimension(:), intent(inout) :: & + surfaceThicknessFluxSubglacialRunoff !< Input/Output: Array for surface thickness flux due to subglacial runoff + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: Error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell, nCells + + real (kind=RKIND), dimension(:), pointer :: subglacialRunoffFlux + + err = 0 + + if (bulkThicknessFluxOff) return + + call mpas_timer_start("bulk_thick", .false.) + + call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) + + nCells = nCellsHalo( 2 ) + + ! Build surface fluxes at cell centers + #ifdef MPAS_OPENACC !$acc enter data copyin(subglacialRunoffFlux) @@ -374,16 +432,15 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur !$omp end do !$omp end parallel #endif - end if #ifdef MPAS_OPENACC - !$acc exit data delete(evaporationFlux, snowFlux, seaIceFreshWaterFlux, icebergFreshWaterFlux, & - !$acc riverRunoffFlux, subglacialRunoffFlux, iceRunoffFlux, rainFlux) + !$acc exit data delete(subglacialRunoffFlux) #endif call mpas_timer_stop("bulk_thick") - end subroutine ocn_surface_bulk_forcing_thick!}}} + end subroutine ocn_surface_bulk_forcing_thick_subglacial_runoff!}}} + !*********************************************************************** ! diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index c6d9e72f83a..e3f47d1316b 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -220,8 +220,12 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ ! Compute surface mass flux array from bulk forcing call ocn_surface_bulk_forcing_thick(forcingPool, & surfaceThicknessFlux, & - surfaceThicknessFluxRunoff, & + surfaceThicknessFluxRunoff, err) + + if (trim(config_subglacial_runoff_mode) == 'data') then + call ocn_surface_bulk_forcing_thick_subglacial_runoff(forcingPool, & surfaceThicknessFluxSubglacialRunoff, err) + end if ! Compute surface thickness flux from land ice call ocn_surface_land_ice_fluxes_thick(forcingPool, & @@ -242,11 +246,14 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ ! Compute surface flux tendency call ocn_thick_surface_flux_tend(fractionAbsorbed, & fractionAbsorbedRunoff, & - fractionAbsorbedSubglacialRunoff, & surfaceThicknessFlux, & surfaceThicknessFluxRunoff, & + tendThick, err) + if (trim(config_subglacial_runoff_mode) == 'data') then + call ocn_thick_surface_flux_tend(fractionAbsorbedSubglacialRunoff, & surfaceThicknessFluxSubglacialRunoff, & tendThick, err) + end if ! Compute contribution from frazil ice formation call ocn_frazil_forcing_layer_thickness(forcingPool, & @@ -1244,10 +1251,15 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & endif ! compute budgets call ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, & - fractionAbsorbedRunoff, fractionAbsorbedSubglacialRunoff, & + fractionAbsorbedRunoff, & layerThickness, tracerGroupSurfaceFlux, & - tracerGroupSurfaceFluxRunoff, tracerGroupSurfaceFluxSubglacialRunoff, & + tracerGroupSurfaceFluxRunoff, & + tracerGroupTend, err) + if (trim(config_subglacial_runoff_mode) == 'data') then + call ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbedSubglacialRunoff, & + layerThickness, tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupTend, err) + end if ! ! Compute shortwave absorption diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index eb531a99958..8e389a74ba3 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -46,7 +46,8 @@ module ocn_thick_surface_flux !-------------------------------------------------------------------- public :: ocn_thick_surface_flux_tend, & - ocn_thick_surface_flux_init + ocn_thick_surface_flux_init, & + ocn_thick_surface_flux_tend_subglacial_runoff !-------------------------------------------------------------------- ! @@ -74,8 +75,7 @@ module ocn_thick_surface_flux !----------------------------------------------------------------------- subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoefficientsRunoff, & - transmissionCoefficientsSubglacialRunoff, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - surfaceThicknessFluxSubglacialRunoff, tend, err)!{{{ + surfaceThicknessFlux, surfaceThicknessFluxRunoff, tend, err)!{{{ !----------------------------------------------------------------- ! ! input variables @@ -84,13 +84,11 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe real (kind=RKIND), dimension(:,:), intent(in) :: & transmissionCoefficients, &!< Input: Coefficients for the transmission of surface fluxes - transmissionCoefficientsRunoff, &!< Input: Coefficients for the transmission of surface fluxes due to river runoff - transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to subglacial runoff + transmissionCoefficientsRunoff !< Input: Coefficients for the transmission of surface fluxes due to river runoff real (kind=RKIND), dimension(:), intent(in) :: & - surfaceThicknessFlux, &!< Input: surface flux of thickness - surfaceThicknessFluxRunoff, &!< Input: surface flux of thickness due to river runoff - surfaceThicknessFluxSubglacialRunoff !< Input: surface flux of thickness due to subglacial runoff + surfaceThicknessFlux, &!< Input: surface flux of thickness + surfaceThicknessFluxRunoff !< Input: surface flux of thickness due to river runoff !----------------------------------------------------------------- @@ -118,7 +116,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe integer :: iCell, k - real (kind=RKIND) :: remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff + real (kind=RKIND) :: remainingFlux, remainingFluxRunoff err = 0 @@ -127,32 +125,24 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe call mpas_timer_start("thick surface flux") #ifdef MPAS_OPENACC - !$acc enter data copyin(transmissionCoefficients, transmissionCoefficientsRunoff, transmissionCoefficientsSubglacialRunoff) + !$acc enter data copyin(transmissionCoefficients, transmissionCoefficientsRunoff) !$acc parallel loop & !$acc present(tend, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - !$acc surfaceThicknessFluxSubglacialRunoff, transmissionCoefficientsSubglacialRunoff, & !$acc transmissionCoefficients, transmissionCoefficientsRunoff, minLevelCell, maxLevelCell) & - !$acc private(k, remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff) + !$acc private(k, remainingFlux, remainingFluxRunoff) #else !$omp parallel - !$omp do schedule(runtime) private(remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff, k) + !$omp do schedule(runtime) private(remainingFlux, remainingFluxRunoff, k) #endif do iCell = 1, nCellsOwned remainingFlux = 1.0_RKIND remainingFluxRunoff = 1.0_RKIND - if (trim(config_subglacial_runoff_mode) == 'data') then - remainingFluxSubglacialRunoff = 1.0_RKIND - end if do k = minLevelCell(iCell), maxLevelCell(iCell) remainingFlux = remainingFlux - transmissionCoefficients(k, iCell) remainingFluxRunoff = remainingFluxRunoff - transmissionCoefficientsRunoff(k, iCell) tend(k, iCell) = tend(k, iCell) + surfaceThicknessFlux(iCell) * transmissionCoefficients(k, iCell) & + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) - if (trim(config_subglacial_runoff_mode) == 'data') then - remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) - tend(k, iCell) = tend(k, iCell) + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) - end if end do if(maxLevelCell(iCell) > 0 .and. remainingFlux > 0.0_RKIND) then @@ -164,12 +154,6 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe + remainingFluxRunoff * surfaceThicknessFluxRunoff(iCell) end if - if (trim(config_subglacial_runoff_mode) == 'data') then - if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then - tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & - + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) - end if - end if end do #ifndef MPAS_OPENACC !$omp end do @@ -177,7 +161,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe #endif #ifdef MPAS_OPENACC - !$acc exit data delete(transmissionCoefficients, transmissionCoefficientsRunoff, transmissionCoefficientsSubglacialRunoff) + !$acc exit data delete(transmissionCoefficients, transmissionCoefficientsRunoff) #endif call mpas_timer_stop("thick surface flux") @@ -186,6 +170,107 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe end subroutine ocn_thick_surface_flux_tend!}}} +!*********************************************************************** +! +! routine ocn_thick_surface_flux_tend_subglacial_runoff +! +!> \brief Computes tendency term from horizontal advection of thickness +!> \author Doug Jacobsen +!> \date 15 September 2011 +!> \details +!> This routine computes the horizontal advection tendency for +!> thickness based on current state and user choices of forcings. +! +!----------------------------------------------------------------------- + + subroutine ocn_thick_surface_flux_tend_subglacial_runoff(transmissionCoefficientsSubglacialRunoff, & + surfaceThicknessFluxSubglacialRunoff, tend, err)!{{{ + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + real (kind=RKIND), dimension(:,:), intent(in) :: & + transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to subglacial runoff + + real (kind=RKIND), dimension(:), intent(in) :: & + surfaceThicknessFluxSubglacialRunoff !< Input: surface flux of thickness due to subglacial runoff + + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + real (kind=RKIND), dimension(:,:), intent(inout) :: & + tend !< Input/Output: thickness tendency + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell, k + + real (kind=RKIND) :: remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff + + err = 0 + + if (.not. surfaceThicknessFluxOn) return + + call mpas_timer_start("thick surface flux") + +#ifdef MPAS_OPENACC + !$acc enter data copyin(transmissionCoefficientsSubglacialRunoff) + + !$acc parallel loop & + !$acc present(tend, & + !$acc surfaceThicknessFluxSubglacialRunoff, transmissionCoefficientsSubglacialRunoff, & + !$acc minLevelCell, maxLevelCell) & + !$acc private(k, remainingFluxSubglacialRunoff) +#else + !$omp parallel + !$omp do schedule(runtime) private(remainingFluxSubglacialRunoff, k) +#endif + do iCell = 1, nCellsOwned + remainingFluxSubglacialRunoff = 1.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) + tend(k, iCell) = tend(k, iCell) + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) + end do + + if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then + tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & + + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) + end if + + end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + +#ifdef MPAS_OPENACC + !$acc exit data delete(transmissionCoefficientsSubglacialRunoff) +#endif + + call mpas_timer_stop("thick surface flux") + + !-------------------------------------------------------------------- + + end subroutine ocn_thick_surface_flux_tend_subglacial_runoff!}}} + !*********************************************************************** ! ! routine ocn_thick_surface_flux_init diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index 4a1dc5fce09..fd754562a57 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -45,7 +45,8 @@ module ocn_tracer_surface_flux_to_tend !-------------------------------------------------------------------- public :: ocn_tracer_surface_flux_tend, & - ocn_tracer_surface_flux_init + ocn_tracer_surface_flux_init, & + ocn_tracer_surface_flux_tend_subglacial_runoff !-------------------------------------------------------------------- ! @@ -71,8 +72,8 @@ module ocn_tracer_surface_flux_to_tend ! !----------------------------------------------------------------------- - subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbsorbedRunoff, fractionAbsorbedSubglacialRunoff, & - layerThickness, surfaceTracerFlux, surfaceTracerFluxRunoff, surfaceTracerFluxSubglacialRunoff, tend, err)!{{{ + subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbsorbedRunoff, & + layerThickness, surfaceTracerFlux, surfaceTracerFluxRunoff, tend, err)!{{{ !----------------------------------------------------------------- ! ! input variables @@ -97,13 +98,6 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso real (kind=RKIND), dimension(:,:), intent(in) :: & fractionAbsorbedRunoff !< Input: Coefficients for the application of surface fluxes due to river runoff - real (kind=RKIND), dimension(:,:), intent(in), pointer :: & - surfaceTracerFluxSubglacialRunoff !< Input: surface tracer fluxes from subglacial runoff - - real (kind=RKIND), dimension(:,:), intent(in) :: & - fractionAbsorbedSubglacialRunoff !< Input: Coefficients for the application of surface fluxes due to subglacial runoff - - !----------------------------------------------------------------- ! ! input/output variables @@ -204,14 +198,96 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso call mpas_timer_stop("surface_tracer_runoff_flux") end if + !-------------------------------------------------------------------- + + end subroutine ocn_tracer_surface_flux_tend!}}} + + +!*********************************************************************** +! +! routine ocn_tracer_surface_flux_tend_subglacial_runoff +! +!> \brief Computes tendency term for surface fluxes +!> \author Doug Jacobsen +!> \date 12/17/12 +!> \details +!> This routine computes the tendency for tracers based on surface fluxes. +! +!----------------------------------------------------------------------- + + subroutine ocn_tracer_surface_flux_tend_subglacial_runoff(meshPool, fractionAbsorbedSubglacialRunoff, & + layerThickness, surfaceTracerFluxSubglacialRunoff, tend, err)!{{{ + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + type (mpas_pool_type), intent(in) :: & + meshPool !< Input: mesh information + + real (kind=RKIND), dimension(:,:), intent(in) :: & + layerThickness !< Input: Layer thickness + + real (kind=RKIND), dimension(:,:), intent(in), pointer :: & + surfaceTracerFluxSubglacialRunoff !< Input: surface tracer fluxes from subglacial runoff + + real (kind=RKIND), dimension(:,:), intent(in) :: & + fractionAbsorbedSubglacialRunoff !< Input: Coefficients for the application of surface fluxes due to subglacial runoff + + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + real (kind=RKIND), dimension(:,:,:), intent(inout) :: & + tend !< Input/Output: velocity tendency + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell, k, iTracer, nTracers, nCells + integer, pointer :: nVertLevels + integer, dimension(:), pointer :: nCellsArray + integer, dimension(:), pointer :: minLevelCell, maxLevelCell + + real (kind=RKIND) :: remainingFlux + + err = 0 + + if (.not. surfaceTracerFluxOn) return + + call mpas_timer_start("surface_tracer_flux") + + call mpas_pool_get_dimension(meshPool, 'nCellsArray', nCellsArray) + call mpas_pool_get_dimension(meshPool, 'nVertLevels', nVertLevels) + nTracers = size(tend, dim=1) + + call mpas_pool_get_array(meshPool, 'minLevelCell', minLevelCell) + call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell) + + nCells = nCellsArray( 1 ) + ! now do subglacial runoff component - if (trim(config_subglacial_runoff_mode) == 'data') then - call mpas_timer_start("surface_tracer_subglacial_runoff_flux") + call mpas_timer_start("surface_tracer_subglacial_runoff_flux") - !$omp parallel - !$omp do schedule(runtime) private(remainingFlux, k, iTracer) - do iCell = 1, nCells + !$omp parallel + !$omp do schedule(runtime) private(remainingFlux, k, iTracer) + do iCell = 1, nCells remainingFlux = 1.0_RKIND do k = minLevelCell(iCell), maxLevelCell(iCell) remainingFlux = remainingFlux - fractionAbsorbedSubglacialRunoff(k, iCell) @@ -228,15 +304,13 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso + surfaceTracerFluxSubglacialRunoff(iTracer, iCell) * remainingFlux end do end if - end do - !$omp end do - !$omp end parallel + end do + !$omp end do + !$omp end parallel - call mpas_timer_stop("surface_tracer_subglacial_runoff_flux") - end if !-------------------------------------------------------------------- - end subroutine ocn_tracer_surface_flux_tend!}}} + end subroutine ocn_tracer_surface_flux_tend_subglacial_runoff!}}} !*********************************************************************** ! From 9ff4253ce41be1da822001d6cb7f3208e0a92260 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 18:53:48 -0600 Subject: [PATCH 069/197] fix function call typos --- components/mpas-ocean/src/shared/mpas_ocn_tendency.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index e3f47d1316b..b855512fb29 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -250,7 +250,7 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ surfaceThicknessFluxRunoff, & tendThick, err) if (trim(config_subglacial_runoff_mode) == 'data') then - call ocn_thick_surface_flux_tend(fractionAbsorbedSubglacialRunoff, & + call ocn_thick_surface_flux_tend_subglacial_runoff(fractionAbsorbedSubglacialRunoff, & surfaceThicknessFluxSubglacialRunoff, & tendThick, err) end if @@ -1256,7 +1256,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & tracerGroupSurfaceFluxRunoff, & tracerGroupTend, err) if (trim(config_subglacial_runoff_mode) == 'data') then - call ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbedSubglacialRunoff, & + call ocn_tracer_surface_flux_tend_subglacial_runoff(meshPool, fractionAbsorbedSubglacialRunoff, & layerThickness, tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupTend, err) end if From 476908cbf811143a1066833171c2b1c9f250f925 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 21:15:47 -0600 Subject: [PATCH 070/197] more new subrutines with _subglacial_runoff --- .../shared/mpas_ocn_surface_bulk_forcing.F | 218 +++++++++++++++--- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 6 +- 2 files changed, 187 insertions(+), 37 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 168f8c31e27..81732b637a9 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -50,8 +50,10 @@ module ocn_surface_bulk_forcing ocn_surface_bulk_forcing_vel, & ocn_surface_bulk_forcing_thick, & ocn_surface_bulk_forcing_init, & + ocn_surface_bulk_forcing_tracers_subglacial_runoff, & ocn_surface_bulk_forcing_thick_subglacial_runoff + !-------------------------------------------------------------------- ! ! Private module variables @@ -79,7 +81,7 @@ module ocn_surface_bulk_forcing !----------------------------------------------------------------------- subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, dt, layerThickness, err)!{{{ + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, dt, layerThickness, err)!{{{ !----------------------------------------------------------------- ! @@ -99,8 +101,6 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFlux !< Input/Output: Surface flux for tracer group real (kind=RKIND), dimension(:,:), intent(inout) :: & tracersSurfaceFluxRunoff !< Input/Output: Surface flux for tracer group due to river runoff - real (kind=RKIND), dimension(:,:), intent(inout) :: & - tracersSurfaceFluxSubglacialRunoff !< Input/Output: Surface flux for tracer group due to subglacial runoff real (kind=RKIND), dimension(:,:), intent(inout) :: & tracersSurfaceFluxRemoved !< Input/Output: Accumulator for ignored Surface flux for tracer group real (kind=RKIND), dimension(:,:), intent(in) :: layerThickness @@ -125,12 +125,69 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr call mpas_timer_start("bulk_" // trim(groupName)) if ( trim(groupName) == 'activeTracers' ) then call ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) end if call mpas_timer_stop("bulk_" // trim(groupName)) end subroutine ocn_surface_bulk_forcing_tracers!}}} +!*********************************************************************** +! +! routine ocn_surface_bulk_forcing_tracers_subglacial_runoff +! +!> \brief Determines the tracers forcing array used for the bulk forcing. +!> \author Doug Jacobsen +!> \date 04/25/12 +!> \details +!> This routine computes the tracers forcing arrays used later in MPAS. +! +!----------------------------------------------------------------------- + + subroutine ocn_surface_bulk_forcing_tracers_subglacial_runoff(meshPool, groupName, forcingPool, & + tracersSurfaceFluxSubglacialRunoff, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(in) :: meshPool !< Input: mesh information + character (len=*) :: groupName !< Input: Name of tracer group + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information + real (kind=RKIND), dimension(:,:), intent(inout) :: & + tracersSurfaceFluxSubglacialRunoff !< Input/Output: Surface flux for tracer group due to subglacial runoff + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: Error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + err = 0 + + call mpas_timer_start("bulk_" // trim(groupName)) + if ( trim(groupName) == 'activeTracers' ) then + call ocn_surface_bulk_forcing_active_tracers_subglacial_runoff(meshPool, forcingPool, & + tracersSurfaceFluxSubglacialRunoff, err) + end if + call mpas_timer_stop("bulk_" // trim(groupName)) + + end subroutine ocn_surface_bulk_forcing_tracers_subglacial_runoff!}}} + !*********************************************************************** ! ! routine ocn_surface_bulk_forcing_vel @@ -503,7 +560,7 @@ end subroutine ocn_surface_bulk_forcing_init!}}} !----------------------------------------------------------------------- subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err)!{{{ + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err)!{{{ !----------------------------------------------------------------- ! @@ -520,7 +577,6 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFlux real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxRunoff - real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxSubglacialRunoff real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxRemoved real (kind=RKIND), dimension(:,:,:), intent(inout) :: tracerGroup real (kind=RKIND), dimension(:,:), intent(in) :: layerThickness @@ -548,7 +604,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer type(mpas_pool_type),pointer :: tracersSurfaceFluxPool real (kind=RKIND), dimension(:), pointer :: latentHeatFlux, sensibleHeatFlux, longWaveHeatFluxUp, longWaveHeatFluxDown, & - seaIceHeatFlux, icebergHeatFlux, evaporationFlux, riverRunoffFlux, subglacialRunoffFlux + seaIceHeatFlux, icebergHeatFlux, evaporationFlux, riverRunoffFlux real (kind=RKIND), dimension(:), pointer :: seaIceFreshWaterFlux, icebergFreshWaterFlux, seaIceSalinityFlux, iceRunoffFlux real (kind=RKIND), dimension(:), pointer :: shortWaveHeatFlux, penetrativeTemperatureFlux real (kind=RKIND), dimension(:), pointer :: snowFlux, rainFlux @@ -589,7 +645,6 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) - call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'penetrativeTemperatureFlux', penetrativeTemperatureFlux) call mpas_pool_get_array(forcingPool, 'landIcePressure', landIcePressure) @@ -653,28 +708,6 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFluxRunoff(index_temperature_flux,iCell) = riverRunoffFlux(iCell) & * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw - if (trim(config_subglacial_runoff_mode) == 'data') then - if ( config_use_sgr_opt_temp_prescribed ) then - !sgr with fixed prescribed temperature - tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_temperature_prescribed / rho_sw - else - !sgr with temperature equal to the local freezing point of freshwater - tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & - inLandIceCavity=.true.) / rho_sw - end if - - if ( config_use_sgr_opt_salt_prescribed ) then - !sgr with fixed prescribed temperature - tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_salinity_prescribed / rho_sw - else - !sgr with temperature equal to the local freezing point of freshwater - tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND - end if - end if - ! Accumulate fluxes that use the freezing point ! mrp performance note: should call ocn_freezing_temperature just once here seaIceTemperatureFlux(iCell) = seaIceFreshWaterFlux(iCell) * & @@ -694,12 +727,6 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer totalFreshWaterTemperatureFlux(iCell) = surfaceTemperatureFluxWithoutRunoff & + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) - ! add subglacial runoff contribution for sending through coupler - if (trim(config_subglacial_runoff_mode) == 'data') then - totalFreshWaterTemperatureFlux(iCell) = totalFreshWaterTemperatureFlux(iCell) & - + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) - end if - ! Fields with zero temperature are not accumulated. These include: ! snowFlux ! iceRunoffFlux @@ -720,6 +747,125 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer end subroutine ocn_surface_bulk_forcing_active_tracers!}}} +!*********************************************************************** +! +! routine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff +! +!> \brief Determines the active tracers forcing array used for the bulk forcing. +!> \author Doug Jacobsen +!> \date 04/25/12 +!> \details +!> This routine computes the active tracers forcing arrays used later in MPAS. +! +!----------------------------------------------------------------------- + + subroutine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff(meshPool, forcingPool, & + tracersSurfaceFluxSubglacialRunoff, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(in) :: meshPool !< Input: mesh information + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information + real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxSubglacialRunoff + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: Error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell, nCells + integer, pointer :: index_temperature_fluxPtr, index_salinity_fluxPtr + integer :: index_temperature_flux, index_salinity_flux + integer, dimension(:), pointer :: nCellsArray + + type(mpas_pool_type),pointer :: tracersSurfaceFluxPool + + real (kind=RKIND), dimension(:), pointer :: subglacialRunoffFlux + real (kind=RKIND), dimension(:), pointer :: totalFreshWaterTemperatureFlux + real (kind=RKIND), dimension(:), pointer :: landIcePressure + + err = 0 + + call mpas_pool_get_dimension(meshPool, 'nCellsArray', nCellsArray) + + call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) + + call mpas_pool_get_dimension(tracersSurfaceFluxPool, & + 'index_temperatureSurfaceFlux', & + index_temperature_fluxPtr) + call mpas_pool_get_dimension(tracersSurfaceFluxPool, & + 'index_salinitySurfaceFlux', & + index_salinity_fluxPtr) + index_temperature_flux = index_temperature_fluxPtr + index_salinity_flux = index_salinity_fluxPtr + + call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) + + call mpas_pool_get_array(forcingPool, 'landIcePressure', landIcePressure) + + call mpas_pool_get_array(forcingPool, 'totalFreshWaterTemperatureFlux', totalFreshWaterTemperatureFlux) + + nCells = nCellsArray( 3 ) + + ! Surface fluxes of water have an associated heat content, but the coupled system does not account for this + ! Assume surface fluxes of water have a temperature dependent on the incoming mass flux. + ! Assume surface fluxes of water have zero salinity. So the RHS forcing is zero for salinity. + ! Only include this heat forcing when bulk thickness is turned on + ! indices on tracerGroup are (iTracer, iLevel, iCell) + if (.not. bulkThicknessFluxOff) then + !$omp parallel + !$omp do schedule(runtime) + do iCell = 1, nCells + + if ( config_use_sgr_opt_temp_prescribed ) then + !sgr with fixed prescribed temperature + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + config_sgr_temperature_prescribed / rho_sw + else + !sgr with temperature equal to the local freezing point of freshwater + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & + inLandIceCavity=.true.) / rho_sw + end if + + if ( config_use_sgr_opt_salt_prescribed ) then + !sgr with fixed prescribed temperature + tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & + config_sgr_salinity_prescribed / rho_sw + else + !sgr with temperature equal to the local freezing point of freshwater + tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND + end if + + ! add subglacial runoff contribution for sending through coupler + totalFreshWaterTemperatureFlux(iCell) = totalFreshWaterTemperatureFlux(iCell) & + + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) + + end do + !$omp end do + !$omp end parallel + endif ! bulkThicknessFluxOn + + end subroutine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff!}}} + end module ocn_surface_bulk_forcing diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index b855512fb29..f42df59a629 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -891,9 +891,13 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & forcingPool, tracerGroup, & tracerGroupSurfaceFlux, & tracerGroupSurfaceFluxRunoff, & - tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupSurfaceFluxRemoved, & dt, layerThickness, err) + if (trim(config_subglacial_runoff_mode) == 'data') then + call ocn_surface_bulk_forcing_tracers(meshPool, groupName, & + forcingPool, & + tracerGroupSurfaceFluxSubglacialRunoff, err) + end if end if ! sfc bulk forcing From 5a54e97cf2577dbc9bed3bff0c25379ad4fc72e1 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 21:43:49 -0600 Subject: [PATCH 071/197] fix function call typo _subglacial_runoff --- components/mpas-ocean/src/shared/mpas_ocn_tendency.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index f42df59a629..a0f4ae74e5e 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -894,7 +894,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & tracerGroupSurfaceFluxRemoved, & dt, layerThickness, err) if (trim(config_subglacial_runoff_mode) == 'data') then - call ocn_surface_bulk_forcing_tracers(meshPool, groupName, & + call ocn_surface_bulk_forcing_tracers_subglacial_runoff(meshPool, groupName, & forcingPool, & tracerGroupSurfaceFluxSubglacialRunoff, err) end if From bdd8761563b4e46fb575c11830289c0fd4facd13 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 23:12:28 -0600 Subject: [PATCH 072/197] fix timer for sgr --- .../src/shared/mpas_ocn_tracer_surface_flux_to_tend.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index fd754562a57..280ebc72844 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -270,8 +270,6 @@ subroutine ocn_tracer_surface_flux_tend_subglacial_runoff(meshPool, fractionAbso if (.not. surfaceTracerFluxOn) return - call mpas_timer_start("surface_tracer_flux") - call mpas_pool_get_dimension(meshPool, 'nCellsArray', nCellsArray) call mpas_pool_get_dimension(meshPool, 'nVertLevels', nVertLevels) nTracers = size(tend, dim=1) @@ -308,6 +306,8 @@ subroutine ocn_tracer_surface_flux_tend_subglacial_runoff(meshPool, fractionAbso !$omp end do !$omp end parallel + call mpas_timer_stop("surface_tracer_subglacial_runoff_flux") + !-------------------------------------------------------------------- end subroutine ocn_tracer_surface_flux_tend_subglacial_runoff!}}} From 0b72d7532ee6d28b926ed2365b3d68c86a022f54 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 22 Jul 2024 13:20:13 -0600 Subject: [PATCH 073/197] corrected subglacialRunoffFlux add up in conservation check so that it is as mass, not volume flux --- .../src/analysis_members/mpas_ocn_conservation_check.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 756328a3d5d..beed937d676 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -983,7 +983,7 @@ subroutine mass_conservation(domain, err) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) if (trim(config_subglacial_runoff_mode) == 'data') then - sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) / areaCell(iCell) * rho_sw + sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) end if enddo From 00fc2618b0ad0d064870659e92ac51d8f4246c13 Mon Sep 17 00:00:00 2001 From: irenavankova Date: Wed, 17 Jul 2024 12:18:10 -0600 Subject: [PATCH 074/197] Change if statement for config_sgr_flux_vertical_location init check Co-authored-by: Carolyn Begeman --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 5046e19d5d5..a2d6586a7d6 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -4742,10 +4742,9 @@ subroutine ocn_diagnostics_init(domain, err)!{{{ call ocn_diagnostics_variables_init(domain, jenkinsOn, & hollandJenkinsOn, err) - if ( trim(config_sgr_flux_vertical_location) == 'top' ) then - else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then - else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then - else + if ( trim(config_sgr_flux_vertical_location) /= 'top' .and. & + trim(config_sgr_flux_vertical_location) /= 'uniform' .and. & + trim(config_sgr_flux_vertical_location) /= 'bottom' ) then call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if From 77feb929dcad7ab939f7108c6b4f292d716e5530 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 23 Jul 2024 13:45:38 -0600 Subject: [PATCH 075/197] change author on new subroutines --- .../src/shared/mpas_ocn_surface_bulk_forcing.F | 12 ++++++------ .../src/shared/mpas_ocn_thick_surface_flux.F | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 81732b637a9..11d70ae9c40 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -136,8 +136,8 @@ end subroutine ocn_surface_bulk_forcing_tracers!}}} ! routine ocn_surface_bulk_forcing_tracers_subglacial_runoff ! !> \brief Determines the tracers forcing array used for the bulk forcing. -!> \author Doug Jacobsen -!> \date 04/25/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the tracers forcing arrays used later in MPAS. ! @@ -425,8 +425,8 @@ end subroutine ocn_surface_bulk_forcing_thick!}}} ! routine ocn_surface_bulk_forcing_thick_subglacial_runoff ! !> \brief Determines the thickness forcing array used for the bulk forcing. -!> \author Doug Jacobsen -!> \date 04/25/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the thickness forcing arrays used later in MPAS. ! @@ -752,8 +752,8 @@ end subroutine ocn_surface_bulk_forcing_active_tracers!}}} ! routine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff ! !> \brief Determines the active tracers forcing array used for the bulk forcing. -!> \author Doug Jacobsen -!> \date 04/25/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the active tracers forcing arrays used later in MPAS. ! diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index 8e389a74ba3..b959a89bff1 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -175,8 +175,8 @@ end subroutine ocn_thick_surface_flux_tend!}}} ! routine ocn_thick_surface_flux_tend_subglacial_runoff ! !> \brief Computes tendency term from horizontal advection of thickness -!> \author Doug Jacobsen -!> \date 15 September 2011 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the horizontal advection tendency for !> thickness based on current state and user choices of forcings. @@ -276,8 +276,8 @@ end subroutine ocn_thick_surface_flux_tend_subglacial_runoff!}}} ! routine ocn_thick_surface_flux_init ! !> \brief Initializes ocean horizontal thickness surface fluxes -!> \author Doug Jacobsen -!> \date 12/17/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine initializes quantities related to thickness !> surface fluxes in the ocean. From 0288938beae15cf92f0a86d077e0cd12b3ffaf3c Mon Sep 17 00:00:00 2001 From: Jon Wolfe Date: Thu, 25 Jul 2024 11:06:20 -0500 Subject: [PATCH 076/197] Make bld files consistent with Registry --- components/mpas-ocean/bld/build-namelist | 10 ++++---- .../mpas-ocean/bld/build-namelist-section | 2 +- .../namelist_defaults_mpaso.xml | 2 +- .../namelist_definition_mpaso.xml | 23 ++++++++++--------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 490100040c0..37c8b88f67e 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -708,6 +708,11 @@ add_default($nl, 'config_use_bulk_wind_stress'); add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); +if ($OCN_SGR eq 'data') { + add_default($nl, 'config_subglacial_runoff_mode', 'val'=>"data"); +} else { + add_default($nl, 'config_subglacial_runoff_mode'); +} add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); @@ -715,11 +720,6 @@ add_default($nl, 'config_use_sgr_opt_temp_prescribed'); add_default($nl, 'config_use_sgr_opt_salt_prescribed'); add_default($nl, 'config_sgr_temperature_prescribed'); add_default($nl, 'config_sgr_salinity_prescribed'); -if ($OCN_SGR eq 'data') { - add_default($nl, 'config_subglacial_runoff_mode', 'val'=>"data"); -} else { - add_default($nl, 'config_subglacial_runoff_mode'); -} ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 189d32fc7b5..9e646beb6b5 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -224,6 +224,7 @@ add_default($nl, 'config_use_bulk_wind_stress'); add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); +add_default($nl, 'config_subglacial_runoff_mode'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); @@ -231,7 +232,6 @@ add_default($nl, 'config_use_sgr_opt_temp_prescribed'); add_default($nl, 'config_use_sgr_opt_salt_prescribed'); add_default($nl, 'config_sgr_temperature_prescribed'); add_default($nl, 'config_sgr_salinity_prescribed'); -add_default($nl, 'config_subglacial_runoff_mode'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index c57920e5c38..b70f7942686 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -342,6 +342,7 @@ .true. 0.001 10.0 +'off' 0.001 'bottom' .true. @@ -349,7 +350,6 @@ .false. 0.0 0.0 -'off' .false. diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index fed7828e6a8..601b121e576 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1188,9 +1188,17 @@ Valid values: Any positive real number. Default: Defined in namelist_defaults.xml + +Selects the mode in which subglacial runoff fluxes are implemented. + +Valid values: 'off', 'data' +Default: Defined in namelist_defaults.xml + + -The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$. +The length scale of exponential decay of subglacial runoff, used when config_sgr_flux_vertical_location is 'top' or 'bottom'. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$. Valid values: Any positive real number. Default: Defined in namelist_defaults.xml @@ -1198,9 +1206,9 @@ Default: Defined in namelist_defaults.xml -Selects the vertical location where subglacial runoff is fluxed +Selects the vertical location where subglacial runoff is fluxed. -Valid values: 'top','uniform', 'bottom'. +Valid values: 'top','uniform', 'bottom' Default: Defined in namelist_defaults.xml @@ -1240,17 +1248,10 @@ Default: Defined in namelist_defaults.xml category="forcing" group="forcing"> Prescribed subglacial runoff salinity value, applied when config_use_sgr_opt_salt_prescribed = .true. -Valid values: Any real number. +Valid values: Any positive real number Default: Defined in namelist_defaults.xml - -Selects the mode in which subglacial runoff fluxes are computed. - -Valid values: 'off', 'data' -Default: Defined in namelist_defaults.xml - From 48cee50966dfefddfad8b90e8502c9296bf62573 Mon Sep 17 00:00:00 2001 From: irenavankova Date: Thu, 25 Jul 2024 10:12:31 -0600 Subject: [PATCH 077/197] Correct DSGR file name Co-authored-by: Xylar Asay-Davis --- components/mpas-ocean/cime_config/buildnml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index f3eb2288168..8f5193c334b 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -380,7 +380,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.massFlux.massFlux.MALI.out2055.IcoswISC30E3r5.20240328.nc' + data_sgr_file = 'DSGR.massFlux.MALI.out2055.IcoswISC30E3r5.20240328.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' From 5a0f2842c03cb058d51dd8c09a133efece7cd2ca Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 25 Jul 2024 10:44:04 -0600 Subject: [PATCH 078/197] Corrected authorship --- .../mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F | 4 ++-- .../src/shared/mpas_ocn_tracer_surface_flux_to_tend.F | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index b959a89bff1..1c535532cea 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -276,8 +276,8 @@ end subroutine ocn_thick_surface_flux_tend_subglacial_runoff!}}} ! routine ocn_thick_surface_flux_init ! !> \brief Initializes ocean horizontal thickness surface fluxes -!> \author Irena Vankova -!> \date July 2024 +!> \author Doug Jacobsen +!> \date 12/17/12 !> \details !> This routine initializes quantities related to thickness !> surface fluxes in the ocean. diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index 280ebc72844..ba97203c4ec 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -208,8 +208,8 @@ end subroutine ocn_tracer_surface_flux_tend!}}} ! routine ocn_tracer_surface_flux_tend_subglacial_runoff ! !> \brief Computes tendency term for surface fluxes -!> \author Doug Jacobsen -!> \date 12/17/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the tendency for tracers based on surface fluxes. ! From 9ddd011645f60d3c59e7783476f75d5359ed06ae Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 25 Jul 2024 10:49:40 -0600 Subject: [PATCH 079/197] Added DSGR to stealth feature tests --- cime_config/tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/tests.py b/cime_config/tests.py index c1f6cfaa1b7..12ab829c51d 100644 --- a/cime_config/tests.py +++ b/cime_config/tests.py @@ -274,6 +274,7 @@ "ERS_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF.mpaso-jra_1958", "PEM_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF.mpaso-jra_1958", "SMS_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF-TMIX.mpaso-jra_1958", + "SMS_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF-DSGR.mpaso-jra_1958", ) }, From 24f24b88665c4e671f91bde4aacb0f3007c20d3b Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 29 Jul 2024 09:28:12 -0600 Subject: [PATCH 080/197] added package condition in tendency tracers --- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index a0f4ae74e5e..601d134ceec 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -830,13 +830,15 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & modifiedGroupName, & tracerGroupSurfaceFluxRunoff) - ! Get surface flux due to subglacial runoff array - ! only active tracers have subglacial runoff flux for now, - ! but we still need to associate for ALL tracers - modifiedGroupName = groupName // "SurfaceFluxSubglacialRunoff" - call mpas_pool_get_array(tracersSurfaceFluxPool, & - modifiedGroupName, & - tracerGroupSurfaceFluxSubglacialRunoff) + if (trim(config_subglacial_runoff_mode) == 'data') then + ! Get surface flux due to subglacial runoff array + ! only active tracers have subglacial runoff flux for now, + ! but we still need to associate for ALL tracers + modifiedGroupName = groupName // "SurfaceFluxSubglacialRunoff" + call mpas_pool_get_array(tracersSurfaceFluxPool, & + modifiedGroupName, & + tracerGroupSurfaceFluxSubglacialRunoff) + end if ! Get surface flux removed array to keep track of how much ! flux is ignored From b4352409b890093a34ab600915543a02bbd811be Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Tue, 30 Jul 2024 20:39:22 -0400 Subject: [PATCH 081/197] small mods to v3 script --- run_e3sm.template.sh | 59 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/run_e3sm.template.sh b/run_e3sm.template.sh index 623867c0190..1a55dc933d8 100755 --- a/run_e3sm.template.sh +++ b/run_e3sm.template.sh @@ -5,9 +5,6 @@ # Bash coding style inspired by: # http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming -# TO DO: -# - custom pelayout - main() { # For debugging, uncomment line below @@ -46,8 +43,8 @@ readonly GET_REFCASE=TRUE #readonly RUN_REFDATE="" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' # Set paths -readonly CODE_ROOT="${HOME}/E3SMv3/code/${CHECKOUT}" -readonly CASE_ROOT="/pscratch/sd/r/${USER}/e3sm-scratch/${CASE_NAME}" +readonly CODE_ROOT="/pscratch/sd/${USER:0:1}/${USER}/e3sm-scratch/${MACHINE}/your_casename/code/${CHECKOUT}" +readonly CASE_ROOT="/pscratch/sd/${USER:0:1}/${USER}/e3sm-scratch/${MACHINE}/${CASE_NAME}" # Sub-directories readonly CASE_BUILD_DIR=${CASE_ROOT}/build @@ -56,6 +53,7 @@ readonly CASE_ARCHIVE_DIR=${CASE_ROOT}/archive # Define type of run # short tests: 'XS_2x5_ndays', 'XS_1x10_ndays', 'S_1x10_ndays', # 'M_1x10_ndays', 'M2_1x10_ndays', 'M80_1x10_ndays', 'L_1x10_ndays' +# * can replace XS, M, etc with custom-XY with XY being the node count # or 'production' for full simulation readonly run='XS_2x5_ndays' if [ "${run}" != "production" ]; then @@ -118,6 +116,9 @@ fetch_code # Create case create_newcase +# Custom PE layout +custom_pelayout + # Setup case_setup @@ -322,6 +323,14 @@ create_newcase() { echo $'\n----- Starting create_newcase -----\n' + + if [[ ${PELAYOUT} == custom-* ]]; + then + layout="M" # temporary placeholder for create_newcase + else + layout=${PELAYOUT} + fi + if [[ -z "$CASE_GROUP" ]]; then ${CODE_ROOT}/cime/scripts/create_newcase \ --case ${CASE_NAME} \ @@ -333,7 +342,7 @@ create_newcase() { --machine ${MACHINE} \ --project ${PROJECT} \ --walltime ${WALLTIME} \ - --pecount ${PELAYOUT} + --pecount ${layout} else ${CODE_ROOT}/cime/scripts/create_newcase \ --case ${CASE_NAME} \ @@ -346,7 +355,7 @@ create_newcase() { --machine ${MACHINE} \ --project ${PROJECT} \ --walltime ${WALLTIME} \ - --pecount ${PELAYOUT} + --pecount ${layout} fi @@ -398,6 +407,37 @@ case_setup() { popd } +#----------------------------------------------------- +custom_pelayout() { + +if [[ ${PELAYOUT} == custom-* ]]; +then + echo $'\n CUSTOMIZE PROCESSOR CONFIGURATION:' + + # Number of cores per node (machine specific) + if [ "${MACHINE}" == "pm-cpu" ]; then + ncore=128 + else + echo 'ERROR: MACHINE = '${MACHINE}' is not supported for custom PE layout.' + exit 400 + fi + + # Extract number of nodes + tmp=($(echo ${PELAYOUT} | tr "-" " ")) + nnodes=${tmp[1]} + + # Customize + pushd ${CASE_SCRIPTS_DIR} + ./xmlchange NTASKS=$(( $nnodes * $ncore )) + ./xmlchange NTHRDS=1 + ./xmlchange MAX_MPITASKS_PER_NODE=$ncore + ./xmlchange MAX_TASKS_PER_NODE=$ncore + popd + +fi + +} + #----------------------------------------------------- case_build() { @@ -534,9 +574,10 @@ copy_script() { local script_provenance_dir=${CASE_SCRIPTS_DIR}/run_script_provenance mkdir -p ${script_provenance_dir} - local this_script_name=`basename $0` + local this_script_name=$( basename -- "$0"; ) + local this_script_dir=$( dirname -- "$0"; ) local script_provenance_name=${this_script_name}.`date +%Y%m%d-%H%M%S` - cp -vp ${this_script_name} ${script_provenance_dir}/${script_provenance_name} + cp -vp "${this_script_dir}/${this_script_name}" ${script_provenance_dir}/${script_provenance_name} } From 33b4eaa5c04b7f1a8e866c5ef4b174e1c8016b1d Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Tue, 30 Jul 2024 20:44:30 -0400 Subject: [PATCH 082/197] Use $PSCRATCH instead --- run_e3sm.template.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_e3sm.template.sh b/run_e3sm.template.sh index 1a55dc933d8..e2a5b603ba7 100755 --- a/run_e3sm.template.sh +++ b/run_e3sm.template.sh @@ -43,8 +43,8 @@ readonly GET_REFCASE=TRUE #readonly RUN_REFDATE="" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' # Set paths -readonly CODE_ROOT="/pscratch/sd/${USER:0:1}/${USER}/e3sm-scratch/${MACHINE}/your_casename/code/${CHECKOUT}" -readonly CASE_ROOT="/pscratch/sd/${USER:0:1}/${USER}/e3sm-scratch/${MACHINE}/${CASE_NAME}" +readonly CASE_ROOT="${PSCRATCH}/e3sm-scratch/${MACHINE}/${CASE_NAME}" +readonly CODE_ROOT="${PSCRATCH}/e3sm-scratch/${MACHINE}/${CASE_NAME}/code/${CHECKOUT}" # Sub-directories readonly CASE_BUILD_DIR=${CASE_ROOT}/build From 1d9dae3ad3016776b8aad0a03be1fd7b5d14fb4d Mon Sep 17 00:00:00 2001 From: Yunpeng Shan Date: Wed, 31 Jul 2024 21:34:19 -0500 Subject: [PATCH 083/197] Add outfld lines for in-cloud properties output. --- components/eam/src/physics/p3/eam/micro_p3_interface.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/eam/src/physics/p3/eam/micro_p3_interface.F90 b/components/eam/src/physics/p3/eam/micro_p3_interface.F90 index bb6e164b4a1..c6c533329a3 100644 --- a/components/eam/src/physics/p3/eam/micro_p3_interface.F90 +++ b/components/eam/src/physics/p3/eam/micro_p3_interface.F90 @@ -1630,6 +1630,12 @@ subroutine micro_p3_tend(state, ptend, dtime, pbuf) call outfld('FREQI', freqi, pcols, lchnk) call outfld('FREQR', freqr, psetcols, lchnk) call outfld('CDNUMC', cdnumc, pcols, lchnk) +! call outfld('CLOUDFRAC_LIQ_MICRO', cld_frac_l, pcols, lchnk) call outfld('CLOUDFRAC_ICE_MICRO', cld_frac_i, pcols, lchnk) From 7581ae045f308b6544e61f9c30db20536441a27a Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Mon, 5 Aug 2024 09:19:07 -0400 Subject: [PATCH 084/197] fix link to best practices, save code in home --- run_e3sm.template.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_e3sm.template.sh b/run_e3sm.template.sh index e2a5b603ba7..413f2bf7528 100755 --- a/run_e3sm.template.sh +++ b/run_e3sm.template.sh @@ -3,7 +3,7 @@ # E3SM Coupled Model Group run_e3sm script template. # # Bash coding style inspired by: -# http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming +# https://web.archive.org/web/20200620202413/http://kfirlavi.herokuapp.com/blog/2012/11/14/defensive-bash-programming main() { @@ -44,7 +44,7 @@ readonly GET_REFCASE=TRUE # Set paths readonly CASE_ROOT="${PSCRATCH}/e3sm-scratch/${MACHINE}/${CASE_NAME}" -readonly CODE_ROOT="${PSCRATCH}/e3sm-scratch/${MACHINE}/${CASE_NAME}/code/${CHECKOUT}" +readonly CODE_ROOT="${HOME}/E3SMv3/code/${CHECKOUT}" # Sub-directories readonly CASE_BUILD_DIR=${CASE_ROOT}/build From 87068eda3d10d1b8486023bcde28382720b0fd69 Mon Sep 17 00:00:00 2001 From: Nicole Jeffery Date: Thu, 15 Aug 2024 09:56:51 -0500 Subject: [PATCH 085/197] Updates bgc defaults for grazing parameters Bugfix. Registry defaults were updated when implicit grazing was adding for E3SMv2, but the build defaults were kept the same. non-bfb in ice bgc runs. BFB for all others --- .../bld/namelist_files/namelist_defaults_mpassi.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/mpas-seaice/bld/namelist_files/namelist_defaults_mpassi.xml b/components/mpas-seaice/bld/namelist_files/namelist_defaults_mpassi.xml index 70db1f04189..d62797de451 100644 --- a/components/mpas-seaice/bld/namelist_files/namelist_defaults_mpassi.xml +++ b/components/mpas-seaice/bld/namelist_files/namelist_defaults_mpassi.xml @@ -289,9 +289,9 @@ 0.063 0.063 0.063 -0.0 -0.7 -0.7 +0.19 +0.19 +0.19 0.007 0.007 0.007 From ffdb1bc85ea4c7849346f2b80115cb436391bfc2 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Fri, 16 Aug 2024 17:32:13 +0000 Subject: [PATCH 086/197] Update ALCF Sunspot machine config --- cime_config/machines/config_machines.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index 6cd9d585a25..67611a0de22 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3413,13 +3413,9 @@ module /soft/packaging/lmod/lmod/libexec/lmod python - - /soft/modulefiles - spack cmake/3.26.3-gcc-11.2.0-vnn7ncx - prepend-deps/default + cmake - gcc oneapi/eng-compiler/2023.05.15.007 From 7c473e334e68aef5d142c55e245109f624a6aaaa Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Mon, 19 Aug 2024 22:26:49 +0000 Subject: [PATCH 087/197] Update oneapi to latest default --- cime_config/machines/config_machines.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index 67611a0de22..446262a3a9b 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3416,7 +3416,7 @@ cmake - oneapi/eng-compiler/2023.05.15.007 + oneapi/eng-compiler/2024.04.15.002 spack cmake From a4b7c3b9a75acdef005b3bbfc6dd671c7b2c2248 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Mon, 19 Aug 2024 22:29:07 +0000 Subject: [PATCH 088/197] Run BGC couppled cases on at least 2 nodes --- cime_config/allactive/config_pesall.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cime_config/allactive/config_pesall.xml b/cime_config/allactive/config_pesall.xml index e99230e7cb0..78ba011d9b7 100644 --- a/cime_config/allactive/config_pesall.xml +++ b/cime_config/allactive/config_pesall.xml @@ -1472,6 +1472,21 @@ + + + sunspot: --compset BGC* --res ne30pg2_r05_IcoswISC30E3r5 on 2 nodes pure-MPI + + -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + + + From e3e52e2b833f57d74231107cfcc3efc4c940b393 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Mon, 19 Aug 2024 22:34:11 +0000 Subject: [PATCH 089/197] Remove -check flags from debug builds They lead to link errors in currently available oneapi versions. --- cime_config/machines/cmake_macros/oneapi-ifx.cmake | 2 +- cime_config/machines/cmake_macros/oneapi-ifxgpu.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/machines/cmake_macros/oneapi-ifx.cmake b/cime_config/machines/cmake_macros/oneapi-ifx.cmake index e98a65d32a6..9ab0cdda7d5 100644 --- a/cime_config/machines/cmake_macros/oneapi-ifx.cmake +++ b/cime_config/machines/cmake_macros/oneapi-ifx.cmake @@ -7,7 +7,7 @@ endif() string(APPEND CMAKE_C_FLAGS_RELEASE " -O2") string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2") string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O2") -string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created") +string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0 -g -fpe0") string(APPEND CMAKE_C_FLAGS_DEBUG " -O0 -g") string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0 -g") string(APPEND CMAKE_C_FLAGS " -fp-model precise -std=gnu99") diff --git a/cime_config/machines/cmake_macros/oneapi-ifxgpu.cmake b/cime_config/machines/cmake_macros/oneapi-ifxgpu.cmake index 9d08ca6c630..d7dfae00219 100644 --- a/cime_config/machines/cmake_macros/oneapi-ifxgpu.cmake +++ b/cime_config/machines/cmake_macros/oneapi-ifxgpu.cmake @@ -7,7 +7,7 @@ endif() string(APPEND CMAKE_C_FLAGS_RELEASE " -O2") string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2") string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O2") -string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created") +string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0 -g -fpe0") string(APPEND CMAKE_C_FLAGS_DEBUG " -O0 -g") string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0 -g") string(APPEND CMAKE_C_FLAGS " -fp-model precise -std=gnu99") From c6e75e3fa6b3f9c1c1814ca7d368f4111a626949 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Mon, 19 Aug 2024 22:50:35 +0000 Subject: [PATCH 090/197] Cleanup unused mpilib refs --- cime_config/machines/config_machines.xml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index 446262a3a9b..c94a2bbcf7d 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3365,7 +3365,7 @@ uan-.* LINUX oneapi-ifx,oneapi-ifxgpu,gnu - mpich,impi,openmpi + mpich CSC249ADSE15_CNDA /gila/CSC249ADSE15_CNDA/performance_archive .* @@ -3398,13 +3398,6 @@ $ENV{GPU_TILE_COMPACT} - - mpirun - - --tag-output -n {{ total_tasks }} - --map-by ppr:{{ tasks_per_numa }}:socket:PE=$ENV{OMP_NUM_THREADS} --bind-to hwthread - - /soft/packaging/lmod/lmod/init/sh /soft/packaging/lmod/lmod/init/csh @@ -3434,12 +3427,6 @@ 1 - - 10 - omp - spread - unit - level_zero:gpu NO_GPU From eae53e54007c2be42ef3ee9f0d809e1ff88c53d9 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Tue, 20 Aug 2024 03:21:06 +0000 Subject: [PATCH 091/197] Run ne4-cases at 96x1 MPIxOMP --- cime_config/allactive/config_pesall.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cime_config/allactive/config_pesall.xml b/cime_config/allactive/config_pesall.xml index 78ba011d9b7..84c0e24d8c9 100644 --- a/cime_config/allactive/config_pesall.xml +++ b/cime_config/allactive/config_pesall.xml @@ -1759,6 +1759,21 @@ + + + allactive+sunspot: default, 96 mpi x 1 omp @ root 0 + + 96 + 96 + 96 + 96 + 96 + 96 + 96 + 96 + + + From ffec269d010a34f04b3ff132981dbeb0bcc24ac3 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Tue, 20 Aug 2024 03:22:36 +0000 Subject: [PATCH 092/197] Add initial sunspot machine file for eamxx --- components/eamxx/cmake/machine-files/sunspot.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 components/eamxx/cmake/machine-files/sunspot.cmake diff --git a/components/eamxx/cmake/machine-files/sunspot.cmake b/components/eamxx/cmake/machine-files/sunspot.cmake new file mode 100644 index 00000000000..09ff6d4e6c4 --- /dev/null +++ b/components/eamxx/cmake/machine-files/sunspot.cmake @@ -0,0 +1,10 @@ +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) +common_setup() + +include (${EKAT_MACH_FILES_PATH}/kokkos/serial.cmake) +include (${EKAT_MACH_FILES_PATH}/mpi/other.cmake) + +set(EKAT_MPIRUN_EXE "mpiexec" CACHE STRING "" FORCE) +set(EKAT_MPI_NP_FLAG "-np" CACHE STRING "" FORCE) +set(EKAT_MPI_EXTRA_ARGS "--label --cpu-bind depth -envall" CACHE STRING "") +set(EKAT_MPI_THREAD_FLAG "-d" CACHE STRING "") From fd620a5c8779956548980e335498ffef16552581 Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Wed, 21 Aug 2024 09:37:50 -0400 Subject: [PATCH 093/197] gen custom_pelayout, better case loc, and default proj --- run_e3sm.template.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/run_e3sm.template.sh b/run_e3sm.template.sh index 413f2bf7528..86e36015759 100755 --- a/run_e3sm.template.sh +++ b/run_e3sm.template.sh @@ -15,7 +15,7 @@ main() { # Machine and project readonly MACHINE=pm-cpu # BEFORE RUNNING: CHANGE this to your project -readonly PROJECT="e3sm" +readonly PROJECT="$(sacctmgr show user $USER format=DefaultAccount | tail -n1 | tr -d ' ')" # Simulation readonly COMPSET="WCYCL1850" @@ -43,7 +43,7 @@ readonly GET_REFCASE=TRUE #readonly RUN_REFDATE="" # same as MODEL_START_DATE for 'branch', can be different for 'hybrid' # Set paths -readonly CASE_ROOT="${PSCRATCH}/e3sm-scratch/${MACHINE}/${CASE_NAME}" +readonly CASE_ROOT="${PSCRATCH}/E3SMv3/${CASE_NAME}" readonly CODE_ROOT="${HOME}/E3SMv3/code/${CHECKOUT}" # Sub-directories @@ -417,6 +417,12 @@ then # Number of cores per node (machine specific) if [ "${MACHINE}" == "pm-cpu" ]; then ncore=128 + elif [ "${MACHINE}" == "chrysalis" ]; then + ncore=64 + elif [ "${MACHINE}" == "compy" ]; then + ncore=40 + elif [ "${MACHINE}" == "anvil" ]; then + ncore=36 else echo 'ERROR: MACHINE = '${MACHINE}' is not supported for custom PE layout.' exit 400 From 49e1cb2ebda26e15c33ab62245606db132211576 Mon Sep 17 00:00:00 2001 From: Matthew Hoffman Date: Tue, 13 Aug 2024 12:30:05 -0500 Subject: [PATCH 094/197] Add additional fields to history files --- .../mpas-albany-landice/cime_config/buildnml | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/components/mpas-albany-landice/cime_config/buildnml b/components/mpas-albany-landice/cime_config/buildnml index 4d927c4370f..e345853f84a 100755 --- a/components/mpas-albany-landice/cime_config/buildnml +++ b/components/mpas-albany-landice/cime_config/buildnml @@ -229,25 +229,31 @@ def buildnml(case, caseroot, compname): lines.append(' ') lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') -# lines.append(' ') -# lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') - lines.append(' ') - lines.append(' ') + lines.append(' ') + lines.append(' ') + lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') + lines.append(' ') + lines.append(' ') + lines.append(' ') + lines.append(' ') lines.append('') lines.append('') lines.append('') @@ -263,22 +269,16 @@ def buildnml(case, caseroot, compname): lines.append(' filename_interval="0001-00-00_00:00:00"') lines.append(' clobber_mode="truncate"') lines.append(' packages="globalStatsAMPKG"') - lines.append(' output_interval="0000_01:00:00">') + lines.append(' output_interval="0000_00:00:01">') lines.append('') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') - lines.append(' ') + lines.append(' ') lines.append(' ') + lines.append(' ') + lines.append(' ') + lines.append(' ') + lines.append(' ') + lines.append(' ') + lines.append(' ') lines.append('') lines.append('') lines.append(' -'none' +'temperature' .true. 'file' 0.0 From 36147b9482bf6ca18009f368f02c083c2a63f39d Mon Sep 17 00:00:00 2001 From: Matthew Hoffman Date: Wed, 14 Aug 2024 16:03:06 -0500 Subject: [PATCH 096/197] Adjust MALI buildnml to look for mesh-specific albany_input.yaml files Also create the corresponding albany_input.*.yaml files --- .../namelist_files/albany_input.ais20km.yaml | 231 ++++++++++++++++ .../albany_input.ais_4to20km.yaml | 246 ++++++++++++++++++ .../albany_input.ais_8to30km.yaml | 246 ++++++++++++++++++ .../albany_input.aisgis20km.yaml | 231 ++++++++++++++++ .../albany_input.gis_1to10km_r01.yaml | 231 ++++++++++++++++ ...yaml => albany_input.gis_1to10km_r02.yaml} | 118 +++++---- .../albany_input.gis_20km_r01.yaml | 231 ++++++++++++++++ .../mpas-albany-landice/cime_config/buildnml | 6 +- 8 files changed, 1479 insertions(+), 61 deletions(-) create mode 100644 components/mpas-albany-landice/bld/namelist_files/albany_input.ais20km.yaml create mode 100644 components/mpas-albany-landice/bld/namelist_files/albany_input.ais_4to20km.yaml create mode 100644 components/mpas-albany-landice/bld/namelist_files/albany_input.ais_8to30km.yaml create mode 100644 components/mpas-albany-landice/bld/namelist_files/albany_input.aisgis20km.yaml create mode 100644 components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r01.yaml rename components/mpas-albany-landice/bld/namelist_files/{albany_input.yaml => albany_input.gis_1to10km_r02.yaml} (81%) create mode 100644 components/mpas-albany-landice/bld/namelist_files/albany_input.gis_20km_r01.yaml diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.ais20km.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.ais20km.yaml new file mode 100644 index 00000000000..589e163bba7 --- /dev/null +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.ais20km.yaml @@ -0,0 +1,231 @@ +%YAML 1.1 +--- +ANONYMOUS: + +# Discretization Description + Discretization: + #Exodus Output File Name: albany_output.exo + + Piro: +# Nonlinear Solver Information + NOX: + Nonlinear Solver: Line Search Based + Line Search: + Full Step: + Full Step: 1.0e+00 + Method: Backtrack + Solver Options: + Status Test Check Type: Minimal + Status Tests: + Test Type: Combo + Combo Type: OR + Number of Tests: 2 + Test 0: + Test Type: Combo + Combo Type: AND + Number of Tests: 2 + Test 0: + Test Type: NormF + Norm Type: Two Norm + Scale Type: Unscaled + Tolerance: 1.0e-03 + Test 1: + Test Type: RelativeNormF + Norm Type: Two Norm + Tolerance: 0.9999 + Test 1: + Test Type: MaxIters + Maximum Iterations: 100 + Printing: + Output Precision: 3 + Output Processor: 0 + Output Information: + Error: true + Warning: true + Outer Iteration: true + Parameters: false + Details: false + Linear Solver Details: false + Stepper Iteration: true + Stepper Details: true + Stepper Parameters: true + + Direction: + Method: Newton + Newton: + Forcing Term Method: Type 2 + Rescue Bad Newton Solve: true + Linear Solver: + Write Linear System: false + Tolerance: 1.0e-8 + + Stratimikos Linear Solver: + Stratimikos: + +# Linear Solver Information + Linear Solver Type: Belos + Linear Solver Types: + Belos: + Solver Type: Block GMRES + Solver Types: + Block GMRES: + Output Frequency: 20 + Output Style: 1 + Verbosity: 33 + Maximum Iterations: 200 + Block Size: 1 + Num Blocks: 200 + Flexible Gmres: false + VerboseObject: + Output File: none + Verbosity Level: low + +# Preconditioner Information + Preconditioner Type: MueLu + Preconditioner Types: + + Ifpack2: + Overlap: 1 + Prec Type: ILUT + + MueLu: + Matrix: + PDE equations: 2 + Factories: + myLineDetectionFact: + factory: LineDetectionFactory + 'linedetection: orientation': coordinates + mySemiCoarsenPFact1: + factory: SemiCoarsenPFactory + 'semicoarsen: coarsen rate': 14 + UncoupledAggregationFact2: + factory: UncoupledAggregationFactory + 'aggregation: ordering': graph + 'aggregation: max selected neighbors': 0 + 'aggregation: min agg size': 3 + 'aggregation: phase3 avoid singletons': true + MyCoarseMap2: + factory: CoarseMapFactory + Aggregates: UncoupledAggregationFact2 + myTentativePFact2: + 'tentative: calculate qr': true + factory: TentativePFactory + Aggregates: UncoupledAggregationFact2 + CoarseMap: MyCoarseMap2 + mySaPFact2: + 'sa: eigenvalue estimate num iterations': 10 + 'sa: damping factor': 1.33333e+00 + factory: SaPFactory + P: myTentativePFact2 + myTransferCoordinatesFact: + factory: CoordinatesTransferFactory + CoarseMap: MyCoarseMap2 + Aggregates: UncoupledAggregationFact2 + myTogglePFact: + factory: TogglePFactory + 'semicoarsen: number of levels': 2 + TransferFactories: + P1: mySemiCoarsenPFact1 + P2: mySaPFact2 + Ptent1: mySemiCoarsenPFact1 + Ptent2: myTentativePFact2 + Nullspace1: mySemiCoarsenPFact1 + Nullspace2: myTentativePFact2 + myRestrictorFact: + factory: TransPFactory + P: myTogglePFact + myToggleTransferCoordinatesFact: + factory: ToggleCoordinatesTransferFactory + Chosen P: myTogglePFact + TransferFactories: + Coordinates1: mySemiCoarsenPFact1 + Coordinates2: myTransferCoordinatesFact + myRAPFact: + factory: RAPFactory + P: myTogglePFact + R: myRestrictorFact + TransferFactories: + For Coordinates: myToggleTransferCoordinatesFact + myRepartitionHeuristicFact: + factory: RepartitionHeuristicFactory + A: myRAPFact + 'repartition: min rows per proc': 3000 + 'repartition: max imbalance': 1.327e+00 + 'repartition: start level': 1 + myZoltanInterface: + factory: ZoltanInterface + A: myRAPFact + Coordinates: myToggleTransferCoordinatesFact + number of partitions: myRepartitionHeuristicFact + myRepartitionFact: + factory: RepartitionFactory + A: myRAPFact + Partition: myZoltanInterface + 'repartition: remap parts': true + number of partitions: myRepartitionHeuristicFact + myRebalanceProlongatorFact: + factory: RebalanceTransferFactory + type: Interpolation + P: myTogglePFact + Coordinates: myToggleTransferCoordinatesFact + Nullspace: myTogglePFact + myRebalanceRestrictionFact: + factory: RebalanceTransferFactory + type: Restriction + R: myRestrictorFact + myRebalanceAFact: + factory: RebalanceAcFactory + A: myRAPFact + TransferFactories: { } + mySmoother1: + factory: TrilinosSmoother + type: LINESMOOTHING_BANDEDRELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother3: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother4: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': pre + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 4 + 'relaxation: damping factor': 1.0 + Hierarchy: + max levels: 7 + 'coarse: max size': 2000 + verbosity: None + Finest: + Smoother: mySmoother1 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + All: + startLevel: 1 + Smoother: mySmoother4 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.ais_4to20km.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.ais_4to20km.yaml new file mode 100644 index 00000000000..c3bc0cf8bd5 --- /dev/null +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.ais_4to20km.yaml @@ -0,0 +1,246 @@ +%YAML 1.1 +--- +ANONYMOUS: + Problem: + Basal Cubature Degree: 4 + LandIce Field Norm: + sliding_velocity_basalside: + Regularization Type: Given Value + Regularization Value: 1.0e-4 + LandIce BCs: + BC 0: + Basal Friction Coefficient: + Type: Power Law + Power Exponent: 0.2 + Mu Type: Field + Effective Pressure Type: Constant + Effective Pressure: 1.0 + # Zero Effective Pressure On Floating Ice At Nodes: true + Zero Beta On Floating Ice: true +# Discretization Description + Discretization: + #Exodus Output File Name: albany_output.exo + + Piro: +# Nonlinear Solver Information + NOX: + Nonlinear Solver: Line Search Based + Line Search: + Full Step: + Full Step: 1.0e+00 + Method: Backtrack + Solver Options: + Status Test Check Type: Minimal + Status Tests: + Test Type: Combo + Combo Type: OR + Number of Tests: 2 + Test 0: + Test Type: Combo + Combo Type: AND + Number of Tests: 2 + Test 0: + Test Type: NormF + Norm Type: Two Norm + Scale Type: Unscaled + Tolerance: 1.0e-03 + Test 1: + Test Type: RelativeNormF + Norm Type: Two Norm + Tolerance: 0.9999 + Test 1: + Test Type: MaxIters + Maximum Iterations: 100 + Printing: + Output Precision: 3 + Output Processor: 0 + Output Information: + Error: true + Warning: true + Outer Iteration: true + Parameters: false + Details: false + Linear Solver Details: false + Stepper Iteration: true + Stepper Details: true + Stepper Parameters: true + + Direction: + Method: Newton + Newton: + Forcing Term Method: Type 2 + Rescue Bad Newton Solve: true + Linear Solver: + Write Linear System: false + Tolerance: 1.0e-8 + + Stratimikos Linear Solver: + Stratimikos: + +# Linear Solver Information + Linear Solver Type: Belos + Linear Solver Types: + Belos: + Solver Type: Block GMRES + Solver Types: + Block GMRES: + Output Frequency: 20 + Output Style: 1 + Verbosity: 33 + Maximum Iterations: 200 + Block Size: 1 + Num Blocks: 200 + Flexible Gmres: false + VerboseObject: + Output File: none + Verbosity Level: low + +# Preconditioner Information + Preconditioner Type: MueLu + Preconditioner Types: + + Ifpack2: + Overlap: 1 + Prec Type: ILUT + + MueLu: + Matrix: + PDE equations: 2 + Factories: + myLineDetectionFact: + factory: LineDetectionFactory + 'linedetection: orientation': coordinates + mySemiCoarsenPFact1: + factory: SemiCoarsenPFactory + 'semicoarsen: coarsen rate': 14 + UncoupledAggregationFact2: + factory: UncoupledAggregationFactory + 'aggregation: ordering': graph + 'aggregation: max selected neighbors': 0 + 'aggregation: min agg size': 3 + 'aggregation: phase3 avoid singletons': true + MyCoarseMap2: + factory: CoarseMapFactory + Aggregates: UncoupledAggregationFact2 + myTentativePFact2: + 'tentative: calculate qr': true + factory: TentativePFactory + Aggregates: UncoupledAggregationFact2 + CoarseMap: MyCoarseMap2 + mySaPFact2: + 'sa: eigenvalue estimate num iterations': 10 + 'sa: damping factor': 1.33333e+00 + factory: SaPFactory + P: myTentativePFact2 + myTransferCoordinatesFact: + factory: CoordinatesTransferFactory + CoarseMap: MyCoarseMap2 + Aggregates: UncoupledAggregationFact2 + myTogglePFact: + factory: TogglePFactory + 'semicoarsen: number of levels': 2 + TransferFactories: + P1: mySemiCoarsenPFact1 + P2: mySaPFact2 + Ptent1: mySemiCoarsenPFact1 + Ptent2: myTentativePFact2 + Nullspace1: mySemiCoarsenPFact1 + Nullspace2: myTentativePFact2 + myRestrictorFact: + factory: TransPFactory + P: myTogglePFact + myToggleTransferCoordinatesFact: + factory: ToggleCoordinatesTransferFactory + Chosen P: myTogglePFact + TransferFactories: + Coordinates1: mySemiCoarsenPFact1 + Coordinates2: myTransferCoordinatesFact + myRAPFact: + factory: RAPFactory + P: myTogglePFact + R: myRestrictorFact + TransferFactories: + For Coordinates: myToggleTransferCoordinatesFact + myRepartitionHeuristicFact: + factory: RepartitionHeuristicFactory + A: myRAPFact + 'repartition: min rows per proc': 3000 + 'repartition: max imbalance': 1.327e+00 + 'repartition: start level': 1 + myZoltanInterface: + factory: ZoltanInterface + A: myRAPFact + Coordinates: myToggleTransferCoordinatesFact + number of partitions: myRepartitionHeuristicFact + myRepartitionFact: + factory: RepartitionFactory + A: myRAPFact + Partition: myZoltanInterface + 'repartition: remap parts': true + number of partitions: myRepartitionHeuristicFact + myRebalanceProlongatorFact: + factory: RebalanceTransferFactory + type: Interpolation + P: myTogglePFact + Coordinates: myToggleTransferCoordinatesFact + Nullspace: myTogglePFact + myRebalanceRestrictionFact: + factory: RebalanceTransferFactory + type: Restriction + R: myRestrictorFact + myRebalanceAFact: + factory: RebalanceAcFactory + A: myRAPFact + TransferFactories: { } + mySmoother1: + factory: TrilinosSmoother + type: LINESMOOTHING_BANDEDRELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother3: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother4: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': pre + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 4 + 'relaxation: damping factor': 1.0 + Hierarchy: + max levels: 7 + 'coarse: max size': 2000 + verbosity: None + Finest: + Smoother: mySmoother1 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + All: + startLevel: 1 + Smoother: mySmoother4 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.ais_8to30km.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.ais_8to30km.yaml new file mode 100644 index 00000000000..c3bc0cf8bd5 --- /dev/null +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.ais_8to30km.yaml @@ -0,0 +1,246 @@ +%YAML 1.1 +--- +ANONYMOUS: + Problem: + Basal Cubature Degree: 4 + LandIce Field Norm: + sliding_velocity_basalside: + Regularization Type: Given Value + Regularization Value: 1.0e-4 + LandIce BCs: + BC 0: + Basal Friction Coefficient: + Type: Power Law + Power Exponent: 0.2 + Mu Type: Field + Effective Pressure Type: Constant + Effective Pressure: 1.0 + # Zero Effective Pressure On Floating Ice At Nodes: true + Zero Beta On Floating Ice: true +# Discretization Description + Discretization: + #Exodus Output File Name: albany_output.exo + + Piro: +# Nonlinear Solver Information + NOX: + Nonlinear Solver: Line Search Based + Line Search: + Full Step: + Full Step: 1.0e+00 + Method: Backtrack + Solver Options: + Status Test Check Type: Minimal + Status Tests: + Test Type: Combo + Combo Type: OR + Number of Tests: 2 + Test 0: + Test Type: Combo + Combo Type: AND + Number of Tests: 2 + Test 0: + Test Type: NormF + Norm Type: Two Norm + Scale Type: Unscaled + Tolerance: 1.0e-03 + Test 1: + Test Type: RelativeNormF + Norm Type: Two Norm + Tolerance: 0.9999 + Test 1: + Test Type: MaxIters + Maximum Iterations: 100 + Printing: + Output Precision: 3 + Output Processor: 0 + Output Information: + Error: true + Warning: true + Outer Iteration: true + Parameters: false + Details: false + Linear Solver Details: false + Stepper Iteration: true + Stepper Details: true + Stepper Parameters: true + + Direction: + Method: Newton + Newton: + Forcing Term Method: Type 2 + Rescue Bad Newton Solve: true + Linear Solver: + Write Linear System: false + Tolerance: 1.0e-8 + + Stratimikos Linear Solver: + Stratimikos: + +# Linear Solver Information + Linear Solver Type: Belos + Linear Solver Types: + Belos: + Solver Type: Block GMRES + Solver Types: + Block GMRES: + Output Frequency: 20 + Output Style: 1 + Verbosity: 33 + Maximum Iterations: 200 + Block Size: 1 + Num Blocks: 200 + Flexible Gmres: false + VerboseObject: + Output File: none + Verbosity Level: low + +# Preconditioner Information + Preconditioner Type: MueLu + Preconditioner Types: + + Ifpack2: + Overlap: 1 + Prec Type: ILUT + + MueLu: + Matrix: + PDE equations: 2 + Factories: + myLineDetectionFact: + factory: LineDetectionFactory + 'linedetection: orientation': coordinates + mySemiCoarsenPFact1: + factory: SemiCoarsenPFactory + 'semicoarsen: coarsen rate': 14 + UncoupledAggregationFact2: + factory: UncoupledAggregationFactory + 'aggregation: ordering': graph + 'aggregation: max selected neighbors': 0 + 'aggregation: min agg size': 3 + 'aggregation: phase3 avoid singletons': true + MyCoarseMap2: + factory: CoarseMapFactory + Aggregates: UncoupledAggregationFact2 + myTentativePFact2: + 'tentative: calculate qr': true + factory: TentativePFactory + Aggregates: UncoupledAggregationFact2 + CoarseMap: MyCoarseMap2 + mySaPFact2: + 'sa: eigenvalue estimate num iterations': 10 + 'sa: damping factor': 1.33333e+00 + factory: SaPFactory + P: myTentativePFact2 + myTransferCoordinatesFact: + factory: CoordinatesTransferFactory + CoarseMap: MyCoarseMap2 + Aggregates: UncoupledAggregationFact2 + myTogglePFact: + factory: TogglePFactory + 'semicoarsen: number of levels': 2 + TransferFactories: + P1: mySemiCoarsenPFact1 + P2: mySaPFact2 + Ptent1: mySemiCoarsenPFact1 + Ptent2: myTentativePFact2 + Nullspace1: mySemiCoarsenPFact1 + Nullspace2: myTentativePFact2 + myRestrictorFact: + factory: TransPFactory + P: myTogglePFact + myToggleTransferCoordinatesFact: + factory: ToggleCoordinatesTransferFactory + Chosen P: myTogglePFact + TransferFactories: + Coordinates1: mySemiCoarsenPFact1 + Coordinates2: myTransferCoordinatesFact + myRAPFact: + factory: RAPFactory + P: myTogglePFact + R: myRestrictorFact + TransferFactories: + For Coordinates: myToggleTransferCoordinatesFact + myRepartitionHeuristicFact: + factory: RepartitionHeuristicFactory + A: myRAPFact + 'repartition: min rows per proc': 3000 + 'repartition: max imbalance': 1.327e+00 + 'repartition: start level': 1 + myZoltanInterface: + factory: ZoltanInterface + A: myRAPFact + Coordinates: myToggleTransferCoordinatesFact + number of partitions: myRepartitionHeuristicFact + myRepartitionFact: + factory: RepartitionFactory + A: myRAPFact + Partition: myZoltanInterface + 'repartition: remap parts': true + number of partitions: myRepartitionHeuristicFact + myRebalanceProlongatorFact: + factory: RebalanceTransferFactory + type: Interpolation + P: myTogglePFact + Coordinates: myToggleTransferCoordinatesFact + Nullspace: myTogglePFact + myRebalanceRestrictionFact: + factory: RebalanceTransferFactory + type: Restriction + R: myRestrictorFact + myRebalanceAFact: + factory: RebalanceAcFactory + A: myRAPFact + TransferFactories: { } + mySmoother1: + factory: TrilinosSmoother + type: LINESMOOTHING_BANDEDRELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother3: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother4: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': pre + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 4 + 'relaxation: damping factor': 1.0 + Hierarchy: + max levels: 7 + 'coarse: max size': 2000 + verbosity: None + Finest: + Smoother: mySmoother1 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + All: + startLevel: 1 + Smoother: mySmoother4 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.aisgis20km.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.aisgis20km.yaml new file mode 100644 index 00000000000..589e163bba7 --- /dev/null +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.aisgis20km.yaml @@ -0,0 +1,231 @@ +%YAML 1.1 +--- +ANONYMOUS: + +# Discretization Description + Discretization: + #Exodus Output File Name: albany_output.exo + + Piro: +# Nonlinear Solver Information + NOX: + Nonlinear Solver: Line Search Based + Line Search: + Full Step: + Full Step: 1.0e+00 + Method: Backtrack + Solver Options: + Status Test Check Type: Minimal + Status Tests: + Test Type: Combo + Combo Type: OR + Number of Tests: 2 + Test 0: + Test Type: Combo + Combo Type: AND + Number of Tests: 2 + Test 0: + Test Type: NormF + Norm Type: Two Norm + Scale Type: Unscaled + Tolerance: 1.0e-03 + Test 1: + Test Type: RelativeNormF + Norm Type: Two Norm + Tolerance: 0.9999 + Test 1: + Test Type: MaxIters + Maximum Iterations: 100 + Printing: + Output Precision: 3 + Output Processor: 0 + Output Information: + Error: true + Warning: true + Outer Iteration: true + Parameters: false + Details: false + Linear Solver Details: false + Stepper Iteration: true + Stepper Details: true + Stepper Parameters: true + + Direction: + Method: Newton + Newton: + Forcing Term Method: Type 2 + Rescue Bad Newton Solve: true + Linear Solver: + Write Linear System: false + Tolerance: 1.0e-8 + + Stratimikos Linear Solver: + Stratimikos: + +# Linear Solver Information + Linear Solver Type: Belos + Linear Solver Types: + Belos: + Solver Type: Block GMRES + Solver Types: + Block GMRES: + Output Frequency: 20 + Output Style: 1 + Verbosity: 33 + Maximum Iterations: 200 + Block Size: 1 + Num Blocks: 200 + Flexible Gmres: false + VerboseObject: + Output File: none + Verbosity Level: low + +# Preconditioner Information + Preconditioner Type: MueLu + Preconditioner Types: + + Ifpack2: + Overlap: 1 + Prec Type: ILUT + + MueLu: + Matrix: + PDE equations: 2 + Factories: + myLineDetectionFact: + factory: LineDetectionFactory + 'linedetection: orientation': coordinates + mySemiCoarsenPFact1: + factory: SemiCoarsenPFactory + 'semicoarsen: coarsen rate': 14 + UncoupledAggregationFact2: + factory: UncoupledAggregationFactory + 'aggregation: ordering': graph + 'aggregation: max selected neighbors': 0 + 'aggregation: min agg size': 3 + 'aggregation: phase3 avoid singletons': true + MyCoarseMap2: + factory: CoarseMapFactory + Aggregates: UncoupledAggregationFact2 + myTentativePFact2: + 'tentative: calculate qr': true + factory: TentativePFactory + Aggregates: UncoupledAggregationFact2 + CoarseMap: MyCoarseMap2 + mySaPFact2: + 'sa: eigenvalue estimate num iterations': 10 + 'sa: damping factor': 1.33333e+00 + factory: SaPFactory + P: myTentativePFact2 + myTransferCoordinatesFact: + factory: CoordinatesTransferFactory + CoarseMap: MyCoarseMap2 + Aggregates: UncoupledAggregationFact2 + myTogglePFact: + factory: TogglePFactory + 'semicoarsen: number of levels': 2 + TransferFactories: + P1: mySemiCoarsenPFact1 + P2: mySaPFact2 + Ptent1: mySemiCoarsenPFact1 + Ptent2: myTentativePFact2 + Nullspace1: mySemiCoarsenPFact1 + Nullspace2: myTentativePFact2 + myRestrictorFact: + factory: TransPFactory + P: myTogglePFact + myToggleTransferCoordinatesFact: + factory: ToggleCoordinatesTransferFactory + Chosen P: myTogglePFact + TransferFactories: + Coordinates1: mySemiCoarsenPFact1 + Coordinates2: myTransferCoordinatesFact + myRAPFact: + factory: RAPFactory + P: myTogglePFact + R: myRestrictorFact + TransferFactories: + For Coordinates: myToggleTransferCoordinatesFact + myRepartitionHeuristicFact: + factory: RepartitionHeuristicFactory + A: myRAPFact + 'repartition: min rows per proc': 3000 + 'repartition: max imbalance': 1.327e+00 + 'repartition: start level': 1 + myZoltanInterface: + factory: ZoltanInterface + A: myRAPFact + Coordinates: myToggleTransferCoordinatesFact + number of partitions: myRepartitionHeuristicFact + myRepartitionFact: + factory: RepartitionFactory + A: myRAPFact + Partition: myZoltanInterface + 'repartition: remap parts': true + number of partitions: myRepartitionHeuristicFact + myRebalanceProlongatorFact: + factory: RebalanceTransferFactory + type: Interpolation + P: myTogglePFact + Coordinates: myToggleTransferCoordinatesFact + Nullspace: myTogglePFact + myRebalanceRestrictionFact: + factory: RebalanceTransferFactory + type: Restriction + R: myRestrictorFact + myRebalanceAFact: + factory: RebalanceAcFactory + A: myRAPFact + TransferFactories: { } + mySmoother1: + factory: TrilinosSmoother + type: LINESMOOTHING_BANDEDRELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother3: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother4: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': pre + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 4 + 'relaxation: damping factor': 1.0 + Hierarchy: + max levels: 7 + 'coarse: max size': 2000 + verbosity: None + Finest: + Smoother: mySmoother1 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + All: + startLevel: 1 + Smoother: mySmoother4 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r01.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r01.yaml new file mode 100644 index 00000000000..589e163bba7 --- /dev/null +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r01.yaml @@ -0,0 +1,231 @@ +%YAML 1.1 +--- +ANONYMOUS: + +# Discretization Description + Discretization: + #Exodus Output File Name: albany_output.exo + + Piro: +# Nonlinear Solver Information + NOX: + Nonlinear Solver: Line Search Based + Line Search: + Full Step: + Full Step: 1.0e+00 + Method: Backtrack + Solver Options: + Status Test Check Type: Minimal + Status Tests: + Test Type: Combo + Combo Type: OR + Number of Tests: 2 + Test 0: + Test Type: Combo + Combo Type: AND + Number of Tests: 2 + Test 0: + Test Type: NormF + Norm Type: Two Norm + Scale Type: Unscaled + Tolerance: 1.0e-03 + Test 1: + Test Type: RelativeNormF + Norm Type: Two Norm + Tolerance: 0.9999 + Test 1: + Test Type: MaxIters + Maximum Iterations: 100 + Printing: + Output Precision: 3 + Output Processor: 0 + Output Information: + Error: true + Warning: true + Outer Iteration: true + Parameters: false + Details: false + Linear Solver Details: false + Stepper Iteration: true + Stepper Details: true + Stepper Parameters: true + + Direction: + Method: Newton + Newton: + Forcing Term Method: Type 2 + Rescue Bad Newton Solve: true + Linear Solver: + Write Linear System: false + Tolerance: 1.0e-8 + + Stratimikos Linear Solver: + Stratimikos: + +# Linear Solver Information + Linear Solver Type: Belos + Linear Solver Types: + Belos: + Solver Type: Block GMRES + Solver Types: + Block GMRES: + Output Frequency: 20 + Output Style: 1 + Verbosity: 33 + Maximum Iterations: 200 + Block Size: 1 + Num Blocks: 200 + Flexible Gmres: false + VerboseObject: + Output File: none + Verbosity Level: low + +# Preconditioner Information + Preconditioner Type: MueLu + Preconditioner Types: + + Ifpack2: + Overlap: 1 + Prec Type: ILUT + + MueLu: + Matrix: + PDE equations: 2 + Factories: + myLineDetectionFact: + factory: LineDetectionFactory + 'linedetection: orientation': coordinates + mySemiCoarsenPFact1: + factory: SemiCoarsenPFactory + 'semicoarsen: coarsen rate': 14 + UncoupledAggregationFact2: + factory: UncoupledAggregationFactory + 'aggregation: ordering': graph + 'aggregation: max selected neighbors': 0 + 'aggregation: min agg size': 3 + 'aggregation: phase3 avoid singletons': true + MyCoarseMap2: + factory: CoarseMapFactory + Aggregates: UncoupledAggregationFact2 + myTentativePFact2: + 'tentative: calculate qr': true + factory: TentativePFactory + Aggregates: UncoupledAggregationFact2 + CoarseMap: MyCoarseMap2 + mySaPFact2: + 'sa: eigenvalue estimate num iterations': 10 + 'sa: damping factor': 1.33333e+00 + factory: SaPFactory + P: myTentativePFact2 + myTransferCoordinatesFact: + factory: CoordinatesTransferFactory + CoarseMap: MyCoarseMap2 + Aggregates: UncoupledAggregationFact2 + myTogglePFact: + factory: TogglePFactory + 'semicoarsen: number of levels': 2 + TransferFactories: + P1: mySemiCoarsenPFact1 + P2: mySaPFact2 + Ptent1: mySemiCoarsenPFact1 + Ptent2: myTentativePFact2 + Nullspace1: mySemiCoarsenPFact1 + Nullspace2: myTentativePFact2 + myRestrictorFact: + factory: TransPFactory + P: myTogglePFact + myToggleTransferCoordinatesFact: + factory: ToggleCoordinatesTransferFactory + Chosen P: myTogglePFact + TransferFactories: + Coordinates1: mySemiCoarsenPFact1 + Coordinates2: myTransferCoordinatesFact + myRAPFact: + factory: RAPFactory + P: myTogglePFact + R: myRestrictorFact + TransferFactories: + For Coordinates: myToggleTransferCoordinatesFact + myRepartitionHeuristicFact: + factory: RepartitionHeuristicFactory + A: myRAPFact + 'repartition: min rows per proc': 3000 + 'repartition: max imbalance': 1.327e+00 + 'repartition: start level': 1 + myZoltanInterface: + factory: ZoltanInterface + A: myRAPFact + Coordinates: myToggleTransferCoordinatesFact + number of partitions: myRepartitionHeuristicFact + myRepartitionFact: + factory: RepartitionFactory + A: myRAPFact + Partition: myZoltanInterface + 'repartition: remap parts': true + number of partitions: myRepartitionHeuristicFact + myRebalanceProlongatorFact: + factory: RebalanceTransferFactory + type: Interpolation + P: myTogglePFact + Coordinates: myToggleTransferCoordinatesFact + Nullspace: myTogglePFact + myRebalanceRestrictionFact: + factory: RebalanceTransferFactory + type: Restriction + R: myRestrictorFact + myRebalanceAFact: + factory: RebalanceAcFactory + A: myRAPFact + TransferFactories: { } + mySmoother1: + factory: TrilinosSmoother + type: LINESMOOTHING_BANDEDRELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother3: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother4: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': pre + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 4 + 'relaxation: damping factor': 1.0 + Hierarchy: + max levels: 7 + 'coarse: max size': 2000 + verbosity: None + Finest: + Smoother: mySmoother1 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + All: + startLevel: 1 + Smoother: mySmoother4 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r02.yaml similarity index 81% rename from components/mpas-albany-landice/bld/namelist_files/albany_input.yaml rename to components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r02.yaml index 8b770a290ae..2b70fd9b30f 100644 --- a/components/mpas-albany-landice/bld/namelist_files/albany_input.yaml +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r02.yaml @@ -12,35 +12,34 @@ ANONYMOUS: Basal Friction Coefficient: Type: Power Law Power Exponent: 1.0 - Mu Type: Field + Mu Type: Field Effective Pressure Type: Hydrostatic Computed At Nodes Zero Effective Pressure On Floating Ice At Nodes: true Zero Beta On Floating Ice: false Use Pressurized Bed Above Sea Level: false - # Discretization Description Discretization: #Exodus Output File Name: albany_output.exo - - Piro: + + Piro: # Nonlinear Solver Information - NOX: + NOX: Nonlinear Solver: Line Search Based - Line Search: - Full Step: + Line Search: + Full Step: Full Step: 1.0e+00 Method: Backtrack - Solver Options: + Solver Options: Status Test Check Type: Minimal - Status Tests: + Status Tests: Test Type: Combo Combo Type: OR Number of Tests: 2 - Test 0: + Test 0: Test Type: Combo Combo Type: AND Number of Tests: 2 - Test 0: + Test 0: Test Type: NormF Norm Type: Two Norm Scale Type: Unscaled @@ -49,13 +48,13 @@ ANONYMOUS: Test Type: RelativeNormF Norm Type: Two Norm Tolerance: 0.9999 - Test 1: + Test 1: Test Type: MaxIters Maximum Iterations: 100 - Printing: + Printing: Output Precision: 3 Output Processor: 0 - Output Information: + Output Information: Error: true Warning: true Outer Iteration: true @@ -66,21 +65,21 @@ ANONYMOUS: Stepper Details: true Stepper Parameters: true - Direction: + Direction: Method: Newton - Newton: - Forcing Term Method: Type 2 + Newton: + Forcing Term Method: Type 2 Rescue Bad Newton Solve: true Linear Solver: Write Linear System: false Tolerance: 1.0e-8 - - Stratimikos Linear Solver: + + Stratimikos Linear Solver: Stratimikos: - + # Linear Solver Information Linear Solver Type: Belos - Linear Solver Types: + Linear Solver Types: Belos: Solver Type: Block GMRES Solver Types: @@ -95,133 +94,133 @@ ANONYMOUS: VerboseObject: Output File: none Verbosity Level: low - + # Preconditioner Information Preconditioner Type: MueLu - Preconditioner Types: - - Ifpack2: + Preconditioner Types: + + Ifpack2: Overlap: 1 - Prec Type: ILUT - - MueLu: - Matrix: + Prec Type: ILUT + + MueLu: + Matrix: PDE equations: 2 - Factories: - myLineDetectionFact: + Factories: + myLineDetectionFact: factory: LineDetectionFactory 'linedetection: orientation': coordinates - mySemiCoarsenPFact1: + mySemiCoarsenPFact1: factory: SemiCoarsenPFactory 'semicoarsen: coarsen rate': 14 - UncoupledAggregationFact2: + UncoupledAggregationFact2: factory: UncoupledAggregationFactory 'aggregation: ordering': graph 'aggregation: max selected neighbors': 0 'aggregation: min agg size': 3 'aggregation: phase3 avoid singletons': true - MyCoarseMap2: + MyCoarseMap2: factory: CoarseMapFactory Aggregates: UncoupledAggregationFact2 - myTentativePFact2: + myTentativePFact2: 'tentative: calculate qr': true factory: TentativePFactory Aggregates: UncoupledAggregationFact2 CoarseMap: MyCoarseMap2 - mySaPFact2: + mySaPFact2: 'sa: eigenvalue estimate num iterations': 10 'sa: damping factor': 1.33333e+00 factory: SaPFactory P: myTentativePFact2 - myTransferCoordinatesFact: + myTransferCoordinatesFact: factory: CoordinatesTransferFactory CoarseMap: MyCoarseMap2 Aggregates: UncoupledAggregationFact2 - myTogglePFact: + myTogglePFact: factory: TogglePFactory 'semicoarsen: number of levels': 2 - TransferFactories: + TransferFactories: P1: mySemiCoarsenPFact1 P2: mySaPFact2 Ptent1: mySemiCoarsenPFact1 Ptent2: myTentativePFact2 Nullspace1: mySemiCoarsenPFact1 Nullspace2: myTentativePFact2 - myRestrictorFact: + myRestrictorFact: factory: TransPFactory P: myTogglePFact - myToggleTransferCoordinatesFact: + myToggleTransferCoordinatesFact: factory: ToggleCoordinatesTransferFactory Chosen P: myTogglePFact - TransferFactories: + TransferFactories: Coordinates1: mySemiCoarsenPFact1 Coordinates2: myTransferCoordinatesFact - myRAPFact: + myRAPFact: factory: RAPFactory P: myTogglePFact R: myRestrictorFact - TransferFactories: + TransferFactories: For Coordinates: myToggleTransferCoordinatesFact - myRepartitionHeuristicFact: + myRepartitionHeuristicFact: factory: RepartitionHeuristicFactory A: myRAPFact 'repartition: min rows per proc': 3000 'repartition: max imbalance': 1.327e+00 'repartition: start level': 1 - myZoltanInterface: + myZoltanInterface: factory: ZoltanInterface A: myRAPFact Coordinates: myToggleTransferCoordinatesFact number of partitions: myRepartitionHeuristicFact - myRepartitionFact: + myRepartitionFact: factory: RepartitionFactory A: myRAPFact Partition: myZoltanInterface 'repartition: remap parts': true number of partitions: myRepartitionHeuristicFact - myRebalanceProlongatorFact: + myRebalanceProlongatorFact: factory: RebalanceTransferFactory type: Interpolation P: myTogglePFact Coordinates: myToggleTransferCoordinatesFact Nullspace: myTogglePFact - myRebalanceRestrictionFact: + myRebalanceRestrictionFact: factory: RebalanceTransferFactory type: Restriction R: myRestrictorFact - myRebalanceAFact: + myRebalanceAFact: factory: RebalanceAcFactory A: myRAPFact TransferFactories: { } - mySmoother1: + mySmoother1: factory: TrilinosSmoother type: LINESMOOTHING_BANDEDRELAXATION 'smoother: pre or post': both - ParameterList: + ParameterList: 'relaxation: type': Gauss-Seidel 'relaxation: sweeps': 1 'relaxation: damping factor': 1.0 - mySmoother3: + mySmoother3: factory: TrilinosSmoother type: RELAXATION 'smoother: pre or post': both - ParameterList: + ParameterList: 'relaxation: type': Gauss-Seidel 'relaxation: sweeps': 1 'relaxation: damping factor': 1.0 - mySmoother4: + mySmoother4: factory: TrilinosSmoother type: RELAXATION 'smoother: pre or post': pre - ParameterList: + ParameterList: 'relaxation: type': Gauss-Seidel 'relaxation: sweeps': 4 'relaxation: damping factor': 1.0 - Hierarchy: + Hierarchy: max levels: 7 'coarse: max size': 2000 verbosity: None - Finest: + Finest: Smoother: mySmoother1 CoarseSolver: mySmoother4 P: myRebalanceProlongatorFact @@ -232,7 +231,7 @@ ANONYMOUS: A: myRebalanceAFact Coordinates: myRebalanceProlongatorFact Importer: myRepartitionFact - All: + All: startLevel: 1 Smoother: mySmoother4 CoarseSolver: mySmoother4 @@ -244,4 +243,3 @@ ANONYMOUS: A: myRebalanceAFact Coordinates: myRebalanceProlongatorFact Importer: myRepartitionFact - diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_20km_r01.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_20km_r01.yaml new file mode 100644 index 00000000000..589e163bba7 --- /dev/null +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_20km_r01.yaml @@ -0,0 +1,231 @@ +%YAML 1.1 +--- +ANONYMOUS: + +# Discretization Description + Discretization: + #Exodus Output File Name: albany_output.exo + + Piro: +# Nonlinear Solver Information + NOX: + Nonlinear Solver: Line Search Based + Line Search: + Full Step: + Full Step: 1.0e+00 + Method: Backtrack + Solver Options: + Status Test Check Type: Minimal + Status Tests: + Test Type: Combo + Combo Type: OR + Number of Tests: 2 + Test 0: + Test Type: Combo + Combo Type: AND + Number of Tests: 2 + Test 0: + Test Type: NormF + Norm Type: Two Norm + Scale Type: Unscaled + Tolerance: 1.0e-03 + Test 1: + Test Type: RelativeNormF + Norm Type: Two Norm + Tolerance: 0.9999 + Test 1: + Test Type: MaxIters + Maximum Iterations: 100 + Printing: + Output Precision: 3 + Output Processor: 0 + Output Information: + Error: true + Warning: true + Outer Iteration: true + Parameters: false + Details: false + Linear Solver Details: false + Stepper Iteration: true + Stepper Details: true + Stepper Parameters: true + + Direction: + Method: Newton + Newton: + Forcing Term Method: Type 2 + Rescue Bad Newton Solve: true + Linear Solver: + Write Linear System: false + Tolerance: 1.0e-8 + + Stratimikos Linear Solver: + Stratimikos: + +# Linear Solver Information + Linear Solver Type: Belos + Linear Solver Types: + Belos: + Solver Type: Block GMRES + Solver Types: + Block GMRES: + Output Frequency: 20 + Output Style: 1 + Verbosity: 33 + Maximum Iterations: 200 + Block Size: 1 + Num Blocks: 200 + Flexible Gmres: false + VerboseObject: + Output File: none + Verbosity Level: low + +# Preconditioner Information + Preconditioner Type: MueLu + Preconditioner Types: + + Ifpack2: + Overlap: 1 + Prec Type: ILUT + + MueLu: + Matrix: + PDE equations: 2 + Factories: + myLineDetectionFact: + factory: LineDetectionFactory + 'linedetection: orientation': coordinates + mySemiCoarsenPFact1: + factory: SemiCoarsenPFactory + 'semicoarsen: coarsen rate': 14 + UncoupledAggregationFact2: + factory: UncoupledAggregationFactory + 'aggregation: ordering': graph + 'aggregation: max selected neighbors': 0 + 'aggregation: min agg size': 3 + 'aggregation: phase3 avoid singletons': true + MyCoarseMap2: + factory: CoarseMapFactory + Aggregates: UncoupledAggregationFact2 + myTentativePFact2: + 'tentative: calculate qr': true + factory: TentativePFactory + Aggregates: UncoupledAggregationFact2 + CoarseMap: MyCoarseMap2 + mySaPFact2: + 'sa: eigenvalue estimate num iterations': 10 + 'sa: damping factor': 1.33333e+00 + factory: SaPFactory + P: myTentativePFact2 + myTransferCoordinatesFact: + factory: CoordinatesTransferFactory + CoarseMap: MyCoarseMap2 + Aggregates: UncoupledAggregationFact2 + myTogglePFact: + factory: TogglePFactory + 'semicoarsen: number of levels': 2 + TransferFactories: + P1: mySemiCoarsenPFact1 + P2: mySaPFact2 + Ptent1: mySemiCoarsenPFact1 + Ptent2: myTentativePFact2 + Nullspace1: mySemiCoarsenPFact1 + Nullspace2: myTentativePFact2 + myRestrictorFact: + factory: TransPFactory + P: myTogglePFact + myToggleTransferCoordinatesFact: + factory: ToggleCoordinatesTransferFactory + Chosen P: myTogglePFact + TransferFactories: + Coordinates1: mySemiCoarsenPFact1 + Coordinates2: myTransferCoordinatesFact + myRAPFact: + factory: RAPFactory + P: myTogglePFact + R: myRestrictorFact + TransferFactories: + For Coordinates: myToggleTransferCoordinatesFact + myRepartitionHeuristicFact: + factory: RepartitionHeuristicFactory + A: myRAPFact + 'repartition: min rows per proc': 3000 + 'repartition: max imbalance': 1.327e+00 + 'repartition: start level': 1 + myZoltanInterface: + factory: ZoltanInterface + A: myRAPFact + Coordinates: myToggleTransferCoordinatesFact + number of partitions: myRepartitionHeuristicFact + myRepartitionFact: + factory: RepartitionFactory + A: myRAPFact + Partition: myZoltanInterface + 'repartition: remap parts': true + number of partitions: myRepartitionHeuristicFact + myRebalanceProlongatorFact: + factory: RebalanceTransferFactory + type: Interpolation + P: myTogglePFact + Coordinates: myToggleTransferCoordinatesFact + Nullspace: myTogglePFact + myRebalanceRestrictionFact: + factory: RebalanceTransferFactory + type: Restriction + R: myRestrictorFact + myRebalanceAFact: + factory: RebalanceAcFactory + A: myRAPFact + TransferFactories: { } + mySmoother1: + factory: TrilinosSmoother + type: LINESMOOTHING_BANDEDRELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother3: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': both + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 1 + 'relaxation: damping factor': 1.0 + mySmoother4: + factory: TrilinosSmoother + type: RELAXATION + 'smoother: pre or post': pre + ParameterList: + 'relaxation: type': Gauss-Seidel + 'relaxation: sweeps': 4 + 'relaxation: damping factor': 1.0 + Hierarchy: + max levels: 7 + 'coarse: max size': 2000 + verbosity: None + Finest: + Smoother: mySmoother1 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + All: + startLevel: 1 + Smoother: mySmoother4 + CoarseSolver: mySmoother4 + P: myRebalanceProlongatorFact + Nullspace: myRebalanceProlongatorFact + CoarseNumZLayers: myLineDetectionFact + LineDetection_Layers: myLineDetectionFact + LineDetection_VertLineIds: myLineDetectionFact + A: myRebalanceAFact + Coordinates: myRebalanceProlongatorFact + Importer: myRepartitionFact + diff --git a/components/mpas-albany-landice/cime_config/buildnml b/components/mpas-albany-landice/cime_config/buildnml index e345853f84a..a42011e5407 100755 --- a/components/mpas-albany-landice/cime_config/buildnml +++ b/components/mpas-albany-landice/cime_config/buildnml @@ -300,7 +300,11 @@ def buildnml(case, caseroot, compname): if os.path.exists("{}/SourceMods/src.mali/{}".format(caseroot, albany_input_name)): safe_copy("{}/SourceMods/src.mali/{}".format(caseroot, albany_input_name), os.path.join(rundir, albany_input_name)) else: - safe_copy("{}/components/mpas-albany-landice/bld/namelist_files/{}".format(srcroot, albany_input_name), os.path.join(rundir, albany_input_name)) + # Each supported grid should have a corresponding albany_input.yaml file in + # components/mpas-albany-landice/bld/namelist_files/ + # Naming convention is albany_input.GRID_PREFIX.yaml + albany_input_name_grid = f"albany_input.{grid_prefix}.yaml" + safe_copy(f"{srcroot}/components/mpas-albany-landice/bld/namelist_files/{albany_input_name_grid}", os.path.join(rundir, albany_input_name)) ############################################################################### def _main_func(): From 57c057e5e396ee893d1ef98edfa3275cd56ed2cf Mon Sep 17 00:00:00 2001 From: Matthew Hoffman Date: Wed, 14 Aug 2024 16:28:32 -0500 Subject: [PATCH 097/197] Update glcshelf test to use ais8to30 mesh This was not possible when the mesh was added due to issues with the treatment of temperature in MALI. Now that those issues have been resolved, this test can be updated to the newer mesh. --- cime_config/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/tests.py b/cime_config/tests.py index 059c280e2bb..183004df2dd 100644 --- a/cime_config/tests.py +++ b/cime_config/tests.py @@ -302,7 +302,7 @@ "SMS.ne30_f19_g16_rx1.A", "ERS_Ld5.T62_oQU120.CMPASO-NYF", "ERS.f09_g16_g.MALISIA", - "ERS_Ld5.TL319_oQU240wLI_ais20.MPAS_LISIO_JRA1p5.mpaso-ocn_glcshelf", + "ERS_Ld5.TL319_oQU240wLI_ais8to30.MPAS_LISIO_JRA1p5.mpaso-ocn_glcshelf", "SMS_P12x2.ne4pg2_oQU480.WCYCL1850NS.allactive-mach_mods", "ERS_Ln9.ne4pg2_ne4pg2.F2010-MMF1.eam-mmf_crmout", ) From bd084b04a0980bf9a3e1614997f7c32d8cecd75e Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Wed, 21 Aug 2024 15:27:19 -0500 Subject: [PATCH 098/197] Add and move a test to e3sm_integration. ERS.ne30pg2_r05_IcoswISC30E3r5.GPMPAS-JRA.mosart-rof_ocn_2way is moved from e3sm_developer to e3sm_integration because it is to large and was taking to much time/memory. To do that, it was removed from land_developer by removing the inheritance of e3sm_mosart_exonoshare Also add a moab-coupler test to e3sm-integration. --- cime_config/tests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cime_config/tests.py b/cime_config/tests.py index 059c280e2bb..c6be199ea73 100644 --- a/cime_config/tests.py +++ b/cime_config/tests.py @@ -80,7 +80,7 @@ "e3sm_land_developer" : { "share" : True, "time" : "0:45:00", - "inherit" : ("e3sm_mosart_developer", "e3sm_mosart_exenoshare", "e3sm_land_exeshare", "e3sm_land_exenoshare", "e3sm_land_debug", "fates_elm_developer"), + "inherit" : ("e3sm_mosart_developer", "e3sm_land_exeshare", "e3sm_land_exenoshare", "e3sm_land_debug", "fates_elm_developer"), "tests" : ( "ERS.f19_f19.I1850ELMCN", "ERS.f19_f19.I20TRELMCN", @@ -321,6 +321,7 @@ "time" : "03:00:00", "tests" : ( "ERS.ne4pg2_oQU480.WCYCL1850NS", + "ERS_Vmoab.ne4pg2_oQU480.WCYCL1850NS", "SMS_D_Ld1.ne30pg2_r05_IcoswISC30E3r5.WCYCL1850.allactive-wcprod", "SMS_D_Ld1.ne30pg2_r05_IcoswISC30E3r5.WCYCLSSP370.allactive-wcprodssp", "ERS_Ld3.ne4pg2_oQU480.F2010", @@ -337,6 +338,7 @@ "ERS_Ld3.ne30pg2_r05_IcoswISC30E3r5.WCYCL1850.allactive-nlmaps", "SMS_D_Ld1.ne30pg2_r05_IcoswISC30E3r5.CRYO1850-DISMF", "ERS.hcru_hcru.I20TRGSWCNPRDCTCBC.elm-erosion", + "ERS.ne30pg2_r05_IcoswISC30E3r5.GPMPAS-JRA.mosart-rof_ocn_2way", ) }, From 0b58cb0c955bafd28f906f1f1fb006153a0978a4 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Wed, 21 Aug 2024 23:18:20 +0000 Subject: [PATCH 099/197] Load pre-built kokkos module for GPU builds Also export ZES_ENABLE_SYSMAN=1 to avoid ext_intel_free_memory run-time errors. --- cime_config/machines/config_machines.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index c94a2bbcf7d..b6ac815f58f 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3411,6 +3411,9 @@ oneapi/eng-compiler/2024.04.15.002 + + kokkos/git.7ff87a5-omp-sycl + spack cmake gcc/10.3.0 @@ -3439,6 +3442,8 @@ /soft/tools/mpi_wrapper_utils/gpu_tile_compact.sh 131072 20 + $ENV{KOKKOS_ROOT} + 1 0 From 226ac0ff37064badf2f4237b111a93ecdf20ce74 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Wed, 21 Aug 2024 23:21:54 +0000 Subject: [PATCH 100/197] Fix a SYCL typo Also avoid a call to variadic printf in a SYCL kernel within an error diagnostic log. --- components/homme/src/share/compose/cedr_kokkos.hpp | 2 +- components/homme/src/share/compose/compose_slmm_siqk.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/homme/src/share/compose/cedr_kokkos.hpp b/components/homme/src/share/compose/cedr_kokkos.hpp index 42e423e2913..758f4148a9a 100644 --- a/components/homme/src/share/compose/cedr_kokkos.hpp +++ b/components/homme/src/share/compose/cedr_kokkos.hpp @@ -18,7 +18,7 @@ typedef Kokkos::Experimental::HIPSpace CedrGpuSpace; # endif # if defined KOKKOS_ENABLE_SYCL typedef Kokkos::Experimental::SYCL CedrGpuExeSpace; -typedef Kokkos::Experimental::SYCL> CedrGpuSpace; +typedef Kokkos::Experimental::SYCL CedrGpuSpace; # endif #endif diff --git a/components/homme/src/share/compose/compose_slmm_siqk.cpp b/components/homme/src/share/compose/compose_slmm_siqk.cpp index 628c023090c..56564b0b8ca 100644 --- a/components/homme/src/share/compose/compose_slmm_siqk.cpp +++ b/components/homme/src/share/compose/compose_slmm_siqk.cpp @@ -60,8 +60,10 @@ class TestSphereToRefKernel { // tol is on dx, not (a,b), so adjust slightly. if ( ! info.success || err > 1e4*tol_) { jinfo.nfails++; +#ifndef KOKKOS_ENABLE_SYCL printf("calc_sphere_to_ref ei %d i %d j %d: nits %d re %1.1e\n", ei, i, j, info.n_iterations, err); +#endif } jinfo.sum_nits += info.n_iterations; jinfo.max_nits = max(jinfo.max_nits, info.n_iterations); From d5c15c3ca7fa41b564b41b30aa79c146dafc399c Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Wed, 21 Aug 2024 23:30:34 +0000 Subject: [PATCH 101/197] Let SYCL kernels call a virtual function --- .../machines/cmake_macros/oneapi-ifxgpu_aurora.cmake | 1 + .../machines/cmake_macros/oneapi-ifxgpu_sunspot.cmake | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 cime_config/machines/cmake_macros/oneapi-ifxgpu_sunspot.cmake diff --git a/cime_config/machines/cmake_macros/oneapi-ifxgpu_aurora.cmake b/cime_config/machines/cmake_macros/oneapi-ifxgpu_aurora.cmake index 47d513408c2..16288ce4dee 100644 --- a/cime_config/machines/cmake_macros/oneapi-ifxgpu_aurora.cmake +++ b/cime_config/machines/cmake_macros/oneapi-ifxgpu_aurora.cmake @@ -5,3 +5,4 @@ if (compile_threaded) endif() string(APPEND KOKKOS_OPTIONS " -DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_SERIAL=On -DKokkos_ARCH_INTEL_PVC=On -DKokkos_ENABLE_SYCL=On -DKokkos_ENABLE_EXPLICIT_INSTANTIATION=Off") string(APPEND SYCL_FLAGS " -\-intel -fsycl -fsycl-targets=spir64_gen -mlong-double-64 -Xsycl-target-backend \"-device 12.60.7\"") +string(APPEND CMAKE_CXX_FLAGS " -Xclang -fsycl-allow-virtual-functions") diff --git a/cime_config/machines/cmake_macros/oneapi-ifxgpu_sunspot.cmake b/cime_config/machines/cmake_macros/oneapi-ifxgpu_sunspot.cmake new file mode 100644 index 00000000000..6835515164f --- /dev/null +++ b/cime_config/machines/cmake_macros/oneapi-ifxgpu_sunspot.cmake @@ -0,0 +1,7 @@ + +string(APPEND CMAKE_EXE_LINKER_FLAGS " -lmkl_intel_lp64 -lmkl_sequential -lmkl_core") +if (compile_threaded) + string(APPEND CMAKE_EXE_LINKER_FLAGS " -fiopenmp -fopenmp-targets=spir64") +endif() +string(APPEND SYCL_FLAGS " -\-intel -fsycl -fsycl-targets=spir64_gen -mlong-double-64 -Xsycl-target-backend \"-device 12.60.7\"") +string(APPEND CMAKE_CXX_FLAGS " -Xclang -fsycl-allow-virtual-functions") From f84cad1e7e817b248ebfe45f7270cb36db29b8f5 Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Fri, 23 Aug 2024 10:15:38 -0400 Subject: [PATCH 102/197] improve the comment regarding PROJECT --- run_e3sm.template.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/run_e3sm.template.sh b/run_e3sm.template.sh index 86e36015759..49869f5c6f6 100755 --- a/run_e3sm.template.sh +++ b/run_e3sm.template.sh @@ -14,7 +14,8 @@ main() { # Machine and project readonly MACHINE=pm-cpu -# BEFORE RUNNING: CHANGE this to your project +# NOTE: The command below will return your default project on SLURM-based systems. +# If you are not using SLURM or need a different project, remove the command and set it directly readonly PROJECT="$(sacctmgr show user $USER format=DefaultAccount | tail -n1 | tr -d ' ')" # Simulation @@ -53,7 +54,7 @@ readonly CASE_ARCHIVE_DIR=${CASE_ROOT}/archive # Define type of run # short tests: 'XS_2x5_ndays', 'XS_1x10_ndays', 'S_1x10_ndays', # 'M_1x10_ndays', 'M2_1x10_ndays', 'M80_1x10_ndays', 'L_1x10_ndays' -# * can replace XS, M, etc with custom-XY with XY being the node count +# * can replace XS, M, etc. with custom-XY with XY being the node count # or 'production' for full simulation readonly run='XS_2x5_ndays' if [ "${run}" != "production" ]; then From 455ac56439af77dfd7450c8718ea8500b0afa3d0 Mon Sep 17 00:00:00 2001 From: Jayesh Krishna Date: Fri, 23 Aug 2024 09:23:18 -0500 Subject: [PATCH 103/197] PnetCDF support for HOMME+BFB on Anvil/Chrysalis Adding support for the PnetCDF library in HOMME for the BFB tests on Anvil and Chrysalis. These configuration files are used for standalone HOMME builds on Anvil and Chrysalis --- components/homme/cmake/machineFiles/anvil-bfb.cmake | 9 ++++++++- components/homme/cmake/machineFiles/chrysalis-bfb.cmake | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/components/homme/cmake/machineFiles/anvil-bfb.cmake b/components/homme/cmake/machineFiles/anvil-bfb.cmake index d46774646eb..ab9b1d3edc8 100644 --- a/components/homme/cmake/machineFiles/anvil-bfb.cmake +++ b/components/homme/cmake/machineFiles/anvil-bfb.cmake @@ -20,7 +20,14 @@ ENDIF() # Set kokkos arch, to get correct avx flags SET (Kokkos_ARCH_BDW ON CACHE BOOL "") -SET (WITH_PNETCDF FALSE CACHE FILEPATH "") +EXECUTE_PROCESS(COMMAND pnetcdf-config --prefix + RESULT_VARIABLE PNCCONFIG_RESULT + OUTPUT_VARIABLE PNCCONFIG_OUTPUT + ERROR_VARIABLE PNCCONFIG_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE +) +SET (PnetCDF_PATH "${PNCCONFIG_OUTPUT}" CACHE STRING "") + # # anvil module system doesn't set environment variables, but will put # nc-config in our path. anvil seperates C and Fortran libraries, diff --git a/components/homme/cmake/machineFiles/chrysalis-bfb.cmake b/components/homme/cmake/machineFiles/chrysalis-bfb.cmake index ddeb7fa7811..b9f0d41a060 100644 --- a/components/homme/cmake/machineFiles/chrysalis-bfb.cmake +++ b/components/homme/cmake/machineFiles/chrysalis-bfb.cmake @@ -20,7 +20,13 @@ SET (USE_MPI_OPTIONS "-K --cpu_bind=cores" CACHE STRING "") # Set kokkos arch, to get correct avx flags SET (Kokkos_ARCH_ZEN2 ON CACHE BOOL "") -SET (WITH_PNETCDF FALSE CACHE FILEPATH "") +EXECUTE_PROCESS(COMMAND pnetcdf-config --prefix + RESULT_VARIABLE PNCCONFIG_RESULT + OUTPUT_VARIABLE PNCCONFIG_OUTPUT + ERROR_VARIABLE PNCCONFIG_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE +) +SET (PnetCDF_PATH "${PNCCONFIG_OUTPUT}" CACHE STRING "") EXECUTE_PROCESS(COMMAND nf-config --prefix RESULT_VARIABLE NFCONFIG_RESULT From 5a60663a84c83adefcd3eab6c7613611ec3dd187 Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Fri, 23 Aug 2024 08:55:47 -0600 Subject: [PATCH 104/197] fix commens and add file global attributes --- .../eam/tools/mkatmsrffile/mkatmsrffile.py | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/components/eam/tools/mkatmsrffile/mkatmsrffile.py b/components/eam/tools/mkatmsrffile/mkatmsrffile.py index 50999b6e945..826544feb08 100644 --- a/components/eam/tools/mkatmsrffile/mkatmsrffile.py +++ b/components/eam/tools/mkatmsrffile/mkatmsrffile.py @@ -1,9 +1,8 @@ #!/usr/bin/env python3 #--------------------------------------------------------------------------------------------------- ''' -This is a replacement for the legacy gen_domain tool created for CESM. -Most legacy functionality is reproduced, with the notable exception of -the pole point latitude adjustment needed for the CESM FV grid. +This is a replacement for the legacy mkatmsrffile tool created for CESM. +All legacy functionality is reproduced. Created April, 2024 by Walter Hannah (LLNL) ''' @@ -22,12 +21,14 @@ #--------------------------------------------------------------------------------------------------- import datetime, os, numpy as np, xarray as xr, numba, itertools, subprocess as sp user, host = os.getenv('USER'), os.getenv('HOST') -source_code_meta = 'generate_domain_E3SM.py' +source_code_meta = 'mkatmsrffile.py' #--------------------------------------------------------------------------------------------------- class clr:END,RED,GREEN,MAGENTA,CYAN = '\033[0m','\033[31m','\033[32m','\033[35m','\033[36m' #--------------------------------------------------------------------------------------------------- usage = ''' python mkatmsrffile.py --map_file + --vegetation_file + --soil_water_file --dst_grid [--output-root ] [--date-stamp ] @@ -47,7 +48,6 @@ class clr:END,RED,GREEN,MAGENTA,CYAN = '\033[0m','\033[31m','\033[32m','\033[35m The following output file is created: atmsrf__.nc - ???? ''' from optparse import OptionParser @@ -71,11 +71,11 @@ class clr:END,RED,GREEN,MAGENTA,CYAN = '\033[0m','\033[31m','\033[32m','\033[35m parser.add_option('--output_root', dest='output_root', default='./', - help='Output path for domain files') + help='Output path for atmsrf files') parser.add_option('--date-stamp', dest='date_stamp', default=None, - help='Creation date stamp for domain files') + help='Creation date stamp for atmsrf files') (opts, args) = parser.parse_args() #--------------------------------------------------------------------------------------------------- def main(): @@ -252,6 +252,15 @@ def main(): ds_out['soilw'] = xr.DataArray(SOILW ,dims=['month','ncol']) ds_out['lon'] = ds_map.xc_b.rename({'n_b':'ncol'}) ds_out['lat'] = ds_map.yc_b.rename({'n_b':'ncol'}) + + ds.attrs['title'] = 'E3SM atmosphere surface data' + ds.attrs['source_code'] = source_code_meta + ds.attrs['hostname'] = str(host) + ds.attrs['history'] = f'created by {user}, '+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ds.attrs['input_map_file'] = opts.map_file + ds.attrs['input_vegetation_file'] = opts.vegetation_file + ds.attrs['input_soil_water_file'] = opts.soil_water_file + ds_out.to_netcdf(path=output_file,mode='w') #----------------------------------------------------------------------------- From b114661343405091a72fe5de722d68376a796a79 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Sun, 25 Aug 2024 23:40:48 -0500 Subject: [PATCH 105/197] Add alternative data stream control for SO2 species in ect_frc --- .../namelist_files/namelist_definition.xml | 18 + .../eam/src/chemistry/mozart/chemistry.F90 | 13 +- .../eam/src/chemistry/mozart/mo_chemini.F90 | 7 +- .../eam/src/chemistry/mozart/mo_extfrc.F90 | 31 +- .../eam/src/chemistry/mozart/tracer_data.F90 | 2884 +++++++++++++++++ 5 files changed, 2945 insertions(+), 8 deletions(-) create mode 100644 components/eam/src/chemistry/mozart/tracer_data.F90 diff --git a/components/eam/bld/namelist_files/namelist_definition.xml b/components/eam/bld/namelist_files/namelist_definition.xml index b3ecb5e9290..8228c7d8d2e 100644 --- a/components/eam/bld/namelist_files/namelist_definition.xml +++ b/components/eam/bld/namelist_files/namelist_definition.xml @@ -5138,6 +5138,17 @@ Format: YYYY Default: 0 + +The cycle year of the volcanic SO2 forcing (3D emissions) data. +Use this in place of ext_frc_cycle_yr if non-default, to allow different +speciciations volcanic emission and aerosols/precursors, which may be +invoked for single forcing simulation design. +if ext_frc_volc_type is 'CYCLICAL'. +Format: YYYY +Default: -1 + + Default: current model date @@ -5189,6 +5200,13 @@ Can be set to 'CYCLICAL', 'SERIAL', 'INTERP_MISSING_MONTHS', or 'FIXED'. Default: 'CYCLICAL' + +Type of time interpolation for fixed lower boundary data. See also ext_frc_volc_cycle_yr. +Can be set to 'NULL','CYCLICAL', 'SERIAL', 'INTERP_MISSING_MONTHS', or 'FIXED'. +Default: 'NULL' + + The cycle year of the fixed lower boundary data diff --git a/components/eam/src/chemistry/mozart/chemistry.F90 b/components/eam/src/chemistry/mozart/chemistry.F90 index f78ceda1dea..3412e1b9bf9 100644 --- a/components/eam/src/chemistry/mozart/chemistry.F90 +++ b/components/eam/src/chemistry/mozart/chemistry.F90 @@ -106,6 +106,13 @@ module chemistry integer :: ext_frc_fixed_ymd = 0 integer :: ext_frc_fixed_tod = 0 + ! alternative type and cycle year for volcanic and other SO2 for controlling single forcing experiments + ! if NULL, same treatment as for the other species. + ! Possible in the future to modify further and apply to volcanic sector of SO2 alone + + character(len=24) :: ext_frc_volc_type = 'NULL' !'NULL'|'CYCLICAL'|'SERIAL'|'INTERP_MISSING_MONTHS' + integer :: ext_frc_volc_cycle_yr = -1 + real(r8) :: dms_emis_scale = 1._r8 ! fixed stratosphere @@ -515,7 +522,7 @@ subroutine chem_readnl(nlfile) srf_emis_type, srf_emis_cycle_yr, srf_emis_fixed_ymd, srf_emis_fixed_tod, srf_emis_specifier, & fstrat_file, fstrat_list, fstrat_efold_list, & ext_frc_specifier, ext_frc_type, ext_frc_cycle_yr, ext_frc_fixed_ymd, ext_frc_fixed_tod, & - dms_emis_scale + ext_frc_volc_type, ext_frc_volc_cycle_yr, dms_emis_scale namelist /chem_inparm/ chem_rad_passive @@ -689,6 +696,8 @@ subroutine chem_readnl(nlfile) call mpibcast (ext_frc_cycle_yr, 1, mpiint, 0, mpicom) call mpibcast (ext_frc_fixed_ymd, 1, mpiint, 0, mpicom) call mpibcast (ext_frc_fixed_tod, 1, mpiint, 0, mpicom) + call mpibcast (ext_frc_volc_type, len(ext_frc_volc_type), mpichar, 0, mpicom) + call mpibcast (ext_frc_volc_cycle_yr, 1, mpiint, 0, mpicom) call mpibcast (dms_emis_scale, 1, mpir8, 0, mpicom) @@ -1033,6 +1042,8 @@ subroutine chem_init(phys_state, pbuf2d, species_class) , ext_frc_cycle_yr & , ext_frc_fixed_ymd & , ext_frc_fixed_tod & + , ext_frc_volc_type & + , ext_frc_volc_cycle_yr & , xactive_prates & , exo_coldens_file & , tuv_xsect_file & diff --git a/components/eam/src/chemistry/mozart/mo_chemini.F90 b/components/eam/src/chemistry/mozart/mo_chemini.F90 index ff0eb0df15f..564855d76dc 100644 --- a/components/eam/src/chemistry/mozart/mo_chemini.F90 +++ b/components/eam/src/chemistry/mozart/mo_chemini.F90 @@ -43,6 +43,8 @@ subroutine chemini & , ext_frc_cycle_yr & , ext_frc_fixed_ymd & , ext_frc_fixed_tod & + , ext_frc_volc_type & + , ext_frc_volc_cycle_yr & , xactive_prates & , exo_coldens_file & , tuv_xsect_file & @@ -133,6 +135,8 @@ subroutine chemini & integer, intent(in) :: ext_frc_cycle_yr integer, intent(in) :: ext_frc_fixed_ymd integer, intent(in) :: ext_frc_fixed_tod + character(len=*), intent(in) :: ext_frc_volc_type + integer, intent(in) :: ext_frc_volc_cycle_yr character(len=*), intent(in) :: srf_emis_type integer, intent(in) :: srf_emis_cycle_yr integer, intent(in) :: srf_emis_fixed_ymd @@ -183,7 +187,8 @@ subroutine chemini & ! ... initialize external forcings module !----------------------------------------------------------------------- call setext_inti() - call extfrc_inti(ext_frc_specifier, ext_frc_type, ext_frc_cycle_yr, ext_frc_fixed_ymd, ext_frc_fixed_tod) + call extfrc_inti(ext_frc_specifier, ext_frc_type, ext_frc_cycle_yr, ext_frc_fixed_ymd, ext_frc_fixed_tod, & + ext_frc_volc_type, ext_frc_volc_cycle_yr) if (masterproc) write(iulog,*) 'chemini: after extfrc_inti on node ',iam !----------------------------------------------------------------------- diff --git a/components/eam/src/chemistry/mozart/mo_extfrc.F90 b/components/eam/src/chemistry/mozart/mo_extfrc.F90 index 23b3f480882..d00e0d5673e 100644 --- a/components/eam/src/chemistry/mozart/mo_extfrc.F90 +++ b/components/eam/src/chemistry/mozart/mo_extfrc.F90 @@ -46,7 +46,8 @@ module mo_extfrc contains - subroutine extfrc_inti( extfrc_specifier, extfrc_type, extfrc_cycle_yr, extfrc_fixed_ymd, extfrc_fixed_tod) + subroutine extfrc_inti( extfrc_specifier, extfrc_type, extfrc_cycle_yr, extfrc_fixed_ymd, extfrc_fixed_tod, & + extfrc_volc_type, extfrc_volc_cycle_yr) !----------------------------------------------------------------------- ! ... initialize the surface forcings @@ -71,6 +72,8 @@ subroutine extfrc_inti( extfrc_specifier, extfrc_type, extfrc_cycle_yr, extfrc_f integer , intent(in) :: extfrc_cycle_yr integer , intent(in) :: extfrc_fixed_ymd integer , intent(in) :: extfrc_fixed_tod + character(len=*), intent(in) :: extfrc_volc_type + integer , intent(in) :: extfrc_volc_cycle_yr !----------------------------------------------------------------------- ! ... local variables @@ -204,6 +207,14 @@ subroutine extfrc_inti( extfrc_specifier, extfrc_type, extfrc_cycle_yr, extfrc_f else if( extfrc_type == 'CYCLICAL' ) then write(iulog,*) ' cycle year = ',extfrc_cycle_yr end if + if (extfrc_volc_type /= 'NULL' ) then + write(iulog,*) ' ' + write(iulog,*) 'Volcanic SO2 type = ',extfrc_volc_type + if (extfrc_volc_type == 'CYCLICAL' ) then + write(iulog,*) ' ' + write(iulog,*) 'Volcanic SO2 cycle year = ',extfrc_volc_cycle_yr + end if + end if write(iulog,*) ' ' write(iulog,*) 'there are ',extfrc_cnt,' species with external forcing files' do m = 1,extfrc_cnt @@ -264,11 +275,19 @@ subroutine extfrc_inti( extfrc_specifier, extfrc_type, extfrc_cycle_yr, extfrc_f allocate(forcings(m)%file%in_pbuf(size(forcings(m)%sectors))) forcings(m)%file%in_pbuf(:) = .false. - call trcdata_init( forcings(m)%sectors, & - forcings(m)%filename, filelist, datapath, & - forcings(m)%fields, & - forcings(m)%file, & - rmv_file, extfrc_cycle_yr, extfrc_fixed_ymd, extfrc_fixed_tod, extfrc_type) + if (trim(forcings(m)%species) == 'SO2' .and. extfrc_volc_type /= 'NULL') then + call trcdata_init( forcings(m)%sectors, & + forcings(m)%filename, filelist, datapath, & + forcings(m)%fields, & + forcings(m)%file, rmv_file, extfrc_volc_cycle_yr, & + extfrc_fixed_ymd, extfrc_fixed_tod, extfrc_volc_type) + else + call trcdata_init( forcings(m)%sectors, & + forcings(m)%filename, filelist, datapath, & + forcings(m)%fields, & + forcings(m)%file, & + rmv_file, extfrc_cycle_yr, extfrc_fixed_ymd, extfrc_fixed_tod, extfrc_type) + end if enddo frcing_loop diff --git a/components/eam/src/chemistry/mozart/tracer_data.F90 b/components/eam/src/chemistry/mozart/tracer_data.F90 new file mode 100644 index 00000000000..62ccbcef8a2 --- /dev/null +++ b/components/eam/src/chemistry/mozart/tracer_data.F90 @@ -0,0 +1,2884 @@ +module tracer_data +!----------------------------------------------------------------------- +! module used to read (and interpolate) offline tracer data (sources and +! mixing ratios) +! Created by: Francis Vitt -- 2 May 2006 +! Modified by : Jim Edwards -- 10 March 2009 +! Modified by : Cheryl Craig and Chih-Chieh (Jack) Chen -- February 2010 +! Modified by : Jinbo Xie --March 2023 +! Added a new option in interpolate_trcdata to work on linoz +! inputdata. A new UCI interpolation that better conserves +! mass in implemented and added a new function. It is called +! when linoz data are used in interpolate_trcdata. +! +!----------------------------------------------------------------------- + + use perf_mod, only : t_startf, t_stopf + use shr_kind_mod, only : r8 => shr_kind_r8,r4 => shr_kind_r4, shr_kind_cl, SHR_KIND_CS + use time_manager, only : get_curr_date, get_step_size, get_curr_calday + use spmd_utils, only : masterproc + use ppgrid, only : pcols, pver, pverp, begchunk, endchunk + use cam_abortutils, only : endrun + use cam_logfile, only : iulog + + use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_get_index + use time_manager, only : set_time_float_from_date, set_date_from_time_float + use pio, only : file_desc_t, var_desc_t, & + pio_seterrorhandling, pio_internal_error, pio_bcast_error, & + pio_setdebuglevel, & + pio_char, pio_noerr, & + pio_inq_dimid, pio_inq_varid, & + pio_def_dim, pio_def_var, & + pio_put_att, pio_put_var, & + pio_get_var, pio_get_att, pio_nowrite, pio_inq_dimlen, & + pio_inq_vardimid, pio_inq_dimlen, pio_closefile, & + pio_inquire_variable + + implicit none + + private ! all unless made public + save + + public :: trfld, input3d, input2d, trfile + public :: trcdata_init + public :: advance_trcdata + public :: get_fld_data + public :: put_fld_data + public :: get_fld_ndx + public :: write_trc_restart + public :: read_trc_restart + public :: init_trc_restart + public :: incr_filename + !added public for linoz new function diagnostic + public :: read_next_trcdata + public :: interpolate_trcdata + public :: get_model_time + !!PUBLIC MEMBERS + + type input3d + real(r8), dimension(:,:,:), pointer :: data => null() + endtype input3d + + type input2d + real(r8), dimension(:,:), pointer :: data => null() + endtype input2d + + type trfld + real(r8), dimension(:,:,:), pointer :: data => null() + type(input3d), dimension(4) :: input + character(len=32) :: srcnam + character(len=32) :: fldnam + character(len=32) :: units + type(var_desc_t) :: var_id + integer :: coords(4) ! LATDIM | LONDIM | LEVDIM | TIMDIM + integer :: order(4) ! LATDIM | LONDIM | LEVDIM | TIMDIM + logical :: srf_fld = .false. + integer :: pbuf_ndx = -1 + endtype trfld + + type trfile + type(input2d), dimension(4) :: ps_in + character(len=shr_kind_cl) :: pathname = ' ' + character(len=shr_kind_cl) :: curr_filename = ' ' + character(len=shr_kind_cl) :: next_filename = ' ' + type(file_desc_t) :: curr_fileid + type(file_desc_t) :: next_fileid + + type(var_desc_t), pointer :: currfnameid => null() ! pio restart file var id + type(var_desc_t), pointer :: nextfnameid => null() ! pio restart file var id + + character(len=shr_kind_cl) :: filenames_list = '' + real(r8) :: datatimem = -1.e36_r8 ! time of prv. values read in + real(r8) :: datatimep = -1.e36_r8 ! time of nxt. values read in + real(r8) :: datatimes(4) + integer :: interp_recs + real(r8), pointer, dimension(:) :: curr_data_times => null() + real(r8), pointer, dimension(:) :: next_data_times => null() + logical :: remove_trc_file = .false. ! delete file when finished with it + real(r8) :: offset_time + integer :: cyc_ndx_beg + integer :: cyc_ndx_end + integer :: cyc_yr = 0 + real(r8) :: one_yr = 0 + real(r8) :: curr_mod_time ! model time - calendar day + real(r8) :: next_mod_time ! model time - calendar day - next time step + integer :: nlon + integer :: nlat + integer :: nlev + integer :: nilev + integer :: ps_coords(3) ! LATDIM | LONDIM | TIMDIM + integer :: ps_order(3) ! LATDIM | LONDIM | TIMDIM + real(r8), pointer, dimension(:) :: lons => null() + real(r8), pointer, dimension(:) :: lats => null() + real(r8), pointer, dimension(:) :: levs => null() + real(r8), pointer, dimension(:) :: ilevs => null() + real(r8), pointer, dimension(:) :: hyam => null() + real(r8), pointer, dimension(:) :: hybm => null() + real(r8), pointer, dimension(:,:) :: ps => null() + real(r8), pointer, dimension(:) :: hyai => null() + real(r8), pointer, dimension(:) :: hybi => null() + real(r8), pointer, dimension(:,:) :: weight_x => null(), weight_y => null() + integer, pointer, dimension(:) :: count_x => null(), count_y => null() + integer, pointer, dimension(:,:) :: index_x => null(), index_y => null() + real(r8) :: p0 + type(var_desc_t) :: ps_id + logical, allocatable, dimension(:) :: in_pbuf + logical :: has_ps = .false. + logical :: zonal_ave = .false. + logical :: alt_data = .false. + logical :: cyclical = .false. + logical :: cyclical_list = .false. + logical :: weight_by_lat = .false. + logical :: conserve_column = .false. + logical :: fill_in_months = .false. + logical :: fixed = .false. + logical :: initialized = .false. + logical :: top_bndry = .false. + logical :: stepTime = .false. ! Do not interpolate in time, but use stepwise times + logical :: linoz_v3 = .false. !set for linoz_v3 interpolation only + logical :: linoz_v2 = .false. !set for linoz_v2 interpolation only + endtype trfile + + integer, public, parameter :: MAXTRCRS = 100 + + integer, parameter :: LONDIM = 1 + integer, parameter :: LATDIM = 2 + integer, parameter :: LEVDIM = 3 + integer, parameter :: TIMDIM = 4 + + integer, parameter :: PS_TIMDIM = 3 + + integer, parameter :: ZA_LATDIM = 1 + integer, parameter :: ZA_LEVDIM = 2 + integer, parameter :: ZA_TIMDIM = 3 + + integer, parameter :: nm=1 ! array index for previous (minus) data + integer, parameter :: np=2 ! array index for next (plus) data + + integer :: plon, plat + +contains + +!-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- + subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & + rmv_file, data_cycle_yr, data_fixed_ymd, data_fixed_tod, data_type ) + + use mo_constants, only : d2r + use cam_control_mod, only : nsrest + use dyn_grid, only : get_dyn_grid_parm + use string_utils, only : to_upper + use horizontal_interpolate, only : xy_interp_init +#if ( defined SPMD ) + use mpishorthand, only: mpicom, mpir8, mpiint +#endif + + implicit none + + character(len=*), intent(in) :: specifier(:) + character(len=*), intent(in) :: filename + character(len=*), intent(in) :: filelist + character(len=*), intent(in) :: datapath + type(trfld), dimension(:), pointer :: flds + type(trfile), intent(inout) :: file + logical, intent(in) :: rmv_file + integer, intent(in) :: data_cycle_yr + integer, intent(in) :: data_fixed_ymd + integer, intent(in) :: data_fixed_tod + character(len=*), intent(in) :: data_type + + integer :: f, mxnflds, astat + integer :: str_yr, str_mon, str_day + integer :: lon_dimid, lat_dimid, lev_dimid, tim_dimid, old_dimid + integer :: dimids(4), did + type(var_desc_t) :: varid + integer :: idx + integer :: ierr + integer :: errcode + real(r8) :: start_time, time1, time2 + integer :: i1,i2,j1,j2 + integer :: nvardims, vardimids(4) + + character(len=80) :: data_units + + call specify_fields( specifier, flds ) + + file%datatimep=-1.e36_r8 + file%datatimem=-1.e36_r8 + + mxnflds = 0 + if (associated(flds)) mxnflds = size( flds ) + + if (mxnflds < 1) return + + file%remove_trc_file = rmv_file + file%pathname = trim(datapath) + file%filenames_list = trim(filelist) + + file%fill_in_months = .false. + file%cyclical = .false. + file%cyclical_list = .false. + +! does not work when compiled with pathf90 +! select case ( to_upper(data_type) ) + select case ( data_type ) + case( 'FIXED' ) + file%fixed = .true. + case( 'INTERP_MISSING_MONTHS' ) + file%fill_in_months = .true. + case( 'CYCLICAL' ) + file%cyclical = .true. + file%cyc_yr = data_cycle_yr + case( 'CYCLICAL_LIST' ) + file%cyclical_list = .true. + file%cyc_yr = data_cycle_yr + case( 'SERIAL' ) + case default + write(iulog,*) 'trcdata_init: invalid data type: '//trim(data_type)//' file: '//trim(filename) + write(iulog,*) 'trcdata_init: valid data types: SERIAL | CYCLICAL | CYCLICAL_LIST | FIXED | INTERP_MISSING_MONTHS ' + call endrun('trcdata_init: invalid data type: '//trim(data_type)//' file: '//trim(filename)) + endselect + + if ( (.not.file%fixed) .and. ((data_fixed_ymd>0._r8) .or.(data_fixed_tod>0._r8))) then + call endrun('trcdata_init: Cannot specify data_fixed_ymd or data_fixed_tod if data type is not FIXED') + endif + if ( (.not.file%cyclical) .and. (data_cycle_yr>0._r8) ) then + call endrun('trcdata_init: Cannot specify data_cycle_yr if data type is not CYCLICAL') + endif + + if (masterproc) then + write(iulog,*) 'trcdata_init: data type: '//trim(data_type)//' file: '//trim(filename) + endif + + ! if there is no list of files (len_trim(file%filenames_list)<1) then + ! -> set curr_filename from namelist rather from restart data + if ( len_trim(file%curr_filename)<1 .or. len_trim(file%filenames_list)<1 .or. file%fixed ) then ! initial run + file%curr_filename = trim(filename) + + call get_model_time(file) + + if ( file%fixed ) then + str_yr = data_fixed_ymd/10000 + str_mon = (data_fixed_ymd - str_yr*10000)/100 + str_day = data_fixed_ymd - str_yr*10000 - str_mon*100 + call set_time_float_from_date( start_time, str_yr, str_mon, str_day, data_fixed_tod ) + file%offset_time = start_time - file%curr_mod_time + else + file%offset_time = 0 + endif + endif + + call set_time_float_from_date( time2, 2, 1, 1, 0 ) + call set_time_float_from_date( time1, 1, 1, 1, 0 ) + file%one_yr = time2-time1 + + if ( file%cyclical .or. file%cyclical_list) then + file%cyc_ndx_beg = -1 + file%cyc_ndx_end = -1 + if ( file%cyc_yr /= 0 ) then + call set_time_float_from_date( time1, file%cyc_yr , 1, 1, 0 ) + call set_time_float_from_date( time2, file%cyc_yr+1, 1, 1, 0 ) + file%one_yr = time2-time1 + endif + + call open_trc_datafile( file%curr_filename, file%pathname, file%curr_fileid, file%curr_data_times, & + cyc_ndx_beg=file%cyc_ndx_beg, cyc_ndx_end=file%cyc_ndx_end, cyc_yr=file%cyc_yr ) + else + call open_trc_datafile( file%curr_filename, file%pathname, file%curr_fileid, file%curr_data_times ) + file%curr_data_times = file%curr_data_times - file%offset_time + endif + + call pio_seterrorhandling(File%curr_fileid, PIO_BCAST_ERROR) + ierr = pio_inq_dimid( file%curr_fileid, 'lon', idx ) + call pio_seterrorhandling(File%curr_fileid, PIO_INTERNAL_ERROR) + + file%zonal_ave = (ierr/=PIO_NOERR) + + plon = get_dyn_grid_parm('plon') + plat = get_dyn_grid_parm('plat') + + if ( .not. file%zonal_ave ) then + + call get_dimension( file%curr_fileid, 'lon', file%nlon, dimid=old_dimid, data=file%lons ) + + file%lons = file%lons * d2r + + lon_dimid = old_dimid + + endif + + ierr = pio_inq_dimid( file%curr_fileid, 'time', old_dimid) + + ! Hack to work with weird netCDF and old gcc or NAG bug. + tim_dimid = old_dimid + + call get_dimension( file%curr_fileid, 'lat', file%nlat, dimid=old_dimid, data=file%lats ) + file%lats = file%lats * d2r + + lat_dimid = old_dimid + + allocate( file%ps(file%nlon,file%nlat), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'trcdata_init: file%ps allocation error = ',astat + call endrun('trcdata_init: failed to allocate x array') + end if + + call pio_seterrorhandling(File%curr_fileid, PIO_BCAST_ERROR) + ierr = pio_inq_varid( file%curr_fileid, 'PS', file%ps_id ) + file%has_ps = (ierr==PIO_NOERR) + ierr = pio_inq_dimid( file%curr_fileid, 'altitude', idx ) + file%alt_data = (ierr==PIO_NOERR) + + call pio_seterrorhandling(File%curr_fileid, PIO_INTERNAL_ERROR) + + if ( file%has_ps) then + ierr = pio_inq_vardimid (file%curr_fileid, file%ps_id, dimids(1:3)) + do did = 1,3 + if ( dimids(did) == lon_dimid ) then + file%ps_coords(LONDIM) = did + file%ps_order(did) = LONDIM + else if ( dimids(did) == lat_dimid ) then + file%ps_coords(LATDIM) = did + file%ps_order(did) = LATDIM + else if ( dimids(did) == tim_dimid ) then + file%ps_coords(PS_TIMDIM) = did + file%ps_order(did) = PS_TIMDIM + endif + enddo + endif + + if (masterproc) then + write(iulog,*) 'trcdata_init: file%has_ps = ' , file%has_ps + endif ! masterproc + + if (file%alt_data) then + call get_dimension( file%curr_fileid, 'altitude_int', file%nilev, data=file%ilevs ) + call get_dimension( file%curr_fileid, 'altitude', file%nlev, dimid=old_dimid, data=file%levs ) + else + call get_dimension( file%curr_fileid, 'lev', file%nlev, dimid=old_dimid, data=file%levs ) + !!added for Linoz_v3 + call get_dimension( file%curr_fileid, 'ilev', file%nilev, data=file%ilevs ) + if (old_dimid>0) then + file%levs = file%levs*100._r8 ! mbar->pascals + endif + endif + + ! For some bizarre reason, netCDF with older gcc is keeping a pointer to the dimid, and overwriting it later! + ! Hackish workaround is to make a copy... + lev_dimid = old_dimid + + if (file%has_ps) then + + allocate( file%hyam(file%nlev), file%hybm(file%nlev), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'trcdata_init: file%hyam,file%hybm allocation error = ',astat + call endrun('trcdata_init: failed to allocate file%hyam and file%hybm arrays') + end if + + allocate( file%hyai(file%nlev+1), file%hybi(file%nlev+1), stat=astat ) + if( astat /= 0 ) then + write(iulog,*) 'trcdata_init: file%hyai,file%hybi allocation error = ',astat + call endrun('trcdata_init: failed to allocate file%hyai and file%hybi arrays') + end if + + call pio_seterrorhandling(File%curr_fileid, PIO_BCAST_ERROR) + ierr = pio_inq_varid( file%curr_fileid, 'P0', varid) + call pio_seterrorhandling(File%curr_fileid, PIO_INTERNAL_ERROR) + + if ( ierr == PIO_NOERR ) then + ierr = pio_get_var( file%curr_fileid, varid, file%p0 ) + else + file%p0 = 100000._r8 + endif + ierr = pio_inq_varid( file%curr_fileid, 'hyam', varid ) + ierr = pio_get_var( file%curr_fileid, varid, file%hyam ) + ierr = pio_inq_varid( file%curr_fileid, 'hybm', varid ) + ierr = pio_get_var( file%curr_fileid, varid, file%hybm ) + if (file%conserve_column) then + ierr = pio_inq_varid( file%curr_fileid, 'hyai', varid ) + ierr = pio_get_var( file%curr_fileid, varid, file%hyai ) + ierr = pio_inq_varid( file%curr_fileid, 'hybi', varid ) + ierr = pio_get_var( file%curr_fileid, varid, file%hybi ) + endif + + allocate( file %ps (pcols,begchunk:endchunk), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate file%ps array; error = ',astat + call endrun + end if + allocate( file%ps_in(1)%data(pcols,begchunk:endchunk), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate file%ps_in(1)%data array; error = ',astat + call endrun + end if + allocate( file%ps_in(2)%data(pcols,begchunk:endchunk), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate file%ps_in(2)%data array; error = ',astat + call endrun + end if + if( file%fill_in_months ) then + allocate( file%ps_in(3)%data(pcols,begchunk:endchunk), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate file%ps_in(3)%data array; error = ',astat + call endrun + end if + allocate( file%ps_in(4)%data(pcols,begchunk:endchunk), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate file%ps_in(4)%data array; error = ',astat + call endrun + end if + end if + endif + + flds_loop: do f = 1,mxnflds + + ! initialize the coordinate values to -1, + ! to defend against fields that do not have certain dimension, e.g., zonal average surface fields + ! and check against it when assigning value to cnt3 for that dimension + + do did = 1,4 + flds(f)%coords(did) = -1 + end do + + ! get netcdf variable id for the field + ierr = pio_inq_varid( file%curr_fileid, flds(f)%srcnam, flds(f)%var_id ) + + ! determine if the field has a vertical dimension + if (lev_dimid>0) then + ierr = pio_inquire_variable( file%curr_fileid, flds(f)%var_id, ndims=nvardims ) + ierr = pio_inquire_variable( file%curr_fileid, flds(f)%var_id, dimids=vardimids(:nvardims) ) + flds(f)%srf_fld = .not.any(vardimids(:nvardims)==lev_dimid) + else + flds(f)%srf_fld = .true. + endif + + ! allocate memory only if not already in pbuf2d + + if ( .not. file%in_pbuf(f) ) then + if ( flds(f)%srf_fld .or. file%top_bndry ) then + allocate( flds(f) %data(pcols,1,begchunk:endchunk), stat=astat ) + else + allocate( flds(f) %data(pcols,pver,begchunk:endchunk), stat=astat ) + endif + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate flds(f)%data array; error = ',astat + call endrun + end if + else + flds(f)%pbuf_ndx = pbuf_get_index(flds(f)%fldnam,errcode) + endif + + if (flds(f)%srf_fld) then + allocate( flds(f)%input(1)%data(pcols,1,begchunk:endchunk), stat=astat ) + else + allocate( flds(f)%input(1)%data(pcols,file%nlev,begchunk:endchunk), stat=astat ) + endif + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate flds(f)%input(1)%data array; error = ',astat + call endrun + end if + if (flds(f)%srf_fld) then + allocate( flds(f)%input(2)%data(pcols,1,begchunk:endchunk), stat=astat ) + else + allocate( flds(f)%input(2)%data(pcols,file%nlev,begchunk:endchunk), stat=astat ) + endif + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate flds(f)%input(2)%data array; error = ',astat + call endrun + end if + + if( file%fill_in_months ) then + if (flds(f)%srf_fld) then + allocate( flds(f)%input(3)%data(pcols,1,begchunk:endchunk), stat=astat ) + else + allocate( flds(f)%input(3)%data(pcols,file%nlev,begchunk:endchunk), stat=astat ) + endif + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate flds(f)%input(3)%data array; error = ',astat + call endrun + end if + if (flds(f)%srf_fld) then + allocate( flds(f)%input(4)%data(pcols,1,begchunk:endchunk), stat=astat ) + else + allocate( flds(f)%input(4)%data(pcols,file%nlev,begchunk:endchunk), stat=astat ) + endif + if( astat/= 0 ) then + write(iulog,*) 'trcdata_init: failed to allocate flds(f)%input(4)%data array; error = ',astat + call endrun + end if + endif + + if ( file%zonal_ave ) then + ierr = pio_inq_vardimid (file%curr_fileid, flds(f)%var_id, dimids(1:3)) + do did = 1,3 + if ( dimids(did) == lat_dimid ) then + flds(f)%coords(ZA_LATDIM) = did + flds(f)%order(did) = ZA_LATDIM + else if ( dimids(did) == lev_dimid ) then + flds(f)%coords(ZA_LEVDIM) = did + flds(f)%order(did) = ZA_LEVDIM + else if ( dimids(did) == tim_dimid ) then + flds(f)%coords(ZA_TIMDIM) = did + flds(f)%order(did) = ZA_TIMDIM + endif + enddo + else if ( flds(f)%srf_fld ) then + ierr = pio_inq_vardimid (file%curr_fileid, flds(f)%var_id, dimids(1:3)) + do did = 1,3 + if ( dimids(did) == lon_dimid ) then + flds(f)%coords(LONDIM) = did + flds(f)%order(did) = LONDIM + else if ( dimids(did) == lat_dimid ) then + flds(f)%coords(LATDIM) = did + flds(f)%order(did) = LATDIM + else if ( dimids(did) == tim_dimid ) then + flds(f)%coords(PS_TIMDIM) = did + flds(f)%order(did) = PS_TIMDIM + endif + enddo + else + ierr = pio_inq_vardimid (file%curr_fileid, flds(f)%var_id, dimids) + do did = 1,4 + if ( dimids(did) == lon_dimid ) then + flds(f)%coords(LONDIM) = did + flds(f)%order(did) = LONDIM + else if ( dimids(did) == lat_dimid ) then + flds(f)%coords(LATDIM) = did + flds(f)%order(did) = LATDIM + else if ( dimids(did) == lev_dimid ) then + flds(f)%coords(LEVDIM) = did + flds(f)%order(did) = LEVDIM + else if ( dimids(did) == tim_dimid ) then + flds(f)%coords(TIMDIM) = did + flds(f)%order(did) = TIMDIM + endif + enddo + endif + + ierr = pio_get_att( file%curr_fileid, flds(f)%var_id, 'units', data_units) + data_units = trim(data_units) + flds(f)%units = data_units(1:32) + + enddo flds_loop + +! if weighting by latitude, compute weighting for horizontal interpolation + if( file%weight_by_lat ) then +! get dimensions of CAM resolution + plon = get_dyn_grid_parm('plon') + plat = get_dyn_grid_parm('plat') + +! weight_x & weight_y are weighting function for x & y interpolation + allocate(file%weight_x(plon,file%nlon)) + allocate(file%weight_y(plat,file%nlat)) + allocate(file%count_x(plon)) + allocate(file%count_y(plat)) + allocate(file%index_x(plon,file%nlon)) + allocate(file%index_y(plat,file%nlat)) + file%weight_x(:,:) = 0.0_r8 + file%weight_y(:,:) = 0.0_r8 + file%count_x(:) = 0 + file%count_y(:) = 0 + file%index_x(:,:) = 0 + file%index_y(:,:) = 0 + + if(masterproc) then +! compute weighting + call xy_interp_init(file%nlon,file%nlat,file%lons,file%lats,plon,plat,file%weight_x,file%weight_y) + + do i2=1,plon + file%count_x(i2) = 0 + do i1=1,file%nlon + if(file%weight_x(i2,i1).gt.0.0_r8 ) then + file%count_x(i2) = file%count_x(i2) + 1 + file%index_x(i2,file%count_x(i2)) = i1 + endif + enddo + enddo + + do j2=1,plat + file%count_y(j2) = 0 + do j1=1,file%nlat + if(file%weight_y(j2,j1).gt.0.0_r8 ) then + file%count_y(j2) = file%count_y(j2) + 1 + file%index_y(j2,file%count_y(j2)) = j1 + endif + enddo + enddo + endif + +#if ( defined SPMD) + call mpibcast(file%weight_x, plon*file%nlon, mpir8 , 0, mpicom) + call mpibcast(file%weight_y, plat*file%nlat, mpir8 , 0, mpicom) + call mpibcast(file%count_x, plon, mpiint , 0, mpicom) + call mpibcast(file%count_y, plat, mpiint , 0, mpicom) + call mpibcast(file%index_x, plon*file%nlon, mpiint , 0, mpicom) + call mpibcast(file%index_y, plat*file%nlat, mpiint , 0, mpicom) +#endif + endif + + end subroutine trcdata_init + +!----------------------------------------------------------------------- +! Reads more data if needed and interpolates data to current model time +!----------------------------------------------------------------------- + subroutine advance_trcdata( flds, file, state, pbuf2d ) + use physics_types,only : physics_state + use physics_buffer, only : physics_buffer_desc + use ppgrid, only : pver,pcols + + implicit none + + type(trfile), intent(inout) :: file + type(trfld), intent(inout) :: flds(:) + type(physics_state), intent(in) :: state(begchunk:endchunk) + + type(physics_buffer_desc), optional, pointer :: pbuf2d(:,:) + integer :: ncol + real(r8) :: data_time + real(r8) :: t(pcols,pver) ! input temperature (K) + real(r8) :: rho(pcols,pver) ! input temperature (K) + real(r8) :: pmid(pcols,pver) ! pressure at layer midpoints (pa) +!--------------------------------------BLH----------------------------------- + + call t_startf('advance_trcdata') + if ( .not.( file%fixed .and. file%initialized ) ) then + + call get_model_time(file) + + data_time = file%datatimep + + if ( file%cyclical .or. file%cyclical_list ) then + ! wrap around + if ( (file%datatimepfile%datatimem) ) then + data_time = data_time + file%one_yr + endif + endif + + ! For stepTime need to advance if the times are equal + ! Should not impact other runs? + if ( file%curr_mod_time >= data_time ) then + call t_startf('read_next_trcdata') + call read_next_trcdata(state, flds, file ) + call t_stopf('read_next_trcdata') + if(masterproc) write(iulog,*) 'READ_NEXT_TRCDATA ', flds%fldnam,data_time + end if + + endif + + ! need to interpolate the data, regardless + ! each mpi task needs to interpolate + call t_startf('interpolate_trcdata') + if(present(pbuf2d)) then + call interpolate_trcdata( state, flds, file, pbuf2d ) + else + call interpolate_trcdata( state, flds, file ) + endif + call t_stopf('interpolate_trcdata') + + file%initialized = .true. + + call t_stopf('advance_trcdata') + + end subroutine advance_trcdata + +!------------------------------------------------------------------- +!------------------------------------------------------------------- + subroutine get_fld_data( flds, field_name, data, ncol, lchnk, pbuf ) + + use physics_buffer, only : physics_buffer_desc, pbuf_get_field + + implicit none + + type(trfld), intent(inout) :: flds(:) + character(len=*), intent(in) :: field_name + real(r8), intent(out) :: data(:,:) + integer, intent(in) :: lchnk + integer, intent(in) :: ncol + type(physics_buffer_desc), pointer :: pbuf(:) + + + integer :: f, nflds + real(r8),pointer :: tmpptr(:,:) + + data(:,:) = 0._r8 + nflds = size(flds) + + do f = 1, nflds + if ( trim(flds(f)%fldnam) == trim(field_name) ) then + if ( flds(f)%pbuf_ndx>0 ) then + call pbuf_get_field(pbuf, flds(f)%pbuf_ndx, tmpptr) + data(:ncol,:) = tmpptr(:ncol,:) + else + data(:ncol,:) = flds(f)%data(:ncol,:,lchnk) + endif + endif + enddo + + end subroutine get_fld_data + +!------------------------------------------------------------------- +!------------------------------------------------------------------- + subroutine put_fld_data( flds, field_name, data, ncol, lchnk, pbuf ) + + use physics_buffer, only : physics_buffer_desc, pbuf_get_field + + implicit none + + type(trfld), intent(inout) :: flds(:) + character(len=*), intent(in) :: field_name + real(r8), intent(in) :: data(:,:) + integer, intent(in) :: lchnk + integer, intent(in) :: ncol + type(physics_buffer_desc), pointer :: pbuf(:) + + + integer :: f, nflds + real(r8),pointer :: tmpptr(:,:) + + nflds = size(flds) + + do f = 1, nflds + if ( trim(flds(f)%fldnam) == trim(field_name) ) then + if ( flds(f)%pbuf_ndx>0 ) then + call pbuf_get_field(pbuf, flds(f)%pbuf_ndx, tmpptr) + tmpptr(:ncol,:) = data(:ncol,:) + else + flds(f)%data(:ncol,:,lchnk) = data(:ncol,:) + endif + endif + enddo + + end subroutine put_fld_data + +!------------------------------------------------------------------- +!------------------------------------------------------------------- + subroutine get_fld_ndx( flds, field_name, idx ) + + implicit none + + type(trfld), intent(in) :: flds(:) + character(len=*), intent(in) :: field_name + integer, intent(out) :: idx + integer :: f, nflds + + idx = -1 + nflds = size(flds) + + do f = 1, nflds + if ( trim(flds(f)%fldnam) == trim(field_name) ) then + idx = f + return + endif + enddo + + end subroutine get_fld_ndx + +!------------------------------------------------------------------------------ +!------------------------------------------------------------------------------ + subroutine get_model_time(file) + implicit none + type(trfile), intent(inout) :: file + + integer yr, mon, day, ncsec ! components of a date + + call get_curr_date(yr, mon, day, ncsec) + + if ( file%cyclical .or. file%cyclical_list) yr = file%cyc_yr + call set_time_float_from_date( file%curr_mod_time, yr, mon, day, ncsec ) + file%next_mod_time = file%curr_mod_time + get_step_size()/86400._r8 + + end subroutine get_model_time + +!------------------------------------------------------------------------------ +!------------------------------------------------------------------------------ + subroutine check_files( file, fids, itms, times_found) + + implicit none + + type(trfile), intent(inout) :: file + type(file_desc_t), intent(out) :: fids(2) ! ids of files that contains these recs + integer, optional, intent(out) :: itms(2) + logical, optional, intent(inout) :: times_found + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + logical :: list_cycled + + list_cycled = .false. + + !----------------------------------------------------------------------- + ! If next time beyond the end of the time list, + ! then increment the filename and move on to the next file + !----------------------------------------------------------------------- + if ((file%next_mod_time > file%curr_data_times(size(file%curr_data_times))).or.file%cyclical_list) then + if (file%cyclical_list) then + if ( associated(file%next_data_times) ) then + if ((file%curr_mod_time > file%datatimep)) then + + call advance_file(file) + + endif + endif + + endif + if ( .not. associated(file%next_data_times) ) then + ! open next file if not already opened... + if (file%cyclical_list) then + file%next_filename = incr_filename( file%curr_filename, filenames_list=file%filenames_list, datapath=file%pathname ,& + cyclical_list=file%cyclical_list, list_cycled=list_cycled) + else + file%next_filename = incr_filename( file%curr_filename, filenames_list=file%filenames_list, datapath=file%pathname) + endif + call open_trc_datafile( file%next_filename, file%pathname, file%next_fileid, file%next_data_times ) + file%next_data_times = file%next_data_times - file%offset_time + endif + endif + + !----------------------------------------------------------------------- + ! If using next_data_times and the current is greater than or equal to the next, then + ! close the current file, and set up for next file. + !----------------------------------------------------------------------- + if ( associated(file%next_data_times) ) then + if (file%cyclical_list .and. list_cycled) then ! special case - list cycled + + file%datatimem = file%curr_data_times(size(file%curr_data_times)) + itms(1)=size(file%curr_data_times) + fids(1)=file%curr_fileid + + file%datatimep = file%next_data_times(1) + itms(2)=1 + fids(2) = file%next_fileid + + times_found = .true. + + else if (file%curr_mod_time >= file%next_data_times(1)) then + + call advance_file(file) + + endif + endif + + end subroutine check_files + +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- + function incr_filename( filename, filenames_list, datapath, cyclical_list, list_cycled ) + + !----------------------------------------------------------------------- + ! ... Increment or decrement a date string withing a filename + ! the filename date section is assumed to be of the form + ! yyyy-dd-mm + !----------------------------------------------------------------------- + + use string_utils, only : incstr + use shr_file_mod, only : shr_file_getunit, shr_file_freeunit + + implicit none + + + character(len=*), intent(in) :: filename ! present dynamical dataset filename + character(len=*), optional, intent(in) :: filenames_list + character(len=*), optional, intent(in) :: datapath + logical , optional, intent(in) :: cyclical_list ! If true, allow list to cycle + logical , optional, intent(out) :: list_cycled + character(len=shr_kind_cl) :: incr_filename ! next filename in the sequence + + + ! set new next_filename ... + + !----------------------------------------------------------------------- + ! ... local variables + !----------------------------------------------------------------------- + integer :: pos, pos1, istat + character(len=shr_kind_cl) :: fn_new, line, filepath + character(len=6) :: seconds + character(len=5) :: num + integer :: ios,unitnumber + + if (present(list_cycled)) list_cycled = .false. + + if (( .not. present(filenames_list)) .or.(len_trim(filenames_list) == 0)) then + !----------------------------------------------------------------------- + ! ... ccm type filename + !----------------------------------------------------------------------- + pos = len_trim( filename ) + fn_new = filename(:pos) + if ( masterproc ) write(iulog,*) 'incr_flnm: old filename = ',trim(fn_new) + if( fn_new(pos-2:) == '.nc' ) then + pos = pos - 3 + end if + istat = incstr( fn_new(:pos), 1 ) + if( istat /= 0 ) then + write(iulog,*) 'incr_flnm: incstr returned ', istat + write(iulog,*) ' while trying to decrement ',trim( fn_new ) + call endrun + end if + + else + + !------------------------------------------------------------------- + ! ... open filenames_list + !------------------------------------------------------------------- + if ( masterproc ) write(iulog,*) 'incr_flnm: old filename = ',trim(filename) + if ( masterproc ) write(iulog,*) 'incr_flnm: open filenames_list : ',trim(filenames_list) + unitnumber = shr_file_getUnit() + if ( present(datapath) ) then + filepath = trim(datapath) //'/'// trim(filenames_list) + else + filepath = trim(datapath) + endif + + open( unit=unitnumber, file=filepath, iostat=ios, status="OLD") + if (ios /= 0) then + call endrun('not able to open filenames_list file: '//trim(filepath)) + endif + + !------------------------------------------------------------------- + ! ... read file names + !------------------------------------------------------------------- + read( unit=unitnumber, fmt='(A)', iostat=ios ) line + if (ios /= 0) then + call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) + endif + + !------------------------------------------------------------------- + ! If current filename is '', then initialize with the first filename read in + ! and skip this section. + !------------------------------------------------------------------- + if (filename /= '') then + + !------------------------------------------------------------------- + ! otherwise read until find current filename + !------------------------------------------------------------------- + do while( trim(line) /= trim(filename) ) + read( unit=unitnumber, fmt='(A)', iostat=ios ) line + if (ios /= 0) then + call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) + endif + enddo + + !------------------------------------------------------------------- + ! Read next filename + !------------------------------------------------------------------- + read( unit=unitnumber, fmt='(A)', iostat=ios ) line + + !--------------------------------------------------------------------------------- + ! If cyclical_list, then an end of file is not an error, but rather + ! a signal to rewind and start over + !--------------------------------------------------------------------------------- + + if (ios /= 0) then + if (present(cyclical_list)) then + if (cyclical_list) then + list_cycled=.true. + rewind(unitnumber) + read( unit=unitnumber, fmt='(A)', iostat=ios ) line + ! Error here should never happen, but check just in case + if (ios /= 0) then + call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) + endif + else + call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) + endif + else + call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) + endif + endif + + endif + + !--------------------------------------------------------------------------------- + ! Assign the current filename and close the filelist + !--------------------------------------------------------------------------------- + fn_new = trim(line) + + close(unit=unitnumber) + call shr_file_freeUnit(unitnumber) + endif + + !--------------------------------------------------------------------------------- + ! return the current filename + !--------------------------------------------------------------------------------- + incr_filename = trim(fn_new) + if ( masterproc ) write(iulog,*) 'incr_flnm: new filename = ',trim(incr_filename) + + end function incr_filename + +!------------------------------------------------------------------------------ +!------------------------------------------------------------------------------ + subroutine find_times( itms, fids, time, file, datatimem, datatimep, times_found ) + + implicit none + + type(trfile), intent(in) :: file + real(r8), intent(out) :: datatimem, datatimep + + integer, intent(out) :: itms(2) ! record numbers that bracket time + type(file_desc_t), intent(out) :: fids(2) ! ids of files that contains these recs + + real(r8), intent(in) :: time ! time of interest + logical, intent(inout) :: times_found + + integer :: np1 ! current forward time index of dataset + integer :: n,i ! + integer :: curr_tsize, next_tsize, all_tsize + integer :: astat + integer :: cyc_tsize + + real(r8), allocatable, dimension(:):: all_data_times + + curr_tsize = size(file%curr_data_times) + next_tsize = 0 + if ( associated(file%next_data_times)) next_tsize = size(file%next_data_times) + + all_tsize = curr_tsize + next_tsize + + allocate( all_data_times( all_tsize ), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'find_times: failed to allocate all_data_times array; error = ',astat + call endrun + end if + + all_data_times(:curr_tsize) = file%curr_data_times(:) + if (next_tsize > 0) all_data_times(curr_tsize+1:all_tsize) = file%next_data_times(:) + + if ( .not. file%cyclical ) then + if ( all( all_data_times(:) > time ) ) then + write(iulog,*) 'FIND_TIMES: ALL data times are after ', time + write(iulog,*) 'FIND_TIMES: data times: ',all_data_times(:) + write(iulog,*) 'FIND_TIMES: time: ',time + call endrun('find_times: all(all_data_times(:) > time) '// trim(file%curr_filename) ) + endif + + ! find bracketing times + find_times_loop : do n=1, all_tsize-1 + np1 = n + 1 + datatimem = all_data_times(n) !+ file%offset_time + datatimep = all_data_times(np1) !+ file%offset_time + ! When stepTime, datatimep may not equal the time (as only datatimem is used) + ! Should not break other runs? + if ( (time .ge. datatimem) .and. (time .lt. datatimep) ) then + times_found = .true. + exit find_times_loop + endif + enddo find_times_loop + + else ! file%cyclical + + cyc_tsize = file%cyc_ndx_end - file%cyc_ndx_beg + 1 + + if ( cyc_tsize > 1 ) then + + call findplb(all_data_times(file%cyc_ndx_beg:file%cyc_ndx_end),cyc_tsize, time, n ) + + if (n == cyc_tsize) then + np1 = 1 + else + np1 = n+1 + endif + + datatimem = all_data_times(n +file%cyc_ndx_beg-1) + datatimep = all_data_times(np1+file%cyc_ndx_beg-1) + times_found = .true. + + endif + endif + + if ( .not. times_found ) then + if (masterproc) then + write(iulog,*)'FIND_TIMES: Failed to find dates bracketing desired time =', time + write(iulog,*)' datatimem = ',file%datatimem + write(iulog,*)' datatimep = ',file%datatimep + write(iulog,*)' all_data_times = ',all_data_times + !call endrun() + return + endif + endif + + deallocate( all_data_times, stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'find_times: failed to deallocate all_data_times array; error = ',astat + call endrun + end if + + if ( .not. file%cyclical ) then + itms(1) = n + itms(2) = np1 + else + itms(1) = n +file%cyc_ndx_beg-1 + itms(2) = np1 +file%cyc_ndx_beg-1 + endif + + fids(:) = file%curr_fileid + + do i=1,2 + if ( itms(i) > curr_tsize ) then + itms(i) = itms(i) - curr_tsize + fids(i) = file%next_fileid + endif + enddo + + end subroutine find_times + +!------------------------------------------------------------------------ +!------------------------------------------------------------------------ + subroutine read_next_trcdata(state, flds, file ) + + use shr_const_mod, only:pi => shr_const_pi + use physics_types,only : physics_state + use ppgrid, only: pcols, pver, pverp,begchunk,endchunk + use physconst, only: rair + use iop_data_mod + use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_aer_props, & + rad_cnst_get_mode_props, rad_cnst_get_mode_num + + implicit none + + type (trfile), intent(inout) :: file + type (trfld),intent(inout) :: flds(:) + type(physics_state), intent(in) :: state(begchunk:endchunk) + + integer :: recnos(4),i,f,nflds ! + integer :: cnt4(4) ! array of counts for each dimension + integer :: strt4(4) ! array of starting indices + integer :: cnt3(3) ! array of counts for each dimension + integer :: strt3(3) ! array of starting indices + type(file_desc_t) :: fids(4) + logical :: times_found + + integer :: cur_yr, cur_mon, cur_day, cur_sec, yr1, yr2, mon, date, sec + real(r8) :: series1_time, series2_time + type(file_desc_t) :: fid1, fid2 + + integer :: nspec,nmodes,n,ii,kk,l1,k,lchnk + real(r8) :: profile_p(pver),pp(pver),meanP,meanO,sumii,volfrac,specdens,aero_den(6) + real(r8) :: q_a(3,6) + real(r8) :: rho(pcols,pver) ! air density (kg m-3) + character(len=20) :: aername + character(len=3) :: arnam(7) = (/'so4','pom','soa','bc ','dst','ncl','num'/) + + nflds = size(flds) + times_found = .false. + + if(single_column .and. scm_observed_aero) then + + call ver_profile_aero(pp) + ! The following do loop gets the species properties and calculates the aerosol + ! mass mixing ratio of each species from observed total number and size distribution + ! properties in the unit kg/m^3 for the 3 modes. Data is read from the forcing file. + ! For mode 1 (accumulation mode) q_a(1,1)=q(so4),q_a(1,2)=q(pom),q_a(1,3)=q(soa), + ! q_a(1,4)=q(bc),q_a(1,5)=q(dst),q_a(1,6)=q(ncl). + ! For mode 2 (aitken mode) q_a(2,1)=q(so4),q_a(2,2)=q(soa),q_a(2,3)=q(ncl). + ! For mode 3 (coarse mode) q_a(3,1)=q(dst),q_a(3,2)=q(ncl),q_a(3,3)=q(so4). + + call rad_cnst_get_info(0, nmodes=nmodes) + do n=1, nmodes + call rad_cnst_get_info(0, n, nspec=nspec) + do l1 = 1, nspec + call rad_cnst_get_aer_props(0, n,l1,density_aer=specdens) + call rad_cnst_get_aer_props(0, n, l1, aername=aername) + aero_den(l1)=specdens + q_a(n,l1) = specdens*scm_div(n,l1)*scm_num(n)*((pi/6.0_r8)*( & + scm_dgnum(n)**3)*exp(4.5_r8*(log(scm_std(n))**2) )) + enddo + enddo + + do k = 1, pver + do ii = 1, state(begchunk)%ncol + rho(ii,k) = state(begchunk)%pmid(ii,k)/(rair*state(begchunk)%t(ii,k)) + enddo + enddo + end if + + do while( .not. times_found ) + call find_times( recnos, fids, file%curr_mod_time,file,file%datatimem,file%datatimep, times_found ) + if ( .not. times_found ) then + call check_files( file, fids, recnos, times_found ) + endif + enddo + + ! If single column do not interpolate aerosol data, just use the step function. + ! The exception is if we are trying to "replay" a column from the full model + if(single_column .and. .not. use_replay) then + file%stepTime = .true. + endif + + if (file%stepTime) then + file%interp_recs = 1 + else + file%interp_recs = 2 + end if + + if ( file%fill_in_months ) then + + if( file%datatimep-file%datatimem > file%one_yr ) then + + call get_curr_date(cur_yr, cur_mon, cur_day, cur_sec) + + call set_date_from_time_float(file%datatimem, yr1, mon, date, sec ) + call set_date_from_time_float(file%datatimep, yr2, mon, date, sec ) + + call set_time_float_from_date( series1_time, yr1, cur_mon, cur_day, cur_sec ) + call set_time_float_from_date( series2_time, yr2, cur_mon, cur_day, cur_sec ) + + fid1 = fids(1) + fid2 = fids(2) + file%cyclical = .true. + call set_cycle_indices( fid1, file%cyc_ndx_beg, file%cyc_ndx_end, yr1) + call find_times( recnos(1:2), fids(1:2), series1_time, file, file%datatimes(1), file%datatimes(2), times_found ) + + if ( .not. times_found ) then + call endrun('read_next_trcdata: time not found for series1_time') + endif + call set_cycle_indices( fid2, file%cyc_ndx_beg, file%cyc_ndx_end, yr2) + + if ( fid1%fh /= fid2%fh ) then + file%cyc_ndx_beg = file%cyc_ndx_beg + size(file%curr_data_times) + file%cyc_ndx_end = file%cyc_ndx_end + size(file%curr_data_times) + endif + call find_times( recnos(3:4), fids(3:4), series2_time, file, file%datatimes(3), file%datatimes(4), times_found ) + if ( .not. times_found ) then + call endrun('read_next_trcdata: time not found for series2_time') + endif + file%cyclical = .false. + file%interp_recs = 4 + + call set_date_from_time_float( file%datatimes(1), yr1, mon, date, sec ) + call set_time_float_from_date( file%datatimem, cur_yr, mon, date, sec ) + if (file%datatimes(1) > file%datatimes(2) ) then ! wrap around + if ( cur_mon == 1 ) then + call set_time_float_from_date( file%datatimem, cur_yr-1, mon, date, sec ) + endif + endif + + call set_date_from_time_float( file%datatimes(2), yr1, mon, date, sec ) + call set_time_float_from_date( file%datatimep, cur_yr, mon, date, sec ) + if (file%datatimes(1) > file%datatimes(2) ) then ! wrap around + if ( cur_mon == 12 ) then + call set_time_float_from_date( file%datatimep, cur_yr+1, mon, date, sec ) + endif + endif + + endif + + endif + + ! + ! Set up hyperslab corners + ! + strt4(:) = 1 + strt3(:) = 1 + + do i=1,file%interp_recs + + do f = 1,nflds + if ( file%zonal_ave ) then + ! Defend against zonal mean surface fields that do not set the value via dimension match + if (flds(f)%coords(ZA_LATDIM) .gt. 0) cnt3(flds(f)%coords(ZA_LATDIM)) = file%nlat + if (flds(f)%srf_fld) then + ! Defend against zonal mean surface fields that do not set the value via dimension match + if (flds(f)%coords(ZA_LEVDIM) .gt. 0) cnt3(flds(f)%coords(ZA_LEVDIM)) = 1 + else + cnt3(flds(f)%coords(ZA_LEVDIM)) = file%nlev + endif + cnt3(flds(f)%coords(ZA_TIMDIM)) = 1 + strt3(flds(f)%coords(ZA_TIMDIM)) = recnos(i) + !! + if (file%linoz_v3 .or. file%linoz_v2) then + !!check if these are the surface variables + !!no need to do interpolate since only used + !!in preprocessing, + !!clim +57 is the correspondent srf variable + if (index(flds(f)%fldnam,"_clim") .gt.0.and.& + index(flds(f)%fldnam,"P_clim") .le.0.and.& + index(flds(f)%fldnam,"L_clim") .le.0.and.& + index(flds(f)%fldnam,"_srf") .le.0)then + call read_za_trc_linoz( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file, & + (/ flds(f)%order(ZA_LATDIM),flds(f)%order(ZA_LEVDIM)/), & + vid_srf=flds(f+57)%var_id ) + elseif (index(flds(f)%fldnam,"_srf").gt.0) then + if (index(flds(f)%fldnam,"ch4_avg_srf").gt.0) then + cnt3(1)=1!set 1st dim since no ZA_LATDIM + endif + call read_zasrf_trc_linoz(fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file) + else + call read_za_trc_linoz( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file, & + (/ flds(f)%order(ZA_LATDIM),flds(f)%order(ZA_LEVDIM) /) ) + endif + else + call read_za_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file, & + (/ flds(f)%order(ZA_LATDIM),flds(f)%order(ZA_LEVDIM) /) ) + endif + else if ( flds(f)%srf_fld ) then + cnt3( flds(f)%coords(LONDIM)) = file%nlon + cnt3( flds(f)%coords(LATDIM)) = file%nlat + cnt3( flds(f)%coords(PS_TIMDIM)) = 1 + strt3(flds(f)%coords(PS_TIMDIM)) = recnos(i) + call read_2d_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data(:,1,:), strt3, cnt3, file, & + (/ flds(f)%order(LONDIM),flds(f)%order(LATDIM) /) ) + else + cnt4(flds(f)%coords(LONDIM)) = file%nlon + cnt4(flds(f)%coords(LATDIM)) = file%nlat + cnt4(flds(f)%coords(LEVDIM)) = file%nlev + cnt4(flds(f)%coords(TIMDIM)) = 1 + strt4(flds(f)%coords(TIMDIM)) = recnos(i) + call read_3d_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt4, cnt4, file, & + (/ flds(f)%order(LONDIM),flds(f)%order(LATDIM),flds(f)%order(LEVDIM) /)) + + ! + ! This section sets the observed aersol mass and number mixing ratios in the + ! appropriate variables. The observed aerosol inforamtion is read from the + ! forcing file as total number and size distribution parameters. Then the total + ! volume is calculated.Using the desnsity of each species, the mass is calculated. + ! Finally the number is partition among the each species using the species fraction + ! data read from the forcing file. + ! + if(single_column .and. scm_observed_aero) then + kk=index(trim(flds(f)%fldnam),'_')-1 + if(index(trim(flds(f)%fldnam),'1') > 0 .and.index(trim(flds(f)%fldnam),'log') < 1) then + if(flds(f)%fldnam(1:kk).eq.arnam(1).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(1),flds(f)%input(i)%data, & + rho,pp,q_a(1,1),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(2).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(2),flds(f)%input(i)%data, & + rho,pp,q_a(1,2),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(3).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(3),flds(f)%input(i)%data, & + rho,pp,q_a(1,3),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(4).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(4),flds(f)%input(i)%data, & + rho,pp,q_a(1,4),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(5).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(5),flds(f)%input(i)%data, & + rho,pp,q_a(1,5),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(6).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(6),flds(f)%input(i)%data, & + rho,pp,q_a(1,6),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(7).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(7),flds(f)%input(i)%data, & + rho,pp,scm_num(1),state(begchunk)%ncol) + endif + elseif(index(trim(flds(f)%fldnam),'2') > 0 .and.index(trim(flds(f)%fldnam),'log') < 1) then + if(flds(f)%fldnam(1:kk).eq.arnam(1).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(1),flds(f)%input(i)%data, & + rho,pp,q_a(2,1),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(3).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(3),flds(f)%input(i)%data, & + rho,pp,q_a(2,2),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(6).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(6),flds(f)%input(i)%data, & + rho,pp,q_a(2,3),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(7).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(7),flds(f)%input(i)%data, & + rho,pp,scm_num(2),state(begchunk)%ncol) + endif + elseif(index(trim(flds(f)%fldnam),'3') > 0 .and.index(trim(flds(f)%fldnam),'log') < 1) then + if(flds(f)%fldnam(1:kk).eq.arnam(1).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(1),flds(f)%input(i)%data, & + rho,pp,q_a(3,3),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(5).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(5),flds(f)%input(i)%data, & + rho,pp,q_a(3,1),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(6).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(6),flds(f)%input(i)%data, & + rho,pp,q_a(3,2),state(begchunk)%ncol) + elseif(flds(f)%fldnam(1:kk).eq.arnam(7).and.index(trim(flds(f)%fldnam),'log') < 1) then + call replace_aero_data(flds(f)%fldnam,arnam(7),flds(f)%input(i)%data, & + rho,pp,scm_num(3),state(begchunk)%ncol) + endif + endif + endif !scm_observed_aero + endif + + enddo + + if ( file%has_ps ) then + cnt3(file%ps_coords(LONDIM)) = file%nlon + cnt3(file%ps_coords(LATDIM)) = file%nlat + cnt3(file%ps_coords(PS_TIMDIM)) = 1 + strt3(file%ps_coords(PS_TIMDIM)) = recnos(i) + call read_2d_trc( fids(i), file%ps_id, file%ps_in(i)%data, strt3, cnt3, file, & + (/ file%ps_order(LONDIM),file%ps_order(LATDIM) /) ) + endif + + enddo + + end subroutine read_next_trcdata + +!-------------------------------------------------------------------------------- +!This subroutine replaces the climatological aerosol information by the observed +!once after they are read +! + subroutine replace_aero_data(aerofulnam,spnam,aero_q_data,rho,pp,q_mix,ncoli) + use ppgrid, only: pcols,pver,begchunk,endchunk + + implicit none + real(r8), intent(inout) :: aero_q_data(pcols,pver,begchunk:endchunk) + real(r8), intent(in) :: rho(pcols,pver),pp(pver) + real(r8) :: sumii,meanO + real(r8), intent(in) :: q_mix + character(len=32),intent(in) ::aerofulnam + character(len=3),intent(in) :: spnam + character(len=32) ::aerosubnam + integer, intent(in) :: ncoli + integer :: ii,k,countj + + if(trim(aerofulnam(1:2)).eq.'bc') then + aerosubnam=aerofulnam(1:4) + else + aerosubnam=aerofulnam(1:5) + endif + + if((trim(aerosubnam).eq.(trim(spnam)//'_a').or.trim(aerosubnam).eq.(trim(spnam)//'_c')) & + .and.index(trim(aerofulnam),'log') < 1) then + + aero_q_data=q_mix + sumii=0._r8 + countj =0 + do ii = 1, ncoli + do k = 1, pver + if(pp(k).gt.0._r8) then + countj=countj+1 + endif + if(trim(spnam).ne.'num') then + aero_q_data(ii,k,begchunk)=(aero_q_data(ii,k,begchunk)*pp(k)) /rho(ii,k) + endif + sumii=sumii + aero_q_data(ii,k,begchunk) + enddo + enddo + meanO=sumii/countj + do k = 1, pver + if(meanO.ne.0.) then + aero_q_data(1,k,begchunk)=pp(k)*meanO + else + aero_q_data(1,k,begchunk)=0._r8 + endif + enddo + endif + + end subroutine replace_aero_data + +!--------------------------------------------------------------------------- +!This subroutine generates a heavyside type profiles for the observed aerosol. +!This setting is constant profile in the lower atmosphere and then exponentially +!decreasing to zero at the top of the atmosphere. The level of initial decay is +!controlled by "initial_val". Larger than -3.5 pushes the decay point up and smaller +!brings it closer to the surface. +! + subroutine ver_profile_aero(vertprof_aero) + use mo_constants, only : pi + use ppgrid, only: pcols,pver + + implicit none + real(r8), intent(inout) :: vertprof_aero(pver) + real(r8) :: initial_val = -3.5_r8 + integer :: k + + do k=1,pver + if(k==1) then + vertprof_aero(k)=0._r8 + elseif(k==2) then + vertprof_aero(k)=1._r8/(1._r8 + exp(-2._r8*initial_val * pi)) + else + vertprof_aero(k)=1._r8/(1._r8 + exp(-2._r8*(initial_val * pi + pi/4._r8*(k-2)))) + endif + enddo + end subroutine ver_profile_aero + +!------------------------------------------------------------------------ + + + subroutine read_2d_trc( fid, vid, loc_arr, strt, cnt, file, order ) + use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish + + use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p, get_lon_all_p, get_lat_all_p + use mo_constants, only : pi + use dycore, only: dycore_is + use polar_avg, only: polar_average + use horizontal_interpolate, only : xy_interp + + implicit none + type(file_desc_t), intent(in) :: fid + type(var_desc_t), intent(in) :: vid + integer, intent(in) :: strt(:), cnt(:), order(2) + real(r8),intent(out) :: loc_arr(:,:) + type (trfile), intent(in) :: file + + real(r8) :: to_lats(pcols), to_lons(pcols), wrk(pcols) + real(r8), allocatable, target :: wrk2d(:,:) + real(r8), pointer :: wrk2d_in(:,:) + + integer :: tsize, c, i, j, ierr, ncols + real(r8), parameter :: zero=0_r8, twopi=2_r8*pi + type(interp_type) :: lon_wgts, lat_wgts + integer :: lons(pcols), lats(pcols) + + nullify(wrk2d_in) + allocate( wrk2d(cnt(1),cnt(2)), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'read_2d_trc: wrk2d allocation error = ',ierr + call endrun + end if + + if(order(1)/=1 .or. order(2)/=2 .or. cnt(1)/=file%nlon .or. cnt(2)/=file%nlat) then + allocate( wrk2d_in(file%nlon, file%nlat), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'read_2d_trc: wrk2d_in allocation error = ',ierr + call endrun + end if + end if + + + + ierr = pio_get_var( fid, vid, strt, cnt, wrk2d ) + if(associated(wrk2d_in)) then + wrk2d_in = reshape( wrk2d(:,:),(/file%nlon,file%nlat/), order=order ) + deallocate(wrk2d) + else + wrk2d_in => wrk2d + end if + + j=1 + +! if weighting by latitude, the perform horizontal interpolation by using weight_x, weight_y + + if(file%weight_by_lat) then + + call t_startf('xy_interp') + + do c = begchunk,endchunk + ncols = get_ncols_p(c) + call get_lon_all_p(c,ncols,lons) + call get_lat_all_p(c,ncols,lats) + + call xy_interp(file%nlon,file%nlat,1,plon,plat,pcols,ncols,file%weight_x,file%weight_y,wrk2d_in,loc_arr(:,c-begchunk+1), & + lons,lats,file%count_x,file%count_y,file%index_x,file%index_y) + enddo + + call t_stopf('xy_interp') + + else + do c=begchunk,endchunk + ncols = get_ncols_p(c) + call get_rlat_all_p(c, pcols, to_lats) + call get_rlon_all_p(c, pcols, to_lons) + + call lininterp_init(file%lons, file%nlon, to_lons, ncols, 2, lon_wgts, zero, twopi) + call lininterp_init(file%lats, file%nlat, to_lats, ncols, 1, lat_wgts) + + call lininterp(wrk2d_in, file%nlon, file%nlat, loc_arr(1:ncols,c-begchunk+1), ncols, lon_wgts, lat_wgts) + + call lininterp_finish(lon_wgts) + call lininterp_finish(lat_wgts) + end do + endif + + if(allocated(wrk2d)) then + deallocate(wrk2d) + else + deallocate(wrk2d_in) + end if + if(dycore_is('LR')) call polar_average(loc_arr) + end subroutine read_2d_trc + +!------------------------------------------------------------------------ + + subroutine read_za_trc( fid, vid, loc_arr, strt, cnt, file, order ) + use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish + use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p + use mo_constants, only : pi + use dycore, only : dycore_is + use polar_avg, only : polar_average + + implicit none + type(file_desc_t), intent(in) :: fid + type(var_desc_t), intent(in) :: vid + integer, intent(in) :: strt(:), cnt(:) + integer, intent(in) :: order(2) + real(r8), intent(out):: loc_arr(:,:,:) + type (trfile), intent(in) :: file + + type(interp_type) :: lat_wgts + real(r8) :: to_lats(pcols), to_lons(pcols), wrk(pcols) + real(r8), allocatable, target :: wrk2d(:,:) + real(r8), pointer :: wrk2d_in(:,:) + integer :: c, k, ierr, ncols + + nullify(wrk2d_in) + allocate( wrk2d(cnt(1),cnt(2)), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'read_2d_trc: wrk2d allocation error = ',ierr + call endrun + end if + + if(order(1)/=1 .or. order(2)/=2 .or. cnt(1)/=file%nlat .or. cnt(2)/=file%nlev) then + allocate( wrk2d_in(file%nlat, file%nlev), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'read_2d_trc: wrk2d_in allocation error = ',ierr + call endrun + end if + end if + + + ierr = pio_get_var( fid, vid, strt, cnt, wrk2d ) + if(associated(wrk2d_in)) then + wrk2d_in = reshape( wrk2d(:,:),(/file%nlat,file%nlev/), order=order ) + deallocate(wrk2d) + else + wrk2d_in => wrk2d + end if + + + + do c=begchunk,endchunk + ncols = get_ncols_p(c) + call get_rlat_all_p(c, pcols, to_lats) + + call lininterp_init(file%lats, file%nlat, to_lats, ncols, 1, lat_wgts) + do k=1,file%nlev + call lininterp(wrk2d_in(:,k), file%nlat, wrk(1:ncols), ncols, lat_wgts) + loc_arr(1:ncols,k,c-begchunk+1) = wrk(1:ncols) + end do + call lininterp_finish(lat_wgts) + end do + + if(allocated(wrk2d)) then + deallocate(wrk2d) + else + deallocate(wrk2d_in) + end if +! if(dycore_is('LR')) call polar_average(loc_arr) + end subroutine read_za_trc +!------------------------------------------------------------------------ + subroutine read_za_trc_linoz( fid, vid, loc_arr, strt, cnt, file, order ,vid_srf) + use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish + use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p + use mo_constants, only : pi + use dycore, only : dycore_is + use polar_avg, only : polar_average + + implicit none + type(file_desc_t), intent(in) :: fid + type(var_desc_t), intent(in) :: vid + integer, intent(in) :: strt(:), cnt(:) + integer, intent(in) :: order(2) + real(r8), intent(out):: loc_arr(:,:,:) + type (trfile), intent(in) :: file + !! + type(var_desc_t), intent(in), optional :: vid_srf + integer :: cnt_srf(2) + integer :: strt_srf(2) + !! + type(interp_type) :: lat_wgts + real(r8) :: to_lats(pcols), to_lons(pcols), wrk(pcols) + real(r8), allocatable, target :: wrk2d(:,:) + real(r8), allocatable, target :: wrksrf(:) + real(r8), pointer :: wrk2d_in(:,:) + integer :: c, k, ierr, ncols + + nullify(wrk2d_in) + allocate( wrk2d(cnt(1),cnt(2)), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'read_2d_trc: wrk2d allocation error = ',ierr + call endrun + end if + + if(order(1)/=1 .or. order(2)/=2 .or. cnt(1)/=file%nlat .or. cnt(2)/=file%nlev) then + allocate( wrk2d_in(file%nlat, file%nlev), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'read_2d_trc: wrk2d_in allocation error = ',ierr + call endrun + end if + end if + !! + ierr = pio_get_var( fid, vid, strt, cnt, wrk2d ) + !! + if (file%linoz_v3) then + !!since io reads in global data for every thread + !!and interpolate to local chunk, we can do surface, + !!polar, and surface padding preprocessfor every variable + !!before interpolation + !!it is put here rather than the data formation process + !!to prevent forget when producing forcing data + !read in order of 0.1hPa~985hPa, pad top with 2nd layer + wrk2d(:,1)=wrk2d(:,2) + !both N/S poles need to pad by nearest data + wrk2d(1,:)=wrk2d(2,:) + wrk2d(file%nlat,:)=wrk2d(file%nlat-1,:) + !!read in srf data to pad surface + !!they are inputs from CMIP forcing and other references + cnt_srf(1)=cnt(1) + cnt_srf(2)=cnt(3) + strt_srf(1)=strt(1) + strt_srf(2)=strt(3) + !!check if vid_srf is present to determine clim variables + if (present(vid_srf)) then + !!padding for clim terms + allocate(wrksrf(cnt(1)), stat=ierr ) + ierr = pio_get_var( fid, vid_srf, strt_srf, cnt_srf, wrksrf ) + !!surface padding + wrk2d(:,file%nlev)=wrksrf + deallocate(wrksrf) + endif + !! + endif + !! + if(associated(wrk2d_in)) then + wrk2d_in = reshape( wrk2d(:,:),(/file%nlat,file%nlev/), order=order ) + deallocate(wrk2d) + else + wrk2d_in => wrk2d + end if + + do c=begchunk,endchunk + ncols = get_ncols_p(c) + call get_rlat_all_p(c, pcols, to_lats) + call lininterp_init(file%lats, file%nlat, to_lats, ncols, 1, lat_wgts) + do k=1,file%nlev + call lininterp(wrk2d_in(:,k), file%nlat, wrk(1:ncols), ncols, lat_wgts) + loc_arr(1:ncols,k,c-begchunk+1) = wrk(1:ncols) + end do + call lininterp_finish(lat_wgts) + end do + + if(allocated(wrk2d)) then + deallocate(wrk2d) + else + deallocate(wrk2d_in) + end if + !! + if(allocated(wrksrf)) then + deallocate(wrksrf) + end if +! if(dycore_is('LR')) call polar_average(loc_arr) + end subroutine read_za_trc_linoz + +!------------------------------------------------------------------------ + subroutine read_zasrf_trc_linoz( fid, vid, loc_arr, strt, cnt, file) + use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish + use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p + !! + implicit none + type(file_desc_t), intent(in) :: fid + type(var_desc_t), intent(in) :: vid + integer, intent(in) :: strt(:), cnt(:) + real(r8), intent(out):: loc_arr(:,:,:) + type (trfile), intent(in) :: file + !! + real(r8), allocatable, target :: wrk(:) + real(r8), pointer :: wrk_in(:) + real(r8) :: wrk_out(pcols) + type(interp_type) :: lat_wgts + real(r8) :: to_lats(pcols), to_lons(pcols) + integer :: c, k, ierr, ncols + integer :: cnt_srf(2) + integer :: strt_srf(2) + !! + nullify(wrk_in) + allocate( wrk(cnt(1)), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'read_zasrf_trc_linoz: wrk allocation error = ',ierr + call endrun + end if + !! + cnt_srf(1)=cnt(1) + cnt_srf(2)=cnt(3) + strt_srf(1)=strt(1) + strt_srf(2)=strt(3) + !! + !for surface variable with the dimension of (time,lat) or (time,1) + !for (time) it is also set like (time,1) + ierr = pio_get_var( fid, vid, strt_srf, cnt_srf, wrk ) + !! + if(associated(wrk_in)) then + wrk_in = reshape( wrk(:),(/file%nlat/)) + deallocate(wrk) + else + wrk_in => wrk + end if + !! + do c=begchunk,endchunk + ncols = get_ncols_p(c) + call get_rlat_all_p(c, pcols, to_lats) + call lininterp_init(file%lats, file%nlat, to_lats, ncols, 1, lat_wgts) + !! + if (cnt(1).eq.1) then!!for single timeseries + do k=1,1 + loc_arr(1:ncols,k,c-begchunk+1) = wrk_in(1) + end do + else + do k=1,1 + call lininterp(wrk_in(:), file%nlat, wrk_out(1:ncols), ncols, lat_wgts) + loc_arr(1:ncols,k,c-begchunk+1) = wrk_out(1:ncols) + end do + end if + !! + call lininterp_finish(lat_wgts) + end do + !! + if(allocated(wrk)) then + deallocate(wrk) + else + deallocate(wrk_in) + end if + !! + end subroutine read_zasrf_trc_linoz + +!------------------------------------------------------------------------ + + subroutine read_3d_trc( fid, vid, loc_arr, strt, cnt, file, order) + use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish + use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p, get_lon_all_p,& + get_lat_all_p + use mo_constants, only : pi + use dycore, only : dycore_is + use polar_avg, only : polar_average + use dycore, only : dycore_is + use horizontal_interpolate, only : xy_interp + + implicit none + + type(file_desc_t), intent(in) :: fid + type(var_desc_t), intent(in) :: vid + integer, intent(in) :: strt(:), cnt(:), order(3) + real(r8),intent(out) :: loc_arr(:,:,:) + + type (trfile), intent(in) :: file + + integer :: i,j,k, astat, c, ncols + integer :: lons(pcols), lats(pcols) + + integer :: jlim(2), jl, ju, ierr + integer :: gndx + + real(r8), allocatable, target :: wrk3d(:,:,:) + real(r8), pointer :: wrk3d_in(:,:,:) + real(r8) :: to_lons(pcols), to_lats(pcols) + real(r8), parameter :: zero=0_r8, twopi=2_r8*pi + type(interp_type) :: lon_wgts, lat_wgts + + loc_arr(:,:,:) = 0._r8 + nullify(wrk3d_in) + allocate(wrk3d(cnt(1),cnt(2),cnt(3)), stat=ierr) + if( ierr /= 0 ) then + write(iulog,*) 'read_3d_trc: wrk3d allocation error = ',ierr + call endrun + end if + + ierr = pio_get_var( fid, vid, strt, cnt, wrk3d ) + + if(order(1)/=1 .or. order(2)/=2 .or. order(3)/=3 .or. & + cnt(1)/=file%nlon.or.cnt(2)/=file%nlat.or.cnt(3)/=file%nlev) then + allocate(wrk3d_in(file%nlon,file%nlat,file%nlev),stat=ierr) + if( ierr /= 0 ) then + write(iulog,*) 'read_3d_trc: wrk3d allocation error = ',ierr + call endrun + end if + wrk3d_in = reshape( wrk3d(:,:,:),(/file%nlon,file%nlat,file%nlev/), order=order ) + deallocate(wrk3d) + else + wrk3d_in => wrk3d + end if + + j=1 + +! If weighting by latitude, then perform horizontal interpolation by using weight_x, weight_y + + if(file%weight_by_lat) then + + call t_startf('xy_interp') + + do c = begchunk,endchunk + ncols = get_ncols_p(c) + call get_lon_all_p(c,ncols,lons) + call get_lat_all_p(c,ncols,lats) + + call xy_interp(file%nlon,file%nlat,file%nlev,plon,plat,pcols,ncols,file%weight_x,file%weight_y,wrk3d_in, & + loc_arr(:,:,c-begchunk+1), lons,lats,file%count_x,file%count_y,file%index_x,file%index_y) + enddo + + call t_stopf('xy_interp') + + else + do c=begchunk,endchunk + ncols = get_ncols_p(c) + call get_rlat_all_p(c, pcols, to_lats) + call get_rlon_all_p(c, pcols, to_lons) + + call lininterp_init(file%lons, file%nlon, to_lons(1:ncols), ncols, 2, lon_wgts, zero, twopi) + call lininterp_init(file%lats, file%nlat, to_lats(1:ncols), ncols, 1, lat_wgts) + + + call lininterp(wrk3d_in, file%nlon, file%nlat, file%nlev, loc_arr(:,:,c-begchunk+1), ncols, pcols, lon_wgts, lat_wgts) + + + call lininterp_finish(lon_wgts) + call lininterp_finish(lat_wgts) + end do + endif + + if(allocated(wrk3d)) then + deallocate( wrk3d, stat=astat ) + else + deallocate( wrk3d_in, stat=astat ) + end if + if( astat/= 0 ) then + write(iulog,*) 'read_3d_trc: failed to deallocate wrk3d array; error = ',astat + call endrun + endif + if(dycore_is('LR')) call polar_average(file%nlev, loc_arr) + end subroutine read_3d_trc + +!------------------------------------------------------------------------------ + + subroutine interpolate_trcdata( state, flds, file, pbuf2d ) + use mo_util, only : rebin + use physics_types,only : physics_state + use physconst, only : cday + use physics_buffer, only : physics_buffer_desc, pbuf_get_field + + implicit none + + type(physics_state), intent(in) :: state(begchunk:endchunk) + type (trfld), intent(inout) :: flds(:) + type (trfile), intent(inout) :: file + + type(physics_buffer_desc), optional, pointer :: pbuf2d(:,:) + + + real(r8) :: fact1, fact2 + real(r8) :: deltat + integer :: f,nflds,c,ncol, i,k + real(r8) :: ps(pcols) + real(r8) :: datain(pcols,file%nlev) + real(r8) :: pin(pcols,file%nlev) + real(r8) :: pint(pcols,file%nilev) + + real(r8) :: model_z(pverp) + real(r8), parameter :: m2km = 1.e-3_r8 + real(r8), pointer :: data_out3d(:,:,:) + real(r8), pointer :: data_out(:,:) + integer :: chnk_offset + + nflds = size(flds) + + if ( file%interp_recs == 4 ) then + deltat = file%datatimes(3) - file%datatimes(1) + fact1 = (file%datatimes(3) - file%datatimem)/deltat + fact2 = 1._r8-fact1 +!$OMP PARALLEL DO PRIVATE (C, NCOL, F) + do c = begchunk,endchunk + ncol = state(c)%ncol + if ( file%has_ps ) then + file%ps_in(1)%data(:ncol,c) = fact1*file%ps_in(1)%data(:ncol,c) + fact2*file%ps_in(3)%data(:ncol,c) + endif + do f = 1,nflds + flds(f)%input(1)%data(:ncol,:,c) = fact1*flds(f)%input(1)%data(:ncol,:,c) + fact2*flds(f)%input(3)%data(:ncol,:,c) + enddo + enddo + + deltat = file%datatimes(4) - file%datatimes(2) + fact1 = (file%datatimes(4) - file%datatimep)/deltat + fact2 = 1._r8-fact1 + +!$OMP PARALLEL DO PRIVATE (C, NCOL, F) + do c = begchunk,endchunk + ncol = state(c)%ncol + if ( file%has_ps ) then + file%ps_in(2)%data(:ncol,c) = fact1*file%ps_in(2)%data(:ncol,c) + fact2*file%ps_in(4)%data(:ncol,c) + endif + do f = 1,nflds + flds(f)%input(2)%data(:ncol,:,c) = fact1*flds(f)%input(2)%data(:ncol,:,c) + fact2*flds(f)%input(4)%data(:ncol,:,c) + enddo + enddo + + endif + !------------------------------------------------------------------------- + ! If file%interp_recs=1 then no time interpolation -- set + ! fact1=1 and fact2=0 and will just use first value unmodified + !------------------------------------------------------------------------- + + if (file%interp_recs == 1) then + fact1=1._r8 + fact2=0._r8 + else + file%interp_recs = 2 + + deltat = file%datatimep - file%datatimem + + if ( file%cyclical .and. (deltat < 0._r8) ) then + deltat = deltat+file%one_yr + if ( file%datatimep >= file%curr_mod_time ) then + fact1 = (file%datatimep - file%curr_mod_time)/deltat + else + fact1 = (file%datatimep+file%one_yr - file%curr_mod_time)/deltat + endif + else + fact1 = (file%datatimep - file%curr_mod_time)/deltat + endif + + ! this assures that FIXED data are b4b on restarts + if ( file%fixed ) then + fact1 = dble(int(fact1*cday+.5_r8))/dble(cday) + endif + fact2 = 1._r8-fact1 + endif + + chnk_offset=-begchunk+1 + + fld_loop: do f = 1,nflds + + if (flds(f)%pbuf_ndx<=0) then + data_out3d => flds(f)%data(:,:,:) + endif + +!$OMP PARALLEL DO PRIVATE (C, NCOL, PS, I, K, PIN, DATAIN, MODEL_Z, DATA_OUT) + do c = begchunk,endchunk + if (flds(f)%pbuf_ndx>0) then + if(.not.present(pbuf2d)) then + call endrun ('tracer_data.F90(subr interpolate_trcdata):' // & + 'pbuf2d must be passed as an argument for pbuf_get_field subr call') + endif + call pbuf_get_field(pbuf2d, c, flds(f)%pbuf_ndx, data_out) + else + data_out => data_out3d(:,:,c+chnk_offset) + endif + ncol = state(c)%ncol + if (file%alt_data) then + + if (fact2 == 0) then ! This needed as %data is not set if fact2=0 (and lahey compiler core dumps) + datain(:ncol,:) = fact1*flds(f)%input(nm)%data(:ncol,:,c) + else + datain(:ncol,:) = fact1*flds(f)%input(nm)%data(:ncol,:,c) + fact2*flds(f)%input(np)%data(:ncol,:,c) + end if + do i = 1,ncol + model_z(1:pverp) = m2km * state(c)%zi(i,pverp:1:-1) + call rebin( file%nlev, pver, file%ilevs, model_z, datain(i,:), data_out(i,:) ) + enddo + + else + + if ( file%nlev>1 ) then + if ( file%has_ps ) then + if (fact2 == 0) then ! This needed as %data is not set if fact2=0 (and lahey compiler core dumps) + ps(:ncol) = fact1*file%ps_in(nm)%data(:ncol,c) + else + ps(:ncol) = fact1*file%ps_in(nm)%data(:ncol,c) + fact2*file%ps_in(np)%data(:ncol,c) + end if + do i = 1,ncol + do k = 1,file%nlev + pin(i,k) = file%p0*file%hyam(k) + ps(i)*file%hybm(k) + enddo + enddo + else + do k = 1,file%nlev + pin(:,k) = file%levs(k) + enddo + !!Currently designed for linoz_v2/v3 use + if (file%linoz_v3 .or. file%linoz_v2) then + do k = 1,file%nilev + pint(:,k) = file%ilevs(k) + enddo + endif + endif + endif + + if (flds(f)%srf_fld) then + do i = 1,ncol + if (fact2 == 0) then ! This needed as %data is not set if fact2=0 (and lahey compiler core dumps) + data_out(i,1) = & + fact1*flds(f)%input(nm)%data(i,1,c) + else + data_out(i,1) = & + fact1*flds(f)%input(nm)%data(i,1,c) + fact2*flds(f)%input(np)%data(i,1,c) + endif + enddo + else + if (fact2 == 0) then ! This needed as %data is not set if fact2=0 (and lahey compiler core dumps) + datain(:ncol,:) = fact1*flds(f)%input(nm)%data(:ncol,:,c) + else + datain(:ncol,:) = fact1*flds(f)%input(nm)%data(:ncol,:,c) + fact2*flds(f)%input(np)%data(:ncol,:,c) + end if + if ( file%top_bndry ) then + call vert_interp_ub(ncol, file%nlev, file%levs, datain(:ncol,:), data_out(:ncol,:) ) + else if(file%conserve_column) then + call vert_interp_mixrat(ncol,file%nlev,pver,state(c)%pint, & + datain, data_out(:,:), & + file%p0,ps,file%hyai,file%hybi) + else if(file%linoz_v3 .or. file%linoz_v2) then + !!uci chemistry for linoz that better conserves mass + !!uci interpolation for 55 out of 57 variables in linoz_v3 + !!excluding t_clim, o3col_clim + !!for linoz_v2 it is simiar with less variables + if (flds(f)%fldnam.ne.'t_clim ' & + .and.flds(f)%fldnam.ne.'o3col_clim ') then + !!file ilevs is in hPa, while model level in Pa, so times 100 + call vert_interp_uci(ncol, file%nlev, 100*file%ilevs, state(c)%pint, datain, data_out(:,:) ) + else + call vert_interp(ncol, file%nlev, pin, state(c)%pmid, datain, data_out(:,:) ) + endif + !! + else + call vert_interp(ncol, file%nlev, pin, state(c)%pmid, datain, data_out(:,:) ) + endif + endif + + endif + enddo + + enddo fld_loop + + end subroutine interpolate_trcdata + +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- + subroutine get_dimension( fid, dname, dsize, dimid, data ) + implicit none + type(file_desc_t), intent(inout) :: fid + character(*), intent(in) :: dname + integer, intent(out) :: dsize + + integer, optional, intent(out) :: dimid + real(r8), optional, pointer, dimension(:) :: data + + integer :: vid, ierr, id + + call pio_seterrorhandling( fid, PIO_BCAST_ERROR) + ierr = pio_inq_dimid( fid, dname, id ) + call pio_seterrorhandling( fid, PIO_INTERNAL_ERROR) + + if ( ierr==PIO_NOERR ) then + + ierr = pio_inq_dimlen( fid, id, dsize ) + + if ( present(dimid) ) then + dimid = id + endif + + if ( present(data) ) then + if ( associated(data) ) then + deallocate(data, stat=ierr) + if( ierr /= 0 ) then + write(iulog,*) 'get_dimension: data deallocation error = ',ierr + call endrun('get_dimension: failed to deallocate data array') + end if + endif + allocate( data(dsize), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'get_dimension: data allocation error = ',ierr + call endrun('get_dimension: failed to allocate data array') + end if + + ierr = pio_inq_varid( fid, dname, vid ) + ierr = pio_get_var( fid, vid, data ) + endif + else + dsize = 1 + if ( present(dimid) ) then + dimid = -1 + endif + endif + + end subroutine get_dimension + +!----------------------------------------------------------------------- +!----------------------------------------------------------------------- + subroutine set_cycle_indices( fileid, cyc_ndx_beg, cyc_ndx_end, cyc_yr ) + + implicit none + + type(file_desc_t), intent(inout) :: fileid + integer, intent(out) :: cyc_ndx_beg + integer, intent(out) :: cyc_ndx_end + integer, intent(in) :: cyc_yr + + integer, allocatable , dimension(:) :: dates, datesecs + integer :: timesize, i, astat, year, ierr + type(var_desc_T) :: dateid + call get_dimension( fileid, 'time', timesize ) + cyc_ndx_beg=-1 + + allocate( dates(timesize), stat=astat ) + if( astat/= 0 ) then + write(*,*) 'set_cycle_indices: failed to allocate dates array; error = ',astat + call endrun + end if + + ierr = pio_inq_varid( fileid, 'date', dateid ) + ierr = pio_get_var( fileid, dateid, dates ) + + do i=1,timesize + year = dates(i) / 10000 + if ( year == cyc_yr ) then + if (cyc_ndx_beg < 0) then + cyc_ndx_beg = i + endif + cyc_ndx_end = i + endif + enddo + deallocate( dates, stat=astat ) + if( astat/= 0 ) then + write(*,*) 'set_cycle_indices: failed to deallocate dates array; error = ',astat + call endrun + end if + if (cyc_ndx_beg < 0) then + write(*,*) 'set_cycle_indices: cycle year not found : ' , cyc_yr + call endrun('set_cycle_indices: cycle year not found') + endif + + end subroutine set_cycle_indices +!----------------------------------------------------------------------- + +!----------------------------------------------------------------------- + subroutine open_trc_datafile( fname, path, piofile, times, cyc_ndx_beg, cyc_ndx_end, cyc_yr ) + + use ioFileMod, only: getfil + use cam_pio_utils, only: cam_pio_openfile + + implicit none + + character(*), intent(in) :: fname + character(*), intent(in) :: path + type(file_desc_t), intent(inout) :: piofile + real(r8), pointer :: times(:) + + integer, optional, intent(out) :: cyc_ndx_beg + integer, optional, intent(out) :: cyc_ndx_end + integer, optional, intent(in) :: cyc_yr + + character(len=shr_kind_cl) :: filen, filepath + integer :: year, month, day, dsize, i, timesize + integer :: dateid,secid + integer, allocatable , dimension(:) :: dates, datesecs + integer :: astat, ierr + logical :: need_first_ndx + + if (len_trim(path) == 0) then + filepath = trim(fname) + else + filepath = trim(path) // '/' // trim(fname) + end if + ! + ! open file and get fileid + ! + call getfil( filepath, filen, 0 ) + call cam_pio_openfile( piofile, filen, PIO_NOWRITE) + if(masterproc) write(iulog,*)'open_trc_datafile: ',trim(filen) + + call get_dimension(piofile, 'time', timesize) + + if ( associated(times) ) then + deallocate(times, stat=ierr) + if( ierr /= 0 ) then + write(iulog,*) 'open_trc_datafile: data deallocation error = ',ierr + call endrun('open_trc_datafile: failed to deallocate data array') + end if + endif + allocate( times(timesize), stat=ierr ) + if( ierr /= 0 ) then + write(iulog,*) 'open_trc_datafile: data allocation error = ',ierr + call endrun('open_trc_datafile: failed to allocate data array') + end if + + allocate( dates(timesize), stat=astat ) + if( astat/= 0 ) then + if(masterproc) write(iulog,*) 'open_trc_datafile: failed to allocate dates array; error = ',astat + call endrun + end if + allocate( datesecs(timesize), stat=astat ) + if( astat/= 0 ) then + if(masterproc) write(iulog,*) 'open_trc_datafile: failed to allocate datesec array; error = ',astat + call endrun + end if + + ierr = pio_inq_varid( piofile, 'date', dateid ) + call pio_seterrorhandling( piofile, PIO_BCAST_ERROR) + ierr = pio_inq_varid( piofile, 'datesec', secid ) + call pio_seterrorhandling( piofile, PIO_INTERNAL_ERROR) + + if(ierr==PIO_NOERR) then + ierr = pio_get_var( piofile, secid, datesecs ) + else + datesecs=0 + end if + + ierr = pio_get_var( piofile, dateid, dates ) + need_first_ndx=.true. + + do i=1,timesize + year = dates(i) / 10000 + month = mod(dates(i),10000)/100 + day = mod(dates(i),100) + call set_time_float_from_date( times(i), year, month, day, datesecs(i) ) + if ( present(cyc_yr) ) then + if ( year == cyc_yr ) then + if ( present(cyc_ndx_beg) .and. need_first_ndx ) then + cyc_ndx_beg = i + need_first_ndx = .false. + endif + if ( present(cyc_ndx_end) ) then + cyc_ndx_end = i + endif + endif + endif + enddo + + deallocate( dates, stat=astat ) + if( astat/= 0 ) then + if(masterproc) write(iulog,*) 'open_trc_datafile: failed to deallocate dates array; error = ',astat + call endrun + end if + deallocate( datesecs, stat=astat ) + if( astat/= 0 ) then + if(masterproc) write(iulog,*) 'open_trc_datafile: failed to deallocate datesec array; error = ',astat + call endrun + end if + + if ( present(cyc_yr) .and. present(cyc_ndx_beg) ) then + if (cyc_ndx_beg < 0) then + write(iulog,*) 'open_trc_datafile: cycle year not found : ' , cyc_yr + call endrun('open_trc_datafile: cycle year not found') + endif + endif + + end subroutine open_trc_datafile + +!-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- + subroutine specify_fields( specifier, fields ) + + implicit none + + character(len=*), intent(in) :: specifier(:) + type(trfld), pointer, dimension(:) :: fields + + integer :: fld_cnt, astat + integer :: i,j + character(len=shr_kind_cl) :: str1, str2 + character(len=32), allocatable, dimension(:) :: fld_name, src_name + integer :: nflds + + nflds = size(specifier) + + allocate(fld_name(nflds), src_name(nflds), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'specify_fields: failed to allocate fld_name, src_name arrays; error = ',astat + call endrun + end if + + fld_cnt = 0 + + count_cnst: do i = 1, nflds + + if ( len_trim( specifier(i) ) == 0 ) then + exit count_cnst + endif + + j = scan( specifier(i),':') + + if (j > 0) then + str1 = trim(adjustl( specifier(i)(:j-1) )) + str2 = trim(adjustl( specifier(i)(j+1:) )) + fld_name(i) = trim(adjustl( str1 )) + src_name(i) = trim(adjustl( str2 )) + else + fld_name(i) = trim(adjustl( specifier(i) )) + src_name(i) = trim(adjustl( specifier(i) )) + endif + + fld_cnt = fld_cnt + 1 + + enddo count_cnst + + if( fld_cnt < 1 ) then + nullify(fields) + return + end if + + !----------------------------------------------------------------------- + ! ... allocate field type array + !----------------------------------------------------------------------- + allocate( fields(fld_cnt), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'specify_fields: failed to allocate fields array; error = ',astat + call endrun + end if + + do i = 1,fld_cnt + fields(i)%fldnam = fld_name(i) + fields(i)%srcnam = src_name(i) + enddo + + deallocate(fld_name, src_name) + + end subroutine specify_fields + +!------------------------------------------------------------------------------ + + subroutine init_trc_restart( whence, piofile, tr_file ) + + implicit none + character(len=*), intent(in) :: whence + type(file_desc_t), intent(inout) :: piofile + type(trfile), intent(inout) :: tr_file + + character(len=32) :: name + integer :: ioerr, mcdimid, maxlen + + + ! Dimension should already be defined in restart file + call pio_seterrorhandling(pioFile, PIO_BCAST_ERROR) + ioerr = pio_inq_dimid(pioFile,'max_chars', mcdimid) + call pio_seterrorhandling(pioFile, PIO_INTERNAL_ERROR) + ! but define it if nessasary + if(ioerr/= PIO_NOERR) then + ioerr = pio_def_dim(pioFile, 'max_chars', SHR_KIND_CL, mcdimid) + end if + + if(len_trim(tr_file%curr_filename)>1) then + allocate(tr_file%currfnameid) + name = trim(whence)//'_curr_fname' + ioerr = pio_def_var(pioFile, name,pio_char, (/mcdimid/), tr_file%currfnameid) + ioerr = pio_put_att(pioFile, tr_file%currfnameid, 'offset_time', tr_file%offset_time) + maxlen = len_trim(tr_file%curr_filename) + ioerr = pio_put_att(pioFile, tr_file%currfnameid, 'actual_len', maxlen) + else + nullify(tr_file%currfnameid) + end if + + if(len_trim(tr_file%next_filename)>1) then + allocate(tr_file%nextfnameid) + name = trim(whence)//'_next_fname' + ioerr = pio_def_var(pioFile, name,pio_char, (/mcdimid/), tr_file%nextfnameid) + maxlen = len_trim(tr_file%next_filename) + ioerr = pio_put_att(pioFile, tr_file%nextfnameid, 'actual_len', maxlen) + else + nullify(tr_file%nextfnameid) + end if + end subroutine init_trc_restart +!------------------------------------------------------------------------- +! writes file names to restart file +!------------------------------------------------------------------------- + subroutine write_trc_restart( piofile, tr_file ) + + implicit none + + type(file_desc_t), intent(inout) :: piofile + type(trfile), intent(inout) :: tr_file + + integer :: ioerr, slen ! error status + if(associated(tr_file%currfnameid)) then + ioerr = pio_put_var(pioFile, tr_file%currfnameid, tr_file%curr_filename) + deallocate(tr_file%currfnameid) + nullify(tr_file%currfnameid) + end if + if(associated(tr_file%nextfnameid)) then + ioerr = pio_put_var(pioFile, tr_file%nextfnameid, tr_file%next_filename) + deallocate(tr_file%nextfnameid) + nullify(tr_file%nextfnameid) + end if + end subroutine write_trc_restart + +!------------------------------------------------------------------------- +! reads file names from restart file +!------------------------------------------------------------------------- + subroutine read_trc_restart( whence, piofile, tr_file ) + + implicit none + + character(len=*), intent(in) :: whence + type(file_desc_t), intent(inout) :: piofile + type(trfile), intent(inout) :: tr_file + type(var_desc_t) :: vdesc + character(len=64) :: name + integer :: ioerr ! error status + integer :: slen + + call PIO_SetErrorHandling(piofile, PIO_BCAST_ERROR) + name = trim(whence)//'_curr_fname' + ioerr = pio_inq_varid(piofile, name, vdesc) + if(ioerr==PIO_NOERR) then + tr_file%curr_filename=' ' + ioerr = pio_get_att(piofile, vdesc, 'offset_time', tr_file%offset_time) + ioerr = pio_get_att(piofile, vdesc, 'actual_len', slen) + ioerr = pio_get_var(piofile, vdesc, tr_file%curr_filename) + if(slen P2 (decreasing up) +!--- integrates (p-avg) the value F0 from F on the grid P +!--- assumes model pressure increases from top to bottom. +!---NOTE reverse order in P's +!---Assume that the quantity is constant over range halfway to layer above/below +!--- and calculate box edges from model top to model bottom +! +!---For a model level between pressure range P1 > P2 (decreasing up) +!---calculate the SOM Z-moments of the loss freq at std z* (log-p) intervals +!-------- the pressure levels BETWEEN z* values are: +! P(i) < P(i+1) bounds z*(i) +!-------- The MOMENTS for a square-wave or 'bar': F(x)=F0 b<=x<=c, =0.0 else +!----- S0 = f0 (x) [from x=b to x=c] +!----------------------------------------------------------------------- + implicit none + integer, intent(in) :: NL + real(r8), intent(in) :: P1,P2,P(NL+1),F(NL) + real(r8), intent(out):: F0 + integer I + real(r8) XB,XC,PC,PB,SGNF0,PF1,PF2 +!----------------------------------------------------------------------- + F0 = 0._r8 + ! + do I = 1,NL + PF1=P(I) + PF2=P(I+1) + ! + PC = min(P1,PF2) + PB = max(P2,PF1) + ! + if (PC .gt. PB) then +!--- have condition: P1 .ge. PC .gt. PB .ge. P2 +!--- and 0 .le. XB .lt. XC .le. 1 + XC = (PC-P2)/(P1-P2) + XB = (PB-P2)/(P1-P2) +!-------- assume that the quantity, F, is constant over interval [XLO,XUP], +!-------- F0: (c-b), +!-------- calculate its contribution to the moments in the interval [0,1] + F0 = F0 +F(I) *(XC -XB) + endif + enddo +!---limiter on Z-moments: force monotonicity (tables can be + or -) + SGNF0 = sign(1._r8, F0) + F0 = abs(F0) + F0 = SGNF0 * F0 + END SUBROUTINE vert_interp_uci_single +!------------------------------------------------------------------------------ + subroutine vert_interp_ub( ncol, nlevs, plevs, datain, dataout ) + use ref_pres, only : ptop_ref + + + !----------------------------------------------------------------------- + ! + ! Interpolate data from current time-interpolated values to top interface pressure + ! -- from mo_tgcm_ubc.F90 + !-------------------------------------------------------------------------- + implicit none + ! Arguments + ! + integer, intent(in) :: ncol + integer, intent(in) :: nlevs + real(r8), intent(in) :: plevs(nlevs) + real(r8), intent(in) :: datain(ncol,nlevs) + real(r8), intent(out) :: dataout(ncol) + + ! + ! local variables + ! + integer :: i,ku,kl,kk + real(r8) :: pinterp, delp + + pinterp = ptop_ref + + if( pinterp <= plevs(1) ) then + kl = 1 + ku = 1 + delp = 0._r8 + else if( pinterp >= plevs(nlevs) ) then + kl = nlevs + ku = nlevs + delp = 0._r8 + else + + do kk = 2,nlevs + if( pinterp <= plevs(kk) ) then + ku = kk + kl = kk - 1 + delp = log( pinterp/plevs(kk) ) / log( plevs(kk-1)/plevs(kk) ) + exit + end if + end do + + end if + + do i = 1,ncol + dataout(i) = datain(i,kl) + delp * (datain(i,ku) - datain(i,kl)) + end do + + end subroutine vert_interp_ub +!------------------------------------------------------------------------------ + +!------------------------------------------------------------------------------ +!------------------------------------------------------------------------------ + subroutine advance_file(file) + + !------------------------------------------------------------------------------ + ! This routine advances to the next file + !------------------------------------------------------------------------------ + + use shr_sys_mod, only: shr_sys_system + use ioFileMod, only: getfil + + implicit none + + type(trfile), intent(inout) :: file + + !----------------------------------------------------------------------- + ! local variables + !----------------------------------------------------------------------- + character(len=shr_kind_cl) :: ctmp + character(len=shr_kind_cl) :: loc_fname + integer :: istat, astat + + !----------------------------------------------------------------------- + ! close current file ... + !----------------------------------------------------------------------- + call pio_closefile( file%curr_fileid ) + + !----------------------------------------------------------------------- + ! remove if requested + !----------------------------------------------------------------------- + if( file%remove_trc_file ) then + call getfil( file%curr_filename, loc_fname, 0 ) + write(iulog,*) 'advance_file: removing file = ',trim(loc_fname) + ctmp = 'rm -f ' // trim(loc_fname) + write(iulog,*) 'advance_file: fsystem issuing command - ' + write(iulog,*) trim(ctmp) + call shr_sys_system( ctmp, istat ) + end if + + !----------------------------------------------------------------------- + ! Advance the filename and file id + !----------------------------------------------------------------------- + file%curr_filename = file%next_filename + file%curr_fileid = file%next_fileid + + !----------------------------------------------------------------------- + ! Advance the curr_data_times + !----------------------------------------------------------------------- + deallocate( file%curr_data_times, stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'advance_file: failed to deallocate file%curr_data_times array; error = ',astat + call endrun + end if + allocate( file%curr_data_times( size( file%next_data_times ) ), stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'advance_file: failed to allocate file%curr_data_times array; error = ',astat + call endrun + end if + file%curr_data_times(:) = file%next_data_times(:) + + !----------------------------------------------------------------------- + ! delete information about next file (as was just assigned to current) + !----------------------------------------------------------------------- + file%next_filename = '' + + deallocate( file%next_data_times, stat=astat ) + if( astat/= 0 ) then + write(iulog,*) 'advance_file: failed to deallocate file%next_data_times array; error = ',astat + call endrun + end if + nullify( file%next_data_times ) + + end subroutine advance_file + +end module tracer_data From 104dd9408cbfbc53d24037dcb187d93fba106299 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Sun, 25 Aug 2024 23:49:33 -0500 Subject: [PATCH 106/197] Add compsets and support files for v3 single forcing simulations --- cime_config/allactive/config_compsets.xml | 72 ++++++++++ ...R_eam_CMIP6-GHG_chemUCI-Linoz-mam5-vbs.xml | 121 +++++++++++++++++ ..._eam_CMIP6-LULC_chemUCI-Linoz-mam5-vbs.xml | 124 ++++++++++++++++++ ...R_eam_CMIP6-aer_chemUCI-Linoz-mam5-vbs.xml | 119 +++++++++++++++++ ...R_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml | 122 +++++++++++++++++ ...eam_CMIP6-ozone_chemUCI-Linoz-mam5-vbs.xml | 121 +++++++++++++++++ ..._eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml | 123 +++++++++++++++++ ...CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml | 120 +++++++++++++++++ .../eam/cime_config/config_component.xml | 9 ++ .../use_cases/20thC_CMIP6xLULC_transient.xml | 48 +++++++ .../elm/cime_config/config_component.xml | 9 +- .../cime_config/config_component_e3sm.xml | 6 + 12 files changed, 993 insertions(+), 1 deletion(-) create mode 100644 components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-GHG_chemUCI-Linoz-mam5-vbs.xml create mode 100644 components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-LULC_chemUCI-Linoz-mam5-vbs.xml create mode 100644 components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-aer_chemUCI-Linoz-mam5-vbs.xml create mode 100644 components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml create mode 100644 components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-ozone_chemUCI-Linoz-mam5-vbs.xml create mode 100644 components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml create mode 100644 components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml create mode 100644 components/elm/bld/namelist_files/use_cases/20thC_CMIP6xLULC_transient.xml diff --git a/cime_config/allactive/config_compsets.xml b/cime_config/allactive/config_compsets.xml index 21032c48371..63883bff15d 100755 --- a/cime_config/allactive/config_compsets.xml +++ b/cime_config/allactive/config_compsets.xml @@ -86,6 +86,78 @@ 20TRSOI_EAM%CMIP6_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + WCYCL20TR-GHG + 20TRSOI_EAM%CMIP6-GHG_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + hist-GHG + 20TRSOI_EAM%CMIP6-GHG_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + WCYCL20TR-aer + 20TRSOI_EAM%CMIP6-AER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + hist-aer + 20TRSOI_EAM%CMIP6-AER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + WCYCL20TR-xGHG-xaer + 20TRSOI_EAM%CMIP6-xGHG-xAER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + hist-all-xGHG-xaer + 20TRSOI_EAM%CMIP6-xGHG-xAER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + WCYCL20TR-nat + 20TRSOI_EAM%CMIP6-NAT_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + hist-nat + 20TRSOI_EAM%CMIP6-NAT_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + WCYCL20TR-ozone + 20TRSOI_EAM%CMIP6-OZONE_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + hist-ozone + 20TRSOI_EAM%CMIP6-OZONE_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + WCYCL20TR-lulc + 20TRSOI_EAM%CMIP6-LULC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + hist-lulc + 20TRSOI_EAM%CMIP6-LULC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + WCYCL20TR-volc + 20TRSOI_EAM%CMIP6-VOLC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + hist-volc + 20TRSOI_EAM%CMIP6-VOLC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-GHG_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-GHG_chemUCI-Linoz-mam5-vbs.xml new file mode 100644 index 00000000000..cd16d6a0d9a --- /dev/null +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-GHG_chemUCI-Linoz-mam5-vbs.xml @@ -0,0 +1,121 @@ + + + + +.true. + + +.true. +.true. +.true. + + +atm/cam/solar/Solar_1850control_input4MIPS_c20181106.nc +18500101 +FIXED + + +atm/cam/ggas/GHG_CMIP-1-2-0_Annual_Global_0000-2014_c20180105.nc +RAMPED + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc + +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_1850_2014_avg_so2_elev_strat_1850.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_elev_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_elev_1850-2014_c180205.nc + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H4_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H6_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C3H8_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH2O_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3CHO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3COCH3_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_MTERP_surface_1850-2014_1.9x2.5_c20230126.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_NO_surface_1850-2014_1.9x2.5_c20220425.nc +atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_surf_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions_E90_surface_1750-2015_1.9x2.5_c20210408.nc + + + + +CYCLICAL +1849 +oxid_1.9x2.5_L26_1850-2015_c20181106.nc +'' +atm/cam/chem/trop_mozart_aero/oxid +'prsd_O3:O3','prsd_NO3:NO3','prsd_OH:OH' + + +ch4_oxid_1.9x2.5_L26_1990-1999clim.c090804.nc +atm/cam/chem/methane +CYCLICAL +1995 +'' +'prsd_ch4:CH4' + + + + 'A:H2OLNZ:H2O', 'N:O2:O2', 'N:CO2:CO2', + 'A:O3:O3', 'A:N2OLNZ:N2O', 'A:CH4LNZ:CH4', + 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam5_mode1:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode2:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_c130628.nc', + 'M:mam5_mode3:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode4:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'M:mam5_mode5:$INPUTDATA_ROOT/atm/cam/physprops/mam5_mode5_rrtmg_sig1.2_dgnl.40_c03072023.nc' + + + +3 +1 +'atm/cam/chem/trop_mam/marine_BGC/' +'CYCLICAL' +'monthly_macromolecules_0.1deg_bilinear_latlon_year01_merge_date.nc' +0 +0 +'chla:CHL1','mpoly:TRUEPOLYC','mprot:TRUEPROTC','mlip:TRUELIPC' + + +atm/cam/chem/trop_mozart/ub/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc +18500101 +FIXED +1850 +linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc +atm/cam/chem/trop_mozart/ub +CYCLICAL + + +SERIAL + + +'xactive_lnd' +'O3','H2O2','CH2O','CH3OOH','NO','NO2','HNO3','HO2NO2','PAN','CO','CH3COCH3','C2H5OOH','CH3CHO','H2SO4','SO2','NO3','N2O5','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'NEU' +'C2H5OOH','CH2O','CH3CHO','CH3OOH','H2O2','H2SO4','HNO3','HO2NO2','SO2','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'CH2O', 'CH3O2', 'CH3OOH', 'PAN', 'CO', 'C2H6', 'C3H8', 'C2H4', 'ROHO2', 'CH3COCH3', 'C2H5O2', 'C2H5OOH', 'CH3CHO', 'CH3CO3', 'ISOP', 'ISOPO2', 'MVKMACR', 'MVKO2' +'' + diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-LULC_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-LULC_chemUCI-Linoz-mam5-vbs.xml new file mode 100644 index 00000000000..e2f53df4dc6 --- /dev/null +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-LULC_chemUCI-Linoz-mam5-vbs.xml @@ -0,0 +1,124 @@ + + + + +.true. + + +.true. +.true. +.true. + + +atm/cam/solar/Solar_1850control_input4MIPS_c20181106.nc +18500101 +FIXED + + + +808.249e-9 +273.0211e-9 +32.1102e-12 +0.0 + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc + +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_1850_2014_avg_so2_elev_strat_1850.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_elev_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_elev_1850-2014_c180205.nc + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H4_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H6_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C3H8_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH2O_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3CHO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3COCH3_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_MTERP_surface_1850-2014_1.9x2.5_c20230126.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_NO_surface_1850-2014_1.9x2.5_c20220425.nc +atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_surf_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions_E90_surface_1750-2015_1.9x2.5_c20210408.nc + + + + +CYCLICAL +1849 +oxid_1.9x2.5_L26_1850-2015_c20181106.nc +'' +atm/cam/chem/trop_mozart_aero/oxid +'prsd_O3:O3','prsd_NO3:NO3','prsd_OH:OH' + + +ch4_oxid_1.9x2.5_L26_1990-1999clim.c090804.nc +atm/cam/chem/methane +CYCLICAL +1995 +'' +'prsd_ch4:CH4' + + + + 'A:H2OLNZ:H2O', 'N:O2:O2', 'N:CO2:CO2', + 'A:O3:O3', 'A:N2OLNZ:N2O', 'A:CH4LNZ:CH4', + 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam5_mode1:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode2:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_c130628.nc', + 'M:mam5_mode3:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode4:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'M:mam5_mode5:$INPUTDATA_ROOT/atm/cam/physprops/mam5_mode5_rrtmg_sig1.2_dgnl.40_c03072023.nc' + + + +3 +1 +'atm/cam/chem/trop_mam/marine_BGC/' +'CYCLICAL' +'monthly_macromolecules_0.1deg_bilinear_latlon_year01_merge_date.nc' +0 +0 +'chla:CHL1','mpoly:TRUEPOLYC','mprot:TRUEPROTC','mlip:TRUELIPC' + + +atm/cam/chem/trop_mozart/ub/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc +18500101 +FIXED +1850 +linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc +atm/cam/chem/trop_mozart/ub +CYCLICAL + + +SERIAL + + +'xactive_lnd' +'O3','H2O2','CH2O','CH3OOH','NO','NO2','HNO3','HO2NO2','PAN','CO','CH3COCH3','C2H5OOH','CH3CHO','H2SO4','SO2','NO3','N2O5','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'NEU' +'C2H5OOH','CH2O','CH3CHO','CH3OOH','H2O2','H2SO4','HNO3','HO2NO2','SO2','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'CH2O', 'CH3O2', 'CH3OOH', 'PAN', 'CO', 'C2H6', 'C3H8', 'C2H4', 'ROHO2', 'CH3COCH3', 'C2H5O2', 'C2H5OOH', 'CH3CHO', 'CH3CO3', 'ISOP', 'ISOPO2', 'MVKMACR', 'MVKO2' +'' + diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-aer_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-aer_chemUCI-Linoz-mam5-vbs.xml new file mode 100644 index 00000000000..8aedc762728 --- /dev/null +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-aer_chemUCI-Linoz-mam5-vbs.xml @@ -0,0 +1,119 @@ + + + + +.true. + + +.true. +.true. +.true. + + +atm/cam/solar/Solar_1850control_input4MIPS_c20181106.nc +18500101 +FIXED + + + +808.249e-9 +273.0211e-9 +32.1102e-12 +0.0 + + +INTERP_MISSING_MONTHS +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_elev_1850-2014_c180205_hist-aero_1850-volcano.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_elev_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_elev_1850-2014_c180205.nc + + +INTERP_MISSING_MONTHS +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H4_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H6_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C3H8_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH2O_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3CHO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3COCH3_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_MTERP_surface_1850-2014_1.9x2.5_c20230126.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_NO_surface_1850-2014_1.9x2.5_c20220425.nc +atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850-2100.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160727.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_surf_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions_E90_surface_1750-2015_1.9x2.5_c20210408.nc + + + + +INTERP_MISSING_MONTHS +oxid_1.9x2.5_L26_1850-2015_c20181106.nc +'' +atm/cam/chem/trop_mozart_aero/oxid +'prsd_O3:O3','prsd_NO3:NO3','prsd_OH:OH' + + +ch4_oxid_1.9x2.5_L26_1990-1999clim.c090804.nc +atm/cam/chem/methane +CYCLICAL +1995 +'' +'prsd_ch4:CH4' + + + + 'A:H2OLNZ:H2O', 'N:O2:O2', 'N:CO2:CO2', + 'A:O3:O3', 'A:N2OLNZ:N2O', 'A:CH4LNZ:CH4', + 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam5_mode1:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode2:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_c130628.nc', + 'M:mam5_mode3:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode4:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'M:mam5_mode5:$INPUTDATA_ROOT/atm/cam/physprops/mam5_mode5_rrtmg_sig1.2_dgnl.40_c03072023.nc' + + + +3 +1 +'atm/cam/chem/trop_mam/marine_BGC/' +'CYCLICAL' +'monthly_macromolecules_0.1deg_bilinear_latlon_year01_merge_date.nc' +0 +0 +'chla:CHL1','mpoly:TRUEPOLYC','mprot:TRUEPROTC','mlip:TRUELIPC' + +atm/cam/chem/trop_mozart/ub/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc +18500101 +FIXED +1850 +linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc +atm/cam/chem/trop_mozart/ub +CYCLICAL + + +SERIAL + + +'xactive_lnd' +'O3','H2O2','CH2O','CH3OOH','NO','NO2','HNO3','HO2NO2','PAN','CO','CH3COCH3','C2H5OOH','CH3CHO','H2SO4','SO2','NO3','N2O5','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'NEU' +'C2H5OOH','CH2O','CH3CHO','CH3OOH','H2O2','H2SO4','HNO3','HO2NO2','SO2','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'CH2O', 'CH3O2', 'CH3OOH', 'PAN', 'CO', 'C2H6', 'C3H8', 'C2H4', 'ROHO2', 'CH3COCH3', 'C2H5O2', 'C2H5OOH', 'CH3CHO', 'CH3CO3', 'ISOP', 'ISOPO2', 'MVKMACR', 'MVKO2' +'' + diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml new file mode 100644 index 00000000000..8f3a2644527 --- /dev/null +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml @@ -0,0 +1,122 @@ + + + + +.true. + + +.true. +.true. +.true. + + +atm/cam/solar/Solar_1850-2299_input4MIPS_c20181106.nc +SERIAL + + + +808.249e-9 +273.0211e-9 +32.1102e-12 +0.0 + + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_elev_1850-2014_c180205_1850-aero_hist-volcano.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_elev_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_elev_1850-2014_c180205.nc + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H4_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H6_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C3H8_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH2O_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3CHO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3COCH3_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_MTERP_surface_1850-2014_1.9x2.5_c20230126.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_NO_surface_1850-2014_1.9x2.5_c20220425.nc +atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_surf_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions_E90_surface_1750-2015_1.9x2.5_c20210408.nc + + + + +CYCLICAL +1849 +oxid_1.9x2.5_L26_1850-2015_c20181106.nc +'' +atm/cam/chem/trop_mozart_aero/oxid +'prsd_O3:O3','prsd_NO3:NO3','prsd_OH:OH' + + +ch4_oxid_1.9x2.5_L26_1990-1999clim.c090804.nc +atm/cam/chem/methane +CYCLICAL +1995 +'' +'prsd_ch4:CH4' + + + + 'A:H2OLNZ:H2O', 'N:O2:O2', 'N:CO2:CO2', + 'A:O3:O3', 'A:N2OLNZ:N2O', 'A:CH4LNZ:CH4', + 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam5_mode1:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode2:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_c130628.nc', + 'M:mam5_mode3:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode4:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'M:mam5_mode5:$INPUTDATA_ROOT/atm/cam/physprops/mam5_mode5_rrtmg_sig1.2_dgnl.40_c03072023.nc' + + + +3 +1 +'atm/cam/chem/trop_mam/marine_BGC/' +'CYCLICAL' +'monthly_macromolecules_0.1deg_bilinear_latlon_year01_merge_date.nc' +0 +0 +'chla:CHL1','mpoly:TRUEPOLYC','mprot:TRUEPROTC','mlip:TRUELIPC' + +atm/cam/chem/trop_mozart/ub/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc +18500101 +FIXED +1850 +linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc +atm/cam/chem/trop_mozart/ub +INTERP_MISSING_MONTHS + + +SERIAL + + +'xactive_lnd' +'O3','H2O2','CH2O','CH3OOH','NO','NO2','HNO3','HO2NO2','PAN','CO','CH3COCH3','C2H5OOH','CH3CHO','H2SO4','SO2','NO3','N2O5','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'NEU' +'C2H5OOH','CH2O','CH3CHO','CH3OOH','H2O2','H2SO4','HNO3','HO2NO2','SO2','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'CH2O', 'CH3O2', 'CH3OOH', 'PAN', 'CO', 'C2H6', 'C3H8', 'C2H4', 'ROHO2', 'CH3COCH3', 'C2H5O2', 'C2H5OOH', 'CH3CHO', 'CH3CO3', 'ISOP', 'ISOPO2', 'MVKMACR', 'MVKO2' +'' + diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-ozone_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-ozone_chemUCI-Linoz-mam5-vbs.xml new file mode 100644 index 00000000000..58f69d8fe97 --- /dev/null +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-ozone_chemUCI-Linoz-mam5-vbs.xml @@ -0,0 +1,121 @@ + + + + +.true. + + +.true. +.true. +.true. + + +atm/cam/solar/Solar_1850control_input4MIPS_c20181106.nc +18500101 +FIXED + + + +808.249e-9 +273.0211e-9 +32.1102e-12 +0.0 + + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_1850_2014_avg_so2_elev_strat_1850.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_elev_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_elev_1850-2014_c180205.nc + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H4_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H6_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C3H8_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH2O_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3CHO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3COCH3_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_MTERP_surface_1850-2014_1.9x2.5_c20230126.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_NO_surface_1850-2014_1.9x2.5_c20220425.nc +atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_surf_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions_E90_surface_1750-2015_1.9x2.5_c20210408.nc + + + + +CYCLICAL +1849 +oxid_1.9x2.5_L26_1850-2015_c20181106.nc +'' +atm/cam/chem/trop_mozart_aero/oxid +'prsd_O3:O3','prsd_NO3:NO3','prsd_OH:OH' + + +ch4_oxid_1.9x2.5_L26_1990-1999clim.c090804.nc +atm/cam/chem/methane +CYCLICAL +1995 +'' +'prsd_ch4:CH4' + + + + 'A:H2OLNZ:H2O', 'N:O2:O2', 'N:CO2:CO2', + 'A:O3:O3', 'A:N2OLNZ:N2O', 'A:CH4LNZ:CH4', + 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam5_mode1:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode2:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_c130628.nc', + 'M:mam5_mode3:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode4:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'M:mam5_mode5:$INPUTDATA_ROOT/atm/cam/physprops/mam5_mode5_rrtmg_sig1.2_dgnl.40_c03072023.nc' + + + +3 +1 +'atm/cam/chem/trop_mam/marine_BGC/' +'CYCLICAL' +'monthly_macromolecules_0.1deg_bilinear_latlon_year01_merge_date.nc' +0 +0 +'chla:CHL1','mpoly:TRUEPOLYC','mprot:TRUEPROTC','mlip:TRUELIPC' + +atm/cam/chem/trop_mozart/ub/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc +SERIAL +linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc +atm/cam/chem/trop_mozart/ub +INTERP_MISSING_MONTHS + + +SERIAL + + +'xactive_lnd' +'O3','H2O2','CH2O','CH3OOH','NO','NO2','HNO3','HO2NO2','PAN','CO','CH3COCH3','C2H5OOH','CH3CHO','H2SO4','SO2','NO3','N2O5','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'NEU' +'C2H5OOH','CH2O','CH3CHO','CH3OOH','H2O2','H2SO4','HNO3','HO2NO2','SO2','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'CH2O', 'CH3O2', 'CH3OOH', 'PAN', 'CO', 'C2H6', 'C3H8', 'C2H4', 'ROHO2', 'CH3COCH3', 'C2H5O2', 'C2H5OOH', 'CH3CHO', 'CH3CO3', 'ISOP', 'ISOPO2', 'MVKMACR', 'MVKO2' +'' + diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml new file mode 100644 index 00000000000..6f075442359 --- /dev/null +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml @@ -0,0 +1,123 @@ + + + + +.true. + + +.true. +.true. +.true. + + +atm/cam/solar/Solar_1850control_input4MIPS_c20181106.nc +18500101 +FIXED + + + +808.249e-9 +273.0211e-9 +32.1102e-12 +0.0 + + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_elev_1850-2014_c180205_1850-aero_hist-volcano.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_elev_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_elev_1850-2014_c180205.nc + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H4_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H6_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C3H8_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH2O_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3CHO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3COCH3_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_MTERP_surface_1850-2014_1.9x2.5_c20230126.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_NO_surface_1850-2014_1.9x2.5_c20220425.nc +atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_surf_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions_E90_surface_1750-2015_1.9x2.5_c20210408.nc + + + + +CYCLICAL +1849 +oxid_1.9x2.5_L26_1850-2015_c20181106.nc +'' +atm/cam/chem/trop_mozart_aero/oxid +'prsd_O3:O3','prsd_NO3:NO3','prsd_OH:OH' + + +ch4_oxid_1.9x2.5_L26_1990-1999clim.c090804.nc +atm/cam/chem/methane +CYCLICAL +1995 +'' +'prsd_ch4:CH4' + + + + 'A:H2OLNZ:H2O', 'N:O2:O2', 'N:CO2:CO2', + 'A:O3:O3', 'A:N2OLNZ:N2O', 'A:CH4LNZ:CH4', + 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam5_mode1:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode2:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_c130628.nc', + 'M:mam5_mode3:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode4:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'M:mam5_mode5:$INPUTDATA_ROOT/atm/cam/physprops/mam5_mode5_rrtmg_sig1.2_dgnl.40_c03072023.nc' + + + +3 +1 +'atm/cam/chem/trop_mam/marine_BGC/' +'CYCLICAL' +'monthly_macromolecules_0.1deg_bilinear_latlon_year01_merge_date.nc' +0 +0 +'chla:CHL1','mpoly:TRUEPOLYC','mprot:TRUEPROTC','mlip:TRUELIPC' + +atm/cam/chem/trop_mozart/ub/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc +18500101 +FIXED +1850 +linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc +atm/cam/chem/trop_mozart/ub +CYCLICAL + + +SERIAL + + +'xactive_lnd' +'O3','H2O2','CH2O','CH3OOH','NO','NO2','HNO3','HO2NO2','PAN','CO','CH3COCH3','C2H5OOH','CH3CHO','H2SO4','SO2','NO3','N2O5','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'NEU' +'C2H5OOH','CH2O','CH3CHO','CH3OOH','H2O2','H2SO4','HNO3','HO2NO2','SO2','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'CH2O', 'CH3O2', 'CH3OOH', 'PAN', 'CO', 'C2H6', 'C3H8', 'C2H4', 'ROHO2', 'CH3COCH3', 'C2H5O2', 'C2H5OOH', 'CH3CHO', 'CH3CO3', 'ISOP', 'ISOPO2', 'MVKMACR', 'MVKO2' +'' + diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml new file mode 100644 index 00000000000..f70010a82c4 --- /dev/null +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml @@ -0,0 +1,120 @@ + + + + +.true. + + +.true. +.true. +.true. + + +atm/cam/solar/Solar_1850-2299_input4MIPS_c20181106.nc +SERIAL + + + +808.249e-9 +273.0211e-9 +32.1102e-12 +0.0 + + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_elev_1850-2014_c180205_1850-aero_hist-volcano.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_elev_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_elev_1850-2014_c180205.nc + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H4_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H6_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C3H8_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH2O_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3CHO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3COCH3_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_MTERP_surface_1850-2014_1.9x2.5_c20230126.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_NO_surface_1850-2014_1.9x2.5_c20220425.nc +atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_surf_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions_E90_surface_1750-2015_1.9x2.5_c20210408.nc + + + + +CYCLICAL +1849 +oxid_1.9x2.5_L26_1850-2015_c20181106.nc +'' +atm/cam/chem/trop_mozart_aero/oxid +'prsd_O3:O3','prsd_NO3:NO3','prsd_OH:OH' + + +ch4_oxid_1.9x2.5_L26_1990-1999clim.c090804.nc +atm/cam/chem/methane +CYCLICAL +1995 +'' +'prsd_ch4:CH4' + + + + 'A:H2OLNZ:H2O', 'N:O2:O2', 'N:CO2:CO2', + 'A:O3:O3', 'A:N2OLNZ:N2O', 'A:CH4LNZ:CH4', + 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam5_mode1:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode2:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_c130628.nc', + 'M:mam5_mode3:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode4:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'M:mam5_mode5:$INPUTDATA_ROOT/atm/cam/physprops/mam5_mode5_rrtmg_sig1.2_dgnl.40_c03072023.nc' + + + +3 +1 +'atm/cam/chem/trop_mam/marine_BGC/' +'CYCLICAL' +'monthly_macromolecules_0.1deg_bilinear_latlon_year01_merge_date.nc' +0 +0 +'chla:CHL1','mpoly:TRUEPOLYC','mprot:TRUEPROTC','mlip:TRUELIPC' + +atm/cam/chem/trop_mozart/ub/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc +SERIAL +linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc +atm/cam/chem/trop_mozart/ub +INTERP_MISSING_MONTHS + + +SERIAL + + +'xactive_lnd' +'O3','H2O2','CH2O','CH3OOH','NO','NO2','HNO3','HO2NO2','PAN','CO','CH3COCH3','C2H5OOH','CH3CHO','H2SO4','SO2','NO3','N2O5','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'NEU' +'C2H5OOH','CH2O','CH3CHO','CH3OOH','H2O2','H2SO4','HNO3','HO2NO2','SO2','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'CH2O', 'CH3O2', 'CH3OOH', 'PAN', 'CO', 'C2H6', 'C3H8', 'C2H4', 'ROHO2', 'CH3COCH3', 'C2H5O2', 'C2H5OOH', 'CH3CHO', 'CH3CO3', 'ISOP', 'ISOPO2', 'MVKMACR', 'MVKO2' +'' + diff --git a/components/eam/cime_config/config_component.xml b/components/eam/cime_config/config_component.xml index 1a961b84aff..8f1e68161cb 100755 --- a/components/eam/cime_config/config_component.xml +++ b/components/eam/cime_config/config_component.xml @@ -53,6 +53,7 @@ -phys default &eamv3_phys_defaults; &eamv3_chem_defaults; &eamv3_phys_defaults; &eamv3_chem_defaults; + &eamv3_phys_defaults; &eamv3_chem_defaults; &eamv3_phys_defaults; &eamv3_chem_defaults; -bc_dep_to_snow_updates -co2_cycle @@ -125,6 +126,14 @@ 1850_E3SMv1_superfast_ar5-emis 1850S_E3SMv1_superfast_ar5-emis 20TR_eam_CMIP6_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6-GHG_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6-aer_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6-ozone_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6-lulc_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs 20TR_eam_CMIP6_chemUCI-Linoz-mam5-vbs SSP585_eam_CMIP6_chemUCI-Linoz-mam5-vbs SSP370_eam_CMIP6_chemUCI-Linoz-mam5-vbs diff --git a/components/elm/bld/namelist_files/use_cases/20thC_CMIP6xLULC_transient.xml b/components/elm/bld/namelist_files/use_cases/20thC_CMIP6xLULC_transient.xml new file mode 100644 index 00000000000..7a6247bbe27 --- /dev/null +++ b/components/elm/bld/namelist_files/use_cases/20thC_CMIP6xLULC_transient.xml @@ -0,0 +1,48 @@ + + + + +Historical single forcing simulation with land held at 1850 condition +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to 2005 +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to 2005 +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to 2005 + +1850 + +1850-2000 + +arb_ic + + +1850 +1850 +1850 + + +2000 +2000 +2000 + +1850 +1850 +1850 + + + + +lnd/clm2/surfdata_map/surfdata_ne30np4_simyr1850_2015_c171018.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_simyr1850_2015_c20171018.nc +lnd/clm2/initdata_map/20180316.DECKv1b_A1.ne30_oEC.edison.clm2.r.1980-01-01-00000.8575c3f_c20190904.nc + +lnd/clm2/surfdata_map/surfdata_0.125x0.125_simyr1850_c190730.nc + +lnd/clm2/surfdata_map/surfdata_0.5x0.5_simyr1850_c200609_with_TOP.nc + + +lnd/clm2/surfdata_map/surfdata_ne1024pg2_simyr2010_c211021.nc + +.false. +.false. + + + diff --git a/components/elm/cime_config/config_component.xml b/components/elm/cime_config/config_component.xml index da060584cfb..b191a0a2248 100755 --- a/components/elm/cime_config/config_component.xml +++ b/components/elm/cime_config/config_component.xml @@ -72,7 +72,14 @@ 1850_CMIP6bgc_control 1850_SCMIP6_control 1850_SCMIP6_control - 20thC_CMIP6_transient + 20thC_CMIP6_transient + 20thC_CMIP6xLULC_transient + 20thC_CMIP6xLULC_transient + 20thC_CMIP6xLULC_transient + 20thC_CMIP6xLULC_transient + 20thC_CMIP6xLULC_transient + 20thC_CMIP6_transient + 20thC_CMIP6_transient 20thC_CMIP6bgc_transient 20thC_CMIP6bgc_transient 20thC_bgc_transient diff --git a/driver-mct/cime_config/config_component_e3sm.xml b/driver-mct/cime_config/config_component_e3sm.xml index 08758f93531..acdca60ae2a 100755 --- a/driver-mct/cime_config/config_component_e3sm.xml +++ b/driver-mct/cime_config/config_component_e3sm.xml @@ -753,6 +753,12 @@ 312.821 388.717 388.717 + 284.317 + 284.317 + 284.317 + 284.317 + 284.317 + 284.317 0.000001 0.000001 284.317 From 82fd0061a9b32bdf209b4a173ecb47d3f7d09587 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:00:22 +0000 Subject: [PATCH 107/197] Bump tj-actions/changed-files from 44 to 45 Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 44 to 45. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v44...v45) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/e3sm-gh-md-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e3sm-gh-md-linter.yml b/.github/workflows/e3sm-gh-md-linter.yml index 8ee8b7a7f13..507c2c3745e 100644 --- a/.github/workflows/e3sm-gh-md-linter.yml +++ b/.github/workflows/e3sm-gh-md-linter.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: tj-actions/changed-files@v44 + - uses: tj-actions/changed-files@v45 id: changed-files with: files: '**/*.md' From 624d9ac5757e18db32477702dba04f442e24d247 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 26 Aug 2024 06:07:59 -0500 Subject: [PATCH 108/197] Revert changes to .gitignore --- .gitignore | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.gitignore b/.gitignore index d2fcc80bbb7..d7a1fabfd6b 100644 --- a/.gitignore +++ b/.gitignore @@ -51,16 +51,3 @@ components/eamxx/docs/common/eamxx_params.md components/eamxx/src/python/build components/eamxx/src/python/build_src components/eamxx/src/python/dist - -# OS generated files # -###################### -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -ehthumbs.db -Thumbs.db - -# idea folder -.idea/ From a7ec7e67c6793b500dc83106995bf6038ae90e96 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 26 Aug 2024 12:28:59 -0600 Subject: [PATCH 109/197] Update CIME submodule ... to af3eab5b8a213e79923551e7f9d9f56edb944c0f Changes: 1) Generalize _hists_match for mom6 files 2) support append in config_pes.xml overrides field 3) Add case git: Adds a case interface to git. It creates a local git repository when case.setup is run and updates that repository with each action that triggers an update of the CaseStatus file. Optionally a remote repository can be attached by setting CASE_GIT_REPOSITORY to the name of the remote repository. 4) xmlchange: Add documentation for setting values with commas 5) Remove mct for cesm 6) remove load_balancing_tool, broken and unsupported Fixes 1) Fix/rest n in tests: move the computation of REST_N into the python 2) cprnc: need to make sure the directory exists before linking to it 3) check_lockedfiles call in xmlchange needs quiet=True 4) fixes detection of pfunit_path by making sure it exists 5) Fixes handling cprnc output 6) Fixes creating new environment with specific python version 7) Fixes `query_config` tool. - Adds longname to `--grids` - Fixes duplicate and empty choices 8) Fixes check_lockedfiles call in xmlchange 9) Fix list_e3sm_tests tool [BFB] --- cime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime b/cime index f903115718e..af3eab5b8a2 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit f903115718ebc30669ce557f511abaef231a1d88 +Subproject commit af3eab5b8a213e79923551e7f9d9f56edb944c0f From aa08e0c2b115604f79f6b87ae321689504caaa33 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 26 Aug 2024 13:10:55 -0600 Subject: [PATCH 110/197] Disable git interface --- cime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime b/cime index af3eab5b8a2..eacb1b7f5ed 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit af3eab5b8a213e79923551e7f9d9f56edb944c0f +Subproject commit eacb1b7f5ed984f0c124076c78fd1e80dbd9b7a1 From dabae5c6e1d2c36dc32a75bbbae33f709a55d0f1 Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Mon, 13 Nov 2023 11:59:09 -0500 Subject: [PATCH 111/197] 3 initial tests added into 'e3sm_lnd_developer' for user-defined PFT codes, but NOT YET fully work. Two tests are actually similary as 'elm_usrdat' test, but with 42_FLUXNETSITES, so those 2 shall produce same outputs. The 3rd one, usrpft_arctic_I1850CNPRDCTCBC, is for testing an actual Arctic Site (See Sulman et al. 2021), however which would not produce same results as the paper because ELM developments in arctic PFT physiology not yet included. NOTE: there are a few needed inputs are included in each tests, which if not in $DIN_LOC_ROOT user can copy them into to allow it work. --- cime_config/tests.py | 3 ++- .../clm_params_c180524-sub12_updated20240201.nc | Bin 0 -> 82964 bytes .../shell_commands | 11 +++++++++++ .../usrpft_arctic_I1850CNPRDCTCBC/user_nl_elm | 7 +++++++ .../clm_params_c211124vpft.nc | Bin 0 -> 93128 bytes .../shell_commands | 10 ++++++++++ .../usrpft_codetest_I1850CNPRDCTCBC/user_nl_elm | 10 ++++++++++ .../shell_commands | 11 +++++++++++ .../usrpft_default_I1850CNPRDCTCBC/user_nl_elm | 2 ++ 9 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_arctic_I1850CNPRDCTCBC/clm_params_c180524-sub12_updated20240201.nc create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_arctic_I1850CNPRDCTCBC/shell_commands create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_arctic_I1850CNPRDCTCBC/user_nl_elm create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_codetest_I1850CNPRDCTCBC/clm_params_c211124vpft.nc create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_codetest_I1850CNPRDCTCBC/shell_commands create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_codetest_I1850CNPRDCTCBC/user_nl_elm create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_default_I1850CNPRDCTCBC/shell_commands create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_default_I1850CNPRDCTCBC/user_nl_elm diff --git a/cime_config/tests.py b/cime_config/tests.py index 556f80ec970..d6512d88ede 100644 --- a/cime_config/tests.py +++ b/cime_config/tests.py @@ -76,7 +76,6 @@ ) }, - "e3sm_land_developer" : { "share" : True, "time" : "0:45:00", @@ -95,6 +94,8 @@ "SMS.r05_r05.IELM.elm-topounit", "ERS.ELM_USRDAT.I1850ELM.elm-usrdat", "ERS.r05_r05.IELM.elm-lnd_rof_2way", + "ERS.ELM_USRDAT.I1850CNPRDCTCBC.elm-usrpft_default_I1850CNPRDCTCBC", + "ERS.ELM_USRDAT.I1850CNPRDCTCBC.elm-usrpft_codetest_I1850CNPRDCTCBC", "ERS.r05_r05.IELM.elm-V2_ELM_MOSART_features", "ERS.ELM_USRDAT.IELM.elm-surface_water_dynamics" ) diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_arctic_I1850CNPRDCTCBC/clm_params_c180524-sub12_updated20240201.nc b/components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_arctic_I1850CNPRDCTCBC/clm_params_c180524-sub12_updated20240201.nc new file mode 100644 index 0000000000000000000000000000000000000000..2ec124ef77968589cf6c89b76f65993234444ed6 GIT binary patch literal 82964 zcmeHw3!EH9o&Ro&%GlK8Gk9dj#r)NavQ1lD}ii+_6{_4@w)7vxMvpuun zK4*WDt?r(#s&7^O>Q}$|)vtavuyJ#3jkuZ+)ZzckR3uAp=HmanOg0@&jQV4GVl+EO zZ)<9r@xLLa?;lMk!t{J9{?E=Nqp@TM2jbC0G8%5tqM1+xh_eBdRLdr{psoQ>AQ;oN z1Hi2%^aI-9Wt%p&_NUQoA#LmSRcNfRo@t`$98B)lI@f8)Oy$?v)2pTR)^Jh_hzOan zbS_AZoN3yX(?yJKiqYNKyLt^(K4K(7dox;VYa;0n1VdWu4&2B0`qO&IAC4z9P^3)F z-_e!`neQj3+0|vF8Ax?$tr?2`3jBZN`VMnU%0)oriB3+aBcG5JT$s{q=|H8%{iy&d zGvg0+_H?Z7T4jYtm9$Y05zTdV^>(c7?Osdp)>4rPUO@_LJ9;{LCb)O$s%$Sk-@N@(mGco*WS)`y{maaj4Y9OI+F|fv&ocy zG?okoV)4K@=s1}6$J0o@v!l%}eZn<4S969M`qi4=jy1iVyjjf|BJJ_?dj6MkXj`qf z_E0IaAwRg4p2@5??pAad#i#PB-;D~8FOW?4nhw+iQUU8orq}bo^qN}M7ODMPqrxQq z)xF)5D$Inxn&>@aU)8&6bpd^$cFMv&<(lj0=w02@+qJGRcXVWsaxR{tuFR>~Ov!B> zE4vDbt&qqp#6?+vxNNha-eOBGD=;LO+TBeCtL(~9Mh0erBFw9MSM`*YWFcP8nfi01 zn%1LX(CWg_Wl1ihMbgP+)*nkIM%TymK!o3!QUP~b)3LU*lk?is8RzVcdInrI#f7nCL`!k;EDNa&5pW@m+T+NZM96t@Jq5hkklnfOod?b^OA6bocBdPYOL@6U_qVMvteXfOxK z8wAV+MvWv!qykL5eUWia)KjTE>+$_aP0fjMgr|pfh`ygsWe zjXn6Lr@L|CduyGZ8rDbCx}Nb5=&?*R$NRS(&gSjWL^Pg@V`>w_+$O8VlZotDY(gV; zX7totnyAucS^h})XYCEW)av+;w^2PENG8LgD-^VU1AcR&+hRQKtic_Fex9x-{_>fh zn7~{4711H_Cw}=(h>(eZ{@S(C62;3!>al1!vGOOUJgl@bHK_qY`y`zN%AmK9g$pq}A9gUts$+Z@cr7d0B zrB@+(eC~c=t4~Ct<8n->6fG_VjkHp_T%Csjbx_^6@|?WX+o^+^N=$XX>8`gwEuuCx zG-G(cWv)BoC&hT*8NonWZ|97u9im5yG;Cb(MjR(T;-%gUp2+h9b8x{Er$T#F_K}*J zKaC@-<0?bk;Bs3(%OPFo(t((tWVKW}IhsgjpiT5sUHKzYBka%5J*rt}OBK({ubb>#4Hc284~6uOzc$oVU4Zv!l28o_xc(_wPhp zYuV~MXzok3WZzb8SPKZ|&?O+z(_|?Ii9Ug;yA}zApxe|iqG%k8n5FY{ocf3=%X9d; z0sJAF2&E{ZtFoBpT-LJCd}(xuL$DnKn|NN@K<|*oKXQrlFIVI1#z@>B&Y(qc?+T}f zI$yatiiL`_9;1aO2v_MW=G55MI6AH9U`{@EARs0Kb~3aZ-Zx9}PIvw5`9)MmK_YJ4 z;BwX0;#2wqUt1_18ceMi|9lJJNxdHiTyQD@5oUkRY7$5~3FK8eX z+8hh>5yNd69!8c85h{9!Q?u7HaNaRkyc~1S!-+BJxXuU;E#;7+(GPtg2dZ$l_~vHSYuB@lnCxSi^A z_GQHPsX|43C!BK3`0EjT-UOitiwcVUx$C1P=$B(HLBnfI-O$i#VVx8U(4k}?4f-ZL z+JHu*KfNVnnn=)Pxn7u$ay4QxDl-;H@5jBFE~X-jIq{tpsbm`el!_f0N5fbIr`#c* zpj+}ac0OS8269^t8p!K1@l+DhauSGtod+i{xT4 zG(r+~1?Ui=STZ9NWPs$h9LMl&BXqPeITW~R4^d?P*V-SP+M^q5@i8nks4;-pJ(kx| z0T?<68aH7=OHHCWZ!E*H4H6t}OFCGG3l6zya*So^*K?ZAaA@|0j`*kIRxow9N zR1OT^WL88YhpTenJ9U*ySB#HaCI%Kt>S&ly6ureX5~q>}(20r=nY*&p)(in;V>lCo z?kW()y{odB=*wER`uMB5+D8Q+wWGcEU1RBFZgflw1ro{B1SE@e@;W_4+zU#NfCdpK zn(5WT!`u4X!`u3|QXRT2%MpCb`B;)-c`r)^_!wEaLGloIT$ZDDK0dF@rgCFp5zlLz zsQ7m6p?-6VEd@w(xPd?@;ZFv+{HN0JvhH>ot=P&jc~FCyTvRk-ArHb_u`Jo6w)PnC zsx_c>xOauM0(yn!?UJ)rYz?S(MhEb7x(MI~m#ear=&LGz1?XbNA>gT}!7s{1QFqvQ zDa0QuA8{Ic+qpg}8i#IlvOX%$6Nj+8k;GCApOCtw@fjxosS(V6zl|I*6TdmFY1!51 zC6u1D`jk^fZZ<&6#a-N#A=e%V@g+gG{BGtD;gsu}L>sC-OZLMO>zgy;T}Z`Vr*zgX z((Ng60mA$N%xJ-|>3f&;I`as=ZIZ@Cn3+*jcbH4iu+uzXm1!8Y%mYju$Cw4s zT$X9pe3YRfJ(i3mqI~7vRU4EjPovToAYD5;I-AP|X&uw(5KNpyI?ZVU>DH~JD8%I! zcM9LuM<$|rObjxfaXZ)twWxBDR#oWqvSSeYqZtkQksPF}iTp&SjB*^qw=?z$`wp*V zQ1R{RUH#^=e(O4b%OtyRS%qhnM#=tZq76G7N_O9}%IJ($klkzR4gqgH#6sBh;;ww` zR(|dz7y5>kL6Z=ENfvB|5V%|ekpKjdO(~I)FuHA<6Zp1~t0Thk@d}i!R!nzo`|G)i zWg7N2dJ2Z{R2r-jaq-D5?)o8MZHQ#jwC;slcl1ob*?iJx!w?GX5GHZV zy{$@Z{SjcBtz)#K^&lY*6ksL2kkc4yr5~$3g&pRLHo)#K4V^n|IQSxmfr0B=!C!*h zPRp%cy4dCs?ORw z2^(vMv*}zYyE_#wtF0SSzyq3u@@$%Py2D&g=TWCy+i;9<$0AsxnVxm51zfT~cBJ^q zFK4->m&Oj@ot5$LCly^K#*qs$G0aVg5A6?uMZK2bg%a3o1D21~ip*G)S{8YlY#X&) zJQ>plc632xZO2X+l!TXR5Gqwz#wLghUZq-DoXFWhX* z$tB?;<5&)=S*SeavKHZRiGTJGzQuY4tbW7-jJe&5;-?JcW#xHJbHrw`UP0NJ)Mk0E zXPz9oEyEFDk$i)XY_7^+lIg5va9VRYm5W2N`sK=tORP=vfwevu3?@@tT<}aUs;qXj zqJDFWEk)P@TqxqLtKyfGjro`2kF_41XrXr}E%%rvgXV$Im>3q*rn;u_relCt$G5Hs zoUY1Mf<9FI3e@?W4nUd}3FT;_s?sf4-z9K4%~P*4RkcyQy$0K$fd_LwwNTEdf}=?t zd-#&r;gwEfFu{Znw&_@^n1F7Wv^?3d7K~4EEJ0$IF?~oI^{{J}SF}sIn{xCxtlbdWrI)xkmu7F@*(|aA!vc z?#(nZl{uJGpI^NZlSP^e(4vl9sOCL7qbIo43t(sy&{om!VaztL0-WTM4EiJt)#5^g zIZ{*(vdaqiL)W=2M+u&<=%)f>(Y#~8Qy(DKS4N*Jfz4_Bzm&^Sra{U5 z_|N4$mvw#$^|K}_R(^S`px+gxA5+=v>USQc3F|V`(pbUV%q&N`#d?U^AQD#UBzHJV z(D{rpt^&86OU&c?B-ml`=_NA8b{<$!H-0MbYxN_)8E-Y$Yb?mWm)n09BOn^R-88gy0A{0M-85B+UN7e2l$Oi7I(3Nhg<503et^V+g8Feo zdy~d8(?rj%j)qNLs)(FN)>X8bK~oBUZiCUB8jB?{R0J?Iq*1$wtS3Ta6Y)S9w$-(# z9zhw2SI1sDyqXuUOkO>IKFU!Si^DLDTFraARghQDr><5%ng+R(_Q^XoCtiK_Wn9{a zu%Agq1;dagRy=#RePRAFd_FUhsK~lp1?zJ`2XHlTwVSZ;P-#zfE~et!^-uMiOa8Io z5U@20_Q4gSD*jZl@o{NLw3{8iQ+RLT?4e8>|Jns7^7R;?9K2#x@$GP`-(1$?X;frY zk0d~-_@3%CqA0yn^KyJEhBn0j({8?nMt822Agv&m>umiYfjEf1Xxvq=KnI;*2k{sn=AHgxV z^T~5EO@^La^b?*&cwO7=(fQ&D`l-gekJxS54k20{->=M5@XVh|tv{YK026gsc|hK! zeVRhs6OLlKPfqYe{%&zoiRa4kNf{uT+s2KIYscSDGmS&$NtSv2YYKC$Glqb7Ar{#D zgIn^`7rDl2#%)JaR2KEkBzk%|uI<}5Zp1g%dB&TuorL=y*xfeVrqPZx=uFha1k)Hi z!{{c&{nU(-BBdYdRhp9Y!cS53dL4f!;8QOHF0N1}9n}9q33+ z?U{!W){}lkm@s(9N_$#M$ZCxot60o)iSaBzEiZ4vHKApz?vxiBKTVQ91 zoTKpMNl0AFEN6}2TkPlLldx)IzG$=BYl+n*YENyDwq)+i!PRRhsp*O9C%D5iw{?CL z*lFIINFKnQcN(6idG8_(Sm(m+Y9^VmT_2i??%$35RqLd69*!XpE4tDHI&x`4QOp+W zOuk+bJ{efyRLB_2R4$Ur;7(H;XJ@1N1M2S z%YJk=1MYchoS!D$ZJW~Fc6M;(tqXPSBsppt^tERnM%~nLr>eNY<&{S^@Uf@3UFXGo zZ#Nlqa#@R3(_y(qhU8{-o513-eHYW$+%72=2-3aRGB}M*+9bOqWE_Q$X_KznE%p(C z9V=_oV+VMOY1ct{J}qh&9|hL>_)F5BXNgAjNc$kBOFrQ;lxO*5$wA3M$H(oOgr?*-lLo=XBbMh7q-b&Fv5xChPXR?_nW=b$^9TO7| zyE&D^Ja#yl^E8iLdRVmQwCVh8c9Re}IfSq0?%Cddwe%=JB5Ju~wOt>Wie6#v z=urD8=Tie*SaDm16I2GN|4YdY$dxFAS^qa=GP0PY|D#I7G3=UJdKgOfS}?}RgYxWiQC~juRuPqcf{lt`(a?O zgPRJuWy)Q>B96MO_3B6`N=MCQ&3@XFxRraJ&u<}^ym1Pdxh#)Hxa#8L@E1dO&U8|0 zJz$n}-)Pqcm#T6I4^t$7a<`4p{2RV%4BH*y#LT=k!m&J3=dO*Q472toUt&J0Yqdkb zMQhm8<$tl&*`Cwte$laxrLI~#fwG)p8p8+q&SGcUq4-X|@29f2c<$)nRL1f1X)?h0Urp5Dk}GI z%VJ@FQ$e}sg89J9&ol`BZ#>hW_JS1fgEwdG>`aN@+0rN8tIImpl=8Q@0{mIqmA5B# zaJT4|S6pxmV7R_`ntW5(>WfX@DO`?=7j^(Q{J3#iC-VR^Zzx*#C3u6AjB+9I25CDr zJ`s~fsaW7nXQ^W>S5{MQ@gD+a=_5&X)w0WA$HUA%k}B9&FFXOfe2!wBD_H8jk~Rwe zP++4#76Z|8trYrGX^WKtw_8{}$x1=kBj9t3odQ4CE+d35yZY|pK8B#Bv!C~PwNbce z2=&`Q{_(I>iCcFxQo{b;X)oF(Zv5j(EG}vNqJzLakBptMr6=MKVy_8a;PTpMon-S% zcOp;n=}KAVclWmNS?K_`Dj%d{HeqiBcaoUr!M9RY8q^a$x8*yIZ`HV4QF|lPxLZMc zql+2viv1@B>nXb}?D~S-e`01kllPwxLE~~+w-+DAx3fvjX7m8>bi;Z501~FOZO$p% zV^Xsja~|OrmXMen!iq&&t+}<6pWBn6y}?>|0>_@ggpGe2FgCFAEemeTy^OHcb3e%B zanWU&`Iq94Rkm>ID+6NwYM_O?20MR}N`fxB3EE}5E*k+%zQ)Z@4iuQZ@`Ebc|13KS zh~%eqx_rgE@l(p#15p{Uxvcj~G<@42cTD28px;+xPPK~UCf*Z@?)S9a?rF7GJc;wF zOAex*W=GTM=qQ%N!&Ga9_2y+SHT(qa@*8Pu#vSG1cF(FE4?A1h*=$v?4aX#uGSYTw zQ)A^LRvRC;baxzi)?bGOHR-U_YhPFK?aHoxbBV2)0h^jjq;Rj|d(wBxan26kDW-9~ z%=P`|!@wu%F@QVoSXEi=aH`*2)*~O_Xnj93O>;>b`$N-A(lt+9K7x8Ae-Cndpu6_> zAY;4O%WYVI(5kZA`agwjh{4%_+I#~>+w#(knRnveAaB=&koyi_52LWBpsR;3EY1Q z79~FryswPv32|JU*r6w!d2<|Y@gKz3>O2XO0bJqdIfy^y@<29BnhlfU!+!o>iSr~{ zj{{;|HUM7%0;{=fGx5r)j>;|DdhQ>9mb8WWMsGS0#?j1V#Q}Y?ICPv(QKfYUv3^qO z!{J0koo`Pv$4E_W8$)<1_FZk?Iyk(0=Vt$q>1=VrPG^@9jnTdB`j3hJ?dZHi9j`)g zhcwKcah{Jl%|{+Jo`6pgoP(1~gRW?+O`-i!elHdnq7>qz$<)krvLbElge`B&PBUxlwo8n{tvR@^L5^YW=)9T#oD9aI`*PTq z$@K`TK6|J>v7gBw6K9!vtZA_#fR^% zOt(Kc%6q4GI&@lpK8=njq;^KX^rt=&ntG&S&rxpn8(r1bLoMacA%5r zdOBo|j+V&4RUqaTpiA(5v^dTXqHATWjs(gk4C}V-jbkGsEYL)y8>AQJmE2Iu%Hc zMbSbE80SGA+_-6A$MzvuQm?`bT;*c5Yx8EaEQpk$tAdO1Ae|^1jmL3=DKe)3R@jd7gcG{EDe`)@;IqGRvshw8sHXVft<=^kb}U~1f>rh&+boEhTl8UX3r4ZjzIbV zd*~Eq-LX)P++k>!ZQKa8AO=!wSi`|{&3c5-k0T;L-Bkf`>HgS>&&pb{J^#o3u4PlfvsaL*xGB{a5*xCtK1 zripU#o=Ngbo^>g%MOhp5c^mGVa9%_*-9;OV`ET@xD;*B^Y5mksIF2$f{ z5j0er-w!Niek_+j%Esr+k7*^uEw7u*kBUEXFF{5ksvNR+)Hr= zEtpa=Bc@wiTu`DU4Q8tDzK(msM4b0zVxs&NrenCL`JOy7&@(QlK777m&*yHw_b~7+ zNbBL`I1Uu@tBDO>;__ODrTXoLT{K0ZLyVefpT=?;yZGcC+7{C!nwlBDRpDxh%c{hb zAnKC8eCa4h)$?)ST@1P0ABbi7tPF>w2&IOSFua$iw!|4&>(o4(>t3j2fJn=7p}lA7ceF)9E-x(2#lwS@tbcCR|B|LtflzCTAT4(oSZHW zP%w6J(V5**l554*b*fK=dp_Nh9LPN!l;3B{t=sdI&Z>lG5ru6Lu+^d2D>lz|SkoTb zlZ-(f07(M|ocUwu!#XT7NOY6O42mkw2H@*T17{K%1ry&Ty#j104{&oaRTd3pnG*}d z!vQ~zQWsvF%cTuF{&We^9GBs^1%nsfuXL(s1Al)PF8PehI^Vd<0~9`t88|9O4aK8H1yG#qGo&E`(U0cRa0h z8l)%aqLGO!49pmNB*xe@Vq9j6QR-X@VH&)E0VmhD3YClZ_AjAtZJDHRaj9rWNqhct;V=+8ii6xIzf^2e_VM=-V5`idA<%)NOP{CkHWZ*XRlbD>anCADy-)2 zh8~Jf%T?Wu17Aa2_d_i|J?m22lW;OjIvI>B`Z%@-VZB#sIS2z*)#<<~oaC6%n)7-F z^SYGpATZa_8W7h8d#~T}*MCIDst#{bc%R7U+Y}xy zv7e0g5*aHzhk>UtbRevpHhHZdr~bKYTcL|4BK=Sj?sCO}064iu55n~}Q04i^ow#oR z8;<03zK-t|Bhi$w{IlnIVvjB5W>UOEm!BMN+`5ZnFSkAI<{sx5 zx)Bf*tx*-s=Xo}h^dXkDDc{%eSp(tPyp=?fvfI%P*98WyLY>WE7szNluhS}AH_Q8E zR_%HWcuo@vv2-qh(bhkRvu#B`DYyQtbE8uFunil<8SrF{Z~$7cF->F-o%1+cvvYGz zlVm{hz@SFRsO80{RF#HY^)T+64EaT@sd&X-N`7f^E5Fc6hY9C#+&Auv#7Lb=3sPP& zmYRQV;)dR+FPe3d$ww=0Mxh^-rgf^yn+cDfUeeTaxtgGotxYr}NWrM*CxDsj_PQ#k z+be%8E|d*U0F#^_8x|{G>(yzzDXl;2Qfuj4Xi$CaIpC}hWaC(l#GUuHZ{Ri+#cj}b z_GjZ{^oK>ckVYmG(mD=GNVwnxUC`PcbSp4Gk4CfvOqd`H?vK(jZZJ+G9RQ2KQd;d`4U-(CzqLrm(-om4ut0G7w+TaiS)qUc+*vIUZjQe_L3b zOhN$2WYppsc)76169#2aW(8pv#fxmxd{OySSsUpdHZheNi=F6e&46itGT@5Ce>Jsd zIW$4Nl+cLrTHlw;^L&MQJ}?*PYa?RAiPv^2#dEricFM1}M$)=|Jt-HJ7Oc3gmMsG2 z*+fr%e9WaX?{w7wO?@&E=A6uqwk|L*BTr?4MU$#T6)8C0m-Sn z*$v*sfN3_jF;^03`E+X6Zx&%amD>)RgibYcFw30{EBp9}kGJKwyH%!lqQ@(Ca^V6*$c>(rs*y%3AZq21Xf)j-A@`G3yY4Rmtw4#!4+S86Ijm^GaF!DbuX`WSL<)LdKkR7e7w?#7p{G+Oc5Qw7pmd+aRs4L0&nr;%p+kswhBPu2Y6+Am7DibJ znRjfZbP})7TV-At`q6?MBA-)m^*LBrfke=z4U><2Ftb=7O*^9#<8h3xD!tekkimhxU#6)n9s43(~vpe>Nv=u8TEMtkF$+&MEq85d;=S>RkSri z)^&!#I0o^I{m9}xp4?Am;QN}oAmdf045ikHFPXH~u4K9{KJKZV7=%R8z){?r?UCj5 z*fY=eJU=G3f_(z$j5#_|(v11*c$iD`X!!CA(Oxb*SDQA@Rr7Y4B`hxCDT?++g`_l= zuhV0|W5__Gfp|PX=&O&h5;D-kz&RUzl9s^b_D0WjTS|xAy%N( z^hkB7==V78=VA_pWww}_L{*y>mKUEx4P1o{B^V6FmO>#G8CahHR)a3Wdd%!2(~IrD z(^ydnx;O#s%62%Oi)EwatRrn05aZYC)A!}Zyo&U)YT}K>eLf6gt1%WV!k|O{p#P%L4f%h_0Sa;jM6qsmFSPZlI z;1q3CtvZp~D|k_D>$sVpH3;7$n0=9W3KatQI_1t+Wb!7pNJ7!>MYx|&pQzn-qzJ`3 zukXdTTG#620I6{Zm?*Ep+k(f_(wSV)PusIcW65A3 z1`fqP@`|~VXE`dotAK1)Fl?O1>t+0LvI{<jBO%K3HHjpp>M*p)kD+_k13{>ZHxX zsagy?8*xuQy-2vA_g>r4$@XOVKr#*1LA!UL$sVP{i1>n*AVRfcLW7J!X!1C>(LLYy zD<)Cp;N(|o9fk|Ek80Z;!?=r;(TP|F$Zel2h=f74PX@88`gt$%X~N#UXKSUTL-N@^*Ol5oy`=vG!r%-bs^rlf9mp0Xgax`d@=&=NoIpez6g# z0+=f;YupG-GY^EQ>v*nDr@p`FDme6l!XO^Z!Q~ej`$}Gbyj7dujCdFabn@kXR$dp)o%N^@kn&dT z`C;5!)+PC>v)8tDqBXbcl42D)kN4xi%h!B6r_YAeaUI8Sds1Le-T!G|rM)A>G`-fR zlZ;qu|2pNb+WYf#Pkwolg0XtV<>ZrReOW$vc65RLSY7fM*uPBJG4HCB?VA≧jaH z+B-B;b^0yfBA!S!>a{+d+S!38@lvF=uF26&uB;%Wi(4epC4`#CMI@ zL&yEr;@)fCPJOnk#2z}~JJ)vmoY9U;2`{XLuJ>cmn+CjXILHkoj`eQj$NL9m4mWyS z4`5!jp^tcXF|b|)eDFb_hUTi*ZT{?OGD^>@K>4x-xj)AVRB~xN?*I-M6)m*jKJQ1Z zLb8y9-vpB%HNLZ4?cOiLkJ^S+z&)S)sqxcb?ng^R$?bf#Y5D4%lo8dgT)l#~9I{~x z!%^udj*jE=MVtM>vftHydf6_!ns!d*o`%}677}<{HJx6*iTZQb$ zHf#jGMwsGEWUx9>fjTd>#((i-zYkQ6F?ivFbvbQnmYaf1^|uZ8vn4*U``SBQl)|{o z5hHi;0#x}n-i7-@-5@;LPLpo1yFe!8!l%W&hp$bLhuyH&%r!}7`^F8|0=w9c8seKh zz0#%A__26EkHvD>ux7H%wi{Q&gbU0r*%gaQ_fb>!r|pDko3b|uB+%R8Uo%u_&?a>4 zP`N_7H))ddCJ8DQ4Iw7Fh~d6T%782`zCxsyLbyYc^uU8W^7tUif7f;16< zeHuwpSl8x57CE(r!%BDnqdhP&I_k#k99)fRice*Mr;&JF-o%yTB)Q88r}fO8FYi_d zOHiIT6p`H5W;M7q%wj(yPMzRvp7TQta-(gUwly;OH5q4e=)|BSD1qKWWq{jTI+0gF z6_&^R7@xd>7TMw<)nQ?UD4gS9t^0tE*d5w3c>HX}-v1b+&Hegv`x#ps%57KwLCA%| zYXB6p%6mCU(;8N0gqKHxCOt}|$D-GZjbgNkikd4Li{V&Oz7-4SoP>$Aun&!XOlW$X zOhkzCA$QQYE5s2_D`py2ZT1>`H&S72a^dQ z`~u&e8cwF;aJdgfEtU+#so-Au=&2Pa*cJ~?Ui^~Z1!4P@8k>N0S>%%6=`a@^#a>K!bs0;; zS|fZQkdBz66!{J_vY7cZO@0S!k!UyvS27OiS-*qdxPs)0rRO%^KrD=*#dJx0khg-S zx07#GInon;>_;Lg48o($CBHiWpT#A=LmSiOnjXaGH8pI$xT|!i(x2{-9bEIv`|e49 zlifTVdT8BPj@|T!haX&g!<*QRTONPxs(}scH9z^~```MG!z}f-jsJ3c^Y_>_55NDS z+keE^x+Q;k-7B8`1e^7Z8$bQ7wsXtHebVxc-1EpqHwFL5GRMvv+j{V;Y~TLwhM&Fc z5f&S{dHaL6Zf4=m+QwVsA7oc8KmEezH!NoxzSe$w=gMc;`G;CQJ@cD2zTYmKc+JyC z-&}Ti|CaCH>bV+p^?$AZo}}`s{?4Rxa~2hESf3?aA)kwd%jECY@Uiiu^b4z2_~4tK z?#6ZW7Dn0BR61l&hes&gYK4@x-Nocfx1n7c=65O`AMGUgKXgr3c~w5v@TF4KEO(qk zDHayP$z;Ep6s{F9nA@;OIx1h^uij19dyMdB^4V=@jjx_1y|dTR5*Ye%g~RE>Z>6hB zJuCeGTSInB4~Jf@5Q*2;%)q>Q7UtCTm`^v>%)xA$=F%tSGTQz7H0pJC`+hD%MeoN2 zEcO1RfHYURYc?ap|FS!k^@#Qn6QO%3h+;VO6vk!o46^6dYBm8n3TH~u{ zh27wHs{Ot%+tY2R;#oqK{{Qyy=rH*@hjr} zQ1Y{4;g7#X*SCGe!XojEdaBa+tngPW^!@Rkh1dV=vU{u{BP}~Fx1lw@dKRgm{y&&_ z*IRe|^itm^E)8F^^y7`bx1@ge*ahEA`QCT`l~2Cm-1~j+e0cZYfA8O0eD8QqI`g3g zzxUnNckVwOJGjPo`_dz!SAB4<@!g>x-}tBXL%V%4oUZ!!S>^Meq(1bcruF-LZbNH) z`E1mWl-~`x$MUSca|*5Toxb<_d$sFdm51HHIMhmqs{Cy8N6sZmG{RMaE*ZO($aAM- zXpJwQRr=KqeaA%(l@68r}&-1Zw-A?PIntx<6EDrMW5`ohj~`j3Vm+%7gPL>EhRBC z_2FuT)zS;7bk+F5KAIBkQ0cJB^LK^cO0Sdj9ZFwOW~kDgH2xKtFHD+;sPBr5rz-tw zhsHeon8>M8&kDEiAvs>D(8_TIHp-TUYvVW?uT>L7YHB{;QK1{Rhg|Du3$hbM6 z$|WDNVR7#^%*U+EU8UzCMtUEh>DZOO@ma$kK62)pR?e8~a~oRY%V$-3)$divwERP3fXLMZ?JF`8t-?D1lbh_`3>8A`s&-0z8ly&`M&qRf4H^og#_!nrSMp53oJldZq^pD+9UKksI}zdPlQ+n0n@C}KmN|2_>HANr9Iep%9= z+t34Uyc4gc{wXaXbr(m4IF*;g!7a^$~?`thmI zIuEJvv%>Ebs&;Y;t?8)mS(5ReDjll)eE%->W-1&CZvT&`?t0$mHdOH}VWs58V(Ij4 znt0n|9XIz@D>UlIX*`(f?~)#imCy703q%Q6l|rL_K2NKD*Dm*|@RO3Ss?a*VTAx)s zOK7BTp{q&sI@RA*{i}5+6>gXHW_?!gi-kLn@`y}^3V*p_x$=VB?-dTW-uK2r0~Y?-|)&Kckk?T z8x~2&z%Ti(l5ZxJr^x)%_|6(%@$rXf%i-k9ZNF9DO-`Zk4STbAHtc?__PrO$-;0Gs z#^b_Vs`oUBue+7=)OW`Own^#8cCaEZcb&}|Up=z}hxsjg?Wr$&`nxZC)(Ep5;=S9@ z8ecxEe98?Cx^$x3GJjV%e82U*=C`+wWhx!A4<1!n6ohW)`RcoZ$fgJO56Afv3$w!T zV6%938(QPbXP$`7AK!!B{4(^w-;(mF3co?aIqYVSi^zuFS-qE`P103)#T1`Vb}+Ov z6qmstWxsNIW;_L-Lf z9;;HQ+QE06rgzPMFv5rBv)j-bUp^b@Tj|8@I->f{8ecy5rN8>y=K} ze(!yKZo?w!DExm5OV@z!F3E2z9G1@2`>*{oLR`|RR;Umfqbc&x@{hp-qzw(Lh2?`pl~Eo{x}-ZlE>tH#-?5B>gAf4Sj(tn=|l zKlz>okFb_K-(9-tbNktaJ1>Z)x1`v@dmgy=^p}6g_rmP6AK&=Oe&3^av*3S!rLEkM z?b-Op+a~JHVER*U?Ya1g8(H|gN0P6;{WUC*-4b8EcL{sN2U5FNg#MB3{NbyYeK$Uv zZCnxVjUBj}wQl+89ltuIh0T8PwvohF?7{p@DAU=Es-a%bFW5doucqt*mZ$&5rYqJymvivdVk1=xPJ6=kK$fvYv-{ zJzvbW@p|rIn`J%s@p|rO9lV}D%og!_?(#h=>bcyI4Lbd`_TN1<|AEt3=;fcf>2qKEA{+U7y#8S7A$HBJ!4*Z$jG^R|z^;qPAD!3LgK^}@UB`&r8q54`Ep$U!#y?v4Jg%dRRr zJX!f}yZL|a>iJ|VyY~FQ_V4|dJ?!P*`rXK%{dciFBe%Y)=AT~4uDq{*-^bp$f^Av$ zv6L8rT){?ex$qZT&WW;X*4+Emr$6;ecI8i7KJe!IRs6`Xy}N*1`Rs?|q!bpTF!^ zufF>WZ1i*geaga`PBzjO>e+E$H@kA@wRi4$?>x5dlJ{Spe)K2o%w5m#d}#0sWrrs# z-{AA9544v;mP99f6I4T#=*Y!MZbRIhu95$eIHId zv+MEIeJ@*l?wz0RxxTN*|MvfP{Y`WGx-b81VDERj`&JCLU-jnKf3I(8^N+4*`|?A5 zv(o-|Z(j4l`p1?%|JHdAK3Z&kUF`k(PbR)`$<|-~-tf;O*W1*-PqqKW_py)vY2lY{ z53*$1BJtI3^t~V$>{R?t`DAyiAKO)y7 z77od%9(b@7}k+(BZ%9wX9a?%f#1teLf2w<*%3~e(C$v z-uhoW`^k4IJ65ed(qz2Rj$t>|4CH z=Rdx?^lqiUJ1UaR>w8rB#d1!Kp*OKS`@SRhzr9@IdWS5(vNwL>O0h3a+B;kGQ@D+G zlJWXJ|Au{E9=m@1m*$C$T|T+4VU+jh9S12#LocQFSE_cBVc(LAe)Z^;4>zm&Fus52 zTmpWcDwppWv5wUD>ot!(xpbga)gzPTQaF7w-uk!vA~)x*{`}R0243kuO8KEUD)mkxHsU`i=uFWs-v8P7P5HFQin?X1#4jv;nBS~_ z_zUenx%1X$-#?LM>(Ql7vEG(L@|JfGR2aI@64~#$mg^zam zv_pH@XIl@9?CE9yrO#G))!1PaP$SuL^%0*YGU`=7hKdGqonZ<0)!R+(SZ^X_~1 z-E;1_=bn4+x#!+jzjS$?L;Q*X3h-Cx4hEzCM4ax@vk^$p^;GW?y&-2ZnUt8;&>-AJuxohUs z&aJNTx_$ndxpV#Vi4}z%fp{Vk;}yZXh1D7-#2wbE7iiVh3oGX?tf~YN)pHhVK5rm_ zcG1wBVRs1Z@oV8o!nILw(dX3?k@Op`WZ2gk^?AT6{z7v^OLVvs8k)Dg-51k9bgT@e zfx%v%mhibiDdq7|@ab>B`L(M~6nZK}RJ~hq!g<9C-j#dL@$Q5fb%sg$=Ps=2#V`Z?LrMLhX`i!j&fGqDZ%_MxIagV^aBeNST{`yF zye*TVXw2sk(rlFE^2*uO>B5#SWG3Mv6c8>;6x3TR#bp+>r=i`mK`_Uv4*fu26eyy3 z?!q~>{VFn@-r|;|Pg|U9*R)y<`n?)j-c(#%^T#64sKH3MeGzFaeq|^Hx@BJF{HiLh zBcNt#Dr>-q^0xKa}p$Cfo!FymfMP`%7jJC=`kLlf#6jxe153a_fLL1yM zO{>ws?wYv^=R$o;t-U_3mDSi*pzjQ>YOtS%VaI5g7*#Z$%E6KD(O67&hq6`p*qsaq zlpR6oB1#9LIB`9S+TBGXB@+12^QlXHaj48FH%c(zM!A`ifOW#NP@WO{9FAR0NRBp) zd-PP2Pi2mMPIlv=W`fKT2EDO6H5sJTh)IlogA#1;8;;b_7-qF2nIaLfDHV zsm*1X`R(-;p&BIc16`wcIvkJD^(ayVZZat-mEM*_Q@%-#MpRXVD4!LL$JeiF(5O5z z-gGV!OS#43OGsnfu3aVH_JBsmNKdrG4QP}xE4t`8{jBIx&$7h(Y&Xg&0>43ZHMN}) zH*aqfPsV$F?J=J(?yC0%eqo8uXG88j6Gy9lX+f5zyu2O6==a-DYJr$X@$$2ksfnCFeEub;Vf^(W<;&rUF9PjQ z@#OgqRAsbbPDwS(mM@dkL==iB9@l~a2swEQ4n$u&E)Y&&J|8pAhe3hghbeO?B|^Q% z+kW>qg-5o4>~H@^9+FY|^qaVrJ>PhL!@J;F35=6u%pEM7$SIBhRdCm$AZraMja{lv@why0%K$5ACtYCT?SKyF;V5 zw350-+FY1_WQl0f5Sc03%#OFRPwd@dpqu6xM!E-M_sm}#g@upa4F@9G+6GI9Cp&!F zCU-2PTSQt(ViR0UoO(Ojt?i&|nW(uwzP`{zb%X64Npx^4)L1vGHYuniFC%fmx-H7# z4{b|Aq+#8XVIPEb8^-iX^SeE8E^*Hv$0cS`yc|nfd#-i9e&sPc*C2;%hZm>dx)A+4 z5cWjrMI)`GC(Pp|+4k*JLHw+AMlml-t6$ip@jMF8UZjfrA(xlT99$dm41_1Mmj`0L zvY0POPHT)Qu>|I4i7q2cyl|Rp5}hMUe!R3DwB>thqH*EIPNS3RlF63Lub-pU%Q=so z99h|q+3MsYn>r$iNW2Tiybn4KvzYH}+ z{pHI#qnOiT@qj$qLT1UguLZ(dedFR_Fyavl7UaVA$B=;}9SbgWU%24Oal~n{>o z^EbtRQXXHSxmJFg8!l{d-&jX0dCaR9`K)Aq_7aq%wWQ`$rKw3Mtq1Umx;>udK`+<1 zc6E?6zDgJi{Zw@imqt4pdEaczOy{&!C<Q(?~B8!#I0v zZPhGg?~f0mxMCOu@QNz+WXnTNYacQ=&(Mu@4+s`=e48+2xMPq{!l%`1G&<5Gey+I?0u62m{`21LODFWkvgI>u*on@xd42d!HL zcyp>T>$Mi(&X0$paStx=Gtxn_U>>s$3kf;3>bqslAdsG5BrcpKC_hVn{b@S#7QtT@l&aK7rWcPyUW}D&RJ3%&BFXj+&EpP7qFop{W08ya>N3kH~^Apiz zhc`PqiRbjQ;-`9+CGJ08k8(!y6*^DY6=~!4iLp&H_36XWan+d8s9{MZAefxqhcQ=> zW2bDBx6cPY)rEdQQI_wA(vx zpqv6y{&H+I;Kbt!_f+-NaQ zQoXGBbu#7m#Skh316EFhV-b*#rKf6|PPZj1+#bHXq3nitFC{#3t)&vzc04;QRE=EL z_$RlJ??Vk|Fy=O4#sY;!`3J<8-s>svEk#+ya`jxze~dI+$(Ws;IL9!InCwJDkJhb3 zntX68(XLLif4@HlG#AD?BEfKgukzW^TcqZDc+aYxr}D8c=EF3|gK#yEk8E0ZtZXGY zG4RWluHPbWfxj!@3wrr`M!E)KyOt`t$*UxM9y|;z5Z54$NsRtoDMOZU;}15>UvCCH zY=c-wGtywymh_x{R(w&gL{Jml-mPSiHo}1@f=CwyFnogAKR^)!-PD~w# z#`R8zyN$;bWb4<;+4>d8&Q=Egxe9p;E{0%n2}o~?krwsuO9m?Ixvk5^ z)M(15hFJvhHYZ|9PhxGE`=PC5osV-(qH{ zyzoaNiaaZ=v38NioAFR|`$tRBw+U91}A|5DZ&5Y`2SM0-&b4p?thWu-|5tZaO{J~?+OCL3gGl2cbM^za@R_l5b!DxlH2Fq^06 zURb+Wfr;>u++M#GA`n9Do1?az5haJvY)QR>m0AdK6IvW`uoPh-_o`(pdve?e%*abpI6FN&>-fNzgS9CqmNpS&gm*=7^=u~514#vk(=L27X zn^aHlK4HZpJ6q=zZYLO&diLWZw^Qu&k8IoG6N$e>cFO&o)}KkXtoSpQ-a+(&!S!ug zzcTy2^NQaf9{Ig$I-iEeibscaa2J|2em8#r%mZhA|9pI7(|ml?8qh8H+vUhRViF*HD=rK#JYv9(S9W8|QQT&dz7>>-NCbTX zOn9@D^CNywbS2!$T&>{=x)Rvg6h~Bc?^V1k={oWj&~;d6kgAd<|09t$`wZ=LGN-A6 zPfj8+3ZxMcs5IB7B_3N|SU^BpAj4SG=(n;X`dU9Yx*j2N zSY?F0L;D=WY}XsWbcmM2IR&=#OS-1aLH03Hzp4Nbqa0?ke-Ah4QKJ!T^luw|fePP# z;F|;oxvOzS%KVgT97eoWwr9~f_%$>vU5YZy_8Z9ny-zH>J$!#~J53}P!#zYM=R$164qWWR|6N*DWuoI0EgtD=qYaj)Cvn(_ zxD(}}wwpR|k_U`oZy7S5g2+ZvCz`m6888gx#>mEULBG{}qq;%Hx1`a7k;b$nNNNTv0Q687aAw{gW`M}Re+>0^{7&+N`g$j!Xrm_49nOx)*=N5Yo=T`OIi&H8;=FF!2DfgOsOJh9Nt zS*`(Q@;4vJ{ms4baDHdmPRDLTZqdJ@{5?B4vYS(k;_v4z#nwn2jERUKiY+hj;(Gk zr2TS@nd5R!;(LcEAcv3TwAzG~e+qOnx(fuZEZgt+9%Se1;z4&Cy=f=kcDh^ZwJwf= z1HrUK@hoXOVT+&*p6%Skd5kkeEvh|-S<-T16KE+24a<7+NmGaq6epRh@s*G9gC1W` z+6%fyUR)WbvJGc! zCqByfbzIuYx}B{wHYMv>@B5N=+sQPV@VQO%!85m+*G#7xy5nRa_nLE+B1)S48GdYo z)Y`hVcmS3(LXSFxVQXbe+RQ_mBgsDJAtkkjOBu+UAt93NTAQVIE2g+C@YdNbW0 z(@SOAj&D+~W_m$aft!34eq5!?IL+_+>-$*9?F7R@MD}ZI9KRhu&2w|A2aQ4MC+jtf ze7j@TH7q_`?kFRDY#gg{Iqw_O-c-@f^+Y`%j1>*!(^dYDsN4XP4Gl*BN0VU@u$TXX zDutiKH=F#plW6Vjpwtnd%j}mKkdBaRe#(aAJ`~+oVW%TXH-kroA{HmBwGKO9UzI)% zi9$U-8jUnD*kl}m?EOfxO-uKI-hBAus^{VYKcoCu&HGeeu+p#UnOz@~xXbPYz9N5W z0JOtxH~t-)HvU;}6wi{j@=nl}k8Of7WIBy61JPSm$_K`6oy8RLzmoj5hA6q-fzzPD zj@~TwRRyE^ggUX`78m##d2Lmnk@AQYbNQ4v+jh2+ky8{O#145fu=ueo@J#A^f%Uaz zama!(G?brF2%lhO5$G7XK5~H1Ys;%7UpTE15O@$2j2vKcnnf`ETszbQN~7S;qZ!!6bEM z+kRx8j}Ku?R`o-mXADJ2ZSs2hHE#3BDzX0Ck8!)^8sOvSSGFCD=U3*$Evy0k>dWY9PJIX^miF{2ioaoPwvrHqMp|OGwC1W9_@a} z`g|JRxQ%MI1##b2?+noz-G8O6(b0-opuekhi=#2qDji?9o6FbjjH`5FJr3DT>va6! z`nVYUt@=$h-$M;Ahqc{nw?#L3y5Zy|A+ZIle-VeK~1 zIF^FB5VGrcwIS9NH}EskO7hs>Iq4~DP$r#8L`9}{x0Lc(Lp_grYsA6HI4p)fivT+w zd%F`dppWp&zPz9V*J@no*Lt>LTU^HS87F2nR8#SEgu zPCr}r8G2FvWc^Ovf;3+v;z!?$hsOS5*=|F(zPyOUiq6r=)mePmoTJ0L7fA_lTk@^9 z?Oitoc?)GkKXJ{-vw_&Wb7)-VlA3Wpg5`DuJ2^Ojc5mHY@L^OShL6o)$;eAwN#_g6 zT&A^C?1OG`>F;X#6_sIEN6UC8dXavHcqc1eH&w0^uT*5~8$-qG*{%tj#}xA#wd`-s z?I^b3A~?L|fjUOHvFdB|oPJict7mrnk+@kD~UK!qT%r$7rr&>DaxhN+i>GMtn8vw-SBd zmOQEtAC%H?z$fkXz~;LIKEI{$UEX-tk{^Ub{_OhIVDwJb`d(E-Za*{Y8KW;n%Gojv z^kc0Ep5$1s*xiBHET!CL;l*KFhc9IT8>|zf6VHxsc6?X$*oS%)bab`hC@J0|MtwDq zdd#7iC9>m}iqoN&(s|Le(MR`84(WdN<#$rMQ0#J!*3~Uzm-`=6b6O|p8s*3Q1;-u6 zvOJHjaDBUmQxL1EVXVfclgLj)Wd?$XLgibO+pyLfjbd)h&zw!*b1UR*#m`P&q&%!( z$V>Zf3#{~~8Xv9bQ_r%*y|M_n3ur&MmrfT=*F#pgjs4OJKepE+$d*3oqfx0` z3~AEBj}@(NT)GZ8vZZY|@^Ze2q4q%X<@6f~x1R(D7x)?bs3l));xdk39tj3$pB|UR zc3)T=mo6gU#bIh3PnNtnqZPT;d6zT>8tEH|4q?qS^GwafGR)r&zt4dIx@rX@s zSlQUTcFl5Eli^!RG(Hpm$KWs1SY4@(IHgsZCJplsoO!EGyp^9;3S(a+&YDfez6Sf{twHngjEgpTwF*6F&Rs_K1V?2S!^<6ts;M>m@CV zo0my$rOtV=19`}_#Qtf3P=L_k~vAEBJtd{!L*@8%WRkr9Y5&^bSVZDTZPnByK z-BA?^bkbmmwr^hDK;;shMUK4lI{*tKc-RqWqx)IVR#SoFf+(+*uA8-zO5&dqC2S!d zj<|qDCO6j8DT#>hiF9_Mw^I>19n@a=(G}o2zims0o$uv1j7eOsqASF(--{4|NAZEs z7Hp`hbjiKWc6_kKe{ zRB#i0=hYpSdzS3#YS;Ehr}i|W_lugRJUtw}F8AAz9L>+a$A@C1^xNUjU*E3p9kJr~ z8LR0$eMlQ@UE19vPw}E%K6LgT9W+kIL&k9&1?)4(1@szP1m|E!X>$-st*)?$TGc+= zaXo6iD}+xE$BnTElqZueD}t^7v1POq!HU+p27H0Z?F$CtWeo_1feip` zshyIJcvYO+%!8%l?kYtD$EA4D0~*G{URb)Uesx0=qNyl=06#M=R&7#Zv=w;N zfd19RKq!RIFT%`M+&7Mc`G^?^iSDJ#%r4*@ouZ>@Ks4~3RoT*zW~cBmZa0t?V`534 zU~)yX(`RGZK4(4w~@4ld^1 zU5JOGYcJ>;O=F>_V-EF3BzwtCf9W}r#=}(CR=t{v*7>my*Tpy!G7_t%%_IDoSzh~# zcb;)?l{`3$+AD&`5S@rqydVIQpuW6cs zx$5|U5se4%X==`-Ui`U$aE|bXqXY-rUelK1;CiqCpA`^;fN9{AZE`^oa2fTRbX)eq zZ&lZH{YKu)Y;{X7{dU0w&@pnoiz|A&y60C_AU=+`WIYy6U&@t01Rt~2hd&x^NXwIQ zS9PC)Yr;vIY$$P3`3k3oYqHPfG4Hl`?fSrRdW=F=_W1=Rz&|nO^F})P*`0C$9yjr` z<3V3?zodmsQabpzgkl$Gl1|{0A^LC-YU zaV~c-!L4i@d@3e^YQ(gsx34|-3)H-Z&qaxHkU*|(&wBAGHV~SIkt!7Nh{Fv*o1(K8 z*G06~nP$fpJhbXJvvs>bU!mt3A;T2eVG|JHr)Xff=JtM7_V&J=T#Yr_`(miq z@vQ*9;`J`lFUr)ml^yh1ITN?;vnQzbNY`3vrYq3uG!P5OMvd3R`ABakyLR>M+cwk< zRE|sW{cO-MUW^}n%Z*D8Aa=C$)sN;|j344_M&eLJJu;ZSvlAdYNo@Bq@}?CDJ_qN! zzU=#n9dC|RbMQWPGb)~R0Czr`CF^;Ojc>DQT_lL<6-F`yrKCRX{dj)r!5G`wI@ z!j1js_zIewp&9fJ&C?J+vWYLTD_WzVb#%}j^5Prj0=B0W;?Af*;&|_47EXv!7^3x? zb>n(8^{wi-u2Jk{+D?W}fLWG0EKAJ+`G`!Kl~2HoG;EPH1anBk3`-j19JD%(44oHS zK?nEWh$(0<`RLU?efV!md--p;L`$!Q@-mcw7cv861L;PU~EJxU)B3gTo>W2(+G|_QnAFim2qxh*AI?T_L>_$ zByrv!+-WFY9x9^n?gWm}Bp!UmAP(WQtMiD4CO6S$rL)TPamAoTQy<9V&KNo|BQ=_& zc+i6~$LRBGj5|o%(PGDkKIhe5HFweH)qGl_c(V)m3qw8^+;F+^^EO0q@Dj}#p%;Cf z2wN3jEG4E84y@wPA;dWS9-m51&7+Kd-V1hvrhM|ba_^BnfBNrl6$L9E>{0lnpUAE~ z`j1Z(tnlqs_@phEdwil`g>Rq2$1Sd*;HM~9;d>kSiaeXVY9q5<{p{p>#;Wvf%OqOz z!=1Ee0H>+?+Hl+#u%`Oi2e>YTn(-%nd|k+n25M9JNh`}fFZL}^X$D6c23wCi7VFa7 zFac8E)503og`5_c^f-HpE^YgGK~;qu?W}dqxCZ?*&Sb~)G9|w+EJBLg7&QmN#;8df z+!YNIKtloMZjCEjIBjNrTj|lG^|>1wlzh5r^A%o9ulZU?_ECj*3bGXv-sLOLrZ=*| zd%TV}ea_fejb`jj&56_f$mwSmQyXi*cet2P$C6=adsidAhau$9Oo!RF>1#f{WU2V> z5v@*b!YsN&6UDWS2f5=b)#j+B@=c1crn$J`Q zJgt2OJff*|KGlLIKKHNAe(vA@u^?^ixsU;;oFC{bjCOpn)0chEzpK^S4DU&*ZB~Ge z0(T+=_d2fZ+oq7Op=DlkU$Zz7q96sF!|2gyiA=8cLwVuY6SN!omNEB3P*%XNg|Q?I zV_;*zix$LUJk7B{j9vggteVrM=xsu(2;VP-D=RA-s;}>t#?$3Fq%4?}Nk{$4hg0}r z)#xjMC85wv>;dNOCL#>P0y`$lZQQSqDj8RHGsJY|uv__n;&7<9Z&6UtO!38Yc+9R>&} z#hU_as;#29Hm{FG&GwMn%sK@Eo30d6L?>j6G~xi?$M^cK)p5cj*nvcU%1 zUXz>QPa`jxzFUgy7~U*;-`)zGqj=1hvQT=?Mb5Obi9WP`2iY)gL+&ejN}0uP`i)v}OI%Qnz5LC$yi)=#;dJXm^Wn%0ty zOUWFMaS<6bC>hv}>%+r1dNc-k;m!g+BH?cDb}`#*c5-^g8a}u|2zU^aaz&7~1;#Rt zl7>EhQ7VGhx#XtY7kud#FY-x)qWMnHRuuEN!ZHSbu)I4NZHY-bKS+=8%a4}w#^k)y z!ur={6b(B;!`N8hBG>v@1nWqMJ|vC}o@eu$1EFZpR|bzfK5|2T1Jj2ow35X!cL(3( zx{ja!r&TRjFxTiWxUdIwjNM2JT(DkTDmuWPwqg|rR3QvOtA03nwLaj}yo(}zcqk*) zUGZiYu6c}4b#7v7Y-4GMpbUcU7)6_l)dqTrzg|X%tw-@GDC(p{o07GCxW-%#A6(+$yY$GG zZoAmshIMN1IOnO!hpva+LH3miDFX6vTx|kT+Z!t=3)%1Z`l3(cB^W zAK3BOPRGt$))|F_;D{>N0kEf0w2%f7wL%j>TG@(YWJYh*Y3H~V4?jSv5Ox5hm`{cW zOViO-b^r?Jq3ewtwc>}1QloS|DxM7%fBh01_fY1i=m0$c41-YITC>{fQ&$nu$m49Q zVMAm`V_$0&C-+*bQ8q(0*Xt^Bkub?Na!tUsF`h_HKWt@v(DM)KmWa!PuqWvldLvC! zkQhVr6r8W%q1a)h2itbXsCkbp5)mEPz070e^bfu%o@l_QkHPKkP{@rN_zjkZ9E`!P z63{UUGEYk^GF;u3uD*OsH4XBdJl>tf#5pw|Cq3Cah@E($cvXq(F|dK*h7Kwtc(8n$ znb`)eKMMhtQ0C&B%3@g7X{iM*db{DPTgG!ih~`YOadx^e7wyJ?U&RK6lEFlPHps>F z03jmJwjJ&0JYBbo$*-d(Hdq|uYMj3AZiq%AHgfk5?Q7{3OT_6>ZM*_0qmD4{)1-`< z_*$4-pMa~0a7kHHPP_vqYf?Weo}A5Tk#@Q~f@ZL^I>Fk4$1b1g$r&_VIdLHBxJTZZ@dEa#@0f9$`>EadI5%xS08L*^Q!q@qBOVG+#L0O9%qI3NHz_$EUis{I}UJaqLp-{SsDl+`;WT^|6CX-$By$k_4TuC23O6A&vjdi%Fhz4>}cRqoagOLlI z4A3!cN)|KuKYyIk^-h0xB4MCjv zAU@G*@L#I>Zv)Oz62I8_V&86k(J;f72EKh0SW|7V9oOl;37qbeBi}?#noYxv7t_)& z_bt+CLSC(e&xDP!BdvFWHnCR$A8N+6om|+-^t5_kFqlLzwjnCaYFyY!c%cj;)xiLF ziX%PHezZ!hmAS*{EjSCslOAj!d}(mmz`9er1>qJ*EvKosNJWAUB|AO1E*7@8a!KQk zpp*DyH9nouVsJUbyDQ??$L5cZ6Nj+VQ9cO`JBkyCrN=3UT#a#k043dCu4ya%y>C-s z3nz`#w;vSxN{L1s0YqQ0P^5sP2!Z3rx~3N2DGmaqHj4-kv9T3vF`ImNyHcBh(^*Qe zFDeLYWutGVwZ&bIdRg(e4R(jvQH2&%Cz+A8g-NH(qt2n+&uaX zG*Vr5Ir3Wf0FGQQs>1Cer0wc5UKJblCrHZhN-w?*MV*coL3#>%?@ECV)N6$1$a8PQ z^@U` zV%%n#WeOc+Zskd0D-F6=x}@klZQlzT$55aH*_bYTR~BjFsU2Sn`;e2q=-h3llLi!J z$Wf1nZI*zk8>jy4!@)uPl;n;sZwzPsVla^P;Pd%XEl}<&=b8*bsT6ie=Py|WS%^HM z;lK=1r5lq$3TmRmw%{2MElUSjaYGI2lAk01B4D3kXe;ShuT^Lr>zR>NrCL=v4ZyPB zt#@GShfA7!*gl^O`#Ph1Ify!xX847DK5x)RAKGyF5PH*&eFI_s{cRAG@VQVAk=-(1 z8v+;I!Bi%cYsiPy$$&SBZK*Dcd~LCa8;H}<^4&w}1zP5lW1)dOEtM~YR_sQ~RGuMU zmgQMg!+DtDpGnvLE!+vdeGW^ZjpKx{bx2zVL!gyKZFXop4(ezn19tYmc0M{-;PVX%VN)$KXiZREiCl=2UeVW z%&(aDynof+`(%Kv{nfc&xo<{@IdAp6b;;hpu<280es%r6i~3z(|5x%S-?aJ>wsEOz zZ}p0GEV2Ia3znVqNw(qMnJu6G<@+o+>b}BTUpt$5j=ug)ZRyjjWn=eWg25eZ(GS}{ zdsaz=O>^)3XX2dxqIIzUwE7O0Jp1o>_QWl1e`E38$9Amjewc08SX21Isn4=t>opAz zUbmcitMZDj3w@KFHS-fE>|ZjIE%`;o%~iACW5;bRy=TNP9nLo=bzS;y&(-~HVD_Je zw|m|z_udivCA+5C^VEWlB-`@WJr7R1>@#fhidSDet9}W)^!Zo5{<-V7vFPWQ{?E-N zzh>v|`TB`BKf~C9qyBmMdGCLZjeKPDJvWpe({DZ}?oNFAq(81=S4e)*F4RiHuM6`2u}$89%0=nvbaT6#3i?)pIkPA@iG| z`TfDBU+nB5OzcpH4}Rv|8vJ-=P@f*g@IUG$@3RV?bm;9R(>*enpyyh~GpPLL`|7#6 zua~FF&lP;v+e(D6LmYBu;y*R-9w=n8ATyM=4;aWq{{bW5KNOLf@Bg7}=y$cvd{gOu z7j%fcpz1eJsH(}X(fB31qDR2wUJliN>w^)BQ~44D!BWjq~@9((f_nUU5f<>b@O(;VbmJ$!UhK$@?}?(J@e{& z75r?sNM9~iDcR<2BCYtQ?yIzVuI?XT$ce*$S+~d2e*SYRsM^Wg4k~Ta4o>-8(J@e{ z+T%b$MW-2`y04)5xm{YlH{8(qBiWAz2#1?~g`a8SNN3mlxqHxAK#yQ42CO9TK4tIRQG0Aa+<4DJ3$CU0o zj_@G(kF69$3>2y=IG?1MWKE3@ACWTtB)^@y-_Nuv|33xl{Oc#5)O(6g4~*A(=-L*J zKAXStfEi9Zwwu3ih7)$}<@bje5{`r6=X_h*QUip{aqamf@Bi#t=UbnAy#DmBPISKQ zEBeEqPW}$Ty?NueJAZxJ9g{A8VFiDF;iC3lX_fC)X&acJDu1YI)!QG z(4o3-2Q$g_0kUOOJ%$^yNrD0$D&J=&C<$gJ!kzWE&8l2m?bhMhUrhYuqEG$9dHTE; zU!PuIro+~@hTpt%+kU4Bnu;5?WY612bKJJ@g~=kH8NOHFO%Hm^@GlcZ{vn2oi$u7= zp$^$H&MpUA_HGURScA|ztYIn*=r^&YWBA;Xt$mn3V9R^>3v9W}zmmUJ!&a;k`4-Ff z>t(rSd*k#Oq8uHs%s1Gyngh-g<@E^QP*9)qR}-0!KBlLYk6Y%~@5}Pk`@MYH3SX|_ zJJ)kc*dY!jJBJ+%)Xvr48?L!Zn~*%Fpl2`VB~!3%n@DF1)!GZ~a=?!b6q?5|nHHrU zxc__2{r3vo&eu9(cWMva-0S(<^0|aeB=xlyl|E2VqIc-NALRp5Q2B!FV5a=){t(0A zn#((17vqi&P3^1SH|NWcR_$@1pz}5{UpC{*bl;pWQ`-4AnqHiChx3(h{IciMheuf9 zb<`n#uAuXQ*RMQg=b3M)=jOD^$7n|gerBkbukZ{J6xiWQ-AuKabcwTD+Os!Gdv}Wo zer@NOR5Pa;s(j}A*`{SXsdjPRCHa>n9IpOh#_JU3T8$3h5O$C=6a2f7Pp5=>dps-e z|Bl4y^(&nUs{3~E`RKQvDPFX}X@<(jZ37h@gN5etL6w*3zIv{p%BRx*sgR8nHCIrV zFSER<^gfZ_DWO?Thb_%N9|nD=pbYC~nP4m96=4!8d0<;R#C;hx%r2ApzR)A?U!w`A z<_({TinPk7o}2Hh=jy(KIbP%9#Na&KpAt<1tos1v$7LWNfdXTTj2j^#NlF zjwS{124mNe!d#=n<=+*HGep>n^%Rkh#Kkh#YUM{(Cq(EX}jktUnaOf;u$D>aEqY- zK*5(X;LCJBOS%LXhW~%3S#F+`a+L}06*Q}UtjAmyiTj6YTD62(|JmJF&lObft8{;% zdVio$;Zrdc!vz%`2MQ{FWx|)~xw@YTW-9McyRXj!GtA%3^>IG(75d$zpn9GuCdB;Q zoL29t`@;>LJv5z*-r{^v>N^G1eFc9c`JkY>|8uM^!k%=Rp^0ybe`Yw?`aA#3mut^I zVDL4`2Q%JG_s#h-qzB7~gXMk3x;ZJVR#3ziO1MD-$#o#MSUx|k zn_sYMnO3k=rWM{CK~XB^QK}xp1Qi_vh356JVM}j_iFHFA9wyTYw#l@D>G@UtmHr$s z+$%~_cAF|km2U?#jgQ&hSLGk-dY64_8?VZt4pki1u*2O#GW7VIex})UF^(VV@KBG( zQ1mN(z`i5>gNG_S#N!xL9ERQ=nfx(>ysz}S9n}3y1H`AwKh*aqsCxXnz=7)RgXKNd z4$2BHJ_RHxx@B!W=sPu&xxI`ozjb+vL&*H^8Kvyzdb-aHt(^; z-MnC?d@*Y6sZQWy3aa~NX!qQlKgVf7CHVi4)QP!%8>M>zsGDwC?c!>;vbIe$jR74@QsI;f~JW z@g1X{a{jMa>vulT`P+ZJd+%}`sxeNLr_v91|M$u>uh`-I4I<3KH+)Wq&#@nN&j~&3 z%of_n+i=T!w)jd+F)UpI6N@l@q3`#r)(kh>NZoaRctNRLWs1)z#2=c=4pR-BE4CWfD{xZaH*nF+mGSMCiZn#_eRu#NL zrX^JQ6x{Hld@f+!vaZj+Sb5FDLmldJwOd>rEOW1Z(;@ZlK_g#EZu$$47wy0f6r7L& zU#9z6(xuB)rkG+i?%F~1zB%7dlg4vxGZb4t22MaXE&Gbq?$=x>k zxe;|&eDxozX8qqc>(2bvUH9Glqi@#LPk-{;oq2EQaLuMy{pY{ir9U^PRsL0P?|QJ{ zc2Auds`7^zvTs!KCSdoRpMMO+L;q;cDvCeV;a#J*zYo_YyY0!hX$6km66X7N*zMEH z>6`#P-{#xCg5OQd1T(d-j#uFyB+P`TfA>echHvB;{_@IjlnVYvHi$n_n)4O8M`XZI z`ifr}9>~U!D-vydsKepf`)a~#mNDJ`r2J4OXwHAIr1i5OezEYw@3D{S z8n!kb`PZVy0oVNE^@kp=Yi@qbH~X%3JTF>%`fnEZN~?UEpS(0OdD1g=o1eVwf;)Gt z(V;4Th@of=w1?VfF;J-DB+XFT?8=9g2`V}U3fWVa@>kgl=iS0}{9Dg#CT}uR@Rwgd zj`pjvXP!KQkN3}=yp@mZ&wQzyUexoM#&I>S^TI9u)A1_&gMFFHrZ*UwWKYi^(t#PQh)l5+3lTcM-$b6OuYQ81=p}y}?`G|7_6`$g8BhQAS4!j8vZ-uvQDU>L4FG79hD>nZE;=Tp4rVu{)L7A>Pq z`CHoNvkXFFmdD%XR0sBz%)r;X2|@1$&jN%E=96-|XQPVOuT| ze)#_?PKTTLp(2m5%dQi1%1!^|lW)DxsQji_2`1B-_^jhq_y-IBYp%Lsn=gRHky-(l9Cz32NOFX~gP8y0guekpp_oQrBb6VYhMCLO=#ixIFsBCpr z&w-{@4EmuCRs9e77<&0>OLmAuT`u>K$GhaO&RoO2vfLqtdOg%0R<-9F~_*(fejR z{UtpA=3Te?^6JcKmA`BBRqvnj>#x4s}R%pr76j1LVhWzb|Sr{Qomaf`WE@>9sC8x0P zFW>*?WnW`euReFzO%tDGrR$!UzU;>v*$Hco55!hP*`zyucK0XF`Ihs;QBz-Cdck7n zb30huAAernU&z)i{o9RQ`A0C{JD;mPY2Rk%J@(niB{yHn+=&&Tnd^^Y=Y1o(c9!Q0 zY|Yb`%y=R+iY=YxT^QVSHY;24hg)A8SIS0xbYpAy;amF+*L?o*7Vopyv9^_Gj6C*+ zLe~28xz(qh^<8$s%P0^ zrHl5vS>tQFx8M8RYQ{eM_0#;3l0V{zd`c46B|AO1by zV&^^I68rlb4eab$&qW@r`Wb81KK$s#rGH_kAF*QGxhrbeDX+h|sAlI|?8N0K-tmpI zZ)JHO?OgJ+J*)Z+*9PwX@K2jxWWK4Nd}qSX4riWozQ5(izqp^Z?g|xjN1tNnUe`A3 za@TIQ=4i)~-<|LptM@#8)n87`XQd@uPTM=##fm<<`TQTP*xhe9TzJ% z&gAd0^OpC#bMp^xWovHy&Xu41Xf>eJ5ZHykd! ztFC$Lw%WVO*!jo(Yw`O3S;x+K^v|vTaNWk%wO)6jU-z1`s2QH#xZyAWwUp! zFR6~a&Wd)dIPcO&Zs<4kX!|Ejtr*K<&#tZcbiq+(Uo@)GQzu|Dm(S>-etrTR&=LXI3pM4!(Ff ztNq*7`))2gfgL$(&6@e+kLWiXF8%y5-UBiY)>TaT(^cPMm(|tX5`M4c)wy-2PCI7% zJ+&9t)w;g;tBbdcsjE5tKKJ^^YwBh-R-AS9r+-~Hz2uoQ${%{FZe+~$mF4q3T=e3M z{hu5A;B)=;1T4BM{K&~GU-=7D`+nvAHGQ4DNR;UO?(Kh{^uWz+Y=%s~%EL4K`dRo) z?z{aBgb}3e;N|!4`jYzIwO+nDXW=bb zpK_63#rCQEiaysKDDzW?idPsAtG z{YieKP|~4)TS3M^I^}zdKKpWV^lgzpF(Lv#b(YYgm;d`aFS#FI<^1KbXYc;U!`(W) z>iw65JoQL^insB;jQ`Nj)RwV``g8f7Ga>lP)ET3(Z9L1OJwL5@e*1ML&M(txA}jAx z_0`YfD&9fAR;SuuxmT2|^F#7W<#*nVFI0W?+b^*fuICx`v%{r4*ZsWQ7oPIsYV-TL z{H=TMgvTEE`sZ|cc%O$stx)|yfA8J;&iz0APPJNR)#X8u=U8&sHkXELXOp*m>gLAGLyS#eQ`#(Ox`Kybrt2HB9t_{?2H4OMOG*2;bEhba8G9tT(Z{kydX8!yMb zLlmm^__!ViM?3zzw8sO7t?s6}JfM|s<8TU&bi?m~$yMDPj@vBYgo}H4dQwk%T7HZ8 m0sXzlM83%qs{BI@Kdy)1`^W7e Date: Mon, 26 Mar 2018 10:06:23 -0400 Subject: [PATCH 112/197] Allow namelist 'maxpft' workable for natural-PFT parameter data read. --- components/elm/bld/ELMBuildNamelist.pm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/components/elm/bld/ELMBuildNamelist.pm b/components/elm/bld/ELMBuildNamelist.pm index 68afd92e132..cbf067e6760 100755 --- a/components/elm/bld/ELMBuildNamelist.pm +++ b/components/elm/bld/ELMBuildNamelist.pm @@ -1552,13 +1552,19 @@ sub setup_cmdl_maxpft { $nl_flags->{'maxpft'} = $val; if ( ($nl_flags->{'bgc_mode'} ne "sp") && ($nl_flags->{'maxpft'} != $maxpatchpft{$nl_flags->{'use_crop'}}) ) { - fatal_error("** For CN or BGC mode you MUST set max patch PFT's to $maxpatchpft{$nl_flags->{'use_crop'}}\n" . - "**\n" . - "** When the crop model is on then it must be set to $maxpatchpft{'crop'} otherwise to $maxpatchpft{'nocrop'}\n" . - "** Set the bgc mode, crop and maxpft by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -bgc, -crop and -maxpft\n" . - "** * by a default configuration file, specified by -defaults\n" . - "**\n"); + if ($opts->{$var} eq "default") { + fatal_error("** For CN or BGC mode you MUST set max patch PFT $val to $maxpatchpft{$nl_flags->{'use_crop'}}\n" . + "**\n" . + "** When the crop model is on then it must be set to $maxpatchpft{'crop'} otherwise to $maxpatchpft{'nocrop'}\n" . + "** Set the bgc mode, crop and maxpft by the following means from highest to lowest precedence:\n" . + "** * by the command-line options -bgc, -crop and -maxpft\n" . + "** * by a default configuration file, specified by -defaults\n" . + "**\n"); + } else { + message("running with maxpft NOT equal to $maxpatchpft{$nl_flags->{'use_crop'}} is " . + "NOT validated / scientifically supported.\n"); + + } } if ( $nl_flags->{'maxpft'} > $maxpatchpft{$nl_flags->{'use_crop'}} ) { fatal_error("** Max patch PFT's can NOT exceed $maxpatchpft{$nl_flags->{'use_crop'}}\n" . From 98be2ae3c832a825c764ca2bea9a0770f1140dc2 Mon Sep 17 00:00:00 2001 From: Fengming Yuan Date: Mon, 26 Mar 2018 10:06:23 -0400 Subject: [PATCH 113/197] Allow read flexible-length PFT parameters and names, if user-defined. NOTES for when user-defined: (1) explicitly define a few PFT properties (flags) as following: nonvasular (0, 1=moss, or 2=lichen); woody (0, 1=tree, or 2=shrub); needleleaf ( 0=broadleaf, or 1=needleleaf); graminoid ( 0=woody/crop/nonvascular, or 1=graminoid); generic_crop ( 0=non-crop/prognostic crop, 1=generic_crop. NOTE that this is for not having conflicts with crop module development). climatezone (0=not-specific, 1=tropical, 2=temperate, 3=boreal, or 4=arctic) (2) in case's env_run.xml, add ' -maxpft 12' in which 12 is an example number of pfts, in "ELM_BLDNML_OPTS'" like the following: char CLM build-namelist options --- .../elm/src/data_types/VegetationType.F90 | 5 + components/elm/src/main/elm_varpar.F90 | 9 +- components/elm/src/main/pftvarcon.F90 | 354 +++++++++++++++++- 3 files changed, 352 insertions(+), 16 deletions(-) diff --git a/components/elm/src/data_types/VegetationType.F90 b/components/elm/src/data_types/VegetationType.F90 index a3711f7c117..dd8bd7d842d 100644 --- a/components/elm/src/data_types/VegetationType.F90 +++ b/components/elm/src/data_types/VegetationType.F90 @@ -33,6 +33,11 @@ module VegetationType ! 24 => irrigated soybean ! -------------------------------------------------------- ! + + ! ----------------------user-defined parameter file --------------------------------------------------------------------- + ! NOTE: if user provides own parameter file, with different 'pft_name' or order, + ! the above ilist of default PFTs will be replaced, and arrays of sizes as below will be changed as well. + use shr_kind_mod , only : r8 => shr_kind_r8 use elm_varcon , only : ispval, spval diff --git a/components/elm/src/main/elm_varpar.F90 b/components/elm/src/main/elm_varpar.F90 index 21e8f659210..1f82d65ec7e 100644 --- a/components/elm/src/main/elm_varpar.F90 +++ b/components/elm/src/main/elm_varpar.F90 @@ -48,20 +48,23 @@ module elm_varpar integer, parameter :: ndst = 4 ! number of dust size classes (BGC only) integer, parameter :: dst_src_nbr = 3 ! number of size distns in src soil (BGC only) integer, parameter :: sz_nbr = 200 ! number of sub-grid bins in large bin of dust size distribution (BGC only) - integer, parameter :: mxpft = 50 ! maximum number of PFT's for any mode; + !integer, parameter :: mxpft = 50 ! maximum number of PFT's for any mode; + integer :: mxpft = 50 ! maximum number of PFT's for any mode; + ! can be modified from reading pft-physiology in 'main/pftvarcon.F90:pftconrd' ! FIX(RF,032414) might we set some of these automatically from reading pft-physiology? integer, parameter :: numveg = 16 ! number of veg types (without specific crop) integer, parameter :: nlayer = 3 ! number of VIC soil layer --Added by AWang integer :: nlayert ! number of VIC soil layer + 3 lower thermal layers - integer :: numpft = mxpft ! actual # of patches (without bare), a total that spans LUs + integer :: numpft = 50 ! actual # of patches (without bare), a total that spans LUs integer :: numcft = 36 ! actual # of crops logical :: crop_prog = .true. ! If prognostic crops is turned on integer :: maxpatch_urb= 5 ! max number of urban patches (columns) in urban landunit integer :: mxpft_nc ! maximum number of PFT's when use_crop=False; - integer :: maxpatch_pft ! max number of plant functional types in naturally vegetated landunit (namelist setting) + integer :: maxpatch_pft ! max number of plant functional types in naturally vegetated landunit (namelist setting: maxpft) + ! This number must be exactly matched with 'natpft' in surfdata.nc integer, parameter :: nsoilorder = 15 ! number of soil orders diff --git a/components/elm/src/main/pftvarcon.F90 b/components/elm/src/main/pftvarcon.F90 index 2e2a00f4b4e..cbd5946bb4e 100644 --- a/components/elm/src/main/pftvarcon.F90 +++ b/components/elm/src/main/pftvarcon.F90 @@ -9,11 +9,19 @@ module pftvarcon use shr_kind_mod, only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use abortutils , only : endrun - use elm_varpar , only : mxpft, numrad, ivis, inir, cft_lb, cft_ub + use elm_varpar , only : mxpft, numrad, ivis, inir use elm_varpar , only: mxpft_nc use elm_varctl , only : iulog, use_vertsoilc use elm_varpar , only : nlevdecomp_full, nsoilorder use elm_varctl , only : nu_com + !------------------------------------------------------------------------------------------- + use elm_varpar , only : crop_prog + use elm_varpar , only : natpft_size, natpft_lb, natpft_ub + use elm_varpar , only : cft_size, cft_lb, cft_ub + use elm_varpar , only : surfpft_size, surfpft_lb, surfpft_ub + use elm_varpar , only : numpft, numcft, maxpatch_pft, max_patch_per_col, maxpatch_urb + use elm_varctl , only : create_crop_landunit + !------------------------------------------------------------------------------------------- ! ! !PUBLIC TYPES: implicit none @@ -116,6 +124,7 @@ module pftvarcon real(r8), allocatable :: grpnow(:) !growth respiration parameter real(r8), allocatable :: rootprof_beta(:) !CLM rooting distribution parameter for C and N inputs [unitless] + ! add pft dependent parameters for phosphorus -X.YANG real(r8), allocatable :: leafcp(:) !leaf C:P [gC/gP] real(r8), allocatable :: lflitcp(:) !leaf litter C:P (gC/gP) @@ -303,6 +312,16 @@ module pftvarcon real(r8), allocatable :: gcbr_p(:) !effectiveness of roots in reducing rainfall-driven erosion real(r8), allocatable :: gcbr_q(:) !effectiveness of roots in reducing runoff-driven erosion + ! new pft properties, together with woody, crop, percrop, evergreen, stress_decid, season_decid, defined above, + ! are introduced to define vegetation properties. This will be well defineing a pft so that no indices needed for codes. + real(r8), allocatable :: climatezone(:) ! distributed climate zone (0 = any zone, 1 = tropical, 2 = temperate, 3 = boreal, 4 = arctic) + real(r8), allocatable :: nonvascular(:) ! nonvascular lifeform flag (0 = vascular, 1 = moss, 2 = lichen) + real(r8), allocatable :: needleleaf(:) ! needleleaf lifeform flag (0 = broadleaf, 1 = needleleaf) + real(r8), allocatable :: graminoid(:) ! graminoid lifeform flag (0 = nonvascular+woody+crop+percrop, 1 = graminoid) + real(r8), allocatable :: generic_crop(:) ! generic_crop (0 = non_crop or prognostic crop, 1 = generic crop, i.e. crop when use_crop=false) + real(r8), allocatable :: nfixer(:) ! nitrogen fixer flag (0 = inable, 1 = able to nitrogen fixation from atm. N2) + + ! ! !PUBLIC MEMBER FUNCTIONS: public :: pftconrd ! Read and initialize vegetation (PFT) constants @@ -347,6 +366,9 @@ subroutine pftconrd integer :: dimid ! netCDF dimension id integer :: npft ! number of pfts on pft-physiology file logical :: readv ! read variable in or not + logical :: PFT_DEFAULT ! pft names are default, i.e. NOT user-defined + integer :: ncft0, ncft ! crop pft index of first/last when 'create_crop_landunit' is true + integer :: noncropmax ! max non-crop pft index (to check when 'create_crop_landunit' is true) character(len=32) :: subname = 'pftconrd' ! subroutine name ! ! Expected PFT names: The names expected on the paramfile file and the order they are expected to be in. @@ -410,6 +432,24 @@ subroutine pftconrd expected_pftnames(49) = 'willow ' expected_pftnames(50) = 'irrigated_willow ' + ! read actual 'npft' from parameter file + if (masterproc) then + write(iulog,*) 'Attempting to read PFT physiological data .....' + end if + call getfil (paramfile, locfn, 0) + call ncd_pio_openfile (ncid, trim(locfn), 0) + call ncd_inqdid(ncid,'pft',dimid) + call ncd_inqdlen(ncid,dimid,npft) + + ! now 'mxpft' in 'elm_varpar' updated by npft here + mxpft = npft - 1 + mxpft_nc = npft - 1 ! when .not.use_crop, so here temporarily set and may be changed after read-through PFT-physiology + + ! NOTES: + ! In parameter file, 'npft' (mxpft) [number of pfts in parameter file] can be greater than 'maxpatch_pft' [number of pfts in surfdata file] which also set by namelist 'maxpft', + ! but cannot be less, i.e. there cannot be more pfts in the surface file than there are set of pft parameters, if running the non-crop version of model. + if (npft=1 .or. percrop(i)>=1) .and. generic_crop(i)==0) then + ! at this moment, read-in 'generic_crop' is actually 'iscft' (i.e. crop as CFT or not) + ! So must re-assign + generic_crop(i) = 1 + else + generic_crop(i) = 0 + end if + end do + end if + + ! woody=2 for shrub NOT YET ready in rest of ELM code + do i = 0, npft-1 + if (woody(i)>1) woody(i) == 1 + end do call ncd_pio_closefile(ncid) + + if ( PFT_DEFAULT ) then + ! if still reading in default PFT physiology file, + ! pft indexing will be as old way + do i = 0, mxpft if(.not. use_crop .and. i > mxpft_nc) EXIT ! exit the do loop @@ -1032,13 +1167,13 @@ subroutine pftconrd ! on non-fates columns. For now, they are incompatible, and this check is warranted (rgk 04-2017) ! avd - this should be independent of FATES because it fails for non-crop config otherwise - - if(.not. use_crop .and. i > mxpft_nc) EXIT ! exit the do loop + if(.not. use_fates)then if ( trim(adjustl(pftname(i))) /= trim(expected_pftnames(i)) )then write(iulog,*)'pftconrd: pftname is NOT what is expected, name = ', & trim(pftname(i)), ', expected name = ', trim(expected_pftnames(i)) call endrun(msg='pftconrd: bad name for pft on paramfile dataset'//errMsg(__FILE__, __LINE__)) end if + end if if ( trim(pftname(i)) == 'not_vegetated' ) noveg = i if ( trim(pftname(i)) == 'needleleaf_evergreen_temperate_tree' ) ndllf_evr_tmp_tree = i @@ -1103,12 +1238,204 @@ subroutine pftconrd nppercropmax = nwillowirrig ! last prognostic perennial crop in list end if + !------------------------------------------------------------------------------------------- + ! the following is initialized as 0 above for all PFT. + ! here the hard-coded values (or flags) for default ELM PFT physiology will be working as original + ! when not using those indexing of PFT orders anymore in other codes than here. + needleleaf(noveg+1:ndllf_dcd_brl_tree) = 1 + graminoid(nc3_arctic_grass:nc4_grass) = 1 + generic_crop(nc3crop:nc3irrig) = 1 + nfixer(nsoybean) = 1 + nfixer(nsoybeanirrig) = 1 + + climatezone(ndllf_evr_tmp_tree) = 2 + climatezone(ndllf_evr_brl_tree) = 3 + climatezone(ndllf_dcd_brl_tree) = 3 + climatezone(nbrdlf_evr_trp_tree) = 1 + climatezone(nbrdlf_evr_tmp_tree) = 2 + climatezone(nbrdlf_dcd_trp_tree) = 1 + climatezone(nbrdlf_dcd_tmp_tree) = 2 + climatezone(nbrdlf_dcd_brl_tree) = 3 + climatezone(nbrdlf_dcd_tmp_shrub)= 2 + climatezone(nbrdlf_dcd_brl_shrub)= 3 + climatezone(nc3_arctic_grass) = 4 + !------------------------------------------------------------------------------------------- + + + + ! NOT default PFT file + else + + ! not vegetated checking + noveg = -1 + + ! when user-defined PFTs, if crop included, it must be the default way: + ! cropts must be in one block and after nat-pft if 'create_crop_landunit' or 'use_crop' is true + npcropmin = -1 ! first prognostic crop + npcropmax = -1 ! last prognostic crop in list + nppercropmin = -1 ! first prognostic perennial crop + nppercropmax = -1 ! last prognostic perennial crop in list + + numcft = 0 + ncft = -1 + ncft0 = -1 + noncropmax = 0 + do i = 0, npft-1 + if (crop(i)>=1 .or. percrop(i)>=1 .or. generic_crop(i)>=1) then + numcft = numcft + 1 + + if(use_crop) then + ! if 'generic_crop' specifically defined, + ! 'crop' will not be counted into prognostic + if (crop(i)>=1 .and. generic_crop(i)==0) then + npcropmax = i + if(npcropmin<=0) npcropmin = i + end if + + ! NOTE: there is a misunderstanding in pft physiology parameter file: 'perennial crop' IS NOT 'crop', + ! but still counted into 'numcft' + if(percrop(i)==1) then + nppercropmax = i + if(nppercropmin<=0) nppercropmin = i + end if + + else + if(crop(i)>=1 .or. generic_crop(i)>=1) then + ! in case either 'crop' or 'generic_crop' or both defined when not use_crop=.true. + generic_crop(i) = 1 + else + generic_crop(i) = 0 + end if + end if + + ! + if (create_crop_landunit) then + ! make sure all crop-pft are in one block and following nat-pft SO THAT creating crop landunit is possible + ncft = ncft + 1 + if (ncft0<0) ncft0=i + end if + + ! + else if (create_crop_landunit) then + noncropmax = i + + end if + + ! need to check 'noveg' + if ( woody(i)<=0 .and. graminoid(i)<=0 .and. nonvascular(i)<=0 .and. & + generic_crop(i)<=0 .and. crop(i)<=0 .and. percrop(i)<=0) then + if (noveg>=0) then + ! not yet support multiple non-vegetated PFT + ! this also will catch error of no actual PFT if npft>1 + call endrun(msg=' ERROR: more than 1 not vegetated in physiology parameter nc file.'//errMsg(__FILE__, __LINE__)) + else + noveg = i + end if + end if + + ! + end do + + ! make sure non-generic crop indices always beyond natural-pft, even if not available - used in filterMod.F90) + if (npcropmin < 0 .and. npcropmax < 0) then + npcropmin = npft + npcropmax = npft + end if + + ! MUST re-do some constants which already set in 'elm_varpar.F90:elm_varpar_init()' + mxpft_nc = min(maxpatch_pft,npft) - 1 ! user-defined is what max. + numpft = min(maxpatch_pft,npft) - 1 ! actual # of patches (without bare) + + if (create_crop_landunit) then + if (ncft0 /= noncropmax+1) then + call endrun(msg=' ERROR: when create_crop_landunit is true, crop must be following non-crop PFT .'//errMsg(__FILE__, __LINE__)) + end if + if (ncft /= npft-1) then + call endrun(msg=' ERROR: when create_crop_landunit is true, last crop must be the last one of all PFTs .'//errMsg(__FILE__, __LINE__)) + end if + + natpft_size = (numpft + 1) - numcft ! note that numpft doesn't include bare ground -- thus we add 1 + cft_size = numcft + else + natpft_size = numpft + 1 ! note that numpft doesn't include bare ground -- thus we add 1 + cft_size = 0 + end if + natpft_lb = 0 + natpft_ub = natpft_lb + natpft_size - 1 + cft_lb = natpft_ub + 1 + cft_ub = max(cft_lb, cft_lb + cft_size - 1) ! NOTE: if cft_size is ZERO, could be issue (but so far so good) + surfpft_lb = natpft_lb + surfpft_ub = natpft_ub + surfpft_size = natpft_size + max_patch_per_col= max(numpft+1, numcft, maxpatch_urb) + + + end if ! end if 'PFT_DEFAULT' + + ! checking of pft flags' conflict + if ( .not. use_fates ) then + do i = 0, mxpft + if (i == noveg) then + if ( (nonvascular(i)+woody(i)+graminoid(i)+generic_crop(i)+crop(i)+percrop(i)) >= 1 .or. & + (needleleaf(i)+evergreen(i)+stress_decid(i)+season_decid(i)+nfixer(i)) >= 1 ) then + print *, 'ERROR: Incorrect not-vegetated PFT flags: ', i, ' ', trim(pftname(i)) + call endrun(msg=' ERROR: not_vegetated has at least one positive PFT flag '//errMsg(__FILE__, __LINE__)) + end if + + else if ( (nonvascular(i)+woody(i)+graminoid(i)+generic_crop(i)+crop(i)+percrop(i)) >= 1) then + if (nonvascular(i) >= 1 .and. (woody(i)+graminoid(i)+generic_crop(i)+crop(i)+percrop(i)) >= 1) then + print *, 'ERROR: Incorrect nonvasculr PFT flags: ', i, ' ', trim(pftname(i)) + call endrun(msg=' ERROR: nonvascular PFT cannot be any of woody/graminoid/crop type '//errMsg(__FILE__, __LINE__)) + else if (woody(i) >= 1 .and. (nonvascular(i)+graminoid(i)+generic_crop(i)+crop(i)+percrop(i)) >= 1) then + print *, 'ERROR: Incorrect woody PFT flags: ', i, ' ', trim(pftname(i)) + call endrun(msg=' ERROR: woody PFT cannot be any of nonvascular/graminoid/crop type - '//errMsg(__FILE__, __LINE__)) + else if (graminoid(i) >= 1 .and. (nonvascular(i)+woody(i)+generic_crop(i)+crop(i)+percrop(i)) >=1 ) then + print *, 'ERROR: Incorrect graminoid PFT flags: ', i, ' ', trim(pftname(i)) + call endrun(msg=' ERROR: graminoid PFT cannot be any of nonvascular/woody/crop type - '//errMsg(__FILE__, __LINE__)) + else if ( (generic_crop(i)+crop(i)+percrop(i)) >= 1 .and. (nonvascular(i)+woody(i)+graminoid(i)) >= 1) then + print *, 'ERROR: Incorrect crop PFT flags: ', i, ' ', trim(pftname(i)) + call endrun(msg=' ERROR: crop PFT cannot be any of nonvascular/woody/graminoid type - '//errMsg(__FILE__, __LINE__)) + end if + + if( (stress_decid(i)*season_decid(i)) >= 1 ) then + print *, 'ERROR: Incorrect stress_decid or season_decid flags: ', i, ' ', trim(pftname(i)) + call endrun(msg=' ERROR: stress_decid AND season_decid cannot be both 1 - '//errMsg(__FILE__, __LINE__)) + elseif( (evergreen(i)*(stress_decid(i)+season_decid(i)) ) >= 1 ) then + print *, 'ERROR: Incorrect evergreen AND season_/stress_decid flags: ', i, ' ', trim(pftname(i)) + call endrun(msg=' ERROR: evergreen AND (stress_decid OR season_decid) cannot be both 1 - '//errMsg(__FILE__, __LINE__)) + end if + + else + + call endrun(msg=' ERROR: not_vegetated AND none of vegetation type for PFT - '//errMsg(__FILE__, __LINE__)) + + end if + + end do + end if + + ! information + if (masterproc) then + write(iulog,*) + write(iulog,*) 'Using PFT physiological parameters from: ', paramfile + write(iulog,*) ' -- index -- name -- climate zone -- -- woody -- -- needleleaf -- -- evergreen -- -- stress_decid -- -- season_decid -- -- graminoid-- -- generic_crop -- -- crop -- -- perennial crop -- -- nfixer --' + do i = 0, npft-1 + write(iulog,*) i, pftname(i), int(climatezone(i)), int(woody(i)), int(needleleaf(i)), & + int(evergreen(i)), int(stress_decid(i)), int(season_decid(i)), & + int(graminoid(i)), int(generic_crop(i)), int(crop(i)), int(percrop(i)), int(nfixer(i)) + end do + write(iulog,*) + end if + + + !------------------------------------------------------------------------------------------- + call set_is_pft_known_to_model() - call set_num_cfts_known_to_model() + if (cft_size>0) call set_num_cfts_known_to_model() if( .not. use_fates ) then if( .not. use_crop) then - if ( npcropmax /= mxpft_nc )then + if ( npcropmax /= mxpft_nc .and. crop_prog)then call endrun(msg=' ERROR: npcropmax is NOT the last value'//errMsg(__FILE__, __LINE__)) end if else @@ -1118,6 +1445,7 @@ subroutine pftconrd end if do i = 0, mxpft if(.not. use_crop .and. i > mxpft_nc) EXIT ! exit the do loop + if(.not.PFT_DEFAULT) EXIT ! no checking of indexing PFTs for user-defined if( .not. use_crop) then if ( irrigated(i) == 1.0_r8 .and. (i == nc3irrig .or. & i == ncornirrig .or. & From a8b486bc426d5f69971230ed8312fdb45b97c489 Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Tue, 31 Oct 2023 14:41:12 -0400 Subject: [PATCH 114/197] Distinguish woody types between tree (1) and shrub (2). --- .../elm/src/biogeochem/AllocationMod.F90 | 26 +++++++-------- .../src/biogeochem/CNAllocationBetrMod.F90 | 22 ++++++------- .../elm/src/biogeochem/CNCarbonStateType.F90 | 2 +- .../src/biogeochem/CNNStateUpdate1BeTRMod.F90 | 8 ++--- .../src/biogeochem/CNNitrogenStateType.F90 | 2 +- .../elm/src/biogeochem/CNPhenologyBeTRMod.F90 | 32 +++++++++---------- .../src/biogeochem/CarbonStateUpdate1Mod.F90 | 18 +++++------ .../elm/src/biogeochem/ComputeSeedMod.F90 | 2 +- .../elm/src/biogeochem/GrowthRespMod.F90 | 2 +- .../elm/src/biogeochem/MaintenanceRespMod.F90 | 2 +- .../biogeochem/NitrogenStateUpdate1Mod.F90 | 8 ++--- .../src/biogeochem/PhenologyFluxLimitMod.F90 | 22 ++++++------- .../elm/src/biogeochem/PhenologyMod.F90 | 32 +++++++++---------- .../biogeochem/PhosphorusStateUpdate1Mod.F90 | 8 ++--- .../elm/src/biogeochem/VegStructUpdateMod.F90 | 2 +- .../elm/src/data_types/VegetationDataType.F90 | 6 ++-- .../data_types/VegetationPropertiesType.F90 | 17 +++++----- components/elm/src/main/pftvarcon.F90 | 11 +++---- 18 files changed, 111 insertions(+), 111 deletions(-) diff --git a/components/elm/src/biogeochem/AllocationMod.F90 b/components/elm/src/biogeochem/AllocationMod.F90 index 2795fd42c8e..a31a07cd8f6 100644 --- a/components/elm/src/biogeochem/AllocationMod.F90 +++ b/components/elm/src/biogeochem/AllocationMod.F90 @@ -583,7 +583,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp ! These fluxes should already be in gC/m2/s mr = leaf_mr(p) + froot_mr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) else if (ivt(p) >= npcropmin) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) @@ -815,7 +815,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp ! determine N requirements ! determine P requirements -X. YANG - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then c_allometry(p) = (1._r8+g1)*(1._r8+f1+f3*(1._r8+f2)) n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & (f3*(1._r8-f4)*(1._r8+f2))/cndw @@ -2372,7 +2372,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & endif mr = leaf_mr(p) + froot_mr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) else if (ivt(p) >= npcropmin) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) @@ -2466,7 +2466,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & plant_calloc(p) = availc(p) ! here no down-regulation on allocatable C here, NP limitation is implemented in leaf-level NP control on GPP - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then c_allometry(p) = (1._r8+g1)*(1._r8+f1+f3*(1._r8+f2)) n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & (f3*(1._r8-f4)*(1._r8+f2))/cndw @@ -2549,7 +2549,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * (1._r8 - fcur) * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f1 * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f1 * (1._r8 - fcur) * (1 + g1) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * (1._r8 - fcur) * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * (1._r8 - f4) * fcur * (1 + g1) @@ -2580,7 +2580,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_leafc_storage(p) = nlc * (1._r8 - fcur) cpool_to_frootc(p) = nlc * f1 * fcur cpool_to_frootc_storage(p) = nlc * f1 * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then cpool_to_livestemc(p) = nlc * f3 * f4 * fcur cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur @@ -2633,7 +2633,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_leafn_storage(p) = (nlc / cnl) * (1._r8 - fcur) npool_to_frootn(p) = (nlc * f1 / cnfr) * fcur npool_to_frootn_storage(p) = (nlc * f1 / cnfr) * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) npool_to_deadstemn(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur @@ -2677,7 +2677,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_leafp_storage(p) = (nlc / cpl) * (1._r8 - fcur) ppool_to_frootp(p) = (nlc * f1 / cpfr) * fcur ppool_to_frootp_storage(p) = (nlc * f1 / cpfr) * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then ppool_to_livestemp(p) = (nlc * f3 * f4 / cplw) * fcur ppool_to_livestemp_storage(p) = (nlc * f3 * f4 / cplw) * (1._r8 -fcur) ppool_to_deadstemp(p) = (nlc * f3 * (1._r8 - f4) / cpdw) *fcur @@ -2711,7 +2711,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ! growth is assigned here. gresp_storage = cpool_to_leafc_storage(p) + cpool_to_frootc_storage(p) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) gresp_storage = gresp_storage + cpool_to_deadstemc_storage(p) gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) @@ -2748,7 +2748,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_frootn(p) = cpool_to_frootc(p) / cnfr npool_to_frootn_storage(p) = cpool_to_frootc_storage(p) / cnfr - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then supplement_to_plantn(p) = supplement_to_plantn(p) + cpool_to_livestemc(p) / cnlw - npool_to_livestemn(p) supplement_to_plantn(p) = supplement_to_plantn(p) + cpool_to_livestemc_storage(p) / cnlw & - npool_to_livestemn_storage(p) @@ -2815,7 +2815,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_frootp(p) = cpool_to_frootc(p) / cpfr ppool_to_frootp_storage(p) = cpool_to_frootc_storage(p) / cpfr - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then supplement_to_plantp(p) = supplement_to_plantp(p) + max(cpool_to_livestemc(p) / cplw & - ppool_to_livestemp(p),0._r8) @@ -3891,7 +3891,7 @@ subroutine dynamic_plant_alloc( nutrient_scalar, water_scalar, laindex, alloc_le alloc_froot = min(alloc_froot, 0.4_r8) ! stem allocation - if (woody == 1.0_r8) then + if (woody >= 1.0_r8) then alloc_stem = alloc_s0 * 3.0_r8 * min(nu_scalar,w_scalar) / (2.0_r8 * light_scalar + min(nu_scalar,w_scalar)) else alloc_stem = 0.0_r8 @@ -3908,7 +3908,7 @@ subroutine dynamic_plant_alloc( nutrient_scalar, water_scalar, laindex, alloc_le ! if lai greater than laimax then no allocation to leaf; leaf allocation goes to stem or fine root if (laindex > laimax) then - if (woody == 1.0_r8) then + if (woody >= 1.0_r8) then alloc_stem = alloc_stem + alloc_leaf/2._r8 - 0.005_r8 alloc_froot = alloc_froot + alloc_leaf/2._r8 - 0.005_r8 else diff --git a/components/elm/src/biogeochem/CNAllocationBetrMod.F90 b/components/elm/src/biogeochem/CNAllocationBetrMod.F90 index 9701eebda60..42fad84a9d1 100644 --- a/components/elm/src/biogeochem/CNAllocationBetrMod.F90 +++ b/components/elm/src/biogeochem/CNAllocationBetrMod.F90 @@ -643,7 +643,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp ! These fluxes should already be in gC/m2/s mr = leaf_mr(p) + froot_mr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) else if (ivt(p) >= npcropmin) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) @@ -852,7 +852,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp ! based on available C, use constant allometric relationships to ! determine N requirements - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then c_allometry(p) = (1._r8+g1)*(1._r8+f1+f3*(1._r8+f2)) n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & (f3*(1._r8-f4)*(1._r8+f2))/cndw @@ -1434,7 +1434,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & plant_palloc(p) = sminp_to_ppool(p) + retransp_to_ppool(p) mr = leaf_mr(p) + froot_mr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) else if (ivt(p) >= npcropmin) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) @@ -1523,7 +1523,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & plant_calloc(p) = availc(p) ! here no down-regulation on allocatable C here, NP limitation is implemented in leaf-level NP control on GPP - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then c_allometry(p) = (1._r8+g1)*(1._r8+f1+f3*(1._r8+f2)) n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & (f3*(1._r8-f4)*(1._r8+f2))/cndw @@ -1604,7 +1604,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * (1._r8 - fcur) * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f1 * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f1 * (1._r8 - fcur) * (1 + g1) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * (1._r8 - fcur) * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * (1._r8 - f4) * fcur * (1 + g1) @@ -1635,7 +1635,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_leafc_storage(p) = nlc * (1._r8 - fcur) cpool_to_frootc(p) = nlc * f1 * fcur cpool_to_frootc_storage(p) = nlc * f1 * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then cpool_to_livestemc(p) = nlc * f3 * f4 * fcur cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur @@ -1688,7 +1688,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_leafn_storage(p) = (nlc / cnl) * (1._r8 - fcur) npool_to_frootn(p) = (nlc * f1 / cnfr) * fcur npool_to_frootn_storage(p) = (nlc * f1 / cnfr) * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) npool_to_deadstemn(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur @@ -1732,7 +1732,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_leafp_storage(p) = (nlc / cpl) * (1._r8 - fcur) ppool_to_frootp(p) = (nlc * f1 / cpfr) * fcur ppool_to_frootp_storage(p) = (nlc * f1 / cpfr) * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then ppool_to_livestemp(p) = (nlc * f3 * f4 / cplw) * fcur ppool_to_livestemp_storage(p) = (nlc * f3 * f4 / cplw) * (1._r8 -fcur) ppool_to_deadstemp(p) = (nlc * f3 * (1._r8 - f4) / cpdw) *fcur @@ -1766,7 +1766,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ! growth is assigned here. gresp_storage = cpool_to_leafc_storage(p) + cpool_to_frootc_storage(p) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) gresp_storage = gresp_storage + cpool_to_deadstemc_storage(p) gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) @@ -1797,7 +1797,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_frootn(p) = cpool_to_frootc(p) / cnfr npool_to_frootn_storage(p) = cpool_to_frootc_storage(p) / cnfr - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then supplement_to_sminn_vr(c,1) = supplement_to_sminn_vr(c,1) + cpool_to_livestemc(p) / cnlw - npool_to_livestemn(p) supplement_to_sminn_vr(c,1) = supplement_to_sminn_vr(c,1) + cpool_to_livestemc_storage(p) / cnlw & - npool_to_livestemn_storage(p) @@ -1864,7 +1864,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_frootp(p) = cpool_to_frootc(p) / cpfr ppool_to_frootp_storage(p) = cpool_to_frootc_storage(p) / cpfr - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then supplement_to_sminp_vr(c,1) = supplement_to_sminp_vr(c,1) + max(cpool_to_livestemc(p) / cplw & - ppool_to_livestemp(p),0._r8) supplement_to_sminp_vr(c,1) = supplement_to_sminp_vr(c,1) + max(cpool_to_livestemc_storage(p) / cplw & diff --git a/components/elm/src/biogeochem/CNCarbonStateType.F90 b/components/elm/src/biogeochem/CNCarbonStateType.F90 index 2ed04f03231..8f258bbb6a9 100644 --- a/components/elm/src/biogeochem/CNCarbonStateType.F90 +++ b/components/elm/src/biogeochem/CNCarbonStateType.F90 @@ -477,7 +477,7 @@ subroutine InitCold(this, bounds, ratio, c12_carbonstate_vars) this%livestemc_storage_patch(p) = 0._r8 this%livestemc_xfer_patch(p) = 0._r8 - if (veg_vp%woody(veg_pp%itype(p)) == 1._r8) then + if (veg_vp%woody(veg_pp%itype(p)) >= 1.0_r8) then this%deadstemc_patch(p) = 0.1_r8 * ratio else this%deadstemc_patch(p) = 0._r8 diff --git a/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 b/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 index 6eee5f923da..95d884de490 100644 --- a/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 +++ b/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 @@ -90,7 +90,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%frootn(p) = veg_ns%frootn(p) + veg_nf%frootn_xfer_to_frootn(p)*dt veg_ns%frootn_xfer(p) = veg_ns%frootn_xfer(p) - veg_nf%frootn_xfer_to_frootn(p)*dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) - veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%deadstemn(p) = veg_ns%deadstemn(p) + veg_nf%deadstemn_xfer_to_deadstemn(p)*dt @@ -116,7 +116,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%leafn_to_retransn(p)*dt ! live wood turnover and retranslocation fluxes - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_deadstemn(p)*dt veg_ns%deadstemn(p) = veg_ns%deadstemn(p) + veg_nf%livestemn_to_deadstemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_retransn(p)*dt @@ -153,7 +153,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_frootn_storage(p)*dt veg_ns%frootn_storage(p) = veg_ns%frootn_storage(p) + veg_nf%npool_to_frootn_storage(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%npool_to_livestemn(p)*dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn_storage(p)*dt @@ -189,7 +189,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%frootn_storage(p) = veg_ns%frootn_storage(p) - veg_nf%frootn_storage_to_xfer(p)*dt veg_ns%frootn_xfer(p) = veg_ns%frootn_xfer(p) + veg_nf%frootn_storage_to_xfer(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ns%livestemn_storage(p) = veg_ns%livestemn_storage(p) - veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) + veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%deadstemn_storage(p) = veg_ns%deadstemn_storage(p) - veg_nf%deadstemn_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/CNNitrogenStateType.F90 b/components/elm/src/biogeochem/CNNitrogenStateType.F90 index 003e34e132d..dda6477899a 100644 --- a/components/elm/src/biogeochem/CNNitrogenStateType.F90 +++ b/components/elm/src/biogeochem/CNNitrogenStateType.F90 @@ -588,7 +588,7 @@ subroutine InitCold(this, bounds, & ! tree types need to be initialized with some stem mass so that ! roughness length is not zero in canopy flux calculation - if (veg_vp%woody(veg_pp%itype(p)) == 1._r8) then + if (veg_vp%woody(veg_pp%itype(p)) >= 1.0_r8) then this%deadstemn_patch(p) = deadstemc_patch(p) / veg_vp%deadwdcn(veg_pp%itype(p)) else this%deadstemn_patch(p) = 0._r8 diff --git a/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 b/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 index 4bc23896427..23f461ad305 100644 --- a/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 +++ b/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 @@ -693,7 +693,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & frootn_xfer_to_frootn(p) = 0.0_r8 leafp_xfer_to_leafp(p) = 0.0_r8 frootp_xfer_to_frootp(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer_to_livestemc(p) = 0.0_r8 deadstemc_xfer_to_deadstemc(p) = 0.0_r8 livecrootc_xfer_to_livecrootc(p) = 0.0_r8 @@ -714,7 +714,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & frootc_xfer(p) = 0.0_r8 frootn_xfer(p) = 0.0_r8 frootp_xfer(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer(p) = 0.0_r8 livestemn_xfer(p) = 0.0_r8 livestemp_xfer(p) = 0.0_r8 @@ -777,7 +777,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! set carbon fluxes for shifting storage pools to transfer pools leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt @@ -788,7 +788,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! set nitrogen fluxes for shifting storage pools to transfer pools leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt @@ -798,7 +798,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! set phosphorus fluxes for shifting storage pools to transfer pools leafp_storage_to_xfer(p) = fstor2tran * leafp_storage(p)/dt frootp_storage_to_xfer(p) = fstor2tran * frootp_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemp_storage_to_xfer(p) = fstor2tran * livestemp_storage(p)/dt deadstemp_storage_to_xfer(p) = fstor2tran * deadstemp_storage(p)/dt livecrootp_storage_to_xfer(p) = fstor2tran * livecrootp_storage(p)/dt @@ -1040,7 +1040,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & frootn_xfer_to_frootn(p) = 0._r8 leafp_xfer_to_leafp(p) = 0._r8 frootp_xfer_to_frootp(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer_to_livestemc(p) = 0._r8 deadstemc_xfer_to_deadstemc(p) = 0._r8 livecrootc_xfer_to_livecrootc(p) = 0._r8 @@ -1061,7 +1061,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & frootc_xfer(p) = 0._r8 frootn_xfer(p) = 0._r8 frootp_xfer(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer(p) = 0._r8 livestemn_xfer(p) = 0._r8 livestemp_xfer(p) = 0._r8 @@ -1148,7 +1148,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set carbon fluxes for shifting storage pools to transfer pools leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt @@ -1159,7 +1159,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set nitrogen fluxes for shifting storage pools to transfer pools leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt @@ -1169,7 +1169,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set phosphorus fluxes for shifting storage pools to transfer pools leafp_storage_to_xfer(p) = fstor2tran * leafp_storage(p)/dt frootp_storage_to_xfer(p) = fstor2tran * frootp_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemp_storage_to_xfer(p) = fstor2tran * livestemp_storage(p)/dt deadstemp_storage_to_xfer(p) = fstor2tran * deadstemp_storage(p)/dt livecrootp_storage_to_xfer(p) = fstor2tran * livecrootp_storage(p)/dt @@ -1268,7 +1268,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & leafc_storage_to_xfer(p) = leafc_storage(p) * bgtr(p) frootc_storage_to_xfer(p) = frootc_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_storage_to_xfer(p) = livestemc_storage(p) * bgtr(p) deadstemc_storage_to_xfer(p) = deadstemc_storage(p) * bgtr(p) livecrootc_storage_to_xfer(p) = livecrootc_storage(p) * bgtr(p) @@ -1279,7 +1279,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set nitrogen fluxes for shifting storage pools to transfer pools leafn_storage_to_xfer(p) = leafn_storage(p) * bgtr(p) frootn_storage_to_xfer(p) = frootn_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemn_storage_to_xfer(p) = livestemn_storage(p) * bgtr(p) deadstemn_storage_to_xfer(p) = deadstemn_storage(p) * bgtr(p) livecrootn_storage_to_xfer(p) = livecrootn_storage(p) * bgtr(p) @@ -1290,7 +1290,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set phosphorus fluxes for shifting storage pools to transfer pools leafp_storage_to_xfer(p) = leafp_storage(p) * bgtr(p) frootp_storage_to_xfer(p) = frootp_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemp_storage_to_xfer(p) = livestemp_storage(p) * bgtr(p) deadstemp_storage_to_xfer(p) = deadstemp_storage(p) * bgtr(p) livecrootp_storage_to_xfer(p) = livecrootp_storage(p) * bgtr(p) @@ -2362,7 +2362,7 @@ subroutine CNOnsetGrowth (num_soilp, filter_soilp, & frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) leafp_xfer_to_leafp(p) = t1 * leafp_xfer(p) frootp_xfer_to_frootp(p) = t1 * frootp_xfer(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) @@ -2391,7 +2391,7 @@ subroutine CNOnsetGrowth (num_soilp, filter_soilp, & frootn_xfer_to_frootn(p) = frootn_xfer(p) / dt leafp_xfer_to_leafp(p) = leafp_xfer(p) / dt frootp_xfer_to_frootp(p) = frootp_xfer(p) / dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer_to_livestemc(p) = livestemc_xfer(p) / dt deadstemc_xfer_to_deadstemc(p) = deadstemc_xfer(p) / dt livecrootc_xfer_to_livecrootc(p) = livecrootc_xfer(p) / dt @@ -2909,7 +2909,7 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & p = filter_soilp(fp) ! only calculate these fluxes for woody types - if (woody(ivt(p)) > 0._r8) then + if (woody(ivt(p)) >= 1.0_r8) then if ( nu_com .eq. 'RD') then ! live stem to dead stem turnover diff --git a/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 b/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 index 057fd0e56b6..a371a44c537 100644 --- a/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 @@ -274,7 +274,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%leafc_xfer(p) = veg_cs%leafc_xfer(p) - veg_cf%leafc_xfer_to_leafc(p)*dt veg_cs%frootc(p) = veg_cs%frootc(p) + veg_cf%frootc_xfer_to_frootc(p)*dt veg_cs%frootc_xfer(p) = veg_cs%frootc_xfer(p) - veg_cf%frootc_xfer_to_frootc(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%livestemc_xfer_to_livestemc(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) - veg_cf%livestemc_xfer_to_livestemc(p)*dt veg_cs%deadstemc(p) = veg_cs%deadstemc(p) + veg_cf%deadstemc_xfer_to_deadstemc(p)*dt @@ -297,7 +297,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%frootc(p) = veg_cs%frootc(p) - veg_cf%frootc_to_litter(p)*dt ! livewood turnover fluxes - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%livestemc(p) = veg_cs%livestemc(p) - veg_cf%livestemc_to_deadstemc(p)*dt veg_cs%deadstemc(p) = veg_cs%deadstemc(p) + veg_cf%livestemc_to_deadstemc(p)*dt veg_cs%livecrootc(p) = veg_cs%livecrootc(p) - veg_cf%livecrootc_to_deadcrootc(p)*dt @@ -315,7 +315,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_xsmrpool(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%leaf_curmr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%froot_curmr(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livestem_curmr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livecroot_curmr(p)*dt end if @@ -333,7 +333,7 @@ subroutine CarbonStateUpdate1(bounds, & if (nu_com .ne. 'RD') then veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%xsmrpool_turnover(p)*dt end if - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livestem_xsmr(p)*dt veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livecroot_xsmr(p)*dt end if @@ -355,7 +355,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%frootc(p) = veg_cs%frootc(p) + veg_cf%cpool_to_frootc(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_frootc_storage(p)*dt veg_cs%frootc_storage(p) = veg_cs%frootc_storage(p) + veg_cf%cpool_to_frootc_storage(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_livestemc(p)*dt veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%cpool_to_livestemc(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_livestemc_storage(p)*dt @@ -387,7 +387,7 @@ subroutine CarbonStateUpdate1(bounds, & ! growth respiration fluxes for current growth veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_leaf_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_froot_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livestem_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_deadstem_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livecroot_gr(p)*dt @@ -401,7 +401,7 @@ subroutine CarbonStateUpdate1(bounds, & ! growth respiration for transfer growth veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_leaf_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_froot_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_livestem_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_deadstem_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_livecroot_gr(p)*dt @@ -415,7 +415,7 @@ subroutine CarbonStateUpdate1(bounds, & ! growth respiration at time of storage veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_leaf_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_froot_storage_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livestem_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_deadstem_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livecroot_storage_gr(p)*dt @@ -435,7 +435,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%leafc_xfer(p) = veg_cs%leafc_xfer(p) + veg_cf%leafc_storage_to_xfer(p)*dt veg_cs%frootc_storage(p) = veg_cs%frootc_storage(p) - veg_cf%frootc_storage_to_xfer(p)*dt veg_cs%frootc_xfer(p) = veg_cs%frootc_xfer(p) + veg_cf%frootc_storage_to_xfer(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%livestemc_storage(p) = veg_cs%livestemc_storage(p) - veg_cf%livestemc_storage_to_xfer(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) + veg_cf%livestemc_storage_to_xfer(p)*dt veg_cs%deadstemc_storage(p) = veg_cs%deadstemc_storage(p) - veg_cf%deadstemc_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/ComputeSeedMod.F90 b/components/elm/src/biogeochem/ComputeSeedMod.F90 index 61b916d64f3..9b7ebf8838d 100644 --- a/components/elm/src/biogeochem/ComputeSeedMod.F90 +++ b/components/elm/src/biogeochem/ComputeSeedMod.F90 @@ -124,7 +124,7 @@ subroutine ComputeSeedAmounts(p, & if (pft_type /= noveg) then my_leaf_seed = leafc_seed_param * & SpeciesTypeMultiplier(species, pft_type, COMPONENT_LEAF) - if (veg_vp%woody(pft_type) == 1._r8) then + if (veg_vp%woody(pft_type) >= 1.0_r8) then my_deadstem_seed = deadstemc_seed_param * & SpeciesTypeMultiplier(species, pft_type, COMPONENT_DEADWOOD) end if diff --git a/components/elm/src/biogeochem/GrowthRespMod.F90 b/components/elm/src/biogeochem/GrowthRespMod.F90 index f499dedb2e0..a5002d108e5 100644 --- a/components/elm/src/biogeochem/GrowthRespMod.F90 +++ b/components/elm/src/biogeochem/GrowthRespMod.F90 @@ -133,7 +133,7 @@ subroutine GrowthResp(num_soilp, filter_soilp) transfer_froot_gr(p) = frootc_xfer_to_frootc(p) * grperc(ivt(p)) * & (1._r8 - grpnow(ivt(p))) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then cpool_livestem_gr(p) = cpool_to_livestemc(p) * grperc(ivt(p)) cpool_livestem_storage_gr(p) = cpool_to_livestemc_storage(p) * & grperc(ivt(p)) * grpnow(ivt(p)) diff --git a/components/elm/src/biogeochem/MaintenanceRespMod.F90 b/components/elm/src/biogeochem/MaintenanceRespMod.F90 index ef83ca92ff6..eab60926ab6 100644 --- a/components/elm/src/biogeochem/MaintenanceRespMod.F90 +++ b/components/elm/src/biogeochem/MaintenanceRespMod.F90 @@ -182,7 +182,7 @@ subroutine MaintenanceResp(bounds, & end if - if (woody(ivt(p)) == 1) then + if (woody(ivt(p)) >= 1.0_r8) then livestem_mr(p) = livestemn(p)*br_mr*tc livecroot_mr(p) = livecrootn(p)*br_mr*tc else if (ivt(p) >= npcropmin .and. livestemn(p) .gt. 0._r8) then diff --git a/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 b/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 index 1eefadd7bea..14d834245f5 100644 --- a/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 @@ -286,7 +286,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%frootn(p) = veg_ns%frootn(p) + veg_nf%frootn_xfer_to_frootn(p)*dt veg_ns%frootn_xfer(p) = veg_ns%frootn_xfer(p) - veg_nf%frootn_xfer_to_frootn(p)*dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) - veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%deadstemn(p) = veg_ns%deadstemn(p) + veg_nf%deadstemn_xfer_to_deadstemn(p)*dt @@ -312,7 +312,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%leafn_to_retransn(p)*dt ! live wood turnover and retranslocation fluxes - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_deadstemn(p)*dt veg_ns%deadstemn(p) = veg_ns%deadstemn(p) + veg_nf%livestemn_to_deadstemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_retransn(p)*dt @@ -354,7 +354,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_frootn_storage(p)*dt veg_ns%frootn_storage(p) = veg_ns%frootn_storage(p) + veg_nf%npool_to_frootn_storage(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%npool_to_livestemn(p)*dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn_storage(p)*dt @@ -390,7 +390,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%frootn_storage(p) = veg_ns%frootn_storage(p) - veg_nf%frootn_storage_to_xfer(p)*dt veg_ns%frootn_xfer(p) = veg_ns%frootn_xfer(p) + veg_nf%frootn_storage_to_xfer(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ns%livestemn_storage(p) = veg_ns%livestemn_storage(p) - veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) + veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%deadstemn_storage(p) = veg_ns%deadstemn_storage(p) - veg_nf%deadstemn_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 b/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 index b6d05460c0b..786efbe6323 100644 --- a/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 +++ b/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 @@ -630,7 +630,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_frootc) = veg_cs%frootc(p) ystates(s_frootc_xfer) = veg_cs%frootc_xfer(p) ystates(s_frootc_storage) = veg_cs%frootc_storage(p) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then ystates(s_livestemc) = veg_cs%livestemc(p) ystates(s_livestemc_xfer) = veg_cs%livestemc_xfer(p) ystates(s_livestemc_storage) = veg_cs%livestemc_storage(p) @@ -662,7 +662,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& + veg_cf%cpool_froot_gr(p) & + veg_cf%cpool_leaf_storage_gr(p) & + veg_cf%cpool_froot_storage_gr(p) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then ar_p = ar_p & + veg_cf%livestem_curmr(p) & + veg_cf%livecroot_curmr(p) & @@ -692,7 +692,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_cpool_to_xsmrpool) = veg_cf%cpool_to_xsmrpool(p) rfluxes(f_cpool_to_gresp_storage) = veg_cf%cpool_to_gresp_storage(p) rfluxes(f_cpool_to_ar) = ar_p - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then rfluxes(f_cpool_to_livestemc) = veg_cf%cpool_to_livestemc(p) rfluxes(f_cpool_to_livestemc_storage) = veg_cf%cpool_to_livestemc_storage(p) rfluxes(f_cpool_to_deadstemc) = veg_cf%cpool_to_deadstemc(p) @@ -746,7 +746,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_cpool_to_xsmrpool) , veg_cf%cpool_to_xsmrpool(p)) call fpmax(rfluxes(f_cpool_to_gresp_storage) , veg_cf%cpool_to_gresp_storage(p)) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then call fpmax(rfluxes(f_cpool_to_livestemc) , veg_cf%cpool_to_livestemc(p)) call fpmax(rfluxes(f_cpool_to_livestemc_storage) , veg_cf%cpool_to_livestemc_storage(p)) call fpmax(rfluxes(f_cpool_to_deadstemc) , veg_cf%cpool_to_deadstemc(p)) @@ -794,7 +794,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& call ascal(veg_cf%cpool_froot_gr(p) , rscal) call ascal(veg_cf%cpool_leaf_storage_gr(p) , rscal) call ascal(veg_cf%cpool_froot_storage_gr(p) , rscal) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then call ascal(veg_cf%livestem_curmr(p) , rscal) call ascal(veg_cf%livecroot_curmr(p) , rscal) call ascal(veg_cf%cpool_livestem_gr(p) , rscal) @@ -864,7 +864,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_frootn) = veg_ns%frootn(p) ystates(s_frootn_xfer) = veg_ns%frootn_xfer(p) ystates(s_frootn_storage) = veg_ns%frootn_storage(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then ystates(s_livestemn) = veg_ns%livestemn(p) ystates(s_livestemn_xfer) = veg_ns%livestemn_xfer(p) ystates(s_livestemn_storage) = veg_ns%livestemn_storage(p) @@ -894,7 +894,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_npool_to_leafn_storage) = veg_nf%npool_to_leafn_storage(p) rfluxes(f_npool_to_frootn) = veg_nf%npool_to_frootn(p) rfluxes(f_npool_to_frootn_storage) = veg_nf%npool_to_frootn_storage(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then rfluxes(f_npool_to_livestemn) = veg_nf%npool_to_livestemn(p) rfluxes(f_npool_to_livestemn_storage) = veg_nf%npool_to_livestemn_storage(p) rfluxes(f_npool_to_livecrootn) = veg_nf%npool_to_livecrootn(p) @@ -950,7 +950,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_npool_to_leafn_storage) , veg_nf%npool_to_leafn_storage(p)) call fpmax(rfluxes(f_npool_to_frootn) , veg_nf%npool_to_frootn(p)) call fpmax(rfluxes(f_npool_to_frootn_storage) , veg_nf%npool_to_frootn_storage(p)) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then call fpmax(rfluxes(f_npool_to_livestemn) , veg_nf%npool_to_livestemn(p)) call fpmax(rfluxes(f_npool_to_livestemn_storage) , veg_nf%npool_to_livestemn_storage(p)) call fpmax(rfluxes(f_npool_to_livecrootn) , veg_nf%npool_to_livecrootn(p)) @@ -1049,7 +1049,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_frootn) = veg_ps%frootp(p) ystates(s_frootn_xfer) = veg_ps%frootp_xfer(p) ystates(s_frootn_storage) = veg_ps%frootp_storage(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then ystates(s_livestemn) = veg_ps%livestemp(p) ystates(s_livestemn_xfer) = veg_ps%livestemp_xfer(p) ystates(s_livestemn_storage) = veg_ps%livestemp_storage(p) @@ -1079,7 +1079,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_npool_to_leafn_storage) = veg_pf%ppool_to_leafp_storage(p) rfluxes(f_npool_to_frootn) = veg_pf%ppool_to_frootp(p) rfluxes(f_npool_to_frootn_storage) = veg_pf%ppool_to_frootp_storage(p) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then rfluxes(f_npool_to_livestemn) = veg_pf%ppool_to_livestemp(p) rfluxes(f_npool_to_livestemn_storage) = veg_pf%ppool_to_livestemp_storage(p) rfluxes(f_npool_to_livecrootn) = veg_pf%ppool_to_livecrootp(p) @@ -1135,7 +1135,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_npool_to_leafn_storage) , veg_pf%ppool_to_leafp_storage(p)) call fpmax(rfluxes(f_npool_to_frootn) , veg_pf%ppool_to_frootp(p)) call fpmax(rfluxes(f_npool_to_frootn_storage) , veg_pf%ppool_to_frootp_storage(p)) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then call fpmax(rfluxes(f_npool_to_livestemn) , veg_pf%ppool_to_livestemp(p)) call fpmax(rfluxes(f_npool_to_livestemn_storage) , veg_pf%ppool_to_livestemp_storage(p)) call fpmax(rfluxes(f_npool_to_livecrootn) , veg_pf%ppool_to_livecrootp(p)) diff --git a/components/elm/src/biogeochem/PhenologyMod.F90 b/components/elm/src/biogeochem/PhenologyMod.F90 index 9f51301acb7..d5ddfc2f44e 100644 --- a/components/elm/src/biogeochem/PhenologyMod.F90 +++ b/components/elm/src/biogeochem/PhenologyMod.F90 @@ -771,7 +771,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp, cnstate_vars) frootn_xfer_to_frootn(p) = 0.0_r8 leafp_xfer_to_leafp(p) = 0.0_r8 frootp_xfer_to_frootp(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer_to_livestemc(p) = 0.0_r8 deadstemc_xfer_to_deadstemc(p) = 0.0_r8 livecrootc_xfer_to_livecrootc(p) = 0.0_r8 @@ -792,7 +792,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp, cnstate_vars) frootc_xfer(p) = 0.0_r8 frootn_xfer(p) = 0.0_r8 frootp_xfer(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer(p) = 0.0_r8 livestemn_xfer(p) = 0.0_r8 livestemp_xfer(p) = 0.0_r8 @@ -855,7 +855,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp, cnstate_vars) ! set carbon fluxes for shifting storage pools to transfer pools leafc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * leafc_storage(p)/dt frootc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livestemc_storage(p)/dt deadstemc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * deadstemc_storage(p)/dt livecrootc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livecrootc_storage(p)/dt @@ -866,7 +866,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp, cnstate_vars) ! set nitrogen fluxes for shifting storage pools to transfer pools leafn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * leafn_storage(p)/dt frootn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livestemn_storage(p)/dt deadstemn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * deadstemn_storage(p)/dt livecrootn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livecrootn_storage(p)/dt @@ -876,7 +876,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp, cnstate_vars) ! set phosphorus fluxes for shifting storage pools to transfer pools leafp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * leafp_storage(p)/dt frootp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * frootp_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livestemp_storage(p)/dt deadstemp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * deadstemp_storage(p)/dt livecrootp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livecrootp_storage(p)/dt @@ -1116,7 +1116,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & frootn_xfer_to_frootn(p) = 0._r8 leafp_xfer_to_leafp(p) = 0._r8 frootp_xfer_to_frootp(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer_to_livestemc(p) = 0._r8 deadstemc_xfer_to_deadstemc(p) = 0._r8 livecrootc_xfer_to_livecrootc(p) = 0._r8 @@ -1137,7 +1137,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & frootc_xfer(p) = 0._r8 frootn_xfer(p) = 0._r8 frootp_xfer(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer(p) = 0._r8 livestemn_xfer(p) = 0._r8 livestemp_xfer(p) = 0._r8 @@ -1229,7 +1229,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set carbon fluxes for shifting storage pools to transfer pools leafc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * leafc_storage(p)/dt frootc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livestemc_storage(p)/dt deadstemc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * deadstemc_storage(p)/dt livecrootc_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livecrootc_storage(p)/dt @@ -1240,7 +1240,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set nitrogen fluxes for shifting storage pools to transfer pools leafn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * leafn_storage(p)/dt frootn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livestemn_storage(p)/dt deadstemn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * deadstemn_storage(p)/dt livecrootn_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livecrootn_storage(p)/dt @@ -1250,7 +1250,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set phosphorus fluxes for shifting storage pools to transfer pools leafp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * leafp_storage(p)/dt frootp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * frootp_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livestemp_storage(p)/dt deadstemp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * deadstemp_storage(p)/dt livecrootp_storage_to_xfer(p) = PhenolParamsInst%fstor2tran * livecrootp_storage(p)/dt @@ -1352,7 +1352,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & leafc_storage_to_xfer(p) = leafc_storage(p) * bgtr(p) frootc_storage_to_xfer(p) = frootc_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_storage_to_xfer(p) = livestemc_storage(p) * bgtr(p) deadstemc_storage_to_xfer(p) = deadstemc_storage(p) * bgtr(p) livecrootc_storage_to_xfer(p) = livecrootc_storage(p) * bgtr(p) @@ -1363,7 +1363,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set nitrogen fluxes for shifting storage pools to transfer pools leafn_storage_to_xfer(p) = leafn_storage(p) * bgtr(p) frootn_storage_to_xfer(p) = frootn_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemn_storage_to_xfer(p) = livestemn_storage(p) * bgtr(p) deadstemn_storage_to_xfer(p) = deadstemn_storage(p) * bgtr(p) livecrootn_storage_to_xfer(p) = livecrootn_storage(p) * bgtr(p) @@ -1374,7 +1374,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! set phosphorus fluxes for shifting storage pools to transfer pools leafp_storage_to_xfer(p) = leafp_storage(p) * bgtr(p) frootp_storage_to_xfer(p) = frootp_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemp_storage_to_xfer(p) = livestemp_storage(p) * bgtr(p) deadstemp_storage_to_xfer(p) = deadstemp_storage(p) * bgtr(p) livecrootp_storage_to_xfer(p) = livecrootp_storage(p) * bgtr(p) @@ -2694,7 +2694,7 @@ subroutine CNOnsetGrowth (num_soilp, filter_soilp, & frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) leafp_xfer_to_leafp(p) = t1 * leafp_xfer(p) frootp_xfer_to_frootp(p) = t1 * frootp_xfer(p) - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) @@ -2723,7 +2723,7 @@ subroutine CNOnsetGrowth (num_soilp, filter_soilp, & frootn_xfer_to_frootn(p) = frootn_xfer(p) / dt leafp_xfer_to_leafp(p) = leafp_xfer(p) / dt frootp_xfer_to_frootp(p) = frootp_xfer(p) / dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then livestemc_xfer_to_livestemc(p) = livestemc_xfer(p) / dt deadstemc_xfer_to_deadstemc(p) = deadstemc_xfer(p) / dt livecrootc_xfer_to_livecrootc(p) = livecrootc_xfer(p) / dt @@ -3315,7 +3315,7 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp) p = filter_soilp(fp) ! only calculate these fluxes for woody types - if (woody(ivt(p)) > 0._r8) then + if (woody(ivt(p)) >= 1.0_r8) then if ( nu_com .eq. 'RD') then ! live stem to dead stem turnover diff --git a/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 b/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 index 63390dc419e..feea9fd86fb 100644 --- a/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 @@ -244,7 +244,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%frootp(p) = veg_ps%frootp(p) + veg_pf%frootp_xfer_to_frootp(p)*dt veg_ps%frootp_xfer(p) = veg_ps%frootp_xfer(p) - veg_pf%frootp_xfer_to_frootp(p)*dt - if (woody(ivt(p)) == 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ps%livestemp(p) = veg_ps%livestemp(p) + veg_pf%livestemp_xfer_to_livestemp(p)*dt veg_ps%livestemp_xfer(p) = veg_ps%livestemp_xfer(p) - veg_pf%livestemp_xfer_to_livestemp(p)*dt veg_ps%deadstemp(p) = veg_ps%deadstemp(p) + veg_pf%deadstemp_xfer_to_deadstemp(p)*dt @@ -270,7 +270,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%retransp(p) = veg_ps%retransp(p) + veg_pf%leafp_to_retransp(p)*dt ! live wood turnover and retranslocation fluxes - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ps%livestemp(p) = veg_ps%livestemp(p) - veg_pf%livestemp_to_deadstemp(p)*dt veg_ps%deadstemp(p) = veg_ps%deadstemp(p) + veg_pf%livestemp_to_deadstemp(p)*dt veg_ps%livestemp(p) = veg_ps%livestemp(p) - veg_pf%livestemp_to_retransp(p)*dt @@ -312,7 +312,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_frootp_storage(p)*dt veg_ps%frootp_storage(p) = veg_ps%frootp_storage(p) + veg_pf%ppool_to_frootp_storage(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_livestemp(p)*dt veg_ps%livestemp(p) = veg_ps%livestemp(p) + veg_pf%ppool_to_livestemp(p)*dt veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_livestemp_storage(p)*dt @@ -348,7 +348,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%frootp_storage(p) = veg_ps%frootp_storage(p) - veg_pf%frootp_storage_to_xfer(p)*dt veg_ps%frootp_xfer(p) = veg_ps%frootp_xfer(p) + veg_pf%frootp_storage_to_xfer(p)*dt - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_ps%livestemp_storage(p) = veg_ps%livestemp_storage(p) - veg_pf%livestemp_storage_to_xfer(p)*dt veg_ps%livestemp_xfer(p) = veg_ps%livestemp_xfer(p) + veg_pf%livestemp_storage_to_xfer(p)*dt veg_ps%deadstemp_storage(p) = veg_ps%deadstemp_storage(p) - veg_pf%deadstemp_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/VegStructUpdateMod.F90 b/components/elm/src/biogeochem/VegStructUpdateMod.F90 index 6796ab1993a..9a7db79154b 100644 --- a/components/elm/src/biogeochem/VegStructUpdateMod.F90 +++ b/components/elm/src/biogeochem/VegStructUpdateMod.F90 @@ -159,7 +159,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & tsai_min = tsai_min * 0.5_r8 tsai(p) = max(tsai_alpha*tsai_old+max(tlai_old-tlai(p),0._r8),tsai_min) - if (woody(ivt(p)) == 1._r8) then + if (woody(ivt(p)) >= 1.0_r8) then ! trees and shrubs diff --git a/components/elm/src/data_types/VegetationDataType.F90 b/components/elm/src/data_types/VegetationDataType.F90 index 45dc063b853..eea30fc55fe 100644 --- a/components/elm/src/data_types/VegetationDataType.F90 +++ b/components/elm/src/data_types/VegetationDataType.F90 @@ -2465,7 +2465,7 @@ subroutine veg_cs_init(this, begp, endp, carbon_type, ratio) this%livestemc_storage(p) = 0._r8 this%livestemc_xfer(p) = 0._r8 - if (veg_vp%woody(veg_pp%itype(p)) == 1._r8) then + if (veg_vp%woody(veg_pp%itype(p)) >= 1.0_r8) then this%deadstemc(p) = 0.1_r8 * ratio else this%deadstemc(p) = 0._r8 @@ -3937,7 +3937,7 @@ subroutine veg_ns_init(this, begp, endp, veg_cs) ! tree types need to be initialized with some stem mass so that ! roughness length is not zero in canopy flux calculation - if (veg_vp%woody(veg_pp%itype(p)) == 1._r8) then + if (veg_vp%woody(veg_pp%itype(p)) >= 1.0_r8) then this%deadstemn(p) = veg_cs%deadstemc(p) / veg_vp%deadwdcn(veg_pp%itype(p)) else this%deadstemn(p) = 0._r8 @@ -4621,7 +4621,7 @@ subroutine veg_ps_init(this, begp, endp, veg_cs) ! tree types need to be initialized with some stem mass so that ! roughness length is not zero in canopy flux calculation - if (veg_vp%woody(veg_pp%itype(p)) == 1._r8) then + if (veg_vp%woody(veg_pp%itype(p)) >= 1.0_r8) then this%deadstemp(p) = veg_cs%deadstemc(p) / veg_vp%deadwdcp(veg_pp%itype(p)) else this%deadstemp(p) = 0._r8 diff --git a/components/elm/src/data_types/VegetationPropertiesType.F90 b/components/elm/src/data_types/VegetationPropertiesType.F90 index 20547779195..2cb4e01c8a4 100644 --- a/components/elm/src/data_types/VegetationPropertiesType.F90 +++ b/components/elm/src/data_types/VegetationPropertiesType.F90 @@ -17,7 +17,7 @@ module VegetationPropertiesType ! !PUBLIC TYPES: type, public :: vegetation_properties_type integer , pointer :: noveg (:) => null() ! value for not vegetated - integer , pointer :: tree (:) => null() ! tree or not? + !integer , pointer :: tree (:) => null() ! tree or not? real(r8), pointer :: smpso (:) => null() ! soil water potential at full stomatal opening (mm) real(r8), pointer :: smpsc (:) => null() ! soil water potential at full stomatal closure (mm) real(r8), pointer :: fnitr (:) => null() ! foliage nitrogen limitation factor (-) @@ -159,7 +159,7 @@ subroutine veg_vp_init(this) ! ! !USES: use elm_varpar, only : numrad, numpft - use pftvarcon , only : ntree, smpso, smpsc, fnitr + use pftvarcon , only : smpso, smpsc, fnitr use pftvarcon , only : z0mr, displar, dleaf, rhol, rhos, taul, taus, xl use pftvarcon , only : c3psn, slatop, dsladlai, leafcn, flnr, woody use pftvarcon , only : lflitcn, frootcn, livewdcn, deadwdcn, froot_leaf, stem_leaf, croot_stem @@ -190,7 +190,7 @@ subroutine veg_vp_init(this) !------------------------------------------------------------------------ allocate(this%noveg (0:numpft)) ; this%noveg (:) =huge(1) - allocate(this%tree (0:numpft)) ; this%tree (:) =huge(1) + !allocate(this%tree (0:numpft)) ; this%tree (:) =huge(1) allocate(this%smpso (0:numpft)) ; this%smpso (:) =spval allocate(this%smpsc (0:numpft)) ; this%smpsc (:) =spval allocate(this%fnitr (0:numpft)) ; this%fnitr (:) =spval @@ -308,11 +308,12 @@ subroutine veg_vp_init(this) do m = 0,numpft - if (m <= ntree) then - this%tree(m) = 1 - else - this%tree(m) = 0 - end if + ! not needed anymore: woody(m)=1 for tree, 2 for shrub, or 0 for any other + !if (woody(m) == 1) then + ! this%tree(m) = 1 + !else + ! this%tree(m) = 0 + !end if do ib = 1,numrad this%rhol(m,ib) = rhol(m,ib) diff --git a/components/elm/src/main/pftvarcon.F90 b/components/elm/src/main/pftvarcon.F90 index cbd5946bb4e..1b06a49cf2f 100644 --- a/components/elm/src/main/pftvarcon.F90 +++ b/components/elm/src/main/pftvarcon.F90 @@ -115,7 +115,7 @@ module pftvarcon real(r8), allocatable :: dsladlai(:) !dSLA/dLAI [m^2/gC] real(r8), allocatable :: leafcn(:) !leaf C:N [gC/gN] real(r8), allocatable :: flnr(:) !fraction of leaf N in Rubisco [no units] - real(r8), allocatable :: woody(:) !woody lifeform flag (0 or 1) + real(r8), allocatable :: woody(:) !woody lifeform flag (0 = non-woody, 1 = tree, 2 = shrub) real(r8), allocatable :: lflitcn(:) !leaf litter C:N (gC/gN) real(r8), allocatable :: frootcn(:) !fine root C:N (gC/gN) real(r8), allocatable :: livewdcn(:) !live wood (phloem and ray parenchyma) C:N (gC/gN) @@ -1146,11 +1146,6 @@ subroutine pftconrd end do end if - ! woody=2 for shrub NOT YET ready in rest of ELM code - do i = 0, npft-1 - if (woody(i)>1) woody(i) == 1 - end do - call ncd_pio_closefile(ncid) @@ -1239,6 +1234,10 @@ subroutine pftconrd end if !------------------------------------------------------------------------------------------- + ! default: for tree and shrub always 1, now hard-coded as following + woody(ndllf_evr_tmp_tree:nbrdlf_dcd_brl_tree) = 1 + woody(nbrdlf_evr_shrub:nbrdlf_dcd_brl_shrub) = 2 + ! the following is initialized as 0 above for all PFT. ! here the hard-coded values (or flags) for default ELM PFT physiology will be working as original ! when not using those indexing of PFT orders anymore in other codes than here. From 475eac8d4a33bb80cefd0537e1925ee0d8a4000e Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Mon, 29 Jan 2024 12:03:52 -0500 Subject: [PATCH 115/197] avoid using hard coded PFT total number and indices in PFT physiology parameter file. --- components/elm/src/biogeochem/CH4Mod.F90 | 5 +- .../src/biogeochem/CNNStateUpdate1BeTRMod.F90 | 10 +-- .../src/biogeochem/CarbonStateUpdate1Mod.F90 | 31 ++++++---- .../elm/src/biogeochem/DryDepVelocity.F90 | 56 +++++++++-------- components/elm/src/biogeochem/FireMod.F90 | 61 ++++++++++++++----- .../elm/src/biogeochem/GapMortalityMod.F90 | 7 ++- .../biogeochem/NitrogenStateUpdate1Mod.F90 | 14 +++-- .../biogeochem/PhosphorusStateUpdate1Mod.F90 | 14 +++-- .../src/biogeochem/PrecisionControlMod.F90 | 10 ++- .../src/biogeochem/SatellitePhenologyMod.F90 | 4 +- .../elm/src/biogeochem/VOCEmissionMod.F90 | 38 ++++++------ .../elm/src/biogeochem/VegStructUpdateMod.F90 | 13 ++-- .../elm/src/biogeophys/CanopyFluxesMod.F90 | 8 ++- .../elm/src/biogeophys/PhotosynthesisMod.F90 | 2 - components/elm/src/biogeophys/SedYieldMod.F90 | 10 ++- .../elm/src/dyn_subgrid/dynHarvestMod.F90 | 5 +- components/elm/src/main/surfrdUtilsMod.F90 | 32 +++++----- 17 files changed, 192 insertions(+), 128 deletions(-) diff --git a/components/elm/src/biogeochem/CH4Mod.F90 b/components/elm/src/biogeochem/CH4Mod.F90 index ce2378049fd..3b3c1fa8061 100644 --- a/components/elm/src/biogeochem/CH4Mod.F90 +++ b/components/elm/src/biogeochem/CH4Mod.F90 @@ -2426,7 +2426,7 @@ subroutine ch4_aere (bounds, & ! !USES: !$acc routine seq use elm_varcon , only : rpi - use pftvarcon , only : nc3_arctic_grass, crop, nc3_nonarctic_grass, nc4_grass, noveg + use pftvarcon , only : graminoid, crop, noveg use CH4varcon , only : transpirationloss, usefrootc, use_aereoxid_prog ! ! !ARGUMENTS: @@ -2563,8 +2563,7 @@ subroutine ch4_aere (bounds, & is_vegetated = .false. end if - if (veg_pp%itype(p) == nc3_arctic_grass .or. crop(veg_pp%itype(p)) == 1 .or. & - veg_pp%itype(p) == nc3_nonarctic_grass .or. veg_pp%itype(p) == nc4_grass) then + if (graminoid(veg_pp%itype(p)) == 1 .or. crop(veg_pp%itype(p)) == 1) then poros_tiller = 0.3_r8 ! Colmer 2003 else poros_tiller = 0.3_r8 * CH4ParamsInst%nongrassporosratio diff --git a/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 b/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 index 95d884de490..4c7fd83d210 100644 --- a/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 +++ b/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 @@ -10,7 +10,7 @@ module CNNStateUpdate1BeTRMod use elm_varpar , only : crop_prog, i_met_lit, i_cel_lit, i_lig_lit, i_cwd use elm_varctl , only : iulog use elm_varcon , only : nitrif_n2o_loss_frac - use pftvarcon , only : npcropmin, nc3crop + use pftvarcon , only : crop, generic_crop use VegetationPropertiesType , only : veg_vp use CNDecompCascadeConType , only : decomp_cascade_con use CNStateType , only : cnstate_type @@ -101,7 +101,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) - veg_nf%deadcrootn_xfer_to_deadcrootn(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (crop(ivt(p)) >= 1 .and. generic_crop(ivt(p)) < 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) - veg_nf%livestemn_xfer_to_livestemn(p)*dt @@ -126,7 +126,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%livecrootn(p) = veg_ns%livecrootn(p) - veg_nf%livecrootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%livecrootn_to_retransn(p)*dt end if - if (ivt(p) >= npcropmin) then ! Beth adds retrans from froot + if (crop(ivt(p)) >= 1 .and. generic_crop(ivt(p)) < 1) then ! Beth adds retrans from froot veg_ns%frootn(p) = veg_ns%frootn(p) - veg_nf%frootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%frootn_to_retransn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_litter(p)*dt @@ -172,7 +172,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_storage(p) = veg_ns%deadcrootn_storage(p) + veg_nf%npool_to_deadcrootn_storage(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (crop(ivt(p)) >= 1 .and. generic_crop(ivt(p)) < 1) then ! skip 2 generic crops veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%npool_to_livestemn(p)*dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn_storage(p)*dt @@ -200,7 +200,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) + veg_nf%deadcrootn_storage_to_xfer(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (crop(ivt(p)) >= 1 .and. generic_crop(ivt(p)) < 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn_storage(p) = veg_ns%livestemn_storage(p) - veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) + veg_nf%livestemn_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 b/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 index a371a44c537..25455dbbb20 100644 --- a/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 @@ -11,7 +11,7 @@ module CarbonStateUpdate1Mod use elm_varcon , only : dzsoi_decomp use elm_varctl , only : nu_com, use_c13, use_c14 use elm_varctl , only : use_pflotran, pf_cmode, use_fates - use pftvarcon , only : npcropmin, nc3crop + use pftvarcon , only : crop, generic_crop, percrop use CNDecompCascadeConType , only : decomp_cascade_type use CNStateType , only : cnstate_type use CNDecompCascadeConType , only : decomp_cascade_con @@ -274,7 +274,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%leafc_xfer(p) = veg_cs%leafc_xfer(p) - veg_cf%leafc_xfer_to_leafc(p)*dt veg_cs%frootc(p) = veg_cs%frootc(p) + veg_cf%frootc_xfer_to_frootc(p)*dt veg_cs%frootc_xfer(p) = veg_cs%frootc_xfer(p) - veg_cf%frootc_xfer_to_frootc(p)*dt - if (woody(ivt(p)) >= 1.0_r8) then + if (woody(ivt(p)) >= 1.0_r8) then veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%livestemc_xfer_to_livestemc(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) - veg_cf%livestemc_xfer_to_livestemc(p)*dt veg_cs%deadstemc(p) = veg_cs%deadstemc(p) + veg_cf%deadstemc_xfer_to_deadstemc(p)*dt @@ -284,7 +284,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%deadcrootc(p) = veg_cs%deadcrootc(p) + veg_cf%deadcrootc_xfer_to_deadcrootc(p)*dt veg_cs%deadcrootc_xfer(p) = veg_cs%deadcrootc_xfer(p) - veg_cf%deadcrootc_xfer_to_deadcrootc(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%livestemc_xfer_to_livestemc(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) - veg_cf%livestemc_xfer_to_livestemc(p)*dt @@ -303,7 +304,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%livecrootc(p) = veg_cs%livecrootc(p) - veg_cf%livecrootc_to_deadcrootc(p)*dt veg_cs%deadcrootc(p) = veg_cs%deadcrootc(p) + veg_cf%livecrootc_to_deadcrootc(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_cs%livestemc(p) = veg_cs%livestemc(p) - veg_cf%livestemc_to_litter(p)*dt veg_cs%grainc(p) = veg_cs%grainc(p) - veg_cf%grainc_to_food(p)*dt @@ -319,7 +321,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livestem_curmr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livecroot_curmr(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livestem_curmr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%grain_curmr(p)*dt end if @@ -337,7 +340,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livestem_xsmr(p)*dt veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livecroot_xsmr(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livestem_xsmr(p)*dt veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%grain_xsmr(p)*dt if (harvdate(p) < 999) then ! beginning at harvest, send to atm @@ -373,7 +377,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_deadcrootc_storage(p)*dt veg_cs%deadcrootc_storage(p) = veg_cs%deadcrootc_storage(p) + veg_cf%cpool_to_deadcrootc_storage(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_livestemc(p)*dt veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%cpool_to_livestemc(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_livestemc_storage(p)*dt @@ -393,7 +398,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livecroot_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_deadcroot_gr(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livestem_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_grain_gr(p)*dt end if @@ -407,7 +413,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_livecroot_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_deadcroot_gr(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_livestem_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_grain_gr(p)*dt end if @@ -421,7 +428,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livecroot_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_deadcroot_storage_gr(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livestem_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_grain_storage_gr(p)*dt end if @@ -447,7 +455,8 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%gresp_storage(p) = veg_cs%gresp_storage(p) - veg_cf%gresp_storage_to_xfer(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) + veg_cf%gresp_storage_to_xfer(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_cs%livestemc_storage(p) = veg_cs%livestemc_storage(p) - veg_cf%livestemc_storage_to_xfer(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) + veg_cf%livestemc_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/DryDepVelocity.F90 b/components/elm/src/biogeochem/DryDepVelocity.F90 index 009de700b45..293713da54a 100644 --- a/components/elm/src/biogeochem/DryDepVelocity.F90 +++ b/components/elm/src/biogeochem/DryDepVelocity.F90 @@ -145,14 +145,9 @@ subroutine depvel_compute( bounds, & use seq_drydep_mod , only : rcls, h2_a, h2_b, h2_c, ri, rac, rclo, rlu, rgss, rgso use landunit_varcon, only : istsoil, istice, istice_mec, istdlak, istwet use elm_varctl , only : iulog - use pftvarcon , only : noveg, ndllf_evr_tmp_tree, ndllf_evr_brl_tree - use pftvarcon , only : ndllf_dcd_brl_tree, nbrdlf_evr_trp_tree - use pftvarcon , only : nbrdlf_evr_tmp_tree, nbrdlf_dcd_trp_tree - use pftvarcon , only : nbrdlf_dcd_tmp_tree, nbrdlf_dcd_brl_tree - use pftvarcon , only : nbrdlf_evr_shrub, nbrdlf_dcd_tmp_shrub - use pftvarcon , only : nbrdlf_dcd_brl_shrub,nc3_arctic_grass - use pftvarcon , only : nc3_nonarctic_grass, nc4_grass, nc3crop - use pftvarcon , only : nc3irrig, npcropmin, npcropmax + use pftvarcon , only : noveg, nonvascular + use pftvarcon , only : woody, graminoid, generic_crop, crop, percrop + use pftvarcon , only : needleleaf ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -275,24 +270,33 @@ subroutine depvel_compute( bounds, & !map ELM veg type into Wesely veg type wesveg = wveg_unset - if (elmveg == noveg ) wesveg = 8 - if (elmveg == ndllf_evr_tmp_tree ) wesveg = 5 - if (elmveg == ndllf_evr_brl_tree ) wesveg = 5 - if (elmveg == ndllf_dcd_brl_tree ) wesveg = 5 - if (elmveg == nbrdlf_evr_trp_tree ) wesveg = 4 - if (elmveg == nbrdlf_evr_tmp_tree ) wesveg = 4 - if (elmveg == nbrdlf_dcd_trp_tree ) wesveg = 4 - if (elmveg == nbrdlf_dcd_tmp_tree ) wesveg = 4 - if (elmveg == nbrdlf_dcd_brl_tree ) wesveg = 4 - if (elmveg == nbrdlf_evr_shrub ) wesveg = 11 - if (elmveg == nbrdlf_dcd_tmp_shrub ) wesveg = 11 - if (elmveg == nbrdlf_dcd_brl_shrub ) wesveg = 11 - if (elmveg == nc3_arctic_grass ) wesveg = 3 - if (elmveg == nc3_nonarctic_grass ) wesveg = 3 - if (elmveg == nc4_grass ) wesveg = 3 - if (elmveg == nc3crop ) wesveg = 2 - if (elmveg == nc3irrig ) wesveg = 2 - if (elmveg >= npcropmin .and. elmveg <= npcropmax ) wesveg = 2 + if (elmveg == noveg ) wesveg = 8 + if (nonvascular(elmveg) == 2.0_r8 ) wesveg = 8 ! assuming lichen like bare-ground + !if (elmveg == ndllf_evr_tmp_tree ) wesveg = 5 + !if (elmveg == ndllf_evr_brl_tree ) wesveg = 5 + !if (elmveg == ndllf_dcd_brl_tree ) wesveg = 5 + if (woody(elmveg) == 1.0_r8 .and. needleleaf(elmveg) == 1) wesveg = 5 + !if (elmveg == nbrdlf_evr_trp_tree ) wesveg = 4 + !if (elmveg == nbrdlf_evr_tmp_tree ) wesveg = 4 + !if (elmveg == nbrdlf_dcd_trp_tree ) wesveg = 4 + !if (elmveg == nbrdlf_dcd_tmp_tree ) wesveg = 4 + !if (elmveg == nbrdlf_dcd_brl_tree ) wesveg = 4 + if (woody(elmveg) == 1.0_r8 .and. needleleaf(elmveg) == 0) wesveg = 4 + !if (elmveg == nbrdlf_evr_shrub ) wesveg = 11 + !if (elmveg == nbrdlf_dcd_tmp_shrub ) wesveg = 11 + !if (elmveg == nbrdlf_dcd_brl_shrub ) wesveg = 11 + if (woody(elmveg) == 2.0_r8 ) wesveg = 11 + !if (elmveg == nc3_arctic_grass ) wesveg = 3 + !if (elmveg == nc3_nonarctic_grass ) wesveg = 3 + !if (elmveg == nc4_grass ) wesveg = 3 + if (graminoid(elmveg) == 1.0_r8 ) wesveg = 3 + if (nonvascular(elmveg) == 1.0_r8 ) wesveg = 3 ! assuming moss like grass + !if (elmveg == nc3crop ) wesveg = 2 + !if (elmveg == nc3irrig ) wesveg = 2 + if (generic_crop(elmveg) == 1.0_r8 ) wesveg = 2 + if (crop(elmveg) == 1.0_r8 ) wesveg = 2 + if (percrop(elmveg) == 1.0_r8 ) wesveg = 2 + !if (elmveg >= npcropmin .and. elmveg <= npcropmax ) wesveg = 2 #ifndef _OPENACC if (wesveg == wveg_unset )then write(iulog,*) 'elmveg = ', elmveg, 'lun_pp%itype = ', lun_pp%itype(l) diff --git a/components/elm/src/biogeochem/FireMod.F90 b/components/elm/src/biogeochem/FireMod.F90 index 0dec0c08a50..743141b2018 100644 --- a/components/elm/src/biogeochem/FireMod.F90 +++ b/components/elm/src/biogeochem/FireMod.F90 @@ -126,8 +126,8 @@ subroutine FireArea (bounds, & use elm_varcon , only: secspday, spval use elm_varctl , only: use_nofire, spinup_state, spinup_mortality_factor use dynSubgridControlMod , only: run_has_transient_landcover - use pftvarcon , only: nc4_grass, nc3crop, ndllf_evr_tmp_tree - use pftvarcon , only: nbrdlf_evr_trp_tree, nbrdlf_dcd_trp_tree, nbrdlf_evr_shrub + use pftvarcon , only: noveg, woody, graminoid, generic_crop, crop, percrop + use pftvarcon , only: climatezone, needleleaf, evergreen ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -305,11 +305,16 @@ subroutine FireArea (bounds, & if (pi <= col_pp%npfts(c)) then p = col_pp%pfti(c) + pi - 1 ! For crop veg types - if( veg_pp%itype(p) > nc4_grass )then + if( generic_crop(veg_pp%itype(p)) == 1 .or. & + crop(veg_pp%itype(p)) == 1 .or. & + percrop(veg_pp%itype(p)) == 1 )then cropf_col(c) = cropf_col(c) + veg_pp%wtcol(p) end if ! For natural vegetation (non-crop and non-bare-soil) - if( veg_pp%itype(p) >= ndllf_evr_tmp_tree .and. veg_pp%itype(p) <= nc4_grass )then + if( veg_pp%itype(p) /= noveg .and. & + (generic_crop(veg_pp%itype(p)) == 0 .and. & + crop(veg_pp%itype(p)) == 0 .and. & + percrop(veg_pp%itype(p)) == 0) )then lfwt(c) = lfwt(c) + veg_pp%wtcol(p) end if end if @@ -331,7 +336,10 @@ subroutine FireArea (bounds, & ! column-level litter carbon ! is available, so we use leaf carbon to estimate the ! litter carbon for crop PFTs - if( veg_pp%itype(p) > nc4_grass .and. veg_pp%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then + if( (generic_crop(veg_pp%itype(p)) == 1 .or. & + crop(veg_pp%itype(p)) == 1 .or. & + percrop(veg_pp%itype(p)) == 1) .and. & + veg_pp%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & leafc_xfer(p))*veg_pp%wtcol(p)/cropf_col(c) + & totlitc(c)*leafc(p)/leafc_col(c)*veg_pp%wtcol(p)/cropf_col(c) @@ -368,21 +376,37 @@ subroutine FireArea (bounds, & p = col_pp%pfti(c) + pi - 1 ! For non-crop -- natural vegetation and bare-soil - if( veg_pp%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then + if( (generic_crop(veg_pp%itype(p)) == 0 .and. & + crop(veg_pp%itype(p)) == 0 .and. & + percrop(veg_pp%itype(p)) == 0) .and. & + cropf_col(c) < 1.0_r8 ) then if( btran2(p) .ne. spval) then if (btran2(p) <= 1._r8 ) then btran_col(c) = btran_col(c)+btran2(p)*veg_pp%wtcol(p) wtlf(c) = wtlf(c)+veg_pp%wtcol(p) end if end if - if( veg_pp%itype(p) == nbrdlf_evr_trp_tree .and. veg_pp%wtcol(p) > 0._r8 )then + ! broadleaf evergreen tropical tree + if( (needleleaf(veg_pp%itype(p)) == 0 .and. & + evergreen(veg_pp%itype(p)) == 1 .and. & + climatezone(veg_pp%itype(p)) == 1 .and. & + woody(veg_pp%itype(p)) == 1.0_r8) .and. & + veg_pp%wtcol(p) > 0._r8 )then trotr1_col(c)=trotr1_col(c)+veg_pp%wtcol(p)*col_pp%wttopounit(c) end if - if( veg_pp%itype(p) == nbrdlf_dcd_trp_tree .and. veg_pp%wtcol(p) > 0._r8 )then + ! broadleaf deciduous tropical tree + if( (needleleaf(veg_pp%itype(p)) == 0 .and. & + evergreen(veg_pp%itype(p)) == 0 .and. & + climatezone(veg_pp%itype(p)) == 1 .and. & + woody(veg_pp%itype(p)) == 1.0_r8) .and. & + veg_pp%wtcol(p) > 0._r8 ) then trotr2_col(c)=trotr2_col(c)+veg_pp%wtcol(p)*col_pp%wttopounit(c) end if if (transient_landcover) then !true when landuse data is used - if( veg_pp%itype(p) == nbrdlf_evr_trp_tree .or. veg_pp%itype(p) == nbrdlf_dcd_trp_tree )then + ! broadleaf tropical tree + if(needleleaf(veg_pp%itype(p)) == 0 .and. & + climatezone(veg_pp%itype(p)) == 1 .and. & + woody(veg_pp%itype(p)) == 1.0_r8)then if(lfpftd(p) > 0._r8)then dtrotr_col(c)=dtrotr_col(c)+lfpftd(p)*col_pp%wttopounit(c) end if @@ -405,7 +429,8 @@ subroutine FireArea (bounds, & ! For NOT bare-soil if( veg_pp%itype(p) /= noveg )then ! For shrub and grass (crop already excluded above) - if( veg_pp%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass + if( woody(veg_pp%itype(p)) == 2.0_r8 .or. & + graminoid(veg_pp%itype(p)) == 1 )then !for shurb and grass lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & exp(-1._r8*SHR_CONST_PI* & (gdp_lf(c)/8._r8)**0.5_r8))*veg_pp%wtcol(p) & @@ -416,7 +441,7 @@ subroutine FireArea (bounds, & lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & exp(-1._r8*SHR_CONST_PI* & (hdmlf/450._r8)**0.5_r8))*veg_pp%wtcol(p)/lfwt(c) - else ! for trees + else if (woody(veg_pp%itype(p)) == 1.0_r8) then ! for trees if( gdp_lf(c) > 20._r8 )then lgdp_col(c) =lgdp_col(c)+0.39_r8*veg_pp%wtcol(p)/(1.0_r8 - cropf_col(c)) else @@ -491,7 +516,10 @@ subroutine FireArea (bounds, & if (pi <= col_pp%npfts(c)) then p = col_pp%pfti(c) + pi - 1 ! For crop - if( forc_t(t) >= SHR_CONST_TKFRZ .and. veg_pp%itype(p) > nc4_grass .and. & + if( forc_t(t) >= SHR_CONST_TKFRZ .and. & + (generic_crop(veg_pp%itype(p))>=1 .or. & + crop(veg_pp%itype(p))>=1 .or. & + percrop(veg_pp%itype(p))>=1) .and. & kmo == abm_lf(c) .and. forc_rain(t)+forc_snow(t) == 0._r8 .and. & burndate(p) >= 999 .and. veg_pp%wtcol(p) > 0._r8 )then ! catch crop burn time @@ -661,7 +689,8 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! !USES: !$acc routine seq use pftvarcon , only: cc_leaf,cc_lstem,cc_dstem,cc_other,fm_leaf,fm_lstem,fm_other,fm_root,fm_lroot,fm_droot - use pftvarcon , only: nc3crop,lf_flab,lf_fcel,lf_flig,fr_flab,fr_fcel,fr_flig + use pftvarcon , only: lf_flab,lf_fcel,lf_flig,fr_flab,fr_fcel,fr_flig + use pftvarcon , only: generic_crop, crop, percrop use elm_varpar , only: max_patch_per_col use elm_varctl , only: spinup_state, spinup_mortality_factor use dynSubgridControlMod , only: get_flanduse_timeseries @@ -706,7 +735,7 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool is_litter => decomp_cascade_con%is_litter , & ! Input: [logical (:) ] TRUE => pool is a litter pool - woody => veg_vp%woody , & ! Input: [real(r8) (:) ] woody lifeform (1=woody, 0=not woody) + !woody => veg_vp%woody , & ! Input: [real(r8) (:) ] woody lifeform (1=woody, 0=not woody) cropf_col => cnstate_vars%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column croot_prof => cnstate_vars%croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots @@ -965,7 +994,9 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & c = veg_pp%column(p) itype = veg_pp%itype(p) - if( itype < nc3crop .and. cropf_col(c) < 1.0_r8)then + if( (generic_crop(veg_pp%itype(p)) == 0 .and. crop(veg_pp%itype(p)) == 0 .and. & + percrop(veg_pp%itype(p)) == 0 ) .and. & + cropf_col(c) < 1.0_r8)then ! For non-crop (bare-soil and natural vegetation) if (transient_landcover) then !true when landuse data is used f = (fbac(c)-baf_crop(c))/(1.0_r8-cropf_col(c)) diff --git a/components/elm/src/biogeochem/GapMortalityMod.F90 b/components/elm/src/biogeochem/GapMortalityMod.F90 index 495c46ed0df..31cd45814d6 100644 --- a/components/elm/src/biogeochem/GapMortalityMod.F90 +++ b/components/elm/src/biogeochem/GapMortalityMod.F90 @@ -564,7 +564,7 @@ subroutine mortality_rate_soilorder(& ! USES !$acc routine seq - use pftvarcon , only: nbrdlf_evr_trp_tree, nbrdlf_dcd_trp_tree + use pftvarcon , only: woody, needleleaf, climatezone use soilorder_varcon, only: r_mort_soilorder ! @@ -586,7 +586,10 @@ subroutine mortality_rate_soilorder(& do fp = 1,num_soilp p = filter_soilp(fp) c = veg_pp%column(p) - if( veg_pp%itype(p) == nbrdlf_evr_trp_tree .or. veg_pp%itype(p) == nbrdlf_dcd_trp_tree )then + ! broadleaf tropical trees + if( woody(veg_pp%itype(p)) == 1.0_r8 .and. & + needleleaf(veg_pp%itype(p)) == 0 .and. & + climatezone(veg_pp%itype(p)) == 1 )then r_mort_cal(p) = r_mort_soilorder( isoilorder(c) ) else r_mort_cal(p) = 0.02_r8 ! Default mortality rate diff --git a/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 b/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 index 14d834245f5..d72dc4dc598 100644 --- a/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 @@ -9,7 +9,7 @@ module NitrogenStateUpdate1Mod use elm_varpar , only : crop_prog, i_met_lit, i_cel_lit, i_lig_lit, i_cwd use elm_varctl , only : iulog use elm_varcon , only : nitrif_n2o_loss_frac - use pftvarcon , only : npcropmin, nc3crop + use pftvarcon , only : crop, generic_crop, percrop use VegetationPropertiesType , only : veg_vp use CNDecompCascadeConType , only : decomp_cascade_con use CNStateType , only : cnstate_type @@ -297,7 +297,8 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) - veg_nf%deadcrootn_xfer_to_deadcrootn(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) - veg_nf%livestemn_xfer_to_livestemn(p)*dt @@ -322,7 +323,8 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%livecrootn(p) = veg_ns%livecrootn(p) - veg_nf%livecrootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%livecrootn_to_retransn(p)*dt end if - if (ivt(p) >= npcropmin) then ! Beth adds retrans from froot + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! Beth adds retrans from froot veg_ns%frootn(p) = veg_ns%frootn(p) - veg_nf%frootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%frootn_to_retransn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_litter(p)*dt @@ -373,7 +375,8 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_storage(p) = veg_ns%deadcrootn_storage(p) + veg_nf%npool_to_deadcrootn_storage(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%npool_to_livestemn(p)*dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn_storage(p)*dt @@ -401,7 +404,8 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) + veg_nf%deadcrootn_storage_to_xfer(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn_storage(p) = veg_ns%livestemn_storage(p) - veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) + veg_nf%livestemn_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 b/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 index feea9fd86fb..e29074eb332 100644 --- a/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 @@ -8,7 +8,7 @@ module PhosphorusStateUpdate1Mod use elm_varpar , only : nlevdecomp, ndecomp_pools, ndecomp_cascade_transitions use elm_varpar , only : crop_prog, i_met_lit, i_cel_lit, i_lig_lit, i_cwd use elm_varctl , only : iulog - use pftvarcon , only : npcropmin, nc3crop + use pftvarcon , only : crop, generic_crop, percrop use soilorder_varcon , only : smax,ks_sorption use VegetationPropertiesType , only : veg_vp use CNDecompCascadeConType , only : decomp_cascade_con @@ -255,7 +255,8 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_xfer(p) = veg_ps%deadcrootp_xfer(p) - veg_pf%deadcrootp_xfer_to_deadcrootp(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ps%livestemp(p) = veg_ps%livestemp(p) + veg_pf%livestemp_xfer_to_livestemp(p)*dt veg_ps%livestemp_xfer(p) = veg_ps%livestemp_xfer(p) - veg_pf%livestemp_xfer_to_livestemp(p)*dt @@ -280,7 +281,8 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%livecrootp(p) = veg_ps%livecrootp(p) - veg_pf%livecrootp_to_retransp(p)*dt veg_ps%retransp(p) = veg_ps%retransp(p) + veg_pf%livecrootp_to_retransp(p)*dt end if - if (ivt(p) >= npcropmin) then ! Beth adds retrans from froot + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! Beth adds retrans from froot veg_ps%frootp(p) = veg_ps%frootp(p) - veg_pf%frootp_to_retransp(p)*dt veg_ps%retransp(p) = veg_ps%retransp(p) + veg_pf%frootp_to_retransp(p)*dt veg_ps%livestemp(p) = veg_ps%livestemp(p) - veg_pf%livestemp_to_litter(p)*dt @@ -331,7 +333,8 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_storage(p) = veg_ps%deadcrootp_storage(p) + veg_pf%ppool_to_deadcrootp_storage(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_livestemp(p)*dt veg_ps%livestemp(p) = veg_ps%livestemp(p) + veg_pf%ppool_to_livestemp(p)*dt veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_livestemp_storage(p)*dt @@ -359,7 +362,8 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_xfer(p) = veg_ps%deadcrootp_xfer(p) + veg_pf%deadcrootp_storage_to_xfer(p)*dt end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & + generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ps%livestemp_storage(p) = veg_ps%livestemp_storage(p) - veg_pf%livestemp_storage_to_xfer(p)*dt veg_ps%livestemp_xfer(p) = veg_ps%livestemp_xfer(p) + veg_pf%livestemp_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/PrecisionControlMod.F90 b/components/elm/src/biogeochem/PrecisionControlMod.F90 index 89e30c83fd1..8767d300b24 100644 --- a/components/elm/src/biogeochem/PrecisionControlMod.F90 +++ b/components/elm/src/biogeochem/PrecisionControlMod.F90 @@ -39,7 +39,7 @@ subroutine PrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) !$acc routine seq use elm_varctl , only : iulog, use_c13, use_c14, use_fates use elm_varpar , only : nlevdecomp_full, crop_prog - use pftvarcon , only : nc3crop + use pftvarcon , only : crop, generic_crop, percrop use tracer_varcon , only : is_active_betr_bgc use CNDecompCascadeConType , only : decomp_cascade_con ! @@ -211,7 +211,9 @@ subroutine PrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) veg_ps%frootp_xfer(p) = 0._r8 end if - if ( crop_prog .and. veg_pp%itype(p) >= nc3crop )then + if ( crop_prog .and. & + (crop(veg_pp%itype(p)) >= 1 .or. & + percrop(veg_pp%itype(p)) >= 1) )then ! grain C and N if (abs(veg_cs%grainc(p)) < ccrit) then pc = pc + veg_cs%grainc(p) @@ -513,7 +515,9 @@ subroutine PrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) endif end if - if ( crop_prog .and. veg_pp%itype(p) >= nc3crop )then + if ( crop_prog .and. & + (crop(veg_pp%itype(p)) >= 1 .or. & + percrop(veg_pp%itype(p)) >= 1) )then ! xsmrpool (C only) if (abs(veg_cs%xsmrpool(p)) < ccrit) then pc = pc + veg_cs%xsmrpool(p) diff --git a/components/elm/src/biogeochem/SatellitePhenologyMod.F90 b/components/elm/src/biogeochem/SatellitePhenologyMod.F90 index b5d9b1bd3a4..688b254bd83 100644 --- a/components/elm/src/biogeochem/SatellitePhenologyMod.F90 +++ b/components/elm/src/biogeochem/SatellitePhenologyMod.F90 @@ -304,7 +304,7 @@ subroutine SatellitePhenology(bounds, num_filter, filter, & ! Calculates leaf areas (tlai, elai), stem areas (tsai, esai) and height (htop). ! ! !USES: - use pftvarcon, only : noveg, nbrdlf_dcd_brl_shrub + use pftvarcon, only : woody use elm_varctl, only : use_fates_sp ! ! !ARGUMENTS: @@ -371,7 +371,7 @@ subroutine SatellitePhenology(bounds, num_filter, filter, & ! snow burial fraction for short vegetation (e.g. grasses) as in ! Wang and Zeng, 2007. - if (veg_pp%itype(p) > noveg .and. veg_pp%itype(p) <= nbrdlf_dcd_brl_shrub ) then + if (woody(veg_pp%itype(p)) >= 1.0_r8) then ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) else diff --git a/components/elm/src/biogeochem/VOCEmissionMod.F90 b/components/elm/src/biogeochem/VOCEmissionMod.F90 index cb58227b523..64a72fe78b8 100644 --- a/components/elm/src/biogeochem/VOCEmissionMod.F90 +++ b/components/elm/src/biogeochem/VOCEmissionMod.F90 @@ -9,13 +9,9 @@ module VOCEmissionMod use shr_log_mod , only : errMsg => shr_log_errMsg use elm_varctl , only : iulog use elm_varpar , only : numpft, nlevcan - use pftvarcon , only : ndllf_evr_tmp_tree, ndllf_evr_brl_tree - use pftvarcon , only : ndllf_dcd_brl_tree, nbrdlf_evr_trp_tree - use pftvarcon , only : nbrdlf_evr_tmp_tree, nbrdlf_dcd_brl_shrub - use pftvarcon , only : nbrdlf_dcd_trp_tree, nbrdlf_dcd_tmp_tree - use pftvarcon , only : nbrdlf_dcd_brl_tree, nbrdlf_evr_shrub - use pftvarcon , only : nc3_arctic_grass , nc3crop - use pftvarcon , only : nc4_grass, noveg + use elm_varpar , only : numveg ! fixed as 16, while numpft above may be variable + use pftvarcon , only : woody, graminoid, generic_crop, crop, percrop + use pftvarcon , only : needleleaf, evergreen use shr_megan_mod , only : shr_megan_megcomps_n, shr_megan_megcomp_t, shr_megan_linkedlist use shr_megan_mod , only : shr_megan_mechcomps_n, shr_megan_mechcomps, shr_megan_mapped_emisfctrs use MEGANFactorsMod , only : Agro, Amat, Anew, Aold, betaT, ct1, ct2, LDF, Ceo @@ -114,7 +110,7 @@ subroutine InitAllocate(this, bounds) ! !LOCAL VARIABLES: integer :: i, imeg integer :: class_num - real(r8) :: factors(numpft) + real(r8) :: factors(numveg) real(r8) :: molec_wght integer :: begg, endg integer :: begp, endp @@ -128,7 +124,8 @@ subroutine InitAllocate(this, bounds) meg_cmp => shr_megan_linkedlist do while(associated(meg_cmp)) - allocate(meg_cmp%emis_factors(numpft)) + !allocate(meg_cmp%emis_factors(numpft)) + allocate(meg_cmp%emis_factors(numveg)) ! TODO: VOCEmission input is with a hard-wired num of pft (16) call megan_factors_get( trim(meg_cmp%name), factors, class_num, molec_wght ) meg_cmp%emis_factors = factors meg_cmp%class_number = class_num @@ -693,21 +690,21 @@ function get_map_EF(ivt_in, g_in, ti_in, vocemis_vars) get_map_EF = 0._r8 - if ( ivt_in == ndllf_evr_tmp_tree & - .or. ivt_in == ndllf_evr_brl_tree) then !fineleaf evergreen + if (woody(ivt_in) == 1.0_r8 .and. evergreen(ivt_in) == 1 & + .and. needleleaf(ivt_in) == 1) then !fineleaf evergreen trees get_map_EF = vocemis_vars%efisop_grc(2,g_in, ti_in) - else if (ivt_in == ndllf_dcd_brl_tree) then !fineleaf deciduous + else if (woody(ivt_in) == 1.0_r8 .and. evergreen(ivt_in) == 0 & + .and. needleleaf(ivt_in) == 1) then !fineleaf deciduous trees get_map_EF = vocemis_vars%efisop_grc(3,g_in, ti_in) - else if (ivt_in >= nbrdlf_evr_trp_tree & - .and. ivt_in <= nbrdlf_dcd_brl_tree) then !broadleaf trees + else if (woody(ivt_in) == 1.0_r8 & + .and. needleleaf(ivt_in) == 0) then !broadleaf trees get_map_EF = vocemis_vars%efisop_grc(1,g_in,ti_in) - else if (ivt_in >= nbrdlf_evr_shrub & - .and. ivt_in <= nbrdlf_dcd_brl_shrub) then !shrubs + else if (woody(ivt_in) == 2.0_r8) then !shrubs get_map_EF = vocemis_vars%efisop_grc(4,g_in, ti_in) - else if (ivt_in >= nc3_arctic_grass & - .and. ivt_in <= nc4_grass) then !grass + else if (graminoid(ivt_in) == 1) then !grass get_map_EF = vocemis_vars%efisop_grc(5,g_in, ti_in) - else if (ivt_in >= nc3crop) then !crops + else if (generic_crop(ivt_in) == 1 .or. crop(ivt_in) == 1 & + .or. percrop(ivt_in) == 1) then !crops get_map_EF = vocemis_vars%efisop_grc(6,g_in, ti_in) end if @@ -970,7 +967,8 @@ function get_gamma_A(ivt_in, elai240_in,elai_in,nclass_in) real(r8) :: elai_prev ! lai for previous timestep real(r8) :: fnew, fgro, fmat, fold ! fractions of leaves at different phenological stages !----------------------------------------------------------------------- - if ( (ivt_in == ndllf_dcd_brl_tree) .or. (ivt_in >= nbrdlf_dcd_trp_tree) ) then ! non-evergreen + !if ( (ivt_in == ndllf_dcd_brl_tree) .or. (ivt_in >= nbrdlf_dcd_trp_tree) ) then ! non-evergreen + if ( (woody(ivt_in) == 1.0_r8) .and. (evergreen(ivt_in) <= 0) ) then ! non-evergreen tree if ( (elai240_in > 0.0_r8) .and. (elai240_in < 1.e30_r8) )then elai_prev = 2._r8*elai240_in-elai_in ! have accumulated average lai over last timestep diff --git a/components/elm/src/biogeochem/VegStructUpdateMod.F90 b/components/elm/src/biogeochem/VegStructUpdateMod.F90 index 9a7db79154b..cd982139eef 100644 --- a/components/elm/src/biogeochem/VegStructUpdateMod.F90 +++ b/components/elm/src/biogeochem/VegStructUpdateMod.F90 @@ -37,8 +37,8 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & ! vegetation structure (LAI, SAI, height) ! ! !USES: - use pftvarcon , only : noveg, nc3crop, nc3irrig, nbrdlf_evr_shrub, nbrdlf_dcd_brl_shrub - use pftvarcon , only : ncorn, ncornirrig, npcropmin, ztopmx, laimx + use pftvarcon , only : noveg, woody, generic_crop, crop, percrop + use pftvarcon , only : ncorn, ncornirrig, ztopmx, laimx use pftvarcon , only : nmiscanthus, nmiscanthusirrig, nswitchgrass, nswitchgrassirrig use elm_time_manager , only : get_rad_step_size use elm_varctl , only : spinup_state, spinup_mortality_factor @@ -148,7 +148,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & ! alpha are set by PFT, and alpha is scaled to CLM time step by multiplying by ! dt and dividing by dtsmonth (seconds in average 30 day month) ! tsai_min scaled by 0.5 to match MODIS satellite derived values - if (ivt(p) == nc3crop .or. ivt(p) == nc3irrig) then ! generic crops + if (generic_crop(ivt(p)) == 1) then ! generic crops tsai_alpha = 1.0_r8-1.0_r8*dt/dtsmonth tsai_min = 0.1_r8 @@ -164,7 +164,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & ! trees and shrubs ! if shrubs have a squat taper - if (ivt(p) >= nbrdlf_evr_shrub .and. ivt(p) <= nbrdlf_dcd_brl_shrub) then + if (woody(ivt(p)) == 2.0_r8) then taper = 10._r8 ! otherwise have a tall taper else @@ -194,7 +194,8 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & hbot(p) = max(0._r8, min(3._r8, htop(p)-1._r8)) - else if (ivt(p) >= npcropmin) then ! prognostic crops + else if ( generic_crop(ivt(p)) <1 .and. & + (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) ) then ! prognostic crops if (tlai(p) >= laimx(ivt(p))) peaklai(p) = 1 ! used in CNAllocation @@ -248,7 +249,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & ! adjust lai and sai for burying by snow. ! snow burial fraction for short vegetation (e.g. grasses) as in ! Wang and Zeng, 2007. - if (ivt(p) > noveg .and. ivt(p) <= nbrdlf_dcd_brl_shrub ) then + if (woody(ivt(p)) >= 1.0_r8 ) then ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) else diff --git a/components/elm/src/biogeophys/CanopyFluxesMod.F90 b/components/elm/src/biogeophys/CanopyFluxesMod.F90 index 6c96e70e172..fd6cd3ab163 100755 --- a/components/elm/src/biogeophys/CanopyFluxesMod.F90 +++ b/components/elm/src/biogeophys/CanopyFluxesMod.F90 @@ -17,7 +17,7 @@ module CanopyFluxesMod use elm_varctl , only : use_hydrstress use elm_varpar , only : nlevgrnd, nlevsno use elm_varcon , only : namep - use pftvarcon , only : nbrdlf_dcd_tmp_shrub, nsoybean , nsoybeanirrig + use pftvarcon , only : crop, nfixer use decompMod , only : bounds_type use PhotosynthesisMod , only : Photosynthesis, PhotosynthesisTotal, Fractionation, PhotoSynthesisHydraulicStress use SoilMoistStressMod , only : calc_effective_soilporosity, calc_volumetric_h2oliq @@ -869,7 +869,8 @@ subroutine CanopyFluxes(bounds, num_nolakeurbanp, filter_nolakeurbanp, & p = filterp(f) c = veg_pp%column(p) if(.not.veg_pp%is_fates(p)) then - if (veg_pp%itype(p) == nsoybean .or. veg_pp%itype(p) == nsoybeanirrig) then + ! soybean (crop with N fixation) + if (crop(veg_pp%itype(p)) >= 1 .and. nfixer(veg_pp%itype(p)) == 1) then btran(p) = min(1._r8, btran(p) * 1.25_r8) end if @@ -909,7 +910,8 @@ subroutine CanopyFluxes(bounds, num_nolakeurbanp, filter_nolakeurbanp, & do f = 1, fn p = filterp(f) c = veg_pp%column(p) - if (veg_pp%itype(p) == nsoybean .or. veg_pp%itype(p) == nsoybeanirrig) then + ! soybean (crop with N fixation) + if (crop(veg_pp%itype(p)) >= 1 .and. nfixer(veg_pp%itype(p)) == 1) then btran(p) = min(1._r8, btran(p) * 1.25_r8) end if end do diff --git a/components/elm/src/biogeophys/PhotosynthesisMod.F90 b/components/elm/src/biogeophys/PhotosynthesisMod.F90 index 65ddbbb7155..f080c457fa3 100644 --- a/components/elm/src/biogeophys/PhotosynthesisMod.F90 +++ b/components/elm/src/biogeophys/PhotosynthesisMod.F90 @@ -225,7 +225,6 @@ subroutine Photosynthesis ( bounds, fn, filterp, & !$acc routine seq use elm_varcon , only : rgas, tfrz use elm_varctl , only : carbon_only - use pftvarcon , only : nbrdlf_dcd_tmp_shrub, nsoybean, nsoybeanirrig, npcropmin use pftvarcon , only : vcmax_np1, vcmax_np2, vcmax_np3, vcmax_np4, jmax_np1, jmax_np2, jmax_np3 ! ! !ARGUMENTS: @@ -1594,7 +1593,6 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & use elm_varctl , only : carbon_only !use elm_varctl , only : lnc_opt, reduce_dayl_factor, vcmax_opt use elm_varpar , only : nlevsoi - use pftvarcon , only : nbrdlf_dcd_tmp_shrub, npcropmin use pftvarcon , only : vcmax_np1, vcmax_np2, vcmax_np3, vcmax_np4, jmax_np1, jmax_np2, jmax_np3 use ColumnType , only : col_pp diff --git a/components/elm/src/biogeophys/SedYieldMod.F90 b/components/elm/src/biogeophys/SedYieldMod.F90 index 10b0db72814..e50544edde6 100644 --- a/components/elm/src/biogeophys/SedYieldMod.F90 +++ b/components/elm/src/biogeophys/SedYieldMod.F90 @@ -63,7 +63,7 @@ subroutine SoilErosion (bounds, num_soilc, filter_soilc, & use elm_time_manager, only : get_step_size use landunit_varcon , only : istcrop, istsoil, istice use pftvarcon , only : gcbc_p, gcbc_q, gcbr_p, gcbr_q - use pftvarcon , only : nc4_grass + use pftvarcon , only : generic_crop, crop, percrop ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -218,7 +218,9 @@ subroutine SoilErosion (bounds, num_soilc, filter_soilc, & (veg_cs%livecrootc(p)+veg_cs%deadcrootc(p))*croot_prof(p,1) ) fgndcov = exp( -gcbc_p(veg_pp%itype(p))*PCT_gnd - & gcbr_p(veg_pp%itype(p))*Broot ) - if( veg_pp%itype(p) > nc4_grass )then + if( generic_crop(veg_pp%itype(p)) >= 1 .or. & + crop(veg_pp%itype(p)) >= 1 .or. & + percrop(veg_pp%itype(p)) >=1 )then Es_Pcrp = Es_Pcrp + pfactor(c) * ftillage * flitho * & fgndcov * veg_pp%wtcol(p) * K * (KE_DT+KE_LD) @@ -266,7 +268,9 @@ subroutine SoilErosion (bounds, num_soilc, filter_soilc, & nh = 0.03_r8 + 0.05_r8*max(Crsd,Clai) fsr = fsr + veg_pp%wtcol(p) * (0.03_r8/nh)**0.6_r8 - if ( veg_pp%itype(p) > nc4_grass ) then + if ( generic_crop(veg_pp%itype(p)) >= 1 .or. & + crop(veg_pp%itype(p)) >= 1 .or. & + percrop(veg_pp%itype(p)) >=1 ) then ftillage_tc = ftillage_tc + ftillage * veg_pp%wtcol(p) Es_Q = Es_Q + 19.1_r8 * qfactor(c) * 2._r8/COH * flitho * fslp * & diff --git a/components/elm/src/dyn_subgrid/dynHarvestMod.F90 b/components/elm/src/dyn_subgrid/dynHarvestMod.F90 index 5256f415efe..07455f77ec6 100644 --- a/components/elm/src/dyn_subgrid/dynHarvestMod.F90 +++ b/components/elm/src/dyn_subgrid/dynHarvestMod.F90 @@ -202,7 +202,8 @@ subroutine CNHarvest (num_soilc, filter_soilc, num_soilp, filter_soilp, cnstate_ ! Harvest mortality routine for coupled carbon-nitrogen code (CN) ! !USES: - use pftvarcon , only : noveg, nbrdlf_evr_shrub, pprodharv10 + use pftvarcon , only : pprodharv10 + use pftvarcon , only : woody use elm_varcon , only : secspday use elm_time_manager, only : get_days_per_year use GridcellType , only : grc_pp @@ -377,7 +378,7 @@ subroutine CNHarvest (num_soilc, filter_soilc, num_soilp, filter_soilp, cnstate_ ! If this is a tree pft, then ! get the annual harvest "mortality" rate (am) from harvest array ! and convert to rate per second - if (ivt(p) > noveg .and. ivt(p) < nbrdlf_evr_shrub) then + if (woody(ivt(p)) == 1.0_r8) then if (do_harvest) then am = 0._r8 diff --git a/components/elm/src/main/surfrdUtilsMod.F90 b/components/elm/src/main/surfrdUtilsMod.F90 index a32570c15a2..1e58b5174af 100644 --- a/components/elm/src/main/surfrdUtilsMod.F90 +++ b/components/elm/src/main/surfrdUtilsMod.F90 @@ -20,7 +20,7 @@ module surfrdUtilsMod ! !PUBLIC MEMBER FUNCTIONS: public :: check_sums_equal_1_3d ! Confirm that sum(arr(n,t,:)) == 1 for all n public :: check_sums_equal_1_2d ! Confirm that sum(arr(n,:)) == 1 for all n - public :: convert_cft_to_pft ! Conversion of crop CFT to natural veg PFT:w + public :: convert_cft_to_pft ! Conversion of crop CFT to natural veg PFT public :: collapse_crop_types ! Collapse unused crop types into types used in this run public :: collapse_crop_var ! Collapse crop variables according to cft weights determined in previous "collapse" subroutines public :: convert_pft_to_cft ! Conversion of crops from natural veg to CFT @@ -124,20 +124,21 @@ subroutine convert_cft_to_pft( begg, endg, cftsize, wt_cft ) ! !USES: use elm_varsur , only : wt_lunit, wt_nat_patch use elm_varpar , only : cft_size, surfpft_size - use pftvarcon , only : nc3crop + use elm_varpar , only : natpft_size use landunit_varcon , only : istsoil, istcrop use topounit_varcon , only : max_topounits ! !ARGUMENTS: implicit none integer , intent(in) :: begg, endg - integer , intent(in) :: cftsize ! CFT size + integer , intent(in) :: cftsize ! CFT size ! this could be wrong if by input real(r8) , intent(inout) :: wt_cft(begg:,:,:) ! CFT weights ! ! !LOCAL VARIABLES: integer :: g, t ! index !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(wt_cft ) == (/endg,max_topounits, cftsize /)), errMsg(__FILE__, __LINE__)) - SHR_ASSERT_ALL((ubound(wt_nat_patch) == (/endg,max_topounits, nc3crop+cftsize-1/)), errMsg(__FILE__, __LINE__)) + ! note (01-29-2024 by fmyuan@ornl.gov, cftsize --> elm_varpar:cft_size) + SHR_ASSERT_ALL((ubound(wt_cft ) == (/endg,max_topounits, cft_size /)), errMsg(__FILE__, __LINE__)) + SHR_ASSERT_ALL((ubound(wt_nat_patch) == (/endg,max_topounits, natpft_size+cft_size/)), errMsg(__FILE__, __LINE__)) do g = begg, endg do t = 1, max_topounits @@ -145,12 +146,12 @@ subroutine convert_cft_to_pft( begg, endg, cftsize, wt_cft ) ! Move CFT over to PFT and do weighted average of the crop and soil parts wt_nat_patch(g,t,:) = wt_nat_patch(g,t,:) * wt_lunit(g,t,istsoil) wt_cft(g,t,:) = wt_cft(g,t,:) * wt_lunit(g,t,istcrop) - wt_nat_patch(g,t,nc3crop:) = wt_cft(g,t,:) ! Add crop CFT's to end of natural veg PFT's - wt_lunit(g,t,istsoil) = (wt_lunit(g,t,istsoil) + wt_lunit(g,t,istcrop)) ! Add crop landunit to soil landunit + wt_nat_patch(g,t,natpft_size:) = wt_cft(g,t,:) ! Add crop CFT's to end of natural veg PFT's + wt_lunit(g,t,istsoil) = (wt_lunit(g,t,istsoil) + wt_lunit(g,t,istcrop)) ! Add crop landunit to soil landunit wt_nat_patch(g,t,:) = wt_nat_patch(g,t,:) / wt_lunit(g,t,istsoil) - wt_lunit(g,t,istcrop) = 0.0_r8 ! Zero out crop CFT's + wt_lunit(g,t,istcrop) = 0.0_r8 ! Zero out crop CFT's else - wt_nat_patch(g,t,nc3crop:) = 0.0_r8 ! Make sure generic crops are zeroed out + wt_nat_patch(g,t,natpft_size:) = 0.0_r8 ! Make sure generic crops are zeroed out end if end do end do @@ -171,7 +172,6 @@ subroutine convert_pft_to_cft( begg, endg ) use elm_varsur , only : wt_lunit, wt_nat_patch, wt_cft use elm_varpar , only : cft_size, surfpft_size use elm_varpar , only : cft_size, cft_lb, cft_ub, surfpft_lb, surfpft_ub - use pftvarcon , only : nc3crop use landunit_varcon , only : istsoil, istcrop use topounit_varcon , only : max_topounits ! !ARGUMENTS: @@ -309,8 +309,8 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose ! !USES: use elm_varctl , only : irrigate use elm_varpar , only : cft_lb, cft_ub, cft_size - use pftvarcon , only : nc3crop, nc3irrig, npcropmax, mergetoelmpft use pftvarcon , only: is_pft_known_to_model + use pftvarcon , only : npcropmax, mergetoelmpft, npcropmin use topounit_varcon , only : max_topounits ! TKT use GridcellType , only : grc_pp ! TKT ! @@ -369,10 +369,12 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose ! stride 2 ! where stride 2 means "every other" - do t = 1,max_topounits - wt_cft(g,t, nc3crop:npcropmax-1:2) = & - wt_cft(g,t, nc3crop:npcropmax-1:2) + wt_cft(g,t, nc3irrig:npcropmax:2) ! TKT - wt_cft(g,t, nc3irrig:npcropmax:2) = 0._r8 + do t = grc_pp%topi(g), grc_pp%topf(g) ! TKT + t2 = t - grc_pp%topi(g) + 1 + + wt_cft(g,t2, cft_lb:cft_ub-1:2) = & + wt_cft(g,t2, cft_lb:cft_ub-1:2) + wt_cft(g,t2, cft_lb+1:cft_ub:2) ! TKT + wt_cft(g,t2, cft_lb+1:cft_ub:2) = 0._r8 end do ! TKT end do From 4314a504beed21046772e05080cdbd9ddbb84a5c Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Tue, 30 Jan 2024 10:00:41 -0500 Subject: [PATCH 116/197] All PFT read-in constants are passed into VegetationProperties, i.e. veg_pp. Only difference may be actual number of PFTs due to surface data 'natpft' length less than physiology parameter length ('npft'). So it's shall be exactly same by 'use pftvarcon, only: ', or by 'veg_pp%'. This commit try to use either in one code file of .F90. --- components/elm/src/biogeochem/FireMod.F90 | 2 -- .../elm/src/biogeochem/GapMortalityMod.F90 | 1 - .../elm/src/biogeochem/VegStructUpdateMod.F90 | 1 - .../data_types/VegetationPropertiesType.F90 | 24 +++++++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/components/elm/src/biogeochem/FireMod.F90 b/components/elm/src/biogeochem/FireMod.F90 index 743141b2018..24e34e37c55 100644 --- a/components/elm/src/biogeochem/FireMod.F90 +++ b/components/elm/src/biogeochem/FireMod.F90 @@ -735,8 +735,6 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool is_litter => decomp_cascade_con%is_litter , & ! Input: [logical (:) ] TRUE => pool is a litter pool - !woody => veg_vp%woody , & ! Input: [real(r8) (:) ] woody lifeform (1=woody, 0=not woody) - cropf_col => cnstate_vars%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column croot_prof => cnstate_vars%croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots stem_prof => cnstate_vars%stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems diff --git a/components/elm/src/biogeochem/GapMortalityMod.F90 b/components/elm/src/biogeochem/GapMortalityMod.F90 index 31cd45814d6..3257a6365b6 100644 --- a/components/elm/src/biogeochem/GapMortalityMod.F90 +++ b/components/elm/src/biogeochem/GapMortalityMod.F90 @@ -110,7 +110,6 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & associate( & ivt => veg_pp%itype , & ! Input: [integer (:) ] pft vegetation type - woody => veg_vp%woody , & ! Input: [real(r8) (:) ] binary flag for woody lifeform croplive => crop_vars%croplive_patch & ! Input: [logical (:) ] flag, true if planted, not harvested ) diff --git a/components/elm/src/biogeochem/VegStructUpdateMod.F90 b/components/elm/src/biogeochem/VegStructUpdateMod.F90 index cd982139eef..de7062b810d 100644 --- a/components/elm/src/biogeochem/VegStructUpdateMod.F90 +++ b/components/elm/src/biogeochem/VegStructUpdateMod.F90 @@ -83,7 +83,6 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & associate( & ivt => veg_pp%itype , & ! Input: [integer (:) ] pft vegetation type - woody => veg_vp%woody , & ! Input: [real(r8) (:) ] binary flag for woody lifeform (1=woody, 0=not woody) slatop => veg_vp%slatop , & ! Input: [real(r8) (:) ] specific leaf area at top of canopy, projected area basis [m^2/gC] dsladlai => veg_vp%dsladlai , & ! Input: [real(r8) (:) ] dSLA/dLAI, projected area basis [m^2/gC] z0mr => veg_vp%z0mr , & ! Input: [real(r8) (:) ] ratio of momentum roughness length to canopy top height (-) diff --git a/components/elm/src/data_types/VegetationPropertiesType.F90 b/components/elm/src/data_types/VegetationPropertiesType.F90 index 2cb4e01c8a4..21d7ed671f3 100644 --- a/components/elm/src/data_types/VegetationPropertiesType.F90 +++ b/components/elm/src/data_types/VegetationPropertiesType.F90 @@ -143,6 +143,13 @@ module VegetationPropertiesType real(r8), pointer :: nstor(:) => null() !Nitrogen storage pool timescale real(r8), pointer :: br_xr(:) => null() !Base rate for excess respiration real(r8), pointer :: tc_stress => null() !Critial temperature for moisture stress + ! new properties for flexible PFT + real(r8), pointer :: climatezone(:) => null() !climate zone adapted + real(r8), pointer :: nonvascular(:) => null() !nonvascular type or vascular + real(r8), pointer :: graminoid(:) => null() !graminoid or not + real(r8), pointer :: generic_crop(:) => null() !generic crop or not for prognostic crop modules (?) + real(r8), pointer :: needleleaf(:) => null() !needleleaf or broadleaf + real(r8), pointer :: nfixer(:) => null() !cablity of nitrogen fixation from atm. N2 contains @@ -181,6 +188,8 @@ subroutine veg_vp_init(this) use pftvarcon , only : fnr, act25, kcha, koha, cpha, vcmaxha, jmaxha, tpuha use pftvarcon , only : lmrha, vcmaxhd, jmaxhd, tpuhd, lmrse, qe, theta_cj use pftvarcon , only : bbbopt, mbbopt, nstor, br_xr, tc_stress, lmrhd + ! new properties for flexible PFT + use pftvarcon , only : climatezone, nonvascular, graminoid, generic_crop,needleleaf, nfixer ! class (vegetation_properties_type) :: this @@ -305,6 +314,14 @@ subroutine veg_vp_init(this) allocate(this%tc_stress ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! new properties for flexible PFT + allocate( this%climatezone(0:numpft)) ; this%climatezone(:) =spval + allocate( this%nonvascular(0:numpft)) ; this%nonvascular(:) =spval + allocate( this%graminoid(0:numpft)) ; this%graminoid(:) =spval + allocate( this%generic_crop(0:numpft)) ; this%generic_crop(:) =spval + allocate( this%needleleaf(0:numpft)) ; this%needleleaf(:) =spval + allocate( this%nfixer(0:numpft)) ; this%nfixer(:) =spval + ! ----------------------------------------------------------------------------------------------------------- do m = 0,numpft @@ -393,6 +410,13 @@ subroutine veg_vp_init(this) this%mbbopt(m) = mbbopt(m) this%nstor(m) = nstor(m) this%br_xr(m) = br_xr(m) + ! new properties for flexible PFT + this%climatezone(m) = climatezone(m) + this%nonvascular(m) = nonvascular(m) + this%graminoid(m) = graminoid(m) + this%generic_crop(m) = generic_crop(m) + this%needleleaf(m) = needleleaf(m) + this%nfixer(m) = nfixer(m) end do From a0765f2dd4f96669d82fc1cf2b78b2449f086447 Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Tue, 31 Oct 2023 17:07:41 -0400 Subject: [PATCH 117/197] Fix of possible bugs in surfrdMod.F90 --- components/elm/src/main/surfrdMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/elm/src/main/surfrdMod.F90 b/components/elm/src/main/surfrdMod.F90 index 9cbcd4b2b8e..1a957e8cd38 100755 --- a/components/elm/src/main/surfrdMod.F90 +++ b/components/elm/src/main/surfrdMod.F90 @@ -1105,6 +1105,8 @@ subroutine surfrd_pftformat( begg, endg, ncid ) end if fert_p_cft = 0.0_r8 + wt_nat_patch(begg:endg, :, :) = 0.0_r8 + wt_cft(begg:endg, :, :) = 0.0_r8 if (.not. create_crop_landunit) then call ncd_io(ncid=ncid, varname='PCT_NAT_PFT', flag='read', data=wt_nat_patch, & dim1name=grlnd, readvar=readvar) From c5afb348b306b6bebc60389201a6d50340b2d37e Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Tue, 3 Jan 2023 16:06:50 -0500 Subject: [PATCH 118/197] Make natpft patch and croppft patch are merged correctly, especially when flexible length pfts are user-provided, and/or surfdata 'lsmpft' dimension is less than 'pft' dimension in parameter file. --- components/elm/src/main/elm_initializeMod.F90 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/elm/src/main/elm_initializeMod.F90 b/components/elm/src/main/elm_initializeMod.F90 index 86e72030b94..9fe4959c241 100755 --- a/components/elm/src/main/elm_initializeMod.F90 +++ b/components/elm/src/main/elm_initializeMod.F90 @@ -59,6 +59,7 @@ subroutine initialize1( ) ! !USES: use elm_varpar , only: elm_varpar_init, natpft_lb, natpft_ub use elm_varpar , only: cft_lb, cft_ub, maxpatch_glcmec + use elm_varpar , only: mxpft, numveg, mxpft_nc, numpft use elm_varpar , only: update_pft_array_bounds use elm_varpar , only: surfpft_lb, surfpft_ub use elm_varcon , only: elm_varcon_init @@ -293,6 +294,17 @@ subroutine initialize1( ) ! Independent of model resolution, Needs to stay before surfrd_get_data call pftconrd() + ! by user-defined PFT (numbers and names), 'numpft/mxpft_nc' changed and other indices + ! a few arrays had been allocated in elm_initializedMod.F90:L266-268 and require redo after this 'pftconrd' call + if ((numpft/=mxpft .or. numpft/=numveg) .or. (mxpft_nc/=24 .or. mxpft_nc/=numveg)) then + if (associated(wt_nat_patch)) deallocate(wt_nat_patch) + allocate (wt_nat_patch (begg:endg,1:max_topounits, surfpft_lb:surfpft_ub )) + if (associated(wt_cft)) deallocate(wt_cft) + allocate (wt_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) + if (associated(fert_cft)) deallocate(fert_cft) + allocate (fert_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) + endif + call soilorder_conrd() ! Read in FATES parameter values early in the call sequence as well From d01128e7e34b798cb175cdacfa057f0d913075c4 Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Tue, 30 Jan 2024 11:58:45 -0500 Subject: [PATCH 119/197] Edit added 'usrpft_codetest_I1850CNPRDCTCBC' test for e3sm_land_developer in effect. --- .../elm/usrpft_codetest_I1850CNPRDCTCBC/user_nl_elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_codetest_I1850CNPRDCTCBC/user_nl_elm b/components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_codetest_I1850CNPRDCTCBC/user_nl_elm index b2fef61a4be..921f5d7714b 100644 --- a/components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_codetest_I1850CNPRDCTCBC/user_nl_elm +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/usrpft_codetest_I1850CNPRDCTCBC/user_nl_elm @@ -1,5 +1,5 @@ fsurdat = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_42_FLUXNETSITES_simyr1850_c170912.nc' -paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/clm_params_c211124.nc' +! paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/clm_params_c211124.nc' ! ! When 'user-pft' codes ready, comment out the above line while let the following in. ! @@ -7,4 +7,4 @@ paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/clm_params_c211124.nc' ! woody=1 for tree, or =2 for shrub, and defined other pft flags: ! climatezone(0-4), nonvascular(0/1), graminoid(0/1), generic_crop(0/1), nfixer(0/1), needleleaf(0/1) ! for not going by default, changing one PFT name by appending '_unexpected'. -! paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/clm_params_c211124vpft.nc' + paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/clm_params_c211124vpft.nc' From 1cd6dff299d2200e983911605dc2561d61ea9d67 Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Wed, 4 Jan 2023 14:42:50 -0500 Subject: [PATCH 120/197] (optional) Vcmax25 at top canopy for each PFT is as an output variable. --- components/elm/src/biogeophys/PhotosynthesisMod.F90 | 4 ++++ components/elm/src/biogeophys/PhotosynthesisType.F90 | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/components/elm/src/biogeophys/PhotosynthesisMod.F90 b/components/elm/src/biogeophys/PhotosynthesisMod.F90 index f080c457fa3..aee433610da 100644 --- a/components/elm/src/biogeophys/PhotosynthesisMod.F90 +++ b/components/elm/src/biogeophys/PhotosynthesisMod.F90 @@ -387,6 +387,7 @@ subroutine Photosynthesis ( bounds, fn, filterp, & gb_mol => photosyns_vars%gb_mol_patch , & ! Output: [real(r8) (:) ] leaf boundary layer conductance (umol H2O/m**2/s) gs_mol => photosyns_vars%gs_mol_patch , & ! Output: [real(r8) (:,:) ] leaf stomatal conductance (umol H2O/m**2/s) vcmax_z => photosyns_vars%vcmax_z_patch , & ! Output: [real(r8) (:,:) ] maximum rate of carboxylation (umol co2/m**2/s) + vcmax25_top => photosyns_vars%vcmax25_top_patch , & ! Output: [real(r8) (:) ] maximum rate of carboxylation at top canopy at 25oC (umol co2/m**2/s) cp => photosyns_vars%cp_patch , & ! Output: [real(r8) (:) ] CO2 compensation point (Pa) kc => photosyns_vars%kc_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for CO2 (Pa) ko => photosyns_vars%ko_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for O2 (Pa) @@ -788,6 +789,9 @@ subroutine Photosynthesis ( bounds, fn, filterp, & vcmax_z(p,iv) = vcmax_z(p,iv) * btran(p) lmr_z(p,iv) = lmr_z(p,iv) * btran(p) + + ! output variable + vcmax25_top(p) = vcmax25top end do ! canopy layer loop end do ! patch loop diff --git a/components/elm/src/biogeophys/PhotosynthesisType.F90 b/components/elm/src/biogeophys/PhotosynthesisType.F90 index 59ae928c23a..5cb94628d8d 100644 --- a/components/elm/src/biogeophys/PhotosynthesisType.F90 +++ b/components/elm/src/biogeophys/PhotosynthesisType.F90 @@ -26,6 +26,7 @@ module PhotosynthesisType real(r8), pointer :: ag_patch (:,:) => null()! patch co-limited gross leaf photosynthesis (umol CO2/m**2/s) real(r8), pointer :: an_patch (:,:) => null()! patch net leaf photosynthesis (umol CO2/m**2/s) real(r8), pointer :: vcmax_z_patch (:,:) => null()! patch maximum rate of carboxylation (umol co2/m**2/s) + real(r8), pointer :: vcmax25_top_patch (:) => null()! patch maximum rate of carboxylation at top canopy at 25oC (umol co2/m**2/s) real(r8), pointer :: cp_patch (:) => null()! patch CO2 compensation point (Pa) real(r8), pointer :: kc_patch (:) => null()! patch Michaelis-Menten constant for CO2 (Pa) real(r8), pointer :: ko_patch (:) => null()! patch Michaelis-Menten constant for O2 (Pa) @@ -143,6 +144,7 @@ subroutine InitAllocate(this, bounds) allocate(this%ag_patch (begp:endp,1:nlevcan)) ; this%ag_patch (:,:) = spval allocate(this%an_patch (begp:endp,1:nlevcan)) ; this%an_patch (:,:) = spval allocate(this%vcmax_z_patch (begp:endp,1:nlevcan)) ; this%vcmax_z_patch (:,:) = spval + allocate(this%vcmax25_top_patch (begp:endp)) ; this%vcmax25_top_patch (:) = spval allocate(this%cp_patch (begp:endp)) ; this%cp_patch (:) = spval allocate(this%kc_patch (begp:endp)) ; this%kc_patch (:) = spval allocate(this%ko_patch (begp:endp)) ; this%ko_patch (:) = spval @@ -263,6 +265,12 @@ subroutine InitHistory(this, bounds) call hist_addfld1d (fname='PSNSHA', units='umolCO2/m^2/s', & avgflag='A', long_name='shaded leaf photosynthesis', & ptr_patch=this%psnsha_patch) + + this%vcmax25_top_patch(begp:endp) = spval + call hist_addfld1d (fname='VCMAX25TOP', units='umolCO2/m^2/s', & + avgflag='A', long_name='vcmax at top canopy at 25oC', & + ptr_patch=this%vcmax25_top_patch, default='inactive') + end if if ( use_c13 ) then @@ -423,6 +431,8 @@ subroutine TimeStepInit (this, bounds) this%psnsun_wj_patch(p) = 0._r8 this%psnsun_wp_patch(p) = 0._r8 + this%vcmax25_top_patch(p) = 0._r8 + this%psnsha_patch(p) = 0._r8 this%psnsha_wc_patch(p) = 0._r8 this%psnsha_wj_patch(p) = 0._r8 From 92077c1d238d3ebfc7a00aee1422d6e0ccbf601f Mon Sep 17 00:00:00 2001 From: "Yuan, Fengming" Date: Tue, 12 Mar 2024 14:36:02 -0400 Subject: [PATCH 121/197] crop and perenial crop pft flag, 'iscft', is added so that crop pft indexing may be not in need anymore. --- .../elm/src/biogeochem/AllocationMod.F90 | 40 ++++++------- .../src/biogeochem/CNAllocationBetrMod.F90 | 40 ++++++------- .../elm/src/biogeochem/CNCarbonFluxType.F90 | 16 +++--- .../elm/src/biogeochem/CNCarbonStateType.F90 | 8 +-- .../src/biogeochem/CNGapMortalityBeTRMod.F90 | 6 +- .../src/biogeochem/CNNStateUpdate1BeTRMod.F90 | 10 ++-- .../src/biogeochem/CNNStateUpdate2BeTRMod.F90 | 4 +- .../elm/src/biogeochem/CNNitrogenFluxType.F90 | 2 +- .../src/biogeochem/CNNitrogenStateType.F90 | 6 +- .../elm/src/biogeochem/CNPhenologyBeTRMod.F90 | 11 +++- .../src/biogeochem/CarbonStateUpdate1Mod.F90 | 29 ++++------ .../src/biogeochem/CarbonStateUpdate2Mod.F90 | 4 +- components/elm/src/biogeochem/CropType.F90 | 4 +- .../elm/src/biogeochem/DryDepVelocity.F90 | 6 +- components/elm/src/biogeochem/FireMod.F90 | 27 +++------ .../elm/src/biogeochem/GapMortalityMod.F90 | 12 ++-- .../elm/src/biogeochem/GrowthRespMod.F90 | 4 +- .../elm/src/biogeochem/MaintenanceRespMod.F90 | 4 +- .../biogeochem/NitrogenStateUpdate1Mod.F90 | 14 ++--- .../biogeochem/NitrogenStateUpdate2Mod.F90 | 4 +- .../src/biogeochem/PhenologyFluxLimitMod.F90 | 24 ++++---- .../elm/src/biogeochem/PhenologyMod.F90 | 40 +++++++------ .../elm/src/biogeochem/PhosphorusFluxType.F90 | 1 - .../src/biogeochem/PhosphorusStateType.F90 | 4 +- .../biogeochem/PhosphorusStateUpdate1Mod.F90 | 14 ++--- .../biogeochem/PhosphorusStateUpdate2Mod.F90 | 4 +- .../src/biogeochem/PrecisionControlMod.F90 | 10 +--- .../elm/src/biogeochem/RootDynamicsMod.F90 | 4 +- .../elm/src/biogeochem/VOCEmissionMod.F90 | 5 +- .../elm/src/biogeochem/VegStructUpdateMod.F90 | 7 +-- components/elm/src/biogeophys/SedYieldMod.F90 | 10 +--- .../elm/src/data_types/VegetationDataType.F90 | 29 +++++----- .../data_types/VegetationPropertiesType.F90 | 8 +-- components/elm/src/main/filterMod.F90 | 8 +-- components/elm/src/main/pftvarcon.F90 | 57 ++++++++----------- components/elm/src/main/surfrdMod.F90 | 2 + components/elm/src/main/surfrdUtilsMod.F90 | 2 +- 37 files changed, 221 insertions(+), 259 deletions(-) diff --git a/components/elm/src/biogeochem/AllocationMod.F90 b/components/elm/src/biogeochem/AllocationMod.F90 index a31a07cd8f6..0110367f59c 100644 --- a/components/elm/src/biogeochem/AllocationMod.F90 +++ b/components/elm/src/biogeochem/AllocationMod.F90 @@ -386,7 +386,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp use elm_varctl , only : carbonphosphorus_only! use pftvarcon , only: npcropmin, declfact, bfact, aleaff, arootf, astemf, noveg use pftvarcon , only: arooti, fleafi, allconsl, allconss, grperc, grpnow, nsoybean - use pftvarcon , only: percrop + use pftvarcon , only: iscft, percrop use elm_varpar , only: nlevdecomp use elm_varcon , only: nitrif_n2o_loss_frac, secspday ! @@ -585,7 +585,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp mr = leaf_mr(p) + froot_mr(p) if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (ivt(p) >= npcropmin) then + else if (iscft(ivt(p)) >= 1) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) end if @@ -672,7 +672,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp f5 = 0._r8 ! continued intializations from above - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops if (croplive(p) .and. percrop(ivt(p)) == 0.0_r8 ) then ! same phases appear in subroutine CropPhenology @@ -822,7 +822,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + & (f3*(1._r8-f4)*(1._r8+f2))/cpdw - else if (ivt(p) >= npcropmin) then ! skip generic crops + else if (iscft(ivt(p)) >= 1) then ! skip generic crops cng = graincn(ivt(p)) cpg = graincp(ivt(p)) c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) @@ -852,10 +852,10 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp ! retransn pool has N from leaves, stems, and roots for ! retranslocation - if (ivt(p) >= npcropmin .and. grain_flag(p) == 1._r8) then + if (iscft(ivt(p)) >= 1 .and. grain_flag(p) == 1._r8) then avail_retransn(p) = plant_ndemand(p) avail_retransp(p) = plant_pdemand(p) - else if (ivt(p) < npcropmin .and. annsum_potential_gpp(p) > 0._r8) then + else if (iscft(ivt(p)) < 1 .and. annsum_potential_gpp(p) > 0._r8) then avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt avail_retransp(p) = (annmax_retransp(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt else @@ -1859,7 +1859,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & !$acc routine seq use elm_varctl , only: iulog use pftvarcon , only: noveg - use pftvarcon , only: npcropmin, grperc, grpnow + use pftvarcon , only: iscft, grperc, grpnow use elm_varpar , only: nlevdecomp use elm_varcon , only: nitrif_n2o_loss_frac, secspday ! @@ -2142,7 +2142,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & fcur = fcur2(ivt(p)) - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops if (croplive(p)) then f1 = aroot(p) / aleaf(p) f3 = astem(p) / aleaf(p) @@ -2328,7 +2328,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & fcur = fcur2(ivt(p)) - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops if (croplive(p)) then f1 = aroot(p) / aleaf(p) f3 = astem(p) / aleaf(p) @@ -2345,10 +2345,10 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & sminn_to_npool(p) = sminn_to_plant_patch(p) sminp_to_ppool(p) = sminp_to_plant_patch(p) - if (ivt(p) >= npcropmin .and. grain_flag(p) == 1._r8) then + if (iscft(ivt(p)) >= 1 .and. grain_flag(p) == 1._r8) then avail_retransn(p) = retransn(p)/dt avail_retransp(p) = retransp(p)/dt - else if (ivt(p) < npcropmin .and. annsum_potential_gpp(p) > 0._r8) then + else if (iscft(ivt(p)) < 1 .and. annsum_potential_gpp(p) > 0._r8) then avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt avail_retransp(p) = (annmax_retransp(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt else @@ -2374,7 +2374,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & mr = leaf_mr(p) + froot_mr(p) if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (ivt(p) >= npcropmin) then + else if (iscft(ivt(p)) >= 1) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) end if @@ -2473,7 +2473,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + & (f3*(1._r8-f4)*(1._r8+f2))/cpdw - else if (ivt(p) >= npcropmin) then ! skip generic crops + else if (iscft(ivt(p)) >= 1) then ! skip generic crops cng = graincn(ivt(p)) cpg = graincp(ivt(p)) c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) @@ -2559,7 +2559,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f2 * f3 * (1._r8 - f4) * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) * (1 + g1) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * (1._r8 - fcur) * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * (1._r8 - f4) * fcur * (1 + g1) @@ -2590,7 +2590,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpool_to_livestemc(p) = nlc * f3 * f4 * fcur cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur @@ -2643,7 +2643,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cng = graincn(ivt(p)) npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) @@ -2687,7 +2687,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_deadcrootp(p) = (nlc * f2 * f3 * (1._r8 - f4) / cpdw)* fcur ppool_to_deadcrootp_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cpdw)* (1._r8 - fcur) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpg = graincp(ivt(p)) ppool_to_livestemp(p) = (nlc * f3 * f4 / cplw) * fcur ppool_to_livestemp_storage(p) = (nlc * f3 * f4 / cplw) * (1._r8 -fcur) @@ -2717,7 +2717,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) gresp_storage = gresp_storage + cpool_to_deadcrootc_storage(p) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) gresp_storage = gresp_storage + cpool_to_grainc_storage(p) end if @@ -2771,7 +2771,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_deadcrootn(p) = cpool_to_deadcrootc(p) / cndw npool_to_deadcrootn_storage(p) = cpool_to_deadcrootc_storage(p) / cndw end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cng = graincn(ivt(p)) supplement_to_plantn(p) = supplement_to_plantn(p) + cpool_to_livestemc(p) / cnlw - npool_to_livestemn(p) supplement_to_plantn(p) = supplement_to_plantn(p) + cpool_to_livestemc_storage(p) / cnlw & @@ -2843,7 +2843,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_deadcrootp(p) = cpool_to_deadcrootc(p) / cpdw ppool_to_deadcrootp_storage(p) = cpool_to_deadcrootc_storage(p) / cpdw end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpg = graincp(ivt(p)) supplement_to_plantp(p) = supplement_to_plantp(p) + max(cpool_to_livestemc(p) / cplw & - ppool_to_livestemp(p),0._r8) diff --git a/components/elm/src/biogeochem/CNAllocationBetrMod.F90 b/components/elm/src/biogeochem/CNAllocationBetrMod.F90 index 42fad84a9d1..cc8b72046a1 100644 --- a/components/elm/src/biogeochem/CNAllocationBetrMod.F90 +++ b/components/elm/src/biogeochem/CNAllocationBetrMod.F90 @@ -246,7 +246,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp use shr_sys_mod , only: shr_sys_flush use elm_varctl , only: iulog,cnallocate_carbon_only,cnallocate_carbonnitrogen_only,& cnallocate_carbonphosphorus_only - use pftvarcon , only: npcropmin, declfact, bfact, aleaff, arootf, astemf, noveg + use pftvarcon , only: iscft, declfact, bfact, aleaff, arootf, astemf, noveg use pftvarcon , only: arooti, fleafi, allconsl, allconss, grperc, grpnow, nsoybean use elm_varpar , only: nlevdecomp use elm_varcon , only: nitrif_n2o_loss_frac, secspday @@ -645,7 +645,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp mr = leaf_mr(p) + froot_mr(p) if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (ivt(p) >= npcropmin) then + else if (iscft(ivt(p)) >= 1) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) end if @@ -726,7 +726,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp f5 = 0._r8 ! continued intializations from above - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops if (croplive(p)) then ! same phases appear in subroutine CropPhenology @@ -859,7 +859,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + & (f3*(1._r8-f4)*(1._r8+f2))/cpdw - else if (ivt(p) >= npcropmin) then ! skip generic crops + else if (iscft(ivt(p)) >= 1) then ! skip generic crops cng = graincn(ivt(p)) cpg = graincp(ivt(p)) c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) @@ -889,10 +889,10 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp ! retransn pool has N from leaves, stems, and roots for ! retranslocation - if (ivt(p) >= npcropmin .and. grain_flag(p) == 1._r8) then + if (iscft(ivt(p)) >= 1 .and. grain_flag(p) == 1._r8) then avail_retransn(p) = plant_ndemand(p) avail_retransp(p) = plant_pdemand(p) - else if (ivt(p) < npcropmin .and. annsum_potential_gpp(p) > 0._r8) then + else if (iscft(ivt(p)) < 1 .and. annsum_potential_gpp(p) > 0._r8) then avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt avail_retransp(p) = (annmax_retransp(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt else @@ -1105,10 +1105,10 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & use shr_sys_mod , only: shr_sys_flush use elm_varctl , only: iulog,cnallocate_carbon_only,cnallocate_carbonnitrogen_only,& cnallocate_carbonphosphorus_only -! use pftvarcon , only: npcropmin, declfact, bfact, aleaff, arootf, astemf +! use pftvarcon , only: iscft, declfact, bfact, aleaff, arootf, astemf ! use pftvarcon , only: arooti, fleafi, allconsl, allconss, grperc, grpnow, nsoybean use pftvarcon , only: noveg - use pftvarcon , only: npcropmin, grperc, grpnow + use pftvarcon , only: iscft, grperc, grpnow use elm_varpar , only: nlevdecomp !!nlevsoi, use elm_varcon , only: nitrif_n2o_loss_frac, secspday ! use landunit_varcon , only: istsoil, istcrop @@ -1393,7 +1393,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & fcur = fcur2(ivt(p)) - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops if (croplive(p)) then f1 = aroot(p) / aleaf(p) f3 = astem(p) / aleaf(p) @@ -1412,10 +1412,10 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & plant_n_buffer_patch(p) = plant_n_buffer_patch(p) * (1._r8-dt/taun) plant_p_buffer_patch(p) = plant_p_buffer_patch(p) * (1._r8-dt/taun) - if (ivt(p) >= npcropmin .and. grain_flag(p) == 1._r8) then + if (iscft(ivt(p)) >= 1 .and. grain_flag(p) == 1._r8) then avail_retransn(p) = retransn(p)/dt avail_retransp(p) = retransp(p)/dt - else if (ivt(p) < npcropmin .and. annsum_potential_gpp(p) > 0._r8) then + else if (iscft(ivt(p)) < 1 .and. annsum_potential_gpp(p) > 0._r8) then avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt avail_retransp(p) = (annmax_retransp(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt else @@ -1436,7 +1436,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & mr = leaf_mr(p) + froot_mr(p) if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (ivt(p) >= npcropmin) then + else if (iscft(ivt(p)) >= 1) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) end if ! try to take mr from xsmr storage pool first @@ -1530,7 +1530,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + & (f3*(1._r8-f4)*(1._r8+f2))/cpdw - else if (ivt(p) >= npcropmin) then ! skip generic crops + else if (iscft(ivt(p)) >= 1) then ! skip generic crops cng = graincn(ivt(p)) cpg = graincp(ivt(p)) c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) @@ -1614,7 +1614,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f2 * f3 * (1._r8 - f4) * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) * (1 + g1) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * (1._r8 - fcur) * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * (1._r8 - f4) * fcur * (1 + g1) @@ -1645,7 +1645,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpool_to_livestemc(p) = nlc * f3 * f4 * fcur cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur @@ -1698,7 +1698,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cng = graincn(ivt(p)) npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) @@ -1742,7 +1742,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_deadcrootp(p) = (nlc * f2 * f3 * (1._r8 - f4) / cpdw)* fcur ppool_to_deadcrootp_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cpdw)* (1._r8 - fcur) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpg = graincp(ivt(p)) ppool_to_livestemp(p) = (nlc * f3 * f4 / cplw) * fcur ppool_to_livestemp_storage(p) = (nlc * f3 * f4 / cplw) * (1._r8 -fcur) @@ -1772,7 +1772,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) gresp_storage = gresp_storage + cpool_to_deadcrootc_storage(p) end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) gresp_storage = gresp_storage + cpool_to_grainc_storage(p) end if @@ -1820,7 +1820,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_deadcrootn(p) = cpool_to_deadcrootc(p) / cndw npool_to_deadcrootn_storage(p) = cpool_to_deadcrootc_storage(p) / cndw end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cng = graincn(ivt(p)) supplement_to_sminn_vr(c,1) = supplement_to_sminn_vr(c,1) + cpool_to_livestemc(p) / cnlw - npool_to_livestemn(p) supplement_to_sminn_vr(c,1) = supplement_to_sminn_vr(c,1) + cpool_to_livestemc_storage(p) / cnlw & @@ -1891,7 +1891,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_deadcrootp(p) = cpool_to_deadcrootc(p) / cpdw ppool_to_deadcrootp_storage(p) = cpool_to_deadcrootc_storage(p) / cpdw end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpg = graincp(ivt(p)) supplement_to_sminp_vr(c,1) = supplement_to_sminp_vr(c,1) + max(cpool_to_livestemc(p) / cplw & - ppool_to_livestemp(p),0._r8) diff --git a/components/elm/src/biogeochem/CNCarbonFluxType.F90 b/components/elm/src/biogeochem/CNCarbonFluxType.F90 index 092af4fa66b..61a3f736f62 100644 --- a/components/elm/src/biogeochem/CNCarbonFluxType.F90 +++ b/components/elm/src/biogeochem/CNCarbonFluxType.F90 @@ -10,7 +10,7 @@ module CNCarbonFluxType use landunit_varcon , only : istsoil, istcrop, istdlak use elm_varctl , only : use_c13, use_fates use CH4varcon , only : allowlakeprod - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft use CNDecompCascadeConType , only : decomp_cascade_con use VegetationType , only : veg_pp use ColumnType , only : col_pp @@ -1675,7 +1675,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%cpool_livecroot_storage_gr_patch(p) + & this%cpool_deadcroot_storage_gr_patch(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%mr_patch(p) = & this%mr_patch(p) + & this%grain_mr_patch(p) @@ -1700,7 +1700,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%storage_gr_patch(p) ! autotrophic respiration (AR) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%ar_patch(p) = & this%mr_patch(p) + & this%gr_patch(p) + & @@ -1812,7 +1812,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%wood_harvestc_patch(p) = & this%hrv_deadstemc_to_prod10c_patch(p) + & this%hrv_deadstemc_to_prod100c_patch(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%wood_harvestc_patch(p) = & this%wood_harvestc_patch(p) + & this%hrv_cropc_to_prod1c_patch(p) @@ -1842,7 +1842,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%m_gresp_xfer_to_fire_patch(p) + & this%m_cpool_to_fire_patch(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%litfall_patch(p) = & this%litfall_patch(p) + & @@ -1878,7 +1878,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%hrv_leafc_to_litter_patch(p) + & this%leafc_to_litter_patch(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%leafc_loss_patch(p) = & this%leafc_loss_patch(p) + & this%hrv_leafc_to_prod1c_patch(p) @@ -1920,7 +1920,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%hrv_deadcrootc_storage_to_litter_patch(p) + & this%hrv_deadcrootc_xfer_to_litter_patch(p) ! putting the harvested crop stem and grain in the wood loss bdrewniak - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%woodc_loss_patch(p) = & this%woodc_loss_patch(p) + & this%hrv_grainc_to_prod1c_patch(p) + & @@ -2592,7 +2592,7 @@ subroutine summary_cflux_for_ch4( this, bounds, num_soilp, filter_soilp, num_soi this%cpool_to_deadstemc_patch(p) + & this%deadstemc_xfer_to_deadstemc_patch(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%agnpp_patch(p) = & this%agnpp_patch(p) + & this%cpool_to_grainc_patch(p) + & diff --git a/components/elm/src/biogeochem/CNCarbonStateType.F90 b/components/elm/src/biogeochem/CNCarbonStateType.F90 index 8f258bbb6a9..46440bee235 100644 --- a/components/elm/src/biogeochem/CNCarbonStateType.F90 +++ b/components/elm/src/biogeochem/CNCarbonStateType.F90 @@ -12,7 +12,7 @@ module CNCarbonStateType use elm_varctl , only : iulog, use_vertsoilc, spinup_state use decompMod , only : bounds_type use CNStateType , only : cnstate_type - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft use CNDecompCascadeConType , only : decomp_cascade_con use VegetationPropertiesType , only : veg_vp use abortutils , only : endrun @@ -400,7 +400,7 @@ subroutine InitCold(this, bounds, ratio, c12_carbonstate_vars) ! ! !USES: use landunit_varcon , only: istsoil - use pftvarcon , only: noveg, npcropmin + use pftvarcon , only: noveg ! ! !ARGUMENTS: class(carbonstate_type) :: this @@ -459,7 +459,7 @@ subroutine InitCold(this, bounds, ratio, c12_carbonstate_vars) if (veg_vp%evergreen(veg_pp%itype(p)) == 1._r8) then this%leafc_patch(p) = 1._r8 * ratio this%leafc_storage_patch(p) = 0._r8 - else if (veg_pp%itype(p) >= npcropmin) then ! prognostic crop types + else if (iscft(veg_pp%itype(p)) >= 1) then ! prognostic crop types this%leafc_patch(p) = 0._r8 this%leafc_storage_patch(p) = 0._r8 else @@ -866,7 +866,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%gresp_storage_patch(p) + & this%gresp_xfer_patch(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%storvegc_patch(p) = & this%storvegc_patch(p) + & this%grainc_storage_patch(p) + & diff --git a/components/elm/src/biogeochem/CNGapMortalityBeTRMod.F90 b/components/elm/src/biogeochem/CNGapMortalityBeTRMod.F90 index e3965d6eea3..370e82ab7ff 100644 --- a/components/elm/src/biogeochem/CNGapMortalityBeTRMod.F90 +++ b/components/elm/src/biogeochem/CNGapMortalityBeTRMod.F90 @@ -91,7 +91,7 @@ subroutine CNGapMortality (& ! !USES: use elm_time_manager , only: get_days_per_year use elm_varcon , only: secspday - use pftvarcon , only: npcropmin + use pftvarcon , only: iscft use elm_varctl , only: spinup_state, spinup_mortality_factor ! ! !ARGUMENTS: @@ -188,7 +188,7 @@ subroutine CNGapMortality (& * gap_indicator(gid_m_deadcrootn_to_litter) - if (ivt(p) < npcropmin) then + if (iscft(veg_pp%itype(p)) < 1) then veg_nf%m_retransn_to_litter(p) = veg_ns%retransn(p) * m & * gap_indicator(gid_m_retransn_to_litter) end if @@ -239,7 +239,7 @@ subroutine CNGapMortality (& veg_pf%m_deadstemp_to_litter(p) = veg_ps%deadstemp(p) * m veg_pf%m_livecrootp_to_litter(p) = veg_ps%livecrootp(p) * m veg_pf%m_deadcrootp_to_litter(p) = veg_ps%deadcrootp(p) * m - if (ivt(p) < npcropmin) then + if (iscft(veg_pp%itype(p)) < 1) then veg_pf%m_retransp_to_litter(p) = veg_ps%retransp(p) * m end if diff --git a/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 b/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 index 4c7fd83d210..f2a431e7283 100644 --- a/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 +++ b/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 @@ -10,7 +10,7 @@ module CNNStateUpdate1BeTRMod use elm_varpar , only : crop_prog, i_met_lit, i_cel_lit, i_lig_lit, i_cwd use elm_varctl , only : iulog use elm_varcon , only : nitrif_n2o_loss_frac - use pftvarcon , only : crop, generic_crop + use pftvarcon , only : iscft use VegetationPropertiesType , only : veg_vp use CNDecompCascadeConType , only : decomp_cascade_con use CNStateType , only : cnstate_type @@ -101,7 +101,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) - veg_nf%deadcrootn_xfer_to_deadcrootn(p)*dt end if - if (crop(ivt(p)) >= 1 .and. generic_crop(ivt(p)) < 1) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) - veg_nf%livestemn_xfer_to_livestemn(p)*dt @@ -126,7 +126,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%livecrootn(p) = veg_ns%livecrootn(p) - veg_nf%livecrootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%livecrootn_to_retransn(p)*dt end if - if (crop(ivt(p)) >= 1 .and. generic_crop(ivt(p)) < 1) then ! Beth adds retrans from froot + if (iscft(ivt(p)) >= 1) then ! Beth adds retrans from froot veg_ns%frootn(p) = veg_ns%frootn(p) - veg_nf%frootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%frootn_to_retransn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_litter(p)*dt @@ -172,7 +172,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_storage(p) = veg_ns%deadcrootn_storage(p) + veg_nf%npool_to_deadcrootn_storage(p)*dt end if - if (crop(ivt(p)) >= 1 .and. generic_crop(ivt(p)) < 1) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%npool_to_livestemn(p)*dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn_storage(p)*dt @@ -200,7 +200,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) + veg_nf%deadcrootn_storage_to_xfer(p)*dt end if - if (crop(ivt(p)) >= 1 .and. generic_crop(ivt(p)) < 1) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn_storage(p) = veg_ns%livestemn_storage(p) - veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) + veg_nf%livestemn_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/CNNStateUpdate2BeTRMod.F90 b/components/elm/src/biogeochem/CNNStateUpdate2BeTRMod.F90 index 60100b657ae..fbfa6110d77 100644 --- a/components/elm/src/biogeochem/CNNStateUpdate2BeTRMod.F90 +++ b/components/elm/src/biogeochem/CNNStateUpdate2BeTRMod.F90 @@ -14,7 +14,7 @@ module CNNStateUpdate2BeTRMod use CNNitrogenFLuxType , only : nitrogenflux_type use VegetationType , only : veg_pp use VegetationDataType , only : veg_ns, veg_nf - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft !! bgc interface & pflotran: use elm_varctl , only : use_pflotran, pf_cmode ! @@ -147,7 +147,7 @@ subroutine NStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn(p) = veg_ns%deadcrootn(p) - veg_nf%hrv_deadcrootn_to_litter(p) * dt veg_ns%retransn(p) = veg_ns%retransn(p) - veg_nf%hrv_retransn_to_litter(p) * dt - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >=1) then ! skip 2 generic crops veg_ns%livestemn(p)= veg_ns%livestemn(p) - veg_nf%hrv_livestemn_to_prod1n(p) * dt veg_ns%leafn(p) = veg_ns%leafn(p) - veg_nf%hrv_leafn_to_prod1n(p) * dt veg_ns%grainn(p) = veg_ns%grainn(p) - veg_nf%hrv_grainn_to_prod1n(p) * dt diff --git a/components/elm/src/biogeochem/CNNitrogenFluxType.F90 b/components/elm/src/biogeochem/CNNitrogenFluxType.F90 index d0b76c195af..b6f02ce91f8 100644 --- a/components/elm/src/biogeochem/CNNitrogenFluxType.F90 +++ b/components/elm/src/biogeochem/CNNitrogenFluxType.F90 @@ -1078,7 +1078,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil ! !USES: use elm_varpar , only: nlevdecomp,ndecomp_cascade_transitions,ndecomp_pools use subgridAveMod , only: p2c - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft use tracer_varcon , only: is_active_betr_bgc use elm_varpar , only: nlevdecomp_full ! diff --git a/components/elm/src/biogeochem/CNNitrogenStateType.F90 b/components/elm/src/biogeochem/CNNitrogenStateType.F90 index dda6477899a..041c757ae59 100644 --- a/components/elm/src/biogeochem/CNNitrogenStateType.F90 +++ b/components/elm/src/biogeochem/CNNitrogenStateType.F90 @@ -12,7 +12,7 @@ module CNNitrogenStateType use elm_varctl , only : use_vertsoilc, use_century_decomp, use_fan use elm_varctl , only : iulog, override_bgc_restart_mismatch_dump, spinup_state use decompMod , only : bounds_type - use pftvarcon , only : npcropmin, nstor + use pftvarcon , only : iscft, nstor use CNDecompCascadeConType , only : decomp_cascade_con use VegetationPropertiesType , only : veg_vp use abortutils , only : endrun @@ -502,7 +502,7 @@ subroutine InitCold(this, bounds, & ! !USES: use elm_varpar , only : crop_prog use decompMod , only : bounds_type - use pftvarcon , only : noveg, npcropmin + use pftvarcon , only : noveg, iscft ! ! !ARGUMENTS: class(nitrogenstate_type) :: this @@ -1007,7 +1007,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%npool_patch(p) + & this%retransn_patch(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%dispvegn_patch(p) = & this%dispvegn_patch(p) + & this%grainn_patch(p) diff --git a/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 b/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 index 23f461ad305..aaeb58d9ee9 100644 --- a/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 +++ b/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 @@ -1868,7 +1868,8 @@ subroutine CropPhenologyInit(bounds) ! initialized, and after ecophyscon file is read in. ! ! !USES: - use pftvarcon , only: npcropmin, npcropmax, mnNHplantdate + use elm_varpar , only : mxpft + use pftvarcon , only: iscft, crop, mnNHplantdate use pftvarcon , only: mnSHplantdate, mxNHplantdate use pftvarcon , only: mxSHplantdate use elm_time_manager, only: get_calday @@ -1893,13 +1894,17 @@ subroutine CropPhenologyInit(bounds) ! Convert planting dates into julian day minplantjday(:,:) = huge(1) maxplantjday(:,:) = huge(1) - do n = npcropmin, npcropmax + do n = 0, mxpft + if (iscft(n)>=1) then minplantjday(n,inNH) = int( get_calday( mnNHplantdate(n), 0 ) ) maxplantjday(n,inNH) = int( get_calday( mxNHplantdate(n), 0 ) ) + end if end do - do n = npcropmin, npcropmax + do n = 0, mxpft + if (iscft(n)>=1) then minplantjday(n,inSH) = int( get_calday( mnSHplantdate(n), 0 ) ) maxplantjday(n,inSH) = int( get_calday( mxSHplantdate(n), 0 ) ) + end if end do ! Figure out what hemisphere each PFT is in diff --git a/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 b/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 index 25455dbbb20..7513662f467 100644 --- a/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 @@ -11,7 +11,7 @@ module CarbonStateUpdate1Mod use elm_varcon , only : dzsoi_decomp use elm_varctl , only : nu_com, use_c13, use_c14 use elm_varctl , only : use_pflotran, pf_cmode, use_fates - use pftvarcon , only : crop, generic_crop, percrop + use pftvarcon , only : iscft use CNDecompCascadeConType , only : decomp_cascade_type use CNStateType , only : cnstate_type use CNDecompCascadeConType , only : decomp_cascade_con @@ -284,8 +284,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%deadcrootc(p) = veg_cs%deadcrootc(p) + veg_cf%deadcrootc_xfer_to_deadcrootc(p)*dt veg_cs%deadcrootc_xfer(p) = veg_cs%deadcrootc_xfer(p) - veg_cf%deadcrootc_xfer_to_deadcrootc(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%livestemc_xfer_to_livestemc(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) - veg_cf%livestemc_xfer_to_livestemc(p)*dt @@ -304,8 +303,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%livecrootc(p) = veg_cs%livecrootc(p) - veg_cf%livecrootc_to_deadcrootc(p)*dt veg_cs%deadcrootc(p) = veg_cs%deadcrootc(p) + veg_cf%livecrootc_to_deadcrootc(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_cs%livestemc(p) = veg_cs%livestemc(p) - veg_cf%livestemc_to_litter(p)*dt veg_cs%grainc(p) = veg_cs%grainc(p) - veg_cf%grainc_to_food(p)*dt @@ -321,8 +319,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livestem_curmr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livecroot_curmr(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livestem_curmr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%grain_curmr(p)*dt end if @@ -340,8 +337,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livestem_xsmr(p)*dt veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livecroot_xsmr(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livestem_xsmr(p)*dt veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%grain_xsmr(p)*dt if (harvdate(p) < 999) then ! beginning at harvest, send to atm @@ -377,8 +373,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_deadcrootc_storage(p)*dt veg_cs%deadcrootc_storage(p) = veg_cs%deadcrootc_storage(p) + veg_cf%cpool_to_deadcrootc_storage(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if ( iscft(ivt(p)) >= 1 ) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_livestemc(p)*dt veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%cpool_to_livestemc(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_livestemc_storage(p)*dt @@ -398,8 +393,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livecroot_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_deadcroot_gr(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livestem_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_grain_gr(p)*dt end if @@ -413,8 +407,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_livecroot_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_deadcroot_gr(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_livestem_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_grain_gr(p)*dt end if @@ -428,8 +421,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livecroot_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_deadcroot_storage_gr(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if ( iscft(ivt(p)) >= 1 ) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livestem_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_grain_storage_gr(p)*dt end if @@ -455,8 +447,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%gresp_storage(p) = veg_cs%gresp_storage(p) - veg_cf%gresp_storage_to_xfer(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) + veg_cf%gresp_storage_to_xfer(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if ( iscft(ivt(p)) >= 1 ) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_cs%livestemc_storage(p) = veg_cs%livestemc_storage(p) - veg_cf%livestemc_storage_to_xfer(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) + veg_cf%livestemc_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/CarbonStateUpdate2Mod.F90 b/components/elm/src/biogeochem/CarbonStateUpdate2Mod.F90 index 48174fb8ddf..985c544d29f 100644 --- a/components/elm/src/biogeochem/CarbonStateUpdate2Mod.F90 +++ b/components/elm/src/biogeochem/CarbonStateUpdate2Mod.F90 @@ -9,7 +9,7 @@ module CarbonStateUpdate2Mod use shr_log_mod , only : errMsg => shr_log_errMsg use abortutils , only : endrun use elm_varpar , only : nlevdecomp, i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft use elm_varctl , only : use_pflotran, pf_cmode use VegetationType , only : veg_pp use tracer_varcon , only : is_active_betr_bgc @@ -186,7 +186,7 @@ subroutine CarbonStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, veg_cs%deadcrootc(p) = veg_cs%deadcrootc(p) - veg_cf%hrv_deadcrootc_to_litter(p) * dt ! crops - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_cs%livestemc(p) = veg_cs%livestemc(p) - veg_cf%hrv_livestemc_to_prod1c(p) *dt veg_cs%leafc(p) = veg_cs%leafc(p) - veg_cf%hrv_leafc_to_prod1c(p) *dt veg_cs%grainc(p) = veg_cs%grainc(p) - veg_cf%hrv_grainc_to_prod1c(p) *dt diff --git a/components/elm/src/biogeochem/CropType.F90 b/components/elm/src/biogeochem/CropType.F90 index bc3d8c44ff4..58f7757e5fc 100644 --- a/components/elm/src/biogeochem/CropType.F90 +++ b/components/elm/src/biogeochem/CropType.F90 @@ -417,7 +417,7 @@ subroutine Restart(this, bounds, ncid, flag) use restUtilMod use ncdio_pio use VegetationType , only : veg_pp - use pftvarcon , only : npcropmin, npcropmax + use pftvarcon , only : iscft ! ! !ARGUMENTS: class(crop_type), intent(inout) :: this @@ -454,7 +454,7 @@ subroutine Restart(this, bounds, ncid, flag) interpinic_flag='copy', readvar=readvar, data=restyear) if (readvar) then do p = bounds%begp, bounds%endp - if (veg_pp%itype(p) >= npcropmin .and. veg_pp%itype(p) <= npcropmax .and. & + if (iscft(veg_pp%itype(p)) >= 1 .and. & veg_pp%active(p)) then this%nyrs_crop_active_patch(p) = restyear end if diff --git a/components/elm/src/biogeochem/DryDepVelocity.F90 b/components/elm/src/biogeochem/DryDepVelocity.F90 index 293713da54a..a79792b4e85 100644 --- a/components/elm/src/biogeochem/DryDepVelocity.F90 +++ b/components/elm/src/biogeochem/DryDepVelocity.F90 @@ -146,7 +146,7 @@ subroutine depvel_compute( bounds, & use landunit_varcon, only : istsoil, istice, istice_mec, istdlak, istwet use elm_varctl , only : iulog use pftvarcon , only : noveg, nonvascular - use pftvarcon , only : woody, graminoid, generic_crop, crop, percrop + use pftvarcon , only : woody, graminoid, iscft, crop use pftvarcon , only : needleleaf ! ! !ARGUMENTS: @@ -293,10 +293,8 @@ subroutine depvel_compute( bounds, & if (nonvascular(elmveg) == 1.0_r8 ) wesveg = 3 ! assuming moss like grass !if (elmveg == nc3crop ) wesveg = 2 !if (elmveg == nc3irrig ) wesveg = 2 - if (generic_crop(elmveg) == 1.0_r8 ) wesveg = 2 - if (crop(elmveg) == 1.0_r8 ) wesveg = 2 - if (percrop(elmveg) == 1.0_r8 ) wesveg = 2 !if (elmveg >= npcropmin .and. elmveg <= npcropmax ) wesveg = 2 + if (crop(elmveg) == 1.0_r8 .or. iscft(elmveg) == 1.0_r8 ) wesveg = 2 #ifndef _OPENACC if (wesveg == wveg_unset )then write(iulog,*) 'elmveg = ', elmveg, 'lun_pp%itype = ', lun_pp%itype(l) diff --git a/components/elm/src/biogeochem/FireMod.F90 b/components/elm/src/biogeochem/FireMod.F90 index 24e34e37c55..7aa4e6a50f9 100644 --- a/components/elm/src/biogeochem/FireMod.F90 +++ b/components/elm/src/biogeochem/FireMod.F90 @@ -126,7 +126,7 @@ subroutine FireArea (bounds, & use elm_varcon , only: secspday, spval use elm_varctl , only: use_nofire, spinup_state, spinup_mortality_factor use dynSubgridControlMod , only: run_has_transient_landcover - use pftvarcon , only: noveg, woody, graminoid, generic_crop, crop, percrop + use pftvarcon , only: noveg, woody, graminoid, iscft, crop use pftvarcon , only: climatezone, needleleaf, evergreen ! ! !ARGUMENTS: @@ -305,16 +305,12 @@ subroutine FireArea (bounds, & if (pi <= col_pp%npfts(c)) then p = col_pp%pfti(c) + pi - 1 ! For crop veg types - if( generic_crop(veg_pp%itype(p)) == 1 .or. & - crop(veg_pp%itype(p)) == 1 .or. & - percrop(veg_pp%itype(p)) == 1 )then + if( crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p)) == 1 )then cropf_col(c) = cropf_col(c) + veg_pp%wtcol(p) end if ! For natural vegetation (non-crop and non-bare-soil) if( veg_pp%itype(p) /= noveg .and. & - (generic_crop(veg_pp%itype(p)) == 0 .and. & - crop(veg_pp%itype(p)) == 0 .and. & - percrop(veg_pp%itype(p)) == 0) )then + (crop(veg_pp%itype(p)) == 0 .and. iscft(veg_pp%itype(p)) == 0) )then lfwt(c) = lfwt(c) + veg_pp%wtcol(p) end if end if @@ -336,9 +332,7 @@ subroutine FireArea (bounds, & ! column-level litter carbon ! is available, so we use leaf carbon to estimate the ! litter carbon for crop PFTs - if( (generic_crop(veg_pp%itype(p)) == 1 .or. & - crop(veg_pp%itype(p)) == 1 .or. & - percrop(veg_pp%itype(p)) == 1) .and. & + if( (crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p)) == 1) .and. & veg_pp%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & leafc_xfer(p))*veg_pp%wtcol(p)/cropf_col(c) + & @@ -376,9 +370,7 @@ subroutine FireArea (bounds, & p = col_pp%pfti(c) + pi - 1 ! For non-crop -- natural vegetation and bare-soil - if( (generic_crop(veg_pp%itype(p)) == 0 .and. & - crop(veg_pp%itype(p)) == 0 .and. & - percrop(veg_pp%itype(p)) == 0) .and. & + if( (crop(veg_pp%itype(p)) == 0 .and. iscft(veg_pp%itype(p)) == 0) .and. & cropf_col(c) < 1.0_r8 ) then if( btran2(p) .ne. spval) then if (btran2(p) <= 1._r8 ) then @@ -517,9 +509,7 @@ subroutine FireArea (bounds, & p = col_pp%pfti(c) + pi - 1 ! For crop if( forc_t(t) >= SHR_CONST_TKFRZ .and. & - (generic_crop(veg_pp%itype(p))>=1 .or. & - crop(veg_pp%itype(p))>=1 .or. & - percrop(veg_pp%itype(p))>=1) .and. & + (crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p)) == 1) .and. & kmo == abm_lf(c) .and. forc_rain(t)+forc_snow(t) == 0._r8 .and. & burndate(p) >= 999 .and. veg_pp%wtcol(p) > 0._r8 )then ! catch crop burn time @@ -690,7 +680,7 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & !$acc routine seq use pftvarcon , only: cc_leaf,cc_lstem,cc_dstem,cc_other,fm_leaf,fm_lstem,fm_other,fm_root,fm_lroot,fm_droot use pftvarcon , only: lf_flab,lf_fcel,lf_flig,fr_flab,fr_fcel,fr_flig - use pftvarcon , only: generic_crop, crop, percrop + use pftvarcon , only: iscft, crop use elm_varpar , only: max_patch_per_col use elm_varctl , only: spinup_state, spinup_mortality_factor use dynSubgridControlMod , only: get_flanduse_timeseries @@ -992,8 +982,7 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & c = veg_pp%column(p) itype = veg_pp%itype(p) - if( (generic_crop(veg_pp%itype(p)) == 0 .and. crop(veg_pp%itype(p)) == 0 .and. & - percrop(veg_pp%itype(p)) == 0 ) .and. & + if( (crop(veg_pp%itype(p)) == 0 .and. iscft(veg_pp%itype(p)) == 0) .and. & cropf_col(c) < 1.0_r8)then ! For non-crop (bare-soil and natural vegetation) if (transient_landcover) then !true when landuse data is used diff --git a/components/elm/src/biogeochem/GapMortalityMod.F90 b/components/elm/src/biogeochem/GapMortalityMod.F90 index 3257a6365b6..734be187805 100644 --- a/components/elm/src/biogeochem/GapMortalityMod.F90 +++ b/components/elm/src/biogeochem/GapMortalityMod.F90 @@ -87,7 +87,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! !USES: !$acc routine seq use elm_varcon , only: secspday - use pftvarcon , only: npcropmin + use pftvarcon , only: iscft use elm_varctl , only: spinup_state, spinup_mortality_factor ! ! !ARGUMENTS: @@ -142,7 +142,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! displayed pools veg_cf%m_leafc_to_litter(p) = 0._r8 veg_cf%m_livestemc_to_litter(p) = 0._r8 - if(ivt(p) < npcropmin .or. (ivt(p) >= npcropmin .and. croplive(p))) then + if(iscft(ivt(p)) < 1 .or. (iscft(ivt(p)) >= 1 .and. croplive(p))) then veg_cf%m_leafc_to_litter(p) = veg_cs%leafc(p) * m veg_cf%m_livestemc_to_litter(p) = veg_cs%livestemc(p) * m end if @@ -181,7 +181,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! displayed pools veg_nf%m_leafn_to_litter(p) = 0._r8 veg_nf%m_livestemn_to_litter(p) = 0._r8 - if(ivt(p) < npcropmin .or. (ivt(p) >= npcropmin .and. croplive(p))) then + if(iscft(ivt(p)) < 1 .or. (iscft(ivt(p)) >= 1 .and. croplive(p))) then veg_nf%m_leafn_to_litter(p) = veg_ns%leafn(p) * m veg_nf%m_livestemn_to_litter(p) = veg_ns%livestemn(p) * m end if @@ -190,7 +190,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_nf%m_livecrootn_to_litter(p) = veg_ns%livecrootn(p) * m veg_nf%m_deadcrootn_to_litter(p) = veg_ns%deadcrootn(p) * m veg_nf%m_retransn_to_litter(p) = 0._r8 - if (ivt(p) < npcropmin) then + if (iscft(ivt(p)) < 1) then veg_nf%m_retransn_to_litter(p) = veg_ns%retransn(p) * m end if veg_nf%m_npool_to_litter(p) = veg_ns%npool(p) * m @@ -225,7 +225,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! displayed pools veg_pf%m_leafp_to_litter(p) = 0._r8 veg_pf%m_livestemp_to_litter(p) = 0._r8 - if(ivt(p) < npcropmin .or. (ivt(p) >= npcropmin .and. croplive(p))) then + if(iscft(ivt(p)) < 1 .or. (iscft(ivt(p)) >= 1 .and. croplive(p))) then veg_pf%m_leafp_to_litter(p) = veg_ps%leafp(p) * m veg_pf%m_livestemp_to_litter(p) = veg_ps%livestemp(p) * m endif @@ -235,7 +235,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_pf%m_deadcrootp_to_litter(p) = veg_ps%deadcrootp(p) * m veg_pf%m_retransp_to_litter(p) = 0._r8 - if (ivt(p) < npcropmin) then + if (iscft(ivt(p)) < 1) then veg_pf%m_retransp_to_litter(p) = veg_ps%retransp(p) * m end if veg_pf%m_ppool_to_litter(p) = veg_ps%ppool(p) * m diff --git a/components/elm/src/biogeochem/GrowthRespMod.F90 b/components/elm/src/biogeochem/GrowthRespMod.F90 index a5002d108e5..34a9a64c56c 100644 --- a/components/elm/src/biogeochem/GrowthRespMod.F90 +++ b/components/elm/src/biogeochem/GrowthRespMod.F90 @@ -7,7 +7,7 @@ module GrowthRespMod ! ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 - use pftvarcon , only : grperc, grpnow, npcropmin + use pftvarcon , only : grperc, grpnow, iscft use VegetationPropertiesType , only : veg_vp use VegetationType , only : veg_pp use VegetationDataType , only : veg_cf @@ -102,7 +102,7 @@ subroutine GrowthResp(num_soilp, filter_soilp) do fp = 1,num_soilp p = filter_soilp(fp) - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops cpool_livestem_gr(p) = cpool_to_livestemc(p) * grperc(ivt(p)) diff --git a/components/elm/src/biogeochem/MaintenanceRespMod.F90 b/components/elm/src/biogeochem/MaintenanceRespMod.F90 index eab60926ab6..48d179f97d1 100644 --- a/components/elm/src/biogeochem/MaintenanceRespMod.F90 +++ b/components/elm/src/biogeochem/MaintenanceRespMod.F90 @@ -12,7 +12,7 @@ module MaintenanceRespMod use decompMod , only : bounds_type use abortutils , only : endrun use shr_log_mod , only : errMsg => shr_log_errMsg - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft use SharedParamsMod , only : ParamsShareInst use VegetationPropertiesType , only : veg_vp use SoilStateType , only : soilstate_type @@ -185,7 +185,7 @@ subroutine MaintenanceResp(bounds, & if (woody(ivt(p)) >= 1.0_r8) then livestem_mr(p) = livestemn(p)*br_mr*tc livecroot_mr(p) = livecrootn(p)*br_mr*tc - else if (ivt(p) >= npcropmin .and. livestemn(p) .gt. 0._r8) then + else if (iscft(ivt(p)) >= 1 .and. livestemn(p) .gt. 0._r8) then livestem_mr(p) = livestemn(p)*br_mr*tc grain_mr(p) = grainn(p)*br_mr*tc end if diff --git a/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 b/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 index d72dc4dc598..80fc34e6d0b 100644 --- a/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 @@ -9,7 +9,7 @@ module NitrogenStateUpdate1Mod use elm_varpar , only : crop_prog, i_met_lit, i_cel_lit, i_lig_lit, i_cwd use elm_varctl , only : iulog use elm_varcon , only : nitrif_n2o_loss_frac - use pftvarcon , only : crop, generic_crop, percrop + use pftvarcon , only : iscft use VegetationPropertiesType , only : veg_vp use CNDecompCascadeConType , only : decomp_cascade_con use CNStateType , only : cnstate_type @@ -297,8 +297,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) - veg_nf%deadcrootn_xfer_to_deadcrootn(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) - veg_nf%livestemn_xfer_to_livestemn(p)*dt @@ -323,8 +322,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%livecrootn(p) = veg_ns%livecrootn(p) - veg_nf%livecrootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%livecrootn_to_retransn(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! Beth adds retrans from froot + if (iscft(ivt(p)) >= 1) then ! Beth adds retrans from froot veg_ns%frootn(p) = veg_ns%frootn(p) - veg_nf%frootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%frootn_to_retransn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_litter(p)*dt @@ -375,8 +373,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_storage(p) = veg_ns%deadcrootn_storage(p) + veg_nf%npool_to_deadcrootn_storage(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%npool_to_livestemn(p)*dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn_storage(p)*dt @@ -404,8 +401,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) + veg_nf%deadcrootn_storage_to_xfer(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn_storage(p) = veg_ns%livestemn_storage(p) - veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) + veg_nf%livestemn_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/NitrogenStateUpdate2Mod.F90 b/components/elm/src/biogeochem/NitrogenStateUpdate2Mod.F90 index 9121954e636..5d897c5905a 100644 --- a/components/elm/src/biogeochem/NitrogenStateUpdate2Mod.F90 +++ b/components/elm/src/biogeochem/NitrogenStateUpdate2Mod.F90 @@ -14,7 +14,7 @@ module NitrogenStateUpdate2Mod use ColumnDataType , only : col_ns, col_nf use VegetationType , only : veg_pp use VegetationDataType , only : veg_ns, veg_nf - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft ! bgc interface & pflotran: use elm_varctl , only : use_pflotran, pf_cmode ! @@ -172,7 +172,7 @@ subroutine NitrogenStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soil veg_ns%retransn(p) = veg_ns%retransn(p) - veg_nf%hrv_retransn_to_litter(p) * dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%hrv_npool_to_litter(p) * dt - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_ns%livestemn(p)= veg_ns%livestemn(p) - veg_nf%hrv_livestemn_to_prod1n(p) * dt veg_ns%leafn(p) = veg_ns%leafn(p) - veg_nf%hrv_leafn_to_prod1n(p) * dt veg_ns%grainn(p) = veg_ns%grainn(p) - veg_nf%hrv_grainn_to_prod1n(p) * dt diff --git a/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 b/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 index 786efbe6323..49909f54929 100644 --- a/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 +++ b/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 @@ -10,7 +10,7 @@ module PhenologyFLuxLimitMod use VegetationType , only : veg_pp use VegetationPropertiesType , only : veg_vp use elm_time_manager , only : get_step_size - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft use elm_varctl , only : iulog use abortutils , only : endrun implicit none @@ -644,7 +644,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_deadcrootc_xfer) = veg_cs%deadcrootc_xfer(p) ystates(s_deadcrootc_storage) = veg_cs%deadcrootc_storage(p) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then ystates(s_livestemc) = veg_cs%livestemc(p) ystates(s_livestemc_xfer) = veg_cs%livestemc_xfer(p) ystates(s_livestemc_storage) = veg_cs%livestemc_storage(p) @@ -675,7 +675,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& + veg_cf%cpool_livecroot_storage_gr(p) & + veg_cf%cpool_deadcroot_storage_gr(p) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then ar_p= ar_p & + veg_cf%livestem_curmr(p) & + veg_cf%grain_curmr(p) & @@ -713,7 +713,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_deadcrootc_storage_to_xfer) = veg_cf%deadcrootc_storage_to_xfer(p) rfluxes(f_gresp_storage_to_xfer) = veg_cf%gresp_storage_to_xfer(p) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then rfluxes(f_cpool_to_livestemc) = veg_cf%cpool_to_livestemc(p) rfluxes(f_cpool_to_livestemc_storage) = veg_cf%cpool_to_livestemc_storage(p) rfluxes(f_cpool_to_grainc) = veg_cf%cpool_to_grainc(p) @@ -767,7 +767,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_deadcrootc_storage_to_xfer) , veg_cf%deadcrootc_storage_to_xfer(p)) call fpmax(rfluxes(f_gresp_storage_to_xfer) , veg_cf%gresp_storage_to_xfer(p)) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then call fpmax(rfluxes(f_cpool_to_livestemc) , veg_cf%cpool_to_livestemc(p)) call fpmax(rfluxes(f_cpool_to_livestemc_storage) , veg_cf%cpool_to_livestemc_storage(p)) call fpmax(rfluxes(f_cpool_to_grainc) , veg_cf%cpool_to_grainc(p)) @@ -806,7 +806,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& call ascal(veg_cf%cpool_livecroot_storage_gr(p), rscal) call ascal(veg_cf%cpool_deadcroot_storage_gr(p), rscal) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then call ascal(veg_cf%livestem_curmr(p) , rscal) call ascal(veg_cf%grain_curmr(p) , rscal) call ascal(veg_cf%cpool_livestem_gr(p) , rscal) @@ -878,7 +878,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_deadcrootn_xfer) = veg_ns%deadcrootn_xfer(p) ystates(s_deadcrootn_storage) = veg_ns%deadcrootn_storage(p) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then ystates(s_grainn) = veg_ns%grainn(p) ystates(s_grainn_xfer) = veg_ns%grainn_xfer(p) ystates(s_grainn_storage) = veg_ns%grainn_storage(p) @@ -917,7 +917,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_deadcrootn_xfer_to_deadcrootn) = veg_nf%deadcrootn_xfer_to_deadcrootn(p) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then rfluxes(f_npool_to_livestemn) = veg_nf%npool_to_livestemn(p) rfluxes(f_npool_to_livestemn_storage) = veg_nf%npool_to_livestemn_storage(p) rfluxes(f_npool_to_grainn) = veg_nf%npool_to_grainn(p) @@ -973,7 +973,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_deadcrootn_xfer_to_deadcrootn) , veg_nf%deadcrootn_xfer_to_deadcrootn(p)) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then call fpmax(rfluxes(f_npool_to_livestemn) , veg_nf%npool_to_livestemn(p)) call fpmax(rfluxes(f_npool_to_livestemn_storage) , veg_nf%npool_to_livestemn_storage(p)) call fpmax(rfluxes(f_npool_to_grainn) , veg_nf%npool_to_grainn(p)) @@ -1063,7 +1063,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_deadcrootn_xfer) = veg_ps%deadcrootp_xfer(p) ystates(s_deadcrootn_storage) = veg_ps%deadcrootp_storage(p) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then ystates(s_grainn) = veg_ps%grainp(p) ystates(s_grainn_xfer) = veg_ps%grainp_xfer(p) ystates(s_grainn_storage) = veg_ps%grainp_storage(p) @@ -1102,7 +1102,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_deadcrootn_xfer_to_deadcrootn) = veg_pf%deadcrootp_xfer_to_deadcrootp(p) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then rfluxes(f_npool_to_livestemn) = veg_pf%ppool_to_livestemp(p) rfluxes(f_npool_to_livestemn_storage) = veg_pf%ppool_to_livestemp_storage(p) rfluxes(f_npool_to_grainn) = veg_pf%ppool_to_grainp(p) @@ -1158,7 +1158,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_deadcrootn_xfer_to_deadcrootn) , veg_pf%deadcrootp_xfer_to_deadcrootp(p)) endif - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then call fpmax(rfluxes(f_npool_to_livestemn) , veg_pf%ppool_to_livestemp(p)) call fpmax(rfluxes(f_npool_to_livestemn_storage) , veg_pf%ppool_to_livestemp_storage(p)) call fpmax(rfluxes(f_npool_to_grainn) , veg_pf%ppool_to_grainp(p)) diff --git a/components/elm/src/biogeochem/PhenologyMod.F90 b/components/elm/src/biogeochem/PhenologyMod.F90 index d5ddfc2f44e..2a52cb92883 100644 --- a/components/elm/src/biogeochem/PhenologyMod.F90 +++ b/components/elm/src/biogeochem/PhenologyMod.F90 @@ -2177,7 +2177,8 @@ subroutine CropPhenologyInit(bounds) ! initialized, and after ecophyscon file is read in. ! ! !USES: - use pftvarcon , only: npcropmin, npcropmax, nppercropmin, nppercropmax, mnNHplantdate + use elm_varpar , only : mxpft + use pftvarcon , only: iscft, mnNHplantdate use pftvarcon , only: mnSHplantdate, mxNHplantdate use pftvarcon , only: mxSHplantdate use elm_time_manager, only: get_calday @@ -2203,23 +2204,28 @@ subroutine CropPhenologyInit(bounds) ! Convert planting dates into julian day minplantjday(:,:) = huge(1) maxplantjday(:,:) = huge(1) - do n = npcropmin, npcropmax + do n = 0, mxpft + if (iscft(n)>=1) then minplantjday(n,inNH) = int( get_calday( mnNHplantdate(n), 0 ) ) maxplantjday(n,inNH) = int( get_calday( mxNHplantdate(n), 0 ) ) + end if end do - do n = npcropmin, npcropmax + do n = 0, mxpft + if (iscft(n)>=1) then minplantjday(n,inSH) = int( get_calday( mnSHplantdate(n), 0 ) ) maxplantjday(n,inSH) = int( get_calday( mxSHplantdate(n), 0 ) ) + end if end do - do n = nppercropmin, nppercropmax - minplantjday(n,inNH) = int( get_calday( mnNHplantdate(n), 0 ) ) - maxplantjday(n,inNH) = int( get_calday( mxNHplantdate(n), 0 ) ) - end do - do n = nppercropmin, nppercropmax - minplantjday(n,inSH) = int( get_calday( mnSHplantdate(n), 0 ) ) - maxplantjday(n,inSH) = int( get_calday( mxSHplantdate(n), 0 ) ) - end do + ! with flag 'iscft', the following is not needed anymore + !do n = nppercropmin, nppercropmax + ! minplantjday(n,inNH) = int( get_calday( mnNHplantdate(n), 0 ) ) + ! maxplantjday(n,inNH) = int( get_calday( mxNHplantdate(n), 0 ) ) + !end do + !do n = nppercropmin, nppercropmax + ! minplantjday(n,inSH) = int( get_calday( mnSHplantdate(n), 0 ) ) + ! maxplantjday(n,inSH) = int( get_calday( mxSHplantdate(n), 0 ) ) + !end do ! Figure out what hemisphere each PFT is in do p = bounds%begp, bounds%endp @@ -2965,7 +2971,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & ! ! !USES: !$acc routine seq - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft ! ! !ARGUMENTS: integer , intent(in) :: num_soilp ! number of soil patches in filter @@ -3062,7 +3068,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & if (offset_counter(p) == dt) then t1 = 1.0_r8 / dt - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" leafc_to_litter(p) = (1.0_r8 - presharv(ivt(p))) * ((t1 * leafc(p)) + cpool_to_leafc(p)) @@ -3079,7 +3085,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & end if if ( nu_com .eq. 'RD') then - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then if (offset_counter(p) == dt) then t1 = 1.0_r8 / dt @@ -3113,7 +3119,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & else if (offset_counter(p) == dt) then t1 = 1.0_r8 / dt - if (ivt(p) >= npcropmin) then + if (iscft(ivt(p)) >= 1) then ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" leafn_to_litter(p) = (1.0_r8 - presharv(ivt(p))) * ((t1 * leafn(p)) + npool_to_leafn(p)) @@ -3387,7 +3393,7 @@ subroutine CNLitterToColumn (num_soilp, filter_soilp, & ! !USES: !$acc routine seq use elm_varpar , only : max_patch_per_col, nlevdecomp - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft ! ! !ARGUMENTS: integer , intent(in) :: num_soilp ! number of soil columns in filter @@ -3497,7 +3503,7 @@ subroutine CNLitterToColumn (num_soilp, filter_soilp, & ! new ones for now (slevis) ! The food is now directed to the product pools (BDrewniak) - if (ivt(p) >= npcropmin) then ! add livestemc to litter + if (iscft(ivt(p)) >= 1) then ! add livestemc to litter ! stem litter carbon fluxes phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & + livestemc_to_litter(p) * lf_flab(ivt(p)) * wt_col * leaf_prof(p,j) diff --git a/components/elm/src/biogeochem/PhosphorusFluxType.F90 b/components/elm/src/biogeochem/PhosphorusFluxType.F90 index f34d7556f69..52bda3118fd 100644 --- a/components/elm/src/biogeochem/PhosphorusFluxType.F90 +++ b/components/elm/src/biogeochem/PhosphorusFluxType.F90 @@ -561,7 +561,6 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil ! !USES: use elm_varpar , only: nlevdecomp,ndecomp_cascade_transitions,ndecomp_pools use subgridAveMod , only: p2c - use pftvarcon , only: npcropmin ! pflotran ! use elm_varctl , only: use_pflotran, pf_cmode ! diff --git a/components/elm/src/biogeochem/PhosphorusStateType.F90 b/components/elm/src/biogeochem/PhosphorusStateType.F90 index 0be7dd7f533..58dbe630c2e 100644 --- a/components/elm/src/biogeochem/PhosphorusStateType.F90 +++ b/components/elm/src/biogeochem/PhosphorusStateType.F90 @@ -12,7 +12,7 @@ module PhosphorusStateType use elm_varctl , only : use_vertsoilc, use_century_decomp use elm_varctl , only : iulog, override_bgc_restart_mismatch_dump, spinup_state use decompMod , only : bounds_type - use pftvarcon , only : npcropmin, nstor + use pftvarcon , only : iscft, nstor use CNDecompCascadeConType , only : decomp_cascade_con use VegetationPropertiesType , only : veg_vp use abortutils , only : endrun @@ -254,7 +254,7 @@ subroutine InitCold(this, bounds, & ! !USES: use elm_varpar , only : crop_prog use decompMod , only : bounds_type - use pftvarcon , only : noveg, npcropmin + use pftvarcon , only : noveg, iscft ! ! !ARGUMENTS: class(phosphorusstate_type) :: this diff --git a/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 b/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 index e29074eb332..01369ed83fa 100644 --- a/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 @@ -8,7 +8,7 @@ module PhosphorusStateUpdate1Mod use elm_varpar , only : nlevdecomp, ndecomp_pools, ndecomp_cascade_transitions use elm_varpar , only : crop_prog, i_met_lit, i_cel_lit, i_lig_lit, i_cwd use elm_varctl , only : iulog - use pftvarcon , only : crop, generic_crop, percrop + use pftvarcon , only : iscft use soilorder_varcon , only : smax,ks_sorption use VegetationPropertiesType , only : veg_vp use CNDecompCascadeConType , only : decomp_cascade_con @@ -255,8 +255,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_xfer(p) = veg_ps%deadcrootp_xfer(p) - veg_pf%deadcrootp_xfer_to_deadcrootp(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ps%livestemp(p) = veg_ps%livestemp(p) + veg_pf%livestemp_xfer_to_livestemp(p)*dt veg_ps%livestemp_xfer(p) = veg_ps%livestemp_xfer(p) - veg_pf%livestemp_xfer_to_livestemp(p)*dt @@ -281,8 +280,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%livecrootp(p) = veg_ps%livecrootp(p) - veg_pf%livecrootp_to_retransp(p)*dt veg_ps%retransp(p) = veg_ps%retransp(p) + veg_pf%livecrootp_to_retransp(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! Beth adds retrans from froot + if (iscft(ivt(p)) >= 1) then ! Beth adds retrans from froot veg_ps%frootp(p) = veg_ps%frootp(p) - veg_pf%frootp_to_retransp(p)*dt veg_ps%retransp(p) = veg_ps%retransp(p) + veg_pf%frootp_to_retransp(p)*dt veg_ps%livestemp(p) = veg_ps%livestemp(p) - veg_pf%livestemp_to_litter(p)*dt @@ -333,8 +331,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_storage(p) = veg_ps%deadcrootp_storage(p) + veg_pf%ppool_to_deadcrootp_storage(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_livestemp(p)*dt veg_ps%livestemp(p) = veg_ps%livestemp(p) + veg_pf%ppool_to_livestemp(p)*dt veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_livestemp_storage(p)*dt @@ -362,8 +359,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_xfer(p) = veg_ps%deadcrootp_xfer(p) + veg_pf%deadcrootp_storage_to_xfer(p)*dt end if - if ( (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) .and. & - generic_crop(ivt(p)) == 0 ) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ps%livestemp_storage(p) = veg_ps%livestemp_storage(p) - veg_pf%livestemp_storage_to_xfer(p)*dt veg_ps%livestemp_xfer(p) = veg_ps%livestemp_xfer(p) + veg_pf%livestemp_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/PhosphorusStateUpdate2Mod.F90 b/components/elm/src/biogeochem/PhosphorusStateUpdate2Mod.F90 index 2385083451c..4aa7563c70f 100644 --- a/components/elm/src/biogeochem/PhosphorusStateUpdate2Mod.F90 +++ b/components/elm/src/biogeochem/PhosphorusStateUpdate2Mod.F90 @@ -12,7 +12,7 @@ module PhosphorusStateUpdate2Mod !use PhosphorusStateType , only : phosphorusstate_type !use PhosphorusFLuxType , only : phosphorusflux_type use VegetationType , only : veg_pp - use pftvarcon , only : npcropmin + use pftvarcon , only : iscft use tracer_varcon , only : is_active_betr_bgc ! bgc interface & pflotran: use elm_varctl , only : use_pflotran, pf_cmode @@ -182,7 +182,7 @@ subroutine PhosphorusStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_so veg_ps%retransp(p) = veg_ps%retransp(p) - veg_pf%hrv_retransp_to_litter(p) * dt veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%hrv_ppool_to_litter(p) * dt - if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops veg_ps%livestemp(p)= veg_ps%livestemp(p) - veg_pf%hrv_livestemp_to_prod1p(p) * dt veg_ps%leafp(p) = veg_ps%leafp(p) - veg_pf%hrv_leafp_to_prod1p(p) * dt veg_ps%grainp(p) = veg_ps%grainp(p) - veg_pf%hrv_grainp_to_prod1p(p) * dt diff --git a/components/elm/src/biogeochem/PrecisionControlMod.F90 b/components/elm/src/biogeochem/PrecisionControlMod.F90 index 8767d300b24..2423592c05c 100644 --- a/components/elm/src/biogeochem/PrecisionControlMod.F90 +++ b/components/elm/src/biogeochem/PrecisionControlMod.F90 @@ -39,7 +39,7 @@ subroutine PrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) !$acc routine seq use elm_varctl , only : iulog, use_c13, use_c14, use_fates use elm_varpar , only : nlevdecomp_full, crop_prog - use pftvarcon , only : crop, generic_crop, percrop + use pftvarcon , only : iscft use tracer_varcon , only : is_active_betr_bgc use CNDecompCascadeConType , only : decomp_cascade_con ! @@ -211,9 +211,7 @@ subroutine PrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) veg_ps%frootp_xfer(p) = 0._r8 end if - if ( crop_prog .and. & - (crop(veg_pp%itype(p)) >= 1 .or. & - percrop(veg_pp%itype(p)) >= 1) )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then ! grain C and N if (abs(veg_cs%grainc(p)) < ccrit) then pc = pc + veg_cs%grainc(p) @@ -515,9 +513,7 @@ subroutine PrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) endif end if - if ( crop_prog .and. & - (crop(veg_pp%itype(p)) >= 1 .or. & - percrop(veg_pp%itype(p)) >= 1) )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then ! xsmrpool (C only) if (abs(veg_cs%xsmrpool(p)) < ccrit) then pc = pc + veg_cs%xsmrpool(p) diff --git a/components/elm/src/biogeochem/RootDynamicsMod.F90 b/components/elm/src/biogeochem/RootDynamicsMod.F90 index 3c78043aa6a..f5ffc4c6784 100644 --- a/components/elm/src/biogeochem/RootDynamicsMod.F90 +++ b/components/elm/src/biogeochem/RootDynamicsMod.F90 @@ -10,7 +10,7 @@ module RootDynamicsMod use elm_varpar , only : nlevsoi, nlevgrnd use elm_varctl , only : use_vertsoilc use decompMod , only : bounds_type - use pftvarcon , only : noveg, npcropmin, roota_par, rootb_par, root_dmx, evergreen + use pftvarcon , only : noveg, iscft, roota_par, rootb_par, root_dmx, evergreen use CanopyStateType , only: canopystate_type use CNStateType , only : cnstate_type use CNCarbonStateType , only : carbonstate_type @@ -136,7 +136,7 @@ subroutine RootDynamics(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp p = filter_soilp(f) c = pcolumn(p) if (ivt(p) /= noveg) then - if ((ivt(p)) >= npcropmin) then !skip generic crop types + if (iscft(ivt(p)) >= 1) then !skip generic crop types if (huigrain(p) > 0._r8) then root_depth(p) = max(zi(c,2), min(hui(p)/huigrain(p)* root_dmx(ivt(p)), root_dmx(ivt(p)))) end if diff --git a/components/elm/src/biogeochem/VOCEmissionMod.F90 b/components/elm/src/biogeochem/VOCEmissionMod.F90 index 64a72fe78b8..fb7bd66958d 100644 --- a/components/elm/src/biogeochem/VOCEmissionMod.F90 +++ b/components/elm/src/biogeochem/VOCEmissionMod.F90 @@ -10,7 +10,7 @@ module VOCEmissionMod use elm_varctl , only : iulog use elm_varpar , only : numpft, nlevcan use elm_varpar , only : numveg ! fixed as 16, while numpft above may be variable - use pftvarcon , only : woody, graminoid, generic_crop, crop, percrop + use pftvarcon , only : woody, graminoid, iscft, crop use pftvarcon , only : needleleaf, evergreen use shr_megan_mod , only : shr_megan_megcomps_n, shr_megan_megcomp_t, shr_megan_linkedlist use shr_megan_mod , only : shr_megan_mechcomps_n, shr_megan_mechcomps, shr_megan_mapped_emisfctrs @@ -703,8 +703,7 @@ function get_map_EF(ivt_in, g_in, ti_in, vocemis_vars) get_map_EF = vocemis_vars%efisop_grc(4,g_in, ti_in) else if (graminoid(ivt_in) == 1) then !grass get_map_EF = vocemis_vars%efisop_grc(5,g_in, ti_in) - else if (generic_crop(ivt_in) == 1 .or. crop(ivt_in) == 1 & - .or. percrop(ivt_in) == 1) then !crops + else if (crop(ivt_in) == 1 .or. iscft(ivt_in) == 1) then !crops get_map_EF = vocemis_vars%efisop_grc(6,g_in, ti_in) end if diff --git a/components/elm/src/biogeochem/VegStructUpdateMod.F90 b/components/elm/src/biogeochem/VegStructUpdateMod.F90 index de7062b810d..c40e0fc0ea0 100644 --- a/components/elm/src/biogeochem/VegStructUpdateMod.F90 +++ b/components/elm/src/biogeochem/VegStructUpdateMod.F90 @@ -37,7 +37,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & ! vegetation structure (LAI, SAI, height) ! ! !USES: - use pftvarcon , only : noveg, woody, generic_crop, crop, percrop + use pftvarcon , only : noveg, woody, iscft, crop use pftvarcon , only : ncorn, ncornirrig, ztopmx, laimx use pftvarcon , only : nmiscanthus, nmiscanthusirrig, nswitchgrass, nswitchgrassirrig use elm_time_manager , only : get_rad_step_size @@ -147,7 +147,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & ! alpha are set by PFT, and alpha is scaled to CLM time step by multiplying by ! dt and dividing by dtsmonth (seconds in average 30 day month) ! tsai_min scaled by 0.5 to match MODIS satellite derived values - if (generic_crop(ivt(p)) == 1) then ! generic crops + if (crop(ivt(p)) == 1 .and. iscft(ivt(p)) == 0) then ! generic crops tsai_alpha = 1.0_r8-1.0_r8*dt/dtsmonth tsai_min = 0.1_r8 @@ -193,8 +193,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & hbot(p) = max(0._r8, min(3._r8, htop(p)-1._r8)) - else if ( generic_crop(ivt(p)) <1 .and. & - (crop(ivt(p)) >= 1 .or. percrop(ivt(p)) >= 1) ) then ! prognostic crops + else if (iscft(ivt(p)) >= 1) then ! prognostic crops if (tlai(p) >= laimx(ivt(p))) peaklai(p) = 1 ! used in CNAllocation diff --git a/components/elm/src/biogeophys/SedYieldMod.F90 b/components/elm/src/biogeophys/SedYieldMod.F90 index e50544edde6..e0d63ed063c 100644 --- a/components/elm/src/biogeophys/SedYieldMod.F90 +++ b/components/elm/src/biogeophys/SedYieldMod.F90 @@ -63,7 +63,7 @@ subroutine SoilErosion (bounds, num_soilc, filter_soilc, & use elm_time_manager, only : get_step_size use landunit_varcon , only : istcrop, istsoil, istice use pftvarcon , only : gcbc_p, gcbc_q, gcbr_p, gcbr_q - use pftvarcon , only : generic_crop, crop, percrop + use pftvarcon , only : crop, iscft ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -218,9 +218,7 @@ subroutine SoilErosion (bounds, num_soilc, filter_soilc, & (veg_cs%livecrootc(p)+veg_cs%deadcrootc(p))*croot_prof(p,1) ) fgndcov = exp( -gcbc_p(veg_pp%itype(p))*PCT_gnd - & gcbr_p(veg_pp%itype(p))*Broot ) - if( generic_crop(veg_pp%itype(p)) >= 1 .or. & - crop(veg_pp%itype(p)) >= 1 .or. & - percrop(veg_pp%itype(p)) >=1 )then + if( crop(veg_pp%itype(p)) >= 1 .or. iscft(veg_pp%itype(p)) >=1 )then Es_Pcrp = Es_Pcrp + pfactor(c) * ftillage * flitho * & fgndcov * veg_pp%wtcol(p) * K * (KE_DT+KE_LD) @@ -268,9 +266,7 @@ subroutine SoilErosion (bounds, num_soilc, filter_soilc, & nh = 0.03_r8 + 0.05_r8*max(Crsd,Clai) fsr = fsr + veg_pp%wtcol(p) * (0.03_r8/nh)**0.6_r8 - if ( generic_crop(veg_pp%itype(p)) >= 1 .or. & - crop(veg_pp%itype(p)) >= 1 .or. & - percrop(veg_pp%itype(p)) >=1 ) then + if ( crop(veg_pp%itype(p)) >= 1 .or. iscft(veg_pp%itype(p)) >= 1 ) then ftillage_tc = ftillage_tc + ftillage * veg_pp%wtcol(p) Es_Q = Es_Q + 19.1_r8 * qfactor(c) * 2._r8/COH * flitho * fslp * & diff --git a/components/elm/src/data_types/VegetationDataType.F90 b/components/elm/src/data_types/VegetationDataType.F90 index eea30fc55fe..ecbdca64df3 100644 --- a/components/elm/src/data_types/VegetationDataType.F90 +++ b/components/elm/src/data_types/VegetationDataType.F90 @@ -17,7 +17,7 @@ module VegetationDataType use elm_varcon , only : spval, ispval, sb use elm_varcon , only : c13ratio, c14ratio use landunit_varcon , only : istsoil, istcrop - use pftvarcon , only : npcropmin, noveg, nstor + use pftvarcon , only : iscft, noveg, nstor use elm_varctl , only : iulog, use_cn, spinup_state, spinup_mortality_factor, use_fates use elm_varctl , only : nu_com, use_crop, use_c13 use elm_varctl , only : use_lch4, use_betr @@ -2447,7 +2447,7 @@ subroutine veg_cs_init(this, begp, endp, carbon_type, ratio) if (veg_vp%evergreen(veg_pp%itype(p)) == 1._r8) then this%leafc(p) = 1._r8 * ratio this%leafc_storage(p) = 0._r8 - else if (veg_pp%itype(p) >= npcropmin) then ! prognostic crop types + else if (iscft(veg_pp%itype(p)) >= 1) then ! prognostic crop types this%leafc(p) = 0._r8 this%leafc_storage(p) = 0._r8 else @@ -3572,7 +3572,7 @@ subroutine veg_cs_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%gresp_storage(p) + & this%gresp_xfer(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%storvegc(p) = & this%storvegc(p) + & this%grainc_storage(p) + & @@ -4249,7 +4249,7 @@ subroutine veg_ns_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%npool(p) + & this%retransn(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%dispvegn(p) = & this%dispvegn(p) + & this%grainn(p) @@ -4997,7 +4997,7 @@ subroutine veg_ps_summary (this, bounds, num_soilc, filter_soilc, num_soilp, fil this%ppool(p) + & this%retransp(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%dispvegp(p) = & this%dispvegp(p) + & this%grainp(p) @@ -8189,7 +8189,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%cpool_livecroot_storage_gr(p) + & this%cpool_deadcroot_storage_gr(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%mr(p) = & this%mr(p) + & this%grain_mr(p) @@ -8214,7 +8214,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%storage_gr(p) ! autotrophic respiration (AR) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%ar(p) = & this%mr(p) + & this%gr(p) + & @@ -8324,8 +8324,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%wood_harvestc(p) = & this%hrv_deadstemc_to_prod10c(p) + & this%hrv_deadstemc_to_prod100c(p) - - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%wood_harvestc(p) = & this%wood_harvestc(p) + & this%hrv_cropc_to_prod1c(p) @@ -8355,7 +8354,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_gresp_xfer_to_fire(p) + & this%m_cpool_to_fire(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%litfall(p) = & this%litfall(p) + & this%livestemc_to_litter(p) + & @@ -8394,7 +8393,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%leafc_loss(p) = this%leafc_loss(p) + & this%hrv_leafc_to_litter(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%leafc_loss(p) = & this%leafc_loss(p) + & this%hrv_leafc_to_prod1c(p) @@ -8438,7 +8437,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%hrv_deadcrootc_storage_to_litter(p) + & this%hrv_deadcrootc_xfer_to_litter(p) ! putting the harvested crop stem and grain in the wood loss bdrewniak - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%woodc_loss(p) = & this%woodc_loss(p) + & this%hrv_grainc_to_prod1c(p) + & @@ -8563,7 +8562,7 @@ subroutine veg_cf_summary_for_ch4( this, bounds, num_soilp, filter_soilp) this%cpool_to_deadstemc(p) + & this%deadstemc_xfer_to_deadstemc(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%agnpp(p) = & this%agnpp(p) + & this%cpool_to_grainc(p) + & @@ -9721,7 +9720,7 @@ subroutine veg_nf_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%wood_harvestn(p) = & this%hrv_deadstemn_to_prod10n(p) + & this%hrv_deadstemn_to_prod100n(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%wood_harvestn(p) = & this%wood_harvestn(p) + & this%hrv_cropn_to_prod1n(p) @@ -10777,7 +10776,7 @@ subroutine veg_pf_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%wood_harvestp(p) = & this%hrv_deadstemp_to_prod10p(p) + & this%hrv_deadstemp_to_prod100p(p) - if ( crop_prog .and. veg_pp%itype(p) >= npcropmin )then + if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then this%wood_harvestp(p) = & this%wood_harvestp(p) + & this%hrv_cropp_to_prod1p(p) diff --git a/components/elm/src/data_types/VegetationPropertiesType.F90 b/components/elm/src/data_types/VegetationPropertiesType.F90 index 21d7ed671f3..16f251377a4 100644 --- a/components/elm/src/data_types/VegetationPropertiesType.F90 +++ b/components/elm/src/data_types/VegetationPropertiesType.F90 @@ -147,7 +147,7 @@ module VegetationPropertiesType real(r8), pointer :: climatezone(:) => null() !climate zone adapted real(r8), pointer :: nonvascular(:) => null() !nonvascular type or vascular real(r8), pointer :: graminoid(:) => null() !graminoid or not - real(r8), pointer :: generic_crop(:) => null() !generic crop or not for prognostic crop modules (?) + real(r8), pointer :: iscft(:) => null() !generic crop (0) or (1) crop for prognostic crop modules real(r8), pointer :: needleleaf(:) => null() !needleleaf or broadleaf real(r8), pointer :: nfixer(:) => null() !cablity of nitrogen fixation from atm. N2 @@ -189,7 +189,7 @@ subroutine veg_vp_init(this) use pftvarcon , only : lmrha, vcmaxhd, jmaxhd, tpuhd, lmrse, qe, theta_cj use pftvarcon , only : bbbopt, mbbopt, nstor, br_xr, tc_stress, lmrhd ! new properties for flexible PFT - use pftvarcon , only : climatezone, nonvascular, graminoid, generic_crop,needleleaf, nfixer + use pftvarcon , only : climatezone, nonvascular, graminoid, iscft,needleleaf, nfixer ! class (vegetation_properties_type) :: this @@ -318,7 +318,7 @@ subroutine veg_vp_init(this) allocate( this%climatezone(0:numpft)) ; this%climatezone(:) =spval allocate( this%nonvascular(0:numpft)) ; this%nonvascular(:) =spval allocate( this%graminoid(0:numpft)) ; this%graminoid(:) =spval - allocate( this%generic_crop(0:numpft)) ; this%generic_crop(:) =spval + allocate( this%iscft(0:numpft)) ; this%iscft(:) =spval allocate( this%needleleaf(0:numpft)) ; this%needleleaf(:) =spval allocate( this%nfixer(0:numpft)) ; this%nfixer(:) =spval ! ----------------------------------------------------------------------------------------------------------- @@ -414,7 +414,7 @@ subroutine veg_vp_init(this) this%climatezone(m) = climatezone(m) this%nonvascular(m) = nonvascular(m) this%graminoid(m) = graminoid(m) - this%generic_crop(m) = generic_crop(m) + this%iscft(m) = iscft(m) this%needleleaf(m) = needleleaf(m) this%nfixer(m) = nfixer(m) diff --git a/components/elm/src/main/filterMod.F90 b/components/elm/src/main/filterMod.F90 index 768235bea40..eb3f2f2ef1d 100644 --- a/components/elm/src/main/filterMod.F90 +++ b/components/elm/src/main/filterMod.F90 @@ -272,7 +272,7 @@ subroutine setFiltersOneGroup(bounds, this_filter, include_inactive, icemask_grc ! ! !USES: use decompMod , only : BOUNDS_LEVEL_CLUMP - use pftvarcon , only : npcropmin, nppercropmin + use pftvarcon , only : iscft, crop, percrop use landunit_varcon, only : istsoil, istcrop, istice_mec use column_varcon, only : icol_road_perv ! @@ -420,17 +420,17 @@ subroutine setFiltersOneGroup(bounds, this_filter, include_inactive, icemask_grc t =veg_pp%topounit(p) if (top_pp%active(t)) then if (veg_pp%active(p) .or. include_inactive) then - if (veg_pp%itype(p) < npcropmin) then + if (iscft(veg_pp%itype(p)) < 1) then l =veg_pp%landunit(p) if (lun_pp%itype(l) == istsoil .or. lun_pp%itype(l) == istcrop) then fnc = fnc + 1 this_filter(nc)%soilnopcropp(fnc) = p end if else - if (veg_pp%itype(p) < nppercropmin) then + if (percrop(veg_pp%itype(p)) < 1) then fc = fc + 1 this_filter(nc)%pcropp(fc) = p - else if (veg_pp%itype(p) >= nppercropmin) then + else if (percrop(veg_pp%itype(p)) >= 1) then fpc = fpc + 1 this_filter(nc)%ppercropp(fpc) = p end if diff --git a/components/elm/src/main/pftvarcon.F90 b/components/elm/src/main/pftvarcon.F90 index 1b06a49cf2f..dc5d837472a 100644 --- a/components/elm/src/main/pftvarcon.F90 +++ b/components/elm/src/main/pftvarcon.F90 @@ -318,7 +318,7 @@ module pftvarcon real(r8), allocatable :: nonvascular(:) ! nonvascular lifeform flag (0 = vascular, 1 = moss, 2 = lichen) real(r8), allocatable :: needleleaf(:) ! needleleaf lifeform flag (0 = broadleaf, 1 = needleleaf) real(r8), allocatable :: graminoid(:) ! graminoid lifeform flag (0 = nonvascular+woody+crop+percrop, 1 = graminoid) - real(r8), allocatable :: generic_crop(:) ! generic_crop (0 = non_crop or prognostic crop, 1 = generic crop, i.e. crop when use_crop=false) + real(r8), allocatable :: iscft(:) ! crop function type flag (0 = non_crop or generic crop, i.e. crop when use_crop=false, 1 = prognostic crop with cft created) real(r8), allocatable :: nfixer(:) ! nitrogen fixer flag (0 = inable, 1 = able to nitrogen fixation from atm. N2) @@ -641,7 +641,7 @@ subroutine pftconrd allocate( climatezone (0:mxpft) ) allocate( nonvascular (0:mxpft) ) allocate( graminoid (0:mxpft) ) - allocate( generic_crop (0:mxpft) ) + allocate( iscft (0:mxpft) ) allocate( needleleaf (0:mxpft) ) allocate( nfixer (0:mxpft) ) @@ -1127,23 +1127,13 @@ subroutine pftconrd end if end if - call ncd_io('iscft', generic_crop, 'read', ncid, readvar=readv) ! read-in is 'CFT' or not for crop type + call ncd_io('iscft', iscft, 'read', ncid, readvar=readv) ! read-in is 'CFT' or not for crop type if ( .not. readv ) then if (PFT_DEFAULT) then - generic_crop(:) = 0 ! will assign a value below + iscft(:) = 0 ! will assign a value below else call endrun(msg='ERROR: error in reading in user-defined pft data'//errMsg(__FILE__,__LINE__)) end if - else - do i = 0, npft-1 - if ((crop(i)>=1 .or. percrop(i)>=1) .and. generic_crop(i)==0) then - ! at this moment, read-in 'generic_crop' is actually 'iscft' (i.e. crop as CFT or not) - ! So must re-assign - generic_crop(i) = 1 - else - generic_crop(i) = 0 - end if - end do end if call ncd_pio_closefile(ncid) @@ -1243,7 +1233,7 @@ subroutine pftconrd ! when not using those indexing of PFT orders anymore in other codes than here. needleleaf(noveg+1:ndllf_dcd_brl_tree) = 1 graminoid(nc3_arctic_grass:nc4_grass) = 1 - generic_crop(nc3crop:nc3irrig) = 1 + iscft(npcropmin:max(npcropmax,nppercropmax)) = 1 nfixer(nsoybean) = 1 nfixer(nsoybeanirrig) = 1 @@ -1280,13 +1270,16 @@ subroutine pftconrd ncft0 = -1 noncropmax = 0 do i = 0, npft-1 - if (crop(i)>=1 .or. percrop(i)>=1 .or. generic_crop(i)>=1) then - numcft = numcft + 1 + if (crop(i)>=1 .or. percrop(i)>=1 .or. iscft(i)>=1) then + numcft = numcft + 1 ! includes generic_crop, while cft_size NOT (???? todo checking) if(use_crop) then - ! if 'generic_crop' specifically defined, + + ! the following assumes that all crop pfts are in a block + + ! if 'generic crop' (crop=1) specifically flagged by iscft=0 ! 'crop' will not be counted into prognostic - if (crop(i)>=1 .and. generic_crop(i)==0) then + if (crop(i)>=1 .and. iscft(i)==1) then npcropmax = i if(npcropmin<=0) npcropmin = i end if @@ -1299,11 +1292,9 @@ subroutine pftconrd end if else - if(crop(i)>=1 .or. generic_crop(i)>=1) then - ! in case either 'crop' or 'generic_crop' or both defined when not use_crop=.true. - generic_crop(i) = 1 - else - generic_crop(i) = 0 + if(crop(i)>=1 .or. percrop(i)>=1) then + ! in case either 'crop' or 'generic crop' or both defined, it must be generic, when not use_crop=.true. + iscft(i) = 0 end if end if @@ -1322,7 +1313,7 @@ subroutine pftconrd ! need to check 'noveg' if ( woody(i)<=0 .and. graminoid(i)<=0 .and. nonvascular(i)<=0 .and. & - generic_crop(i)<=0 .and. crop(i)<=0 .and. percrop(i)<=0) then + iscft(i)<=0 .and. crop(i)<=0 .and. percrop(i)<=0) then if (noveg>=0) then ! not yet support multiple non-vegetated PFT ! this also will catch error of no actual PFT if npft>1 @@ -1375,23 +1366,23 @@ subroutine pftconrd if ( .not. use_fates ) then do i = 0, mxpft if (i == noveg) then - if ( (nonvascular(i)+woody(i)+graminoid(i)+generic_crop(i)+crop(i)+percrop(i)) >= 1 .or. & + if ( (nonvascular(i)+woody(i)+graminoid(i)+max(iscft(i),crop(i)+percrop(i))) >= 1 .or. & (needleleaf(i)+evergreen(i)+stress_decid(i)+season_decid(i)+nfixer(i)) >= 1 ) then print *, 'ERROR: Incorrect not-vegetated PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: not_vegetated has at least one positive PFT flag '//errMsg(__FILE__, __LINE__)) end if - else if ( (nonvascular(i)+woody(i)+graminoid(i)+generic_crop(i)+crop(i)+percrop(i)) >= 1) then - if (nonvascular(i) >= 1 .and. (woody(i)+graminoid(i)+generic_crop(i)+crop(i)+percrop(i)) >= 1) then + else if ( (nonvascular(i)+woody(i)+graminoid(i)+max(iscft(i),crop(i)+percrop(i))) >= 1) then + if (nonvascular(i) >= 1 .and. (woody(i)+graminoid(i)+max(iscft(i),crop(i)+percrop(i))) >= 1) then print *, 'ERROR: Incorrect nonvasculr PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: nonvascular PFT cannot be any of woody/graminoid/crop type '//errMsg(__FILE__, __LINE__)) - else if (woody(i) >= 1 .and. (nonvascular(i)+graminoid(i)+generic_crop(i)+crop(i)+percrop(i)) >= 1) then + else if (woody(i) >= 1 .and. (nonvascular(i)+graminoid(i)+max(iscft(i),crop(i)+percrop(i))) >= 1) then print *, 'ERROR: Incorrect woody PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: woody PFT cannot be any of nonvascular/graminoid/crop type - '//errMsg(__FILE__, __LINE__)) - else if (graminoid(i) >= 1 .and. (nonvascular(i)+woody(i)+generic_crop(i)+crop(i)+percrop(i)) >=1 ) then + else if (graminoid(i) >= 1 .and. (nonvascular(i)+woody(i)+max(iscft(i),crop(i)+percrop(i))) >=1 ) then print *, 'ERROR: Incorrect graminoid PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: graminoid PFT cannot be any of nonvascular/woody/crop type - '//errMsg(__FILE__, __LINE__)) - else if ( (generic_crop(i)+crop(i)+percrop(i)) >= 1 .and. (nonvascular(i)+woody(i)+graminoid(i)) >= 1) then + else if ( (max(iscft(i),crop(i)+percrop(i))) >= 1 .and. (nonvascular(i)+woody(i)+graminoid(i)) >= 1) then print *, 'ERROR: Incorrect crop PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: crop PFT cannot be any of nonvascular/woody/graminoid type - '//errMsg(__FILE__, __LINE__)) end if @@ -1417,11 +1408,11 @@ subroutine pftconrd if (masterproc) then write(iulog,*) write(iulog,*) 'Using PFT physiological parameters from: ', paramfile - write(iulog,*) ' -- index -- name -- climate zone -- -- woody -- -- needleleaf -- -- evergreen -- -- stress_decid -- -- season_decid -- -- graminoid-- -- generic_crop -- -- crop -- -- perennial crop -- -- nfixer --' + write(iulog,*) ' -- index -- name -- climate zone -- -- woody -- -- needleleaf -- -- evergreen -- -- stress_decid -- -- season_decid -- -- graminoid-- -- iscft -- -- crop -- -- perennial crop -- -- nfixer --' do i = 0, npft-1 write(iulog,*) i, pftname(i), int(climatezone(i)), int(woody(i)), int(needleleaf(i)), & int(evergreen(i)), int(stress_decid(i)), int(season_decid(i)), & - int(graminoid(i)), int(generic_crop(i)), int(crop(i)), int(percrop(i)), int(nfixer(i)) + int(graminoid(i)), int(iscft(i)), int(crop(i)), int(percrop(i)), int(nfixer(i)) end do write(iulog,*) end if diff --git a/components/elm/src/main/surfrdMod.F90 b/components/elm/src/main/surfrdMod.F90 index 1a957e8cd38..d61ac41e38e 100755 --- a/components/elm/src/main/surfrdMod.F90 +++ b/components/elm/src/main/surfrdMod.F90 @@ -1265,6 +1265,8 @@ subroutine surfrd_veg_all(begg, endg, ncid, ns,ntpu) do nl = begg,endg do t = 1, max_topounits + ! (TODO) the following assumes that rainfed/irrigated crop are ordered side by side + ! indexing is fixed wt_cft(nl,t,nc3crop) = wt_cft(nl,t,nc3crop) + wt_cft(nl,t,nc3irrig) wt_cft(nl,t,nc3irrig) = 0._r8 wt_cft(nl,t,ncorn) = wt_cft(nl,t,ncorn) + wt_cft(nl,t,ncornirrig) diff --git a/components/elm/src/main/surfrdUtilsMod.F90 b/components/elm/src/main/surfrdUtilsMod.F90 index 1e58b5174af..c581f968aaf 100644 --- a/components/elm/src/main/surfrdUtilsMod.F90 +++ b/components/elm/src/main/surfrdUtilsMod.F90 @@ -310,7 +310,7 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose use elm_varctl , only : irrigate use elm_varpar , only : cft_lb, cft_ub, cft_size use pftvarcon , only: is_pft_known_to_model - use pftvarcon , only : npcropmax, mergetoelmpft, npcropmin + use pftvarcon , only : npcropmax, mergetoelmpft use topounit_varcon , only : max_topounits ! TKT use GridcellType , only : grc_pp ! TKT ! From 0dcb1658da7ecc13c83e3a0b09026151b69ba77e Mon Sep 17 00:00:00 2001 From: Peter Thornton Date: Sun, 19 May 2024 13:04:00 -0400 Subject: [PATCH 122/197] Bug fix to remove topi, topf and use max_topounits, plus cleanup --- components/elm/src/main/surfrdUtilsMod.F90 | 33 ++++++++-------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/components/elm/src/main/surfrdUtilsMod.F90 b/components/elm/src/main/surfrdUtilsMod.F90 index c581f968aaf..2c1e42559da 100644 --- a/components/elm/src/main/surfrdUtilsMod.F90 +++ b/components/elm/src/main/surfrdUtilsMod.F90 @@ -36,7 +36,7 @@ subroutine check_sums_equal_1_3d(arr, lb, name, caller) ! Confirm that sum(arr(n,:)) == 1 for all n. If this isn't true for any n, abort with a message. ! ! Uses - use topounit_varcon, only : max_topounits, has_topounit + use topounit_varcon, only : max_topounits ! !ARGUMENTS: integer , intent(in) :: lb ! lower bound of the first dimension of arr @@ -123,7 +123,7 @@ subroutine convert_cft_to_pft( begg, endg, cftsize, wt_cft ) ! a crop landunit, and put them on the vegetated landunit. ! !USES: use elm_varsur , only : wt_lunit, wt_nat_patch - use elm_varpar , only : cft_size, surfpft_size + use elm_varpar , only : cft_size use elm_varpar , only : natpft_size use landunit_varcon , only : istsoil, istcrop use topounit_varcon , only : max_topounits @@ -170,7 +170,6 @@ subroutine convert_pft_to_cft( begg, endg ) ! the new crop landunit ! !USES: use elm_varsur , only : wt_lunit, wt_nat_patch, wt_cft - use elm_varpar , only : cft_size, surfpft_size use elm_varpar , only : cft_size, cft_lb, cft_ub, surfpft_lb, surfpft_ub use landunit_varcon , only : istsoil, istcrop use topounit_varcon , only : max_topounits @@ -261,7 +260,6 @@ subroutine collapse_crop_var(crop_var, begg, endg) use elm_varpar, only: cft_lb, cft_ub, cft_size use pftvarcon , only: is_pft_known_to_model use topounit_varcon , only : max_topounits ! TKT - use GridcellType, only : grc_pp ! ! !ARGUMENTS: ! Use begg and endg rather than 'bounds', because bounds may not be @@ -311,8 +309,7 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose use elm_varpar , only : cft_lb, cft_ub, cft_size use pftvarcon , only: is_pft_known_to_model use pftvarcon , only : npcropmax, mergetoelmpft - use topounit_varcon , only : max_topounits ! TKT - use GridcellType , only : grc_pp ! TKT + use topounit_varcon , only : max_topounits ! ! !ARGUMENTS: @@ -323,16 +320,15 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose ! Weight and fertilizer of each CFT in each grid cell; dimensioned [g, cft_lb:cft_ub] ! This array is modified in-place - real(r8), intent(inout) :: wt_cft(begg:,1:, cft_lb:) !TKT - real(r8), intent(inout) :: fert_cft(begg:,1:, cft_lb:) !TKT + real(r8), intent(inout) :: wt_cft(begg:,1:, cft_lb:) + real(r8), intent(inout) :: fert_cft(begg:,1:, cft_lb:) real(r8), intent(inout) :: fert_p_cft(begg:, 1:, cft_lb:) logical, intent(in) :: verbose ! If true, print some extra information ! ! !LOCAL VARIABLES: - integer :: g, t,t2 ! TKT + integer :: g, t,t2 integer :: m - !integer, allocatable :: ntpu(:) ! To store number of topounits per grid TKT real(r8) :: wt_cft_to real(r8) :: wt_cft_from real(r8) :: wt_cft_merge @@ -340,7 +336,7 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose character(len=*), parameter :: subname = 'collapse_crop_types' !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(wt_cft) == (/endg,max_topounits, cft_ub/)), errMsg(__FILE__, __LINE__)) ! TKT + SHR_ASSERT_ALL((ubound(wt_cft) == (/endg,max_topounits, cft_ub/)), errMsg(__FILE__, __LINE__)) SHR_ASSERT_ALL((ubound(fert_cft) == (/endg,max_topounits, cft_ub/)), errMsg(__FILE__, __LINE__)) SHR_ASSERT_ALL((ubound(fert_p_cft) == (/endg,max_topounits, cft_ub/)), errMsg(__FILE__, __LINE__)) @@ -353,14 +349,12 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose ! ------------------------------------------------------------------------ ! If not using irrigation, merge irrigated CFTs into rainfed CFTs ! ------------------------------------------------------------------------ - !allocate(ntpu(begg:endg)) if (.not. irrigate) then if (verbose .and. masterproc) then write(iulog,*) trim(subname)//' crop=.T. and irrigate=.F., so merging irrigated pfts with rainfed' end if do g = begg, endg - !ntpu(g) = grc_pp%ntopounits(g) ! Left Hand Side: merged rainfed+irrigated crop pfts from nc3crop to ! npcropmax-1, stride 2 ! Right Hand Side: rainfed crop pfts from nc3crop to npcropmax-1, @@ -369,16 +363,14 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose ! stride 2 ! where stride 2 means "every other" - do t = grc_pp%topi(g), grc_pp%topf(g) ! TKT - t2 = t - grc_pp%topi(g) + 1 - + do t2 = 1, max_topounits wt_cft(g,t2, cft_lb:cft_ub-1:2) = & - wt_cft(g,t2, cft_lb:cft_ub-1:2) + wt_cft(g,t2, cft_lb+1:cft_ub:2) ! TKT + wt_cft(g,t2, cft_lb:cft_ub-1:2) + wt_cft(g,t2, cft_lb+1:cft_ub:2) wt_cft(g,t2, cft_lb+1:cft_ub:2) = 0._r8 - end do ! TKT + end do end do - call check_sums_equal_1_3d(wt_cft, begg, 'wt_cft', subname//': irrigation') ! TKT + call check_sums_equal_1_3d(wt_cft, begg, 'wt_cft', subname//': irrigation') end if ! ------------------------------------------------------------------------ @@ -412,8 +404,7 @@ subroutine collapse_crop_types(wt_cft, fert_cft, fert_p_cft, begg, endg, verbose end do end do - call check_sums_equal_1_3d(wt_cft, begg, 'wt_cft', subname//': mergetoelmpft') ! TKT - !deallocate(ntpu) + call check_sums_equal_1_3d(wt_cft, begg, 'wt_cft', subname//': mergetoelmpft') end subroutine collapse_crop_types end module surfrdUtilsMod From ee819167f2d14b08f6046050902ce30a299e7518 Mon Sep 17 00:00:00 2001 From: Fengming Yuan Date: Sun, 21 Jul 2024 13:02:28 -0400 Subject: [PATCH 123/197] Move a few array allocations to after pftconrd(). (#6) --- components/elm/src/main/elm_initializeMod.F90 | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/components/elm/src/main/elm_initializeMod.F90 b/components/elm/src/main/elm_initializeMod.F90 index 9fe4959c241..b7fe36f24ed 100755 --- a/components/elm/src/main/elm_initializeMod.F90 +++ b/components/elm/src/main/elm_initializeMod.F90 @@ -269,10 +269,10 @@ subroutine initialize1( ) allocate (wt_lunit (begg:endg,1:max_topounits, max_lunit )) allocate (urban_valid (begg:endg,1:max_topounits )) - allocate (wt_nat_patch (begg:endg,1:max_topounits, surfpft_lb:surfpft_ub )) - allocate (wt_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) - allocate (fert_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) - allocate (fert_p_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) + !allocate (wt_nat_patch (begg:endg,1:max_topounits, surfpft_lb:surfpft_ub )) + !allocate (wt_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) + !allocate (fert_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) + !allocate (fert_p_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) if (create_glacier_mec_landunit) then allocate (wt_glc_mec (begg:endg,1:max_topounits, maxpatch_glcmec)) allocate (topo_glc_mec(begg:endg,1:max_topounits, maxpatch_glcmec)) @@ -294,16 +294,13 @@ subroutine initialize1( ) ! Independent of model resolution, Needs to stay before surfrd_get_data call pftconrd() - ! by user-defined PFT (numbers and names), 'numpft/mxpft_nc' changed and other indices - ! a few arrays had been allocated in elm_initializedMod.F90:L266-268 and require redo after this 'pftconrd' call - if ((numpft/=mxpft .or. numpft/=numveg) .or. (mxpft_nc/=24 .or. mxpft_nc/=numveg)) then - if (associated(wt_nat_patch)) deallocate(wt_nat_patch) - allocate (wt_nat_patch (begg:endg,1:max_topounits, surfpft_lb:surfpft_ub )) - if (associated(wt_cft)) deallocate(wt_cft) - allocate (wt_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) - if (associated(fert_cft)) deallocate(fert_cft) - allocate (fert_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) - endif + ! if by user-defined PFT (numbers and names), 'numpft/mxpft_nc' may be changed including other derived indices + ! + ! a few arrays allocation previously done above is moved here i.e. after this 'pftconrd' call + allocate (wt_nat_patch (begg:endg,1:max_topounits, surfpft_lb:surfpft_ub )) + allocate (wt_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) + allocate (fert_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) + allocate (fert_p_cft (begg:endg,1:max_topounits, cft_lb:cft_ub )) call soilorder_conrd() From d2164819c243e6760e60d1d3d11961a4215a7e9e Mon Sep 17 00:00:00 2001 From: Peter Thornton Date: Sun, 21 Jul 2024 22:07:12 -0400 Subject: [PATCH 124/197] Convert iscft() from real(r8) to logical. This is a demonstration of how the same approach could be used for other flags that are used as logicals but allocated as reals or integers. [BFB] --- .../elm/src/biogeochem/AllocationMod.F90 | 36 +++++++-------- .../src/biogeochem/CNAllocationBetrMod.F90 | 38 +++++++--------- .../elm/src/biogeochem/CNCarbonFluxType.F90 | 14 +++--- .../elm/src/biogeochem/CNCarbonStateType.F90 | 4 +- .../src/biogeochem/CNGapMortalityBeTRMod.F90 | 4 +- .../src/biogeochem/CNNStateUpdate1BeTRMod.F90 | 8 ++-- .../src/biogeochem/CNNStateUpdate2BeTRMod.F90 | 2 +- .../elm/src/biogeochem/CNNitrogenFluxType.F90 | 1 - .../src/biogeochem/CNNitrogenStateType.F90 | 2 +- .../elm/src/biogeochem/CNPhenologyBeTRMod.F90 | 4 +- .../src/biogeochem/CarbonStateUpdate1Mod.F90 | 18 ++++---- .../src/biogeochem/CarbonStateUpdate2Mod.F90 | 2 +- components/elm/src/biogeochem/CropType.F90 | 2 +- .../elm/src/biogeochem/DryDepVelocity.F90 | 2 +- components/elm/src/biogeochem/FireMod.F90 | 12 ++--- .../elm/src/biogeochem/GapMortalityMod.F90 | 10 ++--- .../elm/src/biogeochem/GrowthRespMod.F90 | 2 +- .../elm/src/biogeochem/MaintenanceRespMod.F90 | 2 +- .../biogeochem/NitrogenStateUpdate1Mod.F90 | 8 ++-- .../biogeochem/NitrogenStateUpdate2Mod.F90 | 2 +- .../src/biogeochem/PhenologyFluxLimitMod.F90 | 22 ++++----- .../elm/src/biogeochem/PhenologyMod.F90 | 22 +++------ .../biogeochem/PhosphorusStateUpdate1Mod.F90 | 8 ++-- .../biogeochem/PhosphorusStateUpdate2Mod.F90 | 2 +- .../src/biogeochem/PrecisionControlMod.F90 | 4 +- .../elm/src/biogeochem/RootDynamicsMod.F90 | 2 +- .../elm/src/biogeochem/VOCEmissionMod.F90 | 2 +- .../elm/src/biogeochem/VegStructUpdateMod.F90 | 4 +- components/elm/src/biogeophys/SedYieldMod.F90 | 4 +- .../elm/src/data_types/VegetationDataType.F90 | 26 +++++------ .../data_types/VegetationPropertiesType.F90 | 4 +- components/elm/src/main/filterMod.F90 | 2 +- components/elm/src/main/pftvarcon.F90 | 45 +++++++++++-------- 33 files changed, 157 insertions(+), 163 deletions(-) diff --git a/components/elm/src/biogeochem/AllocationMod.F90 b/components/elm/src/biogeochem/AllocationMod.F90 index 0110367f59c..141194397fb 100644 --- a/components/elm/src/biogeochem/AllocationMod.F90 +++ b/components/elm/src/biogeochem/AllocationMod.F90 @@ -585,7 +585,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp mr = leaf_mr(p) + froot_mr(p) if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (iscft(ivt(p)) >= 1) then + else if (iscft(ivt(p))) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) end if @@ -672,7 +672,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp f5 = 0._r8 ! continued intializations from above - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops if (croplive(p) .and. percrop(ivt(p)) == 0.0_r8 ) then ! same phases appear in subroutine CropPhenology @@ -822,7 +822,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + & (f3*(1._r8-f4)*(1._r8+f2))/cpdw - else if (iscft(ivt(p)) >= 1) then ! skip generic crops + else if (iscft(ivt(p))) then ! skip generic crops cng = graincn(ivt(p)) cpg = graincp(ivt(p)) c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) @@ -852,10 +852,10 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp ! retransn pool has N from leaves, stems, and roots for ! retranslocation - if (iscft(ivt(p)) >= 1 .and. grain_flag(p) == 1._r8) then + if (iscft(ivt(p)) .and. grain_flag(p) == 1._r8) then avail_retransn(p) = plant_ndemand(p) avail_retransp(p) = plant_pdemand(p) - else if (iscft(ivt(p)) < 1 .and. annsum_potential_gpp(p) > 0._r8) then + else if ((.not. iscft(ivt(p))) .and. annsum_potential_gpp(p) > 0._r8) then avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt avail_retransp(p) = (annmax_retransp(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt else @@ -2142,7 +2142,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & fcur = fcur2(ivt(p)) - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops if (croplive(p)) then f1 = aroot(p) / aleaf(p) f3 = astem(p) / aleaf(p) @@ -2328,7 +2328,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & fcur = fcur2(ivt(p)) - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops if (croplive(p)) then f1 = aroot(p) / aleaf(p) f3 = astem(p) / aleaf(p) @@ -2345,10 +2345,10 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & sminn_to_npool(p) = sminn_to_plant_patch(p) sminp_to_ppool(p) = sminp_to_plant_patch(p) - if (iscft(ivt(p)) >= 1 .and. grain_flag(p) == 1._r8) then + if (iscft(ivt(p)) .and. grain_flag(p) == 1._r8) then avail_retransn(p) = retransn(p)/dt avail_retransp(p) = retransp(p)/dt - else if (iscft(ivt(p)) < 1 .and. annsum_potential_gpp(p) > 0._r8) then + else if ((.not. iscft(ivt(p))) .and. annsum_potential_gpp(p) > 0._r8) then avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt avail_retransp(p) = (annmax_retransp(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt else @@ -2374,7 +2374,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & mr = leaf_mr(p) + froot_mr(p) if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (iscft(ivt(p)) >= 1) then + else if (iscft(ivt(p))) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) end if @@ -2473,7 +2473,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + & (f3*(1._r8-f4)*(1._r8+f2))/cpdw - else if (iscft(ivt(p)) >= 1) then ! skip generic crops + else if (iscft(ivt(p))) then ! skip generic crops cng = graincn(ivt(p)) cpg = graincp(ivt(p)) c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) @@ -2559,7 +2559,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f2 * f3 * (1._r8 - f4) * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) * (1 + g1) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * (1._r8 - fcur) * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * (1._r8 - f4) * fcur * (1 + g1) @@ -2590,7 +2590,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpool_to_livestemc(p) = nlc * f3 * f4 * fcur cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur @@ -2643,7 +2643,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cng = graincn(ivt(p)) npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) @@ -2687,7 +2687,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_deadcrootp(p) = (nlc * f2 * f3 * (1._r8 - f4) / cpdw)* fcur ppool_to_deadcrootp_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cpdw)* (1._r8 - fcur) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpg = graincp(ivt(p)) ppool_to_livestemp(p) = (nlc * f3 * f4 / cplw) * fcur ppool_to_livestemp_storage(p) = (nlc * f3 * f4 / cplw) * (1._r8 -fcur) @@ -2717,7 +2717,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) gresp_storage = gresp_storage + cpool_to_deadcrootc_storage(p) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) gresp_storage = gresp_storage + cpool_to_grainc_storage(p) end if @@ -2771,7 +2771,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_deadcrootn(p) = cpool_to_deadcrootc(p) / cndw npool_to_deadcrootn_storage(p) = cpool_to_deadcrootc_storage(p) / cndw end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cng = graincn(ivt(p)) supplement_to_plantn(p) = supplement_to_plantn(p) + cpool_to_livestemc(p) / cnlw - npool_to_livestemn(p) supplement_to_plantn(p) = supplement_to_plantn(p) + cpool_to_livestemc_storage(p) / cnlw & @@ -2843,7 +2843,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_deadcrootp(p) = cpool_to_deadcrootc(p) / cpdw ppool_to_deadcrootp_storage(p) = cpool_to_deadcrootc_storage(p) / cpdw end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpg = graincp(ivt(p)) supplement_to_plantp(p) = supplement_to_plantp(p) + max(cpool_to_livestemc(p) / cplw & - ppool_to_livestemp(p),0._r8) diff --git a/components/elm/src/biogeochem/CNAllocationBetrMod.F90 b/components/elm/src/biogeochem/CNAllocationBetrMod.F90 index cc8b72046a1..8cfc342bb40 100644 --- a/components/elm/src/biogeochem/CNAllocationBetrMod.F90 +++ b/components/elm/src/biogeochem/CNAllocationBetrMod.F90 @@ -645,7 +645,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp mr = leaf_mr(p) + froot_mr(p) if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (iscft(ivt(p)) >= 1) then + else if (iscft(ivt(p))) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) end if @@ -726,7 +726,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp f5 = 0._r8 ! continued intializations from above - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops if (croplive(p)) then ! same phases appear in subroutine CropPhenology @@ -859,7 +859,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + & (f3*(1._r8-f4)*(1._r8+f2))/cpdw - else if (iscft(ivt(p)) >= 1) then ! skip generic crops + else if (iscft(ivt(p))) then ! skip generic crops cng = graincn(ivt(p)) cpg = graincp(ivt(p)) c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) @@ -889,10 +889,10 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp ! retransn pool has N from leaves, stems, and roots for ! retranslocation - if (iscft(ivt(p)) >= 1 .and. grain_flag(p) == 1._r8) then + if (iscft(ivt(p)) .and. grain_flag(p) == 1._r8) then avail_retransn(p) = plant_ndemand(p) avail_retransp(p) = plant_pdemand(p) - else if (iscft(ivt(p)) < 1 .and. annsum_potential_gpp(p) > 0._r8) then + else if ((.not. iscft(ivt(p))) .and. annsum_potential_gpp(p) > 0._r8) then avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt avail_retransp(p) = (annmax_retransp(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt else @@ -1105,14 +1105,10 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & use shr_sys_mod , only: shr_sys_flush use elm_varctl , only: iulog,cnallocate_carbon_only,cnallocate_carbonnitrogen_only,& cnallocate_carbonphosphorus_only -! use pftvarcon , only: iscft, declfact, bfact, aleaff, arootf, astemf -! use pftvarcon , only: arooti, fleafi, allconsl, allconss, grperc, grpnow, nsoybean use pftvarcon , only: noveg use pftvarcon , only: iscft, grperc, grpnow use elm_varpar , only: nlevdecomp !!nlevsoi, use elm_varcon , only: nitrif_n2o_loss_frac, secspday -! use landunit_varcon , only: istsoil, istcrop -! use elm_time_manager , only: get_step_size ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -1393,7 +1389,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & fcur = fcur2(ivt(p)) - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops if (croplive(p)) then f1 = aroot(p) / aleaf(p) f3 = astem(p) / aleaf(p) @@ -1412,10 +1408,10 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & plant_n_buffer_patch(p) = plant_n_buffer_patch(p) * (1._r8-dt/taun) plant_p_buffer_patch(p) = plant_p_buffer_patch(p) * (1._r8-dt/taun) - if (iscft(ivt(p)) >= 1 .and. grain_flag(p) == 1._r8) then + if (iscft(ivt(p)) .and. grain_flag(p) == 1._r8) then avail_retransn(p) = retransn(p)/dt avail_retransp(p) = retransp(p)/dt - else if (iscft(ivt(p)) < 1 .and. annsum_potential_gpp(p) > 0._r8) then + else if ((.not. iscft(ivt(p))) .and. annsum_potential_gpp(p) > 0._r8) then avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt avail_retransp(p) = (annmax_retransp(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt else @@ -1436,7 +1432,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & mr = leaf_mr(p) + froot_mr(p) if (woody(ivt(p)) >= 1.0_r8) then mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (iscft(ivt(p)) >= 1) then + else if (iscft(ivt(p))) then if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) end if ! try to take mr from xsmr storage pool first @@ -1530,7 +1526,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & p_allometry(p) = 1._r8/cpl + f1/cpfr + (f3*f4*(1._r8+f2))/cplw + & (f3*(1._r8-f4)*(1._r8+f2))/cpdw - else if (iscft(ivt(p)) >= 1) then ! skip generic crops + else if (iscft(ivt(p))) then ! skip generic crops cng = graincn(ivt(p)) cpg = graincp(ivt(p)) c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) @@ -1614,7 +1610,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f2 * f3 * (1._r8 - f4) * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) * (1 + g1) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * fcur * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * f4 * (1._r8 - fcur) * (1 + g1) cpool_to_xsmrpool(p) = cpool_to_xsmrpool(p) + nlc * f3 * (1._r8 - f4) * fcur * (1 + g1) @@ -1645,7 +1641,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpool_to_livestemc(p) = nlc * f3 * f4 * fcur cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur @@ -1698,7 +1694,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cng = graincn(ivt(p)) npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) @@ -1742,7 +1738,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_deadcrootp(p) = (nlc * f2 * f3 * (1._r8 - f4) / cpdw)* fcur ppool_to_deadcrootp_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cpdw)* (1._r8 - fcur) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpg = graincp(ivt(p)) ppool_to_livestemp(p) = (nlc * f3 * f4 / cplw) * fcur ppool_to_livestemp_storage(p) = (nlc * f3 * f4 / cplw) * (1._r8 -fcur) @@ -1772,7 +1768,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) gresp_storage = gresp_storage + cpool_to_deadcrootc_storage(p) end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) gresp_storage = gresp_storage + cpool_to_grainc_storage(p) end if @@ -1820,7 +1816,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & npool_to_deadcrootn(p) = cpool_to_deadcrootc(p) / cndw npool_to_deadcrootn_storage(p) = cpool_to_deadcrootc_storage(p) / cndw end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cng = graincn(ivt(p)) supplement_to_sminn_vr(c,1) = supplement_to_sminn_vr(c,1) + cpool_to_livestemc(p) / cnlw - npool_to_livestemn(p) supplement_to_sminn_vr(c,1) = supplement_to_sminn_vr(c,1) + cpool_to_livestemc_storage(p) / cnlw & @@ -1891,7 +1887,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , & ppool_to_deadcrootp(p) = cpool_to_deadcrootc(p) / cpdw ppool_to_deadcrootp_storage(p) = cpool_to_deadcrootc_storage(p) / cpdw end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpg = graincp(ivt(p)) supplement_to_sminp_vr(c,1) = supplement_to_sminp_vr(c,1) + max(cpool_to_livestemc(p) / cplw & - ppool_to_livestemp(p),0._r8) diff --git a/components/elm/src/biogeochem/CNCarbonFluxType.F90 b/components/elm/src/biogeochem/CNCarbonFluxType.F90 index 61a3f736f62..a6c56a935f0 100644 --- a/components/elm/src/biogeochem/CNCarbonFluxType.F90 +++ b/components/elm/src/biogeochem/CNCarbonFluxType.F90 @@ -1675,7 +1675,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%cpool_livecroot_storage_gr_patch(p) + & this%cpool_deadcroot_storage_gr_patch(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%mr_patch(p) = & this%mr_patch(p) + & this%grain_mr_patch(p) @@ -1700,7 +1700,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%storage_gr_patch(p) ! autotrophic respiration (AR) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%ar_patch(p) = & this%mr_patch(p) + & this%gr_patch(p) + & @@ -1812,7 +1812,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%wood_harvestc_patch(p) = & this%hrv_deadstemc_to_prod10c_patch(p) + & this%hrv_deadstemc_to_prod100c_patch(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%wood_harvestc_patch(p) = & this%wood_harvestc_patch(p) + & this%hrv_cropc_to_prod1c_patch(p) @@ -1842,7 +1842,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%m_gresp_xfer_to_fire_patch(p) + & this%m_cpool_to_fire_patch(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%litfall_patch(p) = & this%litfall_patch(p) + & @@ -1878,7 +1878,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%hrv_leafc_to_litter_patch(p) + & this%leafc_to_litter_patch(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%leafc_loss_patch(p) = & this%leafc_loss_patch(p) + & this%hrv_leafc_to_prod1c_patch(p) @@ -1920,7 +1920,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%hrv_deadcrootc_storage_to_litter_patch(p) + & this%hrv_deadcrootc_xfer_to_litter_patch(p) ! putting the harvested crop stem and grain in the wood loss bdrewniak - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%woodc_loss_patch(p) = & this%woodc_loss_patch(p) + & this%hrv_grainc_to_prod1c_patch(p) + & @@ -2592,7 +2592,7 @@ subroutine summary_cflux_for_ch4( this, bounds, num_soilp, filter_soilp, num_soi this%cpool_to_deadstemc_patch(p) + & this%deadstemc_xfer_to_deadstemc_patch(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%agnpp_patch(p) = & this%agnpp_patch(p) + & this%cpool_to_grainc_patch(p) + & diff --git a/components/elm/src/biogeochem/CNCarbonStateType.F90 b/components/elm/src/biogeochem/CNCarbonStateType.F90 index 46440bee235..b733773fb20 100644 --- a/components/elm/src/biogeochem/CNCarbonStateType.F90 +++ b/components/elm/src/biogeochem/CNCarbonStateType.F90 @@ -459,7 +459,7 @@ subroutine InitCold(this, bounds, ratio, c12_carbonstate_vars) if (veg_vp%evergreen(veg_pp%itype(p)) == 1._r8) then this%leafc_patch(p) = 1._r8 * ratio this%leafc_storage_patch(p) = 0._r8 - else if (iscft(veg_pp%itype(p)) >= 1) then ! prognostic crop types + else if (iscft(veg_pp%itype(p))) then ! prognostic crop types this%leafc_patch(p) = 0._r8 this%leafc_storage_patch(p) = 0._r8 else @@ -866,7 +866,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%gresp_storage_patch(p) + & this%gresp_xfer_patch(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%storvegc_patch(p) = & this%storvegc_patch(p) + & this%grainc_storage_patch(p) + & diff --git a/components/elm/src/biogeochem/CNGapMortalityBeTRMod.F90 b/components/elm/src/biogeochem/CNGapMortalityBeTRMod.F90 index 370e82ab7ff..3bbbf1db1f6 100644 --- a/components/elm/src/biogeochem/CNGapMortalityBeTRMod.F90 +++ b/components/elm/src/biogeochem/CNGapMortalityBeTRMod.F90 @@ -188,7 +188,7 @@ subroutine CNGapMortality (& * gap_indicator(gid_m_deadcrootn_to_litter) - if (iscft(veg_pp%itype(p)) < 1) then + if (.not. iscft(veg_pp%itype(p))) then veg_nf%m_retransn_to_litter(p) = veg_ns%retransn(p) * m & * gap_indicator(gid_m_retransn_to_litter) end if @@ -239,7 +239,7 @@ subroutine CNGapMortality (& veg_pf%m_deadstemp_to_litter(p) = veg_ps%deadstemp(p) * m veg_pf%m_livecrootp_to_litter(p) = veg_ps%livecrootp(p) * m veg_pf%m_deadcrootp_to_litter(p) = veg_ps%deadcrootp(p) * m - if (iscft(veg_pp%itype(p)) < 1) then + if (.not. iscft(veg_pp%itype(p))) then veg_pf%m_retransp_to_litter(p) = veg_ps%retransp(p) * m end if diff --git a/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 b/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 index f2a431e7283..465c92f82b4 100644 --- a/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 +++ b/components/elm/src/biogeochem/CNNStateUpdate1BeTRMod.F90 @@ -101,7 +101,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) - veg_nf%deadcrootn_xfer_to_deadcrootn(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) - veg_nf%livestemn_xfer_to_livestemn(p)*dt @@ -126,7 +126,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%livecrootn(p) = veg_ns%livecrootn(p) - veg_nf%livecrootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%livecrootn_to_retransn(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! Beth adds retrans from froot + if (iscft(ivt(p))) then ! Beth adds retrans from froot veg_ns%frootn(p) = veg_ns%frootn(p) - veg_nf%frootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%frootn_to_retransn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_litter(p)*dt @@ -172,7 +172,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_storage(p) = veg_ns%deadcrootn_storage(p) + veg_nf%npool_to_deadcrootn_storage(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%npool_to_livestemn(p)*dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn_storage(p)*dt @@ -200,7 +200,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) + veg_nf%deadcrootn_storage_to_xfer(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn_storage(p) = veg_ns%livestemn_storage(p) - veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) + veg_nf%livestemn_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/CNNStateUpdate2BeTRMod.F90 b/components/elm/src/biogeochem/CNNStateUpdate2BeTRMod.F90 index fbfa6110d77..70b56142c88 100644 --- a/components/elm/src/biogeochem/CNNStateUpdate2BeTRMod.F90 +++ b/components/elm/src/biogeochem/CNNStateUpdate2BeTRMod.F90 @@ -147,7 +147,7 @@ subroutine NStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_ns%deadcrootn(p) = veg_ns%deadcrootn(p) - veg_nf%hrv_deadcrootn_to_litter(p) * dt veg_ns%retransn(p) = veg_ns%retransn(p) - veg_nf%hrv_retransn_to_litter(p) * dt - if (iscft(ivt(p)) >=1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_ns%livestemn(p)= veg_ns%livestemn(p) - veg_nf%hrv_livestemn_to_prod1n(p) * dt veg_ns%leafn(p) = veg_ns%leafn(p) - veg_nf%hrv_leafn_to_prod1n(p) * dt veg_ns%grainn(p) = veg_ns%grainn(p) - veg_nf%hrv_grainn_to_prod1n(p) * dt diff --git a/components/elm/src/biogeochem/CNNitrogenFluxType.F90 b/components/elm/src/biogeochem/CNNitrogenFluxType.F90 index b6f02ce91f8..5394e0d05fa 100644 --- a/components/elm/src/biogeochem/CNNitrogenFluxType.F90 +++ b/components/elm/src/biogeochem/CNNitrogenFluxType.F90 @@ -1078,7 +1078,6 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil ! !USES: use elm_varpar , only: nlevdecomp,ndecomp_cascade_transitions,ndecomp_pools use subgridAveMod , only: p2c - use pftvarcon , only : iscft use tracer_varcon , only: is_active_betr_bgc use elm_varpar , only: nlevdecomp_full ! diff --git a/components/elm/src/biogeochem/CNNitrogenStateType.F90 b/components/elm/src/biogeochem/CNNitrogenStateType.F90 index 041c757ae59..a7f7315c6c8 100644 --- a/components/elm/src/biogeochem/CNNitrogenStateType.F90 +++ b/components/elm/src/biogeochem/CNNitrogenStateType.F90 @@ -1007,7 +1007,7 @@ subroutine Summary(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soil this%npool_patch(p) + & this%retransn_patch(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%dispvegn_patch(p) = & this%dispvegn_patch(p) + & this%grainn_patch(p) diff --git a/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 b/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 index aaeb58d9ee9..ac3b58538e8 100644 --- a/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 +++ b/components/elm/src/biogeochem/CNPhenologyBeTRMod.F90 @@ -1895,13 +1895,13 @@ subroutine CropPhenologyInit(bounds) minplantjday(:,:) = huge(1) maxplantjday(:,:) = huge(1) do n = 0, mxpft - if (iscft(n)>=1) then + if (iscft(n)) then minplantjday(n,inNH) = int( get_calday( mnNHplantdate(n), 0 ) ) maxplantjday(n,inNH) = int( get_calday( mxNHplantdate(n), 0 ) ) end if end do do n = 0, mxpft - if (iscft(n)>=1) then + if (iscft(n)) then minplantjday(n,inSH) = int( get_calday( mnSHplantdate(n), 0 ) ) maxplantjday(n,inSH) = int( get_calday( mxSHplantdate(n), 0 ) ) end if diff --git a/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 b/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 index 7513662f467..1eb7f64d025 100644 --- a/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/CarbonStateUpdate1Mod.F90 @@ -284,7 +284,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%deadcrootc(p) = veg_cs%deadcrootc(p) + veg_cf%deadcrootc_xfer_to_deadcrootc(p)*dt veg_cs%deadcrootc_xfer(p) = veg_cs%deadcrootc_xfer(p) - veg_cf%deadcrootc_xfer_to_deadcrootc(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%livestemc_xfer_to_livestemc(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) - veg_cf%livestemc_xfer_to_livestemc(p)*dt @@ -303,7 +303,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%livecrootc(p) = veg_cs%livecrootc(p) - veg_cf%livecrootc_to_deadcrootc(p)*dt veg_cs%deadcrootc(p) = veg_cs%deadcrootc(p) + veg_cf%livecrootc_to_deadcrootc(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_cs%livestemc(p) = veg_cs%livestemc(p) - veg_cf%livestemc_to_litter(p)*dt veg_cs%grainc(p) = veg_cs%grainc(p) - veg_cf%grainc_to_food(p)*dt @@ -319,7 +319,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livestem_curmr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livecroot_curmr(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%livestem_curmr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%grain_curmr(p)*dt end if @@ -337,7 +337,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livestem_xsmr(p)*dt veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livecroot_xsmr(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%livestem_xsmr(p)*dt veg_cs%xsmrpool(p) = veg_cs%xsmrpool(p) - veg_cf%grain_xsmr(p)*dt if (harvdate(p) < 999) then ! beginning at harvest, send to atm @@ -373,7 +373,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_deadcrootc_storage(p)*dt veg_cs%deadcrootc_storage(p) = veg_cs%deadcrootc_storage(p) + veg_cf%cpool_to_deadcrootc_storage(p)*dt end if - if ( iscft(ivt(p)) >= 1 ) then ! skip 2 generic crops + if ( iscft(ivt(p))) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_livestemc(p)*dt veg_cs%livestemc(p) = veg_cs%livestemc(p) + veg_cf%cpool_to_livestemc(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_to_livestemc_storage(p)*dt @@ -393,7 +393,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livecroot_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_deadcroot_gr(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livestem_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_grain_gr(p)*dt end if @@ -407,7 +407,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_livecroot_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_deadcroot_gr(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_livestem_gr(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) - veg_cf%transfer_grain_gr(p)*dt end if @@ -421,7 +421,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livecroot_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_deadcroot_storage_gr(p)*dt end if - if ( iscft(ivt(p)) >= 1 ) then ! skip 2 generic crops + if ( iscft(ivt(p))) then ! skip 2 generic crops veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_livestem_storage_gr(p)*dt veg_cs%cpool(p) = veg_cs%cpool(p) - veg_cf%cpool_grain_storage_gr(p)*dt end if @@ -447,7 +447,7 @@ subroutine CarbonStateUpdate1(bounds, & veg_cs%gresp_storage(p) = veg_cs%gresp_storage(p) - veg_cf%gresp_storage_to_xfer(p)*dt veg_cs%gresp_xfer(p) = veg_cs%gresp_xfer(p) + veg_cf%gresp_storage_to_xfer(p)*dt end if - if ( iscft(ivt(p)) >= 1 ) then ! skip 2 generic crops + if ( iscft(ivt(p))) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_cs%livestemc_storage(p) = veg_cs%livestemc_storage(p) - veg_cf%livestemc_storage_to_xfer(p)*dt veg_cs%livestemc_xfer(p) = veg_cs%livestemc_xfer(p) + veg_cf%livestemc_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/CarbonStateUpdate2Mod.F90 b/components/elm/src/biogeochem/CarbonStateUpdate2Mod.F90 index 985c544d29f..4676a1e351d 100644 --- a/components/elm/src/biogeochem/CarbonStateUpdate2Mod.F90 +++ b/components/elm/src/biogeochem/CarbonStateUpdate2Mod.F90 @@ -186,7 +186,7 @@ subroutine CarbonStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, veg_cs%deadcrootc(p) = veg_cs%deadcrootc(p) - veg_cf%hrv_deadcrootc_to_litter(p) * dt ! crops - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_cs%livestemc(p) = veg_cs%livestemc(p) - veg_cf%hrv_livestemc_to_prod1c(p) *dt veg_cs%leafc(p) = veg_cs%leafc(p) - veg_cf%hrv_leafc_to_prod1c(p) *dt veg_cs%grainc(p) = veg_cs%grainc(p) - veg_cf%hrv_grainc_to_prod1c(p) *dt diff --git a/components/elm/src/biogeochem/CropType.F90 b/components/elm/src/biogeochem/CropType.F90 index 58f7757e5fc..8394d21ca34 100644 --- a/components/elm/src/biogeochem/CropType.F90 +++ b/components/elm/src/biogeochem/CropType.F90 @@ -454,7 +454,7 @@ subroutine Restart(this, bounds, ncid, flag) interpinic_flag='copy', readvar=readvar, data=restyear) if (readvar) then do p = bounds%begp, bounds%endp - if (iscft(veg_pp%itype(p)) >= 1 .and. & + if (iscft(veg_pp%itype(p)) .and. & veg_pp%active(p)) then this%nyrs_crop_active_patch(p) = restyear end if diff --git a/components/elm/src/biogeochem/DryDepVelocity.F90 b/components/elm/src/biogeochem/DryDepVelocity.F90 index a79792b4e85..b6ef82a632e 100644 --- a/components/elm/src/biogeochem/DryDepVelocity.F90 +++ b/components/elm/src/biogeochem/DryDepVelocity.F90 @@ -294,7 +294,7 @@ subroutine depvel_compute( bounds, & !if (elmveg == nc3crop ) wesveg = 2 !if (elmveg == nc3irrig ) wesveg = 2 !if (elmveg >= npcropmin .and. elmveg <= npcropmax ) wesveg = 2 - if (crop(elmveg) == 1.0_r8 .or. iscft(elmveg) == 1.0_r8 ) wesveg = 2 + if (crop(elmveg) == 1.0_r8 .or. iscft(elmveg)) wesveg = 2 #ifndef _OPENACC if (wesveg == wveg_unset )then write(iulog,*) 'elmveg = ', elmveg, 'lun_pp%itype = ', lun_pp%itype(l) diff --git a/components/elm/src/biogeochem/FireMod.F90 b/components/elm/src/biogeochem/FireMod.F90 index 7aa4e6a50f9..b84aa2c3ab6 100644 --- a/components/elm/src/biogeochem/FireMod.F90 +++ b/components/elm/src/biogeochem/FireMod.F90 @@ -305,12 +305,12 @@ subroutine FireArea (bounds, & if (pi <= col_pp%npfts(c)) then p = col_pp%pfti(c) + pi - 1 ! For crop veg types - if( crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p)) == 1 )then + if( crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p)))then cropf_col(c) = cropf_col(c) + veg_pp%wtcol(p) end if ! For natural vegetation (non-crop and non-bare-soil) if( veg_pp%itype(p) /= noveg .and. & - (crop(veg_pp%itype(p)) == 0 .and. iscft(veg_pp%itype(p)) == 0) )then + (crop(veg_pp%itype(p)) == 0 .and. .not. iscft(veg_pp%itype(p))) )then lfwt(c) = lfwt(c) + veg_pp%wtcol(p) end if end if @@ -332,7 +332,7 @@ subroutine FireArea (bounds, & ! column-level litter carbon ! is available, so we use leaf carbon to estimate the ! litter carbon for crop PFTs - if( (crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p)) == 1) .and. & + if( (crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p))) .and. & veg_pp%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & leafc_xfer(p))*veg_pp%wtcol(p)/cropf_col(c) + & @@ -370,7 +370,7 @@ subroutine FireArea (bounds, & p = col_pp%pfti(c) + pi - 1 ! For non-crop -- natural vegetation and bare-soil - if( (crop(veg_pp%itype(p)) == 0 .and. iscft(veg_pp%itype(p)) == 0) .and. & + if( (crop(veg_pp%itype(p)) == 0 .and. .not. iscft(veg_pp%itype(p))) .and. & cropf_col(c) < 1.0_r8 ) then if( btran2(p) .ne. spval) then if (btran2(p) <= 1._r8 ) then @@ -509,7 +509,7 @@ subroutine FireArea (bounds, & p = col_pp%pfti(c) + pi - 1 ! For crop if( forc_t(t) >= SHR_CONST_TKFRZ .and. & - (crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p)) == 1) .and. & + (crop(veg_pp%itype(p)) == 1 .or. iscft(veg_pp%itype(p))) .and. & kmo == abm_lf(c) .and. forc_rain(t)+forc_snow(t) == 0._r8 .and. & burndate(p) >= 999 .and. veg_pp%wtcol(p) > 0._r8 )then ! catch crop burn time @@ -982,7 +982,7 @@ subroutine FireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp, & c = veg_pp%column(p) itype = veg_pp%itype(p) - if( (crop(veg_pp%itype(p)) == 0 .and. iscft(veg_pp%itype(p)) == 0) .and. & + if( (crop(veg_pp%itype(p)) == 0 .and. .not. iscft(veg_pp%itype(p))) .and. & cropf_col(c) < 1.0_r8)then ! For non-crop (bare-soil and natural vegetation) if (transient_landcover) then !true when landuse data is used diff --git a/components/elm/src/biogeochem/GapMortalityMod.F90 b/components/elm/src/biogeochem/GapMortalityMod.F90 index 734be187805..3a58551ae07 100644 --- a/components/elm/src/biogeochem/GapMortalityMod.F90 +++ b/components/elm/src/biogeochem/GapMortalityMod.F90 @@ -142,7 +142,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! displayed pools veg_cf%m_leafc_to_litter(p) = 0._r8 veg_cf%m_livestemc_to_litter(p) = 0._r8 - if(iscft(ivt(p)) < 1 .or. (iscft(ivt(p)) >= 1 .and. croplive(p))) then + if((.not. iscft(ivt(p))) .or. (iscft(ivt(p)) .and. croplive(p))) then veg_cf%m_leafc_to_litter(p) = veg_cs%leafc(p) * m veg_cf%m_livestemc_to_litter(p) = veg_cs%livestemc(p) * m end if @@ -181,7 +181,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! displayed pools veg_nf%m_leafn_to_litter(p) = 0._r8 veg_nf%m_livestemn_to_litter(p) = 0._r8 - if(iscft(ivt(p)) < 1 .or. (iscft(ivt(p)) >= 1 .and. croplive(p))) then + if((.not. iscft(ivt(p))) .or. (iscft(ivt(p)) .and. croplive(p))) then veg_nf%m_leafn_to_litter(p) = veg_ns%leafn(p) * m veg_nf%m_livestemn_to_litter(p) = veg_ns%livestemn(p) * m end if @@ -190,7 +190,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_nf%m_livecrootn_to_litter(p) = veg_ns%livecrootn(p) * m veg_nf%m_deadcrootn_to_litter(p) = veg_ns%deadcrootn(p) * m veg_nf%m_retransn_to_litter(p) = 0._r8 - if (iscft(ivt(p)) < 1) then + if (.not. iscft(ivt(p))) then veg_nf%m_retransn_to_litter(p) = veg_ns%retransn(p) * m end if veg_nf%m_npool_to_litter(p) = veg_ns%npool(p) * m @@ -225,7 +225,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & ! displayed pools veg_pf%m_leafp_to_litter(p) = 0._r8 veg_pf%m_livestemp_to_litter(p) = 0._r8 - if(iscft(ivt(p)) < 1 .or. (iscft(ivt(p)) >= 1 .and. croplive(p))) then + if((.not. iscft(ivt(p))) .or. (iscft(ivt(p)) .and. croplive(p))) then veg_pf%m_leafp_to_litter(p) = veg_ps%leafp(p) * m veg_pf%m_livestemp_to_litter(p) = veg_ps%livestemp(p) * m endif @@ -235,7 +235,7 @@ subroutine GapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp, & veg_pf%m_deadcrootp_to_litter(p) = veg_ps%deadcrootp(p) * m veg_pf%m_retransp_to_litter(p) = 0._r8 - if (iscft(ivt(p)) < 1) then + if (.not. iscft(ivt(p))) then veg_pf%m_retransp_to_litter(p) = veg_ps%retransp(p) * m end if veg_pf%m_ppool_to_litter(p) = veg_ps%ppool(p) * m diff --git a/components/elm/src/biogeochem/GrowthRespMod.F90 b/components/elm/src/biogeochem/GrowthRespMod.F90 index 34a9a64c56c..cb7ad522265 100644 --- a/components/elm/src/biogeochem/GrowthRespMod.F90 +++ b/components/elm/src/biogeochem/GrowthRespMod.F90 @@ -102,7 +102,7 @@ subroutine GrowthResp(num_soilp, filter_soilp) do fp = 1,num_soilp p = filter_soilp(fp) - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops cpool_livestem_gr(p) = cpool_to_livestemc(p) * grperc(ivt(p)) diff --git a/components/elm/src/biogeochem/MaintenanceRespMod.F90 b/components/elm/src/biogeochem/MaintenanceRespMod.F90 index 48d179f97d1..54005275b29 100644 --- a/components/elm/src/biogeochem/MaintenanceRespMod.F90 +++ b/components/elm/src/biogeochem/MaintenanceRespMod.F90 @@ -185,7 +185,7 @@ subroutine MaintenanceResp(bounds, & if (woody(ivt(p)) >= 1.0_r8) then livestem_mr(p) = livestemn(p)*br_mr*tc livecroot_mr(p) = livecrootn(p)*br_mr*tc - else if (iscft(ivt(p)) >= 1 .and. livestemn(p) .gt. 0._r8) then + else if (iscft(ivt(p)) .and. livestemn(p) .gt. 0._r8) then livestem_mr(p) = livestemn(p)*br_mr*tc grain_mr(p) = grainn(p)*br_mr*tc end if diff --git a/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 b/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 index 80fc34e6d0b..c1b2bfc5d65 100644 --- a/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/NitrogenStateUpdate1Mod.F90 @@ -297,7 +297,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) - veg_nf%deadcrootn_xfer_to_deadcrootn(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%livestemn_xfer_to_livestemn(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) - veg_nf%livestemn_xfer_to_livestemn(p)*dt @@ -322,7 +322,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%livecrootn(p) = veg_ns%livecrootn(p) - veg_nf%livecrootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%livecrootn_to_retransn(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! Beth adds retrans from froot + if (iscft(ivt(p))) then ! Beth adds retrans from froot veg_ns%frootn(p) = veg_ns%frootn(p) - veg_nf%frootn_to_retransn(p)*dt veg_ns%retransn(p) = veg_ns%retransn(p) + veg_nf%frootn_to_retransn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) - veg_nf%livestemn_to_litter(p)*dt @@ -373,7 +373,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_storage(p) = veg_ns%deadcrootn_storage(p) + veg_nf%npool_to_deadcrootn_storage(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn(p)*dt veg_ns%livestemn(p) = veg_ns%livestemn(p) + veg_nf%npool_to_livestemn(p)*dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%npool_to_livestemn_storage(p)*dt @@ -401,7 +401,7 @@ subroutine NitrogenStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp veg_ns%deadcrootn_xfer(p) = veg_ns%deadcrootn_xfer(p) + veg_nf%deadcrootn_storage_to_xfer(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ns%livestemn_storage(p) = veg_ns%livestemn_storage(p) - veg_nf%livestemn_storage_to_xfer(p)*dt veg_ns%livestemn_xfer(p) = veg_ns%livestemn_xfer(p) + veg_nf%livestemn_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/NitrogenStateUpdate2Mod.F90 b/components/elm/src/biogeochem/NitrogenStateUpdate2Mod.F90 index 5d897c5905a..d8e6785e52c 100644 --- a/components/elm/src/biogeochem/NitrogenStateUpdate2Mod.F90 +++ b/components/elm/src/biogeochem/NitrogenStateUpdate2Mod.F90 @@ -172,7 +172,7 @@ subroutine NitrogenStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soil veg_ns%retransn(p) = veg_ns%retransn(p) - veg_nf%hrv_retransn_to_litter(p) * dt veg_ns%npool(p) = veg_ns%npool(p) - veg_nf%hrv_npool_to_litter(p) * dt - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_ns%livestemn(p)= veg_ns%livestemn(p) - veg_nf%hrv_livestemn_to_prod1n(p) * dt veg_ns%leafn(p) = veg_ns%leafn(p) - veg_nf%hrv_leafn_to_prod1n(p) * dt veg_ns%grainn(p) = veg_ns%grainn(p) - veg_nf%hrv_grainn_to_prod1n(p) * dt diff --git a/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 b/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 index 49909f54929..87b9637d551 100644 --- a/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 +++ b/components/elm/src/biogeochem/PhenologyFluxLimitMod.F90 @@ -644,7 +644,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_deadcrootc_xfer) = veg_cs%deadcrootc_xfer(p) ystates(s_deadcrootc_storage) = veg_cs%deadcrootc_storage(p) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then ystates(s_livestemc) = veg_cs%livestemc(p) ystates(s_livestemc_xfer) = veg_cs%livestemc_xfer(p) ystates(s_livestemc_storage) = veg_cs%livestemc_storage(p) @@ -675,7 +675,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& + veg_cf%cpool_livecroot_storage_gr(p) & + veg_cf%cpool_deadcroot_storage_gr(p) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then ar_p= ar_p & + veg_cf%livestem_curmr(p) & + veg_cf%grain_curmr(p) & @@ -713,7 +713,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_deadcrootc_storage_to_xfer) = veg_cf%deadcrootc_storage_to_xfer(p) rfluxes(f_gresp_storage_to_xfer) = veg_cf%gresp_storage_to_xfer(p) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then rfluxes(f_cpool_to_livestemc) = veg_cf%cpool_to_livestemc(p) rfluxes(f_cpool_to_livestemc_storage) = veg_cf%cpool_to_livestemc_storage(p) rfluxes(f_cpool_to_grainc) = veg_cf%cpool_to_grainc(p) @@ -767,7 +767,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_deadcrootc_storage_to_xfer) , veg_cf%deadcrootc_storage_to_xfer(p)) call fpmax(rfluxes(f_gresp_storage_to_xfer) , veg_cf%gresp_storage_to_xfer(p)) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then call fpmax(rfluxes(f_cpool_to_livestemc) , veg_cf%cpool_to_livestemc(p)) call fpmax(rfluxes(f_cpool_to_livestemc_storage) , veg_cf%cpool_to_livestemc_storage(p)) call fpmax(rfluxes(f_cpool_to_grainc) , veg_cf%cpool_to_grainc(p)) @@ -806,7 +806,7 @@ subroutine carbon_flux_limiter(bounds, num_soilc, filter_soilc,& call ascal(veg_cf%cpool_livecroot_storage_gr(p), rscal) call ascal(veg_cf%cpool_deadcroot_storage_gr(p), rscal) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then call ascal(veg_cf%livestem_curmr(p) , rscal) call ascal(veg_cf%grain_curmr(p) , rscal) call ascal(veg_cf%cpool_livestem_gr(p) , rscal) @@ -878,7 +878,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_deadcrootn_xfer) = veg_ns%deadcrootn_xfer(p) ystates(s_deadcrootn_storage) = veg_ns%deadcrootn_storage(p) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then ystates(s_grainn) = veg_ns%grainn(p) ystates(s_grainn_xfer) = veg_ns%grainn_xfer(p) ystates(s_grainn_storage) = veg_ns%grainn_storage(p) @@ -917,7 +917,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_deadcrootn_xfer_to_deadcrootn) = veg_nf%deadcrootn_xfer_to_deadcrootn(p) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then rfluxes(f_npool_to_livestemn) = veg_nf%npool_to_livestemn(p) rfluxes(f_npool_to_livestemn_storage) = veg_nf%npool_to_livestemn_storage(p) rfluxes(f_npool_to_grainn) = veg_nf%npool_to_grainn(p) @@ -973,7 +973,7 @@ subroutine nitrogen_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_deadcrootn_xfer_to_deadcrootn) , veg_nf%deadcrootn_xfer_to_deadcrootn(p)) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then call fpmax(rfluxes(f_npool_to_livestemn) , veg_nf%npool_to_livestemn(p)) call fpmax(rfluxes(f_npool_to_livestemn_storage) , veg_nf%npool_to_livestemn_storage(p)) call fpmax(rfluxes(f_npool_to_grainn) , veg_nf%npool_to_grainn(p)) @@ -1063,7 +1063,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& ystates(s_deadcrootn_xfer) = veg_ps%deadcrootp_xfer(p) ystates(s_deadcrootn_storage) = veg_ps%deadcrootp_storage(p) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then ystates(s_grainn) = veg_ps%grainp(p) ystates(s_grainn_xfer) = veg_ps%grainp_xfer(p) ystates(s_grainn_storage) = veg_ps%grainp_storage(p) @@ -1102,7 +1102,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& rfluxes(f_deadcrootn_xfer_to_deadcrootn) = veg_pf%deadcrootp_xfer_to_deadcrootp(p) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then rfluxes(f_npool_to_livestemn) = veg_pf%ppool_to_livestemp(p) rfluxes(f_npool_to_livestemn_storage) = veg_pf%ppool_to_livestemp_storage(p) rfluxes(f_npool_to_grainn) = veg_pf%ppool_to_grainp(p) @@ -1158,7 +1158,7 @@ subroutine phosphorus_flux_limiter(bounds, num_soilc, filter_soilc,& call fpmax(rfluxes(f_deadcrootn_xfer_to_deadcrootn) , veg_pf%deadcrootp_xfer_to_deadcrootp(p)) endif - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then call fpmax(rfluxes(f_npool_to_livestemn) , veg_pf%ppool_to_livestemp(p)) call fpmax(rfluxes(f_npool_to_livestemn_storage) , veg_pf%ppool_to_livestemp_storage(p)) call fpmax(rfluxes(f_npool_to_grainn) , veg_pf%ppool_to_grainp(p)) diff --git a/components/elm/src/biogeochem/PhenologyMod.F90 b/components/elm/src/biogeochem/PhenologyMod.F90 index 2a52cb92883..08e9b94da52 100644 --- a/components/elm/src/biogeochem/PhenologyMod.F90 +++ b/components/elm/src/biogeochem/PhenologyMod.F90 @@ -2205,28 +2205,18 @@ subroutine CropPhenologyInit(bounds) minplantjday(:,:) = huge(1) maxplantjday(:,:) = huge(1) do n = 0, mxpft - if (iscft(n)>=1) then + if (iscft(n)) then minplantjday(n,inNH) = int( get_calday( mnNHplantdate(n), 0 ) ) maxplantjday(n,inNH) = int( get_calday( mxNHplantdate(n), 0 ) ) end if end do do n = 0, mxpft - if (iscft(n)>=1) then + if (iscft(n)) then minplantjday(n,inSH) = int( get_calday( mnSHplantdate(n), 0 ) ) maxplantjday(n,inSH) = int( get_calday( mxSHplantdate(n), 0 ) ) end if end do - ! with flag 'iscft', the following is not needed anymore - !do n = nppercropmin, nppercropmax - ! minplantjday(n,inNH) = int( get_calday( mnNHplantdate(n), 0 ) ) - ! maxplantjday(n,inNH) = int( get_calday( mxNHplantdate(n), 0 ) ) - !end do - !do n = nppercropmin, nppercropmax - ! minplantjday(n,inSH) = int( get_calday( mnSHplantdate(n), 0 ) ) - ! maxplantjday(n,inSH) = int( get_calday( mxSHplantdate(n), 0 ) ) - !end do - ! Figure out what hemisphere each PFT is in do p = bounds%begp, bounds%endp g = veg_pp%gridcell(p) @@ -3068,7 +3058,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & if (offset_counter(p) == dt) then t1 = 1.0_r8 / dt - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" leafc_to_litter(p) = (1.0_r8 - presharv(ivt(p))) * ((t1 * leafc(p)) + cpool_to_leafc(p)) @@ -3085,7 +3075,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & end if if ( nu_com .eq. 'RD') then - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then if (offset_counter(p) == dt) then t1 = 1.0_r8 / dt @@ -3119,7 +3109,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & else if (offset_counter(p) == dt) then t1 = 1.0_r8 / dt - if (iscft(ivt(p)) >= 1) then + if (iscft(ivt(p))) then ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" leafn_to_litter(p) = (1.0_r8 - presharv(ivt(p))) * ((t1 * leafn(p)) + npool_to_leafn(p)) @@ -3503,7 +3493,7 @@ subroutine CNLitterToColumn (num_soilp, filter_soilp, & ! new ones for now (slevis) ! The food is now directed to the product pools (BDrewniak) - if (iscft(ivt(p)) >= 1) then ! add livestemc to litter + if (iscft(ivt(p))) then ! add livestemc to litter ! stem litter carbon fluxes phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & + livestemc_to_litter(p) * lf_flab(ivt(p)) * wt_col * leaf_prof(p,j) diff --git a/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 b/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 index 01369ed83fa..6e111116922 100644 --- a/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 +++ b/components/elm/src/biogeochem/PhosphorusStateUpdate1Mod.F90 @@ -255,7 +255,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_xfer(p) = veg_ps%deadcrootp_xfer(p) - veg_pf%deadcrootp_xfer_to_deadcrootp(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ps%livestemp(p) = veg_ps%livestemp(p) + veg_pf%livestemp_xfer_to_livestemp(p)*dt veg_ps%livestemp_xfer(p) = veg_ps%livestemp_xfer(p) - veg_pf%livestemp_xfer_to_livestemp(p)*dt @@ -280,7 +280,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%livecrootp(p) = veg_ps%livecrootp(p) - veg_pf%livecrootp_to_retransp(p)*dt veg_ps%retransp(p) = veg_ps%retransp(p) + veg_pf%livecrootp_to_retransp(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! Beth adds retrans from froot + if (iscft(ivt(p))) then ! Beth adds retrans from froot veg_ps%frootp(p) = veg_ps%frootp(p) - veg_pf%frootp_to_retransp(p)*dt veg_ps%retransp(p) = veg_ps%retransp(p) + veg_pf%frootp_to_retransp(p)*dt veg_ps%livestemp(p) = veg_ps%livestemp(p) - veg_pf%livestemp_to_litter(p)*dt @@ -331,7 +331,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_storage(p) = veg_ps%deadcrootp_storage(p) + veg_pf%ppool_to_deadcrootp_storage(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_livestemp(p)*dt veg_ps%livestemp(p) = veg_ps%livestemp(p) + veg_pf%ppool_to_livestemp(p)*dt veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%ppool_to_livestemp_storage(p)*dt @@ -359,7 +359,7 @@ subroutine PhosphorusStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soi veg_ps%deadcrootp_xfer(p) = veg_ps%deadcrootp_xfer(p) + veg_pf%deadcrootp_storage_to_xfer(p)*dt end if - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops ! lines here for consistency; the transfer terms are zero veg_ps%livestemp_storage(p) = veg_ps%livestemp_storage(p) - veg_pf%livestemp_storage_to_xfer(p)*dt veg_ps%livestemp_xfer(p) = veg_ps%livestemp_xfer(p) + veg_pf%livestemp_storage_to_xfer(p)*dt diff --git a/components/elm/src/biogeochem/PhosphorusStateUpdate2Mod.F90 b/components/elm/src/biogeochem/PhosphorusStateUpdate2Mod.F90 index 4aa7563c70f..c6b6cd8ee6d 100644 --- a/components/elm/src/biogeochem/PhosphorusStateUpdate2Mod.F90 +++ b/components/elm/src/biogeochem/PhosphorusStateUpdate2Mod.F90 @@ -182,7 +182,7 @@ subroutine PhosphorusStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_so veg_ps%retransp(p) = veg_ps%retransp(p) - veg_pf%hrv_retransp_to_litter(p) * dt veg_ps%ppool(p) = veg_ps%ppool(p) - veg_pf%hrv_ppool_to_litter(p) * dt - if (iscft(ivt(p)) >= 1) then ! skip 2 generic crops + if (iscft(ivt(p))) then ! skip 2 generic crops veg_ps%livestemp(p)= veg_ps%livestemp(p) - veg_pf%hrv_livestemp_to_prod1p(p) * dt veg_ps%leafp(p) = veg_ps%leafp(p) - veg_pf%hrv_leafp_to_prod1p(p) * dt veg_ps%grainp(p) = veg_ps%grainp(p) - veg_pf%hrv_grainp_to_prod1p(p) * dt diff --git a/components/elm/src/biogeochem/PrecisionControlMod.F90 b/components/elm/src/biogeochem/PrecisionControlMod.F90 index 2423592c05c..10f601487cd 100644 --- a/components/elm/src/biogeochem/PrecisionControlMod.F90 +++ b/components/elm/src/biogeochem/PrecisionControlMod.F90 @@ -211,7 +211,7 @@ subroutine PrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) veg_ps%frootp_xfer(p) = 0._r8 end if - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then ! grain C and N if (abs(veg_cs%grainc(p)) < ccrit) then pc = pc + veg_cs%grainc(p) @@ -513,7 +513,7 @@ subroutine PrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) endif end if - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then ! xsmrpool (C only) if (abs(veg_cs%xsmrpool(p)) < ccrit) then pc = pc + veg_cs%xsmrpool(p) diff --git a/components/elm/src/biogeochem/RootDynamicsMod.F90 b/components/elm/src/biogeochem/RootDynamicsMod.F90 index f5ffc4c6784..9ea6a9812b0 100644 --- a/components/elm/src/biogeochem/RootDynamicsMod.F90 +++ b/components/elm/src/biogeochem/RootDynamicsMod.F90 @@ -136,7 +136,7 @@ subroutine RootDynamics(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp p = filter_soilp(f) c = pcolumn(p) if (ivt(p) /= noveg) then - if (iscft(ivt(p)) >= 1) then !skip generic crop types + if (iscft(ivt(p))) then !skip generic crop types if (huigrain(p) > 0._r8) then root_depth(p) = max(zi(c,2), min(hui(p)/huigrain(p)* root_dmx(ivt(p)), root_dmx(ivt(p)))) end if diff --git a/components/elm/src/biogeochem/VOCEmissionMod.F90 b/components/elm/src/biogeochem/VOCEmissionMod.F90 index fb7bd66958d..0a17f8803e7 100644 --- a/components/elm/src/biogeochem/VOCEmissionMod.F90 +++ b/components/elm/src/biogeochem/VOCEmissionMod.F90 @@ -703,7 +703,7 @@ function get_map_EF(ivt_in, g_in, ti_in, vocemis_vars) get_map_EF = vocemis_vars%efisop_grc(4,g_in, ti_in) else if (graminoid(ivt_in) == 1) then !grass get_map_EF = vocemis_vars%efisop_grc(5,g_in, ti_in) - else if (crop(ivt_in) == 1 .or. iscft(ivt_in) == 1) then !crops + else if (crop(ivt_in) == 1 .or. iscft(ivt_in)) then !crops get_map_EF = vocemis_vars%efisop_grc(6,g_in, ti_in) end if diff --git a/components/elm/src/biogeochem/VegStructUpdateMod.F90 b/components/elm/src/biogeochem/VegStructUpdateMod.F90 index c40e0fc0ea0..5943da355a0 100644 --- a/components/elm/src/biogeochem/VegStructUpdateMod.F90 +++ b/components/elm/src/biogeochem/VegStructUpdateMod.F90 @@ -147,7 +147,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & ! alpha are set by PFT, and alpha is scaled to CLM time step by multiplying by ! dt and dividing by dtsmonth (seconds in average 30 day month) ! tsai_min scaled by 0.5 to match MODIS satellite derived values - if (crop(ivt(p)) == 1 .and. iscft(ivt(p)) == 0) then ! generic crops + if (crop(ivt(p)) == 1 .and. .not. iscft(ivt(p))) then ! generic crops tsai_alpha = 1.0_r8-1.0_r8*dt/dtsmonth tsai_min = 0.1_r8 @@ -193,7 +193,7 @@ subroutine VegStructUpdate(num_soilp, filter_soilp, & hbot(p) = max(0._r8, min(3._r8, htop(p)-1._r8)) - else if (iscft(ivt(p)) >= 1) then ! prognostic crops + else if (iscft(ivt(p))) then ! prognostic crops if (tlai(p) >= laimx(ivt(p))) peaklai(p) = 1 ! used in CNAllocation diff --git a/components/elm/src/biogeophys/SedYieldMod.F90 b/components/elm/src/biogeophys/SedYieldMod.F90 index e0d63ed063c..250929f4a42 100644 --- a/components/elm/src/biogeophys/SedYieldMod.F90 +++ b/components/elm/src/biogeophys/SedYieldMod.F90 @@ -218,7 +218,7 @@ subroutine SoilErosion (bounds, num_soilc, filter_soilc, & (veg_cs%livecrootc(p)+veg_cs%deadcrootc(p))*croot_prof(p,1) ) fgndcov = exp( -gcbc_p(veg_pp%itype(p))*PCT_gnd - & gcbr_p(veg_pp%itype(p))*Broot ) - if( crop(veg_pp%itype(p)) >= 1 .or. iscft(veg_pp%itype(p)) >=1 )then + if( crop(veg_pp%itype(p)) >= 1 .or. iscft(veg_pp%itype(p)))then Es_Pcrp = Es_Pcrp + pfactor(c) * ftillage * flitho * & fgndcov * veg_pp%wtcol(p) * K * (KE_DT+KE_LD) @@ -266,7 +266,7 @@ subroutine SoilErosion (bounds, num_soilc, filter_soilc, & nh = 0.03_r8 + 0.05_r8*max(Crsd,Clai) fsr = fsr + veg_pp%wtcol(p) * (0.03_r8/nh)**0.6_r8 - if ( crop(veg_pp%itype(p)) >= 1 .or. iscft(veg_pp%itype(p)) >= 1 ) then + if ( crop(veg_pp%itype(p)) >= 1 .or. iscft(veg_pp%itype(p))) then ftillage_tc = ftillage_tc + ftillage * veg_pp%wtcol(p) Es_Q = Es_Q + 19.1_r8 * qfactor(c) * 2._r8/COH * flitho * fslp * & diff --git a/components/elm/src/data_types/VegetationDataType.F90 b/components/elm/src/data_types/VegetationDataType.F90 index ecbdca64df3..3bc7021f150 100644 --- a/components/elm/src/data_types/VegetationDataType.F90 +++ b/components/elm/src/data_types/VegetationDataType.F90 @@ -2447,7 +2447,7 @@ subroutine veg_cs_init(this, begp, endp, carbon_type, ratio) if (veg_vp%evergreen(veg_pp%itype(p)) == 1._r8) then this%leafc(p) = 1._r8 * ratio this%leafc_storage(p) = 0._r8 - else if (iscft(veg_pp%itype(p)) >= 1) then ! prognostic crop types + else if (iscft(veg_pp%itype(p))) then ! prognostic crop types this%leafc(p) = 0._r8 this%leafc_storage(p) = 0._r8 else @@ -3572,7 +3572,7 @@ subroutine veg_cs_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%gresp_storage(p) + & this%gresp_xfer(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%storvegc(p) = & this%storvegc(p) + & this%grainc_storage(p) + & @@ -4249,7 +4249,7 @@ subroutine veg_ns_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%npool(p) + & this%retransn(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%dispvegn(p) = & this%dispvegn(p) + & this%grainn(p) @@ -4997,7 +4997,7 @@ subroutine veg_ps_summary (this, bounds, num_soilc, filter_soilc, num_soilp, fil this%ppool(p) + & this%retransp(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%dispvegp(p) = & this%dispvegp(p) + & this%grainp(p) @@ -8189,7 +8189,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%cpool_livecroot_storage_gr(p) + & this%cpool_deadcroot_storage_gr(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%mr(p) = & this%mr(p) + & this%grain_mr(p) @@ -8214,7 +8214,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%storage_gr(p) ! autotrophic respiration (AR) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%ar(p) = & this%mr(p) + & this%gr(p) + & @@ -8324,7 +8324,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%wood_harvestc(p) = & this%hrv_deadstemc_to_prod10c(p) + & this%hrv_deadstemc_to_prod100c(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%wood_harvestc(p) = & this%wood_harvestc(p) + & this%hrv_cropc_to_prod1c(p) @@ -8354,7 +8354,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%m_gresp_xfer_to_fire(p) + & this%m_cpool_to_fire(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%litfall(p) = & this%litfall(p) + & this%livestemc_to_litter(p) + & @@ -8393,7 +8393,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%leafc_loss(p) = this%leafc_loss(p) + & this%hrv_leafc_to_litter(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%leafc_loss(p) = & this%leafc_loss(p) + & this%hrv_leafc_to_prod1c(p) @@ -8437,7 +8437,7 @@ subroutine veg_cf_summary(this, bounds, num_soilp, filter_soilp, num_soilc, filt this%hrv_deadcrootc_storage_to_litter(p) + & this%hrv_deadcrootc_xfer_to_litter(p) ! putting the harvested crop stem and grain in the wood loss bdrewniak - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%woodc_loss(p) = & this%woodc_loss(p) + & this%hrv_grainc_to_prod1c(p) + & @@ -8562,7 +8562,7 @@ subroutine veg_cf_summary_for_ch4( this, bounds, num_soilp, filter_soilp) this%cpool_to_deadstemc(p) + & this%deadstemc_xfer_to_deadstemc(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%agnpp(p) = & this%agnpp(p) + & this%cpool_to_grainc(p) + & @@ -9720,7 +9720,7 @@ subroutine veg_nf_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%wood_harvestn(p) = & this%hrv_deadstemn_to_prod10n(p) + & this%hrv_deadstemn_to_prod100n(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%wood_harvestn(p) = & this%wood_harvestn(p) + & this%hrv_cropn_to_prod1n(p) @@ -10776,7 +10776,7 @@ subroutine veg_pf_summary(this, bounds, num_soilc, filter_soilc, num_soilp, filt this%wood_harvestp(p) = & this%hrv_deadstemp_to_prod10p(p) + & this%hrv_deadstemp_to_prod100p(p) - if ( crop_prog .and. iscft(veg_pp%itype(p)) >= 1 )then + if ( crop_prog .and. iscft(veg_pp%itype(p)))then this%wood_harvestp(p) = & this%wood_harvestp(p) + & this%hrv_cropp_to_prod1p(p) diff --git a/components/elm/src/data_types/VegetationPropertiesType.F90 b/components/elm/src/data_types/VegetationPropertiesType.F90 index 16f251377a4..12f9a7b22ff 100644 --- a/components/elm/src/data_types/VegetationPropertiesType.F90 +++ b/components/elm/src/data_types/VegetationPropertiesType.F90 @@ -147,7 +147,7 @@ module VegetationPropertiesType real(r8), pointer :: climatezone(:) => null() !climate zone adapted real(r8), pointer :: nonvascular(:) => null() !nonvascular type or vascular real(r8), pointer :: graminoid(:) => null() !graminoid or not - real(r8), pointer :: iscft(:) => null() !generic crop (0) or (1) crop for prognostic crop modules + logical, pointer :: iscft(:) => null() !.false. = generic crop, .true. = prognostic crop real(r8), pointer :: needleleaf(:) => null() !needleleaf or broadleaf real(r8), pointer :: nfixer(:) => null() !cablity of nitrogen fixation from atm. N2 @@ -318,7 +318,7 @@ subroutine veg_vp_init(this) allocate( this%climatezone(0:numpft)) ; this%climatezone(:) =spval allocate( this%nonvascular(0:numpft)) ; this%nonvascular(:) =spval allocate( this%graminoid(0:numpft)) ; this%graminoid(:) =spval - allocate( this%iscft(0:numpft)) ; this%iscft(:) =spval + allocate( this%iscft(0:numpft)) ; this%iscft(:) =.false. allocate( this%needleleaf(0:numpft)) ; this%needleleaf(:) =spval allocate( this%nfixer(0:numpft)) ; this%nfixer(:) =spval ! ----------------------------------------------------------------------------------------------------------- diff --git a/components/elm/src/main/filterMod.F90 b/components/elm/src/main/filterMod.F90 index eb3f2f2ef1d..e1dde944559 100644 --- a/components/elm/src/main/filterMod.F90 +++ b/components/elm/src/main/filterMod.F90 @@ -420,7 +420,7 @@ subroutine setFiltersOneGroup(bounds, this_filter, include_inactive, icemask_grc t =veg_pp%topounit(p) if (top_pp%active(t)) then if (veg_pp%active(p) .or. include_inactive) then - if (iscft(veg_pp%itype(p)) < 1) then + if (.not. iscft(veg_pp%itype(p))) then l =veg_pp%landunit(p) if (lun_pp%itype(l) == istsoil .or. lun_pp%itype(l) == istcrop) then fnc = fnc + 1 diff --git a/components/elm/src/main/pftvarcon.F90 b/components/elm/src/main/pftvarcon.F90 index dc5d837472a..9dcbb3cd6da 100644 --- a/components/elm/src/main/pftvarcon.F90 +++ b/components/elm/src/main/pftvarcon.F90 @@ -318,7 +318,8 @@ module pftvarcon real(r8), allocatable :: nonvascular(:) ! nonvascular lifeform flag (0 = vascular, 1 = moss, 2 = lichen) real(r8), allocatable :: needleleaf(:) ! needleleaf lifeform flag (0 = broadleaf, 1 = needleleaf) real(r8), allocatable :: graminoid(:) ! graminoid lifeform flag (0 = nonvascular+woody+crop+percrop, 1 = graminoid) - real(r8), allocatable :: iscft(:) ! crop function type flag (0 = non_crop or generic crop, i.e. crop when use_crop=false, 1 = prognostic crop with cft created) + logical , allocatable :: iscft(:) ! crop function type flag (.false. = non_crop or generic crop, i.e. crop when use_crop=false, .true. = prognostic crop with cft created) + real(r8), allocatable :: temp_iscft(:) ! for file read, translated to logical afterwards real(r8), allocatable :: nfixer(:) ! nitrogen fixer flag (0 = inable, 1 = able to nitrogen fixation from atm. N2) @@ -369,6 +370,7 @@ subroutine pftconrd logical :: PFT_DEFAULT ! pft names are default, i.e. NOT user-defined integer :: ncft0, ncft ! crop pft index of first/last when 'create_crop_landunit' is true integer :: noncropmax ! max non-crop pft index (to check when 'create_crop_landunit' is true) + real(r8) :: local_iscft ! a local transfer of iscft from logical to integer for use in error checks character(len=32) :: subname = 'pftconrd' ! subroutine name ! ! Expected PFT names: The names expected on the paramfile file and the order they are expected to be in. @@ -642,6 +644,7 @@ subroutine pftconrd allocate( nonvascular (0:mxpft) ) allocate( graminoid (0:mxpft) ) allocate( iscft (0:mxpft) ) + allocate( temp_iscft (0:mxpft) ) allocate( needleleaf (0:mxpft) ) allocate( nfixer (0:mxpft) ) @@ -1127,17 +1130,22 @@ subroutine pftconrd end if end if - call ncd_io('iscft', iscft, 'read', ncid, readvar=readv) ! read-in is 'CFT' or not for crop type + call ncd_io('iscft', temp_iscft, 'read', ncid, readvar=readv) ! read-in is 'CFT' or not for crop type if ( .not. readv ) then if (PFT_DEFAULT) then - iscft(:) = 0 ! will assign a value below + temp_iscft(:) = 0._r8 ! will assign a value below else call endrun(msg='ERROR: error in reading in user-defined pft data'//errMsg(__FILE__,__LINE__)) end if end if call ncd_pio_closefile(ncid) - + + ! transfer the temporary real to logical + do i=0, mxpft + if (temp_iscft(i) == 1._r8) iscft(i) = .true. + if (temp_iscft(i) == 0._r8) iscft(i) = .false. + end do if ( PFT_DEFAULT ) then ! if still reading in default PFT physiology file, @@ -1233,7 +1241,7 @@ subroutine pftconrd ! when not using those indexing of PFT orders anymore in other codes than here. needleleaf(noveg+1:ndllf_dcd_brl_tree) = 1 graminoid(nc3_arctic_grass:nc4_grass) = 1 - iscft(npcropmin:max(npcropmax,nppercropmax)) = 1 + iscft(npcropmin:max(npcropmax,nppercropmax)) = .true. nfixer(nsoybean) = 1 nfixer(nsoybeanirrig) = 1 @@ -1251,7 +1259,6 @@ subroutine pftconrd !------------------------------------------------------------------------------------------- - ! NOT default PFT file else @@ -1270,16 +1277,16 @@ subroutine pftconrd ncft0 = -1 noncropmax = 0 do i = 0, npft-1 - if (crop(i)>=1 .or. percrop(i)>=1 .or. iscft(i)>=1) then + if (crop(i)>=1 .or. percrop(i)>=1 .or. iscft(i)) then numcft = numcft + 1 ! includes generic_crop, while cft_size NOT (???? todo checking) if(use_crop) then ! the following assumes that all crop pfts are in a block - ! if 'generic crop' (crop=1) specifically flagged by iscft=0 + ! if 'generic crop' (crop=1) specifically flagged by iscft=.false. ! 'crop' will not be counted into prognostic - if (crop(i)>=1 .and. iscft(i)==1) then + if (crop(i)>=1 .and. iscft(i)) then npcropmax = i if(npcropmin<=0) npcropmin = i end if @@ -1294,7 +1301,7 @@ subroutine pftconrd else if(crop(i)>=1 .or. percrop(i)>=1) then ! in case either 'crop' or 'generic crop' or both defined, it must be generic, when not use_crop=.true. - iscft(i) = 0 + iscft(i) = .false. end if end if @@ -1313,7 +1320,7 @@ subroutine pftconrd ! need to check 'noveg' if ( woody(i)<=0 .and. graminoid(i)<=0 .and. nonvascular(i)<=0 .and. & - iscft(i)<=0 .and. crop(i)<=0 .and. percrop(i)<=0) then + .not. iscft(i) .and. crop(i)<=0 .and. percrop(i)<=0) then if (noveg>=0) then ! not yet support multiple non-vegetated PFT ! this also will catch error of no actual PFT if npft>1 @@ -1365,24 +1372,26 @@ subroutine pftconrd ! checking of pft flags' conflict if ( .not. use_fates ) then do i = 0, mxpft + if (iscft(i)) local_iscft = 1._r8 + if (.not. iscft(i)) local_iscft = 0._r8 if (i == noveg) then - if ( (nonvascular(i)+woody(i)+graminoid(i)+max(iscft(i),crop(i)+percrop(i))) >= 1 .or. & + if ( (nonvascular(i)+woody(i)+graminoid(i)+max(local_iscft,crop(i)+percrop(i))) >= 1 .or. & (needleleaf(i)+evergreen(i)+stress_decid(i)+season_decid(i)+nfixer(i)) >= 1 ) then print *, 'ERROR: Incorrect not-vegetated PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: not_vegetated has at least one positive PFT flag '//errMsg(__FILE__, __LINE__)) end if - else if ( (nonvascular(i)+woody(i)+graminoid(i)+max(iscft(i),crop(i)+percrop(i))) >= 1) then - if (nonvascular(i) >= 1 .and. (woody(i)+graminoid(i)+max(iscft(i),crop(i)+percrop(i))) >= 1) then + else if ( (nonvascular(i)+woody(i)+graminoid(i)+max(local_iscft,crop(i)+percrop(i))) >= 1) then + if (nonvascular(i) >= 1 .and. (woody(i)+graminoid(i)+max(local_iscft,crop(i)+percrop(i))) >= 1) then print *, 'ERROR: Incorrect nonvasculr PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: nonvascular PFT cannot be any of woody/graminoid/crop type '//errMsg(__FILE__, __LINE__)) - else if (woody(i) >= 1 .and. (nonvascular(i)+graminoid(i)+max(iscft(i),crop(i)+percrop(i))) >= 1) then + else if (woody(i) >= 1 .and. (nonvascular(i)+graminoid(i)+max(local_iscft,crop(i)+percrop(i))) >= 1) then print *, 'ERROR: Incorrect woody PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: woody PFT cannot be any of nonvascular/graminoid/crop type - '//errMsg(__FILE__, __LINE__)) - else if (graminoid(i) >= 1 .and. (nonvascular(i)+woody(i)+max(iscft(i),crop(i)+percrop(i))) >=1 ) then + else if (graminoid(i) >= 1 .and. (nonvascular(i)+woody(i)+max(local_iscft,crop(i)+percrop(i))) >=1 ) then print *, 'ERROR: Incorrect graminoid PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: graminoid PFT cannot be any of nonvascular/woody/crop type - '//errMsg(__FILE__, __LINE__)) - else if ( (max(iscft(i),crop(i)+percrop(i))) >= 1 .and. (nonvascular(i)+woody(i)+graminoid(i)) >= 1) then + else if ( (max(local_iscft,crop(i)+percrop(i))) >= 1 .and. (nonvascular(i)+woody(i)+graminoid(i)) >= 1) then print *, 'ERROR: Incorrect crop PFT flags: ', i, ' ', trim(pftname(i)) call endrun(msg=' ERROR: crop PFT cannot be any of nonvascular/woody/graminoid type - '//errMsg(__FILE__, __LINE__)) end if @@ -1412,7 +1421,7 @@ subroutine pftconrd do i = 0, npft-1 write(iulog,*) i, pftname(i), int(climatezone(i)), int(woody(i)), int(needleleaf(i)), & int(evergreen(i)), int(stress_decid(i)), int(season_decid(i)), & - int(graminoid(i)), int(iscft(i)), int(crop(i)), int(percrop(i)), int(nfixer(i)) + int(graminoid(i)), int(local_iscft), int(crop(i)), int(percrop(i)), int(nfixer(i)) end do write(iulog,*) end if From 0f841e67a2a152cd35c85043783459057b891c78 Mon Sep 17 00:00:00 2001 From: Peter Thornton Date: Mon, 26 Aug 2024 22:26:27 -0400 Subject: [PATCH 125/197] Fixes a bug, uninitialized variable in pftvarcon --- components/elm/src/main/pftvarcon.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/elm/src/main/pftvarcon.F90 b/components/elm/src/main/pftvarcon.F90 index 9dcbb3cd6da..fc5bfd54e7d 100644 --- a/components/elm/src/main/pftvarcon.F90 +++ b/components/elm/src/main/pftvarcon.F90 @@ -1421,7 +1421,7 @@ subroutine pftconrd do i = 0, npft-1 write(iulog,*) i, pftname(i), int(climatezone(i)), int(woody(i)), int(needleleaf(i)), & int(evergreen(i)), int(stress_decid(i)), int(season_decid(i)), & - int(graminoid(i)), int(local_iscft), int(crop(i)), int(percrop(i)), int(nfixer(i)) + int(graminoid(i)), int(temp_iscft(i)), int(crop(i)), int(percrop(i)), int(nfixer(i)) end do write(iulog,*) end if From 485ca5850eb05cade08a12ccd3506b76a176ecbb Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Tue, 27 Aug 2024 13:44:42 -0500 Subject: [PATCH 126/197] Correct linoz_data_type for hist-nat --- .../use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml index 8f3a2644527..94cdfc6d000 100644 --- a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml @@ -107,7 +107,7 @@ 1850 linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc atm/cam/chem/trop_mozart/ub -INTERP_MISSING_MONTHS +CYCLICAL SERIAL From e9c56ec7fcf812f3e92fc9bac1341fc68716deba Mon Sep 17 00:00:00 2001 From: Matthew Hoffman Date: Tue, 27 Aug 2024 17:04:21 -0500 Subject: [PATCH 127/197] Turn on depth-int solver for 1km GIS; add more output vars --- .../bld/namelist_files/albany_input.gis_1to10km_r01.yaml | 3 +++ .../bld/namelist_files/albany_input.gis_1to10km_r02.yaml | 2 ++ components/mpas-albany-landice/cime_config/buildnml | 2 ++ 3 files changed, 7 insertions(+) diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r01.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r01.yaml index 589e163bba7..c1b2e310f32 100644 --- a/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r01.yaml +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r01.yaml @@ -2,6 +2,9 @@ --- ANONYMOUS: + Problem: + Depth Integrated Model: true + # Discretization Description Discretization: #Exodus Output File Name: albany_output.exo diff --git a/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r02.yaml b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r02.yaml index 2b70fd9b30f..45539411756 100644 --- a/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r02.yaml +++ b/components/mpas-albany-landice/bld/namelist_files/albany_input.gis_1to10km_r02.yaml @@ -1,7 +1,9 @@ %YAML 1.1 --- ANONYMOUS: + Problem: + Depth Integrated Model: true Basal Cubature Degree: 4 LandIce Field Norm: sliding_velocity_basalside: diff --git a/components/mpas-albany-landice/cime_config/buildnml b/components/mpas-albany-landice/cime_config/buildnml index a42011e5407..9489b6dfa8f 100755 --- a/components/mpas-albany-landice/cime_config/buildnml +++ b/components/mpas-albany-landice/cime_config/buildnml @@ -238,8 +238,10 @@ def buildnml(case, caseroot, compname): lines.append(' ') lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') From 383f137c1e79ea37664cc72ac41a1956fbd0dbd7 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Tue, 27 Aug 2024 22:00:20 -0500 Subject: [PATCH 128/197] Add compset hist-all-xaer --- cime_config/allactive/config_compsets.xml | 10 ++ ..._eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml | 117 ++++++++++++++++++ .../eam/cime_config/config_component.xml | 1 + .../elm/cime_config/config_component.xml | 1 + 4 files changed, 129 insertions(+) create mode 100644 components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml diff --git a/cime_config/allactive/config_compsets.xml b/cime_config/allactive/config_compsets.xml index 63883bff15d..28eefc45b76 100755 --- a/cime_config/allactive/config_compsets.xml +++ b/cime_config/allactive/config_compsets.xml @@ -158,6 +158,16 @@ 20TRSOI_EAM%CMIP6-VOLC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + WCYCL20TR-xaer + 20TRSOI_EAM%CMIP6-xAER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + + + hist-all-xaer + 20TRSOI_EAM%CMIP6-xAER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV + + diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml new file mode 100644 index 00000000000..359a292e9e1 --- /dev/null +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml @@ -0,0 +1,117 @@ + + + + +.true. + + +.true. +.true. +.true. + + +atm/cam/solar/Solar_1850-2299_input4MIPS_c20181106.nc +SERIAL + + +atm/cam/ggas/GHG_CMIP-1-2-0_Annual_Global_0000-2014_c20180105.nc +RAMPED + + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_elev_1850-2014_c180205_1850-aero_hist-volcano.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_elev_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_elev_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_elev_1850-2014_c180205.nc + + +CYCLICAL +1850 +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H4_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C2H6_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_C3H8_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH2O_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3CHO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CH3COCH3_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_CO_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_ISOP_surface_1850-2014_1.9x2.5_c20210323.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_MTERP_surface_1850-2014_1.9x2.5_c20230126.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_e3sm_NO_surface_1850-2014_1.9x2.5_c20220425.nc +atm/cam/chem/trop_mozart_aero/emis/DMSflux.1850.1deg_latlon_conserv.POPmonthlyClimFromACES4BGC_c20160416.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/emissions-cmip6_e3sm_SOAG0_surf_1850-2014_1.9x2.5_c20230201.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_bc_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_num_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_pom_a4_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a1_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/DECK_ne30/cmip6_mam4_so4_a2_surf_1850-2014_c180205.nc +atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions_E90_surface_1750-2015_1.9x2.5_c20210408.nc + + + + +CYCLICAL +1849 +oxid_1.9x2.5_L26_1850-2015_c20181106.nc +'' +atm/cam/chem/trop_mozart_aero/oxid +'prsd_O3:O3','prsd_NO3:NO3','prsd_OH:OH' + + +ch4_oxid_1.9x2.5_L26_1990-1999clim.c090804.nc +atm/cam/chem/methane +CYCLICAL +1995 +'' +'prsd_ch4:CH4' + + + + 'A:H2OLNZ:H2O', 'N:O2:O2', 'N:CO2:CO2', + 'A:O3:O3', 'A:N2OLNZ:N2O', 'A:CH4LNZ:CH4', + 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam5_mode1:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode2:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_c130628.nc', + 'M:mam5_mode3:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam5_mode4:$INPUTDATA_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'M:mam5_mode5:$INPUTDATA_ROOT/atm/cam/physprops/mam5_mode5_rrtmg_sig1.2_dgnl.40_c03072023.nc' + + + +3 +1 +'atm/cam/chem/trop_mam/marine_BGC/' +'CYCLICAL' +'monthly_macromolecules_0.1deg_bilinear_latlon_year01_merge_date.nc' +0 +0 +'chla:CHL1','mpoly:TRUEPOLYC','mprot:TRUEPROTC','mlip:TRUELIPC' + +atm/cam/chem/trop_mozart/ub/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc +SERIAL +linv3_1849-2017_CMIP6_Hist_10deg_58km_c20230705.nc +atm/cam/chem/trop_mozart/ub +INTERP_MISSING_MONTHS + + +SERIAL + + +'xactive_lnd' +'O3','H2O2','CH2O','CH3OOH','NO','NO2','HNO3','HO2NO2','PAN','CO','CH3COCH3','C2H5OOH','CH3CHO','H2SO4','SO2','NO3','N2O5','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'NEU' +'C2H5OOH','CH2O','CH3CHO','CH3OOH','H2O2','H2SO4','HNO3','HO2NO2','SO2','SOAG0','SOAG15','SOAG24','SOAG35','SOAG34','SOAG33','SOAG32','SOAG31' +'CH2O', 'CH3O2', 'CH3OOH', 'PAN', 'CO', 'C2H6', 'C3H8', 'C2H4', 'ROHO2', 'CH3COCH3', 'C2H5O2', 'C2H5OOH', 'CH3CHO', 'CH3CO3', 'ISOP', 'ISOPO2', 'MVKMACR', 'MVKO2' +'' + diff --git a/components/eam/cime_config/config_component.xml b/components/eam/cime_config/config_component.xml index 8f1e68161cb..655d7be5503 100755 --- a/components/eam/cime_config/config_component.xml +++ b/components/eam/cime_config/config_component.xml @@ -131,6 +131,7 @@ 20TR_eam_CMIP6-aer_chemUCI-Linoz-mam5-vbs 20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs 20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs + 20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs 20TR_eam_CMIP6-ozone_chemUCI-Linoz-mam5-vbs 20TR_eam_CMIP6-lulc_chemUCI-Linoz-mam5-vbs 20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs diff --git a/components/elm/cime_config/config_component.xml b/components/elm/cime_config/config_component.xml index b191a0a2248..00518b5dc78 100755 --- a/components/elm/cime_config/config_component.xml +++ b/components/elm/cime_config/config_component.xml @@ -79,6 +79,7 @@ 20thC_CMIP6xLULC_transient 20thC_CMIP6xLULC_transient 20thC_CMIP6_transient + 20thC_CMIP6_transient 20thC_CMIP6_transient 20thC_CMIP6bgc_transient 20thC_CMIP6bgc_transient From 58b4220130cd4c5eea4908dee0c56bbef97f7347 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 28 Aug 2024 13:54:27 -0600 Subject: [PATCH 129/197] Revert ers change --- cime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime b/cime index eacb1b7f5ed..3dfad8399b8 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit eacb1b7f5ed984f0c124076c78fd1e80dbd9b7a1 +Subproject commit 3dfad8399b803d724365c559c5b84e5546049e0c From bd79ca9ce10bafa8ec2d2f170bec5863d73b860e Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Wed, 28 Aug 2024 20:35:07 +0000 Subject: [PATCH 130/197] Run in 4-CCS mode --- cime_config/machines/config_machines.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index b6ac815f58f..fed0110bc32 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3385,7 +3385,7 @@ 104 104 104 - 12 + 48 FALSE mpiexec @@ -3444,6 +3444,7 @@ 20 $ENV{KOKKOS_ROOT} 1 + 0:4,1:4,2:4,3:4:4:4,5:4,6:4,7:4 0 From 6ae05889a8664d227995f661cdbeae13e3b9136d Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Wed, 28 Aug 2024 20:43:22 +0000 Subject: [PATCH 131/197] Disable openmp-offload --- cime_config/machines/Depends.oneapi-ifxgpu.cmake | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/cime_config/machines/Depends.oneapi-ifxgpu.cmake b/cime_config/machines/Depends.oneapi-ifxgpu.cmake index 0dd35e56bcc..5a958df26eb 100644 --- a/cime_config/machines/Depends.oneapi-ifxgpu.cmake +++ b/cime_config/machines/Depends.oneapi-ifxgpu.cmake @@ -1,14 +1,5 @@ -set(CPPDEFS "${CPPDEFS} -DMPAS_OPENMP_OFFLOAD") -list(APPEND MPAS_ADD_ACC_FLAGS - ${CMAKE_BINARY_DIR}/core_seaice/shared/mpas_seaice_mesh_pool.f90 - ${CMAKE_BINARY_DIR}/core_seaice/shared/mpas_seaice_velocity_solver_variational.f90 - ${CMAKE_BINARY_DIR}/core_seaice/shared/mpas_seaice_velocity_solver.f90 -) - -foreach(ITEM IN LISTS MPAS_ADD_ACC_FLAGS) - e3sm_add_flags("${ITEM}" "-fiopenmp -fopenmp-targets=spir64") -endforeach() - # compile mpas_seaice_core_interface.f90 with ifort, not ifx -e3sm_add_flags("${CMAKE_BINARY_DIR}/core_seaice/model_forward/mpas_seaice_core_interface.f90" "-fc=ifort") +if (NOT MPILIB STREQUAL "openmpi") + e3sm_add_flags("${CMAKE_BINARY_DIR}/core_seaice/model_forward/mpas_seaice_core_interface.f90" "-fc=ifort") +endif() From c9d94bbdfdf1a622e74bc001dbd126f78fc1d11c Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Wed, 28 Aug 2024 22:25:14 -0500 Subject: [PATCH 132/197] Put modified tracer_data.F90 on the correct path --- components/eam/src/chemistry/utils/tracer_data.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/eam/src/chemistry/utils/tracer_data.F90 b/components/eam/src/chemistry/utils/tracer_data.F90 index 073aacff6e4..62ccbcef8a2 100644 --- a/components/eam/src/chemistry/utils/tracer_data.F90 +++ b/components/eam/src/chemistry/utils/tracer_data.F90 @@ -660,7 +660,7 @@ subroutine advance_trcdata( flds, file, state, pbuf2d ) call t_startf('read_next_trcdata') call read_next_trcdata(state, flds, file ) call t_stopf('read_next_trcdata') - if(masterproc) write(iulog,*) 'READ_NEXT_TRCDATA ', flds%fldnam + if(masterproc) write(iulog,*) 'READ_NEXT_TRCDATA ', flds%fldnam,data_time end if endif From c5eb35f37c838964d732226c8a5b659b6387a5a8 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Wed, 28 Aug 2024 22:27:03 -0500 Subject: [PATCH 133/197] Remove the mis-placed tracer_data.F90 --- .../eam/src/chemistry/mozart/tracer_data.F90 | 2884 ----------------- 1 file changed, 2884 deletions(-) delete mode 100644 components/eam/src/chemistry/mozart/tracer_data.F90 diff --git a/components/eam/src/chemistry/mozart/tracer_data.F90 b/components/eam/src/chemistry/mozart/tracer_data.F90 deleted file mode 100644 index 62ccbcef8a2..00000000000 --- a/components/eam/src/chemistry/mozart/tracer_data.F90 +++ /dev/null @@ -1,2884 +0,0 @@ -module tracer_data -!----------------------------------------------------------------------- -! module used to read (and interpolate) offline tracer data (sources and -! mixing ratios) -! Created by: Francis Vitt -- 2 May 2006 -! Modified by : Jim Edwards -- 10 March 2009 -! Modified by : Cheryl Craig and Chih-Chieh (Jack) Chen -- February 2010 -! Modified by : Jinbo Xie --March 2023 -! Added a new option in interpolate_trcdata to work on linoz -! inputdata. A new UCI interpolation that better conserves -! mass in implemented and added a new function. It is called -! when linoz data are used in interpolate_trcdata. -! -!----------------------------------------------------------------------- - - use perf_mod, only : t_startf, t_stopf - use shr_kind_mod, only : r8 => shr_kind_r8,r4 => shr_kind_r4, shr_kind_cl, SHR_KIND_CS - use time_manager, only : get_curr_date, get_step_size, get_curr_calday - use spmd_utils, only : masterproc - use ppgrid, only : pcols, pver, pverp, begchunk, endchunk - use cam_abortutils, only : endrun - use cam_logfile, only : iulog - - use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_get_index - use time_manager, only : set_time_float_from_date, set_date_from_time_float - use pio, only : file_desc_t, var_desc_t, & - pio_seterrorhandling, pio_internal_error, pio_bcast_error, & - pio_setdebuglevel, & - pio_char, pio_noerr, & - pio_inq_dimid, pio_inq_varid, & - pio_def_dim, pio_def_var, & - pio_put_att, pio_put_var, & - pio_get_var, pio_get_att, pio_nowrite, pio_inq_dimlen, & - pio_inq_vardimid, pio_inq_dimlen, pio_closefile, & - pio_inquire_variable - - implicit none - - private ! all unless made public - save - - public :: trfld, input3d, input2d, trfile - public :: trcdata_init - public :: advance_trcdata - public :: get_fld_data - public :: put_fld_data - public :: get_fld_ndx - public :: write_trc_restart - public :: read_trc_restart - public :: init_trc_restart - public :: incr_filename - !added public for linoz new function diagnostic - public :: read_next_trcdata - public :: interpolate_trcdata - public :: get_model_time - !!PUBLIC MEMBERS - - type input3d - real(r8), dimension(:,:,:), pointer :: data => null() - endtype input3d - - type input2d - real(r8), dimension(:,:), pointer :: data => null() - endtype input2d - - type trfld - real(r8), dimension(:,:,:), pointer :: data => null() - type(input3d), dimension(4) :: input - character(len=32) :: srcnam - character(len=32) :: fldnam - character(len=32) :: units - type(var_desc_t) :: var_id - integer :: coords(4) ! LATDIM | LONDIM | LEVDIM | TIMDIM - integer :: order(4) ! LATDIM | LONDIM | LEVDIM | TIMDIM - logical :: srf_fld = .false. - integer :: pbuf_ndx = -1 - endtype trfld - - type trfile - type(input2d), dimension(4) :: ps_in - character(len=shr_kind_cl) :: pathname = ' ' - character(len=shr_kind_cl) :: curr_filename = ' ' - character(len=shr_kind_cl) :: next_filename = ' ' - type(file_desc_t) :: curr_fileid - type(file_desc_t) :: next_fileid - - type(var_desc_t), pointer :: currfnameid => null() ! pio restart file var id - type(var_desc_t), pointer :: nextfnameid => null() ! pio restart file var id - - character(len=shr_kind_cl) :: filenames_list = '' - real(r8) :: datatimem = -1.e36_r8 ! time of prv. values read in - real(r8) :: datatimep = -1.e36_r8 ! time of nxt. values read in - real(r8) :: datatimes(4) - integer :: interp_recs - real(r8), pointer, dimension(:) :: curr_data_times => null() - real(r8), pointer, dimension(:) :: next_data_times => null() - logical :: remove_trc_file = .false. ! delete file when finished with it - real(r8) :: offset_time - integer :: cyc_ndx_beg - integer :: cyc_ndx_end - integer :: cyc_yr = 0 - real(r8) :: one_yr = 0 - real(r8) :: curr_mod_time ! model time - calendar day - real(r8) :: next_mod_time ! model time - calendar day - next time step - integer :: nlon - integer :: nlat - integer :: nlev - integer :: nilev - integer :: ps_coords(3) ! LATDIM | LONDIM | TIMDIM - integer :: ps_order(3) ! LATDIM | LONDIM | TIMDIM - real(r8), pointer, dimension(:) :: lons => null() - real(r8), pointer, dimension(:) :: lats => null() - real(r8), pointer, dimension(:) :: levs => null() - real(r8), pointer, dimension(:) :: ilevs => null() - real(r8), pointer, dimension(:) :: hyam => null() - real(r8), pointer, dimension(:) :: hybm => null() - real(r8), pointer, dimension(:,:) :: ps => null() - real(r8), pointer, dimension(:) :: hyai => null() - real(r8), pointer, dimension(:) :: hybi => null() - real(r8), pointer, dimension(:,:) :: weight_x => null(), weight_y => null() - integer, pointer, dimension(:) :: count_x => null(), count_y => null() - integer, pointer, dimension(:,:) :: index_x => null(), index_y => null() - real(r8) :: p0 - type(var_desc_t) :: ps_id - logical, allocatable, dimension(:) :: in_pbuf - logical :: has_ps = .false. - logical :: zonal_ave = .false. - logical :: alt_data = .false. - logical :: cyclical = .false. - logical :: cyclical_list = .false. - logical :: weight_by_lat = .false. - logical :: conserve_column = .false. - logical :: fill_in_months = .false. - logical :: fixed = .false. - logical :: initialized = .false. - logical :: top_bndry = .false. - logical :: stepTime = .false. ! Do not interpolate in time, but use stepwise times - logical :: linoz_v3 = .false. !set for linoz_v3 interpolation only - logical :: linoz_v2 = .false. !set for linoz_v2 interpolation only - endtype trfile - - integer, public, parameter :: MAXTRCRS = 100 - - integer, parameter :: LONDIM = 1 - integer, parameter :: LATDIM = 2 - integer, parameter :: LEVDIM = 3 - integer, parameter :: TIMDIM = 4 - - integer, parameter :: PS_TIMDIM = 3 - - integer, parameter :: ZA_LATDIM = 1 - integer, parameter :: ZA_LEVDIM = 2 - integer, parameter :: ZA_TIMDIM = 3 - - integer, parameter :: nm=1 ! array index for previous (minus) data - integer, parameter :: np=2 ! array index for next (plus) data - - integer :: plon, plat - -contains - -!-------------------------------------------------------------------------- -!-------------------------------------------------------------------------- - subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & - rmv_file, data_cycle_yr, data_fixed_ymd, data_fixed_tod, data_type ) - - use mo_constants, only : d2r - use cam_control_mod, only : nsrest - use dyn_grid, only : get_dyn_grid_parm - use string_utils, only : to_upper - use horizontal_interpolate, only : xy_interp_init -#if ( defined SPMD ) - use mpishorthand, only: mpicom, mpir8, mpiint -#endif - - implicit none - - character(len=*), intent(in) :: specifier(:) - character(len=*), intent(in) :: filename - character(len=*), intent(in) :: filelist - character(len=*), intent(in) :: datapath - type(trfld), dimension(:), pointer :: flds - type(trfile), intent(inout) :: file - logical, intent(in) :: rmv_file - integer, intent(in) :: data_cycle_yr - integer, intent(in) :: data_fixed_ymd - integer, intent(in) :: data_fixed_tod - character(len=*), intent(in) :: data_type - - integer :: f, mxnflds, astat - integer :: str_yr, str_mon, str_day - integer :: lon_dimid, lat_dimid, lev_dimid, tim_dimid, old_dimid - integer :: dimids(4), did - type(var_desc_t) :: varid - integer :: idx - integer :: ierr - integer :: errcode - real(r8) :: start_time, time1, time2 - integer :: i1,i2,j1,j2 - integer :: nvardims, vardimids(4) - - character(len=80) :: data_units - - call specify_fields( specifier, flds ) - - file%datatimep=-1.e36_r8 - file%datatimem=-1.e36_r8 - - mxnflds = 0 - if (associated(flds)) mxnflds = size( flds ) - - if (mxnflds < 1) return - - file%remove_trc_file = rmv_file - file%pathname = trim(datapath) - file%filenames_list = trim(filelist) - - file%fill_in_months = .false. - file%cyclical = .false. - file%cyclical_list = .false. - -! does not work when compiled with pathf90 -! select case ( to_upper(data_type) ) - select case ( data_type ) - case( 'FIXED' ) - file%fixed = .true. - case( 'INTERP_MISSING_MONTHS' ) - file%fill_in_months = .true. - case( 'CYCLICAL' ) - file%cyclical = .true. - file%cyc_yr = data_cycle_yr - case( 'CYCLICAL_LIST' ) - file%cyclical_list = .true. - file%cyc_yr = data_cycle_yr - case( 'SERIAL' ) - case default - write(iulog,*) 'trcdata_init: invalid data type: '//trim(data_type)//' file: '//trim(filename) - write(iulog,*) 'trcdata_init: valid data types: SERIAL | CYCLICAL | CYCLICAL_LIST | FIXED | INTERP_MISSING_MONTHS ' - call endrun('trcdata_init: invalid data type: '//trim(data_type)//' file: '//trim(filename)) - endselect - - if ( (.not.file%fixed) .and. ((data_fixed_ymd>0._r8) .or.(data_fixed_tod>0._r8))) then - call endrun('trcdata_init: Cannot specify data_fixed_ymd or data_fixed_tod if data type is not FIXED') - endif - if ( (.not.file%cyclical) .and. (data_cycle_yr>0._r8) ) then - call endrun('trcdata_init: Cannot specify data_cycle_yr if data type is not CYCLICAL') - endif - - if (masterproc) then - write(iulog,*) 'trcdata_init: data type: '//trim(data_type)//' file: '//trim(filename) - endif - - ! if there is no list of files (len_trim(file%filenames_list)<1) then - ! -> set curr_filename from namelist rather from restart data - if ( len_trim(file%curr_filename)<1 .or. len_trim(file%filenames_list)<1 .or. file%fixed ) then ! initial run - file%curr_filename = trim(filename) - - call get_model_time(file) - - if ( file%fixed ) then - str_yr = data_fixed_ymd/10000 - str_mon = (data_fixed_ymd - str_yr*10000)/100 - str_day = data_fixed_ymd - str_yr*10000 - str_mon*100 - call set_time_float_from_date( start_time, str_yr, str_mon, str_day, data_fixed_tod ) - file%offset_time = start_time - file%curr_mod_time - else - file%offset_time = 0 - endif - endif - - call set_time_float_from_date( time2, 2, 1, 1, 0 ) - call set_time_float_from_date( time1, 1, 1, 1, 0 ) - file%one_yr = time2-time1 - - if ( file%cyclical .or. file%cyclical_list) then - file%cyc_ndx_beg = -1 - file%cyc_ndx_end = -1 - if ( file%cyc_yr /= 0 ) then - call set_time_float_from_date( time1, file%cyc_yr , 1, 1, 0 ) - call set_time_float_from_date( time2, file%cyc_yr+1, 1, 1, 0 ) - file%one_yr = time2-time1 - endif - - call open_trc_datafile( file%curr_filename, file%pathname, file%curr_fileid, file%curr_data_times, & - cyc_ndx_beg=file%cyc_ndx_beg, cyc_ndx_end=file%cyc_ndx_end, cyc_yr=file%cyc_yr ) - else - call open_trc_datafile( file%curr_filename, file%pathname, file%curr_fileid, file%curr_data_times ) - file%curr_data_times = file%curr_data_times - file%offset_time - endif - - call pio_seterrorhandling(File%curr_fileid, PIO_BCAST_ERROR) - ierr = pio_inq_dimid( file%curr_fileid, 'lon', idx ) - call pio_seterrorhandling(File%curr_fileid, PIO_INTERNAL_ERROR) - - file%zonal_ave = (ierr/=PIO_NOERR) - - plon = get_dyn_grid_parm('plon') - plat = get_dyn_grid_parm('plat') - - if ( .not. file%zonal_ave ) then - - call get_dimension( file%curr_fileid, 'lon', file%nlon, dimid=old_dimid, data=file%lons ) - - file%lons = file%lons * d2r - - lon_dimid = old_dimid - - endif - - ierr = pio_inq_dimid( file%curr_fileid, 'time', old_dimid) - - ! Hack to work with weird netCDF and old gcc or NAG bug. - tim_dimid = old_dimid - - call get_dimension( file%curr_fileid, 'lat', file%nlat, dimid=old_dimid, data=file%lats ) - file%lats = file%lats * d2r - - lat_dimid = old_dimid - - allocate( file%ps(file%nlon,file%nlat), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'trcdata_init: file%ps allocation error = ',astat - call endrun('trcdata_init: failed to allocate x array') - end if - - call pio_seterrorhandling(File%curr_fileid, PIO_BCAST_ERROR) - ierr = pio_inq_varid( file%curr_fileid, 'PS', file%ps_id ) - file%has_ps = (ierr==PIO_NOERR) - ierr = pio_inq_dimid( file%curr_fileid, 'altitude', idx ) - file%alt_data = (ierr==PIO_NOERR) - - call pio_seterrorhandling(File%curr_fileid, PIO_INTERNAL_ERROR) - - if ( file%has_ps) then - ierr = pio_inq_vardimid (file%curr_fileid, file%ps_id, dimids(1:3)) - do did = 1,3 - if ( dimids(did) == lon_dimid ) then - file%ps_coords(LONDIM) = did - file%ps_order(did) = LONDIM - else if ( dimids(did) == lat_dimid ) then - file%ps_coords(LATDIM) = did - file%ps_order(did) = LATDIM - else if ( dimids(did) == tim_dimid ) then - file%ps_coords(PS_TIMDIM) = did - file%ps_order(did) = PS_TIMDIM - endif - enddo - endif - - if (masterproc) then - write(iulog,*) 'trcdata_init: file%has_ps = ' , file%has_ps - endif ! masterproc - - if (file%alt_data) then - call get_dimension( file%curr_fileid, 'altitude_int', file%nilev, data=file%ilevs ) - call get_dimension( file%curr_fileid, 'altitude', file%nlev, dimid=old_dimid, data=file%levs ) - else - call get_dimension( file%curr_fileid, 'lev', file%nlev, dimid=old_dimid, data=file%levs ) - !!added for Linoz_v3 - call get_dimension( file%curr_fileid, 'ilev', file%nilev, data=file%ilevs ) - if (old_dimid>0) then - file%levs = file%levs*100._r8 ! mbar->pascals - endif - endif - - ! For some bizarre reason, netCDF with older gcc is keeping a pointer to the dimid, and overwriting it later! - ! Hackish workaround is to make a copy... - lev_dimid = old_dimid - - if (file%has_ps) then - - allocate( file%hyam(file%nlev), file%hybm(file%nlev), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'trcdata_init: file%hyam,file%hybm allocation error = ',astat - call endrun('trcdata_init: failed to allocate file%hyam and file%hybm arrays') - end if - - allocate( file%hyai(file%nlev+1), file%hybi(file%nlev+1), stat=astat ) - if( astat /= 0 ) then - write(iulog,*) 'trcdata_init: file%hyai,file%hybi allocation error = ',astat - call endrun('trcdata_init: failed to allocate file%hyai and file%hybi arrays') - end if - - call pio_seterrorhandling(File%curr_fileid, PIO_BCAST_ERROR) - ierr = pio_inq_varid( file%curr_fileid, 'P0', varid) - call pio_seterrorhandling(File%curr_fileid, PIO_INTERNAL_ERROR) - - if ( ierr == PIO_NOERR ) then - ierr = pio_get_var( file%curr_fileid, varid, file%p0 ) - else - file%p0 = 100000._r8 - endif - ierr = pio_inq_varid( file%curr_fileid, 'hyam', varid ) - ierr = pio_get_var( file%curr_fileid, varid, file%hyam ) - ierr = pio_inq_varid( file%curr_fileid, 'hybm', varid ) - ierr = pio_get_var( file%curr_fileid, varid, file%hybm ) - if (file%conserve_column) then - ierr = pio_inq_varid( file%curr_fileid, 'hyai', varid ) - ierr = pio_get_var( file%curr_fileid, varid, file%hyai ) - ierr = pio_inq_varid( file%curr_fileid, 'hybi', varid ) - ierr = pio_get_var( file%curr_fileid, varid, file%hybi ) - endif - - allocate( file %ps (pcols,begchunk:endchunk), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate file%ps array; error = ',astat - call endrun - end if - allocate( file%ps_in(1)%data(pcols,begchunk:endchunk), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate file%ps_in(1)%data array; error = ',astat - call endrun - end if - allocate( file%ps_in(2)%data(pcols,begchunk:endchunk), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate file%ps_in(2)%data array; error = ',astat - call endrun - end if - if( file%fill_in_months ) then - allocate( file%ps_in(3)%data(pcols,begchunk:endchunk), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate file%ps_in(3)%data array; error = ',astat - call endrun - end if - allocate( file%ps_in(4)%data(pcols,begchunk:endchunk), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate file%ps_in(4)%data array; error = ',astat - call endrun - end if - end if - endif - - flds_loop: do f = 1,mxnflds - - ! initialize the coordinate values to -1, - ! to defend against fields that do not have certain dimension, e.g., zonal average surface fields - ! and check against it when assigning value to cnt3 for that dimension - - do did = 1,4 - flds(f)%coords(did) = -1 - end do - - ! get netcdf variable id for the field - ierr = pio_inq_varid( file%curr_fileid, flds(f)%srcnam, flds(f)%var_id ) - - ! determine if the field has a vertical dimension - if (lev_dimid>0) then - ierr = pio_inquire_variable( file%curr_fileid, flds(f)%var_id, ndims=nvardims ) - ierr = pio_inquire_variable( file%curr_fileid, flds(f)%var_id, dimids=vardimids(:nvardims) ) - flds(f)%srf_fld = .not.any(vardimids(:nvardims)==lev_dimid) - else - flds(f)%srf_fld = .true. - endif - - ! allocate memory only if not already in pbuf2d - - if ( .not. file%in_pbuf(f) ) then - if ( flds(f)%srf_fld .or. file%top_bndry ) then - allocate( flds(f) %data(pcols,1,begchunk:endchunk), stat=astat ) - else - allocate( flds(f) %data(pcols,pver,begchunk:endchunk), stat=astat ) - endif - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate flds(f)%data array; error = ',astat - call endrun - end if - else - flds(f)%pbuf_ndx = pbuf_get_index(flds(f)%fldnam,errcode) - endif - - if (flds(f)%srf_fld) then - allocate( flds(f)%input(1)%data(pcols,1,begchunk:endchunk), stat=astat ) - else - allocate( flds(f)%input(1)%data(pcols,file%nlev,begchunk:endchunk), stat=astat ) - endif - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate flds(f)%input(1)%data array; error = ',astat - call endrun - end if - if (flds(f)%srf_fld) then - allocate( flds(f)%input(2)%data(pcols,1,begchunk:endchunk), stat=astat ) - else - allocate( flds(f)%input(2)%data(pcols,file%nlev,begchunk:endchunk), stat=astat ) - endif - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate flds(f)%input(2)%data array; error = ',astat - call endrun - end if - - if( file%fill_in_months ) then - if (flds(f)%srf_fld) then - allocate( flds(f)%input(3)%data(pcols,1,begchunk:endchunk), stat=astat ) - else - allocate( flds(f)%input(3)%data(pcols,file%nlev,begchunk:endchunk), stat=astat ) - endif - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate flds(f)%input(3)%data array; error = ',astat - call endrun - end if - if (flds(f)%srf_fld) then - allocate( flds(f)%input(4)%data(pcols,1,begchunk:endchunk), stat=astat ) - else - allocate( flds(f)%input(4)%data(pcols,file%nlev,begchunk:endchunk), stat=astat ) - endif - if( astat/= 0 ) then - write(iulog,*) 'trcdata_init: failed to allocate flds(f)%input(4)%data array; error = ',astat - call endrun - end if - endif - - if ( file%zonal_ave ) then - ierr = pio_inq_vardimid (file%curr_fileid, flds(f)%var_id, dimids(1:3)) - do did = 1,3 - if ( dimids(did) == lat_dimid ) then - flds(f)%coords(ZA_LATDIM) = did - flds(f)%order(did) = ZA_LATDIM - else if ( dimids(did) == lev_dimid ) then - flds(f)%coords(ZA_LEVDIM) = did - flds(f)%order(did) = ZA_LEVDIM - else if ( dimids(did) == tim_dimid ) then - flds(f)%coords(ZA_TIMDIM) = did - flds(f)%order(did) = ZA_TIMDIM - endif - enddo - else if ( flds(f)%srf_fld ) then - ierr = pio_inq_vardimid (file%curr_fileid, flds(f)%var_id, dimids(1:3)) - do did = 1,3 - if ( dimids(did) == lon_dimid ) then - flds(f)%coords(LONDIM) = did - flds(f)%order(did) = LONDIM - else if ( dimids(did) == lat_dimid ) then - flds(f)%coords(LATDIM) = did - flds(f)%order(did) = LATDIM - else if ( dimids(did) == tim_dimid ) then - flds(f)%coords(PS_TIMDIM) = did - flds(f)%order(did) = PS_TIMDIM - endif - enddo - else - ierr = pio_inq_vardimid (file%curr_fileid, flds(f)%var_id, dimids) - do did = 1,4 - if ( dimids(did) == lon_dimid ) then - flds(f)%coords(LONDIM) = did - flds(f)%order(did) = LONDIM - else if ( dimids(did) == lat_dimid ) then - flds(f)%coords(LATDIM) = did - flds(f)%order(did) = LATDIM - else if ( dimids(did) == lev_dimid ) then - flds(f)%coords(LEVDIM) = did - flds(f)%order(did) = LEVDIM - else if ( dimids(did) == tim_dimid ) then - flds(f)%coords(TIMDIM) = did - flds(f)%order(did) = TIMDIM - endif - enddo - endif - - ierr = pio_get_att( file%curr_fileid, flds(f)%var_id, 'units', data_units) - data_units = trim(data_units) - flds(f)%units = data_units(1:32) - - enddo flds_loop - -! if weighting by latitude, compute weighting for horizontal interpolation - if( file%weight_by_lat ) then -! get dimensions of CAM resolution - plon = get_dyn_grid_parm('plon') - plat = get_dyn_grid_parm('plat') - -! weight_x & weight_y are weighting function for x & y interpolation - allocate(file%weight_x(plon,file%nlon)) - allocate(file%weight_y(plat,file%nlat)) - allocate(file%count_x(plon)) - allocate(file%count_y(plat)) - allocate(file%index_x(plon,file%nlon)) - allocate(file%index_y(plat,file%nlat)) - file%weight_x(:,:) = 0.0_r8 - file%weight_y(:,:) = 0.0_r8 - file%count_x(:) = 0 - file%count_y(:) = 0 - file%index_x(:,:) = 0 - file%index_y(:,:) = 0 - - if(masterproc) then -! compute weighting - call xy_interp_init(file%nlon,file%nlat,file%lons,file%lats,plon,plat,file%weight_x,file%weight_y) - - do i2=1,plon - file%count_x(i2) = 0 - do i1=1,file%nlon - if(file%weight_x(i2,i1).gt.0.0_r8 ) then - file%count_x(i2) = file%count_x(i2) + 1 - file%index_x(i2,file%count_x(i2)) = i1 - endif - enddo - enddo - - do j2=1,plat - file%count_y(j2) = 0 - do j1=1,file%nlat - if(file%weight_y(j2,j1).gt.0.0_r8 ) then - file%count_y(j2) = file%count_y(j2) + 1 - file%index_y(j2,file%count_y(j2)) = j1 - endif - enddo - enddo - endif - -#if ( defined SPMD) - call mpibcast(file%weight_x, plon*file%nlon, mpir8 , 0, mpicom) - call mpibcast(file%weight_y, plat*file%nlat, mpir8 , 0, mpicom) - call mpibcast(file%count_x, plon, mpiint , 0, mpicom) - call mpibcast(file%count_y, plat, mpiint , 0, mpicom) - call mpibcast(file%index_x, plon*file%nlon, mpiint , 0, mpicom) - call mpibcast(file%index_y, plat*file%nlat, mpiint , 0, mpicom) -#endif - endif - - end subroutine trcdata_init - -!----------------------------------------------------------------------- -! Reads more data if needed and interpolates data to current model time -!----------------------------------------------------------------------- - subroutine advance_trcdata( flds, file, state, pbuf2d ) - use physics_types,only : physics_state - use physics_buffer, only : physics_buffer_desc - use ppgrid, only : pver,pcols - - implicit none - - type(trfile), intent(inout) :: file - type(trfld), intent(inout) :: flds(:) - type(physics_state), intent(in) :: state(begchunk:endchunk) - - type(physics_buffer_desc), optional, pointer :: pbuf2d(:,:) - integer :: ncol - real(r8) :: data_time - real(r8) :: t(pcols,pver) ! input temperature (K) - real(r8) :: rho(pcols,pver) ! input temperature (K) - real(r8) :: pmid(pcols,pver) ! pressure at layer midpoints (pa) -!--------------------------------------BLH----------------------------------- - - call t_startf('advance_trcdata') - if ( .not.( file%fixed .and. file%initialized ) ) then - - call get_model_time(file) - - data_time = file%datatimep - - if ( file%cyclical .or. file%cyclical_list ) then - ! wrap around - if ( (file%datatimepfile%datatimem) ) then - data_time = data_time + file%one_yr - endif - endif - - ! For stepTime need to advance if the times are equal - ! Should not impact other runs? - if ( file%curr_mod_time >= data_time ) then - call t_startf('read_next_trcdata') - call read_next_trcdata(state, flds, file ) - call t_stopf('read_next_trcdata') - if(masterproc) write(iulog,*) 'READ_NEXT_TRCDATA ', flds%fldnam,data_time - end if - - endif - - ! need to interpolate the data, regardless - ! each mpi task needs to interpolate - call t_startf('interpolate_trcdata') - if(present(pbuf2d)) then - call interpolate_trcdata( state, flds, file, pbuf2d ) - else - call interpolate_trcdata( state, flds, file ) - endif - call t_stopf('interpolate_trcdata') - - file%initialized = .true. - - call t_stopf('advance_trcdata') - - end subroutine advance_trcdata - -!------------------------------------------------------------------- -!------------------------------------------------------------------- - subroutine get_fld_data( flds, field_name, data, ncol, lchnk, pbuf ) - - use physics_buffer, only : physics_buffer_desc, pbuf_get_field - - implicit none - - type(trfld), intent(inout) :: flds(:) - character(len=*), intent(in) :: field_name - real(r8), intent(out) :: data(:,:) - integer, intent(in) :: lchnk - integer, intent(in) :: ncol - type(physics_buffer_desc), pointer :: pbuf(:) - - - integer :: f, nflds - real(r8),pointer :: tmpptr(:,:) - - data(:,:) = 0._r8 - nflds = size(flds) - - do f = 1, nflds - if ( trim(flds(f)%fldnam) == trim(field_name) ) then - if ( flds(f)%pbuf_ndx>0 ) then - call pbuf_get_field(pbuf, flds(f)%pbuf_ndx, tmpptr) - data(:ncol,:) = tmpptr(:ncol,:) - else - data(:ncol,:) = flds(f)%data(:ncol,:,lchnk) - endif - endif - enddo - - end subroutine get_fld_data - -!------------------------------------------------------------------- -!------------------------------------------------------------------- - subroutine put_fld_data( flds, field_name, data, ncol, lchnk, pbuf ) - - use physics_buffer, only : physics_buffer_desc, pbuf_get_field - - implicit none - - type(trfld), intent(inout) :: flds(:) - character(len=*), intent(in) :: field_name - real(r8), intent(in) :: data(:,:) - integer, intent(in) :: lchnk - integer, intent(in) :: ncol - type(physics_buffer_desc), pointer :: pbuf(:) - - - integer :: f, nflds - real(r8),pointer :: tmpptr(:,:) - - nflds = size(flds) - - do f = 1, nflds - if ( trim(flds(f)%fldnam) == trim(field_name) ) then - if ( flds(f)%pbuf_ndx>0 ) then - call pbuf_get_field(pbuf, flds(f)%pbuf_ndx, tmpptr) - tmpptr(:ncol,:) = data(:ncol,:) - else - flds(f)%data(:ncol,:,lchnk) = data(:ncol,:) - endif - endif - enddo - - end subroutine put_fld_data - -!------------------------------------------------------------------- -!------------------------------------------------------------------- - subroutine get_fld_ndx( flds, field_name, idx ) - - implicit none - - type(trfld), intent(in) :: flds(:) - character(len=*), intent(in) :: field_name - integer, intent(out) :: idx - integer :: f, nflds - - idx = -1 - nflds = size(flds) - - do f = 1, nflds - if ( trim(flds(f)%fldnam) == trim(field_name) ) then - idx = f - return - endif - enddo - - end subroutine get_fld_ndx - -!------------------------------------------------------------------------------ -!------------------------------------------------------------------------------ - subroutine get_model_time(file) - implicit none - type(trfile), intent(inout) :: file - - integer yr, mon, day, ncsec ! components of a date - - call get_curr_date(yr, mon, day, ncsec) - - if ( file%cyclical .or. file%cyclical_list) yr = file%cyc_yr - call set_time_float_from_date( file%curr_mod_time, yr, mon, day, ncsec ) - file%next_mod_time = file%curr_mod_time + get_step_size()/86400._r8 - - end subroutine get_model_time - -!------------------------------------------------------------------------------ -!------------------------------------------------------------------------------ - subroutine check_files( file, fids, itms, times_found) - - implicit none - - type(trfile), intent(inout) :: file - type(file_desc_t), intent(out) :: fids(2) ! ids of files that contains these recs - integer, optional, intent(out) :: itms(2) - logical, optional, intent(inout) :: times_found - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - logical :: list_cycled - - list_cycled = .false. - - !----------------------------------------------------------------------- - ! If next time beyond the end of the time list, - ! then increment the filename and move on to the next file - !----------------------------------------------------------------------- - if ((file%next_mod_time > file%curr_data_times(size(file%curr_data_times))).or.file%cyclical_list) then - if (file%cyclical_list) then - if ( associated(file%next_data_times) ) then - if ((file%curr_mod_time > file%datatimep)) then - - call advance_file(file) - - endif - endif - - endif - if ( .not. associated(file%next_data_times) ) then - ! open next file if not already opened... - if (file%cyclical_list) then - file%next_filename = incr_filename( file%curr_filename, filenames_list=file%filenames_list, datapath=file%pathname ,& - cyclical_list=file%cyclical_list, list_cycled=list_cycled) - else - file%next_filename = incr_filename( file%curr_filename, filenames_list=file%filenames_list, datapath=file%pathname) - endif - call open_trc_datafile( file%next_filename, file%pathname, file%next_fileid, file%next_data_times ) - file%next_data_times = file%next_data_times - file%offset_time - endif - endif - - !----------------------------------------------------------------------- - ! If using next_data_times and the current is greater than or equal to the next, then - ! close the current file, and set up for next file. - !----------------------------------------------------------------------- - if ( associated(file%next_data_times) ) then - if (file%cyclical_list .and. list_cycled) then ! special case - list cycled - - file%datatimem = file%curr_data_times(size(file%curr_data_times)) - itms(1)=size(file%curr_data_times) - fids(1)=file%curr_fileid - - file%datatimep = file%next_data_times(1) - itms(2)=1 - fids(2) = file%next_fileid - - times_found = .true. - - else if (file%curr_mod_time >= file%next_data_times(1)) then - - call advance_file(file) - - endif - endif - - end subroutine check_files - -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- - function incr_filename( filename, filenames_list, datapath, cyclical_list, list_cycled ) - - !----------------------------------------------------------------------- - ! ... Increment or decrement a date string withing a filename - ! the filename date section is assumed to be of the form - ! yyyy-dd-mm - !----------------------------------------------------------------------- - - use string_utils, only : incstr - use shr_file_mod, only : shr_file_getunit, shr_file_freeunit - - implicit none - - - character(len=*), intent(in) :: filename ! present dynamical dataset filename - character(len=*), optional, intent(in) :: filenames_list - character(len=*), optional, intent(in) :: datapath - logical , optional, intent(in) :: cyclical_list ! If true, allow list to cycle - logical , optional, intent(out) :: list_cycled - character(len=shr_kind_cl) :: incr_filename ! next filename in the sequence - - - ! set new next_filename ... - - !----------------------------------------------------------------------- - ! ... local variables - !----------------------------------------------------------------------- - integer :: pos, pos1, istat - character(len=shr_kind_cl) :: fn_new, line, filepath - character(len=6) :: seconds - character(len=5) :: num - integer :: ios,unitnumber - - if (present(list_cycled)) list_cycled = .false. - - if (( .not. present(filenames_list)) .or.(len_trim(filenames_list) == 0)) then - !----------------------------------------------------------------------- - ! ... ccm type filename - !----------------------------------------------------------------------- - pos = len_trim( filename ) - fn_new = filename(:pos) - if ( masterproc ) write(iulog,*) 'incr_flnm: old filename = ',trim(fn_new) - if( fn_new(pos-2:) == '.nc' ) then - pos = pos - 3 - end if - istat = incstr( fn_new(:pos), 1 ) - if( istat /= 0 ) then - write(iulog,*) 'incr_flnm: incstr returned ', istat - write(iulog,*) ' while trying to decrement ',trim( fn_new ) - call endrun - end if - - else - - !------------------------------------------------------------------- - ! ... open filenames_list - !------------------------------------------------------------------- - if ( masterproc ) write(iulog,*) 'incr_flnm: old filename = ',trim(filename) - if ( masterproc ) write(iulog,*) 'incr_flnm: open filenames_list : ',trim(filenames_list) - unitnumber = shr_file_getUnit() - if ( present(datapath) ) then - filepath = trim(datapath) //'/'// trim(filenames_list) - else - filepath = trim(datapath) - endif - - open( unit=unitnumber, file=filepath, iostat=ios, status="OLD") - if (ios /= 0) then - call endrun('not able to open filenames_list file: '//trim(filepath)) - endif - - !------------------------------------------------------------------- - ! ... read file names - !------------------------------------------------------------------- - read( unit=unitnumber, fmt='(A)', iostat=ios ) line - if (ios /= 0) then - call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) - endif - - !------------------------------------------------------------------- - ! If current filename is '', then initialize with the first filename read in - ! and skip this section. - !------------------------------------------------------------------- - if (filename /= '') then - - !------------------------------------------------------------------- - ! otherwise read until find current filename - !------------------------------------------------------------------- - do while( trim(line) /= trim(filename) ) - read( unit=unitnumber, fmt='(A)', iostat=ios ) line - if (ios /= 0) then - call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) - endif - enddo - - !------------------------------------------------------------------- - ! Read next filename - !------------------------------------------------------------------- - read( unit=unitnumber, fmt='(A)', iostat=ios ) line - - !--------------------------------------------------------------------------------- - ! If cyclical_list, then an end of file is not an error, but rather - ! a signal to rewind and start over - !--------------------------------------------------------------------------------- - - if (ios /= 0) then - if (present(cyclical_list)) then - if (cyclical_list) then - list_cycled=.true. - rewind(unitnumber) - read( unit=unitnumber, fmt='(A)', iostat=ios ) line - ! Error here should never happen, but check just in case - if (ios /= 0) then - call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) - endif - else - call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) - endif - else - call endrun('not able to increment file name from filenames_list file: '//trim(filenames_list)) - endif - endif - - endif - - !--------------------------------------------------------------------------------- - ! Assign the current filename and close the filelist - !--------------------------------------------------------------------------------- - fn_new = trim(line) - - close(unit=unitnumber) - call shr_file_freeUnit(unitnumber) - endif - - !--------------------------------------------------------------------------------- - ! return the current filename - !--------------------------------------------------------------------------------- - incr_filename = trim(fn_new) - if ( masterproc ) write(iulog,*) 'incr_flnm: new filename = ',trim(incr_filename) - - end function incr_filename - -!------------------------------------------------------------------------------ -!------------------------------------------------------------------------------ - subroutine find_times( itms, fids, time, file, datatimem, datatimep, times_found ) - - implicit none - - type(trfile), intent(in) :: file - real(r8), intent(out) :: datatimem, datatimep - - integer, intent(out) :: itms(2) ! record numbers that bracket time - type(file_desc_t), intent(out) :: fids(2) ! ids of files that contains these recs - - real(r8), intent(in) :: time ! time of interest - logical, intent(inout) :: times_found - - integer :: np1 ! current forward time index of dataset - integer :: n,i ! - integer :: curr_tsize, next_tsize, all_tsize - integer :: astat - integer :: cyc_tsize - - real(r8), allocatable, dimension(:):: all_data_times - - curr_tsize = size(file%curr_data_times) - next_tsize = 0 - if ( associated(file%next_data_times)) next_tsize = size(file%next_data_times) - - all_tsize = curr_tsize + next_tsize - - allocate( all_data_times( all_tsize ), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'find_times: failed to allocate all_data_times array; error = ',astat - call endrun - end if - - all_data_times(:curr_tsize) = file%curr_data_times(:) - if (next_tsize > 0) all_data_times(curr_tsize+1:all_tsize) = file%next_data_times(:) - - if ( .not. file%cyclical ) then - if ( all( all_data_times(:) > time ) ) then - write(iulog,*) 'FIND_TIMES: ALL data times are after ', time - write(iulog,*) 'FIND_TIMES: data times: ',all_data_times(:) - write(iulog,*) 'FIND_TIMES: time: ',time - call endrun('find_times: all(all_data_times(:) > time) '// trim(file%curr_filename) ) - endif - - ! find bracketing times - find_times_loop : do n=1, all_tsize-1 - np1 = n + 1 - datatimem = all_data_times(n) !+ file%offset_time - datatimep = all_data_times(np1) !+ file%offset_time - ! When stepTime, datatimep may not equal the time (as only datatimem is used) - ! Should not break other runs? - if ( (time .ge. datatimem) .and. (time .lt. datatimep) ) then - times_found = .true. - exit find_times_loop - endif - enddo find_times_loop - - else ! file%cyclical - - cyc_tsize = file%cyc_ndx_end - file%cyc_ndx_beg + 1 - - if ( cyc_tsize > 1 ) then - - call findplb(all_data_times(file%cyc_ndx_beg:file%cyc_ndx_end),cyc_tsize, time, n ) - - if (n == cyc_tsize) then - np1 = 1 - else - np1 = n+1 - endif - - datatimem = all_data_times(n +file%cyc_ndx_beg-1) - datatimep = all_data_times(np1+file%cyc_ndx_beg-1) - times_found = .true. - - endif - endif - - if ( .not. times_found ) then - if (masterproc) then - write(iulog,*)'FIND_TIMES: Failed to find dates bracketing desired time =', time - write(iulog,*)' datatimem = ',file%datatimem - write(iulog,*)' datatimep = ',file%datatimep - write(iulog,*)' all_data_times = ',all_data_times - !call endrun() - return - endif - endif - - deallocate( all_data_times, stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'find_times: failed to deallocate all_data_times array; error = ',astat - call endrun - end if - - if ( .not. file%cyclical ) then - itms(1) = n - itms(2) = np1 - else - itms(1) = n +file%cyc_ndx_beg-1 - itms(2) = np1 +file%cyc_ndx_beg-1 - endif - - fids(:) = file%curr_fileid - - do i=1,2 - if ( itms(i) > curr_tsize ) then - itms(i) = itms(i) - curr_tsize - fids(i) = file%next_fileid - endif - enddo - - end subroutine find_times - -!------------------------------------------------------------------------ -!------------------------------------------------------------------------ - subroutine read_next_trcdata(state, flds, file ) - - use shr_const_mod, only:pi => shr_const_pi - use physics_types,only : physics_state - use ppgrid, only: pcols, pver, pverp,begchunk,endchunk - use physconst, only: rair - use iop_data_mod - use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_aer_props, & - rad_cnst_get_mode_props, rad_cnst_get_mode_num - - implicit none - - type (trfile), intent(inout) :: file - type (trfld),intent(inout) :: flds(:) - type(physics_state), intent(in) :: state(begchunk:endchunk) - - integer :: recnos(4),i,f,nflds ! - integer :: cnt4(4) ! array of counts for each dimension - integer :: strt4(4) ! array of starting indices - integer :: cnt3(3) ! array of counts for each dimension - integer :: strt3(3) ! array of starting indices - type(file_desc_t) :: fids(4) - logical :: times_found - - integer :: cur_yr, cur_mon, cur_day, cur_sec, yr1, yr2, mon, date, sec - real(r8) :: series1_time, series2_time - type(file_desc_t) :: fid1, fid2 - - integer :: nspec,nmodes,n,ii,kk,l1,k,lchnk - real(r8) :: profile_p(pver),pp(pver),meanP,meanO,sumii,volfrac,specdens,aero_den(6) - real(r8) :: q_a(3,6) - real(r8) :: rho(pcols,pver) ! air density (kg m-3) - character(len=20) :: aername - character(len=3) :: arnam(7) = (/'so4','pom','soa','bc ','dst','ncl','num'/) - - nflds = size(flds) - times_found = .false. - - if(single_column .and. scm_observed_aero) then - - call ver_profile_aero(pp) - ! The following do loop gets the species properties and calculates the aerosol - ! mass mixing ratio of each species from observed total number and size distribution - ! properties in the unit kg/m^3 for the 3 modes. Data is read from the forcing file. - ! For mode 1 (accumulation mode) q_a(1,1)=q(so4),q_a(1,2)=q(pom),q_a(1,3)=q(soa), - ! q_a(1,4)=q(bc),q_a(1,5)=q(dst),q_a(1,6)=q(ncl). - ! For mode 2 (aitken mode) q_a(2,1)=q(so4),q_a(2,2)=q(soa),q_a(2,3)=q(ncl). - ! For mode 3 (coarse mode) q_a(3,1)=q(dst),q_a(3,2)=q(ncl),q_a(3,3)=q(so4). - - call rad_cnst_get_info(0, nmodes=nmodes) - do n=1, nmodes - call rad_cnst_get_info(0, n, nspec=nspec) - do l1 = 1, nspec - call rad_cnst_get_aer_props(0, n,l1,density_aer=specdens) - call rad_cnst_get_aer_props(0, n, l1, aername=aername) - aero_den(l1)=specdens - q_a(n,l1) = specdens*scm_div(n,l1)*scm_num(n)*((pi/6.0_r8)*( & - scm_dgnum(n)**3)*exp(4.5_r8*(log(scm_std(n))**2) )) - enddo - enddo - - do k = 1, pver - do ii = 1, state(begchunk)%ncol - rho(ii,k) = state(begchunk)%pmid(ii,k)/(rair*state(begchunk)%t(ii,k)) - enddo - enddo - end if - - do while( .not. times_found ) - call find_times( recnos, fids, file%curr_mod_time,file,file%datatimem,file%datatimep, times_found ) - if ( .not. times_found ) then - call check_files( file, fids, recnos, times_found ) - endif - enddo - - ! If single column do not interpolate aerosol data, just use the step function. - ! The exception is if we are trying to "replay" a column from the full model - if(single_column .and. .not. use_replay) then - file%stepTime = .true. - endif - - if (file%stepTime) then - file%interp_recs = 1 - else - file%interp_recs = 2 - end if - - if ( file%fill_in_months ) then - - if( file%datatimep-file%datatimem > file%one_yr ) then - - call get_curr_date(cur_yr, cur_mon, cur_day, cur_sec) - - call set_date_from_time_float(file%datatimem, yr1, mon, date, sec ) - call set_date_from_time_float(file%datatimep, yr2, mon, date, sec ) - - call set_time_float_from_date( series1_time, yr1, cur_mon, cur_day, cur_sec ) - call set_time_float_from_date( series2_time, yr2, cur_mon, cur_day, cur_sec ) - - fid1 = fids(1) - fid2 = fids(2) - file%cyclical = .true. - call set_cycle_indices( fid1, file%cyc_ndx_beg, file%cyc_ndx_end, yr1) - call find_times( recnos(1:2), fids(1:2), series1_time, file, file%datatimes(1), file%datatimes(2), times_found ) - - if ( .not. times_found ) then - call endrun('read_next_trcdata: time not found for series1_time') - endif - call set_cycle_indices( fid2, file%cyc_ndx_beg, file%cyc_ndx_end, yr2) - - if ( fid1%fh /= fid2%fh ) then - file%cyc_ndx_beg = file%cyc_ndx_beg + size(file%curr_data_times) - file%cyc_ndx_end = file%cyc_ndx_end + size(file%curr_data_times) - endif - call find_times( recnos(3:4), fids(3:4), series2_time, file, file%datatimes(3), file%datatimes(4), times_found ) - if ( .not. times_found ) then - call endrun('read_next_trcdata: time not found for series2_time') - endif - file%cyclical = .false. - file%interp_recs = 4 - - call set_date_from_time_float( file%datatimes(1), yr1, mon, date, sec ) - call set_time_float_from_date( file%datatimem, cur_yr, mon, date, sec ) - if (file%datatimes(1) > file%datatimes(2) ) then ! wrap around - if ( cur_mon == 1 ) then - call set_time_float_from_date( file%datatimem, cur_yr-1, mon, date, sec ) - endif - endif - - call set_date_from_time_float( file%datatimes(2), yr1, mon, date, sec ) - call set_time_float_from_date( file%datatimep, cur_yr, mon, date, sec ) - if (file%datatimes(1) > file%datatimes(2) ) then ! wrap around - if ( cur_mon == 12 ) then - call set_time_float_from_date( file%datatimep, cur_yr+1, mon, date, sec ) - endif - endif - - endif - - endif - - ! - ! Set up hyperslab corners - ! - strt4(:) = 1 - strt3(:) = 1 - - do i=1,file%interp_recs - - do f = 1,nflds - if ( file%zonal_ave ) then - ! Defend against zonal mean surface fields that do not set the value via dimension match - if (flds(f)%coords(ZA_LATDIM) .gt. 0) cnt3(flds(f)%coords(ZA_LATDIM)) = file%nlat - if (flds(f)%srf_fld) then - ! Defend against zonal mean surface fields that do not set the value via dimension match - if (flds(f)%coords(ZA_LEVDIM) .gt. 0) cnt3(flds(f)%coords(ZA_LEVDIM)) = 1 - else - cnt3(flds(f)%coords(ZA_LEVDIM)) = file%nlev - endif - cnt3(flds(f)%coords(ZA_TIMDIM)) = 1 - strt3(flds(f)%coords(ZA_TIMDIM)) = recnos(i) - !! - if (file%linoz_v3 .or. file%linoz_v2) then - !!check if these are the surface variables - !!no need to do interpolate since only used - !!in preprocessing, - !!clim +57 is the correspondent srf variable - if (index(flds(f)%fldnam,"_clim") .gt.0.and.& - index(flds(f)%fldnam,"P_clim") .le.0.and.& - index(flds(f)%fldnam,"L_clim") .le.0.and.& - index(flds(f)%fldnam,"_srf") .le.0)then - call read_za_trc_linoz( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file, & - (/ flds(f)%order(ZA_LATDIM),flds(f)%order(ZA_LEVDIM)/), & - vid_srf=flds(f+57)%var_id ) - elseif (index(flds(f)%fldnam,"_srf").gt.0) then - if (index(flds(f)%fldnam,"ch4_avg_srf").gt.0) then - cnt3(1)=1!set 1st dim since no ZA_LATDIM - endif - call read_zasrf_trc_linoz(fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file) - else - call read_za_trc_linoz( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file, & - (/ flds(f)%order(ZA_LATDIM),flds(f)%order(ZA_LEVDIM) /) ) - endif - else - call read_za_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt3, cnt3, file, & - (/ flds(f)%order(ZA_LATDIM),flds(f)%order(ZA_LEVDIM) /) ) - endif - else if ( flds(f)%srf_fld ) then - cnt3( flds(f)%coords(LONDIM)) = file%nlon - cnt3( flds(f)%coords(LATDIM)) = file%nlat - cnt3( flds(f)%coords(PS_TIMDIM)) = 1 - strt3(flds(f)%coords(PS_TIMDIM)) = recnos(i) - call read_2d_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data(:,1,:), strt3, cnt3, file, & - (/ flds(f)%order(LONDIM),flds(f)%order(LATDIM) /) ) - else - cnt4(flds(f)%coords(LONDIM)) = file%nlon - cnt4(flds(f)%coords(LATDIM)) = file%nlat - cnt4(flds(f)%coords(LEVDIM)) = file%nlev - cnt4(flds(f)%coords(TIMDIM)) = 1 - strt4(flds(f)%coords(TIMDIM)) = recnos(i) - call read_3d_trc( fids(i), flds(f)%var_id, flds(f)%input(i)%data, strt4, cnt4, file, & - (/ flds(f)%order(LONDIM),flds(f)%order(LATDIM),flds(f)%order(LEVDIM) /)) - - ! - ! This section sets the observed aersol mass and number mixing ratios in the - ! appropriate variables. The observed aerosol inforamtion is read from the - ! forcing file as total number and size distribution parameters. Then the total - ! volume is calculated.Using the desnsity of each species, the mass is calculated. - ! Finally the number is partition among the each species using the species fraction - ! data read from the forcing file. - ! - if(single_column .and. scm_observed_aero) then - kk=index(trim(flds(f)%fldnam),'_')-1 - if(index(trim(flds(f)%fldnam),'1') > 0 .and.index(trim(flds(f)%fldnam),'log') < 1) then - if(flds(f)%fldnam(1:kk).eq.arnam(1).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(1),flds(f)%input(i)%data, & - rho,pp,q_a(1,1),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(2).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(2),flds(f)%input(i)%data, & - rho,pp,q_a(1,2),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(3).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(3),flds(f)%input(i)%data, & - rho,pp,q_a(1,3),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(4).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(4),flds(f)%input(i)%data, & - rho,pp,q_a(1,4),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(5).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(5),flds(f)%input(i)%data, & - rho,pp,q_a(1,5),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(6).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(6),flds(f)%input(i)%data, & - rho,pp,q_a(1,6),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(7).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(7),flds(f)%input(i)%data, & - rho,pp,scm_num(1),state(begchunk)%ncol) - endif - elseif(index(trim(flds(f)%fldnam),'2') > 0 .and.index(trim(flds(f)%fldnam),'log') < 1) then - if(flds(f)%fldnam(1:kk).eq.arnam(1).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(1),flds(f)%input(i)%data, & - rho,pp,q_a(2,1),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(3).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(3),flds(f)%input(i)%data, & - rho,pp,q_a(2,2),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(6).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(6),flds(f)%input(i)%data, & - rho,pp,q_a(2,3),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(7).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(7),flds(f)%input(i)%data, & - rho,pp,scm_num(2),state(begchunk)%ncol) - endif - elseif(index(trim(flds(f)%fldnam),'3') > 0 .and.index(trim(flds(f)%fldnam),'log') < 1) then - if(flds(f)%fldnam(1:kk).eq.arnam(1).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(1),flds(f)%input(i)%data, & - rho,pp,q_a(3,3),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(5).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(5),flds(f)%input(i)%data, & - rho,pp,q_a(3,1),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(6).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(6),flds(f)%input(i)%data, & - rho,pp,q_a(3,2),state(begchunk)%ncol) - elseif(flds(f)%fldnam(1:kk).eq.arnam(7).and.index(trim(flds(f)%fldnam),'log') < 1) then - call replace_aero_data(flds(f)%fldnam,arnam(7),flds(f)%input(i)%data, & - rho,pp,scm_num(3),state(begchunk)%ncol) - endif - endif - endif !scm_observed_aero - endif - - enddo - - if ( file%has_ps ) then - cnt3(file%ps_coords(LONDIM)) = file%nlon - cnt3(file%ps_coords(LATDIM)) = file%nlat - cnt3(file%ps_coords(PS_TIMDIM)) = 1 - strt3(file%ps_coords(PS_TIMDIM)) = recnos(i) - call read_2d_trc( fids(i), file%ps_id, file%ps_in(i)%data, strt3, cnt3, file, & - (/ file%ps_order(LONDIM),file%ps_order(LATDIM) /) ) - endif - - enddo - - end subroutine read_next_trcdata - -!-------------------------------------------------------------------------------- -!This subroutine replaces the climatological aerosol information by the observed -!once after they are read -! - subroutine replace_aero_data(aerofulnam,spnam,aero_q_data,rho,pp,q_mix,ncoli) - use ppgrid, only: pcols,pver,begchunk,endchunk - - implicit none - real(r8), intent(inout) :: aero_q_data(pcols,pver,begchunk:endchunk) - real(r8), intent(in) :: rho(pcols,pver),pp(pver) - real(r8) :: sumii,meanO - real(r8), intent(in) :: q_mix - character(len=32),intent(in) ::aerofulnam - character(len=3),intent(in) :: spnam - character(len=32) ::aerosubnam - integer, intent(in) :: ncoli - integer :: ii,k,countj - - if(trim(aerofulnam(1:2)).eq.'bc') then - aerosubnam=aerofulnam(1:4) - else - aerosubnam=aerofulnam(1:5) - endif - - if((trim(aerosubnam).eq.(trim(spnam)//'_a').or.trim(aerosubnam).eq.(trim(spnam)//'_c')) & - .and.index(trim(aerofulnam),'log') < 1) then - - aero_q_data=q_mix - sumii=0._r8 - countj =0 - do ii = 1, ncoli - do k = 1, pver - if(pp(k).gt.0._r8) then - countj=countj+1 - endif - if(trim(spnam).ne.'num') then - aero_q_data(ii,k,begchunk)=(aero_q_data(ii,k,begchunk)*pp(k)) /rho(ii,k) - endif - sumii=sumii + aero_q_data(ii,k,begchunk) - enddo - enddo - meanO=sumii/countj - do k = 1, pver - if(meanO.ne.0.) then - aero_q_data(1,k,begchunk)=pp(k)*meanO - else - aero_q_data(1,k,begchunk)=0._r8 - endif - enddo - endif - - end subroutine replace_aero_data - -!--------------------------------------------------------------------------- -!This subroutine generates a heavyside type profiles for the observed aerosol. -!This setting is constant profile in the lower atmosphere and then exponentially -!decreasing to zero at the top of the atmosphere. The level of initial decay is -!controlled by "initial_val". Larger than -3.5 pushes the decay point up and smaller -!brings it closer to the surface. -! - subroutine ver_profile_aero(vertprof_aero) - use mo_constants, only : pi - use ppgrid, only: pcols,pver - - implicit none - real(r8), intent(inout) :: vertprof_aero(pver) - real(r8) :: initial_val = -3.5_r8 - integer :: k - - do k=1,pver - if(k==1) then - vertprof_aero(k)=0._r8 - elseif(k==2) then - vertprof_aero(k)=1._r8/(1._r8 + exp(-2._r8*initial_val * pi)) - else - vertprof_aero(k)=1._r8/(1._r8 + exp(-2._r8*(initial_val * pi + pi/4._r8*(k-2)))) - endif - enddo - end subroutine ver_profile_aero - -!------------------------------------------------------------------------ - - - subroutine read_2d_trc( fid, vid, loc_arr, strt, cnt, file, order ) - use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish - - use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p, get_lon_all_p, get_lat_all_p - use mo_constants, only : pi - use dycore, only: dycore_is - use polar_avg, only: polar_average - use horizontal_interpolate, only : xy_interp - - implicit none - type(file_desc_t), intent(in) :: fid - type(var_desc_t), intent(in) :: vid - integer, intent(in) :: strt(:), cnt(:), order(2) - real(r8),intent(out) :: loc_arr(:,:) - type (trfile), intent(in) :: file - - real(r8) :: to_lats(pcols), to_lons(pcols), wrk(pcols) - real(r8), allocatable, target :: wrk2d(:,:) - real(r8), pointer :: wrk2d_in(:,:) - - integer :: tsize, c, i, j, ierr, ncols - real(r8), parameter :: zero=0_r8, twopi=2_r8*pi - type(interp_type) :: lon_wgts, lat_wgts - integer :: lons(pcols), lats(pcols) - - nullify(wrk2d_in) - allocate( wrk2d(cnt(1),cnt(2)), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'read_2d_trc: wrk2d allocation error = ',ierr - call endrun - end if - - if(order(1)/=1 .or. order(2)/=2 .or. cnt(1)/=file%nlon .or. cnt(2)/=file%nlat) then - allocate( wrk2d_in(file%nlon, file%nlat), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'read_2d_trc: wrk2d_in allocation error = ',ierr - call endrun - end if - end if - - - - ierr = pio_get_var( fid, vid, strt, cnt, wrk2d ) - if(associated(wrk2d_in)) then - wrk2d_in = reshape( wrk2d(:,:),(/file%nlon,file%nlat/), order=order ) - deallocate(wrk2d) - else - wrk2d_in => wrk2d - end if - - j=1 - -! if weighting by latitude, the perform horizontal interpolation by using weight_x, weight_y - - if(file%weight_by_lat) then - - call t_startf('xy_interp') - - do c = begchunk,endchunk - ncols = get_ncols_p(c) - call get_lon_all_p(c,ncols,lons) - call get_lat_all_p(c,ncols,lats) - - call xy_interp(file%nlon,file%nlat,1,plon,plat,pcols,ncols,file%weight_x,file%weight_y,wrk2d_in,loc_arr(:,c-begchunk+1), & - lons,lats,file%count_x,file%count_y,file%index_x,file%index_y) - enddo - - call t_stopf('xy_interp') - - else - do c=begchunk,endchunk - ncols = get_ncols_p(c) - call get_rlat_all_p(c, pcols, to_lats) - call get_rlon_all_p(c, pcols, to_lons) - - call lininterp_init(file%lons, file%nlon, to_lons, ncols, 2, lon_wgts, zero, twopi) - call lininterp_init(file%lats, file%nlat, to_lats, ncols, 1, lat_wgts) - - call lininterp(wrk2d_in, file%nlon, file%nlat, loc_arr(1:ncols,c-begchunk+1), ncols, lon_wgts, lat_wgts) - - call lininterp_finish(lon_wgts) - call lininterp_finish(lat_wgts) - end do - endif - - if(allocated(wrk2d)) then - deallocate(wrk2d) - else - deallocate(wrk2d_in) - end if - if(dycore_is('LR')) call polar_average(loc_arr) - end subroutine read_2d_trc - -!------------------------------------------------------------------------ - - subroutine read_za_trc( fid, vid, loc_arr, strt, cnt, file, order ) - use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish - use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p - use mo_constants, only : pi - use dycore, only : dycore_is - use polar_avg, only : polar_average - - implicit none - type(file_desc_t), intent(in) :: fid - type(var_desc_t), intent(in) :: vid - integer, intent(in) :: strt(:), cnt(:) - integer, intent(in) :: order(2) - real(r8), intent(out):: loc_arr(:,:,:) - type (trfile), intent(in) :: file - - type(interp_type) :: lat_wgts - real(r8) :: to_lats(pcols), to_lons(pcols), wrk(pcols) - real(r8), allocatable, target :: wrk2d(:,:) - real(r8), pointer :: wrk2d_in(:,:) - integer :: c, k, ierr, ncols - - nullify(wrk2d_in) - allocate( wrk2d(cnt(1),cnt(2)), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'read_2d_trc: wrk2d allocation error = ',ierr - call endrun - end if - - if(order(1)/=1 .or. order(2)/=2 .or. cnt(1)/=file%nlat .or. cnt(2)/=file%nlev) then - allocate( wrk2d_in(file%nlat, file%nlev), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'read_2d_trc: wrk2d_in allocation error = ',ierr - call endrun - end if - end if - - - ierr = pio_get_var( fid, vid, strt, cnt, wrk2d ) - if(associated(wrk2d_in)) then - wrk2d_in = reshape( wrk2d(:,:),(/file%nlat,file%nlev/), order=order ) - deallocate(wrk2d) - else - wrk2d_in => wrk2d - end if - - - - do c=begchunk,endchunk - ncols = get_ncols_p(c) - call get_rlat_all_p(c, pcols, to_lats) - - call lininterp_init(file%lats, file%nlat, to_lats, ncols, 1, lat_wgts) - do k=1,file%nlev - call lininterp(wrk2d_in(:,k), file%nlat, wrk(1:ncols), ncols, lat_wgts) - loc_arr(1:ncols,k,c-begchunk+1) = wrk(1:ncols) - end do - call lininterp_finish(lat_wgts) - end do - - if(allocated(wrk2d)) then - deallocate(wrk2d) - else - deallocate(wrk2d_in) - end if -! if(dycore_is('LR')) call polar_average(loc_arr) - end subroutine read_za_trc -!------------------------------------------------------------------------ - subroutine read_za_trc_linoz( fid, vid, loc_arr, strt, cnt, file, order ,vid_srf) - use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish - use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p - use mo_constants, only : pi - use dycore, only : dycore_is - use polar_avg, only : polar_average - - implicit none - type(file_desc_t), intent(in) :: fid - type(var_desc_t), intent(in) :: vid - integer, intent(in) :: strt(:), cnt(:) - integer, intent(in) :: order(2) - real(r8), intent(out):: loc_arr(:,:,:) - type (trfile), intent(in) :: file - !! - type(var_desc_t), intent(in), optional :: vid_srf - integer :: cnt_srf(2) - integer :: strt_srf(2) - !! - type(interp_type) :: lat_wgts - real(r8) :: to_lats(pcols), to_lons(pcols), wrk(pcols) - real(r8), allocatable, target :: wrk2d(:,:) - real(r8), allocatable, target :: wrksrf(:) - real(r8), pointer :: wrk2d_in(:,:) - integer :: c, k, ierr, ncols - - nullify(wrk2d_in) - allocate( wrk2d(cnt(1),cnt(2)), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'read_2d_trc: wrk2d allocation error = ',ierr - call endrun - end if - - if(order(1)/=1 .or. order(2)/=2 .or. cnt(1)/=file%nlat .or. cnt(2)/=file%nlev) then - allocate( wrk2d_in(file%nlat, file%nlev), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'read_2d_trc: wrk2d_in allocation error = ',ierr - call endrun - end if - end if - !! - ierr = pio_get_var( fid, vid, strt, cnt, wrk2d ) - !! - if (file%linoz_v3) then - !!since io reads in global data for every thread - !!and interpolate to local chunk, we can do surface, - !!polar, and surface padding preprocessfor every variable - !!before interpolation - !!it is put here rather than the data formation process - !!to prevent forget when producing forcing data - !read in order of 0.1hPa~985hPa, pad top with 2nd layer - wrk2d(:,1)=wrk2d(:,2) - !both N/S poles need to pad by nearest data - wrk2d(1,:)=wrk2d(2,:) - wrk2d(file%nlat,:)=wrk2d(file%nlat-1,:) - !!read in srf data to pad surface - !!they are inputs from CMIP forcing and other references - cnt_srf(1)=cnt(1) - cnt_srf(2)=cnt(3) - strt_srf(1)=strt(1) - strt_srf(2)=strt(3) - !!check if vid_srf is present to determine clim variables - if (present(vid_srf)) then - !!padding for clim terms - allocate(wrksrf(cnt(1)), stat=ierr ) - ierr = pio_get_var( fid, vid_srf, strt_srf, cnt_srf, wrksrf ) - !!surface padding - wrk2d(:,file%nlev)=wrksrf - deallocate(wrksrf) - endif - !! - endif - !! - if(associated(wrk2d_in)) then - wrk2d_in = reshape( wrk2d(:,:),(/file%nlat,file%nlev/), order=order ) - deallocate(wrk2d) - else - wrk2d_in => wrk2d - end if - - do c=begchunk,endchunk - ncols = get_ncols_p(c) - call get_rlat_all_p(c, pcols, to_lats) - call lininterp_init(file%lats, file%nlat, to_lats, ncols, 1, lat_wgts) - do k=1,file%nlev - call lininterp(wrk2d_in(:,k), file%nlat, wrk(1:ncols), ncols, lat_wgts) - loc_arr(1:ncols,k,c-begchunk+1) = wrk(1:ncols) - end do - call lininterp_finish(lat_wgts) - end do - - if(allocated(wrk2d)) then - deallocate(wrk2d) - else - deallocate(wrk2d_in) - end if - !! - if(allocated(wrksrf)) then - deallocate(wrksrf) - end if -! if(dycore_is('LR')) call polar_average(loc_arr) - end subroutine read_za_trc_linoz - -!------------------------------------------------------------------------ - subroutine read_zasrf_trc_linoz( fid, vid, loc_arr, strt, cnt, file) - use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish - use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p - !! - implicit none - type(file_desc_t), intent(in) :: fid - type(var_desc_t), intent(in) :: vid - integer, intent(in) :: strt(:), cnt(:) - real(r8), intent(out):: loc_arr(:,:,:) - type (trfile), intent(in) :: file - !! - real(r8), allocatable, target :: wrk(:) - real(r8), pointer :: wrk_in(:) - real(r8) :: wrk_out(pcols) - type(interp_type) :: lat_wgts - real(r8) :: to_lats(pcols), to_lons(pcols) - integer :: c, k, ierr, ncols - integer :: cnt_srf(2) - integer :: strt_srf(2) - !! - nullify(wrk_in) - allocate( wrk(cnt(1)), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'read_zasrf_trc_linoz: wrk allocation error = ',ierr - call endrun - end if - !! - cnt_srf(1)=cnt(1) - cnt_srf(2)=cnt(3) - strt_srf(1)=strt(1) - strt_srf(2)=strt(3) - !! - !for surface variable with the dimension of (time,lat) or (time,1) - !for (time) it is also set like (time,1) - ierr = pio_get_var( fid, vid, strt_srf, cnt_srf, wrk ) - !! - if(associated(wrk_in)) then - wrk_in = reshape( wrk(:),(/file%nlat/)) - deallocate(wrk) - else - wrk_in => wrk - end if - !! - do c=begchunk,endchunk - ncols = get_ncols_p(c) - call get_rlat_all_p(c, pcols, to_lats) - call lininterp_init(file%lats, file%nlat, to_lats, ncols, 1, lat_wgts) - !! - if (cnt(1).eq.1) then!!for single timeseries - do k=1,1 - loc_arr(1:ncols,k,c-begchunk+1) = wrk_in(1) - end do - else - do k=1,1 - call lininterp(wrk_in(:), file%nlat, wrk_out(1:ncols), ncols, lat_wgts) - loc_arr(1:ncols,k,c-begchunk+1) = wrk_out(1:ncols) - end do - end if - !! - call lininterp_finish(lat_wgts) - end do - !! - if(allocated(wrk)) then - deallocate(wrk) - else - deallocate(wrk_in) - end if - !! - end subroutine read_zasrf_trc_linoz - -!------------------------------------------------------------------------ - - subroutine read_3d_trc( fid, vid, loc_arr, strt, cnt, file, order) - use interpolate_data, only : lininterp_init, lininterp, interp_type, lininterp_finish - use phys_grid, only : pcols, begchunk, endchunk, get_ncols_p, get_rlat_all_p, get_rlon_all_p, get_lon_all_p,& - get_lat_all_p - use mo_constants, only : pi - use dycore, only : dycore_is - use polar_avg, only : polar_average - use dycore, only : dycore_is - use horizontal_interpolate, only : xy_interp - - implicit none - - type(file_desc_t), intent(in) :: fid - type(var_desc_t), intent(in) :: vid - integer, intent(in) :: strt(:), cnt(:), order(3) - real(r8),intent(out) :: loc_arr(:,:,:) - - type (trfile), intent(in) :: file - - integer :: i,j,k, astat, c, ncols - integer :: lons(pcols), lats(pcols) - - integer :: jlim(2), jl, ju, ierr - integer :: gndx - - real(r8), allocatable, target :: wrk3d(:,:,:) - real(r8), pointer :: wrk3d_in(:,:,:) - real(r8) :: to_lons(pcols), to_lats(pcols) - real(r8), parameter :: zero=0_r8, twopi=2_r8*pi - type(interp_type) :: lon_wgts, lat_wgts - - loc_arr(:,:,:) = 0._r8 - nullify(wrk3d_in) - allocate(wrk3d(cnt(1),cnt(2),cnt(3)), stat=ierr) - if( ierr /= 0 ) then - write(iulog,*) 'read_3d_trc: wrk3d allocation error = ',ierr - call endrun - end if - - ierr = pio_get_var( fid, vid, strt, cnt, wrk3d ) - - if(order(1)/=1 .or. order(2)/=2 .or. order(3)/=3 .or. & - cnt(1)/=file%nlon.or.cnt(2)/=file%nlat.or.cnt(3)/=file%nlev) then - allocate(wrk3d_in(file%nlon,file%nlat,file%nlev),stat=ierr) - if( ierr /= 0 ) then - write(iulog,*) 'read_3d_trc: wrk3d allocation error = ',ierr - call endrun - end if - wrk3d_in = reshape( wrk3d(:,:,:),(/file%nlon,file%nlat,file%nlev/), order=order ) - deallocate(wrk3d) - else - wrk3d_in => wrk3d - end if - - j=1 - -! If weighting by latitude, then perform horizontal interpolation by using weight_x, weight_y - - if(file%weight_by_lat) then - - call t_startf('xy_interp') - - do c = begchunk,endchunk - ncols = get_ncols_p(c) - call get_lon_all_p(c,ncols,lons) - call get_lat_all_p(c,ncols,lats) - - call xy_interp(file%nlon,file%nlat,file%nlev,plon,plat,pcols,ncols,file%weight_x,file%weight_y,wrk3d_in, & - loc_arr(:,:,c-begchunk+1), lons,lats,file%count_x,file%count_y,file%index_x,file%index_y) - enddo - - call t_stopf('xy_interp') - - else - do c=begchunk,endchunk - ncols = get_ncols_p(c) - call get_rlat_all_p(c, pcols, to_lats) - call get_rlon_all_p(c, pcols, to_lons) - - call lininterp_init(file%lons, file%nlon, to_lons(1:ncols), ncols, 2, lon_wgts, zero, twopi) - call lininterp_init(file%lats, file%nlat, to_lats(1:ncols), ncols, 1, lat_wgts) - - - call lininterp(wrk3d_in, file%nlon, file%nlat, file%nlev, loc_arr(:,:,c-begchunk+1), ncols, pcols, lon_wgts, lat_wgts) - - - call lininterp_finish(lon_wgts) - call lininterp_finish(lat_wgts) - end do - endif - - if(allocated(wrk3d)) then - deallocate( wrk3d, stat=astat ) - else - deallocate( wrk3d_in, stat=astat ) - end if - if( astat/= 0 ) then - write(iulog,*) 'read_3d_trc: failed to deallocate wrk3d array; error = ',astat - call endrun - endif - if(dycore_is('LR')) call polar_average(file%nlev, loc_arr) - end subroutine read_3d_trc - -!------------------------------------------------------------------------------ - - subroutine interpolate_trcdata( state, flds, file, pbuf2d ) - use mo_util, only : rebin - use physics_types,only : physics_state - use physconst, only : cday - use physics_buffer, only : physics_buffer_desc, pbuf_get_field - - implicit none - - type(physics_state), intent(in) :: state(begchunk:endchunk) - type (trfld), intent(inout) :: flds(:) - type (trfile), intent(inout) :: file - - type(physics_buffer_desc), optional, pointer :: pbuf2d(:,:) - - - real(r8) :: fact1, fact2 - real(r8) :: deltat - integer :: f,nflds,c,ncol, i,k - real(r8) :: ps(pcols) - real(r8) :: datain(pcols,file%nlev) - real(r8) :: pin(pcols,file%nlev) - real(r8) :: pint(pcols,file%nilev) - - real(r8) :: model_z(pverp) - real(r8), parameter :: m2km = 1.e-3_r8 - real(r8), pointer :: data_out3d(:,:,:) - real(r8), pointer :: data_out(:,:) - integer :: chnk_offset - - nflds = size(flds) - - if ( file%interp_recs == 4 ) then - deltat = file%datatimes(3) - file%datatimes(1) - fact1 = (file%datatimes(3) - file%datatimem)/deltat - fact2 = 1._r8-fact1 -!$OMP PARALLEL DO PRIVATE (C, NCOL, F) - do c = begchunk,endchunk - ncol = state(c)%ncol - if ( file%has_ps ) then - file%ps_in(1)%data(:ncol,c) = fact1*file%ps_in(1)%data(:ncol,c) + fact2*file%ps_in(3)%data(:ncol,c) - endif - do f = 1,nflds - flds(f)%input(1)%data(:ncol,:,c) = fact1*flds(f)%input(1)%data(:ncol,:,c) + fact2*flds(f)%input(3)%data(:ncol,:,c) - enddo - enddo - - deltat = file%datatimes(4) - file%datatimes(2) - fact1 = (file%datatimes(4) - file%datatimep)/deltat - fact2 = 1._r8-fact1 - -!$OMP PARALLEL DO PRIVATE (C, NCOL, F) - do c = begchunk,endchunk - ncol = state(c)%ncol - if ( file%has_ps ) then - file%ps_in(2)%data(:ncol,c) = fact1*file%ps_in(2)%data(:ncol,c) + fact2*file%ps_in(4)%data(:ncol,c) - endif - do f = 1,nflds - flds(f)%input(2)%data(:ncol,:,c) = fact1*flds(f)%input(2)%data(:ncol,:,c) + fact2*flds(f)%input(4)%data(:ncol,:,c) - enddo - enddo - - endif - !------------------------------------------------------------------------- - ! If file%interp_recs=1 then no time interpolation -- set - ! fact1=1 and fact2=0 and will just use first value unmodified - !------------------------------------------------------------------------- - - if (file%interp_recs == 1) then - fact1=1._r8 - fact2=0._r8 - else - file%interp_recs = 2 - - deltat = file%datatimep - file%datatimem - - if ( file%cyclical .and. (deltat < 0._r8) ) then - deltat = deltat+file%one_yr - if ( file%datatimep >= file%curr_mod_time ) then - fact1 = (file%datatimep - file%curr_mod_time)/deltat - else - fact1 = (file%datatimep+file%one_yr - file%curr_mod_time)/deltat - endif - else - fact1 = (file%datatimep - file%curr_mod_time)/deltat - endif - - ! this assures that FIXED data are b4b on restarts - if ( file%fixed ) then - fact1 = dble(int(fact1*cday+.5_r8))/dble(cday) - endif - fact2 = 1._r8-fact1 - endif - - chnk_offset=-begchunk+1 - - fld_loop: do f = 1,nflds - - if (flds(f)%pbuf_ndx<=0) then - data_out3d => flds(f)%data(:,:,:) - endif - -!$OMP PARALLEL DO PRIVATE (C, NCOL, PS, I, K, PIN, DATAIN, MODEL_Z, DATA_OUT) - do c = begchunk,endchunk - if (flds(f)%pbuf_ndx>0) then - if(.not.present(pbuf2d)) then - call endrun ('tracer_data.F90(subr interpolate_trcdata):' // & - 'pbuf2d must be passed as an argument for pbuf_get_field subr call') - endif - call pbuf_get_field(pbuf2d, c, flds(f)%pbuf_ndx, data_out) - else - data_out => data_out3d(:,:,c+chnk_offset) - endif - ncol = state(c)%ncol - if (file%alt_data) then - - if (fact2 == 0) then ! This needed as %data is not set if fact2=0 (and lahey compiler core dumps) - datain(:ncol,:) = fact1*flds(f)%input(nm)%data(:ncol,:,c) - else - datain(:ncol,:) = fact1*flds(f)%input(nm)%data(:ncol,:,c) + fact2*flds(f)%input(np)%data(:ncol,:,c) - end if - do i = 1,ncol - model_z(1:pverp) = m2km * state(c)%zi(i,pverp:1:-1) - call rebin( file%nlev, pver, file%ilevs, model_z, datain(i,:), data_out(i,:) ) - enddo - - else - - if ( file%nlev>1 ) then - if ( file%has_ps ) then - if (fact2 == 0) then ! This needed as %data is not set if fact2=0 (and lahey compiler core dumps) - ps(:ncol) = fact1*file%ps_in(nm)%data(:ncol,c) - else - ps(:ncol) = fact1*file%ps_in(nm)%data(:ncol,c) + fact2*file%ps_in(np)%data(:ncol,c) - end if - do i = 1,ncol - do k = 1,file%nlev - pin(i,k) = file%p0*file%hyam(k) + ps(i)*file%hybm(k) - enddo - enddo - else - do k = 1,file%nlev - pin(:,k) = file%levs(k) - enddo - !!Currently designed for linoz_v2/v3 use - if (file%linoz_v3 .or. file%linoz_v2) then - do k = 1,file%nilev - pint(:,k) = file%ilevs(k) - enddo - endif - endif - endif - - if (flds(f)%srf_fld) then - do i = 1,ncol - if (fact2 == 0) then ! This needed as %data is not set if fact2=0 (and lahey compiler core dumps) - data_out(i,1) = & - fact1*flds(f)%input(nm)%data(i,1,c) - else - data_out(i,1) = & - fact1*flds(f)%input(nm)%data(i,1,c) + fact2*flds(f)%input(np)%data(i,1,c) - endif - enddo - else - if (fact2 == 0) then ! This needed as %data is not set if fact2=0 (and lahey compiler core dumps) - datain(:ncol,:) = fact1*flds(f)%input(nm)%data(:ncol,:,c) - else - datain(:ncol,:) = fact1*flds(f)%input(nm)%data(:ncol,:,c) + fact2*flds(f)%input(np)%data(:ncol,:,c) - end if - if ( file%top_bndry ) then - call vert_interp_ub(ncol, file%nlev, file%levs, datain(:ncol,:), data_out(:ncol,:) ) - else if(file%conserve_column) then - call vert_interp_mixrat(ncol,file%nlev,pver,state(c)%pint, & - datain, data_out(:,:), & - file%p0,ps,file%hyai,file%hybi) - else if(file%linoz_v3 .or. file%linoz_v2) then - !!uci chemistry for linoz that better conserves mass - !!uci interpolation for 55 out of 57 variables in linoz_v3 - !!excluding t_clim, o3col_clim - !!for linoz_v2 it is simiar with less variables - if (flds(f)%fldnam.ne.'t_clim ' & - .and.flds(f)%fldnam.ne.'o3col_clim ') then - !!file ilevs is in hPa, while model level in Pa, so times 100 - call vert_interp_uci(ncol, file%nlev, 100*file%ilevs, state(c)%pint, datain, data_out(:,:) ) - else - call vert_interp(ncol, file%nlev, pin, state(c)%pmid, datain, data_out(:,:) ) - endif - !! - else - call vert_interp(ncol, file%nlev, pin, state(c)%pmid, datain, data_out(:,:) ) - endif - endif - - endif - enddo - - enddo fld_loop - - end subroutine interpolate_trcdata - -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- - subroutine get_dimension( fid, dname, dsize, dimid, data ) - implicit none - type(file_desc_t), intent(inout) :: fid - character(*), intent(in) :: dname - integer, intent(out) :: dsize - - integer, optional, intent(out) :: dimid - real(r8), optional, pointer, dimension(:) :: data - - integer :: vid, ierr, id - - call pio_seterrorhandling( fid, PIO_BCAST_ERROR) - ierr = pio_inq_dimid( fid, dname, id ) - call pio_seterrorhandling( fid, PIO_INTERNAL_ERROR) - - if ( ierr==PIO_NOERR ) then - - ierr = pio_inq_dimlen( fid, id, dsize ) - - if ( present(dimid) ) then - dimid = id - endif - - if ( present(data) ) then - if ( associated(data) ) then - deallocate(data, stat=ierr) - if( ierr /= 0 ) then - write(iulog,*) 'get_dimension: data deallocation error = ',ierr - call endrun('get_dimension: failed to deallocate data array') - end if - endif - allocate( data(dsize), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'get_dimension: data allocation error = ',ierr - call endrun('get_dimension: failed to allocate data array') - end if - - ierr = pio_inq_varid( fid, dname, vid ) - ierr = pio_get_var( fid, vid, data ) - endif - else - dsize = 1 - if ( present(dimid) ) then - dimid = -1 - endif - endif - - end subroutine get_dimension - -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- - subroutine set_cycle_indices( fileid, cyc_ndx_beg, cyc_ndx_end, cyc_yr ) - - implicit none - - type(file_desc_t), intent(inout) :: fileid - integer, intent(out) :: cyc_ndx_beg - integer, intent(out) :: cyc_ndx_end - integer, intent(in) :: cyc_yr - - integer, allocatable , dimension(:) :: dates, datesecs - integer :: timesize, i, astat, year, ierr - type(var_desc_T) :: dateid - call get_dimension( fileid, 'time', timesize ) - cyc_ndx_beg=-1 - - allocate( dates(timesize), stat=astat ) - if( astat/= 0 ) then - write(*,*) 'set_cycle_indices: failed to allocate dates array; error = ',astat - call endrun - end if - - ierr = pio_inq_varid( fileid, 'date', dateid ) - ierr = pio_get_var( fileid, dateid, dates ) - - do i=1,timesize - year = dates(i) / 10000 - if ( year == cyc_yr ) then - if (cyc_ndx_beg < 0) then - cyc_ndx_beg = i - endif - cyc_ndx_end = i - endif - enddo - deallocate( dates, stat=astat ) - if( astat/= 0 ) then - write(*,*) 'set_cycle_indices: failed to deallocate dates array; error = ',astat - call endrun - end if - if (cyc_ndx_beg < 0) then - write(*,*) 'set_cycle_indices: cycle year not found : ' , cyc_yr - call endrun('set_cycle_indices: cycle year not found') - endif - - end subroutine set_cycle_indices -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- - subroutine open_trc_datafile( fname, path, piofile, times, cyc_ndx_beg, cyc_ndx_end, cyc_yr ) - - use ioFileMod, only: getfil - use cam_pio_utils, only: cam_pio_openfile - - implicit none - - character(*), intent(in) :: fname - character(*), intent(in) :: path - type(file_desc_t), intent(inout) :: piofile - real(r8), pointer :: times(:) - - integer, optional, intent(out) :: cyc_ndx_beg - integer, optional, intent(out) :: cyc_ndx_end - integer, optional, intent(in) :: cyc_yr - - character(len=shr_kind_cl) :: filen, filepath - integer :: year, month, day, dsize, i, timesize - integer :: dateid,secid - integer, allocatable , dimension(:) :: dates, datesecs - integer :: astat, ierr - logical :: need_first_ndx - - if (len_trim(path) == 0) then - filepath = trim(fname) - else - filepath = trim(path) // '/' // trim(fname) - end if - ! - ! open file and get fileid - ! - call getfil( filepath, filen, 0 ) - call cam_pio_openfile( piofile, filen, PIO_NOWRITE) - if(masterproc) write(iulog,*)'open_trc_datafile: ',trim(filen) - - call get_dimension(piofile, 'time', timesize) - - if ( associated(times) ) then - deallocate(times, stat=ierr) - if( ierr /= 0 ) then - write(iulog,*) 'open_trc_datafile: data deallocation error = ',ierr - call endrun('open_trc_datafile: failed to deallocate data array') - end if - endif - allocate( times(timesize), stat=ierr ) - if( ierr /= 0 ) then - write(iulog,*) 'open_trc_datafile: data allocation error = ',ierr - call endrun('open_trc_datafile: failed to allocate data array') - end if - - allocate( dates(timesize), stat=astat ) - if( astat/= 0 ) then - if(masterproc) write(iulog,*) 'open_trc_datafile: failed to allocate dates array; error = ',astat - call endrun - end if - allocate( datesecs(timesize), stat=astat ) - if( astat/= 0 ) then - if(masterproc) write(iulog,*) 'open_trc_datafile: failed to allocate datesec array; error = ',astat - call endrun - end if - - ierr = pio_inq_varid( piofile, 'date', dateid ) - call pio_seterrorhandling( piofile, PIO_BCAST_ERROR) - ierr = pio_inq_varid( piofile, 'datesec', secid ) - call pio_seterrorhandling( piofile, PIO_INTERNAL_ERROR) - - if(ierr==PIO_NOERR) then - ierr = pio_get_var( piofile, secid, datesecs ) - else - datesecs=0 - end if - - ierr = pio_get_var( piofile, dateid, dates ) - need_first_ndx=.true. - - do i=1,timesize - year = dates(i) / 10000 - month = mod(dates(i),10000)/100 - day = mod(dates(i),100) - call set_time_float_from_date( times(i), year, month, day, datesecs(i) ) - if ( present(cyc_yr) ) then - if ( year == cyc_yr ) then - if ( present(cyc_ndx_beg) .and. need_first_ndx ) then - cyc_ndx_beg = i - need_first_ndx = .false. - endif - if ( present(cyc_ndx_end) ) then - cyc_ndx_end = i - endif - endif - endif - enddo - - deallocate( dates, stat=astat ) - if( astat/= 0 ) then - if(masterproc) write(iulog,*) 'open_trc_datafile: failed to deallocate dates array; error = ',astat - call endrun - end if - deallocate( datesecs, stat=astat ) - if( astat/= 0 ) then - if(masterproc) write(iulog,*) 'open_trc_datafile: failed to deallocate datesec array; error = ',astat - call endrun - end if - - if ( present(cyc_yr) .and. present(cyc_ndx_beg) ) then - if (cyc_ndx_beg < 0) then - write(iulog,*) 'open_trc_datafile: cycle year not found : ' , cyc_yr - call endrun('open_trc_datafile: cycle year not found') - endif - endif - - end subroutine open_trc_datafile - -!-------------------------------------------------------------------------- -!-------------------------------------------------------------------------- - subroutine specify_fields( specifier, fields ) - - implicit none - - character(len=*), intent(in) :: specifier(:) - type(trfld), pointer, dimension(:) :: fields - - integer :: fld_cnt, astat - integer :: i,j - character(len=shr_kind_cl) :: str1, str2 - character(len=32), allocatable, dimension(:) :: fld_name, src_name - integer :: nflds - - nflds = size(specifier) - - allocate(fld_name(nflds), src_name(nflds), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'specify_fields: failed to allocate fld_name, src_name arrays; error = ',astat - call endrun - end if - - fld_cnt = 0 - - count_cnst: do i = 1, nflds - - if ( len_trim( specifier(i) ) == 0 ) then - exit count_cnst - endif - - j = scan( specifier(i),':') - - if (j > 0) then - str1 = trim(adjustl( specifier(i)(:j-1) )) - str2 = trim(adjustl( specifier(i)(j+1:) )) - fld_name(i) = trim(adjustl( str1 )) - src_name(i) = trim(adjustl( str2 )) - else - fld_name(i) = trim(adjustl( specifier(i) )) - src_name(i) = trim(adjustl( specifier(i) )) - endif - - fld_cnt = fld_cnt + 1 - - enddo count_cnst - - if( fld_cnt < 1 ) then - nullify(fields) - return - end if - - !----------------------------------------------------------------------- - ! ... allocate field type array - !----------------------------------------------------------------------- - allocate( fields(fld_cnt), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'specify_fields: failed to allocate fields array; error = ',astat - call endrun - end if - - do i = 1,fld_cnt - fields(i)%fldnam = fld_name(i) - fields(i)%srcnam = src_name(i) - enddo - - deallocate(fld_name, src_name) - - end subroutine specify_fields - -!------------------------------------------------------------------------------ - - subroutine init_trc_restart( whence, piofile, tr_file ) - - implicit none - character(len=*), intent(in) :: whence - type(file_desc_t), intent(inout) :: piofile - type(trfile), intent(inout) :: tr_file - - character(len=32) :: name - integer :: ioerr, mcdimid, maxlen - - - ! Dimension should already be defined in restart file - call pio_seterrorhandling(pioFile, PIO_BCAST_ERROR) - ioerr = pio_inq_dimid(pioFile,'max_chars', mcdimid) - call pio_seterrorhandling(pioFile, PIO_INTERNAL_ERROR) - ! but define it if nessasary - if(ioerr/= PIO_NOERR) then - ioerr = pio_def_dim(pioFile, 'max_chars', SHR_KIND_CL, mcdimid) - end if - - if(len_trim(tr_file%curr_filename)>1) then - allocate(tr_file%currfnameid) - name = trim(whence)//'_curr_fname' - ioerr = pio_def_var(pioFile, name,pio_char, (/mcdimid/), tr_file%currfnameid) - ioerr = pio_put_att(pioFile, tr_file%currfnameid, 'offset_time', tr_file%offset_time) - maxlen = len_trim(tr_file%curr_filename) - ioerr = pio_put_att(pioFile, tr_file%currfnameid, 'actual_len', maxlen) - else - nullify(tr_file%currfnameid) - end if - - if(len_trim(tr_file%next_filename)>1) then - allocate(tr_file%nextfnameid) - name = trim(whence)//'_next_fname' - ioerr = pio_def_var(pioFile, name,pio_char, (/mcdimid/), tr_file%nextfnameid) - maxlen = len_trim(tr_file%next_filename) - ioerr = pio_put_att(pioFile, tr_file%nextfnameid, 'actual_len', maxlen) - else - nullify(tr_file%nextfnameid) - end if - end subroutine init_trc_restart -!------------------------------------------------------------------------- -! writes file names to restart file -!------------------------------------------------------------------------- - subroutine write_trc_restart( piofile, tr_file ) - - implicit none - - type(file_desc_t), intent(inout) :: piofile - type(trfile), intent(inout) :: tr_file - - integer :: ioerr, slen ! error status - if(associated(tr_file%currfnameid)) then - ioerr = pio_put_var(pioFile, tr_file%currfnameid, tr_file%curr_filename) - deallocate(tr_file%currfnameid) - nullify(tr_file%currfnameid) - end if - if(associated(tr_file%nextfnameid)) then - ioerr = pio_put_var(pioFile, tr_file%nextfnameid, tr_file%next_filename) - deallocate(tr_file%nextfnameid) - nullify(tr_file%nextfnameid) - end if - end subroutine write_trc_restart - -!------------------------------------------------------------------------- -! reads file names from restart file -!------------------------------------------------------------------------- - subroutine read_trc_restart( whence, piofile, tr_file ) - - implicit none - - character(len=*), intent(in) :: whence - type(file_desc_t), intent(inout) :: piofile - type(trfile), intent(inout) :: tr_file - type(var_desc_t) :: vdesc - character(len=64) :: name - integer :: ioerr ! error status - integer :: slen - - call PIO_SetErrorHandling(piofile, PIO_BCAST_ERROR) - name = trim(whence)//'_curr_fname' - ioerr = pio_inq_varid(piofile, name, vdesc) - if(ioerr==PIO_NOERR) then - tr_file%curr_filename=' ' - ioerr = pio_get_att(piofile, vdesc, 'offset_time', tr_file%offset_time) - ioerr = pio_get_att(piofile, vdesc, 'actual_len', slen) - ioerr = pio_get_var(piofile, vdesc, tr_file%curr_filename) - if(slen P2 (decreasing up) -!--- integrates (p-avg) the value F0 from F on the grid P -!--- assumes model pressure increases from top to bottom. -!---NOTE reverse order in P's -!---Assume that the quantity is constant over range halfway to layer above/below -!--- and calculate box edges from model top to model bottom -! -!---For a model level between pressure range P1 > P2 (decreasing up) -!---calculate the SOM Z-moments of the loss freq at std z* (log-p) intervals -!-------- the pressure levels BETWEEN z* values are: -! P(i) < P(i+1) bounds z*(i) -!-------- The MOMENTS for a square-wave or 'bar': F(x)=F0 b<=x<=c, =0.0 else -!----- S0 = f0 (x) [from x=b to x=c] -!----------------------------------------------------------------------- - implicit none - integer, intent(in) :: NL - real(r8), intent(in) :: P1,P2,P(NL+1),F(NL) - real(r8), intent(out):: F0 - integer I - real(r8) XB,XC,PC,PB,SGNF0,PF1,PF2 -!----------------------------------------------------------------------- - F0 = 0._r8 - ! - do I = 1,NL - PF1=P(I) - PF2=P(I+1) - ! - PC = min(P1,PF2) - PB = max(P2,PF1) - ! - if (PC .gt. PB) then -!--- have condition: P1 .ge. PC .gt. PB .ge. P2 -!--- and 0 .le. XB .lt. XC .le. 1 - XC = (PC-P2)/(P1-P2) - XB = (PB-P2)/(P1-P2) -!-------- assume that the quantity, F, is constant over interval [XLO,XUP], -!-------- F0: (c-b), -!-------- calculate its contribution to the moments in the interval [0,1] - F0 = F0 +F(I) *(XC -XB) - endif - enddo -!---limiter on Z-moments: force monotonicity (tables can be + or -) - SGNF0 = sign(1._r8, F0) - F0 = abs(F0) - F0 = SGNF0 * F0 - END SUBROUTINE vert_interp_uci_single -!------------------------------------------------------------------------------ - subroutine vert_interp_ub( ncol, nlevs, plevs, datain, dataout ) - use ref_pres, only : ptop_ref - - - !----------------------------------------------------------------------- - ! - ! Interpolate data from current time-interpolated values to top interface pressure - ! -- from mo_tgcm_ubc.F90 - !-------------------------------------------------------------------------- - implicit none - ! Arguments - ! - integer, intent(in) :: ncol - integer, intent(in) :: nlevs - real(r8), intent(in) :: plevs(nlevs) - real(r8), intent(in) :: datain(ncol,nlevs) - real(r8), intent(out) :: dataout(ncol) - - ! - ! local variables - ! - integer :: i,ku,kl,kk - real(r8) :: pinterp, delp - - pinterp = ptop_ref - - if( pinterp <= plevs(1) ) then - kl = 1 - ku = 1 - delp = 0._r8 - else if( pinterp >= plevs(nlevs) ) then - kl = nlevs - ku = nlevs - delp = 0._r8 - else - - do kk = 2,nlevs - if( pinterp <= plevs(kk) ) then - ku = kk - kl = kk - 1 - delp = log( pinterp/plevs(kk) ) / log( plevs(kk-1)/plevs(kk) ) - exit - end if - end do - - end if - - do i = 1,ncol - dataout(i) = datain(i,kl) + delp * (datain(i,ku) - datain(i,kl)) - end do - - end subroutine vert_interp_ub -!------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------ -!------------------------------------------------------------------------------ - subroutine advance_file(file) - - !------------------------------------------------------------------------------ - ! This routine advances to the next file - !------------------------------------------------------------------------------ - - use shr_sys_mod, only: shr_sys_system - use ioFileMod, only: getfil - - implicit none - - type(trfile), intent(inout) :: file - - !----------------------------------------------------------------------- - ! local variables - !----------------------------------------------------------------------- - character(len=shr_kind_cl) :: ctmp - character(len=shr_kind_cl) :: loc_fname - integer :: istat, astat - - !----------------------------------------------------------------------- - ! close current file ... - !----------------------------------------------------------------------- - call pio_closefile( file%curr_fileid ) - - !----------------------------------------------------------------------- - ! remove if requested - !----------------------------------------------------------------------- - if( file%remove_trc_file ) then - call getfil( file%curr_filename, loc_fname, 0 ) - write(iulog,*) 'advance_file: removing file = ',trim(loc_fname) - ctmp = 'rm -f ' // trim(loc_fname) - write(iulog,*) 'advance_file: fsystem issuing command - ' - write(iulog,*) trim(ctmp) - call shr_sys_system( ctmp, istat ) - end if - - !----------------------------------------------------------------------- - ! Advance the filename and file id - !----------------------------------------------------------------------- - file%curr_filename = file%next_filename - file%curr_fileid = file%next_fileid - - !----------------------------------------------------------------------- - ! Advance the curr_data_times - !----------------------------------------------------------------------- - deallocate( file%curr_data_times, stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'advance_file: failed to deallocate file%curr_data_times array; error = ',astat - call endrun - end if - allocate( file%curr_data_times( size( file%next_data_times ) ), stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'advance_file: failed to allocate file%curr_data_times array; error = ',astat - call endrun - end if - file%curr_data_times(:) = file%next_data_times(:) - - !----------------------------------------------------------------------- - ! delete information about next file (as was just assigned to current) - !----------------------------------------------------------------------- - file%next_filename = '' - - deallocate( file%next_data_times, stat=astat ) - if( astat/= 0 ) then - write(iulog,*) 'advance_file: failed to deallocate file%next_data_times array; error = ',astat - call endrun - end if - nullify( file%next_data_times ) - - end subroutine advance_file - -end module tracer_data From 9bb98d766f8cb6e44e40805ad7c856ad6c0861b2 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Wed, 28 Aug 2024 22:45:09 -0500 Subject: [PATCH 134/197] Add ext_frc_volc_type to use_cases having only volcanic SO2 varying over years --- .../use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml | 1 + .../use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml | 1 + .../20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml | 1 + .../use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml | 1 + 4 files changed, 4 insertions(+) diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml index 94cdfc6d000..493affd9641 100644 --- a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-nat_chemUCI-Linoz-mam5-vbs.xml @@ -22,6 +22,7 @@ +INTERP_MISSING_MONTHS CYCLICAL 1850 atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml index 6f075442359..83d4c4d9271 100644 --- a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-volc_chemUCI-Linoz-mam5-vbs.xml @@ -23,6 +23,7 @@ +INTERP_MISSING_MONTHS CYCLICAL 1850 atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml index f70010a82c4..671eb826ef1 100644 --- a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xGHG-xaer_chemUCI-Linoz-mam5-vbs.xml @@ -22,6 +22,7 @@ +INTERP_MISSING_MONTHS CYCLICAL 1850 atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc diff --git a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml index 359a292e9e1..8dd525d7e5d 100644 --- a/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml +++ b/components/eam/bld/namelist_files/use_cases/20TR_eam_CMIP6-xaer_chemUCI-Linoz-mam5-vbs.xml @@ -19,6 +19,7 @@ +INTERP_MISSING_MONTHS CYCLICAL 1850 atm/cam/chem/trop_mozart_aero/emis/chem_gases/2degrees/emissions-cmip6_NO2_aircraft_vertical_1750-2015_1.9x2.5_c20170608.nc From 04872f3350c20c5e10faf14785c11d647f6bbe12 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Fri, 30 Aug 2024 03:00:57 +0000 Subject: [PATCH 135/197] Update Aurora machine config --- cime_config/allactive/config_pesall.xml | 8 ++-- .../cmake_macros/oneapi-ifxgpu_aurora.cmake | 1 - cime_config/machines/config_batch.xml | 2 +- cime_config/machines/config_machines.xml | 47 +++++++++---------- .../eamxx/cmake/machine-files/aurora.cmake | 14 ++++++ 5 files changed, 41 insertions(+), 31 deletions(-) create mode 100644 components/eamxx/cmake/machine-files/aurora.cmake diff --git a/cime_config/allactive/config_pesall.xml b/cime_config/allactive/config_pesall.xml index 84c0e24d8c9..3392ad71ca1 100644 --- a/cime_config/allactive/config_pesall.xml +++ b/cime_config/allactive/config_pesall.xml @@ -1472,9 +1472,9 @@ - + - sunspot: --compset BGC* --res ne30pg2_r05_IcoswISC30E3r5 on 2 nodes pure-MPI + sunspot|aurora: --compset BGC* --res ne30pg2_r05_IcoswISC30E3r5 on 2 nodes pure-MPI -2 -2 @@ -1759,9 +1759,9 @@ - + - allactive+sunspot: default, 96 mpi x 1 omp @ root 0 + allactive+sunspot|aurora: default, 96 mpi x 1 omp @ root 0 96 96 diff --git a/cime_config/machines/cmake_macros/oneapi-ifxgpu_aurora.cmake b/cime_config/machines/cmake_macros/oneapi-ifxgpu_aurora.cmake index 16288ce4dee..6835515164f 100644 --- a/cime_config/machines/cmake_macros/oneapi-ifxgpu_aurora.cmake +++ b/cime_config/machines/cmake_macros/oneapi-ifxgpu_aurora.cmake @@ -3,6 +3,5 @@ string(APPEND CMAKE_EXE_LINKER_FLAGS " -lmkl_intel_lp64 -lmkl_sequential -lmkl_c if (compile_threaded) string(APPEND CMAKE_EXE_LINKER_FLAGS " -fiopenmp -fopenmp-targets=spir64") endif() -string(APPEND KOKKOS_OPTIONS " -DCMAKE_CXX_STANDARD=17 -DKokkos_ENABLE_SERIAL=On -DKokkos_ARCH_INTEL_PVC=On -DKokkos_ENABLE_SYCL=On -DKokkos_ENABLE_EXPLICIT_INSTANTIATION=Off") string(APPEND SYCL_FLAGS " -\-intel -fsycl -fsycl-targets=spir64_gen -mlong-double-64 -Xsycl-target-backend \"-device 12.60.7\"") string(APPEND CMAKE_CXX_FLAGS " -Xclang -fsycl-allow-virtual-functions") diff --git a/cime_config/machines/config_batch.xml b/cime_config/machines/config_batch.xml index 448eefece21..13cfdfb337b 100644 --- a/cime_config/machines/config_batch.xml +++ b/cime_config/machines/config_batch.xml @@ -562,7 +562,7 @@ - /lus/gecko/projects/CSC249ADSE15_CNDA/tools/qsub/throttle + /lus/flare/projects/CSC249ADSE15_CNDA/tools/qsub/throttle EarlyAppAccess workq-route diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index fed0110bc32..f1bed254da4 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3474,14 +3474,14 @@ oneapi-ifx,oneapi-ifxgpu,gnu mpich CSC249ADSE15_CNDA - /lus/gecko/projects/CSC249ADSE15_CNDA/performance_archive + /lus/flare/projects/CSC249ADSE15_CNDA/performance_archive .* - /lus/gecko/projects/CSC249ADSE15_CNDA/$USER/scratch - /lus/gecko/projects/CSC249ADSE15_CNDA/inputdata - /lus/gecko/projects/CSC249ADSE15_CNDA/inputdata/atm/datm7 + /lus/flare/projects/CSC249ADSE15_CNDA/$USER/scratch + /lus/flare/projects/CSC249ADSE15_CNDA/inputdata + /lus/flare/projects/CSC249ADSE15_CNDA/inputdata/atm/datm7 $CIME_OUTPUT_ROOT/archive/$CASE - /lus/gecko/projects/CSC249ADSE15_CNDA/baselines/$COMPILER - /lus/gecko/projects/CSC249ADSE15_CNDA/tools/cprnc/cprnc + /lus/flare/projects/CSC249ADSE15_CNDA/baselines/$COMPILER + /lus/flare/projects/CSC249ADSE15_CNDA/tools/cprnc/cprnc 16 e3sm_developer 4 @@ -3490,7 +3490,7 @@ 208 104 104 - 12 + 48 FALSE mpiexec @@ -3498,46 +3498,40 @@ -np {{ total_tasks }} --label -ppn {{ tasks_per_node }} - --cpu-bind $ENV{RANKS_BIND} -envall + --cpu-bind depth -envall -d $ENV{OMP_NUM_THREADS} $ENV{GPU_TILE_COMPACT} - /lus/gecko/projects/CSC249ADSE15_CNDA/modules/lmod.sh + /lus/flare/projects/CSC249ADSE15_CNDA/modules/lmod.sh /soft/sunspot_migrate/soft/packaging/lmod/lmod/init/csh /soft/sunspot_migrate/soft/packaging/lmod/lmod/init/env_modules_python.py module module /soft/sunspot_migrate/soft/packaging/lmod/lmod/libexec/lmod python - - /soft/modulefiles - /soft/restricted/CNDA/updates/modulefiles - spack-pe-gcc cmake + cmake - oneapi/eng-compiler/2023.05.15.007 + oneapi/eng-compiler/2024.04.15.002 + + + kokkos/git.7ff87a5-omp-sycl spack-pe-gcc cmake gcc/10.3.0 - - cray-pals - libfabric/1.15.2.0 - cray-libpals/1.3.2 - $CIME_OUTPUT_ROOT/$CASE/run $CIME_OUTPUT_ROOT/$CASE/bld - /lus/gecko/projects/CSC249ADSE15_CNDA/software/netcdf-c/4.9.2/oneapi.eng.2023.05.15.007 - /lus/gecko/projects/CSC249ADSE15_CNDA/software/netcdf-fortran/4.6.1/oneapi.eng.2023.05.15.007 - /lus/gecko/projects/CSC249ADSE15_CNDA/software/pnetcdf/1.12.3/oneapi.eng.2023.05.15.007 - /lus/gecko/projects/CSC249ADSE15_CNDA/software/pnetcdf/1.12.3/oneapi.eng.2023.05.15.007/lib:/lus/gecko/projects/CSC249ADSE15_CNDA/software/netcdf-fortran/4.6.1/oneapi.eng.2023.05.15.007/lib:/lus/gecko/projects/CSC249ADSE15_CNDA/software/netcdf-c/4.9.2/oneapi.eng.2023.05.15.007/lib:$ENV{LD_LIBRARY_PATH} - /lus/gecko/projects/CSC249ADSE15_CNDA/software/pnetcdf/1.12.3/oneapi.eng.2023.05.15.007/bin:/lus/gecko/projects/CSC249ADSE15_CNDA/software/netcdf-fortran/4.6.1/oneapi.eng.2023.05.15.007/bin:/lus/gecko/projects/CSC249ADSE15_CNDA/software/netcdf-c/4.9.2/oneapi.eng.2023.05.15.007/bin:$ENV{PATH} - list:0-7,104-111:8-15,112-119:16-23,120-127:24-31,128-135:32-39,136-143:40-47,144-151:52-59,156-163:60-67,164-171:68-75,172-179:76-83,180-187:84-91,188-195:92-99,196-203 + /lus/flare/projects/CSC249ADSE15_CNDA/software/netcdf-c/4.9.2/oneapi.eng.2024.04.15.002 + /lus/flare/projects/CSC249ADSE15_CNDA/software/netcdf-fortran/4.6.1/oneapi.eng.2024.04.15.002 + /lus/flare/projects/CSC249ADSE15_CNDA/software/pnetcdf/1.12.3/oneapi.eng.2024.04.15.002 + /lus/flare/projects/CSC249ADSE15_CNDA/software/pnetcdf/1.12.3/oneapi.eng.2024.04.15.002/lib:/lus/flare/projects/CSC249ADSE15_CNDA/software/netcdf-fortran/4.6.1/oneapi.eng.2024.04.15.002/lib:/lus/flare/projects/CSC249ADSE15_CNDA/software/netcdf-c/4.9.2/oneapi.eng.2024.04.15.002/lib:$ENV{LD_LIBRARY_PATH} + /lus/flare/projects/CSC249ADSE15_CNDA/software/pnetcdf/1.12.3/oneapi.eng.2024.04.15.002/bin:/lus/flare/projects/CSC249ADSE15_CNDA/software/netcdf-fortran/4.6.1/oneapi.eng.2024.04.15.002/bin:/lus/flare/projects/CSC249ADSE15_CNDA/software/netcdf-c/4.9.2/oneapi.eng.2024.04.15.002/bin:$ENV{PATH} 1 @@ -3554,6 +3548,9 @@ /soft/tools/mpi_wrapper_utils/gpu_tile_compact.sh 131072 20 + $ENV{KOKKOS_ROOT} + 1 + 0:4,1:4,2:4,3:4:4:4,5:4,6:4,7:4 0 diff --git a/components/eamxx/cmake/machine-files/aurora.cmake b/components/eamxx/cmake/machine-files/aurora.cmake new file mode 100644 index 00000000000..59157285bab --- /dev/null +++ b/components/eamxx/cmake/machine-files/aurora.cmake @@ -0,0 +1,14 @@ +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) +common_setup() + +include (${EKAT_MACH_FILES_PATH}/kokkos/serial.cmake) +include (${EKAT_MACH_FILES_PATH}/mpi/other.cmake) + +set(EKAT_MPIRUN_EXE "mpiexec" CACHE STRING "" FORCE) +set(EKAT_MPI_NP_FLAG "-np" CACHE STRING "" FORCE) +set(EKAT_MPI_EXTRA_ARGS "--label --cpu-bind depth -envall" CACHE STRING "") +set(EKAT_MPI_THREAD_FLAG "-d" CACHE STRING "") + +set(NETCDF_C_PATH "$ENV{NETCDF_C_PATH}") +set(NETCDF_FORTRAN_PATH "$ENV{NETCDF_FORTRAN_PATH}") +set(PNETCDF_PATH "$ENV{PNETCDF_PATH}") From fd04726e9b49f12b1b9e0e533d1cffece64151ba Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 30 Aug 2024 08:09:18 -0500 Subject: [PATCH 136/197] Remove trailing whitespace --- .../src/framework/mpas_stream_manager.F | 302 +++++++++--------- 1 file changed, 151 insertions(+), 151 deletions(-) diff --git a/components/mpas-framework/src/framework/mpas_stream_manager.F b/components/mpas-framework/src/framework/mpas_stream_manager.F index 9f9b46adae5..e8705c51a6d 100644 --- a/components/mpas-framework/src/framework/mpas_stream_manager.F +++ b/components/mpas-framework/src/framework/mpas_stream_manager.F @@ -146,7 +146,7 @@ end subroutine seed_random if (err_local /= MPAS_STREAM_LIST_NOERR) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR STREAM_ERROR_WRITE('Problems while creating stream list') - return + return end if ! @@ -156,7 +156,7 @@ end subroutine seed_random if (err_local /= MPAS_STREAM_LIST_NOERR) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR STREAM_ERROR_WRITE('Problems while creating input alarm list') - return + return end if ! @@ -166,7 +166,7 @@ end subroutine seed_random if (err_local /= MPAS_STREAM_LIST_NOERR) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR STREAM_ERROR_WRITE('Problems while creating output alarm list') - return + return end if ! @@ -204,7 +204,7 @@ subroutine MPAS_stream_mgr_finalize(manager, ierr)!{{{ threadNum = mpas_threading_get_thread_num() - STREAM_DEBUG_WRITE('-- Called MPAS_stream_mgr_finalize()') + STREAM_DEBUG_WRITE('-- Called MPAS_stream_mgr_finalize()') if (present(ierr)) ierr = MPAS_STREAM_MGR_NOERR @@ -264,16 +264,16 @@ end subroutine MPAS_stream_mgr_finalize!}}} !> \author Michael Duda, Doug Jacobsen !> \date 13 June 2014 !> \details - !> Creates a new stream within the stream manager. The "direction" - !> argument may be either MPAS_STREAM_INPUT, MPAS_STREAM_OUTPUT, - !> MPAS_STREAM_INPUT_OUTPUT, or MPAS_STREAM_NONE. The "filename" argument - !> is the template of the filenames that are associated with the stream. - !> Knowing the interval between files, and - !> the filename template, a "referenceTime" argument must be provided to - !> specify the first timestamp appearing in any of the files associated with - !> the stream, thereby determining where the "file breaks" will occur between - !> timestamps. If no "referenceTime" is specified, the start time of the - !> clock associated with the stream handler will be used as the reference + !> Creates a new stream within the stream manager. The "direction" + !> argument may be either MPAS_STREAM_INPUT, MPAS_STREAM_OUTPUT, + !> MPAS_STREAM_INPUT_OUTPUT, or MPAS_STREAM_NONE. The "filename" argument + !> is the template of the filenames that are associated with the stream. + !> Knowing the interval between files, and + !> the filename template, a "referenceTime" argument must be provided to + !> specify the first timestamp appearing in any of the files associated with + !> the stream, thereby determining where the "file breaks" will occur between + !> timestamps. If no "referenceTime" is specified, the start time of the + !> clock associated with the stream handler will be used as the reference !> time. Additionally, the interval between records in the file may be !> specified using the optional "recordInterval" argument; if this argument !> is not supplied, the stream manager will assume that this interval is @@ -284,8 +284,8 @@ end subroutine MPAS_stream_mgr_finalize!}}} !> MPAS_IO_DOUBLE_PRECISION, or MPAS_IO_NATIVE_PRECISION; if this argument is !> not supplied, native precision is assumed. !> The optional argument clobberMode determines how the stream manager will - !> deal with existing files; possible options include MPAS_STREAM_CLOBBER_NEVER, - !> MPAS_STREAM_CLOBBER_APPEND, MPAS_STREAM_CLOBBER_TRUNCATE, + !> deal with existing files; possible options include MPAS_STREAM_CLOBBER_NEVER, + !> MPAS_STREAM_CLOBBER_APPEND, MPAS_STREAM_CLOBBER_TRUNCATE, !> and MPAS_STREAM_CLOBBER_OVERWRITE. The default behavior is to never modify !> existing files (MPAS_STREAM_CLOBBER_NEVER). !> The optional argument ioType specifies the I/O type to use for the @@ -398,14 +398,14 @@ subroutine MPAS_stream_mgr_create_stream(manager, streamID, direction, filename, if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR STREAM_ERROR_WRITE('Problems while creating input alarm list') deallocate(new_stream) - return + return end if call MPAS_stream_list_create(new_stream % alarmList_out, ierr=err_local) if (err_local /= MPAS_STREAM_LIST_NOERR) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR STREAM_ERROR_WRITE('Problems while creating output alarm list') deallocate(new_stream) - return + return end if call mpas_pool_create_pool(new_stream % att_pool) call mpas_pool_clone_pool(manager % defaultAtts, new_stream % att_pool) @@ -424,7 +424,7 @@ subroutine MPAS_stream_mgr_create_stream(manager, streamID, direction, filename, STREAM_ERROR_WRITE('Problems while adding stream to list') return end if - + manager % numStreams = manager % numStreams + 1 end if @@ -635,7 +635,7 @@ subroutine MPAS_stream_mgr_destroy_stream(manager, streamID, ierr)!{{{ deallocate(stream % stream) end if deallocate(stream) - + manager % numStreams = manager % numStreams - 1 end if @@ -649,8 +649,8 @@ end subroutine MPAS_stream_mgr_destroy_stream!}}} !> \author Michael Duda !> \date 22 August 2014 !> \details - !> Returns a pointer to the clock associated with the stream manager, - !> in which any stream alarms should be defined before being added to + !> Returns a pointer to the clock associated with the stream manager, + !> in which any stream alarms should be defined before being added to !> the stream manager via the MPAS_stream_mgr_add_alarm() routine. ! !----------------------------------------------------------------------- @@ -1072,7 +1072,7 @@ end subroutine MPAS_stream_mgr_add_stream_fields!}}} ! !----------------------------------------------------------------------- subroutine MPAS_stream_mgr_remove_field(manager, streamID, fieldName, ierr)!{{{ - + implicit none character (len=*), parameter :: sub = 'MPAS_stream_mgr_remove_field' @@ -1232,7 +1232,7 @@ subroutine MPAS_stream_mgr_add_alarm(manager, streamID, alarmID, direction, ierr ! if ( threadNum == 0 ) then if (direction == MPAS_STREAM_INPUT .or. direction == MPAS_STREAM_INPUT_OUTPUT) then - + ! If alarm is not already defined, we need to create a new alarm node nullify(new_alarm) if (.not. MPAS_stream_list_query(manager % alarms_in, alarmID, new_alarm, ierr=err_local)) then @@ -1242,10 +1242,10 @@ subroutine MPAS_stream_mgr_add_alarm(manager, streamID, alarmID, direction, ierr if (err_local /= MPAS_STREAM_LIST_NOERR) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR STREAM_ERROR_WRITE('Problems while creating stream list for alarm') - return + return end if nullify(new_alarm % next) - + call MPAS_stream_list_insert(manager % alarms_in, new_alarm, ierr=err_local) if (err_local /= MPAS_STREAM_LIST_NOERR) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR @@ -1253,7 +1253,7 @@ subroutine MPAS_stream_mgr_add_alarm(manager, streamID, alarmID, direction, ierr return end if end if - + ! Add specified stream to alarm node stream list allocate(new_xref) new_xref % name = streamID @@ -1264,7 +1264,7 @@ subroutine MPAS_stream_mgr_add_alarm(manager, streamID, alarmID, direction, ierr STREAM_ERROR_WRITE('Problems while adding stream to alarm stream list') return end if - + ! Add alarm to stream alarm list allocate(new_xref) new_xref % name = alarmID @@ -1276,9 +1276,9 @@ subroutine MPAS_stream_mgr_add_alarm(manager, streamID, alarmID, direction, ierr return end if end if - + if (direction == MPAS_STREAM_OUTPUT .or. direction == MPAS_STREAM_INPUT_OUTPUT) then - + ! If alarm is not already defined, we need to create a new alarm node nullify(new_alarm) if (.not. MPAS_stream_list_query(manager % alarms_out, alarmID, new_alarm, ierr=err_local)) then @@ -1288,10 +1288,10 @@ subroutine MPAS_stream_mgr_add_alarm(manager, streamID, alarmID, direction, ierr if (err_local /= MPAS_STREAM_LIST_NOERR) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR STREAM_ERROR_WRITE('Problems while creating stream list for alarm') - return + return end if nullify(new_alarm % next) - + call MPAS_stream_list_insert(manager % alarms_out, new_alarm, ierr=err_local) if (err_local /= MPAS_STREAM_LIST_NOERR) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR @@ -1299,7 +1299,7 @@ subroutine MPAS_stream_mgr_add_alarm(manager, streamID, alarmID, direction, ierr return end if end if - + ! Add specified stream to alarm node stream list allocate(new_xref) new_xref % name = streamID @@ -1310,7 +1310,7 @@ subroutine MPAS_stream_mgr_add_alarm(manager, streamID, alarmID, direction, ierr STREAM_ERROR_WRITE('Problems while adding stream to alarm stream list') return end if - + ! Add alarm to stream alarm list allocate(new_xref) new_xref % name = alarmID @@ -1399,7 +1399,7 @@ subroutine MPAS_stream_mgr_remove_alarm(manager, streamID, alarmID, direction, i STREAM_ERROR_WRITE('Output alarm '//trim(alarmID)//' does not exist on stream '//trim(streamID)) end if return - end if + end if if (.not. associated(streamNode)) then if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR STREAM_ERROR_WRITE('Alarm '//trim(alarmID)//' does not have stream '//trim(streamID)//' on its stream list.') @@ -1433,7 +1433,7 @@ end subroutine MPAS_stream_mgr_remove_alarm!}}} !> Resets all alarms used by the stream manager. If the optional argument !> 'streamID' is provided, only alarms associated with streams that match !> the 'streamID' regular expression will be - !> reset. If the optional 'direction' argument is provided, only alarms + !> reset. If the optional 'direction' argument is provided, only alarms !> associated with that direction will be reset. ! !----------------------------------------------------------------------- @@ -1453,7 +1453,7 @@ subroutine MPAS_stream_mgr_reset_alarms(manager, streamID, direction, ierr)!{{{ logical :: resetAlarms threadNum = mpas_threading_get_thread_num() - + if (present(streamID)) then STREAM_DEBUG_WRITE('-- Called MPAS_stream_mgr_reset_alarms() for stream ' // trim(streamID)) else @@ -1486,7 +1486,7 @@ subroutine MPAS_stream_mgr_reset_alarms(manager, streamID, direction, ierr)!{{{ alarm_cursor => stream % alarmList_in % head do while (associated(alarm_cursor)) if (mpas_is_alarm_ringing(manager % streamClock, alarm_cursor % name, ierr=local_ierr)) then - call mpas_reset_clock_alarm(manager % streamClock, alarm_cursor % name, ierr=local_ierr) + call mpas_reset_clock_alarm(manager % streamClock, alarm_cursor % name, ierr=local_ierr) end if alarm_cursor => alarm_cursor % next end do @@ -1496,7 +1496,7 @@ subroutine MPAS_stream_mgr_reset_alarms(manager, streamID, direction, ierr)!{{{ alarm_cursor => stream % alarmList_out % head do while (associated(alarm_cursor)) if (mpas_is_alarm_ringing(manager % streamClock, alarm_cursor % name, ierr=local_ierr)) then - call mpas_reset_clock_alarm(manager % streamClock, alarm_cursor % name, ierr=local_ierr) + call mpas_reset_clock_alarm(manager % streamClock, alarm_cursor % name, ierr=local_ierr) end if alarm_cursor => alarm_cursor % next end do @@ -1514,7 +1514,7 @@ subroutine MPAS_stream_mgr_reset_alarms(manager, streamID, direction, ierr)!{{{ alarm_cursor => manager % alarms_in % head do while (associated(alarm_cursor)) if (mpas_is_alarm_ringing(manager % streamClock, alarm_cursor % name, ierr=local_ierr)) then - call mpas_reset_clock_alarm(manager % streamClock, alarm_cursor % name, ierr=local_ierr) + call mpas_reset_clock_alarm(manager % streamClock, alarm_cursor % name, ierr=local_ierr) end if alarm_cursor => alarm_cursor % next end do @@ -1525,7 +1525,7 @@ subroutine MPAS_stream_mgr_reset_alarms(manager, streamID, direction, ierr)!{{{ alarm_cursor => manager % alarms_out % head do while (associated(alarm_cursor)) if (mpas_is_alarm_ringing(manager % streamClock, alarm_cursor % name, ierr=local_ierr)) then - call mpas_reset_clock_alarm(manager % streamClock, alarm_cursor % name, ierr=local_ierr) + call mpas_reset_clock_alarm(manager % streamClock, alarm_cursor % name, ierr=local_ierr) end if alarm_cursor => alarm_cursor % next end do @@ -1543,10 +1543,10 @@ end subroutine MPAS_stream_mgr_reset_alarms!}}} !> \author Michael Duda !> \date 30 September 2014 !> \details - !> Tests whether any I/O alarms in a stream manager are ringing; if the optional - !> 'streamID' argument is given, only alarms for that stream are tested; if - !> the optional argument 'direction' is given, only alarms for the specified - !> direction are tested. If any of the tested alarms is ringing, the function + !> Tests whether any I/O alarms in a stream manager are ringing; if the optional + !> 'streamID' argument is given, only alarms for that stream are tested; if + !> the optional argument 'direction' is given, only alarms for the specified + !> direction are tested. If any of the tested alarms is ringing, the function !> returns .true.; otherwise, it returns .false.. !> Note: This function doesn't support streamID regular expressions ! @@ -1566,7 +1566,7 @@ logical function MPAS_stream_mgr_ringing_alarms(manager, streamID, direction, ie integer :: local_ierr, threadNum threadNum = mpas_threading_get_thread_num() - + STREAM_DEBUG_WRITE('-- Called MPAS_stream_mgr_ringing_alarms()') MPAS_stream_mgr_ringing_alarms = .false. @@ -1784,7 +1784,7 @@ subroutine MPAS_stream_mgr_set_property_int(manager, streamID, propertyName, pro if ( .not. setProperties ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_set_property().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if @@ -1848,7 +1848,7 @@ subroutine MPAS_stream_mgr_set_property_char(manager, streamID, propertyName, pr call mpas_set_time(stream_cursor % referenceTime, dateTimeString=propertyValue) case (MPAS_STREAM_PROPERTY_RECORD_INTV) - + ! The interval between records may not have been allocated if the optional recordInterval ! argument was not provided when the stream was created if (.not. associated(stream_cursor % recordInterval)) then @@ -1869,7 +1869,7 @@ subroutine MPAS_stream_mgr_set_property_char(manager, streamID, propertyName, pr if ( .not. setProperties ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_set_property().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if @@ -1945,7 +1945,7 @@ subroutine MPAS_stream_mgr_set_property_logical(manager, streamID, propertyName, if ( .not. setProperties ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_set_property().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if @@ -1990,7 +1990,7 @@ subroutine MPAS_stream_mgr_get_property_int(manager, streamID, propertyName, pro if (.not. MPAS_stream_list_query(manager % streams, streamID, stream_cursor, ierr=err_local)) then STREAM_ERROR_WRITE('Stream '//trim(streamID)//' does not exist in call to MPAS_stream_mgr_get_property().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if ! @@ -2057,7 +2057,7 @@ subroutine MPAS_stream_mgr_get_property_char(manager, streamID, propertyName, pr if (.not. MPAS_stream_list_query(manager % streams, streamID, stream_cursor, ierr=err_local)) then STREAM_ERROR_WRITE('Stream '//trim(streamID)//' does not exist in call to MPAS_stream_mgr_get_property().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if ! @@ -2081,9 +2081,9 @@ subroutine MPAS_stream_mgr_get_property_char(manager, streamID, propertyName, pr ! assume that the interval is the shortest interval between alarms on the stream; since ! recordInterval is only used for reading, use the input alarm list in this check. if (.not. associated(stream_cursor % recordInterval)) then - + ! - ! If no direction is specified, return the read interval, since this was the only historic + ! If no direction is specified, return the read interval, since this was the only historic ! use of the recordInterval for a stream. ! if (present(direction)) then @@ -2164,7 +2164,7 @@ subroutine MPAS_stream_mgr_get_property_logical(manager, streamID, propertyName, if (.not. MPAS_stream_list_query(manager % streams, streamID, stream_cursor, ierr=err_local)) then STREAM_ERROR_WRITE('Stream '//trim(streamID)//' does not exist in call to MPAS_stream_mgr_get_property().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if ! @@ -2245,14 +2245,14 @@ subroutine MPAS_stream_mgr_add_pkg(manager, streamID, packageName, ierr)!{{{ ! ! Add package to the packages pool for the stream ! - call mpas_pool_add_package(stream_cursor % pkg_pool, packageName, package) + call mpas_pool_add_package(stream_cursor % pkg_pool, packageName, package) end do if ( .not. addedPackages ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_add_pkg().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if @@ -2310,7 +2310,7 @@ subroutine MPAS_stream_mgr_remove_pkg(manager, streamID, packageName, ierr)!{{{ if ( .not. removedPackage ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_remove_pkg().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if @@ -2374,7 +2374,7 @@ subroutine MPAS_stream_mgr_add_att_int(manager, attName, attVal, streamID, ierr) if (mpas_pool_config_type(att_pool, attName) /= MPAS_POOL_FATAL) then STREAM_ERROR_WRITE('Attribute '//trim(attName)//' in stream '//trim(stream_cursor % name)//' is not of type integer.') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if call mpas_pool_add_config(att_pool, attName, attVal) else @@ -2385,7 +2385,7 @@ subroutine MPAS_stream_mgr_add_att_int(manager, attName, attVal, streamID, ierr) if ( .not. addedAttribute ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_add_att().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if else @@ -2403,7 +2403,7 @@ subroutine MPAS_stream_mgr_add_att_int(manager, attName, attVal, streamID, ierr) if (mpas_pool_config_type(att_pool, attName) /= MPAS_POOL_FATAL) then STREAM_ERROR_WRITE('Attribute '//trim(attName)//' in streamManager is not of type integer.') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if call mpas_pool_add_config(att_pool, attName, attVal) else @@ -2473,7 +2473,7 @@ subroutine MPAS_stream_mgr_add_att_real(manager, attName, attVal, streamID, ierr if (mpas_pool_config_type(att_pool, attName) /= MPAS_POOL_FATAL) then STREAM_ERROR_WRITE('Attribute '//trim(attName)//' in stream '//trim(stream_cursor % name)//' is not of type real.') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if call mpas_pool_add_config(att_pool, attName, attVal) else @@ -2484,7 +2484,7 @@ subroutine MPAS_stream_mgr_add_att_real(manager, attName, attVal, streamID, ierr if ( .not. addedAttribute ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_add_att().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if else @@ -2503,7 +2503,7 @@ subroutine MPAS_stream_mgr_add_att_real(manager, attName, attVal, streamID, ierr if (mpas_pool_config_type(att_pool, attName) /= MPAS_POOL_FATAL) then STREAM_ERROR_WRITE('Attribute '//trim(attName)//' in streamManager is not of type real.') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if call mpas_pool_add_config(att_pool, attName, attVal) else @@ -2573,7 +2573,7 @@ subroutine MPAS_stream_mgr_add_att_char(manager, attName, attVal, streamID, ierr if (mpas_pool_config_type(att_pool, attName) /= MPAS_POOL_FATAL) then STREAM_ERROR_WRITE('Attribute '//trim(attName)//' in stream '//trim(stream_cursor % name)//' is not of type character.') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if call mpas_pool_add_config(att_pool, attName, attVal) else @@ -2584,7 +2584,7 @@ subroutine MPAS_stream_mgr_add_att_char(manager, attName, attVal, streamID, ierr if ( .not. addedAttribute ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_add_att().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if else @@ -2603,7 +2603,7 @@ subroutine MPAS_stream_mgr_add_att_char(manager, attName, attVal, streamID, ierr if (mpas_pool_config_type(att_pool, attName) /= MPAS_POOL_FATAL) then STREAM_ERROR_WRITE('Attribute '//trim(attName)//' in streamManager is not of type character.') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if call mpas_pool_add_config(att_pool, attName, attVal) else @@ -2673,7 +2673,7 @@ subroutine MPAS_stream_mgr_add_att_logical(manager, attName, attVal, streamID, i if (mpas_pool_config_type(att_pool, attName) /= MPAS_POOL_FATAL) then STREAM_ERROR_WRITE('Attribute '//trim(attName)//' in stream '//trim(stream_cursor % name)//' is not of type logical.') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if call mpas_pool_add_config(att_pool, attName, attVal) else @@ -2684,7 +2684,7 @@ subroutine MPAS_stream_mgr_add_att_logical(manager, attName, attVal, streamID, i if ( .not. addedAttribute ) then STREAM_ERROR_WRITE('No stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_add_att().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if else @@ -2703,7 +2703,7 @@ subroutine MPAS_stream_mgr_add_att_logical(manager, attName, attVal, streamID, i if (mpas_pool_config_type(att_pool, attName) /= MPAS_POOL_FATAL) then STREAM_ERROR_WRITE('Attribute '//trim(attName)//' in streamManger is not of type logical.') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if call mpas_pool_add_config(att_pool, attName, attVal) else @@ -2727,11 +2727,11 @@ end subroutine MPAS_stream_mgr_add_att_logical!}}} !> stream is only written if any of its alarms are ringing. !> The "timeLevel" argument optionally specifies, for fields with multiple !> time levels, the time level from which fields should be written. - !> The "mgLevel" argument optionally specifies, for fields that exist for + !> The "mgLevel" argument optionally specifies, for fields that exist for !> multiple grid levels, the grid level from which fields should be written. - !> The "forceWriteNow" argument optionally specifies that all streams -- or - !> the stream specified by the "streamID" argument -- should be written by - !> the call regardless of whether any alarms associated with the stream(s) + !> The "forceWriteNow" argument optionally specifies that all streams -- or + !> the stream specified by the "streamID" argument -- should be written by + !> the call regardless of whether any alarms associated with the stream(s) !> are ringing. The "writeTime" argument optionally specifies a time stamp !> to be used for expanding a filename template, when it is not passed in, !> the current time of the streamManager's clock is used to expand filename @@ -2824,7 +2824,7 @@ subroutine MPAS_stream_mgr_write(manager, streamID, timeLevel, mgLevel, forceWri if ( .not. wroteStreams ) then STREAM_ERROR_WRITE('No output stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_write().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if else nullify(stream_cursor) @@ -2872,11 +2872,11 @@ end subroutine MPAS_stream_mgr_write !}}} !> stream is only written if any of its alarms are ringing. !> The "timeLevel" argument optionally specifies, for fields with multiple !> time levels, the time level from which fields should be written. - !> The "mgLevel" argument optionally specifies, for fields that exist for + !> The "mgLevel" argument optionally specifies, for fields that exist for !> multiple grid levels, the grid level from which fields should be written. - !> The "forceWriteNow" argument optionally specifies that all streams -- or - !> the stream specified by the "streamID" argument -- should be written by - !> the call regardless of whether any alarms associated with the stream(s) + !> The "forceWriteNow" argument optionally specifies that all streams -- or + !> the stream specified by the "streamID" argument -- should be written by + !> the call regardless of whether any alarms associated with the stream(s) !> are ringing. The "writeTime" argument optionally specifies a time stamp !> to be used for expanding a filename template, when it is not passed in, !> the current time of the streamManager's clock is used to expand filename @@ -3006,7 +3006,7 @@ subroutine MPAS_stream_mgr_block_write(manager, writeBlock, streamID, timeLevel, if ( .not. wroteStreams ) then STREAM_ERROR_WRITE('No output stream matching '//trim(streamID)//' exists in call to MPAS_stream_mgr_block_write().') if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if else nullify(stream_cursor) @@ -3048,7 +3048,7 @@ subroutine MPAS_stream_mgr_block_write(manager, writeBlock, streamID, timeLevel, call mpas_dmpar_finalize(debugContext % dminfo) deallocate(debugContext % dminfo) - deallocate(debugContext) + deallocate(debugContext) end if call mpas_threading_barrier() @@ -3180,7 +3180,7 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite ! Based on clobber_mode, determine if it matters if the file exists or not. if ( stream % clobber_mode == MPAS_STREAM_CLOBBER_OVERWRITE .or. stream % clobber_mode == MPAS_STREAM_CLOBBER_APPEND ) then STREAM_DEBUG_WRITE(' -- Cobber mode is overwrite or append...') - + ! Check if the file exists if (manager % ioContext % dminfo % my_proc_id == IO_NODE) then inquire(file=trim(stream % filename), exist=recordSeek) @@ -3217,12 +3217,12 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite if ( recordSeek ) then STREAM_DEBUG_WRITE(' -- File exists on disk: ' // trim(stream % filename)) call mpas_get_time(writeTime, dateTimeString=now_string) - + ! Look for exact record (in the case of overwriting) ! This also gets the number of records in the file. stream % nRecords = MPAS_seekStream(stream % stream, now_string, MPAS_STREAM_EXACT_TIME, actualWhen, maxRecords, local_ierr) STREAM_DEBUG_WRITE(' -- Seeked record is: $i with current records equal to $i and an error of $i' COMMA intArgs=(/stream % nRecords COMMA maxRecords COMMA local_ierr/)) - + if ( stream % nRecords == 0 ) then ! If we didn't find an exact time, set record to point to the end of the file. ! This might result in non-monotonic timestamps in the output file. @@ -3266,7 +3266,7 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite ! Based on clobber_mode, determine if it matters if the file exists or not. if ( stream % clobber_mode == MPAS_STREAM_CLOBBER_OVERWRITE .or. stream % clobber_mode == MPAS_STREAM_CLOBBER_APPEND ) then STREAM_DEBUG_WRITE(' -- Cobber mode is overwrite or append...') - + ! Check if the file exists if (manager % ioContext % dminfo % my_proc_id == IO_NODE) then inquire(file=trim(stream % filename), exist=recordSeek) @@ -3305,12 +3305,12 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite if ( recordSeek ) then STREAM_DEBUG_WRITE(' -- File exists on disk: ' // trim(stream % filename)) call mpas_get_time(writeTime, dateTimeString=now_string) - + ! Look for exact record (in the case of overwriting) ! This also gets the number of records in the file. stream % nRecords = MPAS_seekStream(stream % stream, now_string, MPAS_STREAM_EXACT_TIME, actualWhen, maxRecords, local_ierr) STREAM_DEBUG_WRITE(' -- Seeked record is: $i with current records equal to $i and an error of $i' COMMA intArgs=(/stream % nRecords COMMA maxRecords COMMA local_ierr/)) - + if ( stream % nRecords == 0 ) then ! If we didn't find an exact time, set record to point to the end of the file. ! This might result in non-monotonic timestamps in the output file. @@ -3330,12 +3330,12 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite stream % nRecords = stream % nRecords + 1 if ( stream % clobber_mode == MPAS_STREAM_CLOBBER_OVERWRITE .or. stream % clobber_mode == MPAS_STREAM_CLOBBER_APPEND ) then call mpas_get_time(writeTime, dateTimeString=now_string) - + ! Look for exact record (in the case of overwriting) ! This also gets the number of records in the file. tempRecord = MPAS_seekStream(stream % stream, now_string, MPAS_STREAM_EXACT_TIME, actualWhen, maxRecords, local_ierr) STREAM_DEBUG_WRITE(' -- Seeked record is: $i with current records equal to $i and an error of $i' COMMA intArgs=(/tempRecord COMMA maxRecords COMMA local_ierr/)) - + if ( tempRecord /= 0 .and. stream % nRecords < maxRecords ) then ! If we found an exact result ! This might result in non-monotonic timestamps in the output file. @@ -3375,9 +3375,9 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite call prewrite_reindex(manager % allFields, stream % field_pool) end if - ! + ! ! Write the stream - ! + ! STREAM_DEBUG_WRITE(' -- Writing stream ' // trim(stream % name)) call MPAS_writeStream(stream % stream, stream % nRecords, & useMissingValMask, ierr=local_ierr) @@ -3433,16 +3433,16 @@ end subroutine write_stream !}}} !> is only read if any of its alarms are ringing. !> The "timeLevel" argument optionally specifies, for fields with multiple !> time levels, the time level into which fields should be read. - !> The "mgLevel" argument optionally specifies, for fields that exist for + !> The "mgLevel" argument optionally specifies, for fields that exist for !> multiple grid levels, the grid level into which fields should be read. !> The "when" argument optionally specifies the timestamp from which fields !> are to be read. !> The "whence" argument optionally specifies the method for determining !> the timestamp to read from in case an exact match is not found for the !> read timestamp, which is the current time unless the optional "when" - !> argument is given; possible values are MPAS_STREAM_EXACT_TIME, - !> MPAS_STREAM_NEAREST, MPAS_STREAM_LATEST_BEFORE, - !> MPAS_STREAM_LATEST_STRICTLY_BEFORE, MPAS_STREAM_EARLIEST_AFTER, or + !> argument is given; possible values are MPAS_STREAM_EXACT_TIME, + !> MPAS_STREAM_NEAREST, MPAS_STREAM_LATEST_BEFORE, + !> MPAS_STREAM_LATEST_STRICTLY_BEFORE, MPAS_STREAM_EARLIEST_AFTER, or !> MPAS_STREAM_EARLIEST_STRICTLY_AFTER. !> The optional output argument "saveActualWhen" will save the actual time read !> from a stream in case an exact match for the "when" time is not found, @@ -3484,7 +3484,7 @@ subroutine MPAS_stream_mgr_read(manager, streamID, timeLevel, mgLevel, rightNow, integer :: local_whence integer :: local_ierr integer :: temp_ierr - type (MPAS_Time_type) :: now_time + type (MPAS_Time_type) :: now_time character (len=StrKIND) :: actualWhen_local logical :: local_saveActualWhen logical :: local_readInputOutputStreams @@ -3555,7 +3555,7 @@ subroutine MPAS_stream_mgr_read(manager, streamID, timeLevel, mgLevel, rightNow, nullify(stream_cursor) do while (MPAS_stream_list_query(manager % streams, streamID, stream_cursor, ierr=ierr)) STREAM_DEBUG_WRITE('-- Handling read of stream '//trim(stream_cursor % name)) - + ! Verify that the stream is an input stream if (local_readInputOutputStreams) then if (stream_cursor % direction == MPAS_STREAM_INPUT .or. stream_cursor % direction == MPAS_STREAM_INPUT_OUTPUT) then @@ -3590,7 +3590,7 @@ subroutine MPAS_stream_mgr_read(manager, streamID, timeLevel, mgLevel, rightNow, STREAM_ERROR_WRITE(' strictly INPUT direction were requested by this call.') endif if (present(ierr)) ierr = MPAS_STREAM_MGR_ERROR - return + return end if else ! try to read any stream of input direction nullify(stream_cursor) @@ -3631,7 +3631,7 @@ subroutine MPAS_stream_mgr_read(manager, streamID, timeLevel, mgLevel, rightNow, local_ierr = MPAS_STREAM_MGR_ERROR end if end if - + stream_cursor => stream_cursor % next end do end if @@ -3747,7 +3747,7 @@ subroutine read_stream(manager, stream, timeLevel, mgLevel, forceReadNow, when, if ( stream % filename_interval /= 'none' ) then call mpas_set_time(now_time, dateTimeString=when, ierr=local_ierr) call mpas_set_timeInterval(filename_interval, timeString=stream % filename_interval) - + call mpas_build_stream_filename(stream % referenceTime, now_time, filename_interval, stream % filename_template, blockID_local, temp_filename, ierr=local_ierr) else call mpas_expand_string(when, blockID_local, stream % filename_template, temp_filename) @@ -3916,7 +3916,7 @@ subroutine read_stream(manager, stream, timeLevel, mgLevel, forceReadNow, when, call mpas_get_time(filenameTime, dateTimeString=test_when) call mpas_set_timeInterval(filename_interval, timeString=stream % filename_interval) - + call mpas_build_stream_filename(stream % referenceTime, filenameTime, filename_interval, stream % filename_template, blockID_local, test_filename, ierr=local_ierr) STREAM_DEBUG_WRITE(' --- Retesting filename is ' // trim(test_filename)) @@ -4031,9 +4031,9 @@ subroutine read_stream(manager, stream, timeLevel, mgLevel, forceReadNow, when, stream % timeLevel = timeLevel end if - ! + ! ! Read the stream - ! + ! call MPAS_readStream(stream % stream, stream % nRecords, ierr=local_ierr) if (local_ierr /= MPAS_STREAM_NOERR) then ierr = MPAS_STREAM_MGR_ERROR @@ -4068,13 +4068,13 @@ end subroutine read_stream !}}} !----------------------------------------------------------------------- ! routine MPAS_stream_mesg ! - !> \brief Write an error message (if the level requires it) to + !> \brief Write an error message (if the level requires it) to !> \author Michael Duda, Doug Jacobsen !> \date 07/16/2014 - !> \details Using the input error level, + !> \details Using the input error level, !----------------------------------------------------------------------- subroutine MPAS_stream_mesg(level, mesg)!{{{ - + use mpas_dmpar implicit none @@ -4171,7 +4171,7 @@ end subroutine mpas_get_stream_filename !}}} !> \brief Construct the filename that contains a specific time in a stream !> \author Michael Duda, Doug Jacobsen !> \date 21 August 2014 - !> \details + !> \details !> Given a filename template and the information necessary to determine the time !> in the stream that matches a time available in any of the files associated with !> the stream, returns a specific filename that should contain that time. @@ -4182,7 +4182,7 @@ end subroutine mpas_get_stream_filename !}}} !> !> This is a low level subroutine to complement the !> mpas_get_stream_Filename routine - !> + !> !> Return error codes: !> 0 no error !----------------------------------------------------------------------- @@ -4229,7 +4229,7 @@ subroutine mpas_build_stream_filename(ref_time, when, filename_interval, filenam call mpas_get_timeInterval(intv, timeString=temp_string) STREAM_DEBUG_WRITE(' ** intv is: ' // trim(temp_string)) - call mpas_interval_division(ref_time, intv, filename_interval, nrecs, rem) + call mpas_interval_division(ref_time, intv, filename_interval, nrecs, rem) ! STREAM_DEBUG_WRITE(' ** Divisions are: $i' COMMA intArgs=(/nrecs/)) @@ -4260,7 +4260,7 @@ end subroutine mpas_build_stream_filename !}}} !> \brief This is a utility routine to build a stream type from a pool representing a stream. !> \author Michael Duda, Doug Jacobsen !> \date 07/23/2014 - !> \details + !> \details !> This routine will take as input a pool representing a stream. !> It will then generate a stream type based on this pool, and return that. !----------------------------------------------------------------------- @@ -4465,8 +4465,8 @@ end subroutine build_stream !}}} !> \brief Updates the time level for fields in a stream !> \author Michael Duda, Doug Jacobsen !> \date 07/23/2014 - !> \details - !> For an existing stream, updates the time levels for all fields in + !> \details + !> For an existing stream, updates the time levels for all fields in !> the stream so that subsequent reads/writes of the stream will read !> from / write to the specified time level. !----------------------------------------------------------------------- @@ -4581,7 +4581,7 @@ end subroutine update_stream !}}} !> \brief Checks whether a stream has any active packages (or none at all) !> \author Michael Duda !> \date 23 September 2014 - !> \details + !> \details !> This function determines whether a stream has any active packages !> associated with it. If the stream has at least one active package, !> or no packages at all, the function returns true; else, if all packages @@ -4630,32 +4630,32 @@ end function stream_active_pkg_check !}}} !> \brief Parses a semi-colon-separated list of package names, indicating whether any are active !> \author Michael Duda !> \date 19 March 2015 - !> \details - !> This function determines whether any of the named strings in + !> \details + !> This function determines whether any of the named strings in !> the semi-colon-separated list provided in the 'packages' argument are - !> active. + !> active. !> If any of the packages does not exist in the package pool, the optional - !> argument ierr is set to a non-zero value; otherwise, if all packages exist, + !> argument ierr is set to a non-zero value; otherwise, if all packages exist, !> ierr will be set to zero upon return. ! !----------------------------------------------------------------------- logical function parse_package_list(package_pool, packages, ierr) result(active) - + implicit none - + type (mpas_pool_type), intent(in) :: package_pool character (len=*), intent(in) :: packages integer, intent(out), optional :: ierr - + integer :: i, j, slen integer :: err_level logical, pointer :: pkg_val - - + + if (present(ierr)) ierr = 0 - + slen = len_trim(packages) - + ! ! No packages @@ -4664,7 +4664,7 @@ logical function parse_package_list(package_pool, packages, ierr) result(active) active = .true. return end if - + active = .false. err_level = mpas_pool_get_error_level() @@ -4870,8 +4870,8 @@ end subroutine exch_all_halos !}}} !> \brief Determines whether a dimension represents a decomposed dimension or not !> \author Michael Duda !> \date 24 September 2014 - !> \details - !> This function determines whether the name of the input argument is + !> \details + !> This function determines whether the name of the input argument is !> a decompsed dimension or not. Currently in MPAS, the only decomposed !> dimensions are: !> nCells @@ -4906,8 +4906,8 @@ end function is_decomposed_dim !}}} !> \brief Reindex connectivity fields from local to global index space. !> \author Doug Jacobsen, Michael Duda !> \date 24 September 2014 - !> \details - !> For any connectivity fields contained in the stream to be written, + !> \details + !> For any connectivity fields contained in the stream to be written, !> whose fields include those in the streamFields pool, save the locally !> indexed fields in module variables *_save, and allocate new arrays for !> the fields, which are set to contain global indices. @@ -5203,12 +5203,12 @@ end subroutine prewrite_reindex !}}} !> \brief Reindex connectivity fields from global to local index space. !> \author Doug Jacobsen, Michael Duda !> \date 24 September 2014 - !> \details - !> For any connectivity fields contained in the stream to be written, + !> \details + !> For any connectivity fields contained in the stream to be written, !> whose fields include those in the streamFields pool, restore the locally !> indexed fields from module variables *_save. !> This routine should be called immediately after a write of a stream. - !> + !> !> NB: Even if the write of a stream fails, it is important to stil call !> this routine to reset the connectivity fields to contain local indices. ! @@ -5247,35 +5247,35 @@ subroutine postwrite_reindex(allFields, streamFields) !{{{ if (associated(cellsOnCell_save)) then cellsOnCell_ptr => cellsOnCell_save call mpas_pool_get_field(allFields, 'cellsOnCell', cellsOnCell) - end if + end if if (associated(edgesOnCell_save)) then edgesOnCell_ptr => edgesOnCell_save call mpas_pool_get_field(allFields, 'edgesOnCell', edgesOnCell) - end if + end if if (associated(verticesOnCell_save)) then verticesOnCell_ptr => verticesOnCell_save call mpas_pool_get_field(allFields, 'verticesOnCell', verticesOnCell) - end if + end if if (associated(cellsOnEdge_save)) then cellsOnEdge_ptr => cellsOnEdge_save call mpas_pool_get_field(allFields, 'cellsOnEdge', cellsOnEdge) - end if + end if if (associated(verticesOnEdge_save)) then verticesOnEdge_ptr => verticesOnEdge_save call mpas_pool_get_field(allFields, 'verticesOnEdge', verticesOnEdge) - end if + end if if (associated(edgesOnEdge_save)) then edgesOnEdge_ptr => edgesOnEdge_save call mpas_pool_get_field(allFields, 'edgesOnEdge', edgesOnEdge) - end if + end if if (associated(cellsOnVertex_save)) then cellsOnVertex_ptr => cellsOnVertex_save call mpas_pool_get_field(allFields, 'cellsOnVertex', cellsOnVertex) - end if + end if if (associated(edgesOnVertex_save)) then edgesOnVertex_ptr => edgesOnVertex_save call mpas_pool_get_field(allFields, 'edgesOnVertex', edgesOnVertex) - end if + end if ! ! Reset indices for connectivity arrays from global to local index space @@ -5378,8 +5378,8 @@ end subroutine postwrite_reindex !}}} !> \brief Reindex connectivity fields from global to local index space. !> \author Doug Jacobsen, Michael Duda !> \date 24 September 2014 - !> \details - !> For any connectivity fields contained in the stream that was read, + !> \details + !> For any connectivity fields contained in the stream that was read, !> whose fields include those in the streamFields pool, convert the !> globally indexed connectivity fields in the stream to local index space. !> This routine should be called immediately after a read of a stream. @@ -5606,13 +5606,13 @@ end subroutine postread_reindex !}}} !> \author Doug Jacobsen, Michael Duda !> \date 03/03/2015 !> \details - !> If the optional 'streamID' argument is provided, this routine resets - !> the iterator within a stream manager so that streams may subsequently - !> be iterated over using the MPAS_stream_mgr_get_next_stream function. + !> If the optional 'streamID' argument is provided, this routine resets + !> the iterator within a stream manager so that streams may subsequently + !> be iterated over using the MPAS_stream_mgr_get_next_stream function. !> !> If an optional stream name is provided via the 'streamID' argument, this - !> routine will reset the iterator for fields within the specified stream, - !> which may subsequently iterated over using the + !> routine will reset the iterator for fields within the specified stream, + !> which may subsequently iterated over using the !> MPAS_stream_mgr_get_next_field() routine. !> !> NOTE: This routine does not support regular expressions for StreamID @@ -5772,7 +5772,7 @@ end function MPAS_stream_mgr_get_next_stream !}}} !> the stream manager. !> !> This function returns .TRUE. if the stream contains another field, - !> whether active or not, in which case the output argument fieldName + !> whether active or not, in which case the output argument fieldName !> provides the name of this field, and .FALSE. otherwise. If a field name !> is returned, the optional logical argument isActive may be used to !> determine whether the field is currently active in the stream. @@ -5828,7 +5828,7 @@ logical function MPAS_stream_mgr_get_next_field(manager, streamID, fieldName, is else isActive = .true. end if - + call mpas_pool_set_error_level(err_level) end if @@ -5864,7 +5864,7 @@ logical function MPAS_stream_mgr_stream_exists(manager, streamID) result(validSt return end function MPAS_stream_mgr_stream_exists!}}} - + end module mpas_stream_manager @@ -5967,7 +5967,7 @@ subroutine stream_mgr_create_stream_c(manager_c, streamID_c, direction_c, filena end if STREAM_DEBUG_WRITE('Creating stream from c...') - + ! ! For immutable streams, the stream should have already been defined at this point, and ! all we need to do is update the stream's filename template; From 67556b4249d9a78299eb6f4c98870b352012f811 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Fri, 30 Aug 2024 10:25:08 -0600 Subject: [PATCH 137/197] Fix append feature --- cime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime b/cime index 3dfad8399b8..52787427846 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit 3dfad8399b803d724365c559c5b84e5546049e0c +Subproject commit 52787427846eec58038ab59664fd9c2706f23513 From 36bb7c01ad1577d84ebbe18808bed6495400913c Mon Sep 17 00:00:00 2001 From: Elizabeth Hunke Date: Fri, 30 Aug 2024 11:51:59 -0500 Subject: [PATCH 138/197] clean up debugging code and comments --- components/mpas-seaice/src/shared/mpas_seaice_icepack.F | 9 --------- 1 file changed, 9 deletions(-) diff --git a/components/mpas-seaice/src/shared/mpas_seaice_icepack.F b/components/mpas-seaice/src/shared/mpas_seaice_icepack.F index c6386f2c1aa..36899b4b10d 100644 --- a/components/mpas-seaice/src/shared/mpas_seaice_icepack.F +++ b/components/mpas-seaice/src/shared/mpas_seaice_icepack.F @@ -10656,15 +10656,6 @@ subroutine init_icepack_package_configs(domain) call seaice_icepack_write_warnings(icepack_warnings_aborted()) -!note that icepack_recompute_constants, called from icepck_init_parameters above, recomputes Lfresh -! - make Lfresh optional for E3SM? - -! tcraig, this will write out icepack parameters to fort.101, need to uncomment 3 lines - if (mpas_log_info % taskID == 0) then - call icepack_write_parameters(101) - endif -! call seaice_icepack_write_warnings(icepack_warnings_aborted()) - call mpas_log_write(" ----- compare values after icepack init -----") ! Lfresh is derived in Icepack, not sent in from driver From 86eb592e18d8ebb59960500959e1862cc8c2b6a3 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 30 Aug 2024 08:09:41 -0500 Subject: [PATCH 139/197] Warn on failure to clobber record in append mode We do not want this to be an error (even a non-fatal one). --- .../mpas-framework/src/framework/mpas_stream_manager.F | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/mpas-framework/src/framework/mpas_stream_manager.F b/components/mpas-framework/src/framework/mpas_stream_manager.F index e8705c51a6d..fd393908a7d 100644 --- a/components/mpas-framework/src/framework/mpas_stream_manager.F +++ b/components/mpas-framework/src/framework/mpas_stream_manager.F @@ -3398,10 +3398,9 @@ subroutine write_stream(manager, stream, blockID, timeLevel, mgLevel, forceWrite ! write(err_string,'(a,i4,a)') 'Writing to stream '''//trim(stream % name)//''' would overwrite record ', & stream % nRecords, ' in file '''//trim(stream % filename)//''',' - STREAM_ERROR_WRITE(trim(err_string)) + STREAM_WARNING_WRITE(trim(err_string)) write(err_string,'(a)') ' but clobber_mode is set to ''append''.' - STREAM_ERROR_WRITE(trim(err_string)) - ierr = MPAS_STREAM_MGR_ERR_CLOBBER_REC + STREAM_WARNING_WRITE(trim(err_string)) else ierr = MPAS_STREAM_MGR_ERROR end if From 6cbb5b0fc2f46b9d3c56e020ed80288a16ec4d23 Mon Sep 17 00:00:00 2001 From: "Andrew M. Bradley" Date: Fri, 30 Aug 2024 16:48:23 -0500 Subject: [PATCH 140/197] Homme: Fix planar-mode pgN get_latlon routines. Add is_planar block to gfr_f_get_(corner_)latlon. Add unit test for these routines. Clean up and add to some other unit tests. --- components/homme/src/share/gllfvremap_mod.F90 | 97 ++++++++++++++----- 1 file changed, 75 insertions(+), 22 deletions(-) diff --git a/components/homme/src/share/gllfvremap_mod.F90 b/components/homme/src/share/gllfvremap_mod.F90 index e0e0fa6c4da..e8013df217b 100644 --- a/components/homme/src/share/gllfvremap_mod.F90 +++ b/components/homme/src/share/gllfvremap_mod.F90 @@ -2088,9 +2088,14 @@ subroutine gfr_f_get_latlon(ie, i, j, lat, lon) type (spherical_polar_t) :: p - p = change_coordinates(gfr%center_f(i,j,ie)) - lat = p%lat - lon = p%lon + if (gfr%is_planar) then + lon = gfr%center_f(i,j,ie)%x + lat = gfr%center_f(i,j,ie)%y + else + p = change_coordinates(gfr%center_f(i,j,ie)) + lat = p%lat + lon = p%lon + end if end subroutine gfr_f_get_latlon subroutine gfr_f_get_corner_latlon(ie, i, j, c, lat, lon) @@ -2103,9 +2108,14 @@ subroutine gfr_f_get_corner_latlon(ie, i, j, c, lat, lon) type (spherical_polar_t) :: p - p = change_coordinates(gfr%corners_f(c,i,j,ie)) - lat = p%lat - lon = p%lon + if (gfr%is_planar) then + lon = gfr%corners_f(c,i,j,ie)%x + lat = gfr%corners_f(c,i,j,ie)%y + else + p = change_coordinates(gfr%corners_f(c,i,j,ie)) + lat = p%lat + lon = p%lon + end if end subroutine gfr_f_get_corner_latlon subroutine gfr_f_get_cartesian3d(ie, i, j, p) @@ -2318,6 +2328,7 @@ subroutine set_ps_Q(elem, nets, nete, timeidx, qidx, nlev) ! Make up a test function for use in unit tests. use coordinate_systems_mod, only: cartesian3D_t, change_coordinates + use physical_constants, only: dd_pi, Lx, Ly type (element_t), intent(inout) :: elem(:) integer, intent(in) :: nets, nete, timeidx, qidx, nlev @@ -2329,7 +2340,13 @@ subroutine set_ps_Q(elem, nets, nete, timeidx, qidx, nlev) do ie = nets, nete do j = 1,np do i = 1,np - p = change_coordinates(elem(ie)%spherep(i,j)) + if (gfr%is_planar) then + p%x = elem(ie)%spherep(i,j)%lon*2*dd_pi/Lx + p%y = elem(ie)%spherep(i,j)%lat*2*dd_pi/Ly + p%z = 0 + else + p = change_coordinates(elem(ie)%spherep(i,j)) + end if elem(ie)%state%ps_v(i,j,timeidx) = & 1.0d3*(1 + 0.05*sin(2*p%x+0.5)*sin(p%y+1.5)*sin(3*p%z+2.5)) q = 0.5*(1 + sin(3*p%x)*sin(3*p%y)*sin(4*p%z)) @@ -2609,7 +2626,8 @@ function check(par, dom_mt, gfr, elem, verbose) result(nerr) logical, intent(in) :: verbose real(kind=real_kind) :: a, b, rd, x, y, f0(np*np), f1(np*np), g(np,np), & - wf(np*np), wg(np,np), qmin, qmax, qmin1, qmax1 + wf(np*np), wg(np,np), qmin, qmax, qmin1, qmax1, lat, lon, latext(2), & + lonext(2), tol integer :: nf, nf2, ie, i, j, k, iremap, info, ilimit, it real(kind=real_kind), allocatable :: Qdp_fv(:,:), ps_v_fv(:,:), & qmins(:,:,:), qmaxs(:,:,:) @@ -2669,6 +2687,31 @@ function check(par, dom_mt, gfr, elem, verbose) result(nerr) nerr = nerr + 1 write(iulog,*) 'gfr> Dinv', ie, rd end if + if (gfr%is_planar) then + lonext(1) = minval(elem(ie)%spherep(:,:)%lon) + lonext(2) = maxval(elem(ie)%spherep(:,:)%lon) + latext(1) = minval(elem(ie)%spherep(:,:)%lat) + latext(2) = maxval(elem(ie)%spherep(:,:)%lat) + tol = max(lonext(2) - lonext(1), latext(2) - latext(1))*1.e4*eps + do i = 1, nf + do j = 1, nf + call gfr_f_get_latlon(ie, i, j, lat, lon) + if ( lon < lonext(1) .or. lon > lonext(2) .or. & + lat < latext(1) .or. lat > latext(2)) then + write(iulog,*) 'gfr> planar latlon ctr', ie, latext, lonext, lat, lon + nerr = nerr + 1 + end if + do k = 1, 4 + call gfr_f_get_corner_latlon(ie, i, j, k, lat, lon) + if ( lon < lonext(1) - tol .or. lon > lonext(2) + tol .or. & + lat < latext(1) - tol .or. lat > latext(2) + tol) then + write(iulog,*) 'gfr> planar latlon crn', ie, latext, lonext, lat, lon + nerr = nerr + 1 + end if + end do + end do + end do + end if ! Check that FV -> GLL -> FV recovers the original FV values exactly ! (with no DSS and no limiter). @@ -2839,8 +2882,8 @@ function test_sphere2ref() result(nerr) use kinds, only: iulog type (cartesian3D_t) :: corners(4), sphere - real (real_kind) :: refin(2), refout(2), err - integer :: i, j, n, nerr + real (real_kind) :: refin(2), refout(2), err, tol + integer :: i, j, n, trial, nerr nerr = 0 @@ -2854,18 +2897,28 @@ function test_sphere2ref() result(nerr) do i = 1,n refin(1) = -1 + (1.0_real_kind/(n-1))*(i-1) do j = 1,n - refin(2) = -1 + (1.0_real_kind/(n-1))*(j-1) - call ref2sphere(corners, refin(1), refin(2), sphere) - call sphere2ref(corners, sphere, refout(1), refout(2)) - err = abs(refin(1) - refout(1)) + abs(refin(2) - refout(2)) - if (err > 15*eps .or. & - maxval(abs(refout)) > 1 + 5*eps .or. & - any(refout /= refout)) then - write(iulog,*) refin(1), refin(2) - write(iulog,*) refout(1), refout(2) - write(iulog,*) err - nerr = nerr + 1 - end if + do trial = 1, 2 + refin(2) = -1 + (1.0_real_kind/(n-1))*(j-1) + call ref2sphere(corners, refin(1), refin(2), sphere) + if (trial == 2) then + sphere%x = 0.9d0*sphere%x + sphere%y = 0.9d0*sphere%y + sphere%z = 0.9d0*sphere%z + end if + call sphere2ref(corners, sphere, refout(1), refout(2)) + err = abs(refin(1) - refout(1)) + abs(refin(2) - refout(2)) + tol = 15*eps + if (trial == 2) tol = 1e-6 + if (err > tol .or. & + maxval(abs(refout)) > 1 + 5*eps .or. & + any(refout /= refout)) then + write(iulog,*) 'gfr> test_sphere2ref trial', trial + write(iulog,*) refin(1), refin(2) + write(iulog,*) refout(1), refout(2) + write(iulog,*) err + nerr = nerr + 1 + end if + end do end do end do if (nerr /= 0) write(iulog,*) 'test_sphere2ref FAILED' From 4b5cf35b729a221770acd1134c720a7f8dff8410 Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Sat, 31 Aug 2024 02:18:41 +0000 Subject: [PATCH 141/197] Remove "--cpu-bind depth" in Aurora mpiexec --- cime_config/machines/config_machines.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index f1bed254da4..e97c93957a8 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3498,7 +3498,7 @@ -np {{ total_tasks }} --label -ppn {{ tasks_per_node }} - --cpu-bind depth -envall + -envall -d $ENV{OMP_NUM_THREADS} $ENV{GPU_TILE_COMPACT} From 15d891a3b5ae59726c3f84b9306d508e31c204b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:23:29 +0000 Subject: [PATCH 142/197] Bump actions/setup-python from 5.1.1 to 5.2.0 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.1.1 to 5.2.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5.1.1...v5.2.0) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/e3sm-gh-pages.yml | 2 +- .github/workflows/eamxx-gh-pages.yml | 2 +- .github/workflows/eamxx_default_files.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e3sm-gh-pages.yml b/.github/workflows/e3sm-gh-pages.yml index 9ea25ae1864..709fecc623a 100644 --- a/.github/workflows/e3sm-gh-pages.yml +++ b/.github/workflows/e3sm-gh-pages.yml @@ -31,7 +31,7 @@ jobs: - name: Show action trigger run: echo "= The job was automatically triggered by a ${{github.event_name}} event on repo ${{github.event.repository.name}}." - name: Set up Python 3.10 - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: "3.10" - name: Install python deps diff --git a/.github/workflows/eamxx-gh-pages.yml b/.github/workflows/eamxx-gh-pages.yml index e6fb53ba29f..7c9da3264d6 100644 --- a/.github/workflows/eamxx-gh-pages.yml +++ b/.github/workflows/eamxx-gh-pages.yml @@ -54,7 +54,7 @@ jobs: echo "= The job was automatically triggered by a ${{github.event_name}} event." - name: Set up Python 3.11 - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: "3.11" diff --git a/.github/workflows/eamxx_default_files.yml b/.github/workflows/eamxx_default_files.yml index e0a8e19f9c0..fa84f9f96f0 100644 --- a/.github/workflows/eamxx_default_files.yml +++ b/.github/workflows/eamxx_default_files.yml @@ -21,7 +21,7 @@ jobs: show-progress: false submodules: false - name: Set up Python 3.11 - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: "3.11" - name: Run unit tests From 76c1a9084fa954e3c360a3cbc8a2830ef1d115c1 Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Mon, 2 Sep 2024 13:38:21 -0400 Subject: [PATCH 143/197] rename singularity2 to ghci-oci --- .github/workflows/e3sm-gh-ci-cime-tests.yml | 16 ++++++++-------- .github/workflows/e3sm-gh-ci-w-cime-tests.yml | 16 ++++++++-------- cime_config/machines/config_machines.xml | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/e3sm-gh-ci-cime-tests.yml b/.github/workflows/e3sm-gh-ci-cime-tests.yml index b90ed2f0119..adaadd68160 100644 --- a/.github/workflows/e3sm-gh-ci-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-cime-tests.yml @@ -27,14 +27,14 @@ jobs: fail-fast: false matrix: test: - - SMS_D_P4.ne4pg2_oQU480.F2010.singularity2_gnu - - SMS_P4.ne4pg2_oQU480.F2010.singularity2_gnu - - REP_P4.ne4pg2_oQU480.F2010.singularity2_gnu - - ERS_P4.ne4pg2_oQU480.F2010.singularity2_gnu - - ERS_P4.ne4pg2_oQU480.F2010.singularity2_gnu.eam-wcprod_F2010 - - ERP_P4.ne4pg2_oQU480.F2010.singularity2_gnu - - PET_P4.ne4pg2_oQU480.F2010.singularity2_gnu - - PEM_P4.ne4pg2_oQU480.F2010.singularity2_gnu + - SMS_D_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu + - SMS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu + - REP_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu + - ERS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu + - ERS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu.eam-wcprod_F2010 + - ERP_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu + - PET_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu + - PEM_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 diff --git a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml index c24604d4ad0..a3ab08ddf69 100644 --- a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml @@ -19,14 +19,14 @@ jobs: fail-fast: false matrix: test: - - SMS_D_P8.ne4pg2_oQU480.WCYCL2010NS.singularity2_gnu - - SMS_P8.ne4pg2_oQU480.WCYCL2010NS.singularity2_gnu - - REP_P8.ne4pg2_oQU480.WCYCL2010NS.singularity2_gnu - - ERS_P8.ne4pg2_oQU480.WCYCL2010NS.singularity2_gnu - - ERS_P8.ne4pg2_oQU480.WCYCL2010NS.singularity2_gnu.allactive-wcprod_1850 - - ERP_P8.ne4pg2_oQU480.WCYCL2010NS.singularity2_gnu - - PET_P8.ne4pg2_oQU480.WCYCL2010NS.singularity2_gnu - - PEM_P8.ne4pg2_oQU480.WCYCL2010NS.singularity2_gnu + - SMS_D_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu + - SMS_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu + - REP_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu + - ERS_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu + - ERS_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu.allactive-wcprod_1850 + - ERP_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu + - PET_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu + - PEM_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index 6cd9d585a25..7f20b1b512b 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -1712,9 +1712,9 @@ - - Singularity container 2.0 - singularity2 + + OCI-based container 2.0 + ghci-oci LINUX gnu mpich From 0e3c779739a04d91c283a5730b9de10f5b56acc3 Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Mon, 2 Sep 2024 13:40:48 -0400 Subject: [PATCH 144/197] reduce gh ci and ci-w burden --- .github/workflows/e3sm-gh-ci-cime-tests.yml | 10 +++------- .github/workflows/e3sm-gh-ci-w-cime-tests.yml | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/e3sm-gh-ci-cime-tests.yml b/.github/workflows/e3sm-gh-ci-cime-tests.yml index adaadd68160..0af45e95d4e 100644 --- a/.github/workflows/e3sm-gh-ci-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-cime-tests.yml @@ -5,6 +5,7 @@ on: branches: [ master ] paths: # first, yes to these + - '.github/workflows/e3sm-gh-ci-cime-tests.yml' - 'cime_config/**' - 'components/eam/**' - 'components/elm/**' @@ -26,15 +27,10 @@ jobs: strategy: fail-fast: false matrix: - test: + test: + # format test like usual (TYPE_PX.GRID.COMPSET.MACHINE_COMPILER) - SMS_D_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - - SMS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - - REP_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - - ERS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - ERS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu.eam-wcprod_F2010 - - ERP_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - - PET_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - - PEM_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 diff --git a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml index a3ab08ddf69..b481119a85a 100644 --- a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml @@ -18,15 +18,11 @@ jobs: strategy: fail-fast: false matrix: - test: + test: + # format test like usual (TYPE_PX.GRID.COMPSET.MACHINE_COMPILER) - SMS_D_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - - SMS_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - - REP_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - - ERS_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - ERS_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu.allactive-wcprod_1850 - - ERP_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - - PET_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - - PEM_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu + container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 From 22e94c1140a73b1f49bcaa0b98def0e6c890c56c Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Mon, 2 Sep 2024 13:42:53 -0400 Subject: [PATCH 145/197] add a screamv1 SMS test --- .github/workflows/e3sm-gh-ci-cime-tests.yml | 1 + components/eamxx/cmake/machine-files/ghci-oci.cmake | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 components/eamxx/cmake/machine-files/ghci-oci.cmake diff --git a/.github/workflows/e3sm-gh-ci-cime-tests.yml b/.github/workflows/e3sm-gh-ci-cime-tests.yml index 0af45e95d4e..ed35f82a2a7 100644 --- a/.github/workflows/e3sm-gh-ci-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-cime-tests.yml @@ -31,6 +31,7 @@ jobs: # format test like usual (TYPE_PX.GRID.COMPSET.MACHINE_COMPILER) - SMS_D_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - ERS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu.eam-wcprod_F2010 + - SMS_P4.ne4pg2_oQU480.F2010-SCREAMv1.ghci-oci_gnu container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 diff --git a/components/eamxx/cmake/machine-files/ghci-oci.cmake b/components/eamxx/cmake/machine-files/ghci-oci.cmake new file mode 100644 index 00000000000..86a2fb1d530 --- /dev/null +++ b/components/eamxx/cmake/machine-files/ghci-oci.cmake @@ -0,0 +1,2 @@ +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) +common_setup() From 7d06bcfa09ecd6b0931034f6f8cd6fcb59eb796d Mon Sep 17 00:00:00 2001 From: mahf708 Date: Mon, 2 Sep 2024 18:01:40 -0500 Subject: [PATCH 146/197] add screamv1 prod testmod --- .../scream/v1prod/shell_commands | 97 +++++++++++++++++++ .../testmods_dirs/scream/v1prod/user_nl_cpl | 1 + .../testmods_dirs/scream/v1prod/user_nl_elm | 14 +++ ...cream_output.decadal.1dailyAVG_native.yaml | 16 +++ ...cream_output.decadal.1dailyMAX_native.yaml | 17 ++++ ...cream_output.decadal.1dailyMIN_native.yaml | 16 +++ ...scream_output.decadal.1hourlyINST_arm.yaml | 40 ++++++++ ...eam_output.decadal.1hourlyINST_native.yaml | 19 ++++ ...ream_output.decadal.3hourlyAVG_coarse.yaml | 69 +++++++++++++ ...eam_output.decadal.3hourlyINST_coarse.yaml | 68 +++++++++++++ ...ream_output.decadal.6hourlyAVG_coarse.yaml | 48 +++++++++ ...eam_output.decadal.6hourlyINST_coarse.yaml | 39 ++++++++ ...eam_output.decadal.6hourlyINST_native.yaml | 28 ++++++ ...scream_output.decadal.dailyAVG_coarse.yaml | 95 ++++++++++++++++++ 14 files changed, 567 insertions(+) create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/shell_commands create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_cpl create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_elm create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml create mode 100644 components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/shell_commands b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/shell_commands new file mode 100644 index 00000000000..435556401a2 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/shell_commands @@ -0,0 +1,97 @@ +#!/bin/bash + +cime_root=$(./xmlquery --value CIMEROOT) +input_data_dir=$(./xmlquery --value DIN_LOC_ROOT) +atmchange=$cime_root/../components/eamxx/scripts/atmchange + +# Change run length +./xmlchange RUN_STARTDATE="1994-10-01" + +# Turn on budget reporting +./xmlchange BUDGETS=TRUE + +# For big data +./xmlchange PIO_NETCDF_FORMAT="64bit_data" +./xmlchange PIO_TYPENAME=pnetcdf #adios #,PIO_TYPENAME_ATM=adios +./xmlchange PIO_REARRANGER=1 # use PIO_REARRANGER=3, for ADIOS; PIO_REARRANGER=1 for pnetcdf + +# Turn on cosp and set frequency +$atmchange -b physics::atm_procs_list="mac_aero_mic,rrtmgp,cosp" +$atmchange -b physics::cosp::cosp_frequency_units="hours" +$atmchange -b physics::cosp::cosp_frequency=1 + +# Need to explicitly turn on computing tendencies +$atmchange -b physics::mac_aero_mic::shoc::compute_tendencies=T_mid,qv +$atmchange -b physics::mac_aero_mic::p3::compute_tendencies=T_mid,qv +$atmchange -b physics::rrtmgp::compute_tendencies=T_mid +$atmchange -b homme::compute_tendencies=T_mid,qv + +# Set temperature cut off in dycore threshold to 180K +$atmchange -b vtheta_thresh=180 + +# Change lambda_high +$atmchange -b lambda_high=0.08 + +# use GHG levels more appropriate for sim +# Average from 19940101 - 20150101 +$atmchange -b co2vmr=377.2e-6 +$atmchange -b ch4vmr=1786.6e-9 +$atmchange -b n2ovmr=318.6e-9 +$atmchange -b orbital_year=-9999 +# use CO2 the same in land model +./xmlchange CCSM_CO2_PPMV=377.2 + +# determine grid and set remap files +atm_grid=$(./xmlquery --value ATM_GRID) +if [[ "${atm_grid}" = "ne30np4.pg2" ]]; then + hmapfile="${input_data_dir}/atm/scream/maps/map_ne30pg2_to_ne4pg2_20231201.nc" + armmapfile="${input_data_dir}/atm/scream/maps/map_ne30pg2_to_DecadalSites_c20240130.nc" + # Run with bugfixed SPA file + $atmchange -b spa_data_file="${input_data_dir}/atm/scream/init/spa_v3.LR.F2010.2011-2025.c_20240405.nc" +elif [[ "${atm_grid}" = "ne4np4.pg2" ]]; then + hmapfile="${input_data_dir}/atm/scream/maps/map_ne4pg2_to_ne2pg2_c20240902.nc" + echo "Note: arm remap only works for ne30pg2 atm grids for now" + armmapfile="not-supported-yet" + # Keep default SPA file + # ... (do nothing) +else + echo "Note: horiz/arm remaps only work for ne30pg2 and ne4pg2 atm grids for now" + hmapfile="not-supported-yet" + armmapfile="not-supported-yet" +fi + +# set the output yaml files +output_yaml_files=$(find ${cime_root}/../components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/ -maxdepth 1 -type f) +for file in ${output_yaml_files[@]}; do + # if the word "coarse" is in the file name, do nothing + if [[ "${file}" == *"_coarse.yaml" && "${hmapfile}" == "not-supported-yet" ]]; then + continue + elif [[ "${file}" == *"_arm.yaml" && "${armmapfile}" == "not-supported-yet" ]]; then + continue + else + # TODO: add remap file replacement for different grids + cp -v ${file} ./ + if [ "${file}" == "${output_yaml_files[0]}" ]; then + # First file, reset output list + $atmchange -b output_yaml_files="./$(basename ${file})" + else + # Append to output list + $atmchange -b output_yaml_files+="./$(basename ${file})" + fi + # Replace remap files + sed -i "s|horiz_remap_file:.*_to_ne30.*|horiz_remap_file: ${hmapfile}|" ./$(basename ${file}) + sed -i "s|horiz_remap_file:.*_to_DecadalSites.*|horiz_remap_file: ${armmapfile}|" ./$(basename ${file}) + fi +done + +# TODO: +# the only thing remaining is to set the SST data, but for some reason, this is proving difficult +# because it is not super important, leave it commented out for now, until a better solution can be found +# ... also, not sure if the below are specific to a given ocn/sea-ice grid? + +# # Point to new SST forcing +# ./xmlchange --file env_run.xml --id SSTICE_DATA_FILENAME --val "${input_data_dir}/atm/cam/sst/sst_ostia_3600x7200_19940930_20151231_c20240125.nc" +# ./xmlchange --file env_run.xml --id SSTICE_GRID_FILENAME --val "${input_data_dir}/ocn/docn7/domain.ocn.3600x7200.230522.nc" +# ./xmlchange --file env_run.xml --id SSTICE_YEAR_ALIGN --val 1994 +# ./xmlchange --file env_run.xml --id SSTICE_YEAR_START --val 1994 +# ./xmlchange --file env_run.xml --id SSTICE_YEAR_END --val 2015 diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_cpl b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_cpl new file mode 100644 index 00000000000..3e3a0580721 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_cpl @@ -0,0 +1 @@ +ocn_surface_flux_scheme = 2 diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_elm b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_elm new file mode 100644 index 00000000000..93b7ec9e277 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_elm @@ -0,0 +1,14 @@ +! Override consistency checks since we know our surface data is inconsistent +check_finidat_fsurdat_consistency = .false. +check_finidat_year_consistency = .false. +check_finidat_pct_consistency = .false. +check_dynpft_consistency = .false. + +hist_dov2xy = .true.,.true. +hist_mfilt = 1,1 +hist_nhtfrq = -24,-24 +hist_avgflag_pertape = 'A','A' +hist_fincl1 = 'FIRE', 'FPSN', 'QDRAI', 'QRUNOFF', 'ZWT', 'FSAT', 'H2OSOI', 'EFLX_LH_TOT', + 'QVEGT', 'QVEGE', 'FSH', 'ALBD', 'ALBI', 'TBOT', 'QBOT', 'RAIN', 'SNOW', + 'FSDS', 'FSDSND', 'FSDSNI', 'FSDSVD', 'FSDSVI', 'FLDS' +hist_fincl2 = 'H2OSNO','SOILWATER_10CM','TG' diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml new file mode 100644 index 00000000000..4e1239b5c33 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml @@ -0,0 +1,16 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.1dailyAVG_native.h +iotype: pnetcdf +Averaging Type: Average +Max Snapshots Per File: 1 +Fields: + Physics PG2: + Field Names: + - snow_depth_land +output_control: + Frequency: 1 + frequency_units: ndays + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml new file mode 100644 index 00000000000..a7d10efe070 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml @@ -0,0 +1,17 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.1dailyMAX_native.h +iotype: pnetcdf +Averaging Type: Max +Max Snapshots Per File: 1 +Fields: + Physics PG2: + Field Names: + - T_2m + - precip_total_surf_mass_flux +output_control: + Frequency: 1 + frequency_units: ndays + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml new file mode 100644 index 00000000000..653e194d278 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml @@ -0,0 +1,16 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.1dailyMIN_native.h +iotype: pnetcdf +Averaging Type: Min +Max Snapshots Per File: 1 +Fields: + Physics PG2: + Field Names: + - T_2m +output_control: + Frequency: 1 + frequency_units: ndays + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml new file mode 100644 index 00000000000..5bb07048aed --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml @@ -0,0 +1,40 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.1hourlyINST_arm.h +iotype: pnetcdf +Averaging Type: Instant +Max Snapshots Per File: 24 # one file per day +horiz_remap_file: ${DIN_LOC_ROOT}/atm/scream/maps/map_ne1024pg2_to_DecadalSites_c20240130.nc +Fields: + Physics PG2: + Field Names: + # 3D + - T_mid + - RelativeHumidity + - qc + - qi + - qr + - qm + - ps + - cldfrac_tot_for_analysis + - cldfrac_liq + - cldfrac_ice_for_analysis + - omega + - tke + - eff_radius_qc + - eff_radius_qi + - nc + - ni + - nr + - bm + - p_mid + - z_mid + - U + - V + - landfrac +output_control: + Frequency: 1 + frequency_units: nhours + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml new file mode 100644 index 00000000000..7a221e89f1c --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml @@ -0,0 +1,19 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.1hourlyINST_native.h +iotype: pnetcdf +Averaging Type: Instant +Max Snapshots Per File: 24 +Fields: + Physics PG2: + Field Names: + # For cloud morphology + - SW_flux_up_at_model_top + - LW_flux_up_at_model_top + - precip_total_surf_mass_flux +output_control: + Frequency: 1 + frequency_units: nhours + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml new file mode 100644 index 00000000000..665294c6227 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml @@ -0,0 +1,69 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.3hourlyAVG_coarse.h +iotype: pnetcdf +Averaging Type: Average +Max Snapshots Per File: 8 # one file per day +horiz_remap_file: ${DIN_LOC_ROOT}/atm/scream/maps/map_ne1024pg2_to_ne30pg2_mono.20230901.nc +Fields: + Physics PG2: + Field Names: + # 3D fields + - T_mid + - qv + - qc + - qr + - qi + - cldfrac_tot + - cldfrac_liq + - omega + - U + - V + - pseudo_density + - z_mid + # Surface + - surf_sens_flux + - surf_evap + - surface_upward_latent_heat_flux + - ps + - precip_liq_surf_mass_flux + - precip_ice_surf_mass_flux + - surf_mom_flux + - surf_radiative_T + - T_2m + - sfc_flux_dir_nir + - sfc_flux_dir_vis + - sfc_flux_dif_nir + - sfc_flux_dif_vis + - sfc_flux_sw_net + - sfc_flux_lw_dn + # Lowest Level + - U_at_model_bot + - V_at_model_bot + - T_mid_at_model_bot + - qv_at_model_bot + - qc_at_model_bot + - qi_at_model_bot + - qr_at_model_bot + - qm_at_model_bot + - bm_at_model_bot + - SW_flux_up_at_model_top + - SW_flux_dn_at_model_top + - LW_flux_up_at_model_top + - SW_clrsky_flux_up_at_model_top + - LW_clrsky_flux_up_at_model_top + - SW_flux_dn_at_model_bot + - SW_clrsky_flux_dn_at_model_bot + - SW_flux_up_at_model_bot + - SW_clrsky_flux_up_at_model_bot + - LW_flux_dn_at_model_bot + - LW_clrsky_flux_dn_at_model_bot + - LW_flux_up_at_model_bot + - LongwaveCloudForcing + - ShortwaveCloudForcing +output_control: + Frequency: 3 + frequency_units: nhours + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml new file mode 100644 index 00000000000..42c64954508 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml @@ -0,0 +1,68 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.3hourlyINST_coarse.h +iotype: pnetcdf +Averaging Type: Instant +Max Snapshots Per File: 8 # one file per day +horiz_remap_file: ${DIN_LOC_ROOT}/atm/scream/maps/map_ne1024pg2_to_ne30pg2_mono.20230901.nc +Fields: + Physics PG2: + Field Names: + # 2D vars for storm analysis + - SeaLevelPressure + - U_at_model_bot + - V_at_model_bot + - wind_speed_10m + - U_at_925hPa + - V_at_925hPa + - U_at_850hPa + - V_at_850hPa + - U_at_700hPa + - V_at_700hPa + - U_at_500hPa + - V_at_500hPa + - U_at_300hPa + - V_at_300hPa + - ZonalVapFlux + - MeridionalVapFlux + - T_2m + - qv_2m + - T_mid_at_925hPa + - T_mid_at_850hPa + - T_mid_at_700hPa + - T_mid_at_500hPa + - T_mid_at_300hPa + - RelativeHumidity_at_925hPa + - RelativeHumidity_at_850hPa + - RelativeHumidity_at_700hPa + - RelativeHumidity_at_500hPa + - RelativeHumidity_at_300hPa + - z_mid_at_925hPa + - z_mid_at_850hPa + - z_mid_at_700hPa + - z_mid_at_500hPa + - z_mid_at_300hPa + # 2D vars For ACI diagnostics + - SW_clrsky_flux_up_at_model_top + - SW_flux_up_at_model_top + - SW_flux_dn_at_model_top + - LiqWaterPath + - precip_liq_surf_mass_flux + - precip_ice_surf_mass_flux + - IceWaterPath + - cldfrac_tot_for_analysis + - cldfrac_liq + - omega_at_500hPa + - omega_at_700hPa + - omega_at_850hPa + - PotentialTemperature_at_700hPa + - PotentialTemperature_at_1000hPa + # 3D vars for nudging + - U + - V +output_control: + Frequency: 3 + frequency_units: nhours + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml new file mode 100644 index 00000000000..5e4aaed0738 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml @@ -0,0 +1,48 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.6hourlyAVG_coarse.h +iotype: pnetcdf +Averaging Type: Average +Max Snapshots Per File: 4 # one file per day +horiz_remap_file: ${DIN_LOC_ROOT}/atm/scream/maps/map_ne1024pg2_to_ne30pg2_mono.20230901.nc +Fields: + Physics PG2: + Field Names: + # Full 3D Profile + - p3_T_mid_tend + - shoc_T_mid_tend + - rrtmgp_T_mid_tend + - homme_T_mid_tend + - p3_qv_tend + - shoc_qv_tend + - homme_qv_tend + - SW_flux_dn + - SW_flux_up + - LW_flux_dn + - LW_flux_up + # Surface + - surf_sens_flux + - surf_evap + - surface_upward_latent_heat_flux + - ps + - precip_liq_surf_mass_flux + - precip_ice_surf_mass_flux + - surf_mom_flux + - surf_radiative_T + - T_2m + # Lowest Level + - U_at_model_bot + - V_at_model_bot + - SW_flux_dn_at_model_bot + - SW_flux_up_at_model_bot + - LW_flux_dn_at_model_bot + - LW_flux_up_at_model_bot + - SW_flux_up_at_model_top + - SW_flux_dn_at_model_top + - LW_flux_up_at_model_top +output_control: + Frequency: 6 + frequency_units: nhours + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml new file mode 100644 index 00000000000..e9e0f34d5e0 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml @@ -0,0 +1,39 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.6hourlyINST_coarse.h +iotype: pnetcdf +Averaging Type: Instant +Max Snapshots Per File: 4 # one file per day +horiz_remap_file: ${DIN_LOC_ROOT}/atm/scream/maps/map_ne1024pg2_to_ne30pg2_mono.20230901.nc +Fields: + Physics PG2: + Field Names: + # 3D fields on model levels + - T_mid + - qv + - RelativeHumidity + - U + - V + - omega + - qc + - nc + - qr + - qi + - tke + - o3_volume_mix_ratio + # 2D fields + - VapWaterPath + - LiqWaterPath + - IceWaterPath + - surf_radiative_T + - ps + - qv_2m + - T_2m + - ocnfrac + - landfrac +output_control: + Frequency: 6 + frequency_units: nhours + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml new file mode 100644 index 00000000000..bb7fd275abf --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml @@ -0,0 +1,28 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.6hourlyINST_native.h +iotype: pnetcdf +Averaging Type: Instant +Max Snapshots Per File: 4 # one file per day +Fields: + Physics PG2: + Field Names: + # For storm analysis + - SeaLevelPressure + - wind_speed_10m + - z_mid_at_500hPa + - z_mid_at_200hPa + # For wind turbine study + - wind_speed_at_100m_above_surface + # For atmospheric rivers + - ZonalVapFlux + - MeridionalVapFlux + # Others + - omega_at_500hPa + - omega_at_850hPa +output_control: + Frequency: 6 + frequency_units: nhours + MPI Ranks in Filename: false +Restart: + force_new_file: true diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml new file mode 100644 index 00000000000..7c1990a7b56 --- /dev/null +++ b/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml @@ -0,0 +1,95 @@ +%YAML 1.1 +--- +filename_prefix: scream_output.decadal.dailyAVG_coarse.h +iotype: pnetcdf +Averaging Type: Average +Max Snapshots Per File: 1 +horiz_remap_file: ${DIN_LOC_ROOT}/atm/scream/maps/map_ne1024pg2_to_ne30pg2_mono.20230901.nc +Fields: + Physics PG2: + Field Names: + # 3D fields + - T_mid + - qv + - RelativeHumidity + - qc + - qi + - qr + - qm + - nc + - ni + - nr + - cldfrac_tot_for_analysis + - cldfrac_ice_for_analysis + - cldfrac_liq + - omega + - U + - V + - z_mid + - p_mid + - tke + # 2D fields + - SW_flux_up_at_model_top + - SW_flux_dn_at_model_top + - LW_flux_up_at_model_top + - SW_clrsky_flux_up_at_model_top + - SW_clrsky_flux_dn_at_model_top + - LW_clrsky_flux_up_at_model_top + - SW_flux_up_at_model_bot + - SW_flux_dn_at_model_bot + - LW_flux_up_at_model_bot + - LW_flux_dn_at_model_bot + - SW_clrsky_flux_up_at_model_bot + - SW_clrsky_flux_dn_at_model_bot + - LW_clrsky_flux_dn_at_model_bot + - ShortwaveCloudForcing + - LongwaveCloudForcing + - ps + - SeaLevelPressure + - T_2m + - qv_2m + - surf_radiative_T + - VapWaterPath + - IceWaterPath + - LiqWaterPath + - RainWaterPath + - ZonalVapFlux + - MeridionalVapFlux + - surf_evap + - surf_sens_flux + - surface_upward_latent_heat_flux + - precip_liq_surf_mass_flux + - precip_ice_surf_mass_flux + - landfrac + - ocnfrac + - PotentialTemperature_at_700hPa + - PotentialTemperature_at_850hPa + - PotentialTemperature_at_1000hPa + - PotentialTemperature_at_2m_above_surface + - omega_at_500hPa + - omega_at_700hPa + - omega_at_850hPa + - RelativeHumidity_at_700hPa + - RelativeHumidity_at_1000hPa + - RelativeHumidity_at_2m_above_surface + - wind_speed_10m + - z_mid_at_700hPa + - z_mid_at_1000hPa + - T_mid_at_850hPa + - T_mid_at_700hPa + # For SST advection + - U_at_10m_above_surface + - V_at_10m_above_surface + # COSP + - isccp_ctptau + - modis_ctptau + - misr_cthtau + - cosp_sunlit + - isccp_cldtot + +output_control: + Frequency: 1 + frequency_units: ndays + MPI Ranks in Filename: false +Restart: + force_new_file: true From 7b43a058dd90183f3bca87daa6fea67c358cedd4 Mon Sep 17 00:00:00 2001 From: mahf708 Date: Mon, 2 Sep 2024 19:58:19 -0500 Subject: [PATCH 147/197] add scream-v1prod test to gh/ci --- .github/workflows/e3sm-gh-ci-cime-tests.yml | 4 ++-- .github/workflows/e3sm-gh-ci-w-cime-tests.yml | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e3sm-gh-ci-cime-tests.yml b/.github/workflows/e3sm-gh-ci-cime-tests.yml index ed35f82a2a7..62f6c1542e7 100644 --- a/.github/workflows/e3sm-gh-ci-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-cime-tests.yml @@ -28,10 +28,10 @@ jobs: fail-fast: false matrix: test: - # format test like usual (TYPE_PX.GRID.COMPSET.MACHINE_COMPILER) - SMS_D_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - ERS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu.eam-wcprod_F2010 - - SMS_P4.ne4pg2_oQU480.F2010-SCREAMv1.ghci-oci_gnu + - SMS_D_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu + - ERS_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu.scream-v1prod container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 diff --git a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml index b481119a85a..178b9a6a442 100644 --- a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml @@ -14,15 +14,14 @@ on: jobs: ci-w: + if: ${{ github.event.repository.name == 'e3sm' }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: test: - # format test like usual (TYPE_PX.GRID.COMPSET.MACHINE_COMPILER) - SMS_D_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - ERS_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu.allactive-wcprod_1850 - container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 From dd9b28d77a8a1b2c408662864185d7608b82b5fd Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Tue, 3 Sep 2024 08:36:55 -0600 Subject: [PATCH 148/197] Add white space at end of mkatmsrffile.py --- components/eam/tools/mkatmsrffile/mkatmsrffile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/eam/tools/mkatmsrffile/mkatmsrffile.py b/components/eam/tools/mkatmsrffile/mkatmsrffile.py index 826544feb08..268bd4ddd86 100644 --- a/components/eam/tools/mkatmsrffile/mkatmsrffile.py +++ b/components/eam/tools/mkatmsrffile/mkatmsrffile.py @@ -301,4 +301,4 @@ def apply_map_2D( data_out, ntime, n_s, wgt, row, col, data_in ): #--------------------------------------------------------------------------------------------------- if __name__ == '__main__': main() -#--------------------------------------------------------------------------------------------------- \ No newline at end of file +#--------------------------------------------------------------------------------------------------- From 47e474c6dc1284e9793c2d346cfcb2a5316a00a9 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Tue, 3 Sep 2024 10:47:43 -0500 Subject: [PATCH 149/197] Remove alternative aliases for v3 single-forcings compsets --- cime_config/allactive/config_compsets.xml | 40 ----------------------- 1 file changed, 40 deletions(-) diff --git a/cime_config/allactive/config_compsets.xml b/cime_config/allactive/config_compsets.xml index 28eefc45b76..ace33ae0917 100755 --- a/cime_config/allactive/config_compsets.xml +++ b/cime_config/allactive/config_compsets.xml @@ -93,81 +93,41 @@ 20TRSOI_EAM%CMIP6-GHG_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - hist-GHG - 20TRSOI_EAM%CMIP6-GHG_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - WCYCL20TR-aer 20TRSOI_EAM%CMIP6-AER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - hist-aer - 20TRSOI_EAM%CMIP6-AER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - WCYCL20TR-xGHG-xaer 20TRSOI_EAM%CMIP6-xGHG-xAER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - hist-all-xGHG-xaer - 20TRSOI_EAM%CMIP6-xGHG-xAER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - WCYCL20TR-nat 20TRSOI_EAM%CMIP6-NAT_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - hist-nat - 20TRSOI_EAM%CMIP6-NAT_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - WCYCL20TR-ozone 20TRSOI_EAM%CMIP6-OZONE_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - hist-ozone - 20TRSOI_EAM%CMIP6-OZONE_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - WCYCL20TR-lulc 20TRSOI_EAM%CMIP6-LULC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - hist-lulc - 20TRSOI_EAM%CMIP6-LULC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - WCYCL20TR-volc 20TRSOI_EAM%CMIP6-VOLC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - hist-volc - 20TRSOI_EAM%CMIP6-VOLC_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - WCYCL20TR-xaer 20TRSOI_EAM%CMIP6-xAER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - hist-all-xaer - 20TRSOI_EAM%CMIP6-xAER_ELM%CNPRDCTCBCTOP_MPASSI_MPASO_MOSART_SGLC_SWAV - - From ddc2f2347929d23704ec6582517689eabd120bea Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Tue, 3 Sep 2024 10:10:49 -0600 Subject: [PATCH 150/197] Delete components/eam/tools/mkatmsrffile/test.md --- components/eam/tools/mkatmsrffile/test.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 components/eam/tools/mkatmsrffile/test.md diff --git a/components/eam/tools/mkatmsrffile/test.md b/components/eam/tools/mkatmsrffile/test.md deleted file mode 100644 index bc0ef89536e..00000000000 --- a/components/eam/tools/mkatmsrffile/test.md +++ /dev/null @@ -1,3 +0,0 @@ -# test - -Some text goes here. From 9034faa5cd2076c85651bf33b3fad4b2bce89f4f Mon Sep 17 00:00:00 2001 From: Gautam Bisht Date: Mon, 17 Jun 2024 12:11:53 -0700 Subject: [PATCH 151/197] Adds LULC for NARRM A LULC file for 1850-2000 at r025 is added. [BFB] --- .../elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml b/components/elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml index 4f48bf6326a..92f186f1a38 100644 --- a/components/elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml +++ b/components/elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml @@ -38,6 +38,7 @@ lnd/clm2/initdata_map/20180316.DECKv1b_A1.ne30_oEC.edison.clm2.r.1980-01-01-00000.8575c3f_c20190904.nc lnd/clm2/surfdata_map/landuse.timeseries_0.5x0.5_hist_simyr1850-2015_c240308.nc +lnd/clm2/surfdata_map/landuse.timeseries_0.25x0.25_hist_simyr1850-2015_c240125.nc lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_historical_simyr1850-2015_c190904.nc From 6ca2cfe9d1b7dd00cb2c63d77b9fb23a5e5b1812 Mon Sep 17 00:00:00 2001 From: noel Date: Tue, 3 Sep 2024 11:25:28 -0700 Subject: [PATCH 152/197] For pm-cpu, use 2 nodes for default with tests using l%360x720cru eg SMS.hcru_hcru.IELM --- components/elm/cime_config/config_pes.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/components/elm/cime_config/config_pes.xml b/components/elm/cime_config/config_pes.xml index 4af0da69965..9dbc776bcac 100644 --- a/components/elm/cime_config/config_pes.xml +++ b/components/elm/cime_config/config_pes.xml @@ -239,14 +239,14 @@ elm: pm-cpu 2 nodes for grid l%360x720cru - 192 - 192 - 192 - 192 - 192 - 192 - 192 - 192 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 @@ -568,7 +568,7 @@ - + GIS 20km (low-res) testing config 128 @@ -606,7 +606,7 @@ - + GIS 1-to-10km (high-res) config 128 From fdb2218352fe267d10317a6598cb8dcdf0669e56 Mon Sep 17 00:00:00 2001 From: "Andrew M. Bradley" Date: Tue, 3 Sep 2024 14:21:37 -0500 Subject: [PATCH 153/197] Hommexx: Use portable PRIx64 instead of lx in printf. --- .../homme/src/share/cxx/utilities/InternalDiagnostics.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/homme/src/share/cxx/utilities/InternalDiagnostics.cpp b/components/homme/src/share/cxx/utilities/InternalDiagnostics.cpp index 3249966c0b5..ffc9657f410 100644 --- a/components/homme/src/share/cxx/utilities/InternalDiagnostics.cpp +++ b/components/homme/src/share/cxx/utilities/InternalDiagnostics.cpp @@ -13,6 +13,8 @@ #include "TimeLevel.hpp" #include "mpi/Comm.hpp" +#include + namespace Homme { namespace { @@ -50,10 +52,10 @@ void print_global_state_hash (const std::string& label) { all_reduce_HashType(comm.mpi_comm(), accum, gaccum, 5); if (comm.root()) { for (int i = 0; i < NUM_TIME_LEVELS; ++i) - fprintf(stderr, "hxxhash> %14d %1d %16lx (E %s)\n", + fprintf(stderr, "hxxhash> %14d %1d %16" PRIx64 " (E %s)\n", tl.nstep, i, gaccum[i], label.c_str()); for (int i = 0; i < Q_NUM_TIME_LEVELS; ++i) - fprintf(stderr, "hxxhash> %14d %1d %16lx (T %s)\n", + fprintf(stderr, "hxxhash> %14d %1d %16" PRIx64 " (T %s)\n", tl.nstep, i, gaccum[NUM_TIME_LEVELS+i], label.c_str()); } } From 73a96413bcf2c8d5195313ca2ece05ba47d2ee7f Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Tue, 3 Sep 2024 15:03:46 -0500 Subject: [PATCH 154/197] Add to list of the supported coupled compsets --- docs/user-guide/index.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index c2daf519a42..01890a0d41c 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -37,6 +37,16 @@ Below list the standard configuration compsets supported in the current version |`WCYCLSSP245` | Standard configuration with prescribed SSP-245 forcings | |`WCYCLSSP370` | Standard configuration with prescribed SSP-370 forcings | |`WCYCLSSP585` | Standard configuration with prescribed SSP-585 forcings | +| | +|Extra Compsets |For single-forcings simulations of the historical period (1850-2014) | +|`WCYCL20TR-GHG` | Greenhouse gases only configuration (`GHGs`)| +|`WCYCL20TR-aer` | Anthropogenic aerosols and precursors only configuration (`aer`)| +|`WCYCL20TR-xGHG-xaer` | All forcings except GHGs and aer (`solar irradiance, stratospheric ozone and volcanic emissions, land use land cover`) | +|`WCYCL20TR-xaer` | All forcings except aer (`GHGs, solar irradiance, stratospheric ozone and volcanic emissions, land use land cover`) | +|`WCYCL20TR-nat` | Natural-only configuration (`solar irradiance, stratospheric volcanic emissions, land use land cover`) | +|`WCYCL20TR-ozone` | Stratospheric ozone only configuration | +|`WCYCL20TR-lulc` | Land use land cover only configuration | +|`WCYCL20TR-volc` | Stratospheric volcanic emissions only configuration | The compsets for the other two science simulation campaigns are being finalized, with additional components and/or features. The compset naming follows the same convention, e.g., `CRYO1850` and `CRYO1850-4xCO2` are with prognostic ice-shelf melt fluxes for the `polar processes` simulation campaign. From 72f544fff76ae812174be4887568a704d14d7337 Mon Sep 17 00:00:00 2001 From: noel Date: Tue, 3 Sep 2024 14:51:44 -0700 Subject: [PATCH 155/197] Use 3 full nodes instead of 2 in last commit to avoid yet a different issue. --- components/elm/cime_config/config_pes.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/components/elm/cime_config/config_pes.xml b/components/elm/cime_config/config_pes.xml index 9dbc776bcac..39e36221175 100644 --- a/components/elm/cime_config/config_pes.xml +++ b/components/elm/cime_config/config_pes.xml @@ -237,16 +237,16 @@ - elm: pm-cpu 2 nodes for grid l%360x720cru - - -2 - -2 - -2 - -2 - -2 - -2 - -2 - -2 + elm: pm-cpu 3 nodes for grid l%360x720cru + + -3 + -3 + -3 + -3 + -3 + -3 + -3 + -3 From 846531dc611d44d0d056dae0d0a9f68159c85a63 Mon Sep 17 00:00:00 2001 From: mahf708 Date: Tue, 3 Sep 2024 18:19:51 -0500 Subject: [PATCH 156/197] fix minor bug and add mkatmsrffile workflow --- .../e3sm-gh-tools-mkatmsrffile-test.yml | 86 +++++++++++++++++++ .../eam/tools/mkatmsrffile/mkatmsrffile.py | 14 +-- 2 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml diff --git a/.github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml b/.github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml new file mode 100644 index 00000000000..13b73e4df3f --- /dev/null +++ b/.github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml @@ -0,0 +1,86 @@ +name: mkatmsrffile + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + paths: + - 'components/eam/tools/mkatmsrffile/mkatmsrffile.py' + schedule: + - cron: '00 15 * * 2' + workflow_dispatch: + +jobs: + mkatmsrffile-test: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + outputs: + event_name: ${{ github.event_name }} + steps: + - + name: Repository checkout + uses: actions/checkout@v4 + with: + show-progress: false + submodules: false + - + name: Conda setup + uses: conda-incubator/setup-miniconda@v3 + with: + activate-environment: "envmkatmsrffile" + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true + mamba-version: "*" + channel-priority: strict + auto-update-conda: true + python-version: 3.11 + - + name: Install dependencies + run: | + echo $CONDA_PREFIX + mamba install -y nco xarray numba numpy netcdf4 + - + name: Run tests + working-directory: components/eam/tools/mkatmsrffile + run: | + echo $CONDA_PREFIX + wget https://web.lcrc.anl.gov/public/e3sm/inputdata/atm/cam/chem/trop_mozart/dvel/clim_soilw.nc + wget https://web.lcrc.anl.gov/public/e3sm/inputdata/atm/cam/chem/trop_mozart/dvel/regrid_vegetation.nc + wget https://web.lcrc.anl.gov/public/e3sm/inputdata/atm/cam/chem/trop_mozart/dvel/map_1x1_to_ne30pg2_traave_c20240903.nc + python mkatmsrffile.py --map_file=map_1x1_to_ne30pg2_traave_c20240903.nc --vegetation_file=regrid_vegetation.nc --soil_water_file=clim_soilw.nc --dst_grid=ne30pg2 + + mkatmsrffile-notify: + needs: mkatmsrffile-test + if: ${{ failure() && needs.mkatmsrffile-test.outputs.event_name != 'pull_request' }} + runs-on: ubuntu-latest + steps: + - name: Create issue + run: | + previous_issue_number=$(gh issue list \ + --label "$LABELS" \ + --json number \ + --jq '.[0].number') + if [[ -n $previous_issue_number ]]; then + gh issue comment "$previous_issue_number" \ + --body "$BODY" + else + gh issue create \ + --title "$TITLE" \ + --assignee "$ASSIGNEES" \ + --label "$LABELS" \ + --body "$BODY" + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + TITLE: mkatmsrffile test failure + ASSIGNEES: whannah1 + LABELS: bug + BODY: | + Workflow failed! There's likely an issue in the mkatmsrffile tool! For more information, please see: + - Workflow URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} (number ${{ github.run_number }}, attempt ${{ github.run_attempt }}) + - Workflow SHA: ${{ github.sha }} diff --git a/components/eam/tools/mkatmsrffile/mkatmsrffile.py b/components/eam/tools/mkatmsrffile/mkatmsrffile.py index 268bd4ddd86..101671488f3 100644 --- a/components/eam/tools/mkatmsrffile/mkatmsrffile.py +++ b/components/eam/tools/mkatmsrffile/mkatmsrffile.py @@ -253,13 +253,13 @@ def main(): ds_out['lon'] = ds_map.xc_b.rename({'n_b':'ncol'}) ds_out['lat'] = ds_map.yc_b.rename({'n_b':'ncol'}) - ds.attrs['title'] = 'E3SM atmosphere surface data' - ds.attrs['source_code'] = source_code_meta - ds.attrs['hostname'] = str(host) - ds.attrs['history'] = f'created by {user}, '+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') - ds.attrs['input_map_file'] = opts.map_file - ds.attrs['input_vegetation_file'] = opts.vegetation_file - ds.attrs['input_soil_water_file'] = opts.soil_water_file + ds_out.attrs['title'] = 'E3SM atmosphere surface data' + ds_out.attrs['source_code'] = source_code_meta + ds_out.attrs['hostname'] = str(host) + ds_out.attrs['history'] = f'created by {user}, '+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ds_out.attrs['input_map_file'] = opts.map_file + ds_out.attrs['input_vegetation_file'] = opts.vegetation_file + ds_out.attrs['input_soil_water_file'] = opts.soil_water_file ds_out.to_netcdf(path=output_file,mode='w') From 9c88f0db5b974e40a79e1ee1ca5a5b7c69b6cae8 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Tue, 3 Sep 2024 18:51:45 -0500 Subject: [PATCH 157/197] Update docs for the new compsets --- docs/user-guide/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index 01890a0d41c..d32d6c65b13 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -37,8 +37,7 @@ Below list the standard configuration compsets supported in the current version |`WCYCLSSP245` | Standard configuration with prescribed SSP-245 forcings | |`WCYCLSSP370` | Standard configuration with prescribed SSP-370 forcings | |`WCYCLSSP585` | Standard configuration with prescribed SSP-585 forcings | -| | -|Extra Compsets |For single-forcings simulations of the historical period (1850-2014) | +| |Compsets for single-forcings simulations of the historical period (1850-2014) | |`WCYCL20TR-GHG` | Greenhouse gases only configuration (`GHGs`)| |`WCYCL20TR-aer` | Anthropogenic aerosols and precursors only configuration (`aer`)| |`WCYCL20TR-xGHG-xaer` | All forcings except GHGs and aer (`solar irradiance, stratospheric ozone and volcanic emissions, land use land cover`) | From 5c8c7369208f42ef2df9719d5c449f8cb78519e1 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Tue, 3 Sep 2024 20:40:18 -0500 Subject: [PATCH 158/197] Fix markdown text in user's guide --- docs/user-guide/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index d32d6c65b13..8674926526e 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -37,7 +37,7 @@ Below list the standard configuration compsets supported in the current version |`WCYCLSSP245` | Standard configuration with prescribed SSP-245 forcings | |`WCYCLSSP370` | Standard configuration with prescribed SSP-370 forcings | |`WCYCLSSP585` | Standard configuration with prescribed SSP-585 forcings | -| |Compsets for single-forcings simulations of the historical period (1850-2014) | +| | #### Compsets for single-forcings simulations of the historical period (1850-2014) | |`WCYCL20TR-GHG` | Greenhouse gases only configuration (`GHGs`)| |`WCYCL20TR-aer` | Anthropogenic aerosols and precursors only configuration (`aer`)| |`WCYCL20TR-xGHG-xaer` | All forcings except GHGs and aer (`solar irradiance, stratospheric ozone and volcanic emissions, land use land cover`) | From e757ed8c6f8bfe1a1acc3de019c8193e1d996dfb Mon Sep 17 00:00:00 2001 From: mahf708 Date: Tue, 3 Sep 2024 17:43:07 -0500 Subject: [PATCH 159/197] rename v1prod to prod, add eamxx to F testing --- .github/workflows/e3sm-gh-ci-cime-tests.yml | 5 ++++- cime_config/config_files.xml | 1 + .../{scream/v1prod => eamxx/prod}/shell_commands | 0 .../testmods_dirs/{scream/v1prod => eamxx/prod}/user_nl_cpl | 0 .../testmods_dirs/{scream/v1prod => eamxx/prod}/user_nl_elm | 0 .../yaml_outs/scream_output.decadal.1dailyAVG_native.yaml | 0 .../yaml_outs/scream_output.decadal.1dailyMAX_native.yaml | 0 .../yaml_outs/scream_output.decadal.1dailyMIN_native.yaml | 0 .../yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml | 0 .../yaml_outs/scream_output.decadal.1hourlyINST_native.yaml | 0 .../yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml | 0 .../yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml | 0 .../yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml | 0 .../yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml | 0 .../yaml_outs/scream_output.decadal.6hourlyINST_native.yaml | 0 .../yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml | 0 16 files changed, 5 insertions(+), 1 deletion(-) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/shell_commands (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/user_nl_cpl (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/user_nl_elm (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml (100%) rename components/eamxx/cime_config/testdefs/testmods_dirs/{scream/v1prod => eamxx/prod}/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml (100%) diff --git a/.github/workflows/e3sm-gh-ci-cime-tests.yml b/.github/workflows/e3sm-gh-ci-cime-tests.yml index 62f6c1542e7..f5c3ffcebf9 100644 --- a/.github/workflows/e3sm-gh-ci-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-cime-tests.yml @@ -8,12 +8,15 @@ on: - '.github/workflows/e3sm-gh-ci-cime-tests.yml' - 'cime_config/**' - 'components/eam/**' + - 'components/eamxx/**' - 'components/elm/**' - 'driver-moab/**' - 'driver-mct/**' # second, no to these - '!components/eam/docs/**' - '!components/eam/mkdocs.yml' + - '!components/eamxx/docs/**' + - '!components/eamxx/mkdocs.yml' - '!components/elm/docs/**' - '!components/elm/mkdocs.yml' @@ -31,7 +34,7 @@ jobs: - SMS_D_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - ERS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu.eam-wcprod_F2010 - SMS_D_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu - - ERS_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu.scream-v1prod + - ERS_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu.eamxx-prod container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 diff --git a/cime_config/config_files.xml b/cime_config/config_files.xml index 281291798db..e88a9d68f62 100644 --- a/cime_config/config_files.xml +++ b/cime_config/config_files.xml @@ -348,6 +348,7 @@ $COMP_ROOT_DIR_ICE/cime_config/testdefs/testmods_dirs $COMP_ROOT_DIR_ROF/cime_config/testdefs/testmods_dirs $COMP_ROOT_DIR_ATM/cime_config/testdefs/testmods_dirs + $COMP_ROOT_DIR_ATM/cime_config/testdefs/testmods_dirs $COMP_ROOT_DIR_OCN/cime_config/testdefs/testmods_dirs $COMP_ROOT_DIR_ICE/cime_config/testdefs/testmods_dirs $COMP_ROOT_DIR_WAV/cime_config/testdefs/testmods_dirs diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/shell_commands b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/shell_commands similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/shell_commands rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/shell_commands diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_cpl b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/user_nl_cpl similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_cpl rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/user_nl_cpl diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_elm b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/user_nl_elm similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/user_nl_elm rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/user_nl_elm diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1dailyAVG_native.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1dailyMAX_native.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1dailyMIN_native.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1hourlyINST_arm.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.1hourlyINST_native.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.3hourlyAVG_coarse.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.3hourlyINST_coarse.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.6hourlyAVG_coarse.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.6hourlyINST_coarse.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.6hourlyINST_native.yaml diff --git a/components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml b/components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml similarity index 100% rename from components/eamxx/cime_config/testdefs/testmods_dirs/scream/v1prod/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml rename to components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/prod/yaml_outs/scream_output.decadal.dailyAVG_coarse.yaml From 71326bde3bebf5569cc050adc65b7ce2cbd69b10 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 4 Sep 2024 10:14:27 -0600 Subject: [PATCH 160/197] Another fix for CIME mvk and pgn --- cime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime b/cime index 52787427846..2a3142fc14b 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit 52787427846eec58038ab59664fd9c2706f23513 +Subproject commit 2a3142fc14b18fd58379f98d7d2a9a8b4b0d43a8 From 72cebf6f1c6b70efdada9d7907f49c885d0a2f71 Mon Sep 17 00:00:00 2001 From: noel Date: Wed, 4 Sep 2024 10:26:32 -0700 Subject: [PATCH 161/197] fix white spaces only. see next commit for real change --- components/eam/src/dynamics/se/dyn_grid.F90 | 130 ++++++++++---------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/components/eam/src/dynamics/se/dyn_grid.F90 b/components/eam/src/dynamics/se/dyn_grid.F90 index c39b3aea730..6294fafe20f 100644 --- a/components/eam/src/dynamics/se/dyn_grid.F90 +++ b/components/eam/src/dynamics/se/dyn_grid.F90 @@ -1,28 +1,28 @@ module dyn_grid - !------------------------------------------------------------------------------------------------- - ! + !------------------------------------------------------------------------------------------------- + ! ! Purpose: Definition of dynamics computational grid. - ! - ! The grid used by the SE dynamics is called the GLL grid, which is - ! made up up of elements that correspond to "blocks". The columns + ! + ! The grid used by the SE dynamics is called the GLL grid, which is + ! made up up of elements that correspond to "blocks". The columns ! within each element are located at the Gauss-Lobatto-Legendre (GLL) ! quadrature points. The GLL nodes can be used as the physics columns ! as well, but this can lead to grid imprinting. The physics can also - ! be done on a quasi-equal area FV grid when fv_nphys>0, which will + ! be done on a quasi-equal area FV grid when fv_nphys>0, which will ! define fv_nphys^2 cells per element. - ! + ! ! Method: Variables are private; interface routines used to extract ! information for use in user code. Global column index range - ! defined using full (unreduced) grid. - ! + ! defined using full (unreduced) grid. + ! ! Entry points: - ! get_block_bounds_d get first and last indices in global + ! get_block_bounds_d get first and last indices in global ! block ordering ! get_block_gcol_d get column indices for given block ! get_block_gcol_cnt_d get number of columns in given block ! get_block_lvl_cnt_d get number of vertical levels in column ! get_block_levels_d get vertical levels in column - ! get_gcol_block_d get global block indices and local columns + ! get_gcol_block_d get global block indices and local columns ! index for given global column index ! get_gcol_block_cnt_d get number of blocks containing data ! from a given global column index @@ -31,14 +31,14 @@ module dyn_grid ! information ! get_horiz_grid_dim_d get horizontal dimensions of dynamics grid ! dyn_grid_get_pref get reference pressures for the dynamics grid - ! dyn_grid_get_elem_coords get coordinates of a specified block element + ! dyn_grid_get_elem_coords get coordinates of a specified block element ! of the dynamics grid ! dyn_grid_find_gcols finds nearest column for given lat/lon - ! dyn_grid_get_colndx get element block/column and MPI process indices + ! dyn_grid_get_colndx get element block/column and MPI process indices ! corresponding to a specified global column index ! ! Author: Jim Edwards and Patrick Worley - ! + ! !------------------------------------------------------------------------------------------------- use element_mod, only: element_t use cam_logfile, only: iulog @@ -60,7 +60,7 @@ module dyn_grid integer, parameter, public :: physgrid_d = 102 ! FV physics grid resolution (physics on GLL grid if NPG=0) - integer, parameter, public :: fv_nphys = NPG + integer, parameter, public :: fv_nphys = NPG integer :: ngcols_d = 0 ! number of dynamics columns logical :: gblocks_need_initialized = .true. @@ -113,9 +113,9 @@ end subroutine dyn_grid_init !================================================================================================= ! subroutine get_block_bounds_d(block_first,block_last) - !--------------------------------------------------------------------------- + !--------------------------------------------------------------------------- ! Purpose: Return first and last indices used in global block ordering - ! + ! ! Author: Jim Edwards !------------------------------Arguments------------------------------------ integer, intent(out) :: block_first ! first (global) index used for blocks @@ -129,9 +129,9 @@ end subroutine get_block_bounds_d !================================================================================================= ! subroutine get_block_gcol_d(blockid,size,cdex) - !--------------------------------------------------------------------------- + !--------------------------------------------------------------------------- ! Purpose: Return list of dynamics column indices in given block - ! + ! ! Author: Jim Edwards !--------------------------------------------------------------------------- implicit none @@ -160,9 +160,9 @@ end subroutine get_block_gcol_d !================================================================================================= ! integer function get_block_gcol_cnt_d(blockid) - !--------------------------------------------------------------------------- + !--------------------------------------------------------------------------- ! Purpose: Return number of dynamics columns in indicated block - ! + ! ! Author: Jim Edwards !------------------------------Arguments------------------------------------ integer, intent(in) :: blockid @@ -243,11 +243,11 @@ subroutine get_gcol_block_d(gcol, cnt, blockid, bcid, localblockid) use kinds, only: int_kind use cam_abortutils, only: endrun !--------------------------------------------------------------------------- - ! Purpose: Return global block index and local column index for + ! Purpose: Return global block index and local column index for ! global column index. Element array is naturally ordered. - ! + ! ! Author: Jim Edwards - ! Modified: replaced linear search with best guess and binary search + ! Modified: replaced linear search with best guess and binary search ! (Pat Worley, 7/2/09) !--------------------------------------------------------------------------- implicit none @@ -378,7 +378,7 @@ integer function get_gcol_block_cnt_d(gcol) !--------------------------------------------------------------------------- ! Purpose: Return number of blocks contain data for the vertical column ! with the given global column index - ! + ! ! Author: Patrick Worley !--------------------------------------------------------------------------- implicit none @@ -392,9 +392,9 @@ end function get_gcol_block_cnt_d !================================================================================================= ! integer function get_block_owner_d(blockid) - !--------------------------------------------------------------------------- + !--------------------------------------------------------------------------- ! Purpose: Return id of processor that "owns" the indicated block - ! + ! ! Author: Jim Edwards !--------------------------------------------------------------------------- implicit none @@ -402,7 +402,7 @@ integer function get_block_owner_d(blockid) integer, intent(in) :: blockid ! global block id !--------------------------------------------------------------------------- if (gblocks_need_initialized) call gblocks_init() - + if (gblocks(blockid)%Owner>-1) then get_block_owner_d=gblocks(blockid)%Owner else @@ -419,7 +419,7 @@ subroutine get_horiz_grid_dim_d(hdim1_d,hdim2_d) ! Purpose: Returns declared horizontal dimensions of computational grid. ! For non-lon/lat grids, declare grid to be one-dimensional, ! i.e., (ngcols_d x 1) - ! + ! ! Author: Patrick Worley !------------------------------Arguments------------------------------------ integer, intent(out) :: hdim1_d ! first horizontal dimension @@ -430,7 +430,7 @@ subroutine get_horiz_grid_dim_d(hdim1_d,hdim2_d) else hdim1_d = ngcols_d end if ! fv_nphys > 0 - + if (present(hdim2_d)) hdim2_d = 1 return @@ -441,7 +441,7 @@ end subroutine get_horiz_grid_dim_d subroutine set_horiz_grid_cnt_d(NumUniqueCols) !--------------------------------------------------------------------------- ! Purpose: Set number of columns in the dynamics computational grid - ! + ! ! Author: Jim Edwards !--------------------------------------------------------------------------- use dimensions_mod, only: nelem, nelemd, np, npsq @@ -454,7 +454,7 @@ subroutine set_horiz_grid_cnt_d(NumUniqueCols) integer :: ie, i, j, ii logical, save :: local_coords_initialized = .false. real(r8) :: areaw(np, np) - type(index_t), pointer :: idx + type(index_t), pointer :: idx !--------------------------------------------------------------------------- if (.not. local_coords_initialized) then ngcols_d = NumUniqueCols @@ -463,12 +463,12 @@ subroutine set_horiz_grid_cnt_d(NumUniqueCols) call endrun('set_horiz_grid_cnt_d: fdofp_local already defined') end if allocate(fdofp_local(npsq, nelemd)) - fdofp_local =0 + fdofp_local =0 do ie = 1, nelemd idx => elem(ie)%idxP do ii = 1, idx%NumUniquePts i = idx%ia(ii) - j = idx%ja(ii) + j = idx%ja(ii) fdofp_local((np*(j-1))+i,ie) = (idx%UniquePtoffset+ii-1) end do end do @@ -480,7 +480,7 @@ subroutine set_horiz_grid_cnt_d(NumUniqueCols) ! Now, fill in the appropriate values ii = 1 do ie = 1, nelemd - areaw = 1.0_r8 / elem(ie)%rspheremp(:,:) + areaw = 1.0_r8 / elem(ie)%rspheremp(:,:) pearea(ii:ii+npsq-1) = reshape(areaw, (/ np*np /)) pemap(ii:ii+npsq-1) = fdofp_local(:,ie) do j = 1, np @@ -503,14 +503,14 @@ end subroutine set_horiz_grid_cnt_d ! subroutine get_horiz_grid_d(nxy,clat_d_out,clon_d_out,area_d_out, & wght_d_out,lat_d_out,lon_d_out,cost_d_out) - !--------------------------------------------------------------------------- + !--------------------------------------------------------------------------- ! Purpose: Return latitude and longitude (in radians), column surface ! area (in radians squared) and surface integration weights ! for global column indices that will be passed to/from - ! physics. Optionally also return estimated physics - ! computational cost per global column for use in load + ! physics. Optionally also return estimated physics + ! computational cost per global column for use in load ! balancing. - ! + ! ! Author: Jim Edwards !------------------------------Arguments------------------------------------ integer, intent(in ) :: nxy ! array sizes @@ -572,7 +572,7 @@ subroutine get_horiz_grid_d(nxy,clat_d_out,clon_d_out,area_d_out, & end if if ( present(clat_d_out) .or. present(clon_d_out) ) then - + allocate( lat_d_rad_temp(nxy) ) allocate( lon_d_rad_temp(nxy) ) allocate( lat_d_deg_temp(nxy) ) @@ -628,7 +628,7 @@ subroutine define_cam_grids() !--------------------------------------------------------------------------- ! Create grid for data on HOMME GLL nodes !--------------------------------------------------------------------------- - ! When the FV physs grid is used the GLL grid output + ! When the FV physs grid is used the GLL grid output ! variables will use coordinates with the '_d' suffix. gridname = 'GLL' if (fv_nphys > 0) then @@ -670,7 +670,7 @@ subroutine define_cam_grids() call cam_grid_attribute_register(trim(gridname), trim(areaname), & 'gll grid areas', trim(ncolname), pearea, pemap) else - ! if single column model, then this attribute has to be handled + ! if single column model, then this attribute has to be handled ! by assigning just the SCM point. Else, the model will bomb out ! when writing the header information to history output area_scm(1) = 1.0_r8 / elem(1)%rspheremp(1,1) @@ -687,15 +687,15 @@ subroutine define_cam_grids() deallocate(pelon_deg) ! These can be nullified since the grid object has the reference - nullify(grid_map_d) + nullify(grid_map_d) nullify(pearea) nullify(pemap) !--------------------------------------------------------------------------- ! Create grid object for physics grid on the dynamics decomposition !--------------------------------------------------------------------------- - ! Following CAM6-SE the 'physgrid_d' grid is created and used to load the - ! PHIS field (i.e. surface topo) on the FV physics grid and then + ! Following CAM6-SE the 'physgrid_d' grid is created and used to load the + ! PHIS field (i.e. surface topo) on the FV physics grid and then ! interpolated to the GLL grid. This ensures consistent treatment of SGH. if (fv_nphys>0) then @@ -822,13 +822,13 @@ subroutine gblocks_init() end do end if - do ie = 1,nelemdmax + do ie = 1,nelemdmax if (ie<=nelemd) then rdispls(iam+1)=elem(ie)%idxP%UniquePtOffset-1 gid(iam+1)=elem(ie)%GlobalID lid(iam+1)=ie recvcounts(iam+1)=elem(ie)%idxP%NumUniquePts - else + else rdispls(iam+1) = 0 recvcounts(iam+1) = 0 gid(iam+1)=0 @@ -882,7 +882,7 @@ subroutine compute_global_area(area_d) end if if (fv_nphys > 0) then - + ncol_fv_gbl = fv_nphys*fv_nphys*nelem ncol_fv_lcl = fv_nphys*fv_nphys*nelemd allocate(rbuf(ncol_fv_gbl)) @@ -948,14 +948,14 @@ subroutine compute_global_area(area_d) deallocate(col_id_global) else ! physics is on GLL grid - + allocate(rbuf(ngcols_d)) - do ie = 1, nelemdmax + do ie = 1, nelemdmax if(ie <= nelemd) then displace(iam+1) = elem(ie)%idxp%UniquePtOffset-1 recvcnts(iam+1) = elem(ie)%idxP%NumUniquePts eb = displace(iam+1) + elem(ie)%idxp%NumUniquePts - areaw = 1.0_r8 / elem(ie)%rspheremp(:,:) + areaw = 1.0_r8 / elem(ie)%rspheremp(:,:) call UniquePoints(elem(ie)%idxP, areaw, area_d(displace(iam+1)+1:eb)) else displace(iam+1) = 0 @@ -1065,7 +1065,7 @@ subroutine compute_global_coords(clat, clon, lat_out, lon_out, corner_lat_out, c ! Gather global latitudes call mpi_allgatherv( lat_rad_local(:), recvcnts(iam+1), mpi_real8, rbuf, & recvcnts(:), displace(:), mpi_real8, mpicom, ierr) - + ! sort latitude according to global element ID do icol = 1,ncol_fv_gbl clat( col_id_global(icol) ) = rbuf(icol) @@ -1074,7 +1074,7 @@ subroutine compute_global_coords(clat, clon, lat_out, lon_out, corner_lat_out, c ! Gather global longitudes call mpi_allgatherv( lon_rad_local(:), recvcnts(iam+1), mpi_real8, rbuf, & recvcnts(:), displace(:), mpi_real8, mpicom, ierr) - + ! sort longitude according to global element ID do icol = 1,ncol_fv_gbl clon( col_id_global(icol) ) = rbuf(icol) @@ -1107,14 +1107,14 @@ subroutine compute_global_coords(clat, clon, lat_out, lon_out, corner_lat_out, c ! Gather latitude call mpi_allgatherv( corner_lat_rad_local(:,c), recvcnts(iam+1), mpi_real8, rbuf, & recvcnts(:), displace(:), mpi_real8, mpicom, ierr) - ! sort latitude + ! sort latitude do icol = 1,ncol_fv_gbl corner_lat_out( col_id_global(icol), c) = rbuf(icol) * rad2deg end do ! Gather longitude call mpi_allgatherv( corner_lon_rad_local(:,c), recvcnts(iam+1), mpi_real8, rbuf, & recvcnts(:), displace(:), mpi_real8, mpicom, ierr) - ! sort longitude + ! sort longitude do icol = 1,ncol_fv_gbl corner_lon_out( col_id_global(icol), c) = rbuf(icol) * rad2deg end do @@ -1179,7 +1179,7 @@ subroutine compute_global_coords(clat, clon, lat_out, lon_out, corner_lat_out, c call mpi_allgatherv(rbuf, recvcnts(iam+1), mpi_real8, clat, & recvcnts(:), displace(:), mpi_real8, mpicom, ierr) if (present(lat_out)) then - rbuf(1:recvcnts(iam+1)) = lat_out(sb:eb) + rbuf(1:recvcnts(iam+1)) = lat_out(sb:eb) call mpi_allgatherv(rbuf, recvcnts(iam+1), mpi_real8, lat_out, & recvcnts(:), displace(:), mpi_real8, mpicom, ierr) end if @@ -1188,12 +1188,12 @@ subroutine compute_global_coords(clat, clon, lat_out, lon_out, corner_lat_out, c call mpi_allgatherv(rbuf, recvcnts(iam+1), mpi_real8, clon, & recvcnts(:), displace(:), mpi_real8, mpicom, ierr) if (present(lon_out)) then - rbuf(1:recvcnts(iam+1)) = lon_out(sb:eb) + rbuf(1:recvcnts(iam+1)) = lon_out(sb:eb) call mpi_allgatherv(rbuf, recvcnts(iam+1), mpi_real8, lon_out, & recvcnts(:), displace(:), mpi_real8, mpicom, ierr) end if end do - + deallocate(rbuf) end if ! fv_nphys > 0 @@ -1275,7 +1275,7 @@ integer function get_dyn_grid_parm(name) result(ival) ival = fv_nphys*fv_nphys*nelem else ival = ngcols_d - end if + end if else if(name.eq.'plev') then ival = plev else if(name.eq.'plevp') then @@ -1318,10 +1318,10 @@ end subroutine dyn_grid_get_pref ! !================================================================================================= ! - subroutine dyn_grid_find_gcols( lat, lon, nclosest, owners, col, lbk, rlat, rlon, idyn_dists ) + subroutine dyn_grid_find_gcols( lat, lon, nclosest, owners, col, lbk, rlat, rlon, idyn_dists ) !--------------------------------------------------------------------------- - ! This returns the lat/lon information (and corresponding MPI task - ! numbers (owners)) of the global model grid columns nearest to the + ! This returns the lat/lon information (and corresponding MPI task + ! numbers (owners)) of the global model grid columns nearest to the ! input satellite coordinate (lat,lon) !--------------------------------------------------------------------------- use shr_const_mod, only: SHR_CONST_REARTH @@ -1415,7 +1415,7 @@ end subroutine dyn_grid_find_gcols ! !================================================================================================= ! - subroutine dyn_grid_get_colndx( igcol, nclosest, owners, col, lbk ) + subroutine dyn_grid_get_colndx( igcol, nclosest, owners, col, lbk ) !------------------------------Arguments------------------------------------ integer, intent(in) :: nclosest integer, intent(in) :: igcol(nclosest) @@ -1437,7 +1437,7 @@ subroutine dyn_grid_get_colndx( igcol, nclosest, owners, col, lbk ) call get_gcol_block_d( igcol(i), 1, blockid, bcid, lclblockid ) owners(i) = get_block_owner_d(blockid(1)) - + if (owners(i)==iam) then lbk(i) = lclblockid(1) ii = igcol(i)-elem(lbk(i))%idxp%UniquePtoffset+1 @@ -1448,7 +1448,7 @@ subroutine dyn_grid_get_colndx( igcol, nclosest, owners, col, lbk ) lbk(i) = -1 col(i) = -1 endif - + end do end subroutine dyn_grid_get_colndx From f0fa68c522af80e8390c69189fa5afa733179432 Mon Sep 17 00:00:00 2001 From: noel Date: Wed, 4 Sep 2024 10:30:29 -0700 Subject: [PATCH 162/197] create and use a module scope pointer to hold area for SCM that will survive until writing to netcdf file --- components/eam/src/dynamics/se/dyn_grid.F90 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/eam/src/dynamics/se/dyn_grid.F90 b/components/eam/src/dynamics/se/dyn_grid.F90 index 6294fafe20f..0faed9ea1d3 100644 --- a/components/eam/src/dynamics/se/dyn_grid.F90 +++ b/components/eam/src/dynamics/se/dyn_grid.F90 @@ -101,6 +101,7 @@ module dyn_grid real(r8), allocatable :: pelon_deg(:) ! pe-local longitudes (degrees) real(r8), pointer :: pearea(:) => null() ! pe-local areas integer(iMap), pointer :: pemap(:) => null() ! pe-local map for PIO decomp + real(r8), pointer :: pearea_scm(:) => null() ! special case: area for SCM (only 1 value) !=================================================================================================== contains @@ -618,7 +619,7 @@ subroutine define_cam_grids() integer(iMap), pointer :: grid_map_d(:,:) integer(iMap), pointer :: grid_map_p(:,:) integer :: ie, i, j, k, mapind ! Loop variables - real(r8) :: area_scm(1), lat, lon + real(r8) :: lat, lon integer :: ncols_p_lcl ! local column count integer :: ncols_p_gbl ! global column count integer(iMap), pointer :: physgrid_map(:) @@ -670,12 +671,13 @@ subroutine define_cam_grids() call cam_grid_attribute_register(trim(gridname), trim(areaname), & 'gll grid areas', trim(ncolname), pearea, pemap) else - ! if single column model, then this attribute has to be handled - ! by assigning just the SCM point. Else, the model will bomb out - ! when writing the header information to history output - area_scm(1) = 1.0_r8 / elem(1)%rspheremp(1,1) - call cam_grid_attribute_register(trim(gridname), trim(areaname), & - 'gll grid areas', trim(ncolname), area_scm) + ! If single column model, set pearea_scm(1) to be the area. + ! Then register attribute in same way as non-SCM to simplify. + allocate(pearea_scm(1)) + pearea_scm(1) = 1.0_r8 / elem(1)%rspheremp(1,1) + call cam_grid_attribute_register(trim(gridname), trim(areaname), & + 'gll grid areas', trim(ncolname), pearea_scm, pemap) + nullify(pearea_scm) end if ! .not. single_column call cam_grid_attribute_register(trim(gridname), 'np', '', np) From 04933000cb9e2390e5e2231ccba64fd49795e3f4 Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Wed, 4 Sep 2024 14:52:58 -0500 Subject: [PATCH 163/197] Add single forcing table Add table explaining what is fixed and what is varying in the single forcing compsets. --- docs/user-guide/index.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index 8674926526e..25d2d1c74c0 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -24,7 +24,7 @@ is available. A *fully coupled* compset is one which has active components for at least the atmosphere, ocean, land surface, ocean and sea-ice all interacting. Each compset is associated with a specific forcing condition. -Coupled compsets in E3SM are developed for three science-driven simulation campaigns: `water cycle change and impacts`, `human-earth system feedbacks`, and `polar processes, sea-level rise and coastal impacts`. The standard coupled configurations -- which consist of prognostic atmosphere, land, river, ocean and sea-ice components -- form the base physical coupled system and are mainly designed for `water cycle change and impacts` simulation campaign. +Coupled compsets in E3SM are developed for three science-driven simulation campaigns: **water cycle change and impacts**, **human-earth system feedbacks**, and **polar processes, sea-level rise and coastal impacts**. The standard coupled configurations -- which consist of prognostic atmosphere, land, river, ocean and sea-ice components -- form the base physical coupled system and are mainly designed for `water cycle change and impacts` simulation campaign. Below list the standard configuration compsets supported in the current version of E3SM: |Compset alias | Description | @@ -37,7 +37,7 @@ Below list the standard configuration compsets supported in the current version |`WCYCLSSP245` | Standard configuration with prescribed SSP-245 forcings | |`WCYCLSSP370` | Standard configuration with prescribed SSP-370 forcings | |`WCYCLSSP585` | Standard configuration with prescribed SSP-585 forcings | -| | #### Compsets for single-forcings simulations of the historical period (1850-2014) | +| | **Compsets for single-forcings simulations of the historical period (1850-2014)** | |`WCYCL20TR-GHG` | Greenhouse gases only configuration (`GHGs`)| |`WCYCL20TR-aer` | Anthropogenic aerosols and precursors only configuration (`aer`)| |`WCYCL20TR-xGHG-xaer` | All forcings except GHGs and aer (`solar irradiance, stratospheric ozone and volcanic emissions, land use land cover`) | @@ -47,6 +47,25 @@ Below list the standard configuration compsets supported in the current version |`WCYCL20TR-lulc` | Land use land cover only configuration | |`WCYCL20TR-volc` | Stratospheric volcanic emissions only configuration | +The table below specifies which forcing category is fixed at 1850 conditions and which are allowed to vary over the historical period +for each of the historical ("20TR") compsets including the single-forcing compsets. + +|Compset alias | GHGs | Aerosol & precursors | Oxidants | Ozone (CI & Linoz) | Volcano | Solar | Land Use & ndep/popdensa | +|:------------ |:-----: | :---: | :---: | :---: | :---: | :---: | :---: | +|`WCYCL20TR` | varying | varying | varying | varying | varying | varying | varying | +|`WCYCL20TR-GHG`| varying | 1850 | 1850 | 1850 | 1850 | 1850 | 1850 | +|`WCYCL20TR-aer`| 1850 | varying | varying | 1850 | 1850 | 1850 | 1850 | +|`WCYCL20TR-xGHG-xaer`| 1850 | 1850 | 1850 | varying | varying | varying | varying | +|`WCYCL20TR-xaer`| varying | 1850 | 1850 | varying | varying | varying | varying | +|`WCYCL20TR-nat`| 1850 | 1850 | 1850 | 1850 | varying | varying | 1850 | +|`WCYCL20TR-ozone`| 1850 | 1850 | 1850 | varying | 1850 | 1850 | 1850 | +|`WCYCL20TR-lulc`| 1850 | 1850 | 1850 | 1850 | 1850 | 1850 | varying | +|`WCYCL20TR-volc`| 1850 | 1850 | 1850 | 1850 | varying | 1850 | 1850 | + + +- *Volcano* refers to stratospheric volcanic SO2 emissions; *1850* for *Volcano refers to background (average) stratospheric volcanic emissions used in pre-industrial control experiments +- *Oxidants* always follow *Aerosol & precursors* for fixed or varying. + The compsets for the other two science simulation campaigns are being finalized, with additional components and/or features. The compset naming follows the same convention, e.g., `CRYO1850` and `CRYO1850-4xCO2` are with prognostic ice-shelf melt fluxes for the `polar processes` simulation campaign. From 344bacac97aa21aa158bce89d1680241be3079df Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Wed, 4 Sep 2024 15:16:50 -0500 Subject: [PATCH 164/197] Fix linting of markdown Fix linting of markdown --- docs/user-guide/index.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index 25d2d1c74c0..53fa28d64e2 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -62,8 +62,9 @@ for each of the historical ("20TR") compsets including the single-forcing compse |`WCYCL20TR-lulc`| 1850 | 1850 | 1850 | 1850 | 1850 | 1850 | varying | |`WCYCL20TR-volc`| 1850 | 1850 | 1850 | 1850 | varying | 1850 | 1850 | - -- *Volcano* refers to stratospheric volcanic SO2 emissions; *1850* for *Volcano refers to background (average) stratospheric volcanic emissions used in pre-industrial control experiments + +- *Volcano* refers to stratospheric volcanic SO2 emissions; *1850* for *Volcano* refers to background (average) stratospheric volcanic emissions used in pre-industrial control experiments + - *Oxidants* always follow *Aerosol & precursors* for fixed or varying. The compsets for the other two science simulation campaigns are being finalized, with additional components and/or features. From c23345d82da5667a9ebaacf05a7f1d87a7789fbb Mon Sep 17 00:00:00 2001 From: noel Date: Wed, 4 Sep 2024 13:20:22 -0700 Subject: [PATCH 165/197] use different routine signature -- tested correct what looks like an incorrect if conditional for scm and convert it to positive. only nullify is scm --- components/eam/src/dynamics/se/dyn_grid.F90 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/components/eam/src/dynamics/se/dyn_grid.F90 b/components/eam/src/dynamics/se/dyn_grid.F90 index 0faed9ea1d3..125cfbca7a6 100644 --- a/components/eam/src/dynamics/se/dyn_grid.F90 +++ b/components/eam/src/dynamics/se/dyn_grid.F90 @@ -667,17 +667,16 @@ subroutine define_cam_grids() ! The native HOMME GLL grid call cam_grid_register(trim(gridname), dyn_decomp, lat_coord, lon_coord, & grid_map_d,block_indexed=.false., unstruct=.true.) - if (.not.single_column .or. scm_multcols) then - call cam_grid_attribute_register(trim(gridname), trim(areaname), & - 'gll grid areas', trim(ncolname), pearea, pemap) - else - ! If single column model, set pearea_scm(1) to be the area. - ! Then register attribute in same way as non-SCM to simplify. + if (single_column .or. scm_multcols) then + ! If single column model, set pearea_scm(1) to be the area as 1 value to simplify allocate(pearea_scm(1)) pearea_scm(1) = 1.0_r8 / elem(1)%rspheremp(1,1) call cam_grid_attribute_register(trim(gridname), trim(areaname), & - 'gll grid areas', trim(ncolname), pearea_scm, pemap) - nullify(pearea_scm) + 'gll grid areas', trim(ncolname), pearea_scm) + else + call cam_grid_attribute_register(trim(gridname), trim(areaname), & + 'gll grid areas', trim(ncolname), pearea, pemap) + end if ! .not. single_column call cam_grid_attribute_register(trim(gridname), 'np', '', np) @@ -692,6 +691,9 @@ subroutine define_cam_grids() nullify(grid_map_d) nullify(pearea) nullify(pemap) + if (single_column .or. scm_multcols) then + nullify(pearea_scm) + endif !--------------------------------------------------------------------------- ! Create grid object for physics grid on the dynamics decomposition From 25fe7324339bc2aef8a4b9f37b84d72ca5a21350 Mon Sep 17 00:00:00 2001 From: Youngsung Kim Date: Wed, 7 Aug 2024 13:30:47 -0400 Subject: [PATCH 166/197] Update Frontier machine/compilers following system update - Retain current software modules instead of updating to the latest versions. - Add linker options to use GCC 12.2, addressing linker errors. - Utilize Fortran linker to resolve additional linker errors. - Replace hipcc with mpicxx for MPICXX macro in the GPU compiler definitions. - Adjust compiler priority to prioritize reliability over performance. - Temporarily comment out ADIOS2 configurations --- .../cmake_macros/amdclang_frontier.cmake | 5 ++++- .../cmake_macros/amdclanggpu_frontier.cmake | 13 ++++++------- .../cmake_macros/crayclang_frontier.cmake | 2 ++ .../cmake_macros/crayclanggpu_frontier.cmake | 11 +++++++---- .../machines/cmake_macros/gnu_frontier.cmake | 5 +++++ .../machines/cmake_macros/gnugpu_frontier.cmake | 16 +++++++++++----- cime_config/machines/config_machines.xml | 14 ++++++++------ 7 files changed, 43 insertions(+), 23 deletions(-) diff --git a/cime_config/machines/cmake_macros/amdclang_frontier.cmake b/cime_config/machines/cmake_macros/amdclang_frontier.cmake index 2df5074d11f..3727164933d 100644 --- a/cime_config/machines/cmake_macros/amdclang_frontier.cmake +++ b/cime_config/machines/cmake_macros/amdclang_frontier.cmake @@ -9,4 +9,7 @@ string(APPEND CPPDEFS " -DLINUX") if (COMP_NAME STREQUAL gptl) string(APPEND CPPDEFS " -DHAVE_NANOTIME -DBIT64 -DHAVE_SLASHPROC -DHAVE_COMM_F2C -DHAVE_TIMES -DHAVE_GETTIMEOFDAY") endif() -string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{CRAY_LIBSCI_PREFIX_DIR}/lib -lsci_amd") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/opt/cray/pe/gcc/12.2.0/snos/lib64 -lgfortran -lstdc++") + +# to support Fortran specific compiler intrinsic functions +set(E3SM_LINK_WITH_FORTRAN "TRUE") diff --git a/cime_config/machines/cmake_macros/amdclanggpu_frontier.cmake b/cime_config/machines/cmake_macros/amdclanggpu_frontier.cmake index 6f3c0074798..4412ea0de7b 100644 --- a/cime_config/machines/cmake_macros/amdclanggpu_frontier.cmake +++ b/cime_config/machines/cmake_macros/amdclanggpu_frontier.cmake @@ -1,8 +1,8 @@ set(MPICC "cc") -set(MPICXX "CC") +set(MPICXX "mpicxx") set(MPIFC "ftn") set(SCC "cc") -set(SCXX "CC") +set(SCXX "hipcc") set(SFC "ftn") string(APPEND CPPDEFS " -DLINUX") @@ -14,13 +14,12 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O2") string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2") string(APPEND SPIO_CMAKE_OPTS " -DPIO_ENABLE_TOOLS:BOOL=OFF") -string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{CRAY_LIBSCI_PREFIX_DIR}/lib -lsci_amd") -set(MPICXX "hipcc") -set(SCXX "hipcc") -string(APPEND CMAKE_CXX_FLAGS " -I$ENV{MPICH_DIR}/include --offload-arch=gfx90a") -string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{MPICH_DIR}/lib -lmpi -L$ENV{CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa") +string(APPEND CMAKE_CXX_FLAGS " --offload-arch=gfx90a") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/opt/cray/pe/gcc/12.2.0/snos/lib64 -lgfortran -lstdc++") string(APPEND KOKKOS_OPTIONS " -DKokkos_ENABLE_HIP=On -DKokkos_ARCH_ZEN3=On -DKokkos_ARCH_VEGA90A=On") set(USE_HIP "TRUE") string(APPEND CMAKE_HIP_FLAGS "${CXXFLAGS} -munsafe-fp-atomics -x hip") +set(E3SM_LINK_WITH_FORTRAN "TRUE") diff --git a/cime_config/machines/cmake_macros/crayclang_frontier.cmake b/cime_config/machines/cmake_macros/crayclang_frontier.cmake index 6c8d4164cb2..76ec41bdbe7 100644 --- a/cime_config/machines/cmake_macros/crayclang_frontier.cmake +++ b/cime_config/machines/cmake_macros/crayclang_frontier.cmake @@ -16,5 +16,7 @@ string(APPEND CMAKE_Fortran_FLAGS " -hipa0 -hzero") # Scorpio installs string(APPEND CMAKE_Fortran_FLAGS " -em -ef") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/opt/cray/pe/gcc/12.2.0/snos/lib64 -lgfortran -lstdc++") + # to support Fortran specific compiler intrinsic functions set(E3SM_LINK_WITH_FORTRAN "TRUE") diff --git a/cime_config/machines/cmake_macros/crayclanggpu_frontier.cmake b/cime_config/machines/cmake_macros/crayclanggpu_frontier.cmake index 32f125947b5..a37ccde439e 100644 --- a/cime_config/machines/cmake_macros/crayclanggpu_frontier.cmake +++ b/cime_config/machines/cmake_macros/crayclanggpu_frontier.cmake @@ -1,5 +1,6 @@ set(MPICC "cc") -set(MPICXX "hipcc") +set(MPICXX "mpicxx") +#set(MPICXX "CC") set(MPIFC "ftn") set(SCC "cc") set(SCXX "hipcc") @@ -33,7 +34,7 @@ set(HAS_F2008_CONTIGUOUS "TRUE") # -Wl,--allow-shlib-undefined was added to address rocm 5.4.3 Fortran linker issue: # /opt/rocm-5.4.3/lib/libhsa-runtime64.so.1: undefined reference to `std::condition_variable::wait(std::unique_lock&)@GLIBCXX_3.4.30' # AMD started building with GCC 12.2.0, which brings in a GLIBCXX symbol that isn't in CCE's default GCC toolchain. -string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--allow-multiple-definition -Wl,--allow-shlib-undefined") +#string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--allow-multiple-definition -Wl,--allow-shlib-undefined") # Switching to O3 for performance benchmarking # Will revisit any failing tests @@ -53,11 +54,13 @@ string(APPEND CMAKE_Fortran_FLAGS " -hipa0 -hzero -em -ef -hnoacc") string(APPEND SPIO_CMAKE_OPTS " -DPIO_ENABLE_TOOLS:BOOL=OFF") -string(APPEND CMAKE_CXX_FLAGS " -I$ENV{MPICH_DIR}/include --offload-arch=gfx90a") -string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{MPICH_DIR}/lib -lmpi -L$ENV{CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa") +string(APPEND CMAKE_CXX_FLAGS " --offload-arch=gfx90a") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa") string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{ROCM_PATH}/lib -lamdhip64") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/opt/cray/pe/gcc/12.2.0/snos/lib64 -lgfortran -lstdc++") string(APPEND KOKKOS_OPTIONS " -DKokkos_ENABLE_HIP=On -DKokkos_ARCH_ZEN3=On -DKokkos_ARCH_VEGA90A=On") set(USE_HIP "TRUE") string(APPEND CMAKE_HIP_FLAGS "${CXXFLAGS} -munsafe-fp-atomics -x hip") +set(E3SM_LINK_WITH_FORTRAN "TRUE") diff --git a/cime_config/machines/cmake_macros/gnu_frontier.cmake b/cime_config/machines/cmake_macros/gnu_frontier.cmake index 9b242243989..ee44a2ca08f 100644 --- a/cime_config/machines/cmake_macros/gnu_frontier.cmake +++ b/cime_config/machines/cmake_macros/gnu_frontier.cmake @@ -13,3 +13,8 @@ string(APPEND CMAKE_Fortran_FLAGS " -Wno-implicit-interface") string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2") string(APPEND CMAKE_C_FLAGS_RELEASE " -O2") + +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/opt/cray/pe/gcc/12.2.0/snos/lib64 -lgfortran -lstdc++") + +# to support Fortran specific compiler intrinsic functions +set(E3SM_LINK_WITH_FORTRAN "TRUE") diff --git a/cime_config/machines/cmake_macros/gnugpu_frontier.cmake b/cime_config/machines/cmake_macros/gnugpu_frontier.cmake index 174f8207d0d..6ca4b83d9c2 100644 --- a/cime_config/machines/cmake_macros/gnugpu_frontier.cmake +++ b/cime_config/machines/cmake_macros/gnugpu_frontier.cmake @@ -1,6 +1,6 @@ set(MPICC "cc") -set(MPICXX "hipcc") # Needs MPICH_CXX to use hipcc -set(MPIFC "ftn") # Linker needs to be the Cray wrapper ftn, not mpif90 +set(MPICXX "mpicxx") +set(MPIFC "ftn") set(SCC "cc") set(SCXX "hipcc") set(SFC "ftn") @@ -16,11 +16,17 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O2") string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2") string(APPEND SPIO_CMAKE_OPTS " -DPIO_ENABLE_TOOLS:BOOL=OFF") -set(E3SM_LINK_WITH_FORTRAN "TRUE") -string(APPEND CMAKE_CXX_FLAGS " -I$ENV{MPICH_DIR}/include --offload-arch=gfx90a") -string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/opt/cray/pe/gcc/11.2.0/snos/lib64/ -lgfortran -L/opt/rocm-5.4.0/lib -lhsa-runtime64 -L$ENV{MPICH_DIR}/lib -lmpi -L$ENV{CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa ") +string(APPEND CMAKE_CXX_FLAGS " --offload-arch=gfx90a") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L$ENV{ROCM_PATH}/lib -lamdhip64") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/opt/cray/pe/gcc/12.2.0/snos/lib64 -lgfortran -lstdc++") +# +#string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/opt/rocm-5.4.0/lib -lhsa-runtime64 -L$ENV{CRAY_MPICH_ROOTDIR}/gtl/lib -lmpi_gtl_hsa ") string(APPEND KOKKOS_OPTIONS " -DKokkos_ENABLE_HIP=On -DKokkos_ARCH_ZEN3=On -DKokkos_ARCH_VEGA90A=On -DKokkos_ENABLE_OPENMP=Off") set(USE_HIP "TRUE") string(APPEND CMAKE_HIP_FLAGS "${CXXFLAGS} -munsafe-fp-atomics -x hip") + + +set(E3SM_LINK_WITH_FORTRAN "TRUE") diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index 6cd9d585a25..2841df7200c 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -980,7 +980,7 @@ Frontier exascale supercomputer at ORNL. 9408 nodes, Node: 4 AMD MI250X GPUs (2 GCDs) ~ 8 GPUs, 512 GB HDB2E, AMD EPYC 64 cores, 512GB DDR4 .*frontier.* Linux - crayclang,gnu,amdclang,gnugpu,crayclanggpu,amdclanggpu + gnu,amdclang,crayclang,gnugpu,amdclanggpu,crayclanggpu mpich cli115 /lustre/orion/cli115/world-shared/frontier @@ -1042,8 +1042,7 @@ PrgEnv-cray PrgEnv-gnu/8.3.3 - - gcc gcc/11.2.0 + gcc gcc/12.2.0 craype-accel-amd-gfx90a @@ -1051,6 +1050,7 @@ cray-python/3.9.13.1 + cray-libsci subversion/1.14.1 git/2.36.1 cmake/3.21.3 @@ -1066,14 +1066,12 @@ 0.25 0 + $ENV{CRAY_LIBSCI_PREFIX_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH} $ENV{NETCDF_DIR} $ENV{PNETCDF_DIR} - - $ENV{CRAY_LIBSCI_DIR}/amd/4.0/x86_64/lib:$ENV{LD_LIBRARY_PATH} - --ntasks-per-gpu=$SHELL{echo "`./xmlquery --value MAX_MPITASKS_PER_NODE`/8"|bc} --gpu-bind=closest @@ -1090,6 +1088,9 @@ spread threads + From 8e6f5ecd8c5870d271790ddaedaa849b60fe7d89 Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Thu, 5 Sep 2024 13:23:32 -0500 Subject: [PATCH 167/197] remove CMIP6 from MMF compsets --- cime_config/allactive/config_compsets.xml | 6 +++--- components/eam/cime_config/config_compsets.xml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cime_config/allactive/config_compsets.xml b/cime_config/allactive/config_compsets.xml index ace33ae0917..e66f1e473d8 100755 --- a/cime_config/allactive/config_compsets.xml +++ b/cime_config/allactive/config_compsets.xml @@ -133,18 +133,18 @@ WCYCL1950-MMF1 - 1950SOI_EAM%CMIP6-MMF1_ELM%SPBC_MPASSI_MPASO_MOSART_SGLC_SWAV + 1950SOI_EAM%MMF1_ELM%SPBC_MPASSI_MPASO_MOSART_SGLC_SWAV WCYCL20TR-MMF1 - 20TRSOI_EAM%CMIP6-MMF1_ELM%SP_MPASSI_MPASO_MOSART_SGLC_SWAV + 20TRSOI_EAM%MMF1_ELM%SP_MPASSI_MPASO_MOSART_SGLC_SWAV WCYCL20TRNS-MMF1 - 20TR_EAM%CMIP6-MMF1_ELM%SP_MPASSI_MPASO_MOSART_SGLC_SWAV + 20TR_EAM%MMF1_ELM%SP_MPASSI_MPASO_MOSART_SGLC_SWAV diff --git a/components/eam/cime_config/config_compsets.xml b/components/eam/cime_config/config_compsets.xml index 39971fbb094..7050bd0c8f9 100644 --- a/components/eam/cime_config/config_compsets.xml +++ b/components/eam/cime_config/config_compsets.xml @@ -272,12 +272,12 @@ F20TR-MMF1 - 20TR_EAM%CMIP6-MMF1_ELM%SP_MPASSI%PRES_DOCN%DOM_MOSART_SGLC_SWAV + 20TR_EAM%MMF1_ELM%SP_MPASSI%PRES_DOCN%DOM_MOSART_SGLC_SWAV F20TR-MMF1 - 20TR_EAM%CMIP6-MMF2_ELM%SP_MPASSI%PRES_DOCN%DOM_MOSART_SGLC_SWAV + 20TR_EAM%MMF2_ELM%SP_MPASSI%PRES_DOCN%DOM_MOSART_SGLC_SWAV From e950299cd9e91622308d3a3318b33ee01025b700 Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Thu, 5 Sep 2024 17:00:26 -0500 Subject: [PATCH 168/197] Add eddy product AM to RRSwISC6to18 --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index c7441c6b221..64211f42c39 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -1111,6 +1111,7 @@ .false. +.true. '0000-00-00_01:00:00' 'eddyProductVariablesOutput' .true. From f88f96472d48567aafab8a125048bc1e2d14996b Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Thu, 5 Sep 2024 13:35:14 -0400 Subject: [PATCH 169/197] update all actions to use major pins and minor other fixes --- .github/workflows/e3sm-gh-pages.yml | 6 +++--- .github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml | 2 +- .github/workflows/eamxx-gh-pages.yml | 2 +- .github/workflows/eamxx_default_files.yml | 4 +++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e3sm-gh-pages.yml b/.github/workflows/e3sm-gh-pages.yml index 709fecc623a..ebd2ac9c1e9 100644 --- a/.github/workflows/e3sm-gh-pages.yml +++ b/.github/workflows/e3sm-gh-pages.yml @@ -30,10 +30,10 @@ jobs: submodules: true - name: Show action trigger run: echo "= The job was automatically triggered by a ${{github.event_name}} event on repo ${{github.event.repository.name}}." - - name: Set up Python 3.10 - uses: actions/setup-python@v5.2.0 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install python deps run: python3 -m pip install mkdocs-material pymdown-extensions mkdocs-monorepo-plugin mdutils mkdocs-bibtex # build every time (PR or push to master) diff --git a/.github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml b/.github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml index 13b73e4df3f..8fe212886d9 100644 --- a/.github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml +++ b/.github/workflows/e3sm-gh-tools-mkatmsrffile-test.yml @@ -79,7 +79,7 @@ jobs: GH_REPO: ${{ github.repository }} TITLE: mkatmsrffile test failure ASSIGNEES: whannah1 - LABELS: bug + LABELS: bug,notify-mkatmsrffile-gh-action BODY: | Workflow failed! There's likely an issue in the mkatmsrffile tool! For more information, please see: - Workflow URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} (number ${{ github.run_number }}, attempt ${{ github.run_attempt }}) diff --git a/.github/workflows/eamxx-gh-pages.yml b/.github/workflows/eamxx-gh-pages.yml index 7c9da3264d6..2ce70d97843 100644 --- a/.github/workflows/eamxx-gh-pages.yml +++ b/.github/workflows/eamxx-gh-pages.yml @@ -54,7 +54,7 @@ jobs: echo "= The job was automatically triggered by a ${{github.event_name}} event." - name: Set up Python 3.11 - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5 with: python-version: "3.11" diff --git a/.github/workflows/eamxx_default_files.yml b/.github/workflows/eamxx_default_files.yml index fa84f9f96f0..950f335700e 100644 --- a/.github/workflows/eamxx_default_files.yml +++ b/.github/workflows/eamxx_default_files.yml @@ -5,6 +5,8 @@ on: branches: [ master ] pull_request: branches: [ master ] + paths: + - 'components/eamxx/cime_config/namelist_defaults_scream.xml' schedule: - cron: '00 00 * * *' workflow_dispatch: @@ -21,7 +23,7 @@ jobs: show-progress: false submodules: false - name: Set up Python 3.11 - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5 with: python-version: "3.11" - name: Run unit tests From 835ca84d8a97613f9553b2203957b052caea7057 Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Fri, 6 Sep 2024 09:39:52 -0500 Subject: [PATCH 170/197] simplify CMIP6 physics default config for EAM --- components/eam/cime_config/config_component.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/components/eam/cime_config/config_component.xml b/components/eam/cime_config/config_component.xml index 655d7be5503..d20a8c400cc 100755 --- a/components/eam/cime_config/config_component.xml +++ b/components/eam/cime_config/config_component.xml @@ -51,10 +51,7 @@ -mach $MACH -phys default - &eamv3_phys_defaults; &eamv3_chem_defaults; - &eamv3_phys_defaults; &eamv3_chem_defaults; - &eamv3_phys_defaults; &eamv3_chem_defaults; - &eamv3_phys_defaults; &eamv3_chem_defaults; + &eamv3_phys_defaults; &eamv3_chem_defaults; -bc_dep_to_snow_updates -co2_cycle From 8208d4bd376f0cb8b51658f077b3941121ec1d8d Mon Sep 17 00:00:00 2001 From: Walter Hannah Date: Fri, 6 Sep 2024 09:40:29 -0500 Subject: [PATCH 171/197] specify ELM use case for MMF transient compset --- components/elm/cime_config/config_component.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/elm/cime_config/config_component.xml b/components/elm/cime_config/config_component.xml index 00518b5dc78..4e637ef5580 100755 --- a/components/elm/cime_config/config_component.xml +++ b/components/elm/cime_config/config_component.xml @@ -81,6 +81,7 @@ 20thC_CMIP6_transient 20thC_CMIP6_transient 20thC_CMIP6_transient + 20thC_CMIP6_transient 20thC_CMIP6bgc_transient 20thC_CMIP6bgc_transient 20thC_bgc_transient From 8f670095dcbf1d7fe22470031fdbdf8f2e0a8eff Mon Sep 17 00:00:00 2001 From: noel Date: Sat, 7 Sep 2024 11:36:45 -0700 Subject: [PATCH 172/197] correct my logic mistake in previous commit --- components/eam/src/dynamics/se/dyn_grid.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/eam/src/dynamics/se/dyn_grid.F90 b/components/eam/src/dynamics/se/dyn_grid.F90 index 125cfbca7a6..a4a8424f887 100644 --- a/components/eam/src/dynamics/se/dyn_grid.F90 +++ b/components/eam/src/dynamics/se/dyn_grid.F90 @@ -667,16 +667,15 @@ subroutine define_cam_grids() ! The native HOMME GLL grid call cam_grid_register(trim(gridname), dyn_decomp, lat_coord, lon_coord, & grid_map_d,block_indexed=.false., unstruct=.true.) - if (single_column .or. scm_multcols) then + if (.not.single_column .or. scm_multcols) then + call cam_grid_attribute_register(trim(gridname), trim(areaname), & + 'gll grid areas', trim(ncolname), pearea, pemap) + else ! If single column model, set pearea_scm(1) to be the area as 1 value to simplify allocate(pearea_scm(1)) pearea_scm(1) = 1.0_r8 / elem(1)%rspheremp(1,1) call cam_grid_attribute_register(trim(gridname), trim(areaname), & 'gll grid areas', trim(ncolname), pearea_scm) - else - call cam_grid_attribute_register(trim(gridname), trim(areaname), & - 'gll grid areas', trim(ncolname), pearea, pemap) - end if ! .not. single_column call cam_grid_attribute_register(trim(gridname), 'np', '', np) @@ -691,7 +690,8 @@ subroutine define_cam_grids() nullify(grid_map_d) nullify(pearea) nullify(pemap) - if (single_column .or. scm_multcols) then + if (.not.single_column .or. scm_multcols) then + else nullify(pearea_scm) endif From 1ead26f943a8d38c510eebb27872f7ebb238f092 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Sun, 8 Sep 2024 15:05:47 -0500 Subject: [PATCH 173/197] Update ndep and popdens files for all configs including default --- components/elm/bld/namelist_files/namelist_defaults.xml | 6 +++--- .../namelist_files/use_cases/2015-2100_SSP245_transient.xml | 6 ++++-- .../namelist_files/use_cases/2015-2100_SSP370_transient.xml | 6 ++++-- .../namelist_files/use_cases/2015-2100_SSP585_transient.xml | 6 ++++-- .../bld/namelist_files/use_cases/20thC_CMIP6_transient.xml | 6 +++--- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/components/elm/bld/namelist_files/namelist_defaults.xml b/components/elm/bld/namelist_files/namelist_defaults.xml index e76a5647b4e..e66ebfa637b 100644 --- a/components/elm/bld/namelist_files/namelist_defaults.xml +++ b/components/elm/bld/namelist_files/namelist_defaults.xml @@ -666,7 +666,7 @@ this mask will have smb calculated over the entire global land surface 2000 2100 -lnd/clm2/ndepdata/fndep_elm_cbgc_exp_simyr1849-2101_1.9x2.5_c190103.nc +lnd/clm2/ndepdata/fndep_elm_cbgc_exp_simyr1849-2101_1.9x2.5_ssp245_c240903.nc lnd/clm2/ndepdata/fndep_clm_rcp8.5_simyr1849-2106_1.9x2.5_c100428.nc lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100810.nc lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc @@ -899,8 +899,8 @@ this mask will have smb calculated over the entire global land surface 1850 2010 -lnd/clm2/firedata/elmforc.ssp5_hdm_0.5x0.5_simyr1850-2100_c190109.nc -lnd/clm2/firedata/elmforc.ssp5_hdm_0.5x0.5_simyr1850-2100_c190109.nc +lnd/clm2/firedata/elmforc.Li_20181205_mod_hist_SSP2_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c240906.nc +lnd/clm2/firedata/elmforc.Li_20181205_mod_hist_SSP2_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c240906.nc bilinear diff --git a/components/elm/bld/namelist_files/use_cases/2015-2100_SSP245_transient.xml b/components/elm/bld/namelist_files/use_cases/2015-2100_SSP245_transient.xml index e313dab6b16..6e664162609 100755 --- a/components/elm/bld/namelist_files/use_cases/2015-2100_SSP245_transient.xml +++ b/components/elm/bld/namelist_files/use_cases/2015-2100_SSP245_transient.xml @@ -17,8 +17,10 @@ + + 1850 -2005 +2101 1850 2000 @@ -26,7 +28,7 @@ 2000 1850 -2010 +2100 1850 diff --git a/components/elm/bld/namelist_files/use_cases/2015-2100_SSP370_transient.xml b/components/elm/bld/namelist_files/use_cases/2015-2100_SSP370_transient.xml index 0e8415d3c1a..0c54a8ce603 100755 --- a/components/elm/bld/namelist_files/use_cases/2015-2100_SSP370_transient.xml +++ b/components/elm/bld/namelist_files/use_cases/2015-2100_SSP370_transient.xml @@ -18,16 +18,18 @@ 1850 -2005 +2101 1850 +lnd/clm2/ndepdata/fndep_elm_cbgc_exp_simyr1849-2101_1.9x2.5_ssp370_c220614.nc 2000 2000 2000 1850 -2010 +2100 1850 +lnd/clm2/firedata/elmforc.Li_20181205_mod_hist_SSP3_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c240906.nc diff --git a/components/elm/bld/namelist_files/use_cases/2015-2100_SSP585_transient.xml b/components/elm/bld/namelist_files/use_cases/2015-2100_SSP585_transient.xml index 2db3549ce5f..c297dffe113 100644 --- a/components/elm/bld/namelist_files/use_cases/2015-2100_SSP585_transient.xml +++ b/components/elm/bld/namelist_files/use_cases/2015-2100_SSP585_transient.xml @@ -18,16 +18,18 @@ 1850 -2005 +2101 1850 +lnd/clm2/ndepdata/fndep_elm_cbgc_exp_simyr1849-2101_1.9x2.5_ssp585_c190103.nc 2000 2000 2000 1850 -2010 +2100 1850 +lnd/clm2/firedata/elmforc.Li_20181205_mod_hist_SSP5_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c240906.nc diff --git a/components/elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml b/components/elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml index 92f186f1a38..a919a484791 100644 --- a/components/elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml +++ b/components/elm/bld/namelist_files/use_cases/20thC_CMIP6_transient.xml @@ -9,7 +9,7 @@ 1850 -1850-2000 +1850-2015 arb_ic @@ -18,7 +18,7 @@ 1850 -2005 +2101 1850 @@ -27,7 +27,7 @@ 2000 1850 -2010 +2100 1850 From 84de5e161bc93c8980d20eafaa5ae9deea2edda5 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Sun, 8 Sep 2024 15:06:31 -0500 Subject: [PATCH 174/197] Reset default/placeholder co2vmr value for ssp245 --- driver-mct/cime_config/config_component_e3sm.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/driver-mct/cime_config/config_component_e3sm.xml b/driver-mct/cime_config/config_component_e3sm.xml index 08758f93531..8647bdda189 100755 --- a/driver-mct/cime_config/config_component_e3sm.xml +++ b/driver-mct/cime_config/config_component_e3sm.xml @@ -753,8 +753,7 @@ 312.821 388.717 388.717 - 0.000001 - 0.000001 + 0.000001 284.317 284.317 284.317 From a0e3ffd9bab97e983078c5ee321370ac3356c451 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Sun, 8 Sep 2024 21:30:03 -0700 Subject: [PATCH 175/197] Explicitly set dust_emis_scheme=2 for MMF --- driver-mct/cime_config/config_component_e3sm.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/driver-mct/cime_config/config_component_e3sm.xml b/driver-mct/cime_config/config_component_e3sm.xml index acdca60ae2a..feaa8f270a1 100755 --- a/driver-mct/cime_config/config_component_e3sm.xml +++ b/driver-mct/cime_config/config_component_e3sm.xml @@ -863,6 +863,7 @@ 1 2 + 2 shr_dust_nl env_run.xml From e7eb37a35330c10a76d5b0a0ef808b6f6ef2de82 Mon Sep 17 00:00:00 2001 From: Jinyun Tang Date: Mon, 9 Sep 2024 11:40:32 -0500 Subject: [PATCH 176/197] bug fix for N balance error due to spval value for land use simulation When the land use data is on, at the begining of every year, the model may crash with N balance error due to including spval value in N leaching flux update. This update fixes this error by keeping those spval values away. The fix should be BFB for simulations do not involve land use data. --- .../elm/src/data_types/ColumnDataType.F90 | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/components/elm/src/data_types/ColumnDataType.F90 b/components/elm/src/data_types/ColumnDataType.F90 index 724cefb5cfd..d0a4a10cd3d 100644 --- a/components/elm/src/data_types/ColumnDataType.F90 +++ b/components/elm/src/data_types/ColumnDataType.F90 @@ -7538,14 +7538,16 @@ subroutine col_cf_summary(this, bounds, num_soilc, filter_soilc, isotope) c = filter_soilc(fc) this%decomp_cpools_leached(c,l) = 0._r8 end do - do j = 1, nlev - do fc = 1,num_soilc + if(l /= i_cwd)then + do j = 1, nlev + do fc = 1,num_soilc c = filter_soilc(fc) this%decomp_cpools_leached(c,l) = & this%decomp_cpools_leached(c,l) + & this%decomp_cpools_transport_tendency(c,j,l) * dzsoi_decomp(j) - end do - end do + end do + end do + endif do fc = 1,num_soilc c = filter_soilc(fc) this%som_c_leached(c) = & @@ -9784,8 +9786,9 @@ subroutine col_nf_summary(this, bounds, num_soilc, filter_soilc) c = filter_soilc(fc) this%decomp_npools_leached(c,l) = 0._r8 end do - do j = 1, nlev - do fc = 1,num_soilc + if(l /= i_cwd)then + do j = 1, nlev + do fc = 1,num_soilc c = filter_soilc(fc) this%decomp_npools_leached(c,l) = & this%decomp_npools_leached(c,l) + & @@ -9793,8 +9796,9 @@ subroutine col_nf_summary(this, bounds, num_soilc, filter_soilc) this%bgc_npool_inputs(c,l) = this%bgc_npool_inputs(c,l) + & (this%bgc_npool_ext_inputs_vr(c,j,l)-this%bgc_npool_ext_loss_vr(c,j,l))*dzsoi_decomp(j) - end do - end do + end do + end do + endif do fc = 1,num_soilc c = filter_soilc(fc) this%som_n_leached(c) = & @@ -11314,16 +11318,16 @@ subroutine col_pf_summary(this, bounds, num_soilc, filter_soilc) c = filter_soilc(fc) this%decomp_ppools_leached(c,l) = 0._r8 end do - - do j = 1, nlevdecomp - do fc = 1,num_soilc + if(l /= i_cwd)then + do j = 1, nlevdecomp + do fc = 1,num_soilc c = filter_soilc(fc) this%decomp_ppools_leached(c,l) = & this%decomp_ppools_leached(c,l) + & this%decomp_ppools_transport_tendency(c,j,l) * dzsoi_decomp(j) - end do - end do - + end do + end do + endif do fc = 1,num_soilc c = filter_soilc(fc) this%som_p_leached(c) = & From 67cda37cb5c617f760793d04b2ee4a8e7731de14 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 9 Sep 2024 13:19:32 -0600 Subject: [PATCH 177/197] Update CIME submodule with a new fix commit That fixes BFAILs not being considered DIFFs [BFB] --- cime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime b/cime index 2a3142fc14b..0cdd4b1c5c5 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit 2a3142fc14b18fd58379f98d7d2a9a8b4b0d43a8 +Subproject commit 0cdd4b1c5c5eb2e29c6ec64667724af434847bcf From 026ff137c209f2e811c9a31026f23e765026b718 Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Tue, 10 Sep 2024 13:09:36 -0500 Subject: [PATCH 178/197] Reduce test lengths Reduce the simulation time for tests from defaults following what is used in e3sm_integration for similar cases. --- .github/workflows/e3sm-gh-ci-cime-tests.yml | 8 ++++---- .github/workflows/e3sm-gh-ci-w-cime-tests.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e3sm-gh-ci-cime-tests.yml b/.github/workflows/e3sm-gh-ci-cime-tests.yml index f5c3ffcebf9..b113710f46f 100644 --- a/.github/workflows/e3sm-gh-ci-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-cime-tests.yml @@ -31,10 +31,10 @@ jobs: fail-fast: false matrix: test: - - SMS_D_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu - - ERS_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu.eam-wcprod_F2010 - - SMS_D_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu - - ERS_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu.eamxx-prod + - SMS_D_Ln5_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu + - ERS_Ld5_P4.ne4pg2_oQU480.F2010.ghci-oci_gnu.eam-wcprod_F2010 + - SMS_D_Ln5_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu + - ERS_Ld5_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu.eamxx-prod container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 diff --git a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml index 178b9a6a442..ca21646382b 100644 --- a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml @@ -20,8 +20,8 @@ jobs: fail-fast: false matrix: test: - - SMS_D_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - - ERS_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu.allactive-wcprod_1850 + - SMS_D_Ld1_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu + - ERS_Ld3_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu.allactive-wcprod_1850 container: image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 From 8bd4d09450caf2f6f35892c4076f9e7db270774f Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Tue, 10 Sep 2024 15:58:30 -0500 Subject: [PATCH 179/197] Adjust PEs for MPAS dev-tests on Anvil --- .../testmods_dirs/config_pes_tests.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cime_config/testmods_dirs/config_pes_tests.xml b/cime_config/testmods_dirs/config_pes_tests.xml index 080e496d205..1ac88ac5fe6 100644 --- a/cime_config/testmods_dirs/config_pes_tests.xml +++ b/cime_config/testmods_dirs/config_pes_tests.xml @@ -37,6 +37,8 @@ -4 -4 -4 + -4 + -4 -4 @@ -203,6 +205,23 @@ + + + + tests+anvil: --compset GMPAS-JRA1p5-DIB-PISMF, 8 nodes + + -8 + -8 + -8 + -8 + -8 + -8 + -8 + -8 + + + + From 73e37fab4cbf63d4ef16759bb02328f9b090798a Mon Sep 17 00:00:00 2001 From: mahf708 Date: Wed, 11 Sep 2024 08:28:27 -0700 Subject: [PATCH 180/197] update compy intel compiler --- cime_config/machines/config_machines.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index 5eaae75f204..ff6f9ac3759 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3912,7 +3912,7 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss gcc/8.1.0 - intel/19.0.5 + intel/20.0.0 pgi/19.10 @@ -3921,7 +3921,7 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss mvapich2/2.3.1 - intelmpi/2019u4 + intelmpi/2020 intelmpi/2019u3 From 57f549be17e95ef5b1ab5e1218fcd11547608044 Mon Sep 17 00:00:00 2001 From: Gautam Bisht Date: Wed, 11 Sep 2024 12:08:35 -0700 Subject: [PATCH 181/197] Enables output of land fraction used in dust mobilization Adds a new member variable (`lnd_frc_mbl_patch`) to `dust_type` to allow output of land fraction sued in dust mobilization. This new variable is added to ELM history file and is inactive by default. [BFB] --- components/elm/src/biogeochem/DUSTMod.F90 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/elm/src/biogeochem/DUSTMod.F90 b/components/elm/src/biogeochem/DUSTMod.F90 index ba24f259669..a6ee6c6c11f 100644 --- a/components/elm/src/biogeochem/DUSTMod.F90 +++ b/components/elm/src/biogeochem/DUSTMod.F90 @@ -69,6 +69,7 @@ module DUSTMod real(r8), pointer, private :: vlc_trb_2_patch (:) ! turbulent deposition velocity 2(m/s) real(r8), pointer, private :: vlc_trb_3_patch (:) ! turbulent deposition velocity 3(m/s) real(r8), pointer, private :: vlc_trb_4_patch (:) ! turbulent deposition velocity 4(m/s) + real(r8), pointer, private :: lnd_frc_mbl_patch (:) ! land fraction for dust mobilization (-) real(r8), pointer, private :: mbl_bsn_fct_col (:) ! basin factor contains @@ -121,7 +122,8 @@ subroutine InitAllocate(this, bounds) allocate(this%vlc_trb_2_patch (begp:endp)) ; this%vlc_trb_2_patch (:) = nan allocate(this%vlc_trb_3_patch (begp:endp)) ; this%vlc_trb_3_patch (:) = nan allocate(this%vlc_trb_4_patch (begp:endp)) ; this%vlc_trb_4_patch (:) = nan - allocate(this%mbl_bsn_fct_col (begc:endc)) ; this%mbl_bsn_fct_col (:) = nan + allocate(this%lnd_frc_mbl_patch (begp:endp)) ; this%lnd_frc_mbl_patch (:) = spval + allocate(this%mbl_bsn_fct_col (begc:endc)) ; this%mbl_bsn_fct_col (:) = nan end subroutine InitAllocate @@ -167,6 +169,11 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='turbulent deposition velocity 4', & ptr_patch=this%vlc_trb_4_patch, default='inactive') + this%lnd_frc_mbl_patch(begp:endp) = spval + call hist_addfld1d (fname='LND_FRC_DUST_MBL', units='-', & + avgflag='A', long_name='land fraction for dust mobilization', & + ptr_patch=this%lnd_frc_mbl_patch, default='inactive') + end subroutine InitHistory !----------------------------------------------------------------------- @@ -239,7 +246,6 @@ subroutine DustEmission (bounds, & real(r8) :: Cd ! [dimless] The dust emission coefficient, which depends on ! the soil's standardized threshold friction speed -YF real(r8) :: wnd_frc_slt - real(r8) :: lnd_frc_mbl(bounds%begp:bounds%endp) real(r8) :: bd real(r8) :: gwc_sfc real(r8) :: ttlai(bounds%begp:bounds%endp) @@ -287,6 +293,7 @@ subroutine DustEmission (bounds, & u10 => frictionvel_vars%u10_patch , & ! Input: [real(r8) (:) ] 10-m wind (m/s) (created for dust model) mbl_bsn_fct => dust_vars%mbl_bsn_fct_col , & ! Input: [real(r8) (:) ] basin factor + lnd_frc_mbl => dust_vars%lnd_frc_mbl_patch , & ! Output: [real(r8) (:) ] land fraction for dust mobilization flx_mss_vrt_dst => dust_vars%flx_mss_vrt_dst_patch , & ! Output: [real(r8) (:,:) ] surface dust emission (kg/m**2/s) flx_mss_vrt_dst_tot => dust_vars%flx_mss_vrt_dst_tot_patch & ! Output: [real(r8) (:) ] total dust flux back to atmosphere (pft) ) From f094149ea4e74cda23d72fddfea782abf0977e5d Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Wed, 11 Sep 2024 17:16:28 -0400 Subject: [PATCH 182/197] update ghci container to restore gh/ci --- .github/workflows/e3sm-gh-ci-cime-tests.yml | 6 +----- .github/workflows/e3sm-gh-ci-w-cime-tests.yml | 6 +----- cime_config/machines/config_machines.xml | 16 ++++++++-------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/e3sm-gh-ci-cime-tests.yml b/.github/workflows/e3sm-gh-ci-cime-tests.yml index b113710f46f..1f3f63d4f09 100644 --- a/.github/workflows/e3sm-gh-ci-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-cime-tests.yml @@ -36,7 +36,7 @@ jobs: - SMS_D_Ln5_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu - ERS_Ld5_P4.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-oci_gnu.eamxx-prod container: - image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 + image: ghcr.io/e3sm-project/containers-ghci:ghci-0.1.0 steps: - @@ -49,10 +49,6 @@ jobs: name: CIME working-directory: cime/scripts run: | - mkdir -p $HOME/projects/e3sm/cesm-inputdata/atm/cam/physprops/ - wget https://web.lcrc.anl.gov/public/e3sm/inputdata/atm/cam/physprops/p3_lookup_table_1.dat-v4.1.2 - mv p3_lookup_table_1.dat-v4.1.2 $HOME/projects/e3sm/cesm-inputdata/atm/cam/physprops/ - export USER=test ./create_test ${{ matrix.test }} --wait --debug - name: Artifacts diff --git a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml index ca21646382b..5f064bcad7f 100644 --- a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml @@ -23,7 +23,7 @@ jobs: - SMS_D_Ld1_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu - ERS_Ld3_P8.ne4pg2_oQU480.WCYCL2010NS.ghci-oci_gnu.allactive-wcprod_1850 container: - image: ghcr.io/mahf708/e3sm-imgs:v0.0.9 + image: ghcr.io/e3sm-project/containers-ghci:ghci-0.1.0 steps: - @@ -36,10 +36,6 @@ jobs: name: CIME working-directory: cime/scripts run: | - mkdir -p $HOME/projects/e3sm/cesm-inputdata/atm/cam/physprops/ - wget https://web.lcrc.anl.gov/public/e3sm/inputdata/atm/cam/physprops/p3_lookup_table_1.dat-v4.1.2 - mv p3_lookup_table_1.dat-v4.1.2 $HOME/projects/e3sm/cesm-inputdata/atm/cam/physprops/ - export USER=test ./create_test ${{ matrix.test }} --wait --debug - name: Artifacts diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index 30508f8a630..daff3ed9038 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -1715,16 +1715,16 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss - OCI-based container 2.0 + OCI-based container ghci-oci LINUX gnu mpich - $ENV{HOME}/projects/e3sm/scratch - $ENV{HOME}/projects/e3sm/cesm-inputdata - $ENV{HOME}/projects/e3sm/ptclm-data - $ENV{HOME}/projects/e3sm/scratch/archive/$CASE - $ENV{HOME}/projects/e3sm/baselines/$COMPILER + /projects/e3sm/scratch + /projects/e3sm/inputdata + /projects/e3sm/ptclm-data + /projects/e3sm/scratch/archive/$CASE + /projects/e3sm/baselines/$COMPILER /usr/local/packages/bin/cprnc make 4 @@ -1740,8 +1740,8 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss - $ENV{HOME}/projects/e3sm/scratch/$CASE/run - $ENV{HOME}/projects/e3sm/scratch/$CASE/bld + /projects/e3sm/scratch/$CASE/run + /projects/e3sm/scratch/$CASE/bld $SRCROOT From 20d044b8e29939163657b1eb039c3b36643baee7 Mon Sep 17 00:00:00 2001 From: Naser Mahfouz Date: Wed, 11 Sep 2024 17:51:33 -0400 Subject: [PATCH 183/197] adjust artifacts to reflect recent edits --- .github/workflows/e3sm-gh-ci-cime-tests.yml | 8 ++++---- .github/workflows/e3sm-gh-ci-w-cime-tests.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e3sm-gh-ci-cime-tests.yml b/.github/workflows/e3sm-gh-ci-cime-tests.yml index 1f3f63d4f09..6c9ee1ab114 100644 --- a/.github/workflows/e3sm-gh-ci-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-cime-tests.yml @@ -57,7 +57,7 @@ jobs: with: name: ${{ matrix.test }} path: | - ~/projects/e3sm/scratch/${{ matrix.test }}*/TestStatus.log - ~/projects/e3sm/scratch/${{ matrix.test }}*/bld/*.bldlog.* - ~/projects/e3sm/scratch/${{ matrix.test }}*/run/*.log.* - ~/projects/e3sm/scratch/${{ matrix.test }}*/run/*.cprnc.out + /projects/e3sm/scratch/${{ matrix.test }}*/TestStatus.log + /projects/e3sm/scratch/${{ matrix.test }}*/bld/*.bldlog.* + /projects/e3sm/scratch/${{ matrix.test }}*/run/*.log.* + /projects/e3sm/scratch/${{ matrix.test }}*/run/*.cprnc.out diff --git a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml index 5f064bcad7f..48c367c8f62 100644 --- a/.github/workflows/e3sm-gh-ci-w-cime-tests.yml +++ b/.github/workflows/e3sm-gh-ci-w-cime-tests.yml @@ -44,7 +44,7 @@ jobs: with: name: ${{ matrix.test }} path: | - ~/projects/e3sm/scratch/${{ matrix.test }}*/TestStatus.log - ~/projects/e3sm/scratch/${{ matrix.test }}*/bld/*.bldlog.* - ~/projects/e3sm/scratch/${{ matrix.test }}*/run/*.log.* - ~/projects/e3sm/scratch/${{ matrix.test }}*/run/*.cprnc.out + /projects/e3sm/scratch/${{ matrix.test }}*/TestStatus.log + /projects/e3sm/scratch/${{ matrix.test }}*/bld/*.bldlog.* + /projects/e3sm/scratch/${{ matrix.test }}*/run/*.log.* + /projects/e3sm/scratch/${{ matrix.test }}*/run/*.cprnc.out From f21d4617fae7727c2ddfd691a598305b22a2ff54 Mon Sep 17 00:00:00 2001 From: Gautam Bisht Date: Wed, 11 Sep 2024 17:15:23 -0500 Subject: [PATCH 184/197] Updates the long_name --- components/elm/src/biogeochem/DUSTMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/elm/src/biogeochem/DUSTMod.F90 b/components/elm/src/biogeochem/DUSTMod.F90 index a6ee6c6c11f..f53e970423b 100644 --- a/components/elm/src/biogeochem/DUSTMod.F90 +++ b/components/elm/src/biogeochem/DUSTMod.F90 @@ -171,7 +171,7 @@ subroutine InitHistory(this, bounds) this%lnd_frc_mbl_patch(begp:endp) = spval call hist_addfld1d (fname='LND_FRC_DUST_MBL', units='-', & - avgflag='A', long_name='land fraction for dust mobilization', & + avgflag='A', long_name='bare soil fraction for land fraction for dust mobilization', & ptr_patch=this%lnd_frc_mbl_patch, default='inactive') end subroutine InitHistory From 059f6e3def8692f81daeb05ebdf9b87054d90b1a Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Thu, 12 Sep 2024 12:50:30 -0500 Subject: [PATCH 185/197] Reset sim_year_range to 1850-2015 in namelist_defaults for flanduse_timeseries --- .../bld/namelist_files/namelist_defaults.xml | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/components/elm/bld/namelist_files/namelist_defaults.xml b/components/elm/bld/namelist_files/namelist_defaults.xml index e66ebfa637b..beeae785859 100644 --- a/components/elm/bld/namelist_files/namelist_defaults.xml +++ b/components/elm/bld/namelist_files/namelist_defaults.xml @@ -485,48 +485,48 @@ lnd/clm2/surfdata_map/surfdata_conusx4v1_simyr2000_c160503.nc dataset (arbitrarily, RCP8.5) for the historical period, because all of the RCP datasets contain the 1850-2000 period as well as the future period. --> -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_simyr1850-2015_c180220.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_simyr1850-2015_c180306.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_simyr1850-2015_c180306.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_10x15_rcp8.5_simyr1850-2100_c130524.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp8.5_simyr1850-2100_c130524.nc lnd/clm2/surfdata_map/landuse.timeseries_antarcticax4v1pg2_hist_simyr1850-2015_c210131.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_1x1_tropicAtl_hist_simyr1850-2005_c130627.nc -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_rcp8.5_simyr1850-2100_c140610.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_simyr1850-2015_c180306.nc - lnd/clm2/surfdata_map/landuse.timeseries_ne30np4.pg2_hist_simyr1850-2015_c210113.nc - lnd/clm2/surfdata_map/landuse.timeseries_ne4pg2_hist_simyr1850-2015_c210722.nc - lnd/clm2/surfdata_map/landuse.timeseries_ne0np4_northamericax4v1.pg2_hist_simyr1850-2015_c211015.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne16np4_hist_simyr1850-2005_c160803.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne11np4_hist_simyr1850-2005_c160803.nc lnd/clm2/surfdata_map/landuse.timeseries_ne1024pg2_historical_simyr1990-2014_c240109.nc lnd/clm2/surfdata_map/landuse.timeseries_ne256pg2_hist_simyr1850-2015_c240131.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.125x0.125_hist_simyr1850-2015_c191004.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.5x0.5_HIST_simyr1850-2015_c211019.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.5x0.5_hist_simyr1850-2015_c191004.nc From 66ce874b14ed691d12d61933cd2689f3c89f7c45 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Thu, 12 Sep 2024 14:49:24 -0500 Subject: [PATCH 186/197] Add LND_FRC_DUST_MBL to elm.h0 for wcprod mods --- cime_config/testmods_dirs/allactive/wcprod/user_nl_elm | 2 +- cime_config/testmods_dirs/allactive/wcprod_1850/user_nl_elm | 2 +- .../testmods_dirs/allactive/wcprod_1850_1pctCO2/user_nl_elm | 2 +- .../testmods_dirs/allactive/wcprod_1850_4xCO2/user_nl_elm | 2 +- cime_config/testmods_dirs/allactive/wcprodrrm/user_nl_elm | 2 +- cime_config/testmods_dirs/allactive/wcprodrrm_1850/user_nl_elm | 2 +- cime_config/testmods_dirs/allactive/wcprodssp/user_nl_elm | 2 +- .../cime_config/testdefs/testmods_dirs/eam/wcprod/user_nl_elm | 2 +- .../testdefs/testmods_dirs/eam/wcprod_F2010/user_nl_elm | 2 +- .../testdefs/testmods_dirs/eam/wcprod_F20TR/user_nl_elm | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cime_config/testmods_dirs/allactive/wcprod/user_nl_elm b/cime_config/testmods_dirs/allactive/wcprod/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/cime_config/testmods_dirs/allactive/wcprod/user_nl_elm +++ b/cime_config/testmods_dirs/allactive/wcprod/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/cime_config/testmods_dirs/allactive/wcprod_1850/user_nl_elm b/cime_config/testmods_dirs/allactive/wcprod_1850/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/cime_config/testmods_dirs/allactive/wcprod_1850/user_nl_elm +++ b/cime_config/testmods_dirs/allactive/wcprod_1850/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/cime_config/testmods_dirs/allactive/wcprod_1850_1pctCO2/user_nl_elm b/cime_config/testmods_dirs/allactive/wcprod_1850_1pctCO2/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/cime_config/testmods_dirs/allactive/wcprod_1850_1pctCO2/user_nl_elm +++ b/cime_config/testmods_dirs/allactive/wcprod_1850_1pctCO2/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/cime_config/testmods_dirs/allactive/wcprod_1850_4xCO2/user_nl_elm b/cime_config/testmods_dirs/allactive/wcprod_1850_4xCO2/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/cime_config/testmods_dirs/allactive/wcprod_1850_4xCO2/user_nl_elm +++ b/cime_config/testmods_dirs/allactive/wcprod_1850_4xCO2/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/cime_config/testmods_dirs/allactive/wcprodrrm/user_nl_elm b/cime_config/testmods_dirs/allactive/wcprodrrm/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/cime_config/testmods_dirs/allactive/wcprodrrm/user_nl_elm +++ b/cime_config/testmods_dirs/allactive/wcprodrrm/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/cime_config/testmods_dirs/allactive/wcprodrrm_1850/user_nl_elm b/cime_config/testmods_dirs/allactive/wcprodrrm_1850/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/cime_config/testmods_dirs/allactive/wcprodrrm_1850/user_nl_elm +++ b/cime_config/testmods_dirs/allactive/wcprodrrm_1850/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/cime_config/testmods_dirs/allactive/wcprodssp/user_nl_elm b/cime_config/testmods_dirs/allactive/wcprodssp/user_nl_elm index 7bfdbac5c84..e2ac4d5d1ab 100644 --- a/cime_config/testmods_dirs/allactive/wcprodssp/user_nl_elm +++ b/cime_config/testmods_dirs/allactive/wcprodssp/user_nl_elm @@ -38,7 +38,7 @@ 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' - hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' + hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod/user_nl_elm b/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod/user_nl_elm +++ b/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod_F2010/user_nl_elm b/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod_F2010/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod_F2010/user_nl_elm +++ b/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod_F2010/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 diff --git a/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod_F20TR/user_nl_elm b/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod_F20TR/user_nl_elm index cd1adab7740..9224c77e0f0 100644 --- a/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod_F20TR/user_nl_elm +++ b/components/eam/cime_config/testdefs/testmods_dirs/eam/wcprod_F20TR/user_nl_elm @@ -33,7 +33,7 @@ hist_fexcl1 = 'AGWDNPP','ALTMAX_LASTYEAR','AVAIL_RETRANSP','AVAILC','BAF_CROP', 'SOIL4N_vr','SOIL4P_TNDNCY_VERT_TRANS','SOIL4P_TO_SMINP','SOIL4P_vr','SOLUTIONP_vr', 'TCS_MONTH_BEGIN','TCS_MONTH_END','TOTCOLCH4','water_scalar','WF', 'wlim_m','WOODC_LOSS','WTGQ' -hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC' +hist_fincl1 = 'SNOWDP','COL_FIRE_CLOSS','NPOOL','PPOOL','TOTPRODC','LND_FRC_DUST_MBL' hist_fincl2 = 'H2OSNO', 'FSNO', 'QRUNOFF', 'QSNOMELT', 'FSNO_EFF', 'SNORDSL', 'SNOW', 'FSDS', 'FSR', 'FLDS', 'FIRE', 'FIRA' hist_mfilt = 1,365 hist_nhtfrq = -24,-24 From b69636d543a21c7384e239178fcfc003e8d8c705 Mon Sep 17 00:00:00 2001 From: Balwinder Singh Date: Thu, 12 Sep 2024 17:45:36 -0700 Subject: [PATCH 187/197] Updates cprnc version to match the new compiler version --- cime_config/machines/config_machines.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index ff6f9ac3759..6f0a952ac6c 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -3865,7 +3865,7 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss /compyfs/inputdata/atm/datm7 /compyfs/$USER/e3sm_scratch/archive/$CASE /compyfs/e3sm_baselines/$COMPILER - /compyfs/e3sm_baselines/cprnc/cprnc + /compyfs/e3sm_baselines/cprnc/cprnc.intel.v20.0.04/cprnc 8 e3sm_integration 4 From d5dd94cb4fe8cd53fafb3b11b46f79d07e23ecf7 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Fri, 13 Sep 2024 09:02:25 -0500 Subject: [PATCH 188/197] Update sim_year_range in 20thC_transient.xml --- components/elm/bld/namelist_files/use_cases/20thC_transient.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/elm/bld/namelist_files/use_cases/20thC_transient.xml b/components/elm/bld/namelist_files/use_cases/20thC_transient.xml index 86035ec6e08..1fe1f286049 100644 --- a/components/elm/bld/namelist_files/use_cases/20thC_transient.xml +++ b/components/elm/bld/namelist_files/use_cases/20thC_transient.xml @@ -9,7 +9,7 @@ 1850 -1850-2000 +1850-2015 arb_ic From c11886bcd6e3056be6dd28ca577ea6f97bd807ec Mon Sep 17 00:00:00 2001 From: jayeshkrishna Date: Wed, 11 Sep 2024 23:06:33 -0500 Subject: [PATCH 189/197] Log PIO buffer size limit for default case Logging the SCORPIO internal buffer cache size when the user lets the library choose the buffer size (the default case) --- share/util/shr_pio_mod.F90 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/share/util/shr_pio_mod.F90 b/share/util/shr_pio_mod.F90 index 0935bce351a..d500cbc680a 100644 --- a/share/util/shr_pio_mod.F90 +++ b/share/util/shr_pio_mod.F90 @@ -173,17 +173,24 @@ subroutine shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_ia logical, intent(in) :: comp_iamin(:) character(len=*), intent(in) :: comp_name(:) integer, intent(in) :: comp_comm(:), comp_comm_iam(:) + integer(kind=pio_offset_kind) :: cur_buffer_size_limit=-1 integer :: i character(len=shr_kind_cl) :: nlfilename, cname integer :: ret character(*), parameter :: subName = '(shr_pio_init2) ' ! 0 is a valid value of pio_buffer_size_limit - if(pio_buffer_size_limit>=0) then + ! -1 is the value used by CIME to let the library choose the buffer limit + if(pio_buffer_size_limit>=-1) then + call pio_set_buffer_size_limit(pio_buffer_size_limit, prev_limit=cur_buffer_size_limit) if(comp_comm_iam(1)==0) then - write(shr_log_unit,*) 'Setting pio_buffer_size_limit : ',pio_buffer_size_limit + if(pio_buffer_size_limit >= 0) then + write(shr_log_unit,*) 'Set pio_buffer_size_limit to : ', pio_buffer_size_limit, ' (bytes)' + else + ! Default pio_buffer_size_limit + write(shr_log_unit,*) 'Using pio_buffer_size_limit (default): ', cur_buffer_size_limit, ' (bytes)' + end if end if - call pio_set_buffer_size_limit(pio_buffer_size_limit) endif if(pio_blocksize>0) then if(comp_comm_iam(1)==0) then From 2aadb974efacf339f7e76e6ce98f250da573aefc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:02:49 +0000 Subject: [PATCH 190/197] Bump DavidAnson/markdownlint-cli2-action from 16 to 17 Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 16 to 17. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v16...v17) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/e3sm-gh-md-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e3sm-gh-md-linter.yml b/.github/workflows/e3sm-gh-md-linter.yml index 507c2c3745e..424a871637b 100644 --- a/.github/workflows/e3sm-gh-md-linter.yml +++ b/.github/workflows/e3sm-gh-md-linter.yml @@ -22,7 +22,7 @@ jobs: with: files: '**/*.md' separator: "," - - uses: DavidAnson/markdownlint-cli2-action@v16 + - uses: DavidAnson/markdownlint-cli2-action@v17 if: steps.changed-files.outputs.any_changed == 'true' with: config: 'docs/.markdownlint.json' From a2e91dc0e9b476e9f6a845fd3c1b9f7e3e2746d8 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 16 Sep 2024 15:14:56 -0600 Subject: [PATCH 191/197] Get mappy working again with RHEL9 --- cime_config/machines/config_machines.xml | 38 +++++++++++++----------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index fe1febd6ddc..dcbd43ad6f0 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -1861,31 +1861,32 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss - /projects/sems/install/rhel7-x86_64/sems/v2/lmod/lmod/8.3/gcc/10.1.0/zbzzu7k/lmod/lmod/init/env_modules_python.py - /projects/sems/install/rhel7-x86_64/sems/v2/lmod/lmod/8.3/gcc/10.1.0/zbzzu7k/lmod/lmod/init/perl - /projects/sems/install/rhel7-x86_64/sems/v2/lmod/lmod/8.3/gcc/10.1.0/zbzzu7k/lmod/lmod/init/sh - /projects/sems/install/rhel7-x86_64/sems/v2/lmod/lmod/8.3/gcc/10.1.0/zbzzu7k/lmod/lmod/init/csh - /projects/sems/install/rhel7-x86_64/sems/v2/lmod/lmod/8.3/gcc/10.1.0/zbzzu7k/lmod/lmod/libexec/lmod python - /projects/sems/install/rhel7-x86_64/sems/v2/lmod/lmod/8.3/gcc/10.1.0/zbzzu7k/lmod/lmod/libexec/lmod perl + /projects/sems/install/rhel9-x86_64/sems/lmod/lmod/8.7.24/gcc/11.4.1/base/lnirq74/lmod/lmod/init/env_modules_python.py + /projects/sems/install/rhel9-x86_64/sems/lmod/lmod/8.7.24/gcc/11.4.1/base/lnirq74/lmod/lmod/init/perl + /projects/sems/install/rhel9-x86_64/sems/lmod/lmod/8.7.24/gcc/11.4.1/base/lnirq74/lmod/lmod/init/sh + /projects/sems/install/rhel9-x86_64/sems/lmod/lmod/8.7.24/gcc/11.4.1/base/lnirq74/lmod/lmod/init/csh + /projects/sems/install/rhel9-x86_64/sems/lmod/lmod/8.7.24/gcc/11.4.1/base/lnirq74/lmod/lmod/libexec/lmod python + /projects/sems/install/rhel9-x86_64/sems/lmod/lmod/8.7.24/gcc/11.4.1/base/lnirq74/lmod/lmod/libexec/lmod perl module module - sems-archive-env - acme-env - sems-archive-git - acme-cmake/3.26.3 + sems-git/2.42.0 + sems-cmake/3.27.9 - acme-gcc/11.2.0 + sems-gcc/11.4.0 + sems-openblas - acme-netcdf/4.4.1/exo_acme - acme-pfunit/3.2.8/base + sems-netcdf-c-serial/4.9.2 - acme-openmpi/4.1.4 - acme-netcdf/4.7.4/acme + sems-openmpi/4.1.6 + sems-netcdf-c/4.9.2 + sems-netcdf-cxx/4.2 + sems-netcdf-fortran/4.6.1 + sems-parallel-netcdf/1.12.3 $CIME_OUTPUT_ROOT/$CASE/run @@ -1894,11 +1895,14 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss 0 - $ENV{SEMS_NETCDF_ROOT} + $ENV{NETCDF_C_ROOT} + $ENV{NETCDF_FORTRAN_ROOT} + $ENV{PARALLEL_NETCDF_ROOT} + $ENV{OPENBLAS_ROOT} 64M spread threads - Generic + OpenBLAS 4000MB From 312c442ac6018cecde4b9024f4b0ea6090d57017 Mon Sep 17 00:00:00 2001 From: Wuyin Lin Date: Mon, 16 Sep 2024 21:27:35 -0500 Subject: [PATCH 192/197] Revert "Merge remote-tracking branch 'liho/liho745/river/bug-fix-7792c63' (PR #6313)" This reverts commit 427b86040f21ce3e41cc99f7cc2aeff02267f17f, reversing changes made to cf32a25b559c71ba63208fc09adaae5daebe6412. --- components/mosart/src/riverroute/MOSART_physics_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mosart/src/riverroute/MOSART_physics_mod.F90 b/components/mosart/src/riverroute/MOSART_physics_mod.F90 index cad978577cd..912014904e9 100644 --- a/components/mosart/src/riverroute/MOSART_physics_mod.F90 +++ b/components/mosart/src/riverroute/MOSART_physics_mod.F90 @@ -682,8 +682,8 @@ subroutine Euler ! check for negative channel storage if (negchan < -1.e-10) then - write(iulog,*) 'Error: Negative channel storage found! ',negchan - call shr_sys_abort('mosart: negative channel storage') + write(iulog,*) 'Warning: Negative channel storage found! ',negchan +! call shr_sys_abort('mosart: negative channel storage') endif TRunoff%flow = TRunoff%flow / Tctl%DLevelH2R TRunoff%erowm_regi(:,nt_nmud:nt_nsan) = TRunoff%erowm_regi(:,nt_nmud:nt_nsan) / Tctl%DLevelH2R From 43239f35bcf42b4c33ef713c1ee2fdc3a8699238 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Tue, 17 Sep 2024 11:31:00 -0600 Subject: [PATCH 193/197] Fixes for mpi-serial on mappy --- cime_config/machines/config_machines.xml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index dcbd43ad6f0..fedb4318b3e 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -1896,8 +1896,6 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss $ENV{NETCDF_C_ROOT} - $ENV{NETCDF_FORTRAN_ROOT} - $ENV{PARALLEL_NETCDF_ROOT} $ENV{OPENBLAS_ROOT} 64M spread @@ -1905,6 +1903,14 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss OpenBLAS 4000MB + + /home/jgfouca/packages/netcdf-fortran-4.6.1-bin + /home/jgfouca/packages/netcdf-fortran-4.6.1-bin:$ENV{LD_LIBRARY_PATH} + + + $ENV{NETCDF_FORTRAN_ROOT} + $ENV{PARALLEL_NETCDF_ROOT} + @@ -3497,7 +3503,7 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss 104 104 48 - FALSE + FALSE mpiexec @@ -4290,7 +4296,7 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss - Chicoma GPU nodes at LANL IC. Each GPU node has single + Chicoma GPU nodes at LANL IC. Each GPU node has single AMD EPYC 7713 64-Core (Milan) (256GB) and 4 nvidia A100' ch-fe* Linux From 67a5f9aca7e8e532894af791612d92689a0fd5a4 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Thu, 19 Sep 2024 09:56:10 -0600 Subject: [PATCH 194/197] Everything working now --- cime_config/machines/config_machines.xml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cime_config/machines/config_machines.xml b/cime_config/machines/config_machines.xml index fedb4318b3e..5d997dcb5d6 100644 --- a/cime_config/machines/config_machines.xml +++ b/cime_config/machines/config_machines.xml @@ -1880,9 +1880,10 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss sems-netcdf-c-serial/4.9.2 + sems-netcdf-fortran-serial/4.6.1 - sems-openmpi/4.1.6 + sems-openmpi-no-cuda/4.1.6 sems-netcdf-c/4.9.2 sems-netcdf-cxx/4.2 sems-netcdf-fortran/4.6.1 @@ -1896,6 +1897,7 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss $ENV{NETCDF_C_ROOT} + $ENV{NETCDF_FORTRAN_ROOT} $ENV{OPENBLAS_ROOT} 64M spread @@ -1903,12 +1905,7 @@ commented out until "*** No rule to make target '.../libadios2pio-nm-lib.a'" iss OpenBLAS 4000MB - - /home/jgfouca/packages/netcdf-fortran-4.6.1-bin - /home/jgfouca/packages/netcdf-fortran-4.6.1-bin:$ENV{LD_LIBRARY_PATH} - - $ENV{NETCDF_FORTRAN_ROOT} $ENV{PARALLEL_NETCDF_ROOT} From 2bd7413743d9d9ea27eea861b44ced532f7e8a83 Mon Sep 17 00:00:00 2001 From: Luca Bertagna Date: Thu, 19 Sep 2024 14:39:41 -0600 Subject: [PATCH 195/197] Update EKAT submodule Brings in new remote for yaml-cpp --- externals/ekat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/ekat b/externals/ekat index 9ffec9a4fb4..38a533c4a72 160000 --- a/externals/ekat +++ b/externals/ekat @@ -1 +1 @@ -Subproject commit 9ffec9a4fb4c03596b7e1729241b6348aad70ec1 +Subproject commit 38a533c4a72f1fdf9736163f91dbea63fbaa4653 From 284223881d0101084cabc24a02befd9903e13780 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Thu, 19 Sep 2024 14:47:45 -0600 Subject: [PATCH 196/197] Fixes for mappy due to rebuild --- components/eamxx/cmake/machine-files/mappy.cmake | 1 - components/eamxx/scripts/jenkins/mappy_setup | 5 +---- components/eamxx/scripts/machines_specs.py | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/components/eamxx/cmake/machine-files/mappy.cmake b/components/eamxx/cmake/machine-files/mappy.cmake index 29fb2e74b8a..976db822325 100644 --- a/components/eamxx/cmake/machine-files/mappy.cmake +++ b/components/eamxx/cmake/machine-files/mappy.cmake @@ -1,5 +1,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) common_setup() -set(PYTHON_EXECUTABLE "/ascldap/users/jgfouca/packages/Python-3.8.5/bin/python3.8" CACHE STRING "" FORCE) set(CMAKE_Fortran_FLAGS "-fallow-argument-mismatch" CACHE STRING "" FORCE) diff --git a/components/eamxx/scripts/jenkins/mappy_setup b/components/eamxx/scripts/jenkins/mappy_setup index 8796d5fa60f..c261cb8a682 100644 --- a/components/eamxx/scripts/jenkins/mappy_setup +++ b/components/eamxx/scripts/jenkins/mappy_setup @@ -1,8 +1,5 @@ module purge -source /projects/sems/modulefiles/utils/sems-archive-modules-init.sh -module load sems-archive-env -export PATH=/ascldap/users/jgfouca/packages/Python-3.8.5/bin:$PATH -module load sems-archive-git/2.10.1 +module load sems-git/2.42.0 source $JENKINS_SCRIPT_DIR/sandia_son_proxy diff --git a/components/eamxx/scripts/machines_specs.py b/components/eamxx/scripts/machines_specs.py index 713f49200fb..f1fd0c9d34b 100644 --- a/components/eamxx/scripts/machines_specs.py +++ b/components/eamxx/scripts/machines_specs.py @@ -28,9 +28,8 @@ ["mpicxx","mpifort","mpicc"], "bsub -I -q rhel8 -n 4 -gpu num=4", "/home/projects/e3sm/scream/pr-autotester/master-baselines/weaver/"), - "mappy" : (["module purge", "module load sems-archive-env acme-env acme-cmake/3.26.3 acme-gcc/11.2.0 sems-archive-git/2.10.1 acme-openmpi/4.1.4 acme-netcdf/4.7.4/acme", + "mappy" : (["module purge", "module load sems-cmake/3.27.9 sems-git/2.42.0 sems-gcc/11.4.0 sems-openmpi-no-cuda/4.1.6 sems-netcdf-c/4.9.2 sems-netcdf-cxx/4.2 sems-netcdf-fortran/4.6.1 sems-parallel-netcdf/1.12.3 sems-openblas", "export GATOR_INITIAL_MB=4000MB", - "export PATH=/ascldap/users/jgfouca/packages/valgrind-3.22.0/bin:$PATH", ], ["mpicxx","mpifort","mpicc"], "", From 7cdcc2cdafcdce2f23e691e75133da536fe114fb Mon Sep 17 00:00:00 2001 From: James Foucar Date: Thu, 19 Sep 2024 16:00:39 -0600 Subject: [PATCH 197/197] Fix is_cuda_machine --- components/eamxx/scripts/machines_specs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/eamxx/scripts/machines_specs.py b/components/eamxx/scripts/machines_specs.py index f1fd0c9d34b..479d402e709 100644 --- a/components/eamxx/scripts/machines_specs.py +++ b/components/eamxx/scripts/machines_specs.py @@ -237,9 +237,9 @@ def is_cuda_machine(machine): assert_machine_supported(machine) env_setup_raw = MACHINE_METADATA[machine][0] - env_setup_str = " ".join(env_setup_raw) + env_setup_str = " ".join(env_setup_raw).lower() - return "cuda" in env_setup_str.lower() + return ("no-cuda" not in env_setup_str and "cuda" in env_setup_str) ############################################################################### def setup_mach_env(machine, ctest_j=None):