equinor / mercury

Mercury calculator - API and Webapp
https://mercury.app.radix.equinor.com
MIT License
1 stars 0 forks source link
mercury processing

Mercury · GitHub license CI)

Mercury calculator - API and Webapp

About

This calculator performs phase equilibrium calculations for mercury. It can be used to provide mercury distribution results for hydrocarbon mixtures at different temperatures and pressures. Depending on the corresponding conditions used, the calculator can provide results up to 4 separate phases: Hydrocarbon Gas/Hydrocarbon Liquid/Aqueous/Pure Mercury (liquid or solid).

The core of the calculator is the UMR model (1-4). This model has been qualified for mercury calculations through the research activity “Mercury distribution in the oil & gas value chain” colab link.

The model was tested and qualified for gas/condensate systems for the following conditions:

Offshore applications: -30 to 110°C, 1 to 160 bara.

Onshore applications: -50 to 150°C, 1 to 90 bara.

It is also possible to use the model for glycol systems (MEG and TEG) but the uncertainty of the model is not defined for such calculations.

References

  1. Voutsas E, Magoulas K, Tassios D. Universal mixing rule for cubic equations of state applicable to symmetric and asymmetric systems: results with the Peng−Robinson equation of state. Ind Eng Chem Res 2004; 43(19):6238–46.

  2. Novak N, Louli V, Skouras S, Voutsas E. Prediction of dew points and liquid dropouts of gas condensate mixtures. Fluid Phase Equilibria 2018; 457:62–73.

  3. Koulocheris V, Louli V, Panteli E, Skouras S, Voutsas E, Modelling of elemental mercury solubility in natural gas components, Fuel 233 (2018) 558-564.

  4. Koulocheris V, Plakia A, Louli V, Panteli E, Voutsas E, Calculating the chemical and phase equilibria of mercury in natural gas, Fluid Phase Equilibria, 544-545 (2021) 113089.

Develop

Prerequisites

In order to run the application locally, you need:

Building the Dockerfile requires access to the private Github repository with the fortan library source (https://github.com/equinor/gpa-libhg).
The simplest way to manage this is by adding a deploy key to the repository.
Generate the keypair like so;

ssh-keygen -t ed25519 -f ./id_ed25519

Upload the public key to Github, and add the private key to .env, replacing newlines with \n so that it is one line.

LIBHG_REPO_DEPLOY_KEY=-----BEGIN OPENSSH PRIVATE KEY-----\nb3Blbn...

Testing

Depending on your OS/CPU, tests can be run locally or via Docker. In order to test locally, Intel's Fortran compiler must be installed and libhg must be compiled (see https://github.com/equinor/gpa-libhg) for more details on how to compile the library. Tests are then run through pytest from the command line.

To run tests in docker you first have to build the Docker image. When the build is done, unit tests can be run with the command:

docker-compose run --rm api pytest

Integration tests are run with the command:

docker-compose run --rm api pytest --integration

Common issues

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.