Successfully reported this slideshow.
Upcoming SlideShare
×

# Inversa lu

1,200 views

Published on

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### Inversa lu

1. 1. PROYECTO CALCULO DE LA DENSIDAD Y EL VOLUMEN MOLAR DE UNA COMPOSICIÓN GASEOSA <ul><li>JUAN CAMILO CORTES COD : 2042097 </li></ul><ul><li>FERNANDO ANDRES FUENTES COD: 2042087 </li></ul><ul><li>NATALIA GRAJALES GARCIA COD: 2061840 </li></ul>
2. 3. program proyecto2 integer ::opcion integer ::FM,CM real ::bm,suma,ac,A,ma,c,d,e,f,Pe,Q,P,T,De,th,Z1,Z2,Z3,u,v,Zr1,Zr2,Zr3,Zi2,Zi3 real ::Zg,Vm,densidad,ui,uo real,allocatable ::M(:,:),R(:,:) real,dimension ( 10 )::ai,bi,mi,alfa,yimi write (*,*)'_____Menu______' write (*,*)' ' write (*,*)'oprima:' write (*,*)' ' write (*,*)'1.Calcula la densidad y Vm' write (*,*)' ' write (*,*)'oprima cualquier numero para salir' read (*,*)opcion
3. 4. do while (opcion==1) open ( unit =10, file ='datos.txt', action ='read') read ( 10 ,*)FM,CM allocate (M(FM,CM),R(FM,CM)) do i=1,FM,1 read ( 10 ,*)M(i, 1 :CM) end do close ( 10 ) suma= 0.0 do i= 1 ,FM, 1 suma =suma+M(i, 1 ) end do Abre el archivo , lee los datos
4. 5. write(*,*)' ' write(*,*)'la suma de las composiciones es =',suma bm=0.0 ma=0.0 if(suma==1)then write(*,*)' ' write(*,*)'Escriba los valores de Presion y Temperatura' write(*,*)' ' write(*,*)'Presion:' read(*,*)P write(*,*)' ' write(*,*)'Temperatura:' read(*,*)T write(*,*)' ‘ do i=1,FM,1 ai(i)=0.45724*((10.737*M(i,3))**2) ai(i)=ai(i)/M(i,4)
5. 6. bi(i)=0.07780*10.737*M(i,3)/M(i,4) mi(i)=0.3746+(1.5423*M(i,5))-(0.2699*(M(i,5)**2)) alfa(i)=(1+(mi(i)*(1-((T/(M(i,3)))**0.5))))**2 bm=bm+(M(i,1)*bi(i)) ma=ma+((M(i,1))*(M(i,2))) yimi(i)=(M(i,1))*(M(i,2)) end do open(unit=20,file='tabla.txt' ,action='write',status='replace') do i=1,FM,1
6. 7. R(i,1)=ai(i) R(i,2)=bi(i) R(i,3)=yimi(i) R(i,4)=mi(i) R(i,5)=alfa(i) end do do i=1,FM,1 write(20,*)(R(i,1:CM)) end do close(20) call calculos(M,ac,ai,alfa,A,P,T,B,bm,FM) c=1.0 d=B-1 e=A-(3*(B**2))-(2*B) f=(A*B)-(B**2)-(B**3) SUBRUTINA
7. 8. Pe=((3*(e/c))-((d/c)**2))/3 Q=((2*((d/c)**3))-(9*(d*e/(c**2)))+(27*f/c))/27 De=((Pe/3)**3)+((Q/2)**2) if(De<0)then write(*,*)'todas las raices son reales' th=(cos(-Q/(2*sqrt(((abs(Pe))**3)/27)))) Z1=(2*sqrt((abs(Pe))/3)*cos(th/3))-(d/(3*c)) Z2=(-2*sqrt((abs(Pe))/3)*cos((th+3.1416)/3))-(d/(3*c)) Z3=(-2*sqrt((abs(Pe))/3)*cos((th-3.1416)/3))-(d/(3*c)) if(Z1>Z2.and.Z1>Z3)then Zg=Z1 else if(Z2>Z3)then Zg=Z2 else Zg=Z3 end if end if else
8. 9. if(De==0)then write(*,*)'Existen solo raices reales dos de ellas son iguales' else write(*,*)' ' write(*,*)'Existen raices reales e imaginarias' u=((abs((-Q/2)+sqrt(De))))**(1.0/3.0) v=((abs((-Q/2)-sqrt(De))))**(1.0/3.0) end if Zr1=(u+v)-(d/(3*c)) Zr2=(-(u+v)/2)-(d/(3*c)) Zr3=(-(u+v)/2)-(d/(3*c)) Zi2=(sqrt(3.0))*(u-v)/2 Zi3=-(sqrt(3.0))*(u-v)/2 if(Zr1>Zr2)then Zg=Zr1 else Zg=Zr2 end if
9. 10. end if densidad=(P*ma)/(Zg*10.737*T) Vm=Zg*10.737*T/P write(*,*)' ' write(*,*)'el valor de Zg es:',Zg write(*,*)' ' write(*,*)'la densidad es:',densidad write(*,*)' ' write(*,*)'el volumen molar del gas es:',vm write(*,*)' ‘ open(unit=30,file='resultados.txt' ,action='write',status='replace') write(30,*)'el Zg es:',Zg,'la densidad es:',densidad,'el Vm es',Vm close(30)
10. 11. else write(*,*)' ' write(*,*)'ERROR:la suma de las composiciones es diferente de uno corrija los datos ' end if write(*,*)'_____Menu______' write(*,*)' ' write(*,*)'oprima:' write(*,*)' ' write(*,*)'1.Calcula la densidad y Vm' write(*,*)' ' write(*,*)'oprima cualquier numero para salir' read(*,*)opcion end do end program proyecto2
11. 12. subroutine calculos(M,ac,ai,alfa,A,P,T,B,bm,FM) integer::FM real,dimension(10,10)::M real,dimension(10)::ai,alfa real::ac,A,P,T,B,bm do i=1,FM,1 do j=1,FM,1 ac=ac+((M(i,1)*M(j,1))*((ai(i)*ai(j)*alfa(i)*alfa(j))**0.5)) A=ac*P/((10.737*T)**2) B=bm*P/(10.737*T) end do end do return end subroutine calculos VOLVER
12. 13. <ul><li>calcular la densidad de una fase gaseosa con la siguiente composicion a 4000 psia y a 160 ºF = 619.67 R : </li></ul>Componente Xi Mi Tc Pc W C1 0.8600 16.04 343.000 667.8 0.0104 C2 0.0500 30.07 549.590 706.5 0.0879 C3 0.0500 44.10 665.730 616.0 0.1522 iC4 0.0200 58.12 734.150 529.1 0.1852 iC5 0.0100 72.15 828.770 488.6 0.2280 iC6 0.0095 86.18 913.270 436.9 0.2994 iC7 0.0005 215.0 1159.67 285.0 0.52