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.
trabbc.F90 in branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/TRA/trabbc.F90 @ 2326

Last change on this file since 2326 was 2325, checked in by cetlod, 14 years ago

Improvment of trabbc.F90 routine ( by gm ) : dynamical allocation + suppression of key_trabbc

  • Property svn:keywords set to Id
File size: 8.1 KB
RevLine 
[3]1MODULE trabbc
2   !!==============================================================================
3   !!                       ***  MODULE  trabbc  ***
[2325]4   !! Ocean active tracers:  bottom boundary condition (geothermal heat flux)
[3]5   !!==============================================================================
[2325]6   !! History :  OPA  ! 1999-10 (G. Madec)  original code
7   !!   NEMO     1.0  ! 2002-08 (G. Madec)  free form + modules
8   !!             -   ! 2002-11 (A. Bozec)  tra_bbc_init: original code
9   !!            3.3  ! 2010-10 (G. Madec)  dynamical allocation + suppression of key_trabbc
[503]10   !!----------------------------------------------------------------------
[2325]11
[3]12   !!   tra_bbc      : update the tracer trend at ocean bottom
13   !!   tra_bbc_init : initialization of geothermal heat flux trend
14   !!----------------------------------------------------------------------
15   USE oce             ! ocean dynamics and active tracers
16   USE dom_oce         ! ocean space and time domain
17   USE phycst          ! physical constants
[2024]18   USE trdmod_oce      ! ocean trends
19   USE trdtra      ! ocean trends
[3]20   USE in_out_manager  ! I/O manager
[258]21   USE prtctl          ! Print control
[3]22
23   IMPLICIT NONE
24   PRIVATE
25
26   PUBLIC tra_bbc          ! routine called by step.F90
[2024]27   PUBLIC tra_bbc_init     ! routine called by opa.F90
[3]28
[2325]29   !                                                !!* Namelist nambbc: bottom boundary condition *
30   LOGICAL, PUBLIC ::   ln_trabbc     = .FALSE.      !: Geothermal heat flux flag
31   INTEGER         ::   nn_geoflx     = 1            !  Geothermal flux (=1:constant flux, =2:read in file )
32   REAL(wp)        ::   rn_geoflx_cst = 86.4e-3_wp   !  Constant value of geothermal heat flux
[3]33
[2325]34   INTEGER , DIMENSION(:,:), ALLOCATABLE ::   nbotlevt   ! ocean bottom level index at T-pt
35   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   qgh_trd0   ! geothermal heating trend
[3]36 
37   !! * Substitutions
38#  include "domzgr_substitute.h90"
39   !!----------------------------------------------------------------------
[2287]40   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
[2325]41   !! $Id $
42   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[3]43   !!----------------------------------------------------------------------
44CONTAINS
45
46   SUBROUTINE tra_bbc( kt )
47      !!----------------------------------------------------------------------
48      !!                  ***  ROUTINE tra_bbc  ***
49      !!
50      !! ** Purpose :   Compute the bottom boundary contition on temperature
[1601]51      !!              associated with geothermal heating and add it to the
52      !!              general trend of temperature equations.
[3]53      !!
54      !! ** Method  :   The geothermal heat flux set to its constant value of
[1601]55      !!              86.4 mW/m2 (Stein and Stein 1992, Huang 1999).
[3]56      !!       The temperature trend associated to this heat flux through the
57      !!       ocean bottom can be computed once and is added to the temperature
58      !!       trend juste above the bottom at each time step:
59      !!            ta = ta + Qsf / (rau0 rcp e3T) for k= mbathy -1
60      !!       Where Qsf is the geothermal heat flux.
61      !!
62      !! ** Action  : - update the temperature trends (ta) with the trend of
63      !!                the ocean bottom boundary condition
64      !!
[503]65      !! References : Stein, C. A., and S. Stein, 1992, Nature, 359, 123-129.
[1601]66      !!              Emile-Geay and Madec, 2009, Ocean Science.
[503]67      !!----------------------------------------------------------------------
[3]68      !!
[503]69      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
70      !!
[2024]71      INTEGER  ::   ji, jj, ik    ! dummy loop indices
[592]72      REAL(wp) ::   zqgh_trd  ! geothermal heat flux trend
[2325]73      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrdt
[3]74      !!----------------------------------------------------------------------
75
[503]76      IF( l_trdtra )   THEN         ! Save ta and sa trends
[2024]77         ALLOCATE( ztrdt(jpi,jpj,jpk) )     ;   ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
[503]78      ENDIF
[3]79
[2325]80      !                             !  Add the geothermal heat flux trend on temperature
[789]81#if defined key_vectopt_loop
[2325]82      DO jj = 1, 1
83         DO ji = jpi+2, jpij-jpi-1   ! vector opt. (forced unrolling)
[3]84#else
[2325]85      DO jj = 2, jpjm1
86         DO ji = 2, jpim1
[1601]87#endif
[2325]88            ik = nbotlevt(ji,jj)
89            zqgh_trd = qgh_trd0(ji,jj) / fse3t(ji,jj,ik)
90            tsa(ji,jj,ik,jp_tem) = tsa(ji,jj,ik,jp_tem) + zqgh_trd
[3]91         END DO
[2325]92      END DO
[106]93
[503]94      IF( l_trdtra ) THEN        ! Save the geothermal heat flux trend for diagnostics
[2024]95         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
96         CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_bbc, ztrdt )
[2325]97         DEALLOCATE( ztrdt )
[3]98      ENDIF
[503]99      !
[2024]100      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' bbc  - Ta: ', mask1=tmask, clinfo3='tra-ta' )
[503]101      !
[3]102   END SUBROUTINE tra_bbc
103
104
105   SUBROUTINE tra_bbc_init
106      !!----------------------------------------------------------------------
107      !!                  ***  ROUTINE tra_bbc_init  ***
108      !!
[1601]109      !! ** Purpose :   Compute once for all the trend associated with geothermal
110      !!              heating that will be applied at each time step at the
111      !!              last ocean level
[3]112      !!
113      !! ** Method  :   Read the nambbc namelist and check the parameters.
114      !!
115      !! ** Input   : - Namlist nambbc
116      !!              - NetCDF file  : geothermal_heating.nc ( if necessary )
117      !!
[592]118      !! ** Action  : - read/fix the geothermal heat qgh_trd0
[3]119      !!              - compute the bottom ocean level nbotlevt
120      !!----------------------------------------------------------------------
[473]121      USE iom
[503]122      !!
[3]123      INTEGER  ::   ji, jj              ! dummy loop indices
[473]124      INTEGER  ::   inum                ! temporary logical unit
[1601]125      !!
[2325]126      NAMELIST/nambbc/ln_trabbc, nn_geoflx, rn_geoflx_cst 
[3]127      !!----------------------------------------------------------------------
128
[503]129      REWIND ( numnam )              ! Read Namelist nambbc : bottom momentum boundary condition
[3]130      READ   ( numnam, nambbc )
131
[2325]132      IF(lwp) THEN                     ! Control print
[1601]133         WRITE(numout,*)
[2325]134         WRITE(numout,*) 'tra_bbc : Bottom Boundary Condition (bbc), apply a Geothermal heating'
[1601]135         WRITE(numout,*) '~~~~~~~   '
136         WRITE(numout,*) '   Namelist nambbc : set bbc parameters'
[2325]137         WRITE(numout,*) '      Apply a geothermal heating at ocean bottom   ln_trabbc     = ', ln_trabbc
138         WRITE(numout,*) '      type of geothermal flux                      nn_geoflx     = ', nn_geoflx
139         WRITE(numout,*) '      Constant geothermal flux value               rn_geoflx_cst = ', rn_geoflx_cst
[1601]140         WRITE(numout,*)
141      ENDIF
[3]142
[2325]143      IF( ln_trabbc ) THEN             !==  geothermal heating  ==!
144         !
145         ALLOCATE( nbotlevt(jpi,jpj) )    ! allocation
146         ALLOCATE( qgh_trd0(jpi,jpj) )     
147         !             
148         DO jj = 1, jpj                   ! level of the ocean bottom at T-point
149            DO ji = 1, jpi
150               nbotlevt(ji,jj) = MAX( mbathy(ji,jj)-1, 1 )
151            END DO
[3]152         END DO
[503]153         !
[2325]154         SELECT CASE ( nn_geoflx )        ! geothermal heat flux / (rauO * Cp)
[503]155         !
[2325]156         CASE ( 1 )                          !* constant flux
157            IF(lwp) WRITE(numout,*) '      *** constant heat flux  =   ', rn_geoflx_cst
158            qgh_trd0(:,:) = ro0cpr * rn_geoflx_cst
159            !
160         CASE ( 2 )                          !* variable geothermal heat flux : read the geothermal fluxes in mW/m2
161            IF(lwp) WRITE(numout,*) '      *** variable geothermal heat flux'
162            CALL iom_open ( 'geothermal_heating.nc', inum )
163            CALL iom_get  ( inum, jpdom_data, 'heatflow', qgh_trd0 )
164            CALL iom_close( inum )
165            qgh_trd0(:,:) = ro0cpr * qgh_trd0(:,:) * 1.e-3     ! conversion in W/m2
166            !
167         CASE DEFAULT
168            WRITE(ctmp1,*) '     bad flag value for nn_geoflx = ', nn_geoflx
169            CALL ctl_stop( ctmp1 )
170            !
171         END SELECT
[503]172         !
[2325]173      ELSE
174            IF(lwp) WRITE(numout,*) '      *** no geothermal heat flux'
175      ENDIF
[1601]176      !
[3]177   END SUBROUTINE tra_bbc_init
178
179   !!======================================================================
180END MODULE trabbc
Note: See TracBrowser for help on using the repository browser.