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/SWG/MY_SRC – NEMO

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

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

trunk: SWE passes sette tests in debug

File size: 5.1 KB
RevLine 
[13503]1MODULE usrdef_sbc
2   !!======================================================================
3   !!                     ***  MODULE  usrdef_sbc  ***
4   !!
[13752]5   !!                     ===  SWG configuration  ===
[13503]6   !!
7   !! User defined :   surface forcing of a user configuration
8   !!======================================================================
[13599]9   !! History :  4.0  ! 2016-03  (S. Flavoni, G. Madec)  user defined interface
10   !!             -   ! 2020-03  (A. Nasser) Shallow Water Eq. configuration
[13503]11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   usrdef_sbc    : user defined surface bounday conditions in GYRE case
15   !!----------------------------------------------------------------------
16   USE oce            ! ocean dynamics and tracers
17   USE dom_oce        ! ocean space and time domain
18   USE sbc_oce        ! Surface boundary condition: ocean fields
19   USE phycst         ! physical constants
20   USE usrdef_nam
21   !
22   USE in_out_manager ! I/O manager
23   USE lib_mpp        ! distribued memory computing library
24   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
[13599]25   USE lib_fortran    ! Fortran library
[13503]26
27   IMPLICIT NONE
28   PRIVATE
29
30   PUBLIC   usrdef_sbc_oce       ! routine called in sbcmod module
31   PUBLIC   usrdef_sbc_ice_tau   ! routine called by icestp.F90 for ice dynamics
32   PUBLIC   usrdef_sbc_ice_flx   ! routine called by icestp.F90 for ice thermo
33     
[15033]34   !! * Substitutions
35#  include "do_loop_substitute.h90"
[13503]36   !!----------------------------------------------------------------------
37   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
38   !! $Id: usrdef_sbc.F90 10425 2018-12-19 21:54:16Z smasson $
39   !! Software governed by the CeCILL license (see ./LICENSE)
40   !!----------------------------------------------------------------------
41CONTAINS
42
43   SUBROUTINE usrdef_sbc_oce( kt, Kbb )
44      !!---------------------------------------------------------------------
[13599]45      !!                    ***  ROUTINE usrdef_sbc_oce  ***
[13503]46      !!             
47      !! ** Purpose :   provide at each time-step the GYRE surface boundary
48      !!              condition, i.e. the momentum, heat and freshwater fluxes.
49      !!
50      !! ** Method  :   analytical seasonal cycle for GYRE configuration.
51      !!                CAUTION : never mask the surface stress field !
52      !!
53      !! ** Action  : - set the ocean surface boundary condition, i.e.   
54      !!                   utau, vtau, taum, wndm, qns, qsr, emp, sfx
55      !!
56      !!----------------------------------------------------------------------
57      INTEGER, INTENT(in) ::   kt   ! ocean time step
58      INTEGER, INTENT(in) ::   Kbb  ! ocean time index
59      !!
60      INTEGER  ::   ji, jj                ! dummy loop indices
61      REAL(wp) ::   ztauu, ztauv          ! wind intensity projeted
62      REAL(wp) ::   zrhoa  = 1.22         ! Air density kg/m3
63      REAL(wp) ::   zcdrag = 1.5e-3       ! drag coefficient
64      REAL(wp) ::   ztx, zty, zmod, zcoef ! temporary variables
65      !!---------------------------------------------------------------------
66
67      ! ---------------------------- !
68      !  heat and freshwater fluxes  !   (no fluxes)
69      ! ---------------------------- !
70     
71      emp (:,:) = 0._wp
72      sfx (:,:) = 0._wp
73      qns (:,:) = 0._wp
[15136]74      qsr (:,:) = 0._wp
[13503]75
76      ! ---------------------------- !
77      !       momentum fluxes        !
78      ! ---------------------------- !
79      ! rotated case (45deg)
80      ! ztauu = 0.2_wp / SQRT( 2._wp )    ! N.m-2
81      ! ztauv = 0.2_wp / SQRT( 2._wp)     ! N.m-2
82      ! non rotated
83      !ztauu = 0.2_wp                    ! N.m-2
84      !ztauv = 0._wp                     ! N.m-2
85      ! general case
86      ztauu =   REAL( rn_tau, wp ) * COS( rn_theta * rad )   ! N.m-2
87      ztauv = - REAL( rn_tau, wp ) * SIN( rn_theta * rad )   ! N.m-2
88     
[15033]89      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
90         ! length of the domain : 2000km x 2000km
91         utau(ji,jj) = - ztauu * COS( rpi * gphiu(ji,jj) / 2000000._wp)
92         vtau(ji,jj) = - ztauv * COS( rpi * gphiv(ji,jj) / 2000000._wp)
93      END_2D
94     
[13503]95      ! module of wind stress and wind speed at T-point
96      zcoef = 1. / ( zrhoa * zcdrag ) 
[15033]97      DO_2D( 0, 0, 0, 0 )
98         ztx = utau(ji-1,jj  ) + utau(ji,jj) 
99         zty = vtau(ji  ,jj-1) + vtau(ji,jj) 
100         zmod = 0.5 * SQRT( ztx * ztx + zty * zty )
101         taum(ji,jj) = zmod
102         wndm(ji,jj) = SQRT( zmod * zcoef )
103      END_2D
[14433]104      CALL lbc_lnk( 'usrdef_sbc', taum(:,:), 'T', 1. , wndm(:,:), 'T', 1. )
[13503]105      !
106   END SUBROUTINE usrdef_sbc_oce
107
108
109   SUBROUTINE usrdef_sbc_ice_tau( kt )
110      INTEGER, INTENT(in) ::   kt   ! ocean time step
111   END SUBROUTINE usrdef_sbc_ice_tau
112
113
114   SUBROUTINE usrdef_sbc_ice_flx( kt, phs, phi )
115      INTEGER, INTENT(in) ::   kt   ! ocean time step
116      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phs    ! snow thickness
117      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   phi    ! ice thickness
118   END SUBROUTINE usrdef_sbc_ice_flx
119
120   !!======================================================================
121END MODULE usrdef_sbc
Note: See TracBrowser for help on using the repository browser.