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

source: branches/UKMO/r5518_sst_landsea_cpl/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90 @ 7147

Last change on this file since 7147 was 7147, checked in by jcastill, 7 years ago

Remove svn keywords

File size: 8.8 KB
Line 
1MODULE sbcapr
2   !!======================================================================
3   !!                       ***  MODULE  sbcapr  ***
4   !! Surface module :   atmospheric pressure forcing
5   !!======================================================================
6   !! History :  3.3  !   2010-09  (J. Chanut, C. Bricaud, G. Madec)  Original code
7   !!----------------------------------------------------------------------
8   
9   !!----------------------------------------------------------------------
10   !!   sbc_apr        : read atmospheric pressure in netcdf files
11   !!----------------------------------------------------------------------
12   USE dom_oce         ! ocean space and time domain
13   USE sbc_oce         ! surface boundary condition
14   USE phycst          ! physical constants
15   USE fldread         ! read input fields
16   USE in_out_manager  ! I/O manager
17   USE lib_fortran     ! distribued memory computing library
18   USE iom             ! IOM library
19   USE lib_mpp         ! MPP library
20
21   IMPLICIT NONE
22   PRIVATE
23
24   PUBLIC   sbc_apr    ! routine called in sbcmod
25   
26   !                                !!* namsbc_apr namelist (Atmospheric PRessure) *
27   LOGICAL, PUBLIC ::   ln_apr_obc   !: inverse barometer added to OBC ssh data
28   LOGICAL, PUBLIC ::   ln_ref_apr   !: ref. pressure: global mean Patm (F) or a constant (F)
29   REAL(wp)        ::   rn_pref      !  reference atmospheric pressure   [N/m2]
30
31   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:) ::   ssh_ib    ! Inverse barometer now    sea surface height   [m]
32   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:) ::   ssh_ibb   ! Inverse barometer before sea surface height   [m]
33   REAL(wp), ALLOCATABLE, SAVE, PUBLIC, DIMENSION(:,:) ::   apr       ! atmospheric pressure at kt                 [N/m2]
34   
35   REAL(wp) ::   tarea                ! whole domain mean masked ocean surface
36   REAL(wp) ::   r1_grau              ! = 1.e0 / (grav * rau0)
37   
38   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_apr   ! structure of input fields (file informations, fields read)
39
40   !! * Substitutions
41#  include "domzgr_substitute.h90"
42   !!----------------------------------------------------------------------
43   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
44   !! $Id$
45   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
46   !!----------------------------------------------------------------------
47CONTAINS
48
49   SUBROUTINE sbc_apr( kt )
50      !!---------------------------------------------------------------------
51      !!                     ***  ROUTINE sbc_apr  ***
52      !!
53      !! ** Purpose :   read atmospheric pressure fields in netcdf files.
54      !!
55      !! ** Method  : - Read namelist namsbc_apr
56      !!              - Read Patm fields in netcdf files
57      !!              - Compute reference atmospheric pressure
58      !!              - Compute inverse barometer ssh
59      !! ** action  :   apr      : atmospheric pressure at kt
60      !!                ssh_ib   : inverse barometer ssh at kt
61      !!---------------------------------------------------------------------
62      INTEGER, INTENT(in)::   kt   ! ocean time step
63      !
64      INTEGER            ::   ierror  ! local integer
65      INTEGER            ::   ios     ! Local integer output status for namelist read
66      !!
67      CHARACTER(len=100) ::  cn_dir   ! Root directory for location of ssr files
68      TYPE(FLD_N)        ::  sn_apr   ! informations about the fields to be read
69      !!
70      NAMELIST/namsbc_apr/ cn_dir, sn_apr, ln_ref_apr, rn_pref, ln_apr_obc
71      !!----------------------------------------------------------------------
72      !
73      !                                         ! -------------------- !
74      IF( kt == nit000 ) THEN                   ! First call kt=nit000 !
75         !                                      ! -------------------- !
76         REWIND( numnam_ref )              ! Namelist namsbc_apr in reference namelist : File for atmospheric pressure forcing
77         READ  ( numnam_ref, namsbc_apr, IOSTAT = ios, ERR = 901)
78901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in reference namelist', lwp )
79
80         REWIND( numnam_cfg )              ! Namelist namsbc_apr in configuration namelist : File for atmospheric pressure forcing
81         READ  ( numnam_cfg, namsbc_apr, IOSTAT = ios, ERR = 902 )
82902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in configuration namelist', lwp )
83         IF(lwm) WRITE ( numond, namsbc_apr )
84         !
85         ALLOCATE( sf_apr(1), STAT=ierror )           !* allocate and fill sf_sst (forcing structure) with sn_sst
86         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_apr: unable to allocate sf_apr structure' )
87         !
88         CALL fld_fill( sf_apr, (/ sn_apr /), cn_dir, 'sbc_apr', 'Atmospheric pressure ', 'namsbc_apr' )
89                                ALLOCATE( sf_apr(1)%fnow(jpi,jpj,1)   )
90         IF( sn_apr%ln_tint )   ALLOCATE( sf_apr(1)%fdta(jpi,jpj,1,2) )
91                                ALLOCATE( ssh_ib(jpi,jpj) , ssh_ibb(jpi,jpj) )
92                                ALLOCATE( apr (jpi,jpj) )
93         !
94         IF(lwp) THEN                                 !* control print
95            WRITE(numout,*)
96            WRITE(numout,*) '   Namelist namsbc_apr : Atmospheric PRessure as extrenal forcing'
97            WRITE(numout,*) '      ref. pressure: global mean Patm (T) or a constant (F)  ln_ref_apr = ', ln_ref_apr
98         ENDIF
99         !
100         IF( ln_ref_apr ) THEN                        !* Compute whole inner domain mean masked ocean surface
101            tarea = glob_sum( e1e2t(:,:) )
102            IF(lwp) WRITE(numout,*) '         Variable ref. Patm computed over a ocean surface of ', tarea*1e-6, 'km2'
103         ELSE
104            IF(lwp) WRITE(numout,*) '         Reference Patm used : ', rn_pref, ' N/m2'
105         ENDIF
106         !
107         r1_grau = 1.e0 / (grav * rau0)               !* constant for optimization
108         !
109         !                                            !* control check
110         IF ( ln_apr_obc  ) THEN
111            IF(lwp) WRITE(numout,*) '         Inverse barometer added to OBC ssh data'
112         ENDIF
113!jc: stop below should rather be a warning
114         IF( ( ln_apr_obc ) .AND. .NOT. ln_apr_dyn   )   &
115            CALL ctl_stop( 'sbc_apr: use inverse barometer ssh at open boundary ONLY requires ln_apr_dyn=T' )
116      ENDIF
117
118      !                                         ! ========================== !
119      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN      !    At each sbc time-step   !
120         !                                      ! ===========+++============ !
121         !
122         IF( kt /= nit000 )   ssh_ibb(:,:) = ssh_ib(:,:)    !* Swap of ssh_ib fields
123         !
124         CALL fld_read( kt, nn_fsbc, sf_apr )               !* input Patm provided at kt + nn_fsbc/2
125         !
126         !                                                  !* update the reference atmospheric pressure (if necessary)
127         IF( ln_ref_apr )   rn_pref = glob_sum( sf_apr(1)%fnow(:,:,1) * e1e2t(:,:) ) / tarea
128         !
129         !                                                  !* Patm related forcing at kt
130         ssh_ib(:,:) = - ( sf_apr(1)%fnow(:,:,1) - rn_pref ) * r1_grau    ! equivalent ssh (inverse barometer)
131         apr   (:,:) =     sf_apr(1)%fnow(:,:,1)                        ! atmospheric pressure
132         !
133         CALL iom_put( "ssh_ib", ssh_ib )                   !* output the inverse barometer ssh
134      ENDIF
135
136      !                                         ! ---------------------------------------- !
137      IF( kt == nit000 ) THEN                   !   set the forcing field at nit000 - 1    !
138         !                                      ! ---------------------------------------- !
139         !                                            !* Restart: read in restart file
140         IF( ln_rstart .AND. iom_varid( numror, 'ssh_ibb', ldstop = .FALSE. ) > 0 ) THEN
141            IF(lwp) WRITE(numout,*) 'sbc_apr:   ssh_ibb read in the restart file'
142            CALL iom_get( numror, jpdom_autoglo, 'ssh_ibb', ssh_ibb )   ! before inv. barometer ssh
143            !
144         ELSE                                         !* no restart: set from nit000 values
145            IF(lwp) WRITE(numout,*) 'sbc_apr:   ssh_ibb set to nit000 values'
146            ssh_ibb(:,:) = ssh_ib(:,:)
147         ENDIF
148      ENDIF
149      !                                         ! ---------------------------------------- !
150      IF( lrst_oce ) THEN                       !      Write in the ocean restart file     !
151         !                                      ! ---------------------------------------- !
152         IF(lwp) WRITE(numout,*)
153         IF(lwp) WRITE(numout,*) 'sbc_apr : ssh_ib written in ocean restart file at it= ', kt,' date= ', ndastp
154         IF(lwp) WRITE(numout,*) '~~~~'
155         CALL iom_rstput( kt, nitrst, numrow, 'ssh_ibb' , ssh_ib )
156      ENDIF
157      !
158   END SUBROUTINE sbc_apr
159     
160   !!======================================================================
161END MODULE sbcapr
Note: See TracBrowser for help on using the repository browser.