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 10025 for utils/tools/NESTING/src/agrif_interpolation.f90 – NEMO

Ignore:
Timestamp:
2018-08-02T15:25:27+02:00 (6 years ago)
Author:
clem
Message:

nesting tools are partly rewritten (mostly for create_coordinates and bathy) to get better functionality. Now you can use the nesting to either define an agrif zoom or a regional domain (for bdy purposes). Also, the nesting tools output a domain_cfg.nc that can be directly used in NEMO4 without the need of DOMAINcfg tool. The option of median average for bathymetry interpolation still does not work properly but it's not new

File:
1 edited

Legend:

Unmodified
Added
Removed
  • utils/tools/NESTING/src/agrif_interpolation.f90

    r9166 r10025  
    5454    !  
    5555    ! 
    56     CALL agrif_base_interp2(tabin,tabout,imin,jmin,typevar) 
    57  
     56    IF( ln_agrif_domain ) THEN 
     57       CALL agrif_base_interp2(tabin,tabout,imin,jmin,typevar) 
     58    ELSE 
     59       CALL agrif_base_interp3(tabin,tabout,imin,jmin,typevar) 
     60    ENDIF 
     61     
    5862    ! 
    5963  END SUBROUTINE agrif_interp 
    6064  ! 
    61   !******************************************************** 
    62   !   subroutine agrif_base_interp2       * 
    63   !******************************************************** 
    6465  !       
    6566  SUBROUTINE agrif_base_interp2(tabin,tabout,i_min,j_min,typevar) 
     
    189190  END SUBROUTINE agrif_base_interp2 
    190191  ! 
    191   !******************************************************** 
    192   !   subroutine polint             * 
    193   !******************************************************** 
     192  !       
     193  SUBROUTINE agrif_base_interp3(tabin,tabout,i_min,j_min,typevar) 
     194    ! 
     195    IMPLICIT NONE 
     196    REAL*8,DIMENSION(:,:) :: tabin,tabout 
     197    INTEGER :: i_min,j_min 
     198    CHARACTER(*) :: typevar    
     199 
     200    INTEGER :: nxf,nyf,zx,zy 
     201    INTEGER :: ji,jj,jif,jjf,jic,jjc,jdecx,jdecy 
     202    REAL*8 :: Ax, Bx, Ay, By 
     203 
     204    nxf = SIZE(tabout,1) 
     205    nyf = SIZE(tabout,2) 
     206 
     207    SELECT CASE(typevar) 
     208    CASE('T') 
     209       IF(MOD(irafx,2)==1) THEN ! odd 
     210          zx = 1 ; zy = 1 ; jdecx = FLOOR(irafx/2.) ; jdecy = FLOOR(irafy/2.) 
     211       ELSE                     ! even 
     212          zx = 2 ; zy = 2 ; jdecx = FLOOR(irafx/2.) ; jdecy = FLOOR(irafy/2.) 
     213       ENDIF 
     214    CASE('U') 
     215       IF(MOD(irafx,2)==1) THEN ! odd 
     216          zx = 1 ; zy = 1 ; jdecx = irafx - 1 ; jdecy = FLOOR(irafy/2.) 
     217       ELSE                     ! even 
     218          zx = 1 ; zy = 2 ; jdecx = irafx - 1 ; jdecy = FLOOR(irafy/2.) 
     219       ENDIF 
     220    CASE('V') 
     221       IF(MOD(irafx,2)==1) THEN ! odd 
     222          zx = 1 ; zy = 1 ; jdecx = FLOOR(irafx/2.) ; jdecy = irafy - 1 
     223       ELSE                     ! even 
     224          zx = 2 ; zy = 1 ; jdecx = FLOOR(irafx/2.) ; jdecy = irafy - 1 
     225       ENDIF 
     226    CASE('F') 
     227       IF(MOD(irafx,2)==1) THEN ! odd 
     228          zx = 1 ; zy = 1 ; jdecx = irafx - 1 ; jdecy = irafy - 1 
     229       ELSE                     ! even 
     230          zx = 1 ; zy = 1 ; jdecx = irafx - 1 ; jdecy = irafy - 1 
     231       ENDIF 
     232    END SELECT 
     233 
     234     
     235    DO jj = 1, nyf 
     236 
     237       jjf = jj - jdecy 
     238       jjc = j_min + FLOOR((jjf-1.) / irafy)  
     239        
     240       DO ji = 1, nxf 
     241           
     242          jif = ji - jdecx  
     243          jic = i_min + FLOOR((jif-1.) / irafx)  
     244           
     245          Bx = MOD( zx*jif-1, zx*irafx ) / REAL(zx*irafx) 
     246          By = MOD( zy*jjf-1, zy*irafy ) / REAL(zy*irafy) 
     247          Ax = 1. - Bx 
     248          Ay = 1. - By 
     249 
     250          tabout(ji,jj) = ( Bx * tabin(jic+1,jjc  ) + Ax * tabin(jic,jjc  ) ) * Ay + & 
     251             &            ( Bx * tabin(jic+1,jjc+1) + Ax * tabin(jic,jjc+1) ) * By 
     252       END DO 
     253    END DO 
     254     
     255    ! 
     256  END SUBROUTINE agrif_base_interp3 
     257 
    194258  !        
    195259  SUBROUTINE polint(xin,valin,n,x,val) 
     
    238302  END SUBROUTINE polint 
    239303  ! 
    240   !******************************************************** 
    241   !   subroutine polcoe             * 
    242   !******************************************************** 
    243304  !       
    244305  SUBROUTINE polcoe(xin,valin,n,cof) 
     
    709770          CALL Read_Ncdf_var('time_steps',filename,tabtemp1DInt)  
    710771          !       print *,'timedeph = ',tabtemp1DInt 
    711           CALL Write_Ncdf_var('time_steps','time_counter',Child_file,tabtemp1DInt) 
     772          CALL Write_Ncdf_var('time_steps','time_counter',Child_file,tabtemp1DInt,'integer') 
    712773          CALL Copy_Ncdf_att('time_steps',filename,Child_file)  
    713774          DEALLOCATE(tabtemp1DInt) 
     
    9841045  END SUBROUTINE Interp_Extrap_var 
    9851046  ! 
    986   !************************************************************** 
    987   !   end subroutine Interp_var 
    988   !**************************************************************           
    9891047  !  
    9901048END MODULE agrif_interpolation 
Note: See TracChangeset for help on using the changeset viewer.