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.
limsbc.F90 in trunk/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: trunk/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90 @ 7702

Last change on this file since 7702 was 7698, checked in by mocavero, 7 years ago

update trunk with OpenMP parallelization

  • Property svn:keywords set to Id
File size: 25.2 KB
Line 
1MODULE limsbc
2   !!======================================================================
3   !!                       ***  MODULE limsbc   ***
4   !!           computation of the flux at the sea ice/ocean interface
5   !!======================================================================
6   !! History :   -   ! 2006-07 (M. Vancoppelle)  LIM3 original code
7   !!            3.0  ! 2008-03 (C. Tallandier)  surface module
8   !!             -   ! 2008-04 (C. Tallandier)  split in 2 + new ice-ocean coupling
9   !!            3.3  ! 2010-05 (G. Madec) decrease ocean & ice reference salinities in the Baltic sea
10   !!                 !                  + simplification of the ice-ocean stress calculation
11   !!            3.4  ! 2011-02 (G. Madec) dynamical allocation
12   !!             -   ! 2012    (D. Iovino) salt flux change
13   !!             -   ! 2012-05 (C. Rousset) add penetration solar flux
14   !!            3.5  ! 2012-10 (A. Coward, G. Madec) salt fluxes ; ice+snow mass
15   !!----------------------------------------------------------------------
16#if defined key_lim3
17   !!----------------------------------------------------------------------
18   !!   'key_lim3'                                    LIM 3.0 sea-ice model
19   !!----------------------------------------------------------------------
20   !!   lim_sbc_alloc : allocate the limsbc arrays
21   !!   lim_sbc_init  : initialisation
22   !!   lim_sbc_flx   : updates mass, heat and salt fluxes at the ocean surface
23   !!   lim_sbc_tau   : update i- and j-stresses, and its modulus at the ocean surface
24   !!----------------------------------------------------------------------
25   USE par_oce        ! ocean parameters
26   USE oce     , ONLY : sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass
27   USE phycst         ! physical constants
28   USE dom_oce        ! ocean domain
29   USE ice            ! LIM sea-ice variables
30   USE sbc_ice        ! Surface boundary condition: sea-ice fields
31   USE sbc_oce        ! Surface boundary condition: ocean fields
32   USE sbccpl         ! Surface boundary condition: coupled interface
33   USE albedo         ! albedo parameters
34   USE traqsr         ! add penetration of solar flux in the calculation of heat budget
35   USE domvvl         ! Variable volume
36   USE limctl         !
37   USE limcons        !
38   USE bdy_oce  , ONLY: ln_bdy
39   !
40   USE in_out_manager ! I/O manager
41   USE iom            ! xIO server
42   USE lbclnk         ! ocean lateral boundary condition - MPP exchanges
43   USE lib_mpp        ! MPP library
44   USE wrk_nemo       ! work arrays
45   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
46
47   IMPLICIT NONE
48   PRIVATE
49
50   PUBLIC   lim_sbc_init   ! called by sbc_lim_init
51   PUBLIC   lim_sbc_flx    ! called by sbc_ice_lim
52   PUBLIC   lim_sbc_tau    ! called by sbc_ice_lim
53
54   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   utau_oce, vtau_oce   ! air-ocean surface i- & j-stress     [N/m2]
55   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tmod_io              ! modulus of the ice-ocean velocity   [m/s]
56   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   soce_0  , sice_0     ! cst SSS and ice salinity (levitating sea-ice)
57
58   !! * Substitutions
59#  include "vectopt_loop_substitute.h90"
60   !!----------------------------------------------------------------------
61   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
62   !! $Id$
63   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
64   !!----------------------------------------------------------------------
65CONTAINS
66
67   INTEGER FUNCTION lim_sbc_alloc()
68      !!-------------------------------------------------------------------
69      !!             ***  ROUTINE lim_sbc_alloc ***
70      !!-------------------------------------------------------------------
71      ALLOCATE( soce_0(jpi,jpj) , utau_oce(jpi,jpj) ,                       &
72         &      sice_0(jpi,jpj) , vtau_oce(jpi,jpj) , tmod_io(jpi,jpj), STAT=lim_sbc_alloc)
73         !
74      IF( lk_mpp             )   CALL mpp_sum( lim_sbc_alloc )
75      IF( lim_sbc_alloc /= 0 )   CALL ctl_warn('lim_sbc_alloc: failed to allocate arrays')
76   END FUNCTION lim_sbc_alloc
77
78
79   SUBROUTINE lim_sbc_flx( kt )
80      !!-------------------------------------------------------------------
81      !!                ***  ROUTINE lim_sbc_flx ***
82      !! 
83      !! ** Purpose :   Update the surface ocean boundary condition for heat
84      !!              salt and mass over areas where sea-ice is non-zero
85      !!         
86      !! ** Action  : - computes the heat and freshwater/salt fluxes
87      !!              at the ice-ocean interface.
88      !!              - Update the ocean sbc
89      !!     
90      !! ** Outputs : - qsr     : sea heat flux:     solar
91      !!              - qns     : sea heat flux: non solar
92      !!              - emp     : freshwater budget: volume flux
93      !!              - sfx     : salt flux
94      !!              - fr_i    : ice fraction
95      !!              - tn_ice  : sea-ice surface temperature
96      !!              - alb_ice : sea-ice albedo (recomputed only for coupled mode)
97      !!
98      !! References : Goosse, H. et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90.
99      !!              Tartinville et al. 2001 Ocean Modelling, 3, 95-108.
100      !!              These refs are now obsolete since everything has been revised
101      !!              The ref should be Rousset et al., 2015
102      !!---------------------------------------------------------------------
103      INTEGER, INTENT(in) ::   kt   ! number of iteration
104      !
105      INTEGER  ::   ji, jj, jl, jk   ! dummy loop indices
106      REAL(wp) ::   zqmass           ! Heat flux associated with mass exchange ice->ocean (W.m-2)
107      REAL(wp) ::   zqsr             ! New solar flux received by the ocean
108      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zalb_cs, zalb_os     ! 3D workspace
109      REAL(wp), POINTER, DIMENSION(:,:)   ::   zalb                 ! 2D workspace
110      !!---------------------------------------------------------------------
111
112      ! --- case we bypass ice thermodynamics --- !
113      IF( .NOT. ln_limthd ) THEN   ! we suppose ice is impermeable => ocean is isolated from atmosphere
114!$OMP PARALLEL
115!$OMP DO schedule(static) private(jj,ji)
116         DO jj = 1, jpj
117            DO ji = 1, jpi
118               hfx_in   (ji,jj)   = pfrld(ji,jj) * ( qns_oce(ji,jj) + qsr_oce(ji,jj) ) + qemp_oce(ji,jj)
119               hfx_out  (ji,jj)   = pfrld(ji,jj) *   qns_oce(ji,jj)                  + qemp_oce(ji,jj)
120               emp_ice  (ji,jj)   = 0._wp
121               qemp_ice (ji,jj)   = 0._wp
122            END DO
123         END DO
124         DO jl = 1, jpl
125!$OMP DO schedule(static) private(jj,ji)
126            DO jj = 1, jpj
127               DO ji = 1, jpi
128                  ftr_ice  (ji,jj,jl) = 0._wp
129                  qevap_ice(ji,jj,jl) = 0._wp
130               END DO
131            END DO
132         END DO
133!$OMP END PARALLEL
134      ENDIF
135     
136      ! albedo output
137      CALL wrk_alloc( jpi,jpj, zalb )   
138
139!$OMP PARALLEL
140!$OMP DO schedule(static) private(jj,ji)
141      DO jj = 1, jpj
142         DO ji = 1, jpi
143            zalb(ji,jj) = 0._wp
144         END DO
145      END DO
146!$OMP DO schedule(static) private(jj,ji,jl)
147      DO jj = 1, jpj
148         DO ji = 1, jpi
149            IF ( at_i_b(ji,jj) <= epsi06 ) THEN
150               zalb(ji,jj) = 0.066_wp
151            ELSE 
152               DO jl = 1, jpl
153                  zalb(ji,jj) = zalb(ji,jj) + ( alb_ice(ji,jj,jl) * a_i_b(ji,jj,jl) ) / at_i_b(ji,jj)
154               END DO
155            END IF
156          END DO
157      END DO
158!$OMP END PARALLEL
159      IF( iom_use('alb_ice' ) )  CALL iom_put( "alb_ice"  , zalb(:,:) )           ! ice albedo output
160
161!$OMP PARALLEL
162!$OMP DO schedule(static) private(jj,ji)
163      DO jj = 1, jpj
164         DO ji = 1, jpi
165            zalb(ji,jj) = 0._wp
166         END DO
167      END DO
168      DO jl = 1, jpl
169!$OMP DO schedule(static) private(jj,ji)
170         DO jj = 1, jpj
171            DO ji = 1, jpi
172               zalb(ji,jj) = zalb(ji,jj) + ( alb_ice(ji,jj,jl) * a_i_b(ji,jj,jl) ) + 0.066_wp * ( 1._wp - at_i_b(ji,jj) )     
173            END DO
174         END DO
175      END DO
176!$OMP END PARALLEL
177      IF( iom_use('albedo'  ) )  CALL iom_put( "albedo"  , zalb(:,:) )           ! ice albedo output
178
179      CALL wrk_dealloc( jpi,jpj, zalb )   
180
181!$OMP PARALLEL
182!$OMP DO schedule(static) private(jj,ji,jl,zqsr,zqmass)
183      DO jj = 1, jpj
184         DO ji = 1, jpi
185
186            !------------------------------------------!
187            !      heat flux at the ocean surface      !
188            !------------------------------------------!
189            ! Solar heat flux reaching the ocean = zqsr (W.m-2)
190            !---------------------------------------------------
191            zqsr = qsr_tot(ji,jj)
192            DO jl = 1, jpl
193               zqsr = zqsr - a_i_b(ji,jj,jl) * (  qsr_ice(ji,jj,jl) - ftr_ice(ji,jj,jl) ) 
194            END DO
195
196            ! Total heat flux reaching the ocean = hfx_out (W.m-2)
197            !---------------------------------------------------
198            zqmass         = hfx_thd(ji,jj) + hfx_dyn(ji,jj) + hfx_res(ji,jj) ! heat flux from snow is 0 (T=0 degC)
199            hfx_out(ji,jj) = hfx_out(ji,jj) + zqmass + zqsr
200
201            ! Add the residual from heat diffusion equation and sublimation (W.m-2)
202            !----------------------------------------------------------------------
203            hfx_out(ji,jj) = hfx_out(ji,jj) + hfx_err_dif(ji,jj) +   &
204               &           ( hfx_sub(ji,jj) - SUM( qevap_ice(ji,jj,:) * a_i_b(ji,jj,:) ) )
205
206            ! New qsr and qns used to compute the oceanic heat flux at the next time step
207            !----------------------------------------------------------------------------
208            qsr(ji,jj) = zqsr                                     
209            qns(ji,jj) = hfx_out(ji,jj) - zqsr             
210
211            !------------------------------------------!
212            !      mass flux at the ocean surface      !
213            !------------------------------------------!
214            !  case of realistic freshwater flux (Tartinville et al., 2001) (presently ACTIVATED)
215            !  -------------------------------------------------------------------------------------
216            !  The idea of this approach is that the system that we consider is the ICE-OCEAN system
217            !  Thus  FW  flux  =  External ( E-P+snow melt)
218            !       Salt flux  =  Exchanges in the ice-ocean system then converted into FW
219            !                     Associated to Ice formation AND Ice melting
220            !                     Even if i see Ice melting as a FW and SALT flux
221            !       
222            ! mass flux from ice/ocean
223            wfx_ice(ji,jj) = wfx_bog(ji,jj) + wfx_bom(ji,jj) + wfx_sum(ji,jj) + wfx_sni(ji,jj)   &
224                           + wfx_opw(ji,jj) + wfx_dyn(ji,jj) + wfx_res(ji,jj) + wfx_lam(ji,jj) 
225
226            ! mass flux at the ocean/ice interface
227            fmmflx(ji,jj) = - ( wfx_ice(ji,jj) + wfx_snw(ji,jj) + wfx_err_sub(ji,jj) )              ! F/M mass flux save at least for biogeochemical model
228            emp(ji,jj)    = emp_oce(ji,jj) - wfx_ice(ji,jj) - wfx_snw(ji,jj) - wfx_err_sub(ji,jj)   ! mass flux + F/M mass flux (always ice/ocean mass exchange)
229         END DO
230      END DO
231
232      !------------------------------------------!
233      !      salt flux at the ocean surface      !
234      !------------------------------------------!
235!$OMP DO schedule(static) private(jj,ji)
236      DO jj = 1, jpj
237         DO ji = 1, jpi
238            sfx(ji,jj) = sfx_bog(ji,jj) + sfx_bom(ji,jj) + sfx_sum(ji,jj) + sfx_sni(ji,jj) + sfx_opw(ji,jj)   &
239               &     + sfx_res(ji,jj) + sfx_dyn(ji,jj) + sfx_bri(ji,jj) + sfx_sub(ji,jj) + sfx_lam(ji,jj)
240         END DO
241      END DO
242!$OMP END PARALLEL
243
244      !-------------------------------------------------------------!
245      !   mass of snow and ice per unit area for embedded sea-ice   !
246      !-------------------------------------------------------------!
247      IF( nn_ice_embd /= 0 ) THEN
248!$OMP PARALLEL DO schedule(static) private(jj,ji)
249         DO jj = 1, jpj
250            DO ji = 1, jpi
251               ! save mass from the previous ice time step
252               snwice_mass_b(ji,jj) = snwice_mass(ji,jj)                 
253               ! new mass per unit area
254               snwice_mass  (ji,jj) = tmask(ji,jj,1) * ( rhosn * vt_s(ji,jj) + rhoic * vt_i(ji,jj)  ) 
255               ! time evolution of snow+ice mass
256               snwice_fmass (ji,jj) = ( snwice_mass(ji,jj) - snwice_mass_b(ji,jj) ) * r1_rdtice
257            END DO
258         END DO
259      ENDIF
260
261      !-----------------------------------------------!
262      !   Storing the transmitted variables           !
263      !-----------------------------------------------!
264!$OMP PARALLEL
265!$OMP DO schedule(static) private(jj,ji)
266      DO jj = 1, jpj
267         DO ji = 1, jpi
268            fr_i  (ji,jj)   = at_i(ji,jj)             ! Sea-ice fraction           
269         END DO
270      END DO
271      DO jl = 1, jpl
272!$OMP DO schedule(static) private(jj,ji)
273         DO jj = 1, jpj
274            DO ji = 1, jpi
275               tn_ice(ji,jj,jl) = t_su(ji,jj,jl)           ! Ice surface temperature                     
276            END DO
277         END DO
278      END DO
279!$OMP END PARALLEL
280
281      !------------------------------------------------------------------------!
282      !    Snow/ice albedo (only if sent to coupler, useless in forced mode)   !
283      !------------------------------------------------------------------------!
284      CALL wrk_alloc( jpi,jpj,jpl,   zalb_cs, zalb_os )   
285      CALL albedo_ice( t_su, ht_i, ht_s, zalb_cs, zalb_os )  ! cloud-sky and overcast-sky ice albedos
286      DO jl = 1, jpl
287!$OMP PARALLEL DO schedule(static) private(jj,ji)
288         DO jj = 1, jpj
289            DO ji = 1, jpi
290               alb_ice(ji,jj,jl) = ( 1. - cldf_ice ) * zalb_cs(ji,jj,jl) + cldf_ice * zalb_os(ji,jj,jl)
291            END DO
292         END DO
293      END DO
294      CALL wrk_dealloc( jpi,jpj,jpl,   zalb_cs, zalb_os )
295
296      ! conservation test
297      IF( ln_limdiachk .AND. .NOT. ln_bdy)  CALL lim_cons_final( 'limsbc' )
298
299      ! control prints
300      IF( ln_limctl )   CALL lim_prt( kt, iiceprt, jiceprt, 3, ' - Final state lim_sbc - ' )
301      IF( ln_ctl )      CALL lim_prt3D( 'limsbc' )
302
303   END SUBROUTINE lim_sbc_flx
304
305
306   SUBROUTINE lim_sbc_tau( kt , pu_oce, pv_oce )
307      !!-------------------------------------------------------------------
308      !!                ***  ROUTINE lim_sbc_tau ***
309      !! 
310      !! ** Purpose : Update the ocean surface stresses due to the ice
311      !!         
312      !! ** Action  : * at each ice time step (every nn_fsbc time step):
313      !!                - compute the modulus of ice-ocean relative velocity
314      !!                  (*rho*Cd) at T-point (C-grid) or I-point (B-grid)
315      !!                      tmod_io = rhoco * | U_ice-U_oce |
316      !!                - update the modulus of stress at ocean surface
317      !!                      taum = frld * taum + (1-frld) * tmod_io * | U_ice-U_oce |
318      !!              * at each ocean time step (every kt):
319      !!                  compute linearized ice-ocean stresses as
320      !!                      Utau = tmod_io * | U_ice - pU_oce |
321      !!                using instantaneous current ocean velocity (usually before)
322      !!
323      !!    NB: - ice-ocean rotation angle no more allowed
324      !!        - here we make an approximation: taum is only computed every ice time step
325      !!          This avoids mutiple average to pass from T -> U,V grids and next from U,V grids
326      !!          to T grid. taum is used in TKE and GLS, which should not be too sensitive to this approximaton...
327      !!
328      !! ** Outputs : - utau, vtau   : surface ocean i- and j-stress (u- & v-pts) updated with ice-ocean fluxes
329      !!              - taum         : modulus of the surface ocean stress (T-point) updated with ice-ocean fluxes
330      !!---------------------------------------------------------------------
331      INTEGER ,                     INTENT(in) ::   kt               ! ocean time-step index
332      REAL(wp), DIMENSION(jpi,jpj), INTENT(in) ::   pu_oce, pv_oce   ! surface ocean currents
333      !
334      INTEGER  ::   ji, jj   ! dummy loop indices
335      REAL(wp) ::   zat_u, zutau_ice, zu_t, zmodt   ! local scalar
336      REAL(wp) ::   zat_v, zvtau_ice, zv_t, zrhoco  !   -      -
337      !!---------------------------------------------------------------------
338      zrhoco = rau0 * rn_cio
339      !
340      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN     !==  Ice time-step only  ==!   (i.e. surface module time-step)
341!$OMP PARALLEL DO schedule(static) private(jj,ji,zu_t,zv_t,zmodt)
342         DO jj = 2, jpjm1                             !* update the modulus of stress at ocean surface (T-point)
343            DO ji = fs_2, fs_jpim1
344               !                                               ! 2*(U_ice-U_oce) at T-point
345               zu_t = u_ice(ji,jj) + u_ice(ji-1,jj) - u_oce(ji,jj) - u_oce(ji-1,jj)   
346               zv_t = v_ice(ji,jj) + v_ice(ji,jj-1) - v_oce(ji,jj) - v_oce(ji,jj-1) 
347               !                                              ! |U_ice-U_oce|^2
348               zmodt =  0.25_wp * (  zu_t * zu_t + zv_t * zv_t  )
349               !                                               ! update the ocean stress modulus
350               taum(ji,jj) = ( 1._wp - at_i(ji,jj) ) * taum(ji,jj) + at_i(ji,jj) * zrhoco * zmodt
351               tmod_io(ji,jj) = zrhoco * SQRT( zmodt )          ! rhoco * |U_ice-U_oce| at T-point
352            END DO
353         END DO
354         CALL lbc_lnk_multi( taum, 'T', 1., tmod_io, 'T', 1. )
355         !
356!$OMP PARALLEL DO schedule(static) private(jj,ji)
357         DO jj = 1, jpj
358            DO ji = 1, jpi
359               utau_oce(ji,jj) = utau(ji,jj)                    !* save the air-ocean stresses at ice time-step
360               vtau_oce(ji,jj) = vtau(ji,jj)
361            END DO
362         END DO
363         !
364      ENDIF
365      !
366      !                                      !==  every ocean time-step  ==!
367      !
368!$OMP PARALLEL DO schedule(static) private(jj,ji,zat_u,zat_v,zutau_ice,zvtau_ice)
369      DO jj = 2, jpjm1                                !* update the stress WITHOUT a ice-ocean rotation angle
370         DO ji = fs_2, fs_jpim1   ! Vect. Opt.
371            zat_u  = ( at_i(ji,jj) + at_i(ji+1,jj) ) * 0.5_wp   ! ice area at u and V-points
372            zat_v  = ( at_i(ji,jj) + at_i(ji,jj+1) ) * 0.5_wp
373            !                                                   ! linearized quadratic drag formulation
374            zutau_ice   = 0.5_wp * ( tmod_io(ji,jj) + tmod_io(ji+1,jj) ) * ( u_ice(ji,jj) - pu_oce(ji,jj) )
375            zvtau_ice   = 0.5_wp * ( tmod_io(ji,jj) + tmod_io(ji,jj+1) ) * ( v_ice(ji,jj) - pv_oce(ji,jj) )
376            !                                                   ! stresses at the ocean surface
377            utau(ji,jj) = ( 1._wp - zat_u ) * utau_oce(ji,jj) + zat_u * zutau_ice
378            vtau(ji,jj) = ( 1._wp - zat_v ) * vtau_oce(ji,jj) + zat_v * zvtau_ice
379         END DO
380      END DO
381      CALL lbc_lnk_multi( utau, 'U', -1., vtau, 'V', -1. )   ! lateral boundary condition
382      !
383     
384   END SUBROUTINE lim_sbc_tau
385
386
387   SUBROUTINE lim_sbc_init
388      !!-------------------------------------------------------------------
389      !!                  ***  ROUTINE lim_sbc_init  ***
390      !!             
391      !! ** Purpose : Preparation of the file ice_evolu for the output of
392      !!      the temporal evolution of key variables
393      !!
394      !! ** input   : Namelist namicedia
395      !!-------------------------------------------------------------------
396      INTEGER  ::   ji, jj, jk               ! dummy loop indices
397      REAL(wp) ::   zcoefu, zcoefv, zcoeff   ! local scalar
398      !!-------------------------------------------------------------------
399      !
400      IF(lwp) WRITE(numout,*)
401      IF(lwp) WRITE(numout,*) 'lim_sbc_init : LIM-3 sea-ice - surface boundary condition'
402      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~   '
403
404      !                                      ! allocate lim_sbc array
405      IF( lim_sbc_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'lim_sbc_init : unable to allocate standard arrays' )
406      !
407!$OMP PARALLEL
408!$OMP DO schedule(static) private(jj,ji)
409      DO jj = 1, jpj
410         DO ji = 1, jpi
411            soce_0(ji,jj) = soce                     ! constant SSS and ice salinity used in levitating sea-ice case
412            sice_0(ji,jj) = sice
413         END DO
414      END DO
415      !                                      ! decrease ocean & ice reference salinities in the Baltic Sea area
416!$OMP DO schedule(static) private(jj,ji)
417      DO jj = 1, jpj
418         DO ji = 1, jpi
419            IF ( 14._wp <= glamt(ji,jj) .AND. glamt(ji,jj) <= 32._wp .AND.   &
420               &   54._wp <= gphit(ji,jj) .AND. gphit(ji,jj) <= 66._wp         ) THEN
421               soce_0(ji,jj) = 4._wp
422               sice_0(ji,jj) = 2._wp
423            END IF
424         END DO
425      END DO
426!$OMP END PARALLEL
427      !
428      IF( .NOT. ln_rstart ) THEN
429         !                                      ! embedded sea ice
430         IF( nn_ice_embd /= 0 ) THEN            ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass
431!$OMP PARALLEL DO schedule(static) private(jj,ji)
432            DO jj = 1, jpj
433               DO ji = 1, jpi
434                  snwice_mass  (ji,jj) = tmask(ji,jj,1) * ( rhosn * vt_s(ji,jj) + rhoic * vt_i(ji,jj)  )
435                  snwice_mass_b(ji,jj) = snwice_mass(ji,jj)
436               END DO
437            END DO
438         ELSE
439!$OMP PARALLEL DO schedule(static) private(jj,ji)
440            DO jj = 1, jpj
441               DO ji = 1, jpi
442                  snwice_mass  (ji,jj) = 0._wp          ! no mass exchanges
443                  snwice_mass_b(ji,jj) = 0._wp          ! no mass exchanges
444               END DO
445            END DO
446         ENDIF
447         IF( nn_ice_embd == 2 ) THEN            ! full embedment (case 2) deplete the initial ssh below sea-ice area
448!$OMP PARALLEL DO schedule(static) private(jj,ji)
449            DO jj = 1, jpj
450               DO ji = 1, jpi
451                  sshn(ji,jj) = sshn(ji,jj) - snwice_mass(ji,jj) * r1_rau0
452                  sshb(ji,jj) = sshb(ji,jj) - snwice_mass(ji,jj) * r1_rau0
453               END DO
454            END DO
455
456!!gm I really don't like this stuff here...  Find a way to put that elsewhere or differently
457!!gm
458            IF( .NOT.ln_linssh ) THEN
459!$OMP PARALLEL
460!$OMP DO schedule(static) private(jj,ji)
461               DO jk = 1,jpkm1                     ! adjust initial vertical scale factors
462                  DO jj = 1, jpj
463                     DO ji = 1, jpi
464                        e3t_n(ji,jj,jk) = e3t_0(ji,jj,jk)*( 1._wp + sshn(ji,jj)*tmask(ji,jj,1)/(ht_0(ji,jj) + 1.0 - tmask(ji,jj,1)) )
465                        e3t_b(ji,jj,jk) = e3t_0(ji,jj,jk)*( 1._wp + sshb(ji,jj)*tmask(ji,jj,1)/(ht_0(ji,jj) + 1.0 - tmask(ji,jj,1)) )
466                     END DO
467                  END DO
468               END DO
469!$OMP DO schedule(static) private(jj,ji)
470               DO jk = 1,jpk
471                  DO jj = 1, jpj
472                     DO ji = 1, jpi
473                        e3t_a(ji,jj,jk) = e3t_b(ji,jj,jk)
474                     END DO
475                  END DO
476               END DO
477!$OMP END PARALLEL
478               ! Reconstruction of all vertical scale factors at now and before time-steps
479               ! =========================================================================
480               ! Horizontal scale factor interpolations
481               ! --------------------------------------
482               CALL dom_vvl_interpol( e3t_b(:,:,:), e3u_b(:,:,:), 'U' )
483               CALL dom_vvl_interpol( e3t_b(:,:,:), e3v_b(:,:,:), 'V' )
484               CALL dom_vvl_interpol( e3t_n(:,:,:), e3u_n(:,:,:), 'U' )
485               CALL dom_vvl_interpol( e3t_n(:,:,:), e3v_n(:,:,:), 'V' )
486               CALL dom_vvl_interpol( e3u_n(:,:,:), e3f_n(:,:,:), 'F' )
487               ! Vertical scale factor interpolations
488                 ! ------------------------------------
489               CALL dom_vvl_interpol( e3t_n(:,:,:), e3w_n (:,:,:), 'W'  )
490               CALL dom_vvl_interpol( e3u_n(:,:,:), e3uw_n(:,:,:), 'UW' )
491               CALL dom_vvl_interpol( e3v_n(:,:,:), e3vw_n(:,:,:), 'VW' )
492               CALL dom_vvl_interpol( e3u_b(:,:,:), e3uw_b(:,:,:), 'UW' )
493               CALL dom_vvl_interpol( e3v_b(:,:,:), e3vw_b(:,:,:), 'VW' )
494               ! t- and w- points depth
495               ! ----------------------
496!!gm not sure of that....
497!$OMP PARALLEL
498!$OMP DO schedule(static) private(jj,ji)
499               DO jj = 1, jpj
500                  DO ji = 1, jpi
501                     gdept_n(ji,jj,1) = 0.5_wp * e3w_n(ji,jj,1)
502                     gdepw_n(ji,jj,1) = 0.0_wp
503                     gde3w_n(ji,jj,1) = gdept_n(ji,jj,1) - sshn(ji,jj)
504                  END DO
505               END DO
506               DO jk = 2, jpk
507!$OMP DO schedule(static) private(jj,ji)
508                  DO jj = 1, jpj
509                     DO ji = 1, jpi
510                        gdept_n(ji,jj,jk) = gdept_n(ji,jj,jk-1) + e3w_n(ji,jj,jk)
511                        gdepw_n(ji,jj,jk) = gdepw_n(ji,jj,jk-1) + e3t_n(ji,jj,jk-1)
512                        gde3w_n(ji,jj,jk) = gdept_n(ji,jj,jk  ) - sshn   (ji,jj)
513                     END DO
514                  END DO
515               END DO
516!$OMP END PARALLEL
517            ENDIF
518         ENDIF
519      ENDIF ! .NOT. ln_rstart
520      !
521   END SUBROUTINE lim_sbc_init
522
523#else
524   !!----------------------------------------------------------------------
525   !!   Default option :        Dummy module       NO LIM 3.0 sea-ice model
526   !!----------------------------------------------------------------------
527CONTAINS
528   SUBROUTINE lim_sbc           ! Dummy routine
529   END SUBROUTINE lim_sbc
530#endif 
531
532   !!======================================================================
533END MODULE limsbc
Note: See TracBrowser for help on using the repository browser.