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 11401 for NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/ICE/iceistate.F90 – NEMO

Ignore:
Timestamp:
2019-08-05T14:36:23+02:00 (5 years ago)
Author:
clem
Message:

add new functionality for initialization. Now you can use a simplified restart for starting a simulation (as for the initialization)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/ICE/iceistate.F90

    r11397 r11401  
    4040   ! 
    4141   !                             !! ** namelist (namini) ** 
    42    LOGICAL  ::   ln_iceini        ! Ice initialization or not 
    43    LOGICAL  ::   ln_iceini_file   ! Ice initialization from 2D netcdf file 
    44    REAL(wp) ::   rn_thres_sst     ! threshold water temperature for initial sea ice 
    45    REAL(wp) ::   rn_hts_ini_n     ! initial snow thickness in the north 
    46    REAL(wp) ::   rn_hts_ini_s     ! initial snow thickness in the south 
    47    REAL(wp) ::   rn_hti_ini_n     ! initial ice thickness in the north 
    48    REAL(wp) ::   rn_hti_ini_s     ! initial ice thickness in the south 
    49    REAL(wp) ::   rn_ati_ini_n     ! initial concentration in the north 
    50    REAL(wp) ::   rn_ati_ini_s     ! initial concentration in the south 
    51    REAL(wp) ::   rn_smi_ini_n     ! initial salinity in the north 
    52    REAL(wp) ::   rn_smi_ini_s     ! initial salinity in the south 
    53    REAL(wp) ::   rn_tmi_ini_n     ! initial ice temperature in the north 
    54    REAL(wp) ::   rn_tmi_ini_s     ! initial ice temperature in the south 
    55    REAL(wp) ::   rn_tms_ini_n     ! initial snw temperature in the north 
    56    REAL(wp) ::   rn_tms_ini_s     ! initial swn temperature in the south 
    57    REAL(wp) ::   rn_apd_ini_n     ! initial pond fraction in the north 
    58    REAL(wp) ::   rn_apd_ini_s     ! initial pond fraction in the south 
    59    REAL(wp) ::   rn_hpd_ini_n     ! initial pond depth in the north 
    60    REAL(wp) ::   rn_hpd_ini_s     ! initial pond depth in the south 
    61  
     42   LOGICAL, PUBLIC  ::   ln_iceini        !: Ice initialization or not 
     43   LOGICAL, PUBLIC  ::   ln_iceini_file   !: Ice initialization from 2D netcdf file 
     44   REAL(wp) ::   rn_thres_sst 
     45   REAL(wp) ::   rn_hti_ini_n, rn_hts_ini_n, rn_ati_ini_n, rn_smi_ini_n, rn_tmi_ini_n, rn_tsu_ini_n, rn_tms_ini_n 
     46   REAL(wp) ::   rn_hti_ini_s, rn_hts_ini_s, rn_ati_ini_s, rn_smi_ini_s, rn_tmi_ini_s, rn_tsu_ini_s, rn_tms_ini_s 
     47   REAL(wp) ::   rn_apd_ini_n, rn_hpd_ini_n 
     48   REAL(wp) ::   rn_apd_ini_s, rn_hpd_ini_s 
     49   ! 
    6250   !                              ! if ln_iceini_file = T 
    6351   INTEGER , PARAMETER ::   jpfldi = 9           ! maximum number of files to read 
     
    6553   INTEGER , PARAMETER ::   jp_hts = 2           ! index of snw thickness    (m) 
    6654   INTEGER , PARAMETER ::   jp_ati = 3           ! index of ice fraction     (-) 
    67    INTEGER , PARAMETER ::   jp_tsu = 4           ! index of ice surface temp (K) 
     55   INTEGER , PARAMETER ::   jp_smi = 4           ! index of ice salinity     (g/kg) 
    6856   INTEGER , PARAMETER ::   jp_tmi = 5           ! index of ice temperature  (K) 
    69    INTEGER , PARAMETER ::   jp_smi = 6           ! index of ice salinity     (g/kg) 
     57   INTEGER , PARAMETER ::   jp_tsu = 6           ! index of ice surface temp (K) 
    7058   INTEGER , PARAMETER ::   jp_tms = 7           ! index of snw temperature  (K) 
    7159   INTEGER , PARAMETER ::   jp_apd = 8           ! index of pnd fraction     (-) 
     
    181169         IF( ln_iceini_file )THEN      ! Read a file   ! 
    182170            !                          !---------------! 
    183             CALL fld_read( kt, 1, si )                ! input fields provided at the current time-step 
    184             ! 
     171            WHERE( ff_t(:,:) >= 0._wp )   ;   zswitch(:,:) = 1._wp 
     172            ELSEWHERE                     ;   zswitch(:,:) = 0._wp 
     173            END WHERE 
     174            ! 
     175            CALL fld_read( kt, 1, si ) ! input fields provided at the current time-step 
     176            ! 
     177            ! -- mandatory fields -- ! 
    185178            zht_i_ini(:,:) = si(jp_hti)%fnow(:,:,1) 
    186179            zht_s_ini(:,:) = si(jp_hts)%fnow(:,:,1) 
    187180            zat_i_ini(:,:) = si(jp_ati)%fnow(:,:,1) 
     181 
     182            ! -- optional fields -- ! 
     183            !    if fields do not exist then set them to the values present in the namelist (except for snow and surface temperature) 
     184            ! 
     185            ! ice salinity 
     186            IF( TRIM(si(jp_smi)%clrootname) == 'NOT USED' ) & 
     187               &     si(jp_smi)%fnow(:,:,1) = ( rn_smi_ini_n * zswitch + rn_smi_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 
     188            zsm_i_ini(:,:) = si(jp_smi)%fnow(:,:,1) 
     189            ! 
     190            ! ice temperature 
     191            IF( TRIM(si(jp_tmi)%clrootname) == 'NOT USED' ) & 
     192               &     si(jp_tmi)%fnow(:,:,1) = ( rn_tmi_ini_n * zswitch + rn_tmi_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 
     193            ztm_i_ini(:,:) = si(jp_tmi)%fnow(:,:,1) 
     194            ! 
     195            ! surface temperature => set to ice temperature if it exists 
     196            IF    ( TRIM(si(jp_tsu)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tmi)%clrootname) == 'NOT USED' ) THEN 
     197                     si(jp_tsu)%fnow(:,:,1) = ( rn_tsu_ini_n * zswitch + rn_tsu_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 
     198            ELSEIF( TRIM(si(jp_tsu)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tmi)%clrootname) /= 'NOT USED' ) THEN 
     199                     si(jp_tsu)%fnow(:,:,1) = si(jp_tmi)%fnow(:,:,1) 
     200            ENDIF 
    188201            zt_su_ini(:,:) = si(jp_tsu)%fnow(:,:,1) 
    189             ztm_i_ini(:,:) = si(jp_tmi)%fnow(:,:,1) 
    190             zsm_i_ini(:,:) = si(jp_smi)%fnow(:,:,1) 
    191             ! snow temperature 
    192             IF( TRIM(si(jp_tms)%clrootname) == 'NOT USED' )   si(jp_tms)%fnow(:,:,1) = si(jp_tmi)%fnow(:,:,1) 
     202            ! 
     203            ! snow temperature => set to ice temperature if it exists 
     204            IF    ( TRIM(si(jp_tms)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tmi)%clrootname) == 'NOT USED' ) THEN 
     205                     si(jp_tms)%fnow(:,:,1) = ( rn_tms_ini_n * zswitch + rn_tms_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 
     206            ELSEIF( TRIM(si(jp_tms)%clrootname) == 'NOT USED' .AND. TRIM(si(jp_tmi)%clrootname) /= 'NOT USED' ) THEN 
     207                     si(jp_tms)%fnow(:,:,1) = si(jp_tmi)%fnow(:,:,1) 
     208            ENDIF 
    193209            ztm_s_ini(:,:) = si(jp_tms)%fnow(:,:,1) 
     210            ! 
    194211            ! ponds 
    195             IF( TRIM(si(jp_apd)%clrootname) == 'NOT USED' )   si(jp_apd)%fnow(:,:,1) = 0._wp  
    196             IF( TRIM(si(jp_hpd)%clrootname) == 'NOT USED' )   si(jp_hpd)%fnow(:,:,1) = 0._wp  
     212            IF( TRIM(si(jp_apd)%clrootname) == 'NOT USED' ) & 
     213               &     si(jp_apd)%fnow(:,:,1) = ( rn_apd_ini_n * zswitch + rn_apd_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 
    197214            zapnd_ini(:,:) = si(jp_apd)%fnow(:,:,1) 
     215            IF( TRIM(si(jp_hpd)%clrootname) == 'NOT USED' ) & 
     216               &     si(jp_hpd)%fnow(:,:,1) = ( rn_hpd_ini_n * zswitch + rn_hpd_ini_s * (1._wp - zswitch) ) * tmask(:,:,1) 
    198217            zhpnd_ini(:,:) = si(jp_hpd)%fnow(:,:,1) 
    199218            ! 
    200             WHERE( zat_i_ini(:,:) > 0._wp ) ; zswitch(:,:) = tmask(:,:,1)  
    201             ELSEWHERE                       ; zswitch(:,:) = 0._wp 
     219            ! change the switch for the following 
     220            WHERE( zat_i_ini(:,:) > 0._wp )   ;   zswitch(:,:) = tmask(:,:,1)  
     221            ELSEWHERE                         ;   zswitch(:,:) = 0._wp 
    202222            END WHERE 
    203223            !                          !---------------! 
     
    214234               zht_s_ini(:,:) = rn_hts_ini_n * zswitch(:,:) 
    215235               zat_i_ini(:,:) = rn_ati_ini_n * zswitch(:,:) 
    216                zt_su_ini(:,:) = rn_tmi_ini_n * zswitch(:,:) 
    217236               zsm_i_ini(:,:) = rn_smi_ini_n * zswitch(:,:) 
    218237               ztm_i_ini(:,:) = rn_tmi_ini_n * zswitch(:,:) 
     238               zt_su_ini(:,:) = rn_tsu_ini_n * zswitch(:,:) 
    219239               ztm_s_ini(:,:) = rn_tms_ini_n * zswitch(:,:) 
    220240               zapnd_ini(:,:) = rn_apd_ini_n * zswitch(:,:) 
     
    224244               zht_s_ini(:,:) = rn_hts_ini_s * zswitch(:,:) 
    225245               zat_i_ini(:,:) = rn_ati_ini_s * zswitch(:,:) 
    226                zt_su_ini(:,:) = rn_tmi_ini_s * zswitch(:,:) 
    227246               zsm_i_ini(:,:) = rn_smi_ini_s * zswitch(:,:) 
    228247               ztm_i_ini(:,:) = rn_tmi_ini_s * zswitch(:,:) 
     248               zt_su_ini(:,:) = rn_tsu_ini_s * zswitch(:,:) 
    229249               ztm_s_ini(:,:) = rn_tms_ini_s * zswitch(:,:) 
    230250               zapnd_ini(:,:) = rn_apd_ini_s * zswitch(:,:) 
     
    296316            DO jj = 1, jpj 
    297317               DO ji = 1, jpi 
    298                   v_i (ji,jj,jl) = h_i(ji,jj,jl) * a_i(ji,jj,jl)              ! ice volume 
    299                   v_s (ji,jj,jl) = h_s(ji,jj,jl) * a_i(ji,jj,jl)              ! snow volume 
     318                  v_i (ji,jj,jl) = h_i(ji,jj,jl) * a_i(ji,jj,jl) 
     319                  v_s (ji,jj,jl) = h_s(ji,jj,jl) * a_i(ji,jj,jl) 
    300320                  sv_i(ji,jj,jl) = MIN( MAX( rn_simin , s_i(ji,jj,jl) ) , rn_simax ) * v_i(ji,jj,jl) 
    301321               END DO 
     
    320340                  DO ji = 1, jpi 
    321341                     t_i (ji,jj,jk,jl) = zti_3d(ji,jj,jl)  
    322                      ztmelts          = - rTmlt * sz_i(ji,jj,jk,jl) + rt0 !Melting temperature in K 
     342                     ztmelts          = - rTmlt * sz_i(ji,jj,jk,jl) + rt0 ! melting temperature in K 
    323343                     e_i(ji,jj,jk,jl) = zswitch(ji,jj) * v_i(ji,jj,jl) * r1_nlay_i * & 
    324344                        &               rhoi * (  rcpi  * ( ztmelts - t_i(ji,jj,jk,jl) ) + & 
     
    429449      ! 
    430450      CHARACTER(len=256) ::  cn_dir          ! Root directory for location of ice files 
    431       TYPE(FLD_N)                    ::   sn_hti, sn_hts, sn_ati, sn_tsu, sn_tmi, sn_smi, sn_tms, sn_apd, sn_hpd 
     451      TYPE(FLD_N)                    ::   sn_hti, sn_hts, sn_ati, sn_smi, sn_tmi, sn_tsu, sn_tms, sn_apd, sn_hpd 
    432452      TYPE(FLD_N), DIMENSION(jpfldi) ::   slf_i                 ! array of namelist informations on the fields to read 
    433453      ! 
    434454      NAMELIST/namini/ ln_iceini, ln_iceini_file, rn_thres_sst, & 
    435          &             rn_hts_ini_n, rn_hts_ini_s, rn_hti_ini_n, rn_hti_ini_s, & 
     455         &             rn_hti_ini_n, rn_hti_ini_s, rn_hts_ini_n, rn_hts_ini_s, & 
    436456         &             rn_ati_ini_n, rn_ati_ini_s, rn_smi_ini_n, rn_smi_ini_s, & 
    437          &             rn_tmi_ini_n, rn_tmi_ini_s, rn_tms_ini_n, rn_tms_ini_s, & 
     457         &             rn_tmi_ini_n, rn_tmi_ini_s, rn_tsu_ini_n, rn_tsu_ini_s, rn_tms_ini_n, rn_tms_ini_s, & 
    438458         &             rn_apd_ini_n, rn_apd_ini_s, rn_hpd_ini_n, rn_hpd_ini_s, & 
    439459         &             sn_hti, sn_hts, sn_ati, sn_tsu, sn_tmi, sn_smi, sn_tms, sn_apd, sn_hpd, cn_dir 
     
    449469      ! 
    450470      slf_i(jp_hti) = sn_hti  ;  slf_i(jp_hts) = sn_hts 
    451       slf_i(jp_ati) = sn_ati  ;  slf_i(jp_tsu) = sn_tsu 
    452       slf_i(jp_tmi) = sn_tmi  ;  slf_i(jp_smi) = sn_smi 
    453       slf_i(jp_tms) = sn_tms  ; 
     471      slf_i(jp_ati) = sn_ati  ;  slf_i(jp_smi) = sn_smi 
     472      slf_i(jp_tmi) = sn_tmi  ;  slf_i(jp_tsu) = sn_tsu   ;   slf_i(jp_tms) = sn_tms 
    454473      slf_i(jp_apd) = sn_apd  ;  slf_i(jp_hpd) = sn_hpd 
    455474      ! 
     
    459478         WRITE(numout,*) '~~~~~~~~~~~~~~~' 
    460479         WRITE(numout,*) '   Namelist namini:' 
    461          WRITE(numout,*) '      ice initialization (T) or not (F)                     ln_iceini       = ', ln_iceini 
    462          WRITE(numout,*) '      ice initialization from a netcdf file                 ln_iceini_file  = ', ln_iceini_file 
    463          WRITE(numout,*) '      max delta ocean temp. above Tfreeze with initial ice  rn_thres_sst    = ', rn_thres_sst 
    464          WRITE(numout,*) '      initial snw thickness in the north                    rn_hts_ini_n    = ', rn_hts_ini_n 
    465          WRITE(numout,*) '      initial snw thickness in the south                    rn_hts_ini_s    = ', rn_hts_ini_s  
    466          WRITE(numout,*) '      initial ice thickness in the north                    rn_hti_ini_n    = ', rn_hti_ini_n 
    467          WRITE(numout,*) '      initial ice thickness in the south                    rn_hti_ini_s    = ', rn_hti_ini_s 
    468          WRITE(numout,*) '      initial ice concentr  in the north                    rn_ati_ini_n    = ', rn_ati_ini_n 
    469          WRITE(numout,*) '      initial ice concentr  in the north                    rn_ati_ini_s    = ', rn_ati_ini_s 
    470          WRITE(numout,*) '      initial ice salinity  in the north                    rn_smi_ini_n    = ', rn_smi_ini_n 
    471          WRITE(numout,*) '      initial ice salinity  in the south                    rn_smi_ini_s    = ', rn_smi_ini_s 
    472          WRITE(numout,*) '      initial ice temperat  in the north                    rn_tmi_ini_n    = ', rn_tmi_ini_n 
    473          WRITE(numout,*) '      initial ice temperat  in the south                    rn_tmi_ini_s    = ', rn_tmi_ini_s 
    474          WRITE(numout,*) '      initial snw temperat  in the north                    rn_tms_ini_n    = ', rn_tms_ini_n 
    475          WRITE(numout,*) '      initial snw temperat  in the south                    rn_tms_ini_s    = ', rn_tms_ini_s 
    476          WRITE(numout,*) '      initial pnd fraction  in the north                    rn_apd_ini_n    = ', rn_apd_ini_n 
    477          WRITE(numout,*) '      initial pnd fraction  in the south                    rn_apd_ini_s    = ', rn_apd_ini_s 
    478          WRITE(numout,*) '      initial pnd depth     in the north                    rn_hpd_ini_n    = ', rn_hpd_ini_n 
    479          WRITE(numout,*) '      initial pnd depth     in the south                    rn_hpd_ini_s    = ', rn_hpd_ini_s 
     480         WRITE(numout,*) '      ice initialization (T) or not (F)                ln_iceini      = ', ln_iceini 
     481         WRITE(numout,*) '      ice initialization from a netcdf file            ln_iceini_file = ', ln_iceini_file 
     482         WRITE(numout,*) '      max ocean temp. above Tfreeze with initial ice   rn_thres_sst   = ', rn_thres_sst 
     483         WRITE(numout,*) '      initial snw thickness in the north-south         rn_hts_ini     = ', rn_hts_ini_n,rn_hts_ini_s  
     484         WRITE(numout,*) '      initial ice thickness in the north-south         rn_hti_ini     = ', rn_hti_ini_n,rn_hti_ini_s 
     485         WRITE(numout,*) '      initial ice concentr  in the north-south         rn_ati_ini     = ', rn_ati_ini_n,rn_ati_ini_s 
     486         WRITE(numout,*) '      initial ice salinity  in the north-south         rn_smi_ini     = ', rn_smi_ini_n,rn_smi_ini_s 
     487         WRITE(numout,*) '      initial surf temperat in the north-south         rn_tsu_ini     = ', rn_tsu_ini_n,rn_tsu_ini_s 
     488         WRITE(numout,*) '      initial ice temperat  in the north-south         rn_tmi_ini     = ', rn_tmi_ini_n,rn_tmi_ini_s 
     489         WRITE(numout,*) '      initial snw temperat  in the north-south         rn_tms_ini     = ', rn_tms_ini_n,rn_tms_ini_s 
     490         WRITE(numout,*) '      initial pnd fraction  in the north-south         rn_apd_ini     = ', rn_apd_ini_n,rn_apd_ini_s 
     491         WRITE(numout,*) '      initial pnd depth     in the north-south         rn_hpd_ini     = ', rn_hpd_ini_n,rn_hpd_ini_s 
    480492      ENDIF 
    481493      ! 
Note: See TracChangeset for help on using the changeset viewer.