Changeset 15540 for NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/OBS/obs_averg_h2d.F90
- Timestamp:
- 2021-11-26T12:27:56+01:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/OBS/obs_averg_h2d.F90
r14644 r15540 82 82 & kmaxjfp, & ! Max size of model points in j-direction for obs footprint 83 83 & k2dint ! Averaging scheme options - see header 84 REAL(KIND= wp), INTENT(INOUT) :: &84 REAL(KIND=dp), INTENT(INOUT) :: & 85 85 & plam, & ! Geographical (lat,lon) coordinates of 86 86 & pphi ! observation 87 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp), INTENT(IN) :: &87 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp), INTENT(IN) :: & 88 88 & pglam, & ! Model variable lon 89 89 & pgphi ! Model variable lat 90 REAL(KIND= wp), DIMENSION(kmaxifp+1,kmaxjfp+1), INTENT(IN) :: &90 REAL(KIND=dp), DIMENSION(kmaxifp+1,kmaxjfp+1), INTENT(IN) :: & 91 91 & pglamf, & ! Model variable lon at corners of grid-boxes 92 92 & pgphif ! Model variable lat at corners of grid-boxes 93 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: &93 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: & 94 94 & pmask ! Model variable mask 95 REAL(KIND= wp), INTENT(IN) :: &95 REAL(KIND=dp), INTENT(IN) :: & 96 96 & plamscl, & ! Diameter (lat,lon) of obs footprint in metres 97 97 & pphiscl ! This is the full width (rather than half-width) 98 98 LOGICAL, INTENT(IN) :: & 99 99 & lindegrees ! T=> obs footprint specified in degrees, F=> in metres 100 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(OUT) :: &100 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(OUT) :: & 101 101 & pweig ! Weights for averaging 102 102 INTEGER, INTENT(IN), OPTIONAL :: & … … 170 170 & kmaxjfp ! Max size of model points in j-direction for obs footprint 171 171 172 REAL(KIND=wp), INTENT(IN) :: & 173 & plam, & 174 & pphi ! Geographical (lat,lon) coordinates of 172 REAL(KIND=dp), INTENT(IN) :: plam, pphi 173 174 175 175 176 ! observation 176 REAL(KIND= wp), INTENT(IN) :: &177 REAL(KIND=dp), INTENT(IN) :: & 177 178 & plamscl, & ! Diameter (lat,lon) of obs footprint in metres or degrees (see below) 178 179 & pphiscl ! This is the full width (rather than half-width) 179 180 LOGICAL, INTENT(IN) :: & 180 181 & lindegrees ! T=>scales specified in degrees, F=> in metres 181 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: &182 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: & 182 183 & pmask ! Model variable mask 183 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp), INTENT(IN) :: &184 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp), INTENT(IN) :: & 184 185 & pglam, & ! Model variable lon 185 186 & pgphi ! Model variable lat 186 REAL(KIND= wp), DIMENSION(kmaxifp+1,kmaxjfp+1), INTENT(IN) :: &187 REAL(KIND=dp), DIMENSION(kmaxifp+1,kmaxjfp+1), INTENT(IN) :: & 187 188 & pglamf, & ! Model variable lon at corners of grid boxes 188 189 & pgphif ! Model variable lat at corners of grid boxes 189 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(OUT) :: &190 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(OUT) :: & 190 191 & pweig ! Weights for interpolation 191 192 … … 197 198 & jnumsubgrid = 20 ! The number of sub grid-boxes (in x and y directions) used to approximate area of obs fp 198 199 199 REAL(KIND= wp), DIMENSION(4) :: &200 REAL(KIND=dp), DIMENSION(4) :: & 200 201 & zxvert, zyvert, & ! The lon/lat of the vertices(corners) of the grid box in m relative to centre of obs fp 201 202 & zdist ! Distance of each vertex to the centre of the obs footprint 202 REAL(KIND= wp), DIMENSION(4) :: &203 REAL(KIND=dp), DIMENSION(4) :: & 203 204 & zxgrid, zygrid, & ! Distance of each vertex of grid box to the centre of the grid box in x/y directions 204 205 & zdgrid 205 REAL(KIND= wp) :: &206 REAL(KIND=dp) :: & 206 207 & zdx, zdy, & ! The sub grid-box sizes (in metres) 207 208 & zarea_subbox, & ! The area of each sub grid-box (in metres squared) … … 210 211 & zarea_fp, & ! Total area of obs footprint within the grid box 211 212 & zareabox ! Total area of the grid box 212 REAL(KIND= wp) :: &213 REAL(KIND=dp) :: & 213 214 & zphiscl_m, & ! Diameter of obs footprint in metres 214 215 & zlamscl_m … … 353 354 & kmaxjfp ! Max size of model points in j-direction for obs footprint 354 355 355 REAL(KIND=wp), INTENT(IN) :: & 356 & plam, & 357 & pphi ! Geographical (lat,lon) coordinates of 356 REAL(KIND=dp), INTENT(IN) :: plam, pphi ! Geographical (lat,lon) coordinates of 357 358 359 358 360 ! observation 359 REAL(KIND=wp), INTENT(IN) :: & 360 & plamscl, & 361 & pphiscl ! Width in x/y directions of obs footprint in metres 361 REAL(KIND=dp), INTENT(IN) :: plamscl, pphiscl ! Width in x/y directions of obs footprint in metres 362 363 364 362 365 ! This is the full width (rather than half-width) 363 366 LOGICAL, INTENT(IN) :: & 364 367 & lindegrees !T=> scales specified in degrees, F=> in metres 365 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: &368 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: & 366 369 & pmask ! Model variable mask 367 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp), INTENT(IN) :: &370 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp), INTENT(IN) :: & 368 371 & pglam, & ! Model variable lat at centre of grid boxes 369 372 & pgphi ! Model variable lon at centre of grid boxes 370 REAL(KIND= wp), DIMENSION(kmaxifp+1,kmaxjfp+1), INTENT(IN) :: &373 REAL(KIND=dp), DIMENSION(kmaxifp+1,kmaxjfp+1), INTENT(IN) :: & 371 374 & pglamf, & ! Model variable lat at corners of grid boxes 372 375 & pgphif ! Model variable lon at corners of grid boxes 373 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(OUT) :: &376 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(OUT) :: & 374 377 & pweig ! Weights for interpolation 375 378 … … 379 382 INTEGER, DIMENSION(4) :: & 380 383 & jnumvert 381 REAL(KIND= wp), DIMENSION(4) :: &384 REAL(KIND=dp), DIMENSION(4) :: & 382 385 & zxvert, zyvert ! The lon/lat of the vertices(corners) of the grid box in m relative to centre of obs fp 383 REAL(KIND= wp), DIMENSION(4) :: &386 REAL(KIND=dp), DIMENSION(4) :: & 384 387 & zdist ! Distance of each vertex to the centre of the obs footprint 385 REAL(KIND= wp), DIMENSION(4) :: &388 REAL(KIND=dp), DIMENSION(4) :: & 386 389 & zxgrid, zygrid, & ! Distance of each vertex of grid box to the centre of the grid box in x/y directions 387 390 & zdgrid 388 REAL(KIND= wp) :: &391 REAL(KIND=dp) :: & 389 392 & zareabox, & ! Total area of grid box 390 393 & zarea_fp, & ! Total area of obs footprint 391 394 & zarea_intersect ! Area of the intersection between the grid box and the obs footprint 392 REAL(KIND= wp) :: &395 REAL(KIND=dp) :: & 393 396 & zlamscl_m, & 394 397 & zphiscl_m ! Total width (lat,lon) of obs footprint in metres 395 REAL(KIND= wp) :: &398 REAL(KIND=dp) :: & 396 399 & z_awidth, z_aheight, & ! Width and height of model grid box 397 400 & z_cwidth, z_cheight ! Width and height of union of model grid box and obs footprint 398 REAL(KIND= wp) :: &401 REAL(KIND=dp) :: & 399 402 & zleft, zright, & ! Distance (metres) of corners area of intersection 400 403 & ztop, zbottom ! between grid box and obs footprint … … 507 510 & kmaxifp, & ! Max size of model points in i-direction for obs footprint 508 511 & kmaxjfp ! Max size of model points in j-direction for obs footprint 509 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: &512 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: & 510 513 & pweig ! Interpolation weights 511 REAL(KIND= wp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: &514 REAL(KIND=dp), DIMENSION(kmaxifp,kmaxjfp,kpk2), INTENT(IN) :: & 512 515 & pmod ! Model variable to interpolate 513 REAL(KIND= wp), DIMENSION(kpk2), INTENT(OUT) :: &516 REAL(KIND=dp), DIMENSION(kpk2), INTENT(OUT) :: & 514 517 & pobsk ! Model profile interpolated to obs (i,j) pt 515 518 … … 518 521 INTEGER :: & 519 522 & ikmax 520 REAL(KIND=wp) :: & 521 & zsum 523 REAL(KIND=dp) :: zsum 524 525 522 526 523 527 !------------------------------------------------------------------------ … … 574 578 INTEGER , INTENT(IN) :: & 575 579 & k2dint !Type of interpolation/averaging used 576 REAL(KIND= wp), INTENT(IN) :: &580 REAL(KIND=dp), INTENT(IN) :: & 577 581 & plamscl, & !Total width/radius in metres of the observation footprint 578 582 & pphiscl ! 579 583 LOGICAL, INTENT(IN) :: & 580 584 & lindegrees !T=> plamscl and pphiscl are specified in degrees 581 REAL(KIND= wp), DIMENSION(jpi,jpj), INTENT(IN) :: &585 REAL(KIND=dp), DIMENSION(jpi,jpj), INTENT(IN) :: & 582 586 & pmask !Land/sea mask 583 587 !F=> plamscl and pphiscl are specified in metres … … 587 591 588 592 !! * Local variables 589 REAL(KIND= wp) :: &593 REAL(KIND=dp) :: & 590 594 & ze1min, & !Minimum global grid-size in i,j directions 591 595 & ze2min 592 REAL(KIND= wp) :: &596 REAL(KIND=dp) :: & 593 597 & zphiscl_m, & 594 598 & zlamscl_m … … 605 609 !If the scales are specified in degrees, work out the max 606 610 !distance (metres) in x/y directions 607 CALL obs_deg2dist( jpi, jpj, CASTWP(glamt), CASTWP(gphit), &611 CALL obs_deg2dist( jpi, jpj, glamt, gphit, & 608 612 & plamscl, pphiscl, zlamscl_m, zphiscl_m ) 609 613 ELSE … … 655 659 INTEGER , INTENT(IN) :: & 656 660 & ki, kj !x/y dimensions of input lat/lon variables 657 REAL(KIND= wp), INTENT(IN), DIMENSION(ki,kj) :: &661 REAL(KIND=dp), INTENT(IN), DIMENSION(ki,kj) :: & 658 662 & pglam, pgphi !Longitude and latitudes of grid points 659 REAL(KIND= wp), INTENT(IN) :: &663 REAL(KIND=dp), INTENT(IN) :: & 660 664 & plamscl_deg, & !Size in degrees of the observation footprint 661 665 & pphiscl_deg ! 662 REAL(KIND= wp), INTENT(OUT) :: &666 REAL(KIND=dp), INTENT(OUT) :: & 663 667 & plamscl_max, & !Maximum size of obs footprint in metres 664 668 & pphiscl_max … … 667 671 INTEGER :: & 668 672 & ji, jj !Counters 669 REAL(KIND= wp) :: &673 REAL(KIND=dp) :: & 670 674 & zlon1, zlon2, & !Lon values surrounding centre of grid point 671 675 & zlat1, zlat2, & !Lat values surrounding centre of grid point 672 676 & zdlat, zdlon !Distance in radians in lat/lon directions 673 REAL(KIND= wp) :: &677 REAL(KIND=dp) :: & 674 678 & za1, za2, za, zc, zd 675 679 … … 740 744 !! * Modules used 741 745 !! * Arguments 742 REAL(KIND= wp), INTENT(IN) :: &746 REAL(KIND=dp), INTENT(IN) :: & 743 747 & pglam_bl, pglam_br, & !lon at corners of grid box 744 748 & pglam_tl, pglam_tr 745 REAL(KIND= wp), INTENT(IN) :: &749 REAL(KIND=dp), INTENT(IN) :: & 746 750 & pgphi_bl, pgphi_br, & !lat at corners of grid box 747 751 & pgphi_tl, pgphi_tr 748 REAL(KIND= wp), INTENT(IN) :: &752 REAL(KIND=dp), INTENT(IN) :: & 749 753 & pphi, plam !lat/lon of centre of obs footprint 750 REAL(KIND= wp), DIMENSION(4), INTENT(OUT) :: &754 REAL(KIND=dp), DIMENSION(4), INTENT(OUT) :: & 751 755 & pxvert, pyvert !x/y location (in metres relative to centre of obs footprint) of corners 752 REAL(KIND= wp), DIMENSION(4), INTENT(OUT) :: &756 REAL(KIND=dp), DIMENSION(4), INTENT(OUT) :: & 753 757 & pdist !distance (in metres) of each corner relative to centre of obs footprint 754 758 … … 756 760 INTEGER :: & 757 761 & jvert !Counter for corners 758 REAL(KIND= wp) :: &762 REAL(KIND=dp) :: & 759 763 & zphi, zlam !Local values for lon/lat of corners 760 REAL(KIND= wp) :: &764 REAL(KIND=dp) :: & 761 765 & za1, za2, & !For great circle distance calculations 762 766 & zb1, zb2, & 763 767 & zc1, zc2 764 REAL(KIND= wp) :: &768 REAL(KIND=dp) :: & 765 769 & zdist_centre_lat, & !Distances in lat/lon directions (in metres) 766 770 & zdist_centre_lon
Note: See TracChangeset
for help on using the changeset viewer.