1 | MODULE trcdmp |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE trcdmp *** |
---|
4 | !! Ocean physics: internal restoring trend on passive tracers |
---|
5 | !!====================================================================== |
---|
6 | !! History : OPA ! 1991-03 (O. Marti, G. Madec) Original code |
---|
7 | !! ! 1996-01 (G. Madec) statement function for e3 |
---|
8 | !! ! 1997-05 (H. Loukos) adapted for passive tracers |
---|
9 | !! NEMO 9.0 ! 2004-03 (C. Ethe) free form + modules |
---|
10 | !! 3.2 ! 2007-02 (C. Deltel) Diagnose ML trends for passive tracers |
---|
11 | !! 3.3 ! 2010-06 (C. Ethe, G. Madec) merge TRA-TRC |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | #if defined key_top && defined key_trcdmp |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | !! key_trcdmp internal damping |
---|
16 | !!---------------------------------------------------------------------- |
---|
17 | !! trc_dmp : update the tracer trend with the internal damping |
---|
18 | !! trc_dmp_init : initialization, namlist read, parameters control |
---|
19 | !!---------------------------------------------------------------------- |
---|
20 | USE oce_trc ! ocean dynamics and tracers variables |
---|
21 | USE trc ! ocean passive tracers variables |
---|
22 | USE trcnam_trp ! passive tracers transport namelist variables |
---|
23 | USE trcdta |
---|
24 | USE tradmp |
---|
25 | USE prtctl_trc ! Print control for debbuging |
---|
26 | USE trdtra |
---|
27 | |
---|
28 | IMPLICIT NONE |
---|
29 | PRIVATE |
---|
30 | |
---|
31 | PUBLIC trc_dmp ! routine called by step.F90 |
---|
32 | PUBLIC trc_dmp_alloc ! routine called by nemogcm.F90 |
---|
33 | |
---|
34 | LOGICAL , PUBLIC, PARAMETER :: lk_trcdmp = .TRUE. !: internal damping flag |
---|
35 | |
---|
36 | ! !!* Namelist namtrc_dmp : passive tracer newtonian damping * |
---|
37 | INTEGER :: nn_hdmp_tr = -1 ! = 0/-1/'latitude' for damping over passive tracer |
---|
38 | INTEGER :: nn_zdmp_tr = 0 ! = 0/1/2 flag for damping in the mixed layer |
---|
39 | REAL(wp) :: rn_surf_tr = 50. ! surface time scale for internal damping [days] |
---|
40 | REAL(wp) :: rn_bot_tr = 360. ! bottom time scale for internal damping [days] |
---|
41 | REAL(wp) :: rn_dep_tr = 800. ! depth of transition between rn_surf and rn_bot [meters] |
---|
42 | INTEGER :: nn_file_tr = 2 ! = 1 create a damping.coeff NetCDF file |
---|
43 | |
---|
44 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: restotr ! restoring coeff. on tracers (s-1) |
---|
45 | |
---|
46 | !! * Substitutions |
---|
47 | # include "top_substitute.h90" |
---|
48 | !!---------------------------------------------------------------------- |
---|
49 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
50 | !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/TRP/trcdmp.F90,v 1.11 2006/09/01 14:03:49 opalod Exp $ |
---|
51 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
52 | !!---------------------------------------------------------------------- |
---|
53 | CONTAINS |
---|
54 | |
---|
55 | INTEGER FUNCTION trc_dmp_alloc() |
---|
56 | !!---------------------------------------------------------------------- |
---|
57 | !! *** ROUTINE trc_dmp_alloc *** |
---|
58 | !!---------------------------------------------------------------------- |
---|
59 | ALLOCATE( restotr(jpi,jpj,jpk) , STAT=trc_dmp_alloc ) |
---|
60 | ! |
---|
61 | IF( trc_dmp_alloc /= 0 ) CALL ctl_warn('trc_dmp_alloc: failed to allocate array') |
---|
62 | ! |
---|
63 | END FUNCTION trc_dmp_alloc |
---|
64 | |
---|
65 | |
---|
66 | SUBROUTINE trc_dmp( kt ) |
---|
67 | !!---------------------------------------------------------------------- |
---|
68 | !! *** ROUTINE trc_dmp *** |
---|
69 | !! |
---|
70 | !! ** Purpose : Compute the passive tracer trend due to a newtonian damping |
---|
71 | !! of the tracer field towards given data field and add it to the |
---|
72 | !! general tracer trends. |
---|
73 | !! |
---|
74 | !! ** Method : Newtonian damping towards trdta computed |
---|
75 | !! and add to the general tracer trends: |
---|
76 | !! trn = tra + restotr * (trdta - trb) |
---|
77 | !! The trend is computed either throughout the water column |
---|
78 | !! (nlmdmptr=0) or in area of weak vertical mixing (nlmdmptr=1) or |
---|
79 | !! below the well mixed layer (nlmdmptr=2) |
---|
80 | !! |
---|
81 | !! ** Action : - update the tracer trends tra with the newtonian |
---|
82 | !! damping trends. |
---|
83 | !! - save the trends ('key_trdmld_trc') |
---|
84 | !!---------------------------------------------------------------------- |
---|
85 | !! |
---|
86 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
87 | !! |
---|
88 | INTEGER :: ji, jj, jk, jn ! dummy loop indices |
---|
89 | REAL(wp) :: ztra ! temporary scalars |
---|
90 | CHARACTER (len=22) :: charout |
---|
91 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ztrtrd |
---|
92 | !!---------------------------------------------------------------------- |
---|
93 | |
---|
94 | ! 0. Initialization (first time-step only) |
---|
95 | ! -------------- |
---|
96 | IF( kt == nit000 ) CALL trc_dmp_init |
---|
97 | |
---|
98 | IF( l_trdtrc ) ALLOCATE( ztrtrd(jpi,jpj,jpk) ) ! temporary save of trends |
---|
99 | |
---|
100 | ! 1. Newtonian damping trends on tracer fields |
---|
101 | ! -------------------------------------------- |
---|
102 | ! Initialize the input fields for newtonian damping |
---|
103 | CALL trc_dta( kt ) |
---|
104 | ! ! =========== |
---|
105 | DO jn = 1, jptra ! tracer loop |
---|
106 | ! ! =========== |
---|
107 | IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn) ! save trends |
---|
108 | |
---|
109 | IF( lutini(jn) ) THEN |
---|
110 | ! |
---|
111 | SELECT CASE ( nn_zdmp_trc ) |
---|
112 | ! |
---|
113 | CASE( 0 ) !== newtonian damping throughout the water column ==! |
---|
114 | DO jk = 1, jpkm1 |
---|
115 | DO jj = 2, jpjm1 |
---|
116 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
117 | ztra = restotr(ji,jj,jk) * ( trdta(ji,jj,jk,jn) - trb(ji,jj,jk,jn) ) |
---|
118 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
119 | END DO |
---|
120 | END DO |
---|
121 | END DO |
---|
122 | ! |
---|
123 | CASE ( 1 ) !== no damping in the turbocline (avt > 5 cm2/s) ==! |
---|
124 | DO jk = 1, jpkm1 |
---|
125 | DO jj = 2, jpjm1 |
---|
126 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
127 | IF( avt(ji,jj,jk) <= 5.e-4 ) THEN |
---|
128 | ztra = restotr(ji,jj,jk) * ( trdta(ji,jj,jk,jn) - trb(ji,jj,jk,jn) ) |
---|
129 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
130 | ENDIF |
---|
131 | END DO |
---|
132 | END DO |
---|
133 | END DO |
---|
134 | ! |
---|
135 | CASE ( 2 ) !== no damping in the mixed layer ==! |
---|
136 | DO jk = 1, jpkm1 |
---|
137 | DO jj = 2, jpjm1 |
---|
138 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
139 | IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN |
---|
140 | ztra = restotr(ji,jj,jk,jn) * ( trdta(ji,jj,jk,jn) - trb(ji,jj,jk,jn) ) |
---|
141 | tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra |
---|
142 | END IF |
---|
143 | END DO |
---|
144 | END DO |
---|
145 | END DO |
---|
146 | ! |
---|
147 | END SELECT |
---|
148 | ! |
---|
149 | ENDIF |
---|
150 | ! |
---|
151 | IF( l_trdtrc ) THEN |
---|
152 | ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:) |
---|
153 | CALL trd_tra( kt, 'TRC', jn, jptra_trd_dmp, ztrtrd ) |
---|
154 | END IF |
---|
155 | ! ! =========== |
---|
156 | END DO ! tracer loop |
---|
157 | ! ! =========== |
---|
158 | IF( l_trdtrc ) DEALLOCATE( ztrtrd ) |
---|
159 | ! ! print mean trends (used for debugging) |
---|
160 | IF( ln_ctl ) THEN |
---|
161 | WRITE(charout, FMT="('dmp ')") ; CALL prt_ctl_trc_info(charout) |
---|
162 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
163 | ENDIF |
---|
164 | ! |
---|
165 | END SUBROUTINE trc_dmp |
---|
166 | |
---|
167 | |
---|
168 | SUBROUTINE trc_dmp_init |
---|
169 | !!---------------------------------------------------------------------- |
---|
170 | !! *** ROUTINE trc_dmp_init *** |
---|
171 | !! |
---|
172 | !! ** Purpose : Initialization for the newtonian damping |
---|
173 | !! |
---|
174 | !! ** Method : read the nammbf namelist and check the parameters |
---|
175 | !! called by trc_dmp at the first timestep (nit000) |
---|
176 | !!---------------------------------------------------------------------- |
---|
177 | |
---|
178 | SELECT CASE ( nn_hdmp_tr ) |
---|
179 | CASE ( -1 ) ; IF(lwp) WRITE(numout,*) ' tracer damping in the Med & Red seas only' |
---|
180 | CASE ( 1:90 ) ; IF(lwp) WRITE(numout,*) ' tracer damping poleward of', nn_hdmp_tr, ' degrees' |
---|
181 | CASE DEFAULT |
---|
182 | WRITE(ctmp1,*) ' bad flag value for nn_hdmp_tr = ', nn_hdmp_tr |
---|
183 | CALL ctl_stop(ctmp1) |
---|
184 | END SELECT |
---|
185 | |
---|
186 | SELECT CASE ( nn_zdmp_tr ) |
---|
187 | CASE ( 0 ) ; IF(lwp) WRITE(numout,*) ' tracer damping throughout the water column' |
---|
188 | CASE ( 1 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the turbocline (avt > 5 cm2/s)' |
---|
189 | CASE ( 2 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the mixed layer' |
---|
190 | CASE DEFAULT |
---|
191 | WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr |
---|
192 | CALL ctl_stop(ctmp1) |
---|
193 | END SELECT |
---|
194 | |
---|
195 | IF( .NOT. lk_dtatrc ) & |
---|
196 | & CALL ctl_stop( 'no passive tracer data define key_dtatrc' ) |
---|
197 | |
---|
198 | IF( .NOT. lk_tradmp ) & |
---|
199 | & CALL ctl_stop( 'passive trace damping need key_tradmp to compute damping coef.' ) |
---|
200 | ! |
---|
201 | ! ! Damping coefficients initialization |
---|
202 | IF( lzoom ) THEN ; CALL dtacof_zoom( restotr ) |
---|
203 | ELSE ; CALL dtacof( nn_hdmp_tr, rn_surf_tr, rn_bot_tr, rn_dep_tr, & |
---|
204 | & nn_file_tr, 'TRC' , restotr ) |
---|
205 | ENDIF |
---|
206 | ! |
---|
207 | END SUBROUTINE trc_dmp_init |
---|
208 | #else |
---|
209 | !!---------------------------------------------------------------------- |
---|
210 | !! Default key NO internal damping |
---|
211 | !!---------------------------------------------------------------------- |
---|
212 | LOGICAL , PUBLIC, PARAMETER :: lk_trcdmp = .FALSE. !: internal damping flag |
---|
213 | CONTAINS |
---|
214 | SUBROUTINE trc_dmp( kt ) ! Empty routine |
---|
215 | INTEGER, INTENT(in) :: kt |
---|
216 | WRITE(*,*) 'trc_dmp: You should not have seen this print! error?', kt |
---|
217 | END SUBROUTINE trc_dmp |
---|
218 | #endif |
---|
219 | !!====================================================================== |
---|
220 | END MODULE trcdmp |
---|