Opened 9 years ago

Closed 9 years ago

#667 closed bug (Fixed)

modify def_his.F/wrt_his.F for writing wetdry_mask_psi — at Version 1

Reported by: jcwarner Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.7
Component: Nonlinear Version: 3.7
Keywords: Cc:

Description (last modified by arango)

Need to modify def_his.F to allow wetdry_psi_mask to be read during a restart and written out to the history NetCDF file. This is discussed on the forum but here are some details for modifications to def_his.F:

  • In my solution, firstly add the declaration statement to line 55 in def_his.F:
      integer :: p2dgrd(3)
  • Then insert the following codes to line 301:
!
!  Define dimension vectors for staggered type variables at PSI-points.
!
        p2dgrd(1)=DimIDs( 4)
        p2dgrd(2)=DimIDs( 8)
        p2dgrd(3)=DimIDs(12)

  • Then, insert the following codes to line 458 ( inside #ifdef WET_DRY ... #endif statement):
!
!  Define wet/dry mask on PSI-points.
!
        Vinfo( 1)=Vname(1,idPwet)
        Vinfo( 2)=Vname(2,idPwet)
        Vinfo( 3)=Vname(3,idPwet)
        Vinfo( 9)='land'
        Vinfo(10)='water'
        Vinfo(14)=Vname(4,idPwet)
        Vinfo(16)=Vname(1,idtime)
        Vinfo(22)='coordinates'
        Aval(5)=REAL(Iinfo(1,idPwet,ng),r8)
        status=def_var(ng, iNLM, HIS(ng)%ncid, HIS(ng)%Vid(idPwet),     &
     &                 NF_FOUT, nvd3, p2dgrd, Aval, Vinfo, ncname,      &
     &                 SetFillVal = .FALSE.)
        IF (exit_flag.ne.NoError) RETURN

  • Similarly, insert the following codes to line 154 ( inside #ifdef WET_DRY ... #endif statement) in wrt_his.F:
!
!  Write out wet/dry mask at PSI-points.
!
      scale=1.0_r8
      gtype=gfactor*p2dvar
      status=nf_fwrite2d(ng, iNLM, HIS(ng)%ncid, HIS(ng)%Vid(idPwet),   &
     &                   HIS(ng)%Rindex, gtype,                         &
     &                   LBi, UBi, LBj, UBj, scale,                     &
# ifdef MASKING
     &                   GRID(ng) % pmask,                              &
# endif
     &                   GRID(ng) % pmask_wet,                          &
     &                   SetFillVal = .FALSE.)
      IF (status.ne.nf90_noerr) THEN
        IF (Master) THEN
          WRITE (stdout,10) TRIM(Vname(1,idPwet)), HIS(ng)%Rindex
        END IF
        exit_flag=3
        ioerror=status
        RETURN
      END IF
  • Also need to add in def_his.F around line 2383:
          ELSE IF (TRIM(var_name(i)).eq.TRIM(Vname(1,idPwet))) THEN
            got_var(idPwet)=.TRUE.
            HIS(ng)%Vid(idPwet)=var_id(i)
  • and near line 2786
        IF (.not.got_var(idPwet)) THEN
          IF (Master) WRITE (stdout,60) TRIM(Vname(1,idPwet)),          &
     &                                  TRIM(ncname)
          exit_flag=3
          RETURN
        END IF

Change History (1)

comment:1 by arango, 9 years ago

Description: modified (diff)
Resolution: Fixed
Status: newclosed
Summary: modify def_his for wetdry_mask_psimodify def_his.F/wrt_his.F for writing wetdry_mask_psi

Yes, thank you. I missed to consider this possibility when I updated the restart procedure for wetting and drying. It is valid to restart the model from a history NetCDF record instead of a restart NetCDF record. When updated these codes months ago I was thinking about perfect restart (PERFECT_RESTART) and this can be only done with the restart NetCDF file.

Many thanks to Takashi Nakamura for bringing this to our attention.

Note: See TracTickets for help on using tickets.