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.
#1870 (NESTING TOOLS AGRIF create restart files) – NEMO

Opened 7 years ago

Last modified 2 years ago

#1870 closed Bug

NESTING TOOLS AGRIF create restart files — at Version 7

Reported by: jharlass Owned by: sciliberti
Priority: normal Milestone:
Component: AGRIF Version: v3.6
Severity: major Keywords: AGRIF Tools nesting restartability v3.6
Cc: sciliberti

Description (last modified by nicolasmartin)

Context

AGRIF NESTING TOOLS: agrif_create_restart.exe does not work with current NEMO 3.6 version

Analysis

Create restart file for AGRIF NEST from base model restart (global file).

  1. Restart variables of current NEMO version were unknown to nesting tools.
  2. The nest grid can have deeper values than the base grid, if e.g. bathymetry created with ETOPO. Happens in the near bottom levels in ragged bathymetry. Since there are no vlaues to inter/extrapolate they remain zero which causes the model to crash after a few time steps as e.g. zero salinity causes huge gradients, creating instabilty and so on ...

Fix

  1. Add all variables needed.
  2. New routine ("check_interpextrap") that checks for such missing values and replaces them with values from 1 level above.

CHANGES IN: NESTING/src/agrif_create_restart.f90:

  • (a) Revision vs. (b) Working

    a b  
    436458        ENDIF 
    437459        ! 
    438460        ! Variable interpolation according to their position on grid 
    439         !                                    
    440      CASE('un','ub')   
     461        ! 
     462        ! grid U 
     463        ! 3D  
     464     CASE('un','ub','avu','avmu')   
     465        ! irec only for DIMG format ! 
    441466        varname = Ncdf_varname(i) 
    442  
    443467        IF(TRIM(varname)=='un') irec = 6 * z + 2 
    444468        IF(TRIM(varname)=='ub') irec = 2 
    445  
    446         WRITE(*,*) TRIM(varname),'interpolation ...'     
     469!        WRITE(*,*) TRIM(varname),'interpolation ...'     
    447470        vert_coord_name = 'z'              
    448471        posvar='U' 
    449472        Interpolation = .TRUE.   
    450         ! 
    451      CASE('u_io' 
     473        ! 1D                                   
     474     CASE('u_io','ssu_m','utau_b') 
    452475        varname = Ncdf_varname(i)   
    453         WRITE(*,*) TRIM(varname),'interpolation ...'     
     476!        WRITE(*,*) TRIM(varname),'interpolation ...'     
    454477        vert_coord_name = 'z_b'              
    455478        posvar='U' 
    456479        Interpolation = .TRUE.  
    457         !                           
    458      CASE('vn','vb') 
     480        ! 
     481        ! grid V 
     482        ! 3D 
     483     CASE('vn','vb','avmv') 
    459484        varname = Ncdf_varname(i) 
    460  
    461485        IF(TRIM(varname)=='vn') irec = 7 * z + 2 
    462486        IF(TRIM(varname)=='vb') irec = 2 + z 
    463  
    464         WRITE(*,*) TRIM(varname),'interpolation ...'       
     487!        WRITE(*,*) TRIM(varname),'interpolation ...'       
    465488        vert_coord_name = 'z' 
    466489        posvar='V' 
    467490        Interpolation = .TRUE.      
    468         !               
    469      CASE('v_io') 
     491        ! 1D              
     492     CASE('v_io','ssv_m','vtau_b') 
    470493        varname = Ncdf_varname(i) 
    471         WRITE(*,*) TRIM(varname),'interpolation ...'       
     494!        WRITE(*,*) TRIM(varname),' interpolation ...'       
    472495        vert_coord_name = 'z_b' 
    473496        posvar='V' 
    474497        Interpolation = .TRUE. 
    475         !              
    476      CASE('gcx','gcxb','sshb','sshn','sst_io','sss_io','gsst') 
    477         varname = Ncdf_varname(i)     
    478  
    479         IF(TRIM(varname)=='gcx') irec = 12 * z + 2 
    480         IF(TRIM(varname)=='gcxb')  irec = 12 * z + 3 
    481         IF(TRIM(varname)=='sshb') irec = 12 * z + 4 
    482         IF(TRIM(varname)=='sshn') irec = 12 * z + 5 
    483  
    484         WRITE(*,*) TRIM(varname),'interpolation ...'  
    485         vert_coord_name = 'z_b'              
    486         posvar='T' 
    487         Interpolation = .TRUE.      
    488  
    489         !   
    490      CASE ('tb','sb','sn','tn') 
     498        ! 
     499        ! grid T 
     500        ! 3D 
     501     CASE ('tb','sb','tn','sn','en','avt','avm','dissl','rhop','qsr_hc_b') 
    491502        varname = Ncdf_varname(i)  
    492  
    493503        IF(TRIM(varname)=='sn') irec = 9 * z + 2 
    494504        IF(TRIM(varname)=='tn') irec = 8 * z + 2 
    495505        IF(TRIM(varname)=='sb') irec = 3 * z + 2 
    496506        IF(TRIM(varname)=='tb') irec = 2 * z + 2 
    497  
    498         WRITE(*,*) TRIM(varname),'interpolation ...'      
     507        IF(TRIM(varname)=='tb') irec = 2 * z + 2 
     508        IF(TRIM(varname)=='en') irec = 12* z + 6 
     509 !       WRITE(*,*) TRIM(varname),' interpolation ...'      
    499510        vert_coord_name = 'z' 
    500511        posvar='T' 
    501512        Interpolation = .TRUE.             
    502  
    503      CASE('en') 
    504         varname = Ncdf_varname(i)  
    505         irec = 12 * z + 6 
    506         WRITE(*,*) TRIM(varname),'interpolation ...'      
    507         vert_coord_name = 'z' 
     513        ! 1D 
     514     CASE('gcx','gcxb','sshb','sshn','sst_io','sss_io','gsst','sss_m','sst_m','ssh_m','frq_m','qns_b','emp_b','sfx_b','sbc_hc_b','sbc_sc_b','fraqsr_1lev') 
     515        varname = Ncdf_varname(i)     
     516        IF(TRIM(varname)=='gcx')  irec = 12 * z + 2 
     517        IF(TRIM(varname)=='gcxb') irec = 12 * z + 3 
     518        IF(TRIM(varname)=='sshb') irec = 12 * z + 4 
     519        IF(TRIM(varname)=='sshn') irec = 12 * z + 5 
     520 !       WRITE(*,*) TRIM(varname),' interpolation ...'  
     521        vert_coord_name = 'z_b'              
    508522        posvar='T' 
    509         Interpolation = .TRUE.              
    510  
     523        Interpolation = .TRUE.      
     524        ! 
     525        ! NO interpolation 
     526        ! 
    511527     CASE ('rotb','rotn','hdivb','hdivn') 
    512528        Interpolation = .FALSE. 
    513529        ! 

FULL COURCE CODE ATTACHED:

NESTING/src/agrif_create_restart.f90
and
NESTING/src/agrif_extrapolation.f90 with new routine: "check_interpextrap"

Commit History (0)

(No commits)

Change History (9)

Changed 7 years ago by jharlass

routine checking for missing values: check_interpextrap

comment:1 Changed 7 years ago by nemo

  • Keywords CREATE removed

comment:2 Changed 7 years ago by nemo

  • Keywords nesting added; NESTING removed

comment:3 Changed 7 years ago by nemo

  • Keywords restart added; RESTART removed

comment:4 Changed 7 years ago by nemo

  • Keywords tools added; TOOLS removed

comment:5 Changed 7 years ago by mdunphy

Hi Jan,

Thanks for this, it eliminates a bunch of post-processing work to fix up the partial steps. There's a typo in the allocations in check_interpextrap (see attached patch), but otherwise it looks good!

Changed 7 years ago by mdunphy

Fix for the allocations in check_interpextrap(). This patch is for agrif_extrapolation.f90 attached to this ticket (#1870), not for the version under SVN.

comment:6 Changed 7 years ago by clevy

  • Owner changed from nemo to sciliberti

comment:7 Changed 7 years ago by nicolasmartin

  • Description modified (diff)
Note: See TracTickets for help on using tickets.