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 13027 for vendors/AGRIF/dev_r12970_AGRIF_CMEMS/AGRIF_FILES/modupdatebasic.F90 – NEMO

Ignore:
Timestamp:
2020-06-03T16:36:09+02:00 (4 years ago)
Author:
rblod
Message:

New AGRIF library, see ticket #2129

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendors/AGRIF/dev_r12970_AGRIF_CMEMS/AGRIF_FILES/modupdatebasic.F90

    r5656 r13027  
    220220end subroutine Agrif_basicupdate_average1d 
    221221!=================================================================================================== 
     222 
     223!=================================================================================================== 
     224!  subroutine Agrif_basicupdate_max1d 
     225! 
     226!> Carries out an update by taking the maximum on a parent grid (vector x)from its child grid (vector y). 
     227!--------------------------------------------------------------------------------------------------- 
     228subroutine Agrif_basicupdate_max1d ( x, y, np, nc, s_parent, s_child, ds_parent, ds_child ) 
     229!--------------------------------------------------------------------------------------------------- 
     230    REAL, DIMENSION(np), intent(out)    :: x 
     231    REAL, DIMENSION(nc), intent(in)     :: y 
     232    INTEGER,             intent(in)     :: np,nc 
     233    REAL,                intent(in)     :: s_parent,  s_child 
     234    REAL,                intent(in)     :: ds_parent, ds_child 
     235! 
     236    INTEGER :: i, ii, locind_child_left, coeffraf 
     237    REAL    :: xpos, invcoeffraf 
     238    INTEGER :: nbnonnuls 
     239    INTEGER :: diffmod 
     240! 
     241    coeffraf = nint(ds_parent/ds_child) 
     242    invcoeffraf = 1./coeffraf 
     243! 
     244    if (coeffraf == 1) then 
     245        locind_child_left = 1 + nint((s_parent - s_child)/ds_child) 
     246        x(1:np) = y(locind_child_left:locind_child_left+np-1) 
     247        return 
     248    endif 
     249! 
     250    xpos = s_parent 
     251    x = -HUGE(1.0) 
     252! 
     253    diffmod = 0 
     254! 
     255    IF ( mod(coeffraf,2) == 0 ) diffmod = 1 
     256! 
     257    locind_child_left = 1 + agrif_int((xpos - s_child)/ds_child) 
     258! 
     259    IF (Agrif_UseSpecialValueInUpdate) THEN 
     260        do i = 1,np 
     261            nbnonnuls = 0 
     262!CDIR NOVECTOR 
     263            do ii = -coeffraf/2+locind_child_left+diffmod, & 
     264                     coeffraf/2+locind_child_left 
     265                IF (y(ii) /= Agrif_SpecialValueFineGrid) THEN 
     266                    x(i) = max(x(i),y(ii)) 
     267                ENDIF 
     268            enddo 
     269            locind_child_left = locind_child_left + coeffraf 
     270        enddo 
     271    ELSE 
     272! 
     273!CDIR ALTCODE 
     274        do i = 1,np 
     275!CDIR NOVECTOR 
     276            do ii = -coeffraf/2+locind_child_left+diffmod, & 
     277                     coeffraf/2+locind_child_left 
     278                x(i) = max(x(i),y(ii)) 
     279            enddo 
     280            locind_child_left = locind_child_left + coeffraf 
     281        enddo 
     282    ENDIF 
     283!--------------------------------------------------------------------------------------------------- 
     284end subroutine Agrif_basicupdate_max1d 
     285!=================================================================================================== 
     286 
    222287! 
    223288!=================================================================================================== 
Note: See TracChangeset for help on using the changeset viewer.