diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-18 04:51:30 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-18 04:51:30 +0000 |
| commit | 3e888bcb9e61b7f0e952652f82da2472a968e838 (patch) | |
| tree | b91401be4f866d061e2f9385a9628d6d8170f3be /python-pyremot.spec | |
| parent | 6dbe831392c30a3eb642e32356b3dec828b3c665 (diff) | |
automatic import of python-pyremot
Diffstat (limited to 'python-pyremot.spec')
| -rw-r--r-- | python-pyremot.spec | 1806 |
1 files changed, 1806 insertions, 0 deletions
diff --git a/python-pyremot.spec b/python-pyremot.spec new file mode 100644 index 0000000..284ced4 --- /dev/null +++ b/python-pyremot.spec @@ -0,0 +1,1806 @@ +%global _empty_manifest_terminate_build 0 +Name: python-PyREMOT +Version: 1.0.17 +Release: 1 +Summary: Python Reactor Modeling Tools (PyREMOT) +License: MIT +URL: https://pyremot.herokuapp.com/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ca/fb/67ad7824ae88160d1964c94035ffe370b6ae0b7e57d1d36c6262d6bd220b/PyREMOT-1.0.17.tar.gz +BuildArch: noarch + +Requires: python3-numpy +Requires: python3-scipy +Requires: python3-matplotlib + +%description + +# Python Reactor Modeling Tools + + + +Python Reactor Modeling Tools (PyREMOT) is an open-source package which can be used for process simulation, optimization, and parameter estimation. The current version consists of homogenous models for steady-state and dynamic conditions. + + + +You can visit [dashboard](https://pyremot.herokuapp.com/) to build model input and load examples! + + + +## Installation + + + +You can install this package + + + +```bash + + pip install PyREMOT + +``` + + + +## Documentation + + + +The main method is called as: + + + +```python + + from PyREMOT import rmtExe + + + + # model inputs + + # using dashboard to build model inputs + + modelInput = {...} + + + + # run + + res = rmtExe(modelInput) + +``` + + + +Check component list available in the current version: + + + +```python + + from PyREMOT import rmtCom + + + + # display component list + + res = rmtCom() + + print(res) + + + +``` + + + +PyREMOT UI dashboard conatins some panels as: + + + +1- MODEL SELECTION + + + +2- COMPONENTS + + + + H2;CO2;H2O;CO;CH3OH;DME + + + +this code is automaticly converted to python as: + + + +```python + + compList = ["H2","CO2","H2O","CO","CH3OH","DME"] + +``` + + + +3- REACTIONS + + + +define reacions as: + + + + CO2 + 3H2 <=> CH3OH + H2O; + + CO + H2O <=> H2 + CO2; + + 2CH3OH <=> DME + H2O + + + +then: + + + +```python + + reactionSet = { + + "R1":"CO2+3H2<=>CH3OH+H2O", + + "R2":"CO+H2O<=>H2+CO2", + + "R3":"2CH3OH<=>DME+H2O" + + } + +``` + + + +In order to define reaction rate expressions, there are two code sections as + + + +a) define parameters: + + + + "RT": x['R_CONST']*x['T']; + + "K1": 35.45*math.exp(-1.7069e4/x['RT']); + + "K2": 7.3976*math.exp(-2.0436e4/x['RT']); + + "K3": 8.2894e4*math.exp(-5.2940e4/x['RT']); + + "KH2": 0.249*math.exp(3.4394e4/x['RT']); + + "KCO2": 1.02e-7*math.exp(6.74e4/x['RT']); + + "KCO": 7.99e-7*math.exp(5.81e4/x['RT']); + + "Ln_KP1": 4213/x['T'] - 5.752 * math.log(x['T']) - 1.707e-3*x['T'] + 2.682e-6 * (math.pow(x['T'], 2)) - 7.232e-10*(math.pow(x['T'], 3)) + 17.6; + + "KP1": math.exp(x['Ln_KP1']); + + "log_KP2": 2167/x['T'] - 0.5194 * math.log10(x['T']) + 1.037e-3*x['T'] - 2.331e-7 * (math.pow(x['T'], 2)) - 1.2777; + + "KP2": math.pow(10, x['log_KP2']); + + "Ln_KP3": 4019/x['T'] + 3.707 * math.log(x['T']) - 2.783e-3*x['T'] + 3.8e-7 * (math.pow(x['T'], 2)) - 6.56e-4/(math.pow(x['T'], 3)) - 26.64; + + "KP3": math.exp(x['Ln_KP3']); + + "yi_H2": x['MoFri'][0]; + + "yi_CO2": x['MoFri'][1]; + + "yi_H2O": x['MoFri'][2]; + + "yi_CO": x['MoFri'][3]; + + "yi_CH3OH": x['MoFri'][4]; + + "yi_DME": x['MoFri'][5]; + + "PH2": x['P']*(x['yi_H2'])*1e-5; + + "PCO2": x['P']*(x['yi_CO2'])*1e-5; + + "PH2O": x['P']*(x['yi_H2O'])*1e-5; + + "PCO": x['P']*(x['yi_CO'])*1e-5; + + "PCH3OH": x['P']*(x['yi_CH3OH'])*1e-5; + + "PCH3OCH3": x['P']*(x['yi_DME'])*1e-5; + + "ra1": x['PCO2']*x['PH2']; + + "ra2": 1 + (x['KCO2']*x['PCO2']) + (x['KCO']*x['PCO']) + math.sqrt(x['KH2']*x['PH2']); + + "ra3": (1/x['KP1'])*((x['PH2O']*x['PCH3OH'])/(x['PCO2']*(math.pow(x['PH2'], 3)))); + + "ra4": x['PH2O'] - (1/x['KP2'])*((x['PCO2']*x['PH2'])/x['PCO']); + + "ra5": (math.pow(x['PCH3OH'], 2)/x['PH2O'])-(x['PCH3OCH3']/x['KP3']) + + + +then converted: + + + +```python + + varis0 = { + + "RT": lambda x: x['R_CONST']*x['T'], + + "K1": lambda x: 35.45*math.exp(-1.7069e4/x['RT']), + + "K2": lambda x: 7.3976*math.exp(-2.0436e4/x['RT']), + + "K3": lambda x: 8.2894e4*math.exp(-5.2940e4/x['RT']), + + "KH2": lambda x: 0.249*math.exp(3.4394e4/x['RT']), + + "KCO2": lambda x: 1.02e-7*math.exp(6.74e4/x['RT']), + + "KCO": lambda x: 7.99e-7*math.exp(5.81e4/x['RT']), + + "Ln_KP1": lambda x: 4213/x['T'] - 5.752 * math.log(x['T']) - 1.707e-3*x['T'] + 2.682e-6 * (math.pow(x['T'], 2)) - 7.232e-10*(math.pow(x['T'], 3)) + 17.6, + + "KP1": lambda x: math.exp(x['Ln_KP1']), + + "log_KP2": lambda x: 2167/x['T'] - 0.5194 * math.log10(x['T']) + 1.037e-3*x['T'] - 2.331e-7 * (math.pow(x['T'], 2)) - 1.2777, + + "KP2": lambda x: math.pow(10, x['log_KP2']), + + "Ln_KP3": lambda x: 4019/x['T'] + 3.707 * math.log(x['T']) - 2.783e-3*x['T'] + 3.8e-7 * (math.pow(x['T'], 2)) - 6.56e-4/(math.pow(x['T'], 3)) - 26.64, + + "KP3": lambda x: math.exp(x['Ln_KP3']), + + "yi_H2": lambda x: x['MoFri'][0], + + "yi_CO2": lambda x: x['MoFri'][1], + + "yi_H2O": lambda x: x['MoFri'][2], + + "yi_CO": lambda x: x['MoFri'][3], + + "yi_CH3OH": lambda x: x['MoFri'][4], + + "yi_DME": lambda x: x['MoFri'][5], + + "PH2": lambda x: x['P']*(x['yi_H2'])*1e-5, + + "PCO2": lambda x: x['P']*(x['yi_CO2'])*1e-5, + + "PH2O": lambda x: x['P']*(x['yi_H2O'])*1e-5, + + "PCO": lambda x: x['P']*(x['yi_CO'])*1e-5, + + "PCH3OH": lambda x: x['P']*(x['yi_CH3OH'])*1e-5, + + "PCH3OCH3": lambda x: x['P']*(x['yi_DME'])*1e-5, + + "ra1": lambda x: x['PCO2']*x['PH2'], + + "ra2": lambda x: 1 + (x['KCO2']*x['PCO2']) + (x['KCO']*x['PCO']) + math.sqrt(x['KH2']*x['PH2']), + + "ra3": lambda x: (1/x['KP1'])*((x['PH2O']*x['PCH3OH'])/(x['PCO2']*(math.pow(x['PH2'], 3)))), + + "ra4": lambda x: x['PH2O'] - (1/x['KP2'])*((x['PCO2']*x['PH2'])/x['PCO']), + + "ra5": lambda x: (math.pow(x['PCH3OH'], 2)/x['PH2O'])-(x['PCH3OCH3']/x['KP3']) + + } + +``` + + + +b) define the final form of reaction rate expressions: + + + + "r1": 1000*x['K1']*(x['ra1']/(math.pow(x['ra2'], 3)))*(1-x['ra3'])*x['CaBeDe']; + + "r2": 1000*x['K2']*(1/x['ra2'])*x['ra4']*x['CaBeDe']; + + "r3": 1000*x['K3']*x['ra5']*x['CaBeDe'] + + + +then converted: + + + +```python + + rates0 = { + + "r1": lambda x: 1000*x['K1']*(x['ra1']/(math.pow(x['ra2'], 3)))*(1-x['ra3'])*x['CaBeDe'], + + "r2": lambda x: 1000*x['K2']*(1/x['ra2'])*x['ra4']*x['CaBeDe'], + + "r3": lambda x: 1000*x['K3']*x['ra5']*x['CaBeDe'] + + } + +``` + + + +4- PROPERTIES + + + +feed properties: + + + +```python + + # species-concentration [mol/m^3] + + SpCoi = [574.8978, 287.4489, 1.15e-02, 287.4489, 1.15e-02, 1.15e-02] + + # flowrate @ P & T [m^3/s] + + VoFlRa = 0.000228 + + # pressure [Pa] + + P = 5000000 + + # temperature [K] + + T = 523 + + # process-type [-] + + PrTy = "non-iso-thermal" + +``` + + + +5- REACTOR + + + +reactor and catalyst characteristics: + + + +```python + + # reactor-length [m] + + ReLe = 1 + + # reactor-inner-diameter [m] + + ReInDi = 0.0381 + + # bed-void-fraction [-] + + BeVoFr = 0.39 + + # catalyst bed density [kg/m^3] + + CaBeDe = 1171.2 + + # particle-diameter [m] + + PaDi = 0.002 + + # particle-density [kg/m^3] + + CaDe = 1920 + + # particle-specific-heat-capacity [J/kg.K] + + CaSpHeCa = 960 + +``` + + + +6- HEAT-EXCHANGER + + + +```python + + # overall-heat-transfer-coefficient [J/m^2.s.K] + + U = 50 + + # medium-temperature [K] + + Tm = 523 + +``` + + + +7- SOLVER + + + +```python + + # ode-solver [-] + + ivp = "default" + + # display-result [-] + + diRe = "True" + +``` + + + +After setting all modules, you can find 'model input' in python format in the summary panel. Then, copy the content of this file in your python framework and run it! + + + +You can also find an example on PyREMOT dashboard, load it and then have a look at the summary panel. + + + +## Run + + + +As the downloaded python file contains modelInput varibale, you can directly run the model as: + + + +```python + + # model input + + modelInput = {...} + + # start modeling + + res = rmtExe(modelInput) + +``` + + + +## Result Format + + + +For steady-state cases, the modeling result is stored in an array named dataPack: + + + +```python + + # res + + dataPack = [] + + dataPack.append({ + + "modelId": modelId, + + "processType": processType, + + "successStatus": successStatus, + + "computation-time": elapsed, + + "dataShape": dataShape, + + "labelList": labelList, + + "indexList": indexList, + + "dataTime": [], + + "dataXs": dataXs, + + "dataYCons1": dataYs_Concentration_DiLeVa, + + "dataYCons2": dataYs_Concentration_ReVa, + + "dataYTemp1": dataYs_Temperature_DiLeVa, + + "dataYTemp2": dataYs_Temperature_ReVa, + + "dataYs": dataYs_All + + }) + +``` + + + +And for dynamic cases, + + + +```python + + # res + + resPack = { + + "computation-time": elapsed, + + "dataPack": dataPack + + } + +``` + + + +Concentration results: + + + + dataYCons1: dimensionless concentration + + + + dataYCons2: concentraton [mol/m^3.s] + + + +Temperature results: + + + + dataYTemp1: dimensionless temperature + + + + dataYTemp2: Temperature [K] + + + +All modeling results is also saved in dataYs. + + + +## FAQ + + + +For any question, you can conatct me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/) or [Twitter](https://twitter.com/sinagilassi). + + + +## Authors + + + +- [@sinagilassi](https://www.github.com/sinagilassi) + + + + + +%package -n python3-PyREMOT +Summary: Python Reactor Modeling Tools (PyREMOT) +Provides: python-PyREMOT +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-PyREMOT + +# Python Reactor Modeling Tools + + + +Python Reactor Modeling Tools (PyREMOT) is an open-source package which can be used for process simulation, optimization, and parameter estimation. The current version consists of homogenous models for steady-state and dynamic conditions. + + + +You can visit [dashboard](https://pyremot.herokuapp.com/) to build model input and load examples! + + + +## Installation + + + +You can install this package + + + +```bash + + pip install PyREMOT + +``` + + + +## Documentation + + + +The main method is called as: + + + +```python + + from PyREMOT import rmtExe + + + + # model inputs + + # using dashboard to build model inputs + + modelInput = {...} + + + + # run + + res = rmtExe(modelInput) + +``` + + + +Check component list available in the current version: + + + +```python + + from PyREMOT import rmtCom + + + + # display component list + + res = rmtCom() + + print(res) + + + +``` + + + +PyREMOT UI dashboard conatins some panels as: + + + +1- MODEL SELECTION + + + +2- COMPONENTS + + + + H2;CO2;H2O;CO;CH3OH;DME + + + +this code is automaticly converted to python as: + + + +```python + + compList = ["H2","CO2","H2O","CO","CH3OH","DME"] + +``` + + + +3- REACTIONS + + + +define reacions as: + + + + CO2 + 3H2 <=> CH3OH + H2O; + + CO + H2O <=> H2 + CO2; + + 2CH3OH <=> DME + H2O + + + +then: + + + +```python + + reactionSet = { + + "R1":"CO2+3H2<=>CH3OH+H2O", + + "R2":"CO+H2O<=>H2+CO2", + + "R3":"2CH3OH<=>DME+H2O" + + } + +``` + + + +In order to define reaction rate expressions, there are two code sections as + + + +a) define parameters: + + + + "RT": x['R_CONST']*x['T']; + + "K1": 35.45*math.exp(-1.7069e4/x['RT']); + + "K2": 7.3976*math.exp(-2.0436e4/x['RT']); + + "K3": 8.2894e4*math.exp(-5.2940e4/x['RT']); + + "KH2": 0.249*math.exp(3.4394e4/x['RT']); + + "KCO2": 1.02e-7*math.exp(6.74e4/x['RT']); + + "KCO": 7.99e-7*math.exp(5.81e4/x['RT']); + + "Ln_KP1": 4213/x['T'] - 5.752 * math.log(x['T']) - 1.707e-3*x['T'] + 2.682e-6 * (math.pow(x['T'], 2)) - 7.232e-10*(math.pow(x['T'], 3)) + 17.6; + + "KP1": math.exp(x['Ln_KP1']); + + "log_KP2": 2167/x['T'] - 0.5194 * math.log10(x['T']) + 1.037e-3*x['T'] - 2.331e-7 * (math.pow(x['T'], 2)) - 1.2777; + + "KP2": math.pow(10, x['log_KP2']); + + "Ln_KP3": 4019/x['T'] + 3.707 * math.log(x['T']) - 2.783e-3*x['T'] + 3.8e-7 * (math.pow(x['T'], 2)) - 6.56e-4/(math.pow(x['T'], 3)) - 26.64; + + "KP3": math.exp(x['Ln_KP3']); + + "yi_H2": x['MoFri'][0]; + + "yi_CO2": x['MoFri'][1]; + + "yi_H2O": x['MoFri'][2]; + + "yi_CO": x['MoFri'][3]; + + "yi_CH3OH": x['MoFri'][4]; + + "yi_DME": x['MoFri'][5]; + + "PH2": x['P']*(x['yi_H2'])*1e-5; + + "PCO2": x['P']*(x['yi_CO2'])*1e-5; + + "PH2O": x['P']*(x['yi_H2O'])*1e-5; + + "PCO": x['P']*(x['yi_CO'])*1e-5; + + "PCH3OH": x['P']*(x['yi_CH3OH'])*1e-5; + + "PCH3OCH3": x['P']*(x['yi_DME'])*1e-5; + + "ra1": x['PCO2']*x['PH2']; + + "ra2": 1 + (x['KCO2']*x['PCO2']) + (x['KCO']*x['PCO']) + math.sqrt(x['KH2']*x['PH2']); + + "ra3": (1/x['KP1'])*((x['PH2O']*x['PCH3OH'])/(x['PCO2']*(math.pow(x['PH2'], 3)))); + + "ra4": x['PH2O'] - (1/x['KP2'])*((x['PCO2']*x['PH2'])/x['PCO']); + + "ra5": (math.pow(x['PCH3OH'], 2)/x['PH2O'])-(x['PCH3OCH3']/x['KP3']) + + + +then converted: + + + +```python + + varis0 = { + + "RT": lambda x: x['R_CONST']*x['T'], + + "K1": lambda x: 35.45*math.exp(-1.7069e4/x['RT']), + + "K2": lambda x: 7.3976*math.exp(-2.0436e4/x['RT']), + + "K3": lambda x: 8.2894e4*math.exp(-5.2940e4/x['RT']), + + "KH2": lambda x: 0.249*math.exp(3.4394e4/x['RT']), + + "KCO2": lambda x: 1.02e-7*math.exp(6.74e4/x['RT']), + + "KCO": lambda x: 7.99e-7*math.exp(5.81e4/x['RT']), + + "Ln_KP1": lambda x: 4213/x['T'] - 5.752 * math.log(x['T']) - 1.707e-3*x['T'] + 2.682e-6 * (math.pow(x['T'], 2)) - 7.232e-10*(math.pow(x['T'], 3)) + 17.6, + + "KP1": lambda x: math.exp(x['Ln_KP1']), + + "log_KP2": lambda x: 2167/x['T'] - 0.5194 * math.log10(x['T']) + 1.037e-3*x['T'] - 2.331e-7 * (math.pow(x['T'], 2)) - 1.2777, + + "KP2": lambda x: math.pow(10, x['log_KP2']), + + "Ln_KP3": lambda x: 4019/x['T'] + 3.707 * math.log(x['T']) - 2.783e-3*x['T'] + 3.8e-7 * (math.pow(x['T'], 2)) - 6.56e-4/(math.pow(x['T'], 3)) - 26.64, + + "KP3": lambda x: math.exp(x['Ln_KP3']), + + "yi_H2": lambda x: x['MoFri'][0], + + "yi_CO2": lambda x: x['MoFri'][1], + + "yi_H2O": lambda x: x['MoFri'][2], + + "yi_CO": lambda x: x['MoFri'][3], + + "yi_CH3OH": lambda x: x['MoFri'][4], + + "yi_DME": lambda x: x['MoFri'][5], + + "PH2": lambda x: x['P']*(x['yi_H2'])*1e-5, + + "PCO2": lambda x: x['P']*(x['yi_CO2'])*1e-5, + + "PH2O": lambda x: x['P']*(x['yi_H2O'])*1e-5, + + "PCO": lambda x: x['P']*(x['yi_CO'])*1e-5, + + "PCH3OH": lambda x: x['P']*(x['yi_CH3OH'])*1e-5, + + "PCH3OCH3": lambda x: x['P']*(x['yi_DME'])*1e-5, + + "ra1": lambda x: x['PCO2']*x['PH2'], + + "ra2": lambda x: 1 + (x['KCO2']*x['PCO2']) + (x['KCO']*x['PCO']) + math.sqrt(x['KH2']*x['PH2']), + + "ra3": lambda x: (1/x['KP1'])*((x['PH2O']*x['PCH3OH'])/(x['PCO2']*(math.pow(x['PH2'], 3)))), + + "ra4": lambda x: x['PH2O'] - (1/x['KP2'])*((x['PCO2']*x['PH2'])/x['PCO']), + + "ra5": lambda x: (math.pow(x['PCH3OH'], 2)/x['PH2O'])-(x['PCH3OCH3']/x['KP3']) + + } + +``` + + + +b) define the final form of reaction rate expressions: + + + + "r1": 1000*x['K1']*(x['ra1']/(math.pow(x['ra2'], 3)))*(1-x['ra3'])*x['CaBeDe']; + + "r2": 1000*x['K2']*(1/x['ra2'])*x['ra4']*x['CaBeDe']; + + "r3": 1000*x['K3']*x['ra5']*x['CaBeDe'] + + + +then converted: + + + +```python + + rates0 = { + + "r1": lambda x: 1000*x['K1']*(x['ra1']/(math.pow(x['ra2'], 3)))*(1-x['ra3'])*x['CaBeDe'], + + "r2": lambda x: 1000*x['K2']*(1/x['ra2'])*x['ra4']*x['CaBeDe'], + + "r3": lambda x: 1000*x['K3']*x['ra5']*x['CaBeDe'] + + } + +``` + + + +4- PROPERTIES + + + +feed properties: + + + +```python + + # species-concentration [mol/m^3] + + SpCoi = [574.8978, 287.4489, 1.15e-02, 287.4489, 1.15e-02, 1.15e-02] + + # flowrate @ P & T [m^3/s] + + VoFlRa = 0.000228 + + # pressure [Pa] + + P = 5000000 + + # temperature [K] + + T = 523 + + # process-type [-] + + PrTy = "non-iso-thermal" + +``` + + + +5- REACTOR + + + +reactor and catalyst characteristics: + + + +```python + + # reactor-length [m] + + ReLe = 1 + + # reactor-inner-diameter [m] + + ReInDi = 0.0381 + + # bed-void-fraction [-] + + BeVoFr = 0.39 + + # catalyst bed density [kg/m^3] + + CaBeDe = 1171.2 + + # particle-diameter [m] + + PaDi = 0.002 + + # particle-density [kg/m^3] + + CaDe = 1920 + + # particle-specific-heat-capacity [J/kg.K] + + CaSpHeCa = 960 + +``` + + + +6- HEAT-EXCHANGER + + + +```python + + # overall-heat-transfer-coefficient [J/m^2.s.K] + + U = 50 + + # medium-temperature [K] + + Tm = 523 + +``` + + + +7- SOLVER + + + +```python + + # ode-solver [-] + + ivp = "default" + + # display-result [-] + + diRe = "True" + +``` + + + +After setting all modules, you can find 'model input' in python format in the summary panel. Then, copy the content of this file in your python framework and run it! + + + +You can also find an example on PyREMOT dashboard, load it and then have a look at the summary panel. + + + +## Run + + + +As the downloaded python file contains modelInput varibale, you can directly run the model as: + + + +```python + + # model input + + modelInput = {...} + + # start modeling + + res = rmtExe(modelInput) + +``` + + + +## Result Format + + + +For steady-state cases, the modeling result is stored in an array named dataPack: + + + +```python + + # res + + dataPack = [] + + dataPack.append({ + + "modelId": modelId, + + "processType": processType, + + "successStatus": successStatus, + + "computation-time": elapsed, + + "dataShape": dataShape, + + "labelList": labelList, + + "indexList": indexList, + + "dataTime": [], + + "dataXs": dataXs, + + "dataYCons1": dataYs_Concentration_DiLeVa, + + "dataYCons2": dataYs_Concentration_ReVa, + + "dataYTemp1": dataYs_Temperature_DiLeVa, + + "dataYTemp2": dataYs_Temperature_ReVa, + + "dataYs": dataYs_All + + }) + +``` + + + +And for dynamic cases, + + + +```python + + # res + + resPack = { + + "computation-time": elapsed, + + "dataPack": dataPack + + } + +``` + + + +Concentration results: + + + + dataYCons1: dimensionless concentration + + + + dataYCons2: concentraton [mol/m^3.s] + + + +Temperature results: + + + + dataYTemp1: dimensionless temperature + + + + dataYTemp2: Temperature [K] + + + +All modeling results is also saved in dataYs. + + + +## FAQ + + + +For any question, you can conatct me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/) or [Twitter](https://twitter.com/sinagilassi). + + + +## Authors + + + +- [@sinagilassi](https://www.github.com/sinagilassi) + + + + + +%package help +Summary: Development documents and examples for PyREMOT +Provides: python3-PyREMOT-doc +%description help + +# Python Reactor Modeling Tools + + + +Python Reactor Modeling Tools (PyREMOT) is an open-source package which can be used for process simulation, optimization, and parameter estimation. The current version consists of homogenous models for steady-state and dynamic conditions. + + + +You can visit [dashboard](https://pyremot.herokuapp.com/) to build model input and load examples! + + + +## Installation + + + +You can install this package + + + +```bash + + pip install PyREMOT + +``` + + + +## Documentation + + + +The main method is called as: + + + +```python + + from PyREMOT import rmtExe + + + + # model inputs + + # using dashboard to build model inputs + + modelInput = {...} + + + + # run + + res = rmtExe(modelInput) + +``` + + + +Check component list available in the current version: + + + +```python + + from PyREMOT import rmtCom + + + + # display component list + + res = rmtCom() + + print(res) + + + +``` + + + +PyREMOT UI dashboard conatins some panels as: + + + +1- MODEL SELECTION + + + +2- COMPONENTS + + + + H2;CO2;H2O;CO;CH3OH;DME + + + +this code is automaticly converted to python as: + + + +```python + + compList = ["H2","CO2","H2O","CO","CH3OH","DME"] + +``` + + + +3- REACTIONS + + + +define reacions as: + + + + CO2 + 3H2 <=> CH3OH + H2O; + + CO + H2O <=> H2 + CO2; + + 2CH3OH <=> DME + H2O + + + +then: + + + +```python + + reactionSet = { + + "R1":"CO2+3H2<=>CH3OH+H2O", + + "R2":"CO+H2O<=>H2+CO2", + + "R3":"2CH3OH<=>DME+H2O" + + } + +``` + + + +In order to define reaction rate expressions, there are two code sections as + + + +a) define parameters: + + + + "RT": x['R_CONST']*x['T']; + + "K1": 35.45*math.exp(-1.7069e4/x['RT']); + + "K2": 7.3976*math.exp(-2.0436e4/x['RT']); + + "K3": 8.2894e4*math.exp(-5.2940e4/x['RT']); + + "KH2": 0.249*math.exp(3.4394e4/x['RT']); + + "KCO2": 1.02e-7*math.exp(6.74e4/x['RT']); + + "KCO": 7.99e-7*math.exp(5.81e4/x['RT']); + + "Ln_KP1": 4213/x['T'] - 5.752 * math.log(x['T']) - 1.707e-3*x['T'] + 2.682e-6 * (math.pow(x['T'], 2)) - 7.232e-10*(math.pow(x['T'], 3)) + 17.6; + + "KP1": math.exp(x['Ln_KP1']); + + "log_KP2": 2167/x['T'] - 0.5194 * math.log10(x['T']) + 1.037e-3*x['T'] - 2.331e-7 * (math.pow(x['T'], 2)) - 1.2777; + + "KP2": math.pow(10, x['log_KP2']); + + "Ln_KP3": 4019/x['T'] + 3.707 * math.log(x['T']) - 2.783e-3*x['T'] + 3.8e-7 * (math.pow(x['T'], 2)) - 6.56e-4/(math.pow(x['T'], 3)) - 26.64; + + "KP3": math.exp(x['Ln_KP3']); + + "yi_H2": x['MoFri'][0]; + + "yi_CO2": x['MoFri'][1]; + + "yi_H2O": x['MoFri'][2]; + + "yi_CO": x['MoFri'][3]; + + "yi_CH3OH": x['MoFri'][4]; + + "yi_DME": x['MoFri'][5]; + + "PH2": x['P']*(x['yi_H2'])*1e-5; + + "PCO2": x['P']*(x['yi_CO2'])*1e-5; + + "PH2O": x['P']*(x['yi_H2O'])*1e-5; + + "PCO": x['P']*(x['yi_CO'])*1e-5; + + "PCH3OH": x['P']*(x['yi_CH3OH'])*1e-5; + + "PCH3OCH3": x['P']*(x['yi_DME'])*1e-5; + + "ra1": x['PCO2']*x['PH2']; + + "ra2": 1 + (x['KCO2']*x['PCO2']) + (x['KCO']*x['PCO']) + math.sqrt(x['KH2']*x['PH2']); + + "ra3": (1/x['KP1'])*((x['PH2O']*x['PCH3OH'])/(x['PCO2']*(math.pow(x['PH2'], 3)))); + + "ra4": x['PH2O'] - (1/x['KP2'])*((x['PCO2']*x['PH2'])/x['PCO']); + + "ra5": (math.pow(x['PCH3OH'], 2)/x['PH2O'])-(x['PCH3OCH3']/x['KP3']) + + + +then converted: + + + +```python + + varis0 = { + + "RT": lambda x: x['R_CONST']*x['T'], + + "K1": lambda x: 35.45*math.exp(-1.7069e4/x['RT']), + + "K2": lambda x: 7.3976*math.exp(-2.0436e4/x['RT']), + + "K3": lambda x: 8.2894e4*math.exp(-5.2940e4/x['RT']), + + "KH2": lambda x: 0.249*math.exp(3.4394e4/x['RT']), + + "KCO2": lambda x: 1.02e-7*math.exp(6.74e4/x['RT']), + + "KCO": lambda x: 7.99e-7*math.exp(5.81e4/x['RT']), + + "Ln_KP1": lambda x: 4213/x['T'] - 5.752 * math.log(x['T']) - 1.707e-3*x['T'] + 2.682e-6 * (math.pow(x['T'], 2)) - 7.232e-10*(math.pow(x['T'], 3)) + 17.6, + + "KP1": lambda x: math.exp(x['Ln_KP1']), + + "log_KP2": lambda x: 2167/x['T'] - 0.5194 * math.log10(x['T']) + 1.037e-3*x['T'] - 2.331e-7 * (math.pow(x['T'], 2)) - 1.2777, + + "KP2": lambda x: math.pow(10, x['log_KP2']), + + "Ln_KP3": lambda x: 4019/x['T'] + 3.707 * math.log(x['T']) - 2.783e-3*x['T'] + 3.8e-7 * (math.pow(x['T'], 2)) - 6.56e-4/(math.pow(x['T'], 3)) - 26.64, + + "KP3": lambda x: math.exp(x['Ln_KP3']), + + "yi_H2": lambda x: x['MoFri'][0], + + "yi_CO2": lambda x: x['MoFri'][1], + + "yi_H2O": lambda x: x['MoFri'][2], + + "yi_CO": lambda x: x['MoFri'][3], + + "yi_CH3OH": lambda x: x['MoFri'][4], + + "yi_DME": lambda x: x['MoFri'][5], + + "PH2": lambda x: x['P']*(x['yi_H2'])*1e-5, + + "PCO2": lambda x: x['P']*(x['yi_CO2'])*1e-5, + + "PH2O": lambda x: x['P']*(x['yi_H2O'])*1e-5, + + "PCO": lambda x: x['P']*(x['yi_CO'])*1e-5, + + "PCH3OH": lambda x: x['P']*(x['yi_CH3OH'])*1e-5, + + "PCH3OCH3": lambda x: x['P']*(x['yi_DME'])*1e-5, + + "ra1": lambda x: x['PCO2']*x['PH2'], + + "ra2": lambda x: 1 + (x['KCO2']*x['PCO2']) + (x['KCO']*x['PCO']) + math.sqrt(x['KH2']*x['PH2']), + + "ra3": lambda x: (1/x['KP1'])*((x['PH2O']*x['PCH3OH'])/(x['PCO2']*(math.pow(x['PH2'], 3)))), + + "ra4": lambda x: x['PH2O'] - (1/x['KP2'])*((x['PCO2']*x['PH2'])/x['PCO']), + + "ra5": lambda x: (math.pow(x['PCH3OH'], 2)/x['PH2O'])-(x['PCH3OCH3']/x['KP3']) + + } + +``` + + + +b) define the final form of reaction rate expressions: + + + + "r1": 1000*x['K1']*(x['ra1']/(math.pow(x['ra2'], 3)))*(1-x['ra3'])*x['CaBeDe']; + + "r2": 1000*x['K2']*(1/x['ra2'])*x['ra4']*x['CaBeDe']; + + "r3": 1000*x['K3']*x['ra5']*x['CaBeDe'] + + + +then converted: + + + +```python + + rates0 = { + + "r1": lambda x: 1000*x['K1']*(x['ra1']/(math.pow(x['ra2'], 3)))*(1-x['ra3'])*x['CaBeDe'], + + "r2": lambda x: 1000*x['K2']*(1/x['ra2'])*x['ra4']*x['CaBeDe'], + + "r3": lambda x: 1000*x['K3']*x['ra5']*x['CaBeDe'] + + } + +``` + + + +4- PROPERTIES + + + +feed properties: + + + +```python + + # species-concentration [mol/m^3] + + SpCoi = [574.8978, 287.4489, 1.15e-02, 287.4489, 1.15e-02, 1.15e-02] + + # flowrate @ P & T [m^3/s] + + VoFlRa = 0.000228 + + # pressure [Pa] + + P = 5000000 + + # temperature [K] + + T = 523 + + # process-type [-] + + PrTy = "non-iso-thermal" + +``` + + + +5- REACTOR + + + +reactor and catalyst characteristics: + + + +```python + + # reactor-length [m] + + ReLe = 1 + + # reactor-inner-diameter [m] + + ReInDi = 0.0381 + + # bed-void-fraction [-] + + BeVoFr = 0.39 + + # catalyst bed density [kg/m^3] + + CaBeDe = 1171.2 + + # particle-diameter [m] + + PaDi = 0.002 + + # particle-density [kg/m^3] + + CaDe = 1920 + + # particle-specific-heat-capacity [J/kg.K] + + CaSpHeCa = 960 + +``` + + + +6- HEAT-EXCHANGER + + + +```python + + # overall-heat-transfer-coefficient [J/m^2.s.K] + + U = 50 + + # medium-temperature [K] + + Tm = 523 + +``` + + + +7- SOLVER + + + +```python + + # ode-solver [-] + + ivp = "default" + + # display-result [-] + + diRe = "True" + +``` + + + +After setting all modules, you can find 'model input' in python format in the summary panel. Then, copy the content of this file in your python framework and run it! + + + +You can also find an example on PyREMOT dashboard, load it and then have a look at the summary panel. + + + +## Run + + + +As the downloaded python file contains modelInput varibale, you can directly run the model as: + + + +```python + + # model input + + modelInput = {...} + + # start modeling + + res = rmtExe(modelInput) + +``` + + + +## Result Format + + + +For steady-state cases, the modeling result is stored in an array named dataPack: + + + +```python + + # res + + dataPack = [] + + dataPack.append({ + + "modelId": modelId, + + "processType": processType, + + "successStatus": successStatus, + + "computation-time": elapsed, + + "dataShape": dataShape, + + "labelList": labelList, + + "indexList": indexList, + + "dataTime": [], + + "dataXs": dataXs, + + "dataYCons1": dataYs_Concentration_DiLeVa, + + "dataYCons2": dataYs_Concentration_ReVa, + + "dataYTemp1": dataYs_Temperature_DiLeVa, + + "dataYTemp2": dataYs_Temperature_ReVa, + + "dataYs": dataYs_All + + }) + +``` + + + +And for dynamic cases, + + + +```python + + # res + + resPack = { + + "computation-time": elapsed, + + "dataPack": dataPack + + } + +``` + + + +Concentration results: + + + + dataYCons1: dimensionless concentration + + + + dataYCons2: concentraton [mol/m^3.s] + + + +Temperature results: + + + + dataYTemp1: dimensionless temperature + + + + dataYTemp2: Temperature [K] + + + +All modeling results is also saved in dataYs. + + + +## FAQ + + + +For any question, you can conatct me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/) or [Twitter](https://twitter.com/sinagilassi). + + + +## Authors + + + +- [@sinagilassi](https://www.github.com/sinagilassi) + + + + + +%prep +%autosetup -n PyREMOT-1.0.17 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-PyREMOT -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.17-1 +- Package Spec generated |
