diff --git a/README.md b/README.md index 1ecd483fe..0c5940a7a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ [![Build Status](https://travis-ci.org/CICE-Consortium/CICE.svg?branch=master)](https://travis-ci.org/CICE-Consortium/CICE) [![Documentation Status](https://readthedocs.org/projects/cice-consortium-cice/badge/?version=master)](http://cice-consortium-cice.readthedocs.io/en/master/?badge=master) -[![codecov](https://codecov.io/gh/apcraig/Test_CICE_Icepack/branch/master/graph/badge.svg)](https://codecov.io/gh/apcraig/Test_CICE_Icepack) +[![lcov](https://img.shields.io/endpoint?url=https://apcraig.github.io/coverage.json)](https://apcraig.github.io) + + ## The CICE Consortium sea-ice model CICE is a computationally efficient model for simulating the growth, melting, and movement of polar sea ice. Designed as one component of coupled atmosphere-ocean-land-ice global climate models, today’s CICE model is the outcome of more than two decades of community collaboration in building a sea ice model suitable for multiple uses including process studies, operational forecasting, and climate simulation. @@ -13,7 +15,7 @@ CICE consists of a top level driver and dynamical core plus the [Icepack column [icepack]: https://github.com/CICE-Consortium/Icepack -If you need help getting started using the model afer reviewing the [model documentation][doc-resources], the first point of contact with the CICE Consortium is the [Consortium Community Forum][forum]. +The first point of contact with the CICE Consortium is the [Consortium Community Forum][forum]. This forum is monitored by Consortium members and also opened to the whole community. Please do not use our issue tracker for general support questions. @@ -45,4 +47,4 @@ Head over to our [Contribution guide][contributing] to learn more about how you List of resources for information about the Consortium and its repositories as well as model documentation, testing, and development. ## License -See our [License](License.pdf) and [Distribution Policy](DistributionPolicy.pdf). +See our [License](LICENSE.pdf) and [Distribution Policy](DistributionPolicy.pdf). diff --git a/cice.setup b/cice.setup index 9038b5b93..43fdd836c 100755 --- a/cice.setup +++ b/cice.setup @@ -13,7 +13,7 @@ set dash = "-" set spval = "UnDeFiNeD" set machcomp = ${spval} set machine = ${spval} -set compilers = intel +set envnames = intel set case = ${spval} set test = ${spval} set grid = gx3 @@ -34,8 +34,8 @@ set stime = `date -u "+%H%M%S"` set docase = 0 set dotest = 0 set dosuite = 0 -set codecov = 0 # code coverage measurement and reporting -set codecovflag = false +set coverage = 0 # code coverage measurement and reporting +set coverageflag = false set suitebuild = true set suitereuse = true set suiterun = false @@ -84,7 +84,7 @@ SYNOPSIS --suite SUITE[,SUITE2] -m MACH --testid ID [-e ENV1,ENV2][--acct ACCT][--bdir DIR][--bgen DIR] - [--bcmp DIR][--tdir PATH][--report || --codecov] + [--bcmp DIR][--tdir PATH][--report || --coverage] [--setup-only || --setup-build || --setup-build-run || --setup-build-submit] DESCRIPTION @@ -93,7 +93,7 @@ DESCRIPTION --setvers : updates cice version number in sandbox --case, -c : case, case directory/name (not with --test or --suite) --mach, -m : machine, machine name (required) - --env, -e : compiler(s), comma separated (default = $compilers) + --env, -e : compilation environment name(s), comma separated (default = $envnames) --pes, -p : tasks x threads [x blocksize_x x blocksize_y [x maxblocks]] (default is ${pesx}) --acct : account number for the batch submission --grid, -g : grid, grid (default = ${grid}) @@ -111,8 +111,8 @@ DESCRIPTION --testid : test ID, user-defined id for testing (REQUIRED with --test or --suite) --diff : generate comparison against another case --report : automatically post results when tests are complete - --codecov : generate and report test coverage metrics when tests are complete, - requires GNU compiler (--env gnu) + --coverage : generate and report test coverage metrics when tests are complete, + requires GNU compiler (ie. normally ``--env gnu``) --setup-only : for suite, setup testcases, no build, no submission --setup-build : for suite, setup and build testcases, no submission --setup-build-run : for suite, setup, build, and run interactively @@ -229,9 +229,9 @@ while (1) set report = 1 shift argv - else if ("$option" == "--codecov") then - set codecov = 1 - set codecovflag = true + else if ("$option" == "--coverage") then + set coverage = 1 + set coverageflag = true set suitereuse = false shift argv @@ -281,7 +281,7 @@ while (1) else if ("$option" =~ --mach* || "$option" == "-m") then set machine = $argv[1] else if ("$option" =~ --env* || "$option" == "-e") then - set compilers = $argv[1] + set envnames = $argv[1] else if ("$option" == "--test") then set test = $argv[1] set dotest = 1 @@ -336,18 +336,18 @@ if (${dosum} > 1) then exit -1 endif -if ($codecov == 1 && $report == 1) then - echo "${0}: ERROR in arguments, not recommmended to set both --codecov and --report" +if ($coverage == 1 && $report == 1) then + echo "${0}: ERROR in arguments, not recommmended to set both --coverage and --report" exit -1 endif -if ($codecov == 1 && "$compilers" != "gnu") then - echo "${0}: ERROR in arguments, must use --env gnu with --codecov" +if ($coverage == 1 && "$envnames" !~ "gnu*") then + echo "${0}: ERROR in arguments, must use --env gnu* with --coverage" exit -1 endif -if ($codecov == 1 && `where curl` == "" && `where wget` == "") then - echo "${0}: ERROR 'curl' or 'wget' is required for --codecov" +if ($coverage == 1 && `where curl` == "" && `where wget` == "") then + echo "${0}: ERROR 'curl' or 'wget' is required for --coverage" exit -1 endif @@ -356,26 +356,29 @@ if (${dosuite} == 0) then echo "${0}: ERROR in arguments, must use --suite with --report" exit -1 endif - if ($codecov == 1) then - echo "${0}: ERROR in arguments, must use --suite with --codecov" + if ($coverage == 1) then + echo "${0}: ERROR in arguments, must use --suite with --coverage" exit -1 endif - if ("$compilers" =~ "*,*") then - echo "${0}: ERROR in arguments, cannot set multiple compilers without --suite" + if ("$envnames" =~ "*,*") then + echo "${0}: ERROR in arguments, cannot set multiple envnames without --suite" exit -1 else - set compiler = ${compilers} - set machcomp = ${machine}_${compiler} + set envname = ${envnames} + set machcomp = ${machine}_${envname} + endif +else + if ($coverage == 1) then + if ("$envnames" =~ "*,*") then + echo "${0}: ERROR in arguments, cannot set multiple envnamess with --coverage" + exit -1 + else + set envname = ${envnames} + set machcomp = ${machine}_${envname} + endif endif endif -# tcraig, lets find another way to validate argument -#if (${test} != ${spval} && ${test} != 'smoke' && ${test} != '10day' && ${test} != 'annual' \ -# && ${test} != 'restart') then -# echo "${0}: ERROR in arguments. ${test} is not a valid test" -# exit -1 -#endif - if ((${dosuite} == 1 || ${dotest} == 1) && ${testid} == ${spval}) then echo "${0}: ERROR in arguments. --testid must be passed if using --suite or --test" exit -1 @@ -422,7 +425,9 @@ if ( ${dosuite} == 0 ) then else set tarrays = `echo ${testsuite} | sed 's/,/ /g' | fmt -1 | sort -u` + set testsuitecnt = 0 foreach tarray ( ${tarrays} ) + @ testsuitecnt = ${testsuitecnt} + 1 if (-e ${tarray}) then cat ${tarray} >> $tsfile else if (-e ${tarray}.ts) then @@ -504,6 +509,14 @@ EOF0 cat >! ${tsdir}/report_codecov.csh << EOF0 #!/bin/csh -f +source ${ICE_SCRIPTS}/machines/env.${machcomp} + +set rn0 = "${sdate}-${stime}:${shhash}:${testsuitecnt}:${testsuite}" +set rn1 = \`echo \${rn0} | sed -e 's/ //g'\` +set report_name = \`echo \${rn1} | sed -e 's/_suite//g'\` + +#for codecov +set use_curl = 1 # define CODECOV_TOKEN env variable if !(\$?CODECOV_TOKEN) then if (-e ~/.codecov_cice_token) then @@ -515,26 +528,27 @@ if !(\$?CODECOV_TOKEN) then endif endif -set report_name = "${shhash}:${branch}:${machine} ${testsuite}" -set use_curl = 1 +#for lcov +set lcovalist = "" EOF0 chmod +x ${tsdir}/suite.submit chmod +x ${tsdir}/results.csh chmod +x ${tsdir}/report_codecov.csh + cp -p -f ${tsdir}/report_codecov.csh ${tsdir}/report_lcov.csh endif #------------------------------------------------------------------- # Loop over cases/tests -set ncompilers = "`echo $compilers | sed -e 's/,/ /g'`" +set nenvnames = "`echo $envnames | sed -e 's/,/ /g'`" -# check that machines and compilers are valid before starting big loop +# check that machines and envnames are valid before starting big loop set doabort = false -foreach compiler ( $ncompilers ) - set machcomp = ${machine}_${compiler} +foreach envname ( $nenvnames ) + set machcomp = ${machine}_${envname} foreach file (env.${machcomp} Macros.${machcomp}) if !(-e ${ICE_SCRIPTS}/machines/$file) then echo "${0}: ERROR, ${ICE_SCRIPTS}/machines/$file not found" @@ -549,8 +563,8 @@ endif # Create a new sets_base variable to store sets passed to cice.setup set sets_base = "${sets}" set bfbcomp_base = "$bfbcomp" -foreach compiler ( $ncompilers ) - set machcomp = ${machine}_${compiler} +foreach envname ( $nenvnames ) + set machcomp = ${machine}_${envname} foreach line ( "`cat $tsfile`" ) # Check if line is a comment line @@ -572,6 +586,15 @@ EOF continue endif + # unset env variables that might not exist in env machine file + # to avoid any carry over during multi envname suites + unsetenv ICE_MACHINE_MAXTHREADS + unsetenv ICE_MACHINE_MAXPES + unsetenv ICE_MACHINE_QUIETMODE + unsetenv ICE_MACHINE_CPPDEFS + unsetenv ICE_MACHINE_QSTAT + unsetenv ICE_MACHINE_MACHINFO + unsetenv ICE_MACHINE_ENVINFO source ${ICE_SCRIPTS}/machines/env.${machcomp} -nomodules || exit 2 # Obtain the test name, sets, grid, and PE information from .ts file @@ -754,7 +777,7 @@ EOF echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found" exit -1 endif - cp -f -p ${ICE_SCRIPTS}/$file ${casedir} + cp -f -p ${ICE_SCRIPTS}/$file ${casedir}/ end # from machines dir to case @@ -763,7 +786,7 @@ EOF echo "${0}: ERROR, ${ICE_SCRIPTS}/machines/$file not found" exit -1 endif - cp -f -p ${ICE_SCRIPTS}/machines/$file ${casedir} + cp -f -p ${ICE_SCRIPTS}/machines/$file ${casedir}/ end # from basic script dir to casescr @@ -772,7 +795,16 @@ EOF echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found" exit -1 endif - cp -f -p ${ICE_SCRIPTS}/$file ${casescr} + cp -f -p ${ICE_SCRIPTS}/$file ${casescr}/ + end + + # from tests dir to casescr + foreach file (cice.results.csh cice.codecov.csh cice.lcov.csh) + if !(-e ${ICE_SCRIPTS}/tests/$file) then + echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found" + exit -1 + endif + cp -f -p ${ICE_SCRIPTS}/tests/$file ${casescr}/ end cd ${casedir} @@ -782,6 +814,11 @@ EOF set quietmode = ${ICE_MACHINE_QUIETMODE} endif + set cppdefs = "" + if ($?ICE_MACHINE_CPPDEFS) then + set cppdefs = ${ICE_MACHINE_CPPDEFS} + endif + if (${acct} == ${spval}) then if (-e ~/.cice_proj) then set acct = `head -1 ~/.cice_proj` @@ -820,7 +857,7 @@ EOF echo "ICE_CASENAME = ${casename}" echo "ICE_CASEDIR = ${casedir}" echo "ICE_MACHINE = ${machine}" - echo "ICE_COMPILER = ${compiler}" + echo "ICE_ENVNAME = ${envname}" echo "ICE_RUNDIR = ${rundir}" echo "ICE_PES = ${task}x${thrd}" echo "ICE_GRID = ${grid} (${ICE_DECOMP_NXGLOB}x${ICE_DECOMP_NYGLOB}) blocksize=${ICE_DECOMP_BLCKX}x${ICE_DECOMP_BLCKY}x${ICE_DECOMP_MXBLCKS}" @@ -874,7 +911,7 @@ setenv ICE_SCRIPTS ${ICE_SCRIPTS} setenv ICE_CASENAME ${casename} setenv ICE_CASEDIR ${casedir} setenv ICE_MACHINE ${machine} -setenv ICE_COMPILER ${compiler} +setenv ICE_ENVNAME ${envname} setenv ICE_MACHCOMP ${machcomp} setenv ICE_RUNDIR ${rundir} setenv ICE_GRID ${grid} @@ -884,6 +921,7 @@ setenv ICE_BASELINE ${basedir_tmp} setenv ICE_BASEGEN ${baseGen} setenv ICE_BASECOM ${baseCom} setenv ICE_SPVAL ${spval} +setenv ICE_CPPDEFS ${cppdefs} setenv ICE_QUIETMODE ${quietmode} setenv ICE_TEST ${test} setenv ICE_TESTNAME ${testname_noid} @@ -891,7 +929,7 @@ setenv ICE_TESTID ${testid} setenv ICE_BFBCOMP ${fbfbcomp} setenv ICE_ACCOUNT ${acct} setenv ICE_QUEUE ${queue} -setenv ICE_CODECOV ${codecovflag} +setenv ICE_COVERAGE ${coverageflag} EOF1 if (${sets} != "") then @@ -1021,6 +1059,14 @@ EOF mkdir ${testname_base}/codecov_output cp ${rundir}/compile/*.{gcno,gcda} ${testname_base}/codecov_output/ +EOF + + cat >> ${tsdir}/report_lcov.csh << EOF +lcov --gcov-tool gcov -c -d ${rundir}/compile -o ${testname_base}/lcov.info +if (-s ${testname_base}/lcov.info) then + set lcovalist = "\${lcovalist} -a ${testname_base}/lcov.info" +endif + EOF cat >> ${tsdir}/suite.submit << EOF @@ -1031,7 +1077,7 @@ cd ${testname_base} source ./cice.settings if (\${dobuild} == true) then if (\${doreuse} == true) then - set ciceexe = "../ciceexe.\${ICE_COMPILER}.\${ICE_COMMDIR}.\${ICE_BLDDEBUG}.\${ICE_THREADED}.\${ICE_IOTYPE}" + set ciceexe = "../ciceexe.\${ICE_ENVNAME}.\${ICE_COMMDIR}.\${ICE_BLDDEBUG}.\${ICE_THREADED}.\${ICE_IOTYPE}" ./cice.build --exe \${ciceexe} if !(-e \${ciceexe}) cp -p \${ICE_RUNDIR}/cice \${ciceexe} else @@ -1056,7 +1102,7 @@ EOF # This is the foreach end for the testsuite end -# This is the foreach end for the compilers +# This is the foreach end for the envnames end #----------------------------------------------------- @@ -1071,60 +1117,7 @@ set nonomatch && rm -f ciceexe.* && unset nonomatch EOF0 - # Add code to results.csh to count the number of failures - cat >> ${tsdir}/results.csh << EOF -cat ./results.log -set pends = \`cat ./results.log | grep PEND | wc -l\` -set misses = \`cat ./results.log | grep MISS | wc -l\` -set failures = \`cat ./results.log | grep FAIL | wc -l\` -set failbuild = \`cat ./results.log | grep FAIL | grep " build " | wc -l\` -set failrun = \`cat ./results.log | grep FAIL | grep " run " | wc -l\` -set failtest = \`cat ./results.log | grep FAIL | grep " test " | wc -l\` -set failcomp = \`cat ./results.log | grep FAIL | grep " compare " | wc -l\` -set failbfbc = \`cat ./results.log | grep FAIL | grep " bfbcomp " | wc -l\` -set failgen = \`cat ./results.log | grep FAIL | grep " generate " | wc -l\` -set success = \`cat ./results.log | grep 'PASS\|COPY' | wc -l\` -set comments = \`cat ./results.log | grep "#" | wc -l\` -set alltotal = \`cat ./results.log | wc -l\` -@ total = \$alltotal - \$comments -@ chkcnt = \$pends + \$misses + \$failures + \$success - -echo "#------- " >> results.log -echo " " >> results.log -echo "#totl = \$total total" >> results.log -echo "#chkd = \$chkcnt checked" >> results.log -echo "#pass = \$success" >> results.log -echo "#pend = \$pends" >> results.log -echo "#miss = \$misses" >> results.log -echo "#fail = \$failures" >> results.log -echo " #failbuild = \$failbuild" >> results.log -echo " #failrun = \$failrun" >> results.log -echo " #failtest = \$failtest" >> results.log -echo " #failcomp = \$failcomp" >> results.log -echo " #failbfbc = \$failbfbc" >> results.log -echo " #failgen = \$failgen" >> results.log - -echo "" -echo "Descriptors:" -echo " PASS - successful completion" -echo " COPY - previously compiled code was copied for new test" -echo " MISS - comparison data is missing" -echo " PEND - status is undertermined; test may still be queued, running, or timed out" -echo " FAIL - test failed" -echo "" -echo "\$chkcnt measured results of \$total total results" -echo "\$success of \$chkcnt tests PASSED" -echo "\$pends of \$chkcnt tests PENDING" -echo "\$misses of \$chkcnt tests MISSING data" -echo "\$failures of \$chkcnt tests FAILED" -#echo " \$failbuild of \$failures FAILED build" -#echo " \$failrun of \$failures FAILED run" -#echo " \$failtest of \$failures FAILED test" -#echo " \$failcomp of \$failures FAILED compare" -#echo " \$failbfbc of \$failures FAILED bfbcomp" -#echo " \$failgen of \$failures FAILED generate" -exit \$failures -EOF + # Add code to post processing scripts if ($?ICE_MACHINE_QSTAT) then cat >! ${tsdir}/poll_queue.env << EOF0 @@ -1132,19 +1125,11 @@ setenv ICE_MACHINE_QSTAT ${ICE_MACHINE_QSTAT} EOF0 endif -cat >> ${tsdir}/report_codecov.csh << EOF -source ${ICE_SCRIPTS}/machines/env.${machcomp} + cat ${casescr}/cice.results.csh >> ${tsdir}/results.csh -if ( \${use_curl} == 1 ) then - bash -c "bash <(curl -s https://codecov.io/bash) -n '\${report_name}' -y ./codecov.yml " -else - bash -c "bash <(wget -O - https://codecov.io/bash) -n '\${report_name}' -y ./codecov.yml " -endif - -sleep 10 -rm -r -f ./*/codecov_output + cat ${casescr}/cice.codecov.csh >> ${tsdir}/report_codecov.csh -EOF + cat ${casescr}/cice.lcov.csh >> ${tsdir}/report_lcov.csh # build and submit tests cd ${tsdir} @@ -1159,10 +1144,11 @@ EOF ./results.csh ./report_results.csh endif - if ($codecov == 1) then - echo "Generating codecov reports" + if ($coverage == 1) then + echo "Generating coverage reports" ./poll_queue.csh - ./report_codecov.csh + ./report_lcov.csh + #./report_codecov.csh endif cd ${ICE_SANDBOX} diff --git a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 index 60d120435..a496402f0 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 @@ -615,8 +615,8 @@ subroutine transport_remap (dt) asum_init(0), asum_final(0)) if (l_stop) then - write (nu_diag,*) 'istep1, my_task, iblk =', & - istep1, my_task, iblk + write (nu_diag,*) 'istep1, my_task =', & + istep1, my_task write (nu_diag,*) 'transport: conservation error, cat 0' call abort_ice(subname//'ERROR: conservation error1') endif @@ -629,8 +629,8 @@ subroutine transport_remap (dt) atsum_init(:,n), atsum_final(:,n)) if (l_stop) then - write (nu_diag,*) 'istep1, my_task, iblk, cat =', & - istep1, my_task, iblk, n + write (nu_diag,*) 'istep1, my_task, cat =', & + istep1, my_task, n write (nu_diag,*) 'transport: conservation error, cat ',n call abort_ice(subname//'ERROR: conservation error2') endif diff --git a/cicecore/cicedynB/dynamics/ice_transport_remap.F90 b/cicecore/cicedynB/dynamics/ice_transport_remap.F90 index ff48f1497..070f3b7ad 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_remap.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_remap.F90 @@ -30,6 +30,7 @@ module ice_transport_remap use ice_kinds_mod + use ice_blocks, only: nx_block, ny_block use ice_communicate, only: my_task use ice_constants, only: c0, c1, c2, c12, p333, p4, p5, p6, & eps13, eps16, & @@ -254,7 +255,6 @@ module ice_transport_remap subroutine init_remap use ice_domain, only: nblocks - use ice_blocks, only: nx_block, ny_block use ice_grid, only: xav, yav, xxav, yyav ! dxt, dyt, xyav, & ! xxxav, xxyav, xyyav, yyyav @@ -324,7 +324,7 @@ subroutine horizontal_remap (dt, ntrace, & use ice_boundary, only: ice_halo, ice_HaloMask, ice_HaloUpdate, & ice_HaloDestroy use ice_domain, only: nblocks, blocks_ice, halo_info, maskhalo_remap - use ice_blocks, only: block, get_block, nghost, nx_block, ny_block + use ice_blocks, only: block, get_block, nghost use ice_grid, only: HTE, HTN, dxu, dyu, & tarear, hm, & xav, yav, xxav, yyav @@ -384,8 +384,7 @@ subroutine horizontal_remap (dt, ntrace, & integer (kind=int_kind), dimension(0:ncat,max_blocks) :: & icellsnc ! number of cells with ice - integer (kind=int_kind), & - dimension(nx_block*ny_block,0:ncat) :: & + integer (kind=int_kind), dimension(nx_block*ny_block,0:ncat) :: & indxinc, indxjnc ! compressed i/j indices real (kind=dbl_kind), dimension(nx_block,ny_block) :: & @@ -403,13 +402,11 @@ subroutine horizontal_remap (dt, ntrace, & real (kind=dbl_kind), dimension(nx_block,ny_block,0:ncat) :: & mmask ! = 1. if mass is present, = 0. otherwise - real (kind=dbl_kind), & - dimension (nx_block,ny_block,ntrace,ncat,max_blocks) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat,max_blocks) :: & tc ,&! tracer values at geometric center of cell tx, ty ! limited derivative of tracer wrt x and y - real (kind=dbl_kind), & - dimension (nx_block,ny_block,ntrace,ncat) :: & + real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat) :: & tmask ! = 1. if tracer is present, = 0. otherwise real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat) :: & @@ -424,19 +421,19 @@ subroutine horizontal_remap (dt, ntrace, & real (kind=dbl_kind), dimension (nx_block,ny_block,0:nvert,ngroups) :: & xp, yp ! x and y coordinates of special triangle points ! (need 4 points for triangle integrals) - - integer (kind=int_kind), & - dimension (nx_block,ny_block,ngroups) :: & + integer (kind=int_kind), dimension (nx_block,ny_block,ngroups) :: & iflux ,&! i index of cell contributing transport jflux ! j index of cell contributing transport integer (kind=int_kind), dimension(ngroups,max_blocks) :: & icellsng ! number of cells with ice - integer (kind=int_kind), & - dimension(nx_block*ny_block,ngroups) :: & + integer (kind=int_kind), dimension(nx_block*ny_block,ngroups) :: & indxing, indxjng ! compressed i/j indices + integer (kind=int_kind), dimension(nx_block,ny_block,max_blocks) :: & + halomask ! temporary mask for fast halo updates + logical (kind=log_kind) :: & l_stop ! if true, abort the model @@ -446,9 +443,6 @@ subroutine horizontal_remap (dt, ntrace, & character (len=char_len) :: & edge ! 'north' or 'east' - integer (kind=int_kind), & - dimension(nx_block,ny_block,max_blocks) :: halomask - type (ice_halo) :: halo_info_tracer type (block) :: & @@ -515,6 +509,7 @@ subroutine horizontal_remap (dt, ntrace, & mmask (:,:,0) ) ! ice categories + do n = 1, ncat call construct_fields(nx_block, ny_block, & diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 index 52d4124b4..66a7d9ef3 100755 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -122,6 +122,9 @@ module ice_forcing ! 'hadgem_sst' or 'hadgem_sst_uvocn' ice_data_type, & ! 'default', 'box2001', 'boxslotcyl' precip_units ! 'mm_per_month', 'mm_per_sec', 'mks','m_per_sec' + + logical (kind=log_kind), public :: & + rotate_wind ! rotate wind/stress to computational grid from true north directed character(char_len_long), public :: & atm_data_dir , & ! top directory for atmospheric data @@ -1628,11 +1631,10 @@ subroutine prepare_forcing (nx_block, ny_block, & if (calc_strair) then - do j = jlo, jhi - do i = ilo, ihi - - wind(i,j) = sqrt(uatm(i,j)**2 + vatm(i,j)**2) - + if (rotate_wind) then + do j = jlo, jhi + do i = ilo, ihi + wind(i,j) = sqrt(uatm(i,j)**2 + vatm(i,j)**2) !----------------------------------------------------------------- ! Rotate zonal/meridional vectors to local coordinates. ! Velocity comes in on T grid, but is oriented geographically --- @@ -1644,30 +1646,38 @@ subroutine prepare_forcing (nx_block, ny_block, & ! atmo_boundary_layer, and are interpolated to the U grid later as ! necessary. !----------------------------------------------------------------- - workx = uatm(i,j) ! wind velocity, m/s - worky = vatm(i,j) - uatm (i,j) = workx*cos(ANGLET(i,j)) & ! convert to POP grid - + worky*sin(ANGLET(i,j)) ! note uatm, vatm, wind - vatm (i,j) = worky*cos(ANGLET(i,j)) & ! are on the T-grid here - - workx*sin(ANGLET(i,j)) - - enddo ! i - enddo ! j - - else ! strax, stray, wind are read from files - - do j = jlo, jhi - do i = ilo, ihi - - workx = strax(i,j) ! wind stress - worky = stray(i,j) - strax(i,j) = workx*cos(ANGLET(i,j)) & ! convert to POP grid - + worky*sin(ANGLET(i,j)) ! note strax, stray, wind - stray(i,j) = worky*cos(ANGLET(i,j)) & ! are on the T-grid here - - workx*sin(ANGLET(i,j)) - - enddo ! i - enddo ! j + workx = uatm(i,j) ! wind velocity, m/s + worky = vatm(i,j) + uatm (i,j) = workx*cos(ANGLET(i,j)) & ! convert to POP grid + + worky*sin(ANGLET(i,j)) ! note uatm, vatm, wind + vatm (i,j) = worky*cos(ANGLET(i,j)) & ! are on the T-grid here + - workx*sin(ANGLET(i,j)) + enddo ! i + enddo ! j + else ! not rotated + do j = jlo, jhi + do i = ilo, ihi + wind(i,j) = sqrt(uatm(i,j)**2 + vatm(i,j)**2) + enddo ! i + enddo ! j + endif ! rotated + + else ! strax, stray, wind are read from files + + if (rotate_wind) then + do j = jlo, jhi + do i = ilo, ihi + workx = strax(i,j) ! wind stress + worky = stray(i,j) + strax(i,j) = workx*cos(ANGLET(i,j)) & ! convert to POP grid + + worky*sin(ANGLET(i,j)) ! note strax, stray, wind + stray(i,j) = worky*cos(ANGLET(i,j)) & ! are on the T-grid here + - workx*sin(ANGLET(i,j)) + enddo ! i + enddo ! j + else ! not rotated + ! wind (speed) is already read from file, so all is in place + endif ! rotated endif ! calc_strair @@ -2050,11 +2060,11 @@ subroutine JRA55_gx1_files(yr) uwind_file = & trim(atm_data_dir)//'/8XDAILY/JRA55_03hr_forcing_2005.nc' call file_year(uwind_file,yr) - if (my_task == master_task) then + if (my_task == master_task) then write (nu_diag,*) ' ' write (nu_diag,*) 'Atmospheric data files:' write (nu_diag,*) trim(uwind_file) - endif + endif end subroutine JRA55_gx1_files subroutine JRA55_tx1_files(yr) ! @@ -2066,11 +2076,11 @@ subroutine JRA55_tx1_files(yr) uwind_file = & trim(atm_data_dir)//'/8XDAILY/JRA55_03hr_forcing_tx1_2005.nc' call file_year(uwind_file,yr) - if (my_task == master_task) then + if (my_task == master_task) then write (nu_diag,*) ' ' write (nu_diag,*) 'Atmospheric data files:' write (nu_diag,*) trim(uwind_file) - endif + endif end subroutine JRA55_tx1_files subroutine JRA55_gx3_files(yr) ! @@ -2082,11 +2092,11 @@ subroutine JRA55_gx3_files(yr) uwind_file = & trim(atm_data_dir)//'/8XDAILY/JRA55_gx3_03hr_forcing_2005.nc' call file_year(uwind_file,yr) - if (my_task == master_task) then + if (my_task == master_task) then write (nu_diag,*) ' ' write (nu_diag,*) 'Atmospheric data files:' write (nu_diag,*) trim(uwind_file) - endif + endif end subroutine JRA55_gx3_files !======================================================================= ! @@ -4471,7 +4481,7 @@ subroutine hycom_atm_data write (nu_diag,*) & 'ERROR: CICE: Atm forcing not available at hcdate =',hcdate write (nu_diag,*) & - 'ERROR: CICE: nyr, year_init, yday = ',nyr, year_init, yday + 'ERROR: CICE: nyr, year_init, yday ,sec = ',nyr, year_init, yday, sec call abort_ice ('ERROR: CICE stopped') endif diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index 289b70a9f..f43c08793 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -59,7 +59,7 @@ subroutine input_data use ice_broadcast, only: broadcast_scalar, broadcast_array use ice_diagnostics, only: diag_file, print_global, print_points, latpnt, lonpnt - use ice_domain, only: close_boundaries + use ice_domain, only: close_boundaries, ns_boundary_type use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, nfsd, nfreq, & n_iso, n_aero, n_zaero, n_algae, & n_doc, n_dic, n_don, n_fed, n_fep, & @@ -83,7 +83,7 @@ subroutine input_data use ice_flux_bgc, only: cpl_bgc use ice_forcing, only: & ycycle, fyear_init, dbug, & - atm_data_type, atm_data_dir, precip_units, & + atm_data_type, atm_data_dir, precip_units, rotate_wind, & atm_data_format, ocn_data_format, & bgc_data_type, & ocn_data_type, ocn_data_dir, wave_spec_file, & @@ -117,7 +117,7 @@ subroutine input_data ahmax, R_ice, R_pnd, R_snw, dT_mlt, rsnw_mlt, emissivity, & mu_rdg, hs0, dpscale, rfracmin, rfracmax, pndaspect, hs1, hp1, & a_rapid_mode, Rac_rapid_mode, aspect_rapid_mode, dSdt_slow_mode, & - phi_c_slow_mode, phi_i_mushy, kalg, atmiter_conv + phi_c_slow_mode, phi_i_mushy, kalg, atmiter_conv, Pstar, Cstar integer (kind=int_kind) :: ktherm, kstrength, krdg_partic, krdg_redist, natmiter, & kitd, kcatbound @@ -134,8 +134,9 @@ subroutine input_data integer (kind=int_kind) :: rpcesm, rplvl, rptopo real (kind=dbl_kind) :: Cf, ksno, puny - integer :: abort_flag + character (len=char_len) :: abort_list character (len=64) :: tmpstr + character (len=128) :: tmpstr2 character(len=*), parameter :: subname='(input_data)' @@ -189,7 +190,8 @@ subroutine input_data advection, coriolis, kridge, ktransport, & kstrength, krdg_partic, krdg_redist, mu_rdg, & e_ratio, Ktens, Cf, basalstress, & - k1, k2, alphab, threshold_hw + k1, k2, alphab, threshold_hw, & + Pstar, Cstar namelist /shortwave_nml/ & shortwave, albedo_type, & @@ -205,7 +207,7 @@ subroutine input_data namelist /forcing_nml/ & formdrag, atmbndy, calc_strair, calc_Tsfc, & highfreq, natmiter, atmiter_conv, & - ustar_min, emissivity, & + ustar_min, emissivity, & fbot_xfer_type, update_ocn_f, l_mpond_fresh, tfrz_option, & oceanmixed_ice, restore_ice, restore_ocn, trestore, & precip_units, default_season, wave_spec_type,nfreq, & @@ -213,14 +215,14 @@ subroutine input_data ice_data_type, wave_spec_file, & fyear_init, ycycle, & atm_data_dir, ocn_data_dir, bgc_data_dir, & - atm_data_format, ocn_data_format, & + atm_data_format, ocn_data_format, rotate_wind, & oceanmixed_file !----------------------------------------------------------------- ! default values !----------------------------------------------------------------- - abort_flag = 0 + abort_list = "" call icepack_query_parameters(puny_out=puny) ! nu_diag not yet defined @@ -257,7 +259,7 @@ subroutine input_data history_file = 'iceh' ! history file name prefix history_precision = 4 ! precision of history files write_ic = .false. ! write out initial condition - cpl_bgc = .false. ! history file name prefix + cpl_bgc = .false. ! couple bgc thru driver incond_dir = history_dir ! write to history dir for default incond_file = 'iceh_ic'! file prefix dumpfreq='y' ! restart frequency option @@ -297,11 +299,15 @@ subroutine input_data revised_evp = .false. ! if true, use revised procedure for evp dynamics yield_curve = 'ellipse' kstrength = 1 ! 1 = Rothrock 75 strength, 0 = Hibler 79 + Pstar = 2.75e4_dbl_kind ! constant in Hibler strength formula (kstrength = 0) + Cstar = 20._dbl_kind ! constant in Hibler strength formula (kstrength = 0) krdg_partic = 1 ! 1 = new participation, 0 = Thorndike et al 75 krdg_redist = 1 ! 1 = new redistribution, 0 = Hibler 80 mu_rdg = 3 ! e-folding scale of ridged ice, krdg_partic=1 (m^0.5) Cf = 17.0_dbl_kind ! ratio of ridging work to PE change in ridging ksno = 0.3_dbl_kind ! snow thermal conductivity + dxrect = 0.0_dbl_kind ! user defined grid spacing in cm in x direction + dyrect = 0.0_dbl_kind ! user defined grid spacing in cm in y direction close_boundaries = .false. ! true = set land on edges of grid basalstress= .false. ! if true, basal stress for landfast is on k1 = 8.0_dbl_kind ! 1st free parameter for landfast parameterization @@ -354,6 +360,7 @@ subroutine input_data atm_data_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf) atm_data_type = 'default' atm_data_dir = ' ' + rotate_wind = .true. ! rotate wind/stress composants to computational grid orientation calc_strair = .true. ! calculate wind stress formdrag = .false. ! calculate form drag highfreq = .false. ! calculate high frequency RASM coupling @@ -582,6 +589,8 @@ subroutine input_data call broadcast_scalar(revised_evp, master_task) call broadcast_scalar(yield_curve, master_task) call broadcast_scalar(kstrength, master_task) + call broadcast_scalar(Pstar, master_task) + call broadcast_scalar(Cstar, master_task) call broadcast_scalar(krdg_partic, master_task) call broadcast_scalar(krdg_redist, master_task) call broadcast_scalar(mu_rdg, master_task) @@ -628,6 +637,7 @@ subroutine input_data call broadcast_scalar(atm_data_format, master_task) call broadcast_scalar(atm_data_type, master_task) call broadcast_scalar(atm_data_dir, master_task) + call broadcast_scalar(rotate_wind, master_task) call broadcast_scalar(calc_strair, master_task) call broadcast_scalar(calc_Tsfc, master_task) call broadcast_scalar(formdrag, master_task) @@ -759,10 +769,10 @@ subroutine input_data ice_ic /= 'none' .and. ice_ic /= 'default') then if (my_task == master_task) then write(nu_diag,*) subname//' ERROR: runtype, restart, ice_ic are inconsistent:' - write(nu_diag,*) subname//' ERROR: runtype=',trim(runtype), 'restart=',restart, 'ice_ic=',trim(ice_ic) + write(nu_diag,*) subname//' ERROR: runtype=',trim(runtype), ' restart=',restart, ' ice_ic=',trim(ice_ic) write(nu_diag,*) subname//' ERROR: Please review user guide' endif - abort_flag = 1 + abort_list = trim(abort_list)//":1" endif #ifndef ncdf @@ -771,13 +781,13 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: ncdf CPP flag unset, data formats must be bin' write(nu_diag,*) subname//' ERROR: check grid_format, atm_data_format, ocn_data_format or set ncdf CPP' endif - abort_flag = 2 + abort_list = trim(abort_list)//":2" endif #endif if (advection /= 'remap' .and. advection /= 'upwind' .and. advection /= 'none') then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: invalid advection=',trim(advection) - abort_flag = 3 + abort_list = trim(abort_list)//":3" endif if (ncat == 1 .and. kitd == 1) then @@ -787,7 +797,7 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: Use kitd = 0 (delta function ITD) with kcatbound = 0' write(nu_diag,*) subname//' ERROR: or for column configurations use kcatbound = -1' endif - abort_flag = 4 + abort_list = trim(abort_list)//":4" endif if (ncat /= 1 .and. kcatbound == -1) then @@ -796,7 +806,7 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: ncat=',ncat,' kcatbound=',kcatbound write(nu_diag,*) subname//' ERROR: Please review user guide' endif - abort_flag = 5 + abort_list = trim(abort_list)//":5" endif if (kdyn == 2 .and. revised_evp) then @@ -807,6 +817,13 @@ subroutine input_data revised_evp = .false. endif + if (kdyn > 2) then + if (my_task == master_task) then + write(nu_diag,*) subname//' WARNING: kdyn out of range' + endif + abort_list = trim(abort_list)//":33" + endif + rpcesm = 0 rplvl = 0 rptopo = 0 @@ -821,14 +838,14 @@ subroutine input_data if (my_task == master_task) then write(nu_diag,*) subname//' ERROR: Must use only one melt pond scheme' endif - abort_flag = 6 + abort_list = trim(abort_list)//":6" endif if (tr_pond_lvl .and. .not. tr_lvl) then if (my_task == master_task) then write(nu_diag,*) subname//' ERROR: tr_pond_lvl=T but tr_lvl=F' endif - abort_flag = 30 + abort_list = trim(abort_list)//":30" endif ! tcraig - this was originally implemented by resetting hs0=0. EH says it might be OK @@ -839,7 +856,7 @@ subroutine input_data if (my_task == master_task) then write(nu_diag,*) subname//' ERROR: tr_pond_lvl=T and hs0 /= 0' endif - abort_flag = 7 + abort_list = trim(abort_list)//":7" endif if (trim(shortwave) /= 'dEdd' .and. tr_pond .and. calc_tsfc) then @@ -847,7 +864,7 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: tr_pond=T, calc_tsfc=T, invalid shortwave' write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd' endif - abort_flag = 8 + abort_list = trim(abort_list)//":8" endif if (tr_iso .and. n_iso==0) then @@ -856,7 +873,7 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: not allocated in tracer array.' write(nu_diag,*) subname//' ERROR: if tr_iso, n_iso must be > 0.' endif - abort_flag = 31 + abort_list = trim(abort_list)//":31" endif if (tr_aero .and. n_aero==0) then @@ -865,7 +882,36 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: not allocated in tracer array.' write(nu_diag,*) subname//' ERROR: if tr_aero, n_aero must be > 0.' endif - abort_flag = 9 + abort_list = trim(abort_list)//":9" + endif + + if (ncat < 1) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: ncat < 1' + endif + abort_list = trim(abort_list)//":32" + endif + + if (nilyr < 1) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: nilyr < 1' + endif + abort_list = trim(abort_list)//":33" + endif + + if (nslyr < 1) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: nslyr < 1' + endif + abort_list = trim(abort_list)//":34" + endif + + if (nblyr < 1) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: nblyr < 1' + write(nu_diag,*) subname//' ERROR: not allowed due to history implementation.' + endif + abort_list = trim(abort_list)//":35" endif if (nfsd < 1) then @@ -873,7 +919,7 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: nfsd < 1' write(nu_diag,*) subname//' ERROR: not allowed due to history implementation.' endif - abort_flag = 32 + abort_list = trim(abort_list)//":36" endif if (trim(shortwave) /= 'dEdd' .and. tr_aero) then @@ -881,7 +927,7 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: tr_aero=T, invalid shortwave' write(nu_diag,*) subname//' ERROR: Must use shortwave=dEdd' endif - abort_flag = 10 + abort_list = trim(abort_list)//":10" endif if ((rfracmin < -puny .or. rfracmin > c1+puny) .or. & @@ -891,19 +937,19 @@ subroutine input_data write(nu_diag,*) subname//' ERROR: rfracmin, rfracmax must be between 0 and 1' write(nu_diag,*) subname//' ERROR: and rfracmax >= rfracmin' endif - abort_flag = 11 + abort_list = trim(abort_list)//":11" endif rfracmin = min(max(rfracmin,c0),c1) rfracmax = min(max(rfracmax,c0),c1) if (trim(atm_data_type) == 'monthly' .and. calc_strair) then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: atm_data_type=monthly and calc_strair=T' - abort_flag = 12 + abort_list = trim(abort_list)//":12" endif if (ktherm == 2 .and. .not. calc_Tsfc) then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: ktherm = 2 and calc_Tsfc=F' - abort_flag = 13 + abort_list = trim(abort_list)//":13" endif ! tcraig, is it really OK for users to run inconsistently? @@ -925,38 +971,38 @@ subroutine input_data if (formdrag) then if (trim(atmbndy) == 'constant') then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and atmbndy=constant' - abort_flag = 14 + abort_list = trim(abort_list)//":14" endif if (.not. calc_strair) then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and calc_strair=F' - abort_flag = 15 + abort_list = trim(abort_list)//":15" endif if (.not. tr_pond) then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and tr_pond=F' - abort_flag = 16 + abort_list = trim(abort_list)//":16" endif if (tr_pond_cesm) then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and frzpnd=cesm' - abort_flag = 17 + abort_list = trim(abort_list)//":17" endif if (.not. tr_lvl) then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=T and tr_lvl=F' - abort_flag = 18 + abort_list = trim(abort_list)//":18" endif endif if (trim(fbot_xfer_type) == 'Cdn_ocn' .and. .not. formdrag) then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: formdrag=F and fbot_xfer_type=Cdn_ocn' - abort_flag = 19 + abort_list = trim(abort_list)//":19" endif if(history_precision .ne. 4 .and. history_precision .ne. 8) then - write (nu_diag,*) 'ERROR: bad value for history_precision, allowed values: 4, 8' - abort_flag = 22 + write (nu_diag,*) subname//' ERROR: bad value for history_precision, allowed values: 4, 8' + abort_list = trim(abort_list)//":22" endif if (.not.(trim(dumpfreq) == 'y' .or. trim(dumpfreq) == 'Y' .or. & @@ -989,7 +1035,390 @@ subroutine input_data if (my_task == master_task) then - write(nu_diag,*) ' Document ice_in namelist parameters:' + write(nu_diag,*) ' Overview of model configuration with relevant parameters' + write(nu_diag,*) ' ========================================================' + write(nu_diag,*) ' For details, compare namelist output below with the' + write(nu_diag,*) ' Case Settings section in the model documentation.' + write(nu_diag,*) ' ' + write(nu_diag,*) ' Calendar' + write(nu_diag,*) '--------------------------------' + write(nu_diag,1022) ' days_per_year = ',days_per_year,' number of days in a model year' + if (use_leap_years) then + tmpstr2 = ' leap days are included' + else + tmpstr2 = ' leap days are not included' + endif + write(nu_diag,1012) ' use_leap_years = ',use_leap_years,trim(tmpstr2) + write(nu_diag,1002) ' dt = ', dt, ' model time step' + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Grid, Discretization' + write(nu_diag,*) '--------------------------------' + if (trim(grid_type) == 'rectangular') & + write(nu_diag,*) 'grid_type = ', & + trim(grid_type),': internally defined, rectangular grid' + if (trim(grid_type) == 'regional') & + write(nu_diag,*) 'grid_type = ', & + trim(grid_type),': user-defined, regional grid' + if (trim(grid_type) == 'displaced_pole') & + write(nu_diag,*) 'grid_type = ', & + trim(grid_type),': user-defined grid with rotated north pole' + if (trim(grid_type) == 'tripole') then + write(nu_diag,*) 'grid_type = ', & + trim(grid_type),': user-defined grid with northern hemisphere zipper' + if (trim(ns_boundary_type) == 'tripole') then + tmpstr2 = ' on U points (nodes)' + elseif (trim(ns_boundary_type) == 'tripoleT') then + tmpstr2 = ' on T points (cell centers)' + endif + write(nu_diag,*) 'ns_boundary_type = ', trim(ns_boundary_type),trim(tmpstr2) + endif + if (trim(grid_type) /= 'rectangular') then + if (use_bathymetry) then + tmpstr2 = ' bathymetric input data is used' + else + tmpstr2 = ' bathymetric input data is not used' + endif + write(nu_diag,1012) ' use_bathymetry = ', use_bathymetry,trim(tmpstr2) + endif + write(nu_diag,1022) ' nilyr = ', nilyr, ' number of ice layers (equal thickness)' + write(nu_diag,1022) ' nslyr = ', nslyr, ' number of snow layers (equal thickness)' + write(nu_diag,1022) ' nblyr = ', nblyr, ' number of bio layers (equal thickness)' + if (trim(shortwave) == 'dEdd') & + write(nu_diag,*) 'dEdd interior and sfc scattering layers are used in both ice, snow (unequal)' + write(nu_diag,1022) ' ncat = ', ncat, ' number of ice categories' + if (kcatbound == 0) then + tmpstr2 = ' original ITD category bounds' + elseif (kcatbound == 1) then + tmpstr2 = ' round-number category bounds' + elseif (kcatbound == 2) then + tmpstr2 = ' WMO standard ITD categories' + elseif (kcatbound == -1) then + tmpstr2 = ' one thickness category' + endif + write(nu_diag,1022) ' kcatbound = ', kcatbound,trim(tmpstr2) + if (kitd==0) then + tmpstr2 = ' delta function ITD approx' + else + tmpstr2 = ' linear remapping ITD approx' + endif + write(nu_diag,1022) ' kitd = ', kitd,trim(tmpstr2) + + if (tr_fsd) then + tmpstr2 = ' floe size distribution is enabled' + ! write(nu_diag,1002) ' floediam = ', floediam, ' constant floe diameter' + else + tmpstr2 = ' floe size distribution is disabled' + endif + write(nu_diag,1012) ' tr_fsd = ', tr_fsd,trim(tmpstr2) + write(nu_diag,1022) ' nfsd = ', nfsd, ' number of floe size categories' + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Horizontal Dynamics' + write(nu_diag,*) '--------------------------------' + if (kdyn == 1) then + tmpstr2 = ' elastic-viscous-plastic dynamics' + write(nu_diag,*) 'yield_curve = ', trim(yield_curve) + if (trim(yield_curve) == 'ellipse') & + write(nu_diag,1007) ' e_ratio = ', e_ratio, ' aspect ratio of ellipse' + elseif (kdyn == 2) then + tmpstr2 = ' elastic-anisotropic-plastic dynamics' + elseif (kdyn < 1) then + tmpstr2 = ' dynamics disabled' + endif + write(nu_diag,1022) ' kdyn = ', kdyn,trim(tmpstr2) + if (kdyn >= 1) then + if (revised_evp) then + tmpstr2 = ' revised EVP formulation used' + else + tmpstr2 = ' revised EVP formulation not used' + endif + write(nu_diag,1012) ' revised_evp = ', revised_evp,trim(tmpstr2) + write(nu_diag,1022) ' kevp_kernel = ', kevp_kernel,' EVP solver' + + write(nu_diag,1022) ' ndtd = ', ndtd, ' number of dynamics/advection/ridging/steps per thermo timestep' + write(nu_diag,1022) ' ndte = ', ndte, ' number of EVP or EAP subcycles' + write(nu_diag,1007) ' arlx = ', arlx, ' stress equation factor alpha' + write(nu_diag,1007) ' brlx = ', brlx, ' stress equation factor beta' + + if (trim(coriolis) == 'latitude') then + tmpstr2 = ': latitude-dependent Coriolis parameter' + elseif (trim(coriolis) == 'contant') then + tmpstr2 = ' = 1.46e-4/s' + elseif (trim(coriolis) == 'zero') then + tmpstr2 = ' = 0.0' + endif + write(nu_diag,*) 'coriolis = ',trim(coriolis),trim(tmpstr2) + + if (ktransport == 1) then + tmpstr2 = ' transport enabled' + if (trim(advection) == 'remap') then + tmpstr2 = ': linear remapping advection' + elseif (trim(advection) == 'upwind') then + tmpstr2 = ': donor cell (upwind) advection' + endif + write(nu_diag,*) 'advection = ', trim(advection),trim(tmpstr2) + else + tmpstr2 = ' transport disabled' + endif + write(nu_diag,1022) ' ktransport = ', ktransport,trim(tmpstr2) + + if (basalstress) then + tmpstr2 = ' use basal stress parameterization for landfast ice' + else + tmpstr2 = ' basal stress not used for landfast ice' + endif + write(nu_diag,1012) ' basalstress = ', basalstress,trim(tmpstr2) + if (basalstress) then + write(nu_diag,1007) ' k1 = ', k1, ' free parameter for landfast ice' + write(nu_diag,1007) ' k2 = ', k2, ' free parameter for landfast ice' + write(nu_diag,1007) ' alphab = ', alphab, ' factor for landfast ice' + write(nu_diag,1007) ' threshold_hw = ', threshold_hw, ' max water depth for grounding ice' + write(nu_diag,1007) ' Ktens = ', Ktens, ' tensile strength factor' + endif + endif ! kdyn enabled + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Mechanical Deformation (Ridging) and Ice Strength' + write(nu_diag,*) '--------------------------------------------------' + if (kridge == 1) then + tmpstr2 = ' ridging enabled' + else + tmpstr2 = ' ridging disabled' + endif + write(nu_diag,1012) ' tr_lvl = ', tr_lvl,' ridging related tracers' + write(nu_diag,1022) ' kridge = ', kridge,trim(tmpstr2) + if (kridge == 1) then + if (krdg_partic == 1) then + tmpstr2 = ' new participation function' + else + tmpstr2 = ' old participation function' + endif + write(nu_diag,1022) ' krdg_partic = ', krdg_partic,trim(tmpstr2) + if (krdg_partic == 1) & + write(nu_diag,1007) ' mu_rdg = ', mu_rdg,' e-folding scale of ridged ice' + if (krdg_redist == 1) then + tmpstr2 = ' new redistribution function' + else + tmpstr2 = ' old redistribution function' + endif + write(nu_diag,1022) ' krdg_redist = ', krdg_redist,trim(tmpstr2) + endif + + if (kstrength == 0) then + tmpstr2 = ' Hibler (1979)' + elseif (kstrength == 1) then + tmpstr2 = ' Rothrock (1975)' + endif + write(nu_diag,1022) ' kstrength = ', kstrength,trim(tmpstr2) + if (kstrength == 0) then + write(nu_diag,1009) ' Pstar = ', Pstar, ' P* strength factor' + write(nu_diag,1007) ' Cstar = ', Cstar, ' C* strength exponent factor' + elseif (kstrength == 1) then + write(nu_diag,1007) ' Cf = ', Cf, ' ratio of ridging work to PE change' + endif + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Thermodynamics' + write(nu_diag,*) '--------------------------------' + + if (ktherm == 1) then + tmpstr2 = ' Bitz and Lipscomb 1999 thermo' + elseif (ktherm == 2) then + tmpstr2 = ' mushy-layer thermo' + elseif (ktherm == 0) then + tmpstr2 = ' zero-layer thermo' + elseif (ktherm < 0) then + tmpstr2 = ' thermodynamics disabled' + endif + if (ktherm >= 0) then + write(nu_diag,1022) ' ktherm = ', ktherm,trim(tmpstr2) + write(nu_diag,1002) ' dt = ', dt, ' thermodynamic time step' + write(nu_diag,1007) ' ksno = ', ksno,' snow thermal conductivity' + if (ktherm == 1) & + write(nu_diag,*) 'conduct = ', trim(conduct),' ice thermal conductivity' + if (ktherm == 2) then + write(nu_diag,1002) ' a_rapid_mode = ', a_rapid_mode,' brine channel diameter' + write(nu_diag,1007) ' Rac_rapid_mode = ', Rac_rapid_mode,' critical Rayleigh number' + write(nu_diag,1007) ' aspect_rapid_mode= ', aspect_rapid_mode,' brine convection aspect ratio' + write(nu_diag,*) 'dSdt_slow_mode = ', dSdt_slow_mode,' drainage strength parameter' + write(nu_diag,1007) ' phi_c_slow_mode = ', phi_c_slow_mode,' critical liquid fraction' + write(nu_diag,1007) ' phi_i_mushy = ', phi_i_mushy,' solid fraction at lower boundary' + endif + endif + !write(nu_diag,1007) ' hfrazilmin = ', hfrazilmin,' minimum new frazil ice thickness' + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Radiation' + write(nu_diag,*) '--------------------------------' + if (trim(shortwave) == 'dEdd') then + tmpstr2 = ': delta-Eddington multiple-scattering method' + elseif (trim(shortwave) == 'ccsm3') then + tmpstr2 = ': NCAR CCSM3 distribution method' + endif + write(nu_diag,*) ' shortwave = ', trim(shortwave),trim(tmpstr2) + if (trim(shortwave) == 'dEdd') then + write(nu_diag,1007) ' R_ice = ', R_ice,' tuning parameter for sea ice albedo' + write(nu_diag,1007) ' R_pnd = ', R_pnd,' tuning parameter for ponded sea ice albedo' + write(nu_diag,1007) ' R_snw = ', R_snw,' tuning parameter for snow broadband albedo' + write(nu_diag,1007) ' dT_mlt = ', dT_mlt,' change in temperature per change in snow grain radius' + write(nu_diag,1002) ' rsnw_mlt = ', rsnw_mlt,' maximum melting snow grain radius' + write(nu_diag,1007) ' kalg = ', kalg,' absorption coefficient for algae' + else + if (trim(albedo_type) == 'ccsm3') then + tmpstr2 = ': NCAR CCSM3 albedos' + elseif (trim(albedo_type) == 'constant') then + tmpstr2 = ': four constant albedos' + endif + write(nu_diag,*) 'albedo_type = ', trim(albedo_type),trim(tmpstr2) + if (trim(albedo_type) == 'ccsm3') then + write(nu_diag,1007) ' albicev = ', albicev,' visible ice albedo for thicker ice' + write(nu_diag,1007) ' albicei = ', albicei,' near infrared ice albedo for thicker ice' + write(nu_diag,1007) ' albsnowv = ', albsnowv,' visible, cold snow albedo' + write(nu_diag,1007) ' albsnowi = ', albsnowi,' near infrared, cold snow albedo' + write(nu_diag,1007) ' ahmax = ', ahmax,' albedo is constant above this thickness' + endif + endif + write(nu_diag,1007) ' emissivity = ', emissivity,' emissivity of snow and ice' + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Atmospheric Forcing / Coupling' + write(nu_diag,*) '--------------------------------' + write(nu_diag,1012) ' calc_Tsfc = ', calc_Tsfc,' calculate surface temperature as part of thermo' + write(nu_diag,1012) ' calc_strair = ', calc_strair,' calculate wind stress and speed' + write(nu_diag,1012) ' rotate_wind = ', rotate_wind,' rotate wind/stress to computational grid' + write(nu_diag,1012) ' formdrag = ', formdrag,' use form drag parameterization' + if (trim(atmbndy) == 'constant') then + tmpstr2 = ': stability-based boundary layer' + write(nu_diag,1012) ' highfreq = ', highfreq,' high-frequency atmospheric coupling' + write(nu_diag,1022) ' natmiter = ', natmiter,' number of atmo boundary layer iterations' + write(nu_diag,1006) ' atmiter_conv = ', atmiter_conv,' convergence criterion for ustar' + elseif (trim(atmbndy) == 'default') then + tmpstr2 = ': boundary layer uses bulk transfer coefficients' + endif + write(nu_diag,*) 'atmbndy = ', trim(atmbndy),trim(tmpstr2) + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Oceanic Forcing / Coupling' + write(nu_diag,*) '--------------------------------' + if (oceanmixed_ice) then + tmpstr2 = ' ocean mixed layer calculation (SST) enabled' + else + tmpstr2 = ' ocean mixed layer calculation (SST) disabled' + endif + write(nu_diag,1012) ' oceanmixed_ice = ', oceanmixed_ice,trim(tmpstr2) + if (trim(tfrz_option) == 'minus1p8') then + tmpstr2 = ': constant ocean freezing temperature (-1.8C)' + elseif (trim(tfrz_option) == 'linear_salt') then + tmpstr2 = ': linear function of salinity (use with ktherm=1)' + elseif (trim(tfrz_option) == 'mushy') then + tmpstr2 = ': Assur (1958) as in mushy-layer thermo (ktherm=2)' + endif + write(nu_diag,*) 'tfrz_option = ', trim(tfrz_option),trim(tmpstr2) + if (update_ocn_f) then + tmpstr2 = ' frazil water/salt fluxes included in ocean fluxes' + else + tmpstr2 = ' frazil water/salt fluxes not included in ocean fluxes' + endif + write(nu_diag,1012) ' update_ocn_f = ', update_ocn_f,trim(tmpstr2) + if (l_mpond_fresh .and. tr_pond_topo) then + tmpstr2 = ' retain (topo) pond water until ponds drain' + else + tmpstr2 = ' pond water not retained on ice (virtual only)' + endif + write(nu_diag,1012) ' l_mpond_fresh = ', l_mpond_fresh,trim(tmpstr2) + if (trim(fbot_xfer_type) == 'constant') then + tmpstr2 = ': ocean heat transfer coefficient is constant' + elseif (trim(fbot_xfer_type) == 'Cdn_ocn') then + tmpstr2 = ': variable ocean heat transfer coefficient' ! only used with form_drag=T? + endif + write(nu_diag,*) 'fbot_xfer_type = ', trim(fbot_xfer_type),trim(tmpstr2) + write(nu_diag,1006) ' ustar_min = ', ustar_min,' minimum value of ocean friction velocity' + + if (tr_fsd) then + if (wave_spec) then + tmpstr2 = ' use wave spectrum for floe size distribution' + else + tmpstr2 = ' floe size distribution does not use wave spectrum' + endif + write(nu_diag,1012) ' wave_spec = ', wave_spec,trim(tmpstr2) + if (wave_spec) then + if (trim(wave_spec_type) == 'none') then + tmpstr2 = ': no wave data provided, no wave-ice interactions' + elseif (trim(wave_spec_type) == 'profile') then + tmpstr2 = ': use fixed dummy wave spectrum for testing' + elseif (trim(wave_spec_type) == 'constant') then + tmpstr2 = ': constant wave spectrum data file provided for testing' + elseif (trim(wave_spec_type) == 'random') then + tmpstr2 = ': wave data file provided, spectrum generated using random number' + endif + write(nu_diag,*) 'wave_spec_type = ', trim(wave_spec_type),trim(tmpstr2) + endif + write(nu_diag,1022) ' nfreq = ', nfreq,' number of wave spectral forcing frequencies' + endif + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Age related tracers' + write(nu_diag,*) '--------------------------------' + write(nu_diag,1012) ' tr_iage = ', tr_iage,' chronological ice age' + write(nu_diag,1012) ' tr_FY = ', tr_FY,' first-year ice area' + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Melt ponds' + write(nu_diag,*) '--------------------------------' + if (tr_pond_cesm) then + write(nu_diag,1012) ' tr_pond_cesm = ', tr_pond_cesm,' CESM pond formulation' + write(nu_diag,1007) ' pndaspect = ', pndaspect + elseif (tr_pond_lvl) then + write(nu_diag,1012) ' tr_pond_lvl = ', tr_pond_lvl,' level-ice pond formulation' + write(nu_diag,1007) ' pndaspect = ', pndaspect + write(nu_diag,1006) ' dpscale = ', dpscale,' time scale for flushing in permeable ice' + if (trim(frzpnd) == 'hlid') then + tmpstr2 = ': Stefan refreezing with pond ice thickness' + elseif (trim(frzpnd) == 'cesm') then + tmpstr2 = ': CESM refreezing empirical formula' + endif + write(nu_diag,*) ' frzpnd = ', trim(frzpnd),trim(tmpstr2) + write(nu_diag,1007) ' hs1 = ', hs1,' snow depth of transition to pond ice' + elseif (tr_pond_topo) then + write(nu_diag,1012) ' tr_pond_topo = ', tr_pond_topo,' topo pond formulation' + write(nu_diag,1007) ' hp1 = ', hp1,' critical ice lid thickness for topo ponds' + elseif (trim(shortwave) == 'ccsm3') then + write(nu_diag,*) 'Pond effects on radiation are treated implicitly in the ccsm3 shortwave scheme' + else + write(nu_diag,*) ' Using default dEdd melt pond scheme for testing only' + endif + + if (trim(shortwave) == 'dEdd') then + write(nu_diag,1007) ' hs0 = ', hs0,' snow depth of transition to bare sea ice' + endif + + write(nu_diag,1007) ' rfracmin = ', rfracmin,' minimum fraction of melt water added to ponds' + write(nu_diag,1007) ' rfracmax = ', rfracmax,' maximum fraction of melt water added to ponds' + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Primary state variables, tracers' + write(nu_diag,*) ' (excluding biogeochemistry)' + write(nu_diag,*) '---------------------------------' + write(nu_diag,*) 'Conserved properties (all tracers are conserved):' + write(nu_diag,*) 'ice concentration, volume and enthalpy' + write(nu_diag,*) 'snow volume and enthalpy' + if (ktherm == 2) write(nu_diag,*) 'ice salinity' + if (tr_fsd) write(nu_diag,1012) ' tr_fsd = ', tr_fsd,' floe size distribution' + if (tr_lvl) write(nu_diag,1012) ' tr_lvl = ', tr_lvl,' ridging related tracers' + if (tr_pond_lvl) write(nu_diag,1012) ' tr_pond_lvl = ', tr_pond_lvl,' level-ice pond formulation' + if (tr_pond_topo) write(nu_diag,1012) ' tr_pond_topo = ', tr_pond_topo,' topo pond formulation' + if (tr_pond_cesm) write(nu_diag,1012) ' tr_pond_cesm = ', tr_pond_cesm,' CESM pond formulation' + if (tr_iage) write(nu_diag,1012) ' tr_iage = ', tr_iage,' chronological ice age' + if (tr_FY) write(nu_diag,1012) ' tr_FY = ', tr_FY,' first-year ice area' + if (tr_iso) write(nu_diag,1012) ' tr_iso = ', tr_iso,' diagnostic isotope tracers' + if (tr_aero) write(nu_diag,1012) ' tr_aero = ', tr_aero,' CESM aerosol tracers' + write(nu_diag,*) 'Non-conserved properties:' + write(nu_diag,*) 'ice surface temperature' + write(nu_diag,*) 'ice velocity components and internal stress' + + write(nu_diag,*) ' ' + write(nu_diag,*) ' Other ice_in namelist parameters:' write(nu_diag,*) ' ==================================== ' write(nu_diag,*) ' ' if (trim(runid) /= 'unknown') & @@ -997,11 +1426,8 @@ subroutine input_data trim(runid) write(nu_diag,1030) ' runtype = ', & trim(runtype) - write(nu_diag,1020) ' days_per_year = ', days_per_year - write(nu_diag,1010) ' use_leap_years = ', use_leap_years write(nu_diag,1020) ' year_init = ', year_init write(nu_diag,1020) ' istep0 = ', istep0 - write(nu_diag,1000) ' dt = ', dt write(nu_diag,1020) ' npt = ', npt write(nu_diag,1020) ' diagfreq = ', diagfreq write(nu_diag,1010) ' print_global = ', print_global @@ -1012,7 +1438,7 @@ subroutine input_data write(nu_diag,1050) ' histfreq = ', histfreq(:) write(nu_diag,1040) ' histfreq_n = ', histfreq_n(:) write(nu_diag,1010) ' hist_avg = ', hist_avg - if (.not. hist_avg) write(nu_diag,*) 'History data will be snapshots' + if (.not. hist_avg) write(nu_diag,*) ' History data will be snapshots' write(nu_diag,*) ' history_dir = ', & trim(history_dir) write(nu_diag,*) ' history_file = ', & @@ -1021,7 +1447,7 @@ subroutine input_data write(nu_diag,*) ' history_format = ', & trim(history_format) if (write_ic) then - write(nu_diag,*) 'Initial condition will be written in ', & + write(nu_diag,*) ' Initial condition will be written in ', & trim(incond_dir) endif write(nu_diag,1030) ' dumpfreq = ', & @@ -1043,8 +1469,6 @@ subroutine input_data write(nu_diag,*) ' use_restart_time = ', use_restart_time write(nu_diag,*) ' ice_ic = ', & trim(ice_ic) - write(nu_diag,*) ' grid_type = ', & - trim(grid_type) if (trim(grid_type) /= 'rectangular' .or. & trim(grid_type) /= 'column') then write(nu_diag,*) ' grid_file = ', & @@ -1053,113 +1477,13 @@ subroutine input_data trim(gridcpl_file) write(nu_diag,*) ' bathymetry_file = ', & trim(bathymetry_file) - write(nu_diag,*) ' use_bathymetry = ', & - use_bathymetry write(nu_diag,*) ' kmt_file = ', & trim(kmt_file) endif - write(nu_diag,1020) ' kitd = ', kitd - write(nu_diag,1020) ' kcatbound = ', & - kcatbound write(nu_diag,1010) ' close_boundaries = ', & close_boundaries - if (kdyn == 1) then - write(nu_diag,1021) ' kdyn = ','evp ', kdyn - elseif (kdyn == 2) then - write(nu_diag,1021) ' kdyn = ','eap ', kdyn - else - write(nu_diag,1020) ' kdyn = ', kdyn - endif - write(nu_diag,1020) ' ndtd = ', ndtd - write(nu_diag,1020) ' ndte = ', ndte - write(nu_diag,1010) ' revised_evp = ', revised_evp - write(nu_diag,1020) ' kevp_kernel = ', kevp_kernel - write(nu_diag,1005) ' brlx = ', brlx - write(nu_diag,1005) ' arlx = ', arlx - if (kdyn == 1) & - write(nu_diag,*) ' yield_curve = ', & - trim(yield_curve) - write(nu_diag,1020) ' kstrength = ', kstrength - write(nu_diag,1030) ' coriolis = ', coriolis - write(nu_diag,1020) ' kridge = ', kridge - write(nu_diag,1020) ' ktransport = ', ktransport - write(nu_diag,1020) ' krdg_partic = ', & - krdg_partic - write(nu_diag,1020) ' krdg_redist = ', & - krdg_redist - if (krdg_redist == 1) & - write(nu_diag,1000) ' mu_rdg = ', mu_rdg - if (kstrength == 1) & - write(nu_diag,1000) ' Cf = ', Cf - - write(nu_diag,1010) ' basalstress = ', basalstress - write(nu_diag,1005) ' k1 = ', k1 - write(nu_diag,1005) ' k2 = ', k2 - write(nu_diag,1005) ' alphab = ', alphab - write(nu_diag,1005) ' threshold_hw = ', threshold_hw - write(nu_diag,1005) ' Ktens = ', Ktens - write(nu_diag,1005) ' e_ratio = ', e_ratio - write(nu_diag,1030) ' advection = ', & - trim(advection) - write(nu_diag,1030) ' shortwave = ', & - trim(shortwave) - write(nu_diag,1000) ' ksno = ', ksno - write(nu_diag,1010) ' conserv_check = ', conserv_check - if (cpl_bgc) then - write(nu_diag,1000) ' BGC coupling is switched ON' - else - write(nu_diag,1000) ' BGC coupling is switched OFF' - endif - if (trim(shortwave) == 'dEdd') then - write(nu_diag,1000) ' R_ice = ', R_ice - write(nu_diag,1000) ' R_pnd = ', R_pnd - write(nu_diag,1000) ' R_snw = ', R_snw - write(nu_diag,1000) ' dT_mlt = ', dT_mlt - write(nu_diag,1000) ' rsnw_mlt = ', rsnw_mlt - write(nu_diag,1000) ' kalg = ', kalg - write(nu_diag,1000) ' hp1 = ', hp1 - write(nu_diag,1000) ' hs0 = ', hs0 - else - write(nu_diag,1030) ' albedo_type = ', & - trim(albedo_type) - write(nu_diag,1000) ' albicev = ', albicev - write(nu_diag,1000) ' albicei = ', albicei - write(nu_diag,1000) ' albsnowv = ', albsnowv - write(nu_diag,1000) ' albsnowi = ', albsnowi - write(nu_diag,1000) ' ahmax = ', ahmax - endif - - write(nu_diag,1000) ' rfracmin = ', rfracmin - write(nu_diag,1000) ' rfracmax = ', rfracmax - if (tr_pond_lvl) then - write(nu_diag,1000) ' hs1 = ', hs1 - write(nu_diag,1000) ' dpscale = ', dpscale - write(nu_diag,1030) ' frzpnd = ', trim(frzpnd) - endif - if (tr_pond .and. .not. tr_pond_lvl) & - write(nu_diag,1000) ' pndaspect = ', pndaspect - - write(nu_diag,1020) ' ktherm = ', ktherm - if (ktherm == 1) & - write(nu_diag,1030) ' conduct = ', conduct - if (ktherm == 2) then - write(nu_diag,1005) ' a_rapid_mode = ', a_rapid_mode - write(nu_diag,1005) ' Rac_rapid_mode = ', Rac_rapid_mode - write(nu_diag,1005) ' aspect_rapid_mode = ', aspect_rapid_mode - write(nu_diag,1005) ' dSdt_slow_mode = ', dSdt_slow_mode - write(nu_diag,1005) ' phi_c_slow_mode = ', phi_c_slow_mode - write(nu_diag,1005) ' phi_i_mushy = ', phi_i_mushy - endif - - write(nu_diag,1030) ' atmbndy = ', & - trim(atmbndy) - write(nu_diag,1010) ' formdrag = ', formdrag - write(nu_diag,1010) ' highfreq = ', highfreq - write(nu_diag,1020) ' natmiter = ', natmiter - write(nu_diag,1005) ' atmiter_conv = ', atmiter_conv - write(nu_diag,1010) ' calc_strair = ', calc_strair - write(nu_diag,1010) ' calc_Tsfc = ', calc_Tsfc + write(nu_diag,1010) ' conserv_check = ', conserv_check write(nu_diag,1020) ' fyear_init = ', & fyear_init @@ -1175,27 +1499,19 @@ subroutine input_data write(nu_diag,*) ' default_season = ', trim(default_season) endif - write(nu_diag,1010) ' update_ocn_f = ', update_ocn_f - write(nu_diag,1010) ' l_mpond_fresh = ', l_mpond_fresh - write(nu_diag,1005) ' ustar_min = ', ustar_min - write(nu_diag,1005) ' emissivity = ', emissivity - write(nu_diag, *) ' fbot_xfer_type = ', & - trim(fbot_xfer_type) - write(nu_diag,1010) ' oceanmixed_ice = ', & - oceanmixed_ice - write(nu_diag,1010) ' wave_spec = ', wave_spec if (wave_spec) then - write(nu_diag,*) ' wave_spec_type = ', trim(wave_spec_type) write(nu_diag,*) ' wave_spec_file = ', trim(wave_spec_file) endif - write(nu_diag,1020) ' nfreq = ', nfreq - write(nu_diag,*) ' tfrz_option = ', & - trim(tfrz_option) if (trim(bgc_data_type) == 'ncar' .or. & trim(ocn_data_type) == 'ncar') then write(nu_diag,*) ' oceanmixed_file = ', & trim(oceanmixed_file) endif + if (cpl_bgc) then + write(nu_diag,1000) ' BGC coupling is switched ON' + else + write(nu_diag,1000) ' BGC coupling is switched OFF' + endif write(nu_diag,*) ' bgc_data_type = ', & trim(bgc_data_type) write(nu_diag,*) ' fe_data_type = ', & @@ -1235,31 +1551,17 @@ subroutine input_data write(nu_diag,'(a30,2f8.2)') 'Diagnostic point 2: lat, lon =', & latpnt(2), lonpnt(2) - ! tracers - write(nu_diag,1010) ' tr_iage = ', tr_iage + ! tracer restarts write(nu_diag,1010) ' restart_age = ', restart_age - write(nu_diag,1010) ' tr_FY = ', tr_FY write(nu_diag,1010) ' restart_FY = ', restart_FY - write(nu_diag,1010) ' tr_lvl = ', tr_lvl write(nu_diag,1010) ' restart_lvl = ', restart_lvl - write(nu_diag,1010) ' tr_pond_cesm = ', tr_pond_cesm write(nu_diag,1010) ' restart_pond_cesm = ', restart_pond_cesm - write(nu_diag,1010) ' tr_pond_lvl = ', tr_pond_lvl write(nu_diag,1010) ' restart_pond_lvl = ', restart_pond_lvl - write(nu_diag,1010) ' tr_pond_topo = ', tr_pond_topo write(nu_diag,1010) ' restart_pond_topo = ', restart_pond_topo - write(nu_diag,1010) ' tr_iso = ', tr_iso write(nu_diag,1010) ' restart_iso = ', restart_iso - write(nu_diag,1010) ' tr_aero = ', tr_aero write(nu_diag,1010) ' restart_aero = ', restart_aero - write(nu_diag,1010) ' tr_fsd = ', tr_fsd write(nu_diag,1010) ' restart_fsd = ', restart_fsd - write(nu_diag,1020) ' ncat = ', ncat - write(nu_diag,1020) ' nfsd = ', nfsd - write(nu_diag,1020) ' nilyr = ', nilyr - write(nu_diag,1020) ' nslyr = ', nslyr - write(nu_diag,1020) ' nblyr = ', nblyr write(nu_diag,1020) ' n_iso = ', n_iso write(nu_diag,1020) ' n_aero = ', n_aero write(nu_diag,1020) ' n_zaero = ', n_zaero @@ -1280,7 +1582,7 @@ subroutine input_data grid_type /= 'regional' .and. & grid_type /= 'latlon' ) then if (my_task == master_task) write(nu_diag,*) subname//' ERROR: unknown grid_type=',trim(grid_type) - abort_flag = 20 + abort_list = trim(abort_list)//":20" endif ! check for valid kevp_kernel @@ -1294,16 +1596,16 @@ subroutine input_data if (kevp_kernel == 2) then if (my_task == master_task) write(nu_diag,*) subname//' kevp_kernel=2 not validated, use kevp_kernel=102 for testing until it is validated' endif - abort_flag = 21 + abort_list = trim(abort_list)//":21" endif endif - if (abort_flag /= 0) then + if (abort_list /= "") then call flush_fileunit(nu_diag) endif call ice_barrier() - if (abort_flag /= 0) then - write(nu_diag,*) subname,' ERROR: abort_flag=',abort_flag + if (abort_list /= "") then + write(nu_diag,*) subname,' ERROR: abort_list = ',trim(abort_list) call abort_ice (subname//' ABORTING on input ERRORS', & file=__FILE__, line=__LINE__) endif @@ -1323,7 +1625,8 @@ subroutine input_data phi_c_slow_mode_in=phi_c_slow_mode, phi_i_mushy_in=phi_i_mushy, conserv_check_in=conserv_check, & wave_spec_type_in = wave_spec_type, & wave_spec_in=wave_spec, nfreq_in=nfreq, & - tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type) + tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type, & + Pstar_in=Pstar, Cstar_in=Cstar) call icepack_init_tracer_flags(tr_iage_in=tr_iage, tr_FY_in=tr_FY, & tr_lvl_in=tr_lvl, tr_iso_in=tr_iso, tr_aero_in=tr_aero, & tr_fsd_in=tr_fsd, tr_pond_in=tr_pond, & @@ -1337,10 +1640,15 @@ subroutine input_data file=__FILE__, line=__LINE__) 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements + 1002 format (a20,1x,f7.2,a) 1005 format (a30,2x,f12.6) ! float + 1006 format (a20,2x,f10.6,a) + 1007 format (a20,2x,f6.2,a) + 1009 format (a20,2x,d13.6,a) ! float, exponential notation 1010 format (a30,2x,l6) ! logical + 1012 format (a20,2x,l3,1x,a) ! logical 1020 format (a30,2x,i6) ! integer - 1021 format (a30,2x,a8,i6) ! char, int + 1022 format (a20,2x,i3,1x,a) ! integer 1030 format (a30, a8) ! character 1040 format (a30,2x,6i6) ! integer 1050 format (a30,2x,6a6) ! character diff --git a/cicecore/cicedynB/general/ice_step_mod.F90 b/cicecore/cicedynB/general/ice_step_mod.F90 index 7f9f316a3..2f1a1c75b 100644 --- a/cicecore/cicedynB/general/ice_step_mod.F90 +++ b/cicecore/cicedynB/general/ice_step_mod.F90 @@ -182,7 +182,6 @@ subroutine step_therm1 (dt, iblk) logical (kind=log_kind) :: & prescribed_ice ! if .true., use prescribed ice instead of computed #endif - real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -190,7 +189,10 @@ subroutine step_therm1 (dt, iblk) iblk ! block index ! local variables - +#ifdef CICE_IN_NEMO + real (kind=dbl_kind) :: & + raice ! temporary reverse ice concentration +#endif integer (kind=int_kind) :: & ilo,ihi,jlo,jhi, & ! beginning and end of physical domain i, j , & ! horizontal indices diff --git a/cicecore/cicedynB/infrastructure/ice_grid.F90 b/cicecore/cicedynB/infrastructure/ice_grid.F90 index 8df66042b..f4b5fef6e 100644 --- a/cicecore/cicedynB/infrastructure/ice_grid.F90 +++ b/cicecore/cicedynB/infrastructure/ice_grid.F90 @@ -133,6 +133,10 @@ module ice_grid real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & rndex_global ! global index for local subdomain (dbl) + logical (kind=log_kind), private :: & + l_readCenter ! If anglet exist in grid file read it otherwise calculate it + + !======================================================================= contains @@ -332,7 +336,6 @@ subroutine init_grid2 real (kind=dbl_kind) :: & angle_0, angle_w, angle_s, angle_sw, & pi, pi2, puny -! real (kind=dbl_kind) :: ANGLET_dum logical (kind=log_kind), dimension(nx_block,ny_block,max_blocks):: & out_of_range @@ -470,11 +473,10 @@ subroutine init_grid2 !----------------------------------------------------------------- ! Compute ANGLE on T-grid !----------------------------------------------------------------- - ANGLET = c0 - if (trim(grid_type) == 'cpom_grid') then ANGLET(:,:,:) = ANGLE(:,:,:) - else + else if (.not. (l_readCenter)) then + ANGLET = c0 !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block, & !$OMP angle_0,angle_w,angle_s,angle_sw) @@ -504,7 +506,8 @@ subroutine init_grid2 enddo !$OMP END PARALLEL DO endif ! cpom_grid - if (trim(grid_type) == 'regional') then + if (trim(grid_type) == 'regional' .and. & + (.not. (l_readCenter))) then ! for W boundary extrapolate from interior !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) do iblk = 1, nblocks @@ -531,9 +534,9 @@ subroutine init_grid2 call ice_timer_stop(timer_bound) call makemask ! velocity mask, hemisphere masks - - call Tlatlon ! get lat, lon on the T grid - + if (.not. (l_readCenter)) then + call Tlatlon ! get lat, lon on the T grid + endif !----------------------------------------------------------------- ! bathymetry !----------------------------------------------------------------- @@ -716,6 +719,7 @@ subroutine popgrid_nc field_loc_center, field_loc_NEcorner, & field_type_scalar, field_type_angle use ice_domain_size, only: max_blocks + use netcdf integer (kind=int_kind) :: & i, j, iblk, & @@ -739,6 +743,12 @@ subroutine popgrid_nc type (block) :: & this_block ! block information for current block + + integer(kind=int_kind) :: & + varid + integer (kind=int_kind) :: & + status ! status flag + character(len=*), parameter :: subname = '(popgrid_nc)' @@ -751,7 +761,7 @@ subroutine popgrid_nc call ice_open_nc(kmt_file,fid_kmt) diag = .true. ! write diagnostic info - + l_readCenter = .false. !----------------------------------------------------------------- ! topography !----------------------------------------------------------------- @@ -806,11 +816,37 @@ subroutine popgrid_nc call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) ! ANGLE call scatter_global(ANGLE, work_g1, master_task, distrb_info, & field_loc_NEcorner, field_type_angle) - ! fix ANGLE: roundoff error due to single precision where (ANGLE > pi) ANGLE = pi where (ANGLE < -pi) ANGLE = -pi + ! if grid file includes anglet then read instead + fieldname='anglet' + if (my_task == master_task) then + status = nf90_inq_varid(fid_grid, trim(fieldname) , varid) + if (status /= nf90_noerr) then + write(nu_diag,*) subname//' CICE will calculate angleT, TLON and TLAT' + else + write(nu_diag,*) subname//' angleT, TLON and TLAT is read from grid file' + l_readCenter = .true. + endif + endif + call broadcast_scalar(l_readCenter,master_task) + if (l_readCenter) then + call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) + call scatter_global(ANGLET, work_g1, master_task, distrb_info, & + field_loc_center, field_type_angle) + where (ANGLET > pi) ANGLET = pi + where (ANGLET < -pi) ANGLET = -pi + fieldname="tlon" + call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) + call scatter_global(TLON, work_g1, master_task, distrb_info, & + field_loc_center, field_type_scalar) + fieldname="tlat" + call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) + call scatter_global(TLAT, work_g1, master_task, distrb_info, & + field_loc_center, field_type_scalar) + endif !----------------------------------------------------------------- ! cell dimensions ! calculate derived quantities from global arrays to preserve @@ -820,7 +856,6 @@ subroutine popgrid_nc fieldname='htn' call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) ! HTN call primary_grid_lengths_HTN(work_g1) ! dxu, dxt - fieldname='hte' call ice_read_global_nc(fid_grid,1,fieldname,work_g1,diag) ! HTE call primary_grid_lengths_HTE(work_g1) ! dyu, dyt @@ -831,7 +866,6 @@ subroutine popgrid_nc call ice_close_nc(fid_grid) call ice_close_nc(fid_kmt) endif - #endif end subroutine popgrid_nc @@ -1737,7 +1771,6 @@ subroutine Tlatlon enddo ! j enddo ! iblk !$OMP END PARALLEL DO - if (trim(grid_type) == 'regional') then ! for W boundary extrapolate from interior !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) @@ -2463,7 +2496,6 @@ subroutine read_basalstress_bathy ! use module use ice_read_write - use ice_communicate, only: my_task, master_task use ice_constants, only: field_loc_center, field_type_scalar ! local variables @@ -2491,7 +2523,6 @@ subroutine read_basalstress_bathy if (my_task == master_task) then write(nu_diag,*) 'reading ',TRIM(fieldname) - write(*,*) 'reading ',TRIM(fieldname) call icepack_warnings_flush(nu_diag) endif call ice_read_nc(fid_init,1,fieldname,bathymetry,diag, & diff --git a/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 b/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 index b72745e30..3dcd8fb2f 100644 --- a/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 +++ b/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 @@ -57,7 +57,7 @@ end subroutine CICE_Initialize ! ! Initialize CICE model. - subroutine cice_init(mpicom_ice) + subroutine cice_init use ice_arrays_column, only: hin_max, c_hi_range, alloc_arrays_column use ice_arrays_column, only: floe_rad_l, floe_rad_c, & @@ -66,7 +66,7 @@ subroutine cice_init(mpicom_ice) use ice_flux_bgc, only: alloc_flux_bgc use ice_calendar, only: dt, dt_dyn, time, istep, istep1, write_ic, & init_calendar, calendar - use ice_communicate, only: init_communicate, my_task, master_task + use ice_communicate, only: my_task, master_task use ice_diagnostics, only: init_diags use ice_domain, only: init_domain_blocks use ice_domain_size, only: ncat, nfsd @@ -91,14 +91,10 @@ subroutine cice_init(mpicom_ice) use drv_forcing, only: sst_sss #endif - integer (kind=int_kind), optional, intent(in) :: & - mpicom_ice ! communicator for sequential ccsm - logical(kind=log_kind) :: tr_aero, tr_zaero, skl_bgc, z_tracers, & tr_iso, tr_fsd, wave_spec character(len=*), parameter :: subname = '(cice_init)' - call init_communicate(mpicom_ice) ! initial setup for message passing call init_fileunits ! unit numbers call icepack_configure() ! initialize icepack @@ -204,9 +200,9 @@ subroutine cice_init(mpicom_ice) ! coupler communication or forcing data initialization !-------------------------------------------------------------------- +#ifndef coupled call init_forcing_atmo ! initialize atmospheric forcing (standalone) -#ifndef coupled #ifndef CESMCOUPLED if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice call get_forcing_atmo ! atmospheric forcing from data diff --git a/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 b/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 index 09cffa0c7..aed00a9a0 100644 --- a/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 +++ b/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 @@ -15,7 +15,9 @@ module CICE_RunMod use ice_kinds_mod +#ifdef CESMCOUPLED use perf_mod, only : t_startf, t_stopf, t_barrierf +#endif use ice_fileunits, only: nu_diag use ice_arrays_column, only: oceanmixed_ice use ice_constants, only: c0, c1 @@ -207,12 +209,14 @@ subroutine ice_step call init_history_bgc call ice_timer_stop(timer_diags) ! diagnostics/history +#ifdef CESMCOUPLED if (prescribed_ice) then ! read prescribed ice call t_barrierf('cice_run_presc_BARRIER',MPI_COMM_ICE) call t_startf ('cice_run_presc') call ice_prescribed_run(idate, sec) call t_stopf ('cice_run_presc') endif +#endif call save_init @@ -374,7 +378,7 @@ subroutine coupling_prep (iblk) fsens, flat, fswabs, flwout, evap, Tref, Qref, & scale_fluxes, frzmlt_init, frzmlt, Uref, wind use ice_flux_bgc, only: faero_ocn, fiso_ocn, Qref_iso, fiso_evap, & - fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai + fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai, & fnit, fsil, famm, fdmsp, fdms, fhum, fdust, falgalN, & fdoc, fdic, fdon, ffep, ffed, bgcflux_ice_to_ocn use ice_grid, only: tmask diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index 29cd34320..81fb1a308 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -15,13 +15,12 @@ module ice_comp_nuopc use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize use NUOPC_Model , only : NUOPC_ModelGet, SetVM - use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs - use shr_sys_mod , only : shr_sys_abort, shr_sys_flush +#ifdef CESMCOUPLED use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit - use shr_string_mod , only : shr_string_listGetNum - use shr_orb_mod , only : shr_orb_decl + use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT use shr_const_mod - use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date + use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian +#endif use ice_constants , only : ice_init_constants use ice_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit use ice_shr_methods , only : set_component_logging, get_component_instance @@ -38,15 +37,17 @@ module ice_comp_nuopc use ice_calendar , only : force_restart_now, write_ic use ice_calendar , only : idate, mday, time, month, daycal, time2sec, year_init use ice_calendar , only : sec, dt, calendar, calendar_type, nextsw_cday, istep - use ice_kinds_mod , only : dbl_kind, int_kind, char_len + use ice_kinds_mod , only : dbl_kind, int_kind, char_len, char_len_long use ice_scam , only : scmlat, scmlon, single_column - use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name, inst_suffix, release_all_fileunits + use ice_fileunits , only : nu_diag, nu_diag_set, inst_index, inst_name, inst_suffix, release_all_fileunits, flush_fileunit use ice_restart_shared , only : runid, runtype, restart_dir, restart_file use ice_history , only : accum_hist #if (defined NEWCODE) use ice_history_shared , only : model_doi_url ! TODO: add this functionality #endif +#ifdef CESMCOUPLED use ice_prescribed_mod , only : ice_prescribed_init +#endif #if (defined NEWCODE) use ice_atmo , only : flux_convergence_tolerance, flux_convergence_max_iteration use ice_atmo , only : use_coldair_outbreak_mod @@ -55,12 +56,16 @@ module ice_comp_nuopc use CICE_RunMod , only : CICE_Run use ice_exit , only : abort_ice use icepack_intfc , only : icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc , only : icepack_init_orbit, icepack_init_parameters + use icepack_intfc , only : icepack_init_orbit, icepack_init_parameters, icepack_query_orbit use icepack_intfc , only : icepack_query_tracer_flags, icepack_query_parameters +#ifdef CESMCOUPLED use perf_mod , only : t_startf, t_stopf, t_barrierf +#endif use ice_timers + use ice_communicate, only: init_communicate implicit none + private public :: SetServices public :: SetVM @@ -71,13 +76,27 @@ module ice_comp_nuopc private :: ModelAdvance private :: ModelSetRunClock private :: ModelFinalize +#ifdef CESMCOUPLED + private :: ice_orbital_init ! only for cesm +#endif - character(len=CL) :: flds_scalar_name = '' + character(len=char_len_long) :: flds_scalar_name = '' integer :: flds_scalar_num = 0 integer :: flds_scalar_index_nx = 0 integer :: flds_scalar_index_ny = 0 integer :: flds_scalar_index_nextsw_cday = 0 + character(len=char_len_long) :: orb_mode ! attribute - orbital mode + integer :: orb_iyear ! attribute - orbital year + integer :: orb_iyear_align ! attribute - associated with model year + real(dbl_kind) :: orb_obliq ! attribute - obliquity in degrees + real(dbl_kind) :: orb_mvelp ! attribute - moving vernal equinox longitude + real(dbl_kind) :: orb_eccen ! attribute and update- orbital eccentricity + + character(len=*) , parameter :: orb_fixed_year = 'fixed_year' + character(len=*) , parameter :: orb_variable_year = 'variable_year' + character(len=*) , parameter :: orb_fixed_parameters = 'fixed_parameters' + integer , parameter :: dbug = 10 integer , parameter :: debug_import = 0 ! internal debug level integer , parameter :: debug_export = 0 ! internal debug level @@ -170,8 +189,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! Local variables - character(len=CL) :: cvalue - character(len=CL) :: logmsg + character(len=char_len_long) :: cvalue + character(len=char_len_long) :: logmsg logical :: isPresent, isSet character(len=*), parameter :: subname=trim(modName)//':(InitializeAdvertise) ' !-------------------------------- @@ -183,7 +202,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_LogWrite(trim(subname)//' flds_scalar_name = '//trim(flds_scalar_name), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldName') + call abort_ice(subname//'Need to set attribute ScalarFieldName') endif call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldCount", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) @@ -194,7 +213,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_LogWrite(trim(subname)//' flds_scalar_num = '//trim(logmsg), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldCount') + call abort_ice(subname//'Need to set attribute ScalarFieldCount') endif call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNX", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) @@ -205,7 +224,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_nx = '//trim(logmsg), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldIdxGridNX') + call abort_ice(subname//'Need to set attribute ScalarFieldIdxGridNX') endif call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNY", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) @@ -216,7 +235,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_ny = '//trim(logmsg), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldIdxGridNY') + call abort_ice(subname//'Need to set attribute ScalarFieldIdxGridNY') endif call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxNextSwCday", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) @@ -227,7 +246,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_nextsw_cday = '//trim(logmsg), ESMF_LOGMSG_INFO) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldIdxNextSwCday') + call abort_ice(subname//'Need to set attribute ScalarFieldIdxNextSwCday') endif call ice_advertise_fields(gcomp, importState, exportState, flds_scalar_name, rc) @@ -251,15 +270,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) type(ESMF_Mesh) :: Emesh, EmeshTemp integer :: spatialDim integer :: numOwnedElements - real(R8), pointer :: ownedElemCoords(:) - real(r8), pointer :: lat(:), latMesh(:) - real(r8), pointer :: lon(:), lonMesh(:) + real(dbl_kind), pointer :: ownedElemCoords(:) + real(dbl_kind), pointer :: lat(:), latMesh(:) + real(dbl_kind), pointer :: lon(:), lonMesh(:) integer , allocatable :: gindex_ice(:) integer , allocatable :: gindex_elim(:) integer , allocatable :: gindex(:) integer :: globalID character(ESMF_MAXSTR) :: cvalue - real(r8) :: eccen, obliqr, lambm0, mvelpp + real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp character(len=char_len) :: tfrz_option character(ESMF_MAXSTR) :: convCIM, purpComp type(ESMF_VM) :: vm @@ -283,7 +302,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: dtime ! time step integer :: lmpicom integer :: shrlogunit ! original log unit - character(len=cs) :: starttype ! infodata start type + character(len=char_len) :: starttype ! infodata start type integer :: lsize ! local size of coupling array character(len=512) :: diro character(len=512) :: logfile @@ -295,8 +314,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: ilo, ihi, jlo, jhi ! beginning and end of physical domain type(block) :: this_block ! block information for current block integer :: compid ! component id - character(len=CL) :: tempc1,tempc2 - real(R8) :: diff_lon + character(len=char_len_long) :: tempc1,tempc2 + real(dbl_kind) :: diff_lon integer :: npes integer :: num_elim_global integer :: num_elim_local @@ -310,6 +329,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer(int_kind) :: ktherm character(*), parameter :: F00 = "('(ice_comp_nuopc) ',2a,1x,d21.14)" character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' + logical :: mastertask !-------------------------------- rc = ESMF_SUCCESS @@ -338,42 +358,47 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! start cice timers !---------------------------------------------------------------------------- +#ifdef CESMCOUPLED call t_startf ('cice_init_total') +#endif !---------------------------------------------------------------------------- ! Initialize constants !---------------------------------------------------------------------------- +#ifdef CESMCOUPLED call ice_init_constants(omega_in=SHR_CONST_OMEGA, radius_in=SHR_CONST_REARTH, & spval_dbl_in=SHR_CONST_SPVAL) + call icepack_init_parameters( & - secday_in = SHR_CONST_CDAY, & - rhoi_in = SHR_CONST_RHOICE, & - rhow_in = SHR_CONST_RHOSW, & - cp_air_in = SHR_CONST_CPDAIR, & - cp_ice_in = SHR_CONST_CPICE, & - cp_ocn_in = SHR_CONST_CPSW, & - gravit_in = SHR_CONST_G, & - rhofresh_in = SHR_CONST_RHOFW, & - zvir_in = SHR_CONST_ZVIR, & - vonkar_in = SHR_CONST_KARMAN, & - cp_wv_in = SHR_CONST_CPWV, & - stefan_boltzmann_in = SHR_CONST_STEBOL, & - Tffresh_in= SHR_CONST_TKFRZ, & - Lsub_in = SHR_CONST_LATSUB, & - Lvap_in = SHR_CONST_LATVAP, & -! Lfresh_in = SHR_CONST_LATICE, & ! computed in init_parameters as Lsub-Lvap - Timelt_in = SHR_CONST_TKFRZ-SHR_CONST_TKFRZ, & - Tsmelt_in = SHR_CONST_TKFRZ-SHR_CONST_TKFRZ, & - ice_ref_salinity_in = SHR_CONST_ICE_REF_SAL, & - depressT_in = 0.054_dbl_kind, & - Tocnfrz_in= -34.0_dbl_kind*0.054_dbl_kind, & - pi_in = SHR_CONST_PI, & - snowpatch_in = 0.005_dbl_kind, & - dragio_in = 0.00962_dbl_kind) + secday_in = SHR_CONST_CDAY, & + rhoi_in = SHR_CONST_RHOICE, & + rhow_in = SHR_CONST_RHOSW, & + cp_air_in = SHR_CONST_CPDAIR, & + cp_ice_in = SHR_CONST_CPICE, & + cp_ocn_in = SHR_CONST_CPSW, & + gravit_in = SHR_CONST_G, & + rhofresh_in = SHR_CONST_RHOFW, & + zvir_in = SHR_CONST_ZVIR, & + vonkar_in = SHR_CONST_KARMAN, & + cp_wv_in = SHR_CONST_CPWV, & + stefan_boltzmann_in = SHR_CONST_STEBOL, & + Tffresh_in = SHR_CONST_TKFRZ, & + Lsub_in = SHR_CONST_LATSUB, & + Lvap_in = SHR_CONST_LATVAP, & + !Lfresh_in = SHR_CONST_LATICE, & ! computed in init_parameters as Lsub-Lvap + Timelt_in = SHR_CONST_TKFRZ-SHR_CONST_TKFRZ, & + Tsmelt_in = SHR_CONST_TKFRZ-SHR_CONST_TKFRZ, & + ice_ref_salinity_in = SHR_CONST_ICE_REF_SAL, & + depressT_in = 0.054_dbl_kind, & + Tocnfrz_in = -34.0_dbl_kind*0.054_dbl_kind, & + pi_in = SHR_CONST_PI, & + snowpatch_in = 0.005_dbl_kind, & + dragio_in = 0.00962_dbl_kind) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) +#endif !---------------------------------------------------------------------------- ! Determine attributes - also needed in realize phase to get grid information @@ -382,32 +407,44 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Get orbital values ! Note that these values are obtained in a call to init_orbit in ice_shortwave.F90 ! if CESMCOUPLED is not defined +#ifdef CESMCOUPLED + mastertask = .false. + if (my_task == master_task) mastertask = .true. + call ice_orbital_init(gcomp, clock, nu_diag, mastertask, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return +#else + ! Start with icepack values then update with values defined in configure file if they exist + call icepack_query_orbit(eccen_out=eccen, mvelpp_out=mvelpp, lambm0_out=lambm0, obliqr_out=obliqr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) eccen end if call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) obliqr end if call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) lambm0 end if call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) mvelpp end if - call icepack_init_orbit(eccen_in=eccen, mvelpp_in=mvelpp, & - lambm0_in=lambm0, obliqr_in=obliqr) + call icepack_init_orbit(eccen_in=eccen, mvelpp_in=mvelpp, lambm0_in=lambm0, obliqr_in=obliqr) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) +#endif ! Determine runtype and possibly nextsw_cday call NUOPC_CompAttributeGet(gcomp, name='start_type', value=cvalue, isPresent=isPresent, rc=rc) @@ -421,7 +458,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) else if (trim(starttype) == trim('branch')) then runtype = "continue" else - call shr_sys_abort( subname//' ERROR: unknown starttype' ) + call abort_ice( subname//' ERROR: unknown starttype' ) end if ! Note that in the mct version the atm was initialized first so that nextsw_cday could be passed to the other @@ -429,10 +466,10 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! In the nuopc version it will be easier to assume that on startup - nextsw_cday is just the current time ! TOOD (mvertens, 2019-03-21): need to get the perpetual run working - + if (trim(runtype) /= 'initial') then ! Set nextsw_cday to -1 (this will skip an orbital calculation on initialization - nextsw_cday = -1.0_r8 + nextsw_cday = -1.0_dbl_kind else call ESMF_ClockGet( clock, currTime=currTime, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -441,20 +478,21 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) end if else ! This would be the NEMS branch - ! Note that in NEMS - nextsw_cday is not needed in ice_orbital.F90 and what is needed is + ! Note that in NEMS - nextsw_cday is not needed in ice_orbital.F90 and what is needed is ! simply a CPP variable declaratino of NEMSCOUPLED runtype = 'initial' ! determined from the namelist in ice_init if CESMCOUPLED is not defined end if + single_column = .false. +#ifdef CESMCOUPLED ! Determine single column info call NUOPC_CompAttributeGet(gcomp, name='single_column', value=cvalue, isPresent=isPresent, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) single_column - else - single_column = .false. end if +#endif if (single_column) then ! Must have these attributes present call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) @@ -467,14 +505,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Determine runid call NUOPC_CompAttributeGet(gcomp, name='case_name', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) runid else runid = 'unknown' ! read in from the namelist in ice_init.F90 if CESMCOUPLED is not defined end if +#ifdef CESMCOUPLED ! Determine tfreeze_option, flux convertence before call to cice_init + ! tcx, what is going on here? if not present, set it? if present, ignore it? call NUOPC_CompAttributeGet(gcomp, name="tfreeze_option", value=tfrz_option, isPresent=isPresent, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (.not. isPresent) then @@ -484,6 +523,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) +#endif #if (defined NEWCODE) call NUOPC_CompAttributeGet(gcomp, name="flux_convergence", value=cvalue, isPresent=isPresent, rc=rc) @@ -491,7 +531,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (isPresent) then read(cvalue,*) flux_convergence_tolerance else - flux_convergence_tolerance = 0._r8 + flux_convergence_tolerance = 0._dbl_kind end if call NUOPC_CompAttributeGet(gcomp, name="flux_max_iteration", value=cvalue, isPresent=isPresent, rc=rc) @@ -520,19 +560,19 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=curr_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,curr_ymd) + call ice_cal_ymd2date(yy,mm,dd,curr_ymd) call ESMF_TimeGet( startTime, yy=yy, mm=mm, dd=dd, s=start_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,start_ymd) + call ice_cal_ymd2date(yy,mm,dd,start_ymd) call ESMF_TimeGet( stopTime, yy=yy, mm=mm, dd=dd, s=stop_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,stop_ymd) + call ice_cal_ymd2date(yy,mm,dd,stop_ymd) call ESMF_TimeGet( refTime, yy=yy, mm=mm, dd=dd, s=ref_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,ref_ymd) + call ice_cal_ymd2date(yy,mm,dd,ref_ymd) call ESMF_TimeIntervalGet( timeStep, s=dtime, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -541,13 +581,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return +#ifdef CESMCOUPLED if (esmf_caltype == ESMF_CALKIND_NOLEAP) then calendar_type = shr_cal_noleap else if (esmf_caltype == ESMF_CALKIND_GREGORIAN) then calendar_type = shr_cal_gregorian else - call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) + call abort_ice( subname//'ERROR:: bad calendar for ESMF' ) end if +#endif !---------------------------------------------------------------------------- ! Set cice logging @@ -555,11 +597,17 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Note that sets the nu_diag module variable in ice_fileunits ! Set the nu_diag_set flag so it's not reset later - call set_component_logging(gcomp, my_task==master_task, nu_diag, shrlogunit, rc) + call init_communicate(lmpicom) ! initial setup for message passing + + mastertask = .false. + if (my_task == master_task) mastertask = .true. + call set_component_logging(gcomp, mastertask, nu_diag, shrlogunit, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return nu_diag_set = .true. +#ifdef CESMCOUPLED call shr_file_setLogUnit (shrlogunit) +#endif !---------------------------------------------------------------------------- ! Initialize cice @@ -568,9 +616,13 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Note that cice_init also sets time manager info as well as mpi communicator info, ! including master_task and my_task +#ifdef CESMCOUPLED call t_startf ('cice_init') - call cice_init( lmpicom ) +#endif + call cice_init +#ifdef CESMCOUPLED call t_stopf ('cice_init') +#endif !---------------------------------------------------------------------------- ! reset shr logging to my log file @@ -630,7 +682,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) write(nu_diag,*) trim(subname),' ERROR curr_ymd,year_init =',curr_ymd,year_init write(nu_diag,*) trim(subname),' ERROR idate lt zero',idate end if - call shr_sys_abort(subname//' :: ERROR idate lt zero') + call abort_ice(subname//' :: ERROR idate lt zero') endif iyear = (idate/10000) ! integer year of basedate month = (idate-iyear*10000)/100 ! integer month of basedate @@ -641,12 +693,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) write(nu_diag,*) trim(subname),' cice year_init = ',year_init write(nu_diag,*) trim(subname),' cice start date = ',idate write(nu_diag,*) trim(subname),' cice start ymds = ',iyear,month,mday,start_tod + write(nu_diag,*) trim(subname),' cice calendar_type = ',trim(calendar_type) endif - if (calendar_type /= "GREGORIAN") then - call time2sec(iyear-year_init,month,mday,time) - else + if (calendar_type == "GREGORIAN" .or. & + calendar_type == "Gregorian" .or. & + calendar_type == "gregorian") then call time2sec(iyear-(year_init-1),month,mday,time) + else + call time2sec(iyear-year_init,month,mday,time) endif time = time+start_tod end if @@ -850,16 +905,16 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! error check differences between internally generated lons and those read in do n = 1,lsize diff_lon = abs(lonMesh(n) - lon(n)) - if ( (diff_lon > 1.e2 .and. abs(diff_lon - 360_r8) > 1.e-1) .or.& - (diff_lon > 1.e-3 .and. diff_lon < 1._r8) ) then + if ( (diff_lon > 1.e2 .and. abs(diff_lon - 360_dbl_kind) > 1.e-1) .or.& + (diff_lon > 1.e-3 .and. diff_lon < 1._dbl_kind) ) then !write(6,100)n,lonMesh(n),lon(n), diff_lon 100 format('ERROR: CICE n, lonmesh(n), lon(n), diff_lon = ',i6,2(f21.13,3x),d21.5) - !call shr_sys_abort() + !call abort_ice() end if if (abs(latMesh(n) - lat(n)) > 1.e-1) then !write(6,101)n,latMesh(n),lat(n), abs(latMesh(n)-lat(n)) 101 format('ERROR: CICE n, latmesh(n), lat(n), diff_lat = ',i6,2(f21.13,3x),d21.5) - !call shr_sys_abort() + !call abort_ice() end if end do @@ -876,7 +931,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) flds_scalar_name=flds_scalar_name, flds_scalar_num=flds_scalar_num, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return -#ifdef CESMCOUPLED +#ifdef CESMCOUPLED !----------------------------------------------------------------- ! Prescribed ice initialization - first get compid !----------------------------------------------------------------- @@ -935,12 +990,14 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) +#ifdef CESMCOUPLED call t_stopf ('cice_init_total') +#endif deallocate(gindex_ice) deallocate(gindex) - call shr_sys_flush(nu_diag) + call flush_fileunit(nu_diag) end subroutine InitializeRealize @@ -963,7 +1020,7 @@ subroutine ModelAdvance(gcomp, rc) type(ESMF_Time) :: nextTime type(ESMF_State) :: importState, exportState character(ESMF_MAXSTR) :: cvalue - real(r8) :: eccen, obliqr, lambm0, mvelpp + real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp integer :: shrlogunit ! original log unit integer :: k,n ! index logical :: stop_now ! .true. ==> stop at the end of this run phase @@ -977,8 +1034,8 @@ subroutine ModelAdvance(gcomp, rc) integer :: mon_sync ! Sync current month integer :: day_sync ! Sync current day integer :: tod_sync ! Sync current time of day (sec) - character(CL) :: restart_date - character(CL) :: restart_filename + character(char_len_long) :: restart_date + character(char_len_long) :: restart_filename logical :: isPresent character(*) , parameter :: F00 = "('(ice_comp_nuopc) ',2a,i8,d21.14)" character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' @@ -992,15 +1049,19 @@ subroutine ModelAdvance(gcomp, rc) !-------------------------------- call ice_timer_start(timer_total) ! time entire run +#ifdef CESMCOUPLED call t_barrierf('cice_run_total_BARRIER',mpi_comm_ice) call t_startf ('cice_run_total') +#endif !-------------------------------- ! Reset shr logging to my log file !-------------------------------- +#ifdef CESMCOUPLED call shr_file_getLogUnit (shrlogunit) call shr_file_setLogUnit (nu_diag) +#endif !-------------------------------- ! Query the Component for its clock, importState and exportState @@ -1024,23 +1085,34 @@ subroutine ModelAdvance(gcomp, rc) !-------------------------------- ! Obtain orbital values !-------------------------------- - call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, isPresent=isPresent, rc=rc) +#ifdef CESMCOUPLED + call ice_orbital_init(gcomp, clock, nu_diag, my_task==master_task, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return +#else + ! Start with icepack values then update with values defined in configure file if they exist + ! tcx, This should be identical with initialization, why do it again? Get rid of it + call icepack_query_orbit(eccen_out=eccen, mvelpp_out=mvelpp, lambm0_out=lambm0, obliqr_out=obliqr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, isPresent=isPresent, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) eccen end if call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) obliqr end if call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) lambm0 end if call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent) then read(cvalue,*) mvelpp end if @@ -1050,6 +1122,7 @@ subroutine ModelAdvance(gcomp, rc) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) +#endif !-------------------------------- ! check that cice internal time is in sync with master clock before timestep update @@ -1064,7 +1137,7 @@ subroutine ModelAdvance(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeGet( currTime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yr_sync, mon_sync, day_sync, ymd_sync) + call ice_cal_ymd2date(yr_sync, mon_sync, day_sync, ymd_sync) ! error check if ( (ymd /= ymd_sync) .or. (tod /= tod_sync) ) then @@ -1108,15 +1181,19 @@ subroutine ModelAdvance(gcomp, rc) ! Unpack import state !-------------------------------- +#ifdef CESMCOUPLED call t_barrierf('cice_run_import_BARRIER',mpi_comm_ice) call t_startf ('cice_run_import') call ice_timer_start(timer_cplrecv) +#endif call ice_import(importState, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return +#ifdef CESMCOUPLED call ice_timer_stop(timer_cplrecv) call t_stopf ('cice_run_import') +#endif ! write Debug output if (debug_import > 0 .and. my_task==master_task) then @@ -1139,15 +1216,19 @@ subroutine ModelAdvance(gcomp, rc) ! Create export state !-------------------------------- +#ifdef CESMCOUPLED call t_barrierf('cice_run_export_BARRIER',mpi_comm_ice) call t_startf ('cice_run_export') call ice_timer_start(timer_cplsend) +#endif call ice_export(exportState, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return +#ifdef CESMCOUPLED call ice_timer_stop(timer_cplsend) call t_stopf ('cice_run_export') +#endif if (debug_export > 0 .and. my_task==master_task) then call State_fldDebug(exportState, flds_scalar_name, 'cice_export:', & @@ -1155,8 +1236,10 @@ subroutine ModelAdvance(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if +#ifdef CESMCOUPLED ! reset shr logging to my original values call shr_file_setLogUnit (shrlogunit) +#endif !-------------------------------- ! stop timers and print timer info @@ -1180,7 +1263,9 @@ subroutine ModelAdvance(gcomp, rc) stop_now = .false. endif +#ifdef CESMCOUPLED call t_stopf ('cice_run_total') +#endif ! Need to stop this at the end of every run phase in a coupled run. call ice_timer_stop(timer_total) @@ -1349,4 +1434,169 @@ subroutine ModelFinalize(gcomp, rc) end subroutine ModelFinalize + !=============================================================================== + +#ifdef CESMCOUPLED + subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) + + !---------------------------------------------------------- + ! Initialize orbital related values for cesm coupled + !---------------------------------------------------------- + + ! input/output variables + type(ESMF_GridComp) :: gcomp + type(ESMF_Clock) , intent(in) :: clock + integer , intent(in) :: logunit + logical , intent(in) :: mastertask + integer , intent(out) :: rc ! output error + + ! local variables + real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp + character(len=char_len_long) :: msgstr ! temporary + character(len=char_len_long) :: cvalue ! temporary + type(ESMF_Time) :: CurrTime ! current time + integer :: year ! model year at current time + integer :: orb_year ! orbital year for current orbital computation + logical :: lprint + logical :: first_time = .true. + character(len=*) , parameter :: subname = "(cice_orbital_init)" + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + if (first_time) then + + ! Determine orbital attributes from input + call NUOPC_CompAttributeGet(gcomp, name='orb_mode', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_mode + call NUOPC_CompAttributeGet(gcomp, name="orb_iyear", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_iyear + call NUOPC_CompAttributeGet(gcomp, name="orb_iyear_align", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_iyear_align + call NUOPC_CompAttributeGet(gcomp, name="orb_obliq", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_obliq + call NUOPC_CompAttributeGet(gcomp, name="orb_eccen", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_eccen + call NUOPC_CompAttributeGet(gcomp, name="orb_mvelp", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_mvelp + + ! Error checks + if (trim(orb_mode) == trim(orb_fixed_year)) then + orb_obliq = SHR_ORB_UNDEF_REAL + orb_eccen = SHR_ORB_UNDEF_REAL + orb_mvelp = SHR_ORB_UNDEF_REAL + if (orb_iyear == SHR_ORB_UNDEF_INT) then + if (mastertask) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: fixed_year settings = ',orb_iyear + write (msgstr, *) ' ERROR: invalid settings for orb_mode '//trim(orb_mode) + end if + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + return ! bail out + endif + elseif (trim(orb_mode) == trim(orb_variable_year)) then + orb_obliq = SHR_ORB_UNDEF_REAL + orb_eccen = SHR_ORB_UNDEF_REAL + orb_mvelp = SHR_ORB_UNDEF_REAL + if (orb_iyear == SHR_ORB_UNDEF_INT .or. orb_iyear_align == SHR_ORB_UNDEF_INT) then + if (mastertask) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: variable_year settings = ',orb_iyear, orb_iyear_align + write (msgstr, *) subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode) + end if + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + return ! bail out + endif + elseif (trim(orb_mode) == trim(orb_fixed_parameters)) then + !-- force orb_iyear to undef to make sure shr_orb_params works properly + orb_iyear = SHR_ORB_UNDEF_INT + orb_iyear_align = SHR_ORB_UNDEF_INT + if (orb_eccen == SHR_ORB_UNDEF_REAL .or. & + orb_obliq == SHR_ORB_UNDEF_REAL .or. & + orb_mvelp == SHR_ORB_UNDEF_REAL) then + if (mastertask) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: orb_eccen = ',orb_eccen + write(logunit,*) trim(subname),' ERROR: orb_obliq = ',orb_obliq + write(logunit,*) trim(subname),' ERROR: orb_mvelp = ',orb_mvelp + write (msgstr, *) subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode) + end if + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + return ! bail out + endif + else + write (msgstr, *) subname//' ERROR: invalid orb_mode '//trim(orb_mode) + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + rc = ESMF_FAILURE + return ! bail out + endif + end if + + if (trim(orb_mode) == trim(orb_variable_year)) then + call ESMF_ClockGet(clock, CurrTime=CurrTime, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet(CurrTime, yy=year, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + orb_year = orb_iyear + (year - orb_iyear_align) + lprint = mastertask + else + orb_year = orb_iyear + if (first_time) then + lprint = mastertask + else + lprint = .false. + end if + end if + + eccen = orb_eccen + call shr_orb_params(orb_year, eccen, orb_obliq, orb_mvelp, obliqr, lambm0, mvelpp, lprint) + + if ( eccen == SHR_ORB_UNDEF_REAL .or. obliqr == SHR_ORB_UNDEF_REAL .or. & + mvelpp == SHR_ORB_UNDEF_REAL .or. lambm0 == SHR_ORB_UNDEF_REAL) then + write (msgstr, *) subname//' ERROR: orb params incorrect' + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + return ! bail out + endif + + call icepack_init_orbit(eccen_in=eccen, mvelpp_in=mvelpp, lambm0_in=lambm0, obliqr_in=obliqr) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + first_time = .false. + + end subroutine ice_orbital_init +#endif + !=============================================================================== + + subroutine ice_cal_ymd2date(year, month, day, date) + + implicit none + + ! !INPUT/OUTPUT PARAMETERS: + + integer,intent(in ) :: year,month,day ! calendar year,month,day + integer,intent(out) :: date ! coded (yyyymmdd) calendar date + + !--- local --- + character(*),parameter :: subName = "(ice_cal_ymd2date)" + + !------------------------------------------------------------------------------- + ! NOTE: + ! this calendar has a year zero (but no day or month zero) + !------------------------------------------------------------------------------- + + date = abs(year)*10000 + month*100 + day ! coded calendar date + if (year < 0) date = -date + + end subroutine ice_cal_ymd2date + + !=============================================================================== + end module ice_comp_nuopc diff --git a/cicecore/drivers/nuopc/cmeps/ice_import_export.F90 b/cicecore/drivers/nuopc/cmeps/ice_import_export.F90 index 0fe2510aa..083283895 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_import_export.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_import_export.F90 @@ -3,10 +3,7 @@ module ice_import_export use ESMF use NUOPC use NUOPC_Model - use shr_sys_mod , only : shr_sys_abort, shr_sys_flush - use shr_frz_mod , only : shr_frz_freezetemp - use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs - use ice_kinds_mod , only : int_kind, dbl_kind, char_len_long, log_kind + use ice_kinds_mod , only : int_kind, dbl_kind, char_len, log_kind use ice_constants , only : c0, c1, spval_dbl use ice_constants , only : field_loc_center, field_type_scalar, field_type_vector use ice_blocks , only : block, get_block, nx_block, ny_block @@ -19,27 +16,29 @@ module ice_import_export #if (defined NEWCODE) use ice_flux , only : fswthruvdr, fswthruvdf, fswthruidr, fswthruidf use ice_flux , only : send_i2x_per_cat, fswthrun_ai -#endif - use ice_flux , only : fresh, fsalt, zlvl, uatm, vatm, potT, Tair, Qa - use ice_flux , only : rhoa, swvdr, swvdf, swidr, swidf, flw, frain - use ice_flux , only : fsnow, uocn, vocn, sst, ss_tltx, ss_tlty, frzmlt - use ice_flux , only : sss, tf, wind, fsw -#if (defined NEWCODE) use ice_flux , only : faero_atm, faero_ocn use ice_flux , only : fiso_atm, fiso_ocn, fiso_rain, fiso_evap use ice_flux , only : Qa_iso, Qref_iso, HDO_ocn, H2_18O_ocn, H2_16O_ocn #endif + use ice_flux , only : fresh, fsalt, zlvl, uatm, vatm, potT, Tair, Qa + use ice_flux , only : rhoa, swvdr, swvdf, swidr, swidf, flw, frain + use ice_flux , only : fsnow, uocn, vocn, sst, ss_tltx, ss_tlty, frzmlt + use ice_flux , only : sss, Tf, wind, fsw use ice_state , only : vice, vsno, aice, aicen_init, trcr use ice_grid , only : tlon, tlat, tarea, tmask, anglet, hm, ocn_gridcell_frac use ice_grid , only : grid_type, t2ugrid_vector use ice_boundary , only : ice_HaloUpdate - use ice_fileunits , only : nu_diag + use ice_fileunits , only : nu_diag, flush_fileunit use ice_communicate , only : my_task, master_task, MPI_COMM_ICE use ice_prescribed_mod , only : prescribed_ice use ice_shr_methods , only : chkerr, state_reset use icepack_intfc , only : icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc , only : icepack_query_parameters, icepack_query_tracer_flags + use icepack_intfc , only : icepack_liquidus_temperature +#ifdef CESMCOUPLED + use shr_frz_mod , only : shr_frz_freezetemp use perf_mod , only : t_startf, t_stopf, t_barrierf +#endif implicit none public @@ -107,8 +106,8 @@ subroutine ice_advertise_fields(gcomp, importState, exportState, flds_scalar_nam ! local variables integer :: n - character(CS) :: stdname - character(CS) :: cvalue + character(char_len) :: stdname + character(char_len) :: cvalue logical :: flds_wiso ! use case logical :: flds_i2o_per_cat ! .true. => select per ice thickness category character(len=*), parameter :: subname='(ice_import_export:ice_advertise_fields)' @@ -117,16 +116,19 @@ subroutine ice_advertise_fields(gcomp, importState, exportState, flds_scalar_nam rc = ESMF_SUCCESS if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + flds_wiso = .false. + flds_i2o_per_cat = .false. +#ifdef CESMCOUPLED call NUOPC_CompAttributeGet(gcomp, name='flds_wiso', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) flds_wiso call ESMF_LogWrite('flds_wiso = '// trim(cvalue), ESMF_LOGMSG_INFO) - #if (defined NEWCODE) call NUOPC_CompAttributeGet(gcomp, name='flds_i2o_per_cat', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) send_i2x_per_cat call ESMF_LogWrite('flds_i2o_per_cat = '// trim(cvalue), ESMF_LOGMSG_INFO) +#endif #endif !----------------- @@ -142,7 +144,7 @@ subroutine ice_advertise_fields(gcomp, importState, exportState, flds_scalar_nam call fldlist_add(fldsToIce_num, fldsToIce, 's_surf' ) call fldlist_add(fldsToIce_num, fldsToIce, 'ocn_current_zonal' ) call fldlist_add(fldsToIce_num, fldsToIce, 'ocn_current_merid' ) - call fldlist_add(fldsToIce_num, fldsToIce, 'freezing_melting_potential' ) + call fldlist_add(fldsToIce_num, fldsToIce, 'freezing_melting_potential') if (flds_wiso) then call fldlist_add(fldsToIce_num, fldsToIce, 'So_roce_wiso', ungridded_lbound=1, ungridded_ubound=3) end if @@ -153,8 +155,7 @@ subroutine ice_advertise_fields(gcomp, importState, exportState, flds_scalar_nam call fldlist_add(fldsToIce_num, fldsToIce, 'inst_merid_wind_height_lowest' ) call fldlist_add(fldsToIce_num, fldsToIce, 'inst_spec_humid_height_lowest' ) call fldlist_add(fldsToIce_num, fldsToIce, 'inst_temp_height_lowest' ) - call fldlist_add(fldsToIce_num, fldsToIce, 'Sa_ptem' ) - call fldlist_add(fldsToIce_num, fldsToIce, 'air_density_height_lowest' ) + call fldlist_add(fldsToIce_num, fldsToIce, 'inst_pres_height_lowest' ) call fldlist_add(fldsToIce_num, fldsToIce, 'mean_down_sw_vis_dir_flx' ) call fldlist_add(fldsToIce_num, fldsToIce, 'mean_down_sw_ir_dir_flx' ) call fldlist_add(fldsToIce_num, fldsToIce, 'mean_down_sw_vis_dif_flx' ) @@ -162,7 +163,10 @@ subroutine ice_advertise_fields(gcomp, importState, exportState, flds_scalar_nam call fldlist_add(fldsToIce_num, fldsToIce, 'mean_down_lw_flx' ) call fldlist_add(fldsToIce_num, fldsToIce, 'mean_prec_rate' ) call fldlist_add(fldsToIce_num, fldsToIce, 'mean_fprec_rate' ) + call fldlist_add(fldsToIce_num, fldsToIce, 'Sa_ptem' ) !cesm + call fldlist_add(fldsToIce_num, fldsToIce, 'air_density_height_lowest' ) !cesm +#ifdef CESMCOUPLED ! from atm - black carbon deposition fluxes (3) call fldlist_add(fldsToIce_num, fldsToIce, 'Faxa_bcph', ungridded_lbound=1, ungridded_ubound=3) @@ -171,6 +175,7 @@ subroutine ice_advertise_fields(gcomp, importState, exportState, flds_scalar_nam ! from - atm dry dust deposition frluxes (4 sizes) call fldlist_add(fldsToIce_num, fldsToIce, 'Faxa_dstdry', ungridded_lbound=1, ungridded_ubound=4) +#endif do n = 1,fldsToIce_num call NUOPC_Advertise(importState, standardName=fldsToIce(n)%stdname, & @@ -231,9 +236,11 @@ subroutine ice_advertise_fields(gcomp, importState, exportState, flds_scalar_nam call fldlist_add(fldsFrIce_num , fldsFrIce, 'mean_salt_rate' ) call fldlist_add(fldsFrIce_num , fldsFrIce, 'stress_on_ocn_ice_zonal' ) call fldlist_add(fldsFrIce_num , fldsFrIce, 'stress_on_ocn_ice_merid' ) +#ifdef CESMCOUPLED call fldlist_add(fldsFrIce_num , fldsFrIce, 'Fioi_bcpho' ) call fldlist_add(fldsFrIce_num , fldsFrIce, 'Fioi_bcphi' ) call fldlist_add(fldsFrIce_num , fldsFrIce, 'Fioi_flxdst' ) +#endif if (flds_wiso) then call fldlist_add(fldsFrIce_num, fldsFrIce, 'mean_fresh_water_to_ocean_rate_wiso', & ungridded_lbound=1, ungridded_ubound=3) @@ -337,7 +344,7 @@ subroutine ice_import( importState, rc ) integer , intent(out) :: rc ! local variables - integer,parameter :: nflds=15 + integer,parameter :: nflds=16 integer,parameter :: nfldv=6 integer :: i, j, iblk, n integer :: ilo, ihi, jlo, jhi !beginning and end of physical domain @@ -346,6 +353,7 @@ subroutine ice_import( importState, rc ) real (kind=dbl_kind) :: workx, worky real (kind=dbl_kind) :: MIN_RAIN_TEMP, MAX_SNOW_TEMP real (kind=dbl_kind) :: tffresh + real (kind=dbl_kind) :: inst_pres_height_lowest character(len=*), parameter :: subname = 'ice_import' !----------------------------------------------------- @@ -383,57 +391,68 @@ subroutine ice_import( importState, rc ) call state_getimport(importState, 's_surf', output=aflds, index=2, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! import ocean states + ! import atm states call state_getimport(importState, 'inst_height_lowest', output=aflds, index=3, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_ptem', output=aflds, index=4, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'inst_temp_height_lowest', output=aflds, index=5, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (State_FldChk(importState, 'Sa_ptem') .and. State_fldchk(importState, 'air_density_height_lowest')) then + call state_getimport(importState, 'Sa_ptem', output=aflds, index=4, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'air_density_height_lowest', output=aflds, index=5, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else if (State_FldChk(importState, 'inst_pres_height_lowest')) then + call state_getimport(importState, 'inst_pres_height_lowest', output=aflds, index=6, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call abort_ice(trim(subname)//& + ": ERROR either Sa_ptem and air_density_height_lowest OR inst_pres_height_lowest must be in import state") + end if - call state_getimport(importState, 'inst_spec_humid_height_lowest', output=aflds, index=6, rc=rc) + call state_getimport(importState, 'inst_temp_height_lowest', output=aflds, index=7, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'air_density_height_lowest', output=aflds, index=7, rc=rc) + call state_getimport(importState, 'inst_spec_humid_height_lowest', output=aflds, index=8, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! import ocn/ice fluxes - call state_getimport(importState, 'freezing_melting_potential', output=aflds, index=8, rc=rc) + call state_getimport(importState, 'freezing_melting_potential', output=aflds, index=9, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! import atm fluxes - call state_getimport(importState, 'mean_down_sw_vis_dir_flx', output=aflds, index=9, rc=rc) + call state_getimport(importState, 'mean_down_sw_vis_dir_flx', output=aflds, index=10, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'mean_down_sw_ir_dir_flx', output=aflds, index=10, rc=rc) + call state_getimport(importState, 'mean_down_sw_ir_dir_flx', output=aflds, index=11, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'mean_down_sw_vis_dif_flx', output=aflds, index=11, rc=rc) + call state_getimport(importState, 'mean_down_sw_vis_dif_flx', output=aflds, index=12, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'mean_down_sw_ir_dif_flx', output=aflds, index=12, rc=rc) + call state_getimport(importState, 'mean_down_sw_ir_dif_flx', output=aflds, index=13, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'mean_down_lw_flx', output=aflds, index=13, rc=rc) + call state_getimport(importState, 'mean_down_lw_flx', output=aflds, index=14, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'mean_prec_rate', output=aflds, index=14, rc=rc) + call state_getimport(importState, 'mean_prec_rate', output=aflds, index=15, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'mean_fprec_rate', output=aflds, index=15, rc=rc) + call state_getimport(importState, 'mean_fprec_rate', output=aflds, index=16, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! perform a halo update if (.not.prescribed_ice) then +#ifdef CESMCOUPLED call t_startf ('cice_imp_halo') +#endif call ice_HaloUpdate(aflds, halo_info, field_loc_center, field_type_scalar) +#ifdef CESMCOUPLED call t_stopf ('cice_imp_halo') +#endif endif ! now fill in the ice internal data types @@ -442,26 +461,59 @@ subroutine ice_import( importState, rc ) do iblk = 1, nblocks do j = 1,ny_block do i = 1,nx_block - sst (i,j,iblk) = aflds(i,j, 1,iblk) - sss (i,j,iblk) = aflds(i,j, 2,iblk) - zlvl (i,j,iblk) = aflds(i,j, 3,iblk) - potT (i,j,iblk) = aflds(i,j, 4,iblk) - Tair (i,j,iblk) = aflds(i,j, 5,iblk) - Qa (i,j,iblk) = aflds(i,j, 6,iblk) - rhoa (i,j,iblk) = aflds(i,j, 7,iblk) - frzmlt (i,j,iblk) = aflds(i,j, 8,iblk) - swvdr(i,j,iblk) = aflds(i,j, 9,iblk) - swidr(i,j,iblk) = aflds(i,j,10,iblk) - swvdf(i,j,iblk) = aflds(i,j,11,iblk) - swidf(i,j,iblk) = aflds(i,j,12,iblk) - flw (i,j,iblk) = aflds(i,j,13,iblk) - frain(i,j,iblk) = aflds(i,j,14,iblk) - fsnow(i,j,iblk) = aflds(i,j,15,iblk) - enddo !i - enddo !j - enddo !iblk + sst (i,j,iblk) = aflds(i,j, 1,iblk) + sss (i,j,iblk) = aflds(i,j, 2,iblk) + zlvl (i,j,iblk) = aflds(i,j, 3,iblk) + ! see below for 4,5,6 + Tair (i,j,iblk) = aflds(i,j, 7,iblk) + Qa (i,j,iblk) = aflds(i,j, 8,iblk) + frzmlt (i,j,iblk) = aflds(i,j, 9,iblk) + swvdr(i,j,iblk) = aflds(i,j,10,iblk) + swidr(i,j,iblk) = aflds(i,j,11,iblk) + swvdf(i,j,iblk) = aflds(i,j,12,iblk) + swidf(i,j,iblk) = aflds(i,j,13,iblk) + flw (i,j,iblk) = aflds(i,j,14,iblk) + frain(i,j,iblk) = aflds(i,j,15,iblk) + fsnow(i,j,iblk) = aflds(i,j,16,iblk) + end do + end do + end do !$OMP END PARALLEL DO + if ( State_fldChk(importState, 'Sa_ptem') .and. State_fldchk(importState,'air_density_height_lowest')) then + !$OMP PARALLEL DO PRIVATE(iblk,i,j) + do iblk = 1, nblocks + do j = 1,ny_block + do i = 1,nx_block + potT (i,j,iblk) = aflds(i,j, 4,iblk) + rhoa (i,j,iblk) = aflds(i,j, 5,iblk) + end do + end do + end do + !$OMP END PARALLEL DO + else if (State_fldChk(importState, 'inst_pres_height_lowest')) then + !$OMP PARALLEL DO PRIVATE(iblk,i,j) + do iblk = 1, nblocks + do j = 1,ny_block + do i = 1,nx_block + inst_pres_height_lowest = aflds(i,j,6,iblk) + if (inst_pres_height_lowest > 0.0_ESMF_KIND_R8) then + potT (i,j,iblk) = Tair(i,j,iblk) * (100000._ESMF_KIND_R8/inst_pres_height_lowest)**0.286_ESMF_KIND_R8 + else + potT (i,j,iblk) = 0.0_ESMF_KIND_R8 + end if + if (Tair(i,j,iblk) /= 0._ESMF_KIND_R8) then + rhoa(i,j,iblk) = inst_pres_height_lowest / & + (287.058_ESMF_KIND_R8*(1._ESMF_KIND_R8+0.608_ESMF_KIND_R8*Qa(i,j,iblk))*Tair(i,j,iblk)) + else + rhoa(i,j,iblk) = 0._ESMF_KIND_R8 + endif + end do !i + end do !j + end do !iblk + !$OMP END PARALLEL DO + end if + deallocate(aflds) allocate(aflds(nx_block,ny_block,nfldv,nblocks)) aflds = c0 @@ -485,9 +537,13 @@ subroutine ice_import( importState, rc ) if (.not.prescribed_ice) then +#ifdef CESMCOUPLED call t_startf ('cice_imp_halo') +#endif call ice_HaloUpdate(aflds, halo_info, field_loc_center, field_type_vector) +#ifdef CESMCOUPLED call t_stopf ('cice_imp_halo') +#endif endif !$OMP PARALLEL DO PRIVATE(iblk,i,j) @@ -600,7 +656,9 @@ subroutine ice_import( importState, rc ) ! interpolate across the pole) ! use ANGLET which is on the T grid ! +#ifdef CESMCOUPLED call t_startf ('cice_imp_ocn') +#endif !$OMP PARALLEL DO PRIVATE(iblk,i,j,workx,worky) do iblk = 1, nblocks @@ -624,33 +682,47 @@ subroutine ice_import( importState, rc ) sst(i,j,iblk) = sst(i,j,iblk) - Tffresh ! sea sfc temp (C) sss(i,j,iblk) = max(sss(i,j,iblk),c0) +#ifndef CESMCOUPLED +!tcx should this be icepack_sea_freezing_temperature? + Tf (i,j,iblk) = icepack_liquidus_temperature(sss(i,j,iblk)) +#endif enddo enddo - ! Use shr_frz_mod for this +#ifdef CESMCOUPLED + ! Use shr_frz_mod for this, overwrite Tf computed above Tf(:,:,iblk) = shr_frz_freezetemp(sss(:,:,iblk)) +#endif enddo !$OMP END PARALLEL DO +#ifdef CESMCOUPLED call t_stopf ('cice_imp_ocn') +#endif ! Interpolate ocean dynamics variables from T-cell centers to ! U-cell centers. if (.not.prescribed_ice) then +#ifdef CESMCOUPLED call t_startf ('cice_imp_t2u') +#endif call t2ugrid_vector(uocn) call t2ugrid_vector(vocn) call t2ugrid_vector(ss_tltx) call t2ugrid_vector(ss_tlty) +#ifdef CESMCOUPLED call t_stopf ('cice_imp_t2u') +#endif end if ! Atmosphere variables are needed in T cell centers in ! subroutine stability and are interpolated to the U grid ! later as necessary. +#ifdef CESMCOUPLED call t_startf ('cice_imp_atm') +#endif !$OMP PARALLEL DO PRIVATE(iblk,i,j,workx,worky) do iblk = 1, nblocks do j = 1, ny_block @@ -671,7 +743,9 @@ subroutine ice_import( importState, rc ) enddo enddo !$OMP END PARALLEL DO +#ifdef CESMCOUPLED call t_stopf ('cice_imp_atm') +#endif end subroutine ice_import @@ -787,7 +861,7 @@ subroutine ice_export( exportState, rc ) if (tmask(i,j,iblk) .and. ailohi(i,j,iblk) < c0 ) then write(nu_diag,*) & ' (ice) send: ERROR ailohi < 0.0 ',i,j,ailohi(i,j,iblk) - call shr_sys_flush(nu_diag) + call flush_fileunit(nu_diag) endif end do end do @@ -1039,7 +1113,6 @@ subroutine ice_export( exportState, rc ) lmask=tmask, ifrac=ailohi, ungridded_index=2, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif -#endif ! ------ ! optional short wave penetration to ocean ice category @@ -1056,11 +1129,12 @@ subroutine ice_export( exportState, rc ) ! penetrative shortwave by category ! Note: no need zero out pass-through fields over land for benefit of x2oacc fields in cpl hist files since ! the export state has been zeroed out at the beginning - call state_setexport(exportState, 'mean_sw_pen_to_ocn_ifrac_n', input=aicen_init, index=n, & + call state_setexport(exportState, 'mean_sw_pen_to_ocn_ifrac_n', input=fswthrun_ai, index=n, & lmask=tmask, ifrac=ailohi, ungridded_index=n, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do end if +#endif end subroutine ice_export @@ -1083,7 +1157,7 @@ subroutine fldlist_add(num, fldlist, stdname, ungridded_lbound, ungridded_ubound num = num + 1 if (num > fldsMax) then - call shr_sys_abort(trim(subname)//": ERROR num > fldsMax "//trim(stdname)) + call abort_ice(trim(subname)//": ERROR num > fldsMax "//trim(stdname)) endif fldlist(num)%stdname = trim(stdname) @@ -1270,6 +1344,9 @@ subroutine state_getimport_4d_output(state, fldname, output, index, do_sum, ungr rc = ESMF_SUCCESS + ! check that fieldname exists + if (.not. State_FldChk(state, trim(fldname))) return + if (geomtype == ESMF_GEOMTYPE_MESH) then ! get field pointer @@ -1381,6 +1458,9 @@ subroutine state_getimport_3d_output(state, fldname, output, do_sum, ungridded_i rc = ESMF_SUCCESS + ! check that fieldname exists + if (.not. State_FldChk(state, trim(fldname))) return + if (geomtype == ESMF_GEOMTYPE_MESH) then ! get field pointer @@ -1486,11 +1566,10 @@ subroutine state_setexport_4d_input(state, fldname, input, index, lmask, ifrac, rc = ESMF_SUCCESS - if (geomtype == ESMF_GEOMTYPE_MESH) then + ! check that fieldname exists + if (.not. State_FldChk(state, trim(fldname))) return - if (present(ungridded_index)) then - write(6,*)'DEBUG: fldname = ',trim(fldname),' has ungridded index= ',ungridded_index - end if + if (geomtype == ESMF_GEOMTYPE_MESH) then ! get field pointer if (present(ungridded_index)) then @@ -1604,6 +1683,9 @@ subroutine state_setexport_3d_input(state, fldname, input, lmask, ifrac, ungridd rc = ESMF_SUCCESS + ! check that fieldname exists + if (.not. State_FldChk(state, trim(fldname))) return + if (geomtype == ESMF_GEOMTYPE_MESH) then ! get field pointer diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index f597015f3..dd56ac441 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -1,6 +1,15 @@ module ice_prescribed_mod -#ifdef CESMCOUPLED +#ifndef CESMCOUPLED + + use ice_kinds_mod + + implicit none + private ! except + + logical(kind=log_kind), parameter, public :: prescribed_ice = .false. ! true if prescribed ice + +#else ! !DESCRIPTION: ! The prescribed ice model reads in ice concentration data from a netCDF @@ -49,7 +58,7 @@ module ice_prescribed_mod ! !PUBLIC DATA MEMBERS: logical(kind=log_kind), public :: prescribed_ice ! true if prescribed ice - integer(SHR_KIND_IN),parameter :: nFilesMaximum = 400 ! max number of files + integer(kind=int_kind),parameter :: nFilesMaximum = 400 ! max number of files integer(kind=int_kind) :: stream_year_first ! first year in stream to use integer(kind=int_kind) :: stream_year_last ! last year in stream to use integer(kind=int_kind) :: model_year_align ! align stream_year_first diff --git a/cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90 b/cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90 index 24a4226e5..323cba9a4 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90 @@ -20,9 +20,11 @@ module ice_shr_methods use ESMF , only : ESMF_VM, ESMF_VMGet, ESMF_VMBroadcast, ESMF_VMGetCurrent use NUOPC , only : NUOPC_CompAttributeGet use NUOPC_Model , only : NUOPC_ModelGet - use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs - use shr_sys_mod , only : shr_sys_abort + use ice_kinds_mod, only : r8 => dbl_kind, cl=>char_len_long, cs=>char_len + use ice_exit , only : abort_ice +#ifdef CESMCOUPLED use shr_file_mod , only : shr_file_setlogunit, shr_file_getLogUnit +#endif implicit none private @@ -89,9 +91,11 @@ subroutine memcheck(string, level, mastertask) character(len=*), parameter :: subname='(memcheck)' !----------------------------------------------------------------------- +#ifdef CESMCOUPLED if ((mastertask .and. memdebug_level > level) .or. memdebug_level > level+1) then ierr = GPTLprint_memusage(string) endif +#endif end subroutine memcheck @@ -160,7 +164,9 @@ subroutine set_component_logging(gcomp, mastertask, logunit, shrlogunit, rc) logUnit = 6 endif +#ifdef CESMCOUPLED call shr_file_setLogUnit (logunit) +#endif end subroutine set_component_logging @@ -710,10 +716,10 @@ subroutine alarmInit( clock, alarm, option, & case (optDate) if (.not. present(opt_ymd)) then - call shr_sys_abort(subname//trim(option)//' requires opt_ymd') + call abort_ice(subname//trim(option)//' requires opt_ymd') end if if (lymd < 0 .or. ltod < 0) then - call shr_sys_abort(subname//trim(option)//'opt_ymd, opt_tod invalid') + call abort_ice(subname//trim(option)//'opt_ymd, opt_tod invalid') end if call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -723,13 +729,13 @@ subroutine alarmInit( clock, alarm, option, & case (optIfdays0) if (.not. present(opt_ymd)) then - call shr_sys_abort(subname//trim(option)//' requires opt_ymd') + call abort_ice(subname//trim(option)//' requires opt_ymd') end if if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -739,10 +745,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNSteps) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -750,8 +756,8 @@ subroutine alarmInit( clock, alarm, option, & update_nextalarm = .true. case (optNStep) - if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') - if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + if (.not.present(opt_n)) call abort_ice(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call abort_ice(subname//trim(option)//' invalid opt_n') call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return AlarmInterval = AlarmInterval * opt_n @@ -759,10 +765,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNSeconds) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -771,10 +777,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNSecond) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -784,20 +790,20 @@ subroutine alarmInit( clock, alarm, option, & case (optNMinutes) call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if AlarmInterval = AlarmInterval * opt_n update_nextalarm = .true. case (optNMinute) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -806,10 +812,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNHours) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -818,10 +824,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNHour) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -830,10 +836,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNDays) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -842,10 +848,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNDay) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -854,10 +860,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNMonths) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -866,10 +872,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNMonth) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -885,10 +891,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNYears) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -897,10 +903,10 @@ subroutine alarmInit( clock, alarm, option, & case (optNYear) if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') + call abort_ice(subname//trim(option)//' requires opt_n') end if if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call abort_ice(subname//trim(option)//' invalid opt_n') end if call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -915,7 +921,7 @@ subroutine alarmInit( clock, alarm, option, & update_nextalarm = .true. case default - call shr_sys_abort(subname//'unknown option '//trim(option)) + call abort_ice(subname//'unknown option '//trim(option)) end select @@ -964,7 +970,7 @@ subroutine timeInit( Time, ymd, cal, tod, rc) rc = ESMF_SUCCESS if ( (ymd < 0) .or. (tod < 0) .or. (tod > SecPerDay) )then - call shr_sys_abort( subname//'ERROR yymmdd is a negative number or time-of-day out of bounds' ) + call abort_ice( subname//'ERROR yymmdd is a negative number or time-of-day out of bounds' ) end if tdate = abs(date) diff --git a/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 b/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 index 986189f96..adafb3d36 100644 --- a/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 +++ b/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 @@ -171,10 +171,12 @@ subroutine cice_init(mpi_comm) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) - -! call calendar(time) ! determine the initial date - +#ifndef CICE_DMI + call calendar(time) ! determine the initial date +#endif +#ifndef CICE_IN_NEMO call init_forcing_ocn(dt) ! initialize sss and sst from data +#endif call init_state ! initialize the ice state call init_transport ! initialize horizontal transport call ice_HaloRestore_init ! restored boundary conditions @@ -216,7 +218,9 @@ subroutine cice_init(mpi_comm) ! coupler communication or forcing data initialization !-------------------------------------------------------------------- +#ifndef CICE_IN_NEMO call init_forcing_atmo ! initialize atmospheric forcing (standalone) +#endif #ifndef coupled #ifndef CESMCOUPLED diff --git a/cicecore/drivers/nuopc/dmi/cice_cap.info b/cicecore/drivers/nuopc/dmi/cice_cap.info new file mode 100644 index 000000000..49127cc15 --- /dev/null +++ b/cicecore/drivers/nuopc/dmi/cice_cap.info @@ -0,0 +1,1031 @@ +module cice_cap +!--------------- LANL CICE NUOPC CAP ----------------- +! This is the DMI CICE model cap component that is NUOPC compliant. +! Author: Fei.Liu@gmail.com +! 5/10/13 +! This is now acting as a cap/connector between NUOPC driver and LANL CICE code. +! Author: Anthony.Craig@gmail.com +! Added cice grid code to match internal grid representation +! Updated by Till Rasmussen, DMI + +! cice specific + use ice_blocks, only: nx_block, ny_block, nblocks_tot, block, get_block, & + get_block_parameter + use ice_domain_size, only: max_blocks, nx_global, ny_global + use ice_domain, only: nblocks, blocks_ice, distrb_info + use ice_distribution, only: ice_distributiongetblockloc + use icepack_parameters, only: Tffresh, rad_to_deg + use ice_calendar, only: dt + use ice_flux + use ice_grid, only: TLAT, TLON, ULAT, ULON, hm, tarea, ANGLET, ANGLE, & + dxt, dyt, t2ugrid_vector + use ice_state + use CICE_RunMod + use CICE_InitMod + use CICE_FinalMod +!end cice specific + use ESMF + use NUOPC + use mod_nuopc_options, only: esmf_write_diagnostics + use NUOPC_Model, & + model_routine_SS => SetServices, & + model_label_SetClock => label_SetClock, & + model_label_Advance => label_Advance, & + model_label_Finalize => label_Finalize + + implicit none + + private + + public SetServices + +! type cice_internalstate_type +! end type + +! type cice_internalstate_wrapper +! type(cice_internalstate_type), pointer :: ptr +! end type + + integer :: import_slice = 0 + integer :: export_slice = 0 + + type fld_list_type + character(len=64) :: stdname + character(len=64) :: shortname + character(len=64) :: canonicalUnits + character(len=64) :: transferOffer + logical :: assoc ! is the farrayPtr associated with internal data + real(ESMF_KIND_R8), dimension(:,:,:), pointer :: farrayPtr + end type fld_list_type + + integer,parameter :: fldsMax = 50 + integer :: fldsToIce_num = 0 + type (fld_list_type) :: fldsToIce(fldsMax) + integer :: fldsFrIce_num = 0 + type (fld_list_type) :: fldsFrIce(fldsMax) + +!tarnotused integer :: lsize ! local number of gridcells for coupling + character(len=256) :: tmpstr + character(len=2048):: info + logical :: isPresent + integer :: dbrc ! temporary debug rc value + + logical :: profile_memory = .true. + + contains + !----------------------------------------------------------------------------- + subroutine SetServices(gcomp, rc) + type(ESMF_GridComp) :: gcomp + integer, intent(out) :: rc + character(len=*),parameter :: subname='(cice:SetServices)' + rc = ESMF_SUCCESS + + ! the NUOPC model component will register the generic methods + call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! set entry point for methods that require specific implementation + call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & + phaseLabelList=(/"IPDv00p1"/), userRoutine=InitializeAdvertise, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & + phaseLabelList=(/"IPDv00p2"/), userRoutine=InitializeRealize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! attach specializing method(s) + call NUOPC_CompSpecialize(gcomp, specLabel=model_label_SetClock, & + specRoutine=SetClock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Advance, & + specRoutine=ModelAdvance, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + + call NUOPC_CompSpecialize(gcomp, specLabel=model_label_Finalize, & + specRoutine=cice_model_finalize, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: gcomp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + ! Local Variables + type(ESMF_VM) :: vm + integer :: mpi_comm + character(len=*),parameter :: subname='(cice_cap:InitializeAdvertise)' + rc = ESMF_SUCCESS + call ESMF_VMGetCurrent(vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_VMGet(vm, mpiCommunicator=mpi_comm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call CICE_FieldsSetup() + call CICE_Initialize(mpi_comm) + + call CICE_AdvertiseFields(importState, fldsToIce_num, fldsToIce, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call CICE_AdvertiseFields(exportState, fldsFrIce_num, fldsFrIce, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + write(info,*) subname,' --- initialization phase 1 completed --- ' + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: gcomp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! Local Variables + type(ESMF_VM) :: vm + type(ESMF_Grid) :: gridIn + type(ESMF_Grid) :: gridOut + type(ESMF_DistGrid) :: distgrid + type(ESMF_DistGridConnection), allocatable :: connectionList(:) + integer :: npet + integer :: i,j,iblk, n, i1,j1, DE + integer :: ilo,ihi,jlo,jhi + integer :: ig,jg,cnt + integer :: peID,locID + integer :: peIDCount + integer, pointer :: indexList(:) + integer, pointer :: deLabelList(:) + integer, pointer :: deBlockList(:,:,:) + integer, pointer :: petMap(:) + integer, pointer :: i_glob(:),j_glob(:) + integer :: lbnd(2),ubnd(2) + type(block) :: this_block + type(ESMF_DELayout) :: delayout + real(ESMF_KIND_R8), pointer :: tarray(:,:) + real(ESMF_KIND_R8), pointer :: coordXcenter(:,:) + real(ESMF_KIND_R8), pointer :: coordYcenter(:,:) + real(ESMF_KIND_R8), pointer :: coordXcorner(:,:) + real(ESMF_KIND_R8), pointer :: coordYcorner(:,:) + integer(ESMF_KIND_I4), pointer :: gridmask(:,:) + real(ESMF_KIND_R8), pointer :: gridarea(:,:) + character(len=*),parameter :: subname='(cice_cap:InitializeRealize)' + rc = ESMF_SUCCESS + + ! We can check if npet is 4 or some other value to make sure + ! CICE is configured to run on the correct number of processors. + + ! create a Grid object for Fields + ! we are going to create a single tile displaced pole grid from a gridspec + ! file. We also use the exact decomposition in CICE so that the Fields + ! created can wrap on the data pointers in internal part of CICE + write(tmpstr,'(a,2i8)') subname//' ice nx,ny = ',nx_global,ny_global + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + +! distgrid = ESMF_DistGridCreate(minIndex=(/1,1/), maxIndex=(/nx_global,ny_global/), & +! regDecomp=(/2,2/), rc=rc) + + allocate(deBlockList(2,2,nblocks_tot)) + allocate(petMap(nblocks_tot)) + allocate(deLabelList(nblocks_tot)) + + write(tmpstr,'(a,2i8)') subname//' nblocks = ',nblocks_tot, nblocks + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + peIDCount = 0 + do n = 1, nblocks_tot + deLabelList(n) = n-1 + call get_block_parameter(n,ilo=ilo,ihi=ihi,jlo=jlo,jhi=jhi, & + i_glob=i_glob,j_glob=j_glob) +! deBlockList(1,1,n) = i_glob(ilo) +! deBlockList(1,2,n) = i_glob(ihi) +! deBlockList(2,1,n) = j_glob(jlo) +! deBlockList(2,2,n) = j_glob(jhi) + call ice_distributionGetBlockLoc(distrb_info,n,peID,locID) + if (peID > 0) then + peIDCount = peIDCount+1 + petMap(peIDCount) = peID-1 + deBlockList(1,1,peIDCount) = i_glob(ilo) + deBlockList(1,2,peIDCount) = i_glob(ihi) + deBlockList(2,1,peIDCount) = j_glob(jlo) + deBlockList(2,2,PeIDCount) = j_glob(jhi) + write(tmpstr,'(a,4i8)') subname//' ID2s = ',n,peID, locID, nblocks + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + !reducepetmappetMap(n) = max(0,peID - 1) + write(tmpstr,'(a,4i8)') subname//' IDs = ',n,peID, locID, nblocks + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + write(tmpstr,'(a,3i8)') subname//' iglo = ',n,deBlockList(1,1,peIDCount),deBlockList(1,2,peIDCount) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + write(tmpstr,'(a,3i8)') subname//' jglo = ',n,deBlockList(2,1,peIDCount),deBlockList(2,2,peIDCount) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + endif + enddo + write(tmpstr,'(a,1i8)') subname//' npeID ',peIDCount + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) +!!!TAR ADDED 141119 + delayout = ESMF_DELayoutCreate(petMap(1:peIDCount), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + +!tarnotglobal allocate(connectionList(2)) + ! bipolar boundary condition at top row: nyg +!tarnotglobal call ESMF_DistGridConnectionSet(connectionList(1), tileIndexA=1, & +!tarnotglobal tileIndexB=1, positionVector=(/nx_global+1, 2*ny_global+1/), & +!tarnotglobal orientationVector=(/-1, -2/), rc=rc) +!tarnotglobal if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & +!tarnotglobal line=__LINE__, & +!tarnotglobal file=__FILE__)) & +!tarnotglobal return ! bail out + ! periodic boundary condition along first dimension +!tarnotglobal call ESMF_DistGridConnectionSet(connectionList(2), tileIndexA=1, & +!tarnotglobal tileIndexB=1, positionVector=(/nx_global, 0/), rc=rc) +!tarnotglobal if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & +!tarnotglobal line=__LINE__, & +!tarnotglobal file=__FILE__)) & +!tarnotglobal return ! bail out + + distgrid = ESMF_DistGridCreate(minIndex=(/1,1/), maxIndex=(/nx_global,ny_global/), & +! indexflag = ESMF_INDEX_DELOCAL, & + deBlockList=deBlockList(:,:,1:peIDCount), & +! deLabelList=deLabelList, & + delayout=delayout, & +!tarnotglobal connectionList=connectionList, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + deallocate(deLabelList) + deallocate(deBlockList) + deallocate(petMap) +!tarnotglobal deallocate(connectionList) + + call ESMF_DistGridGet(distgrid=distgrid, localDE=0, elementCount=cnt, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + allocate(indexList(cnt)) + write(tmpstr,'(a,i8)') subname//' distgrid cnt= ',cnt + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + call ESMF_DistGridGet(distgrid=distgrid, localDE=0, seqIndexList=indexList, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + write(tmpstr,'(a,4i8)') subname//' distgrid list= ',indexList(1),indexList(cnt),minval(indexList), maxval(indexList) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + deallocate(IndexList) + + gridIn = ESMF_GridCreate(distgrid=distgrid, & + coordSys = ESMF_COORDSYS_SPH_DEG, & + gridEdgeLWidth=(/0,0/), gridEdgeUWidth=(/0,1/), & + rc = rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_GridAddCoord(gridIn, staggerLoc=ESMF_STAGGERLOC_CENTER, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_GridAddCoord(gridIn, staggerLoc=ESMF_STAGGERLOC_CORNER, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_GridAddItem(gridIn, itemFlag=ESMF_GRIDITEM_MASK, itemTypeKind=ESMF_TYPEKIND_I4, & + staggerLoc=ESMF_STAGGERLOC_CENTER, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_GridAddItem(gridIn, itemFlag=ESMF_GRIDITEM_AREA, itemTypeKind=ESMF_TYPEKIND_R8, & + staggerLoc=ESMF_STAGGERLOC_CENTER, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + do iblk = 1,nblocks + DE = iblk-1 + this_block = get_block(blocks_ice(iblk),iblk) + ilo = this_block%ilo + ihi = this_block%ihi + jlo = this_block%jlo + jhi = this_block%jhi + + call ESMF_GridGetCoord(gridIn, coordDim=1, localDE=DE, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + computationalLBound=lbnd, computationalUBound=ubnd, & + farrayPtr=coordXcenter, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_GridGetCoord(gridIn, coordDim=2, localDE=DE, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + farrayPtr=coordYcenter, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + write(tmpstr,'(a,5i8)') subname//' iblk center bnds ',iblk,lbnd,ubnd + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + if (lbnd(1) /= 1 .or. lbnd(2) /= 1 .or. ubnd(1) /= ihi-ilo+1 .or. ubnd(2) /= jhi-jlo+1) then + write(tmpstr,'(a,5i8)') subname//' iblk bnds ERROR ' + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, line=__LINE__, file=__FILE__, rc=dbrc) + write(tmpstr,'(a,4i8)') subname//' iblk center bnds 2',ihi, ilo, jhi,jlo + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, line=__LINE__, file=__FILE__, rc=dbrc) + rc = ESMF_FAILURE + return + endif + + call ESMF_GridGetItem(gridIn, itemflag=ESMF_GRIDITEM_MASK, localDE=DE, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + farrayPtr=gridmask, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_GridGetItem(gridIn, itemflag=ESMF_GRIDITEM_AREA, localDE=DE, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + farrayPtr=gridarea, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + do j1 = lbnd(2),ubnd(2) + do i1 = lbnd(1),ubnd(1) + i = i1 + ilo - lbnd(1) + j = j1 + jlo - lbnd(2) + coordXcenter(i1,j1) = TLON(i,j,iblk) * rad_to_deg + coordYcenter(i1,j1) = TLAT(i,j,iblk) * rad_to_deg + gridmask(i1,j1) = nint(hm(i,j,iblk)) + gridarea(i1,j1) = tarea(i,j,iblk) + enddo + enddo + + call ESMF_GridGetCoord(gridIn, coordDim=1, localDE=DE, & + staggerloc=ESMF_STAGGERLOC_CORNER, & + computationalLBound=lbnd, computationalUBound=ubnd, & + farrayPtr=coordXcorner, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_GridGetCoord(gridIn, coordDim=2, localDE=DE, & + staggerloc=ESMF_STAGGERLOC_CORNER, & + farrayPtr=coordYcorner, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + write(tmpstr,'(a,5i8)') subname//' iblk corner bnds ',iblk,lbnd,ubnd + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + + ! ULON and ULAT are upper right hand corner from TLON and TLAT + ! corners in ESMF need to be defined lon lower left corner from center + ! ULON and ULAT have ghost cells, leverage that to fill corner arrays + do j1 = lbnd(2),ubnd(2) + do i1 = lbnd(1),ubnd(1) + i = i1 + ilo - lbnd(1) + j = j1 + jlo - lbnd(2) + coordXcorner(i1,j1) = ULON(i-1,j-1,iblk) * rad_to_deg + coordYcorner(i1,j1) = ULAT(i-1,j-1,iblk) * rad_to_deg + enddo + enddo + + enddo + + call ESMF_GridGetCoord(gridIn, coordDim=1, localDE=0, & + staggerLoc=ESMF_STAGGERLOC_CENTER, farrayPtr=tarray, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + write(tmpstr,'(a,2g15.7)') subname//' gridIn center1 = ',minval(tarray),maxval(tarray) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + + call ESMF_GridGetCoord(gridIn, coordDim=2, localDE=0, & + staggerLoc=ESMF_STAGGERLOC_CENTER, farrayPtr=tarray, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + write(tmpstr,'(a,2g15.7)') subname//' gridIn center2 = ',minval(tarray),maxval(tarray) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + + call ESMF_GridGetCoord(gridIn, coordDim=1, localDE=0, & + staggerLoc=ESMF_STAGGERLOC_CORNER, farrayPtr=tarray, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + write(tmpstr,'(a,2g15.7)') subname//' gridIn corner1 = ',minval(tarray),maxval(tarray) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + + call ESMF_GridGetCoord(gridIn, coordDim=2, localDE=0, & + staggerLoc=ESMF_STAGGERLOC_CORNER, farrayPtr=tarray, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + write(tmpstr,'(a,2g15.7)') subname//' gridIn corner2 = ',minval(tarray),maxval(tarray) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + !TAR FOR NOW GRIDS ARE ASSUMED IDENTICAL. THIS MAY change at a later state. Not necessary + gridOut = gridIn ! for now out same as in +! ice_grid_i = gridIn + + call CICE_RealizeFields(importState, gridIn , fldsToIce_num, fldsToIce, "Ice import", rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call CICE_RealizeFields(exportState, gridOut, fldsFrIce_num, fldsFrIce, "Ice export", rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Import data to CICE native structures through glue fields. + call CICE_Import(importState,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + ! Export CICE native structures to data through glue fields. + CALL CICE_export(exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + write(info,*) subname,' --- initialization phase 2 completed --- ' + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, line=__LINE__, file=__FILE__, rc=dbrc) + + end subroutine + + !----------------------------------------------------------------------------- + + ! CICE model uses same clock as parent gridComp + subroutine SetClock(gcomp, rc) + type(ESMF_GridComp) :: gcomp + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_TimeInterval) :: stabilityTimeStep, timestep + character(len=*),parameter :: subname='(cice_cap:SetClock)' + + rc = ESMF_SUCCESS + ! query the Component for its clock, importState and exportState + call ESMF_GridCompGet(gcomp, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! tcraig: dt is the cice thermodynamic timestep in seconds + call ESMF_TimeIntervalSet(timestep, s=nint(dt), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockSet(clock, timestep=timestep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! initialize internal clock + ! here: parent Clock and stability timeStep determine actual model timeStep + call ESMF_TimeIntervalSet(stabilityTimeStep, s=nint(dt), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call NUOPC_CompSetClock(gcomp, clock, stabilityTimeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + end subroutine + + !----------------------------------------------------------------------------- + + subroutine ModelAdvance(gcomp, rc) + type(ESMF_GridComp) :: gcomp + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_State) :: importState, exportState + type(ESMF_Time) :: currTime + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Field) :: lfield,lfield2d + type(ESMF_Grid) :: grid + real(ESMF_KIND_R8), pointer :: fldptr(:,:,:) + real(ESMF_KIND_R8), pointer :: fldptr2d(:,:) + type(block) :: this_block + character(len=64) :: fldname + integer :: i,j,iblk,n,i1,i2,j1,j2 + integer :: ilo,ihi,jlo,jhi + real(ESMF_KIND_R8) :: ue, vn, ui, vj +! real(ESMF_KIND_R8) :: sigma_r, sigma_l, sigma_c + type(ESMF_StateItem_Flag) :: itemType + character(240) :: msgString + character(len=*),parameter :: subname='(cice_cap:ModelAdvance)' + rc = ESMF_SUCCESS + if(profile_memory) call ESMF_VMLogMemInfo("Entering CICE Model_ADVANCE: ") + write(info,*) subname,' --- run phase 1 called --- ' + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + import_slice = import_slice + 1 + export_slice = export_slice + 1 + + ! query the Component for its clock, importState and exportState + call NUOPC_ModelGet(gcomp, modelClock=clock, importState=importState, & + exportState=exportState, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + ! HERE THE MODEL ADVANCES: currTime -> currTime + timeStep + + ! Because of the way that the internal Clock was set in SetClock(), + ! its timeStep is likely smaller than the parent timeStep. As a consequence + ! the time interval covered by a single parent timeStep will result in + ! multiple calls to the ModelAdvance() routine. Every time the currTime + ! will come in by one internal timeStep advanced. This goes until the + ! stopTime of the internal Clock has been reached. + + call ESMF_ClockPrint(clock, options="currTime", & + preString="------>Advancing CICE from: ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_TimePrint(currTime + timeStep, & + preString="--------------------------------> to: ", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out +!TODO ADD LOGFOUNDERROR + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call CICE_Import(importState,rc) + if (esmf_write_diagnostics >0) then + if (mod(import_slice,esmf_write_diagnostics)==0) then + call nuopc_write(state=importState,filenamePrefix='Import_CICE', & + timeslice=import_slice/esmf_write_diagnostics,rc=rc) + endif + endif ! write_diagnostics + write(info,*) subname,' --- run phase 2 called --- ' + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + if(profile_memory) call ESMF_VMLogMemInfo("Before CICE_Run") + call CICE_Run + + if(profile_memory) call ESMF_VMLogMemInfo("After CICE_Run") + write(info,*) subname,' --- run phase 3 called --- ' + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + + !---- local modifications to coupling fields ----- + call CICE_Export(exportState,rc=rc) + if (esmf_write_diagnostics >0) then + if (mod(export_slice,esmf_write_diagnostics)==0) then + call nuopc_write(state=exportState,filenamePrefix='Export_CICE', & + timeslice=export_slice/esmf_write_diagnostics,rc=rc) + endif + endif + !------------------------------------------------- + + !call state_diagnose(exportState, 'cice_export', rc) + write(info,*) subname,' --- run phase 4 called --- ',rc + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + if(profile_memory) call ESMF_VMLogMemInfo("Leaving CICE Model_ADVANCE: ") + end subroutine + + subroutine cice_model_finalize(gcomp, rc) + + ! input arguments + type(ESMF_GridComp) :: gcomp + integer, intent(out) :: rc + + ! local variables + type(ESMF_Clock) :: clock + type(ESMF_Time) :: currTime + character(len=*),parameter :: subname='(cice_cap:cice_model_finalize)' + + rc = ESMF_SUCCESS + + write(info,*) subname,' --- finalize called --- ' + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + + call NUOPC_ModelGet(gcomp, modelClock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call ESMF_ClockGet(clock, currTime=currTime, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call CICE_Finalize + + write(info,*) subname,' --- finalize completed --- ' + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + + end subroutine cice_model_finalize + + subroutine CICE_AdvertiseFields(state, nfields, field_defs, rc) + + type(ESMF_State), intent(inout) :: state + integer,intent(in) :: nfields + type(fld_list_type), intent(inout) :: field_defs(:) + integer, intent(inout) :: rc + + integer :: i + character(len=*),parameter :: subname='(cice_cap:CICE_AdvertiseFields)' + + rc = ESMF_SUCCESS + !write(6,*) nfields + do i = 1, nfields + if (.not. NUOPC_FieldDictionaryHasEntry(trim(field_defs(i)%stdname))) then + write(6,*) trim(field_defs(i)%stdname), trim(field_defs(i)%canonicalUnits) + call NUOPC_FieldDictionaryAddEntry( & + standardName=trim(field_defs(i)%stdname), & + canonicalUnits=trim(field_defs(i)%canonicalUnits), & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + endif + + call ESMF_LogWrite('Advertise: '//trim(field_defs(i)%stdname), ESMF_LOGMSG_INFO, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + call NUOPC_Advertise(state, & + standardName=field_defs(i)%stdname, & + name=field_defs(i)%shortname, & + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + + enddo + call flush(6) + + end subroutine CICE_AdvertiseFields + + subroutine CICE_RealizeFields(state, grid, nfields, field_defs, tag, rc) + + type(ESMF_State), intent(inout) :: state + type(ESMF_Grid), intent(in) :: grid + integer, intent(in) :: nfields + type(fld_list_type), intent(inout) :: field_defs(:) + character(len=*), intent(in) :: tag + integer, intent(inout) :: rc + + integer :: i + type(ESMF_Field) :: field + integer :: npet, nx, ny, pet, elb(2), eub(2), clb(2), cub(2), tlb(2), tub(2) + type(ESMF_VM) :: vm + character(len=*),parameter :: subname='(cice_cap:CICE_RealizeFields)' + + rc = ESMF_SUCCESS + + do i = 1, nfields + if (field_defs(i)%assoc) then + write(info, *) subname, tag, ' Field ', field_defs(i)%shortname, ':', & + lbound(field_defs(i)%farrayPtr,1), ubound(field_defs(i)%farrayPtr,1), & + lbound(field_defs(i)%farrayPtr,2), ubound(field_defs(i)%farrayPtr,2), & + lbound(field_defs(i)%farrayPtr,3), ubound(field_defs(i)%farrayPtr,3) + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + field = ESMF_FieldCreate(grid=grid, & + farray=field_defs(i)%farrayPtr, indexflag=ESMF_INDEX_DELOCAL, & + ungriddedLBound=(/1/), ungriddedUBound=(/max_blocks/), & + name=field_defs(i)%shortname, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + else + field = ESMF_FieldCreate(grid, ESMF_TYPEKIND_R8, indexflag=ESMF_INDEX_DELOCAL, & + ungriddedLBound=(/1/), ungriddedUBound=(/max_blocks/), & + name=field_defs(i)%shortname, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + endif + + if (NUOPC_IsConnected(state, fieldName=field_defs(i)%shortname)) then + call NUOPC_Realize(state, field=field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + call ESMF_LogWrite(subname // tag // " Field "// field_defs(i)%stdname // " is connected.", & + ESMF_LOGMSG_INFO, & + line=__LINE__, & + file=__FILE__, & + rc=dbrc) + else + call ESMF_LogWrite(subname // tag // " Field "// field_defs(i)%stdname // " is not connected.", & + ESMF_LOGMSG_INFO, & + line=__LINE__, & + file=__FILE__, & + rc=dbrc) + ! TODO: Initialize the value in the pointer to 0 after proper restart is setup + !if(associated(field_defs(i)%farrayPtr) ) field_defs(i)%farrayPtr = 0.0 + ! remove a not connected Field from State + call ESMF_StateRemove(state, (/field_defs(i)%shortname/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + endif + + enddo + + + end subroutine CICE_RealizeFields + + !----------------------------------------------------------------------------- + + + !----------------------------------------------------------------------------- + + + !----------------------------------------------------------------------------- + + subroutine State_GetFldPtr(ST, fldname, fldptr, rc) + type(ESMF_State), intent(in) :: ST + character(len=*), intent(in) :: fldname + real(ESMF_KIND_R8), pointer, intent(in) :: fldptr(:,:,:) + integer, intent(out), optional :: rc + + ! local variables + type(ESMF_Field) :: lfield + integer :: lrc + character(len=*),parameter :: subname='(cice_cap:State_GetFldPtr)' + + call ESMF_StateGet(ST, itemName=trim(fldname), field=lfield, rc=lrc) + if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_FieldGet(lfield, farrayPtr=fldptr, rc=lrc) + if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + if (present(rc)) rc = lrc + + end subroutine State_GetFldPtr + + subroutine CICE_FieldsSetup + character(len=*),parameter :: subname='(cice_cap:CICE_FieldsSetup)' + +!--------- import fields to Sea Ice ------------- + !tartmpwrite(6,*) subname +! tcraig, don't point directly into cice data YET (last field is optional in interface) +! instead, create space for the field when it's "realized". +!TODO REMOVE FIELDS NOT USED TAR +! WILL PROVIDE means that field has its own grid. Can be changed to accept grid from outside + call fld_list_add(fldsToIce_num, fldsToIce, "sea_surface_temperature" ,"K" , "will provide") + call fld_list_add(fldsToIce_num, fldsToIce, "sea_surface_salinity" ,"1" , "will provide") + call fld_list_add(fldsToIce_num, fldsToIce, "sea_level" ,"m" , "will provide") + call fld_list_add(fldsToIce_num, fldsToIce, "sea_surface_slope_zonal" ,"1" , "will provide") + call fld_list_add(fldsToIce_num, fldsToIce, "sea_surface_slope_merid" ,"1" , "will provide") + call fld_list_add(fldsToIce_num, fldsToIce, "ocn_current_zonal" ,"m/s" , "will provide") + call fld_list_add(fldsToIce_num, fldsToIce, "ocn_current_merid" ,"m/s" , "will provide") + call fld_list_add(fldsToIce_num, fldsToIce, "freezing_melting_potential" ,"1" , "will provide") + call fld_list_add(fldsToIce_num, fldsToIce, "mixed_layer_depth" ,"m" , "will provide") +! fields for export + call fld_list_add(fldsFrIce_num, fldsFrIce, "sea_ice_fraction" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "stress_on_ocn_ice_zonal" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "stress_on_ocn_ice_merid" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "sea_ice_temperature" ,"1" , "will provide") +! call fld_list_add(fldsFrIce_num, fldsFrIce, "ice_mask" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "mean_sw_pen_to_ocn" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "mean_fresh_water_to_ocean_rate" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "mean_salt_rate" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "net_heat_flx_to_ocn" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "mean_ice_volume" ,"1" , "will provide") + call fld_list_add(fldsFrIce_num, fldsFrIce, "mean_snow_volume" ,"1" , "will provide") + + end subroutine CICE_FieldsSetup + + !----------------------------------------------------------------------------- + + subroutine fld_list_add(num, fldlist, stdname, canonicalUnits, transferOffer, data, shortname) + ! ---------------------------------------------- + ! Set up a list of field information + ! ---------------------------------------------- + integer, intent(inout) :: num + type(fld_list_type), intent(inout) :: fldlist(:) + character(len=*), intent(in) :: stdname + character(len=*), intent(in) :: canonicalUnits + character(len=*), intent(in) :: transferOffer + real(ESMF_KIND_R8), dimension(:,:,:), optional, target :: data + character(len=*), intent(in),optional :: shortname + + ! local variables + integer :: rc + character(len=*), parameter :: subname='(cice_cap:fld_list_add)' + ! fill in the new entry + + num = num + 1 + if (num > fldsMax) then + call ESMF_LogWrite(trim(subname)//": ERROR num gt fldsMax "//trim(stdname), & + ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__, rc=dbrc) + return + endif + + fldlist(num)%stdname = trim(stdname) + fldlist(num)%canonicalUnits = trim(canonicalUnits) + if (present(shortname)) then + fldlist(num)%shortname = trim(shortname) + else + fldlist(num)%shortname = trim(stdname) + endif + fldlist(num)%transferOffer = trim(transferOffer) + if (present(data)) then + fldlist(num)%assoc = .true. + fldlist(num)%farrayPtr => data + else + fldlist(num)%assoc = .false. + endif + + end subroutine fld_list_add + + !----------------------------------------------------------------------------- + subroutine CICE_Import(st,rc) + type(ESMF_State) :: st + logical :: initflag + integer, intent(out) :: rc + real(kind=ESMF_KIND_R8), pointer :: dataPtr_sst(:,:,:) + real(kind=ESMF_KIND_R8), pointer :: dataPtr_sss(:,:,:) + real(kind=ESMF_KIND_R8), pointer :: dataPtr_ssh(:,:,:) + real(kind=ESMF_KIND_R8), pointer :: dataPtr_sssz(:,:,:) + real(kind=ESMF_KIND_R8), pointer :: dataPtr_sssm(:,:,:) + real(kind=ESMF_KIND_R8), pointer :: dataPtr_ocncz(:,:,:) + real(kind=ESMF_KIND_R8), pointer :: dataPtr_ocncm(:,:,:) + real(kind=ESMF_KIND_R8), pointer :: dataPtr_fmpot(:,:,:) + real(kind=ESMF_KIND_R8), pointer :: dataPtr_mld(:,:,:) + integer :: ilo,ihi,jlo,jhi + integer :: i,j,iblk,n,i1,i2,j1,j2 + real(kind=ESMF_KIND_R8) :: ue, vn, AngT_s + type(block) :: this_block + character(len=*),parameter :: subname='(cice_cap:CICE_Import)' + + call State_getFldPtr(st,'sea_surface_temperature',dataPtr_sst,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'sea_surface_salinity',dataPtr_sss,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'sea_level',dataPtr_ssh,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'sea_surface_slope_zonal',dataPtr_sssz,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'sea_surface_slope_merid',dataPtr_sssm,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'ocn_current_zonal',dataPtr_ocncz,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'ocn_current_merid',dataPtr_ocncm,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'freezing_melting_potential',dataPtr_fmpot,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'mixed_layer_depth',dataPtr_mld,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + do iblk = 1,nblocks + this_block = get_block(blocks_ice(iblk),iblk) + ilo = this_block%ilo + ihi = this_block%ihi + jlo = this_block%jlo + jhi = this_block%jhi + do j = jlo,jhi + do i = ilo,ihi + i1 = i - ilo + 1 + j1 = j - jlo + 1 + sss (i,j,iblk) = dataPtr_sss (i1,j1,iblk) ! sea surface salinity (maybe for mushy layer) + sst (i,j,iblk) = dataPtr_sst (i1,j1,iblk) - Tffresh ! sea surface temp (may not be needed?) + + frzmlt (i,j,iblk) = dataPtr_fmpot (i1,j1,iblk) + ue = dataPtr_ocncz (i1,j1,iblk) + vn = dataPtr_ocncm (i1,j1,iblk) + AngT_s = ANGLET(i,j,iblk) + uocn (i,j,iblk) = ue*cos(AngT_s) - vn*sin(AngT_s) + vocn (i,j,iblk) = ue*sin(AngT_s) + vn*cos(AngT_s) + ue = dataPtr_sssz (i1,j1,iblk) + vn = dataPtr_sssm (i1,j1,iblk) + ss_tltx(i,j,iblk) = ue*cos(AngT_s) - vn*sin(AngT_s) + ss_tlty(i,j,iblk) = ue*sin(AngT_s) + vn*cos(AngT_s) + enddo + enddo + call t2ugrid_vector(ss_tltx) + call t2ugrid_vector(ss_tlty) + call t2ugrid_vector(uocn) + call t2ugrid_vector(vocn) + enddo + + end subroutine + subroutine CICE_Export(st,rc) + type(ESMF_State) :: st + integer, intent(out) :: rc +! real(ESMF_KIND_R8), pointer :: dataPtr_mask(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_ifrac(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_itemp(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_strocnxT(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_strocnyT(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_fhocn(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_fresh(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_fsalt(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_vice(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_vsno(:,:,:) + real(ESMF_KIND_R8), pointer :: dataPtr_fswthru(:,:,:) + + integer :: ilo,ihi,jlo,jhi + integer :: i,j,iblk,n,i1,i2,j1,j2 + real(kind=ESMF_KIND_R8) :: ui, vj, angT + + type(block) :: this_block + character(len=*),parameter :: subname='(cice_cap:CICE_Export)' +!TODO clean up fields +! call State_getFldPtr(st,'ice_mask',dataPtr_mask,rc=rc) +! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'sea_ice_fraction',dataPtr_ifrac,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'sea_ice_temperature',dataPtr_itemp,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'stress_on_ocn_ice_zonal',dataPtr_strocnxT,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'stress_on_ocn_ice_merid',dataPtr_strocnyT,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'net_heat_flx_to_ocn',dataPtr_fhocn,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'mean_fresh_water_to_ocean_rate',dataPtr_fresh,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'mean_salt_rate',dataPtr_fsalt,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'mean_ice_volume',dataPtr_vice,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'mean_snow_volume',dataPtr_vsno,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + call State_getFldPtr(st,'mean_sw_pen_to_ocn',dataPtr_fswthru,rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) return + + write(info, *) subname//' ifrac size :', & + lbound(dataPtr_ifrac,1), ubound(dataPtr_ifrac,1), & + lbound(dataPtr_ifrac,2), ubound(dataPtr_ifrac,2), & + lbound(dataPtr_ifrac,3), ubound(dataPtr_ifrac,3) + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + dataPtr_ifrac = 0._ESMF_KIND_R8 + dataPtr_itemp = 0._ESMF_KIND_R8 +! dataPtr_mask = 0._ESMF_KIND_R8 + call ESMF_LogWrite(info, ESMF_LOGMSG_INFO, rc=dbrc) + do iblk = 1,nblocks + this_block = get_block(blocks_ice(iblk),iblk) + ilo = this_block%ilo + ihi = this_block%ihi + jlo = this_block%jlo + jhi = this_block%jhi + do j = jlo,jhi + do i = ilo,ihi + i1 = i - ilo + 1 + j1 = j - jlo + 1 +! if (hm(i,j,iblk) > 0.5) dataPtr_mask(i1,j1,iblk) = 1._ESMF_KIND_R8 + dataPtr_ifrac (i1,j1,iblk) = aice(i,j,iblk) ! ice fraction (0-1) + dataPtr_fhocn (i1,j1,iblk) = fhocn(i,j,iblk) ! heat exchange with ocean + dataPtr_fresh (i1,j1,iblk) = fresh(i,j,iblk) ! fresh water to ocean + dataPtr_fsalt (i1,j1,iblk) = fsalt(i,j,iblk) ! salt to ocean + dataPtr_vice (i1,j1,iblk) = vice(i,j,iblk) ! sea ice volume + dataPtr_vsno (i1,j1,iblk) = vsno(i,j,iblk) ! snow volume + dataPtr_fswthru (i1,j1,iblk) = fswthru(i,j,iblk) ! short wave penetration through ice + ui = strocnxT(i,j,iblk) + vj = strocnyT(i,j,iblk) + angT = ANGLET(i,j,iblk) + dataPtr_strocnxT(i1,j1,iblk) = ui*cos(-angT) + vj*sin(angT) ! ice ocean stress + dataPtr_strocnyT(i1,j1,iblk) = -ui*sin(angT) + vj*cos(-angT) ! ice ocean stress + enddo + enddo + enddo +! write(tmpstr,*) subname//' mask = ',minval(dataPtr_mask),maxval(dataPtr_mask) +! call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO, rc=dbrc) + + + + end subroutine + +end module cice_cap diff --git a/cicecore/shared/ice_init_column.F90 b/cicecore/shared/ice_init_column.F90 index fbcc8413b..9e4838087 100644 --- a/cicecore/shared/ice_init_column.F90 +++ b/cicecore/shared/ice_init_column.F90 @@ -785,7 +785,7 @@ subroutine init_bgc() if (solve_zsal) then ! default values - !$OMP PARALLEL DO PRIVATE(iblk,i,j,n,ilo,ihi,jlo,jhi,this_block) + !$OMP PARALLEL DO PRIVATE(iblk,i,j,k,n,ilo,ihi,jlo,jhi,this_block,trcrn_bgc) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -816,6 +816,7 @@ subroutine init_bgc() enddo ! i enddo ! j enddo ! iblk + !$OMP END PARALLEL DO call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -855,6 +856,7 @@ subroutine init_bgc() enddo ! j enddo ! iblk + !$OMP END PARALLEL DO call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -865,7 +867,7 @@ subroutine init_bgc() endif ! .not. restart - !$OMP PARALLEL DO PRIVATE(iblk,i,j,n,ilo,ihi,jlo,jhi,this_block) + !$OMP PARALLEL DO PRIVATE(iblk,i,j,k,n,ilo,ihi,jlo,jhi,this_block,sicen,trcrn_bgc) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -900,6 +902,7 @@ subroutine init_bgc() enddo ! j enddo ! iblk + !$OMP END PARALLEL DO call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -925,6 +928,7 @@ subroutine init_bgc() enddo ! i enddo ! j enddo ! iblk + !$OMP END PARALLEL DO call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -1937,6 +1941,7 @@ subroutine count_tracers nbtrcr = 0 nbtrcr_sw = 0 + nt_zbgc_frac = 0 ! vectors of size icepack_max_algae nlt_bgc_N(:) = 0 @@ -2184,7 +2189,6 @@ subroutine count_tracers enddo ! mm endif ! tr_zaero - nt_zbgc_frac = 0 if (nbtrcr > 0) then nt_zbgc_frac = ntrcr + 1 ntrcr = ntrcr + nbtrcr diff --git a/cicecore/shared/ice_restart_column.F90 b/cicecore/shared/ice_restart_column.F90 index e830dd50b..e819b1098 100644 --- a/cicecore/shared/ice_restart_column.F90 +++ b/cicecore/shared/ice_restart_column.F90 @@ -809,6 +809,7 @@ subroutine read_restart_hbrine() enddo ! i enddo ! j enddo ! iblk + !$OMP END PARALLEL DO end subroutine read_restart_hbrine @@ -868,6 +869,7 @@ subroutine write_restart_hbrine() enddo ! i enddo ! j enddo ! iblk + !$OMP END PARALLEL DO call write_restart_field(nu_dump_hbrine,0,trcrn(:,:,nt_fbri,:,:),'ruf8', & 'fbrn',ncat,diag) @@ -997,6 +999,7 @@ subroutine write_restart_bgc() enddo enddo enddo + !$OMP END PARALLEL DO call write_restart_field(nu_dump_bgc,0,Rayleigh_real,'ruf8','Rayleigh',1,diag) @@ -1411,7 +1414,8 @@ subroutine read_restart_bgc() endif enddo enddo - enddo + enddo ! iblk + !$OMP END PARALLEL DO endif ! restart_zsal !----------------------------------------------------------------- diff --git a/cicecore/version.txt b/cicecore/version.txt index 18921f221..43f856223 100644 --- a/cicecore/version.txt +++ b/cicecore/version.txt @@ -1 +1 @@ -CICE 6.1.1 +CICE 6.1.2 diff --git a/configuration/scripts/Makefile b/configuration/scripts/Makefile index 88a5030d1..7b39d5c8d 100644 --- a/configuration/scripts/Makefile +++ b/configuration/scripts/Makefile @@ -16,7 +16,8 @@ # # Usage examples: # % gmake -j 8 VPFILE=Filepath EXEC=${ICE_RUNDIR}/cice \ -# -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.conrad_intel +# -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.conrad_intel \ +# DEPFILE=${ICE_CASEDIR}/makdep.c cice #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- @@ -25,6 +26,7 @@ EXEC := a.out MACFILE := NONE +DEPFILE := NONE MODEL := NONE VPFILE := NONE VPATH := . @@ -33,6 +35,13 @@ SRCS := NONE # dependency generator DEPGEN := ./makdep +OBJS_DEPGEN := $(DEPFILE) + +ifneq ($(ESMFMKFILE),) + -include $(ESMFMKFILE) + INCLDIR += $(ESMF_F90COMPILEPATHS) + SLIBS += $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) +endif ifneq ($(VPATH),.) # this variable was specified on cmd line or in an env var @@ -59,14 +68,14 @@ endif OBJS := $(addsuffix .o, $(sort $(basename $(notdir $(SRCS))))) DEPS := $(addsuffix .d, $(sort $(basename $(notdir $(SRCS))))) INCS := $(patsubst %,-I%, $(VPATH) ) -OBJS_DEPGEN := $(addprefix $(ICE_CASEDIR)/,$(addsuffix .c, $(notdir $(DEPGEN)))) MODDIR:= -I. RM := rm +AR := ar .SUFFIXES: .SUFFIXES: .F90 .F .c .o -.PHONY: all cice targets target db_files db_flags clean realclean +.PHONY: all cice libcice targets target db_files db_flags clean realclean all: $(EXEC) cice: $(EXEC) @@ -83,7 +92,7 @@ cice: $(EXEC) targets: @echo " " - @echo "Supported Makefile Targets are: cice, makdep, depends, clean, realclean, targets, db_files, db_flags" + @echo "Supported Makefile Targets are: cice, libcice, makdep, depends, clean, realclean, targets, db_files, db_flags" target: targets db_files: @@ -100,6 +109,7 @@ db_files: @echo "* ULIBS := $(ULIBS)" @echo "* SLIBS := $(SLIBS)" @echo "* INCLDIR := $(INCLDIR)" + @echo "* DEPFILE := $(DEPFILE)" @echo "* OBJS_DEPGEN := $(OBJS_DEPGEN)" db_flags: @echo " " @@ -112,6 +122,7 @@ db_flags: @echo "* .c.o := $(CC) $(CFLAGS) $(CPPDEFS) $(INCLDIR)" @echo "* .F.o := $(FC) -c $(FFLAGS) $(FIXEDFLAGS) $(CPPDEFS) $(INCLDIR)" @echo "* .F90.o := $(FC) -c $(FFLAGS) $(FREEFLAGS) $(CPPDEFS) $(MODDIR) $(INCLDIR)" + @echo "* libcice := $(AR) -r $(EXEC) " @echo "* $(notdir $(EXEC)) := $(LD) $(LDFLAGS) $(ULIBS) $(SLIBS)" #------------------------------------------------------------------------------- @@ -130,6 +141,10 @@ $(DEPGEN): $(OBJS_DEPGEN) $(EXEC): $(OBJS) $(LD) -o $(EXEC) $(LDFLAGS) $(OBJS) $(ULIBS) $(SLIBS) +libcice: $(OBJS) + @ echo "$(AR) -r $(EXEC) $(OBJS)" + $(AR) -r $(EXEC) $(OBJS) + .c.o: $(CC) $(CFLAGS) $(CPPDEFS) $(INCLDIR) $< diff --git a/configuration/scripts/cice.batch.csh b/configuration/scripts/cice.batch.csh index 07e6d86ec..54a2be711 100755 --- a/configuration/scripts/cice.batch.csh +++ b/configuration/scripts/cice.batch.csh @@ -1,4 +1,4 @@ -#! /bin/csh -f +#!/bin/csh -f if ( $1 != "" ) then echo "running cice.batch.csh (creating ${1})" @@ -91,7 +91,7 @@ cat >> ${jobfile} << EOFB #PBS -l walltime=${batchtime} EOFB -else if (${ICE_MACHINE} =~ thunder* || ${ICE_MACHINE} =~ gordon* || ${ICE_MACHINE} =~ conrad* || ${ICE_MACHINE} =~ gaffney* || ${ICE_MACHINE} =~ koehr*) then +else if (${ICE_MACHINE} =~ gordon* || ${ICE_MACHINE} =~ conrad* || ${ICE_MACHINE} =~ gaffney* || ${ICE_MACHINE} =~ koehr* || ${ICE_MACHINE} =~ mustang) then cat >> ${jobfile} << EOFB #PBS -N ${shortcase} #PBS -q ${queue} @@ -99,6 +99,7 @@ cat >> ${jobfile} << EOFB #PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} #PBS -l walltime=${batchtime} #PBS -j oe +#PBS -W umask=022 ###PBS -M username@domain.com ###PBS -m be EOFB @@ -145,18 +146,6 @@ cat >> ${jobfile} << EOFB #SBATCH --qos=standby EOFB -else if (${ICE_MACHINE} =~ loft*) then -cat >> ${jobfile} << EOFB -#PBS -N ${shortcase} -#PBS -q ${queue} -#PBS -A ${acct} -#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} -#PBS -l walltime=${batchtime} -#PBS -j oe -###PBS -M username@domain.com -###PBS -m be -EOFB - else if (${ICE_MACHINE} =~ fram*) then cat >> ${jobfile} << EOFB #SBATCH -J ${ICE_CASENAME} diff --git a/configuration/scripts/cice.build b/configuration/scripts/cice.build index 1729c52e6..b51484201 100755 --- a/configuration/scripts/cice.build +++ b/configuration/scripts/cice.build @@ -1,4 +1,4 @@ -#! /bin/csh -f +#!/bin/csh -f #==================================== # If the cice binary is passed via the --exe argument and the file exists, @@ -96,12 +96,12 @@ endif source ./cice.settings source ${ICE_CASEDIR}/env.${ICE_MACHCOMP} || exit 2 -if (${ICE_MACHINE} != ${ICE_MACHINE_ENVNAME}) then - echo "WARNING, is ICE_MACHINE setting OK, ${ICE_MACHINE}, ${ICE_MACHINE_ENVNAME}" +if (${ICE_MACHINE} != ${ICE_MACHINE_MACHNAME}) then + echo "WARNING, is ICE_MACHINE setting OK, ${ICE_MACHINE}, ${ICE_MACHINE_MACHNAME}" endif -if (${ICE_COMPILER} != ${ICE_MACHINE_COMPILER}) then - echo "WARNING, is ICE_COMPILER setting OK, ${ICE_COMPILER}, ${ICE_MACHINE_COMPILER}" +if (${ICE_ENVNAME} != ${ICE_MACHINE_ENVNAME}) then + echo "WARNING, is ICE_ENVNAME setting OK, ${ICE_ENVNAME}, ${ICE_MACHINE_ENVNAME}" endif echo " " @@ -145,7 +145,8 @@ endif if (${directmake} == 1) then echo "make ${target}" ${ICE_MACHINE_MAKE} -j ${ICE_MACHINE_BLDTHRDS} VPFILE=Filepath EXEC=${ICE_RUNDIR}/cice \ - -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} ${target} + -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} \ + DEPFILE=${ICE_CASEDIR}/makdep.c ${target} set bldstat = ${status} if (${bldstat} != 0) then echo "${0}: targeted make FAILED" @@ -170,10 +171,12 @@ if (${ICE_CLEANBUILD} == 'true') then echo "gmake clean" if (${quiet} == "true") then ${ICE_MACHINE_MAKE} VPFILE=Filepath EXEC=${ICE_RUNDIR}/cice \ - -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} clean >& ${ICE_BLDLOG_FILE} + -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} \ + DEPFILE=${ICE_CASEDIR}/makdep.c clean >& ${ICE_BLDLOG_FILE} else ${ICE_MACHINE_MAKE} VPFILE=Filepath EXEC=${ICE_RUNDIR}/cice \ - -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} clean |& tee ${ICE_BLDLOG_FILE} + -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} \ + DEPFILE=${ICE_CASEDIR}/makdep.c clean |& tee ${ICE_BLDLOG_FILE} endif endif @@ -181,11 +184,13 @@ echo "gmake cice" if (${quiet} == "true") then echo " quiet mode on... patience" ${ICE_MACHINE_MAKE} -j ${ICE_MACHINE_BLDTHRDS} VPFILE=Filepath EXEC=${ICE_RUNDIR}/cice \ - -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} >& ${ICE_BLDLOG_FILE} + -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} \ + DEPFILE=${ICE_CASEDIR}/makdep.c cice >& ${ICE_BLDLOG_FILE} set bldstat = ${status} else ${ICE_MACHINE_MAKE} -j ${ICE_MACHINE_BLDTHRDS} VPFILE=Filepath EXEC=${ICE_RUNDIR}/cice \ - -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} |& tee ${ICE_BLDLOG_FILE} + -f ${ICE_CASEDIR}/Makefile MACFILE=${ICE_CASEDIR}/Macros.${ICE_MACHCOMP} \ + DEPFILE=${ICE_CASEDIR}/makdep.c cice |& tee ${ICE_BLDLOG_FILE} set bldstat = ${status} endif diff --git a/configuration/scripts/cice.launch.csh b/configuration/scripts/cice.launch.csh index 297f1df39..dfbffd6ab 100755 --- a/configuration/scripts/cice.launch.csh +++ b/configuration/scripts/cice.launch.csh @@ -1,4 +1,4 @@ -#! /bin/csh -f +#!/bin/csh -f #echo ${0} echo "running cice.launch.csh" @@ -46,19 +46,7 @@ EOFR endif #======= -else if (${ICE_MACHINE} =~ thunder*) then -if (${ICE_COMMDIR} =~ serial*) then -cat >> ${jobfile} << EOFR -./cice >&! \$ICE_RUNLOG_FILE -EOFR -else -cat >> ${jobfile} << EOFR -mpiexec_mpt -np ${ntasks} omplace ./cice >&! \$ICE_RUNLOG_FILE -EOFR -endif - -#======= -else if (${ICE_MACHINE} =~ gaffney* || ${ICE_MACHINE} =~ koehr*) then +else if (${ICE_MACHINE} =~ gaffney* || ${ICE_MACHINE} =~ koehr* || ${ICE_MACHINE} =~ mustang*) then if (${ICE_COMMDIR} =~ serial*) then cat >> ${jobfile} << EOFR ./cice >&! \$ICE_RUNLOG_FILE @@ -105,17 +93,6 @@ mpirun -np ${ntasks} ./cice >&! \$ICE_RUNLOG_FILE EOFR endif -#======= -else if (${ICE_MACHINE} =~ loft*) then -if (${ICE_COMMDIR} =~ serial*) then -cat >> ${jobfile} << EOFR -./cice >&! \$ICE_RUNLOG_FILE -EOFR -else -cat >> ${jobfile} << EOFR -aprun -n ${ntasks} -N ${taskpernodelimit} -d ${nthrds} ./cice >&! \$ICE_RUNLOG_FILE -EOFR -endif #======= else if (${ICE_MACHINE} =~ fram*) then if (${ICE_COMMDIR} =~ serial*) then diff --git a/configuration/scripts/cice.run.setup.csh b/configuration/scripts/cice.run.setup.csh index 2134d345c..901671a36 100755 --- a/configuration/scripts/cice.run.setup.csh +++ b/configuration/scripts/cice.run.setup.csh @@ -1,4 +1,4 @@ -#! /bin/csh -f +#!/bin/csh -f #echo ${0} echo "running cice.run.setup.csh" diff --git a/configuration/scripts/cice.settings b/configuration/scripts/cice.settings index 19b695ba1..d2653a29d 100755 --- a/configuration/scripts/cice.settings +++ b/configuration/scripts/cice.settings @@ -1,9 +1,9 @@ -#! /bin/csh -f +#!/bin/csh -f setenv ICE_CASENAME undefined setenv ICE_SANDBOX undefined setenv ICE_MACHINE undefined -setenv ICE_COMPILER undefined +setenv ICE_ENVNAME undefined setenv ICE_MACHCOMP undefined setenv ICE_SCRIPTS undefined setenv ICE_CASEDIR undefined @@ -41,5 +41,5 @@ if (${ICE_NTASKS} == 1) setenv ICE_COMMDIR serial ### Specialty code setenv ICE_BLDDEBUG false # build debug flags -setenv ICE_CODECOV false # build debug flags +setenv ICE_COVERAGE false # build debug flags diff --git a/configuration/scripts/cice.test.setup.csh b/configuration/scripts/cice.test.setup.csh index 535a2ac06..536d5e088 100755 --- a/configuration/scripts/cice.test.setup.csh +++ b/configuration/scripts/cice.test.setup.csh @@ -1,4 +1,4 @@ -#! /bin/csh -f +#!/bin/csh -f #source ./cice.settings #source ${ICE_CASEDIR}/env.${ICE_MACHCOMP} || exit 2 diff --git a/configuration/scripts/forapps/ufs/comp_ice.backend.clean b/configuration/scripts/forapps/ufs/comp_ice.backend.clean new file mode 100755 index 000000000..7eef2ed1a --- /dev/null +++ b/configuration/scripts/forapps/ufs/comp_ice.backend.clean @@ -0,0 +1,42 @@ +#! /bin/csh -f + +### Expect to find the following environment variables set on entry: +# SITE +# SYSTEM_USERDIR +# SRCDIR +# EXEDIR + +setenv OBJDIR $EXEDIR/compile ; if !(-d $OBJDIR) mkdir -p $OBJDIR + +if (${SITE} =~ cheyenne*) then + setenv ARCH cheyenne_intel +#else if (${SITE} =~ Orion*) then +# setenv ARCH orion_intel +#else if (${SITE} =~ hera*) then +# setenv ARCH hera_intel +else + echo "CICE6 ${0}: ERROR in ARCH setup, ${hname}" + exit -2 +endif + +echo "CICE6 ${0}: ARCH = $ARCH" + +cd $OBJDIR + +setenv MAKENAME gmake +setenv MAKETHRDS 1 +setenv MAKEFILE ${SRCDIR}/configuration/scripts/Makefile +setenv MACROSFILE ${SRCDIR}/configuration/scripts/machines/Macros.$ARCH + +echo "CICE6 ${0}: EXEDIR = ${EXEDIR}" +echo "CICE6 ${0}: OBJDIR = ${OBJDIR}" +echo "CICE6 ${0}: MAKEFILE = ${MAKEFILE}" +echo "CICE6 ${0}: MACROSFILE = ${MACROSFILE}" +echo "CICE6 ${0}: ESMFMKFILE = ${ESMFMKFILE}" + +#clean +${MAKENAME} EXEC=${OBJDIR}/libcice6.a \ + -f ${MAKEFILE} MACFILE=${MACROSFILE} clean + +#clean install +rm -r -f ${BINDIR} diff --git a/configuration/scripts/forapps/ufs/comp_ice.backend.libcice b/configuration/scripts/forapps/ufs/comp_ice.backend.libcice new file mode 100755 index 000000000..eb1b8a4e7 --- /dev/null +++ b/configuration/scripts/forapps/ufs/comp_ice.backend.libcice @@ -0,0 +1,142 @@ +#! /bin/csh -f + +### Expect to find the following environment variables set on entry: +# SITE +# SYSTEM_USERDIR +# SRCDIR +# EXEDIR + +### local variable that begin with ICE_ are needed in the Macros file +# ICE_COMMDIR +# ICE_BLDDEBUG +# ICE_THREADED +# ICE_CPPDEFS + +setenv OBJDIR $EXEDIR/compile ; if !(-d $OBJDIR) mkdir -p $OBJDIR + +setenv THRD no # set to yes for OpenMP threading + +if (${SITE} =~ cheyenne*) then + setenv ARCH cheyenne_intel +#else if (${SITE} =~ Orion*) then +# setenv ARCH orion_intel +#else if (${SITE} =~ hera*) then +# setenv ARCH hera_intel +else + echo "CICE6 ${0}: ERROR in ARCH setup, ${hname}" + exit -2 +endif + +echo "CICE6 ${0}: ARCH = $ARCH" + +cd $OBJDIR + +setenv SHRDIR csm_share # location of CCSM shared code +setenv DRVDIR nuopc/cmeps + +#if ($NTASK == 1) then +# setenv ICE_COMMDIR serial +#else + setenv ICE_COMMDIR mpi +#endif + +if ($THRD == 'yes') then + setenv ICE_THREADED true +else + setenv ICE_THREADED false +endif + +if ($?ICE_CPPDEFS) then + setenv ICE_CPPDEFS "${ICE_CPPDEFS} -Dcoupled" +else + setenv ICE_CPPDEFS "-Dcoupled" +endif + +if !($?IO_TYPE) then + setenv IO_TYPE netcdf4 # set to none if netcdf library is unavailable +endif +if ($IO_TYPE == 'netcdf3' || $IO_TYPE == 'netcdf4') then + setenv IODIR io_netcdf + setenv ICE_CPPDEFS "${ICE_CPPDEFS} -Dncdf" +else if ($IO_TYPE == 'pio') then + setenv IODIR io_pio + setenv ICE_CPPDEFS "${ICE_CPPDEFS} -Dncdf" +else + setenv IODIR io_binary +endif + +# Build in debug mode. If DEBUG=Y, enable DEBUG compilation. This +# flag is set in ${ROOTDIR}/coupledFV3_MOM6_CICE_debug.appBuilder file. +if (! $?DEBUG) then + setenv ICE_BLDDEBUG true +else + if ($DEBUG != "Y") then + setenv ICE_BLDDEBUG false + endif +endif +echo "CICE6 ${0}: DEBUG = ${ICE_BLDDEBUG}" + +### List of source code directories (in order of importance). +cat >! Filepath << EOF +${SRCDIR}/cicecore/drivers/${DRVDIR} +${SRCDIR}/cicecore/cicedynB/dynamics +${SRCDIR}/cicecore/cicedynB/general +${SRCDIR}/cicecore/cicedynB/analysis +${SRCDIR}/cicecore/cicedynB/infrastructure +${SRCDIR}/cicecore/cicedynB/infrastructure/io/${IODIR} +${SRCDIR}/cicecore/cicedynB/infrastructure/comm/${ICE_COMMDIR} +${SRCDIR}/cicecore/shared +${SRCDIR}/icepack/columnphysics +${SRCDIR}/$SHRDIR +EOF + +setenv MAKENAME gmake +setenv MAKETHRDS 1 +setenv MAKEFILE ${SRCDIR}/configuration/scripts/Makefile +setenv MACROSFILE ${SRCDIR}/configuration/scripts/machines/Macros.$ARCH +setenv DEPFILE ${SRCDIR}/configuration/scripts/makdep.c + +echo "CICE6 ${0}: EXEDIR = ${EXEDIR}" +echo "CICE6 ${0}: OBJDIR = ${OBJDIR}" +echo "CICE6 ${0}: MAKEFILE = ${MAKEFILE}" +echo "CICE6 ${0}: MACROSFILE = ${MACROSFILE}" +echo "CICE6 ${0}: DEPFILE = ${DEPFILE}" +echo "CICE6 ${0}: ESMFMKFILE = ${ESMFMKFILE}" + +#diagnostics +#${MAKENAME} -j ${MAKETHRDS} VPFILE=Filepath EXEC=${OBJDIR}/cice \ +# -f ${MAKEFILE} MACFILE=${MACROSFILE} DEPFILE=${DEPFILE} db_files +#${MAKENAME} -j ${MAKETHRDS} VPFILE=Filepath EXEC=${OBJDIR}/cice \ +# -f ${MAKEFILE} MACFILE=${MACROSFILE} DEPFILE=${DEPFILE} db_flags + +#clean +#${MAKENAME} VPFILE=Filepath EXEC=${OBJDIR}/cice \ +# -f ${MAKEFILE} MACFILE=${MACROSFILE} DEPFILE=${DEPFILE} clean + +#needed to trigger a failed build to rest of system +rm ${BINDIR}/cice6.mk + +#build lib (includes dependencies) +${MAKENAME} -j ${MAKETHRDS} VPFILE=Filepath EXEC=${OBJDIR}/libcice6.a \ + -f ${MAKEFILE} MACFILE=${MACROSFILE} DEPFILE=${DEPFILE} libcice + +if ($status != 0) then + echo "CICE6 ${0}: gmake failed, exiting" + exit -2 +endif + +#install +mkdir -p ${BINDIR} +cp -f ${OBJDIR}/libcice6.a ${BINDIR}/ +cp -f ${OBJDIR}/ice_comp_nuopc.mod ${BINDIR}/ + +cat >! ${BINDIR}/cice6.mk << EOF +# ESMF self-describing build dependency makefile fragment + +ESMF_DEP_FRONT = ice_comp_nuopc +ESMF_DEP_INCPATH = ${BINDIR} +ESMF_DEP_CMPL_OBJS = +ESMF_DEP_LINK_OBJS = ${BINDIR}/libcice6.a + +EOF + diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index d64960c6f..9d35b4366 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -120,6 +120,8 @@ krdg_partic = 1 krdg_redist = 1 mu_rdg = 3 + Pstar = 2.75e4 + Cstar = 20 Cf = 17. Ktens = 0. e_ratio = 2. @@ -163,6 +165,7 @@ &forcing_nml formdrag = .false. atmbndy = 'default' + rotate_wind = .true. calc_strair = .true. calc_Tsfc = .true. highfreq = .false. diff --git a/configuration/scripts/machines/Macros.cheyenne_gnu b/configuration/scripts/machines/Macros.cheyenne_gnu index 657a66223..f46d80414 100644 --- a/configuration/scripts/machines/Macros.cheyenne_gnu +++ b/configuration/scripts/machines/Macros.cheyenne_gnu @@ -16,14 +16,14 @@ ifeq ($(ICE_BLDDEBUG), true) CFLAGS += -O0 endif -ifeq ($(ICE_CODECOV), true) +ifeq ($(ICE_COVERAGE), true) FFLAGS += -O0 -g -fprofile-arcs -ftest-coverage CFLAGS += -O0 -g -coverage LDFLAGS += -g -ftest-coverage -fprofile-arcs endif ifneq ($(ICE_BLDDEBUG), true) -ifneq ($(ICE_CODECOV), true) +ifneq ($(ICE_COVERAGE), true) FFLAGS += -O2 CFLAGS += -O2 endif diff --git a/configuration/scripts/machines/Macros.gaffney_gnu b/configuration/scripts/machines/Macros.gaffney_gnu index 87b489ae1..4ae235bc9 100644 --- a/configuration/scripts/machines/Macros.gaffney_gnu +++ b/configuration/scripts/machines/Macros.gaffney_gnu @@ -16,14 +16,14 @@ ifeq ($(ICE_BLDDEBUG), true) CFLAGS += -O0 endif -ifeq ($(ICE_CODECOV), true) +ifeq ($(ICE_COVERAGE), true) FFLAGS += -O0 -g -fprofile-arcs -ftest-coverage CFLAGS += -O0 -g -coverage LDFLAGS += -g -ftest-coverage -fprofile-arcs endif ifneq ($(ICE_BLDDEBUG), true) -ifneq ($(ICE_CODECOV), true) +ifneq ($(ICE_COVERAGE), true) FFLAGS += -O2 CFLAGS += -O2 endif diff --git a/configuration/scripts/machines/Macros.gordon_gnu b/configuration/scripts/machines/Macros.gordon_gnu index 61c81f936..8c3e277ab 100644 --- a/configuration/scripts/machines/Macros.gordon_gnu +++ b/configuration/scripts/machines/Macros.gordon_gnu @@ -16,14 +16,14 @@ ifeq ($(ICE_BLDDEBUG), true) CFLAGS += -O0 endif -ifeq ($(ICE_CODECOV), true) +ifeq ($(ICE_COVERAGE), true) FFLAGS += -O0 -g -fprofile-arcs -ftest-coverage CFLAGS += -O0 -g -coverage LDFLAGS += -g -ftest-coverage -fprofile-arcs endif ifneq ($(ICE_BLDDEBUG), true) -ifneq ($(ICE_CODECOV), true) +ifneq ($(ICE_COVERAGE), true) FFLAGS += -O2 CFLAGS += -O2 endif diff --git a/configuration/scripts/machines/Macros.izumi_gnu b/configuration/scripts/machines/Macros.izumi_gnu index 7f2f4739e..99df7a033 100644 --- a/configuration/scripts/machines/Macros.izumi_gnu +++ b/configuration/scripts/machines/Macros.izumi_gnu @@ -16,14 +16,14 @@ ifeq ($(ICE_BLDDEBUG), true) CFLAGS += -O0 endif -ifeq ($(ICE_CODECOV), true) +ifeq ($(ICE_COVERAGE), true) FFLAGS += -O0 -g -fprofile-arcs -ftest-coverage CFLAGS += -O0 -g -coverage LDFLAGS += -g -ftest-coverage -fprofile-arcs endif ifneq ($(ICE_BLDDEBUG), true) -ifneq ($(ICE_CODECOV), true) +ifneq ($(ICE_COVERAGE), true) FFLAGS += -O2 CFLAGS += -O2 endif diff --git a/configuration/scripts/machines/Macros.loft_gnu b/configuration/scripts/machines/Macros.loft_gnu deleted file mode 100644 index 6d14c04cc..000000000 --- a/configuration/scripts/machines/Macros.loft_gnu +++ /dev/null @@ -1,64 +0,0 @@ -#============================================================================== -# Macros file for LANL osx, gfortran compiler (loft laptop) -#============================================================================== - -CPP := /usr/bin/cpp -#CPP := fpp -CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} -CFLAGS := -c -O2 -fp-model precise -xHost - -FIXEDFLAGS := -132 -#FREEFLAGS := -FR - -#gfortran flags -FFLAGS := -O2 -ffree-line-length-none -fconvert=big-endian -finit-real=nan -#FFLAGS := -O2 -ffree-line-length-none -fconvert=big-endian -finit-real=nan -Wall -Wextra -pedantic -fbacktrace -std=f2008 - -#ifort flags -#FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost - -FFLAGS_NOOPT:= -O0 - -ifeq ($(ICE_BLDDEBUG), true) - FFLAGS += -O0 -Wextra -fbacktrace -fbounds-check -ffpe-trap=zero,overflow -# FFLAGS += -O0 -g -Wextra -fbacktrace -fbounds-check -ffpe-trap=zero,overflow -# FFLAGS += -O0 -Wextra -fbacktrace -fbounds-check -ffpe-trap=zero,overflow -# ifort flags -# FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -else - FFLAGS += -O2 -endif - -SCC := gcc -SFC := gfortran -MPICC := gcc -MPIFC := gfortran - -ifeq ($(ICE_COMMDIR), mpi) - FC := $(MPIFC) - CC := $(MPICC) -else - FC := $(SFC) - CC := $(SCC) -endif -LD:= $(FC) - -ifeq ($(ICE_IOTYPE), netcdf) - NETCDF_PATH := /usr/projects/climate/SHARED_CLIMATE/software/conejo/netcdf/3.6.3/intel-13.0.1 - INCLDIR := $(INCLDIR) -I$(NETCDF_PATH)/include - LIB_NETCDF := $(NETCDF_PATH)/lib - LIB_PNETCDF := - SLIBS := -L$(LIB_NETCDF) -lnetcdf -else - SLIBS := -endif - -LIB_MPI := - -ifeq ($(ICE_THREADED), true) - LDFLAGS += -openmp - CFLAGS += -openmp - FFLAGS += -openmp -endif - - diff --git a/configuration/scripts/machines/Macros.thunder_intel b/configuration/scripts/machines/Macros.mustang_intel18 similarity index 67% rename from configuration/scripts/machines/Macros.thunder_intel rename to configuration/scripts/machines/Macros.mustang_intel18 index 7163fb883..5d1849488 100644 --- a/configuration/scripts/machines/Macros.thunder_intel +++ b/configuration/scripts/machines/Macros.mustang_intel18 @@ -1,5 +1,5 @@ #============================================================================== -# Macros file for ARFL thunder, intel compiler +# Macros file for AFRL mustang, intel compiler #============================================================================== CPP := fpp @@ -25,28 +25,18 @@ MPIFC := ifort ifeq ($(ICE_COMMDIR), mpi) FC := $(MPIFC) CC := $(MPICC) - LDFLAGS += -lmpi else FC := $(SFC) CC := $(SCC) endif LD:= $(FC) -# defined by module -#NETCDF_PATH := $(NETCDF) -#PNETCDF_PATH := $(PNETCDF) -#PNETCDF_PATH := /glade/apps/opt/pnetcdf/1.3.0/intel/default -#LAPACK_LIBDIR := /glade/apps/opt/lapack/3.4.2/intel/12.1.5/lib +#defined by env +#NETCDF_PATH := $(NETCDF_PATH) -#PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs - -INCLDIR := $(INCLDIR) INCLDIR += -I$(NETCDF_PATH)/include - LIB_NETCDF := $(NETCDF_PATH)/lib -LIB_PNETCDF := $(PNETCDF_PATH)/lib -LIB_MPI := $(IMPILIBDIR) -SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lmpi ifeq ($(ICE_THREADED), true) LDFLAGS += -qopenmp diff --git a/configuration/scripts/machines/Macros.mustang_intel19 b/configuration/scripts/machines/Macros.mustang_intel19 new file mode 100644 index 000000000..5d1849488 --- /dev/null +++ b/configuration/scripts/machines/Macros.mustang_intel19 @@ -0,0 +1,46 @@ +#============================================================================== +# Macros file for AFRL mustang, intel compiler +#============================================================================== + +CPP := fpp +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 -fp-model precise -xHost + +FIXEDFLAGS := -132 +FREEFLAGS := -FR +FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created +else + FFLAGS += -O2 +endif + +SCC := icc +SFC := ifort +MPICC := icc +MPIFC := ifort + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +#defined by env +#NETCDF_PATH := $(NETCDF_PATH) + +INCLDIR += -I$(NETCDF_PATH)/include +LIB_NETCDF := $(NETCDF_PATH)/lib +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lmpi + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif + diff --git a/configuration/scripts/machines/Macros.mustang_intel20 b/configuration/scripts/machines/Macros.mustang_intel20 new file mode 100644 index 000000000..5d1849488 --- /dev/null +++ b/configuration/scripts/machines/Macros.mustang_intel20 @@ -0,0 +1,46 @@ +#============================================================================== +# Macros file for AFRL mustang, intel compiler +#============================================================================== + +CPP := fpp +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 -fp-model precise -xHost + +FIXEDFLAGS := -132 +FREEFLAGS := -FR +FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created +else + FFLAGS += -O2 +endif + +SCC := icc +SFC := ifort +MPICC := icc +MPIFC := ifort + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +#defined by env +#NETCDF_PATH := $(NETCDF_PATH) + +INCLDIR += -I$(NETCDF_PATH)/include +LIB_NETCDF := $(NETCDF_PATH)/lib +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lmpi + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif + diff --git a/configuration/scripts/machines/Macros.onyx_gnu b/configuration/scripts/machines/Macros.onyx_gnu index 93de0a55d..890e29e31 100644 --- a/configuration/scripts/machines/Macros.onyx_gnu +++ b/configuration/scripts/machines/Macros.onyx_gnu @@ -16,14 +16,14 @@ ifeq ($(ICE_BLDDEBUG), true) CFLAGS += -O0 endif -ifeq ($(ICE_CODECOV), true) +ifeq ($(ICE_COVERAGE), true) FFLAGS += -O0 -g -fprofile-arcs -ftest-coverage CFLAGS += -O0 -g -coverage LDFLAGS += -g -ftest-coverage -fprofile-arcs endif ifneq ($(ICE_BLDDEBUG), true) -ifneq ($(ICE_CODECOV), true) +ifneq ($(ICE_COVERAGE), true) FFLAGS += -O2 CFLAGS += -O2 endif diff --git a/configuration/scripts/machines/Macros.travisCI_gnu b/configuration/scripts/machines/Macros.travisCI_gnu index aa7b12c05..5d68fdceb 100644 --- a/configuration/scripts/machines/Macros.travisCI_gnu +++ b/configuration/scripts/machines/Macros.travisCI_gnu @@ -16,14 +16,14 @@ ifeq ($(ICE_BLDDEBUG), true) CFLAGS += -O0 endif -ifeq ($(ICE_CODECOV), true) +ifeq ($(ICE_COVERAGE), true) FFLAGS += -O0 -g -fprofile-arcs -ftest-coverage CFLAGS += -O0 -g -coverage LDFLAGS += -g -ftest-coverage -fprofile-arcs endif ifneq ($(ICE_BLDDEBUG), true) -ifneq ($(ICE_CODECOV), true) +ifneq ($(ICE_COVERAGE), true) FFLAGS += -O2 CFLAGS += -O2 endif diff --git a/configuration/scripts/machines/env.badger_intel b/configuration/scripts/machines/env.badger_intel index 8fe69148b..6d53bf978 100755 --- a/configuration/scripts/machines/env.badger_intel +++ b/configuration/scripts/machines/env.badger_intel @@ -30,8 +30,10 @@ module load netcdf-h5parallel/4.4.0 endif -setenv ICE_MACHINE_ENVNAME badger -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME badger +setenv ICE_MACHINE_MACHINFO "Penguin Intel Xeon Broadwell" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "(Note: can vary) ifort 19.0.4.243 20190416, openmpi/2.1.2, netcdf4.4.0" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /net/scratch3/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /usr/projects/climate/eclare/DATA/Consortium diff --git a/configuration/scripts/machines/env.banting_gnu b/configuration/scripts/machines/env.banting_gnu index 7b1a55eac..0c0a4abce 100755 --- a/configuration/scripts/machines/env.banting_gnu +++ b/configuration/scripts/machines/env.banting_gnu @@ -21,8 +21,8 @@ setenv HDF5_USE_FILE_LOCKING FALSE # necessary since data is on an NFS filesyste endif -setenv ICE_MACHINE_ENVNAME banting -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME banting +setenv ICE_MACHINE_ENVNAME gnu setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR ~/data/banting/cice/runs setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/sice500/ diff --git a/configuration/scripts/machines/env.banting_intel b/configuration/scripts/machines/env.banting_intel index 48dce9d1e..ac01e4d72 100755 --- a/configuration/scripts/machines/env.banting_intel +++ b/configuration/scripts/machines/env.banting_intel @@ -16,8 +16,10 @@ setenv HDF5_USE_FILE_LOCKING FALSE # necessary since data is on an NFS filesyste endif -setenv ICE_MACHINE_ENVNAME banting -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME banting +setenv ICE_MACHINE_MACHINFO "Cray XC50, Intel Xeon Gold 6148 (Skylake)" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "Intel 19.0.3.199, cray-mpich/7.7.7, cray-netcdf/4.6.1.3" setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR ~/data/banting/cice/runs setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/sice500/ diff --git a/configuration/scripts/machines/env.cesium_intel b/configuration/scripts/machines/env.cesium_intel index 1b8717897..19209919e 100755 --- a/configuration/scripts/machines/env.cesium_intel +++ b/configuration/scripts/machines/env.cesium_intel @@ -6,8 +6,8 @@ source /fs/ssm/main/opt/intelcomp/intelcomp-2016.1.156/intelcomp_2016.1.156_mult source $ssmuse -d /fs/ssm/main/opt/openmpi/openmpi-1.6.5/intelcomp-2016.1.156 # openmpi source $ssmuse -d /fs/ssm/hpco/tmp/eccc/201402/04/intel-2016.1.150 # netcdf (and openmpi) -setenv ICE_MACHINE_ENVNAME cesium -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME cesium +setenv ICE_MACHINE_ENVNAME intel setenv ICE_MACHINE_MAKE colormake-short setenv ICE_MACHINE_WKDIR /users/dor/afsg/phb/local/CICEDIRS/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /users/dor/afsg/phb/local/FORCING diff --git a/configuration/scripts/machines/env.cheyenne_gnu b/configuration/scripts/machines/env.cheyenne_gnu index f8f139dc0..b17a15917 100755 --- a/configuration/scripts/machines/env.cheyenne_gnu +++ b/configuration/scripts/machines/env.cheyenne_gnu @@ -16,6 +16,7 @@ module load mpt/2.19 module load ncarcompilers/0.5.0 module load netcdf/4.6.3 +if ($?ICE_IOTYPE) then if ($ICE_IOTYPE =~ pio*) then module unload netcdf module load netcdf-mpi/4.6.3 @@ -26,11 +27,14 @@ if ($ICE_IOTYPE =~ pio*) then module load pio/2.4.4 endif endif +endif endif -setenv ICE_MACHINE_ENVNAME cheyenne -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME cheyenne +setenv ICE_MACHINE_MACHINFO "SGI ICE XA Xeon E5-2697V4 Broadwell" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "GNU Fortran (GCC) 8.3.0, mpt2.19, netcdf4.6.3, pnetcdf1.11.1, pio1.10.1, pio2.4.4" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/scratch/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev @@ -41,3 +45,23 @@ setenv ICE_MACHINE_QUEUE "regular" setenv ICE_MACHINE_TPNODE 36 setenv ICE_MACHINE_BLDTHRDS 1 setenv ICE_MACHINE_QSTAT "qstat " + +# For lcov +set lcovpath = "/glade/u/home/tcraig/bin" +set lcovp5l = "/glade/u/home/tcraig/usr/lib/perl5/site_perl/5.18.2/x86_64-linux-thread-multi" + +if ($?PATH) then + if ("$PATH" !~ "*${lcovpath}*") then + setenv PATH ${PATH}:$lcovpath + endif +else + setenv PATH $lcovpath +endif + +if ($?PERL5LIB) then + if ("$PERL5LIB" !~ "*${lcovp5l}*") then + setenv PERL5LIB ${PERL5LIB}:$lcovp5l + endif +else + setenv PERL5LIB $lcovp5l +endif diff --git a/configuration/scripts/machines/env.cheyenne_intel b/configuration/scripts/machines/env.cheyenne_intel index 82cfd3aeb..ce4eba29b 100755 --- a/configuration/scripts/machines/env.cheyenne_intel +++ b/configuration/scripts/machines/env.cheyenne_intel @@ -16,6 +16,7 @@ module load mpt/2.19 module load ncarcompilers/0.5.0 module load netcdf/4.6.3 +if ($?ICE_IOTYPE) then if ($ICE_IOTYPE =~ pio*) then module unload netcdf module load netcdf-mpi/4.6.3 @@ -26,11 +27,14 @@ if ($ICE_IOTYPE =~ pio*) then module load pio/2.4.4 endif endif +endif endif -setenv ICE_MACHINE_ENVNAME cheyenne -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME cheyenne +setenv ICE_MACHINE_MACHINFO "SGI ICE XA Xeon E5-2697V4 Broadwell" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 19.0.2.187 20190117, mpt2.19, netcdf4.6.3, pnetcdf1.11.1, pio1.10.1, pio2.4.4" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/scratch/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev diff --git a/configuration/scripts/machines/env.cheyenne_pgi b/configuration/scripts/machines/env.cheyenne_pgi index 864c907e3..ba9ea498d 100755 --- a/configuration/scripts/machines/env.cheyenne_pgi +++ b/configuration/scripts/machines/env.cheyenne_pgi @@ -16,6 +16,7 @@ module load mpt/2.21 module load ncarcompilers/0.5.0 module load netcdf/4.7.3 +if ($?ICE_IOTYPE) then if ($ICE_IOTYPE =~ pio*) then module unload netcdf module load netcdf-mpi/4.7.3 @@ -26,11 +27,14 @@ if ($ICE_IOTYPE =~ pio*) then module load pio/2.4.4 endif endif +endif endif -setenv ICE_MACHINE_ENVNAME cheyenne -setenv ICE_MACHINE_COMPILER pgi +setenv ICE_MACHINE_MACHNAME cheyenne +setenv ICE_MACHINE_MACHINFO "SGI ICE XA Xeon E5-2697V4 Broadwell" +setenv ICE_MACHINE_ENVNAME pgi +setenv ICE_MACHINE_ENVINFO "pgf90 19.9-0, mpt2.21, netcdf4.7.3, pnetcdf1.12.1, pio1.10.1, pio2.4.4" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/scratch/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev diff --git a/configuration/scripts/machines/env.conda_linux b/configuration/scripts/machines/env.conda_linux index 14f2d5c46..08cf27724 100755 --- a/configuration/scripts/machines/env.conda_linux +++ b/configuration/scripts/machines/env.conda_linux @@ -26,8 +26,10 @@ endif endif -setenv ICE_MACHINE_ENVNAME conda -setenv ICE_MACHINE_COMPILER linux +setenv ICE_MACHINE_MACHNAME conda +setenv ICE_MACHINE_MACHINFO "Generic conda setup" +setenv ICE_MACHINE_ENVNAME linux +setenv ICE_MACHINE_ENVINFO "(NOTE: may vary) GNU Fortran (GCC) 7.3.0, openmpi 4.0.2, netcdf 4.5.2" setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR $HOME/cice-dirs/runs setenv ICE_MACHINE_INPUTDATA $HOME/cice-dirs/input diff --git a/configuration/scripts/machines/env.conda_macos b/configuration/scripts/machines/env.conda_macos index aef2b3a4b..e33eee710 100755 --- a/configuration/scripts/machines/env.conda_macos +++ b/configuration/scripts/machines/env.conda_macos @@ -26,8 +26,10 @@ endif endif -setenv ICE_MACHINE_ENVNAME conda -setenv ICE_MACHINE_COMPILER macos +setenv ICE_MACHINE_MACHNAME conda +setenv ICE_MACHINE_MACHINFO "Generic conda setup" +setenv ICE_MACHINE_ENVNAME macos +setenv ICE_MACHINE_ENVINFO "(NOTE: may vary) GNU Fortran 7.3.0, clang 9.0.1, openmpi 4.0.2, netcdf 4.5.2" setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR $HOME/cice-dirs/runs setenv ICE_MACHINE_INPUTDATA $HOME/cice-dirs/input diff --git a/configuration/scripts/machines/env.conrad_cray b/configuration/scripts/machines/env.conrad_cray index 32093eb40..62549a738 100755 --- a/configuration/scripts/machines/env.conrad_cray +++ b/configuration/scripts/machines/env.conrad_cray @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME conrad -setenv ICE_MACHINE_COMPILER cray +setenv ICE_MACHINE_MACHNAME conrad +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME cray +setenv ICE_MACHINE_ENVINFO "cce 8.5.8, mpich 7.5.3, netcdf 4.4.1.1" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_consortium diff --git a/configuration/scripts/machines/env.conrad_gnu b/configuration/scripts/machines/env.conrad_gnu index 112d0f719..f14ee33a5 100755 --- a/configuration/scripts/machines/env.conrad_gnu +++ b/configuration/scripts/machines/env.conrad_gnu @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME conrad -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME conrad +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "GNU Fortran (GCC) 6.3.0 20161221, mpich 7.5.3, netcdf 4.4.1.1" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_consortium @@ -53,3 +55,23 @@ setenv ICE_MACHINE_QUEUE "debug" setenv ICE_MACHINE_TPNODE 32 # tasks per node setenv ICE_MACHINE_BLDTHRDS 4 setenv ICE_MACHINE_QSTAT "qstat " + +# For lcov +set lcovpath = "/p/home/apcraig/bin" +set lcovp5l = "/p/home/apcraig/usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi" + +if ($?PATH) then + if ("$PATH" !~ "*${lcovpath}*") then + setenv PATH ${PATH}:$lcovpath + endif +else + setenv PATH $lcovpath +endif + +if ($?PERL5LIB) then + if ("$PERL5LIB" !~ "*${lcovp5l}*") then + setenv PERL5LIB ${PERL5LIB}:$lcovp5l + endif +else + setenv PERL5LIB $lcovp5l +endif diff --git a/configuration/scripts/machines/env.conrad_intel b/configuration/scripts/machines/env.conrad_intel index f3f2c2529..e37ce4b1f 100755 --- a/configuration/scripts/machines/env.conrad_intel +++ b/configuration/scripts/machines/env.conrad_intel @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME conrad -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME conrad +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 17.0.2 20170213, mpich 7.3.2, netcdf 4.3.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_consortium diff --git a/configuration/scripts/machines/env.conrad_pgi b/configuration/scripts/machines/env.conrad_pgi index c5f813242..2e82ea34f 100755 --- a/configuration/scripts/machines/env.conrad_pgi +++ b/configuration/scripts/machines/env.conrad_pgi @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME conrad -setenv ICE_MACHINE_COMPILER pgi +setenv ICE_MACHINE_MACHNAME conrad +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME pgi +setenv ICE_MACHINE_ENVINFO "pgf90 16.10-0, mpich 7.5.3, netcdf 4.4.1.1" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_consortium diff --git a/configuration/scripts/machines/env.cori_intel b/configuration/scripts/machines/env.cori_intel index bd66b4313..ed01928f4 100755 --- a/configuration/scripts/machines/env.cori_intel +++ b/configuration/scripts/machines/env.cori_intel @@ -44,8 +44,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME cori -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME cori +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 19.0.3.199 20190206, cray-mpich/7.7.6, netcdf/4.6.3.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $SCRATCH/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /project/projectdirs/ccsm1/cice-consortium/ diff --git a/configuration/scripts/machines/env.daley_gnu b/configuration/scripts/machines/env.daley_gnu index f77bf2d88..b1e379eb0 100755 --- a/configuration/scripts/machines/env.daley_gnu +++ b/configuration/scripts/machines/env.daley_gnu @@ -21,8 +21,8 @@ setenv HDF5_USE_FILE_LOCKING FALSE # necessary since data is on an NFS filesyste endif -setenv ICE_MACHINE_ENVNAME daley -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME daley +setenv ICE_MACHINE_ENVNAME gnu setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR ~/data/daley/cice/runs setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/sice500/ diff --git a/configuration/scripts/machines/env.daley_intel b/configuration/scripts/machines/env.daley_intel index 0d25f983f..502c71037 100755 --- a/configuration/scripts/machines/env.daley_intel +++ b/configuration/scripts/machines/env.daley_intel @@ -16,8 +16,10 @@ setenv HDF5_USE_FILE_LOCKING FALSE # necessary since data is on an NFS filesyste endif -setenv ICE_MACHINE_ENVNAME daley -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME daley +setenv ICE_MACHINE_MACHINFO "Cray XC50, Intel Xeon Gold 6148 (Skylake)" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "Intel 19.0.3.199, cray-mpich/7.7.6, cray-netcdf/4.6.1.3" setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR ~/data/daley/cice/runs setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/sice500/ diff --git a/configuration/scripts/machines/env.fram_intel b/configuration/scripts/machines/env.fram_intel index 8b1326913..a7b141479 100755 --- a/configuration/scripts/machines/env.fram_intel +++ b/configuration/scripts/machines/env.fram_intel @@ -7,8 +7,8 @@ source /fs/ssm/main/opt/intelcomp/intelcomp-2016.1.156/intelcomp_2016.1.156_mult source $ssmuse -d /fs/ssm/main/opt/openmpi/openmpi-1.6.5/intelcomp-2016.1.156 # openmpi source $ssmuse -d /fs/ssm/hpco/tmp/eccc/201402/04/intel-2016.1.150 # netcdf (and openmpi) -setenv ICE_MACHINE_ENVNAME fram -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME fram +setenv ICE_MACHINE_ENVNAME intel setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR /home/dormrb01/zephyr4/armn/jfl/local1/CICEDIRS/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /users/dor/armn/jfl/local1/FORCING diff --git a/configuration/scripts/machines/env.gaffney_gnu b/configuration/scripts/machines/env.gaffney_gnu index d0dff0949..a63ee2ae4 100755 --- a/configuration/scripts/machines/env.gaffney_gnu +++ b/configuration/scripts/machines/env.gaffney_gnu @@ -27,8 +27,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME gaffney -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME gaffney +setenv ICE_MACHINE_MACHINFO "HPE SGI 8600 Xeon Platinum 8168" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "GNU Fortran (GCC) 7.3.0, mpt2.18, netcdf4.4.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/home/apcraig/cice-consortium-data/cice_consortium diff --git a/configuration/scripts/machines/env.gaffney_intel b/configuration/scripts/machines/env.gaffney_intel index 569d0befa..9fa11d16e 100755 --- a/configuration/scripts/machines/env.gaffney_intel +++ b/configuration/scripts/machines/env.gaffney_intel @@ -27,8 +27,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME gaffney -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME gaffney +setenv ICE_MACHINE_MACHINFO "HPE SGI 8600 Xeon Platinum 8168" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 18.0.1 20171018, mpt2.18, netcdf4.4.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/home/apcraig/cice-consortium-data/cice_consortium diff --git a/configuration/scripts/machines/env.gordon_cray b/configuration/scripts/machines/env.gordon_cray index 271761d42..d8c392d60 100755 --- a/configuration/scripts/machines/env.gordon_cray +++ b/configuration/scripts/machines/env.gordon_cray @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME gordon -setenv ICE_MACHINE_COMPILER cray +setenv ICE_MACHINE_MACHNAME gordon +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME cray +setenv ICE_MACHINE_ENVINFO "cce 8.5.8, mpich 7.5.3, netcdf 4.4.1.1" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_consortium diff --git a/configuration/scripts/machines/env.gordon_gnu b/configuration/scripts/machines/env.gordon_gnu index 9b1db5b1b..d17923bd3 100755 --- a/configuration/scripts/machines/env.gordon_gnu +++ b/configuration/scripts/machines/env.gordon_gnu @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME gordon -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME gordon +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "GNU Fortran (GCC) 6.3.0 20161221, mpich 7.5.3, netcdf 4.4.1.1" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_consortium diff --git a/configuration/scripts/machines/env.gordon_intel b/configuration/scripts/machines/env.gordon_intel index 9fd3a7fe4..67aaa9c69 100755 --- a/configuration/scripts/machines/env.gordon_intel +++ b/configuration/scripts/machines/env.gordon_intel @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME gordon -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME gordon +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 17.0.2 20170213, mpich 7.3.2, netcdf 4.3.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_consortium @@ -50,6 +52,8 @@ setenv ICE_MACHINE_BASELINE $WORKDIR/CICE_BASELINE setenv ICE_MACHINE_SUBMIT "qsub " setenv ICE_MACHINE_ACCT P00000000 setenv ICE_MACHINE_QUEUE "debug" -setenv ICE_MACHINE_TPNODE 32 # tasks per node +setenv ICE_MACHINE_TPNODE 32 # tasks per node +setenv ICE_MACHINE_MAXPES 8000 # maximum total pes (tasks * threads) available +setenv ICE_MACHINE_MAXRUNLENGTH 168 # maximum batch wall time limit in hours (integer) setenv ICE_MACHINE_BLDTHRDS 4 setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.gordon_pgi b/configuration/scripts/machines/env.gordon_pgi index 2505018c7..5885afb4b 100755 --- a/configuration/scripts/machines/env.gordon_pgi +++ b/configuration/scripts/machines/env.gordon_pgi @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME gordon -setenv ICE_MACHINE_COMPILER pgi +setenv ICE_MACHINE_MACHNAME gordon +setenv ICE_MACHINE_MACHINFO "Cray XC40 Xeon E5-2698v3 Haswell" +setenv ICE_MACHINE_ENVNAME pgi +setenv ICE_MACHINE_ENVINFO "pgf90 16.10-0, mpich 7.5.3, netcdf 4.4.1.1" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_consortium diff --git a/configuration/scripts/machines/env.hera_intel b/configuration/scripts/machines/env.hera_intel index 9204cf046..7330c3937 100755 --- a/configuration/scripts/machines/env.hera_intel +++ b/configuration/scripts/machines/env.hera_intel @@ -17,8 +17,10 @@ module load netcdf/4.7.0 endif -setenv ICE_MACHINE_ENVNAME hera -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME hera +setenv ICE_MACHINE_MACHINFO "Cray Intel SkyLake 6148" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 18.0.5 20180823, intelmpi/2018.0.4, netcdf/4.7.0" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $HOME/scratch/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /home/Anthony.Craig/scratch/CICE_INPUTDATA diff --git a/configuration/scripts/machines/env.high_Sierra_gnu b/configuration/scripts/machines/env.high_Sierra_gnu index db8bc01a3..3845a91aa 100755 --- a/configuration/scripts/machines/env.high_Sierra_gnu +++ b/configuration/scripts/machines/env.high_Sierra_gnu @@ -1,7 +1,7 @@ #!/bin/csh -f -setenv ICE_MACHINE_ENVNAME high_Sierra -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME high_Sierra +setenv ICE_MACHINE_ENVNAME gnu setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR /Volumes/ncep/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /Volumes/Data/ diff --git a/configuration/scripts/machines/env.hobart_intel b/configuration/scripts/machines/env.hobart_intel index 80092297a..2ab7a3c53 100755 --- a/configuration/scripts/machines/env.hobart_intel +++ b/configuration/scripts/machines/env.hobart_intel @@ -14,8 +14,8 @@ module load compiler/intel/18.0.3 endif -setenv ICE_MACHINE_ENVNAME hobart -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME hobart +setenv ICE_MACHINE_ENVNAME intel setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /scratch/cluster/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /fs/cgd/csm/inputdata diff --git a/configuration/scripts/machines/env.hobart_nag b/configuration/scripts/machines/env.hobart_nag index cc3fc2e67..cae8c0fd8 100755 --- a/configuration/scripts/machines/env.hobart_nag +++ b/configuration/scripts/machines/env.hobart_nag @@ -14,8 +14,8 @@ module load compiler/nag/6.2 endif -setenv ICE_MACHINE_ENVNAME hobart -setenv ICE_MACHINE_COMPILER nag +setenv ICE_MACHINE_MACHNAME hobart +setenv ICE_MACHINE_ENVNAME nag setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /scratch/cluster/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /fs/cgd/csm/inputdata diff --git a/configuration/scripts/machines/env.izumi_gnu b/configuration/scripts/machines/env.izumi_gnu index 9f9938d68..873324e5d 100755 --- a/configuration/scripts/machines/env.izumi_gnu +++ b/configuration/scripts/machines/env.izumi_gnu @@ -10,14 +10,16 @@ if ("$inp" != "-nomodules") then source /usr/share/Modules/init/csh module purge -module load compiler/gnu/8.2.0 +module load compiler/gnu/9.3.0 setenv OMP_STACKSIZE 64M endif -setenv ICE_MACHINE_ENVNAME izumi -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME izumi +setenv ICE_MACHINE_MACHINFO "Linux Cluster" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "GNU Fortran (GCC) 9.3.0, mvapich2-2.3.3, netcdf4.7.4" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /scratch/cluster/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /fs/cgd/csm/inputdata diff --git a/configuration/scripts/machines/env.izumi_intel b/configuration/scripts/machines/env.izumi_intel index 218d388be..33baa096e 100755 --- a/configuration/scripts/machines/env.izumi_intel +++ b/configuration/scripts/machines/env.izumi_intel @@ -10,15 +10,18 @@ if ("$inp" != "-nomodules") then source /usr/share/Modules/init/csh module purge -module load compiler/intel/19.0.2 +module load compiler/intel/20.0.1 setenv OMP_STACKSIZE 64M endif -setenv ICE_MACHINE_ENVNAME izumi -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME izumi +setenv ICE_MACHINE_MACHINFO "Linux Cluster" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 19.1.0.166 20191121, mvapich2-2.3.3, netcdf4.7.4" setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_CPPDEFS "" setenv ICE_MACHINE_WKDIR /scratch/cluster/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /fs/cgd/csm/inputdata setenv ICE_MACHINE_BASELINE /scratch/cluster/$user/CICE_BASELINE diff --git a/configuration/scripts/machines/env.izumi_nag b/configuration/scripts/machines/env.izumi_nag index 785cc410a..d1ce4ba95 100755 --- a/configuration/scripts/machines/env.izumi_nag +++ b/configuration/scripts/machines/env.izumi_nag @@ -10,14 +10,17 @@ if ("$inp" != "-nomodules") then source /usr/share/Modules/init/csh module purge -module load compiler/nag/6.2 +#module load compiler/nag/7.0 +module load compiler/nag/6.2-8.1.0 setenv OMP_STACKSIZE 64M endif -setenv ICE_MACHINE_ENVNAME izumi -setenv ICE_MACHINE_COMPILER nag +setenv ICE_MACHINE_MACHNAME izumi +setenv ICE_MACHINE_MACHINFO "Linux Cluster" +setenv ICE_MACHINE_ENVNAME nag +setenv ICE_MACHINE_ENVINFO "NAG Fortran Compiler Release 6.2(Chiyoda) Build 6207, gcc (GCC) 8.1.0, cc (GCC) 4.8.5 20150623, mvapich2-2.3.3, netcdf/c4.6.1-f4.4.4" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /scratch/cluster/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /fs/cgd/csm/inputdata diff --git a/configuration/scripts/machines/env.izumi_pgi b/configuration/scripts/machines/env.izumi_pgi index b89eafeb8..8a8c36b8f 100755 --- a/configuration/scripts/machines/env.izumi_pgi +++ b/configuration/scripts/machines/env.izumi_pgi @@ -10,14 +10,16 @@ if ("$inp" != "-nomodules") then source /usr/share/Modules/init/csh module purge -module load compiler/pgi/18.10 +module load compiler/pgi/20.1 setenv OMP_STACKSIZE 64M endif -setenv ICE_MACHINE_ENVNAME izumi -setenv ICE_MACHINE_COMPILER pgi +setenv ICE_MACHINE_MACHNAME izumi +setenv ICE_MACHINE_MACHINFO "Linux Cluster" +setenv ICE_MACHINE_ENVNAME pgi +setenv ICE_MACHINE_ENVINFO "pgf90 20.1-0, mvapich2-2.3.3, netcdf4.7.4" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /scratch/cluster/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /fs/cgd/csm/inputdata diff --git a/configuration/scripts/machines/env.koehr_intel b/configuration/scripts/machines/env.koehr_intel index 30876b656..f4d7cada2 100755 --- a/configuration/scripts/machines/env.koehr_intel +++ b/configuration/scripts/machines/env.koehr_intel @@ -27,8 +27,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME koehr -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME koehr +setenv ICE_MACHINE_MACHINFO "HPE SGI 8600 Xeon Platinum 8168" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 18.0.1 20171018, mpt2.18, netcdf4.4.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/home/apcraig/cice-consortium-data/cice_consortium diff --git a/configuration/scripts/machines/env.loft_gnu b/configuration/scripts/machines/env.loft_gnu deleted file mode 100755 index 666a8ff54..000000000 --- a/configuration/scripts/machines/env.loft_gnu +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/tcsh -f - -#setenv NETCDF_PATH /usr/projects/climate/SHARED_CLIMATE/software/conejo/netcdf/3.6.3/intel-13.0.1 - -setenv ICE_MACHINE_ENVNAME loft -setenv ICE_MACHINE_COMPILER gnu -setenv ICE_MACHINE_MAKE gmake -setenv ICE_MACHINE_WKDIR /Users/$user/Desktop/CICE-Consortium/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA /Users/$user/Desktop/CICE-Consortium -setenv ICE_MACHINE_BASELINE /Users/$user/Desktop/CICE-Consortium/CICE_BASELINE -setenv ICE_MACHINE_SUBMIT " " -setenv ICE_MACHINE_ACCT -setenv ICE_MACHINE_QUEUE "default" -setenv ICE_MACHINE_TPNODE 1 -setenv ICE_MACHINE_BLDTHRDS 1 -setenv ICE_MACHINE_QSTAT " " diff --git a/configuration/scripts/machines/env.millikan_intel b/configuration/scripts/machines/env.millikan_intel index fc81ac097..63913166d 100755 --- a/configuration/scripts/machines/env.millikan_intel +++ b/configuration/scripts/machines/env.millikan_intel @@ -6,8 +6,8 @@ source /fs/ssm/main/opt/intelcomp/intelcomp-2016.1.156/intelcomp_2016.1.156_mult source $ssmuse -d /fs/ssm/main/opt/openmpi/openmpi-1.6.5/intelcomp-2016.1.156 # openmpi source $ssmuse -d /fs/ssm/hpco/tmp/eccc/201402/04/intel-2016.1.150 # netcdf (and openmpi) -setenv ICE_MACHINE_ENVNAME millikan -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME millikan +setenv ICE_MACHINE_ENVNAME intel setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR /users/dor/armn/amb/data/local/runs setenv ICE_MACHINE_INPUTDATA /users/dor/armn/amb/data/local/forcing diff --git a/configuration/scripts/machines/env.thunder_intel b/configuration/scripts/machines/env.mustang_intel18 similarity index 64% rename from configuration/scripts/machines/env.thunder_intel rename to configuration/scripts/machines/env.mustang_intel18 index caf1880d9..f420ec7ff 100755 --- a/configuration/scripts/machines/env.thunder_intel +++ b/configuration/scripts/machines/env.mustang_intel18 @@ -9,19 +9,15 @@ if ("$inp" != "-nomodules") then source ${MODULESHOME}/init/csh -module unload gcc-compilers -module unload intel-compilers +module unload compiler module unload mpt module unload netcdf-fortran -module unload netcdf-c -module unload hdf5 -module unload pbs module load costinit -module load intel-compilers/15.0.3.187 -module load mpt/2.14 +module load git +module load compiler/intel/2018.3.222 +module load mpt/2.18 module load netcdf-fortran/intel/4.4.2 -module load pbs/12.2.4.142262 setenv NETCDF_PATH /app/COST/netcdf-fortran/4.4.2/intel @@ -34,15 +30,17 @@ setenv NETCDF_PATH /app/COST/netcdf-fortran/4.4.2/intel endif -setenv ICE_MACHINE_ENVNAME thunder -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME mustang +setenv ICE_MACHINE_MACHINFO "HPE SGI 8600 Xeon Platinum 8168" +setenv ICE_MACHINE_ENVNAME intel18 +setenv ICE_MACHINE_ENVINFO "ifort 18.0.3 20180410, mpt2.19, netcdf4.4.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA /p/work2/projects/rasm/cice_consortium +setenv ICE_MACHINE_INPUTDATA /p/work1/projects/RASM/cice-consortium setenv ICE_MACHINE_BASELINE $WORKDIR/CICE_BASELINE setenv ICE_MACHINE_SUBMIT "qsub " setenv ICE_MACHINE_ACCT P00000000 setenv ICE_MACHINE_QUEUE "debug" -setenv ICE_MACHINE_TPNODE 36 # tasks per node +setenv ICE_MACHINE_TPNODE 48 # tasks per node setenv ICE_MACHINE_BLDTHRDS 4 setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.mustang_intel19 b/configuration/scripts/machines/env.mustang_intel19 new file mode 100755 index 000000000..0fc0458fd --- /dev/null +++ b/configuration/scripts/machines/env.mustang_intel19 @@ -0,0 +1,46 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source ${MODULESHOME}/init/csh + +module unload compiler +module unload mpt +module unload netcdf-fortran + +module load costinit +module load git +module load compiler/intel/2019.3.199 +module load mpt/2.20 +module load netcdf-fortran/intel/4.4.2 + +setenv NETCDF_PATH /app/COST/netcdf-fortran/4.4.2/intel + +#setenv OMP_STACKSIZE 256M +#setenv MP_LABELIO yes +#setenv MP_INFOLEVEL 2 +#setenv MP_SHARED_MEMORY yes +#setenv MP_EUILIB us +#setenv MP_EAGER_LIMIT 0 + +endif + +setenv ICE_MACHINE_MACHNAME mustang +setenv ICE_MACHINE_MACHINFO "HPE SGI 8600 Xeon Platinum 8168" +setenv ICE_MACHINE_ENVNAME intel19 +setenv ICE_MACHINE_ENVINFO "ifort 19.0.3.199 20190206, mpt2.20, netcdf4.4.2" +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS +setenv ICE_MACHINE_INPUTDATA /p/work1/projects/RASM/cice-consortium +setenv ICE_MACHINE_BASELINE $WORKDIR/CICE_BASELINE +setenv ICE_MACHINE_SUBMIT "qsub " +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "debug" +setenv ICE_MACHINE_TPNODE 48 # tasks per node +setenv ICE_MACHINE_BLDTHRDS 4 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.mustang_intel20 b/configuration/scripts/machines/env.mustang_intel20 new file mode 100755 index 000000000..00c4a250d --- /dev/null +++ b/configuration/scripts/machines/env.mustang_intel20 @@ -0,0 +1,46 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source ${MODULESHOME}/init/csh + +module unload compiler +module unload mpt +module unload netcdf-fortran + +module load costinit +module load git +module load compiler/intel/2020.0.1 +module load mpt/2.20 +module load netcdf-fortran/intel/4.4.2 + +setenv NETCDF_PATH /app/COST/netcdf-fortran/4.4.2/intel + +#setenv OMP_STACKSIZE 256M +#setenv MP_LABELIO yes +#setenv MP_INFOLEVEL 2 +#setenv MP_SHARED_MEMORY yes +#setenv MP_EUILIB us +#setenv MP_EAGER_LIMIT 0 + +endif + +setenv ICE_MACHINE_MACHNAME mustang +setenv ICE_MACHINE_MACHINFO "HPE SGI 8600 Xeon Platinum 8168" +setenv ICE_MACHINE_ENVNAME intel20 +setenv ICE_MACHINE_ENVINFO "ifort 19.1.1.217 20200306, mpt2.19, netcdf4.4.2" +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS +setenv ICE_MACHINE_INPUTDATA /p/work1/projects/RASM/cice-consortium +setenv ICE_MACHINE_BASELINE $WORKDIR/CICE_BASELINE +setenv ICE_MACHINE_SUBMIT "qsub " +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "debug" +setenv ICE_MACHINE_TPNODE 48 # tasks per node +setenv ICE_MACHINE_BLDTHRDS 4 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.onyx_cray b/configuration/scripts/machines/env.onyx_cray index 78cdb739f..b155c1d1e 100755 --- a/configuration/scripts/machines/env.onyx_cray +++ b/configuration/scripts/machines/env.onyx_cray @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME onyx -setenv ICE_MACHINE_COMPILER cray +setenv ICE_MACHINE_MACHNAME onyx +setenv ICE_MACHINE_MACHINFO "Cray XC40/50 Xeon E5-2699v4 Broadwell" +setenv ICE_MACHINE_ENVNAME cray +setenv ICE_MACHINE_ENVINFO "Cray cce/8.6.4, cray-mpich/7.6.3, netcdf/4.4.1.1.3" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/app/unsupported/RASM/cice_consortium diff --git a/configuration/scripts/machines/env.onyx_gnu b/configuration/scripts/machines/env.onyx_gnu index 139250142..de7bcc787 100755 --- a/configuration/scripts/machines/env.onyx_gnu +++ b/configuration/scripts/machines/env.onyx_gnu @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME onyx -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME onyx +setenv ICE_MACHINE_MACHINFO "Cray XC40/50 Xeon E5-2699v4 Broadwell" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "GNU Fortran (GCC) 7.2.0 20170814, cray-mpich/7.6.2, netcdf/4.4.1.1.3" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/app/unsupported/RASM/cice_consortium diff --git a/configuration/scripts/machines/env.onyx_intel b/configuration/scripts/machines/env.onyx_intel index e2a8bde4a..df42fe9f8 100755 --- a/configuration/scripts/machines/env.onyx_intel +++ b/configuration/scripts/machines/env.onyx_intel @@ -41,8 +41,10 @@ limit stacksize unlimited endif -setenv ICE_MACHINE_ENVNAME onyx -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME onyx +setenv ICE_MACHINE_MACHINFO "Cray XC40/50 Xeon E5-2699v4 Broadwell" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 17.0.1 20161005, cray-mpich/7.6.2, netcdf/4.4.1.1.3" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /p/app/unsupported/RASM/cice_consortium diff --git a/configuration/scripts/machines/env.orion_intel b/configuration/scripts/machines/env.orion_intel index 7088bed49..95850b6bb 100755 --- a/configuration/scripts/machines/env.orion_intel +++ b/configuration/scripts/machines/env.orion_intel @@ -24,8 +24,10 @@ echo " module load netcdf/4.7.2" endif -setenv ICE_MACHINE_ENVNAME orion -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME orion +setenv ICE_MACHINE_MACHINFO "Dell EMC PowerEdge C6420 Xeon Gold 6148" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 19.1.0.166 20191121, intelmpi 2019 Update 6 Build 20191024, netcdf/4.7.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR $HOME/scratch/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /home/acraig/scratch/CICE_INPUTDATA diff --git a/configuration/scripts/machines/env.phase3_intel b/configuration/scripts/machines/env.phase3_intel index 4c8f65eee..af8dd3e5f 100755 --- a/configuration/scripts/machines/env.phase3_intel +++ b/configuration/scripts/machines/env.phase3_intel @@ -13,8 +13,8 @@ module load NetCDF/4.5.0 module load ESMF/7_1_0r module list -setenv ICE_MACHINE_ENVNAME phase3 -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME phase3 +setenv ICE_MACHINE_ENVNAME intel setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /u/Robert.Grumbine/noscrub/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /u/Robert.Grumbine/noscrub/ diff --git a/configuration/scripts/machines/env.testmachine_intel b/configuration/scripts/machines/env.testmachine_intel index b85d610c9..5b52f1b07 100755 --- a/configuration/scripts/machines/env.testmachine_intel +++ b/configuration/scripts/machines/env.testmachine_intel @@ -1,7 +1,9 @@ #!/bin/csh -f -setenv ICE_MACHINE_ENVNAME testmachine -setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MACHNAME testmachine +setenv ICE_MACHINE_MACHINFO "Undefined" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "Undefined" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR ~/CICE_RUNS setenv ICE_MACHINE_INPUTDATA ~/CICE_INPUTDATA diff --git a/configuration/scripts/machines/env.travisCI_gnu b/configuration/scripts/machines/env.travisCI_gnu index f3c9da26b..b7a1b6176 100755 --- a/configuration/scripts/machines/env.travisCI_gnu +++ b/configuration/scripts/machines/env.travisCI_gnu @@ -1,7 +1,9 @@ #!/bin/csh -f -setenv ICE_MACHINE_ENVNAME travisCI -setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MACHNAME travisCI +setenv ICE_MACHINE_MACHINFO "Cloud Computing" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "(NOTE: varies in time) gfortran, gcc, openmpi, netcdf" setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR ~/CICE_RUNS setenv ICE_MACHINE_INPUTDATA ~ diff --git a/configuration/scripts/options/set_nml.boxdyn b/configuration/scripts/options/set_nml.boxdyn index 1b74720c7..72e89db5c 100644 --- a/configuration/scripts/options/set_nml.boxdyn +++ b/configuration/scripts/options/set_nml.boxdyn @@ -20,7 +20,7 @@ tr_pond_lvl = .false. tr_aero = .false. kitd = 0 ktherm = 0 -kdyn = 3 +kdyn = 0 revised_evp = .false. kstrength = 0 krdg_partic = 1 diff --git a/configuration/scripts/set_version_number.csh b/configuration/scripts/set_version_number.csh index 5dfe2880a..71cde9b48 100755 --- a/configuration/scripts/set_version_number.csh +++ b/configuration/scripts/set_version_number.csh @@ -1,4 +1,4 @@ -#! /bin/csh -f +#!/bin/csh -f if ( $#argv < 1 ) then echo "$0 requires one argument, none passed" diff --git a/configuration/scripts/setup_run_dirs.csh b/configuration/scripts/setup_run_dirs.csh index 0a01d4297..92348e411 100755 --- a/configuration/scripts/setup_run_dirs.csh +++ b/configuration/scripts/setup_run_dirs.csh @@ -1,4 +1,4 @@ -#! /bin/csh -f +#!/bin/csh -f source ./cice.settings source ${ICE_CASEDIR}/env.${ICE_MACHCOMP} -nomodules || exit 2 diff --git a/configuration/scripts/tests/baseline.script b/configuration/scripts/tests/baseline.script index 9e78027a1..a1ab4e055 100644 --- a/configuration/scripts/tests/baseline.script +++ b/configuration/scripts/tests/baseline.script @@ -98,3 +98,18 @@ if (${ICE_BFBCOMP} != ${ICE_SPVAL}) then endif #----------------------------------------------------------- + +# Document machine and env + +set machinfo = "" +set envinfo = "" +if ($?ICE_MACHINE_MACHINFO) then + set machinfo = "${ICE_MACHINE_MACHINFO}" +endif +if ($?ICE_MACHINE_ENVINFO) then + set envinfo = "${ICE_MACHINE_ENVINFO}" +endif +echo "#machinfo = ${machinfo}" >> ${ICE_CASEDIR}/test_output +echo "#envinfo ${ICE_ENVNAME} = ${envinfo}" >> ${ICE_CASEDIR}/test_output + +#----------------------------------------------------------- diff --git a/configuration/scripts/tests/cice.codecov.csh b/configuration/scripts/tests/cice.codecov.csh new file mode 100644 index 000000000..51cce4ac7 --- /dev/null +++ b/configuration/scripts/tests/cice.codecov.csh @@ -0,0 +1,20 @@ + +#--- cice.codecov.csh --- + +#if ( ${use_curl} == 1 ) then +# bash -c "bash <(curl -s https://codecov.io/bash) -n '${report_name}' -y ./codecov.yml " +#else +# bash -c "bash <(wget -O - https://codecov.io/bash) -n '${report_name}' -y ./codecov.yml " +#endif + +if ( ${use_curl} == 1 ) then + curl https://codecov.io/bash -o codecov.bash +else + wget https://codecov.io/bash -O codecov.bash +endif +chmod +x codecov.bash +sed -i.sedbak 's|mktemp /tmp/|mktemp ./|g' codecov.bash +bash -c "bash ./codecov.bash -n '${report_name}' -y ./codecov.yml" + +sleep 10 +rm -r -f ./*/codecov_output diff --git a/configuration/scripts/tests/cice.lcov.csh b/configuration/scripts/tests/cice.lcov.csh new file mode 100644 index 000000000..8107778d9 --- /dev/null +++ b/configuration/scripts/tests/cice.lcov.csh @@ -0,0 +1,47 @@ + +#--- cice.lcov.csh --- + +echo ${lcovalist} +lcov ${lcovalist} -o total.info + +set lcovrepo = apcraig.github.io +set lcovhtmldir = lcov_cice_${report_name} +genhtml -o ./${lcovhtmldir} --precision 2 -t "${report_name}" total.info + +rm -r -f ${lcovrepo} +git clone https://github.com/apcraig/${lcovrepo} +cp -p -r ${lcovhtmldir} ${lcovrepo}/ + +cd ${lcovrepo} +set covp0 = `grep message coverage.json | cut -d : -f 2 | cut -d \" -f 2 | cut -d % -f 1` +set covp = `grep -i headerCovTableEntry ${lcovhtmldir}/index.html | grep % | head -1 | cut -d \> -f 2 | cut -d % -f 1` +set covpi = `echo $covp | cut -d . -f 1` + +set lcovhtmlname = "${covpi}%:${report_name}" +set oline = `grep -n "add_cice_entry_here" index.html | head -1 | cut -d : -f 1` +@ nline = ${oline} +sed -i "$nline a
  • ${lcovhtmlname}
  • " index.html + +set covpcolor = red +if (${covpi} > 50) set covpcolor = orange +if (${covpi} > 60) set covpcolor = yellow +if (${covpi} > 70) set covpcolor = yellowgreen +if (${covpi} > 80) set covpcolor = green +if (${covpi} > 90) set covpcolor = brightgreen + +cp coverage.json coverage.json.old +cat >! coverage.json <> results.log +echo " " >> results.log +echo "#totl = $total total" >> results.log +echo "#chkd = $chkcnt checked" >> results.log +echo "#pass = $success" >> results.log +echo "#pend = $pends" >> results.log +echo "#miss = $misses" >> results.log +echo "#fail = $failures" >> results.log +echo " #failbuild = $failbuild" >> results.log +echo " #failrun = $failrun" >> results.log +echo " #failtest = $failtest" >> results.log +echo " #failcomp = $failcomp" >> results.log +echo " #failbfbc = $failbfbc" >> results.log +echo " #failgen = $failgen" >> results.log + +echo "" +echo "Descriptors:" +echo " PASS - successful completion" +echo " COPY - previously compiled code was copied for new test" +echo " MISS - comparison data is missing" +echo " PEND - status is undetermined; test may still be queued, running, or timed out" +echo " FAIL - test failed" +echo "" +echo "$chkcnt measured results of $total total results" +echo "$success of $chkcnt tests PASSED" +echo "$pends of $chkcnt tests PENDING" +echo "$misses of $chkcnt tests MISSING data" +echo "$failures of $chkcnt tests FAILED" +#echo " $failbuild of $failures FAILED build" +#echo " $failrun of $failures FAILED run" +#echo " $failtest of $failures FAILED test" +#echo " $failcomp of $failures FAILED compare" +#echo " $failbfbc of $failures FAILED bfbcomp" +#echo " $failgen of $failures FAILED generate" +exit $failures diff --git a/configuration/scripts/tests/cice_test_codecov.csh b/configuration/scripts/tests/cice_test_codecov.csh index 0b2d970ec..be9399f1b 100755 --- a/configuration/scripts/tests/cice_test_codecov.csh +++ b/configuration/scripts/tests/cice_test_codecov.csh @@ -1,8 +1,7 @@ #!/bin/csh # This was a script on gordon -# This script should only be run on hardware with the gnu compiler with a -# modified Macros file to turn on the codecov flags +# This script should only be run on hardware with the gnu compiler # This should be run interactively because git push will require login information #PBS -N cice_test @@ -69,7 +68,7 @@ git push origin master # Run test suite echo " " echo "*** run test suite ***" -./cice.setup --suite first_suite,base_suite,travis_suite,decomp_suite,reprosum_suite,quick_suite -m gordon -e gnu --testid T${date} --codecov --queue standard +./cice.setup --suite first_suite,base_suite,travis_suite,decomp_suite,reprosum_suite,io_suite,quick_suite -m gordon -e gnu --testid T${date} --coverage --queue standard -# The test suite will wait until all jobs are complete then run report_codecov.csh -# If that fails, you can run report_codecov.csh manually after all jobs are done +# The test suite will wait until all jobs are complete then run report_codecov.csh or report_lcov.csh +# If that fails, you can run report_codecov.csh or report_lcov.csh manually after all jobs are done diff --git a/configuration/scripts/tests/report_results.csh b/configuration/scripts/tests/report_results.csh index 4a64deff8..e3f8eed70 100755 --- a/configuration/scripts/tests/report_results.csh +++ b/configuration/scripts/tests/report_results.csh @@ -49,7 +49,7 @@ set totl = `grep "#totl = " results.log | cut -c 9-` set pass = `grep "#pass = " results.log | cut -c 9-` set fail = `grep "#fail = " results.log | cut -c 9-` set cases = `grep -v "#" results.log | grep ${mach}_ | cut -d " " -f 2 | sort -u` -set compilers = `grep -v "#" results.log | grep ${mach}_ | cut -d "_" -f 2 | sort -u` +set envnames = `grep -v "#" results.log | grep ${mach}_ | cut -d "_" -f 2 | sort -u` #echo "debug ${repo}" #echo "debug ${bran}" @@ -93,12 +93,15 @@ unset noglob # Create results table #============================================================== -foreach compiler ( ${compilers} ) +foreach envname ( ${envnames} ) + + set machinfo = `grep -m 1 "#machinfo = " results.log | cut -d = -f 2` + set envinfo = `grep -m 1 "#envinfo ${envname} = " results.log | cut -d = -f 2` set cnt = 0 set found = 1 while ($found == 1) - set ofile = "${shhash}.${mach}.${compiler}.${xcdat}.${xctim}.$cnt" + set ofile = "${shhash}.${mach}.${envname}.${xcdat}.${xctim}.$cnt" set outfile = "${wikiname}/${tsubdir}/${ofile}.md" if (-e ${outfile}) then @ cnt = $cnt + 1 @@ -126,7 +129,7 @@ EOF @ rothr = 0 foreach case ( ${cases} ) -if ( ${case} =~ *_${compiler}_* ) then +if ( ${case} =~ *_${envname}_* ) then # check that case results are meaningful set fbuild = `grep " ${case} " results.log | grep " build" | cut -c 1-4` @@ -292,7 +295,9 @@ cat >! ${outfile} << EOF - hash = ${hash} - hash created by ${hashuser} ${hashdate} - vers = ${vers} -- tested on ${mach}, ${compiler}, ${user}, ${cdat} ${ctim} UTC +- tested by ${user}, ${cdat} ${ctim} UTC +- ${mach} : ${machinfo} +- ${envname} : ${envinfo} - ${ttotl} total tests: ${tpass} pass, ${tfail} fail - ${ttotl} total regressions: ${rpass} pass, ${rfail} fail, ${rothr} other EOF @@ -326,9 +331,9 @@ if ($chk == 0) then cat >! ${hashfile} << EOF #### ${hash} -| machine | compiler | version | date | test fail | comp fail | total | +| machine | envname | version | date | test fail | comp fail | total | | ------ | ------ | ------ | ------ | ------ | ------ | ------ | -| ${mach} | ${compiler} | ${vers} | ${cdat} | ${tcolor} ${tfail}, ${tunkn} | ${rcolor} ${rfail}, ${rothr} | [${ttotl}](${ofile}) | +| ${mach} | ${envname} | ${vers} | ${cdat} | ${tcolor} ${tfail}, ${tunkn} | ${rcolor} ${rfail}, ${rothr} | [${ttotl}](${ofile}) | EOF if (-e ${hashfile}.prev) cat ${hashfile}.prev >> ${hashfile} @@ -336,7 +341,7 @@ if (-e ${hashfile}.prev) cat ${hashfile}.prev >> ${hashfile} else set oline = `grep -n "#### ${hash}" ${hashfile} | head -1 | cut -d : -f 1` @ nline = ${oline} + 3 - sed -i "$nline a | ${mach} | ${compiler} | ${vers} | ${cdat} | ${tcolor} ${tfail}, ${tunkn} | ${rcolor} ${rfail}, ${rothr} | [${ttotl}](${ofile}) | " ${hashfile} + sed -i "$nline a | ${mach} | ${envname} | ${vers} | ${cdat} | ${tcolor} ${tfail}, ${tunkn} | ${rcolor} ${rfail}, ${rothr} | [${ttotl}](${ofile}) | " ${hashfile} endif #===================== @@ -350,9 +355,9 @@ if ($chk == 0) then cat >! ${machfile} << EOF #### ${mach} -| version | hash | compiler | date | test fail | comp fail | total | +| version | hash | envname | date | test fail | comp fail | total | | ------ | ------ | ------ | ------ | ------ | ------ | ------ | -| ${vers} | ${shhash} | ${compiler} | ${cdat} | ${tcolor} ${tfail}, ${tunkn} | ${rcolor} ${rfail}, ${rothr} | [${ttotl}](${ofile}) | +| ${vers} | ${shhash} | ${envname} | ${cdat} | ${tcolor} ${tfail}, ${tunkn} | ${rcolor} ${rfail}, ${rothr} | [${ttotl}](${ofile}) | EOF if (-e ${machfile}.prev) cat ${machfile}.prev >> ${machfile} @@ -360,10 +365,10 @@ if (-e ${machfile}.prev) cat ${machfile}.prev >> ${machfile} else set oline = `grep -n "#### ${mach}" ${machfile} | head -1 | cut -d : -f 1` @ nline = ${oline} + 3 - sed -i "$nline a | ${vers} | ${shhash} | ${compiler} | ${cdat} | ${tcolor} ${tfail}, ${tunkn} | ${rcolor} ${rfail}, ${rothr} | [${ttotl}](${ofile}) | " ${machfile} + sed -i "$nline a | ${vers} | ${shhash} | ${envname} | ${cdat} | ${tcolor} ${tfail}, ${tunkn} | ${rcolor} ${rfail}, ${rothr} | [${ttotl}](${ofile}) | " ${machfile} endif -#foreach compiler +#foreach envname end #===================== diff --git a/doc/source/cice_index.rst b/doc/source/cice_index.rst index e2920c839..1884d03f1 100644 --- a/doc/source/cice_index.rst +++ b/doc/source/cice_index.rst @@ -91,6 +91,7 @@ either Celsius or Kelvin units). "bTiz", "temperature of ice layers on bio grid", "" "**C**", "", "" "c", "real(\ :math:`n`)", "" + "rotate_wind", ":math:`\bullet` if true, rotate wind/stress components to computational grid", "T" "calc_strair", ":math:`\bullet` if true, calculate wind stress", "T" "calc_Tsfc", ":math:`\bullet` if true, calculate surface temperature", "T" "Cdn_atm", "atmospheric drag coefficient", "" @@ -489,7 +490,7 @@ either Celsius or Kelvin units). "print_points", ":math:`\bullet` if true, print point data", "F" "processor_shape", ":math:`\bullet` descriptor for processor aspect ratio", "" "prs_sig", "replacement pressure", "N/m" - "Pstar", "ice strength parameter", "2.75\ :math:`\times`\ 10\ :math:`^4`\ N/m" + "Pstar", "ice strength parameter", "2.75\ :math:`\times`\ 10\ :math:`^4`\ N/m\ :math:`^2`" "puny", "a small positive number", "1\ :math:`\times`\ 10\ :math:`^{-11}`" "**Q**", "", "" "Qa", "specific humidity at 10 m", "kg/kg" diff --git a/doc/source/conf.py b/doc/source/conf.py index 32cf67fc2..840ef4a44 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -62,9 +62,9 @@ # built documents. # # The short X.Y version. -version = u'6.1.1' +version = u'6.1.2' # The full version, including alpha/beta/rc tags. -version = u'6.1.1' +version = u'6.1.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/developer_guide/dg_about.rst b/doc/source/developer_guide/dg_about.rst index bd06d7a3f..37318b2c5 100644 --- a/doc/source/developer_guide/dg_about.rst +++ b/doc/source/developer_guide/dg_about.rst @@ -20,9 +20,7 @@ Guiding principles for the creation of CICE include the following: Git workflow and Pull Requests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -There is extensive Information for Developers documentation available. -See https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index#information-for-developers -for information on: +There is extensive Information for Developers documentation available. See https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index#information-for-developers for information on: - Contributing to model development - Software development practices guide - git Workflow Guide - including extensive information about the Pull Request process and requirements diff --git a/doc/source/developer_guide/dg_dynamics.rst b/doc/source/developer_guide/dg_dynamics.rst index d9cc08841..0a48513dc 100644 --- a/doc/source/developer_guide/dg_dynamics.rst +++ b/doc/source/developer_guide/dg_dynamics.rst @@ -23,8 +23,7 @@ binary and netcdf files. **cicecore/drivers/** contains subdirectories that support stand-alone drivers and other high level coupling layers. -**cicecore/shared/** contains some basic methods related to grid decomposition, time managers, constants, -kinds, and restart capabilities. +**cicecore/shared/** contains some basic methods related to grid decomposition, time managers, constants, kinds, and restart capabilities. Dynamical Solvers @@ -72,7 +71,7 @@ Constants while others have internal defaults and can be set thru namelist. Dynamic Array Allocation ------------------- +------------------------------- CICE v5 and earlier was implemented using mainly static arrays and required several CPPs to be set to define grid size, blocks sizes, tracer numbers, and so forth. With CICE v6 and later, arrays are dynamically allocated and those diff --git a/doc/source/developer_guide/dg_other.rst b/doc/source/developer_guide/dg_other.rst index 7853cb66b..8d4f9716e 100644 --- a/doc/source/developer_guide/dg_other.rst +++ b/doc/source/developer_guide/dg_other.rst @@ -6,6 +6,27 @@ Other things ============= +.. _debugger: + +Running with a Debugger +------------------------- + +Availability and usage of interactive debuggers varies across machines. Contact your +system administrator for additional information about what’s available on your system. +To run with an interactive debugger, the following general steps should be taken. + +- Setup a case +- Modify the env file and Macros file to add appropriate modules and compiler/ linker flags +- Build the model +- Get interactive hardware resources as needed +- Open a csh shell +- Source the env.${machine} file +- Source cice.settings +- Change directories to the run directory +- Manually launch the executable thru the debugger + + + Reproducible Sums ---------------------- @@ -79,6 +100,7 @@ modified. Be careful not to have one command outside of a loop and the other command inside. Timers can be run for individual blocks, if desired, by including the block ID in the timer calls. + .. _addhist: Adding History fields @@ -155,14 +177,14 @@ the tracer dependencies (weights), which are tracked using the arrays ``trcr_base`` (a dependency mask), ``n_trcr_strata`` (the number of underlying tracer layers), and ``nt_strata`` (indices of underlying layers). Additional information about tracers can be found in the -`Icepack documentation `_. +`Icepack documentation `__. To add a tracer, follow these steps using one of the existing tracers as a pattern. 1) **icepack\_tracers.F90** and **icepack\_[tracer].F90**: declare tracers, add flags and indices, and create physics routines as described in the - `Icepack documentation `_ + `Icepack documentation `__ 2) **ice_arrays_column.F90**: declare arrays @@ -211,6 +233,6 @@ a pattern. configuration in **configuration/scripts/options**. 12) If strict conservation is necessary, add diagnostics as noted for - topo ponds in the `Icepack documentation `_. + topo ponds in the `Icepack documentation `__. 13) Update documentation, including **cice_index.rst** and **ug_case_settings.rst** diff --git a/doc/source/master_list.bib b/doc/source/master_list.bib index c2df631e5..caa93ec06 100644 --- a/doc/source/master_list.bib +++ b/doc/source/master_list.bib @@ -564,7 +564,7 @@ @Article{Wilchinsky04 pages = {2852-2856}, url = {http://dx.doi.org/10.1175/JPO2667.1} } -@Article{Lavoie05 +@Article{Lavoie05, author = "D. Lavoie and K. Denman and C. Michel", title = "{Modeling ice algal growth and decline in a seasonally ice- covered region of the Arctic (Resolute Passage, Canadian Archipelago)}", journal = JGRO, @@ -607,7 +607,7 @@ @Article{Hibler06 volume = {44}, url = {http://dx.doi.org/10.3189/172756406781811178} } -@Article{Jin06 +@Article{Jin06, author = "M. Jin and C. Deal and J. Wang and K.H. Shin and N. Tanaka and T.E. Whiteledge and S.H. Lee and R.R. Gradinger", title = "{Controls of the landfast ice-ocean ecosystem offshore Barrow, Alaska}", journal = AG, @@ -702,6 +702,15 @@ @Article{Large09 volume = {33}, url = {http://dx.doi.org/10.1007/s00382-008-0441-3} } +@Article{Tagliabue09, + author = "A. Tagliabue and L. Bopp and O. Aumont", + title = "{Evaluating the importance of atmospheric and sedimentary iron sources to Southern Ocean biogeochemistry}", + journal = GRL, + year = {2009}, + volume = {36}, + issue = {13}, + url = {http://dx.doi.org/10.1029/2009GL038914} +} @Article{Weiss09 author = "J. Weiss and E.M. Schulson", title = "{Coulombic faulting from the grain scale to the geophysical scale: lessons from ice}", diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst index 9d6e6f906..84d3633b1 100644 --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -15,18 +15,20 @@ for CICE. Variables in both files are described below. Table of CICE Settings -------------------------- -The **cice.settings** file is reasonably well self documented. Several of -the variables defined in the file are not used in CICE. They exist -to support the CICE model. +The **cice.settings** file contains a number of environment variables that define +configuration, file system, run, and build settings. Several variables are set +by the **cice.setup** script. This file is created on a case by case basis and +can be modified as needed. -.. csv-table:: *CICE settings* - :header: "variable", "options/format", "description", "recommended value" + +.. csv-table:: **CICE settings** + :header: "variable", "options/format", "description", "default value" :widths: 15, 15, 25, 20 "ICE_CASENAME", "string", "case name", "set by cice.setup" "ICE_SANDBOX", "string", "sandbox directory", "set by cice.setup" "ICE_MACHINE", "string", "machine name", "set by cice.setup" - "ICE_COMPILER", "string", "environment name", "set by cice.setup" + "ICE_ENVNAME", "string", "environment name", "set by cice.setup" "ICE_MACHCOMP", "string", "machine_environment name", "set by cice.setup" "ICE_SCRIPTS", "string", "scripts directory", "set by cice.setup" "ICE_CASEDIR", "string", "case directory", "set by cice.setup" @@ -69,7 +71,7 @@ to support the CICE model. "ICE_QUEUE", "string", "batch queue name", "set by cice.setup or by default" "ICE_THREADED", "true, false", "force threading in compile, will always compile threaded if ICE_NTHRDS :math:`> 1`", "false" "ICE_BLDDEBUG", "true, false", "turn on compile debug flags", "false" - "ICE_CODECOV", "true,false", "turn on code coverage flags", "false" + "ICE_COVERAGE", "true, false", "turn on code coverage flags", "false" .. _tabnamelist: @@ -78,353 +80,575 @@ to support the CICE model. Table of namelist options ------------------------------- -.. csv-table:: *Namelist options* - :header: "also in Icepack","variable", "options/format", "description", "recommended value" - :widths: 5, 15, 15, 30, 15 - - "","", "", "", "" - "","*setup_nml*", "", "", "" - "","", "", "**Time, Diagnostics**", "" - "\*","``days_per_year``", "``360`` or ``365``", "number of days in a model year", "365" - "\*","``use_leap_years``", "true/false", "if true, include leap days", "" - "\*","``year_init``", "yyyy", "the initial year, if not using restart", "" - "\*","``istep0``", "integer", "initial time step number", "0" - "\*","``dt``", "seconds", "thermodynamics time step length", "3600." - "\*","``npt``", "integer", "total number of time steps to take", "" - "\*","``ndtd``", "integer", "number of dynamics/advection/ridging/steps per thermo timestep", "1" - "","", "", "**Initialization/Restarting**", "" - "","``runtype``", "``initial``", "start from ``ice_ic``", "" - "","", "``continue``", "restart using ``pointer_file``", "" - "\*","``ice_ic``", "``default``", "latitude and sst dependent", "default" - "","", "``none``", "no ice", "" - "","", "path/file", "restart file name", "" - "","``restart``", "true/false", "initialize using restart file", "``.true.``" - "","``use_restart_time``", "true/false", "set initial date using restart file", "``.true.``" - "","``restart_format``", "string", "restart file format", "default" - "","", "default", "read/write restart files in default format", "" - "","", "pio_pnetcdf", "read/write restart files with pnetcdf in pio", "" - "","``lcdf64``", "true/false", "if true, use 64-bit  format", "" - "","``numin``", "integer", "minimum internal IO unit number", "11" - "","``numax``", "integer", "maximum internal IO unit number", "99" - "\*","``restart_dir``", "path/", "path to restart directory", "" - "","``restart_ext``", "true/false", "read/write halo cells in restart files", "" - "","``restart_file``", "filename prefix", "output file for restart dump", "‘iced’" - "","``pointer_file``", "pointer filename", "contains restart filename", "" - "\*","``dumpfreq``", "``y``", "write restart every ``dumpfreq_n`` years", "y" - "","", "``m``", "write restart every ``dumpfreq_n`` months", "" - "","", "``d``", "write restart every ``dumpfreq_n`` days", "" - "","", "``h``", "write restart every ``dumpfreq_n`` hours", "" - "","", "``1``", "write restart every ``dumpfreq_n`` time step", "" - "","``dumpfreq_n``", "integer", "frequency restart data is written", "1" - "\*","``dump_last``", "true/false", "if true, write restart on last time step of simulation", "" - "","", "", "**Model Output**", "" - "","``bfbflag``", "off/lsum4/lsum8/lsum16/ddpdd/reprosum", "global sum methods", "off" - "\*","``diagfreq``", "integer", "frequency of diagnostic output in ``dt``", "24" - "","", "*e.g.*, 10", "once every 10 time steps", "" - "\*","``diag_type``", "``stdout``", "write diagnostic output to stdout", "" - "","", "``file``", "write diagnostic output to file", "" - "","``diag_file``", "filename", "diagnostic output file (script may reset)", "" - "","``conserv_check``", "true/false", "check conservation", "``.false.``" - "","``print_global``", "true/false", "print diagnostic data, global sums", "``.false.``" - "","``print_points``", "true/false", "print diagnostic data for two grid points", "``.false.``" - "","``latpnt``", "real", "latitude of (2) diagnostic points", "" - "","``lonpnt``", "real", "longitude of (2) diagnostic points", "" - "","``dbug``", "true/false", "if true, write extra diagnostics", "``.false.``" - "","``histfreq``", "string array", "defines output frequencies", "" - "","", "``y``", "write history every ``histfreq_n`` years", "" - "","", "``m``", "write history every ``histfreq_n`` months", "" - "","", "``d``", "write history every ``histfreq_n`` days", "" - "","", "``h``", "write history every ``histfreq_n`` hours", "" - "","", "``1``", "write history every ``histfreq_n`` time step", "" - "","", "``x``", "unused frequency stream (not written)", "" - "","``histfreq_n``", "integer array", "frequency history output is written", "" - "","", "0", "do not write to history", "" - "","``hist_avg``", "true", "write time-averaged data", "``.true.``" - "","", "false", "write snapshots of data", "" - "","``history_dir``", "path/", "path to history output directory", "" - "","``history_file``", "filename prefix", "output file for history", "‘iceh’" - "","``history_precision``", "integer", "history file precision: 4 or 8 byte", "4" - "","``history_format``", "string", "history file format", "default" - "","", "default", "read/write restart files in default format", "" - "","", "pio_pnetcdf", "read/write restart files with pnetcdf in pio", "" - "","``write_ic``", "true/false", "write initial condition", "" - "","``incond_dir``", "path/", "path to initial condition directory", "" - "","``incond_file``", "filename prefix", "output file for initial condition", "‘iceh’" - "","``runid``", "string", "label for run (currently CESM only)", "" - "","", "", "", "" - "","*grid_nml*", "", "", "" - "","", "", "**Grid**", "" - "","``grid_format``", "``nc``", "read  grid and kmt files", "‘bin’" - "","", "``bin``", "read direct access, binary file", "" - "","``grid_type``", "``rectangular``", "defined in *rectgrid*", "" - "","", "``displaced_pole``", "read from file in *popgrid*", "" - "","", "``tripole``", "read from file in *popgrid*", "" - "","", "``regional``", "read from file in *popgrid*", "" - "","``grid_file``", "filename", "name of grid file to be read", "‘grid’" - "","``bathymetry_file``", "filename", "name of bathymetry file to be read", "‘grid’" - "","``use_bathymetry``", "true/false", "use read in bathymetry file for basalstress option", "" - "","``kmt_file``", "filename", "name of land mask file to be read", "‘kmt’" - "","``gridcpl_file``", "filename", "input file for coupling grid info", "" - "\*","``kcatbound``", "``0``", "original category boundary formula", "0" - "","", "``1``", "new formula with round numbers", "" - "","", "``2``", "WMO standard categories", "" - "","", "``-1``", "one category", "" - "","``dxrect``", "real", "x-direction grid spacing (cm) for rectangular grid", "" - "","``dyrect``", "real", "y-direction grid spacing (cm) for rectangular grid", "" - "","``ncat``", "integer", "number of ice thickness categories", "5" - "","``nfsd``", "integer", "number of floe size categories", "12 for prognostic FSD; 1 otherwise" - "","``nilyr``", "integer", "number of vertical layers in ice", "7" - "","``nslyr``", "integer", "number of vertical layers in snow", "1" - "","``nblyr``", "integer", "number of zbgc layers", "7" - "","", "", "", "" - "","*domain_nml*", "", "", "" - "","", "", "**Domain**", "" - "","``nprocs``", "integer", "number of processors to use", "" - "","``nx_global``", "integer", "global grid size in x direction", "" - "","``ny_global``", "integer", "global grid size in y direction", "" - "","``block_size_x``", "integer", "block size in x direction", "" - "","``block_size_y``", "integer", "block size in y direction", "" - "","``max_blocks``", "integer", "maximum number of blocks per MPI task for memory allocation", "" - "","``processor_shape``", "``slenderX1``", "1 processor in the y direction (tall, thin)", "" - "","", "``slenderX2``", "2 processors in the y direction (thin)", "" - "","", "``square-ice``", "more processors in x than y, :math:`\sim` square", "" - "","", "``square-pop``", "more processors in y than x, :math:`\sim` square", "" - "","``distribution_type``", "``cartesian``", "distribute blocks in 2D Cartesian array", "" - "","", "``roundrobin``", "1 block per proc until blocks are used", "" - "","", "``sectcart``", "blocks distributed to domain quadrants", "" - "","", "``sectrobin``", "several blocks per proc until used", "" - "","", "``rake``", "redistribute blocks among neighbors", "" - "","", "``spacecurve``", "distribute blocks via space-filling curves", "" - "","", "``spiralcenter``", "distribute blocks via roundrobin from center of grid outward in a spiral", "" - "","", "``wghtfile``", "distribute blocks based on weights specified in ``distribution_wght_file``", "" - "","``distribution_wght``", "``block``", "full block size sets ``work_per_block``", "" - "","", "``latitude``", "latitude/ocean sets ``work_per_block``", "" - "","``distribution_wght_file``", "filename", "distribution weight file when distribution_type is ``wghtfile``", "" - "","``ew_boundary_type``", "``cyclic``", "periodic boundary conditions in x-direction", "" - "","", "``open``", "Dirichlet boundary conditions in x", "" - "","``ns_boundary_type``", "``cyclic``", "periodic boundary conditions in y-direction", "" - "","", "``open``", "Dirichlet boundary conditions in y", "" - "","", "``tripole``", "U-fold tripole boundary conditions in y", "" - "","", "``tripoleT``", "T-fold tripole boundary conditions in y", "" - "","``maskhalo_dyn``", "true/false", "mask unused halo cells for dynamics", "" - "","``maskhalo_remap``", "true/false", "mask unused halo cells for transport", "" - "","``maskhalo_bound``", "true/false", "mask unused halo cells for boundary updates", "" - "","", "", "", "" - "","*tracer_nml*", "", "", "" - "","", "", "**Tracers**", "" - "","``n_aero``", "integer", "number of aerosol tracers", "1" - "","``n_iso``", "integer", "number of isotope tracers", "1" - "","``n_zaero``", "0,1,2,3,4,5,6", "number of z aerosol tracers in use", "0" - "","``n_algae``", "0,1,2,3", "number of algal tracers", "0" - "","``n_doc``", "0,1,2,3", "number of dissolved organic carbon", "0" - "","``n_dic``", "0,1", "number of dissolved inorganic carbon", "0" - "","``n_don``", "0,1", "number of dissolved organize nitrogen", "0" - "","``n_fed``", "0,1,2", "number of dissolved iron tracers", "0" - "","``n_fep``", "0,1,2", "number of particulate iron tracers", "0" - "\*","``tr_iage``", "true/false", "ice age", "" - "","``restart_age``", "true/false", "restart tracer values from file", "" - "\*","``tr_FY``", "true/false", "first-year ice area", "" - "","``restart_FY``", "true/false", "restart tracer values from file", "" - "\*","``tr_lvl``", "true/false", "level ice area and volume", "" - "","``restart_lvl``", "true/false", "restart tracer values from file", "" - "\*","``tr_pond_cesm``", "true/false", "CESM melt ponds", "" - "","``restart_pond_cesm``", "true/false", "restart tracer values from file", "" - "\*","``tr_pond_topo``", "true/false", "topo melt ponds", "" - "","``restart_pond_topo``", "true/false", "restart tracer values from file", "" - "\*","``tr_pond_lvl``", "true/false", "level-ice melt ponds", "" - "","``restart_pond_lvl``", "true/false", "restart tracer values from file", "" - "\*","``tr_aero``", "true/false", "aerosols", "" - "","``restart_aero``", "true/false", "restart tracer values from file", "" - "\*","``tr_iso``", "true/false", "isotopes", "" - "","``restart_iso``", "true/false", "restart tracer values from file", "" - "\*","``tr_fsd``", "true/false", "floe size distribution", "" - "","``restart_fsd``", "true/false", "restart floe size distribution values from file", "" - "","", "", "", "" - "","*thermo_nml*", "", "", "" - "","", "", "**Thermodynamics**", "" - "\*","``kitd``", "``0``", "delta function ITD approximation", "1" - "","", "``1``", "linear remapping ITD approximation", "" - "\*","``ktherm``", "``0``", "zero-layer thermodynamic model", "" - "","", "``1``", "Bitz and Lipscomb thermodynamic model", "" - "","", "``2``", "mushy-layer thermodynamic model", "" - "","", "``-1``", "thermodynamics disabled", "" - "\*","``conduct``", "``Maykut71``", "conductivity :cite:`Maykut71`", "" - "","", "``bubbly``", "conductivity :cite:`Pringle07`", "" - "\*","``ksno``", "real", "snow thermal conductivity", "0.3" - "\*","``a_rapid_mode``", "real", "brine channel diameter", "0.5x10 :math:`^{-3}` m" - "\*","``Rac_rapid_mode``", "real", "critical Rayleigh number", "10" - "\*","``aspect_rapid_mode``", "real", "brine convection aspect ratio", "1" - "\*","``dSdt_slow_mode``", "real", "drainage strength parameter", "-1.5x10 :math:`^{-7}` m/s/K" - "\*","``phi_c_slow_mode``", ":math:`0<\phi_c < 1`", "critical liquid fraction", "0.05" - "\*","``phi_i_mushy``", ":math:`0<\phi_i < 1`", "solid fraction at lower boundary", "0.85" - "","", "", "", "" - "","*dynamics_nml*", "", "", "" - "","", "", "**Dynamics**", "" - "","``kdyn``", "``-1``", "dynamics OFF", "1" - "","", "``0``", "dynamics OFF", "" - "","", "``1``", "EVP dynamics", "" - "","", "``2``", "EAP dynamics", "" - "","", "``1``", "dynamics ON", "" - "","``revised_evp``", "true/false", "use revised EVP formulation", "" - "","``ndte``", "integer", "number of EVP subcycles", "240" - "","``advection``", "``remap``", "linear remapping advection", "‘remap’" - "","", "``upwind``", "donor cell advection", "" - "\*","``kstrength``", "``0``", "ice strength formulation :cite:`Hibler79`", "1" - "","", "``1``", "ice strength formulation :cite:`Rothrock75`", "" - "\*","``krdg_partic``", "``0``", "old ridging participation function", "1" - "","", "``1``", "new ridging participation function", "" - "\*","``krdg_redist``", "``0``", "old ridging redistribution function", "1" - "","", "``1``", "new ridging redistribution function", "" - "\*","``mu_rdg``", "real", "e-folding scale of ridged ice", "" - "\*","``Cf``", "real", "ratio of ridging work to PE change in ridging", "17." - "","``coriolis``", "``latitude``", "Coriolis variable by latitude", "'latitude'" - "","", "``constant``", "Constant coriolis value = 1.46e-4", "" - "","", "``zero``", "Zero coriolis", "" - "","``kridge``", "``1``", "Ridging Enabled", "1" - "","", "``-1``", "Ridging Disabled", "" - "","``ktransport``", "``1``", "Transport Enabled", "1" - "","", "``-1``", "Transport Disabled", "" - "","``basalstress``", "true/false", "use basal stress parameterization for landfast ice", "" - "","``k1``", "real", "1st free parameter for landfast parameterization", "8." - "","``k2``", "real", "2nd free parameter (N/m^3) for landfast parameterization", "15." - "","``alphab``", "real", ":math:`\alpha_{b}` factor in :cite:`Lemieux16`", "20." - "","``threshold_hw``", "real", "Max water depth for grounding (see :cite:`Amundrud04`)", "30." - "","``e_ratio``", "real", "EVP ellipse aspect ratio", "2.0" - "","``Ktens``", "real", "Tensile strength factor (see :cite:`Konig10`)", "0.0" - "","", "", "", "" - "","*shortwave_nml*", "", "", "" - "","", "", "**Shortwave**", "" - "\*","``shortwave``", "``ccsm3``", "NCAR CCSM3 distribution method", "" - "","", "``dEdd``", "Delta-Eddington method", "" - "\*","``albedo_type``", "``ccsm3``", "NCAR CCSM3 albedos", "‘default’" - "","", "``constant``", "four constant albedos", "" - "\*","``albicev``", ":math:`0<\alpha <1`", "visible ice albedo for thicker ice", "" - "\*","``albicei``", ":math:`0<\alpha <1`", "near infrared ice albedo for thicker ice", "" - "\*","``albsnowv``", ":math:`0<\alpha <1`", "visible, cold snow albedo", "" - "\*","``albsnowi``", ":math:`0<\alpha <1`", "near infrared, cold snow albedo", "" - "\*","``ahmax``", "real", "albedo is constant above this thickness", "0.3 m" - "\*","``R_ice``", "real", "tuning parameter for sea ice albedo from Delta-Eddington shortwave", "" - "\*","``R_pnd``", "real", "... for ponded sea ice albedo …", "" - "\*","``R_snw``", "real", "... for snow (broadband albedo) …", "" - "\*","``dT_mlt``", "real", ":math:`\Delta` temperature per :math:`\Delta` snow grain radius", "" - "\*","``rsnw_mlt``", "real", "maximum melting snow grain radius", "" - "\*","``kalg``", "real", "absorption coefficient for algae", "" - "","", "", "", "" - "","*ponds_nml*", "", "", "" - "","", "", "**Melt Ponds**", "" - "\*","``hp1``", "real", "critical ice lid thickness for topo ponds", "0.01 m" - "\*","``hs0``", "real", "snow depth of transition to bare sea ice", "0.03 m" - "\*","``hs1``", "real", "snow depth of transition to pond ice", "0.03 m" - "\*","``dpscale``", "real", "time scale for flushing in permeable ice", ":math:`1\times 10^{-3}`" - "\*","``frzpnd``", "``hlid``", "Stefan refreezing with pond ice thickness", "‘hlid’" - "","", "``cesm``", "CESM refreezing empirical formula", "" - "\*","``rfracmin``", ":math:`0 \le r_{min} \le 1`", "minimum melt water added to ponds", "0.15" - "\*","``rfracmax``", ":math:`0 \le r_{max} \le 1`", "maximum melt water added to ponds", "1.0" - "\*","``pndaspect``", "real", "aspect ratio of pond changes (depth:area)", "0.8" - "","", "", "", "" - "","*forcing_nml*", "", "", "" - "","", "", "**Forcing**", "" - "\*","``formdrag``", "true/false", "calculate form drag", "" - "\*","``atmbndy``", "``default``", "stability-based boundary layer", "‘default’" - "","", "``constant``", "bulk transfer coefficients", "" - "\*","``fyear_init``", "yyyy", "first year of atmospheric forcing data", "" - "\*","``ycycle``", "integer", "number of years in forcing data cycle", "" - "\*","``calc_strair``", "true", "calculate wind stress and speed", "" - "","", "false", "read wind stress and speed from files", "" - "\*","``highfreq``", "true/false", "high-frequency atmo coupling", "" - "\*","``natmiter``", "integer", "number of atmo boundary layer iterations", "5" - "\*","``atmiter_conv``", "real", "convergence criteria for ustar", "0.0" - "\*","``calc_Tsfc``", "true/false", "calculate surface temperature", "``.true.``" - "\*","``default_season``","``winter``", "Sets initial values of forcing and is overwritten if forcing is read in.", "" - "\*","``precip_units``", "``mks``", "liquid precipitation data units", "" - "","", "``mm_per_month``", "", "" - "","", "``mm_per_sec``", "(same as MKS units)", "" - "","", "``m_per_sec``", "", "" - "\*","``tfrz_option``", "``minus1p8``", "constant ocean freezing temperature (:math:`-1.8^{\circ} C`)", "" - "","", "``linear_salt``", "linear function of salinity (ktherm=1)", "" - "","", "``mushy_layer``", "matches mushy-layer thermo (ktherm=2)", "" - "\*","``ustar_min``", "real", "minimum value of ocean friction velocity", "0.0005 m/s" - "\*","``emissivity``", "real", "emissivity of snow and ice", "0.95" - "\*","``fbot_xfer_type``", "``constant``", "constant ocean heat transfer coefficient", "" - "","", "``Cdn_ocn``", "variable ocean heat transfer coefficient", "" - "\*","``update_ocn_f``", "true", "include frazil water/salt fluxes in ocn fluxes", "" - "","", "false", "do not include (when coupling with POP)", "" - "\*","``l_mpond_fresh``", "true", "retain (topo) pond water until ponds drain", "" - "","", "false", "release (topo) pond water immediately to ocean", "" - "\*","``oceanmixed_ice``", "true/false", "active ocean mixed layer calculation", "``.true.`` (if uncoupled)" - "\*", "``wave_spec_type``", "``none``", "no wave data provided, no wave-ice interactions", "" - "", "", "``profile``", "no wave data file is provided, use fixed dummy wave spectrum, for testing", "" - "", "", "``constant``", "wave data file is provided, constant wave spectrum, for testing", "" - "", "", "``random``", "wave data file is provided, wave spectrum generated using random number", "" - "\*","``restore_ocn``", "true/false", "restore sst to data", "" - "\*","``trestore``", "integer", "sst restoring time scale (days)", "" - "","``restore_ice``", "true/false", "restore ice state along lateral boundaries", "" - "","``nfreq``", "25", "number of frequencies in ocean surface wave spectral forcing", "" - "\*","``atm_data_type``", "``default``", "constant values defined in the code", "" - "","", "``LYq``", "COREII Large-Yeager (AOMIP) forcing data", ":cite:`Large09`" - "","", "``JRA55_gx1``", "JRA55 forcing data for gx1 grid :cite:`Tsujino18`", "" - "","", "``JRA55_gx3``", "JRA55 forcing data for gx3 grid :cite:`Tsujino18`", "" - "","", "``JRA55_tx1``", "JRA55 forcing data for tx1 grid :cite:`Tsujino18`", "" - "","", "``monthly``", "monthly forcing data", "" - "","", "``ncar``", "NCAR bulk forcing data", "" - "","", "``box2001``", "forcing data for :cite:`Hunke01` box problem", "" - "","", "``oned``", "column forcing data", "" - "","", "``hycom``", "HYCOM atm forcing data in netcdf format", "" - "\*","``ocn_data_type``", "``default``", "constant values defined in the code", "" - "","", "``clim``", "climatological data", "" - "","", "``ncar``", "POP ocean forcing data", "" - "","", "``hycom``", "HYCOM ocean forcing data in netcdf format", "Constant initial forcing" - "","``bgc_data_type``", "``default``", "constant values defined in the code", "" - "","", "``clim``", "climatological data", "" - "","", "``ncar``", "POP ocean forcing data", "" - "","", "``hycom``", "HYCOM ocean forcing data in netcdf format", "Constant initial forcing" - "","``fe_data_type``", "``default``", "default forcing value for iron", "" - "","", "``clim``", "iron forcing from ocean climatology", "" - "","``ice_data_type``", "string", "ice initialization for special tests", "``default``" - "","", "``default``", "no special initialization", "" - "","", "``box2001``", "initialize ice concentration for :ref:`box2001` test (:cite:`Hunke01`)", "" - "","", "``boxslotcyl``", "initialize ice concentration and velocity for :ref:`boxslotcyl` test (:cite:`Zalesak79`)", "" - "","``atm_data_format``", "``nc``", "read  atmo forcing files", "" - "","", "``bin``", "read direct access, binary files", "" - "","``ocn_data_format``", "``nc``", "read  ocean forcing files", "" - "","", "``bin``", "read direct access, binary files", "" - "\*","``oceanmixed_file``", "filename", "data file containing ocean forcing data", "" - "\*","``wave_spec_file``", "filename", "data file containing wave spectrum forcing data", "" - "","``atm_data_dir``", "path/", "path to atmospheric forcing data directory", "" - "","``ocn_data_dir``", "path/", "path to oceanic forcing data directory", "" - "","``bgc_data_dir``", "path/", "path to oceanic forcing data directory", "" - "","", "", "", "" - "","*zbgc_nml*", "", "", "" - "","", "", "**Biogeochemistry**", "More information about the BGC tuning can be found in the `Icepack Documentation `_." - "\*","``tr_brine``", "true/false", "brine height tracer", "" - "\*","``tr_zaero``", "true/false", "vertical aerosol tracers", "" - "\*","``modal_aero``", "true/false", "modal aersols", "" - "","``restore_bgc``", "true/false", "restore bgc to data", "" - "","``solve_zsal``", "true/false", "update salinity tracer profile", "" - "\*","``skl_bgc``", "true/false", "biogeochemistry", "" - "","``bgc_flux_type``", "``Jin2006``", "ice–ocean flux velocity of :cite:`Jin06`", "" - "","", "``constant``", "constant ice–ocean flux velocity", "" - "","``restart_bgc``", "true/false", "restart tracer values from file", "" - "","``tr_bgc_C_sk``", "true/false", "algal carbon tracer", "" - "","``tr_bgc_chl_sk``", "true/false", "algal chlorophyll tracer", "" - "","``tr_bgc_Am_sk``", "true/false", "ammonium tracer", "" - "","``tr_bgc_Sil_sk``", "true/false", "silicate tracer", "" - "","``tr_bgc_DMSPp_sk``", "true/false", "particulate DMSP tracer", "" - "","``tr_bgc_DMSPd_sk``", "true/false", "dissolved DMSP tracer", "" - "","``tr_bgc_DMS_sk``", "true/false", "DMS tracer", "" - "","``phi_snow``", "real", "snow porosity for brine height tracer", "" - "","", "", "", "" - "","*icefields_nml*", "", "", "" - "","", "", "*History Fields*", "" - "","``f_``", "string", "frequency units for writing ```` to history", "" - "","", "``y``", "write history every ``histfreq_n`` years", "" - "","", "``m``", "write history every ``histfreq_n`` months", "" - "","", "``d``", "write history every ``histfreq_n`` days", "" - "","", "``h``", "write history every ``histfreq_n`` hours", "" - "","", "``1``", "write history every time step", "" - "","", "``x``", "do not write ```` to history", "" - "","", "``md``", "*e.g.,* write both monthly and daily files", "" - "","``f__ai``", "", "grid cell average of ```` (:math:`\times a_i`)", "" +CICE reads a namelist input file, **ice_in**, consisting of several namelist groups. The tables below +summarize the different groups and the variables in each group. The variables are organized alphabetically +and the default values listed are the values defined in the source code. Those values will be +used unless overridden by the CICE namelist file, **ice_in**. The source code default values as listed +in the table are not necessarily the recommended production values. + +setup_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **setup_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``bfbflag``", "``off``", "local reduction then global scalar sum", "``off``" + "", "``lsum4``", "local reduction with real*4 then global scalar sum", "" + "", "``lsum8``", "local reduction with real*8 then global scalar sum", "" + "", "``lsum16``", "local reduction with real*16 then global scalar sum", "" + "", "``ddpdd``", "parallel double double algorithm", "" + "", "``reprosum``", "fixed point double integer sum", "" + "``conserv_check``", "logical", "check conservation", "``.false.``" + "``cpl_bgc``", "logical", "couple bgc thru driver", "``.false.``" + "``days_per_year``", "integer", "number of days in a model year", "365" + "``dbug``", "logical", "write extra diagnostics", "``.false.``" + "``diagfreq``", "integer", "frequency of diagnostic output in timesteps", "24" + "``diag_type``", "``stdout``", "write diagnostic output to stdout", "``stdout``" + "", "``file``", "write diagnostic output to file", "" + "``diag_file``", "string", "diagnostic output file", "'ice_diag.d'" + "``dt``", "real", "thermodynamics time step length in seconds", "3600." + "``dumpfreq``", "``d``", "write restart every ``dumpfreq_n`` days", "``y``" + "", "``h``", "write restart every ``dumpfreq_n`` hours", "" + "", "``m``", "write restart every ``dumpfreq_n`` months", "" + "", "``y``", "write restart every ``dumpfreq_n`` years", "" + "", "``1``", "write restart every ``dumpfreq_n`` time step", "" + "``dumpfreq_n``", "integer", "write restart frequency with ``dumpfreq``", "1" + "``dump_last``", "logical", "write restart on last time step of simulation", "``.false.``" + "``hist_avg``", "logical", "write time-averaged data", "``.true.``" + "``histfreq``", "``d``", "write history every ``histfreq_n`` days", "'1','h','d','m','y'" + "", "``h``", "write history every ``histfreq_n`` hours", "" + "", "``m``", "write history every ``histfreq_n`` months", "" + "", "``x``", "unused frequency stream (not written)", "" + "", "``y``", "write history every ``histfreq_n`` years", "" + "", "``1``", "write history every ``histfreq_n`` time step", "" + "``histfreq_n``", "integer array", "frequency history output is written with ``histfreq``", "1,1,1,1,1" + "``history_dir``", "string", "path to history output directory", "'./'" + "``history_file``", "string", "output file for history", "'iceh'" + "``history_format``", "``default``", "read/write restart files in default format", "``default``" + "", "``pio_pnetcdf``", "read/write restart files with pnetcdf in pio", "" + "``history_precision``", "integer", "history file precision: 4 or 8 byte", "4" + "``ice_ic``", "``default``", "latitude and sst dependent initial condition", "``default``" + "", "``none``", "no ice", "" + "", "'path/file'", "restart file name", "" + "``incond_dir``", "string", "path to initial condition directory", "'./'" + "``incond_file``", "string", "output file prefix for initial condition", "‘iceh_ic’" + "``istep0``", "integer", "initial time step number", "0" + "``latpnt``", "real", "latitude of (2) diagnostic points", "90.0,-65.0" + "``lcdf64``", "logical", "use 64-bit netcdf format", "``.false.``" + "``lonpnt``", "real", "longitude of (2) diagnostic points", "0.0,-45.0" + "``ndtd``", "integer", "number of dynamics/advection/ridging/steps per thermo timestep", "1" + "``npt``", "integer", "total number of time steps to take", "99999" + "``numin``", "integer", "minimum internal IO unit number", "11" + "``numax``", "integer", "maximum internal IO unit number", "99" + "``pointer_file``", "string", "restart pointer filename", "'ice.restart_file'" + "``print_global``", "logical", "print global sums diagnostic data", "``.true.``" + "``print_points``", "logical", "print diagnostic data for two grid points", "``.false.``" + "``restart``", "logical", "initialize using restart file", "``.false.``" + "``restart_dir``", "string", "path to restart directory", "'./'" + "``restart_ext``", "logical", "read/write halo cells in restart files", "``.false.``" + "``restart_file``", "string", "output file prefix for restart dump", "'iced'" + "``restart_format``", "``default``", "read/write restart file with default format", "``default``" + "", "``pio_pnetcdf``", "read/write restart files with pnetcdf in pio", "" + "``runid``", "string", "label for run (currently CESM only)", "'unknown'" + "``runtype``", "``continue``", "restart using ``pointer_file``", "``initial``" + "", "``initial``", "start from ``ice_ic``", "" + "``use_leap_years``", "logical", "include leap days", "``.false.``" + "``use_restart_time``", "logical", "set initial date using restart file", "``.true.``" + "``version_name``", "string", "model version", "'unknown_version_name'" + "``write_ic``", "logical", "write initial condition", "``.false.``" + "``year_init``", "integer", "the initial year if not using restart", "0" + "", "", "", "" + +grid_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **grid_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``bathymetry_file``", "string", "name of bathymetry file to be read", "‘unknown_bathymetry_file’" + "``close_boundaries``", "logical", "set land on edges of grid", "``.false.``" + "``dxrect``", "real", "x-direction grid spacing for rectangular grid in cm", "0.0" + "``dyrect``", "real", "y-direction grid spacing for rectangular grid in cm", "0.0" + "``gridcpl_file``", "string", "input file for coupling grid info", "'unknown_gridcpl_file'" + "``grid_file``", "string", "name of grid file to be read", "'unknown_grid_file'" + "``grid_format``", "``bin``", "read direct access grid and kmt files", "``bin``" + "", "``nc``", "read grid and kmt files", "" + "``grid_type``", "``displaced_pole``", "read from file in *popgrid*", "``rectangular``" + "", "``rectangular``", "defined in *rectgrid*", "" + "", "``regional``", "read from file in *popgrid*", "" + "", "``tripole``", "read from file in *popgrid*", "" + "``kcatbound``", "``-1``", "single category formulation", "1" + "", "``0``", "old formulation", "" + "", "``1``", "new formulation with round numbers", "" + "", "``2``", "WMO standard categories", "" + "", "``3``", "asymptotic scheme", "" + "``kmt_file``", "string", "name of land mask file to be read", "'unknown_kmt_file'" + "``nblyr``", "integer", "number of zbgc layers", "0" + "``ncat``", "integer", "number of ice thickness categories", "0" + "``nfsd``", "integer", "number of floe size categories", "1" + "``nilyr``", "integer", "number of vertical layers in ice", "0" + "``nslyr``", "integer", "number of vertical layers in snow", "0" + "``use_bathymetry``", "logical", "use read in bathymetry file for basalstress option", "``.false.``" + "", "", "", "" + +domain_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **domain_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``block_size_x``", "integer", "block size in x direction", "-1" + "``block_size_y``", "integer", "block size in y direction", "-1" + "``distribution_type``", "``cartesian``", "2D cartesian block distribution method", "``cartesian``" + "", "``rake``", "redistribute blocks among neighbors", "" + "", "``roundrobin``", "1 block per proc until blocks are used", "" + "", "``sectcart``", "blocks distributed to domain quadrants", "" + "", "``sectrobin``", "several blocks per proc until used", "" + "", "``spacecurve``", "distribute blocks via space-filling curves", "" + "", "``spiralcenter``", "distribute blocks via roundrobin from center of grid outward in a spiral", "" + "", "``wghtfile``", "distribute blocks based on weights specified in ``distribution_wght_file``", "" + "``distribution_wght``", "``block``", "full block size distribution weight method", "``latitude``" + "", "``latitude``", "latitude/ocean sets ``work_per_block``", "" + "``distribution_wght_file``", "string", "distribution weight file when distribution_type is ``wghtfile``", "'unknown'" + "``ew_boundary_type``", "``cyclic``", "periodic boundary conditions in x-direction", "``cyclic``" + "", "``open``", "Dirichlet boundary conditions in x", "" + "``maskhalo_dyn``", "logical", "mask unused halo cells for dynamics", "``.false.``" + "``maskhalo_remap``", "logical", "mask unused halo cells for transport", "``.false.``" + "``maskhalo_bound``", "logical", "mask unused halo cells for boundary updates", "``.false.``" + "``max_blocks``", "integer", "maximum number of blocks per MPI task for memory allocation", "-1" + "``nprocs``", "integer", "number of processors to use", "-1" + "``ns_boundary_type``", "``cyclic``", "periodic boundary conditions in y-direction", "``open``" + "", "``open``", "Dirichlet boundary conditions in y", "" + "", "``tripole``", "U-fold tripole boundary conditions in y", "" + "", "``tripoleT``", "T-fold tripole boundary conditions in y", "" + "``nx_global``", "integer", "global grid size in x direction", "-1" + "``ny_global``", "integer", "global grid size in y direction", "-1" + "``processor_shape``", "``slenderX1``", "1 processor in the y direction used with ``distribution_type=cartesian``", "``slenderX2``" + "", "``slenderX1``", "1 processor in the y direction (tall, thin)", "" + "", "``slenderX2``", "2 processors in the y direction (thin)", "" + "", "``square-ice``", "more processors in x than y, :math:`\sim` square", "" + "", "``square-pop``", "more processors in y than x, :math:`\sim` square", "" + "", "", "", "" + +tracer_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **tracer_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``n_aero``", "integer", "number of aerosol tracers", "0" + "``n_algae``", "0,1,2,3", "number of algal tracers", "0" + "``n_dic``", "0,1", "number of dissolved inorganic carbon", "0" + "``n_doc``", "0,1,2,3", "number of dissolved organic carbon", "0" + "``n_don``", "0,1", "number of dissolved organize nitrogen", "0" + "``n_fed``", "0,1,2", "number of dissolved iron tracers", "0" + "``n_fep``", "0,1,2", "number of particulate iron tracers", "0" + "``n_iso``", "integer", "number of isotope tracers", "0" + "``n_zaero``", "0,1,2,3,4,5,6", "number of z aerosol tracers in use", "0" + "``tr_aero``", "logical", "aerosols", "``.false.``" + "``tr_fsd``", "logical", "floe size distribution", "``.false.``" + "``tr_FY``", "logical", "first-year ice area", "``.false.``" + "``tr_iage``", "logical", "ice age", "``.false.``" + "``tr_iso``", "logical", "isotopes", "``.false.``" + "``tr_lvl``", "logical", "level ice area and volume", "``.false.``" + "``tr_pond_cesm``", "logical", "CESM melt ponds", "``.false.``" + "``tr_pond_lvl``", "logical", "level-ice melt ponds", "``.false.``" + "``tr_pond_topo``", "logical", "topo melt ponds", "``.false.``" + "``restart_aero``", "logical", "restart tracer values from file", "``.false.``" + "``restart_age``", "logical", "restart tracer values from file", "``.false.``" + "``restart_fsd``", "logical", "restart floe size distribution values from file", "``.false.``" + "``restart_FY``", "logical", "restart tracer values from file", "``.false.``" + "``restart_iso``", "logical", "restart tracer values from file", "``.false.``" + "``restart_lvl``", "logical", "restart tracer values from file", "``.false.``" + "``restart_pond_cesm``", "logical", "restart tracer values from file", "``.false.``" + "``restart_pond_lvl``", "logical", "restart tracer values from file", "``.false.``" + "``restart_pond_topo``", "logical", "restart tracer values from file", "``.false.``" + "", "", "", "" + +thermo_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **thermo_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``a_rapid_mode``", "real", "brine channel diameter in m", "0.5e-3" + "``aspect_rapid_mode``", "real", "brine convection aspect ratio", "1.0" + "``conduct``", "``bubbly``", "conductivity scheme :cite:`Pringle07`", "``bubbly``" + "", "``MU71``", "conductivity :cite:`Maykut71`", "" + "``dSdt_slow_mode``", "real", "slow drainage strength parameter m/s/K", "-1.5e-7" + "``kitd``", "``0``", "delta function ITD approximation", "1" + "", "``1``", "linear remapping ITD approximation", "" + "``ksno``", "real", "snow thermal conductivity", "0.3" + "``ktherm``", "``-1``", "thermodynamic model disabled", "1" + "", "``0``", "zero-layer thermodynamic model", "" + "", "``1``", "Bitz and Lipscomb thermodynamic model", "" + "", "``2``", "mushy-layer thermodynamic model", "" + "``phi_c_slow_mode``", ":math:`0<\phi_c < 1`", "critical liquid fraction", "0.05" + "``phi_i_mushy``", ":math:`0<\phi_i < 1`", "solid fraction at lower boundary", "0.85" + "``Rac_rapid_mode``", "real", "critical Rayleigh number", "10.0" + "", "", "", "" + +dynamics_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **dynamics_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``advection``", "``remap``", "linear remapping advection scheme", "``remap``" + "", "``upwind``", "donor cell advection", "" + "``alphab``", "real", ":math:`\alpha_{b}` factor in :cite:`Lemieux16`", "20.0" + "``arlx``", "real", "revised_evp value", "300.0" + "``brlx``", "real", "revised_evp value", "300.0" + "``basalstress``", "logical", "use basal stress parameterization for landfast ice", "``.false.``" + "``Cf``", "real", "ratio of ridging work to PE change in ridging", "17.0" + "``coriolis``", "``constant``", "constant coriolis value = 1.46e-4", "``latitude``" + "``Cstar``", "real", "constant in Hibler strength formula", "20" + "", "``latitude``", "coriolis variable by latitude", "" + "", "``zero``", "zero coriolis", "" + "``e_ratio``", "real", "EVP ellipse aspect ratio", "2.0" + "``kdyn``", "``-1``", "dynamics algorithm OFF", "1" + "", "``0``", "dynamics OFF", "" + "", "``1``", "EVP dynamics", "" + "", "``2``", "EAP dynamics", "" + "``kevp_kernel``", "``0``", "standard 2D EVP memory parallel solver", "0" + "", "``2``", "1D shared memory solver (not fully validated)", "" + "``kstrength``", "``0``", "ice strength formulation :cite:`Hibler79`", "1" + "", "``1``", "ice strength formulation :cite:`Rothrock75`", "" + "``krdg_partic``", "``0``", "old ridging participation function", "1" + "", "``1``", "new ridging participation function", "" + "``krdg_redist``", "``0``", "old ridging redistribution function", "1" + "", "``1``", "new ridging redistribution function", "" + "``kridge``", "``-1``", "ridging disabled", "1" + "", "``1``", "ridging enabled", "" + "``ktransport``", "``-1``", "transport disabled", "1" + "", "``1``", "transport enabled", "" + "``Ktens``", "real", "Tensile strength factor (see :cite:`Konig10`)", "0.0" + "``k1``", "real", "1st free parameter for landfast parameterization", "8.0" + "``k2``", "real", "2nd free parameter (N/m\ :math:`^3`) for landfast parameterization", "15.0" + "``mu_rdg``", "real", "e-folding scale of ridged ice for ``krdg_partic`` = 1 in m^0.5", "3.0" + "``ndte``", "integer", "number of EVP subcycles", "120" + "``Pstar``", "real", "constant in Hibler strength formula (N/m\ :math:`^2`)", "2.75e4" + "``revised_evp``", "logical", "use revised EVP formulation", "``.false.``" + "``threshold_hw``", "real", "Max water depth for grounding (see :cite:`Amundrud04`)", "30." + "``yield_curve``", "``ellipse``", "elliptical yield curve", "``ellipse``" + "", "", "", "" + +shortwave_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **shortwave_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``ahmax``", "real", "albedo is constant above this thickness in meters", "0.3" + "``albedo_type``", "`ccsm3``", "NCAR CCSM3 albedo implementation", "``ccsm3``" + "", "``constant``", "four constant albedos", "" + "``albicei``", ":math:`0<\alpha <1`", "near infrared ice albedo for thicker ice", "0.36" + "``albicev``", ":math:`0<\alpha <1`", "visible ice albedo for thicker ice", "0.78" + "``albsnowi``", ":math:`0<\alpha <1`", "near infrared, cold snow albedo", "0.70" + "``albsnowv``", ":math:`0<\alpha <1`", "visible, cold snow albedo", "0.98" + "``dT_mlt``", "real", ":math:`\Delta` temperature per :math:`\Delta` snow grain radius", "1.5" + "``kalg``", "real", "absorption coefficient for algae", "0.6" + "``rsnw_mlt``", "real", "maximum melting snow grain radius", "1500." + "``R_ice``", "real", "tuning parameter for sea ice albedo from Delta-Eddington shortwave", "0.0" + "``R_pnd``", "real", "tuning parameter for ponded sea ice albedo from Delta-Eddington shortwave", "0.0" + "``R_snw``", "real", "tuning parameter for snow (broadband albedo) from Delta-Eddington shortwave", "1.5" + "``shortwave``", "``ccsm3``", "NCAR CCSM3 shortwave distribution method", "``ccsm3``" + "", "``dEdd``", "Delta-Eddington method", "" + "", "", "", "" + +ponds_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **ponds_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``dpscale``", "real", "time scale for flushing in permeable ice", "1.0" + "``frzpnd``", "``cesm``", "CESM pond refreezing forumulation", "``cesm``" + "", "``hlid``", "Stefan refreezing with pond ice thickness", "" + "``hp1``", "real", "critical ice lid thickness for topo ponds in m", "0.01" + "``hs0``", "real", "snow depth of transition to bare sea ice in m", "0.03" + "``hs1``", "real", "snow depth of transition to pond ice in m", "0.03" + "``pndaspect``", "real", "aspect ratio of pond changes (depth:area)", "0.8" + "``rfracmax``", ":math:`0 \le r_{max} \le 1`", "maximum melt water added to ponds", "0.85" + "``rfracmin``", ":math:`0 \le r_{min} \le 1`", "minimum melt water added to ponds", "0.15" + "", "", "", "" + +forcing_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **forcing_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``atmbndy``", "``constant``", "bulk transfer coefficients", "``default``" + "", "``default``", "stability-based boundary layer", "" + "``atmiter_conv``", "real", "convergence criteria for ustar", "0.0" + "``atm_data_dir``", "string", "path to atmospheric forcing data directory", "" + "``atm_data_format``", "``bin``", "read direct access binary atmo forcing file format", "``bin``" + "", "``nc``", "read netcdf atmo forcing files", "" + "``atm_data_type``", "``box2001``", "forcing data for :cite:`Hunke01` box problem", "``default``" + "", "``default``", "constant values defined in the code", "" + "", "``hycom``", "HYCOM atm forcing data in netcdf format", "" + "", "``JRA55_gx1``", "JRA55 forcing data for gx1 grid :cite:`Tsujino18`", "" + "", "``JRA55_gx3``", "JRA55 forcing data for gx3 grid :cite:`Tsujino18`", "" + "", "``JRA55_tx1``", "JRA55 forcing data for tx1 grid :cite:`Tsujino18`", "" + "", "``LYq``", "COREII Large-Yeager (AOMIP) forcing data :cite:`Large09`", "" + "", "``monthly``", "monthly forcing data", "" + "", "``ncar``", "NCAR bulk forcing data", "" + "", "``oned``", "column forcing data", "" + "``bgc_data_dir``", "string", "path to oceanic forcing data directory", "'unknown_bgc_data_dir'" + "``bgc_data_type``", "``clim``", "bgc climatological data", "``default``" + "", "``default``", "constant values defined in the code", "" + "", "``hycom``", "HYCOM ocean forcing data in netcdf format", "" + "", "``ncar``", "POP ocean forcing data", "" + "``calc_strair``", "``.false.``", "read wind stress and speed from files", "``.true.``" + "", "``.true.``", "calculate wind stress and speed", "" + "``calc_Tsfc``", "logical", "calculate surface temperature", "``.true.``" + "``default_season``", "``summer``", "forcing initial summer values", "``winter``" + "", "``winter``", "forcing initial winter values", "" + "``emissivity``", "real", "emissivity of snow and ice", "0.95" + "``fbot_xfer_type``", "``Cdn_ocn``", "variabler ocean heat transfer coefficient scheme", "``constant``" + "", "``constant``", "constant ocean heat transfer coefficient", "" + "``fe_data_type``", "``clim``", "ocean climatology forcing value for iron", "``default``" + "", "``default``", "default forcing value for iron", "" + "``formdrag``", "logical", "calculate form drag", "``.false.``" + "``fyear_init``", "integer", "first year of atmospheric forcing data", "1900" + "``highfreq``", "logical", "high-frequency atmo coupling", "``.false.``" + "``ice_data_type``", "``boxslotcyl``", "initialize ice concentration and velocity for :ref:`boxslotcyl` test (:cite:`Zalesak79`)", "``default``" + "", "``box2001``", "initialize ice concentration for :ref:`box2001` test (:cite:`Hunke01`)", "" + "", "``default``", "no special initialization", "" + "``l_mpond_fresh``", "``.false.``", "release pond water immediately to ocean", "``.false.``" + "", "``true``", "retain (topo) pond water until ponds drain", "" + "``natmiter``", "integer", "number of atmo boundary layer iterations", "5" + "``nfreq``", "integer", "number of frequencies in ocean surface wave spectral forcing", "25" + "``oceanmixed_file``", "string", "data file containing ocean forcing data", "'unknown_oceanmixed_file'" + "``oceanmixed_ice``", "logical", "active ocean mixed layer calculation", "``.false.``" + "``ocn_data_dir``", "string", "path to oceanic forcing data directory", "'unknown_ocn_data_dir'" + "``ocn_data_format``", "``bin``", "read direct access binary ocean forcing files", "``bin``" + "", "``nc``", "read netcdf ocean forcing files", "" + "``ocn_data_type``", "``clim``", "ocean climatological data formulation", "``default``" + "", "``default``", "constant values defined in the code", "" + "", "``hycom``", "HYCOM ocean forcing data in netcdf format", "" + "", "``ncar``", "POP ocean forcing data", "" + "``precip_units``", "``mks``", "liquid precipitation data units", "``mks``" + "", "``mm_per_month``", "", "" + "", "``mm_per_sec``", "(same as MKS units)", "" + "", "``m_per_sec``", "", "" + "``restore_ocn``", "logical", "restore sst to data", "``.false.``" + "``restore_ice``", "logical", "restore ice state along lateral boundaries", "``.false.``" + "``tfrz_option``", "``linear_salt``", "linear functino of salinity (ktherm=1)", "``mushy``" + "", "``minus1p8``", "constant ocean freezing temperature (:math:`-1.8^{\circ} C`)", "" + "", "``mushy``", "matches mushy-layer thermo (ktherm=2)", "" + "``trestore``", "integer", "sst restoring time scale (days)", "90" + "``ustar_min``", "real", "minimum value of ocean friction velocity", "0.0005 m/s" + "``update_ocn_f``", "``.false.``", "do not include frazil water/salt fluxes in ocn fluxes", "``.false.``" + "", "``true``", "include frazil water/salt fluxes in ocn fluxes", "" + "``wave_spec_file``", "string", "data file containing wave spectrum forcing data", "" + "``wave_spec_type``", "``constant``", "wave data file is provided, constant wave spectrum, for testing", "``none``" + "", "``none``", "no wave data provided, no wave-ice interactions", "" + "", "``profile``", "no wave data file is provided, use fixed dummy wave spectrum, for testing", "" + "", "``random``", "wave data file is provided, wave spectrum generated using random number", "" + "``ycycle``", "integer", "number of years in forcing data cycle", "1" + "", "", "", "" + +zbgc_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **zbgc_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``algaltype_diatoms``", "real", "mobility type between stationary and mobile algal diatoms", "0.0" + "``algaltype_phaeo``", "real", "mobility type between stationary and mobile algal phaeocystis", "0.5" + "``algaltype_sp``", "real", "mobility type between stationary and mobile small plankton", "0.5" + "``algal_vel``", "real", ":cite:`Lavoie05`", "1.11e-8" + "``alpha2max_low_diatoms``", "real", "light limitation diatoms 1/(W/m^2)", "0.8" + "``alpha2max_low_phaeo``", "real", "light limitation phaeocystis 1/(W/m^2)", "0.67" + "``alpha2max_low_sp``", "real", "light limitation small plankton 1/(W/m^2)", "0.67" + "``ammoniumtype``", "real", "mobility type between stationary and mobile ammonium", "1.0" + "``beta2max_diatoms``", "real", "light inhibition diatoms 1/(W/m^2)", "0.18" + "``beta2max_phaeo``", "real", "light inhibition phaeocystis 1/(W/m^2)", "0.01" + "``beta2max_sp``", "real", "light inhibition small plankton 1/(W/m^2)", "0.0025" + "``bgc_flux_type``", "``constant``", "constant ice–ocean flux velocity", "``Jin2006``" + "", "``Jin2006``", "ice–ocean flux velocity of :cite:`Jin06`", "" + "``chlabs_diatoms``", "real", "chl absorbtion diatoms 1/m/(mg/m^3)", "0.03" + "``chlabs_phaeo``", "real", "chl absorbtion phaeocystis 1/m/(mg/m^3)", "0.05" + "``chlabs_sp``", "real", "chl absorbtion small plankton 1/m/(mg/m^3)", "0.01" + "``dEdd_algae``", "logical", "", "``.false.``" + "``dmspdtype``", "real", "mobility type between stationary and mobile dmspd", "-1.0" + "``dmspptype``", "real", "mobility type between stationary and mobile dmspp", "0.5" + "``doctype_l``", "real", "mobility type between stationary and mobile doc lipids", "0.5" + "``doctype_s``", "real", "mobility type between stationary and mobile doc saccharids", "0.5" + "``dontype_protein``", "real", "mobility type between stationary and mobile don proteins", "0.5" + "``dustFe_sol``", "real", "solubility fraction", "0.005" + "``fedtype_1``", "real", "mobility type between stationary and mobile fed lipids", "0.5" + "``feptype_1``", "real", "mobility type between stationary and mobile fep lipids", "0.5" + "``frazil_scav``", "real", "increase in initial bio bracer from ocean scavenging", "1.0" + "``fr_dFe``", "real", "fraction of remineralized nitrogen in units of algal iron", "0.3" + "``fr_graze_diatoms``", "real", "fraction grazed diatoms", "0.01" + "``fr_graze_e``", "real", "fraction of assimilation excreted", "0.5" + "``fr_graze_phaeo``", "real", "fraction grazed phaeocystis", "0.1" + "``fr_graze_s``", "real", "fraction of grazing spilled or slopped", "0.5" + "``fr_graze_sp``", "real", "fraction grazed small plankton", "0.1" + "``fr_mort2min``", "real", "fractionation of mortality to Am", "0.5" + "``fr_resp``", "real", "frac of algal growth lost due to respiration", "0.05" + "``fr_resp_s``", "real", "DMSPd fraction of respiration loss as DMSPd", "0.75" + "``fsal``", "real", "salinity limitation ppt", "1.0" + "``F_abs_chl_diatoms``", "real", "scales absorbed radiation for dEdd chl diatoms", "2.0" + "``F_abs_chl_phaeo``", "real", "scales absorbed radiation for dEdd chl phaeocystis", "5.0" + "``F_abs_chl_sp``", "real", "scales absorbed radiation for dEdd small plankton", "4.0" + "``f_doc_l``", "real", "fraction of mortality to DOC lipids", "0.4" + "``f_doc_s``", "real", "fraction of mortality to DOC saccharides", "0.4" + "``f_don_Am_protein``", "real", "fraction of remineralized DON to ammonium", "0.25" + "``f_don_protein``", "real", "fraction of spilled grazing to proteins", "0.6" + "``f_exude_l``", "real", "fraction of exudation to DOC lipids", "1.0" + "``f_exude_s``", "real", "fraction of exudation to DOC saccharids", "1.0" + "``grid_o``", "real", "z biology for bottom flux", "5.0" + "``grid_o_t``", "real", "z biology for top flux", "5.0" + "``grid_oS``", "real", "z salinity for bottom flux", "5.0" + "``grow_Tdep_diatoms``", "real", "temperature dependence growth diatoms per degC", "0.06" + "``grow_Tdep_phaeo``", "real", "temperature dependence growth phaeocystis per degC", "0.06" + "``grow_Tdep_sp``", "real", "temperature dependence growth small plankton per degC", "0.06" + "``humtype``", "real", "mobility type between stationary and mobile hum", "1.0" + "``initbio_frac``", "real", "fraction of ocean trcr concentration in bio tracers", "1.0" + "``K_Am_diatoms``", "real", "ammonium half saturation diatoms mmol/m^3", "0.3" + "``K_Am_phaeo``", "real", "ammonium half saturation phaeocystis mmol/m^3", "0.3" + "``K_Am_sp``", "real", "ammonium half saturation small plankton mmol/m^3", "0.3" + "``k_bac_l``", "real", "Bacterial degredation of DOC lipids per day", "0.03" + "``k_bac_s``", "real", "Bacterial degredation of DOC saccharids per day", "0.03" + "``k_exude_diatoms``", "real", "algal exudation diatoms per day", "0.0" + "``k_exude_phaeo``", "real", "algal exudation phaeocystis per day", "0.0" + "``k_exude_sp``", "real", "algal exudation small plankton per day", "0.0" + "``K_Fe_diatoms``", "real", "iron half saturation diatoms nM", "1.0" + "``K_Fe_phaeo``", "real", "iron half saturation phaeocystis nM", "0.1" + "``K_Fe_sp``", "real", "iron half saturation small plankton nM", "0.2" + "``k_nitrif``", "real", "nitrification rate per day", "0.0" + "``K_Nit_diatoms``", "real", "nitrate half saturation diatoms mmol/m^3", "1.0" + "``K_Nit_phaeo``", "real", "nitrate half saturation phaeocystis mmol/m^3", "1.0" + "``K_Nit_sp``", "real", "nitrate half saturation small plankton mmol/m^3", "1.0" + "``K_Sil_diatoms``", "real", "silicate half saturation diatoms mmol/m^3", "4.0" + "``K_Sil_phaeo``", "real", "silicate half saturation phaeocystis mmol/m^3", "0.0" + "``K_Sil_sp``", "real", "silicate half saturation small plankton mmol/m^3", "0.0" + "``kn_bac_protein``", "real", "bacterial degradation of DON per day", "0.03" + "``l_sk``", "real", "characteristic diffusive scale in m", "7.0" + "``l_skS``", "real", "z salinity characteristic diffusive scale in m", "7.0" + "``max_dfe_doc1``", "real", "max ratio of dFe to saccharides in the ice in nm Fe / muM C", "0.2" + "``max_loss``", "real", "restrict uptake to percent of remaining value", "0.9" + "``modal_aero``", "logical", "modal aersols", "``.false.``" + "``mort_pre_diatoms``", "real", "mortality diatoms", "0.007" + "``mort_pre_phaeo``", "real", "mortality phaeocystis", "0.007" + "``mort_pre_sp``", "real", "mortality small plankton", "0.007" + "``mort_Tdep_diatoms``", "real", "temperature dependence of mortality diatoms per degC", "0.03" + "``mort_Tdep_phaeo``", "real", "temperature dependence of mortality phaeocystis per degC", "0.03" + "``mort_Tdep_sp``", "real", "temperature dependence of mortality small plankton per degC", "0.03" + "``mu_max_diatoms``", "real", "maximum growth rate diatoms per day", "1.2" + "``mu_max_phaeo``", "real", "maximum growth rate phaeocystis per day", "0.851" + "``mu_max_sp``", "real", "maximum growth rate small plankton per day", "0.851" + "``nitratetype``", "real", "mobility type between stationary and mobile nitrate", "-1.0" + "``op_dep_min``", "real", "light attenuates for optical depths exceeding min", "0.1" + "``phi_snow``", "real", "snow porosity for brine height tracer", "0.5" + "``ratio_chl2N_diatoms``", "real", "algal chl to N in mg/mmol diatoms", "2.1" + "``ratio_chl2N_phaeo``", "real", "algal chl to N in mg/mmol phaeocystis", "0.84" + "``ratio_chl2N_sp``", "real", "algal chl to N in mg/mmol small plankton", "1.1" + "``ratio_C2N_diatoms``", "real", "algal C to N in mol/mol diatoms", "7.0" + "``ratio_C2N_phaeo``", "real", "algal C to N in mol/mol phaeocystis", "7.0" + "``ratio_C2N_proteins``", "real", "algal C to N in mol/mol proteins", "7.0" + "``ratio_C2N_sp``", "real", "algal C to N in mol/mol small plankton", "7.0" + "``ratio_Fe2C_diatoms``", "real", "algal Fe to C in umol/mol diatoms", "0.0033" + "``ratio_Fe2C_phaeo``", "real", "algal Fe to C in umol/mol phaeocystis", "1.0" + "``ratio_Fe2C_sp``", "real", "algal Fe to C in umol/mol small plankton", "0.0033" + "``ratio_Fe2N_diatoms``", "real", "algal Fe to N in umol/mol diatoms", "0.23" + "``ratio_Fe2N_phaeo``", "real", "algal Fe to N in umol/mol phaeocystis", "0.7" + "``ratio_Fe2N_sp``", "real", "algal Fe to N in umol/mol small plankton", "0.23" + "``ratio_Fe2DOC_s``", "real", "Fe to C of DON saccharids nmol/umol", "1.0" + "``ratio_Fe2DOC_l``", "real", "Fe to C of DOC lipids nmol/umol", "0.033" + "``ratio_Fe2DON``", "real", "Fe to C of DON nmol/umol", "0.023" + "``ratio_Si2N_diatoms``", "real", "algal Si to N in mol/mol diatoms", "1.8" + "``ratio_Si2N_phaeo``", "real", "algal Si to N in mol/mol phaeocystis", "0.0" + "``ratio_Si2N_sp``", "real", "algal Si to N in mol/mol small plankton", "0.0" + "``ratio_S2N_diatoms``", "real", "algal S to N in mol/mol diatoms", "0.03" + "``ratio_S2N_phaeo``", "real", "algal S to N in mol/mol phaeocystis", "0.03" + "``ratio_S2N_sp``", "real", "algal S to N in mol/mol small plankton", "0.03" + "``restart_bgc``", "logical", "restart tracer values from file", "``.false.``" + "``restart_hbrine``", "logical", "", "``.false.``" + "``restart_zsal``", "logical", "", "``.false.``" + "``restore_bgc``", "logical", "restore bgc to data", "``.false.``" + "``R_dFe2dust``", "real", "g/g :cite:`Tagliabue09`", "0.035" + "``scale_bgc``", "logical", "", "``.false.``" + "``silicatetype``", "real", "mobility type between stationary and mobile silicate", "-1.0" + "``skl_bgc``", "logical", "biogeochemistry", "``.false.``" + "``solve_zbgc``", "logical", "", "``.false.``" + "``solve_zsal``", "logical", "update salinity tracer profile", "``.false.``" + "``tau_max``", "real", "long time mobile to stationary exchanges", "1.73e-5" + "``tau_min``", "real", "rapid module to stationary exchanges", "5200." + "``tr_bgc_Am``", "logical", "ammonium tracer", "``.false.``" + "``tr_bgc_C``", "logical", "algal carbon tracer", "``.false.``" + "``tr_bgc_chl``", "logical", "algal chlorophyll tracer", "``.false.``" + "``tr_bgc_DMS``", "logical", "DMS tracer", "``.false.``" + "``tr_bgc_DON``", "logical", "DON tracer", "``.false.``" + "``tr_bgc_Fe``", "logical", "iron tracer", "``.false.``" + "``tr_bgc_hum``", "logical", "", "``.false.``" + "``tr_bgc_Nit``", "logical", "", "``.false.``" + "``tr_bgc_PON``", "logical", "PON tracer", "``.false.``" + "``tr_bgc_Sil``", "logical", "silicate tracer", "``.false.``" + "``tr_brine``", "logical", "brine height tracer", "``.false.``" + "``tr_zaero``", "logical", "vertical aerosol tracers", "``.false.``" + "``t_iron_conv``", "real", "desorption loss pFe to dFe in days", "3065." + "``t_sk_conv``", "real", "Stefels conversion time in days", "3.0" + "``t_sk_ox``", "real", "DMS oxidation time in days", "10.0" + "``T_max``", "real", "maximum temperature degC", "0.0" + "``y_sk_DMS``", "real", "fraction conversion given high yield", "0.5" + "``zaerotype_bc1``", "real", "mobility type between stationary and mobile zaero bc1", "1.0" + "``zaerotype_bc2``", "real", "mobility type between stationary and mobile zaero bc2", "1.0" + "``zaerotype_dust1``", "real", "mobility type between stationary and mobile zaero dust1", "1.0" + "``zaerotype_dust2``", "real", "mobility type between stationary and mobile zaero dust2", "1.0" + "``zaerotype_dust3``", "real", "mobility type between stationary and mobile zaero dust3", "1.0" + "``zaerotype_dust4``", "real", "mobility type between stationary and mobile zaero dust4", "1.0" + "``z_tracers``", "logical", "", "``.false.``" + "", "", "", "" + + +icefields_nml +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. csv-table:: **icefields_nml namelist options** + :header: "variable", "options/format", "description", "default value" + :widths: 15, 15, 30, 15 + + "", "", "", "" + "``f_``", "``d``", "write field var every ``histfreq_n`` days", "" + "", "``h``", "write field var every ``histfreq_n`` hours", "" + "", "``m``", "write field var every ``histfreq_n`` months", "" + "", "``x``", "do not write var to history", "" + "", "``y``", "write field var every ``histfreq_n`` years", "" + "", "``1``", "write field var every time step", "" + "", "``md``", "*e.g.,* write both monthly and daily files", "" + "``f__ai``", "``d``", "write field cell average var every ``histfreq_n`` days", "" + "", "``h``", "write field cell average var every ``histfreq_n`` hours", "" + "", "``m``", "write field cell average var every ``histfreq_n`` months", "" + "", "``x``", "do not write cell average var to history", "" + "", "``y``", "write field cell average var every ``histfreq_n`` years", "" + "", "``1``", "write field cell average var every time step", "" + "", "``md``", "*e.g.,* write both monthly and daily files", "" + "", "", "", "" diff --git a/doc/source/user_guide/ug_running.rst b/doc/source/user_guide/ug_running.rst index b4fa7bcd7..8befee9cb 100644 --- a/doc/source/user_guide/ug_running.rst +++ b/doc/source/user_guide/ug_running.rst @@ -101,9 +101,7 @@ There are three usage modes, * ``--test`` creates individual tests. Tests are just cases that have some extra automation in order to carry out particular tests such as exact restart. * ``--suite`` creates a test suite. Test suites are predefined sets of tests and ``--suite`` provides the ability to quickly setup, build, and run a full suite of tests. -All modes will require use of ``--mach`` or ``-m`` to specify the machine and case and test modes -can use ``--set`` or ``-s`` to define specific options. ``--test`` and ``--suite`` will require ``--testid`` to be set -and both of the test modes can use ``--bdir``, ``--bgen``, ``--bcmp``, and ``--diff`` to generate (save) results and compare results with prior results as well as ``--tdir`` to specify the location of the test directory. +All modes will require use of ``--mach`` or ``-m`` to specify the machine. Use of ``--env`` is also recommended to specify the compilation environment. ``--case`` and ``--test`` modes can use ``--set`` or ``-s`` which will turn on various model options. ``--test`` and ``--suite`` will require ``--testid`` to be set and can use ``--bdir``, ``--bgen``, ``--bcmp``, and ``--diff`` to generate (save) results for regression testing (comparison with prior results). ``--tdir`` will specify the location of the test directory. Testing will be described in greater detail in the :ref:`testing` section. Again, ``cice.setup --help`` will show the latest usage information including @@ -111,15 +109,15 @@ the available ``--set`` options, the current ported machines, and the test choic To create a case, run **cice.setup**:: - cice.setup -c mycase -m machine + cice.setup -c mycase -m machine -e intel cd mycase Once a case/test is created, several files are placed in the case directory -- **env.[machine]** defines the environment +- **env.[machine]_[env]** defines the environment - **cice.settings** defines many variables associated with building and running the model - **makdep.c** is a tool that will automatically generate the make dependencies -- **Macros.[machine]** defines the Makefile macros +- **Macros.[machine]_[env]** defines the Makefile macros - **Makefile** is the makefile used to build the model - **cice.build** is a script that calls the Makefile and compiles the model - **ice\_in** is the namelist input file @@ -137,8 +135,8 @@ The **casescripts/** directory holds scripts used to create the case and can largely be ignored. Once a case is created, the **cice.build** script should be run interactively and then the case should be submitted by executing the **cice.submit** script interactively. The **cice.submit** script -simply submits the **cice.run script**. -You can also submit the **cice.run** script on the command line. +submits the **cice.run script** or **cice.test** script. These scripts can +also be run interactively or submitted manually without the **cice.submit** script. Some hints: @@ -158,7 +156,7 @@ To build and run:: ./cice.build ./cice.submit -The build and run log files will be copied into the logs directory in the case directory. +The build and run log files will be copied into the logs subdirectory in the case directory. Other model output will be in the run directory. The run directory is set in **cice.settings** via the ``ICE_RUNDIR`` variable. To modify the case setup, changes should be made in the case directory, NOT the run directory. @@ -186,10 +184,10 @@ Testing will be described in greater detail in the :ref:`testing` section. specifies the case name. This can be either a relative path of an absolute path. This cannot be used with --test or --suite. Either ``--case``, ``--test``, or ``--suite`` is required. ``--mach``, ``-m`` MACHINE - specifies the machine name. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. This is required in all modes. + specifies the machine name. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. This is required in all modes and is paired with ``--env`` to define the compilation environment. ``--env``, ``-e`` ENVIRONMENT1,ENVIRONMENT2,ENVIRONMENT3 - specifies the environment or compiler associated with the machine. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. Each machine can have multiple supported environments including support for different compilers or other system setups. When used with ``--suite`` or ``--test``, the ENVIRONMENT can be a set of comma deliminated values with no spaces and the tests will then be run for all of those environments. With ``--case``, only one ENVIRONMENT should be specified. (default is intel) +specifies the compilation environment associated with the machine. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. Each machine can have multiple supported environments including support for different compilers, different compiler versions, different mpi libraries, or other system settigs. When used with ``--suite`` or ``--test``, the ENVIRONMENT can be a set of comma deliminated values with no spaces and the tests will then be run for all of those environments. With ``--case``, only one ENVIRONMENT should be specified. (default is intel) ``--pes``, ``-p`` MxN[[xBXxBY[xMB] specifies the number of tasks and threads the case should be run on. This only works with ``--case``. The format is tasks x threads or "M"x"N" where M is tasks and N is threads and both are integers. BX, BY, and MB can also be set via this option where BX is the x-direction blocksize, BY is the y-direction blocksize, and MB is the max-blocks setting. If BX, BY, and MB are not set, they will be computed automatically based on the grid size and the task/thread count. More specifically, this option has three modes, --pes MxN, --pes MxNxBXxBY, and --pes MxNxBXxBYxMB. (default is 4x1) @@ -229,7 +227,7 @@ files **configuration/scripts/ice_in** and settings (options), the set_env.setting and set_nml.setting will be used to change the defaults. This is done as part of the ``cice.setup`` and the modifications are resolved in the **cice.settings** and **ice_in** file placed in -the case directory. If multiple options are chosen and then conflict, then the last +the case directory. If multiple options are chosen that conflict, then the last option chosen takes precedent. Not all options are compatible with each other. Some of the options are @@ -372,13 +370,16 @@ To port, an **env.[machine]_[environment]** and **Macros.[machine]_[environment] **configuration/scripts/machines/** directory and the **configuration/scripts/cice.batch.csh** and **configuration/scripts/cice.launch.csh** files need to be modified. In general, the machine is specified in ``cice.setup`` with ``--mach`` -and the environment (compiler) is specified with ``--env``. +and the environment (compiler) is specified with ``--env``. mach and env +in combination define the compiler, compiler version, supporting libaries, +and batch information. Multiple compilation environments can be created for +a single machine by choosing unique env names. - cd to **configuration/scripts/machines/** - Copy an existing env and a Macros file to new names for your new machine -- Edit your env and Macros files +- Edit your env and Macros files, update as needed - cd .. to **configuration/scripts/** @@ -412,8 +413,10 @@ system. Some variables are optional. :header: "variable", "format", "description" :widths: 15, 15, 25 - "ICE_MACHINE_ENVNAME", "string", "machine name" - "ICE_MACHINE_COMPILER", "string", "compiler" + "ICE_MACHINE_MACHNAME", "string", "machine name" + "ICE_MACHINE_MACHINFO", "string", "machine information" + "ICE_MACHINE_ENVNAME", "string", "env/compiler name" + "ICE_MACHINE_ENVINFO", "string", "env/compiler information" "ICE_MACHINE_MAKE", "string", "make command" "ICE_MACHINE_WKDIR", "string", "root work directory" "ICE_MACHINE_INPUTDATA", "string", "root input data directory" @@ -433,6 +436,7 @@ system. Some variables are optional. Cross-compiling ~~~~~~~~~~~~~~~ + It can happen that the model must be built on a platform and run on another, for example when the run environment is only available in a batch queue. The program **makdep** (see :ref:`overview`), however, is both compiled and run as part of the build process. In order to support this, the Makefile uses a variable ``CFLAGS_HOST`` that can hold compiler flags specfic to the build machine for the compilation of makdep. If this feature is needed, add the variable ``CFLAGS_HOST`` to the **Macros.[machine]_[environment]** file. For example : :: diff --git a/doc/source/user_guide/ug_testing.rst b/doc/source/user_guide/ug_testing.rst index 04b82a401..8f8fe9441 100644 --- a/doc/source/user_guide/ug_testing.rst +++ b/doc/source/user_guide/ug_testing.rst @@ -380,8 +380,8 @@ following options are valid for suites, ``--report`` This is only used by ``--suite`` and when set, invokes a script that sends the test results to the results page when all tests are complete. Please see :ref:`testreporting` for more information. -``--codecov`` - When invoked, code coverage diagnostics are generated. This will modify the build and reduce optimization. The results will be uploaded to the **codecov.io** website via the **report_codecov.csh** script. General use is not recommended, this is mainly used as a diagnostic to periodically assess test coverage. Please see :ref:`codecoverage` for more information. +``--coverage`` + When invoked, code coverage diagnostics are generated. This will modify the build and reduce optimization and generate coverage reports using lcov or codecov tools. General use is not recommended, this is mainly used as a diagnostic to periodically assess test coverage. Please see :ref:`codecoverage` for more information. ``--setup-only`` This is only used by ``--suite`` and when set, just creates the suite testcases. It does not build or submit them to run. By default, the suites do ``--setup-build-submit``. @@ -665,42 +665,65 @@ wait for all runs to be complete, and run the results and report_results scripts Code Coverage Testing ------------------------------ -The ``--codecov`` feature in **cice.setup** provides a method to diagnose code coverage. +The ``--coverage`` feature in **cice.setup** provides a method to diagnose code coverage. This argument turns on special compiler flags including reduced optimization and then -invokes the gcov tool. +invokes the gcov tool. Once runs are complete, either lcov or codecov can be used +to analyze the results. This option is currently only available with the gnu compiler and on a few systems with modified Macros files. -Because codecov.io does not support git submodule analysis right now, a customized -repository has to be created to test CICE with Icepack integrated directly. The repository -https://github.com/apcraig/Test_CICE_Icepack serves as the current default test repository. -In general, to setup the code coverage test in CICE, the current CICE master has -to be copied into the Test_CICE_Icepack repository, then the full test suite -can be run with the gnu compiler with the ``--codecov`` argument. - -The test suite will run and then a report will be generated and uploaded to -the `codecov.io site `_ by the -**report_codecov.csh** script. The env variable CODECOV_TOKEN needs to be defined -either in the environment or in a file named **~/.codecov_cice_token**. That -token provides write permission to the Test_CICE_Icepack codecov.io site and is available -by contacting the Consortium team directly. - -A script that carries out the end-to-end testing can be found in -**configuration/scripts/tests/cice_test_codecov.csh** - -This is a special diagnostic test and does not constitute proper model testing. -General use is not recommended, this is mainly used as a diagnostic to periodically -assess test coverage. The interaction with codecov.io is not always robust and -can be tricky to manage. Some constraints are that the output generated at runtime -is copied into the directory where compilation took place. That means each -test should be compiled separately. Tests that invoke multiple runs -(such as exact restart and the decomp test) will only save coverage information -for the last run, so some coverage information may be lost. The gcov tool can -be a little slow to run on large test suites, and the codecov.io bash uploader -(that runs gcov and uploads the data to codecov.io) is constantly evolving. -Finally, gcov requires that the diagnostic output be copied into the git sandbox for -analysis. These constraints are handled by the current scripts, but may change -in the future. +At the present time, the ``--coverage`` flag invokes the lcov analysis automatically +by running the **report_lcov.csh** script in the test suite directory. The output +will show up at the `CICE lcov website `__. To +use the tool, you should have write permission for that repository. The lcov tool +should be run on a full multi-suite test suite, and it can +take several hours to process the data once the test runs are complete. A typical +instantiation would be +:: + + ./cice.setup --suite first_suite,base_suite,travis_suite,decomp_suite,reprosum_suite,io_suite,quick_suite --mach cheyenne --env gnu --testid cc01 --coverage + +Alternatively, codecov analysis can be carried out by manually running the **report_codecov.csh** +script from the test suite directory, but there are several ongoing problems with this approach and +it is not generally recommended. A script that summarizes the end-to-end process for codecov +analysis can be found in ..**configuration/scripts/tests/cice_test_codecov.csh**. The codecov +analysis is largely identical to the analysis performed by lcov, codecov just provides a nicer +web experience to view the output. + +This is a special diagnostic test and is not part of the standard model testing. +General use is not recommended, this is mainly used as a diagnostic to periodically +assess test coverage. + +..Because codecov.io does not support git submodule analysis right now, a customized +..repository has to be created to test CICE with Icepack integrated directly. The repository +..https://github.com/apcraig/Test_CICE_Icepack serves as the current default test repository. +..In general, to setup the code coverage test in CICE, the current CICE master has +..to be copied into the Test_CICE_Icepack repository, then the full test suite +..can be run with the gnu compiler with the ``--coverage`` argument. + +..The test suite will run and then a report will be generated and uploaded to +..the `codecov.io site `_ by the +..**report_codecov.csh** script. The env variable CODECOV_TOKEN needs to be defined +..either in the environment or in a file named **~/.codecov_cice_token**. That +..token provides write permission to the Test_CICE_Icepack codecov.io site and is available +..by contacting the Consortium team directly. + +..A script that carries out the end-to-end testing can be found in +..**configuration/scripts/tests/cice_test_codecov.csh** + +..This is a special diagnostic test and does not constitute proper model testing. +..General use is not recommended, this is mainly used as a diagnostic to periodically +..assess test coverage. The interaction with codecov.io is not always robust and +..can be tricky to manage. Some constraints are that the output generated at runtime +..is copied into the directory where compilation took place. That means each +..test should be compiled separately. Tests that invoke multiple runs +..(such as exact restart and the decomp test) will only save coverage information +..for the last run, so some coverage information may be lost. The gcov tool can +..be a little slow to run on large test suites, and the codecov.io bash uploader +..(that runs gcov and uploads the data to codecov.io) is constantly evolving. +..Finally, gcov requires that the diagnostic output be copied into the git sandbox for +..analysis. These constraints are handled by the current scripts, but may change +..in the future. .. _compliance: @@ -929,6 +952,10 @@ In order to run the script, the following requirements must be met: * matplotlib Python package (optional) * basemap Python package (optional) +QC testing should be carried out using configurations (ie. namelist settings) that +exercise the active code modifications. Multiple configurations may need to be tested +in some cases. Developers can contact the Consortium for guidance or if there are questions. + In order to generate the files necessary for the compliance test, test cases should be created with the ``qc`` option (i.e., ``--set qc``) when running cice.setup. This option results in daily, non-averaged history files being written for a 5 year simulation. @@ -1010,6 +1037,7 @@ If the regression comparisons fail, then you may want to run the QC test, # Create a QC baseline # From the baseline sandbox + # Generate the test case(s) using options or namelist changes to activate new code modifications ./cice.setup -m onyx -e intel --test smoke -g gx1 -p 44x1 --testid qc_base -s qc,medium cd onyx_intel_smoke_gx1_44x1_medium_qc.qc_base @@ -1018,7 +1046,8 @@ If the regression comparisons fail, then you may want to run the QC test, ./cice.submit # Create the t-test testing data - # From the update sandbox + # From the updated sandbox + # Generate the same test case(s) as the baseline using options or namelist changes to activate new code modifications ./cice.setup -m onyx -e intel --test smoke -g gx1 -p 44x1 -testid qc_test -s qc,medium cd onyx_intel_smoke_gx1_44x1_medium_qc.qc_test