Skip to main content

Python Reactor Modeling Tools (PyREMOT)

Project 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 to build model input and load examples!

Installation

You can install this package

  pip install PyREMOT

Documentation

The main method is called as:

    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:

    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:

  compList = ["H2","CO2","H2O","CO","CH3OH","DME"]

3- REACTIONS

define reacions as:

CO2 + 3H2 <=> CH3OH + H2O;

CO + H2O <=> H2 + CO2;

2CH3OH <=> DME + H2O

then:

    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:

   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:

   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:

   # 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:

   # 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

    # overall-heat-transfer-coefficient [J/m^2.s.K]

    U = 50

    # medium-temperature [K]

    Tm = 523

7- SOLVER

    # 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:

    # model input

    modelInput = {...}

    # start modeling

    res = rmtExe(modelInput)

Result Format

For steady-state cases, the modeling result is stored in an array named dataPack:

    # 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,

    # 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 or Twitter.

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyREMOT-1.0.17.tar.gz (176.7 kB view details)

Uploaded Source

Built Distribution

PyREMOT-1.0.17-py3-none-any.whl (239.6 kB view details)

Uploaded Python 3

File details

Details for the file PyREMOT-1.0.17.tar.gz.

File metadata

  • Download URL: PyREMOT-1.0.17.tar.gz
  • Upload date:
  • Size: 176.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for PyREMOT-1.0.17.tar.gz
Algorithm Hash digest
SHA256 a8afa4cb87e3d9ad1f3001fa7f61cd7ee0c96878de1eb4492e89b62030c88a32
MD5 5ed53260d13b01971581e489edf5bcf1
BLAKE2b-256 cafb67ad7824ae88160d1964c94035ffe370b6ae0b7e57d1d36c6262d6bd220b

See more details on using hashes here.

File details

Details for the file PyREMOT-1.0.17-py3-none-any.whl.

File metadata

  • Download URL: PyREMOT-1.0.17-py3-none-any.whl
  • Upload date:
  • Size: 239.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for PyREMOT-1.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 d66720d94352e05655aaa54842c8469a891b9b0a78197cc61794194242cb4fe8
MD5 2d3a2cf309fee5228bb79fc847598b9a
BLAKE2b-256 f272cdfc3ff25377b21b770dc5d74e750f064bea2f6652a9c2d42909128964a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page