processforge 0.4.3__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {processforge-0.4.3/src/processforge.egg-info → processforge-0.5.1}/PKG-INFO +1 -1
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/custom/crimson/simple_water_system.json +75 -82
- {processforge-0.4.3 → processforge-0.5.1}/pyproject.toml +1 -1
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/__init__.py +1 -1
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/apply.py +5 -3
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/common.py +3 -3
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/display.py +3 -3
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/init.py +3 -3
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/run.py +2 -6
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/flowsheet.py +8 -1
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/flowsheet.py +9 -1
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/output_collector.py +25 -1
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/__init__.py +20 -0
- processforge-0.5.1/src/processforge/providers/_sim_strategy.py +70 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/base.py +13 -0
- processforge-0.5.1/src/processforge/providers/base_simulation_provider.py +92 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/cantera_provider.py +2 -1
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/container_client.py +21 -18
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/coolprop_provider.py +4 -3
- processforge-0.5.1/src/processforge/providers/errors.py +453 -0
- processforge-0.5.1/src/processforge/providers/festim/__init__.py +16 -0
- processforge-0.5.1/src/processforge/providers/festim/build_helpers.py +349 -0
- processforge-0.5.1/src/processforge/providers/festim/provider.py +171 -0
- processforge-0.5.1/src/processforge/providers/festim/result_extraction.py +106 -0
- processforge-0.5.1/src/processforge/providers/festim/strategies.py +93 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/manager.py +61 -36
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/modelica_provider.py +2 -1
- processforge-0.5.1/src/processforge/providers/openmc/__init__.py +16 -0
- processforge-0.5.1/src/processforge/providers/openmc/build_helpers.py +163 -0
- processforge-0.5.1/src/processforge/providers/openmc/provider.py +327 -0
- processforge-0.5.1/src/processforge/providers/openmc/result_extraction.py +194 -0
- processforge-0.5.1/src/processforge/providers/openmc/strategies.py +217 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/registry.py +83 -61
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/schemas/festim/festim_model.py +1 -1
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/types.py +14 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/utils/validate_flowsheet.py +3 -3
- {processforge-0.4.3 → processforge-0.5.1/src/processforge.egg-info}/PKG-INFO +1 -1
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge.egg-info/SOURCES.txt +12 -2
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_cli.py +20 -2
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_container_client.py +56 -1
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_coupling.py +1 -1
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_festim_provider.py +35 -39
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_init.py +6 -6
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_openmc_provider.py +1 -1
- processforge-0.5.1/tests/test_provider_errors.py +216 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_providers.py +41 -3
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_runs_command.py +48 -0
- processforge-0.4.3/src/processforge/providers/errors.py +0 -276
- processforge-0.4.3/src/processforge/providers/festim_provider.py +0 -917
- processforge-0.4.3/src/processforge/providers/openmc_provider.py +0 -1066
- processforge-0.4.3/tests/test_provider_errors.py +0 -104
- {processforge-0.4.3 → processforge-0.5.1}/LICENSE +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/MANIFEST.in +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/README.md +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/closed-loop-chain.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/coupled/msre_coupled.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/custom/crimson/MUWS_HB.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/custom/simple_hyrdaulic_scheme.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/festim/hydrogen_transport_1d.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/festim/tds_tungsten.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/hydraulic-chain.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/flowsheets/openmc/msre_eigenvalue.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/setup.cfg +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/__main__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/_schema.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/analysis/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/analysis/dof.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/api/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/api/serve.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/diagram.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/export_fmu.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/export_modelica.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/persist.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/plan.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/runs.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/cli/validate.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/compose.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/coupling.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/backends/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/backends/base.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/backends/casadi_backend.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/backends/pyomo_backend.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/backends/scipy_backend.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/jacobian.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/mixin.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/solver.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/stream_var.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/units/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/units/flash_eo.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/units/heater_eo.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/units/pipes_eo.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/units/pump_eo.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/units/strainer_eo.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/eo/units/valve_eo.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/fmu/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/fmu/_fmi_vars.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/fmu/builder.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/fmu/interface.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/fmu/slave_template.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/lock.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/modelica/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/modelica/mo_writer.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/modelica/omc_runner.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/modelica/transpiler.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/modelica/unit_equations.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/pathsim/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/pathsim/adapter.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/pcl/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/pcl/compiler.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/pcl/namespace.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/persistence/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/persistence/archive.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/persistence/artifact_store.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/provenance.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/base_jacobian_mixin.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/cantera_jacobian.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/jacobian_contributor.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/modelica_jacobian.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/providers/reference_state_registry.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/quantity.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/result.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/result_schema.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/schemas/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/schemas/flowsheet_schema.json +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/schemas/openmc/openmc_model.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/simulate.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/solver.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/state.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/thermo.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/base.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/cstr.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/flash.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/heater.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/pfr.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/pipes.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/pump.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/registry.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/solver_unit.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/strainer.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/tank.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/units/valve.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/utils/__init__.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/utils/flowsheet_diagram.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/utils/mermaid_diagram.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/utils/s3_upload.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/utils/topology.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/utils/unit_consistency.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge/utils/validation.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge.egg-info/dependency_links.txt +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge.egg-info/entry_points.txt +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge.egg-info/requires.txt +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/src/processforge.egg-info/top_level.txt +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_display.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_festim_schema.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_fmu_solverunit.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_pathsim_adapter.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_persist.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_result_zarr.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_s3_upload.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_state.py +0 -0
- {processforge-0.4.3 → processforge-0.5.1}/tests/test_types.py +0 -0
{processforge-0.4.3 → processforge-0.5.1}/flowsheets/custom/crimson/simple_water_system.json
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
"name": "Make-up Water System",
|
|
4
|
-
"description": "A
|
|
4
|
+
"description": "A simple water system with a tank, pump, and valves.",
|
|
5
5
|
"version": "2.0"
|
|
6
6
|
},
|
|
7
7
|
"providers": {
|
|
@@ -17,147 +17,143 @@
|
|
|
17
17
|
"id": 2
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
"streams": {
|
|
21
21
|
"feed": {
|
|
22
22
|
"T": 313.00,
|
|
23
23
|
"P": 101325,
|
|
24
24
|
"flowrate": 1,
|
|
25
|
-
"z": {
|
|
25
|
+
"z": {
|
|
26
|
+
"Water": 1.0
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"units": {
|
|
29
|
+
},
|
|
30
|
+
"units": {
|
|
30
31
|
"tank_1": {
|
|
31
32
|
"type": "Tank",
|
|
32
|
-
"in": [
|
|
33
|
-
|
|
33
|
+
"in": [
|
|
34
|
+
"feed"
|
|
35
|
+
],
|
|
36
|
+
"out": [
|
|
37
|
+
"tank_1_to_pipe1",
|
|
38
|
+
"tank_1_to_pipe2"
|
|
39
|
+
],
|
|
34
40
|
"outlet_flow": 1.0,
|
|
35
|
-
"initial_n": {
|
|
41
|
+
"initial_n": {
|
|
36
42
|
"Water": 1.0
|
|
37
43
|
},
|
|
38
44
|
"initial_T": 298.15,
|
|
39
|
-
"P": 101325,
|
|
45
|
+
"P": 101325,
|
|
40
46
|
"material": 1
|
|
41
47
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"pipe_1": {
|
|
48
|
+
"pipe_1": {
|
|
45
49
|
"type": "Pipes",
|
|
46
50
|
"in": "tank_1_to_pipe1",
|
|
47
51
|
"out": "after_pipe_1",
|
|
48
52
|
"delta_p": 1000.0,
|
|
49
53
|
"diameter": 0.05,
|
|
50
54
|
"material": 2
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"material": 2,
|
|
67
|
-
"delta_p": 1000.0
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
"pipe_2": {
|
|
55
|
+
},
|
|
56
|
+
"low_pressure_pump": {
|
|
57
|
+
"type": "Pump",
|
|
58
|
+
"in": "after_pipe_1",
|
|
59
|
+
"out": "after_low_pressure_pump",
|
|
60
|
+
"q_flowrate": 4,
|
|
61
|
+
"head": 57,
|
|
62
|
+
"efficiency": 36,
|
|
63
|
+
"power": 1.3,
|
|
64
|
+
"cap": 2.5,
|
|
65
|
+
"motor_rating": 370,
|
|
66
|
+
"material": 2,
|
|
67
|
+
"delta_p": 1000.0
|
|
68
|
+
},
|
|
69
|
+
"pipe_2": {
|
|
71
70
|
"type": "Pipes",
|
|
72
71
|
"in": "tank_1_to_pipe2",
|
|
73
72
|
"out": "after_pipe_2",
|
|
74
73
|
"delta_p": 1000.0,
|
|
75
74
|
"diameter": 0.05,
|
|
76
75
|
"material": 2
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
"pipe_3": {
|
|
76
|
+
},
|
|
77
|
+
"pipe_3": {
|
|
80
78
|
"type": "Pipes",
|
|
81
79
|
"in": "after_low_pressure_pump",
|
|
82
80
|
"out": "after_pipe_3",
|
|
83
81
|
"delta_p": 1000.0,
|
|
84
82
|
"diameter": 0.05,
|
|
85
83
|
"material": 2
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
},
|
|
89
85
|
"drain_valve_1": {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
"type": "Valve",
|
|
87
|
+
"in": "after_pipe_2",
|
|
88
|
+
"out": "after_drain_valve_1",
|
|
89
|
+
"material": 2,
|
|
90
|
+
"valve_type": "drain",
|
|
91
|
+
"p_start_open": 2059396.5,
|
|
92
|
+
"p_full_open": 2451662.5,
|
|
93
|
+
"flow_min": 2.7778e-05,
|
|
94
|
+
"flow_max": 0.0013889,
|
|
95
|
+
"pressure_ratio": 0.5
|
|
97
96
|
},
|
|
98
|
-
|
|
99
97
|
"make_up_valve_1": {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
"type": "Valve",
|
|
99
|
+
"in": "after_pipe_3",
|
|
100
|
+
"out": "after_make_up_valve_1",
|
|
101
|
+
"material": 2,
|
|
102
|
+
"valve_type": "makeup",
|
|
103
|
+
"p_start_open": 1863273.5,
|
|
104
|
+
"p_full_open": 1470997.5,
|
|
105
|
+
"flow_min": 5.5556e-05,
|
|
106
|
+
"flow_max": 0.0016667,
|
|
107
|
+
"pressure_ratio": 0.5
|
|
107
108
|
},
|
|
108
|
-
|
|
109
|
-
"pipe_4": {
|
|
109
|
+
"pipe_4": {
|
|
110
110
|
"type": "Pipes",
|
|
111
111
|
"in": "after_make_up_valve_1",
|
|
112
112
|
"out": "after_pipe_4",
|
|
113
113
|
"delta_p": 1000.0,
|
|
114
114
|
"diameter": 0.05,
|
|
115
115
|
"material": 2
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
"pipe_5": {
|
|
116
|
+
},
|
|
117
|
+
"pipe_5": {
|
|
119
118
|
"type": "Pipes",
|
|
120
119
|
"in": "after_drain_valve_1",
|
|
121
120
|
"out": "after_pipe_5",
|
|
122
121
|
"delta_p": 1000.0,
|
|
123
122
|
"diameter": 0.05,
|
|
124
123
|
"material": 2
|
|
125
|
-
},
|
|
124
|
+
},
|
|
126
125
|
"tank_2": {
|
|
127
126
|
"type": "Tank",
|
|
128
|
-
"in": [
|
|
127
|
+
"in": [
|
|
128
|
+
"after_pipe_4",
|
|
129
|
+
"after_pipe_5"
|
|
130
|
+
],
|
|
129
131
|
"out": "after_tank_2",
|
|
130
132
|
"outlet_flow": 1.0,
|
|
131
|
-
"initial_n": {
|
|
133
|
+
"initial_n": {
|
|
132
134
|
"Water": 1.0
|
|
133
135
|
},
|
|
134
136
|
"initial_T": 298.15,
|
|
135
|
-
"P":
|
|
137
|
+
"P": 1961330,
|
|
136
138
|
"material": 1
|
|
137
139
|
},
|
|
138
|
-
|
|
139
|
-
"pipe_6": {
|
|
140
|
+
"pipe_6": {
|
|
140
141
|
"type": "Pipes",
|
|
141
142
|
"in": "after_tank_2",
|
|
142
143
|
"out": "after_pipe_6",
|
|
143
144
|
"delta_p": 1000.0,
|
|
144
145
|
"diameter": 0.05,
|
|
145
146
|
"material": 2
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
},
|
|
151
148
|
"manual_drain_valve": {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
"type": "Valve",
|
|
150
|
+
"in": "after_pipe_6",
|
|
151
|
+
"out": "after_manual_drain_valve",
|
|
152
|
+
"opening": 50,
|
|
153
|
+
"q_flowrate": 50,
|
|
154
|
+
"material": 2,
|
|
155
|
+
"pressure_ratio": 0.5
|
|
159
156
|
}
|
|
160
|
-
|
|
161
157
|
},
|
|
162
158
|
"simulation": {
|
|
163
159
|
"mode": "dynamic",
|
|
@@ -166,7 +162,4 @@
|
|
|
166
162
|
"dt": 1.0,
|
|
167
163
|
"backend": "scipy"
|
|
168
164
|
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
}
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "processforge"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.5.1"
|
|
8
8
|
description = "A Python-based process simulation framework for chemical engineering applications."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "BSD-3-Clause"
|
|
@@ -9,7 +9,7 @@ from typing import Literal
|
|
|
9
9
|
import typer
|
|
10
10
|
from loguru import logger
|
|
11
11
|
|
|
12
|
-
from .persist import make_run_id, persist_run
|
|
12
|
+
from .persist import flowsheet_hash, make_run_id, persist_run
|
|
13
13
|
from ..eo import EOFlowsheet
|
|
14
14
|
from ..provenance import build_run_info
|
|
15
15
|
from .common import (
|
|
@@ -106,6 +106,8 @@ def apply(
|
|
|
106
106
|
fs.solver_max_iter = max_iter
|
|
107
107
|
|
|
108
108
|
logger.info("=== Running Apply (Steady-State EO) ===")
|
|
109
|
+
run_id = make_run_id()
|
|
110
|
+
fs.set_run_context(run_id, flowsheet_hash(config))
|
|
109
111
|
t0 = time.perf_counter()
|
|
110
112
|
results = fs.run()
|
|
111
113
|
elapsed = time.perf_counter() - t0
|
|
@@ -122,7 +124,6 @@ def apply(
|
|
|
122
124
|
label="converged state",
|
|
123
125
|
)
|
|
124
126
|
run_info = build_run_info(config, x0=fs.x0, var_names=fs.var_names)
|
|
125
|
-
run_id = make_run_id()
|
|
126
127
|
persist_run(sm, fs, run_id, results, run_info, config, base_name, snapshot_id)
|
|
127
128
|
logger.info("=== Apply Summary ===")
|
|
128
129
|
logger.info(" Status : CONVERGED")
|
|
@@ -142,7 +143,9 @@ def apply(
|
|
|
142
143
|
from ..providers.manager import teardown_providers
|
|
143
144
|
|
|
144
145
|
solver = EOSolver(backend=fs.backend, tol=tolerance, max_iter=max_iter)
|
|
146
|
+
run_id = make_run_id()
|
|
145
147
|
tmp_fs = _EO(config, backend=backend)
|
|
148
|
+
tmp_fs.set_run_context(run_id, flowsheet_hash(config))
|
|
146
149
|
manager = tmp_fs._build()
|
|
147
150
|
try:
|
|
148
151
|
homotopy_result = solve_with_homotopy(tmp_fs, manager, solver, state, drifted)
|
|
@@ -168,7 +171,6 @@ def apply(
|
|
|
168
171
|
label="homotopy solution",
|
|
169
172
|
)
|
|
170
173
|
run_info = build_run_info(config, x0=fs.x0, var_names=fs.var_names)
|
|
171
|
-
run_id = make_run_id()
|
|
172
174
|
persist_run(sm, tmp_fs, run_id, tmp_fs.results, run_info, config, base_name, snapshot_id)
|
|
173
175
|
logger.info("Homotopy apply succeeded. New snapshot saved.")
|
|
174
176
|
return
|
|
@@ -252,13 +252,13 @@ def _check_pip_provider(
|
|
|
252
252
|
"""Verify a pip-installable provider's module is importable."""
|
|
253
253
|
from ..providers.registry import _PROVIDER_CATALOG
|
|
254
254
|
|
|
255
|
-
catalog = _PROVIDER_CATALOG.get(ptype
|
|
256
|
-
module = catalog.
|
|
255
|
+
catalog = _PROVIDER_CATALOG.get(ptype)
|
|
256
|
+
module = catalog.module if catalog else ""
|
|
257
257
|
try:
|
|
258
258
|
importlib.util.find_spec(module)
|
|
259
259
|
logger.info(f" [OK] {name} [{ptype}] (pip — importable)")
|
|
260
260
|
except (ModuleNotFoundError, ValueError):
|
|
261
|
-
dep = catalog.
|
|
261
|
+
dep = catalog.optional_dep if catalog else None
|
|
262
262
|
hint = f"pip install 'processforge[{dep}]'" if dep else "built-in"
|
|
263
263
|
msg = (
|
|
264
264
|
f" [WARN] {name} [{ptype}] — not installed. "
|
|
@@ -96,13 +96,13 @@ def print_provider_health(config: dict, strict: bool = False) -> list[str]:
|
|
|
96
96
|
logger.error(msg)
|
|
97
97
|
failures.append(f"Provider '{name}' unreachable at {url}: {info}")
|
|
98
98
|
else:
|
|
99
|
-
catalog = _PROVIDER_CATALOG.get(ptype
|
|
100
|
-
module = catalog.
|
|
99
|
+
catalog = _PROVIDER_CATALOG.get(ptype)
|
|
100
|
+
module = catalog.module if catalog else ""
|
|
101
101
|
try:
|
|
102
102
|
importlib.util.find_spec(module)
|
|
103
103
|
logger.info(f" [OK] {name} [{ptype}] (pip — importable)")
|
|
104
104
|
except (ModuleNotFoundError, ValueError):
|
|
105
|
-
dep = catalog.
|
|
105
|
+
dep = catalog.optional_dep if catalog else None
|
|
106
106
|
hint = f"pip install 'processforge[{dep}]'" if dep else "built-in"
|
|
107
107
|
logger.warning(f" [WARN] {name} [{ptype}] — not installed ({hint})")
|
|
108
108
|
if strict:
|
|
@@ -208,13 +208,13 @@ def init(
|
|
|
208
208
|
# Validate pip providers are importable
|
|
209
209
|
for name, info in pip_providers.items():
|
|
210
210
|
ptype = info["type"]
|
|
211
|
-
catalog = _PROVIDER_CATALOG.get(ptype
|
|
212
|
-
module = catalog.
|
|
211
|
+
catalog = _PROVIDER_CATALOG.get(ptype)
|
|
212
|
+
module = catalog.module if catalog else ""
|
|
213
213
|
try:
|
|
214
214
|
importlib.util.find_spec(module)
|
|
215
215
|
logger.info(f" {name} — importable")
|
|
216
216
|
except (ModuleNotFoundError, ValueError):
|
|
217
|
-
dep = catalog.
|
|
217
|
+
dep = catalog.optional_dep if catalog else None
|
|
218
218
|
hint = f"pip install 'processforge[{dep}]'" if dep else "built-in"
|
|
219
219
|
logger.warning(f" {name} — not installed. Install with: {hint}")
|
|
220
220
|
|
|
@@ -106,6 +106,7 @@ def run(
|
|
|
106
106
|
logger.debug("No .pfarchive found — starting dynamic run from flowsheet defaults.")
|
|
107
107
|
|
|
108
108
|
fs = Flowsheet(config)
|
|
109
|
+
fs.set_run_context(run_id, flowsheet_hash_value)
|
|
109
110
|
logger.info("=== Dynamic Results ===")
|
|
110
111
|
results = fs.run()
|
|
111
112
|
|
|
@@ -128,6 +129,7 @@ def run(
|
|
|
128
129
|
else:
|
|
129
130
|
# Pass None so EOFlowsheet resolves backend from config (with scipy default).
|
|
130
131
|
fs = EOFlowsheet(config, backend=None)
|
|
132
|
+
fs.set_run_context(run_id, flowsheet_hash_value)
|
|
131
133
|
logger.info("=== Steady-State EO Results ===")
|
|
132
134
|
results = fs.run()
|
|
133
135
|
|
|
@@ -144,12 +146,6 @@ def run(
|
|
|
144
146
|
snap_backend = getattr(fs, "backend", "scipy")
|
|
145
147
|
snap_ok = bool(getattr(fs, "converged", False))
|
|
146
148
|
|
|
147
|
-
# Propagate run context to any containerized providers so their S3 uploads
|
|
148
|
-
# are keyed by the same run_id/flowsheet_hash as this archive run.
|
|
149
|
-
for provider in getattr(fs, "_provider_map", {}).values():
|
|
150
|
-
if hasattr(provider, "set_run_context"):
|
|
151
|
-
provider.set_run_context(run_id, flowsheet_hash_value)
|
|
152
|
-
|
|
153
149
|
# Build + persist the standardized run manifest.
|
|
154
150
|
archive_path = os.path.join(outputs_dir, f"{base_name}.pfarchive")
|
|
155
151
|
archive = ProcessStateArchive(archive_path)
|
|
@@ -51,6 +51,12 @@ class EOFlowsheet:
|
|
|
51
51
|
self.solver_tol: float = 1e-6
|
|
52
52
|
self.solver_max_iter: int = 50
|
|
53
53
|
|
|
54
|
+
def set_run_context(self, run_id: str | None = None, flowsheet_hash: str | None = None) -> None:
|
|
55
|
+
"""Store run-level metadata so containerized providers can tag artifacts."""
|
|
56
|
+
from processforge.types import RunContext
|
|
57
|
+
|
|
58
|
+
self._run_context = RunContext(run_id=run_id, flowsheet_hash=flowsheet_hash)
|
|
59
|
+
|
|
54
60
|
# ------------------------------------------------------------------
|
|
55
61
|
# Public API
|
|
56
62
|
# ------------------------------------------------------------------
|
|
@@ -68,8 +74,9 @@ class EOFlowsheet:
|
|
|
68
74
|
Stream result dict in the same format as ``Flowsheet.run()``:
|
|
69
75
|
``{stream_name: {"T": ..., "P": ..., "flowrate": ..., "z": {...}}}``
|
|
70
76
|
"""
|
|
71
|
-
from processforge.providers.manager import teardown_providers
|
|
77
|
+
from processforge.providers.manager import apply_run_context, teardown_providers
|
|
72
78
|
manager = self._build()
|
|
79
|
+
apply_run_context(self._provider_map, getattr(self, "_run_context", None))
|
|
73
80
|
self.engine_outputs: dict = {}
|
|
74
81
|
try:
|
|
75
82
|
x0 = self._warm_start(manager)
|
|
@@ -9,7 +9,7 @@ from copy import deepcopy
|
|
|
9
9
|
if TYPE_CHECKING:
|
|
10
10
|
from .providers.manager import ProviderMap
|
|
11
11
|
|
|
12
|
-
from .providers.manager import build_provider_map, teardown_providers
|
|
12
|
+
from .providers.manager import apply_run_context, build_provider_map, teardown_providers
|
|
13
13
|
from .types import EngineOutput, FlowsheetConfig, MergedInletTimeseries, StreamTimeseries
|
|
14
14
|
from .solver import Solver
|
|
15
15
|
from .providers.manager import UnitProviderConfig
|
|
@@ -112,6 +112,12 @@ class Flowsheet:
|
|
|
112
112
|
self.tear_streams = set()
|
|
113
113
|
self.has_recycles = False
|
|
114
114
|
|
|
115
|
+
def set_run_context(self, run_id: str | None = None, flowsheet_hash: str | None = None) -> None:
|
|
116
|
+
"""Store run-level metadata so containerized providers can tag artifacts."""
|
|
117
|
+
from processforge.types import RunContext
|
|
118
|
+
|
|
119
|
+
self._run_context = RunContext(run_id=run_id, flowsheet_hash=flowsheet_hash)
|
|
120
|
+
|
|
115
121
|
def build_units(self, provider_map: ProviderMap | None = None):
|
|
116
122
|
logger.info("Building units")
|
|
117
123
|
_merge_provider_types(provider_map=provider_map)
|
|
@@ -228,6 +234,8 @@ class Flowsheet:
|
|
|
228
234
|
logger.info("Starting simulation")
|
|
229
235
|
flowsheet_cfg = FlowsheetConfig.from_dict(self.config)
|
|
230
236
|
provider_map = build_provider_map(providers_config=flowsheet_cfg.providers, flowsheet_config=flowsheet_cfg)
|
|
237
|
+
self._provider_map = provider_map
|
|
238
|
+
apply_run_context(provider_map, getattr(self, "_run_context", None))
|
|
231
239
|
self.engine_outputs: dict = {}
|
|
232
240
|
try:
|
|
233
241
|
self.build_units(provider_map=provider_map)
|
|
@@ -18,6 +18,7 @@ from datetime import datetime, timezone
|
|
|
18
18
|
from typing import Optional
|
|
19
19
|
|
|
20
20
|
import arrow
|
|
21
|
+
import numpy as np
|
|
21
22
|
from loguru import logger
|
|
22
23
|
|
|
23
24
|
from .types import (
|
|
@@ -30,6 +31,26 @@ from .types import (
|
|
|
30
31
|
)
|
|
31
32
|
|
|
32
33
|
|
|
34
|
+
def _to_scalar(value):
|
|
35
|
+
"""Return the last element of a sequence, or the scalar value itself.
|
|
36
|
+
|
|
37
|
+
Dynamic simulations store stream properties as timeseries lists. For
|
|
38
|
+
manifest-level thermo output we use the final timestep as the representative
|
|
39
|
+
scalar, matching the convention used by :func:`~processforge.result.plot_results`.
|
|
40
|
+
"""
|
|
41
|
+
if isinstance(value, (list, tuple, np.ndarray)):
|
|
42
|
+
arr = np.asarray(value)
|
|
43
|
+
if arr.size == 0:
|
|
44
|
+
raise ValueError("empty sequence")
|
|
45
|
+
candidate = arr[-1]
|
|
46
|
+
else:
|
|
47
|
+
candidate = value
|
|
48
|
+
try:
|
|
49
|
+
return float(candidate)
|
|
50
|
+
except (TypeError, ValueError) as exc:
|
|
51
|
+
raise ValueError(f"non-numeric value {candidate!r}") from exc
|
|
52
|
+
|
|
53
|
+
|
|
33
54
|
def collect_stream_outputs(provider, stream_results: dict) -> dict[str, StreamOutput]:
|
|
34
55
|
"""Build :class:`StreamOutput` for each stream using *provider*'s thermo."""
|
|
35
56
|
if provider is None:
|
|
@@ -44,7 +65,10 @@ def collect_stream_outputs(provider, stream_results: dict) -> dict[str, StreamOu
|
|
|
44
65
|
if not isinstance(z, dict) or T is None or P is None:
|
|
45
66
|
continue
|
|
46
67
|
try:
|
|
47
|
-
|
|
68
|
+
z_norm = {comp: _to_scalar(frac) for comp, frac in z.items()}
|
|
69
|
+
T_norm = _to_scalar(T)
|
|
70
|
+
P_norm = _to_scalar(P)
|
|
71
|
+
props = provider.get_thermo_properties({"z": z_norm, "T": T_norm, "P": P_norm})
|
|
48
72
|
except Exception as exc: # noqa: BLE001
|
|
49
73
|
logger.debug(f"thermo properties unavailable for stream '{name}': {exc}")
|
|
50
74
|
continue
|
|
@@ -23,6 +23,16 @@ back to the built-in CoolProp provider — existing flowsheets are unaffected.
|
|
|
23
23
|
from .base import AbstractProvider
|
|
24
24
|
from .base_jacobian_mixin import BaseJacobianMixin
|
|
25
25
|
from .coolprop_provider import CoolPropProvider
|
|
26
|
+
from .errors import (
|
|
27
|
+
ProviderCleanupError,
|
|
28
|
+
ProviderConfigError,
|
|
29
|
+
ProviderError,
|
|
30
|
+
ProviderInitError,
|
|
31
|
+
ProviderNotAvailableError,
|
|
32
|
+
ProviderRunError,
|
|
33
|
+
ProviderRuntimeError,
|
|
34
|
+
ProviderValidationError,
|
|
35
|
+
)
|
|
26
36
|
from .jacobian_contributor import JacobianContributor, ReferenceState
|
|
27
37
|
from .reference_state_registry import ReferenceStateRegistry
|
|
28
38
|
from .registry import get_provider_class, list_providers, register_provider
|
|
@@ -38,4 +48,14 @@ __all__ = [
|
|
|
38
48
|
"ReferenceState",
|
|
39
49
|
"BaseJacobianMixin",
|
|
40
50
|
"ReferenceStateRegistry",
|
|
51
|
+
# Provider error taxonomy
|
|
52
|
+
"ProviderError",
|
|
53
|
+
"ProviderInitError",
|
|
54
|
+
"ProviderNotAvailableError",
|
|
55
|
+
"ProviderRuntimeError",
|
|
56
|
+
"ProviderCleanupError",
|
|
57
|
+
"ProviderValidationError",
|
|
58
|
+
"ProviderConfigError",
|
|
59
|
+
"ProviderRunError",
|
|
41
60
|
]
|
|
61
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Shared simulation-type strategy registry for engine providers.
|
|
2
|
+
|
|
3
|
+
Engine providers such as OpenMC and FESTIM support multiple ``sim_type`` values.
|
|
4
|
+
Each simulation type is implemented as a strategy class that builds the
|
|
5
|
+
engine-specific model for that type. This module provides the shared
|
|
6
|
+
infrastructure so new engines can reuse the same registration pattern.
|
|
7
|
+
|
|
8
|
+
Example::
|
|
9
|
+
|
|
10
|
+
from processforge.providers._sim_strategy import SimStrategy, register_sim_type
|
|
11
|
+
|
|
12
|
+
class MyEngineStrategy(SimStrategy):
|
|
13
|
+
config_model = MyGeometryConfig
|
|
14
|
+
|
|
15
|
+
def build(self, engine_module, solver_cfg, geometry_cfg, materials_map):
|
|
16
|
+
...
|
|
17
|
+
return built_model
|
|
18
|
+
|
|
19
|
+
register_sim_type("my_engine", "my_sim", MyEngineStrategy)
|
|
20
|
+
"""
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from abc import ABC, abstractmethod
|
|
24
|
+
from typing import Any
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class SimStrategy(ABC):
|
|
28
|
+
"""Base class for an engine-specific simulation type.
|
|
29
|
+
|
|
30
|
+
Subclasses declare ``config_model`` — the Pydantic model validating the
|
|
31
|
+
per-strategy ``geometry_config`` block of the flowsheet — and implement
|
|
32
|
+
``build`` to construct the engine model.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
#: Pydantic model validating the unit's ``geometry_config`` block. ``None``
|
|
36
|
+
#: means the strategy takes no geometry config.
|
|
37
|
+
config_model: type | None = None
|
|
38
|
+
|
|
39
|
+
@abstractmethod
|
|
40
|
+
def build(self, **kwargs: Any) -> Any:
|
|
41
|
+
"""Construct the engine model and return engine-specific objects."""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Engine name -> sim_type name -> strategy class
|
|
45
|
+
_SIM_TYPE_REGISTRIES: dict[str, dict[str, type]] = {}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def register_sim_type(engine: str, name: str, strategy_cls: type) -> None:
|
|
49
|
+
"""Register a simulation type for a given engine.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
engine: Engine/provider name (e.g. ``"openmc"``, ``"festim"``).
|
|
53
|
+
name: The ``sim_type`` string used in the flowsheet JSON.
|
|
54
|
+
strategy_cls: A subclass of :class:`SimStrategy`.
|
|
55
|
+
"""
|
|
56
|
+
_SIM_TYPE_REGISTRIES.setdefault(engine, {})[name] = strategy_cls
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def get_registered_sim_types(engine: str) -> dict[str, type]:
|
|
60
|
+
"""Return a copy of the sim_type → strategy mapping for *engine*.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
A dict mapping ``sim_type`` strings to strategy classes.
|
|
64
|
+
"""
|
|
65
|
+
return dict(_SIM_TYPE_REGISTRIES.get(engine, {}))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def get_strategy(engine: str, sim_type: str) -> type | None:
|
|
69
|
+
"""Return the strategy class for (*engine*, *sim_type*), or ``None``."""
|
|
70
|
+
return _SIM_TYPE_REGISTRIES.get(engine, {}).get(sim_type)
|
|
@@ -10,6 +10,7 @@ if TYPE_CHECKING:
|
|
|
10
10
|
FlowsheetConfig,
|
|
11
11
|
MaterialDef,
|
|
12
12
|
ProviderConfig,
|
|
13
|
+
RunContext,
|
|
13
14
|
UnitConfig,
|
|
14
15
|
)
|
|
15
16
|
|
|
@@ -87,6 +88,18 @@ class AbstractProvider(ABC):
|
|
|
87
88
|
def teardown(self) -> None:
|
|
88
89
|
"""Release managed resources (FMU instances, Cantera solutions, etc.)."""
|
|
89
90
|
|
|
91
|
+
def set_run_context(self, context: "RunContext") -> None:
|
|
92
|
+
"""Attach run-level orchestration metadata to this provider instance.
|
|
93
|
+
|
|
94
|
+
Called by the framework before a flowsheet run begins. The default
|
|
95
|
+
implementation is a no-op; providers that produce run-scoped artifacts
|
|
96
|
+
(e.g. the containerized HTTP client) may override this to capture the
|
|
97
|
+
context and forward it as needed.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
context: Run identity and related metadata for this execution.
|
|
101
|
+
"""
|
|
102
|
+
|
|
90
103
|
# ------------------------------------------------------------------
|
|
91
104
|
# Simulation provider interface (optional — override for FEM/neutronics)
|
|
92
105
|
# ------------------------------------------------------------------
|