PLUME-MoM-TSM  1.0
VolcanicPlumeModel
solver_rise.f90
Go to the documentation of this file.
1 !********************************************************************************
3 !
9 !********************************************************************************
10 
12  USE moments_module, ONLY: n_mom , n_sections
14  USE particles_module, ONLY : n_part
15  USE mixture_module, ONLY : n_gas
16  USE variables, ONLY : wp
17 
18  !
19  IMPLICIT NONE
20 
22  REAL(wp), ALLOCATABLE, DIMENSION(:) :: rhs1
23 
25  REAL(wp), ALLOCATABLE, DIMENSION(:) :: rhs2
26 
28  REAL(wp), ALLOCATABLE, DIMENSION(:) :: rhstemp
29 
31  REAL(wp), ALLOCATABLE, DIMENSION(:) :: rhs
32 
34  REAL(wp), ALLOCATABLE, DIMENSION(:) :: ftemp
35 
37  REAL(wp), ALLOCATABLE, DIMENSION(:) :: f
38 
40  REAL(wp), ALLOCATABLE, DIMENSION(:) :: f_stepold
41 
43  REAL(wp), ALLOCATABLE, DIMENSION(:) :: volcgas_rate
44 
46  INTEGER :: itotal
47 
49  REAL(wp) :: dz
50 
52  REAL(wp) :: dz0
53  !
54  SAVE
55 
56 CONTAINS
57 
58  !******************************************************************************
60  !
66  !******************************************************************************
67 
68  SUBROUTINE allocate_matrix
69 
70  IMPLICIT NONE
71  !
72  IF ( read_atm_profile .EQ. 'standard' ) THEN
73 
74  itotal = n_part * n_sections * n_mom + 9 + n_gas + 2
75 
76  ELSE
77 
78  itotal = n_part * n_sections * n_mom + 9 + n_gas
79 
80  END IF
81  !
82  ALLOCATE(f(itotal))
83  ALLOCATE(f_stepold(itotal))
84  ALLOCATE(rhs1(itotal))
85  ALLOCATE(rhs2(itotal))
86  ALLOCATE(rhs(itotal))
87  ALLOCATE(rhstemp(itotal))
88  ALLOCATE(ftemp(itotal))
89  ALLOCATE(volcgas_rate(n_gas))
90 
91  !
92  f = 0.0_wp
93  f_stepold = 0.0_wp
94  ftemp = 0.0_wp
95  rhs = 0.0_wp
96  rhstemp = 0.0_wp
97  !
98  RETURN
99  END SUBROUTINE allocate_matrix
100 
101  !******************************************************************************
103  !
105  !
109  !******************************************************************************
110 
111  SUBROUTINE rate
113  USE meteo_module, ONLY: u_atm , rho_atm , ta , cpair , rair , gamma_m , &
115 
116  USE mixture_module, ONLY: rho_mix , t_mix , rgasmix , rho_gas , &
118 
119  USE particles_module, ONLY: mom , set_mom , set_cp_mom , &
121 
122  USE plume_module, ONLY: s , r , u , w , v , mag_u , phi , alpha_inp , &
124 
125  USE variables, ONLY: gi , flag_nbl , entr_abv_nbl_flag
126 
127  !
128  IMPLICIT NONE
129 
130  INTEGER :: i
131  INTEGER :: i_part
132  INTEGER :: i_sect
133  INTEGER :: i_gas
134 
135  INTEGER :: idx
136 
137  REAL(wp) :: ueps
138 
139  REAL(wp) :: cos_phi , sin_phi
140  REAL(wp) :: factor0
141 
142  REAL(wp) :: solid_term , cp_solid_term
143 
144  REAL(wp) :: Ri
145 
146  REAL(wp) :: alpha_p , beta_p
147 
148  REAL(wp) :: A , C
149 
150  REAL(wp) :: a_poly , b_poly , c_poly , d_poly
151  REAL(wp) :: s_star
152 
153  REAL(wp) :: a_10 , a_10_deriv
154 
155  REAL(wp) :: rate_mom , f_mom , coeff_mom
156 
157  !WRITE(*,*) 'mag_u',mag_u
158 
159  cos_phi = sqrt( u**2+v**2 ) / mag_u
160  sin_phi = w / mag_u
161 
162  IF ( alpha_inp .LE. 0.0_wp ) THEN
163 
164  s_star = s / r0
165 
166  IF ( s_star .LE. 10 ) THEN
167 
168  ! value and slope at s_star=10 from equation 3.4 Carazzo et al. 2006
169  a_10 = 2.45_wp - 1.05_wp * exp( -4.65e-3_wp * 10.0_wp )
170 
171  a_10_deriv = - 1.05_wp * exp( -4.65e-3_wp * 10.0_wp ) * ( -4.65e-3_wp )
172 
173  ! coefficients for the 3rd order polynomial defining A as a function of z/D
174 
175  a_poly = 1.1_wp
176 
177  b_poly = 0
178 
179  d_poly = - ( a_10 - 1.1_wp - a_10_deriv ) / 500.0_wp
180 
181  c_poly = ( a_10 - 1.1_wp - 1000.0_wp * d_poly ) / 100.0_wp
182 
183  ! Equation 12 Carazzo et al. 2008
184  a = a_poly + b_poly*s_star + c_poly*s_star**2 + d_poly*s_star**3
185 
186  ELSE
187 
188  ! Equation 3.4 Carazzo et al. 2006
189  a = 2.45_wp - 1.05_wp * exp( -4.65e-3_wp * s_star )
190 
191  END IF
192 
193  c = 0.135_wp
194 
195  ri = gi * ( rho_atm - rho_mix ) * r / ( rho_atm * mag_u**2 )
196 
197  alpha_p = max( 0.0_wp , 0.5_wp * c + ( 1.0_wp - 1.0_wp / a ) * ri )
198 
199  !WRITE(*,*) 's_star,Ri,alpha_p',s_star,Ri,alpha_p
200 
201  ELSE
202 
203  alpha_p = alpha_inp
204 
205  END IF
206 
207  IF ( particles_loss ) THEN
208 
209  !---- Probability of particle loss (Eq. 15 PlumeMoM - GMD)
210  factor0 = ( 1.0_wp + 6.0_wp / 5.0_wp * alpha_p )**2
211  prob_factor = ( factor0 - 1.0_wp ) / ( factor0 + 1.0_wp )
212 
213  ELSE
214 
215  prob_factor = 0.0_wp
216 
217  END IF
218 
219  !---- Crosswind entrainment coefficient
220  IF ( beta_inp .LE. 0.0_wp ) THEN
221 
222  beta_p = 0.0_wp
223 
224  ELSE
225 
226  beta_p = beta_inp
227 
228  END IF
229 
230  !---- Entrainment velocity (Eq. 20 PlumeMoM - GMD)
231  IF ( ( flag_nbl ) .AND. ( .not. entr_abv_nbl_flag ) ) THEN
232 
233  ueps = 0.0_wp
234 
235  ELSE
236 
237  ueps = alpha_p * abs( mag_u - u_atm * cos_phi ) + beta_p * abs( u_atm * &
238  sin_phi )
239  !ueps = alpha_p * ABS( w ) + beta_p * ABS( u_atm )
240  !ueps = alpha_p * ABS( w ) + beta_p * SQRT( (u - u_wind)**2 + ( v-v_wind)**2 )
241 
242  END IF
243 
244  !---- Particle loss term corrections
245  ! It is not possible to loose more particles than available in the plume
246 
247  solid_term = sum( set_mom( 1, 1:n_sections , 1:n_part ) &
248  * mom( 1 , 1:n_sections , 1:n_part ) )
249 
250  DO i_gas=1,n_gas
251 
252  volcgas_rate(i_gas) = 0.0_wp
253 
254  END DO
255 
256  !---- Mass conservation of the plume (Eq. 20 PlumeMoM - GMD)
257  rhs1(1) = 2.0_wp * r * rho_atm * ueps - prob_factor * 2.0_wp * r * &
258  solid_term + sum( volcgas_rate(1:n_gas) )
259 
260  !---- Horizontal x-momentum conservation (Eq. 21 PlumeMoM - GMD)
261  rhs1(2) = 2.0_wp * r * rho_atm * ueps * u_wind - u * prob_factor * 2.0_wp * r * &
262  solid_term + u * sum( volcgas_rate(1:n_gas) )
263 
264  !---- Horizontal y-momentum conservation (Eq. 21 PlumeMoM - GMD)
265  rhs1(3) = 2.0_wp * r * rho_atm * ueps * v_wind - v * prob_factor * 2.0_wp * r * &
266  solid_term + v * sum( volcgas_rate(1:n_gas) )
267 
268  !---- Vertical momentum conservation (Eq. 22 PlumeMoM - GMD)
269  rhs1(4) = gi * r**2 * ( rho_atm - rho_mix ) - w * prob_factor * 2.0_wp * r * &
270  solid_term + w * sum( volcgas_rate(1:n_gas) )
271 
272  !---- Mixture specific heat integration
273  cp_solid_term =sum( set_cp_mom( 1 , 1:n_sections , 1:n_part ) &
274  * mom( 1 , 1:n_sections , 1:n_part ) )
275 
276  !---- Energy conservation (Eq.2d Folch 2016) + loss of kinetic energy
277  !---- due to particle sedimentation
278  rhs1(5) = 2.0_wp * r * ueps * rho_atm * ( cpair * ta * ( 1.0_wp - sphu_atm ) &
279  + sphu_atm * ( h_wv0 - c_wv * ta ) + gi * z &
280  + 0.5_wp * u_atm**2 ) - prob_factor * 2.0_wp * r * ( t_mix * cp_solid_term &
281  + 0.5_wp * mag_u**2 * solid_term) &
282  + t_mix * sum( cpvolcgas(1:n_gas) * volcgas_rate(1:n_gas) )
283 
284  !---- X integration dx/dz = (dx/dt)*(dt/dz) = u/w
285  rhs1(6) = u / w
286 
287  !---- Y integration dy/dz = (dy/dt)*(dt/dz) = v/w
288  rhs1(7) = v / w
289 
290  !---- Moments equations
291  DO i_part=1,n_part
292 
293  DO i_sect=1,n_sections
294 
295  DO i=0,n_mom-1
296 
297  idx = 8+i+(i_part-1)*n_sections*n_mom+(i_sect-1)*n_mom
298 
299  !---- Momentum equation RHS term (Eq. 32 PlumeMoM - GMD)
300  rhs1(idx) = - 2.0_wp * prob_factor * r * set_mom(i,i_sect,i_part) &
301  * mom(i,i_sect,i_part)
302 
303  END DO
304 
305  END DO
306 
307  END DO
308 
309  ! ---- Equations for entrained dry air
310  rhs1(n_part*n_sections*n_mom+8) = ( 2.0_wp * r * rho_atm * ueps ) &
311  * ( 1.0_wp - sphu_atm )
312 
313  ! ---- Equations for H20 (volcanic+entrained)
314  rhs1(n_part*n_sections*n_mom+9) = ( 2.0_wp * r * rho_atm * ueps ) &
315  * ( sphu_atm )
316 
317  ! ---- Equations for additional volcanic gases
318  DO i_gas=1,n_gas
319 
320  rhs1(9+n_part*n_sections*n_mom+i_gas) = volcgas_rate(i_gas)
321 
322  END DO
323 
324  IF ( read_atm_profile .EQ. 'standard' ) THEN
325 
326  rhs1(itotal-1 ) = - rho_atm * gi
327  rhs1(itotal ) = - gamma_m
328 
329  END IF
330 
331  RETURN
332 
333  END SUBROUTINE rate
334 
335 
336  !******************************************************************************
338  !
340  !
344  !******************************************************************************
345 
346  SUBROUTINE aggr_rate
348  USE meteo_module, ONLY: visc_atm
352 
353  USE plume_module, ONLY: r
354  !
356 
357  IMPLICIT NONE
358 
359  INTEGER :: i_mom
360  INTEGER :: i_part
361  INTEGER :: i_sect
362  INTEGER :: i_gas
363 
364  INTEGER :: idx
365 
368 
369  rhs2 = 0.0_wp
370 
371  !---- Moments equations
372  DO i_part=1,n_part
373 
374  DO i_sect=1,n_sections
375 
376  DO i_mom=0,n_mom-1
377 
378  idx = 8+i_mom+(i_part-1)*n_sections*n_mom+(i_sect-1)*n_mom
379 
380  rhs2(idx) = r**2 * ( birth_mom(i_mom,i_sect,i_part) - &
381  death_mom(i_mom,i_sect,i_part))
382 
383  END DO
384 
385  END DO
386 
387  END DO
388 
389  RETURN
390 
391  END SUBROUTINE aggr_rate
392 
393 
394  !******************************************************************************
396  !
403  !******************************************************************************
404 
405  SUBROUTINE lump(f_)
407  USE mixture_module, ONLY: rgasmix , rho_mix , t_mix
414 
415  USE meteo_module, ONLY: u_atm , c_lw , c_wv , cpair , h_lw0 , h_wv0 , &
416  t_ref , c_ice , ta , pa
417 
418  USE particles_module, ONLY: mom , cpsolid
419 
420  USE plume_module, ONLY: x , z , y , r , u , v , w , mag_u
421 
422  USE variables, ONLY: gi
423  !
424  IMPLICIT NONE
425  REAL(wp), DIMENSION(:), INTENT(OUT) :: f_
426  INTEGER :: i_mom
427  INTEGER :: i_part
428  INTEGER :: i_sect
429  INTEGER :: idx , idx1 , idx2
430  INTEGER :: i_gas
431 
432  f_(1) = rho_mix * w * r**2
433  f_(2) = f_(1) * u
434  f_(3) = f_(1) * v
435  f_(4) = f_(1) * w
436 
437  !WRITE(*,*) 'dry_air_mass_fraction',dry_air_mass_fraction
438 
439  mixture_enthalpy = dry_air_mass_fraction * cpair * t_mix &
440  + solid_tot_mass_fraction * cpsolid * t_mix &
441  + water_vapor_mass_fraction * ( h_wv0 + c_wv * ( t_mix - t_ref ) ) &
442  + liquid_water_mass_fraction * ( h_lw0 + c_lw * ( t_mix - t_ref ) ) &
443  + ice_mass_fraction * ( c_ice * t_mix ) &
444  + volcgas_mix_mass_fraction * cpvolcgas_mix * t_mix
445 
446  ! ---- Total energy flow rate
447  f_(5) = f_(1) * ( mixture_enthalpy + gi * z + 0.5_wp * mag_u**2 )
448 
449  f_(6) = x
450  f_(7) = y
451 
452  DO i_part=1,n_part
453 
454  DO i_sect=1,n_sections
455 
456  DO i_mom=0,n_mom-1
457 
458  idx = 8+(i_part-1)*n_sections*n_mom+(i_sect-1)*n_mom+i_mom
459 
460  f_(idx) = w * r**2 * mom(i_mom,i_sect,i_part)
461 
462  ENDDO
463 
464  END DO
465 
466  END DO
467 
468  f_(n_part*n_sections*n_mom+8) = rho_mix * dry_air_mass_fraction * w * r**2
469 
470  f_(n_part*n_sections*n_mom+9) = rho_mix * water_mass_fraction * w * r**2
471 
472  DO i_gas=1,n_gas
473 
474  f_(9+n_part*n_sections*n_mom+i_gas) = ( volcgas_mass_fraction(i_gas) &
475  * rho_mix ) * w * r**2
476 
477  END DO
478 
479  IF ( read_atm_profile .EQ. 'standard' ) THEN
480 
481  f_(itotal-1 ) = pa
482  f_(itotal ) = ta
483 
484  END IF
485 
486  RETURN
487 
488  END SUBROUTINE lump
489 
490  !******************************************************************************
492  !
501  !******************************************************************************
502 
503  SUBROUTINE marching(fold,fnew,rate)
505  IMPLICIT NONE
506  REAL(wp), DIMENSION(:), INTENT(IN) :: fold, rate
507  REAL(wp), DIMENSION(:), INTENT(OUT) :: fnew
508  INTEGER :: i
509  INTEGER :: i_part, i_mom
510 
511  DO i=1,itotal
512 
513  fnew(i) = fold(i) + rate(i) * dz
514 
515  ! WRITE(*,*) 'marching: i,fold(i),rate(i),dz',i,fold(i),rate(i),dz
516 
517  END DO
518 
519  ! READ(*,*)
520 
521  RETURN
522 
523  END SUBROUTINE marching
524 
525 
526 
527  !******************************************************************************
529  !
536  !******************************************************************************
537 
538  SUBROUTINE unlump(f_)
540  USE meteo_module, ONLY: u_atm , rair , pa , cpair , rwv , rho_atm , ta , &
541  visc_atm
542 
543  USE mixture_module, ONLY: rho_gas , rgasmix , rho_mix , t_mix , &
551 
555  rho_quad , phil , phir
556 
557  USE plume_module, ONLY: x , z , y , r , u , v , w , mag_u , phi
558 
559  USE moments_module, ONLY: n_nodes , n_sections
560 
562 
563  USE meteo_module, ONLY : zmet
564 
565  USE mixture_module, ONLY : eval_temp
566 
568 
570  ! USE particles_module, ONLY : eval_aggregation_moments
572 
573 
574  IMPLICIT NONE
575 
576  REAL(wp), DIMENSION(:), INTENT(INOUT) :: f_
577  !
578  REAL(wp), DIMENSION(n_part,n_nodes) :: xi , wi , wi_temp
579 
580  REAL(wp) :: rhoB_volcgas_w_r2(n_gas)
581 
582  REAL(wp) :: rhoB_solid_w_r2(n_part)
583  REAL(wp) :: rhoB_solid_tot_w_r2
584 
585  REAL(wp) :: alfa_s_w_r2(1:n_part)
586  REAL(wp) :: alfa_g_w_r2
587  REAL(wp) :: alfa_lw_w_r2
588  REAL(wp) :: alfa_ice_w_r2
589 
590  REAL(wp) :: atm_volume_fraction
591  REAL(wp) :: volcgas_mix_volume_fraction
592 
593  REAL(wp) :: w_r2
594 
595  REAL(wp) :: rho_solid_avg(n_part)
596  REAL(wp) :: rho_solid_tot_avg
597 
598  INTEGER :: j
599  INTEGER :: i_part
600  INTEGER :: i_sect
601  INTEGER :: i_mom
602 
603  INTEGER :: iter
604  INTEGER :: i_gas
605 
606  INTEGER :: idx , idx1 , idx2
607 
608  REAL(wp) :: enth
609 
610  REAL(wp) :: gas_mix_volume_fraction
611 
612  x = f_(6)
613  y = f_(7)
614 
615  ! ---- evaluate the new atmospheric density ad u and temperature at z -------
616  IF ( read_atm_profile .EQ. 'standard' ) THEN
617 
618  pa = f_(itotal-1 )
619  ta = f_(itotal )
620 
621  END IF
622 
623  CALL zmet
624 
625  u = f_(2)/f_(1)
626  v = f_(3)/f_(1)
627  w = f_(4)/f_(1)
628 
629  mag_u = sqrt( u*u + v*v + w*w )
630 
631  phi = atan( w / sqrt(u**2+v**2) )
632 
633  ! Mass fractions of volcanic gases (H2O excluded ) in mixture of volc. gases
634  volcgas_mass_fraction(1:n_gas) = &
635  f_(9+n_part*n_mom*n_sections+1:9+n_part*n_mom*n_sections+n_gas) / f_(1)
636 
637  ! Sum of additional gas (H2O excluded) mass fractions
638  volcgas_mix_mass_fraction = sum( volcgas_mass_fraction(1:n_gas) )
639 
640  rvolcgas_mix = 0.0_wp
641  cpvolcgas_mix = 0.0_wp
642 
643  ! Properties of the mixture of volcanic gases (H2O excluded)
644  IF ( n_gas .GT. 0 ) THEN
645 
646  DO i_gas = 1,n_gas
647 
648  rvolcgas_mix = rvolcgas_mix + volcgas_mass_fraction(i_gas) &
649  * rvolcgas(i_gas)
650 
651  cpvolcgas_mix = cpvolcgas_mix + volcgas_mass_fraction(i_gas) &
652  * cpvolcgas(i_gas)
653  END DO
654 
655  rvolcgas_mix = rvolcgas_mix / sum(volcgas_mass_fraction(1:n_gas))
656  cpvolcgas_mix = cpvolcgas_mix / sum(volcgas_mass_fraction(1:n_gas))
657 
658  IF ( verbose_level .GE. 2 ) THEN
659 
660  WRITE(*,*) 'rvolcgas_mix :', rvolcgas_mix
661  WRITE(*,*) 'cpvolcgas_mix :', cpvolcgas_mix
662 
663  END IF
664 
665  ELSE
666 
667  rvolcgas_mix = 0.0_wp
668  cpvolcgas_mix = 0.0_wp
669 
670  END IF
671 
672  ! mass fraction of dry air in the mixture
673  dry_air_mass_fraction = f_(8+n_part*n_mom*n_sections) / f_(1)
674 
675  ! mass fraction of water in the mixture
676  water_mass_fraction = f_(9+n_part*n_mom*n_sections) / f_(1)
677 
678  ! solid mass fraction in the mixture
679  solid_tot_mass_fraction = 1.0_wp-dry_air_mass_fraction- water_mass_fraction &
680  - volcgas_mix_mass_fraction
681 
682  ! The moments computed here are not correct, because a common multiplying
683  ! factor (w*r^2) is present. In any case, the quadrature values computed
684  ! from these "wrong" moments can be used to compute the new densities
685  ! of the solid phases, because the terms f_quad appear both at the
686  ! numerator and denominator and they are all scaled by the same factor.
687 
688  DO i_part=1,n_part
689 
690  DO i_sect=1,n_sections
691 
692  idx1 = 8+0+(i_part-1)*n_sections*n_mom+(i_sect-1)*n_mom
693  idx2 = 8+n_mom-1+(i_part-1)*n_sections*n_mom+(i_sect-1)*n_mom
694 
695  mom(0:1,i_sect,i_part) = f_(idx1:idx2)
696 
697  END DO
698 
699  rhob_solid_w_r2(i_part) = sum(mom(1,:,i_part))
700 
701  END DO
702 
703  ! compute the values of f_quad with the uncorrected moments
704  CALL eval_quad_values
705 
706  ! compute the average densities of the particle phases with f_quad values
707  DO i_part=1,n_part
708 
709  rho_solid_avg(i_part) = 1.0_wp / ( sum( f_quad(:,:,i_part) &
710  * w_quad(:,:,i_part) * m_quad(:,:,i_part) / rho_quad(:,:,i_part) ) &
711  / sum(f_quad(:,:,i_part)* w_quad(:,:,i_part) * m_quad(:,:,i_part) ) )
712 
713  IF ( verbose_level .GE. 1 ) THEN
714 
715  WRITE(*,*) 'i_part',i_part
716  WRITE(*,*) 'rhoB_solid_w_r2',idx1,rhob_solid_w_r2(i_part)
717  WRITE(*,*) 'i_part,rho_solid_avg',i_part, rho_solid_avg(i_part)
718  WRITE(*,*) 'mom(0,1,i_part)',mom(0,1,i_part)
719  WRITE(*,*) 'mom(1,1,i_part)',mom(1,1,i_part)
720  WRITE(*,*) 'f_quad(:,1,i_part)',f_quad(:,1,i_part)
721 
722  END IF
723 
724  END DO
725 
726  ! solid-average specific heat capacity
727  cpsolid = sum( rhob_solid_w_r2(1:n_part) * cp_part(1:n_part) ) &
728  / ( sum(rhob_solid_w_r2(1:n_part) ) )
729 
730  ! solid total mass flow rate
731  rhob_solid_tot_w_r2 = sum( rhob_solid_w_r2(1:n_part) )
732 
733  enth = f_(5) / f_(1) - gi * z - 0.50_wp * mag_u**2
734 
735  ! --- Compute water_vapor_mass_fraction, ice_mass_fraction -----------------
736  ! --- and t_mix from other variables ----------------------------------------
737 
738  CALL eval_temp(enth,pa,cpsolid)
739 
740  IF ( verbose_level .GE. 1 ) THEN
741 
742  WRITE(*,*)
743  WRITE(*,*) 't_mix',t_mix
744  WRITE(*,*) 'enth',enth
745  WRITE(*,*) 'mag_u',mag_u
746  WRITE(*,*) 'cpsolid',cpsolid
747  WRITE(*,*) 'solid_tot_mass_fraction',solid_tot_mass_fraction
748  WRITE(*,*) 'water_mass_fraction', water_mass_fraction
749  WRITE(*,*) 'volcgas_mix_mass_fraction', volcgas_mix_mass_fraction
750  WRITE(*,*) 'dry_air_mass_fraction', dry_air_mass_fraction
751  WRITE(*,*) 'water_vapor_mass_fraction', water_vapor_mass_fraction
752  WRITE(*,*) 'ice_mass_fraction',ice_mass_fraction
753  READ(*,*)
754 
755  END IF
756 
757  ! mass fraction of liquid water in the mixture
758  liquid_water_mass_fraction = water_mass_fraction-water_vapor_mass_fraction &
759  - ice_mass_fraction
760 
761  IF ( verbose_level .GE. 1 ) THEN
762 
763  WRITE(*,*) 'liquid_water_mass_fraction',liquid_water_mass_fraction
764 
765  END IF
766 
767  ! constant for mixture of dry air + water vapor + other volcanic gases
768  rgasmix = ( f_(8+n_part*n_mom*n_sections)*rair + water_vapor_mass_fraction &
769  * f_(1) * rwv + volcgas_mix_mass_fraction * f_(1) * rvolcgas_mix ) &
770  / ( f_(8+n_part*n_mom*n_sections) + f_(1) * &
771  ( water_vapor_mass_fraction + volcgas_mix_mass_fraction ) )
772 
773  ! density of mixture of dry air + water vapor + other volcanic gases
774  rho_gas = pa / ( rgasmix * t_mix )
775 
776  ! density of mixture of other volcanic gases (no H2O)
777  IF ( n_gas .GT. 0 ) THEN
778 
779  rhovolcgas_mix = pa / ( rvolcgas_mix * t_mix )
780 
781  ELSE
782 
783  rhovolcgas_mix = 0.0_wp
784 
785  END IF
786 
787  IF ( verbose_level .GE. 2 ) THEN
788 
789  WRITE(*,*)
790  WRITE(*,*) '*********************** UNLUMP ***********************'
791  WRITE(*,*) 'pa,t_mix',pa,t_mix
792  WRITE(*,*) 'rgasmix',rgasmix
793 
794  WRITE(*,*) 'rho_gas,rhovolcgas_mix',rho_gas,rhovolcgas_mix
795 
796  END IF
797 
798  !-- w*r^2 is computed summing the contributions from the different phases
799 
800  ! contribution from solid
801  alfa_s_w_r2(1:n_part) = rhob_solid_w_r2(1:n_part) / rho_solid_avg(1:n_part)
802 
803  ! contribution from all gas (water vapour, other volcanic gas, dry air)
804  alfa_g_w_r2 = ( f_(1) * ( 1.0_wp - liquid_water_mass_fraction &
805  - ice_mass_fraction ) - rhob_solid_tot_w_r2 ) / rho_gas
806 
807  ! contribution from liquid water
808  alfa_lw_w_r2 = f_(1) * liquid_water_mass_fraction / rho_lw
809 
810  ! contribution from ice
811  alfa_ice_w_r2 = f_(1) * ice_mass_fraction / rho_ice
812 
813  w_r2 = sum( alfa_s_w_r2(1:n_part) ) + alfa_g_w_r2 + alfa_lw_w_r2 &
814  + alfa_ice_w_r2
815 
816  r = sqrt( w_r2 / w )
817 
818  IF ( verbose_level .GE. 2 ) THEN
819 
820  WRITE(*,*)
821  WRITE(*,*) 'w_r2,r,w',w_r2,r,w
822  WRITE(*,*)
823 
824  END IF
825 
826  rho_mix = f_(1) / w_r2
827 
828  ! -------- update the moments -----------------------------------------------
829 
830  mom(0:n_mom-1,1:n_sections,1:n_part) = mom(0:n_mom-1,1:n_sections,1:n_part) &
831  / w_r2
832 
833  ! update the values of the linear reconstructions at the quadrature points
834  f_quad(1:n_nodes,1:n_sections,1:n_part) = &
835  f_quad(1:n_nodes,1:n_sections,1:n_part) / w_r2
836 
837  ! With the new quadrature values the moments of other variables are updated
838  CALL eval_particles_moments
839 
840 
841  IF ( verbose_level .GE. 2 ) THEN
842 
843  WRITE(*,*) '*********** SUM(alfa_s(1:n_part))' , &
844  sum(alfa_s_w_r2(1:n_part))/w_r2
845  WRITE(*,*) ' alfa_g', alfa_g_w_r2/ w_r2
846  WRITE(*,*) ' alfa_lw', alfa_lw_w_r2/ w_r2
847  WRITE(*,*) ( alfa_lw_w_r2 + alfa_ice_w_r2 + alfa_g_w_r2 &
848  + sum(alfa_s_w_r2(1:n_part)) ) / w_r2
849 
850  WRITE(*,*) 'rho_gas',rho_gas
851  WRITE(*,*) '*********** SUM(alfa_s_w_r2(1:n_part))' , &
852  sum(alfa_s_w_r2(1:n_part))
853  WRITE(*,*) 'w_r2,r,w',w_r2,r,w
854  WRITE(*,*) 'f_(1),rho_gas',f_(1),rho_gas
855  WRITE(*,*) 'rhoB_solid_tot_w_r2',rhob_solid_tot_w_r2
856  WRITE(*,*) 'rho_mix',rho_mix
857  WRITE(*,*) 'alfa_g', alfa_g_w_r2 / w_r2
858  READ(*,*)
859 
860  END IF
861 
862 
863  ! --------- liquid fractions ------------------------------------------------
864  liquid_water_volume_fraction = liquid_water_mass_fraction * ( rho_mix &
865  / rho_lw)
866 
867  ! --------- ice fractions ---------------------------------------------------
868  ice_volume_fraction = ice_mass_fraction * ( rho_mix / rho_ice)
869 
870  ! -------- solid fractions --------------------------------------------------
871 
872  solid_volume_fraction(1:n_part) = alfa_s_w_r2(1:n_part) / w_r2
873 
874  solid_tot_volume_fraction = sum( solid_volume_fraction(1:n_part) )
875 
876  solid_partial_volume_fraction(1:n_part) = solid_volume_fraction(1:n_part) / &
877  solid_tot_volume_fraction
878 
879  solid_partial_mass_fraction = solid_partial_volume_fraction * rho_solid_avg &
880  / sum( solid_partial_volume_fraction * rho_solid_avg )
881 
882  solid_mass_fraction(1:n_part) = solid_volume_fraction(1:n_part) * &
883  rho_solid_avg(1:n_part) / rho_mix
884 
885  rho_solid_tot_avg = sum( solid_partial_volume_fraction * rho_solid_avg )
886 
887  ! --------- gas fractions ---------------------------------------------------
888  ! --------- mixture of dry air + water vapor + other volcanic gases ---------
889 
890  gas_mass_fraction = ( f_(1) * ( 1.0_wp - liquid_water_mass_fraction &
891  - ice_mass_fraction ) - rhob_solid_tot_w_r2 ) / f_(1)
892 
893  gas_volume_fraction = 1.0_wp - solid_tot_volume_fraction - &
894  liquid_water_volume_fraction - ice_volume_fraction
895 
896  volcgas_mix_volume_fraction = volcgas_mix_mass_fraction * ( rho_mix / &
897  rhovolcgas_mix )
898 
899  IF ( verbose_level .GE. 1 ) THEN
900 
901  WRITE(*,*) ''
902  WRITE(*,*) '************** UNLUMPED VARIABLES **************'
903  WRITE(*,*) 'pres',pa
904  WRITE(*,*) 'rgasmix',rgasmix
905  WRITE(*,*) 't_mix',t_mix
906  WRITE(*,*) 'u,v,w',u,v,w
907  WRITE(*,*) 'r',r
908  WRITE(*,*) 'z',z
909  WRITE(*,*) 'mass_flow_rate', pi_g * rho_mix * w * (r**2)
910 
911  WRITE(*,*) ''
912  WRITE(*,*) '************** DENSITIES **************'
913  WRITE(*,*) 'rho_gas',rho_gas
914  WRITE(*,*) 'rho solids',rho_solid_avg
915  WRITE(*,*) 'rho solid tot avg',rho_solid_tot_avg
916  WRITE(*,*) 'rho_atm',rho_atm
917  WRITE(*,*) 'rho_mix',rho_mix
918 
919  WRITE(*,*) ''
920  WRITE(*,*) '************** VOLUME FRACTIONS **************'
921  WRITE(*,*) 'solid partial volume fractions',solid_partial_volume_fraction
922  WRITE(*,*) 'solid tot volume fraction',solid_tot_volume_fraction
923  WRITE(*,*) 'liquid water volume fraction',liquid_water_volume_fraction
924  WRITE(*,*) 'ice volume fraction',ice_volume_fraction
925  WRITE(*,*) 'gas volume fraction',gas_volume_fraction
926  WRITE(*,*) 'sum of previous four volume fractions', &
927  solid_tot_volume_fraction + liquid_water_volume_fraction + &
928  gas_volume_fraction + ice_volume_fraction
929 
930  WRITE(*,*) ''
931  WRITE(*,*) '************** MASS FRACTIONS **************'
932  WRITE(*,*) 'solid partial mass fractions',solid_partial_mass_fraction
933  WRITE(*,*) 'solid tot mass fraction',solid_tot_mass_fraction
934  WRITE(*,*) 'liquid water mass fraction',liquid_water_mass_fraction
935  WRITE(*,*) 'ice mass fraction',ice_mass_fraction
936  WRITE(*,*) 'gas mass fraction',gas_mass_fraction
937  WRITE(*,*) 'sum of previous four mass fractions', &
938  solid_tot_mass_fraction + liquid_water_mass_fraction + &
939  gas_mass_fraction + ice_mass_fraction
940 
941  WRITE(*,*)
942 
943  WRITE(*,*) 'volcgas_mass_fractions',volcgas_mass_fraction
944  WRITE(*,*) 'volcgas_mix_mass_fraction',volcgas_mix_mass_fraction
945  WRITE(*,*) 'water vapor mass fraction',water_vapor_mass_fraction
946  WRITE(*,*) 'dry air mass fraction',dry_air_mass_fraction
947  WRITE(*,*) 'sum of previous three mass fractions', &
948  volcgas_mix_mass_fraction + water_vapor_mass_fraction + &
949  dry_air_mass_fraction
950  WRITE(*,*) 'liquid water mass fraction',liquid_water_mass_fraction
951  WRITE(*,*) 'ice mass fraction',ice_mass_fraction
952 
953  WRITE(*,*) ''
954 
955  WRITE(*,*) 'Solid partial mass fractions'
956 
957  DO i_part=1,n_part
958 
959  WRITE(*,*) 'Particle phase:',i_part
960  WRITE(*,"(30F8.2)") phil(n_sections:1:-1)
961  WRITE(*,"(30F8.2)") phir(n_sections:1:-1)
962  WRITE(*,"(30ES8.1)") mom(1,n_sections:1:-1,i_part) / &
963  sum( mom(1,:,i_part) )
964  WRITE(*,*)
965 
966  END DO
967 
968  READ(*,*)
969 
970  END IF
971 
972  END SUBROUTINE unlump
973 
974 END MODULE solver_module
subroutine aggr_rate
Compute the right-hand side of the equations.
integer n_mom
Number of moments.
Definition: moments.f90:24
integer n_part
number of particle phases
Definition: particles.f90:23
real(wp) exit_status
exit_status
Definition: mixture.f90:40
real(wp) v_wind
Definition: meteo.f90:57
real(wp) visc_atm
Atmospheric kinematic viscosity.
Definition: meteo.f90:70
real(wp) pa
Atmospheric pressure.
Definition: meteo.f90:79
real(wp), dimension(:), allocatable f_stepold
Integrated variables.
Definition: solver_rise.f90:40
real(wp) u
plume x-horizontal velocity
Definition: plume.f90:23
real(wp) rho_atm
Atmospheric density.
Definition: meteo.f90:60
real(wp), dimension(:), allocatable rhs2
Right-Hand Side (rhs2) aggregation terms only.
Definition: solver_rise.f90:25
real(wp), dimension(:), allocatable volcgas_rate
Rate of change of volcanic gases.
Definition: solver_rise.f90:43
real(wp) ice_mass_fraction
mass fraction of ice in the mixture
Definition: mixture.f90:118
subroutine linear_reconstruction(Ml, Mr, mom, Ma, Mb, alfa, beta, gamma1, gamma2)
Definition: moments.f90:178
character(len=20) distribution
Ditribution of the particles: .
Definition: particles.f90:110
subroutine eval_particles_moments
Particles moments computation.
Definition: particles.f90:1100
real(wp) liquid_water_mass_fraction
mass fraction of liquid water in the mixture
Definition: mixture.f90:106
real(wp), dimension(:), allocatable volcgas_mass_fraction
mass fractions of volcanic gases
Definition: mixture.f90:82
real(wp) cpair
specific heat capacity for dry air
Definition: meteo.f90:91
real(wp), dimension(:,:,:), allocatable m_quad
Abscissa of quadrature formulas.
Definition: particles.f90:131
real(wp), parameter h_lw0
enthalpy of liquid water at reference temperature (J kg-1)
Definition: meteo.f90:103
logical flag_nbl
Definition: variables.f90:47
real(wp) v
plume y-horizontal velocity
Definition: plume.f90:24
integer itotal
Total number of equations.
Definition: solver_rise.f90:46
real(wp) dz0
Initial integration step.
Definition: solver_rise.f90:52
real(wp) gas_volume_fraction
gas vlume fraction in the mixture
Definition: mixture.f90:22
real(wp), dimension(:), allocatable solid_volume_fraction
volume fraction of the particle phases with respect to the mixture
Definition: particles.f90:41
real(wp) water_vapor_mass_fraction
mass fraction of water vapor in the mixture
Definition: mixture.f90:112
integer n_sections
Definition: moments.f90:26
real(wp) rho_ice
Density of ice in the mixture.
Definition: mixture.f90:133
real(wp), dimension(:,:,:), allocatable set_mom
Moments of the settling velocities.
Definition: particles.f90:59
real *8 pi_g
Greek pi.
Definition: variables.f90:30
real(wp) ta
Atmospheric temperature.
Definition: meteo.f90:76
real(wp) dry_air_mass_fraction
mass fraction of dry air in the mixture
Definition: mixture.f90:100
integer n_nodes
Number of nodes for the quadrature.
Definition: moments.f90:18
Particles module.
Definition: particles.f90:11
real(wp) x
plume location (downwind)
Definition: plume.f90:19
real(wp) rvolcgas_mix
gas constant of volcanic gases mixture ( J/(kg K) )
Definition: mixture.f90:88
real(wp) volcgas_mix_mass_fraction
mass fraction of the volcanic gas in the mixture
Definition: mixture.f90:97
real(wp) u_atm
Horizonal wind speed.
Definition: meteo.f90:54
real(wp), dimension(:,:,:), allocatable set_cp_mom
Moments of the settling velocities times the heat capacity.
Definition: particles.f90:62
logical aggregation_flag
Definition: variables.f90:72
real(wp), dimension(:,:,:), allocatable f_quad
Values of linear reconstructions at quadrature points.
Definition: particles.f90:158
real(wp) beta_inp
entrainment coefficient (normal direction)
Definition: plume.f90:30
subroutine rate
Compute the right-hand side of the equations.
real(wp) alpha_inp
entrainment coefficient (parallel direction)
Definition: plume.f90:29
real(wp), dimension(:,:,:), allocatable rho_quad
Particle densities at quadrature points.
Definition: particles.f90:146
real(wp) cpvolcgas_mix
specific heat of volcanic gases mixture
Definition: mixture.f90:91
real(wp), dimension(:), allocatable f
Integrated variables.
Definition: solver_rise.f90:37
real(wp), dimension(:), allocatable cp_part
Heat capacity of particle phases.
Definition: particles.f90:92
real(wp) prob_factor
particle loss factor
Definition: plume.f90:31
real(wp) y
plume location (crosswind)
Definition: plume.f90:20
real(wp), dimension(:), allocatable solid_partial_mass_fraction
mass fraction of the particle phases with respect to the total solid
Definition: particles.f90:26
Meteo module.
Definition: meteo.f90:11
subroutine eval_temp(enth, pa, cpsolid)
Mixture temperature.
Definition: mixture.f90:560
real(wp) solid_tot_volume_fraction
solid volume fraction in the mixture
Definition: mixture.f90:46
real(wp) r0
initial radius of the plume
Definition: plume.f90:37
real(wp) rgasmix
universal constant for the mixture
Definition: mixture.f90:28
subroutine update_aggregation(temp, visc, lw_vf, ice_vf, solid_mf)
Aggregation terms.
Definition: particles.f90:1478
real(wp) atm_mass_fraction
mass fraction of the entrained air in the mixture
Definition: mixture.f90:94
real(wp), dimension(:), allocatable solid_mass_fraction
mass fraction of the particle phases with respect to the mixture
Definition: particles.f90:35
real(wp) dz
Integration step.
Definition: solver_rise.f90:49
real(wp) rp
radiation coefficient (kg/m**2/deg. k**3/s)
Definition: plume.f90:28
real(wp) gamma_m
Definition: meteo.f90:38
Gas/particles mixture module.
Definition: mixture.f90:11
real(wp) rho_mix
mixture density
Definition: mixture.f90:31
real(wp) s
length along plume centerline
Definition: plume.f90:18
Plume module.
Definition: plume.f90:11
real(wp), parameter h_wv0
enthalpy of water vapor at reference temperature (J kg-1)
Definition: meteo.f90:97
real(wp) cos_theta
Wind angle.
Definition: meteo.f90:48
real(wp) phi
angle between the plume trajectory and ground
Definition: plume.f90:27
subroutine zmet
Meteo parameters.
Definition: meteo.f90:229
real(wp), parameter c_ice
specific heat of ice (J K-1 kg-1)
Definition: meteo.f90:109
real(wp) rair
perfect gas constant for dry air ( J/(kg K) )
Definition: meteo.f90:88
Method of Moments module.
Definition: moments.f90:11
logical particles_loss
logical defining if we loose particles
Definition: plume.f90:32
real(wp), dimension(:), allocatable rvolcgas
gas constants for volcanic gases
Definition: mixture.f90:70
real(wp), dimension(:,:,:), allocatable mom
Moments of the particles diameter.
Definition: particles.f90:53
real(wp), dimension(:), allocatable phil
left boundaries of the sections in phi-scale
Definition: particles.f90:164
real(wp), parameter t_ref
reference temperature (K)
Definition: meteo.f90:94
real(wp), dimension(:), allocatable rhs
Right-Hand Side (rhs)
Definition: solver_rise.f90:31
logical entr_abv_nbl_flag
Flag to allow for entrainment above neutral buoyancy level.
Definition: variables.f90:50
real(wp) mag_u
velocity magnitude along the centerline
Definition: plume.f90:26
real(wp), dimension(:,:,:), allocatable w_quad
Weights of quadrature formulas.
Definition: particles.f90:134
real(wp), dimension(:), allocatable rhstemp
Right-Hand Side (rhs)
Definition: solver_rise.f90:28
Solver module.
Definition: solver_rise.f90:11
real(wp) u_wind
Definition: meteo.f90:56
real(wp) liquid_water_volume_fraction
mass fraction of liquid water in the mixture
Definition: mixture.f90:109
real(wp) z
plume vertical coordinate
Definition: plume.f90:21
real(wp) water_mass_fraction
mass fraction of water in the mixture
Definition: mixture.f90:103
real(wp) rho_gas
gas phase density
Definition: mixture.f90:25
real(wp), dimension(:,:,:), allocatable birth_mom
Term accounting for the birth of aggregates in the moments equations.
Definition: particles.f90:65
real(wp), dimension(:), allocatable cpvolcgas
specific heat capacity for volcanic gases
Definition: mixture.f90:73
real(wp) cpsolid
Average heat capacity of particles.
Definition: particles.f90:95
integer, parameter wp
working precision
Definition: variables.f90:21
real(wp), dimension(:), allocatable ftemp
Integrated variables.
Definition: solver_rise.f90:34
real(wp), dimension(:), allocatable phir
right boundaries of the sections in phi-scale
Definition: particles.f90:167
real(wp) t_mix
mixture temperature
Definition: mixture.f90:37
real(wp), parameter c_lw
specific heat of liquid water (J K-1 kg-1)
Definition: meteo.f90:106
real(wp), parameter c_wv
specifc heat of water vapor (J K-1 kg-1)
Definition: meteo.f90:100
real(wp), dimension(:), allocatable rhs1
Right-Hand Side (rhs1) terms without aggregation.
Definition: solver_rise.f90:22
real(wp) rhovolcgas_mix
volcanic gases mixture density
Definition: mixture.f90:85
subroutine lump(f_)
Calculate the lumped variables.
real(wp), dimension(:,:,:), allocatable death_mom
Term accounting for the loss of particles because of aggregation.
Definition: particles.f90:68
subroutine marching(fold, fnew, rate)
Marching s one step.
real(wp) function particles_density(i_part, phi)
Particle density.
Definition: particles.f90:607
real *8 gi
Gravity acceleration.
Definition: variables.f90:24
real(wp) mixture_enthalpy
Definition: mixture.f90:127
real(wp) r
plume radius
Definition: plume.f90:22
real(wp), parameter rwv
gas constant for water vapor ( J/(kg K) )
Definition: meteo.f90:118
real(wp) rho_lw
Density of liquid water in the mixture.
Definition: mixture.f90:130
subroutine unlump(f_)
Calculate physical variables from lumped variables.
subroutine eval_quad_values
Quadrature values computation.
Definition: particles.f90:1179
subroutine allocate_matrix
Solver variables allocation.
Definition: solver_rise.f90:69
integer n_gas
volcanic gas species number
Definition: mixture.f90:64
real(wp), dimension(:), allocatable solid_partial_volume_fraction
volume fraction of the particle phases with respect to the total solid
Definition: particles.f90:32
real(wp) solid_tot_mass_fraction
solid mass fraction in the mixture
Definition: mixture.f90:58
real(wp) ice_volume_fraction
mass fraction of ice in the mixture
Definition: mixture.f90:121
Global variables.
Definition: variables.f90:10
real(wp) gas_mass_fraction
gas mass fraction in the mixture
Definition: mixture.f90:19
real(wp) w
plume vertical velocity
Definition: plume.f90:25
character *10 read_atm_profile
Definition: meteo.f90:134
real(wp) sin_theta
Definition: meteo.f90:48
integer verbose_level
Level of verbose output (0 = minimal output on screen)
Definition: variables.f90:33
real(wp) sphu_atm
Atmospheric specific humidity (kg/kg)
Definition: meteo.f90:63