#1870 closed Bug (fixed)
NESTING TOOLS AGRIF create restart files
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).
- Restart variables of current NEMO version were unknown to nesting tools.
- 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
- Add all variables needed.
- 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 436 458 ENDIF 437 459 ! 438 460 ! 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 ! 441 466 varname = Ncdf_varname(i) 442 443 467 IF(TRIM(varname)=='un') irec = 6 * z + 2 444 468 IF(TRIM(varname)=='ub') irec = 2 445 446 WRITE(*,*) TRIM(varname),'interpolation ...' 469 ! WRITE(*,*) TRIM(varname),'interpolation ...' 447 470 vert_coord_name = 'z' 448 471 posvar='U' 449 472 Interpolation = .TRUE. 450 ! 451 CASE('u_io' )473 ! 1D 474 CASE('u_io','ssu_m','utau_b') 452 475 varname = Ncdf_varname(i) 453 WRITE(*,*) TRIM(varname),'interpolation ...'476 ! WRITE(*,*) TRIM(varname),'interpolation ...' 454 477 vert_coord_name = 'z_b' 455 478 posvar='U' 456 479 Interpolation = .TRUE. 457 ! 458 CASE('vn','vb') 480 ! 481 ! grid V 482 ! 3D 483 CASE('vn','vb','avmv') 459 484 varname = Ncdf_varname(i) 460 461 485 IF(TRIM(varname)=='vn') irec = 7 * z + 2 462 486 IF(TRIM(varname)=='vb') irec = 2 + z 463 464 WRITE(*,*) TRIM(varname),'interpolation ...' 487 ! WRITE(*,*) TRIM(varname),'interpolation ...' 465 488 vert_coord_name = 'z' 466 489 posvar='V' 467 490 Interpolation = .TRUE. 468 ! 469 CASE('v_io' )491 ! 1D 492 CASE('v_io','ssv_m','vtau_b') 470 493 varname = Ncdf_varname(i) 471 WRITE(*,*) TRIM(varname),'interpolation ...'494 ! WRITE(*,*) TRIM(varname),' interpolation ...' 472 495 vert_coord_name = 'z_b' 473 496 posvar='V' 474 497 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') 491 502 varname = Ncdf_varname(i) 492 493 503 IF(TRIM(varname)=='sn') irec = 9 * z + 2 494 504 IF(TRIM(varname)=='tn') irec = 8 * z + 2 495 505 IF(TRIM(varname)=='sb') irec = 3 * z + 2 496 506 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 ...' 499 510 vert_coord_name = 'z' 500 511 posvar='T' 501 512 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' 508 522 posvar='T' 509 Interpolation = .TRUE. 510 523 Interpolation = .TRUE. 524 ! 525 ! NO interpolation 526 ! 511 527 CASE ('rotb','rotn','hdivb','hdivn') 512 528 Interpolation = .FALSE. 513 529 !
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)
Attachments (4)
Change History (20)
Changed 7 years ago by jharlass
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)
comment:8 Changed 7 years ago by clevy
- Cc sciliberti added
- Status changed from new to assigned
comment:9 Changed 7 years ago by clevy
- Priority changed from critical to major
comment:10 Changed 7 years ago by nemo
- Keywords Tools added; tools removed
comment:11 Changed 7 years ago by nemo
- Keywords restartability added; restart removed
comment:12 Changed 7 years ago by nemo
- Keywords release-3.6* added
comment:13 Changed 7 years ago by nemo
- Keywords release-3.6* removed
comment:14 Changed 6 years ago by jharlass
- Severity set to major
I uploaded the recent version for agrif_create_restart.f90 and the new checking routine in agrif_extrapolation.2.f90, which now is only called for 3d variables and replaces only (if necessary) below level 2. nn_fsbc has been added to the agrif restart files and the case of unknown variables is covered. Thereby we also encountered a conversion error affecting qsr_hc_b, with values of 2.E-5 and smaller. To overcome automatic conversion in netcdf we deallcoate/allocate read4d real variable every time. According changes:
-
io_netcdf.f90
1337 1337 IF(.NOT. ASSOCIATED(tabvar)) THEN 1338 1338 ALLOCATE(tabvar(dim1,dim2,1,1)) 1339 1339 ELSE 1340 IF ((SIZE(tabvar,1) /= dim1) .OR. (SIZE(tabvar,2) /= dim2)) THEN 1340 ! cjh IF ((SIZE(tabvar,1) /= dim1) .OR. (SIZE(tabvar,2) /= dim2)) THEN 1341 ! the only way I came up with to avoid Type Conversion! 1341 1342 DEALLOCATE(tabvar) 1342 1343 ALLOCATE(tabvar(dim1,dim2,1,1)) 1343 ENDIF1344 ! cjh ENDIF 1344 1345 ENDIF 1345 1346 ! 1346 1347 status=nf90_get_var(ncid,varid,tabvar,start=(/1,1,level,time/),count=(/dim1,dim2,1,1/)) 1347 1348 ! 1348 1349 IF (status/=nf90_noerr) THEN 1349 1350 WRITE(*,*)"unable to retrieve netcdf variable : ",TRIM(varname)
comment:15 Changed 5 years ago by jchanut
- Resolution set to fixed
- Status changed from assigned to closed
Use the very last NESTING tool version (no correction made to the one provided with NEMO 3.6_STABLE)
comment:16 Changed 2 years ago by nemo
- Keywords v3.6 added
routine checking for missing values: check_interpextrap