-
Notifications
You must be signed in to change notification settings - Fork 6
/
aed_noncohesive.F90
560 lines (472 loc) · 24.2 KB
/
aed_noncohesive.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
!###############################################################################
!# #
!# aed_noncohesive.F90 #
!# #
!# Developed by : #
!# AquaticEcoDynamics (AED) Group #
!# The University of Western Australia #
!# #
!# https://aquatic.science.uwa.edu.au/ #
!# #
!# Copyright 2018 - 2024 - The University of Western Australia #
!# #
!# AED is free software: you can redistribute it and/or modify #
!# it under the terms of the GNU General Public License as published by #
!# the Free Software Foundation, either version 3 of the License, or #
!# (at your option) any later version. #
!# #
!# AED is distributed in the hope that it will be useful, #
!# but WITHOUT ANY WARRANTY; without even the implied warranty of #
!# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
!# GNU General Public License for more details. #
!# #
!# You should have received a copy of the GNU General Public License #
!# along with this program. If not, see <https://www.gnu.org/licenses/>. #
!# #
!# ----------------------------------------------------------------------- #
!# #
!# Created Aug 2018 #
!# #
!###############################################################################
! !
! .-----------------. .----------------. .----------------. !
! | .--------------. || .--------------. || .--------------. | !
! | | ____ _____ | || | ______ | || | _______ | | !
! | ||_ \|_ _| | || | .' ___ | | || | / ___ | | | !
! | | | \ | | | || | / .' \_| | || | | (__ \_| | | !
! | | | |\ \| | | || | | | | || | '.___`-. | | !
! | | _| |_\ |_ | || | \ `.___.'\ | || | |`\____) | | | !
! | ||_____|\____| | || | `._____.' | || | |_______.' | | !
! | | | || | | || | | | !
! | '--------------' || '--------------' || '--------------' | !
! '----------------' '----------------' '----------------' !
! !
!###############################################################################
#include "aed.h"
!
MODULE aed_noncohesive
!-------------------------------------------------------------------------------
! aed_noncohesive --- noncohesive sediment model
!
! The AED module noncohesive contains equations that describe a
! particle, noncohesive, sediment. It is subject to processes of
! resupension and settling, and other modules may link to these pools.
!-------------------------------------------------------------------------------
USE aed_core
USE aed_util,ONLY : water_viscosity
IMPLICIT NONE
PRIVATE
PUBLIC aed_noncohesive_data_t
TYPE,extends(aed_model_data_t) :: aed_noncohesive_data_t
!# Variable identifiers
INTEGER,ALLOCATABLE :: id_ss(:), id_ss_vvel(:)
INTEGER,ALLOCATABLE :: id_ss_sed(:), id_sfss(:), id_ss_set(:)
INTEGER :: id_l_bot, id_tau_0, id_epsilon, id_resus, id_set
INTEGER :: id_e_temp, id_e_taub, id_e_salt, id_e_rho
INTEGER :: id_e_sedzone , id_sed, id_swi_dz, id_ss_swi
INTEGER :: id_d_taub
!# Module configuration
INTEGER :: num_ss
INTEGER :: resuspension, settling
LOGICAL :: simSedimentMass
!# Model parameters
AED_REAL,ALLOCATABLE :: decay(:), Ke_ss(:)
AED_REAL,ALLOCATABLE :: w_ss(:), rho_ss(:), d_ss(:)
AED_REAL,ALLOCATABLE :: fs(:), tau_0(:)
AED_REAL,ALLOCATABLE :: Fsed(:)
AED_REAL :: epsilon, kTau_0, tau_r
AED_REAL :: sed_porosity
CONTAINS
PROCEDURE :: define => aed_define_noncohesive
PROCEDURE :: initialize_benthic => aed_initialize_benthic_noncohesive
PROCEDURE :: calculate => aed_calculate_noncohesive
PROCEDURE :: calculate_benthic => aed_calculate_benthic_noncohesive
PROCEDURE :: mobility => aed_mobility_noncohesive
PROCEDURE :: light_extinction => aed_light_extinction_noncohesive
!PROCEDURE :: delete => aed_delete_noncohesive
END TYPE
! MODULE GLOBALS
AED_REAL :: sed_depth = 1.0
INTEGER :: diag_level = 10 ! 0 = no diagnostic outputs
! 1 = basic diagnostic outputs
! 2 = flux rates, and supporitng
! 3 = other metrics
!10 = all debug & checking outputs
!===============================================================================
CONTAINS
!###############################################################################
SUBROUTINE aed_define_noncohesive(data, namlst)
!-------------------------------------------------------------------------------
! Initialise the AED model
!
! Here, the aed namelist is read in and the variables simulated
! by the model are registered with AED core.
!-------------------------------------------------------------------------------
!ARGUMENTS
INTEGER,INTENT(in) :: namlst
CLASS (aed_noncohesive_data_t),INTENT(inout) :: data
!
!LOCALS
INTEGER :: status,i
CHARACTER(4) :: ncs_name
! %% NAMELIST %% /aed_noncohesive/
! %% Last Checked 20/08/2021
! Set default parameter values
INTEGER :: num_ss = 0
INTEGER :: resuspension = 0
INTEGER :: settling = 0
LOGICAL :: simSedimentMass = .FALSE.
AED_REAL :: ss_initial(100) = zero_
AED_REAL :: decay(100) = zero_
AED_REAL :: Ke_ss(100) = 0.02
AED_REAL :: w_ss(100) = 0.
AED_REAL :: rho_ss(100) = 1.6e3
AED_REAL :: d_ss(100) = 1e-6
AED_REAL :: Fsed(100) = zero_
AED_REAL :: tau_0(100) = 0.04
AED_REAL :: epsilon = 0.02
AED_REAL :: tau_r = 1.0
AED_REAL :: kTau_0 = 1.0
AED_REAL :: fs(100) = 1.0
AED_REAL :: sed_porosity = 0.3
AED_REAL :: sed_initial = zero_
CHARACTER(len=64) :: macrophyte_link_var = ''
CHARACTER(len=64) :: ss1_particle_link = '' ! For FV API 2.0 (To be implemented)
CHARACTER(len=64) :: ss2_particle_link = '' ! For FV API 2.0 (To be implemented)
CHARACTER(len=64) :: ss3_particle_link = '' ! For FV API 2.0 (To be implemented)
CHARACTER(len=64) :: ss4_particle_link = '' ! For FV API 2.0 (To be implemented)
! %% From Module Globals
! INTEGER :: diag_level = 10 ! 0 = no diagnostic outputs
! ! 1 = basic diagnostic outputs
! ! 2 = flux rates, and supporitng
! ! 3 = other metrics
! !10 = all debug & checking outputs
! %% END NAMELIST %% /aed_noncohesive/
NAMELIST /aed_noncohesive/ num_ss, &
! core
decay, Ke_ss, &
settling, w_ss, rho_ss, d_ss, &
resuspension, epsilon, tau_0, tau_r, Ktau_0, &
macrophyte_link_var, Fsed, fs, &
simSedimentMass, ss_initial, sed_porosity, &
diag_level, &
! optional/advanced
ss1_particle_link, ss2_particle_link, &
ss3_particle_link, ss4_particle_link
!
!-------------------------------------------------------------------------------
!BEGIN
print *," aed_noncohesive configuration"
! Read the namelist
read(namlst,nml=aed_noncohesive,iostat=status)
IF (status /= 0) STOP 'ERROR reading namelist aed_noncohesive'
! Store parameter values in our own derived type
data%num_ss = num_ss
data%settling = settling
data%resuspension = resuspension
data%simSedimentMass = simSedimentMass
data%sed_porosity = sed_porosity
data%epsilon = epsilon
data%kTau_0 = kTau_0
data%tau_r = tau_r
! Check if it is worth going further
IF ( num_ss < 1 ) RETURN
! Setup non-cohesive particle groups
ALLOCATE(data%id_ss(num_ss)) ; ALLOCATE(data%id_ss_vvel(num_ss))
ALLOCATE(data%id_ss_set(num_ss))
IF ( simSedimentMass ) ALLOCATE(data%id_ss_sed(num_ss))
ALLOCATE(data%decay(num_ss)) ; data%decay(1:num_ss) = decay(1:num_ss)
ALLOCATE(data%Ke_ss(num_ss)) ; data%Ke_ss(1:num_ss) = Ke_ss(1:num_ss)
ALLOCATE(data%w_ss(num_ss)) ; data%w_ss(1:num_ss) = w_ss(1:num_ss)/secs_per_day
ALLOCATE(data%d_ss(num_ss)) ; data%d_ss(1:num_ss) = d_ss(1:num_ss)
ALLOCATE(data%rho_ss(num_ss)); data%rho_ss(1:num_ss)= rho_ss(1:num_ss)
ALLOCATE(data%Fsed(num_ss)) ; data%Fsed(1:num_ss) = Fsed(1:num_ss)
ALLOCATE(data%tau_0(num_ss)) ; data%tau_0(1:num_ss) = tau_0(1:num_ss)
ALLOCATE(data%fs(num_ss)) ; data%fs(1:num_ss) = fs(1:num_ss)
! Register state variables
ncs_name = 'ss0'
DO i=1,num_ss
ncs_name(3:3) = CHAR(ICHAR('0') + i)
! divide settling by secs_per_day to convert m/d to m/s
data%id_ss(i) = aed_define_variable(TRIM(ncs_name),'g/m3','noncohesive particle group', &
ss_initial(i),minimum=zero_,maximum=1e4,mobility=(w_ss(i)/secs_per_day))
data%id_ss_vvel(i) = aed_define_diag_variable(TRIM(ncs_name)//'_vvel','m/d','vertical velocity')
data%id_ss_set(i) = aed_define_diag_variable(TRIM(ncs_name)//'_set','g/m3/d','sedimentation flux')
IF ( simSedimentMass ) THEN
sed_initial = (1.-data%sed_porosity) * fs(i) * sed_depth * data%rho_ss(i) * 1e3
data%id_ss_sed(i) = aed_define_sheet_variable(TRIM(ncs_name)//'_sed',&
'g/m2','sedimented noncohesive particles', &
sed_initial,minimum=zero_)
ENDIF
ENDDO
! Setup bottom diag arrays for sediment and spatially variable resuspension
IF ( simSedimentMass ) THEN
data%id_sed = aed_define_sheet_diag_variable('ss_sed','g/m2','total non-cohesive sediment mass')
ENDIF
IF ( resuspension == 2 ) THEN
data%id_tau_0 = aed_define_sheet_diag_variable('tau_0','N/m2','dynamic bottom drag')
data%id_epsilon = aed_define_sheet_diag_variable('epsilon','g/m2/s','max resuspension rate')
ALLOCATE(data%id_sfss(num_ss))
ncs_name = 'fs0'
DO i=1,num_ss
ncs_name(3:3) = CHAR(ICHAR('0') + i)
data%id_sfss(i) = aed_define_sheet_diag_variable(TRIM(ncs_name),'w/w', 'sediment fraction of sed size')
ENDDO
IF ( macrophyte_link_var .NE. '' ) THEN
data%id_l_bot = aed_locate_sheet_variable(macrophyte_link_var)
IF ( data%id_l_bot .LE. 0 ) THEN
print *, "Macrophyte Link Variable ", TRIM(macrophyte_link_var), " is not defined."
STOP
ENDIF
ELSE
data%id_l_bot = 0
ENDIF
ENDIF
data%id_set = aed_define_diag_variable('set','g/m3/d','total sedimentation flux')
data%id_ss_swi = aed_define_sheet_diag_variable('swi','g/m2/d','net flux across the sediment-water interface')
data%id_swi_dz = aed_define_sheet_diag_variable('swi_dz','m/d','cum. swi position change')
IF ( resuspension > 0 ) THEN
data%id_resus = aed_define_sheet_diag_variable('resus','g/m2/s','resuspension rate')
data%id_d_taub = aed_define_sheet_diag_variable('d_taub','N/m2','taub diagnostic')
data%id_e_taub = aed_locate_sheet_global('taub')
data%id_e_sedzone = aed_locate_sheet_global('sed_zone')
ENDIF
! Register environmental dependencies
data%id_e_temp = aed_locate_global('temperature')
data%id_e_salt = aed_locate_global('salinity')
IF ( settling > 1 ) THEN
data%id_e_rho = aed_locate_global('density')
ENDIF
END SUBROUTINE aed_define_noncohesive
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!###############################################################################
SUBROUTINE aed_initialize_benthic_noncohesive(data, column, layer_idx)
!-------------------------------------------------------------------------------
! Routine to set initial state of NCS variables (in the sediment)
!-------------------------------------------------------------------------------
!ARGUMENTS
CLASS (aed_noncohesive_data_t),INTENT(in) :: data
TYPE (aed_column_t),INTENT(inout) :: column(:)
INTEGER,INTENT(in) :: layer_idx
!
!LOCALS
INTEGER :: i
!-------------------------------------------------------------------------------
!BEGIN
!---------------------------------------------------------------------------+
! If users update fs (sediment fraction) via benthic initialisaiton file,
! then we need to recompute the starting mass of each sediment particle type
!---------------------------------------------------------------------------+
IF ( data%resuspension == 2 ) THEN
DO i=1,data%num_ss
_STATE_VAR_S_(data%id_ss_sed(i))=_DIAG_VAR_S_(data%id_sfss(i)) * sed_depth &
* (1.-data%sed_porosity) * (data%rho_ss(i)*1e3)
ENDDO
ENDIF
!---------------------------------------------------------------------------+
END SUBROUTINE aed_initialize_benthic_noncohesive
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!###############################################################################
SUBROUTINE aed_calculate_noncohesive(data,column,layer_idx)
!-------------------------------------------------------------------------------
!ARGUMENTS
CLASS (aed_noncohesive_data_t),INTENT(in) :: data
TYPE (aed_column_t),INTENT(inout) :: column(:)
INTEGER,INTENT(in) :: layer_idx
!
!LOCALS
INTEGER :: i
AED_REAL :: ss
!
!-------------------------------------------------------------------------------
!BEGIN
DO i=1,data%num_ss
ss = _STATE_VAR_(data%id_ss(i))
_FLUX_VAR_(data%id_ss(i)) = _FLUX_VAR_(data%id_ss(i)) + data%decay(i)*ss
ENDDO
END SUBROUTINE aed_calculate_noncohesive
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!###############################################################################
SUBROUTINE aed_calculate_benthic_noncohesive(data,column,layer_idx)
!-------------------------------------------------------------------------------
! Calculate bottom fluxes and benthic sink and source terms of AED noncohesive
! Everything in units per surface area (not volume!) per time, eg. g/m2
!-------------------------------------------------------------------------------
!ARGUMENTS
CLASS (aed_noncohesive_data_t),INTENT(in) :: data
TYPE (aed_column_t),INTENT(inout) :: column(:)
INTEGER,INTENT(in) :: layer_idx
!
!LOCALS
! Environment
AED_REAL :: bottom_stress, matz
! State
AED_REAL :: ss
! Temporary variables
AED_REAL :: resus_flux, ss_flux, set_flux
AED_REAL :: dummy_eps, dummy_tau
INTEGER :: i
!-------------------------------------------------------------------------------
!BEGIN
IF ( .NOT. ALLOCATED(data%id_ss) ) RETURN
resus_flux = zero_ ; set_flux = zero_ ; ss_flux = zero_
_DIAG_VAR_S_(data%id_ss_swi) = zero_
! Retrieve current environmental conditions for the bottom pelagic layer
IF ( data%resuspension > 0) THEN
bottom_stress = MIN( _STATE_VAR_S_(data%id_e_taub), one_ )
_DIAG_VAR_S_(data%id_d_taub) = bottom_stress
_DIAG_VAR_S_(data%id_resus) = zero_
ENDIF
! If (spatially variable) resuspension has plant stabilisation (e.g.,
! seagrass-sediment-turbidity feedback), then update tau_0
IF ( data%resuspension == 2 .AND. data%id_l_bot > 0 ) &
_DIAG_VAR_S_(data%id_tau_0) = data%tau_0(1) + data%kTau_0 * _STATE_VAR_S_(data%id_l_bot)
IF ( data%simSedimentMass ) _DIAG_VAR_S_(data%id_sed) = zero_
! Loop through each type of particle and lift it up via resuspension
DO i=1,ubound(data%id_ss,1)
! Resuspension
IF ( data%resuspension > 0 ) THEN
IF ( data%resuspension == 2 ) THEN
IF (data%id_l_bot > 0) THEN
dummy_tau = data%tau_0(i) + data%kTau_0 * _STATE_VAR_S_(data%id_l_bot)
ELSE
dummy_tau = data%tau_0(i)
ENDIF
dummy_eps = data%epsilon * _DIAG_VAR_S_(data%id_sfss(i))
ELSE
dummy_tau = data%tau_0(i)
dummy_eps = data%epsilon * data%fs(i)
!!MH COORONG account for low clay conetent in more sandy MTAZ
!matz = _STATE_VAR_S_(data%id_E_sedzone)
!IF (matz >3) dummy_eps = dummy_eps* 0.3
ENDIF
IF ( bottom_stress > dummy_tau ) THEN
resus_flux = dummy_eps * (bottom_stress - dummy_tau) / data%tau_r
ELSE
resus_flux = zero_
ENDIF
_DIAG_VAR_S_(data%id_resus) = _DIAG_VAR_S_(data%id_resus) + resus_flux
ENDIF
! Constant sediment "flux" (not for general consumption)
ss_flux = data%Fsed(i)
! Settling rate
set_flux = _DIAG_VAR_(data%id_ss_set(i)) / secs_per_day
! Transfer sediment flux value to model for ODE
_FLUX_VAR_(data%id_ss(i)) = _FLUX_VAR_(data%id_ss(i)) + ss_flux + resus_flux
! Log the flux across the sediment-water interface, cumulating over groups
_DIAG_VAR_S_(data%id_ss_swi) = _DIAG_VAR_S_(data%id_ss_swi) - (ss_flux + resus_flux - set_flux) * secs_per_day
! Keep track of the cumulative deviation in SWI position due to
! resuspension of this particle class
_DIAG_VAR_S_(data%id_swi_dz) = _DIAG_VAR_S_(data%id_swi_dz) - &
((resus_flux+ss_flux-set_flux) / ((1.-data%sed_porosity) * (data%rho_ss(i)*1e3)) * secs_per_day)
IF ( data%simSedimentMass ) THEN
! Remove/add sediment fluxes value from the sediment vars
_FLUX_VAR_B_(data%id_ss_sed(i)) = _FLUX_VAR_B_(data%id_ss_sed(i)) &
- resus_flux - ss_flux - set_flux
! Recompute the total sediment mass, adding this group
_DIAG_VAR_S_(data%id_sed) = _DIAG_VAR_S_(data%id_sed) + &
_STATE_VAR_S_(data%id_ss_sed(i))
ENDIF
ENDDO
END SUBROUTINE aed_calculate_benthic_noncohesive
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!###############################################################################
SUBROUTINE aed_light_extinction_noncohesive(data,column,layer_idx,extinction)
!-------------------------------------------------------------------------------
! Get the light extinction coefficient due to biogeochemical variables
!-------------------------------------------------------------------------------
!ARGUMENTS
CLASS (aed_noncohesive_data_t),INTENT(in) :: data
TYPE (aed_column_t),INTENT(inout) :: column(:)
INTEGER,INTENT(in) :: layer_idx
AED_REAL,INTENT(inout) :: extinction
!
!LOCALS
AED_REAL :: ss
INTEGER :: ss_i
!
!-----------------------------------------------------------------------
!BEGIN
IF ( .NOT. ALLOCATED(data%id_ss) ) RETURN
!DO ss_i=1,ubound(data%id_ss,1)
DO ss_i=1,data%num_ss
! Retrieve current (local) state variable values.
ss = _STATE_VAR_(data%id_ss(ss_i))
! Self-shading with contribution from background noncohesive concentration.
extinction = extinction + (data%Ke_ss(ss_i)*ss)
ENDDO
END SUBROUTINE aed_light_extinction_noncohesive
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!###############################################################################
SUBROUTINE aed_mobility_noncohesive(data,column,layer_idx,mobility)
!-------------------------------------------------------------------------------
! Get the vertical movement velocities (+ve up; -ve down)
!-------------------------------------------------------------------------------
!ARGUMENTS
CLASS (aed_noncohesive_data_t),INTENT(in) :: data
TYPE (aed_column_t),INTENT(inout) :: column(:)
INTEGER,INTENT(in) :: layer_idx
AED_REAL,INTENT(inout) :: mobility(:)
!
!LOCALS
INTEGER :: i
AED_REAL :: ss, vvel
AED_REAL :: pw, pw20, mu, mu20
AED_REAL :: temp, rho_s
!
!-------------------------------------------------------------------------------
!BEGIN
_DIAG_VAR_(data%id_set) = zero_
! settling = 0 : no settling
! settling = 1 : constant settling @ w_pom
! settling = 2 : constant settling @ w_pom, corrected for variable density
! settling = 3 : settling based on Stoke's Law (calculated below)
DO i=1,data%num_ss
SELECT CASE (data%settling)
CASE ( _MOB_OFF_ )
! disable settling by setting vertical velocity to 0
vvel = zero_
CASE ( _MOB_CONST_ )
! constant settling velocity using user provided value
vvel = data%w_ss(i)
CASE ( _MOB_TEMP_ )
! constant settling velocity @20C corrected for density changes
pw = _STATE_VAR_(data%id_e_rho)
temp = _STATE_VAR_(data%id_e_temp)
mu = water_viscosity(temp)
mu20 = 0.001002 ! N s/m2
pw20 = 998.2000 ! kg/m3 (assuming freshwater)
vvel = data%w_ss(i)*mu20*pw / ( mu*pw20 )
CASE ( _MOB_STOKES_ )
! settling velocity based on Stokes Law calculation and cell density
pw = _STATE_VAR_(data%id_e_rho) ! water density
temp = _STATE_VAR_(data%id_e_temp) ! water temperature
mu = water_viscosity(temp) ! water dynamic viscosity
rho_s = data%rho_ss(i)
vvel = -9.807*(data%d_ss(i)**2.)*( rho_s-pw ) / ( 18.*mu )
CASE DEFAULT
! unknown settling/migration option selection
vvel = data%w_ss(i)
END SELECT
!------------------------------------------------------------------------+
! Set global mobility array
mobility(data%id_ss(i)) = vvel
_DIAG_VAR_(data%id_ss_vvel(i)) = vvel * secs_per_day
!------------------------------------------------------------------------+
! EXPERIMENTAL : SEDIMENT CUMULATION
! Keep track of the cumulative deviation in SWI position due to
! sedimentation of this particle class
ss = _STATE_VAR_(data%id_ss(i))
_DIAG_VAR_(data%id_ss_set(i)) = ss * vvel * secs_per_day
_DIAG_VAR_(data%id_set) = _DIAG_VAR_(data%id_set) + ss * vvel * secs_per_day
_DIAG_VAR_S_(data%id_swi_dz) = _DIAG_VAR_S_(data%id_swi_dz) - (vvel*ss) &
/ ((1.-data%sed_porosity) * (data%rho_ss(i)*1e3))
! IF ( data%simSedimentMass ) THEN
! ! Remove/add sediment fluxes value from the sediment vars
! _FLUX_VAR_B_(data%id_ss_sed(i)) = _FLUX_VAR_B_(data%id_ss_sed(i)) - vvel*ss
! ENDIF
!------------------------------------------------------------------------+
ENDDO
END SUBROUTINE aed_mobility_noncohesive
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
END MODULE aed_noncohesive