From d46d6913b93a1e4f435dcdf89f3d79505e0ef494 Mon Sep 17 00:00:00 2001 From: Denise Worthen Date: Wed, 22 Apr 2020 14:48:08 -0400 Subject: [PATCH] merge latest master (#4) * Isotopes for CICE (#423) Co-authored-by: apcraig Co-authored-by: David Bailey Co-authored-by: Elizabeth Hunke --- .travis.yml | 4 +- LICENSE.pdf | Bin 59402 -> 92397 bytes README.md | 1 + cice.setup | 160 +++- .../cicedynB/analysis/ice_diagnostics.F90 | 124 +++- .../cicedynB/analysis/ice_history_bgc.F90 | 119 ++- .../dynamics/ice_transport_driver.F90 | 15 +- cicecore/cicedynB/general/ice_flux.F90 | 37 +- cicecore/cicedynB/general/ice_flux_bgc.F90 | 31 +- cicecore/cicedynB/general/ice_forcing.F90 | 20 +- cicecore/cicedynB/general/ice_forcing_bgc.F90 | 26 +- cicecore/cicedynB/general/ice_init.F90 | 63 +- cicecore/cicedynB/general/ice_step_mod.F90 | 70 +- .../infrastructure/comm/mpi/ice_boundary.F90 | 14 +- .../cicedynB/infrastructure/ice_blocks.F90 | 14 +- .../cicedynB/infrastructure/ice_domain.F90 | 1 + .../cicedynB/infrastructure/ice_restoring.F90 | 4 +- .../io/io_binary/ice_restart.F90 | 56 +- .../io/io_netcdf/ice_restart.F90 | 18 +- .../infrastructure/io/io_pio/ice_restart.F90 | 14 +- .../infrastructure/io/io_pio2/ice_restart.F90 | 14 +- cicecore/drivers/mct/cesm1/CICE_InitMod.F90 | 37 +- cicecore/drivers/mct/cesm1/CICE_RunMod.F90 | 31 +- .../drivers/mct/cesm1/CICE_RunMod.F90_debug | 696 ------------------ cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 | 42 +- cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 | 31 +- cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 | 46 +- cicecore/drivers/nuopc/dmi/CICE_RunMod.F90 | 32 +- .../drivers/nuopc/dmi/CICE_RunMod.F90_debug | 686 ----------------- .../drivers/standalone/cice/CICE_InitMod.F90 | 37 +- .../drivers/standalone/cice/CICE_RunMod.F90 | 31 +- .../standalone/cice/CICE_RunMod.F90_debug | 40 +- cicecore/shared/ice_distribution.F90 | 32 +- cicecore/shared/ice_domain_size.F90 | 7 +- cicecore/shared/ice_fileunits.F90 | 8 +- cicecore/shared/ice_init_column.F90 | 39 +- cicecore/shared/ice_restart_column.F90 | 85 +++ codecov.yml | 6 + configuration/scripts/cice.batch.csh | 2 +- configuration/scripts/cice.build | 2 +- configuration/scripts/cice.settings | 1 + configuration/scripts/cice.test.setup.csh | 7 + configuration/scripts/ice_in | 9 +- .../scripts/machines/Macros.gaffney_gnu | 20 +- .../scripts/machines/Macros.gordon_gnu | 20 +- .../scripts/machines/Macros.izumi_gnu | 16 +- .../scripts/machines/Macros.onyx_gnu | 20 +- .../scripts/machines/Macros.travisCI_gnu | 20 +- .../scripts/machines/env.badger_intel | 3 +- configuration/scripts/options/set_nml.isotope | 2 + configuration/scripts/tests/base_suite.ts | 3 + configuration/scripts/tests/nothread_suite.ts | 12 + .../scripts/tests/report_results.csh | 33 +- .../scripts/tests/test_logbfb.script | 5 - .../scripts/tests/test_restart.script | 10 - configuration/scripts/tests/test_smoke.script | 5 - doc/source/developer_guide/dg_other.rst | 4 +- doc/source/science_guide/sg_tracers.rst | 4 +- doc/source/user_guide/ug_case_settings.rst | 4 + doc/source/user_guide/ug_testing.rst | 58 +- icepack | 2 +- 61 files changed, 1259 insertions(+), 1694 deletions(-) delete mode 100644 cicecore/drivers/mct/cesm1/CICE_RunMod.F90_debug delete mode 100644 cicecore/drivers/nuopc/dmi/CICE_RunMod.F90_debug create mode 100644 codecov.yml create mode 100644 configuration/scripts/options/set_nml.isotope diff --git a/.travis.yml b/.travis.yml index bb8dd37b4..f8f5aeadc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,9 +33,9 @@ install: script: # verify cice.setup --case and cice.setup --test don't error then run test suite - - "./cice.setup --case trcase --mach travisCI --env gnu --pes 2x2 -s diag1" + - "./cice.setup --case trcase --mach travisCI --env gnu --pes 2x2 -s diag1 && sleep 4" - "./cice.setup --test smoke --testid trtest --mach travisCI --env gnu - --pes 2x2 -s diag1" + --pes 2x2 -s diag1 && sleep 4" - "./cice.setup --suite travis_suite --testid travisCItest --mach travisCI --env gnu; cd testsuite.travisCItest && diff --git a/LICENSE.pdf b/LICENSE.pdf index 5be71376b88f9119eb9f3e5df50222734d8d0185..da37344cf0234bb32481f59a2268ef9ae91516cd 100644 GIT binary patch delta 33153 zcmcG%2SAQ(+W>4OJ2Da>kwW9%BMmA^N)io8+S+?*TxPN|LPbfU%t$I!GE%9?jFi$w zQ)y`EKaT6ZZ;$7BpXYu5@BQEZc|X^6Ugtc{V;{$Pc7F$6jBI%+baUKif+|UobhC1t zsI08GV#PXLr8Twzer}#NUXlztw5(Uu@U*q`c5rjmwDh)>)l{NUs2nPl#--9JEGl)= zVqUwOr>rpyTC6A-ExTAz&&}r77#fAbfd6qBEGAc;!jhp-WELx~^K`TE8EI|n8S%bm z;b_GT4&KhT5tnM_5vr;aZCz~;DB2&uX}Gz1+q!xKTr3hUJzE<8#V{^ ztDv6BB*^(!8B!&wlpm28JWus>@< zTW>SPb(&g=8*Kf(&7pEbfV(X~X>a?-CaE|Lp9Ffg-j;-orMIOdgGtVaUA_4GA;)S! zqqCd+AHzv__`}sLy=)OyMFV5)6*>k>H#oT1dabqfTkqy#>AKEPZ-b(yt(P?**V5G+ z`vEpdJSeVowRW>{aJ5%lZDUKgdOLUr$ZIPa`dE1*xVSDwaf91NR|n{2E6L#SHj8aI z%WtqC(0o{QZC&lXw@K3JOxmxRO!Rbl7{GnvHdR%hMT9YBvXMUZ%qLrbEyhc7M(?9 z$w>l#6C6bNqGVd)nA3t=H7zuLoZ$Qro<}-IWv-{rvnC z{OAg9p7x4VE|;rFp()a6^3X%xE5Oy;(qG=yYXNT(!8}L~PX~7tFiD)((#p+;@K%wM z!j*pg$KRQY`>&N;y%fk@DpEfdJ3k9%2Wf-DF>KI$p7O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C~<-3B- z12)bx_bSn*3h*QmjlzPCIq$J+tkH`+N!jzAW{L=JwvS_QD|gm@)~fYXx$RTL=169V zT1Tq`yc26&U5VrPpoN8xdDcc^k%yhs-MfZE-rvK-(~G~;xYja!d5F}$SVX)P^x3`K zXd08+q%G{Bbm$~L8e8L4Gz@bkFr+P}3jRBm2GUUzBr8Iz@;54MB&KscoAmfrIVt9wgx_w2SfY5l5x4ZUJ1Awr!fez{L%@ zQ1Rzs_xPz?8Dw6f=jzVWd2`YYh7VCw|sKfIsHi!()pVT8Qv+VEf1BeTkSHbHX*s@ z5ruPjEyEGIq1qC)FAfH3JrQPxyP6jRRZj;z@W&X)aK|jJpfi?98k#4l{)lSfuoBa@ zD6P+U5OPou5ZK{N6sK0}ltgn~gMKUFM=z9c>@CqmzrbE!{-PrNT&OcP;?)sR>9Q=% zPWu!2s|IYWMe3GZzZ`21eO0)`8rQB#F2b*=g6)2LhJ9aEERx+S@Y>Qy|SOk_*O81j6+U zEJouFNB`xA9Cf0`FcPnsGjowMV&b!J3ZDc%fM+gosyr4m6k+R)lsB$A$KE|E(Ulp* z9CX3(v3VXN5o;T9N*nUW6ph#-cq3?5F^|Mgh?N#-kt7Fo`Nk;wwul+K1o2k4(sIGg zhuTiCg1hOa@yHfKsR>J_2bhJ<9IV^y3>D`52`J=(#hoWe#7g5(sh+cz3<4Sw-Yr+` z?vfitR6FoZc2?u 1) then exit -1 endif +if ($codecov == 1 && $report == 1) then + echo "${0}: ERROR in arguments, not recommmended to set both --codecov and --report" + exit -1 +endif + +if ($codecov == 1 && "$compilers" != "gnu") then + echo "${0}: ERROR in arguments, must use --env gnu with --codecov" + exit -1 +endif + +if ($codecov == 1 && `where curl` == "" && `where wget` == "") then + echo "${0}: ERROR 'curl' or 'wget' is required for --codecov" + exit -1 +endif + if (${dosuite} == 0) then + if ($report == 1) 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" + exit -1 + endif if ("$compilers" =~ "*,*") then echo "${0}: ERROR in arguments, cannot set multiple compilers without --suite" exit -1 @@ -355,7 +393,7 @@ endif if ( ${tdir} != ${spval} ) then set tsdir = ${tdir} endif -if (-e $tsfile) then +if (-e ${tsfile}) then echo "${0}: ERROR in tsfile, this should never happen" exit -1 endif @@ -416,11 +454,15 @@ else set nonomatch && rm -f ciceexe.* && unset nonomatch set dobuild = true +set doreuse = true set dorun = false set dosubmit = true if (\$?SUITE_BUILD) then set dobuild = "\${SUITE_BUILD}" endif +if (\$?SUITE_REUSEBUILD) then + set doreuse = "\${SUITE_REUSEBUILD}" +endif if (\$?SUITE_RUN) then set dorun = "\${SUITE_RUN}" endif @@ -429,6 +471,7 @@ if (\$?SUITE_SUBMIT) then endif echo \${0}: dobuild = \${dobuild} +echo \${0}: doreuse = \${doreuse} echo \${0}: dorun = \${dorun} echo \${0}: dosubmit = \${dosubmit} @@ -449,16 +492,30 @@ echo "#hash = ${hash}" >> results.log echo "#hshs = ${shhash}" >> results.log echo "#hshu = ${hashuser}" >> results.log echo "#hshd = ${hashdate}" >> results.log +echo "#suit = ${testsuite}" >> results.log echo "#date = ${cdate}" >> results.log echo "#time = ${ctime}" >> results.log echo "#mach = ${machine}" >> results.log echo "#user = ${user}" >> results.log echo "#vers = ${vers}" >> results.log echo "#------- " >> results.log +EOF0 + +cat >! ${tsdir}/report_codecov.csh << EOF0 +#!/bin/csh -f + +#setenv CODECOV_TOKEN "1d09241f-ed9e-47d8-847c-038bab024b53" # consortium cice +#setenv CODECOV_TOKEN "f3236008-0b92-4707-9ad5-ad906f5d2ba7" # apcraig cice +setenv CODECOV_TOKEN "0dcc6066-fdce-47b6-b84a-c55e2a0af4c0" # apcraig test_cice_icepack +set report_name = "${shhash}:${branch}:${machine} ${testsuite}" + +set use_curl = 1 + EOF0 chmod +x ${tsdir}/suite.submit chmod +x ${tsdir}/results.csh + chmod +x ${tsdir}/report_codecov.csh endif @@ -734,6 +791,8 @@ EOF endif endif + set rundir = ${ICE_MACHINE_WKDIR}/${casename} + #------------------------------------------------------------ # Compute a default blocksize @@ -755,6 +814,7 @@ EOF echo "ICE_CASEDIR = ${casedir}" echo "ICE_MACHINE = ${machine}" echo "ICE_COMPILER = ${compiler}" + 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}" echo "ICE_DECOMP = ${ICE_DECOMP_DECOMP} ${ICE_DECOMP_DSHAPE}" @@ -809,7 +869,7 @@ setenv ICE_CASEDIR ${casedir} setenv ICE_MACHINE ${machine} setenv ICE_COMPILER ${compiler} setenv ICE_MACHCOMP ${machcomp} -setenv ICE_RUNDIR ${ICE_MACHINE_WKDIR}/${casename} +setenv ICE_RUNDIR ${rundir} setenv ICE_GRID ${grid} #setenv ICE_NXGLOB ${ICE_DECOMP_NXGLOB} # moved to namelist #setenv ICE_NYGLOB ${ICE_DECOMP_NYGLOB} # moved to namelist @@ -829,6 +889,7 @@ setenv ICE_TESTID ${testid} setenv ICE_BFBCOMP ${fbfbcomp} setenv ICE_ACCOUNT ${acct} setenv ICE_QUEUE ${queue} +setenv ICE_CODECOV ${codecovflag} EOF1 if (${sets} != "") then @@ -941,9 +1002,6 @@ EOF2 exit -1 endif -# # Initial test_output file -# echo "#---" >! test_output -# echo "PEND ${testname_noid} " >> test_output endif #------------------------------------------------------------ @@ -955,6 +1013,12 @@ EOF2 cat >> ${tsdir}/results.csh << EOF cat ${testname_base}/test_output >> results.log +EOF + + cat >> ${tsdir}/report_codecov.csh << EOF +mkdir ${testname_base}/codecov_output +cp ${rundir}/compile/*.{gcno,gcda} ${testname_base}/codecov_output/ + EOF cat >> ${tsdir}/suite.submit << EOF @@ -964,9 +1028,13 @@ echo "${testname_base}" cd ${testname_base} source ./cice.settings if (\${dobuild} == true) then - set ciceexe = "../ciceexe.\${ICE_COMPILER}.\${ICE_COMMDIR}.\${ICE_BLDDEBUG}.\${ICE_THREADED}.\${ICE_IOTYPE}" - ./cice.build --exe \${ciceexe} - if !(-e \${ciceexe}) cp -p \${ICE_RUNDIR}/cice \${ciceexe} + if (\${doreuse} == true) then + set ciceexe = "../ciceexe.\${ICE_COMPILER}.\${ICE_COMMDIR}.\${ICE_BLDDEBUG}.\${ICE_THREADED}.\${ICE_IOTYPE}" + ./cice.build --exe \${ciceexe} + if !(-e \${ciceexe}) cp -p \${ICE_RUNDIR}/cice \${ciceexe} + else + ./cice.build + endif endif if (\${dosubmit} == true) then ./cice.submit | tee -a ../suite.jobs @@ -1004,31 +1072,55 @@ 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 failures = \`cat ./results.log | grep FAIL | 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\` +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" >> results.log +echo "#totl = \$total total" >> results.log +echo "#chkd = \$chkcnt checked" >> results.log echo "#pass = \$success" >> results.log -echo "#fail = \$failures" >> 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 - run has been submitted to queue and is waiting or failed submission" -echo " FAIL - test is still executing, did not complete, or completed and failed" +echo " PEND - status is undertermined; test may still be queued, running, or timed out" +echo " FAIL - test failed" echo "" -echo "\$success of \$total tests PASSED" -echo "\$failures of \$total tests FAILED" -echo "\$pends of \$total tests PENDING" +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 @@ -1038,9 +1130,24 @@ setenv ICE_MACHINE_QSTAT ${ICE_MACHINE_QSTAT} EOF0 endif +cat >> ${tsdir}/report_codecov.csh << EOF +source ${ICE_SCRIPTS}/machines/env.${machcomp} + +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 + +EOF + # build and submit tests cd ${tsdir} setenv SUITE_BUILD ${suitebuild} + setenv SUITE_REUSEBUILD ${suitereuse} setenv SUITE_RUN ${suiterun} setenv SUITE_SUBMIT ${suitesubmit} ./suite.submit | tee suite.log @@ -1050,6 +1157,11 @@ EOF0 ./results.csh ./report_results.csh endif + if ($codecov == 1) then + echo "Generating codecov reports" + ./poll_queue.csh + ./report_codecov.csh + endif cd ${ICE_SANDBOX} endif diff --git a/cicecore/cicedynB/analysis/ice_diagnostics.F90 b/cicecore/cicedynB/analysis/ice_diagnostics.F90 index 64137446d..40da6cb64 100644 --- a/cicecore/cicedynB/analysis/ice_diagnostics.F90 +++ b/cicecore/cicedynB/analysis/ice_diagnostics.F90 @@ -18,7 +18,7 @@ module ice_diagnostics use ice_fileunits, only: flush_fileunit use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero + use icepack_intfc, only: icepack_max_aero, icepack_max_iso use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags use icepack_intfc, only: icepack_query_tracer_indices @@ -79,6 +79,10 @@ module ice_diagnostics toten , & ! total ice/snow energy (J) totes ! total ice/snow energy (J) + real (kind=dbl_kind), dimension(icepack_max_iso) :: & + totison , & ! total isotope mass + totisos ! total isotope mass + real (kind=dbl_kind), dimension(icepack_max_aero) :: & totaeron , & ! total aerosol mass totaeros ! total aerosol mass @@ -89,8 +93,8 @@ module ice_diagnostics integer (kind=int_kind), parameter, public :: & check_step = 999999999, & ! begin printing at istep1=check_step iblkp = 1, & ! block number - ip = 2, & ! i index - jp = 11, & ! j index + ip = 72, & ! i index + jp = 11, & ! j index mtask = 0 ! my_task !======================================================================= @@ -113,7 +117,7 @@ subroutine runtime_diags (dt) use ice_constants, only: c1, c1000, c2, p001, p5, & field_loc_center, m2_to_km2 use ice_domain, only: distrb_info, nblocks - use ice_domain_size, only: ncat, n_aero, max_blocks, nfsd + use ice_domain_size, only: ncat, n_iso, n_aero, max_blocks, nfsd use ice_flux, only: alvdr, alidr, alvdf, alidf, evap, fsnow, frazil, & fswabs, fswthru, flw, flwout, fsens, fsurf, flat, frzmlt_init, frain, fpond, & fhocn_ai, fsalt_ai, fresh_ai, frazil_diag, & @@ -121,7 +125,7 @@ subroutine runtime_diags (dt) dsnow, congel, sst, sss, Tf, fhocn, & swvdr, swvdf, swidr, swidf, & alvdr_init, alvdf_init, alidr_init, alidf_init - use ice_flux_bgc, only: faero_atm, faero_ocn + use ice_flux_bgc, only: faero_atm, faero_ocn, fiso_atm, fiso_ocn use ice_global_reductions, only: global_sum, global_sum_prod, global_maxval use ice_grid, only: lmask_n, lmask_s, tarean, tareas use ice_state ! everything @@ -138,10 +142,11 @@ subroutine runtime_diags (dt) integer (kind=int_kind) :: & i, j, k, n, iblk, nc, & ktherm, & - nt_tsfc, nt_aero, nt_fbri, nt_apnd, nt_hpnd, nt_fsd + nt_tsfc, nt_aero, nt_fbri, nt_apnd, nt_hpnd, nt_fsd, & + nt_isosno, nt_isoice logical (kind=log_kind) :: & - tr_pond_topo, tr_brine, tr_aero, calc_Tsfc, tr_fsd + tr_pond_topo, tr_brine, tr_iso, tr_aero, calc_Tsfc, tr_fsd real (kind=dbl_kind) :: & rhow, rhos, rhoi, puny, awtvdr, awtidr, awtvdf, awtidf, & @@ -166,6 +171,13 @@ subroutine runtime_diags (dt) delein, werrn, herrn, msltn, delmsltn, serrn, & deleis, werrs, herrs, mslts, delmslts, serrs + ! isotope diagnostics + real (kind=dbl_kind), dimension(icepack_max_aero) :: & + fisoan, fisoon, isorn, & + fisoas, fisoos, isors, & + isomx1n, isomx1s, & + isototn, isotots + ! aerosol diagnostics real (kind=dbl_kind), dimension(icepack_max_aero) :: & faeran, faeron, aerrn, & @@ -188,10 +200,10 @@ subroutine runtime_diags (dt) call icepack_query_parameters(ktherm_out=ktherm, calc_Tsfc_out=calc_Tsfc) call icepack_query_tracer_flags(tr_brine_out=tr_brine, tr_aero_out=tr_aero, & - tr_pond_topo_out=tr_pond_topo, tr_fsd_out=tr_fsd) + tr_pond_topo_out=tr_pond_topo, tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) call icepack_query_tracer_indices(nt_fbri_out=nt_fbri, nt_Tsfc_out=nt_Tsfc, & nt_aero_out=nt_aero, nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, & - nt_fsd_out=nt_fsd) + nt_fsd_out=nt_fsd,nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_query_parameters(Tffresh_out=Tffresh, rhos_out=rhos, & rhow_out=rhow, rhoi_out=rhoi, puny_out=puny, & awtvdr_out=awtvdr, awtidr_out=awtidr, awtvdf_out=awtvdf, awtidf_out=awtidf, & @@ -683,6 +695,45 @@ subroutine runtime_diags (dt) serrn = (sfsaltn + delmsltn) / (msltn + c1) serrs = (sfsalts + delmslts) / (mslts + c1) + ! isotopes + if (tr_iso) then + do n = 1, n_iso + fisoan(n) = global_sum_prod(fiso_atm(:,:,n,:), aice_init, & + distrb_info, field_loc_center, tarean) + fisoas(n) = global_sum_prod(fiso_atm(:,:,n,:), aice_init, & + distrb_info, field_loc_center, tareas) + fisoan(n) = fisoan(n)*dt + fisoas(n) = fisoas(n)*dt + fisoon(n) = global_sum_prod(fiso_ocn(:,:,n,:), aice, & + distrb_info, field_loc_center, tarean) + fisoos(n) = global_sum_prod(fiso_ocn(:,:,n,:), aice, & + distrb_info, field_loc_center, tareas) + fisoon(n) = fisoon(n)*dt + fisoos(n) = fisoos(n)*dt + + !$OMP PARALLEL DO PRIVATE(iblk,i,j) + do iblk = 1, nblocks + do j = 1, ny_block + do i = 1, nx_block + work1(i,j,iblk) = c0 + do k = 1, n_iso + work1(i,j,iblk) = work1(i,j,iblk) & + + vsno(i,j,iblk)*trcr(i,j,nt_isosno+k-1,iblk) & + + vice(i,j,iblk)*trcr(i,j,nt_isoice+k-1,iblk) + enddo + enddo + enddo + enddo + !$OMP END PARALLEL DO + isototn(n) = global_sum(work1, distrb_info, field_loc_center, tarean) + isotots(n) = global_sum(work1, distrb_info, field_loc_center, tareas) + isomx1n(n) = global_maxval(work1, distrb_info, lmask_n) + isomx1s(n) = global_maxval(work1, distrb_info, lmask_s) + isorn(n) = (totison(n)-isototn(n)+fisoan(n)-fisoon(n))/(isototn(n)+c1) + isors(n) = (totisos(n)-isotots(n)+fisoas(n)-fisoos(n))/(isotots(n)+c1) + enddo ! n_iso + endif ! tr_iso + ! aerosols if (tr_aero) then do n = 1, n_aero @@ -917,6 +968,17 @@ subroutine runtime_diags (dt) write(nu_diag,901) 'arwt salt flx error = ',serrn,serrs write(nu_diag,*) '----------------------------' + if (tr_iso) then + do n = 1, n_iso + write(nu_diag,*) ' isotope ',n + write(nu_diag,901) 'fiso_atm (kg/m2) = ', fisoan(n), fisoas(n) + write(nu_diag,901) 'fiso_ocn (kg/m2) = ', fisoon(n), fisoos(n) + write(nu_diag,901) 'total iso (kg/m2) = ', isototn(n), isotots(n) + write(nu_diag,901) 'iso error = ', isorn(n), isors(n) + write(nu_diag,901) 'maximum iso (kg/m2) = ', isomx1n(n),isomx1s(n) + enddo + write(nu_diag,*) '----------------------------' + endif ! tr_iso if (tr_aero) then do n = 1, n_aero write(nu_diag,*) ' aerosol ',n @@ -1030,16 +1092,16 @@ subroutine init_mass_diags use ice_blocks, only: nx_block, ny_block use ice_constants, only: field_loc_center use ice_domain, only: distrb_info, nblocks - use ice_domain_size, only: n_aero, ncat, max_blocks + use ice_domain_size, only: n_iso, n_aero, ncat, max_blocks use ice_global_reductions, only: global_sum use ice_grid, only: tareas, tarean use ice_state, only: aicen, vice, vsno, trcrn, trcr - integer (kind=int_kind) :: n, i, j, iblk, & - nt_hpnd, nt_apnd, nt_aero + integer (kind=int_kind) :: n, i, j, k, iblk, & + nt_hpnd, nt_apnd, nt_aero, nt_isosno, nt_isoice logical (kind=log_kind) :: & - tr_aero, tr_pond_topo + tr_iso, tr_aero, tr_pond_topo real (kind=dbl_kind) :: & shmaxn, snwmxn, shmaxs, snwmxs, totpn, totps, & @@ -1051,7 +1113,8 @@ subroutine init_mass_diags character(len=*), parameter :: subname = '(init_mass_diags)' call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_pond_topo_out=tr_pond_topo) - call icepack_query_tracer_indices( & + call icepack_query_tracer_flags(tr_iso_out=tr_iso) + call icepack_query_tracer_indices(nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice, & nt_hpnd_out=nt_hpnd, nt_apnd_out=nt_apnd, nt_aero_out=nt_aero) call icepack_query_parameters( & rhoi_out=rhoi, rhos_out=rhos, rhofresh_out=rhofresh) @@ -1094,6 +1157,27 @@ subroutine init_mass_diags enddo ! npnt endif ! print_points + if (tr_iso) then + do n=1,n_iso + !$OMP PARALLEL DO PRIVATE(iblk,i,j) + do iblk = 1, nblocks + do j = 1, ny_block + do i = 1, nx_block + work1(i,j,iblk) = c0 + do k = 1, n_iso + work1(i,j,iblk) = work1(i,j,iblk) & + + vsno(i,j,iblk)*trcr(i,j,nt_isosno+k-1,iblk) & + + vice(i,j,iblk)*trcr(i,j,nt_isoice+k-1,iblk) + enddo + enddo + enddo + enddo + !$OMP END PARALLEL DO + totison(n)= global_sum(work1, distrb_info, field_loc_center, tarean) + totisos(n)= global_sum(work1, distrb_info, field_loc_center, tareas) + enddo + endif + if (tr_aero) then do n=1,n_aero !$OMP PARALLEL DO PRIVATE(iblk,i,j) @@ -1480,18 +1564,20 @@ subroutine print_state(plabel,i,j,iblk) qi, qs, Tsnow, & rad_to_deg, puny, rhoi, lfresh, rhos, cp_ice - integer (kind=int_kind) :: n, k, nt_Tsfc, nt_qice, nt_qsno, nt_fsd + integer (kind=int_kind) :: n, k, nt_Tsfc, nt_qice, nt_qsno, nt_fsd, & + nt_isosno, nt_isoice - logical (kind=log_kind) :: tr_fsd + logical (kind=log_kind) :: tr_fsd, tr_iso type (block) :: & this_block ! block information for current block character(len=*), parameter :: subname = '(print_state)' - call icepack_query_tracer_flags(tr_fsd_out=tr_fsd) + call icepack_query_tracer_flags(tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, nt_qice_out=nt_qice, & - nt_qsno_out=nt_qsno, nt_fsd_out=nt_fsd) + nt_qsno_out=nt_qsno, nt_fsd_out=nt_fsd, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_query_parameters( & rad_to_deg_out=rad_to_deg, puny_out=puny, rhoi_out=rhoi, lfresh_out=lfresh, & rhos_out=rhos, cp_ice_out=cp_ice) @@ -1521,6 +1607,8 @@ subroutine print_state(plabel,i,j,iblk) endif write(nu_diag,*) 'Tsfcn',trcrn(i,j,nt_Tsfc,n,iblk) if (tr_fsd) write(nu_diag,*) 'afsdn',trcrn(i,j,nt_fsd,n,iblk) ! fsd cat 1 +! if (tr_iso) write(nu_diag,*) 'isosno',trcrn(i,j,nt_isosno,n,iblk) ! isotopes in snow +! if (tr_iso) write(nu_diag,*) 'isoice',trcrn(i,j,nt_isoice,n,iblk) ! isotopes in ice write(nu_diag,*) ' ' ! dynamics (transport and/or ridging) causes the floe size distribution to become non-normal diff --git a/cicecore/cicedynB/analysis/ice_history_bgc.F90 b/cicecore/cicedynB/analysis/ice_history_bgc.F90 index c27683423..1ae572b30 100644 --- a/cicecore/cicedynB/analysis/ice_history_bgc.F90 +++ b/cicecore/cicedynB/analysis/ice_history_bgc.F90 @@ -14,13 +14,13 @@ module ice_history_bgc use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero, icepack_max_dic, & - icepack_max_doc, icepack_max_don, & + use icepack_intfc, only: icepack_max_iso, icepack_max_aero, & + icepack_max_dic, icepack_max_doc, icepack_max_don, & icepack_max_algae, icepack_max_fe use icepack_intfc, only: icepack_query_tracer_flags, & icepack_query_tracer_indices, icepack_query_parameters, & icepack_query_parameters - use ice_domain_size, only: max_nstrm, n_aero, & + use ice_domain_size, only: max_nstrm, n_iso, n_aero, & n_algae, n_dic, n_doc, n_don, n_zaero, n_fed, n_fep implicit none @@ -35,6 +35,8 @@ module ice_history_bgc ! specified in input_templates !-------------------------------------------------------------- character (len=max_nstrm), public :: & + f_fiso_atm = 'x', f_fiso_ocn = 'x', & + f_iso = 'x', & f_faero_atm = 'x', f_faero_ocn = 'x', & f_aero = 'x', & f_fzsal = 'm', f_fzsal_ai = 'm', & @@ -124,6 +126,8 @@ module ice_history_bgc !--------------------------------------------------------------- namelist / icefields_bgc_nml / & + f_fiso_atm , f_fiso_ocn , & + f_iso , & f_faero_atm , f_faero_ocn , & f_aero , & f_fbio , f_fbio_ai , & @@ -154,6 +158,12 @@ module ice_history_bgc n_fzsal_g , n_fzsal_g_ai , & n_zsal + integer(kind=int_kind), dimension(icepack_max_iso,max_nstrm) :: & + n_fiso_atm , & + n_fiso_ocn , & + n_isosno , & + n_isoice + integer(kind=int_kind), dimension(icepack_max_aero,max_nstrm) :: & n_faero_atm , & n_faero_ocn , & @@ -266,7 +276,7 @@ subroutine init_hist_bgc_2D integer (kind=int_kind) :: nml_error ! namelist i/o error flag character (len=3) :: nchar character (len=16) :: vname_in ! variable name - logical (kind=log_kind) :: tr_zaero, tr_aero, tr_brine, & + logical (kind=log_kind) :: tr_zaero, tr_aero, tr_brine, tr_iso, & tr_bgc_Nit, tr_bgc_Am, tr_bgc_Sil, & tr_bgc_DMS, tr_bgc_PON, & tr_bgc_N, tr_bgc_C, tr_bgc_chl, & @@ -276,7 +286,8 @@ subroutine init_hist_bgc_2D call icepack_query_parameters(skl_bgc_out=skl_bgc, & solve_zsal_out=solve_zsal, z_tracers_out=z_tracers) - call icepack_query_tracer_flags(tr_zaero_out =tr_zaero, & + call icepack_query_tracer_flags( & + tr_iso_out =tr_iso, tr_zaero_out =tr_zaero, & tr_aero_out =tr_aero, tr_brine_out =tr_brine, & tr_bgc_Nit_out=tr_bgc_Nit, tr_bgc_Am_out =tr_bgc_Am, & tr_bgc_Sil_out=tr_bgc_Sil, tr_bgc_DMS_out=tr_bgc_DMS, & @@ -313,6 +324,12 @@ subroutine init_hist_bgc_2D call abort_ice(subname//'ERROR: reading icefields_bgc_nml') endif + if (.not. tr_iso) then + f_fiso_atm = 'x' + f_fiso_ocn = 'x' + f_iso = 'x' + endif + if (.not. tr_aero) then f_faero_atm = 'x' f_faero_ocn = 'x' @@ -609,6 +626,9 @@ subroutine init_hist_bgc_2D f_iki = 'x' endif + call broadcast_scalar (f_fiso_atm, master_task) + call broadcast_scalar (f_fiso_ocn, master_task) + call broadcast_scalar (f_iso, master_task) call broadcast_scalar (f_faero_atm, master_task) call broadcast_scalar (f_faero_ocn, master_task) call broadcast_scalar (f_aero, master_task) @@ -758,10 +778,44 @@ subroutine init_hist_bgc_2D ! 2D variables - if (tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then + if (tr_iso .or. tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then do ns = 1, nstreams + if (f_iso(1:1) /= 'x') then + do n=1,n_iso + write(nchar,'(i3.3)') n + write(vname_in,'(a,a)') 'isosno', trim(nchar) + call define_hist_field(n_isosno(n,:),vname_in,"kg/kg", & + tstr2D, tcstr,"snow isotope mass concentration","none", c1, c0, & + ns, f_iso) + write(vname_in,'(a,a)') 'isoice', trim(nchar) + call define_hist_field(n_isoice(n,:),vname_in,"kg/kg", & + tstr2D, tcstr,"ice isotope mass concentration","none", c1, c0, & + ns, f_iso) + enddo + endif + + if (f_fiso_atm(1:1) /= 'x') then + do n=1,n_iso + write(nchar,'(i3.3)') n + write(vname_in,'(a,a)') 'fiso_atm', trim(nchar) + call define_hist_field(n_fiso_atm(n,:),vname_in,"kg/m^2 s", & + tstr2D, tcstr,"isotope deposition rate","none", c1, c0, & + ns, f_fiso_atm) + enddo + endif + + if (f_fiso_ocn(1:1) /= 'x') then + do n=1,n_iso + write(nchar,'(i3.3)') n + write(vname_in,'(a,a)') 'fiso_ocn', trim(nchar) + call define_hist_field(n_fiso_ocn(n,:),vname_in,"kg/m^2 s", & + tstr2D, tcstr,"isotope flux to ocean","none", c1, c0, & + ns, f_fiso_ocn) + enddo + endif + ! zsalinity call define_hist_field(n_fzsal,"fzsal","kg/m^2/s",tstr2D, tcstr, & @@ -1839,8 +1893,8 @@ subroutine accum_hist_bgc (iblk) use ice_domain, only: blocks_ice use ice_domain_size, only: nblyr use ice_flux, only: sss - use ice_flux_bgc, only: faero_atm, faero_ocn, flux_bio, flux_bio_ai, & - fzsal_ai, fzsal_g_ai + use ice_flux_bgc, only: fiso_atm, fiso_ocn, faero_atm, faero_ocn, & + flux_bio, flux_bio_ai, fzsal_ai, fzsal_g_ai use ice_history_shared, only: n2D, a2D, a3Dc, & n3Dzcum, n3Dbcum, a3Db, a3Da, & ncat_hist, accum_hist_field, nzblyr, nzalyr @@ -1873,15 +1927,16 @@ subroutine accum_hist_bgc (iblk) workii logical (kind=log_kind) :: & - skl_bgc, z_tracers, tr_aero, tr_brine, solve_zsal - - integer(kind=int_kind) :: nt_aero, nt_fbri, & - nt_bgc_Nit, nt_bgc_Am, nt_bgc_Sil, nt_bgc_DMSPp, & - nt_bgc_DMSPd, nt_bgc_DMS, nt_bgc_PON, nt_bgc_S, & - nt_zbgc_frac, nlt_chl_sw, & - nlt_bgc_Nit, nlt_bgc_Am, nlt_bgc_Sil, & - nlt_bgc_DMS, nlt_bgc_PON, & - nlt_bgc_DMSPp, nlt_bgc_DMSPd, & + skl_bgc, z_tracers, tr_iso, tr_aero, tr_brine, solve_zsal + + integer(kind=int_kind) :: & + nt_isosno, nt_isoice, nt_aero, nt_fbri, & + nt_bgc_Nit, nt_bgc_Am, nt_bgc_Sil, nt_bgc_DMSPp, & + nt_bgc_DMSPd, nt_bgc_DMS, nt_bgc_PON, nt_bgc_S, & + nt_zbgc_frac, nlt_chl_sw, & + nlt_bgc_Nit, nlt_bgc_Am, nlt_bgc_Sil, & + nlt_bgc_DMS, nlt_bgc_PON, & + nlt_bgc_DMSPp, nlt_bgc_DMSPd, & nt_bgc_hum, nlt_bgc_hum integer (kind=int_kind), dimension(icepack_max_aero) :: & @@ -1915,11 +1970,13 @@ subroutine accum_hist_bgc (iblk) call icepack_query_parameters(rhos_out=rhos, rhoi_out=rhoi, & rhow_out=rhow, puny_out=puny, sk_l_out=sk_l) - call icepack_query_tracer_flags( & + call icepack_query_tracer_flags(tr_iso_out=tr_iso, & tr_aero_out=tr_aero, tr_brine_out=tr_brine) call icepack_query_parameters(skl_bgc_out=skl_bgc, & solve_zsal_out=solve_zsal, z_tracers_out=z_tracers) - call icepack_query_tracer_indices( nt_aero_out=nt_aero, & + call icepack_query_tracer_indices( & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice, & + nt_aero_out=nt_aero, & nt_fbri_out=nt_fbri, nt_bgc_DOC_out=nt_bgc_DOC, & nt_zaero_out=nt_zaero, nt_bgc_DIC_out=nt_bgc_DIC, & nt_bgc_DON_out=nt_bgc_DON, nt_bgc_N_out=nt_bgc_N, & @@ -1955,7 +2012,7 @@ subroutine accum_hist_bgc (iblk) ! increment field !--------------------------------------------------------------- - if (tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then + if (tr_iso .or. tr_aero .or. tr_brine .or. solve_zsal .or. skl_bgc) then ! 2d bgc fields @@ -1971,6 +2028,28 @@ subroutine accum_hist_bgc (iblk) if (f_zsal (1:1) /= 'x') & call accum_hist_field(n_zsal, iblk, zsal_tot(:,:,iblk), a2D) + ! isotopes + if (f_fiso_atm(1:1) /= 'x') then + do n=1,n_iso + call accum_hist_field(n_fiso_atm(n,:),iblk, & + fiso_atm(:,:,n,iblk), a2D) + enddo + endif + if (f_fiso_ocn(1:1) /= 'x') then + do n=1,n_iso + call accum_hist_field(n_fiso_ocn(n,:),iblk, & + fiso_ocn(:,:,n,iblk), a2D) + enddo + endif + if (f_iso(1:1) /= 'x') then + do n=1,n_iso + call accum_hist_field(n_isosno(n,:), iblk, & + trcr(:,:,nt_isosno+n-1,iblk)/rhos, a2D) + call accum_hist_field(n_isoice(n,:), iblk, & + trcr(:,:,nt_isoice+n-1,iblk)/rhos, a2D) + enddo + endif + ! Aerosols if (f_faero_atm(1:1) /= 'x') then do n=1,n_aero diff --git a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 index 86c5a67c4..7eaba64cf 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 @@ -44,11 +44,11 @@ module ice_transport_driver integer (kind=int_kind) :: & ntrace ! number of tracers in use - integer (kind=int_kind), dimension(:), allocatable :: & + integer (kind=int_kind), dimension(:), allocatable, public :: & tracer_type ,&! = 1, 2, or 3 (depends on 0, 1 or 2 other tracers) depend ! tracer dependencies (see below) - logical (kind=log_kind), dimension (:), allocatable :: & + logical (kind=log_kind), dimension (:), allocatable, public :: & has_dependents ! true if a tracer has dependent tracers integer (kind=int_kind), parameter :: & @@ -82,7 +82,7 @@ subroutine init_transport integer (kind=int_kind) :: ntrcr, nt_Tsfc, nt_qice, nt_qsno, & nt_sice, nt_fbri, nt_iage, nt_FY, nt_alvl, nt_vlvl, & - nt_apnd, nt_hpnd, nt_ipnd, nt_fsd, nt_bgc_Nit, nt_bgc_S + nt_apnd, nt_hpnd, nt_ipnd, nt_fsd, nt_isosno, nt_isoice, nt_bgc_Nit, nt_bgc_S character(len=*), parameter :: subname = '(init_transport)' @@ -93,7 +93,8 @@ subroutine init_transport nt_qsno_out=nt_qsno, nt_sice_out=nt_sice, nt_fbri_out=nt_fbri, & nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_alvl_out=nt_alvl, nt_fsd_out=nt_fsd, & nt_vlvl_out=nt_vlvl, nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, & - nt_ipnd_out=nt_ipnd, nt_bgc_Nit_out=nt_bgc_Nit, nt_bgc_S_out=nt_bgc_S) + nt_ipnd_out=nt_ipnd, nt_bgc_Nit_out=nt_bgc_Nit, nt_bgc_S_out=nt_bgc_S, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -194,6 +195,12 @@ subroutine init_transport if (nt-k==nt_fsd) & write(nu_diag,*) 'nt_fsd ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) + if (nt-k==nt_isosno) & + write(nu_diag,*) 'nt_isosno',nt,depend(nt),tracer_type(nt),& + has_dependents(nt) + if (nt-k==nt_isoice) & + write(nu_diag,*) 'nt_isoice',nt,depend(nt),tracer_type(nt),& + has_dependents(nt) if (nt-k==nt_bgc_Nit) & write(nu_diag,*) 'nt_bgc_Nit',nt,depend(nt),tracer_type(nt),& has_dependents(nt) diff --git a/cicecore/cicedynB/general/ice_flux.F90 b/cicecore/cicedynB/general/ice_flux.F90 index afefef9d3..607b763eb 100644 --- a/cicecore/cicedynB/general/ice_flux.F90 +++ b/cicecore/cicedynB/general/ice_flux.F90 @@ -527,7 +527,7 @@ end subroutine alloc_flux subroutine init_coupler_flux use ice_arrays_column, only: Cdn_atm - use ice_flux_bgc, only: flux_bio_atm, flux_bio, faero_atm, & + use ice_flux_bgc, only: flux_bio_atm, flux_bio, faero_atm, fiso_atm, & fnit, famm, fsil, fdmsp, fdms, fhum, fdust, falgalN, & fdoc, fdon, fdic, ffed, ffep use ice_grid, only: bathymetry @@ -617,6 +617,7 @@ subroutine init_coupler_flux fsensn_f (:,:,:,:) = c0 ! sensible heat flux (W/m^2) endif ! + fiso_atm (:,:,:,:) = c0 ! isotope deposition rate (kg/m2/s) faero_atm (:,:,:,:) = c0 ! aerosol deposition rate (kg/m2/s) flux_bio_atm (:,:,:,:) = c0 ! zaero and bio deposition rate (kg/m2/s) @@ -727,6 +728,8 @@ end subroutine init_coupler_flux subroutine init_flux_atm + use ice_flux_bgc, only: fiso_evap, Qref_iso, Qa_iso + character(len=*), parameter :: subname = '(init_flux_atm)' !----------------------------------------------------------------- @@ -748,6 +751,10 @@ subroutine init_flux_atm Qref (:,:,:) = c0 Uref (:,:,:) = c0 + fiso_evap(:,:,:,:) = c0 + Qref_iso (:,:,:,:) = c0 + Qa_iso (:,:,:,:) = c0 + end subroutine init_flux_atm !======================================================================= @@ -763,7 +770,7 @@ end subroutine init_flux_atm subroutine init_flux_ocn - use ice_flux_bgc, only: faero_ocn + use ice_flux_bgc, only: faero_ocn, fiso_ocn, HDO_ocn, H2_16O_ocn, H2_18O_ocn character(len=*), parameter :: subname = '(init_flux_ocn)' @@ -776,7 +783,12 @@ subroutine init_flux_ocn fpond (:,:,:) = c0 fhocn (:,:,:) = c0 fswthru (:,:,:) = c0 - faero_ocn(:,:,:,:) = c0 + + faero_ocn (:,:,:,:) = c0 + fiso_ocn (:,:,:,:) = c0 + HDO_ocn (:,:,:) = c0 + H2_16O_ocn (:,:,:) = c0 + H2_18O_ocn (:,:,:) = c0 end subroutine init_flux_ocn @@ -972,7 +984,11 @@ subroutine scale_fluxes (nx_block, ny_block, & fzsal, fzsal_g, & flux_bio, & fsurf, fcondtop, & - Uref, wind ) + Uref, wind, & + Qref_iso, & + fiso_evap,fiso_ocn) + + use icepack_intfc, only: icepack_max_iso integer (kind=int_kind), intent(in) :: & nx_block, ny_block, & ! block dimensions @@ -1030,6 +1046,13 @@ subroutine scale_fluxes (nx_block, ny_block, & fzsal , & ! salt flux to ocean with prognositic salinity (kg/m2/s) fzsal_g ! Gravity drainage salt flux to ocean (kg/m2/s) + ! isotopes + real (kind=dbl_kind), dimension(nx_block,ny_block,icepack_max_iso), & + optional, intent(inout) :: & + Qref_iso , & ! isotope air sp hum reference level (kg/kg) + fiso_evap, & ! isotope evaporation (kg/m2/s) + fiso_ocn ! isotope flux to ocean (kg/m2/s) + ! local variables real (kind=dbl_kind) :: & @@ -1078,6 +1101,9 @@ subroutine scale_fluxes (nx_block, ny_block, & fzsal_g (i,j) = fzsal_g (i,j) * ar flux_bio (i,j,:) = flux_bio (i,j,:) * ar faero_ocn(i,j,:) = faero_ocn(i,j,:) * ar + if (present(Qref_iso )) Qref_iso (i,j,:) = Qref_iso (i,j,:) * ar + if (present(fiso_evap)) fiso_evap(i,j,:) = fiso_evap(i,j,:) * ar + if (present(fiso_ocn )) fiso_ocn (i,j,:) = fiso_ocn (i,j,:) * ar else ! zero out fluxes strairxT(i,j) = c0 strairyT(i,j) = c0 @@ -1103,6 +1129,9 @@ subroutine scale_fluxes (nx_block, ny_block, & fzsal_g (i,j) = c0 flux_bio (i,j,:) = c0 faero_ocn(i,j,:) = c0 + if (present(Qref_iso )) Qref_iso (i,j,:) = c0 + if (present(fiso_evap)) fiso_evap(i,j,:) = c0 + if (present(fiso_ocn )) fiso_ocn (i,j,:) = c0 endif ! tmask and aice > 0 enddo ! i enddo ! j diff --git a/cicecore/cicedynB/general/ice_flux_bgc.F90 b/cicecore/cicedynB/general/ice_flux_bgc.F90 index 2ff193b2f..56e644431 100644 --- a/cicecore/cicedynB/general/ice_flux_bgc.F90 +++ b/cicecore/cicedynB/general/ice_flux_bgc.F90 @@ -12,7 +12,7 @@ module ice_flux_bgc use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero, icepack_max_nbtrcr, & + use icepack_intfc, only: icepack_max_iso, icepack_max_aero, icepack_max_nbtrcr, & icepack_max_algae, icepack_max_doc, icepack_max_don, icepack_max_dic, icepack_max_fe, & icepack_query_tracer_indices, icepack_query_tracer_flags, icepack_query_parameters @@ -23,22 +23,22 @@ module ice_flux_bgc ! in from atmosphere - real (kind=dbl_kind), & !coupling variable for both tr_aero and tr_zaero + real (kind=dbl_kind), & ! coupling variable for both tr_aero and tr_zaero dimension (:,:,:,:), allocatable, public :: & + fiso_atm, & ! isotope deposition rate (kg/m^2 s) faero_atm ! aerosol deposition rate (kg/m^2 s) real (kind=dbl_kind), & dimension (:,:,:,:), allocatable, public :: & flux_bio_atm ! all bio fluxes to ice from atmosphere - ! in from ocean + ! out to ocean real (kind=dbl_kind), & dimension (:,:,:,:), allocatable, public :: & + fiso_ocn, & ! isotope flux to ocean (kg/m^2/s) faero_ocn ! aerosol flux to ocean (kg/m^2/s) - ! out to ocean - real (kind=dbl_kind), & dimension (:,:,:,:), allocatable, public :: & flux_bio , & ! all bio fluxes to ocean @@ -95,6 +95,19 @@ module ice_flux_bgc real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & zaeros ! ocean aerosols (mmol/m^3) + ! isotopes + real (kind=dbl_kind), & ! coupling variable for tr_iso + dimension (:,:,:,:), allocatable, public :: & + fiso_evap , & ! isotope evaporation rate (kg/m^2 s) + Qa_iso , & ! isotope specific humidity (kg/kg) + Qref_iso ! 2m atm reference isotope spec humidity (kg/kg) + + real (kind=dbl_kind), & ! coupling variable for tr_iso + dimension (:,:,:), allocatable, public :: & + HDO_ocn , & ! seawater concentration of HDO (kg/kg) + H2_16O_ocn, & ! seawater concentration of H2_16O (kg/kg) + H2_18O_ocn ! seawater concentration of H2_18O (kg/kg) + !======================================================================= contains @@ -125,6 +138,14 @@ subroutine alloc_flux_bgc fdust (nx_block,ny_block,max_blocks), & ! ice-ocean dust flux (kg/m^2/s), positive to ocean hin_old (nx_block,ny_block,ncat,max_blocks), & ! old ice thickness dsnown (nx_block,ny_block,ncat,max_blocks), & ! change in snow thickness in category n (m) + HDO_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of HDO (kg/kg) + H2_16O_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of H2_16O (kg/kg) + H2_18O_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of H2_18O (kg/kg) + Qa_iso (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope specific humidity (kg/kg) + Qref_iso (nx_block,ny_block,icepack_max_iso,max_blocks), & ! 2m atm reference isotope spec humidity (kg/kg) + fiso_atm (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope deposition rate (kg/m^2 s) + fiso_evap (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope evaporation rate (kg/m^2 s) + fiso_ocn (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope flux to ocean (kg/m^2/s) faero_atm (nx_block,ny_block,icepack_max_aero,max_blocks), & ! aerosol deposition rate (kg/m^2 s) faero_ocn (nx_block,ny_block,icepack_max_aero,max_blocks), & ! aerosol flux to ocean (kg/m^2/s) zaeros (nx_block,ny_block,icepack_max_aero,max_blocks), & ! ocean aerosols (mmol/m^3) diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 index 0632408bf..64f4b4834 100755 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -72,7 +72,7 @@ module ice_forcing sublim_file, & snow_file - character (char_len_long), dimension(:), allocatable :: & ! input data file names + character (char_len_long), dimension(:), allocatable, public :: & ! input data file names topmelt_file, & botmelt_file @@ -84,10 +84,10 @@ module ice_forcing oldrecnum = 0 , & ! old record number (save between steps) oldrecnum4X = 0 ! - real (kind=dbl_kind), dimension(:,:,:), allocatable :: & + real (kind=dbl_kind), dimension(:,:,:), allocatable, public :: & cldf ! cloud fraction - real (kind=dbl_kind), dimension(:,:,:,:), allocatable :: & + real (kind=dbl_kind), dimension(:,:,:,:), allocatable, public :: & fsw_data, & ! field values at 2 temporal data points cldf_data, & fsnow_data, & @@ -107,8 +107,7 @@ module ice_forcing sublim_data, & frain_data - real (kind=dbl_kind), & - dimension(:,:,:,:,:), allocatable :: & + real (kind=dbl_kind), dimension(:,:,:,:,:), allocatable, public :: & topmelt_data, & botmelt_data @@ -141,8 +140,7 @@ module ice_forcing frcidr = 0.31_dbl_kind, & ! frac of incoming sw in near IR direct band frcidf = 0.17_dbl_kind ! frac of incoming sw in near IR diffuse band - real (kind=dbl_kind), & - dimension (:,:,:,:,:), allocatable :: & + real (kind=dbl_kind), dimension (:,:,:,:,:), allocatable, public :: & ocn_frc_m ! ocn data for 12 months logical (kind=log_kind), public :: & @@ -4362,8 +4360,8 @@ subroutine hycom_atm_files fsw_file = trim(atm_data_dir)//'/forcing.shwflx.nc' flw_file = trim(atm_data_dir)//'/forcing.radflx.nc' rain_file = trim(atm_data_dir)//'/forcing.precip.nc' - uwind_file = trim(atm_data_dir)//'/forcing.ewndsp.nc' !actually Xward, not Eward - vwind_file = trim(atm_data_dir)//'/forcing.nwndsp.nc' !actually Yward, not Nward + uwind_file = trim(atm_data_dir)//'/forcing.wndewd.nc' + vwind_file = trim(atm_data_dir)//'/forcing.wndnwd.nc' tair_file = trim(atm_data_dir)//'/forcing.airtmp.nc' humid_file = trim(atm_data_dir)//'/forcing.vapmix.nc' @@ -4469,11 +4467,11 @@ subroutine hycom_atm_data call read_data_nc_hycom (read6, recnum, & tair_file, fieldname, Tair_data, & field_loc_center, field_type_scalar) - fieldname = 'ewndsp' + fieldname = 'wndewd' call read_data_nc_hycom (read6, recnum, & uwind_file, fieldname, uatm_data, & field_loc_center, field_type_vector) - fieldname = 'nwndsp' + fieldname = 'wndnwd' call read_data_nc_hycom (read6, recnum, & vwind_file, fieldname, vatm_data, & field_loc_center, field_type_vector) diff --git a/cicecore/cicedynB/general/ice_forcing_bgc.F90 b/cicecore/cicedynB/general/ice_forcing_bgc.F90 index 6e543a056..4eedcfb80 100644 --- a/cicecore/cicedynB/general/ice_forcing_bgc.F90 +++ b/cicecore/cicedynB/general/ice_forcing_bgc.F90 @@ -29,16 +29,17 @@ module ice_forcing_bgc implicit none private public :: get_forcing_bgc, get_atm_bgc, fzaero_data, alloc_forcing_bgc, & - init_bgc_data, faero_data, faero_default, faero_optics + init_bgc_data, faero_data, faero_default, faero_optics, & + fiso_default integer (kind=int_kind) :: & bgcrecnum = 0 ! old record number (save between steps) - real (kind=dbl_kind), dimension(:,:,:), allocatable :: & - nitdat , & ! data value toward which nitrate is restored - sildat ! data value toward which silicate is restored + real (kind=dbl_kind), dimension(:,:,:), allocatable, public :: & + nitdat , & ! data value toward which nitrate is restored + sildat ! data value toward which silicate is restored - real (kind=dbl_kind), dimension(:,:,:,:), allocatable, save :: & + real (kind=dbl_kind), dimension(:,:,:,:), allocatable, public :: & nit_data, & ! field values at 2 temporal data points sil_data @@ -538,6 +539,21 @@ end subroutine get_atm_bgc !======================================================================= +! constant values for atmospheric water isotopes +! +! authors: David Bailey, NCAR + + subroutine fiso_default + + use ice_flux_bgc, only: fiso_atm + character(len=*), parameter :: subname='(fiso_default)' + + fiso_atm(:,:,:,:) = 1.e-14_dbl_kind ! kg/m^2 s + + end subroutine fiso_default + +!======================================================================= + ! constant values for atmospheric aerosols ! ! authors: Elizabeth Hunke, LANL diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index 41ff70aec..ffb070644 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -61,7 +61,7 @@ subroutine input_data use ice_diagnostics, only: diag_file, print_global, print_points, latpnt, lonpnt use ice_domain, only: close_boundaries use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, nfsd, nfreq, & - n_aero, n_zaero, n_algae, & + n_iso, n_aero, n_zaero, n_algae, & n_doc, n_dic, n_don, n_fed, n_fep, & max_nstrm use ice_calendar, only: year_init, istep0, histfreq, histfreq_n, & @@ -71,7 +71,7 @@ subroutine input_data use ice_arrays_column, only: oceanmixed_ice use ice_restart_column, only: restart_age, restart_FY, restart_lvl, & restart_pond_cesm, restart_pond_lvl, restart_pond_topo, restart_aero, & - restart_fsd + restart_fsd, restart_iso use ice_restart_shared, only: & restart, restart_ext, restart_dir, restart_file, pointer_file, & runid, runtype, use_restart_time, restart_format, lcdf64 @@ -126,12 +126,13 @@ subroutine input_data logical (kind=log_kind) :: calc_Tsfc, formdrag, highfreq, calc_strair, wave_spec - logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_aero, tr_fsd + logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond + logical (kind=log_kind) :: tr_iso, tr_aero, tr_fsd logical (kind=log_kind) :: tr_pond_cesm, tr_pond_lvl, tr_pond_topo integer (kind=int_kind) :: numin, numax ! unit number limits integer (kind=int_kind) :: rpcesm, rplvl, rptopo - real (kind=dbl_kind) :: Cf, puny + real (kind=dbl_kind) :: Cf, ksno, puny integer :: abort_flag character (len=64) :: tmpstr @@ -168,13 +169,14 @@ subroutine input_data tr_pond_cesm, restart_pond_cesm, & tr_pond_lvl, restart_pond_lvl, & tr_pond_topo, restart_pond_topo, & + tr_iso, restart_iso, & tr_aero, restart_aero, & tr_fsd, restart_fsd, & - n_aero, n_zaero, n_algae, & + n_iso, n_aero, n_zaero, n_algae, & n_doc, n_dic, n_don, n_fed, n_fep namelist /thermo_nml/ & - kitd, ktherm, conduct, & + kitd, ktherm, conduct, ksno, & a_rapid_mode, Rac_rapid_mode, aspect_rapid_mode, & dSdt_slow_mode, phi_c_slow_mode, phi_i_mushy @@ -294,6 +296,7 @@ subroutine input_data 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 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 @@ -392,11 +395,14 @@ subroutine input_data restart_pond_lvl = .false. ! melt ponds restart tr_pond_topo = .false. ! explicit melt ponds (topographic) restart_pond_topo = .false. ! melt ponds restart + tr_iso = .false. ! isotopes + restart_iso = .false. ! isotopes restart tr_aero = .false. ! aerosols restart_aero = .false. ! aerosols restart tr_fsd = .false. ! floe size distribution restart_fsd = .false. ! floe size distribution restart + n_iso = 0 n_aero = 0 n_zaero = 0 n_algae = 0 @@ -571,6 +577,7 @@ subroutine input_data call broadcast_scalar(krdg_redist, master_task) call broadcast_scalar(mu_rdg, master_task) call broadcast_scalar(Cf, master_task) + call broadcast_scalar(ksno, master_task) call broadcast_scalar(basalstress, master_task) call broadcast_scalar(k1, master_task) call broadcast_scalar(k2, master_task) @@ -660,6 +667,8 @@ subroutine input_data call broadcast_scalar(restart_pond_lvl, master_task) call broadcast_scalar(tr_pond_topo, master_task) call broadcast_scalar(restart_pond_topo, master_task) + call broadcast_scalar(tr_iso, master_task) + call broadcast_scalar(restart_iso, master_task) call broadcast_scalar(tr_aero, master_task) call broadcast_scalar(restart_aero, master_task) call broadcast_scalar(tr_fsd, master_task) @@ -669,6 +678,7 @@ subroutine input_data call broadcast_scalar(nilyr, master_task) call broadcast_scalar(nslyr, master_task) call broadcast_scalar(nblyr, master_task) + call broadcast_scalar(n_iso, master_task) call broadcast_scalar(n_aero, master_task) call broadcast_scalar(n_zaero, master_task) call broadcast_scalar(n_algae, master_task) @@ -721,6 +731,7 @@ subroutine input_data if (my_task == master_task) & write(nu_diag,*) subname//' WARNING: ice_ic = none or default, setting restart flags to .false.' restart = .false. + restart_iso = .false. restart_aero = .false. restart_fsd = .false. restart_age = .false. @@ -828,6 +839,15 @@ subroutine input_data abort_flag = 8 endif + if (tr_iso .and. n_iso==0) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: isotopes activated but' + write(nu_diag,*) subname//' ERROR: not allocated in tracer array.' + write(nu_diag,*) subname//' ERROR: Activate in compilation script.' + endif + abort_flag = 31 + endif + if (tr_aero .and. n_aero==0) then if (my_task == master_task) then write(nu_diag,*) subname//' ERROR: aerosols activated but' @@ -931,6 +951,7 @@ subroutine input_data ice_IOUnitsMaxUnit = numax call icepack_init_parameters(Cf_in=Cf) + call icepack_init_parameters(ksno_in=ksno) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname//'Icepack Abort1', & file=__FILE__, line=__LINE__) @@ -1055,6 +1076,7 @@ subroutine input_data trim(advection) write(nu_diag,1030) ' shortwave = ', & trim(shortwave) + write(nu_diag,1000) ' ksno = ', ksno if (cpl_bgc) then write(nu_diag,1000) ' BGC coupling is switched ON' else @@ -1197,6 +1219,8 @@ subroutine input_data 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 @@ -1207,6 +1231,7 @@ subroutine input_data 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 write(nu_diag,1020) ' n_algae = ', n_algae @@ -1270,10 +1295,12 @@ subroutine input_data wave_spec_in=wave_spec, nfreq_in=nfreq, & tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type) call icepack_init_tracer_flags(tr_iage_in=tr_iage, tr_FY_in=tr_FY, & - tr_lvl_in=tr_lvl, tr_aero_in=tr_aero, tr_fsd_in=tr_fsd, tr_pond_in=tr_pond, & + 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, & tr_pond_cesm_in=tr_pond_cesm, tr_pond_lvl_in=tr_pond_lvl, tr_pond_topo_in=tr_pond_topo) call icepack_init_tracer_sizes(ncat_in=ncat, nilyr_in=nilyr, nslyr_in=nslyr, nblyr_in=nblyr, & - nfsd_in=nfsd, n_algae_in=n_algae, n_aero_in=n_aero, n_DOC_in=n_DOC, n_DON_in=n_DON, & + nfsd_in=nfsd, n_algae_in=n_algae, n_iso_in=n_iso, n_aero_in=n_aero, & + n_DOC_in=n_DOC, n_DON_in=n_DON, & n_DIC_in=n_DIC, n_fed_in=n_fed, n_fep_in=n_fep, n_zaero_in=n_zaero) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -1301,7 +1328,7 @@ subroutine init_state use ice_blocks, only: block, get_block, nx_block, ny_block use ice_domain, only: nblocks, blocks_ice - use ice_domain_size, only: ncat, nilyr, nslyr, n_aero, nfsd + use ice_domain_size, only: ncat, nilyr, nslyr, n_iso, n_aero, nfsd use ice_flux, only: sst, Tf, Tair, salinz, Tmltz use ice_grid, only: tmask, ULON, TLAT use ice_state, only: trcr_depend, aicen, trcrn, vicen, vsnon, & @@ -1322,11 +1349,11 @@ subroutine init_state heat_capacity ! from icepack integer (kind=int_kind) :: ntrcr - logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_aero, tr_fsd + logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_fsd logical (kind=log_kind) :: tr_pond_cesm, tr_pond_lvl, tr_pond_topo integer (kind=int_kind) :: nt_Tsfc, nt_sice, nt_qice, nt_qsno, nt_iage, nt_FY - integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, nt_aero - integer (kind=int_kind) :: nt_fsd + integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd + integer (kind=int_kind) :: nt_isosno, nt_isoice, nt_aero, nt_fsd type (block) :: & this_block ! block information for current block @@ -1338,12 +1365,14 @@ subroutine init_state call icepack_query_parameters(heat_capacity_out=heat_capacity) call icepack_query_tracer_sizes(ntrcr_out=ntrcr) call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & - tr_lvl_out=tr_lvl, tr_aero_out=tr_aero, tr_fsd_out=tr_fsd, & + tr_lvl_out=tr_lvl, tr_iso_out=tr_iso, tr_aero_out=tr_aero, tr_fsd_out=tr_fsd, & tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, tr_pond_topo_out=tr_pond_topo) call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, nt_sice_out=nt_sice, & nt_qice_out=nt_qice, nt_qsno_out=nt_qsno, nt_iage_out=nt_iage, nt_fy_out=nt_fy, & nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, & - nt_ipnd_out=nt_ipnd, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd) + nt_ipnd_out=nt_ipnd, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) + call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -1423,6 +1452,12 @@ subroutine init_state trcr_depend(nt_fsd + it - 1) = 0 ! area-weighted floe size distribution enddo endif + if (tr_iso) then ! isotopes + do it = 1, n_iso + trcr_depend(nt_isosno+it-1) = 2 ! snow + trcr_depend(nt_isoice+it-1) = 1 ! ice + enddo + endif if (tr_aero) then ! volume-weighted aerosols do it = 1, n_aero trcr_depend(nt_aero+(it-1)*4 ) = 2 ! snow diff --git a/cicecore/cicedynB/general/ice_step_mod.F90 b/cicecore/cicedynB/general/ice_step_mod.F90 index b8d796710..e389adc87 100644 --- a/cicecore/cicedynB/general/ice_step_mod.F90 +++ b/cicecore/cicedynB/general/ice_step_mod.F90 @@ -27,7 +27,7 @@ module ice_step_mod use icepack_intfc, only: icepack_biogeochemistry, icepack_load_ocean_bio_array use icepack_intfc, only: icepack_max_algae, icepack_max_nbtrcr, icepack_max_don use icepack_intfc, only: icepack_max_doc, icepack_max_dic, icepack_max_aero - use icepack_intfc, only: icepack_max_fe + use icepack_intfc, only: icepack_max_fe, icepack_max_iso use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_sizes use icepack_intfc, only: icepack_query_tracer_indices @@ -161,7 +161,7 @@ subroutine step_therm1 (dt, iblk) use ice_blocks, only: block, get_block, nx_block, ny_block use ice_calendar, only: yday use ice_domain, only: blocks_ice - use ice_domain_size, only: ncat, nilyr, nslyr, n_aero + use ice_domain_size, only: ncat, nilyr, nslyr, n_iso, n_aero use ice_flux, only: frzmlt, sst, Tf, strocnxT, strocnyT, rside, fbot, Tbot, Tsnice, & meltsn, melttn, meltbn, congeln, snoicen, uatm, vatm, fside, & wind, rhoa, potT, Qa, zlvl, strax, stray, flatn, fsensn, fsurfn, fcondtopn, & @@ -170,7 +170,8 @@ subroutine step_therm1 (dt, iblk) flat, fswabs, flwout, evap, evaps, evapi, Tref, Qref, Uref, fresh, fsalt, fhocn, & fswthru, meltt, melts, meltb, congel, snoice, & flatn_f, fsensn_f, fsurfn_f, fcondtopn_f - use ice_flux_bgc, only: dsnown, faero_atm, faero_ocn + use ice_flux_bgc, only: dsnown, faero_atm, faero_ocn, fiso_atm, fiso_ocn, & + Qa_iso, Qref_iso, fiso_evap, HDO_ocn, H2_16O_ocn, H2_18O_ocn use ice_grid, only: lmask_n, lmask_s, tmask use ice_state, only: aice, aicen, aice_init, aicen_init, vicen_init, & vice, vicen, vsno, vsnon, trcrn, uvel, vvel, vsnon_init @@ -198,10 +199,11 @@ subroutine step_therm1 (dt, iblk) integer (kind=int_kind) :: & ntrcr, nt_apnd, nt_hpnd, nt_ipnd, nt_alvl, nt_vlvl, nt_Tsfc, & - nt_iage, nt_FY, nt_qice, nt_sice, nt_aero, nt_qsno + nt_iage, nt_FY, nt_qice, nt_sice, nt_aero, nt_qsno, & + nt_isosno, nt_isoice logical (kind=log_kind) :: & - tr_iage, tr_FY, tr_aero, tr_pond, tr_pond_cesm, & + tr_iage, tr_FY, tr_iso, tr_aero, tr_pond, tr_pond_cesm, & tr_pond_lvl, tr_pond_topo, calc_Tsfc real (kind=dbl_kind) :: & @@ -210,6 +212,9 @@ subroutine step_therm1 (dt, iblk) real (kind=dbl_kind), dimension(n_aero,2,ncat) :: & aerosno, aeroice ! kg/m^2 + real (kind=dbl_kind), dimension(n_iso,ncat) :: & + isosno, isoice ! kg/m^2 + type (block) :: & this_block ! block information for current block @@ -219,7 +224,7 @@ subroutine step_therm1 (dt, iblk) call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc) call icepack_query_tracer_sizes(ntrcr_out=ntrcr) call icepack_query_tracer_flags( & - tr_iage_out=tr_iage, tr_FY_out=tr_FY, & + tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_iso_out=tr_iso, & tr_aero_out=tr_aero, tr_pond_out=tr_pond, tr_pond_cesm_out=tr_pond_cesm, & tr_pond_lvl_out=tr_pond_lvl, tr_pond_topo_out=tr_pond_topo) call icepack_query_tracer_indices( & @@ -227,7 +232,8 @@ subroutine step_therm1 (dt, iblk) nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, nt_Tsfc_out=nt_Tsfc, & nt_iage_out=nt_iage, nt_FY_out=nt_FY, & nt_qice_out=nt_qice, nt_sice_out=nt_sice, & - nt_aero_out=nt_aero, nt_qsno_out=nt_qsno) + nt_aero_out=nt_aero, nt_qsno_out=nt_qsno, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -236,6 +242,8 @@ subroutine step_therm1 (dt, iblk) prescribed_ice = .false. #endif + isosno (:,:) = c0 + isoice (:,:) = c0 aerosno(:,:,:) = c0 aeroice(:,:,:) = c0 @@ -270,8 +278,16 @@ subroutine step_therm1 (dt, iblk) do j = jlo, jhi do i = ilo, ihi - if (tr_aero) then - ! trcrn(nt_aero) has units kg/m^3 + if (tr_iso) then ! trcrn(nt_iso*) has units kg/m^3 + do n=1,ncat + do k=1,n_iso + isosno(k,n) = trcrn(i,j,nt_isosno+k-1,n,iblk) * vsnon_init(i,j,n,iblk) + isoice(k,n) = trcrn(i,j,nt_isoice+k-1,n,iblk) * vicen_init(i,j,n,iblk) + enddo + enddo + endif ! tr_iso + + if (tr_aero) then ! trcrn(nt_aero) has units kg/m^3 do n=1,ncat do k=1,n_aero aerosno (k,:,n) = & @@ -311,15 +327,19 @@ subroutine step_therm1 (dt, iblk) FY = trcrn (i,j,nt_FY ,:,iblk), & aerosno = aerosno (:,:,:), & aeroice = aeroice (:,:,:), & + isosno = isosno (:,:), & + isoice = isoice (:,:), & uatm = uatm (i,j, iblk), & vatm = vatm (i,j, iblk), & wind = wind (i,j, iblk), & zlvl = zlvl (i,j, iblk), & Qa = Qa (i,j, iblk), & + Qa_iso = Qa_iso (i,j,:,iblk), & rhoa = rhoa (i,j, iblk), & Tair = Tair (i,j, iblk), & Tref = Tref (i,j, iblk), & Qref = Qref (i,j, iblk), & + Qref_iso = Qref_iso (i,j,:,iblk), & Uref = Uref (i,j, iblk), & Cdn_atm_ratio= Cdn_atm_ratio(i,j, iblk), & Cdn_ocn = Cdn_ocn (i,j, iblk), & @@ -389,6 +409,12 @@ subroutine step_therm1 (dt, iblk) fcondtopn_f = fcondtopn_f (i,j,:,iblk), & faero_atm = faero_atm (i,j,1:n_aero,iblk), & faero_ocn = faero_ocn (i,j,1:n_aero,iblk), & + fiso_atm = fiso_atm (i,j,:,iblk), & + fiso_ocn = fiso_ocn (i,j,:,iblk), & + fiso_evap = fiso_evap (i,j,:,iblk), & + HDO_ocn = HDO_ocn (i,j, iblk), & + H2_16O_ocn = H2_16O_ocn (i,j, iblk), & + H2_18O_ocn = H2_18O_ocn (i,j, iblk), & dhsn = dhsn (i,j,:,iblk), & ffracn = ffracn (i,j,:,iblk), & meltt = meltt (i,j, iblk), & @@ -408,6 +434,19 @@ subroutine step_therm1 (dt, iblk) frz_onset = frz_onset (i,j, iblk), & yday=yday, prescribed_ice=prescribed_ice) + if (tr_iso) then + do n = 1, ncat + if (vicen(i,j,n,iblk) > puny) & + isoice(:,n) = isoice(:,n)/vicen(i,j,n,iblk) + if (vsnon(i,j,n,iblk) > puny) & + isosno(:,n) = isosno(:,n)/vsnon(i,j,n,iblk) + do k = 1, n_iso + trcrn(i,j,nt_isosno+k-1,n,iblk) = isosno(k,n) + trcrn(i,j,nt_isoice+k-1,n,iblk) = isoice(k,n) + enddo + enddo + endif ! tr_iso + if (tr_aero) then do n = 1, ncat if (vicen(i,j,n,iblk) > puny) & @@ -452,7 +491,8 @@ subroutine step_therm2 (dt, iblk) use ice_flux, only: fresh, frain, fpond, frzmlt, frazil, frz_onset, & update_ocn_f, fsalt, Tf, sss, salinz, fhocn, rside, fside, & meltl, frazil_diag - use ice_flux_bgc, only: flux_bio, faero_ocn + use ice_flux_bgc, only: flux_bio, faero_ocn, & + fiso_ocn, HDO_ocn, H2_16O_ocn, H2_18O_ocn use ice_grid, only: tmask use ice_state, only: aice, aicen, aice0, trcr_depend, & aicen_init, vicen_init, trcrn, vicen, vsnon, & @@ -550,7 +590,12 @@ subroutine step_therm2 (dt, iblk) ocean_bio = ocean_bio (i,j,1:nbtrcr,iblk), & frazil_diag= frazil_diag(i,j,iblk), & frz_onset = frz_onset (i,j, iblk), & - yday = yday, nfsd=nfsd, & + yday = yday, & + fiso_ocn = fiso_ocn (i,j,:,iblk), & + HDO_ocn = HDO_ocn (i,j, iblk), & + H2_16O_ocn = H2_16O_ocn(i,j, iblk), & + H2_18O_ocn = H2_18O_ocn(i,j, iblk), & + nfsd = nfsd, & wave_sig_ht= wave_sig_ht(i,j,iblk), & wave_spectrum = wave_spectrum(i,j,:,iblk), & wavefreq = wavefreq(:), & @@ -820,7 +865,7 @@ subroutine step_dyn_ridge (dt, ndtd, iblk) dvirdgdt, opening, fpond, fresh, fhocn, & aparticn, krdgn, aredistn, vredistn, dardg1ndt, dardg2ndt, & dvirdgndt, araftn, vraftn, fsalt - use ice_flux_bgc, only: flux_bio, faero_ocn + use ice_flux_bgc, only: flux_bio, faero_ocn, fiso_ocn use ice_grid, only: tmask use ice_state, only: trcrn, vsnon, aicen, vicen, & aice, aice0, trcr_depend, n_trcr_strata, & @@ -897,6 +942,7 @@ subroutine step_dyn_ridge (dt, ndtd, iblk) fresh = fresh (i,j, iblk), & fhocn = fhocn (i,j, iblk), & faero_ocn = faero_ocn(i,j,:,iblk), & + fiso_ocn = fiso_ocn (i,j,:,iblk), & aparticn = aparticn (i,j,:,iblk), & krdgn = krdgn (i,j,:,iblk), & aredistn = aredistn (i,j,:,iblk), & diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 index 3dce5a42e..884ee6331 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 @@ -100,19 +100,19 @@ module ice_boundary ! !----------------------------------------------------------------------- - integer (int_kind) :: & + integer (int_kind), public :: & bufSizeSend, &! max buffer size for send messages bufSizeRecv ! max buffer size for recv messages - integer (int_kind), dimension(:,:), allocatable :: & + integer (int_kind), dimension(:,:), allocatable, public :: & bufSendI4, &! buffer for use to send in 2D i4 halo updates bufRecvI4 ! buffer for use to recv in 2D i4 halo updates - real (real_kind), dimension(:,:), allocatable :: & + real (real_kind), dimension(:,:), allocatable, public :: & bufSendR4, &! buffer for use to send in 2D r4 halo updates bufRecvR4 ! buffer for use to recv in 2D r4 halo updates - real (dbl_kind), dimension(:,:), allocatable :: & + real (dbl_kind), dimension(:,:), allocatable, public :: & bufSendR8, &! buffer for use to send in 2D r8 halo updates bufRecvR8 ! buffer for use to recv in 2D r8 halo updates @@ -122,13 +122,13 @@ module ice_boundary ! !----------------------------------------------------------------------- - integer (int_kind), dimension(:,:), allocatable :: & + integer (int_kind), dimension(:,:), allocatable, public :: & bufTripoleI4 - real (real_kind), dimension(:,:), allocatable :: & + real (real_kind), dimension(:,:), allocatable, public :: & bufTripoleR4 - real (dbl_kind), dimension(:,:), allocatable :: & + real (dbl_kind), dimension(:,:), allocatable, public :: & bufTripoleR8 !*********************************************************************** diff --git a/cicecore/cicedynB/infrastructure/ice_blocks.F90 b/cicecore/cicedynB/infrastructure/ice_blocks.F90 index b95ad6acb..5177dd047 100644 --- a/cicecore/cicedynB/infrastructure/ice_blocks.F90 +++ b/cicecore/cicedynB/infrastructure/ice_blocks.F90 @@ -89,15 +89,15 @@ module ice_blocks ! !----------------------------------------------------------------------- - type (block), dimension(:), allocatable :: & + type (block), dimension(:), allocatable, public :: & all_blocks ! block information for all blocks in domain - integer (int_kind), dimension(:,:),allocatable :: & + integer (int_kind), dimension(:,:),allocatable, public :: & all_blocks_ij ! block index stored in Cartesian order ! useful for determining block index ! of neighbor blocks - integer (int_kind), dimension(:,:), allocatable, target :: & + integer (int_kind), dimension(:,:), allocatable, target, public :: & i_global, &! global i index for each point in each block j_global ! global j index for each point in each block @@ -157,10 +157,10 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, & ! !---------------------------------------------------------------------- - allocate(all_blocks(nblocks_tot)) - allocate(i_global(nx_block,nblocks_tot), & - j_global(ny_block,nblocks_tot)) - allocate(all_blocks_ij(nblocks_x,nblocks_y)) + if (.not.allocated(all_blocks)) allocate(all_blocks(nblocks_tot)) + if (.not.allocated(i_global)) allocate(i_global(nx_block,nblocks_tot)) + if (.not.allocated(j_global)) allocate(j_global(ny_block,nblocks_tot)) + if (.not.allocated(all_blocks_ij)) allocate(all_blocks_ij(nblocks_x,nblocks_y)) !---------------------------------------------------------------------- ! diff --git a/cicecore/cicedynB/infrastructure/ice_domain.F90 b/cicecore/cicedynB/infrastructure/ice_domain.F90 index 51a9eaa69..3be2449f7 100644 --- a/cicecore/cicedynB/infrastructure/ice_domain.F90 +++ b/cicecore/cicedynB/infrastructure/ice_domain.F90 @@ -188,6 +188,7 @@ subroutine init_domain_blocks ( (dble(nx_global-1)/dble(block_size_x + 1)) * & (dble(ny_global-1)/dble(block_size_y + 1)) ) & / dble(nprocs)) + max_blocks=max(1,max_blocks) write(nu_diag,'(/,a52,i6,/)') & '(ice_domain): max_block < 1: max_block estimated to ',max_blocks endif diff --git a/cicecore/cicedynB/infrastructure/ice_restoring.F90 b/cicecore/cicedynB/infrastructure/ice_restoring.F90 index 1ef7b9531..09db9c273 100644 --- a/cicecore/cicedynB/infrastructure/ice_restoring.F90 +++ b/cicecore/cicedynB/infrastructure/ice_restoring.F90 @@ -32,12 +32,12 @@ module ice_restoring ! state of the ice for each category !----------------------------------------------------------------- - real (kind=dbl_kind), dimension (:,:,:,:), allocatable :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & aicen_rest , & ! concentration of ice vicen_rest , & ! volume per unit area of ice (m) vsnon_rest ! volume per unit area of snow (m) - real (kind=dbl_kind), dimension (:,:,:,:,:), allocatable :: & + real (kind=dbl_kind), dimension (:,:,:,:,:), allocatable, public :: & trcrn_rest ! tracers !======================================================================= diff --git a/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 index 9e9150b6c..8ecfeb6f1 100644 --- a/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 @@ -15,10 +15,11 @@ module ice_restart use ice_fileunits, only: nu_diag, nu_rst_pointer use ice_fileunits, only: nu_dump, nu_dump_eap, nu_dump_FY, nu_dump_age use ice_fileunits, only: nu_dump_lvl, nu_dump_pond, nu_dump_hbrine - use ice_fileunits, only: nu_dump_bgc, nu_dump_aero, nu_dump_fsd + use ice_fileunits, only: nu_dump_bgc, nu_dump_aero, nu_dump_fsd, nu_dump_iso use ice_fileunits, only: nu_restart, nu_restart_eap, nu_restart_FY, nu_restart_age use ice_fileunits, only: nu_restart_lvl, nu_restart_pond, nu_restart_hbrine use ice_fileunits, only: nu_restart_bgc, nu_restart_aero, nu_restart_fsd + use ice_fileunits, only: nu_restart_iso use ice_exit, only: abort_ice use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_sizes @@ -52,7 +53,7 @@ subroutine init_restart_read(ice_ic) logical (kind=log_kind) :: & solve_zsal, tr_fsd, & - tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, & + tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_pond_cesm, & tr_pond_topo, tr_pond_lvl, tr_brine character(len=char_len_long) :: & @@ -77,7 +78,7 @@ subroutine init_restart_read(ice_ic) nbtrcr_out=nbtrcr) call icepack_query_tracer_flags( & tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, tr_fsd_out=tr_fsd, & - tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & + tr_iso_out=tr_iso, tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -320,6 +321,26 @@ subroutine init_restart_read(ice_ic) endif endif + if (tr_iso) then + if (my_task == master_task) then + n = index(filename0,trim(restart_file)) + if (n == 0) call abort_ice(subname//'ERROR: iso restart: filename discrepancy') + string1 = trim(filename0(1:n-1)) + string2 = trim(filename0(n+lenstr(restart_file):lenstr(filename0))) + write(filename,'(a,a,a,a)') & + string1(1:lenstr(string1)), & + restart_file(1:lenstr(restart_file)),'.iso', & + string2(1:lenstr(string2)) + if (restart_ext) then + call ice_open_ext(nu_restart_iso,filename,0) + else + call ice_open(nu_restart_iso,filename,0) + endif + read (nu_restart_iso) iignore,rignore,rignore + write(nu_diag,*) 'Reading ',filename(1:lenstr(filename)) + endif + endif + if (tr_aero) then if (my_task == master_task) then n = index(filename0,trim(restart_file)) @@ -366,7 +387,7 @@ subroutine init_restart_write(filename_spec) logical (kind=log_kind) :: & solve_zsal, tr_fsd, & - tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, & + tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_pond_cesm, & tr_pond_topo, tr_pond_lvl, tr_brine integer (kind=int_kind) :: & @@ -383,7 +404,7 @@ subroutine init_restart_write(filename_spec) nbtrcr_out=nbtrcr) call icepack_query_tracer_flags( & tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, tr_fsd_out=tr_fsd, & - tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & + tr_iso_out=tr_iso, tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -618,6 +639,26 @@ subroutine init_restart_write(filename_spec) endif endif + if (tr_iso) then + + write(filename,'(a,a,a,i4.4,a,i2.2,a,i2.2,a,i5.5)') & + restart_dir(1:lenstr(restart_dir)), & + restart_file(1:lenstr(restart_file)),'.iso.', & + iyear,'-',month,'-',mday,'-',sec + + if (restart_ext) then + call ice_open_ext(nu_dump_iso,filename,0) + else + call ice_open(nu_dump_iso,filename,0) + endif + + if (my_task == master_task) then + write(nu_dump_iso) istep1,time,time_forc + write(nu_diag,*) 'Writing ',filename(1:lenstr(filename)) + endif + + endif + if (tr_aero) then write(filename,'(a,a,a,i4.4,a,i2.2,a,i2.2,a,i5.5)') & @@ -767,7 +808,7 @@ subroutine final_restart() logical (kind=log_kind) :: & solve_zsal, & - tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, & + tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_pond_cesm, & tr_pond_topo, tr_pond_lvl, tr_brine integer (kind=int_kind) :: & @@ -781,7 +822,7 @@ subroutine final_restart() nbtrcr_out=nbtrcr) call icepack_query_tracer_flags( & tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, & - tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & + tr_iso_out=tr_iso, tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -790,6 +831,7 @@ subroutine final_restart() if (my_task == master_task) then close(nu_dump) + if (tr_iso) close(nu_dump_iso) if (tr_aero) close(nu_dump_aero) if (tr_iage) close(nu_dump_age) if (tr_FY) close(nu_dump_FY) diff --git a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 index ecabcc089..d4decf6f7 100644 --- a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 @@ -113,7 +113,7 @@ subroutine init_restart_write(filename_spec) time, time_forc, year_init use ice_communicate, only: my_task, master_task use ice_domain_size, only: nx_global, ny_global, ncat, nilyr, nslyr, & - n_aero, nblyr, n_zaero, n_algae, n_doc, & + n_iso, n_aero, nblyr, n_zaero, n_algae, n_doc, & n_dic, n_don, n_fed, n_fep, nfsd use ice_arrays_column, only: oceanmixed_ice use ice_dyn_shared, only: kdyn @@ -124,13 +124,13 @@ subroutine init_restart_write(filename_spec) logical (kind=log_kind) :: & solve_zsal, skl_bgc, z_tracers, tr_fsd, & - tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, & + tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_pond_cesm, & tr_pond_topo, tr_pond_lvl, tr_brine, & tr_bgc_N, tr_bgc_C, tr_bgc_Nit, & tr_bgc_Sil, tr_bgc_DMS, & - tr_bgc_chl, tr_bgc_Am, & + tr_bgc_chl, tr_bgc_Am, & tr_bgc_PON, tr_bgc_DON, & - tr_zaero, tr_bgc_Fe, & + tr_zaero, tr_bgc_Fe, & tr_bgc_hum integer (kind=int_kind) :: & @@ -160,7 +160,7 @@ subroutine init_restart_write(filename_spec) nbtrcr_out=nbtrcr) call icepack_query_tracer_flags( & tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, tr_fsd_out=tr_fsd, & - tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & + tr_iso_out=tr_iso, tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine, & tr_bgc_N_out=tr_bgc_N, tr_bgc_C_out=tr_bgc_C, tr_bgc_Nit_out=tr_bgc_Nit, & tr_bgc_Sil_out=tr_bgc_Sil, tr_bgc_DMS_out=tr_bgc_DMS, & @@ -470,6 +470,14 @@ subroutine init_restart_write(filename_spec) enddo endif + if (tr_iso) then + do k=1,n_iso + write(nchar,'(i3.3)') k + call define_rest_field(ncid,'isosno'//trim(nchar),dims) + call define_rest_field(ncid,'isoice'//trim(nchar),dims) + enddo + endif + if (tr_aero) then do k=1,n_aero write(nchar,'(i3.3)') k diff --git a/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 index 8dc9e94a9..d673c7f7a 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 @@ -125,7 +125,7 @@ subroutine init_restart_write(filename_spec) time, time_forc, year_init use ice_communicate, only: my_task, master_task use ice_domain_size, only: nx_global, ny_global, ncat, nilyr, nslyr, & - n_aero, nblyr, n_zaero, n_algae, n_doc, & + n_iso, n_aero, nblyr, n_zaero, n_algae, n_doc, & n_dic, n_don, n_fed, n_fep use ice_dyn_shared, only: kdyn use ice_arrays_column, only: oceanmixed_ice @@ -134,7 +134,7 @@ subroutine init_restart_write(filename_spec) solve_zsal, skl_bgc, z_tracers logical (kind=log_kind) :: & - tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, & + tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_pond_cesm, & tr_pond_topo, tr_pond_lvl, tr_brine, & tr_bgc_N, tr_bgc_C, tr_bgc_Nit, & tr_bgc_Sil, tr_bgc_DMS, & @@ -171,7 +171,7 @@ subroutine init_restart_write(filename_spec) call icepack_query_tracer_sizes(nbtrcr_out=nbtrcr) call icepack_query_tracer_flags( & tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, & - tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & + tr_iso_out=tr_iso, tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine, & tr_bgc_N_out=tr_bgc_N, tr_bgc_C_out=tr_bgc_C, tr_bgc_Nit_out=tr_bgc_Nit, & tr_bgc_Sil_out=tr_bgc_Sil, tr_bgc_DMS_out=tr_bgc_DMS, & @@ -473,6 +473,14 @@ subroutine init_restart_write(filename_spec) call define_rest_field(File,'qsno'//trim(nchar),dims) enddo + if (tr_iso) then + do k=1,n_iso + write(nchar,'(i3.3)') k + call define_rest_field(File,'isosno'//nchar, dims) + call define_rest_field(File,'isoice'//nchar, dims) + enddo + endif + if (tr_aero) then do k=1,n_aero write(nchar,'(i3.3)') k diff --git a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 index 8dc9e94a9..d673c7f7a 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 @@ -125,7 +125,7 @@ subroutine init_restart_write(filename_spec) time, time_forc, year_init use ice_communicate, only: my_task, master_task use ice_domain_size, only: nx_global, ny_global, ncat, nilyr, nslyr, & - n_aero, nblyr, n_zaero, n_algae, n_doc, & + n_iso, n_aero, nblyr, n_zaero, n_algae, n_doc, & n_dic, n_don, n_fed, n_fep use ice_dyn_shared, only: kdyn use ice_arrays_column, only: oceanmixed_ice @@ -134,7 +134,7 @@ subroutine init_restart_write(filename_spec) solve_zsal, skl_bgc, z_tracers logical (kind=log_kind) :: & - tr_iage, tr_FY, tr_lvl, tr_aero, tr_pond_cesm, & + tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_pond_cesm, & tr_pond_topo, tr_pond_lvl, tr_brine, & tr_bgc_N, tr_bgc_C, tr_bgc_Nit, & tr_bgc_Sil, tr_bgc_DMS, & @@ -171,7 +171,7 @@ subroutine init_restart_write(filename_spec) call icepack_query_tracer_sizes(nbtrcr_out=nbtrcr) call icepack_query_tracer_flags( & tr_iage_out=tr_iage, tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, & - tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & + tr_iso_out=tr_iso, tr_aero_out=tr_aero, tr_pond_cesm_out=tr_pond_cesm, & tr_pond_topo_out=tr_pond_topo, tr_pond_lvl_out=tr_pond_lvl, tr_brine_out=tr_brine, & tr_bgc_N_out=tr_bgc_N, tr_bgc_C_out=tr_bgc_C, tr_bgc_Nit_out=tr_bgc_Nit, & tr_bgc_Sil_out=tr_bgc_Sil, tr_bgc_DMS_out=tr_bgc_DMS, & @@ -473,6 +473,14 @@ subroutine init_restart_write(filename_spec) call define_rest_field(File,'qsno'//trim(nchar),dims) enddo + if (tr_iso) then + do k=1,n_iso + write(nchar,'(i3.3)') k + call define_rest_field(File,'isosno'//nchar, dims) + call define_rest_field(File,'isoice'//nchar, dims) + enddo + endif + if (tr_aero) then do k=1,n_aero write(nchar,'(i3.3)') k diff --git a/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 b/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 index b5d2608a3..b72745e30 100644 --- a/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 +++ b/cicecore/drivers/mct/cesm1/CICE_InitMod.F90 @@ -77,7 +77,7 @@ subroutine cice_init(mpicom_ice) use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & get_forcing_atmo, get_forcing_ocn, get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default, faero_optics, alloc_forcing_bgc + faero_default, faero_optics, alloc_forcing_bgc, fiso_default use ice_grid, only: init_grid1, init_grid2, alloc_grid use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runtype @@ -95,7 +95,7 @@ subroutine cice_init(mpicom_ice) mpicom_ice ! communicator for sequential ccsm logical(kind=log_kind) :: tr_aero, tr_zaero, skl_bgc, z_tracers, & - tr_fsd, wave_spec + tr_iso, tr_fsd, wave_spec character(len=*), parameter :: subname = '(cice_init)' call init_communicate(mpicom_ice) ! initial setup for message passing @@ -122,7 +122,6 @@ subroutine cice_init(mpicom_ice) call ice_timer_start(timer_total) ! start timing entire run call init_grid2 ! grid variables call init_zbgc ! vertical biogeochemistry initialization - call init_calendar ! initialize some calendar stuff call init_hist (dt) ! initialize output history file @@ -134,6 +133,7 @@ subroutine cice_init(mpicom_ice) endif call init_coupler_flux ! initialize fluxes exchanged with coupler + #ifdef popcice call sst_sss ! POP data for CICE initialization #endif @@ -181,6 +181,7 @@ subroutine cice_init(mpicom_ice) call init_history_dyn ! initialize dynamic history variables call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero) + call icepack_query_tracer_flags(tr_iso_out=tr_iso) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(trim(subname), & file=__FILE__,line= __LINE__) @@ -211,6 +212,8 @@ subroutine cice_init(mpicom_ice) call get_forcing_atmo ! atmospheric forcing from data call get_forcing_ocn(dt) ! ocean forcing from data + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -239,20 +242,21 @@ subroutine init_restart use ice_calendar, only: time, calendar use ice_constants, only: c0 use ice_domain, only: nblocks - use ice_domain_size, only: ncat, n_aero, nfsd + use ice_domain_size, only: ncat, n_iso, n_aero, nfsd use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn use ice_grid, only: tmask use ice_init, only: ice_ic use ice_init_column, only: init_age, init_FY, init_lvl, & init_meltponds_cesm, init_meltponds_lvl, init_meltponds_topo, & - init_aerosol, init_hbrine, init_bgc, init_fsd + init_isotope, init_aerosol, init_hbrine, init_bgc, init_fsd use ice_restart_column, only: restart_age, read_restart_age, & restart_FY, read_restart_FY, restart_lvl, read_restart_lvl, & restart_pond_cesm, read_restart_pond_cesm, & restart_pond_lvl, read_restart_pond_lvl, & restart_pond_topo, read_restart_pond_topo, & restart_fsd, read_restart_fsd, & + restart_iso, read_restart_iso, & restart_aero, read_restart_aero, & restart_hbrine, read_restart_hbrine, & restart_zsal, restart_bgc @@ -265,13 +269,13 @@ subroutine init_restart iblk ! block index logical(kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_pond_cesm, tr_pond_lvl, & - tr_pond_topo, tr_fsd, tr_aero, tr_brine, & + tr_pond_topo, tr_fsd, tr_iso, tr_aero, tr_brine, & skl_bgc, z_tracers, solve_zsal integer(kind=int_kind) :: & ntrcr integer(kind=int_kind) :: & nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & - nt_iage, nt_FY, nt_aero, nt_fsd + nt_iage, nt_FY, nt_aero, nt_fsd, nt_isosno, nt_isoice character(len=*), parameter :: subname = '(init_restart)' @@ -285,10 +289,11 @@ subroutine init_restart call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_aero_out=tr_aero, tr_brine_out=tr_brine, & - tr_fsd_out=tr_fsd) + tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) call icepack_query_tracer_indices(nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, & nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, & - nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd) + nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -393,6 +398,20 @@ subroutine init_restart call init_fsd(trcrn(:,:,nt_fsd:nt_fsd+nfsd-1,:,:)) endif endif + + ! isotopes + if (tr_iso) then + if (trim(runtype) == 'continue') restart_iso = .true. + if (restart_iso) then + call read_restart_iso + else + do iblk = 1, nblocks + call init_isotope(trcrn(:,:,nt_isosno:nt_isosno+n_iso-1,:,iblk), & + trcrn(:,:,nt_isoice:nt_isoice+n_iso-1,:,iblk)) + enddo ! iblk + endif + endif + if (tr_aero) then ! ice aerosol if (trim(runtype) == 'continue') restart_aero = .true. if (restart_aero) then diff --git a/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 b/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 index 26d40a431..09cffa0c7 100644 --- a/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 +++ b/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 @@ -22,7 +22,7 @@ module CICE_RunMod use ice_constants, only: field_loc_center, field_type_scalar use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero + use icepack_intfc, only: icepack_max_iso, icepack_max_aero use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_sizes @@ -48,12 +48,12 @@ subroutine CICE_Run use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, & get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default + fiso_default, faero_default use ice_flux, only: init_flux_atm, init_flux_ocn use ice_timers, only: ice_timer_start, ice_timer_stop, & timer_couple, timer_step logical (kind=log_kind) :: & - tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd + tr_iso, tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd character(len=*), parameter :: subname = '(CICE_Run)' !-------------------------------------------------------------------- @@ -65,7 +65,8 @@ subroutine CICE_Run call icepack_query_parameters(skl_bgc_out=skl_bgc, & z_tracers_out=z_tracers, & wave_spec_out=wave_spec) - call icepack_query_tracer_flags(tr_aero_out=tr_aero, & + call icepack_query_tracer_flags(tr_iso_out=tr_iso, & + tr_aero_out=tr_aero, & tr_zaero_out=tr_zaero, & tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) @@ -95,6 +96,8 @@ subroutine CICE_Run call get_forcing_atmo ! atmospheric forcing from data call get_forcing_ocn(dt) ! ocean forcing from data + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -150,7 +153,7 @@ subroutine ice_step use ice_restart_column, only: write_restart_age, write_restart_FY, & write_restart_lvl, write_restart_pond_cesm, write_restart_pond_lvl, & write_restart_pond_topo, write_restart_aero, write_restart_fsd, & - write_restart_bgc, write_restart_hbrine + write_restart_iso, write_restart_bgc, write_restart_hbrine use ice_restart_driver, only: dumpfile use ice_restoring, only: restore_ice, ice_HaloRestore use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & @@ -172,7 +175,7 @@ subroutine ice_step logical (kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_fsd, & - tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_aero, & + tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_iso, tr_aero, & calc_Tsfc, skl_bgc, solve_zsal, z_tracers, wave_spec character(len=*), parameter :: subname = '(ice_step)' @@ -183,7 +186,7 @@ subroutine ice_step call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero, & - tr_fsd_out=tr_fsd) + tr_iso_out=tr_iso, tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -236,7 +239,7 @@ subroutine ice_step if (.not.prescribed_ice) & call step_therm2 (dt, iblk) ! ice thickness distribution thermo - endif + endif ! ktherm > 0 enddo ! iblk !$OMP END PARALLEL DO @@ -335,6 +338,7 @@ subroutine ice_step if (tr_pond_lvl) call write_restart_pond_lvl if (tr_pond_topo) call write_restart_pond_topo if (tr_fsd) call write_restart_fsd + if (tr_iso) call write_restart_iso if (tr_aero) call write_restart_aero if (solve_zsal .or. skl_bgc .or. z_tracers) & call write_restart_bgc @@ -369,7 +373,8 @@ subroutine coupling_prep (iblk) swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, & fsens, flat, fswabs, flwout, evap, Tref, Qref, & scale_fluxes, frzmlt_init, frzmlt, Uref, wind - use ice_flux_bgc, only: faero_ocn, fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai, & + use ice_flux_bgc, only: faero_ocn, fiso_ocn, Qref_iso, fiso_evap, & + 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 @@ -552,7 +557,8 @@ subroutine coupling_prep (iblk) !----------------------------------------------------------------- call scale_fluxes (nx_block, ny_block, & - tmask (:,:,iblk), nbtrcr, icepack_max_aero, & + tmask (:,:,iblk), nbtrcr, & + icepack_max_aero, & aice (:,:,iblk), Tf (:,:,iblk), & Tair (:,:,iblk), Qa (:,:,iblk), & strairxT (:,:,iblk), strairyT(:,:,iblk), & @@ -566,7 +572,10 @@ subroutine coupling_prep (iblk) alvdr (:,:,iblk), alidr (:,:,iblk), & alvdf (:,:,iblk), alidf (:,:,iblk), & fzsal (:,:,iblk), fzsal_g (:,:,iblk), & - flux_bio(:,:,1:nbtrcr,iblk), & + flux_bio (:,:,1:nbtrcr,iblk), & + Qref_iso =Qref_iso (:,:,:,iblk), & + fiso_evap=fiso_evap(:,:,:,iblk), & + fiso_ocn =fiso_ocn (:,:,:,iblk), & Uref=Uref(:,:,iblk), wind=wind(:,:,iblk) ) !----------------------------------------------------------------- diff --git a/cicecore/drivers/mct/cesm1/CICE_RunMod.F90_debug b/cicecore/drivers/mct/cesm1/CICE_RunMod.F90_debug deleted file mode 100644 index 4f8b0a352..000000000 --- a/cicecore/drivers/mct/cesm1/CICE_RunMod.F90_debug +++ /dev/null @@ -1,696 +0,0 @@ -!======================================================================= -! -! Main driver for time stepping of CICE. -! -! authors Elizabeth C. Hunke, LANL -! Philip W. Jones, LANL -! William H. Lipscomb, LANL -! -! 2006 ECH: moved exit timeLoop to prevent execution of unnecessary timestep -! 2006 ECH: Streamlined for efficiency -! 2006 ECH: Converted to free source form (F90) -! 2007 BPB: Modified Delta-Eddington shortwave interface -! 2008 ECH: moved ESMF code to its own driver - - module CICE_RunMod - - use ice_kinds_mod - use perf_mod, only : t_startf, t_stopf, t_barrierf - use ice_fileunits, only: nu_diag - use ice_arrays_column, only: oceanmixed_ice - use ice_constants, only: c0, c1 - use ice_constants, only: field_loc_center, field_type_scalar - use ice_exit, only: abort_ice - use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero - use icepack_intfc, only: icepack_query_parameters - use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_numbers - - implicit none - private - public :: CICE_Run, ice_step - -!======================================================================= - - contains - -!======================================================================= -! -! This is the main driver routine for advancing CICE forward in time. -! -! author Elizabeth C. Hunke, LANL -! Philip W. Jones, LANL -! William H. Lipscomb, LANL - - subroutine CICE_Run - - use ice_calendar, only: istep, istep1, time, dt, stop_now, calendar - use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, atm_data_type - use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default - use ice_flux, only: init_flux_atm, init_flux_ocn - use ice_timers, only: ice_timer_start, ice_timer_stop, & - timer_couple, timer_step - - logical (kind=log_kind) :: & - tr_aero, tr_zaero, skl_bgc, z_tracers - character(len=*), parameter :: subname = '(CICE_Run)' - - !-------------------------------------------------------------------- - ! initialize error code and step timer - !-------------------------------------------------------------------- - - call ice_timer_start(timer_step) ! start timing entire run - - call icepack_query_parameters(skl_bgc_out=skl_bgc, z_tracers_out=z_tracers) - call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - !-------------------------------------------------------------------- - ! timestep loop - !-------------------------------------------------------------------- - -! timeLoop: do - - istep = istep + 1 ! update time step counters - istep1 = istep1 + 1 - time = time + dt ! determine the time and date - - call ice_timer_start(timer_couple) ! atm/ocn coupling - -#ifndef coupled -#ifndef CESMCOUPLED - call get_forcing_atmo ! atmospheric forcing from data - call get_forcing_ocn(dt) ! ocean forcing from data - - ! aerosols - ! if (tr_aero) call faero_data ! data file - ! if (tr_zaero) call fzaero_data ! data file (gx1) - if (tr_aero .or. tr_zaero) call faero_default ! default values - - if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry -#endif -#endif - if (z_tracers) call get_atm_bgc ! biogeochemistry - - call init_flux_atm ! Initialize atmosphere fluxes sent to coupler - call init_flux_ocn ! initialize ocean fluxes sent to coupler - - call calendar(time) ! at the end of the timestep - - call ice_timer_stop(timer_couple) ! atm/ocn coupling - - call ice_step - -! if (stop_now >= 1) exit timeLoop -! enddo timeLoop - - !-------------------------------------------------------------------- - ! end of timestep loop - !-------------------------------------------------------------------- - - call ice_timer_stop(timer_step) ! end timestepping loop timer - - end subroutine CICE_Run - -!======================================================================= -! -! Calls drivers for physics components, some initialization, and output -! -! author Elizabeth C. Hunke, LANL -! William H. Lipscomb, LANL - - subroutine ice_step - - use ice_boundary, only: ice_HaloUpdate - use ice_calendar, only: dt, dt_dyn, ndtd, diagfreq, write_restart, istep - use ice_calendar, only: idate, sec - use ice_diagnostics, only: init_mass_diags, runtime_diags - use ice_diagnostics_bgc, only: hbrine_diags, zsal_diags, bgc_diags - use ice_domain, only: halo_info, nblocks - use ice_dyn_eap, only: write_restart_eap - use ice_dyn_shared, only: kdyn, kridge - use ice_flux, only: scale_factor, init_history_therm, & - daidtt, daidtd, dvidtt, dvidtd, dagedtt, dagedtd - use ice_history, only: accum_hist - use ice_history_bgc, only: init_history_bgc - use ice_restart, only: final_restart - use ice_restart_column, only: write_restart_age, write_restart_FY, & - write_restart_lvl, write_restart_pond_cesm, write_restart_pond_lvl, & - write_restart_pond_topo, write_restart_aero, & - write_restart_bgc, write_restart_hbrine - use ice_restart_driver, only: dumpfile - use ice_restoring, only: restore_ice, ice_HaloRestore - use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & - update_state, step_dyn_horiz, step_dyn_ridge, step_radiation, & - biogeochemistry, save_init - use ice_timers, only: ice_timer_start, ice_timer_stop, & - timer_diags, timer_column, timer_thermo, timer_bound, & - timer_hist, timer_readwrite - use ice_communicate, only: MPI_COMM_ICE - use ice_prescribed_mod - - integer (kind=int_kind) :: & - iblk , & ! block index - k , & ! dynamics supercycling index - ktherm ! thermodynamics is off when ktherm = -1 - - real (kind=dbl_kind) :: & - offset ! d(age)/dt time offset - - logical (kind=log_kind) :: & - tr_iage, tr_FY, tr_lvl, & - tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_aero, & - calc_Tsfc, skl_bgc, solve_zsal, z_tracers - - character(len=*), parameter :: subname = '(ice_step)' - - character (len=char_len) :: plabeld - - plabeld = 'beginning time step' - do iblk = 1, nblocks - call debug_ice (iblk, plabeld) - enddo - - call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc, skl_bgc_out=skl_bgc, & - solve_zsal_out=solve_zsal, z_tracers_out=z_tracers, ktherm_out=ktherm) - call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & - tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & - tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - !----------------------------------------------------------------- - ! restoring on grid boundaries - !----------------------------------------------------------------- - - if (restore_ice) call ice_HaloRestore - - !----------------------------------------------------------------- - ! initialize diagnostics and save initial state values - !----------------------------------------------------------------- - - call ice_timer_start(timer_diags) ! diagnostics/history - call init_mass_diags ! diagnostics per timestep - call init_history_therm - call init_history_bgc - call ice_timer_stop(timer_diags) ! diagnostics/history - - 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 - - call save_init - - call ice_timer_start(timer_column) ! column physics - call ice_timer_start(timer_thermo) ! thermodynamics - - !$OMP PARALLEL DO PRIVATE(iblk) - do iblk = 1, nblocks - - if (ktherm >= 0) then - - !----------------------------------------------------------------- - ! scale radiation fields - !----------------------------------------------------------------- - - if (calc_Tsfc) call prep_radiation (iblk) - - plabeld = 'post prep_radiation' - call debug_ice (iblk, plabeld) - - !----------------------------------------------------------------- - ! thermodynamics and biogeochemistry - !----------------------------------------------------------------- - - call step_therm1 (dt, iblk) ! vertical thermodynamics - - plabeld = 'post step_therm1' - call debug_ice (iblk, plabeld) - - call biogeochemistry (dt, iblk) ! biogeochemistry - - plabeld = 'post biogeochemistry' - call debug_ice (iblk, plabeld) - - if (.not.prescribed_ice) & - call step_therm2 (dt, iblk) ! ice thickness distribution thermo - - plabeld = 'post step_therm2' - call debug_ice (iblk, plabeld) - - endif - - enddo ! iblk - !$OMP END PARALLEL DO - - ! clean up, update tendency diagnostics - offset = dt - call update_state (dt, daidtt, dvidtt, dagedtt, offset) - - call ice_timer_stop(timer_thermo) ! thermodynamics - call ice_timer_stop(timer_column) ! column physics - - !----------------------------------------------------------------- - ! dynamics, transport, ridging - !----------------------------------------------------------------- - - if (.not.prescribed_ice) then - do k = 1, ndtd - - ! momentum, stress, transport - call step_dyn_horiz (dt_dyn) - - plabeld = 'post step_dyn_horiz' - call debug_ice (iblk, plabeld) - - ! ridging - !$OMP PARALLEL DO PRIVATE(iblk) - do iblk = 1, nblocks - if (kridge > 0) call step_dyn_ridge (dt_dyn, ndtd, iblk) - enddo - !$OMP END PARALLEL DO - - ! clean up, update tendency diagnostics - offset = c0 - call update_state (dt_dyn, daidtd, dvidtd, dagedtd, offset) - - enddo - - plabeld = 'post dynamics' - do iblk = 1, nblocks - call debug_ice (iblk, plabeld) - enddo - - endif - - !----------------------------------------------------------------- - ! albedo, shortwave radiation - !----------------------------------------------------------------- - - call ice_timer_start(timer_column) ! column physics - call ice_timer_start(timer_thermo) ! thermodynamics - - !$OMP PARALLEL DO PRIVATE(iblk) - do iblk = 1, nblocks - - if (ktherm >= 0) call step_radiation (dt, iblk) - - plabeld = 'post step_radiation' - call debug_ice (iblk, plabeld) - - !----------------------------------------------------------------- - ! get ready for coupling and the next time step - !----------------------------------------------------------------- - - call coupling_prep (iblk) - - plabeld = 'post coupling_prep' - call debug_ice (iblk, plabeld) - - enddo ! iblk - !$OMP END PARALLEL DO - - call ice_timer_start(timer_bound) - call ice_HaloUpdate (scale_factor, halo_info, & - field_loc_center, field_type_scalar) - call ice_timer_stop(timer_bound) - - call ice_timer_stop(timer_thermo) ! thermodynamics - call ice_timer_stop(timer_column) ! column physics - - !----------------------------------------------------------------- - ! write data - !----------------------------------------------------------------- - - call ice_timer_start(timer_diags) ! diagnostics - if (mod(istep,diagfreq) == 0) then - call runtime_diags(dt) ! log file - if (solve_zsal) call zsal_diags - if (skl_bgc .or. z_tracers) call bgc_diags - if (tr_brine) call hbrine_diags - endif - call ice_timer_stop(timer_diags) ! diagnostics - - call ice_timer_start(timer_hist) ! history - call accum_hist (dt) ! history file - call ice_timer_stop(timer_hist) ! history - - call ice_timer_start(timer_readwrite) ! reading/writing - if (write_restart == 1) then - call dumpfile ! core variables for restarting - if (tr_iage) call write_restart_age - if (tr_FY) call write_restart_FY - if (tr_lvl) call write_restart_lvl - if (tr_pond_cesm) call write_restart_pond_cesm - if (tr_pond_lvl) call write_restart_pond_lvl - if (tr_pond_topo) call write_restart_pond_topo - if (tr_aero) call write_restart_aero - if (solve_zsal .or. skl_bgc .or. z_tracers) & - call write_restart_bgc - if (tr_brine) call write_restart_hbrine - if (kdyn == 2) call write_restart_eap - call final_restart - endif - - call ice_timer_stop(timer_readwrite) ! reading/writing - - end subroutine ice_step - -!======================================================================= -! -! Prepare for coupling -! -! authors: Elizabeth C. Hunke, LANL - - subroutine coupling_prep (iblk) - - use ice_arrays_column, only: alvdfn, alidfn, alvdrn, alidrn, & - albicen, albsnon, albpndn, apeffn, fzsal_g, fzsal, snowfracn - use ice_blocks, only: nx_block, ny_block, get_block, block - use ice_domain, only: blocks_ice - use ice_calendar, only: dt, nstreams - use ice_domain_size, only: ncat - use ice_flux, only: alvdf, alidf, alvdr, alidr, albice, albsno, & - albpnd, albcnt, apeff_ai, fpond, fresh, l_mpond_fresh, & - alvdf_ai, alidf_ai, alvdr_ai, alidr_ai, fhocn_ai, & - fresh_ai, fsalt_ai, fsalt, & - fswthru_ai, fhocn, fswthru, scale_factor, snowfrac, & - swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, & - fsens, flat, fswabs, flwout, evap, Tref, Qref, & - scale_fluxes, frzmlt_init, frzmlt, Uref, wind, fsurfn_f, flatn_f - use ice_flux_bgc, only: faero_ocn, 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 - use ice_state, only: aicen, aice, aice_init - use ice_step_mod, only: ocean_mixed_layer - use ice_timers, only: timer_couple, ice_timer_start, ice_timer_stop - - integer (kind=int_kind), intent(in) :: & - iblk ! block index - - ! local variables - - integer (kind=int_kind) :: & - ilo,ihi,jlo,jhi, & ! beginning and end of physical domain - n , & ! thickness category index - i,j , & ! horizontal indices - k , & ! tracer index - nbtrcr ! - - type (block) :: & - this_block ! block information for current block - - logical (kind=log_kind) :: & - skl_bgc , & ! - calc_Tsfc ! - - real (kind=dbl_kind) :: & - cszn , & ! counter for history averaging - puny , & ! - rhofresh , & ! - netsw ! flag for shortwave radiation presence - - character(len=*), parameter :: subname = '(coupling_prep)' - - !----------------------------------------------------------------- - - call icepack_query_parameters(puny_out=puny, rhofresh_out=rhofresh) - call icepack_query_parameters(skl_bgc_out=skl_bgc) - call icepack_query_tracer_numbers(nbtrcr_out=nbtrcr) - call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - !----------------------------------------------------------------- - ! Save current value of frzmlt for diagnostics. - ! Update mixed layer with heat and radiation from ice. - !----------------------------------------------------------------- - - do j = 1, ny_block - do i = 1, nx_block - frzmlt_init (i,j,iblk) = frzmlt(i,j,iblk) - enddo - enddo - - call ice_timer_start(timer_couple,iblk) ! atm/ocn coupling - - if (oceanmixed_ice) & - call ocean_mixed_layer (dt,iblk) ! ocean surface fluxes and sst - - !----------------------------------------------------------------- - ! Aggregate albedos - !----------------------------------------------------------------- - - do j = 1, ny_block - do i = 1, nx_block - alvdf(i,j,iblk) = c0 - alidf(i,j,iblk) = c0 - alvdr(i,j,iblk) = c0 - alidr(i,j,iblk) = c0 - - albice(i,j,iblk) = c0 - albsno(i,j,iblk) = c0 - albpnd(i,j,iblk) = c0 - apeff_ai(i,j,iblk) = c0 - snowfrac(i,j,iblk) = c0 - - ! for history averaging - cszn = c0 - netsw = swvdr(i,j,iblk)+swidr(i,j,iblk)+swvdf(i,j,iblk)+swidf(i,j,iblk) - if (netsw > puny) cszn = c1 - do n = 1, nstreams - albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn - enddo - enddo - enddo - - 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 n = 1, ncat - do j = jlo, jhi - do i = ilo, ihi - if (aicen(i,j,n,iblk) > puny) then - - alvdf(i,j,iblk) = alvdf(i,j,iblk) & - + alvdfn(i,j,n,iblk)*aicen(i,j,n,iblk) - alidf(i,j,iblk) = alidf(i,j,iblk) & - + alidfn(i,j,n,iblk)*aicen(i,j,n,iblk) - alvdr(i,j,iblk) = alvdr(i,j,iblk) & - + alvdrn(i,j,n,iblk)*aicen(i,j,n,iblk) - alidr(i,j,iblk) = alidr(i,j,iblk) & - + alidrn(i,j,n,iblk)*aicen(i,j,n,iblk) - - netsw = swvdr(i,j,iblk) + swidr(i,j,iblk) & - + swvdf(i,j,iblk) + swidf(i,j,iblk) - if (netsw > puny) then ! sun above horizon - albice(i,j,iblk) = albice(i,j,iblk) & - + albicen(i,j,n,iblk)*aicen(i,j,n,iblk) - albsno(i,j,iblk) = albsno(i,j,iblk) & - + albsnon(i,j,n,iblk)*aicen(i,j,n,iblk) - albpnd(i,j,iblk) = albpnd(i,j,iblk) & - + albpndn(i,j,n,iblk)*aicen(i,j,n,iblk) - endif - - apeff_ai(i,j,iblk) = apeff_ai(i,j,iblk) & ! for history - + apeffn(i,j,n,iblk)*aicen(i,j,n,iblk) - snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & ! for history - + snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk) - - endif ! aicen > puny - enddo - enddo - enddo - - do j = 1, ny_block - do i = 1, nx_block - - !----------------------------------------------------------------- - ! reduce fresh by fpond for coupling - !----------------------------------------------------------------- - - if (l_mpond_fresh) then - fpond(i,j,iblk) = fpond(i,j,iblk) * rhofresh/dt - fresh(i,j,iblk) = fresh(i,j,iblk) - fpond(i,j,iblk) - endif - - !---------------------------------------------------------------- - ! Store grid box mean albedos and fluxes before scaling by aice - !---------------------------------------------------------------- - - alvdf_ai (i,j,iblk) = alvdf (i,j,iblk) - alidf_ai (i,j,iblk) = alidf (i,j,iblk) - alvdr_ai (i,j,iblk) = alvdr (i,j,iblk) - alidr_ai (i,j,iblk) = alidr (i,j,iblk) - fresh_ai (i,j,iblk) = fresh (i,j,iblk) - fsalt_ai (i,j,iblk) = fsalt (i,j,iblk) - fhocn_ai (i,j,iblk) = fhocn (i,j,iblk) - fswthru_ai(i,j,iblk) = fswthru(i,j,iblk) - fzsal_ai (i,j,iblk) = fzsal (i,j,iblk) - fzsal_g_ai(i,j,iblk) = fzsal_g(i,j,iblk) - - if (nbtrcr > 0) then - do k = 1, nbtrcr - flux_bio_ai (i,j,k,iblk) = flux_bio (i,j,k,iblk) - enddo - endif - - !----------------------------------------------------------------- - ! Save net shortwave for scaling factor in scale_factor - !----------------------------------------------------------------- - scale_factor(i,j,iblk) = & - swvdr(i,j,iblk)*(c1 - alvdr_ai(i,j,iblk)) & - + swvdf(i,j,iblk)*(c1 - alvdf_ai(i,j,iblk)) & - + swidr(i,j,iblk)*(c1 - alidr_ai(i,j,iblk)) & - + swidf(i,j,iblk)*(c1 - alidf_ai(i,j,iblk)) - - enddo - enddo - - !----------------------------------------------------------------- - ! Divide fluxes by ice area - ! - the CESM coupler assumes fluxes are per unit ice area - ! - also needed for global budget in diagnostics - !----------------------------------------------------------------- - - call scale_fluxes (nx_block, ny_block, & - tmask (:,:,iblk), nbtrcr, icepack_max_aero, & - aice (:,:,iblk), Tf (:,:,iblk), & - Tair (:,:,iblk), Qa (:,:,iblk), & - strairxT (:,:,iblk), strairyT(:,:,iblk), & - fsens (:,:,iblk), flat (:,:,iblk), & - fswabs (:,:,iblk), flwout (:,:,iblk), & - evap (:,:,iblk), & - Tref (:,:,iblk), Qref (:,:,iblk), & - fresh (:,:,iblk), fsalt (:,:,iblk), & - fhocn (:,:,iblk), fswthru (:,:,iblk), & - faero_ocn(:,:,:,iblk), & - alvdr (:,:,iblk), alidr (:,:,iblk), & - alvdf (:,:,iblk), alidf (:,:,iblk), & - fzsal (:,:,iblk), fzsal_g (:,:,iblk), & - flux_bio(:,:,1:nbtrcr,iblk), & - Uref=Uref(:,:,iblk), wind=wind(:,:,iblk) ) - - !----------------------------------------------------------------- - ! Define ice-ocean bgc fluxes - !----------------------------------------------------------------- - - if (nbtrcr > 0 .or. skl_bgc) then - call bgcflux_ice_to_ocn (nx_block, ny_block, & - flux_bio(:,:,1:nbtrcr,iblk), & - fnit(:,:,iblk), fsil(:,:,iblk), & - famm(:,:,iblk), fdmsp(:,:,iblk), & - fdms(:,:,iblk), fhum(:,:,iblk), & - fdust(:,:,iblk), falgalN(:,:,:,iblk), & - fdoc(:,:,:,iblk), fdic(:,:,:,iblk), & - fdon(:,:,:,iblk), ffep(:,:,:,iblk), & - ffed(:,:,:,iblk)) - endif - -!echmod - comment this out for efficiency, if .not. calc_Tsfc - if (.not. calc_Tsfc) then - - !--------------------------------------------------------------- - ! If surface fluxes were provided, conserve these fluxes at ice - ! free points by passing to ocean. - !--------------------------------------------------------------- - - call sfcflux_to_ocn & - (nx_block, ny_block, & - tmask (:,:,iblk), aice_init(:,:,iblk), & - fsurfn_f (:,:,:,iblk), flatn_f(:,:,:,iblk), & - fresh (:,:,iblk), fhocn (:,:,iblk)) - endif -!echmod - - call ice_timer_stop(timer_couple,iblk) ! atm/ocn coupling - - end subroutine coupling_prep - -!======================================================================= -! -! If surface heat fluxes are provided to CICE instead of CICE calculating -! them internally (i.e. .not. calc_Tsfc), then these heat fluxes can -! be provided at points which do not have ice. (This is could be due to -! the heat fluxes being calculated on a lower resolution grid or the -! heat fluxes not recalculated at every CICE timestep.) At ice free points, -! conserve energy and water by passing these fluxes to the ocean. -! -! author: A. McLaren, Met Office - - subroutine sfcflux_to_ocn(nx_block, ny_block, & - tmask, aice, & - fsurfn_f, flatn_f, & - fresh, fhocn) - - use ice_domain_size, only: ncat - - integer (kind=int_kind), intent(in) :: & - nx_block, ny_block ! block dimensions - - logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & - tmask ! land/boundary mask, thickness (T-cell) - - real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in):: & - aice ! initial ice concentration - - real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), intent(in) :: & - fsurfn_f, & ! net surface heat flux (provided as forcing) - flatn_f ! latent heat flux (provided as forcing) - - real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout):: & - fresh , & ! fresh water flux to ocean (kg/m2/s) - fhocn ! actual ocn/ice heat flx (W/m**2) - -#ifdef CICE_IN_NEMO - - ! local variables - integer (kind=int_kind) :: & - i, j, n ! horizontal indices - - real (kind=dbl_kind) :: & - puny, & ! - rLsub ! 1/Lsub - - character(len=*), parameter :: subname = '(sfcflux_to_ocn)' - - call icepack_query_parameters(puny_out=puny) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - rLsub = c1 / Lsub - - do n = 1, ncat - do j = 1, ny_block - do i = 1, nx_block - if (tmask(i,j) .and. aice(i,j) <= puny) then - fhocn(i,j) = fhocn(i,j) & - + fsurfn_f(i,j,n) + flatn_f(i,j,n) - fresh(i,j) = fresh(i,j) & - + flatn_f(i,j,n) * rLsub - endif - enddo ! i - enddo ! j - enddo ! n - -#endif - - end subroutine sfcflux_to_ocn - -!======================================================================= - - end module CICE_RunMod - -!======================================================================= diff --git a/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 b/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 index cb3e7bb98..b72745e30 100644 --- a/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 +++ b/cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90 @@ -77,7 +77,7 @@ subroutine cice_init(mpicom_ice) use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & get_forcing_atmo, get_forcing_ocn, get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default, faero_optics, alloc_forcing_bgc + faero_default, faero_optics, alloc_forcing_bgc, fiso_default use ice_grid, only: init_grid1, init_grid2, alloc_grid use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runtype @@ -95,7 +95,7 @@ subroutine cice_init(mpicom_ice) mpicom_ice ! communicator for sequential ccsm logical(kind=log_kind) :: tr_aero, tr_zaero, skl_bgc, z_tracers, & - tr_fsd, wave_spec + tr_iso, tr_fsd, wave_spec character(len=*), parameter :: subname = '(cice_init)' call init_communicate(mpicom_ice) ! initial setup for message passing @@ -122,7 +122,6 @@ subroutine cice_init(mpicom_ice) call ice_timer_start(timer_total) ! start timing entire run call init_grid2 ! grid variables call init_zbgc ! vertical biogeochemistry initialization - call init_calendar ! initialize some calendar stuff call init_hist (dt) ! initialize output history file @@ -134,6 +133,7 @@ subroutine cice_init(mpicom_ice) endif call init_coupler_flux ! initialize fluxes exchanged with coupler + #ifdef popcice call sst_sss ! POP data for CICE initialization #endif @@ -181,6 +181,7 @@ subroutine cice_init(mpicom_ice) call init_history_dyn ! initialize dynamic history variables call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero) + call icepack_query_tracer_flags(tr_iso_out=tr_iso) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(trim(subname), & file=__FILE__,line= __LINE__) @@ -194,6 +195,11 @@ subroutine cice_init(mpicom_ice) if (trim(runtype) == 'continue' .or. restart) & call init_shortwave ! initialize radiative transfer +! istep = istep + 1 ! update time step counters +! istep1 = istep1 + 1 +! time = time + dt ! determine the time and date +! call calendar(time) ! at the end of the first timestep + !-------------------------------------------------------------------- ! coupler communication or forcing data initialization !-------------------------------------------------------------------- @@ -206,6 +212,8 @@ subroutine cice_init(mpicom_ice) call get_forcing_atmo ! atmospheric forcing from data call get_forcing_ocn(dt) ! ocean forcing from data + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -234,20 +242,21 @@ subroutine init_restart use ice_calendar, only: time, calendar use ice_constants, only: c0 use ice_domain, only: nblocks - use ice_domain_size, only: ncat, n_aero, nfsd + use ice_domain_size, only: ncat, n_iso, n_aero, nfsd use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn use ice_grid, only: tmask use ice_init, only: ice_ic use ice_init_column, only: init_age, init_FY, init_lvl, & init_meltponds_cesm, init_meltponds_lvl, init_meltponds_topo, & - init_aerosol, init_hbrine, init_bgc, init_fsd + init_isotope, init_aerosol, init_hbrine, init_bgc, init_fsd use ice_restart_column, only: restart_age, read_restart_age, & restart_FY, read_restart_FY, restart_lvl, read_restart_lvl, & restart_pond_cesm, read_restart_pond_cesm, & restart_pond_lvl, read_restart_pond_lvl, & restart_pond_topo, read_restart_pond_topo, & restart_fsd, read_restart_fsd, & + restart_iso, read_restart_iso, & restart_aero, read_restart_aero, & restart_hbrine, read_restart_hbrine, & restart_zsal, restart_bgc @@ -260,13 +269,13 @@ subroutine init_restart iblk ! block index logical(kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_pond_cesm, tr_pond_lvl, & - tr_pond_topo, tr_fsd, tr_aero, tr_brine, & + tr_pond_topo, tr_fsd, tr_iso, tr_aero, tr_brine, & skl_bgc, z_tracers, solve_zsal integer(kind=int_kind) :: & ntrcr integer(kind=int_kind) :: & nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & - nt_iage, nt_FY, nt_aero, nt_fsd + nt_iage, nt_FY, nt_aero, nt_fsd, nt_isosno, nt_isoice character(len=*), parameter :: subname = '(init_restart)' @@ -280,10 +289,11 @@ subroutine init_restart call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_aero_out=tr_aero, tr_brine_out=tr_brine, & - tr_fsd_out=tr_fsd) + tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) call icepack_query_tracer_indices(nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, & nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, & - nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd) + nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -388,6 +398,20 @@ subroutine init_restart call init_fsd(trcrn(:,:,nt_fsd:nt_fsd+nfsd-1,:,:)) endif endif + + ! isotopes + if (tr_iso) then + if (trim(runtype) == 'continue') restart_iso = .true. + if (restart_iso) then + call read_restart_iso + else + do iblk = 1, nblocks + call init_isotope(trcrn(:,:,nt_isosno:nt_isosno+n_iso-1,:,iblk), & + trcrn(:,:,nt_isoice:nt_isoice+n_iso-1,:,iblk)) + enddo ! iblk + endif + endif + if (tr_aero) then ! ice aerosol if (trim(runtype) == 'continue') restart_aero = .true. if (restart_aero) then diff --git a/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 b/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 index 26d40a431..09cffa0c7 100644 --- a/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 +++ b/cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90 @@ -22,7 +22,7 @@ module CICE_RunMod use ice_constants, only: field_loc_center, field_type_scalar use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero + use icepack_intfc, only: icepack_max_iso, icepack_max_aero use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_sizes @@ -48,12 +48,12 @@ subroutine CICE_Run use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, & get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default + fiso_default, faero_default use ice_flux, only: init_flux_atm, init_flux_ocn use ice_timers, only: ice_timer_start, ice_timer_stop, & timer_couple, timer_step logical (kind=log_kind) :: & - tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd + tr_iso, tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd character(len=*), parameter :: subname = '(CICE_Run)' !-------------------------------------------------------------------- @@ -65,7 +65,8 @@ subroutine CICE_Run call icepack_query_parameters(skl_bgc_out=skl_bgc, & z_tracers_out=z_tracers, & wave_spec_out=wave_spec) - call icepack_query_tracer_flags(tr_aero_out=tr_aero, & + call icepack_query_tracer_flags(tr_iso_out=tr_iso, & + tr_aero_out=tr_aero, & tr_zaero_out=tr_zaero, & tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) @@ -95,6 +96,8 @@ subroutine CICE_Run call get_forcing_atmo ! atmospheric forcing from data call get_forcing_ocn(dt) ! ocean forcing from data + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -150,7 +153,7 @@ subroutine ice_step use ice_restart_column, only: write_restart_age, write_restart_FY, & write_restart_lvl, write_restart_pond_cesm, write_restart_pond_lvl, & write_restart_pond_topo, write_restart_aero, write_restart_fsd, & - write_restart_bgc, write_restart_hbrine + write_restart_iso, write_restart_bgc, write_restart_hbrine use ice_restart_driver, only: dumpfile use ice_restoring, only: restore_ice, ice_HaloRestore use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & @@ -172,7 +175,7 @@ subroutine ice_step logical (kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_fsd, & - tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_aero, & + tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_iso, tr_aero, & calc_Tsfc, skl_bgc, solve_zsal, z_tracers, wave_spec character(len=*), parameter :: subname = '(ice_step)' @@ -183,7 +186,7 @@ subroutine ice_step call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero, & - tr_fsd_out=tr_fsd) + tr_iso_out=tr_iso, tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -236,7 +239,7 @@ subroutine ice_step if (.not.prescribed_ice) & call step_therm2 (dt, iblk) ! ice thickness distribution thermo - endif + endif ! ktherm > 0 enddo ! iblk !$OMP END PARALLEL DO @@ -335,6 +338,7 @@ subroutine ice_step if (tr_pond_lvl) call write_restart_pond_lvl if (tr_pond_topo) call write_restart_pond_topo if (tr_fsd) call write_restart_fsd + if (tr_iso) call write_restart_iso if (tr_aero) call write_restart_aero if (solve_zsal .or. skl_bgc .or. z_tracers) & call write_restart_bgc @@ -369,7 +373,8 @@ subroutine coupling_prep (iblk) swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, & fsens, flat, fswabs, flwout, evap, Tref, Qref, & scale_fluxes, frzmlt_init, frzmlt, Uref, wind - use ice_flux_bgc, only: faero_ocn, fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai, & + use ice_flux_bgc, only: faero_ocn, fiso_ocn, Qref_iso, fiso_evap, & + 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 @@ -552,7 +557,8 @@ subroutine coupling_prep (iblk) !----------------------------------------------------------------- call scale_fluxes (nx_block, ny_block, & - tmask (:,:,iblk), nbtrcr, icepack_max_aero, & + tmask (:,:,iblk), nbtrcr, & + icepack_max_aero, & aice (:,:,iblk), Tf (:,:,iblk), & Tair (:,:,iblk), Qa (:,:,iblk), & strairxT (:,:,iblk), strairyT(:,:,iblk), & @@ -566,7 +572,10 @@ subroutine coupling_prep (iblk) alvdr (:,:,iblk), alidr (:,:,iblk), & alvdf (:,:,iblk), alidf (:,:,iblk), & fzsal (:,:,iblk), fzsal_g (:,:,iblk), & - flux_bio(:,:,1:nbtrcr,iblk), & + flux_bio (:,:,1:nbtrcr,iblk), & + Qref_iso =Qref_iso (:,:,:,iblk), & + fiso_evap=fiso_evap(:,:,:,iblk), & + fiso_ocn =fiso_ocn (:,:,:,iblk), & Uref=Uref(:,:,iblk), wind=wind(:,:,iblk) ) !----------------------------------------------------------------- diff --git a/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 b/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 index fd9449efd..986189f96 100644 --- a/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 +++ b/cicecore/drivers/nuopc/dmi/CICE_InitMod.F90 @@ -16,8 +16,8 @@ module CICE_InitMod use ice_exit, only: abort_ice use ice_fileunits, only: init_fileunits, nu_diag use icepack_intfc, only: icepack_aggregate - use icepack_intfc, only: icepack_init_fsd_bounds, icepack_init_wave use icepack_intfc, only: icepack_init_itd, icepack_init_itd_hist + use icepack_intfc, only: icepack_init_fsd_bounds, icepack_init_wave use icepack_intfc, only: icepack_configure use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_flags, & @@ -49,6 +49,7 @@ subroutine CICE_Initialize(mpi_comm) !-------------------------------------------------------------------- ! model initialization !-------------------------------------------------------------------- + if (present(mpi_comm)) then call cice_init(mpi_comm) else @@ -81,7 +82,7 @@ subroutine cice_init(mpi_comm) use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & get_forcing_atmo, get_forcing_ocn, get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default, faero_optics, alloc_forcing_bgc + faero_default, faero_optics, alloc_forcing_bgc, fiso_default use ice_grid, only: init_grid1, init_grid2, alloc_grid use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runtype @@ -94,11 +95,14 @@ subroutine cice_init(mpi_comm) #ifdef popcice use drv_forcing, only: sst_sss #endif + integer (kind=int_kind), optional, intent(in) :: & - mpi_comm ! communicator for sequential ccsm + mpi_comm ! communicator for sequential ccsm + logical(kind=log_kind) :: tr_aero, tr_zaero, skl_bgc, z_tracers, & - tr_fsd, wave_spec + tr_iso, tr_fsd, wave_spec character(len=*), parameter :: subname = '(cice_init)' + if (present(mpi_comm)) then call init_communicate(mpi_comm) ! initial setup for message passing else @@ -130,7 +134,6 @@ subroutine cice_init(mpi_comm) call ice_timer_start(timer_total) ! start timing entire run call init_grid2 ! grid variables call init_zbgc ! vertical biogeochemistry initialization - call init_calendar ! initialize some calendar stuff call init_hist (dt) ! initialize output history file @@ -142,6 +145,7 @@ subroutine cice_init(mpi_comm) endif call init_coupler_flux ! initialize fluxes exchanged with coupler + #ifdef popcice call sst_sss ! POP data for CICE initialization #endif @@ -189,6 +193,7 @@ subroutine cice_init(mpi_comm) call init_history_dyn ! initialize dynamic history variables call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero) + call icepack_query_tracer_flags(tr_iso_out=tr_iso) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(trim(subname), & file=__FILE__,line= __LINE__) @@ -220,6 +225,9 @@ subroutine cice_init(mpi_comm) #ifndef CICE_DMI call get_forcing_ocn(dt) ! ocean forcing from data #endif + + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -248,20 +256,21 @@ subroutine init_restart use ice_calendar, only: time, calendar use ice_constants, only: c0 use ice_domain, only: nblocks - use ice_domain_size, only: ncat, n_aero, nfsd + use ice_domain_size, only: ncat, n_iso, n_aero, nfsd use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn use ice_grid, only: tmask use ice_init, only: ice_ic use ice_init_column, only: init_age, init_FY, init_lvl, & init_meltponds_cesm, init_meltponds_lvl, init_meltponds_topo, & - init_aerosol, init_hbrine, init_bgc, init_fsd + init_isotope, init_aerosol, init_hbrine, init_bgc, init_fsd use ice_restart_column, only: restart_age, read_restart_age, & restart_FY, read_restart_FY, restart_lvl, read_restart_lvl, & restart_pond_cesm, read_restart_pond_cesm, & restart_pond_lvl, read_restart_pond_lvl, & restart_pond_topo, read_restart_pond_topo, & restart_fsd, read_restart_fsd, & + restart_iso, read_restart_iso, & restart_aero, read_restart_aero, & restart_hbrine, read_restart_hbrine, & restart_zsal, restart_bgc @@ -274,13 +283,13 @@ subroutine init_restart iblk ! block index logical(kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_pond_cesm, tr_pond_lvl, & - tr_pond_topo, tr_fsd, tr_aero, tr_brine, & + tr_pond_topo, tr_fsd, tr_iso, tr_aero, tr_brine, & skl_bgc, z_tracers, solve_zsal integer(kind=int_kind) :: & ntrcr integer(kind=int_kind) :: & nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & - nt_iage, nt_FY, nt_aero, nt_fsd + nt_iage, nt_FY, nt_aero, nt_fsd, nt_isosno, nt_isoice character(len=*), parameter :: subname = '(init_restart)' @@ -294,10 +303,11 @@ subroutine init_restart call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_aero_out=tr_aero, tr_brine_out=tr_brine, & - tr_fsd_out=tr_fsd) + tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) call icepack_query_tracer_indices(nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, & nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, & - nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd) + nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -402,6 +412,20 @@ subroutine init_restart call init_fsd(trcrn(:,:,nt_fsd:nt_fsd+nfsd-1,:,:)) endif endif + + ! isotopes + if (tr_iso) then + if (trim(runtype) == 'continue') restart_iso = .true. + if (restart_iso) then + call read_restart_iso + else + do iblk = 1, nblocks + call init_isotope(trcrn(:,:,nt_isosno:nt_isosno+n_iso-1,:,iblk), & + trcrn(:,:,nt_isoice:nt_isoice+n_iso-1,:,iblk)) + enddo ! iblk + endif + endif + if (tr_aero) then ! ice aerosol if (trim(runtype) == 'continue') restart_aero = .true. if (restart_aero) then diff --git a/cicecore/drivers/nuopc/dmi/CICE_RunMod.F90 b/cicecore/drivers/nuopc/dmi/CICE_RunMod.F90 index 11587cd83..ad575f714 100644 --- a/cicecore/drivers/nuopc/dmi/CICE_RunMod.F90 +++ b/cicecore/drivers/nuopc/dmi/CICE_RunMod.F90 @@ -21,7 +21,7 @@ module CICE_RunMod use ice_constants, only: field_loc_center, field_type_scalar use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero + use icepack_intfc, only: icepack_max_iso, icepack_max_aero use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_sizes @@ -47,12 +47,12 @@ subroutine CICE_Run use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, & get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default + fiso_default, faero_default use ice_flux, only: init_flux_atm, init_flux_ocn use ice_timers, only: ice_timer_start, ice_timer_stop, & timer_couple, timer_step logical (kind=log_kind) :: & - tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd + tr_iso, tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd character(len=*), parameter :: subname = '(CICE_Run)' !-------------------------------------------------------------------- @@ -64,7 +64,8 @@ subroutine CICE_Run call icepack_query_parameters(skl_bgc_out=skl_bgc, & z_tracers_out=z_tracers, & wave_spec_out=wave_spec) - call icepack_query_tracer_flags(tr_aero_out=tr_aero, & + call icepack_query_tracer_flags(tr_iso_out=tr_iso, & + tr_aero_out=tr_aero, & tr_zaero_out=tr_zaero, & tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) @@ -103,6 +104,9 @@ subroutine CICE_Run #ifndef CICE_DMI call get_forcing_ocn(dt) ! ocean forcing from data #endif + + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -155,7 +159,7 @@ subroutine ice_step use ice_restart_column, only: write_restart_age, write_restart_FY, & write_restart_lvl, write_restart_pond_cesm, write_restart_pond_lvl, & write_restart_pond_topo, write_restart_aero, write_restart_fsd, & - write_restart_bgc, write_restart_hbrine + write_restart_iso, write_restart_bgc, write_restart_hbrine use ice_restart_driver, only: dumpfile use ice_restoring, only: restore_ice, ice_HaloRestore use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & @@ -175,7 +179,7 @@ subroutine ice_step logical (kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_fsd, & - tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_aero, & + tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_iso, tr_aero, & calc_Tsfc, skl_bgc, solve_zsal, z_tracers, wave_spec character(len=*), parameter :: subname = '(ice_step)' @@ -186,7 +190,7 @@ subroutine ice_step call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero, & - tr_fsd_out=tr_fsd) + tr_iso_out=tr_iso, tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -231,7 +235,7 @@ subroutine ice_step call biogeochemistry (dt, iblk) ! biogeochemistry call step_therm2 (dt, iblk) ! ice thickness distribution thermo - endif + endif ! ktherm > 0 enddo ! iblk !$OMP END PARALLEL DO @@ -326,6 +330,7 @@ subroutine ice_step if (tr_pond_lvl) call write_restart_pond_lvl if (tr_pond_topo) call write_restart_pond_topo if (tr_fsd) call write_restart_fsd + if (tr_iso) call write_restart_iso if (tr_aero) call write_restart_aero if (solve_zsal .or. skl_bgc .or. z_tracers) & call write_restart_bgc @@ -360,7 +365,8 @@ subroutine coupling_prep (iblk) swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, & fsens, flat, fswabs, flwout, evap, Tref, Qref, & scale_fluxes, frzmlt_init, frzmlt - use ice_flux_bgc, only: faero_ocn, fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai + use ice_flux_bgc, only: faero_ocn, fiso_ocn, Qref_iso, fiso_evap, & + fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai use ice_grid, only: tmask use ice_state, only: aicen, aice #ifdef CICE_IN_NEMO @@ -539,7 +545,8 @@ subroutine coupling_prep (iblk) !----------------------------------------------------------------- call scale_fluxes (nx_block, ny_block, & - tmask (:,:,iblk), nbtrcr, icepack_max_aero, & + tmask (:,:,iblk), nbtrcr, & + icepack_max_aero, & aice (:,:,iblk), Tf (:,:,iblk), & Tair (:,:,iblk), Qa (:,:,iblk), & strairxT (:,:,iblk), strairyT(:,:,iblk), & @@ -553,7 +560,10 @@ subroutine coupling_prep (iblk) alvdr (:,:,iblk), alidr (:,:,iblk), & alvdf (:,:,iblk), alidf (:,:,iblk), & fzsal (:,:,iblk), fzsal_g (:,:,iblk), & - flux_bio(:,:,1:nbtrcr,iblk)) + flux_bio (:,:,1:nbtrcr,iblk), & + Qref_iso =Qref_iso (:,:,:,iblk), & + fiso_evap=fiso_evap(:,:,:,iblk), & + fiso_ocn =fiso_ocn (:,:,:,iblk)) #ifdef CICE_IN_NEMO !echmod - comment this out for efficiency, if .not. calc_Tsfc diff --git a/cicecore/drivers/nuopc/dmi/CICE_RunMod.F90_debug b/cicecore/drivers/nuopc/dmi/CICE_RunMod.F90_debug deleted file mode 100644 index 5de6b1cfd..000000000 --- a/cicecore/drivers/nuopc/dmi/CICE_RunMod.F90_debug +++ /dev/null @@ -1,686 +0,0 @@ -!======================================================================= -! -! Main driver for time stepping of CICE. -! -! authors Elizabeth C. Hunke, LANL -! Philip W. Jones, LANL -! William H. Lipscomb, LANL -! -! 2006 ECH: moved exit timeLoop to prevent execution of unnecessary timestep -! 2006 ECH: Streamlined for efficiency -! 2006 ECH: Converted to free source form (F90) -! 2007 BPB: Modified Delta-Eddington shortwave interface -! 2008 ECH: moved ESMF code to its own driver - - module CICE_RunMod - - use ice_kinds_mod - use ice_fileunits, only: nu_diag - use ice_arrays_column, only: oceanmixed_ice - use ice_constants, only: c0, c1 - use ice_constants, only: field_loc_center, field_type_scalar - use ice_exit, only: abort_ice - use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero - use icepack_intfc, only: icepack_query_parameters - use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_numbers - - implicit none - private - public :: CICE_Run, ice_step - -!======================================================================= - - contains - -!======================================================================= -! -! This is the main driver routine for advancing CICE forward in time. -! -! author Elizabeth C. Hunke, LANL -! Philip W. Jones, LANL -! William H. Lipscomb, LANL - - subroutine CICE_Run - - use ice_calendar, only: istep, istep1, time, dt, stop_now, calendar - use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, & - get_wave_spec - use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default - use ice_flux, only: init_flux_atm, init_flux_ocn - use ice_timers, only: ice_timer_start, ice_timer_stop, & - timer_couple, timer_step - logical (kind=log_kind) :: & - tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd - character(len=*), parameter :: subname = '(CICE_Run)' - - !-------------------------------------------------------------------- - ! initialize error code and step timer - !-------------------------------------------------------------------- - - call ice_timer_start(timer_step) ! start timing entire run - - call icepack_query_parameters(skl_bgc_out=skl_bgc, & - z_tracers_out=z_tracers, & - wave_spec_out=wave_spec) - call icepack_query_tracer_flags(tr_aero_out=tr_aero, & - tr_zaero_out=tr_zaero, & - tr_fsd_out=tr_fsd) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - -#ifndef CICE_IN_NEMO - !-------------------------------------------------------------------- - ! timestep loop - !-------------------------------------------------------------------- - - timeLoop: do -#endif - - call ice_step - - istep = istep + 1 ! update time step counters - istep1 = istep1 + 1 - time = time + dt ! determine the time and date - - call calendar(time) ! at the end of the timestep - -#ifndef CICE_IN_NEMO - if (stop_now >= 1) exit timeLoop -#endif - - call ice_timer_start(timer_couple) ! atm/ocn coupling - -#ifndef coupled -#ifndef CESMCOUPLED -! for now, wave_spectrum is constant in time -! if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice - call get_forcing_atmo ! atmospheric forcing from data - call get_forcing_ocn(dt) ! ocean forcing from data - - ! aerosols - ! if (tr_aero) call faero_data ! data file - ! if (tr_zaero) call fzaero_data ! data file (gx1) - if (tr_aero .or. tr_zaero) call faero_default ! default values - - if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry -#endif -#endif - if (z_tracers) call get_atm_bgc ! biogeochemistry - - call init_flux_atm ! Initialize atmosphere fluxes sent to coupler - call init_flux_ocn ! initialize ocean fluxes sent to coupler - - call ice_timer_stop(timer_couple) ! atm/ocn coupling - -#ifndef CICE_IN_NEMO - enddo timeLoop -#endif - - !-------------------------------------------------------------------- - ! end of timestep loop - !-------------------------------------------------------------------- - - call ice_timer_stop(timer_step) ! end timestepping loop timer - - end subroutine CICE_Run - -!======================================================================= -! -! Calls drivers for physics components, some initialization, and output -! -! author Elizabeth C. Hunke, LANL -! William H. Lipscomb, LANL - - subroutine ice_step - - use ice_boundary, only: ice_HaloUpdate - use ice_calendar, only: dt, dt_dyn, ndtd, diagfreq, write_restart, istep - use ice_diagnostics, only: init_mass_diags, runtime_diags - use ice_diagnostics_bgc, only: hbrine_diags, zsal_diags, bgc_diags - use ice_domain, only: halo_info, nblocks - use ice_dyn_eap, only: write_restart_eap - use ice_dyn_shared, only: kdyn, kridge - use ice_flux, only: scale_factor, init_history_therm, & - daidtt, daidtd, dvidtt, dvidtd, dagedtt, dagedtd - use ice_history, only: accum_hist - use ice_history_bgc, only: init_history_bgc - use ice_restart, only: final_restart - use ice_restart_column, only: write_restart_age, write_restart_FY, & - write_restart_lvl, write_restart_pond_cesm, write_restart_pond_lvl, & - write_restart_pond_topo, write_restart_aero, write_restart_fsd, & - write_restart_bgc, write_restart_hbrine - use ice_restart_driver, only: dumpfile - use ice_restoring, only: restore_ice, ice_HaloRestore - use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & - update_state, step_dyn_horiz, step_dyn_ridge, step_radiation, & - biogeochemistry, save_init, step_dyn_wave - use ice_timers, only: ice_timer_start, ice_timer_stop, & - timer_diags, timer_column, timer_thermo, timer_bound, & - timer_hist, timer_readwrite - - integer (kind=int_kind) :: & - iblk , & ! block index - k , & ! dynamics supercycling index - ktherm ! thermodynamics is off when ktherm = -1 - - real (kind=dbl_kind) :: & - offset ! d(age)/dt time offset - - logical (kind=log_kind) :: & - tr_iage, tr_FY, tr_lvl, tr_fsd, & - tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_aero, & - calc_Tsfc, skl_bgc, solve_zsal, z_tracers, wave_spec - - character(len=*), parameter :: subname = '(ice_step)' - - character (len=char_len) :: plabeld - - plabeld = 'beginning time step' - do iblk = 1, nblocks - call debug_ice (iblk, plabeld) - enddo - - call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc, skl_bgc_out=skl_bgc, & - solve_zsal_out=solve_zsal, z_tracers_out=z_tracers, ktherm_out=ktherm, & - wave_spec_out=wave_spec) - call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & - tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & - tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero, & - tr_fsd_out=tr_fsd) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - !----------------------------------------------------------------- - ! restoring on grid boundaries - !----------------------------------------------------------------- - - if (restore_ice) call ice_HaloRestore - - !----------------------------------------------------------------- - ! initialize diagnostics and save initial state values - !----------------------------------------------------------------- - - call ice_timer_start(timer_diags) ! diagnostics/history - call init_mass_diags ! diagnostics per timestep - call init_history_therm - call init_history_bgc - call ice_timer_stop(timer_diags) ! diagnostics/history - - call ice_timer_start(timer_column) ! column physics - call ice_timer_start(timer_thermo) ! thermodynamics - - call save_init - - !$OMP PARALLEL DO PRIVATE(iblk) - do iblk = 1, nblocks - - if (ktherm >= 0) then - - !----------------------------------------------------------------- - ! scale radiation fields - !----------------------------------------------------------------- - - if (calc_Tsfc) call prep_radiation (iblk) - - plabeld = 'post prep_radiation' - call debug_ice (iblk, plabeld) - - !----------------------------------------------------------------- - ! thermodynamics and biogeochemistry - !----------------------------------------------------------------- - - call step_therm1 (dt, iblk) ! vertical thermodynamics - - plabeld = 'post step_therm1' - call debug_ice (iblk, plabeld) - - call biogeochemistry (dt, iblk) ! biogeochemistry - - plabeld = 'post biogeochemistry' - call debug_ice (iblk, plabeld) - - call step_therm2 (dt, iblk) ! ice thickness distribution thermo - - plabeld = 'post step_therm2' - call debug_ice (iblk, plabeld) - - endif - - enddo ! iblk - !$OMP END PARALLEL DO - - ! clean up, update tendency diagnostics - offset = dt - call update_state (dt, daidtt, dvidtt, dagedtt, offset) - - call ice_timer_stop(timer_thermo) ! thermodynamics - call ice_timer_stop(timer_column) ! column physics - - !----------------------------------------------------------------- - ! dynamics, transport, ridging - !----------------------------------------------------------------- - - ! wave fracture of the floe size distribution - ! note this is called outside of the dynamics subcycling loop - if (tr_fsd .and. wave_spec) call step_dyn_wave(dt) - - do k = 1, ndtd - - ! momentum, stress, transport - call step_dyn_horiz (dt_dyn) - - plabeld = 'post step_dyn_horiz' - call debug_ice (iblk, plabeld) - - ! ridging - !$OMP PARALLEL DO PRIVATE(iblk) - do iblk = 1, nblocks - if (kridge > 0) call step_dyn_ridge (dt_dyn, ndtd, iblk) - enddo - !$OMP END PARALLEL DO - - ! clean up, update tendency diagnostics - offset = c0 - call update_state (dt_dyn, daidtd, dvidtd, dagedtd, offset) - - enddo - - plabeld = 'post dynamics' - do iblk = 1, nblocks - call debug_ice (iblk, plabeld) - enddo - - !----------------------------------------------------------------- - ! albedo, shortwave radiation - !----------------------------------------------------------------- - - call ice_timer_start(timer_column) ! column physics - call ice_timer_start(timer_thermo) ! thermodynamics - -!MHRI: CHECK THIS OMP - !$OMP PARALLEL DO PRIVATE(iblk) - do iblk = 1, nblocks - - if (ktherm >= 0) call step_radiation (dt, iblk) - - plabeld = 'post step_radiation' - call debug_ice (iblk, plabeld) - - !----------------------------------------------------------------- - ! get ready for coupling and the next time step - !----------------------------------------------------------------- - - call coupling_prep (iblk) - - plabeld = 'post coupling_prep' - call debug_ice (iblk, plabeld) - - enddo ! iblk - !$OMP END PARALLEL DO - - call ice_timer_start(timer_bound) - call ice_HaloUpdate (scale_factor, halo_info, & - field_loc_center, field_type_scalar) - call ice_timer_stop(timer_bound) - - call ice_timer_stop(timer_thermo) ! thermodynamics - call ice_timer_stop(timer_column) ! column physics - - !----------------------------------------------------------------- - ! write data - !----------------------------------------------------------------- - - call ice_timer_start(timer_diags) ! diagnostics - if (mod(istep,diagfreq) == 0) then - call runtime_diags(dt) ! log file - if (solve_zsal) call zsal_diags - if (skl_bgc .or. z_tracers) call bgc_diags - if (tr_brine) call hbrine_diags - endif - call ice_timer_stop(timer_diags) ! diagnostics - - call ice_timer_start(timer_hist) ! history - call accum_hist (dt) ! history file - call ice_timer_stop(timer_hist) ! history - - call ice_timer_start(timer_readwrite) ! reading/writing - if (write_restart == 1) then - call dumpfile ! core variables for restarting - if (tr_iage) call write_restart_age - if (tr_FY) call write_restart_FY - if (tr_lvl) call write_restart_lvl - if (tr_pond_cesm) call write_restart_pond_cesm - if (tr_pond_lvl) call write_restart_pond_lvl - if (tr_pond_topo) call write_restart_pond_topo - if (tr_fsd) call write_restart_fsd - if (tr_aero) call write_restart_aero - if (solve_zsal .or. skl_bgc .or. z_tracers) & - call write_restart_bgc - if (tr_brine) call write_restart_hbrine - if (kdyn == 2) call write_restart_eap - call final_restart - endif - - call ice_timer_stop(timer_readwrite) ! reading/writing - - end subroutine ice_step - -!======================================================================= -! -! Prepare for coupling -! -! authors: Elizabeth C. Hunke, LANL - - subroutine coupling_prep (iblk) - - use ice_arrays_column, only: alvdfn, alidfn, alvdrn, alidrn, & - albicen, albsnon, albpndn, apeffn, fzsal_g, fzsal, snowfracn - use ice_blocks, only: nx_block, ny_block, get_block, block - use ice_domain, only: blocks_ice - use ice_calendar, only: dt, nstreams - use ice_domain_size, only: ncat - use ice_flux, only: alvdf, alidf, alvdr, alidr, albice, albsno, & - albpnd, albcnt, apeff_ai, fpond, fresh, l_mpond_fresh, & - alvdf_ai, alidf_ai, alvdr_ai, alidr_ai, fhocn_ai, & - fresh_ai, fsalt_ai, fsalt, & - fswthru_ai, fhocn, fswthru, scale_factor, snowfrac, & - swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, & - fsens, flat, fswabs, flwout, evap, Tref, Qref, & - scale_fluxes, frzmlt_init, frzmlt - use ice_flux_bgc, only: faero_ocn, fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai - use ice_grid, only: tmask - use ice_state, only: aicen, aice -#ifdef CICE_IN_NEMO - use ice_state, only: aice_init - use ice_flux, only: flatn_f, fsurfn_f -#endif - use ice_step_mod, only: ocean_mixed_layer - use ice_timers, only: timer_couple, ice_timer_start, ice_timer_stop - - integer (kind=int_kind), intent(in) :: & - iblk ! block index - - ! local variables - - integer (kind=int_kind) :: & - ilo,ihi,jlo,jhi, & ! beginning and end of physical domain - n , & ! thickness category index - i,j , & ! horizontal indices - k , & ! tracer index - nbtrcr ! - - type (block) :: & - this_block ! block information for current block - - logical (kind=log_kind) :: & - calc_Tsfc ! - - real (kind=dbl_kind) :: & - cszn , & ! counter for history averaging - puny , & ! - rhofresh , & ! - netsw ! flag for shortwave radiation presence - - character(len=*), parameter :: subname = '(coupling_prep)' - - call icepack_query_parameters(puny_out=puny, rhofresh_out=rhofresh) - call icepack_query_tracer_numbers(nbtrcr_out=nbtrcr) - call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - !----------------------------------------------------------------- - ! Save current value of frzmlt for diagnostics. - ! Update mixed layer with heat and radiation from ice. - !----------------------------------------------------------------- - - do j = 1, ny_block - do i = 1, nx_block - frzmlt_init (i,j,iblk) = frzmlt(i,j,iblk) - enddo - enddo - - call ice_timer_start(timer_couple) ! atm/ocn coupling - - if (oceanmixed_ice) & - call ocean_mixed_layer (dt,iblk) ! ocean surface fluxes and sst - - !----------------------------------------------------------------- - ! Aggregate albedos - !----------------------------------------------------------------- - - do j = 1, ny_block - do i = 1, nx_block - alvdf(i,j,iblk) = c0 - alidf(i,j,iblk) = c0 - alvdr(i,j,iblk) = c0 - alidr(i,j,iblk) = c0 - - albice(i,j,iblk) = c0 - albsno(i,j,iblk) = c0 - albpnd(i,j,iblk) = c0 - apeff_ai(i,j,iblk) = c0 - snowfrac(i,j,iblk) = c0 - - ! for history averaging - cszn = c0 - netsw = swvdr(i,j,iblk)+swidr(i,j,iblk)+swvdf(i,j,iblk)+swidf(i,j,iblk) - if (netsw > puny) cszn = c1 - do n = 1, nstreams - albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn - enddo - enddo - enddo - - 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 n = 1, ncat - do j = jlo, jhi - do i = ilo, ihi - if (aicen(i,j,n,iblk) > puny) then - - alvdf(i,j,iblk) = alvdf(i,j,iblk) & - + alvdfn(i,j,n,iblk)*aicen(i,j,n,iblk) - alidf(i,j,iblk) = alidf(i,j,iblk) & - + alidfn(i,j,n,iblk)*aicen(i,j,n,iblk) - alvdr(i,j,iblk) = alvdr(i,j,iblk) & - + alvdrn(i,j,n,iblk)*aicen(i,j,n,iblk) - alidr(i,j,iblk) = alidr(i,j,iblk) & - + alidrn(i,j,n,iblk)*aicen(i,j,n,iblk) - - netsw = swvdr(i,j,iblk) + swidr(i,j,iblk) & - + swvdf(i,j,iblk) + swidf(i,j,iblk) - if (netsw > puny) then ! sun above horizon - albice(i,j,iblk) = albice(i,j,iblk) & - + albicen(i,j,n,iblk)*aicen(i,j,n,iblk) - albsno(i,j,iblk) = albsno(i,j,iblk) & - + albsnon(i,j,n,iblk)*aicen(i,j,n,iblk) - albpnd(i,j,iblk) = albpnd(i,j,iblk) & - + albpndn(i,j,n,iblk)*aicen(i,j,n,iblk) - endif - - apeff_ai(i,j,iblk) = apeff_ai(i,j,iblk) & ! for history - + apeffn(i,j,n,iblk)*aicen(i,j,n,iblk) - snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & ! for history - + snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk) - - endif ! aicen > puny - enddo - enddo - enddo - - do j = 1, ny_block - do i = 1, nx_block - - !----------------------------------------------------------------- - ! reduce fresh by fpond for coupling - !----------------------------------------------------------------- - - if (l_mpond_fresh) then - fpond(i,j,iblk) = fpond(i,j,iblk) * rhofresh/dt - fresh(i,j,iblk) = fresh(i,j,iblk) - fpond(i,j,iblk) - endif - - !---------------------------------------------------------------- - ! Store grid box mean albedos and fluxes before scaling by aice - !---------------------------------------------------------------- - - alvdf_ai (i,j,iblk) = alvdf (i,j,iblk) - alidf_ai (i,j,iblk) = alidf (i,j,iblk) - alvdr_ai (i,j,iblk) = alvdr (i,j,iblk) - alidr_ai (i,j,iblk) = alidr (i,j,iblk) - fresh_ai (i,j,iblk) = fresh (i,j,iblk) - fsalt_ai (i,j,iblk) = fsalt (i,j,iblk) - fhocn_ai (i,j,iblk) = fhocn (i,j,iblk) - fswthru_ai(i,j,iblk) = fswthru(i,j,iblk) - fzsal_ai (i,j,iblk) = fzsal (i,j,iblk) - fzsal_g_ai(i,j,iblk) = fzsal_g(i,j,iblk) - - if (nbtrcr > 0) then - do k = 1, nbtrcr - flux_bio_ai (i,j,k,iblk) = flux_bio (i,j,k,iblk) - enddo - endif - - !----------------------------------------------------------------- - ! Save net shortwave for scaling factor in scale_factor - !----------------------------------------------------------------- - scale_factor(i,j,iblk) = & - swvdr(i,j,iblk)*(c1 - alvdr_ai(i,j,iblk)) & - + swvdf(i,j,iblk)*(c1 - alvdf_ai(i,j,iblk)) & - + swidr(i,j,iblk)*(c1 - alidr_ai(i,j,iblk)) & - + swidf(i,j,iblk)*(c1 - alidf_ai(i,j,iblk)) - - enddo - enddo - - !----------------------------------------------------------------- - ! Divide fluxes by ice area - ! - the CESM coupler assumes fluxes are per unit ice area - ! - also needed for global budget in diagnostics - !----------------------------------------------------------------- - - call scale_fluxes (nx_block, ny_block, & - tmask (:,:,iblk), nbtrcr, icepack_max_aero, & - aice (:,:,iblk), Tf (:,:,iblk), & - Tair (:,:,iblk), Qa (:,:,iblk), & - strairxT (:,:,iblk), strairyT(:,:,iblk), & - fsens (:,:,iblk), flat (:,:,iblk), & - fswabs (:,:,iblk), flwout (:,:,iblk), & - evap (:,:,iblk), & - Tref (:,:,iblk), Qref (:,:,iblk), & - fresh (:,:,iblk), fsalt (:,:,iblk), & - fhocn (:,:,iblk), fswthru (:,:,iblk), & - faero_ocn(:,:,:,iblk), & - alvdr (:,:,iblk), alidr (:,:,iblk), & - alvdf (:,:,iblk), alidf (:,:,iblk), & - fzsal (:,:,iblk), fzsal_g (:,:,iblk), & - flux_bio(:,:,1:nbtrcr,iblk)) - -#ifdef CICE_IN_NEMO -!echmod - comment this out for efficiency, if .not. calc_Tsfc - if (.not. calc_Tsfc) then - - !--------------------------------------------------------------- - ! If surface fluxes were provided, conserve these fluxes at ice - ! free points by passing to ocean. - !--------------------------------------------------------------- - - call sfcflux_to_ocn & - (nx_block, ny_block, & - tmask (:,:,iblk), aice_init(:,:,iblk), & - fsurfn_f (:,:,:,iblk), flatn_f(:,:,:,iblk), & - fresh (:,:,iblk), fhocn (:,:,iblk)) - endif -!echmod -#endif - call ice_timer_stop(timer_couple) ! atm/ocn coupling - - end subroutine coupling_prep - -#ifdef CICE_IN_NEMO - -!======================================================================= -! -! If surface heat fluxes are provided to CICE instead of CICE calculating -! them internally (i.e. .not. calc_Tsfc), then these heat fluxes can -! be provided at points which do not have ice. (This is could be due to -! the heat fluxes being calculated on a lower resolution grid or the -! heat fluxes not recalculated at every CICE timestep.) At ice free points, -! conserve energy and water by passing these fluxes to the ocean. -! -! author: A. McLaren, Met Office - - subroutine sfcflux_to_ocn(nx_block, ny_block, & - tmask, aice, & - fsurfn_f, flatn_f, & - fresh, fhocn) - - use ice_domain_size, only: ncat - - integer (kind=int_kind), intent(in) :: & - nx_block, ny_block ! block dimensions - - logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: & - tmask ! land/boundary mask, thickness (T-cell) - - real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in):: & - aice ! initial ice concentration - - real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), intent(in) :: & - fsurfn_f, & ! net surface heat flux (provided as forcing) - flatn_f ! latent heat flux (provided as forcing) - - real (kind=dbl_kind), dimension(nx_block,ny_block), intent(inout):: & - fresh , & ! fresh water flux to ocean (kg/m2/s) - fhocn ! actual ocn/ice heat flx (W/m**2) - - - ! local variables - integer (kind=int_kind) :: & - i, j, n ! horizontal indices - - real (kind=dbl_kind) :: & - puny, & ! - rLsub ! 1/Lsub - - character(len=*), parameter :: subname = '(sfcflux_to_ocn)' - - call icepack_query_parameters(puny_out=puny) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - rLsub = c1 / Lsub - - do n = 1, ncat - do j = 1, ny_block - do i = 1, nx_block - if (tmask(i,j) .and. aice(i,j) <= puny) then - fhocn(i,j) = fhocn(i,j) & - + fsurfn_f(i,j,n) + flatn_f(i,j,n) - fresh(i,j) = fresh(i,j) & - + flatn_f(i,j,n) * rLsub - endif - enddo ! i - enddo ! j - enddo ! n - - - end subroutine sfcflux_to_ocn - -#endif - -!======================================================================= - - end module CICE_RunMod - -!======================================================================= diff --git a/cicecore/drivers/standalone/cice/CICE_InitMod.F90 b/cicecore/drivers/standalone/cice/CICE_InitMod.F90 index 0b61433a3..59bbca31c 100644 --- a/cicecore/drivers/standalone/cice/CICE_InitMod.F90 +++ b/cicecore/drivers/standalone/cice/CICE_InitMod.F90 @@ -77,7 +77,7 @@ subroutine cice_init use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & get_forcing_atmo, get_forcing_ocn, get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default, faero_optics, alloc_forcing_bgc + faero_default, faero_optics, alloc_forcing_bgc, fiso_default use ice_grid, only: init_grid1, init_grid2, alloc_grid use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runtype @@ -92,7 +92,7 @@ subroutine cice_init #endif logical(kind=log_kind) :: tr_aero, tr_zaero, skl_bgc, z_tracers, & - tr_fsd, wave_spec + tr_iso, tr_fsd, wave_spec character(len=*), parameter :: subname = '(cice_init)' call init_communicate ! initial setup for message passing @@ -122,7 +122,6 @@ subroutine cice_init call ice_timer_start(timer_total) ! start timing entire run call init_grid2 ! grid variables call init_zbgc ! vertical biogeochemistry initialization - call init_calendar ! initialize some calendar stuff call init_hist (dt) ! initialize output history file @@ -134,6 +133,7 @@ subroutine cice_init endif call init_coupler_flux ! initialize fluxes exchanged with coupler + #ifdef popcice call sst_sss ! POP data for CICE initialization #endif @@ -181,6 +181,7 @@ subroutine cice_init call init_history_dyn ! initialize dynamic history variables call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero) + call icepack_query_tracer_flags(tr_iso_out=tr_iso) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(trim(subname), & file=__FILE__,line= __LINE__) @@ -211,6 +212,8 @@ subroutine cice_init call get_forcing_atmo ! atmospheric forcing from data call get_forcing_ocn(dt) ! ocean forcing from data + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -239,20 +242,21 @@ subroutine init_restart use ice_calendar, only: time, calendar use ice_constants, only: c0 use ice_domain, only: nblocks - use ice_domain_size, only: ncat, n_aero, nfsd + use ice_domain_size, only: ncat, n_iso, n_aero, nfsd use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn use ice_grid, only: tmask use ice_init, only: ice_ic use ice_init_column, only: init_age, init_FY, init_lvl, & init_meltponds_cesm, init_meltponds_lvl, init_meltponds_topo, & - init_aerosol, init_hbrine, init_bgc, init_fsd + init_isotope, init_aerosol, init_hbrine, init_bgc, init_fsd use ice_restart_column, only: restart_age, read_restart_age, & restart_FY, read_restart_FY, restart_lvl, read_restart_lvl, & restart_pond_cesm, read_restart_pond_cesm, & restart_pond_lvl, read_restart_pond_lvl, & restart_pond_topo, read_restart_pond_topo, & restart_fsd, read_restart_fsd, & + restart_iso, read_restart_iso, & restart_aero, read_restart_aero, & restart_hbrine, read_restart_hbrine, & restart_zsal, restart_bgc @@ -265,13 +269,13 @@ subroutine init_restart iblk ! block index logical(kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_pond_cesm, tr_pond_lvl, & - tr_pond_topo, tr_fsd, tr_aero, tr_brine, & + tr_pond_topo, tr_fsd, tr_iso, tr_aero, tr_brine, & skl_bgc, z_tracers, solve_zsal integer(kind=int_kind) :: & ntrcr integer(kind=int_kind) :: & nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & - nt_iage, nt_FY, nt_aero, nt_fsd + nt_iage, nt_FY, nt_aero, nt_fsd, nt_isosno, nt_isoice character(len=*), parameter :: subname = '(init_restart)' @@ -285,10 +289,11 @@ subroutine init_restart call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_aero_out=tr_aero, tr_brine_out=tr_brine, & - tr_fsd_out=tr_fsd) + tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) call icepack_query_tracer_indices(nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, & nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, & - nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd) + nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_aero_out=nt_aero, nt_fsd_out=nt_fsd, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -393,6 +398,20 @@ subroutine init_restart call init_fsd(trcrn(:,:,nt_fsd:nt_fsd+nfsd-1,:,:)) endif endif + + ! isotopes + if (tr_iso) then + if (trim(runtype) == 'continue') restart_iso = .true. + if (restart_iso) then + call read_restart_iso + else + do iblk = 1, nblocks + call init_isotope(trcrn(:,:,nt_isosno:nt_isosno+n_iso-1,:,iblk), & + trcrn(:,:,nt_isoice:nt_isoice+n_iso-1,:,iblk)) + enddo ! iblk + endif + endif + if (tr_aero) then ! ice aerosol if (trim(runtype) == 'continue') restart_aero = .true. if (restart_aero) then diff --git a/cicecore/drivers/standalone/cice/CICE_RunMod.F90 b/cicecore/drivers/standalone/cice/CICE_RunMod.F90 index ad974475b..7645c43f3 100644 --- a/cicecore/drivers/standalone/cice/CICE_RunMod.F90 +++ b/cicecore/drivers/standalone/cice/CICE_RunMod.F90 @@ -21,7 +21,7 @@ module CICE_RunMod use ice_constants, only: field_loc_center, field_type_scalar use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero + use icepack_intfc, only: icepack_max_iso, icepack_max_aero use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_sizes @@ -47,12 +47,12 @@ subroutine CICE_Run use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, & get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default + fiso_default, faero_default use ice_flux, only: init_flux_atm, init_flux_ocn use ice_timers, only: ice_timer_start, ice_timer_stop, & timer_couple, timer_step logical (kind=log_kind) :: & - tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd + tr_iso, tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd character(len=*), parameter :: subname = '(CICE_Run)' !-------------------------------------------------------------------- @@ -64,7 +64,8 @@ subroutine CICE_Run call icepack_query_parameters(skl_bgc_out=skl_bgc, & z_tracers_out=z_tracers, & wave_spec_out=wave_spec) - call icepack_query_tracer_flags(tr_aero_out=tr_aero, & + call icepack_query_tracer_flags(tr_iso_out=tr_iso, & + tr_aero_out=tr_aero, & tr_zaero_out=tr_zaero, & tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) @@ -100,6 +101,8 @@ subroutine CICE_Run call get_forcing_atmo ! atmospheric forcing from data call get_forcing_ocn(dt) ! ocean forcing from data + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -151,7 +154,7 @@ subroutine ice_step use ice_restart_column, only: write_restart_age, write_restart_FY, & write_restart_lvl, write_restart_pond_cesm, write_restart_pond_lvl, & write_restart_pond_topo, write_restart_aero, write_restart_fsd, & - write_restart_bgc, write_restart_hbrine + write_restart_iso, write_restart_bgc, write_restart_hbrine use ice_restart_driver, only: dumpfile use ice_restoring, only: restore_ice, ice_HaloRestore use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & @@ -171,7 +174,7 @@ subroutine ice_step logical (kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_fsd, & - tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_aero, & + tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_iso, tr_aero, & calc_Tsfc, skl_bgc, solve_zsal, z_tracers, wave_spec character(len=*), parameter :: subname = '(ice_step)' @@ -182,7 +185,7 @@ subroutine ice_step call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero, & - tr_fsd_out=tr_fsd) + tr_iso_out=tr_iso, tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -227,7 +230,7 @@ subroutine ice_step call biogeochemistry (dt, iblk) ! biogeochemistry call step_therm2 (dt, iblk) ! ice thickness distribution thermo - endif + endif ! ktherm > 0 enddo ! iblk !$OMP END PARALLEL DO @@ -322,6 +325,7 @@ subroutine ice_step if (tr_pond_lvl) call write_restart_pond_lvl if (tr_pond_topo) call write_restart_pond_topo if (tr_fsd) call write_restart_fsd + if (tr_iso) call write_restart_iso if (tr_aero) call write_restart_aero if (solve_zsal .or. skl_bgc .or. z_tracers) & call write_restart_bgc @@ -356,7 +360,8 @@ subroutine coupling_prep (iblk) swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, & fsens, flat, fswabs, flwout, evap, Tref, Qref, & scale_fluxes, frzmlt_init, frzmlt - use ice_flux_bgc, only: faero_ocn, fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai + use ice_flux_bgc, only: faero_ocn, fiso_ocn, Qref_iso, fiso_evap, & + fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai use ice_grid, only: tmask use ice_state, only: aicen, aice #ifdef CICE_IN_NEMO @@ -535,7 +540,8 @@ subroutine coupling_prep (iblk) !----------------------------------------------------------------- call scale_fluxes (nx_block, ny_block, & - tmask (:,:,iblk), nbtrcr, icepack_max_aero, & + tmask (:,:,iblk), nbtrcr, & + icepack_max_aero, & aice (:,:,iblk), Tf (:,:,iblk), & Tair (:,:,iblk), Qa (:,:,iblk), & strairxT (:,:,iblk), strairyT(:,:,iblk), & @@ -549,7 +555,10 @@ subroutine coupling_prep (iblk) alvdr (:,:,iblk), alidr (:,:,iblk), & alvdf (:,:,iblk), alidf (:,:,iblk), & fzsal (:,:,iblk), fzsal_g (:,:,iblk), & - flux_bio(:,:,1:nbtrcr,iblk)) + flux_bio (:,:,1:nbtrcr,iblk), & + Qref_iso =Qref_iso (:,:,:,iblk), & + fiso_evap=fiso_evap(:,:,:,iblk), & + fiso_ocn =fiso_ocn (:,:,:,iblk)) #ifdef CICE_IN_NEMO !echmod - comment this out for efficiency, if .not. calc_Tsfc diff --git a/cicecore/drivers/standalone/cice/CICE_RunMod.F90_debug b/cicecore/drivers/standalone/cice/CICE_RunMod.F90_debug index 5de6b1cfd..7ca555433 100644 --- a/cicecore/drivers/standalone/cice/CICE_RunMod.F90_debug +++ b/cicecore/drivers/standalone/cice/CICE_RunMod.F90_debug @@ -21,9 +21,9 @@ use ice_constants, only: field_loc_center, field_type_scalar use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_aero + use icepack_intfc, only: icepack_max_iso, icepack_max_aero use icepack_intfc, only: icepack_query_parameters - use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_numbers + use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_sizes implicit none private @@ -47,12 +47,12 @@ use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, & get_wave_spec use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_default + fiso_default, faero_default use ice_flux, only: init_flux_atm, init_flux_ocn use ice_timers, only: ice_timer_start, ice_timer_stop, & timer_couple, timer_step logical (kind=log_kind) :: & - tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd + tr_iso, tr_aero, tr_zaero, skl_bgc, z_tracers, wave_spec, tr_fsd character(len=*), parameter :: subname = '(CICE_Run)' !-------------------------------------------------------------------- @@ -64,7 +64,8 @@ call icepack_query_parameters(skl_bgc_out=skl_bgc, & z_tracers_out=z_tracers, & wave_spec_out=wave_spec) - call icepack_query_tracer_flags(tr_aero_out=tr_aero, & + call icepack_query_tracer_flags(tr_iso_out=tr_iso, & + tr_aero_out=tr_aero, & tr_zaero_out=tr_zaero, & tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) @@ -100,6 +101,8 @@ call get_forcing_atmo ! atmospheric forcing from data call get_forcing_ocn(dt) ! ocean forcing from data + ! isotopes + if (tr_iso) call fiso_default ! default values ! aerosols ! if (tr_aero) call faero_data ! data file ! if (tr_zaero) call fzaero_data ! data file (gx1) @@ -151,7 +154,7 @@ use ice_restart_column, only: write_restart_age, write_restart_FY, & write_restart_lvl, write_restart_pond_cesm, write_restart_pond_lvl, & write_restart_pond_topo, write_restart_aero, write_restart_fsd, & - write_restart_bgc, write_restart_hbrine + write_restart_iso, write_restart_bgc, write_restart_hbrine use ice_restart_driver, only: dumpfile use ice_restoring, only: restore_ice, ice_HaloRestore use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & @@ -171,7 +174,7 @@ logical (kind=log_kind) :: & tr_iage, tr_FY, tr_lvl, tr_fsd, & - tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_aero, & + tr_pond_cesm, tr_pond_lvl, tr_pond_topo, tr_brine, tr_iso, tr_aero, & calc_Tsfc, skl_bgc, solve_zsal, z_tracers, wave_spec character(len=*), parameter :: subname = '(ice_step)' @@ -189,7 +192,7 @@ call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, & tr_lvl_out=tr_lvl, tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_aero_out=tr_aero, & - tr_fsd_out=tr_fsd) + tr_iso_out=tr_iso, tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) @@ -273,8 +276,10 @@ ! momentum, stress, transport call step_dyn_horiz (dt_dyn) + do iblk = 1, nblocks plabeld = 'post step_dyn_horiz' call debug_ice (iblk, plabeld) + enddo ! iblk ! ridging !$OMP PARALLEL DO PRIVATE(iblk) @@ -283,6 +288,11 @@ enddo !$OMP END PARALLEL DO + do iblk = 1, nblocks + plabeld = 'post step_dyn_ridge' + call debug_ice (iblk, plabeld) + enddo ! iblk + ! clean up, update tendency diagnostics offset = c0 call update_state (dt_dyn, daidtd, dvidtd, dagedtd, offset) @@ -357,6 +367,7 @@ if (tr_pond_lvl) call write_restart_pond_lvl if (tr_pond_topo) call write_restart_pond_topo if (tr_fsd) call write_restart_fsd + if (tr_iso) call write_restart_iso if (tr_aero) call write_restart_aero if (solve_zsal .or. skl_bgc .or. z_tracers) & call write_restart_bgc @@ -391,7 +402,8 @@ swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, & fsens, flat, fswabs, flwout, evap, Tref, Qref, & scale_fluxes, frzmlt_init, frzmlt - use ice_flux_bgc, only: faero_ocn, fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai + use ice_flux_bgc, only: faero_ocn, fiso_ocn, Qref_iso, fiso_evap, & + fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai use ice_grid, only: tmask use ice_state, only: aicen, aice #ifdef CICE_IN_NEMO @@ -428,7 +440,7 @@ character(len=*), parameter :: subname = '(coupling_prep)' call icepack_query_parameters(puny_out=puny, rhofresh_out=rhofresh) - call icepack_query_tracer_numbers(nbtrcr_out=nbtrcr) + call icepack_query_tracer_sizes(nbtrcr_out=nbtrcr) call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -570,7 +582,8 @@ !----------------------------------------------------------------- call scale_fluxes (nx_block, ny_block, & - tmask (:,:,iblk), nbtrcr, icepack_max_aero, & + tmask (:,:,iblk), nbtrcr, & + icepack_max_aero, & aice (:,:,iblk), Tf (:,:,iblk), & Tair (:,:,iblk), Qa (:,:,iblk), & strairxT (:,:,iblk), strairyT(:,:,iblk), & @@ -584,7 +597,10 @@ alvdr (:,:,iblk), alidr (:,:,iblk), & alvdf (:,:,iblk), alidf (:,:,iblk), & fzsal (:,:,iblk), fzsal_g (:,:,iblk), & - flux_bio(:,:,1:nbtrcr,iblk)) + flux_bio (:,:,1:nbtrcr,iblk), & + Qref_iso =Qref_iso (:,:,:,iblk), & + fiso_evap=fiso_evap(:,:,:,iblk), & + fiso_ocn =fiso_ocn (:,:,:,iblk)) #ifdef CICE_IN_NEMO !echmod - comment this out for efficiency, if .not. calc_Tsfc diff --git a/cicecore/shared/ice_distribution.F90 b/cicecore/shared/ice_distribution.F90 index 4af95ae1f..8c5808820 100644 --- a/cicecore/shared/ice_distribution.F90 +++ b/cicecore/shared/ice_distribution.F90 @@ -118,8 +118,7 @@ function create_distribution(dist_type, nprocs, work_per_block) case('spacecurve') - create_distribution = create_distrb_spacecurve(nprocs, & - work_per_block) + create_distribution = create_distrb_spacecurve(nprocs, work_per_block) case default @@ -364,7 +363,7 @@ subroutine ice_distributionDestroy(distribution) ! !---------------------------------------------------------------------- - distribution%nprocs = 0 + distribution%nprocs = 0 distribution%communicator = 0 distribution%numLocalBlocks = 0 @@ -377,6 +376,9 @@ subroutine ice_distributionDestroy(distribution) deallocate(distribution%blockLocation, stat=istat) deallocate(distribution%blockLocalID , stat=istat) deallocate(distribution%blockGlobalID, stat=istat) + deallocate(distribution%blockCnt , stat=istat) + deallocate(distribution%blockindex , stat=istat) + !----------------------------------------------------------------------- @@ -611,6 +613,12 @@ function create_distrb_cart(nprocs, workPerBlock) result(newDistrb) return endif + allocate (newDistrb%blockCnt(nprocs)) + newDistrb%blockCnt(:) = 0 + + allocate(newDistrb%blockIndex(nprocs,max_blocks)) + newDistrb%blockIndex(:,:) = 0 + !---------------------------------------------------------------------- ! ! distribute blocks linearly across processors in each direction @@ -640,6 +648,8 @@ function create_distrb_cart(nprocs, workPerBlock) result(newDistrb) localID = localID + 1 newDistrb%blockLocation(globalID) = processor newDistrb%blockLocalID (globalID) = localID + newDistrb%blockCnt(processor) = newDistrb%blockCnt(processor) + 1 + newDistrb%blockIndex(processor,localID) = globalID else ! no work - eliminate block from distribution newDistrb%blockLocation(globalID) = 0 newDistrb%blockLocalID (globalID) = 0 @@ -966,6 +976,12 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) return endif + allocate (newDistrb%blockCnt(nprocs)) + newDistrb%blockCnt(:) = 0 + + allocate(newDistrb%blockIndex(nprocs,max_blocks)) + newDistrb%blockIndex(:,:) = 0 + allocate(procTmp(nprocs), stat=istat) if (istat > 0) then call abort_ice( & @@ -981,11 +997,13 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) if (pid > 0) then procTmp(pid) = procTmp(pid) + 1 newDistrb%blockLocalID (n) = procTmp(pid) + newDistrb%blockIndex(pid,procTmp(pid)) = n else newDistrb%blockLocalID (n) = 0 endif end do + newDistrb%blockCnt(:) = procTmp(:) newDistrb%numLocalBlocks = procTmp(my_task+1) if (minval(procTmp) < 1) then @@ -2146,6 +2164,12 @@ function create_distrb_spacecurve(nprocs,work_per_block) dist%blockLocation=0 dist%blockLocalID =0 + allocate (dist%blockCnt(nprocs)) + dist%blockCnt(:) = 0 + + allocate(dist%blockIndex(nprocs,max_blocks)) + dist%blockIndex(:,:) = 0 + !---------------------------------------------------------------------- ! Create the array to hold the SFC and indices into it !---------------------------------------------------------------------- @@ -2281,12 +2305,14 @@ function create_distrb_spacecurve(nprocs,work_per_block) if(pid>0) then proc_tmp(pid) = proc_tmp(pid) + 1 dist%blockLocalID(n) = proc_tmp(pid) + dist%blockIndex(pid,proc_tmp(pid)) = n else dist%blockLocalID(n) = 0 endif enddo dist%numLocalBlocks = proc_tmp(my_task+1) + dist%blockCnt(:) = proc_tmp(:) if (dist%numLocalBlocks > 0) then allocate (dist%blockGlobalID(dist%numLocalBlocks)) diff --git a/cicecore/shared/ice_domain_size.F90 b/cicecore/shared/ice_domain_size.F90 index 6f7a73aa1..56381b986 100644 --- a/cicecore/shared/ice_domain_size.F90 +++ b/cicecore/shared/ice_domain_size.F90 @@ -32,10 +32,11 @@ module ice_domain_size nfsd , & ! number of floe size categories nilyr , & ! number of ice layers per category nslyr , & ! number of snow layers per category - nblyr , & ! number of bio/brine layers per category + nblyr , & ! number of bio/brine layers per category + n_iso , & ! number of isotopes in use n_aero , & ! number of aerosols in use - n_zaero , & ! number of z aerosols in use - n_algae , & ! number of algae in use + n_zaero , & ! number of z aerosols in use + n_algae , & ! number of algae in use n_doc , & ! number of DOC pools in use n_dic , & ! number of DIC pools in use n_don , & ! number of DON pools in use diff --git a/cicecore/shared/ice_fileunits.F90 b/cicecore/shared/ice_fileunits.F90 index 00f7acaef..4c91fdb2a 100644 --- a/cicecore/shared/ice_fileunits.F90 +++ b/cicecore/shared/ice_fileunits.F90 @@ -54,6 +54,8 @@ module ice_fileunits nu_restart_pond,& ! restart input file for melt pond tracer nu_dump_fsd , & ! dump file for restarting floe size distribution nu_restart_fsd, & ! restart input file for floe size distribution + nu_dump_iso , & ! dump file for restarting isotope tracers + nu_restart_iso, & ! restart input file for isotope tracers nu_dump_aero , & ! dump file for restarting aerosol tracer nu_restart_aero,& ! restart input file for aerosol tracer nu_dump_bgc , & ! dump file for restarting bgc @@ -106,7 +108,7 @@ subroutine init_fileunits character(len=*),parameter :: subname='(init_fileunits)' - allocate(ice_IOUnitsInUse(ice_IOUnitsMaxUnit)) + if (.not.allocated(ice_IOUnitsInUse)) allocate(ice_IOUnitsInUse(ice_IOUnitsMaxUnit)) ice_IOUnitsInUse = .false. ice_IOUnitsInUse(ice_stdin) = .true. ! reserve unit 5 @@ -130,6 +132,8 @@ subroutine init_fileunits call get_fileunit(nu_restart_pond) call get_fileunit(nu_dump_fsd) call get_fileunit(nu_restart_fsd) + call get_fileunit(nu_dump_iso) + call get_fileunit(nu_restart_iso) call get_fileunit(nu_dump_aero) call get_fileunit(nu_restart_aero) call get_fileunit(nu_dump_bgc) @@ -217,6 +221,8 @@ subroutine release_all_fileunits call release_fileunit(nu_restart_pond) call release_fileunit(nu_dump_fsd) call release_fileunit(nu_restart_fsd) + call release_fileunit(nu_dump_iso) + call release_fileunit(nu_restart_iso) call release_fileunit(nu_dump_aero) call release_fileunit(nu_restart_aero) call release_fileunit(nu_dump_bgc) diff --git a/cicecore/shared/ice_init_column.F90 b/cicecore/shared/ice_init_column.F90 index 19deb0159..fbcc8413b 100644 --- a/cicecore/shared/ice_init_column.F90 +++ b/cicecore/shared/ice_init_column.F90 @@ -45,7 +45,7 @@ module ice_init_column init_age, init_FY, init_lvl, init_fsd, & init_meltponds_cesm, init_meltponds_lvl, init_meltponds_topo, & init_aerosol, init_bgc, init_hbrine, init_zbgc, input_zbgc, & - count_tracers + count_tracers, init_isotope ! namelist parameters needed locally @@ -671,6 +671,21 @@ end subroutine init_fsd !======================================================================= +! Initialize isotope tracers (call prior to reading restart data) + + subroutine init_isotope(isosno, isoice) + + real(kind=dbl_kind), dimension(:,:,:,:), intent(out) :: & + isosno, isoice + character(len=*),parameter :: subname='(init_isotope)' + + isosno(:,:,:,:) = c0 + isoice(:,:,:,:) = c0 + + end subroutine init_isotope + +!======================================================================= + ! Initialize ice aerosol tracer (call prior to reading restart data) subroutine init_aerosol(aero) @@ -1731,7 +1746,7 @@ end subroutine input_zbgc subroutine count_tracers - use ice_domain_size, only: nilyr, nslyr, nblyr, nfsd, & + use ice_domain_size, only: nilyr, nslyr, nblyr, nfsd, n_iso, & n_aero, n_zaero, n_algae, n_doc, n_dic, n_don, n_fed, n_fep ! local variables @@ -1743,10 +1758,10 @@ subroutine count_tracers integer (kind=int_kind) :: ntrcr logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_aero, tr_fsd - logical (kind=log_kind) :: tr_pond_cesm, tr_pond_lvl, tr_pond_topo + logical (kind=log_kind) :: tr_iso, tr_pond_cesm, tr_pond_lvl, tr_pond_topo integer (kind=int_kind) :: nt_Tsfc, nt_sice, nt_qice, nt_qsno, nt_iage, nt_FY integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, nt_aero - integer (kind=int_kind) :: nt_fsd + integer (kind=int_kind) :: nt_fsd, nt_isosno, nt_isoice integer (kind=int_kind) :: & nbtrcr, nbtrcr_sw, & @@ -1829,6 +1844,7 @@ subroutine count_tracers tr_lvl_out=tr_lvl, tr_aero_out=tr_aero, tr_pond_out=tr_pond, & tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, & tr_pond_topo_out=tr_pond_topo, tr_brine_out=tr_brine, tr_fsd_out=tr_fsd, & + tr_iso_out=tr_iso, & tr_bgc_Nit_out=tr_bgc_Nit, tr_bgc_Am_out =tr_bgc_Am, tr_bgc_Sil_out=tr_bgc_Sil, & tr_bgc_DMS_out=tr_bgc_DMS, tr_bgc_PON_out=tr_bgc_PON, & tr_bgc_N_out =tr_bgc_N, tr_bgc_C_out =tr_bgc_C, tr_bgc_chl_out=tr_bgc_chl, & @@ -1897,13 +1913,22 @@ subroutine count_tracers ntrcr = ntrcr + nfsd endif + nt_isosno = 0 + nt_isoice = 0 + if (tr_iso) then + nt_isosno = ntrcr + 1 ! isotopes in snow + ntrcr = ntrcr + n_iso + nt_isoice = ntrcr + 1 ! isotopes in ice + ntrcr = ntrcr + n_iso + endif + nt_aero = 0 if (tr_aero) then nt_aero = ntrcr + 1 ntrcr = ntrcr + 4*n_aero ! 4 dEdd layers, n_aero species else !tcx, modify code so we don't have to reset n_aero here - n_aero = 0 + n_aero = 0 !echmod - this is not getting set correctly (overwritten later?) endif !----------------------------------------------------------------- @@ -2178,6 +2203,8 @@ subroutine count_tracers if (nt_hpnd <= 0) nt_hpnd = ntrcr if (nt_ipnd <= 0) nt_ipnd = ntrcr if (nt_fsd <= 0) nt_fsd = ntrcr + if (nt_isosno<= 0) nt_isosno= ntrcr + if (nt_isoice<= 0) nt_isoice= ntrcr if (nt_aero <= 0) nt_aero = ntrcr if (nt_fbri <= 0) nt_fbri = ntrcr if (nt_bgc_S <= 0) nt_bgc_S = ntrcr @@ -2201,7 +2228,7 @@ subroutine count_tracers nt_qice_in=nt_qice, nt_qsno_in=nt_qsno, nt_iage_in=nt_iage, nt_fy_in=nt_fy, & nt_alvl_in=nt_alvl, nt_vlvl_in=nt_vlvl, nt_apnd_in=nt_apnd, nt_hpnd_in=nt_hpnd, & nt_ipnd_in=nt_ipnd, nt_fsd_in=nt_fsd, nt_aero_in=nt_aero, & - nt_fbri_in=nt_fbri, & + nt_isosno_in=nt_isosno, nt_isoice_in=nt_isoice, nt_fbri_in=nt_fbri, & nt_bgc_Nit_in=nt_bgc_Nit, nt_bgc_Am_in=nt_bgc_Am, nt_bgc_Sil_in=nt_bgc_Sil, & nt_bgc_DMS_in=nt_bgc_DMS, nt_bgc_PON_in=nt_bgc_PON, nt_bgc_S_in=nt_bgc_S, & nt_bgc_N_in=nt_bgc_N, nt_bgc_chl_in=nt_bgc_chl, & diff --git a/cicecore/shared/ice_restart_column.F90 b/cicecore/shared/ice_restart_column.F90 index 34055a751..e830dd50b 100644 --- a/cicecore/shared/ice_restart_column.F90 +++ b/cicecore/shared/ice_restart_column.F90 @@ -33,6 +33,7 @@ module ice_restart_column write_restart_pond_lvl, read_restart_pond_lvl, & write_restart_pond_topo, read_restart_pond_topo, & write_restart_fsd, read_restart_fsd, & + write_restart_iso, read_restart_iso, & write_restart_aero, read_restart_aero, & write_restart_bgc, read_restart_bgc, & write_restart_hbrine, read_restart_hbrine @@ -45,6 +46,7 @@ module ice_restart_column restart_pond_lvl , & ! if .true., read meltponds restart file restart_pond_topo, & ! if .true., read meltponds restart file restart_fsd , & ! if .true., read floe size restart file + restart_iso , & ! if .true., read isotope tracer restart file restart_aero , & ! if .true., read aerosol tracer restart file restart_zsal , & ! if .true., read Salinity from restart file restart_hbrine , & ! if .true., read hbrine from restart file @@ -551,6 +553,89 @@ end subroutine read_restart_fsd !======================================================================= +! Dumps all values needed for restarting +! author Elizabeth C. Hunke, LANL + + subroutine write_restart_iso() + + use ice_domain_size, only: n_iso + use ice_fileunits, only: nu_dump_iso + use ice_state, only: trcrn + + ! local variables + + logical (kind=log_kind) :: diag + integer (kind=int_kind) :: nt_isosno, nt_isoice, k + character*3 ck + character(len=*),parameter :: subname='(write_restart_iso)' + + call icepack_query_tracer_indices(nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + diag = .true. + + !----------------------------------------------------------------- + + do k = 1, n_iso + write(ck,'(i3.3)') k + call write_restart_field(nu_dump_iso,0, trcrn(:,:,nt_isosno+k-1,:,:), & + 'ruf8','isosno'//trim(ck),ncat,diag) + enddo + + do k = 1, n_iso + write(ck,'(i3.3)') k + call write_restart_field(nu_dump_iso,0, trcrn(:,:,nt_isoice+k-1,:,:), & + 'ruf8','isoice'//trim(ck),ncat,diag) + enddo + + end subroutine write_restart_iso + +!======================================================================= + +! Reads all values needed to restart isotope tracers +! author Elizabeth C. Hunke, LANL + + subroutine read_restart_iso() + + use ice_domain_size, only: n_iso + use ice_fileunits, only: nu_restart_iso + use ice_state, only: trcrn + + ! local variables + + logical (kind=log_kind) :: & + diag + integer (kind=int_kind) :: nt_isosno, nt_isoice, k + character*3 ck + character(len=*),parameter :: subname='(read_restart_iso)' + + call icepack_query_tracer_indices(nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + diag = .true. + + do k = 1, n_iso + write(ck,'(i3.3)') k + call read_restart_field(nu_restart_iso,0,trcrn(:,:,nt_isosno+k-1,:,:), & + 'ruf8','isosno'//trim(ck),ncat,diag, & + field_type=field_type_scalar,field_loc=field_loc_center) + enddo + + do k = 1, n_iso + write(ck,'(i3.3)') k + call read_restart_field(nu_restart_iso,0,trcrn(:,:,nt_isoice+k-1,:,:), & + 'ruf8','isoice'//trim(ck),ncat,diag, & + field_type=field_type_scalar,field_loc=field_loc_center) + enddo + + end subroutine read_restart_iso + +!======================================================================= + ! Dumps all values needed for restarting ! ! authors Elizabeth Hunke, LANL (original version) diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..e7f6a6e2f --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +coverage: + range: "20...100" + round: down + precision: 2 + +comment: false diff --git a/configuration/scripts/cice.batch.csh b/configuration/scripts/cice.batch.csh index 0450d2647..e8ec14cab 100755 --- a/configuration/scripts/cice.batch.csh +++ b/configuration/scripts/cice.batch.csh @@ -119,7 +119,7 @@ else if (${ICE_MACHINE} =~ cori*) then @ nthrds2 = ${nthrds} * 2 cat >> ${jobfile} << EOFB #SBATCH -J ${ICE_CASENAME} -###SBATCH -A ${acct} +#SBATCH -A ${acct} #SBATCH --qos ${queue} #SBATCH --time ${batchtime} #SBATCH --nodes ${nnodes} diff --git a/configuration/scripts/cice.build b/configuration/scripts/cice.build index 61d639e09..2534bfa7e 100755 --- a/configuration/scripts/cice.build +++ b/configuration/scripts/cice.build @@ -1,7 +1,7 @@ #! /bin/csh -f #==================================== -# If the cice binary is passed as an argument and the file exists, +# If the cice binary is passed via the --exe argument and the file exists, # copy it into the run directory and don't build the model. set dohelp = 0 diff --git a/configuration/scripts/cice.settings b/configuration/scripts/cice.settings index 8bb860916..7d9bce65c 100755 --- a/configuration/scripts/cice.settings +++ b/configuration/scripts/cice.settings @@ -40,4 +40,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 diff --git a/configuration/scripts/cice.test.setup.csh b/configuration/scripts/cice.test.setup.csh index 16fd84a69..535a2ac06 100755 --- a/configuration/scripts/cice.test.setup.csh +++ b/configuration/scripts/cice.test.setup.csh @@ -40,6 +40,13 @@ if ( ! -f ${ICE_RUNDIR}/cice ) then exit 99 endif +# Initial test results and Reset test results for rerun +mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev +echo "#---" >! ${ICE_CASEDIR}/test_output +cat ${ICE_CASEDIR}/test_output.prev | grep -i "${ICE_TESTNAME} build" >> ${ICE_CASEDIR}/test_output +echo "PEND ${ICE_TESTNAME} run" >> ${ICE_CASEDIR}/test_output +rm -f ${ICE_CASEDIR}/test_output.prev + EOF2 if ( -f ${ICE_SCRIPTS}/tests/test_${ICE_TEST}.script) then diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index 406e8ec91..dcfedf772 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -63,6 +63,7 @@ / &tracer_nml + n_iso = 0 n_aero = 1 n_zaero = 0 n_algae = 0 @@ -83,6 +84,8 @@ restart_pond_topo = .false. tr_pond_lvl = .true. restart_pond_lvl = .false. + tr_iso = .false. + restart_iso = .false. tr_aero = .false. restart_aero = .false. tr_fsd = .false. @@ -93,6 +96,7 @@ kitd = 1 ktherm = 2 conduct = 'bubbly' + ksno = 0.3d0 a_rapid_mode = 0.5e-3 Rac_rapid_mode = 10.0 aspect_rapid_mode = 1.0 @@ -529,9 +533,12 @@ / &icefields_bgc_nml + f_fiso_atm = 'x' + f_fiso_ocn = 'x' + f_iso = 'x' f_faero_atm = 'x' f_faero_ocn = 'x' - f_aero = 'x' + f_aero = 'x' f_fbio = 'm' f_fbio_ai = 'm' f_zaero = 'x' diff --git a/configuration/scripts/machines/Macros.gaffney_gnu b/configuration/scripts/machines/Macros.gaffney_gnu index b2f178247..0d13560de 100644 --- a/configuration/scripts/machines/Macros.gaffney_gnu +++ b/configuration/scripts/machines/Macros.gaffney_gnu @@ -4,7 +4,7 @@ CPP := ftn -E CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} -CFLAGS := -c -O2 +CFLAGS := -c FIXEDFLAGS := -ffixed-line-length-132 FREEFLAGS := -ffree-form @@ -12,9 +12,21 @@ FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) - FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow -else - FFLAGS += -O2 + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow + CFLAGS += -O0 +endif + +ifeq ($(ICE_CODECOV), 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) + FFLAGS += -O2 + CFLAGS += -O2 +endif endif SCC := gcc diff --git a/configuration/scripts/machines/Macros.gordon_gnu b/configuration/scripts/machines/Macros.gordon_gnu index 131f539c1..2e80f7364 100644 --- a/configuration/scripts/machines/Macros.gordon_gnu +++ b/configuration/scripts/machines/Macros.gordon_gnu @@ -4,7 +4,7 @@ CPP := ftn -E CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} -CFLAGS := -c -O2 +CFLAGS := -c FIXEDFLAGS := -ffixed-line-length-132 FREEFLAGS := -ffree-form @@ -12,9 +12,21 @@ FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) - FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow -else - FFLAGS += -O2 + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow + CFLAGS += -O0 +endif + +ifeq ($(ICE_CODECOV), 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) + FFLAGS += -O2 + CFLAGS += -O2 +endif endif SCC := cc diff --git a/configuration/scripts/machines/Macros.izumi_gnu b/configuration/scripts/machines/Macros.izumi_gnu index 6526ac767..cdc6620f4 100644 --- a/configuration/scripts/machines/Macros.izumi_gnu +++ b/configuration/scripts/machines/Macros.izumi_gnu @@ -4,7 +4,7 @@ CPP := /usr/bin/cpp CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} -CFLAGS := -c -O2 +CFLAGS := -c FIXEDFLAGS := -ffixed-line-length-132 FREEFLAGS := -ffree-form @@ -13,8 +13,20 @@ FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow -else + CFLAGS += -O0 +endif + +ifeq ($(ICE_CODECOV), 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) FFLAGS += -O2 + CFLAGS += -O2 +endif endif SCC := gcc diff --git a/configuration/scripts/machines/Macros.onyx_gnu b/configuration/scripts/machines/Macros.onyx_gnu index 14784e625..d423cd9ab 100644 --- a/configuration/scripts/machines/Macros.onyx_gnu +++ b/configuration/scripts/machines/Macros.onyx_gnu @@ -4,7 +4,7 @@ CPP := ftn -E CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} -CFLAGS := -c -O2 +CFLAGS := -c FIXEDFLAGS := -ffixed-line-length-132 FREEFLAGS := -ffree-form @@ -12,9 +12,21 @@ FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) - FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow -else - FFLAGS += -O2 + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow + CFLAGS += -O0 +endif + +ifeq ($(ICE_CODECOV), 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) + FFLAGS += -O2 + CFLAGS += -O2 +endif endif SCC := cc diff --git a/configuration/scripts/machines/Macros.travisCI_gnu b/configuration/scripts/machines/Macros.travisCI_gnu index 66fb30a07..aa7b12c05 100644 --- a/configuration/scripts/machines/Macros.travisCI_gnu +++ b/configuration/scripts/machines/Macros.travisCI_gnu @@ -4,7 +4,7 @@ CPP := cpp CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} -CFLAGS := -c -O2 +CFLAGS := -c FIXEDFLAGS := -ffixed-line-length-132 FREEFLAGS := -ffree-form @@ -12,9 +12,21 @@ FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) - FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow -else - FFLAGS += -O2 + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow + CFLAGS += -O0 +endif + +ifeq ($(ICE_CODECOV), 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) + FFLAGS += -O2 + CFLAGS += -O2 +endif endif SCC := gcc diff --git a/configuration/scripts/machines/env.badger_intel b/configuration/scripts/machines/env.badger_intel index 3e7bb4f8c..8fe69148b 100755 --- a/configuration/scripts/machines/env.badger_intel +++ b/configuration/scripts/machines/env.badger_intel @@ -37,7 +37,8 @@ setenv ICE_MACHINE_WKDIR /net/scratch3/$user/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /usr/projects/climate/eclare/DATA/Consortium setenv ICE_MACHINE_BASELINE /net/scratch3/$user/CICE_BASELINE setenv ICE_MACHINE_SUBMIT "sbatch " -setenv ICE_MACHINE_ACCT e3sm +#setenv ICE_MACHINE_ACCT e3sm +setenv ICE_MACHINE_ACCT climatehilat setenv ICE_MACHINE_QUEUE "default" setenv ICE_MACHINE_TPNODE 16 setenv ICE_MACHINE_BLDTHRDS 1 diff --git a/configuration/scripts/options/set_nml.isotope b/configuration/scripts/options/set_nml.isotope new file mode 100644 index 000000000..b3042ee5f --- /dev/null +++ b/configuration/scripts/options/set_nml.isotope @@ -0,0 +1,2 @@ +n_iso = 3 +tr_iso = .true. diff --git a/configuration/scripts/tests/base_suite.ts b/configuration/scripts/tests/base_suite.ts index 4b0d35e5a..fad8b22f3 100755 --- a/configuration/scripts/tests/base_suite.ts +++ b/configuration/scripts/tests/base_suite.ts @@ -45,3 +45,6 @@ smoke gx3 4x2 fsd1,diag24,run5day,debug smoke gx3 8x2 fsd12,diag24,run5day,short restart gx3 4x2 fsd12,debug,short smoke gx3 8x2 fsd12ww3,diag24,run1day,medium +smoke gx3 4x1 isotope,debug +restart gx3 8x2 isotope + diff --git a/configuration/scripts/tests/nothread_suite.ts b/configuration/scripts/tests/nothread_suite.ts index 5db402d34..49f834a98 100644 --- a/configuration/scripts/tests/nothread_suite.ts +++ b/configuration/scripts/tests/nothread_suite.ts @@ -26,6 +26,12 @@ restart gx3 20x1 alt02,debug,short restart gx3 24x1 alt03,debug,short smoke gx3 24x1 alt04,debug,short smoke gx3 32x1 alt05,debug,short +restart gx3 16x1 isotope +smoke gx3 6x1 isotope,debug +smoke gx3 8x1 fsd1,diag24,run5day,debug +smoke gx3 16x1 fsd12,diag24,run5day,short +restart gx3 12x1 fsd12,debug,short +smoke gx3 20x1 fsd12ww3,diag24,run1day,medium restart gbox128 8x1 short restart gbox128 16x1 boxdyn,short @@ -37,6 +43,12 @@ smoke gbox128 24x1 boxrestore,short,debug restart gbox80 1x1 box2001 smoke gbox80 1x1 boxslotcyl +smoke gx3 16x1 jra55_gx3_2008,medium,run90day +restart gx3 12x1 jra55_gx3,short +#tcraig, hangs nodes intermittently on izumi +#smoke gx1 24x1 jra55_gx1_2008,medium,run90day +#restart gx1 24x1 jra55_gx1,short + smoke gx3 16x1 bgcz smoke gx3 16x1 bgcz,debug smoke gx3 24x1 bgcskl,debug diff --git a/configuration/scripts/tests/report_results.csh b/configuration/scripts/tests/report_results.csh index 711dc3e3d..4a64deff8 100755 --- a/configuration/scripts/tests/report_results.csh +++ b/configuration/scripts/tests/report_results.csh @@ -1,5 +1,19 @@ #!/bin/csh -f +if ($#argv == 0) then + echo "${0}: Running results.csh" + ./results.csh >& /dev/null +else if ($#argv == 1) then + if ("$argv[1]" =~ "-n") then + #continue + else + echo "$0 usage:" + echo "$0 [-n]" + echo " -n : do NOT run results.csh (by default it does)" + exit -1 + endif +endif + if (! -e results.log) then echo " " echo "${0}: ERROR results.log does not exist, try running results.csh" @@ -25,6 +39,7 @@ set hash = `grep "#hash = " results.log | cut -c 9-` set shhash = `grep "#hshs = " results.log | cut -c 9-` set hashuser = `grep "#hshu = " results.log | cut -c 9-` set hashdate = `grep "#hshd = " results.log | cut -c 9-` +set testsuites = `grep "#suit = " results.log | cut -c 9-` set cdat = `grep "#date = " results.log | cut -c 9-` set ctim = `grep "#time = " results.log | cut -c 9-` set user = `grep "#user = " results.log | cut -c 9-` @@ -42,6 +57,7 @@ set compilers = `grep -v "#" results.log | grep ${mach}_ | cut -d "_" -f 2 | sor #echo "debug ${shhash}" #echo "debug ${hashuser}" #echo "debug ${hashdate}" +#echo "debug ${testsuites}" #echo "debug ${cdat}" #echo "debug ${ctim}" #echo "debug ${user}" @@ -79,12 +95,21 @@ unset noglob foreach compiler ( ${compilers} ) - set ofile = "${shhash}.${mach}.${compiler}.${xcdat}.${xctim}" - set outfile = "${wikiname}/${tsubdir}/${ofile}.md" + set cnt = 0 + set found = 1 + while ($found == 1) + set ofile = "${shhash}.${mach}.${compiler}.${xcdat}.${xctim}.$cnt" + set outfile = "${wikiname}/${tsubdir}/${ofile}.md" + if (-e ${outfile}) then + @ cnt = $cnt + 1 + else + set found = 0 + endif + end + mkdir -p ${wikiname}/${tsubdir} echo "${0}: writing to ${outfile}" - if (-e ${outfile}) rm -f ${outfile} cat >! ${outfile} << EOF @@ -103,7 +128,7 @@ EOF foreach case ( ${cases} ) if ( ${case} =~ *_${compiler}_* ) then -# check thata case results are meaningful +# check that case results are meaningful set fbuild = `grep " ${case} " results.log | grep " build" | cut -c 1-4` set frun = `grep " ${case} " results.log | grep " run" | cut -c 1-4` set ftest = `grep " ${case} " results.log | grep " test" | cut -c 1-4` diff --git a/configuration/scripts/tests/test_logbfb.script b/configuration/scripts/tests/test_logbfb.script index fbce5d918..d8e594e81 100644 --- a/configuration/scripts/tests/test_logbfb.script +++ b/configuration/scripts/tests/test_logbfb.script @@ -4,11 +4,6 @@ # This is identical to a smoke test, but triggers bfbcompare with log files instead of restarts # cice.run returns -1 if run did not complete successfully -mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev -cat ${ICE_CASEDIR}/test_output.prev | grep -iv "${ICE_TESTNAME} run" >! ${ICE_CASEDIR}/test_output -rm -f ${ICE_CASEDIR}/test_output.prev -echo "RUN ${ICE_TESTNAME} run " >> ${ICE_CASEDIR}/test_output - ./cice.run set res="$status" diff --git a/configuration/scripts/tests/test_restart.script b/configuration/scripts/tests/test_restart.script index 20953b1e1..59729b361 100644 --- a/configuration/scripts/tests/test_restart.script +++ b/configuration/scripts/tests/test_restart.script @@ -7,14 +7,6 @@ cp ice_in ice_in.0 ${ICE_CASEDIR}/casescripts/parse_namelist.sh ice_in ${ICE_CASEDIR}/casescripts/test_nml.restart1 cp ice_in ice_in.1 -mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev -cat ${ICE_CASEDIR}/test_output.prev | grep -iv "${ICE_TESTNAME} run" >! ${ICE_CASEDIR}/test_output -mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev -cat ${ICE_CASEDIR}/test_output.prev | grep -iv "${ICE_TESTNAME} test" >! ${ICE_CASEDIR}/test_output -rm -f ${ICE_CASEDIR}/test_output.prev -echo "RUN ${ICE_TESTNAME} run " >> ${ICE_CASEDIR}/test_output -echo "PEND ${ICE_TESTNAME} test " >> ${ICE_CASEDIR}/test_output - ./cice.run set res="$status" @@ -27,8 +19,6 @@ if ( $res != 0 ) then echo "FAIL ${ICE_TESTNAME} run" >> ${ICE_CASEDIR}/test_output echo "FAIL ${ICE_TESTNAME} test " >> ${ICE_CASEDIR}/test_output exit 99 -else - echo "PASS ${ICE_TESTNAME} initialrun" >> ${ICE_CASEDIR}/test_output endif # Prepend 'base_' to the final restart file to save for comparison diff --git a/configuration/scripts/tests/test_smoke.script b/configuration/scripts/tests/test_smoke.script index 42a963b47..f39f7cb4a 100644 --- a/configuration/scripts/tests/test_smoke.script +++ b/configuration/scripts/tests/test_smoke.script @@ -3,11 +3,6 @@ # Run the CICE model # cice.run returns -1 if run did not complete successfully -mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev -cat ${ICE_CASEDIR}/test_output.prev | grep -iv "${ICE_TESTNAME} run" >! ${ICE_CASEDIR}/test_output -rm -f ${ICE_CASEDIR}/test_output.prev -echo "RUN ${ICE_TESTNAME} run " >> ${ICE_CASEDIR}/test_output - ./cice.run set res="$status" diff --git a/doc/source/developer_guide/dg_other.rst b/doc/source/developer_guide/dg_other.rst index 2a46186bd..7853cb66b 100644 --- a/doc/source/developer_guide/dg_other.rst +++ b/doc/source/developer_guide/dg_other.rst @@ -132,8 +132,8 @@ tracer. A number of optional tracers are available in the code, including ice age, first-year ice area, melt pond area and volume, brine height, -aerosols, and level ice area and volume (from which ridged ice -quantities are derived). Salinity, enthalpies, age, aerosols, level-ice +aerosols, water isotopes, and level ice area and volume (from which ridged ice +quantities are derived). Salinity, enthalpies, age, aerosols, isotopes, level-ice volume, brine height and most melt pond quantities are volume-weighted tracers, while first-year area, pond area, and level-ice area are area-weighted tracers. Biogeochemistry tracers in the skeletal layer are area-weighted, diff --git a/doc/source/science_guide/sg_tracers.rst b/doc/source/science_guide/sg_tracers.rst index bc55a47f9..bbd18eb1f 100644 --- a/doc/source/science_guide/sg_tracers.rst +++ b/doc/source/science_guide/sg_tracers.rst @@ -87,6 +87,7 @@ is not in use. " ", " ", "apnd", "nt_vpnd", " " " ", " ", "apnd", "nt_ipnd", " " "tr_aero", "n_aero", "vice, vsno", "nt_aero"," " + "tr_iso", "n_iso", "vice, vsno", "nt_iso"," " "tr_brine", " ", "vice", "nt_fbri", " " "tr_fsd","nfsd","aice","nt_fsd"," " "solve_zsal", "n_trzs", "fbri or (a,v)ice", "nt_bgc_S", " " @@ -114,5 +115,4 @@ Users may add any number of additional tracers that are transported conservative provided that the dependency ``trcr_depend`` is defined appropriately. See Section :ref:`addtrcr` for guidance on adding tracers. -Please see the `Icepack documentation `_ for additional information about tracers that depend on other tracers, the floe size distribution, age of the ice, aerosols, -brine height, and the sea ice ecosystem. +Please see the `Icepack documentation `_ for additional information about tracers that depend on other tracers, the floe size distribution, age of the ice, aerosols, water isotopes, brine height, and the sea ice ecosystem. diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst index 411b22fb8..b3088963d 100755 --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -206,6 +206,7 @@ Table of namelist options "","*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" @@ -227,6 +228,8 @@ Table of namelist options "","``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", "" "","", "", "", "" @@ -240,6 +243,7 @@ Table of namelist options "","", "``-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" diff --git a/doc/source/user_guide/ug_testing.rst b/doc/source/user_guide/ug_testing.rst index 48679577c..52621d612 100644 --- a/doc/source/user_guide/ug_testing.rst +++ b/doc/source/user_guide/ug_testing.rst @@ -380,6 +380,9 @@ 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. + ``--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``. @@ -645,7 +648,11 @@ To post results, once a test suite is complete, run ``results.csh`` and ./results.csh ./report_results.csh -The reporting can also be automated by adding ``--report`` to ``cice.setup`` +``report_results.csh`` will run ``results.csh`` by default automatically, but +we recommmend running it manually first to verify results before publishing +them. ``report_results.csh -n`` will turn off automatic running of ``results.csh``. + +The reporting can also be automated in a test suite by adding ``--report`` to ``cice.setup`` :: ./cice.setup --suite base_suite --mach conrad --env cray --testid v01a --report @@ -653,6 +660,55 @@ The reporting can also be automated by adding ``--report`` to ``cice.setup`` With ``--report``, the suite will create all the tests, build and submit them, wait for all runs to be complete, and run the results and report_results scripts. +.. _codecoverage: + +Code Coverage Testing +------------------------------ + +The ``--codecov`` 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. +This option is currently only available with the gnu compiler and on a few systems. + +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 code coverage tool can +be run on that repository. A sample script to do that would be:: + + git clone https://github.com/cice-consortium/cice cice.master --recursive + + git clone https://github.com/apcraig/test_cice_icepack + cd test_cice_icepack + git rm -r * + cp -p -r ../cice.master/* . + git add . + git commit -m "update to current cice master" + git push origin master + + ./cice.setup --suite first_suite,base_suite,travis_suite,decomp_suite,reprosum_suite,quick_suite -m gordon -e gnu --codecov --testid cc01 + +To use, submit a full test suite using an updated Test_CICE_Icepack version +and 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. + +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: diff --git a/icepack b/icepack index edb8c3459..1ae044604 160000 --- a/icepack +++ b/icepack @@ -1 +1 @@ -Subproject commit edb8c3459359f22af20d39d7defe97c4a8b2a419 +Subproject commit 1ae044604498b8d268df6c577556d22d2baa7758