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 14630 – NEMO

Changeset 14630


Ignore:
Timestamp:
2021-03-23T16:19:36+01:00 (3 years ago)
Author:
jchanut
Message:

AGFdomcfg: 1) restore use of analytical grids (i.e. case where jphgr_msh>0). That may be useful to set up test cases with AGRIF. 2) Add random topography over a flat bottom if nn_bathy = -1 (in place of a Gaussian bump). This illustrates well where the interface matching and update are done. #2638

Location:
utils/tools/DOMAINcfg/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • utils/tools/DOMAINcfg/src/agrif_user.F90

    r14628 r14630  
    4646      ! 
    4747      INTEGER :: irafx, irafy 
    48       LOGICAL :: ln_perio 
     48      LOGICAL :: ln_perio, l_deg 
    4949      ! 
    5050      irafx = agrif_irhox() 
     
    7171      WRITE(*,*)'Size of the High resolution grid: ',jpi,' x ',jpj 
    7272      WRITE(*,*) ' ' 
     73      ln_perio = .FALSE. 
     74      l_deg = .TRUE. 
     75  
     76      IF( jperio == 1 .OR. jperio == 2 .OR. jperio == 4 ) ln_perio=.TRUE. 
     77      IF ( Agrif_Parent(jphgr_msh)==2 & 
     78      &.OR.Agrif_Parent(jphgr_msh)==3 &  
     79      &.OR.Agrif_Parent(jphgr_msh)==5 ) l_deg = .FALSE. 
    7380 
    7481      CALL agrif_init_lonlat() 
    75       ln_perio = .FALSE. 
    76       IF( jperio == 1 .OR. jperio == 2 .OR. jperio == 4 ) ln_perio=.TRUE. 
    77  
    78       WHERE (glamt < -180) glamt = glamt +360. 
    79       WHERE (glamt > +180) glamt = glamt -360. 
     82     
     83      IF ( l_deg ) THEN 
     84         WHERE (glamt < -180) glamt = glamt +360. 
     85         WHERE (glamt > +180) glamt = glamt -360. 
     86         WHERE (glamu < -180) glamu = glamu +360. 
     87         WHERE (glamu > +180) glamu = glamu -360. 
     88         WHERE (glamv < -180) glamv = glamv +360. 
     89         WHERE (glamv > +180) glamv = glamv -360. 
     90         WHERE (glamf < -180) glamf = glamf +360. 
     91         WHERE (glamf > +180) glamf = glamf -360. 
     92      ENDIF 
    8093 
    8194      CALL lbc_lnk( 'glamt', glamt, 'T', 1._wp) 
    8295      CALL lbc_lnk( 'gphit', gphit, 'T', 1._wp) 
    8396 
    84       WHERE (glamu < -180) glamu = glamu +360. 
    85       WHERE (glamu > +180) glamu = glamu -360. 
    8697      CALL lbc_lnk( 'glamu', glamu, 'U', 1._wp) 
    8798      CALL lbc_lnk( 'gphiu', gphiu, 'U', 1._wp) 
    8899 
    89       WHERE (glamv < -180) glamv = glamv +360. 
    90       WHERE (glamv > +180) glamv = glamv -360. 
    91100      CALL lbc_lnk( 'glamv', glamv, 'V', 1._wp) 
    92101      CALL lbc_lnk( 'gphiv', gphiv, 'V', 1._wp) 
    93102 
    94       WHERE (glamf < -180) glamf = glamf +360. 
    95       WHERE (glamf > +180) glamf = glamf -360. 
    96103      CALL lbc_lnk( 'glamf', glamf, 'F', 1._wp) 
    97104      CALL lbc_lnk( 'gphif', gphif, 'F', 1._wp) 
     
    582589      USE agrif_util 
    583590      USE dom_oce 
    584       
     591    
     592      LOGICAL  :: l_deg  
    585593      EXTERNAL :: init_glamt, init_glamu, init_glamv, init_glamf 
    586594      EXTERNAL :: init_gphit, init_gphiu, init_gphiv, init_gphif 
    587595      REAL,EXTERNAL :: longitude_linear_interp 
    588596 
    589       CALL Agrif_Set_external_linear_interp(longitude_linear_interp) 
     597      l_deg = .TRUE. 
     598      IF  ( Agrif_Parent(jphgr_msh)==2 &  
     599      & .OR.Agrif_Parent(jphgr_msh)==3 &  
     600      & .OR.Agrif_Parent(jphgr_msh)==5 ) l_deg = .FALSE. 
     601 
     602      IF ( l_deg ) THEN 
     603         CALL Agrif_Set_external_linear_interp(longitude_linear_interp) 
     604      ENDIF 
    590605 
    591606      CALL Agrif_Init_variable(glamt_id, procname = init_glamt) 
     
    614629         IF ((val_interp) >=180.) val_interp = val_interp - 360. 
    615630      ELSE 
    616          val_interp = coeff * x1 + (1.-coeff) * x2 
     631      val_interp = coeff * x1 + (1.-coeff) * x2 
    617632      ENDIF 
    618633      longitude_linear_interp = val_interp 
  • utils/tools/DOMAINcfg/src/domain.F90

    r14623 r14630  
    219219      IF(lwm) WRITE ( numond, namdom ) 
    220220      ! 
    221  
     221#if defined key_agrif 
     222      IF (.NOT.Agrif_root()) THEN 
     223         jphgr_msh = Agrif_Parent(jphgr_msh) 
     224         nn_bathy = Agrif_Parent(nn_bathy) 
     225         rn_bathy = Agrif_Parent(rn_bathy) 
     226         ppglam0 = Agrif_Parent(ppglam0) 
     227         ppgphi0 = Agrif_Parent(ppgphi0)  
     228         ppe1_deg = Agrif_Parent(ppe1_deg)/Agrif_Rhox() 
     229         ppe2_deg = Agrif_Parent(ppe2_deg)/Agrif_Rhoy() 
     230         ppe1_m = Agrif_Parent(ppe1_m)/Agrif_Rhox() 
     231         ppe2_m = Agrif_Parent(ppe2_m)/Agrif_Rhoy()  
     232      ENDIF 
     233#endif 
    222234 
    223235 
  • utils/tools/DOMAINcfg/src/domhgr.F90

    r14623 r14630  
    124124      ! 
    125125      ! 
     126#if defined key_agrif 
     127      IF (agrif_root()) THEN 
     128#endif 
     129      ! 
    126130      SELECT CASE( jphgr_msh )   !  type of horizontal mesh   
    127131      ! 
    128132      CASE ( 0 )                     !==  read in coordinate.nc file  ==! 
    129133         ! 
    130 #if defined key_agrif 
    131          IF (agrif_root()) THEN 
    132 #endif 
    133134         IF(lwp) WRITE(numout,*) 
    134135         IF(lwp) WRITE(numout,*) '          curvilinear coordinate on the sphere read in "coordinate" file' 
     
    143144            e1e2v (:,:) = e1v(:,:) * e2v(:,:)  
    144145         ENDIF 
    145 #if defined key_agrif 
    146          ELSE 
    147            CALL Agrif_InitValues_cont() 
    148          ENDIF 
    149 #endif 
    150146         ! 
    151147      CASE ( 1 )                     !==  geographical mesh on the sphere with regular (in degree) grid-spacing  ==! 
     
    321317      END SELECT 
    322318       
     319#if defined key_agrif 
     320      ELSE 
     321         CALL Agrif_InitValues_cont() 
     322      ENDIF 
     323#endif 
    323324      ! associated horizontal metrics 
    324325      ! ----------------------------- 
  • utils/tools/DOMAINcfg/src/domzgr.F90

    r14623 r14630  
    562562      INTEGER , ALLOCATABLE, DIMENSION(:,:) ::   idta   ! global domain integer data 
    563563      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   zdta   ! global domain scalar data 
     564      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   zrand  
    564565      !!---------------------------------------------------------------------- 
    565566      ! 
     
    574575         ALLOCATE( idta(jpiglo,jpjglo), STAT=ierror ) 
    575576         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'zgr_bat: unable to allocate idta array' ) 
    576          ALLOCATE( zdta(jpiglo,jpjglo), STAT=ierror ) 
     577         ALLOCATE( zdta(jpiglo,jpjglo), zrand(jpiglo,jpjglo), STAT=ierror ) 
    577578         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'zgr_bat: unable to allocate zdta array' ) 
    578579         ! 
     
    599600         ELSE                                         ! bump centered in the basin 
    600601            IF(lwp) WRITE(numout,*) 
    601             IF(lwp) WRITE(numout,*) '         bathymetry field: flat basin with a bump' 
     602!            IF(lwp) WRITE(numout,*) '         bathymetry field: flat basin with a bump' 
     603            IF(lwp) WRITE(numout,*) '         bathymetry field: flat basin with random noise' 
    602604            ii_bump = jpiglo / 2                           ! i-index of the bump center 
    603605            ij_bump = jpjglo / 2                           ! j-index of the bump center 
     
    605607            h_bump  =  2700._wp                            ! bump height (meters) 
    606608            h_oce   = gdepw_1d(jpk)                        ! background ocean depth (meters) 
    607             IF(lwp) WRITE(numout,*) '            bump characteristics: ' 
    608             IF(lwp) WRITE(numout,*) '               bump center (i,j)   = ', ii_bump, ii_bump 
    609             IF(lwp) WRITE(numout,*) '               bump height         = ', h_bump , ' meters' 
    610             IF(lwp) WRITE(numout,*) '               bump radius         = ', r_bump , ' index' 
    611             IF(lwp) WRITE(numout,*) '            background ocean depth = ', h_oce  , ' meters' 
     609!            IF(lwp) WRITE(numout,*) '            bump characteristics: ' 
     610!            IF(lwp) WRITE(numout,*) '               bump center (i,j)   = ', ii_bump, ii_bump 
     611!            IF(lwp) WRITE(numout,*) '               bump height         = ', h_bump , ' meters' 
     612!            IF(lwp) WRITE(numout,*) '               bump radius         = ', r_bump , ' index' 
     613!            IF(lwp) WRITE(numout,*) '            background ocean depth = ', h_oce  , ' meters' 
    612614            !                                         
     615            CALL RANDOM_SEED() 
     616            CALL RANDOM_NUMBER(zrand) 
    613617            DO jj = 1, jpjglo                              ! zdta : 
    614618               DO ji = 1, jpiglo 
    615                   zi = FLOAT( ji - ii_bump ) * ppe1_m / r_bump 
    616                   zj = FLOAT( jj - ij_bump ) * ppe2_m / r_bump 
    617                   zdta(ji,jj) = h_oce - h_bump * EXP( -( zi*zi + zj*zj ) ) 
     619!                  zi = FLOAT( ji - ii_bump ) * ppe1_m / r_bump 
     620!                  zj = FLOAT( jj - ij_bump ) * ppe2_m / r_bump 
     621!                  zdta(ji,jj) = h_oce - h_bump * EXP( -( zi*zi + zj*zj ) ) 
     622                  zdta(ji,jj) = h_oce + 0.1_wp *h_oce * (zrand(ji,jj)-1._wp)  
    618623               END DO 
    619624            END DO 
     
    657662         misfdep(:,:)=1 
    658663         ! 
    659          DEALLOCATE( idta, zdta ) 
     664         DEALLOCATE( idta, zdta , zrand) 
    660665         ! 
    661666         !                                            ! ================ ! 
Note: See TracChangeset for help on using the changeset viewer.