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 1300 for trunk/NEMO/NST_SRC/agrif_user.F90 – NEMO

Ignore:
Timestamp:
2009-02-09T16:36:04+01:00 (15 years ago)
Author:
rblod
Message:

Correct a bug in TOP update part

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/NST_SRC/agrif_user.F90

    r1271 r1300  
    5151 
    5252   ! 
     53#if ! defined key_off_tra 
     54 
    5355   SUBROUTINE Agrif_InitValues 
    5456      !!------------------------------------------ 
     
    310312      CALL Agrif_Update_dyn(0) 
    311313 
     314#if defined key_top 
     315      nbcline_trc = 0 
     316#endif 
    312317      nbcline = 0 
    313318 
    314319   END SUBROUTINE Agrif_InitValues 
    315320   ! 
     321 
     322#else 
     323   SUBROUTINE Agrif_InitValues 
     324      !!------------------------------------------ 
     325      !!   *** ROUTINE Agrif_InitValues *** 
     326      !! 
     327      !! ** Purpose :: Declaration of variables to 
     328      !!               be interpolated 
     329      !!------------------------------------------ 
     330      USE Agrif_Util 
     331      USE oce  
     332      USE dom_oce 
     333      USE opa 
     334      USE trc 
     335      USE in_out_manager 
     336      USE agrif_top_update 
     337      USE agrif_top_interp 
     338      USE agrif_top_sponge 
     339 
     340      IMPLICIT NONE 
     341 
     342      REAL(wp) :: tabtrtemp(jpi,jpj,jpk,jptra) 
     343      LOGICAL check_namelist 
     344 
     345      ! 0. Initializations 
     346      !------------------- 
     347#if defined key_orca_r025 || defined key_orca_r05 || defined key_orca_r2 || defined key_orca_r4 
     348      jp_cfg = -1    ! set special value for jp_cfg on fine grids 
     349      cp_cfg = "default" 
     350#endif 
     351 
     352      Call opa_init  ! Initializations of each fine grid 
     353      Call agrif_opa_init 
     354 
     355      ! 1. Declaration of the type of variable which have to be interpolated 
     356      !--------------------------------------------------------------------- 
     357      Call Agrif_Set_type(trb,(/2,2,0,0/),(/3,3,0,0/)) 
     358      Call Agrif_Set_type(trn,(/2,2,0,0/),(/3,3,0,0/)) 
     359      Call Agrif_Set_type(tra,(/2,2,0,0/),(/3,3,0,0/)) 
     360       
     361      ! 2. Space directions for each variables 
     362      !--------------------------------------- 
     363      Call Agrif_Set_raf(trn,(/'x','y','N','N'/)) 
     364      Call Agrif_Set_raf(trb,(/'x','y','N','N'/)) 
     365      Call Agrif_Set_raf(tra,(/'x','y','N','N'/)) 
     366 
     367      ! 3. Type of interpolation 
     368      !-------------------------  
     369      Call Agrif_Set_bcinterp(trn,interp=AGRIF_linear) 
     370      Call Agrif_Set_bcinterp(tra,interp=AGRIF_linear) 
     371 
     372      ! 4. Location of interpolation 
     373      !----------------------------- 
     374      Call Agrif_Set_bc(trn,(/0,1/)) 
     375      Call Agrif_Set_bc(tra,(/-3*Agrif_irhox(),0/)) 
     376 
     377      ! 5. Update type 
     378      !---------------  
     379      Call Agrif_Set_Updatetype(trn, update = AGRIF_Update_Average) 
     380      Call Agrif_Set_Updatetype(trb, update = AGRIF_Update_Average) 
     381 
     382      ! 6. First interpolations of potentially non zero fields 
     383      !------------------------------------------------------- 
     384      Agrif_SpecialValue=0. 
     385      Agrif_UseSpecialValue = .TRUE. 
     386      Call Agrif_Bc_variable(tabtrtemp,trn,calledweight=1.) 
     387      Call Agrif_Bc_variable(tabtrtemp,tra,calledweight=1.,procname=interptrn) 
     388      Agrif_UseSpecialValue = .FALSE. 
     389 
     390      ! 7. Some controls 
     391      !----------------- 
     392      check_namelist = .true. 
     393             
     394      IF( check_namelist ) THEN 
     395      
     396         ! Check time steps            
     397         IF( nint(Agrif_Rhot()) * nint(rdt) .ne. Agrif_Parent(rdt) ) THEN 
     398            WRITE(*,*) 'incompatible time step between grids' 
     399            WRITE(*,*) 'parent grid value : ',Agrif_Parent(rdt) 
     400            WRITE(*,*) 'child  grid value : ',nint(rdt) 
     401            WRITE(*,*) 'value on parent grid should be : ',rdt*Agrif_Rhot() 
     402            STOP 
     403         ENDIF 
     404          
     405         ! Check run length 
     406         IF( Agrif_IRhot() * (Agrif_Parent(nitend)- & 
     407            Agrif_Parent(nit000)+1) .ne. (nitend-nit000+1) ) THEN 
     408            WRITE(*,*) 'incompatible run length between grids' 
     409            WRITE(*,*) 'parent grid value : ',(Agrif_Parent(nitend)- & 
     410               Agrif_Parent(nit000)+1),' time step' 
     411            WRITE(*,*) 'child  grid value : ', & 
     412               (nitend-nit000+1),' time step' 
     413            WRITE(*,*) 'value on child grid should be : ', & 
     414               Agrif_IRhot() * (Agrif_Parent(nitend)- & 
     415               Agrif_Parent(nit000)+1) 
     416            STOP 
     417         ENDIF 
     418          
     419         ! Check coordinates 
     420         IF( ln_zps ) THEN 
     421            ! check parameters for partial steps  
     422            IF( Agrif_Parent(e3zps_min) .ne. e3zps_min ) THEN 
     423               WRITE(*,*) 'incompatible e3zps_min between grids' 
     424               WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_min) 
     425               WRITE(*,*) 'child grid  :',e3zps_min 
     426               WRITE(*,*) 'those values should be identical' 
     427               STOP 
     428            ENDIF           
     429            IF( Agrif_Parent(e3zps_rat) .ne. e3zps_rat ) THEN 
     430               WRITE(*,*) 'incompatible e3zps_rat between grids' 
     431               WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_rat) 
     432               WRITE(*,*) 'child grid  :',e3zps_rat 
     433               WRITE(*,*) 'those values should be identical'                   
     434               STOP 
     435            ENDIF 
     436         ENDIF 
     437        ! Check passive tracer cell 
     438        IF( ndttrc .ne. 1 ) THEN 
     439           WRITE(*,*) 'ndttrc should be equal to 1' 
     440        ENDIF 
     441 
     442      ENDIF 
     443 
     444      CALL Agrif_Update_trc(0) 
     445      nbcline_trc = 0 
     446 
     447   END SUBROUTINE Agrif_InitValues 
     448#endif 
    316449    
    317450SUBROUTINE Agrif_detect(g,sizex) 
Note: See TracChangeset for help on using the changeset viewer.