New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 12558 for NEMO/branches/UKMO/r12083_India_uncoupled/src/OCE/SBC/fldread.F90 – NEMO

Ignore:
Timestamp:
2020-03-15T20:51:02+01:00 (4 years ago)
Author:
jcastill
Message:

Update vertical interpolation code for boundaries, based on later trunk version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/r12083_India_uncoupled/src/OCE/SBC/fldread.F90

    r12476 r12558  
    843843      INTEGER                                   ::   ipi             ! length of boundary data on local process 
    844844      INTEGER                                   ::   ipkb            ! number of vertical levels in boundary data file 
     845      INTEGER                                   ::   ipkmax          ! number of vertical levels in boundary data file where no mask 
    845846      INTEGER                                   ::   jb, ji, jj, jk, jkb   ! loop counters 
    846847      REAL(wp)                                  ::   zcoef 
     
    864865         jj = idx_bdy(kbdy)%nbj(jb,kgrd) 
    865866         zh  = SUM(pdta_read_dz(jb,1,:) ) 
     867         ! 
     868         ! --- max jk where input data /= FillValue --- ! 
     869         ipkmax = 1 
     870         DO jkb = 2, ipkb 
     871            IF( pdta_read(jb,1,jkb) /= pfv )   ipkmax = MAX( ipkmax, jkb ) 
     872         END DO 
    866873         ! 
    867874         ! Warnings to flag differences in the input and model topgraphy - is this useful/necessary? 
     
    926933            IF(     zdepth(jk) < pdta_read_z(jb,1,          1) ) THEN                ! above the first level of external data 
    927934               pdta(jb,1,jk) =  pdta_read(jb,1,1) 
    928             ELSEIF( zdepth(jk) > MAXVAL(pdta_read_z(jb,1,:),1) ) THEN                ! below the last level of external data  
    929                pdta(jb,1,jk) =  pdta_read(jb,1,MAXLOC(pdta_read_z(jb,1,:),1)) 
     935            ELSEIF( zdepth(jk) > pdta_read_z(jb,1,ipkmax) ) THEN                ! below the last level of external data  
     936               pdta(jb,1,jk) =  pdta_read(jb,1,ipkmax) 
    930937            ELSE                                                             ! inbetween: vertical interpolation between jkb & jkb+1 
    931                DO jkb = 1, ipkb-1                                            ! when  gdept_n(jkb) < zdepth(jk) < gdept_n(jkb+1) 
     938               DO jkb = 1, ipkmax-1                                          ! when  gdept_n(jkb) < zdepth(jk) < gdept_n(jkb+1) 
    932939                  IF( ( ( zdepth(jk) - pdta_read_z(jb,1,jkb) ) * ( zdepth(jk) - pdta_read_z(jb,1,jkb+1) ) <= 0._wp ) & 
    933940                     &    .AND. ( pdta_read_z(jb,1,jkb+1) /= zfv_alt) ) THEN   ! linear interpolation between 2 levels 
Note: See TracChangeset for help on using the changeset viewer.