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