diff --git a/.gitignore b/.gitignore index f32b5b0ea..2a2a5fdb6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ doc/build # Ignore macOS cache files .DS_Store + # Ignore testsuite file/directories testsuite* caselist* diff --git a/cice.setup b/cice.setup index d70aece61..9038b5b93 100755 --- a/cice.setup +++ b/cice.setup @@ -504,11 +504,18 @@ 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}" +# define CODECOV_TOKEN env variable +if !(\$?CODECOV_TOKEN) then + if (-e ~/.codecov_cice_token) then + source ~/.codecov_cice_token + endif + if !(\$?CODECOV_TOKEN) then + echo "\${0}: ERROR, CODECOV_TOKEN env variable not defined" + exit 2 + endif +endif +set report_name = "${shhash}:${branch}:${machine} ${testsuite}" set use_curl = 1 EOF0 @@ -871,13 +878,8 @@ setenv ICE_COMPILER ${compiler} setenv ICE_MACHCOMP ${machcomp} 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 setenv ICE_NTASKS ${task} setenv ICE_NTHRDS ${thrd} -#setenv ICE_MXBLCKS ${ICE_DECOMP_MXBLCKS} # moved to namelist -#setenv ICE_BLCKX ${ICE_DECOMP_BLCKX} # moved to namelist -#setenv ICE_BLCKY ${ICE_DECOMP_BLCKY} # moved to namelist setenv ICE_BASELINE ${basedir_tmp} setenv ICE_BASEGEN ${baseGen} setenv ICE_BASECOM ${baseCom} diff --git a/cicecore/cicedynB/analysis/ice_history.F90 b/cicecore/cicedynB/analysis/ice_history.F90 index 21fea93fe..660676a64 100644 --- a/cicecore/cicedynB/analysis/ice_history.F90 +++ b/cicecore/cicedynB/analysis/ice_history.F90 @@ -30,10 +30,11 @@ module ice_history use ice_kinds_mod + use ice_communicate, only: my_task, master_task use ice_constants, only: c0, c1, c2, c100, c360, c180, & p001, p25, p5, mps_to_cmpdy, kg_to_g, spval use ice_fileunits, only: nu_nml, nml_filename, nu_diag, & - get_fileunit, release_fileunit + get_fileunit, release_fileunit, flush_fileunit use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_snow_temperature, icepack_ice_temperature @@ -62,7 +63,6 @@ subroutine init_hist (dt) use ice_blocks, only: nx_block, ny_block use ice_broadcast, only: broadcast_scalar, broadcast_array - use ice_communicate, only: my_task, master_task use ice_calendar, only: yday, days_per_year, histfreq, & histfreq_n, nstreams use ice_domain_size, only: max_blocks, max_nstrm, nilyr, nslyr, nblyr, ncat, nfsd @@ -1570,10 +1570,6 @@ subroutine init_hist (dt) if (allocated(Tsnz4d)) deallocate(Tsnz4d) allocate(Tsnz4d(nx_block,ny_block,nzslyr,ncat_hist)) endif - if (f_Sinz (1:1) /= 'x') then - if (allocated(Sinz4d)) deallocate(Sinz4d) - allocate(Sinz4d(nx_block,ny_block,nzilyr,ncat_hist)) - endif !----------------------------------------------------------------- ! 4D (floe size, thickness categories) variables looped separately @@ -1616,6 +1612,8 @@ subroutine init_hist (dt) ntmp(:) = 0 if (my_task == master_task) then write(nu_diag,*) ' ' + write(nu_diag,*) 'total number of history fields = ',num_avail_hist_fields_tot + write(nu_diag,*) 'max number of history fields = ',max_avail_hist_fields write(nu_diag,*) 'The following variables will be ', & 'written to the history tape: ' write(nu_diag,101) 'description','units','variable','frequency','x' @@ -1687,7 +1685,7 @@ subroutine init_hist (dt) if (allocated(a3Df)) a3Df(:,:,:,:,:) = c0 if (allocated(a4Di)) a4Di(:,:,:,:,:,:) = c0 if (allocated(a4Ds)) a4Ds(:,:,:,:,:,:) = c0 - if (allocated(a4Ds)) a4Df(:,:,:,:,:,:) = c0 + if (allocated(a4Df)) a4Df(:,:,:,:,:,:) = c0 avgct(:) = c0 albcnt(:,:,:,:) = c0 @@ -2970,7 +2968,7 @@ subroutine accum_hist (dt) enddo enddo enddo - call accum_hist_field(n_Tinz-n3Dacum, iblk, nzilyr, ncat_hist, & + call accum_hist_field(n_Tinz-n3Dfcum, iblk, nzilyr, ncat_hist, & Tinz4d(:,:,1:nzilyr,1:ncat_hist), a4Di) endif if (f_Sinz (1:1) /= 'x') then @@ -2984,7 +2982,7 @@ subroutine accum_hist (dt) enddo enddo enddo - call accum_hist_field(n_Sinz-n3Dacum, iblk, nzilyr, ncat_hist, & + call accum_hist_field(n_Sinz-n3Dfcum, iblk, nzilyr, ncat_hist, & Sinz4d(:,:,1:nzilyr,1:ncat_hist), a4Di) endif @@ -3796,7 +3794,7 @@ subroutine accum_hist (dt) enddo ! n do n = 1, num_avail_hist_fields_4Di - nn = n3Dacum + n + nn = n3Dfcum + n if (avail_hist_fields(nn)%vhistfreq == histfreq(ns)) then do k = 1, nzilyr do ic = 1, ncat_hist @@ -4025,7 +4023,7 @@ subroutine accum_hist (dt) if (avail_hist_fields(n)%vhistfreq == histfreq(ns)) a3Df(:,:,:,nn,:) = c0 enddo do n = n3Dfcum + 1, n4Dicum - nn = n - n3Dacum + nn = n - n3Dfcum if (avail_hist_fields(n)%vhistfreq == histfreq(ns)) a4Di(:,:,:,:,nn,:) = c0 enddo do n = n4Dicum + 1, n4Dscum diff --git a/cicecore/cicedynB/analysis/ice_history_fsd.F90 b/cicecore/cicedynB/analysis/ice_history_fsd.F90 index 7b5a1470d..43afc1e27 100644 --- a/cicecore/cicedynB/analysis/ice_history_fsd.F90 +++ b/cicecore/cicedynB/analysis/ice_history_fsd.F90 @@ -116,24 +116,6 @@ subroutine init_hist_fsd_2D call abort_ice(subname//'ERROR: reading icefields_fsd_nml') endif - if (.not. tr_fsd) then - f_afsd = 'x' - f_afsdn = 'x' - f_dafsd_newi = 'x' - f_dafsd_latg = 'x' - f_dafsd_latm = 'x' - f_dafsd_wave = 'x' - f_dafsd_weld = 'x' - f_wave_sig_ht = 'x' - f_fsdrad = 'x' - f_fsdperim = 'x' - endif - if ((.not. tr_fsd) .or. (.not. wave_spec)) then - f_aice_ww = 'x' - f_diam_ww = 'x' - f_hice_ww = 'x' - endif - call broadcast_scalar (f_afsd, master_task) call broadcast_scalar (f_afsdn, master_task) call broadcast_scalar (f_dafsd_newi, master_task) @@ -184,6 +166,24 @@ subroutine init_hist_fsd_2D enddo ! nstreams + else ! tr_fsd + + f_afsd = 'x' + f_afsdn = 'x' + f_dafsd_newi = 'x' + f_dafsd_latg = 'x' + f_dafsd_latm = 'x' + f_dafsd_wave = 'x' + f_dafsd_weld = 'x' + f_wave_sig_ht = 'x' + f_fsdrad = 'x' + f_fsdperim = 'x' + if (.not. wave_spec) then + f_aice_ww = 'x' + f_diam_ww = 'x' + f_hice_ww = 'x' + endif + endif ! tr_fsd end subroutine init_hist_fsd_2D @@ -428,11 +428,6 @@ subroutine accum_hist_fsd (iblk) call accum_hist_field(n_fsdperim, iblk, worka, a2D) endif - - - - - endif ! a2D allocated ! 3D category fields @@ -474,19 +469,20 @@ subroutine accum_hist_fsd (iblk) if (allocated(a4Df)) then if (f_afsdn(1:1) /= 'x') then + do n = 1, ncat_hist + do k = 1, nfsd_hist do j = 1, ny_block do i = 1, nx_block - do n = 1, ncat_hist - do k = 1, nfsd_hist - workd(i,j,k,n) = trcrn(i,j,nt_fsd+k-1,n,iblk) & - * aicen_init(i,j,n,iblk)/floe_binwidth(k) - end do - end do + workd(i,j,k,n) = trcrn(i,j,nt_fsd+k-1,n,iblk) & + * aicen_init(i,j,n,iblk)/floe_binwidth(k) + end do end do end do - call accum_hist_field(n_afsdn-n4Dscum, iblk, & - nfsd_hist, ncat_hist, workd, a4Df) + end do + call accum_hist_field(n_afsdn-n4Dscum, iblk, nfsd_hist, ncat_hist, & + workd(:,:,1:nfsd_hist,1:ncat_hist), a4Df) endif + endif ! a4Df allocated endif ! tr_fsd diff --git a/cicecore/cicedynB/analysis/ice_history_shared.F90 b/cicecore/cicedynB/analysis/ice_history_shared.F90 index 60740aea1..b5f2226fa 100644 --- a/cicecore/cicedynB/analysis/ice_history_shared.F90 +++ b/cicecore/cicedynB/analysis/ice_history_shared.F90 @@ -24,8 +24,10 @@ module ice_history_shared use ice_kinds_mod + use ice_communicate, only: my_task, master_task use ice_domain_size, only: max_nstrm use ice_exit, only: abort_ice + use ice_fileunits, only: nu_diag use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted implicit none @@ -33,6 +35,8 @@ module ice_history_shared private public :: define_hist_field, accum_hist_field, icefields_nml, construct_filename + integer (kind=int_kind), public :: history_precision + logical (kind=log_kind), public :: & hist_avg ! if true, write averaged data instead of snapshots @@ -50,6 +54,9 @@ module ice_history_shared character (len=char_len), public :: & version_name + character (len=char_len), public :: & + history_format + !--------------------------------------------------------------- ! Instructions for adding a field: (search for 'example') ! Here: @@ -77,7 +84,7 @@ module ice_history_shared end type integer (kind=int_kind), parameter, public :: & - max_avail_hist_fields = 600 ! Max number of history fields + max_avail_hist_fields = 800 ! Max number of history fields integer (kind=int_kind), public :: & num_avail_hist_fields_tot = 0, & ! Current, total number of defined fields @@ -109,8 +116,8 @@ module ice_history_shared nzblyr , & ! bio grid nzalyr ! aerosols (2 snow & nblyr+2 bio) - type (ice_hist_field), dimension(max_avail_hist_fields), public :: & - avail_hist_fields + type (ice_hist_field), public :: & + avail_hist_fields(max_avail_hist_fields) integer (kind=int_kind), parameter, public :: & nvar = 12 , & ! number of grid fields that can be written @@ -804,8 +811,13 @@ subroutine define_hist_field(id, vname, vunit, vcoord, vcellmeas, & num_avail_hist_fields_4Df = num_avail_hist_fields_4Df + 1 endif - if (num_avail_hist_fields_tot > max_avail_hist_fields) & - call abort_ice(subname//'ERROR: Need to increase max_avail_hist_fields') + if (num_avail_hist_fields_tot > max_avail_hist_fields) then + if (my_task == master_task) then + write(nu_diag,*) subname,' num_avail_hist_fields_tot = ',num_avail_hist_fields_tot + write(nu_diag,*) subname,' max_avail_hist_fields = ',max_avail_hist_fields + endif + call abort_ice(subname//'ERROR: Need in computation of max_avail_hist_fields') + endif if (num_avail_hist_fields_tot /= & num_avail_hist_fields_2D + & @@ -817,8 +829,11 @@ subroutine define_hist_field(id, vname, vunit, vcoord, vcellmeas, & num_avail_hist_fields_4Di + & num_avail_hist_fields_4Ds + & num_avail_hist_fields_4Df) then - call abort_ice(subname//'ERROR: num_avail_hist_fields error') - endif + if (my_task == master_task) then + write(nu_diag,*) subname,' num_avail_hist_fields_tot = ',num_avail_hist_fields_tot + endif + call abort_ice(subname//'ERROR: in num_avail_hist_fields') + endif id(ns) = num_avail_hist_fields_tot diff --git a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 index 8239d00d5..3b31fa8cd 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 @@ -1293,9 +1293,6 @@ subroutine stress_eap (nx_block, ny_block, & strtmp(:,:,:) = c0 -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icellt i = indxti(ij) j = indxtj(ij) @@ -2144,7 +2141,6 @@ subroutine read_restart_eap() use ice_domain, only: nblocks, halo_info use ice_grid, only: grid_type use ice_restart, only: read_restart_field - use ice_restart_shared, only: restart_format ! local variables @@ -2183,7 +2179,7 @@ subroutine read_restart_eap() call read_restart_field(nu_restart_eap,0,a12_4,'ruf8', & 'a12_4',1,diag,field_loc_center,field_type_scalar) ! a12_4 - if (trim(grid_type) == 'tripole' .and. trim(restart_format) == 'pio') then + if (trim(grid_type) == 'tripole') then call ice_HaloUpdate_stress(a11_1, a11_3, halo_info, & field_loc_center, field_type_scalar) diff --git a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 index b9c797a9f..0f8acd547 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 @@ -143,6 +143,8 @@ subroutine evp (dt) type (block) :: & this_block ! block information for current block + + logical (kind=log_kind), save :: first_time = .true. character(len=*), parameter :: subname = '(evp)' @@ -349,7 +351,10 @@ subroutine evp (dt) endif call ice_timer_start(timer_evp_2d) if (kevp_kernel > 0) then -! if (my_task == 0) write(nu_diag,*) subname,' Entering kevp_kernel version ',kevp_kernel + if (first_time .and. my_task == 0) then + write(nu_diag,'(2a,i6)') subname,' Entering kevp_kernel version ',kevp_kernel + first_time = .false. + endif if (trim(grid_type) == 'tripole') then call abort_ice(trim(subname)//' & & Kernel not tested on tripole grid. Set kevp_kernel=0') @@ -663,9 +668,6 @@ subroutine stress (nx_block, ny_block, & str(:,:,:) = c0 -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icellt i = indxti(ij) j = indxtj(ij) diff --git a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 index 7eaba64cf..60d120435 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 @@ -51,6 +51,9 @@ module ice_transport_driver logical (kind=log_kind), dimension (:), allocatable, public :: & has_dependents ! true if a tracer has dependent tracers + logical (kind=log_kind), public :: & + conserv_check ! if true, check conservation + integer (kind=int_kind), parameter :: & integral_order = 3 ! polynomial order of quadrature integrals ! linear=1, quadratic=2, cubic=3 @@ -147,53 +150,59 @@ subroutine init_transport ! diagnostic output if (my_task == master_task) then - write (nu_diag, *) 'tracer index depend type has_dependents' + write (nu_diag, *) 'tracer index depend type has_dependents' nt = 1 - write(nu_diag,*) ' hi ',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'hi ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) nt = 2 - write(nu_diag,*) ' hs ',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'hs ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) k=2 do nt = k+1, k+ntrcr if (nt-k==nt_Tsfc) & - write(nu_diag,*) 'nt_Tsfc',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_Tsfc ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_qice) & - write(nu_diag,*) 'nt_qice',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_qice ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_qsno) & - write(nu_diag,*) 'nt_qsno',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_qsno ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_sice) & - write(nu_diag,*) 'nt_sice',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_sice ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_fbri) & - write(nu_diag,*) 'nt_fbri',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_fbri ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_iage) & - write(nu_diag,*) 'nt_iage',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_iage ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_FY) & - write(nu_diag,*) 'nt_FY ', nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_FY ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_alvl) & - write(nu_diag,*) 'nt_alvl',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_alvl ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_vlvl) & - write(nu_diag,*) 'nt_vlvl',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_vlvl ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_apnd) & - write(nu_diag,*) 'nt_apnd',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_apnd ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_hpnd) & - write(nu_diag,*) 'nt_hpnd',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_hpnd ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_ipnd) & - write(nu_diag,*) 'nt_ipnd',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_ipnd ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_fsd) & - write(nu_diag,*) 'nt_fsd ',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_fsd ',nt,depend(nt),tracer_type(nt),& + has_dependents(nt) + if (nt-k==nt_isosno) & + write(nu_diag,1000) 'nt_isosno ',nt,depend(nt),tracer_type(nt),& + has_dependents(nt) + if (nt-k==nt_isoice) & + write(nu_diag,1000) 'nt_isoice ',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),& @@ -202,13 +211,15 @@ subroutine init_transport 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),& + write(nu_diag,1000) 'nt_bgc_Nit ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) if (nt-k==nt_bgc_S) & - write(nu_diag,*) 'nt_bgc_S',nt,depend(nt),tracer_type(nt),& + write(nu_diag,1000) 'nt_bgc_S ',nt,depend(nt),tracer_type(nt),& has_dependents(nt) enddo + write(nu_diag,*) ' ' endif ! master_task + 1000 format (1x,a,2x,i6,2x,i6,2x,i4,4x,l4) if (trim(advection)=='remap') call init_remap ! grid quantities @@ -288,7 +299,6 @@ subroutine transport_remap (dt) ! variables related to optional bug checks logical (kind=log_kind), parameter :: & - l_conservation_check = .false. ,&! if true, check conservation l_monotonicity_check = .false. ! if true, check monotonicity real (kind=dbl_kind), dimension(0:ncat) :: & @@ -308,6 +318,8 @@ subroutine transport_remap (dt) real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & work1 + character(len=char_len_long) :: fieldid + character(len=*), parameter :: subname = '(transport_remap)' call ice_timer_start(timer_advect) ! advection @@ -396,7 +408,7 @@ subroutine transport_remap (dt) !---! Optional conservation and monotonicity checks. !---!------------------------------------------------------------------- - if (l_conservation_check) then + if (conserv_check) then !------------------------------------------------------------------- ! Compute initial values of globally conserved quantities. @@ -434,7 +446,7 @@ subroutine transport_remap (dt) enddo ! nt enddo ! n - endif ! l_conservation_check + endif ! conserv_check if (l_monotonicity_check) then @@ -563,7 +575,7 @@ subroutine transport_remap (dt) ! Check global conservation of area and area*tracers. (Optional) !------------------------------------------------------------------- - if (l_conservation_check) then + if (conserv_check) then do n = 0, ncat asum_final(n) = global_sum(aim(:,:,n,:), distrb_info, & @@ -598,7 +610,8 @@ subroutine transport_remap (dt) enddo ! n if (my_task == master_task) then - call global_conservation (l_stop, & + fieldid = subname//':000' + call global_conservation (l_stop, fieldid, & asum_init(0), asum_final(0)) if (l_stop) then @@ -608,9 +621,10 @@ subroutine transport_remap (dt) call abort_ice(subname//'ERROR: conservation error1') endif - do n = 1, ncat + do n = 1, ncat + write(fieldid,'(a,i3.3)') subname,n call global_conservation & - (l_stop, & + (l_stop, fieldid, & asum_init(n), asum_final(n), & atsum_init(:,n), atsum_final(:,n)) @@ -624,7 +638,7 @@ subroutine transport_remap (dt) endif ! my_task = master_task - endif ! l_conservation_check + endif ! conserv_check !------------------------------------------------------------------- ! Check tracer monotonicity. (Optional) @@ -1075,10 +1089,13 @@ end subroutine tracers_to_state ! ! author William H. Lipscomb, LANL - subroutine global_conservation (l_stop, & + subroutine global_conservation (l_stop, fieldid, & asum_init, asum_final, & atsum_init, atsum_final) + character(len=*), intent(in) :: & + fieldid ! field information string + real (kind=dbl_kind), intent(in) :: & asum_init ,&! initial global ice area asum_final ! final global ice area @@ -1111,11 +1128,11 @@ subroutine global_conservation (l_stop, & if (abs(diff/asum_init) > puny) then l_stop = .true. write (nu_diag,*) - write (nu_diag,*) 'Ice area conserv error' - write (nu_diag,*) 'Initial global area =', asum_init - write (nu_diag,*) 'Final global area =', asum_final - write (nu_diag,*) 'Fractional error =', abs(diff)/asum_init - write (nu_diag,*) 'asum_final-asum_init =', diff + write (nu_diag,*) subname,'Ice area conserv error ', trim(fieldid) + write (nu_diag,*) subname,' Initial global area =', asum_init + write (nu_diag,*) subname,' Final global area =', asum_final + write (nu_diag,*) subname,' Fractional error =', abs(diff)/asum_init + write (nu_diag,*) subname,' asum_final-asum_init =', diff endif endif @@ -1126,15 +1143,12 @@ subroutine global_conservation (l_stop, & if (abs(diff/atsum_init(nt)) > puny) then l_stop = .true. write (nu_diag,*) - write (nu_diag,*) 'area*tracer conserv error' - write (nu_diag,*) 'tracer index =', nt - write (nu_diag,*) 'Initial global area*tracer =', & - atsum_init(nt) - write (nu_diag,*) 'Final global area*tracer =', & - atsum_final(nt) - write (nu_diag,*) 'Fractional error =', & - abs(diff)/atsum_init(nt) - write (nu_diag,*) 'atsum_final-atsum_init =', diff + write (nu_diag,*) subname,'Ice area*tracer conserv error ', trim(fieldid),nt + write (nu_diag,*) subname,' Tracer index =', nt + write (nu_diag,*) subname,' Initial global area*tracer =', atsum_init(nt) + write (nu_diag,*) subname,' Final global area*tracer =', atsum_final(nt) + write (nu_diag,*) subname,' Fractional error =', abs(diff)/atsum_init(nt) + write (nu_diag,*) subname,' atsum_final-atsum_init =', diff endif endif enddo diff --git a/cicecore/cicedynB/dynamics/ice_transport_remap.F90 b/cicecore/cicedynB/dynamics/ice_transport_remap.F90 index b641104ed..ff48f1497 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_remap.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_remap.F90 @@ -1248,9 +1248,6 @@ subroutine construct_fields (nx_block, ny_block, & enddo enddo -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells ! Note: no tx or ty in ghost cells ! (bound calls are later) i = indxi(ij) @@ -3133,10 +3130,6 @@ subroutine triangle_coordinates (nx_block, ny_block, & elseif (integral_order == 2) then ! quadratic (3-point formula) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu - do ng = 1, ngroups do ij = 1, icells(ng) i = indxi(ij,ng) @@ -3164,9 +3157,6 @@ subroutine triangle_coordinates (nx_block, ny_block, & else ! cubic (4-point formula) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ng = 1, ngroups do ij = 1, icells(ng) i = indxi(ij,ng) @@ -3298,9 +3288,6 @@ subroutine transport_integrals (nx_block, ny_block, & if (integral_order == 1) then ! linear (1-point formula) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells(ng) i = indxi(ij,ng) j = indxj(ij,ng) @@ -3326,9 +3313,6 @@ subroutine transport_integrals (nx_block, ny_block, & elseif (integral_order == 2) then ! quadratic (3-point formula) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells(ng) i = indxi(ij,ng) j = indxj(ij,ng) @@ -3373,9 +3357,6 @@ subroutine transport_integrals (nx_block, ny_block, & else ! cubic (4-point formula) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells(ng) i = indxi(ij,ng) j = indxj(ij,ng) @@ -3433,9 +3414,6 @@ subroutine transport_integrals (nx_block, ny_block, & do nt = 1, ntrace if (tracer_type(nt)==1) then ! does not depend on another tracer -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells(ng) i = indxi(ij,ng) j = indxj(ij,ng) @@ -3464,9 +3442,6 @@ subroutine transport_integrals (nx_block, ny_block, & elseif (tracer_type(nt)==2) then ! depends on another tracer nt1 = depend(nt) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells(ng) i = indxi(ij,ng) j = indxj(ij,ng) @@ -3486,9 +3461,6 @@ subroutine transport_integrals (nx_block, ny_block, & elseif (tracer_type(nt)==3) then ! depends on two tracers nt1 = depend(nt) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells(ng) i = indxi(ij,ng) j = indxj(ij,ng) @@ -3690,9 +3662,6 @@ subroutine update_fields (nx_block, ny_block, & elseif (tracer_type(nt)==2) then ! depends on another tracer nt1 = depend(nt) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells i = indxi(ij) j = indxj(ij) @@ -3710,9 +3679,6 @@ subroutine update_fields (nx_block, ny_block, & nt1 = depend(nt) nt2 = depend(nt1) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells i = indxi(ij) j = indxj(ij) diff --git a/cicecore/cicedynB/general/ice_flux.F90 b/cicecore/cicedynB/general/ice_flux.F90 index 607b763eb..6b16edb77 100644 --- a/cicecore/cicedynB/general/ice_flux.F90 +++ b/cicecore/cicedynB/general/ice_flux.F90 @@ -1071,9 +1071,6 @@ subroutine scale_fluxes (nx_block, ny_block, & if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do j = 1, ny_block do i = 1, nx_block if (tmask(i,j) .and. aice(i,j) > c0) then @@ -1139,9 +1136,6 @@ subroutine scale_fluxes (nx_block, ny_block, & ! Scale fluxes for history output if (present(fsurf) .and. present(fcondtop) ) then -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do j = 1, ny_block do i = 1, nx_block if (tmask(i,j) .and. aice(i,j) > c0) then diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 index 64f4b4834..52d4124b4 100755 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -116,7 +116,7 @@ module ice_forcing ocn_data_format, & ! 'bin'=binary or 'nc'=netcdf atm_data_type, & ! 'default', 'monthly', 'ncar', ! 'LYq' or 'hadgem' or 'oned' or - ! 'JRA55_gx1' or 'JRA55_gx3' + ! 'JRA55_gx1' or 'JRA55_gx3' or 'JRA55_tx1' bgc_data_type, & ! 'default', 'clim' ocn_data_type, & ! 'default', 'clim', 'ncar', 'oned', ! 'hadgem_sst' or 'hadgem_sst_uvocn' @@ -241,6 +241,7 @@ subroutine init_forcing_atmo if (use_leap_years .and. (trim(atm_data_type) /= 'JRA55_gx1' .and. & trim(atm_data_type) /= 'JRA55_gx3' .and. & + trim(atm_data_type) /= 'JRA55_tx1' .and. & trim(atm_data_type) /= 'hycom' .and. & trim(atm_data_type) /= 'box2001')) then write(nu_diag,*) 'use_leap_years option is currently only supported for' @@ -261,6 +262,8 @@ subroutine init_forcing_atmo call JRA55_gx1_files(fyear) elseif (trim(atm_data_type) == 'JRA55_gx3') then call JRA55_gx3_files(fyear) + elseif (trim(atm_data_type) == 'JRA55_tx1') then + call JRA55_tx1_files(fyear) elseif (trim(atm_data_type) == 'hadgem') then call hadgem_files(fyear) elseif (trim(atm_data_type) == 'monthly') then @@ -560,6 +563,8 @@ subroutine get_forcing_atmo call JRA55_data(fyear) elseif (trim(atm_data_type) == 'JRA55_gx3') then call JRA55_data(fyear) + elseif (trim(atm_data_type) == 'JRA55_tx1') then + call JRA55_data(fyear) elseif (trim(atm_data_type) == 'hadgem') then call hadgem_data elseif (trim(atm_data_type) == 'monthly') then @@ -1405,6 +1410,10 @@ subroutine file_year (data_file, yr) i = index(data_file,'.nc') - 5 tmpname = data_file write(data_file,'(a,i4.4,a)') tmpname(1:i), yr, '.nc' + elseif (trim(atm_data_type) == 'JRA55_tx1') then ! netcdf + i = index(data_file,'.nc') - 5 + tmpname = data_file + write(data_file,'(a,i4.4,a)') tmpname(1:i), yr, '.nc' else ! LANL/NCAR naming convention i = index(data_file,'.dat') - 5 tmpname = data_file @@ -2047,6 +2056,22 @@ subroutine JRA55_gx1_files(yr) write (nu_diag,*) trim(uwind_file) endif end subroutine JRA55_gx1_files + subroutine JRA55_tx1_files(yr) +! + integer (kind=int_kind), intent(in) :: & + yr ! current forcing year + + character(len=*), parameter :: subname = '(JRA55_tx1_files)' + + uwind_file = & + trim(atm_data_dir)//'/8XDAILY/JRA55_03hr_forcing_tx1_2005.nc' + call file_year(uwind_file,yr) + if (my_task == master_task) then + write (nu_diag,*) ' ' + write (nu_diag,*) 'Atmospheric data files:' + write (nu_diag,*) trim(uwind_file) + endif + end subroutine JRA55_tx1_files subroutine JRA55_gx3_files(yr) ! integer (kind=int_kind), intent(in) :: & diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index ffb070644..e7820d0b7 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -76,7 +76,8 @@ subroutine input_data restart, restart_ext, restart_dir, restart_file, pointer_file, & runid, runtype, use_restart_time, restart_format, lcdf64 use ice_history_shared, only: hist_avg, history_dir, history_file, & - incond_dir, incond_file, version_name + incond_dir, incond_file, version_name, & + history_precision, history_format use ice_flux, only: update_ocn_f, l_mpond_fresh use ice_flux, only: default_season use ice_flux_bgc, only: cpl_bgc @@ -98,7 +99,7 @@ subroutine input_data basalstress, k1, k2, alphab, threshold_hw, & Ktens, e_ratio, coriolis, & kridge, ktransport, brlx, arlx - use ice_transport_driver, only: advection + use ice_transport_driver, only: advection, conserv_check use ice_restoring, only: restore_ice #ifdef CESMCOUPLED use shr_file_mod, only: shr_file_setIO @@ -149,10 +150,11 @@ subroutine input_data ice_ic, restart, restart_dir, restart_file, & restart_ext, use_restart_time, restart_format, lcdf64, & pointer_file, dumpfreq, dumpfreq_n, dump_last, & - diagfreq, diag_type, diag_file, & + diagfreq, diag_type, diag_file, history_format,& print_global, print_points, latpnt, lonpnt, & dbug, histfreq, histfreq_n, hist_avg, & - history_dir, history_file, cpl_bgc, & + history_dir, history_file, history_precision, cpl_bgc, & + conserv_check, & write_ic, incond_dir, incond_file, version_name namelist /grid_nml/ & @@ -249,8 +251,10 @@ subroutine input_data histfreq(5) = 'y' ! output frequency option for different streams histfreq_n(:) = 1 ! output frequency hist_avg = .true. ! if true, write time-averages (not snapshots) + history_format = 'default' ! history file format history_dir = './' ! write to executable dir for default history_file = 'iceh' ! history file name prefix + history_precision = 4 ! precision of history files write_ic = .false. ! write out initial condition cpl_bgc = .false. ! history file name prefix incond_dir = history_dir ! write to history dir for default @@ -262,9 +266,9 @@ subroutine input_data restart_dir = './' ! write to executable dir for default restart_file = 'iced' ! restart file name prefix restart_ext = .false. ! if true, read/write ghost cells - use_restart_time = .true. ! if true, use time info written in file + use_restart_time = .true. ! if true, use time info written in file pointer_file = 'ice.restart_file' - restart_format = 'nc' ! file format ('bin'=binary or 'nc'=netcdf or 'pio') + restart_format = 'default' ! restart file format lcdf64 = .false. ! 64 bit offset for netCDF ice_ic = 'default' ! latitude and sst-dependent grid_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf) @@ -276,7 +280,7 @@ subroutine input_data kmt_file = 'unknown_kmt_file' version_name = 'unknown_version_name' ncat = 0 ! number of ice thickness categories - nfsd = 0 ! number of floe size categories (1 = default) + nfsd = 1 ! number of floe size categories (1 = default) nilyr = 0 ! number of vertical ice layers nslyr = 0 ! number of vertical snow layers nblyr = 0 ! number of bio layers @@ -306,6 +310,7 @@ subroutine input_data Ktens = 0.0_dbl_kind ! T=Ktens*P (tensile strength: see Konig and Holland, 2010) e_ratio = 2.0_dbl_kind ! EVP ellipse aspect ratio advection = 'remap' ! incremental remapping transport scheme + conserv_check = .false.! tracer conservation check shortwave = 'ccsm3' ! 'ccsm3' or 'dEdd' (delta-Eddington) albedo_type = 'ccsm3' ! 'ccsm3' or 'constant' ktherm = 1 ! -1 = OFF, 0 = 0-layer, 1 = BL99, 2 = mushy thermo @@ -536,6 +541,8 @@ subroutine input_data call broadcast_scalar(hist_avg, master_task) call broadcast_scalar(history_dir, master_task) call broadcast_scalar(history_file, master_task) + call broadcast_scalar(history_precision, master_task) + call broadcast_scalar(history_format, master_task) call broadcast_scalar(write_ic, master_task) call broadcast_scalar(cpl_bgc, master_task) call broadcast_scalar(incond_dir, master_task) @@ -586,6 +593,7 @@ subroutine input_data call broadcast_scalar(Ktens, master_task) call broadcast_scalar(e_ratio, master_task) call broadcast_scalar(advection, master_task) + call broadcast_scalar(conserv_check, master_task) call broadcast_scalar(shortwave, master_task) call broadcast_scalar(albedo_type, master_task) call broadcast_scalar(ktherm, master_task) @@ -843,7 +851,7 @@ subroutine input_data 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.' + write(nu_diag,*) subname//' ERROR: if tr_iso, n_iso must be > 0.' endif abort_flag = 31 endif @@ -852,11 +860,19 @@ subroutine input_data if (my_task == master_task) then write(nu_diag,*) subname//' ERROR: aerosols activated but' write(nu_diag,*) subname//' ERROR: not allocated in tracer array.' - write(nu_diag,*) subname//' ERROR: Activate in compilation script.' + write(nu_diag,*) subname//' ERROR: if tr_aero, n_aero must be > 0.' endif abort_flag = 9 endif + if (nfsd < 1) then + if (my_task == master_task) then + write(nu_diag,*) subname//' ERROR: nfsd < 1' + write(nu_diag,*) subname//' ERROR: not allowed due to history implementation.' + endif + abort_flag = 32 + endif + if (trim(shortwave) /= 'dEdd' .and. tr_aero) then if (my_task == master_task) then write(nu_diag,*) subname//' ERROR: tr_aero=T, invalid shortwave' @@ -935,6 +951,11 @@ subroutine input_data abort_flag = 19 endif + if(history_precision .ne. 4 .and. history_precision .ne. 8) then + write (nu_diag,*) 'ERROR: bad value for history_precision, allowed values: 4, 8' + abort_flag = 22 + endif + if (.not.(trim(dumpfreq) == 'y' .or. trim(dumpfreq) == 'Y' .or. & trim(dumpfreq) == 'm' .or. trim(dumpfreq) == 'M' .or. & trim(dumpfreq) == 'd' .or. trim(dumpfreq) == 'D' .or. & @@ -993,6 +1014,9 @@ subroutine input_data trim(history_dir) write(nu_diag,*) ' history_file = ', & trim(history_file) + write(nu_diag,1020) ' history_precision = ', history_precision + write(nu_diag,*) ' history_format = ', & + trim(history_format) if (write_ic) then write(nu_diag,*) 'Initial condition will be written in ', & trim(incond_dir) @@ -1077,6 +1101,7 @@ subroutine input_data write(nu_diag,1030) ' shortwave = ', & trim(shortwave) write(nu_diag,1000) ' ksno = ', ksno + write(nu_diag,1010) ' conserv_check = ', conserv_check if (cpl_bgc) then write(nu_diag,1000) ' BGC coupling is switched ON' else @@ -1156,8 +1181,8 @@ subroutine input_data oceanmixed_ice write(nu_diag,1010) ' wave_spec = ', wave_spec if (wave_spec) then - write(nu_diag,*) ' wave_spec_type = ', wave_spec_type - write(nu_diag,*) ' wave_spec_file = ', wave_spec_file + write(nu_diag,*) ' wave_spec_type = ', trim(wave_spec_type) + write(nu_diag,*) ' wave_spec_file = ', trim(wave_spec_file) endif write(nu_diag,1020) ' nfreq = ', nfreq write(nu_diag,*) ' tfrz_option = ', & @@ -1290,7 +1315,7 @@ subroutine input_data ktherm_in=ktherm, calc_Tsfc_in=calc_Tsfc, conduct_in=conduct, & a_rapid_mode_in=a_rapid_mode, Rac_rapid_mode_in=Rac_rapid_mode, & aspect_rapid_mode_in=aspect_rapid_mode, dSdt_slow_mode_in=dSdt_slow_mode, & - phi_c_slow_mode_in=phi_c_slow_mode, phi_i_mushy_in=phi_i_mushy, & + phi_c_slow_mode_in=phi_c_slow_mode, phi_i_mushy_in=phi_i_mushy, conserv_check_in=conserv_check, & wave_spec_type_in = wave_spec_type, & wave_spec_in=wave_spec, nfreq_in=nfreq, & tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type) @@ -1841,9 +1866,6 @@ subroutine set_state_var (nx_block, ny_block, & do n = 1, ncat ! ice volume, snow volume -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells i = indxi(ij) j = indxj(ij) diff --git a/cicecore/cicedynB/general/ice_step_mod.F90 b/cicecore/cicedynB/general/ice_step_mod.F90 index e389adc87..7f9f316a3 100644 --- a/cicecore/cicedynB/general/ice_step_mod.F90 +++ b/cicecore/cicedynB/general/ice_step_mod.F90 @@ -1284,9 +1284,6 @@ subroutine ocean_mixed_layer (dt, iblk) ! Compute ocean fluxes and update SST !----------------------------------------------------------------- -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells i = indxi(ij) j = indxj(ij) diff --git a/cicecore/cicedynB/infrastructure/ice_domain.F90 b/cicecore/cicedynB/infrastructure/ice_domain.F90 index 3be2449f7..3916039b5 100644 --- a/cicecore/cicedynB/infrastructure/ice_domain.F90 +++ b/cicecore/cicedynB/infrastructure/ice_domain.F90 @@ -342,6 +342,7 @@ subroutine init_domain_distribution(KMTG,ULATG) file=__FILE__, line=__LINE__) if (trim(ns_boundary_type) == 'closed') then + call abort_ice(subname//'ERROR: ns_boundary_type = closed not supported') allocate(nocn(nblocks_tot)) nocn = 0 do n=1,nblocks_tot @@ -373,13 +374,14 @@ subroutine init_domain_distribution(KMTG,ULATG) enddo endif if (nocn(n) > 0) then - print*, 'ice: Not enough land cells along ns edge' - call abort_ice(subname//'ERROR: Not enough land cells along ns edge') + write(nu_diag,*) subname,'ns closed, Not enough land cells along ns edge' + call abort_ice(subname//'ERROR: Not enough land cells along ns edge for ns closed') endif enddo deallocate(nocn) endif if (trim(ew_boundary_type) == 'closed') then + call abort_ice(subname//'ERROR: ew_boundary_type = closed not supported') allocate(nocn(nblocks_tot)) nocn = 0 do n=1,nblocks_tot @@ -411,8 +413,8 @@ subroutine init_domain_distribution(KMTG,ULATG) enddo endif if (nocn(n) > 0) then - print*, 'ice: Not enough land cells along ew edge' - call abort_ice(subname//'ERROR: Not enough land cells along ew edge') + write(nu_diag,*) subname,'ew closed, Not enough land cells along ew edge' + call abort_ice(subname//'ERROR: Not enough land cells along ew edge for ew closed') endif enddo deallocate(nocn) diff --git a/cicecore/cicedynB/infrastructure/ice_grid.F90 b/cicecore/cicedynB/infrastructure/ice_grid.F90 index 20df6b236..8df66042b 100644 --- a/cicecore/cicedynB/infrastructure/ice_grid.F90 +++ b/cicecore/cicedynB/infrastructure/ice_grid.F90 @@ -2411,7 +2411,7 @@ subroutine get_bathymetry_popfile ! create thickness profile k1 = min(5,nlevel) do k = 1,k1 - thick(k) = max(10000._dbl_kind/float(nlevel),500.) + thick(k) = max(10000._dbl_kind/float(nlevel),500._dbl_kind) enddo do k = k1+1,nlevel thick(k) = min(thick(k-1)*1.2_dbl_kind,20000._dbl_kind) diff --git a/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 b/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 index 5bc945fa2..d3829b9c4 100644 --- a/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 +++ b/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 @@ -883,7 +883,7 @@ subroutine restartfile_v4 (ice_ic) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) - ! creates netcdf if restart_format = 'nc' + ! creates new file filename = trim(restart_dir) // '/iced.converted' call dumpfile(filename) call final_restart diff --git a/cicecore/cicedynB/infrastructure/ice_restoring.F90 b/cicecore/cicedynB/infrastructure/ice_restoring.F90 index 09db9c273..38104315d 100644 --- a/cicecore/cicedynB/infrastructure/ice_restoring.F90 +++ b/cicecore/cicedynB/infrastructure/ice_restoring.F90 @@ -499,9 +499,6 @@ subroutine set_restore_var (nx_block, ny_block, & do n = 1, ncat -!DIR$ CONCURRENT !Cray -!cdir nodep !NEC -!ocl novrec !Fujitsu do ij = 1, icells i = indxi(ij) j = indxj(ij) diff --git a/cicecore/cicedynB/infrastructure/io/io_binary/ice_history_write.F90 b/cicecore/cicedynB/infrastructure/io/io_binary/ice_history_write.F90 index dd525df6d..b98e09814 100644 --- a/cicecore/cicedynB/infrastructure/io/io_binary/ice_history_write.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_binary/ice_history_write.F90 @@ -62,6 +62,10 @@ subroutine ice_write_hist(ns) integer (kind=int_kind) :: icategory,i_aice + character (len=4) :: & + atype ! format for output array + ! (real/integer, 4-byte/8-byte) + character (char_len) :: current_date,current_time character (len=16) :: c_aice logical (kind=log_kind) :: diag @@ -70,6 +74,15 @@ subroutine ice_write_hist(ns) diag = .false. + ! single precision + atype = 'rda4' + nbits = 32 + if (history_precision == 8) then + ! double precision + atype = 'rda8' + nbits = 64 + endif + if (my_task == master_task) then call construct_filename(ncfile(ns),'da',ns) @@ -85,7 +98,6 @@ subroutine ice_write_hist(ns) !----------------------------------------------------------------- ! create history files !----------------------------------------------------------------- - nbits = 32 ! single precision call ice_open(nu_history, ncfile(ns), nbits) ! direct access open(nu_hdr,file=hdrfile,form='formatted',status='unknown') ! ascii @@ -124,7 +136,7 @@ subroutine ice_write_hist(ns) write (nu_hdr, 996) nrec,'tarea','area of T grid cells','m^2' write (nu_hdr, * ) 'History variables: (left column = nrec)' endif ! my_task = master_task - call ice_write(nu_history, nrec, tarea, 'rda4', diag) + call ice_write(nu_history, nrec, tarea, atype, diag) do n=1,num_avail_hist_fields_2D if (avail_hist_fields(n)%vhistfreq == histfreq(ns)) then @@ -160,7 +172,7 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a2D(:,:,n,:), 'rda4', diag) + call ice_write(nu_history, nrec, a2D(:,:,n,:), atype, diag) endif enddo ! num_avail_hist_fields_2D @@ -183,7 +195,7 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a3Dc(:,:,nn,n-n2D,:), 'rda4', diag) + call ice_write(nu_history, nrec, a3Dc(:,:,nn,n-n2D,:), atype, diag) enddo ! ncat endif @@ -207,7 +219,7 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a3Dz(:,:,k,n-n3Dccum,:), 'rda4', diag) + call ice_write(nu_history, nrec, a3Dz(:,:,k,n-n3Dccum,:), atype, diag) enddo ! nzilyr endif @@ -231,7 +243,7 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a3Db(:,:,k,n-n3Dzcum,:), 'rda4', diag) + call ice_write(nu_history, nrec, a3Db(:,:,k,n-n3Dzcum,:), atype, diag) enddo ! nzilyr endif @@ -255,7 +267,7 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a3Da(:,:,k,n-n3Dbcum,:), 'rda4', diag) + call ice_write(nu_history, nrec, a3Da(:,:,k,n-n3Dbcum,:), atype, diag) enddo ! nzilyr endif @@ -279,7 +291,7 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a3Df(:,:,k,n-n3Dacum,:), 'rda4', diag) + call ice_write(nu_history, nrec, a3Df(:,:,k,n-n3Dacum,:), atype, diag) enddo ! nfsd_hist endif @@ -304,7 +316,7 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a4Di(:,:,k,nn,n-n3Dfcum,:), 'rda4', diag) + call ice_write(nu_history, nrec, a4Di(:,:,k,nn,n-n3Dfcum,:), atype, diag) enddo ! nzilyr enddo ! ncat_hist @@ -315,7 +327,7 @@ subroutine ice_write_hist(ns) if (avail_hist_fields(n)%vhistfreq == histfreq(ns)) then do nn = 1, ncat_hist - do k = 1, nzilyr + do k = 1, nzslyr nrec = nrec + 1 if (my_task == master_task) then write (nu_hdr, 993) nrec,trim(avail_hist_fields(n)%vname), & @@ -330,8 +342,8 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a4Ds(:,:,k,nn,n-n4Dicum,:), 'rda4', diag) - enddo ! nzilyr + call ice_write(nu_history, nrec, a4Ds(:,:,k,nn,n-n4Dicum,:), atype, diag) + enddo ! nzslyr enddo ! ncat_hist endif @@ -356,7 +368,7 @@ subroutine ice_write_hist(ns) endif endif - call ice_write(nu_history, nrec, a4Df(:,:,k,nn,n-n4Dscum,:), 'rda4', diag) + call ice_write(nu_history, nrec, a4Df(:,:,k,nn,n-n4Dscum,:), atype, diag) enddo ! nfsd_hist enddo ! ncat_hist diff --git a/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 index 8ecfeb6f1..b1a2d026b 100644 --- a/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 @@ -11,7 +11,7 @@ module ice_restart use ice_kinds_mod use ice_restart_shared, only: & restart, restart_ext, restart_dir, restart_file, pointer_file, & - runid, runtype, use_restart_time, restart_format, lenstr + runid, runtype, use_restart_time, lenstr 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 diff --git a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_history_write.F90 b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_history_write.F90 index ff16c637b..5b6aa0dd8 100644 --- a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_history_write.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_history_write.F90 @@ -18,7 +18,7 @@ module ice_history_write - use ice_constants, only: c0, c360, spval + use ice_constants, only: c0, c360, spval, spval_dbl use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted @@ -86,6 +86,8 @@ subroutine ice_write_hist (ns) integer (kind=int_kind) :: ind,boundid + integer (kind=int_kind) :: lprecision + character (char_len) :: start_time,current_date,current_time character (len=8) :: cdate @@ -123,6 +125,9 @@ subroutine ice_write_hist (ns) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) + lprecision = nf90_float + if (history_precision == 8) lprecision = nf90_double + if (my_task == master_task) then ! ltime=time/int(secday) @@ -243,7 +248,7 @@ subroutine ice_write_hist (ns) if (hist_avg) then dimid(1) = boundid dimid(2) = timid - status = nf90_def_var(ncid,'time_bounds',nf90_float,dimid(1:2),varid) + status = nf90_def_var(ncid,'time_bounds',lprecision,dimid(1:2),varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining var time_bounds') status = nf90_put_att(ncid,varid,'long_name', & @@ -344,7 +349,7 @@ subroutine ice_write_hist (ns) dimid(3) = timid do i = 1, ncoord - status = nf90_def_var(ncid, coord_var(i)%short_name, nf90_float, & + status = nf90_def_var(ncid, coord_var(i)%short_name, lprecision, & dimid(1:2), varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining short_name for '//coord_var(i)%short_name) @@ -354,10 +359,18 @@ subroutine ice_write_hist (ns) status = nf90_put_att(ncid, varid, 'units', coord_var(i)%units) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining units for '//coord_var(i)%short_name) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//coord_var(i)%short_name) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//coord_var(i)%short_name) if (coord_var(i)%short_name == 'ULAT') then @@ -384,7 +397,7 @@ subroutine ice_write_hist (ns) do i = 1, nvarz if (igrdz(i)) then status = nf90_def_var(ncid, var_nz(i)%short_name, & - nf90_float, dimidex(i), varid) + lprecision, dimidex(i), varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining short_name for '//var_nz(i)%short_name) status = nf90_put_att(ncid,varid,'long_name',var_nz(i)%long_name) @@ -398,7 +411,7 @@ subroutine ice_write_hist (ns) ! Attributes for tmask, blkmask defined separately, since they have no units if (igrd(n_tmask)) then - status = nf90_def_var(ncid, 'tmask', nf90_float, dimid(1:2), varid) + status = nf90_def_var(ncid, 'tmask', lprecision, dimid(1:2), varid) if (status /= nf90_noerr) call abort_ice(subname//'ERROR: defining var tmask') status = nf90_put_att(ncid,varid, 'long_name', 'ocean grid mask') if (status /= nf90_noerr) call abort_ice(subname//'ERROR: tmask long_name') @@ -406,14 +419,22 @@ subroutine ice_write_hist (ns) if (status /= nf90_noerr) call abort_ice(subname//'ERROR: tmask units') status = nf90_put_att(ncid,varid,'comment', '0 = land, 1 = ocean') if (status /= nf90_noerr) call abort_ice(subname//'ERROR: tmask comment') - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname//'ERROR: defining missing_value for tmask') - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname//'ERROR: defining _FillValue for tmask') endif if (igrd(n_blkmask)) then - status = nf90_def_var(ncid, 'blkmask', nf90_float, dimid(1:2), varid) + status = nf90_def_var(ncid, 'blkmask', lprecision, dimid(1:2), varid) if (status /= nf90_noerr) call abort_ice(subname//'ERROR: defining var blkmask') status = nf90_put_att(ncid,varid, 'long_name', 'ice grid block mask') if (status /= nf90_noerr) call abort_ice(subname//'ERROR: blkmask long_name') @@ -421,16 +442,24 @@ subroutine ice_write_hist (ns) if (status /= nf90_noerr) call abort_ice(subname//'ERROR: blkmask units') status = nf90_put_att(ncid,varid,'comment', 'mytask + iblk/100') if (status /= nf90_noerr) call abort_ice(subname//'ERROR: blkmask comment') - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname//'ERROR: defining missing_value for blkmask') - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname//'ERROR: defining _FillValue for blkmask') endif do i = 3, nvar ! note n_tmask=1, n_blkmask=2 if (igrd(i)) then status = nf90_def_var(ncid, var(i)%req%short_name, & - nf90_float, dimid(1:2), varid) + lprecision, dimid(1:2), varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//var(i)%req%short_name) status = nf90_put_att(ncid,varid, 'long_name', var(i)%req%long_name) @@ -442,10 +471,18 @@ subroutine ice_write_hist (ns) status = nf90_put_att(ncid, varid, 'coordinates', var(i)%coordinates) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining coordinates for '//var(i)%req%short_name) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//var(i)%req%short_name) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//var(i)%req%short_name) endif @@ -458,7 +495,7 @@ subroutine ice_write_hist (ns) do i = 1, nvar_verts if (f_bounds) then status = nf90_def_var(ncid, var_nverts(i)%short_name, & - nf90_float,dimid_nverts, varid) + lprecision,dimid_nverts, varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//var_nverts(i)%short_name) status = nf90_put_att(ncid,varid, 'long_name', var_nverts(i)%long_name) @@ -467,10 +504,18 @@ subroutine ice_write_hist (ns) status = nf90_put_att(ncid, varid, 'units', var_nverts(i)%units) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining units for '//var_nverts(i)%short_name) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//var_nverts(i)%short_name) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//var_nverts(i)%short_name) endif @@ -479,7 +524,7 @@ subroutine ice_write_hist (ns) do n=1,num_avail_hist_fields_2D if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & - nf90_float, dimid, varid) + lprecision, dimid, varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -498,10 +543,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) @@ -542,7 +595,7 @@ subroutine ice_write_hist (ns) do n = n2D + 1, n3Dccum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & - nf90_float, dimidz, varid) + lprecision, dimidz, varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -561,10 +614,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) @@ -593,7 +654,7 @@ subroutine ice_write_hist (ns) do n = n3Dccum + 1, n3Dzcum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & - nf90_float, dimidz, varid) + lprecision, dimidz, varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -612,10 +673,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) @@ -630,7 +699,7 @@ subroutine ice_write_hist (ns) do n = n3Dzcum + 1, n3Dbcum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & - nf90_float, dimidz, varid) + lprecision, dimidz, varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -649,10 +718,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) @@ -667,7 +744,7 @@ subroutine ice_write_hist (ns) do n = n3Dbcum + 1, n3Dacum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & - nf90_float, dimidz, varid) + lprecision, dimidz, varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -686,10 +763,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) @@ -704,7 +789,7 @@ subroutine ice_write_hist (ns) do n = n3Dacum + 1, n3Dfcum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & - nf90_float, dimidz, varid) + lprecision, dimidz, varid) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -723,10 +808,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) @@ -742,8 +835,8 @@ subroutine ice_write_hist (ns) do n = n3Dfcum + 1, n4Dicum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & -! nf90_float, dimidcz, varid) - nf90_float, dimidcz(1:4), varid) ! ferret +! lprecision, dimidcz, varid) + lprecision, dimidcz(1:4), varid) ! ferret if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -762,10 +855,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) @@ -795,8 +896,8 @@ subroutine ice_write_hist (ns) do n = n4Dicum + 1, n4Dscum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & -! nf90_float, dimidcz, varid) - nf90_float, dimidcz(1:4), varid) ! ferret +! lprecision, dimidcz, varid) + lprecision, dimidcz(1:4), varid) ! ferret if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -815,10 +916,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) @@ -848,8 +957,8 @@ subroutine ice_write_hist (ns) do n = n4Dscum + 1, n4Dfcum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = nf90_def_var(ncid, avail_hist_fields(n)%vname, & -! nf90_float, dimidcz, varid) - nf90_float, dimidcz(1:4), varid) ! ferret +! lprecision, dimidcz, varid) + lprecision, dimidcz(1:4), varid) ! ferret if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining variable '//avail_hist_fields(n)%vname) status = nf90_put_att(ncid,varid,'units', & @@ -868,10 +977,18 @@ subroutine ice_write_hist (ns) avail_hist_fields(n)%vcellmeas) if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining cell measures for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'missing_value',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'missing_value',spval) + else + status = nf90_put_att(ncid,varid,'missing_value',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining missing_value for '//avail_hist_fields(n)%vname) - status = nf90_put_att(ncid,varid,'_FillValue',spval) + if (lprecision == nf90_float) then + status = nf90_put_att(ncid,varid,'_FillValue',spval) + else + status = nf90_put_att(ncid,varid,'_FillValue',spval_dbl) + endif if (status /= nf90_noerr) call abort_ice(subname// & 'ERROR: defining _FillValue for '//avail_hist_fields(n)%vname) diff --git a/cicecore/cicedynB/infrastructure/io/io_pio/ice_history_write.F90 b/cicecore/cicedynB/infrastructure/io/io_pio/ice_history_write.F90 deleted file mode 100644 index 43e5dab74..000000000 --- a/cicecore/cicedynB/infrastructure/io/io_pio/ice_history_write.F90 +++ /dev/null @@ -1,1066 +0,0 @@ -!======================================================================= -! -! Writes history in netCDF format -! -! authors Tony Craig and Bruce Briegleb, NCAR -! Elizabeth C. Hunke and William H. Lipscomb, LANL -! C. M. Bitz, UW -! -! 2004 WHL: Block structure added -! 2006 ECH: Accepted some CESM code into mainstream CICE -! Added ice_present, aicen, vicen; removed aice1...10, vice1...1. -! Added histfreq_n and histfreq='h' options, removed histfreq='w' -! Converted to free source form (F90) -! Added option for binary output instead of netCDF -! 2009 D Bailey and ECH: Generalized for multiple frequency output -! 2010 Alison McLaren and ECH: Added 3D capability -! - module ice_history_write - - use ice_kinds_mod - 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_query_parameters - - implicit none - private - public :: ice_write_hist - -!======================================================================= - - contains - -!======================================================================= -! -! write average ice quantities or snapshots -! -! author: Elizabeth C. Hunke, LANL - - subroutine ice_write_hist (ns) - -#ifdef ncdf - use ice_blocks, only: nx_block, ny_block - use ice_broadcast, only: broadcast_scalar - use ice_calendar, only: time, sec, idate, idate0, write_ic, & - histfreq, dayyr, days_per_year, use_leap_years - use ice_communicate, only: my_task, master_task - use ice_constants, only: c0, c360, spval, spval_dbl - use ice_domain, only: distrb_info, nblocks - use ice_domain_size, only: nx_global, ny_global, max_blocks, max_nstrm - use ice_gather_scatter, only: gather_global - use ice_grid, only: TLON, TLAT, ULON, ULAT, hm, bm, tarea, uarea, & - dxu, dxt, dyu, dyt, HTN, HTE, ANGLE, ANGLET, tmask, & - lont_bounds, latt_bounds, lonu_bounds, latu_bounds - use ice_history_shared - use ice_arrays_column, only: hin_max - use ice_restart_shared, only: runid, lcdf64 - use netcdf -#endif - use ice_pio - use pio - - integer (kind=int_kind), intent(in) :: ns - - ! local variables - -#ifdef ncdf - integer (kind=int_kind) :: i,j,k,ic,n,nn, & - ncid,status,imtid,jmtid,kmtidi,kmtids,kmtidb, cmtid,timid, & - length,nvertexid,ivertex,kmtida - integer (kind=int_kind), dimension(2) :: dimid2 - integer (kind=int_kind), dimension(3) :: dimid3 - integer (kind=int_kind), dimension(4) :: dimidz - integer (kind=int_kind), dimension(5) :: dimidcz - integer (kind=int_kind), dimension(3) :: dimid_nverts - integer (kind=int_kind), dimension(5) :: dimidex - real (kind=real_kind) :: ltime - real (kind= dbl_kind) :: ltime2 - character (char_len) :: title - character (char_len_long) :: ncfile(max_nstrm) - - integer (kind=int_kind) :: iyear, imonth, iday - integer (kind=int_kind) :: icategory,ind,i_aice,boundid - - character (char_len) :: start_time,current_date,current_time - character (len=16) :: c_aice - character (len=8) :: cdate - - type(file_desc_t) :: File - type(io_desc_t) :: iodesc2d, & - iodesc3dc, iodesc3dv, iodesc3di, iodesc3db, iodesc3da, & - iodesc4di, iodesc4ds - type(var_desc_t) :: varid - - ! 4 coordinate variables: TLON, TLAT, ULON, ULAT - INTEGER (kind=int_kind), PARAMETER :: ncoord = 4 - - ! 4 vertices in each grid cell - INTEGER (kind=int_kind), PARAMETER :: nverts = 4 - - ! 4 variables describe T, U grid boundaries: - ! lont_bounds, latt_bounds, lonu_bounds, latu_bounds - INTEGER (kind=int_kind), PARAMETER :: nvar_verts = 4 - - TYPE coord_attributes ! netcdf coordinate attributes - character (len=11) :: short_name - character (len=45) :: long_name - character (len=20) :: units - END TYPE coord_attributes - - TYPE req_attributes ! req'd netcdf attributes - type (coord_attributes) :: req - character (len=20) :: coordinates - END TYPE req_attributes - - TYPE(req_attributes), dimension(nvar) :: var - TYPE(coord_attributes), dimension(ncoord) :: coord_var - TYPE(coord_attributes), dimension(nvar_verts) :: var_nverts - TYPE(coord_attributes), dimension(nvarz) :: var_nz - CHARACTER (char_len), dimension(ncoord) :: coord_bounds - - real (kind=dbl_kind), allocatable :: workr2(:,:,:) - real (kind=dbl_kind), allocatable :: workr3(:,:,:,:) - real (kind=dbl_kind), allocatable :: workr4(:,:,:,:,:) - real (kind=dbl_kind), allocatable :: workr3v(:,:,:,:) - - character(len=char_len_long) :: & - filename - - integer (kind=int_kind), dimension(1) :: & - tim_start,tim_length ! dimension quantities for netCDF - - integer (kind=int_kind), dimension(2) :: & - bnd_start,bnd_length ! dimension quantities for netCDF - - real (kind=dbl_kind) :: secday - real (kind=dbl_kind) :: rad_to_deg - - character(len=*), parameter :: subname = '(ice_write_hist)' - - call icepack_query_parameters(secday_out=secday) - call icepack_query_parameters(rad_to_deg_out=rad_to_deg) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - if (my_task == master_task) then - call construct_filename(ncfile(ns),'nc',ns) - - ! add local directory path name to ncfile - if (write_ic) then - ncfile(ns) = trim(incond_dir)//ncfile(ns) - else - ncfile(ns) = trim(history_dir)//ncfile(ns) - endif - filename = ncfile(ns) - end if - call broadcast_scalar(filename, master_task) - - ! create file - - File%fh=-1 - call ice_pio_init(mode='write', filename=trim(filename), File=File, & - clobber=.true., cdf64=lcdf64) - - call ice_pio_initdecomp(iodesc=iodesc2d) - call ice_pio_initdecomp(ndim3=ncat_hist, iodesc=iodesc3dc) - call ice_pio_initdecomp(ndim3=nzilyr, iodesc=iodesc3di) - call ice_pio_initdecomp(ndim3=nzblyr, iodesc=iodesc3db) - call ice_pio_initdecomp(ndim3=nzalyr, iodesc=iodesc3da) - call ice_pio_initdecomp(ndim3=nverts, inner_dim=.true., iodesc=iodesc3dv) - call ice_pio_initdecomp(ndim3=nzilyr, ndim4=ncat_hist, iodesc=iodesc4di) - call ice_pio_initdecomp(ndim3=nzslyr, ndim4=ncat_hist, iodesc=iodesc4ds) - - ltime2 = time/int(secday) - ltime = real(time/int(secday),kind=real_kind) - - !----------------------------------------------------------------- - ! define dimensions - !----------------------------------------------------------------- - - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_def_dim(File,'d2',2,boundid) - endif - - status = pio_def_dim(File,'ni',nx_global,imtid) - status = pio_def_dim(File,'nj',ny_global,jmtid) - status = pio_def_dim(File,'nc',ncat_hist,cmtid) - status = pio_def_dim(File,'nkice',nzilyr,kmtidi) - status = pio_def_dim(File,'nksnow',nzslyr,kmtids) - status = pio_def_dim(File,'nkbio',nzblyr,kmtidb) - status = pio_def_dim(File,'nkaer',nzalyr,kmtida) - status = pio_def_dim(File,'time',PIO_UNLIMITED,timid) - status = pio_def_dim(File,'nvertices',nverts,nvertexid) - - !----------------------------------------------------------------- - ! define coordinate variables: time, time_bounds - !----------------------------------------------------------------- - -!sgl status = pio_def_var(File,'time',pio_real,(/timid/),varid) - status = pio_def_var(File,'time',pio_double,(/timid/),varid) - status = pio_put_att(File,varid,'long_name','model time') - - write(cdate,'(i8.8)') idate0 - write(title,'(a,a,a,a,a,a,a)') 'days since ', & - cdate(1:4),'-',cdate(5:6),'-',cdate(7:8),' 00:00:00' - status = pio_put_att(File,varid,'units',trim(title)) - - if (days_per_year == 360) then - status = pio_put_att(File,varid,'calendar','360_day') - elseif (days_per_year == 365 .and. .not.use_leap_years ) then - status = pio_put_att(File,varid,'calendar','NoLeap') - elseif (use_leap_years) then - status = pio_put_att(File,varid,'calendar','Gregorian') - else - call abort_ice(subname//'ERROR: invalid calendar settings') - endif - - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_put_att(File,varid,'bounds','time_bounds') - endif - - ! Define attributes for time_bounds if hist_avg is true - if (hist_avg .and. histfreq(ns) /= '1') then - dimid2(1) = boundid - dimid2(2) = timid -!sgl status = pio_def_var(File,'time_bounds',pio_real,dimid2,varid) - status = pio_def_var(File,'time_bounds',pio_double,dimid2,varid) - status = pio_put_att(File,varid,'long_name', & - 'boundaries for time-averaging interval') - write(cdate,'(i8.8)') idate0 - write(title,'(a,a,a,a,a,a,a,a)') 'days since ', & - cdate(1:4),'-',cdate(5:6),'-',cdate(7:8),' 00:00:00' - status = pio_put_att(File,varid,'units',trim(title)) - endif - - !----------------------------------------------------------------- - ! define information for required time-invariant variables - !----------------------------------------------------------------- - - ind = 0 - ind = ind + 1 - coord_var(ind) = coord_attributes('TLON', & - 'T grid center longitude', 'degrees_east') - coord_bounds(ind) = 'lont_bounds' - ind = ind + 1 - coord_var(ind) = coord_attributes('TLAT', & - 'T grid center latitude', 'degrees_north') - coord_bounds(ind) = 'latt_bounds' - ind = ind + 1 - coord_var(ind) = coord_attributes('ULON', & - 'U grid center longitude', 'degrees_east') - coord_bounds(ind) = 'lonu_bounds' - ind = ind + 1 - coord_var(ind) = coord_attributes('ULAT', & - 'U grid center latitude', 'degrees_north') - coord_bounds(ind) = 'latu_bounds' - - var_nz(1) = coord_attributes('NCAT', 'category maximum thickness', 'm') - var_nz(2) = coord_attributes('VGRDi', 'vertical ice levels', '1') - var_nz(3) = coord_attributes('VGRDs', 'vertical snow levels', '1') - var_nz(4) = coord_attributes('VGRDb', 'vertical ice-bio levels', '1') - var_nz(5) = coord_attributes('VGRDa', 'vertical snow-ice-bio levels', '1') - - !----------------------------------------------------------------- - ! define information for optional time-invariant variables - !----------------------------------------------------------------- - - var(n_tmask)%req = coord_attributes('tmask', & - 'ocean grid mask', ' ') - var(n_tmask)%coordinates = 'TLON TLAT' - - var(n_blkmask)%req = coord_attributes('blkmask', & - 'ice grid block mask', ' ') - var(n_blkmask)%coordinates = 'TLON TLAT' - - var(n_tarea)%req = coord_attributes('tarea', & - 'area of T grid cells', 'm^2') - var(n_tarea)%coordinates = 'TLON TLAT' - - var(n_uarea)%req = coord_attributes('uarea', & - 'area of U grid cells', 'm^2') - var(n_uarea)%coordinates = 'ULON ULAT' - var(n_dxt)%req = coord_attributes('dxt', & - 'T cell width through middle', 'm') - var(n_dxt)%coordinates = 'TLON TLAT' - var(n_dyt)%req = coord_attributes('dyt', & - 'T cell height through middle', 'm') - var(n_dyt)%coordinates = 'TLON TLAT' - var(n_dxu)%req = coord_attributes('dxu', & - 'U cell width through middle', 'm') - var(n_dxu)%coordinates = 'ULON ULAT' - var(n_dyu)%req = coord_attributes('dyu', & - 'U cell height through middle', 'm') - var(n_dyu)%coordinates = 'ULON ULAT' - var(n_HTN)%req = coord_attributes('HTN', & - 'T cell width on North side','m') - var(n_HTN)%coordinates = 'TLON TLAT' - var(n_HTE)%req = coord_attributes('HTE', & - 'T cell width on East side', 'm') - var(n_HTE)%coordinates = 'TLON TLAT' - var(n_ANGLE)%req = coord_attributes('ANGLE', & - 'angle grid makes with latitude line on U grid', & - 'radians') - var(n_ANGLE)%coordinates = 'ULON ULAT' - var(n_ANGLET)%req = coord_attributes('ANGLET', & - 'angle grid makes with latitude line on T grid', & - 'radians') - var(n_ANGLET)%coordinates = 'TLON TLAT' - - ! These fields are required for CF compliance - ! dimensions (nx,ny,nverts) - var_nverts(n_lont_bnds) = coord_attributes('lont_bounds', & - 'longitude boundaries of T cells', 'degrees_east') - var_nverts(n_latt_bnds) = coord_attributes('latt_bounds', & - 'latitude boundaries of T cells', 'degrees_north') - var_nverts(n_lonu_bnds) = coord_attributes('lonu_bounds', & - 'longitude boundaries of U cells', 'degrees_east') - var_nverts(n_latu_bnds) = coord_attributes('latu_bounds', & - 'latitude boundaries of U cells', 'degrees_north') - - !----------------------------------------------------------------- - ! define attributes for time-invariant variables - !----------------------------------------------------------------- - - dimid2(1) = imtid - dimid2(2) = jmtid - - do i = 1, ncoord - status = pio_def_var(File, trim(coord_var(i)%short_name), pio_real, & - dimid2, varid) - status = pio_put_att(File,varid,'long_name',trim(coord_var(i)%long_name)) - status = pio_put_att(File, varid, 'units', trim(coord_var(i)%units)) - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) - if (coord_var(i)%short_name == 'ULAT') then - status = pio_put_att(File,varid,'comment', & - trim('Latitude of NE corner of T grid cell')) - endif - if (f_bounds) then - status = pio_put_att(File, varid, 'bounds', trim(coord_bounds(i))) - endif - enddo - - ! Extra dimensions (NCAT, NZILYR, NZSLYR, NZBLYR, NZALYR) - dimidex(1)=cmtid - dimidex(2)=kmtidi - dimidex(3)=kmtids - dimidex(4)=kmtidb - dimidex(5)=kmtida - - do i = 1, nvarz - if (igrdz(i)) then - status = pio_def_var(File, trim(var_nz(i)%short_name), pio_real, & - (/dimidex(i)/), varid) - status = pio_put_att(File, varid, 'long_name', var_nz(i)%long_name) - status = pio_put_att(File, varid, 'units' , var_nz(i)%units) - endif - enddo - - ! Attributes for tmask defined separately, since it has no units - if (igrd(n_tmask)) then - status = pio_def_var(File, 'tmask', pio_real, dimid2, varid) - status = pio_put_att(File,varid, 'long_name', 'ocean grid mask') - status = pio_put_att(File, varid, 'coordinates', 'TLON TLAT') - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) - status = pio_put_att(File,varid,'comment', '0 = land, 1 = ocean') - endif - if (igrd(n_blkmask)) then - status = pio_def_var(File, 'blkmask', pio_real, dimid2, varid) - status = pio_put_att(File,varid, 'long_name', 'ice grid block mask') - status = pio_put_att(File, varid, 'coordinates', 'TLON TLAT') - status = pio_put_att(File,varid,'comment', 'mytask + iblk/100') - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) - endif - - do i = 3, nvar ! note: n_tmask=1, n_blkmask=2 - if (igrd(i)) then - status = pio_def_var(File, trim(var(i)%req%short_name), & - pio_real, dimid2, varid) - status = pio_put_att(File,varid, 'long_name', trim(var(i)%req%long_name)) - status = pio_put_att(File, varid, 'units', trim(var(i)%req%units)) - status = pio_put_att(File, varid, 'coordinates', trim(var(i)%coordinates)) - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) - endif - enddo - - ! Fields with dimensions (nverts,nx,ny) - dimid_nverts(1) = nvertexid - dimid_nverts(2) = imtid - dimid_nverts(3) = jmtid - do i = 1, nvar_verts - if (f_bounds) then - status = pio_def_var(File, trim(var_nverts(i)%short_name), & - pio_real,dimid_nverts, varid) - status = & - pio_put_att(File,varid, 'long_name', trim(var_nverts(i)%long_name)) - status = & - pio_put_att(File, varid, 'units', trim(var_nverts(i)%units)) - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) - endif - enddo - - !----------------------------------------------------------------- - ! define attributes for time-variant variables - !----------------------------------------------------------------- - - !----------------------------------------------------------------- - ! 2D - !----------------------------------------------------------------- - - dimid3(1) = imtid - dimid3(2) = jmtid - dimid3(3) = timid - - do n=1,num_avail_hist_fields_2D - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimid3, varid) - status = pio_put_att(File,varid,'units', & - trim(avail_hist_fields(n)%vunit)) - status = pio_put_att(File,varid, 'long_name', & - trim(avail_hist_fields(n)%vdesc)) - status = pio_put_att(File,varid,'coordinates', & - trim(avail_hist_fields(n)%vcoord)) - status = pio_put_att(File,varid,'cell_measures', & - trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) - - ! Add cell_methods attribute to variables if averaged - if (hist_avg .and. histfreq(ns) /= '1') then - if (TRIM(avail_hist_fields(n)%vname)/='sig1' & - .or.TRIM(avail_hist_fields(n)%vname)/='sig2' & - .or.TRIM(avail_hist_fields(n)%vname)/='sistreave' & - .or.TRIM(avail_hist_fields(n)%vname)/='sistremax' & - .or.TRIM(avail_hist_fields(n)%vname)/='sigP') then - status = pio_put_att(File,varid,'cell_methods','time: mean') - endif - endif - - if (histfreq(ns) == '1' .or. .not. hist_avg & - .or. n==n_divu(ns) .or. n==n_shear(ns) & ! snapshots - .or. n==n_sig1(ns) .or. n==n_sig2(ns) & - .or. n==n_sigP(ns) .or. n==n_trsig(ns) & - .or. n==n_sistreave(ns) .or. n==n_sistremax(ns) & - .or. n==n_mlt_onset(ns) .or. n==n_frz_onset(ns) & - .or. n==n_hisnap(ns) .or. n==n_aisnap(ns)) then - status = pio_put_att(File,varid,'time_rep','instantaneous') - else - status = pio_put_att(File,varid,'time_rep','averaged') - endif - endif - enddo ! num_avail_hist_fields_2D - - !----------------------------------------------------------------- - ! 3D (category) - !----------------------------------------------------------------- - - dimidz(1) = imtid - dimidz(2) = jmtid - dimidz(3) = cmtid - dimidz(4) = timid - - do n = n2D + 1, n3Dccum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidz, varid) - status = pio_put_att(File,varid,'units', & - trim(avail_hist_fields(n)%vunit)) - status = pio_put_att(File,varid, 'long_name', & - trim(avail_hist_fields(n)%vdesc)) - status = pio_put_att(File,varid,'coordinates', & - trim(avail_hist_fields(n)%vcoord)) - status = pio_put_att(File,varid,'cell_measures', & - trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) - - ! Add cell_methods attribute to variables if averaged - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_put_att(File,varid,'cell_methods','time: mean') - endif - - if (histfreq(ns) == '1' .or. .not. hist_avg) then - status = pio_put_att(File,varid,'time_rep','instantaneous') - else - status = pio_put_att(File,varid,'time_rep','averaged') - endif - endif - enddo ! num_avail_hist_fields_3Dc - - !----------------------------------------------------------------- - ! 3D (ice layers) - !----------------------------------------------------------------- - - dimidz(1) = imtid - dimidz(2) = jmtid - dimidz(3) = kmtidi - dimidz(4) = timid - - do n = n3Dccum + 1, n3Dzcum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidz, varid) - status = pio_put_att(File,varid,'units', & - trim(avail_hist_fields(n)%vunit)) - status = pio_put_att(File,varid, 'long_name', & - trim(avail_hist_fields(n)%vdesc)) - status = pio_put_att(File,varid,'coordinates', & - trim(avail_hist_fields(n)%vcoord)) - status = pio_put_att(File,varid,'cell_measures', & - trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) - - ! Add cell_methods attribute to variables if averaged - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_put_att(File,varid,'cell_methods','time: mean') - endif - - if (histfreq(ns) == '1' .or. .not. hist_avg) then - status = pio_put_att(File,varid,'time_rep','instantaneous') - else - status = pio_put_att(File,varid,'time_rep','averaged') - endif - endif - enddo ! num_avail_hist_fields_3Dz - - !----------------------------------------------------------------- - ! 3D (biology ice layers) - !----------------------------------------------------------------- - - dimidz(1) = imtid - dimidz(2) = jmtid - dimidz(3) = kmtidb - dimidz(4) = timid - - do n = n3Dzcum + 1, n3Dbcum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidz, varid) - status = pio_put_att(File,varid,'units', & - trim(avail_hist_fields(n)%vunit)) - status = pio_put_att(File,varid, 'long_name', & - trim(avail_hist_fields(n)%vdesc)) - status = pio_put_att(File,varid,'coordinates', & - trim(avail_hist_fields(n)%vcoord)) - status = pio_put_att(File,varid,'cell_measures', & - trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) - - ! Add cell_methods attribute to variables if averaged - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_put_att(File,varid,'cell_methods','time: mean') - endif - - if (histfreq(ns) == '1' .or. .not. hist_avg) then - status = pio_put_att(File,varid,'time_rep','instantaneous') - else - status = pio_put_att(File,varid,'time_rep','averaged') - endif - endif - enddo ! num_avail_hist_fields_3Db - - !----------------------------------------------------------------- - ! 3D (biology snow layers) - !----------------------------------------------------------------- - - dimidz(1) = imtid - dimidz(2) = jmtid - dimidz(3) = kmtida - dimidz(4) = timid - - do n = n3Dbcum + 1, n3Dacum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidz, varid) - status = pio_put_att(File,varid,'units', & - trim(avail_hist_fields(n)%vunit)) - status = pio_put_att(File,varid, 'long_name', & - trim(avail_hist_fields(n)%vdesc)) - status = pio_put_att(File,varid,'coordinates', & - trim(avail_hist_fields(n)%vcoord)) - status = pio_put_att(File,varid,'cell_measures', & - trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) - - ! Add cell_methods attribute to variables if averaged - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_put_att(File,varid,'cell_methods','time: mean') - endif - - if (histfreq(ns) == '1' .or. .not. hist_avg) then - status = pio_put_att(File,varid,'time_rep','instantaneous') - else - status = pio_put_att(File,varid,'time_rep','averaged') - endif - endif - enddo ! num_avail_hist_fields_3Da - - !----------------------------------------------------------------- - ! define attributes for 4D variables - ! time coordinate is dropped - !----------------------------------------------------------------- - - !----------------------------------------------------------------- - ! 4D (ice categories) - !----------------------------------------------------------------- - - dimidcz(1) = imtid - dimidcz(2) = jmtid - dimidcz(3) = kmtidi - dimidcz(4) = cmtid - dimidcz(5) = timid - - do n = n3Dacum + 1, n4Dicum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidcz, varid) - status = pio_put_att(File,varid,'units', & - trim(avail_hist_fields(n)%vunit)) - status = pio_put_att(File,varid, 'long_name', & - trim(avail_hist_fields(n)%vdesc)) - status = pio_put_att(File,varid,'coordinates', & - trim(avail_hist_fields(n)%vcoord)) - status = pio_put_att(File,varid,'cell_measures', & - trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) - - ! Add cell_methods attribute to variables if averaged - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_put_att(File,varid,'cell_methods','time: mean') - endif - - if (histfreq(ns) == '1' .or. .not. hist_avg) then - status = pio_put_att(File,varid,'time_rep','instantaneous') - else - status = pio_put_att(File,varid,'time_rep','averaged') - endif - endif - enddo ! num_avail_hist_fields_4Di - - !----------------------------------------------------------------- - ! 4D (snow layers) - !----------------------------------------------------------------- - - dimidcz(1) = imtid - dimidcz(2) = jmtid - dimidcz(3) = kmtids - dimidcz(4) = cmtid - dimidcz(5) = timid - - do n = n4Dicum + 1, n4Dscum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidcz, varid) - status = pio_put_att(File,varid,'units', & - trim(avail_hist_fields(n)%vunit)) - status = pio_put_att(File,varid, 'long_name', & - trim(avail_hist_fields(n)%vdesc)) - status = pio_put_att(File,varid,'coordinates', & - trim(avail_hist_fields(n)%vcoord)) - status = pio_put_att(File,varid,'cell_measures', & - trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) - - ! Add cell_methods attribute to variables if averaged - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_put_att(File,varid,'cell_methods','time: mean') - endif - - if (histfreq(ns) == '1' .or. .not. hist_avg) then - status = pio_put_att(File,varid,'time_rep','instantaneous') - else - status = pio_put_att(File,varid,'time_rep','averaged') - endif - endif - enddo ! num_avail_hist_fields_4Ds - - !----------------------------------------------------------------- - ! global attributes - !----------------------------------------------------------------- - ! ... the user should change these to something useful ... - !----------------------------------------------------------------- -#ifdef CESMCOUPLED - status = pio_put_att(File,pio_global,'title',runid) -#else - title = 'sea ice model output for CICE' - status = pio_put_att(File,pio_global,'title',trim(title)) -#endif - title = 'Diagnostic and Prognostic Variables' - status = pio_put_att(File,pio_global,'contents',trim(title)) - - write(title,'(2a)') 'Los Alamos Sea Ice Model, ', trim(version_name) - status = pio_put_att(File,pio_global,'source',trim(title)) - - if (use_leap_years) then - write(title,'(a,i3,a)') 'This year has ',int(dayyr),' days' - else - write(title,'(a,i3,a)') 'All years have exactly ',int(dayyr),' days' - endif - status = pio_put_att(File,pio_global,'comment',trim(title)) - - write(title,'(a,i8.8)') 'File written on model date ',idate - status = pio_put_att(File,pio_global,'comment2',trim(title)) - - write(title,'(a,i6)') 'seconds elapsed into model date: ',sec - status = pio_put_att(File,pio_global,'comment3',trim(title)) - - title = 'CF-1.0' - status = & - pio_put_att(File,pio_global,'conventions',trim(title)) - - call date_and_time(date=current_date, time=current_time) - write(start_time,1000) current_date(1:4), current_date(5:6), & - current_date(7:8), current_time(1:2), & - current_time(3:4) -1000 format('This dataset was created on ', & - a,'-',a,'-',a,' at ',a,':',a) - status = pio_put_att(File,pio_global,'history',trim(start_time)) - - status = pio_put_att(File,pio_global,'io_flavor','io_pio') - - !----------------------------------------------------------------- - ! end define mode - !----------------------------------------------------------------- - - status = pio_enddef(File) - - !----------------------------------------------------------------- - ! write time variable - !----------------------------------------------------------------- - - status = pio_inq_varid(File,'time',varid) -!sgl status = pio_put_var(File,varid,(/1/),ltime) - status = pio_put_var(File,varid,(/1/),ltime2) - - !----------------------------------------------------------------- - ! write time_bounds info - !----------------------------------------------------------------- - - if (hist_avg .and. histfreq(ns) /= '1') then - status = pio_inq_varid(File,'time_bounds',varid) - time_bounds=(/time_beg(ns),time_end(ns)/) - bnd_start = (/1,1/) - bnd_length = (/2,1/) - status = pio_put_var(File,varid,ival=time_bounds, & - start=bnd_start(:),count=bnd_length(:)) - endif - - !----------------------------------------------------------------- - ! write coordinate variables - !----------------------------------------------------------------- - - allocate(workr2(nx_block,ny_block,nblocks)) - - do i = 1,ncoord - status = pio_inq_varid(File, coord_var(i)%short_name, varid) - SELECT CASE (coord_var(i)%short_name) - CASE ('TLON') - ! Convert T grid longitude from -180 -> 180 to 0 to 360 - workr2(:,:,:) = mod(tlon(:,:,1:nblocks)*rad_to_deg + c360, c360) - CASE ('TLAT') - workr2(:,:,:) = tlat(:,:,1:nblocks)*rad_to_deg - CASE ('ULON') - workr2(:,:,:) = ulon(:,:,1:nblocks)*rad_to_deg - CASE ('ULAT') - workr2(:,:,:) = ulat(:,:,1:nblocks)*rad_to_deg - END SELECT - call pio_write_darray(File, varid, iodesc2d, & - workr2, status, fillval=spval_dbl) - enddo - - ! Extra dimensions (NCAT, VGRD*) - - do i = 1, nvarz - if (igrdz(i)) then - status = pio_inq_varid(File, var_nz(i)%short_name, varid) - SELECT CASE (var_nz(i)%short_name) - CASE ('NCAT') - status = pio_put_var(File, varid, hin_max(1:ncat_hist)) - CASE ('VGRDi') - status = pio_put_var(File, varid, (/(k, k=1,nzilyr)/)) - CASE ('VGRDs') - status = pio_put_var(File, varid, (/(k, k=1,nzslyr)/)) - CASE ('VGRDb') - status = pio_put_var(File, varid, (/(k, k=1,nzblyr)/)) - CASE ('VGRDa') - status = pio_put_var(File, varid, (/(k, k=1,nzalyr)/)) - END SELECT - endif - enddo - - !----------------------------------------------------------------- - ! write grid masks, area and rotation angle - !----------------------------------------------------------------- - -! if (igrd(n_tmask)) then -! status = pio_inq_varid(File, 'tmask', varid) -! call pio_write_darray(File, varid, iodesc2d, & -! hm(:,:,1:nblocks), status, fillval=spval_dbl) -! endif -! if (igrd(n_blkmask)) then -! status = pio_inq_varid(File, 'blkmask', varid) -! call pio_write_darray(File, varid, iodesc2d, & -! bm(:,:,1:nblocks), status, fillval=spval_dbl) -! endif - - do i = 1, nvar ! note: n_tmask=1, n_blkmask=2 - if (igrd(i)) then - SELECT CASE (var(i)%req%short_name) - CASE ('tmask') - workr2 = hm(:,:,1:nblocks) - CASE ('blkmask') - workr2 = bm(:,:,1:nblocks) - CASE ('tarea') - workr2 = tarea(:,:,1:nblocks) - CASE ('uarea') - workr2 = uarea(:,:,1:nblocks) - CASE ('dxu') - workr2 = dxu(:,:,1:nblocks) - CASE ('dyu') - workr2 = dyu(:,:,1:nblocks) - CASE ('dxt') - workr2 = dxt(:,:,1:nblocks) - CASE ('dyt') - workr2 = dyt(:,:,1:nblocks) - CASE ('HTN') - workr2 = HTN(:,:,1:nblocks) - CASE ('HTE') - workr2 = HTE(:,:,1:nblocks) - CASE ('ANGLE') - workr2 = ANGLE(:,:,1:nblocks) - CASE ('ANGLET') - workr2 = ANGLET(:,:,1:nblocks) - END SELECT - status = pio_inq_varid(File, var(i)%req%short_name, varid) - call pio_write_darray(File, varid, iodesc2d, & - workr2, status, fillval=spval_dbl) - endif - enddo - - !---------------------------------------------------------------- - ! Write coordinates of grid box vertices - !---------------------------------------------------------------- - - if (f_bounds) then - allocate(workr3v(nverts,nx_block,ny_block,nblocks)) - workr3v (:,:,:,:) = c0 - do i = 1, nvar_verts - SELECT CASE (var_nverts(i)%short_name) - CASE ('lont_bounds') - do ivertex = 1, nverts - workr3v(ivertex,:,:,:) = lont_bounds(ivertex,:,:,1:nblocks) - enddo - CASE ('latt_bounds') - do ivertex = 1, nverts - workr3v(ivertex,:,:,:) = latt_bounds(ivertex,:,:,1:nblocks) - enddo - CASE ('lonu_bounds') - do ivertex = 1, nverts - workr3v(ivertex,:,:,:) = lonu_bounds(ivertex,:,:,1:nblocks) - enddo - CASE ('latu_bounds') - do ivertex = 1, nverts - workr3v(ivertex,:,:,:) = latu_bounds(ivertex,:,:,1:nblocks) - enddo - END SELECT - - status = pio_inq_varid(File, var_nverts(i)%short_name, varid) - call pio_write_darray(File, varid, iodesc3dv, & - workr3v, status, fillval=spval_dbl) - enddo - deallocate(workr3v) - endif ! f_bounds - - - !----------------------------------------------------------------- - ! write variable data - !----------------------------------------------------------------- - - ! 2D - do n=1,num_avail_hist_fields_2D - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) - if (status /= pio_noerr) call abort_ice(subname// & - 'ERROR getting varid for '//avail_hist_fields(n)%vname) - workr2(:,:,:) = a2D(:,:,n,1:nblocks) - call pio_setframe(varid, int(1,kind=PIO_OFFSET)) - call pio_write_darray(File, varid, iodesc2d,& - workr2, status, fillval=spval_dbl) - endif - enddo ! num_avail_hist_fields_2D - - deallocate(workr2) - - ! 3D (category) - allocate(workr3(nx_block,ny_block,nblocks,ncat_hist)) - do n = n2D + 1, n3Dccum - nn = n - n2D - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) - if (status /= pio_noerr) call abort_ice(subname// & - 'ERROR: getting varid for '//avail_hist_fields(n)%vname) - do j = 1, nblocks - do i = 1, ncat_hist - workr3(:,:,j,i) = a3Dc(:,:,i,nn,j) - enddo - enddo - call pio_setframe(varid, int(1,kind=PIO_OFFSET)) - call pio_write_darray(File, varid, iodesc3dc,& - workr3, status, fillval=spval_dbl) - endif - enddo ! num_avail_hist_fields_3Dc - deallocate(workr3) - - ! 3D (vertical ice) - allocate(workr3(nx_block,ny_block,nblocks,nzilyr)) - do n = n3Dccum+1, n3Dzcum - nn = n - n3Dccum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) - if (status /= pio_noerr) call abort_ice(subname// & - 'ERROR: getting varid for '//avail_hist_fields(n)%vname) - do j = 1, nblocks - do i = 1, nzilyr - workr3(:,:,j,i) = a3Dz(:,:,i,nn,j) - enddo - enddo - call pio_setframe(varid, int(1,kind=PIO_OFFSET)) - call pio_write_darray(File, varid, iodesc3di,& - workr3, status, fillval=spval_dbl) - endif - enddo ! num_avail_hist_fields_3Dz - deallocate(workr3) - - ! 3D (vertical ice biology) - allocate(workr3(nx_block,ny_block,nblocks,nzblyr)) - do n = n3Dzcum+1, n3Dbcum - nn = n - n3Dzcum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) - if (status /= pio_noerr) call abort_ice(subname// & - 'ERROR: getting varid for '//avail_hist_fields(n)%vname) - do j = 1, nblocks - do i = 1, nzblyr - workr3(:,:,j,i) = a3Db(:,:,i,nn,j) - enddo - enddo - call pio_setframe(varid, int(1,kind=PIO_OFFSET)) - call pio_write_darray(File, varid, iodesc3db,& - workr3, status, fillval=spval_dbl) - endif - enddo ! num_avail_hist_fields_3Db - deallocate(workr3) - - ! 3D (vertical snow biology) - allocate(workr3(nx_block,ny_block,nblocks,nzalyr)) - do n = n3Dbcum+1, n3Dacum - nn = n - n3Dbcum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) - if (status /= pio_noerr) call abort_ice(subname// & - 'ERROR: getting varid for '//avail_hist_fields(n)%vname) - do j = 1, nblocks - do i = 1, nzalyr - workr3(:,:,j,i) = a3Da(:,:,i,nn,j) - enddo - enddo - call pio_setframe(varid, int(1,kind=PIO_OFFSET)) -! call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) - call pio_write_darray(File, varid, iodesc3da,& - workr3, status, fillval=spval_dbl) - endif - enddo ! num_avail_hist_fields_3Db - deallocate(workr3) - - allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzilyr)) - ! 4D (categories, vertical ice) - do n = n3Dacum+1, n4Dicum - nn = n - n3Dacum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) - if (status /= pio_noerr) call abort_ice(subname// & - 'ERROR: getting varid for '//avail_hist_fields(n)%vname) - do j = 1, nblocks - do i = 1, ncat_hist - do k = 1, nzilyr - workr4(:,:,j,i,k) = a4Di(:,:,k,i,nn,j) - enddo ! k - enddo ! i - enddo ! j - call pio_setframe(varid, int(1,kind=PIO_OFFSET)) - call pio_write_darray(File, varid, iodesc4di,& - workr4, status, fillval=spval_dbl) - endif - enddo ! num_avail_hist_fields_4Di - deallocate(workr4) - - allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzslyr)) - ! 4D (categories, vertical ice) - do n = n4Dicum+1, n4Dscum - nn = n - n4Dicum - if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then - status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) - if (status /= pio_noerr) call abort_ice(subname// & - 'ERROR: getting varid for '//avail_hist_fields(n)%vname) - do j = 1, nblocks - do i = 1, ncat_hist - do k = 1, nzslyr - workr4(:,:,j,i,k) = a4Ds(:,:,k,i,nn,j) - enddo ! k - enddo ! i - enddo ! j - call pio_setframe(varid, int(1,kind=PIO_OFFSET)) -! call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) - call pio_write_darray(File, varid, iodesc4ds,& - workr4, status, fillval=spval_dbl) - endif - enddo ! num_avail_hist_fields_4Di - deallocate(workr4) - -! similarly for num_avail_hist_fields_4Db (define workr4b, iodesc4db) - - - !----------------------------------------------------------------- - ! clean-up PIO descriptors - !----------------------------------------------------------------- - - call pio_freedecomp(File,iodesc2d) - call pio_freedecomp(File,iodesc3dv) - call pio_freedecomp(File,iodesc3dc) - call pio_freedecomp(File,iodesc3di) - call pio_freedecomp(File,iodesc3db) - call pio_freedecomp(File,iodesc3da) - call pio_freedecomp(File,iodesc4di) - call pio_freedecomp(File,iodesc4ds) - - !----------------------------------------------------------------- - ! close output dataset - !----------------------------------------------------------------- - - call pio_closefile(File) - if (my_task == master_task) then - write(nu_diag,*) ' ' - write(nu_diag,*) 'Finished writing ',trim(ncfile(ns)) - endif - -#endif - - end subroutine ice_write_hist - -!======================================================================= - - end module ice_history_write - -!======================================================================= diff --git a/cicecore/cicedynB/infrastructure/io/io_pio/ice_pio.F90 b/cicecore/cicedynB/infrastructure/io/io_pio/ice_pio.F90 deleted file mode 100644 index 5fff64944..000000000 --- a/cicecore/cicedynB/infrastructure/io/io_pio/ice_pio.F90 +++ /dev/null @@ -1,365 +0,0 @@ -!============================================================================ -! Writes netcdf files -! Created by Mariana Vertenstein, June 2009 - - module ice_pio - - use shr_kind_mod, only: r8 => shr_kind_r8, in=>shr_kind_in - use shr_kind_mod, only: cl => shr_kind_cl - use shr_sys_mod , only: shr_sys_flush - use ice_kinds_mod - use ice_blocks - use ice_broadcast - use ice_communicate - use ice_domain, only : nblocks, blocks_ice - use ice_domain_size - use ice_fileunits - use ice_exit, only: abort_ice - use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use pio - - implicit none - private - - interface ice_pio_initdecomp - module procedure ice_pio_initdecomp_2d - module procedure ice_pio_initdecomp_3d - module procedure ice_pio_initdecomp_4d - module procedure ice_pio_initdecomp_3d_inner - end interface - - public ice_pio_init - public ice_pio_initdecomp - - type(iosystem_desc_t), pointer, public :: ice_pio_subsystem - -!=============================================================================== - - contains - -!=============================================================================== - -! Initialize the io subsystem -! 2009-Feb-17 - J. Edwards - initial version - - subroutine ice_pio_init(mode, filename, File, clobber, cdf64) - - use shr_pio_mod, only: shr_pio_getiosys, shr_pio_getiotype - - implicit none - character(len=*) , intent(in), optional :: mode - character(len=*) , intent(in), optional :: filename - type(file_desc_t) , intent(inout), optional :: File - logical , intent(in), optional :: clobber - logical , intent(in), optional :: cdf64 - - ! local variables - - integer (int_kind) :: & - nml_error ! namelist read error flag - - integer :: pio_iotype - logical :: exists - logical :: lclobber - logical :: lcdf64 - integer :: status - integer :: nmode - character(len=*), parameter :: subname = '(ice_pio_init)' - logical, save :: first_call = .true. - - ice_pio_subsystem => shr_pio_getiosys(inst_name) - pio_iotype = shr_pio_getiotype(inst_name) - - if (present(mode) .and. present(filename) .and. present(File)) then - - if (trim(mode) == 'write') then - lclobber = .false. - if (present(clobber)) lclobber=clobber - - lcdf64 = .false. - if (present(cdf64)) lcdf64=cdf64 - - if (File%fh<0) then - ! filename not open - inquire(file=trim(filename),exist=exists) - if (exists) then - if (lclobber) then - nmode = pio_clobber - if (lcdf64) nmode = ior(nmode,PIO_64BIT_OFFSET) - status = pio_createfile(ice_pio_subsystem, File, pio_iotype, trim(filename), nmode) - if (my_task == master_task) then - write(nu_diag,*) subname,' create file ',trim(filename) - end if - else - nmode = pio_write - status = pio_openfile(ice_pio_subsystem, File, pio_iotype, trim(filename), nmode) - if (my_task == master_task) then - write(nu_diag,*) subname,' open file ',trim(filename) - end if - endif - else - nmode = pio_noclobber - if (lcdf64) nmode = ior(nmode,PIO_64BIT_OFFSET) - status = pio_createfile(ice_pio_subsystem, File, pio_iotype, trim(filename), nmode) - if (my_task == master_task) then - write(nu_diag,*) subname,' create file ',trim(filename) - end if - endif - else - ! filename is already open, just return - endif - end if - - if (trim(mode) == 'read') then - inquire(file=trim(filename),exist=exists) - if (exists) then - status = pio_openfile(ice_pio_subsystem, File, pio_iotype, trim(filename), pio_nowrite) - else - if(my_task==master_task) then - write(nu_diag,*) 'ice_pio_ropen ERROR: file invalid ',trim(filename) - end if - call abort_ice(subname//'ERROR: aborting with invalid file') - endif - end if - - end if - - end subroutine ice_pio_init - -!================================================================================ - - subroutine ice_pio_initdecomp_2d(iodesc) - - type(io_desc_t), intent(out) :: iodesc - - integer (kind=int_kind) :: & - iblk,ilo,ihi,jlo,jhi,lon,lat,i,j,n,k - - type(block) :: this_block - - integer(kind=int_kind), pointer :: dof2d(:) - character(len=*), parameter :: subname = '(ice_pio_initdecomp_2d)' - - allocate(dof2d(nx_block*ny_block*nblocks)) - - n=0 - do iblk = 1, nblocks - this_block = get_block(blocks_ice(iblk),iblk) - ilo = this_block%ilo - ihi = this_block%ihi - jlo = this_block%jlo - jhi = this_block%jhi - - do j=1,ny_block - do i=1,nx_block - n = n+1 - if (j < jlo .or. j>jhi) then - dof2d(n) = 0 - else if (i < ilo .or. i > ihi) then - dof2d(n) = 0 - else - lon = this_block%i_glob(i) - lat = this_block%j_glob(j) - dof2d(n) = (lat-1)*nx_global + lon - endif - enddo !i - enddo !j - end do - - call pio_initdecomp(ice_pio_subsystem, pio_double, (/nx_global,ny_global/), & - dof2d, iodesc) - - deallocate(dof2d) - - end subroutine ice_pio_initdecomp_2d - -!================================================================================ - - subroutine ice_pio_initdecomp_3d (ndim3, iodesc, remap) - - integer(kind=int_kind), intent(in) :: ndim3 - type(io_desc_t), intent(out) :: iodesc - logical, optional :: remap - integer (kind=int_kind) :: & - iblk,ilo,ihi,jlo,jhi,lon,lat,i,j,n,k - - type(block) :: this_block - logical :: lremap - integer(kind=int_kind), pointer :: dof3d(:) - character(len=*), parameter :: subname = '(ice_pio_initdecomp_2d)' - - allocate(dof3d(nx_block*ny_block*nblocks*ndim3)) - lremap=.false. - if (present(remap)) lremap=remap - if (lremap) then - ! Reorder the ndim3 and nblocks loops to avoid a temporary array in restart read/write - n=0 - do iblk = 1, nblocks - this_block = get_block(blocks_ice(iblk),iblk) - ilo = this_block%ilo - ihi = this_block%ihi - jlo = this_block%jlo - jhi = this_block%jhi - do k=1,ndim3 - do j=1,ny_block - do i=1,nx_block - n = n+1 - if (j < jlo .or. j>jhi) then - dof3d(n)=0 - else if (i < ilo .or. i > ihi) then - dof3d(n) = 0 - else - lon = this_block%i_glob(i) - lat = this_block%j_glob(j) - dof3d(n) = ((lat-1)*nx_global + lon) + (k-1)*nx_global*ny_global - endif - enddo !i - enddo !j - enddo !ndim3 - enddo ! iblk - else - n=0 - do k=1,ndim3 - do iblk = 1, nblocks - this_block = get_block(blocks_ice(iblk),iblk) - ilo = this_block%ilo - ihi = this_block%ihi - jlo = this_block%jlo - jhi = this_block%jhi - do j=1,ny_block - do i=1,nx_block - n = n+1 - if (j < jlo .or. j>jhi) then - dof3d(n)=0 - else if (i < ilo .or. i > ihi) then - dof3d(n) = 0 - else - lon = this_block%i_glob(i) - lat = this_block%j_glob(j) - dof3d(n) = ((lat-1)*nx_global + lon) + (k-1)*nx_global*ny_global - endif - enddo !i - enddo !j - enddo ! iblk - enddo !ndim3 - endif - - call pio_initdecomp(ice_pio_subsystem, pio_double, (/nx_global,ny_global,ndim3/), & - dof3d, iodesc) - - deallocate(dof3d) - - end subroutine ice_pio_initdecomp_3d - -!================================================================================ - - subroutine ice_pio_initdecomp_3d_inner(ndim3, inner_dim, iodesc) - - integer(kind=int_kind), intent(in) :: ndim3 - logical, intent(in) :: inner_dim - type(io_desc_t), intent(out) :: iodesc - - integer (kind=int_kind) :: & - iblk,ilo,ihi,jlo,jhi,lon,lat,i,j,n,k - - type(block) :: this_block - - integer(kind=int_kind), pointer :: dof3d(:) - - character(len=*), parameter :: subname = '(ice_pio_initdecomp_3d_inner)' - - allocate(dof3d(nx_block*ny_block*nblocks*ndim3)) - - n=0 - do iblk = 1, nblocks - this_block = get_block(blocks_ice(iblk),iblk) - ilo = this_block%ilo - ihi = this_block%ihi - jlo = this_block%jlo - jhi = this_block%jhi - - do j=1,ny_block - do i=1,nx_block - do k=1,ndim3 - n = n+1 - if (j < jlo .or. j>jhi) then - dof3d(n) = 0 - else if (i < ilo .or. i > ihi) then - dof3d(n) = 0 - else - lon = this_block%i_glob(i) - lat = this_block%j_glob(j) - dof3d(n) = k + ((lon-1) + (lat-1)*nx_global)*ndim3 - endif - end do !ndim3 - enddo !i - enddo !j - end do !iblk - - call pio_initdecomp(ice_pio_subsystem, pio_double, (/ndim3,nx_global,ny_global/), & - dof3d, iodesc) - - deallocate(dof3d) - - end subroutine ice_pio_initdecomp_3d_inner - -!================================================================================ - - subroutine ice_pio_initdecomp_4d (ndim3, ndim4, iodesc) - - integer(kind=int_kind), intent(in) :: ndim3, ndim4 - type(io_desc_t), intent(out) :: iodesc - - integer (kind=int_kind) :: & - iblk,ilo,ihi,jlo,jhi,lon,lat,i,j,n,k,l - - type(block) :: this_block - - integer(kind=int_kind), pointer :: dof4d(:) - - character(len=*), parameter :: subname = '(ice_pio_initdecomp_4d)' - - allocate(dof4d(nx_block*ny_block*nblocks*ndim3*ndim4)) - - n=0 - do l=1,ndim4 - do k=1,ndim3 - do iblk = 1, nblocks - this_block = get_block(blocks_ice(iblk),iblk) - ilo = this_block%ilo - ihi = this_block%ihi - jlo = this_block%jlo - jhi = this_block%jhi - - do j=1,ny_block - do i=1,nx_block - n = n+1 - if (j < jlo .or. j>jhi) then - dof4d(n)=0 - else if (i < ilo .or. i > ihi) then - dof4d(n) = 0 - else - lon = this_block%i_glob(i) - lat = this_block%j_glob(j) - dof4d(n) = ((lat-1)*nx_global + lon) & - + (k-1)*nx_global*ny_global & - + (l-1)*nx_global*ny_global*ndim3 - endif - enddo !i - enddo !j - enddo ! iblk - enddo !ndim3 - enddo !ndim4 - - call pio_initdecomp(ice_pio_subsystem, pio_double, & - (/nx_global,ny_global,ndim3,ndim4/), dof4d, iodesc) - - deallocate(dof4d) - - end subroutine ice_pio_initdecomp_4d - -!================================================================================ - - end module ice_pio - -!================================================================================ diff --git a/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 deleted file mode 100644 index d673c7f7a..000000000 --- a/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 +++ /dev/null @@ -1,884 +0,0 @@ -!======================================================================= -! -! Read and write ice model restart files using pio interfaces. -! authors David A Bailey, NCAR - - module ice_restart - - use ice_broadcast - use ice_exit, only: abort_ice - use ice_fileunits, only: nu_diag, nu_restart, nu_rst_pointer - use ice_kinds_mod - use ice_restart_shared, only: & - restart, restart_ext, restart_dir, restart_file, pointer_file, & - runid, runtype, use_restart_time, restart_format, lcdf64, lenstr - use ice_pio - use pio - use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_indices - use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_sizes - - implicit none - private - public :: init_restart_write, init_restart_read, & - read_restart_field, write_restart_field, final_restart - - type(file_desc_t) :: File - type(var_desc_t) :: vardesc - - type(io_desc_t) :: iodesc2d - type(io_desc_t) :: iodesc3d_ncat - -!======================================================================= - - contains - -!======================================================================= - -! Sets up restart file for reading. -! author David A Bailey, NCAR - - subroutine init_restart_read(ice_ic) - - use ice_calendar, only: istep0, istep1, time, time_forc, nyr, month, & - mday, sec, npt - use ice_communicate, only: my_task, master_task - use ice_domain_size, only: ncat - use ice_read_write, only: ice_open - - character(len=char_len_long), intent(in), optional :: ice_ic - - ! local variables - - character(len=char_len_long) :: & - filename, filename0 - - integer (kind=int_kind) :: status - - character(len=*), parameter :: subname = '(init_restart_read)' - - if (present(ice_ic)) then - filename = trim(ice_ic) - else - if (my_task == master_task) then - open(nu_rst_pointer,file=pointer_file) - read(nu_rst_pointer,'(a)') filename0 - filename = trim(filename0) - close(nu_rst_pointer) - write(nu_diag,*) 'Read ',pointer_file(1:lenstr(pointer_file)) - endif - call broadcast_scalar(filename, master_task) - endif - - if (my_task == master_task) then - write(nu_diag,*) 'Using restart dump=', trim(filename) - end if - - if (restart_format == 'pio') then - File%fh=-1 - call ice_pio_init(mode='read', filename=trim(filename), File=File) - - call ice_pio_initdecomp(iodesc=iodesc2d) - call ice_pio_initdecomp(ndim3=ncat , iodesc=iodesc3d_ncat,remap=.true.) - - if (use_restart_time) then - status = pio_get_att(File, pio_global, 'istep1', istep0) - status = pio_get_att(File, pio_global, 'time', time) - status = pio_get_att(File, pio_global, 'time_forc', time_forc) - call pio_seterrorhandling(File, PIO_BCAST_ERROR) - status = pio_get_att(File, pio_global, 'nyr', nyr) - call pio_seterrorhandling(File, PIO_INTERNAL_ERROR) - if (status == PIO_noerr) then - status = pio_get_att(File, pio_global, 'month', month) - status = pio_get_att(File, pio_global, 'mday', mday) - status = pio_get_att(File, pio_global, 'sec', sec) - endif - endif ! use namelist values if use_restart_time = F - endif - - if (my_task == master_task) then - write(nu_diag,*) 'Restart read at istep=',istep0,time,time_forc - endif - - call broadcast_scalar(istep0,master_task) - call broadcast_scalar(time,master_task) - call broadcast_scalar(time_forc,master_task) - call broadcast_scalar(nyr,master_task) - - istep1 = istep0 - - ! if runid is bering then need to correct npt for istep0 - if (trim(runid) == 'bering') then - npt = npt - istep0 - endif - - end subroutine init_restart_read - -!======================================================================= - -! Sets up restart file for writing. -! author David A Bailey, NCAR - - subroutine init_restart_write(filename_spec) - - use ice_calendar, only: sec, month, mday, nyr, istep1, & - 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_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 - - logical (kind=log_kind) :: & - solve_zsal, skl_bgc, z_tracers - - logical (kind=log_kind) :: & - 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_PON, tr_bgc_DON, & - tr_zaero, tr_bgc_Fe, & - tr_bgc_hum - - integer (kind=int_kind) :: & - nbtrcr - - character(len=char_len_long), intent(in), optional :: filename_spec - - ! local variables - - integer (kind=int_kind) :: & - iyear, imonth, iday ! year, month, day - - character(len=char_len_long) :: filename - - integer (kind=int_kind) :: dimid_ni, dimid_nj, dimid_ncat, & - dimid_nilyr, dimid_nslyr, dimid_naero - - integer (kind=int_kind), allocatable :: dims(:) - - integer (kind=int_kind) :: & - k, n, & ! loop index - status ! status variable from netCDF routine - - character (len=3) :: nchar, ncharb - - character(len=*), parameter :: subname = '(init_restart_write)' - - 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_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, & - tr_bgc_chl_out=tr_bgc_chl, tr_bgc_Am_out=tr_bgc_Am, & - tr_bgc_PON_out=tr_bgc_PON, tr_bgc_DON_out=tr_bgc_DON, & - tr_zaero_out=tr_zaero, tr_bgc_Fe_out=tr_bgc_Fe, & - tr_bgc_hum_out=tr_bgc_hum) - call icepack_query_parameters(solve_zsal_out=solve_zsal, skl_bgc_out=skl_bgc, & - z_tracers_out=z_tracers) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - ! construct path/file - if (present(filename_spec)) then - filename = trim(filename_spec) - else - iyear = nyr + year_init - 1 - imonth = month - iday = mday - - 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)),'.', & - iyear,'-',month,'-',mday,'-',sec - end if - - if (restart_format /= 'bin') filename = trim(filename) // '.nc' - - ! write pointer (path/file) - if (my_task == master_task) then - open(nu_rst_pointer,file=pointer_file) - write(nu_rst_pointer,'(a)') filename - close(nu_rst_pointer) - endif - - if (restart_format == 'pio') then - - File%fh=-1 - call ice_pio_init(mode='write',filename=trim(filename), File=File, & - clobber=.true., cdf64=lcdf64 ) - - status = pio_put_att(File,pio_global,'istep1',istep1) - status = pio_put_att(File,pio_global,'time',time) - status = pio_put_att(File,pio_global,'time_forc',time_forc) - status = pio_put_att(File,pio_global,'nyr',nyr) - status = pio_put_att(File,pio_global,'month',month) - status = pio_put_att(File,pio_global,'mday',mday) - status = pio_put_att(File,pio_global,'sec',sec) - - status = pio_def_dim(File,'ni',nx_global,dimid_ni) - status = pio_def_dim(File,'nj',ny_global,dimid_nj) - status = pio_def_dim(File,'ncat',ncat,dimid_ncat) - - !----------------------------------------------------------------- - ! 2D restart fields - !----------------------------------------------------------------- - - allocate(dims(2)) - - dims(1) = dimid_ni - dims(2) = dimid_nj - - call define_rest_field(File,'uvel',dims) - call define_rest_field(File,'vvel',dims) - -#ifdef CESMCOUPLED - call define_rest_field(File,'coszen',dims) -#endif - call define_rest_field(File,'scale_factor',dims) - call define_rest_field(File,'swvdr',dims) - call define_rest_field(File,'swvdf',dims) - call define_rest_field(File,'swidr',dims) - call define_rest_field(File,'swidf',dims) - - call define_rest_field(File,'strocnxT',dims) - call define_rest_field(File,'strocnyT',dims) - - call define_rest_field(File,'stressp_1',dims) - call define_rest_field(File,'stressp_2',dims) - call define_rest_field(File,'stressp_3',dims) - call define_rest_field(File,'stressp_4',dims) - - call define_rest_field(File,'stressm_1',dims) - call define_rest_field(File,'stressm_2',dims) - call define_rest_field(File,'stressm_3',dims) - call define_rest_field(File,'stressm_4',dims) - - call define_rest_field(File,'stress12_1',dims) - call define_rest_field(File,'stress12_2',dims) - call define_rest_field(File,'stress12_3',dims) - call define_rest_field(File,'stress12_4',dims) - - call define_rest_field(File,'iceumask',dims) - - if (oceanmixed_ice) then - call define_rest_field(File,'sst',dims) - call define_rest_field(File,'frzmlt',dims) - endif - - if (tr_FY) then - call define_rest_field(File,'frz_onset',dims) - end if - - if (kdyn == 2) then - call define_rest_field(File,'a11_1',dims) - call define_rest_field(File,'a11_2',dims) - call define_rest_field(File,'a11_3',dims) - call define_rest_field(File,'a11_4',dims) - call define_rest_field(File,'a12_1',dims) - call define_rest_field(File,'a12_2',dims) - call define_rest_field(File,'a12_3',dims) - call define_rest_field(File,'a12_4',dims) - endif - - if (tr_pond_lvl) then - call define_rest_field(File,'fsnow',dims) - endif - - if (nbtrcr > 0) then - if (tr_bgc_N) then - do k=1,n_algae - write(nchar,'(i3.3)') k - call define_rest_field(File,'algalN'//trim(nchar),dims) - enddo - endif - if (tr_bgc_C) then - do k=1,n_doc - write(nchar,'(i3.3)') k - call define_rest_field(File,'doc'//trim(nchar),dims) - enddo - do k=1,n_dic - write(nchar,'(i3.3)') k - call define_rest_field(File,'dic'//trim(nchar),dims) - enddo - endif - call define_rest_field(File,'nit' ,dims) - if (tr_bgc_Am) & - call define_rest_field(File,'amm' ,dims) - if (tr_bgc_Sil) & - call define_rest_field(File,'sil' ,dims) - if (tr_bgc_hum) & - call define_rest_field(File,'hum' ,dims) - if (tr_bgc_DMS) then - call define_rest_field(File,'dmsp' ,dims) - call define_rest_field(File,'dms' ,dims) - endif - if (tr_bgc_DON) then - do k=1,n_don - write(nchar,'(i3.3)') k - call define_rest_field(File,'don'//trim(nchar),dims) - enddo - endif - if (tr_bgc_Fe ) then - do k=1,n_fed - write(nchar,'(i3.3)') k - call define_rest_field(File,'fed'//trim(nchar),dims) - enddo - do k=1,n_fep - write(nchar,'(i3.3)') k - call define_rest_field(File,'fep'//trim(nchar),dims) - enddo - endif - if (tr_zaero) then - do k=1,n_zaero - write(nchar,'(i3.3)') k - call define_rest_field(File,'zaeros'//trim(nchar),dims) - enddo - endif - endif !nbtrcr - - if (solve_zsal) call define_rest_field(File,'sss',dims) - - deallocate(dims) - - !----------------------------------------------------------------- - ! 3D restart fields (ncat) - !----------------------------------------------------------------- - - allocate(dims(3)) - - dims(1) = dimid_ni - dims(2) = dimid_nj - dims(3) = dimid_ncat - - call define_rest_field(File,'aicen',dims) - call define_rest_field(File,'vicen',dims) - call define_rest_field(File,'vsnon',dims) - call define_rest_field(File,'Tsfcn',dims) - - if (tr_iage) then - call define_rest_field(File,'iage',dims) - end if - - if (tr_FY) then - call define_rest_field(File,'FY',dims) - end if - - if (tr_lvl) then - call define_rest_field(File,'alvl',dims) - call define_rest_field(File,'vlvl',dims) - end if - - if (tr_pond_cesm) then - call define_rest_field(File,'apnd',dims) - call define_rest_field(File,'hpnd',dims) - end if - - if (tr_pond_topo) then - call define_rest_field(File,'apnd',dims) - call define_rest_field(File,'hpnd',dims) - call define_rest_field(File,'ipnd',dims) - end if - - if (tr_pond_lvl) then - call define_rest_field(File,'apnd',dims) - call define_rest_field(File,'hpnd',dims) - call define_rest_field(File,'ipnd',dims) - call define_rest_field(File,'dhs',dims) - call define_rest_field(File,'ffrac',dims) - end if - - if (tr_brine) then - call define_rest_field(File,'fbrn',dims) - call define_rest_field(File,'first_ice',dims) - endif - - if (skl_bgc) then - do k = 1, n_algae - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_N'//trim(nchar) ,dims) - enddo - if (tr_bgc_C) then - ! do k = 1, n_algae - ! write(nchar,'(i3.3)') k - ! call define_rest_field(File,'bgc_C'//trim(nchar) ,dims) - ! enddo - do k = 1, n_doc - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_DOC'//trim(nchar) ,dims) - enddo - do k = 1, n_dic - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_DIC'//trim(nchar) ,dims) - enddo - endif - if (tr_bgc_chl) then - do k = 1, n_algae - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_chl'//trim(nchar) ,dims) - enddo - endif - call define_rest_field(File,'bgc_Nit' ,dims) - if (tr_bgc_Am) & - call define_rest_field(File,'bgc_Am' ,dims) - if (tr_bgc_Sil) & - call define_rest_field(File,'bgc_Sil' ,dims) - if (tr_bgc_hum) & - call define_rest_field(File,'bgc_hum' ,dims) - if (tr_bgc_DMS) then - call define_rest_field(File,'bgc_DMSPp',dims) - call define_rest_field(File,'bgc_DMSPd',dims) - call define_rest_field(File,'bgc_DMS' ,dims) - endif - if (tr_bgc_PON) & - call define_rest_field(File,'bgc_PON' ,dims) - if (tr_bgc_DON) then - do k = 1, n_don - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_DON'//trim(nchar) ,dims) - enddo - endif - if (tr_bgc_Fe ) then - do k = 1, n_fed - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_Fed'//trim(nchar) ,dims) - enddo - do k = 1, n_fep - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_Fep'//trim(nchar) ,dims) - enddo - endif - endif !skl_bgc - if (solve_zsal) & - call define_rest_field(File,'Rayleigh',dims) - - !----------------------------------------------------------------- - ! 4D restart fields, written as layers of 3D - !----------------------------------------------------------------- - - do k=1,nilyr - write(nchar,'(i3.3)') k - call define_rest_field(File,'sice'//trim(nchar),dims) - call define_rest_field(File,'qice'//trim(nchar),dims) - enddo - - do k=1,nslyr - write(nchar,'(i3.3)') k - 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 - call define_rest_field(File,'aerosnossl'//nchar, dims) - call define_rest_field(File,'aerosnoint'//nchar, dims) - call define_rest_field(File,'aeroicessl'//nchar, dims) - call define_rest_field(File,'aeroiceint'//nchar, dims) - enddo - endif - - if (solve_zsal) then - do k = 1, nblyr - write(nchar,'(i3.3)') k - call define_rest_field(File,'zSalinity'//trim(nchar),dims) - enddo - endif - if (z_tracers) then - if (tr_zaero) then - do n = 1, n_zaero - write(ncharb,'(i3.3)') n - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'zaero'//trim(ncharb)//trim(nchar),dims) - enddo !k - enddo !n - endif !tr_zaero - if (tr_bgc_Nit) then - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_Nit'//trim(nchar),dims) - enddo - endif - if (tr_bgc_N) then - do n = 1, n_algae - write(ncharb,'(i3.3)') n - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_N'//trim(ncharb)//trim(nchar),dims) - enddo - enddo - endif - if (tr_bgc_C) then - ! do n = 1, n_algae - ! write(ncharb,'(i3.3)') n - ! do k = 1, nblyr+3 - ! write(nchar,'(i3.3)') k - ! call - ! define_rest_field(File,'bgc_C'//trim(ncharb)//trim(nchar),dims) - ! enddo - ! enddo - do n = 1, n_doc - write(ncharb,'(i3.3)') n - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_DOC'//trim(ncharb)//trim(nchar),dims) - enddo - enddo - do n = 1, n_dic - write(ncharb,'(i3.3)') n - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_DIC'//trim(ncharb)//trim(nchar),dims) - enddo - enddo - endif - if (tr_bgc_chl) then - do n = 1, n_algae - write(ncharb,'(i3.3)') n - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_chl'//trim(ncharb)//trim(nchar),dims) - enddo - enddo - endif - if (tr_bgc_Am) then - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_Am'//trim(nchar),dims) - enddo - endif - if (tr_bgc_Sil) then - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_Sil'//trim(nchar),dims) - enddo - endif - if (tr_bgc_hum) then - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_hum'//trim(nchar),dims) - enddo - endif - if (tr_bgc_DMS) then - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_DMSPp'//trim(nchar),dims) - call define_rest_field(File,'bgc_DMSPd'//trim(nchar),dims) - call define_rest_field(File,'bgc_DMS'//trim(nchar),dims) - enddo - endif - if (tr_bgc_PON) then - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_PON'//trim(nchar),dims) - enddo - endif - if (tr_bgc_DON) then - do n = 1, n_don - write(ncharb,'(i3.3)') n - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_DON'//trim(ncharb)//trim(nchar),dims) - enddo - enddo - endif - if (tr_bgc_Fe ) then - do n = 1, n_fed - write(ncharb,'(i3.3)') n - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_Fed'//trim(ncharb)//trim(nchar),dims) - enddo - enddo - do n = 1, n_fep - write(ncharb,'(i3.3)') n - do k = 1, nblyr+3 - write(nchar,'(i3.3)') k - call define_rest_field(File,'bgc_Fep'//trim(ncharb)//trim(nchar),dims) - enddo - enddo - endif - do k = 1, nbtrcr - write(nchar,'(i3.3)') k - call define_rest_field(File,'zbgc_frac'//trim(nchar),dims) - enddo - endif !z_tracers - - deallocate(dims) - status = pio_enddef(File) - - call ice_pio_initdecomp(iodesc=iodesc2d) - call ice_pio_initdecomp(ndim3=ncat , iodesc=iodesc3d_ncat, remap=.true.) - - endif - - if (my_task == master_task) then - write(nu_diag,*) 'Writing ',filename(1:lenstr(filename)) - endif - - end subroutine init_restart_write - -!======================================================================= - -! Reads a single restart field -! author David A Bailey, NCAR - - subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3,diag, & - field_loc, field_type) - - use ice_blocks, only: nx_block, ny_block - use ice_communicate, only: my_task, master_task - use ice_constants, only: c0, field_loc_center - use ice_boundary, only: ice_HaloUpdate - use ice_domain, only: halo_info, distrb_info, nblocks - use ice_domain_size, only: max_blocks, ncat - use ice_global_reductions, only: global_minval, global_maxval, global_sum - - integer (kind=int_kind), intent(in) :: & - nu , & ! unit number (not used for netcdf) - ndim3 , & ! third dimension - nrec ! record number (0 for sequential access) - - real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), intent(inout) :: & - work ! input array (real, 8-byte) - - character (len=4), intent(in) :: & - atype ! format for output array - ! (real/integer, 4-byte/8-byte) - - logical (kind=log_kind), intent(in) :: & - diag ! if true, write diagnostic output - - character (len=*), intent(in) :: vname - - integer (kind=int_kind), optional, intent(in) :: & - field_loc, & ! location of field on staggered grid - field_type ! type of field (scalar, vector, angle) - - ! local variables - - integer (kind=int_kind) :: & - j, & ! dimension counter - n, & ! number of dimensions for variable - ndims, & ! number of variable dimensions - status ! status variable from netCDF routine - - real (kind=dbl_kind) :: amin,amax,asum - - character(len=*), parameter :: subname = '(read_restart_field)' - - if (restart_format == "pio") then - if (my_task == master_task) & - write(nu_diag,*)'Parallel restart file read: ',vname - - call pio_seterrorhandling(File, PIO_BCAST_ERROR) - - status = pio_inq_varid(File,trim(vname),vardesc) - - if (status /= 0) then - call abort_ice(subname//"ERROR: CICE restart? Missing variable: "//trim(vname)) - endif - - status = pio_inq_varndims(File, vardesc, ndims) - - call pio_seterrorhandling(File, PIO_INTERNAL_ERROR) - -! if (ndim3 == ncat .and. ncat>1) then - if (ndim3 == ncat .and. ndims == 3) then - call pio_read_darray(File, vardesc, iodesc3d_ncat, work, status) - if (present(field_loc)) then - do n=1,ndim3 - call ice_HaloUpdate (work(:,:,n,:), halo_info, & - field_loc, field_type) - enddo - endif -! elseif (ndim3 == 1) then - elseif (ndim3 == 1 .and. ndims == 2) then - call pio_read_darray(File, vardesc, iodesc2d, work, status) - if (present(field_loc)) then - call ice_HaloUpdate (work(:,:,1,:), halo_info, & - field_loc, field_type) - endif - else - write(nu_diag,*) "ndim3 not supported ",ndim3 - endif - - if (diag) then - if (ndim3 > 1) then - do n=1,ndim3 - amin = global_minval(work(:,:,n,:),distrb_info) - amax = global_maxval(work(:,:,n,:),distrb_info) - asum = global_sum(work(:,:,n,:), distrb_info, field_loc_center) - if (my_task == master_task) then - write(nu_diag,*) ' min and max =', amin, amax - write(nu_diag,*) ' sum =',asum - endif - enddo - else - amin = global_minval(work(:,:,1,:),distrb_info) - amax = global_maxval(work(:,:,1,:),distrb_info) - asum = global_sum(work(:,:,1,:), distrb_info, field_loc_center) - if (my_task == master_task) then - write(nu_diag,*) ' min and max =', amin, amax - write(nu_diag,*) ' sum =',asum - write(nu_diag,*) '' - endif - endif - - endif - else - call abort_ice(subname//"ERROR: Invalid restart_format: "//trim(restart_format)) - endif - - end subroutine read_restart_field - -!======================================================================= - -! Writes a single restart field. -! author David A Bailey, NCAR - - subroutine write_restart_field(nu,nrec,work,atype,vname,ndim3,diag) - - use ice_blocks, only: nx_block, ny_block - use ice_communicate, only: my_task, master_task - use ice_constants, only: c0, field_loc_center - use ice_domain, only: distrb_info, nblocks - use ice_domain_size, only: max_blocks, ncat - use ice_global_reductions, only: global_minval, global_maxval, global_sum - - integer (kind=int_kind), intent(in) :: & - nu , & ! unit number - ndim3 , & ! third dimension - nrec ! record number (0 for sequential access) - - real (kind=dbl_kind), dimension(nx_block,ny_block,ndim3,max_blocks), intent(in) :: & - work ! input array (real, 8-byte) - - character (len=4), intent(in) :: & - atype ! format for output array - ! (real/integer, 4-byte/8-byte) - - logical (kind=log_kind), intent(in) :: & - diag ! if true, write diagnostic output - - character (len=*), intent(in) :: vname - - ! local variables - - integer (kind=int_kind) :: & - j, & ! dimension counter - n, & ! dimension counter - ndims, & ! number of variable dimensions - status ! status variable from netCDF routine - - real (kind=dbl_kind) :: amin,amax,asum - - character(len=*), parameter :: subname = '(write_restart_field)' - - if (restart_format == "pio") then - if (my_task == master_task) & - write(nu_diag,*)'Parallel restart file write: ',vname - - status = pio_inq_varid(File,trim(vname),vardesc) - - status = pio_inq_varndims(File, vardesc, ndims) - - if (ndims==3) then - call pio_write_darray(File, vardesc, iodesc3d_ncat,work(:,:,:,1:nblocks), & - status, fillval=c0) - elseif (ndims == 2) then - call pio_write_darray(File, vardesc, iodesc2d, work(:,:,1,1:nblocks), & - status, fillval=c0) - else - write(nu_diag,*) "ndims not supported",ndims,ndim3 - endif - - if (diag) then - if (ndim3 > 1) then - do n=1,ndim3 - amin = global_minval(work(:,:,n,:),distrb_info) - amax = global_maxval(work(:,:,n,:),distrb_info) - asum = global_sum(work(:,:,n,:), distrb_info, field_loc_center) - if (my_task == master_task) then - write(nu_diag,*) ' min and max =', amin, amax - write(nu_diag,*) ' sum =',asum - endif - enddo - else - amin = global_minval(work(:,:,1,:),distrb_info) - amax = global_maxval(work(:,:,1,:),distrb_info) - asum = global_sum(work(:,:,1,:), distrb_info, field_loc_center) - if (my_task == master_task) then - write(nu_diag,*) ' min and max =', amin, amax - write(nu_diag,*) ' sum =',asum - endif - endif - endif - else - call abort_ice(subname//"ERROR: Invalid restart_format: "//trim(restart_format)) - endif - - end subroutine write_restart_field - -!======================================================================= - -! Finalize the restart file. -! author David A Bailey, NCAR - - subroutine final_restart() - - use ice_calendar, only: istep1, time, time_forc - use ice_communicate, only: my_task, master_task - - character(len=*), parameter :: subname = '(final_restart)' - - if (restart_format == 'pio') then - call PIO_freeDecomp(File,iodesc2d) - call PIO_freeDecomp(File,iodesc3d_ncat) - call pio_closefile(File) - endif - - if (my_task == master_task) & - write(nu_diag,*) 'Restart read/written ',istep1,time,time_forc - - end subroutine final_restart - -!======================================================================= - -! Defines a restart field -! author David A Bailey, NCAR - - subroutine define_rest_field(File, vname, dims) - - type(file_desc_t) , intent(in) :: File - character (len=*) , intent(in) :: vname - integer (kind=int_kind), intent(in) :: dims(:) - - integer (kind=int_kind) :: & - status ! status variable from netCDF routine - - character(len=*), parameter :: subname = '(define_rest_field)' - - status = pio_def_var(File,trim(vname),pio_double,dims,vardesc) - - end subroutine define_rest_field - -!======================================================================= - - end module ice_restart - -!======================================================================= diff --git a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_history_write.F90 b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_history_write.F90 index 771d0e313..d030b439b 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_history_write.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_history_write.F90 @@ -53,7 +53,7 @@ subroutine ice_write_hist (ns) dxu, dxt, dyu, dyt, HTN, HTE, ANGLE, ANGLET, tmask, & lont_bounds, latt_bounds, lonu_bounds, latu_bounds use ice_history_shared - use ice_arrays_column, only: hin_max + use ice_arrays_column, only: hin_max, floe_rad_c use ice_restart_shared, only: runid, lcdf64 use netcdf #endif @@ -67,17 +67,18 @@ subroutine ice_write_hist (ns) #ifdef ncdf integer (kind=int_kind) :: i,j,k,ic,n,nn, & ncid,status,imtid,jmtid,kmtidi,kmtids,kmtidb, cmtid,timid, & - length,nvertexid,ivertex,kmtida + length,nvertexid,ivertex,kmtida,fmtid integer (kind=int_kind), dimension(2) :: dimid2 integer (kind=int_kind), dimension(3) :: dimid3 integer (kind=int_kind), dimension(4) :: dimidz integer (kind=int_kind), dimension(5) :: dimidcz integer (kind=int_kind), dimension(3) :: dimid_nverts - integer (kind=int_kind), dimension(5) :: dimidex + integer (kind=int_kind), dimension(6) :: dimidex real (kind=real_kind) :: ltime real (kind= dbl_kind) :: ltime2 character (char_len) :: title character (char_len_long) :: ncfile(max_nstrm) + integer (kind=int_kind) :: iotype integer (kind=int_kind) :: iyear, imonth, iday integer (kind=int_kind) :: icategory,ind,i_aice,boundid @@ -89,7 +90,8 @@ subroutine ice_write_hist (ns) type(file_desc_t) :: File type(io_desc_t) :: iodesc2d, & iodesc3dc, iodesc3dv, iodesc3di, iodesc3db, iodesc3da, & - iodesc4di, iodesc4ds + iodesc3df, & + iodesc4di, iodesc4ds, iodesc4df type(var_desc_t) :: varid ! 4 coordinate variables: TLON, TLAT, ULON, ULAT @@ -136,6 +138,8 @@ subroutine ice_write_hist (ns) real (kind=dbl_kind) :: secday real (kind=dbl_kind) :: rad_to_deg + integer (kind=int_kind) :: lprecision + character(len=*), parameter :: subname = '(ice_write_hist)' call icepack_query_parameters(secday_out=secday) @@ -159,22 +163,30 @@ subroutine ice_write_hist (ns) ! create file + iotype = PIO_IOTYPE_NETCDF + if (history_format == 'pio_pnetcdf') iotype = PIO_IOTYPE_PNETCDF File%fh=-1 call ice_pio_init(mode='write', filename=trim(filename), File=File, & - clobber=.true., cdf64=lcdf64) + clobber=.true., cdf64=lcdf64, iotype=iotype) call ice_pio_initdecomp(iodesc=iodesc2d) call ice_pio_initdecomp(ndim3=ncat_hist, iodesc=iodesc3dc) call ice_pio_initdecomp(ndim3=nzilyr, iodesc=iodesc3di) call ice_pio_initdecomp(ndim3=nzblyr, iodesc=iodesc3db) call ice_pio_initdecomp(ndim3=nzalyr, iodesc=iodesc3da) - call ice_pio_initdecomp(ndim3=nverts, inner_dim=.true., iodesc=iodesc3dv) - call ice_pio_initdecomp(ndim3=nzilyr, ndim4=ncat_hist, iodesc=iodesc4di) - call ice_pio_initdecomp(ndim3=nzslyr, ndim4=ncat_hist, iodesc=iodesc4ds) + call ice_pio_initdecomp(ndim3=nfsd_hist, iodesc=iodesc3df) + call ice_pio_initdecomp(ndim3=nverts, iodesc=iodesc3dv, inner_dim=.true.) + call ice_pio_initdecomp(ndim3=nzilyr, ndim4=ncat_hist, iodesc=iodesc4di) + call ice_pio_initdecomp(ndim3=nzslyr, ndim4=ncat_hist, iodesc=iodesc4ds) + call ice_pio_initdecomp(ndim3=nfsd_hist, ndim4=ncat_hist, iodesc=iodesc4df) ltime2 = time/int(secday) ltime = real(time/int(secday),kind=real_kind) + ! option of turning on double precision history files + lprecision = pio_real + if (history_precision == 8) lprecision = pio_double + !----------------------------------------------------------------- ! define dimensions !----------------------------------------------------------------- @@ -192,6 +204,7 @@ subroutine ice_write_hist (ns) status = pio_def_dim(File,'nkaer',nzalyr,kmtida) status = pio_def_dim(File,'time',PIO_UNLIMITED,timid) status = pio_def_dim(File,'nvertices',nverts,nvertexid) + status = pio_def_dim(File,'nf',nfsd_hist,fmtid) !----------------------------------------------------------------- ! define coordinate variables: time, time_bounds @@ -261,6 +274,7 @@ subroutine ice_write_hist (ns) var_nz(3) = coord_attributes('VGRDs', 'vertical snow levels', '1') var_nz(4) = coord_attributes('VGRDb', 'vertical ice-bio levels', '1') var_nz(5) = coord_attributes('VGRDa', 'vertical snow-ice-bio levels', '1') + var_nz(6) = coord_attributes('NFSD', 'category floe size (center)', 'm') !----------------------------------------------------------------- ! define information for optional time-invariant variables @@ -327,12 +341,17 @@ subroutine ice_write_hist (ns) dimid2(2) = jmtid do i = 1, ncoord - status = pio_def_var(File, trim(coord_var(i)%short_name), pio_real, & + status = pio_def_var(File, trim(coord_var(i)%short_name), lprecision, & dimid2, varid) status = pio_put_att(File,varid,'long_name',trim(coord_var(i)%long_name)) status = pio_put_att(File, varid, 'units', trim(coord_var(i)%units)) - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif if (coord_var(i)%short_name == 'ULAT') then status = pio_put_att(File,varid,'comment', & trim('Latitude of NE corner of T grid cell')) @@ -342,16 +361,17 @@ subroutine ice_write_hist (ns) endif enddo - ! Extra dimensions (NCAT, NZILYR, NZSLYR, NZBLYR, NZALYR) + ! Extra dimensions (NCAT, NZILYR, NZSLYR, NZBLYR, NZALYR, NFSD) dimidex(1)=cmtid dimidex(2)=kmtidi dimidex(3)=kmtids dimidex(4)=kmtidb dimidex(5)=kmtida + dimidex(6)=fmtid do i = 1, nvarz if (igrdz(i)) then - status = pio_def_var(File, trim(var_nz(i)%short_name), pio_real, & + status = pio_def_var(File, trim(var_nz(i)%short_name), lprecision, & (/dimidex(i)/), varid) status = pio_put_att(File, varid, 'long_name', var_nz(i)%long_name) status = pio_put_att(File, varid, 'units' , var_nz(i)%units) @@ -360,31 +380,46 @@ subroutine ice_write_hist (ns) ! Attributes for tmask defined separately, since it has no units if (igrd(n_tmask)) then - status = pio_def_var(File, 'tmask', pio_real, dimid2, varid) + status = pio_def_var(File, 'tmask', lprecision, dimid2, varid) status = pio_put_att(File,varid, 'long_name', 'ocean grid mask') status = pio_put_att(File, varid, 'coordinates', 'TLON TLAT') - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif status = pio_put_att(File,varid,'comment', '0 = land, 1 = ocean') endif if (igrd(n_blkmask)) then - status = pio_def_var(File, 'blkmask', pio_real, dimid2, varid) + status = pio_def_var(File, 'blkmask', lprecision, dimid2, varid) status = pio_put_att(File,varid, 'long_name', 'ice grid block mask') status = pio_put_att(File, varid, 'coordinates', 'TLON TLAT') status = pio_put_att(File,varid,'comment', 'mytask + iblk/100') - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif endif do i = 3, nvar ! note: n_tmask=1, n_blkmask=2 if (igrd(i)) then status = pio_def_var(File, trim(var(i)%req%short_name), & - pio_real, dimid2, varid) + lprecision, dimid2, varid) status = pio_put_att(File,varid, 'long_name', trim(var(i)%req%long_name)) status = pio_put_att(File, varid, 'units', trim(var(i)%req%units)) status = pio_put_att(File, varid, 'coordinates', trim(var(i)%coordinates)) - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif endif enddo @@ -395,13 +430,18 @@ subroutine ice_write_hist (ns) do i = 1, nvar_verts if (f_bounds) then status = pio_def_var(File, trim(var_nverts(i)%short_name), & - pio_real,dimid_nverts, varid) + lprecision,dimid_nverts, varid) status = & pio_put_att(File,varid, 'long_name', trim(var_nverts(i)%long_name)) status = & pio_put_att(File, varid, 'units', trim(var_nverts(i)%units)) - status = pio_put_att(File, varid, 'missing_value', spval) - status = pio_put_att(File, varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif endif enddo @@ -420,7 +460,7 @@ subroutine ice_write_hist (ns) do n=1,num_avail_hist_fields_2D if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimid3, varid) + lprecision, dimid3, varid) status = pio_put_att(File,varid,'units', & trim(avail_hist_fields(n)%vunit)) status = pio_put_att(File,varid, 'long_name', & @@ -429,8 +469,13 @@ subroutine ice_write_hist (ns) trim(avail_hist_fields(n)%vcoord)) status = pio_put_att(File,varid,'cell_measures', & trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif ! Add cell_methods attribute to variables if averaged if (hist_avg .and. histfreq(ns) /= '1') then @@ -469,7 +514,7 @@ subroutine ice_write_hist (ns) do n = n2D + 1, n3Dccum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidz, varid) + lprecision, dimidz, varid) status = pio_put_att(File,varid,'units', & trim(avail_hist_fields(n)%vunit)) status = pio_put_att(File,varid, 'long_name', & @@ -478,8 +523,13 @@ subroutine ice_write_hist (ns) trim(avail_hist_fields(n)%vcoord)) status = pio_put_att(File,varid,'cell_measures', & trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif ! Add cell_methods attribute to variables if averaged if (hist_avg .and. histfreq(ns) /= '1') then @@ -506,7 +556,7 @@ subroutine ice_write_hist (ns) do n = n3Dccum + 1, n3Dzcum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidz, varid) + lprecision, dimidz, varid) status = pio_put_att(File,varid,'units', & trim(avail_hist_fields(n)%vunit)) status = pio_put_att(File,varid, 'long_name', & @@ -515,8 +565,13 @@ subroutine ice_write_hist (ns) trim(avail_hist_fields(n)%vcoord)) status = pio_put_att(File,varid,'cell_measures', & trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif ! Add cell_methods attribute to variables if averaged if (hist_avg .and. histfreq(ns) /= '1') then @@ -543,7 +598,7 @@ subroutine ice_write_hist (ns) do n = n3Dzcum + 1, n3Dbcum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidz, varid) + lprecision, dimidz, varid) status = pio_put_att(File,varid,'units', & trim(avail_hist_fields(n)%vunit)) status = pio_put_att(File,varid, 'long_name', & @@ -552,8 +607,13 @@ subroutine ice_write_hist (ns) trim(avail_hist_fields(n)%vcoord)) status = pio_put_att(File,varid,'cell_measures', & trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif ! Add cell_methods attribute to variables if averaged if (hist_avg .and. histfreq(ns) /= '1') then @@ -580,7 +640,7 @@ subroutine ice_write_hist (ns) do n = n3Dbcum + 1, n3Dacum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidz, varid) + lprecision, dimidz, varid) status = pio_put_att(File,varid,'units', & trim(avail_hist_fields(n)%vunit)) status = pio_put_att(File,varid, 'long_name', & @@ -589,8 +649,13 @@ subroutine ice_write_hist (ns) trim(avail_hist_fields(n)%vcoord)) status = pio_put_att(File,varid,'cell_measures', & trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif ! Add cell_methods attribute to variables if averaged if (hist_avg .and. histfreq(ns) /= '1') then @@ -605,6 +670,48 @@ subroutine ice_write_hist (ns) endif enddo ! num_avail_hist_fields_3Da + !----------------------------------------------------------------- + ! 3D (fsd) + !----------------------------------------------------------------- + + dimidz(1) = imtid + dimidz(2) = jmtid + dimidz(3) = fmtid + dimidz(4) = timid + + do n = n3Dacum + 1, n3Dfcum + if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then + status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & + lprecision, dimidz, varid) + status = pio_put_att(File,varid,'units', & + trim(avail_hist_fields(n)%vunit)) + status = pio_put_att(File,varid, 'long_name', & + trim(avail_hist_fields(n)%vdesc)) + status = pio_put_att(File,varid,'coordinates', & + trim(avail_hist_fields(n)%vcoord)) + status = pio_put_att(File,varid,'cell_measures', & + trim(avail_hist_fields(n)%vcellmeas)) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif + + ! Add cell_methods attribute to variables if averaged + if (hist_avg .and. histfreq(ns) /= '1') then + status = pio_put_att(File,varid,'cell_methods','time: mean') + endif + + if (histfreq(ns) == '1' .or. .not. hist_avg) then + status = pio_put_att(File,varid,'time_rep','instantaneous') + else + status = pio_put_att(File,varid,'time_rep','averaged') + endif + endif + enddo ! num_avail_hist_fields_3Df + !----------------------------------------------------------------- ! define attributes for 4D variables ! time coordinate is dropped @@ -620,10 +727,10 @@ subroutine ice_write_hist (ns) dimidcz(4) = cmtid dimidcz(5) = timid - do n = n3Dacum + 1, n4Dicum + do n = n3Dfcum + 1, n4Dicum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidcz, varid) + lprecision, dimidcz, varid) status = pio_put_att(File,varid,'units', & trim(avail_hist_fields(n)%vunit)) status = pio_put_att(File,varid, 'long_name', & @@ -632,8 +739,13 @@ subroutine ice_write_hist (ns) trim(avail_hist_fields(n)%vcoord)) status = pio_put_att(File,varid,'cell_measures', & trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif ! Add cell_methods attribute to variables if averaged if (hist_avg .and. histfreq(ns) /= '1') then @@ -661,7 +773,7 @@ subroutine ice_write_hist (ns) do n = n4Dicum + 1, n4Dscum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & - pio_real, dimidcz, varid) + lprecision, dimidcz, varid) status = pio_put_att(File,varid,'units', & trim(avail_hist_fields(n)%vunit)) status = pio_put_att(File,varid, 'long_name', & @@ -670,8 +782,13 @@ subroutine ice_write_hist (ns) trim(avail_hist_fields(n)%vcoord)) status = pio_put_att(File,varid,'cell_measures', & trim(avail_hist_fields(n)%vcellmeas)) - status = pio_put_att(File,varid,'missing_value',spval) - status = pio_put_att(File,varid,'_FillValue',spval) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif ! Add cell_methods attribute to variables if averaged if (hist_avg .and. histfreq(ns) /= '1') then @@ -686,6 +803,50 @@ subroutine ice_write_hist (ns) endif enddo ! num_avail_hist_fields_4Ds + + !----------------------------------------------------------------- + ! 4D (fsd layers) + !----------------------------------------------------------------- + + dimidcz(1) = imtid + dimidcz(2) = jmtid + dimidcz(3) = fmtid + dimidcz(4) = cmtid + dimidcz(5) = timid + + do n = n4Dscum + 1, n4Dfcum + if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then + status = pio_def_var(File, trim(avail_hist_fields(n)%vname), & + lprecision, dimidcz, varid) + status = pio_put_att(File,varid,'units', & + trim(avail_hist_fields(n)%vunit)) + status = pio_put_att(File,varid, 'long_name', & + trim(avail_hist_fields(n)%vdesc)) + status = pio_put_att(File,varid,'coordinates', & + trim(avail_hist_fields(n)%vcoord)) + status = pio_put_att(File,varid,'cell_measures', & + trim(avail_hist_fields(n)%vcellmeas)) + if (lprecision == pio_real) then + status = pio_put_att(File, varid, 'missing_value', spval) + status = pio_put_att(File, varid,'_FillValue',spval) + else + status = pio_put_att(File, varid, 'missing_value', spval_dbl) + status = pio_put_att(File, varid,'_FillValue',spval_dbl) + endif + + ! Add cell_methods attribute to variables if averaged + if (hist_avg .and. histfreq(ns) /= '1') then + status = pio_put_att(File,varid,'cell_methods','time: mean') + endif + + if (histfreq(ns) == '1' .or. .not. hist_avg) then + status = pio_put_att(File,varid,'time_rep','instantaneous') + else + status = pio_put_att(File,varid,'time_rep','averaged') + endif + endif + enddo ! num_avail_hist_fields_4Df + !----------------------------------------------------------------- ! global attributes !----------------------------------------------------------------- @@ -728,7 +889,11 @@ subroutine ice_write_hist (ns) a,'-',a,'-',a,' at ',a,':',a) status = pio_put_att(File,pio_global,'history',trim(start_time)) - status = pio_put_att(File,pio_global,'io_flavor','io_pio') + if (history_format == 'pio_pnetcdf') then + status = pio_put_att(File,pio_global,'io_flavor','io_pio pnetcdf') + else + status = pio_put_att(File,pio_global,'io_flavor','io_pio netcdf') + endif !----------------------------------------------------------------- ! end define mode @@ -780,7 +945,7 @@ subroutine ice_write_hist (ns) workr2, status, fillval=spval_dbl) enddo - ! Extra dimensions (NCAT, VGRD*) + ! Extra dimensions (NCAT, NFSD, VGRD*) do i = 1, nvarz if (igrdz(i)) then @@ -788,6 +953,8 @@ subroutine ice_write_hist (ns) SELECT CASE (var_nz(i)%short_name) CASE ('NCAT') status = pio_put_var(File, varid, hin_max(1:ncat_hist)) + CASE ('NFSD') + status = pio_put_var(File, varid, floe_rad_c(1:nfsd_hist)) CASE ('VGRDi') status = pio_put_var(File, varid, (/(k, k=1,nzilyr)/)) CASE ('VGRDs') @@ -895,7 +1062,11 @@ subroutine ice_write_hist (ns) if (status /= pio_noerr) call abort_ice(subname// & 'ERROR getting varid for '//avail_hist_fields(n)%vname) workr2(:,:,:) = a2D(:,:,n,1:nblocks) +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif call pio_write_darray(File, varid, iodesc2d,& workr2, status, fillval=spval_dbl) endif @@ -916,7 +1087,11 @@ subroutine ice_write_hist (ns) workr3(:,:,j,i) = a3Dc(:,:,i,nn,j) enddo enddo +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif call pio_write_darray(File, varid, iodesc3dc,& workr3, status, fillval=spval_dbl) endif @@ -936,7 +1111,11 @@ subroutine ice_write_hist (ns) workr3(:,:,j,i) = a3Dz(:,:,i,nn,j) enddo enddo +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif call pio_write_darray(File, varid, iodesc3di,& workr3, status, fillval=spval_dbl) endif @@ -956,7 +1135,11 @@ subroutine ice_write_hist (ns) workr3(:,:,j,i) = a3Db(:,:,i,nn,j) enddo enddo +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif call pio_write_darray(File, varid, iodesc3db,& workr3, status, fillval=spval_dbl) endif @@ -976,17 +1159,45 @@ subroutine ice_write_hist (ns) workr3(:,:,j,i) = a3Da(:,:,i,nn,j) enddo enddo +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif call pio_write_darray(File, varid, iodesc3da,& workr3, status, fillval=spval_dbl) endif enddo ! num_avail_hist_fields_3Db deallocate(workr3) - allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzilyr)) - ! 4D (categories, vertical ice) - do n = n3Dacum+1, n4Dicum + ! 3D (fsd) + allocate(workr3(nx_block,ny_block,nblocks,nfsd_hist)) + do n = n3Dacum+1, n3Dfcum nn = n - n3Dacum + if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then + status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) + if (status /= pio_noerr) call abort_ice(subname// & + 'ERROR: getting varid for '//avail_hist_fields(n)%vname) + do j = 1, nblocks + do i = 1, nfsd_hist + workr3(:,:,j,i) = a3Df(:,:,i,nn,j) + enddo + enddo +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else + call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif + call pio_write_darray(File, varid, iodesc3df,& + workr3, status, fillval=spval_dbl) + endif + enddo ! num_avail_hist_fields_3Df + deallocate(workr3) + + allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzilyr)) + ! 4D (categories, fsd) + do n = n3Dfcum+1, n4Dicum + nn = n - n3Dfcum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) if (status /= pio_noerr) call abort_ice(subname// & @@ -998,7 +1209,11 @@ subroutine ice_write_hist (ns) enddo ! k enddo ! i enddo ! j +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif call pio_write_darray(File, varid, iodesc4di,& workr4, status, fillval=spval_dbl) endif @@ -1020,11 +1235,41 @@ subroutine ice_write_hist (ns) enddo ! k enddo ! i enddo ! j +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif call pio_write_darray(File, varid, iodesc4ds,& workr4, status, fillval=spval_dbl) endif - enddo ! num_avail_hist_fields_4Di + enddo ! num_avail_hist_fields_4Ds + deallocate(workr4) + + allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nfsd_hist)) + ! 4D (categories, vertical ice) + do n = n4Dscum+1, n4Dfcum + nn = n - n4Dscum + if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then + status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid) + if (status /= pio_noerr) call abort_ice(subname// & + 'ERROR: getting varid for '//avail_hist_fields(n)%vname) + do j = 1, nblocks + do i = 1, ncat_hist + do k = 1, nfsd_hist + workr4(:,:,j,i,k) = a4Df(:,:,k,i,nn,j) + enddo ! k + enddo ! i + enddo ! j +#ifdef CESM1_PIO + call pio_setframe(varid, int(1,kind=PIO_OFFSET)) +#else + call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND)) +#endif + call pio_write_darray(File, varid, iodesc4df,& + workr4, status, fillval=spval_dbl) + endif + enddo ! num_avail_hist_fields_4Df deallocate(workr4) ! similarly for num_avail_hist_fields_4Db (define workr4b, iodesc4db) @@ -1040,8 +1285,10 @@ subroutine ice_write_hist (ns) call pio_freedecomp(File,iodesc3di) call pio_freedecomp(File,iodesc3db) call pio_freedecomp(File,iodesc3da) + call pio_freedecomp(File,iodesc3df) call pio_freedecomp(File,iodesc4di) call pio_freedecomp(File,iodesc4ds) + call pio_freedecomp(File,iodesc4df) !----------------------------------------------------------------- ! close output dataset diff --git a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_pio.F90 b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_pio.F90 index 5fff64944..9c65b2ce1 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_pio.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_pio.F90 @@ -4,9 +4,6 @@ module ice_pio - use shr_kind_mod, only: r8 => shr_kind_r8, in=>shr_kind_in - use shr_kind_mod, only: cl => shr_kind_cl - use shr_sys_mod , only: shr_sys_flush use ice_kinds_mod use ice_blocks use ice_broadcast @@ -31,7 +28,11 @@ module ice_pio public ice_pio_init public ice_pio_initdecomp - type(iosystem_desc_t), pointer, public :: ice_pio_subsystem +#ifdef CESMCOUPLED + type(iosystem_desc_t), pointer :: ice_pio_subsystem +#else + type(iosystem_desc_t) :: ice_pio_subsystem +#endif !=============================================================================== @@ -42,9 +43,15 @@ module ice_pio ! Initialize the io subsystem ! 2009-Feb-17 - J. Edwards - initial version - subroutine ice_pio_init(mode, filename, File, clobber, cdf64) + subroutine ice_pio_init(mode, filename, File, clobber, cdf64, iotype) +#ifdef CESMCOUPLED use shr_pio_mod, only: shr_pio_getiosys, shr_pio_getiotype +#else +#ifdef GPTL + use perf_mod, only : t_initf +#endif +#endif implicit none character(len=*) , intent(in), optional :: mode @@ -52,12 +59,18 @@ subroutine ice_pio_init(mode, filename, File, clobber, cdf64) type(file_desc_t) , intent(inout), optional :: File logical , intent(in), optional :: clobber logical , intent(in), optional :: cdf64 + integer , intent(in), optional :: iotype ! local variables integer (int_kind) :: & nml_error ! namelist read error flag + integer :: nprocs + integer :: istride + integer :: basetask + integer :: numiotasks + integer :: rearranger integer :: pio_iotype logical :: exists logical :: lclobber @@ -67,8 +80,64 @@ subroutine ice_pio_init(mode, filename, File, clobber, cdf64) character(len=*), parameter :: subname = '(ice_pio_init)' logical, save :: first_call = .true. +#ifdef CESMCOUPLED ice_pio_subsystem => shr_pio_getiosys(inst_name) pio_iotype = shr_pio_getiotype(inst_name) +#else + +#ifdef GPTL + !--- initialize gptl + call t_initf('undefined_NLFileName', LogPrint=.false., mpicom=MPI_COMM_ICE, & + MasterTask=.true.) +#endif + + !--- initialize type of io + !pio_iotype = PIO_IOTYPE_PNETCDF + !pio_iotype = PIO_IOTYPE_NETCDF4C + !pio_iotype = PIO_IOTYPE_NETCDF4P + pio_iotype = PIO_IOTYPE_NETCDF + if (present(iotype)) then + pio_iotype = iotype + endif + + !--- initialize ice_pio_subsystem + nprocs = get_num_procs() + istride = 4 + basetask = min(1,nprocs-1) + numiotasks = max((nprocs-basetask)/istride,1) +!--tcraig this should work better but it causes pio2.4.4 to fail for reasons unknown +! numiotasks = 1 + (nprocs-basetask-1)/istride + rearranger = PIO_REARR_BOX + if (my_task == master_task) then + write(nu_diag,*) subname,' nprocs = ',nprocs + write(nu_diag,*) subname,' istride = ',istride + write(nu_diag,*) subname,' basetask = ',basetask + write(nu_diag,*) subname,' numiotasks = ',numiotasks + write(nu_diag,*) subname,' pio_iotype = ',pio_iotype + end if + + call pio_init(my_task, MPI_COMM_ICE, numiotasks, master_task, istride, & + rearranger, ice_pio_subsystem, base=basetask) + !--- initialize rearranger options + !pio_rearr_opt_comm_type = integer (PIO_REARR_COMM_[P2P,COLL]) + !pio_rearr_opt_fcd = integer, flow control (PIO_REARR_COMM_FC_[2D_ENABLE,1D_COMP2IO,1D_IO2COMP,2D_DISABLE]) + !pio_rearr_opt_c2i_enable_hs = logical + !pio_rearr_opt_c2i_enable_isend = logical + !pio_rearr_opt_c2i_max_pend_req = integer + !pio_rearr_opt_i2c_enable_hs = logical + !pio_rearr_opt_i2c_enable_isend = logical + !pio_rearr_opt_c2i_max_pend_req = integer + !ret = pio_set_rearr_opts(ice_pio_subsystem, pio_rearr_opt_comm_type,& + ! pio_rearr_opt_fcd,& + ! pio_rearr_opt_c2i_enable_hs, pio_rearr_opt_c2i_enable_isend,& + ! pio_rearr_opt_c2i_max_pend_req,& + ! pio_rearr_opt_i2c_enable_hs, pio_rearr_opt_i2c_enable_isend,& + ! pio_rearr_opt_i2c_max_pend_req) + !if(ret /= PIO_NOERR) then + ! call abort_ice(subname//'ERROR: aborting in pio_set_rearr_opts') + !end if + +#endif if (present(mode) .and. present(filename) .and. present(File)) then diff --git a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 index d673c7f7a..5bb880dc5 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio2/ice_restart.F90 @@ -55,6 +55,8 @@ subroutine init_restart_read(ice_ic) integer (kind=int_kind) :: status + integer (kind=int_kind) :: iotype + character(len=*), parameter :: subname = '(init_restart_read)' if (present(ice_ic)) then @@ -74,9 +76,11 @@ subroutine init_restart_read(ice_ic) write(nu_diag,*) 'Using restart dump=', trim(filename) end if - if (restart_format == 'pio') then +! if (restart_format(1:3) == 'pio') then + iotype = PIO_IOTYPE_NETCDF + if (restart_format == 'pio_pnetcdf') iotype = PIO_IOTYPE_PNETCDF File%fh=-1 - call ice_pio_init(mode='read', filename=trim(filename), File=File) + call ice_pio_init(mode='read', filename=trim(filename), File=File, iotype=iotype) call ice_pio_initdecomp(iodesc=iodesc2d) call ice_pio_initdecomp(ndim3=ncat , iodesc=iodesc3d_ncat,remap=.true.) @@ -94,7 +98,7 @@ subroutine init_restart_read(ice_ic) status = pio_get_att(File, pio_global, 'sec', sec) endif endif ! use namelist values if use_restart_time = F - endif +! endif if (my_task == master_task) then write(nu_diag,*) 'Restart read at istep=',istep0,time,time_forc @@ -126,7 +130,7 @@ subroutine init_restart_write(filename_spec) use ice_communicate, only: my_task, master_task use ice_domain_size, only: nx_global, ny_global, ncat, nilyr, nslyr, & n_iso, n_aero, nblyr, n_zaero, n_algae, n_doc, & - n_dic, n_don, n_fed, n_fep + n_dic, n_don, n_fed, n_fep, nfsd use ice_dyn_shared, only: kdyn use ice_arrays_column, only: oceanmixed_ice @@ -138,10 +142,10 @@ subroutine init_restart_write(filename_spec) 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_bgc_hum + tr_zaero, tr_bgc_Fe, & + tr_bgc_hum, tr_fsd integer (kind=int_kind) :: & nbtrcr @@ -160,6 +164,8 @@ subroutine init_restart_write(filename_spec) integer (kind=int_kind), allocatable :: dims(:) + integer (kind=int_kind) :: iotype + integer (kind=int_kind) :: & k, n, & ! loop index status ! status variable from netCDF routine @@ -178,7 +184,7 @@ subroutine init_restart_write(filename_spec) tr_bgc_chl_out=tr_bgc_chl, tr_bgc_Am_out=tr_bgc_Am, & tr_bgc_PON_out=tr_bgc_PON, tr_bgc_DON_out=tr_bgc_DON, & tr_zaero_out=tr_zaero, tr_bgc_Fe_out=tr_bgc_Fe, & - tr_bgc_hum_out=tr_bgc_hum) + tr_bgc_hum_out=tr_bgc_hum, tr_fsd_out=tr_fsd) call icepack_query_parameters(solve_zsal_out=solve_zsal, skl_bgc_out=skl_bgc, & z_tracers_out=z_tracers) call icepack_warnings_flush(nu_diag) @@ -199,7 +205,7 @@ subroutine init_restart_write(filename_spec) iyear,'-',month,'-',mday,'-',sec end if - if (restart_format /= 'bin') filename = trim(filename) // '.nc' + if (restart_format(1:3) /= 'bin') filename = trim(filename) // '.nc' ! write pointer (path/file) if (my_task == master_task) then @@ -208,11 +214,13 @@ subroutine init_restart_write(filename_spec) close(nu_rst_pointer) endif - if (restart_format == 'pio') then +! if (restart_format(1:3) == 'pio') then + iotype = PIO_IOTYPE_NETCDF + if (restart_format == 'pio_pnetcdf') iotype = PIO_IOTYPE_PNETCDF File%fh=-1 call ice_pio_init(mode='write',filename=trim(filename), File=File, & - clobber=.true., cdf64=lcdf64 ) + clobber=.true., cdf64=lcdf64, iotype=iotype) status = pio_put_att(File,pio_global,'istep1',istep1) status = pio_put_att(File,pio_global,'time',time) @@ -473,6 +481,13 @@ subroutine init_restart_write(filename_spec) call define_rest_field(File,'qsno'//trim(nchar),dims) enddo + if (tr_fsd) then + do k=1,nfsd + write(nchar,'(i3.3)') k + call define_rest_field(File,'fsd'//trim(nchar),dims) + enddo + endif + if (tr_iso) then do k=1,n_iso write(nchar,'(i3.3)') k @@ -624,7 +639,7 @@ subroutine init_restart_write(filename_spec) call ice_pio_initdecomp(iodesc=iodesc2d) call ice_pio_initdecomp(ndim3=ncat , iodesc=iodesc3d_ncat, remap=.true.) - endif +! endif ! restart_format if (my_task == master_task) then write(nu_diag,*) 'Writing ',filename(1:lenstr(filename)) @@ -681,7 +696,7 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3,diag, & character(len=*), parameter :: subname = '(read_restart_field)' - if (restart_format == "pio") then +! if (restart_format(1:3) == "pio") then if (my_task == master_task) & write(nu_diag,*)'Parallel restart file read: ',vname @@ -740,9 +755,9 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3,diag, & endif endif - else - call abort_ice(subname//"ERROR: Invalid restart_format: "//trim(restart_format)) - endif +! else +! call abort_ice(subname//"ERROR: Invalid restart_format: "//trim(restart_format)) +! endif ! restart_format end subroutine read_restart_field @@ -789,7 +804,7 @@ subroutine write_restart_field(nu,nrec,work,atype,vname,ndim3,diag) character(len=*), parameter :: subname = '(write_restart_field)' - if (restart_format == "pio") then +! if (restart_format(1:3) == "pio") then if (my_task == master_task) & write(nu_diag,*)'Parallel restart file write: ',vname @@ -828,9 +843,9 @@ subroutine write_restart_field(nu,nrec,work,atype,vname,ndim3,diag) endif endif endif - else - call abort_ice(subname//"ERROR: Invalid restart_format: "//trim(restart_format)) - endif +! else +! call abort_ice(subname//"ERROR: Invalid restart_format: "//trim(restart_format)) +! endif end subroutine write_restart_field @@ -846,11 +861,9 @@ subroutine final_restart() character(len=*), parameter :: subname = '(final_restart)' - if (restart_format == 'pio') then - call PIO_freeDecomp(File,iodesc2d) - call PIO_freeDecomp(File,iodesc3d_ncat) - call pio_closefile(File) - endif + call PIO_freeDecomp(File,iodesc2d) + call PIO_freeDecomp(File,iodesc3d_ncat) + call pio_closefile(File) if (my_task == master_task) & write(nu_diag,*) 'Restart read/written ',istep1,time,time_forc diff --git a/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 b/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 index 09cffa0c7..f5e7de02f 100644 --- a/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 +++ b/cicecore/drivers/mct/cesm1/CICE_RunMod.F90 @@ -374,7 +374,7 @@ subroutine coupling_prep (iblk) fsens, flat, fswabs, flwout, evap, Tref, Qref, & scale_fluxes, frzmlt_init, frzmlt, Uref, wind use ice_flux_bgc, only: faero_ocn, fiso_ocn, Qref_iso, fiso_evap, & - fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai + fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai, & fnit, fsil, famm, fdmsp, fdms, fhum, fdust, falgalN, & fdoc, fdic, fdon, ffep, ffed, bgcflux_ice_to_ocn use ice_grid, only: tmask diff --git a/cicecore/drivers/mct/cesm1/ice_import_export.F90 b/cicecore/drivers/mct/cesm1/ice_import_export.F90 index 82780ccd3..d42d3f8a1 100644 --- a/cicecore/drivers/mct/cesm1/ice_import_export.F90 +++ b/cicecore/drivers/mct/cesm1/ice_import_export.F90 @@ -72,7 +72,6 @@ subroutine ice_import( x2i ) logical (kind=log_kind) :: tr_aero, tr_iage, tr_FY, tr_pond logical (kind=log_kind) :: tr_lvl, tr_zaero, tr_bgc_Nit real (kind=dbl_kind) :: tffresh - logical (kind=log_kind) :: first_call = .true. character(len=*), parameter :: subname = '(ice_import)' !----------------------------------------------------- diff --git a/configuration/scripts/cice.batch.csh b/configuration/scripts/cice.batch.csh index e8ec14cab..07e6d86ec 100755 --- a/configuration/scripts/cice.batch.csh +++ b/configuration/scripts/cice.batch.csh @@ -1,9 +1,9 @@ #! /bin/csh -f if ( $1 != "" ) then - echo ${0:t} ${1} + echo "running cice.batch.csh (creating ${1})" else - echo ${0:t} + echo "running cice.batch.csh" endif #source ./cice.settings @@ -196,7 +196,7 @@ cat >> ${jobfile} << EOFB #SBATCH --qos=standby EOFB -else if (${ICE_MACHINE} =~ brooks*) then +else if (${ICE_MACHINE} =~ daley* || ${ICE_MACHINE} =~ banting*) then cat >> ${jobfile} << EOFB #PBS -N ${ICE_CASENAME} #PBS -j oe @@ -204,27 +204,58 @@ cat >> ${jobfile} << EOFB #PBS -l walltime=${batchtime} EOFB -else if (${ICE_MACHINE} =~ theia*) then +else if (${ICE_MACHINE} =~ hera*) then cat >> ${jobfile} << EOFB #SBATCH -J ${ICE_CASENAME} -#SBATCH -t ${batchtime} -#SBATCH -q batch -#SBATCH -A marine-cpu -#SBATCH -N ${nnodes} +#SBATCH --partition=hera +#SBATCH --qos=${queue} +#SBATCH -A ${acct} +#SBATCH --time=${batchtime} +#SBATCH --nodes=${nnodes} +#SBATCH --ntasks-per-node=${taskpernodelimit} +#SBATCH --cpus-per-task=${nthrds} #SBATCH -e slurm%j.err #SBATCH -o slurm%j.out -#SBATCH --mail-type END,FAIL -#SBATCH --mail-user=robert.grumbine@noaa.gov +##SBATCH --mail-type FAIL +##SBATCH --mail-user=xxx@noaa.gov EOFB -else if (${ICE_MACHINE} =~ phase2*) then +else if (${ICE_MACHINE} =~ orion*) then cat >> ${jobfile} << EOFB -# nothing to do +#SBATCH -J ${ICE_CASENAME} +#SBATCH --partition=orion +#SBATCH --qos=${queue} +#SBATCH -A ${acct} +#SBATCH --time=${batchtime} +#SBATCH --nodes=${nnodes} +#SBATCH --ntasks-per-node=${taskpernodelimit} +#SBATCH --cpus-per-task=${nthrds} +#SBATCH -e slurm%j.err +#SBATCH -o slurm%j.out +##SBATCH --mail-type FAIL +##SBATCH --mail-user=xxx@noaa.gov EOFB else if (${ICE_MACHINE} =~ phase3*) then +if ( ${nnodes} > 15) then + setenv p3tile 16 + setenv mem `expr 100 \* 1024 / $nnodes` +else + setenv p3tile ${nnodes} + setenv mem 8192 +endif +echo mem = ${mem} nnodes and p3tiles ${nnodes} ${p3tile} p3tile must be le nnodes cat >> ${jobfile} << EOFB -# nothing to do +#BSUB -J ${ICE_CASENAME} +#BSUB -q "dev_shared" +#BSUB -P RTO-T2O +#BSUB -W `echo ${batchtime} | cut -f1-2 -d:` +#BSUB -n ${nnodes} +#BSUB -R "affinity[core]" +#BSUB -R "span[ptile=${p3tile}]" +#BSUB -R "rusage[mem=${mem}]" +#BSUB -o /u/Robert.Grumbine/${ICE_CASENAME}.out.%J +#BSUB -e /u/Robert.Grumbine/${ICE_CASENAME}.err.%J EOFB else if (${ICE_MACHINE} =~ high_Sierra*) then diff --git a/configuration/scripts/cice.build b/configuration/scripts/cice.build index 2534bfa7e..1729c52e6 100755 --- a/configuration/scripts/cice.build +++ b/configuration/scripts/cice.build @@ -115,13 +115,11 @@ if !(-d ${ICE_RUNDIR}) mkdir -p ${ICE_RUNDIR} if !(-d ${ICE_OBJDIR}) mkdir -p ${ICE_OBJDIR} cd ${ICE_OBJDIR} -setenv ICE_CPPDEFS " " - if (${ICE_IOTYPE} == 'netcdf') then set IODIR = io_netcdf setenv ICE_CPPDEFS "${ICE_CPPDEFS} -Dncdf" -else if (${ICE_IOTYPE} == 'pio') then - set IODIR = io_pio +else if (${ICE_IOTYPE} =~ pio*) then + set IODIR = io_pio2 setenv ICE_CPPDEFS "${ICE_CPPDEFS} -Dncdf" else set IODIR = io_binary diff --git a/configuration/scripts/cice.launch.csh b/configuration/scripts/cice.launch.csh index 17a260e06..297f1df39 100755 --- a/configuration/scripts/cice.launch.csh +++ b/configuration/scripts/cice.launch.csh @@ -153,7 +153,7 @@ EOFR endif #======= -else if (${ICE_MACHINE} =~ brooks*) then +else if (${ICE_MACHINE} =~ daley* || ${ICE_MACHINE} =~ banting*) then if (${ICE_COMMDIR} =~ serial*) then cat >> ${jobfile} << EOFR ./cice >&! \$ICE_RUNLOG_FILE @@ -165,21 +165,19 @@ EOFR endif #======= -else if (${ICE_MACHINE} =~ theia*) then +else if (${ICE_MACHINE} =~ hera*) then cat >> ${jobfile} << EOFR -#mpirun -np ${ntasks} ./cice >&! \$ICE_RUNLOG_FILE srun -n ${ntasks} -c ${nthrds} ./cice >&! \$ICE_RUNLOG_FILE -#./cice >&! \$ICE_RUNLOG_FILE EOFR + #======= -else if (${ICE_MACHINE} =~ high_Sierra*) then +else if (${ICE_MACHINE} =~ orion*) then cat >> ${jobfile} << EOFR -mpirun -np ${ntasks} ./cice >&! \$ICE_RUNLOG_FILE -#./cice >&! \$ICE_RUNLOG_FILE +srun -n ${ntasks} -c ${nthrds} ./cice >&! \$ICE_RUNLOG_FILE EOFR #======= -else if (${ICE_MACHINE} =~ phase2*) then +else if (${ICE_MACHINE} =~ high_Sierra*) then cat >> ${jobfile} << EOFR mpirun -np ${ntasks} ./cice >&! \$ICE_RUNLOG_FILE #./cice >&! \$ICE_RUNLOG_FILE @@ -191,6 +189,7 @@ cat >> ${jobfile} << EOFR mpirun -np ${ntasks} ./cice >&! \$ICE_RUNLOG_FILE #./cice >&! \$ICE_RUNLOG_FILE EOFR + #======= else if (${ICE_MACHINE} =~ testmachine*) then cat >> ${jobfile} << EOFR diff --git a/configuration/scripts/cice.run.setup.csh b/configuration/scripts/cice.run.setup.csh index 5611ed618..2134d345c 100755 --- a/configuration/scripts/cice.run.setup.csh +++ b/configuration/scripts/cice.run.setup.csh @@ -46,6 +46,8 @@ cd \${ICE_RUNDIR} setenv OMP_NUM_THREADS ${nthrds} cp -f \${ICE_CASEDIR}/ice_in \${ICE_RUNDIR} +cp -f \${ICE_CASEDIR}/env.${ICE_MACHCOMP} \${ICE_RUNDIR} +cp -f \${ICE_CASEDIR}/cice.settings \${ICE_RUNDIR} set diagtype = \`grep -i diag_type \${ICE_CASEDIR}/ice_in | grep -i stdout | wc -l\` set diagfile = \`grep -i diag_file \${ICE_CASEDIR}/ice_in | sed -e "s/.* = '\(.*\)'/\1/"\` diff --git a/configuration/scripts/cice.settings b/configuration/scripts/cice.settings index 7d9bce65c..19b695ba1 100755 --- a/configuration/scripts/cice.settings +++ b/configuration/scripts/cice.settings @@ -13,8 +13,9 @@ setenv ICE_RSTDIR ${ICE_RUNDIR}/restart setenv ICE_HSTDIR ${ICE_RUNDIR}/history setenv ICE_LOGDIR ${ICE_CASEDIR}/logs setenv ICE_DRVOPT standalone/cice -setenv ICE_IOTYPE netcdf # set to none if netcdf library is unavailable +setenv ICE_IOTYPE netcdf # binary, netcdf, pio1, pio2 setenv ICE_CLEANBUILD true +setenv ICE_CPPDEFS "" setenv ICE_QUIETMODE false setenv ICE_GRID undefined setenv ICE_NTASKS undefined diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index dcfedf772..ec984397a 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -11,7 +11,7 @@ restart = .true. restart_ext = .false. use_restart_time = .true. - restart_format = 'nc' + restart_format = 'default' lcdf64 = .false. numin = 21 numax = 89 @@ -27,6 +27,7 @@ diag_file = 'ice_diag.d' print_global = .true. print_points = .true. + conserv_check = .false. latpnt(1) = 90. lonpnt(1) = 0. latpnt(2) = -65. @@ -37,6 +38,8 @@ hist_avg = .true. history_dir = './history/' history_file = 'iceh' + history_precision = 4 + history_format = 'default' write_ic = .true. incond_dir = './history/' incond_file = 'iceh_ic' @@ -493,7 +496,8 @@ f_fcondtopn_ai = 'x' f_fmelttn_ai = 'x' f_flatn_ai = 'x' - f_fsensn_ai = 'x' + f_fsensn_ai = 'x' + f_CMIP = 'x' / &icefields_mechred_nml diff --git a/configuration/scripts/machines/Macros.badger_intel b/configuration/scripts/machines/Macros.badger_intel index 9a92262c2..ce4eccc9c 100644 --- a/configuration/scripts/machines/Macros.badger_intel +++ b/configuration/scripts/machines/Macros.badger_intel @@ -54,10 +54,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/usr/projects/climate/SHARED_CLIMATE/software/conejo/pio/1.7.2/intel-13.0.1/openmpi-1.6.3/netcdf-3.6.3-parallel-netcdf-1.3.1/include - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.banting_gnu b/configuration/scripts/machines/Macros.banting_gnu new file mode 100644 index 000000000..769470f6d --- /dev/null +++ b/configuration/scripts/machines/Macros.banting_gnu @@ -0,0 +1,39 @@ +#============================================================================== +# Makefile macros for ECCC banting +#============================================================================== +# For use with GNU compiler +#============================================================================== + +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 +#-xHost + +FREEFLAGS := -ffree-form +FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none +#-xHost + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow +else + FFLAGS += -O2 +endif + +SCC := cc +SFC := ftn +MPICC := cc +MPIFC := ftn + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -fopenmp + CFLAGS += -fopenmp + FFLAGS += -fopenmp +endif diff --git a/configuration/scripts/machines/Macros.banting_intel b/configuration/scripts/machines/Macros.banting_intel new file mode 100644 index 000000000..96b6933f0 --- /dev/null +++ b/configuration/scripts/machines/Macros.banting_intel @@ -0,0 +1,40 @@ +#============================================================================== +# Makefile macros for ECCC banting +#============================================================================== +# For use with intel compiler +#============================================================================== + +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 -fp-model precise +#-xHost + +FREEFLAGS := -FR +FFLAGS := -fp-model source -convert big_endian -assume byterecl -ftz -traceback +#-xHost + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -check -fpe0 -ftrapuv -fp-model except -check noarg_temp_created +# -heap-arrays 1024 +else + FFLAGS += -O2 +endif + +SCC := cc +SFC := ftn +MPICC := cc +MPIFC := ftn + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif diff --git a/configuration/scripts/machines/Macros.brooks_intel b/configuration/scripts/machines/Macros.brooks_intel deleted file mode 100644 index a6fecdbbb..000000000 --- a/configuration/scripts/machines/Macros.brooks_intel +++ /dev/null @@ -1,73 +0,0 @@ -#============================================================================== -# Makefile macros for ECCC brooks -#============================================================================== -# For use with intel compiler -#============================================================================== - -CPP := fpp -CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} -CFLAGS := -c -O2 -fp-model precise -#-xHost - -FIXEDFLAGS := -132 -FREEFLAGS := -FR -FFLAGS := -fp-model source -convert big_endian -assume byterecl -ftz -traceback -diag-disable 5140 -#-xHost -FFLAGS_NOOPT:= -O0 - -ifeq ($(ICE_BLDDEBUG), true) - FFLAGS += -O0 -g -check -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -# -heap-arrays 1024 -else - FFLAGS += -O2 -endif - -SCC := cc -SFC := ftn -MPICC := cc -MPIFC := ftn - -ifeq ($(ICE_COMMDIR), mpi) - FC := $(MPIFC) - CC := $(MPICC) -else - FC := $(SFC) - CC := $(SCC) -endif -LD:= $(FC) - -#NETCDF_PATH := /fs/ssm/hpco/tmp/eccc/201402/04/intel-2016.1.150/ubuntu-14.04-amd64-64/ - -PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs - -#PNETCDF_PATH := $(PNETCDF) -#PNETCDF_PATH := /glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib - -INCLDIR := $(INCLDIR) - -LIB_NETCDF := $(NETCDF_PATH)/lib -LIB_PNETCDF := $(PNETCDF_PATH)/lib -LIB_MPI := $(IMPILIBDIR) - -#SLIBS := -L$(LIB_NETCDF) -lnetcdff -lnetcdf -L$(LIB_PNETCDF) -lpnetcdf -lgptl -#SLIBS := -L$(LIB_NETCDF) -lnetcdff -lnetcdf - -ifeq ($(ICE_IOTYPE), netcdf) - INCLDIR += $(shell nf-config --fflags) - SLIBS := $(shell nf-config --flibs) -endif - - -ifeq ($(ICE_THREADED), true) - LDFLAGS += -qopenmp - CFLAGS += -qopenmp - FFLAGS += -qopenmp -endif - -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib - INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof -endif - diff --git a/configuration/scripts/machines/Macros.cesium_intel b/configuration/scripts/machines/Macros.cesium_intel index 486ba10e4..1bca1ddac 100644 --- a/configuration/scripts/machines/Macros.cesium_intel +++ b/configuration/scripts/machines/Macros.cesium_intel @@ -11,7 +11,7 @@ CFLAGS := -c -O2 -fp-model precise FIXEDFLAGS := -132 FREEFLAGS := -FR -FFLAGS := -fp-model source -convert big_endian -assume byterecl -ftz -traceback -diag-disable 5140 +FFLAGS := -fp-model source -convert big_endian -assume byterecl -ftz -traceback #-xHost FFLAGS_NOOPT:= -O0 @@ -58,10 +58,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -openmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib - INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof -endif - diff --git a/configuration/scripts/machines/Macros.cheyenne_gnu b/configuration/scripts/machines/Macros.cheyenne_gnu new file mode 100644 index 000000000..657a66223 --- /dev/null +++ b/configuration/scripts/machines/Macros.cheyenne_gnu @@ -0,0 +1,78 @@ +#============================================================================== +# Makefile macros for NCAR cheyenne, gnu compiler +#============================================================================== + +CPP := ftn -E +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c + +FIXEDFLAGS := -ffixed-line-length-132 +FREEFLAGS := -ffree-form +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 + 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 +SFC := gfortran +MPICC := mpicc +MPIFC := mpif90 + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +NETCDF_PATH := $(NETCDF) + +PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs + +#PNETCDF_PATH := $(PNETCDF) +#PNETCDF_PATH := /glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib + +INCLDIR := $(INCLDIR) + +LIB_NETCDF := $(NETCDF_PATH)/lib +#LIB_PNETCDF := $(PNETCDF_PATH)/lib +LIB_MPI := $(IMPILIBDIR) + +#SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -fopenmp + CFLAGS += -fopenmp + FFLAGS += -fopenmp +endif + +ifeq ($(ICE_IOTYPE), pio1) + LIB_PIO := $(PIO_LIBDIR) + SLIBS := $(SLIBS) -L$(LIB_PIO) -lpio +endif + +ifeq ($(ICE_IOTYPE), pio2) + CPPDEFS := $(CPPDEFS) -DGPTL + LIB_PIO := $(PIO_LIBDIR) + SLIBS := $(SLIBS) -L$(LIB_PIO) -lpiof -lpioc -lgptl +endif + diff --git a/configuration/scripts/machines/Macros.cheyenne_intel b/configuration/scripts/machines/Macros.cheyenne_intel index 86b9a1d4e..902224766 100644 --- a/configuration/scripts/machines/Macros.cheyenne_intel +++ b/configuration/scripts/machines/Macros.cheyenne_intel @@ -53,10 +53,14 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib - INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof +ifeq ($(ICE_IOTYPE), pio1) + LIB_PIO := $(PIO_LIBDIR) + SLIBS := $(SLIBS) -L$(LIB_PIO) -lpio +endif + +ifeq ($(ICE_IOTYPE), pio2) + CPPDEFS := $(CPPDEFS) -DGPTL + LIB_PIO := $(PIO_LIBDIR) + SLIBS := $(SLIBS) -L$(LIB_PIO) -lpiof -lpioc -lgptl endif diff --git a/configuration/scripts/machines/Macros.cheyenne_pgi b/configuration/scripts/machines/Macros.cheyenne_pgi new file mode 100644 index 000000000..c1a8a0465 --- /dev/null +++ b/configuration/scripts/machines/Macros.cheyenne_pgi @@ -0,0 +1,67 @@ +#============================================================================== +# Makefile macros for NCAR cheyenne, gnu compiler +#============================================================================== + +CPP := pgcc -Mcpp +CPPDEFS := -DFORTRANUNDERSCORE -DNO_R16 ${ICE_CPPDEFS} +CFLAGS := -c -O2 -Kieee + +FIXEDFLAGS := -Mextend +FREEFLAGS := -Mfree +FFLAGS := -Kieee -Mbyteswapio -traceback +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) +# FFLAGS += -O0 -g -Mbounds -Mchkptr + FFLAGS += -O0 -g -Mchkptr +else + FFLAGS += -O -g +endif + +SCC := pgcc +SFC := pgf90 +MPICC := mpicc +MPIFC := mpif90 + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +NETCDF_PATH := $(NETCDF) + +PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs + +#PNETCDF_PATH := $(PNETCDF) +#PNETCDF_PATH := /glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib + +INCLDIR := $(INCLDIR) + +LIB_NETCDF := $(NETCDF_PATH)/lib +#LIB_PNETCDF := $(PNETCDF_PATH)/lib +LIB_MPI := $(IMPILIBDIR) + +#SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -mp + CFLAGS += -mp + FFLAGS += -mp +endif + +ifeq ($(ICE_IOTYPE), pio1) + LIB_PIO := $(PIO_LIBDIR) + SLIBS := $(SLIBS) -L$(LIB_PIO) -lpio +endif + +ifeq ($(ICE_IOTYPE), pio2) + CPPDEFS := $(CPPDEFS) -DGPTL + LIB_PIO := $(PIO_LIBDIR) + SLIBS := $(SLIBS) -L$(LIB_PIO) -lpiof -lpioc -lgptl +endif + diff --git a/configuration/scripts/machines/Macros.conrad_cray b/configuration/scripts/machines/Macros.conrad_cray index f76652bed..19ddcb8f5 100644 --- a/configuration/scripts/machines/Macros.conrad_cray +++ b/configuration/scripts/machines/Macros.conrad_cray @@ -55,10 +55,3 @@ ifeq ($(ICE_THREADED), false) FFLAGS += -hnoomp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.conrad_gnu b/configuration/scripts/machines/Macros.conrad_gnu index 2f54d753e..5459d9b6b 100644 --- a/configuration/scripts/machines/Macros.conrad_gnu +++ b/configuration/scripts/machines/Macros.conrad_gnu @@ -53,10 +53,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -fopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.conrad_intel b/configuration/scripts/machines/Macros.conrad_intel index a5cb37a5c..74a36304d 100644 --- a/configuration/scripts/machines/Macros.conrad_intel +++ b/configuration/scripts/machines/Macros.conrad_intel @@ -54,10 +54,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.conrad_pgi b/configuration/scripts/machines/Macros.conrad_pgi index 29bcda360..ef0a25ab4 100644 --- a/configuration/scripts/machines/Macros.conrad_pgi +++ b/configuration/scripts/machines/Macros.conrad_pgi @@ -53,10 +53,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -mp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.cori_intel b/configuration/scripts/machines/Macros.cori_intel index 8e006e4cc..93eccaacb 100644 --- a/configuration/scripts/machines/Macros.cori_intel +++ b/configuration/scripts/machines/Macros.cori_intel @@ -53,10 +53,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.daley_gnu b/configuration/scripts/machines/Macros.daley_gnu new file mode 100644 index 000000000..be01e67fe --- /dev/null +++ b/configuration/scripts/machines/Macros.daley_gnu @@ -0,0 +1,39 @@ +#============================================================================== +# Makefile macros for ECCC daley +#============================================================================== +# For use with GNU compiler +#============================================================================== + +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 +#-xHost + +FREEFLAGS := -ffree-form +FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none +#-xHost + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow +else + FFLAGS += -O2 +endif + +SCC := cc +SFC := ftn +MPICC := cc +MPIFC := ftn + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -fopenmp + CFLAGS += -fopenmp + FFLAGS += -fopenmp +endif diff --git a/configuration/scripts/machines/Macros.daley_intel b/configuration/scripts/machines/Macros.daley_intel new file mode 100644 index 000000000..373c9cc42 --- /dev/null +++ b/configuration/scripts/machines/Macros.daley_intel @@ -0,0 +1,40 @@ +#============================================================================== +# Makefile macros for ECCC daley +#============================================================================== +# For use with intel compiler +#============================================================================== + +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 -fp-model precise +#-xHost + +FREEFLAGS := -FR +FFLAGS := -fp-model source -convert big_endian -assume byterecl -ftz -traceback +#-xHost + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -check -fpe0 -ftrapuv -fp-model except -check noarg_temp_created +# -heap-arrays 1024 +else + FFLAGS += -O2 +endif + +SCC := cc +SFC := ftn +MPICC := cc +MPIFC := ftn + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif diff --git a/configuration/scripts/machines/Macros.fram_intel b/configuration/scripts/machines/Macros.fram_intel index 27681178e..5804b1475 100644 --- a/configuration/scripts/machines/Macros.fram_intel +++ b/configuration/scripts/machines/Macros.fram_intel @@ -58,10 +58,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -openmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib - INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof -endif - diff --git a/configuration/scripts/machines/Macros.gaffney_gnu b/configuration/scripts/machines/Macros.gaffney_gnu index 0d13560de..87b489ae1 100644 --- a/configuration/scripts/machines/Macros.gaffney_gnu +++ b/configuration/scripts/machines/Macros.gaffney_gnu @@ -66,10 +66,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -fopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.gaffney_intel b/configuration/scripts/machines/Macros.gaffney_intel index bfad4b54c..61dfe2518 100644 --- a/configuration/scripts/machines/Macros.gaffney_intel +++ b/configuration/scripts/machines/Macros.gaffney_intel @@ -55,10 +55,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.gordon_cray b/configuration/scripts/machines/Macros.gordon_cray index 4f9c43da1..6c5032e0d 100644 --- a/configuration/scripts/machines/Macros.gordon_cray +++ b/configuration/scripts/machines/Macros.gordon_cray @@ -55,10 +55,3 @@ ifeq ($(ICE_THREADED), false) FFLAGS += -hnoomp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.gordon_gnu b/configuration/scripts/machines/Macros.gordon_gnu index 2e80f7364..61c81f936 100644 --- a/configuration/scripts/machines/Macros.gordon_gnu +++ b/configuration/scripts/machines/Macros.gordon_gnu @@ -65,10 +65,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -fopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.gordon_intel b/configuration/scripts/machines/Macros.gordon_intel index 73214ec26..84659d00a 100644 --- a/configuration/scripts/machines/Macros.gordon_intel +++ b/configuration/scripts/machines/Macros.gordon_intel @@ -53,10 +53,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.gordon_pgi b/configuration/scripts/machines/Macros.gordon_pgi index 45d03c64f..1190f6eca 100644 --- a/configuration/scripts/machines/Macros.gordon_pgi +++ b/configuration/scripts/machines/Macros.gordon_pgi @@ -53,10 +53,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -mp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.phase2_intel b/configuration/scripts/machines/Macros.hera_intel similarity index 60% rename from configuration/scripts/machines/Macros.phase2_intel rename to configuration/scripts/machines/Macros.hera_intel index 962aa84a6..519e3a5ba 100644 --- a/configuration/scripts/machines/Macros.phase2_intel +++ b/configuration/scripts/machines/Macros.hera_intel @@ -1,15 +1,14 @@ #============================================================================== -# Makefile macros for generic test machine, intel compiler +# Makefile macros for NOAA hera, intel compiler #============================================================================== CPP := fpp CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} -#CFLAGS := -c -O2 -fp-model precise -xHost -CFLAGS := -c -O2 +CFLAGS := -c -O2 -fp-model precise -xHost FIXEDFLAGS := -132 FREEFLAGS := -FR -FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost +FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -align array64byte -xHost FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) @@ -20,7 +19,7 @@ endif SCC := icc SFC := ifort -MPICC := mpicc +MPICC := mpiicc MPIFC := mpiifort ifeq ($(ICE_COMMDIR), mpi) @@ -36,12 +35,18 @@ NETCDF_PATH := $(NETCDF) PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs -INCLDIR := $(INCLDIR) $(NETCDF_INCLUDE) +#PNETCDF_PATH := $(PNETCDF) +#PNETCDF_PATH := /glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib +INC_NETCDF := $(NETCDF_PATH)/include LIB_NETCDF := $(NETCDF_PATH)/lib -LIB_MPI := $(IMPILIBDIR) -SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff +#LIB_PNETCDF := $(PNETCDF_PATH)/lib +#LIB_MPI := $(IMPILIBDIR) + +INCLDIR := $(INCLDIR) -I$(INC_NETCDF) +#SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff ifeq ($(ICE_THREADED), true) LDFLAGS += -qopenmp @@ -49,9 +54,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -#ifeq ($(ICE_IOTYPE), pio) -# PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib -# INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include -# SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof -#endif diff --git a/configuration/scripts/machines/Macros.high_Sierra_gnu b/configuration/scripts/machines/Macros.high_Sierra_gnu index 960779da1..8f4f90564 100644 --- a/configuration/scripts/machines/Macros.high_Sierra_gnu +++ b/configuration/scripts/machines/Macros.high_Sierra_gnu @@ -1,5 +1,5 @@ #============================================================================== -# Makefile macros for Travis-CI - GCC and openmpi compilers +# Makefile macros for high sierra - GCC and openmpi compilers #============================================================================== CPP := cpp diff --git a/configuration/scripts/machines/Macros.hobart_intel b/configuration/scripts/machines/Macros.hobart_intel index f5b3044b0..f4dbedacf 100644 --- a/configuration/scripts/machines/Macros.hobart_intel +++ b/configuration/scripts/machines/Macros.hobart_intel @@ -40,10 +40,3 @@ LIB_MPI := $(IMPILIBDIR) SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L/usr/lib64 -llapack -mkl=cluster -## if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:= - INCLDIR += -I - SLIBS := $(SLIB) -L$(PIO_PATH) -lpiofS -endif - diff --git a/configuration/scripts/machines/Macros.hobart_nag b/configuration/scripts/machines/Macros.hobart_nag index 2ed098893..998008972 100644 --- a/configuration/scripts/machines/Macros.hobart_nag +++ b/configuration/scripts/machines/Macros.hobart_nag @@ -40,9 +40,3 @@ LIB_MPI := $(IMPILIBDIR) SLIBS := -L/usr/local/nag-6.2/lib/NAG_Fortran -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L/usr/lib64 -llapack -lblas -## if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:= - INCLDIR += -I - SLIBS := $(SLIB) -L$(PIO_PATH) -lpiof -endif diff --git a/configuration/scripts/machines/Macros.izumi_gnu b/configuration/scripts/machines/Macros.izumi_gnu index cdc6620f4..7f2f4739e 100644 --- a/configuration/scripts/machines/Macros.izumi_gnu +++ b/configuration/scripts/machines/Macros.izumi_gnu @@ -55,10 +55,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -fopenmp endif -## if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:= - INCLDIR += -I - SLIBS := $(SLIB) -L$(PIO_PATH) -lpiofS -endif - diff --git a/configuration/scripts/machines/Macros.izumi_intel b/configuration/scripts/machines/Macros.izumi_intel index 0aee3cdd5..d4ace1d52 100644 --- a/configuration/scripts/machines/Macros.izumi_intel +++ b/configuration/scripts/machines/Macros.izumi_intel @@ -43,10 +43,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -## if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:= - INCLDIR += -I - SLIBS := $(SLIB) -L$(PIO_PATH) -lpiofS -endif - diff --git a/configuration/scripts/machines/Macros.izumi_nag b/configuration/scripts/machines/Macros.izumi_nag index 3246635bc..c12edb904 100644 --- a/configuration/scripts/machines/Macros.izumi_nag +++ b/configuration/scripts/machines/Macros.izumi_nag @@ -45,9 +45,3 @@ else FFLAGS += -gline endif -## if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:= - INCLDIR += -I - SLIBS := $(SLIB) -L$(PIO_PATH) -lpiof -endif diff --git a/configuration/scripts/machines/Macros.izumi_pgi b/configuration/scripts/machines/Macros.izumi_pgi index 31eca6039..f89ae78c8 100644 --- a/configuration/scripts/machines/Macros.izumi_pgi +++ b/configuration/scripts/machines/Macros.izumi_pgi @@ -43,10 +43,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -mp endif -## if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:= - INCLDIR += -I - SLIBS := $(SLIB) -L$(PIO_PATH) -lpiofS -endif - diff --git a/configuration/scripts/machines/Macros.koehr_intel b/configuration/scripts/machines/Macros.koehr_intel index d77e90768..284d30c55 100644 --- a/configuration/scripts/machines/Macros.koehr_intel +++ b/configuration/scripts/machines/Macros.koehr_intel @@ -55,10 +55,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.millikan_intel b/configuration/scripts/machines/Macros.millikan_intel index 7bdaac0e6..9b86e442b 100644 --- a/configuration/scripts/machines/Macros.millikan_intel +++ b/configuration/scripts/machines/Macros.millikan_intel @@ -11,7 +11,7 @@ CFLAGS := -c -O2 -fp-model precise FIXEDFLAGS := -132 FREEFLAGS := -FR -FFLAGS := -fp-model source -convert big_endian -assume byterecl -ftz -traceback -diag-disable 5140 +FFLAGS := -fp-model source -convert big_endian -assume byterecl -ftz -traceback #-xHost FFLAGS_NOOPT:= -O0 @@ -58,10 +58,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -openmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib - INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof -endif - diff --git a/configuration/scripts/machines/Macros.onyx_cray b/configuration/scripts/machines/Macros.onyx_cray index aa185e2e5..6753a78e5 100644 --- a/configuration/scripts/machines/Macros.onyx_cray +++ b/configuration/scripts/machines/Macros.onyx_cray @@ -54,10 +54,3 @@ ifeq ($(ICE_THREADED), false) FFLAGS += -hnoomp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.onyx_gnu b/configuration/scripts/machines/Macros.onyx_gnu index d423cd9ab..93de0a55d 100644 --- a/configuration/scripts/machines/Macros.onyx_gnu +++ b/configuration/scripts/machines/Macros.onyx_gnu @@ -65,10 +65,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -fopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.onyx_intel b/configuration/scripts/machines/Macros.onyx_intel index b7f685ac1..55f6fbbf5 100644 --- a/configuration/scripts/machines/Macros.onyx_intel +++ b/configuration/scripts/machines/Macros.onyx_intel @@ -53,10 +53,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/Macros.orion_intel b/configuration/scripts/machines/Macros.orion_intel new file mode 100644 index 000000000..aae839f4e --- /dev/null +++ b/configuration/scripts/machines/Macros.orion_intel @@ -0,0 +1,56 @@ +#============================================================================== +# Makefile macros for MSU orion, intel compiler +#============================================================================== + +CPP := fpp +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 -fp-model precise -xHost + +FIXEDFLAGS := -132 +FREEFLAGS := -FR +FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -align array64byte -xHost +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created +else + FFLAGS += -O2 +endif + +SCC := icc +SFC := ifort +MPICC := mpiicc +MPIFC := mpiifort + +ifeq ($(ICE_COMMDIR), mpi) + FC := $(MPIFC) + CC := $(MPICC) +else + FC := $(SFC) + CC := $(SCC) +endif +LD:= $(FC) + +NETCDF_PATH := $(NETCDF_ROOT) + +PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs + +#PNETCDF_PATH := $(PNETCDF) +#PNETCDF_PATH := /glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib + +INC_NETCDF := $(NETCDF_PATH)/include +LIB_NETCDF := $(NETCDF_PATH)/lib + +#LIB_PNETCDF := $(PNETCDF_PATH)/lib +#LIB_MPI := $(IMPILIBDIR) + +INCLDIR := $(INCLDIR) -I$(INC_NETCDF) +#SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif + diff --git a/configuration/scripts/machines/Macros.phase3_intel b/configuration/scripts/machines/Macros.phase3_intel index 076b2aab1..93089257d 100644 --- a/configuration/scripts/machines/Macros.phase3_intel +++ b/configuration/scripts/machines/Macros.phase3_intel @@ -1,5 +1,5 @@ #============================================================================== -# Makefile macros for generic test machine, intel compiler +# Makefile macros for wcoss phase3 machine, intel compiler #============================================================================== CPP := fpp @@ -50,9 +50,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -#ifeq ($(ICE_IOTYPE), pio) -# PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib -# INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include -# SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof -#endif diff --git a/configuration/scripts/machines/Macros.testmachine_intel b/configuration/scripts/machines/Macros.testmachine_intel index 20c1f3610..9212cb384 100644 --- a/configuration/scripts/machines/Macros.testmachine_intel +++ b/configuration/scripts/machines/Macros.testmachine_intel @@ -52,10 +52,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib - INCLDIR += -I/glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/include - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpiof -endif - diff --git a/configuration/scripts/machines/Macros.theia_gnu b/configuration/scripts/machines/Macros.theia_gnu deleted file mode 100644 index 63cce4b99..000000000 --- a/configuration/scripts/machines/Macros.theia_gnu +++ /dev/null @@ -1,48 +0,0 @@ -#============================================================================== -# Makefile macros for theia - intel and openmpi compilers -#============================================================================== - -CPP := cpp -CPPDEFS := -DFORTRANUNDERSCORE -DNO_R16 -DHAVE_F2008_CONTIGUOUS -DLINUX -DCPRINTEL ${ICE_CPPDEFS} -CFLAGS := -c -O2 -xHost - -FFLAGS := -fconvert=big-endian -#FFLAGS := -h bytwswapio -#FFLAGS := -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 -endif - -#Note that on theia mpif90 refers to gfortran even though it is in the intel bin -FC := mpif90 - -MPICC:= - -MPIFC:= mpif90 -LD:= $(MPIFC) - -NETCDF_PATH := $(NETCDF) - -ifeq ($(ICE_IOTYPE), netcdf) - NETCDF_PATH := $(shell nc-config --prefix) - INCLDIR := $(INCLDIR) -I$(NETCDF_PATH)/include - LIB_NETCDF := $(NETCDF_PATH)/lib - LIB_PNETCDF := - SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -else - SLIBS := -endif - -LIB_MPI := -SCC:= -SFC:= - -ifeq ($(ICE_THREADED), true) - LDFLAGS += -fopenmp - CFLAGS += -fopenmp - FFLAGS += -fopenmp -endif diff --git a/configuration/scripts/machines/Macros.theia_intel b/configuration/scripts/machines/Macros.theia_intel deleted file mode 100644 index 38cc62ed8..000000000 --- a/configuration/scripts/machines/Macros.theia_intel +++ /dev/null @@ -1,60 +0,0 @@ -#============================================================================== -# Makefile macros for theia - intel and openmpi compilers -#============================================================================== - -CPP := cpp -CPPDEFS := -DFORTRANUNDERSCORE -DNO_R16 -DHAVE_F2008_CONTIGUOUS -DLINUX -DCPRINTEL ${ICE_CPPDEFS} -CFLAGS := -c -O2 -xHost - -FIXEDFLAGS := -132 -FREEFLAGS := -FR -FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost - -FFLAGS_NOOPT:= -O0 - -ifeq ($(ICE_BLDDEBUG), true) -#RG: this looks more like gfortran options: -## FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow - FFLAGS += -O0 -g -check-bounds -implicit-none -fpe3 -else - FFLAGS += -O2 -endif - -#Note that on theia mpif90 refers to gfortran even though it is in the intel bin -FC := mpiifort -MPIFC:= mpiifort -LD:= $(MPIFC) - -NETCDF_PATH := $(NETCDF) - -ifeq ($(ICE_IOTYPE), netcdf) - NETCDF_PATH := $(shell nc-config --prefix) - INCLDIR := $(INCLDIR) -I$(NETCDF_PATH)/include - LIB_NETCDF := $(NETCDF_PATH)/lib - LIB_PNETCDF := - SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -else - SLIBS := -endif - -LIB_MPI := - - -SCC := icc -SFC := ifort -MPICC := mpiicc -MPIFC := mpiifort - -ifeq ($(ICE_COMMDIR), mpi) - FC := $(MPIFC) - CC := $(MPICC) -else - FC := $(SFC) - CC := $(SCC) -endif - -ifeq ($(ICE_THREADED), true) - LDFLAGS += -fopenmp - CFLAGS += -fopenmp - FFLAGS += -fopenmp -endif diff --git a/configuration/scripts/machines/Macros.theia_pgi b/configuration/scripts/machines/Macros.theia_pgi deleted file mode 100644 index 83bcc264d..000000000 --- a/configuration/scripts/machines/Macros.theia_pgi +++ /dev/null @@ -1,48 +0,0 @@ -#============================================================================== -# Makefile macros for theia - intel and openmpi compilers -#============================================================================== - -CPP := cpp -CPPDEFS := -DFORTRANUNDERSCORE -DNO_R16 -DHAVE_F2008_CONTIGUOUS -DLINUX -DCPRINTEL ${ICE_CPPDEFS} -CFLAGS := -c -O2 -xHost - -FIXEDFLAGS := -132 -FREEFLAGS := -FR -FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost - -FFLAGS_NOOPT:= -O0 - -ifeq ($(ICE_BLDDEBUG), true) -#RG: this looks more like gfortran options: -## FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow - FFLAGS += -O0 -g -check-bounds -implicit-none -fpe3 -else - FFLAGS += -O2 -endif - -FC := mpif90 -MPICC:= -MPIFC:= mpif90 -LD:= $(MPIFC) - -NETCDF_PATH := $(NETCDF) - -ifeq ($(ICE_IOTYPE), netcdf) - NETCDF_PATH := $(shell nc-config --prefix) - INCLDIR := $(INCLDIR) -I$(NETCDF_PATH)/include - LIB_NETCDF := $(NETCDF_PATH)/lib - LIB_PNETCDF := - SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -else - SLIBS := -endif - -LIB_MPI := -SCC:= -SFC:= - -ifeq ($(ICE_THREADED), true) - LDFLAGS += -fopenmp - CFLAGS += -fopenmp - FFLAGS += -fopenmp -endif diff --git a/configuration/scripts/machines/Macros.thunder_intel b/configuration/scripts/machines/Macros.thunder_intel index 581e31909..7163fb883 100644 --- a/configuration/scripts/machines/Macros.thunder_intel +++ b/configuration/scripts/machines/Macros.thunder_intel @@ -54,10 +54,3 @@ ifeq ($(ICE_THREADED), true) FFLAGS += -qopenmp endif -### if using parallel I/O, load all 3 libraries. PIO must be first! -ifeq ($(ICE_IOTYPE), pio) - PIO_PATH:=/glade/u/home/jedwards/pio1_6_5/pio - INCLDIR += -I$(PIO_PATH) - SLIBS := $(SLIBS) -L$(PIO_PATH) -lpio -endif - diff --git a/configuration/scripts/machines/env.banting_gnu b/configuration/scripts/machines/env.banting_gnu new file mode 100755 index 000000000..7b1a55eac --- /dev/null +++ b/configuration/scripts/machines/env.banting_gnu @@ -0,0 +1,36 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source /opt/modules/default/init/csh # Initialize modules for csh +# Clear environment +module unload craype-x86-skylake +module unload PrgEnv-intel + +module load PrgEnv-gnu # GNU compiler +module load craype-x86-skylake # Reload +module load cray-mpich # MPI (Cray MPICH) +module load cray-netcdf # NetCDF +module load cray-hdf5 # HDF5 +setenv HDF5_USE_FILE_LOCKING FALSE # necessary since data is on an NFS filesystem + +endif + +setenv ICE_MACHINE_ENVNAME banting +setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MAKE make +setenv ICE_MACHINE_WKDIR ~/data/banting/cice/runs +setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/sice500/ +setenv ICE_MACHINE_BASELINE ~/data/banting/cice/baselines +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_TPNODE 40 +setenv ICE_MACHINE_MAXRUNLENGTH 3 +setenv ICE_MACHINE_ACCT P0000000 +setenv ICE_MACHINE_QUEUE "development" +setenv ICE_MACHINE_BLDTHRDS 18 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.banting_intel b/configuration/scripts/machines/env.banting_intel new file mode 100755 index 000000000..48dce9d1e --- /dev/null +++ b/configuration/scripts/machines/env.banting_intel @@ -0,0 +1,31 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source /opt/modules/default/init/csh # Initialize modules for csh +module load PrgEnv-intel # Intel compiler +module load cray-mpich # MPI (Cray MPICH) +module load cray-netcdf # NetCDF +module load cray-hdf5 # HDF5 +setenv HDF5_USE_FILE_LOCKING FALSE # necessary since data is on an NFS filesystem + +endif + +setenv ICE_MACHINE_ENVNAME banting +setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MAKE make +setenv ICE_MACHINE_WKDIR ~/data/banting/cice/runs +setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/sice500/ +setenv ICE_MACHINE_BASELINE ~/data/banting/cice/baselines +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_TPNODE 40 +setenv ICE_MACHINE_MAXRUNLENGTH 3 +setenv ICE_MACHINE_ACCT P0000000 +setenv ICE_MACHINE_QUEUE "development" +setenv ICE_MACHINE_BLDTHRDS 18 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.brooks_intel b/configuration/scripts/machines/env.brooks_intel deleted file mode 100755 index 4a51b5bb1..000000000 --- a/configuration/scripts/machines/env.brooks_intel +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/csh -f - -source /opt/modules/default/init/csh -module load PrgEnv-intel # Intel compiler -module load cray-mpich # MPI (Cray MPICH) -module load cray-netcdf # NetCDF -module load cray-hdf5 # HDF5 - -setenv ICE_MACHINE_ENVNAME brooks -setenv ICE_MACHINE_COMPILER intel -setenv ICE_MACHINE_MAKE make -setenv ICE_MACHINE_WKDIR ~/data/brooks/cice/runs -setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/phb001/ -setenv ICE_MACHINE_BASELINE ~/data/brooks/cice/baselines -setenv ICE_MACHINE_SUBMIT "qsub" -setenv ICE_MACHINE_TPNODE 36 -setenv ICE_MACHINE_MAXRUNLENGTH 3 -setenv ICE_MACHINE_ACCT P0000000 -setenv ICE_MACHINE_QUEUE "development" -setenv ICE_MACHINE_BLDTHRDS 4 -setenv ICE_MACHINE_QSTAT "qstat " - -if (-e ~/.cice_proj) then - set account_name = `head -1 ~/.cice_proj` - setenv CICE_ACCT ${account_name} -endif diff --git a/configuration/scripts/machines/env.cheyenne_gnu b/configuration/scripts/machines/env.cheyenne_gnu new file mode 100755 index 000000000..f8f139dc0 --- /dev/null +++ b/configuration/scripts/machines/env.cheyenne_gnu @@ -0,0 +1,43 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source /glade/u/apps/ch/opt/lmod/7.2.1/lmod/7.2.1/init/csh + +module purge +module load ncarenv/1.2 +module load gnu/8.3.0 +module load mpt/2.19 +module load ncarcompilers/0.5.0 +module load netcdf/4.6.3 + +if ($ICE_IOTYPE =~ pio*) then + module unload netcdf + module load netcdf-mpi/4.6.3 + module load pnetcdf/1.11.1 + if ($ICE_IOTYPE == "pio1") then + module load pio/1.10.1 + else + module load pio/2.4.4 + endif +endif + +endif + +setenv ICE_MACHINE_ENVNAME cheyenne +setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR /glade/scratch/$user/CICE_RUNS +setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev +setenv ICE_MACHINE_BASELINE /glade/scratch/$user/CICE_BASELINE +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "regular" +setenv ICE_MACHINE_TPNODE 36 +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.cheyenne_intel b/configuration/scripts/machines/env.cheyenne_intel index e05c51db2..82cfd3aeb 100755 --- a/configuration/scripts/machines/env.cheyenne_intel +++ b/configuration/scripts/machines/env.cheyenne_intel @@ -16,6 +16,17 @@ module load mpt/2.19 module load ncarcompilers/0.5.0 module load netcdf/4.6.3 +if ($ICE_IOTYPE =~ pio*) then + module unload netcdf + module load netcdf-mpi/4.6.3 + module load pnetcdf/1.11.1 + if ($ICE_IOTYPE == "pio1") then + module load pio/1.10.1 + else + module load pio/2.4.4 + endif +endif + endif setenv ICE_MACHINE_ENVNAME cheyenne diff --git a/configuration/scripts/machines/env.cheyenne_pgi b/configuration/scripts/machines/env.cheyenne_pgi new file mode 100755 index 000000000..864c907e3 --- /dev/null +++ b/configuration/scripts/machines/env.cheyenne_pgi @@ -0,0 +1,43 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source /glade/u/apps/ch/opt/lmod/7.2.1/lmod/7.2.1/init/csh + +module purge +module load ncarenv/1.2 +module load pgi/19.9 +module load mpt/2.21 +module load ncarcompilers/0.5.0 +module load netcdf/4.7.3 + +if ($ICE_IOTYPE =~ pio*) then + module unload netcdf + module load netcdf-mpi/4.7.3 + module load pnetcdf/1.12.1 + if ($ICE_IOTYPE == "pio1") then + module load pio/1.10.1 + else + module load pio/2.4.4 + endif +endif + +endif + +setenv ICE_MACHINE_ENVNAME cheyenne +setenv ICE_MACHINE_COMPILER pgi +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR /glade/scratch/$user/CICE_RUNS +setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev +setenv ICE_MACHINE_BASELINE /glade/scratch/$user/CICE_BASELINE +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "regular" +setenv ICE_MACHINE_TPNODE 36 +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.daley_gnu b/configuration/scripts/machines/env.daley_gnu new file mode 100755 index 000000000..f77bf2d88 --- /dev/null +++ b/configuration/scripts/machines/env.daley_gnu @@ -0,0 +1,36 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source /opt/modules/default/init/csh # Initialize modules for csh +# Clear environment +module unload craype-x86-skylake +module unload PrgEnv-intel + +module load PrgEnv-gnu # GNU compiler +module load craype-x86-skylake # Reload +module load cray-mpich # MPI (Cray MPICH) +module load cray-netcdf # NetCDF +module load cray-hdf5 # HDF5 +setenv HDF5_USE_FILE_LOCKING FALSE # necessary since data is on an NFS filesystem + +endif + +setenv ICE_MACHINE_ENVNAME daley +setenv ICE_MACHINE_COMPILER gnu +setenv ICE_MACHINE_MAKE make +setenv ICE_MACHINE_WKDIR ~/data/daley/cice/runs +setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/sice500/ +setenv ICE_MACHINE_BASELINE ~/data/daley/cice/baselines +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_TPNODE 40 +setenv ICE_MACHINE_MAXRUNLENGTH 3 +setenv ICE_MACHINE_ACCT P0000000 +setenv ICE_MACHINE_QUEUE "development" +setenv ICE_MACHINE_BLDTHRDS 18 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.daley_intel b/configuration/scripts/machines/env.daley_intel new file mode 100755 index 000000000..0d25f983f --- /dev/null +++ b/configuration/scripts/machines/env.daley_intel @@ -0,0 +1,31 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source /opt/modules/default/init/csh # Initialize modules for csh +module load PrgEnv-intel # Intel compiler +module load cray-mpich # MPI (Cray MPICH) +module load cray-netcdf # NetCDF +module load cray-hdf5 # HDF5 +setenv HDF5_USE_FILE_LOCKING FALSE # necessary since data is on an NFS filesystem + +endif + +setenv ICE_MACHINE_ENVNAME daley +setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MAKE make +setenv ICE_MACHINE_WKDIR ~/data/daley/cice/runs +setenv ICE_MACHINE_INPUTDATA /home/ords/cmdd/cmde/sice500/ +setenv ICE_MACHINE_BASELINE ~/data/daley/cice/baselines +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_TPNODE 40 +setenv ICE_MACHINE_MAXRUNLENGTH 3 +setenv ICE_MACHINE_ACCT P0000000 +setenv ICE_MACHINE_QUEUE "development" +setenv ICE_MACHINE_BLDTHRDS 18 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.hera_intel b/configuration/scripts/machines/env.hera_intel new file mode 100755 index 000000000..9204cf046 --- /dev/null +++ b/configuration/scripts/machines/env.hera_intel @@ -0,0 +1,31 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source /etc/profile.d/modules.csh +#module list +module purge +module load intel/18.0.5.274 +module load impi/2018.0.4 +module load netcdf/4.7.0 +#module list + +endif + +setenv ICE_MACHINE_ENVNAME hera +setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR $HOME/scratch/CICE_RUNS +setenv ICE_MACHINE_INPUTDATA /home/Anthony.Craig/scratch/CICE_INPUTDATA +setenv ICE_MACHINE_BASELINE $HOME/scratch/CICE_BASELINE +setenv ICE_MACHINE_SUBMIT "sbatch" +setenv ICE_MACHINE_TPNODE 40 +setenv ICE_MACHINE_ACCT P0000000 +setenv ICE_MACHINE_QUEUE "batch" +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "squeue --jobs=" diff --git a/configuration/scripts/machines/env.high_Sierra_gnu b/configuration/scripts/machines/env.high_Sierra_gnu index cabd66944..db8bc01a3 100755 --- a/configuration/scripts/machines/env.high_Sierra_gnu +++ b/configuration/scripts/machines/env.high_Sierra_gnu @@ -4,7 +4,7 @@ setenv ICE_MACHINE_ENVNAME high_Sierra setenv ICE_MACHINE_COMPILER gnu setenv ICE_MACHINE_MAKE make setenv ICE_MACHINE_WKDIR /Volumes/ncep/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA /Volumes/Data/CICE_data +setenv ICE_MACHINE_INPUTDATA /Volumes/Data/ setenv ICE_MACHINE_BASELINE /Volumes/ncep/CICE_BASELINE setenv ICE_MACHINE_SUBMIT " " setenv ICE_MACHINE_TPNODE 4 diff --git a/configuration/scripts/machines/env.orion_intel b/configuration/scripts/machines/env.orion_intel new file mode 100755 index 000000000..7088bed49 --- /dev/null +++ b/configuration/scripts/machines/env.orion_intel @@ -0,0 +1,38 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +echo "Modules don't currently work with csh on Orion" +echo "Please run the following manually before running cice.setup" +echo " module purge" +echo " module load intel/2020" +echo " module load impi/2020" +echo " module load netcdf/4.7.2" + +##source /etc/profile.d/modules.csh +##module list +#module purge +#module load intel/2020 +#module load impi/2020 +#module load netcdf/4.7.2 +##module list + +endif + +setenv ICE_MACHINE_ENVNAME orion +setenv ICE_MACHINE_COMPILER intel +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR $HOME/scratch/CICE_RUNS +setenv ICE_MACHINE_INPUTDATA /home/acraig/scratch/CICE_INPUTDATA +setenv ICE_MACHINE_BASELINE $HOME/scratch/CICE_BASELINE +setenv ICE_MACHINE_SUBMIT "sbatch" +setenv ICE_MACHINE_TPNODE 20 +setenv ICE_MACHINE_ACCT P0000000 +setenv ICE_MACHINE_QUEUE "batch" +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "squeue --jobs=" diff --git a/configuration/scripts/machines/env.phase2_intel b/configuration/scripts/machines/env.phase2_intel deleted file mode 100755 index 2457d4721..000000000 --- a/configuration/scripts/machines/env.phase2_intel +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/csh -f - -setenv ICE_MACHINE_ENVNAME phase2 -setenv ICE_MACHINE_COMPILER intel -setenv ICE_MACHINE_MAKE gmake -setenv ICE_MACHINE_WKDIR ~/noscrub/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA ~/noscrub/ -setenv ICE_MACHINE_BASELINE ~/noscrub/CICE_BASELINE -setenv ICE_MACHINE_SUBMIT " " -setenv ICE_MACHINE_TPNODE 4 -setenv ICE_MACHINE_QUEUE "default" -setenv ICE_MACHINE_ACCT P0000000 -setenv ICE_MACHINE_BLDTHRDS 1 -setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.phase3_intel b/configuration/scripts/machines/env.phase3_intel index 03aa7083f..4c8f65eee 100755 --- a/configuration/scripts/machines/env.phase3_intel +++ b/configuration/scripts/machines/env.phase3_intel @@ -1,8 +1,12 @@ -#!/bin/csh -f --login +#!/bin/csh -f -source /etc/profile.d/lmod.csh +#. $MODULESHOME/init/csh +source $MODULESHOME/init/csh +echo done with init.csh +module use -a $MODULESHOME/modulefiles module purge +module load lsf/10.1 module load ips/18.0.1.163 module load impi/18.0.1 module load NetCDF/4.5.0 @@ -15,10 +19,10 @@ setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /u/Robert.Grumbine/noscrub/CICE_RUNS setenv ICE_MACHINE_INPUTDATA /u/Robert.Grumbine/noscrub/ setenv ICE_MACHINE_BASELINE /u/Robert.Grumbine/noscrub/CICE_BASELINE -setenv ICE_MACHINE_SUBMIT " " +setenv ICE_MACHINE_SUBMIT "bsub < " setenv ICE_MACHINE_TPNODE 4 setenv ICE_MACHINE_QUEUE "default" setenv ICE_MACHINE_ACCT P0000000 setenv ICE_MACHINE_BLDTHRDS 1 -setenv ICE_MACHINE_QSTAT "qstat " +setenv ICE_MACHINE_QSTAT "bjobs " diff --git a/configuration/scripts/machines/env.theia_gnu b/configuration/scripts/machines/env.theia_gnu deleted file mode 100755 index 974be35e0..000000000 --- a/configuration/scripts/machines/env.theia_gnu +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/csh -f - -setenv ICE_MACHINE_ENVNAME theia -setenv ICE_MACHINE_COMPILER gnu -setenv ICE_MACHINE_MAKE make -setenv ICE_MACHINE_WKDIR /home/Robert.Grumbine/save/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA /home/Robert.Grumbine/save/ -setenv ICE_MACHINE_BASELINE /home/Robert.Grumbine/save/CICE_BASELINE -setenv ICE_MACHINE_SUBMIT " " -setenv ICE_MACHINE_TPNODE 4 -setenv ICE_MACHINE_ACCT P0000000 -setenv ICE_MACHINE_QUEUE "default" -setenv ICE_MACHINE_BLDTHRDS 1 -setenv ICE_MACHINE_QSTAT " " -setenv ICE_MACHINE_QUIETMODE true diff --git a/configuration/scripts/machines/env.theia_intel b/configuration/scripts/machines/env.theia_intel deleted file mode 100755 index 0438238d9..000000000 --- a/configuration/scripts/machines/env.theia_intel +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/csh -f - -source /etc/profile.d/modules.csh -#module list -module purge -#module load intel/18.1.163 Works, at least w. nc 4.4.0, -#14.0.2 w nc4.3.0 does not module load intel/18.1.163 -# ok w nc4.3.0: module load intel/16.0.1.150 -# ok w nc4.3.0: module load intel/15.3.187 -module load intel/17.0.5.239 -module load impi -module load esmf -module load hdf5 netcdf/4.3.0 -module load wgrib wgrib2 -#echo renewed modules: -#module list - -setenv ICE_MACHINE_ENVNAME theia -setenv ICE_MACHINE_COMPILER intel -setenv ICE_MACHINE_MAKE make -setenv ICE_MACHINE_WKDIR /home/Robert.Grumbine/save/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA /scratch3/NCEPDEV/marine/save/Robert.Grumbine/ -setenv ICE_MACHINE_BASELINE /home/Robert.Grumbine/save/CICE_BASELINE -setenv ICE_MACHINE_SUBMIT "sbatch" -setenv ICE_MACHINE_TPNODE 4 -setenv ICE_MACHINE_ACCT P0000000 -setenv ICE_MACHINE_QUEUE "batch" -setenv ICE_MACHINE_BLDTHRDS 1 -setenv ICE_MACHINE_QSTAT " " -#setenv ICE_MACHINE_QUIETMODE true diff --git a/configuration/scripts/machines/env.theia_pgi b/configuration/scripts/machines/env.theia_pgi deleted file mode 100755 index 2c4229c0e..000000000 --- a/configuration/scripts/machines/env.theia_pgi +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/csh -f - -source /etc/profile.d/modules.csh -module list -module purge -module load pgi -module load impi -module load esmf -module load hdf5 netcdf/4.4.0 -module load wgrib wgrib2 -echo renewed modules: -module list - - -setenv ICE_MACHINE_ENVNAME theia -setenv ICE_MACHINE_COMPILER pgi -setenv ICE_MACHINE_MAKE make -setenv ICE_MACHINE_WKDIR /home/Robert.Grumbine/save/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA /scratch3/NCEPDEV/marine/save/Robert.Grumbine/ -setenv ICE_MACHINE_BASELINE /home/Robert.Grumbine/save/CICE_BASELINE -setenv ICE_MACHINE_SUBMIT " " -setenv ICE_MACHINE_TPNODE 4 -setenv ICE_MACHINE_ACCT P0000000 -setenv ICE_MACHINE_QUEUE "default" -setenv ICE_MACHINE_BLDTHRDS 1 -setenv ICE_MACHINE_QSTAT " " -#setenv ICE_MACHINE_QUIETMODE true diff --git a/configuration/scripts/options/set_env.ionetcdf b/configuration/scripts/options/set_env.ionetcdf new file mode 100644 index 000000000..1824dde94 --- /dev/null +++ b/configuration/scripts/options/set_env.ionetcdf @@ -0,0 +1 @@ +setenv ICE_IOTYPE netcdf diff --git a/configuration/scripts/options/set_env.iopio1 b/configuration/scripts/options/set_env.iopio1 new file mode 100644 index 000000000..8357b4aac --- /dev/null +++ b/configuration/scripts/options/set_env.iopio1 @@ -0,0 +1 @@ +setenv ICE_IOTYPE pio1 diff --git a/configuration/scripts/options/set_env.iopio1p b/configuration/scripts/options/set_env.iopio1p new file mode 100644 index 000000000..8357b4aac --- /dev/null +++ b/configuration/scripts/options/set_env.iopio1p @@ -0,0 +1 @@ +setenv ICE_IOTYPE pio1 diff --git a/configuration/scripts/options/set_env.iopio2 b/configuration/scripts/options/set_env.iopio2 new file mode 100644 index 000000000..415005ac4 --- /dev/null +++ b/configuration/scripts/options/set_env.iopio2 @@ -0,0 +1 @@ +setenv ICE_IOTYPE pio2 diff --git a/configuration/scripts/options/set_env.iopio2p b/configuration/scripts/options/set_env.iopio2p new file mode 100644 index 000000000..415005ac4 --- /dev/null +++ b/configuration/scripts/options/set_env.iopio2p @@ -0,0 +1 @@ +setenv ICE_IOTYPE pio2 diff --git a/configuration/scripts/options/set_nml.alt03 b/configuration/scripts/options/set_nml.alt03 index 6336388b1..43681ab9d 100644 --- a/configuration/scripts/options/set_nml.alt03 +++ b/configuration/scripts/options/set_nml.alt03 @@ -1,15 +1,20 @@ +ncat = 6 kcatbound = 2 ice_ic = 'default' restart = .false. distribution_type = 'sectcart' +conserv_check = .true. tr_iage = .false. tr_FY = .false. tr_lvl = .false. tr_pond_cesm = .false. tr_pond_topo = .true. tr_pond_lvl = .false. -tr_aero = .false. +tr_aero = .true. +calc_Tsfc = .false. kdyn = 2 +ktherm = 1 +tfrz_option = 'linear_salt' revised_evp = .false. Ktens = 0. e_ratio = 2. diff --git a/configuration/scripts/options/set_nml.alt04 b/configuration/scripts/options/set_nml.alt04 index 67045b16c..786decae6 100644 --- a/configuration/scripts/options/set_nml.alt04 +++ b/configuration/scripts/options/set_nml.alt04 @@ -10,11 +10,12 @@ tr_lvl = .true. tr_pond_cesm = .false. tr_pond_topo = .false. tr_pond_lvl = .true. -tr_aero = .false. +tr_aero = .true. kitd = 0 ktherm = 1 conduct = 'MU71' kdyn = 1 +kevp_kernel = 102 fbot_xfer_type = 'Cdn_ocn' shortwave = 'dEdd' formdrag = .true. diff --git a/configuration/scripts/options/set_nml.box2001 b/configuration/scripts/options/set_nml.box2001 index 0b4b9645a..79382d84e 100755 --- a/configuration/scripts/options/set_nml.box2001 +++ b/configuration/scripts/options/set_nml.box2001 @@ -3,7 +3,6 @@ npt = 240 ice_ic = 'default' restart = .false. restart_ext = .true. -restart_format = 'bin' histfreq = 'd','x','x','x','x' grid_type = 'rectangular' dxrect = 16.e5 diff --git a/configuration/scripts/options/set_nml.boxdyn b/configuration/scripts/options/set_nml.boxdyn index 118d93d79..1b74720c7 100644 --- a/configuration/scripts/options/set_nml.boxdyn +++ b/configuration/scripts/options/set_nml.boxdyn @@ -3,7 +3,6 @@ ice_ic = 'default' restart = .false. days_per_year = 360 npt = 72 -restart_format = 'bin' dumpfreq = 'd' dumpfreq_n = 2 histfreq = 'd','x','x','x','x' diff --git a/configuration/scripts/options/set_nml.cdf64 b/configuration/scripts/options/set_nml.cdf64 new file mode 100644 index 000000000..0fd700c64 --- /dev/null +++ b/configuration/scripts/options/set_nml.cdf64 @@ -0,0 +1 @@ +lcdf64 = .true. diff --git a/configuration/scripts/options/set_nml.histall b/configuration/scripts/options/set_nml.histall new file mode 100644 index 000000000..5fad1a7e2 --- /dev/null +++ b/configuration/scripts/options/set_nml.histall @@ -0,0 +1,224 @@ + histfreq = 'm','d','1','x','x' + histfreq_n = 1,1,6,1,1 + write_ic = .true. + f_tmask = .true. + f_blkmask = .true. + f_tarea = .true. + f_uarea = .true. + f_dxt = .true. + f_dyt = .true. + f_dxu = .true. + f_dyu = .true. + f_HTN = .true. + f_HTE = .true. + f_ANGLE = .true. + f_ANGLET = .true. + f_NCAT = .true. + f_VGRDi = .true. + f_VGRDs = .true. + f_VGRDb = .true. + f_VGRDa = .true. + f_bounds = .true. + f_CMIP = 'm' + f_aice = 'md1' + f_hi = '1dm' + f_hs = 'd1m' + f_Tsfc = 'md' + f_sice = 'md' + f_uvel = 'md' + f_vvel = 'dm' + f_uatm = 'dm' + f_vatm = 'dm' + f_fswdn = 'dm' + f_flwdn = 'md' + f_snowfrac = 'md' + f_snow = 'md' + f_snow_ai = 'md' + f_rain = 'md' + f_rain_ai = 'md' + f_sst = 'md' + f_sss = 'md' + f_uocn = 'md' + f_vocn = 'md' + f_frzmlt = 'md' + f_fswfac = 'md' + f_fswint_ai = 'md' + f_fswabs = 'md' + f_fswabs_ai = 'md' + f_albsni = 'md' + f_alvdr = 'md' + f_alidr = 'md' + f_alvdf = 'md' + f_alidf = 'md' + f_alvdr_ai = 'md' + f_alidr_ai = 'md' + f_alvdf_ai = 'md' + f_alidf_ai = 'md' + f_albice = 'md' + f_albsno = 'md' + f_albpnd = 'md' + f_coszen = 'md' + f_flat = 'md' + f_flat_ai = 'md' + f_fsens = 'md' + f_fsens_ai = 'md' + f_fswup = 'md' + f_flwup = 'md' + f_flwup_ai = 'md' + f_evap = 'md' + f_evap_ai = 'md' + f_Tair = 'md' + f_Tref = 'md' + f_Qref = 'md' + f_congel = 'md' + f_frazil = 'md' + f_snoice = 'md' + f_dsnow = 'md' + f_melts = 'md' + f_meltt = 'md' + f_meltb = 'md' + f_meltl = 'md' + f_fresh = 'md' + f_fresh_ai = 'md' + f_fsalt = 'md' + f_fsalt_ai = 'md' + f_fbot = 'md' + f_fhocn = 'md' + f_fhocn_ai = 'md' + f_fswthru = 'md' + f_fswthru_ai = 'md' + f_fsurf_ai = 'md' + f_fcondtop_ai = 'md' + f_fmeltt_ai = 'md' + f_strairx = 'md' + f_strairy = 'md' + f_strtltx = 'md' + f_strtlty = 'md' + f_strcorx = 'md' + f_strcory = 'md' + f_strocnx = 'md' + f_strocny = 'md' + f_strintx = 'md' + f_strinty = 'md' + f_taubx = 'md' + f_tauby = 'md' + f_strength = 'md' + f_divu = 'md' + f_shear = 'md' + f_sig1 = 'md' + f_sig2 = 'md' + f_sigP = 'md' + f_dvidtt = 'md' + f_dvidtd = 'md' + f_daidtt = 'md' + f_daidtd = 'md' + f_dagedtt = 'md' + f_dagedtd = 'md' + f_mlt_onset = 'md' + f_frz_onset = 'md' + f_hisnap = 'md' + f_aisnap = 'md' + f_trsig = 'md' + f_icepresent = 'md' + f_iage = 'md' + f_FY = 'md' + f_aicen = 'md' + f_vicen = 'md' + f_vsnon = 'md' + f_snowfracn = 'md' + f_keffn_top = 'md' + f_Tinz = 'md' + f_Sinz = 'md' + f_Tsnz = 'md' + f_fsurfn_ai = 'md' + f_fcondtopn_ai = 'md' + f_fmelttn_ai = 'md' + f_flatn_ai = 'md' + f_fsensn_ai = 'md' + f_alvl = 'md' + f_vlvl = 'md' + f_ardg = 'md' + f_vrdg = 'md' + f_dardg1dt = 'md' + f_dardg2dt = 'md' + f_dvirdgdt = 'md' + f_opening = 'md' + f_ardgn = 'md' + f_vrdgn = 'md' + f_dardg1ndt = 'md' + f_dardg2ndt = 'md' + f_dvirdgndt = 'md' + f_krdgn = 'md' + f_aparticn = 'md' + f_aredistn = 'md' + f_vredistn = 'md' + f_araftn = 'md' + f_vraftn = 'md' + f_apondn = 'md' + f_apeffn = 'md' + f_hpondn = 'md' + f_apond = 'md' + f_hpond = 'md' + f_ipond = 'md' + f_apeff = 'md' + f_apond_ai = 'md' + f_hpond_ai = 'md' + f_ipond_ai = 'md' + f_apeff_ai = 'md' + f_fiso_atm = 'md' + f_fiso_ocn = 'md' + f_iso = 'md' + f_faero_atm = 'md' + f_faero_ocn = 'md' + f_aero = 'md' + f_fbio = 'md' + f_fbio_ai = 'md' + f_zaero = 'md' + f_bgc_S = 'md' + f_bgc_N = 'md' + f_bgc_C = 'md' + f_bgc_DOC = 'md' + f_bgc_DIC = 'md' + f_bgc_chl = 'md' + f_bgc_Nit = 'md' + f_bgc_Am = 'md' + f_bgc_Sil = 'md' + f_bgc_DMSPp = 'md' + f_bgc_DMSPd = 'md' + f_bgc_DMS = 'md' + f_bgc_DON = 'md' + f_bgc_Fe = 'md' + f_bgc_hum = 'md' + f_bgc_PON = 'md' + f_bgc_ml = 'md' + f_upNO = 'md' + f_upNH = 'md' + f_bTin = 'md' + f_bphi = 'md' + f_iDi = 'md' + f_iki = 'md' + f_fbri = 'md' + f_hbri = 'md' + f_zfswin = 'md' + f_bionet = 'md' + f_biosnow = 'md' + f_grownet = 'md' + f_PPnet = 'md' + f_algalpeak = 'md' + f_zbgc_frac = 'md' + f_drag = 'md' + f_Cdn_atm = 'md' + f_Cdn_ocn = 'md' + f_fsdrad = 'md' + f_fsdperim = 'md' + f_afsd = 'md' + f_afsdn = 'md' + f_dafsd_newi = 'md' + f_dafsd_latg = 'md' + f_dafsd_latm = 'md' + f_dafsd_wave = 'md' + f_dafsd_weld = 'md' + f_wave_sig_ht = 'md' + f_aice_ww = 'md' + f_diam_ww = 'md' + f_hice_ww = 'md' diff --git a/configuration/scripts/options/set_nml.iopio1 b/configuration/scripts/options/set_nml.iopio1 new file mode 100644 index 000000000..655f2c96b --- /dev/null +++ b/configuration/scripts/options/set_nml.iopio1 @@ -0,0 +1,2 @@ +restart_format = 'pio_netcdf' +history_format = 'pio_netcdf' diff --git a/configuration/scripts/options/set_nml.iopio1p b/configuration/scripts/options/set_nml.iopio1p new file mode 100644 index 000000000..83c422403 --- /dev/null +++ b/configuration/scripts/options/set_nml.iopio1p @@ -0,0 +1,2 @@ +restart_format = 'pio_pnetcdf' +history_format = 'pio_pnetcdf' diff --git a/configuration/scripts/options/set_nml.iopio2 b/configuration/scripts/options/set_nml.iopio2 new file mode 100644 index 000000000..655f2c96b --- /dev/null +++ b/configuration/scripts/options/set_nml.iopio2 @@ -0,0 +1,2 @@ +restart_format = 'pio_netcdf' +history_format = 'pio_netcdf' diff --git a/configuration/scripts/options/set_nml.iopio2p b/configuration/scripts/options/set_nml.iopio2p new file mode 100644 index 000000000..e4cce54af --- /dev/null +++ b/configuration/scripts/options/set_nml.iopio2p @@ -0,0 +1,2 @@ +restart_format = 'pio_pnetcdf' +history_format = 'pio_netcdf' diff --git a/configuration/scripts/options/set_nml.precision8 b/configuration/scripts/options/set_nml.precision8 new file mode 100644 index 000000000..5243ef8df --- /dev/null +++ b/configuration/scripts/options/set_nml.precision8 @@ -0,0 +1 @@ +history_precision = 8 diff --git a/configuration/scripts/options/set_nml.tx1 b/configuration/scripts/options/set_nml.tx1 index 120f7249f..dfdf6f19b 100644 --- a/configuration/scripts/options/set_nml.tx1 +++ b/configuration/scripts/options/set_nml.tx1 @@ -5,8 +5,8 @@ grid_format = 'bin' grid_type = 'tripole' grid_file = 'ICE_MACHINE_INPUTDATA/CICE_data/grid/tx1/grid_tx1.bin' kmt_file = 'ICE_MACHINE_INPUTDATA/CICE_data/grid/tx1/kmt_tx1.bin' -fyear_init = 1997 -atm_data_format = 'bin' -atm_data_type = 'clim' -atm_data_dir = 'none' - +atm_data_dir = 'ICE_MACHINE_INPUTDATA/CICE_data/forcing/tx1/JRA55' +atm_data_format = 'nc' +atm_data_type = 'JRA55_tx1' +year_init = 2005 +fyear_init = 2005 diff --git a/configuration/scripts/parse_namelist.sh b/configuration/scripts/parse_namelist.sh index ffdc9bacf..c94420f6e 100755 --- a/configuration/scripts/parse_namelist.sh +++ b/configuration/scripts/parse_namelist.sh @@ -26,7 +26,7 @@ do #sed -i 's|\(^\s*'"$vname"'\s*\=\s*\)\(.*$\)|\1'"$value"'|g' $filename cp ${filename} ${filename}.check - sed -i -e 's|\(^[[:space:]]*'"$vname"'[[:space:]]*=[[:space:]]*\)\(.*$\)|\1'"$foundstring"'|g' ${filename}.check + sed -i.sedbak -e 's|\(^[[:space:]]*'"$vname"'[[:space:]]*=[[:space:]]*\)\(.*$\)|\1'"$foundstring"'|g' ${filename}.check grep -q ${foundstring} ${filename}.check if [ $? -eq 0 ]; then sed -i.sedbak -e 's|\(^[[:space:]]*'"$vname"'[[:space:]]*=[[:space:]]*\)\(.*$\)|\1'"$value"'|g' ${filename} @@ -37,7 +37,7 @@ do echo "$0 ERROR: parsing error for ${vname}" exit -99 fi - rm ${filename}.check + rm ${filename}.check ${filename}.check.sedbak fi diff --git a/configuration/scripts/tests/base_suite.ts b/configuration/scripts/tests/base_suite.ts index fad8b22f3..e96b07622 100755 --- a/configuration/scripts/tests/base_suite.ts +++ b/configuration/scripts/tests/base_suite.ts @@ -8,10 +8,9 @@ smoke gx3 8x2 diag24,run1year,medium decomp gx3 4x2x25x29x5 smoke gx3 4x2 diag1,run5day smoke_gx3_8x2_diag1_run5day smoke gx3 4x1 diag1,run5day,thread smoke_gx3_8x2_diag1_run5day -restart gx1 40x4 droundrobin,medium -restart tx1 40x4 dsectrobin,medium +restart gx1 40x4 droundrobin,medium +restart tx1 40x4 dsectrobin,medium restart gx3 4x4 none -restart gx3 4x4 iobinary restart gx3 6x2 alt01 restart gx3 8x2 alt02 restart gx3 4x2 alt03 @@ -22,24 +21,24 @@ restart gx3 8x2 alt02,debug,short restart gx3 4x2 alt03,debug,short smoke gx3 4x4 alt04,debug,short smoke gx3 4x4 alt05,debug,short -restart gbox128 4x2 short -restart gbox128 4x2 boxdyn,short -restart gbox128 4x2 boxdyn,short,debug -restart gbox128 2x2 boxadv,short -smoke gbox128 2x2 boxadv,short,debug -restart gbox128 4x4 boxrestore,short -smoke gbox128 4x4 boxrestore,short,debug -restart gbox80 1x1 box2001 -smoke gbox80 1x1 boxslotcyl +restart gbox128 4x2 short +restart gbox128 4x2 boxdyn,short +restart gbox128 4x2 boxdyn,short,debug +restart gbox128 2x2 boxadv,short +smoke gbox128 2x2 boxadv,short,debug +restart gbox128 4x4 boxrestore,short +smoke gbox128 4x4 boxrestore,short,debug +restart gbox80 1x1 box2001 +smoke gbox80 1x1 boxslotcyl smoke gx3 8x2 bgcz smoke gx3 8x2 bgcz,debug smoke gx3 8x1 bgcskl,debug #smoke gx3 4x1 bgcz,thread smoke_gx3_8x2_bgcz restart gx1 4x2 bgcsklclim,medium restart gx1 8x1 bgczclim,medium -smoke gx1 24x1 jra55_gx1_2008,medium,run90day +smoke gx1 24x1 jra55_gx1_2008,medium,run90day smoke gx3 8x1 jra55_gx3_2008,medium,run90day -restart gx1 24x1 jra55_gx1,short +restart gx1 24x1 jra55_gx1,short restart gx3 8x1 jra55_gx3,short smoke gx3 4x2 fsd1,diag24,run5day,debug smoke gx3 8x2 fsd12,diag24,run5day,short @@ -47,4 +46,7 @@ restart gx3 4x2 fsd12,debug,short smoke gx3 8x2 fsd12ww3,diag24,run1day,medium smoke gx3 4x1 isotope,debug restart gx3 8x2 isotope - +restart gx3 4x4 iobinary +restart gx3 4x4 histall,precision8,cdf64 +smoke gx3 30x1 bgcz,histall +smoke gx3 14x2 fsd12,histall diff --git a/configuration/scripts/tests/cice_test_codecov.csh b/configuration/scripts/tests/cice_test_codecov.csh new file mode 100755 index 000000000..0b2d970ec --- /dev/null +++ b/configuration/scripts/tests/cice_test_codecov.csh @@ -0,0 +1,75 @@ +#!/bin/csh + +# This was a script on gordon +# This script should only be run on hardware with the gnu compiler with a +# modified Macros file to turn on the codecov flags +# This should be run interactively because git push will require login information + +#PBS -N cice_test +#PBS -q standard +#PBS -A NRLSS03755018 +#PBS -l application=Regional-Arctic-System-Model +#PBS -l select=1:ncpus=32:mpiprocs=32 +#PBS -l walltime=24:00:00 +#PBS -j oe +#PBS -M anthony.p.craig@gmail.com +#PBS -m be + +#set verbose +module load costinit git + +set scrdir = "~" +set testdir = "~/cice_testing" +set date0 = `date -u "+%y%m%d"` +set date = ${date0}cc + +mkdir -p ${testdir} + +cd ${testdir} + +# Check out current cice master +echo " " +echo "*** checkout current cice master ***" +git clone https://github.com/cice-consortium/cice cice.master.${date} --recursive +cd cice.master.${date} +set hash = `git rev-parse --short HEAD ` +cd ../ + +# Check out test_cice_icepack, remove all code and copy from cice master +# Need to be careful about dot files, particularly .git* files +# This copies in all files via standard file expansion (except dot files at root) +# This also copies in all dot file at the root that do not start with .g (ie. .git*) +echo " " +echo "*** checkout current test_cice_master ***" +git clone https://github.com/apcraig/test_cice_icepack test_cice_icepack.${date} +cd test_cice_icepack.${date} +echo " " +echo "*** remove current files and copy in cice master files ***" +set verbose +git rm -r * >& /dev/null +cp -p -r ../cice.master.${date}/* . +cp -p ../cice.master.${date}/.[a-f,h-z]* . + +# Clean up icepack .git stuff and commit +rm -r -f icepack/.git* +git add . +unset verbose +echo " " +echo "*** git status of changes ***" +git status +echo " " +echo "*** commit changes ***" +git commit -m "update test_cice_icepack master to ${hash}" + +# Push test_cice_icepack +echo " " +echo "*** push changes to test_cice_icepack ***" +git push origin master + +# Run test suite +echo " " +echo "*** run test suite ***" +./cice.setup --suite first_suite,base_suite,travis_suite,decomp_suite,reprosum_suite,quick_suite -m gordon -e gnu --testid T${date} --codecov --queue standard + +# The test suite will wait until all jobs are complete then run report_codecov.csh +# If that fails, you can run report_codecov.csh manually after all jobs are done diff --git a/configuration/scripts/tests/io_suite.ts b/configuration/scripts/tests/io_suite.ts new file mode 100755 index 000000000..c1edec292 --- /dev/null +++ b/configuration/scripts/tests/io_suite.ts @@ -0,0 +1,67 @@ +# Test Grid PEs Sets BFB-compare +restart gx3 8x4 debug,histall,iobinary,precision8 +restart gx3 12x2 alt01,histall,iobinary +restart gx3 16x2 alt02,histall,iobinary,precision8 +restart gx3 4x2 alt03,histall,iobinary +restart gx3 8x4 alt04,histall,iobinary,precision8 +restart gx3 4x4 alt05,histall,iobinary +restart gx3 32x1 bgcz,histall,iobinary,precision8 +restart gx3 16x2 bgcskl,histall,iobinary +restart gx3 14x2 isotope,histall,iobinary,precision8 +restart gx3 16x2 fsd12,histall,iobinary + +restart gx3 32x1 debug,histall,ionetcdf +restart gx3 15x2 alt01,histall,ionetcdf,precision8,cdf64 +restart gx3 15x2 alt02,histall,ionetcdf +restart gx3 24x1 alt03,histall,ionetcdf,precision8 +restart gx3 8x4 alt04,histall,ionetcdf,cdf64 +restart gx3 8x4 alt05,histall,ionetcdf,precision8,cdf64 +restart gx3 30x1 bgcz,histall,ionetcdf +restart gx3 15x2 bgcskl,histall,ionetcdf,precision8 +restart gx3 31x1 isotope,histall,ionetcdf,cdf64 +restart gx3 14x2 fsd12,histall,ionetcdf,precision8 + +restart gx3 16x2 debug,histall,iopio1,precision8,cdf64 +restart gx3 14x2 alt01,histall,iopio1,cdf64 +restart gx3 32x1 alt02,histall,iopio1,precision8 +restart gx3 24x1 alt03,histall,iopio1 +restart gx3 8x4 alt04,histall,iopio1,precision8,cdf64 +restart gx3 8x4 alt05,histall,iopio1,cdf64 +restart gx3 16x2 bgcz,histall,iopio1,precision8 +restart gx3 30x1 bgcskl,histall,iopio1 +restart gx3 8x4 isotope,histall,iopio1,precision8,cdf64 +restart gx3 12x2 fsd12,histall,iopio1,cdf64 + +restart gx3 16x2 debug,histall,iopio2 +restart gx3 14x2 alt01,histall,iopio2,precision8,cdf64 +restart gx3 32x1 alt02,histall,iopio2,cdf64 +restart gx3 24x1 alt03,histall,iopio2,precision8 +restart gx3 8x4 alt04,histall,iopio2 +restart gx3 8x4 alt05,histall,iopio2,precision8,cdf64 +restart gx3 16x2 bgcz,histall,iopio2,cdf64 +restart gx3 30x1 bgcskl,histall,iopio2,precision8 +restart gx3 8x4 isotope,histall,iopio2 +restart gx3 12x2 fsd12,histall,iopio2,precision8,cdf64 + +restart gx3 16x2 debug,histall,iopio1p,precision8 +restart gx3 14x2 alt01,histall,iopio1p +restart gx3 32x1 alt02,histall,iopio1p,precision8,cdf64 +restart gx3 24x1 alt03,histall,iopio1p,cdf64 +restart gx3 8x4 alt04,histall,iopio1p,precision8 +restart gx3 8x4 alt05,histall,iopio1p +restart gx3 16x2 bgcz,histall,iopio1p,precision8,cdf64 +restart gx3 30x1 bgcskl,histall,iopio1p,cdf64 +restart gx3 8x4 isotope,histall,iopio1p,precision8 +restart gx3 12x2 fsd12,histall,iopio1p + +restart gx3 16x2 debug,histall,iopio2p,cdf64 +restart gx3 14x2 alt01,histall,iopio2p,precision8 +restart gx3 32x1 alt02,histall,iopio2p +restart gx3 24x1 alt03,histall,iopio2p,precision8,cdf64 +restart gx3 8x4 alt04,histall,iopio2p,cdf64 +restart gx3 8x4 alt05,histall,iopio2p,precision8 +restart gx3 16x2 bgcz,histall,iopio2p +restart gx3 30x1 bgcskl,histall,iopio2p,precision8,cdf64 +restart gx3 8x4 isotope,histall,iopio2p,cdf64 +restart gx3 12x2 fsd12,histall,iopio2p,precision8 + diff --git a/doc/source/cice_index.rst b/doc/source/cice_index.rst index 3f0aa482a..b78ac356d 100644 --- a/doc/source/cice_index.rst +++ b/doc/source/cice_index.rst @@ -22,9 +22,11 @@ either Celsius or Kelvin units). "a3Dz", "history field accumulations, 3D vertical", "" "a3Db", "history field accumulations, 3D bio grid", "" "a3Dc", "history field accumulations, 3D categories", "" + "a3Df", "history field accumulations, 3D fsd", "" "a4Di", "history field accumulations, 4D categories, vertical ice", "" "a4Db", "history field accumulations, 4D categories, vertical bio grid", "" "a4Ds", "history field accumulations, 4D categories, vertical snow", "" + "a4Df", "history field accumulations, 4D categories, fsd", "" "a_min", "minimum area concentration for computing velocity", "0.001" "a_rapid_mode", ":math:`{\bullet}` brine channel diameter", "" "advection", ":math:`\bullet` type of advection algorithm used (‘remap’ or ‘upwind’)", "remap" @@ -104,6 +106,7 @@ either Celsius or Kelvin units). "coldsnow", "value for constant albedo parameterization", "0.81" "conduct", ":math:`\bullet` conductivity parameterization", "" "congel", "basal ice growth", "m" + "conserv_check", "if true, check conservation", "" "cosw", "cosine of the turning angle in water", "1." "coszen", "cosine of the zenith angle", "" "Cp", "proportionality constant for potential energy", "kg/m\ :math:`^2`/s\ :math:`^2`" @@ -274,6 +277,8 @@ either Celsius or Kelvin units). "histfreq_n", ":math:`\bullet` integer output frequency in histfreq units", "" "history_dir", ":math:`\bullet` path to history output files", "" "history_file", ":math:`\bullet` history output file prefix", "" + "history_format", ":math:`\bullet` history file format", "" + "history_precision", ":math:`\bullet` history output precision: 4 or 8 byte", "4" "hm", "land/boundary mask, thickness (T-cell)", "" "hmix", "ocean mixed layer depth", "20. m" "hour", "hour of the year", "" @@ -338,7 +343,6 @@ either Celsius or Kelvin units). "ktherm", ":math:`\bullet` thermodynamic formulation (0 = zero-layer, 1 = :cite:`Bitz99`, 2 = mushy)", "" "**L**", "", "" "l_brine", "flag for brine pocket effects", "" - "l_conservation_check", "if true, check conservation when ridging", "" "l_fixed_area", "flag for prescribing remapping fluxes", "" "l_mpond_fresh", ":math:`\bullet` if true, retain (topo) pond water until ponds drain", "" "latpnt", ":math:`\bullet` desired latitude of diagnostic points", "degrees N" diff --git a/doc/source/developer_guide/dg_about.rst b/doc/source/developer_guide/dg_about.rst old mode 100755 new mode 100644 diff --git a/doc/source/developer_guide/dg_driver.rst b/doc/source/developer_guide/dg_driver.rst old mode 100755 new mode 100644 diff --git a/doc/source/developer_guide/dg_dynamics.rst b/doc/source/developer_guide/dg_dynamics.rst old mode 100755 new mode 100644 diff --git a/doc/source/developer_guide/dg_icepack.rst b/doc/source/developer_guide/dg_icepack.rst old mode 100755 new mode 100644 diff --git a/doc/source/developer_guide/dg_scripts.rst b/doc/source/developer_guide/dg_scripts.rst old mode 100755 new mode 100644 diff --git a/doc/source/developer_guide/index.rst b/doc/source/developer_guide/index.rst old mode 100755 new mode 100644 diff --git a/doc/source/intro/about.rst b/doc/source/intro/about.rst old mode 100755 new mode 100644 diff --git a/doc/source/intro/acknowledgements.rst b/doc/source/intro/acknowledgements.rst old mode 100755 new mode 100644 diff --git a/doc/source/intro/copyright.rst b/doc/source/intro/copyright.rst old mode 100755 new mode 100644 diff --git a/doc/source/intro/index.rst b/doc/source/intro/index.rst old mode 100755 new mode 100644 diff --git a/doc/source/intro/quickstart.rst b/doc/source/intro/quickstart.rst old mode 100755 new mode 100644 diff --git a/doc/source/science_guide/figures/EAP.png b/doc/source/science_guide/figures/EAP.png old mode 100755 new mode 100644 diff --git a/doc/source/science_guide/figures/albedo.png b/doc/source/science_guide/figures/albedo.png old mode 100755 new mode 100644 diff --git a/doc/source/science_guide/figures/deparr.png b/doc/source/science_guide/figures/deparr.png old mode 100755 new mode 100644 diff --git a/doc/source/science_guide/figures/gplot.png b/doc/source/science_guide/figures/gplot.png old mode 100755 new mode 100644 diff --git a/doc/source/science_guide/figures/triangles.png b/doc/source/science_guide/figures/triangles.png old mode 100755 new mode 100644 diff --git a/doc/source/science_guide/index.rst b/doc/source/science_guide/index.rst old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/extra/distrb_cart_X1_20x24_16.png b/doc/source/user_guide/figures/extra/distrb_cart_X1_20x24_16.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/extra/distrb_cart_X2_20x24_16.png b/doc/source/user_guide/figures/extra/distrb_cart_X2_20x24_16.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/extra/distrb_cart_sqr_20x24_16.png b/doc/source/user_guide/figures/extra/distrb_cart_sqr_20x24_16.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/extra/distrb_rake_block_20x24_16.png b/doc/source/user_guide/figures/extra/distrb_rake_block_20x24_16.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/extra/distrb_rake_lat_20x24_16.png b/doc/source/user_guide/figures/extra/distrb_rake_lat_20x24_16.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/extra/distrb_sfc_lat_20x24_16.png b/doc/source/user_guide/figures/extra/distrb_sfc_lat_20x24_16.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/extra/topo2.png b/doc/source/user_guide/figures/extra/topo2.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/extra/topo3.png b/doc/source/user_guide/figures/extra/topo3.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/grid.png b/doc/source/user_guide/figures/grid.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/histograms.png b/doc/source/user_guide/figures/histograms.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/figures/scorecard.png b/doc/source/user_guide/figures/scorecard.png old mode 100755 new mode 100644 diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst old mode 100755 new mode 100644 index b3088963d..fe93cca4c --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -41,6 +41,7 @@ to support the CICE model. " ", "pio", "parallel netCDF" " ", "none", "netCDF library is not available" "ICE_CLEANBUILD", "true, false", "automatically clean before building", "true" + "ICE_CPPDEFS", "user defined preprocessor macros for build", "null" "ICE_QUIETMODE", "true, false", "reduce build output to the screen", "false" "ICE_GRID", "string (see below)", "grid", "set by cice.setup" " ", "gx3", "3-deg displace-pole (Greenland) global grid", " " @@ -68,7 +69,7 @@ to support the CICE model. "ICE_QUEUE", "string", "batch queue name", "set by cice.setup or by default" "ICE_THREADED", "true, false", "force threading in compile, will always compile threaded if ICE_NTHRDS :math:`> 1`", "false" "ICE_BLDDEBUG", "true, false", "turn on compile debug flags", "false" - + "ICE_CODECOV", "true,false", "turn on code coverage flags", "false" .. _tabnamelist: @@ -99,8 +100,9 @@ Table of namelist options "","", "path/file", "restart file name", "" "","``restart``", "true/false", "initialize using restart file", "``.true.``" "","``use_restart_time``", "true/false", "set initial date using restart file", "``.true.``" - "","``restart_format``", "nc", "read/write  restart files (use with PIO)", "" - "","", "bin", "read/write binary restart files", "" + "","``restart_format``", "string", "restart file format", "default" + "","", "default", "read/write restart files in default format", "" + "","", "pio_pnetcdf", "read/write restart files with pnetcdf in pio", "" "","``lcdf64``", "true/false", "if true, use 64-bit  format", "" "","``numin``", "integer", "minimum internal IO unit number", "11" "","``numax``", "integer", "maximum internal IO unit number", "99" @@ -122,6 +124,7 @@ Table of namelist options "\*","``diag_type``", "``stdout``", "write diagnostic output to stdout", "" "","", "``file``", "write diagnostic output to file", "" "","``diag_file``", "filename", "diagnostic output file (script may reset)", "" + "","``conserv_check``", "true/false", "check conservation", "``.false.``" "","``print_global``", "true/false", "print diagnostic data, global sums", "``.false.``" "","``print_points``", "true/false", "print diagnostic data for two grid points", "``.false.``" "","``latpnt``", "real", "latitude of (2) diagnostic points", "" @@ -140,6 +143,10 @@ Table of namelist options "","", "false", "write snapshots of data", "" "","``history_dir``", "path/", "path to history output directory", "" "","``history_file``", "filename prefix", "output file for history", "‘iceh’" + "","``history_precision``", "integer", "history file precision: 4 or 8 byte", "4" + "","``history_format``", "string", "history file format", "default" + "","", "default", "read/write restart files in default format", "" + "","", "pio_pnetcdf", "read/write restart files with pnetcdf in pio", "" "","``write_ic``", "true/false", "write initial condition", "" "","``incond_dir``", "path/", "path to initial condition directory", "" "","``incond_file``", "filename prefix", "output file for initial condition", "‘iceh’" @@ -356,6 +363,7 @@ Table of namelist options "","", "``LYq``", "COREII Large-Yeager (AOMIP) forcing data", ":cite:`Large09`" "","", "``JRA55_gx1``", "JRA55 forcing data for gx1 grid :cite:`Tsujino18`", "" "","", "``JRA55_gx3``", "JRA55 forcing data for gx3 grid :cite:`Tsujino18`", "" + "","", "``JRA55_tx1``", "JRA55 forcing data for tx1 grid :cite:`Tsujino18`", "" "","", "``monthly``", "monthly forcing data", "" "","", "``ncar``", "NCAR bulk forcing data", "" "","", "``box2001``", "forcing data for :cite:`Hunke01` box problem", "" diff --git a/doc/source/user_guide/ug_implementation.rst b/doc/source/user_guide/ug_implementation.rst index bba0b5f46..b7d9c0f47 100644 --- a/doc/source/user_guide/ug_implementation.rst +++ b/doc/source/user_guide/ug_implementation.rst @@ -701,6 +701,15 @@ Model output History files ************* +CICE provides history data in binary unformatted or netCDF formats via +separate implementations of binary, netcdf, and pio source code under the +directory **infrastructure/io**. ``ICE_IOTYPE`` defined in cice.settings +specifies the IO type and defines which source code directory is compiled. +At the present time, binary, netcdf, and PIO are exclusive formats +for history and restart files, and history and restart file must use the same +io package. The namelist variable ``history_format`` further refines the +format approach or style for some io packages. + Model output data is averaged over the period(s) given by ``histfreq`` and ``histfreq_n``, and written to binary or netCDF files prepended by ``history_file`` in **ice_in**. These settings for history files are set in the @@ -711,7 +720,7 @@ depending on the output file format chosen in **cice.settings** (set ``ICE_IOTYPE``). The netCDF history files are CF-compliant; header information for data contained in the netCDF files is displayed with the command ``ncdump -h filename.nc``. Parallel netCDF output is available using the PIO library; the -attribute ``io_flavor`` distinguishes output files written with PIO from +output file attribute ``io_flavor`` distinguishes output files written with PIO from those written with standard netCDF. With binary files, a separate header file is written with equivalent information. Standard fields are output according to settings in the **icefields\_nml** section of **ice\_in** @@ -807,6 +816,9 @@ Additionally, a new history output variable, ``f_CMIP``, has been added. When `` is added to the **icefields\_nml** section of **ice\_in** then all SIMIP variables will be turned on for output at the frequency specified by ``f_CMIP``. +It may also be helpful for debugging to increase the precision of the history file +output from 4 bytes to 8 bytes. This is changed through the ``history_precision`` +namelist flag. **************** Diagnostic files @@ -890,11 +902,14 @@ The timers use *MPI\_WTIME* for parallel runs and the F90 intrinsic Restart files ************* -CICE provides restart data in binary unformatted or netCDF formats, via -the ``ICE_IOTYPE`` flag in **cice.settings** and namelist variable -``restart_format``. Restart and history files must use the same format. As -with the history output, there is also an option for writing parallel netCDF -restart files using PIO. +CICE provides restart data in binary unformatted or netCDF formats via +separate implementations of binary, netcdf, and pio source code under the +directory **infrastructure/io**. ``ICE_IOTYPE`` defined in cice.settings +specifies the IO type and defines which source code directory is compiled. +At the present time, binary, netcdf, and PIO are exclusive formats +for history and restart files, and history and restart file must use the same +io package. The namelist variable ``restart_format`` further refines the +format approach or style for some io packages. The restart files created by CICE contain all of the variables needed for a full, exact restart. The filename begins with the character string diff --git a/doc/source/user_guide/ug_running.rst b/doc/source/user_guide/ug_running.rst index 7d7907998..b4fa7bcd7 100644 --- a/doc/source/user_guide/ug_running.rst +++ b/doc/source/user_guide/ug_running.rst @@ -142,11 +142,15 @@ You can also submit the **cice.run** script on the command line. Some hints: -- To change the block sizes required at build time, edit the **cice.settings** file. - To change namelist, manually edit the **ice_in** file - To change batch settings, manually edit the top of the **cice.run** or **cice.test** (if running a test) file +- When the run scripts are submitted, the current **ice_in**, **cice.settings**, and **env.[machine]** files are copied from the case directory into the run directory. Users should generally not edit files in the run directory as these are overwritten when following the standard workflow. **cice.settings** can be sourced to establish the case values in the login shell. An alias like the following can be established to quickly switch between case and run directories:: + + alias cdrun 'cd `\grep "setenv ICE_RUNDIR" cice.settings | awk "{print "\$"NF}"`' + alias cdcase 'cd `\grep "setenv ICE_CASEDIR" cice.settings | awk "{print "\$"NF}"`' + - To turn on the debug compiler flags, set ``ICE_BLDDEBUG`` in **cice.setttings** to true. It is also possible to use the ``debug`` option (``-s debug``) when creating the case with **cice.setup** to set this option automatically. -- To change compiler options, manually edit the Macros file +- To change compiler options, manually edit the Macros file. To add user defined preprocessor macros, modify ``ICE_CPPDEFS`` in **cice.settings** using the syntax ``-DCICE_MACRO``. - To clean the build before each compile, set ``ICE_CLEANBUILD`` in **cice.settings** to true (this is the default value), or use the ``buildclean`` option (``-s buildclean``) when creating the case with **cice.setup**. To not clean before the build, set ``ICE_CLEANBUILD`` in **cice.settings** to false, or use the ``buildincremental`` option (``-s buildincremental``) when creating the case with **cice.setup**. It is recommended that the ``ICE_CLEANBUILD`` be set to true if there are any questions about whether the build is proceeding properly. To build and run:: @@ -268,7 +272,8 @@ To add some optional settings, one might do:: cice.setup --case mycase2 --mach spirit --env intel --set debug,diag1,run1year -Once the cases are created, users are free to modify the cice.settings and ice_in namelist to further modify their setup. +Once the cases are created, users are free to modify the **cice.settings** and +**ice_in** namelist to further modify their setup. .. _cicebuild: @@ -779,7 +784,11 @@ Run Directories The **cice.setup** script creates a case directory. However, the model is actually built and run under the ``ICE_OBJDIR`` and ``ICE_RUNDIR`` directories -as defined in the **cice.settings** file. +as defined in the **cice.settings** file. It's important to note that when the +run scripts are submitted, the current **ice_in**, **cice.settings**, and **env.[machine]** +files are copied from the case directory into the run directory. Users should +generally not edit files in the run directory as these are overwritten when following +the standard workflow. Build and run logs will be copied from the run directory into the case **logs/** directory when complete. diff --git a/doc/source/user_guide/ug_testing.rst b/doc/source/user_guide/ug_testing.rst index 52621d612..04b82a401 100644 --- a/doc/source/user_guide/ug_testing.rst +++ b/doc/source/user_guide/ug_testing.rst @@ -668,32 +668,25 @@ 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. +This option is currently only available with the gnu compiler and on a few systems +with modified Macros files. Because codecov.io does not support git submodule analysis right now, a customized repository has to be created to test CICE with Icepack integrated directly. The repository https://github.com/apcraig/Test_CICE_Icepack serves as the current default test repository. In general, to setup the code coverage test in CICE, the current CICE master has -to be copied into the Test_CICE_Icepack repository, then the code coverage tool can -be run on that repository. A sample script to do that would be:: +to be copied into the Test_CICE_Icepack repository, then the full test suite +can be run with the gnu compiler with the ``--codecov`` argument. - 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. +**report_codecov.csh** script. The env variable CODECOV_TOKEN needs to be defined +either in the environment or in a file named **~/.codecov_cice_token**. That +token provides write permission to the Test_CICE_Icepack codecov.io site and is available +by contacting the Consortium team directly. + +A script that carries out the end-to-end testing can be found in +**configuration/scripts/tests/cice_test_codecov.csh** This is a special diagnostic test and does not constitute proper model testing. General use is not recommended, this is mainly used as a diagnostic to periodically diff --git a/doc/source/user_guide/ug_troubleshooting.rst b/doc/source/user_guide/ug_troubleshooting.rst index e34d1261b..9e6f39941 100644 --- a/doc/source/user_guide/ug_troubleshooting.rst +++ b/doc/source/user_guide/ug_troubleshooting.rst @@ -145,6 +145,9 @@ conflicts in module dependencies. are set in **ice\_diagnostics.F90**. This option can be fairly slow, due to gathering data from processors. +`conserv\_check` = true (**ice\_in**) + Diagnoses conservation in various algorithms. + *global\_minval, global\_maxval, global\_sum* (**ice\_global\_reductions.F90**) Compute and print the minimum and maximum values for an individual real array, or its global sum. diff --git a/icepack b/icepack index 1ae044604..09a5e19f0 160000 --- a/icepack +++ b/icepack @@ -1 +1 @@ -Subproject commit 1ae044604498b8d268df6c577556d22d2baa7758 +Subproject commit 09a5e19f006f62f60f6b940a4385feb47451368e