25 REAL*8,
ALLOCATABLE ::
cv_c(:)
26 REAL*8,
ALLOCATABLE ::
cv_d(:)
27 REAL*8,
ALLOCATABLE ::
cv_g(:)
31 REAL*8,
ALLOCATABLE ::
c0_c(:)
32 REAL*8,
ALLOCATABLE ::
c0_d(:)
33 REAL*8,
ALLOCATABLE ::
c0_g(:)
49 REAL*8,
ALLOCATABLE ::
t0_c(:)
50 REAL*8,
ALLOCATABLE ::
t0_d(:)
51 REAL*8,
ALLOCATABLE ::
t0_g(:)
55 REAL*8,
ALLOCATABLE ::
p0_c(:)
56 REAL*8,
ALLOCATABLE ::
p0_d(:)
57 REAL*8,
ALLOCATABLE ::
p0_g(:)
72 REAL*8,
ALLOCATABLE ::
s0_c(:)
73 REAL*8,
ALLOCATABLE ::
s0_d(:)
74 REAL*8,
ALLOCATABLE ::
s0_g(:)
77 REAL*8,
ALLOCATABLE ::
pc_g(:)
78 REAL*8,
ALLOCATABLE ::
tc_g(:)
79 REAL*8,
ALLOCATABLE ::
a_g(:)
80 REAL*8,
ALLOCATABLE ::
b_g(:)
97 COMPLEX*16,
ALLOCATABLE ::
e_c(:)
98 COMPLEX*16,
ALLOCATABLE ::
e_d(:)
99 COMPLEX*16,
ALLOCATABLE ::
e_g(:)
107 COMPLEX*16,
ALLOCATABLE ::
s_c(:)
108 COMPLEX*16,
ALLOCATABLE ::
s_d(:)
109 COMPLEX*16,
ALLOCATABLE ::
s_g(:)
114 COMPLEX*16,
ALLOCATABLE ::
mu_c(:)
115 COMPLEX*16,
ALLOCATABLE ::
mu_d(:)
116 COMPLEX*16,
ALLOCATABLE ::
mu_g(:)
140 COMPLEX*16,
ALLOCATABLE ::
beta(:)
153 COMPLEX*16,
ALLOCATABLE ::
x_c(:)
155 COMPLEX*16,
ALLOCATABLE ::
x_d(:)
156 COMPlEX*16,
ALLOCATABLE ::
x_g(:)
480 ALLOCATE(
cv_c(n_cry) )
481 ALLOCATE(
c0_c(n_cry) )
484 ALLOCATE(
t0_c(n_cry) )
485 ALLOCATE(
p0_c(n_cry) )
488 ALLOCATE(
s0_c(n_cry) )
489 ALLOCATE(
e_c(n_cry) )
490 ALLOCATE(
s_c(n_cry) )
491 ALLOCATE(
mu_c(n_cry) )
492 ALLOCATE(
rho_c(n_cry) )
494 ALLOCATE(
beta(n_cry) )
496 ALLOCATE(
x_c(n_cry) )
497 ALLOCATE(
x_c_1(n_cry) )
498 ALLOCATE(
tau_c(n_cry) )
499 ALLOCATE(
beta0(n_cry) )
502 IF ( n_mom .GT. 1 )
THEN 504 ALLOCATE(
mom_cry(1:n_cry,0:n_mom-1) )
510 ALLOCATE(
cv_d(n_gas) )
511 ALLOCATE(
c0_d(n_gas) )
514 ALLOCATE(
t0_d(n_gas) )
515 ALLOCATE(
p0_d(n_gas) )
518 ALLOCATE(
s0_d(n_gas) )
519 ALLOCATE(
e_d(n_gas) )
520 ALLOCATE(
s_d(n_gas) )
521 ALLOCATE(
mu_d(n_gas) )
522 ALLOCATE(
rho_d(n_gas) )
525 ALLOCATE(
x_d(n_gas) )
528 ALLOCATE(
x_d_1(n_gas) )
529 ALLOCATE(
tau_d(n_gas) )
530 ALLOCATE(
solub(n_gas) )
535 ALLOCATE(
cv_g(n_gas) )
536 ALLOCATE(
c0_g(n_gas) )
539 ALLOCATE(
t0_g(n_gas) )
540 ALLOCATE(
p0_g(n_gas) )
543 ALLOCATE(
s0_g(n_gas) )
544 ALLOCATE(
e_g(n_gas) )
545 ALLOCATE(
s_g(n_gas) )
546 ALLOCATE(
mu_g(n_gas) )
547 ALLOCATE(
rho_g(n_gas) )
548 ALLOCATE(
x_g(n_gas) )
549 ALLOCATE(
x_g_2(n_gas) )
553 ALLOCATE(
pc_g(n_gas) )
554 ALLOCATE(
tc_g(n_gas) )
555 ALLOCATE(
a_g(n_gas) )
556 ALLOCATE(
b_g(n_gas) )
577 e_c(1:n_cry) = dcmplx(
bar_e_c(1:n_cry),0.d0) + dcmplx(
cv_c(1:n_cry),0.d0) &
583 e_d(1:n_gas) = dcmplx(
bar_e_d(1:n_gas),0.d0) + dcmplx(
cv_d(1:n_gas),0.d0) &
587 sum(
x_d_1(1:n_gas) *
e_d(1:n_gas) )
589 e_g(1:n_gas) = dcmplx(
bar_e_g(1:n_gas),0.d0) + dcmplx(
cv_g(1:n_gas),0.d0) &
590 *
t - dcmplx(
a_g(1:n_gas),0.0) *
rho_g(1:n_gas)
603 sum(
x_d_1(1:n_gas) *
s_d(1:n_gas) )
606 ( (
rho0_g(1:n_gas) /
rho_g(1:n_gas) ) * ( dcmplx(1.d0,0.d0) - &
651 REAL*8,
INTENT(OUT) :: C_mix , mach
654 COMPLEX*16 :: C2_c(1:n_cry) , C2_m , C2_d(1:n_gas) , C2_1 , C2_2
655 COMPLEX*16 :: C2_g(1:n_gas)
658 COMPLEX*16 :: K_1 , K_2 , K_mix
659 COMPLEX*16 :: K_c(1:n_cry) , K_m , K_d(1:n_gas) , K_g(1:n_gas)
663 c2_c(1:n_cry) =
c0_c(1:n_cry)**2.d0 * (
rho_c(1:n_cry) /
rho0_c(1:n_cry) ) &
664 ** (
gamma_c(1:n_cry) - dcmplx(1.0,0.d0) ) * cdexp( (
s_c(1:n_cry) - &
670 c2_d(1:n_gas) =
c0_d(1:n_gas)**2.d0 * (
rho_d(1:n_gas) /
rho0_d(1:n_gas) ) &
671 ** (
gamma_d(1:n_gas) - dcmplx(1.0,0.d0) ) * cdexp( (
s_d(1:n_gas) - &
674 k_c(1:n_cry) = 1.d0 / (
rho_c(1:n_cry) * c2_c(1:n_cry) )
675 k_m = 1.d0 / (
rho_m * c2_m )
676 k_d(1:n_gas) = 1.d0 / (
rho_d(1:n_gas) * c2_d(1:n_gas) )
678 k_1 =
alfa_m_1*k_m + sum(
beta(1:n_cry)*k_c(1:n_cry) ) &
679 + sum(
alfa_d_1(1:n_gas) * k_d(1:n_gas) )
681 c2_1 = 1.d0 / ( k_1 *
rho_1 )
685 c2_g(1:n_gas) =
cv_g(1:n_gas) * (
gamma_g(1:n_gas) - dcmplx(1.0,0.d0) ) &
686 *
gamma_g(1:n_gas) *
t / ( dcmplx(1.0,0.d0) -
b_g(1:n_gas) * &
687 rho_g(1:n_gas) )**2.0 - dcmplx(2.0,0.d0) *
a_g(1:n_gas) *
rho_g(1:n_gas)
689 k_g(1:n_gas) = 1.d0 / (
rho_g(1:n_gas) * c2_g(1:n_gas) )
691 k_2 = sum(
alfa_g_2(1:n_gas) * k_g(1:n_gas) )
693 c2_2 = 1.d0 / ( k_2 *
rho_2 )
699 c_mix = dreal( 1.d0 / cdsqrt( k_mix *
rho_mix ) )
704 mach = dreal(
u_mix / c_mix )
706 IF ( verbose_level .GE. 2 )
THEN 708 WRITE(*,*)
'K_1,k_2',k_1,k_2
709 WRITE(*,*)
'K_mix,rho_mix',k_mix,
rho_mix 710 WRITE(*,*)
'u_mix,C_mix',
u_mix,c_mix
733 COMPLEX*16 :: y1,y2,y3
735 COMPLEX*16 :: coeff1 , coeff2 , coeff3
740 (
gamma_c(1:n_cry) - dcmplx(1.d0,0.d0) ) )
744 (
gamma_d(1:n_gas) - dcmplx(1.d0,0.d0) ) )
747 + ( dcmplx(1.d0,0.d0) - sum(
x_d_md(1:n_gas) ) ) /
rho_m )
749 rho_1 = sum(
beta(1:n_cry) *
rho_c(1:n_cry) ) + ( dcmplx(1.d0,0.d0) - &
752 IF (
gas_law .EQ.
'IDEAL' )
THEN 755 (
gamma_g(1:n_gas) - dcmplx(1.d0,0.d0) ) )
757 ELSEIF (
gas_law .EQ.
'VDW' )
THEN 761 a =
a_g(i) * dcmplx(-1.d0,0.d0)
765 coeff1 = a / (
a_g(i) *
b_g(i) )
766 coeff2 = b / (
a_g(i) *
b_g(i) )
767 coeff3 = c / (
a_g(i) *
b_g(i) )
769 CALL solve_cubic( coeff1 , coeff2 , coeff3 , y1 , y2 , y3 )
800 COMPLEX*16,
INTENT(IN) :: a,b,c
801 COMPLEX*16,
INTENT(OUT) :: y1,y2,y3
803 COMPLEX*16 :: Q,R,D_temp
804 COMPLEX*16 :: phi , arg , u , v
806 q = ( 3.d0*b - a**2) / dcmplx(9.d0,0.d0)
807 r = ( 9.d0*a*b - 27.d0*c - 2.d0*a**3 ) / dcmplx(54.d0,0.d0)
811 IF ( d_temp .GE. 0 )
THEN 813 arg = r + cdsqrt(d_temp)
815 u =
sign(1.d0,
REAL(arg))*(abs(arg))**(1.D0/3.D0)
817 arg = r - cdsqrt(d_temp)
818 v =
sign(1.d0,
REAL(arg))*(abs(arg))**(1.D0/3.D0)
820 y1 = u + v - a / dcmplx(3.d0,0.d0)
824 phi =
acos(r/cdsqrt(-(q**3)))
826 y1 = 2.d0 * cdsqrt(-q) * cos(phi/ dcmplx(3.d0,0.d0) ) &
827 - a / dcmplx(3.d0,0.d0)
829 y2 = 2.d0 * cdsqrt(-q) * cos((phi+2.d0*
pi)/ dcmplx(3.d0,0.d0) ) &
830 - a / dcmplx(3.d0,0.d0)
832 y3 = 2.d0 * cdsqrt(-q) * cos((phi-2.d0*
pi)/ dcmplx(3.d0,0.d0) ) &
833 - a/ dcmplx(3.d0,0.d0)
868 COMPLEX*16 :: aa , bb , cc , pp
869 COMPLEX*16 :: P_bar, log10Ds, Ds, Dcl
871 REAL*8 :: melt_volume
873 COMPLEX*16 :: melt_mass
874 COMPLEX*16 :: co2_exs_mass,h2o_exs_mass,S_exs_mass,Cl_exs_mass
875 COMPLEX*16 :: S_dis_mass,Cl_dis_mass
876 COMPLEX*16 :: gas_mass, Ratio_exs_dis
877 COMPLEX*16 :: S_mass,Cl_mass
880 IF (
REAL(p_2) .LE. 0.D0 ) then
902 aa = 0.4874d0 - 608.0d0 /
t + 489530.d0 / (
t *
t )
904 bb = -0.06062d0 + 135.6d0 /
t - 69200.d0 / (
t *
t )
906 cc = 0.00253d0 - 4.154d0 /
t + 1509.0d0 / (
t *
t )
910 x_d_md_eq(1:n_gas) = 1.0d-2 * ( aa * cdsqrt(pp) + bb * pp + cc &
913 CASE (
'H20-CO2-S-CL' )
919 melt_mass=melt_volume*
rho_md 922 h2o_exs_mass=melt_mass*
x_g(1)
925 co2_exs_mass=melt_mass*
x_g(2)
928 s_exs_mass=melt_mass*
x_g(3)
931 cl_exs_mass=melt_mass*
x_g(4)
934 gas_mass=co2_exs_mass+h2o_exs_mass+s_exs_mass+cl_exs_mass
937 ratio_exs_dis=gas_mass/melt_mass
943 beta_s = [4.8095e+02, -4.5850e+02, 3.0240e-03, -2.7519e-07]
946 log10ds =
beta(1) * p_bar**(-0.0075) +
beta(2) +
beta(3) * p_bar &
947 +
beta(4) * p_bar**(2.0)
949 dcl = dcmplx(2.d0, 0.d0)
960 s_dis_mass=s_mass - (ds*ratio_exs_dis/(ds*ratio_exs_dis + 1.0))*s_mass
969 cl_dis_mass=cl_mass- (dcl*ratio_exs_dis/(dcl* ratio_exs_dis + 1.0)) &
1004 COMPLEX*16 :: x_d_md_tot ,x_d_md_wt_tot
1005 COMPLEX*16 :: p_1_bar, T_celsius
1006 COMPLEX*16 :: crystal_mass_fraction(1:n_cry)
1010 p_1_bar =
p_1 / 1.0e5
1011 t_celsius =
t - 273.d0
1013 x_d_md_tot = sum(
x_d_md(1:n_gas) )
1014 x_d_md_wt_tot = x_d_md_tot * 100.d0
1020 CASE (
'Vitturi2010' )
1025 beta_eq(j)=
beta0(j) + 0.55d0*( 0.58815d0*(
p_1/1.d6 )**( -0.5226d0 ) )
1144 COMPLEX*16,
INTENT(OUT) :: pressure_relaxation
1152 tau_p = dcmplx( 1.d0 , 0.d0 )
1177 tau_p = dcmplx( 1.d0 , 0.d0 )
1179 CASE (
'single_pressure' )
1181 tau_p = dcmplx( 1.d0 , 0.d0 )
1207 COMPLEX*16,
INTENT(OUT) :: velocity_relaxation
1211 COMPLEX*16 :: radius_bubble
1212 COMPLEX*16 :: effusive_drag , explosive_drag
1214 COMPLEX*16 :: k_1 , k_2
1216 COMPLEX*16 :: throat_radius
1218 REAL*8 :: frag_transition, t
1220 frag_transition =
frag_thr + 0.05d0
1222 t =
min(1.0d0,
max(0.0d0, (
REAL(alfa_2) - frag_thr ) / &
1223 (frag_transition - frag_thr )))
1229 effusive_drag = dcmplx(1.d0,0.d0)
1231 explosive_drag = effusive_drag
1240 * (
alfa_1 ) ) ) ** ( 1.d0 / 3.d0 )
1246 explosive_drag = effusive_drag
1248 IF ( verbose_level .GE. 3 )
THEN 1250 WRITE(*,*)
'Rey',rey
1251 WRITE(*,*)
'visc_2',
visc_2 1252 WRITE(*,*)
'rho_2',
rho_2 1257 CASE (
'Klug_and_Cashman' )
1264 * (
alfa_1 ) ) ) ** ( 1.d0 / 3.d0 )
1277 * (
alfa_1 ) ) ) ** ( 1.d0 / 3.d0 )
1283 effusive_drag =
visc_2 / k_1
1287 CASE (
'forchheimer' )
1291 IF (
REAL(alfa_2) .GT. 0.0001 ) then
1294 * (
alfa_1 ) ) ) ** ( 1.d0 / 3.d0 )
1305 explosive_drag = 3.d0 *
c_d / ( 8.d0 *
r_a ) *
rho_2 &
1310 effusive_drag = dcmplx(1.0e20,0.0)
1312 explosive_drag = dcmplx(0.0,0.0)
1317 CASE (
'forchheimer_wt' )
1321 IF (
REAL(alfa_2) .GT. 0.0001 ) then
1324 * (
alfa_1 ) ) ) ** ( 1.d0 / 3.d0 )
1335 explosive_drag = 3.d0 *
c_d / ( 8.d0 *
r_a ) *
rho_2 &
1340 effusive_drag = dcmplx(1.0e20,0.0)
1342 explosive_drag = dcmplx(0.0,0.0)
1351 rey = 2.d0 * radius_bubble * cdabs(
u_2 -
u_1 ) /
visc_1 1353 c_d = dreal( 24.0d0 / rey * ( 1.0d0 + 1.0d0 / 8.0d0 * rey**0.72) )
1355 effusive_drag = 3.d0 *
c_d / ( 8.d0 * radius_bubble ) *
rho_1 &
1358 explosive_drag = effusive_drag
1362 effusive_drag = dcmplx(1.d0,0.d0)
1364 explosive_drag = effusive_drag
1366 CASE (
'single_velocity' )
1368 effusive_drag = dcmplx(1.d0,0.d0)
1370 explosive_drag = effusive_drag
1376 drag_funct = effusive_drag ** ( 1.d0 - t ) * &
1377 ( explosive_drag + 1.d-10 ) ** t
1382 ( explosive_drag + 1.d-10 ) **
frag_eff 1402 IF ( verbose_level .GE. 3 )
THEN 1406 WRITE(*,*)
'velocity_relaxation',velocity_relaxation
1429 REAL*8 :: permkc_alfa_switch
1430 REAL*8 :: d_permkc_alfa_switch
1435 log_base = 1.d0 / dlog10(dexp(1.d0))
1440 d_permkc_alfa_switch = log_base * permkc_alfa_switch * &
1449 IF (
REAL(alfa_2) .LT. alfa_switch ) then
1531 COMPLEX*16 :: visc1exp , visc2exp , visc3exp
1533 COMPLEX*16,
DIMENSION(12) :: wt
1535 COMPLEX*16,
DIMENSION(12) :: norm_wt, xmf
1536 REAL*8,
DIMENSION(12) :: mw
1538 COMPLEX*16 :: gfw , B , C
1539 REAL*8,
DIMENSION(10) :: bb
1540 COMPLEX*16,
DIMENSION(10) :: bcf
1541 COMPLEX*16,
DIMENSION(7) :: cc , ccf
1542 COMPLEX*16 :: siti , tial , fmm , nak
1543 COMPLEX*16 :: b1 , b2 , b3 , b4 , b5 , b6 , b7 , b11 , b12 , b13 , c1 , c2 ,&
1544 c3 , c4 , c5 , c6 , c11
1546 COMPLEX*16 :: x_d_md_tot
1550 x_d_md_tot = sum(
x_d_md(1:n_gas) )
1552 w = x_d_md_tot * 100.d0
1558 CASE (
'Hess_and_Dingwell1996')
1562 IF (
REAL(w) .LT. 0.03 ) then
1568 visc1exp = (-3.545d0 + 0.833d0 * cdlog(w))
1570 visc2exp = (9601.0d0 - 2368.0d0 * cdlog(w))
1572 visc3exp = visc2exp / (
t - ( 195.70d0 + 32.250d0 * cdlog(w) ) )
1578 CASE (
'Romano_et_al2003')
1582 IF (
REAL(w) .LT. 0.03 ) then
1588 visc1exp = ( -5.8996d0 -0.2857d0 * cdlog(w))
1590 visc2exp = ( 10775.0d0 - 394.83d0 * cdlog(w))
1592 visc3exp = visc2exp / (
t - ( 148.71d0 -21.65d0 * cdlog(w) ) )
1598 CASE (
'Giordano_et_al2008' )
1606 wt(i) = dcmplx(
wt_init(i) , 0.d0 )
1615 norm_wt = 100.d0 * ( wt / sum(wt) )
1619 mw = [ 60.0843 , 79.8658 , 101.961276 , 71.8444 , 70.937449 , 40.3044 , &
1620 56.0774 , 61.97894 , 94.1960 , 141.9446 , 18.01528 , 18.9984 ]
1621 gfw = 100.d0 / sum( norm_wt / mw )
1622 xmf = ( norm_wt / mw ) * gfw
1627 bb = [159.56, -173.34, 72.13, 75.69, -38.98, -84.08, 141.54, -2.43, &
1629 cc = [2.75, 15.72, 8.32, 10.2, -12.29, -99.54, 0.3]
1634 siti = xmf(1) + xmf(2)
1635 tial = xmf(2) + xmf(3)
1636 fmm = xmf(4) + xmf(5) + xmf(6)
1637 nak = xmf(8) + xmf(9)
1640 b3 = xmf(4) + xmf(5) + xmf(10)
1643 b6 = xmf(8) + xmf(11) + xmf(12)
1644 b7 = xmf(11) + xmf(12) + cdlog( 1.d0 + xmf(11) )
1646 b12 = ( siti + xmf(3) + xmf(10) ) * ( nak + xmf(11) )
1654 c6 = cdlog( 1.d0 + xmf(11) + xmf(12) )
1655 c11 = xmf(3) + fmm + xmf(7) - xmf(10)
1656 c11 = c11 * ( nak + xmf(11) + xmf(12) )
1658 bcf = [b1, b2, b3, b4, b5, b6, b7, b11, b12, b13]
1659 ccf = [c1, c2, c3, c4, c5, c6, c11]
1672 CASE (
'Di_Genova_et_al2013_eqn_3,5')
1686 c = c1 + c2 * cdlog( 1.d0 + w )
1691 CASE (
'Di_Genova_et_al2013_eqn_4,5')
1701 b = b3 + b4 * cdlog( 1.d0 + w )
1705 c = c3 + c4 * cdlog( 1.d0 + w )
1712 CASE (
'Giordano_et_al2009' )
1719 b = b1 + b2 * 3.5d0 * w
1725 c = c1 + c2 * cdlog( 1.d0 + 3.5d0 * w )
1762 COMPLEX*16 :: arg_erf , t , errorf, var_phi
1764 REAL*8 :: omega , betas , theta0
1766 REAL*8 :: p , a1 , a2 , a3 , a4 , a5
1767 REAL*8 :: phi_star, csi, delta, Einstein_coeff
1773 CASE (
'Lejeune_and_Richet1995')
1776 theta = ( 1.0d0 - ( sum(
beta(1:n_cry) ) / 0.7d0 ) ) ** ( -3.4d0 )
1778 CASE (
'Dingwell1993')
1781 theta = ( 1.0d0 + 0.75d0 * ( ( sum(
beta(1:n_cry) ) / 0.84d0 ) / ( 1.d0 - &
1782 ( sum(
beta(1:n_cry) ) / .84d0 ) ) ) ) **2.d0
1784 CASE (
'Fixed_value')
1804 arg_erf = 0.5d0 * dsqrt(
pi) * sum(
beta(1:n_cry) ) * ( 1.d0 +
c2 / &
1805 ( 1.d0 - sum(
beta(1:n_cry) ) ) **
c3 )
1807 t = 1.d0 / ( 1.d0 + p * arg_erf )
1809 errorf = 1.d0 - ( a1 * t + a2 * t**2 + a3 * t**3 + a4 * t**4 + a5 * t**5)&
1810 * cdexp( - arg_erf ** 2 )
1812 theta = ( 1.d0 -
c1 * errorf ) ** ( - 2.5d0 /
c1 )
1814 CASE (
'Melnik_and_Sparks2005')
1823 CASE (
'Melnik_and_Sparks1999')
1829 theta = theta0 * 10.d0 ** ( 0.5d0 *
pi +
atan( omega * ( sum( &
1830 beta(1:n_cry) ) - betas )))
1832 CASE (
'Vona_et_al2011')
1848 delta = 13.d0 - 0.84d0
1849 einstein_coeff = 2.8d0
1852 var_phi = sum(
beta(1:n_cry) *
rho_c(1:n_cry) /
rho_1 ) / phi_star
1854 arg_erf = 0.5d0 * dsqrt(
pi) / (1.0d0 - csi) * var_phi * ( 1.d0 + &
1857 t = 1.d0 / ( 1.d0 + p * arg_erf )
1859 errorf = 1.d0 - ( a1 * t + a2 * t**2.0d0 + a3 * t**3.0d0 &
1860 + a4 * t**4.0d0 + a5 * t**5.0d0) * cdexp( - arg_erf ** 2.0d0 )
1863 ( ( 1.d0 - (1.d0 - csi) * errorf ) ** (einstein_coeff * phi_star) )
1866 CASE (
'Vona_et_al2011_mod')
1882 delta = 2.0d0 - 0.84d0
1883 einstein_coeff = 2.8d0
1886 var_phi = sum(
beta(1:n_cry) *
rho_c(1:n_cry) /
rho_1 ) / phi_star
1888 arg_erf = 0.5d0 * dsqrt(
pi) / (1.0d0 - csi) * var_phi * ( 1.d0 + &
1891 t = 1.d0 / ( 1.d0 + p * arg_erf )
1893 errorf = 1.d0 - ( a1 * t + a2 * t**2.0d0 + a3 * t**3.0d0 + a4 * t**4.0d0 &
1894 + a5 * t**5.0d0) * cdexp( - arg_erf ** 2.0d0 )
1897 * errorf ) ** (einstein_coeff * phi_star) )
1899 CASE (
'Vona_et_al2013_eq19')
1901 theta = ( 1.d0 - sum(
beta(1:n_cry)) / (1.d0 -
alfa_2 ) ) ** ( - 5.d0 &
1902 / 2.d0) * ( 1 -
alfa_2 ) ** (- 1.d0)
1904 CASE (
'Vona_et_al2013_eq20')
1907 sum(
beta(1:n_cry)) + 2.d0 *
alfa_2 ) / ( 2.d0 * ( sum(
beta(1:n_cry))&
1910 CASE (
'Vona_et_al2013_eq21')
1912 theta = ( 1.d0 -
alfa_2 / (1.d0 - sum(
beta(1:n_cry)) ) ) ** ( -1.0 ) &
1913 * ( 1 - sum(
beta(1:n_cry)) ) ** (- 5.d0/2.d0)
1942 REAL*8 :: Ca, gamma_Ca
1944 IF( (.NOT. (
theta_model .EQ.
'Vona_et_al2013_eq19' ) ) .AND. &
1945 (.NOT. (
theta_model .EQ.
'Vona_et_al2013_eq20' ) ) .AND. &
1946 (.NOT. (
theta_model .EQ.
'Vona_et_al2013_eq21' ) ) )
THEN 1958 CASE (
'Costa2007' )
1963 / (3.0d0 * pi *
radius**3.0d0)) / gamma_ca
1966 * ( 1.0d0 / (1.0d0-
alfa_2) &
1967 + 25.0d0*ca*ca*((1.0d0-
alfa_2)**(5.0d0/3.0d0)))
1974 CASE (
'Quane-Russel' )
1986 / (1.0d0 - 1.29 *
alfa_2) ) ** 2.0d0
1993 - (1.2 *
alfa_2)** 0.33333d0 ) )
2001 CASE (
'Mackenzie' )
2008 CASE (
'DucampRaj' )
2015 CASE (
'BagdassarovDingwell' )
2059 SUBROUTINE f_alfa(xtot,xmax,r_beta,r_rho_md,r_rho_2,r_alfa_2)
2063 REAL*8,
INTENT(IN) :: xtot(n_gas) , xmax(n_gas)
2064 REAL*8,
INTENT(IN) :: r_beta(n_cry)
2065 REAL*8,
INTENT(IN) :: r_rho_md
2066 REAL*8,
INTENT(IN) :: r_rho_2
2067 REAL*8,
INTENT(OUT) :: r_alfa_2(n_gas)
2070 REAL*8 :: r_x_g(n_gas)
2073 r_x_g(1:n_gas) = xtot(1:n_gas) - xmax(1:n_gas)
2075 r_alfa_2 = ( r_x_g * ( 1.d0 - sum( r_beta(1:n_cry) ) ) * r_rho_md ) / &
2076 ( ( 1.d0 - xtot) * r_rho_2 + r_x_g * ( 1.d0 - sum( r_beta(1:n_cry) ) ) &
2102 SUBROUTINE f_alfa3(r_p_2,xtot,r_beta,r_rho_md,r_rho_g,r_alfa_g)
2106 REAL*8,
INTENT(IN) :: xtot(n_gas)
2107 REAL*8,
INTENT(IN) :: r_beta(n_cry)
2108 REAL*8,
INTENT(IN) :: r_p_2
2109 REAL*8,
INTENT(IN) :: r_rho_md
2110 REAL*8,
INTENT(IN) :: r_rho_g(n_gas)
2111 REAL*8,
INTENT(OUT) :: r_alfa_g(n_gas)
2115 REAL*8 :: r_x_d(n_gas)
2116 REAL*8 :: r_alfa_g_2_max(n_gas),best_alfa_g_2(n_gas)
2117 REAL*8 :: r_alfa_g_2(n_gas), r_alfa_g_2_new(n_gas)
2118 REAL*8 :: h,error,best_error
2119 REAL*8 :: A(n_gas,n_gas),num(n_gas), den(n_gas)
2120 REAL*8 :: r_rho_md_beta
2122 INTEGER :: pivot(n_gas)
2130 r_rho_md_beta = ( 1.d0 - sum( r_beta(1:n_cry) ) ) * r_rho_md
2136 r_alfa_g_2 = [0.0 , 1.0]
2139 best_alfa_g_2 = r_alfa_g_2
2141 DO WHILE ( r_alfa_g_2(1) .LT. r_alfa_g_2_max(1) - h)
2143 r_alfa_g_2 = [r_alfa_g_2(1) + h, 1.0 - (r_alfa_g_2(1) + h)]
2150 a(i,j) = - xtot(i) * r_rho_g(j) + r_rho_md_beta * &
2151 ( xtot(i) - r_x_d(i) )
2154 a(i,i) = a(i,i) + r_rho_g(i)
2156 r_alfa_g(i) = r_rho_md_beta * ( xtot(i) - r_x_d(i) )
2160 call dgesv(n_gas, 1, a , n_gas, pivot, r_alfa_g , n_gas, ok)
2162 r_alfa_g_2_new = r_alfa_g / sum( r_alfa_g )
2164 error = maxval(abs(r_alfa_g_2_new - r_alfa_g_2))
2167 IF (r_alfa_g(i) .LT. 0.0)
THEN 2173 IF (r_x_d(i) .GT. xtot(i))
THEN 2178 IF ( error .LT. best_error)
THEN 2180 best_alfa_g_2 = r_alfa_g_2
2185 r_alfa_g_2 = best_alfa_g_2
2192 a(i,j) = - xtot(i) * r_rho_g(j) + r_rho_md_beta * &
2193 ( xtot(i) - r_x_d(i) )
2196 a(i,i) = a(i,i) + r_rho_g(i)
2198 r_alfa_g(i) = r_rho_md_beta * ( xtot(i) - r_x_d(i) )
2202 call dgesv(n_gas, 1, a , n_gas, pivot, r_alfa_g , n_gas, ok)
2204 num = r_alfa_g * r_rho_g + ( 1.0 - sum( r_alfa_g ))* r_rho_md_beta * r_x_d
2205 den = sum(r_alfa_g * r_rho_g) + ( 1.0 - sum( r_alfa_g )) * r_rho_md_beta
2206 error = maxval(abs(xtot - num/den));
2208 IF( error .GT. 1e-010 )
THEN 2209 WRITE(*,*)
'Initial exsolved volatile content error!' real *8, dimension(:), allocatable bar_p_c
crystals cohesion pressure
real *8, dimension(:), allocatable x_ex_dis_in
complex *16 u_1
melt-crystals phase local velocity
complex *16 s
mixture entropy
complex *16 x_md_1
melt+dis.gas mass fraction in phase 1
subroutine f_viscliq
Magma viscosity.
complex *16 rhob_m
melt bulk density
complex *16, dimension(:), allocatable growth_rate
growth rate for the crystals
integer idx_p2
Index of p2 in the qp array.
character(len=30), dimension(20) available_visc_melt_models
real *8, dimension(:), allocatable bar_e_c
crystals formation energy
real *8, dimension(:), allocatable gamma_d
dissolved gas adiabatic exponent
real *8, dimension(:), allocatable b_g
parameter for the VDW EOS
real *8, dimension(:), allocatable bar_e_d
dissolved gas formation energy
complex *16 s_1
local specific entropy of the melt-crystals phase
real *8, dimension(:), allocatable t0_c
crystals gas reference temperature
real *8, dimension(:), allocatable p0_g
exsolved gas reference pressure
real *8 drag_funct_coeff
coefficient for the drag function for the relative velocity:
real *8 grav
gravitational acceleration
complex *16, dimension(:,:), allocatable mom_cry
moments of the crystal referred to the melt-crystals phase
complex *16, dimension(:), allocatable rho_g
exsolved gas local density
subroutine allocate_phases_parameters
Initialization of relaxation flags.
real *8 bar_p_m
melt cohesion pressure
real *8 theta_fixed
Fixed value for the relative viscosity of the crystals.
complex *16, dimension(:), allocatable rho_c
crystals local density
real *8, dimension(:), allocatable s0_d
dissolved gas reference entropy
complex *16 theta
Relative viscosity of the crystals.
real *8 c1
Coefficients for the relative viscosity models.
complex *16 mu_2
free Gibbs energy of the exsolved gas
integer idx_u2
Index of u2 in the qp array.
real *8 t0_m
melt reference temperature
real *8 p0_m
melt reference pressure
complex *16 rho_m
melt local density
integer n_gas
Numbeer of crystal phases.
complex *16, dimension(:), allocatable x_c_1
cristal mass fractions in phase 1
real *8, dimension(:), allocatable p0_d
dissolved gas reference pressure
logical explosive
Flag to choose the eruptive style: .
complex *16 e_m
local specific internal energy of the melt
complex *16 cv_1
dis.gas+melt+crystals specific heat capacity at constant volume
real *8 gamma_m
melt adiabatic exponent
real *8 visc_2
gas viscosity
character *30 theta_model
Parameter to choose the model for the influence of crystal on the mixture: 'Lejeune_and_Richet1995' '...
real *8 gamma_2
exsolved gas adiabatic exponent
complex *16 alfa_2
total exsolved gas local volume fraction
complex *16 u_2
exsolved gas local velocity
subroutine f_alfa3(r_p_2, xtot, r_beta, r_rho_md, r_rho_g, r_alfa_g)
Bottom exsolved gas.
real *8, dimension(:), allocatable gamma_c
crystals adiabatic exponent
real *8, dimension(:), allocatable rho0_d
dissolved gas reference density
complex *16 rho_mix
mixture local density
complex *16, dimension(:), allocatable beta_eq
equil. cry. volume fraction in the melt-crystals phase
real *8, dimension(:), allocatable bar_e_g
exsolved gas formation energy
complex *16, dimension(:), allocatable e_g
local specific internal energy of the exsolved gas
real *8 tau_frag_exp
Fragmentation exponent.
real *8, dimension(:), allocatable tc_g
critical gas temperature
real *8 cv_2
exsolved gas specific heat capacity at constant volume
real *8 frag_thr
Threshold for the fragmentation.
subroutine initialize_models
character *20 bubbles_model
Parameter to choose the model for the influence of the bubbles on the mixture: .
character *20 crystallization_model
Model for the equilibrium crystal volume fraction: .
real *8 c0_m
melt sound speed at atmospheric conditions
subroutine f_bubbles
Exsolved gas relative viscosity.
subroutine solve_cubic(a, b, c, y1, y2, y3)
Solution of a cubic.
complex *16, dimension(:), allocatable e_d
local specific internal energy of the dissolved gas
real *8, dimension(12) wt_init
real *8, dimension(:), allocatable c0_c
crystals sound speed at atm conditions
complex *16 tau_frag
fragmentation rate
complex *16 p_2
local pressure of the exsolved gas
integer fragmentation_model
Parameter to choose the fragmentation model: .
real *8 tau_frag_coeff
fragmentation coefficient:
complex *16 rho_md
dis_gas+melt local density
complex *16 e_2
local specific internal energy of the exsolved gas
real *8, dimension(:), allocatable tau_c
crystallization parameter:
complex *16, dimension(:), allocatable x_d_md_eq
equil. dis. gas mass fraction in the melt+dis.gas phase
complex *16 tau_p
pressure relaxation rate
integer idx_alfa_first
First index of alfa in the qp array.
subroutine vel_relax_term(velocity_relaxation)
Velocity relaxation term.
subroutine f_viscmelt
Melt viscosity.
real *8 bubble_number_density
bubble number density
complex *16, dimension(:), allocatable x_c
crystals mass fraction (with respect to the mixture)
real *8 bar_e_2
exsolved gas formation energy
integer n_cry
Numbeer of crystal phases.
real *8, dimension(:), allocatable rho0_c
crystals reference density
complex *16, dimension(:), allocatable s_g
local specific entropy of the exsolved gas
complex *16 rho_2
exsolved gas local density
integer n_visc_melt_models
character *20 gas_law
equation of state for gas
real *8 s0_m
melt reference entropy
complex *16 alfarho_2
bulk density of the exsolved gas
subroutine f_permkc
Magma permeability.
character(len=30), dimension(20) available_drag_models
real *8, dimension(:), allocatable bar_p_d
dissolved gas cohesion pressure
subroutine f_alfa(xtot, xmax, r_beta, r_rho_md, r_rho_2, r_alfa_2)
Bottom exsolved gas.
character *20 p_relax_model
pressure relaxation model
real *8 friction_coefficient
real *8, dimension(:), allocatable tau_d
exsolution parameter:
complex *16 c_2
second phase local sound speed
subroutine sound_speeds(C_mix, mach)
Local sound speeds.
complex *16 mu_m
free Gibbs energy of the melt
complex *16 u_mix
mixture velocity
real *8 rho0_2
exsolved gas reference density
complex *16 s_2
local specific entropy of the exsolved gas
real *8, dimension(:), allocatable s0_c
crystals reference entropy
real *8, dimension(:), allocatable c0_d
dissolved gas sound speed at atm conditions
complex *16 x_1
melt-crystals phase local mass fraction
real *8 tortuosity_factor
tortuosity factor
complex *16 drag_funct
drag function for the relative velocity:
real *8 k_cr
country rock permeability
complex *16 alfa_1
dis_gas+melt+crystals phase local volume fraction
complex *16, dimension(:), allocatable s_d
local specific entropy of the dissolved gas
complex *16, dimension(:), allocatable alfa_g
exsolved gas phases local volume fraction
integer idx_alfa_last
Last index of alfa in the qp array.
complex *16 alfa_m_1
melt volume fraction in phase 1
real *8 radius
Effective radius.
real *8, dimension(:), allocatable beta_max
maximum crystal volume fraction
complex *16, dimension(:), allocatable alfa_g_2
exsolved gas volume fractions in phase 2
subroutine f_growth_rate
This subroutine compute the growth rates for the different crystal phases.
complex *16 visc_1
melt+crystal viscosity
complex *16 s_m
local specific entropy of the melt
character *20 exsol_model
String for exsolution model: .
real *8 cv_m
melt specific heat capacity at constant volume
real *8 bar_e_m
melt formation energy
real *8 zeta_lith
Elevation above the bottom for the evaluation of the lithostatic pressure.
real *8, dimension(:), allocatable rho0_g
exsolved gas reference density
integer idx_beta_first
First index of beta in the qp array.
complex *16, dimension(:), allocatable s_c
local specific entropy of the crystals
subroutine f_nucleation_rate
Lithostatic pressure.
complex *16, dimension(:), allocatable rhob_c
crystals bulk density
real *8 tau_p_coeff
pressure relaxation coefficient:
real *8 frag_eff
index of fragmentation in the interval [0;1]
integer n_mom
Number of moments for each crystal phase.
subroutine f_beta_eq
Equilibrium Crystal content.
real *8, dimension(:), allocatable cv_g
exsolved gas heat capacity at constant volume
real *8, dimension(:), allocatable p0_c
crystals reference pressure
integer idx_xd_first
First index of xd in the qp array.
real *8 rho0_m
melt reference density
real *8 zn
Right (top) of the physical domain.
integer idx_p1
Index of p1 in the qp array.
integer idx_u1
Index of u1 in the qp array.
complex *16, dimension(:), allocatable x_g
exsolved gas mass fraction (with respect to the mixture)
character *30 drag_funct_model
drag function model
real *8, dimension(:), allocatable cv_d
dissolved gas heat capacity at constant volume
character *30 visc_melt_model
Parameter to select the melt viscosity (bubbles and crystal-free) model: .
integer idx_beta_last
Last index of beta in the qp array.
complex *16, dimension(:), allocatable rho_d
dissolved gas local density
complex *16, dimension(:), allocatable e_c
local specific internal energy of the crystals
complex *16 e_1
local specific internal energy of the melt-crystals phase
complex *16 cv_mix
mixture specific heat capacity at constant volume
real *8, dimension(:), allocatable c0_g
exsolved gas sound speed at atm conditions
real *8, dimension(:), allocatable cv_c
crystals specific heat capacity at constant volume
real *8 p_hydro
Hydrostatic pressure.
character(len=30), dimension(20) available_bubble_models
real *8, dimension(:), allocatable a_g
parameter for the VDW EOS
complex *16 x_m
melt mass fraction (with respect to the mixture)
real *8 log10_bubble_number_density
complex *16, dimension(:), allocatable alfa_d_1
dissolved gas volume fractions in phase 1
subroutine press_relax_term(pressure_relaxation)
Pressure relaxation term.
complex *16, dimension(:), allocatable x_d_1
dissolved gas mass fractions in phase 1
real *8, dimension(:), allocatable solub
Solubility parameter for the Henry's law.
complex *16 rho_1
dis_gas+melt+crystals phase local density
subroutine hydrostatic_pressure
Hydrostatic pressure.
complex *16, dimension(:), allocatable x_d
dissolved gas mass fraction (with respect to the mixture)
real *8 rho_cr
contry rock density
real *8, dimension(:), allocatable t0_g
exsolved gas reference temperature
real *8, dimension(:), allocatable pc_g
critical gas pressure
integer n_vars
Number of conservative variables.
real *8 rho_w
Water density.
real *8 throat_bubble_ratio
throat bubble ratio
complex *16, dimension(:), allocatable beta
crystal volume fraction in the melt-crystals phase
complex *16 e_mix
total internal energy
real *8, dimension(:), allocatable gamma_g
exsolved gas adiabatic exponent
complex *16 x_m_1
melt mass fraction in phase 1
complex *16 x_2
exsolved gas local mass fraction
complex *16 c_1
first phase local sound speed
real *8 p_lith
Lithostatic pressure.
complex *16, dimension(:), allocatable mu_d
free Gibbs energy of the dissolved gas
complex *16 mu_1
free Gibbs energy of the melt-crystals phase
complex *16 p_1
local pressure of the melt-crystals phase
real *8, dimension(:), allocatable s0_g
exsolved gas reference entropy
subroutine lithostatic_pressure
Lithostatic pressure.
subroutine eval_densities
Phases densities.
subroutine f_xdis_eq
Equilibrium Dissolved gas.
real *8, dimension(:), allocatable t0_d
dissolved gas reference temperature
complex *16, dimension(:), allocatable nucleation_rate
nulceation rate for the crystals
complex *16 visc_rel_bubbles
relative viscosity due to bubbles
complex *16 permkc
Magma permeability.
complex *16 t
mixture local temperature
real *8, dimension(:), allocatable bar_p_g
exsolved gas cohesion pressure
complex *16, dimension(:), allocatable x_d_md
dissolved gas mass fraction in the melt+dis.gas phase
complex *16 visc_melt
melt viscosity
complex *16, dimension(:), allocatable x_g_2
exsolved gas mass fractions in phase 2
subroutine eos
Equation of state.
character(len=30), dimension(20) available_theta_models
complex *16, dimension(:), allocatable mu_g
free Gibbs energy of the exsolved gas
real *8, dimension(:), allocatable solub_exp
real *8 t0_2
exsolved gas reference temperature
integer idx_t
Index of T in the qp array.
subroutine f_theta
Crystal relative viscosity.
subroutine mixture_viscosity
Mixture viscosity.
integer idx_xd_last
Last index of xd in the qp array.
complex *16, dimension(:), allocatable mu_c
free Gibbs energy of the crystals
complex *16 visc_mix
mixture viscosity
integer n_eqns
Number of equations.
real *8, dimension(:), allocatable beta0
chamber (equilibrium) crystal volume fraction