15 USE plume_module, ONLY: vent_height, alpha_inp , beta_inp , particles_loss ,&
16 r0 , w0 , z , mfr_exp0
21 diam2 , rho2 , cp_part , settling_model , distribution , &
22 distribution_variable , solid_mass_fraction , shape_factor
24 USE meteo_module, ONLY: gt , gs , p0 , t0 , h1 , h2 , u_atm0 , duatm_dz0 , &
25 visc_atm0 , rair , cpair , read_atm_profile , u_r , z_r , exp_wind , &
30 USE mixture_module, ONLY: tp0 , gas_mass_fraction0 , rwvapour , cpwvapour , &
31 initial_neutral_density
39 CHARACTER(LEN=30) :: inp_file
42 CHARACTER(LEN=30) :: bak_file
45 CHARACTER(LEN=30) :: run_name
48 CHARACTER(LEN=30) :: col_file
51 CHARACTER(LEN=30) :: hy_file
54 CHARACTER(LEN=30) :: mom_file
57 CHARACTER(LEN=30) :: dak_file
60 CHARACTER(LEN=30) :: mat_file
63 CHARACTER(LEN=50) :: atm_file
90 REAL*8,
ALLOCATABLE :: mu_lognormal(:) , sigma_lognormal(:)
95 REAL*8 :: hy_deltaz , hy_z , hy_z_old , hy_x , hy_y , hy_x_old , hy_y_old
97 REAL*8,
ALLOCATABLE :: solid_mfr(:) , solid_mfr_old(:)
99 namelist / control_parameters / run_name , verbose_level , dakota_flag , &
100 inversion_flag , hysplit_flag
102 namelist / inversion_parameters / height_weight , height_obj , mu_weight , &
103 mu_obj , sigma_weight , sigma_obj , skew_weight , skew_obj
105 namelist / plume_parameters / alpha_inp , beta_inp , particles_loss
107 namelist / atm_parameters / visc_atm0 , rair , cpair , wind_mult_coeff , &
108 read_atm_profile , settling_model , shape_factor
110 namelist / std_atm_parameters / gt , gs , p0 , t0 , h1 , h2 , u_atm0 , &
111 duatm_dz0 , u_r , z_r , exp_wind
113 namelist / table_atm_parameters / month , lat , u_r , z_r , exp_wind
115 namelist / initial_values / r0 , w0 , mfr_exp0 , tp0 , &
116 initial_neutral_density , gas_mass_fraction0 , vent_height , ds0 , &
117 n_part , distribution , distribution_variable , n_mom
119 namelist / mixture_parameters / diam1 , rho1 , diam2 , rho2 , cp_part , &
122 namelist / lognormal_parameters / solid_partial_mass_fraction , &
123 mu_lognormal , sigma_lognormal
153 pi_g = 4.d0 * atan(1.d0)
155 wind_mult_coeff = 1.d0
160 inp_file =
'plume_model.inp'
162 INQUIRE (file=inp_file,exist=lexist)
164 IF (lexist .EQV. .false.)
THEN
172 run_name =
'default_run'
174 dakota_flag = .false.
175 hysplit_flag = .false.
176 inversion_flag = .false.
191 particles_loss = .true.
197 wind_mult_coeff = 1.d0
198 read_atm_profile =
"standard"
199 settling_model =
"textor"
218 initial_neutral_density = .false.
219 gas_mass_fraction0 = 3.0d-2
220 vent_height = 1500.d0
223 distribution =
'lognormal'
224 distribution_variable =
'particles_number'
241 ALLOCATE( mu_lognormal(n_part) )
242 ALLOCATE( sigma_lognormal(n_part) )
244 solid_partial_mass_fraction = 1.d0
246 sigma_lognormal= 1.6d0
250 OPEN(inp_unit,file=inp_file,status=
'NEW')
252 WRITE(inp_unit, control_parameters )
253 WRITE(inp_unit, plume_parameters )
254 WRITE(inp_unit, atm_parameters )
255 WRITE(inp_unit, std_atm_parameters )
256 WRITE(inp_unit, initial_values )
257 WRITE(inp_unit, mixture_parameters )
258 WRITE(inp_unit, lognormal_parameters )
262 WRITE(*,*)
'Input file plume_model.inp not found'
263 WRITE(*,*)
'A new one with default values has been created'
284 USE meteo_module, ONLY: rho_atm , ta , pa , atm_profile , n_atm_profile
298 USE meteo_module, ONLY : rho_atm_month_lat , pres_atm_month_lat , temp_atm_month_lat
307 CHARACTER(LEN=80) :: card
311 REAL*8,
DIMENSION(max_n_part) :: solid_volume_fraction0
312 REAL*8,
ALLOCATABLE :: d_max(:)
313 REAL*8,
ALLOCATABLE :: p_beta(:) , q_beta(:)
315 REAL*8,
ALLOCATABLE :: mu_bar(:) , sigma_bar(:)
316 REAL*8,
ALLOCATABLE :: diam_constant(:)
317 REAL*8,
ALLOCATABLE :: diam_constant_phi(:)
319 REAL*8 :: solid_tot_volume_fraction0
323 REAL*8,
DIMENSION(max_n_part) :: rho_solid_avg
325 REAL*8 :: rho_solid_tot_avg
332 REAL*8,
ALLOCATABLE :: xi(:) , wi(:)
333 REAL*8,
ALLOCATABLE :: part_dens_array(:)
335 REAL*8,
ALLOCATABLE :: atm_profile0(:,:)
341 INTEGER,
ALLOCATABLE :: coeff(:,:)
343 REAL*8,
ALLOCATABLE :: rho_atm_month(:,:)
345 REAL*8 :: rho_atm_jan(100,13)
346 REAL*8 :: rho_atm_apr(100,13)
347 REAL*8 :: rho_atm_jul(100,13)
348 REAL*8 :: rho_atm_oct(100,13)
350 REAL*8,
ALLOCATABLE :: pres_atm_month(:,:)
352 REAL*8 :: pres_atm_jan(100,13)
353 REAL*8 :: pres_atm_apr(100,13)
354 REAL*8 :: pres_atm_jul(100,13)
355 REAL*8 :: pres_atm_oct(100,13)
357 REAL*8,
ALLOCATABLE :: temp_atm_month(:,:)
359 REAL*8 :: temp_atm_jan(100,13)
360 REAL*8 :: temp_atm_apr(100,13)
361 REAL*8 :: temp_atm_jul(100,13)
362 REAL*8 :: temp_atm_oct(100,13)
366 INTEGER :: n_atm_levels
372 namelist / beta_parameters / solid_partial_mass_fraction , p_beta , q_beta ,&
375 namelist / constant_parameters / solid_partial_mass_fraction , &
378 namelist / hysplit_parameters / hy_deltaz
380 WRITE(*,*)
'PLUME_MODEL: *** Starting the run ***'
386 inp_file =
'plume_model.inp'
388 OPEN(inp_unit,file=inp_file,status=
'old')
390 READ(inp_unit, control_parameters)
392 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'read control_parameters: done'
394 IF ( inversion_flag )
READ(inp_unit, inversion_parameters)
396 READ(inp_unit, plume_parameters)
398 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'read plume_parameters: done'
400 READ(inp_unit, atm_parameters)
402 IF ( read_atm_profile .EQ.
'table' )
THEN
404 read( inp_unit, table_atm_parameters )
410 atm_file =
'../AtmProfile_info/Density_April.txt'
412 OPEN(atm_unit,file=atm_file,status=
'old')
418 atm_read_levels_apr:
DO
420 atm_level = atm_level + 1
424 READ(atm_unit,*,iostat=io ) rho_atm_apr(atm_level,1:8)
428 END DO atm_read_levels_apr
436 atm_file =
'../AtmProfile_info/Density_Jan.txt'
438 OPEN(atm_unit,file=atm_file,status=
'old')
444 atm_read_levels_jan:
DO
446 atm_level = atm_level + 1
448 READ(atm_unit,*,iostat=io) rho_atm_jan(atm_level,1:8)
452 END DO atm_read_levels_jan
460 atm_file =
'../AtmProfile_info/Density_July.txt'
462 OPEN(atm_unit,file=atm_file,status=
'old')
468 atm_read_levels_jul:
DO
470 atm_level = atm_level + 1
472 READ(atm_unit,*,iostat=io) rho_atm_jul(atm_level,1:8)
476 END DO atm_read_levels_jul
484 atm_file =
'../AtmProfile_info/Density_Oct.txt'
486 OPEN(atm_unit,file=atm_file,status=
'old')
492 atm_read_levels_oct:
DO
494 atm_level = atm_level + 1
496 READ(atm_unit,*,iostat=io) rho_atm_oct(atm_level,1:8)
500 n_atm_levels = atm_level
502 END DO atm_read_levels_oct
512 atm_file =
'../AtmProfile_info/Pressure_April.txt'
514 OPEN(atm_unit,file=atm_file,status=
'old')
520 pres_read_levels_apr:
DO
522 atm_level = atm_level + 1
524 READ(atm_unit,*,iostat=io) pres_atm_apr(atm_level,1:8)
528 END DO pres_read_levels_apr
536 atm_file =
'../AtmProfile_info/Pressure_Jan.txt'
538 OPEN(atm_unit,file=atm_file,status=
'old')
544 pres_read_levels_jan:
DO
546 atm_level = atm_level + 1
548 READ(atm_unit,*,iostat=io) pres_atm_jan(atm_level,1:8)
552 END DO pres_read_levels_jan
560 atm_file =
'../AtmProfile_info/Pressure_July.txt'
562 OPEN(atm_unit,file=atm_file,status=
'old')
568 pres_read_levels_jul:
DO
570 atm_level = atm_level + 1
572 READ(atm_unit,*,iostat=io) pres_atm_jul(atm_level,1:8)
576 END DO pres_read_levels_jul
585 atm_file =
'../AtmProfile_info/Pressure_Oct.txt'
587 OPEN(atm_unit,file=atm_file,status=
'old')
593 pres_read_levels_oct:
DO
595 atm_level = atm_level + 1
597 READ(atm_unit,*,iostat=io) pres_atm_oct(atm_level,1:8)
601 n_atm_levels = atm_level
603 END DO pres_read_levels_oct
615 atm_file =
'../AtmProfile_info/Temp_April.txt'
617 OPEN(atm_unit,file=atm_file,status=
'old')
623 temp_read_levels_apr:
DO
625 atm_level = atm_level + 1
627 READ(atm_unit,*,iostat=io) temp_atm_apr(atm_level,1:8)
631 END DO temp_read_levels_apr
639 atm_file =
'../AtmProfile_info/Temp_Jan.txt'
641 OPEN(atm_unit,file=atm_file,status=
'old')
647 temp_read_levels_jan:
DO
649 atm_level = atm_level + 1
651 READ(atm_unit,*,iostat=io) temp_atm_jan(atm_level,1:8)
655 END DO temp_read_levels_jan
663 atm_file =
'../AtmProfile_info/Temp_July.txt'
665 OPEN(atm_unit,file=atm_file,status=
'old')
671 temp_read_levels_jul:
DO
673 atm_level = atm_level + 1
675 READ(atm_unit,*,iostat=io) temp_atm_jul(atm_level,1:8)
679 END DO temp_read_levels_jul
688 atm_file =
'../AtmProfile_info/Temp_Oct.txt'
690 OPEN(atm_unit,file=atm_file,status=
'old')
696 temp_read_levels_oct:
DO
698 atm_level = atm_level + 1
700 READ(atm_unit,*,iostat=io) temp_atm_oct(atm_level,1:8)
704 n_atm_levels = atm_level
706 END DO temp_read_levels_oct
710 ALLOCATE( h_levels(n_atm_levels) )
712 ALLOCATE( rho_atm_month_lat(n_atm_levels) , rho_atm_month(n_atm_levels,8) )
713 ALLOCATE( pres_atm_month_lat(n_atm_levels) , pres_atm_month(n_atm_levels,8) )
714 ALLOCATE( temp_atm_month_lat(n_atm_levels) , temp_atm_month(n_atm_levels,8) )
716 IF ((month .GE. 0.d0) .and. (month .LE. 1.d0))
THEN
718 rho_atm_month(1:n_atm_levels,1:8) = rho_atm_jan(1:n_atm_levels,1:8)
719 pres_atm_month(1:n_atm_levels,1:8) = pres_atm_jan(1:n_atm_levels,1:8)
720 temp_atm_month(1:n_atm_levels,1:8) = temp_atm_jan(1:n_atm_levels,1:8)
722 ELSEIF ((month .GT. 1.d0) .and. (month .LE. 2.d0))
THEN
724 rho_atm_month(1:n_atm_levels,1:8) = rho_atm_apr(1:n_atm_levels,1:8)
725 pres_atm_month(1:n_atm_levels,1:8) = pres_atm_apr(1:n_atm_levels,1:8)
726 temp_atm_month(1:n_atm_levels,1:8) = temp_atm_apr(1:n_atm_levels,1:8)
728 ELSEIF ((month .GT. 2.d0) .and. (month .LE. 3.d0))
THEN
730 rho_atm_month(1:n_atm_levels,1:8) = rho_atm_jul(1:n_atm_levels,1:8)
731 pres_atm_month(1:n_atm_levels,1:8) = pres_atm_jul(1:n_atm_levels,1:8)
732 temp_atm_month(1:n_atm_levels,1:8) = temp_atm_jul(1:n_atm_levels,1:8)
734 ELSEIF ((month .GT. 3.d0) .and. (month .LE. 4.d0))
THEN
736 rho_atm_month(1:n_atm_levels,1:8) = rho_atm_apr(1:n_atm_levels,1:8)
737 pres_atm_month(1:n_atm_levels,1:8) = pres_atm_apr(1:n_atm_levels,1:8)
738 temp_atm_month(1:n_atm_levels,1:8) = temp_atm_apr(1:n_atm_levels,1:8)
742 IF ( ( lat .GE. 0.d0 ) .AND. ( lat .LE. 15.d0 ) )
THEN
744 coeff_lat = 1.d0 - ( lat - 0.d0 ) / ( 15.d0 - 0.d0 )
746 rho_atm_month_lat(1:n_atm_levels) = coeff_lat * rho_atm_month(1:n_atm_levels,2) &
747 + ( 1.d0 - coeff_lat ) * rho_atm_month(1:n_atm_levels,3)
749 pres_atm_month_lat(1:n_atm_levels) = coeff_lat * pres_atm_month(1:n_atm_levels,2) &
750 + ( 1.d0 - coeff_lat ) * pres_atm_month(1:n_atm_levels,3)
752 temp_atm_month_lat(1:n_atm_levels) = coeff_lat * temp_atm_month(1:n_atm_levels,2) &
753 + ( 1.d0 - coeff_lat ) * temp_atm_month(1:n_atm_levels,3)
755 ELSEIF ( ( lat .GT. 15.d0 ) .AND. ( lat .LE. 30.d0 ) )
THEN
757 coeff_lat = 1.d0 - ( lat - 15.d0 ) / ( 30.d0 - 15.d0 )
759 rho_atm_month_lat(1:n_atm_levels) = coeff_lat * rho_atm_month(1:n_atm_levels,3) &
760 + ( 1.d0 - coeff_lat ) * rho_atm_month(1:n_atm_levels,4)
762 pres_atm_month_lat(1:n_atm_levels) = coeff_lat * pres_atm_month(1:n_atm_levels,3) &
763 + ( 1.d0 - coeff_lat ) * pres_atm_month(1:n_atm_levels,5)
765 temp_atm_month_lat(1:n_atm_levels) = coeff_lat * temp_atm_month(1:n_atm_levels,3) &
766 + ( 1.d0 - coeff_lat ) * temp_atm_month(1:n_atm_levels,5)
768 ELSEIF ( ( lat .GT. 30.d0 ) .AND. ( lat .LE. 45.d0 ) )
THEN
770 coeff_lat = 1.d0 - ( lat - 30.d0 ) / ( 45.d0 - 30.d0 )
772 rho_atm_month_lat(1:n_atm_levels) = coeff_lat * rho_atm_month(1:n_atm_levels,4) &
773 + ( 1.d0 - coeff_lat ) * rho_atm_month(1:n_atm_levels,5)
775 pres_atm_month_lat(1:n_atm_levels) = coeff_lat * pres_atm_month(1:n_atm_levels,4) &
776 + ( 1.d0 - coeff_lat ) * pres_atm_month(1:n_atm_levels,5)
778 temp_atm_month_lat(1:n_atm_levels) = coeff_lat * temp_atm_month(1:n_atm_levels,4) &
779 + ( 1.d0 - coeff_lat ) * temp_atm_month(1:n_atm_levels,5)
781 ELSEIF ( ( lat .GT. 45.d0 ) .AND. ( lat .LE. 60.d0 ) )
THEN
783 coeff_lat = 1.d0 - ( lat - 45.d0 ) / ( 60.d0 - 45.d0 )
785 rho_atm_month_lat(1:n_atm_levels) = coeff_lat * rho_atm_month(1:n_atm_levels,5) &
786 + ( 1.d0 - coeff_lat ) * rho_atm_month(1:n_atm_levels,6)
788 pres_atm_month_lat(1:n_atm_levels) = coeff_lat * pres_atm_month(1:n_atm_levels,5) &
789 + ( 1.d0 - coeff_lat ) * pres_atm_month(1:n_atm_levels,6)
791 temp_atm_month_lat(1:n_atm_levels) = coeff_lat * temp_atm_month(1:n_atm_levels,5) &
792 + ( 1.d0 - coeff_lat ) * temp_atm_month(1:n_atm_levels,6)
794 ELSEIF ( ( lat .GT. 60.d0 ) .AND. ( lat .LE. 75.d0 ) )
THEN
796 coeff_lat = 1.d0 - ( lat - 60.d0 ) / ( 75.d0 - 60.d0 )
798 rho_atm_month_lat(1:n_atm_levels) = coeff_lat * rho_atm_month(1:n_atm_levels,6) &
799 + ( 1.d0 - coeff_lat ) * rho_atm_month(1:n_atm_levels,7)
801 pres_atm_month_lat(1:n_atm_levels) = coeff_lat * pres_atm_month(1:n_atm_levels,6) &
802 + ( 1.d0 - coeff_lat ) * pres_atm_month(1:n_atm_levels,7)
804 temp_atm_month_lat(1:n_atm_levels) = coeff_lat * temp_atm_month(1:n_atm_levels,6) &
805 + ( 1.d0 - coeff_lat ) * temp_atm_month(1:n_atm_levels,7)
807 ELSEIF ( ( lat .GT. 75.d0 ) .AND. ( lat .LE. 90.d0 ) )
THEN
809 coeff_lat = 1.d0 - ( lat - 75.d0 ) / ( 90.d0 - 75.d0 )
811 rho_atm_month_lat(1:n_atm_levels) = coeff_lat * rho_atm_month(1:n_atm_levels,7) &
812 + ( 1.d0 - coeff_lat ) * rho_atm_month(1:n_atm_levels,8)
814 pres_atm_month_lat(1:n_atm_levels) = coeff_lat * pres_atm_month(1:n_atm_levels,7) &
815 + ( 1.d0 - coeff_lat ) * pres_atm_month(1:n_atm_levels,8)
817 temp_atm_month_lat(1:n_atm_levels) = coeff_lat * temp_atm_month(1:n_atm_levels,7) &
818 + ( 1.d0 - coeff_lat ) * temp_atm_month(1:n_atm_levels,8)
822 pres_atm_month_lat(1:n_atm_levels) = 100.d0 * pres_atm_month_lat(1:n_atm_levels)
824 h_levels(1:n_atm_levels) = 1000.d0 * temp_atm_month(1:n_atm_levels,1)
828 ELSEIF ( read_atm_profile .EQ.
'card' )
THEN
832 WRITE(*,*)
'search atm_profile'
834 atm_profile_search:
DO
836 READ(inp_unit,*,
END = 200 ) card
838 IF( trim(card) ==
'ATM_PROFILE' )
THEN
840 EXIT atm_profile_search
844 END DO atm_profile_search
846 READ(inp_unit,*) n_atm_profile
848 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'n_atm_profile',n_atm_profile
850 ALLOCATE( atm_profile(7,n_atm_profile) )
851 ALLOCATE( atm_profile0(7,n_atm_profile) )
853 DO i = 1, n_atm_profile
855 READ(inp_unit,*) atm_profile0(1:7,i)
858 atm_profile(1:7,i) = atm_profile0(1:7,i)
860 atm_profile(1,i) = atm_profile(1,i) * 1000.d0
863 atm_profile(3,i) = atm_profile(3,i) * 100.d0
865 atm_profile(6,i) = atm_profile(6,i) * wind_mult_coeff
866 atm_profile(7,i) = atm_profile(7,i) * wind_mult_coeff
868 IF ( verbose_level .GE. 1 )
WRITE(*,*) i,atm_profile(1,i)
878 ELSEIF ( read_atm_profile .EQ.
'standard' )
THEN
880 read( inp_unit,std_atm_parameters )
884 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'read atm_parameters: done'
886 READ(inp_unit, initial_values)
888 IF ( ( mfr_exp0 .LT. 0.d0 ) .AND. ( r0 .EQ. 0.d0 ) .AND. ( w0 .GT. 0.d0 ) )
THEN
890 WRITE(*,*)
'WARNING: initial radius calculated from MER and velocity'
894 IF ( ( mfr_exp0 .LT. 0.d0 ) .AND. ( r0 .EQ. 0.d0 ) .AND. ( w0 .EQ. 0.d0 ) )
THEN
896 WRITE(*,*)
'WARNING: initial radius and velocity calculated from MER and gas mass fraction'
901 IF ( ( mfr_exp0 .GT. 0.d0 ) .AND. ( w0 .GT. 0.d0 ) .AND. ( r0 .GT. 0.d0 ) )
THEN
903 WRITE(*,*)
'ERROR: too many unknown input parameters: input mfr_exp0 or w0 and r0'
908 IF ( distribution .EQ.
'constant' )
THEN
915 n_nodes = 0.5d0 * n_mom
919 IF ( hysplit_flag )
THEN
921 IF ( distribution .NE.
'constant' )
THEN
923 WRITE(*,*)
'hysplit run requires constant distribution'
928 READ(inp_unit, hysplit_parameters)
930 ALLOCATE( solid_mfr(n_part) , solid_mfr_old(n_part) )
932 hy_z = vent_height + hy_deltaz
933 hy_z_old = vent_height
945 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'read initial_parameters: done'
947 READ(inp_unit, mixture_parameters)
949 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'read mixture_parameters: done'
952 IF ( distribution .EQ.
'beta' )
THEN
954 ALLOCATE( p_beta(n_part) )
955 ALLOCATE( q_beta(n_part) )
956 ALLOCATE( d_max(n_part) )
958 READ(inp_unit, beta_parameters)
960 ELSEIF ( distribution .EQ.
'lognormal' )
THEN
962 ALLOCATE( mu_lognormal(n_part) )
963 ALLOCATE( sigma_lognormal(n_part) )
965 ALLOCATE( mu_bar(n_part) )
966 ALLOCATE( sigma_bar(n_part) )
968 READ(inp_unit, lognormal_parameters)
970 mu_bar = -log( 2.d0 ) * mu_lognormal
971 sigma_bar = log( 2.d0 ) * sigma_lognormal
973 WRITE(*,*)
'mu_bar',mu_bar
974 WRITE(*,*)
'sigma_bar',sigma_bar
977 ELSEIF ( distribution .EQ.
'constant' )
THEN
979 ALLOCATE( diam_constant(n_part) )
980 ALLOCATE( diam_constant_phi(n_part) )
982 READ(inp_unit, constant_parameters)
984 diam_constant = 1.d-3 * 2.d0**(-diam_constant_phi)
988 IF ( sum( solid_partial_mass_fraction(1:n_part) ) .NE. 1.d0 )
THEN
990 WRITE(*,*)
'WARNING: Sum of solid mass fractions > 1'
994 solid_partial_mass_fraction(n_part) = 1.d0 - &
995 sum( solid_partial_mass_fraction(1:n_part-1) )
997 solid_mass_fraction(1:n_part) = ( 1.d0 - gas_mass_fraction0 ) * &
998 solid_partial_mass_fraction(1:n_part)
1000 ALLOCATE( xi(n_nodes) )
1001 ALLOCATE( wi(n_nodes) )
1002 ALLOCATE( part_dens_array(n_nodes) )
1008 IF ( distribution_variable .EQ.
'mass_fraction' )
THEN
1010 ALLOCATE( coeff(0:n_mom,0:n_mom) )
1015 DO i_part = 1,n_part
1017 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'i_part',i_part
1021 IF ( distribution_variable .EQ.
'particles_number' )
THEN
1023 IF ( distribution .EQ.
'beta' )
THEN
1025 mom0(i_part,i) = d_max(i_part)**i *
beta_function(p_beta(i_part) &
1029 ELSEIF ( distribution .EQ.
'lognormal' )
THEN
1031 mom0(i_part,i) = 6.d0 / pi_g * 10.d0**(-3*(i-3)) * &
1032 exp( ( i-3.d0 ) * mu_bar(i_part) + ( i - 3.d0 )**2 / 2.d0 *&
1033 sigma_bar(i_part)**2 )
1035 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'before correction', &
1038 ELSEIF ( distribution .EQ.
'constant' )
THEN
1040 mom0(i_part,i) = diam_constant(i_part)**i
1044 ELSEIF ( distribution_variable .EQ.
'mass_fraction' )
THEN
1046 IF ( distribution .EQ.
'lognormal' )
THEN
1048 IF ( mu_lognormal(i_part) .EQ. 0.d0) mu_lognormal(i_part) = 1.d-5
1050 mom0(i_part,i) = 0.d0
1052 DO k=0,floor(0.5d0 * i)
1054 fact2 = product((/(j, j = 2*k-1,1,-2)/))
1056 mom0(i_part,i) = mom0(i_part,i) + coeff(i,2*k) * fact2 &
1057 * sigma_lognormal(i_part)**(2*k) * &
1058 mu_lognormal(i_part)**(i-2*k)
1060 IF ( verbose_level .GT. 3 )
THEN
1062 WRITE(*,*)
'i,k,coeff_bin,fact2',i,k,coeff(i,2*k),fact2
1063 WRITE(*,*)
'mom0',mom0(i_part,i)
1080 IF ( initial_neutral_density )
THEN
1090 rho_gas = pa / ( rgasmix * tp0 )
1092 IF ( distribution .EQ.
'constant' )
THEN
1109 IF ( verbose_level .GE. 1 )
THEN
1111 WRITE(*,*)
'part_dens_array'
1114 WRITE(*,*)
'rho',part_dens_array
1122 IF ( distribution_variable .EQ.
'particles_number' )
THEN
1124 rho_solid_avg(i_part) = sum( part_dens_array * wi * xi**3 ) / &
1127 ELSEIF ( distribution_variable .EQ.
'mass_fraction' )
THEN
1129 rho_solid_avg(i_part) = 1.d0 / ( sum( wi / part_dens_array ) / &
1134 WRITE(*,*)
'input_file: distribution_variable',distribution_variable
1139 IF ( verbose_level .GE. 1 )
THEN
1141 WRITE(*,*)
'rho avg',rho_solid_avg(i_part)
1150 rho_solid_tot_avg = 1.d0 / sum( solid_partial_mass_fraction(1:n_part) / &
1151 rho_solid_avg(1:n_part) )
1153 IF ( verbose_level .GE. 1 )
THEN
1156 WRITE(*,*)
'******* CHECK ON MASS AND VOLUME FRACTIONS *******'
1157 WRITE(*,*)
'rho solid avg', rho_solid_tot_avg
1161 IF ( initial_neutral_density )
THEN
1165 solid_tot_volume_fraction0 = ( rho_mix - rho_gas ) / &
1166 ( rho_solid_tot_avg - rho_gas )
1168 gas_volume_fraction0 = 1.d0 - solid_tot_volume_fraction0
1170 gas_mass_fraction0 = gas_volume_fraction0 * rho_gas / rho_mix
1174 gas_volume_fraction0 = rho_solid_tot_avg / ( rho_gas * ( 1.d0 / &
1175 gas_mass_fraction0 - 1.d0 ) + rho_solid_tot_avg )
1177 solid_tot_volume_fraction0 = 1.d0 - gas_volume_fraction0
1179 rho_mix = gas_volume_fraction0 * rho_gas + solid_tot_volume_fraction0 &
1184 IF ( verbose_level .GE. 1 )
THEN
1186 WRITE(*,*)
'gas_volume_fraction0',gas_volume_fraction0
1187 WRITE(*,*)
'solid_tot_volume_fraction0',solid_tot_volume_fraction0
1188 WRITE(*,*)
'rho_gas',rho_gas
1189 WRITE(*,*)
'rho_mix',rho_mix
1194 DO i_part = 1,n_part
1199 alfa_s = solid_partial_mass_fraction(i_part) * rho_solid_tot_avg / &
1200 rho_solid_avg(i_part)
1204 solid_volume_fraction0(i_part) = solid_tot_volume_fraction0 * alfa_s
1209 IF ( distribution_variable .EQ.
'particles_number' )
THEN
1211 c0 = 6.d0 / pi_g * solid_volume_fraction0(i_part) / mom0(i_part,3)
1213 ELSEIF ( distribution_variable .EQ.
'mass_fraction' )
THEN
1215 c0 = ( 1.d0 - gas_mass_fraction0 ) / mom0(i_part,0) * &
1216 solid_partial_mass_fraction(i_part)
1224 mom0(i_part,i) = c0 * mom0(i_part,i)
1226 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'mom',i,mom0(i_part,i)
1230 IF ( verbose_level .GE. 1 )
THEN
1232 WRITE(*,*)
'i_part =',i_part
1233 WRITE(*,*)
'alfa_s',i_part,alfa_s
1234 WRITE(*,*)
'solid_volume_fraction0',solid_volume_fraction0(i_part)
1235 WRITE(*,*)
'solid_partial_mass_fract', &
1236 solid_partial_mass_fraction(i_part)
1237 WRITE(*,*)
'solid_mass_fract', solid_mass_fraction(i_part)
1244 gas_volume_fraction0 = 1.d0 - solid_tot_volume_fraction0
1246 gas_mass_fraction0 = gas_volume_fraction0 * rho_gas / rho_mix
1248 WRITE(*,*)
'solid volume fraction',solid_tot_volume_fraction0
1249 WRITE(*,*)
'solid total mass_fraction', solid_tot_volume_fraction0 * &
1250 rho_solid_tot_avg / rho_mix
1252 IF ( distribution_variable .EQ.
'particles_number' )
THEN
1254 WRITE(*,*)
'solid_mass_fractions', mom0(1:n_part,3) * &
1255 rho_solid_avg(1:n_part) / ( sum( mom0(1:n_part,3) * &
1256 rho_solid_avg(1:n_part)) )
1258 ELSEIF ( distribution_variable .EQ.
'mass_fraction' )
THEN
1260 WRITE(*,*)
'solid_mass_fractions', mom0(1:n_part,0)
1264 WRITE(*,*)
'gas volume fraction', gas_volume_fraction0
1265 WRITE(*,*)
'gas mass fraction', gas_mass_fraction0
1270 IF ( .NOT.dakota_flag )
THEN
1276 mat_file = trim(run_name)//
'.m'
1278 OPEN(mat_unit,file=mat_file,status=
'unknown')
1280 WRITE(mat_unit,*)
'n_part = ',n_part,
';'
1281 WRITE(mat_unit,*)
'gas_volume_fraction = ',gas_volume_fraction0,
';'
1283 IF ( distribution .EQ.
'beta' )
THEN
1285 WRITE(mat_unit,*)
'p = [',p_beta(1:n_part),
'];'
1286 WRITE(mat_unit,*)
'q = [',q_beta(1:n_part),
'];'
1287 WRITE(mat_unit,*)
'd_max = [',d_max(1:n_part),
'];'
1290 ELSEIF ( distribution .EQ.
'lognormal' )
THEN
1292 WRITE(mat_unit,*)
'mu = [',mu_lognormal(1:n_part),
'];'
1293 WRITE(mat_unit,*)
'sigma = [',sigma_lognormal(1:n_part),
'];'
1295 ELSEIF ( distribution .EQ.
'constant' )
THEN
1297 WRITE(mat_unit,*)
'diam = [',diam_constant(1:n_part),
'];'
1301 WRITE(mat_unit,*)
'solid_mass_fractions = [', &
1302 solid_partial_mass_fraction(1:n_part),
'];'
1304 WRITE(mat_unit,*)
'd1 = [',diam1(1:n_part),
'];'
1305 WRITE(mat_unit,*)
'd2 = [',diam2(1:n_part),
'];'
1306 WRITE(mat_unit,*)
'rho1 = [',rho1(1:n_part),
'];'
1307 WRITE(mat_unit,*)
'rho2 = [',rho2(1:n_part),
'];'
1310 IF ( verbose_level .GE. 0 )
WRITE(*,*)
'write matlab file: done'
1316 IF ( distribution .EQ.
'moments' )
THEN
1322 READ(inp_unit , *,
END = 300 ) card
1324 IF( trim(card) ==
'MOMENTS' )
THEN
1330 END DO moments_search
1332 READ(inp_unit,*) n_mom
1334 WRITE(*,*)
'input_moments'
1336 READ(inp_unit,*) solid_partial_mass_fraction(1:n_part)
1340 READ(inp_unit,*) mom0(1:n_part,i)
1342 WRITE(*,*) mom0(1:n_part,i)
1362 bak_file = trim(run_name)//
'.bak'
1364 OPEN(bak_unit,file=bak_file,status=
'unknown')
1366 WRITE(bak_unit, control_parameters)
1368 IF ( inversion_flag )
WRITE(bak_unit, inversion_parameters)
1370 WRITE(bak_unit, plume_parameters)
1372 WRITE(bak_unit, atm_parameters)
1374 IF ( read_atm_profile .EQ.
'standard' )
THEN
1376 WRITE(bak_unit, std_atm_parameters )
1380 IF ( read_atm_profile .EQ.
'table' )
THEN
1382 WRITE(bak_unit, table_atm_parameters )
1387 WRITE(bak_unit, initial_values)
1389 WRITE(bak_unit, mixture_parameters)
1391 IF ( distribution .EQ.
'beta' )
THEN
1393 WRITE(bak_unit, beta_parameters)
1395 ELSEIF ( distribution .EQ.
'lognormal' )
THEN
1397 WRITE(bak_unit, lognormal_parameters)
1399 ELSEIF ( distribution .EQ.
'constant' )
THEN
1401 WRITE(bak_unit, constant_parameters)
1403 ELSEIF ( distribution .EQ.
'moments' )
THEN
1405 IF (( tend1 ) .OR. ( n_mom .EQ. 0 ))
THEN
1407 WRITE(*,*)
'WARNING: input ',
' SAMPLING POINTS not found '
1411 WRITE(bak_unit,*)
'''MOMENTS'''
1412 WRITE(bak_unit,*) n_mom
1416 WRITE(bak_unit,*) mom0(1:n_part,i)
1424 IF ( read_atm_profile .EQ.
'card' )
THEN
1426 WRITE(bak_unit,*)
'''ATM_PROFILE'''
1427 WRITE(bak_unit,*) n_atm_profile
1429 DO i = 1, n_atm_profile
1431 WRITE(bak_unit,107) atm_profile0(1:7,i)
1433 107
FORMAT(7(1x,e14.7))
1442 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'end subroutine reainp'
1462 USE variables, ONLY : dakota_flag , hysplit_flag
1467 col_file = trim(run_name)//
'.col'
1468 mom_file = trim(run_name)//
'.mom'
1469 dak_file = trim(run_name)//
'.dak'
1470 hy_file = trim(run_name)//
'.hy'
1472 IF ( .NOT.dakota_flag )
THEN
1477 OPEN(col_unit,file=col_file)
1482 OPEN(mom_unit,file=mom_file)
1485 WRITE(mom_unit,*) n_part
1486 WRITE(mom_unit,*) n_mom
1490 IF ( hysplit_flag )
THEN
1495 OPEN(hy_unit,file=hy_file)
1502 OPEN(dak_unit,file=dak_file)
1519 USE variables, ONLY : dakota_flag , hysplit_flag
1523 IF ( .not.dakota_flag )
THEN
1530 IF ( hysplit_flag )
CLOSE ( hy_unit )
1552 USE particles_module, ONLY: n_mom , n_part , solid_partial_mass_fraction , &
1557 atm_mass_fraction , wvapour_mass_fraction
1567 mfr = 3.14 * r**2 * rho_mix * mag_u
1572 IF ( z .EQ. vent_height )
THEN
1574 WRITE(col_unit,97,advance=
"no")
1578 WRITE(col_unit,98,advance=
"no")
1584 97
FORMAT(1x,
' z (m) ',1x,
' r (m) ',1x,
' x (m) ', &
1585 1x,
' y (m) ',1x,
'mix.dens(kg/m3)',1x,
'temperature(C)', &
1586 1x,
' vert vel (m/s)',1x,
' mag vel (m/s) ',1x,
' atm.mass fract', &
1587 1x,
' wv mass fract ',1x)
1589 98
FORMAT(1x,
'sol.mass fract ')
1591 99
FORMAT(1x,
'atm.rho(kg/m3)',1x,
' MFR (kg/s) ',1x,
'atm.temp (K) ', &
1592 1x,
' atm pres (Pa) ')
1597 WRITE(col_unit,100) z , r , x , y , rho_mix , tp - 273.15d0 , w , mag_u,&
1598 atm_mass_fraction , wvapour_mass_fraction , &
1599 solid_partial_mass_fraction(1:n_part) , rho_atm , mfr , ta, pa
1608 WRITE(mom_unit,*) z , mom(1:n_part,0:n_mom-1),set_mom(1:n_part,0)
1610 100
FORMAT(33(1x,e15.8))
1612 IF ( verbose_level .GE. 1 )
THEN
1614 WRITE(*,*)
'******************'
1620 WRITE(*,*)
'******************'
1643 USE particles_module, ONLY: n_mom , n_part , solid_partial_mass_fraction , &
1648 atm_mass_fraction , wvapour_mass_fraction
1653 LOGICAL,
INTENT(IN) :: last
1657 CHARACTER(len=8) :: x1
1660 IF ( z .EQ. vent_height )
THEN
1662 solid_mfr(1:n_part) = solid_partial_mass_fraction(1:n_part) * ( 1.d0 - &
1663 gas_mass_fraction) * pi_g * mag_u * r**2.d0 * rho_mix
1665 WRITE(hy_unit,107,advance=
"no")
1669 WRITE(x1,
'(I2.2)') i_part
1671 WRITE(hy_unit,108,advance=
"no")
'S mfr'//trim(x1)//
' (kg/s)'
1677 ELSEIF ( z .GE. hy_z )
THEN
1679 solid_mfr_old(1:n_part) = solid_mfr(1:n_part)
1681 solid_mfr(1:n_part) = solid_partial_mass_fraction(1:n_part) * ( 1.d0 - &
1682 gas_mass_fraction) * pi_g * mag_u * r**2.d0 * rho_mix
1684 WRITE(hy_unit,110) 0.5d0 * ( hy_x + hy_x_old ) , 0.5d0 * ( hy_y + hy_y_old ) , &
1685 0.5d0 * ( hy_z + hy_z_old ) , solid_mfr_old(1:n_part) &
1686 - solid_mfr(1:n_part)
1697 hy_z = hy_z + hy_deltaz
1703 solid_mfr_old(1:n_part) = solid_mfr(1:n_part)
1705 solid_mfr(1:n_part) = solid_partial_mass_fraction(1:n_part) * ( 1.d0 - &
1706 gas_mass_fraction) * pi_g * mag_u * r**2.d0 * rho_mix
1712 WRITE(hy_unit,110) 0.5d0 * ( hy_x + hy_x_old ) , 0.5d0 * ( hy_y + &
1713 hy_y_old ) , 0.5d0 * ( hy_z + hy_z_old ) , solid_mfr_old(1:n_part) &
1714 - solid_mfr(1:n_part)
1718 107
FORMAT(1x,
' x (m) ',1x,
' y (m) ', 1x,
' z (m) ')
1722 110
FORMAT(33(1x,e15.8))
1746 CHARACTER(20),
INTENT(IN) :: description
1747 REAL*8,
INTENT(IN) :: value
1749 WRITE(dak_unit,*) description,value
1751 IF ( verbose_level .GE. 2 )
THEN
1753 WRITE(*,*) description,value
real *8 function particles_density(i_part, diam_in)
Particle density.
subroutine write_hysplit(last)
Write outputs.
subroutine zmet
Meteo parameters.
subroutine write_column
Write outputs.
subroutine initialize
Initialize variables.
subroutine write_dakota(description, value)
Dakota outputs.
subroutine coefficient(nmax, c)
Binomial Coefficient.
Gas/particles mixture module.
subroutine allocate_particles
Particles variables inizialization.
subroutine close_file_units
Close output units.
subroutine open_file_units
Initialize output units.
Method of Moments module.
real *8 function beta_function(z, w)
Beta function.
subroutine read_inp
Read Input data.
subroutine wheeler_algorithm(m, xi, w)
Wheeler algorithm.