Design og modellering af metanolanlæg til VEnzin-visionen Bilag

Design og modellering af metanolanlæg til VEnzin-visionen Bilag Design og modellering af metanolanlæg til VEnzin-visionen Bilag

27.07.2013 Views

methanol.for d:/DTU/Eksamensprojekt/bilag/ if (fiters) print*,’Below melting curve, T=’,T−T_0C,’ C’, $ ’, P_melt=’,P_melt,’ bar’,’, P=’,P,’ bar’ error=4 endif endif 10 return end subroutine test_saturation(tau,omega,error,P) integer error,IMAX double precision tau,omega,omega_l,omega_g,T,rho,n(13),rho_star $ ,rho_g,rho_l,theta,P,P_vap,EPSV,R,P_c,T_c,T_ref,rho_ref,M $ ,T_0C logical fiters common/constants/EPSV,R,P_c,T_c,T_ref,rho_ref,rho_star,M,T_0C,IMAX $ ,fiters rho=rho_ref*omega T=T_ref/tau if (T.lt.T_c) then call rho_l__rho_g(tau,omega_l,omega_g) rho_l=rho_ref*omega_l rho_g=rho_ref*omega_g if ((rho.lt.rho_l).and.(rho.gt.rho_g)) then call sub_n(n,2) theta=(T_c/T)−1 P_vap=P_c*1.d6*exp((T/T_c)*(n(1)*theta+n(2)*theta**1.5+ $ n(3)*theta**2+n(4)*theta**2.5)) if ((P.gt.P_vap).and.(rho.lt.rho_l*0.99)) then rho=rho_l omega=rho/rho_ref error=2 elseif ((P.lt.P_vap).and.(rho.gt.rho_g)) then rho=rho_g omega=rho/rho_ref error=2 endif endif endif return end subroutine calculate(f,tau,omega,in) integer in double precision f,tau,omega,omega_g,omega_l logical iterate_rho_l common/switches/iterate_rho_l if (in.eq.1) then call calculate_p(f,tau,omega) elseif (in.eq.2) then call calculate_h(f,tau,omega) elseif (in.eq.5) then call calculate_s(f,tau,omega) elseif (in.eq.6) then iterate_rho_l=.true. call calculate_x(f,tau,omega,omega_g,omega_l) elseif (in.eq.7) then call calculate_u(f,tau,omega) endif return end subroutine calculate_P(P,tau,omega) integer IMAX double precision P,Z,tau,omega,T,v,omega_g,omega_l,x,EPSV,R,P_c $ ,T_c,T_ref,rho_ref,rho_star,M,T_0C logical iterate_rho_l common/constants/EPSV,R,P_c,T_c,T_ref,rho_ref,rho_star,M,T_0C,IMAX $ ,fiters common/switches/iterate_rho_l iterate_rho_l=.true. T=T_ref/tau call calculate_x(x,tau,omega,omega_g,omega_l) if (x.gt.0.and.x.lt.1) then v=1/(rho_ref*omega_g) call calculate_Z(Z,tau,omega_g) 11/19 19−03−2007

methanol.for d:/DTU/Eksamensprojekt/bilag/ P=Z*R*T/(v*1.d−6) else v=1/(rho_ref*omega) call calculate_Z(Z,tau,omega) P=Z*R*T/(v*1.d−6) endif return end subroutine calculate_h(h,tau,omega) integer IMAX double precision h,Z,u,tau,omega,T,omega_g,omega_l,h_l,h_g $ ,x,EPSV,R,P_c,T_c,T_ref,rho_ref,rho_star,M,T_0C logical fiters,iterate_rho_l common/constants/EPSV,R,P_c,T_c,T_ref,rho_ref,rho_star,M,T_0C,IMAX $ ,fiters common/switches/iterate_rho_l iterate_rho_l=.false. T=T_ref/tau call calculate_x(x,tau,omega,omega_g,omega_l) if ((x.gt.0).and.(x.lt.1)) then call calculate_Z(Z,tau,omega_l) call calculate_u(u,tau,omega_l) h_l=u+Z*R*T call calculate_Z(Z,tau,omega_g) call calculate_u(u,tau,omega_g) h_g=u+Z*R*T h=(1−x)*h_l+h_g*x else call calculate_Z(Z,tau,omega) call calculate_u(u,tau,omega) h=u+Z*R*T endif return end subroutine calculate_s(s,tau,omega) integer r_i(44),s_i(44),k_i(44),j_i(44),b_i(44),IMAX double precision s,tau,omega,N_i(44),c_i(44),f_i(10),g_i(10),sigma $ ,vv,omega_a,dalpha_dtau_omega,dalpha_id_dtau,alpha,alpha_id $ ,omega_l,omega_g,s_l,s_g,x,EPSV,R,P_c,T_c,T_ref,rho_ref $ ,rho_star,M,T_0C logical fiters,iterate_rho_l common/constants/EPSV,R,P_c,T_c,T_ref,rho_ref,rho_star,M,T_0C,IMAX $ ,fiters common/switches/iterate_rho_l common/constants2/sigma,vv,omega_a iterate_rho_l=.false. call IUPAC_constants(N_i,r_i,s_i,k_i,j_i,b_i,c_i,f_i,g_i) call calculate_x(x,tau,omega,omega_g,omega_l) if ((x.gt.0).and.(x.lt.1)) then call sub_dalpha_id_dtau(dalpha_id_dtau,tau,omega_l,f_i,g_i) call sub_dalpha_dtau_omega(dalpha_dtau_omega,tau,omega_l,N_i $ ,r_i,s_i,k_i,j_i,b_i,c_i,sigma,vv) call sub_alpha(alpha,tau,omega_l,N_i,r_i,s_i,k_i,j_i,b_i,c_i, $ sigma,vv) call sub_alpha_id(alpha_id,tau,omega_l,f_i,g_i) s_l=R*(tau*(dalpha_id_dtau+dalpha_dtau_omega)−alpha−log(omega_l $ /omega_a)−alpha_id) call sub_dalpha_id_dtau(dalpha_id_dtau,tau,omega_g,f_i,g_i) call sub_dalpha_dtau_omega(dalpha_dtau_omega,tau,omega_g,N_i $ ,r_i,s_i,k_i,j_i,b_i,c_i,sigma,vv) call sub_alpha(alpha,tau,omega_g,N_i,r_i,s_i,k_i,j_i,b_i,c_i, $ sigma,vv) call sub_alpha_id(alpha_id,tau,omega_g,f_i,g_i) s_g=R*(tau*(dalpha_id_dtau+dalpha_dtau_omega)−alpha−log(omega_g $ /omega_a)−alpha_id) s=(1−x)*s_l+s_g*x else call sub_dalpha_id_dtau(dalpha_id_dtau,tau,omega,f_i,g_i) call sub_dalpha_dtau_omega(dalpha_dtau_omega,tau,omega,N_i,r_i $ ,s_i,k_i,j_i,b_i,c_i,sigma,vv) call sub_alpha(alpha,tau,omega,N_i,r_i,s_i,k_i,j_i,b_i,c_i, 12/19 19−03−2007

methanol.for<br />

d:/DTU/Eksamensprojekt/bilag/<br />

P=Z*R*T/(v*1.d−6)<br />

else<br />

v=1/(rho_ref*omega)<br />

call calculate_Z(Z,tau,omega)<br />

P=Z*R*T/(v*1.d−6)<br />

endif<br />

return<br />

end<br />

subroutine calculate_h(h,tau,omega)<br />

integer IMAX<br />

double precision h,Z,u,tau,omega,T,omega_g,omega_l,h_l,h_g<br />

$ ,x,EPSV,R,P_c,T_c,T_ref,rho_ref,rho_star,M,T_0C<br />

l<strong>og</strong>ical fiters,iterate_rho_l<br />

common/constants/EPSV,R,P_c,T_c,T_ref,rho_ref,rho_star,M,T_0C,IMAX<br />

$ ,fiters<br />

common/switches/iterate_rho_l<br />

iterate_rho_l=.false.<br />

T=T_ref/tau<br />

call calculate_x(x,tau,omega,omega_g,omega_l)<br />

if ((x.gt.0).and.(x.lt.1)) then<br />

call calculate_Z(Z,tau,omega_l)<br />

call calculate_u(u,tau,omega_l)<br />

h_l=u+Z*R*T<br />

call calculate_Z(Z,tau,omega_g)<br />

call calculate_u(u,tau,omega_g)<br />

h_g=u+Z*R*T<br />

h=(1−x)*h_l+h_g*x<br />

else<br />

call calculate_Z(Z,tau,omega)<br />

call calculate_u(u,tau,omega)<br />

h=u+Z*R*T<br />

endif<br />

return<br />

end<br />

subroutine calculate_s(s,tau,omega)<br />

integer r_i(44),s_i(44),k_i(44),j_i(44),b_i(44),IMAX<br />

double precision s,tau,omega,N_i(44),c_i(44),f_i(10),g_i(10),sigma<br />

$ ,vv,omega_a,dalpha_dtau_omega,dalpha_id_dtau,alpha,alpha_id<br />

$ ,omega_l,omega_g,s_l,s_g,x,EPSV,R,P_c,T_c,T_ref,rho_ref<br />

$ ,rho_star,M,T_0C<br />

l<strong>og</strong>ical fiters,iterate_rho_l<br />

common/constants/EPSV,R,P_c,T_c,T_ref,rho_ref,rho_star,M,T_0C,IMAX<br />

$ ,fiters<br />

common/switches/iterate_rho_l<br />

common/constants2/sigma,vv,omega_a<br />

iterate_rho_l=.false.<br />

call IUPAC_constants(N_i,r_i,s_i,k_i,j_i,b_i,c_i,f_i,g_i)<br />

call calculate_x(x,tau,omega,omega_g,omega_l)<br />

if ((x.gt.0).and.(x.lt.1)) then<br />

call sub_dalpha_id_dtau(dalpha_id_dtau,tau,omega_l,f_i,g_i)<br />

call sub_dalpha_dtau_omega(dalpha_dtau_omega,tau,omega_l,N_i<br />

$ ,r_i,s_i,k_i,j_i,b_i,c_i,sigma,vv)<br />

call sub_alpha(alpha,tau,omega_l,N_i,r_i,s_i,k_i,j_i,b_i,c_i,<br />

$ sigma,vv)<br />

call sub_alpha_id(alpha_id,tau,omega_l,f_i,g_i)<br />

s_l=R*(tau*(dalpha_id_dtau+dalpha_dtau_omega)−alpha−l<strong>og</strong>(omega_l<br />

$ /omega_a)−alpha_id)<br />

call sub_dalpha_id_dtau(dalpha_id_dtau,tau,omega_g,f_i,g_i)<br />

call sub_dalpha_dtau_omega(dalpha_dtau_omega,tau,omega_g,N_i<br />

$ ,r_i,s_i,k_i,j_i,b_i,c_i,sigma,vv)<br />

call sub_alpha(alpha,tau,omega_g,N_i,r_i,s_i,k_i,j_i,b_i,c_i,<br />

$ sigma,vv)<br />

call sub_alpha_id(alpha_id,tau,omega_g,f_i,g_i)<br />

s_g=R*(tau*(dalpha_id_dtau+dalpha_dtau_omega)−alpha−l<strong>og</strong>(omega_g<br />

$ /omega_a)−alpha_id)<br />

s=(1−x)*s_l+s_g*x<br />

else<br />

call sub_dalpha_id_dtau(dalpha_id_dtau,tau,omega,f_i,g_i)<br />

call sub_dalpha_dtau_omega(dalpha_dtau_omega,tau,omega,N_i,r_i<br />

$ ,s_i,k_i,j_i,b_i,c_i,sigma,vv)<br />

call sub_alpha(alpha,tau,omega,N_i,r_i,s_i,k_i,j_i,b_i,c_i,<br />

12/19<br />

19−03−2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!