计算化学公社

标题: 求助:Sorption 计算吸附等温线 [打印本页]

作者
Author:
霍亚金    时间: 2021-6-8 10:20
标题: 求助:Sorption 计算吸附等温线
Sorption 计算吸附等温线时,高压下,逸度和压力怎么转换,有没有相关的脚本或者软件

作者
Author:
ABetaCarw    时间: 2021-6-8 11:33
  1. ################################################################################
  2. #!perl                                                                         #
  3. #                                                                              #
  4. # PENG-ROBINSON EQUATION OF STATE                                              #
  5. #                                                                              #
  6. # Author: Reinier Akkermans (Biovia)                                           #
  7. # Version: 1.0                                                                 #
  8. # Tested on: Materials Studio 7.0                                              #
  9. # Required modules: Materials Visualizer                                       #
  10. #                                                                              #
  11. # Description: This script calculates the fugacity and pressure for a range of #
  12. # volume using the Peng-Robinson Equation of state. The data is output in a    #
  13. # study table                                                                  #
  14. #                                                                              #
  15. ################################################################################


  16. use strict;
  17. use Getopt::Long;
  18. use MaterialsScript qw(:all);


  19. use constant
  20. {
  21.     GAS_CONSTANT => 8.314, # J/mol/K
  22.     # constants in the Peng-Robinson EoS
  23.     PR_a => 0.457235,
  24.     PR_b => 0.077796,
  25.     PR_kappa0 => 0.37464,
  26.     PR_kappa1 => 1.54226,
  27.     PR_kappa2 => -0.26992,
  28. };


  29. ################################################################################
  30. #  BEGIN USER INPUT                                                            #
  31. ################################################################################


  32. # example: CO2
  33. my $Tc = 304.25; # temperature at critical point in K
  34. my $Pc = 7380000; # pressure at critical point in Pa
  35. my $omega = 0.228; # acentric factor


  36. my $temperature = 298; # K   
  37. my $volume_start = 0.0004; # m^3/mol
  38. my $volume_end = 0.1; # m^3/mol
  39. my $volume_steps = 100;


  40. ################################################################################
  41. #  END USER  INPUT                                                             #
  42. ################################################################################


  43. my $Tr = $temperature/$Tc;
  44. my $RTc = GAS_CONSTANT*$Tc; # J/mol
  45. my $b = PR_b*$RTc/$Pc; # m^3/mol
  46. my $kappa = PR_kappa0+PR_kappa1*$omega+PR_kappa2*$omega**2;
  47. my $alpha = (1+$kappa*(1-sqrt($Tr)))**2;
  48. my $aTc = PR_a*$RTc**2/$Pc; # Pa*(m^3/mol)^2
  49. my $aT = $aTc*$alpha; # Pa*(m^3/mol)^2
  50. my $RT = GAS_CONSTANT*$temperature;


  51. my $std = Documents->New("PengRobinson.std");
  52. $std->ColumnHeading(0) = "Volume (m^3/mol)";
  53. $std->ColumnHeading(1) = "Pressure (kPa)";
  54. $std->ColumnHeading(2) = "Fugacity (kPa)";
  55. $std->ColumnHeading(3) = "A";
  56. $std->ColumnHeading(4) = "B";
  57. $std->ColumnHeading(5) = "Z";
  58. $std->ColumnHeading(6) = "check";


  59. my $scaleFactor = exp(log($volume_end/$volume_start)/($volume_steps-1));
  60. my $volume = $volume_start;
  61. for(my $i = 0; $i < $volume_steps; $i++)
  62. {
  63.     $volume *= $scaleFactor if $i > 0;
  64.     my $pressure = $RT/($volume-$b)
  65.         -$aT/($volume*($b+$volume)+$b*($volume-$b));
  66.    
  67.     my $A = $aT*$pressure/$RT**2;
  68.     my $B = $b*$pressure/$RT;
  69.     my $Z = $pressure*$volume/$RT;
  70.    
  71.     # sanity check; should evaluate to zero
  72.     my $check = $Z**3+($B-1)*$Z**2+($A-2*$B-3*$B**2)*$Z+$B**3+$B**2-$A*$B;


  73.     my $lnfP = $Z-1
  74.         - log($Z-$B)
  75.         - $A/(sqrt(8)*$B)*log(($Z+(1+sqrt(2))*$B)/($Z-(1-sqrt(2))*$B));
  76.         
  77.     my $fugacity = exp($lnfP)*$pressure;
  78.    
  79.     $std->Cell($i,0) = $volume;
  80.     $std->Cell($i,1) = $pressure/1000;
  81.     $std->Cell($i,2) = $fugacity/1000;
  82.     $std->Cell($i,3) = $A;
  83.     $std->Cell($i,4) = $B;
  84.     $std->Cell($i,5) = $Z;
  85.     $std->Cell($i,6) = $check;
  86. }
复制代码
脚本来自Reinier Akkermans (Biovia)



作者
Author:
霍亚金    时间: 2021-6-8 14:50
本帖最后由 霍亚金 于 2021-6-8 14:56 编辑
ABetaCarw 发表于 2021-6-8 11:33
脚本来自Reinier Akkermans (Biovia)

这个脚本怎么用,是在ms里吗?
作者
Author:
ABetaCarw    时间: 2021-6-8 14:53
本帖最后由 ABetaCarw 于 2021-6-8 14:54 编辑
霍亚金 发表于 2021-6-8 14:50
这个脚本怎么用,是用matlab吗

哎……本想多说两句的,还是不说了。是MS的perl脚本。至于怎么用,你百度或者看手册吧。
作者
Author:
霍亚金    时间: 2021-6-8 15:16
ABetaCarw 发表于 2021-6-8 14:53
哎……本想多说两句的,还是不说了。是MS的perl脚本。至于怎么用,你百度或者看手册吧。

好的,感谢感谢
作者
Author:
霍亚金    时间: 2021-6-8 15:30
ABetaCarw 发表于 2021-6-8 14:53
哎……本想多说两句的,还是不说了。是MS的perl脚本。至于怎么用,你百度或者看手册吧。

老师,您有计算不同温度压力下的气体密度的脚本吗
可以分享一下吗
作者
Author:
ABetaCarw    时间: 2021-6-8 15:43
霍亚金 发表于 2021-6-8 15:30
老师,您有计算不同温度压力下的气体密度的脚本吗
可以分享一下吗

要不还是看看物化书吧……
作者
Author:
霍亚金    时间: 2021-6-17 10:53
ABetaCarw 发表于 2021-6-8 15:43
要不还是看看物化书吧……

老师,我用这个脚本算氢气,怎么逸度系数大于1,这正常吗




欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3