- Timestamp:
- 2018-07-23T11:33:03+02:00 (6 years ago)
- Location:
- branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC
- Files:
-
- 113 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ASM/asmbkg.F90
r7960 r9987 119 119 CALL iom_rstput( kt, nitbkg_r, inum, 'en' , en ) 120 120 #endif 121 CALL iom_rstput( kt, nitbkg_r, inum, 'gcx' , gcx ) 121 ! CALL iom_rstput( kt, nitbkg_r, inum, 'gcx' , gcx ) 122 CALL iom_rstput( kt, nitbkg_r, inum, 'avt' , avt ) 122 123 ! 123 124 CALL iom_close( inum ) … … 153 154 CALL iom_rstput( kt, nitdin_r, inum, 'tn' , tsn(:,:,:,jp_tem) ) 154 155 CALL iom_rstput( kt, nitdin_r, inum, 'sn' , tsn(:,:,:,jp_sal) ) 156 CALL iom_rstput( kt, nitdin_r, inum, 'avt' , avt ) 155 157 CALL iom_rstput( kt, nitdin_r, inum, 'sshn' , sshn ) 156 158 #if defined key_lim2 || defined key_lim3 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90
r9486 r9987 39 39 USE ice_2 ! LIM2 40 40 #endif 41 #if defined key_cice && defined key_asminc 42 USE sbc_ice, ONLY : & ! CICE Ice model variables 43 & ndaice_da, nfresh_da, nfsalt_da 44 #endif 41 45 USE sbc_oce ! Surface boundary condition variables. 42 46 … … 131 135 & ln_asmdin, ln_asmiau, & 132 136 & nitbkg, nitdin, nitiaustr, nitiaufin, niaufn, & 133 & ln_salfix, salfixmin, nn_divdmp 137 & ln_salfix, salfixmin, nn_divdmp, & 138 & ln_seaiceinc, ln_temnofreeze 134 139 !!---------------------------------------------------------------------- 135 140 … … 656 661 657 662 DO jk = 1, jpkm1 658 fzptnz(:,:,jk) = eos_fzp( tsn(:,:,jk,jp_sal), fsdept(:,:,jk) )663 CALL eos_fzp( tsn(:,:,jk,jp_sal), fzptnz(:,:,jk), fsdept(:,:,jk) ) 659 664 END DO 660 665 … … 890 895 ENDIF 891 896 897 ELSE 898 #if defined key_asminc 899 ssh_iau(:,:) = 0.0 900 #endif 892 901 ENDIF 893 902 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/BDY/bdydta.F90
r7960 r9987 430 430 CHARACTER(len=100) :: cn_dir ! Root directory for location of data files 431 431 CHARACTER(len=100), DIMENSION(nb_bdy) :: cn_dir_array ! Root directory for location of data files 432 CHARACTER(len = 256):: clname ! temporary file name 432 433 LOGICAL :: ln_full_vel ! =T => full velocities in 3D boundary data 433 434 ! =F => baroclinic velocities in 3D boundary data … … 669 670 ! sea ice 670 671 IF( nn_ice_lim_dta(ib_bdy) .eq. 1 ) THEN 671 672 ! Test for types of ice input (lim2 or lim3) 673 CALL iom_open ( bn_a_i%clname, inum ) 674 id1 = iom_varid ( inum, bn_a_i%clvar, kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE. ) 672 ! Test for types of ice input (lim2 or lim3) 673 ! Build file name to find dimensions 674 clname=TRIM(bn_a_i%clname) 675 IF( .NOT. bn_a_i%ln_clim ) THEN 676 WRITE(clname, '(a,"_y",i4.4)' ) TRIM( bn_a_i%clname ), nyear ! add year 677 IF( bn_a_i%cltype /= 'yearly' ) WRITE(clname, '(a,"m" ,i2.2)' ) TRIM( clname ), nmonth ! add month 678 ELSE 679 IF( bn_a_i%cltype /= 'yearly' ) WRITE(clname, '(a,"_m",i2.2)' ) TRIM( bn_a_i%clname ), nmonth ! add month 680 ENDIF 681 IF( bn_a_i%cltype == 'daily' .OR. bn_a_i%cltype(1:4) == 'week' ) & 682 & WRITE(clname, '(a,"d" ,i2.2)' ) TRIM( clname ), nday ! add day 683 ! 684 CALL iom_open ( clname, inum ) 685 id1 = iom_varid( inum, bn_a_i%clvar, kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE. ) 675 686 CALL iom_close ( inum ) 676 !CALL fld_clopn ( bn_a_i, nyear, nmonth, nday, ldstop=.TRUE. ) 677 !CALL iom_open ( bn_a_i%clname, inum ) 678 !id1 = iom_varid ( bn_a_i%num, bn_a_i%clvar, kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE. ) 687 679 688 IF ( zndims == 4 ) THEN 680 689 ll_bdylim3 = .TRUE. ! lim3 input -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/BDY/bdydyn2d.F90
r7960 r9987 49 49 !!---------------------------------------------------------------------- 50 50 INTEGER, INTENT(in) :: kt ! Main time step counter 51 REAL(wp), DIMENSION( jpi,jpj), INTENT(inout) :: pua2d, pva2d52 REAL(wp), DIMENSION( jpi,jpj), INTENT(in ) :: pub2d, pvb2d53 REAL(wp), DIMENSION( jpi,jpj), INTENT(in ) :: phur, phvr54 REAL(wp), DIMENSION( jpi,jpj), INTENT(in ) :: pssh51 REAL(wp), DIMENSION(:,:), INTENT(inout) :: pua2d, pva2d 52 REAL(wp), DIMENSION(:,:), INTENT(in ) :: pub2d, pvb2d 53 REAL(wp), DIMENSION(:,:), INTENT(in ) :: phur, phvr 54 REAL(wp), DIMENSION(:,:), INTENT(in ) :: pssh 55 55 !! 56 56 INTEGER :: ib_bdy ! Loop counter … … 92 92 TYPE(OBC_DATA), INTENT(in) :: dta ! OBC external data 93 93 INTEGER, INTENT(in) :: ib_bdy ! BDY set index 94 REAL(wp), DIMENSION( jpi,jpj), INTENT(inout) :: pua2d, pva2d94 REAL(wp), DIMENSION(:,:), INTENT(inout) :: pua2d, pva2d 95 95 !! 96 96 INTEGER :: jb, jk ! dummy loop indices … … 147 147 TYPE(OBC_DATA), INTENT(in) :: dta ! OBC external data 148 148 INTEGER, INTENT(in) :: ib_bdy ! BDY set index 149 REAL(wp), DIMENSION( jpi,jpj), INTENT(inout) :: pua2d, pva2d150 REAL(wp), DIMENSION( jpi,jpj), INTENT(in) :: pssh, phur, phvr149 REAL(wp), DIMENSION(:,:), INTENT(inout) :: pua2d, pva2d 150 REAL(wp), DIMENSION(:,:), INTENT(in) :: pssh, phur, phvr 151 151 152 152 INTEGER :: jb, igrd ! dummy loop indices … … 237 237 TYPE(OBC_DATA), INTENT(in) :: dta ! OBC external data 238 238 INTEGER, INTENT(in) :: ib_bdy ! number of current open boundary set 239 REAL(wp), DIMENSION( jpi,jpj),INTENT(inout) :: pua2d, pva2d240 REAL(wp), DIMENSION( jpi,jpj),INTENT(in) :: pub2d, pvb2d239 REAL(wp), DIMENSION(:,:), INTENT(inout) :: pua2d, pva2d 240 REAL(wp), DIMENSION(:,:), INTENT(in) :: pub2d, pvb2d 241 241 LOGICAL, INTENT(in) :: ll_npo ! flag for NPO version 242 242 … … 271 271 !! 272 272 !!---------------------------------------------------------------------- 273 REAL(wp), DIMENSION( jpi,jpj), INTENT(inout) :: zssh ! Sea level273 REAL(wp), DIMENSION(:,:), INTENT(inout) :: zssh ! Sea level 274 274 !! 275 275 INTEGER :: ib_bdy, ib, igrd ! local integers 276 INTEGER :: ii, ij, zcoef, zcoef1, zcoef2,ip, jp ! " "276 INTEGER :: ii, ij, zcoef, ip, jp ! " " 277 277 278 278 igrd = 1 ! Everything is at T-points here … … 283 283 ij = idx_bdy(ib_bdy)%nbj(ib,igrd) 284 284 ! Set gradient direction: 285 zcoef1 = bdytmask(ii-1,ij ) + bdytmask(ii+1,ij ) 286 zcoef2 = bdytmask(ii ,ij-1) + bdytmask(ii ,ij+1) 287 IF ( zcoef1+zcoef2 == 0 ) THEN 288 ! corner 289 ! zcoef = tmask(ii-1,ij,1) + tmask(ii+1,ij,1) + tmask(ii,ij-1,1) + tmask(ii,ij+1,1) 290 ! zssh(ii,ij) = zssh(ii-1,ij ) * tmask(ii-1,ij ,1) + & 291 ! & zssh(ii+1,ij ) * tmask(ii+1,ij ,1) + & 292 ! & zssh(ii ,ij-1) * tmask(ii ,ij-1,1) + & 293 ! & zssh(ii ,ij+1) * tmask(ii ,ij+1,1) 294 zcoef = bdytmask(ii-1,ij) + bdytmask(ii+1,ij) + bdytmask(ii,ij-1) + bdytmask(ii,ij+1) 295 zssh(ii,ij) = zssh(ii-1,ij ) * bdytmask(ii-1,ij ) + & 296 & zssh(ii+1,ij ) * bdytmask(ii+1,ij ) + & 297 & zssh(ii ,ij-1) * bdytmask(ii ,ij-1) + & 298 & zssh(ii ,ij+1) * bdytmask(ii ,ij+1) 299 zssh(ii,ij) = ( zssh(ii,ij) / MAX( 1, zcoef) ) * tmask(ii,ij,1) 285 zcoef = bdytmask(ii-1,ij) + bdytmask(ii+1,ij) + bdytmask(ii,ij-1) + bdytmask(ii,ij+1) 286 IF ( zcoef == 0 ) THEN 287 zssh(ii,ij) = 0._wp 300 288 ELSE 301 289 ip = bdytmask(ii+1,ij ) - bdytmask(ii-1,ij ) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/BDY/bdyice_lim.F90
r7960 r9987 107 107 REAL(wp) :: zwgt, zwgt1 ! local scalar 108 108 REAL(wp) :: ztmelts, zdh 109 #if defined key_lim2 && ! defined key_lim2_vp && defined key_agrif 110 USE ice_2, vt_s => hsnm 111 USE ice_2, vt_i => hicm 112 #endif 109 113 110 114 !!------------------------------------------------------------------------------ … … 115 119 ! 116 120 #if defined key_lim2 117 DO jb = 1, idx%nblen (jgrd)121 DO jb = 1, idx%nblenrim(jgrd) 118 122 ji = idx%nbi(jb,jgrd) 119 123 jj = idx%nbj(jb,jgrd) … … 135 139 136 140 DO jl = 1, jpl 137 DO jb = 1, idx%nblen (jgrd)141 DO jb = 1, idx%nblenrim(jgrd) 138 142 ji = idx%nbi(jb,jgrd) 139 143 jj = idx%nbj(jb,jgrd) … … 171 175 172 176 DO jl = 1, jpl 173 DO jb = 1, idx%nblen (jgrd)177 DO jb = 1, idx%nblenrim(jgrd) 174 178 ji = idx%nbi(jb,jgrd) 175 179 jj = idx%nbj(jb,jgrd) … … 324 328 325 329 jgrd = 2 ! u velocity 326 DO jb = 1, idx_bdy(ib_bdy)%nblen (jgrd)330 DO jb = 1, idx_bdy(ib_bdy)%nblenrim(jgrd) 327 331 ji = idx_bdy(ib_bdy)%nbi(jb,jgrd) 328 332 jj = idx_bdy(ib_bdy)%nbj(jb,jgrd) … … 353 357 354 358 jgrd = 3 ! v velocity 355 DO jb = 1, idx_bdy(ib_bdy)%nblen (jgrd)359 DO jb = 1, idx_bdy(ib_bdy)%nblenrim(jgrd) 356 360 ji = idx_bdy(ib_bdy)%nbi(jb,jgrd) 357 361 jj = idx_bdy(ib_bdy)%nbj(jb,jgrd) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/BDY/bdyini.F90
r7960 r9987 76 76 INTEGER :: ib_bdy, ii, ij, ik, igrd, ib, ir, iseg ! dummy loop indices 77 77 INTEGER :: icount, icountr, ibr_max, ilen1, ibm1 ! local integers 78 INTEGER :: iw , ie, is, in, inum, id_dummy ! - -78 INTEGER :: iwe, ies, iso, ino, inum, id_dummy ! - - 79 79 INTEGER :: igrd_start, igrd_end, jpbdta ! - - 80 80 INTEGER :: jpbdtau, jpbdtas ! - - … … 777 777 ! is = mjg(1) + 1 ! if monotasking and no zoom, is=2 778 778 ! in = mjg(1) + nlcj-1 - 1 ! if monotasking and no zoom, in=jpjm1 779 iw = mig(1) - jpizoom + 2 ! if monotasking and no zoom, iw=2780 ie = mig(1) + nlci - jpizoom - 1 ! if monotasking and no zoom, ie=jpim1781 is = mjg(1) - jpjzoom + 2 ! if monotasking and no zoom, is=2782 in = mjg(1) + nlcj - jpjzoom - 1 ! if monotasking and no zoom, in=jpjm1779 iwe = mig(1) - jpizoom + 2 ! if monotasking and no zoom, iw=2 780 ies = mig(1) + nlci - jpizoom - 1 ! if monotasking and no zoom, ie=jpim1 781 iso = mjg(1) - jpjzoom + 2 ! if monotasking and no zoom, is=2 782 ino = mjg(1) + nlcj - jpjzoom - 1 ! if monotasking and no zoom, in=jpjm1 783 783 784 784 ALLOCATE( nbondi_bdy(nb_bdy)) … … 853 853 ENDIF 854 854 ! check if point is in local domain 855 IF( nbidta(ib,igrd,ib_bdy) >= iw .AND. nbidta(ib,igrd,ib_bdy) <= ie.AND. &856 & nbjdta(ib,igrd,ib_bdy) >= is .AND. nbjdta(ib,igrd,ib_bdy) <= in) THEN855 IF( nbidta(ib,igrd,ib_bdy) >= iwe .AND. nbidta(ib,igrd,ib_bdy) <= ies .AND. & 856 & nbjdta(ib,igrd,ib_bdy) >= iso .AND. nbjdta(ib,igrd,ib_bdy) <= ino ) THEN 857 857 ! 858 858 icount = icount + 1 … … 890 890 com_south_b = 0 891 891 com_north_b = 0 892 892 893 DO igrd = 1, jpbgrd 893 894 icount = 0 … … 896 897 DO ib = 1, nblendta(igrd,ib_bdy) 897 898 ! check if point is in local domain and equals ir 898 IF( nbidta(ib,igrd,ib_bdy) >= iw .AND. nbidta(ib,igrd,ib_bdy) <= ie.AND. &899 & nbjdta(ib,igrd,ib_bdy) >= is .AND. nbjdta(ib,igrd,ib_bdy) <= in.AND. &899 IF( nbidta(ib,igrd,ib_bdy) >= iwe .AND. nbidta(ib,igrd,ib_bdy) <= ies .AND. & 900 & nbjdta(ib,igrd,ib_bdy) >= iso .AND. nbjdta(ib,igrd,ib_bdy) <= ino .AND. & 900 901 & nbrdta(ib,igrd,ib_bdy) == ir ) THEN 901 902 ! … … 1594 1595 ELSE 1595 1596 ! This is a corner 1596 WRITE(numout,*) 'Found a South-West corner at (i,j): ', jpiwob(ib), jpjwdt(ib)1597 IF(lwp) WRITE(numout,*) 'Found a South-West corner at (i,j): ', jpiwob(ib), jpjwdt(ib) 1597 1598 CALL bdy_ctl_corn(npckgw(ib), icornw(ib,1)) 1598 1599 itest=itest+1 … … 1608 1609 ELSE 1609 1610 ! This is a corner 1610 WRITE(numout,*) 'Found a North-West corner at (i,j): ', jpiwob(ib), jpjwft(ib)1611 IF(lwp) WRITE(numout,*) 'Found a North-West corner at (i,j): ', jpiwob(ib), jpjwft(ib) 1611 1612 CALL bdy_ctl_corn(npckgw(ib), icornw(ib,2)) 1612 1613 itest=itest+1 … … 1638 1639 ELSE 1639 1640 ! This is a corner 1640 WRITE(numout,*) 'Found a South-East corner at (i,j): ', jpieob(ib)+1, jpjedt(ib)1641 IF(lwp) WRITE(numout,*) 'Found a South-East corner at (i,j): ', jpieob(ib)+1, jpjedt(ib) 1641 1642 CALL bdy_ctl_corn(npckge(ib), icorne(ib,1)) 1642 1643 itest=itest+1 … … 1652 1653 ELSE 1653 1654 ! This is a corner 1654 WRITE(numout,*) 'Found a North-East corner at (i,j): ', jpieob(ib)+1, jpjeft(ib)1655 IF(lwp) WRITE(numout,*) 'Found a North-East corner at (i,j): ', jpieob(ib)+1, jpjeft(ib) 1655 1656 CALL bdy_ctl_corn(npckge(ib), icorne(ib,2)) 1656 1657 itest=itest+1 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90
r7960 r9987 416 416 ! Absolute time from model initialization: 417 417 IF( PRESENT(kit) ) THEN 418 z_arg = ( kt + (kit+ 0.5_wp*(time_add-1)) / REAL(nn_baro,wp) ) * rdt418 z_arg = ( kt + (kit+time_add-1) / REAL(nn_baro,wp) ) * rdt 419 419 ELSE 420 420 z_arg = ( kt + time_add ) * rdt -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/BDY/bdyvol.F90
r7960 r9987 91 91 ! Calculate the cumulate surface Flux z_cflxemp (m3/s) over all the domain 92 92 ! ----------------------------------------------------------------------- 93 z_cflxemp = SUM ( ( emp(:,:)-rnf(:,:)+ rdivisf*fwfisf(:,:) ) * bdytmask(:,:) * e1t(:,:) * e2t(:,:) ) / rau093 z_cflxemp = SUM ( ( emp(:,:)-rnf(:,:)+fwfisf(:,:) ) * bdytmask(:,:) * e1t(:,:) * e2t(:,:) ) / rau0 94 94 IF( lk_mpp ) CALL mpp_sum( z_cflxemp ) ! sum over the global domain 95 95 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DIA/diaar5.F90
r7960 r9987 24 24 USE phycst ! physical constant 25 25 USE in_out_manager ! I/O manager 26 USE zdfddm 27 USE zdf_oce 26 28 27 29 IMPLICIT NONE … … 42 44 !! * Substitutions 43 45 # include "domzgr_substitute.h90" 46 # include "zdfddm_substitute.h90" 44 47 !!---------------------------------------------------------------------- 45 48 !! NEMO/OPA 3.3 , NEMO Consortium (2010) … … 75 78 INTEGER :: ji, jj, jk ! dummy loop arguments 76 79 REAL(wp) :: zvolssh, zvol, zssh_steric, zztmp, zarho, ztemp, zsal, zmass 80 REAL(wp) :: zaw, zbw, zrw 77 81 ! 78 82 REAL(wp), POINTER, DIMENSION(:,:) :: zarea_ssh , zbotpres ! 2D workspace 83 REAL(wp), POINTER, DIMENSION(:,:) :: pe ! 2D workspace 79 84 REAL(wp), POINTER, DIMENSION(:,:,:) :: zrhd , zrhop ! 3D workspace 80 85 REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztsn ! 4D workspace 81 86 !!-------------------------------------------------------------------- 82 87 IF( nn_timing == 1 ) CALL timing_start('dia_ar5') 88 89 !Call to init moved to here so that we can call iom_use in the 90 !initialisation 91 IF( kt == nit000 ) CALL dia_ar5_init 83 92 84 CALL wrk_alloc( jpi , jpj , zarea_ssh , zbotpres )93 CALL wrk_alloc( jpi , jpj , zarea_ssh , zbotpres, pe ) 85 94 CALL wrk_alloc( jpi , jpj , jpk , zrhd , zrhop ) 86 95 CALL wrk_alloc( jpi , jpj , jpk , jpts , ztsn ) … … 95 104 CALL iom_put( 'voltot', zvol ) 96 105 CALL iom_put( 'sshtot', zvolssh / area_tot ) 106 CALL iom_put( 'sshdyn', sshn(:,:) - (zvolssh / area_tot) ) 97 107 98 108 ! 99 ztsn(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) ! thermosteric ssh 100 ztsn(:,:,:,jp_sal) = sn0(:,:,:) 101 CALL eos( ztsn, zrhd, fsdept_n(:,:,:) ) ! now in situ density using initial salinity 102 ! 103 zbotpres(:,:) = 0._wp ! no atmospheric surface pressure, levitating sea-ice 104 DO jk = 1, jpkm1 105 zbotpres(:,:) = zbotpres(:,:) + fse3t(:,:,jk) * zrhd(:,:,jk) 106 END DO 107 IF( .NOT.lk_vvl ) THEN 108 IF ( ln_isfcav ) THEN 109 DO ji=1,jpi 110 DO jj=1,jpj 111 zbotpres(ji,jj) = zbotpres(ji,jj) + sshn(ji,jj) * zrhd(ji,jj,mikt(ji,jj)) + riceload(ji,jj) 109 IF( iom_use('sshthster')) THEN 110 ztsn(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) ! thermosteric ssh 111 ztsn(:,:,:,jp_sal) = sn0(:,:,:) 112 CALL eos( ztsn, zrhd, fsdept_n(:,:,:) ) ! now in situ density using initial salinity 113 ! 114 zbotpres(:,:) = 0._wp ! no atmospheric surface pressure, levitating sea-ice 115 DO jk = 1, jpkm1 116 zbotpres(:,:) = zbotpres(:,:) + fse3t(:,:,jk) * zrhd(:,:,jk) 117 END DO 118 IF( .NOT.lk_vvl ) THEN 119 IF ( ln_isfcav ) THEN 120 DO ji=1,jpi 121 DO jj=1,jpj 122 zbotpres(ji,jj) = zbotpres(ji,jj) + sshn(ji,jj) * zrhd(ji,jj,mikt(ji,jj)) + riceload(ji,jj) 123 END DO 112 124 END DO 113 E ND DO114 ELSE115 zbotpres(:,:) = zbotpres(:,:) + sshn(:,:) * zrhd(:,:,1)125 ELSE 126 zbotpres(:,:) = zbotpres(:,:) + sshn(:,:) * zrhd(:,:,1) 127 END IF 116 128 END IF 117 END IF118 129 ! 119 zarho = SUM( area(:,:) * zbotpres(:,:) ) 120 IF( lk_mpp ) CALL mpp_sum( zarho ) 121 zssh_steric = - zarho / area_tot 122 CALL iom_put( 'sshthster', zssh_steric ) 130 zarho = SUM( area(:,:) * zbotpres(:,:) ) 131 IF( lk_mpp ) CALL mpp_sum( zarho ) 132 zssh_steric = - zarho / area_tot 133 CALL iom_put( 'sshthster', zssh_steric ) 134 ENDIF 123 135 124 136 ! ! steric sea surface height … … 190 202 CALL iom_put( 'temptot', ztemp ) 191 203 CALL iom_put( 'saltot' , zsal ) 192 ! 193 CALL wrk_dealloc( jpi , jpj , zarea_ssh , zbotpres ) 204 205 IF( iom_use( 'tnpeo' )) THEN 206 ! Work done against stratification by vertical mixing 207 ! Exclude points where rn2 is negative as convection kicks in here and 208 ! work is not being done against stratification 209 pe(:,:) = 0._wp 210 IF( lk_zdfddm ) THEN 211 DO ji=1,jpi 212 DO jj=1,jpj 213 DO jk=1,jpk 214 zrw = ( fsdepw(ji,jj,jk ) - fsdept(ji,jj,jk) ) & 215 & / ( fsdept(ji,jj,jk-1) - fsdept(ji,jj,jk) ) 216 ! 217 zaw = rab_n(ji,jj,jk,jp_tem) * (1. - zrw) + rab_n(ji,jj,jk-1,jp_tem)* zrw 218 zbw = rab_n(ji,jj,jk,jp_sal) * (1. - zrw) + rab_n(ji,jj,jk-1,jp_sal)* zrw 219 ! 220 pe(ji, jj) = pe(ji, jj) - MIN(0._wp, rn2(ji,jj,jk)) * & 221 & grav * (avt(ji,jj,jk) * zaw * (tsn(ji,jj,jk-1,jp_tem) - tsn(ji,jj,jk,jp_tem) ) & 222 & - fsavs(ji,jj,jk) * zbw * (tsn(ji,jj,jk-1,jp_sal) - tsn(ji,jj,jk,jp_sal) ) ) 223 224 ENDDO 225 ENDDO 226 ENDDO 227 ELSE 228 DO ji=1,jpi 229 DO jj=1,jpj 230 DO jk=1,jpk 231 pe(ji,jj) = pe(ji,jj) + avt(ji, jj, jk) * MIN(0._wp,rn2(ji, jj, jk)) * rau0 * fse3w(ji, jj, jk) 232 ENDDO 233 ENDDO 234 ENDDO 235 ENDIF 236 CALL iom_put( 'tnpeo', pe ) 237 ENDIF 238 ! 239 CALL wrk_dealloc( jpi , jpj , zarea_ssh , zbotpres, pe ) 194 240 CALL wrk_dealloc( jpi , jpj , jpk , zrhd , zrhop ) 195 241 CALL wrk_dealloc( jpi , jpj , jpk , jpts , ztsn ) … … 211 257 REAL(wp) :: zztmp 212 258 REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zsaldta ! Jan/Dec levitus salinity 213 ! reading initial file214 LOGICAL :: ln_tsd_init !: T & S data flag215 LOGICAL :: ln_tsd_tradmp !: internal damping toward input data flag216 CHARACTER(len=100) :: cn_dir217 TYPE(FLD_N) :: sn_tem,sn_sal218 INTEGER :: ios=0219 220 NAMELIST/namtsd/ ln_tsd_init,ln_tsd_tradmp,cn_dir,sn_tem,sn_sal221 !222 223 REWIND( numnam_ref ) ! Namelist namtsd in reference namelist :224 READ ( numnam_ref, namtsd, IOSTAT = ios, ERR = 901)225 901 IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtsd in reference namelist for dia_ar5', lwp )226 REWIND( numnam_cfg ) ! Namelist namtsd in configuration namelist : Parameters of the run227 READ ( numnam_cfg, namtsd, IOSTAT = ios, ERR = 902 )228 902 IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtsd in configuration namelist for dia_ar5', lwp )229 IF(lwm) WRITE ( numond, namtsd )230 259 ! 231 260 !!---------------------------------------------------------------------- … … 233 262 IF( nn_timing == 1 ) CALL timing_start('dia_ar5_init') 234 263 ! 235 CALL wrk_alloc( jpi , jpj , jpk, jpts, zsaldta )264 CALL wrk_alloc( jpi, jpj, jpk, 2, zsaldta ) 236 265 ! ! allocate dia_ar5 arrays 237 266 IF( dia_ar5_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'dia_ar5_init : unable to allocate arrays' ) … … 249 278 IF( lk_mpp ) CALL mpp_sum( vol0 ) 250 279 251 CALL iom_open ( TRIM( cn_dir )//TRIM(sn_sal%clname), inum ) 252 CALL iom_get ( inum, jpdom_data, TRIM(sn_sal%clvar), zsaldta(:,:,:,1), 1 ) 253 CALL iom_get ( inum, jpdom_data, TRIM(sn_sal%clvar), zsaldta(:,:,:,2), 12 ) 254 CALL iom_close( inum ) 255 sn0(:,:,:) = 0.5_wp * ( zsaldta(:,:,:,1) + zsaldta(:,:,:,2) ) 256 sn0(:,:,:) = sn0(:,:,:) * tmask(:,:,:) 257 IF( ln_zps ) THEN ! z-coord. partial steps 258 DO jj = 1, jpj ! interpolation of salinity at the last ocean level (i.e. the partial step) 259 DO ji = 1, jpi 260 ik = mbkt(ji,jj) 261 IF( ik > 1 ) THEN 262 zztmp = ( gdept_1d(ik) - gdept_0(ji,jj,ik) ) / ( gdept_1d(ik) - gdept_1d(ik-1) ) 263 sn0(ji,jj,ik) = ( 1._wp - zztmp ) * sn0(ji,jj,ik) + zztmp * sn0(ji,jj,ik-1) 264 ENDIF 280 IF( iom_use('sshthster')) THEN 281 CALL iom_open ( 'sali_ref_clim_monthly', inum ) 282 CALL iom_get ( inum, jpdom_data, 'vosaline' , zsaldta(:,:,:,1), 1 ) 283 CALL iom_get ( inum, jpdom_data, 'vosaline' , zsaldta(:,:,:,2), 12 ) 284 CALL iom_close( inum ) 285 286 sn0(:,:,:) = 0.5_wp * ( zsaldta(:,:,:,1) + zsaldta(:,:,:,2) ) 287 sn0(:,:,:) = sn0(:,:,:) * tmask(:,:,:) 288 IF( ln_zps ) THEN ! z-coord. partial steps 289 DO jj = 1, jpj ! interpolation of salinity at the last ocean level (i.e. the partial step) 290 DO ji = 1, jpi 291 ik = mbkt(ji,jj) 292 IF( ik > 1 ) THEN 293 zztmp = ( gdept_1d(ik) - gdept_0(ji,jj,ik) ) / ( gdept_1d(ik) - gdept_1d(ik-1) ) 294 sn0(ji,jj,ik) = ( 1._wp - zztmp ) * sn0(ji,jj,ik) + zztmp * sn0(ji,jj,ik-1) 295 ENDIF 296 END DO 265 297 END DO 266 END DO298 ENDIF 267 299 ENDIF 268 300 ! 269 CALL wrk_dealloc( jpi , jpj , jpk, jpts, zsaldta )301 CALL wrk_dealloc( jpi, jpj, jpk, 2, zsaldta ) 270 302 ! 271 303 IF( nn_timing == 1 ) CALL timing_stop('dia_ar5_init') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DIA/diadimg.F90
r7960 r9987 124 124 125 125 CASE DEFAULT 126 IF(lwp) WRITE(numout,*) ' E R R O R : bad cd_type in dia_wri_dimg ' 127 STOP 'dia_wri_dimg' 126 127 WRITE(numout,*) 'dia_wri_dimg : E R R O R : bad cd_type in dia_wri_dimg' 128 CALL ctl_stop( 'STOP', 'dia_wri_dimg :bad cd_type in dia_wri_dimg ' ) 128 129 129 130 END SELECT -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DIA/diaharm.F90
r7960 r9987 196 196 DO ji = 1,jpi 197 197 ! Elevation 198 ana_temp(ji,jj,nhc,1) = ana_temp(ji,jj,nhc,1) + ztemp*sshn(ji,jj) *tmask_i(ji,jj) 199 #if defined key_dynspg_ts 200 ana_temp(ji,jj,nhc,2) = ana_temp(ji,jj,nhc,2) + ztemp*un_b(ji,jj)*hur(ji,jj)*umask_i(ji,jj) 201 ana_temp(ji,jj,nhc,3) = ana_temp(ji,jj,nhc,3) + ztemp*vn_b(ji,jj)*hvr(ji,jj)*vmask_i(ji,jj) 202 #endif 198 ana_temp(ji,jj,nhc,1) = ana_temp(ji,jj,nhc,1) + ztemp*sshn(ji,jj)*tmask_i(ji,jj) 199 ana_temp(ji,jj,nhc,2) = ana_temp(ji,jj,nhc,2) + ztemp*un_b(ji,jj)*umask_i(ji,jj) 200 ana_temp(ji,jj,nhc,3) = ana_temp(ji,jj,nhc,3) + ztemp*vn_b(ji,jj)*vmask_i(ji,jj) 203 201 END DO 204 202 END DO -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90
r7960 r9987 93 93 ! 1 - Trends due to forcing ! 94 94 ! ------------------------- ! 95 z_frc_trd_v = r1_rau0 * glob_sum( - ( emp(:,:) - rnf(:,:) + rdivisf *fwfisf(:,:) ) * surf(:,:) ) ! volume fluxes95 z_frc_trd_v = r1_rau0 * glob_sum( - ( emp(:,:) - rnf(:,:) + fwfisf(:,:) ) * surf(:,:) ) ! volume fluxes 96 96 z_frc_trd_t = glob_sum( sbc_tsc(:,:,jp_tem) * surf(:,:) ) ! heat fluxes 97 97 z_frc_trd_s = glob_sum( sbc_tsc(:,:,jp_sal) * surf(:,:) ) ! salt fluxes … … 101 101 ! Add ice shelf heat & salt input 102 102 IF( nn_isf .GE. 1 ) THEN 103 z_frc_trd_t = z_frc_trd_t & 104 & + glob_sum( ( risf_tsc(:,:,jp_tem) - rdivisf * fwfisf(:,:) * (-1.9) * r1_rau0 ) * surf(:,:) ) 105 z_frc_trd_s = z_frc_trd_s + (1.0_wp - rdivisf) * glob_sum( risf_tsc(:,:,jp_sal) * surf(:,:) ) 103 z_frc_trd_t = z_frc_trd_t + glob_sum( risf_tsc(:,:,jp_tem) * surf(:,:) ) 104 z_frc_trd_s = z_frc_trd_s + glob_sum( risf_tsc(:,:,jp_sal) * surf(:,:) ) 106 105 ENDIF 107 106 … … 200 199 ! ENDIF 201 200 !!gm end 202 203 201 204 202 IF( lk_vvl ) THEN -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DIA/diaptr.F90
r7960 r9987 9 9 !! 3.3 ! 2010-10 (G. Madec) dynamical allocation 10 10 !! 3.6 ! 2014-12 (C. Ethe) use of IOM 11 !! 3.6 ! 2016-06 (T. Graham) Addition of diagnostics for CMIP6 11 12 !!---------------------------------------------------------------------- 12 13 … … 21 22 USE dom_oce ! ocean space and time domain 22 23 USE phycst ! physical constants 24 USE ldftra_oce 23 25 ! 24 26 USE iom ! IOM library … … 38 40 PUBLIC dia_ptr_init ! call in step module 39 41 PUBLIC dia_ptr ! call in step module 42 PUBLIC dia_ptr_ohst_components ! called from tra_ldf/tra_adv routines 40 43 41 44 ! !!** namelist namptr ** 42 REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:) :: htr_adv, htr_ldf !: Heat TRansports (adv, diff, overturn.) 43 REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:) :: str_adv, str_ldf !: Salt TRansports (adv, diff, overturn.) 44 45 REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:) :: htr_adv, htr_ldf, htr_eiv, htr_vt !: Heat TRansports (adv, diff, Bolus.) 46 REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:) :: str_adv, str_ldf, str_eiv, str_vs !: Salt TRansports (adv, diff, Bolus.) 47 REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:) :: htr_ove, str_ove !: heat Salt TRansports ( overturn.) 48 REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:) :: htr_btr, str_btr !: heat Salt TRansports ( barotropic ) 45 49 46 50 LOGICAL, PUBLIC :: ln_diaptr ! Poleward transport flag (T) or not (F) 47 51 LOGICAL, PUBLIC :: ln_subbas ! Atlantic/Pacific/Indian basins calculation 48 INTEGER 52 INTEGER, PUBLIC :: nptr ! = 1 (l_subbas=F) or = 5 (glo, atl, pac, ind, ipc) (l_subbas=T) 49 53 50 54 REAL(wp) :: rc_sv = 1.e-6_wp ! conversion from m3/s to Sverdrup … … 77 81 ! 78 82 INTEGER :: ji, jj, jk, jn ! dummy loop indices 79 REAL(wp) :: z v, zsfc ! local scalar83 REAL(wp) :: zsfc,zvfc ! local scalar 80 84 REAL(wp), DIMENSION(jpi,jpj) :: z2d ! 2D workspace 81 85 REAL(wp), DIMENSION(jpi,jpj,jpk) :: z3d ! 3D workspace 82 86 REAL(wp), DIMENSION(jpi,jpj,jpk) :: zmask ! 3D workspace 83 87 REAL(wp), DIMENSION(jpi,jpj,jpk,jpts) :: zts ! 3D workspace 84 CHARACTER( len = 10 ) :: cl1 88 REAL(wp), DIMENSION(jpj) :: vsum ! 1D workspace 89 REAL(wp), DIMENSION(jpj,jpts) :: tssum ! 1D workspace 90 91 ! 92 !overturning calculation 93 REAL(wp), DIMENSION(jpj,jpk,nptr) :: sjk , r1_sjk ! i-mean i-k-surface and its inverse 94 REAL(wp), DIMENSION(jpj,jpk,nptr) :: v_msf, sn_jk , tn_jk ! i-mean T and S, j-Stream-Function 95 REAL(wp), DIMENSION(jpi,jpj,jpk) :: zvn ! 3D workspace 96 97 98 CHARACTER( len = 12 ) :: cl1 85 99 !!---------------------------------------------------------------------- 86 100 ! … … 88 102 89 103 ! 104 z3d(:,:,:) = 0._wp 90 105 IF( PRESENT( pvtr ) ) THEN 91 106 IF( iom_use("zomsfglo") ) THEN ! effective MSF 92 107 z3d(1,:,:) = ptr_sjk( pvtr(:,:,:) ) ! zonal cumulative effective transport 93 DO jk = 2, jpkm194 z3d(1,:,jk) = z3d(1,:,jk -1) +z3d(1,:,jk) ! effective j-Stream-Function (MSF)108 DO jk = jpkm1,1,-1 !Integrate from bottom up to get 109 z3d(1,:,jk) = z3d(1,:,jk+1) - z3d(1,:,jk) ! effective j-Stream-Function (MSF) 95 110 END DO 96 111 DO ji = 1, jpi … … 100 115 CALL iom_put( cl1, z3d * rc_sv ) 101 116 DO jn = 2, nptr ! by sub-basins 102 z3d(1,:,:) = ptr_sjk( pvtr(:,:,:), btmsk(:,:,jn) *btm30(:,:))103 DO jk = 2, jpkm1104 z3d(1,:,jk) = z3d(1,:,jk -1) +z3d(1,:,jk) ! effective j-Stream-Function (MSF)117 z3d(1,:,:) = ptr_sjk( pvtr(:,:,:), btmsk(:,:,jn) ) 118 DO jk = jpkm1,1,-1 119 z3d(1,:,jk) = z3d(1,:,jk+1) - z3d(1,:,jk) ! effective j-Stream-Function (MSF) 105 120 END DO 106 121 DO ji = 1, jpi … … 111 126 END DO 112 127 ENDIF 128 IF( iom_use("sopstove") .OR. iom_use("sophtove") .OR. iom_use("sopstbtr") .OR. iom_use("sophtbtr") ) THEN 129 ! define fields multiplied by scalar 130 zmask(:,:,:) = 0._wp 131 zts(:,:,:,:) = 0._wp 132 zvn(:,:,:) = 0._wp 133 DO jk = 1, jpkm1 134 DO jj = 1, jpjm1 135 DO ji = 1, jpi 136 zvfc = e1v(ji,jj) * fse3v(ji,jj,jk) 137 zmask(ji,jj,jk) = vmask(ji,jj,jk) * zvfc 138 zts(ji,jj,jk,jp_tem) = (tsn(ji,jj,jk,jp_tem)+tsn(ji,jj+1,jk,jp_tem)) * 0.5 * zvfc !Tracers averaged onto V grid 139 zts(ji,jj,jk,jp_sal) = (tsn(ji,jj,jk,jp_sal)+tsn(ji,jj+1,jk,jp_sal)) * 0.5 * zvfc 140 zvn(ji,jj,jk) = vn(ji,jj,jk) * zvfc 141 ENDDO 142 ENDDO 143 ENDDO 144 ENDIF 145 IF( iom_use("sopstove") .OR. iom_use("sophtove") ) THEN 146 sjk(:,:,1) = ptr_sjk( zmask(:,:,:), btmsk(:,:,1) ) 147 r1_sjk(:,:,1) = 0._wp 148 WHERE( sjk(:,:,1) /= 0._wp ) r1_sjk(:,:,1) = 1._wp / sjk(:,:,1) 149 150 ! i-mean T and S, j-Stream-Function, global 151 tn_jk(:,:,1) = ptr_sjk( zts(:,:,:,jp_tem) ) * r1_sjk(:,:,1) 152 sn_jk(:,:,1) = ptr_sjk( zts(:,:,:,jp_sal) ) * r1_sjk(:,:,1) 153 v_msf(:,:,1) = ptr_sjk( zvn(:,:,:) ) 154 155 htr_ove(:,1) = SUM( v_msf(:,:,1)*tn_jk(:,:,1) ,2 ) 156 str_ove(:,1) = SUM( v_msf(:,:,1)*sn_jk(:,:,1) ,2 ) 157 158 z2d(1,:) = htr_ove(:,1) * rc_pwatt ! (conversion in PW) 159 DO ji = 1, jpi 160 z2d(ji,:) = z2d(1,:) 161 ENDDO 162 cl1 = 'sophtove' 163 CALL iom_put( TRIM(cl1), z2d ) 164 z2d(1,:) = str_ove(:,1) * rc_ggram ! (conversion in Gg) 165 DO ji = 1, jpi 166 z2d(ji,:) = z2d(1,:) 167 ENDDO 168 cl1 = 'sopstove' 169 CALL iom_put( TRIM(cl1), z2d ) 170 IF( ln_subbas ) THEN 171 DO jn = 2, nptr 172 sjk(:,:,jn) = ptr_sjk( zmask(:,:,:), btmsk(:,:,jn) ) 173 r1_sjk(:,:,jn) = 0._wp 174 WHERE( sjk(:,:,jn) /= 0._wp ) r1_sjk(:,:,jn) = 1._wp / sjk(:,:,jn) 175 176 ! i-mean T and S, j-Stream-Function, basin 177 tn_jk(:,:,jn) = ptr_sjk( zts(:,:,:,jp_tem), btmsk(:,:,jn) ) * r1_sjk(:,:,jn) 178 sn_jk(:,:,jn) = ptr_sjk( zts(:,:,:,jp_sal), btmsk(:,:,jn) ) * r1_sjk(:,:,jn) 179 v_msf(:,:,jn) = ptr_sjk( zvn(:,:,:), btmsk(:,:,jn) ) 180 htr_ove(:,jn) = SUM( v_msf(:,:,jn)*tn_jk(:,:,jn) ,2 ) 181 str_ove(:,jn) = SUM( v_msf(:,:,jn)*sn_jk(:,:,jn) ,2 ) 182 183 z2d(1,:) = htr_ove(:,jn) * rc_pwatt ! (conversion in PW) 184 DO ji = 1, jpi 185 z2d(ji,:) = z2d(1,:) 186 ENDDO 187 cl1 = TRIM('sophtove_'//clsubb(jn)) 188 CALL iom_put( cl1, z2d ) 189 z2d(1,:) = str_ove(:,jn) * rc_ggram ! (conversion in Gg) 190 DO ji = 1, jpi 191 z2d(ji,:) = z2d(1,:) 192 ENDDO 193 cl1 = TRIM('sopstove_'//clsubb(jn)) 194 CALL iom_put( cl1, z2d ) 195 END DO 196 ENDIF 197 ENDIF 198 IF( iom_use("sopstbtr") .OR. iom_use("sophtbtr") ) THEN 199 ! Calculate barotropic heat and salt transport here 200 sjk(:,1,1) = ptr_sj( zmask(:,:,:), btmsk(:,:,1) ) 201 r1_sjk(:,1,1) = 0._wp 202 WHERE( sjk(:,1,1) /= 0._wp ) r1_sjk(:,1,1) = 1._wp / sjk(:,1,1) 203 204 vsum = ptr_sj( zvn(:,:,:), btmsk(:,:,1)) 205 tssum(:,jp_tem) = ptr_sj( zts(:,:,:,jp_tem), btmsk(:,:,1) ) 206 tssum(:,jp_sal) = ptr_sj( zts(:,:,:,jp_sal), btmsk(:,:,1) ) 207 htr_btr(:,1) = vsum * tssum(:,jp_tem) * r1_sjk(:,1,1) 208 str_btr(:,1) = vsum * tssum(:,jp_sal) * r1_sjk(:,1,1) 209 z2d(1,:) = htr_btr(:,1) * rc_pwatt ! (conversion in PW) 210 DO ji = 2, jpi 211 z2d(ji,:) = z2d(1,:) 212 ENDDO 213 cl1 = 'sophtbtr' 214 CALL iom_put( TRIM(cl1), z2d ) 215 z2d(1,:) = str_btr(:,1) * rc_ggram ! (conversion in Gg) 216 DO ji = 2, jpi 217 z2d(ji,:) = z2d(1,:) 218 ENDDO 219 cl1 = 'sopstbtr' 220 CALL iom_put( TRIM(cl1), z2d ) 221 IF( ln_subbas ) THEN 222 DO jn = 2, nptr 223 sjk(:,1,jn) = ptr_sj( zmask(:,:,:), btmsk(:,:,jn) ) 224 r1_sjk(:,1,jn) = 0._wp 225 WHERE( sjk(:,1,jn) /= 0._wp ) r1_sjk(:,1,jn) = 1._wp / sjk(:,1,jn) 226 vsum = ptr_sj( zvn(:,:,:), btmsk(:,:,jn)) 227 tssum(:,jp_tem) = ptr_sj( zts(:,:,:,jp_tem), btmsk(:,:,jn) ) 228 tssum(:,jp_sal) = ptr_sj( zts(:,:,:,jp_sal), btmsk(:,:,jn) ) 229 htr_btr(:,jn) = vsum * tssum(:,jp_tem) * r1_sjk(:,1,jn) 230 str_btr(:,jn) = vsum * tssum(:,jp_sal) * r1_sjk(:,1,jn) 231 z2d(1,:) = htr_btr(:,jn) * rc_pwatt ! (conversion in PW) 232 DO ji = 1, jpi 233 z2d(ji,:) = z2d(1,:) 234 ENDDO 235 cl1 = TRIM('sophtbtr_'//clsubb(jn)) 236 CALL iom_put( cl1, z2d ) 237 z2d(1,:) = str_btr(:,jn) * rc_ggram ! (conversion in Gg) 238 DO ji = 1, jpi 239 z2d(ji,:) = z2d(1,:) 240 ENDDO 241 cl1 = TRIM('sopstbtr_'//clsubb(jn)) 242 CALL iom_put( cl1, z2d ) 243 ENDDO 244 ENDIF !ln_subbas 245 ENDIF !iom_use("sopstbtr....) 113 246 ! 114 247 ELSE … … 150 283 ! ! Advective and diffusive heat and salt transport 151 284 IF( iom_use("sophtadv") .OR. iom_use("sopstadv") ) THEN 152 z2d(1,:) = htr_adv(: ) * rc_pwatt ! (conversion in PW)285 z2d(1,:) = htr_adv(:,1) * rc_pwatt ! (conversion in PW) 153 286 DO ji = 1, jpi 154 287 z2d(ji,:) = z2d(1,:) … … 156 289 cl1 = 'sophtadv' 157 290 CALL iom_put( TRIM(cl1), z2d ) 158 z2d(1,:) = str_adv(: ) * rc_ggram ! (conversion in Gg)291 z2d(1,:) = str_adv(:,1) * rc_ggram ! (conversion in Gg) 159 292 DO ji = 1, jpi 160 293 z2d(ji,:) = z2d(1,:) … … 162 295 cl1 = 'sopstadv' 163 296 CALL iom_put( TRIM(cl1), z2d ) 297 IF( ln_subbas ) THEN 298 DO jn=2,nptr 299 z2d(1,:) = htr_adv(:,jn) * rc_pwatt ! (conversion in PW) 300 DO ji = 1, jpi 301 z2d(ji,:) = z2d(1,:) 302 ENDDO 303 cl1 = TRIM('sophtadv_'//clsubb(jn)) 304 CALL iom_put( cl1, z2d ) 305 z2d(1,:) = str_adv(:,jn) * rc_ggram ! (conversion in Gg) 306 DO ji = 1, jpi 307 z2d(ji,:) = z2d(1,:) 308 ENDDO 309 cl1 = TRIM('sopstadv_'//clsubb(jn)) 310 CALL iom_put( cl1, z2d ) 311 ENDDO 312 ENDIF 164 313 ENDIF 165 314 ! 166 315 IF( iom_use("sophtldf") .OR. iom_use("sopstldf") ) THEN 167 z2d(1,:) = htr_ldf(: ) * rc_pwatt ! (conversion in PW)316 z2d(1,:) = htr_ldf(:,1) * rc_pwatt ! (conversion in PW) 168 317 DO ji = 1, jpi 169 318 z2d(ji,:) = z2d(1,:) … … 171 320 cl1 = 'sophtldf' 172 321 CALL iom_put( TRIM(cl1), z2d ) 173 z2d(1,:) = str_ldf(: ) * rc_ggram ! (conversion in Gg)322 z2d(1,:) = str_ldf(:,1) * rc_ggram ! (conversion in Gg) 174 323 DO ji = 1, jpi 175 324 z2d(ji,:) = z2d(1,:) … … 177 326 cl1 = 'sopstldf' 178 327 CALL iom_put( TRIM(cl1), z2d ) 179 ENDIF 328 IF( ln_subbas ) THEN 329 DO jn=2,nptr 330 z2d(1,:) = htr_ldf(:,jn) * rc_pwatt ! (conversion in PW) 331 DO ji = 1, jpi 332 z2d(ji,:) = z2d(1,:) 333 ENDDO 334 cl1 = TRIM('sophtldf_'//clsubb(jn)) 335 CALL iom_put( cl1, z2d ) 336 z2d(1,:) = str_ldf(:,jn) * rc_ggram ! (conversion in Gg) 337 DO ji = 1, jpi 338 z2d(ji,:) = z2d(1,:) 339 ENDDO 340 cl1 = TRIM('sopstldf_'//clsubb(jn)) 341 CALL iom_put( cl1, z2d ) 342 ENDDO 343 ENDIF 344 ENDIF 345 346 IF( iom_use("sopht_vt") .OR. iom_use("sopst_vs") ) THEN 347 z2d(1,:) = htr_vt(:,1) * rc_pwatt ! (conversion in PW) 348 DO ji = 1, jpi 349 z2d(ji,:) = z2d(1,:) 350 ENDDO 351 cl1 = 'sopht_vt' 352 CALL iom_put( TRIM(cl1), z2d ) 353 z2d(1,:) = str_vs(:,1) * rc_ggram ! (conversion in Gg) 354 DO ji = 1, jpi 355 z2d(ji,:) = z2d(1,:) 356 ENDDO 357 cl1 = 'sopst_vs' 358 CALL iom_put( TRIM(cl1), z2d ) 359 IF( ln_subbas ) THEN 360 DO jn=2,nptr 361 z2d(1,:) = htr_vt(:,jn) * rc_pwatt ! (conversion in PW) 362 DO ji = 1, jpi 363 z2d(ji,:) = z2d(1,:) 364 ENDDO 365 cl1 = TRIM('sopht_vt_'//clsubb(jn)) 366 CALL iom_put( cl1, z2d ) 367 z2d(1,:) = str_vs(:,jn) * rc_ggram ! (conversion in Gg) 368 DO ji = 1, jpi 369 z2d(ji,:) = z2d(1,:) 370 ENDDO 371 cl1 = TRIM('sopst_vs_'//clsubb(jn)) 372 CALL iom_put( cl1, z2d ) 373 ENDDO 374 ENDIF 375 ENDIF 376 377 #ifdef key_diaeiv 378 IF(lk_traldf_eiv) THEN 379 IF( iom_use("sophteiv") .OR. iom_use("sopsteiv") ) THEN 380 z2d(1,:) = htr_eiv(:,1) * rc_pwatt ! (conversion in PW) 381 DO ji = 1, jpi 382 z2d(ji,:) = z2d(1,:) 383 ENDDO 384 cl1 = 'sophteiv' 385 CALL iom_put( TRIM(cl1), z2d ) 386 z2d(1,:) = str_eiv(:,1) * rc_ggram ! (conversion in Gg) 387 DO ji = 1, jpi 388 z2d(ji,:) = z2d(1,:) 389 ENDDO 390 cl1 = 'sopsteiv' 391 CALL iom_put( TRIM(cl1), z2d ) 392 IF( ln_subbas ) THEN 393 DO jn=2,nptr 394 z2d(1,:) = htr_eiv(:,jn) * rc_pwatt ! (conversion in PW) 395 DO ji = 1, jpi 396 z2d(ji,:) = z2d(1,:) 397 ENDDO 398 cl1 = TRIM('sophteiv_'//clsubb(jn)) 399 CALL iom_put( cl1, z2d ) 400 z2d(1,:) = str_eiv(:,jn) * rc_ggram ! (conversion in Gg) 401 DO ji = 1, jpi 402 z2d(ji,:) = z2d(1,:) 403 ENDDO 404 cl1 = TRIM('sopsteiv_'//clsubb(jn)) 405 CALL iom_put( cl1, z2d ) 406 ENDDO 407 ENDIF 408 ENDIF 409 IF( iom_use("zomsfeivglo") ) THEN 410 z3d(1,:,:) = ptr_sjk( v_eiv(:,:,:) ) ! zonal cumulative effective transport 411 DO jk = jpkm1,1,-1 412 z3d(1,:,jk) = z3d(1,:,jk+1) - z3d(1,:,jk) ! effective j-Stream-Function (MSF) 413 END DO 414 DO ji = 1, jpi 415 z3d(ji,:,:) = z3d(1,:,:) 416 ENDDO 417 cl1 = TRIM('zomsfeiv'//clsubb(1) ) 418 CALL iom_put( cl1, z3d * rc_sv ) 419 IF( ln_subbas ) THEN 420 DO jn = 2, nptr ! by sub-basins 421 z3d(1,:,:) = ptr_sjk( v_eiv(:,:,:), btmsk(:,:,jn) ) 422 DO jk = jpkm1,1,-1 423 z3d(1,:,jk) = z3d(1,:,jk+1) - z3d(1,:,jk) ! effective j-Stream-Function (MSF) 424 END DO 425 DO ji = 1, jpi 426 z3d(ji,:,:) = z3d(1,:,:) 427 ENDDO 428 cl1 = TRIM('zomsfeiv'//clsubb(jn) ) 429 CALL iom_put( cl1, z3d * rc_sv ) 430 END DO 431 ENDIF 432 ENDIF 433 ENDIF 434 #endif 180 435 ! 181 436 ENDIF … … 256 511 ! Initialise arrays to zero because diatpr is called before they are first calculated 257 512 ! Note that this means diagnostics will not be exactly correct when model run is restarted. 258 htr_adv(:) = 0._wp ; str_adv(:) = 0._wp 259 htr_ldf(:) = 0._wp ; str_ldf(:) = 0._wp 513 htr_adv(:,:) = 0._wp ; str_adv(:,:) = 0._wp 514 htr_ldf(:,:) = 0._wp ; str_ldf(:,:) = 0._wp 515 htr_eiv(:,:) = 0._wp ; str_eiv(:,:) = 0._wp 516 htr_vt(:,:) = 0._wp ; str_vs(:,:) = 0._wp 517 htr_ove(:,:) = 0._wp ; str_ove(:,:) = 0._wp 518 htr_btr(:,:) = 0._wp ; str_btr(:,:) = 0._wp 260 519 ! 261 520 ENDIF … … 263 522 END SUBROUTINE dia_ptr_init 264 523 524 SUBROUTINE dia_ptr_ohst_components( ktra, cptr, pva ) 525 !!---------------------------------------------------------------------- 526 !! *** ROUTINE dia_ptr_ohst_components *** 527 !!---------------------------------------------------------------------- 528 !! Wrapper for heat and salt transport calculations to calculate them for each basin 529 !! Called from all advection and/or diffusion routines 530 !!---------------------------------------------------------------------- 531 INTEGER , INTENT(in ) :: ktra ! tracer index 532 CHARACTER(len=3) , INTENT(in) :: cptr ! transport type 'adv'/'ldf'/'eiv' 533 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) :: pva ! 3D input array of advection/diffusion 534 INTEGER :: jn ! 535 536 IF( cptr == 'adv' ) THEN 537 IF( ktra == jp_tem ) htr_adv(:,1) = ptr_sj( pva(:,:,:) ) 538 IF( ktra == jp_sal ) str_adv(:,1) = ptr_sj( pva(:,:,:) ) 539 ENDIF 540 IF( cptr == 'ldf' ) THEN 541 IF( ktra == jp_tem ) htr_ldf(:,1) = ptr_sj( pva(:,:,:) ) 542 IF( ktra == jp_sal ) str_ldf(:,1) = ptr_sj( pva(:,:,:) ) 543 ENDIF 544 IF( cptr == 'eiv' ) THEN 545 IF( ktra == jp_tem ) htr_eiv(:,1) = ptr_sj( pva(:,:,:) ) 546 IF( ktra == jp_sal ) str_eiv(:,1) = ptr_sj( pva(:,:,:) ) 547 ENDIF 548 IF( cptr == 'vts' ) THEN 549 IF( ktra == jp_tem ) htr_vt(:,1) = ptr_sj( pva(:,:,:) ) 550 IF( ktra == jp_sal ) str_vs(:,1) = ptr_sj( pva(:,:,:) ) 551 ENDIF 552 ! 553 IF( ln_subbas ) THEN 554 ! 555 IF( cptr == 'adv' ) THEN 556 IF( ktra == jp_tem ) THEN 557 DO jn = 2, nptr 558 htr_adv(:,jn) = ptr_sj( pva(:,:,:), btmsk(:,:,jn) ) 559 END DO 560 ENDIF 561 IF( ktra == jp_sal ) THEN 562 DO jn = 2, nptr 563 str_adv(:,jn) = ptr_sj( pva(:,:,:), btmsk(:,:,jn) ) 564 END DO 565 ENDIF 566 ENDIF 567 IF( cptr == 'ldf' ) THEN 568 IF( ktra == jp_tem ) THEN 569 DO jn = 2, nptr 570 htr_ldf(:,jn) = ptr_sj( pva(:,:,:), btmsk(:,:,jn) ) 571 END DO 572 ENDIF 573 IF( ktra == jp_sal ) THEN 574 DO jn = 2, nptr 575 str_ldf(:,jn) = ptr_sj( pva(:,:,:), btmsk(:,:,jn) ) 576 END DO 577 ENDIF 578 ENDIF 579 IF( cptr == 'eiv' ) THEN 580 IF( ktra == jp_tem ) THEN 581 DO jn = 2, nptr 582 htr_eiv(:,jn) = ptr_sj( pva(:,:,:), btmsk(:,:,jn) ) 583 END DO 584 ENDIF 585 IF( ktra == jp_sal ) THEN 586 DO jn = 2, nptr 587 str_eiv(:,jn) = ptr_sj( pva(:,:,:), btmsk(:,:,jn) ) 588 END DO 589 ENDIF 590 ENDIF 591 IF( cptr == 'vts' ) THEN 592 IF( ktra == jp_tem ) THEN 593 DO jn = 2, nptr 594 htr_vt(:,jn) = ptr_sj( pva(:,:,:), btmsk(:,:,jn) ) 595 END DO 596 ENDIF 597 IF( ktra == jp_sal ) THEN 598 DO jn = 2, nptr 599 str_vs(:,jn) = ptr_sj( pva(:,:,:), btmsk(:,:,jn) ) 600 END DO 601 ENDIF 602 ENDIF 603 ! 604 ENDIF 605 END SUBROUTINE dia_ptr_ohst_components 606 265 607 266 608 FUNCTION dia_ptr_alloc() … … 273 615 ierr(:) = 0 274 616 ! 275 ALLOCATE( btmsk(jpi,jpj,nptr) , & 276 & htr_adv(jpj) , str_adv(jpj) , & 277 & htr_ldf(jpj) , str_ldf(jpj) , STAT=ierr(1) ) 617 ALLOCATE( btmsk(jpi,jpj,nptr) , & 618 & htr_adv(jpj,nptr) , str_adv(jpj,nptr) , & 619 & htr_eiv(jpj,nptr) , str_eiv(jpj,nptr) , & 620 & htr_vt(jpj,nptr) , str_vs(jpj,nptr) , & 621 & htr_ove(jpj,nptr) , str_ove(jpj,nptr) , & 622 & htr_btr(jpj,nptr) , str_btr(jpj,nptr) , & 623 & htr_ldf(jpj,nptr) , str_ldf(jpj,nptr) , STAT=ierr(1) ) 278 624 ! 279 625 ALLOCATE( p_fval1d(jpj), p_fval2d(jpj,jpk), Stat=ierr(2)) … … 402 748 #endif 403 749 !!-------------------------------------------------------------------- 404 750 ! 405 751 p_fval => p_fval2d 406 752 … … 434 780 #endif 435 781 ! 782 436 783 END FUNCTION ptr_sjk 437 784 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90
r7960 r9987 39 39 USE zdfmxl ! mixed layer 40 40 USE dianam ! build name of file (routine) 41 USE zdftke ! vertical physics: one-equation scheme 41 42 USE zdfddm ! vertical physics: double diffusion 42 43 USE diahth ! thermocline diagnostics … … 46 47 USE iom 47 48 USE ioipsl 48 USE dynspg_oce, ONLY: un_adv, vn_adv ! barotropic velocities 49 49 USE dynspg_oce, ONLY: un_adv, vn_adv ! barotropic velocities 50 USE insitu_tem, ONLY: insitu_t, theta2t 50 51 #if defined key_lim2 51 52 USE limwri_2 … … 145 146 ENDIF 146 147 147 IF( .NOT.lk_vvl ) THEN 148 CALL iom_put( "e3t" , fse3t_n(:,:,:) ) 149 CALL iom_put( "e3u" , fse3u_n(:,:,:) ) 150 CALL iom_put( "e3v" , fse3v_n(:,:,:) ) 151 CALL iom_put( "e3w" , fse3w_n(:,:,:) ) 152 ENDIF 148 ! Output of initial vertical scale factor 149 CALL iom_put("e3t_0", e3t_0(:,:,:) ) 150 CALL iom_put("e3u_0", e3t_0(:,:,:) ) 151 CALL iom_put("e3v_0", e3t_0(:,:,:) ) 152 ! 153 CALL iom_put( "e3t" , fse3t_n(:,:,:) ) 154 CALL iom_put( "e3u" , fse3u_n(:,:,:) ) 155 CALL iom_put( "e3v" , fse3v_n(:,:,:) ) 156 CALL iom_put( "e3w" , fse3w_n(:,:,:) ) 157 IF( iom_use("e3tdef") ) & 158 CALL iom_put( "e3tdef" , ( ( fse3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 ) 159 CALL iom_put("tpt_dep", fsdept_n(:,:,:) ) 160 CALL iom_put("wpt_dep", fsdepw_n(:,:,:) ) 161 153 162 154 163 CALL iom_put( "ssh" , sshn ) ! sea surface height 155 if( iom_use('ssh2') ) CALL iom_put( "ssh2", sshn(:,:) * sshn(:,:) ) ! square of sea surface height156 164 157 165 CALL iom_put( "toce", tsn(:,:,:,jp_tem) ) ! 3D temperature 166 CALL theta2t ! in-situ temperature conversion 167 CALL iom_put( "tinsitu", insitu_t(:,:,:)) ! in-situ temperature 158 168 CALL iom_put( "sst", tsn(:,:,1,jp_tem) ) ! surface temperature 159 169 IF ( iom_use("sbt") ) THEN … … 194 204 CALL iom_put( "taubot", z2d ) 195 205 ENDIF 196 206 197 207 CALL iom_put( "uoce", un(:,:,:) ) ! 3D i-current 198 208 CALL iom_put( "ssu", un(:,:,1) ) ! surface i-current … … 242 252 CALL iom_put( "avt" , avt ) ! T vert. eddy diff. coef. 243 253 CALL iom_put( "avm" , avmu ) ! T vert. eddy visc. coef. 254 IF( lk_zdftke ) THEN 255 CALL iom_put( "tke" , en ) ! TKE budget: Turbulent Kinetic Energy 256 CALL iom_put( "tke_niw" , e_niw ) ! TKE budget: Near-inertial waves 257 ENDIF 244 258 CALL iom_put( "avs" , fsavs(:,:,:) ) ! S vert. eddy diff. coef. (useful only with key_zdfddm) 259 ! Log of eddy diff coef 260 IF( iom_use('logavt') ) CALL iom_put( "logavt", LOG( MAX( 1.e-20_wp, avt (:,:,:) ) ) ) 261 IF( iom_use('logavs') ) CALL iom_put( "logavs", LOG( MAX( 1.e-20_wp, fsavs(:,:,:) ) ) ) 245 262 246 263 IF ( iom_use("sstgrad") .OR. iom_use("sstgrad2") ) THEN … … 307 324 CALL iom_put( "eken", rke ) 308 325 ENDIF 309 310 IF( iom_use("u_masstr") .OR. iom_use("u_heattr") .OR. iom_use("u_salttr") ) THEN 326 ! 327 CALL iom_put( "hdiv", hdivn ) ! Horizontal divergence 328 ! 329 IF( iom_use("u_masstr") .OR. iom_use("u_masstr_vint") .OR. iom_use("u_heattr") .OR. iom_use("u_salttr") ) THEN 311 330 z3d(:,:,jpk) = 0.e0 331 z2d(:,:) = 0.e0 312 332 DO jk = 1, jpkm1 313 333 z3d(:,:,jk) = rau0 * un(:,:,jk) * e2u(:,:) * fse3u(:,:,jk) * umask(:,:,jk) 334 z2d(:,:) = z2d(:,:) + z3d(:,:,jk) 314 335 END DO 315 336 CALL iom_put( "u_masstr", z3d ) ! mass transport in i-direction 337 CALL iom_put( "u_masstr_vint", z2d ) ! mass transport in i-direction vertical sum 316 338 ENDIF 317 339 … … 376 398 CALL iom_put( "v_salttr", 0.5 * z2d ) ! heat transport in j-direction 377 399 ENDIF 400 401 ! Vertical integral of temperature 402 IF( iom_use("tosmint") ) THEN 403 z2d(:,:)=0._wp 404 DO jk = 1, jpkm1 405 DO jj = 2, jpjm1 406 DO ji = fs_2, fs_jpim1 ! vector opt. 407 z2d(ji,jj) = z2d(ji,jj) + rau0 * fse3t(ji,jj,jk) * tsn(ji,jj,jk,jp_tem) 408 END DO 409 END DO 410 END DO 411 CALL lbc_lnk( z2d, 'T', -1. ) 412 CALL iom_put( "tosmint", z2d ) 413 ENDIF 414 415 ! Vertical integral of salinity 416 IF( iom_use("somint") ) THEN 417 z2d(:,:)=0._wp 418 DO jk = 1, jpkm1 419 DO jj = 2, jpjm1 420 DO ji = fs_2, fs_jpim1 ! vector opt. 421 z2d(ji,jj) = z2d(ji,jj) + rau0 * fse3t(ji,jj,jk) * tsn(ji,jj,jk,jp_sal) 422 END DO 423 END DO 424 END DO 425 CALL lbc_lnk( z2d, 'T', -1. ) 426 CALL iom_put( "somint", z2d ) 427 ENDIF 428 429 CALL iom_put( "bn2", rn2 ) !Brunt-Vaisala buoyancy frequency (N^2) 378 430 ! 379 431 CALL wrk_dealloc( jpi , jpj , z2d ) … … 438 490 zdt = rdt 439 491 IF( nacc == 1 ) zdt = rdtmin 440 IF( ln_mskland ) THEN ; clop = "only(x)" ! put 1.e+20 on land (very expensive!!) 441 ELSE ; clop = "x" ! no use of the mask value (require less cpu time) 442 ENDIF 492 clop = "x" ! no use of the mask value (require less cpu time, and otherwise the model crashes) 443 493 #if defined key_diainstant 444 494 zsto = nwrite * zdt … … 1020 1070 CALL histdef( id_i, "vovvldep", "T point depth" , "m" , & ! t-point depth 1021 1071 & jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout ) 1072 CALL histdef( id_i, "vovvle3t", "T point thickness" , "m" , & ! t-point depth 1073 & jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout ) 1022 1074 END IF 1023 1075 … … 1050 1102 CALL histwrite( id_i, "sozotaux", kt, utau , jpi*jpj , idex ) ! i-wind stress 1051 1103 CALL histwrite( id_i, "sometauy", kt, vtau , jpi*jpj , idex ) ! j-wind stress 1104 IF( lk_vvl ) THEN 1105 CALL histwrite( id_i, "vovvldep", kt, fsdept_n(:,:,:), jpi*jpj*jpk, idex )! T-cell depth 1106 CALL histwrite( id_i, "vovvle3t", kt, fse3t_n (:,:,:), jpi*jpj*jpk, idex )! T-cell thickness 1107 END IF 1052 1108 1053 1109 ! 3. Close the file … … 1062 1118 ENDIF 1063 1119 #endif 1120 1121 IF (cdfile_name == "output.abort") THEN 1122 CALL ctl_stop('MPPSTOP', 'NEMO abort from dia_wri_state') 1123 END IF 1064 1124 1065 1125 ! IF( nn_timing == 1 ) CALL timing_stop('dia_wri_state') ! not sure this works for routines not called in first timestep -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90
r7960 r9987 112 112 IF( inbsel > jpk ) THEN 113 113 IF(lwp) WRITE(numout,*) ' STOP inbsel =',inbsel,' is larger than jpk=',jpk 114 STOP114 CALL ctl_stop('STOP', 'NEMO aborted from dia_wri') 115 115 ENDIF 116 116 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90
r7960 r9987 36 36 PUBLIC clo_bat ! routine called in domzgr module 37 37 38 INTEGER, PUBLIC, PARAMETER :: jpncs = 4!: number of closed sea38 INTEGER, PUBLIC, PARAMETER :: jpncs = 10 !: number of closed sea 39 39 INTEGER, PUBLIC, DIMENSION(jpncs) :: ncstt !: Type of closed sea 40 40 INTEGER, PUBLIC, DIMENSION(jpncs) :: ncsi1, ncsj1 !: south-west closed sea limits (i,j) … … 155 155 ncsi2(4) = 76 ; ncsj2(4) = 61 156 156 ncsir(4,1) = 84 ; ncsjr(4,1) = 59 157 ! ! ======================= 158 CASE ( 025 ) ! ORCA_R025 configuration159 ! ! ======================= 160 ncsnr(1) = 1 ; ncstt(1) = 0 ! Caspian + Aralsea161 ncsi1(1) = 1330 ; ncsj1(1) = 645162 ncsi2(1) = 1 400 ; ncsj2(1) = 795157 ! ! ================================ 158 CASE ( 025 ) ! ORCA_R025 extended configuration 159 ! ! ================================ 160 ncsnr(1) = 1 ; ncstt(1) = 0 ! Caspian sea 161 ncsi1(1) = 1330 ; ncsj1(1) = 831 162 ncsi2(1) = 1375 ; ncsj2(1) = 981 163 163 ncsir(1,1) = 1 ; ncsjr(1,1) = 1 164 164 ! 165 ncsnr(2) = 1 ; ncstt(2) = 0 ! A zov Sea166 ncsi1(2) = 1 284 ; ncsj1(2) = 722167 ncsi2(2) = 1 304 ; ncsj2(2) = 747165 ncsnr(2) = 1 ; ncstt(2) = 0 ! Aral sea 166 ncsi1(2) = 1376 ; ncsj1(2) = 900 167 ncsi2(2) = 1400 ; ncsj2(2) = 981 168 168 ncsir(2,1) = 1 ; ncsjr(2,1) = 1 169 ! 170 ncsnr(3) = 1 ; ncstt(3) = 0 ! Azov Sea 171 ncsi1(3) = 1284 ; ncsj1(3) = 908 172 ncsi2(3) = 1304 ; ncsj2(3) = 933 173 ncsir(3,1) = 1 ; ncsjr(3,1) = 1 174 ! 175 ncsnr(4) = 1 ; ncstt(4) = 0 ! Lake Superior 176 ncsi1(4) = 781 ; ncsj1(4) = 904 177 ncsi2(4) = 815 ; ncsj2(4) = 926 178 ncsir(4,1) = 1 ; ncsjr(4,1) = 1 179 ! 180 ncsnr(5) = 1 ; ncstt(5) = 0 ! Lake Michigan 181 ncsi1(5) = 795 ; ncsj1(5) = 871 182 ncsi2(5) = 813 ; ncsj2(5) = 905 183 ncsir(5,1) = 1 ; ncsjr(5,1) = 1 184 ! 185 ncsnr(6) = 1 ; ncstt(6) = 0 ! Lake Huron part 1 186 ncsi1(6) = 814 ; ncsj1(6) = 882 187 ncsi2(6) = 825 ; ncsj2(6) = 905 188 ncsir(6,1) = 1 ; ncsjr(6,1) = 1 189 ! 190 ncsnr(7) = 1 ; ncstt(7) = 0 ! Lake Huron part 2 191 ncsi1(7) = 826 ; ncsj1(7) = 889 192 ncsi2(7) = 833 ; ncsj2(7) = 905 193 ncsir(7,1) = 1 ; ncsjr(7,1) = 1 194 ! 195 ncsnr(8) = 1 ; ncstt(8) = 0 ! Lake Erie 196 ncsi1(8) = 816 ; ncsj1(8) = 871 197 ncsi2(8) = 837 ; ncsj2(8) = 881 198 ncsir(8,1) = 1 ; ncsjr(8,1) = 1 199 ! 200 ncsnr(9) = 1 ; ncstt(9) = 0 ! Lake Ontario 201 ncsi1(9) = 831 ; ncsj1(9) = 882 202 ncsi2(9) = 847 ; ncsj2(9) = 889 203 ncsir(9,1) = 1 ; ncsjr(9,1) = 1 204 ! 205 ncsnr(10) = 1 ; ncstt(10) = 0 ! Lake Victoria 206 ncsi1(10) = 1274 ; ncsj1(10) = 672 207 ncsi2(10) = 1289 ; ncsj2(10) = 687 208 ncsir(10,1) = 1 ; ncsjr(10,1) = 1 169 209 ! 170 210 END SELECT -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
r7960 r9987 73 73 !!---------------------------------------------------------------------- 74 74 ! 75 ! max number of seconds between each restart 76 IF( REAL( nitend - nit000 + 1 ) * rdt > REAL( HUGE( nsec1jan000 ) ) ) THEN 77 CALL ctl_stop( 'The number of seconds between each restart exceeds the integer 4 max value: 2^31-1. ', & 78 & 'You must do a restart at higher frequency (or remove this stop and recompile the code in I8)' ) 79 ENDIF 75 80 ! all calendar staff is based on the fact that MOD( rday, rdttra(1) ) == 0 76 81 IF( MOD( rday , rdttra(1) ) /= 0. ) CALL ctl_stop( 'the time step must devide the number of second of in a day' ) … … 238 243 nday_year = 1 239 244 nsec_year = ndt05 240 IF( nsec1jan000 >= 2 * (2**30 - nsecd * nyear_len(1) / 2 ) ) THEN ! test integer 4 max value241 CALL ctl_stop( 'The number of seconds between Jan. 1st 00h of nit000 year and Jan. 1st 00h ', &242 & 'of the current year is exceeding the INTEGER 4 max VALUE: 2^31-1 -> 68.09 years in seconds', &243 & 'You must do a restart at higher frequency (or remove this STOP and recompile everything in I8)' )244 ENDIF245 245 nsec1jan000 = nsec1jan000 + nsecd * nyear_len(1) 246 246 IF( nleapy == 1 ) CALL day_mth -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90
r7960 r9987 355 355 & gdept_0 (jpi,jpj,jpk) , e3t_0(jpi,jpj,jpk) , e3u_0 (jpi,jpj,jpk) , & 356 356 & gdepw_0 (jpi,jpj,jpk) , e3w_0(jpi,jpj,jpk) , e3vw_0(jpi,jpj,jpk) , e3uw_0(jpi,jpj,jpk) , STAT=ierr(4) ) 357 358 ! Initilaise key variables at risk of being intercepted before properly set up. 359 e3t_0(:,:,:) = 0.0 357 360 ! 358 361 #if defined key_vvl … … 368 371 & ehu_b (jpi,jpj) , ehv_b (jpi,jpj), & 369 372 & ehur_b (jpi,jpj) , ehvr_b (jpi,jpj), STAT=ierr(5) ) 373 374 ! Initilaise key variables at risk of being intercepted before properly set up. 375 e3t_n(:,:,:) = 0.0 370 376 #endif 371 377 ! -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
r7960 r9987 136 136 USE ioipsl 137 137 NAMELIST/namrun/ cn_ocerst_indir, cn_ocerst_outdir, nn_stocklist, ln_rst_list, & 138 & nn_no , cn_exp , cn_ocerst_in, cn_ocerst_out, ln_rstart , nn_rstctl, &138 & nn_no , cn_exp , cn_ocerst_in, cn_ocerst_out, ln_rstart , ln_rstdate, nn_rstctl, & 139 139 & nn_it000, nn_itend , nn_date0 , nn_leapy , nn_istate , nn_stock , & 140 140 & nn_write, ln_dimgnnn, ln_mskland , ln_cfmeta , ln_clobber, nn_chunksz, nn_euler … … 173 173 WRITE(numout,*) ' file prefix restart output cn_ocerst_out= ', cn_ocerst_out 174 174 WRITE(numout,*) ' restart output directory cn_ocerst_outdir= ', cn_ocerst_outdir 175 WRITE(numout,*) ' restart logical ln_rstart = ', ln_rstart 175 WRITE(numout,*) ' restart logical ln_rstart = ' , ln_rstart 176 WRITE(numout,*) ' datestamping of restarts ln_rstdate = ', ln_rstdate 176 177 WRITE(numout,*) ' start with forward time step nn_euler = ', nn_euler 177 178 WRITE(numout,*) ' control of time step nn_rstctl = ', nn_rstctl -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/domhgr.F90
r7960 r9987 169 169 ! 170 170 ii0 = 282 ; ii1 = 283 ! Gibraltar Strait (e2u = 20 km) 171 ij0 = 2 01 +isrow ; ij1 = 241 - isrow ; e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 20.e3171 ij0 = 241 - isrow ; ij1 = 241 - isrow ; e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 20.e3 172 172 IF(lwp) WRITE(numout,*) 173 173 IF(lwp) WRITE(numout,*) ' orca_r1: Gibraltar : e2u reduced to 20 km' 174 174 175 175 ii0 = 314 ; ii1 = 315 ! Bhosporus Strait (e2u = 10 km) 176 ij0 = 2 08 +isrow ; ij1 = 248 - isrow ; e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 10.e3176 ij0 = 248 - isrow ; ij1 = 248 - isrow ; e2u( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 10.e3 177 177 IF(lwp) WRITE(numout,*) 178 178 IF(lwp) WRITE(numout,*) ' orca_r1: Bhosporus : e2u reduced to 10 km' 179 179 180 180 ii0 = 44 ; ii1 = 44 ! Lombok Strait (e1v = 13 km) 181 ij0 = 1 24 +isrow ; ij1 = 165 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 13.e3181 ij0 = 164 - isrow ; ij1 = 165 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 13.e3 182 182 IF(lwp) WRITE(numout,*) 183 183 IF(lwp) WRITE(numout,*) ' orca_r1: Lombok : e1v reduced to 10 km' 184 184 185 185 ii0 = 48 ; ii1 = 48 ! Sumba Strait (e1v = 8 km) [closed from bathy_11 on] 186 ij0 = 1 24 +isrow ; ij1 = 165 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 8.e3186 ij0 = 164 - isrow ; ij1 = 165 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 8.e3 187 187 IF(lwp) WRITE(numout,*) 188 188 IF(lwp) WRITE(numout,*) ' orca_r1: Sumba : e1v reduced to 8 km' 189 189 190 190 ii0 = 53 ; ii1 = 53 ! Ombai Strait (e1v = 13 km) 191 ij0 = 1 24 +isrow ; ij1 = 165 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 13.e3191 ij0 = 164 - isrow ; ij1 = 165 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 13.e3 192 192 IF(lwp) WRITE(numout,*) 193 193 IF(lwp) WRITE(numout,*) ' orca_r1: Ombai : e1v reduced to 13 km' 194 194 195 195 ii0 = 56 ; ii1 = 56 ! Timor Passage (e1v = 20 km) 196 ij0 = 1 24 +isrow ; ij1 = 145 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 20.e3196 ij0 = 164 - isrow ; ij1 = 145 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 20.e3 197 197 IF(lwp) WRITE(numout,*) 198 198 IF(lwp) WRITE(numout,*) ' orca_r1: Timor Passage : e1v reduced to 20 km' 199 199 200 200 ii0 = 55 ; ii1 = 55 ! West Halmahera Strait (e1v = 30 km) 201 ij0 = 1 41 +isrow ; ij1 = 182 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 30.e3201 ij0 = 181 - isrow ; ij1 = 182 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 30.e3 202 202 IF(lwp) WRITE(numout,*) 203 203 IF(lwp) WRITE(numout,*) ' orca_r1: W Halmahera : e1v reduced to 30 km' 204 204 205 205 ii0 = 58 ; ii1 = 58 ! East Halmahera Strait (e1v = 50 km) 206 ij0 = 1 41 +isrow ; ij1 = 182 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 50.e3206 ij0 = 181 - isrow ; ij1 = 182 - isrow ; e1v( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 50.e3 207 207 IF(lwp) WRITE(numout,*) 208 208 IF(lwp) WRITE(numout,*) ' orca_r1: E Halmahera : e1v reduced to 50 km' … … 544 544 IF ( cp_cfg == 'eel' .AND. jp_cfg == 6 ) THEN ! for EEL6 configuration only 545 545 IF( .NOT. Agrif_Root() ) THEN 546 zphi0 = ppgphi0 - FLOAT( Agrif_Parent(jpjglo)/2)*Agrif_Parent(ppe2_m) / (ra * rad) 546 zphi0 = ppgphi0 - FLOAT( Agrif_Parent(jpjglo)/2)*Agrif_Parent(ppe2_m) & 547 & / (ra * rad) 547 548 ENDIF 548 549 ENDIF -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/dommsk.F90
r7960 r9987 136 136 INTEGER :: isrow ! index for ORCA1 starting row 137 137 INTEGER , POINTER, DIMENSION(:,:) :: imsk 138 REAL(wp) :: zphi_drake_passage, zshlat_antarc 138 139 REAL(wp), POINTER, DIMENSION(:,:) :: zwf 139 140 !! … … 413 414 IF(lwp) WRITE(numout,*) ' Gibraltar ' 414 415 ii0 = 282 ; ii1 = 283 ! Gibraltar Strait 415 ij0 = 2 01 +isrow ; ij1 = 241 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp416 ij0 = 241 - isrow ; ij1 = 241 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp 416 417 417 418 IF(lwp) WRITE(numout,*) ' Bhosporus ' 418 419 ii0 = 314 ; ii1 = 315 ! Bhosporus Strait 419 ij0 = 2 08 +isrow ; ij1 = 248 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp420 ij0 = 248 - isrow ; ij1 = 248 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp 420 421 421 422 IF(lwp) WRITE(numout,*) ' Makassar (Top) ' 422 423 ii0 = 48 ; ii1 = 48 ! Makassar Strait (Top) 423 ij0 = 1 49 +isrow ; ij1 = 190 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp424 ij0 = 189 - isrow ; ij1 = 190 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp 424 425 425 426 IF(lwp) WRITE(numout,*) ' Lombok ' 426 427 ii0 = 44 ; ii1 = 44 ! Lombok Strait 427 ij0 = 1 24 +isrow ; ij1 = 165 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp428 ij0 = 164 - isrow ; ij1 = 165 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp 428 429 429 430 IF(lwp) WRITE(numout,*) ' Ombai ' 430 431 ii0 = 53 ; ii1 = 53 ! Ombai Strait 431 ij0 = 1 24 +isrow ; ij1 = 165 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp432 ij0 = 164 - isrow ; ij1 = 165 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp 432 433 433 434 IF(lwp) WRITE(numout,*) ' Timor Passage ' 434 435 ii0 = 56 ; ii1 = 56 ! Timor Passage 435 ij0 = 1 24 +isrow ; ij1 = 165 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp436 ij0 = 164 - isrow ; ij1 = 165 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 2._wp 436 437 437 438 IF(lwp) WRITE(numout,*) ' West Halmahera ' 438 439 ii0 = 58 ; ii1 = 58 ! West Halmahera Strait 439 ij0 = 1 41 +isrow ; ij1 = 182 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp440 ij0 = 181 - isrow ; ij1 = 182 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp 440 441 441 442 IF(lwp) WRITE(numout,*) ' East Halmahera ' 442 443 ii0 = 55 ; ii1 = 55 ! East Halmahera Strait 443 ij0 = 1 41 +isrow ; ij1 = 182 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp444 ij0 = 181 - isrow ; ij1 = 182 - isrow ; fmask( mi0(ii0):mi1(ii1),mj0(ij0):mj1(ij1),1:jpk ) = 3._wp 444 445 ! 445 446 ENDIF 447 ! 448 IF( cp_cfg == "orca" .AND. jp_cfg == 025 .AND. rn_shlat == 0.0 ) THEN 449 ! ! ORCA_R025 configuration 450 ! ! Increased lateral friction on parts of Antarctic coastline 451 ! ! for increased stability 452 ! ! NB. This only works to do this here if we have free slip 453 ! ! generally, so fmask is zero at coast points. 454 IF(lwp) WRITE(numout,*) 455 IF(lwp) WRITE(numout,*) ' orca_r025: increase friction in following regions : ' 456 IF(lwp) WRITE(numout,*) ' whole Antarctic coastline: partial slip shlat=1 ' 457 458 zphi_drake_passage = -58.0_wp 459 zshlat_antarc = 1.0_wp 460 zwf(:,:) = fmask(:,:,1) 461 DO jj = 2, jpjm1 462 DO ji = fs_2, fs_jpim1 ! vector opt. 463 IF( gphif(ji,jj) .lt. zphi_drake_passage .and. fmask(ji,jj,1) == 0._wp ) THEN 464 fmask(ji,jj,:) = zshlat_antarc * MIN( 1._wp , MAX( zwf(ji+1,jj), zwf(ji,jj+1), & 465 & zwf(ji-1,jj), zwf(ji,jj-1) ) ) 466 ENDIF 467 END DO 468 END DO 469 END IF 446 470 ! 447 471 CALL lbc_lnk( fmask, 'F', 1._wp ) ! Lateral boundary conditions on fmask … … 526 550 IF(lwp) WRITE(numout,*) 'dom_msk_nsa : noslip accurate boundary condition' 527 551 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ using Schchepetkin and O Brian scheme' 528 IF( lk_mpp ) CALL ctl_stop( ' mpp version is not yet implemented' )552 IF( lk_mpp ) CALL ctl_stop('STOP', ' mpp version is not yet implemented' ) 529 553 530 554 ! mask for second order calculation of vorticity … … 548 572 WRITE(numout,*) ' symetric boundary conditions need special' 549 573 WRITE(numout,*) ' treatment not implemented. we stop.' 550 STOP574 CALL ctl_stop('STOP', 'NEMO abort from dom_msk_nsa') 551 575 ENDIF 552 576 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90
r7960 r9987 594 594 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~ - interpolate scale factors and compute depths for next time step' 595 595 ENDIF 596 596 597 ! 597 598 ! Time filter and swap of scale factors … … 665 666 ht(:,:) = ht(:,:) + fse3t_n(:,:,jk) * tmask(:,:,jk) 666 667 END DO 667 668 ! Write outputs669 ! =============670 CALL iom_put( "e3t" , fse3t_n (:,:,:) )671 CALL iom_put( "e3u" , fse3u_n (:,:,:) )672 CALL iom_put( "e3v" , fse3v_n (:,:,:) )673 CALL iom_put( "e3w" , fse3w_n (:,:,:) )674 CALL iom_put( "tpt_dep" , fsde3w_n (:,:,:) )675 IF( iom_use("e3tdef") ) &676 CALL iom_put( "e3tdef" , ( ( fse3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 )677 668 678 669 ! write restart file -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90
r7960 r9987 215 215 CALL iom_rstput( 0, 0, inum4, 'gdept_1d' , gdept_1d ) ! ! stretched system 216 216 CALL iom_rstput( 0, 0, inum4, 'gdepw_1d' , gdepw_1d ) 217 CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r4 ) 218 CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r4 ) 217 219 ENDIF 218 220 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90
r7960 r9987 219 219 & ppsur == pp_to_be_computed ) THEN 220 220 ! 221 #if defined key_agrif 222 za1 = ( ppdzmin - pphmax / FLOAT(jpkdta-1) ) & 223 & / ( TANH((1-ppkth)/ppacr) - ppacr/FLOAT(jpkdta-1) * ( LOG( COSH( (jpkdta - ppkth) / ppacr) )& 224 & - LOG( COSH( ( 1 - ppkth) / ppacr) ) ) ) 225 #else 221 226 za1 = ( ppdzmin - pphmax / FLOAT(jpkm1) ) & 222 227 & / ( TANH((1-ppkth)/ppacr) - ppacr/FLOAT(jpk-1) * ( LOG( COSH( (jpk - ppkth) / ppacr) ) & 223 228 & - LOG( COSH( ( 1 - ppkth) / ppacr) ) ) ) 229 #endif 224 230 za0 = ppdzmin - za1 * TANH( (1-ppkth) / ppacr ) 225 231 zsur = - za0 - za1 * ppacr * LOG( COSH( (1-ppkth) / ppacr ) ) … … 236 242 WRITE(numout,*) ' Uniform grid with ',jpk-1,' layers' 237 243 WRITE(numout,*) ' Total depth :', zhmax 244 #if defined key_agrif 245 WRITE(numout,*) ' Layer thickness:', zhmax/(jpkdta-1) 246 #else 238 247 WRITE(numout,*) ' Layer thickness:', zhmax/(jpk-1) 248 #endif 239 249 ELSE 240 250 IF( ppa1 == 0._wp .AND. ppa0 == 0._wp .AND. ppsur == 0._wp ) THEN … … 260 270 ! Reference z-coordinate (depth - scale factor at T- and W-points) 261 271 ! ====================== 262 IF( ppkth == 0._wp ) THEN ! uniform vertical grid 272 IF( ppkth == 0._wp ) THEN ! uniform vertical grid 273 #if defined key_agrif 274 za1 = zhmax / FLOAT(jpkdta-1) 275 #else 263 276 za1 = zhmax / FLOAT(jpk-1) 277 #endif 264 278 DO jk = 1, jpk 265 279 zw = FLOAT( jk ) … … 1870 1884 iim1 = MAX( ji-1, 1 ) 1871 1885 ijm1 = MAX( jj-1, 1 ) 1872 IF( (bathy(iip1,jj) + bathy(iim1,jj) + bathy(ji,ijp1) + bathy(ji,ijm1) + & 1873 & bathy(iip1,ijp1) + bathy(iim1,ijm1) + bathy(iip1,ijp1) + bathy(iim1,ijm1)) > 0._wp ) THEN 1874 zenv(ji,jj) = rn_sbot_min 1886 IF( ( + bathy(iim1,ijp1) + bathy(ji,ijp1) + bathy(iip1,ijp1) & 1887 & + bathy(iim1,jj ) + bathy(iip1,jj ) & 1888 & + bathy(iim1,ijm1) + bathy(ji,ijm1) + bathy(iip1,ijp1) ) > 0._wp ) THEN 1889 zenv(ji,jj) = rn_sbot_min 1875 1890 ENDIF 1876 1891 ENDIF -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DOM/phycst.F90
r7960 r9987 68 68 REAL(wp), PUBLIC :: rcdsn = 0.31_wp !: thermal conductivity of snow 69 69 REAL(wp), PUBLIC :: cpic = 2067.0_wp !: specific heat for ice 70 #if defined key_cice 71 REAL(wp), PUBLIC :: lsub = 2.835e+6_wp !: pure ice latent heat of sublimation [J/kg] 72 #else 70 73 REAL(wp), PUBLIC :: lsub = 2.834e+6_wp !: pure ice latent heat of sublimation [J/kg] 74 #endif 71 75 REAL(wp), PUBLIC :: lfus = 0.334e+6_wp !: latent heat of fusion of fresh ice [J/kg] 72 76 REAL(wp), PUBLIC :: tmut = 0.054_wp !: decrease of seawater meltpoint with salinity -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/divcur.F90
r7960 r9987 97 97 IF( nn_timing == 1 ) CALL timing_start('div_cur') 98 98 ! 99 CALL wrk_alloc( jpi , jpj+2, zwu 100 CALL wrk_alloc( jpi+ 4, jpj , zwv, kistart = -1)99 CALL wrk_alloc( jpi , jpj+2, zwu ) 100 CALL wrk_alloc( jpi+2, jpj , zwv ) 101 101 ! 102 102 IF( kt == nit000 ) THEN … … 236 236 CALL lbc_lnk( hdivn, 'T', 1. ) ; CALL lbc_lnk( rotn , 'F', 1. ) ! lateral boundary cond. (no sign change) 237 237 ! 238 CALL wrk_dealloc( jpi , jpj+2, zwu 239 CALL wrk_dealloc( jpi+ 4, jpj , zwv, kistart = -1)238 CALL wrk_dealloc( jpi , jpj+2, zwu ) 239 CALL wrk_dealloc( jpi+2, jpj , zwv ) 240 240 ! 241 241 IF( nn_timing == 1 ) CALL timing_stop('div_cur') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90
r7960 r9987 44 44 USE wrk_nemo ! Memory Allocation 45 45 USE timing ! Timing 46 USE biaspar ! bias correction variables 46 47 47 48 IMPLICIT NONE … … 84 85 INTEGER, INTENT(in) :: kt ! ocean time-step index 85 86 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdu, ztrdv 87 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: z_rhd_st ! tmp density storage for pressure corr 88 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z_gru_st ! tmp ua trends storage for pressure corr 89 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z_grv_st ! tmp va trends storage for pressure corr 86 90 !!---------------------------------------------------------------------- 87 91 ! … … 94 98 ENDIF 95 99 ! 100 IF ( ln_bias .AND. ln_bias_pc_app ) THEN 101 102 !Allocate space for tempory variables 103 ALLOCATE( z_rhd_st(jpi,jpj,jpk), & 104 & z_gru_st(jpi,jpj), & 105 & z_grv_st(jpi,jpj) ) 106 107 z_rhd_st(:,:,:) = rhd(:,:,:) ! store orig density 108 rhd(:,:,:) = rhd_pc(:,:,:) ! use pressure corrected density 109 z_gru_st(:,:) = gru(:,:) 110 gru(:,:) = gru_pc(:,:) 111 z_grv_st(:,:) = grv(:,:) 112 grv(:,:) = grv_pc(:,:) 113 114 ENDIF 115 96 116 SELECT CASE ( nhpg ) ! Hydrostatic pressure gradient computation 97 117 CASE ( 0 ) ; CALL hpg_zco ( kt ) ! z-coordinate … … 112 132 IF(ln_ctl) CALL prt_ctl( tab3d_1=ua, clinfo1=' hpg - Ua: ', mask1=umask, & 113 133 & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) 134 ! 135 IF ( ln_bias .AND. ln_bias_pc_app ) THEN 136 IF(lwp) THEN 137 WRITE(numout,*) " ! restore original density" 138 ENDIF 139 rhd(:,:,:) = z_rhd_st(:,:,:) ! restore original density 140 gru(:,:) = z_gru_st(:,:) 141 grv(:,:) = z_grv_st(:,:) 142 143 !Deallocate tempory variables 144 DEALLOCATE( z_rhd_st, & 145 & z_gru_st, & 146 & z_grv_st ) 147 ENDIF 114 148 ! 115 149 IF( nn_timing == 1 ) CALL timing_stop('dyn_hpg') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90
r7960 r9987 465 465 END DO 466 466 ELSE 467 IF(lwp)WRITE(numout,*) ' ldfguv: kahm= 1 or 2, here =', kahm 468 IF(lwp)WRITE(numout,*) ' We stop' 469 STOP 'ldfguv' 467 468 WRITE(numout,*) ' ldfguv: kahm= 1 or 2, here =', kahm 469 WRITE(numout,*) ' We stop' 470 CALL ctl_stop('STOP', 'ldfguv: Unexpected kahm value') 471 470 472 ENDIF 471 473 ! ! =============== -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90
r7960 r9987 266 266 ! Add volume filter correction: compatibility with tracer advection scheme 267 267 ! => time filter + conservation correction (only at the first level) 268 fse3t_b(:,:,1) = fse3t_b(:,:,1) - atfp * rdt * r1_rau0 * ( emp_b(:,:) - emp(:,:) & 269 & -rnf_b(:,:) + rnf(:,:) ) * tmask(:,:,1) 268 IF ( nn_isf == 0) THEN ! if no ice shelf melting 269 fse3t_b(:,:,1) = fse3t_b(:,:,1) - atfp * rdt * r1_rau0 * ( emp_b(:,:) - emp(:,:) & 270 & -rnf_b(:,:) + rnf(:,:) ) * tmask(:,:,1) 271 ELSE ! if ice shelf melting 272 DO jj = 1,jpj 273 DO ji = 1,jpi 274 jk = mikt(ji,jj) 275 fse3t_b(ji,jj,jk) = fse3t_b(ji,jj,jk) - atfp * rdt * r1_rau0 & 276 & * ( (emp_b(ji,jj) - emp(ji,jj) ) & 277 & - (rnf_b(ji,jj) - rnf(ji,jj) ) & 278 & + (fwfisf_b(ji,jj) - fwfisf(ji,jj)) ) * tmask(ji,jj,jk) 279 END DO 280 END DO 281 END IF 270 282 ENDIF 271 283 ! -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_flt.F90
r7960 r9987 166 166 ! 167 167 ENDIF 168 IF( l_trddyn ) THEN ! Put here so code doesn't crash when doing KE trend but needs to be done properly 169 CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv ) 170 ENDIF 168 171 ! 169 172 ELSE ! fixed volume (add the surface pressure gradient + unweighted time stepping) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90
r9188 r9987 187 187 ! 188 188 ! time offset in steps for bdy data update 189 IF (.NOT.ln_bt_fw) THEN ; noffset=- 2*nn_baro ; ELSE ; noffset = 0 ; ENDIF189 IF (.NOT.ln_bt_fw) THEN ; noffset=-nn_baro ; ELSE ; noffset = 0 ; ENDIF 190 190 ! 191 191 IF( kt == nit000 ) THEN !* initialisation … … 454 454 ! ! Surface net water flux and rivers 455 455 IF (ln_bt_fw) THEN 456 zssh_frc(:,:) = zraur * ( emp(:,:) - rnf(:,:) + rdivisf *fwfisf(:,:) )456 zssh_frc(:,:) = zraur * ( emp(:,:) - rnf(:,:) + fwfisf(:,:) ) 457 457 ELSE 458 458 zssh_frc(:,:) = zraur * z1_2 * ( emp(:,:) + emp_b(:,:) - rnf(:,:) - rnf_b(:,:) & 459 & + rdivisf * ( fwfisf(:,:) + fwfisf_b(:,:) ))459 & + fwfisf(:,:) + fwfisf_b(:,:) ) 460 460 ENDIF 461 461 #if defined key_asminc … … 523 523 ! Update only tidal forcing at open boundaries 524 524 #if defined key_tide 525 IF ( lk_bdy .AND. lk_tide ) 526 IF ( ln_tide_pot .AND. lk_tide ) CALL upd_tide( kt, kit=jn, koffset=noffset )525 IF ( lk_bdy .AND. lk_tide ) CALL bdy_dta_tides( kt, kit=jn, time_offset=(noffset+1) ) 526 IF ( ln_tide_pot .AND. lk_tide ) CALL upd_tide( kt, kit=jn, time_offset=noffset ) 527 527 #endif 528 528 ! … … 900 900 #if defined key_agrif 901 901 ! Save time integrated fluxes during child grid integration 902 ! (used to update coarse grid transports) 903 ! Useless with 2nd order momentum schemes 902 ! (used to update coarse grid transports at next time step) 904 903 ! 905 904 IF ( (.NOT.Agrif_Root()).AND.(ln_bt_fw) ) THEN -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90
r7960 r9987 38 38 USE wrk_nemo ! Memory Allocation 39 39 USE timing ! Timing 40 USE lib_fortran 40 41 41 42 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90
r7960 r9987 323 323 ze3va = ( 1._wp - r_vvl ) * fse3v_n(ji,jj,1) + r_vvl * fse3v_a(ji,jj,1) 324 324 va(ji,jj,1) = va(ji,jj,1) + p2dt * 0.5_wp * ( vtau_b(ji,jj) + vtau(ji,jj) ) & 325 & / ( ze3va * rau0 ) 325 & / ( ze3va * rau0 ) * vmask(ji,jj,1) 326 326 #else 327 327 va(ji,jj,1) = vb(ji,jj,1) & 328 328 & + p2dt *(va(ji,jj,1) + 0.5_wp * ( vtau_b(ji,jj) + vtau(ji,jj) ) & 329 & / ( fse3v(ji,jj,1) * rau0 ))329 & / ( fse3v(ji,jj,1) * rau0 ) * vmask(ji,jj,1) ) 330 330 #endif 331 331 END DO -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90
r7960 r9987 31 31 USE bdydyn2d ! bdy_ssh routine 32 32 #if defined key_agrif 33 USE agrif_opa_update34 33 USE agrif_opa_interp 35 34 #endif … … 75 74 INTEGER, INTENT(in) :: kt ! time step 76 75 ! 77 INTEGER :: jk ! dummy loop indice 76 INTEGER :: jk ! dummy loop indices 78 77 REAL(wp) :: z2dt, z1_rau0 ! local scalars 79 78 !!---------------------------------------------------------------------- … … 95 94 z2dt = 2._wp * rdt ! set time step size (Euler/Leapfrog) 96 95 IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt 96 97 98 #if defined key_asminc 99 ! ! Include the IAU weighted SSH increment 100 IF( lk_asminc .AND. ln_sshinc .AND. ln_asmiau ) THEN 101 CALL ssh_asm_inc( kt ) 102 #if defined key_vvl 103 ! Don't directly adjust ssh but change hdivn at all levels instead 104 ! In trasbc also add in the heat and salt content associated with these changes at each level 105 DO jk = 1, jpkm1 106 hdivn(:,:,jk) = hdivn(:,:,jk) - ( ssh_iau(:,:) / ( ht_0(:,:) + 1.0 - ssmask(:,:) ) ) * ( e3t_0(:,:,jk) / fse3t_n(:,:,jk) ) * tmask(:,:,jk) 107 END DO 108 ENDIF 109 #endif 110 #endif 111 97 112 98 113 ! !------------------------------! … … 124 139 #endif 125 140 126 #if defined key_asminc127 ! ! Include the IAU weighted SSH increment128 IF( lk_asminc .AND. ln_sshinc .AND. ln_asmiau ) THEN129 CALL ssh_asm_inc( kt )130 ssha(:,:) = ssha(:,:) + z2dt * ssh_iau(:,:)131 ENDIF132 #endif133 141 134 142 ! !------------------------------! … … 268 276 ELSE !** Leap-Frog time-stepping: Asselin filter + swap 269 277 sshb(:,:) = sshn(:,:) + atfp * ( sshb(:,:) - 2 * sshn(:,:) + ssha(:,:) ) ! before <-- now filtered 270 IF( lk_vvl ) sshb(:,:) = sshb(:,:) - atfp * rdt / rau0 * ( emp_b(:,:) - emp(:,:) - rnf_b(:,:) + rnf(:,:) ) * ssmask(:,:) 278 IF( lk_vvl ) sshb(:,:) = sshb(:,:) - atfp * rdt / rau0 * ( emp_b(:,:) - emp(:,:) & 279 & - rnf_b(:,:) + rnf(:,:) & 280 & + fwfisf_b(:,:) - fwfisf(:,:) ) * ssmask(:,:) 271 281 sshn(:,:) = ssha(:,:) ! now <-- after 272 282 ENDIF 273 !274 ! Update velocity at AGRIF zoom boundaries275 #if defined key_agrif276 IF ( .NOT.Agrif_Root() ) CALL Agrif_Update_Dyn( kt )277 #endif278 283 ! 279 284 IF(ln_ctl) CALL prt_ctl( tab2d_1=sshb, clinfo1=' sshb - : ', mask1=tmask, ovlap=1 ) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ICB/icbclv.F90
r7960 r9987 25 25 USE icbutl ! iceberg utility routines 26 26 27 USE sbc_oce ! for icesheet freshwater input variables 28 USE in_out_manager 29 USE iom 30 27 31 IMPLICIT NONE 28 32 PRIVATE … … 48 52 ! 49 53 REAL(wp) :: zcalving_used, zdist, zfact 54 REAL(wp) :: zgreenland_calving_sum, zantarctica_calving_sum 50 55 INTEGER :: jn, ji, jj ! loop counters 51 56 INTEGER :: imx ! temporary integer for max berg class … … 59 64 zfact = ( (1000._wp)**3 / ( NINT(rday) * nyear_len(1) ) ) * 850._wp 60 65 berg_grid%calving(:,:) = src_calving(:,:) * tmask_i(:,:) * zfact 66 67 IF( lk_oasis) THEN 68 ! nn_coupled_iceshelf_fluxes uninitialised unless lk_oasis=true 69 IF( nn_coupled_iceshelf_fluxes .gt. 0 ) THEN 70 71 ! Adjust total calving rates so that sum of iceberg calving and iceshelf melting in the northern 72 ! and southern hemispheres equals rate of increase of mass of greenland and antarctic ice sheets 73 ! to preserve total freshwater conservation in coupled models without an active ice sheet model. 74 75 zgreenland_calving_sum = SUM( berg_grid%calving(:,:) * greenland_icesheet_mask(:,:) ) 76 IF( lk_mpp ) CALL mpp_sum( zgreenland_calving_sum ) 77 WHERE( greenland_icesheet_mask(:,:) == 1.0 ) & 78 & berg_grid%calving(:,:) = berg_grid%calving(:,:) * greenland_icesheet_mass_rate_of_change * rn_greenland_calving_fraction & 79 & / ( zgreenland_calving_sum + 1.0e-10_wp ) 80 81 ! check 82 IF(lwp) WRITE(numout, *) 'Greenland iceberg calving climatology (kg/s) : ',zgreenland_calving_sum 83 zgreenland_calving_sum = SUM( berg_grid%calving(:,:) * greenland_icesheet_mask(:,:) ) 84 IF( lk_mpp ) CALL mpp_sum( zgreenland_calving_sum ) 85 IF(lwp) WRITE(numout, *) 'Greenland iceberg calving adjusted value (kg/s) : ',zgreenland_calving_sum 86 87 zantarctica_calving_sum = SUM( berg_grid%calving(:,:) * antarctica_icesheet_mask(:,:) ) 88 IF( lk_mpp ) CALL mpp_sum( zantarctica_calving_sum ) 89 WHERE( antarctica_icesheet_mask(:,:) == 1.0 ) & 90 berg_grid%calving(:,:) = berg_grid%calving(:,:) * antarctica_icesheet_mass_rate_of_change * rn_antarctica_calving_fraction & 91 & / ( zantarctica_calving_sum + 1.0e-10_wp ) 92 93 ! check 94 IF(lwp) WRITE(numout, *) 'Antarctica iceberg calving climatology (kg/s) : ',zantarctica_calving_sum 95 zantarctica_calving_sum = SUM( berg_grid%calving(:,:) * antarctica_icesheet_mask(:,:) ) 96 IF( lk_mpp ) CALL mpp_sum( zantarctica_calving_sum ) 97 IF(lwp) WRITE(numout, *) 'Antarctica iceberg calving adjusted value (kg/s) : ',zantarctica_calving_sum 98 99 ENDIF 100 ENDIF 101 102 CALL iom_put( 'berg_calve', berg_grid%calving(:,:) ) 61 103 62 104 ! Heat in units of W/m2, and mask (just in case) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ICB/icbdia.F90
r7960 r9987 371 371 IF( .NOT. ln_bergdia ) RETURN !!gm useless iom will control whether it is output or not 372 372 ! 373 CALL iom_put( "berg_total_melt" , berg_grid%floating_melt(:,:) ) ! Total melt flux to ocean [kg/m2/s] 374 CALL iom_put( "berg_total_heat_flux" , berg_grid%calving_hflx(:,:) ) ! Total iceberg-ocean heat flux [W/m2] 373 375 CALL iom_put( "berg_melt" , berg_melt (:,:) ) ! Melt rate of icebergs [kg/m2/s] 374 376 CALL iom_put( "berg_buoy_melt" , buoy_melt (:,:) ) ! Buoyancy component of iceberg melt rate [kg/m2/s] -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ICB/icbini.F90
r7960 r9987 120 120 ! first entry with narea for this processor is left hand interior index 121 121 ! last entry is right hand interior index 122 jj = jpj/2122 jj = nlcj/2 123 123 nicbdi = -1 124 124 nicbei = -1 … … 136 136 ! 137 137 ! repeat for j direction 138 ji = jpi/2138 ji = nlci/2 139 139 nicbdj = -1 140 140 nicbej = -1 … … 153 153 ! special for east-west boundary exchange we save the destination index 154 154 i1 = MAX( nicbdi-1, 1) 155 i3 = INT( src_calving(i1, jpj/2) )155 i3 = INT( src_calving(i1,nlcj/2) ) 156 156 jj = INT( i3/nicbpack ) 157 157 ricb_left = REAL( i3 - nicbpack*jj, wp ) 158 158 i1 = MIN( nicbei+1, jpi ) 159 i3 = INT( src_calving(i1, jpj/2) )159 i3 = INT( src_calving(i1,nlcj/2) ) 160 160 jj = INT( i3/nicbpack ) 161 161 ricb_right = REAL( i3 - nicbpack*jj, wp ) … … 196 196 WRITE(numicb,*) 'berg left ', ricb_left 197 197 WRITE(numicb,*) 'berg right ', ricb_right 198 jj = jpj/2198 jj = nlcj/2 199 199 WRITE(numicb,*) "central j line:" 200 200 WRITE(numicb,*) "i processor" … … 202 202 WRITE(numicb,*) "i point" 203 203 WRITE(numicb,*) (INT(src_calving(ji,jj)), ji=1,jpi) 204 ji = jpi/2204 ji = nlci/2 205 205 WRITE(numicb,*) "central i line:" 206 206 WRITE(numicb,*) "j processor" -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ICB/icbrst.F90
r7960 r9987 12 12 !! - ! Currently needs a fixed processor 13 13 !! - ! layout between restarts 14 !! - ! 2015-11 Dave Storkey Convert icb_rst_read to use IOM so can 15 !! read single restart files 14 16 !!---------------------------------------------------------------------- 15 17 !!---------------------------------------------------------------------- … … 18 20 !!---------------------------------------------------------------------- 19 21 USE par_oce ! NEMO parameters 22 USE phycst ! for rday 20 23 USE dom_oce ! NEMO domain 21 24 USE in_out_manager ! NEMO IO routines 25 USE ioipsl, ONLY : ju2ymds ! for calendar 22 26 USE lib_mpp ! NEMO MPI library, lk_mpp in particular 23 27 USE netcdf ! netcdf routines for IO 28 USE iom 24 29 USE icb_oce ! define iceberg arrays 25 30 USE icbutl ! iceberg utility routines … … 57 62 INTEGER :: idim, ivar, iatt 58 63 INTEGER :: jn, iunlim_dim, ibergs_in_file 59 INTEGER :: iclass 60 INTEGER, DIMENSION(1) :: istrt, ilngth, idata 61 INTEGER, DIMENSION(2) :: istrt2, ilngth2 62 INTEGER, DIMENSION(nkounts) :: idata2 63 REAL(wp), DIMENSION(1) :: zdata ! need 1d array to read in with 64 ! start and count arrays 64 INTEGER :: ii,ij,iclass 65 REAL(wp), DIMENSION(nkounts) :: zdata 65 66 LOGICAL :: ll_found_restart 66 67 CHARACTER(len=256) :: cl_path … … 71 72 !!---------------------------------------------------------------------- 72 73 73 ! Find a restart file. Assume iceberg restarts in same directory as ocean restarts. 74 ! Find a restart file. Assume iceberg restarts in same directory as ocean restarts 75 ! and are called TRIM(cn_ocerst)//'_icebergs' 74 76 cl_path = TRIM(cn_ocerst_indir) 75 77 IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 76 cl_filename = ' ' 77 IF ( lk_mpp ) THEN 78 cl_filename = ' ' 79 WRITE( cl_filename, '("restart_icebergs_",I4.4,".nc")' ) narea-1 80 INQUIRE( file=TRIM(cl_path)//TRIM(cl_filename), exist=ll_found_restart ) 81 ELSE 82 cl_filename = 'restart_icebergs.nc' 83 INQUIRE( file=TRIM(cl_path)//TRIM(cl_filename), exist=ll_found_restart ) 84 ENDIF 85 86 IF ( .NOT. ll_found_restart) THEN ! only do the following if a file was found 87 CALL ctl_stop('icebergs: no restart file found') 88 ENDIF 89 90 IF (nn_verbose_level >= 0 .AND. lwp) & 91 WRITE(numout,'(2a)') 'icebergs, read_restart_bergs: found restart file = ',TRIM(cl_path)//TRIM(cl_filename) 92 93 nret = NF90_OPEN(TRIM(cl_path)//TRIM(cl_filename), NF90_NOWRITE, ncid) 94 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart_bergs: nf_open failed') 95 96 nret = nf90_inquire(ncid, idim, ivar, iatt, iunlim_dim) 97 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart_bergs: nf_inquire failed') 98 99 IF( iunlim_dim .NE. -1) THEN 100 101 nret = nf90_inquire_dimension(ncid, iunlim_dim, cl_dname, ibergs_in_file) 102 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart_bergs: nf_inq_dimlen failed') 103 104 nret = NF90_INQ_VARID(ncid, 'number', numberid) 105 nret = NF90_INQ_VARID(ncid, 'mass_scaling', nscaling_id) 106 nret = NF90_INQ_VARID(ncid, 'xi', nxid) 107 nret = NF90_INQ_VARID(ncid, 'yj', nyid) 108 nret = NF90_INQ_VARID(ncid, 'lon', nlonid) 109 nret = NF90_INQ_VARID(ncid, 'lat', nlatid) 110 nret = NF90_INQ_VARID(ncid, 'uvel', nuvelid) 111 nret = NF90_INQ_VARID(ncid, 'vvel', nvvelid) 112 nret = NF90_INQ_VARID(ncid, 'mass', nmassid) 113 nret = NF90_INQ_VARID(ncid, 'thickness', nthicknessid) 114 nret = NF90_INQ_VARID(ncid, 'width', nwidthid) 115 nret = NF90_INQ_VARID(ncid, 'length', nlengthid) 116 nret = NF90_INQ_VARID(ncid, 'year', nyearid) 117 nret = NF90_INQ_VARID(ncid, 'day', ndayid) 118 nret = NF90_INQ_VARID(ncid, 'mass_of_bits', nmass_of_bits_id) 119 nret = NF90_INQ_VARID(ncid, 'heat_density', nheat_density_id) 120 121 ilngth(1) = 1 122 istrt2(1) = 1 123 ilngth2(1) = nkounts 124 ilngth2(2) = 1 125 DO jn=1, ibergs_in_file 126 127 istrt(1) = jn 128 istrt2(2) = jn 129 130 nret = NF90_GET_VAR(ncid, numberid, idata2, istrt2, ilngth2 ) 131 localberg%number(:) = idata2(:) 132 133 nret = NF90_GET_VAR(ncid, nscaling_id, zdata, istrt, ilngth ) 134 localberg%mass_scaling = zdata(1) 135 136 nret = NF90_GET_VAR(ncid, nlonid, zdata, istrt, ilngth) 137 localpt%lon = zdata(1) 138 nret = NF90_GET_VAR(ncid, nlatid, zdata, istrt, ilngth) 139 localpt%lat = zdata(1) 140 IF (nn_verbose_level >= 2 .AND. lwp) THEN 141 WRITE(numout,'(a,i5,a,2f10.4,a,i5)') 'icebergs, read_restart_bergs: berg ',jn,' is at ', & 142 localpt%lon,localpt%lat,' on PE ',narea-1 78 cl_filename = TRIM(cn_ocerst_in)//'_icebergs' 79 CALL iom_open( TRIM(cl_path)//cl_filename, ncid ) 80 81 IF( iom_file(ncid)%iduld .GE. 0) THEN 82 83 ibergs_in_file = iom_file(ncid)%lenuld 84 DO jn = 1,ibergs_in_file 85 86 ! iom_get treats the unlimited dimension as time. Here the unlimited dimension 87 ! is the iceberg index, but we can still use the ktime keyword to get the iceberg we want. 88 89 CALL iom_get( ncid, 'xi' ,localpt%xi , ktime=jn ) 90 CALL iom_get( ncid, 'yj' ,localpt%yj , ktime=jn ) 91 92 ii = INT( localpt%xi + 0.5 ) 93 ij = INT( localpt%yj + 0.5 ) 94 ! Only proceed if this iceberg is on the local processor (excluding halos). 95 IF ( ii .GE. nldi+nimpp-1 .AND. ii .LE. nlei+nimpp-1 .AND. & 96 & ij .GE. nldj+njmpp-1 .AND. ij .LE. nlej+njmpp-1 ) THEN 97 98 CALL iom_get( ncid, jpdom_unknown, 'number' , zdata(:) , ktime=jn, kstart=(/1/), kcount=(/nkounts/) ) 99 localberg%number(:) = INT(zdata(:)) 100 CALL iom_get( ncid, 'mass_scaling' , localberg%mass_scaling, ktime=jn ) 101 CALL iom_get( ncid, 'lon' , localpt%lon , ktime=jn ) 102 CALL iom_get( ncid, 'lat' , localpt%lat , ktime=jn ) 103 CALL iom_get( ncid, 'uvel' , localpt%uvel , ktime=jn ) 104 CALL iom_get( ncid, 'vvel' , localpt%vvel , ktime=jn ) 105 CALL iom_get( ncid, 'mass' , localpt%mass , ktime=jn ) 106 CALL iom_get( ncid, 'thickness' , localpt%thickness , ktime=jn ) 107 CALL iom_get( ncid, 'width' , localpt%width , ktime=jn ) 108 CALL iom_get( ncid, 'length' , localpt%length , ktime=jn ) 109 CALL iom_get( ncid, 'year' , zdata(1) , ktime=jn ) 110 localpt%year = INT(zdata(1)) 111 CALL iom_get( ncid, 'day' , localpt%day , ktime=jn ) 112 CALL iom_get( ncid, 'mass_of_bits' , localpt%mass_of_bits , ktime=jn ) 113 CALL iom_get( ncid, 'heat_density' , localpt%heat_density , ktime=jn ) 114 115 ! 116 CALL icb_utl_add( localberg, localpt ) 117 143 118 ENDIF 144 nret = NF90_GET_VAR(ncid, nxid, zdata, istrt, ilngth) 145 localpt%xi = zdata(1) 146 nret = NF90_GET_VAR(ncid, nyid, zdata, istrt, ilngth) 147 localpt%yj = zdata(1) 148 nret = NF90_GET_VAR(ncid, nuvelid, zdata, istrt, ilngth ) 149 localpt%uvel = zdata(1) 150 nret = NF90_GET_VAR(ncid, nvvelid, zdata, istrt, ilngth ) 151 localpt%vvel = zdata(1) 152 nret = NF90_GET_VAR(ncid, nmassid, zdata, istrt, ilngth ) 153 localpt%mass = zdata(1) 154 nret = NF90_GET_VAR(ncid, nthicknessid, zdata, istrt, ilngth ) 155 localpt%thickness = zdata(1) 156 nret = NF90_GET_VAR(ncid, nwidthid, zdata, istrt, ilngth ) 157 localpt%width = zdata(1) 158 nret = NF90_GET_VAR(ncid, nlengthid, zdata, istrt, ilngth ) 159 localpt%length = zdata(1) 160 nret = NF90_GET_VAR(ncid, nyearid, idata, istrt, ilngth ) 161 localpt%year = idata(1) 162 nret = NF90_GET_VAR(ncid, ndayid, zdata, istrt, ilngth ) 163 localpt%day = zdata(1) 164 nret = NF90_GET_VAR(ncid, nmass_of_bits_id, zdata, istrt, ilngth ) 165 localpt%mass_of_bits = zdata(1) 166 nret = NF90_GET_VAR(ncid, nheat_density_id, zdata, istrt, ilngth ) 167 localpt%heat_density = zdata(1) 168 ! 169 CALL icb_utl_add( localberg, localpt ) 119 170 120 END DO 171 ! 172 ENDIF 173 174 nret = NF90_INQ_DIMID( ncid, 'c', nc_dim ) 175 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart: nf_inq_dimid c failed') 176 177 nret = NF90_INQUIRE_DIMENSION( ncid, nc_dim, cl_dname, iclass ) 178 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart: nf_inquire_dimension failed') 179 180 nret = NF90_INQ_VARID(ncid, 'kount' , nkountid) 181 nret = NF90_INQ_VARID(ncid, 'calving' , ncalvid) 182 nret = NF90_INQ_VARID(ncid, 'calving_hflx', ncalvhid) 183 nret = NF90_INQ_VARID(ncid, 'stored_ice' , nsiceid) 184 nret = NF90_INQ_VARID(ncid, 'stored_heat' , nsheatid) 185 186 nstrt3(1) = 1 187 nstrt3(2) = 1 188 nlngth3(1) = jpi 189 nlngth3(2) = jpj 190 nlngth3(3) = 1 191 192 DO jn = 1, iclass 193 nstrt3(3) = jn 194 nret = NF90_GET_VAR( ncid, nsiceid , griddata, nstrt3, nlngth3 ) 195 berg_grid%stored_ice(:,:,jn) = griddata(:,:,1) 196 END DO 197 198 nret = NF90_GET_VAR( ncid, ncalvid , src_calving (:,:) ) 199 nret = NF90_GET_VAR( ncid, ncalvhid, src_calving_hflx (:,:) ) 200 nret = NF90_GET_VAR( ncid, nsheatid, berg_grid%stored_heat(:,:) ) 201 nret = NF90_GET_VAR( ncid, nkountid, idata2(:) ) 202 num_bergs(:) = idata2(:) 203 204 ! Finish up 205 nret = NF90_CLOSE(ncid) 206 IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart: nf_close failed') 121 122 ENDIF 123 124 ! Gridded variables 125 CALL iom_get( ncid, jpdom_autoglo, 'calving' , src_calving ) 126 CALL iom_get( ncid, jpdom_autoglo, 'calving_hflx', src_calving_hflx ) 127 CALL iom_get( ncid, jpdom_autoglo, 'stored_heat' , berg_grid%stored_heat ) 128 CALL iom_get( ncid, jpdom_autoglo_xy, 'stored_ice' , berg_grid%stored_ice, kstart=(/1,1,1/), kcount=(/1,1,nclasses/) ) 129 130 CALL iom_get( ncid, jpdom_unknown, 'kount' , zdata(:) ) 131 num_bergs(:) = INT(zdata(:)) 207 132 208 133 ! Sanity check … … 211 136 WRITE(numout,'(2(a,i5))') 'icebergs, read_restart_bergs: # bergs =',jn,' on PE',narea-1 212 137 IF( lk_mpp ) THEN 213 CALL mpp_sum(ibergs_in_file) 138 ! Only mpp_sum ibergs_in_file if we are reading from multiple restart files. 139 IF( INDEX(iom_file(ncid)%name,'icebergs.nc' ) .EQ. 0 ) CALL mpp_sum(ibergs_in_file) 214 140 CALL mpp_sum(jn) 215 141 ENDIF … … 217 143 & ' bergs in the restart file and', jn,' bergs have been read' 218 144 ! 145 ! Finish up 146 CALL iom_close( ncid ) 147 ! 219 148 IF( lwp .and. nn_verbose_level >= 0) WRITE(numout,'(a)') 'icebergs, read_restart_bergs: completed' 220 149 ! … … 231 160 INTEGER :: jn ! dummy loop index 232 161 INTEGER :: ix_dim, iy_dim, ik_dim, in_dim 233 CHARACTER(len=256) :: cl_path 234 CHARACTER(len=256) :: cl_filename 162 INTEGER :: iyear, imonth, iday 163 REAL (wp) :: zsec 164 REAL (wp) :: zfjulday 165 CHARACTER(len=256) :: cl_path 166 CHARACTER(len=256) :: cl_filename 167 CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character 235 168 TYPE(iceberg), POINTER :: this 236 169 TYPE(point) , POINTER :: pt … … 240 173 cl_path = TRIM(cn_ocerst_outdir) 241 174 IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 175 IF ( ln_rstdate ) THEN 176 zfjulday = fjulday + rdttra(1) / rday 177 IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday ) zfjulday = REAL(NINT(zfjulday),wp) ! avoid truncation error 178 CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec ) 179 WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 180 ELSE 181 IF( kt > 999999999 ) THEN ; WRITE(clkt, * ) kt 182 ELSE ; WRITE(clkt, '(i8.8)') kt 183 ENDIF 184 ENDIF 242 185 IF( lk_mpp ) THEN 243 WRITE(cl_filename,'(A,"_icebergs_", I8.8,"_restart_",I4.4,".nc")') TRIM(cexper), kt, narea-1186 WRITE(cl_filename,'(A,"_icebergs_",A,"_restart_",I4.4,".nc")') TRIM(cexper), TRIM(ADJUSTL(clkt)), narea-1 244 187 ELSE 245 WRITE(cl_filename,'(A,"_icebergs_", I8.8,"_restart.nc")') TRIM(cexper), kt188 WRITE(cl_filename,'(A,"_icebergs_",A,"_restart.nc")') TRIM(cexper), TRIM(ADJUSTL(clkt)) 246 189 ENDIF 247 190 IF (nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ',TRIM(cl_path)//TRIM(cl_filename) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ICB/icbthm.F90
r7960 r9987 18 18 USE dom_oce ! NEMO domain 19 19 USE in_out_manager ! NEMO IO routines, numout in particular 20 USE iom 20 21 USE lib_mpp ! NEMO MPI routines, ctl_stop in particular 21 22 USE phycst ! NEMO physical constants … … 160 161 zmelt = ( zdM - ( zdMbitsE - zdMbitsM ) ) * z1_dt ! kg/s 161 162 berg_grid%floating_melt(ii,ij) = berg_grid%floating_melt(ii,ij) + zmelt * z1_e1e2 ! kg/m2/s 162 zheat = zmelt * pt%heat_density ! kg/s x J/kg = J/s 163 ! zheat = zmelt * pt%heat_density ! kg/s x J/kg = J/s 164 zheat = zmelt * lfus !rma kg/s x J/kg (latent heat of fusion) = J/s 163 165 berg_grid%calving_hflx (ii,ij) = berg_grid%calving_hflx (ii,ij) + zheat * z1_e1e2 ! W/m2 164 166 CALL icb_dia_melt( ii, ij, zMnew, zheat, this%mass_scaling, & … … 208 210 IF(.NOT. ln_passive_mode ) THEN 209 211 emp (:,:) = emp (:,:) - berg_grid%floating_melt(:,:) 210 !! qns (:,:) = qns (:,:) + berg_grid%calving_hflx (:,:) !!gm heat flux not yet properly coded ==>> need it, SOLVE that! 212 qns (:,:) = qns (:,:) - berg_grid%calving_hflx (:,:) 211 213 ENDIF 212 214 ! -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ICB/icbtrj.F90
r7960 r9987 18 18 USE lib_mpp ! NEMO MPI library, lk_mpp in particular 19 19 USE in_out_manager ! NEMO IO, numout in particular 20 USE ioipsl, ONLY : ju2ymds ! for calendar 20 21 USE netcdf 21 22 ! … … 60 61 ! 61 62 INTEGER :: iret 63 INTEGER :: iyear, imonth, iday 64 REAL(wp) :: zfjulday, zsec 62 65 CHARACTER(len=80) :: cl_filename 63 66 TYPE(iceberg), POINTER :: this 64 67 TYPE(point) , POINTER :: pt 65 !!---------------------------------------------------------------------- 66 67 IF( lk_mpp ) THEN ; WRITE(cl_filename,'("trajectory_icebergs_",I6.6,"_",I4.4,".nc")') ktend, narea-1 68 ELSE ; WRITE(cl_filename,'("trajectory_icebergs_",I6.6 ,".nc")') ktend 68 CHARACTER(LEN=20) :: cldate_ini, cldate_end 69 !!---------------------------------------------------------------------- 70 71 ! compute initial time step date 72 CALL ju2ymds( fjulday, iyear, imonth, iday, zsec ) 73 WRITE(cldate_ini, '(i4.4,2i2.2)') iyear, imonth, iday 74 75 ! compute end time step date 76 zfjulday = fjulday + rdttra(1) / rday * REAL( nitend - nit000 + 1 , wp) 77 IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday ) zfjulday = REAL(NINT(zfjulday),wp) ! avoid truncation error 78 CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec ) 79 WRITE(cldate_end, '(i4.4,2i2.2)') iyear, imonth, iday 80 81 ! define trajectory output name 82 IF( lk_mpp ) THEN ; WRITE(cl_filename,'("trajectory_icebergs_",A,"-",A,"_",I4.4,".nc")') TRIM(ADJUSTL(cldate_ini)), TRIM(ADJUSTL(cldate_end)), narea-1 83 ELSE ; WRITE(cl_filename,'("trajectory_icebergs_",A,"-",A ,".nc")') TRIM(ADJUSTL(cldate_ini)), TRIM(ADJUSTL(cldate_end)) 69 84 ENDIF 70 85 IF ( lwp .AND. nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, icb_trj_init: creating ',TRIM(cl_filename) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90
r7960 r9987 30 30 CHARACTER(lc) :: cn_ocerst_outdir !: restart output directory 31 31 LOGICAL :: ln_rstart !: start from (F) rest or (T) a restart file 32 LOGICAL :: ln_rstdate !: datestamping of restarts 32 33 LOGICAL :: ln_rst_list !: output restarts at list of times (T) or by frequency (F) 33 34 INTEGER :: nn_no !: job number -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
r7960 r9987 94 94 CHARACTER(len=*), INTENT(in) :: cdname 95 95 #if defined key_iomput 96 TYPE(xios_time) :: dtime = xios_time(0, 0, 0, 0, 0, 0) 97 CHARACTER(len=19) :: cldate 98 CHARACTER(len=10) :: clname 99 INTEGER :: ji 96 #if ! defined key_xios2 97 TYPE(xios_time) :: dtime = xios_time(0, 0, 0, 0, 0, 0) 98 CHARACTER(len=19) :: cldate 99 #else 100 TYPE(xios_duration) :: dtime = xios_duration(0, 0, 0, 0, 0, 0) 101 TYPE(xios_date) :: start_date 102 #endif 103 CHARACTER(len=10) :: clname 104 INTEGER :: ji 100 105 ! 101 106 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z_bnds 102 107 !!---------------------------------------------------------------------- 103 108 #if ! defined key_xios2 104 109 ALLOCATE( z_bnds(jpk,2) ) 110 #else 111 ALLOCATE( z_bnds(2,jpk) ) 112 #endif 105 113 106 114 clname = cdname … … 110 118 111 119 ! calendar parameters 120 #if ! defined key_xios2 112 121 SELECT CASE ( nleapy ) ! Choose calendar for IOIPSL 113 122 CASE ( 1) ; CALL xios_set_context_attr(TRIM(clname), calendar_type= "Gregorian") … … 117 126 WRITE(cldate,"(i4.4,'-',i2.2,'-',i2.2,' 00:00:00')") nyear,nmonth,nday 118 127 CALL xios_set_context_attr(TRIM(clname), start_date=cldate ) 119 128 #else 129 ! Calendar type is now defined in xml file 130 SELECT CASE ( nleapy ) ! Choose calendar for IOIPSL 131 CASE ( 1) ; CALL xios_define_calendar( TYPE = "Gregorian", time_origin = xios_date(1900,01,01,00,00,00), & 132 & start_date = xios_date(nyear,nmonth,nday,0,0,0) ) 133 CASE ( 0) ; CALL xios_define_calendar( TYPE = "NoLeap" , time_origin = xios_date(1900,01,01,00,00,00), & 134 & start_date = xios_date(nyear,nmonth,nday,0,0,0) ) 135 CASE (30) ; CALL xios_define_calendar( TYPE = "D360" , time_origin = xios_date(1900,01,01,00,00,00), & 136 & start_date = xios_date(nyear,nmonth,nday,0,0,0) ) 137 END SELECT 138 #endif 120 139 ! horizontal grid definition 140 121 141 CALL set_scalar 122 142 … … 170 190 171 191 ! Add vertical grid bounds 192 #if ! defined key_xios2 172 193 z_bnds(: ,1) = gdepw_1d(:) 173 194 z_bnds(1:jpkm1,2) = gdepw_1d(2:jpk) 174 195 z_bnds(jpk: ,2) = gdepw_1d(jpk) + e3t_1d(jpk) 196 #else 197 z_bnds(1 ,:) = gdepw_1d(:) 198 z_bnds(2,1:jpkm1) = gdepw_1d(2:jpk) 199 z_bnds(2,jpk: ) = gdepw_1d(jpk) + e3t_1d(jpk) 200 #endif 201 175 202 CALL iom_set_axis_attr( "deptht", bounds=z_bnds ) 176 203 CALL iom_set_axis_attr( "depthu", bounds=z_bnds ) 177 204 CALL iom_set_axis_attr( "depthv", bounds=z_bnds ) 178 z_bnds(: ,2) = gdept_1d(:) 179 z_bnds(2:jpk,1) = gdept_1d(1:jpkm1) 180 z_bnds(1 ,1) = gdept_1d(1) - e3w_1d(1) 205 206 #if ! defined key_xios2 207 z_bnds(: ,2) = gdept_1d(:) 208 z_bnds(2:jpk,1) = gdept_1d(1:jpkm1) 209 z_bnds(1 ,1) = gdept_1d(1) - e3w_1d(1) 210 #else 211 z_bnds(2,: ) = gdept_1d(:) 212 z_bnds(1,2:jpk) = gdept_1d(1:jpkm1) 213 z_bnds(1,1 ) = gdept_1d(1) - e3w_1d(1) 214 #endif 181 215 CALL iom_set_axis_attr( "depthw", bounds=z_bnds ) 216 182 217 183 218 # if defined key_floats … … 193 228 ! automatic definitions of some of the xml attributs 194 229 CALL set_xmlatt 230 231 CALL set_1point 195 232 196 233 ! end file definition … … 673 710 CHARACTER(LEN=256) :: clname ! file name 674 711 CHARACTER(LEN=1) :: clrankpv, cldmspc ! 712 LOGICAL :: ll_depth_spec ! T => if kstart, kcount present then *only* use values for 3rd spatial dimension. 675 713 !--------------------------------------------------------------------- 676 714 ! … … 685 723 IF( PRESENT(kcount) .AND. (.NOT. PRESENT(kstart)) ) CALL ctl_stop(trim(clinfo), 'kcount present needs kstart present') 686 724 IF( PRESENT(kstart) .AND. (.NOT. PRESENT(kcount)) ) CALL ctl_stop(trim(clinfo), 'kstart present needs kcount present') 687 IF( PRESENT(kstart) .AND. idom /= jpdom_unknown ) CALL ctl_stop(trim(clinfo), 'kstart present needs kdom = jpdom_unknown') 725 IF( PRESENT(kstart) .AND. idom /= jpdom_unknown .AND. idom /= jpdom_autoglo_xy ) & 726 & CALL ctl_stop(trim(clinfo), 'kstart present needs kdom = jpdom_unknown or kdom = jpdom_autoglo_xy') 688 727 689 728 luse_jattr = .false. … … 718 757 ! update idom definition... 719 758 ! Identify the domain in case of jpdom_auto(glo/dta) definition 759 IF( idom == jpdom_autoglo_xy ) THEN 760 ll_depth_spec = .TRUE. 761 idom = jpdom_autoglo 762 ELSE 763 ll_depth_spec = .FALSE. 764 ENDIF 720 765 IF( idom == jpdom_autoglo .OR. idom == jpdom_autodta ) THEN 721 766 IF( idom == jpdom_autoglo ) THEN ; idom = jpdom_global … … 771 816 istart(idmspc+1) = itime 772 817 773 IF( PRESENT(kstart)) THEN ; istart(1:idmspc) = kstart(1:idmspc) ; icnt(1:idmspc) = kcount(1:idmspc)818 IF( PRESENT(kstart) .AND. .NOT. ll_depth_spec ) THEN ; istart(1:idmspc) = kstart(1:idmspc) ; icnt(1:idmspc) = kcount(1:idmspc) 774 819 ELSE 775 IF( idom == jpdom_unknown ) THEN ; icnt(1:idmspc) = idimsz(1:idmspc)820 IF( idom == jpdom_unknown ) THEN ; icnt(1:idmspc) = idimsz(1:idmspc) 776 821 ELSE 777 822 IF( .NOT. PRESENT(pv_r1d) ) THEN ! not a 1D array … … 796 841 ENDIF 797 842 IF( PRESENT(pv_r3d) ) THEN 798 IF( idom == jpdom_data ) THEN ; icnt(3) = jpkdta 799 ELSE ; icnt(3) = jpk 843 IF( idom == jpdom_data ) THEN ; icnt(3) = jpkdta 844 ELSE IF( ll_depth_spec .AND. PRESENT(kstart) ) THEN ; istart(3) = kstart(3); icnt(3) = kcount(3) 845 ELSE ; icnt(3) = jpk 800 846 ENDIF 801 847 ENDIF … … 988 1034 !!---------------------------------------------------------------------- 989 1035 SUBROUTINE iom_g0d_intatt( kiomid, cdatt, pvar ) 990 INTEGER , INTENT(in ) :: kiomid ! 1036 INTEGER , INTENT(in ) :: kiomid !Identifier of the file 991 1037 CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute 992 1038 INTEGER , INTENT( out) :: pvar ! read field … … 1104 1150 CHARACTER(LEN=*), INTENT(in) :: cdname 1105 1151 REAL(wp) , INTENT(in) :: pfield0d 1152 #if ! defined key_xios2 1106 1153 REAL(wp) , DIMENSION(jpi,jpj) :: zz ! masson 1154 #endif 1107 1155 #if defined key_iomput 1156 #if ! defined key_xios2 1108 1157 zz(:,:)=pfield0d 1109 1158 CALL xios_send_field(cdname, zz) 1110 !CALL xios_send_field(cdname, (/pfield0d/)) 1159 #else 1160 CALL xios_send_field(cdname, (/pfield0d/)) 1161 #endif 1111 1162 #else 1112 1163 IF( .FALSE. ) WRITE(numout,*) cdname, pfield0d ! useless test to avoid compilation warnings … … 1156 1207 REAL(wp), DIMENSION(:) , OPTIONAL, INTENT(in) :: lonvalue, latvalue 1157 1208 REAL(wp), DIMENSION(:,:) , OPTIONAL, INTENT(in) :: bounds_lon, bounds_lat, area 1158 LOGICAL, DIMENSION(:,:) , OPTIONAL, INTENT(in) :: mask 1159 1209 #if ! defined key_xios2 1210 LOGICAL, DIMENSION(:,:) , OPTIONAL, INTENT(in) :: mask 1211 #else 1212 LOGICAL, DIMENSION(:) , OPTIONAL, INTENT(in) :: mask 1213 #endif 1214 1215 #if ! defined key_xios2 1160 1216 IF ( xios_is_valid_domain (cdid) ) THEN 1161 1217 CALL xios_set_domain_attr ( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj, & … … 1164 1220 & lonvalue=lonvalue, latvalue=latvalue, mask=mask, nvertex=nvertex, bounds_lon=bounds_lon, & 1165 1221 & bounds_lat=bounds_lat, area=area ) 1166 ENDIF 1167 1222 ENDIF 1168 1223 IF ( xios_is_valid_domaingroup(cdid) ) THEN 1169 1224 CALL xios_set_domaingroup_attr( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj, & … … 1173 1228 & bounds_lat=bounds_lat, area=area ) 1174 1229 ENDIF 1230 1231 #else 1232 IF ( xios_is_valid_domain (cdid) ) THEN 1233 CALL xios_set_domain_attr ( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj, & 1234 & data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj , & 1235 & lonvalue_1D=lonvalue, latvalue_1D=latvalue, mask_1D=mask, nvertex=nvertex, bounds_lon_1D=bounds_lon, & 1236 & bounds_lat_1D=bounds_lat, area=area, type='curvilinear') 1237 ENDIF 1238 IF ( xios_is_valid_domaingroup(cdid) ) THEN 1239 CALL xios_set_domaingroup_attr( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj, & 1240 & data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj , & 1241 & lonvalue_1D=lonvalue, latvalue_1D=latvalue, mask_1D=mask, nvertex=nvertex, bounds_lon_1D=bounds_lon, & 1242 & bounds_lat_1D=bounds_lat, area=area, type='curvilinear' ) 1243 ENDIF 1244 #endif 1175 1245 CALL xios_solve_inheritance() 1176 1246 1177 1247 END SUBROUTINE iom_set_domain_attr 1248 1249 #if defined key_xios2 1250 SUBROUTINE iom_set_zoom_domain_attr( cdid, ibegin, jbegin, ni, nj) 1251 CHARACTER(LEN=*) , INTENT(in) :: cdid 1252 INTEGER , OPTIONAL, INTENT(in) :: ibegin, jbegin, ni, nj 1253 1254 IF ( xios_is_valid_zoom_domain (cdid) ) THEN 1255 CALL xios_set_zoom_domain_attr ( cdid, ibegin=ibegin, jbegin=jbegin, ni=ni, & 1256 & nj=nj) 1257 ENDIF 1258 END SUBROUTINE iom_set_zoom_domain_attr 1259 #endif 1178 1260 1179 1261 … … 1183 1265 REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(in) :: bounds 1184 1266 IF ( PRESENT(paxis) ) THEN 1267 #if ! defined key_xios2 1185 1268 IF ( xios_is_valid_axis (cdid) ) CALL xios_set_axis_attr ( cdid, size=SIZE(paxis), value=paxis ) 1186 1269 IF ( xios_is_valid_axisgroup(cdid) ) CALL xios_set_axisgroup_attr( cdid, size=SIZE(paxis), value=paxis ) 1270 #else 1271 IF ( xios_is_valid_axis (cdid) ) CALL xios_set_axis_attr ( cdid, n_glo=SIZE(paxis), value=paxis ) 1272 IF ( xios_is_valid_axisgroup(cdid) ) CALL xios_set_axisgroup_attr( cdid, n_glo=SIZE(paxis), value=paxis ) 1273 #endif 1187 1274 ENDIF 1188 1275 IF ( xios_is_valid_axis (cdid) ) CALL xios_set_axis_attr ( cdid, bounds=bounds ) … … 1191 1278 END SUBROUTINE iom_set_axis_attr 1192 1279 1193 1194 1280 SUBROUTINE iom_set_field_attr( cdid, freq_op, freq_offset ) 1195 1281 CHARACTER(LEN=*) , INTENT(in) :: cdid 1196 CHARACTER(LEN=*),OPTIONAL , INTENT(in) :: freq_op 1197 CHARACTER(LEN=*),OPTIONAL , INTENT(in) :: freq_offset 1198 IF ( xios_is_valid_field (cdid) ) CALL xios_set_field_attr ( cdid, freq_op=freq_op, freq_offset=freq_offset ) 1199 IF ( xios_is_valid_fieldgroup(cdid) ) CALL xios_set_fieldgroup_attr( cdid, freq_op=freq_op, freq_offset=freq_offset ) 1282 #if ! defined key_xios2 1283 CHARACTER(LEN=*) ,OPTIONAL , INTENT(in) :: freq_op 1284 CHARACTER(LEN=*) ,OPTIONAL , INTENT(in) :: freq_offset 1285 #else 1286 TYPE(xios_duration),OPTIONAL , INTENT(in) :: freq_op 1287 TYPE(xios_duration),OPTIONAL , INTENT(in) :: freq_offset 1288 #endif 1289 IF ( xios_is_valid_field (cdid) ) CALL xios_set_field_attr & 1290 & ( cdid, freq_op=freq_op, freq_offset=freq_offset ) 1291 IF ( xios_is_valid_fieldgroup(cdid) ) CALL xios_set_fieldgroup_attr & 1292 & ( cdid, freq_op=freq_op, freq_offset=freq_offset ) 1200 1293 CALL xios_solve_inheritance() 1201 1294 END SUBROUTINE iom_set_field_attr 1202 1203 1295 1204 1296 SUBROUTINE iom_set_file_attr( cdid, name, name_suffix ) … … 1213 1305 SUBROUTINE iom_get_file_attr( cdid, name, name_suffix, output_freq ) 1214 1306 CHARACTER(LEN=*) , INTENT(in ) :: cdid 1215 CHARACTER(LEN=*),OPTIONAL , INTENT(out) :: name, name_suffix, output_freq 1307 CHARACTER(LEN=*),OPTIONAL , INTENT(out) :: name, name_suffix 1308 #if ! defined key_xios2 1309 CHARACTER(LEN=*),OPTIONAL , INTENT(out) :: output_freq 1310 #else 1311 TYPE(xios_duration) ,OPTIONAL , INTENT(out) :: output_freq 1312 #endif 1216 1313 LOGICAL :: llexist1,llexist2,llexist3 1217 1314 !--------------------------------------------------------------------- 1218 1315 IF( PRESENT( name ) ) name = '' ! default values 1219 1316 IF( PRESENT( name_suffix ) ) name_suffix = '' 1317 #if ! defined key_xios2 1220 1318 IF( PRESENT( output_freq ) ) output_freq = '' 1319 #else 1320 IF( PRESENT( output_freq ) ) output_freq = xios_duration(0,0,0,0,0,0) 1321 #endif 1221 1322 IF ( xios_is_valid_file (cdid) ) THEN 1222 1323 CALL xios_solve_inheritance() … … 1239 1340 CHARACTER(LEN=*) , INTENT(in) :: cdid 1240 1341 LOGICAL, DIMENSION(:,:,:), OPTIONAL, INTENT(in) :: mask 1342 #if ! defined key_xios2 1241 1343 IF ( xios_is_valid_grid (cdid) ) CALL xios_set_grid_attr ( cdid, mask=mask ) 1242 1344 IF ( xios_is_valid_gridgroup(cdid) ) CALL xios_set_gridgroup_attr( cdid, mask=mask ) 1345 #else 1346 IF ( xios_is_valid_grid (cdid) ) CALL xios_set_grid_attr ( cdid, mask_3D=mask ) 1347 IF ( xios_is_valid_gridgroup(cdid) ) CALL xios_set_gridgroup_attr( cdid, mask_3D=mask ) 1348 #endif 1243 1349 CALL xios_solve_inheritance() 1244 1350 END SUBROUTINE iom_set_grid_attr … … 1282 1388 ni=nlei-nldi+1 ; nj=nlej-nldj+1 1283 1389 1284 CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-1, jbegin=njmpp+nldj-1, ni=ni, nj=nj) 1390 #if ! defined key_xios2 1391 CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-1, jbegin=njmpp+nldj-1, ni=ni, nj=nj) 1392 #else 1393 CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-2, jbegin=njmpp+nldj-2, ni=ni, nj=nj) 1394 #endif 1285 1395 CALL iom_set_domain_attr("grid_"//cdgrd, data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj) 1286 1396 CALL iom_set_domain_attr("grid_"//cdgrd, lonvalue = RESHAPE(plon(nldi:nlei, nldj:nlej),(/ ni*nj /)), & … … 1296 1406 END SELECT 1297 1407 ! 1408 #if ! defined key_xios2 1298 1409 CALL iom_set_domain_attr( "grid_"//cdgrd , mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,1),(/ni,nj /)) /= 0. ) 1410 #else 1411 CALL iom_set_domain_attr( "grid_"//cdgrd , mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,1),(/ni*nj /)) /= 0. ) 1412 #endif 1299 1413 CALL iom_set_grid_attr ( "grid_"//cdgrd//"_3D", mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,:),(/ni,nj,jpk/)) /= 0. ) 1300 1414 ENDIF … … 1430 1544 ALLOCATE( zlon(ni*nj) ) ; zlon(:) = 0. 1431 1545 1546 CALL dom_ngb( -168.7, 65.6, ix, iy, 'T' ) ! i-line that passes across Bering strait to avoid land processor (used in plots) 1547 #if ! defined key_xios2 1432 1548 CALL iom_set_domain_attr("gznl", ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-1, jbegin=njmpp+nldj-1, ni=ni, nj=nj) 1433 1549 CALL iom_set_domain_attr("gznl", data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj) … … 1435 1551 & latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /))) 1436 1552 ! 1437 CALL dom_ngb( 180., 90., ix, iy, 'T' ) ! i-line that passes near the North Pole : Reference latitude (used in plots)1438 1553 CALL iom_set_domain_attr ('ptr', zoom_ibegin=ix, zoom_nj=jpjglo) 1554 #else 1555 ! Pas teste : attention aux indices ! 1556 CALL iom_set_domain_attr("gznl", ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-2, jbegin=njmpp+nldj-2, ni=ni, nj=nj) 1557 CALL iom_set_domain_attr("gznl", data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj) 1558 CALL iom_set_domain_attr("gznl", lonvalue = zlon, & 1559 & latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /))) 1560 CALL iom_set_zoom_domain_attr ("ptr", ibegin=ix-1, jbegin=0, ni=1, nj=jpjglo) 1561 #endif 1562 1439 1563 CALL iom_update_file_name('ptr') 1440 1564 ! … … 1450 1574 REAL(wp), DIMENSION(1) :: zz = 1. 1451 1575 !!---------------------------------------------------------------------- 1576 #if ! defined key_xios2 1452 1577 CALL iom_set_domain_attr('scalarpoint', ni_glo=jpnij, nj_glo=1, ibegin=narea, jbegin=1, ni=1, nj=1) 1578 #else 1579 CALL iom_set_domain_attr('scalarpoint', ni_glo=jpnij, nj_glo=1, ibegin=narea-1, jbegin=0, ni=1, nj=1) 1580 #endif 1453 1581 CALL iom_set_domain_attr('scalarpoint', data_dim=2, data_ibegin = 1, data_ni = 1, data_jbegin = 1, data_nj = 1) 1454 1582 1455 1583 zz=REAL(narea,wp) 1456 1584 CALL iom_set_domain_attr('scalarpoint', lonvalue=zz, latvalue=zz) 1457 1585 1458 1586 END SUBROUTINE set_scalar 1587 1588 SUBROUTINE set_1point 1589 !!---------------------------------------------------------------------- 1590 !! *** ROUTINE set_1point *** 1591 !! 1592 !! ** Purpose : define zoom grid for scalar fields 1593 !! 1594 !!---------------------------------------------------------------------- 1595 REAL(wp), DIMENSION(1) :: zz = 1. 1596 INTEGER :: ix, iy 1597 !!---------------------------------------------------------------------- 1598 CALL dom_ngb( 180., 90., ix, iy, 'T' ) ! Nearest point to north pole should be ocean 1599 CALL iom_set_domain_attr('1point', zoom_ibegin=ix, zoom_jbegin=iy) 1600 1601 END SUBROUTINE set_1point 1602 1459 1603 1460 1604 … … 1479 1623 REAL(wp) ,DIMENSION( 3) :: zlonpira ! longitudes of pirata moorings 1480 1624 REAL(wp) ,DIMENSION( 9) :: zlatpira ! latitudes of pirata moorings 1625 #if defined key_xios2 1626 TYPE(xios_duration) :: f_op, f_of 1627 #endif 1628 1481 1629 !!---------------------------------------------------------------------- 1482 1630 ! 1483 1631 ! frequency of the call of iom_put (attribut: freq_op) 1484 WRITE(cl1,'(i1)') 1 ; CALL iom_set_field_attr('field_definition', freq_op = cl1//'ts', freq_offset='0ts') 1485 WRITE(cl1,'(i1)') nn_fsbc ; CALL iom_set_field_attr('SBC' , freq_op = cl1//'ts', freq_offset='0ts') 1486 WRITE(cl1,'(i1)') nn_fsbc ; CALL iom_set_field_attr('SBC_scalar' , freq_op = cl1//'ts', freq_offset='0ts') 1487 WRITE(cl1,'(i1)') nn_dttrc ; CALL iom_set_field_attr('ptrc_T' , freq_op = cl1//'ts', freq_offset='0ts') 1488 WRITE(cl1,'(i1)') nn_dttrc ; CALL iom_set_field_attr('diad_T' , freq_op = cl1//'ts', freq_offset='0ts') 1632 #if ! defined key_xios2 1633 WRITE(cl1,'(i1)') 1 ; CALL iom_set_field_attr('field_definition', freq_op=cl1//'ts', freq_offset='0ts') 1634 WRITE(cl1,'(i1)') 2 ; CALL iom_set_field_attr('trendT_even' , freq_op=cl1//'ts', freq_offset='0ts') 1635 WRITE(cl1,'(i1)') 2 ; CALL iom_set_field_attr('trendT_odd' , freq_op=cl1//'ts', freq_offset='-1ts') 1636 WRITE(cl1,'(i1)') nn_fsbc ; CALL iom_set_field_attr('SBC' , freq_op=cl1//'ts', freq_offset='0ts') 1637 WRITE(cl1,'(i1)') nn_fsbc ; CALL iom_set_field_attr('SBC_scalar' , freq_op=cl1//'ts', freq_offset='0ts') 1638 WRITE(cl1,'(i1)') nn_dttrc ; CALL iom_set_field_attr('ptrc_T' , freq_op=cl1//'ts', freq_offset='0ts') 1639 WRITE(cl1,'(i1)') nn_dttrc ; CALL iom_set_field_attr('diad_T' , freq_op=cl1//'ts', freq_offset='0ts') 1640 #else 1641 f_op%timestep = 1 ; f_of%timestep = 0 ; CALL iom_set_field_attr('field_definition', freq_op=f_op, freq_offset=f_of) 1642 f_op%timestep = 2 ; f_of%timestep = 0 ; CALL iom_set_field_attr('trendT_even' , freq_op=f_op, freq_offset=f_of) 1643 f_op%timestep = 2 ; f_of%timestep = -1 ; CALL iom_set_field_attr('trendT_odd' , freq_op=f_op, freq_offset=f_of) 1644 f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('SBC' , freq_op=f_op, freq_offset=f_of) 1645 f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('SBC_scalar' , freq_op=f_op, freq_offset=f_of) 1646 f_op%timestep = nn_dttrc ; f_of%timestep = 0 ; CALL iom_set_field_attr('ptrc_T' , freq_op=f_op, freq_offset=f_of) 1647 f_op%timestep = nn_dttrc ; f_of%timestep = 0 ; CALL iom_set_field_attr('diad_T' , freq_op=f_op, freq_offset=f_of) 1648 #endif 1489 1649 1490 1650 ! output file names (attribut: name) … … 1508 1668 ! Equatorial section (attributs: jbegin, ni, name_suffix) 1509 1669 CALL dom_ngb( 0., 0., ix, iy, cl1 ) 1670 #if ! defined key_xios2 1510 1671 CALL iom_set_domain_attr ('Eq'//cl1, zoom_jbegin=iy, zoom_ni=jpiglo) 1672 #else 1673 CALL iom_set_zoom_domain_attr ('Eq'//cl1, jbegin=iy-1, ni=jpiglo) 1674 #endif 1511 1675 CALL iom_get_file_attr ('Eq'//cl1, name_suffix = clsuff ) 1512 1676 CALL iom_set_file_attr ('Eq'//cl1, name_suffix = TRIM(clsuff)//'_Eq') … … 1588 1752 ENDIF 1589 1753 clname = TRIM(ADJUSTL(clat))//TRIM(ADJUSTL(clon)) 1754 #if ! defined key_xios2 1590 1755 CALL iom_set_domain_attr (TRIM(clname)//cl1, zoom_ibegin= ix, zoom_jbegin= iy) 1756 #else 1757 CALL iom_set_zoom_domain_attr (TRIM(clname)//cl1, ibegin= ix-1, jbegin= iy-1) 1758 #endif 1591 1759 CALL iom_get_file_attr (TRIM(clname)//cl1, name_suffix = clsuff ) 1592 1760 CALL iom_set_file_attr (TRIM(clname)//cl1, name_suffix = TRIM(clsuff)//'_'//TRIM(clname)) … … 1617 1785 REAL(wp) :: zsec 1618 1786 LOGICAL :: llexist 1619 !!---------------------------------------------------------------------- 1787 #if defined key_xios2 1788 TYPE(xios_duration) :: output_freq 1789 #endif 1790 !!---------------------------------------------------------------------- 1791 1620 1792 1621 1793 DO jn = 1,2 1622 1794 #if ! defined key_xios2 1623 1795 IF( jn == 1 ) CALL iom_get_file_attr( cdid, name = clname, output_freq = clfreq ) 1796 #else 1797 output_freq = xios_duration(0,0,0,0,0,0) 1798 IF( jn == 1 ) CALL iom_get_file_attr( cdid, name = clname, output_freq = output_freq ) 1799 #endif 1624 1800 IF( jn == 2 ) CALL iom_get_file_attr( cdid, name_suffix = clname ) 1625 1801 … … 1632 1808 END DO 1633 1809 1810 #if ! defined key_xios2 1634 1811 idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') 1635 1812 DO WHILE ( idx /= 0 ) … … 1644 1821 idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') 1645 1822 END DO 1646 1823 #else 1824 idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') 1825 DO WHILE ( idx /= 0 ) 1826 IF ( output_freq%timestep /= 0) THEN 1827 WRITE(clfreq,'(I18,A2)')INT(output_freq%timestep),'ts' 1828 itrlen = LEN_TRIM(ADJUSTL(clfreq)) 1829 ELSE IF ( output_freq%hour /= 0 ) THEN 1830 WRITE(clfreq,'(I19,A1)')INT(output_freq%hour),'h' 1831 itrlen = LEN_TRIM(ADJUSTL(clfreq)) 1832 ELSE IF ( output_freq%day /= 0 ) THEN 1833 WRITE(clfreq,'(I19,A1)')INT(output_freq%day),'d' 1834 itrlen = LEN_TRIM(ADJUSTL(clfreq)) 1835 ELSE IF ( output_freq%month /= 0 ) THEN 1836 WRITE(clfreq,'(I19,A1)')INT(output_freq%month),'m' 1837 itrlen = LEN_TRIM(ADJUSTL(clfreq)) 1838 ELSE IF ( output_freq%year /= 0 ) THEN 1839 WRITE(clfreq,'(I19,A1)')INT(output_freq%year),'y' 1840 itrlen = LEN_TRIM(ADJUSTL(clfreq)) 1841 ELSE 1842 CALL ctl_stop('error in the name of file id '//TRIM(cdid), & 1843 & ' attribute output_freq is undefined -> cannot replace @freq@ in '//TRIM(clname) ) 1844 ENDIF 1845 clname = clname(1:idx-1)//TRIM(ADJUSTL(clfreq))//clname(idx+6:LEN_TRIM(clname)) 1846 idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') 1847 END DO 1848 #endif 1647 1849 idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@') 1648 1850 DO WHILE ( idx /= 0 ) … … 1673 1875 END DO 1674 1876 1877 IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' ) clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 1675 1878 IF( jn == 1 ) CALL iom_set_file_attr( cdid, name = clname ) 1676 1879 IF( jn == 2 ) CALL iom_set_file_attr( cdid, name_suffix = clname ) … … 1720 1923 ENDIF 1721 1924 1925 !$AGRIF_DO_NOT_TREAT 1926 ! Should be fixed in the conv 1722 1927 IF( llfull ) THEN 1723 1928 clfmt = TRIM(clfmt)//",'_',i2.2,':',i2.2,':',i2.2" … … 1730 1935 WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday ! date of the end of run 1731 1936 ENDIF 1937 !$AGRIF_END_DO_NOT_TREAT 1732 1938 1733 1939 END FUNCTION iom_sdate -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90
r7960 r9987 26 26 INTEGER, PARAMETER, PUBLIC :: jpdom_unknown = 7 !: No dimension checking 27 27 INTEGER, PARAMETER, PUBLIC :: jpdom_autoglo = 8 !: 28 INTEGER, PARAMETER, PUBLIC :: jpdom_autodta = 9 !: 28 INTEGER, PARAMETER, PUBLIC :: jpdom_autoglo_xy = 9 !: Automatically set horizontal dimensions only 29 INTEGER, PARAMETER, PUBLIC :: jpdom_autodta = 10 !: 29 30 30 31 INTEGER, PARAMETER, PUBLIC :: jpioipsl = 100 !: Use ioipsl (fliocom only) library … … 57 58 INTEGER :: nvars !: number of identified varibles in the file 58 59 INTEGER :: iduld !: id of the unlimited dimension 60 INTEGER :: lenuld !: length of the unlimited dimension (number of records in file) 59 61 INTEGER :: irec !: writing record position 60 62 CHARACTER(LEN=32) :: uldname !: name of the unlimited dimension -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90
r7960 r9987 154 154 CALL iom_nf90_check(NF90_Inquire(if90id, unlimitedDimId = iom_file(kiomid)%iduld), clinfo) 155 155 IF ( iom_file(kiomid)%iduld .GE. 0 ) THEN 156 CALL iom_nf90_check(NF90_Inquire_Dimension(if90id, iom_file(kiomid)%iduld, & 157 & name = iom_file(kiomid)%uldname), clinfo) 156 CALL iom_nf90_check(NF90_Inquire_Dimension(if90id, iom_file(kiomid)%iduld, & 157 & name = iom_file(kiomid)%uldname, & 158 & len = iom_file(kiomid)%lenuld ), clinfo ) 158 159 ENDIF 159 160 IF(lwp) WRITE(numout,*) ' ---> '//TRIM(cdname)//' OK' -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
r7960 r9987 21 21 USE in_out_manager ! I/O manager 22 22 USE iom ! I/O module 23 USE ioipsl, ONLY : ju2ymds ! for calendar 23 24 USE eosbn2 ! equation of state (eos bn2 routine) 24 25 USE trdmxl_oce ! ocean active mixed layer tracers trends variables 25 26 USE divcur ! hor. divergence and curl (div & cur routines) 27 USE sbc_oce ! for icesheet freshwater input variables 26 28 27 29 IMPLICIT NONE … … 54 56 !!---------------------------------------------------------------------- 55 57 INTEGER, INTENT(in) :: kt ! ocean time-step 58 INTEGER :: iyear, imonth, iday 59 REAL (wp) :: zsec 60 REAL (wp) :: zfjulday 56 61 !! 57 62 CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character 58 63 CHARACTER(LEN=50) :: clname ! ocean output restart file name 59 CHARACTER( lc):: clpath ! full path to ocean output restart file64 CHARACTER(LEN=150) :: clpath ! full path to ocean output restart file 60 65 !!---------------------------------------------------------------------- 61 66 ! … … 81 86 IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 82 87 IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 83 ! beware of the format used to write kt (default is i8.8, that should be large enough...) 84 IF( nitrst > 999999999 ) THEN ; WRITE(clkt, * ) nitrst 85 ELSE ; WRITE(clkt, '(i8.8)') nitrst 88 IF ( ln_rstdate ) THEN 89 zfjulday = fjulday + rdttra(1) / rday 90 IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday ) zfjulday = REAL(NINT(zfjulday),wp) ! avoid truncation error 91 CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec ) 92 WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 93 ELSE 94 ! beware of the format used to write kt (default is i8.8, that should be large enough...) 95 IF( nitrst > 999999999 ) THEN ; WRITE(clkt, * ) nitrst 96 ELSE ; WRITE(clkt, '(i8.8)') nitrst 97 ENDIF 86 98 ENDIF 87 99 ! create the file … … 145 157 CALL iom_rstput( kt, nitrst, numrow, 'rhd' , rhd ) 146 158 #endif 159 IF( lk_oasis) THEN 160 ! nn_coupled_iceshelf_fluxes uninitialised unless lk_oasis=true 161 IF( nn_coupled_iceshelf_fluxes .eq. 1 ) THEN 162 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_mass', greenland_icesheet_mass ) 163 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_timelapsed', greenland_icesheet_timelapsed ) 164 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_mass_roc', greenland_icesheet_mass_rate_of_change ) 165 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_mass', antarctica_icesheet_mass ) 166 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_timelapsed', antarctica_icesheet_timelapsed ) 167 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_mass_roc', antarctica_icesheet_mass_rate_of_change ) 168 ENDIF 169 ENDIF 170 147 171 IF( kt == nitrst ) THEN 148 172 CALL iom_close( numrow ) ! close the restart file (only at last time step) … … 258 282 #endif 259 283 ! 284 IF( iom_varid( numror, 'greenland_icesheet_mass', ldstop = .FALSE. ) > 0 ) THEN 285 CALL iom_get( numror, 'greenland_icesheet_mass', greenland_icesheet_mass ) 286 CALL iom_get( numror, 'greenland_icesheet_timelapsed', greenland_icesheet_timelapsed ) 287 CALL iom_get( numror, 'greenland_icesheet_mass_roc', greenland_icesheet_mass_rate_of_change ) 288 ELSE 289 greenland_icesheet_mass = 0.0 290 greenland_icesheet_mass_rate_of_change = 0.0 291 greenland_icesheet_timelapsed = 0.0 292 ENDIF 293 IF( iom_varid( numror, 'antarctica_icesheet_mass', ldstop = .FALSE. ) > 0 ) THEN 294 CALL iom_get( numror, 'antarctica_icesheet_mass', antarctica_icesheet_mass ) 295 CALL iom_get( numror, 'antarctica_icesheet_timelapsed', antarctica_icesheet_timelapsed ) 296 CALL iom_get( numror, 'antarctica_icesheet_mass_roc', antarctica_icesheet_mass_rate_of_change ) 297 ELSE 298 antarctica_icesheet_mass = 0.0 299 antarctica_icesheet_mass_rate_of_change = 0.0 300 antarctica_icesheet_timelapsed = 0.0 301 ENDIF 302 260 303 IF( neuler == 0 ) THEN ! Euler restart (neuler=0) 261 304 tsb (:,:,:,:) = tsn (:,:,:,:) ! all before fields set to now values -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/LBC/lbclnk.F90
r7960 r9987 11 11 !! the BDY/OBC communications 12 12 !! 3.4 ! 2012-12 (R. Bourdalle-Badie and G. Reffray) add a C1D case 13 !! 3.6 ! 2015-06 (O. Tintó and M. Castrillo) add lbc_lnk_multi 13 14 !!---------------------------------------------------------------------- 14 15 #if defined key_mpp_mpi … … 24 25 25 26 INTERFACE lbc_lnk_multi 26 MODULE PROCEDURE mpp_lnk_2d_9 27 MODULE PROCEDURE mpp_lnk_2d_9, mpp_lnk_2d_multiple 27 28 END INTERFACE 28 29 … … 80 81 END INTERFACE 81 82 83 INTERFACE lbc_lnk_multi 84 MODULE PROCEDURE lbc_lnk_2d_9, lbc_lnk_2d_multiple 85 END INTERFACE 86 82 87 INTERFACE lbc_bdy_lnk 83 88 MODULE PROCEDURE lbc_bdy_lnk_2d, lbc_bdy_lnk_3d … … 87 92 MODULE PROCEDURE lbc_lnk_2d_e 88 93 END INTERFACE 94 95 TYPE arrayptr 96 REAL , DIMENSION (:,:), POINTER :: pt2d 97 END TYPE arrayptr 98 PUBLIC arrayptr 89 99 90 100 PUBLIC lbc_lnk ! ocean/ice lateral boundary conditions 91 101 PUBLIC lbc_lnk_e 102 PUBLIC lbc_lnk_multi ! modified ocean lateral boundary conditions 92 103 PUBLIC lbc_bdy_lnk ! ocean lateral BDY boundary conditions 93 104 PUBLIC lbc_lnk_icb … … 171 182 ! 172 183 END SUBROUTINE lbc_lnk_2d 184 185 SUBROUTINE lbc_lnk_2d_multiple( pt2d_array , type_array , psgn_array , num_fields ) 186 !! 187 INTEGER :: num_fields 188 TYPE( arrayptr ), DIMENSION(:) :: pt2d_array 189 CHARACTER(len=1), DIMENSION(:), INTENT(in ) :: type_array ! define the nature of ptab array grid-points 190 ! ! = T , U , V , F , W and I points 191 REAL(wp) , DIMENSION(:), INTENT(in ) :: psgn_array ! =-1 the sign change across the north fold boundary 192 ! ! = 1. , the sign is kept 193 ! 194 INTEGER :: ii !!MULTI SEND DUMMY LOOP INDICES 195 ! 196 DO ii = 1, num_fields 197 CALL lbc_lnk_2d( pt2d_array(ii)%pt2d, type_array(ii), psgn_array(ii) ) 198 END DO 199 ! 200 END SUBROUTINE lbc_lnk_2d_multiple 201 202 SUBROUTINE lbc_lnk_2d_9( pt2dA, cd_typeA, psgnA, pt2dB, cd_typeB, psgnB, pt2dC, cd_typeC, psgnC & 203 & , pt2dD, cd_typeD, psgnD, pt2dE, cd_typeE, psgnE, pt2dF, cd_typeF, psgnF & 204 & , pt2dG, cd_typeG, psgnG, pt2dH, cd_typeH, psgnH, pt2dI, cd_typeI, psgnI, cd_mpp, pval) 205 !!--------------------------------------------------------------------- 206 ! Second 2D array on which the boundary condition is applied 207 REAL(wp), DIMENSION(jpi,jpj), TARGET , INTENT(inout) :: pt2dA 208 REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) :: pt2dB , pt2dC , pt2dD , pt2dE 209 REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) :: pt2dF , pt2dG , pt2dH , pt2dI 210 ! define the nature of ptab array grid-points 211 CHARACTER(len=1) , INTENT(in ) :: cd_typeA 212 CHARACTER(len=1) , OPTIONAL, INTENT(in ) :: cd_typeB , cd_typeC , cd_typeD , cd_typeE 213 CHARACTER(len=1) , OPTIONAL, INTENT(in ) :: cd_typeF , cd_typeG , cd_typeH , cd_typeI 214 ! =-1 the sign change across the north fold boundary 215 REAL(wp) , INTENT(in ) :: psgnA 216 REAL(wp) , OPTIONAL, INTENT(in ) :: psgnB , psgnC , psgnD , psgnE 217 REAL(wp) , OPTIONAL, INTENT(in ) :: psgnF , psgnG , psgnH , psgnI 218 CHARACTER(len=3) , OPTIONAL, INTENT(in ) :: cd_mpp ! fill the overlap area only 219 REAL(wp) , OPTIONAL, INTENT(in ) :: pval ! background value (used at closed boundaries) 220 !! 221 !!--------------------------------------------------------------------- 222 223 !!The first array 224 CALL lbc_lnk( pt2dA, cd_typeA, psgnA ) 225 226 !! Look if more arrays to process 227 IF(PRESENT (psgnB) )CALL lbc_lnk( pt2dA, cd_typeA, psgnA ) 228 IF(PRESENT (psgnC) )CALL lbc_lnk( pt2dC, cd_typeC, psgnC ) 229 IF(PRESENT (psgnD) )CALL lbc_lnk( pt2dD, cd_typeD, psgnD ) 230 IF(PRESENT (psgnE) )CALL lbc_lnk( pt2dE, cd_typeE, psgnE ) 231 IF(PRESENT (psgnF) )CALL lbc_lnk( pt2dF, cd_typeF, psgnF ) 232 IF(PRESENT (psgnG) )CALL lbc_lnk( pt2dG, cd_typeG, psgnG ) 233 IF(PRESENT (psgnH) )CALL lbc_lnk( pt2dH, cd_typeH, psgnH ) 234 IF(PRESENT (psgnI) )CALL lbc_lnk( pt2dI, cd_typeI, psgnI ) 235 236 END SUBROUTINE lbc_lnk_2d_9 237 238 239 240 173 241 174 242 #else … … 372 440 ! 373 441 END SUBROUTINE lbc_lnk_2d 442 443 SUBROUTINE lbc_lnk_2d_multiple( pt2d_array , type_array , psgn_array , num_fields ) 444 !! 445 INTEGER :: num_fields 446 TYPE( arrayptr ), DIMENSION(:) :: pt2d_array 447 CHARACTER(len=1), DIMENSION(:), INTENT(in ) :: type_array ! define the nature of ptab array grid-points 448 ! ! = T , U , V , F , W and I points 449 REAL(wp) , DIMENSION(:), INTENT(in ) :: psgn_array ! =-1 the sign change across the north fold boundary 450 ! ! = 1. , the sign is kept 451 ! 452 INTEGER :: ii !!MULTI SEND DUMMY LOOP INDICES 453 ! 454 DO ii = 1, num_fields 455 CALL lbc_lnk_2d( pt2d_array(ii)%pt2d, type_array(ii), psgn_array(ii) ) 456 END DO 457 ! 458 END SUBROUTINE lbc_lnk_2d_multiple 459 460 SUBROUTINE lbc_lnk_2d_9( pt2dA, cd_typeA, psgnA, pt2dB, cd_typeB, psgnB, pt2dC, cd_typeC, psgnC & 461 & , pt2dD, cd_typeD, psgnD, pt2dE, cd_typeE, psgnE, pt2dF, cd_typeF, psgnF & 462 & , pt2dG, cd_typeG, psgnG, pt2dH, cd_typeH, psgnH, pt2dI, cd_typeI, psgnI, cd_mpp, pval) 463 !!--------------------------------------------------------------------- 464 ! Second 2D array on which the boundary condition is applied 465 REAL(wp), DIMENSION(jpi,jpj), TARGET , INTENT(inout) :: pt2dA 466 REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) :: pt2dB , pt2dC , pt2dD , pt2dE 467 REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) :: pt2dF , pt2dG , pt2dH , pt2dI 468 ! define the nature of ptab array grid-points 469 CHARACTER(len=1) , INTENT(in ) :: cd_typeA 470 CHARACTER(len=1) , OPTIONAL, INTENT(in ) :: cd_typeB , cd_typeC , cd_typeD , cd_typeE 471 CHARACTER(len=1) , OPTIONAL, INTENT(in ) :: cd_typeF , cd_typeG , cd_typeH , cd_typeI 472 ! =-1 the sign change across the north fold boundary 473 REAL(wp) , INTENT(in ) :: psgnA 474 REAL(wp) , OPTIONAL, INTENT(in ) :: psgnB , psgnC , psgnD , psgnE 475 REAL(wp) , OPTIONAL, INTENT(in ) :: psgnF , psgnG , psgnH , psgnI 476 CHARACTER(len=3) , OPTIONAL, INTENT(in ) :: cd_mpp ! fill the overlap area only 477 REAL(wp) , OPTIONAL, INTENT(in ) :: pval ! background value (used at closed boundaries) 478 !! 479 !!--------------------------------------------------------------------- 480 481 !!The first array 482 CALL lbc_lnk( pt2dA, cd_typeA, psgnA ) 483 484 !! Look if more arrays to process 485 IF(PRESENT (psgnB) )CALL lbc_lnk( pt2dA, cd_typeA, psgnA ) 486 IF(PRESENT (psgnC) )CALL lbc_lnk( pt2dC, cd_typeC, psgnC ) 487 IF(PRESENT (psgnD) )CALL lbc_lnk( pt2dD, cd_typeD, psgnD ) 488 IF(PRESENT (psgnE) )CALL lbc_lnk( pt2dE, cd_typeE, psgnE ) 489 IF(PRESENT (psgnF) )CALL lbc_lnk( pt2dF, cd_typeF, psgnF ) 490 IF(PRESENT (psgnG) )CALL lbc_lnk( pt2dG, cd_typeG, psgnG ) 491 IF(PRESENT (psgnH) )CALL lbc_lnk( pt2dH, cd_typeH, psgnH ) 492 IF(PRESENT (psgnI) )CALL lbc_lnk( pt2dI, cd_typeI, psgnI ) 493 494 END SUBROUTINE lbc_lnk_2d_9 495 374 496 375 497 #endif … … 441 563 !!====================================================================== 442 564 END MODULE lbclnk 565 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
r7960 r9987 24 24 !! 3.5 ! 2013 ( C. Ethe, G. Madec ) message passing arrays as local variables 25 25 !! 3.5 ! 2013 (S.Mocavero, I.Epicoco - CMCC) north fold optimizations 26 !! 3.6 ! 2015 (O. Tintó and M. Castrillo - BSC) Added 'mpp_lnk_2d_multiple', 'mpp_lbc_north_2d_multiple', 'mpp_max_multiple' 26 27 !!---------------------------------------------------------------------- 27 28 … … 62 63 USE lbcnfd ! north fold treatment 63 64 USE in_out_manager ! I/O manager 65 USE wrk_nemo ! work arrays 64 66 65 67 IMPLICIT NONE … … 70 72 PUBLIC mpp_ini_north, mpp_lbc_north, mpp_lbc_north_e 71 73 PUBLIC mpp_min, mpp_max, mpp_sum, mpp_minloc, mpp_maxloc 74 PUBLIC mpp_max_multiple 72 75 PUBLIC mpp_lnk_3d, mpp_lnk_3d_gather, mpp_lnk_2d, mpp_lnk_2d_e 73 PUBLIC mpp_lnk_2d_9 76 PUBLIC mpp_lnk_2d_9 , mpp_lnk_2d_multiple 74 77 PUBLIC mppscatter, mppgather 75 78 PUBLIC mpp_ini_ice, mpp_ini_znl … … 78 81 PUBLIC mpp_lnk_bdy_2d, mpp_lnk_bdy_3d 79 82 PUBLIC mpp_lbc_north_icb, mpp_lnk_2d_icb 83 PUBLIC mpprank 80 84 81 85 TYPE arrayptr 82 86 REAL , DIMENSION (:,:), POINTER :: pt2d 83 87 END TYPE arrayptr 88 PUBLIC arrayptr 84 89 85 90 !! * Interfaces … … 105 110 INTERFACE mpp_maxloc 106 111 MODULE PROCEDURE mpp_maxloc2d ,mpp_maxloc3d 112 END INTERFACE 113 114 INTERFACE mpp_max_multiple 115 MODULE PROCEDURE mppmax_real_multiple 107 116 END INTERFACE 108 117 … … 298 307 ENDIF 299 308 309 #if defined key_agrif 310 IF (Agrif_Root()) THEN 311 CALL Agrif_MPI_Init(mpi_comm_opa) 312 ELSE 313 CALL Agrif_MPI_set_grid_comm(mpi_comm_opa) 314 ENDIF 315 #endif 316 300 317 CALL mpi_comm_rank( mpi_comm_opa, mpprank, ierr ) 301 318 CALL mpi_comm_size( mpi_comm_opa, mppsize, ierr ) … … 724 741 ! ----------------------- 725 742 ! 726 DO ii = 1 , num_fields727 743 !First Array 728 IF( npolj /= 0 .AND. .NOT. PRESENT(cd_mpp) ) THEN 729 ! 730 SELECT CASE ( jpni ) 731 CASE ( 1 ) ; CALL lbc_nfd ( pt2d_array(ii)%pt2d( : , : ), type_array(ii) , psgn_array(ii) ) ! only 1 northern proc, no mpp 732 CASE DEFAULT ; CALL mpp_lbc_north( pt2d_array(ii)%pt2d( : , : ), type_array(ii), psgn_array(ii) ) ! for all northern procs. 733 END SELECT 734 ! 735 ENDIF 736 ! 737 END DO 744 IF( npolj /= 0 .AND. .NOT. PRESENT(cd_mpp) ) THEN 745 ! 746 SELECT CASE ( jpni ) 747 CASE ( 1 ) ; 748 DO ii = 1 , num_fields 749 CALL lbc_nfd ( pt2d_array(ii)%pt2d( : , : ), type_array(ii) , psgn_array(ii) ) ! only 1 northern proc, no mpp 750 END DO 751 CASE DEFAULT ; CALL mpp_lbc_north_2d_multiple( pt2d_array, type_array, psgn_array, num_fields ) ! for all northern procs. 752 END SELECT 753 ! 754 ENDIF 755 ! 738 756 739 757 DEALLOCATE( zt2ns, zt2sn, zt2ew, zt2we ) … … 1681 1699 END SUBROUTINE mppmax_real 1682 1700 1701 SUBROUTINE mppmax_real_multiple( ptab, NUM , kcom ) 1702 !!---------------------------------------------------------------------- 1703 !! *** routine mppmax_real *** 1704 !! 1705 !! ** Purpose : Maximum 1706 !! 1707 !!---------------------------------------------------------------------- 1708 REAL(wp), DIMENSION(:) , INTENT(inout) :: ptab ! ??? 1709 INTEGER , INTENT(in ) :: NUM 1710 INTEGER , INTENT(in ), OPTIONAL :: kcom ! ??? 1711 !! 1712 INTEGER :: ierror, localcomm 1713 REAL(wp) , POINTER , DIMENSION(:) :: zwork 1714 !!---------------------------------------------------------------------- 1715 ! 1716 CALL wrk_alloc(NUM , zwork) 1717 localcomm = mpi_comm_opa 1718 IF( PRESENT(kcom) ) localcomm = kcom 1719 ! 1720 CALL mpi_allreduce( ptab, zwork, NUM, mpi_double_precision, mpi_max, localcomm, ierror ) 1721 ptab = zwork 1722 CALL wrk_dealloc(NUM , zwork) 1723 ! 1724 END SUBROUTINE mppmax_real_multiple 1725 1683 1726 1684 1727 SUBROUTINE mppmin_a_real( ptab, kdim, kcom ) … … 2006 2049 2007 2050 SUBROUTINE mppstop 2051 2052 #if defined key_oasis3 2053 USE mod_oasis ! coupling routines 2054 #endif 2055 2008 2056 !!---------------------------------------------------------------------- 2009 2057 !! *** routine mppstop *** … … 2015 2063 !!---------------------------------------------------------------------- 2016 2064 ! 2065 2066 #if defined key_oasis3 2067 ! If we're trying to shut down cleanly then we need to consider the fact 2068 ! that this could be part of an MPMD configuration - we don't want to 2069 ! leave other components deadlocked. 2070 2071 CALL oasis_abort(nproc,"mppstop","NEMO initiated abort") 2072 2073 2074 #else 2075 2017 2076 CALL mppsync 2018 2077 CALL mpi_finalize( info ) 2078 #endif 2079 2019 2080 ! 2020 2081 END SUBROUTINE mppstop … … 2575 2636 END SUBROUTINE mpp_lbc_north_2d 2576 2637 2638 SUBROUTINE mpp_lbc_north_2d_multiple( pt2d_array, cd_type, psgn, num_fields) 2639 !!--------------------------------------------------------------------- 2640 !! *** routine mpp_lbc_north_2d *** 2641 !! 2642 !! ** Purpose : Ensure proper north fold horizontal bondary condition 2643 !! in mpp configuration in case of jpn1 > 1 2644 !! (for multiple 2d arrays ) 2645 !! 2646 !! ** Method : North fold condition and mpp with more than one proc 2647 !! in i-direction require a specific treatment. We gather 2648 !! the 4 northern lines of the global domain on 1 processor 2649 !! and apply lbc north-fold on this sub array. Then we 2650 !! scatter the north fold array back to the processors. 2651 !! 2652 !!---------------------------------------------------------------------- 2653 INTEGER , INTENT (in ) :: num_fields ! number of variables contained in pt2d 2654 TYPE( arrayptr ), DIMENSION(:) :: pt2d_array 2655 CHARACTER(len=1), DIMENSION(:), INTENT(in ) :: cd_type ! nature of pt2d grid-points 2656 ! ! = T , U , V , F or W gridpoints 2657 REAL(wp), DIMENSION(:), INTENT(in ) :: psgn ! = -1. the sign change across the north fold 2658 !! ! = 1. , the sign is kept 2659 INTEGER :: ji, jj, jr, jk 2660 INTEGER :: ierr, itaille, ildi, ilei, iilb 2661 INTEGER :: ijpj, ijpjm1, ij, iproc 2662 INTEGER, DIMENSION (jpmaxngh) :: ml_req_nf !for mpi_isend when avoiding mpi_allgather 2663 INTEGER :: ml_err ! for mpi_isend when avoiding mpi_allgather 2664 INTEGER, DIMENSION(MPI_STATUS_SIZE):: ml_stat ! for mpi_isend when avoiding mpi_allgather 2665 ! ! Workspace for message transfers avoiding mpi_allgather 2666 REAL(wp), DIMENSION(:,:,:) , ALLOCATABLE :: ztab 2667 REAL(wp), DIMENSION(:,:,:) , ALLOCATABLE :: znorthloc, zfoldwk 2668 REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: znorthgloio 2669 REAL(wp), DIMENSION(:,:,:) , ALLOCATABLE :: ztabl, ztabr 2670 INTEGER :: istatus(mpi_status_size) 2671 INTEGER :: iflag 2672 !!---------------------------------------------------------------------- 2673 ! 2674 ALLOCATE( ztab(jpiglo,4,num_fields), znorthloc(jpi,4,num_fields), zfoldwk(jpi,4,num_fields), & 2675 & znorthgloio(jpi,4,num_fields,jpni) ) ! expanded to 3 dimensions 2676 ALLOCATE( ztabl(jpi,4,num_fields), ztabr(jpi*jpmaxngh, 4,num_fields) ) 2677 ! 2678 ijpj = 4 2679 ijpjm1 = 3 2680 ! 2681 2682 DO jk = 1, num_fields 2683 DO jj = nlcj-ijpj+1, nlcj ! put in znorthloc the last 4 jlines of pt2d (for every variable) 2684 ij = jj - nlcj + ijpj 2685 znorthloc(:,ij,jk) = pt2d_array(jk)%pt2d(:,jj) 2686 END DO 2687 END DO 2688 ! ! Build in procs of ncomm_north the znorthgloio 2689 itaille = jpi * ijpj 2690 2691 IF ( l_north_nogather ) THEN 2692 ! 2693 ! Avoid the use of mpi_allgather by exchanging only with the processes already identified 2694 ! (in nemo_northcomms) as being involved in this process' northern boundary exchange 2695 ! 2696 ztabr(:,:,:) = 0 2697 ztabl(:,:,:) = 0 2698 2699 DO jk = 1, num_fields 2700 DO jj = nlcj-ijpj+1, nlcj ! First put local values into the global array 2701 ij = jj - nlcj + ijpj 2702 DO ji = nfsloop, nfeloop 2703 ztabl(ji,ij,jk) = pt2d_array(jk)%pt2d(ji,jj) 2704 END DO 2705 END DO 2706 END DO 2707 2708 DO jr = 1,nsndto 2709 IF ((nfipproc(isendto(jr),jpnj) .ne. (narea-1)) .and. (nfipproc(isendto(jr),jpnj) .ne. -1)) THEN 2710 CALL mppsend(5, znorthloc, itaille*num_fields, nfipproc(isendto(jr),jpnj), ml_req_nf(jr)) ! Buffer expanded "num_fields" times 2711 ENDIF 2712 END DO 2713 DO jr = 1,nsndto 2714 iproc = nfipproc(isendto(jr),jpnj) 2715 IF(iproc .ne. -1) THEN 2716 ilei = nleit (iproc+1) 2717 ildi = nldit (iproc+1) 2718 iilb = nfiimpp(isendto(jr),jpnj) - nfiimpp(isendto(1),jpnj) 2719 ENDIF 2720 IF((iproc .ne. (narea-1)) .and. (iproc .ne. -1)) THEN 2721 CALL mpprecv(5, zfoldwk, itaille*num_fields, iproc) ! Buffer expanded "num_fields" times 2722 DO jk = 1 , num_fields 2723 DO jj = 1, ijpj 2724 DO ji = ildi, ilei 2725 ztabr(iilb+ji,jj,jk) = zfoldwk(ji,jj,jk) ! Modified to 3D 2726 END DO 2727 END DO 2728 END DO 2729 ELSE IF (iproc .eq. (narea-1)) THEN 2730 DO jk = 1, num_fields 2731 DO jj = 1, ijpj 2732 DO ji = ildi, ilei 2733 ztabr(iilb+ji,jj,jk) = pt2d_array(jk)%pt2d(ji,nlcj-ijpj+jj) ! Modified to 3D 2734 END DO 2735 END DO 2736 END DO 2737 ENDIF 2738 END DO 2739 IF (l_isend) THEN 2740 DO jr = 1,nsndto 2741 IF ((nfipproc(isendto(jr),jpnj) .ne. (narea-1)) .and. (nfipproc(isendto(jr),jpnj) .ne. -1)) THEN 2742 CALL mpi_wait(ml_req_nf(jr), ml_stat, ml_err) 2743 ENDIF 2744 END DO 2745 ENDIF 2746 ! 2747 DO ji = 1, num_fields ! Loop to manage 3D variables 2748 CALL mpp_lbc_nfd( ztabl(:,:,ji), ztabr(:,:,ji), cd_type(ji), psgn(ji) ) ! North fold boundary condition 2749 END DO 2750 ! 2751 DO jk = 1, num_fields 2752 DO jj = nlcj-ijpj+1, nlcj ! Scatter back to pt2d 2753 ij = jj - nlcj + ijpj 2754 DO ji = 1, nlci 2755 pt2d_array(jk)%pt2d(ji,jj) = ztabl(ji,ij,jk) ! Modified to 3D 2756 END DO 2757 END DO 2758 END DO 2759 2760 ! 2761 ELSE 2762 ! 2763 CALL MPI_ALLGATHER( znorthloc , itaille*num_fields, MPI_DOUBLE_PRECISION, & 2764 & znorthgloio, itaille*num_fields, MPI_DOUBLE_PRECISION, ncomm_north, ierr ) 2765 ! 2766 ztab(:,:,:) = 0.e0 2767 DO jk = 1, num_fields 2768 DO jr = 1, ndim_rank_north ! recover the global north array 2769 iproc = nrank_north(jr) + 1 2770 ildi = nldit (iproc) 2771 ilei = nleit (iproc) 2772 iilb = nimppt(iproc) 2773 DO jj = 1, ijpj 2774 DO ji = ildi, ilei 2775 ztab(ji+iilb-1,jj,jk) = znorthgloio(ji,jj,jk,jr) 2776 END DO 2777 END DO 2778 END DO 2779 END DO 2780 2781 DO ji = 1, num_fields 2782 CALL lbc_nfd( ztab(:,:,ji), cd_type(ji), psgn(ji) ) ! North fold boundary condition 2783 END DO 2784 ! 2785 DO jk = 1, num_fields 2786 DO jj = nlcj-ijpj+1, nlcj ! Scatter back to pt2d 2787 ij = jj - nlcj + ijpj 2788 DO ji = 1, nlci 2789 pt2d_array(jk)%pt2d(ji,jj) = ztab(ji+nimpp-1,ij,jk) 2790 END DO 2791 END DO 2792 END DO 2793 ! 2794 ! 2795 ENDIF 2796 DEALLOCATE( ztab, znorthloc, zfoldwk, znorthgloio ) 2797 DEALLOCATE( ztabl, ztabr ) 2798 ! 2799 END SUBROUTINE mpp_lbc_north_2d_multiple 2577 2800 2578 2801 SUBROUTINE mpp_lbc_north_e( pt2d, cd_type, psgn) … … 3680 3903 IF( numevo_ice /= -1 ) CALL FLUSH(numevo_ice) 3681 3904 ! 3905 IF( cd1 == 'MPPSTOP' ) THEN 3906 IF(lwp) WRITE(numout,*) 'E R R O R: Calling mppstop' 3907 CALL mppstop() 3908 ENDIF 3682 3909 IF( cd1 == 'STOP' ) THEN 3683 3910 IF(lwp) WRITE(numout,*) 'huge E-R-R-O-R : immediate stop' … … 3784 4011 WRITE(kout,*) 3785 4012 ENDIF 3786 STOP 'ctl_opn bad opening'4013 CALL ctl_stop ('STOP', 'NEMO abort ctl_opn bad opening') 3787 4014 ENDIF 3788 4015 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90
r7960 r9987 201 201 202 202 #endif 203 IF(lwp) THEN204 WRITE(numout,*)205 WRITE(numout,*) ' defines mpp subdomains'206 WRITE(numout,*) ' ----------------------'207 WRITE(numout,*) ' iresti=',iresti,' irestj=',irestj208 WRITE(numout,*) ' jpni =',jpni ,' jpnj =',jpnj209 ifreq = 4210 il1 = 1211 DO jn = 1, (jpni-1)/ifreq+1212 il2 = MIN( jpni, il1+ifreq-1 )213 WRITE(numout,*)214 WRITE(numout,9200) ('***',ji = il1,il2-1)215 DO jj = jpnj, 1, -1216 WRITE(numout,9203) (' ',ji = il1,il2-1)217 WRITE(numout,9202) jj, ( ilcit(ji,jj),ilcjt(ji,jj),ji = il1,il2 )218 WRITE(numout,9203) (' ',ji = il1,il2-1)219 WRITE(numout,9200) ('***',ji = il1,il2-1)220 END DO221 WRITE(numout,9201) (ji,ji = il1,il2)222 il1 = il1+ifreq223 END DO224 9200 FORMAT(' ***',20('*************',a3))225 9203 FORMAT(' * ',20(' * ',a3))226 9201 FORMAT(' ',20(' ',i3,' '))227 9202 FORMAT(' ',i3,' * ',20(i3,' x',i3,' * '))228 ENDIF229 230 zidom = nreci231 DO ji = 1, jpni232 zidom = zidom + ilcit(ji,1) - nreci233 END DO234 IF(lwp) WRITE(numout,*)235 IF(lwp) WRITE(numout,*)' sum ilcit(i,1) = ', zidom, ' jpiglo = ', jpiglo236 237 zjdom = nrecj238 DO jj = 1, jpnj239 zjdom = zjdom + ilcjt(1,jj) - nrecj240 END DO241 IF(lwp) WRITE(numout,*)' sum ilcit(1,j) = ', zjdom, ' jpjglo = ', jpjglo242 IF(lwp) WRITE(numout,*)243 244 203 245 204 ! 2. Index arrays for subdomains … … 304 263 nlejt(jn) = nlej 305 264 END DO 306 307 308 ! 4. From global to local 265 266 ! 4. Subdomain print 267 ! ------------------ 268 269 IF(lwp) WRITE(numout,*) 270 IF(lwp) WRITE(numout,*) ' mpp_init: defines mpp subdomains' 271 IF(lwp) WRITE(numout,*) ' ~~~~~~ ----------------------' 272 IF(lwp) WRITE(numout,*) 273 IF(lwp) WRITE(numout,*) 'iresti=',iresti,' irestj=',irestj 274 IF(lwp) WRITE(numout,*) 275 IF(lwp) WRITE(numout,*) 'jpni=',jpni,' jpnj=',jpnj 276 zidom = nreci 277 DO ji = 1, jpni 278 zidom = zidom + ilcit(ji,1) - nreci 279 END DO 280 IF(lwp) WRITE(numout,*) 281 IF(lwp) WRITE(numout,*)' sum ilcit(i,1)=', zidom, ' jpiglo=', jpiglo 282 283 zjdom = nrecj 284 DO jj = 1, jpnj 285 zjdom = zjdom + ilcjt(1,jj) - nrecj 286 END DO 287 IF(lwp) WRITE(numout,*)' sum ilcit(1,j)=', zjdom, ' jpjglo=', jpjglo 288 IF(lwp) WRITE(numout,*) 289 290 IF(lwp) THEN 291 ifreq = 4 292 il1 = 1 293 DO jn = 1, (jpni-1)/ifreq+1 294 il2 = MIN( jpni, il1+ifreq-1 ) 295 WRITE(numout,*) 296 WRITE(numout,9200) ('***',ji = il1,il2-1) 297 DO jj = jpnj, 1, -1 298 WRITE(numout,9203) (' ',ji = il1,il2-1) 299 WRITE(numout,9202) jj, ( ilcit(ji,jj),ilcjt(ji,jj),ji = il1,il2 ) 300 WRITE(numout,9204) (nfipproc(ji,jj),ji=il1,il2) 301 WRITE(numout,9203) (' ',ji = il1,il2-1) 302 WRITE(numout,9200) ('***',ji = il1,il2-1) 303 END DO 304 WRITE(numout,9201) (ji,ji = il1,il2) 305 il1 = il1+ifreq 306 END DO 307 9200 FORMAT(' ***',20('*************',a3)) 308 9203 FORMAT(' * ',20(' * ',a3)) 309 9201 FORMAT(' ',20(' ',i3,' ')) 310 9202 FORMAT(' ',i3,' * ',20(i3,' x',i3,' * ')) 311 9204 FORMAT(' * ',20(' ',i3,' * ')) 312 ENDIF 313 314 ! 5. From global to local 309 315 ! ----------------------- 310 316 … … 313 319 314 320 315 ! 5. Subdomain neighbours321 ! 6. Subdomain neighbours 316 322 ! ---------------------- 317 323 … … 436 442 WRITE(numout,*) ' nimpp = ', nimpp 437 443 WRITE(numout,*) ' njmpp = ', njmpp 438 WRITE(numout,*) ' nbse = ', nbse , ' npse = ', npse 439 WRITE(numout,*) ' nbsw = ', nbsw , ' npsw = ', npsw 440 WRITE(numout,*) ' nbne = ', nbne , ' npne = ', npne 441 WRITE(numout,*) ' nbnw = ', nbnw , ' npnw = ', npnw 444 WRITE(numout,*) ' nreci = ', nreci , ' npse = ', npse 445 WRITE(numout,*) ' nrecj = ', nrecj , ' npsw = ', npsw 446 WRITE(numout,*) ' jpreci = ', jpreci , ' npne = ', npne 447 WRITE(numout,*) ' jprecj = ', jprecj , ' npnw = ', npnw 448 WRITE(numout,*) 442 449 ENDIF 443 450 … … 446 453 ! Prepare mpp north fold 447 454 448 IF (jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN455 IF( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN 449 456 CALL mpp_ini_north 450 END IF 457 IF(lwp) WRITE(numout,*) ' mpp_init : North fold boundary prepared for jpni >1' 458 ENDIF 451 459 452 460 ! Prepare NetCDF output file (if necessary) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/LBC/mppini_2.h90
r7960 r9987 318 318 ENDIF 319 319 320 ! Check wet points over the entire domain to preserve the MPI communication stencil 320 321 isurf = 0 321 DO jj = 1 +jprecj, ilj-jprecj322 DO ji = 1 +jpreci, ili-jpreci322 DO jj = 1, ilj 323 DO ji = 1, ili 323 324 IF( imask(ji+iimppt(ii,ij)-1, jj+ijmppt(ii,ij)-1) == 1) isurf = isurf+1 324 325 END DO 325 326 END DO 327 326 328 IF(isurf /= 0) THEN 327 329 icont = icont + 1 … … 333 335 334 336 nfipproc(:,:) = ipproc(:,:) 335 336 337 337 338 ! Control … … 441 442 ii = iin(narea) 442 443 ij = ijn(narea) 444 445 ! set default neighbours 446 noso = ioso(ii,ij) 447 nowe = iowe(ii,ij) 448 noea = ioea(ii,ij) 449 nono = iono(ii,ij) 450 npse = iose(ii,ij) 451 npsw = iosw(ii,ij) 452 npne = ione(ii,ij) 453 npnw = ionw(ii,ij) 454 455 ! check neighbours location 443 456 IF( ioso(ii,ij) >= 0 .AND. ioso(ii,ij) <= (jpni*jpnj-1) ) THEN 444 457 iiso = 1 + MOD(ioso(ii,ij),jpni) … … 511 524 IF (lwp) THEN 512 525 CALL ctl_opn( inum, 'layout.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea ) 526 WRITE(inum,'(a)') ' jpnij jpi jpj jpk jpiglo jpjglo' 513 527 WRITE(inum,'(6i8)') jpnij,jpi,jpj,jpk,jpiglo,jpjglo 514 528 WRITE(inum,'(a)') 'NAREA nlci nlcj nldi nldj nlei nlej nimpp njmpp' … … 523 537 END IF 524 538 525 IF( nperio == 1 .AND.jpni /= 1 ) CALL ctl_stop( ' mpp_init2: error on cyclicity' )526 527 ! Prepare mpp north fold528 529 IF( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN530 CALL mpp_ini_north531 IF(lwp) WRITE(numout,*) ' mpp_init2 : North fold boundary prepared for jpni >1'532 ENDIF533 534 539 ! Defined npolj, either 0, 3 , 4 , 5 , 6 535 540 ! In this case the important thing is that npolj /= 0 … … 548 553 ENDIF 549 554 555 ! Periodicity : no corner if nbondi = 2 and nperio != 1 556 557 IF(lwp) THEN 558 WRITE(numout,*) ' nproc = ', nproc 559 WRITE(numout,*) ' nowe = ', nowe , ' noea = ', noea 560 WRITE(numout,*) ' nono = ', nono , ' noso = ', noso 561 WRITE(numout,*) ' nbondi = ', nbondi 562 WRITE(numout,*) ' nbondj = ', nbondj 563 WRITE(numout,*) ' npolj = ', npolj 564 WRITE(numout,*) ' nperio = ', nperio 565 WRITE(numout,*) ' nlci = ', nlci 566 WRITE(numout,*) ' nlcj = ', nlcj 567 WRITE(numout,*) ' nimpp = ', nimpp 568 WRITE(numout,*) ' njmpp = ', njmpp 569 WRITE(numout,*) ' nreci = ', nreci , ' npse = ', npse 570 WRITE(numout,*) ' nrecj = ', nrecj , ' npsw = ', npsw 571 WRITE(numout,*) ' jpreci = ', jpreci , ' npne = ', npne 572 WRITE(numout,*) ' jprecj = ', jprecj , ' npnw = ', npnw 573 WRITE(numout,*) 574 ENDIF 575 576 IF( nperio == 1 .AND. jpni /= 1 ) CALL ctl_stop( ' mpp_init2: error on cyclicity' ) 577 578 ! Prepare mpp north fold 579 580 IF( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN 581 CALL mpp_ini_north 582 IF(lwp) WRITE(numout,*) ' mpp_init2 : North fold boundary prepared for jpni >1' 583 ENDIF 584 550 585 ! Prepare NetCDF output file (if necessary) 551 586 CALL mpp_init_ioipsl 552 587 553 ! Periodicity : no corner if nbondi = 2 and nperio != 1554 555 IF(lwp) THEN556 WRITE(numout,*) ' nproc= ',nproc557 WRITE(numout,*) ' nowe= ',nowe558 WRITE(numout,*) ' noea= ',noea559 WRITE(numout,*) ' nono= ',nono560 WRITE(numout,*) ' noso= ',noso561 WRITE(numout,*) ' nbondi= ',nbondi562 WRITE(numout,*) ' nbondj= ',nbondj563 WRITE(numout,*) ' npolj= ',npolj564 WRITE(numout,*) ' nperio= ',nperio565 WRITE(numout,*) ' nlci= ',nlci566 WRITE(numout,*) ' nlcj= ',nlcj567 WRITE(numout,*) ' nimpp= ',nimpp568 WRITE(numout,*) ' njmpp= ',njmpp569 WRITE(numout,*) ' nbse= ',nbse,' npse= ',npse570 WRITE(numout,*) ' nbsw= ',nbsw,' npsw= ',npsw571 WRITE(numout,*) ' nbne= ',nbne,' npne= ',npne572 WRITE(numout,*) ' nbnw= ',nbnw,' npnw= ',npnw573 ENDIF574 588 575 589 END SUBROUTINE mpp_init2 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/LDF/ldfeiv.F90
r7960 r9987 157 157 END DO 158 158 ENDIF 159 160 ! ORCA R1: Take the minimum between aeiw and aeiv0 161 IF( cp_cfg == "orca" .AND. jp_cfg == 1 ) THEN 162 DO jj = 2, jpjm1 163 DO ji = fs_2, fs_jpim1 ! vector opt. 164 aeiw(ji,jj) = MIN( aeiw(ji,jj), aeiv0 ) 165 END DO 166 END DO 167 ENDIF 168 159 169 CALL lbc_lnk( aeiw, 'W', 1. ) ! lateral boundary condition on aeiw 160 170 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90
r7960 r9987 188 188 DO jj = 2, jpjm1 189 189 DO ji = fs_2, fs_jpim1 ! vector opt. 190 IF (miku(ji,jj) .GT. miku(ji+1,jj)) zhmlpu(ji,jj) = MAX(hmlpt(ji ,jj ), 5._wp) 191 IF (miku(ji,jj) .LT. miku(ji+1,jj)) zhmlpu(ji,jj) = MAX(hmlpt(ji+1,jj ), 5._wp) 192 IF (miku(ji,jj) .EQ. miku(ji+1,jj)) zhmlpu(ji,jj) = MAX(hmlpt(ji ,jj ), hmlpt(ji+1,jj ), 5._wp) 193 IF (mikv(ji,jj) .GT. miku(ji,jj+1)) zhmlpv(ji,jj) = MAX(hmlpt(ji ,jj ), 5._wp) 194 IF (mikv(ji,jj) .LT. miku(ji,jj+1)) zhmlpv(ji,jj) = MAX(hmlpt(ji ,jj+1), 5._wp) 195 IF (mikv(ji,jj) .EQ. miku(ji,jj+1)) zhmlpv(ji,jj) = MAX(hmlpt(ji ,jj ), hmlpt(ji ,jj+1), 5._wp) 190 zhmlpu(ji,jj) = ( MAX(hmlpt(ji,jj) , hmlpt (ji+1,jj ), 5._wp) & 191 & - MAX(risfdep(ji,jj), risfdep(ji+1,jj ) ) ) 192 zhmlpv(ji,jj) = ( MAX(hmlpt (ji,jj), hmlpt (ji ,jj+1), 5._wp) & 193 & - MAX(risfdep(ji,jj), risfdep(ji ,jj+1) ) ) 196 194 ENDDO 197 195 ENDDO -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_oce.F90
r7960 r9987 41 41 42 42 REAL(wp), PUBLIC :: rldf !: multiplicative factor of diffusive coefficient 43 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: r_fact_lap 43 44 !: Needed to define the ratio between passive and active tracer diffusion coef. 44 45 … … 92 93 !! *** FUNCTION ldftra_oce_alloc *** 93 94 !!---------------------------------------------------------------------- 94 INTEGER, DIMENSION( 3) :: ierr95 INTEGER, DIMENSION(4) :: ierr 95 96 !!---------------------------------------------------------------------- 96 97 ierr(:) = 0 … … 116 117 # endif 117 118 #endif 119 ALLOCATE( r_fact_lap(jpi,jpj,jpk), STAT=ierr(4) ) 118 120 ldftra_oce_alloc = MAXVAL( ierr ) 119 121 IF( ldftra_oce_alloc /= 0 ) CALL ctl_warn('ldftra_oce_alloc: failed to allocate arrays') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_substitute.h90
r7960 r9987 13 13 ! 'key_traldf_c3d' : aht: 3D coefficient 14 14 # define fsahtt(i,j,k) rldf * ahtt(i,j,k) 15 # define fsahtu(i,j,k) rldf * ahtu(i,j,k) 15 # define fsahtu(i,j,k) rldf * ahtu(i,j,k) * r_fact_lap(i,j,k) 16 16 # define fsahtv(i,j,k) rldf * ahtv(i,j,k) 17 17 # define fsahtw(i,j,k) rldf * ahtw(i,j,k) … … 19 19 ! 'key_traldf_c2d' : aht: 2D coefficient 20 20 # define fsahtt(i,j,k) rldf * ahtt(i,j) 21 # define fsahtu(i,j,k) rldf * ahtu(i,j) 21 # define fsahtu(i,j,k) rldf * ahtu(i,j) * r_fact_lap(i,j,k) 22 22 # define fsahtv(i,j,k) rldf * ahtv(i,j) 23 23 # define fsahtw(i,j,k) rldf * ahtw(i,j) … … 25 25 ! 'key_traldf_c1d' : aht: 1D coefficient 26 26 # define fsahtt(i,j,k) rldf * ahtt(k) 27 # define fsahtu(i,j,k) rldf * ahtu(k) 27 # define fsahtu(i,j,k) rldf * ahtu(k) * r_fact_lap(i,j,k) 28 28 # define fsahtv(i,j,k) rldf * ahtv(k) 29 29 # define fsahtw(i,j,k) rldf * ahtw(k) … … 31 31 ! Default option : aht: Constant coefficient 32 32 # define fsahtt(i,j,k) rldf * aht0 33 # define fsahtu(i,j,k) rldf * aht0 33 # define fsahtu(i,j,k) rldf * aht0 * r_fact_lap(i,j,k) 34 34 # define fsahtv(i,j,k) rldf * aht0 35 35 # define fsahtw(i,j,k) rldf * aht0 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/albedo.F90
r7960 r9987 9 9 !! - ! 2001-06 (M. Vancoppenolle) LIM 3.0 10 10 !! - ! 2006-08 (G. Madec) cleaning for surface module 11 !! 3.6 ! 2016-01 (C. Rousset) new parameterization for sea ice albedo 11 12 !!---------------------------------------------------------------------- 12 13 … … 29 30 30 31 INTEGER :: albd_init = 0 !: control flag for initialization 31 REAL(wp) :: zzero = 0.e0 ! constant values32 REAL(wp) :: zone = 1.e0 ! " "33 34 REAL(wp) :: c1 = 0.05 ! constants values35 REAL(wp) :: c2 = 0.10 !" "36 REAL(wp) :: r mue = 0.40 ! cosine of local solar altitude37 32 33 REAL(wp) :: rmue = 0.40 ! cosine of local solar altitude 34 REAL(wp) :: ralb_oce = 0.066 ! ocean or lead albedo (Pegau and Paulson, Ann. Glac. 2001) 35 REAL(wp) :: c1 = 0.05 ! snow thickness (only for nn_ice_alb=0) 36 REAL(wp) :: c2 = 0.10 ! " " 37 REAL(wp) :: rcloud = 0.06 ! cloud effect on albedo (only-for nn_ice_alb=0) 38 38 39 ! !!* namelist namsbc_alb 39 REAL(wp) :: rn_cloud ! cloudiness effect on snow or ice albedo (Grenfell & Perovich, 1984) 40 #if defined key_lim3 41 REAL(wp) :: rn_albice ! albedo of melting ice in the arctic and antarctic (Shine & Hendersson-Sellers) 42 #else 43 REAL(wp) :: rn_albice ! albedo of melting ice in the arctic and antarctic (Shine & Hendersson-Sellers) 44 #endif 45 REAL(wp) :: rn_alphd ! coefficients for linear interpolation used to compute 46 REAL(wp) :: rn_alphdi ! albedo between two extremes values (Pyane, 1972) 47 REAL(wp) :: rn_alphc ! 40 INTEGER :: nn_ice_alb 41 REAL(wp) :: rn_albice 48 42 49 43 !!---------------------------------------------------------------------- … … 59 53 !! 60 54 !! ** Purpose : Computation of the albedo of the snow/ice system 61 !! as well as the ocean one62 55 !! 63 !! ** Method : - Computation of the albedo of snow or ice (choose the 64 !! rignt one by a large number of tests 65 !! - Computation of the albedo of the ocean 66 !! 67 !! References : Shine and Hendersson-Sellers 1985, JGR, 90(D1), 2243-2250. 56 !! ** Method : Two schemes are available (from namelist parameter nn_ice_alb) 57 !! 0: the scheme is that of Shine & Henderson-Sellers (JGR 1985) for clear-skies 58 !! 1: the scheme is "home made" (for cloudy skies) and based on Brandt et al. (J. Climate 2005) 59 !! and Grenfell & Perovich (JGR 2004) 60 !! Description of scheme 1: 61 !! 1) Albedo dependency on ice thickness follows the findings from Brandt et al (2005) 62 !! which are an update of Allison et al. (JGR 1993) ; Brandt et al. 1999 63 !! 0-5cm : linear function of ice thickness 64 !! 5-150cm: log function of ice thickness 65 !! > 150cm: constant 66 !! 2) Albedo dependency on snow thickness follows the findings from Grenfell & Perovich (2004) 67 !! i.e. it increases as -EXP(-snw_thick/0.02) during freezing and -EXP(-snw_thick/0.03) during melting 68 !! 3) Albedo dependency on clouds is speculated from measurements of Grenfell and Perovich (2004) 69 !! i.e. cloudy-clear albedo depend on cloudy albedo following a 2d order polynomial law 70 !! 4) The needed 4 parameters are: dry and melting snow, freezing ice and bare puddled ice 71 !! 72 !! ** Note : The parameterization from Shine & Henderson-Sellers presents several misconstructions: 73 !! 1) ice albedo when ice thick. tends to 0 is different than ocean albedo 74 !! 2) for small ice thick. covered with some snow (<3cm?), albedo is larger 75 !! under melting conditions than under freezing conditions 76 !! 3) the evolution of ice albedo as a function of ice thickness shows 77 !! 3 sharp inflexion points (at 5cm, 100cm and 150cm) that look highly unrealistic 78 !! 79 !! References : Shine & Henderson-Sellers 1985, JGR, 90(D1), 2243-2250. 80 !! Brandt et al. 2005, J. Climate, vol 18 81 !! Grenfell & Perovich 2004, JGR, vol 109 68 82 !!---------------------------------------------------------------------- 69 83 REAL(wp), INTENT(in ), DIMENSION(:,:,:) :: pt_ice ! ice surface temperature (Kelvin) … … 73 87 REAL(wp), INTENT( out), DIMENSION(:,:,:) :: pa_ice_os ! albedo of ice under overcast sky 74 88 !! 75 INTEGER :: ji, jj, jl ! dummy loop indices 76 INTEGER :: ijpl ! number of ice categories (3rd dim of ice input arrays) 77 REAL(wp) :: zalbpsnm ! albedo of ice under clear sky when snow is melting 78 REAL(wp) :: zalbpsnf ! albedo of ice under clear sky when snow is freezing 79 REAL(wp) :: zalbpsn ! albedo of snow/ice system when ice is coverd by snow 80 REAL(wp) :: zalbpic ! albedo of snow/ice system when ice is free of snow 81 REAL(wp) :: zithsn ! = 1 for hsn >= 0 ( ice is cov. by snow ) ; = 0 otherwise (ice is free of snow) 82 REAL(wp) :: zitmlsn ! = 1 freezinz snow (pt_ice >=rt0_snow) ; = 0 melting snow (pt_ice<rt0_snow) 83 REAL(wp) :: zihsc1 ! = 1 hsn <= c1 ; = 0 hsn > c1 84 REAL(wp) :: zihsc2 ! = 1 hsn >= c2 ; = 0 hsn < c2 85 !! 86 REAL(wp), POINTER, DIMENSION(:,:,:) :: zalbfz ! = rn_alphdi for freezing ice ; = rn_albice for melting ice 87 REAL(wp), POINTER, DIMENSION(:,:,:) :: zficeth ! function of ice thickness 89 INTEGER :: ji, jj, jl ! dummy loop indices 90 INTEGER :: ijpl ! number of ice categories (3rd dim of ice input arrays) 91 REAL(wp) :: ralb_im, ralb_sf, ralb_sm, ralb_if 92 REAL(wp) :: zswitch, z1_c1, z1_c2 93 REAL(wp) :: zalb_sm, zalb_sf, zalb_st ! albedo of snow melting, freezing, total 94 REAL(wp), POINTER, DIMENSION(:,:,:) :: zalb, zalb_it ! intermediate variable & albedo of ice (snow free) 88 95 !!--------------------------------------------------------------------- 89 96 90 97 ijpl = SIZE( pt_ice, 3 ) ! number of ice categories 91 92 CALL wrk_alloc( jpi,jpj,ijpl, zalb fz, zficeth)98 99 CALL wrk_alloc( jpi,jpj,ijpl, zalb, zalb_it ) 93 100 94 101 IF( albd_init == 0 ) CALL albedo_init ! initialization 95 102 96 !--------------------------- 97 ! Computation of zficeth 98 !--------------------------- 99 ! ice free of snow and melts 100 WHERE ( ph_snw == 0._wp .AND. pt_ice >= rt0_ice ) ; zalbfz(:,:,:) = rn_albice 101 ELSE WHERE ; zalbfz(:,:,:) = rn_alphdi 102 END WHERE 103 104 WHERE ( 1.5 < ph_ice ) ; zficeth = zalbfz 105 ELSE WHERE( 1.0 < ph_ice .AND. ph_ice <= 1.5 ) ; zficeth = 0.472 + 2.0 * ( zalbfz - 0.472 ) * ( ph_ice - 1.0 ) 106 ELSE WHERE( 0.05 < ph_ice .AND. ph_ice <= 1.0 ) ; zficeth = 0.2467 + 0.7049 * ph_ice & 107 & - 0.8608 * ph_ice * ph_ice & 108 & + 0.3812 * ph_ice * ph_ice * ph_ice 109 ELSE WHERE ; zficeth = 0.1 + 3.6 * ph_ice 110 END WHERE 111 112 !!gm old code 113 ! DO jl = 1, ijpl 114 ! DO jj = 1, jpj 115 ! DO ji = 1, jpi 116 ! IF( ph_ice(ji,jj,jl) > 1.5 ) THEN 117 ! zficeth(ji,jj,jl) = zalbfz(ji,jj,jl) 118 ! ELSEIF( ph_ice(ji,jj,jl) > 1.0 .AND. ph_ice(ji,jj,jl) <= 1.5 ) THEN 119 ! zficeth(ji,jj,jl) = 0.472 + 2.0 * ( zalbfz(ji,jj,jl) - 0.472 ) * ( ph_ice(ji,jj,jl) - 1.0 ) 120 ! ELSEIF( ph_ice(ji,jj,jl) > 0.05 .AND. ph_ice(ji,jj,jl) <= 1.0 ) THEN 121 ! zficeth(ji,jj,jl) = 0.2467 + 0.7049 * ph_ice(ji,jj,jl) & 122 ! & - 0.8608 * ph_ice(ji,jj,jl) * ph_ice(ji,jj,jl) & 123 ! & + 0.3812 * ph_ice(ji,jj,jl) * ph_ice(ji,jj,jl) * ph_ice (ji,jj,jl) 124 ! ELSE 125 ! zficeth(ji,jj,jl) = 0.1 + 3.6 * ph_ice(ji,jj,jl) 126 ! ENDIF 127 ! END DO 128 ! END DO 129 ! END DO 130 !!gm end old code 131 132 !----------------------------------------------- 133 ! Computation of the snow/ice albedo system 134 !-------------------------- --------------------- 135 136 ! Albedo of snow-ice for clear sky. 137 !----------------------------------------------- 138 DO jl = 1, ijpl 139 DO jj = 1, jpj 140 DO ji = 1, jpi 141 ! Case of ice covered by snow. 142 ! ! freezing snow 143 zihsc1 = 1.0 - MAX( zzero , SIGN( zone , - ( ph_snw(ji,jj,jl) - c1 ) ) ) 144 zalbpsnf = ( 1.0 - zihsc1 ) * ( zficeth(ji,jj,jl) & 145 & + ph_snw(ji,jj,jl) * ( rn_alphd - zficeth(ji,jj,jl) ) / c1 ) & 146 & + zihsc1 * rn_alphd 147 ! ! melting snow 148 zihsc2 = MAX( zzero , SIGN( zone , ph_snw(ji,jj,jl) - c2 ) ) 149 zalbpsnm = ( 1.0 - zihsc2 ) * ( rn_albice + ph_snw(ji,jj,jl) * ( rn_alphc - rn_albice ) / c2 ) & 150 & + zihsc2 * rn_alphc 151 ! 152 zitmlsn = MAX( zzero , SIGN( zone , pt_ice(ji,jj,jl) - rt0_snow ) ) 153 zalbpsn = zitmlsn * zalbpsnm + ( 1.0 - zitmlsn ) * zalbpsnf 154 155 ! Case of ice free of snow. 156 zalbpic = zficeth(ji,jj,jl) 157 158 ! albedo of the system 159 zithsn = 1.0 - MAX( zzero , SIGN( zone , - ph_snw(ji,jj,jl) ) ) 160 pa_ice_cs(ji,jj,jl) = zithsn * zalbpsn + ( 1.0 - zithsn ) * zalbpic 103 104 SELECT CASE ( nn_ice_alb ) 105 106 !------------------------------------------ 107 ! Shine and Henderson-Sellers (1985) 108 !------------------------------------------ 109 CASE( 0 ) 110 111 ralb_sf = 0.80 ! dry snow 112 ralb_sm = 0.65 ! melting snow 113 ralb_if = 0.72 ! bare frozen ice 114 ralb_im = rn_albice ! bare puddled ice 115 116 ! Computation of ice albedo (free of snow) 117 WHERE ( ph_snw == 0._wp .AND. pt_ice >= rt0_ice ) ; zalb(:,:,:) = ralb_im 118 ELSE WHERE ; zalb(:,:,:) = ralb_if 119 END WHERE 120 121 WHERE ( 1.5 < ph_ice ) ; zalb_it = zalb 122 ELSE WHERE( 1.0 < ph_ice .AND. ph_ice <= 1.5 ) ; zalb_it = 0.472 + 2.0 * ( zalb - 0.472 ) * ( ph_ice - 1.0 ) 123 ELSE WHERE( 0.05 < ph_ice .AND. ph_ice <= 1.0 ) ; zalb_it = 0.2467 + 0.7049 * ph_ice & 124 & - 0.8608 * ph_ice * ph_ice & 125 & + 0.3812 * ph_ice * ph_ice * ph_ice 126 ELSE WHERE ; zalb_it = 0.1 + 3.6 * ph_ice 127 END WHERE 128 129 DO jl = 1, ijpl 130 DO jj = 1, jpj 131 DO ji = 1, jpi 132 ! freezing snow 133 ! no effect of underlying ice layer IF snow thickness > c1. Albedo does not depend on snow thick if > c2 134 ! ! freezing snow 135 zswitch = 1._wp - MAX( 0._wp , SIGN( 1._wp , - ( ph_snw(ji,jj,jl) - c1 ) ) ) 136 zalb_sf = ( 1._wp - zswitch ) * ( zalb_it(ji,jj,jl) & 137 & + ph_snw(ji,jj,jl) * ( ralb_sf - zalb_it(ji,jj,jl) ) / c1 ) & 138 & + zswitch * ralb_sf 139 140 ! melting snow 141 ! no effect of underlying ice layer. Albedo does not depend on snow thick IF > c2 142 zswitch = MAX( 0._wp , SIGN( 1._wp , ph_snw(ji,jj,jl) - c2 ) ) 143 zalb_sm = ( 1._wp - zswitch ) * ( ralb_im + ph_snw(ji,jj,jl) * ( ralb_sm - ralb_im ) / c2 ) & 144 & + zswitch * ralb_sm 145 ! 146 ! snow albedo 147 zswitch = MAX( 0._wp , SIGN( 1._wp , pt_ice(ji,jj,jl) - rt0_snow ) ) 148 zalb_st = zswitch * zalb_sm + ( 1._wp - zswitch ) * zalb_sf 149 150 ! Ice/snow albedo 151 zswitch = 1._wp - MAX( 0._wp , SIGN( 1._wp , - ph_snw(ji,jj,jl) ) ) 152 pa_ice_cs(ji,jj,jl) = zswitch * zalb_st + ( 1._wp - zswitch ) * zalb_it(ji,jj,jl) 153 ! 154 END DO 161 155 END DO 162 156 END DO 163 END DO 164 165 ! Albedo of snow-ice for overcast sky. 166 !---------------------------------------------- 167 pa_ice_os(:,:,:) = pa_ice_cs(:,:,:) + rn_cloud ! Oberhuber correction 168 ! 169 CALL wrk_dealloc( jpi,jpj,ijpl, zalbfz, zficeth ) 157 158 pa_ice_os(:,:,:) = pa_ice_cs(:,:,:) + rcloud ! Oberhuber correction for overcast sky 159 160 !------------------------------------------ 161 ! New parameterization (2016) 162 !------------------------------------------ 163 CASE( 1 ) 164 165 ralb_im = rn_albice ! bare puddled ice 166 ! compilation of values from literature 167 ralb_sf = 0.85 ! dry snow 168 ralb_sm = 0.75 ! melting snow 169 ralb_if = 0.60 ! bare frozen ice 170 ! Perovich et al 2002 (Sheba) => the only dataset for which all types of ice/snow were retrieved 171 ! ralb_sf = 0.85 ! dry snow 172 ! ralb_sm = 0.72 ! melting snow 173 ! ralb_if = 0.65 ! bare frozen ice 174 ! Brandt et al 2005 (East Antarctica) 175 ! ralb_sf = 0.87 ! dry snow 176 ! ralb_sm = 0.82 ! melting snow 177 ! ralb_if = 0.54 ! bare frozen ice 178 ! 179 ! Computation of ice albedo (free of snow) 180 z1_c1 = 1. / ( LOG(1.5) - LOG(0.05) ) 181 z1_c2 = 1. / 0.05 182 WHERE ( ph_snw == 0._wp .AND. pt_ice >= rt0_ice ) ; zalb = ralb_im 183 ELSE WHERE ; zalb = ralb_if 184 END WHERE 185 186 WHERE ( 1.5 < ph_ice ) ; zalb_it = zalb 187 ELSE WHERE( 0.05 < ph_ice .AND. ph_ice <= 1.5 ) ; zalb_it = zalb + ( 0.18 - zalb ) * z1_c1 * & 188 & ( LOG(1.5) - LOG(ph_ice) ) 189 ELSE WHERE ; zalb_it = ralb_oce + ( 0.18 - ralb_oce ) * z1_c2 * ph_ice 190 END WHERE 191 192 z1_c1 = 1. / 0.02 193 z1_c2 = 1. / 0.03 194 ! Computation of the snow/ice albedo 195 DO jl = 1, ijpl 196 DO jj = 1, jpj 197 DO ji = 1, jpi 198 zalb_sf = ralb_sf - ( ralb_sf - zalb_it(ji,jj,jl)) * EXP( - ph_snw(ji,jj,jl) * z1_c1 ); 199 zalb_sm = ralb_sm - ( ralb_sm - zalb_it(ji,jj,jl)) * EXP( - ph_snw(ji,jj,jl) * z1_c2 ); 200 201 ! snow albedo 202 zswitch = MAX( 0._wp , SIGN( 1._wp , pt_ice(ji,jj,jl) - rt0_snow ) ) 203 zalb_st = zswitch * zalb_sm + ( 1._wp - zswitch ) * zalb_sf 204 205 ! Ice/snow albedo 206 zswitch = MAX( 0._wp , SIGN( 1._wp , - ph_snw(ji,jj,jl) ) ) 207 pa_ice_os(ji,jj,jl) = ( 1._wp - zswitch ) * zalb_st + zswitch * zalb_it(ji,jj,jl) 208 209 END DO 210 END DO 211 END DO 212 ! Effect of the clouds (2d order polynomial) 213 pa_ice_cs = pa_ice_os - ( - 0.1010 * pa_ice_os * pa_ice_os + 0.1933 * pa_ice_os - 0.0148 ); 214 215 END SELECT 216 217 CALL wrk_dealloc( jpi,jpj,ijpl, zalb, zalb_it ) 170 218 ! 171 219 END SUBROUTINE albedo_ice … … 181 229 REAL(wp), DIMENSION(:,:), INTENT(out) :: pa_oce_cs ! albedo of ocean under clear sky 182 230 !! 183 REAL(wp) :: zcoef ! local scalar184 !!---------------------------------------------------------------------- 185 ! 186 zcoef = 0.05 / ( 1.1 * rmue**1.4 + 0.15 ) ! Parameterization of Briegled and Ramanathan, 1982187 pa_oce_cs(:,:) = zcoef 188 pa_oce_os(:,:) = 0.06! Parameterization of Kondratyev, 1969 and Payne, 1972231 REAL(wp) :: zcoef 232 !!---------------------------------------------------------------------- 233 ! 234 zcoef = 0.05 / ( 1.1 * rmue**1.4 + 0.15 ) ! Parameterization of Briegled and Ramanathan, 1982 235 pa_oce_cs(:,:) = zcoef 236 pa_oce_os(:,:) = 0.06 ! Parameterization of Kondratyev, 1969 and Payne, 1972 189 237 ! 190 238 END SUBROUTINE albedo_oce … … 200 248 !!---------------------------------------------------------------------- 201 249 INTEGER :: ios ! Local integer output status for namelist read 202 NAMELIST/namsbc_alb/ rn_cloud, rn_albice, rn_alphd, rn_alphdi, rn_alphc250 NAMELIST/namsbc_alb/ nn_ice_alb, rn_albice 203 251 !!---------------------------------------------------------------------- 204 252 ! … … 219 267 WRITE(numout,*) '~~~~~~~' 220 268 WRITE(numout,*) ' Namelist namsbc_alb : albedo ' 221 WRITE(numout,*) ' correction for snow and ice albedo rn_cloud = ', rn_cloud 222 WRITE(numout,*) ' albedo of melting ice in the arctic and antarctic rn_albice = ', rn_albice 223 WRITE(numout,*) ' coefficients for linear rn_alphd = ', rn_alphd 224 WRITE(numout,*) ' interpolation used to compute albedo rn_alphdi = ', rn_alphdi 225 WRITE(numout,*) ' between two extremes values (Pyane, 1972) rn_alphc = ', rn_alphc 269 WRITE(numout,*) ' choose the albedo parameterization nn_ice_alb = ', nn_ice_alb 270 WRITE(numout,*) ' albedo of bare puddled ice rn_albice = ', rn_albice 226 271 ENDIF 227 272 ! -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/cpl_oasis3.F90
r7960 r9987 31 31 USE in_out_manager ! I/O manager 32 32 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 33 33 34 34 IMPLICIT NONE 35 35 PRIVATE … … 41 41 PUBLIC cpl_freq 42 42 PUBLIC cpl_finalize 43 #if defined key_mpp_mpi 44 INCLUDE 'mpif.h' 45 #endif 46 47 INTEGER, PARAMETER :: localRoot = 0 48 LOGICAL :: commRank ! true for ranks doing OASIS communication 49 #if defined key_cpl_rootexchg 50 LOGICAL :: rootexchg =.true. ! logical switch 51 #else 52 LOGICAL :: rootexchg =.false. ! logical switch 53 #endif 43 54 44 55 INTEGER, PUBLIC :: OASIS_Rcv = 1 !: return code if received field … … 82 93 83 94 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: exfld ! Temporary buffer for receiving 84 95 INTEGER, PUBLIC :: localComm 96 85 97 !!---------------------------------------------------------------------- 86 98 !! NEMO/OPA 3.3 , NEMO Consortium (2010) … … 120 132 IF ( nerror /= OASIS_Ok ) & 121 133 CALL oasis_abort (ncomp_id, 'cpl_init','Failure in oasis_get_localcomm' ) 134 localComm = kl_comm 122 135 ! 123 136 END SUBROUTINE cpl_init … … 177 190 IF( nerror > 0 ) THEN 178 191 CALL oasis_abort ( ncomp_id, 'cpl_define', 'Failure in allocating exfld') ; RETURN 179 ENDIF 192 ENDIF 180 193 ! 181 194 ! ----------------------------------------------------------------- 182 195 ! ... Define the partition 183 196 ! ----------------------------------------------------------------- 184 197 185 198 paral(1) = 2 ! box partitioning 186 199 paral(2) = jpiglo * (nldj-1+njmpp-1) + (nldi-1+nimpp-1) ! NEMO lower left corner global offset … … 196 209 ENDIF 197 210 198 CALL oasis_def_partition ( id_part, paral, nerror 211 CALL oasis_def_partition ( id_part, paral, nerror, jpiglo*jpjglo) 199 212 ! 200 213 ! ... Announce send variables. … … 241 254 END DO 242 255 ENDIF 243 END DO 256 END DO 244 257 ! 245 258 ! ... Announce received variables. … … 373 386 IF( srcv(kid)%nid(jc,jm) /= -1 ) THEN 374 387 375 CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo ) 388 CALL oasis_get ( srcv(kid)%nid(jc,jm), kstep, exfld, kinfo ) 376 389 377 390 llaction = kinfo == OASIS_Recvd .OR. kinfo == OASIS_FromRest .OR. & … … 384 397 kinfo = OASIS_Rcv 385 398 IF( llfisrt ) THEN 386 pdata(nldi:nlei,nldj:nlej,jc) = exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm) 399 pdata(nldi:nlei,nldj:nlej,jc) = exfld(:,:) * pmask(nldi:nlei,nldj:nlej,jm) 387 400 llfisrt = .FALSE. 388 401 ELSE … … 463 476 CALL oasis_get_freqs(id, mop, 1, itmp, info) 464 477 #else 478 #if defined key_oasis3 479 itmp(1) = namflddti( id ) 480 #else 465 481 CALL oasis_get_freqs(id, 1, itmp, info) 482 #endif 466 483 #endif 467 484 cpl_freq = itmp(1) … … 514 531 END SUBROUTINE oasis_get_localcomm 515 532 516 SUBROUTINE oasis_def_partition(k1,k2,k3 )533 SUBROUTINE oasis_def_partition(k1,k2,k3,K4) 517 534 INTEGER , INTENT( out) :: k1,k3 518 535 INTEGER , INTENT(in ) :: k2(5) 536 INTEGER , OPTIONAL, INTENT(in ) :: k4 519 537 k1 = k2(1) ; k3 = k2(5) 520 538 WRITE(numout,*) 'oasis_def_partition: Error you sould not be there...' -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90
r7960 r9987 32 32 PUBLIC fld_map ! routine called by tides_init 33 33 PUBLIC fld_read, fld_fill ! called by sbc... modules 34 PUBLIC fld_clopn 34 35 35 36 TYPE, PUBLIC :: FLD_N !: Namelist field informations … … 815 816 imonth = kmonth 816 817 iday = kday 818 IF ( sdjf%cltype(1:4) == 'week' ) THEN ! find the day of the beginning of the week 819 isec_week = ksec_week( sdjf%cltype(6:8) )- (86400 * 8 ) 820 llprevmth = isec_week > nsec_month ! longer time since beginning of the week than the month 821 llprevyr = llprevmth .AND. nmonth == 1 822 iyear = nyear - COUNT((/llprevyr /)) 823 imonth = nmonth - COUNT((/llprevmth/)) + 12 * COUNT((/llprevyr /)) 824 iday = nday + nmonth_len(nmonth-1) * COUNT((/llprevmth/)) - isec_week / NINT(rday) 825 ENDIF 817 826 ELSE ! use current day values 818 827 IF ( sdjf%cltype(1:4) == 'week' ) THEN ! find the day of the beginning of the week … … 1281 1290 CHARACTER(LEN=*) , INTENT(in ) :: lsmfile ! land sea mask file name 1282 1291 !! 1283 REAL(wp),DIMENSION(:,:,:),ALLOCATABLE :: ztmp_fly_dta ,zfieldo! temporary array of values on input grid1292 REAL(wp),DIMENSION(:,:,:),ALLOCATABLE :: ztmp_fly_dta ! temporary array of values on input grid 1284 1293 INTEGER, DIMENSION(3) :: rec1,recn ! temporary arrays for start and length 1285 1294 INTEGER, DIMENSION(3) :: rec1_lsm,recn_lsm ! temporary arrays for start and length in case of seaoverland … … 1347 1356 1348 1357 1349 itmpi= SIZE(ztmp_fly_dta(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:),1)1350 itmpj= SIZE(ztmp_fly_dta(jpi1_lsm:jpi2_lsm,jpj1_lsm:jpj2_lsm,:),2)1358 itmpi=jpi2_lsm-jpi1_lsm+1 1359 itmpj=jpj2_lsm-jpj1_lsm+1 1351 1360 itmpz=kk 1352 1361 ALLOCATE(ztmp_fly_dta(itmpi,itmpj,itmpz)) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/geo2ocean.F90
r7960 r9987 51 51 52 52 SUBROUTINE repcmo ( pxu1, pyu1, pxv1, pyv1, & 53 px2 , py2 )53 px2 , py2 , kchoix ) 54 54 !!---------------------------------------------------------------------- 55 55 !! *** ROUTINE repcmo *** … … 68 68 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: py2 ! j-componante (defined at v-point) 69 69 !!---------------------------------------------------------------------- 70 71 ! Change from geographic to stretched coordinate 72 ! ---------------------------------------------- 73 CALL rot_rep( pxu1, pyu1, 'U', 'en->i',px2 ) 74 CALL rot_rep( pxv1, pyv1, 'V', 'en->j',py2 ) 75 70 INTEGER, INTENT( IN ) :: & 71 kchoix ! type of transformation 72 ! = 1 change from geographic to model grid. 73 ! =-1 change from model to geographic grid 74 !!---------------------------------------------------------------------- 75 76 SELECT CASE (kchoix) 77 CASE ( 1) 78 ! Change from geographic to stretched coordinate 79 ! ---------------------------------------------- 80 81 CALL rot_rep( pxu1, pyu1, 'U', 'en->i',px2 ) 82 CALL rot_rep( pxv1, pyv1, 'V', 'en->j',py2 ) 83 CASE (-1) 84 ! Change from stretched to geographic coordinate 85 ! ---------------------------------------------- 86 87 CALL rot_rep( pxu1, pyu1, 'U', 'ij->e',px2 ) 88 CALL rot_rep( pxv1, pyv1, 'V', 'ij->n',py2 ) 89 END SELECT 90 76 91 END SUBROUTINE repcmo 77 92 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90
r7960 r9987 80 80 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qemp_oce !: heat flux of precip and evap over ocean [W/m2] 81 81 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qemp_ice !: heat flux of precip and evap over ice [W/m2] 82 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qprec_ice !: heat flux of precip over ice [J/m3] 82 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: qevap_ice !: heat flux of evap over ice [W/m2] 83 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qprec_ice !: enthalpy of precip over ice [J/m3] 83 84 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: emp_oce !: evap - precip over ocean [kg/m2/s] 84 85 #endif … … 101 102 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: fr_iu !: ice fraction at NEMO U point 102 103 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: fr_iv !: ice fraction at NEMO V point 103 104 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sstfrz !: sea surface freezing temperature 105 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tsfc_ice !: sea-ice surface skin temperature (on categories) 106 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: kn_ice !: sea-ice surface layer thermal conductivity (on cats) 107 104 108 ! variables used in the coupled interface 105 109 INTEGER , PUBLIC, PARAMETER :: jpl = ncat 106 110 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: u_ice, v_ice ! jpi, jpj 111 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: a_p, ht_p ! Meltpond fraction and depth 112 113 ! 114 115 ! 116 #if defined key_asminc 117 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ndaice_da !: NEMO fresh water flux to ocean due to data assim 118 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nfresh_da !: NEMO salt flux to ocean due to data assim 119 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nfsalt_da !: NEMO ice concentration change/second from data assim 120 #endif 121 107 122 #endif 108 123 … … 144 159 #endif 145 160 #if defined key_lim3 146 & evap_ice(jpi,jpj,jpl) , devap_ice(jpi,jpj,jpl) , qprec_ice(jpi,jpj) , &147 & qemp_ice(jpi,jpj) , qe mp_oce(jpi,jpj) ,&148 & qns_oce (jpi,jpj) , qsr_oce (jpi,jpj) , emp_oce (jpi,jpj) ,&161 & evap_ice(jpi,jpj,jpl) , devap_ice(jpi,jpj,jpl) , qprec_ice(jpi,jpj) , & 162 & qemp_ice(jpi,jpj) , qevap_ice(jpi,jpj,jpl) , qemp_oce (jpi,jpj) , & 163 & qns_oce (jpi,jpj) , qsr_oce (jpi,jpj) , emp_oce (jpi,jpj) , & 149 164 #endif 150 165 & emp_ice(jpi,jpj) , STAT= ierr(1) ) … … 152 167 153 168 #if defined key_cice 154 ALLOCATE( qla_ice(jpi,jpj, 1), qlw_ice(jpi,jpj,1) , qsr_ice(jpi,jpj,1) , &169 ALLOCATE( qla_ice(jpi,jpj,ncat) , qlw_ice(jpi,jpj,1) , qsr_ice(jpi,jpj,1) , & 155 170 wndi_ice(jpi,jpj) , tatm_ice(jpi,jpj) , qatm_ice(jpi,jpj) , & 156 171 wndj_ice(jpi,jpj) , nfrzmlt(jpi,jpj) , ss_iou(jpi,jpj) , & 157 172 ss_iov(jpi,jpj) , fr_iu(jpi,jpj) , fr_iv(jpi,jpj) , & 158 173 a_i(jpi,jpj,ncat) , topmelt(jpi,jpj,ncat) , botmelt(jpi,jpj,ncat) , & 159 STAT= ierr(1) ) 160 IF( ln_cpl ) ALLOCATE( u_ice(jpi,jpj) , fr1_i0(jpi,jpj) , tn_ice (jpi,jpj,1) , & 174 #if defined key_asminc 175 ndaice_da(jpi,jpj) , nfresh_da(jpi,jpj) , nfsalt_da(jpi,jpj) , & 176 #endif 177 sstfrz(jpi,jpj) , STAT= ierr(1) ) 178 ! Alex West: Allocating tn_ice with 5 categories. When NEMO is used with CICE, this variable 179 ! represents top layer ice temperature, which is multi-category. 180 IF( ln_cpl ) ALLOCATE( u_ice(jpi,jpj) , fr1_i0(jpi,jpj) , tn_ice (jpi,jpj,jpl) , & 161 181 & v_ice(jpi,jpj) , fr2_i0(jpi,jpj) , alb_ice(jpi,jpj,1) , & 162 182 & emp_ice(jpi,jpj) , qns_ice(jpi,jpj,1) , dqns_ice(jpi,jpj,1) , & 163 & STAT= ierr(2) ) 183 & a_p(jpi,jpj,jpl) , ht_p(jpi,jpj,jpl) , tsfc_ice(jpi,jpj,jpl) , & 184 & kn_ice(jpi,jpj,jpl) , STAT=ierr(2) ) 164 185 165 186 #endif -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90
r7960 r9987 125 125 #endif 126 126 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: xcplmask !: coupling mask for ln_mixcpl (warning: allocated in sbccpl) 127 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: greenland_icesheet_mass_array, greenland_icesheet_mask 128 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: antarctica_icesheet_mass_array, antarctica_icesheet_mask 127 129 128 130 !!---------------------------------------------------------------------- … … 137 139 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: e3t_m !: mean (nn_fsbc time-step) sea surface layer thickness [m] 138 140 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: frq_m !: mean (nn_fsbc time-step) fraction of solar net radiation absorbed in the 1st T level [-] 141 142 !!---------------------------------------------------------------------- 143 !! Surface scalars of total ice sheet mass for Greenland and Antarctica, 144 !! passed from atmosphere to be converted to dvol and hence a freshwater 145 !! flux by using old values. New values are saved in the dump, to become 146 !! old values next coupling timestep. Freshwater fluxes split between 147 !! sub iceshelf melting and iceberg calving, scalled to flux per second 148 !!---------------------------------------------------------------------- 149 150 REAL(wp), PUBLIC :: greenland_icesheet_mass, greenland_icesheet_mass_rate_of_change, greenland_icesheet_timelapsed 151 REAL(wp), PUBLIC :: antarctica_icesheet_mass, antarctica_icesheet_mass_rate_of_change, antarctica_icesheet_timelapsed 152 153 ! sbccpl namelist parameters associated with icesheet freshwater input code. Included here rather than in sbccpl.F90 to 154 ! avoid circular dependencies. 155 INTEGER, PUBLIC :: nn_coupled_iceshelf_fluxes ! =0 : total freshwater input from iceberg calving and ice shelf basal melting 156 ! taken from climatologies used (no action in coupling routines). 157 ! =1 : use rate of change of mass of Greenland and Antarctic icesheets to set the 158 ! combined magnitude of the iceberg calving and iceshelf melting freshwater fluxes. 159 ! =2 : specify constant freshwater inputs in this namelist to set the combined 160 ! magnitude of iceberg calving and iceshelf melting freshwater fluxes. 161 LOGICAL, PUBLIC :: ln_iceshelf_init_atmos ! If true force ocean to initialise iceshelf masses from atmospheric values rather 162 ! than values in ocean restart (applicable if nn_coupled_iceshelf_fluxes=1). 163 REAL(wp), PUBLIC :: rn_greenland_total_fw_flux ! Constant total rate of freshwater input (kg/s) for Greenland (if nn_coupled_iceshelf_fluxes=2) 164 REAL(wp), PUBLIC :: rn_greenland_calving_fraction ! Set fraction of total freshwater flux for iceberg calving - remainder goes to iceshelf melting. 165 REAL(wp), PUBLIC :: rn_antarctica_total_fw_flux ! Constant total rate of freshwater input (kg/s) for Antarctica (if nn_coupled_iceshelf_fluxes=2) 166 REAL(wp), PUBLIC :: rn_antarctica_calving_fraction ! Set fraction of total freshwater flux for iceberg calving - remainder goes to iceshelf melting. 167 REAL(wp), PUBLIC :: rn_iceshelf_fluxes_tolerance ! Absolute tolerance for detecting differences in icesheet masses. 139 168 140 169 !! * Substitutions … … 172 201 & ssu_m (jpi,jpj) , sst_m(jpi,jpj) , frq_m(jpi,jpj) , & 173 202 & ssv_m (jpi,jpj) , sss_m(jpi,jpj) , ssh_m(jpi,jpj) , STAT=ierr(4) ) 203 ALLOCATE( greenland_icesheet_mass_array(jpi,jpj) , antarctica_icesheet_mass_array(jpi,jpj) ) 204 ALLOCATE( greenland_icesheet_mask(jpi,jpj) , antarctica_icesheet_mask(jpi,jpj) ) 174 205 ! 175 206 #if defined key_vvl -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90
r7960 r9987 684 684 qprec_ice(:,:) = rhosn * ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus ) 685 685 686 ! --- heat content of evap over ice in W/m2 (to be used in 1D-thermo) --- ! 687 DO jl = 1, jpl 688 qevap_ice(:,:,jl) = 0._wp ! should be -evap_ice(:,:,jl)*( ( Tice - rt0 ) * cpic * tmask(:,:,1) - lfus ) 689 ! but then qemp_ice should also include sublimation 690 END DO 691 686 692 CALL wrk_dealloc( jpi,jpj, zevap, zsnw ) 687 693 #endif -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90
r7960 r9987 91 91 REAL(wp) :: rn_zqt ! z(q,t) : height of humidity and temperature measurements 92 92 REAL(wp) :: rn_zu ! z(u) : height of wind measurements 93 REAL(wp), PUBLIC :: rn_sfac ! multiplication factor for snow precipitation over sea-ice 93 94 94 95 !! * Substitutions … … 151 152 & sn_wndi, sn_wndj, sn_humi , sn_qsr , & 152 153 & sn_qlw , sn_tair, sn_prec , sn_snow, & 153 & sn_tdif, rn_zqt, rn_zu 154 & sn_tdif, rn_zqt, rn_zu, rn_sfac 154 155 !!--------------------------------------------------------------------- 155 156 ! … … 158 159 ! ! ====================== ! 159 160 ! 161 rn_sfac = 1._wp ! Default to one if missing from namelist 160 162 REWIND( numnam_ref ) ! Namelist namsbc_core in reference namelist : CORE bulk parameters 161 163 READ ( numnam_ref, namsbc_core, IOSTAT = ios, ERR = 901) … … 206 208 IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN 207 209 qlw_ice(:,:,1) = sf(jp_qlw)%fnow(:,:,1) 208 qsr_ice(:,:,1) = sf(jp_qsr)%fnow(:,:,1) 210 IF( ln_dm2dc ) THEN ; qsr_ice(:,:,1) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) 211 ELSE ; qsr_ice(:,:,1) = sf(jp_qsr)%fnow(:,:,1) 212 ENDIF 209 213 tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1) 210 214 qatm_ice(:,:) = sf(jp_humi)%fnow(:,:,1) … … 403 407 CALL iom_put( "qsr_oce" , qsr ) ! output downward solar heat over the ocean 404 408 CALL iom_put( "qt_oce" , qns+qsr ) ! output total downward heat over the ocean 409 tprecip(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac ! output total precipitation [kg/m2/s] 410 sprecip(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac ! output solid precipitation [kg/m2/s] 411 CALL iom_put( 'snowpre', sprecip * 86400. ) ! Snow 412 CALL iom_put( 'precip' , tprecip * 86400. ) ! Total precipitation 405 413 ENDIF 406 414 ! … … 608 616 ! --- evaporation --- ! 609 617 z1_lsub = 1._wp / Lsub 610 evap_ice (:,:,:) = qla_ice (:,:,:) * z1_lsub! sublimation611 devap_ice(:,:,:) = dqla_ice(:,:,:) * z1_lsub612 zevap (:,:) = emp(:,:) + tprecip(:,:)! evaporation over ocean618 evap_ice (:,:,:) = rn_efac * qla_ice (:,:,:) * z1_lsub ! sublimation 619 devap_ice(:,:,:) = rn_efac * dqla_ice(:,:,:) * z1_lsub ! d(sublimation)/dT 620 zevap (:,:) = rn_efac * ( emp(:,:) + tprecip(:,:) ) ! evaporation over ocean 613 621 614 622 ! --- evaporation minus precipitation --- ! … … 633 641 ! --- heat content of precip over ice in J/m3 (to be used in 1D-thermo) --- ! 634 642 qprec_ice(:,:) = rhosn * ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus ) 643 644 ! --- heat content of evap over ice in W/m2 (to be used in 1D-thermo) --- ! 645 DO jl = 1, jpl 646 qevap_ice(:,:,jl) = 0._wp ! should be -evap_ice(:,:,jl)*( ( Tice - rt0 ) * cpic * tmask(:,:,1) ) 647 ! But we do not have Tice => consider it at 0°C => evap=0 648 END DO 635 649 636 650 CALL wrk_dealloc( jpi,jpj, zevap, zsnw ) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
r7960 r9987 33 33 USE cpl_oasis3 ! OASIS3 coupling 34 34 USE geo2ocean ! 35 USE oce , ONLY : tsn, un, vn, sshn, ub, vb, sshb, fraqsr_1lev 35 USE oce , ONLY : tsn, un, vn, sshn, ub, vb, sshb, fraqsr_1lev, & 36 CO2Flux_out_cpl, DMS_out_cpl, chloro_out_cpl, & 37 PCO2a_in_cpl, Dust_in_cpl, & 38 ln_medusa 36 39 USE albedo ! 37 40 USE in_out_manager ! I/O manager … … 46 49 USE p4zflx, ONLY : oce_co2 47 50 #endif 48 #if defined key_cice49 USE ice_domain_size, only: ncat50 #endif51 51 #if defined key_lim3 52 52 USE limthd_dh ! for CALL lim_thd_snwblow 53 53 #endif 54 USE lib_fortran, ONLY: glob_sum 54 55 55 56 IMPLICIT NONE … … 105 106 INTEGER, PARAMETER :: jpr_e3t1st = 41 ! first T level thickness 106 107 INTEGER, PARAMETER :: jpr_fraqsr = 42 ! fraction of solar net radiation absorbed in the first ocean level 107 INTEGER, PARAMETER :: jprcv = 42 ! total number of fields received 108 INTEGER, PARAMETER :: jpr_ts_ice = 43 ! skin temperature of sea-ice (used for melt-ponds) 109 INTEGER, PARAMETER :: jpr_grnm = 44 ! Greenland ice mass 110 INTEGER, PARAMETER :: jpr_antm = 45 ! Antarctic ice mass 111 INTEGER, PARAMETER :: jpr_atm_pco2 = 46 ! Incoming atm CO2 flux 112 INTEGER, PARAMETER :: jpr_atm_dust = 47 ! Incoming atm aggregate dust 113 INTEGER, PARAMETER :: jprcv = 47 ! total number of fields received 108 114 109 115 INTEGER, PARAMETER :: jps_fice = 1 ! ice fraction sent to the atmosphere … … 135 141 INTEGER, PARAMETER :: jps_e3t1st = 27 ! first level depth (vvl) 136 142 INTEGER, PARAMETER :: jps_fraqsr = 28 ! fraction of solar net radiation absorbed in the first ocean level 137 INTEGER, PARAMETER :: jpsnd = 28 ! total number of fields sended 143 INTEGER, PARAMETER :: jps_a_p = 29 ! meltpond fraction 144 INTEGER, PARAMETER :: jps_ht_p = 30 ! meltpond depth (m) 145 INTEGER, PARAMETER :: jps_kice = 31 ! ice surface layer thermal conductivity 146 INTEGER, PARAMETER :: jps_sstfrz = 32 ! sea-surface freezing temperature 147 INTEGER, PARAMETER :: jps_fice1 = 33 ! first-order ice concentration (for time-travelling ice coupling) 148 INTEGER, PARAMETER :: jps_bio_co2 = 34 ! MEDUSA air-sea CO2 flux 149 INTEGER, PARAMETER :: jps_bio_dms = 35 ! MEDUSA DMS surface concentration 150 INTEGER, PARAMETER :: jps_bio_chloro = 36 ! MEDUSA chlorophyll surface concentration 151 INTEGER, PARAMETER :: jpsnd = 36 ! total number of fields sent 152 153 REAL(wp), PARAMETER :: dms_unit_conv = 1.0e+6 ! Coversion factor to get outgong DMS in standard units for coupling 154 ! i.e. specifically nmol/L (= umol/m3) 138 155 139 156 ! !!** namelist namsbc_cpl ** … … 146 163 END TYPE FLD_C 147 164 ! Send to the atmosphere ! 148 TYPE(FLD_C) :: sn_snd_temp, sn_snd_alb, sn_snd_thick, sn_snd_crt, sn_snd_co2 165 TYPE(FLD_C) :: sn_snd_temp, sn_snd_alb, sn_snd_thick, sn_snd_crt, sn_snd_co2, sn_snd_cond, sn_snd_mpnd, sn_snd_sstfrz, sn_snd_thick1 166 TYPE(FLD_C) :: sn_snd_bio_co2, sn_snd_bio_dms, sn_snd_bio_chloro 167 149 168 ! Received from the atmosphere ! 150 169 TYPE(FLD_C) :: sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau, sn_rcv_dqnsdt, sn_rcv_qsr, sn_rcv_qns, sn_rcv_emp, sn_rcv_rnf 151 TYPE(FLD_C) :: sn_rcv_cal, sn_rcv_iceflx, sn_rcv_co2 170 TYPE(FLD_C) :: sn_rcv_cal, sn_rcv_iceflx, sn_rcv_co2, sn_rcv_ts_ice, sn_rcv_grnm, sn_rcv_antm 171 TYPE(FLD_C) :: sn_rcv_atm_pco2, sn_rcv_atm_dust 172 152 173 ! Other namelist parameters ! 153 174 INTEGER :: nn_cplmodel ! Maximum number of models to/from which NEMO is potentialy sending/receiving data … … 188 209 ALLOCATE( a_i(jpi,jpj,1) , STAT=ierr(2) ) ! used in sbcice_if.F90 (done here as there is no sbc_ice_if_init) 189 210 #endif 190 ALLOCATE( xcplmask(jpi,jpj,0:nn_cplmodel) , STAT=ierr(3) ) 211 !ALLOCATE( xcplmask(jpi,jpj,0:nn_cplmodel) , STAT=ierr(3) ) 212 ! Hardwire only two models as nn_cplmodel has not been read in 213 ! from the namelist yet. 214 ALLOCATE( xcplmask(jpi,jpj,0:2) , STAT=ierr(3) ) 191 215 ! 192 216 sbc_cpl_alloc = MAXVAL( ierr ) … … 216 240 REAL(wp), POINTER, DIMENSION(:,:) :: zacs, zaos 217 241 !! 218 NAMELIST/namsbc_cpl/ sn_snd_temp, sn_snd_alb , sn_snd_thick, sn_snd_crt , sn_snd_co2, & 219 & sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau , sn_rcv_dqnsdt, sn_rcv_qsr, & 220 & sn_rcv_qns , sn_rcv_emp , sn_rcv_rnf , sn_rcv_cal , sn_rcv_iceflx, & 221 & sn_rcv_co2 , nn_cplmodel , ln_usecplmask 242 NAMELIST/namsbc_cpl/ sn_snd_temp, sn_snd_alb , sn_snd_thick , sn_snd_crt , sn_snd_co2, & 243 & sn_snd_cond, sn_snd_mpnd , sn_snd_sstfrz, sn_snd_thick1, & 244 & sn_rcv_w10m, sn_rcv_taumod, sn_rcv_tau , sn_rcv_dqnsdt, sn_rcv_qsr, & 245 & sn_rcv_qns , sn_rcv_emp , sn_rcv_rnf , sn_rcv_cal , sn_rcv_iceflx, & 246 & sn_rcv_co2 , sn_rcv_grnm , sn_rcv_antm , sn_rcv_ts_ice, nn_cplmodel , & 247 & ln_usecplmask, nn_coupled_iceshelf_fluxes, ln_iceshelf_init_atmos, & 248 & rn_greenland_total_fw_flux, rn_greenland_calving_fraction, & 249 & rn_antarctica_total_fw_flux, rn_antarctica_calving_fraction, rn_iceshelf_fluxes_tolerance 222 250 !!--------------------------------------------------------------------- 251 252 ! Add MEDUSA related fields to namelist 253 NAMELIST/namsbc_cpl/ sn_snd_bio_co2, sn_snd_bio_dms, sn_snd_bio_chloro, & 254 & sn_rcv_atm_pco2, sn_rcv_atm_dust 255 256 !!--------------------------------------------------------------------- 257 223 258 ! 224 259 IF( nn_timing == 1 ) CALL timing_start('sbc_cpl_init') … … 245 280 ENDIF 246 281 IF( lwp .AND. ln_cpl ) THEN ! control print 247 WRITE(numout,*)' received fields (mutiple ice catego gies)'282 WRITE(numout,*)' received fields (mutiple ice categories)' 248 283 WRITE(numout,*)' 10m wind module = ', TRIM(sn_rcv_w10m%cldes ), ' (', TRIM(sn_rcv_w10m%clcat ), ')' 249 284 WRITE(numout,*)' stress module = ', TRIM(sn_rcv_taumod%cldes), ' (', TRIM(sn_rcv_taumod%clcat), ')' … … 258 293 WRITE(numout,*)' runoffs = ', TRIM(sn_rcv_rnf%cldes ), ' (', TRIM(sn_rcv_rnf%clcat ), ')' 259 294 WRITE(numout,*)' calving = ', TRIM(sn_rcv_cal%cldes ), ' (', TRIM(sn_rcv_cal%clcat ), ')' 295 WRITE(numout,*)' Greenland ice mass = ', TRIM(sn_rcv_grnm%cldes ), ' (', TRIM(sn_rcv_grnm%clcat ), ')' 296 WRITE(numout,*)' Antarctica ice mass = ', TRIM(sn_rcv_antm%cldes ), ' (', TRIM(sn_rcv_antm%clcat ), ')' 260 297 WRITE(numout,*)' sea ice heat fluxes = ', TRIM(sn_rcv_iceflx%cldes), ' (', TRIM(sn_rcv_iceflx%clcat), ')' 261 298 WRITE(numout,*)' atm co2 = ', TRIM(sn_rcv_co2%cldes ), ' (', TRIM(sn_rcv_co2%clcat ), ')' 299 WRITE(numout,*)' atm pco2 = ', TRIM(sn_rcv_atm_pco2%cldes), ' (', TRIM(sn_rcv_atm_pco2%clcat), ')' 300 WRITE(numout,*)' atm dust = ', TRIM(sn_rcv_atm_dust%cldes), ' (', TRIM(sn_rcv_atm_dust%clcat), ')' 262 301 WRITE(numout,*)' sent fields (multiple ice categories)' 263 302 WRITE(numout,*)' surface temperature = ', TRIM(sn_snd_temp%cldes ), ' (', TRIM(sn_snd_temp%clcat ), ')' … … 268 307 WRITE(numout,*)' - orientation = ', sn_snd_crt%clvor 269 308 WRITE(numout,*)' - mesh = ', sn_snd_crt%clvgrd 309 WRITE(numout,*)' bio co2 flux = ', TRIM(sn_snd_bio_co2%cldes), ' (', TRIM(sn_snd_bio_co2%clcat), ')' 310 WRITE(numout,*)' bio dms flux = ', TRIM(sn_snd_bio_dms%cldes), ' (', TRIM(sn_snd_bio_dms%clcat), ')' 311 WRITE(numout,*)' bio dms chlorophyll = ', TRIM(sn_snd_bio_chloro%cldes), ' (', TRIM(sn_snd_bio_chloro%clcat), ')' 270 312 WRITE(numout,*)' oce co2 flux = ', TRIM(sn_snd_co2%cldes ), ' (', TRIM(sn_snd_co2%clcat ), ')' 313 WRITE(numout,*)' ice effective conductivity = ', TRIM(sn_snd_cond%cldes ), ' (', TRIM(sn_snd_cond%clcat ), ')' 314 WRITE(numout,*)' meltponds fraction & depth = ', TRIM(sn_snd_mpnd%cldes ), ' (', TRIM(sn_snd_mpnd%clcat ), ')' 315 WRITE(numout,*)' sea surface freezing temp = ', TRIM(sn_snd_sstfrz%cldes ), ' (', TRIM(sn_snd_sstfrz%clcat ), ')' 316 271 317 WRITE(numout,*)' nn_cplmodel = ', nn_cplmodel 272 318 WRITE(numout,*)' ln_usecplmask = ', ln_usecplmask 319 WRITE(numout,*)' nn_coupled_iceshelf_fluxes = ', nn_coupled_iceshelf_fluxes 320 WRITE(numout,*)' ln_iceshelf_init_atmos = ', ln_iceshelf_init_atmos 321 WRITE(numout,*)' rn_greenland_total_fw_flux = ', rn_greenland_total_fw_flux 322 WRITE(numout,*)' rn_antarctica_total_fw_flux = ', rn_antarctica_total_fw_flux 323 WRITE(numout,*)' rn_greenland_calving_fraction = ', rn_greenland_calving_fraction 324 WRITE(numout,*)' rn_antarctica_calving_fraction = ', rn_antarctica_calving_fraction 325 WRITE(numout,*)' rn_iceshelf_fluxes_tolerance = ', rn_iceshelf_fluxes_tolerance 273 326 ENDIF 274 327 275 328 ! ! allocate sbccpl arrays 276 IF( sbc_cpl_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' )329 !IF( sbc_cpl_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' ) 277 330 278 331 ! ================================ ! … … 337 390 srcv(jpr_otx2:jpr_otz2)%clgrid = 'V' ! and V-point 338 391 srcv(jpr_itx1:jpr_itz1)%clgrid = 'F' ! ice components given at F-point 339 srcv(jpr_otx1:jpr_otz2)%laction = .TRUE. ! receive oce components on grid 1 & 2 392 !srcv(jpr_otx1:jpr_otz2)%laction = .TRUE. ! receive oce components on grid 1 & 2 393 ! Currently needed for HadGEM3 - but shouldn't affect anyone else for the moment 394 srcv(jpr_otx1)%laction = .TRUE. 395 srcv(jpr_oty1)%laction = .TRUE. 396 ! 340 397 srcv(jpr_itx1:jpr_itz1)%laction = .TRUE. ! receive ice components on grid 1 only 341 398 CASE( 'T,I' ) … … 383 440 srcv(jpr_snow)%clname = 'OTotSnow' ! Snow = solid precipitation 384 441 srcv(jpr_tevp)%clname = 'OTotEvap' ! total evaporation (over oce + ice sublimation) 385 srcv(jpr_ievp)%clname = 'OIceEv ap' ! evaporation over ice = sublimation442 srcv(jpr_ievp)%clname = 'OIceEvp' ! evaporation over ice = sublimation 386 443 srcv(jpr_sbpr)%clname = 'OSubMPre' ! sublimation - liquid precipitation - solid precipitation 387 444 srcv(jpr_semp)%clname = 'OISubMSn' ! ice solid water budget = sublimation - solid precipitation … … 396 453 CASE default ; CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_rcv_emp%cldes' ) 397 454 END SELECT 398 455 !Set the number of categories for coupling of sublimation 456 IF ( TRIM( sn_rcv_emp%clcat ) == 'yes' ) srcv(jpr_ievp)%nct = jpl 457 ! 399 458 ! ! ------------------------- ! 400 459 ! ! Runoffs & Calving ! … … 410 469 ! 411 470 srcv(jpr_cal )%clname = 'OCalving' ; IF( TRIM( sn_rcv_cal%cldes ) == 'coupled' ) srcv(jpr_cal)%laction = .TRUE. 471 srcv(jpr_grnm )%clname = 'OGrnmass' ; IF( TRIM( sn_rcv_grnm%cldes ) == 'coupled' ) srcv(jpr_grnm)%laction = .TRUE. 472 srcv(jpr_antm )%clname = 'OAntmass' ; IF( TRIM( sn_rcv_antm%cldes ) == 'coupled' ) srcv(jpr_antm)%laction = .TRUE. 473 412 474 413 475 ! ! ------------------------- ! … … 470 532 ! ! ------------------------- ! 471 533 srcv(jpr_co2 )%clname = 'O_AtmCO2' ; IF( TRIM(sn_rcv_co2%cldes ) == 'coupled' ) srcv(jpr_co2 )%laction = .TRUE. 534 535 536 ! ! --------------------------------------- ! 537 ! ! Incoming CO2 and DUST fluxes for MEDUSA ! 538 ! ! --------------------------------------- ! 539 srcv(jpr_atm_pco2)%clname = 'OATMPCO2' 540 541 IF (TRIM(sn_rcv_atm_pco2%cldes) == 'medusa') THEN 542 srcv(jpr_atm_pco2)%laction = .TRUE. 543 END IF 544 545 srcv(jpr_atm_dust)%clname = 'OATMDUST' 546 IF (TRIM(sn_rcv_atm_dust%cldes) == 'medusa') THEN 547 srcv(jpr_atm_dust)%laction = .TRUE. 548 END IF 549 472 550 ! ! ------------------------- ! 473 551 ! ! topmelt and botmelt ! … … 483 561 srcv(jpr_topm:jpr_botm)%laction = .TRUE. 484 562 ENDIF 563 564 #if defined key_cice && ! defined key_cice4 565 ! ! ----------------------------- ! 566 ! ! sea-ice skin temperature ! 567 ! ! used in meltpond scheme ! 568 ! ! May be calculated in Atm ! 569 ! ! ----------------------------- ! 570 srcv(jpr_ts_ice)%clname = 'OTsfIce' 571 IF ( TRIM( sn_rcv_ts_ice%cldes ) == 'ice' ) srcv(jpr_ts_ice)%laction = .TRUE. 572 IF ( TRIM( sn_rcv_ts_ice%clcat ) == 'yes' ) srcv(jpr_ts_ice)%nct = jpl 573 !TODO: Should there be a consistency check here? 574 #endif 575 485 576 ! ! ------------------------------- ! 486 577 ! ! OPA-SAS coupling - rcv by opa ! … … 600 691 ! ! ------------------------- ! 601 692 ssnd(jps_toce)%clname = 'O_SSTSST' 602 ssnd(jps_tice)%clname = 'O _TepIce'693 ssnd(jps_tice)%clname = 'OTepIce' 603 694 ssnd(jps_tmix)%clname = 'O_TepMix' 604 695 SELECT CASE( TRIM( sn_snd_temp%cldes ) ) 605 696 CASE( 'none' ) ! nothing to do 606 697 CASE( 'oce only' ) ; ssnd( jps_toce )%laction = .TRUE. 607 CASE( 'oce and ice' , 'weighted oce and ice' )698 CASE( 'oce and ice' , 'weighted oce and ice' , 'oce and weighted ice') 608 699 ssnd( (/jps_toce, jps_tice/) )%laction = .TRUE. 609 700 IF ( TRIM( sn_snd_temp%clcat ) == 'yes' ) ssnd(jps_tice)%nct = jpl … … 634 725 635 726 ! ! ------------------------- ! 636 ! ! Ice fraction & Thickness !727 ! ! Ice fraction & Thickness 637 728 ! ! ------------------------- ! 638 729 ssnd(jps_fice)%clname = 'OIceFrc' 639 730 ssnd(jps_hice)%clname = 'OIceTck' 640 731 ssnd(jps_hsnw)%clname = 'OSnwTck' 732 ssnd(jps_a_p)%clname = 'OPndFrc' 733 ssnd(jps_ht_p)%clname = 'OPndTck' 734 ssnd(jps_fice1)%clname = 'OIceFrd' 641 735 IF( k_ice /= 0 ) THEN 642 736 ssnd(jps_fice)%laction = .TRUE. ! if ice treated in the ocean (even in climato case) 737 ssnd(jps_fice1)%laction = .TRUE. ! First-order regridded ice concentration, to be used 738 ! in producing atmos-to-ice fluxes 643 739 ! Currently no namelist entry to determine sending of multi-category ice fraction so use the thickness entry for now 644 740 IF ( TRIM( sn_snd_thick%clcat ) == 'yes' ) ssnd(jps_fice)%nct = jpl 741 IF ( TRIM( sn_snd_thick1%clcat ) == 'yes' ) ssnd(jps_fice1)%nct = jpl 645 742 ENDIF 646 743 … … 657 754 CASE default ; CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_thick%cldes' ) 658 755 END SELECT 756 757 ! ! ------------------------- ! 758 ! ! Ice Meltponds ! 759 ! ! ------------------------- ! 760 #if defined key_cice && ! defined key_cice4 761 ! Meltponds only CICE5 762 ssnd(jps_a_p)%clname = 'OPndFrc' 763 ssnd(jps_ht_p)%clname = 'OPndTck' 764 SELECT CASE ( TRIM( sn_snd_mpnd%cldes ) ) 765 CASE ( 'none' ) 766 ssnd(jps_a_p)%laction = .FALSE. 767 ssnd(jps_ht_p)%laction = .FALSE. 768 CASE ( 'ice only' ) 769 ssnd(jps_a_p)%laction = .TRUE. 770 ssnd(jps_ht_p)%laction = .TRUE. 771 IF ( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN 772 ssnd(jps_a_p)%nct = jpl 773 ssnd(jps_ht_p)%nct = jpl 774 ELSE 775 IF ( jpl > 1 ) THEN 776 CALL ctl_stop( 'sbc_cpl_init: use weighted ice option for sn_snd_mpnd%cldes if not exchanging category fields' ) 777 ENDIF 778 ENDIF 779 CASE ( 'weighted ice' ) 780 ssnd(jps_a_p)%laction = .TRUE. 781 ssnd(jps_ht_p)%laction = .TRUE. 782 IF ( TRIM( sn_snd_mpnd%clcat ) == 'yes' ) THEN 783 ssnd(jps_a_p)%nct = jpl 784 ssnd(jps_ht_p)%nct = jpl 785 ENDIF 786 CASE default ; CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_mpnd%cldes' ) 787 END SELECT 788 #else 789 IF( TRIM( sn_snd_mpnd%cldes ) /= 'none' ) THEN 790 CALL ctl_stop('Meltponds can only be used with CICEv5') 791 ENDIF 792 #endif 659 793 660 794 ! ! ------------------------- ! … … 689 823 ! ! ------------------------- ! 690 824 ssnd(jps_co2)%clname = 'O_CO2FLX' ; IF( TRIM(sn_snd_co2%cldes) == 'coupled' ) ssnd(jps_co2 )%laction = .TRUE. 825 ! 826 827 ! ! ------------------------- ! 828 ! ! MEDUSA output fields ! 829 ! ! ------------------------- ! 830 ! Surface dimethyl sulphide from Medusa 831 ssnd(jps_bio_dms)%clname = 'OBioDMS' 832 IF( TRIM(sn_snd_bio_dms%cldes) == 'medusa' ) ssnd(jps_bio_dms )%laction = .TRUE. 833 834 ! Surface CO2 flux from Medusa 835 ssnd(jps_bio_co2)%clname = 'OBioCO2' 836 IF( TRIM(sn_snd_bio_co2%cldes) == 'medusa' ) ssnd(jps_bio_co2 )%laction = .TRUE. 837 838 ! Surface chlorophyll from Medusa 839 ssnd(jps_bio_chloro)%clname = 'OBioChlo' 840 IF( TRIM(sn_snd_bio_chloro%cldes) == 'medusa' ) ssnd(jps_bio_chloro )%laction = .TRUE. 841 842 ! ! ------------------------- ! 843 ! ! Sea surface freezing temp ! 844 ! ! ------------------------- ! 845 ssnd(jps_sstfrz)%clname = 'O_SSTFrz' ; IF( TRIM(sn_snd_sstfrz%cldes) == 'coupled' ) ssnd(jps_sstfrz)%laction = .TRUE. 846 ! 847 ! ! ------------------------- ! 848 ! ! Ice conductivity ! 849 ! ! ------------------------- ! 850 ! Note that ultimately we will move to passing an ocean effective conductivity as well so there 851 ! will be some changes to the parts of the code which currently relate only to ice conductivity 852 ssnd(jps_kice )%clname = 'OIceKn' 853 SELECT CASE ( TRIM( sn_snd_cond%cldes ) ) 854 CASE ( 'none' ) 855 ssnd(jps_kice)%laction = .FALSE. 856 CASE ( 'ice only' ) 857 ssnd(jps_kice)%laction = .TRUE. 858 IF ( TRIM( sn_snd_cond%clcat ) == 'yes' ) THEN 859 ssnd(jps_kice)%nct = jpl 860 ELSE 861 IF ( jpl > 1 ) THEN 862 CALL ctl_stop( 'sbc_cpl_init: use weighted ice option for sn_snd_cond%cldes if not exchanging category fields' ) 863 ENDIF 864 ENDIF 865 CASE ( 'weighted ice' ) 866 ssnd(jps_kice)%laction = .TRUE. 867 IF ( TRIM( sn_snd_cond%clcat ) == 'yes' ) ssnd(jps_kice)%nct = jpl 868 CASE default ; CALL ctl_stop( 'sbc_cpl_init: wrong definition of sn_snd_cond%cldes' ) 869 END SELECT 870 ! 871 691 872 692 873 ! ! ------------------------------- ! … … 785 966 ncpl_qsr_freq = 86400 / ncpl_qsr_freq 786 967 968 IF( nn_coupled_iceshelf_fluxes .gt. 0 ) THEN 969 ! Crude masks to separate the Antarctic and Greenland icesheets. Obviously something 970 ! more complicated could be done if required. 971 greenland_icesheet_mask = 0.0 972 WHERE( gphit >= 0.0 ) greenland_icesheet_mask = 1.0 973 antarctica_icesheet_mask = 0.0 974 WHERE( gphit < 0.0 ) antarctica_icesheet_mask = 1.0 975 976 ! initialise other variables 977 greenland_icesheet_mass_array(:,:) = 0.0 978 antarctica_icesheet_mass_array(:,:) = 0.0 979 980 IF( .not. ln_rstart ) THEN 981 greenland_icesheet_mass = 0.0 982 greenland_icesheet_mass_rate_of_change = 0.0 983 greenland_icesheet_timelapsed = 0.0 984 antarctica_icesheet_mass = 0.0 985 antarctica_icesheet_mass_rate_of_change = 0.0 986 antarctica_icesheet_timelapsed = 0.0 987 ENDIF 988 989 ENDIF 990 787 991 CALL wrk_dealloc( jpi,jpj, zacs, zaos ) 788 992 ! … … 843 1047 !! 844 1048 LOGICAL :: llnewtx, llnewtau ! update wind stress components and module?? 845 INTEGER :: ji, jj, j n! dummy loop indices1049 INTEGER :: ji, jj, jl, jn ! dummy loop indices 846 1050 INTEGER :: isec ! number of seconds since nit000 (assuming rdttra did not change since nit000) 1051 INTEGER :: ikchoix 847 1052 REAL(wp) :: zcumulneg, zcumulpos ! temporary scalars 1053 REAL(wp) :: zgreenland_icesheet_mass_in, zantarctica_icesheet_mass_in 1054 REAL(wp) :: zgreenland_icesheet_mass_b, zantarctica_icesheet_mass_b 1055 REAL(wp) :: zmask_sum, zepsilon 848 1056 REAL(wp) :: zcoef ! temporary scalar 849 1057 REAL(wp) :: zrhoa = 1.22 ! Air density kg/m3 850 1058 REAL(wp) :: zcdrag = 1.5e-3 ! drag coefficient 851 1059 REAL(wp) :: zzx, zzy ! temporary variables 852 REAL(wp), POINTER, DIMENSION(:,:) :: ztx, zty, zmsk, zemp, zqns, zqsr 1060 REAL(wp), POINTER, DIMENSION(:,:) :: ztx, zty, zmsk, zemp, zqns, zqsr, ztx2, zty2 853 1061 !!---------------------------------------------------------------------- 1062 854 1063 ! 855 1064 IF( nn_timing == 1 ) CALL timing_start('sbc_cpl_rcv') 856 1065 ! 857 CALL wrk_alloc( jpi,jpj, ztx, zty, zmsk, zemp, zqns, zqsr )1066 CALL wrk_alloc( jpi,jpj, ztx, zty, zmsk, zemp, zqns, zqsr, ztx2, zty2 ) 858 1067 ! 859 1068 IF( ln_mixcpl ) zmsk(:,:) = 1. - xcplmask(:,:,0) … … 893 1102 IF( TRIM( sn_rcv_tau%clvor ) == 'eastward-northward' ) THEN ! 2 components oriented along the local grid 894 1103 ! ! (geographical to local grid -> rotate the components) 895 CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->i', ztx ) 896 IF( srcv(jpr_otx2)%laction ) THEN 897 CALL rot_rep( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), srcv(jpr_otx2)%clgrid, 'en->j', zty ) 898 ELSE 899 CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->j', zty ) 1104 IF( srcv(jpr_otx1)%clgrid == 'U' .AND. (.NOT. srcv(jpr_otx2)%laction) ) THEN 1105 ! Temporary code for HadGEM3 - will be removed eventually. 1106 ! Only applies when we have only taux on U grid and tauy on V grid 1107 DO jj=2,jpjm1 1108 DO ji=2,jpim1 1109 ztx(ji,jj)=0.25*vmask(ji,jj,1) & 1110 *(frcv(jpr_otx1)%z3(ji,jj,1)+frcv(jpr_otx1)%z3(ji-1,jj,1) & 1111 +frcv(jpr_otx1)%z3(ji,jj+1,1)+frcv(jpr_otx1)%z3(ji-1,jj+1,1)) 1112 zty(ji,jj)=0.25*umask(ji,jj,1) & 1113 *(frcv(jpr_oty1)%z3(ji,jj,1)+frcv(jpr_oty1)%z3(ji+1,jj,1) & 1114 +frcv(jpr_oty1)%z3(ji,jj-1,1)+frcv(jpr_oty1)%z3(ji+1,jj-1,1)) 1115 ENDDO 1116 ENDDO 1117 1118 ikchoix = 1 1119 CALL repcmo (frcv(jpr_otx1)%z3(:,:,1),zty,ztx,frcv(jpr_oty1)%z3(:,:,1),ztx2,zty2,ikchoix) 1120 CALL lbc_lnk (ztx2,'U', -1. ) 1121 CALL lbc_lnk (zty2,'V', -1. ) 1122 frcv(jpr_otx1)%z3(:,:,1)=ztx2(:,:) 1123 frcv(jpr_oty1)%z3(:,:,1)=zty2(:,:) 1124 ELSE 1125 CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->i', ztx ) 1126 frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:) ! overwrite 1st component on the 1st grid 1127 IF( srcv(jpr_otx2)%laction ) THEN 1128 CALL rot_rep( frcv(jpr_otx2)%z3(:,:,1), frcv(jpr_oty2)%z3(:,:,1), srcv(jpr_otx2)%clgrid, 'en->j', zty ) 1129 ELSE 1130 CALL rot_rep( frcv(jpr_otx1)%z3(:,:,1), frcv(jpr_oty1)%z3(:,:,1), srcv(jpr_otx1)%clgrid, 'en->j', zty ) 1131 ENDIF 1132 frcv(jpr_oty1)%z3(:,:,1) = zty(:,:) ! overwrite 2nd component on the 2nd grid 900 1133 ENDIF 901 frcv(jpr_otx1)%z3(:,:,1) = ztx(:,:) ! overwrite 1st component on the 1st grid902 frcv(jpr_oty1)%z3(:,:,1) = zty(:,:) ! overwrite 2nd component on the 2nd grid903 1134 ENDIF 904 1135 ! … … 990 1221 ENDIF 991 1222 1223 IF (ln_medusa) THEN 1224 IF( srcv(jpr_atm_pco2)%laction) PCO2a_in_cpl(:,:) = frcv(jpr_atm_pco2)%z3(:,:,1) 1225 IF( srcv(jpr_atm_dust)%laction) Dust_in_cpl(:,:) = frcv(jpr_atm_dust)%z3(:,:,1) 1226 ENDIF 1227 992 1228 #if defined key_cpl_carbon_cycle 993 1229 ! ! ================== ! … … 995 1231 ! ! ================== ! 996 1232 IF( srcv(jpr_co2)%laction ) atm_co2(:,:) = frcv(jpr_co2)%z3(:,:,1) 1233 #endif 1234 1235 #if defined key_cice && ! defined key_cice4 1236 ! ! Sea ice surface skin temp: 1237 IF( srcv(jpr_ts_ice)%laction ) THEN 1238 DO jl = 1, jpl 1239 DO jj = 1, jpj 1240 DO ji = 1, jpi 1241 IF (frcv(jpr_ts_ice)%z3(ji,jj,jl) > 0.0) THEN 1242 tsfc_ice(ji,jj,jl) = 0.0 1243 ELSE IF (frcv(jpr_ts_ice)%z3(ji,jj,jl) < -60.0) THEN 1244 tsfc_ice(ji,jj,jl) = -60.0 1245 ELSE 1246 tsfc_ice(ji,jj,jl) = frcv(jpr_ts_ice)%z3(ji,jj,jl) 1247 ENDIF 1248 END DO 1249 END DO 1250 END DO 1251 ENDIF 997 1252 #endif 998 1253 … … 1029 1284 ssu_m(:,:) = frcv(jpr_ocx1)%z3(:,:,1) 1030 1285 ub (:,:,1) = ssu_m(:,:) ! will be used in sbcice_lim in the call of lim_sbc_tau 1286 un (:,:,1) = ssu_m(:,:) ! will be used in sbc_cpl_snd if atmosphere coupling 1031 1287 CALL iom_put( 'ssu_m', ssu_m ) 1032 1288 ENDIF … … 1034 1290 ssv_m(:,:) = frcv(jpr_ocy1)%z3(:,:,1) 1035 1291 vb (:,:,1) = ssv_m(:,:) ! will be used in sbcice_lim in the call of lim_sbc_tau 1292 vn (:,:,1) = ssv_m(:,:) ! will be used in sbc_cpl_snd if atmosphere coupling 1036 1293 CALL iom_put( 'ssv_m', ssv_m ) 1037 1294 ENDIF … … 1110 1367 1111 1368 ENDIF 1112 ! 1113 CALL wrk_dealloc( jpi,jpj, ztx, zty, zmsk, zemp, zqns, zqsr ) 1369 1370 ! ! land ice masses : Greenland 1371 zepsilon = rn_iceshelf_fluxes_tolerance 1372 1373 1374 ! See if we need zmask_sum... 1375 IF ( srcv(jpr_grnm)%laction .OR. srcv(jpr_antm)%laction ) THEN 1376 zmask_sum = glob_sum( tmask(:,:,1) ) 1377 ENDIF 1378 1379 IF( srcv(jpr_grnm)%laction .AND. nn_coupled_iceshelf_fluxes == 1 ) THEN 1380 greenland_icesheet_mass_array(:,:) = frcv(jpr_grnm)%z3(:,:,1) 1381 ! take average over ocean points of input array to avoid cumulative error over time 1382 ! The following must be bit reproducible over different PE decompositions 1383 zgreenland_icesheet_mass_in = glob_sum( greenland_icesheet_mass_array(:,:) * tmask(:,:,1) ) 1384 1385 zgreenland_icesheet_mass_in = zgreenland_icesheet_mass_in / zmask_sum 1386 greenland_icesheet_timelapsed = greenland_icesheet_timelapsed + rdt 1387 1388 IF( ln_iceshelf_init_atmos .AND. kt == 1 ) THEN 1389 ! On the first timestep (of an NRUN) force the ocean to ignore the icesheet masses in the ocean restart 1390 ! and take them from the atmosphere to avoid problems with using inconsistent ocean and atmosphere restarts. 1391 zgreenland_icesheet_mass_b = zgreenland_icesheet_mass_in 1392 greenland_icesheet_mass = zgreenland_icesheet_mass_in 1393 ENDIF 1394 1395 IF( ABS( zgreenland_icesheet_mass_in - greenland_icesheet_mass ) > zepsilon ) THEN 1396 zgreenland_icesheet_mass_b = greenland_icesheet_mass 1397 1398 ! Only update the mass if it has increased. 1399 IF ( (zgreenland_icesheet_mass_in - greenland_icesheet_mass) > 0.0 ) THEN 1400 greenland_icesheet_mass = zgreenland_icesheet_mass_in 1401 ENDIF 1402 1403 IF( zgreenland_icesheet_mass_b /= 0.0 ) & 1404 & greenland_icesheet_mass_rate_of_change = ( greenland_icesheet_mass - zgreenland_icesheet_mass_b ) / greenland_icesheet_timelapsed 1405 greenland_icesheet_timelapsed = 0.0_wp 1406 ENDIF 1407 IF(lwp) WRITE(numout,*) 'Greenland icesheet mass (kg) read in is ', zgreenland_icesheet_mass_in 1408 IF(lwp) WRITE(numout,*) 'Greenland icesheet mass (kg) used is ', greenland_icesheet_mass 1409 IF(lwp) WRITE(numout,*) 'Greenland icesheet mass rate of change (kg/s) is ', greenland_icesheet_mass_rate_of_change 1410 IF(lwp) WRITE(numout,*) 'Greenland icesheet seconds lapsed since last change is ', greenland_icesheet_timelapsed 1411 ELSE IF ( nn_coupled_iceshelf_fluxes == 2 ) THEN 1412 greenland_icesheet_mass_rate_of_change = rn_greenland_total_fw_flux 1413 ENDIF 1414 1415 ! ! land ice masses : Antarctica 1416 IF( srcv(jpr_antm)%laction .AND. nn_coupled_iceshelf_fluxes == 1 ) THEN 1417 antarctica_icesheet_mass_array(:,:) = frcv(jpr_antm)%z3(:,:,1) 1418 ! take average over ocean points of input array to avoid cumulative error from rounding errors over time 1419 ! The following must be bit reproducible over different PE decompositions 1420 zantarctica_icesheet_mass_in = glob_sum( antarctica_icesheet_mass_array(:,:) * tmask(:,:,1) ) 1421 1422 zantarctica_icesheet_mass_in = zantarctica_icesheet_mass_in / zmask_sum 1423 antarctica_icesheet_timelapsed = antarctica_icesheet_timelapsed + rdt 1424 1425 IF( ln_iceshelf_init_atmos .AND. kt == 1 ) THEN 1426 ! On the first timestep (of an NRUN) force the ocean to ignore the icesheet masses in the ocean restart 1427 ! and take them from the atmosphere to avoid problems with using inconsistent ocean and atmosphere restarts. 1428 zantarctica_icesheet_mass_b = zantarctica_icesheet_mass_in 1429 antarctica_icesheet_mass = zantarctica_icesheet_mass_in 1430 ENDIF 1431 1432 IF( ABS( zantarctica_icesheet_mass_in - antarctica_icesheet_mass ) > zepsilon ) THEN 1433 zantarctica_icesheet_mass_b = antarctica_icesheet_mass 1434 1435 ! Only update the mass if it has increased. 1436 IF ( (zantarctica_icesheet_mass_in - antarctica_icesheet_mass) > 0.0 ) THEN 1437 antarctica_icesheet_mass = zantarctica_icesheet_mass_in 1438 END IF 1439 1440 IF( zantarctica_icesheet_mass_b /= 0.0 ) & 1441 & antarctica_icesheet_mass_rate_of_change = ( antarctica_icesheet_mass - zantarctica_icesheet_mass_b ) / antarctica_icesheet_timelapsed 1442 antarctica_icesheet_timelapsed = 0.0_wp 1443 ENDIF 1444 IF(lwp) WRITE(numout,*) 'Antarctica icesheet mass (kg) read in is ', zantarctica_icesheet_mass_in 1445 IF(lwp) WRITE(numout,*) 'Antarctica icesheet mass (kg) used is ', antarctica_icesheet_mass 1446 IF(lwp) WRITE(numout,*) 'Antarctica icesheet mass rate of change (kg/s) is ', antarctica_icesheet_mass_rate_of_change 1447 IF(lwp) WRITE(numout,*) 'Antarctica icesheet seconds lapsed since last change is ', antarctica_icesheet_timelapsed 1448 ELSE IF ( nn_coupled_iceshelf_fluxes == 2 ) THEN 1449 antarctica_icesheet_mass_rate_of_change = rn_antarctica_total_fw_flux 1450 ENDIF 1451 1452 ! 1453 CALL wrk_dealloc( jpi,jpj, ztx, zty, zmsk, zemp, zqns, zqsr, ztx2, zty2 ) 1114 1454 ! 1115 1455 IF( nn_timing == 1 ) CALL timing_stop('sbc_cpl_rcv') … … 1333 1673 !! *** ROUTINE sbc_cpl_ice_flx *** 1334 1674 !! 1335 !! ** Purpose : provide the heat and freshwater fluxes of the 1336 !! ocean-ice system. 1675 !! ** Purpose : provide the heat and freshwater fluxes of the ocean-ice system 1337 1676 !! 1338 1677 !! ** Method : transform the fields received from the atmosphere into 1339 1678 !! surface heat and fresh water boundary condition for the 1340 1679 !! ice-ocean system. The following fields are provided: 1341 !! * total non solar, solar and freshwater fluxes (qns_tot,1680 !! * total non solar, solar and freshwater fluxes (qns_tot, 1342 1681 !! qsr_tot and emp_tot) (total means weighted ice-ocean flux) 1343 1682 !! NB: emp_tot include runoffs and calving. 1344 !! * fluxes over ice (qns_ice, qsr_ice, emp_ice) where1683 !! * fluxes over ice (qns_ice, qsr_ice, emp_ice) where 1345 1684 !! emp_ice = sublimation - solid precipitation as liquid 1346 1685 !! precipitation are re-routed directly to the ocean and 1347 !! runoffs and calving directly enter the ocean.1348 !! * solid precipitation (sprecip), used to add to qns_tot1686 !! calving directly enter the ocean (runoffs are read but included in trasbc.F90) 1687 !! * solid precipitation (sprecip), used to add to qns_tot 1349 1688 !! the heat lost associated to melting solid precipitation 1350 1689 !! over the ocean fraction. 1351 !! ===>> CAUTION here this changes the net heat flux received from 1352 !! the atmosphere 1353 !! 1354 !! - the fluxes have been separated from the stress as 1355 !! (a) they are updated at each ice time step compare to 1356 !! an update at each coupled time step for the stress, and 1357 !! (b) the conservative computation of the fluxes over the 1358 !! sea-ice area requires the knowledge of the ice fraction 1359 !! after the ice advection and before the ice thermodynamics, 1360 !! so that the stress is updated before the ice dynamics 1361 !! while the fluxes are updated after it. 1690 !! * heat content of rain, snow and evap can also be provided, 1691 !! otherwise heat flux associated with these mass flux are 1692 !! guessed (qemp_oce, qemp_ice) 1693 !! 1694 !! - the fluxes have been separated from the stress as 1695 !! (a) they are updated at each ice time step compare to 1696 !! an update at each coupled time step for the stress, and 1697 !! (b) the conservative computation of the fluxes over the 1698 !! sea-ice area requires the knowledge of the ice fraction 1699 !! after the ice advection and before the ice thermodynamics, 1700 !! so that the stress is updated before the ice dynamics 1701 !! while the fluxes are updated after it. 1702 !! 1703 !! ** Details 1704 !! qns_tot = pfrld * qns_oce + ( 1 - pfrld ) * qns_ice => provided 1705 !! + qemp_oce + qemp_ice => recalculated and added up to qns 1706 !! 1707 !! qsr_tot = pfrld * qsr_oce + ( 1 - pfrld ) * qsr_ice => provided 1708 !! 1709 !! emp_tot = emp_oce + emp_ice => calving is provided and added to emp_tot (and emp_oce) 1710 !! river runoff (rnf) is provided but not included here 1362 1711 !! 1363 1712 !! ** Action : update at each nf_ice time step: 1364 1713 !! qns_tot, qsr_tot non-solar and solar total heat fluxes 1365 1714 !! qns_ice, qsr_ice non-solar and solar heat fluxes over the ice 1366 !! emp_tot total evaporation - precipitation(liquid and solid) (-runoff)(-calving)1367 !! emp_ice 1368 !! dqns_ice 1369 !! sprecip 1715 !! emp_tot total evaporation - precipitation(liquid and solid) (-calving) 1716 !! emp_ice ice sublimation - solid precipitation over the ice 1717 !! dqns_ice d(non-solar heat flux)/d(Temperature) over the ice 1718 !! sprecip solid precipitation over the ocean 1370 1719 !!---------------------------------------------------------------------- 1371 1720 REAL(wp), INTENT(in ), DIMENSION(:,:) :: p_frld ! lead fraction [0 to 1] … … 1376 1725 ! 1377 1726 INTEGER :: jl ! dummy loop index 1378 REAL(wp), POINTER, DIMENSION(:,: ) :: zcptn, ztmp, zicefr, zmsk 1379 REAL(wp), POINTER, DIMENSION(:,: ) :: zemp_tot, zemp_ice, z sprecip, ztprecip, zqns_tot, zqsr_tot1380 REAL(wp), POINTER, DIMENSION(:,: ,:) :: zqns_ice, zqsr_ice, zdqns_ice1381 REAL(wp), POINTER, DIMENSION(:,: ) :: zevap, zsnw, zqns_oce, zqsr_oce, zqprec_ice, zqemp_oce ! for LIM31727 REAL(wp), POINTER, DIMENSION(:,: ) :: zcptn, ztmp, zicefr, zmsk, zsnw 1728 REAL(wp), POINTER, DIMENSION(:,: ) :: zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice 1729 REAL(wp), POINTER, DIMENSION(:,: ) :: zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice 1730 REAL(wp), POINTER, DIMENSION(:,:,:) :: zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice 1382 1731 !!---------------------------------------------------------------------- 1383 1732 ! 1384 1733 IF( nn_timing == 1 ) CALL timing_start('sbc_cpl_ice_flx') 1385 1734 ! 1386 CALL wrk_alloc( jpi,jpj, zcptn, ztmp, zicefr, zmsk, zemp_tot, zemp_ice, zsprecip, ztprecip, zqns_tot, zqsr_tot ) 1387 CALL wrk_alloc( jpi,jpj,jpl, zqns_ice, zqsr_ice, zdqns_ice ) 1735 CALL wrk_alloc( jpi,jpj, zcptn, ztmp, zicefr, zmsk, zsnw ) 1736 CALL wrk_alloc( jpi,jpj, zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice ) 1737 CALL wrk_alloc( jpi,jpj, zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice ) 1738 CALL wrk_alloc( jpi,jpj,jpl, zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice ) 1388 1739 1389 1740 IF( ln_mixcpl ) zmsk(:,:) = 1. - xcplmask(:,:,0) … … 1392 1743 ! 1393 1744 ! ! ========================= ! 1394 ! ! freshwater budget ! (emp )1745 ! ! freshwater budget ! (emp_tot) 1395 1746 ! ! ========================= ! 1396 1747 ! 1397 ! ! total Precipitation - total Evaporation (emp_tot)1398 ! ! solid precipitation - sublimation (emp_ice)1399 ! ! solid Precipitation (sprecip)1400 ! ! liquid + solid Precipitation (tprecip)1748 ! ! solid Precipitation (sprecip) 1749 ! ! liquid + solid Precipitation (tprecip) 1750 ! ! total Evaporation - total Precipitation (emp_tot) 1751 ! ! sublimation - solid precipitation (cell average) (emp_ice) 1401 1752 SELECT CASE( TRIM( sn_rcv_emp%cldes ) ) 1402 1753 CASE( 'conservative' ) ! received fields: jpr_rain, jpr_snow, jpr_ievp, jpr_tevp 1403 1754 zsprecip(:,:) = frcv(jpr_snow)%z3(:,:,1) ! May need to ensure positive here 1404 1755 ztprecip(:,:) = frcv(jpr_rain)%z3(:,:,1) + zsprecip(:,:) ! May need to ensure positive here 1405 zemp_tot(:,:) = frcv(jpr_tevp)%z3(:,:,1) - ztprecip(:,:) 1406 zemp_ice(:,:) = frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_snow)%z3(:,:,1) 1407 CALL iom_put( 'rain' , frcv(jpr_rain)%z3(:,:,1) ) ! liquid precipitation 1756 zemp_tot(:,:) = frcv(jpr_tevp)%z3(:,:,1) - ztprecip(:,:) 1757 #if defined key_cice 1758 IF ( TRIM(sn_rcv_emp%clcat) == 'yes' ) THEN 1759 ! zemp_ice is the sum of frcv(jpr_ievp)%z3(:,:,1) over all layers - snow 1760 zemp_ice(:,:) = - frcv(jpr_snow)%z3(:,:,1) 1761 DO jl=1,jpl 1762 zemp_ice(:,: ) = zemp_ice(:,:) + frcv(jpr_ievp)%z3(:,:,jl) 1763 ENDDO 1764 ! latent heat coupled for each category in CICE 1765 qla_ice(:,:,1:jpl) = - frcv(jpr_ievp)%z3(:,:,1:jpl) * lsub 1766 ELSE 1767 ! If CICE has multicategories it still expects coupling fields for 1768 ! each even if we treat as a single field 1769 ! The latent heat flux is split between the ice categories according 1770 ! to the fraction of the ice in each category 1771 zemp_ice(:,:) = frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_snow)%z3(:,:,1) 1772 WHERE ( zicefr(:,:) /= 0._wp ) 1773 ztmp(:,:) = 1./zicefr(:,:) 1774 ELSEWHERE 1775 ztmp(:,:) = 0.e0 1776 END WHERE 1777 DO jl=1,jpl 1778 qla_ice(:,:,jl) = - a_i(:,:,jl) * ztmp(:,:) * frcv(jpr_ievp)%z3(:,:,1) * lsub 1779 END DO 1780 WHERE ( zicefr(:,:) == 0._wp ) qla_ice(:,:,1) = -frcv(jpr_ievp)%z3(:,:,1) * lsub 1781 ENDIF 1782 #else 1783 zemp_ice(:,:) = ( frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_snow)%z3(:,:,1) ) * zicefr(:,:) 1784 #endif 1785 CALL iom_put( 'rain' , frcv(jpr_rain)%z3(:,:,1) * tmask(:,:,1) ) ! liquid precipitation 1786 CALL iom_put( 'rain_ao_cea' , frcv(jpr_rain)%z3(:,:,1)* p_frld(:,:) * tmask(:,:,1) ) ! liquid precipitation 1408 1787 IF( iom_use('hflx_rain_cea') ) & 1409 CALL iom_put( 'hflx_rain_cea', frcv(jpr_rain)%z3(:,:,1) * zcptn(:,:) ) ! heat flux from liq. precip. 1788 & CALL iom_put( 'hflx_rain_cea', frcv(jpr_rain)%z3(:,:,1) * zcptn(:,:) * tmask(:,:,1)) ! heat flux from liq. precip. 1789 IF( iom_use('hflx_prec_cea') ) & 1790 & CALL iom_put( 'hflx_prec_cea', ztprecip * zcptn(:,:) * tmask(:,:,1) * p_frld(:,:) ) ! heat content flux from all precip (cell avg) 1410 1791 IF( iom_use('evap_ao_cea') .OR. iom_use('hflx_evap_cea') ) & 1411 ztmp(:,:) = frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:)1792 & ztmp(:,:) = frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) 1412 1793 IF( iom_use('evap_ao_cea' ) ) & 1413 CALL iom_put( 'evap_ao_cea' , ztmp) ! ice-free oce evap (cell average)1794 & CALL iom_put( 'evap_ao_cea' , ztmp * tmask(:,:,1) ) ! ice-free oce evap (cell average) 1414 1795 IF( iom_use('hflx_evap_cea') ) & 1415 CALL iom_put( 'hflx_evap_cea', ztmp(:,:) * zcptn(:,:) ) ! heat flux from from evap (cell average)1416 CASE( 'oce and ice' 1796 & CALL iom_put( 'hflx_evap_cea', ztmp(:,:) * zcptn(:,:) * tmask(:,:,1) ) ! heat flux from from evap (cell average) 1797 CASE( 'oce and ice' ) ! received fields: jpr_sbpr, jpr_semp, jpr_oemp, jpr_ievp 1417 1798 zemp_tot(:,:) = p_frld(:,:) * frcv(jpr_oemp)%z3(:,:,1) + zicefr(:,:) * frcv(jpr_sbpr)%z3(:,:,1) 1418 zemp_ice(:,:) = frcv(jpr_semp)%z3(:,:,1) 1799 zemp_ice(:,:) = frcv(jpr_semp)%z3(:,:,1) * zicefr(:,:) 1419 1800 zsprecip(:,:) = frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_semp)%z3(:,:,1) 1420 1801 ztprecip(:,:) = frcv(jpr_semp)%z3(:,:,1) - frcv(jpr_sbpr)%z3(:,:,1) + zsprecip(:,:) 1421 1802 END SELECT 1422 1803 1423 IF( iom_use('subl_ai_cea') ) & 1424 CALL iom_put( 'subl_ai_cea', frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) ) ! Sublimation over sea-ice (cell average) 1425 ! 1426 ! ! runoffs and calving (put in emp_tot) 1804 #if defined key_lim3 1805 ! zsnw = snow fraction over ice after wind blowing 1806 zsnw(:,:) = 0._wp ; CALL lim_thd_snwblow( p_frld, zsnw ) 1807 1808 ! --- evaporation minus precipitation corrected (because of wind blowing on snow) --- ! 1809 zemp_ice(:,:) = zemp_ice(:,:) + zsprecip(:,:) * ( zicefr(:,:) - zsnw(:,:) ) ! emp_ice = A * sublimation - zsnw * sprecip 1810 zemp_oce(:,:) = zemp_tot(:,:) - zemp_ice(:,:) ! emp_oce = emp_tot - emp_ice 1811 1812 ! --- evaporation over ocean (used later for qemp) --- ! 1813 zevap_oce(:,:) = frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) 1814 1815 ! --- evaporation over ice (kg/m2/s) --- ! 1816 zevap_ice(:,:) = frcv(jpr_ievp)%z3(:,:,1) 1817 ! since the sensitivity of evap to temperature (devap/dT) is not prescribed by the atmosphere, we set it to 0 1818 ! therefore, sublimation is not redistributed over the ice categories in case no subgrid scale fluxes are provided by atm. 1819 zdevap_ice(:,:) = 0._wp 1820 1821 ! --- runoffs (included in emp later on) --- ! 1427 1822 IF( srcv(jpr_rnf)%laction ) rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 1823 1824 ! --- calving (put in emp_tot and emp_oce) --- ! 1825 IF( srcv(jpr_cal)%laction ) THEN 1826 zemp_tot(:,:) = zemp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1) 1827 zemp_oce(:,:) = zemp_oce(:,:) - frcv(jpr_cal)%z3(:,:,1) 1828 CALL iom_put( 'calving_cea', frcv(jpr_cal)%z3(:,:,1) ) 1829 ENDIF 1830 1831 IF( ln_mixcpl ) THEN 1832 emp_tot(:,:) = emp_tot(:,:) * xcplmask(:,:,0) + zemp_tot(:,:) * zmsk(:,:) 1833 emp_ice(:,:) = emp_ice(:,:) * xcplmask(:,:,0) + zemp_ice(:,:) * zmsk(:,:) 1834 emp_oce(:,:) = emp_oce(:,:) * xcplmask(:,:,0) + zemp_oce(:,:) * zmsk(:,:) 1835 sprecip(:,:) = sprecip(:,:) * xcplmask(:,:,0) + zsprecip(:,:) * zmsk(:,:) 1836 tprecip(:,:) = tprecip(:,:) * xcplmask(:,:,0) + ztprecip(:,:) * zmsk(:,:) 1837 DO jl=1,jpl 1838 evap_ice (:,:,jl) = evap_ice (:,:,jl) * xcplmask(:,:,0) + zevap_ice (:,:) * zmsk(:,:) 1839 devap_ice(:,:,jl) = devap_ice(:,:,jl) * xcplmask(:,:,0) + zdevap_ice(:,:) * zmsk(:,:) 1840 ENDDO 1841 ELSE 1842 emp_tot(:,:) = zemp_tot(:,:) 1843 emp_ice(:,:) = zemp_ice(:,:) 1844 emp_oce(:,:) = zemp_oce(:,:) 1845 sprecip(:,:) = zsprecip(:,:) 1846 tprecip(:,:) = ztprecip(:,:) 1847 DO jl=1,jpl 1848 evap_ice (:,:,jl) = zevap_ice (:,:) 1849 devap_ice(:,:,jl) = zdevap_ice(:,:) 1850 ENDDO 1851 ENDIF 1852 1853 IF( iom_use('subl_ai_cea') ) CALL iom_put( 'subl_ai_cea', zevap_ice(:,:) * zicefr(:,:) ) ! Sublimation over sea-ice (cell average) 1854 CALL iom_put( 'snowpre' , sprecip(:,:) ) ! Snow 1855 IF( iom_use('snow_ao_cea') ) CALL iom_put( 'snow_ao_cea', sprecip(:,:) * ( 1._wp - zsnw(:,:) ) ) ! Snow over ice-free ocean (cell average) 1856 IF( iom_use('snow_ai_cea') ) CALL iom_put( 'snow_ai_cea', sprecip(:,:) * zsnw(:,:) ) ! Snow over sea-ice (cell average) 1857 #else 1858 ! runoffs and calving (put in emp_tot) 1859 IF( srcv(jpr_rnf)%laction ) rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 1860 IF( iom_use('hflx_rnf_cea') ) & 1861 CALL iom_put( 'hflx_rnf_cea' , rnf(:,:) * zcptn(:,:) ) 1428 1862 IF( srcv(jpr_cal)%laction ) THEN 1429 1863 zemp_tot(:,:) = zemp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1) … … 1443 1877 ENDIF 1444 1878 1445 CALL iom_put( 'snowpre' , sprecip ) ! Snow1446 IF( iom_use('snow_ao_cea') ) &1447 CALL iom_put( 'snow_ao_cea', sprecip(:,:) * p_frld(:,:) ) ! Snowover ice-free ocean (cell average)1448 IF( iom_use('snow_ai_cea') ) &1449 CALL iom_put( 'snow_ai_cea', sprecip(:,:) * zicefr(:,:) ) ! Snow over sea-ice (cell average) 1879 IF( iom_use('subl_ai_cea') ) CALL iom_put( 'subl_ai_cea', frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) ) ! Sublimation over sea-ice (cell average) 1880 CALL iom_put( 'snowpre' , sprecip(:,:) ) ! Snow 1881 IF( iom_use('snow_ao_cea') ) CALL iom_put( 'snow_ao_cea', sprecip(:,:) * p_frld(:,:) ) ! Snow over ice-free ocean (cell average) 1882 IF( iom_use('snow_ai_cea') ) CALL iom_put( 'snow_ai_cea', sprecip(:,:) * zicefr(:,:) ) ! Snow over sea-ice (cell average) 1883 #endif 1450 1884 1451 1885 ! ! ========================= ! 1452 1886 SELECT CASE( TRIM( sn_rcv_qns%cldes ) ) ! non solar heat fluxes ! (qns) 1453 1887 ! ! ========================= ! 1454 CASE( 'oce only' ) 1455 zqns_tot(:,: 1456 CASE( 'conservative' ) 1457 zqns_tot(:,: 1888 CASE( 'oce only' ) ! the required field is directly provided 1889 zqns_tot(:,:) = frcv(jpr_qnsoce)%z3(:,:,1) 1890 CASE( 'conservative' ) ! the required fields are directly provided 1891 zqns_tot(:,:) = frcv(jpr_qnsmix)%z3(:,:,1) 1458 1892 IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 1459 1893 zqns_ice(:,:,1:jpl) = frcv(jpr_qnsice)%z3(:,:,1:jpl) 1460 1894 ELSE 1461 ! Set all category values equal for the moment1462 1895 DO jl=1,jpl 1463 zqns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1) 1896 zqns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1) ! Set all category values equal 1464 1897 ENDDO 1465 1898 ENDIF 1466 CASE( 'oce and ice' ) 1467 zqns_tot(:,: 1899 CASE( 'oce and ice' ) ! the total flux is computed from ocean and ice fluxes 1900 zqns_tot(:,:) = p_frld(:,:) * frcv(jpr_qnsoce)%z3(:,:,1) 1468 1901 IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 1469 1902 DO jl=1,jpl … … 1472 1905 ENDDO 1473 1906 ELSE 1474 qns_tot(:,: 1907 qns_tot(:,:) = qns_tot(:,:) + zicefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 1475 1908 DO jl=1,jpl 1476 1909 zqns_tot(:,: ) = zqns_tot(:,:) + zicefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) … … 1478 1911 ENDDO 1479 1912 ENDIF 1480 CASE( 'mixed oce-ice' ) 1913 CASE( 'mixed oce-ice' ) ! the ice flux is cumputed from the total flux, the SST and ice informations 1481 1914 ! ** NEED TO SORT OUT HOW THIS SHOULD WORK IN THE MULTI-CATEGORY CASE - CURRENTLY NOT ALLOWED WHEN INTERFACE INITIALISED ** 1482 1915 zqns_tot(:,: ) = frcv(jpr_qnsmix)%z3(:,:,1) 1483 1916 zqns_ice(:,:,1) = frcv(jpr_qnsmix)%z3(:,:,1) & 1484 1917 & + frcv(jpr_dqnsdt)%z3(:,:,1) * ( pist(:,:,1) - ( (rt0 + psst(:,: ) ) * p_frld(:,:) & 1485 & + pist(:,:,1)* zicefr(:,:) ) )1918 & + pist(:,:,1) * zicefr(:,:) ) ) 1486 1919 END SELECT 1487 1920 !!gm … … 1493 1926 !! similar job should be done for snow and precipitation temperature 1494 1927 ! 1495 IF( srcv(jpr_cal)%laction ) THEN ! Iceberg melting 1496 ztmp(:,:) = frcv(jpr_cal)%z3(:,:,1) * lfus ! add the latent heat of iceberg melting 1497 zqns_tot(:,:) = zqns_tot(:,:) - ztmp(:,:) 1498 IF( iom_use('hflx_cal_cea') ) & 1499 CALL iom_put( 'hflx_cal_cea', ztmp + frcv(jpr_cal)%z3(:,:,1) * zcptn(:,:) ) ! heat flux from calving 1500 ENDIF 1501 1502 ztmp(:,:) = p_frld(:,:) * zsprecip(:,:) * lfus 1503 IF( iom_use('hflx_snow_cea') ) CALL iom_put( 'hflx_snow_cea', ztmp + sprecip(:,:) * zcptn(:,:) ) ! heat flux from snow (cell average) 1504 1505 #if defined key_lim3 1506 CALL wrk_alloc( jpi,jpj, zevap, zsnw, zqns_oce, zqprec_ice, zqemp_oce ) 1507 1508 ! --- evaporation --- ! 1509 ! clem: evap_ice is set to 0 for LIM3 since we still do not know what to do with sublimation 1510 ! the problem is: the atm. imposes both mass evaporation and heat removed from the snow/ice 1511 ! but it is incoherent WITH the ice model 1512 DO jl=1,jpl 1513 evap_ice(:,:,jl) = 0._wp ! should be: frcv(jpr_ievp)%z3(:,:,1) 1514 ENDDO 1515 zevap(:,:) = zemp_tot(:,:) + ztprecip(:,:) ! evaporation over ocean 1516 1517 ! --- evaporation minus precipitation --- ! 1518 emp_oce(:,:) = emp_tot(:,:) - emp_ice(:,:) 1519 1928 IF( srcv(jpr_cal)%laction ) THEN ! Iceberg melting 1929 zqns_tot(:,:) = zqns_tot(:,:) - frcv(jpr_cal)%z3(:,:,1) * lfus ! add the latent heat of iceberg melting 1930 ! we suppose it melts at 0deg, though it should be temp. of surrounding ocean 1931 IF( iom_use('hflx_cal_cea') ) CALL iom_put( 'hflx_cal_cea', - frcv(jpr_cal)%z3(:,:,1) * lfus ) ! heat flux from calving 1932 ENDIF 1933 1934 #if defined key_lim3 1520 1935 ! --- non solar flux over ocean --- ! 1521 1936 ! note: p_frld cannot be = 0 since we limit the ice concentration to amax … … 1523 1938 WHERE( p_frld /= 0._wp ) zqns_oce(:,:) = ( zqns_tot(:,:) - SUM( a_i * zqns_ice, dim=3 ) ) / p_frld(:,:) 1524 1939 1525 ! --- heat flux associated with emp --- !1526 z snw(:,:) = 0._wp1527 CALL lim_thd_snwblow( p_frld, zsnw ) ! snow distribution over ice after wind blowing1528 zqemp_oce(:,:) = - zevap(:,:) * p_frld(:,:) * zcptn(:,:) & ! evap1529 & + ( ztprecip(:,:) - zsprecip(:,:) ) * zcptn(:,:) & ! liquid precip1530 & + zsprecip(:,:) * ( 1._wp - zsnw ) * ( zcptn(:,:) - lfus ) ! solid precip over ocean 1531 qemp_ice(:,:) = - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) * zcptn(:,:) & ! ice evap1532 & + zsprecip(:,:) * zsnw * ( zcptn(:,:) - lfus ) ! solid precip over ice1533 1534 ! --- heat content ofprecip over ice in J/m3 (to be used in 1D-thermo) --- !1940 ! --- heat flux associated with emp (W/m2) --- ! 1941 zqemp_oce(:,:) = - zevap_oce(:,:) * zcptn(:,:) & ! evap 1942 & + ( ztprecip(:,:) - zsprecip(:,:) ) * zcptn(:,:) & ! liquid precip 1943 & + zsprecip(:,:) * ( 1._wp - zsnw ) * ( zcptn(:,:) - lfus ) ! solid precip over ocean + snow melting 1944 ! zqemp_ice(:,:) = - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) * zcptn(:,:) & ! ice evap 1945 ! & + zsprecip(:,:) * zsnw * ( zcptn(:,:) - lfus ) ! solid precip over ice 1946 zqemp_ice(:,:) = zsprecip(:,:) * zsnw * ( zcptn(:,:) - lfus ) ! solid precip over ice (only) 1947 ! qevap_ice=0 since we consider Tice=0degC 1948 1949 ! --- enthalpy of snow precip over ice in J/m3 (to be used in 1D-thermo) --- ! 1535 1950 zqprec_ice(:,:) = rhosn * ( zcptn(:,:) - lfus ) 1536 1951 1537 ! --- total non solar flux --- ! 1538 zqns_tot(:,:) = zqns_tot(:,:) + qemp_ice(:,:) + zqemp_oce(:,:) 1952 ! --- heat content of evap over ice in W/m2 (to be used in 1D-thermo) --- ! 1953 DO jl = 1, jpl 1954 zqevap_ice(:,:,jl) = 0._wp ! should be -evap * ( ( Tice - rt0 ) * cpic ) but we do not have Tice, so we consider Tice=0degC 1955 END DO 1956 1957 ! --- total non solar flux (including evap/precip) --- ! 1958 zqns_tot(:,:) = zqns_tot(:,:) + zqemp_ice(:,:) + zqemp_oce(:,:) 1539 1959 1540 1960 ! --- in case both coupled/forced are active, we must mix values --- ! … … 1543 1963 qns_oce(:,:) = qns_oce(:,:) * xcplmask(:,:,0) + zqns_oce(:,:)* zmsk(:,:) 1544 1964 DO jl=1,jpl 1545 qns_ice(:,:,jl) = qns_ice(:,:,jl) * xcplmask(:,:,0) + zqns_ice(:,:,jl)* zmsk(:,:) 1965 qns_ice (:,:,jl) = qns_ice (:,:,jl) * xcplmask(:,:,0) + zqns_ice (:,:,jl)* zmsk(:,:) 1966 qevap_ice(:,:,jl) = qevap_ice(:,:,jl) * xcplmask(:,:,0) + zqevap_ice(:,:,jl)* zmsk(:,:) 1546 1967 ENDDO 1547 1968 qprec_ice(:,:) = qprec_ice(:,:) * xcplmask(:,:,0) + zqprec_ice(:,:)* zmsk(:,:) 1548 1969 qemp_oce (:,:) = qemp_oce(:,:) * xcplmask(:,:,0) + zqemp_oce(:,:)* zmsk(:,:) 1549 !!clem evap_ice(:,:) = evap_ice(:,:) * xcplmask(:,:,0)1970 qemp_ice (:,:) = qemp_ice(:,:) * xcplmask(:,:,0) + zqemp_ice(:,:)* zmsk(:,:) 1550 1971 ELSE 1551 1972 qns_tot (:,: ) = zqns_tot (:,: ) 1552 1973 qns_oce (:,: ) = zqns_oce (:,: ) 1553 1974 qns_ice (:,:,:) = zqns_ice (:,:,:) 1554 qprec_ice(:,:) = zqprec_ice(:,:) 1555 qemp_oce (:,:) = zqemp_oce (:,:) 1556 ENDIF 1557 1558 CALL wrk_dealloc( jpi,jpj, zevap, zsnw, zqns_oce, zqprec_ice, zqemp_oce ) 1975 qevap_ice(:,:,:) = zqevap_ice(:,:,:) 1976 qprec_ice(:,: ) = zqprec_ice(:,: ) 1977 qemp_oce (:,: ) = zqemp_oce (:,: ) 1978 qemp_ice (:,: ) = zqemp_ice (:,: ) 1979 ENDIF 1980 1981 !! clem: we should output qemp_oce and qemp_ice (at least) 1982 IF( iom_use('hflx_snow_cea') ) CALL iom_put( 'hflx_snow_cea', sprecip(:,:) * ( zcptn(:,:) - Lfus ) ) ! heat flux from snow (cell average) 1983 !! these diags are not outputed yet 1984 !! IF( iom_use('hflx_rain_cea') ) CALL iom_put( 'hflx_rain_cea', ( tprecip(:,:) - sprecip(:,:) ) * zcptn(:,:) ) ! heat flux from rain (cell average) 1985 !! IF( iom_use('hflx_snow_ao_cea') ) CALL iom_put( 'hflx_snow_ao_cea', sprecip(:,:) * ( zcptn(:,:) - Lfus ) * (1._wp - zsnw(:,:)) ) ! heat flux from snow (cell average) 1986 !! IF( iom_use('hflx_snow_ai_cea') ) CALL iom_put( 'hflx_snow_ai_cea', sprecip(:,:) * ( zcptn(:,:) - Lfus ) * zsnw(:,:) ) ! heat flux from snow (cell average) 1987 1559 1988 #else 1560 1561 1989 ! clem: this formulation is certainly wrong... but better than it was... 1990 1562 1991 zqns_tot(:,:) = zqns_tot(:,:) & ! zqns_tot update over free ocean with: 1563 & - ztmp(:,:) &! remove the latent heat flux of solid precip. melting1992 & - (p_frld(:,:) * zsprecip(:,:) * lfus) & ! remove the latent heat flux of solid precip. melting 1564 1993 & - ( zemp_tot(:,:) & ! remove the heat content of mass flux (assumed to be at SST) 1565 & - zemp_ice(:,:) * zicefr(:,:)) * zcptn(:,:)1994 & - zemp_ice(:,:) ) * zcptn(:,:) 1566 1995 1567 1996 IF( ln_mixcpl ) THEN … … 1575 2004 qns_ice(:,:,:) = zqns_ice(:,:,:) 1576 2005 ENDIF 1577 1578 2006 #endif 1579 2007 … … 1626 2054 1627 2055 #if defined key_lim3 1628 CALL wrk_alloc( jpi,jpj, zqsr_oce )1629 2056 ! --- solar flux over ocean --- ! 1630 2057 ! note: p_frld cannot be = 0 since we limit the ice concentration to amax … … 1634 2061 IF( ln_mixcpl ) THEN ; qsr_oce(:,:) = qsr_oce(:,:) * xcplmask(:,:,0) + zqsr_oce(:,:)* zmsk(:,:) 1635 2062 ELSE ; qsr_oce(:,:) = zqsr_oce(:,:) ; ENDIF 1636 1637 CALL wrk_dealloc( jpi,jpj, zqsr_oce )1638 2063 #endif 1639 2064 … … 1686 2111 fr2_i0(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice ) 1687 2112 1688 CALL wrk_dealloc( jpi,jpj, zcptn, ztmp, zicefr, zmsk, zemp_tot, zemp_ice, zsprecip, ztprecip, zqns_tot, zqsr_tot ) 1689 CALL wrk_dealloc( jpi,jpj,jpl, zqns_ice, zqsr_ice, zdqns_ice ) 2113 CALL wrk_dealloc( jpi,jpj, zcptn, ztmp, zicefr, zmsk, zsnw ) 2114 CALL wrk_dealloc( jpi,jpj, zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice ) 2115 CALL wrk_dealloc( jpi,jpj, zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice ) 2116 CALL wrk_dealloc( jpi,jpj,jpl, zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice ) 1690 2117 ! 1691 2118 IF( nn_timing == 1 ) CALL timing_stop('sbc_cpl_ice_flx') … … 1706 2133 ! 1707 2134 INTEGER :: ji, jj, jl ! dummy loop indices 2135 INTEGER :: ikchoix 1708 2136 INTEGER :: isec, info ! local integer 1709 2137 REAL(wp) :: zumax, zvmax 1710 2138 REAL(wp), POINTER, DIMENSION(:,:) :: zfr_l, ztmp1, ztmp2, zotx1, zoty1, zotz1, zitx1, zity1, zitz1 2139 REAL(wp), POINTER, DIMENSION(:,:) :: zotx1_in, zoty1_in 1711 2140 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmp3, ztmp4 1712 2141 !!---------------------------------------------------------------------- … … 1715 2144 ! 1716 2145 CALL wrk_alloc( jpi,jpj, zfr_l, ztmp1, ztmp2, zotx1, zoty1, zotz1, zitx1, zity1, zitz1 ) 2146 CALL wrk_alloc( jpi,jpj, zotx1_in, zoty1_in) 1717 2147 CALL wrk_alloc( jpi,jpj,jpl, ztmp3, ztmp4 ) 1718 2148 … … 1743 2173 ztmp3(:,:,1) = SUM( tn_ice * a_i, dim=3 ) / SUM( a_i, dim=3 ) 1744 2174 ELSEWHERE 1745 ztmp3(:,:,1) = rt0 ! TODO: Is freezing point a good default? (Maybe SST is better?)2175 ztmp3(:,:,1) = rt0 1746 2176 END WHERE 1747 2177 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%clcat' ) … … 1758 2188 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%clcat' ) 1759 2189 END SELECT 2190 CASE( 'oce and weighted ice' ) ; ztmp1(:,:) = tsn(:,:,1,jp_tem) + rt0 2191 SELECT CASE( sn_snd_temp%clcat ) 2192 CASE( 'yes' ) 2193 ztmp3(:,:,1:jpl) = tn_ice(:,:,1:jpl) * a_i(:,:,1:jpl) 2194 CASE( 'no' ) 2195 ztmp3(:,:,:) = 0.0 2196 DO jl=1,jpl 2197 ztmp3(:,:,1) = ztmp3(:,:,1) + tn_ice(:,:,jl) * a_i(:,:,jl) 2198 ENDDO 2199 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_temp%clcat' ) 2200 END SELECT 1760 2201 CASE( 'mixed oce-ice' ) 1761 2202 ztmp1(:,:) = ( ztmp1(:,:) + rt0 ) * zfr_l(:,:) … … 1774 2215 ! ! ------------------------- ! 1775 2216 IF( ssnd(jps_albice)%laction ) THEN ! ice 1776 SELECT CASE( sn_snd_alb%cldes ) 1777 CASE( 'ice' ) ; ztmp3(:,:,1:jpl) = alb_ice(:,:,1:jpl) 1778 CASE( 'weighted ice' ) ; ztmp3(:,:,1:jpl) = alb_ice(:,:,1:jpl) * a_i(:,:,1:jpl) 1779 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_alb%cldes' ) 2217 SELECT CASE( sn_snd_alb%cldes ) 2218 CASE( 'ice' ) 2219 SELECT CASE( sn_snd_alb%clcat ) 2220 CASE( 'yes' ) 2221 ztmp3(:,:,1:jpl) = alb_ice(:,:,1:jpl) 2222 CASE( 'no' ) 2223 WHERE( SUM( a_i, dim=3 ) /= 0. ) 2224 ztmp1(:,:) = SUM( alb_ice (:,:,1:jpl) * a_i(:,:,1:jpl), dim=3 ) / SUM( a_i(:,:,1:jpl), dim=3 ) 2225 ELSEWHERE 2226 ztmp1(:,:) = albedo_oce_mix(:,:) 2227 END WHERE 2228 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_alb%clcat' ) 2229 END SELECT 2230 CASE( 'weighted ice' ) ; 2231 SELECT CASE( sn_snd_alb%clcat ) 2232 CASE( 'yes' ) 2233 ztmp3(:,:,1:jpl) = alb_ice(:,:,1:jpl) * a_i(:,:,1:jpl) 2234 CASE( 'no' ) 2235 WHERE( fr_i (:,:) > 0. ) 2236 ztmp1(:,:) = SUM ( alb_ice(:,:,1:jpl) * a_i(:,:,1:jpl), dim=3 ) 2237 ELSEWHERE 2238 ztmp1(:,:) = 0. 2239 END WHERE 2240 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_ice%clcat' ) 2241 END SELECT 2242 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_alb%cldes' ) 1780 2243 END SELECT 1781 CALL cpl_snd( jps_albice, isec, ztmp3, info ) 1782 ENDIF 2244 2245 SELECT CASE( sn_snd_alb%clcat ) 2246 CASE( 'yes' ) 2247 CALL cpl_snd( jps_albice, isec, ztmp3, info ) !-> MV this has never been checked in coupled mode 2248 CASE( 'no' ) 2249 CALL cpl_snd( jps_albice, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info ) 2250 END SELECT 2251 ENDIF 2252 1783 2253 IF( ssnd(jps_albmix)%laction ) THEN ! mixed ice-ocean 1784 2254 ztmp1(:,:) = albedo_oce_mix(:,:) * zfr_l(:,:) … … 1799 2269 END SELECT 1800 2270 IF( ssnd(jps_fice)%laction ) CALL cpl_snd( jps_fice, isec, ztmp3, info ) 2271 ENDIF 2272 2273 ! Send ice fraction field (first order interpolation), for weighting UM fluxes to be passed to NEMO 2274 IF (ssnd(jps_fice1)%laction) THEN 2275 SELECT CASE (sn_snd_thick1%clcat) 2276 CASE( 'yes' ) ; ztmp3(:,:,1:jpl) = a_i(:,:,1:jpl) 2277 CASE( 'no' ) ; ztmp3(:,:,1) = fr_i(:,:) 2278 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_thick1%clcat' ) 2279 END SELECT 2280 CALL cpl_snd (jps_fice1, isec, ztmp3, info) 1801 2281 ENDIF 1802 2282 … … 1845 2325 ENDIF 1846 2326 ! 2327 #if defined key_cice && ! defined key_cice4 2328 ! Send meltpond fields 2329 IF( ssnd(jps_a_p)%laction .OR. ssnd(jps_ht_p)%laction ) THEN 2330 SELECT CASE( sn_snd_mpnd%cldes) 2331 CASE( 'weighted ice' ) 2332 SELECT CASE( sn_snd_mpnd%clcat ) 2333 CASE( 'yes' ) 2334 ztmp3(:,:,1:jpl) = a_p(:,:,1:jpl) * a_i(:,:,1:jpl) 2335 ztmp4(:,:,1:jpl) = ht_p(:,:,1:jpl) * a_i(:,:,1:jpl) 2336 CASE( 'no' ) 2337 ztmp3(:,:,:) = 0.0 2338 ztmp4(:,:,:) = 0.0 2339 DO jl=1,jpl 2340 ztmp3(:,:,1) = ztmp3(:,:,1) + a_p(:,:,jpl) * a_i(:,:,jpl) 2341 ztmp4(:,:,1) = ztmp4(:,:,1) + ht_p(:,:,jpl) * a_i(:,:,jpl) 2342 ENDDO 2343 CASE default ; CALL ctl_stop( 'sbc_cpl_mpd: wrong definition of sn_snd_mpnd%clcat' ) 2344 END SELECT 2345 CASE( 'ice only' ) 2346 ztmp3(:,:,1:jpl) = a_p(:,:,1:jpl) 2347 ztmp4(:,:,1:jpl) = ht_p(:,:,1:jpl) 2348 END SELECT 2349 IF( ssnd(jps_a_p)%laction ) CALL cpl_snd( jps_a_p, isec, ztmp3, info ) 2350 IF( ssnd(jps_ht_p)%laction ) CALL cpl_snd( jps_ht_p, isec, ztmp4, info ) 2351 ! 2352 ! Send ice effective conductivity 2353 SELECT CASE( sn_snd_cond%cldes) 2354 CASE( 'weighted ice' ) 2355 SELECT CASE( sn_snd_cond%clcat ) 2356 CASE( 'yes' ) 2357 ztmp3(:,:,1:jpl) = kn_ice(:,:,1:jpl) * a_i(:,:,1:jpl) 2358 CASE( 'no' ) 2359 ztmp3(:,:,:) = 0.0 2360 DO jl=1,jpl 2361 ztmp3(:,:,1) = ztmp3(:,:,1) + kn_ice(:,:,jl) * a_i(:,:,jl) 2362 ENDDO 2363 CASE default ; CALL ctl_stop( 'sbc_cpl_snd: wrong definition of sn_snd_cond%clcat' ) 2364 END SELECT 2365 CASE( 'ice only' ) 2366 ztmp3(:,:,1:jpl) = kn_ice(:,:,1:jpl) 2367 END SELECT 2368 IF( ssnd(jps_kice)%laction ) CALL cpl_snd( jps_kice, isec, ztmp3, info ) 2369 ENDIF 2370 #endif 2371 ! 2372 ! 1847 2373 #if defined key_cpl_carbon_cycle 1848 2374 ! ! ------------------------- ! … … 1852 2378 ! 1853 2379 #endif 2380 2381 2382 2383 IF (ln_medusa) THEN 2384 ! ! ---------------------------------------------- ! 2385 ! ! CO2 flux, DMS and chlorophyll from MEDUSA ! 2386 ! ! ---------------------------------------------- ! 2387 IF ( ssnd(jps_bio_co2)%laction ) THEN 2388 CALL cpl_snd( jps_bio_co2, isec, RESHAPE( CO2Flux_out_cpl, (/jpi,jpj,1/) ), info ) 2389 ENDIF 2390 2391 IF ( ssnd(jps_bio_dms)%laction ) THEN 2392 CALL cpl_snd( jps_bio_dms, isec, RESHAPE( DMS_out_cpl, (/jpi,jpj,1/) ), info ) 2393 ENDIF 2394 2395 IF ( ssnd(jps_bio_chloro)%laction ) THEN 2396 CALL cpl_snd( jps_bio_chloro, isec, RESHAPE( chloro_out_cpl, (/jpi,jpj,1/) ), info ) 2397 ENDIF 2398 ENDIF 2399 1854 2400 ! ! ------------------------- ! 1855 2401 IF( ssnd(jps_ocx1)%laction ) THEN ! Surface current ! … … 1858 2404 ! j+1 j -----V---F 1859 2405 ! surface velocity always sent from T point ! | 1860 ! 2406 ! [except for HadGEM3] j | T U 1861 2407 ! | | 1862 2408 ! j j-1 -I-------| … … 1867 2413 zotx1(:,:) = un(:,:,1) 1868 2414 zoty1(:,:) = vn(:,:,1) 1869 ELSE 2415 ELSE 1870 2416 SELECT CASE( TRIM( sn_snd_crt%cldes ) ) 1871 2417 CASE( 'oce only' ) ! C-grid ==> T 1872 DO jj = 2, jpjm1 1873 DO ji = fs_2, fs_jpim1 ! vector opt. 1874 zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj ,1) ) 1875 zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + vn(ji ,jj-1,1) ) 2418 IF ( TRIM( sn_snd_crt%clvgrd ) == 'T' ) THEN 2419 DO jj = 2, jpjm1 2420 DO ji = fs_2, fs_jpim1 ! vector opt. 2421 zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj ,1) ) 2422 zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + vn(ji ,jj-1,1) ) 2423 END DO 1876 2424 END DO 1877 END DO 2425 ELSE 2426 ! Temporarily Changed for UKV 2427 DO jj = 2, jpjm1 2428 DO ji = 2, jpim1 2429 zotx1(ji,jj) = un(ji,jj,1) 2430 zoty1(ji,jj) = vn(ji,jj,1) 2431 END DO 2432 END DO 2433 ENDIF 1878 2434 CASE( 'weighted oce and ice' ) 1879 2435 SELECT CASE ( cp_ice_msh ) … … 1934 2490 END DO 1935 2491 CASE( 'F' ) ! Ocean on C grid, Ice on F-point (B-grid) ==> T 1936 DO jj = 2, jpjm1 1937 DO ji = 2, jpim1 ! NO vector opt. 1938 zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj ,1) ) * zfr_l(ji,jj) & 1939 & + 0.25 * ( u_ice(ji-1,jj-1) + u_ice(ji,jj-1) & 1940 & + u_ice(ji-1,jj ) + u_ice(ji,jj ) ) * fr_i(ji,jj) 1941 zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + vn(ji ,jj-1,1) ) * zfr_l(ji,jj) & 1942 & + 0.25 * ( v_ice(ji-1,jj-1) + v_ice(ji,jj-1) & 1943 & + v_ice(ji-1,jj ) + v_ice(ji,jj ) ) * fr_i(ji,jj) 2492 IF ( TRIM( sn_snd_crt%clvgrd ) == 'T' ) THEN 2493 DO jj = 2, jpjm1 2494 DO ji = 2, jpim1 ! NO vector opt. 2495 zotx1(ji,jj) = 0.5 * ( un(ji,jj,1) + un(ji-1,jj,1) ) * zfr_l(ji,jj) & 2496 & + 0.25 * ( u_ice(ji-1,jj-1) + u_ice(ji,jj-1) & 2497 & + u_ice(ji-1,jj ) + u_ice(ji,jj ) ) * fr_i(ji,jj) 2498 zoty1(ji,jj) = 0.5 * ( vn(ji,jj,1) + vn(ji,jj-1,1) ) * zfr_l(ji,jj) & 2499 & + 0.25 * ( v_ice(ji-1,jj-1) + v_ice(ji,jj-1) & 2500 & + v_ice(ji-1,jj ) + v_ice(ji,jj ) ) * fr_i(ji,jj) 2501 END DO 1944 2502 END DO 1945 END DO 2503 #if defined key_cice 2504 ELSE 2505 ! Temporarily Changed for HadGEM3 2506 DO jj = 2, jpjm1 2507 DO ji = 2, jpim1 ! NO vector opt. 2508 zotx1(ji,jj) = (1.0-fr_iu(ji,jj)) * un(ji,jj,1) & 2509 & + fr_iu(ji,jj) * 0.5 * ( u_ice(ji,jj-1) + u_ice(ji,jj) ) 2510 zoty1(ji,jj) = (1.0-fr_iv(ji,jj)) * vn(ji,jj,1) & 2511 & + fr_iv(ji,jj) * 0.5 * ( v_ice(ji-1,jj) + v_ice(ji,jj) ) 2512 END DO 2513 END DO 2514 #endif 2515 ENDIF 1946 2516 END SELECT 1947 2517 END SELECT … … 1953 2523 IF( TRIM( sn_snd_crt%clvor ) == 'eastward-northward' ) THEN ! Rotation of the components 1954 2524 ! ! Ocean component 1955 CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->e', ztmp1 ) ! 1st component 1956 CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->n', ztmp2 ) ! 2nd component 1957 zotx1(:,:) = ztmp1(:,:) ! overwrite the components 1958 zoty1(:,:) = ztmp2(:,:) 1959 IF( ssnd(jps_ivx1)%laction ) THEN ! Ice component 1960 CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->e', ztmp1 ) ! 1st component 1961 CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->n', ztmp2 ) ! 2nd component 1962 zitx1(:,:) = ztmp1(:,:) ! overwrite the components 1963 zity1(:,:) = ztmp2(:,:) 1964 ENDIF 2525 IF ( TRIM( sn_snd_crt%clvgrd ) == 'T' ) THEN 2526 CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->e', ztmp1 ) ! 1st component 2527 CALL rot_rep( zotx1, zoty1, ssnd(jps_ocx1)%clgrid, 'ij->n', ztmp2 ) ! 2nd component 2528 zotx1(:,:) = ztmp1(:,:) ! overwrite the components 2529 zoty1(:,:) = ztmp2(:,:) 2530 IF( ssnd(jps_ivx1)%laction ) THEN ! Ice component 2531 CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->e', ztmp1 ) ! 1st component 2532 CALL rot_rep( zitx1, zity1, ssnd(jps_ivx1)%clgrid, 'ij->n', ztmp2 ) ! 2nd component 2533 zitx1(:,:) = ztmp1(:,:) ! overwrite the components 2534 zity1(:,:) = ztmp2(:,:) 2535 ENDIF 2536 ELSE 2537 ! Temporary code for HadGEM3 - will be removed eventually. 2538 ! Only applies when we want uvel on U grid and vvel on V grid 2539 ! Rotate U and V onto geographic grid before sending. 2540 2541 DO jj=2,jpjm1 2542 DO ji=2,jpim1 2543 ztmp1(ji,jj)=0.25*vmask(ji,jj,1) & 2544 *(zotx1(ji,jj)+zotx1(ji-1,jj) & 2545 +zotx1(ji,jj+1)+zotx1(ji-1,jj+1)) 2546 ztmp2(ji,jj)=0.25*umask(ji,jj,1) & 2547 *(zoty1(ji,jj)+zoty1(ji+1,jj) & 2548 +zoty1(ji,jj-1)+zoty1(ji+1,jj-1)) 2549 ENDDO 2550 ENDDO 2551 2552 ! Ensure any N fold and wrap columns are updated 2553 CALL lbc_lnk(ztmp1, 'V', -1.0) 2554 CALL lbc_lnk(ztmp2, 'U', -1.0) 2555 2556 ikchoix = -1 2557 ! We need copies of zotx1 and zoty2 in order to avoid problems 2558 ! caused by INTENTs used in the following subroutine. 2559 zotx1_in(:,:) = zotx1(:,:) 2560 zoty1_in(:,:) = zoty1(:,:) 2561 CALL repcmo (zotx1_in,ztmp2,ztmp1,zoty1_in,zotx1,zoty1,ikchoix) 2562 ENDIF 1965 2563 ENDIF 1966 2564 ! … … 2023 2621 IF( ssnd(jps_rnf )%laction ) CALL cpl_snd( jps_rnf , isec, RESHAPE ( rnf , (/jpi,jpj,1/) ), info ) 2024 2622 IF( ssnd(jps_taum )%laction ) CALL cpl_snd( jps_taum , isec, RESHAPE ( taum, (/jpi,jpj,1/) ), info ) 2025 2623 2624 #if defined key_cice 2625 ztmp1(:,:) = sstfrz(:,:) + rt0 2626 IF( ssnd(jps_sstfrz)%laction ) CALL cpl_snd( jps_sstfrz, isec, RESHAPE ( ztmp1, (/jpi,jpj,1/) ), info ) 2627 #endif 2628 ! 2026 2629 CALL wrk_dealloc( jpi,jpj, zfr_l, ztmp1, ztmp2, zotx1, zoty1, zotz1, zitx1, zity1, zitz1 ) 2630 CALL wrk_dealloc( jpi,jpj, zotx1_in, zoty1_in ) 2027 2631 CALL wrk_dealloc( jpi,jpj,jpl, ztmp3, ztmp4 ) 2028 2632 ! -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90
r7960 r9987 108 108 ! 109 109 IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN 110 z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + rdivisf * fwfisf(:,:) -snwice_fmass(:,:) ) ) / area ! sum over the global domain110 z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + fwfisf(:,:) - snwice_fmass(:,:) ) ) / area ! sum over the global domain 111 111 zcoef = z_fwf * rcp 112 112 emp(:,:) = emp(:,:) - z_fwf * tmask(:,:,1) … … 162 162 zsurf_pos = glob_sum( e1e2t(:,:)*ztmsk_pos(:,:) ) 163 163 ! ! fwf global mean (excluding ocean to ice/snow exchanges) 164 z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + rdivisf *fwfisf(:,:) - snwice_fmass(:,:) ) ) / area164 z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) + fwfisf(:,:) - snwice_fmass(:,:) ) ) / area 165 165 ! 166 166 IF( z_fwf < 0._wp ) THEN ! spread out over >0 erp area to increase evaporation -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
r7960 r9987 15 15 USE dom_oce ! ocean space and time domain 16 16 USE domvvl 17 USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic 17 USE eosbn2, only : eos_fzp ! Function to calculate freezing point of seawater 18 USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic, rt0 18 19 USE in_out_manager ! I/O manager 19 20 USE iom, ONLY : iom_put,iom_use ! I/O manager library !!Joakim edit … … 37 38 USE ice_gather_scatter 38 39 USE ice_calendar, only: dt 40 # if defined key_cice4 39 41 USE ice_state, only: aice,aicen,uvel,vvel,vsno,vsnon,vice,vicen 40 # if defined key_cice441 42 USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow, & 42 43 strocnxT,strocnyT, & … … 45 46 flatn_f,fsurfn_f,fcondtopn_f, & 46 47 uatm,vatm,wind,fsw,flw,Tair,potT,Qa,rhoa,zlvl, & 47 swvdr,swvdf,swidr,swidf 48 swvdr,swvdf,swidr,swidf,Tf 48 49 USE ice_therm_vertical, only: calc_Tsfc 49 50 #else 51 USE ice_state, only: aice,aicen,uvel,nt_hpnd,trcrn,vvel,vsno,& 52 vsnon,vice,vicen,nt_Tsfc 50 53 USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow, & 51 54 strocnxT,strocnyT, & 52 sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_ai, &53 fresh_ai,fhocn_ai,fswthru_ai,frzmlt, &55 sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_ai, & 56 fresh_ai,fhocn_ai,fswthru_ai,frzmlt, & 54 57 flatn_f,fsurfn_f,fcondtopn_f, & 58 #ifdef key_asminc 59 daice_da,fresh_da,fsalt_da, & 60 #endif 55 61 uatm,vatm,wind,fsw,flw,Tair,potT,Qa,rhoa,zlvl, & 56 swvdr,swvdf,swidr,swidf 57 USE ice_therm_shared, only: calc_Tsfc 62 swvdr,swvdf,swidr,swidf,Tf, & 63 !! When using NEMO with CICE, this change requires use of 64 !! one of the following two CICE branches: 65 !! - at CICE5.0, hadax/r1015_GSI8_with_GSI7 66 !! - at CICE5.1.2, hadax/vn5.1.2_GSI8 67 keffn_top,Tn_top 68 69 USE ice_therm_shared, only: calc_Tsfc, heat_capacity 70 USE ice_shortwave, only: apeffn 58 71 #endif 59 72 USE ice_forcing, only: frcvdr,frcvdf,frcidr,frcidf … … 161 174 INTEGER, INTENT( in ) :: ksbc ! surface forcing type 162 175 REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2 163 REAL(wp) :: zcoefu, zcoefv, zcoeff ! local scalar176 REAL(wp), DIMENSION(:,:,:), POINTER :: ztfrz3d 164 177 INTEGER :: ji, jj, jl, jk ! dummy loop indices 165 178 !!--------------------------------------------------------------------- … … 174 187 jj_off = INT ( (jpjglo - ny_global) / 2 ) 175 188 176 #if defined key_nemocice_decomp 177 ! Pass initial SST from NEMO to CICE so ice is initialised correctly if 178 ! there is no restart file. 179 ! Values from a CICE restart file would overwrite this 180 IF ( .NOT. ln_rstart ) THEN 181 CALL nemo2cice( tsn(:,:,1,jp_tem) , sst , 'T' , 1.) 182 ENDIF 183 #endif 184 185 ! Initialize CICE 189 ! Initialize CICE 186 190 CALL CICE_Initialize 187 191 188 ! Do some CICE consistency checks192 ! Do some CICE consistency checks 189 193 IF ( (ksbc == jp_flx) .OR. (ksbc == jp_purecpl) ) THEN 190 194 IF ( calc_strair .OR. calc_Tsfc ) THEN … … 198 202 199 203 200 ! allocate sbc_ice and sbc_cice arrays201 IF( sbc_ice_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_ice_ cice_alloc : unable to allocate arrays' )204 ! allocate sbc_ice and sbc_cice arrays 205 IF( sbc_ice_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_ice_alloc : unable to allocate arrays' ) 202 206 IF( sbc_ice_cice_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_ice_cice_alloc : unable to allocate cice arrays' ) 203 207 204 ! Ensure ocean temperatures are nowhere below freezing if not a NEMO restart208 ! Ensure that no temperature points are below freezing if not a NEMO restart 205 209 IF( .NOT. ln_rstart ) THEN 206 tsn(:,:,:,jp_tem) = MAX (tsn(:,:,:,jp_tem),Tocnfrz) 210 211 CALL wrk_alloc( jpi,jpj,jpk, ztfrz3d ) 212 DO jk=1,jpk 213 CALL eos_fzp( tsn(:,:,jk,jp_sal), ztfrz3d(:,:,jk), fsdept_n(:,:,jk) ) 214 ENDDO 215 tsn(:,:,:,jp_tem) = MAX( tsn(:,:,:,jp_tem), ztfrz3d ) 207 216 tsb(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) 208 ENDIF 209 210 fr_iu(:,:)=0.0 211 fr_iv(:,:)=0.0 217 CALL wrk_dealloc( jpi,jpj,jpk, ztfrz3d ) 218 219 #if defined key_nemocice_decomp 220 ! Pass initial SST from NEMO to CICE so ice is initialised correctly if 221 ! there is no restart file. 222 ! Values from a CICE restart file would overwrite this 223 CALL nemo2cice( tsn(:,:,1,jp_tem) , sst , 'T' , 1.) 224 #endif 225 226 ENDIF 227 228 ! calculate surface freezing temperature and send to CICE 229 CALL eos_fzp(sss_m(:,:), sstfrz(:,:), fsdept_n(:,:,1)) 230 CALL nemo2cice(sstfrz,Tf, 'T', 1. ) 212 231 213 232 CALL cice2nemo(aice,fr_i, 'T', 1. ) … … 220 239 ! T point to U point 221 240 ! T point to V point 241 fr_iu(:,:)=0.0 242 fr_iv(:,:)=0.0 222 243 DO jj=1,jpjm1 223 244 DO ji=1,jpim1 … … 283 304 284 305 CALL wrk_dealloc( jpi,jpj, ztmp1, ztmp2 ) 285 ! 306 307 #if defined key_asminc 308 ! Initialize fresh water and salt fluxes from data assim 309 ! and data assimilation index to cice 310 nfresh_da(:,:) = 0.0 311 nfsalt_da(:,:) = 0.0 312 ndaice_da(:,:) = 0.0 313 #endif 314 ! 315 ! In coupled mode get extra fields from CICE for passing back to atmosphere 316 317 IF ( ksbc == jp_purecpl ) CALL cice_sbc_hadgam(nit000) 318 ! 286 319 IF( nn_timing == 1 ) CALL timing_stop('cice_sbc_init') 287 320 ! … … 343 376 CALL nemo2cice(ztmp,stray,'F', -1. ) 344 377 378 379 ! Alex West: From configuration GSI8 onwards, when NEMO is used with CICE in 380 ! HadGEM3 the 'time-travelling ice' coupling approach is used, whereby 381 ! atmosphere-ice fluxes are passed as pseudo-local values, formed by dividing 382 ! gridbox mean fluxes in the UM by future ice concentration obtained through 383 ! OASIS. This allows for a much more realistic apportionment of energy through 384 ! the ice - and conserves energy. 385 ! Therefore the fluxes are now divided by ice concentration in the coupled 386 ! formulation (jp_purecpl) as well as for jp_flx. This NEMO branch should only 387 ! be used at UM10.2 onwards (unless an explicit GSI8 UM branch is included), at 388 ! which point the GSI8 UM changes were committed. 389 345 390 ! Surface downward latent heat flux (CI_5) 346 391 IF (ksbc == jp_flx) THEN … … 348 393 ztmpn(:,:,jl)=qla_ice(:,:,1)*a_i(:,:,jl) 349 394 ENDDO 350 ELSE 351 ! emp_ice is set in sbc_cpl_ice_flx as sublimation-snow 352 qla_ice(:,:,1)= - ( emp_ice(:,:)+sprecip(:,:) ) * Lsub 353 ! End of temporary code 354 DO jj=1,jpj 355 DO ji=1,jpi 356 IF (fr_i(ji,jj).eq.0.0) THEN 357 DO jl=1,ncat 358 ztmpn(ji,jj,jl)=0.0 359 ENDDO 360 ! This will then be conserved in CICE 361 ztmpn(ji,jj,1)=qla_ice(ji,jj,1) 362 ELSE 363 DO jl=1,ncat 364 ztmpn(ji,jj,jl)=qla_ice(ji,jj,1)*a_i(ji,jj,jl)/fr_i(ji,jj) 365 ENDDO 366 ENDIF 367 ENDDO 395 ELSE IF (ksbc == jp_purecpl) THEN 396 DO jl=1,ncat 397 ztmpn(:,:,jl)=qla_ice(:,:,jl)*a_i(:,:,jl) 368 398 ENDDO 399 ELSE 400 !In coupled mode - qla_ice calculated in sbc_cpl for each category 401 ztmpn(:,:,1:ncat)=qla_ice(:,:,1:ncat) 369 402 ENDIF 403 370 404 DO jl=1,ncat 371 405 CALL nemo2cice(ztmpn(:,:,jl),flatn_f(:,:,jl,:),'T', 1. ) … … 373 407 ! GBM conductive flux through ice (CI_6) 374 408 ! Convert to GBM 375 IF (ksbc == jp_flx ) THEN409 IF (ksbc == jp_flx .OR. ksbc == jp_purecpl) THEN 376 410 ztmp(:,:) = botmelt(:,:,jl)*a_i(:,:,jl) 377 411 ELSE … … 382 416 ! GBM surface heat flux (CI_7) 383 417 ! Convert to GBM 384 IF (ksbc == jp_flx ) THEN418 IF (ksbc == jp_flx .OR. ksbc == jp_purecpl) THEN 385 419 ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))*a_i(:,:,jl) 386 420 ELSE … … 431 465 ENDIF 432 466 467 #if defined key_asminc 468 !Ice concentration change (from assimilation) 469 ztmp(:,:)=ndaice_da(:,:)*tmask(:,:,1) 470 Call nemo2cice(ztmp,daice_da,'T', 1. ) 471 #endif 472 433 473 ! Snowfall 434 474 ! Ensure fsnow is positive (as in CICE routine prepare_forcing) 435 475 IF( iom_use('snowpre') ) CALL iom_put('snowpre',MAX( (1.0-fr_i(:,:))*sprecip(:,:) ,0.0)) !!Joakim edit 436 ztmp(:,:)=MAX(fr_i(:,:)*sprecip(:,:),0.0) 476 IF( kt == nit000 .AND. lwp ) THEN 477 WRITE(numout,*) 'sprecip weight, rn_sfac=', rn_sfac 478 ENDIF 479 ztmp(:,:)=MAX(fr_i(:,:)*rn_sfac*sprecip(:,:),0.0) 437 480 CALL nemo2cice(ztmp,fsnow,'T', 1. ) 438 481 … … 442 485 CALL nemo2cice(ztmp,frain,'T', 1. ) 443 486 487 ! Recalculate freezing temperature and send to CICE 488 CALL eos_fzp(sss_m(:,:), sstfrz(:,:), fsdept_n(:,:,1)) 489 CALL nemo2cice(sstfrz,Tf,'T', 1. ) 490 444 491 ! Freezing/melting potential 445 492 ! Calculated over NEMO leapfrog timestep (hence 2*dt) 446 nfrzmlt(:,:)=rau0*rcp*fse3t_m(:,:)*(Tocnfrz-sst_m(:,:))/(2.0*dt) 447 448 ztmp(:,:) = nfrzmlt(:,:) 449 CALL nemo2cice(ztmp,frzmlt,'T', 1. ) 493 nfrzmlt(:,:)=rau0*rcp*fse3t_m(:,:)*(sstfrz(:,:)-sst_m(:,:))/(2.0*dt) 494 CALL nemo2cice(nfrzmlt,frzmlt,'T', 1. ) 450 495 451 496 ! SST and SSS … … 453 498 CALL nemo2cice(sst_m,sst,'T', 1. ) 454 499 CALL nemo2cice(sss_m,sss,'T', 1. ) 500 501 IF( ksbc == jp_purecpl ) THEN 502 ! Sea ice surface skin temperature 503 DO jl=1,ncat 504 CALL nemo2cice(tsfc_ice(:,:,jl), trcrn(:,:,nt_tsfc,jl,:),'T',1.) 505 ENDDO 506 ENDIF 455 507 456 508 ! x comp and y comp of surface ocean current … … 685 737 ENDIF 686 738 739 #if defined key_asminc 740 ! Import fresh water and salt flux due to seaice da 741 CALL cice2nemo(fresh_da, nfresh_da,'T',1.0) 742 CALL cice2nemo(fsalt_da, nfsalt_da,'T',1.0) 743 #endif 744 687 745 ! Release work space 688 746 … … 708 766 IF( nn_timing == 1 ) CALL timing_start('cice_sbc_hadgam') 709 767 ! 710 IF( kt == nit000 ) THEN711 IF(lwp) WRITE(numout,*)'cice_sbc_hadgam'712 IF( sbc_cpl_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' )713 ENDIF714 715 768 ! ! =========================== ! 716 769 ! ! Prepare Coupling fields ! … … 730 783 CALL cice2nemo(vicen(:,:,jl,:),ht_i(:,:,jl),'T', 1. ) 731 784 ENDDO 785 786 #if ! defined key_cice4 787 ! Meltpond fraction and depth 788 DO jl = 1,ncat 789 CALL cice2nemo(apeffn(:,:,jl,:),a_p(:,:,jl),'T', 1. ) 790 CALL cice2nemo(trcrn(:,:,nt_hpnd,jl,:),ht_p(:,:,jl),'T', 1. ) 791 ENDDO 792 #endif 793 794 795 ! If using multilayers thermodynamics in CICE then get top layer temperature 796 ! and effective conductivity 797 !! When using NEMO with CICE, this change requires use of 798 !! one of the following two CICE branches: 799 !! - at CICE5.0, hadax/r1015_GSI8_with_GSI7 800 !! - at CICE5.1.2, hadax/vn5.1.2_GSI8 801 IF (heat_capacity) THEN 802 DO jl = 1,ncat 803 CALL cice2nemo(Tn_top(:,:,jl,:),tn_ice(:,:,jl),'T', 1. ) 804 CALL cice2nemo(keffn_top(:,:,jl,:),kn_ice(:,:,jl),'T', 1. ) 805 ENDDO 806 ! Convert surface temperature to Kelvin 807 tn_ice(:,:,:)=tn_ice(:,:,:)+rt0 808 ELSE 809 tn_ice(:,:,:) = 0.0 810 kn_ice(:,:,:) = 0.0 811 ENDIF 812 732 813 ! 733 814 IF( nn_timing == 1 ) CALL timing_stop('cice_sbc_hadgam') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_if.F90
r7960 r9987 103 103 ! ( d rho / dt ) / ( d rho / ds ) ( s = 34, t = -1.8 ) 104 104 105 fr_i(:,:) = eos_fzp( sss_m ) * tmask(:,:,1) ! sea surface freezing temperature [Celcius] 105 CALL eos_fzp( sss_m(:,:), fr_i(:,:) ) ! sea surface freezing temperature [Celcius] 106 fr_i(:,:) = fr_i(:,:) * tmask(:,:,1) 106 107 107 108 IF( ln_cpl ) a_i(:,:,1) = fr_i(:,:) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90
r7960 r9987 110 110 INTEGER :: jl ! dummy loop index 111 111 REAL(wp), POINTER, DIMENSION(:,:,:) :: zalb_os, zalb_cs ! ice albedo under overcast/clear sky 112 REAL(wp), POINTER, DIMENSION(:,:,:) :: zalb_ice ! mean ice albedo (for coupled)113 112 REAL(wp), POINTER, DIMENSION(:,: ) :: zutau_ice, zvtau_ice 114 113 !!---------------------------------------------------------------------- … … 126 125 127 126 ! masked sea surface freezing temperature [Kelvin] (set to rt0 over land) 128 t_bo(:,:) = ( eos_fzp( sss_m ) + rt0 ) * tmask(:,:,1) + rt0 * ( 1._wp - tmask(:,:,1) ) 129 127 CALL eos_fzp( sss_m(:,:) , t_bo(:,:) ) 128 t_bo(:,:) = ( t_bo(:,:) + rt0 ) * tmask(:,:,1) + rt0 * ( 1._wp - tmask(:,:,1) ) 129 130 130 ! Mask sea ice surface temperature (set to rt0 over land) 131 131 DO jl = 1, jpl … … 196 196 ! fr1_i0 , fr2_i0 : 1sr & 2nd fraction of qsr penetration in ice [%] 197 197 !---------------------------------------------------------------------------------------- 198 CALL wrk_alloc( jpi,jpj,jpl, zalb_os, zalb_cs , zalb_ice)198 CALL wrk_alloc( jpi,jpj,jpl, zalb_os, zalb_cs ) 199 199 CALL albedo_ice( t_su, ht_i, ht_s, zalb_cs, zalb_os ) ! cloud-sky and overcast-sky ice albedos 200 200 … … 202 202 CASE( jp_clio ) ! CLIO bulk formulation 203 203 ! In CLIO the cloud fraction is read in the climatology and the all-sky albedo 204 ! ( zalb_ice) is computed within the bulk routine205 CALL blk_ice_clio_flx( t_su, zalb_cs, zalb_os, zalb_ice )206 IF( ln_mixcpl ) CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi= zalb_ice, psst=sst_m, pist=t_su )207 IF( nn_limflx /= 2 ) CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx )204 ! (alb_ice) is computed within the bulk routine 205 CALL blk_ice_clio_flx( t_su, zalb_cs, zalb_os, alb_ice ) 206 IF( ln_mixcpl ) CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=alb_ice, psst=sst_m, pist=t_su ) 207 IF( nn_limflx /= 2 ) CALL ice_lim_flx( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 208 208 CASE( jp_core ) ! CORE bulk formulation 209 209 ! albedo depends on cloud fraction because of non-linear spectral effects 210 zalb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:)211 CALL blk_ice_core_flx( t_su, zalb_ice )212 IF( ln_mixcpl ) CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi= zalb_ice, psst=sst_m, pist=t_su )213 IF( nn_limflx /= 2 ) CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx )210 alb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:) 211 CALL blk_ice_core_flx( t_su, alb_ice ) 212 IF( ln_mixcpl ) CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=alb_ice, psst=sst_m, pist=t_su ) 213 IF( nn_limflx /= 2 ) CALL ice_lim_flx( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 214 214 CASE ( jp_purecpl ) 215 215 ! albedo depends on cloud fraction because of non-linear spectral effects 216 zalb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:) 217 CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=zalb_ice, psst=sst_m, pist=t_su ) 218 ! clem: evap_ice is forced to 0 in coupled mode for now 219 ! but it needs to be changed (along with modif in limthd_dh) once heat flux from evap will be avail. from atm. models 220 evap_ice (:,:,:) = 0._wp ; devap_ice (:,:,:) = 0._wp 221 IF( nn_limflx == 2 ) CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 216 alb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:) 217 CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=alb_ice, psst=sst_m, pist=t_su ) 218 IF( nn_limflx == 2 ) CALL ice_lim_flx( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 222 219 END SELECT 223 CALL wrk_dealloc( jpi,jpj,jpl, zalb_os, zalb_cs , zalb_ice)220 CALL wrk_dealloc( jpi,jpj,jpl, zalb_os, zalb_cs ) 224 221 225 222 !----------------------------! … … 264 261 !!---------------------------------------------------------------------- 265 262 INTEGER :: ierr 263 INTEGER :: ji, jj 266 264 !!---------------------------------------------------------------------- 267 265 IF(lwp) WRITE(numout,*) … … 320 318 tn_ice(:,:,:) = t_su(:,:,:) ! initialisation of surface temp for coupled simu 321 319 ! 320 DO jj = 1, jpj 321 DO ji = 1, jpi 322 IF( gphit(ji,jj) > 0._wp ) THEN ; rn_amax_2d(ji,jj) = rn_amax_n ! NH 323 ELSE ; rn_amax_2d(ji,jj) = rn_amax_s ! SH 324 ENDIF 325 ENDDO 326 ENDDO 327 ! 322 328 nstart = numit + nn_fsbc 323 329 nitrun = nitend - nit000 + 1 … … 342 348 INTEGER :: ios ! Local integer output status for namelist read 343 349 NAMELIST/namicerun/ jpl, nlay_i, nlay_s, cn_icerst_in, cn_icerst_indir, cn_icerst_out, cn_icerst_outdir, & 344 & ln_limdyn, rn_amax , ln_limdiahsb, ln_limdiaout, ln_icectl, iiceprt, jiceprt350 & ln_limdyn, rn_amax_n, rn_amax_s, ln_limdiahsb, ln_limdiaout, ln_icectl, iiceprt, jiceprt 345 351 !!------------------------------------------------------------------- 346 352 ! … … 363 369 WRITE(numout,*) ' number of snow layers = ', nlay_s 364 370 WRITE(numout,*) ' switch for ice dynamics (1) or not (0) ln_limdyn = ', ln_limdyn 365 WRITE(numout,*) ' maximum ice concentration = ', rn_amax 371 WRITE(numout,*) ' maximum ice concentration for NH = ', rn_amax_n 372 WRITE(numout,*) ' maximum ice concentration for SH = ', rn_amax_s 366 373 WRITE(numout,*) ' Diagnose heat/salt budget or not ln_limdiahsb = ', ln_limdiahsb 367 374 WRITE(numout,*) ' Output heat/salt budget or not ln_limdiaout = ', ln_limdiaout … … 578 585 sfx_bog(:,:) = 0._wp ; sfx_dyn(:,:) = 0._wp 579 586 sfx_bom(:,:) = 0._wp ; sfx_sum(:,:) = 0._wp 580 sfx_res(:,:) = 0._wp 587 sfx_res(:,:) = 0._wp ; sfx_sub(:,:) = 0._wp 581 588 582 589 wfx_snw(:,:) = 0._wp ; wfx_ice(:,:) = 0._wp … … 594 601 hfx_spr(:,:) = 0._wp ; hfx_dif(:,:) = 0._wp 595 602 hfx_err(:,:) = 0._wp ; hfx_err_rem(:,:) = 0._wp 596 hfx_err_dif(:,:) = 0._wp ; 597 603 hfx_err_dif(:,:) = 0._wp 604 wfx_err_sub(:,:) = 0._wp 605 598 606 afx_tot(:,:) = 0._wp ; 599 607 afx_dyn(:,:) = 0._wp ; afx_thd(:,:) = 0._wp -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90
r7960 r9987 150 150 151 151 ! ... masked sea surface freezing temperature [Kelvin] (set to rt0 over land) 152 tfu(:,:) = eos_fzp( sss_m ) + rt0 152 CALL eos_fzp( sss_m(:,:), tfu(:,:) ) 153 tfu(:,:) = tfu(:,:) + rt0 153 154 154 155 zsist (:,:,1) = sist (:,:) + rt0 * ( 1. - tmask(:,:,1) ) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90
r7960 r9987 26 26 USE zdfbfr 27 27 USE fldread ! read input field at current time step 28 29 28 USE lib_fortran, ONLY: glob_sum 30 29 31 30 IMPLICIT NONE … … 53 52 REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:) :: risfLeff !:effective length (Leff) BG03 nn_isf==2 54 53 REAL(wp) , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:) :: ttbl, stbl, utbl, vtbl !:top boundary layer variable at T point 55 #if defined key_agrif56 ! AGRIF can not handle these arrays as integers. The reason is a mystery but problems avoided by declaring them as reals57 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:) :: misfkt, misfkb !:Level of ice shelf base58 !: (first wet level and last level include in the tbl)59 #else60 54 INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:) :: misfkt, misfkb !:Level of ice shelf base 61 #endif62 55 63 56 … … 90 83 INTEGER :: ji, jj, jk, ijkmin, inum, ierror 91 84 INTEGER :: ikt, ikb ! top and bottom level of the isf boundary layer 85 REAL(wp) :: zgreenland_fwfisf_sum, zantarctica_fwfisf_sum 92 86 REAL(wp) :: rmin 93 87 REAL(wp) :: zhk 94 CHARACTER(len=256) :: cfisf, cvarzisf, cvarhisf ! name for isf file 88 REAL(wp) :: zt_frz, zpress 89 CHARACTER(len=256) :: cfisf , cvarzisf, cvarhisf ! name for isf file 95 90 CHARACTER(LEN=256) :: cnameis ! name of iceshelf file 96 91 CHARACTER (LEN=32) :: cvarLeff ! variable name for efficient Length scale 97 92 INTEGER :: ios ! Local integer output status for namelist read 93 94 REAL(wp), DIMENSION(:,:,:), POINTER :: zfwfisf3d, zqhcisf3d, zqlatisf3d 95 REAL(wp), DIMENSION(:,: ), POINTER :: zqhcisf2d 98 96 ! 99 97 !!--------------------------------------------------------------------- … … 176 174 DO jj = 1, jpj 177 175 jk = 2 178 DO WHILE ( jk .LE. mbkt(ji,jj) .AND. fsdepw(ji,jj,jk) < rzisf_tbl(ji,jj) ) ; jk = jk + 1 ; END DO176 DO WHILE ( jk .LE. mbkt(ji,jj) .AND. gdepw_0(ji,jj,jk) < rzisf_tbl(ji,jj) ) ; jk = jk + 1 ; END DO 179 177 misfkt(ji,jj) = jk-1 180 178 END DO … … 194 192 END IF 195 193 194 ! save initial top boundary layer thickness 196 195 rhisf_tbl_0(:,:) = rhisf_tbl(:,:) 196 197 END IF 198 199 ! ! ---------------------------------------- ! 200 IF( kt /= nit000 ) THEN ! Swap of forcing fields ! 201 ! ! ---------------------------------------- ! 202 fwfisf_b (:,: ) = fwfisf (:,: ) ! Swap the ocean forcing fields except at nit000 203 risf_tsc_b(:,:,:) = risf_tsc(:,:,:) ! where before fields are set at the end of the routine 204 ! 205 ENDIF 206 207 IF( MOD( kt-1, nn_fsbc) == 0 ) THEN 197 208 198 209 ! compute bottom level of isf tbl and thickness of tbl below the ice shelf … … 205 216 206 217 ! determine the deepest level influenced by the boundary layer 207 ! test on tmask useless ?????208 218 DO jk = ikt, mbkt(ji,jj) 209 219 IF ( (SUM(fse3t_n(ji,jj,ikt:jk-1)) .LT. rhisf_tbl(ji,jj)) .AND. (tmask(ji,jj,jk) == 1) ) ikb = jk … … 217 227 END DO 218 228 END DO 219 220 END IF221 222 ! ! ---------------------------------------- !223 IF( kt /= nit000 ) THEN ! Swap of forcing fields !224 ! ! ---------------------------------------- !225 fwfisf_b (:,: ) = fwfisf (:,: ) ! Swap the ocean forcing fields except at nit000226 risf_tsc_b(:,:,:) = risf_tsc(:,:,:) ! where before fields are set at the end of the routine227 !228 ENDIF229 230 IF( MOD( kt-1, nn_fsbc) == 0 ) THEN231 232 229 233 230 ! compute salf and heat flux … … 256 253 CALL fld_read ( kt, nn_fsbc, sf_rnfisf ) 257 254 fwfisf(:,:) = - sf_rnfisf(1)%fnow(:,:,1) ! fresh water flux from the isf (fwfisf <0 mean melting) 255 256 IF( lk_oasis) THEN 257 ! nn_coupled_iceshelf_fluxes uninitialised unless lk_oasis=true 258 IF( nn_coupled_iceshelf_fluxes .gt. 0 ) THEN 259 260 ! Adjust total iceshelf melt rates so that sum of iceberg calving and iceshelf melting in the northern 261 ! and southern hemispheres equals rate of increase of mass of greenland and antarctic ice sheets 262 ! to preserve total freshwater conservation in coupled models without an active ice sheet model. 263 264 ! All related global sums must be done bit reproducibly 265 zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 266 267 ! use ABS function because we need to preserve the sign of fwfisf 268 WHERE( greenland_icesheet_mask(:,:) == 1.0 ) & 269 & fwfisf(:,:) = fwfisf(:,:) * ABS( greenland_icesheet_mass_rate_of_change * (1.0-rn_greenland_calving_fraction) & 270 & / ( zgreenland_fwfisf_sum + 1.0e-10_wp ) ) 271 272 ! check 273 IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting climatology (kg/s) : ',zgreenland_fwfisf_sum 274 275 zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 276 277 IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting adjusted value (kg/s) : ',zgreenland_fwfisf_sum 278 279 zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 280 281 ! use ABS function because we need to preserve the sign of fwfisf 282 WHERE( antarctica_icesheet_mask(:,:) == 1.0 ) & 283 & fwfisf(:,:) = fwfisf(:,:) * ABS( antarctica_icesheet_mass_rate_of_change * (1.0-rn_antarctica_calving_fraction) & 284 & / ( zantarctica_fwfisf_sum + 1.0e-10_wp ) ) 285 286 ! check 287 IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting climatology (kg/s) : ',zantarctica_fwfisf_sum 288 289 zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 290 291 IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting adjusted value (kg/s) : ',zantarctica_fwfisf_sum 292 293 ENDIF 294 ENDIF 295 258 296 qisf(:,:) = fwfisf(:,:) * lfusisf ! heat flux 259 297 stbl(:,:) = soce … … 264 302 !CALL fld_read ( kt, nn_fsbc, sf_qisf ) 265 303 fwfisf(:,:) = sf_fwfisf(1)%fnow(:,:,1) ! fwf 304 305 IF( lk_oasis) THEN 306 ! nn_coupled_iceshelf_fluxes uninitialised unless lk_oasis=true 307 IF( nn_coupled_iceshelf_fluxes .gt. 0 ) THEN 308 309 ! Adjust total iceshelf melt rates so that sum of iceberg calving and iceshelf melting in the northern 310 ! and southern hemispheres equals rate of increase of mass of greenland and antarctic ice sheets 311 ! to preserve total freshwater conservation in coupled models without an active ice sheet model. 312 313 ! All related global sums must be done bit reproducibly 314 zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 315 316 ! use ABS function because we need to preserve the sign of fwfisf 317 WHERE( greenland_icesheet_mask(:,:) == 1.0 ) & 318 & fwfisf(:,:) = fwfisf(:,:) * ABS( greenland_icesheet_mass_rate_of_change * (1.0-rn_greenland_calving_fraction) & 319 & / ( zgreenland_fwfisf_sum + 1.0e-10_wp ) ) 320 321 ! check 322 IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting climatology (kg/s) : ',zgreenland_fwfisf_sum 323 324 zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 325 326 IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting adjusted value (kg/s) : ',zgreenland_fwfisf_sum 327 328 zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 329 330 ! use ABS function because we need to preserve the sign of fwfisf 331 WHERE( antarctica_icesheet_mask(:,:) == 1.0 ) & 332 & fwfisf(:,:) = fwfisf(:,:) * ABS( antarctica_icesheet_mass_rate_of_change * (1.0-rn_antarctica_calving_fraction) & 333 & / ( zantarctica_fwfisf_sum + 1.0e-10_wp ) ) 334 335 ! check 336 IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting climatology (kg/s) : ',zantarctica_fwfisf_sum 337 338 zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 339 340 IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting adjusted value (kg/s) : ',zantarctica_fwfisf_sum 341 342 ENDIF 343 ENDIF 344 266 345 qisf(:,:) = fwfisf(:,:) * lfusisf ! heat flux 267 346 !qisf(:,:) = sf_qisf(1)%fnow(:,:,1) ! heat flux … … 270 349 END IF 271 350 ! compute tsc due to isf 272 ! WARNING water add at temp = 0C, correction term is added in trasbc, maybe better here but need a 3D variable). 273 risf_tsc(:,:,jp_tem) = qisf(:,:) * r1_rau0_rcp ! 351 ! WARNING water add at temp = 0C, correction term is added, maybe better here but need a 3D variable). 352 ! zpress = grav*rau0*fsdept(ji,jj,jk)*1.e-04 353 zt_frz = -1.9 !eos_fzp( tsn(ji,jj,jk,jp_sal), zpress ) 354 risf_tsc(:,:,jp_tem) = qisf(:,:) * r1_rau0_rcp - rdivisf * fwfisf(:,:) * zt_frz * r1_rau0 ! 274 355 275 356 ! salt effect already take into account in vertical advection 276 357 risf_tsc(:,:,jp_sal) = (1.0_wp-rdivisf) * fwfisf(:,:) * stbl(:,:) * r1_rau0 277 358 359 ! output 360 IF( iom_use('qlatisf' ) ) CALL iom_put('qlatisf', qisf) 361 IF( iom_use('fwfisf' ) ) CALL iom_put('fwfisf' , fwfisf * stbl(:,:) / soce ) 362 363 ! if apply only on the trend and not as a volume flux (rdivisf = 0), fwfisf have to be set to 0 now 364 fwfisf(:,:) = rdivisf * fwfisf(:,:) 365 278 366 ! lbclnk 279 367 CALL lbc_lnk(risf_tsc(:,:,jp_tem),'T',1.) … … 281 369 CALL lbc_lnk(fwfisf(:,:) ,'T',1.) 282 370 CALL lbc_lnk(qisf(:,:) ,'T',1.) 371 372 !============================================================================================================================================= 373 IF ( iom_use('fwfisf3d') .OR. iom_use('qlatisf3d') .OR. iom_use('qhcisf3d') .OR. iom_use('qhcisf')) THEN 374 CALL wrk_alloc( jpi,jpj,jpk, zfwfisf3d, zqhcisf3d, zqlatisf3d ) 375 CALL wrk_alloc( jpi,jpj, zqhcisf2d ) 376 377 zfwfisf3d(:,:,:) = 0.0_wp ! 3d ice shelf melting (kg/m2/s) 378 zqhcisf3d(:,:,:) = 0.0_wp ! 3d heat content flux (W/m2) 379 zqlatisf3d(:,:,:)= 0.0_wp ! 3d ice shelf melting latent heat flux (W/m2) 380 zqhcisf2d(:,:) = fwfisf(:,:) * zt_frz * rcp ! 2d heat content flux (W/m2) 381 382 DO jj = 1,jpj 383 DO ji = 1,jpi 384 ikt = misfkt(ji,jj) 385 ikb = misfkb(ji,jj) 386 DO jk = ikt, ikb - 1 387 zfwfisf3d (ji,jj,jk) = zfwfisf3d (ji,jj,jk) + fwfisf (ji,jj) * r1_hisf_tbl(ji,jj) * fse3t(ji,jj,jk) 388 zqhcisf3d (ji,jj,jk) = zqhcisf3d (ji,jj,jk) + zqhcisf2d(ji,jj) * r1_hisf_tbl(ji,jj) * fse3t(ji,jj,jk) 389 zqlatisf3d(ji,jj,jk) = zqlatisf3d(ji,jj,jk) + qisf (ji,jj) * r1_hisf_tbl(ji,jj) * fse3t(ji,jj,jk) 390 END DO 391 zfwfisf3d (ji,jj,jk) = zfwfisf3d (ji,jj,jk) + fwfisf (ji,jj) * r1_hisf_tbl(ji,jj) * ralpha(ji,jj) * fse3t(ji,jj,jk) 392 zqhcisf3d (ji,jj,jk) = zqhcisf3d (ji,jj,jk) + zqhcisf2d(ji,jj) * r1_hisf_tbl(ji,jj) * ralpha(ji,jj) * fse3t(ji,jj,jk) 393 zqlatisf3d(ji,jj,jk) = zqlatisf3d(ji,jj,jk) + qisf (ji,jj) * r1_hisf_tbl(ji,jj) * ralpha(ji,jj) * fse3t(ji,jj,jk) 394 END DO 395 END DO 396 397 CALL iom_put('fwfisf3d' , zfwfisf3d (:,:,:)) 398 CALL iom_put('qlatisf3d', zqlatisf3d(:,:,:)) 399 CALL iom_put('qhcisf3d' , zqhcisf3d (:,:,:)) 400 CALL iom_put('qhcisf' , zqhcisf2d (:,: )) 401 402 CALL wrk_dealloc( jpi,jpj,jpk, zfwfisf3d, zqhcisf3d, zqlatisf3d ) 403 CALL wrk_dealloc( jpi,jpj, zqhcisf2d ) 404 END IF 405 !============================================================================================================================================= 283 406 284 407 IF( kt == nit000 ) THEN ! set the forcing field at nit000 - 1 ! … … 295 418 ENDIF 296 419 ! 297 ! output298 CALL iom_put('qisf' , qisf)299 IF( iom_use('fwfisf') ) CALL iom_put('fwfisf', fwfisf * stbl(:,:) / soce )300 420 END IF 301 421 … … 370 490 ! Calculate freezing temperature 371 491 zpress = grav*rau0*fsdept(ji,jj,ik)*1.e-04 372 zt_frz = eos_fzp(tsb(ji,jj,ik,jp_sal), zpress)492 CALL eos_fzp(tsb(ji,jj,ik,jp_sal), zt_frz, zpress) 373 493 zt_sum = zt_sum + (tsn(ji,jj,ik,jp_tem)-zt_frz) * fse3t(ji,jj,ik) * tmask(ji,jj,ik) ! sum temp 374 494 ENDDO … … 452 572 zti(:,:)=tinsitu( ttbl, stbl, zpress ) 453 573 ! Calculate freezing temperature 454 zfrz(:,:)=eos_fzp( sss_m(:,:), zpress )574 CALL eos_fzp( sss_m(:,:), zfrz(:,:), zpress ) 455 575 456 576 … … 472 592 473 593 nit = nit + 1 474 IF (nit .GE. 100) THEN 475 !WRITE(numout,*) "sbcisf : too many iteration ... ", zhtflx, zhtflx_b,zgammat, rn_gammat0, rn_tfri2, nn_gammablk, ji,jj 476 !WRITE(numout,*) "sbcisf : too many iteration ... ", (zhtflx - zhtflx_b)/zhtflx 477 CALL ctl_stop( 'STOP', 'sbc_isf_hol99 : too many iteration ...' ) 478 END IF 594 IF (nit .GE. 100) CALL ctl_stop( 'STOP', 'sbc_isf_hol99 : too many iteration ...' ) 595 479 596 ! save gammat and compute zhtflx_b 480 597 zgammat2d(ji,jj)=zgammat … … 794 911 ! test on tmask useless ????? 795 912 DO jk = ikt, mbkt(ji,jj) 796 !IF ( (SUM(fse3t(ji,jj,ikt:jk-1)) .LT. rhisf_tbl(ji,jj)) .AND. (tmask(ji,jj,jk) == 1) ) ikb = jk913 IF ( (SUM(fse3t(ji,jj,ikt:jk-1)) .LT. rhisf_tbl(ji,jj)) .AND. (tmask(ji,jj,jk) == 1) ) ikb = jk 797 914 END DO 798 915 rhisf_tbl(ji,jj) = MIN(rhisf_tbl(ji,jj), SUM(fse3t(ji,jj,ikt:ikb))) ! limit the tbl to water thickness. -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
r7960 r9987 179 179 180 180 ! ! Checks: 181 IF( nn_isf .EQ. 0 ) THEN ! no specific treatment in vicinity ofice shelf181 IF( nn_isf .EQ. 0 ) THEN ! variable initialisation if no ice shelf 182 182 IF( sbc_isf_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_isf arrays' ) 183 fwfisf (:,:) = 0.0_wp 184 fwfisf_b(:,:) = 0.0_wp 183 fwfisf (:,:) = 0.0_wp ; fwfisf_b (:,:) = 0.0_wp 184 risf_tsc(:,:,:) = 0.0_wp ; risf_tsc_b(:,:,:) = 0.0_wp 185 rdivisf = 0.0_wp 185 186 END IF 186 187 IF( nn_ice == 0 .AND. nn_components /= jp_iam_opa ) fr_i(:,:) = 0.e0 ! no ice in the domain, ice fraction is always zero … … 265 266 ENDIF 266 267 ! 267 IF( lk_oasis ) CALL sbc_cpl_init (nn_ice) ! OASIS initialisation. must be done before: (1) first time step 268 ! ! (2) the use of nn_fsbc 268 IF( lk_oasis ) THEN 269 IF( sbc_cpl_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'sbc_cpl_alloc : unable to allocate arrays' ) 270 CALL sbc_cpl_init (nn_ice) ! OASIS initialisation. must be done before: (1) first time step 271 ! (2) the use of nn_fsbc 272 ENDIF 269 273 270 274 ! nn_fsbc initialization if OPA-SAS coupling via OASIS … … 339 343 emp_b(:,:) = emp(:,:) 340 344 sfx_b(:,:) = sfx(:,:) 345 IF ( ln_rnf ) THEN 346 rnf_b (:,: ) = rnf (:,: ) 347 rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:) 348 ENDIF 341 349 ENDIF 342 350 ! ! ---------------------------------------- ! … … 455 463 ! ! ---------------------------------------- ! 456 464 IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN 457 CALL iom_put( "empmr" , emp - rnf ) ! upward water flux 465 CALL iom_put( "empmr" , emp - rnf ) ! upward water flux 466 CALL iom_put( "empbmr" , emp_b - rnf ) ! before upward water flux ( needed to recalculate the time evolution of ssh in offline ) 458 467 CALL iom_put( "saltflx", sfx ) ! downward salt flux 459 468 ! (includes virtual salt flux beneath ice -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90
r7960 r9987 52 52 REAL(wp) :: rn_hrnf !: runoffs, depth over which enhanced vertical mixing is used 53 53 REAL(wp) , PUBLIC :: rn_avt_rnf !: runoffs, value of the additional vertical mixing coef. [m2/s] 54 REAL(wp) 54 REAL(wp) , PUBLIC :: rn_rfact !: multiplicative factor for runoff 55 55 56 56 LOGICAL , PUBLIC :: l_rnfcpl = .false. ! runoffs recieved from oasis … … 109 109 ! 110 110 CALL wrk_alloc( jpi,jpj, ztfrz) 111 112 ! ! ---------------------------------------- ! 113 IF( kt /= nit000 ) THEN ! Swap of forcing fields ! 114 ! ! ---------------------------------------- ! 115 rnf_b (:,: ) = rnf (:,: ) ! Swap the ocean forcing fields except at nit000 116 rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:) ! where before fields are set at the end of the routine 117 ! 118 ENDIF 119 111 ! 120 112 ! !-------------------! 121 113 ! ! Update runoff ! … … 126 118 IF( ln_rnf_sal ) CALL fld_read ( kt, nn_fsbc, sf_s_rnf ) ! idem for runoffs salinity if required 127 119 ! 128 ! Runoff reduction only associated to the ORCA2_LIM configuration129 ! when reading the NetCDF file runoff_1m_nomask.nc130 IF( cp_cfg == 'orca' .AND. jp_cfg == 2 .AND. .NOT. l_rnfcpl ) THEN131 WHERE( 40._wp < gphit(:,:) .AND. gphit(:,:) < 65._wp )132 sf_rnf(1)%fnow(:,:,1) = 0.85 * sf_rnf(1)%fnow(:,:,1)133 END WHERE134 ENDIF135 !136 120 IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN 137 121 ! 138 122 IF( .NOT. l_rnfcpl ) rnf(:,:) = rn_rfact * ( sf_rnf(1)%fnow(:,:,1) ) ! updated runoff value at time step kt 123 CALL lbc_lnk(rnf(:,:), 'T', 1._wp) 139 124 ! 140 125 ! ! set temperature & salinity content of runoffs -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SBC/updtide.F90
r7960 r9987 31 31 CONTAINS 32 32 33 SUBROUTINE upd_tide( kt, kit, kbaro, koffset )33 SUBROUTINE upd_tide( kt, kit, time_offset ) 34 34 !!---------------------------------------------------------------------- 35 35 !! *** ROUTINE upd_tide *** … … 42 42 !!---------------------------------------------------------------------- 43 43 INTEGER, INTENT(in) :: kt ! ocean time-step index 44 INTEGER, INTENT(in), OPTIONAL :: kit ! external mode sub-time-step index (lk_dynspg_ts=T only)45 INTEGER, INTENT(in), OPTIONAL :: kbaro ! number of sub-time-step (lk_dynspg_ts=T only)46 INTEGER, INTENT(in), OPTIONAL :: koffset ! time offset in number47 ! of sub-time-steps (lk_dynspg_ts=T only)44 INTEGER, INTENT(in), OPTIONAL :: kit ! external mode sub-time-step index (lk_dynspg_ts=T) 45 INTEGER, INTENT(in), OPTIONAL :: time_offset ! time offset in number 46 ! of internal steps (lk_dynspg_ts=F) 47 ! of external steps (lk_dynspg_ts=T) 48 48 ! 49 49 INTEGER :: joffset ! local integer … … 57 57 ! 58 58 joffset = 0 59 IF( PRESENT( koffset ) ) joffset = koffset59 IF( PRESENT( time_offset ) ) joffset = time_offset 60 60 ! 61 IF( PRESENT( kit ) .AND. PRESENT( kbaro )) THEN62 zt = zt + ( kit + 0.5_wp * ( joffset - 1 ) ) * rdt / REAL( kbaro, wp )61 IF( PRESENT( kit ) ) THEN 62 zt = zt + ( kit + joffset - 1 ) * rdt / REAL( nn_baro, wp ) 63 63 ELSE 64 64 zt = zt + joffset * rdt … … 74 74 IF( ln_tide_ramp ) THEN ! linear increase if asked 75 75 zt = ( kt - nit000 ) * rdt 76 IF( PRESENT( kit ) .AND. PRESENT( kbaro ) ) zt = zt + kit * rdt / REAL( kbaro, wp )76 IF( PRESENT( kit ) ) zt = zt + ( kit + joffset -1) * rdt / REAL( nn_baro, wp ) 77 77 zramp = MIN( MAX( zt / (rdttideramp*rday) , 0._wp ) , 1._wp ) 78 78 pot_astro(:,:) = zramp * pot_astro(:,:) … … 86 86 !!---------------------------------------------------------------------- 87 87 CONTAINS 88 SUBROUTINE upd_tide( kt, kit, kbaro, koffset )! Empty routine88 SUBROUTINE upd_tide( kt, kit, time_offset ) ! Empty routine 89 89 INTEGER, INTENT(in) :: kt ! integer arg, dummy routine 90 90 INTEGER, INTENT(in), OPTIONAL :: kit ! optional arg, dummy routine 91 INTEGER, INTENT(in), OPTIONAL :: kbaro ! optional arg, dummy routine 92 INTEGER, INTENT(in), OPTIONAL :: koffset ! optional arg, dummy routine 91 INTEGER, INTENT(in), OPTIONAL :: time_offset ! optional arg, dummy routine 93 92 WRITE(*,*) 'upd_tide: You should not have seen this print! error?', kt 94 93 END SUBROUTINE upd_tide -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SOL/solpcg.F90
r7960 r9987 93 93 REAL(wp) :: zgcad ! temporary scalars 94 94 REAL(wp), DIMENSION(2) :: zsum 95 REAL(wp), POINTER, DIMENSION(:,:) :: zgcr95 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zgcr 96 96 !!---------------------------------------------------------------------- 97 97 ! 98 98 IF( nn_timing == 1 ) CALL timing_start('sol_pcg') 99 99 ! 100 CALL wrk_alloc( jpi, jpj, zgcr)100 ALLOCATE( zgcr(1:jpi,1:jpj) ) 101 101 ! 102 102 ! Initialization of the algorithm with standard PCG … … 210 210 CALL lbc_lnk( gcx, c_solver_pt, 1. ) ! Output in gcx with lateral b.c. applied 211 211 ! 212 CALL wrk_dealloc( jpi, jpj,zgcr )212 DEALLOCATE ( zgcr ) 213 213 ! 214 214 IF( nn_timing == 1 ) CALL timing_stop('sol_pcg') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/SOL/solver.F90
r7960 r9987 92 92 IF( .NOT. lk_agrif .OR. .NOT. ln_rstart) THEN 93 93 IF( sol_oce_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'solver_init : unable to allocate sol_oce arrays' ) 94 gcx (:,:) = 0.e0 95 gcxb(:,:) = 0.e0 94 96 ENDIF 95 97 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/STO/stopar.F90
r7959 r9987 849 849 850 850 851 REAL(wp)FUNCTION sto_par_flt_fac( kpasses )851 FUNCTION sto_par_flt_fac( kpasses ) 852 852 !!---------------------------------------------------------------------- 853 853 !! *** FUNCTION sto_par_flt_fac *** … … 858 858 !!---------------------------------------------------------------------- 859 859 INTEGER, INTENT(in) :: kpasses 860 REAL(wp) :: sto_par_flt_fac 860 861 !! 861 862 INTEGER :: jpasses, ji, jj, jflti, jfltj -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90
r7960 r9987 22 22 !! - ! 2013-04 (F. Roquet, G. Madec) add eos_rab, change bn2 computation and reorganize the module 23 23 !! - ! 2014-09 (F. Roquet) add TEOS-10, S-EOS, and modify EOS-80 24 !! - ! 2015-06 (P.A. Bouttier) eos_fzp functions changed to subroutines for AGRIF 24 25 !!---------------------------------------------------------------------- 25 26 … … 311 312 REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(in ) :: pts ! 1 : potential temperature [Celcius] 312 313 ! ! 2 : salinity [psu] 313 REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT( 314 REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT( 314 REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT(inout) :: prd ! in situ density [-] 315 REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT(inout) :: prhop ! potential density (surface referenced) 315 316 REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT(in ) :: pdep ! depth [m] 316 317 ! … … 456 457 END SELECT 457 458 ! 459 CALL lbc_lnk( prd, 'T', 1.0_wp ) 460 ! 458 461 IF(ln_ctl) CALL prt_ctl( tab3d_1=prd, clinfo1=' eos-pot: ', tab3d_2=prhop, clinfo2=' pot : ', ovlap=1, kdim=jpk ) 459 462 ! … … 901 904 REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(in ) :: pts ! pot. temperature and salinity [Celcius,psu] 902 905 REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(in ) :: pab ! thermal/haline expansion coef. [Celcius-1,psu-1] 903 REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT( 906 REAL(wp), DIMENSION(jpi,jpj,jpk ), INTENT(inout) :: pn2 ! Brunt-Vaisala frequency squared [1/s^2] 904 907 ! 905 908 INTEGER :: ji, jj, jk ! dummy loop indices … … 991 994 992 995 993 FUNCTION eos_fzp_2d( psal, pdep ) RESULT( ptf)996 SUBROUTINE eos_fzp_2d( psal, ptf, pdep ) 994 997 !!---------------------------------------------------------------------- 995 998 !! *** ROUTINE eos_fzp *** … … 1005 1008 REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: psal ! salinity [psu] 1006 1009 REAL(wp), DIMENSION(jpi,jpj), INTENT(in ), OPTIONAL :: pdep ! depth [m] 1007 REAL(wp), DIMENSION(jpi,jpj) :: ptf! freezing temperature [Celcius]1010 REAL(wp), DIMENSION(jpi,jpj), INTENT(out ) :: ptf ! freezing temperature [Celcius] 1008 1011 ! 1009 1012 INTEGER :: ji, jj ! dummy loop indices … … 1017 1020 DO jj = 1, jpj 1018 1021 DO ji = 1, jpi 1019 zs= SQRT( ABS( psal(ji,jj) ) * r1_S0) ! square root salinity1022 zs= SQRT( ABS( psal(ji,jj) ) / 35.16504_wp ) ! square root salinity 1020 1023 ptf(ji,jj) = ((((1.46873e-03_wp*zs-9.64972e-03_wp)*zs+2.28348e-02_wp)*zs & 1021 1024 & - 3.12775e-02_wp)*zs+2.07679e-02_wp)*zs-5.87701e-02_wp … … 1038 1041 nstop = nstop + 1 1039 1042 ! 1040 END SELECT 1041 ! 1042 END FUNCTIONeos_fzp_2d1043 1044 FUNCTION eos_fzp_0d( psal, pdep ) RESULT( ptf)1043 END SELECT 1044 ! 1045 END SUBROUTINE eos_fzp_2d 1046 1047 SUBROUTINE eos_fzp_0d( psal, ptf, pdep ) 1045 1048 !!---------------------------------------------------------------------- 1046 1049 !! *** ROUTINE eos_fzp *** … … 1054 1057 !! Reference : UNESCO tech. papers in the marine science no. 28. 1978 1055 1058 !!---------------------------------------------------------------------- 1056 REAL(wp), INTENT(in ) :: psal! salinity [psu]1057 REAL(wp), INTENT(in ), OPTIONAL :: pdep! depth [m]1058 REAL(wp) :: ptf! freezing temperature [Celcius]1059 REAL(wp), INTENT(in ) :: psal ! salinity [psu] 1060 REAL(wp), INTENT(in ), OPTIONAL :: pdep ! depth [m] 1061 REAL(wp), INTENT(out) :: ptf ! freezing temperature [Celcius] 1059 1062 ! 1060 1063 REAL(wp) :: zs ! local scalars … … 1065 1068 CASE ( -1, 1 ) !== CT,SA (TEOS-10 formulation) ==! 1066 1069 ! 1067 zs = SQRT( ABS( psal ) * r1_S0) ! square root salinity1070 zs = SQRT( ABS( psal ) / 35.16504_wp ) ! square root salinity 1068 1071 ptf = ((((1.46873e-03_wp*zs-9.64972e-03_wp)*zs+2.28348e-02_wp)*zs & 1069 1072 & - 3.12775e-02_wp)*zs+2.07679e-02_wp)*zs-5.87701e-02_wp … … 1086 1089 END SELECT 1087 1090 ! 1088 END FUNCTIONeos_fzp_0d1091 END SUBROUTINE eos_fzp_0d 1089 1092 1090 1093 … … 1255 1258 WRITE(numout,*) ' model does not use Conservative Temperature' 1256 1259 ENDIF 1260 ENDIF 1261 ! 1262 ! Consistency check on ln_useCT and nn_eos 1263 IF ((nn_eos .EQ. -1) .AND. (.NOT. ln_useCT)) THEN 1264 CALL ctl_stop("ln_useCT should be set to True if using TEOS-10 (nn_eos=-1)") 1265 ELSE IF ((nn_eos .NE. -1) .AND. (ln_useCT)) THEN 1266 CALL ctl_stop("ln_useCT should be set to False if using TEOS-80 or simplified equation of state (nn_eos=0 or nn_eos=1)") 1257 1267 ENDIF 1258 1268 ! -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90
r7960 r9987 26 26 USE cla ! cross land advection (cla_traadv routine) 27 27 USE ldftra_oce ! lateral diffusion coefficient on tracers 28 USE trd_oce ! trends: ocean variables 29 USE trdtra ! trends manager: tracers 28 30 ! 29 31 USE in_out_manager ! I/O manager … … 78 80 ! 79 81 INTEGER :: jk ! dummy loop index 80 REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn 82 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zun, zvn, zwn 83 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrdt, ztrds ! 3D workspace 81 84 !!---------------------------------------------------------------------- 82 85 ! 83 86 IF( nn_timing == 1 ) CALL timing_start('tra_adv') 84 87 ! 85 CALL wrk_alloc( jpi, jpj, jpk, zun, zvn, zwn ) 88 ALLOCATE(zun(1:jpi, 1:jpj, 1:jpk)) 89 ALLOCATE(zvn(1:jpi, 1:jpj, 1:jpk)) 90 ALLOCATE(zwn(1:jpi, 1:jpj, 1:jpk)) 86 91 ! ! set time step 87 92 IF( neuler == 0 .AND. kt == nit000 ) THEN ! at nit000 … … 120 125 IF( ln_diaptr ) CALL dia_ptr( zvn ) ! diagnose the effective MSF 121 126 ! 122 127 IF( l_trdtra ) THEN !* Save ta and sa trends 128 ALLOCATE(ztrdt( 1:jpi, 1:jpj, 1:jpk) ) 129 ALLOCATE(ztrds( 1:jpi, 1:jpj, 1:jpk) ) 130 ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 131 ztrds(:,:,:) = tsa(:,:,:,jp_sal) 132 ENDIF 133 ! 123 134 SELECT CASE ( nadv ) !== compute advection trend and add it to general trend ==! 124 135 CASE ( 1 ) ; CALL tra_adv_cen2 ( kt, nit000, 'TRA', zun, zvn, zwn, tsb, tsn, tsa, jpts ) ! 2nd order centered … … 151 162 END SELECT 152 163 ! 164 IF( l_trdtra ) THEN ! save the advective trends for further diagnostics 165 DO jk = 1, jpkm1 166 ztrdt(:,:,jk) = tsa(:,:,jk,jp_tem) - ztrdt(:,:,jk) 167 ztrds(:,:,jk) = tsa(:,:,jk,jp_sal) - ztrds(:,:,jk) 168 END DO 169 CALL trd_tra( kt, 'TRA', jp_tem, jptra_totad, ztrdt ) 170 CALL trd_tra( kt, 'TRA', jp_sal, jptra_totad, ztrds ) 171 DEALLOCATE (ztrdt) 172 DEALLOCATE (ztrds) 173 ENDIF 153 174 ! ! print mean trends (used for debugging) 154 175 IF(ln_ctl) CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' adv - Ta: ', mask1=tmask, & … … 157 178 IF( nn_timing == 1 ) CALL timing_stop( 'tra_adv' ) 158 179 ! 159 CALL wrk_dealloc( jpi, jpj, jpk, zun, zvn, zwn ) 180 DEALLOCATE(zun) 181 DEALLOCATE(zvn) 182 DEALLOCATE(zwn) 160 183 ! 161 184 END SUBROUTINE tra_adv -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_cen2.F90
r7960 r9987 173 173 END DO 174 174 END DO 175 zfzp(:,:) = eos_fzp( tsn(:,:,1,jp_sal), zpres(:,:) )175 CALL eos_fzp( tsn(:,:,1,jp_sal), zfzp(:,:), zpres(:,:) ) 176 176 DO jk = 1, jpk 177 177 DO jj = 1, jpj … … 279 279 END IF 280 280 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 281 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 282 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( zwy(:,:,:) ) 283 IF( jn == jp_sal ) str_adv(:) = ptr_sj( zwy(:,:,:) ) 284 ENDIF 281 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'adv', zwy(:,:,:) ) 285 282 ! 286 283 END DO -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_eiv.F90
r7960 r9987 28 28 USE wrk_nemo ! Memory Allocation 29 29 USE timing ! Timing 30 USE diaptr ! Heat/Salt transport diagnostics 31 USE trddyn 32 USE trd_oce 30 33 31 34 IMPLICIT NONE … … 78 81 # endif 79 82 REAL(wp), POINTER, DIMENSION(:,:) :: zu_eiv, zv_eiv, zw_eiv, z2d 83 REAL(wp), POINTER, DIMENSION(:,:,:) :: z3d, z3d_T 80 84 !!---------------------------------------------------------------------- 81 85 ! … … 84 88 # if defined key_diaeiv 85 89 CALL wrk_alloc( jpi, jpj, zu_eiv, zv_eiv, zw_eiv, z2d ) 90 CALL wrk_alloc( jpi, jpj, jpk, z3d, z3d_T ) 86 91 # else 87 92 CALL wrk_alloc( jpi, jpj, zu_eiv, zv_eiv, zw_eiv ) … … 160 165 CALL iom_put( "voce_eiv", v_eiv ) ! j-eiv current 161 166 CALL iom_put( "woce_eiv", w_eiv ) ! vert. eiv current 162 IF( iom_use('ueiv_heattr') ) THEN 163 zztmp = 0.5 * rau0 * rcp 167 IF( iom_use('weiv_masstr') ) THEN ! vertical mass transport & its square value 168 z2d(:,:) = rau0 * e12t(:,:) 169 DO jk = 1, jpk 170 z3d(:,:,jk) = w_eiv(:,:,jk) * z2d(:,:) 171 END DO 172 CALL iom_put( "weiv_masstr" , z3d ) 173 ENDIF 174 IF( iom_use("ueiv_masstr") .OR. iom_use("ueiv_heattr") .OR. iom_use('ueiv_heattr3d') & 175 .OR. iom_use("ueiv_salttr") .OR. iom_use('ueiv_salttr3d') ) THEN 176 z3d(:,:,jpk) = 0.e0 177 z2d(:,:) = 0.e0 178 DO jk = 1, jpkm1 179 z3d(:,:,jk) = rau0 * u_eiv(:,:,jk) * e2u(:,:) * fse3u(:,:,jk) * umask(:,:,jk) 180 z2d(:,:) = z2d(:,:) + z3d(:,:,jk) 181 END DO 182 CALL iom_put( "ueiv_masstr", z3d ) ! mass transport in i-direction 183 ENDIF 184 185 IF( iom_use('ueiv_heattr') .OR. iom_use('ueiv_heattr3d') ) THEN 186 zztmp = 0.5 * rcp 164 187 z2d(:,:) = 0.e0 165 DO jk = 1, jpkm1 166 DO jj = 2, jpjm1 167 DO ji = fs_2, fs_jpim1 ! vector opt. 168 z2d(ji,jj) = z2d(ji,jj) + u_eiv(ji,jj,jk) & 169 & * (tsn(ji,jj,jk,jp_tem)+tsn(ji+1,jj,jk,jp_tem)) * e2u(ji,jj) * fse3u(ji,jj,jk) 170 END DO 171 END DO 172 END DO 173 CALL lbc_lnk( z2d, 'U', -1. ) 174 CALL iom_put( "ueiv_heattr", zztmp * z2d ) ! heat transport in i-direction 188 z3d_T(:,:,:) = 0.e0 189 DO jk = 1, jpkm1 190 DO jj = 2, jpjm1 191 DO ji = fs_2, fs_jpim1 ! vector opt. 192 z3d_T(ji,jj,jk) = z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) ) 193 z2d(ji,jj) = z2d(ji,jj) + z3d_T(ji,jj,jk) 194 END DO 195 END DO 196 END DO 197 IF (iom_use('ueiv_heattr') ) THEN 198 CALL lbc_lnk( z2d, 'U', -1. ) 199 CALL iom_put( "ueiv_heattr", zztmp * z2d ) ! 2D heat transport in i-direction 200 ENDIF 201 IF (iom_use('ueiv_heattr3d') ) THEN 202 CALL lbc_lnk( z3d_T, 'U', -1. ) 203 CALL iom_put( "ueiv_heattr3d", zztmp * z3d_T ) ! 3D heat transport in i-direction 204 ENDIF 205 ENDIF 206 207 IF( iom_use('ueiv_salttr') .OR. iom_use('ueiv_salttr3d') ) THEN 208 zztmp = 0.5 * 0.001 209 z2d(:,:) = 0.e0 210 z3d_T(:,:,:) = 0.e0 211 DO jk = 1, jpkm1 212 DO jj = 2, jpjm1 213 DO ji = fs_2, fs_jpim1 ! vector opt. 214 z3d_T(ji,jj,jk) = z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji+1,jj,jk,jp_sal) ) 215 z2d(ji,jj) = z2d(ji,jj) + z3d_T(ji,jj,jk) 216 END DO 217 END DO 218 END DO 219 IF (iom_use('ueiv_salttr') ) THEN 220 CALL lbc_lnk( z2d, 'U', -1. ) 221 CALL iom_put( "ueiv_salttr", zztmp * z2d ) ! 2D salt transport in i-direction 222 ENDIF 223 IF (iom_use('ueiv_salttr3d') ) THEN 224 CALL lbc_lnk( z3d_T, 'U', -1. ) 225 CALL iom_put( "ueiv_salttr3d", zztmp * z3d_T ) ! 3D salt transport in i-direction 226 ENDIF 227 ENDIF 228 229 IF( iom_use("veiv_masstr") .OR. iom_use("veiv_heattr") .OR. iom_use('veiv_heattr3d') & 230 .OR. iom_use("veiv_salttr") .OR. iom_use('veiv_salttr3d') ) THEN 231 z3d(:,:,jpk) = 0.e0 232 DO jk = 1, jpkm1 233 z3d(:,:,jk) = rau0 * v_eiv(:,:,jk) * e1v(:,:) * fse3v(:,:,jk) * vmask(:,:,jk) 234 END DO 235 CALL iom_put( "veiv_masstr", z3d ) ! mass transport in j-direction 175 236 ENDIF 176 237 177 IF( iom_use('veiv_heattr') ) THEN178 zztmp = 0.5 * r au0 * rcp238 IF( iom_use('veiv_heattr') .OR. iom_use('veiv_heattr3d') ) THEN 239 zztmp = 0.5 * rcp 179 240 z2d(:,:) = 0.e0 180 DO jk = 1, jpkm1 181 DO jj = 2, jpjm1 182 DO ji = fs_2, fs_jpim1 ! vector opt. 183 z2d(ji,jj) = z2d(ji,jj) + v_eiv(ji,jj,jk) & 184 & * (tsn(ji,jj,jk,jp_tem)+tsn(ji,jj+1,jk,jp_tem)) * e1v(ji,jj) * fse3v(ji,jj,jk) 185 END DO 186 END DO 187 END DO 188 CALL lbc_lnk( z2d, 'V', -1. ) 189 CALL iom_put( "veiv_heattr", zztmp * z2d ) ! heat transport in i-direction 190 ENDIF 241 z3d_T(:,:,:) = 0.e0 242 DO jk = 1, jpkm1 243 DO jj = 2, jpjm1 244 DO ji = fs_2, fs_jpim1 ! vector opt. 245 z3d_T(ji,jj,jk) = z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji,jj+1,jk,jp_tem) ) 246 z2d(ji,jj) = z2d(ji,jj) + z3d_T(ji,jj,jk) 247 END DO 248 END DO 249 END DO 250 IF (iom_use('veiv_heattr') ) THEN 251 CALL lbc_lnk( z2d, 'V', -1. ) 252 CALL iom_put( "veiv_heattr", zztmp * z2d ) ! 2D heat transport in j-direction 253 ENDIF 254 IF (iom_use('veiv_heattr3d') ) THEN 255 CALL lbc_lnk( z3d_T, 'V', -1. ) 256 CALL iom_put( "veiv_heattr3d", zztmp * z3d_T ) ! 3D heat transport in j-direction 257 ENDIF 258 ENDIF 259 260 IF( iom_use('veiv_salttr') .OR. iom_use('veiv_salttr3d') ) THEN 261 zztmp = 0.5 * 0.001 262 z2d(:,:) = 0.e0 263 z3d_T(:,:,:) = 0.e0 264 DO jk = 1, jpkm1 265 DO jj = 2, jpjm1 266 DO ji = fs_2, fs_jpim1 ! vector opt. 267 z3d_T(ji,jj,jk) = z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji,jj+1,jk,jp_sal) ) 268 z2d(ji,jj) = z2d(ji,jj) + z3d_T(ji,jj,jk) 269 END DO 270 END DO 271 END DO 272 IF (iom_use('veiv_salttr') ) THEN 273 CALL lbc_lnk( z2d, 'V', -1. ) 274 CALL iom_put( "veiv_salttr", zztmp * z2d ) ! 2D salt transport in i-direction 275 ENDIF 276 IF (iom_use('veiv_salttr3d') ) THEN 277 CALL lbc_lnk( z3d_T, 'V', -1. ) 278 CALL iom_put( "veiv_salttr3d", zztmp * z3d_T ) ! 3D salt transport in i-direction 279 ENDIF 280 ENDIF 281 282 IF( iom_use('weiv_masstr') .OR. iom_use('weiv_heattr3d') .OR. iom_use('weiv_salttr3d')) THEN ! vertical mass transport & its square value 283 z2d(:,:) = rau0 * e12t(:,:) 284 DO jk = 1, jpk 285 z3d(:,:,jk) = w_eiv(:,:,jk) * z2d(:,:) 286 END DO 287 CALL iom_put( "weiv_masstr" , z3d ) ! mass transport in k-direction 288 ENDIF 289 290 IF( iom_use('weiv_heattr3d') ) THEN 291 zztmp = 0.5 * rcp 292 DO jk = 1, jpkm1 293 DO jj = 2, jpjm1 294 DO ji = fs_2, fs_jpim1 ! vector opt. 295 z3d_T(ji,jj,jk) = z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_tem) + tsn(ji,jj,jk+1,jp_tem) ) 296 END DO 297 END DO 298 END DO 299 CALL lbc_lnk( z3d_T, 'T', 1. ) 300 CALL iom_put( "weiv_heattr3d", zztmp * z3d_T ) ! 3D heat transport in k-direction 301 ENDIF 302 303 IF( iom_use('weiv_salttr3d') ) THEN 304 zztmp = 0.5 * 0.001 305 DO jk = 1, jpkm1 306 DO jj = 2, jpjm1 307 DO ji = fs_2, fs_jpim1 ! vector opt. 308 z3d_T(ji,jj,jk) = z3d(ji,jj,jk) * ( tsn(ji,jj,jk,jp_sal) + tsn(ji,jj,jk+1,jp_sal) ) 309 END DO 310 END DO 311 END DO 312 CALL lbc_lnk( z3d_T, 'T', 1. ) 313 CALL iom_put( "weiv_salttr3d", zztmp * z3d_T ) ! 3D salt transport in k-direction 314 ENDIF 315 191 316 END IF 317 ! 318 IF( ln_diaptr .AND. cdtype == 'TRA' ) THEN 319 z3d(:,:,:) = 0._wp 320 DO jk = 1, jpkm1 321 DO jj = 2, jpjm1 322 DO ji = fs_2, fs_jpim1 ! vector opt. 323 z3d(ji,jj,jk) = v_eiv(ji,jj,jk) * 0.5 * (tsn(ji,jj,jk,jp_tem)+tsn(ji,jj+1,jk,jp_tem)) & 324 & * e1v(ji,jj) * fse3v(ji,jj,jk) 325 END DO 326 END DO 327 END DO 328 CALL dia_ptr_ohst_components( jp_tem, 'eiv', z3d ) 329 z3d(:,:,:) = 0._wp 330 DO jk = 1, jpkm1 331 DO jj = 2, jpjm1 332 DO ji = fs_2, fs_jpim1 ! vector opt. 333 z3d(ji,jj,jk) = v_eiv(ji,jj,jk) * 0.5 * (tsn(ji,jj,jk,jp_sal)+tsn(ji,jj+1,jk,jp_sal)) & 334 & * e1v(ji,jj) * fse3v(ji,jj,jk) 335 END DO 336 END DO 337 END DO 338 CALL dia_ptr_ohst_components( jp_sal, 'eiv', z3d ) 339 ENDIF 340 341 IF( ln_KE_trd ) CALL trd_dyn(u_eiv, v_eiv, jpdyn_eivke, kt ) 192 342 # endif 193 ! 343 194 344 # if defined key_diaeiv 195 345 CALL wrk_dealloc( jpi, jpj, zu_eiv, zv_eiv, zw_eiv, z2d ) 346 CALL wrk_dealloc( jpi, jpj, jpk, z3d, z3d_T ) 196 347 # else 197 348 CALL wrk_dealloc( jpi, jpj, zu_eiv, zv_eiv, zw_eiv ) … … 212 363 CHARACTER(len=3) :: cdtype 213 364 REAL, DIMENSION(:,:,:) :: pun, pvn, pwn 214 WRITE(*,*) 'tra_adv_eiv: You should not have seen this print! error?', kt, cdtype, pun(1,1,1), pvn(1,1,1), pwn(1,1,1) 365 WRITE(*,*) 'tra_adv_eiv: You should not have seen this print! error?', & 366 & kt, cdtype, pun(1,1,1), pvn(1,1,1), pwn(1,1,1) 215 367 END SUBROUTINE tra_adv_eiv 216 368 #endif -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl.F90
r7960 r9987 82 82 REAL(wp) :: zv, z0v, zzwy, z0w ! - - 83 83 REAL(wp) :: ztra, zbtr, zdt, zalpha ! - - 84 REAL(wp), POINTER, DIMENSION(:,:,:) :: zslpx, zslpy ! 3D workspace85 REAL(wp), POINTER, DIMENSION(:,:,:) :: zwx , zwy ! - -84 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zslpx, zslpy ! 3D workspace 85 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zwx , zwy ! - - 86 86 !!---------------------------------------------------------------------- 87 87 ! 88 88 IF( nn_timing == 1 ) CALL timing_start('tra_adv_muscl') 89 89 ! 90 CALL wrk_alloc( jpi, jpj, jpk, zslpx, zslpy, zwx, zwy ) 90 ALLOCATE( zslpx(1:jpi, 1:jpj, 1:jpk) ) 91 ALLOCATE( zslpy(1:jpi, 1:jpj, 1:jpk) ) 92 ALLOCATE( zwx (1:jpi, 1:jpj, 1:jpk) ) 93 ALLOCATE( zwy (1:jpi, 1:jpj, 1:jpk) ) 91 94 ! 92 95 IF( kt == kit000 ) THEN … … 219 222 END IF 220 223 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 221 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 222 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( zwy(:,:,:) ) 223 IF( jn == jp_sal ) str_adv(:) = ptr_sj( zwy(:,:,:) ) 224 ENDIF 224 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'adv', zwy(:,:,:) ) 225 225 226 226 ! II. Vertical advective fluxes … … 291 291 END DO 292 292 ! 293 CALL wrk_dealloc( jpi, jpj, jpk, zslpx, zslpy, zwx, zwy ) 293 DEALLOCATE( zslpx ) 294 DEALLOCATE( zslpy ) 295 DEALLOCATE( zwx ) 296 DEALLOCATE( zwy ) 294 297 ! 295 298 IF( nn_timing == 1 ) CALL timing_stop('tra_adv_muscl') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl2.F90
r7960 r9987 200 200 201 201 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 202 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 203 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( zwy(:,:,:) ) 204 IF( jn == jp_sal ) str_adv(:) = ptr_sj( zwy(:,:,:) ) 205 ENDIF 202 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'adv', zwy(:,:,:) ) 206 203 207 204 ! II. Vertical advective fluxes -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_qck.F90
r7960 r9987 355 355 IF( l_trd ) CALL trd_tra( kt, cdtype, jn, jptra_yad, zwy, pvn, ptn(:,:,:,jn) ) 356 356 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 357 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 358 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( zwy(:,:,:) ) 359 IF( jn == jp_sal ) str_adv(:) = ptr_sj( zwy(:,:,:) ) 360 ENDIF 357 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'adv', zwy(:,:,:) ) 361 358 ! 362 359 END DO -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd.F90
r7960 r9987 34 34 USE timing ! Timing 35 35 USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 36 USE iom 36 37 37 38 IMPLICIT NONE … … 42 43 43 44 LOGICAL :: l_trd ! flag to compute trends 45 LOGICAL :: l_trans ! flag to output vertically integrated transports 44 46 45 47 !! * Substitutions … … 84 86 REAL(wp) :: zfp_ui, zfp_vj, zfp_wk ! - - 85 87 REAL(wp) :: zfm_ui, zfm_vj, zfm_wk ! - - 86 REAL(wp), POINTER, DIMENSION(:,:,:) :: zwi, zwz 87 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdx, ztrdy, ztrdz 88 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zwi, zwz 89 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrdx, ztrdy, ztrdz, zptry 90 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z2d 88 91 !!---------------------------------------------------------------------- 89 92 ! 90 93 IF( nn_timing == 1 ) CALL timing_start('tra_adv_tvd') 91 94 ! 92 CALL wrk_alloc( jpi, jpj, jpk, zwi, zwz ) 95 ALLOCATE(zwi(1:jpi, 1:jpj, 1:jpk)) 96 ALLOCATE(zwz(1:jpi, 1:jpj, 1:jpk)) 97 93 98 ! 94 99 IF( kt == kit000 ) THEN … … 97 102 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' 98 103 ! 99 l_trd = .FALSE.100 IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE.101 104 ENDIF 102 ! 103 IF( l_trd ) THEN 104 CALL wrk_alloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz ) 105 l_trd = .FALSE. 106 l_trans = .FALSE. 107 IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE. 108 IF( cdtype == 'TRA' .AND. (iom_use("uadv_heattr") .OR. iom_use("vadv_heattr") ) ) l_trans = .TRUE. 109 ! 110 IF( l_trd .OR. l_trans ) THEN 111 ALLOCATE(ztrdx(1:jpi, 1:jpj, 1:jpk)) 112 ALLOCATE(ztrdy(1:jpi, 1:jpj, 1:jpk)) 113 ALLOCATE(ztrdz(1:jpi, 1:jpj, 1:jpk)) 105 114 ztrdx(:,:,:) = 0.e0 ; ztrdy(:,:,:) = 0.e0 ; ztrdz(:,:,:) = 0.e0 115 ALLOCATE(z2d(1:jpi, 1:jpj)) 116 ENDIF 117 ! 118 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 119 ALLOCATE(zptry(1:jpi, 1:jpj, 1:jpk)) 120 zptry(:,:,:) = 0._wp 106 121 ENDIF 107 122 ! … … 173 188 DO jj = 2, jpjm1 174 189 DO ji = fs_2, fs_jpim1 ! vector opt. 175 zbtr = 1. / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )176 190 ! total intermediate advective trends 177 ztra = - zbtr *( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk ) &178 & 179 & + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1))191 ztra = - ( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk ) & 192 & + zwy(ji,jj,jk) - zwy(ji ,jj-1,jk ) & 193 & + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1) ) / e1e2t(ji,jj) 180 194 ! update and guess with monotonic sheme 181 pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra* tmask(ji,jj,jk)182 zwi(ji,jj,jk) = ( ptb(ji,jj,jk,jn) + z2dtt * ztra) * tmask(ji,jj,jk)195 pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra / fse3t_n(ji,jj,jk) * tmask(ji,jj,jk) 196 zwi(ji,jj,jk) = ( fse3t_b(ji,jj,jk) * ptb(ji,jj,jk,jn) + z2dtt * ztra ) / fse3t_a(ji,jj,jk) * tmask(ji,jj,jk) 183 197 END DO 184 198 END DO … … 188 202 189 203 ! ! trend diagnostics (contribution of upstream fluxes) 190 IF( l_trd ) THEN204 IF( l_trd .OR. l_trans ) THEN 191 205 ! store intermediate advective trends 192 206 ztrdx(:,:,:) = zwx(:,:,:) ; ztrdy(:,:,:) = zwy(:,:,:) ; ztrdz(:,:,:) = zwz(:,:,:) 193 207 END IF 194 208 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 195 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 196 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( zwy(:,:,:) ) 197 IF( jn == jp_sal ) str_adv(:) = ptr_sj( zwy(:,:,:) ) 198 ENDIF 209 IF( cdtype == 'TRA' .AND. ln_diaptr ) zptry(:,:,:) = zwy(:,:,:) 199 210 200 211 ! 3. antidiffusive flux : high order minus low order … … 254 265 255 266 ! ! trend diagnostics (contribution of upstream fluxes) 256 IF( l_trd ) THEN267 IF( l_trd .OR. l_trans ) THEN 257 268 ztrdx(:,:,:) = ztrdx(:,:,:) + zwx(:,:,:) ! <<< Add to previously computed 258 269 ztrdy(:,:,:) = ztrdy(:,:,:) + zwy(:,:,:) ! <<< Add to previously computed 259 270 ztrdz(:,:,:) = ztrdz(:,:,:) + zwz(:,:,:) ! <<< Add to previously computed 260 261 CALL trd_tra( kt, cdtype, jn, jptra_xad, ztrdx, pun, ptn(:,:,:,jn) ) 262 CALL trd_tra( kt, cdtype, jn, jptra_yad, ztrdy, pvn, ptn(:,:,:,jn) ) 263 CALL trd_tra( kt, cdtype, jn, jptra_zad, ztrdz, pwn, ptn(:,:,:,jn) ) 271 ENDIF 272 273 IF( l_trd ) THEN 274 CALL trd_tra( kt, cdtype, jn, jptra_xad, ztrdx, pun, ptn(:,:,:,jn) ) 275 CALL trd_tra( kt, cdtype, jn, jptra_yad, ztrdy, pvn, ptn(:,:,:,jn) ) 276 CALL trd_tra( kt, cdtype, jn, jptra_zad, ztrdz, pwn, ptn(:,:,:,jn) ) 264 277 END IF 265 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 278 279 IF( l_trans .AND. jn==jp_tem ) THEN 280 z2d(:,:) = 0._wp 281 DO jk = 1, jpkm1 282 DO jj = 2, jpjm1 283 DO ji = fs_2, fs_jpim1 ! vector opt. 284 z2d(ji,jj) = z2d(ji,jj) + ztrdx(ji,jj,jk) 285 END DO 286 END DO 287 END DO 288 CALL lbc_lnk( z2d, 'U', -1. ) 289 CALL iom_put( "uadv_heattr", rau0_rcp * z2d ) ! heat transport in i-direction 290 ! 291 z2d(:,:) = 0._wp 292 DO jk = 1, jpkm1 293 DO jj = 2, jpjm1 294 DO ji = fs_2, fs_jpim1 ! vector opt. 295 z2d(ji,jj) = z2d(ji,jj) + ztrdy(ji,jj,jk) 296 END DO 297 END DO 298 END DO 299 CALL lbc_lnk( z2d, 'V', -1. ) 300 CALL iom_put( "vadv_heattr", rau0_rcp * z2d ) ! heat transport in j-direction 301 ENDIF 302 ! "Poleward" heat and salt transports (contribution of upstream fluxes) 266 303 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 267 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( zwy(:,:,:) ) + htr_adv(:)268 IF( jn == jp_sal ) str_adv(:) = ptr_sj( zwy(:,:,:) ) + str_adv(:)304 zptry(:,:,:) = zptry(:,:,:) + zwy(:,:,:) ! <<< Add to previously computed 305 CALL dia_ptr_ohst_components( jn, 'adv', zptry(:,:,:) ) 269 306 ENDIF 270 307 ! 271 308 END DO 272 309 ! 273 CALL wrk_dealloc( jpi, jpj, jpk, zwi, zwz ) 274 IF( l_trd ) CALL wrk_dealloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz ) 310 DEALLOCATE( zwi ) 311 DEALLOCATE( zwz ) 312 IF( l_trd .OR. l_trans ) THEN 313 DEALLOCATE( ztrdx ) 314 DEALLOCATE( ztrdy ) 315 DEALLOCATE( ztrdz ) 316 DEALLOCATE( z2d ) 317 ENDIF 318 IF( cdtype == 'TRA' .AND. ln_diaptr ) DEALLOCATE( zptry ) 275 319 ! 276 320 IF( nn_timing == 1 ) CALL timing_stop('tra_adv_tvd') … … 316 360 REAL(wp) :: zfp_ui, zfp_vj, zfp_wk ! - - 317 361 REAL(wp) :: zfm_ui, zfm_vj, zfm_wk ! - - 318 REAL(wp), POINTER, DIMENSION(:,: ) :: zwx_sav , zwy_sav 319 REAL(wp), POINTER, DIMENSION(:,:,:) :: zwi, zwz, zhdiv, zwz_sav, zwzts 320 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdx, ztrdy, ztrdz 321 REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrs 362 REAL(wp), ALLOCATABLE, DIMENSION(:,: ) :: zwx_sav , zwy_sav 363 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zwi, zwz, zhdiv, zwz_sav, zwzts 364 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrdx, ztrdy, ztrdz 365 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zptry 366 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: ztrs 322 367 !!---------------------------------------------------------------------- 323 368 ! 324 369 IF( nn_timing == 1 ) CALL timing_start('tra_adv_tvd_zts') 325 370 ! 326 CALL wrk_alloc( jpi, jpj, zwx_sav, zwy_sav ) 327 CALL wrk_alloc( jpi, jpj, jpk, zwi, zwz , zhdiv, zwz_sav, zwzts ) 328 CALL wrk_alloc( jpi, jpj, jpk, 3, ztrs ) 371 ALLOCATE(zwx_sav(1:jpi, 1:jpj)) 372 ALLOCATE(zwy_sav(1:jpi, 1:jpj)) 373 ALLOCATE(zwi(1:jpi, 1:jpj, 1:jpk)) 374 ALLOCATE(zwz(1:jpi, 1:jpj, 1:jpk)) 375 ALLOCATE(zhdiv(1:jpi, 1:jpj, 1:jpk)) 376 ALLOCATE(zwz_sav(1:jpi, 1:jpj, 1:jpk)) 377 ALLOCATE(zwzts(1:jpi, 1:jpj, 1:jpk)) 378 ALLOCATE(ztrs(1:jpi, 1:jpj, 1:jpk, 1:kjpt+1)) 329 379 ! 330 380 IF( kt == kit000 ) THEN … … 338 388 ! 339 389 IF( l_trd ) THEN 340 CALL wrk_alloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz ) 390 ALLOCATE(ztrdx(1:jpi, 1:jpj, 1:jpk)) 391 ALLOCATE(ztrdy(1:jpi, 1:jpj, 1:jpk)) 392 ALLOCATE(ztrdz(1:jpi, 1:jpj, 1:jpk)) 341 393 ztrdx(:,:,:) = 0._wp ; ztrdy(:,:,:) = 0._wp ; ztrdz(:,:,:) = 0._wp 394 ENDIF 395 ! 396 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 397 ALLOCATE(zptry(1:jpi, 1:jpj, 1:jpk)) 398 zptry(:,:,:) = 0._wp 342 399 ENDIF 343 400 ! … … 410 467 DO jj = 2, jpjm1 411 468 DO ji = fs_2, fs_jpim1 ! vector opt. 412 zbtr = 1._wp / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )413 469 ! total intermediate advective trends 414 ztra = - zbtr *( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk ) &415 & 416 & + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1))470 ztra = - ( zwx(ji,jj,jk) - zwx(ji-1,jj ,jk ) & 471 & + zwy(ji,jj,jk) - zwy(ji ,jj-1,jk ) & 472 & + zwz(ji,jj,jk) - zwz(ji ,jj ,jk+1) ) / e1e2t(ji,jj) 417 473 ! update and guess with monotonic sheme 418 pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra419 zwi(ji,jj,jk) = ( ptb(ji,jj,jk,jn) + z2dtt * ztra) * tmask(ji,jj,jk)474 pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra / fse3t_n(ji,jj,jk) * tmask(ji,jj,jk) 475 zwi(ji,jj,jk) = ( fse3t_b(ji,jj,jk) * ptb(ji,jj,jk,jn) + z2dtt * ztra ) / fse3t_a(ji,jj,jk) * tmask(ji,jj,jk) 420 476 END DO 421 477 END DO … … 430 486 END IF 431 487 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 432 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 433 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( zwy(:,:,:) ) 434 IF( jn == jp_sal ) str_adv(:) = ptr_sj( zwy(:,:,:) ) 435 ENDIF 488 IF( cdtype == 'TRA' .AND. ln_diaptr ) zptry(:,:,:) = zwy(:,:,:) 436 489 437 490 ! 3. antidiffusive flux : high order minus low order 438 491 ! -------------------------------------------------- 439 492 ! antidiffusive flux on i and j 440 441 493 ! 442 494 DO jk = 1, jpkm1 443 495 ! 444 496 DO jj = 1, jpjm1 445 497 DO ji = 1, fs_jpim1 ! vector opt. … … 472 524 ! 473 525 ztrs(:,:,:,1) = ptb(:,:,:,jn) 526 ztrs(:,:,1,2) = ptb(:,:,1,jn) 527 ztrs(:,:,1,3) = ptb(:,:,1,jn) 474 528 zwzts(:,:,:) = 0._wp 475 529 … … 557 611 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 558 612 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 559 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( zwy(:,:,:) ) + htr_adv(:)560 IF( jn == jp_sal ) str_adv(:) = ptr_sj( zwy(:,:,:) ) + str_adv(:)613 zptry(:,:,:) = zptry(:,:,:) + zwy(:,:,:) 614 CALL dia_ptr_ohst_components( jn, 'adv', zptry(:,:,:) ) 561 615 ENDIF 562 616 ! 563 617 END DO 564 618 ! 565 CALL wrk_dealloc( jpi, jpj, jpk, zwi, zwz, zhdiv, zwz_sav, zwzts ) 566 CALL wrk_dealloc( jpi, jpj, jpk, 3, ztrs ) 567 CALL wrk_dealloc( jpi, jpj, zwx_sav, zwy_sav ) 568 IF( l_trd ) CALL wrk_dealloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz ) 619 DEALLOCATE(zwi) 620 DEALLOCATE(zwz) 621 DEALLOCATE(zhdiv) 622 DEALLOCATE(zwz_sav) 623 DEALLOCATE(zwzts) 624 DEALLOCATE(ztrs ) 625 DEALLOCATE(zwx_sav) 626 DEALLOCATE(zwy_sav ) 627 628 IF( l_trd ) THEN 629 DEALLOCATE(ztrdx) 630 DEALLOCATE(ztrdy) 631 DEALLOCATE(ztrdz) 632 END IF 633 634 IF( cdtype == 'TRA' .AND. ln_diaptr ) DEALLOCATE(zptry ) 569 635 ! 570 636 IF( nn_timing == 1 ) CALL timing_stop('tra_adv_tvd_zts') 571 637 ! 572 638 END SUBROUTINE tra_adv_tvd_zts 639 573 640 574 641 SUBROUTINE nonosc( pbef, paa, pbb, pcc, paft, p2dt ) … … 593 660 REAL(wp) :: zpos, zneg, zbt, za, zb, zc, zbig, zrtrn, z2dtt ! local scalars 594 661 REAL(wp) :: zau, zbu, zcu, zav, zbv, zcv, zup, zdo ! - - 595 REAL(wp), POINTER, DIMENSION(:,:,:) :: zbetup, zbetdo, zbup, zbdo662 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zbetup, zbetdo, zbup, zbdo 596 663 !!---------------------------------------------------------------------- 597 664 ! 598 665 IF( nn_timing == 1 ) CALL timing_start('nonosc') 599 666 ! 600 CALL wrk_alloc( jpi, jpj, jpk, zbetup, zbetdo, zbup, zbdo ) 667 ALLOCATE(zbetup(1:jpi, 1:jpj, 1:jpk)) 668 ALLOCATE(zbetdo(1:jpi, 1:jpj, 1:jpk)) 669 ALLOCATE(zbup(1:jpi, 1:jpj, 1:jpk)) 670 ALLOCATE(zbdo(1:jpi, 1:jpj, 1:jpk)) 601 671 ! 602 672 zbig = 1.e+40_wp … … 675 745 CALL lbc_lnk( paa, 'U', -1. ) ; CALL lbc_lnk( pbb, 'V', -1. ) ! lateral boundary condition (changed sign) 676 746 ! 677 CALL wrk_dealloc( jpi, jpj, jpk, zbetup, zbetdo, zbup, zbdo ) 747 DEALLOCATE(zbetup) 748 DEALLOCATE(zbetdo) 749 DEALLOCATE(zbup) 750 DEALLOCATE(zbdo) 678 751 ! 679 752 IF( nn_timing == 1 ) CALL timing_stop('nonosc') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_ubs.F90
r7960 r9987 177 177 END IF 178 178 ! ! "Poleward" heat and salt transports (contribution of upstream fluxes) 179 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 180 IF( jn == jp_tem ) htr_adv(:) = ptr_sj( ztv(:,:,:) ) 181 IF( jn == jp_sal ) str_adv(:) = ptr_sj( ztv(:,:,:) ) 182 ENDIF 179 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'adv', ztv(:,:,:) ) 183 180 184 181 ! TVD scheme for the vertical direction -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90
r7960 r9987 107 107 INTEGER, INTENT( in ) :: kt ! ocean time-step 108 108 ! 109 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdt, ztrds109 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrdt, ztrds 110 110 !!---------------------------------------------------------------------- 111 111 ! … … 113 113 ! 114 114 IF( l_trdtra ) THEN !* Save ta and sa trends 115 CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) 115 ALLOCATE( ztrdt (1:jpi, 1:jpj, 1:jpk)) 116 ALLOCATE( ztrds (1:jpi, 1:jpj, 1:jpk)) 116 117 ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 117 118 ztrds(:,:,:) = tsa(:,:,:,jp_sal) … … 151 152 CALL trd_tra( kt, 'TRA', jp_tem, jptra_bbl, ztrdt ) 152 153 CALL trd_tra( kt, 'TRA', jp_sal, jptra_bbl, ztrds ) 153 CALL wrk_dealloc( jpi, jpj, jpk,ztrdt, ztrds )154 DEALLOCATE( ztrdt, ztrds ) 154 155 ENDIF 155 156 ! … … 187 188 INTEGER :: ik ! local integers 188 189 REAL(wp) :: zbtr ! local scalars 189 REAL(wp), POINTER, DIMENSION(:,:) :: zptb190 REAL(wp), ALLOCATABLE , DIMENSION(:,:) :: zptb 190 191 !!---------------------------------------------------------------------- 191 192 ! 192 193 IF( nn_timing == 1 ) CALL timing_start('tra_bbl_dif') 193 194 ! 194 CALL wrk_alloc( jpi, jpj, zptb)195 ALLOCATE(zptb(1:jpi, 1:jpj)) 195 196 ! 196 197 DO jn = 1, kjpt ! tracer loop … … 217 218 END DO ! end tracer 218 219 ! ! =========== 219 CALL wrk_dealloc( jpi, jpj,zptb )220 DEALLOCATE( zptb ) 220 221 ! 221 222 IF( nn_timing == 1 ) CALL timing_stop('tra_bbl_dif') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90
r7960 r9987 68 68 ! 69 69 rldf = 1 ! For active tracers the 70 r_fact_lap(:,:,:) = 1.0 70 71 71 72 IF( l_trdtra ) THEN !* Save ta and sa trends … … 214 215 IF( ierr == 1 ) CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) 215 216 IF( ierr == 2 ) CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) 217 IF( ln_traldf_grif .AND. ln_isfcav ) & 218 CALL ctl_stop( ' ice shelf and traldf_grif not tested') 216 219 IF( lk_traldf_eiv .AND. .NOT.ln_traldf_iso ) & 217 220 CALL ctl_stop( ' eddy induced velocity on tracers', & -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilap.F90
r7960 r9987 173 173 ! 174 174 ! "zonal" mean lateral diffusive heat and salt transport 175 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 176 IF( jn == jp_tem ) htr_ldf(:) = ptr_sj( ztv(:,:,:) ) 177 IF( jn == jp_sal ) str_ldf(:) = ptr_sj( ztv(:,:,:) ) 178 ENDIF 175 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'ldf', ztv(:,:,:) ) 179 176 ! ! =========== 180 177 END DO ! tracer loop -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90
r7960 r9987 247 247 ! ! =============== 248 248 ! "Poleward" diffusive heat or salt transport 249 IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( kaht == 2 ) ) THEN 250 ! note sign is reversed to give down-gradient diffusive transports (#1043) 251 IF( jn == jp_tem) htr_ldf(:) = ptr_sj( -zftv(:,:,:) ) 252 IF( jn == jp_sal) str_ldf(:) = ptr_sj( -zftv(:,:,:) ) 253 ENDIF 249 ! note sign is reversed to give down-gradient diffusive transports (#1043) 250 IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( kaht == 2 ) ) CALL dia_ptr_ohst_components( jn, 'ldf', -zftv(:,:,:) ) 254 251 255 252 ! ! ************ ! ! =============== … … 330 327 END DO 331 328 ELSE 332 IF(lwp)WRITE(numout,*) ' ldfght: kaht= 1 or 2, here =', kaht333 IF(lwp)WRITE(numout,*) ' We stop'334 STOP 'ldfght'329 WRITE(numout,*) ' ldfght: kaht= 1 or 2, here =', kaht 330 WRITE(numout,*) ' We stop' 331 CALL ctl_stop( 'STOP', 'ldfght : unexpected kaht value') 335 332 ENDIF 336 333 ! ! =============== -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso.F90
r7960 r9987 26 26 USE ldfslp ! iso-neutral slopes 27 27 USE diaptr ! poleward transport diagnostics 28 USE trd_oce ! trends: ocean variables 29 USE trdtra ! trends manager: tracers 28 30 USE in_out_manager ! I/O manager 29 31 USE iom ! I/O library 30 32 USE phycst ! physical constants 31 33 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 32 USE wrk_nemo ! Memory Allocation33 34 USE timing ! Timing 34 35 … … 105 106 INTEGER :: ji, jj, jk, jn ! dummy loop indices 106 107 INTEGER :: ikt 107 REAL(wp) :: zmsku, zabe1, zcof1, zcoef3 ! local scalars 108 REAL(wp) :: zmskv, zabe2, zcof2, zcoef4 ! - - 109 REAL(wp) :: zcoef0, zbtr, ztra ! - - 110 REAL(wp), POINTER, DIMENSION(:,: ) :: z2d 111 REAL(wp), POINTER, DIMENSION(:,:,:) :: zdkt, zdk1t, zdit, zdjt, ztfw 108 REAL(wp) :: zmsku, zabe1, zcof1, zcoef3 ! local scalars 109 REAL(wp) :: zmskv, zabe2, zcof2, zcoef4 ! - - 110 REAL(wp) :: zcoef0, zbtr ! - - 111 REAL(wp), ALLOCATABLE, DIMENSION(:,: ) :: z2d 112 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zdkt, zdk1t, zdit, zdjt, ztfw 113 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET :: ztrax, ztray, ztraz 114 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET :: ztrax_T, ztray_T, ztraz_T 112 115 !!---------------------------------------------------------------------- 113 116 ! 114 117 IF( nn_timing == 1 ) CALL timing_start('tra_ldf_iso') 115 118 ! 116 CALL wrk_alloc( jpi, jpj, z2d ) 117 CALL wrk_alloc( jpi, jpj, jpk, zdit, zdjt, ztfw, zdkt, zdk1t ) 119 ALLOCATE( z2d(1:jpi, 1:jpj)) 120 ALLOCATE( zdit(1:jpi, 1:jpj, 1:jpk)) 121 ALLOCATE( zdjt(1:jpi, 1:jpj, 1:jpk)) 122 ALLOCATE( ztfw(1:jpi, 1:jpj, 1:jpk)) 123 ALLOCATE( zdkt(1:jpi, 1:jpj, 1:jpk)) 124 ALLOCATE( zdk1t(1:jpi, 1:jpj, 1:jpk)) 125 ALLOCATE( ztrax(1:jpi,1:jpj,1:jpk)) 126 ALLOCATE( ztray(1:jpi,1:jpj,1:jpk)) 127 ALLOCATE( ztraz(1:jpi,1:jpj,1:jpk) ) 128 IF( l_trdtra .and. cdtype == 'TRA' ) THEN 129 ALLOCATE( ztrax_T(1:jpi,1:jpj,1:jpk)) 130 ALLOCATE( ztray_T(1:jpi,1:jpj,1:jpk)) 131 ALLOCATE( ztraz_T(1:jpi,1:jpj,1:jpk)) 132 ENDIF 118 133 ! 119 134 … … 127 142 DO jn = 1, kjpt ! tracer loop 128 143 ! ! =========== 144 ztrax(:,:,:) = 0._wp ; ztray(:,:,:) = 0._wp ; ztraz(:,:,:) = 0._wp ; 129 145 ! 130 146 !!---------------------------------------------------------------------- … … 226 242 DO ji = fs_2, fs_jpim1 ! vector opt. 227 243 zbtr = 1.0 / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) ) 228 ztra = zbtr * ( zftu(ji,jj,jk) - zftu(ji-1,jj,jk) + zftv(ji,jj,jk) - zftv(ji,jj-1,jk))229 pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra244 ztrax(ji,jj,jk) = zbtr * ( zftu(ji,jj,jk) - zftu(ji-1,jj,jk) ) 245 ztray(ji,jj,jk) = zbtr * ( zftv(ji,jj,jk) - zftv(ji,jj-1,jk) ) 230 246 END DO 231 247 END DO … … 234 250 ! ! =============== 235 251 ! 252 pta(:,:,:,jn) = pta(:,:,:,jn) + ztrax(:,:,:) + ztray(:,:,:) 253 ! 236 254 ! "Poleward" diffusive heat or salt transports (T-S case only) 237 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN238 255 ! note sign is reversed to give down-gradient diffusive transports (#1043) 239 IF( jn == jp_tem) htr_ldf(:) = ptr_sj( -zftv(:,:,:) ) 240 IF( jn == jp_sal) str_ldf(:) = ptr_sj( -zftv(:,:,:) ) 241 ENDIF 256 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'ldf', -zftv(:,:,:) ) 242 257 243 258 IF( iom_use("udiff_heattr") .OR. iom_use("vdiff_heattr") ) THEN … … 314 329 DO ji = fs_2, fs_jpim1 ! vector opt. 315 330 zbtr = 1.0 / ( e12t(ji,jj) * fse3t_n(ji,jj,jk) ) 316 ztra = ( ztfw(ji,jj,jk) - ztfw(ji,jj,jk+1) ) * zbtr 317 pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra 331 ztraz(ji,jj,jk) = ( ztfw(ji,jj,jk) - ztfw(ji,jj,jk+1) ) * zbtr 318 332 END DO 319 333 END DO 320 334 END DO 335 pta(:,:,:,jn) = pta(:,:,:,jn) + ztraz(:,:,:) 321 336 ! 337 IF( l_trdtra .AND. cdtype == "TRA" .AND. jn .eq. 1 ) THEN ! save the temperature trends 338 ztrax_T(:,:,:) = ztrax(:,:,:) 339 ztray_T(:,:,:) = ztray(:,:,:) 340 ztraz_T(:,:,:) = ztraz(:,:,:) 341 ENDIF 342 IF( l_trdtrc .AND. cdtype == "TRC" ) THEN ! save the horizontal component of diffusive trends for further diagnostics 343 CALL trd_tra( kt, cdtype, jn, jptra_iso_x, ztrax ) 344 CALL trd_tra( kt, cdtype, jn, jptra_iso_y, ztray ) 345 CALL trd_tra( kt, cdtype, jn, jptra_iso_z1, ztraz ) ! This is the first part of the vertical component. 346 ENDIF 322 347 END DO 323 348 ! 324 CALL wrk_dealloc( jpi, jpj, z2d ) 325 CALL wrk_dealloc( jpi, jpj, jpk, zdit, zdjt, ztfw, zdkt, zdk1t ) 349 IF( l_trdtra .AND. cdtype == "TRA" ) THEN ! save the horizontal component of diffusive trends for further diagnostics 350 CALL trd_tra( kt, cdtype, jp_tem, jptra_iso_x, ztrax_T ) 351 CALL trd_tra( kt, cdtype, jp_sal, jptra_iso_x, ztrax ) 352 CALL trd_tra( kt, cdtype, jp_tem, jptra_iso_y, ztray_T ) 353 CALL trd_tra( kt, cdtype, jp_sal, jptra_iso_y, ztray ) 354 CALL trd_tra( kt, cdtype, jp_tem, jptra_iso_z1, ztraz_T ) ! This is the first part of the vertical component 355 CALL trd_tra( kt, cdtype, jp_sal, jptra_iso_z1, ztraz ) ! 356 ENDIF 357 ! 358 DEALLOCATE( z2d ) 359 DEALLOCATE( zdit) 360 DEALLOCATE( zdjt) 361 DEALLOCATE( ztfw) 362 DEALLOCATE( zdkt ) 363 DEALLOCATE( zdk1t ) 364 DEALLOCATE( ztrax, ztray, ztraz ) 365 IF( l_trdtra .and. cdtype == 'TRA' ) DEALLOCATE( ztrax_T, ztray_T, ztraz_T ) 326 366 ! 327 367 IF( nn_timing == 1 ) CALL timing_stop('tra_ldf_iso') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso_grif.F90
r7960 r9987 386 386 ! 387 387 ! ! "Poleward" diffusive heat or salt transports (T-S case only) 388 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 389 IF( jn == jp_tem) htr_ldf(:) = ptr_sj( zftv(:,:,:) ) ! 3.3 names 390 IF( jn == jp_sal) str_ldf(:) = ptr_sj( zftv(:,:,:) ) 391 ENDIF 388 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'ldf', zftv(:,:,:) ) 392 389 393 390 IF( iom_use("udiff_heattr") .OR. iom_use("vdiff_heattr") ) THEN -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_lap.F90
r7960 r9987 154 154 ! 155 155 ! "Poleward" diffusive heat or salt transports 156 IF( cdtype == 'TRA' .AND. ln_diaptr ) THEN 157 IF( jn == jp_tem) htr_ldf(:) = ptr_sj( ztv(:,:,:) ) 158 IF( jn == jp_sal) str_ldf(:) = ptr_sj( ztv(:,:,:) ) 159 ENDIF 156 IF( cdtype == 'TRA' .AND. ln_diaptr ) CALL dia_ptr_ohst_components( jn, 'ldf', ztv(:,:,:) ) 160 157 ! ! ================== 161 158 END DO ! end of tracer loop -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90
r7960 r9987 28 28 USE sbc_oce ! surface boundary condition: ocean 29 29 USE sbcrnf ! river runoffs 30 USE sbcisf ! ice shelf melting/freezing 30 31 USE zdf_oce ! ocean vertical mixing 31 32 USE domvvl ! variable volume … … 46 47 USE timing ! Timing 47 48 #if defined key_agrif 48 USE agrif_opa_update49 49 USE agrif_opa_interp 50 50 #endif … … 110 110 ! Update after tracer on domain lateral boundaries 111 111 ! 112 #if defined key_agrif 113 CALL Agrif_tra ! AGRIF zoom boundaries 114 #endif 115 ! 112 116 CALL lbc_lnk( tsa(:,:,:,jp_tem), 'T', 1._wp ) ! local domain boundaries (T-point, unchanged sign) 113 117 CALL lbc_lnk( tsa(:,:,:,jp_sal), 'T', 1._wp ) … … 115 119 #if defined key_bdy 116 120 IF( lk_bdy ) CALL bdy_tra( kt ) ! BDY open boundaries 117 #endif118 #if defined key_agrif119 CALL Agrif_tra ! AGRIF zoom boundaries120 121 #endif 121 122 … … 126 127 127 128 ! trends computation initialisation 128 IF( l_trdtra ) THEN ! store now fields before applying the Asselin filter129 IF( l_trdtra ) THEN 129 130 CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) 130 ztrdt(:,:, :) = tsn(:,:,:,jp_tem)131 ztrds(:,:, :) = tsn(:,:,:,jp_sal)131 ztrdt(:,:,jpk) = 0._wp 132 ztrds(:,:,jpk) = 0._wp 132 133 IF( ln_traldf_iso ) THEN ! diagnose the "pure" Kz diffusive trend 133 134 CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdfp, ztrdt ) 134 135 CALL trd_tra( kt, 'TRA', jp_sal, jptra_zdfp, ztrds ) 135 136 ENDIF 137 ! total trend for the non-time-filtered variables. 138 ! G Nurser 23 Mar 2017. Recalculate trend as Delta(e3t*T)/e3tn; e3tn cancel from tsn terms 139 IF( lk_vvl ) THEN 140 DO jk = 1, jpkm1 141 zfact = 1.0 / rdttra(jk) 142 ztrdt(:,:,jk) = ( tsa(:,:,jk,jp_tem)*fse3t_a(:,:,jk) / fse3t_n(:,:,jk) - tsn(:,:,jk,jp_tem)) * zfact 143 ztrds(:,:,jk) = ( tsa(:,:,jk,jp_sal)*fse3t_a(:,:,jk) / fse3t_n(:,:,jk) - tsn(:,:,jk,jp_sal)) * zfact 144 END DO 145 ELSE 146 DO jk = 1, jpkm1 147 zfact = 1.0 / rdttra(jk) 148 ztrdt(:,:,jk) = ( tsa(:,:,jk,jp_tem) - tsn(:,:,jk,jp_tem) ) * zfact 149 ztrds(:,:,jk) = ( tsa(:,:,jk,jp_sal) - tsn(:,:,jk,jp_sal) ) * zfact 150 END DO 151 END IF 152 CALL trd_tra( kt, 'TRA', jp_tem, jptra_tot, ztrdt ) 153 CALL trd_tra( kt, 'TRA', jp_sal, jptra_tot, ztrds ) 154 IF( .NOT.lk_vvl ) THEN 155 ! Store now fields before applying the Asselin filter 156 ! in order to calculate Asselin filter trend later. 157 ztrdt(:,:,:) = tsn(:,:,:,jp_tem) 158 ztrds(:,:,:) = tsn(:,:,:,jp_sal) 159 END IF 136 160 ENDIF 137 161 … … 142 166 END DO 143 167 END DO 168 IF (l_trdtra.AND.lk_vvl) THEN ! Zero Asselin filter contribution must be explicitly written out since for vvl 169 ! Asselin filter is output by tra_nxt_vvl that is not called on this time step 170 ztrdt(:,:,:) = 0._wp 171 ztrds(:,:,:) = 0._wp 172 CALL trd_tra( kt, 'TRA', jp_tem, jptra_atf, ztrdt ) 173 CALL trd_tra( kt, 'TRA', jp_sal, jptra_atf, ztrds ) 174 END IF 144 175 ELSE ! Leap-Frog + Asselin filter time stepping 145 176 ! … … 148 179 ELSE ; CALL tra_nxt_fix( kt, nit000, 'TRA', tsb, tsn, tsa, jpts ) ! fixed volume level 149 180 ENDIF 150 ENDIF 151 ! 152 #if defined key_agrif 153 ! Update tracer at AGRIF zoom boundaries 154 IF( .NOT.Agrif_Root() ) CALL Agrif_Update_Tra( kt ) ! children only 155 #endif 156 ! 157 ! trends computation 158 IF( l_trdtra ) THEN ! trend of the Asselin filter (tb filtered - tb)/dt 181 ENDIF 182 ! 183 ! trends computation 184 IF( l_trdtra.AND..NOT.lk_vvl) THEN ! trend of the Asselin filter (tb filtered - tb)/dt 159 185 DO jk = 1, jpkm1 160 186 zfact = 1._wp / r2dtra(jk) … … 164 190 CALL trd_tra( kt, 'TRA', jp_tem, jptra_atf, ztrdt ) 165 191 CALL trd_tra( kt, 'TRA', jp_sal, jptra_atf, ztrds ) 166 CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds )167 192 END IF 193 IF( l_trdtra) CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) 168 194 ! 169 195 ! ! control print … … 279 305 280 306 !! 281 LOGICAL :: ll_tra_hpg, ll_traqsr, ll_rnf ! local logical307 LOGICAL :: ll_tra_hpg, ll_traqsr, ll_rnf, ll_isf ! local logical 282 308 INTEGER :: ji, jj, jk, jn ! dummy loop indices 283 REAL(wp) :: zfact 1, ztc_a , ztc_n , ztc_b , ztc_f , ztc_d ! local scalar309 REAL(wp) :: zfact, zfact1, ztc_a , ztc_n , ztc_b , ztc_f , ztc_d ! local scalar 284 310 REAL(wp) :: zfact2, ze3t_b, ze3t_n, ze3t_a, ze3t_f, ze3t_d ! - - 311 REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrd_atf 285 312 !!---------------------------------------------------------------------- 286 313 ! … … 295 322 ll_traqsr = ln_traqsr ! active tracers case and solar penetration 296 323 ll_rnf = ln_rnf ! active tracers case and river runoffs 324 IF (nn_isf .GE. 1) THEN 325 ll_isf = .TRUE. ! active tracers case and ice shelf melting/freezing 326 ELSE 327 ll_isf = .FALSE. 328 END IF 297 329 ELSE 298 330 ll_tra_hpg = .FALSE. ! passive tracers case or NO semi-implicit hpg 299 331 ll_traqsr = .FALSE. ! active tracers case and NO solar penetration 300 332 ll_rnf = .FALSE. ! passive tracers or NO river runoffs 301 ENDIF 302 ! 333 ll_isf = .FALSE. ! passive tracers or NO ice shelf melting/freezing 334 ENDIF 335 ! 336 IF( ( l_trdtra .and. cdtype == 'TRA' ) .OR. ( l_trdtrc .and. cdtype == 'TRC' ) ) THEN 337 CALL wrk_alloc( jpi, jpj, jpk, kjpt, ztrd_atf ) 338 ztrd_atf(:,:,:,:) = 0.0_wp 339 ENDIF 303 340 DO jn = 1, kjpt 304 341 DO jk = 1, jpkm1 342 zfact = 1._wp / r2dtra(jk) 305 343 zfact1 = atfp * p2dt(jk) 306 344 zfact2 = zfact1 / rau0 … … 321 359 ztc_f = ztc_n + atfp * ztc_d 322 360 ! 323 IF( jk == 1 ) THEN ! first level 324 ze3t_f = ze3t_f - zfact2 * ( emp_b(ji,jj) - emp(ji,jj) + rnf(ji,jj) - rnf_b(ji,jj) ) 361 IF( jk == mikt(ji,jj) ) THEN ! first level 362 ze3t_f = ze3t_f - zfact2 * ( (emp_b(ji,jj) - emp(ji,jj) ) & 363 & - (rnf_b(ji,jj) - rnf(ji,jj) ) & 364 & + (fwfisf_b(ji,jj) - fwfisf(ji,jj)) ) 325 365 ztc_f = ztc_f - zfact1 * ( psbc_tc(ji,jj,jn) - psbc_tc_b(ji,jj,jn) ) 326 366 ENDIF 327 367 328 IF( ll_traqsr .AND. jn == jp_tem .AND. jk <= nksr ) & ! solar penetration (temperature only) 368 ! solar penetration (temperature only) 369 IF( ll_traqsr .AND. jn == jp_tem .AND. jk <= nksr ) & 329 370 & ztc_f = ztc_f - zfact1 * ( qsr_hc(ji,jj,jk) - qsr_hc_b(ji,jj,jk) ) 330 371 331 IF( ll_rnf .AND. jk <= nk_rnf(ji,jj) ) & ! river runoffs 372 ! river runoff 373 IF( ll_rnf .AND. jk <= nk_rnf(ji,jj) ) & 332 374 & ztc_f = ztc_f - zfact1 * ( rnf_tsc(ji,jj,jn) - rnf_tsc_b(ji,jj,jn) ) & 333 375 & * fse3t_n(ji,jj,jk) / h_rnf(ji,jj) 376 377 ! ice shelf 378 IF( ll_isf ) THEN 379 ! level fully include in the Losch_2008 ice shelf boundary layer 380 IF ( jk >= misfkt(ji,jj) .AND. jk < misfkb(ji,jj) ) & 381 ztc_f = ztc_f - zfact1 * ( risf_tsc(ji,jj,jn) - risf_tsc_b(ji,jj,jn) ) & 382 & * fse3t_n(ji,jj,jk) * r1_hisf_tbl (ji,jj) 383 ! level partially include in Losch_2008 ice shelf boundary layer 384 IF ( jk == misfkb(ji,jj) ) & 385 ztc_f = ztc_f - zfact1 * ( risf_tsc(ji,jj,jn) - risf_tsc_b(ji,jj,jn) ) & 386 & * fse3t_n(ji,jj,jk) * r1_hisf_tbl (ji,jj) * ralpha(ji,jj) 387 END IF 334 388 335 389 ze3t_f = 1.e0 / ze3t_f … … 340 394 ze3t_d = 1.e0 / ( ze3t_n + rbcp * ze3t_d ) 341 395 pta(ji,jj,jk,jn) = ze3t_d * ( ztc_n + rbcp * ztc_d ) ! ta <-- Brown & Campana average 396 ENDIF 397 IF( ( l_trdtra .and. cdtype == 'TRA' ) .OR. ( l_trdtrc .and. cdtype == 'TRC' ) ) THEN 398 ztrd_atf(ji,jj,jk,jn) = (ztc_f - ztc_n) * zfact/ze3t_n 342 399 ENDIF 343 400 END DO … … 347 404 END DO 348 405 ! 406 IF( l_trdtra .and. cdtype == 'TRA' ) THEN 407 CALL trd_tra( kt, cdtype, jp_tem, jptra_atf, ztrd_atf(:,:,:,jp_tem) ) 408 CALL trd_tra( kt, cdtype, jp_sal, jptra_atf, ztrd_atf(:,:,:,jp_sal) ) 409 CALL wrk_dealloc( jpi, jpj, jpk, kjpt, ztrd_atf ) 410 ENDIF 411 IF( l_trdtrc .and. cdtype == 'TRC' ) THEN 412 DO jn = 1, kjpt 413 CALL trd_tra( kt, cdtype, jn, jptra_atf, ztrd_atf(:,:,:,jn) ) 414 END DO 415 CALL wrk_dealloc( jpi, jpj, jpk, kjpt, ztrd_atf ) 416 ENDIF 417 349 418 END SUBROUTINE tra_nxt_vvl 350 419 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90
r7960 r9987 10 10 !! - ! 2005-11 (G. Madec) zco, zps, sco coordinate 11 11 !! 3.2 ! 2009-04 (G. Madec & NEMO team) 12 !! 4.0 ! 2012-05 (C. Rousset) store attenuation coef for use in ice model 12 !! 3.4 ! 2012-05 (C. Rousset) store attenuation coef for use in ice model 13 !! 3.6 ! 2015-12 (O. Aumont, J. Jouanno, C. Ethe) use vertical profile of chlorophyll 13 14 !!---------------------------------------------------------------------- 14 15 … … 93 94 !! Reference : Jerlov, N. G., 1968 Optical Oceanography, Elsevier, 194pp. 94 95 !! Lengaigne et al. 2007, Clim. Dyn., V28, 5, 503-516. 96 !! Morel, A. et Berthon, JF, 1989, Limnol Oceanogr 34(8), 1545-1562 95 97 !!---------------------------------------------------------------------- 96 98 ! … … 101 103 REAL(wp) :: zchl, zcoef, zfact ! local scalars 102 104 REAL(wp) :: zc0, zc1, zc2, zc3 ! - - 103 REAL(wp) :: zzc0, zzc1, zzc2, zzc3 ! - -104 105 REAL(wp) :: zz0, zz1, z1_e3t ! - - 106 REAL(wp) :: zCb, zCmax, zze, zpsi, zpsimax, zdelpsi, zCtot, zCze 107 REAL(wp) :: zlogc, zlogc2, zlogc3 105 108 REAL(wp), POINTER, DIMENSION(:,: ) :: zekb, zekg, zekr 106 REAL(wp), POINTER, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea, ztrdt 107 !!---------------------------------------------------------------------- 109 REAL(wp), POINTER, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea, ztrdt, zchl3d 110 !!-------------------------------------------------------------------------- 108 111 ! 109 112 IF( nn_timing == 1 ) CALL timing_start('tra_qsr') 110 113 ! 111 114 CALL wrk_alloc( jpi, jpj, zekb, zekg, zekr ) 112 CALL wrk_alloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea )115 CALL wrk_alloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea, zchl3d ) 113 116 ! 114 117 IF( kt == nit000 ) THEN … … 183 186 ! ! ------------------------- ! 184 187 ! Set chlorophyl concentration 185 IF( nn_chldta == 1 .OR. lk_vvl ) THEN !* Variable Chlorophyll or ocean volume 186 ! 187 IF( nn_chldta == 1 ) THEN !* Variable Chlorophyll 188 ! 189 CALL fld_read( kt, 1, sf_chl ) ! Read Chl data and provides it at the current time step 190 ! 191 !CDIR COLLAPSE 188 IF( nn_chldta == 1 .OR. nn_chldta == 2 .OR. lk_vvl ) THEN !* Variable Chlorophyll or ocean volume 189 ! 190 IF( nn_chldta == 1 ) THEN !* 2D Variable Chlorophyll 191 ! 192 CALL fld_read( kt, 1, sf_chl ) ! Read Chl data and provides it at the current time step 193 DO jk = 1, nksr + 1 194 zchl3d(:,:,jk) = sf_chl(1)%fnow(:,:,1) 195 ENDDO 196 ! 197 ELSE IF( nn_chldta == 2 ) THEN !* -3-D Variable Chlorophyll 198 ! 199 CALL fld_read( kt, 1, sf_chl ) ! Read Chl data and provides it at the current time step 200 !CDIR NOVERRCHK ! 201 DO jj = 1, jpj 192 202 !CDIR NOVERRCHK 193 DO jj = 1, jpj ! Separation in R-G-B depending of the surface Chl 194 !CDIR NOVERRCHK 195 DO ji = 1, jpi 196 zchl = MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj,1) ) ) 197 irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 ) 198 zekb(ji,jj) = rkrgb(1,irgb) 199 zekg(ji,jj) = rkrgb(2,irgb) 200 zekr(ji,jj) = rkrgb(3,irgb) 201 END DO 202 END DO 203 ELSE ! Variable ocean volume but constant chrlorophyll 204 zchl = 0.05 ! constant chlorophyll 205 irgb = NINT( 41 + 20.*LOG10( zchl ) + 1.e-15 ) 206 zekb(:,:) = rkrgb(1,irgb) ! Separation in R-G-B depending of the chlorophyll 207 zekg(:,:) = rkrgb(2,irgb) 208 zekr(:,:) = rkrgb(3,irgb) 203 DO ji = 1, jpi 204 zchl = sf_chl(1)%fnow(ji,jj,1) 205 zCtot = 40.6 * zchl**0.459 206 zze = 568.2 * zCtot**(-0.746) 207 IF( zze > 102. ) zze = 200.0 * zCtot**(-0.293) 208 zlogc = LOG( zchl ) 209 zlogc2 = zlogc * zlogc 210 zlogc3 = zlogc * zlogc * zlogc 211 zCb = 0.768 + 0.087 * zlogc - 0.179 * zlogc2 - 0.025 * zlogc3 212 zCmax = 0.299 - 0.289 * zlogc + 0.579 * zlogc2 213 zpsimax = 0.6 - 0.640 * zlogc + 0.021 * zlogc2 + 0.115 * zlogc3 214 zdelpsi = 0.710 + 0.159 * zlogc + 0.021 * zlogc2 215 zCze = 1.12 * (zchl)**0.803 216 DO jk = 1, nksr + 1 217 zpsi = fsdept(ji,jj,jk) / zze 218 zchl3d(ji,jj,jk) = zCze * ( zCb + zCmax * EXP( -( (zpsi - zpsimax) / zdelpsi )**2 ) ) 219 END DO 220 ! 221 END DO 222 END DO 223 ! 224 ELSE !* Variable ocean volume but constant chrlorophyll 225 DO jk = 1, nksr + 1 226 zchl3d(:,:,jk) = 0.05 227 ENDDO 209 228 ENDIF 210 229 ! 211 zcoef = ( 1. - rn_abs ) / 3.e0 ! equi-partition in R-G-B230 zcoef = ( 1. - rn_abs ) / 3.e0 ! equi-partition in R-G-B 212 231 ze0(:,:,1) = rn_abs * qsr(:,:) 213 232 ze1(:,:,1) = zcoef * qsr(:,:) … … 217 236 ! 218 237 DO jk = 2, nksr+1 238 ! 239 DO jj = 1, jpj ! Separation in R-G-B depending of vertical profile of Chl 240 !CDIR NOVERRCHK 241 DO ji = 1, jpi 242 zchl = MIN( 10. , MAX( 0.03, zchl3d(ji,jj,jk) ) ) 243 irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 ) 244 zekb(ji,jj) = rkrgb(1,irgb) 245 zekg(ji,jj) = rkrgb(2,irgb) 246 zekr(ji,jj) = rkrgb(3,irgb) 247 END DO 248 END DO 219 249 !CDIR NOVERRCHK 220 250 DO jj = 1, jpj … … 233 263 END DO 234 264 END DO 235 ! clem: store attenuation coefficient of the first ocean level236 IF ( ln_qsr_ice ) THEN237 DO jj = 1, jpj238 DO ji = 1, jpi239 zzc0 = rn_abs * EXP( - fse3t(ji,jj,1) * xsi0r )240 zzc1 = zcoef * EXP( - fse3t(ji,jj,1) * zekb(ji,jj) )241 zzc2 = zcoef * EXP( - fse3t(ji,jj,1) * zekg(ji,jj) )242 zzc3 = zcoef * EXP( - fse3t(ji,jj,1) * zekr(ji,jj) )243 fraqsr_1lev(ji,jj) = 1.0 - ( zzc0 + zzc1 + zzc2 + zzc3 ) * tmask(ji,jj,2)244 END DO245 END DO246 ENDIF247 265 ! 248 266 DO jk = 1, nksr ! compute and add qsr trend to ta … … 251 269 zea(:,:,nksr+1:jpk) = 0.e0 ! below 400m set to zero 252 270 CALL iom_put( 'qsr3d', zea ) ! Shortwave Radiation 3D distribution 271 ! 272 IF ( ln_qsr_ice ) THEN ! store attenuation coefficient of the first ocean level 273 !CDIR NOVERRCHK 274 DO jj = 1, jpj ! Separation in R-G-B depending of the surface Chl 275 !CDIR NOVERRCHK 276 DO ji = 1, jpi 277 zchl = MIN( 10. , MAX( 0.03, zchl3d(ji,jj,1) ) ) 278 irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 ) 279 zekb(ji,jj) = rkrgb(1,irgb) 280 zekg(ji,jj) = rkrgb(2,irgb) 281 zekr(ji,jj) = rkrgb(3,irgb) 282 END DO 283 END DO 284 ! 285 DO jj = 1, jpj 286 DO ji = 1, jpi 287 zc0 = rn_abs * EXP( - fse3t(ji,jj,1) * xsi0r ) 288 zc1 = zcoef * EXP( - fse3t(ji,jj,1) * zekb(ji,jj) ) 289 zc2 = zcoef * EXP( - fse3t(ji,jj,1) * zekg(ji,jj) ) 290 zc3 = zcoef * EXP( - fse3t(ji,jj,1) * zekr(ji,jj) ) 291 fraqsr_1lev(ji,jj) = 1.0 - ( zc0 + zc1 + zc2 + zc3 ) * tmask(ji,jj,2) 292 END DO 293 END DO 294 ! 295 ENDIF 253 296 ! 254 297 ELSE !* Constant Chlorophyll … … 256 299 qsr_hc(:,:,jk) = etot3(:,:,jk) * qsr(:,:) 257 300 END DO 258 ! clem:store attenuation coefficient of the first ocean level259 IF 301 ! store attenuation coefficient of the first ocean level 302 IF( ln_qsr_ice ) THEN 260 303 fraqsr_1lev(:,:) = etot3(:,:,1) / r1_rau0_rcp 261 304 ENDIF … … 339 382 ! 340 383 CALL wrk_dealloc( jpi, jpj, zekb, zekg, zekr ) 341 CALL wrk_dealloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea )384 CALL wrk_dealloc( jpi, jpj, jpk, ze0, ze1, ze2, ze3, zea, zchl3d ) 342 385 ! 343 386 IF( nn_timing == 1 ) CALL timing_stop('tra_qsr') … … 405 448 WRITE(numout,*) ' bio-model light penetration ln_qsr_bio = ', ln_qsr_bio 406 449 WRITE(numout,*) ' light penetration for ice-model LIM3 ln_qsr_ice = ', ln_qsr_ice 407 WRITE(numout,*) ' RGB : Chl data (=1 ) or cst value (=0)nn_chldta = ', nn_chldta450 WRITE(numout,*) ' RGB : Chl data (=1/2) or cst value (=0) nn_chldta = ', nn_chldta 408 451 WRITE(numout,*) ' RGB & 2 bands: fraction of light (rn_si1) rn_abs = ', rn_abs 409 452 WRITE(numout,*) ' RGB & 2 bands: shortess depth of extinction rn_si0 = ', rn_si0 … … 429 472 IF( ln_qsr_rgb .AND. nn_chldta == 0 ) nqsr = 1 430 473 IF( ln_qsr_rgb .AND. nn_chldta == 1 ) nqsr = 2 431 IF( ln_qsr_2bd ) nqsr = 3 432 IF( ln_qsr_bio ) nqsr = 4 474 IF( ln_qsr_rgb .AND. nn_chldta == 2 ) nqsr = 3 475 IF( ln_qsr_2bd ) nqsr = 4 476 IF( ln_qsr_bio ) nqsr = 5 433 477 ! 434 478 IF(lwp) THEN ! Print the choice 435 479 WRITE(numout,*) 436 480 IF( nqsr == 1 ) WRITE(numout,*) ' R-G-B light penetration - Constant Chlorophyll' 437 IF( nqsr == 2 ) WRITE(numout,*) ' R-G-B light penetration - Chl data ' 438 IF( nqsr == 3 ) WRITE(numout,*) ' 2 bands light penetration' 439 IF( nqsr == 4 ) WRITE(numout,*) ' bio-model light penetration' 481 IF( nqsr == 2 ) WRITE(numout,*) ' R-G-B light penetration - 2D Chl data ' 482 IF( nqsr == 3 ) WRITE(numout,*) ' R-G-B light penetration - 3D Chl data ' 483 IF( nqsr == 4 ) WRITE(numout,*) ' 2 bands light penetration' 484 IF( nqsr == 5 ) WRITE(numout,*) ' bio-model light penetration' 440 485 ENDIF 441 486 ! … … 460 505 IF(lwp) WRITE(numout,*) ' level of light extinction = ', nksr, ' ref depth = ', gdepw_1d(nksr+1), ' m' 461 506 ! 462 IF( nn_chldta == 1 ) THEN !* Chl data : set sf_chl structure507 IF( nn_chldta == 1 .OR. nn_chldta == 2 ) THEN !* Chl data : set sf_chl structure 463 508 IF(lwp) WRITE(numout,*) 464 509 IF(lwp) WRITE(numout,*) ' Chlorophyll read in a file' -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90
r7960 r9987 33 33 USE timing ! Timing 34 34 USE eosbn2 35 #if defined key_asminc 36 USE asminc ! Assimilation increment 37 #endif 35 38 36 39 IMPLICIT NONE … … 159 162 ELSE ! No restart or restart not found: Euler forward time stepping 160 163 zfact = 1._wp 164 sbc_tsc(:,:,:) = 0._wp 161 165 sbc_tsc_b(:,:,:) = 0._wp 162 166 ENDIF … … 232 236 DO jk = ikt, ikb - 1 233 237 ! compute tfreez for the temperature correction (we add water at freezing temperature) 234 ! zpress = grav*rau0*fsdept(ji,jj,jk)*1.e-04235 zt_frz = -1.9 !eos_fzp( tsn(ji,jj,jk,jp_sal), zpress )236 238 ! compute trend 237 239 tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) & 238 & + zfact * (risf_tsc_b(ji,jj,jp_tem) + risf_tsc(ji,jj,jp_tem) & 239 & - rdivisf * (fwfisf(ji,jj) + fwfisf_b(ji,jj)) * zt_frz * r1_rau0) & 240 & * r1_hisf_tbl(ji,jj) 240 & + zfact * (risf_tsc_b(ji,jj,jp_tem) + risf_tsc(ji,jj,jp_tem)) * r1_hisf_tbl(ji,jj) 241 241 tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) & 242 242 & + zfact * (risf_tsc_b(ji,jj,jp_sal) + risf_tsc(ji,jj,jp_sal)) * r1_hisf_tbl(ji,jj) … … 245 245 ! level partially include in ice shelf boundary layer 246 246 ! compute tfreez for the temperature correction (we add water at freezing temperature) 247 ! zpress = grav*rau0*fsdept(ji,jj,ikb)*1.e-04248 zt_frz = -1.9 !eos_fzp( tsn(ji,jj,ikb,jp_sal), zpress )249 247 ! compute trend 250 248 tsa(ji,jj,ikb,jp_tem) = tsa(ji,jj,ikb,jp_tem) & 251 & + zfact * (risf_tsc_b(ji,jj,jp_tem) + risf_tsc(ji,jj,jp_tem) & 252 & - rdivisf * (fwfisf(ji,jj) + fwfisf_b(ji,jj)) * zt_frz * r1_rau0) & 253 & * r1_hisf_tbl(ji,jj) * ralpha(ji,jj) 249 & + zfact * (risf_tsc_b(ji,jj,jp_tem) + risf_tsc(ji,jj,jp_tem)) * r1_hisf_tbl(ji,jj) * ralpha(ji,jj) 254 250 tsa(ji,jj,ikb,jp_sal) = tsa(ji,jj,ikb,jp_sal) & 255 251 & + zfact * (risf_tsc_b(ji,jj,jp_sal) + risf_tsc(ji,jj,jp_sal)) * r1_hisf_tbl(ji,jj) * ralpha(ji,jj) … … 287 283 END DO 288 284 ENDIF 285 286 IF( iom_use('rnf_x_sst') ) CALL iom_put( "rnf_x_sst", rnf*tsn(:,:,1,jp_tem) ) ! runoff term on sst 287 IF( iom_use('rnf_x_sss') ) CALL iom_put( "rnf_x_sss", rnf*tsn(:,:,1,jp_sal) ) ! runoff term on sss 288 289 #if defined key_asminc 290 ! WARNING: THIS MAY WELL NOT BE REQUIRED - WE DON'T WANT TO CHANGE T&S BUT THIS MAY COMPENSATE ANOTHER TERM... 291 ! Rate of change in e3t for each level is ssh_iau*e3t_0/ht_0 292 ! Contribution to tsa should be rate of change in level / per m of ocean? (hence the division by fse3t_n) 293 IF( ln_sshinc ) THEN ! input of heat and salt due to assimilation 294 DO jj = 2, jpj 295 DO ji = fs_2, fs_jpim1 296 zdep = ssh_iau(ji,jj) / ( ht_0(ji,jj) + 1.0 - ssmask(ji, jj) ) 297 DO jk = 1, jpkm1 298 tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) & 299 & + tsn(ji,jj,jk,jp_tem) * zdep * ( e3t_0(ji,jj,jk) / fse3t_n(ji,jj,jk) ) 300 tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) & 301 & + tsn(ji,jj,jk,jp_sal) * zdep * ( e3t_0(ji,jj,jk) / fse3t_n(ji,jj,jk) ) 302 END DO 303 END DO 304 END DO 305 ENDIF 306 #endif 289 307 290 308 IF( l_trdtra ) THEN ! send trends for further diagnostics -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90
r7960 r9987 94 94 95 95 IF( l_trdtra ) THEN ! save the vertical diffusive trends for further diagnostics 96 DO jk = 1, jpkm1 97 ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / r2dtra(jk) ) - ztrdt(:,:,jk) 98 ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / r2dtra(jk) ) - ztrds(:,:,jk) 99 END DO 96 ! G Nurser 23 Mar 2017. Recalculate trend as Delta(e3t*T)/e3tn. 97 IF( lk_vvl ) THEN 98 DO jk = 1, jpkm1 99 ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem)*fse3t_a(:,:,jk) - tsb(:,:,jk,jp_tem)*fse3t_b(:,:,jk) ) & 100 & / (fse3t_n(:,:,jk)*r2dtra(jk)) ) - ztrdt(:,:,jk) 101 ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal)*fse3t_a(:,:,jk) - tsb(:,:,jk,jp_sal)*fse3t_b(:,:,jk) ) & 102 & / (fse3t_n(:,:,jk)*r2dtra(jk)) ) - ztrds(:,:,jk) 103 END DO 104 ELSE 105 DO jk = 1, jpkm1 106 ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / r2dtra(jk) ) - ztrdt(:,:,jk) 107 ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / r2dtra(jk) ) - ztrds(:,:,jk) 108 END DO 109 END IF 100 110 CALL lbc_lnk( ztrdt, 'T', 1. ) 101 111 CALL lbc_lnk( ztrds, 'T', 1. ) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRD/trd_oce.F90
r7960 r9987 33 33 # endif 34 34 ! !!!* Active tracers trends indexes 35 INTEGER, PUBLIC, PARAMETER :: jptot_tra = 14!: Total trend nb: change it when adding/removing one indice below35 INTEGER, PUBLIC, PARAMETER :: jptot_tra = 20 !: Total trend nb: change it when adding/removing one indice below 36 36 ! =============== ! 37 37 INTEGER, PUBLIC, PARAMETER :: jptra_xad = 1 !: x- horizontal advection … … 39 39 INTEGER, PUBLIC, PARAMETER :: jptra_zad = 3 !: z- vertical advection 40 40 INTEGER, PUBLIC, PARAMETER :: jptra_sad = 4 !: z- vertical advection 41 INTEGER, PUBLIC, PARAMETER :: jptra_ldf = 5 !: lateral diffusion 42 INTEGER, PUBLIC, PARAMETER :: jptra_zdf = 6 !: vertical diffusion 43 INTEGER, PUBLIC, PARAMETER :: jptra_zdfp = 7 !: "PURE" vert. diffusion (ln_traldf_iso=T) 44 INTEGER, PUBLIC, PARAMETER :: jptra_bbc = 8 !: Bottom Boundary Condition (geoth. heating) 45 INTEGER, PUBLIC, PARAMETER :: jptra_bbl = 9 !: Bottom Boundary Layer (diffusive and/or advective) 46 INTEGER, PUBLIC, PARAMETER :: jptra_npc = 10 !: non-penetrative convection treatment 47 INTEGER, PUBLIC, PARAMETER :: jptra_dmp = 11 !: internal restoring (damping) 48 INTEGER, PUBLIC, PARAMETER :: jptra_qsr = 12 !: penetrative solar radiation 49 INTEGER, PUBLIC, PARAMETER :: jptra_nsr = 13 !: non solar radiation / C/D on salinity (+runoff if ln_rnf=T) 50 INTEGER, PUBLIC, PARAMETER :: jptra_atf = 14 !: Asselin time filter 41 INTEGER, PUBLIC, PARAMETER :: jptra_totad = 5 !: total advection 42 INTEGER, PUBLIC, PARAMETER :: jptra_ldf = 6 !: lateral diffusion 43 INTEGER, PUBLIC, PARAMETER :: jptra_iso_x = 7 !: x-component of isopycnal diffusion 44 INTEGER, PUBLIC, PARAMETER :: jptra_iso_y = 8 !: y-component of isopycnal diffusion 45 INTEGER, PUBLIC, PARAMETER :: jptra_iso_z1 = 9 !: z-component of isopycnal diffusion 46 INTEGER, PUBLIC, PARAMETER :: jptra_zdf = 10 !: vertical diffusion 47 INTEGER, PUBLIC, PARAMETER :: jptra_zdfp = 11 !: "PURE" vert. diffusion (ln_traldf_iso=T) 48 INTEGER, PUBLIC, PARAMETER :: jptra_evd = 12 !: EVD term (convection) 49 INTEGER, PUBLIC, PARAMETER :: jptra_bbc = 13 !: Bottom Boundary Condition (geoth. heating) 50 INTEGER, PUBLIC, PARAMETER :: jptra_bbl = 14 !: Bottom Boundary Layer (diffusive and/or advective) 51 INTEGER, PUBLIC, PARAMETER :: jptra_npc = 15 !: non-penetrative convection treatment 52 INTEGER, PUBLIC, PARAMETER :: jptra_dmp = 16 !: internal restoring (damping) 53 INTEGER, PUBLIC, PARAMETER :: jptra_qsr = 17 !: penetrative solar radiation 54 INTEGER, PUBLIC, PARAMETER :: jptra_nsr = 18 !: non solar radiation / C/D on salinity (+runoff if ln_rnf=T) 55 INTEGER, PUBLIC, PARAMETER :: jptra_atf = 19 !: Asselin time filter 56 INTEGER, PUBLIC, PARAMETER :: jptra_tot = 20 !: Model total trend 51 57 ! 52 58 ! !!!* Passive tracers trends indices (use if "key_top" defined) 53 INTEGER, PUBLIC, PARAMETER :: jptra_sms = 1 5!: sources m. sinks54 INTEGER, PUBLIC, PARAMETER :: jptra_radn = 16!: corr. trn<0 in trcrad55 INTEGER, PUBLIC, PARAMETER :: jptra_radb = 17!: corr. trb<0 in trcrad (like atf)59 INTEGER, PUBLIC, PARAMETER :: jptra_sms = 19 !: sources m. sinks 60 INTEGER, PUBLIC, PARAMETER :: jptra_radn = 20 !: corr. trn<0 in trcrad 61 INTEGER, PUBLIC, PARAMETER :: jptra_radb = 21 !: corr. trb<0 in trcrad (like atf) 56 62 ! 57 63 ! !!!* Momentum trends indices 58 INTEGER, PUBLIC, PARAMETER :: jptot_dyn = 1 5!: Total trend nb: change it when adding/removing one indice below64 INTEGER, PUBLIC, PARAMETER :: jptot_dyn = 16 !: Total trend nb: change it when adding/removing one indice below 59 65 ! =============== ! 60 66 INTEGER, PUBLIC, PARAMETER :: jpdyn_hpg = 1 !: hydrostatic pressure gradient … … 73 79 INTEGER, PUBLIC, PARAMETER :: jpdyn_spgflt = 14 !: filter contribution to surface pressure gradient (spg_flt) 74 80 INTEGER, PUBLIC, PARAMETER :: jpdyn_spgexp = 15 !: explicit contribution to surface pressure gradient (spg_flt) 81 INTEGER, PUBLIC, PARAMETER :: jpdyn_eivke = 16 !: K.E trend from Gent McWilliams scheme 75 82 ! 76 83 !!---------------------------------------------------------------------- -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRD/trdini.F90
r7960 r9987 91 91 !!gm end 92 92 ! 93 IF( lk_vvl .AND. ( l_trdtra .OR. l_trddyn ) ) CALL ctl_stop( 'trend diagnostics with variable volume not validated' )94 93 95 94 !!gm : Potential BUG : 3D output only for vector invariant form! add a ctl_stop or code the flux form case -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRD/trdken.F90
r7960 r9987 27 27 USE lib_mpp ! MPP library 28 28 USE wrk_nemo ! Memory allocation 29 USE ldfslp ! Isopycnal slopes 29 30 30 31 IMPLICIT NONE … … 42 43 # include "domzgr_substitute.h90" 43 44 # include "vectopt_loop_substitute.h90" 45 # include "ldfeiv_substitute.h90" 46 44 47 !!---------------------------------------------------------------------- 45 48 !! NEMO/OPA 3.3 , NEMO Consortium (2010) … … 117 120 ! 118 121 SELECT CASE( ktrd ) 119 120 121 122 123 124 125 126 127 128 122 CASE( jpdyn_hpg ) ; CALL iom_put( "ketrd_hpg", zke ) ! hydrostatic pressure gradient 123 CASE( jpdyn_spg ) ; CALL iom_put( "ketrd_spg", zke ) ! surface pressure gradient 124 CASE( jpdyn_spgexp ); CALL iom_put( "ketrd_spgexp", zke ) ! surface pressure gradient (explicit) 125 CASE( jpdyn_spgflt ); CALL iom_put( "ketrd_spgflt", zke ) ! surface pressure gradient (filter) 126 CASE( jpdyn_pvo ) ; CALL iom_put( "ketrd_pvo", zke ) ! planetary vorticity 127 CASE( jpdyn_rvo ) ; CALL iom_put( "ketrd_rvo", zke ) ! relative vorticity (or metric term) 128 CASE( jpdyn_keg ) ; CALL iom_put( "ketrd_keg", zke ) ! Kinetic Energy gradient (or had) 129 CASE( jpdyn_zad ) ; CALL iom_put( "ketrd_zad", zke ) ! vertical advection 130 CASE( jpdyn_ldf ) ; CALL iom_put( "ketrd_ldf", zke ) ! lateral diffusion 131 CASE( jpdyn_zdf ) ; CALL iom_put( "ketrd_zdf", zke ) ! vertical diffusion 129 132 ! ! wind stress trends 130 131 132 133 134 135 136 137 138 139 140 141 142 133 CALL wrk_alloc( jpi, jpj, z2dx, z2dy, zke2d ) 134 z2dx(:,:) = un(:,:,1) * ( utau_b(:,:) + utau(:,:) ) * e1u(:,:) * e2u(:,:) * umask(:,:,1) 135 z2dy(:,:) = vn(:,:,1) * ( vtau_b(:,:) + vtau(:,:) ) * e1v(:,:) * e2v(:,:) * vmask(:,:,1) 136 zke2d(1,:) = 0._wp ; zke2d(:,1) = 0._wp 137 DO jj = 2, jpj 138 DO ji = 2, jpi 139 zke2d(ji,jj) = 0.5_wp * ( z2dx(ji,jj) + z2dx(ji-1,jj) & 140 & + z2dy(ji,jj) + z2dy(ji,jj-1) ) * r1_bt(ji,jj,1) 141 END DO 142 END DO 143 CALL iom_put( "ketrd_tau", zke2d ) 144 CALL wrk_dealloc( jpi, jpj , z2dx, z2dy, zke2d ) 145 CASE( jpdyn_bfr ) ; CALL iom_put( "ketrd_bfr", zke ) ! bottom friction (explicit case) 143 146 !!gm TO BE DONE properly 144 147 !!gm only valid if ln_bfrimp=F otherwise the bottom stress as to be recomputed at the end of the computation.... … … 162 165 ! ENDIF 163 166 !!gm end 164 167 CASE( jpdyn_atf ) ; CALL iom_put( "ketrd_atf", zke ) ! asselin filter trends 165 168 !! a faire !!!! idee changer dynnxt pour avoir un appel a jpdyn_bfr avant le swap !!! 166 169 !! reflechir a une possible sauvegarde du "vrai" un,vn pour le calcul de atf.... … … 184 187 ! CALL iom_put( "ketrd_bfri", zke2d ) 185 188 ! ENDIF 186 CASE( jpdyn_ken ) ; ! kinetic energy 187 ! called in dynnxt.F90 before asselin time filter 188 ! with putrd=ua and pvtrd=va 189 zke(:,:,:) = 0.5_wp * zke(:,:,:) 190 CALL iom_put( "KE", zke ) 191 ! 192 CALL ken_p2k( kt , zke ) 193 CALL iom_put( "ketrd_convP2K", zke ) ! conversion -rau*g*w 189 CASE( jpdyn_ken ) ; ! kinetic energy 190 ! called in dynnxt.F90 before asselin time filter 191 ! with putrd=ua and pvtrd=va 192 zke(:,:,:) = 0.5_wp * zke(:,:,:) 193 CALL iom_put( "KE", zke ) 194 ! 195 CALL ken_p2k( kt , zke ) 196 CALL iom_put( "ketrd_convP2K", zke ) ! conversion -rau*g*w 197 CASE( jpdyn_eivke ) 198 ! CMIP6 diagnostic tknebto = tendency of KE from 199 ! parameterized mesoscale eddy advection 200 ! = vertical_integral( k (N S)^2 ) rho dz 201 ! rho = reference density 202 ! S = isoneutral slope. 203 ! Most terms are on W grid so work on this grid 204 CALL wrk_alloc( jpi, jpj, zke2d ) 205 zke2d(:,:) = 0._wp 206 DO jk = 1,jpk 207 DO ji = 1,jpi 208 DO jj = 1,jpj 209 zke2d(ji,jj) = zke2d(ji,jj) + rau0 * fsaeiw(ji, jj, jk) & 210 & * ( wslpi(ji, jj, jk) * wslpi(ji,jj,jk) & 211 & + wslpj(ji, jj, jk) * wslpj(ji,jj,jk) ) & 212 & * rn2(ji,jj,jk) * fse3w(ji, jj, jk) 213 ENDDO 214 ENDDO 215 ENDDO 216 CALL iom_put("ketrd_eiv", zke2d) 217 CALL wrk_dealloc( jpi, jpj, zke2d ) 194 218 ! 195 219 END SELECT -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl.F90
r7960 r9987 165 165 166 166 167 168 167 SELECT CASE( ktrd ) 168 CASE( jptra_npc ) ! non-penetrative convection: regrouped with zdf 169 169 !!gm : to be completed ! 170 ! 170 ! IF( .... 171 171 !!gm end 172 173 172 CASE( jptra_zdfp ) ! iso-neutral diffusion: "pure" vertical diffusion 173 ! ! regroup iso-neutral diffusion in one term 174 174 tmltrd(:,:,jpmxl_ldf) = tmltrd(:,:,jpmxl_ldf) + ( tmltrd(:,:,jpmxl_zdf) - tmltrd(:,:,jpmxl_zdfp) ) 175 175 smltrd(:,:,jpmxl_ldf) = smltrd(:,:,jpmxl_ldf) + ( smltrd(:,:,jpmxl_zdf) - smltrd(:,:,jpmxl_zdfp) ) … … 811 811 812 812 813 813 nkstp = nit000 - 1 ! current time step indicator initialization 814 814 815 815 … … 851 851 IF( nn_ctls == 1 ) THEN 852 852 CALL ctl_opn( inum, 'ctlsurf_idx', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, lwp ) 853 READ ( inum ) nbol853 READ ( inum, * ) nbol 854 854 CLOSE( inum ) 855 855 END IF -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRD/trdmxl_oce.F90
r7960 r9987 15 15 16 16 ! !* mixed layer trend indices 17 INTEGER, PUBLIC, PARAMETER :: jpltrd = 1 1!: number of mixed-layer trends arrays17 INTEGER, PUBLIC, PARAMETER :: jpltrd = 12 !: number of mixed-layer trends arrays 18 18 INTEGER, PUBLIC :: jpktrd !: max level for mixed-layer trends diag. 19 19 ! … … 28 28 INTEGER, PUBLIC, PARAMETER :: jpmxl_for = 9 !: forcing 29 29 INTEGER, PUBLIC, PARAMETER :: jpmxl_dmp = 10 !: internal restoring trend 30 INTEGER, PUBLIC, PARAMETER :: jpmxl_zdfp = 11 !: asselin trend (**MUST BE THE LAST ONE**)31 INTEGER, PUBLIC, PARAMETER :: jpmxl_atf = 12 30 INTEGER, PUBLIC, PARAMETER :: jpmxl_zdfp = 11 !: iso-neutral diffusion:"pure" vertical diffusion 31 INTEGER, PUBLIC, PARAMETER :: jpmxl_atf = 12 !: asselin trend (**MUST BE THE LAST ONE**) 32 32 ! !!* Namelist namtrd_mxl: trend diagnostics in the mixed layer * 33 33 INTEGER , PUBLIC :: nn_ctls = 0 !: control surface type for trends vertical integration -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRD/trdpen.F90
r7960 r9987 99 99 CALL wrk_alloc( jpi, jpj, z2d ) 100 100 z2d(:,:) = wn(:,:,1) * ( & 101 102 103 &) / fse3t(:,:,1)101 & - ( rab_n(:,:,1,jp_tem) + rab_pe(:,:,1,jp_tem) ) * tsn(:,:,1,jp_tem) & 102 & + ( rab_n(:,:,1,jp_sal) + rab_pe(:,:,1,jp_sal) ) * tsn(:,:,1,jp_sal) & 103 & ) / fse3t(:,:,1) 104 104 CALL iom_put( "petrd_sad" , z2d ) 105 105 CALL wrk_dealloc( jpi, jpj, z2d ) … … 150 150 rab_pe(:,:,:,:) = 0._wp 151 151 ! 152 IF ( lk_vvl ) CALL ctl_stop('trd_pen_init : PE trends not coded for variable volume')152 ! IF ( lk_vvl ) CALL ctl_stop('trd_pen_init : PE trends not coded for variable volume') 153 153 ! 154 154 nkstp = nit000 - 1 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90
r7960 r9987 38 38 REAL(wp) :: r2dt ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0 39 39 40 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: trdtx, trdty, trdt ! use to store the temperature trends 40 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: trdtx, trdty, trdt ! use to store the temperature trends 41 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: avt_evd ! store avt_evd to calculate EVD trend 41 42 42 43 !! * Substitutions … … 55 56 !! *** FUNCTION trd_tra_alloc *** 56 57 !!--------------------------------------------------------------------- 57 ALLOCATE( trdtx(jpi,jpj,jpk) , trdty(jpi,jpj,jpk) , trdt(jpi,jpj,jpk) , STAT= trd_tra_alloc )58 ALLOCATE( trdtx(jpi,jpj,jpk) , trdty(jpi,jpj,jpk) , trdt(jpi,jpj,jpk) , avt_evd(jpi,jpj,jpk), STAT= trd_tra_alloc ) 58 59 ! 59 60 IF( lk_mpp ) CALL mpp_sum ( trd_tra_alloc ) … … 104 105 ztrds(:,:,:) = 0._wp 105 106 CALL trd_tra_mng( trdt, ztrds, ktrd, kt ) 107 CASE( jptra_evd ) ; avt_evd(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) 106 108 CASE DEFAULT ! other trends: masked trends 107 109 trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) ! mask & store … … 128 130 zwt(:,:,jpk) = 0._wp ; zws(:,:,jpk) = 0._wp 129 131 DO jk = 2, jpk 130 zwt(:,:,jk) = 132 zwt(:,:,jk) = avt(:,:,jk) * ( tsa(:,:,jk-1,jp_tem) - tsa(:,:,jk,jp_tem) ) / fse3w(:,:,jk) * tmask(:,:,jk) 131 133 zws(:,:,jk) = fsavs(:,:,jk) * ( tsa(:,:,jk-1,jp_sal) - tsa(:,:,jk,jp_sal) ) / fse3w(:,:,jk) * tmask(:,:,jk) 132 134 END DO … … 138 140 END DO 139 141 CALL trd_tra_mng( ztrdt, ztrds, jptra_zdfp, kt ) 142 ! 143 ! ! Also calculate EVD trend at this point. 144 zwt(:,:,:) = 0._wp ; zws(:,:,:) = 0._wp ! vertical diffusive fluxes 145 DO jk = 2, jpk 146 zwt(:,:,jk) = avt_evd(:,:,jk) * ( tsa(:,:,jk-1,jp_tem) - tsa(:,:,jk,jp_tem) ) / fse3w(:,:,jk) * tmask(:,:,jk) 147 zws(:,:,jk) = avt_evd(:,:,jk) * ( tsa(:,:,jk-1,jp_sal) - tsa(:,:,jk,jp_sal) ) / fse3w(:,:,jk) * tmask(:,:,jk) 148 END DO 149 ! 150 ztrdt(:,:,jpk) = 0._wp ; ztrds(:,:,jpk) = 0._wp 151 DO jk = 1, jpkm1 152 ztrdt(:,:,jk) = ( zwt(:,:,jk) - zwt(:,:,jk+1) ) / fse3t(:,:,jk) 153 ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / fse3t(:,:,jk) 154 END DO 155 CALL trd_tra_mng( ztrdt, ztrds, jptra_evd, kt ) 140 156 ! 141 157 CALL wrk_dealloc( jpi, jpj, jpk, zwt, zws, ztrdt ) … … 285 301 !! ** Purpose : output 3D tracer trends using IOM 286 302 !!---------------------------------------------------------------------- 287 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdx ! Temperature or U trend 288 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdy ! Salinity or V trend 289 INTEGER , INTENT(in ) :: ktrd ! tracer trend index 290 INTEGER , INTENT(in ) :: kt ! time step 291 !! 292 INTEGER :: ji, jj, jk ! dummy loop indices 293 INTEGER :: ikbu, ikbv ! local integers 294 REAL(wp), POINTER, DIMENSION(:,:) :: z2dx, z2dy ! 2D workspace 295 !!---------------------------------------------------------------------- 296 ! 297 !!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added 298 ! 299 SELECT CASE( ktrd ) 300 CASE( jptra_xad ) ; CALL iom_put( "ttrd_xad" , ptrdx ) ! x- horizontal advection 301 CALL iom_put( "strd_xad" , ptrdy ) 302 CASE( jptra_yad ) ; CALL iom_put( "ttrd_yad" , ptrdx ) ! y- horizontal advection 303 CALL iom_put( "strd_yad" , ptrdy ) 304 CASE( jptra_zad ) ; CALL iom_put( "ttrd_zad" , ptrdx ) ! z- vertical advection 305 CALL iom_put( "strd_zad" , ptrdy ) 306 IF( .NOT. lk_vvl ) THEN ! cst volume : adv flux through z=0 surface 307 CALL wrk_alloc( jpi, jpj, z2dx, z2dy ) 308 z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / fse3t(:,:,1) 309 z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / fse3t(:,:,1) 310 CALL iom_put( "ttrd_sad", z2dx ) 311 CALL iom_put( "strd_sad", z2dy ) 312 CALL wrk_dealloc( jpi, jpj, z2dx, z2dy ) 313 ENDIF 314 CASE( jptra_ldf ) ; CALL iom_put( "ttrd_ldf" , ptrdx ) ! lateral diffusion 315 CALL iom_put( "strd_ldf" , ptrdy ) 316 CASE( jptra_zdf ) ; CALL iom_put( "ttrd_zdf" , ptrdx ) ! vertical diffusion (including Kz contribution) 317 CALL iom_put( "strd_zdf" , ptrdy ) 318 CASE( jptra_zdfp ) ; CALL iom_put( "ttrd_zdfp", ptrdx ) ! PURE vertical diffusion (no isoneutral contribution) 319 CALL iom_put( "strd_zdfp", ptrdy ) 320 CASE( jptra_dmp ) ; CALL iom_put( "ttrd_dmp" , ptrdx ) ! internal restoring (damping) 321 CALL iom_put( "strd_dmp" , ptrdy ) 322 CASE( jptra_bbl ) ; CALL iom_put( "ttrd_bbl" , ptrdx ) ! bottom boundary layer 323 CALL iom_put( "strd_bbl" , ptrdy ) 324 CASE( jptra_npc ) ; CALL iom_put( "ttrd_npc" , ptrdx ) ! static instability mixing 325 CALL iom_put( "strd_npc" , ptrdy ) 326 CASE( jptra_nsr ) ; CALL iom_put( "ttrd_qns" , ptrdx ) ! surface forcing + runoff (ln_rnf=T) 327 CALL iom_put( "strd_cdt" , ptrdy ) 328 CASE( jptra_qsr ) ; CALL iom_put( "ttrd_qsr" , ptrdx ) ! penetrative solar radiat. (only on temperature) 329 CASE( jptra_bbc ) ; CALL iom_put( "ttrd_bbc" , ptrdx ) ! geothermal heating (only on temperature) 330 CASE( jptra_atf ) ; CALL iom_put( "ttrd_atf" , ptrdx ) ! asselin time Filter 331 CALL iom_put( "strd_atf" , ptrdy ) 332 END SELECT 333 ! 303 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdx ! Temperature or U trend 304 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdy ! Salinity or V trend 305 INTEGER , INTENT(in ) :: ktrd ! tracer trend index 306 INTEGER , INTENT(in ) :: kt ! time step 307 !! 308 INTEGER :: ji, jj, jk ! dummy loop indices 309 INTEGER :: ikbu, ikbv ! local integers 310 REAL(wp), POINTER, DIMENSION(:,:) :: z2dx, z2dy ! 2D workspace 311 !!---------------------------------------------------------------------- 312 ! 313 !!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added 314 ! 315 ! Trends evaluated every time step that could go to the standard T file and can be output every ts into a 1ts file if 1ts output is selected 316 SELECT CASE( ktrd ) 317 ! This total trend is done every time step 318 CASE( jptra_tot ) ; CALL iom_put( "ttrd_tot" , ptrdx ) ! model total trend 319 CALL iom_put( "strd_tot" , ptrdy ) 320 END SELECT 321 322 ! These trends are done every second time step. When 1ts output is selected must go different (2ts) file from standard T-file 323 IF( MOD( kt, 2 ) == 0 ) THEN 324 SELECT CASE( ktrd ) 325 CASE( jptra_xad ) ; CALL iom_put( "ttrd_xad" , ptrdx ) ! x- horizontal advection 326 CALL iom_put( "strd_xad" , ptrdy ) 327 CASE( jptra_yad ) ; CALL iom_put( "ttrd_yad" , ptrdx ) ! y- horizontal advection 328 CALL iom_put( "strd_yad" , ptrdy ) 329 CASE( jptra_zad ) ; CALL iom_put( "ttrd_zad" , ptrdx ) ! z- vertical advection 330 CALL iom_put( "strd_zad" , ptrdy ) 331 IF( .NOT. lk_vvl ) THEN ! cst volume : adv flux through z=0 surface 332 CALL wrk_alloc( jpi, jpj, z2dx, z2dy ) 333 z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / fse3t(:,:,1) 334 z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / fse3t(:,:,1) 335 CALL iom_put( "ttrd_sad", z2dx ) 336 CALL iom_put( "strd_sad", z2dy ) 337 CALL wrk_dealloc( jpi, jpj, z2dx, z2dy ) 338 ENDIF 339 CASE( jptra_totad ) ; CALL iom_put( "ttrd_totad" , ptrdx ) ! total advection 340 CALL iom_put( "strd_totad" , ptrdy ) 341 CASE( jptra_ldf ) ; CALL iom_put( "ttrd_ldf" , ptrdx ) ! lateral diffusion 342 CALL iom_put( "strd_ldf" , ptrdy ) 343 CASE( jptra_zdf ) ; CALL iom_put( "ttrd_zdf" , ptrdx ) ! vertical diffusion (including Kz contribution) 344 CALL iom_put( "strd_zdf" , ptrdy ) 345 CASE( jptra_zdfp ) ; CALL iom_put( "ttrd_zdfp", ptrdx ) ! PURE vertical diffusion (no isoneutral contribution) 346 CALL iom_put( "strd_zdfp", ptrdy ) 347 CASE( jptra_evd ) ; CALL iom_put( "ttrd_evd", ptrdx ) ! EVD trend (convection) 348 CALL iom_put( "strd_evd", ptrdy ) 349 CASE( jptra_dmp ) ; CALL iom_put( "ttrd_dmp" , ptrdx ) ! internal restoring (damping) 350 CALL iom_put( "strd_dmp" , ptrdy ) 351 CASE( jptra_bbl ) ; CALL iom_put( "ttrd_bbl" , ptrdx ) ! bottom boundary layer 352 CALL iom_put( "strd_bbl" , ptrdy ) 353 CASE( jptra_npc ) ; CALL iom_put( "ttrd_npc" , ptrdx ) ! static instability mixing 354 CALL iom_put( "strd_npc" , ptrdy ) 355 CASE( jptra_bbc ) ; CALL iom_put( "ttrd_bbc" , ptrdx ) ! geothermal heating (only on temperature) 356 CASE( jptra_nsr ) ; CALL iom_put( "ttrd_qns" , ptrdx(:,:,1) ) ! surface forcing + runoff (ln_rnf=T) 357 CALL iom_put( "strd_cdt" , ptrdy(:,:,1) ) ! output as 2D surface fields 358 CASE( jptra_qsr ) ; CALL iom_put( "ttrd_qsr" , ptrdx ) ! penetrative solar radiat. (only on temperature) 359 END SELECT 360 ! the Asselin filter trend is also every other time step but needs to be lagged one time step 361 ! Even when 1ts output is selected can go to the same (2ts) file as the trends plotted every even time step. 362 ELSE IF( MOD( kt, 2 ) == 1 ) THEN 363 SELECT CASE( ktrd ) 364 CASE( jptra_atf ) ; CALL iom_put( "ttrd_atf" , ptrdx ) ! asselin time Filter 365 CALL iom_put( "strd_atf" , ptrdy ) 366 END SELECT 367 END IF 368 ! 334 369 END SUBROUTINE trd_tra_iom 335 370 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/TRD/trdtrc.F90
r7960 r9987 1 #if ! defined key_top 1 2 MODULE trdtrc 2 3 !!====================================================================== … … 22 23 !!====================================================================== 23 24 END MODULE trdtrc 25 #endif -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfddm.F90
r7960 r9987 177 177 & + 0.15 * zrau(ji,jj) * zmskd2(ji,jj) ) 178 178 ! add to the eddy viscosity coef. previously computed 179 # if defined key_zdftmx_new 180 ! key_zdftmx_new: New internal wave-driven param: use avs value computed by zdftmx 181 avs (ji,jj,jk) = avs(ji,jj,jk) + zavfs + zavds 182 # else 179 183 avs (ji,jj,jk) = avt(ji,jj,jk) + zavfs + zavds 184 # endif 180 185 avt (ji,jj,jk) = avt(ji,jj,jk) + zavft + zavdt 181 186 avm (ji,jj,jk) = avm(ji,jj,jk) + MAX( zavft + zavdt, zavfs + zavds ) -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfevd.F90
r7960 r9987 19 19 USE zdf_oce ! ocean vertical physics variables 20 20 USE zdfkpp ! KPP vertical mixing 21 USE trd_oce ! trends: ocean variables 22 USE trdtra ! trends manager: tracers 21 23 USE in_out_manager ! I/O manager 22 24 USE iom ! for iom_put … … 122 124 zavt_evd(:,:,:) = avt(:,:,:) - zavt_evd(:,:,:) ! change in avt due to evd 123 125 CALL iom_put( "avt_evd", zavt_evd ) ! output this change 126 IF( l_trdtra ) CALL trd_tra( kt, 'TRA', jp_tem, jptra_evd, zavt_evd ) 124 127 ! 125 128 IF( nn_timing == 1 ) CALL timing_stop('zdf_evd') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfmxl.F90
r7960 r9987 18 18 USE phycst ! physical constants 19 19 USE iom ! I/O library 20 USE eosbn2 ! for zdf_mxl_zint 20 21 USE lib_mpp ! MPP library 21 22 USE wrk_nemo ! work arrays … … 27 28 28 29 PUBLIC zdf_mxl ! called by step.F90 30 PUBLIC zdf_mxl_alloc ! Used in zdf_tke_init 29 31 30 32 INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nmln !: number of level in the mixed layer (used by TOP) … … 32 34 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hmlp !: mixed layer depth (rho=rho0+zdcrit) [m] 33 35 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hmlpt !: mixed layer depth at t-points [m] 36 REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:) :: hmld_zint !: vertically-interpolated mixed layer depth [m] 37 REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:) :: htc_mld ! Heat content of hmld_zint 38 LOGICAL, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ll_found ! Is T_b to be found by interpolation ? 39 LOGICAL, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ll_belowml ! Flag points below mixed layer when ll_found=F 34 40 35 41 REAL(wp), PUBLIC :: rho_c = 0.01_wp !: density criterion for mixed layer depth 36 42 REAL(wp) :: avt_c = 5.e-4_wp ! Kz criterion for the turbocline depth 43 44 TYPE, PUBLIC :: MXL_ZINT !: Structure for MLD defs 45 INTEGER :: mld_type ! mixed layer type 46 REAL(wp) :: zref ! depth of initial T_ref 47 REAL(wp) :: dT_crit ! Critical temp diff 48 REAL(wp) :: iso_frac ! Fraction of rn_dT_crit used 49 END TYPE MXL_ZINT 37 50 38 51 !! * Substitutions … … 51 64 zdf_mxl_alloc = 0 ! set to zero if no array to be allocated 52 65 IF( .NOT. ALLOCATED( nmln ) ) THEN 53 ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), STAT= zdf_mxl_alloc ) 66 ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), hmld_zint(jpi,jpj), & 67 & htc_mld(jpi,jpj), & 68 & ll_found(jpi,jpj), ll_belowml(jpi,jpj,jpk), STAT= zdf_mxl_alloc ) 54 69 ! 55 70 IF( lk_mpp ) CALL mpp_sum ( zdf_mxl_alloc ) … … 79 94 INTEGER, INTENT(in) :: kt ! ocean time-step index 80 95 ! 81 INTEGER :: ji, jj, jk ! dummy loop indices82 INTEGER :: iikn, iiki, ikt , imkt! local integer83 REAL(wp) :: zN2_c ! local scalar96 INTEGER :: ji, jj, jk ! dummy loop indices 97 INTEGER :: iikn, iiki, ikt ! local integer 98 REAL(wp) :: zN2_c ! local scalar 84 99 INTEGER, POINTER, DIMENSION(:,:) :: imld ! 2D workspace 85 100 !!---------------------------------------------------------------------- … … 89 104 CALL wrk_alloc( jpi,jpj, imld ) 90 105 91 IF( kt == nit000 ) THEN106 IF( kt <= nit000 ) THEN 92 107 IF(lwp) WRITE(numout,*) 93 108 IF(lwp) WRITE(numout,*) 'zdf_mxl : mixed layer depth' … … 116 131 DO jj = 1, jpj 117 132 DO ji = 1, jpi 118 imkt = mikt(ji,jj) 119 IF( avt (ji,jj,jk) < avt_c ) imld(ji,jj) = MAX( imkt, jk ) ! Turbocline 133 IF( avt (ji,jj,jk) < avt_c * wmask(ji,jj,jk) ) imld(ji,jj) = jk ! Turbocline 120 134 END DO 121 135 END DO … … 126 140 iiki = imld(ji,jj) 127 141 iikn = nmln(ji,jj) 128 imkt = mikt(ji,jj) 129 hmld (ji,jj) = ( fsdepw(ji,jj,iiki ) - fsdepw(ji,jj,imkt ) ) * ssmask(ji,jj) ! Turbocline depth 130 hmlp (ji,jj) = ( fsdepw(ji,jj,iikn ) - fsdepw(ji,jj,MAX( imkt,nla10 ) ) ) * ssmask(ji,jj) ! Mixed layer depth 131 hmlpt(ji,jj) = ( fsdept(ji,jj,iikn-1) - fsdepw(ji,jj,imkt ) ) * ssmask(ji,jj) ! depth of the last T-point inside the mixed layer 142 hmld (ji,jj) = fsdepw(ji,jj,iiki ) * ssmask(ji,jj) ! Turbocline depth 143 hmlp (ji,jj) = fsdepw(ji,jj,iikn ) * ssmask(ji,jj) ! Mixed layer depth 144 hmlpt(ji,jj) = fsdept(ji,jj,iikn-1) * ssmask(ji,jj) ! depth of the last T-point inside the mixed layer 132 145 END DO 133 146 END DO 134 IF( .NOT.lk_offline ) THEN ! no need to output in offline mode 135 CALL iom_put( "mldr10_1", hmlp ) ! mixed layer depth 136 CALL iom_put( "mldkz5" , hmld ) ! turbocline depth 147 ! no need to output in offline mode 148 IF( .NOT.lk_offline ) THEN 149 IF ( iom_use("mldr10_1") ) THEN 150 IF( ln_isfcav ) THEN 151 CALL iom_put( "mldr10_1", hmlp - risfdep) ! mixed layer thickness 152 ELSE 153 CALL iom_put( "mldr10_1", hmlp ) ! mixed layer depth 154 END IF 155 END IF 156 IF ( iom_use("mldkz5") ) THEN 157 IF( ln_isfcav ) THEN 158 CALL iom_put( "mldkz5" , hmld - risfdep ) ! turbocline thickness 159 ELSE 160 CALL iom_put( "mldkz5" , hmld ) ! turbocline depth 161 END IF 162 END IF 137 163 ENDIF 138 164 165 ! Vertically-interpolated mixed-layer depth diagnostic 166 CALL zdf_mxl_zint( kt ) 167 139 168 IF(ln_ctl) CALL prt_ctl( tab2d_1=REAL(nmln,wp), clinfo1=' nmln : ', tab2d_2=hmlp, clinfo2=' hmlp : ', ovlap=1 ) 140 169 ! … … 144 173 ! 145 174 END SUBROUTINE zdf_mxl 175 176 SUBROUTINE zdf_mxl_zint_mld( sf ) 177 !!---------------------------------------------------------------------------------- 178 !! *** ROUTINE zdf_mxl_zint_mld *** 179 ! 180 ! Calculate vertically-interpolated mixed layer depth diagnostic. 181 ! 182 ! This routine can calculate the mixed layer depth diagnostic suggested by 183 ! Kara et al, 2000, JGR, 105, 16803, but is more general and can calculate 184 ! vertically-interpolated mixed-layer depth diagnostics with other parameter 185 ! settings set in the namzdf_mldzint namelist. 186 ! 187 ! If mld_type=1 the mixed layer depth is calculated as the depth at which the 188 ! density has increased by an amount equivalent to a temperature difference of 189 ! 0.8C at the surface. 190 ! 191 ! For other values of mld_type the mixed layer is calculated as the depth at 192 ! which the temperature differs by 0.8C from the surface temperature. 193 ! 194 ! David Acreman, Daley Calvert 195 ! 196 !!----------------------------------------------------------------------------------- 197 198 TYPE(MXL_ZINT), INTENT(in) :: sf 199 200 ! Diagnostic criteria 201 INTEGER :: nn_mld_type ! mixed layer type 202 REAL(wp) :: rn_zref ! depth of initial T_ref 203 REAL(wp) :: rn_dT_crit ! Critical temp diff 204 REAL(wp) :: rn_iso_frac ! Fraction of rn_dT_crit used 205 206 ! Local variables 207 REAL(wp), PARAMETER :: zepsilon = 1.e-30 ! local small value 208 INTEGER, POINTER, DIMENSION(:,:) :: ikmt ! number of active tracer levels 209 INTEGER, POINTER, DIMENSION(:,:) :: ik_ref ! index of reference level 210 INTEGER, POINTER, DIMENSION(:,:) :: ik_iso ! index of last uniform temp level 211 REAL, POINTER, DIMENSION(:,:,:) :: zT ! Temperature or density 212 REAL, POINTER, DIMENSION(:,:) :: ppzdep ! depth for use in calculating d(rho) 213 REAL, POINTER, DIMENSION(:,:) :: zT_ref ! reference temperature 214 REAL :: zT_b ! base temperature 215 REAL, POINTER, DIMENSION(:,:,:) :: zdTdz ! gradient of zT 216 REAL, POINTER, DIMENSION(:,:,:) :: zmoddT ! Absolute temperature difference 217 REAL :: zdz ! depth difference 218 REAL :: zdT ! temperature difference 219 REAL, POINTER, DIMENSION(:,:) :: zdelta_T ! difference critereon 220 REAL, POINTER, DIMENSION(:,:) :: zRHO1, zRHO2 ! Densities 221 INTEGER :: ji, jj, jk ! loop counter 222 223 !!------------------------------------------------------------------------------------- 224 ! 225 CALL wrk_alloc( jpi, jpj, ikmt, ik_ref, ik_iso) 226 CALL wrk_alloc( jpi, jpj, ppzdep, zT_ref, zdelta_T, zRHO1, zRHO2 ) 227 CALL wrk_alloc( jpi, jpj, jpk, zT, zdTdz, zmoddT ) 228 229 ! Unpack structure 230 nn_mld_type = sf%mld_type 231 rn_zref = sf%zref 232 rn_dT_crit = sf%dT_crit 233 rn_iso_frac = sf%iso_frac 234 235 ! Set the mixed layer depth criterion at each grid point 236 IF( nn_mld_type == 0 ) THEN 237 zdelta_T(:,:) = rn_dT_crit 238 zT(:,:,:) = rhop(:,:,:) 239 ELSE IF( nn_mld_type == 1 ) THEN 240 ppzdep(:,:)=0.0 241 call eos ( tsn(:,:,1,:), ppzdep(:,:), zRHO1(:,:) ) 242 ! Use zT temporarily as a copy of tsn with rn_dT_crit added to SST 243 ! [assumes number of tracers less than number of vertical levels] 244 zT(:,:,1:jpts)=tsn(:,:,1,1:jpts) 245 zT(:,:,jp_tem)=zT(:,:,1)+rn_dT_crit 246 CALL eos( zT(:,:,1:jpts), ppzdep(:,:), zRHO2(:,:) ) 247 zdelta_T(:,:) = abs( zRHO1(:,:) - zRHO2(:,:) ) * rau0 248 ! RHO from eos (2d version) doesn't calculate north or east halo: 249 CALL lbc_lnk( zdelta_T, 'T', 1. ) 250 zT(:,:,:) = rhop(:,:,:) 251 ELSE 252 zdelta_T(:,:) = rn_dT_crit 253 zT(:,:,:) = tsn(:,:,:,jp_tem) 254 END IF 255 256 ! Calculate the gradient of zT and absolute difference for use later 257 DO jk = 1 ,jpk-2 258 zdTdz(:,:,jk) = ( zT(:,:,jk+1) - zT(:,:,jk) ) / fse3w(:,:,jk+1) 259 zmoddT(:,:,jk) = abs( zT(:,:,jk+1) - zT(:,:,jk) ) 260 END DO 261 262 ! Find density/temperature at the reference level (Kara et al use 10m). 263 ! ik_ref is the index of the box centre immediately above or at the reference level 264 ! Find rn_zref in the array of model level depths and find the ref 265 ! density/temperature by linear interpolation. 266 DO jk = jpkm1, 2, -1 267 WHERE ( fsdept(:,:,jk) > rn_zref ) 268 ik_ref(:,:) = jk - 1 269 zT_ref(:,:) = zT(:,:,jk-1) + zdTdz(:,:,jk-1) * ( rn_zref - fsdept(:,:,jk-1) ) 270 END WHERE 271 END DO 272 273 ! If the first grid box centre is below the reference level then use the 274 ! top model level to get zT_ref 275 WHERE ( fsdept(:,:,1) > rn_zref ) 276 zT_ref = zT(:,:,1) 277 ik_ref = 1 278 END WHERE 279 280 ! The number of active tracer levels is 1 less than the number of active w levels 281 ikmt(:,:) = mbathy(:,:) - 1 282 283 ! Initialize / reset 284 ll_found(:,:) = .false. 285 286 IF ( rn_iso_frac - zepsilon > 0. ) THEN 287 ! Search for a uniform density/temperature region where adjacent levels 288 ! differ by less than rn_iso_frac * deltaT. 289 ! ik_iso is the index of the last level in the uniform layer 290 ! ll_found indicates whether the mixed layer depth can be found by interpolation 291 ik_iso(:,:) = ik_ref(:,:) 292 DO jj = 1, nlcj 293 DO ji = 1, nlci 294 !CDIR NOVECTOR 295 DO jk = ik_ref(ji,jj), ikmt(ji,jj)-1 296 IF ( zmoddT(ji,jj,jk) > ( rn_iso_frac * zdelta_T(ji,jj) ) ) THEN 297 ik_iso(ji,jj) = jk 298 ll_found(ji,jj) = ( zmoddT(ji,jj,jk) > zdelta_T(ji,jj) ) 299 EXIT 300 END IF 301 END DO 302 END DO 303 END DO 304 305 ! Use linear interpolation to find depth of mixed layer base where possible 306 hmld_zint(:,:) = rn_zref 307 DO jj = 1, jpj 308 DO ji = 1, jpi 309 IF (ll_found(ji,jj) .and. tmask(ji,jj,1) == 1.0) THEN 310 zdz = abs( zdelta_T(ji,jj) / zdTdz(ji,jj,ik_iso(ji,jj)) ) 311 hmld_zint(ji,jj) = fsdept(ji,jj,ik_iso(ji,jj)) + zdz 312 END IF 313 END DO 314 END DO 315 END IF 316 317 ! If ll_found = .false. then calculate MLD using difference of zdelta_T 318 ! from the reference density/temperature 319 320 ! Prevent this section from working on land points 321 WHERE ( tmask(:,:,1) /= 1.0 ) 322 ll_found = .true. 323 END WHERE 324 325 DO jk=1, jpk 326 ll_belowml(:,:,jk) = abs( zT(:,:,jk) - zT_ref(:,:) ) >= zdelta_T(:,:) 327 END DO 328 329 ! Set default value where interpolation cannot be used (ll_found=false) 330 DO jj = 1, jpj 331 DO ji = 1, jpi 332 IF ( .not. ll_found(ji,jj) ) hmld_zint(ji,jj) = fsdept(ji,jj,ikmt(ji,jj)) 333 END DO 334 END DO 335 336 DO jj = 1, jpj 337 DO ji = 1, jpi 338 !CDIR NOVECTOR 339 DO jk = ik_ref(ji,jj)+1, ikmt(ji,jj) 340 IF ( ll_found(ji,jj) ) EXIT 341 IF ( ll_belowml(ji,jj,jk) ) THEN 342 zT_b = zT_ref(ji,jj) + zdelta_T(ji,jj) * SIGN(1.0, zdTdz(ji,jj,jk-1) ) 343 zdT = zT_b - zT(ji,jj,jk-1) 344 zdz = zdT / zdTdz(ji,jj,jk-1) 345 hmld_zint(ji,jj) = fsdept(ji,jj,jk-1) + zdz 346 EXIT 347 END IF 348 END DO 349 END DO 350 END DO 351 352 hmld_zint(:,:) = hmld_zint(:,:)*tmask(:,:,1) 353 ! 354 CALL wrk_dealloc( jpi, jpj, ikmt, ik_ref, ik_iso) 355 CALL wrk_dealloc( jpi, jpj, ppzdep, zT_ref, zdelta_T, zRHO1, zRHO2 ) 356 CALL wrk_dealloc( jpi,jpj, jpk, zT, zdTdz, zmoddT ) 357 ! 358 END SUBROUTINE zdf_mxl_zint_mld 359 360 SUBROUTINE zdf_mxl_zint_htc( kt ) 361 !!---------------------------------------------------------------------- 362 !! *** ROUTINE zdf_mxl_zint_htc *** 363 !! 364 !! ** Purpose : 365 !! 366 !! ** Method : 367 !!---------------------------------------------------------------------- 368 369 INTEGER, INTENT(in) :: kt ! ocean time-step index 370 371 INTEGER :: ji, jj, jk 372 INTEGER :: ikmax 373 REAL(wp) :: zc, zcoef 374 ! 375 INTEGER, ALLOCATABLE, DIMENSION(:,:) :: ilevel 376 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zthick_0, zthick 377 378 !!---------------------------------------------------------------------- 379 380 IF( .NOT. ALLOCATED(ilevel) ) THEN 381 ALLOCATE( ilevel(jpi,jpj), zthick_0(jpi,jpj), & 382 & zthick(jpi,jpj), STAT=ji ) 383 IF( lk_mpp ) CALL mpp_sum(ji) 384 IF( ji /= 0 ) CALL ctl_stop( 'STOP', 'zdf_mxl_zint_htc : unable to allocate arrays' ) 385 ENDIF 386 387 ! Find last whole model T level above the MLD 388 ilevel(:,:) = 0 389 zthick_0(:,:) = 0._wp 390 391 DO jk = 1, jpkm1 392 DO jj = 1, jpj 393 DO ji = 1, jpi 394 zthick_0(ji,jj) = zthick_0(ji,jj) + fse3t(ji,jj,jk) 395 IF( zthick_0(ji,jj) < hmld_zint(ji,jj) ) ilevel(ji,jj) = jk 396 END DO 397 END DO 398 WRITE(numout,*) 'zthick_0(jk =',jk,') =',zthick_0(2,2) 399 WRITE(numout,*) 'fsdepw(jk+1 =',jk+1,') =',fsdepw(2,2,jk+1) 400 END DO 401 402 ! Surface boundary condition 403 IF( lk_vvl ) THEN ; zthick(:,:) = 0._wp ; htc_mld(:,:) = 0._wp 404 ELSE ; zthick(:,:) = sshn(:,:) ; htc_mld(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:) * tmask(:,:,1) 405 ENDIF 406 407 ! Deepest whole T level above the MLD 408 ikmax = MIN( MAXVAL( ilevel(:,:) ), jpkm1 ) 409 410 ! Integration down to last whole model T level 411 DO jk = 1, ikmax 412 DO jj = 1, jpj 413 DO ji = 1, jpi 414 zc = fse3t(ji,jj,jk) * REAL( MIN( MAX( 0, ilevel(ji,jj) - jk + 1 ) , 1 ) ) ! 0 below ilevel 415 zthick(ji,jj) = zthick(ji,jj) + zc 416 htc_mld(ji,jj) = htc_mld(ji,jj) + zc * tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk) 417 END DO 418 END DO 419 END DO 420 421 ! Subsequent partial T level 422 zthick(:,:) = hmld_zint(:,:) - zthick(:,:) ! remaining thickness to reach MLD 423 424 DO jj = 1, jpj 425 DO ji = 1, jpi 426 htc_mld(ji,jj) = htc_mld(ji,jj) + tsn(ji,jj,ilevel(ji,jj)+1,jp_tem) & 427 & * MIN( fse3t(ji,jj,ilevel(ji,jj)+1), zthick(ji,jj) ) * tmask(ji,jj,ilevel(ji,jj)+1) 428 END DO 429 END DO 430 431 WRITE(numout,*) 'htc_mld(after) =',htc_mld(2,2) 432 433 ! Convert to heat content 434 zcoef = rau0 * rcp 435 htc_mld(:,:) = zcoef * htc_mld(:,:) 436 437 END SUBROUTINE zdf_mxl_zint_htc 438 439 SUBROUTINE zdf_mxl_zint( kt ) 440 !!---------------------------------------------------------------------- 441 !! *** ROUTINE zdf_mxl_zint *** 442 !! 443 !! ** Purpose : 444 !! 445 !! ** Method : 446 !!---------------------------------------------------------------------- 447 448 INTEGER, INTENT(in) :: kt ! ocean time-step index 449 450 INTEGER :: ios 451 INTEGER :: jn 452 453 INTEGER :: nn_mld_diag = 0 ! number of diagnostics 454 455 CHARACTER(len=1) :: cmld 456 457 TYPE(MXL_ZINT) :: sn_mld1, sn_mld2, sn_mld3, sn_mld4, sn_mld5 458 TYPE(MXL_ZINT), SAVE, DIMENSION(5) :: mld_diags 459 460 NAMELIST/namzdf_mldzint/ nn_mld_diag, sn_mld1, sn_mld2, sn_mld3, sn_mld4, sn_mld5 461 462 !!---------------------------------------------------------------------- 463 464 IF( kt == nit000 ) THEN 465 REWIND( numnam_ref ) ! Namelist namzdf_mldzint in reference namelist 466 READ ( numnam_ref, namzdf_mldzint, IOSTAT = ios, ERR = 901) 467 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_mldzint in reference namelist', lwp ) 468 469 REWIND( numnam_cfg ) ! Namelist namzdf_mldzint in configuration namelist 470 READ ( numnam_cfg, namzdf_mldzint, IOSTAT = ios, ERR = 902 ) 471 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_mldzint in configuration namelist', lwp ) 472 IF(lwm) WRITE ( numond, namzdf_mldzint ) 473 474 IF( nn_mld_diag > 5 ) CALL ctl_stop( 'STOP', 'zdf_mxl_ini: Specify no more than 5 MLD definitions' ) 475 476 mld_diags(1) = sn_mld1 477 mld_diags(2) = sn_mld2 478 mld_diags(3) = sn_mld3 479 mld_diags(4) = sn_mld4 480 mld_diags(5) = sn_mld5 481 482 IF( lwp .AND. (nn_mld_diag > 0) ) THEN 483 WRITE(numout,*) '=============== Vertically-interpolated mixed layer ================' 484 WRITE(numout,*) '(Diagnostic number, nn_mld_type, rn_zref, rn_dT_crit, rn_iso_frac)' 485 DO jn = 1, nn_mld_diag 486 WRITE(numout,*) 'MLD criterion',jn,':' 487 WRITE(numout,*) ' nn_mld_type =', mld_diags(jn)%mld_type 488 WRITE(numout,*) ' rn_zref =' , mld_diags(jn)%zref 489 WRITE(numout,*) ' rn_dT_crit =' , mld_diags(jn)%dT_crit 490 WRITE(numout,*) ' rn_iso_frac =', mld_diags(jn)%iso_frac 491 END DO 492 WRITE(numout,*) '====================================================================' 493 ENDIF 494 ENDIF 495 496 IF( nn_mld_diag > 0 ) THEN 497 DO jn = 1, nn_mld_diag 498 WRITE(cmld,'(I1)') jn 499 IF( iom_use( "mldzint_"//cmld ) .OR. iom_use( "mldhtc_"//cmld ) ) THEN 500 CALL zdf_mxl_zint_mld( mld_diags(jn) ) 501 502 IF( iom_use( "mldzint_"//cmld ) ) THEN 503 CALL iom_put( "mldzint_"//cmld, hmld_zint(:,:) ) 504 ENDIF 505 506 IF( iom_use( "mldhtc_"//cmld ) ) THEN 507 CALL zdf_mxl_zint_htc( kt ) 508 CALL iom_put( "mldhtc_"//cmld , htc_mld(:,:) ) 509 ENDIF 510 ENDIF 511 END DO 512 ENDIF 513 514 END SUBROUTINE zdf_mxl_zint 146 515 147 516 !!====================================================================== -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90
r9188 r9987 53 53 USE timing ! Timing 54 54 USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 55 #if defined key_agrif 56 USE agrif_opa_interp 57 USE agrif_opa_update 58 #endif 59 60 55 61 56 62 IMPLICIT NONE … … 77 83 INTEGER :: nn_htau ! type of tke profile of penetration (=0/1) 78 84 REAL(wp) :: rn_efr ! fraction of TKE surface value which penetrates in the ocean 85 REAL(wp) :: rn_c ! fraction of TKE added within the mixed layer by nn_etau 79 86 LOGICAL :: ln_lc ! Langmuir cells (LC) as a source term of TKE or not 80 87 REAL(wp) :: rn_lc ! coef to compute vertical velocity of Langmuir cells … … 82 89 REAL(wp) :: ri_cri ! critic Richardson number (deduced from rn_ediff and rn_ediss values) 83 90 REAL(wp) :: rmxl_min ! minimum mixing length value (deduced from rn_ediff and rn_emin values) [m] 91 REAL(wp) :: rhtau ! coefficient to relate MLD to htau when nn_htau == 2 84 92 REAL(wp) :: rhftau_add = 1.e-3_wp ! add offset applied to HF part of taum (nn_etau=3) 85 93 REAL(wp) :: rhftau_scl = 1.0_wp ! scale factor applied to HF part of taum (nn_etau=3) 86 94 87 95 REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:) :: htau ! depth of tke penetration (nn_htau) 96 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: e_niw !: TKE budget- near-inertial waves term 97 REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:) :: efr ! surface boundary condition for nn_etau = 4 88 98 REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: dissl ! now mixing lenght of dissipation 89 99 #if defined key_c1d … … 108 118 !!---------------------------------------------------------------------- 109 119 ALLOCATE( & 120 & efr (jpi,jpj) , e_niw(jpi,jpj,jpk) , & 110 121 #if defined key_c1d 111 122 & e_dis(jpi,jpj,jpk) , e_mix(jpi,jpj,jpk) , & … … 184 195 avmv_k(:,:,:) = avmv(:,:,:) 185 196 ! 197 #if defined key_agrif 198 ! Update child grid f => parent grid 199 IF( .NOT.Agrif_Root() ) CALL Agrif_Update_Tke( kt ) ! children only 200 #endif 201 ! 186 202 END SUBROUTINE zdf_tke 187 203 … … 312 328 zwlc = zind * rn_lc * zus * SIN( rpi * fsdepw(ji,jj,jk) / zhlc(ji,jj) ) 313 329 ! ! TKE Langmuir circulation source term 314 en(ji,jj,jk) = en(ji,jj,jk) + rdt * ( zwlc * zwlc * zwlc ) / zhlc(ji,jj) * wmask(ji,jj,jk) * tmask(ji,jj,1) 330 en(ji,jj,jk) = en(ji,jj,jk) + rdt * ( 1._wp - fr_i(ji,jj) ) * ( zwlc * zwlc * zwlc ) / & 331 & zhlc(ji,jj) * wmask(ji,jj,jk) * tmask(ji,jj,1) 315 332 END DO 316 333 END DO … … 345 362 DO ji = fs_2, fs_jpim1 ! vector opt. 346 363 zcof = zfact1 * tmask(ji,jj,jk) 364 # if defined key_zdftmx_new 365 ! key_zdftmx_new: New internal wave-driven param: set a minimum value for Kz on TKE (ensure numerical stability) 366 zzd_up = zcof * ( MAX( avm(ji,jj,jk+1) + avm(ji,jj,jk), 2.e-5_wp ) ) & ! upper diagonal 367 & / ( fse3t(ji,jj,jk ) * fse3w(ji,jj,jk ) ) 368 zzd_lw = zcof * ( MAX( avm(ji,jj,jk) + avm(ji,jj,jk-1), 2.e-5_wp ) ) & ! lower diagonal 369 & / ( fse3t(ji,jj,jk-1) * fse3w(ji,jj,jk ) ) 370 # else 347 371 zzd_up = zcof * ( avm (ji,jj,jk+1) + avm (ji,jj,jk ) ) & ! upper diagonal 348 372 & / ( fse3t(ji,jj,jk ) * fse3w(ji,jj,jk ) ) 349 373 zzd_lw = zcof * ( avm (ji,jj,jk ) + avm (ji,jj,jk-1) ) & ! lower diagonal 350 374 & / ( fse3t(ji,jj,jk-1) * fse3w(ji,jj,jk ) ) 375 # endif 351 376 ! ! shear prod. at w-point weightened by mask 352 377 zesh2 = ( avmu(ji-1,jj,jk) + avmu(ji,jj,jk) ) / MAX( 1._wp , umask(ji-1,jj,jk) + umask(ji,jj,jk) ) & … … 408 433 END DO 409 434 435 ! ! Save TKE prior to nn_etau addition 436 e_niw(:,:,:) = en(:,:,:) 437 ! 410 438 ! !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 411 439 ! ! TKE due to surface and internal wave breaking 412 440 ! !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 441 IF( nn_htau == 2 ) THEN !* mixed-layer depth dependant length scale 442 DO jj = 2, jpjm1 443 DO ji = fs_2, fs_jpim1 ! vector opt. 444 htau(ji,jj) = rhtau * hmlp(ji,jj) 445 END DO 446 END DO 447 ENDIF 448 #if defined key_iomput 449 ! 450 CALL iom_put( "htau", htau(:,:) ) ! Check htau (even if constant in time) 451 #endif 452 ! 413 453 IF( nn_etau == 1 ) THEN !* penetration below the mixed layer (rn_efr fraction) 414 454 DO jk = 2, jpkm1 … … 445 485 END DO 446 486 END DO 487 ELSEIF( nn_etau == 4 ) THEN !* column integral independant of htau (rn_efr must be scaled up) 488 IF( nn_htau == 2 ) THEN ! efr dependant on time-varying htau 489 DO jj = 2, jpjm1 490 DO ji = fs_2, fs_jpim1 ! vector opt. 491 efr(ji,jj) = rn_efr / ( htau(ji,jj) * ( 1._wp - EXP( -bathy(ji,jj) / htau(ji,jj) ) ) ) 492 END DO 493 END DO 494 ENDIF 495 DO jk = 2, jpkm1 496 DO jj = 2, jpjm1 497 DO ji = fs_2, fs_jpim1 ! vector opt. 498 en(ji,jj,jk) = en(ji,jj,jk) + efr(ji,jj) * en(ji,jj,1) * EXP( -fsdepw(ji,jj,jk) / htau(ji,jj) ) & 499 & * ( 1._wp - fr_i(ji,jj) ) * tmask(ji,jj,jk) 500 END DO 501 END DO 502 END DO 447 503 ENDIF 448 504 CALL lbc_lnk( en, 'W', 1. ) ! Lateral boundary conditions (sign unchanged) 505 ! 506 DO jk = 2, jpkm1 ! TKE budget: near-inertial waves term 507 DO jj = 2, jpjm1 508 DO ji = fs_2, fs_jpim1 ! vector opt. 509 e_niw(ji,jj,jk) = en(ji,jj,jk) - e_niw(ji,jj,jk) 510 END DO 511 END DO 512 END DO 513 ! 514 CALL lbc_lnk( e_niw, 'W', 1. ) 449 515 ! 450 516 CALL wrk_dealloc( jpi,jpj, imlc ) ! integer … … 705 771 !!---------------------------------------------------------------------- 706 772 INTEGER :: ji, jj, jk ! dummy loop indices 707 INTEGER :: ios 773 INTEGER :: ios, ierr 708 774 !! 709 775 NAMELIST/namzdf_tke/ rn_ediff, rn_ediss , rn_ebb , rn_emin , & 710 776 & rn_emin0, rn_bshear, nn_mxl , ln_mxl0 , & 711 777 & rn_mxl0 , nn_pdl , ln_lc , rn_lc , & 712 & nn_etau , nn_htau , rn_efr 778 & nn_etau , nn_htau , rn_efr , rn_c 713 779 !!---------------------------------------------------------------------- 714 ! 780 715 781 REWIND( numnam_ref ) ! Namelist namzdf_tke in reference namelist : Turbulent Kinetic Energy 716 782 READ ( numnam_ref, namzdf_tke, IOSTAT = ios, ERR = 901) … … 723 789 ! 724 790 ri_cri = 2._wp / ( 2._wp + rn_ediss / rn_ediff ) ! resulting critical Richardson number 791 # if defined key_zdftmx_new 792 ! key_zdftmx_new: New internal wave-driven param: specified value of rn_emin & rmxl_min are used 793 rn_emin = 1.e-10_wp 794 rmxl_min = 1.e-03_wp 795 IF(lwp) THEN ! Control print 796 WRITE(numout,*) 797 WRITE(numout,*) 'zdf_tke_init : New tidal mixing case: force rn_emin = 1.e-10 and rmxl_min = 1.e-3 ' 798 WRITE(numout,*) '~~~~~~~~~~~~' 799 ENDIF 800 # else 725 801 rmxl_min = 1.e-6_wp / ( rn_ediff * SQRT( rn_emin ) ) ! resulting minimum length to recover molecular viscosity 802 # endif 726 803 ! 727 804 IF(lwp) THEN !* Control print … … 745 822 WRITE(numout,*) ' flag for computation of exp. tke profile nn_htau = ', nn_htau 746 823 WRITE(numout,*) ' fraction of en which pene. the thermocline rn_efr = ', rn_efr 824 WRITE(numout,*) ' fraction of TKE added within the mixed layer by nn_etau rn_c = ', rn_c 747 825 WRITE(numout,*) 748 826 WRITE(numout,*) ' critical Richardson nb with your parameters ri_cri = ', ri_cri … … 755 833 IF( nn_mxl < 0 .OR. nn_mxl > 3 ) CALL ctl_stop( 'bad flag: nn_mxl is 0, 1 or 2 ' ) 756 834 IF( nn_pdl < 0 .OR. nn_pdl > 1 ) CALL ctl_stop( 'bad flag: nn_pdl is 0 or 1 ' ) 757 IF( nn_htau < 0 .OR. nn_htau > 1 ) CALL ctl_stop( 'bad flag: nn_htau is 0, 1 or 2' )835 IF( nn_htau < 0 .OR. nn_htau > 5 ) CALL ctl_stop( 'bad flag: nn_htau is 0 to 5 ' ) 758 836 IF( nn_etau == 3 .AND. .NOT. ln_cpl ) CALL ctl_stop( 'nn_etau == 3 : HF taum only known in coupled mode' ) 759 837 … … 763 841 ENDIF 764 842 765 IF( nn_etau == 2 ) CALL zdf_mxl( nit000 ) ! Initialization of nmln 843 IF( nn_etau == 2 ) THEN 844 ierr = zdf_mxl_alloc() 845 nmln(:,:) = nlb10 ! Initialization of nmln 846 ENDIF 847 848 IF( nn_etau /= 0 .and. nn_htau == 2 ) THEN 849 ierr = zdf_mxl_alloc() 850 nmln(:,:) = nlb10 ! Initialization of nmln 851 ENDIF 766 852 767 853 ! !* depth of penetration of surface tke 768 854 IF( nn_etau /= 0 ) THEN 855 htau(:,:) = 0._wp 769 856 SELECT CASE( nn_htau ) ! Choice of the depth of penetration 770 857 CASE( 0 ) ! constant depth penetration (here 10 meters) … … 772 859 CASE( 1 ) ! F(latitude) : 0.5m to 30m poleward of 40 degrees 773 860 htau(:,:) = MAX( 0.5_wp, MIN( 30._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(:,:) ) ) ) ) 861 CASE( 2 ) ! fraction of depth-integrated TKE within mixed-layer 862 rhtau = -1._wp / LOG( 1._wp - rn_c ) 863 CASE( 3 ) ! F(latitude) : 0.5m to 15m poleward of 20 degrees 864 htau(:,:) = MAX( 0.5_wp, MIN( 15._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(:,:) ) ) ) ) 865 CASE( 4 ) ! F(latitude) : 0.5m to 10m/30m poleward of 13/40 degrees north/south 866 DO jj = 2, jpjm1 867 DO ji = fs_2, fs_jpim1 ! vector opt. 868 IF( gphit(ji,jj) <= 0._wp ) THEN 869 htau(ji,jj) = MAX( 0.5_wp, MIN( 30._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(ji,jj) ) ) ) ) 870 ELSE 871 htau(ji,jj) = MAX( 0.5_wp, MIN( 10._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(ji,jj) ) ) ) ) 872 ENDIF 873 END DO 874 END DO 875 CASE ( 5 ) ! F(latitude) : 0.5m to 10m poleward of 13 degrees north/south, 876 DO jj = 2, jpjm1 ! 10m to 30m between 30/45 degrees south 877 DO ji = fs_2, fs_jpim1 ! vector opt. 878 IF( gphit(ji,jj) <= -30._wp ) THEN 879 htau(ji,jj) = MAX( 10._wp, MIN( 30._wp, 55._wp* ABS( SIN( rpi/120._wp * ( gphit(ji,jj) + 23._wp ) ) ) ) ) 880 ELSE 881 htau(ji,jj) = MAX( 0.5_wp, MIN( 10._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(ji,jj) ) ) ) ) 882 ENDIF 883 END DO 884 END DO 774 885 END SELECT 886 ! 887 IF( nn_etau == 4 .AND. nn_htau /= 2 ) THEN ! efr dependant on constant htau 888 DO jj = 2, jpjm1 889 DO ji = fs_2, fs_jpim1 ! vector opt. 890 efr(ji,jj) = rn_efr / ( htau(ji,jj) * ( 1._wp - EXP( -bathy(ji,jj) / htau(ji,jj) ) ) ) 891 END DO 892 END DO 893 ENDIF 775 894 ENDIF 776 895 ! !* set vertical eddy coef. to the background value -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftmx.F90
r7960 r9987 561 561 END SUBROUTINE zdf_tmx_init 562 562 563 #elif defined key_zdftmx_new 564 !!---------------------------------------------------------------------- 565 !! 'key_zdftmx_new' Internal wave-driven vertical mixing 566 !!---------------------------------------------------------------------- 567 !! zdf_tmx : global momentum & tracer Kz with wave induced Kz 568 !! zdf_tmx_init : global momentum & tracer Kz with wave induced Kz 569 !!---------------------------------------------------------------------- 570 USE oce ! ocean dynamics and tracers variables 571 USE dom_oce ! ocean space and time domain variables 572 USE zdf_oce ! ocean vertical physics variables 573 USE zdfddm ! ocean vertical physics: double diffusive mixing 574 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 575 USE eosbn2 ! ocean equation of state 576 USE phycst ! physical constants 577 USE prtctl ! Print control 578 USE in_out_manager ! I/O manager 579 USE iom ! I/O Manager 580 USE lib_mpp ! MPP library 581 USE wrk_nemo ! work arrays 582 USE timing ! Timing 583 USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 584 585 IMPLICIT NONE 586 PRIVATE 587 588 PUBLIC zdf_tmx ! called in step module 589 PUBLIC zdf_tmx_init ! called in nemogcm module 590 PUBLIC zdf_tmx_alloc ! called in nemogcm module 591 592 LOGICAL, PUBLIC, PARAMETER :: lk_zdftmx = .TRUE. !: wave-driven mixing flag 593 594 ! !!* Namelist namzdf_tmx : internal wave-driven mixing * 595 INTEGER :: nn_zpyc ! pycnocline-intensified mixing energy proportional to N (=1) or N^2 (=2) 596 LOGICAL :: ln_mevar ! variable (=T) or constant (=F) mixing efficiency 597 LOGICAL :: ln_tsdiff ! account for differential T/S wave-driven mixing (=T) or not (=F) 598 599 REAL(wp) :: r1_6 = 1._wp / 6._wp 600 601 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: ebot_tmx ! power available from high-mode wave breaking (W/m2) 602 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: epyc_tmx ! power available from low-mode, pycnocline-intensified wave breaking (W/m2) 603 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: ecri_tmx ! power available from low-mode, critical slope wave breaking (W/m2) 604 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: hbot_tmx ! WKB decay scale for high-mode energy dissipation (m) 605 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: hcri_tmx ! decay scale for low-mode critical slope dissipation (m) 606 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: emix_tmx ! local energy density available for mixing (W/kg) 607 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: bflx_tmx ! buoyancy flux Kz * N^2 (W/kg) 608 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: pcmap_tmx ! vertically integrated buoyancy flux (W/m2) 609 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: zav_ratio ! S/T diffusivity ratio (only for ln_tsdiff=T) 610 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: zav_wave ! Internal wave-induced diffusivity 611 612 !! * Substitutions 613 # include "zdfddm_substitute.h90" 614 # include "domzgr_substitute.h90" 615 # include "vectopt_loop_substitute.h90" 616 !!---------------------------------------------------------------------- 617 !! NEMO/OPA 4.0 , NEMO Consortium (2016) 618 !! $Id$ 619 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 620 !!---------------------------------------------------------------------- 621 CONTAINS 622 623 INTEGER FUNCTION zdf_tmx_alloc() 624 !!---------------------------------------------------------------------- 625 !! *** FUNCTION zdf_tmx_alloc *** 626 !!---------------------------------------------------------------------- 627 ALLOCATE( ebot_tmx(jpi,jpj), epyc_tmx(jpi,jpj), ecri_tmx(jpi,jpj) , & 628 & hbot_tmx(jpi,jpj), hcri_tmx(jpi,jpj), emix_tmx(jpi,jpj,jpk), & 629 & bflx_tmx(jpi,jpj,jpk), pcmap_tmx(jpi,jpj), zav_ratio(jpi,jpj,jpk), & 630 & zav_wave(jpi,jpj,jpk), STAT=zdf_tmx_alloc ) 631 ! 632 IF( lk_mpp ) CALL mpp_sum ( zdf_tmx_alloc ) 633 IF( zdf_tmx_alloc /= 0 ) CALL ctl_warn('zdf_tmx_alloc: failed to allocate arrays') 634 END FUNCTION zdf_tmx_alloc 635 636 637 SUBROUTINE zdf_tmx( kt ) 638 !!---------------------------------------------------------------------- 639 !! *** ROUTINE zdf_tmx *** 640 !! 641 !! ** Purpose : add to the vertical mixing coefficients the effect of 642 !! breaking internal waves. 643 !! 644 !! ** Method : - internal wave-driven vertical mixing is given by: 645 !! Kz_wave = min( 100 cm2/s, f( Reb = emix_tmx /( Nu * N^2 ) ) 646 !! where emix_tmx is the 3D space distribution of the wave-breaking 647 !! energy and Nu the molecular kinematic viscosity. 648 !! The function f(Reb) is linear (constant mixing efficiency) 649 !! if the namelist parameter ln_mevar = F and nonlinear if ln_mevar = T. 650 !! 651 !! - Compute emix_tmx, the 3D power density that allows to compute 652 !! Reb and therefrom the wave-induced vertical diffusivity. 653 !! This is divided into three components: 654 !! 1. Bottom-intensified low-mode dissipation at critical slopes 655 !! emix_tmx(z) = ( ecri_tmx / rau0 ) * EXP( -(H-z)/hcri_tmx ) 656 !! / ( 1. - EXP( - H/hcri_tmx ) ) * hcri_tmx 657 !! where hcri_tmx is the characteristic length scale of the bottom 658 !! intensification, ecri_tmx a map of available power, and H the ocean depth. 659 !! 2. Pycnocline-intensified low-mode dissipation 660 !! emix_tmx(z) = ( epyc_tmx / rau0 ) * ( sqrt(rn2(z))^nn_zpyc ) 661 !! / SUM( sqrt(rn2(z))^nn_zpyc * e3w(z) ) 662 !! where epyc_tmx is a map of available power, and nn_zpyc 663 !! is the chosen stratification-dependence of the internal wave 664 !! energy dissipation. 665 !! 3. WKB-height dependent high mode dissipation 666 !! emix_tmx(z) = ( ebot_tmx / rau0 ) * rn2(z) * EXP(-z_wkb(z)/hbot_tmx) 667 !! / SUM( rn2(z) * EXP(-z_wkb(z)/hbot_tmx) * e3w(z) ) 668 !! where hbot_tmx is the characteristic length scale of the WKB bottom 669 !! intensification, ebot_tmx is a map of available power, and z_wkb is the 670 !! WKB-stretched height above bottom defined as 671 !! z_wkb(z) = H * SUM( sqrt(rn2(z'>=z)) * e3w(z'>=z) ) 672 !! / SUM( sqrt(rn2(z')) * e3w(z') ) 673 !! 674 !! - update the model vertical eddy viscosity and diffusivity: 675 !! avt = avt + av_wave 676 !! avm = avm + av_wave 677 !! avmu = avmu + mi(av_wave) 678 !! avmv = avmv + mj(av_wave) 679 !! 680 !! - if namelist parameter ln_tsdiff = T, account for differential mixing: 681 !! avs = avt + av_wave * diffusivity_ratio(Reb) 682 !! 683 !! ** Action : - Define emix_tmx used to compute internal wave-induced mixing 684 !! - avt, avs, avm, avmu, avmv increased by internal wave-driven mixing 685 !! 686 !! References : de Lavergne et al. 2015, JPO; 2016, in prep. 687 !!---------------------------------------------------------------------- 688 INTEGER, INTENT(in) :: kt ! ocean time-step 689 ! 690 INTEGER :: ji, jj, jk ! dummy loop indices 691 REAL(wp) :: ztpc ! scalar workspace 692 REAL(wp), DIMENSION(:,:) , POINTER :: zfact ! Used for vertical structure 693 REAL(wp), DIMENSION(:,:) , POINTER :: zhdep ! Ocean depth 694 REAL(wp), DIMENSION(:,:,:), POINTER :: zwkb ! WKB-stretched height above bottom 695 REAL(wp), DIMENSION(:,:,:), POINTER :: zweight ! Weight for high mode vertical distribution 696 REAL(wp), DIMENSION(:,:,:), POINTER :: znu_t ! Molecular kinematic viscosity (T grid) 697 REAL(wp), DIMENSION(:,:,:), POINTER :: znu_w ! Molecular kinematic viscosity (W grid) 698 REAL(wp), DIMENSION(:,:,:), POINTER :: zReb ! Turbulence intensity parameter 699 !!---------------------------------------------------------------------- 700 ! 701 IF( nn_timing == 1 ) CALL timing_start('zdf_tmx') 702 ! 703 CALL wrk_alloc( jpi,jpj, zfact, zhdep ) 704 CALL wrk_alloc( jpi,jpj,jpk, zwkb, zweight, znu_t, znu_w, zReb ) 705 706 ! ! ----------------------------- ! 707 ! ! Internal wave-driven mixing ! (compute zav_wave) 708 ! ! ----------------------------- ! 709 ! 710 ! !* Critical slope mixing: distribute energy over the time-varying ocean depth, 711 ! using an exponential decay from the seafloor. 712 DO jj = 1, jpj ! part independent of the level 713 DO ji = 1, jpi 714 zhdep(ji,jj) = fsdepw(ji,jj,mbkt(ji,jj)+1) ! depth of the ocean 715 zfact(ji,jj) = rau0 * ( 1._wp - EXP( -zhdep(ji,jj) / hcri_tmx(ji,jj) ) ) 716 IF( zfact(ji,jj) /= 0 ) zfact(ji,jj) = ecri_tmx(ji,jj) / zfact(ji,jj) 717 END DO 718 END DO 719 720 DO jk = 2, jpkm1 ! complete with the level-dependent part 721 emix_tmx(:,:,jk) = zfact(:,:) * ( EXP( ( fsde3w(:,:,jk ) - zhdep(:,:) ) / hcri_tmx(:,:) ) & 722 & - EXP( ( fsde3w(:,:,jk-1) - zhdep(:,:) ) / hcri_tmx(:,:) ) ) * wmask(:,:,jk) & 723 & / ( fsde3w(:,:,jk) - fsde3w(:,:,jk-1) ) 724 END DO 725 726 ! !* Pycnocline-intensified mixing: distribute energy over the time-varying 727 ! !* ocean depth as proportional to sqrt(rn2)^nn_zpyc 728 729 SELECT CASE ( nn_zpyc ) 730 731 CASE ( 1 ) ! Dissipation scales as N (recommended) 732 733 zfact(:,:) = 0._wp 734 DO jk = 2, jpkm1 ! part independent of the level 735 zfact(:,:) = zfact(:,:) + fse3w(:,:,jk) * SQRT( MAX( 0._wp, rn2(:,:,jk) ) ) * wmask(:,:,jk) 736 END DO 737 738 DO jj = 1, jpj 739 DO ji = 1, jpi 740 IF( zfact(ji,jj) /= 0 ) zfact(ji,jj) = epyc_tmx(ji,jj) / ( rau0 * zfact(ji,jj) ) 741 END DO 742 END DO 743 744 DO jk = 2, jpkm1 ! complete with the level-dependent part 745 emix_tmx(:,:,jk) = emix_tmx(:,:,jk) + zfact(:,:) * SQRT( MAX( 0._wp, rn2(:,:,jk) ) ) * wmask(:,:,jk) 746 END DO 747 748 CASE ( 2 ) ! Dissipation scales as N^2 749 750 zfact(:,:) = 0._wp 751 DO jk = 2, jpkm1 ! part independent of the level 752 zfact(:,:) = zfact(:,:) + fse3w(:,:,jk) * MAX( 0._wp, rn2(:,:,jk) ) * wmask(:,:,jk) 753 END DO 754 755 DO jj= 1, jpj 756 DO ji = 1, jpi 757 IF( zfact(ji,jj) /= 0 ) zfact(ji,jj) = epyc_tmx(ji,jj) / ( rau0 * zfact(ji,jj) ) 758 END DO 759 END DO 760 761 DO jk = 2, jpkm1 ! complete with the level-dependent part 762 emix_tmx(:,:,jk) = emix_tmx(:,:,jk) + zfact(:,:) * MAX( 0._wp, rn2(:,:,jk) ) * wmask(:,:,jk) 763 END DO 764 765 END SELECT 766 767 ! !* WKB-height dependent mixing: distribute energy over the time-varying 768 ! !* ocean depth as proportional to rn2 * exp(-z_wkb/rn_hbot) 769 770 zwkb(:,:,:) = 0._wp 771 zfact(:,:) = 0._wp 772 DO jk = 2, jpkm1 773 zfact(:,:) = zfact(:,:) + fse3w(:,:,jk) * SQRT( MAX( 0._wp, rn2(:,:,jk) ) ) * wmask(:,:,jk) 774 zwkb(:,:,jk) = zfact(:,:) 775 END DO 776 777 DO jk = 2, jpkm1 778 DO jj = 1, jpj 779 DO ji = 1, jpi 780 IF( zfact(ji,jj) /= 0 ) zwkb(ji,jj,jk) = zhdep(ji,jj) * ( zfact(ji,jj) - zwkb(ji,jj,jk) ) & 781 & * tmask(ji,jj,jk) / zfact(ji,jj) 782 END DO 783 END DO 784 END DO 785 zwkb(:,:,1) = zhdep(:,:) * tmask(:,:,1) 786 787 zweight(:,:,:) = 0._wp 788 DO jk = 2, jpkm1 789 zweight(:,:,jk) = MAX( 0._wp, rn2(:,:,jk) ) * hbot_tmx(:,:) * wmask(:,:,jk) & 790 & * ( EXP( -zwkb(:,:,jk) / hbot_tmx(:,:) ) - EXP( -zwkb(:,:,jk-1) / hbot_tmx(:,:) ) ) 791 END DO 792 793 zfact(:,:) = 0._wp 794 DO jk = 2, jpkm1 ! part independent of the level 795 zfact(:,:) = zfact(:,:) + zweight(:,:,jk) 796 END DO 797 798 DO jj = 1, jpj 799 DO ji = 1, jpi 800 IF( zfact(ji,jj) /= 0 ) zfact(ji,jj) = ebot_tmx(ji,jj) / ( rau0 * zfact(ji,jj) ) 801 END DO 802 END DO 803 804 DO jk = 2, jpkm1 ! complete with the level-dependent part 805 emix_tmx(:,:,jk) = emix_tmx(:,:,jk) + zweight(:,:,jk) * zfact(:,:) * wmask(:,:,jk) & 806 & / ( fsde3w(:,:,jk) - fsde3w(:,:,jk-1) ) 807 END DO 808 809 810 ! Calculate molecular kinematic viscosity 811 znu_t(:,:,:) = 1.e-4_wp * ( 17.91_wp - 0.53810_wp * tsn(:,:,:,jp_tem) + 0.00694_wp * tsn(:,:,:,jp_tem) * tsn(:,:,:,jp_tem) & 812 & + 0.02305_wp * tsn(:,:,:,jp_sal) ) * tmask(:,:,:) * r1_rau0 813 DO jk = 2, jpkm1 814 znu_w(:,:,jk) = 0.5_wp * ( znu_t(:,:,jk-1) + znu_t(:,:,jk) ) * wmask(:,:,jk) 815 END DO 816 817 ! Calculate turbulence intensity parameter Reb 818 DO jk = 2, jpkm1 819 zReb(:,:,jk) = emix_tmx(:,:,jk) / MAX( 1.e-20_wp, znu_w(:,:,jk) * rn2(:,:,jk) ) 820 END DO 821 822 ! Define internal wave-induced diffusivity 823 DO jk = 2, jpkm1 824 zav_wave(:,:,jk) = znu_w(:,:,jk) * zReb(:,:,jk) * r1_6 ! This corresponds to a constant mixing efficiency of 1/6 825 END DO 826 827 IF( ln_mevar ) THEN ! Variable mixing efficiency case : modify zav_wave in the 828 DO jk = 2, jpkm1 ! energetic (Reb > 480) and buoyancy-controlled (Reb <10.224 ) regimes 829 DO jj = 1, jpj 830 DO ji = 1, jpi 831 IF( zReb(ji,jj,jk) > 480.00_wp ) THEN 832 zav_wave(ji,jj,jk) = 3.6515_wp * znu_w(ji,jj,jk) * SQRT( zReb(ji,jj,jk) ) 833 ELSEIF( zReb(ji,jj,jk) < 10.224_wp ) THEN 834 zav_wave(ji,jj,jk) = 0.052125_wp * znu_w(ji,jj,jk) * zReb(ji,jj,jk) * SQRT( zReb(ji,jj,jk) ) 835 ENDIF 836 END DO 837 END DO 838 END DO 839 ENDIF 840 841 DO jk = 2, jpkm1 ! Bound diffusivity by molecular value and 100 cm2/s 842 zav_wave(:,:,jk) = MIN( MAX( 1.4e-7_wp, zav_wave(:,:,jk) ), 1.e-2_wp ) * wmask(:,:,jk) 843 END DO 844 845 IF( kt == nit000 ) THEN !* Control print at first time-step: diagnose the energy consumed by zav_wave 846 ztpc = 0._wp 847 DO jk = 2, jpkm1 848 DO jj = 1, jpj 849 DO ji = 1, jpi 850 ztpc = ztpc + fse3w(ji,jj,jk) * e1e2t(ji,jj) & 851 & * MAX( 0._wp, rn2(ji,jj,jk) ) * zav_wave(ji,jj,jk) * wmask(ji,jj,jk) * tmask_i(ji,jj) 852 END DO 853 END DO 854 END DO 855 IF( lk_mpp ) CALL mpp_sum( ztpc ) 856 ztpc = rau0 * ztpc ! Global integral of rauo * Kz * N^2 = power contributing to mixing 857 858 IF(lwp) THEN 859 WRITE(numout,*) 860 WRITE(numout,*) 'zdf_tmx : Internal wave-driven mixing (tmx)' 861 WRITE(numout,*) '~~~~~~~ ' 862 WRITE(numout,*) 863 WRITE(numout,*) ' Total power consumption by av_wave: ztpc = ', ztpc * 1.e-12_wp, 'TW' 864 ENDIF 865 ENDIF 866 867 ! ! ----------------------- ! 868 ! ! Update mixing coefs ! 869 ! ! ----------------------- ! 870 ! 871 IF( ln_tsdiff ) THEN !* Option for differential mixing of salinity and temperature 872 DO jk = 2, jpkm1 ! Calculate S/T diffusivity ratio as a function of Reb 873 DO jj = 1, jpj 874 DO ji = 1, jpi 875 zav_ratio(ji,jj,jk) = ( 0.505_wp + 0.495_wp * & 876 & TANH( 0.92_wp * ( LOG10( MAX( 1.e-20_wp, zReb(ji,jj,jk) * 5._wp * r1_6 ) ) - 0.60_wp ) ) & 877 & ) * wmask(ji,jj,jk) 878 END DO 879 END DO 880 END DO 881 CALL iom_put( "av_ratio", zav_ratio ) 882 DO jk = 2, jpkm1 !* update momentum & tracer diffusivity with wave-driven mixing 883 fsavs(:,:,jk) = avt(:,:,jk) + zav_wave(:,:,jk) * zav_ratio(:,:,jk) 884 avt (:,:,jk) = avt(:,:,jk) + zav_wave(:,:,jk) 885 avm (:,:,jk) = avm(:,:,jk) + zav_wave(:,:,jk) 886 END DO 887 ! 888 ELSE !* update momentum & tracer diffusivity with wave-driven mixing 889 DO jk = 2, jpkm1 890 fsavs(:,:,jk) = avt(:,:,jk) + zav_wave(:,:,jk) 891 avt (:,:,jk) = avt(:,:,jk) + zav_wave(:,:,jk) 892 avm (:,:,jk) = avm(:,:,jk) + zav_wave(:,:,jk) 893 END DO 894 ENDIF 895 896 DO jk = 2, jpkm1 !* update momentum diffusivity at wu and wv points 897 DO jj = 2, jpjm1 898 DO ji = fs_2, fs_jpim1 ! vector opt. 899 avmu(ji,jj,jk) = avmu(ji,jj,jk) + 0.5_wp * ( zav_wave(ji,jj,jk) + zav_wave(ji+1,jj ,jk) ) * wumask(ji,jj,jk) 900 avmv(ji,jj,jk) = avmv(ji,jj,jk) + 0.5_wp * ( zav_wave(ji,jj,jk) + zav_wave(ji ,jj+1,jk) ) * wvmask(ji,jj,jk) 901 END DO 902 END DO 903 END DO 904 CALL lbc_lnk( avmu, 'U', 1. ) ; CALL lbc_lnk( avmv, 'V', 1. ) ! lateral boundary condition 905 906 ! !* output internal wave-driven mixing coefficient 907 CALL iom_put( "av_wave", zav_wave ) 908 !* output useful diagnostics: N^2, Kz * N^2 (bflx_tmx), 909 ! vertical integral of rau0 * Kz * N^2 (pcmap_tmx), energy density (emix_tmx) 910 IF( iom_use("bflx_tmx") .OR. iom_use("pcmap_tmx") ) THEN 911 bflx_tmx(:,:,:) = MAX( 0._wp, rn2(:,:,:) ) * zav_wave(:,:,:) 912 pcmap_tmx(:,:) = 0._wp 913 DO jk = 2, jpkm1 914 pcmap_tmx(:,:) = pcmap_tmx(:,:) + fse3w(:,:,jk) * bflx_tmx(:,:,jk) * wmask(:,:,jk) 915 END DO 916 pcmap_tmx(:,:) = rau0 * pcmap_tmx(:,:) 917 CALL iom_put( "bflx_tmx", bflx_tmx ) 918 CALL iom_put( "pcmap_tmx", pcmap_tmx ) 919 ENDIF 920 CALL iom_put( "emix_tmx", emix_tmx ) 921 922 CALL wrk_dealloc( jpi,jpj, zfact, zhdep ) 923 CALL wrk_dealloc( jpi,jpj,jpk, zwkb, zweight, znu_t, znu_w, zReb ) 924 925 IF(ln_ctl) CALL prt_ctl(tab3d_1=zav_wave , clinfo1=' tmx - av_wave: ', tab3d_2=avt, clinfo2=' avt: ', ovlap=1, kdim=jpk) 926 ! 927 IF( nn_timing == 1 ) CALL timing_stop('zdf_tmx') 928 ! 929 END SUBROUTINE zdf_tmx 930 931 932 SUBROUTINE zdf_tmx_init 933 !!---------------------------------------------------------------------- 934 !! *** ROUTINE zdf_tmx_init *** 935 !! 936 !! ** Purpose : Initialization of the wave-driven vertical mixing, reading 937 !! of input power maps and decay length scales in netcdf files. 938 !! 939 !! ** Method : - Read the namzdf_tmx namelist and check the parameters 940 !! 941 !! - Read the input data in NetCDF files : 942 !! power available from high-mode wave breaking (mixing_power_bot.nc) 943 !! power available from pycnocline-intensified wave-breaking (mixing_power_pyc.nc) 944 !! power available from critical slope wave-breaking (mixing_power_cri.nc) 945 !! WKB decay scale for high-mode wave-breaking (decay_scale_bot.nc) 946 !! decay scale for critical slope wave-breaking (decay_scale_cri.nc) 947 !! 948 !! ** input : - Namlist namzdf_tmx 949 !! - NetCDF files : mixing_power_bot.nc, mixing_power_pyc.nc, mixing_power_cri.nc, 950 !! decay_scale_bot.nc decay_scale_cri.nc 951 !! 952 !! ** Action : - Increase by 1 the nstop flag is setting problem encounter 953 !! - Define ebot_tmx, epyc_tmx, ecri_tmx, hbot_tmx, hcri_tmx 954 !! 955 !! References : de Lavergne et al. 2015, JPO; 2016, in prep. 956 !! 957 !!---------------------------------------------------------------------- 958 INTEGER :: ji, jj, jk ! dummy loop indices 959 INTEGER :: inum ! local integer 960 INTEGER :: ios 961 REAL(wp) :: zbot, zpyc, zcri ! local scalars 962 !! 963 NAMELIST/namzdf_tmx_new/ nn_zpyc, ln_mevar, ln_tsdiff 964 !!---------------------------------------------------------------------- 965 ! 966 IF( nn_timing == 1 ) CALL timing_start('zdf_tmx_init') 967 ! 968 REWIND( numnam_ref ) ! Namelist namzdf_tmx in reference namelist : Wave-driven mixing 969 READ ( numnam_ref, namzdf_tmx_new, IOSTAT = ios, ERR = 901) 970 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_tmx in reference namelist', lwp ) 971 ! 972 REWIND( numnam_cfg ) ! Namelist namzdf_tmx in configuration namelist : Wave-driven mixing 973 READ ( numnam_cfg, namzdf_tmx_new, IOSTAT = ios, ERR = 902 ) 974 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_tmx in configuration namelist', lwp ) 975 IF(lwm) WRITE ( numond, namzdf_tmx_new ) 976 ! 977 IF(lwp) THEN ! Control print 978 WRITE(numout,*) 979 WRITE(numout,*) 'zdf_tmx_init : internal wave-driven mixing' 980 WRITE(numout,*) '~~~~~~~~~~~~' 981 WRITE(numout,*) ' Namelist namzdf_tmx_new : set wave-driven mixing parameters' 982 WRITE(numout,*) ' Pycnocline-intensified diss. scales as N (=1) or N^2 (=2) = ', nn_zpyc 983 WRITE(numout,*) ' Variable (T) or constant (F) mixing efficiency = ', ln_mevar 984 WRITE(numout,*) ' Differential internal wave-driven mixing (T) or not (F) = ', ln_tsdiff 985 ENDIF 986 987 ! The new wave-driven mixing parameterization elevates avt and avm in the interior, and 988 ! ensures that avt remains larger than its molecular value (=1.4e-7). Therefore, avtb should 989 ! be set here to a very small value, and avmb to its (uniform) molecular value (=1.4e-6). 990 avmb(:) = 1.4e-6_wp ! viscous molecular value 991 avtb(:) = 1.e-10_wp ! very small diffusive minimum (background avt is specified in zdf_tmx) 992 avtb_2d(:,:) = 1.e0_wp ! uniform 993 IF(lwp) THEN ! Control print 994 WRITE(numout,*) 995 WRITE(numout,*) ' Force the background value applied to avm & avt in TKE to be everywhere ', & 996 & 'the viscous molecular value & a very small diffusive value, resp.' 997 ENDIF 998 999 IF( .NOT.lk_zdfddm ) CALL ctl_stop( 'STOP', 'zdf_tmx_init_new : key_zdftmx_new requires key_zdfddm' ) 1000 1001 ! ! allocate tmx arrays 1002 IF( zdf_tmx_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'zdf_tmx_init : unable to allocate tmx arrays' ) 1003 ! 1004 ! ! read necessary fields 1005 CALL iom_open('mixing_power_bot',inum) ! energy flux for high-mode wave breaking [W/m2] 1006 CALL iom_get (inum, jpdom_data, 'field', ebot_tmx, 1 ) 1007 CALL iom_close(inum) 1008 ! 1009 CALL iom_open('mixing_power_pyc',inum) ! energy flux for pynocline-intensified wave breaking [W/m2] 1010 CALL iom_get (inum, jpdom_data, 'field', epyc_tmx, 1 ) 1011 CALL iom_close(inum) 1012 ! 1013 CALL iom_open('mixing_power_cri',inum) ! energy flux for critical slope wave breaking [W/m2] 1014 CALL iom_get (inum, jpdom_data, 'field', ecri_tmx, 1 ) 1015 CALL iom_close(inum) 1016 ! 1017 CALL iom_open('decay_scale_bot',inum) ! spatially variable decay scale for high-mode wave breaking [m] 1018 CALL iom_get (inum, jpdom_data, 'field', hbot_tmx, 1 ) 1019 CALL iom_close(inum) 1020 ! 1021 CALL iom_open('decay_scale_cri',inum) ! spatially variable decay scale for critical slope wave breaking [m] 1022 CALL iom_get (inum, jpdom_data, 'field', hcri_tmx, 1 ) 1023 CALL iom_close(inum) 1024 1025 ebot_tmx(:,:) = ebot_tmx(:,:) * ssmask(:,:) 1026 epyc_tmx(:,:) = epyc_tmx(:,:) * ssmask(:,:) 1027 ecri_tmx(:,:) = ecri_tmx(:,:) * ssmask(:,:) 1028 1029 ! Set once for all to zero the first and last vertical levels of appropriate variables 1030 emix_tmx (:,:, 1 ) = 0._wp 1031 emix_tmx (:,:,jpk) = 0._wp 1032 zav_ratio(:,:, 1 ) = 0._wp 1033 zav_ratio(:,:,jpk) = 0._wp 1034 zav_wave (:,:, 1 ) = 0._wp 1035 zav_wave (:,:,jpk) = 0._wp 1036 1037 zbot = glob_sum( e1e2t(:,:) * ebot_tmx(:,:) ) 1038 zpyc = glob_sum( e1e2t(:,:) * epyc_tmx(:,:) ) 1039 zcri = glob_sum( e1e2t(:,:) * ecri_tmx(:,:) ) 1040 IF(lwp) THEN 1041 WRITE(numout,*) ' High-mode wave-breaking energy: ', zbot * 1.e-12_wp, 'TW' 1042 WRITE(numout,*) ' Pycnocline-intensifed wave-breaking energy: ', zpyc * 1.e-12_wp, 'TW' 1043 WRITE(numout,*) ' Critical slope wave-breaking energy: ', zcri * 1.e-12_wp, 'TW' 1044 ENDIF 1045 ! 1046 IF( nn_timing == 1 ) CALL timing_stop('zdf_tmx_init') 1047 ! 1048 END SUBROUTINE zdf_tmx_init 1049 563 1050 #else 564 1051 !!---------------------------------------------------------------------- -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
r7960 r9987 68 68 USE icbini ! handle bergs, initialisation 69 69 USE icbstp ! handle bergs, calving, themodynamics and transport 70 USE sbccpl 70 71 USE cpl_oasis3 ! OASIS3 coupling 71 72 USE c1d ! 1D configuration … … 74 75 #if defined key_top 75 76 USE trcini ! passive tracer initialisation 77 USE trc, ONLY: numstr ! tracer stats unit number 76 78 #endif 77 79 USE lib_mpp ! distributed memory computing … … 161 163 ENDIF 162 164 165 #if defined key_agrif 166 CALL Agrif_Regrid() 167 #endif 168 163 169 DO WHILE ( istp <= nitend .AND. nstop == 0 ) 164 170 #if defined key_agrif 165 CALL Agrif_Step( stp )! AGRIF: time stepping171 CALL stp ! AGRIF: time stepping 166 172 #else 167 CALL stp( istp ) ! standard time stepping 173 IF (lk_oasis) CALL sbc_cpl_snd( istp ) ! Coupling to atmos 174 CALL stp( istp ) 175 ! We don't couple on the final timestep because 176 ! our restart file has already been written 177 ! and contains all the necessary data for a 178 ! restart. sbc_cpl_snd could be called here 179 ! but it would require 180 ! a) A test to ensure it was not performed 181 ! on the very last time-step 182 ! b) the presence of another call to 183 ! sbc_cpl_snd call prior to the main DO loop 184 ! This solution produces identical results 185 ! with fewer lines of code. 168 186 #endif 169 187 istp = istp + 1 … … 187 205 ! 188 206 #if defined key_agrif 189 CALL Agrif_ParentGrid_To_ChildGrid() 190 IF( lk_diaobs ) CALL dia_obs_wri 191 IF( nn_timing == 1 ) CALL timing_finalize 192 CALL Agrif_ChildGrid_To_ParentGrid() 207 IF( .NOT. Agrif_Root() ) THEN 208 CALL Agrif_ParentGrid_To_ChildGrid() 209 IF( lk_diaobs ) CALL dia_obs_wri 210 IF( nn_timing == 1 ) CALL timing_finalize 211 CALL Agrif_ChildGrid_To_ParentGrid() 212 ENDIF 193 213 #endif 194 214 IF( nn_timing == 1 ) CALL timing_finalize … … 206 226 ENDIF 207 227 #endif 228 ! 229 ! Met Office addition: if failed, return non-zero exit code 230 IF( nstop /= 0 ) CALL exit( 9 ) 208 231 ! 209 232 END SUBROUTINE nemo_gcm … … 277 300 IF( Agrif_Root() ) THEN 278 301 IF( lk_oasis ) THEN 279 CALL cpl_init( " oceanx", ilocal_comm ) ! nemo local communicator given by oasis302 CALL cpl_init( "toyoce", ilocal_comm ) ! nemo local communicator given by oasis 280 303 CALL xios_initialize( "not used",local_comm=ilocal_comm ) ! send nemo communicator to xios 281 304 ELSE … … 288 311 IF( lk_oasis ) THEN 289 312 IF( Agrif_Root() ) THEN 290 CALL cpl_init( " oceanx", ilocal_comm ) ! nemo local communicator given by oasis313 CALL cpl_init( "toyoce", ilocal_comm ) ! nemo local communicator given by oasis 291 314 ENDIF 292 315 ! Nodes selection (control print return in cltxt) … … 334 357 jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj ! second dim. 335 358 #endif 336 ENDIF 359 ENDIF 337 360 jpk = jpkdta ! third dim 361 #if defined key_agrif 362 ! simple trick to use same vertical grid as parent 363 ! but different number of levels: 364 ! Save maximum number of levels in jpkdta, then define all vertical grids 365 ! with this number. 366 ! Suppress once vertical online interpolation is ok 367 IF(.NOT.Agrif_Root()) jpkdta = Agrif_Parent(jpkdta) 368 #endif 338 369 jpim1 = jpi-1 ! inner domain indices 339 370 jpjm1 = jpj-1 ! " " … … 448 479 ! ! Diagnostics 449 480 IF( lk_floats ) CALL flo_init ! drifting Floats 450 IF( lk_diaar5 ) CALL dia_ar5_init ! ar5 diag451 481 CALL dia_ptr_init ! Poleward TRansports initialization 452 482 IF( lk_diadct ) CALL dia_dct_init ! Sections tranports 453 483 CALL dia_hsb_init ! heat content, salt content and volume budgets 454 484 CALL trd_init ! Mixed-layer/Vorticity/Integral constraints trends 485 CALL bias_init ! Pressure correction bias 455 486 IF( lk_diaobs ) THEN ! Observation & model comparison 456 487 CALL dia_obs_init ! Initialize observational data … … 461 492 IF( lk_asminc ) CALL asm_inc_init ! Initialize assimilation increments 462 493 IF(lwp) WRITE(numout,*) 'Euler time step switch is ', neuler 494 495 IF (nstop > 0) THEN 496 CALL CTL_STOP('STOP','Critical errors in NEMO initialisation') 497 END IF 498 463 499 ! 464 500 END SUBROUTINE nemo_init … … 596 632 IF( numdct_heat /= -1 ) CLOSE( numdct_heat ) ! heat transports 597 633 IF( numdct_salt /= -1 ) CLOSE( numdct_salt ) ! salt transports 598 634 #if defined key_top 635 IF( numstr /= -1 ) CLOSE( numstr ) ! tracer statistics 636 #endif 599 637 ! 600 638 numout = 6 ! redefine numout in case it is used after this point... … … 612 650 !!---------------------------------------------------------------------- 613 651 USE diawri , ONLY: dia_wri_alloc 652 USE insitu_tem, ONLY: insitu_tem_alloc 614 653 USE dom_oce , ONLY: dom_oce_alloc 615 654 USE ldfdyn_oce, ONLY: ldfdyn_oce_alloc … … 628 667 ierr = oce_alloc () ! ocean 629 668 ierr = ierr + dia_wri_alloc () 669 ierr = ierr + insitu_tem_alloc() 630 670 ierr = ierr + dom_oce_alloc () ! ocean domain 631 671 ierr = ierr + ldfdyn_oce_alloc() ! ocean lateral physics : dynamics … … 710 750 INTEGER :: ifac, jl, inu 711 751 INTEGER, PARAMETER :: ntest = 14 712 INTEGER :: ilfax(ntest) 713 ! 714 ! lfax contains the set of allowed factors. 715 data (ilfax(jl),jl=1,ntest) / 16384, 8192, 4096, 2048, 1024, 512, 256, & 716 & 128, 64, 32, 16, 8, 4, 2 / 717 !!---------------------------------------------------------------------- 752 INTEGER, DIMENSION(ntest) :: ilfax 753 ! 754 ! ilfax contains the set of allowed factors. 755 ilfax(:) = (/(2**jl,jl=ntest,1,-1)/) 756 !!---------------------------------------------------------------------- 757 ! ilfax contains the set of allowed factors. 758 ilfax(:) = (/(2**jl,jl=ntest,1,-1)/) 718 759 719 760 ! Clear the error flag and initialise output vars -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/oce.F90
r7960 r9987 71 71 !! Energy budget of the leads (open water embedded in sea ice) 72 72 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: fraqsr_1lev !: fraction of solar net radiation absorbed in the first ocean level [-] 73 74 !! Arrays used in coupling when MEDUSA is present. These arrays need to be declared 75 !! even if MEDUSA is not active, to allow compilation, in which case they will not be allocated. 76 !! --------------------- 77 REAL(wp), PUBLIC, ALLOCATABLE, SAVE :: CO2Flux_out_cpl(:,:) ! Output coupling CO2 flux 78 REAL(wp), PUBLIC, ALLOCATABLE, SAVE :: DMS_out_cpl(:,:) ! Output coupling DMS 79 REAL(wp), PUBLIC, ALLOCATABLE, SAVE :: chloro_out_cpl(:,:) ! Output coupling chlorophyll 80 ! (expected in Kg/M3) 73 81 82 REAL(wp), PUBLIC, ALLOCATABLE, SAVE :: PCO2a_in_cpl(:,:) ! Input coupling CO2 partial pressure 83 REAL(wp), PUBLIC, ALLOCATABLE, SAVE :: Dust_in_cpl(:,:) ! Input coupling dust 84 85 #if defined key_medusa 86 LOGICAL, PUBLIC, PARAMETER :: ln_medusa=.TRUE. ! Medusa switched on or off. 87 #else 88 LOGICAL, PUBLIC, PARAMETER :: ln_medusa=.FALSE. ! Medusa switched on or off. 89 #endif 74 90 !!---------------------------------------------------------------------- 75 91 !! NEMO/OPA 4.0 , NEMO Consortium (2011) … … 83 99 !! *** FUNCTION oce_alloc *** 84 100 !!---------------------------------------------------------------------- 85 INTEGER :: ierr( 4)101 INTEGER :: ierr(5) 86 102 !!---------------------------------------------------------------------- 87 103 ! … … 119 135 ALLOCATE( fraqsr_1lev(jpi,jpj) , STAT=ierr(4) ) 120 136 ! 137 #if defined key_oasis3 138 IF (ln_medusa) THEN 139 ! We only actually need these arrays to be allocated if coupling and MEDUSA 140 ! are enabled 141 ALLOCATE( CO2Flux_out_cpl(jpi,jpj), DMS_out_cpl(jpi,jpj), & 142 chloro_out_cpl(jpi,jpj), & 143 PCO2a_in_cpl(jpi,jpj), Dust_in_cpl(jpi,jpj), STAT=ierr(5) ) 144 145 ENDIF 146 #endif 147 121 148 oce_alloc = MAXVAL( ierr ) 122 149 IF( oce_alloc /= 0 ) CALL ctl_warn('oce_alloc: failed to allocate arrays') -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/step.F90
r7960 r9987 33 33 USE step_oce ! time stepping definition modules 34 34 USE iom 35 USE lbclnk 35 36 36 37 IMPLICIT NONE … … 50 51 51 52 #if defined key_agrif 52 SUBROUTINE stp( )53 RECURSIVE SUBROUTINE stp( ) 53 54 INTEGER :: kstp ! ocean time-step index 54 55 #else … … 73 74 !!---------------------------------------------------------------------- 74 75 INTEGER :: jk ! dummy loop indice 76 INTEGER :: tind ! tracer loop index 75 77 INTEGER :: indic ! error indicator if < 0 76 78 INTEGER :: kcall ! optional integer argument (dom_vvl_sf_nxt) … … 79 81 #if defined key_agrif 80 82 kstp = nit000 + Agrif_Nb_Step() 81 ! IF ( Agrif_Root() .and. lwp) Write(*,*) '---' 82 ! IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp 83 IF ( lk_agrif_debug ) THEN 84 IF ( Agrif_Root() .and. lwp) Write(*,*) '---' 85 IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp, 'int tstep',Agrif_NbStepint() 86 ENDIF 87 83 88 IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE. 89 84 90 # if defined key_iomput 85 91 IF( Agrif_Nbstepint() == 0 ) CALL iom_swap( cxios_context ) … … 97 103 IF( ln_crs ) CALL iom_setkt( kstp - nit000 + 1, TRIM(cxios_context)//"_crs" ) ! tell iom we are at time step kstp 98 104 105 IF( ln_bias ) CALL bias_opn( kstp ) 106 99 107 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 100 108 ! Update data, open boundaries, surface boundary condition (including sea-ice) … … 105 113 CALL bdy_dta ( kstp, time_offset=+1 ) ! update dynamic & tracer data at open boundaries 106 114 ENDIF 115 116 ! We must ensure that tsb halos are up to date on EVERY timestep. 117 DO tind = 1, jpts 118 CALL lbc_lnk( tsb(:,:,:,tind), 'T', 1. ) 119 END DO 120 107 121 CALL sbc ( kstp ) ! Sea Boundary Condition (including sea-ice) 108 122 ! clem: moved here for bdy ice purpose … … 110 124 ! Update stochastic parameters and random T/S fluctuations 111 125 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 112 CALL sto_par( kstp ) ! Stochastic parameters 126 IF( ln_sto_eos ) CALL sto_par( kstp ) ! Stochastic parameters 127 IF( ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations 113 128 114 129 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> … … 152 167 ! 153 168 IF( lk_ldfslp ) THEN ! slope of lateral mixing 154 IF(ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations 155 CALL eos( tsb, rhd, gdept_0(:,:,:) ) ! before in situ density 169 CALL eos( tsb, rhd, gdept_0(:,:,:) ) ! before in situ density 156 170 IF( ln_zps .AND. .NOT. ln_isfcav) & 157 171 & CALL zps_hde ( kstp, jpts, tsb, gtsu, gtsv, & ! Partial steps: before horizontal gradient … … 188 202 ! Note that the computation of vertical velocity above, hence "after" sea level 189 203 ! is necessary to compute momentum advection for the rhs of barotropic loop: 190 IF(ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations 191 CALL eos ( tsn, rhd, rhop, fsdept_n(:,:,:) ) ! now in situ density for hpg computation 204 CALL eos ( tsn, rhd, rhop, fsdept_n(:,:,:) ) ! now in situ density for hpg computation 192 205 IF( ln_zps .AND. .NOT. ln_isfcav) & 193 206 & CALL zps_hde ( kstp, jpts, tsn, gtsu, gtsv, & ! Partial steps: before horizontal gradient … … 200 213 ua(:,:,:) = 0.e0 ! set dynamics trends to zero 201 214 va(:,:,:) = 0.e0 202 IF( l n_asmiau .AND. &215 IF( lk_asminc .AND. ln_asmiau .AND. & 203 216 & ln_dyninc ) CALL dyn_asm_inc ( kstp ) ! apply dynamics assimilation increment 204 217 IF( ln_neptsimp ) CALL dyn_nept_cor ( kstp ) ! subtract Neptune velocities (simplified) … … 231 244 IF( lk_diaar5 ) CALL dia_ar5( kstp ) ! ar5 diag 232 245 IF( lk_diaharm ) CALL dia_harm( kstp ) ! Tidal harmonic analysis 246 CALL dia_prod( kstp ) ! ocean model: product diagnostics 233 247 CALL dia_wri( kstp ) ! ocean model: outputs 234 248 ! … … 248 262 tsa(:,:,:,:) = 0.e0 ! set tracer trends to zero 249 263 250 IF( l n_asmiau .AND. &264 IF( lk_asminc .AND. ln_asmiau .AND. & 251 265 & ln_trainc ) CALL tra_asm_inc( kstp ) ! apply tracer assimilation increment 252 266 CALL tra_sbc ( kstp ) ! surface boundary condition … … 255 269 IF( lk_trabbl ) CALL tra_bbl ( kstp ) ! advective (and/or diffusive) bottom boundary layer scheme 256 270 IF( ln_tradmp ) CALL tra_dmp ( kstp ) ! internal damping trends 271 IF( ln_bias ) CALL tra_bias ( kstp ) 257 272 IF( lk_bdy ) CALL bdy_tra_dmp( kstp ) ! bdy damping trends 258 273 CALL tra_adv ( kstp ) ! horizontal & vertical advection … … 270 285 IF( ln_zdfnpc ) CALL tra_npc( kstp ) ! update after fields by non-penetrative convection 271 286 CALL tra_nxt( kstp ) ! tracer fields at next time step 272 IF( ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations273 287 CALL eos ( tsa, rhd, rhop, fsdept_n(:,:,:) ) ! Time-filtered in situ density for hpg computation 274 288 IF( ln_zps .AND. .NOT. ln_isfcav) & … … 279 293 & rhd, gru , grv , aru , arv , gzu , gzv , ge3ru , ge3rv , & 280 294 & gtui, gtvi, grui, grvi, arui, arvi, gzui, gzvi, ge3rui, ge3rvi ) ! of t, s, rd at the last ocean level 295 IF( ln_bias ) CALL dyn_bias( kstp ) 281 296 ELSE ! centered hpg (eos then time stepping) 282 297 IF ( .NOT. lk_dynspg_ts ) THEN ! eos already called in time-split case 283 IF( ln_sto_eos ) CALL sto_pts( tsn ) ! Random T/S fluctuations284 298 CALL eos ( tsn, rhd, rhop, fsdept_n(:,:,:) ) ! now in situ density for hpg computation 285 299 IF( ln_zps .AND. .NOT. ln_isfcav) & … … 293 307 IF( ln_zdfnpc ) CALL tra_npc( kstp ) ! update after fields by non-penetrative convection 294 308 CALL tra_nxt( kstp ) ! tracer fields at next time step 309 IF( ln_bias ) CALL dyn_bias( kstp ) 295 310 ENDIF 296 311 … … 314 329 va(:,:,:) = 0.e0 315 330 316 IF( l n_asmiau .AND. &331 IF( lk_asminc .AND. ln_asmiau .AND. & 317 332 & ln_dyninc ) CALL dyn_asm_inc( kstp ) ! apply dynamics assimilation increment 318 333 IF( ln_bkgwri ) CALL asm_bkg_wri( kstp ) ! output background fields … … 335 350 CALL ssh_swp( kstp ) ! swap of sea surface height 336 351 IF( lk_vvl ) CALL dom_vvl_sf_swp( kstp ) ! swap of vertical scale factors 337 352 ! 353 IF( lrst_oce ) CALL rst_write( kstp ) ! write output ocean restart file 354 IF( ln_sto_eos ) CALL sto_rst_write( kstp ) ! write restart file for stochastic parameters 355 356 #if defined key_agrif 357 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 358 ! AGRIF 359 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 360 CALL Agrif_Integrate_ChildGrids( stp ) 361 362 IF ( Agrif_NbStepint().EQ.0 ) THEN 363 CALL Agrif_Update_Tra() ! Update active tracers 364 CALL Agrif_Update_Dyn() ! Update momentum 365 ENDIF 366 #endif 338 367 IF( ln_diahsb ) CALL dia_hsb( kstp ) ! - ML - global conservation diagnostics 339 368 IF( lk_diaobs ) CALL dia_obs( kstp ) ! obs-minus-model (assimilation) diagnostics (call after dynamics update) 340 369 341 370 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 342 ! Control and restarts371 ! Control 343 372 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 344 373 CALL stp_ctl( kstp, indic ) … … 352 381 IF( lwm.AND.numoni /= -1 ) CALL FLUSH ( numoni ) ! flush output namelist ice 353 382 ENDIF 354 IF( lrst_oce ) CALL rst_write ( kstp ) ! write output ocean restart file 383 384 385 IF( lrst_bias ) CALL bias_wrt ( kstp ) 355 386 356 387 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 357 388 ! Coupled mode 358 389 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 359 IF( lk_oasis ) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges390 !IF( lk_oasis ) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges 360 391 ! 361 392 #if defined key_iomput … … 367 398 ! 368 399 IF( nn_timing == 1 .AND. kstp == nit000 ) CALL timing_reset 400 ! 369 401 ! 370 402 END SUBROUTINE stp -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/step_oce.F90
r7960 r9987 88 88 89 89 USE diawri ! Standard run outputs (dia_wri routine) 90 USE diaprod ! Product diagnostics (dia_prod routine) 90 91 USE diaptr ! poleward transports (dia_ptr routine) 91 92 USE diadct ! sections transports (dia_dct routine) … … 99 100 100 101 USE crsfld ! Standard output on coarse grid (crs_fld routine) 101 102 USE biaspar ! bias param 103 USE bias ! bias routines (tra_bias routine 104 ! dyn_bias routine) 102 105 USE asminc ! assimilation increments (tra_asm_inc routine) 103 106 ! (dyn_asm_inc routine) … … 112 115 #if defined key_agrif 113 116 USE agrif_opa_sponge ! Momemtum and tracers sponges 117 USE agrif_opa_update ! Update (2-way nesting) 114 118 #endif 115 119 #if defined key_top -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/stpctl.F90
r7960 r9987 17 17 USE dom_oce ! ocean space and time domain variables 18 18 USE sol_oce ! ocean space and time domain variables 19 USE sbc_oce ! surface boundary conditions variables 19 20 USE in_out_manager ! I/O manager 20 21 USE lbclnk ! ocean lateral boundary conditions (or mpp link) … … 22 23 USE dynspg_oce ! pressure gradient schemes 23 24 USE c1d ! 1D vertical configuration 25 24 26 25 27 IMPLICIT NONE … … 52 54 INTEGER, INTENT( inout ) :: kindic ! indicator of solver convergence 53 55 !! 56 CHARACTER(len = 32) :: clfname ! time stepping output file name 54 57 INTEGER :: ji, jj, jk ! dummy loop indices 55 58 INTEGER :: ii, ij, ik ! temporary integers … … 63 66 WRITE(numout,*) 'stp_ctl : time-stepping control' 64 67 WRITE(numout,*) '~~~~~~~' 65 ! open time.step file 66 CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 68 ! open time.step file with special treatment for SAS 69 IF ( nn_components == jp_iam_sas ) THEN 70 clfname = 'time.step.sas' 71 ELSE 72 clfname = 'time.step' 73 ENDIF 74 CALL ctl_opn( numstp, TRIM(clfname), 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 67 75 ENDIF 68 76 -
branches/UKMO/dev_r5518_obs_oper_update_icethick/NEMOGCM/NEMO/OPA_SRC/wrk_nemo.F90
r7960 r9987 453 453 SUBROUTINE wrk_allocbase( kidim , kjdim , kkdim , kldim , kisrt , kjsrt , kksrt , klsrt , & 454 454 & kwrk1d, kwrk2d, kwrk3d, kwrk4d, pwrk1d, pwrk2d, pwrk3d, pwrk4d ) 455 USE in_out_manager, ONLY: numout 455 456 INTEGER , INTENT(in ) :: kidim, kjdim, kkdim, kldim 456 457 INTEGER , INTENT(in ) :: kisrt, kjsrt, kksrt, klsrt … … 483 484 & .AND. SUM( tree(ii)%ishape ) /= 0 ) 484 485 ii = ii + 1 485 IF (ii > jparray) STOP ! increase the value of jparray (should not be needed as already very big!) 486 IF (ii > jparray) THEN 487 WRITE(numout,*) "E R R O R: NEMO aborted wrk_allocbase" 488 FLUSH(numout) 489 STOP 'Increase the value of jparray' 490 ! increase the value of jparray (should not be needed as already very big!) 491 END IF 486 492 END DO 487 493
Note: See TracChangeset
for help on using the changeset viewer.