Skip to content

Commit d24fb00

Browse files
committed
added arcs experimental version
1 parent bc4a057 commit d24fb00

5 files changed

Lines changed: 99 additions & 3 deletions

File tree

backend/src/acidwatch_api/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
from .solubilityccs import SolubilityCCSAdapter
55
from .gibbs_minimization_model import GibbsMinimizationModelAdapter
66
from .phpitz import PhpitzAdapter
7+
from .arcs_exp import ArcsExpAdapter
78

89
__all__ = [
910
"BaseAdapter",
1011
"InputError",
1112
"get_parameters_schema",
1213
"TocomoAdapter",
1314
"ArcsAdapter",
15+
"ArcsExpAdapter",
1416
"SolubilityCCSAdapter",
1517
"GibbsMinimizationModelAdapter",
1618
"PhpitzAdapter",

backend/src/acidwatch_api/models/arcs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111

1212
DESCRIPTION: str = """Automated Reactions for CO2 Storage (ARCS) model.
1313
ARCS combines first-principles calculations with Monte-Carlo sampling and models possible reactions that may occur under a given set of conditions.
14-
This process identifies the most frequently occurring reactions and paths, final products, and expected concentrations."""
14+
This process identifies the most frequently occurring reactions and paths, final products, and expected concentrations.
15+
16+
Source code found at https://github.com/equinor/arcs/tree/21ded96960d28d549c0950fbc1aa09c94159f652
17+
"""
1518

1619

1720
class ArcsParameters(BaseParameters):
@@ -109,5 +112,3 @@ async def run(self) -> RunResult:
109112
common_paths=common_paths,
110113
stats=all_stats,
111114
)
112-
113-
return {k: v * 1e6 for k, v in result["results"]["final_concs"].items()}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
from acidwatch_api.models.base import (
2+
BaseAdapter,
3+
BaseParameters,
4+
Parameter,
5+
RunResult,
6+
Unit,
7+
)
8+
from acidwatch_api.settings import SETTINGS
9+
10+
DESCRIPTION: str = """Automated Reactions for CO2 Storage (ARCS) model.
11+
ARCS combines first-principles calculations with Monte-Carlo sampling and models possible reactions that may occur under a given set of conditions.
12+
This process identifies the most frequently occurring reactions and paths, final products, and expected concentrations.
13+
14+
This model is under significant development and expected to deviate while developed. Therefore a development version of it has been released while work is ongoing
15+
Source code found at https://github.com/badw/arcs
16+
"""
17+
18+
19+
class ArcsParameters(BaseParameters):
20+
temperature: int = Parameter(
21+
300,
22+
label="Temperature",
23+
unit=Unit.TEMPERATURE_KELVIN,
24+
min=200,
25+
max=400,
26+
description="Temperature in Celsius",
27+
)
28+
29+
pressure: int = Parameter(
30+
10,
31+
label="Pressure",
32+
unit="bara",
33+
min=1,
34+
max=300,
35+
description="Pressure in bara",
36+
)
37+
38+
39+
class ArcsExpAdapter(BaseAdapter):
40+
model_id = "arcs_exp"
41+
display_name = "ARCS experimental"
42+
description = DESCRIPTION
43+
category = "Primary"
44+
45+
valid_substances = [
46+
"CH2O2",
47+
"CH3CH2OH",
48+
"CO",
49+
"H2",
50+
"O2",
51+
"CH3COOH",
52+
"CH3OH",
53+
"CH4",
54+
"CH3CHO",
55+
"H2CO",
56+
"H2O",
57+
"H2SO4",
58+
"H2S",
59+
"S8",
60+
"SO2",
61+
"H2SO3",
62+
"HNO3",
63+
"NO2",
64+
"NH3",
65+
"HNO2",
66+
"NO",
67+
"N2",
68+
"NOHSO4",
69+
]
70+
71+
parameters: ArcsParameters
72+
base_url = SETTINGS.arcs_exp_api_base_uri
73+
74+
async def run(self) -> RunResult:
75+
response = await self.client.post(
76+
f"{SETTINGS.arcs_exp_api_base_uri}/run_simulation",
77+
json={
78+
"concs": {
79+
key: value / 1e6 for key, value in self.concentrations.items()
80+
},
81+
"temperature": self.parameters.temperature,
82+
"pressure": self.parameters.pressure,
83+
"samples": 500,
84+
},
85+
timeout=300.0,
86+
)
87+
88+
result = response.json()
89+
90+
return {k: v * 1e6 for k, v in result["results"].items()}

backend/src/acidwatch_api/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Settings(BaseSettings):
1616

1717
tocomo_api_base_uri: str | None = None
1818
arcs_api_base_uri: str | None = None
19+
arcs_exp_api_base_uri: str | None = None
1920
phpitz_api_base_uri: str | None = None
2021

2122
tenant_id: str = "3aa4a235-b6e2-48d5-9195-7fcf05b459b0"

radixconfig.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ spec:
6565
BACKEND_API_SCOPE: api://456cc109-08d7-4c11-bf2e-a7b26660f99e/AcidWatch.User
6666
TOCOMO_API_BASE_URI: https://backend-tocomo-dev.radix.equinor.com
6767
ARCS_API_BASE_URI: https://api-arcs-eq-fork.radix.equinor.com
68+
ARCS_EXP_API_BASE_URI: https://api-arcs-dev.radix.equinor.com
6869
PHPITZ_API_BASE_URI: https://backend-phpitz-dev.radix.equinor.com
6970
APPLICATIONINSIGHTS_CONNECTION_STRING:
7071
OASIS_URI: https://api-oasis-test.radix.equinor.com
@@ -77,6 +78,7 @@ spec:
7778
BACKEND_API_SCOPE: api://873cbfab-30ca-4323-b5d5-e7955cc89ad9/AcidWatch.User
7879
TOCOMO_API_BASE_URI: https://backend-tocomo-prod.radix.equinor.com
7980
ARCS_API_BASE_URI: https://api-arcs-eq-fork.radix.equinor.com
81+
ARCS_EXP_API_BASE_URI: https://api-arcs-prod.radix.equinor.com
8082
PHPITZ_API_BASE_URI: https://backend-phpitz-dev.radix.equinor.com
8183
APPLICATIONINSIGHTS_CONNECTION_STRING:
8284
OASIS_URI: https://api-oasis-prod.radix.equinor.com

0 commit comments

Comments
 (0)