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 13141 for NEMO – NEMO

Changeset 13141 for NEMO


Ignore:
Timestamp:
2020-06-22T18:27:34+02:00 (4 years ago)
Author:
jchanut
Message:

#2129, corrections/add ons to initial state interpolation with AGRIF
1) add namelist flag for child grid initial state interpolation - ice not considered yet
2) provide depths and not thicknesses as inputs to vertical linear interpolation
3) extend initial state interpolation to a restart scenario for parent grid (warning should be added in that case in order to prevent users doing this at each model restart...)
The online interpolation seems to work fine in the VORTEX case (provided 0. is not considered as a special value in the initial velocity field, i.e. ln_spc_dyn=F)

Location:
NEMO/branches/2020/dev_r12973_AGRIF_CMEMS
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/cfgs/SHARED/namelist_ref

    r13058 r13141  
    638638&namagrif      !  AGRIF zoom                                            ("key_agrif") 
    639639!----------------------------------------------------------------------- 
    640    ln_agrif_2way = .true.  !  activate two way nesting 
    641    ln_spc_dyn    = .true.  !  use 0 as special value for dynamics 
    642    rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s] 
    643    rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s] 
    644    rn_trelax_tra = 0.01    !  inverse of relaxation time (in steps) for tracers [] 
    645    rn_trelax_dyn = 0.01    !  inverse of relaxation time (in steps) for dynamics [] 
    646    ln_chk_bathy  = .false. !  =T  check the parent bathymetry 
    647    ln_bry_south  = .true.  !  =T  south boundary open 
     640   ln_agrif_2way   = .true.  !  activate two way nesting 
     641   ln_init_chfrpar = .false. !  initialize child grids from parent 
     642   ln_spc_dyn      = .true.  !  use 0 as special value for dynamics 
     643   rn_sponge_tra   = 2880.   !  coefficient for tracer   sponge layer [m2/s] 
     644   rn_sponge_dyn   = 2880.   !  coefficient for dynamics sponge layer [m2/s] 
     645   rn_trelax_tra   = 0.01    !  inverse of relaxation time (in steps) for tracers [] 
     646   rn_trelax_dyn   = 0.01    !  inverse of relaxation time (in steps) for dynamics [] 
     647   ln_chk_bathy    = .false. !  =T  check the parent bathymetry 
     648   ln_bry_south    = .true.  !  =T  south boundary open 
    648649/ 
    649650!----------------------------------------------------------------------- 
  • NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_oce.F90

    r13026 r13141  
    1919   
    2020   !                                              !!* Namelist namagrif: AGRIF parameters 
     21   LOGICAL , PUBLIC ::   ln_init_chfrpar = .FALSE. !: set child grids initial state from parent 
    2122   LOGICAL , PUBLIC ::   ln_agrif_2way = .TRUE.    !: activate two way nesting  
    2223   LOGICAL , PUBLIC ::   ln_spc_dyn    = .FALSE.   !: use zeros (.false.) or not (.true.) in 
  • NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_oce_interp.F90

    r13026 r13141  
    717717      REAL(wp) :: zhtot 
    718718      REAL(wp), DIMENSION(k1:k2,1:jpts) :: tabin 
    719       REAL(wp), DIMENSION(k1:k2) :: h_in 
    720       REAL(wp), DIMENSION(1:jpk) :: h_out 
     719      REAL(wp), DIMENSION(k1:k2) :: h_in, z_in 
     720      REAL(wp), DIMENSION(1:jpk) :: h_out, z_out 
    721721      !!---------------------------------------------------------------------- 
    722722 
     
    790790                     tabin(jk,:) = ptab(ji,jj,jk,n1:n2-1) 
    791791                  END DO 
     792                  z_in(1) = 0.5_wp * h_in(1) - zhtot + ht0_parent(ji,jj) 
     793                  DO jk=2,N_in 
     794                     z_in(jk) = z_in(jk-1) + 0.5_wp * h_in(jk) 
     795                  ENDDO 
     796 
    792797                  N_out = 0 
    793798                  DO jk=1,jpk ! jpk of child grid 
     
    796801                     h_out(jk) = e3t(ji,jj,jk,Krhs_a) 
    797802                  ENDDO 
     803 
     804                  z_out(1) = 0.5_wp * h_out(1) - SUM(h_out(1:N_out)) + ht_0(ji,jj) 
     805                  DO jk=2,N_out 
     806                     z_out(jk) = z_out(jk-1) + 0.5_wp * h_out(jk) 
     807                  ENDDO 
     808 
    798809                  IF (N_in*N_out > 0) THEN 
    799810                     IF( l_ini_child ) THEN 
    800                         CALL remap_linear(tabin(1:N_in,1:jpts),h_in(1:N_in),ts(ji,jj,1:N_out,1:jpts,Krhs_a),          & 
    801                                       &   h_out(1:N_out),N_in,N_out,jpts)   
     811                        CALL remap_linear(tabin(1:N_in,1:jpts),z_in(1:N_in),ts(ji,jj,1:N_out,1:jpts,Krhs_a),          & 
     812                                      &   z_out(1:N_out),N_in,N_out,jpts)   
    802813                     ELSE  
    803814                        CALL reconstructandremap(tabin(1:N_in,1:jpts),h_in(1:N_in),ts(ji,jj,1:N_out,1:jpts,Krhs_a),   & 
     
    850861      REAL(wp) :: zrhoy, zhtot 
    851862      ! vertical interpolation: 
    852       REAL(wp), DIMENSION(k1:k2) :: tabin, h_in 
    853       REAL(wp), DIMENSION(1:jpk) :: h_out 
     863      REAL(wp), DIMENSION(k1:k2) :: tabin, h_in, z_in 
     864      REAL(wp), DIMENSION(1:jpk) :: h_out, z_out 
    854865      INTEGER  :: N_in, N_out,item 
    855866      REAL(wp) :: h_diff 
     
    924935                     ENDIF 
    925936                 ENDDO 
     937                 z_in(1) = 0.5_wp * h_in(1) - zhtot + hu0_parent(ji,jj)  
     938                 DO jk=2,N_in 
     939                    z_in(jk) = z_in(jk-1) + 0.5_wp * h_in(jk) 
     940                 ENDDO 
    926941                      
    927942                 N_out = 0 
     
    931946                    h_out(N_out) = e3u(ji,jj,jk,Krhs_a) 
    932947                 ENDDO 
     948 
     949                 z_out(1) = 0.5_wp * h_out(1) - SUM(h_out(1:N_out)) + hu_0(ji,jj) 
     950                 DO jk=2,N_out 
     951                    z_out(jk) = z_out(jk-1) + 0.5_wp * h_out(jk)  
     952                 ENDDO   
     953 
    933954                 IF (N_in*N_out > 0) THEN 
    934955                     IF( l_ini_child ) THEN 
    935                         CALL remap_linear       (tabin(1:N_in),h_in(1:N_in),uu(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 
     956                        CALL remap_linear       (tabin(1:N_in),z_in(1:N_in),uu(ji,jj,1:N_out,Krhs_a),z_out(1:N_out),N_in,N_out,1) 
    936957                     ELSE 
    937958                        CALL reconstructandremap(tabin(1:N_in),h_in(1:N_in),uu(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 
     
    964985      REAL(wp) :: zrhox 
    965986      ! vertical interpolation: 
    966       REAL(wp), DIMENSION(k1:k2) :: tabin, h_in 
    967       REAL(wp), DIMENSION(1:jpk) :: h_out 
     987      REAL(wp), DIMENSION(k1:k2) :: tabin, h_in, z_in 
     988      REAL(wp), DIMENSION(1:jpk) :: h_out, z_out 
    968989      INTEGER  :: N_in, N_out, item 
    969990      REAL(wp) :: h_diff, zhtot 
     
    10291050                     ENDIF 
    10301051                     zhtot = zhtot + h_in(jk) 
    1031                     IF( h_in(jk) .GT. 0. ) THEN 
    1032                      tabin(jk) = ptab(ji,jj,jk,1)/(e1v(ji,jj)*zrhox*h_in(jk)) 
    1033                     ELSE 
    1034                      tabin(jk)  = 0. 
    1035                     ENDIF  
    1036                  ENDDO 
    1037              
     1052                     IF( h_in(jk) .GT. 0. ) THEN 
     1053                       tabin(jk) = ptab(ji,jj,jk,1)/(e1v(ji,jj)*zrhox*h_in(jk)) 
     1054                     ELSE 
     1055                       tabin(jk)  = 0. 
     1056                     ENDIF  
     1057                  ENDDO 
     1058 
     1059                  z_in(1) = 0.5_wp * h_in(1) - zhtot + hv0_parent(ji,jj) 
     1060                  DO jk=2,N_in 
     1061                     z_in(jk) = z_in(jk-1) + 0.5_wp * h_in(jk) 
     1062                  ENDDO 
     1063 
    10381064                  N_out = 0 
    10391065                  DO jk=1,jpk 
    1040                      if (vmask(ji,jj,jk) == 0) EXIT 
     1066                     IF (vmask(ji,jj,jk) == 0) EXIT 
    10411067                     N_out = N_out + 1 
    10421068                     h_out(N_out) = e3v(ji,jj,jk,Krhs_a) 
    1043                   END DO 
     1069                  ENDDO 
     1070 
     1071                  z_out(1) = 0.5_wp * h_out(1) - SUM(h_out(1:N_out)) + hv_0(ji,jj) 
     1072                  DO jk=2,N_out 
     1073                     z_out(jk) = z_out(jk-1) + 0.5_wp * h_out(jk) 
     1074                  ENDDO 
     1075  
    10441076                  IF (N_in*N_out > 0) THEN 
    10451077                     IF( l_ini_child ) THEN 
    1046                         CALL remap_linear       (tabin(1:N_in),h_in(1:N_in),vv(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 
     1078                        CALL remap_linear       (tabin(1:N_in),z_in(1:N_in),vv(ji,jj,1:N_out,Krhs_a),z_out(1:N_out),N_in,N_out,1) 
    10471079                     ELSE 
    10481080                        CALL reconstructandremap(tabin(1:N_in),h_in(1:N_in),vv(ji,jj,1:N_out,Krhs_a),h_out(1:N_out),N_in,N_out,1) 
  • NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/NST/agrif_user.F90

    r13133 r13141  
    5252      INTEGER :: jn 
    5353 
     54      IF(lwp) WRITE(numout,*) ' ' 
     55      IF(lwp) WRITE(numout,*) 'AGRIF: interp child initial state from parent' 
     56      IF(lwp) WRITE(numout,*) ' ' 
     57 
    5458      l_ini_child = .TRUE. 
    5559      Agrif_SpecialValue    = 0._wp 
    5660      Agrif_UseSpecialValue = .TRUE. 
     61      CALL Agrif_childgrid_to_parentgrid() 
     62      l_ini_child = .TRUE. 
     63      CALL Agrif_parentgrid_to_childgrid()   
    5764      uu(:,:,:,:) = 0.  ;  vv(:,:,:,:) = 0.   ;  ts(:,:,:,:,:) = 0. 
    5865        
     
    6168      ! Brutal fix to pas 1x1 refinment.  
    6269  !    IF(Agrif_Irhox() == 1) THEN 
    63          CALL Agrif_Init_Variable(tsini_id, procname=agrif_initts) 
     70  !       CALL Agrif_Init_Variable(tsini_id, procname=agrif_initts) 
    6471  !    ELSE 
    65    !      CALL Agrif_Init_Variable(tsini_id, procname=interptsn) 
     72      CALL Agrif_Init_Variable(tsini_id, procname=interptsn) 
    6673 
    6774  !    ENDIF 
     75! just for VORTEX because Parent velocities can actually be exactly zero 
     76!      Agrif_UseSpecialValue = .FALSE. 
    6877      Agrif_UseSpecialValue = ln_spc_dyn 
    6978      use_sign_north = .TRUE. 
    7079      sign_north = -1. 
    71   !    CALL Agrif_Init_Variable(uini_id , procname=interpun ) 
    72   !    CALL Agrif_Init_Variable(vini_id , procname=interpvn ) 
    73        use_sign_north = .FALSE. 
     80      CALL Agrif_Init_Variable(uini_id , procname=interpun ) 
     81      CALL Agrif_Init_Variable(vini_id , procname=interpvn ) 
     82      use_sign_north = .FALSE. 
    7483 
    7584      Agrif_UseSpecialValue = .FALSE.            ! 
    7685      l_ini_child = .FALSE. 
     86      CALL Agrif_childgrid_to_parentgrid() 
     87      l_ini_child = .FALSE. 
     88      CALL Agrif_parentgrid_to_childgrid()  
     89 
    7790      Krhs_a = Kaa ; Kmm_a = Kmm 
    7891 
     
    281294      mbkv_parent(:,:) = MAX( NINT( zk(:,:) ), 1 )    
    282295 
    283  
    284       CALL Agrif_Init_Variable(sshini_id, procname=agrif_initssh) 
    285       CALL lbc_lnk( 'Agrif_Init_Domain', ssh(:,:,Kbb), 'T', 1. ) 
    286       DO jk = 1, jpk 
    287             e3t(:,:,jk,Kbb) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kbb)  ) & 
    288       &                            / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
    289                      &              + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) ) 
    290       END DO 
     296      IF ( ln_init_chfrpar ) THEN  
     297         CALL Agrif_Init_Variable(sshini_id, procname=agrif_initssh) 
     298         CALL lbc_lnk( 'Agrif_Init_Domain', ssh(:,:,Kbb), 'T', 1. ) 
     299         DO jk = 1, jpk 
     300               e3t(:,:,jk,Kbb) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kbb)  ) & 
     301                        &             / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
     302                        &              + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) ) 
     303         END DO 
     304      ENDIF 
    291305 
    292306      ! check if masks and bathymetries match 
     
    850864      ! 
    851865      INTEGER  ::   ios                 ! Local integer output status for namelist read 
    852       NAMELIST/namagrif/ ln_agrif_2way, rn_sponge_tra, rn_sponge_dyn, rn_trelax_tra, rn_trelax_dyn, & 
     866      NAMELIST/namagrif/ ln_agrif_2way, ln_init_chfrpar, rn_sponge_tra, rn_sponge_dyn, rn_trelax_tra, rn_trelax_dyn, & 
    853867                       & ln_spc_dyn, ln_chk_bathy, ln_bry_south 
    854868      !!-------------------------------------------------------------------------------------- 
     
    866880         WRITE(numout,*) '   Namelist namagrif : set AGRIF parameters' 
    867881         WRITE(numout,*) '      Two way nesting activated ln_agrif_2way         = ', ln_agrif_2way 
     882         WRITE(numout,*) '      child initial state from parent ln_init_chfrpar = ', ln_init_chfrpar 
    868883         WRITE(numout,*) '      sponge coefficient for tracers    rn_sponge_tra = ', rn_sponge_tra, ' m^2/s' 
    869884         WRITE(numout,*) '      sponge coefficient for dynamics   rn_sponge_tra = ', rn_sponge_dyn, ' m^2/s' 
  • NEMO/branches/2020/dev_r12973_AGRIF_CMEMS/src/OCE/DOM/istate.F90

    r13103 r13141  
    8787#endif 
    8888 
     89#if defined key_agrif 
     90      IF ( (.NOT.Agrif_root()).AND.ln_init_chfrpar ) THEN 
     91         numror = 0                           ! define numror = 0 -> no restart file to read 
     92         ln_1st_euler = .true.                ! Set time-step indicator at nit000 (euler forward) 
     93         CALL day_init  
     94         CALL agrif_istate( Kbb, Kmm, Kaa )   ! Interp from parent 
     95         ! 
     96         ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)  
     97         ssh (:,:,Kmm)     = ssh(:,:,Kbb) 
     98         uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb) 
     99         vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb) 
     100      ELSE 
     101#endif 
    89102      IF( ln_rstart ) THEN                    ! Restart from a file 
    90103         !                                    ! ------------------- 
     
    105118               uu  (:,:,:,Kbb) = 0._wp 
    106119               vv  (:,:,:,Kbb) = 0._wp   
    107 #if defined key_agrif 
    108             ELSE 
    109                CALL agrif_istate( Kbb, Kmm, Kaa )  
    110 #endif 
    111120            ENDIF 
    112121            ! 
     
    157166         !  
    158167      ENDIF  
     168#if defined key_agrif 
     169      ENDIF 
     170#endif 
    159171      !  
    160172      ! Initialize "now" and "before" barotropic velocities: 
Note: See TracChangeset for help on using the changeset viewer.