1 | MODULE sbcflx_tam |
---|
2 | #if defined key_tam |
---|
3 | !!====================================================================== |
---|
4 | !! *** MODULE sbcflx_tam *** |
---|
5 | !! Ocean forcing: momentum, heat and freshwater flux formulation |
---|
6 | !! Angent and Andjoint Module |
---|
7 | !!===================================================================== |
---|
8 | !! History of the direct module: |
---|
9 | !! 9.0 ! 06-06 (G. Madec) Original code |
---|
10 | !! History of the T&A module: |
---|
11 | !! 9.0 ! 08-11 (A. Vidard) Original code |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | !! namflx : flux formulation namlist |
---|
16 | !! sbc_flx : flux formulation as ocean surface boundary condition |
---|
17 | !! (forced mode, fluxes read in NetCDF files) |
---|
18 | !!---------------------------------------------------------------------- |
---|
19 | !! question diverses |
---|
20 | !! * ajouter un test sur la division entier de freqh et rdttra ??? |
---|
21 | !! ** ajoute dans namelist: 1 year forcing files |
---|
22 | !! or forcing file starts at the begining of the run |
---|
23 | !! *** we assume that the forcing file start and end with the previous |
---|
24 | !! year last record and the next year first record (useful for |
---|
25 | !! time interpolation, required even if no time interp???) |
---|
26 | !! * ajouter un test sur la division de la frequence en pas de temps |
---|
27 | !! ==> daymod ajout de nsec_year = number of second since the begining of the year |
---|
28 | !! assumed to be 0 at 0h january the 1st (i.e. 24h december the 31) |
---|
29 | !! |
---|
30 | !! *** regrouper dtatem et dtasal |
---|
31 | !!---------------------------------------------------------------------- |
---|
32 | USE par_kind , ONLY: & ! Precision variables |
---|
33 | & wp |
---|
34 | USE par_oce , ONLY: & ! Ocean space and time domain variables |
---|
35 | & jpi, & |
---|
36 | & jpj |
---|
37 | USE sbc_oce_tam, ONLY: & ! Surface boundary condition: ocean fields |
---|
38 | & utau_tl, & ! sea surface i-stress (ocean referential) [N/m2] |
---|
39 | & vtau_tl, & ! sea surface j-stress (ocean referential) [N/m2] |
---|
40 | & qns_tl , & ! sea heat flux: non solar [W/m2] |
---|
41 | & qsr_tl , & ! sea heat flux: solar [W/m2] |
---|
42 | & emp_tl , & ! freshwater budget: volume flux [Kg/m2/s] |
---|
43 | & emps_tl, & ! freshwater budget: concentr/dillution [Kg/m2/s] |
---|
44 | & wndm_tl, & ! wind speed module at T-point(=|U10m-Uoce|)[m/s] |
---|
45 | & utau_ad, & |
---|
46 | & vtau_ad, & |
---|
47 | & qns_ad , & |
---|
48 | & qsr_ad , & |
---|
49 | & emp_ad , & |
---|
50 | & emps_ad, & |
---|
51 | & wndm_ad |
---|
52 | |
---|
53 | IMPLICIT NONE |
---|
54 | PRIVATE |
---|
55 | |
---|
56 | PUBLIC sbc_flx_tan ! routine called by sbcmod_tam.F90 |
---|
57 | PUBLIC sbc_flx_adj ! routine called by sbcmod_tam.F90 |
---|
58 | PUBLIC sbc_flx_adj_tst ! routine called by tst.F90 |
---|
59 | |
---|
60 | REAL(wp) :: rhoa = 1.22 ! Air density kg/m3 |
---|
61 | REAL(wp) :: cdrag = 1.5e-3 ! drag coefficient |
---|
62 | |
---|
63 | !! * Substitutions |
---|
64 | # include "domzgr_substitute.h90" |
---|
65 | # include "vectopt_loop_substitute.h90" |
---|
66 | !!---------------------------------------------------------------------- |
---|
67 | !! OPA 9.0 , LOCEAN-IPSL (2006) |
---|
68 | !! $Id: sbcflx.F90 1200 2008-09-24 13:05:20Z rblod $ |
---|
69 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
70 | !!---------------------------------------------------------------------- |
---|
71 | |
---|
72 | CONTAINS |
---|
73 | |
---|
74 | SUBROUTINE sbc_flx_tan( kt ) |
---|
75 | !!--------------------------------------------------------------------- |
---|
76 | !! *** ROUTINE sbc_flx_tan *** |
---|
77 | !! |
---|
78 | !! ** Purpose of the direct routine: |
---|
79 | !! provide at each time step the surface ocean fluxes |
---|
80 | !! (momentum, heat, freshwater and runoff) |
---|
81 | !! |
---|
82 | !! ** Method : - READ each fluxes in NetCDF files: |
---|
83 | !! i-component of the stress utau (N/m2) |
---|
84 | !! j-component of the stress vtau (N/m2) |
---|
85 | !! net downward heat flux qtot (watt/m2) |
---|
86 | !! net downward radiative flux qsr (watt/m2) |
---|
87 | !! net upward freshwater (evapo - precip) emp (kg/m2/s) |
---|
88 | !! Assumptions made: |
---|
89 | !! - each file content an entire year (read record, not the time axis) |
---|
90 | !! - first and last record are part of the previous and next year |
---|
91 | !! (useful for time interpolation) |
---|
92 | !! - the number of records is 2 + 365*24 / freqh(jf) |
---|
93 | !! or 366 in leap year case |
---|
94 | !! |
---|
95 | !! CAUTION : - never mask the surface stress fields |
---|
96 | !! - the stress is assumed to be in the mesh referential |
---|
97 | !! i.e. the (i,j) referential |
---|
98 | !! |
---|
99 | !! ** Action : update at each time-step |
---|
100 | !! - utau & vtau : stress components in (i,j) referential |
---|
101 | !! - qns : non solar heat flux |
---|
102 | !! - qsr : solar heat flux |
---|
103 | !! - emp : evap - precip (volume flux) |
---|
104 | !! - emps : evap - precip (concentration/dillution) |
---|
105 | !!---------------------------------------------------------------------- |
---|
106 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
107 | !! |
---|
108 | INTEGER :: ji, jj, jf ! dummy indices |
---|
109 | REAL(wp) :: zcoef |
---|
110 | !! |
---|
111 | !!--------------------------------------------------------------------- |
---|
112 | ! set the ocean fluxes from read fields |
---|
113 | !CDIR COLLAPSE |
---|
114 | DO jj = 1, jpj |
---|
115 | DO ji = 1, jpi |
---|
116 | utau_tl(ji,jj) = 0.0_wp |
---|
117 | vtau_tl(ji,jj) = 0.0_wp |
---|
118 | qns_tl (ji,jj) = 0.0_wp |
---|
119 | qsr_tl (ji,jj) = 0.0_wp |
---|
120 | emp_tl (ji,jj) = 0.0_wp |
---|
121 | END DO |
---|
122 | END DO |
---|
123 | |
---|
124 | ! Initialization of emps (when no ice model) |
---|
125 | emps_tl(:,:) = emp_tl (:,:) |
---|
126 | |
---|
127 | ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 ) |
---|
128 | ! WARNING !!! TANGENT NOT VALID if TAU is part of the state vector. |
---|
129 | zcoef = 0.5 / ( rhoa * cdrag ) |
---|
130 | wndm_tl(:,:) = 0.0_wp |
---|
131 | ! |
---|
132 | END SUBROUTINE sbc_flx_tan |
---|
133 | SUBROUTINE sbc_flx_adj( kt ) |
---|
134 | !!--------------------------------------------------------------------- |
---|
135 | !! *** ROUTINE sbc_flx_adj *** |
---|
136 | !! |
---|
137 | !! ** Purpose of the direct routine: |
---|
138 | !! provide at each time step the surface ocean fluxes |
---|
139 | !! (momentum, heat, freshwater and runoff) |
---|
140 | !! |
---|
141 | !! ** Method : - READ each fluxes in NetCDF files: |
---|
142 | !! i-component of the stress utau (N/m2) |
---|
143 | !! j-component of the stress vtau (N/m2) |
---|
144 | !! net downward heat flux qtot (watt/m2) |
---|
145 | !! net downward radiative flux qsr (watt/m2) |
---|
146 | !! net upward freshwater (evapo - precip) emp (kg/m2/s) |
---|
147 | !! Assumptions made: |
---|
148 | !! - each file content an entire year (read record, not the time axis) |
---|
149 | !! - first and last record are part of the previous and next year |
---|
150 | !! (useful for time interpolation) |
---|
151 | !! - the number of records is 2 + 365*24 / freqh(jf) |
---|
152 | !! or 366 in leap year case |
---|
153 | !! |
---|
154 | !! CAUTION : - never mask the surface stress fields |
---|
155 | !! - the stress is assumed to be in the mesh referential |
---|
156 | !! i.e. the (i,j) referential |
---|
157 | !! |
---|
158 | !! ** Action : update at each time-step |
---|
159 | !! - utau & vtau : stress components in (i,j) referential |
---|
160 | !! - qns : non solar heat flux |
---|
161 | !! - qsr : solar heat flux |
---|
162 | !! - emp : evap - precip (volume flux) |
---|
163 | !! - emps : evap - precip (concentration/dillution) |
---|
164 | !!---------------------------------------------------------------------- |
---|
165 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
166 | !! |
---|
167 | INTEGER :: ji, jj ! dummy indices |
---|
168 | REAL(wp) :: zcoef |
---|
169 | !! |
---|
170 | !!--------------------------------------------------------------------- |
---|
171 | ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 ) |
---|
172 | ! WARNING !!! ADJGENT NOT VALID if TAU is par of the state vector. |
---|
173 | zcoef = 0.5 / ( rhoa * cdrag ) |
---|
174 | wndm_ad(:,:) = 0.0_wp |
---|
175 | ! Initialization of emps (when no ice model) |
---|
176 | emp_ad (:,:) = emp_ad (:,:) + emps_ad(:,:) |
---|
177 | emps_ad(:,:) = 0.0_wp |
---|
178 | ! set the ocean fluxes from read fields |
---|
179 | !CDIR COLLAPSE |
---|
180 | DO jj = 1, jpj |
---|
181 | DO ji = 1, jpi |
---|
182 | utau_ad(ji,jj) = 0.0_wp |
---|
183 | vtau_ad(ji,jj) = 0.0_wp |
---|
184 | qns_ad (ji,jj) = 0.0_wp |
---|
185 | qsr_ad (ji,jj) = 0.0_wp |
---|
186 | emp_ad (ji,jj) = 0.0_wp |
---|
187 | END DO |
---|
188 | END DO |
---|
189 | ! |
---|
190 | END SUBROUTINE sbc_flx_adj |
---|
191 | SUBROUTINE sbc_flx_adj_tst( kumadt ) |
---|
192 | !!----------------------------------------------------------------------- |
---|
193 | !! |
---|
194 | !! *** ROUTINE sbc_flx_adj_tst *** |
---|
195 | !! |
---|
196 | !! ** Purpose : Test the adjoint routine. |
---|
197 | !! |
---|
198 | !! ** Method : Verify the scalar product |
---|
199 | !! |
---|
200 | !! ( L dx )^T W dy = dx^T L^T W dy |
---|
201 | !! |
---|
202 | !! where L = tangent routine |
---|
203 | !! L^T = adjoint routine |
---|
204 | !! W = diagonal matrix of scale factors |
---|
205 | !! dx = input perturbation (random field) |
---|
206 | !! dy = L dx |
---|
207 | !! |
---|
208 | !! |
---|
209 | !! History : |
---|
210 | !! ! 08-11 (A. Vidard) |
---|
211 | !!----------------------------------------------------------------------- |
---|
212 | !! * Modules used |
---|
213 | |
---|
214 | !! * Arguments |
---|
215 | INTEGER, INTENT(IN) :: & |
---|
216 | & kumadt ! Output unit |
---|
217 | |
---|
218 | ! adjoint is obvious, no need to test... |
---|
219 | END SUBROUTINE sbc_flx_adj_tst |
---|
220 | #endif |
---|
221 | !!====================================================================== |
---|
222 | END MODULE sbcflx_tam |
---|