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.
usrdef_sbc.F90 in NEMO/trunk/tests/BENCH/MY_SRC – NEMO

source: NEMO/trunk/tests/BENCH/MY_SRC/usrdef_sbc.F90

Last change on this file was 14433, checked in by smasson, 3 years ago

trunk: merge dev_r14312_MPI_Interface into the trunk, #2598

File size: 7.1 KB
Line 
1MODULE usrdef_sbc
2   !!======================================================================
3   !!                       ***  MODULE  usrdef_sbc  ***
4   !!
5   !!                      ===  BENCH configuration  ===
6   !!
7   !! User defined :   surface forcing of a user configuration
8   !!======================================================================
9   !! History :  4.0   !
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_sbc    : user defined surface bounday conditions in BENCH case
14   !!----------------------------------------------------------------------
15   USE par_oce        ! ocean space and time domain
16   USE dom_oce       
17   USE oce             ! ocean dynamics and tracers
18   USE sbc_oce         ! Surface boundary condition: ocean fields
19   USE sbc_ice         ! Surface boundary condition: ocean fields
20   USE in_out_manager  ! I/O manager
21   USE phycst          ! physical constants
22   USE lib_mpp         ! MPP library
23   USE lbclnk          ! lateral boundary conditions - mpp exchanges
24
25#if defined key_si3
26   USE ice, ONLY       : at_i_b, a_i_b
27#endif
28
29   IMPLICIT NONE
30   PRIVATE
31
32   PUBLIC   usrdef_sbc_oce      ! routine called by sbcmod.F90 for sbc ocean
33   PUBLIC   usrdef_sbc_ice_tau  ! routine called by icestp.F90 for ice dynamics
34   PUBLIC   usrdef_sbc_ice_flx  ! routine called by icestp.F90 for ice thermo
35
36   !! * Substitutions
37#  include "do_loop_substitute.h90"
38   !!----------------------------------------------------------------------
39   !! NEMO/OPA 4.0 , NEMO Consortium (2016)
40   !! $Id$
41   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
42   !!----------------------------------------------------------------------
43CONTAINS
44
45   SUBROUTINE usrdef_sbc_oce( kt, Kbb )
46      !!---------------------------------------------------------------------
47      !!                    ***  ROUTINE usr_def_sbc  ***
48      !!             
49      !! ** Purpose :   provide at each time-step the surface boundary
50      !!              condition, i.e. the momentum, heat and freshwater fluxes.
51      !!
52      !! ** Method  :   all 0 fields, for BENCH case
53      !!                CAUTION : never mask the surface stress field !
54      !!
55      !! ** Action  : - set to ZERO all the ocean surface boundary condition, i.e.   
56      !!                   utau, vtau, taum, wndm, qns, qsr, emp, sfx
57      !!
58      !!----------------------------------------------------------------------
59      INTEGER, INTENT(in) ::   kt   ! ocean time step
60      INTEGER, INTENT(in) ::   Kbb  ! ocean time index
61      !!---------------------------------------------------------------------
62      !     
63      IF( kt == nit000 ) THEN
64         !
65         IF(lwp) WRITE(numout,*)' usr_sbc : BENCH case: surface forcing'
66         IF(lwp) WRITE(numout,*)' ~~~~~~~~~~~   vtau = taum = wndm = qns = qsr = emp = sfx = 0'
67         !
68         utau(:,:) = 0._wp
69         vtau(:,:) = 0._wp
70         taum(:,:) = 0._wp
71         wndm(:,:) = 0._wp
72         !
73         emp (:,:) = 0._wp
74         sfx (:,:) = 0._wp
75         qns (:,:) = 0._wp
76         qsr (:,:) = 0._wp
77         !
78         utau_b(:,:) = 0._wp 
79         vtau_b(:,:) = 0._wp
80         emp_b (:,:) = 0._wp
81         sfx_b (:,:) = 0._wp
82         qns_b (:,:) = 0._wp
83         !
84      ENDIF
85      !
86   END SUBROUTINE usrdef_sbc_oce
87
88   
89   SUBROUTINE usrdef_sbc_ice_tau( kt )
90      !!---------------------------------------------------------------------
91      !!                     ***  ROUTINE usrdef_sbc_ice_tau  ***
92      !!
93      !! ** Purpose :   provide the surface boundary (momentum) condition over
94      !sea-ice
95      !!---------------------------------------------------------------------
96      INTEGER, INTENT(in) ::   kt   ! ocean time step
97      !
98      REAL(wp) ::   zztmp
99      INTEGER  ::   ji, jj
100      !!---------------------------------------------------------------------
101#if defined key_si3
102      IF( kt==nit000 .AND. lwp)   WRITE(numout,*)' usrdef_sbc_ice : BENCH case: constant stress forcing'
103      !
104      ! define unique value on each point. z2d ranging from 0.05 to -0.05
105      !
106      DO_2D( 0, 0, 0, 0 )
107         zztmp = 0.1 * ( 0.5 - REAL( mig0(ji) + (mjg0(jj)-1) * Ni0glo, wp ) / REAL( Ni0glo * Nj0glo, wp ) )
108         utau_ice(ji,jj) = 0.1_wp + zztmp
109         vtau_ice(ji,jj) = 0.1_wp + zztmp
110      END_2D
111
112      CALL lbc_lnk( 'usrdef_sbc', utau_ice, 'U', -1., vtau_ice, 'V', -1. )
113#endif
114      !
115   END SUBROUTINE usrdef_sbc_ice_tau
116
117   
118   SUBROUTINE usrdef_sbc_ice_flx( kt, phs, phi )
119      !!---------------------------------------------------------------------
120      !!                     ***  ROUTINE usrdef_sbc_ice_flx  ***
121      !!
122      !! ** Purpose :   provide the surface boundary (flux) condition over sea-ice
123      !!---------------------------------------------------------------------
124      INTEGER, INTENT(in) ::   kt   ! ocean time step
125      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phs    ! snow thickness
126      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phi    ! ice thickness
127      !!
128      REAL(wp), DIMENSION(jpi,jpj) ::   zsnw   ! snw distribution after wind blowing
129      !!---------------------------------------------------------------------
130#if defined key_si3
131      !
132      IF( kt==nit000 .AND. lwp)   WRITE(numout,*)' usrdef_sbc_ice : BENCH case: NO flux forcing'
133      !
134      ! ocean variables (renaming)
135      emp_oce (:,:)   = 0._wp   ! uniform value for freshwater budget (E-P)
136      qsr_oce (:,:)   = 0._wp   ! uniform value for     solar radiation
137      qns_oce (:,:)   = 0._wp   ! uniform value for non-solar heat flux
138
139      ! ice variables
140      alb_ice (:,:,:) = 0.7_wp  ! useless
141      qsr_ice (:,:,:) = 0._wp   ! uniform value for     solar radiation
142      qns_ice (:,:,:) = 0._wp   ! uniform value for non-solar heat flux
143      dqns_ice(:,:,:) = 0._wp   ! uniform value for non solar heat flux sensitivity for ice
144      sprecip (:,:)   = 0._wp   ! uniform value for snow precip
145      evap_ice(:,:,:) = 0._wp   ! uniform value for sublimation
146
147      ! ice fields deduced from above
148      zsnw(:,:) = 1._wp
149      !!CALL lim_thd_snwblow( at_i_b, zsnw )  ! snow distribution over ice after wind blowing
150      emp_ice  (:,:)   = SUM( a_i_b(:,:,:) * evap_ice(:,:,:), dim=3 ) - sprecip(:,:) * zsnw(:,:)
151      emp_oce  (:,:)   = emp_oce(:,:) - sprecip(:,:) * (1._wp - zsnw(:,:) )
152      qevap_ice(:,:,:) =   0._wp
153      qprec_ice(:,:)   =   rhos * ( sst_m(:,:) * rcpi - rLfus ) * tmask(:,:,1) !  in J/m3
154      qemp_oce (:,:)   = - emp_oce(:,:) * sst_m(:,:) * rcp
155      qemp_ice (:,:)   =   sprecip(:,:) * zsnw * ( sst_m(:,:) * rcpi - rLfus ) * tmask(:,:,1) ! solid precip (only)
156
157      ! total fluxes
158      emp_tot (:,:) = emp_ice  + emp_oce
159      qns_tot (:,:) = at_i_b(:,:) * qns_oce(:,:) + SUM( a_i_b(:,:,:) * qns_ice(:,:,:), dim=3 ) + qemp_ice(:,:) + qemp_oce(:,:)
160      qsr_tot (:,:) = at_i_b(:,:) * qsr_oce(:,:) + SUM( a_i_b(:,:,:) * qsr_ice(:,:,:), dim=3 )
161
162      ! --- shortwave radiation transmitted thru the surface scattering layer (W/m2) --- !
163      qtr_ice_top(:,:,:) = 0._wp
164#endif
165
166   END SUBROUTINE usrdef_sbc_ice_flx
167
168   !!======================================================================
169END MODULE usrdef_sbc
Note: See TracBrowser for help on using the repository browser.