Skip to content

Commit 187d222

Browse files
authored
various updates (#1883)
* update * update * update * update * iso6976 * adsorption * add oil quality * updates * update * update * update bio * update * update * update * update * add task solving descriptions * well mech desing * update
1 parent ca8cb62 commit 187d222

File tree

19 files changed

+5384
-51
lines changed

19 files changed

+5384
-51
lines changed

.github/copilot-instructions.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# NeqSim AI Guidance for Coding Agents
22

3+
## Quick Orientation
4+
5+
> **Start here:** Read `CONTEXT.md` in the repo root for a 60-second overview of the
6+
> entire codebase — repo map, code patterns, build commands, and constraints.
7+
>
8+
> **Solving a task?** See `docs/development/TASK_SOLVING_GUIDE.md` for the step-by-step
9+
> workflow: classify the task, find similar past solutions, write code, verify, log it.
10+
>
11+
> **Looking for code patterns?** `docs/development/CODE_PATTERNS.md` has copy-paste
12+
> starters for every common task (fluids, flash, equipment, PVT, tests, notebooks).
13+
>
14+
> **Was this solved before?** Search `docs/development/TASK_LOG.md` for keywords.
15+
> Every solved task gets an entry there — check before starting from scratch.
16+
17+
---
18+
319
## ⚠️ CRITICAL: Java 8 Compatibility (READ FIRST)
420

521
**All code MUST compile with Java 8.** The CI build will FAIL if you use Java 9+ features.
@@ -1060,3 +1076,38 @@ fluid.setMultiPhaseCheck(True) # Python bool works
10601076
```
10611077
10621078
---
1079+
1080+
## Task-Solving Workflow (MANDATORY)
1081+
1082+
Every task solved in this repo MUST follow this workflow to build persistent,
1083+
searchable knowledge across sessions.
1084+
1085+
### Before Starting
1086+
1087+
1. Read `CONTEXT.md` for orientation (60 seconds)
1088+
2. Search `docs/development/TASK_LOG.md` for similar past tasks
1089+
3. Classify the task (Type A–F, see `docs/development/TASK_SOLVING_GUIDE.md`)
1090+
4. Find the closest existing code (test, notebook, or source file)
1091+
1092+
### While Working
1093+
1094+
5. Follow patterns from `docs/development/CODE_PATTERNS.md`
1095+
6. Verify using the checklist in `docs/development/TASK_SOLVING_GUIDE.md`
1096+
7. Use the appropriate Copilot Chat agent (see `.github/agents/`)
1097+
1098+
### After Completing
1099+
1100+
8. **Always** add an entry to `docs/development/TASK_LOG.md` with:
1101+
- Date, title, task type, keywords, solution location, and notes
1102+
9. If the solution is reusable: write a test, notebook, or doc page
1103+
10. If you discovered a new pattern: add it to `docs/development/CODE_PATTERNS.md`
1104+
1105+
### Task Log Entry Format
1106+
1107+
```markdown
1108+
### YYYY-MM-DD — Short task title
1109+
**Type:** A (Property) | B (Process) | C (PVT) | D (Standards) | E (Feature) | F (Design)
1110+
**Keywords:** comma, separated, search, terms
1111+
**Solution:** path/to/test/or/notebook
1112+
**Notes:** Key decisions, gotchas, or results
1113+
```

CONTEXT.md

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
# NeqSim — Fast Context for Task Solving
2+
3+
> **Purpose:** Get oriented in 60 seconds. This file is the single entry point for anyone
4+
> (human or AI) solving engineering tasks inside the NeqSim repo.
5+
6+
## What Is NeqSim?
7+
8+
Java library for thermodynamic fluid properties and process simulation.
9+
Developed at NTNU, maintained by Equinor. Apache-2.0 license.
10+
`com.equinor.neqsim:neqsim` version 3.4.0 — **must compile with Java 8**.
11+
12+
## Repo Map
13+
14+
```
15+
src/main/java/neqsim/
16+
thermo/system/ 60 EOS classes (SystemSrkEos, SystemPrEos, ...)
17+
thermo/phase/ Phase implementations
18+
thermodynamicoperations/ Flash calculations (TP, PH, PS, dew, bubble)
19+
physicalproperties/ Density, viscosity, conductivity, surface tension
20+
process/equipment/ 33 equipment packages:
21+
stream/ separator/ compressor/ pump/ valve/ heatexchanger/
22+
pipeline/ distillation/ mixer/ splitter/ expander/ reactor/
23+
well/ reservoir/ membrane/ ejector/ filter/ flare/ ...
24+
process/processmodel/ ProcessSystem — the flowsheet orchestrator
25+
pvtsimulation/ CME, CVD, DL, saturation, GOR, swelling, MMP
26+
standards/ Gas quality, oil quality, sales contracts
27+
fluidmechanics/ Pipeline hydraulics
28+
chemicalreactions/ Reaction equilibrium/kinetics
29+
statistics/ Parameter fitting, Monte Carlo
30+
util/ Validation, exceptions, named interfaces
31+
32+
src/test/java/neqsim/ Mirrors production structure. JUnit 5. Extend NeqSimTest.
33+
src/main/resources/ Component databases, design data CSVs
34+
examples/notebooks/ 28+ Jupyter notebooks
35+
docs/ 350+ markdown files, Jekyll site
36+
.github/agents/ 12 Copilot Chat agents (thermo, process, test, PVT, ...)
37+
devtools/ neqsim_dev_setup.py for Jupyter development
38+
```
39+
40+
## Build & Test (30 seconds)
41+
42+
```powershell
43+
# Full build
44+
.\mvnw.cmd install
45+
46+
# Tests only
47+
.\mvnw.cmd test
48+
49+
# Single test class
50+
.\mvnw.cmd test -Dtest=SeparatorTest
51+
52+
# Single test method
53+
.\mvnw.cmd test -Dtest=SeparatorTest#testTwoPhase
54+
55+
# Skip slow tests (default)
56+
.\mvnw.cmd test # excludes @Tag("slow")
57+
.\mvnw.cmd test -DexcludedTestGroups= # runs everything
58+
59+
# Static analysis
60+
.\mvnw.cmd checkstyle:check spotbugs:check pmd:check
61+
62+
# Package JAR + copy to Python
63+
.\mvnw.cmd package -DskipTests
64+
Copy-Item target\neqsim-3.3.0.jar C:\Users\ESOL\AppData\Roaming\Python\Python312\site-packages\neqsim\lib\java11\ -Force
65+
```
66+
67+
## Code Patterns — Copy-Paste Starters
68+
69+
### Create a Fluid
70+
71+
```java
72+
SystemInterface fluid = new SystemSrkEos(273.15 + 25.0, 60.0); // T in Kelvin, P in bara
73+
fluid.addComponent("methane", 0.85);
74+
fluid.addComponent("ethane", 0.10);
75+
fluid.addComponent("propane", 0.05);
76+
fluid.setMixingRule("classic"); // NEVER skip this
77+
```
78+
79+
### Run a Flash
80+
81+
```java
82+
ThermodynamicOperations ops = new ThermodynamicOperations(fluid);
83+
ops.TPflash();
84+
fluid.init(3); // full property init after flash
85+
double density = fluid.getDensity("kg/m3");
86+
double viscosity = fluid.getPhase("gas").getViscosity("kg/msec");
87+
```
88+
89+
### Build a Process
90+
91+
```java
92+
ProcessSystem process = new ProcessSystem();
93+
94+
Stream feed = new Stream("feed", fluid);
95+
feed.setFlowRate(50000.0, "kg/hr");
96+
feed.setTemperature(30.0, "C");
97+
feed.setPressure(60.0, "bara");
98+
process.add(feed);
99+
100+
Separator sep = new Separator("HP Sep", feed);
101+
process.add(sep);
102+
103+
Compressor comp = new Compressor("Compressor", sep.getGasOutStream());
104+
comp.setOutletPressure(120.0, "bara");
105+
process.add(comp);
106+
107+
process.run();
108+
System.out.println("Compressor power: " + comp.getPower("kW") + " kW");
109+
```
110+
111+
### Write a Test
112+
113+
```java
114+
public class MyFeatureTest extends neqsim.NeqSimTest {
115+
@Test
116+
void testSomething() {
117+
// 1. Create fluid
118+
// 2. Build process
119+
// 3. process.run()
120+
// 4. Assert on physical outputs
121+
assertEquals(expected, actual, tolerance);
122+
}
123+
}
124+
```
125+
126+
### Jupyter Notebook (Python)
127+
128+
```python
129+
from neqsim import jneqsim
130+
SystemSrkEos = jneqsim.thermo.system.SystemSrkEos
131+
Stream = jneqsim.process.equipment.stream.Stream
132+
# ... see devtools/neqsim_dev_setup.py for local dev workflow
133+
```
134+
135+
## EOS Selection Quick Reference
136+
137+
| Fluid Type | Class | Mixing Rule |
138+
|------------|-------|-------------|
139+
| Dry/lean gas | `SystemSrkEos` | `"classic"` |
140+
| Oil systems | `SystemPrEos` | `"classic"` |
141+
| Water/MEG/methanol | `SystemSrkCPAstatoil` | `10` |
142+
| Fiscal metering | `SystemGERG2008Eos` ||
143+
| Electrolytes | `SystemElectrolyteCPAstatoil` | `10` |
144+
145+
## Equipment Package → Class Cheat Sheet
146+
147+
| Equipment | Package | Key Class |
148+
|-----------|---------|-----------|
149+
| Stream | `stream` | `Stream`, `EquilibriumStream` |
150+
| Separator | `separator` | `Separator`, `ThreePhaseSeparator` |
151+
| Compressor | `compressor` | `Compressor` |
152+
| Pump | `pump` | `Pump` |
153+
| Valve | `valve` | `ThrottlingValve` |
154+
| Heat exchanger | `heatexchanger` | `Cooler`, `Heater`, `HeatExchanger` |
155+
| Pipeline | `pipeline` | `AdiabaticPipe`, `PipeBeggsAndBrills` |
156+
| Mixer | `mixer` | `Mixer` |
157+
| Splitter | `splitter` | `Splitter` |
158+
| Distillation | `distillation` | `DistillationColumn` |
159+
| Expander | `expander` | `Expander` |
160+
| Ejector | `ejector` | `Ejector` |
161+
| Well | `well` | `SimpleWell` |
162+
| Recycle | `util` | `Recycle` |
163+
| Adjuster | `util` | `Adjuster` |
164+
165+
Full package path: `neqsim.process.equipment.<package>.<Class>`
166+
167+
## Where to Find Things
168+
169+
| I need to... | Look in... |
170+
|-------------|-----------|
171+
| Pick an EOS | `src/main/java/neqsim/thermo/system/` |
172+
| Add equipment | `src/main/java/neqsim/process/equipment/<type>/` |
173+
| Run a PVT experiment | `src/main/java/neqsim/pvtsimulation/simulation/` |
174+
| Check gas quality | `src/main/java/neqsim/standards/gasquality/` |
175+
| See a working example | `examples/notebooks/` or `src/test/java/neqsim/process/` |
176+
| Read documentation | `docs/wiki/` (60+ topics) or `docs/REFERENCE_MANUAL_INDEX.md` |
177+
| Use an AI agent | `.github/agents/` (12 specialist agents) |
178+
| Set up Jupyter dev | `devtools/neqsim_dev_setup.py` |
179+
| Find design data | `src/main/resources/designdata/` |
180+
| Component database | `src/main/resources/` |
181+
182+
## Key Constraints
183+
184+
- **Java 8 only** — no `var`, `List.of()`, `Map.of()`, `String.repeat()`, text blocks, records
185+
- **Temperature in Kelvin** — constructors take `(T_kelvin, P_bara)`
186+
- **Always set mixing rule** — simulations fail silently without it
187+
- **Unique equipment names**`ProcessSystem` enforces unique names
188+
- **Clone before branching**`fluid.clone()` to avoid shared state
189+
- **Google Java Style** — 2-space indent, checkstyle enforced
190+
191+
## Deeper Context
192+
193+
| Topic | File |
194+
|-------|------|
195+
| Full AI coding instructions | `.github/copilot-instructions.md` |
196+
| Task-solving workflow | `docs/development/TASK_SOLVING_GUIDE.md` |
197+
| Solved task history | `docs/development/TASK_LOG.md` |
198+
| Developer setup | `docs/development/DEVELOPER_SETUP.md` |
199+
| Module architecture | `docs/modules.md` |
200+
| Contributing guide | `CONTRIBUTING.md` |
201+
| All documentation index | `docs/REFERENCE_MANUAL_INDEX.md` |

docs/REFERENCE_MANUAL_INDEX.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ Fluid characterization handles plus fraction splitting, property estimation, and
358358
| **Subsea Boosters** | [docs/process/equipment/subsea_boosters.md](process/equipment/subsea_boosters) | **Subsea pumps & compressors, helico-axial/multiphase, performance curves** |
359359
| **Umbilicals** | [docs/process/equipment/umbilicals.md](process/equipment/umbilicals) | **Control umbilicals: hydraulic, electrical, chemical injection lines** |
360360
| **SURF Subsea Equipment** | [docs/process/SURF_SUBSEA_EQUIPMENT.md](process/SURF_SUBSEA_EQUIPMENT) | **Comprehensive SURF equipment: PLET, PLEM, manifolds, trees, jumpers, umbilicals, flexible pipes, boosters with mechanical design and cost estimation** |
361+
| **Well Mechanical Design** | [docs/process/well_mechanical_design.md](process/well_mechanical_design) | **Subsea well casing/tubing design, barrier verification per NORSOK D-010/API 5CT, drilling cost estimation** |
361362

362363
### Chapter 20: Utility Equipment
363364

@@ -419,6 +420,7 @@ Fluid characterization handles plus fraction splitting, property estimation, and
419420
| **Riser Mechanical Design** | [docs/process/riser_mechanical_design.md](process/riser_mechanical_design) | **Riser design with catenary mechanics, VIV, fatigue per DNV-OS-F201** |
420421
| **Pipeline Design Math** | [docs/process/pipeline_mechanical_design_math.md](process/pipeline_mechanical_design_math) | **Mathematical methods and formulas for pipeline design** |
421422
| **Subsea SURF Mechanical Design** | [docs/process/SURF_SUBSEA_EQUIPMENT.md#mechanical-design](process/SURF_SUBSEA_EQUIPMENT#mechanical-design) | **Mechanical design for PLET, PLEM, trees, manifolds, jumpers, umbilicals, flexible pipes, boosters per DNV, API, ISO, NORSOK** |
423+
| **Well Mechanical Design** | [docs/process/well_mechanical_design.md](process/well_mechanical_design) | **Subsea well casing/tubing design per NORSOK D-010 and API 5CT/Bull 5C3 with barrier verification and cost estimation** |
422424
| **Equipment Datasheet Generator** | [docs/process/equipment_datasheets.md](process/equipment_datasheets) | **Structured JSON equipment datasheets from process simulation (separator, compressor, heater, valve)** |
423425
| **Dual EoS Comparison** | [docs/process/dual_eos_comparison.md](process/dual_eos_comparison) | **SRK vs PR78 cross-check per TR1244 for field development QA** |
424426
| TORG Integration | [docs/process/torg_integration.md](process/torg_integration) | TORG integration |

0 commit comments

Comments
 (0)