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.
sbchfp.F90 in branches/UKMO/dev_r5518_flux_correction/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/UKMO/dev_r5518_flux_correction/NEMOGCM/NEMO/OPA_SRC/SBC/sbchfp.F90

Last change on this file was 8897, checked in by davestorkey, 7 years ago

UKMO/dev_r5518_flux_correction branch: update formulation.

File size: 5.9 KB
Line 
1MODULE sbchfp
2   !!======================================================================
3   !!                       ***  MODULE  sbchfp ***
4   !! Surface module :  apply perturbation term to surface heat flux (qns)
5   !!======================================================================
6   !! History :  3.6  !  2017-12  (D. Storkey)  Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   sbc_hfp       : add perturbation term to qns
11   !!   sbc_hfp_init  : initialisation of heat flux perturbation field
12   !!----------------------------------------------------------------------
13   USE oce            ! ocean dynamics and tracers
14   USE dom_oce        ! ocean space and time domain
15   USE sbc_oce        ! surface boundary condition
16   USE phycst         ! physical constants
17   !
18   USE fldread        ! read input fields
19   USE iom            ! I/O manager
20   USE in_out_manager ! I/O manager
21   USE lib_mpp        ! distribued memory computing library
22   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
23   USE timing         ! Timing
24   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
25   USE wrk_nemo       ! work arrays
26
27   IMPLICIT NONE
28   PRIVATE
29
30   PUBLIC   sbc_hfp        ! routine called in sbcmod
31   PUBLIC   sbc_hfp_init   ! routine called in sbcmod
32
33!!$   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   erp   !: evaporation damping   [kg/m2/s]
34!!$   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qrp   !: heat flux damping        [w/m2]
35
36   !                                   !!* Namelist namsbc_hfp *
37   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_hfp   ! structure of input heat flux perturbation (file informations, fields read)
38
39   !! * Substitutions
40#  include "domzgr_substitute.h90"
41   !!----------------------------------------------------------------------
42   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
43   !! $Id$
44   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
45   !!----------------------------------------------------------------------
46CONTAINS
47
48   SUBROUTINE sbc_hfp( kt )
49      !!---------------------------------------------------------------------
50      !!                     ***  ROUTINE sbc_hfp  ***
51      !!
52      !! ** Purpose :   Add perturbation term to qns
53      !!
54      !! ** Method  :
55      !!             
56      !!---------------------------------------------------------------------
57      INTEGER, INTENT(in   ) ::   kt   ! ocean time step
58      !!
59      INTEGER  ::   ierror   ! return error code
60      REAL(wp), POINTER, DIMENSION(:,:) ::   zqcorr ! 2D workspace
61      !!----------------------------------------------------------------------
62      !
63      IF( nn_timing == 1 )  CALL timing_start('sbc_hfp')
64      !
65      CALL wrk_alloc( jpi, jpj, zqcorr )
66      !
67      CALL fld_read( kt, nn_fsbc, sf_hfp )   ! Read in heat flux perturbation and provide it at kt
68      !
69      !                                         ! ========================= !
70      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN      !   Add perturbation term   !
71         !                                      ! ========================= !
72         !
73         zqcorr(:,:) = sf_hfp(1)%fnow(:,:,1)
74         WHERE( fr_i(:,:) > 0 .and. fr_i(:,:) < 0.5 ) 
75            zqcorr(:,:) = zqcorr(:,:) * ( 1.0 - 2.0 * fr_i(:,:) )
76         ENDWHERE
77         WHERE( fr_i(:,:) >= 0.5 ) 
78            zqcorr(:,:) = 0.0
79         ENDWHERE
80         qns(:,:) = ( qns(:,:) - zqcorr(:,:) ) * tmask(:,:,1)
81         !
82         CALL iom_put( "qcorr_oce",   zqcorr )       ! perturbation to downward heat flux over the ocean
83      ENDIF         
84      !
85      IF( nn_timing == 1 )  CALL timing_stop('sbc_hfp')
86      !
87   END SUBROUTINE sbc_hfp
88
89 
90   SUBROUTINE sbc_hfp_init
91      !!---------------------------------------------------------------------
92      !!                  ***  ROUTINE sbc_hfp_init  ***
93      !!
94      !! ** Purpose :   initialisation of heat flux perturbation
95      !!
96      !! ** Method  : - Read namelist namsbc_hfp
97      !!              - Initialise heat flux perturbation field (to be read from file)
98      !!---------------------------------------------------------------------
99      INTEGER  ::   ierror   ! return error code
100      !!
101      CHARACTER(len=100) ::  cn_dir          ! Root directory for location of ssr files
102      TYPE(FLD_N) ::   sn_hfp            ! informations about the fields to be read
103      NAMELIST/namsbc_hfp/ cn_dir, sn_hfp
104      INTEGER     ::  ios
105      !!----------------------------------------------------------------------
106      !
107 
108      REWIND( numnam_ref )              ! Namelist namsbc_hfp in reference namelist :
109      READ  ( numnam_ref, namsbc_hfp, IOSTAT = ios, ERR = 901)
110901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_hfp in reference namelist', lwp )
111
112      REWIND( numnam_cfg )              ! Namelist namsbc_hfp in configuration namelist :
113      READ  ( numnam_cfg, namsbc_hfp, IOSTAT = ios, ERR = 902 )
114902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_hfp in configuration namelist', lwp )
115      IF(lwm) WRITE ( numond, namsbc_hfp )
116
117      !* set sf_hfp structure & allocate arrays
118      !
119      ALLOCATE( sf_hfp(1), STAT=ierror )
120      IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_hfp: unable to allocate sf_hfp structure' )
121      ALLOCATE( sf_hfp(1)%fnow(jpi,jpj,1), STAT=ierror )
122      IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_hfp: unable to allocate sf_sst now array' )
123      !
124      ! fill sf_hfp with sn_hfp and control print
125      CALL fld_fill( sf_hfp, (/ sn_hfp /), cn_dir, 'sbc_hfp', 'heat flux perturbation', 'namsbc_hfp' )
126      IF( sf_hfp(1)%ln_tint )   ALLOCATE( sf_hfp(1)%fdta(jpi,jpj,1,2), STAT=ierror )
127      IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_hfp: unable to allocate sf_hfp data array' )
128      !
129      !
130   END SUBROUTINE sbc_hfp_init
131     
132   !!======================================================================
133END MODULE sbchfp
Note: See TracBrowser for help on using the repository browser.