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 5343 for branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90 – NEMO

Ignore:
Timestamp:
2015-06-04T09:48:48+02:00 (9 years ago)
Author:
smasson
Message:

dev_r5218_CNRS17_coupling: update and bugfix (mainly) for SAS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/SAS_SRC/sbcssm.F90

    r5331 r5343  
    3636   PUBLIC   sbc_ssm        ! called by sbc 
    3737 
    38    CHARACTER(len=100)   ::   cn_dir     = './'    !: Root directory for location of ssm files 
    39    LOGICAL              ::   ln_3d_uv   = .true.  !: specify whether input velocity data is 3D 
    40    INTEGER  , SAVE      ::   nfld_3d 
    41    INTEGER  , SAVE      ::   nfld_2d 
    42  
    43    INTEGER  , PARAMETER ::   jpfld_3d = 4   ! maximum number of files to read 
    44    INTEGER  , PARAMETER ::   jpfld_2d = 1   ! maximum number of files to read 
    45    INTEGER  , SAVE      ::   jf_tem         ! index of temperature 
    46    INTEGER  , SAVE      ::   jf_sal         ! index of salinity 
    47    INTEGER  , SAVE      ::   jf_usp         ! index of u velocity component 
    48    INTEGER  , SAVE      ::   jf_vsp         ! index of v velocity component 
    49    INTEGER  , SAVE      ::   jf_ssh         ! index of sea surface height 
     38   CHARACTER(len=100)   ::   cn_dir      !: Root directory for location of ssm files 
     39   LOGICAL              ::   ln_3d_uve   !: specify whether input velocity data is 3D 
     40   INTEGER     ::   nfld_3d 
     41   INTEGER     ::   nfld_2d 
     42 
     43   INTEGER     ::   jf_tem         ! index of temperature 
     44   INTEGER     ::   jf_sal         ! index of salinity 
     45   INTEGER     ::   jf_usp         ! index of u velocity component 
     46   INTEGER     ::   jf_vsp         ! index of v velocity component 
     47   INTEGER     ::   jf_ssh         ! index of sea surface height 
     48   INTEGER     ::   jf_e3t         ! index of first T level thickness 
    5049 
    5150   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_ssm_3d  ! structure of input fields (file information, fields read) 
    5251   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_ssm_2d  ! structure of input fields (file information, fields read) 
    5352 
    54    !! * Substitutions 
    55 #  include "domzgr_substitute.h90" 
    56 #  include "vectopt_loop_substitute.h90" 
    5753   !!---------------------------------------------------------------------- 
    5854   !! NEMO/OFF 3.3 , NEMO Consortium (2010) 
     
    8682      IF( nfld_2d > 0 ) CALL fld_read( kt, 1, sf_ssm_2d )      !==   read data at kt time step   ==! 
    8783      !  
    88       IF( ln_3d_uv ) THEN 
     84      IF( ln_3d_uve ) THEN 
    8985         ssu_m(:,:) = sf_ssm_3d(jf_usp)%fnow(:,:,1) * umask(:,:,1)    ! u-velocity 
    9086         ssv_m(:,:) = sf_ssm_3d(jf_vsp)%fnow(:,:,1) * vmask(:,:,1)    ! v-velocity  
     87         IF( lk_vvl )   e3t_m(:,:) = sf_ssm_3d(jf_e3t)%fnow(:,:,1) * tmask(:,:,1)    ! v-velocity  
    9188      ELSE 
    9289         ssu_m(:,:) = sf_ssm_2d(jf_usp)%fnow(:,:,1) * umask(:,:,1)    ! u-velocity 
    9390         ssv_m(:,:) = sf_ssm_2d(jf_vsp)%fnow(:,:,1) * vmask(:,:,1)    ! v-velocity  
     91         IF( lk_vvl )   e3t_m(:,:) = sf_ssm_2d(jf_e3t)%fnow(:,:,1) * tmask(:,:,1)    ! v-velocity  
    9492      ENDIF 
    9593      ! 
     
    104102         tsb(:,:,1,jp_sal) = sss_m(:,:) 
    105103      ENDIF 
    106       ub (:,:,1       ) = ssu_m(:,:) 
    107       vb (:,:,1       ) = ssv_m(:,:) 
     104      ub (:,:,1) = ssu_m(:,:) 
     105      vb (:,:,1) = ssv_m(:,:) 
    108106 
    109107      IF(ln_ctl) THEN                  ! print control 
     
    113111         CALL prt_ctl(tab2d_1=ssv_m, clinfo1=' ssv_m   - : ', mask1=vmask, ovlap=1   ) 
    114112         CALL prt_ctl(tab2d_1=ssh_m, clinfo1=' ssh_m   - : ', mask1=tmask, ovlap=1   ) 
     113         IF( lk_vvl )   CALL prt_ctl(tab2d_1=ssh_m, clinfo1=' e3t_m   - : ', mask1=tmask, ovlap=1   ) 
    115114      ENDIF 
    116115      ! 
     
    138137      TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) ::  slf_2d       ! array of namelist information on the fields to read 
    139138      TYPE(FLD_N) :: sn_tem, sn_sal                     ! information about the fields to be read 
    140       TYPE(FLD_N) :: sn_usp, sn_vsp, sn_ssh 
    141       ! 
    142       NAMELIST/namsbc_sas/cn_dir, ln_3d_uv, sn_tem, sn_sal, sn_usp, sn_vsp, sn_ssh 
     139      TYPE(FLD_N) :: sn_usp, sn_vsp 
     140      TYPE(FLD_N) :: sn_ssh, sn_e3t 
     141      ! 
     142      NAMELIST/namsbc_sas/cn_dir, ln_3d_uve, sn_tem, sn_sal, sn_usp, sn_vsp, sn_ssh, sn_e3t 
    143143      !!---------------------------------------------------------------------- 
    144144       
     
    195195      !! when we have other 3d arrays that we need to read in 
    196196      !! so if a new field is added i.e. jf_new, just give it the next integer in sequence 
    197       !! for the corresponding dimension (currently if ln_3d_uv is true, 4 for 2d and 3 for 3d, 
    198       !! alternatively if ln_3d_uv is false, 6 for 2d and 1 for 3d), reset nfld_3d, nfld_2d, 
     197      !! for the corresponding dimension (currently if ln_3d_uve is true, 4 for 2d and 3 for 3d, 
     198      !! alternatively if ln_3d_uve is false, 6 for 2d and 1 for 3d), reset nfld_3d, nfld_2d, 
    199199      !! and the rest of the logic should still work 
    200200      ! 
    201201      jf_tem = 1 ; jf_sal = 2 ; jf_ssh = 3 
    202202      ! 
    203       IF( ln_3d_uv ) THEN 
    204          jf_usp = 1 ; jf_vsp = 2 
    205          nfld_3d  = 2 
     203      IF( ln_3d_uve ) THEN 
     204         jf_usp = 1 ; jf_vsp = 2 ; jf_e3t = 3 
     205         nfld_3d  = 2 + COUNT( (/lk_vvl/) ) 
    206206         nfld_2d  = 3 
    207207      ELSE 
    208          jf_usp = 4 ; jf_vsp = 5 
     208         jf_usp = 4 ; jf_vsp = 5 ; jf_e3t = 6 
    209209         nfld_3d  = 0 
    210          nfld_2d  = 5 
     210         nfld_2d  = 5 + COUNT( (/lk_vvl/) ) 
    211211      ENDIF 
    212212 
     
    216216            CALL ctl_stop( 'sbc_ssm_init: unable to allocate slf 3d structure' )   ;   RETURN 
    217217         ENDIF 
    218          IF( ln_3d_uv ) THEN 
    219             slf_3d(jf_usp) = sn_usp 
    220             slf_3d(jf_vsp) = sn_vsp 
    221          ENDIF 
     218         slf_3d(jf_usp) = sn_usp 
     219         slf_3d(jf_vsp) = sn_vsp 
     220         IF( lk_vvl )   slf_3d(jf_e3t) = sn_e3t 
    222221      ENDIF 
    223222 
     
    228227         ENDIF 
    229228         slf_2d(jf_tem) = sn_tem ; slf_2d(jf_sal) = sn_sal ; slf_2d(jf_ssh) = sn_ssh 
    230          IF( .NOT. ln_3d_uv ) THEN 
     229         IF( .NOT. ln_3d_uve ) THEN 
    231230            slf_2d(jf_usp) = sn_usp ; slf_2d(jf_vsp) = sn_vsp 
    232          ENDIF 
    233       ENDIF 
    234       ! 
     231            IF( lk_vvl )   slf_2d(jf_e3t) = sn_e3t 
     232         ENDIF 
     233      ENDIF 
     234      ! 
     235      ierr1 = 0    ! default definition if slf_?d(ifpr)%ln_tint = .false.  
    235236      IF( nfld_3d > 0 ) THEN 
    236237         ALLOCATE( sf_ssm_3d(nfld_3d), STAT=ierr )         ! set sf structure 
     
    269270      IF( nfld_3d > 0 ) DEALLOCATE( slf_3d, STAT=ierr ) 
    270271      IF( nfld_2d > 0 ) DEALLOCATE( slf_2d, STAT=ierr ) 
     272 
     273      call sbc_ssm( nit000 )   ! need to define ss?_m arrays used in limistate 
    271274      ! 
    272275   END SUBROUTINE sbc_ssm_init 
Note: See TracChangeset for help on using the changeset viewer.