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