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 6717 for branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90 – NEMO

Ignore:
Timestamp:
2016-06-17T12:00:46+02:00 (8 years ago)
Author:
gm
Message:

#1692 - branch SIMPLIF_2_usrdef: numerous improvement in the user defined interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DOM/istate.F90

    r6596 r6717  
    1414   !!            3.3  !  2010-10  (C. Ethe) merge TRC-TRA 
    1515   !!            3.4  !  2011-04  (G. Madec) Merge of dtatem and dtasal & suppression of tb,tn/sb,sn  
    16    !!            3.7  !  2016-04  (S. Flavoni) change configuration's interface: 
    17    !!                              read file or CALL usr_def module to compute initial state (example given for GYRE) 
     16   !!            3.7  !  2016-04  (S. Flavoni) introduce user defined initial state  
    1817   !!---------------------------------------------------------------------- 
    1918 
     
    2221   !!   istate_uvg    : initial velocity in geostropic balance 
    2322   !!---------------------------------------------------------------------- 
    24    USE oce             ! ocean dynamics and active tracers  
    25    USE dom_oce         ! ocean space and time domain  
    26    USE c1d             ! 1D vertical configuration 
    27    USE daymod          ! calendar 
    28    USE eosbn2          ! eq. of state, Brunt Vaisala frequency (eos     routine) 
    29    USE ldftra          ! lateral physics: ocean active tracers 
    30    USE zdf_oce         ! ocean vertical physics 
    31    USE phycst          ! physical constants 
    32    USE dtatsd          ! data temperature and salinity   (dta_tsd routine) 
    33    USE dtauvd          ! data: U & V current             (dta_uvd routine) 
     23   USE oce            ! ocean dynamics and active tracers  
     24   USE dom_oce        ! ocean space and time domain  
     25   USE daymod         ! calendar 
     26   USE divhor         ! horizontal divergence            (div_hor routine) 
     27   USE dtatsd         ! data temperature and salinity   (dta_tsd routine) 
     28   USE dtauvd         ! data: U & V current             (dta_uvd routine) 
    3429   USE domvvl          ! varying vertical mesh 
    3530   USE iscplrst        ! ice sheet coupling 
    36    USE usrdef          ! User defined routine 
     31   USE usrdef_istate   ! User defined initial state 
    3732   ! 
    3833   USE in_out_manager  ! I/O manager 
     
    4742 
    4843   PUBLIC   istate_init   ! routine called by step.F90 
    49    !SF PUBLIC   ini_read      ! subroutine ini_read  
    5044 
    5145   !! * Substitutions 
     
    7064      IF( nn_timing == 1 )   CALL timing_start('istate_init') 
    7165      ! 
     66      IF(lwp) WRITE(numout,*) 
     67      IF(lwp) WRITE(numout,*) 'istate_init : Initialization of the dynamics and tracers' 
     68      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' 
    7269 
    73       IF(lwp) WRITE(numout,*) 
    74       IF(lwp) WRITE(numout,*) 'istate_ini : Initialization of the dynamics and tracers' 
    75       IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    76  
    77      !SF initialisation of T & S with data file 
     70!!gm  Why not include in the first call of dta_tsd ?   
     71!!gm  probably associated with the use of internal damping... 
    7872                     CALL dta_tsd_init        ! Initialisation of T & S input data 
    79       IF( lk_c1d )   CALL dta_uvd_init        ! Initialization of U & V input data 
     73!!gm to be moved in usrdef of C1D case 
     74!      IF( lk_c1d )   CALL dta_uvd_init        ! Initialization of U & V input data 
     75!!gm 
    8076 
    8177      rhd  (:,:,:  ) = 0._wp   ;   rhop (:,:,:  ) = 0._wp      ! set one for all to 0 at level jpk 
     
    8783         !                                    ! ------------------- 
    8884         CALL rst_read                        ! Read the restart file 
    89          IF (ln_iscpl)       CALL iscpl_stp   ! extraloate restart to wet and dry 
     85         IF (ln_iscpl)       CALL iscpl_stp   ! extrapolate restart to wet and dry 
    9086         CALL day_init                        ! model calendar (using both namelist and restart infos) 
    91       ELSE 
    92          !                                    ! Start from rest 
     87         ! 
     88      ELSE                                    ! Start from rest 
    9389         !                                    ! --------------- 
    9490         numror = 0                           ! define numror = 0 -> no restart file to read 
     
    9692         CALL day_init                        ! model calendar (using both namelist and restart infos) 
    9793         !                                    ! Initialization of ocean to zero 
    98          !   before fields      !       now fields      
    99          sshb (:,:)   = 0._wp   ;   sshn (:,:)   = 0._wp 
    100          ub   (:,:,:) = 0._wp   ;   un   (:,:,:) = 0._wp 
    101          vb   (:,:,:) = 0._wp   ;   vn   (:,:,:) = 0._wp   
    102                                     hdivn(:,:,:) = 0._wp 
    10394         ! 
    104          IF( ln_tsd_init ) THEN               ! read 3D T and S data at nit000 
    105             CALL dta_tsd( nit000, tsb )   
     95         IF( ln_tsd_init ) THEN                
     96            CALL dta_tsd( nit000, tsb )       ! read 3D T and S data at nit000 
     97            ! 
     98            sshb(:,:)   = 0._wp               ! set the ocean at rest 
     99            ub  (:,:,:) = 0._wp 
     100            vb  (:,:,:) = 0._wp   
     101            ! 
    106102         ELSE                                 ! user defined initial T and S 
    107             CALL usr_def_ini( tsb )                 
     103            CALL usr_def_istate( gdept_b, tmask, tsb, ub, vb, sshb  )          
    108104         ENDIF 
    109          tsn(:,:,:,:) = tsb(:,:,:,:)          ! set now to before values 
     105         tsn  (:,:,:,:) = tsb (:,:,:,:)       ! set now values from to before ones 
     106         sshn (:,:)     = sshb(:,:)    
     107         un   (:,:,:)   = ub  (:,:,:) 
     108         vn   (:,:,:)   = vb  (:,:,:) 
     109         hdivn(:,:,jpk) = 0._wp               ! bottom divergence set one for 0 to zero at jpk level 
     110         CALL div_hor( 0 )                    ! compute interior hdivn value   
     111!!gm                                    hdivn(:,:,:) = 0._wp 
     112 
     113!!gm POTENTIAL BUG : 
     114!!gm  ISSUE :  if sshb /= 0  then, in non linear free surface, the e3._n, e3._b should be recomputed 
     115!!             as well as gdept and gdepw....   !!!!!  
     116!!      ===>>>>   probably a call to domvvl initialisation here.... 
     117 
     118 
    110119         ! 
    111          IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
    112             CALL wrk_alloc( jpi,jpj,jpk,2,   zuvd ) 
    113             CALL dta_uvd( nit000, zuvd ) 
    114             ub(:,:,:) = zuvd(:,:,:,1) ;  un(:,:,:) = ub(:,:,:) 
    115             vb(:,:,:) = zuvd(:,:,:,2) ;  vn(:,:,:) = vb(:,:,:) 
    116             CALL wrk_dealloc( jpi,jpj,jpk,2,   zuvd ) 
    117          ENDIF 
     120!!gm to be moved in usrdef of C1D case 
     121!         IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
     122!            CALL wrk_alloc( jpi,jpj,jpk,2,   zuvd ) 
     123!            CALL dta_uvd( nit000, zuvd ) 
     124!            ub(:,:,:) = zuvd(:,:,:,1) ;  un(:,:,:) = ub(:,:,:) 
     125!            vb(:,:,:) = zuvd(:,:,:,2) ;  vn(:,:,:) = vb(:,:,:) 
     126!            CALL wrk_dealloc( jpi,jpj,jpk,2,   zuvd ) 
     127!         ENDIF 
    118128         ! 
    119129!!gm This is to be changed !!!! 
    120          ! - ML - sshn could be modified by istate_eel, so that initialization of e3t_b is done here 
    121          IF( .NOT.ln_linssh ) THEN 
    122             DO jk = 1, jpk 
    123                e3t_b(:,:,jk) = e3t_n(:,:,jk) 
    124             END DO 
    125          ENDIF 
     130!         ! - ML - sshn could be modified by istate_eel, so that initialization of e3t_b is done here 
     131!         IF( .NOT.ln_linssh ) THEN 
     132!            DO jk = 1, jpk 
     133!               e3t_b(:,:,jk) = e3t_n(:,:,jk) 
     134!            END DO 
     135!         ENDIF 
    126136!!gm  
    127137         !  
Note: See TracChangeset for help on using the changeset viewer.