[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 phycst ! physical constants |
---|
[6140] | 15 | ! |
---|
[2396] | 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 |
---|
[2396] | 21 | |
---|
| 22 | IMPLICIT NONE |
---|
| 23 | PRIVATE |
---|
| 24 | |
---|
[8524] | 25 | PUBLIC sbc_apr ! routine called in sbcmod |
---|
| 26 | PUBLIC sbc_apr_init ! routine called in sbcmod |
---|
[2396] | 27 | |
---|
[11204] | 28 | ! !!* namsbc_apr namelist (Atmospheric PRessure) * |
---|
| 29 | LOGICAL, PUBLIC :: ln_apr_obc = .false. !: 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 | !!---------------------------------------------------------------------- |
---|
[10068] | 43 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[5215] | 44 | !! $Id$ |
---|
[10068] | 45 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[2396] | 46 | !!---------------------------------------------------------------------- |
---|
| 47 | CONTAINS |
---|
| 48 | |
---|
[8524] | 49 | SUBROUTINE sbc_apr_init |
---|
[2396] | 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 :: ierror ! local integer |
---|
[4147] | 63 | INTEGER :: ios ! Local integer output status for namelist read |
---|
[2396] | 64 | !! |
---|
| 65 | CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files |
---|
| 66 | TYPE(FLD_N) :: sn_apr ! informations about the fields to be read |
---|
[9367] | 67 | LOGICAL :: lrxios ! read restart using XIOS? |
---|
[2396] | 68 | !! |
---|
[3795] | 69 | NAMELIST/namsbc_apr/ cn_dir, sn_apr, ln_ref_apr, rn_pref, ln_apr_obc |
---|
[2396] | 70 | !!---------------------------------------------------------------------- |
---|
[8524] | 71 | READ ( numnam_ref, namsbc_apr, IOSTAT = ios, ERR = 901) |
---|
[11536] | 72 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in reference namelist' ) |
---|
[8524] | 73 | |
---|
| 74 | READ ( numnam_cfg, namsbc_apr, IOSTAT = ios, ERR = 902 ) |
---|
[11536] | 75 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namsbc_apr in configuration namelist' ) |
---|
[8524] | 76 | IF(lwm) WRITE ( numond, namsbc_apr ) |
---|
[2396] | 77 | ! |
---|
[8524] | 78 | ALLOCATE( sf_apr(1), STAT=ierror ) !* allocate and fill sf_sst (forcing structure) with sn_sst |
---|
| 79 | IF( ierror > 0 ) CALL ctl_stop( 'STOP', 'sbc_apr: unable to allocate sf_apr structure' ) |
---|
| 80 | ! |
---|
| 81 | CALL fld_fill( sf_apr, (/ sn_apr /), cn_dir, 'sbc_apr', 'Atmospheric pressure ', 'namsbc_apr' ) |
---|
[2396] | 82 | ALLOCATE( sf_apr(1)%fnow(jpi,jpj,1) ) |
---|
[8524] | 83 | IF( sn_apr%ln_tint ) ALLOCATE( sf_apr(1)%fdta(jpi,jpj,1,2) ) |
---|
| 84 | ALLOCATE( ssh_ib(jpi,jpj) , ssh_ibb(jpi,jpj) ) |
---|
| 85 | ALLOCATE( apr (jpi,jpj) ) |
---|
| 86 | ! |
---|
| 87 | IF( lwp )THEN !* control print |
---|
| 88 | WRITE(numout,*) |
---|
| 89 | WRITE(numout,*) ' Namelist namsbc_apr : Atmospheric PRessure as extrenal forcing' |
---|
| 90 | WRITE(numout,*) ' ref. pressure: global mean Patm (T) or a constant (F) ln_ref_apr = ', ln_ref_apr |
---|
| 91 | ENDIF |
---|
| 92 | ! |
---|
| 93 | IF( ln_ref_apr ) THEN !* Compute whole inner domain mean masked ocean surface |
---|
[10425] | 94 | tarea = glob_sum( 'sbcapr', e1e2t(:,:) ) |
---|
[8524] | 95 | IF(lwp) WRITE(numout,*) ' Variable ref. Patm computed over a ocean surface of ', tarea*1e-6, 'km2' |
---|
| 96 | ELSE |
---|
| 97 | IF(lwp) WRITE(numout,*) ' Reference Patm used : ', rn_pref, ' N/m2' |
---|
| 98 | ENDIF |
---|
| 99 | ! |
---|
| 100 | r1_grau = 1.e0 / (grav * rau0) !* constant for optimization |
---|
| 101 | ! |
---|
| 102 | ! !* control check |
---|
[12182] | 103 | IF( ln_apr_obc ) THEN |
---|
[8524] | 104 | IF(lwp) WRITE(numout,*) ' Inverse barometer added to OBC ssh data' |
---|
| 105 | ENDIF |
---|
[5930] | 106 | !jc: stop below should rather be a warning |
---|
[8524] | 107 | IF( ln_apr_obc .AND. .NOT.ln_apr_dyn ) & |
---|
| 108 | CALL ctl_warn( 'sbc_apr: use inverse barometer ssh at open boundary ONLY requires ln_apr_dyn=T' ) |
---|
| 109 | ! |
---|
[9367] | 110 | IF( lwxios ) THEN |
---|
| 111 | CALL iom_set_rstw_var_active('ssh_ibb') |
---|
| 112 | ENDIF |
---|
[8524] | 113 | END SUBROUTINE sbc_apr_init |
---|
[2396] | 114 | |
---|
[8524] | 115 | SUBROUTINE sbc_apr( kt ) |
---|
| 116 | !!--------------------------------------------------------------------- |
---|
| 117 | !! *** ROUTINE sbc_apr *** |
---|
| 118 | !! |
---|
| 119 | !! ** Purpose : read atmospheric pressure fields in netcdf files. |
---|
| 120 | !! |
---|
| 121 | !! ** Method : - Read namelist namsbc_apr |
---|
| 122 | !! - Read Patm fields in netcdf files |
---|
| 123 | !! - Compute reference atmospheric pressure |
---|
| 124 | !! - Compute inverse barometer ssh |
---|
| 125 | !! ** action : apr : atmospheric pressure at kt |
---|
| 126 | !! ssh_ib : inverse barometer ssh at kt |
---|
| 127 | !!--------------------------------------------------------------------- |
---|
| 128 | INTEGER, INTENT(in):: kt ! ocean time step |
---|
| 129 | ! |
---|
| 130 | !!---------------------------------------------------------------------- |
---|
| 131 | |
---|
[2396] | 132 | ! ! ========================== ! |
---|
| 133 | IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN ! At each sbc time-step ! |
---|
| 134 | ! ! ===========+++============ ! |
---|
| 135 | ! |
---|
| 136 | IF( kt /= nit000 ) ssh_ibb(:,:) = ssh_ib(:,:) !* Swap of ssh_ib fields |
---|
| 137 | ! |
---|
| 138 | CALL fld_read( kt, nn_fsbc, sf_apr ) !* input Patm provided at kt + nn_fsbc/2 |
---|
| 139 | ! |
---|
| 140 | ! !* update the reference atmospheric pressure (if necessary) |
---|
[10425] | 141 | IF( ln_ref_apr ) rn_pref = glob_sum( 'sbcapr', sf_apr(1)%fnow(:,:,1) * e1e2t(:,:) ) / tarea |
---|
[2396] | 142 | ! |
---|
| 143 | ! !* Patm related forcing at kt |
---|
[3795] | 144 | ssh_ib(:,:) = - ( sf_apr(1)%fnow(:,:,1) - rn_pref ) * r1_grau ! equivalent ssh (inverse barometer) |
---|
[2396] | 145 | apr (:,:) = sf_apr(1)%fnow(:,:,1) ! atmospheric pressure |
---|
| 146 | ! |
---|
| 147 | CALL iom_put( "ssh_ib", ssh_ib ) !* output the inverse barometer ssh |
---|
| 148 | ENDIF |
---|
| 149 | |
---|
| 150 | ! ! ---------------------------------------- ! |
---|
| 151 | IF( kt == nit000 ) THEN ! set the forcing field at nit000 - 1 ! |
---|
| 152 | ! ! ---------------------------------------- ! |
---|
| 153 | ! !* Restart: read in restart file |
---|
| 154 | IF( ln_rstart .AND. iom_varid( numror, 'ssh_ibb', ldstop = .FALSE. ) > 0 ) THEN |
---|
| 155 | IF(lwp) WRITE(numout,*) 'sbc_apr: ssh_ibb read in the restart file' |
---|
[9367] | 156 | CALL iom_get( numror, jpdom_autoglo, 'ssh_ibb', ssh_ibb, ldxios = lrxios ) ! before inv. barometer ssh |
---|
[2396] | 157 | ! |
---|
| 158 | ELSE !* no restart: set from nit000 values |
---|
| 159 | IF(lwp) WRITE(numout,*) 'sbc_apr: ssh_ibb set to nit000 values' |
---|
| 160 | ssh_ibb(:,:) = ssh_ib(:,:) |
---|
| 161 | ENDIF |
---|
| 162 | ENDIF |
---|
| 163 | ! ! ---------------------------------------- ! |
---|
| 164 | IF( lrst_oce ) THEN ! Write in the ocean restart file ! |
---|
| 165 | ! ! ---------------------------------------- ! |
---|
| 166 | IF(lwp) WRITE(numout,*) |
---|
| 167 | IF(lwp) WRITE(numout,*) 'sbc_apr : ssh_ib written in ocean restart file at it= ', kt,' date= ', ndastp |
---|
| 168 | IF(lwp) WRITE(numout,*) '~~~~' |
---|
[9367] | 169 | IF( lwxios ) CALL iom_swap( cwxios_context ) |
---|
| 170 | CALL iom_rstput( kt, nitrst, numrow, 'ssh_ibb' , ssh_ib, ldxios = lwxios ) |
---|
| 171 | IF( lwxios ) CALL iom_swap( cxios_context ) |
---|
[2396] | 172 | ENDIF |
---|
| 173 | ! |
---|
| 174 | END SUBROUTINE sbc_apr |
---|
| 175 | |
---|
| 176 | !!====================================================================== |
---|
| 177 | END MODULE sbcapr |
---|