1 | MODULE diahsb |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE diahsb *** |
---|
4 | !! Ocean diagnostics: Heat salt and volume budgets |
---|
5 | !!====================================================================== |
---|
6 | !! History : NEMO 3.3 ! 2010-09 (M. Leclair) Original code |
---|
7 | !!---------------------------------------------------------------------- |
---|
8 | !! * Modules used |
---|
9 | USE oce ! ocean dynamics and tracers |
---|
10 | USE dom_oce ! ocean space and time domain |
---|
11 | USE phycst ! physical constants |
---|
12 | USE sbc_oce ! surface thermohaline fluxes |
---|
13 | USE in_out_manager ! I/O manager |
---|
14 | USE domvvl ! vertical scale factors |
---|
15 | USE traqsr ! penetrative solar radiation |
---|
16 | USE lib_mpp ! distributed memory computing library |
---|
17 | USE trabbc ! bottom boundary condition |
---|
18 | USE bdy_par ! (for lk_bdy) |
---|
19 | USE obc_par ! (for lk_obc) |
---|
20 | |
---|
21 | IMPLICIT NONE |
---|
22 | PRIVATE |
---|
23 | |
---|
24 | !! * Routine accessibility |
---|
25 | PUBLIC dia_hsb ! routine called by step.F90 |
---|
26 | |
---|
27 | |
---|
28 | !! * Module variables |
---|
29 | INTEGER :: num ! |
---|
30 | REAL(dp) :: surf_tot , vol_tot ! |
---|
31 | REAL(dp) :: frc_t , frc_s , frc_v ! global forcing trends |
---|
32 | REAL(dp) :: fact1 ! conversion factors |
---|
33 | REAL(dp) :: fact21 , fact22 ! - - |
---|
34 | REAL(dp) :: fact31 , fact32 ! - - |
---|
35 | REAL(dp), DIMENSION(:,:) , ALLOCATABLE :: surf , ssh_ini ! |
---|
36 | REAL(dp), DIMENSION(:,:,:), ALLOCATABLE :: hc_loc_ini, sc_loc_ini, e3t_ini ! |
---|
37 | |
---|
38 | !! * Substitutions |
---|
39 | # include "domzgr_substitute.h90" |
---|
40 | # include "vectopt_loop_substitute.h90" |
---|
41 | |
---|
42 | !!---------------------------------------------------------------------- |
---|
43 | !! NEMO/OPA 3.3 , LOCEAN-IPSL (2010) |
---|
44 | !! $Id: trasbc.F90 2091 2010-09-14 20:29:38Z mlelod $ |
---|
45 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
46 | !!---------------------------------------------------------------------- |
---|
47 | |
---|
48 | CONTAINS |
---|
49 | |
---|
50 | SUBROUTINE dia_hsb( kt ) |
---|
51 | !!--------------------------------------------------------------------------- |
---|
52 | !! *** ROUTINE dia_hsb *** |
---|
53 | !! |
---|
54 | !! ** Purpose: Compute the ocean global heat content, salt content and volume |
---|
55 | !! non conservation |
---|
56 | !! |
---|
57 | !! ** Method : - Compute the deviation of heat content, salt content and volume |
---|
58 | !! at the current time step from their values at nit000 |
---|
59 | !! - Compute the contribution of forcing and remove it from these |
---|
60 | !! deviations |
---|
61 | !! ** Action : Write the results in the 'heat_salt_volume_budgets.txt' ASCII file |
---|
62 | !!--------------------------------------------------------------------------- |
---|
63 | INTEGER, INTENT(in) :: kt ! ocean time-step index |
---|
64 | !! |
---|
65 | CHARACTER (len=32) :: s_name ! output file name |
---|
66 | INTEGER :: jk ! dummy loop indice |
---|
67 | INTEGER :: ierror ! local integer |
---|
68 | REAL(dp) :: zdiff_hc , zdiff_sc ! heat and salt content variations |
---|
69 | REAL(dp) :: zdiff_v1 , zdiff_v2 ! volume variation |
---|
70 | REAL(dp) :: z1_rau0 ! local scalars |
---|
71 | REAL(dp) :: zdeltat ! - - |
---|
72 | REAL(dp) :: z_frc_trd_t , z_frc_trd_s ! - - |
---|
73 | REAL(dp) :: z_frc_trd_v ! - - |
---|
74 | !!--------------------------------------------------------------------------- |
---|
75 | |
---|
76 | ! ! =================== ! |
---|
77 | IF( kt == nit000 ) THEN ! 1 - Initialisations ! |
---|
78 | ! ! =================== ! |
---|
79 | |
---|
80 | ! 1.0 - Allocate memory |
---|
81 | ! --------------------- |
---|
82 | ALLOCATE( hc_loc_ini(jpi,jpj,jpk), STAT=ierror ) |
---|
83 | IF( ierror > 0 ) THEN |
---|
84 | CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' ) ; RETURN |
---|
85 | ENDIF |
---|
86 | ALLOCATE( sc_loc_ini(jpi,jpj,jpk), STAT=ierror ) |
---|
87 | IF( ierror > 0 ) THEN |
---|
88 | CALL ctl_stop( 'dia_hsb: unable to allocate sc_loc_ini' ) ; RETURN |
---|
89 | ENDIF |
---|
90 | ALLOCATE( e3t_ini(jpi,jpj,jpk) , STAT=ierror ) |
---|
91 | IF( ierror > 0 ) THEN |
---|
92 | CALL ctl_stop( 'dia_hsb: unable to allocate e3t_ini' ) ; RETURN |
---|
93 | ENDIF |
---|
94 | ALLOCATE( surf(jpi,jpj) , STAT=ierror ) |
---|
95 | IF( ierror > 0 ) THEN |
---|
96 | CALL ctl_stop( 'dia_hsb: unable to allocate surf' ) ; RETURN |
---|
97 | ENDIF |
---|
98 | ALLOCATE( ssh_ini(jpi,jpj) , STAT=ierror ) |
---|
99 | IF( ierror > 0 ) THEN |
---|
100 | CALL ctl_stop( 'dia_hsb: unable to allocate ssh_ini' ) ; RETURN |
---|
101 | ENDIF |
---|
102 | |
---|
103 | ! 1.1 - Time independant variables and file opening |
---|
104 | ! ------------------------------------------------- |
---|
105 | WRITE(numout,*) "dia_hsb: heat salt volume budgets activated" |
---|
106 | WRITE(numout,*) "~~~~~~~ output written in the 'heat_salt_volume_budgets.txt' ASCII file" |
---|
107 | IF( lk_obc .OR. lk_bdy) THEN |
---|
108 | CALL ctl_warn( 'dia_hsb does not take open boundary fluxes into account' ) |
---|
109 | ENDIF |
---|
110 | s_name = 'heat_salt_volume_budgets.txt' ! name of output file |
---|
111 | surf(:,:) = e1t(:,:) * e2t(:,:) * tmask(:,:,1) * tmask_i(:,:) ! masked surface grid cell area |
---|
112 | surf_tot = SUM( surf(:,:) ) ! total ocean surface area |
---|
113 | vol_tot = 0.d0 ! total ocean volume |
---|
114 | DO jk = 1, jpkm1 |
---|
115 | vol_tot = vol_tot + SUM( surf(:,:) * tmask(:,:,jk) & |
---|
116 | & * fse3t_n(:,:,jk) ) |
---|
117 | ENDDO |
---|
118 | IF( lk_mpp ) THEN |
---|
119 | CALL mpp_sum( vol_tot ) |
---|
120 | CALL mpp_sum( surf_tot ) |
---|
121 | ENDIF |
---|
122 | |
---|
123 | CALL ctl_opn( num , s_name , 'UNKNOWN' , 'FORMATTED' , 'SEQUENTIAL' , 1 , numout , lwp , 1 ) |
---|
124 | ! 12345678901234567890123456789012345678901234567890123456789012345678901234567890 -> 80 |
---|
125 | WRITE( num, 9010 ) "kt | heat content budget | salt content budget ", & |
---|
126 | ! 123456789012345678901234567890123456789012345 -> 45 |
---|
127 | & "| volume budget (ssh) ", & |
---|
128 | ! 678901234567890123456789012345678901234567890 -> 45 |
---|
129 | & "| volume budget (e3t) " |
---|
130 | WRITE( num, 9010 ) " | [C] [W/m2] | [psu] [mmm/s] [SV] ", & |
---|
131 | & "| [m3] [mmm/s] [SV] ", & |
---|
132 | & "| [m3] [mmm/s] [SV] " |
---|
133 | |
---|
134 | ! 1.2 - Conversions (factors will be multiplied by duration afterwards) |
---|
135 | ! ----------------- |
---|
136 | ! heat content variation => equivalent heat flux: |
---|
137 | fact1 = rau0 * rcp / surf_tot ! [C*m3] -> [W/m2] |
---|
138 | ! salt content variation => equivalent EMP and equivalent "flow": |
---|
139 | fact21 = 1.e3 / ( soce * surf_tot ) ! [psu*m3] -> [mm/s] |
---|
140 | fact22 = 1.e-6 / soce ! [psu*m3] -> [Sv] |
---|
141 | ! volume variation => equivalent EMP and equivalent "flow": |
---|
142 | fact31 = 1.e3 / surf_tot ! [m3] -> [mm/s] |
---|
143 | fact32 = 1.e-6 ! [m3] -> [SV] |
---|
144 | |
---|
145 | ! 1.3 - initial conservation variables |
---|
146 | ! ------------------------------------ |
---|
147 | ssh_ini(:,:) = sshn(:,:) ! initial ssh |
---|
148 | DO jk = 1, jpk |
---|
149 | e3t_ini (:,:,jk) = fse3t_n(:,:,jk) ! initial vertical scale factors |
---|
150 | hc_loc_ini(:,:,jk) = tn(:,:,jk) * fse3t_n(:,:,jk) ! initial heat content |
---|
151 | sc_loc_ini(:,:,jk) = sn(:,:,jk) * fse3t_n(:,:,jk) ! initial salt content |
---|
152 | END DO |
---|
153 | frc_v = 0.d0 ! volume trend due to forcing |
---|
154 | frc_t = 0.d0 ! heat content " " " " |
---|
155 | frc_s = 0.d0 ! salt content " " " " |
---|
156 | |
---|
157 | ! ! ====================================================================== ! |
---|
158 | ELSE ! 2 - Heat content, salt content and volume variations: curent - initial ! |
---|
159 | ! ! ====================================================================== ! |
---|
160 | |
---|
161 | ! 2.1 - Trends due to forcing |
---|
162 | ! --------------------------- |
---|
163 | z1_rau0 = 1.e0 / rau0 |
---|
164 | z_frc_trd_v = z1_rau0 * SUM( - emp(:,:) * surf(:,:) ) ! volume fluxes |
---|
165 | z_frc_trd_t = SUM( sbc_hc_n(:,:) * surf(:,:) ) ! heat fluxes |
---|
166 | z_frc_trd_s = SUM( sbc_sc_n(:,:) * surf(:,:) ) ! salt fluxes |
---|
167 | ! Add penetrative solar radiation |
---|
168 | IF( ln_traqsr ) z_frc_trd_t = z_frc_trd_t + ro0cpr * SUM( qsr (:,:) * surf(:,:) ) |
---|
169 | ! Add geothermal heat flux |
---|
170 | IF( lk_trabbc ) z_frc_trd_t = z_frc_trd_t + ro0cpr * SUM( qgh_trd0(:,:) * surf(:,:) ) |
---|
171 | IF( lk_mpp ) THEN |
---|
172 | CALL mpp_sum( z_frc_trd_v ) |
---|
173 | CALL mpp_sum( z_frc_trd_t ) |
---|
174 | ENDIF |
---|
175 | frc_v = frc_v + z_frc_trd_v * rdt |
---|
176 | frc_t = frc_t + z_frc_trd_t * rdt |
---|
177 | frc_s = frc_s + z_frc_trd_s * rdt |
---|
178 | |
---|
179 | ! 2.2 - Content variations |
---|
180 | ! ------------------------- |
---|
181 | zdiff_v2 = 0.d0 |
---|
182 | zdiff_hc = 0.d0 |
---|
183 | zdiff_sc = 0.d0 |
---|
184 | ! volume variation (calculated with ssh) |
---|
185 | zdiff_v1 = SUM( surf(:,:) * tmask(:,:,1) * ( sshn(:,:) - ssh_ini(:,:) ) ) |
---|
186 | DO jk = 1, jpkm1 |
---|
187 | ! volume variation (calculated with scale factors) |
---|
188 | zdiff_v2 = zdiff_v2 + SUM( surf(:,:) * tmask(:,:,jk) & |
---|
189 | & * ( fse3t_n(:,:,jk) & |
---|
190 | & - e3t_ini(:,:,jk) ) ) |
---|
191 | ! heat content variation |
---|
192 | zdiff_hc = zdiff_hc + SUM( surf(:,:) * tmask(:,:,jk) & |
---|
193 | & * ( fse3t_n(:,:,jk) * tn(:,:,jk) & |
---|
194 | & - hc_loc_ini(:,:,jk) ) ) |
---|
195 | ! salt content variation |
---|
196 | zdiff_sc = zdiff_sc + SUM( surf(:,:) * tmask(:,:,jk) & |
---|
197 | & * ( fse3t_n(:,:,jk) * sn(:,:,jk) & |
---|
198 | & - sc_loc_ini(:,:,jk) ) ) |
---|
199 | ENDDO |
---|
200 | |
---|
201 | IF( lk_mpp ) THEN |
---|
202 | CALL mpp_sum( zdiff_hc ) |
---|
203 | CALL mpp_sum( zdiff_sc ) |
---|
204 | CALL mpp_sum( zdiff_v1 ) |
---|
205 | CALL mpp_sum( zdiff_v2 ) |
---|
206 | ENDIF |
---|
207 | |
---|
208 | ! Substract sbc fluxes from heat content, salt content and volume variations |
---|
209 | zdiff_v1 = zdiff_v1 - frc_v |
---|
210 | zdiff_v2 = zdiff_v2 - frc_v |
---|
211 | zdiff_hc = zdiff_hc - frc_t |
---|
212 | zdiff_sc = zdiff_sc - frc_s |
---|
213 | |
---|
214 | ! 2.3 - Diagnostics writing |
---|
215 | ! ------------------------- |
---|
216 | ! heat salt and volume budgets |
---|
217 | zdeltat = 1.e0 / ( ( kt - nit000 + 1 ) * rdt ) |
---|
218 | WRITE(num , 9020) kt , zdiff_hc / vol_tot , zdiff_hc * fact1 * zdeltat, & |
---|
219 | & zdiff_sc / vol_tot , zdiff_sc * fact21 * zdeltat, zdiff_sc * fact22 * zdeltat, & |
---|
220 | & zdiff_v1 , zdiff_v1 * fact31 * zdeltat, zdiff_v1 * fact32 * zdeltat, & |
---|
221 | & zdiff_v2 , zdiff_v2 * fact31 * zdeltat, zdiff_v2 * fact32 * zdeltat |
---|
222 | ENDIF |
---|
223 | |
---|
224 | IF ( kt == nitend ) CLOSE( num ) |
---|
225 | |
---|
226 | 9010 FORMAT(A80,A45,A45) |
---|
227 | 9020 FORMAT(I5,11D15.7) |
---|
228 | |
---|
229 | END SUBROUTINE dia_hsb |
---|
230 | |
---|
231 | !!====================================================================== |
---|
232 | END MODULE diahsb |
---|