1 | MODULE sbcssm |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE sbcssm *** |
---|
4 | !! Surface module : provide time-mean ocean surface variables |
---|
5 | !!====================================================================== |
---|
6 | !! History : 9.0 ! 2006-07 (G. Madec) Original code |
---|
7 | !! 3.3 ! 2010-10 (C. Bricaud, G. Madec) add the Patm forcing for sea-ice |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | !! sbc_ssm : calculate sea surface mean currents, temperature, |
---|
12 | !! and salinity over nn_fsbc time-step |
---|
13 | !!---------------------------------------------------------------------- |
---|
14 | USE oce ! ocean dynamics and tracers |
---|
15 | USE dom_oce ! ocean space and time domain |
---|
16 | USE sbc_oce ! surface boundary condition: ocean fields |
---|
17 | USE sbcapr ! surface boundary condition: atmospheric pressure |
---|
18 | USE eosbn2 ! equation of state and related derivatives |
---|
19 | USE traqsr, ONLY: ln_qsr_ice,fraqsr_1lev |
---|
20 | ! |
---|
21 | USE in_out_manager ! I/O manager |
---|
22 | USE prtctl ! Print control |
---|
23 | USE iom ! IOM library |
---|
24 | |
---|
25 | IMPLICIT NONE |
---|
26 | PRIVATE |
---|
27 | |
---|
28 | PUBLIC sbc_ssm ! routine called by step.F90 |
---|
29 | PUBLIC sbc_ssm_init ! routine called by sbcmod.F90 |
---|
30 | |
---|
31 | LOGICAL, SAVE :: l_ssm_mean = .FALSE. ! keep track of whether means have been read |
---|
32 | ! from restart file |
---|
33 | |
---|
34 | !! * Substitutions |
---|
35 | # include "domzgr_substitute.h90" |
---|
36 | !!---------------------------------------------------------------------- |
---|
37 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
38 | !! $Id$ |
---|
39 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
40 | !!---------------------------------------------------------------------- |
---|
41 | CONTAINS |
---|
42 | |
---|
43 | SUBROUTINE sbc_ssm( kt ) |
---|
44 | !!--------------------------------------------------------------------- |
---|
45 | !! *** ROUTINE sbc_oce *** |
---|
46 | !! |
---|
47 | !! ** Purpose : provide ocean surface variable to sea-surface boundary |
---|
48 | !! condition computation |
---|
49 | !! |
---|
50 | !! ** Method : compute mean surface velocity (2 components at U and |
---|
51 | !! V-points) [m/s], temperature [Celcius] and salinity [psu] over |
---|
52 | !! the periode (kt - nn_fsbc) to kt |
---|
53 | !! Note that the inverse barometer ssh (i.e. ssh associated with Patm) |
---|
54 | !! is add to ssh_m when ln_apr_dyn = T. Required for sea-ice dynamics. |
---|
55 | !!--------------------------------------------------------------------- |
---|
56 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
57 | ! |
---|
58 | INTEGER :: ji, jj ! loop index |
---|
59 | REAL(wp) :: zcoef, zf_sbc ! local scalar |
---|
60 | REAL(wp), DIMENSION(jpi,jpj,jpts) :: zts |
---|
61 | !!--------------------------------------------------------------------- |
---|
62 | |
---|
63 | ! !* surface T-, U-, V- ocean level variables (T, S, depth, velocity) |
---|
64 | DO jj = 1, jpj |
---|
65 | DO ji = 1, jpi |
---|
66 | zts(ji,jj,jp_tem) = tsn(ji,jj,mikt(ji,jj),jp_tem) |
---|
67 | zts(ji,jj,jp_sal) = tsn(ji,jj,mikt(ji,jj),jp_sal) |
---|
68 | END DO |
---|
69 | END DO |
---|
70 | ! |
---|
71 | IF( nn_fsbc == 1 ) THEN ! Instantaneous surface fields ! |
---|
72 | ! ! ---------------------------------------- ! |
---|
73 | ssu_m(:,:) = ub(:,:,1) |
---|
74 | ssv_m(:,:) = vb(:,:,1) |
---|
75 | IF( ln_useCT ) THEN ; sst_m(:,:) = eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) |
---|
76 | ELSE ; sst_m(:,:) = zts(:,:,jp_tem) |
---|
77 | ENDIF |
---|
78 | sss_m(:,:) = zts(:,:,jp_sal) |
---|
79 | ! ! removed inverse barometer ssh when Patm forcing is used (for sea-ice dynamics) |
---|
80 | IF( ln_apr_dyn ) THEN ; ssh_m(:,:) = sshn(:,:) - 0.5 * ( ssh_ib(:,:) + ssh_ibb(:,:) ) |
---|
81 | ELSE ; ssh_m(:,:) = sshn(:,:) |
---|
82 | ENDIF |
---|
83 | ! |
---|
84 | IF( lk_vvl ) e3t_m(:,:) = fse3t_n(:,:,1) |
---|
85 | ! |
---|
86 | IF( ln_qsr_ice ) frq_m(:,:) = fraqsr_1lev(:,:) |
---|
87 | ! |
---|
88 | ELSE |
---|
89 | ! ! ----------------------------------------------- ! |
---|
90 | IF( kt == nit000 .AND. .NOT. l_ssm_mean ) THEN ! Initialisation: 1st time-step, no input means ! |
---|
91 | ! ! ----------------------------------------------- ! |
---|
92 | IF(lwp) WRITE(numout,*) |
---|
93 | IF(lwp) WRITE(numout,*) '~~~~~~~ mean fields initialised to instantaneous values' |
---|
94 | zcoef = REAL( nn_fsbc - 1, wp ) |
---|
95 | ssu_m(:,:) = zcoef * ub(:,:,1) |
---|
96 | ssv_m(:,:) = zcoef * vb(:,:,1) |
---|
97 | IF( ln_useCT ) THEN ; sst_m(:,:) = zcoef * eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) |
---|
98 | ELSE ; sst_m(:,:) = zcoef * zts(:,:,jp_tem) |
---|
99 | ENDIF |
---|
100 | sss_m(:,:) = zcoef * zts(:,:,jp_sal) |
---|
101 | ! ! removed inverse barometer ssh when Patm forcing is used (for sea-ice dynamics) |
---|
102 | IF( ln_apr_dyn ) THEN ; ssh_m(:,:) = zcoef * ( sshn(:,:) - 0.5 * ( ssh_ib(:,:) + ssh_ibb(:,:) ) ) |
---|
103 | ELSE ; ssh_m(:,:) = zcoef * sshn(:,:) |
---|
104 | ENDIF |
---|
105 | ! |
---|
106 | IF( lk_vvl ) e3t_m(:,:) = zcoef * fse3t_n(:,:,1) |
---|
107 | ! |
---|
108 | IF( ln_qsr_ice ) frq_m(:,:) = zcoef * fraqsr_1lev(:,:) |
---|
109 | ! ! ---------------------------------------- ! |
---|
110 | ELSEIF( MOD( kt - 2 , nn_fsbc ) == 0 ) THEN ! Initialisation: New mean computation ! |
---|
111 | ! ! ---------------------------------------- ! |
---|
112 | ssu_m(:,:) = 0.e0 ! reset to zero ocean mean sbc fields |
---|
113 | ssv_m(:,:) = 0.e0 |
---|
114 | sst_m(:,:) = 0.e0 |
---|
115 | sss_m(:,:) = 0.e0 |
---|
116 | ssh_m(:,:) = 0.e0 |
---|
117 | IF( lk_vvl ) e3t_m(:,:) = 0.e0 |
---|
118 | IF( ln_qsr_ice ) frq_m(:,:) = 0.e0 |
---|
119 | ENDIF |
---|
120 | ! ! ---------------------------------------- ! |
---|
121 | ! ! Cumulate at each time step ! |
---|
122 | ! ! ---------------------------------------- ! |
---|
123 | ssu_m(:,:) = ssu_m(:,:) + ub(:,:,1) |
---|
124 | ssv_m(:,:) = ssv_m(:,:) + vb(:,:,1) |
---|
125 | IF( ln_useCT ) THEN ; sst_m(:,:) = sst_m(:,:) + eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) |
---|
126 | ELSE ; sst_m(:,:) = sst_m(:,:) + zts(:,:,jp_tem) |
---|
127 | ENDIF |
---|
128 | sss_m(:,:) = sss_m(:,:) + zts(:,:,jp_sal) |
---|
129 | ! ! removed inverse barometer ssh when Patm forcing is used (for sea-ice dynamics) |
---|
130 | IF( ln_apr_dyn ) THEN ; ssh_m(:,:) = ssh_m(:,:) + sshn(:,:) - 0.5 * ( ssh_ib(:,:) + ssh_ibb(:,:) ) |
---|
131 | ELSE ; ssh_m(:,:) = ssh_m(:,:) + sshn(:,:) |
---|
132 | ENDIF |
---|
133 | ! |
---|
134 | IF( lk_vvl ) e3t_m(:,:) = fse3t_m(:,:) + fse3t_n(:,:,1) |
---|
135 | ! |
---|
136 | IF( ln_qsr_ice ) frq_m(:,:) = frq_m(:,:) + fraqsr_1lev(:,:) |
---|
137 | |
---|
138 | ! ! ---------------------------------------- ! |
---|
139 | IF( MOD( kt - 1 , nn_fsbc ) == 0 ) THEN ! Mean value at each nn_fsbc time-step ! |
---|
140 | ! ! ---------------------------------------- ! |
---|
141 | zcoef = 1. / REAL( nn_fsbc, wp ) |
---|
142 | sst_m(:,:) = sst_m(:,:) * zcoef ! mean SST [Celcius] |
---|
143 | sss_m(:,:) = sss_m(:,:) * zcoef ! mean SSS [psu] |
---|
144 | ssu_m(:,:) = ssu_m(:,:) * zcoef ! mean suface current [m/s] |
---|
145 | ssv_m(:,:) = ssv_m(:,:) * zcoef ! |
---|
146 | ssh_m(:,:) = ssh_m(:,:) * zcoef ! mean SSH [m] |
---|
147 | IF( lk_vvl ) e3t_m(:,:) = fse3t_m(:,:) * zcoef ! mean vertical scale factor [m] |
---|
148 | IF( ln_qsr_ice ) frq_m(:,:) = frq_m(:,:) * zcoef ! mean fraction of solar net radiation absorbed in the 1st T level [-] |
---|
149 | ! |
---|
150 | ENDIF |
---|
151 | ! ! ---------------------------------------- ! |
---|
152 | IF( lrst_oce ) THEN ! Write in the ocean restart file ! |
---|
153 | ! ! ---------------------------------------- ! |
---|
154 | IF(lwp) WRITE(numout,*) |
---|
155 | IF(lwp) WRITE(numout,*) 'sbc_ssm : sea surface mean fields written in ocean restart file ', & |
---|
156 | & 'at it= ', kt,' date= ', ndastp |
---|
157 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
158 | zf_sbc = REAL( nn_fsbc, wp ) |
---|
159 | CALL iom_rstput( kt, nitrst, numrow, 'nn_fsbc', zf_sbc ) ! sbc frequency |
---|
160 | CALL iom_rstput( kt, nitrst, numrow, 'ssu_m' , ssu_m ) ! sea surface mean fields |
---|
161 | CALL iom_rstput( kt, nitrst, numrow, 'ssv_m' , ssv_m ) |
---|
162 | CALL iom_rstput( kt, nitrst, numrow, 'sst_m' , sst_m ) |
---|
163 | CALL iom_rstput( kt, nitrst, numrow, 'sss_m' , sss_m ) |
---|
164 | CALL iom_rstput( kt, nitrst, numrow, 'ssh_m' , ssh_m ) |
---|
165 | IF( lk_vvl ) CALL iom_rstput( kt, nitrst, numrow, 'e3t_m' , e3t_m ) |
---|
166 | IF( ln_qsr_ice ) CALL iom_rstput( kt, nitrst, numrow, 'frq_m' , frq_m ) |
---|
167 | ! |
---|
168 | ENDIF |
---|
169 | ! |
---|
170 | ENDIF |
---|
171 | ! |
---|
172 | IF( MOD( kt - 1 , nn_fsbc ) == 0 ) THEN ! Mean value at each nn_fsbc time-step ! |
---|
173 | CALL iom_put( 'ssu_m', ssu_m ) |
---|
174 | CALL iom_put( 'ssv_m', ssv_m ) |
---|
175 | CALL iom_put( 'sst_m', sst_m ) |
---|
176 | CALL iom_put( 'sss_m', sss_m ) |
---|
177 | CALL iom_put( 'ssh_m', ssh_m ) |
---|
178 | IF( lk_vvl ) CALL iom_put( 'e3t_m', e3t_m ) |
---|
179 | IF( ln_qsr_ice ) CALL iom_put( 'frq_m', frq_m ) |
---|
180 | ENDIF |
---|
181 | ! |
---|
182 | END SUBROUTINE sbc_ssm |
---|
183 | |
---|
184 | SUBROUTINE sbc_ssm_init |
---|
185 | !!---------------------------------------------------------------------- |
---|
186 | !! *** ROUTINE sbc_ssm_init *** |
---|
187 | !! |
---|
188 | !! ** Purpose : Initialisation of the sbc data |
---|
189 | !! |
---|
190 | !! ** Action : - read parameters |
---|
191 | !!---------------------------------------------------------------------- |
---|
192 | REAL(wp) :: zcoef, zf_sbc ! local scalar |
---|
193 | !!---------------------------------------------------------------------- |
---|
194 | |
---|
195 | IF( nn_fsbc == 1 ) THEN |
---|
196 | ! |
---|
197 | IF(lwp) WRITE(numout,*) |
---|
198 | IF(lwp) WRITE(numout,*) 'sbc_ssm : sea surface mean fields, nn_fsbc=1 : instantaneous values' |
---|
199 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
200 | ! |
---|
201 | ELSE |
---|
202 | ! |
---|
203 | IF(lwp) WRITE(numout,*) |
---|
204 | IF(lwp) WRITE(numout,*) 'sbc_ssm : sea surface mean fields' |
---|
205 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
206 | ! |
---|
207 | IF( ln_rstart .AND. iom_varid( numror, 'nn_fsbc', ldstop = .FALSE. ) > 0 ) THEN |
---|
208 | l_ssm_mean = .TRUE. |
---|
209 | CALL iom_get( numror , 'nn_fsbc', zf_sbc ) ! sbc frequency of previous run |
---|
210 | CALL iom_get( numror, jpdom_autoglo, 'ssu_m' , ssu_m ) ! sea surface mean velocity (T-point) |
---|
211 | CALL iom_get( numror, jpdom_autoglo, 'ssv_m' , ssv_m ) ! " " velocity (V-point) |
---|
212 | CALL iom_get( numror, jpdom_autoglo, 'sst_m' , sst_m ) ! " " temperature (T-point) |
---|
213 | CALL iom_get( numror, jpdom_autoglo, 'sss_m' , sss_m ) ! " " salinity (T-point) |
---|
214 | CALL iom_get( numror, jpdom_autoglo, 'ssh_m' , ssh_m ) ! " " height (T-point) |
---|
215 | IF( lk_vvl ) CALL iom_get( numror, jpdom_autoglo, 'e3t_m', e3t_m ) |
---|
216 | ! fraction of solar net radiation absorbed in 1st T level |
---|
217 | IF( iom_varid( numror, 'frq_m', ldstop = .FALSE. ) > 0 ) THEN |
---|
218 | CALL iom_get( numror, jpdom_autoglo, 'frq_m' , frq_m ) |
---|
219 | ELSE |
---|
220 | frq_m(:,:) = 1._wp ! default definition |
---|
221 | ENDIF |
---|
222 | ! |
---|
223 | IF( zf_sbc /= REAL( nn_fsbc, wp ) ) THEN ! nn_fsbc has changed between 2 runs |
---|
224 | IF(lwp) WRITE(numout,*) '~~~~~~~ restart with a change in the frequency of mean ', & |
---|
225 | & 'from ', zf_sbc, ' to ', nn_fsbc |
---|
226 | zcoef = REAL( nn_fsbc - 1, wp ) / zf_sbc |
---|
227 | ssu_m(:,:) = zcoef * ssu_m(:,:) |
---|
228 | ssv_m(:,:) = zcoef * ssv_m(:,:) |
---|
229 | sst_m(:,:) = zcoef * sst_m(:,:) |
---|
230 | sss_m(:,:) = zcoef * sss_m(:,:) |
---|
231 | ssh_m(:,:) = zcoef * ssh_m(:,:) |
---|
232 | IF( lk_vvl ) e3t_m(:,:) = zcoef * fse3t_m(:,:) |
---|
233 | frq_m(:,:) = zcoef * frq_m(:,:) ! bug: must not be done if ln_qsr_ice = .false. |
---|
234 | ELSE |
---|
235 | IF(lwp) WRITE(numout,*) '~~~~~~~ mean fields read in the ocean restart file' |
---|
236 | ENDIF |
---|
237 | ENDIF |
---|
238 | ENDIF |
---|
239 | |
---|
240 | IF( .NOT. l_ssm_mean ) THEN ! default initialisation. needed by lim_istate |
---|
241 | ! |
---|
242 | IF(lwp) WRITE(numout,*) ' default initialisation of ss?_m arrays' |
---|
243 | ssu_m(:,:) = ub(:,:,1) |
---|
244 | ssv_m(:,:) = vb(:,:,1) |
---|
245 | IF( ln_useCT ) THEN ; sst_m(:,:) = eos_pt_from_ct( tsn(:,:,1,jp_tem), tsn(:,:,1,jp_sal) ) |
---|
246 | ELSE ; sst_m(:,:) = tsn(:,:,1,jp_tem) |
---|
247 | ENDIF |
---|
248 | sss_m(:,:) = tsn(:,:,1,jp_sal) |
---|
249 | ssh_m(:,:) = sshn(:,:) |
---|
250 | IF( lk_vvl ) e3t_m(:,:) = fse3t_n(:,:,1) |
---|
251 | frq_m(:,:) = 1._wp |
---|
252 | ! |
---|
253 | ENDIF |
---|
254 | ! |
---|
255 | END SUBROUTINE sbc_ssm_init |
---|
256 | |
---|
257 | !!====================================================================== |
---|
258 | END MODULE sbcssm |
---|