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.
iceforcing.F90 in branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/iceforcing.F90 @ 8514

Last change on this file since 8514 was 8514, checked in by clem, 7 years ago

changes in style - part5 - almost done

File size: 13.9 KB
Line 
1MODULE iceforcing
2   !!======================================================================
3   !!                       ***  MODULE  iceforcing  ***
4   !! Sea-Ice :   air-ice forcing fields
5   !!=====================================================================
6   !! History :  4.0  ! 2017-08  (C. Rousset) Original code
7   !!----------------------------------------------------------------------
8#if defined key_lim3
9   !!----------------------------------------------------------------------
10   !!   'key_lim3' :                                  LIM 3.0 sea-ice model
11   !!----------------------------------------------------------------------
12   USE oce            ! ocean dynamics and tracers
13   USE dom_oce        ! ocean space and time domain
14   USE ice            ! sea-ice variables
15   USE sbc_oce        ! Surface boundary condition: ocean fields
16   USE sbc_ice        ! Surface boundary condition: ice   fields
17   USE usrdef_sbc     ! user defined: surface boundary condition
18   USE sbcblk         ! Surface boundary condition: bulk
19   USE sbccpl         ! Surface boundary condition: coupled interface
20   USE icealb         ! ice albedo
21   !
22   USE iom            ! I/O manager library
23   USE in_out_manager ! I/O manager
24   USE lbclnk         ! lateral boundary condition - MPP link
25   USE lib_mpp        ! MPP library
26   USE lib_fortran    !
27   USE timing         ! Timing
28
29   IMPLICIT NONE
30   PRIVATE
31
32   PUBLIC ice_forcing_tau  ! routine called by icestp.F90
33   PUBLIC ice_forcing_flx  ! routine called by icestp.F90
34
35   !! * Substitutions
36#  include "vectopt_loop_substitute.h90"
37   !!----------------------------------------------------------------------
38   !! NEMO/ICE 4.0 , UCL NEMO Consortium (2017)
39   !! $Id: icestp.F90 8319 2017-07-11 15:00:44Z clem $
40   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
41   !!----------------------------------------------------------------------
42CONTAINS
43
44   SUBROUTINE ice_forcing_tau( kt, ksbc, utau_ice, vtau_ice )
45      !!---------------------------------------------------------------------
46      !!                  ***  ROUTINE ice_forcing_tau  ***
47      !!
48      !! ** Purpose : provide surface boundary condition for sea ice (momentum)
49      !!
50      !! ** Action  : It provides the following fields:
51      !!              utau_ice, vtau_ice : surface ice stress (U- & V-points) [N/m2]
52      !!---------------------------------------------------------------------
53      INTEGER, INTENT(in) ::   kt      ! ocean time step
54      INTEGER, INTENT(in) ::   ksbc    ! type of sbc flux ( 1 = user defined formulation,
55                                       !                    3 = bulk formulation,
56                                       !                    4 = Pure Coupled formulation)
57      REAL(wp), DIMENSION(jpi,jpj), INTENT(out) ::   utau_ice, vtau_ice 
58      !!
59      INTEGER  ::   ji, jj                 ! dummy loop index
60      REAL(wp), DIMENSION(jpi,jpj) ::   zutau_ice, zvtau_ice 
61      !!----------------------------------------------------------------------
62
63      IF( nn_timing == 1 )   CALL timing_start('ice_forcing_tau')
64
65      IF( kt == nit000 .AND. lwp ) THEN
66         WRITE(numout,*)
67         WRITE(numout,*)'ice_forcing_tau: Surface boundary condition for sea ice (momentum)'
68         WRITE(numout,*)'~~~~~~~~~~~~~~~'
69      ENDIF
70
71      SELECT CASE( ksbc )
72         CASE( jp_usr     )   ;    CALL usrdef_sbc_ice_tau( kt )                 ! user defined formulation
73         CASE( jp_blk     )   ;    CALL blk_ice_tau                              ! Bulk formulation
74         CASE( jp_purecpl )   ;    CALL sbc_cpl_ice_tau( utau_ice , vtau_ice )   ! Coupled   formulation
75      END SELECT
76
77      IF( ln_mixcpl) THEN                                                        ! Case of a mixed Bulk/Coupled formulation
78                                   CALL sbc_cpl_ice_tau( zutau_ice , zvtau_ice )
79         DO jj = 2, jpjm1
80            DO ji = 2, jpim1
81               utau_ice(ji,jj) = utau_ice(ji,jj) * xcplmask(ji,jj,0) + zutau_ice(ji,jj) * ( 1. - xcplmask(ji,jj,0) )
82               vtau_ice(ji,jj) = vtau_ice(ji,jj) * xcplmask(ji,jj,0) + zvtau_ice(ji,jj) * ( 1. - xcplmask(ji,jj,0) )
83            END DO
84         END DO
85         CALL lbc_lnk_multi( utau_ice, 'U', -1., vtau_ice, 'V', -1. )
86      ENDIF
87
88      IF( nn_timing == 1 )   CALL timing_stop('ice_forcing_tau')
89      !
90   END SUBROUTINE ice_forcing_tau
91
92   
93   SUBROUTINE ice_forcing_flx( kt, ksbc )
94      !!---------------------------------------------------------------------
95      !!                  ***  ROUTINE ice_forcing_flx  ***
96      !!
97      !! ** Purpose : provide surface boundary condition for sea ice (flux)
98      !!
99      !! ** Action  : It provides the following fields used in sea ice model:
100      !!                fr1_i0  , fr2_i0                         = 1sr & 2nd fraction of qsr penetration in ice  [%]
101      !!                emp_oce , emp_ice                        = E-P over ocean and sea ice                    [Kg/m2/s]
102      !!                sprecip                                  = solid precipitation                           [Kg/m2/s]
103      !!                evap_ice                                 = sublimation                                   [Kg/m2/s]
104      !!                qsr_tot , qns_tot                        = solar & non solar heat flux (total)           [W/m2]
105      !!                qsr_ice , qns_ice                        = solar & non solar heat flux over ice          [W/m2]
106      !!                dqns_ice                                 = non solar  heat sensistivity                  [W/m2]
107      !!                qemp_oce, qemp_ice, qprec_ice, qevap_ice = sensible heat (associated with evap & precip) [W/m2]
108      !!            + some fields that are not used outside this module:
109      !!                qla_ice                                  = latent heat flux over ice                     [W/m2]
110      !!                dqla_ice                                 = latent heat sensistivity                      [W/m2]
111      !!                tprecip                                  = total  precipitation                          [Kg/m2/s]
112      !!                alb_ice                                  = albedo above sea ice
113      !!---------------------------------------------------------------------
114      INTEGER, INTENT(in) ::   kt     ! ocean time step
115      INTEGER, INTENT(in) ::   ksbc   ! flux formulation (user defined, bulk or Pure Coupled)
116      !
117      INTEGER  ::   ji, jj, jl                                ! dummy loop index
118      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zalb_os, zalb_cs  ! ice albedo under overcast/clear sky
119      REAL(wp), DIMENSION(jpi,jpj)     ::   zalb              ! 2D workspace
120      !!----------------------------------------------------------------------
121      !
122      IF( nn_timing == 1 )   CALL timing_start('ice_forcing_flx')
123
124      IF( kt == nit000 .AND. lwp ) THEN
125         WRITE(numout,*)
126         WRITE(numout,*)'ice_forcing_flx: Surface boundary condition for sea ice (flux)'
127         WRITE(numout,*)'~~~~~~~~~~~~~~~'
128      ENDIF
129
130      ! --- cloud-sky and overcast-sky ice albedos --- !
131      CALL ice_alb( t_su, ht_i, ht_s, a_ip_frac, h_ip, ln_pnd_rad, zalb_cs, zalb_os )
132
133      ! albedo depends on cloud fraction because of non-linear spectral effects
134!!gm cldf_ice is a real, DOCTOR naming rule: start with cd means CHARACTER passed in argument !
135      alb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:)
136     
137      SELECT CASE( ksbc )      !==  fluxes over sea ice  ==!
138      !
139      CASE( jp_usr )                !--- user defined formulation
140                                CALL usrdef_sbc_ice_flx( kt )
141         !
142      CASE( jp_blk )                !--- bulk formulation
143                                CALL blk_ice_flx( t_su, alb_ice )    !
144         IF( ln_mixcpl      )   CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su )
145         IF( nn_iceflx /= 2 )   CALL ice_flx_dist( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_iceflx )
146         !
147      CASE ( jp_purecpl )           !--- coupled formulation
148                                CALL sbc_cpl_ice_flx( picefr=at_i_b, palbi=alb_ice, psst=sst_m, pist=t_su )
149         IF( nn_iceflx == 2 )   CALL ice_flx_dist( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_iceflx )
150         !
151      END SELECT
152
153      IF( iom_use('icealb') ) THEN    !--- output ice albedo
154         WHERE( at_i_b <= epsi06 )   ;   zalb(:,:) = rn_alb_oce
155         ELSEWHERE                   ;   zalb(:,:) = SUM( alb_ice * a_i_b, dim=3 ) / at_i_b
156         END WHERE
157         CALL iom_put( "icealb" , zalb(:,:) )   ! ice albedo
158      ENDIF
159
160      IF( iom_use('albedo') ) THEN  !--- surface albedo
161         zalb(:,:) = SUM( alb_ice * a_i_b, dim=3 ) + rn_alb_oce * ( 1._wp - at_i_b )
162         CALL iom_put( "albedo" , zalb(:,:) )
163      ENDIF
164      !
165      IF( nn_timing == 1 )   CALL timing_stop('ice_forcing_flx')
166      !
167   END SUBROUTINE ice_forcing_flx
168
169
170   SUBROUTINE ice_flx_dist( ptn_ice, palb_ice, pqns_ice, pqsr_ice, pdqn_ice, pevap_ice, pdevap_ice, k_iceflx )
171      !!---------------------------------------------------------------------
172      !!                  ***  ROUTINE ice_flx_dist  ***
173      !!
174      !! ** Purpose :   update the ice surface boundary condition by averaging
175      !!              and/or redistributing fluxes on ice categories
176      !!
177      !! ** Method  :   average then redistribute
178      !!
179      !! ** Action  :   depends on k_iceflx
180      !!                = -1  Do nothing (needs N(cat) fluxes)
181      !!                =  0  Average N(cat) fluxes then apply the average over the N(cat) ice
182      !!                =  1  Average N(cat) fluxes then redistribute over the N(cat) ice
183      !!                                                 using T-ice and albedo sensitivity
184      !!                =  2  Redistribute a single flux over categories
185      !!---------------------------------------------------------------------
186      INTEGER                   , INTENT(in   ) ::   k_iceflx   ! redistributor
187      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   ptn_ice    ! ice surface temperature
188      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   palb_ice   ! ice albedo
189      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pqns_ice   ! non solar flux
190      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pqsr_ice   ! net solar flux
191      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdqn_ice   ! non solar flux sensitivity
192      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pevap_ice  ! sublimation
193      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdevap_ice ! sublimation sensitivity
194      !
195      INTEGER  ::   jl      ! dummy loop index
196      !
197      REAL(wp), DIMENSION(jpi,jpj) ::   z1_at_i   ! inverse of concentration
198      !
199      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_qsr_m   ! Mean solar heat flux over all categories
200      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_qns_m   ! Mean non solar heat flux over all categories
201      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_evap_m  ! Mean sublimation over all categories
202      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_dqn_m   ! Mean d(qns)/dT over all categories
203      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z_devap_m ! Mean d(evap)/dT over all categories
204      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   zalb_m    ! Mean albedo over all categories
205      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   ztem_m    ! Mean temperature over all categories
206      !!----------------------------------------------------------------------
207      !
208      IF( nn_timing == 1 )  CALL timing_start('ice_flx_dist')
209      !
210      WHERE ( at_i (:,:) > 0._wp )   ; z1_at_i(:,:) = 1._wp / at_i (:,:)
211      ELSEWHERE                      ; z1_at_i(:,:) = 0._wp
212      END WHERE
213     
214      SELECT CASE( k_iceflx )       !==  averaged on all ice categories  ==!
215      !
216      CASE( 0 , 1 )
217         !
218         ALLOCATE( z_qns_m(jpi,jpj), z_qsr_m(jpi,jpj), z_dqn_m(jpi,jpj), z_evap_m(jpi,jpj), z_devap_m(jpi,jpj) ) 
219         !
220         z_qns_m  (:,:) = SUM( a_i(:,:,:) * pqns_ice  (:,:,:) , dim=3 ) * z1_at_i(:,:)
221         z_qsr_m  (:,:) = SUM( a_i(:,:,:) * pqsr_ice  (:,:,:) , dim=3 ) * z1_at_i(:,:)
222         z_dqn_m  (:,:) = SUM( a_i(:,:,:) * pdqn_ice  (:,:,:) , dim=3 ) * z1_at_i(:,:)
223         z_evap_m (:,:) = SUM( a_i(:,:,:) * pevap_ice (:,:,:) , dim=3 ) * z1_at_i(:,:)
224         z_devap_m(:,:) = SUM( a_i(:,:,:) * pdevap_ice(:,:,:) , dim=3 ) * z1_at_i(:,:)
225         DO jl = 1, jpl
226            pqns_ice  (:,:,jl) = z_qns_m (:,:)
227            pqsr_ice  (:,:,jl) = z_qsr_m (:,:)
228            pdqn_ice  (:,:,jl) = z_dqn_m  (:,:)
229            pevap_ice (:,:,jl) = z_evap_m(:,:)
230            pdevap_ice(:,:,jl) = z_devap_m(:,:)
231         END DO
232         !
233         DEALLOCATE( z_qns_m, z_qsr_m, z_dqn_m, z_evap_m, z_devap_m ) 
234         !
235      END SELECT
236      !
237      SELECT CASE( k_iceflx )       !==  redistribution on all ice categories  ==!
238      !
239      CASE( 1 , 2 )
240         !
241         ALLOCATE( zalb_m(jpi,jpj), ztem_m(jpi,jpj) ) 
242         !
243         zalb_m(:,:) = SUM( a_i(:,:,:) * palb_ice(:,:,:) , dim=3 ) * z1_at_i(:,:)
244         ztem_m(:,:) = SUM( a_i(:,:,:) * ptn_ice (:,:,:) , dim=3 ) * z1_at_i(:,:)
245         DO jl = 1, jpl
246            pqns_ice (:,:,jl) = pqns_ice (:,:,jl) + pdqn_ice  (:,:,jl) * ( ptn_ice(:,:,jl) - ztem_m(:,:) )
247            pevap_ice(:,:,jl) = pevap_ice(:,:,jl) + pdevap_ice(:,:,jl) * ( ptn_ice(:,:,jl) - ztem_m(:,:) )
248            pqsr_ice (:,:,jl) = pqsr_ice (:,:,jl) * ( 1._wp - palb_ice(:,:,jl) ) / ( 1._wp - zalb_m(:,:) )
249         END DO
250         !
251         DEALLOCATE( zalb_m, ztem_m ) 
252         !
253      END SELECT
254      !
255      IF( nn_timing == 1 )  CALL timing_stop('ice_flx_dist')
256      !
257   END SUBROUTINE ice_flx_dist
258
259#else
260   !!----------------------------------------------------------------------
261   !!   Default option :         Empty module          NO LIM sea-ice model
262   !!----------------------------------------------------------------------
263#endif
264
265   !!======================================================================
266END MODULE iceforcing
Note: See TracBrowser for help on using the repository browser.