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

Ignore:
Timestamp:
2012-05-17T18:33:12+02:00 (12 years ago)
Author:
acc
Message:

Branch: dev_r3385_NOCS04_HAMF; #665. Stage 1 of 2012 development: porting of changes on old development branch (2011/DEV_r1837_mass_heat_salt_fluxes) into new branch. Corrected a few errors on the way. This branch now compiles but is incomplete. Still missing LIM3 changes which must reside on a certain persons laptop somewhere

File:
1 edited

Legend:

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

    r3294 r3396  
    6464      INTEGER, INTENT( in ) ::   kn_fwb   ! ocean time-step index 
    6565      ! 
    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 
     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, zcoef          !   -      - 
     69      REAL(wp), POINTER, DIMENSION(:,:) ::   ztmsk_neg, ztmsk_pos, z_wgt ! 2D workspaces 
     70      REAL(wp), POINTER, DIMENSION(:,:) ::   ztmsk_tospread, zerp_cor    !   -      - 
    7071      !!---------------------------------------------------------------------- 
    7172      ! 
     
    9697         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN 
    9798            z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) ) ) / area   ! sum over the global domain 
    98             emp (:,:) = emp (:,:) - z_fwf  
    99             emps(:,:) = emps(:,:) - z_fwf  
     99            zcoef = z_fwf * rcp 
     100            emp(:,:) = emp(:,:) - z_fwf  
     101            qns(:,:) = qns(:,:) + zcoef * sst_m(:,:)                          ! ensure fw correction does not change the heat budget 
    100102         ENDIF 
    101103         ! 
     
    103105         ! 
    104106         IF( kt == nit000 ) THEN                   ! initialisation 
    105             !                                         ! Read the corrective factor on precipitations (fwfold) 
     107            !                                      ! Read the corrective factor on precipitations (fwfold) 
    106108            CALL ctl_opn( inum, 'EMPave_old.dat', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    107109            READ ( inum, "(24X,I8,2ES24.16)" ) iyear, a_fwb_b, a_fwb 
     
    125127         ENDIF 
    126128         !  
    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 
     129         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN         ! correct the freshwater fluxes 
     130            zcoef = fwfold * rcp 
     131            emp(:,:) = emp(:,:) + fwfold 
     132            qns(:,:) = qns(:,:) - zcoef * sst_m(:,:)  ! ensure fw correction does not change the heat budget 
     133         ENDIF 
     134         ! 
     135         IF( kt == nitend .AND. lwp ) THEN            ! save fwfold value in a file 
    133136            CALL ctl_opn( inum, 'EMPave.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea ) 
    134137            WRITE( inum, "(24X,I8,2ES24.16)" ) nyear, a_fwb_b, a_fwb 
     
    143146            ztmsk_neg(:,:) = tmask_i(:,:) - ztmsk_pos(:,:) 
    144147            ! 
    145             zsurf_neg = glob_sum( e1e2t(:,:)*ztmsk_neg(:,:) )   ! Area filled by <0 and >0 erp  
     148            zsurf_neg = glob_sum( e1e2t(:,:)*ztmsk_neg(:,:) )  ! Area filled by <0 and >0 erp  
    146149            zsurf_pos = glob_sum( e1e2t(:,:)*ztmsk_pos(:,:) ) 
    147150            !                                                  ! fwf global mean  
    148             z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) ) ) / area 
     151            z_fwf     = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) ) ) / area 
    149152            !             
    150153            IF( z_fwf < 0._wp ) THEN         ! spread out over >0 erp area to increase evaporation 
     
    160163            z_fwf_nsrf =  zsum_fwf / ( zsurf_tospread + rsmall ) 
    161164            !                                                  ! weight to respect erp field 2D structure  
    162             zsum_erp = glob_sum( ztmsk_tospread(:,:) * erp(:,:) * e1e2t(:,:) ) 
     165            zsum_erp   = glob_sum( ztmsk_tospread(:,:) * erp(:,:) * e1e2t(:,:) ) 
    163166            z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( zsum_erp + rsmall ) 
    164167            !                                                  ! final correction term to apply 
     
    168171            CALL lbc_lnk( zerp_cor, 'T', 1. ) 
    169172            ! 
    170             emp (:,:) = emp (:,:) + zerp_cor(:,:) 
    171             emps(:,:) = emps(:,:) + zerp_cor(:,:) 
    172             erp (:,:) = erp (:,:) + zerp_cor(:,:) 
     173            emp(:,:) = emp(:,:) + zerp_cor(:,:) 
     174            qns(:,:) = qns(:,:) - zerp_cor(:,:) * rcp * sst_m(:,:)   
     175            erp(:,:) = erp(:,:) + zerp_cor(:,:) 
    173176            ! 
    174177            IF( nprint == 1 .AND. lwp ) THEN                   ! control print 
Note: See TracChangeset for help on using the changeset viewer.