85 REAL*8,
ALLOCATABLE :: qp(:)
87 REAL*8 :: V_0 , V_1, V_2
90 LOGICAL :: check_flow_rate
94 REAL*8 :: extrap_z , extrap_z_p , extrap_z_mach
95 INTEGER :: extrap_flag
96 REAL*8 :: r_p_1 , r_p_2 , r_p
99 REAL*8 :: extrap_z_0 , extrap_z_2
101 REAL*8 :: V_temp , V_coeff
102 LOGICAL :: check_interval
104 LOGICAL :: flag_output , increase_temp
106 REAL*8 :: initial_mass_flow_rate, final_mass_flow_rate
109 ALLOCATE( qp(n_vars) )
116 IF ( explosive )
THEN 126 flag_output = .false.
132 flag_output = .false.
140 CALL init_steady( u_inlet , qp )
146 IF ( verbose_level .GE. 1 )
THEN 147 p_1 = dcmplx( qp(idx_p1) , 0.d0 )
148 p_2 = dcmplx( qp(idx_p2) , 0.d0 )
149 u_1 = dcmplx( qp(idx_u1) , 0.d0 )
150 u_2 = dcmplx( qp(idx_u2) , 0.d0 )
151 t = dcmplx( qp(idx_t) , 0.d0 )
154 WRITE(*,*)
'<<<<<<<<<<<< ThermoPhysical quantities >>>>>>>>>>>' 155 WRITE(*,*)
'P_1 =',
REAL(p_1)
156 WRITE(*,*)
'P_2 =',
REAL(p_2)
157 WRITE(*,*)
'T =',
REAL(t)
160 WRITE(*,*)
'rho_c =',
REAL(rho_c)
161 WRITE(*,*)
's_c =',
REAL(s_c)
162 WRITE(*,*)
'e_c =',
REAL(
e_c)
163 WRITE(*,*)
'enth_c =',
REAL(
e_c + p_1 / rho_c)
164 WRITE(*,*)
'gibbs_c =',
REAL(mu_c)
167 WRITE(*,*)
'rho_g =',
REAL(rho_g)
168 WRITE(*,*)
's_g =',
REAL(s_g)
169 WRITE(*,*)
'e_g =',
REAL(
e_g)
170 WRITE(*,*)
'enth_g =',
REAL(
e_g + p_2 / rho_g)
171 WRITE(*,*)
'gibbs_g =',
REAL(mu_g)
174 WRITE(*,*)
'rho_m =',
REAL(rho_m)
175 WRITE(*,*)
's_m =',
REAL(
s_m)
176 WRITE(*,*)
'e_m =',
REAL(
e_m)
177 WRITE(*,*)
'enth_m =',
REAL(
e_m + p_1 / rho_m)
178 WRITE(*,*)
'gibbs_m =',
REAL(
mu_m)
182 WRITE(*,*)
'rho_1 =',
REAL(rho_1)
183 WRITE(*,*)
's_1 =',
REAL(s_1)
184 WRITE(*,*)
'e_1 =',
REAL(e_1)
185 WRITE(*,*)
'enth_1 =',
REAL(e_1 + p_1 / rho_1)
186 WRITE(*,*)
'gibbs_1 =',
REAL(mu_1)
189 WRITE(*,*)
'rho_2 =',
REAL(rho_2)
190 WRITE(*,*)
's_2 =',
REAL(s_2)
191 WRITE(*,*)
'e_2 =',
REAL(e_2)
192 WRITE(*,*)
'enth_2 =',
REAL(e_2 + p_2 / rho_2)
193 WRITE(*,*)
'gibbs_2 =',
REAL(mu_2)
195 WRITE(*,*)
'<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>' 200 WRITE(*,*)
'********* V_inlet = ',v_temp,
'**********' 204 initial_mass_flow_rate =
REAL(rho_mix * u_mix)*3.1415*radius*radius
206 WRITE(*,*)
'Initial mass flow rate = ',initial_mass_flow_rate,
' kg/s' 209 extrap_z_mach , extrap_flag , r_p_1 , r_p_2 , mach )
211 IF ( .NOT. shooting )
THEN 217 CALL init_steady( u_inlet , qp )
222 WRITE(*,*)
'Saving solution for V at the inlet',v_temp
225 extrap_z_mach , extrap_flag , r_p_1 , r_p_2 , mach )
231 final_mass_flow_rate =
REAL(rho_mix * u_mix)*3.1415*radius*radius
233 WRITE(*,*)
'Initial mass flow rate = ',initial_mass_flow_rate,
' kg/s' 234 WRITE(*,*)
'Final mass flow rate = ',final_mass_flow_rate,
' kg/s' 236 extrap_z_0 = extrap_z
240 WRITE(*,*)
'Pressure 1 at exit:', r_p_1
241 WRITE(*,*)
'Pressure 2 at exit:', r_p_2
242 WRITE(*,*)
'Mach at exit:', mach
244 IF ( extrap_flag .EQ. -3 )
THEN 246 WRITE(*,*)
'Mach = 1 is reached at:',extrap_z
250 WRITE(*,*)
'Exit pressure is reached at:',extrap_z
256 v_2 = v_temp * v_coeff
262 v_0 = v_temp * v_coeff
264 WRITE(*,*)
'At zeta ',
zeta 265 WRITE(*,*)
'Pressure 1 is: ',r_p_1
266 WRITE(*,*)
'Pressure 2 is: ',r_p_2
267 WRITE(*,*)
'Mach is:', mach
269 IF ( extrap_flag .EQ. 3 )
THEN 271 WRITE(*,*)
'Mach = 1 is reached at:',extrap_z
275 WRITE(*,*)
'Extrap_flag:',extrap_flag
276 WRITE(*,*)
'Exit pressure is reached at:',extrap_z
282 IF ( .NOT.shooting )
THEN 288 IF ( verbose_level .GE. 1 )
READ(*,*)
293 check_interval = .false.
296 DO WHILE ( .NOT. check_interval )
298 IF (v_coeff .LT. 1.0)
THEN 308 v_temp = v_temp * v_coeff
310 WRITE(*,*)
'********* V_inlet = ',v_temp,
'**********' 314 CALL init_steady( u_inlet , qp )
318 flag_output = .false.
322 initial_mass_flow_rate =
REAL(rho_mix * u_mix)*3.1415*radius*radius
325 extrap_z_mach , extrap_flag , r_p_1 , r_p_2 , mach )
328 final_mass_flow_rate =
REAL(rho_mix * u_mix)*3.1415*radius*radius
330 WRITE(*,*)
'Initial mass flow rate = ',initial_mass_flow_rate,
' kg/s' 331 WRITE(*,*)
'Final mass flow rate = ',final_mass_flow_rate,
' kg/s' 333 extrap_z_2 = extrap_z
338 WRITE(*,*)
'Pressure 1 at exit:', r_p_1
339 WRITE(*,*)
'Pressure 2 at exit:', r_p_2
340 WRITE(*,*)
'Mach at exit:', mach
342 IF ( extrap_flag .EQ. -3 )
THEN 344 WRITE(*,*)
'Mach = 1 is reached at:',extrap_z
348 WRITE(*,*)
'Exit pressure is reached at:',extrap_z
353 IF ( .NOT. increase_temp )
THEN 355 check_interval = .true.
362 WRITE(*,*)
'At zeta ',
zeta 363 WRITE(*,*)
'Pressure 1 is: ',r_p_1
364 WRITE(*,*)
'Pressure 2 is: ',r_p_2
365 WRITE(*,*)
'Mach is:', mach
367 IF ( extrap_flag .EQ. 3 )
THEN 369 WRITE(*,*)
'Mach = 1 is reached at:',extrap_z
373 WRITE(*,*)
'Extrap_flag:',extrap_flag
374 WRITE(*,*)
'Exit pressure is reached at:',extrap_z
378 IF ( increase_temp )
THEN 380 check_interval = .true.
389 IF ( verbose_level .GE. 1 )
READ(*,*)
393 check_flow_rate = .false.
397 DO WHILE ( .NOT. check_flow_rate )
401 v_1 = 0.5d0 * ( v_0 + v_2 )
403 WRITE(*,*)
'********* V_inlet = ',v_1,
'********** iter = ', iter
404 WRITE(*,*)
'V_0 = ',v_0,
' V_1 = ',v_1,
' V_2 = ',v_2
405 WRITE(*,*)
'Delta V = ', 0.5d0 * ( v_2 - v_0 )
409 CALL init_steady( u_inlet , qp )
413 flag_output = .false.
417 initial_mass_flow_rate =
REAL(rho_mix * u_mix)*3.14*radius*radius
420 extrap_z_mach , extrap_flag , r_p_1 , r_p_2 , mach )
423 final_mass_flow_rate =
REAL(rho_mix * u_mix)*3.14*radius*radius
425 WRITE(*,*)
'Initial mass flow rate = ',initial_mass_flow_rate,
' kg/s' 426 WRITE(*,*)
'Final mass flow rate = ',final_mass_flow_rate,
' kg/s' 428 WRITE(*,*)
'Extrap_flag:',extrap_flag
429 WRITE(*,*)
'Extrap_z_p',extrap_z_p
430 WRITE(*,*)
'Extrap_z_mach',extrap_z_mach
432 r_p = min( r_p_1 , r_p_2 )
436 WRITE(*,*)
'Pressure 1 at exit:', r_p_1
437 WRITE(*,*)
'Pressure 2 at exit:', r_p_2
438 WRITE(*,*)
'Mach at exit:', mach
441 IF ( extrap_z_mach .LE. extrap_z_p )
THEN 443 WRITE(*,*)
'Mach = 1 is reached at:',extrap_z
447 WRITE(*,*)
'Extrap_flag:',extrap_flag
448 WRITE(*,*)
'Exit pressure is reached at:',extrap_z
452 IF ( abs(r_p - p_out) .LT.
eps_conv * p_out )
THEN 454 check_flow_rate = .true.
460 IF ( ( abs( mach - 1.d0 ) .LT.
eps_conv ) .AND. (
zeta .EQ. zn ) )
THEN 462 WRITE(*,*)
'Mach at exit:', mach
463 WRITE(*,*)
'Pressure 1 at exit:', r_p_1
464 WRITE(*,*)
'Pressure 2 at exit:', r_p_2
466 check_flow_rate = .true.
470 IF (
zeta .GE. zn )
THEN 472 WRITE(*,*)
'Mach at exit:', mach
473 WRITE(*,*)
'Pressure 1 at exit:', r_p_1
474 WRITE(*,*)
'Pressure 2 at exit:', r_p_2
478 WRITE(*,*)
'At zeta ',
zeta 479 WRITE(*,*)
'Pressure 1 is: ',r_p_1
480 WRITE(*,*)
'Pressure 2 is: ',r_p_2
481 WRITE(*,*)
'Mach is:', mach
483 IF ( extrap_flag .EQ. 3 )
THEN 485 WRITE(*,*)
'Mach = 1 is reached at:',extrap_z
489 WRITE(*,*)
'Extrap_flag:',extrap_flag
490 WRITE(*,*)
'Exit pressure is reached at:',extrap_z
505 extrap_z_0 = extrap_z
511 extrap_z_2 = extrap_z
516 IF ( abs(r_p - p_out) .GT. p_out )
THEN 518 check_flow_rate = .false.
523 IF ( iter .GT. 20 )
THEN 525 IF ( ( ( v_2 - v_0 ) / v_0 .LT.
eps_conv ) .AND. &
526 (
zeta .GE. zn - (iter-20)/100.d0 ) .AND. ( extrap_flag .NE. 4 ) &
527 .AND. ( extrap_flag .NE. -3 ) )
THEN 529 WRITE(*,*)
'Relative change in flow rate', ( v_2 - v_0 ) / v_0
531 check_flow_rate = .true.
535 IF ( ( ( v_2 - v_0 ) / v_0 .LT.
eps_conv ) .AND. &
536 (
zeta .GE. zn - (iter-20)/100.d0 ) .AND. &
537 ( abs(mach - 1.0) .LT. 0.01) )
THEN 539 WRITE(*,*)
'Relative change in flow rate', ( v_2 - v_0 ) / v_0
541 check_flow_rate = .true.
547 IF ( iter .GT. 100 )
THEN 549 IF ( (
zeta .GE. zn - (iter-20)/100.d0 ) .AND. ( extrap_flag .NE. 4 ) &
550 .AND. ( extrap_flag .NE. -3 ) )
THEN 552 WRITE(*,*)
'Relative change in flow rate', ( v_2 - v_0 ) / v_0
554 check_flow_rate = .true.
558 IF ( (
zeta .GE. zn - (iter-20)/100.d0 ) .AND. ( abs(r_p - p_out) &
559 .LT. (1.0d0 + (iter-50)/10.d0) * p_out) )
THEN 561 WRITE(*,*)
'Relative change in flow rate', ( v_2 - v_0 ) / v_0
563 check_flow_rate = .true.
569 IF ( ( ( v_2 - v_0 ) / v_0 .LT.
eps_conv ) .AND. &
570 (
zeta .GE. zn ) .AND. ( extrap_flag .NE. 4 ) &
574 WRITE(*,*)
'Relative change in flow rate', ( v_2 - v_0 ) / v_0
576 check_flow_rate = .true.
580 IF ( verbose_level .GE. 1 )
READ(*,*)
590 CALL init_steady( u_inlet , qp )
594 WRITE(*,*)
'Number of iterations',iter
595 WRITE(*,*)
'Saving solution for V at the inlet',v_1
598 extrap_z_mach , extrap_flag , r_p_1 , r_p_2 , mach )
624 extrap_z_mach , extrap_flag , r_p_1 , r_p_2 , mach )
657 REAL*8,
INTENT(INOUT) :: qp(n_eqns)
658 LOGICAL,
INTENT(IN) :: flag_output
659 REAL*8,
INTENT(OUT) :: extrap_z , extrap_z_p , extrap_z_mach
660 INTEGER,
INTENT(OUT) :: extrap_flag
661 REAL*8,
INTENT(OUT) :: r_p_1 , r_p_2
662 REAL*8,
INTENT(OUT) :: mach
671 REAL*8 :: check_error , check_error_old, coeff_z
675 LOGICAL :: fragmentation
682 REAL*8 :: qp_comp(n_eqns)
685 REAL*8 :: qp_old(n_eqns)
688 REAL*8 :: qp_full(n_eqns)
691 REAL*8 :: qp_half(n_eqns)
694 REAL*8 :: qp_half2(n_eqns)
696 REAL*8 :: fluxes_temp(n_vars) , nh_terms_temp(n_vars)
698 REAL*8 :: dqp_dz(n_vars)
701 LOGICAL :: check_convergence
703 REAL*8 :: qp_guess(n_vars)
705 REAL*8 :: delta_full , delta_half2
707 LOGICAL :: fragmentation_half2, fragmentation_full
709 REAL*8 :: alfa_2_half2, alfa_2_full, alfa_2_qp
711 REAL*8 :: strain_rate_qp
725 IF ( flag_output) shooting = .false.
727 CALL update_radius(
zeta)
736 IF ( verbose_level .GE. 1 )
THEN 745 lateral_degassing = .false.
746 fragmentation = .false.
749 check_error_old = 1.d0
751 dqp_dz(1:n_vars) = 0.d0
762 counter = counter + 1
766 WRITE(*,*)
'Convergence error: Too many iterations' 767 WRITE(*,*)
'counter = ', counter
776 u_1_old = qp_old(idx_u1)
780 CALL update_radius(
zeta)
782 IF ( verbose_level .GE. 1 )
THEN 784 WRITE(*,*)
'zeta, radius, counter',
zeta,
radius, counter
788 CALL eval_fluxes_qp( r_qp = qp_old , r_flux =
fluxes_old )
790 CALL eval_nonhyperbolic_terms_qp( r_qp = qp_old , r_nh_term_impl = &
793 IF ( verbose_level .GE. 3 )
THEN 795 WRITE(*,*)
'Non hyperbolic term = ' 801 IF ( isothermal )
THEN 811 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'z = ',
zeta,
'dz = ',dz
817 CALL update_radius(
zeta)
821 IF ( verbose_level .GE. 1 )
THEN 823 WRITE(*,*)
'/--------full step---------/' 832 CALL advance_dz( qp_full , dz , check_convergence )
834 IF ( .NOT. check_convergence )
THEN 836 qp_full = qp_old + dqp_dz * dz
840 CALL advance_dz( qp_full , dz , check_convergence )
847 IF ( check_convergence )
THEN 853 CALL update_radius(
zeta)
856 IF ( verbose_level .GE. 1 )
THEN 858 WRITE(*,*)
'/--------fist half step---------/' 861 qp_half(1:n_vars) = qp_old(1:n_vars)
865 CALL advance_dz( qp_half , 0.5 * dz , check_convergence )
869 IF ( .NOT. check_convergence )
THEN 871 qp_half(1:n_vars) = 0.5d0 * (qp_old(1:n_vars) + &
876 CALL advance_dz( qp_half , 0.5 * dz , check_convergence )
882 IF ( .NOT. check_convergence )
THEN 888 CALL advance_dz( qp_half , 0.5 * dz , check_convergence )
895 IF ( check_convergence )
THEN 901 IF ( verbose_level .GE. 1 )
THEN 903 WRITE(*,*)
'/--------second half step---------/' 907 CALL update_radius(
zeta_old + 0.5d0 * dz)
908 CALL eval_fluxes_qp( r_qp = qp_half , r_flux =
fluxes_old )
910 CALL eval_nonhyperbolic_terms_qp( r_qp = qp_half , r_nh_term_impl =&
913 IF ( isothermal )
THEN 921 CALL update_radius(
zeta)
928 CALL advance_dz( qp_half2 , 0.5 * dz , check_convergence )
932 IF ( .NOT. check_convergence )
THEN 938 CALL advance_dz( qp_half2 , 0.5 * dz , check_convergence )
944 IF ( .NOT. check_convergence )
THEN 946 qp_half2 = qp_old + 0.50 * dz * ( qp_half - qp_old )
950 CALL advance_dz( qp_half2 , 0.5 * dz , check_convergence )
956 IF ( verbose_level .GE. 1 )
THEN 958 WRITE(*,*)
'<<<<<<<<< check_convergence >>>>>>>> ',check_convergence
962 IF ( check_convergence )
THEN 966 check_error = maxval(abs( qp_full(1:n_vars) - &
968 max( abs( qp_full(1:n_vars) ) , &
969 abs( qp_half2(1:n_vars) ) ) ) )
971 delta_full = maxval(abs( qp_full(1:n_vars) - &
973 max( abs( qp_full(1:n_vars) ) , &
974 abs( qp_guess(1:n_vars) ) ) ) )
976 delta_half2 = maxval(abs( qp_half2(1:n_vars) - &
978 max( abs( qp_half2(1:n_vars) ) , &
979 abs( qp_guess(1:n_vars) ) ) ) )
981 IF ( verbose_level .GE. 1 )
THEN 983 WRITE(*,*)
'check dz and dz/2 error',check_error
987 IF ( max( qp_half2(idx_p1) , qp_half2(idx_p2) ) &
990 check_convergence = .false.
991 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'pressure', &
992 max( qp_half2(idx_p1) , qp_half2(idx_p2) )
996 IF ( verbose_level .GE. 2 )
THEN 998 WRITE(*,*)
'qp_half2' 1001 WRITE(*,*)
'qp_full' 1004 WRITE(*,*)
'alfa_2',sum(qp_half2(1:
n_gas))
1016 IF ( explosive )
THEN 1018 alfa_2_half2 = sum(qp_half2(idx_alfa_first:idx_alfa_last))
1019 alfa_2_full = sum(qp_full(idx_alfa_first:idx_alfa_last))
1020 alfa_2_qp = sum(qp(idx_alfa_first:idx_alfa_last))
1022 IF ( alfa_2_half2 .GT. frag_thr )
THEN 1024 fragmentation_half2 = .true.
1028 fragmentation_half2 = .false.
1032 IF ( alfa_2_full .GT. frag_thr )
THEN 1034 fragmentation_full = .true.
1038 fragmentation_full = .false.
1043 IF ( ( .NOT.fragmentation ) &
1044 .AND. ( fragmentation_half2 .OR. fragmentation_full ) &
1045 .AND. ( frag_thr - alfa_2_qp .GT. 1.d-4 ) &
1049 check_convergence = .false.
1055 IF ( ( check_error .LT. 1.d0 ) .AND. ( check_convergence ) )
THEN 1060 coeff_z = max( 1.05d0 , min( 1.50d0 , check_error ** ( -0.35d0 ) * &
1061 check_error_old ** ( 0.2d0 ) ) )
1063 check_error_old = check_error
1067 IF ( delta_half2 .LT. delta_full )
THEN 1070 dqp_dz = ( qp_half2 - qp_old ) / dz
1075 dqp_dz = ( qp_full - qp_old ) / dz
1081 IF ( verbose_level .GE. 1 )
THEN 1083 WRITE(*,*)
'::::::::: checks ok :::::::::' 1084 WRITE(*,*)
'zeta = ',
zeta,
' check_error = ',check_error, &
1085 ' coeff_z = ',coeff_z
1090 WRITE(*,*)
'alfa_2 =',sum(qp(idx_alfa_first:idx_alfa_last)), &
1091 ' fragmentation = ', frag_eff,
'Mass flow rate = ', &
1092 REAL(rho_mix * u_mix)*3.14*radius*radius
1109 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'zeta_old',
zeta_old, &
1112 IF ( dz .LT. 1e-20 )
THEN 1114 WRITE(*,*)
'Convergence Error: dz too small' 1115 WRITE(*,*)
'dz =', dz
1122 END DO find_step_loop
1126 IF ( flag_output )
THEN 1128 IF ( shooting )
THEN 1130 DO WHILE ( (
z_comp(idx_zeta) .LT.
zeta ) .AND. &
1133 coeff_zeta = (
z_comp(idx_zeta) - (
zeta - dz ) ) / dz
1135 qp_comp = coeff_zeta * qp + ( 1.d0 - coeff_zeta ) * qp_old
1139 idx_zeta = idx_zeta + 1
1155 dz = min( coeff_z * dz ,
dz_max )
1159 r_alfa_2 = sum(qp_half2(idx_alfa_first:idx_alfa_last))
1166 CALL sound_speeds( c_mix , mach )
1172 extrap_z_mach,extrap_flag)
1174 IF ( extrap_flag .GT. 0 )
THEN 1184 IF (
zeta .GE. zn )
THEN 1194 IF ( explosive )
THEN 1196 alfa_2_qp = sum(qp(idx_alfa_first:idx_alfa_last))
1198 IF ( ( alfa_2_qp .GT. frag_thr) .AND. &
1199 ( .NOT. fragmentation ) )
THEN 1202 fragmentation = .true.
1204 WRITE(*,*)
'Fragmentation at z = ',
zeta 1213 IF ( ( r_alfa_2 .GE. alfa2_lat_thr ) .AND. &
1214 ( lateral_degassing_flag ) .AND. ( .NOT.lateral_degassing ) )
THEN 1216 lateral_degassing = .true.
1218 WRITE(*,*)
'Lateral degassing from z = ',
zeta 1222 END DO zeta_integration
1243 REAL*8,
INTENT(INOUT) :: qp(n_vars)
1246 qp(idx_p2) = qp(idx_p2) + 1.d-2
1249 IF ( qp(idx_u1) - qp(idx_u2) .GT. -1d-7 )
THEN 1251 qp(idx_u2) = qp(idx_u2) * ( 1.0001d0 )
1270 SUBROUTINE advance_dz( qp , dz , check_convergence )
1281 REAL*8,
INTENT(INOUT) :: qp(n_eqns)
1282 REAL*8,
INTENT(IN) :: dz
1283 LOGICAL,
INTENT(OUT) :: check_convergence
1285 REAL*8 :: qp_rel(n_vars)
1286 REAL*8 :: qp_org(n_vars)
1288 REAL*8 :: left_matrix(n_eqns,n_eqns)
1289 REAL*8 :: right_term(n_eqns)
1291 REAL*8 :: scal_f , scal_f_old
1293 INTEGER :: pivot(n_eqns)
1296 INTEGER :: idx_max(1)
1298 REAL*8 :: delta_qp_rel(n_eqns)
1299 REAL*8 :: grad_f(n_eqns)
1301 REAL*8,
DIMENSION(size(qp)) :: qp_NR_old , desc_dir
1303 REAL*8 :: qp_rel_NR_old(n_vars)
1305 REAL*8 :: check_NR_error
1307 REAL*8 :: scal_f_init
1309 LOGICAL :: opt_search_NL
1310 REAL*8,
PARAMETER :: STPMX=100.d0
1315 REAL*8,
PARAMETER :: tol_rel_NR = 1.d-20 , tol_abs_nr = 1.d-20
1318 LOGICAL :: normalize_qp
1319 LOGICAL :: normalize_f
1321 REAL*8 :: coeff_f(n_eqns)
1323 REAL*8 :: arg_check(n_eqns)
1327 check_convergence = .false.
1329 normalize_qp = .true.
1330 normalize_f = .false.
1332 IF ( normalize_qp )
THEN 1336 IF ( qp(i) .EQ. 0.d0 )
THEN 1350 qp_org(1:n_vars) = 1.0d0
1354 qp_rel = qp / qp_org
1356 IF ( normalize_qp )
THEN 1358 qp_rel = qp_rel * 1.00001d0
1363 coeff_f(1:n_eqns) = 1.d0
1365 IF ( normalize_f )
THEN 1367 CALL eval_f( qp_rel , qp_org , dz , coeff_f , right_term , scal_f )
1371 IF ( abs(right_term(i)) .GE. 1.d-5 )
THEN 1373 coeff_f(i) = 1.d0 / right_term(i)
1381 IF ( verbose_level .GE. 3 )
THEN 1383 CALL eval_f( qp_rel , qp_org , dz , coeff_f , right_term , scal_f )
1384 WRITE(*,*)
'before iter' 1385 WRITE(*,*)
'right_term',right_term
1393 CALL eval_jacobian( qp_rel , qp_org , dz , coeff_f , left_matrix )
1395 CALL eval_f( qp_rel , qp_org , dz , coeff_f , right_term , scal_f )
1397 IF (
nl_iter .EQ. 1 ) scal_f_init = scal_f
1399 delta_qp_rel = right_term
1401 call dgesv(n_eqns, 1, left_matrix , n_eqns, pivot, delta_qp_rel , n_eqns,&
1404 IF ( ok .EQ. 0 )
THEN 1406 qp_rel_nr_old = qp_rel
1407 qp_nr_old = qp_rel * qp_org
1409 desc_dir = - delta_qp_rel
1411 opt_search_nl = .true.
1413 IF ( ( opt_search_nl ) .AND. (
nl_iter .GT. 0 ) )
THEN 1415 stpmax = stpmx * max( dsqrt( dot_product(qp_rel,qp_rel) ) , &
1416 dble(
SIZE(qp_rel)) )
1418 grad_f = matmul( right_term , left_matrix )
1420 CALL steady_lnsrch( qp_rel_nr_old , qp_org , scal_f_old , grad_f , &
1421 desc_dir , dz , coeff_f , qp_rel , scal_f , right_term , &
1422 stpmax , check ,
eval_f )
1426 desc_dir = - 0.5d0 * delta_qp_rel
1428 qp_rel = qp_rel_nr_old + desc_dir
1430 CALL eval_f( qp_rel , qp_org , dz , coeff_f , right_term , &
1435 DO i=idx_xd_first,idx_xd_last
1437 qp_rel(i) = max(qp_rel(i),0.d0)
1441 DO i=idx_beta_first,idx_beta_last
1443 qp_rel(i) = max(qp_rel(i),0.d0)
1449 qp_rel = qp_rel_nr_old + desc_dir
1451 DO i=idx_xd_first,idx_xd_last
1453 qp_rel(i) = max(qp_rel(i),0.d0)
1457 DO i=idx_beta_first,idx_beta_last
1459 qp_rel(i) = max(qp_rel(i),0.d0)
1463 CALL eval_f( qp_rel , qp_org , dz , coeff_f , right_term , scal_f )
1472 DO i=idx_xd_first,idx_xd_last
1474 qp_rel(i) = max(qp_rel(i),0.d0)
1478 DO i=idx_beta_first,idx_beta_last
1480 qp_rel(i) = max(qp_rel(i),0.d0)
1484 qp = qp_rel * qp_org
1486 arg_check = abs( qp_rel(1:n_vars) - qp_rel_nr_old(1:n_vars) ) / &
1487 ( tol_abs_nr + tol_rel_nr * max( abs(qp_rel(1:n_vars)) , &
1488 abs(qp_rel_nr_old(1:n_vars)) ) )
1490 check_nr_error = maxval( arg_check )
1492 idx_max = maxloc( arg_check )
1494 IF ( verbose_level .GE. 3 )
THEN 1497 WRITE(*,*)
'right_term' 1498 WRITE(*,*) right_term
1500 WRITE(*,*)
'desc_dir' 1503 WRITE(*,*)
'qp_NR_old' 1504 WRITE(*,*) qp_nr_old
1510 WRITE(*,*)
'scal_f = ' 1511 WRITE(*,*) scal_f_init , scal_f , scal_f/scal_f_old , &
1515 WRITE(*,*)
'check_NR_error = ' 1516 WRITE(*,*) check_nr_error, idx_max, &
1517 qp_rel(idx_max) * qp_org(idx_max), &
1518 qp_rel_nr_old(idx_max) * qp_org(idx_max)
1520 WRITE(*,*)
'zeta = ' 1530 IF ( verbose_level .GE. 3 )
THEN 1532 WRITE(*,*)
'advance_dz : num_cond too small' 1533 WRITE(*,*)
'left_matrix' 1536 WRITE(*,*) left_matrix(j,:)
1548 IF ( qp_rel(1) .LT. 0.0d0 )
THEN 1550 check_convergence = .false.
1557 IF ( check_nr_error .LT. 0.10d0 )
THEN 1559 IF ( scal_f / scal_f_init .LT. 1.d-10 ) check_convergence = .true.
1565 IF ( scal_f / scal_f_init .LT. 1.d-14 )
THEN 1567 check_convergence = .true.
1575 IF ( scal_f / scal_f_init .LT. 1.d-11 ) check_convergence = .true.
1577 IF ( sum(qp_rel(idx_alfa_first:idx_alfa_last)) .LT. 0.0d0 )
THEN 1579 check_convergence = .false.
1583 IF ( sum(qp_org(idx_alfa_first:idx_alfa_last) &
1584 * qp_rel(idx_alfa_first:idx_alfa_last)) .GE. 1.0d0 )
THEN 1586 check_convergence = .false.
1591 IF ( verbose_level .GE. 1 )
THEN 1594 WRITE(*,*)
'scal_f = ' ,
nl_iter , idx_max , &
1595 scal_f/scal_f_init,check_nr_error, idx_max, ok
1597 WRITE(*,*)
'qp_new = ' 1598 WRITE(*,*) qp_rel * qp_org
1620 SUBROUTINE eval_f( qp_rel , qp_org , dz , coeff_f , right_term , scal_f )
1629 REAL*8,
INTENT(IN) :: qp_rel(:)
1630 REAL*8,
INTENT(IN) :: qp_org(:)
1631 REAL*8,
INTENT(IN) :: dz
1632 REAL*8,
INTENT(IN) :: coeff_f(:)
1633 REAL*8,
INTENT(OUT) :: right_term(:)
1634 REAL*8,
INTENT(OUT) :: scal_f
1636 REAL*8 :: qp(n_vars)
1637 REAL*8 :: fluxes(n_eqns)
1638 REAL*8 :: nh_terms(n_eqns)
1641 qp = qp_rel * qp_org
1643 CALL eval_fluxes_qp( r_qp=qp , r_flux=fluxes)
1656 IF ( isothermal )
THEN 1658 fluxes(idx_mix_engy_eqn) = qp(idx_t)
1659 nh_terms(idx_mix_engy_eqn) = 0.d0
1660 right_term(idx_mix_engy_eqn) = fluxes(idx_mix_engy_eqn) &
1668 right_term = right_term * coeff_f
1670 IF ( verbose_level .GE. 3 )
THEN 1673 WRITE(*,*)
'fluxes',
REAL(fluxes)
1675 WRITE(*,*)
'nh_terms',
REAL(nh_terms)
1681 scal_f = 0.5d0 * dot_product( right_term , right_term )
1701 SUBROUTINE eval_jacobian( qp_rel , qp_org , dz , coeff_f , left_matrix)
1711 REAL*8,
INTENT(IN) :: qp_rel(n_vars)
1712 REAL*8,
INTENT(IN) :: qp_org(n_vars)
1713 REAL*8,
INTENT(IN) :: dz
1714 REAL*8,
INTENT(IN) :: coeff_f(n_eqns)
1715 REAL*8,
INTENT(OUT) :: left_matrix(n_eqns,n_eqns)
1719 REAL*8 :: qp(n_vars)
1720 COMPLEX*16 :: qp_cmplx(n_eqns)
1721 COMPLEX*16 :: fluxes_cmplx(n_eqns)
1722 COMPLEX*16 :: nh_terms_cmplx(n_eqns)
1724 REAL*8 :: Jacob_fluxes(n_eqns,n_eqns)
1725 REAL*8 :: Jacob_nh(n_eqns,n_eqns)
1729 h = n_eqns * epsilon(1.d0)
1731 qp = qp_rel * qp_org
1733 qp_cmplx(1:n_eqns) = dcmplx( qp(1:n_eqns) , 0.d0 )
1737 qp_cmplx(i) = dcmplx( qp_rel(i) , h ) * qp_org(i)
1739 CALL eval_fluxes_qp( c_qp=qp_cmplx , c_flux=fluxes_cmplx )
1743 IF ( isothermal )
THEN 1745 fluxes_cmplx(idx_mix_engy_eqn) = qp_cmplx(idx_t)
1746 nh_terms_cmplx(idx_mix_engy_eqn) = dcmplx( 0.d0 , 0.d0)
1750 jacob_fluxes(1:n_eqns,i) = dimag(fluxes_cmplx) / h
1751 jacob_nh(1:n_eqns,i) = dimag(nh_terms_cmplx) / h
1753 jacob_fluxes(1:n_eqns,i) = jacob_fluxes(1:n_eqns,i) * coeff_f
1754 jacob_nh(1:n_eqns,i) = jacob_nh(1:n_eqns,i) * coeff_f
1756 qp_cmplx(i) = dcmplx( qp(i) , 0.d0 )
1760 left_matrix = jacob_fluxes - dz *
alfa_impl * jacob_nh
1788 SUBROUTINE steady_lnsrch( x_rel_init , x_org , scal_f_old , grad_f , desc_dir &
1789 , dz , coeff_f , x_rel_new , scal_f , f_nl , stpmax , check , callf )
1794 REAL*8,
DIMENSION(:),
INTENT(IN) :: x_rel_init
1797 REAL*8,
DIMENSION(:),
INTENT(IN) :: x_org
1800 REAL*8,
DIMENSION(:),
INTENT(IN) :: grad_f
1803 REAL*8,
INTENT(IN) :: scal_f_old
1806 REAL*8,
DIMENSION(:),
INTENT(INOUT) :: desc_dir
1808 REAL*8,
INTENT(IN) :: dz
1810 REAL*8,
INTENT(IN) :: stpmax
1812 REAL*8,
DIMENSION(:),
INTENT(IN) :: coeff_f
1815 REAL*8,
DIMENSION(:),
INTENT(OUT) :: x_rel_new
1818 REAL*8,
INTENT(OUT) :: scal_f
1821 REAL*8,
DIMENSION(:),
INTENT(OUT) :: f_nl
1824 LOGICAL,
INTENT(OUT) :: check
1827 SUBROUTINE callf( x_rel , x_org , dz , coeff_f , f_nl , scal_f )
1831 REAL*8,
INTENT(IN) :: x_rel(:)
1832 REAL*8,
INTENT(IN) :: x_org(:)
1833 REAL*8,
INTENT(IN) :: dz
1834 REAL*8,
INTENT(IN) :: coeff_f(:)
1835 REAL*8,
INTENT(OUT) :: f_nl(:)
1836 REAL*8,
INTENT(OUT) :: scal_f
1838 END SUBROUTINE callf
1841 REAL*8,
PARAMETER :: TOLX=epsilon(x_rel_init)
1843 INTEGER,
DIMENSION(1) :: ndum
1844 REAL*8 :: ALF , a,alam,alam2,alamin,b,disc
1846 REAL*8 :: desc_dir_abs
1847 REAL*8 :: rhs1 , rhs2 , slope, tmplam
1851 IF (
size(grad_f) ==
size(desc_dir) .AND.
size(grad_f) ==
size(x_rel_new) &
1852 .AND.
size(x_rel_new) ==
size(x_rel_init) )
THEN 1858 WRITE(*,*)
'nrerror: an assert_eq failed with this tag:',
'lnsrch' 1859 stop
'program terminated by assert_eq4' 1865 desc_dir_abs = dsqrt( dot_product(desc_dir,desc_dir) )
1867 IF ( desc_dir_abs > stpmax ) desc_dir(:) = desc_dir(:) * stpmax / &
1870 slope = dot_product(grad_f,desc_dir)
1872 alamin = tolx / maxval( abs( desc_dir(:)) / max( abs( x_rel_init(:)) , &
1877 IF ( alamin .EQ. 0.d0)
THEN 1879 x_rel_new(:) = x_rel_init(:)
1890 optimal_step_search:
DO 1892 IF ( verbose_level .GE. 4 )
THEN 1894 WRITE(*,*)
'alam',alam
1898 x_rel_new = x_rel_init + alam * desc_dir
1900 CALL callf( x_rel_new , x_org , dz , coeff_f , f_nl , scal_f )
1904 IF ( verbose_level .GE. 4 )
THEN 1906 WRITE(*,*)
'x',x_rel_new,x_rel_init
1907 WRITE(*,*)
'lnsrch: effe_old,effe',scal_f_old,scal_f
1912 IF ( alam < alamin )
THEN 1915 IF ( verbose_level .GE. 4 )
THEN 1917 WRITE(*,*)
' convergence on Delta_x',alam,alamin
1921 x_rel_new(:) = x_rel_init(:)
1925 EXIT optimal_step_search
1927 ELSE IF ( scal_f .LE. scal_f_old + alf * alam * slope )
THEN 1929 EXIT optimal_step_search
1933 IF ( alam .EQ. 1.d0 )
THEN 1935 tmplam = - slope / ( 2.0d0 * ( scal_f - scal_f_old - slope ) )
1939 rhs1 = scal_f - scal_f_old - alam*slope
1940 rhs2 = scal_f2 - scal_f_old - alam2*slope
1942 a = ( rhs1/alam**2.d0 - rhs2/alam2**2.d0 ) / ( alam - alam2 )
1943 b = ( -alam2*rhs1/alam**2 + alam*rhs2/alam2**2 ) / ( alam - alam2 )
1945 IF ( a .EQ. 0.d0 )
THEN 1947 tmplam = - slope / ( 2.0d0 * b )
1951 disc = b*b - 3.0d0*a*slope
1953 IF ( disc .LT. 0.d0 )
THEN 1955 tmplam = 0.5d0 * alam
1957 ELSE IF ( b .LE. 0.d0 )
THEN 1959 tmplam = ( - b + dsqrt(disc) ) / ( 3.d0 * a )
1963 tmplam = - slope / ( b + dsqrt(disc) )
1969 IF ( tmplam .GT. 0.5d0*alam ) tmplam = 0.5d0 * alam
1977 alam = max( tmplam , 0.1d0*alam )
1979 END DO optimal_step_search
2003 extrap_z_mach,extrap_flag)
2016 REAL*8,
INTENT(IN) :: zeta_old
2017 REAL*8,
INTENT(IN) :: qp_old(n_eqns)
2018 REAL*8,
INTENT(IN) :: zeta
2019 REAL*8,
INTENT(IN) :: qp(n_eqns)
2021 REAL*8,
INTENT(OUT) :: extrap_z
2022 REAL*8,
INTENT(OUT) :: extrap_z_p
2023 REAL*8,
INTENT(OUT) :: extrap_z_mach
2024 INTEGER,
INTENT(OUT) :: extrap_flag
2026 REAL*8 :: r_p_2 , r_p_2_old
2027 REAL*8 :: r_p_1 , r_p_1_old
2028 REAL*8 :: mach , mach_old
2034 REAL*8 :: extrap_z_2
2035 REAL*8 :: extrap_z_1
2037 REAL*8 :: coeff_p_1 , coeff_p_2
2039 REAL*8 :: p_out_1 , p_out_2
2041 REAL*8 :: eps_extrap
2055 IF ( qp(n_vars) .GT. 0.d0 )
THEN 2069 CALL sound_speeds(c_mix,mach)
2073 IF ( verbose_level .GT. 1 )
THEN 2075 WRITE(*,*)
'p1,p2,mach',r_p_1,r_p_2,mach
2081 p_check = min(r_p_2,r_p_1)
2083 r_alfa_2 =
REAL(alfa_2)
2085 IF ( ( r_p_1 .LT. p_out_1 ) .OR. ( r_p_2 .LT. p_out_2 ) .OR. &
2086 ( mach .GT. 1.d0 ) )
THEN 2088 IF ( verbose_level .GE. -1 )
THEN 2090 WRITE(*,*)
'Boundary conditions before the top' 2091 WRITE(*,*)
'z = ',zeta,
'Pressures = ',r_p_1,r_p_2
2092 WRITE(*,*)
'Mach =',mach
2103 IF ( r_alfa_2 .GE. 1.d0 )
THEN 2105 IF ( verbose_level .GE. -1 )
THEN 2107 WRITE(*,*)
'Boundary conditions before the top' 2108 WRITE(*,*)
'z = ',zeta,
'alfa gas = ',r_alfa_2
2119 IF ( (abs(zeta - zeta_old) .LT. 1e-11) .AND. &
2120 (r_p_1 .LT. 1.0e+6) )
THEN 2122 IF ( verbose_level .GE. -1 )
THEN 2124 WRITE(*,*)
'Pressure Conditions reached before the exit' 2136 IF ( (abs(zeta - zeta_old) .LT. 1e-6) .AND. &
2137 ( sum(
REAL(
x_d_md)) .LT. sum(x_ex_dis_in) ) ) then
2139 IF ( verbose_level .GE. -1 )
THEN 2141 WRITE(*,*)
'Dissolved gas Conditions reached before the exit' 2157 r_p_1_old = qp_old(idx_p1)
2158 r_p_2_old = qp_old(idx_p2)
2162 CALL sound_speeds(c_mix,mach_old)
2165 IF ( r_p_2 - r_p_2_old .LT. 0.d0 )
THEN 2167 extrap_z_2 = zeta_old - ( zeta - zeta_old ) / ( r_p_2 - r_p_2_old) * &
2170 IF ( verbose_level .GE. 1 )
THEN 2172 WRITE(*,*)
'gas pressure extrapolation' 2173 WRITE(*,*)
'extrap_z_2 =',extrap_z_2,r_p_2
2184 IF ( r_p_1 - r_p_1_old .LT. 0.d0 )
THEN 2186 extrap_z_1 = zeta_old + ( zeta - zeta_old ) / ( r_p_1 - r_p_1_old) * &
2187 ( p_out_1 - r_p_1_old )
2189 IF ( verbose_level .GE. 1 )
THEN 2191 WRITE(*,*)
'liquid pressure extrapolation' 2192 WRITE(*,*)
'extrap_z_1 =',extrap_z_1,r_p_1
2202 extrap_z_p = min( extrap_z_1 , extrap_z_2 )
2205 IF ( mach - mach_old .GT. 0.d0 )
THEN 2207 extrap_z_mach = zeta_old + ( zeta - zeta_old ) / ( mach - mach_old ) * &
2210 IF ( verbose_level .GE. 1 )
THEN 2212 WRITE(*,*)
'Mach number extrapolation' 2213 WRITE(*,*)
'extrap_z_mach',extrap_z_mach,mach
2227 IF ( zeta .EQ.
zn )
THEN 2229 IF ( extrap_z_1 .GT.
zn ) extrap_z_p = extrap_z_1
2231 IF ( extrap_z_2 .GT.
zn ) extrap_z_p = min( extrap_z_p , extrap_z_2 )
2233 extrap_z = extrap_z_p
2235 IF ( extrap_z_mach .GT.
zn )
THEN 2237 extrap_z = min( extrap_z_p , extrap_z_mach )
2248 IF ( ( extrap_z_mach - zeta ) * ( 1.d0 - mach ) .LT. eps_extrap )
THEN 2250 IF ( extrap_z_mach .LT.
zn )
THEN 2252 extrap_z = extrap_z_mach
2261 coeff_p_1 = (
p1_in - r_p_1 ) / (
p1_in - p_out_1 )
2263 IF ( ( extrap_z_1 - zeta ) * ( 1.d0 - coeff_p_1 ) .LT. eps_extrap )
THEN 2265 IF ( extrap_z_1 .LT.
zn )
THEN 2267 extrap_z = extrap_z_1
2276 coeff_p_2 = ( r_p_2 -
p2_in ) / ( p_out_2 -
p2_in )
2278 IF ( ( extrap_z_2 - zeta ) * ( 1.d0 - coeff_p_2 ) .LT. eps_extrap )
THEN 2280 IF ( extrap_z_2 .LT.
zn )
THEN 2282 extrap_z = extrap_z_2
real *8, dimension(:), allocatable x_ex_dis_in
complex *16 u_1
melt-crystals phase local velocity
logical isothermal
Flag for isothermal runs: .
integer idx_p2
Index of p2 in the qp array.
complex *16 s_1
local specific entropy of the melt-crystals phase
integer idx_ex_gas_eqn_last
complex *16, dimension(:), allocatable rho_g
exsolved gas local density
complex *16, dimension(:), allocatable rho_c
crystals local density
real *8, parameter alfa_impl
Parameter for numerical scheme: .
complex *16 mu_2
free Gibbs energy of the exsolved gas
integer idx_u2
Index of u2 in the qp array.
complex *16 rho_m
melt local density
integer n_gas
Numbeer of crystal phases.
real *8 eps_conv
Residual for the convergence of the shooting method. The solution is accepted if one of these conditi...
real *8, parameter tol_abs
logical explosive
Flag to choose the eruptive style: .
complex *16 e_m
local specific internal energy of the melt
logical shooting
Flag for the shooting technique: .
subroutine steady_shooting
Shooting Method.
complex *16 alfa_2
total exsolved gas local volume fraction
complex *16 u_2
exsolved gas local velocity
integer idx_ex_gas_eqn_first
subroutine f_alfa3(r_p_2, xtot, r_beta, r_rho_md, r_rho_g, r_alfa_g)
Bottom exsolved gas.
complex *16 rho_mix
mixture local density
real *8 p_out
Outlet pressure.
integer comp_cells
Number of control volumes in the computational domain.
subroutine eval_fluxes_qp(c_qp, r_qp, c_flux, r_flux)
Fluxes.
complex *16, dimension(:), allocatable e_g
local specific internal energy of the exsolved gas
subroutine integrate_equations(qp, flag_output, extrap_z, extrap_z_p, extrap_z_mach, extrap_flag, r_p_1, r_p_2, mach)
Steady state integration.
real *8 frag_thr
Threshold for the fragmentation.
subroutine update_radius(zeta)
real *8, dimension(:), allocatable fluxes_old
logical lateral_degassing
Flag for lateral degassing: .
subroutine eval_nonhyperbolic_terms_qp(c_qp, c_nh_term_impl, r_qp, r_nh_term_impl)
Non-Hyperbolic terms.
complex *16 p_2
local pressure of the exsolved gas
subroutine eval_f(qp_rel, qp_org, dz, coeff_f, right_term, scal_f)
Nonlinear function evaluation.
complex *16 e_2
local specific internal energy of the exsolved gas
integer idx_alfa_first
First index of alfa in the qp array.
subroutine steady_lnsrch(x_rel_init, x_org, scal_f_old, grad_f, desc_dir, dz, coeff_f, x_rel_new, scal_f, f_nl, stpmax, check, callf)
Search the descent stepsize.
logical lateral_degassing_flag
Input flag for lateral degassing: .
complex *16, dimension(:), allocatable s_g
local specific entropy of the exsolved gas
real *8, parameter tol_rel
complex *16 rho_2
exsolved gas local density
real *8 z0
Left (bottom) of the physical domain.
integer, parameter max_nl_iter
Maximum iterations of the Newthon-Raphson solver.
subroutine f_alfa(xtot, xmax, r_beta, r_rho_md, r_rho_2, r_alfa_2)
Bottom exsolved gas.
subroutine sound_speeds(C_mix, mach)
Local sound speeds.
subroutine perturbe_qp(qp)
Solution preturbation.
complex *16 mu_m
free Gibbs energy of the melt
complex *16 u_mix
mixture velocity
complex *16 s_2
local specific entropy of the exsolved gas
integer idx_alfa_last
Last index of alfa in the qp array.
real *8 radius
Effective radius.
subroutine eval_jacobian(qp_rel, qp_org, dz, coeff_f, left_matrix)
Jacobian evaluation.
complex *16 s_m
local specific entropy of the melt
real *8 zeta_lith
Elevation above the bottom for the evaluation of the lithostatic pressure.
integer idx_beta_first
First index of beta in the qp array.
complex *16, dimension(:), allocatable s_c
local specific entropy of the crystals
real *8 zeta_exit
Right (top) of the physical domain.
subroutine linear_extrapolation(zeta_old, qp_old, zeta, qp, extrap_z, extrap_z_p, extrap_z_mach, extrap_flag)
Linear extrapolation of the solution.
real *8 u1_in
Inlet first phase velocity.
real *8 frag_eff
index of fragmentation in the interval [0;1]
integer idx_dis_gas_eqn_first
real *8, dimension(:), allocatable nh_terms_old
real *8, dimension(:), allocatable z_comp
Location of the centers of the control volume of the domain.
integer idx_xd_first
First index of xd in the qp array.
integer idx_p1
Index of p1 in the qp array.
real *8 zn
Right (top) of the physical domain.
integer idx_u1
Index of u1 in the qp array.
integer idx_cry_eqn_first
integer idx_beta_last
Last index of beta in the qp array.
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
real *8 p1_in
Inlet first phase pressure.
integer idx_dis_gas_eqn_last
complex *16 rho_1
dis_gas+melt+crystals phase local density
Steady state equations integration.
integer n_vars
Number of conservative variables.
real *8 p2_in
Inlet second phase pressure.
real *8 alfa2_lat_thr
Exsolved gas volume fraction threshold for lateral degassing.
subroutine advance_dz(qp, dz, check_convergence)
Solution advance in space.
complex *16 mu_1
free Gibbs energy of the melt-crystals phase
complex *16 p_1
local pressure of the melt-crystals phase
subroutine output_steady(zeta, qp, radius)
Write the steady solution on the output unit.
subroutine eval_densities
Phases densities.
complex *16 t
mixture local temperature
subroutine phys_var_qp(r_qp, c_qp)
Physical variables.
complex *16, dimension(:), allocatable x_d_md
dissolved gas mass fraction in the melt+dis.gas phase
subroutine eos
Equation of state.
complex *16, dimension(:), allocatable mu_g
free Gibbs energy of the exsolved gas
integer idx_t
Index of T in the qp array.
logical increase_flow_rate
integer idx_xd_last
Last index of xd in the qp array.
complex *16, dimension(:), allocatable mu_c
free Gibbs energy of the crystals
subroutine init_steady(u_0, qp)
Steady problem initialization.
integer n_eqns
Number of equations.