1 | MODULE dynldf_lap_blp |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE dynldf_lap_blp *** |
---|
4 | !! Ocean dynamics: lateral viscosity trend (laplacian and bilaplacian) |
---|
5 | !!====================================================================== |
---|
6 | !! History : 3.7 ! 2014-01 (G. Madec, S. Masson) Original code, re-entrant laplacian |
---|
7 | !!---------------------------------------------------------------------- |
---|
8 | |
---|
9 | !!---------------------------------------------------------------------- |
---|
10 | !! dyn_ldf_lap : update the momentum trend with the lateral viscosity using an iso-level laplacian operator |
---|
11 | !! dyn_ldf_blp : update the momentum trend with the lateral viscosity using an iso-level bilaplacian operator |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | USE oce ! ocean dynamics and tracers |
---|
14 | USE dom_oce ! ocean space and time domain |
---|
15 | USE ldfdyn ! lateral diffusion: eddy viscosity coef. |
---|
16 | USE ldfslp ! iso-neutral slopes |
---|
17 | USE zdf_oce ! ocean vertical physics |
---|
18 | ! |
---|
19 | USE in_out_manager ! I/O manager |
---|
20 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
21 | |
---|
22 | IMPLICIT NONE |
---|
23 | PRIVATE |
---|
24 | |
---|
25 | PUBLIC dyn_ldf_lap ! called by dynldf.F90 |
---|
26 | PUBLIC dyn_ldf_blp ! called by dynldf.F90 |
---|
27 | |
---|
28 | !! * Substitutions |
---|
29 | # include "vectopt_loop_substitute.h90" |
---|
30 | !!---------------------------------------------------------------------- |
---|
31 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
32 | !! $Id$ |
---|
33 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
34 | !!---------------------------------------------------------------------- |
---|
35 | CONTAINS |
---|
36 | |
---|
37 | SUBROUTINE dyn_ldf_lap( kt, pub, pvb, pua, pva, kpass ) |
---|
38 | !!---------------------------------------------------------------------- |
---|
39 | !! *** ROUTINE dyn_ldf_lap *** |
---|
40 | !! |
---|
41 | !! ** Purpose : Compute the before horizontal momentum diffusive |
---|
42 | !! trend and add it to the general trend of momentum equation. |
---|
43 | !! |
---|
44 | !! ** Method : The Laplacian operator apply on horizontal velocity is |
---|
45 | !! writen as : grad_h( ahmt div_h(U )) - curl_h( ahmf curl_z(U) ) |
---|
46 | !! |
---|
47 | !! ** Action : - pua, pva increased by the harmonic operator applied on pub, pvb. |
---|
48 | !!---------------------------------------------------------------------- |
---|
49 | INTEGER , INTENT(in ) :: kt ! ocean time-step index |
---|
50 | INTEGER , INTENT(in ) :: kpass ! =1/2 first or second passage |
---|
51 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pub, pvb ! before velocity [m/s] |
---|
52 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pua, pva ! velocity trend [m/s2] |
---|
53 | ! |
---|
54 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
55 | REAL(wp) :: zsign ! local scalars |
---|
56 | REAL(wp) :: zua, zva ! local scalars |
---|
57 | REAL(wp), DIMENSION(jpi,jpj) :: zcur, zdiv |
---|
58 | ! REAL(wp), ALLOCATABLE, DIMENSION(:, :) :: zcur, zdiv |
---|
59 | !!---------------------------------------------------------------------- |
---|
60 | ! |
---|
61 | IF( kt == nit000 ) THEN |
---|
62 | IF(lwp) THEN |
---|
63 | WRITE(numout,*) |
---|
64 | WRITE(numout,*) 'dyn_ldf : iso-level harmonic (laplacian) operator, pass=', kpass |
---|
65 | WRITE(numout,*) '~~~~~~~ ' |
---|
66 | ENDIF |
---|
67 | ! ALLOCATE(zcur(jpi,jpj), zdiv(jpi,jpj)) |
---|
68 | ENDIF |
---|
69 | ! |
---|
70 | IF( kpass == 1 ) THEN ; zsign = 1._wp ! bilaplacian operator require a minus sign |
---|
71 | ELSE ; zsign = -1._wp ! (eddy viscosity coef. >0) |
---|
72 | ENDIF |
---|
73 | ! |
---|
74 | ! ! =============== |
---|
75 | DO jk = 1, jpkm1 ! Horizontal slab |
---|
76 | ! ! =============== |
---|
77 | DO jj = 2, jpj |
---|
78 | DO ji = fs_2, jpi ! vector opt. |
---|
79 | ! ! ahm * e3 * curl (computed from 1 to jpim1/jpjm1) |
---|
80 | !!gm open question here : e3f at before or now ? probably now... |
---|
81 | !!gm note that ahmf has already been multiplied by fmask |
---|
82 | zcur(ji-1,jj-1) = ahmf(ji-1,jj-1,jk) * e3f_n(ji-1,jj-1,jk) * r1_e1e2f(ji-1,jj-1) & |
---|
83 | & * ( e2v(ji ,jj-1) * pvb(ji ,jj-1,jk) - e2v(ji-1,jj-1) * pvb(ji-1,jj-1,jk) & |
---|
84 | & - e1u(ji-1,jj ) * pub(ji-1,jj ,jk) + e1u(ji-1,jj-1) * pub(ji-1,jj-1,jk) ) |
---|
85 | ! ! ahm * div (computed from 2 to jpi/jpj) |
---|
86 | !!gm note that ahmt has already been multiplied by tmask |
---|
87 | zdiv(ji,jj) = ahmt(ji,jj,jk) * r1_e1e2t(ji,jj) / e3t_b(ji,jj,jk) & |
---|
88 | & * ( e2u(ji,jj)*e3u_b(ji,jj,jk) * pub(ji,jj,jk) - e2u(ji-1,jj)*e3u_b(ji-1,jj,jk) * pub(ji-1,jj,jk) & |
---|
89 | & + e1v(ji,jj)*e3v_b(ji,jj,jk) * pvb(ji,jj,jk) - e1v(ji,jj-1)*e3v_b(ji,jj-1,jk) * pvb(ji,jj-1,jk) ) |
---|
90 | END DO |
---|
91 | END DO |
---|
92 | ! |
---|
93 | DO jj = 2, jpjm1 ! - curl( curl) + grad( div ) |
---|
94 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
95 | pua(ji,jj,jk) = pua(ji,jj,jk) + zsign * ( & |
---|
96 | & - ( zcur(ji ,jj) - zcur(ji,jj-1) ) * r1_e2u(ji,jj) / e3u_n(ji,jj,jk) & |
---|
97 | & + ( zdiv(ji+1,jj) - zdiv(ji,jj ) ) * r1_e1u(ji,jj) ) |
---|
98 | ! |
---|
99 | pva(ji,jj,jk) = pva(ji,jj,jk) + zsign * ( & |
---|
100 | & ( zcur(ji,jj ) - zcur(ji-1,jj) ) * r1_e1v(ji,jj) / e3v_n(ji,jj,jk) & |
---|
101 | & + ( zdiv(ji,jj+1) - zdiv(ji ,jj) ) * r1_e2v(ji,jj) ) |
---|
102 | END DO |
---|
103 | END DO |
---|
104 | ! ! =============== |
---|
105 | END DO ! End of slab |
---|
106 | ! ! =============== |
---|
107 | ! |
---|
108 | END SUBROUTINE dyn_ldf_lap |
---|
109 | |
---|
110 | |
---|
111 | SUBROUTINE dyn_ldf_blp( kt, pub, pvb, pua, pva ) |
---|
112 | !!---------------------------------------------------------------------- |
---|
113 | !! *** ROUTINE dyn_ldf_blp *** |
---|
114 | !! |
---|
115 | !! ** Purpose : Compute the before lateral momentum viscous trend |
---|
116 | !! and add it to the general trend of momentum equation. |
---|
117 | !! |
---|
118 | !! ** Method : The lateral viscous trends is provided by a bilaplacian |
---|
119 | !! operator applied to before field (forward in time). |
---|
120 | !! It is computed by two successive calls to dyn_ldf_lap routine |
---|
121 | !! |
---|
122 | !! ** Action : pta updated with the before rotated bilaplacian diffusion |
---|
123 | !!---------------------------------------------------------------------- |
---|
124 | INTEGER , INTENT(in ) :: kt ! ocean time-step index |
---|
125 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pub, pvb ! before velocity fields |
---|
126 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) :: pua, pva ! momentum trend |
---|
127 | ! |
---|
128 | ! REAL(wp), DIMENSION(jpi,jpj,jpk) :: zulap, zvlap ! laplacian at u- and v-point |
---|
129 | REAL(wp), ALLOCATABLE, DIMENSION(:, :, :) :: zulap, zvlap |
---|
130 | !!---------------------------------------------------------------------- |
---|
131 | ! |
---|
132 | IF( kt == nit000 ) THEN |
---|
133 | IF(lwp) WRITE(numout,*) |
---|
134 | IF(lwp) WRITE(numout,*) 'dyn_ldf_blp : bilaplacian operator momentum ' |
---|
135 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' |
---|
136 | ALLOCATE(zulap(jpi,jpj,jpk), zvlap(jpi,jpj,jpk)) |
---|
137 | ENDIF |
---|
138 | ! |
---|
139 | zulap(:,:,:) = 0._wp |
---|
140 | zvlap(:,:,:) = 0._wp |
---|
141 | ! |
---|
142 | CALL dyn_ldf_lap( kt, pub, pvb, zulap, zvlap, 1 ) ! rotated laplacian applied to ptb (output in zlap) |
---|
143 | ! |
---|
144 | CALL lbc_lnk_multi( 'dynldf_lap_blp', zulap, 'U', -1., zvlap, 'V', -1. ) ! Lateral boundary conditions |
---|
145 | ! |
---|
146 | CALL dyn_ldf_lap( kt, zulap, zvlap, pua, pva, 2 ) ! rotated laplacian applied to zlap (output in pta) |
---|
147 | ! |
---|
148 | END SUBROUTINE dyn_ldf_blp |
---|
149 | |
---|
150 | !!====================================================================== |
---|
151 | END MODULE dynldf_lap_blp |
---|