[2848] | 1 | MODULE diadct |
---|
[6140] | 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE diadct *** |
---|
| 4 | !! Ocean diagnostics: Compute the transport trough a sec. |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : OPA ! 02/1999 (Y Drillet) original code |
---|
| 7 | !! ! 10/2001 (Y Drillet, R Bourdalle Badie) |
---|
| 8 | !! NEMO 1.0 ! 10/2005 (M Laborie) F90 |
---|
| 9 | !! 3.0 ! 04/2007 (G Garric) Ice sections |
---|
| 10 | !! - ! 04/2007 (C Bricaud) test on sec%nb_point, initialisation of ztransp1,ztransp2,... |
---|
| 11 | !! 3.4 ! 09/2011 (C Bricaud) |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
[11536] | 13 | #if ! defined key_agrif |
---|
[13237] | 14 | !! ==>> CAUTION: does not work with agrif |
---|
[6140] | 15 | !!---------------------------------------------------------------------- |
---|
| 16 | !! dia_dct : Compute the transport through a sec. |
---|
| 17 | !! dia_dct_init : Read namelist. |
---|
| 18 | !! readsec : Read sections description and pathway |
---|
| 19 | !! removepoints : Remove points which are common to 2 procs |
---|
| 20 | !! transport : Compute transport for each sections |
---|
| 21 | !! dia_dct_wri : Write tranports results in ascii files |
---|
| 22 | !! interp : Compute temperature/salinity/density at U-point or V-point |
---|
| 23 | !! |
---|
| 24 | !!---------------------------------------------------------------------- |
---|
| 25 | USE oce ! ocean dynamics and tracers |
---|
| 26 | USE dom_oce ! ocean space and time domain |
---|
| 27 | USE phycst ! physical constants |
---|
| 28 | USE in_out_manager ! I/O manager |
---|
| 29 | USE daymod ! calendar |
---|
| 30 | USE dianam ! build name of file |
---|
| 31 | USE lib_mpp ! distributed memory computing library |
---|
[9570] | 32 | #if defined key_si3 |
---|
[6140] | 33 | USE ice |
---|
[3632] | 34 | #endif |
---|
[6140] | 35 | USE domvvl |
---|
| 36 | USE timing ! preformance summary |
---|
[2848] | 37 | |
---|
[6140] | 38 | IMPLICIT NONE |
---|
| 39 | PRIVATE |
---|
[2848] | 40 | |
---|
[6140] | 41 | PUBLIC dia_dct ! routine called by step.F90 |
---|
[11536] | 42 | PUBLIC dia_dct_init ! routine called by nemogcm.F90 |
---|
[2848] | 43 | |
---|
[11536] | 44 | ! !!** namelist variables ** |
---|
| 45 | LOGICAL, PUBLIC :: ln_diadct !: Calculate transport thru a section or not |
---|
| 46 | INTEGER :: nn_dct ! Frequency of computation |
---|
| 47 | INTEGER :: nn_dctwri ! Frequency of output |
---|
| 48 | INTEGER :: nn_secdebug ! Number of the section to debug |
---|
[2848] | 49 | |
---|
[6140] | 50 | INTEGER, PARAMETER :: nb_class_max = 10 |
---|
| 51 | INTEGER, PARAMETER :: nb_sec_max = 150 |
---|
| 52 | INTEGER, PARAMETER :: nb_point_max = 2000 |
---|
| 53 | INTEGER, PARAMETER :: nb_type_class = 10 |
---|
| 54 | INTEGER, PARAMETER :: nb_3d_vars = 3 |
---|
| 55 | INTEGER, PARAMETER :: nb_2d_vars = 2 |
---|
| 56 | INTEGER :: nb_sec |
---|
[2927] | 57 | |
---|
[6140] | 58 | TYPE POINT_SECTION |
---|
| 59 | INTEGER :: I,J |
---|
| 60 | END TYPE POINT_SECTION |
---|
[2848] | 61 | |
---|
[6140] | 62 | TYPE COORD_SECTION |
---|
| 63 | REAL(wp) :: lon,lat |
---|
| 64 | END TYPE COORD_SECTION |
---|
[2848] | 65 | |
---|
[6140] | 66 | TYPE SECTION |
---|
| 67 | CHARACTER(len=60) :: name ! name of the sec |
---|
[13237] | 68 | LOGICAL :: llstrpond ! true if you want the computation of salt and heat transports |
---|
[6140] | 69 | LOGICAL :: ll_ice_section ! ice surface and ice volume computation |
---|
| 70 | LOGICAL :: ll_date_line ! = T if the section crosses the date-line |
---|
| 71 | TYPE(COORD_SECTION), DIMENSION(2) :: coordSec ! longitude and latitude of the extremities of the sec |
---|
| 72 | INTEGER :: nb_class ! number of boundaries for density classes |
---|
| 73 | INTEGER, DIMENSION(nb_point_max) :: direction ! vector direction of the point in the section |
---|
| 74 | CHARACTER(len=40),DIMENSION(nb_class_max) :: classname ! characteristics of the class |
---|
[13237] | 75 | REAL(wp), DIMENSION(nb_class_max) :: zsigi ! in-situ density classes (99 if you don't want) |
---|
| 76 | REAL(wp), DIMENSION(nb_class_max) :: zsigp ! potential density classes (99 if you don't want) |
---|
| 77 | REAL(wp), DIMENSION(nb_class_max) :: zsal ! salinity classes (99 if you don't want) |
---|
| 78 | REAL(wp), DIMENSION(nb_class_max) :: ztem ! temperature classes(99 if you don't want) |
---|
| 79 | REAL(wp), DIMENSION(nb_class_max) :: zlay ! level classes (99 if you don't want) |
---|
[6140] | 80 | REAL(wp), DIMENSION(nb_type_class,nb_class_max) :: transport ! transport output |
---|
| 81 | REAL(wp) :: slopeSection ! slope of the section |
---|
| 82 | INTEGER :: nb_point ! number of points in the section |
---|
| 83 | TYPE(POINT_SECTION),DIMENSION(nb_point_max) :: listPoint ! list of points in the sections |
---|
| 84 | END TYPE SECTION |
---|
[2848] | 85 | |
---|
[6140] | 86 | TYPE(SECTION),DIMENSION(nb_sec_max) :: secs ! Array of sections |
---|
[2848] | 87 | |
---|
[6140] | 88 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: transports_3d |
---|
| 89 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: transports_2d |
---|
[3680] | 90 | |
---|
[13237] | 91 | |
---|
| 92 | !! * Substitutions |
---|
| 93 | # include "domzgr_substitute.h90" |
---|
[6140] | 94 | !!---------------------------------------------------------------------- |
---|
[9598] | 95 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[5215] | 96 | !! $Id$ |
---|
[10068] | 97 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[6140] | 98 | !!---------------------------------------------------------------------- |
---|
[13237] | 99 | |
---|
[2848] | 100 | CONTAINS |
---|
[3680] | 101 | |
---|
[11536] | 102 | INTEGER FUNCTION diadct_alloc() |
---|
| 103 | !!---------------------------------------------------------------------- |
---|
| 104 | !! *** FUNCTION diadct_alloc *** |
---|
| 105 | !!---------------------------------------------------------------------- |
---|
[3680] | 106 | |
---|
[11536] | 107 | ALLOCATE( transports_3d(nb_3d_vars,nb_sec_max,nb_point_max,jpk), & |
---|
| 108 | & transports_2d(nb_2d_vars,nb_sec_max,nb_point_max) , STAT=diadct_alloc ) |
---|
[3680] | 109 | |
---|
[11536] | 110 | CALL mpp_sum( 'diadct', diadct_alloc ) |
---|
| 111 | IF( diadct_alloc /= 0 ) CALL ctl_stop( 'STOP', 'diadct_alloc: failed to allocate arrays' ) |
---|
[3680] | 112 | |
---|
[11536] | 113 | END FUNCTION diadct_alloc |
---|
[6140] | 114 | |
---|
[9124] | 115 | SUBROUTINE dia_dct_init |
---|
| 116 | !!--------------------------------------------------------------------- |
---|
| 117 | !! *** ROUTINE diadct *** |
---|
| 118 | !! |
---|
| 119 | !! ** Purpose: Read the namelist parameters |
---|
| 120 | !! Open output files |
---|
| 121 | !! |
---|
| 122 | !!--------------------------------------------------------------------- |
---|
| 123 | INTEGER :: ios ! Local integer output status for namelist read |
---|
| 124 | !! |
---|
[11536] | 125 | NAMELIST/nam_diadct/ln_diadct, nn_dct, nn_dctwri, nn_secdebug |
---|
[9124] | 126 | !!--------------------------------------------------------------------- |
---|
[2848] | 127 | |
---|
[11536] | 128 | READ ( numnam_ref, nam_diadct, IOSTAT = ios, ERR = 901) |
---|
| 129 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diadct in reference namelist' ) |
---|
[2848] | 130 | |
---|
[11536] | 131 | READ ( numnam_cfg, nam_diadct, IOSTAT = ios, ERR = 902 ) |
---|
| 132 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nam_diadct in configuration namelist' ) |
---|
| 133 | IF(lwm) WRITE ( numond, nam_diadct ) |
---|
[4147] | 134 | |
---|
[2848] | 135 | IF( lwp ) THEN |
---|
| 136 | WRITE(numout,*) " " |
---|
| 137 | WRITE(numout,*) "diadct_init: compute transports through sections " |
---|
| 138 | WRITE(numout,*) "~~~~~~~~~~~~~~~~~~~~~" |
---|
[11536] | 139 | WRITE(numout,*) " Calculate transport thru sections: ln_diadct = ", ln_diadct |
---|
| 140 | WRITE(numout,*) " Frequency of computation: nn_dct = ", nn_dct |
---|
| 141 | WRITE(numout,*) " Frequency of write: nn_dctwri = ", nn_dctwri |
---|
[2848] | 142 | |
---|
| 143 | IF ( nn_secdebug .GE. 1 .AND. nn_secdebug .LE. nb_sec_max )THEN |
---|
| 144 | WRITE(numout,*)" Debug section number: ", nn_secdebug |
---|
| 145 | ELSE IF ( nn_secdebug == 0 )THEN ; WRITE(numout,*)" No section to debug" |
---|
| 146 | ELSE IF ( nn_secdebug == -1 )THEN ; WRITE(numout,*)" Debug all sections" |
---|
| 147 | ELSE ; WRITE(numout,*)" Wrong value for nn_secdebug : ",nn_secdebug |
---|
| 148 | ENDIF |
---|
[11536] | 149 | ENDIF |
---|
[2848] | 150 | |
---|
[11536] | 151 | IF( ln_diadct ) THEN |
---|
| 152 | ! control |
---|
[2848] | 153 | IF(nn_dct .GE. nn_dctwri .AND. MOD(nn_dct,nn_dctwri) .NE. 0) & |
---|
[11536] | 154 | & CALL ctl_stop( 'diadct: nn_dct should be smaller and a multiple of nn_dctwri' ) |
---|
[2848] | 155 | |
---|
[11536] | 156 | ! allocate dia_dct arrays |
---|
| 157 | IF( diadct_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'diadct_alloc: failed to allocate arrays' ) |
---|
[2848] | 158 | |
---|
[11536] | 159 | !Read section_ijglobal.diadct |
---|
| 160 | CALL readsec |
---|
[2848] | 161 | |
---|
[11536] | 162 | !open output file |
---|
| 163 | IF( lwm ) THEN |
---|
| 164 | CALL ctl_opn( numdct_vol, 'volume_transport', 'NEW', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) |
---|
| 165 | CALL ctl_opn( numdct_heat, 'heat_transport' , 'NEW', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) |
---|
| 166 | CALL ctl_opn( numdct_salt, 'salt_transport' , 'NEW', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) |
---|
| 167 | ENDIF |
---|
| 168 | |
---|
| 169 | ! Initialise arrays to zero |
---|
| 170 | transports_3d(:,:,:,:)=0.0 |
---|
| 171 | transports_2d(:,:,:) =0.0 |
---|
| 172 | ! |
---|
[2927] | 173 | ENDIF |
---|
[3294] | 174 | ! |
---|
[2848] | 175 | END SUBROUTINE dia_dct_init |
---|
| 176 | |
---|
| 177 | |
---|
[12377] | 178 | SUBROUTINE dia_dct( kt, Kmm ) |
---|
[2848] | 179 | !!--------------------------------------------------------------------- |
---|
| 180 | !! *** ROUTINE diadct *** |
---|
| 181 | !! |
---|
[3680] | 182 | !! Purpose :: Compute section transports and write it in numdct files |
---|
| 183 | !! |
---|
| 184 | !! Method :: All arrays initialised to zero in dct_init |
---|
| 185 | !! Each nn_dct time step call subroutine 'transports' for |
---|
| 186 | !! each section to sum the transports over each grid cell. |
---|
| 187 | !! Each nn_dctwri time step: |
---|
| 188 | !! Divide the arrays by the number of summations to gain |
---|
| 189 | !! an average value |
---|
| 190 | !! Call dia_dct_sum to sum relevant grid boxes to obtain |
---|
| 191 | !! totals for each class (density, depth, temp or sal) |
---|
| 192 | !! Call dia_dct_wri to write the transports into file |
---|
| 193 | !! Reinitialise all relevant arrays to zero |
---|
[2848] | 194 | !!--------------------------------------------------------------------- |
---|
[12377] | 195 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
| 196 | INTEGER, INTENT(in) :: Kmm ! time level index |
---|
[6140] | 197 | ! |
---|
[9124] | 198 | INTEGER :: jsec ! loop on sections |
---|
| 199 | INTEGER :: itotal ! nb_sec_max*nb_type_class*nb_class_max |
---|
| 200 | LOGICAL :: lldebug =.FALSE. ! debug a section |
---|
| 201 | INTEGER , DIMENSION(1) :: ish ! work array for mpp_sum |
---|
| 202 | INTEGER , DIMENSION(3) :: ish2 ! " |
---|
| 203 | REAL(wp), ALLOCATABLE, DIMENSION(:) :: zwork ! " |
---|
| 204 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:):: zsum ! " |
---|
[2848] | 205 | !!--------------------------------------------------------------------- |
---|
[6140] | 206 | ! |
---|
[9124] | 207 | IF( ln_timing ) CALL timing_start('dia_dct') |
---|
[2848] | 208 | |
---|
[3294] | 209 | IF( lk_mpp )THEN |
---|
| 210 | itotal = nb_sec_max*nb_type_class*nb_class_max |
---|
[9124] | 211 | ALLOCATE( zwork(itotal) , zsum(nb_sec_max,nb_type_class,nb_class_max) ) |
---|
[3294] | 212 | ENDIF |
---|
| 213 | |
---|
[3680] | 214 | ! Initialise arrays |
---|
| 215 | zwork(:) = 0.0 |
---|
| 216 | zsum(:,:,:) = 0.0 |
---|
| 217 | |
---|
[2848] | 218 | IF( lwp .AND. kt==nit000+nn_dct-1 ) THEN |
---|
| 219 | WRITE(numout,*) " " |
---|
| 220 | WRITE(numout,*) "diadct: compute transport" |
---|
| 221 | WRITE(numout,*) "~~~~~~~~~~~~~~~~~~~~~~~~~" |
---|
| 222 | WRITE(numout,*) "nb_sec = ",nb_sec |
---|
| 223 | ENDIF |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | ! Compute transport and write only at nn_dctwri |
---|
| 227 | IF( MOD(kt,nn_dct)==0 ) THEN |
---|
| 228 | |
---|
| 229 | DO jsec=1,nb_sec |
---|
| 230 | |
---|
| 231 | !debug this section computing ? |
---|
| 232 | lldebug=.FALSE. |
---|
[8126] | 233 | IF( (jsec==nn_secdebug .OR. nn_secdebug==-1) .AND. kt==nit000+nn_dct-1 ) lldebug=.TRUE. |
---|
[2848] | 234 | |
---|
| 235 | !Compute transport through section |
---|
[12377] | 236 | CALL transport(Kmm,secs(jsec),lldebug,jsec) |
---|
[2908] | 237 | |
---|
| 238 | ENDDO |
---|
[2848] | 239 | |
---|
[2908] | 240 | IF( MOD(kt,nn_dctwri)==0 )THEN |
---|
[2848] | 241 | |
---|
[8126] | 242 | IF( kt==nit000+nn_dctwri-1 )WRITE(numout,*)" diadct: average transports and write at kt = ",kt |
---|
[2848] | 243 | |
---|
[3680] | 244 | !! divide arrays by nn_dctwri/nn_dct to obtain average |
---|
| 245 | transports_3d(:,:,:,:)=transports_3d(:,:,:,:)/(nn_dctwri/nn_dct) |
---|
| 246 | transports_2d(:,:,:) =transports_2d(:,:,:) /(nn_dctwri/nn_dct) |
---|
| 247 | |
---|
| 248 | ! Sum over each class |
---|
| 249 | DO jsec=1,nb_sec |
---|
[12377] | 250 | CALL dia_dct_sum(Kmm,secs(jsec),jsec) |
---|
[3680] | 251 | ENDDO |
---|
| 252 | |
---|
[2908] | 253 | !Sum on all procs |
---|
| 254 | IF( lk_mpp )THEN |
---|
| 255 | ish(1) = nb_sec_max*nb_type_class*nb_class_max |
---|
| 256 | ish2 = (/nb_sec_max,nb_type_class,nb_class_max/) |
---|
| 257 | DO jsec=1,nb_sec ; zsum(jsec,:,:) = secs(jsec)%transport(:,:) ; ENDDO |
---|
| 258 | zwork(:)= RESHAPE(zsum(:,:,:), ish ) |
---|
[10425] | 259 | CALL mpp_sum('diadct', zwork, ish(1)) |
---|
[2908] | 260 | zsum(:,:,:)= RESHAPE(zwork,ish2) |
---|
| 261 | DO jsec=1,nb_sec ; secs(jsec)%transport(:,:) = zsum(jsec,:,:) ; ENDDO |
---|
| 262 | ENDIF |
---|
| 263 | |
---|
| 264 | !Write the transport |
---|
| 265 | DO jsec=1,nb_sec |
---|
| 266 | |
---|
[5505] | 267 | IF( lwm )CALL dia_dct_wri(kt,jsec,secs(jsec)) |
---|
[2848] | 268 | |
---|
| 269 | !nullify transports values after writing |
---|
[3680] | 270 | transports_3d(:,jsec,:,:)=0. |
---|
| 271 | transports_2d(:,jsec,: )=0. |
---|
[2848] | 272 | secs(jsec)%transport(:,:)=0. |
---|
| 273 | |
---|
[2908] | 274 | ENDDO |
---|
| 275 | |
---|
| 276 | ENDIF |
---|
| 277 | |
---|
[2848] | 278 | ENDIF |
---|
| 279 | |
---|
[3294] | 280 | IF( lk_mpp )THEN |
---|
| 281 | itotal = nb_sec_max*nb_type_class*nb_class_max |
---|
[9124] | 282 | DEALLOCATE( zwork , zsum ) |
---|
[3294] | 283 | ENDIF |
---|
| 284 | |
---|
[9124] | 285 | IF( ln_timing ) CALL timing_stop('dia_dct') |
---|
[3294] | 286 | ! |
---|
[2848] | 287 | END SUBROUTINE dia_dct |
---|
| 288 | |
---|
[9124] | 289 | |
---|
[2848] | 290 | SUBROUTINE readsec |
---|
| 291 | !!--------------------------------------------------------------------- |
---|
| 292 | !! *** ROUTINE readsec *** |
---|
| 293 | !! |
---|
[2854] | 294 | !! ** Purpose: |
---|
| 295 | !! Read a binary file(section_ijglobal.diadct) |
---|
| 296 | !! generated by the tools "NEMOGCM/TOOLS/SECTIONS_DIADCT" |
---|
| 297 | !! |
---|
| 298 | !! |
---|
[2848] | 299 | !!--------------------------------------------------------------------- |
---|
| 300 | INTEGER :: iptglo , iptloc ! Global and local number of points for a section |
---|
| 301 | INTEGER :: isec, iiglo, ijglo, iiloc, ijloc,iost,i1 ,i2 ! temporary integer |
---|
| 302 | INTEGER :: jsec, jpt ! dummy loop indices |
---|
| 303 | INTEGER, DIMENSION(2) :: icoord |
---|
[9124] | 304 | LOGICAL :: llbon, lldebug ! local logical |
---|
| 305 | CHARACTER(len=160) :: clname ! filename |
---|
[2927] | 306 | CHARACTER(len=200) :: cltmp |
---|
[9124] | 307 | CHARACTER(len=200) :: clformat !automatic format |
---|
| 308 | TYPE(POINT_SECTION),DIMENSION(nb_point_max) ::coordtemp !contains listpoints coordinates read in the file |
---|
| 309 | INTEGER, DIMENSION(nb_point_max) :: directemp !contains listpoints directions read in the files |
---|
[2848] | 310 | !!------------------------------------------------------------------------------------- |
---|
| 311 | |
---|
| 312 | !open input file |
---|
| 313 | !--------------- |
---|
| 314 | CALL ctl_opn( numdct_in, 'section_ijglobal.diadct', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) |
---|
| 315 | |
---|
| 316 | !--------------- |
---|
| 317 | !Read input file |
---|
| 318 | !--------------- |
---|
| 319 | |
---|
| 320 | DO jsec=1,nb_sec_max !loop on the nb_sec sections |
---|
| 321 | |
---|
[8126] | 322 | IF ( jsec==nn_secdebug .OR. nn_secdebug==-1 ) & |
---|
[2848] | 323 | & WRITE(numout,*)'debuging for section number: ',jsec |
---|
| 324 | |
---|
| 325 | !initialization |
---|
| 326 | !--------------- |
---|
| 327 | secs(jsec)%name='' |
---|
| 328 | secs(jsec)%llstrpond = .FALSE. ; secs(jsec)%ll_ice_section = .FALSE. |
---|
| 329 | secs(jsec)%ll_date_line = .FALSE. ; secs(jsec)%nb_class = 0 |
---|
| 330 | secs(jsec)%zsigi = 99._wp ; secs(jsec)%zsigp = 99._wp |
---|
| 331 | secs(jsec)%zsal = 99._wp ; secs(jsec)%ztem = 99._wp |
---|
| 332 | secs(jsec)%zlay = 99._wp |
---|
| 333 | secs(jsec)%transport = 0._wp ; secs(jsec)%nb_point = 0 |
---|
| 334 | |
---|
| 335 | !read section's number / name / computing choices / classes / slopeSection / points number |
---|
| 336 | !----------------------------------------------------------------------------------------- |
---|
| 337 | READ(numdct_in,iostat=iost)isec |
---|
| 338 | IF (iost .NE. 0 )EXIT !end of file |
---|
[2912] | 339 | WRITE(cltmp,'(a,i4.4,a,i4.4)')'diadct: read sections : Problem of section number: isec= ',isec,' and jsec= ',jsec |
---|
[2848] | 340 | IF( jsec .NE. isec ) CALL ctl_stop( cltmp ) |
---|
| 341 | |
---|
[8126] | 342 | IF( jsec==nn_secdebug .OR. nn_secdebug==-1 )WRITE(numout,*)"isec ",isec |
---|
[2848] | 343 | |
---|
| 344 | READ(numdct_in)secs(jsec)%name |
---|
| 345 | READ(numdct_in)secs(jsec)%llstrpond |
---|
| 346 | READ(numdct_in)secs(jsec)%ll_ice_section |
---|
| 347 | READ(numdct_in)secs(jsec)%ll_date_line |
---|
| 348 | READ(numdct_in)secs(jsec)%coordSec |
---|
| 349 | READ(numdct_in)secs(jsec)%nb_class |
---|
| 350 | READ(numdct_in)secs(jsec)%zsigi |
---|
| 351 | READ(numdct_in)secs(jsec)%zsigp |
---|
| 352 | READ(numdct_in)secs(jsec)%zsal |
---|
| 353 | READ(numdct_in)secs(jsec)%ztem |
---|
| 354 | READ(numdct_in)secs(jsec)%zlay |
---|
| 355 | READ(numdct_in)secs(jsec)%slopeSection |
---|
| 356 | READ(numdct_in)iptglo |
---|
| 357 | |
---|
| 358 | !debug |
---|
| 359 | !----- |
---|
[2927] | 360 | |
---|
[8126] | 361 | IF( jsec==nn_secdebug .OR. nn_secdebug==-1 )THEN |
---|
[2927] | 362 | |
---|
| 363 | WRITE(clformat,'(a,i2,a)') '(A40,', nb_class_max,'(f8.3,1X))' |
---|
| 364 | |
---|
| 365 | WRITE(numout,*) " Section name : ",TRIM(secs(jsec)%name) |
---|
| 366 | WRITE(numout,*) " Compute heat and salt transport ? ",secs(jsec)%llstrpond |
---|
| 367 | WRITE(numout,*) " Compute ice transport ? ",secs(jsec)%ll_ice_section |
---|
| 368 | WRITE(numout,*) " Section crosses date-line ? ",secs(jsec)%ll_date_line |
---|
| 369 | WRITE(numout,*) " Slope section : ",secs(jsec)%slopeSection |
---|
| 370 | WRITE(numout,*) " Number of points in the section: ",iptglo |
---|
| 371 | WRITE(numout,*) " Number of classes ",secs(jsec)%nb_class |
---|
| 372 | WRITE(numout,clformat)" Insitu density classes : ",secs(jsec)%zsigi |
---|
| 373 | WRITE(numout,clformat)" Potential density classes : ",secs(jsec)%zsigp |
---|
| 374 | WRITE(numout,clformat)" Salinity classes : ",secs(jsec)%zsal |
---|
| 375 | WRITE(numout,clformat)" Temperature classes : ",secs(jsec)%ztem |
---|
| 376 | WRITE(numout,clformat)" Depth classes : ",secs(jsec)%zlay |
---|
[2848] | 377 | ENDIF |
---|
| 378 | |
---|
[7646] | 379 | IF( iptglo /= 0 )THEN |
---|
[2848] | 380 | |
---|
| 381 | !read points'coordinates and directions |
---|
| 382 | !-------------------------------------- |
---|
| 383 | coordtemp(:) = POINT_SECTION(0,0) !list of points read |
---|
| 384 | directemp(:) = 0 !value of directions of each points |
---|
| 385 | DO jpt=1,iptglo |
---|
[7646] | 386 | READ(numdct_in) i1, i2 |
---|
[2848] | 387 | coordtemp(jpt)%I = i1 |
---|
| 388 | coordtemp(jpt)%J = i2 |
---|
| 389 | ENDDO |
---|
[7646] | 390 | READ(numdct_in) directemp(1:iptglo) |
---|
[2848] | 391 | |
---|
| 392 | !debug |
---|
| 393 | !----- |
---|
[8126] | 394 | IF( jsec==nn_secdebug .OR. nn_secdebug==-1 )THEN |
---|
[2848] | 395 | WRITE(numout,*)" List of points in global domain:" |
---|
| 396 | DO jpt=1,iptglo |
---|
[3632] | 397 | WRITE(numout,*)' # I J ',jpt,coordtemp(jpt),directemp(jpt) |
---|
[2848] | 398 | ENDDO |
---|
| 399 | ENDIF |
---|
| 400 | |
---|
| 401 | !Now each proc selects only points that are in its domain: |
---|
| 402 | !-------------------------------------------------------- |
---|
[7646] | 403 | iptloc = 0 ! initialize number of points selected |
---|
| 404 | DO jpt = 1, iptglo ! loop on listpoint read in the file |
---|
| 405 | ! |
---|
[2848] | 406 | iiglo=coordtemp(jpt)%I ! global coordinates of the point |
---|
| 407 | ijglo=coordtemp(jpt)%J ! " |
---|
| 408 | |
---|
[7646] | 409 | IF( iiglo==jpiglo .AND. nimpp==1 ) iiglo = 2 !!gm BUG: Hard coded periodicity ! |
---|
[2848] | 410 | |
---|
[7646] | 411 | iiloc=iiglo-nimpp+1 ! local coordinates of the point |
---|
| 412 | ijloc=ijglo-njmpp+1 ! " |
---|
[2848] | 413 | |
---|
| 414 | !verify if the point is on the local domain:(1,nlei)*(1,nlej) |
---|
[7646] | 415 | IF( iiloc >= 1 .AND. iiloc <= nlei .AND. & |
---|
| 416 | ijloc >= 1 .AND. ijloc <= nlej )THEN |
---|
[2848] | 417 | iptloc = iptloc + 1 ! count local points |
---|
| 418 | secs(jsec)%listPoint(iptloc) = POINT_SECTION(mi0(iiglo),mj0(ijglo)) ! store local coordinates |
---|
[2912] | 419 | secs(jsec)%direction(iptloc) = directemp(jpt) ! store local direction |
---|
[2848] | 420 | ENDIF |
---|
[7646] | 421 | ! |
---|
| 422 | END DO |
---|
[2848] | 423 | |
---|
| 424 | secs(jsec)%nb_point=iptloc !store number of section's points |
---|
| 425 | |
---|
| 426 | !debug |
---|
| 427 | !----- |
---|
[8126] | 428 | IF( jsec==nn_secdebug .OR. nn_secdebug==-1 )THEN |
---|
[2848] | 429 | WRITE(numout,*)" List of points selected by the proc:" |
---|
| 430 | DO jpt = 1,iptloc |
---|
[7646] | 431 | iiglo = secs(jsec)%listPoint(jpt)%I + nimpp - 1 |
---|
| 432 | ijglo = secs(jsec)%listPoint(jpt)%J + njmpp - 1 |
---|
[2848] | 433 | WRITE(numout,*)' # I J : ',iiglo,ijglo |
---|
| 434 | ENDDO |
---|
| 435 | ENDIF |
---|
| 436 | |
---|
[3294] | 437 | IF(jsec==nn_secdebug .AND. secs(jsec)%nb_point .NE. 0)THEN |
---|
| 438 | DO jpt = 1,iptloc |
---|
[7646] | 439 | iiglo = secs(jsec)%listPoint(jpt)%I + nimpp - 1 |
---|
| 440 | ijglo = secs(jsec)%listPoint(jpt)%J + njmpp - 1 |
---|
[3294] | 441 | ENDDO |
---|
| 442 | ENDIF |
---|
| 443 | |
---|
[2848] | 444 | !remove redundant points between processors |
---|
[2908] | 445 | !------------------------------------------ |
---|
[8126] | 446 | lldebug = .FALSE. ; IF ( jsec==nn_secdebug .OR. nn_secdebug==-1 ) lldebug = .TRUE. |
---|
[2848] | 447 | IF( iptloc .NE. 0 )THEN |
---|
| 448 | CALL removepoints(secs(jsec),'I','top_list',lldebug) |
---|
| 449 | CALL removepoints(secs(jsec),'I','bot_list',lldebug) |
---|
| 450 | CALL removepoints(secs(jsec),'J','top_list',lldebug) |
---|
| 451 | CALL removepoints(secs(jsec),'J','bot_list',lldebug) |
---|
| 452 | ENDIF |
---|
[3294] | 453 | IF(jsec==nn_secdebug .AND. secs(jsec)%nb_point .NE. 0)THEN |
---|
| 454 | DO jpt = 1,secs(jsec)%nb_point |
---|
[7646] | 455 | iiglo = secs(jsec)%listPoint(jpt)%I + nimpp - 1 |
---|
| 456 | ijglo = secs(jsec)%listPoint(jpt)%J + njmpp - 1 |
---|
[3294] | 457 | ENDDO |
---|
| 458 | ENDIF |
---|
[2848] | 459 | |
---|
| 460 | !debug |
---|
| 461 | !----- |
---|
[8126] | 462 | IF( jsec==nn_secdebug .OR. nn_secdebug==-1 )THEN |
---|
[2848] | 463 | WRITE(numout,*)" List of points after removepoints:" |
---|
[3294] | 464 | iptloc = secs(jsec)%nb_point |
---|
[2848] | 465 | DO jpt = 1,iptloc |
---|
[7646] | 466 | iiglo = secs(jsec)%listPoint(jpt)%I + nimpp - 1 |
---|
| 467 | ijglo = secs(jsec)%listPoint(jpt)%J + njmpp - 1 |
---|
[2848] | 468 | WRITE(numout,*)' # I J : ',iiglo,ijglo |
---|
[4153] | 469 | CALL FLUSH(numout) |
---|
[2848] | 470 | ENDDO |
---|
| 471 | ENDIF |
---|
| 472 | |
---|
| 473 | ELSE ! iptglo = 0 |
---|
[8126] | 474 | IF( jsec==nn_secdebug .OR. nn_secdebug==-1 )& |
---|
[2912] | 475 | WRITE(numout,*)' No points for this section.' |
---|
[2848] | 476 | ENDIF |
---|
| 477 | |
---|
| 478 | ENDDO !end of the loop on jsec |
---|
| 479 | |
---|
| 480 | nb_sec = jsec-1 !number of section read in the file |
---|
[3294] | 481 | ! |
---|
[2848] | 482 | END SUBROUTINE readsec |
---|
| 483 | |
---|
[9124] | 484 | |
---|
[2848] | 485 | SUBROUTINE removepoints(sec,cdind,cdextr,ld_debug) |
---|
| 486 | !!--------------------------------------------------------------------------- |
---|
| 487 | !! *** function removepoints |
---|
| 488 | !! |
---|
[3680] | 489 | !! ** Purpose :: Remove points which are common to 2 procs |
---|
[2854] | 490 | !! |
---|
[2848] | 491 | !---------------------------------------------------------------------------- |
---|
| 492 | !! * arguments |
---|
| 493 | TYPE(SECTION),INTENT(INOUT) :: sec |
---|
| 494 | CHARACTER(len=1),INTENT(IN) :: cdind ! = 'I'/'J' |
---|
| 495 | CHARACTER(len=8),INTENT(IN) :: cdextr ! = 'top_list'/'bot_list' |
---|
| 496 | LOGICAL,INTENT(IN) :: ld_debug |
---|
| 497 | |
---|
| 498 | !! * Local variables |
---|
| 499 | INTEGER :: iextr ,& !extremity of listpoint that we verify |
---|
| 500 | iind ,& !coord of listpoint that we verify |
---|
| 501 | itest ,& !indice value of the side of the domain |
---|
| 502 | !where points could be redundant |
---|
[2912] | 503 | isgn ,& ! isgn= 1 : scan listpoint from start to end |
---|
| 504 | ! isgn=-1 : scan listpoint from end to start |
---|
[2848] | 505 | istart,iend !first and last points selected in listpoint |
---|
[3294] | 506 | INTEGER :: jpoint !loop on list points |
---|
[9125] | 507 | INTEGER, DIMENSION(nb_point_max) :: idirec !contains temporary sec%direction |
---|
| 508 | INTEGER, DIMENSION(2,nb_point_max) :: icoord !contains temporary sec%listpoint |
---|
[2848] | 509 | !---------------------------------------------------------------------------- |
---|
[9125] | 510 | ! |
---|
[2848] | 511 | IF( ld_debug )WRITE(numout,*)' -------------------------' |
---|
| 512 | IF( ld_debug )WRITE(numout,*)' removepoints in listpoint' |
---|
| 513 | |
---|
| 514 | !iextr=extremity of list_point that we verify |
---|
| 515 | IF ( cdextr=='bot_list' )THEN ; iextr=1 ; isgn=1 |
---|
| 516 | ELSE IF ( cdextr=='top_list' )THEN ; iextr=sec%nb_point ; isgn=-1 |
---|
| 517 | ELSE ; CALL ctl_stop("removepoints :Wrong value for cdextr") |
---|
| 518 | ENDIF |
---|
| 519 | |
---|
| 520 | !which coordinate shall we verify ? |
---|
| 521 | IF ( cdind=='I' )THEN ; itest=nlei ; iind=1 |
---|
| 522 | ELSE IF ( cdind=='J' )THEN ; itest=nlej ; iind=2 |
---|
| 523 | ELSE ; CALL ctl_stop("removepoints :Wrong value for cdind") |
---|
| 524 | ENDIF |
---|
| 525 | |
---|
| 526 | IF( ld_debug )THEN |
---|
| 527 | WRITE(numout,*)' case: coord/list extr/domain side' |
---|
| 528 | WRITE(numout,*)' ', cdind,' ',cdextr,' ',itest |
---|
| 529 | WRITE(numout,*)' Actual number of points: ',sec%nb_point |
---|
| 530 | ENDIF |
---|
| 531 | |
---|
| 532 | icoord(1,1:nb_point_max) = sec%listPoint%I |
---|
| 533 | icoord(2,1:nb_point_max) = sec%listPoint%J |
---|
| 534 | idirec = sec%direction |
---|
| 535 | sec%listPoint = POINT_SECTION(0,0) |
---|
| 536 | sec%direction = 0 |
---|
| 537 | |
---|
| 538 | jpoint=iextr+isgn |
---|
[3294] | 539 | DO WHILE( jpoint .GE. 1 .AND. jpoint .LE. sec%nb_point ) |
---|
| 540 | IF( icoord( iind,jpoint-isgn ) == itest .AND. icoord( iind,jpoint ) == itest )THEN ; jpoint=jpoint+isgn |
---|
| 541 | ELSE ; EXIT |
---|
| 542 | ENDIF |
---|
| 543 | ENDDO |
---|
[2908] | 544 | |
---|
[2848] | 545 | IF( cdextr=='bot_list')THEN ; istart=jpoint-1 ; iend=sec%nb_point |
---|
| 546 | ELSE ; istart=1 ; iend=jpoint+1 |
---|
| 547 | ENDIF |
---|
[3294] | 548 | |
---|
[2848] | 549 | sec%listPoint(1:1+iend-istart)%I = icoord(1,istart:iend) |
---|
| 550 | sec%listPoint(1:1+iend-istart)%J = icoord(2,istart:iend) |
---|
| 551 | sec%direction(1:1+iend-istart) = idirec(istart:iend) |
---|
| 552 | sec%nb_point = iend-istart+1 |
---|
| 553 | |
---|
| 554 | IF( ld_debug )THEN |
---|
| 555 | WRITE(numout,*)' Number of points after removepoints :',sec%nb_point |
---|
| 556 | WRITE(numout,*)' sec%direction after removepoints :',sec%direction(1:sec%nb_point) |
---|
| 557 | ENDIF |
---|
[9124] | 558 | ! |
---|
| 559 | END SUBROUTINE removepoints |
---|
[2848] | 560 | |
---|
[9125] | 561 | |
---|
[12377] | 562 | SUBROUTINE transport(Kmm,sec,ld_debug,jsec) |
---|
[2912] | 563 | !!------------------------------------------------------------------------------------------- |
---|
[2848] | 564 | !! *** ROUTINE transport *** |
---|
| 565 | !! |
---|
[3680] | 566 | !! Purpose :: Compute the transport for each point in a section |
---|
[2913] | 567 | !! |
---|
[3680] | 568 | !! Method :: Loop over each segment, and each vertical level and add the transport |
---|
| 569 | !! Be aware : |
---|
| 570 | !! One section is a sum of segments |
---|
| 571 | !! One segment is defined by 2 consecutive points in sec%listPoint |
---|
| 572 | !! All points of sec%listPoint are positioned on the F-point of the cell |
---|
| 573 | !! |
---|
| 574 | !! There are two loops: |
---|
| 575 | !! loop on the segment between 2 nodes |
---|
| 576 | !! loop on the level jk !! |
---|
| 577 | !! |
---|
| 578 | !! Output :: Arrays containing the volume,density,heat,salt transports for each i |
---|
| 579 | !! point in a section, summed over each nn_dct. |
---|
[2848] | 580 | !! |
---|
[2912] | 581 | !!------------------------------------------------------------------------------------------- |
---|
[12377] | 582 | INTEGER ,INTENT(IN) :: Kmm ! time level index |
---|
[2848] | 583 | TYPE(SECTION),INTENT(INOUT) :: sec |
---|
| 584 | LOGICAL ,INTENT(IN) :: ld_debug |
---|
[3680] | 585 | INTEGER ,INTENT(IN) :: jsec ! numeric identifier of section |
---|
[9124] | 586 | ! |
---|
| 587 | INTEGER :: jk, jseg, jclass,jl, isgnu, isgnv ! loop on level/segment/classes/ice categories |
---|
| 588 | REAL(wp):: zumid, zvmid, zumid_ice, zvmid_ice ! U/V ocean & ice velocity on a cell segment |
---|
| 589 | REAL(wp):: zTnorm ! transport of velocity through one cell's sides |
---|
| 590 | REAL(wp):: ztn, zsn, zrhoi, zrhop, zsshn, zdep ! temperature/salinity/potential density/ssh/depth at u/v point |
---|
| 591 | TYPE(POINT_SECTION) :: k |
---|
[6140] | 592 | !!-------------------------------------------------------- |
---|
| 593 | ! |
---|
| 594 | IF( ld_debug )WRITE(numout,*)' Compute transport' |
---|
[2848] | 595 | |
---|
[6140] | 596 | !---------------------------! |
---|
| 597 | ! COMPUTE TRANSPORT ! |
---|
| 598 | !---------------------------! |
---|
| 599 | IF(sec%nb_point .NE. 0)THEN |
---|
[2848] | 600 | |
---|
[6140] | 601 | !---------------------------------------------------------------------------------------------------- |
---|
| 602 | !Compute sign for velocities: |
---|
| 603 | ! |
---|
| 604 | !convention: |
---|
| 605 | ! non horizontal section: direction + is toward left hand of section |
---|
| 606 | ! horizontal section: direction + is toward north of section |
---|
| 607 | ! |
---|
| 608 | ! |
---|
| 609 | ! slopeSection < 0 slopeSection > 0 slopeSection=inf slopeSection=0 |
---|
| 610 | ! ---------------- ----------------- --------------- -------------- |
---|
| 611 | ! |
---|
| 612 | ! isgnv=1 direction + |
---|
| 613 | ! ______ _____ ______ |
---|
| 614 | ! | //| | | direction + |
---|
| 615 | ! | isgnu=1 // | |isgnu=1 |isgnu=1 /|\ |
---|
| 616 | ! |_______ // ______| \\ | ---\ | |
---|
| 617 | ! | | isgnv=-1 \\ | | ---/ direction + ____________ |
---|
| 618 | ! | | __\\| | |
---|
| 619 | ! | | direction + | isgnv=1 |
---|
| 620 | ! |
---|
| 621 | !---------------------------------------------------------------------------------------------------- |
---|
| 622 | isgnu = 1 |
---|
| 623 | IF( sec%slopeSection .GT. 0 ) THEN ; isgnv = -1 |
---|
| 624 | ELSE ; isgnv = 1 |
---|
| 625 | ENDIF |
---|
| 626 | IF( sec%slopeSection .GE. 9999. ) isgnv = 1 |
---|
[2848] | 627 | |
---|
[6140] | 628 | IF( ld_debug )write(numout,*)"sec%slopeSection isgnu isgnv ",sec%slopeSection,isgnu,isgnv |
---|
[2848] | 629 | |
---|
[6140] | 630 | !--------------------------------------! |
---|
| 631 | ! LOOP ON THE SEGMENT BETWEEN 2 NODES ! |
---|
| 632 | !--------------------------------------! |
---|
| 633 | DO jseg=1,MAX(sec%nb_point-1,0) |
---|
[2848] | 634 | |
---|
[6140] | 635 | !------------------------------------------------------------------------------------------- |
---|
| 636 | ! Select the appropriate coordinate for computing the velocity of the segment |
---|
| 637 | ! |
---|
| 638 | ! CASE(0) Case (2) |
---|
| 639 | ! ------- -------- |
---|
| 640 | ! listPoint(jseg) listPoint(jseg+1) listPoint(jseg) F(i,j) |
---|
| 641 | ! F(i,j)----------V(i+1,j)-------F(i+1,j) | |
---|
| 642 | ! | |
---|
| 643 | ! | |
---|
| 644 | ! | |
---|
| 645 | ! Case (3) U(i,j) |
---|
| 646 | ! -------- | |
---|
| 647 | ! | |
---|
| 648 | ! listPoint(jseg+1) F(i,j+1) | |
---|
| 649 | ! | | |
---|
| 650 | ! | | |
---|
| 651 | ! | listPoint(jseg+1) F(i,j-1) |
---|
| 652 | ! | |
---|
| 653 | ! | |
---|
| 654 | ! U(i,j+1) |
---|
| 655 | ! | Case(1) |
---|
| 656 | ! | ------ |
---|
| 657 | ! | |
---|
| 658 | ! | listPoint(jseg+1) listPoint(jseg) |
---|
| 659 | ! | F(i-1,j)-----------V(i,j) -------f(jseg) |
---|
| 660 | ! listPoint(jseg) F(i,j) |
---|
| 661 | ! |
---|
| 662 | !------------------------------------------------------------------------------------------- |
---|
[2919] | 663 | |
---|
[6140] | 664 | SELECT CASE( sec%direction(jseg) ) |
---|
| 665 | CASE(0) ; k = sec%listPoint(jseg) |
---|
| 666 | CASE(1) ; k = POINT_SECTION(sec%listPoint(jseg)%I+1,sec%listPoint(jseg)%J) |
---|
| 667 | CASE(2) ; k = sec%listPoint(jseg) |
---|
| 668 | CASE(3) ; k = POINT_SECTION(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J+1) |
---|
| 669 | END SELECT |
---|
[2864] | 670 | |
---|
[6140] | 671 | !---------------------------| |
---|
| 672 | ! LOOP ON THE LEVEL | |
---|
| 673 | !---------------------------| |
---|
[8126] | 674 | DO jk = 1, mbkt(k%I,k%J) !Sum of the transport on the vertical |
---|
[6140] | 675 | ! ! compute temperature, salinity, insitu & potential density, ssh and depth at U/V point |
---|
| 676 | SELECT CASE( sec%direction(jseg) ) |
---|
| 677 | CASE(0,1) |
---|
[12377] | 678 | ztn = interp(Kmm,k%I,k%J,jk,'V',ts(:,:,:,jp_tem,Kmm) ) |
---|
| 679 | zsn = interp(Kmm,k%I,k%J,jk,'V',ts(:,:,:,jp_sal,Kmm) ) |
---|
| 680 | zrhop = interp(Kmm,k%I,k%J,jk,'V',rhop) |
---|
[12489] | 681 | zrhoi = interp(Kmm,k%I,k%J,jk,'V',rhd*rho0+rho0) |
---|
[12377] | 682 | zsshn = 0.5*( ssh(k%I,k%J,Kmm) + ssh(k%I,k%J+1,Kmm) ) * vmask(k%I,k%J,1) |
---|
[6140] | 683 | CASE(2,3) |
---|
[12377] | 684 | ztn = interp(Kmm,k%I,k%J,jk,'U',ts(:,:,:,jp_tem,Kmm) ) |
---|
| 685 | zsn = interp(Kmm,k%I,k%J,jk,'U',ts(:,:,:,jp_sal,Kmm) ) |
---|
| 686 | zrhop = interp(Kmm,k%I,k%J,jk,'U',rhop) |
---|
[12489] | 687 | zrhoi = interp(Kmm,k%I,k%J,jk,'U',rhd*rho0+rho0) |
---|
[12377] | 688 | zsshn = 0.5*( ssh(k%I,k%J,Kmm) + ssh(k%I+1,k%J,Kmm) ) * umask(k%I,k%J,1) |
---|
[6140] | 689 | END SELECT |
---|
| 690 | ! |
---|
[12377] | 691 | zdep= gdept(k%I,k%J,jk,Kmm) |
---|
[3680] | 692 | |
---|
[6140] | 693 | SELECT CASE( sec%direction(jseg) ) !compute velocity with the correct direction |
---|
| 694 | CASE(0,1) |
---|
| 695 | zumid=0._wp |
---|
[12377] | 696 | zvmid=isgnv*vv(k%I,k%J,jk,Kmm)*vmask(k%I,k%J,jk) |
---|
[6140] | 697 | CASE(2,3) |
---|
[12377] | 698 | zumid=isgnu*uu(k%I,k%J,jk,Kmm)*umask(k%I,k%J,jk) |
---|
[6140] | 699 | zvmid=0._wp |
---|
| 700 | END SELECT |
---|
[3680] | 701 | |
---|
[6140] | 702 | !zTnorm=transport through one cell; |
---|
| 703 | !velocity* cell's length * cell's thickness |
---|
[12377] | 704 | zTnorm = zumid*e2u(k%I,k%J) * e3u(k%I,k%J,jk,Kmm) & |
---|
| 705 | & + zvmid*e1v(k%I,k%J) * e3v(k%I,k%J,jk,Kmm) |
---|
[2848] | 706 | |
---|
[6140] | 707 | !!gm THIS is WRONG no transport due to ssh in linear free surface case !!!!! |
---|
| 708 | IF( ln_linssh ) THEN !add transport due to free surface |
---|
| 709 | IF( jk==1 ) THEN |
---|
| 710 | zTnorm = zTnorm + zumid* e2u(k%I,k%J) * zsshn * umask(k%I,k%J,jk) & |
---|
| 711 | & + zvmid* e1v(k%I,k%J) * zsshn * vmask(k%I,k%J,jk) |
---|
| 712 | ENDIF |
---|
| 713 | ENDIF |
---|
| 714 | !!gm end |
---|
[3680] | 715 | !COMPUTE TRANSPORT |
---|
[2848] | 716 | |
---|
[3680] | 717 | transports_3d(1,jsec,jseg,jk) = transports_3d(1,jsec,jseg,jk) + zTnorm |
---|
| 718 | |
---|
[6140] | 719 | IF( sec%llstrpond ) THEN |
---|
[3680] | 720 | transports_3d(2,jsec,jseg,jk) = transports_3d(2,jsec,jseg,jk) + zTnorm * ztn * zrhop * rcp |
---|
| 721 | transports_3d(3,jsec,jseg,jk) = transports_3d(3,jsec,jseg,jk) + zTnorm * zsn * zrhop * 0.001 |
---|
[2848] | 722 | ENDIF |
---|
| 723 | |
---|
[6140] | 724 | END DO !end of loop on the level |
---|
[2848] | 725 | |
---|
[9570] | 726 | #if defined key_si3 |
---|
[2848] | 727 | |
---|
| 728 | !ICE CASE |
---|
| 729 | !------------ |
---|
| 730 | IF( sec%ll_ice_section )THEN |
---|
| 731 | SELECT CASE (sec%direction(jseg)) |
---|
| 732 | CASE(0) |
---|
| 733 | zumid_ice = 0 |
---|
| 734 | zvmid_ice = isgnv*0.5*(v_ice(k%I,k%J+1)+v_ice(k%I+1,k%J+1)) |
---|
| 735 | CASE(1) |
---|
| 736 | zumid_ice = 0 |
---|
| 737 | zvmid_ice = isgnv*0.5*(v_ice(k%I,k%J+1)+v_ice(k%I+1,k%J+1)) |
---|
| 738 | CASE(2) |
---|
| 739 | zvmid_ice = 0 |
---|
| 740 | zumid_ice = isgnu*0.5*(u_ice(k%I+1,k%J)+u_ice(k%I+1,k%J+1)) |
---|
| 741 | CASE(3) |
---|
| 742 | zvmid_ice = 0 |
---|
| 743 | zumid_ice = isgnu*0.5*(u_ice(k%I+1,k%J)+u_ice(k%I+1,k%J+1)) |
---|
| 744 | END SELECT |
---|
| 745 | |
---|
| 746 | zTnorm=zumid_ice*e2u(k%I,k%J)+zvmid_ice*e1v(k%I,k%J) |
---|
[4153] | 747 | |
---|
[9570] | 748 | #if defined key_si3 |
---|
[4153] | 749 | DO jl=1,jpl |
---|
[9019] | 750 | transports_2d(1,jsec,jseg) = transports_2d(1,jsec,jseg) + (zTnorm)* & |
---|
| 751 | a_i(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl) * & |
---|
| 752 | ( h_i(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl) + & |
---|
| 753 | h_s(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl) ) |
---|
[4153] | 754 | |
---|
| 755 | transports_2d(2,jsec,jseg) = transports_2d(2,jsec,jseg) + (zTnorm)* & |
---|
[9019] | 756 | a_i(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J,jl) |
---|
[6140] | 757 | END DO |
---|
[4153] | 758 | #endif |
---|
[2848] | 759 | |
---|
| 760 | ENDIF !end of ice case |
---|
| 761 | #endif |
---|
| 762 | |
---|
[6140] | 763 | END DO !end of loop on the segment |
---|
[2848] | 764 | |
---|
[3680] | 765 | ENDIF !end of sec%nb_point =0 case |
---|
[3294] | 766 | ! |
---|
[2848] | 767 | END SUBROUTINE transport |
---|
[6140] | 768 | |
---|
| 769 | |
---|
[12377] | 770 | SUBROUTINE dia_dct_sum(Kmm,sec,jsec) |
---|
[3680] | 771 | !!------------------------------------------------------------- |
---|
| 772 | !! Purpose: Average the transport over nn_dctwri time steps |
---|
| 773 | !! and sum over the density/salinity/temperature/depth classes |
---|
| 774 | !! |
---|
| 775 | !! Method: Sum over relevant grid cells to obtain values |
---|
| 776 | !! for each class |
---|
| 777 | !! There are several loops: |
---|
| 778 | !! loop on the segment between 2 nodes |
---|
| 779 | !! loop on the level jk |
---|
| 780 | !! loop on the density/temperature/salinity/level classes |
---|
| 781 | !! test on the density/temperature/salinity/level |
---|
| 782 | !! |
---|
| 783 | !! Note: Transport through a given section is equal to the sum of transports |
---|
| 784 | !! computed on each proc. |
---|
| 785 | !! On each proc,transport is equal to the sum of transport computed through |
---|
| 786 | !! segments linking each point of sec%listPoint with the next one. |
---|
| 787 | !! |
---|
| 788 | !!------------------------------------------------------------- |
---|
[12377] | 789 | INTEGER ,INTENT(IN) :: Kmm ! time level index |
---|
[3680] | 790 | TYPE(SECTION),INTENT(INOUT) :: sec |
---|
| 791 | INTEGER ,INTENT(IN) :: jsec ! numeric identifier of section |
---|
| 792 | |
---|
| 793 | TYPE(POINT_SECTION) :: k |
---|
| 794 | INTEGER :: jk,jseg,jclass ! dummy variables for looping on level/segment/classes |
---|
[6140] | 795 | REAL(wp) :: ztn, zsn, zrhoi, zrhop, zsshn, zdep ! temperature/salinity/ssh/potential density /depth at u/v point |
---|
[3680] | 796 | !!------------------------------------------------------------- |
---|
| 797 | |
---|
| 798 | !! Sum the relevant segments to obtain values for each class |
---|
| 799 | IF(sec%nb_point .NE. 0)THEN |
---|
| 800 | |
---|
| 801 | !--------------------------------------! |
---|
| 802 | ! LOOP ON THE SEGMENT BETWEEN 2 NODES ! |
---|
| 803 | !--------------------------------------! |
---|
| 804 | DO jseg=1,MAX(sec%nb_point-1,0) |
---|
| 805 | |
---|
| 806 | !------------------------------------------------------------------------------------------- |
---|
| 807 | ! Select the appropriate coordinate for computing the velocity of the segment |
---|
| 808 | ! |
---|
| 809 | ! CASE(0) Case (2) |
---|
| 810 | ! ------- -------- |
---|
| 811 | ! listPoint(jseg) listPoint(jseg+1) listPoint(jseg) F(i,j) |
---|
| 812 | ! F(i,j)----------V(i+1,j)-------F(i+1,j) | |
---|
| 813 | ! | |
---|
| 814 | ! | |
---|
| 815 | ! | |
---|
| 816 | ! Case (3) U(i,j) |
---|
| 817 | ! -------- | |
---|
| 818 | ! | |
---|
| 819 | ! listPoint(jseg+1) F(i,j+1) | |
---|
| 820 | ! | | |
---|
| 821 | ! | | |
---|
| 822 | ! | listPoint(jseg+1) F(i,j-1) |
---|
| 823 | ! | |
---|
| 824 | ! | |
---|
| 825 | ! U(i,j+1) |
---|
| 826 | ! | Case(1) |
---|
| 827 | ! | ------ |
---|
| 828 | ! | |
---|
| 829 | ! | listPoint(jseg+1) listPoint(jseg) |
---|
| 830 | ! | F(i-1,j)-----------V(i,j) -------f(jseg) |
---|
| 831 | ! listPoint(jseg) F(i,j) |
---|
| 832 | ! |
---|
| 833 | !------------------------------------------------------------------------------------------- |
---|
| 834 | |
---|
| 835 | SELECT CASE( sec%direction(jseg) ) |
---|
| 836 | CASE(0) ; k = sec%listPoint(jseg) |
---|
| 837 | CASE(1) ; k = POINT_SECTION(sec%listPoint(jseg)%I+1,sec%listPoint(jseg)%J) |
---|
| 838 | CASE(2) ; k = sec%listPoint(jseg) |
---|
| 839 | CASE(3) ; k = POINT_SECTION(sec%listPoint(jseg)%I,sec%listPoint(jseg)%J+1) |
---|
| 840 | END SELECT |
---|
| 841 | |
---|
| 842 | !---------------------------| |
---|
| 843 | ! LOOP ON THE LEVEL | |
---|
| 844 | !---------------------------| |
---|
| 845 | !Sum of the transport on the vertical |
---|
[8126] | 846 | DO jk=1,mbkt(k%I,k%J) |
---|
[3680] | 847 | |
---|
| 848 | ! compute temperature, salinity, insitu & potential density, ssh and depth at U/V point |
---|
| 849 | SELECT CASE( sec%direction(jseg) ) |
---|
| 850 | CASE(0,1) |
---|
[12377] | 851 | ztn = interp(Kmm,k%I,k%J,jk,'V',ts(:,:,:,jp_tem,Kmm) ) |
---|
| 852 | zsn = interp(Kmm,k%I,k%J,jk,'V',ts(:,:,:,jp_sal,Kmm) ) |
---|
| 853 | zrhop = interp(Kmm,k%I,k%J,jk,'V',rhop) |
---|
[12489] | 854 | zrhoi = interp(Kmm,k%I,k%J,jk,'V',rhd*rho0+rho0) |
---|
[3680] | 855 | |
---|
| 856 | CASE(2,3) |
---|
[12377] | 857 | ztn = interp(Kmm,k%I,k%J,jk,'U',ts(:,:,:,jp_tem,Kmm) ) |
---|
| 858 | zsn = interp(Kmm,k%I,k%J,jk,'U',ts(:,:,:,jp_sal,Kmm) ) |
---|
| 859 | zrhop = interp(Kmm,k%I,k%J,jk,'U',rhop) |
---|
[12489] | 860 | zrhoi = interp(Kmm,k%I,k%J,jk,'U',rhd*rho0+rho0) |
---|
[12377] | 861 | zsshn = 0.5*( ssh(k%I,k%J,Kmm) + ssh(k%I+1,k%J,Kmm) ) * umask(k%I,k%J,1) |
---|
[3680] | 862 | END SELECT |
---|
| 863 | |
---|
[12377] | 864 | zdep= gdept(k%I,k%J,jk,Kmm) |
---|
[3680] | 865 | |
---|
| 866 | !------------------------------- |
---|
| 867 | ! LOOP ON THE DENSITY CLASSES | |
---|
| 868 | !------------------------------- |
---|
| 869 | !The computation is made for each density/temperature/salinity/depth class |
---|
| 870 | DO jclass=1,MAX(1,sec%nb_class-1) |
---|
| 871 | |
---|
| 872 | !----------------------------------------------! |
---|
| 873 | !TEST ON THE DENSITY/SALINITY/TEMPERATURE/LEVEL! |
---|
| 874 | !----------------------------------------------! |
---|
| 875 | |
---|
| 876 | IF ( ( & |
---|
| 877 | ((( zrhop .GE. (sec%zsigp(jclass)+1000. )) .AND. & |
---|
| 878 | ( zrhop .LE. (sec%zsigp(jclass+1)+1000. ))) .OR. & |
---|
| 879 | ( sec%zsigp(jclass) .EQ. 99.)) .AND. & |
---|
| 880 | |
---|
| 881 | ((( zrhoi .GE. (sec%zsigi(jclass) + 1000. )) .AND. & |
---|
| 882 | ( zrhoi .LE. (sec%zsigi(jclass+1)+1000. ))) .OR. & |
---|
| 883 | ( sec%zsigi(jclass) .EQ. 99.)) .AND. & |
---|
| 884 | |
---|
| 885 | ((( zsn .GT. sec%zsal(jclass)) .AND. & |
---|
| 886 | ( zsn .LE. sec%zsal(jclass+1))) .OR. & |
---|
| 887 | ( sec%zsal(jclass) .EQ. 99.)) .AND. & |
---|
| 888 | |
---|
| 889 | ((( ztn .GE. sec%ztem(jclass)) .AND. & |
---|
| 890 | ( ztn .LE. sec%ztem(jclass+1))) .OR. & |
---|
| 891 | ( sec%ztem(jclass) .EQ.99.)) .AND. & |
---|
| 892 | |
---|
[6140] | 893 | ((( zdep .GE. sec%zlay(jclass)) .AND. & |
---|
| 894 | ( zdep .LE. sec%zlay(jclass+1))) .OR. & |
---|
[3680] | 895 | ( sec%zlay(jclass) .EQ. 99. )) & |
---|
| 896 | )) THEN |
---|
| 897 | |
---|
| 898 | !SUM THE TRANSPORTS FOR EACH CLASSES FOR THE POSITIVE AND NEGATIVE DIRECTIONS |
---|
| 899 | !---------------------------------------------------------------------------- |
---|
| 900 | IF (transports_3d(1,jsec,jseg,jk) .GE. 0.0) THEN |
---|
| 901 | sec%transport(1,jclass) = sec%transport(1,jclass)+transports_3d(1,jsec,jseg,jk)*1.E-6 |
---|
| 902 | ELSE |
---|
| 903 | sec%transport(2,jclass) = sec%transport(2,jclass)+transports_3d(1,jsec,jseg,jk)*1.E-6 |
---|
| 904 | ENDIF |
---|
| 905 | IF( sec%llstrpond )THEN |
---|
| 906 | |
---|
| 907 | IF ( transports_3d(2,jsec,jseg,jk) .GE. 0.0 ) THEN |
---|
| 908 | sec%transport(3,jclass) = sec%transport(3,jclass)+transports_3d(2,jsec,jseg,jk) |
---|
| 909 | ELSE |
---|
| 910 | sec%transport(4,jclass) = sec%transport(4,jclass)+transports_3d(2,jsec,jseg,jk) |
---|
| 911 | ENDIF |
---|
| 912 | |
---|
| 913 | IF ( transports_3d(3,jsec,jseg,jk) .GE. 0.0 ) THEN |
---|
| 914 | sec%transport(5,jclass) = sec%transport(5,jclass)+transports_3d(3,jsec,jseg,jk) |
---|
| 915 | ELSE |
---|
| 916 | sec%transport(6,jclass) = sec%transport(6,jclass)+transports_3d(3,jsec,jseg,jk) |
---|
| 917 | ENDIF |
---|
| 918 | |
---|
| 919 | ELSE |
---|
| 920 | sec%transport( 3,jclass) = 0._wp |
---|
| 921 | sec%transport( 4,jclass) = 0._wp |
---|
| 922 | sec%transport( 5,jclass) = 0._wp |
---|
| 923 | sec%transport( 6,jclass) = 0._wp |
---|
| 924 | ENDIF |
---|
| 925 | |
---|
| 926 | ENDIF ! end of test if point is in class |
---|
| 927 | |
---|
[9019] | 928 | END DO ! end of loop on the classes |
---|
[3680] | 929 | |
---|
[9019] | 930 | END DO ! loop over jk |
---|
[3680] | 931 | |
---|
[9570] | 932 | #if defined key_si3 |
---|
[3680] | 933 | |
---|
| 934 | !ICE CASE |
---|
| 935 | IF( sec%ll_ice_section )THEN |
---|
| 936 | |
---|
| 937 | IF ( transports_2d(1,jsec,jseg) .GE. 0.0 ) THEN |
---|
| 938 | sec%transport( 7,1) = sec%transport( 7,1)+transports_2d(1,jsec,jseg)*1.E-6 |
---|
| 939 | ELSE |
---|
| 940 | sec%transport( 8,1) = sec%transport( 8,1)+transports_2d(1,jsec,jseg)*1.E-6 |
---|
| 941 | ENDIF |
---|
| 942 | |
---|
| 943 | IF ( transports_2d(3,jsec,jseg) .GE. 0.0 ) THEN |
---|
| 944 | sec%transport( 9,1) = sec%transport( 9,1)+transports_2d(2,jsec,jseg)*1.E-6 |
---|
| 945 | ELSE |
---|
| 946 | sec%transport(10,1) = sec%transport(10,1)+transports_2d(2,jsec,jseg)*1.E-6 |
---|
| 947 | ENDIF |
---|
| 948 | |
---|
| 949 | ENDIF !end of ice case |
---|
| 950 | #endif |
---|
| 951 | |
---|
[6140] | 952 | END DO !end of loop on the segment |
---|
[3680] | 953 | |
---|
| 954 | ELSE !if sec%nb_point =0 |
---|
| 955 | sec%transport(1:2,:)=0. |
---|
| 956 | IF (sec%llstrpond) sec%transport(3:6,:)=0. |
---|
| 957 | IF (sec%ll_ice_section) sec%transport(7:10,:)=0. |
---|
| 958 | ENDIF !end of sec%nb_point =0 case |
---|
| 959 | |
---|
| 960 | END SUBROUTINE dia_dct_sum |
---|
[6140] | 961 | |
---|
| 962 | |
---|
[2941] | 963 | SUBROUTINE dia_dct_wri(kt,ksec,sec) |
---|
[2848] | 964 | !!------------------------------------------------------------- |
---|
| 965 | !! Write transport output in numdct |
---|
| 966 | !! |
---|
[2854] | 967 | !! Purpose: Write transports in ascii files |
---|
| 968 | !! |
---|
| 969 | !! Method: |
---|
| 970 | !! 1. Write volume transports in "volume_transport" |
---|
[2908] | 971 | !! Unit: Sv : area * Velocity / 1.e6 |
---|
[2854] | 972 | !! |
---|
| 973 | !! 2. Write heat transports in "heat_transport" |
---|
[3680] | 974 | !! Unit: Peta W : area * Velocity * T * rhop * Cp * 1.e-15 |
---|
[2854] | 975 | !! |
---|
| 976 | !! 3. Write salt transports in "salt_transport" |
---|
[3680] | 977 | !! Unit: 10^9 Kg/m^2/s : area * Velocity * S * rhop * 1.e-9 |
---|
[2854] | 978 | !! |
---|
[2848] | 979 | !!------------------------------------------------------------- |
---|
| 980 | !!arguments |
---|
[3294] | 981 | INTEGER, INTENT(IN) :: kt ! time-step |
---|
| 982 | TYPE(SECTION), INTENT(INOUT) :: sec ! section to write |
---|
| 983 | INTEGER ,INTENT(IN) :: ksec ! section number |
---|
[2848] | 984 | |
---|
| 985 | !!local declarations |
---|
[3680] | 986 | INTEGER :: jclass ! Dummy loop |
---|
[3294] | 987 | CHARACTER(len=2) :: classe ! Classname |
---|
| 988 | REAL(wp) :: zbnd1,zbnd2 ! Class bounds |
---|
| 989 | REAL(wp) :: zslope ! section's slope coeff |
---|
| 990 | ! |
---|
[9124] | 991 | REAL(wp), DIMENSION(nb_type_class):: zsumclasses ! 1D workspace |
---|
[2848] | 992 | !!------------------------------------------------------------- |
---|
[3294] | 993 | |
---|
[3680] | 994 | zsumclasses(:)=0._wp |
---|
[2908] | 995 | zslope = sec%slopeSection |
---|
| 996 | |
---|
| 997 | |
---|
[3680] | 998 | DO jclass=1,MAX(1,sec%nb_class-1) |
---|
[2848] | 999 | |
---|
| 1000 | classe = 'N ' |
---|
| 1001 | zbnd1 = 0._wp |
---|
| 1002 | zbnd2 = 0._wp |
---|
[3680] | 1003 | zsumclasses(1:nb_type_class)=zsumclasses(1:nb_type_class)+sec%transport(1:nb_type_class,jclass) |
---|
[2848] | 1004 | |
---|
| 1005 | |
---|
| 1006 | !insitu density classes transports |
---|
[3680] | 1007 | IF( ( sec%zsigi(jclass) .NE. 99._wp ) .AND. & |
---|
| 1008 | ( sec%zsigi(jclass+1) .NE. 99._wp ) )THEN |
---|
[2848] | 1009 | classe = 'DI ' |
---|
[3680] | 1010 | zbnd1 = sec%zsigi(jclass) |
---|
| 1011 | zbnd2 = sec%zsigi(jclass+1) |
---|
[2848] | 1012 | ENDIF |
---|
| 1013 | !potential density classes transports |
---|
[3680] | 1014 | IF( ( sec%zsigp(jclass) .NE. 99._wp ) .AND. & |
---|
| 1015 | ( sec%zsigp(jclass+1) .NE. 99._wp ) )THEN |
---|
[2848] | 1016 | classe = 'DP ' |
---|
[3680] | 1017 | zbnd1 = sec%zsigp(jclass) |
---|
| 1018 | zbnd2 = sec%zsigp(jclass+1) |
---|
[2848] | 1019 | ENDIF |
---|
| 1020 | !depth classes transports |
---|
[3680] | 1021 | IF( ( sec%zlay(jclass) .NE. 99._wp ) .AND. & |
---|
| 1022 | ( sec%zlay(jclass+1) .NE. 99._wp ) )THEN |
---|
[2848] | 1023 | classe = 'Z ' |
---|
[3680] | 1024 | zbnd1 = sec%zlay(jclass) |
---|
| 1025 | zbnd2 = sec%zlay(jclass+1) |
---|
[2848] | 1026 | ENDIF |
---|
| 1027 | !salinity classes transports |
---|
[3680] | 1028 | IF( ( sec%zsal(jclass) .NE. 99._wp ) .AND. & |
---|
| 1029 | ( sec%zsal(jclass+1) .NE. 99._wp ) )THEN |
---|
[2848] | 1030 | classe = 'S ' |
---|
[3680] | 1031 | zbnd1 = sec%zsal(jclass) |
---|
| 1032 | zbnd2 = sec%zsal(jclass+1) |
---|
[2848] | 1033 | ENDIF |
---|
| 1034 | !temperature classes transports |
---|
[3680] | 1035 | IF( ( sec%ztem(jclass) .NE. 99._wp ) .AND. & |
---|
| 1036 | ( sec%ztem(jclass+1) .NE. 99._wp ) ) THEN |
---|
[2848] | 1037 | classe = 'T ' |
---|
[3680] | 1038 | zbnd1 = sec%ztem(jclass) |
---|
| 1039 | zbnd2 = sec%ztem(jclass+1) |
---|
[2848] | 1040 | ENDIF |
---|
| 1041 | |
---|
| 1042 | !write volume transport per class |
---|
[2941] | 1043 | WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope, & |
---|
[3680] | 1044 | jclass,classe,zbnd1,zbnd2,& |
---|
| 1045 | sec%transport(1,jclass),sec%transport(2,jclass), & |
---|
| 1046 | sec%transport(1,jclass)+sec%transport(2,jclass) |
---|
[2848] | 1047 | |
---|
| 1048 | IF( sec%llstrpond )THEN |
---|
| 1049 | |
---|
[2854] | 1050 | !write heat transport per class: |
---|
[2941] | 1051 | WRITE(numdct_heat,119) ndastp,kt,ksec,sec%name,zslope, & |
---|
[3680] | 1052 | jclass,classe,zbnd1,zbnd2,& |
---|
| 1053 | sec%transport(3,jclass)*1.e-15,sec%transport(4,jclass)*1.e-15, & |
---|
| 1054 | ( sec%transport(3,jclass)+sec%transport(4,jclass) )*1.e-15 |
---|
[2848] | 1055 | !write salt transport per class |
---|
[2941] | 1056 | WRITE(numdct_salt,119) ndastp,kt,ksec,sec%name,zslope, & |
---|
[3680] | 1057 | jclass,classe,zbnd1,zbnd2,& |
---|
| 1058 | sec%transport(5,jclass)*1.e-9,sec%transport(6,jclass)*1.e-9,& |
---|
| 1059 | (sec%transport(5,jclass)+sec%transport(6,jclass))*1.e-9 |
---|
[2848] | 1060 | ENDIF |
---|
| 1061 | |
---|
| 1062 | ENDDO |
---|
| 1063 | |
---|
| 1064 | zbnd1 = 0._wp |
---|
| 1065 | zbnd2 = 0._wp |
---|
[3680] | 1066 | jclass=0 |
---|
[2848] | 1067 | |
---|
| 1068 | !write total volume transport |
---|
[2941] | 1069 | WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope, & |
---|
[3680] | 1070 | jclass,"total",zbnd1,zbnd2,& |
---|
| 1071 | zsumclasses(1),zsumclasses(2),zsumclasses(1)+zsumclasses(2) |
---|
[2848] | 1072 | |
---|
| 1073 | IF( sec%llstrpond )THEN |
---|
| 1074 | |
---|
| 1075 | !write total heat transport |
---|
[2941] | 1076 | WRITE(numdct_heat,119) ndastp,kt,ksec,sec%name,zslope, & |
---|
[3680] | 1077 | jclass,"total",zbnd1,zbnd2,& |
---|
| 1078 | zsumclasses(3)*1.e-15,zsumclasses(4)*1.e-15,& |
---|
| 1079 | (zsumclasses(3)+zsumclasses(4) )*1.e-15 |
---|
[2848] | 1080 | !write total salt transport |
---|
[2941] | 1081 | WRITE(numdct_salt,119) ndastp,kt,ksec,sec%name,zslope, & |
---|
[3680] | 1082 | jclass,"total",zbnd1,zbnd2,& |
---|
| 1083 | zsumclasses(5)*1.e-9,zsumclasses(6)*1.e-9,& |
---|
| 1084 | (zsumclasses(5)+zsumclasses(6))*1.e-9 |
---|
[2848] | 1085 | ENDIF |
---|
| 1086 | |
---|
| 1087 | |
---|
| 1088 | IF ( sec%ll_ice_section) THEN |
---|
| 1089 | !write total ice volume transport |
---|
[2941] | 1090 | WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope,& |
---|
[3680] | 1091 | jclass,"ice_vol",zbnd1,zbnd2,& |
---|
| 1092 | sec%transport(7,1),sec%transport(8,1),& |
---|
| 1093 | sec%transport(7,1)+sec%transport(8,1) |
---|
[2848] | 1094 | !write total ice surface transport |
---|
[2941] | 1095 | WRITE(numdct_vol,118) ndastp,kt,ksec,sec%name,zslope,& |
---|
[3680] | 1096 | jclass,"ice_surf",zbnd1,zbnd2,& |
---|
| 1097 | sec%transport(9,1),sec%transport(10,1), & |
---|
| 1098 | sec%transport(9,1)+sec%transport(10,1) |
---|
[6140] | 1099 | ENDIF |
---|
[2848] | 1100 | |
---|
[6140] | 1101 | 118 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3F12.4) |
---|
| 1102 | 119 FORMAT(I8,1X,I8,1X,I4,1X,A30,1X,f9.2,1X,I4,3X,A8,1X,2F12.4,5X,3E15.6) |
---|
| 1103 | ! |
---|
| 1104 | END SUBROUTINE dia_dct_wri |
---|
[2848] | 1105 | |
---|
[6140] | 1106 | |
---|
[12377] | 1107 | FUNCTION interp(Kmm, ki, kj, kk, cd_point, ptab) |
---|
[2848] | 1108 | !!---------------------------------------------------------------------- |
---|
| 1109 | !! |
---|
[3680] | 1110 | !! Purpose: compute temperature/salinity/density at U-point or V-point |
---|
[2908] | 1111 | !! -------- |
---|
[2848] | 1112 | !! |
---|
[2908] | 1113 | !! Method: |
---|
| 1114 | !! ------ |
---|
[2848] | 1115 | !! |
---|
[2908] | 1116 | !! ====> full step and partial step |
---|
| 1117 | !! |
---|
| 1118 | !! |
---|
[3680] | 1119 | !! | I | I+1 | Z=temperature/salinity/density at U-poinT |
---|
[2908] | 1120 | !! | | | |
---|
[3680] | 1121 | !! ---------------------------------------- 1. Veritcal interpolation: compute zbis |
---|
[2908] | 1122 | !! | | | interpolation between ptab(I,J,K) and ptab(I,J,K+1) |
---|
| 1123 | !! | | | zbis = |
---|
[13237] | 1124 | !! | | | [ e3w_n(I+1,J,K,NOW)*ptab(I,J,K) + ( e3w_n(I,J,K,NOW) - e3w_n(I+1,J,K,NOW) ) * ptab(I,J,K-1) ] |
---|
| 1125 | !! | | | /[ e3w_n(I+1,J,K,NOW) + e3w_n(I,J,K,NOW) - e3w_n(I+1,J,K,NOW) ] |
---|
[2908] | 1126 | !! | | | |
---|
| 1127 | !! | | | 2. Horizontal interpolation: compute value at U/V point |
---|
| 1128 | !!K-1 | ptab(I,J,K-1) | | interpolation between zbis and ptab(I+1,J,K) |
---|
| 1129 | !! | . | | |
---|
[2909] | 1130 | !! | . | | interp = ( 0.5*zet2*zbis + 0.5*zet1*ptab(I+1,J,K) )/(0.5*zet2+0.5*zet1) |
---|
[2908] | 1131 | !! | . | | |
---|
| 1132 | !! ------------------------------------------ |
---|
| 1133 | !! | . | | |
---|
| 1134 | !! | . | | |
---|
| 1135 | !! | . | | |
---|
[2909] | 1136 | !!K | zbis.......U...ptab(I+1,J,K) | |
---|
[2908] | 1137 | !! | . | | |
---|
| 1138 | !! | ptab(I,J,K) | | |
---|
| 1139 | !! | |------------------| |
---|
| 1140 | !! | | partials | |
---|
| 1141 | !! | | steps | |
---|
| 1142 | !! ------------------------------------------- |
---|
| 1143 | !! <----zet1------><----zet2---------> |
---|
| 1144 | !! |
---|
| 1145 | !! |
---|
| 1146 | !! ====> s-coordinate |
---|
| 1147 | !! |
---|
[2909] | 1148 | !! | | | 1. Compute distance between T1 and U points: SQRT( zdep1^2 + (0.5 * zet1 )^2 |
---|
| 1149 | !! | | | Compute distance between T2 and U points: SQRT( zdep2^2 + (0.5 * zet2 )^2 |
---|
[2908] | 1150 | !! | | ptab(I+1,J,K) | |
---|
| 1151 | !! | | T2 | 2. Interpolation between T1 and T2 values at U point |
---|
| 1152 | !! | | ^ | |
---|
| 1153 | !! | | | zdep2 | |
---|
| 1154 | !! | | | | |
---|
| 1155 | !! | ^ U v | |
---|
| 1156 | !! | | | | |
---|
| 1157 | !! | | zdep1 | | |
---|
| 1158 | !! | v | | |
---|
| 1159 | !! | T1 | | |
---|
| 1160 | !! | ptab(I,J,K) | | |
---|
| 1161 | !! | | | |
---|
| 1162 | !! | | | |
---|
| 1163 | !! |
---|
| 1164 | !! <----zet1--------><----zet2---------> |
---|
| 1165 | !! |
---|
[2848] | 1166 | !!---------------------------------------------------------------------- |
---|
| 1167 | !*arguments |
---|
[12377] | 1168 | INTEGER, INTENT(IN) :: Kmm ! time level index |
---|
[2908] | 1169 | INTEGER, INTENT(IN) :: ki, kj, kk ! coordinate of point |
---|
| 1170 | CHARACTER(len=1), INTENT(IN) :: cd_point ! type of point (U, V) |
---|
| 1171 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(IN) :: ptab ! variable to compute at (ki, kj, kk ) |
---|
| 1172 | REAL(wp) :: interp ! interpolated variable |
---|
[2848] | 1173 | |
---|
| 1174 | !*local declations |
---|
[2908] | 1175 | INTEGER :: ii1, ij1, ii2, ij2 ! local integer |
---|
[6140] | 1176 | REAL(wp):: ze3t, ze3, zwgt1, zwgt2, zbis, zdepu ! local real |
---|
[2908] | 1177 | REAL(wp):: zet1, zet2 ! weight for interpolation |
---|
| 1178 | REAL(wp):: zdep1,zdep2 ! differences of depth |
---|
[4613] | 1179 | REAL(wp):: zmsk ! mask value |
---|
[2848] | 1180 | !!---------------------------------------------------------------------- |
---|
| 1181 | |
---|
| 1182 | IF( cd_point=='U' )THEN |
---|
| 1183 | ii1 = ki ; ij1 = kj |
---|
| 1184 | ii2 = ki+1 ; ij2 = kj |
---|
[2908] | 1185 | |
---|
| 1186 | zet1=e1t(ii1,ij1) |
---|
| 1187 | zet2=e1t(ii2,ij2) |
---|
[4613] | 1188 | zmsk=umask(ii1,ij1,kk) |
---|
| 1189 | |
---|
[2908] | 1190 | |
---|
[2848] | 1191 | ELSE ! cd_point=='V' |
---|
| 1192 | ii1 = ki ; ij1 = kj |
---|
| 1193 | ii2 = ki ; ij2 = kj+1 |
---|
[2908] | 1194 | |
---|
| 1195 | zet1=e2t(ii1,ij1) |
---|
| 1196 | zet2=e2t(ii2,ij2) |
---|
[4613] | 1197 | zmsk=vmask(ii1,ij1,kk) |
---|
[2908] | 1198 | |
---|
[2848] | 1199 | ENDIF |
---|
| 1200 | |
---|
[2908] | 1201 | IF( ln_sco )THEN ! s-coordinate case |
---|
| 1202 | |
---|
[12377] | 1203 | zdepu = ( gdept(ii1,ij1,kk,Kmm) + gdept(ii2,ij2,kk,Kmm) ) * 0.5_wp |
---|
| 1204 | zdep1 = gdept(ii1,ij1,kk,Kmm) - zdepu |
---|
| 1205 | zdep2 = gdept(ii2,ij2,kk,Kmm) - zdepu |
---|
[2908] | 1206 | |
---|
[3680] | 1207 | ! weights |
---|
[2908] | 1208 | zwgt1 = SQRT( ( 0.5 * zet1 ) * ( 0.5 * zet1 ) + ( zdep1 * zdep1 ) ) |
---|
| 1209 | zwgt2 = SQRT( ( 0.5 * zet2 ) * ( 0.5 * zet2 ) + ( zdep2 * zdep2 ) ) |
---|
| 1210 | |
---|
| 1211 | ! result |
---|
[4613] | 1212 | interp = zmsk * ( zwgt2 * ptab(ii1,ij1,kk) + zwgt1 * ptab(ii1,ij1,kk) ) / ( zwgt2 + zwgt1 ) |
---|
[2908] | 1213 | |
---|
| 1214 | |
---|
| 1215 | ELSE ! full step or partial step case |
---|
| 1216 | |
---|
[12377] | 1217 | ze3t = e3t(ii2,ij2,kk,Kmm) - e3t(ii1,ij1,kk,Kmm) |
---|
[13237] | 1218 | zwgt1 = ( e3w(ii2,ij2,kk,Kmm) - e3w(ii1,ij1,kk,Kmm) ) & |
---|
| 1219 | & / e3w(ii2,ij2,kk,Kmm) |
---|
| 1220 | zwgt2 = ( e3w(ii1,ij1,kk,Kmm) - e3w(ii2,ij2,kk,Kmm) ) & |
---|
| 1221 | & / e3w(ii1,ij1,kk,Kmm) |
---|
[2848] | 1222 | |
---|
[2908] | 1223 | IF(kk .NE. 1)THEN |
---|
[2848] | 1224 | |
---|
[2908] | 1225 | IF( ze3t >= 0. )THEN |
---|
[3680] | 1226 | ! zbis |
---|
[2908] | 1227 | zbis = ptab(ii2,ij2,kk) + zwgt1 * ( ptab(ii2,ij2,kk-1) - ptab(ii2,ij2,kk) ) |
---|
| 1228 | ! result |
---|
[4613] | 1229 | interp = zmsk * ( zet2 * ptab(ii1,ij1,kk) + zet1 * zbis )/( zet1 + zet2 ) |
---|
[2908] | 1230 | ELSE |
---|
[3680] | 1231 | ! zbis |
---|
[2908] | 1232 | zbis = ptab(ii1,ij1,kk) + zwgt2 * ( ptab(ii1,ij1,kk-1) - ptab(ii1,ij2,kk) ) |
---|
| 1233 | ! result |
---|
[4613] | 1234 | interp = zmsk * ( zet2 * zbis + zet1 * ptab(ii2,ij2,kk) )/( zet1 + zet2 ) |
---|
[2908] | 1235 | ENDIF |
---|
| 1236 | |
---|
[2848] | 1237 | ELSE |
---|
[4613] | 1238 | interp = zmsk * ( zet2 * ptab(ii1,ij1,kk) + zet1 * ptab(ii2,ij2,kk) )/( zet1 + zet2 ) |
---|
[2908] | 1239 | ENDIF |
---|
[2848] | 1240 | |
---|
| 1241 | ENDIF |
---|
[6140] | 1242 | ! |
---|
| 1243 | END FUNCTION interp |
---|
[2848] | 1244 | |
---|
| 1245 | #else |
---|
| 1246 | !!---------------------------------------------------------------------- |
---|
[11536] | 1247 | !! Dummy module |
---|
[2848] | 1248 | !!---------------------------------------------------------------------- |
---|
[11536] | 1249 | LOGICAL, PUBLIC :: ln_diadct = .FALSE. |
---|
[2848] | 1250 | CONTAINS |
---|
[11536] | 1251 | SUBROUTINE dia_dct_init |
---|
[9927] | 1252 | IMPLICIT NONE |
---|
[2864] | 1253 | END SUBROUTINE dia_dct_init |
---|
[12377] | 1254 | |
---|
| 1255 | SUBROUTINE dia_dct( kt, Kmm ) ! Dummy routine |
---|
[9927] | 1256 | IMPLICIT NONE |
---|
[12377] | 1257 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 1258 | INTEGER, INTENT( in ) :: Kmm ! ocean time level index |
---|
| 1259 | WRITE(*,*) 'dia_dct: You should not have seen this print! error?', kt |
---|
[2848] | 1260 | END SUBROUTINE dia_dct |
---|
[11536] | 1261 | ! |
---|
[2848] | 1262 | #endif |
---|
| 1263 | |
---|
[6140] | 1264 | !!====================================================================== |
---|
[2848] | 1265 | END MODULE diadct |
---|