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 11603 for NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_oce_interp.F90 – NEMO

Ignore:
Timestamp:
2019-09-26T17:27:43+02:00 (5 years ago)
Author:
jchanut
Message:

#2222, 1) correct time interpolation of barotropic velocities in corners. 2) Clean remapping module and enable remapping several variables at the same time. At this stage, vertical remapping doesn't change VORTEX results with an identical vertical grid ONLY in one way mode and a linearized free surface (within truncature errors).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/NST/agrif_oce_interp.F90

    r11590 r11603  
    4545   PUBLIC   interpe3t, interpumsk, interpvmsk 
    4646 
     47   INTEGER ::   bdy_tinterp = 0 
     48 
    4749#  include "vectopt_loop_substitute.h90" 
    4850   !!---------------------------------------------------------------------- 
     
    501503         CALL Agrif_Bc_variable( vb2b_interp_id, calledweight=1._wp, procname=interpvb2b )  
    502504         ! 
     505         bdy_tinterp = 1 
    503506         CALL Agrif_Bc_variable( unb_id        , calledweight=1._wp, procname=interpunb  ) ! After 
    504          CALL Agrif_Bc_variable( vnb_id        , calledweight=1._wp, procname=interpvnb  ) 
     507         CALL Agrif_Bc_variable( vnb_id        , calledweight=1._wp, procname=interpvnb  )   
    505508         ! 
     509         bdy_tinterp = 2 
    506510         CALL Agrif_Bc_variable( unb_id        , calledweight=0._wp, procname=interpunb  ) ! Before 
    507          CALL Agrif_Bc_variable( vnb_id        , calledweight=0._wp, procname=interpvnb  )          
     511         CALL Agrif_Bc_variable( vnb_id        , calledweight=0._wp, procname=interpvnb  )    
    508512      ELSE ! Linear interpolation 
    509513         ! 
     
    703707               ENDDO 
    704708               IF (N_in > 0) THEN 
    705                   DO jn=1,jpts 
    706                      call reconstructandremap(tabin(1:N_in,jn),h_in(1:N_in),ptab_child(ji,jj,1:N_out,jn),h_out(1:N_out),N_in,N_out) 
    707                   ENDDO 
     709                  CALL reconstructandremap(tabin(1:N_in,1:jpts),h_in(1:N_in),ptab_child(ji,jj,1:N_out,1:jpts),h_out(1:N_out),N_in,N_out,jpts) 
    708710               ENDIF 
    709711            ENDDO 
     
    800802              ENDIF 
    801803          
    802               IF (N_in * N_out > 0) THEN 
    803                  h_diff = sum(h_out(1:N_out))-sum(h_in(1:N_in)) 
    804 ! Should be able to remove the next IF/ELSEIF statement once scale factors are dealt with properly 
    805                  if (h_diff < -1.e4) then 
    806                     print *,'CHECK YOUR BATHY ...', h_diff, sum(h_out(1:N_out)), sum(h_in(1:N_in)) 
    807 !                    stop 
    808                  endif 
    809               ENDIF 
    810               call reconstructandremap(tabin(1:N_in),h_in(1:N_in),ua(ji,jj,1:N_out),h_out(1:N_out),N_in,N_out) 
     804              CALL reconstructandremap(tabin(1:N_in),h_in(1:N_in),ua(ji,jj,1:N_out),h_out(1:N_out),N_in,N_out,1) 
    811805            ENDDO 
    812806         ENDDO 
     
    881875                 CYCLE 
    882876               ENDIF 
    883                call reconstructandremap(tabin(1:N_in),h_in(1:N_in),va(ji,jj,1:N_out),h_out(1:N_out),N_in,N_out) 
     877               call reconstructandremap(tabin(1:N_in),h_in(1:N_in),va(ji,jj,1:N_out),h_out(1:N_out),N_in,N_out,1) 
    884878            END DO 
    885879         END DO 
     
    916910         DO ji = i1, i2 
    917911            DO jj = j1, j2 
    918                IF    ( utint_stage(ji,jj) == 1  ) THEN 
    919                   ztcoeff = zrhot * (  zt1**2._wp * (       zt1 - 1._wp)        & 
    920                      &               - zt0**2._wp * (       zt0 - 1._wp)        ) 
    921                ELSEIF( utint_stage(ji,jj) == 2  ) THEN 
    922                   ztcoeff = zrhot * (  zt1        * (       zt1 - 1._wp)**2._wp & 
    923                      &               - zt0        * (       zt0 - 1._wp)**2._wp ) 
    924                ELSEIF( utint_stage(ji,jj) == 0  ) THEN                 
    925                   ztcoeff = 1._wp 
    926                ELSE 
    927                   ztcoeff = 0._wp 
    928                ENDIF 
    929                !    
    930                ubdy(ji,jj) = ubdy(ji,jj) + ztcoeff * ptab(ji,jj) 
    931                !             
    932                IF (( utint_stage(ji,jj) == 2 ).OR.( utint_stage(ji,jj) == 0 )) THEN 
    933                   ubdy(ji,jj) = ubdy(ji,jj) / (zrhoy*e2u(ji,jj)) * umask(ji,jj,1) 
    934                   utint_stage(ji,jj) = 3 
    935                ELSE 
     912               IF ( utint_stage(ji,jj) < (bdy_tinterp + 1) ) THEN 
     913                  IF    ( utint_stage(ji,jj) == 1  ) THEN 
     914                     ztcoeff = zrhot * (  zt1**2._wp * (       zt1 - 1._wp)        & 
     915                        &               - zt0**2._wp * (       zt0 - 1._wp)        ) 
     916                  ELSEIF( utint_stage(ji,jj) == 2  ) THEN 
     917                     ztcoeff = zrhot * (  zt1        * (       zt1 - 1._wp)**2._wp & 
     918                        &               - zt0        * (       zt0 - 1._wp)**2._wp ) 
     919                  ELSEIF( utint_stage(ji,jj) == 0  ) THEN                 
     920                     ztcoeff = 1._wp 
     921                  ELSE 
     922                     ztcoeff = 0._wp 
     923                  ENDIF 
     924                  !    
     925                  ubdy(ji,jj) = ubdy(ji,jj) + ztcoeff * ptab(ji,jj) 
     926                  !             
     927                  IF (( utint_stage(ji,jj) == 2 ).OR.( utint_stage(ji,jj) == 0 )) THEN 
     928                     ubdy(ji,jj) = ubdy(ji,jj) / (zrhoy*e2u(ji,jj)) * umask(ji,jj,1) 
     929                  ENDIF 
     930                  ! 
    936931                  utint_stage(ji,jj) = utint_stage(ji,jj) + 1 
    937932               ENDIF 
     
    966961         DO ji = i1, i2 
    967962            DO jj = j1, j2 
    968                IF    ( vtint_stage(ji,jj) == 1  ) THEN 
    969                   ztcoeff = zrhot * (  zt1**2._wp * (       zt1 - 1._wp)        & 
    970                      &               - zt0**2._wp * (       zt0 - 1._wp)        ) 
    971                ELSEIF( vtint_stage(ji,jj) == 2  ) THEN 
    972                   ztcoeff = zrhot * (  zt1        * (       zt1 - 1._wp)**2._wp & 
    973                      &               - zt0        * (       zt0 - 1._wp)**2._wp ) 
    974                ELSEIF( vtint_stage(ji,jj) == 0  ) THEN                 
    975                   ztcoeff = 1._wp 
    976                ELSE 
    977                   ztcoeff = 0._wp 
    978                ENDIF 
    979                !    
    980                vbdy(ji,jj) = vbdy(ji,jj) + ztcoeff * ptab(ji,jj) 
    981                !             
    982                IF (( vtint_stage(ji,jj) == 2 ).OR.( vtint_stage(ji,jj) == 0 )) THEN 
    983                   vbdy(ji,jj) = vbdy(ji,jj) / (zrhox*e1v(ji,jj)) * vmask(ji,jj,1) 
    984                   vtint_stage(ji,jj) = 3 
    985                ELSE 
     963               IF ( vtint_stage(ji,jj) < (bdy_tinterp + 1) ) THEN 
     964                  IF    ( vtint_stage(ji,jj) == 1  ) THEN 
     965                     ztcoeff = zrhot * (  zt1**2._wp * (       zt1 - 1._wp)        & 
     966                        &               - zt0**2._wp * (       zt0 - 1._wp)        ) 
     967                  ELSEIF( vtint_stage(ji,jj) == 2  ) THEN 
     968                     ztcoeff = zrhot * (  zt1        * (       zt1 - 1._wp)**2._wp & 
     969                        &               - zt0        * (       zt0 - 1._wp)**2._wp ) 
     970                  ELSEIF( vtint_stage(ji,jj) == 0  ) THEN                 
     971                     ztcoeff = 1._wp 
     972                  ELSE 
     973                     ztcoeff = 0._wp 
     974                  ENDIF 
     975                  !    
     976                  vbdy(ji,jj) = vbdy(ji,jj) + ztcoeff * ptab(ji,jj) 
     977                  !             
     978                  IF (( vtint_stage(ji,jj) == 2 ).OR.( vtint_stage(ji,jj) == 0 )) THEN 
     979                     vbdy(ji,jj) = vbdy(ji,jj) / (zrhox*e1v(ji,jj)) * vmask(ji,jj,1) 
     980                  ENDIF 
     981                  ! 
    986982                  vtint_stage(ji,jj) = vtint_stage(ji,jj) + 1 
    987983               ENDIF 
     
    12491245               ENDDO 
    12501246               IF (N_in > 0) THEN 
    1251                   CALL reconstructandremap(tabin(1:N_in),h_in,avm_k(ji,jj,1:N_out),h_out,N_in,N_out) 
     1247                  CALL reconstructandremap(tabin(1:N_in),h_in,avm_k(ji,jj,1:N_out),h_out,N_in,N_out,1) 
    12521248               ENDIF 
    12531249            ENDDO 
Note: See TracChangeset for help on using the changeset viewer.