[888] | 1 | MODULE sbcfwb |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE sbcfwb *** |
---|
| 4 | !! Ocean fluxes : domain averaged freshwater budget |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : 8.2 ! 01-02 (E. Durand) Original code |
---|
| 7 | !! 8.5 ! 02-06 (G. Madec) F90: Free form and module |
---|
| 8 | !! 9.0 ! 06-08 (G. Madec) Surface module |
---|
| 9 | !!---------------------------------------------------------------------- |
---|
| 10 | |
---|
| 11 | !!---------------------------------------------------------------------- |
---|
| 12 | !! sbc_fwb : freshwater budget for global ocean configurations |
---|
| 13 | !! in free surface and forced mode |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
| 15 | USE oce ! ocean dynamics and tracers |
---|
| 16 | USE dom_oce ! ocean space and time domain |
---|
| 17 | USE sbc_oce ! surface ocean boundary condition |
---|
| 18 | USE cpl_oce ! coupled atmosphere/ocean |
---|
| 19 | USE phycst ! physical constants |
---|
| 20 | USE sbcrnf ! ocean runoffs |
---|
| 21 | USE daymod ! calendar |
---|
| 22 | USE in_out_manager ! I/O manager |
---|
| 23 | USE lib_mpp ! distribued memory computing library |
---|
| 24 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | PRIVATE |
---|
| 27 | |
---|
| 28 | PUBLIC sbc_fwb ! routine called by step |
---|
| 29 | |
---|
| 30 | REAL(wp) :: a_fwb_b ! annual domain averaged freshwater budget |
---|
| 31 | REAL(wp) :: a_fwb ! for 2 year before (_b) and before year. |
---|
| 32 | REAL(wp) :: empold ! empold to be suppressed |
---|
| 33 | REAL(wp) :: area ! global mean ocean surface (interior domain) |
---|
| 34 | |
---|
| 35 | REAL(wp), DIMENSION(jpi,jpj) :: e1e2_i ! area of the interior domain (e1t*e2t*tmask_i) |
---|
| 36 | |
---|
| 37 | !! * Substitutions |
---|
| 38 | # include "domzgr_substitute.h90" |
---|
| 39 | # include "vectopt_loop_substitute.h90" |
---|
| 40 | !!---------------------------------------------------------------------- |
---|
| 41 | !! OPA 9.0 , LOCEAN-IPSL (2006) |
---|
| 42 | !! $ Id: $ |
---|
| 43 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
| 44 | !!---------------------------------------------------------------------- |
---|
| 45 | CONTAINS |
---|
| 46 | |
---|
| 47 | SUBROUTINE sbc_fwb( kt, kn_fwb, kn_fsbc ) |
---|
| 48 | !!--------------------------------------------------------------------- |
---|
| 49 | !! *** ROUTINE sbc_fwb *** |
---|
| 50 | !! |
---|
| 51 | !! ** Purpose : Control the mean sea surface drift |
---|
| 52 | !! |
---|
| 53 | !! ** Method : several ways depending on kn_fwb |
---|
| 54 | !! =0 no control |
---|
| 55 | !! =1 annual global mean corrected from previous year |
---|
| 56 | !! =2 global mean of emp set to zero at each nn_fsbc time step |
---|
| 57 | !!---------------------------------------------------------------------- |
---|
| 58 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 59 | INTEGER, INTENT( in ) :: kn_fsbc ! |
---|
| 60 | INTEGER, INTENT( in ) :: kn_fwb ! ocean time-step index |
---|
| 61 | !! |
---|
[895] | 62 | INTEGER :: inum ! temporary logical unit |
---|
[888] | 63 | INTEGER :: ikty, iyear ! |
---|
| 64 | LOGICAL :: llbon |
---|
[895] | 65 | CHARACTER (len=32) :: clname |
---|
[888] | 66 | REAL(wp) :: z_emp ! temporary scalars |
---|
| 67 | !!---------------------------------------------------------------------- |
---|
| 68 | ! |
---|
| 69 | IF( kt == nit000 ) THEN |
---|
| 70 | ! |
---|
| 71 | IF(lwp) THEN |
---|
| 72 | WRITE(numout,*) |
---|
| 73 | WRITE(numout,*) 'sbc_fwb : FreshWater Budget correction' |
---|
| 74 | WRITE(numout,*) '~~~~~~~' |
---|
| 75 | IF( kn_fwb == 1 ) WRITE(numout,*) ' instantaneously set to zero' |
---|
| 76 | IF( kn_fwb == 2 ) WRITE(numout,*) ' adjusted from previous year budget' |
---|
| 77 | ENDIF |
---|
| 78 | ! |
---|
| 79 | e1e2_i(:,:) = e1t(:,:) * e2t(:,:) * tmask_i(:,:) |
---|
| 80 | area = SUM( e1e2_i(:,:) ) |
---|
| 81 | IF( lk_mpp ) CALL mpp_sum( area ) ! sum over the global domain |
---|
| 82 | ! |
---|
| 83 | ENDIF |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | SELECT CASE ( kn_fwb ) |
---|
| 87 | ! |
---|
| 88 | CASE ( 1 ) ! global mean emp set to zero |
---|
| 89 | IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN |
---|
| 90 | z_emp = SUM( e1e2_i(:,:) * emp(:,:) ) / area |
---|
| 91 | IF( lk_mpp ) CALL mpp_sum( z_emp ) ! sum over the global domain |
---|
| 92 | emp (:,:) = emp (:,:) - z_emp |
---|
| 93 | emps(:,:) = emps(:,:) - z_emp |
---|
| 94 | ENDIF |
---|
| 95 | ! |
---|
| 96 | CASE ( 2 ) ! emp budget adjusted from the previous year |
---|
| 97 | ! initialisation |
---|
| 98 | IF( kt == nit000 ) THEN |
---|
| 99 | ! Read the corrective factor on precipitations (empold) |
---|
[895] | 100 | clname = 'EMPave_old.dat' |
---|
| 101 | CALL ctlopn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', & |
---|
| 102 | & 1, numout, .FALSE., 1 ) |
---|
| 103 | |
---|
| 104 | READ ( inum, "(24X,I8,2ES24.16)" ) iyear, a_fwb_b, a_fwb |
---|
| 105 | CLOSE( inum ) |
---|
| 106 | empold = a_fwb ! current year freshwater budget correction |
---|
| 107 | ! ! estimate from the previous year budget |
---|
| 108 | IF(lwp)WRITE(numout,*) |
---|
| 109 | IF(lwp)WRITE(numout,*)'sbc_fwb : year = ',iyear , ' freshwater budget correction = ', empold |
---|
| 110 | IF(lwp)WRITE(numout,*)' year = ',iyear-1, ' freshwater budget read = ', a_fwb |
---|
| 111 | IF(lwp)WRITE(numout,*)' year = ',iyear-2, ' freshwater budget read = ', a_fwb_b |
---|
| 112 | ENDIF |
---|
[888] | 113 | ! |
---|
| 114 | ! Update empold if new year start |
---|
| 115 | ikty = 365 * 86400 / rdttra(1) !!bug use of 365 days leap year or 360d year !!!!!!! |
---|
| 116 | IF( MOD( kt, ikty ) == 0 ) THEN |
---|
| 117 | a_fwb_b = a_fwb |
---|
| 118 | a_fwb = SUM( e1e2_i(:,:) * sshn(:,:) ) |
---|
| 119 | IF( lk_mpp ) CALL mpp_sum( a_fwb ) ! sum over the global domain |
---|
| 120 | a_fwb = a_fwb * 1.e+3 / ( area * 86400. * 365. ) ! convert in Kg/m3/s = mm/s |
---|
| 121 | !!gm ! !!bug 365d year |
---|
| 122 | empold = a_fwb ! current year freshwater budget correction |
---|
| 123 | ! ! estimate from the previous year budget |
---|
| 124 | ENDIF |
---|
| 125 | ! |
---|
| 126 | ! correct the freshwater fluxes |
---|
| 127 | IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN |
---|
| 128 | emp (:,:) = emp (:,:) - empold |
---|
| 129 | emps(:,:) = emps(:,:) - empold |
---|
| 130 | ENDIF |
---|
| 131 | ! |
---|
| 132 | ! save empold value in a file |
---|
[895] | 133 | IF( kt == nitend .AND. lwp ) THEN |
---|
| 134 | clname = 'EMPav.dat' |
---|
| 135 | CALL ctlopn( inum, clname, 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', & |
---|
| 136 | & 1, numout, .FALSE., 0 ) |
---|
[888] | 137 | WRITE(inum, "(24X,I8,2ES24.16)" ) nyear, a_fwb_b, a_fwb |
---|
| 138 | ENDIF |
---|
| 139 | ! |
---|
| 140 | CASE DEFAULT ! you should never be there |
---|
| 141 | WRITE(ctmp1,*)'sbc_fwb : nn_fwb = ', kn_fwb, ' is not permitted for the FreshWater Budget correction, choose either 0/1/2' |
---|
| 142 | CALL ctl_stop( ctmp1 ) |
---|
| 143 | ! |
---|
| 144 | END SELECT |
---|
| 145 | ! |
---|
| 146 | END SUBROUTINE sbc_fwb |
---|
| 147 | |
---|
| 148 | !!====================================================================== |
---|
| 149 | END MODULE sbcfwb |
---|