6 PUBLIC :: converged, restore_converged, switch, init_vars, si_dens, select_sum_rel, &
7 determine_flash_it, determine_flash_it2, new_flash, x_summation, flash_alpha, &
8 flash_sum, neutr_charge, molefrac, file_open, p_calc, dens_calc, enthalpy_etc, &
9 critical, pure_crit_point_iteration, fden_calc, only_one_term_eos_numerical, &
10 restore_previous_eos_numerical, paus, error_message
38 val_conv(0) = dense(3)
39 val_conv(1) = dense(1)
40 val_conv(2) = dense(2)
45 val_conv(4+i+(ph-1)*ncomp) = lnx(ph,i)
49 end subroutine converged
79 densta(3) = val_init(0)
80 densta(1) = val_init(1)
81 densta(2) = val_init(2)
86 lnx(ph,i) = val_init(4+i+(ph-1)*ncomp)
90 end subroutine init_vars
105 real :: savval(nc*np+6)
108 savval(1) = val_init(1)
109 savval(2) = val_init(2)
110 val_init(1) = savval(2)
111 val_init(2) = savval(1)
113 savval(i) = val_init(4+i)
114 val_init(4+i) = val_init(4+i+ncomp)
117 val_init(4+i+ncomp) = savval(i)
120 end subroutine switch
126 subroutine restore_converged
133 dense(3) = val_conv(0)
134 dense(1) = val_conv(1)
135 dense(2) = val_conv(2)
140 lnx(ph,i) = val_conv(4+i+(ph-1)*ncomp)
142 if ( lnx(ph,i) > -300.0 ) xi(ph,i) = exp( lnx(ph,i) )
146 end subroutine restore_converged
158 subroutine si_dens (density,w)
164 real,
INTENT(OUT) :: density(np)
165 real,
INTENT(OUT) :: w(np,nc)
169 real :: mm_mean, rho, z3t
170 real :: dhs(nc), d00(nc), t_p, pcon, l_st
176 dhs(i) = parame(i,2) * ( 1.0 - 0.12 *exp( -3.0*parame(i,3)/t ) )
177 ELSE IF (eos == 0)
THEN 178 d00(i) = ( 1.e30/1.e6*tau*parame(i,2)*6.0/pi/nav )**(1.0/3.0)
179 dhs(i) = d00(i) * ( 1.0 - 0.12 *exp( -3.0*parame(i,3)/t ) )
180 ELSE IF (eos == 4)
THEN 181 dhs(i) = ( 0.1617/0.3107 / ( 0.689+0.311*(t/parame(i,3)/1.328)**0.3674 ) &
182 / ( pi/6.0 ) )**(1.0/3.0) * parame(i,2)
183 ELSE IF (eos == 5.OR.eos == 6)
THEN 185 IF (ncomp /= 1)
write (*,*)
' ERROR for EOS = 5' 186 t_p =((34.037352+17.733741*l_st) /(1.0+0.53237307*l_st+12.860239*l_st**2 ))**0.5
187 IF (l_st == 0.0) t_p = t_p/4.0
188 IF (eos == 5 .AND. l_st /= 0.0) t_p = t_p/4.0*parame(1,1)**2
189 t_p = t/parame(i,3)/t_p
190 pcon =0.5256+3.2088804*l_st**2 -3.1499114*l_st**2.5 +0.43049357*l_st**4
191 dhs(i) = ( pcon/(0.67793+0.32207*(t_p)**0.3674) /(pi/6.0) )**(1.0/3.0) *parame(i,2)
192 ELSE IF (eos == 8)
THEN 193 dhs(i) = parame(i,2)*(1.0+0.2977*t/parame(i,3)) &
194 /(1.0+0.33163*t/parame(i,3) +1.0477e-3*(t/parame(i,3))**2 )
196 write (*,*)
'define EOS in subroutine: SI_DENS' 205 mm_mean = mm_mean + xi(ph,i)*mm(i)
206 z3t = z3t + xi(ph,i) * parame(i,1) * dhs(i)**3
210 density(ph) = rho * mm_mean * 1.e27 /nav
212 w(ph,i) = xi(ph,i) * mm(i)/mm_mean
217 end subroutine si_dens
243 subroutine select_sum_rel ( ph, excl, startindex )
248 integer,
INTENT(IN) :: ph
249 integer,
INTENT(IN) :: excl
250 integer,
INTENT(IN) :: startindex
253 integer :: sum_index = 0
261 IF ( xi(ph,i) > xmax(ph) )
THEN 265 IF (ph == 1 .AND. i == 1) sum_rel(1) =
'x11' 266 IF (ph == 1 .AND. i == 2) sum_rel(1) =
'x12' 267 IF (ph == 1 .AND. i == 3) sum_rel(1) =
'x13' 268 IF (ph == 1 .AND. i == 4) sum_rel(1) =
'x14' 269 IF (ph == 1 .AND. i == 5) sum_rel(1) =
'x15' 271 IF (ph == 2 .AND. i == 1) sum_rel(2) =
'x21' 272 IF (ph == 2 .AND. i == 2) sum_rel(2) =
'x22' 273 IF (ph == 2 .AND. i == 3) sum_rel(2) =
'x23' 274 IF (ph == 2 .AND. i == 4) sum_rel(2) =
'x24' 275 IF (ph == 2 .AND. i == 5) sum_rel(2) =
'x25' 277 IF (ph == 3 .AND. i == 1) sum_rel(3) =
'x31' 278 IF (ph == 3 .AND. i == 2) sum_rel(3) =
'x32' 279 IF (ph == 3 .AND. i == 3) sum_rel(3) =
'x33' 280 IF (ph == 3 .AND. i == 4) sum_rel(3) =
'x34' 281 IF (ph == 3 .AND. i == 5) sum_rel(3) =
'x35' 290 IF ( i /= sum_index .AND. i /= excl )
THEN 291 IF (ph == 1 .AND. i == 1) it(startindex+j) =
'x11' 292 IF (ph == 1 .AND. i == 2) it(startindex+j) =
'x12' 293 IF (ph == 1 .AND. i == 3) it(startindex+j) =
'x13' 294 IF (ph == 1 .AND. i == 4) it(startindex+j) =
'x14' 295 IF (ph == 1 .AND. i == 5) it(startindex+j) =
'x15' 297 IF (ph == 2 .AND. i == 1) it(startindex+j) =
'x21' 298 IF (ph == 2 .AND. i == 2) it(startindex+j) =
'x22' 299 IF (ph == 2 .AND. i == 3) it(startindex+j) =
'x23' 300 IF (ph == 2 .AND. i == 4) it(startindex+j) =
'x24' 301 IF (ph == 2 .AND. i == 5) it(startindex+j) =
'x25' 303 IF (ph == 3 .AND. i == 1) it(startindex+j) =
'x31' 304 IF (ph == 3 .AND. i == 2) it(startindex+j) =
'x32' 305 IF (ph == 3 .AND. i == 3) it(startindex+j) =
'x33' 306 IF (ph == 3 .AND. i == 4) it(startindex+j) =
'x34' 307 IF (ph == 3 .AND. i == 5) it(startindex+j) =
'x35' 314 end subroutine select_sum_rel
321 subroutine determine_flash_it
327 integer :: min_index = 0
328 integer :: max_index = 0
330 integer :: phase_from_flash
331 real :: d_xmax, xmin, xmax
334 write (*,*)
'entering determine_flash_it, press return' 337 IF (nphas /= 2)
WRITE (*,*)
'DETERMINE_FLASH_IT: only 2 phases!' 338 IF (nphas /= 2) stop 2
346 IF ( abs( xi(1,i)-xi(2,i) ) > d_xmax )
THEN 347 d_xmax = abs( xi(1,i)-xi(2,i) )
356 IF ( minval( lnx(1,1:ncomp) ) < minval( lnx(2,1:ncomp) ) )
THEN 359 IF (max_index == 1) sum_rel(2) =
'fl1' 360 IF (max_index == 2) sum_rel(2) =
'fl2' 361 IF (max_index == 3) sum_rel(2) =
'fl3' 362 IF (max_index == 4) sum_rel(2) =
'fl4' 363 IF (max_index == 5) sum_rel(2) =
'fl5' 364 IF (max_index == 6) sum_rel(2) =
'fl6' 365 IF (max_index > 6)
WRITE (*,*)
'DETERMINE_FLASH_IT:extend list!' 368 IF (max_index == 1) sum_rel(1) =
'fl1' 369 IF (max_index == 2) sum_rel(1) =
'fl2' 370 IF (max_index == 3) sum_rel(1) =
'fl3' 371 IF (max_index == 4) sum_rel(1) =
'fl4' 372 IF (max_index == 5) sum_rel(1) =
'fl5' 373 IF (max_index == 6) sum_rel(1) =
'fl6' 374 IF (max_index > 6)
WRITE (*,*)
'DETERMINE_FLASH_IT:extend list!' 379 IF (ph == phase_from_flash)
THEN 386 IF ( xi(ph,i) < xmin )
THEN 391 IF (phase_from_flash == 1) it(1) =
'x1' 392 IF (phase_from_flash == 2) it(1) =
'x2' 393 IF (min_index == 1) it(1) = trim(it(1))//
'1' 394 IF (min_index == 2) it(1) = trim(it(1))//
'2' 395 IF (min_index == 3) it(1) = trim(it(1))//
'3' 396 IF (min_index == 4) it(1) = trim(it(1))//
'4' 397 IF (min_index == 5) it(1) = trim(it(1))//
'5' 398 IF (min_index == 6) it(1) = trim(it(1))//
'6' 407 IF (xi(ph,i) > xmax)
THEN 412 IF (phase_from_flash == 1) phase = 2
413 IF (phase_from_flash == 1) sum_rel(2) =
'x2' 414 IF (phase_from_flash == 2) phase = 1
415 IF (phase_from_flash == 2) sum_rel(1) =
'x1' 417 IF (max_index == 1) sum_rel(phase) = trim(sum_rel(phase))//
'1' 418 IF (max_index == 2) sum_rel(phase) = trim(sum_rel(phase))//
'2' 419 IF (max_index == 3) sum_rel(phase) = trim(sum_rel(phase))//
'3' 420 IF (max_index == 4) sum_rel(phase) = trim(sum_rel(phase))//
'4' 421 IF (max_index == 5) sum_rel(phase) = trim(sum_rel(phase))//
'5' 422 IF (max_index == 6) sum_rel(phase) = trim(sum_rel(phase))//
'6' 426 IF ( i /= max_index )
THEN 427 IF (phase == 1) it(2+j) =
'x1' 428 IF (phase == 2) it(2+j) =
'x2' 429 IF (i == 1) it(2+j) = trim(it(2+j))//
'1' 430 IF (i == 2) it(2+j) = trim(it(2+j))//
'2' 431 IF (i == 3) it(2+j) = trim(it(2+j))//
'3' 432 IF (i == 4) it(2+j) = trim(it(2+j))//
'4' 433 IF (i == 5) it(2+j) = trim(it(2+j))//
'5' 434 IF (i == 6) it(2+j) = trim(it(2+j))//
'6' 442 end subroutine determine_flash_it
450 subroutine determine_flash_it2
456 real :: n_phase1, n_phase2, max_x_diff
461 IF ( minval( lnx(1,1:ncomp) ) < minval( lnx(2,1:ncomp) ) )
THEN 464 IF (ncomp >= 3) it(3) =
'x13' 465 IF (ncomp >= 4) it(4) =
'x14' 466 IF (ncomp >= 5) it(5) =
'x15' 471 IF (ncomp >= 3) it(3) =
'x23' 472 IF (ncomp >= 4) it(4) =
'x24' 473 IF (ncomp >= 5) it(5) =
'x25' 478 IF ( abs( exp( lnx(1,i) ) - exp( lnx(2,i) ) ) > max_x_diff )
THEN 479 max_x_diff = abs( exp( lnx(1,i) ) - exp( lnx(2,i) ) )
480 n_phase1 = ( xif(i) - exp( lnx(2,i) ) ) / ( exp( lnx(1,i) ) - exp( lnx(2,i) ) )
481 n_phase2 = 1.0 - n_phase1
484 if ( n_phase1 < 1.e-12 ) n_phase1 = 1.e-12
485 if ( n_phase1 > ( 1.0 - 1.e-12 ) ) n_phase1 = 1.0 - 1.e-12
486 n_phase2 = 1.0 - n_phase1
487 lnx(1,1:ncomp) = lnx(1,1:ncomp) + log( n_phase1 )
488 lnx(2,1:ncomp) = lnx(2,1:ncomp) + log( n_phase2 )
490 val_init(1) = dense(1)
491 val_init(2) = dense(2)
496 val_init(4+k+(ph-1)*ncomp) = lnx(ph,k)
501 end subroutine determine_flash_it2
509 subroutine new_flash (ph_it)
514 integer,
INTENT(IN) :: ph_it
518 real,
DIMENSION(nc) :: ni_1, ni_2
524 IF ( lnx(ph_it,i) < -300.0 )
THEN 527 ni_2(i) = exp( lnx(ph_it,i) )
532 ni_1(i) = xif(i)-ni_2(i)
533 IF ( ni_2(i) > xif(i) .OR. sum( ni_1(1:ncomp)) <= 0.0 )
THEN 535 ni_1(i) = xif(i) * 1.e-20
546 xi(ph_it,1:ncomp) = ni_2(1:ncomp) / sum( ni_2(1:ncomp) )
548 IF ( xi(ph_it,i) >= 1.e-300 ) lnx(ph_it,i) = log( xi(ph_it,i) )
549 IF ( xi(ph_it,i) < 1.e-300 ) lnx(ph_it,i) = 1.e-300
551 xi(ph_cal,1:ncomp) = ni_1(1:ncomp) / sum( ni_1(1:ncomp) )
553 IF ( xi(ph_cal,i) >= 1.e-300 ) lnx(ph_cal,i) = log( xi(ph_cal,i) )
554 IF ( xi(ph_cal,i) < 1.e-300 ) lnx(ph_cal,i) = 1.e-300
557 end subroutine new_flash
576 subroutine x_summation
581 integer :: i, j, comp_i, ph_i
583 character (LEN=2) :: phasno
584 character (LEN=2) :: compno
585 logical :: flashcase2
589 IF (sum_rel(j)(1:3) ==
'nfl')
THEN 601 IF (sum_rel(j)(1:1) ==
'x')
THEN 603 phasno = sum_rel(j)(2:2)
605 compno = sum_rel(j)(3:3)
606 READ (compno,*) comp_i
607 IF ( sum_rel(nphas+j)(1:1) ==
'e' )
CALL neutr_charge(nphas+j)
611 IF ( i /= comp_i ) sum_x = sum_x + xi(ph_i,i)
613 xi(ph_i,comp_i) = 1.0 - sum_x
614 IF ( xi(ph_i,comp_i ) < 0.0 ) xi(ph_i,comp_i) = 0.0
615 IF ( xi(ph_i,comp_i ) /= 0.0 )
THEN 616 lnx(ph_i,comp_i) = log( xi(ph_i,comp_i) )
618 lnx(ph_i,comp_i) = -100000.0
622 ELSE IF ( sum_rel(j)(1:2) ==
'fl' )
THEN 638 WRITE (*,*)
'summation relation not defined' 644 IF ( it(1) ==
'fls' )
CALL flash_sum
645 IF ( flashcase2 )
CALL flash_alpha
647 end subroutine x_summation
663 subroutine flash_alpha
668 integer :: i, j, comp_i, phase1, phase2
669 character (LEN=2) :: compno
679 IF ( sum_rel(j)(1:2) ==
'fl' )
THEN 680 compno = sum_rel(j)(3:3)
681 READ (compno,*) comp_i
682 IF ( (xi(1,comp_i)-xi(2,comp_i)) /= 0.0 )
THEN 683 alpha = (xif(comp_i)-xi(2,comp_i)) / (xi(1,comp_i)-xi(2,comp_i))
684 write (*,*)
'flsh',(xif(comp_i)-xi(2,comp_i)),(xi(1,comp_i)-xi(2,comp_i))
687 WRITE (*,*)
'FLASH_ALPHA:error in calc. of phase fraction',comp_i
690 IF (alpha > 1.0) alpha = 1.0
691 IF (alpha < 0.0) alpha = 0.0
701 IF ( it(i)(2:2) ==
'1' ) phase1 = phase1 + 1
702 IF ( it(i)(2:2) ==
'2' ) phase2 = phase2 + 1
705 IF ( sum_rel(i)(2:2) ==
'1' ) phase1 = phase1 + 1
706 IF ( sum_rel(i)(2:2) ==
'2' ) phase2 = phase2 + 1
710 IF ( phase1 == ncomp )
THEN 715 IF ( alpha == 1.0 ) alpha = 1.0 - 1.0e-10
717 xi(2,i) = ( xif(i) - alpha*xi(1,i) ) / (1.0-alpha)
718 IF ( xi(2,i) < 0.0 ) xi(2,i) = 0.0
719 IF ( xi(2,i) > 1.0 ) xi(2,i) = 1.0
720 IF ( xi(2,i) /= 0.0 )
THEN 721 lnx(2,i) = log( xi(2,i) )
725 write (*,*)
'fl_cal ph=2',i,lnx(2,i),xi(2,i)
727 ELSE IF ( phase2 == ncomp )
THEN 733 xi(1,i) = ( xif(i) - (1.0-alpha)*xi(2,i) ) /alpha
734 IF ( xi(1,i) < 0.0 ) xi(1,i) = 0.0
735 IF ( xi(1,i) > 1.0 ) xi(1,i) = 1.0
736 IF ( xi(1,i) /= 0.0 )
THEN 737 lnx(1,i) = log( xi(1,i) )
741 write (*,*)
'fl_cal ph=1',i,lnx(1,i),xi(1,i),alpha
744 WRITE (*,*)
' FLASH_ALPHA: undefined flash-case' 748 end subroutine flash_alpha
760 integer :: i, j, ph_i, phase1, phase2
766 IF (it(j)(2:2) ==
'1') phase1=phase1+1
767 IF (it(j)(2:2) ==
'2') phase2=phase2+1
770 IF (phase1 == ncomp-1)
THEN 772 ELSE IF (phase2 == ncomp-1)
THEN 775 WRITE (*,*)
' FLASH_SUM: undefined flash-case' 783 IF (alpha > dmin1(1.0,xif(i)/xi(1,i), &
784 (xif(i)-1.0)/(xi(1,i)-1.0),alpha))
THEN 785 WRITE (*,*)
' FLASH_SUM: exeeded 1st alpha-bound' 786 alpha=dmin1(1.0,xif(i)/xi(1,i),(xif(i)-1.0)/(xi(1,i)-1.0))
790 xi(2,i) = ( xif(i) - alpha*xi(1,i) ) / (1.0-alpha)
791 IF (xi(2,i) > 0.0)
THEN 792 lnx(2,i) = log(xi(2,i))
798 ELSE IF (ph_i == 2)
THEN 800 IF (alpha > dmax1(0.0,(xif(i)-xi(2,i))/(1.0-xi(2,i)), &
801 1.0-xif(i)/xi(2,i),alpha))
THEN 802 WRITE (*,*)
' FLASH_SUM: exeeded 2nd alpha-bound' 803 WRITE (*,*) 0.0,(xif(i)-xi(2,i))/(1.0-xi(2,i)), 1.0-xif(i)/xi(2,i)
804 alpha=dmax1(0.0,(xif(i)-xi(2,i))/(1.0-xi(2,i)), 1.0-xif(i)/xi(2,i))
808 xi(1,i) = ( xif(i) - (1.0-alpha)*xi(2,i) ) / alpha
810 IF (xi(1,i) > 0.0)
THEN 811 lnx(1,i) = log(xi(1,i))
819 end subroutine flash_sum
831 subroutine neutr_charge(i)
836 integer,
INTENT(IN) :: i
839 integer :: comp_e, ph_e
841 character (LEN=2) :: phasno
842 character (LEN=2) :: compno
845 phasno = sum_rel(i)(2:2)
847 compno = sum_rel(i)(3:3)
848 READ (compno,*) comp_e
851 write (*,*)
'there must be an error in neutr_charge' 863 xi(ph_e,comp_e) = - sum_c
864 IF (xi(ph_e,comp_e) < 0.0) xi(ph_e,comp_e)=0.0
865 IF (xi(ph_e,comp_e) /= 0.0)
THEN 866 lnx(ph_e,comp_e) = log(xi(ph_e,comp_e))
868 lnx(ph_e,comp_e) = -100000.0
874 end subroutine neutr_charge
886 subroutine molefrac ( w, phas1, phas2 )
891 real,
INTENT(IN) :: w(np,nc)
892 integer,
INTENT(IN) :: phas1
893 integer,
INTENT(IN) :: phas2
902 IF ((ph == 1.AND.phas1 == 1).OR.(ph == 2.AND.phas2 == 1))
THEN 905 mm_denom = mm_denom + w(ph,i)/mm(i)
907 IF (mm_denom > 0.0)
THEN 909 xi(ph,i)=w(ph,i)/mm(i)/mm_denom
915 end subroutine molefrac
926 subroutine file_open(filename,file_number)
929 character (LEN=*) :: filename
930 integer :: file_number
934 INQUIRE (file=filename, exist = filefound)
936 OPEN (file_number, file = filename)
938 write (*,*)
' Solubility Code: FOLLOWING FILE CAN NOT BE OPENED', filename
942 end subroutine file_open
955 subroutine p_calc (pges_transfer, zges)
961 real,
INTENT(IN OUT) :: pges_transfer
962 real,
INTENT(OUT) :: zges
965 IF (nphas /= 1 )
THEN 966 write (*,*)
'P_CALC: can only be called for single phases' 974 x(1:ncomp) = xi(1,1:ncomp)
976 CALL perturbation_parameter
981 zges = (pges * 1.e-30) / ( kbol * t * rho )
984 write (*,*)
' subroutine P_CALC not available for cubic EOS' 988 end subroutine p_calc
999 subroutine dens_calc ( rho_phas )
1005 real,
INTENT(OUT) :: rho_phas(np)
1017 eta_start = densta(ph)
1018 x(1:ncomp) = xi(ph,1:ncomp)
1020 CALL perturbation_parameter
1021 CALL density_iteration
1024 rho_phas(ph) = eta/z3t
1027 write (*,*)
' subroutine DENS_CALC not available for cubic EOS' 1033 end subroutine dens_calc
1047 subroutine enthalpy_etc
1055 IF ( eos <= 1 )
THEN 1062 x(1:ncomp) = xi(ph,1:ncomp)
1064 CALL h_eos_interface
1069 speed_of_sound(ph) = speed_sound
1072 IF (nphas == 2) h_lv = enthal(2)-enthal(1)
1076 end subroutine enthalpy_etc
1086 subroutine critical ( tc, pc, rhoc )
1092 real,
INTENT(IN OUT) :: tc
1093 real,
INTENT(IN OUT) :: pc
1094 real,
INTENT(OUT) :: rhoc
1098 real :: density(np), w(np,nc)
1106 IF (eos < 2.AND.ncomp == 1)
THEN 1113 x(1:ncomp) = xi(nphas,1:ncomp)
1115 CALL perturbation_parameter
1116 CALL pure_crit_point_iteration
1118 CALL si_dens (density,w)
1124 write (*,*)
' PURE_CRIT_POINT_ITERATION not available for cubic EOS' 1125 write (*,*)
' and not for mixtures' 1131 end subroutine critical
1142 subroutine pure_crit_point_iteration
1148 integer :: count, count_t, max_eta_count
1149 real :: tdelt, pdz1, pdz2, t_tol, eta_tol, zc, r_damp, t_damp, eta_l1
1153 IF (num == 2) r_damp = 0.15
1158 IF (num == 1) eta_tol = 2.0
1159 IF (num == 2) eta_tol = 0.5
1164 pgesdz = t_tol + 1.0
1166 DO WHILE (abs(pgesdz) > t_tol .AND. count_t < 30)
1169 count_t =count_t + 1
1171 pgesd2 = eta_tol + 1.0
1173 DO WHILE ( abs(pgesd2) > eta_tol .AND. count < max_eta_count )
1175 CALL perturbation_parameter
1176 CALL p_eos_interface
1177 eta = eta - r_damp*pgesd2/pgesd3
1178 IF (eta < 0.0) eta=0.001
1179 IF (eta > 0.7) eta=0.5
1189 pgesd2 = eta_tol + 1.0
1191 DO WHILE ( abs(pgesd2) > eta_tol .AND. count < max_eta_count )
1193 CALL perturbation_parameter
1194 CALL p_eos_interface
1195 eta = eta - r_damp*pgesd2/pgesd3
1196 IF (eta < 0.0) eta = 0.001
1197 IF (eta > 0.7) eta = 0.5
1201 IF ( abs(pdz2 / ( (pdz2-pdz1)/tdelt ))/t >= 0.05 ) t_damp = 0.5
1202 t = t - t_damp * pdz2 / ( (pdz2-pdz1)/tdelt )
1204 IF (.NOT.( t > 0.0 )) t = 300.0
1208 IF (abs(pgesdz) > t_tol)
write (*,*)
'PURE_CRIT_POINT_ITERATION: T-iteration not converged' 1209 IF (abs(pgesd2) > eta_tol)
write (*,*)
'PURE_CRIT_POINT: density-iteration not converged',pgesd2
1213 zc = (p * 1.e-30)/(kbol*t*rho)
1215 end subroutine pure_crit_point_iteration
1222 subroutine fden_calc (fden, rhoi)
1228 real,
INTENT(OUT) :: fden
1229 real,
INTENT(IN OUT) :: rhoi(nc)
1231 real :: rhot, fden_id
1237 rhot = sum( rhoi(1:ncomp) )
1238 x(1:ncomp) = rhoi(1:ncomp) / rhot
1240 CALL perturbation_parameter
1244 call f_eos_interface
1246 fden_id = sum( rhoi(1:ncomp) * ( log( rhoi(1:ncomp) ) - 1.0 ) )
1248 fden = fres * rhot + fden_id
1251 write (*,*)
' subroutine FDEN_CALC not available for cubic EOS' 1255 end subroutine fden_calc
1262 subroutine only_one_term_eos_numerical ( only_term, type_of_term )
1266 character (LEN=9) :: only_term, type_of_term
1269 save_eos_terms(1) = ideal_gas
1270 save_eos_terms(2) = hard_sphere
1271 save_eos_terms(3) = chain_term
1272 save_eos_terms(4) = disp_term
1273 save_eos_terms(5) = hb_term
1274 save_eos_terms(6) = lc_term
1275 save_eos_terms(7) = branch_term
1276 save_eos_terms(8) = ii_term
1277 save_eos_terms(9) = id_term
1278 save_eos_terms(10)= dd_term
1279 save_eos_terms(11)= qq_term
1280 save_eos_terms(12)= dq_term
1295 IF ( only_term ==
'ideal_gas' ) ideal_gas = trim( adjustl( type_of_term ) )
1296 IF ( only_term ==
'hard_sphere' ) hard_sphere = trim( adjustl( type_of_term ) )
1297 IF ( only_term ==
'chain_term' ) chain_term = trim( adjustl( type_of_term ) )
1298 IF ( only_term ==
'disp_term' ) disp_term = trim( adjustl( type_of_term ) )
1299 IF ( only_term ==
'hb_term' ) hb_term = trim( adjustl( type_of_term ) )
1300 IF ( only_term ==
'LC_term' ) lc_term = trim( adjustl( type_of_term ) )
1301 IF ( only_term ==
'branch_term' ) branch_term = trim( adjustl( type_of_term ) )
1302 IF ( only_term ==
'II_term' ) ii_term = trim( adjustl( type_of_term ) )
1303 IF ( only_term ==
'ID_term' ) id_term = trim( adjustl( type_of_term ) )
1304 IF ( only_term ==
'dd_term' ) dd_term = trim( adjustl( type_of_term ) )
1305 IF ( only_term ==
'qq_term' ) qq_term = trim( adjustl( type_of_term ) )
1306 IF ( only_term ==
'dq_term' ) dq_term = trim( adjustl( type_of_term ) )
1308 end subroutine only_one_term_eos_numerical
1315 subroutine restore_previous_eos_numerical
1320 ideal_gas = trim( adjustl( save_eos_terms(1) ) )
1321 hard_sphere = trim( adjustl( save_eos_terms(2) ) )
1322 chain_term = trim( adjustl( save_eos_terms(3) ) )
1323 disp_term = trim( adjustl( save_eos_terms(4) ) )
1324 hb_term = trim( adjustl( save_eos_terms(5) ) )
1325 lc_term = trim( adjustl( save_eos_terms(6) ) )
1326 branch_term = trim( adjustl( save_eos_terms(7) ) )
1327 ii_term = trim( adjustl( save_eos_terms(8) ) )
1328 id_term = trim( adjustl( save_eos_terms(9) ) )
1329 dd_term = trim( adjustl( save_eos_terms(10) ) )
1330 qq_term = trim( adjustl( save_eos_terms(11) ) )
1331 dq_term = trim( adjustl( save_eos_terms(12) ) )
1333 end subroutine restore_previous_eos_numerical
1341 subroutine paus ( message_to_screen )
1343 character (LEN=*),
optional,
intent(in) :: message_to_screen
1346 if (
present( message_to_screen ) )
then 1347 write (*,*)
'MESSAGE: ',message_to_screen
1349 write (*,*)
'PAUSE: press any key to continue' 1360 subroutine error_message ( message_to_screen )
1363 character (LEN=*) :: message_to_screen
1365 write (*,*) message_to_screen
1368 end subroutine error_message
1370 end module utilities
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains constant...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...