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 branches/UKMO/r6232_HZG_WAVE-coupling/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/UKMO/r6232_HZG_WAVE-coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90

Last change on this file was 8756, checked in by jcastill, 6 years ago

Changes for receiving the ocean wind stress components from a wave model, both in forced and coupled mode
WARNING: this might not work properly without merging the branch svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/UKMO/AMM15_v3_6_STABLE_package_UKEP

File size: 16.5 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   !!----------------------------------------------------------------------
13
14   !!----------------------------------------------------------------------
15   !!   sbc_oce_alloc : allocation of sbc arrays
16   !!   sbc_tau2wnd   : wind speed estimated from wind stress
17   !!----------------------------------------------------------------------
18   USE par_oce        ! ocean parameters
19   USE in_out_manager ! I/O manager
20   USE lib_mpp        ! MPP library
21
22   IMPLICIT NONE
23   PRIVATE
24
25   PUBLIC   sbc_oce_alloc   ! routine called in sbcmod.F90
26   PUBLIC   sbc_tau2wnd     ! routine called in several sbc modules
27   
28   !!----------------------------------------------------------------------
29   !!           Namelist for the Ocean Surface Boundary Condition
30   !!----------------------------------------------------------------------
31   !                                   !!* namsbc namelist *
32   LOGICAL , PUBLIC ::   ln_ana         !: analytical boundary condition flag
33   LOGICAL , PUBLIC ::   ln_flx         !: flux      formulation
34   LOGICAL , PUBLIC ::   ln_blk_clio    !: CLIO bulk formulation
35   LOGICAL , PUBLIC ::   ln_blk_core    !: CORE bulk formulation
36   LOGICAL , PUBLIC ::   ln_blk_mfs     !: MFS  bulk formulation
37#if defined key_oasis3
38   LOGICAL , PUBLIC ::   lk_oasis = .TRUE.  !: OASIS used
39#else
40   LOGICAL , PUBLIC ::   lk_oasis = .FALSE. !: OASIS unused
41#endif
42   LOGICAL , PUBLIC ::   ln_cpl         !: ocean-atmosphere coupled formulation
43   LOGICAL , PUBLIC ::   ln_mixcpl      !: ocean-atmosphere forced-coupled mixed formulation
44   LOGICAL , PUBLIC ::   ln_wavcpl      !: ocean-wave forced-coupled mixed formulation
45   LOGICAL , PUBLIC ::   ll_purecpl     !: ocean-atmosphere or ocean-wave pure coupled formulation
46   LOGICAL , PUBLIC ::   ln_dm2dc       !: Daily mean to Diurnal Cycle short wave (qsr)
47   LOGICAL , PUBLIC ::   ln_rnf         !: runoffs / runoff mouths
48   LOGICAL , PUBLIC ::   ln_ssr         !: Sea Surface restoring on SST and/or SSS     
49   LOGICAL , PUBLIC ::   ln_apr_dyn     !: Atmospheric pressure forcing used on dynamics (ocean & ice)
50   INTEGER , PUBLIC ::   nn_ice         !: flag for ice in the surface boundary condition (=0/1/2/3)
51   INTEGER , PUBLIC ::   nn_isf         !: flag for isf in the surface boundary condition (=0/1/2/3/4)
52   INTEGER , PUBLIC ::   nn_ice_embd    !: flag for levitating/embedding sea-ice in the ocean
53   !                                             !: =0 levitating ice (no mass exchange, concentration/dilution effect)
54   !                                             !: =1 levitating ice with mass and salt exchange but no presure effect
55   !                                             !: =2 embedded sea-ice (full salt and mass exchanges and pressure)
56   INTEGER , PUBLIC ::   nn_components  !: flag for sbc module (including sea-ice) coupling mode (see component definition below)
57   INTEGER , PUBLIC ::   nn_limflx      !: LIM3 Multi-category heat flux formulation
58   !                                             !: =-1  Use of per-category fluxes
59   !                                             !: = 0  Average per-category fluxes
60   !                                             !: = 1  Average then redistribute per-category fluxes
61   !                                             !: = 2  Redistribute a single flux over categories
62   INTEGER , PUBLIC ::   nn_fwb         !: FreshWater Budget:
63   !                                             !:  = 0 unchecked
64   !                                             !:  = 1 global mean of e-p-r set to zero at each nn_fsbc time step
65   !                                             !:  = 2 annual global mean of e-p-r set to zero
66   LOGICAL , PUBLIC ::   ln_wave        !: true if some coupling with wave model
67   LOGICAL , PUBLIC ::   ln_cdgw        !: true if neutral drag coefficient from wave model
68   LOGICAL , PUBLIC ::   ln_sdw         !: true if 3d Stokes drift from wave model
69   LOGICAL , PUBLIC ::   ln_stcor       !: true if Stokes-Coriolis term is used
70   LOGICAL , PUBLIC ::   ln_tauoc       !: true if normalized stress from wave is used
71   LOGICAL , PUBLIC ::   ln_tauw        !: true if ocean stress components from wave is used
72   LOGICAL , PUBLIC ::   ln_phioc       !: true if wave energy to ocean is used
73   LOGICAL , PUBLIC ::   ln_rough       !: true if wave roughness equals significant wave height
74   LOGICAL , PUBLIC ::   ln_zdfqiao     !: Enhanced wave vertical mixing Qiao(2010) formulation flag
75   INTEGER , PUBLIC ::   nn_drag        ! type of formula to calculate wind stress from wind components
76   INTEGER , PUBLIC ::   nn_wmix        ! type of wave breaking mixing
77   !
78   LOGICAL , PUBLIC ::   ln_icebergs    !: Icebergs
79   !
80   INTEGER , PUBLIC ::   nn_lsm         !: Number of iteration if seaoverland is applied
81   !!----------------------------------------------------------------------
82   !!           switch definition (improve readability)
83   !!----------------------------------------------------------------------
84   INTEGER , PUBLIC, PARAMETER ::   jp_gyre    = 0        !: GYRE analytical               formulation
85   INTEGER , PUBLIC, PARAMETER ::   jp_ana     = 1        !: analytical                    formulation
86   INTEGER , PUBLIC, PARAMETER ::   jp_flx     = 2        !: flux                          formulation
87   INTEGER , PUBLIC, PARAMETER ::   jp_clio    = 3        !: CLIO bulk                     formulation
88   INTEGER , PUBLIC, PARAMETER ::   jp_core    = 4        !: CORE bulk                     formulation
89   INTEGER , PUBLIC, PARAMETER ::   jp_purecpl = 5        !: Pure ocean-atmosphere Coupled formulation
90   INTEGER , PUBLIC, PARAMETER ::   jp_mfs     = 6        !: MFS  bulk                     formulation
91   INTEGER , PUBLIC, PARAMETER ::   jp_none    = 7        !: for OPA when doing coupling via SAS module
92   INTEGER , PUBLIC, PARAMETER ::   jp_esopa   = -1       !: esopa test, ALL formulations
93   
94   !!----------------------------------------------------------------------
95   !!           component definition
96   !!----------------------------------------------------------------------
97   INTEGER , PUBLIC, PARAMETER ::   jp_iam_nemo = 0      !: Initial single executable configuration
98                                                         !  (no internal OASIS coupling)
99   INTEGER , PUBLIC, PARAMETER ::   jp_iam_opa  = 1      !: Multi executable configuration - OPA component
100                                                         !  (internal OASIS coupling)
101   INTEGER , PUBLIC, PARAMETER ::   jp_iam_sas  = 2      !: Multi executable configuration - SAS component
102                                                         !  (internal OASIS coupling)
103   !!----------------------------------------------------------------------
104   !!           wind stress definition
105   !!----------------------------------------------------------------------
106   INTEGER, PUBLIC, PARAMETER ::   jp_ukmo  = 0        ! UKMO SHELF formulation
107   INTEGER, PUBLIC, PARAMETER ::   jp_std   = 1        ! standard formulation with forced or coupled drag coefficient
108   INTEGER, PUBLIC, PARAMETER ::   jp_const = 2        ! standard formulation with constant drag coefficient
109   INTEGER, PUBLIC, PARAMETER ::   jp_mcore = 3        ! momentum calculated from core forcing fields
110
111   !!----------------------------------------------------------------------
112   !!           Wave mixing vertical parameterization
113   !!----------------------------------------------------------------------
114   INTEGER, PUBLIC, PARAMETER ::   jp_craigbanner = 0  ! Craig and Banner formulation (original NEMO formulation -
115                                                       !    direct conversion of mechanical to turbulent energy)
116   INTEGER, PUBLIC, PARAMETER ::   jp_janssen     = 1  ! Janssen formulation - no assumption on direct energy conversion
117
118   !!----------------------------------------------------------------------
119   !!              Ocean Surface Boundary Condition fields
120   !!----------------------------------------------------------------------
121   INTEGER , PUBLIC ::  ncpl_qsr_freq            !: qsr coupling frequency per days from atmosphere
122   !
123   LOGICAL , PUBLIC ::   lhftau = .FALSE.        !: HF tau used in TKE: mean(stress module) - module(mean stress)
124   !!                                   !!   now    ! before   !!
125   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   utau   , utau_b   !: sea surface i-stress (ocean referential)     [N/m2]
126   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   vtau   , vtau_b   !: sea surface j-stress (ocean referential)     [N/m2]
127   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   taum              !: module of sea surface stress (at T-point)    [N/m2]
128   !! wndm is used onmpute surface gases exchanges in ice-free ocean or leads
129   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wndm              !: wind speed module at T-point (=|U10m-Uoce|)  [m/s]
130   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr               !: sea heat flux:     solar                     [W/m2]
131   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qns    , qns_b    !: sea heat flux: non solar                     [W/m2]
132   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qsr_tot           !: total     solar heat flux (over sea and ice) [W/m2]
133   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qns_tot           !: total non solar heat flux (over sea and ice) [W/m2]
134   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   emp    , emp_b    !: freshwater budget: volume flux               [Kg/m2/s]
135   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx    , sfx_b    !: salt flux                                    [PSU/m2/s]
136   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   emp_tot           !: total E-P over ocean and ice                 [Kg/m2/s]
137   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fmmflx            !: freshwater budget: freezing/melting          [Kg/m2/s]
138   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rnf    , rnf_b    !: river runoff        [Kg/m2/s] 
139   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fwfisf , fwfisf_b !: ice shelf melting   [Kg/m2/s] 
140   !!
141   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  sbc_tsc, sbc_tsc_b  !: sbc content trend                      [K.m/s] jpi,jpj,jpts
142   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  qsr_hc , qsr_hc_b   !: heat content trend due to qsr flux     [K.m/s] jpi,jpj,jpk
143   !!
144   !!
145   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tprecip           !: total precipitation                          [Kg/m2/s]
146   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sprecip           !: solid precipitation                          [Kg/m2/s]
147   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fr_i              !: ice fraction = 1 - lead fraction      (between 0 to 1)
148#if defined key_cpl_carbon_cycle
149   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   atm_co2           !: atmospheric pCO2                             [ppm]
150#endif
151   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: xcplmask          !: coupling mask for ln_mixcpl (warning: allocated in sbccpl)
152
153   !!----------------------------------------------------------------------
154   !!                     Sea Surface Mean fields
155   !!----------------------------------------------------------------------
156   INTEGER , PUBLIC                     ::   nn_fsbc   !: frequency of sbc computation (as well as sea-ice model)
157   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssu_m     !: mean (nn_fsbc time-step) surface sea i-current (U-point) [m/s]
158   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssv_m     !: mean (nn_fsbc time-step) surface sea j-current (V-point) [m/s]
159   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sst_m     !: mean (nn_fsbc time-step) surface sea temperature     [Celsius]
160   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sss_m     !: mean (nn_fsbc time-step) surface sea salinity            [psu]
161   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssh_m     !: mean (nn_fsbc time-step) sea surface height                [m]
162   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   e3t_m     !: mean (nn_fsbc time-step) sea surface layer thickness       [m]
163   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   frq_m     !: mean (nn_fsbc time-step) fraction of solar net radiation absorbed in the 1st T level [-]
164
165   !! * Substitutions
166#  include "vectopt_loop_substitute.h90"
167   !!----------------------------------------------------------------------
168   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
169   !! $Id$
170   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
171   !!----------------------------------------------------------------------
172CONTAINS
173
174   INTEGER FUNCTION sbc_oce_alloc()
175      !!---------------------------------------------------------------------
176      !!                  ***  FUNCTION sbc_oce_alloc  ***
177      !!---------------------------------------------------------------------
178      INTEGER :: ierr(5)
179      !!---------------------------------------------------------------------
180      ierr(:) = 0
181      !
182      ALLOCATE( utau(jpi,jpj) , utau_b(jpi,jpj) , taum(jpi,jpj) ,     &
183         &      vtau(jpi,jpj) , vtau_b(jpi,jpj) , wndm(jpi,jpj) , STAT=ierr(1) ) 
184         !
185      ALLOCATE( qns_tot(jpi,jpj) , qns  (jpi,jpj) , qns_b(jpi,jpj),        &
186         &      qsr_tot(jpi,jpj) , qsr  (jpi,jpj) ,                        &
187         &      emp    (jpi,jpj) , emp_b(jpi,jpj) ,                        &
188         &      sfx    (jpi,jpj) , sfx_b(jpi,jpj) , emp_tot(jpi,jpj), fmmflx(jpi,jpj), STAT=ierr(2) )
189         !
190      ALLOCATE( fwfisf  (jpi,jpj), rnf  (jpi,jpj) , sbc_tsc  (jpi,jpj,jpts) , qsr_hc  (jpi,jpj,jpk) ,     &
191         &      fwfisf_b(jpi,jpj), rnf_b(jpi,jpj) , sbc_tsc_b(jpi,jpj,jpts) , qsr_hc_b(jpi,jpj,jpk) , STAT=ierr(3) )
192         !
193      ALLOCATE( tprecip(jpi,jpj) , sprecip(jpi,jpj) , fr_i(jpi,jpj) ,     &
194#if defined key_cpl_carbon_cycle
195         &      atm_co2(jpi,jpj) ,                                        &
196#endif
197         &      ssu_m  (jpi,jpj) , sst_m(jpi,jpj) , frq_m(jpi,jpj) ,      &
198         &      ssv_m  (jpi,jpj) , sss_m(jpi,jpj) , ssh_m(jpi,jpj) , STAT=ierr(4) )
199         !
200#if defined key_vvl
201      ALLOCATE( e3t_m(jpi,jpj) , STAT=ierr(5) )
202#endif
203         !
204      sbc_oce_alloc = MAXVAL( ierr )
205      IF( lk_mpp            )   CALL mpp_sum ( sbc_oce_alloc )
206      IF( sbc_oce_alloc > 0 )   CALL ctl_warn('sbc_oce_alloc: allocation of arrays failed')
207      !
208   END FUNCTION sbc_oce_alloc
209
210
211   SUBROUTINE sbc_tau2wnd
212      !!---------------------------------------------------------------------
213      !!                    ***  ROUTINE sbc_tau2wnd  ***
214      !!                   
215      !! ** Purpose : Estimation of wind speed as a function of wind stress   
216      !!
217      !! ** Method  : |tau|=rhoa*Cd*|U|^2
218      !!---------------------------------------------------------------------
219      USE dom_oce         ! ocean space and time domain
220      USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
221      REAL(wp) ::   zrhoa  = 1.22         ! Air density kg/m3
222      REAL(wp) ::   zcdrag = 1.5e-3       ! drag coefficient
223      REAL(wp) ::   ztx, zty, ztau, zcoef ! temporary variables
224      INTEGER  ::   ji, jj                ! dummy indices
225      !!---------------------------------------------------------------------
226      zcoef = 0.5 / ( zrhoa * zcdrag ) 
227!CDIR NOVERRCHK
228      DO jj = 2, jpjm1
229!CDIR NOVERRCHK
230         DO ji = fs_2, fs_jpim1   ! vect. opt.
231            ztx = utau(ji-1,jj  ) + utau(ji,jj) 
232            zty = vtau(ji  ,jj-1) + vtau(ji,jj) 
233            ztau = SQRT( ztx * ztx + zty * zty )
234            wndm(ji,jj) = SQRT ( ztau * zcoef ) * tmask(ji,jj,1)
235         END DO
236      END DO
237      CALL lbc_lnk( wndm(:,:) , 'T', 1. )
238      !
239   END SUBROUTINE sbc_tau2wnd
240
241   !!======================================================================
242END MODULE sbc_oce
Note: See TracBrowser for help on using the repository browser.