The Total Consumption Model (ToCoMo) calculator was made to democratize the dicussions about the consequences of mixing liquid CO2 with impurities. Current focus is to implement that algorithms as described by Sven Morten Hesjevik and Anne Marie Koren Halvorsen.
The application as hosted on Radix https://tocomo.radix.equinor.com
The application can be run locally quite easily using Docker. A docker compose file has been added which will build and start all components necessary. The setup has also been tested in a codespace environment. Stand in root and run:
docker compose up
The required ports in codespace will automatically be forwarded and you can open the application in your web browser.
The application consist of a frontend in React and a backend in Python. Each component contains a Dockerfile to build them, although they can also be build natively (instructions follow). In addition a docker compose file is available to set up the entire application in one step.
The calculations are implemented in python and served through a web api using fastapi.
In order to start the backend, create a python environment and do then following
cd backend
pip install fastapi
uvicorn main:app --port 5005Include --reload to have the backend rebuild on changes. It is also possible
to start the backend using the Dockerfile:
docker build -t backend_image .
docker run -t backend_image --p 5005:5005Go to http://127.0.0.1:5005/docs in your browser to see the swagger page for the backend
The frontend is written in react. In order to start the frontend do the following:
cd frontend
npm install
npm run devIt is also possible to start the backend using the Dockerfile:
docker build -t frontend_image .
docker run -t frontend_image --p 3000:3000Navigate to http://localhost:3000 in your browser to see the frontend. Given that the backend exists it should now be possible to insert numbers and click the run reactions button