AshFlow  0.1
ashflowmodel
 All Classes Files Functions Variables Pages
particles.f90
Go to the documentation of this file.
1 !********************************************************************************
5 !********************************************************************************
7  !
8  IMPLICIT NONE
9 
11  REAL*8 :: min_phi
12 
14  REAL*8 :: max_phi
15 
16  REAL*8 :: diam2
17 
19  REAL*8 :: max_rho
20 
21  REAL*8 :: diam1
22 
24  REAL*8 :: min_rho
25 
27  INTEGER :: no_bins
28 
30  REAL*8 :: sigma_phi
31 
33  REAL*8 :: mean_phi
34 
36  REAL*8, ALLOCATABLE, DIMENSION(:) :: fracsolid
37 
39  REAL*8, ALLOCATABLE, DIMENSION(:) :: init_fracsolid
40 
42  REAL*8, ALLOCATABLE, DIMENSION(:) :: rhosol
43 
45  REAL*8, ALLOCATABLE, DIMENSION(:) :: diam
46 
48  REAL*8, ALLOCATABLE, DIMENSION(:) :: C_d
49 
51  REAL*8 :: C_d_input
52 
54  REAL*8, ALLOCATABLE, DIMENSION(:) :: sepsolid
55 
57  REAL*8, ALLOCATABLE, DIMENSION(:) :: solidmassflux_fract
58 
60  REAL*8, ALLOCATABLE, DIMENSION(:) :: v_s
61 
63  REAL*8, ALLOCATABLE, DIMENSION(:) :: S
64 
66  REAL*8 :: Acc_rate
67 
69  REAL*8 :: Total_Acc_rate
70 
72  REAL*8 :: Pn
73 
75  REAL*8 :: k = 0.4D0
76 
78  REAL*8 :: ustar !> shear velocity of flow
79 
81  REAL*8 :: h_bl
82 
84  REAL*8 :: ks = 1.D0
85 
87  REAL*8 :: eta0
88 
90  REAL*8 :: wavelengthfreen
91 
93  REAL*8 :: wavelengthshearn
94 
96  REAL*8 :: wavelengthfreex
97 
99  REAL*8 :: wavelengthshearx
100 
102  REAL*8 :: wavelength_height
103 
105  REAL*8, ALLOCATABLE, DIMENSION(:) :: eta
106 
108  REAL*8, ALLOCATABLE, DIMENSION(:) :: BV
109 
111  REAL*8, ALLOCATABLE, DIMENSION(:) :: SS0
112 
114  REAL*8, ALLOCATABLE, DIMENSION(:) :: norm_flux
115 
117  REAL*8, ALLOCATABLE, DIMENSION(:) :: ipf
118 
120  REAL*8, ALLOCATABLE, DIMENSION(:) :: fpf
121 
123  INTEGER :: iclass
124  INTEGER :: final = 9.D0
125 
127  REAL*8 :: sumsed
128 
129  REAL*8 :: delta_phi
130  REAL*8 :: phi_left
131  REAL*8 :: phi_right
132  REAL*8, ALLOCATABLE, DIMENSION(:) :: phi_dist
133  REAL*8 :: left_tail_fract
134  REAL*8 :: right_tail_fract
135  REAL*8 :: rho_one
136 
137  !
138  SAVE
139  !----------------------------------------------------------------------
140 CONTAINS
141  !----------------------------------------------------------------------
142 
143  !******************************************************************************
146  !******************************************************************************
148  INTEGER :: i
149 
150  no_bins = iclass
151 
152  ! Define a normal distribution
153 
154  delta_phi= (max_phi - min_phi) / no_bins
155 
156  phi_left = min_phi
157 
158  DO i=1,no_bins
159 
160  phi_dist(i) = phi_left + 0.5d0 * delta_phi
161 
162  phi_right = min_phi + (i) * delta_phi
163 
164  ! Convert grainsize to m
165  diam(i) = 1.d-3 * 2.0**(-phi_dist(i))
166 
167  IF ( diam(i) .LE. diam1 ) THEN
168 
169  rhosol(i) = min_rho
170 
171  ELSEIF ( diam(i) .LE. diam2 ) THEN
172 
173  rhosol(i) = min_rho + ( diam(i) - diam1 ) / ( diam2 - diam1 ) * &
174  ( max_rho - min_rho)
175 
176  ELSE
177 
178  rhosol(i) = max_rho
179 
180  END IF
181 
182  c_d(i) = c_d_input
183 
184  fracsolid(i) = cdf(phi_right) - cdf(phi_left)
185 
186  phi_left = phi_right
187 
188  END DO
189 
190  left_tail_fract= cdf(min_phi)
191  right_tail_fract= 1 - cdf(max_phi)
192 
193  If (left_tail_fract .GT. fracsolid(1)) THEN
194 
195  fracsolid(1) = fracsolid(1) + left_tail_fract
196 
197  END IF
198 
199  If (right_tail_fract .GT. fracsolid(no_bins)) THEN
200 
201  fracsolid(no_bins) = fracsolid(no_bins) + right_tail_fract
202 
203  END IF
204 
205  fracsolid(1:no_bins) = fracsolid(1:no_bins)/sum(fracsolid(1:no_bins))
206 
207  RETURN
208 
209  END SUBROUTINE initialize_particles
210 
211  !******************************************************************************
213  !
216  !******************************************************************************
217 
218  FUNCTION cdf(phi_in)
219  !
220  IMPLICIT NONE
221 
222  REAL*8 :: cdf
223  REAL*8, INTENT(IN) :: phi_in
224 
225  cdf = 0.5d0 * (1.d0 + erf((phi_in - mean_phi)/(sigma_phi * sqrt(2.d0))))
226 
227  END FUNCTION cdf
228 
229  !******************************************************************************
233  !******************************************************************************
235  !
236  IMPLICIT NONE
237  !
238  ALLOCATE(solidmassflux_fract(iclass))
239  ALLOCATE(v_s(iclass))
240  ALLOCATE(s(iclass))
241  ALLOCATE(diam(iclass))
242  ALLOCATE(rhosol(iclass))
243  ALLOCATE(fracsolid(iclass))
244  ALLOCATE(phi_dist(iclass))
245  ALLOCATE(c_d(iclass))
246  ALLOCATE(norm_flux(iclass))
247  ALLOCATE(ipf(iclass))
248  ALLOCATE(fpf(iclass))
249  ALLOCATE(eta(final))
250  ALLOCATE(ss0(final))
251  ALLOCATE(bv(final))
252  !
253  RETURN
254  END SUBROUTINE allocate_particles
255  !----------------------------------------------------------------------
256 END MODULE particles_module
257 !----------------------------------------------------------------------
subroutine initialize_particles
Allocating particles variables This subroutine allocates the variables defining the particle sediment...
Definition: particles.f90:147
subroutine allocate_particles
Particle inizialization This subroutine allocates the variables defining the particle physical charac...
Definition: particles.f90:234
real *8 function cdf(phi_in)
Defining cumulative density function of particle size.
Definition: particles.f90:218
Particles module This module contains the procedures and the variables related to the solid particles...
Definition: particles.f90:6