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.
sbc_oce.F90 in NEMO/trunk/src/OCE/SBC – NEMO

source: NEMO/trunk/src/OCE/SBC/sbc_oce.F90 @ 14072

Last change on this file since 14072 was 14072, checked in by laurent, 3 years ago

Merging branch "2020/dev_r13648_ASINTER-04_laurent_bulk_ice", ticket #2369

  • Property svn:keywords set to Id
File size: 15.9 KB
Line 
1MODULE sbc_oce
2   !!======================================================================
3   !!                       ***  MODULE  sbc_oce  ***
4   !! Surface module :   variables defined in core memory
5   !!======================================================================
6   !! History :  3.0  ! 2006-06  (G. Madec)  Original code
7   !!             -   ! 2008-08  (G. Madec)  namsbc moved from sbcmod
8   !!            3.3  ! 2010-04  (M. Leclair, G. Madec)  Forcing averaged over 2 time steps
9   !!             -   ! 2010-11  (G. Madec) ice-ocean stress always computed at each ocean time-step
10   !!            3.3  ! 2010-10  (J. Chanut, C. Bricaud)  add the surface pressure forcing
11   !!            4.0  ! 2012-05  (C. Rousset) add attenuation coef for use in ice model
12   !!            4.0  ! 2016-06  (L. Brodeau) new unified bulk routine (based on AeroBulk)
13   !!            4.0  ! 2019-03  (F. Lemarié, G. Samson) add compatibility with ABL mode
14   !!            4.2  ! 2020-12  (G. Madec, E. Clementi) modified wave parameters in namelist
15   !!----------------------------------------------------------------------
16
17   !!----------------------------------------------------------------------
18   !!   sbc_oce_alloc : allocation of sbc arrays
19   !!   sbc_tau2wnd   : wind speed estimated from wind stress
20   !!----------------------------------------------------------------------
21   USE par_oce        ! ocean parameters
22   USE in_out_manager ! I/O manager
23   USE lib_mpp        ! MPP library
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   sbc_oce_alloc   ! routine called in sbcmod.F90
29   PUBLIC   sbc_tau2wnd     ! routine called in several sbc modules
30
31   !!----------------------------------------------------------------------
32   !!           Namelist for the Ocean Surface Boundary Condition
33   !!----------------------------------------------------------------------
34   !                                   !!* namsbc namelist *
35   LOGICAL , PUBLIC ::   ln_usr         !: user defined formulation
36   LOGICAL , PUBLIC ::   ln_flx         !: flux      formulation
37   LOGICAL , PUBLIC ::   ln_blk         !: bulk formulation
38   LOGICAL , PUBLIC ::   ln_abl         !: Atmospheric boundary layer model
39   LOGICAL , PUBLIC ::   ln_wave        !: wave in the system (forced or coupled)
40#if defined key_oasis3
41   LOGICAL , PUBLIC ::   lk_oasis = .TRUE.  !: OASIS used
42#else
43   LOGICAL , PUBLIC ::   lk_oasis = .FALSE. !: OASIS unused
44#endif
45   LOGICAL , PUBLIC ::   ln_cpl         !: ocean-atmosphere coupled formulation
46   LOGICAL , PUBLIC ::   ln_mixcpl      !: ocean-atmosphere forced-coupled mixed formulation
47   LOGICAL , PUBLIC ::   ln_dm2dc       !: Daily mean to Diurnal Cycle short wave (qsr)
48   LOGICAL , PUBLIC ::   ln_rnf         !: runoffs / runoff mouths
49   LOGICAL , PUBLIC ::   ln_ssr         !: Sea Surface restoring on SST and/or SSS
50   LOGICAL , PUBLIC ::   ln_apr_dyn     !: Atmospheric pressure forcing used on dynamics (ocean & ice)
51   INTEGER , PUBLIC ::   nn_ice         !: flag for ice in the surface boundary condition (=0/1/2/3)
52   LOGICAL , PUBLIC ::   ln_ice_embd    !: flag for levitating/embedding sea-ice in the ocean
53   !                                             !: =F levitating ice (no presure effect) with mass and salt exchanges
54   !                                             !: =T embedded sea-ice (pressure effect + mass and salt exchanges)
55   INTEGER , PUBLIC ::   nn_components  !: flag for sbc module (including sea-ice) coupling mode (see component definition below)
56   INTEGER , PUBLIC ::   nn_fwb         !: FreshWater Budget:
57   !                                             !:  = 0 unchecked
58   !                                             !:  = 1 global mean of e-p-r set to zero at each nn_fsbc time step
59   !                                             !:  = 2 annual global mean of e-p-r set to zero
60   LOGICAL , PUBLIC ::   ln_icebergs    !: Icebergs
61   !
62   INTEGER , PUBLIC ::   nn_lsm         !: Number of iteration if seaoverland is applied
63   !
64   !                                   !!* namsbc_cpl namelist *
65   INTEGER , PUBLIC ::   nn_cats_cpl    !: Number of sea ice categories over which the coupling is carried out
66   !
67   !                                   !!* namsbc_wave namelist *
68   LOGICAL , PUBLIC ::   ln_sdw         !: =T 3d stokes drift from wave model
69   LOGICAL , PUBLIC ::   ln_stcor       !: =T if Stokes-Coriolis and tracer advection terms are used
70   LOGICAL , PUBLIC ::   ln_cdgw        !: =T neutral drag coefficient from wave model
71   LOGICAL , PUBLIC ::   ln_tauoc       !: =T if normalized stress from wave is used
72   LOGICAL , PUBLIC ::   ln_wave_test   !: =T wave test case (constant Stokes drift)
73   LOGICAL , PUBLIC ::   ln_charn       !: =T Chranock coefficient from wave model
74   LOGICAL , PUBLIC ::   ln_taw         !: =T wind stress corrected by wave intake
75   LOGICAL , PUBLIC ::   ln_phioc       !: =T TKE surface BC from wave model
76   LOGICAL , PUBLIC ::   ln_bern_srfc   !: Bernoulli head, waves' inuced pressure
77   LOGICAL , PUBLIC ::   ln_breivikFV_2016 !: Breivik 2016 profile
78   LOGICAL , PUBLIC ::   ln_vortex_force !: vortex force activation
79   LOGICAL , PUBLIC ::   ln_stshear     !: Stoked Drift shear contribution in zdftke
80   !
81   !!----------------------------------------------------------------------
82   !!           switch definition (improve readability)
83   !!----------------------------------------------------------------------
84   INTEGER , PUBLIC, PARAMETER ::   jp_usr     = 1        !: user defined                  formulation
85   INTEGER , PUBLIC, PARAMETER ::   jp_flx     = 2        !: flux                          formulation
86   INTEGER , PUBLIC, PARAMETER ::   jp_blk     = 3        !: bulk                          formulation
87   INTEGER , PUBLIC, PARAMETER ::   jp_abl     = 4        !: Atmospheric boundary layer    formulation
88   INTEGER , PUBLIC, PARAMETER ::   jp_purecpl = 5        !: Pure ocean-atmosphere Coupled formulation
89   INTEGER , PUBLIC, PARAMETER ::   jp_none    = 6        !: for OPA when doing coupling via SAS module
90   !
91   !!----------------------------------------------------------------------
92   !!           component definition
93   !!----------------------------------------------------------------------
94   INTEGER , PUBLIC, PARAMETER ::   jp_iam_nemo = 0      !: Initial single executable configuration
95   !  (no internal OASIS coupling)
96   INTEGER , PUBLIC, PARAMETER ::   jp_iam_opa  = 1      !: Multi executable configuration - OPA component
97   !  (internal OASIS coupling)
98   INTEGER , PUBLIC, PARAMETER ::   jp_iam_sas  = 2      !: Multi executable configuration - SAS component
99   !  (internal OASIS coupling)
100   !!----------------------------------------------------------------------
101   !!              Ocean Surface Boundary Condition fields
102   !!----------------------------------------------------------------------
103   INTEGER , PUBLIC ::  ncpl_qsr_freq = 0        !: qsr coupling frequency per days from atmosphere (used by top)
104   !
105   !!                                   !!   now    ! before   !!
106   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   utau   , utau_b   !: sea surface i-stress (ocean referential)     [N/m2]
107   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   vtau   , vtau_b   !: sea surface j-stress (ocean referential)     [N/m2]
108   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   taum              !: module of sea surface stress (at T-point)    [N/m2]
109   !! wndm is used compute surface gases exchanges in ice-free ocean or leads
110   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wndm              !: wind speed module at T-point (=|U10m-Uoce|)  [m/s]
111   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rhoa              !: air density at "rn_zu" m above the sea       [kg/m3]
112   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr               !: sea heat flux:     solar                     [W/m2]
113   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qns    , qns_b    !: sea heat flux: non solar                     [W/m2]
114   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr_tot           !: total     solar heat flux (over sea and ice) [W/m2]
115   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qns_tot           !: total non solar heat flux (over sea and ice) [W/m2]
116   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   emp    , emp_b    !: freshwater budget: volume flux               [Kg/m2/s]
117   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx    , sfx_b    !: salt flux                                    [PSS.kg/m2/s]
118   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   emp_tot           !: total E-P over ocean and ice                 [Kg/m2/s]
119   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fmmflx            !: freshwater budget: freezing/melting          [Kg/m2/s]
120   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rnf    , rnf_b    !: river runoff                                 [Kg/m2/s]
121   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fwficb , fwficb_b !: iceberg melting                              [Kg/m2/s]
122   !!
123   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  sbc_tsc, sbc_tsc_b  !: sbc content trend                      [K.m/s] jpi,jpj,jpts
124   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  qsr_hc , qsr_hc_b   !: heat content trend due to qsr flux     [K.m/s] jpi,jpj,jpk
125   !!
126   !!
127   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tprecip           !: total precipitation                          [Kg/m2/s]
128   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sprecip           !: solid precipitation                          [Kg/m2/s]
129   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fr_i              !: ice fraction = 1 - lead fraction      (between 0 to 1)
130   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   atm_co2           !: atmospheric pCO2                             [ppm]
131   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: xcplmask          !: coupling mask for ln_mixcpl (warning: allocated in sbccpl)
132   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   cloud_fra         !: cloud cover (fraction of cloud in a gridcell) [-]
133
134   !!---------------------------------------------------------------------
135   !! ABL Vertical Domain size
136   !!---------------------------------------------------------------------
137   INTEGER , PUBLIC            ::   jpka   = 2     !: ABL number of vertical levels (default definition)
138   INTEGER , PUBLIC            ::   jpkam1 = 1     !: jpka-1
139   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   ght_abl, ghw_abl          !: ABL geopotential height (needed for iom)
140   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   e3t_abl, e3w_abl          !: ABL vertical scale factors (needed for iom)
141
142   !!----------------------------------------------------------------------
143   !!                     Sea Surface Mean fields
144   !!----------------------------------------------------------------------
145   INTEGER , PUBLIC                     ::   nn_fsbc   !: frequency of sbc computation (as well as sea-ice model)
146   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssu_m     !: mean (nn_fsbc time-step) surface sea i-current (U-point) [m/s]
147   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssv_m     !: mean (nn_fsbc time-step) surface sea j-current (V-point) [m/s]
148   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sst_m     !: mean (nn_fsbc time-step) surface sea temperature     [Celsius]
149   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sss_m     !: mean (nn_fsbc time-step) surface sea salinity            [psu]
150   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssh_m     !: mean (nn_fsbc time-step) sea surface height                [m]
151   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tsk_m     !: mean (nn_fsbc time-step) SKIN surface sea temp.      [Celsius]
152   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   e3t_m     !: mean (nn_fsbc time-step) sea surface layer thickness       [m]
153   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   frq_m     !: mean (nn_fsbc time-step) fraction of solar net radiation absorbed in the 1st T level [-]
154
155   !!----------------------------------------------------------------------
156   !!                     Surface atmospheric fields
157   !!----------------------------------------------------------------------
158   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: q_air_zt       !: specific humidity of air at z=zt [kg/kg]ww
159   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: theta_air_zt   !: potential temperature of air at z=zt [K]
160
161
162   !! * Substitutions
163#  include "do_loop_substitute.h90"
164   !!----------------------------------------------------------------------
165   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
166   !! $Id$
167   !! Software governed by the CeCILL license (see ./LICENSE)
168   !!----------------------------------------------------------------------
169CONTAINS
170
171   INTEGER FUNCTION sbc_oce_alloc()
172      !!---------------------------------------------------------------------
173      !!                  ***  FUNCTION sbc_oce_alloc  ***
174      !!---------------------------------------------------------------------
175      INTEGER :: ierr(6)
176      !!---------------------------------------------------------------------
177      ierr(:) = 0
178      !
179      ALLOCATE( utau(jpi,jpj) , utau_b(jpi,jpj) , taum(jpi,jpj) ,     &
180         &      vtau(jpi,jpj) , vtau_b(jpi,jpj) , wndm(jpi,jpj) , rhoa(jpi,jpj) , STAT=ierr(1) )
181      !
182      ALLOCATE( qns_tot(jpi,jpj) , qns  (jpi,jpj) , qns_b(jpi,jpj),        &
183         &      qsr_tot(jpi,jpj) , qsr  (jpi,jpj) ,                        &
184         &      emp    (jpi,jpj) , emp_b(jpi,jpj) ,                        &
185         &      sfx    (jpi,jpj) , sfx_b(jpi,jpj) , emp_tot(jpi,jpj), fmmflx(jpi,jpj), STAT=ierr(2) )
186      !
187      ALLOCATE( rnf  (jpi,jpj) , sbc_tsc  (jpi,jpj,jpts) , qsr_hc  (jpi,jpj,jpk) ,  &
188         &      rnf_b(jpi,jpj) , sbc_tsc_b(jpi,jpj,jpts) , qsr_hc_b(jpi,jpj,jpk) ,  &
189         &      fwficb  (jpi,jpj), fwficb_b(jpi,jpj), STAT=ierr(3) )
190      !
191      ALLOCATE( tprecip(jpi,jpj) , sprecip(jpi,jpj) , fr_i(jpi,jpj) ,     &
192         &      atm_co2(jpi,jpj) , tsk_m(jpi,jpj) , cloud_fra(jpi,jpj),   &
193         &      ssu_m  (jpi,jpj) , sst_m(jpi,jpj) , frq_m(jpi,jpj) ,      &
194         &      ssv_m  (jpi,jpj) , sss_m(jpi,jpj) , ssh_m(jpi,jpj) , STAT=ierr(4) )
195      !
196      ALLOCATE( e3t_m(jpi,jpj) , STAT=ierr(5) )
197      !
198      ALLOCATE( q_air_zt(jpi,jpj) , theta_air_zt(jpi,jpj) , STAT=ierr(6) ) !#LB
199      !
200      sbc_oce_alloc = MAXVAL( ierr )
201      CALL mpp_sum ( 'sbc_oce', sbc_oce_alloc )
202      IF( sbc_oce_alloc > 0 )   CALL ctl_warn('sbc_oce_alloc: allocation of arrays failed')
203      !
204   END FUNCTION sbc_oce_alloc
205
206
207   SUBROUTINE sbc_tau2wnd
208      !!---------------------------------------------------------------------
209      !!                    ***  ROUTINE sbc_tau2wnd  ***
210      !!
211      !! ** Purpose : Estimation of wind speed as a function of wind stress
212      !!
213      !! ** Method  : |tau|=rhoa*Cd*|U|^2
214      !!---------------------------------------------------------------------
215      USE dom_oce         ! ocean space and time domain
216      USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
217      REAL(wp) ::   zrhoa  = 1.22         ! Air density kg/m3
218      REAL(wp) ::   zcdrag = 1.5e-3       ! drag coefficient
219      REAL(wp) ::   ztx, zty, ztau, zcoef ! temporary variables
220      INTEGER  ::   ji, jj                ! dummy indices
221      !!---------------------------------------------------------------------
222      zcoef = 0.5 / ( zrhoa * zcdrag )
223      DO_2D( 0, 0, 0, 0 )
224         ztx = utau(ji-1,jj  ) + utau(ji,jj)
225         zty = vtau(ji  ,jj-1) + vtau(ji,jj)
226         ztau = SQRT( ztx * ztx + zty * zty )
227         wndm(ji,jj) = SQRT ( ztau * zcoef ) * tmask(ji,jj,1)
228      END_2D
229      CALL lbc_lnk( 'sbc_oce', wndm(:,:) , 'T', 1.0_wp )
230      !
231   END SUBROUTINE sbc_tau2wnd
232
233   !!======================================================================
234END MODULE sbc_oce
Note: See TracBrowser for help on using the repository browser.