1 | MODULE ldfdyn |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE ldfdyn *** |
---|
4 | !! Ocean physics: lateral viscosity coefficient |
---|
5 | !!===================================================================== |
---|
6 | !! History : OPA ! 1997-07 (G. Madec) multi dimensional coefficients |
---|
7 | !! NEMO 1.0 ! 2002-09 (G. Madec) F90: Free form and module |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | !! ldf_dyn_init : initialization, namelist read, and parameters control |
---|
12 | !! ldf_dyn_c3d : 3D eddy viscosity coefficient initialization |
---|
13 | !! ldf_dyn_c2d : 2D eddy viscosity coefficient initialization |
---|
14 | !! ldf_dyn_c1d : 1D eddy viscosity coefficient initialization |
---|
15 | !!---------------------------------------------------------------------- |
---|
16 | USE oce ! ocean dynamics and tracers |
---|
17 | USE dom_oce ! ocean space and time domain |
---|
18 | USE ldfdyn_oce ! ocean dynamics lateral physics |
---|
19 | USE phycst ! physical constants |
---|
20 | USE ldfslp ! ??? |
---|
21 | USE ioipsl |
---|
22 | USE in_out_manager ! I/O manager |
---|
23 | USE lib_mpp ! distribued memory computing library |
---|
24 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
25 | USE wrk_nemo ! Memory Allocation |
---|
26 | |
---|
27 | IMPLICIT NONE |
---|
28 | PRIVATE |
---|
29 | |
---|
30 | PUBLIC ldf_dyn_init ! called by opa.F90 |
---|
31 | |
---|
32 | INTERFACE ldf_zpf |
---|
33 | MODULE PROCEDURE ldf_zpf_1d, ldf_zpf_1d_3d, ldf_zpf_3d |
---|
34 | END INTERFACE |
---|
35 | |
---|
36 | !! * Substitutions |
---|
37 | # include "domzgr_substitute.h90" |
---|
38 | !!---------------------------------------------------------------------- |
---|
39 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
40 | !! $Id$ |
---|
41 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
42 | !!---------------------------------------------------------------------- |
---|
43 | CONTAINS |
---|
44 | |
---|
45 | SUBROUTINE ldf_dyn_init |
---|
46 | !!---------------------------------------------------------------------- |
---|
47 | !! *** ROUTINE ldf_dyn_init *** |
---|
48 | !! |
---|
49 | !! ** Purpose : set the horizontal ocean dynamics physics |
---|
50 | !! |
---|
51 | !! ** Method : |
---|
52 | !! - default option : ahm = constant coef. = rn_ahm_0 (namelist) |
---|
53 | !! - 'key_dynldf_c1d': ahm = F(depth) see ldf_dyn_c1d.h90 |
---|
54 | !! - 'key_dynldf_c2d': ahm = F(latitude,longitude) see ldf_dyn_c2d.h90 |
---|
55 | !! - 'key_dynldf_c3d': ahm = F(latitude,longitude,depth) see ldf_dyn_c3d.h90 |
---|
56 | !! |
---|
57 | !! N.B. User defined include files. By default, 3d and 2d coef. |
---|
58 | !! are set to a constant value given in the namelist and the 1d |
---|
59 | !! coefficients are initialized to a hyperbolic tangent vertical |
---|
60 | !! profile. |
---|
61 | !! |
---|
62 | !! Reference : Madec, G. and M. Imbard, 1996: Climate Dynamics, 12, 381-388. |
---|
63 | !!---------------------------------------------------------------------- |
---|
64 | INTEGER :: ioptio ! ??? |
---|
65 | LOGICAL :: ll_print = .FALSE. ! Logical flag for printing viscosity coef. |
---|
66 | !! |
---|
67 | NAMELIST/namdyn_ldf/ ln_dynldf_lap , ln_dynldf_bilap, & |
---|
68 | & ln_dynldf_level, ln_dynldf_hor , ln_dynldf_iso, & |
---|
69 | & rn_ahm_0_lap , rn_ahmb_0 , rn_ahm_0_blp |
---|
70 | !!---------------------------------------------------------------------- |
---|
71 | |
---|
72 | REWIND( numnam ) ! Read Namelist namdyn_ldf : Lateral physics |
---|
73 | READ ( numnam, namdyn_ldf ) |
---|
74 | |
---|
75 | IF(lwp) THEN ! Parameter print |
---|
76 | WRITE(numout,*) |
---|
77 | WRITE(numout,*) 'ldf_dyn : lateral momentum physics' |
---|
78 | WRITE(numout,*) '~~~~~~~' |
---|
79 | WRITE(numout,*) ' Namelist nam_dynldf : set lateral mixing parameters' |
---|
80 | WRITE(numout,*) ' laplacian operator ln_dynldf_lap = ', ln_dynldf_lap |
---|
81 | WRITE(numout,*) ' bilaplacian operator ln_dynldf_bilap = ', ln_dynldf_bilap |
---|
82 | WRITE(numout,*) ' iso-level ln_dynldf_level = ', ln_dynldf_level |
---|
83 | WRITE(numout,*) ' horizontal (geopotential) ln_dynldf_hor = ', ln_dynldf_hor |
---|
84 | WRITE(numout,*) ' iso-neutral ln_dynldf_iso = ', ln_dynldf_iso |
---|
85 | WRITE(numout,*) ' horizontal laplacian eddy viscosity rn_ahm_0_lap = ', rn_ahm_0_lap |
---|
86 | WRITE(numout,*) ' background viscosity rn_ahmb_0 = ', rn_ahmb_0 |
---|
87 | WRITE(numout,*) ' horizontal bilaplacian eddy viscosity rn_ahm_0_blp = ', rn_ahm_0_blp |
---|
88 | ENDIF |
---|
89 | |
---|
90 | ahm0 = rn_ahm_0_lap ! OLD namelist variables defined from DOCTOR namelist variables |
---|
91 | ahmb0 = rn_ahmb_0 |
---|
92 | ahm0_blp = rn_ahm_0_blp |
---|
93 | |
---|
94 | ! ... check of lateral diffusive operator on tracers |
---|
95 | ! ==> will be done in trazdf module |
---|
96 | |
---|
97 | ! ... Space variation of eddy coefficients |
---|
98 | ioptio = 0 |
---|
99 | #if defined key_dynldf_c3d |
---|
100 | IF(lwp) WRITE(numout,*) ' momentum mixing coef. = F( latitude, longitude, depth)' |
---|
101 | ioptio = ioptio+1 |
---|
102 | #endif |
---|
103 | #if defined key_dynldf_c2d |
---|
104 | IF(lwp) WRITE(numout,*) ' momentum mixing coef. = F( latitude, longitude)' |
---|
105 | ioptio = ioptio+1 |
---|
106 | #endif |
---|
107 | #if defined key_dynldf_c1d |
---|
108 | IF(lwp) WRITE(numout,*) ' momentum mixing coef. = F( depth )' |
---|
109 | ioptio = ioptio+1 |
---|
110 | IF( ln_sco ) CALL ctl_stop( 'key_dynldf_c1d cannot be used in s-coordinate (ln_sco)' ) |
---|
111 | #endif |
---|
112 | IF( ioptio == 0 ) THEN |
---|
113 | IF(lwp) WRITE(numout,*) ' momentum mixing coef. = constant (default option)' |
---|
114 | ELSEIF( ioptio > 1 ) THEN |
---|
115 | CALL ctl_stop( 'use only one of the following keys: key_dynldf_c3d, key_dynldf_c2d, key_dynldf_c1d' ) |
---|
116 | ENDIF |
---|
117 | |
---|
118 | |
---|
119 | IF( ln_dynldf_bilap ) THEN |
---|
120 | IF(lwp) WRITE(numout,*) ' biharmonic momentum diffusion' |
---|
121 | IF( .NOT. ln_dynldf_lap ) ahm0 = ahm0_blp ! Allow spatially varying coefs, which use ahm0 as input |
---|
122 | IF( ahm0_blp > 0 .AND. .NOT. lk_esopa ) CALL ctl_stop( 'The horizontal viscosity coef. ahm0 must be negative' ) |
---|
123 | ELSE |
---|
124 | IF(lwp) WRITE(numout,*) ' harmonic momentum diff. (default)' |
---|
125 | IF( ahm0 < 0 .AND. .NOT. lk_esopa ) CALL ctl_stop( 'The horizontal viscosity coef. ahm0 must be positive' ) |
---|
126 | ENDIF |
---|
127 | |
---|
128 | |
---|
129 | ! Lateral eddy viscosity |
---|
130 | ! ====================== |
---|
131 | #if defined key_dynldf_c3d |
---|
132 | CALL ldf_dyn_c3d( ll_print ) ! ahm = 3D coef. = F( longitude, latitude, depth ) |
---|
133 | #elif defined key_dynldf_c2d |
---|
134 | CALL ldf_dyn_c2d( ll_print ) ! ahm = 1D coef. = F( longitude, latitude ) |
---|
135 | #elif defined key_dynldf_c1d |
---|
136 | CALL ldf_dyn_c1d( ll_print ) ! ahm = 1D coef. = F( depth ) |
---|
137 | #else |
---|
138 | ! Constant coefficients |
---|
139 | IF(lwp) WRITE(numout,*) |
---|
140 | IF(lwp) WRITE(numout,*) 'inildf: constant eddy viscosity coef. ' |
---|
141 | IF(lwp) WRITE(numout,*) '~~~~~~' |
---|
142 | IF(lwp) WRITE(numout,*) ' ahm1 = ahm2 = ahm0 = ',ahm0 |
---|
143 | #endif |
---|
144 | ! |
---|
145 | END SUBROUTINE ldf_dyn_init |
---|
146 | |
---|
147 | #if defined key_dynldf_c3d |
---|
148 | # include "ldfdyn_c3d.h90" |
---|
149 | #elif defined key_dynldf_c2d |
---|
150 | # include "ldfdyn_c2d.h90" |
---|
151 | #elif defined key_dynldf_c1d |
---|
152 | # include "ldfdyn_c1d.h90" |
---|
153 | #endif |
---|
154 | |
---|
155 | |
---|
156 | SUBROUTINE ldf_zpf_1d( ld_print, pdam, pwam, pbot, pdep, pah ) |
---|
157 | !!---------------------------------------------------------------------- |
---|
158 | !! *** ROUTINE ldf_zpf *** |
---|
159 | !! |
---|
160 | !! ** Purpose : vertical adimensional profile for eddy coefficient |
---|
161 | !! |
---|
162 | !! ** Method : 1D eddy viscosity coefficients ( depth ) |
---|
163 | !!---------------------------------------------------------------------- |
---|
164 | LOGICAL , INTENT(in ) :: ld_print ! If true, output arrays on numout |
---|
165 | REAL(wp), INTENT(in ) :: pdam ! depth of the inflection point |
---|
166 | REAL(wp), INTENT(in ) :: pwam ! width of inflection |
---|
167 | REAL(wp), INTENT(in ) :: pbot ! bottom value (0<pbot<= 1) |
---|
168 | REAL(wp), INTENT(in ), DIMENSION(jpk) :: pdep ! depth of the gridpoint (T, U, V, F) |
---|
169 | REAL(wp), INTENT(inout), DIMENSION(jpk) :: pah ! adimensional vertical profile |
---|
170 | !! |
---|
171 | INTEGER :: jk ! dummy loop indices |
---|
172 | REAL(wp) :: zm00, zm01, zmhb, zmhs ! temporary scalars |
---|
173 | !!---------------------------------------------------------------------- |
---|
174 | |
---|
175 | zm00 = TANH( ( pdam - gdept_0(1 ) ) / pwam ) |
---|
176 | zm01 = TANH( ( pdam - gdept_0(jpkm1) ) / pwam ) |
---|
177 | zmhs = zm00 / zm01 |
---|
178 | zmhb = ( 1.e0 - pbot ) / ( 1.e0 - zmhs ) / zm01 |
---|
179 | |
---|
180 | DO jk = 1, jpk |
---|
181 | pah(jk) = 1.e0 + zmhb * ( zm00 - TANH( ( pdam - pdep(jk) ) / pwam ) ) |
---|
182 | END DO |
---|
183 | |
---|
184 | IF(lwp .AND. ld_print ) THEN ! Control print |
---|
185 | WRITE(numout,*) |
---|
186 | WRITE(numout,*) ' ahm profile : ' |
---|
187 | WRITE(numout,*) |
---|
188 | WRITE(numout,'(" jk ahm "," depth t-level " )') |
---|
189 | DO jk = 1, jpk |
---|
190 | WRITE(numout,'(i6,2f12.4,3x,2f12.4)') jk, pah(jk), pdep(jk) |
---|
191 | END DO |
---|
192 | ENDIF |
---|
193 | ! |
---|
194 | END SUBROUTINE ldf_zpf_1d |
---|
195 | |
---|
196 | |
---|
197 | SUBROUTINE ldf_zpf_1d_3d( ld_print, pdam, pwam, pbot, pdep, pah ) |
---|
198 | !!---------------------------------------------------------------------- |
---|
199 | !! *** ROUTINE ldf_zpf *** |
---|
200 | !! |
---|
201 | !! ** Purpose : vertical adimensional profile for eddy coefficient |
---|
202 | !! |
---|
203 | !! ** Method : 1D eddy viscosity coefficients ( depth ) |
---|
204 | !!---------------------------------------------------------------------- |
---|
205 | LOGICAL , INTENT(in ) :: ld_print ! If true, output arrays on numout |
---|
206 | REAL(wp), INTENT(in ) :: pdam ! depth of the inflection point |
---|
207 | REAL(wp), INTENT(in ) :: pwam ! width of inflection |
---|
208 | REAL(wp), INTENT(in ) :: pbot ! bottom value (0<pbot<= 1) |
---|
209 | REAL(wp), INTENT(in ), DIMENSION (:) :: pdep ! depth of the gridpoint (T, U, V, F) |
---|
210 | REAL(wp), INTENT(inout), DIMENSION (:,:,:) :: pah ! adimensional vertical profile |
---|
211 | !! |
---|
212 | INTEGER :: jk ! dummy loop indices |
---|
213 | REAL(wp) :: zm00, zm01, zmhb, zmhs, zcf ! temporary scalars |
---|
214 | !!---------------------------------------------------------------------- |
---|
215 | |
---|
216 | zm00 = TANH( ( pdam - gdept_0(1 ) ) / pwam ) |
---|
217 | zm01 = TANH( ( pdam - gdept_0(jpkm1) ) / pwam ) |
---|
218 | zmhs = zm00 / zm01 |
---|
219 | zmhb = ( 1.e0 - pbot ) / ( 1.e0 - zmhs ) / zm01 |
---|
220 | |
---|
221 | DO jk = 1, jpk |
---|
222 | zcf = 1.e0 + zmhb * ( zm00 - TANH( ( pdam - pdep(jk) ) / pwam ) ) |
---|
223 | pah(:,:,jk) = zcf |
---|
224 | END DO |
---|
225 | |
---|
226 | IF(lwp .AND. ld_print ) THEN ! Control print |
---|
227 | WRITE(numout,*) |
---|
228 | WRITE(numout,*) ' ahm profile : ' |
---|
229 | WRITE(numout,*) |
---|
230 | WRITE(numout,'(" jk ahm "," depth t-level " )') |
---|
231 | DO jk = 1, jpk |
---|
232 | WRITE(numout,'(i6,2f12.4,3x,2f12.4)') jk, pah(1,1,jk), pdep(jk) |
---|
233 | END DO |
---|
234 | ENDIF |
---|
235 | ! |
---|
236 | END SUBROUTINE ldf_zpf_1d_3d |
---|
237 | |
---|
238 | |
---|
239 | SUBROUTINE ldf_zpf_3d( ld_print, pdam, pwam, pbot, pdep, pah ) |
---|
240 | !!---------------------------------------------------------------------- |
---|
241 | !! *** ROUTINE ldf_zpf *** |
---|
242 | !! |
---|
243 | !! ** Purpose : vertical adimensional profile for eddy coefficient |
---|
244 | !! |
---|
245 | !! ** Method : 3D for partial step or s-coordinate |
---|
246 | !!---------------------------------------------------------------------- |
---|
247 | LOGICAL , INTENT(in ) :: ld_print ! If true, output arrays on numout |
---|
248 | REAL(wp), INTENT(in ) :: pdam ! depth of the inflection point |
---|
249 | REAL(wp), INTENT(in ) :: pwam ! width of inflection |
---|
250 | REAL(wp), INTENT(in ) :: pbot ! bottom value (0<pbot<= 1) |
---|
251 | REAL(wp), INTENT(in ), DIMENSION (:,:,:) :: pdep ! dep of the gridpoint (T, U, V, F) |
---|
252 | REAL(wp), INTENT(inout), DIMENSION (:,:,:) :: pah ! adimensional vertical profile |
---|
253 | !! |
---|
254 | INTEGER :: jk ! dummy loop indices |
---|
255 | REAL(wp) :: zm00, zm01, zmhb, zmhs ! temporary scalars |
---|
256 | !!---------------------------------------------------------------------- |
---|
257 | |
---|
258 | zm00 = TANH( ( pdam - gdept_0(1 ) ) / pwam ) |
---|
259 | zm01 = TANH( ( pdam - gdept_0(jpkm1) ) / pwam ) |
---|
260 | zmhs = zm00 / zm01 |
---|
261 | zmhb = ( 1.e0 - pbot ) / ( 1.e0 - zmhs ) / zm01 |
---|
262 | |
---|
263 | DO jk = 1, jpk |
---|
264 | pah(:,:,jk) = 1.e0 + zmhb * ( zm00 - TANH( ( pdam - pdep(:,:,jk) ) / pwam ) ) |
---|
265 | END DO |
---|
266 | |
---|
267 | IF(lwp .AND. ld_print ) THEN ! Control print |
---|
268 | WRITE(numout,*) |
---|
269 | WRITE(numout,*) ' ahm profile : ' |
---|
270 | WRITE(numout,*) |
---|
271 | WRITE(numout,'(" jk ahm "," depth t-level " )') |
---|
272 | DO jk = 1, jpk |
---|
273 | WRITE(numout,'(i6,2f12.4,3x,2f12.4)') jk, pah(1,1,jk), pdep(1,1,jk) |
---|
274 | END DO |
---|
275 | ENDIF |
---|
276 | ! |
---|
277 | END SUBROUTINE ldf_zpf_3d |
---|
278 | |
---|
279 | !!====================================================================== |
---|
280 | END MODULE ldfdyn |
---|