Fortran Coder

查看: 8824|回复: 5
打印 上一主题 下一主题

[非线性] DNEQNF 算法求解非线性方程组

[复制链接]

59

帖子

2

主题

0

精华

大师

F 币
810 元
贡献
476 点
楼主
发表于 2015-3-20 15:36:26 | 显示全部楼层
Example of using NEQNF subroutine
Example Statement
Consider a binary system of component 1 and 2, with component 1 being the more volatile one. For a given pressure P and a vapor composition y of component 1 the dew point calculation consist in determining the Temperature T and the liquid composition x. Assuming ideal phase equilibrium the Pressure and the liquid composition are given by:

The pressure should be in mmHg and temperature in oK.

----------------------------------------------------------------------------------------------------------------------------
Fortran Program Listing
[Fortran] 纯文本查看 复制代码
 INTEGER N,ITMAX 
 REAL X(3), XG(3), FNORM 
 EXTERNAL FCN 

 N=2 
 ERRREL=1.0e-4 
 ITMAX=100 
 XG(1)=0.5 
 XG(2)=100.0 

 call NEQNF (FCN, ERRREL, N, ITMAX, XG, X, FNORM) 

 WRITE(6,*) 
 WRITE(6,*)'FNORM = ',FNORM 
 WRITE(6,*)'X1 = ',X(1) 
 WRITE(6,*)'X2 = ',X(2) 

 STOP 
 END 


   SUBROUTINE FCN(X,F,N) 
 INTEGER N 
 REAL X(N),F(N) 

 P=3.0*750.6 
 Y=0.6 
 A1=19.6664 
 B1=-4361.55 
 A2=20.1735 
 B2=-5050.5 

 PS1=EXP(A1+B1/(X(2)+273)) 
 PS2=EXP(A2+B2/(X(2)+273)) 

 F(1)=P-X(1)*PS1-(1-X(1))*PS2 
 F(2)=Y*P-X(1)*PS1 

 RETURN 
 END 

C Output 
C FNORM = 5.483037E-04 
C X1 = 2.966535E-01 
C X2 = 114.950700 
C Stop - Program terminated. 
C Press any key to continue 



Example-of-using-NEQNF-subroutine.pdf

24.49 KB, 下载次数: 22

评分

参与人数 1F 币 +8 贡献 +8 收起 理由
fcode + 8 + 8 赞一个!

查看全部评分

您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-5-16 01:57

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表