1 | MODULE trddyn |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE trddyn *** |
---|
4 | !! Ocean diagnostics: ocean dynamic trends |
---|
5 | !!===================================================================== |
---|
6 | !! History : 3.5 ! 2012-02 (G. Madec) creation from trdmod: split DYN and TRA trends |
---|
7 | !! and manage 3D trends output for U, V, and KE |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | !! trd_dyn : manage the type of momentum trend diagnostics (3D I/O, domain averaged, KE) |
---|
12 | !! trd_dyn_iom : output 3D momentum and/or tracer trends using IOM |
---|
13 | !! trd_dyn_init : initialization step |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | USE oce ! ocean dynamics and tracers variables |
---|
16 | USE dom_oce ! ocean space and time domain variables |
---|
17 | USE phycst ! physical constants |
---|
18 | USE sbc_oce ! surface boundary condition: ocean |
---|
19 | USE zdf_oce ! ocean vertical physics: variables |
---|
20 | !!gm USE zdfdrg ! ocean vertical physics: bottom friction |
---|
21 | USE trd_oce ! trends: ocean variables |
---|
22 | USE trdken ! trends: Kinetic ENergy |
---|
23 | USE trdglo ! trends: global domain averaged |
---|
24 | USE trdvor ! trends: vertical averaged vorticity |
---|
25 | USE trdmxl ! trends: mixed layer averaged |
---|
26 | ! |
---|
27 | USE in_out_manager ! I/O manager |
---|
28 | USE lbclnk ! lateral boundary condition |
---|
29 | USE iom ! I/O manager library |
---|
30 | USE lib_mpp ! MPP library |
---|
31 | |
---|
32 | IMPLICIT NONE |
---|
33 | PRIVATE |
---|
34 | |
---|
35 | PUBLIC trd_dyn ! called by all dynXXX modules |
---|
36 | |
---|
37 | !! * Substitutions |
---|
38 | # include "vectopt_loop_substitute.h90" |
---|
39 | !!---------------------------------------------------------------------- |
---|
40 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
41 | !! $Id$ |
---|
42 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
43 | !!---------------------------------------------------------------------- |
---|
44 | CONTAINS |
---|
45 | |
---|
46 | SUBROUTINE trd_dyn( putrd, pvtrd, ktrd, kt ) |
---|
47 | !!--------------------------------------------------------------------- |
---|
48 | !! *** ROUTINE trd_mod *** |
---|
49 | !! |
---|
50 | !! ** Purpose : Dispatch momentum trend computation, e.g. 3D output, |
---|
51 | !! integral constraints, barotropic vorticity, kinetic enrgy, |
---|
52 | !! and/or mixed layer budget. |
---|
53 | !!---------------------------------------------------------------------- |
---|
54 | REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: putrd, pvtrd ! U and V trends |
---|
55 | INTEGER , INTENT(in ) :: ktrd ! trend index |
---|
56 | INTEGER , INTENT(in ) :: kt ! time step |
---|
57 | !!---------------------------------------------------------------------- |
---|
58 | ! |
---|
59 | putrd(:,:,:) = putrd(:,:,:) * umask(:,:,:) ! mask the trends |
---|
60 | pvtrd(:,:,:) = pvtrd(:,:,:) * vmask(:,:,:) |
---|
61 | ! |
---|
62 | |
---|
63 | !!gm NB : here a lbc_lnk should probably be added |
---|
64 | |
---|
65 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
66 | ! 3D output of momentum and/or tracers trends using IOM interface |
---|
67 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
68 | IF( ln_dyn_trd ) CALL trd_dyn_iom( putrd, pvtrd, ktrd, kt ) |
---|
69 | |
---|
70 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
71 | ! Integral Constraints Properties for momentum and/or tracers trends |
---|
72 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
73 | IF( ln_glo_trd ) CALL trd_glo( putrd, pvtrd, ktrd, 'DYN', kt ) |
---|
74 | |
---|
75 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
76 | ! Kinetic Energy trends |
---|
77 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
78 | IF( ln_KE_trd ) CALL trd_ken( putrd, pvtrd, ktrd, kt ) |
---|
79 | |
---|
80 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
81 | ! Vorticity trends |
---|
82 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
83 | IF( ln_vor_trd ) CALL trd_vor( putrd, pvtrd, ktrd, kt ) |
---|
84 | |
---|
85 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
86 | ! Mixed layer trends for active tracers |
---|
87 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
88 | !!gm IF( ln_dyn_mxl ) CALL trd_mxl_dyn |
---|
89 | ! |
---|
90 | END SUBROUTINE trd_dyn |
---|
91 | |
---|
92 | |
---|
93 | SUBROUTINE trd_dyn_iom( putrd, pvtrd, ktrd, kt ) |
---|
94 | !!--------------------------------------------------------------------- |
---|
95 | !! *** ROUTINE trd_dyn_iom *** |
---|
96 | !! |
---|
97 | !! ** Purpose : output 3D trends using IOM |
---|
98 | !!---------------------------------------------------------------------- |
---|
99 | REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: putrd, pvtrd ! U and V trends |
---|
100 | INTEGER , INTENT(in ) :: ktrd ! trend index |
---|
101 | INTEGER , INTENT(in ) :: kt ! time step |
---|
102 | ! |
---|
103 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
104 | INTEGER :: ikbu, ikbv ! local integers |
---|
105 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z2dx, z2dy ! 2D workspace |
---|
106 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: z3dx, z3dy ! 3D workspace |
---|
107 | !!---------------------------------------------------------------------- |
---|
108 | ! |
---|
109 | SELECT CASE( ktrd ) |
---|
110 | CASE( jpdyn_hpg ) ; CALL iom_put( "utrd_hpg", putrd ) ! hydrostatic pressure gradient |
---|
111 | CALL iom_put( "vtrd_hpg", pvtrd ) |
---|
112 | CASE( jpdyn_spg ) ; CALL iom_put( "utrd_spg", putrd ) ! surface pressure gradient |
---|
113 | CALL iom_put( "vtrd_spg", pvtrd ) |
---|
114 | CASE( jpdyn_pvo ) ; CALL iom_put( "utrd_pvo", putrd ) ! planetary vorticity |
---|
115 | CALL iom_put( "vtrd_pvo", pvtrd ) |
---|
116 | CASE( jpdyn_rvo ) ; CALL iom_put( "utrd_rvo", putrd ) ! relative vorticity (or metric term) |
---|
117 | CALL iom_put( "vtrd_rvo", pvtrd ) |
---|
118 | CASE( jpdyn_keg ) ; CALL iom_put( "utrd_keg", putrd ) ! Kinetic Energy gradient (or had) |
---|
119 | CALL iom_put( "vtrd_keg", pvtrd ) |
---|
120 | ALLOCATE( z3dx(jpi,jpj,jpk) , z3dy(jpi,jpj,jpk) ) |
---|
121 | z3dx(:,:,:) = 0._wp ! U.dxU & V.dyV (approximation) |
---|
122 | z3dy(:,:,:) = 0._wp |
---|
123 | DO jk = 1, jpkm1 ! no mask as un,vn are masked |
---|
124 | DO jj = 2, jpjm1 |
---|
125 | DO ji = 2, jpim1 |
---|
126 | z3dx(ji,jj,jk) = un(ji,jj,jk) * ( un(ji+1,jj,jk) - un(ji-1,jj,jk) ) / ( 2._wp * e1u(ji,jj) ) |
---|
127 | z3dy(ji,jj,jk) = vn(ji,jj,jk) * ( vn(ji,jj+1,jk) - vn(ji,jj-1,jk) ) / ( 2._wp * e2v(ji,jj) ) |
---|
128 | END DO |
---|
129 | END DO |
---|
130 | END DO |
---|
131 | CALL lbc_lnk_multi( 'trddyn', z3dx, 'U', -1., z3dy, 'V', -1. ) |
---|
132 | CALL iom_put( "utrd_udx", z3dx ) |
---|
133 | CALL iom_put( "vtrd_vdy", z3dy ) |
---|
134 | DEALLOCATE( z3dx , z3dy ) |
---|
135 | CASE( jpdyn_zad ) ; CALL iom_put( "utrd_zad", putrd ) ! vertical advection |
---|
136 | CALL iom_put( "vtrd_zad", pvtrd ) |
---|
137 | CASE( jpdyn_ldf ) ; CALL iom_put( "utrd_ldf", putrd ) ! lateral diffusion |
---|
138 | CALL iom_put( "vtrd_ldf", pvtrd ) |
---|
139 | CASE( jpdyn_zdf ) ; CALL iom_put( "utrd_zdf", putrd ) ! vertical diffusion |
---|
140 | CALL iom_put( "vtrd_zdf", pvtrd ) |
---|
141 | ! |
---|
142 | ! ! wind stress trends |
---|
143 | ALLOCATE( z2dx(jpi,jpj) , z2dy(jpi,jpj) ) |
---|
144 | z2dx(:,:) = ( utau_b(:,:) + utau(:,:) ) / ( e3u_n(:,:,1) * rau0 ) |
---|
145 | z2dy(:,:) = ( vtau_b(:,:) + vtau(:,:) ) / ( e3v_n(:,:,1) * rau0 ) |
---|
146 | CALL iom_put( "utrd_tau", z2dx ) |
---|
147 | CALL iom_put( "vtrd_tau", z2dy ) |
---|
148 | DEALLOCATE( z2dx , z2dy ) |
---|
149 | !!gm to be changed : computation should be done in dynzdf.F90 |
---|
150 | !!gm + missing the top friction |
---|
151 | ! ! ! bottom stress tends (implicit case) |
---|
152 | ! IF( ln_drgimp ) THEN |
---|
153 | ! ALLOCATE( z3dx(jpi,jpj,jpk) , z3dy(jpi,jpj,jpk) ) |
---|
154 | ! z3dx(:,:,:) = 0._wp ; z3dy(:,:,:) = 0._wp ! after velocity known (now filed at this stage) |
---|
155 | ! DO jk = 1, jpkm1 |
---|
156 | ! DO jj = 2, jpjm1 |
---|
157 | ! DO ji = 2, jpim1 |
---|
158 | ! ikbu = mbku(ji,jj) ! deepest ocean u- & v-levels |
---|
159 | ! ikbv = mbkv(ji,jj) |
---|
160 | ! z3dx(ji,jj,jk) = 0.5 * ( rCdU_bot(ji+1,jj) + rCdU_bot(ji,jj) ) & |
---|
161 | ! & * un(ji,jj,ikbu) / e3u_n(ji,jj,ikbu) |
---|
162 | ! z3dy(ji,jj,jk) = 0.5 * ( rCdU_bot(ji,jj+1) + rCdU_bot(ji,jj) ) & |
---|
163 | ! & * vn(ji,jj,ikbv) / e3v_n(ji,jj,ikbv) |
---|
164 | ! END DO |
---|
165 | ! END DO |
---|
166 | ! END DO |
---|
167 | ! CALL lbc_lnk_multi( 'trddyn', z3dx, 'U', -1., z3dy, 'V', -1. ) |
---|
168 | ! CALL iom_put( "utrd_bfr", z3dx ) |
---|
169 | ! CALL iom_put( "vtrd_bfr", z3dy ) |
---|
170 | ! DEALLOCATE( z3dx , z3dy ) |
---|
171 | ! ENDIF |
---|
172 | !!gm end |
---|
173 | CASE( jpdyn_bfr ) ! called if ln_drgimp=F |
---|
174 | CALL iom_put( "utrd_bfr", putrd ) ! bottom friction (explicit case) |
---|
175 | CALL iom_put( "vtrd_bfr", pvtrd ) |
---|
176 | CASE( jpdyn_atf ) ; CALL iom_put( "utrd_atf", putrd ) ! asselin filter trends |
---|
177 | CALL iom_put( "vtrd_atf", pvtrd ) |
---|
178 | END SELECT |
---|
179 | ! |
---|
180 | END SUBROUTINE trd_dyn_iom |
---|
181 | |
---|
182 | !!====================================================================== |
---|
183 | END MODULE trddyn |
---|