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 3625 for branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90 – NEMO

Ignore:
Timestamp:
2012-11-21T14:19:18+01:00 (11 years ago)
Author:
acc
Message:

Branch dev_NOC_2012_r3555. #1006. Step 7. Check in code now merged with dev_r3385_NOCS04_HAMF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90

    r3294 r3625  
    5959      !!                =3 global mean of emp set to zero at each nn_fsbc time step 
    6060      !!                   & spread out over erp area depending its sign 
     61      !! Note: if sea ice is embedded it is taken into account when computing the budget  
    6162      !!---------------------------------------------------------------------- 
    6263      INTEGER, INTENT( in ) ::   kt       ! ocean time-step index 
     
    6465      INTEGER, INTENT( in ) ::   kn_fwb   ! ocean time-step index 
    6566      ! 
    66       INTEGER  ::   inum, ikty, iyear   ! local integers 
    67       REAL(wp) ::   z_fwf, z_fwf_nsrf, zsum_fwf, zsum_erp   ! local scalars 
    68       REAL(wp) ::   zsurf_neg, zsurf_pos, zsurf_tospread    !   -      - 
    69       REAL(wp), POINTER, DIMENSION(:,:) ::   ztmsk_neg, ztmsk_pos, ztmsk_tospread, z_wgt, zerp_cor 
     67      INTEGER  ::   inum, ikty, iyear     ! local integers 
     68      REAL(wp) ::   z_fwf, z_fwf_nsrf, zsum_fwf, zsum_erp                ! local scalars 
     69      REAL(wp) ::   zsurf_neg, zsurf_pos, zsurf_tospread, zcoef          !   -      - 
     70      REAL(wp), POINTER, DIMENSION(:,:) ::   ztmsk_neg, ztmsk_pos, z_wgt ! 2D workspaces 
     71      REAL(wp), POINTER, DIMENSION(:,:) ::   ztmsk_tospread, zerp_cor    !   -      - 
    7072      !!---------------------------------------------------------------------- 
    7173      ! 
     
    8789         ! 
    8890         area = glob_sum( e1e2t(:,:) )           ! interior global domain surface 
     91         ! 
     92#if ! defined key_lim2 &&  ! defined key_lim3 && ! defined key_cice  
     93         snwice_mass_b(:,:) = 0.e0               ! no sea-ice model is being used : no snow+ice mass 
     94         snwice_mass  (:,:) = 0.e0 
     95#endif 
     96         ! 
    8997      ENDIF 
    9098       
     
    95103         ! 
    96104         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN 
    97             z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) ) ) / area   ! sum over the global domain 
    98             emp (:,:) = emp (:,:) - z_fwf  
    99             emps(:,:) = emps(:,:) - z_fwf  
     105            z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) -  snwice_fmass(:,:) ) ) / area   ! sum over the global domain 
     106            zcoef = z_fwf * rcp 
     107            emp(:,:) = emp(:,:) - z_fwf  
     108            qns(:,:) = qns(:,:) + zcoef * sst_m(:,:)  ! account for change to the heat budget due to fw correction 
    100109         ENDIF 
    101110         ! 
    102111      CASE ( 2 )                             !==  fwf budget adjusted from the previous year  ==! 
    103112         ! 
    104          IF( kt == nit000 ) THEN                   ! initialisation 
     113         IF( kt == nit000 ) THEN                      ! initialisation 
    105114            !                                         ! Read the corrective factor on precipitations (fwfold) 
    106115            CALL ctl_opn( inum, 'EMPave_old.dat', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
     
    117126         ikty = 365 * 86400 / rdttra(1)    !!bug  use of 365 days leap year or 360d year !!!!!!! 
    118127         IF( MOD( kt, ikty ) == 0 ) THEN 
    119             a_fwb_b = a_fwb 
    120             a_fwb   = glob_sum( e1e2t(:,:) * sshn(:,:) )   ! sum over the global domain 
     128            a_fwb_b = a_fwb                           ! mean sea level taking into account the ice+snow 
     129                                                      ! sum over the global domain 
     130            a_fwb   = glob_sum( e1e2t(:,:) * ( sshn(:,:) + snwice_mass(:,:) * r1_rau0 ) ) 
    121131            a_fwb   = a_fwb * 1.e+3 / ( area * 86400. * 365. )     ! convert in Kg/m3/s = mm/s 
    122132!!gm        !                                                      !!bug 365d year  
     
    125135         ENDIF 
    126136         !  
    127          IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN      ! correct the freshwater fluxes 
    128             emp (:,:) = emp (:,:) + fwfold 
    129             emps(:,:) = emps(:,:) + fwfold 
    130          ENDIF 
    131          ! 
    132          IF( kt == nitend .AND. lwp ) THEN         ! save fwfold value in a file 
     137         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN         ! correct the freshwater fluxes 
     138            zcoef = fwfold * rcp 
     139            emp(:,:) = emp(:,:) + fwfold 
     140            qns(:,:) = qns(:,:) - zcoef * sst_m(:,:)  ! account for change to the heat budget due to fw correction 
     141         ENDIF 
     142         ! 
     143         IF( kt == nitend .AND. lwp ) THEN            ! save fwfold value in a file 
    133144            CALL ctl_opn( inum, 'EMPave.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea ) 
    134145            WRITE( inum, "(24X,I8,2ES24.16)" ) nyear, a_fwb_b, a_fwb 
     
    143154            ztmsk_neg(:,:) = tmask_i(:,:) - ztmsk_pos(:,:) 
    144155            ! 
    145             zsurf_neg = glob_sum( e1e2t(:,:)*ztmsk_neg(:,:) )   ! Area filled by <0 and >0 erp  
     156            zsurf_neg = glob_sum( e1e2t(:,:)*ztmsk_neg(:,:) )  ! Area filled by <0 and >0 erp  
    146157            zsurf_pos = glob_sum( e1e2t(:,:)*ztmsk_pos(:,:) ) 
    147             !                                                  ! fwf global mean  
    148             z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) ) ) / area 
     158            !                                                  ! fwf global mean (excluding ocean to ice/snow exchanges)  
     159            z_fwf     = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) - snwice_fmass(:,:) ) ) / area 
    149160            !             
    150161            IF( z_fwf < 0._wp ) THEN         ! spread out over >0 erp area to increase evaporation 
     
    160171            z_fwf_nsrf =  zsum_fwf / ( zsurf_tospread + rsmall ) 
    161172            !                                                  ! weight to respect erp field 2D structure  
    162             zsum_erp = glob_sum( ztmsk_tospread(:,:) * erp(:,:) * e1e2t(:,:) ) 
     173            zsum_erp   = glob_sum( ztmsk_tospread(:,:) * erp(:,:) * e1e2t(:,:) ) 
    163174            z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( zsum_erp + rsmall ) 
    164175            !                                                  ! final correction term to apply 
     
    168179            CALL lbc_lnk( zerp_cor, 'T', 1. ) 
    169180            ! 
    170             emp (:,:) = emp (:,:) + zerp_cor(:,:) 
    171             emps(:,:) = emps(:,:) + zerp_cor(:,:) 
    172             erp (:,:) = erp (:,:) + zerp_cor(:,:) 
     181            emp(:,:) = emp(:,:) + zerp_cor(:,:) 
     182            qns(:,:) = qns(:,:) - zerp_cor(:,:) * rcp * sst_m(:,:)  ! account for change to the heat budget due to fw correction 
     183            erp(:,:) = erp(:,:) + zerp_cor(:,:) 
    173184            ! 
    174185            IF( nprint == 1 .AND. lwp ) THEN                   ! control print 
Note: See TracChangeset for help on using the changeset viewer.