NeqSim Project Structure Recommendations
This document provides actionable recommendations to improve the NeqSim project structure, addressing clarity, discoverability, and maintainability.
1. Root Directory Organization
Current State
- Issue: 20+ configuration and documentation files at root level create clutter
- Impact: Harder to find core files (README, pom.xml, source code)
Recommendations
A. Group Configuration Files
Create a .config/ directory for build/formatting configurations:
mkdir .config
git mv checkstyle_neqsim.xml .config/
git mv eclipse-java-google-style.xml .config/
git mv neqsim_formatter.xml .config/
git mv settings.xml .config/
Update references in:
pom.xml→<checkstyle.config.location>.config/checkstyle_neqsim.xml</checkstyle.config.location>CONTRIBUTING.md→ Update paths in setup instructions.vscode/settings.json→ Update formatter URLs if needed
B. Group POM Variants
Current: pom.xml, pomJava8.xml, pomJava21.xml, dependency-reduced-pom.xml all at root
Recommendation: Add a README_POMS.md at root explaining:
# POM Files in NeqSim
- **pom.xml** - Main build file (Java 8 target, Maven 3.6+)
- **pomJava8.xml** - Java 8 explicit profile (CI/legacy builds)
- **pomJava21.xml** - Java 21 testing profile (internal only, not published)
- **dependency-reduced-pom.xml** - Generated by maven-shade-plugin (do not edit)
For normal development, use `pom.xml` only. See docs/development/BUILD.md for details.
C. Document Cleanup Scripts
Issue: Root has scripts like _update_report.py without clear documentation
Recommendation: Create scripts/ directory:
mkdir scripts
git mv _update_report.py scripts/
Add scripts/README.md:
# Scripts Directory
- **update_report.py** - Regenerate metrics badges for README.md
- Usage: `python scripts/update_report.py`
- Run after: Security/dependency updates
See individual script headers for usage details.
2. AI Agent Organization
Current State
- Issue: 13 agents in
.github/agents/with inconsistent namingprocess.model.agent.mdvsprocessmodel.agent.md(duplicates?)AGENTS.mdand.github/copilot-instructions.mdduplicate ~60% content
Recommendations
A. Consolidate Duplicate Agents
Check if these are duplicates and merge:
process.model.agent.md↔️processmodel.agent.md
Action:
# Compare content
diff .github/agents/process.model.agent.md .github/agents/processmodel.agent.md
# If identical or mergeable, keep one canonical name
git mv .github/agents/processmodel.agent.md .github/agents/process.model.agent.md
B. Agent Naming Convention
Establish consistent naming: <domain>.<action>.agent.md
Recommended renames:
✓ Good: solve.task.agent.md, thermo.fluid.agent.md
✓ Good: flow.assurance.agent.md, gas.quality.agent.md
✓ Rename: processmodel.agent.md → process.model.agent.md
C. Reduce Documentation Duplication
Current: AGENTS.md (root) and .github/copilot-instructions.md share large sections
Recommendation: Single-source principle
- Keep
AGENTS.mdas external-facing (for OpenAI Codex, Claude, standalone agents) - Keep
.github/copilot-instructions.mdas VS Code Copilot-specific (tool restrictions, UI patterns) - Extract shared content to
docs/development/AI_AGENT_REFERENCE.md:- Code patterns
- Java 8 compatibility rules
- API verification rules
- JavaDoc standards
Then both files import the reference:
<!-- In AGENTS.md -->
## Code Patterns
See [AI Agent Reference](docs/development/AI_AGENT_REFERENCE.md#code-patterns) for copy-paste starters.
<!-- In .github/copilot-instructions.md -->
<instructions>
Include: docs/development/AI_AGENT_REFERENCE.md
</instructions>
D. Agent Index File
Create .github/agents/README.md:
# NeqSim Copilot Agents
This directory contains specialized GitHub Copilot Chat agents for NeqSim development.
## Available Agents
| Agent | Command | Purpose |
|-------|---------|---------|
| **solve.task** | `@solve.task <description>` | End-to-end task solving with report generation |
| **thermo.fluid** | `@thermo.fluid <description>` | Create thermodynamic fluid systems |
| **process.model** | `@process.model <description>` | Build process simulations |
| **pvt.simulation** | `@pvt.simulation <description>` | Run PVT lab tests (CME, CVD, DL) |
| **flow.assurance** | `@flow.assurance <description>` | Hydrate, wax, asphaltene, corrosion |
| **gas.quality** | `@gas.quality <description>` | ISO 6976, sales specs, gas quality |
| **mechanical.design** | `@mechanical.design <description>` | ASME/API/DNV mechanical design |
| **safety.depressuring** | `@safety.depressuring <description>` | Blowdown, PSV sizing, fire case |
| **neqsim.test** | `@neqsim.test <description>` | Create JUnit 5 unit tests |
| **notebook.example** | `@notebook.example <description>` | Create Jupyter notebook examples |
| **documentation** | `@documentation <description>` | Write/update markdown docs |
## Usage
In VS Code Copilot Chat:
@solve.task 3-stage compression with intercooling from 5 to 150 bara
See the [AGENTS.md](../../AGENTS.md) file in the repo root for detailed documentation.
3. Examples Directory Structure
Current State
examples/
├── CNGtankmodelling/ # Single-task folder
├── neqsim/ # Generic folder (unclear purpose)
├── notebooks/ # 28+ mixed notebooks
└── sulfurtask/ # Single-task folder
Recommendations
A. Reorganize by Category
Create topical subdirectories for better discoverability:
examples/
├── README.md # NEW - index of all examples
├── notebooks/
│ ├── 01_quickstart/ # NEW - beginner examples
│ │ ├── 01_first_flash.ipynb
│ │ ├── 02_simple_separator.ipynb
│ │ └── README.md
│ ├── 02_thermodynamics/ # NEW - thermo examples
│ │ ├── phase_envelope.ipynb
│ │ ├── hydrate_prediction.ipynb
│ │ └── README.md
│ ├── 03_process_simulation/ # NEW - process examples
│ │ ├── teg_dehydration.ipynb
│ │ ├── compression_train.ipynb
│ │ └── README.md
│ ├── 04_pvt_analysis/ # NEW - PVT examples
│ │ ├── cme_test.ipynb
│ │ ├── cvd_test.ipynb
│ │ └── README.md
│ ├── 05_field_development/ # NEW - subsea/field dev
│ │ ├── subsea_tieback.ipynb
│ │ ├── well_design.ipynb
│ │ └── README.md
│ ├── 06_standards/ # NEW - standards examples
│ │ ├── iso6976_calorific_value.ipynb
│ │ └── README.md
│ └── 07_advanced/ # NEW - advanced topics
│ ├── custom_eos.ipynb
│ └── README.md
├── java/ # NEW - standalone Java examples
│ ├── quickstart/
│ │ ├── FirstFlash.java
│ │ └── README.md
│ ├── process/
│ │ ├── TEGDehydrationExample.java
│ │ └── README.md
│ └── pvt/
│ └── CMETestExample.java
└── case_studies/ # RENAMED from CNGtankmodelling, sulfurtask
├── cng_tank_thermal_analysis/ # RENAMED
│ └── README.md
└── sulfur_deposition/ # RENAMED
└── README.md
B. Create Examples Index
Create examples/README.md:
# NeqSim Examples
This directory contains Jupyter notebooks, Java examples, and case studies demonstrating NeqSim capabilities.
## Quick Start (5 minutes)
- [First TPflash](notebooks/01_quickstart/01_first_flash.ipynb) - Your first fluid calculation
- [Simple Separator](notebooks/01_quickstart/02_simple_separator.ipynb) - Basic process equipment
## By Topic
### Thermodynamics
- Phase envelopes, flash calculations, physical properties
- See [notebooks/02_thermodynamics/](notebooks/02_thermodynamics/)
### Process Simulation
- Separators, compressors, heat exchangers, complete flowsheets
- See [notebooks/03_process_simulation/](notebooks/03_process_simulation/)
### PVT Analysis
- CME, CVD, differential liberation, swelling tests
- See [notebooks/04_pvt_analysis/](notebooks/04_pvt_analysis/)
### Field Development
- Subsea wells, pipelines, SURF cost estimation
- See [notebooks/05_field_development/](notebooks/05_field_development/)
### Standards & Compliance
- ISO 6976 calorific values, gas quality specifications
- See [notebooks/06_standards/](notebooks/06_standards/)
## Java Examples
Standalone Java programs you can copy-paste into your projects:
- [java/quickstart/](java/quickstart/) - Getting started
- [java/process/](java/process/) - Process simulation
- [java/pvt/](java/pvt/) - PVT calculations
## Case Studies
Complete worked examples from real projects:
- [CNG Tank Thermal Analysis](case_studies/cng_tank_thermal_analysis/)
- [Sulfur Deposition in Gas Pipelines](case_studies/sulfur_deposition/)
See also:
- [Documentation Examples](../docs/examples/) - Documentation-embedded examples
- [Test Examples](https://github.com/equinor/neqsim/tree/master/src/test/java/neqsim/) - Unit test examples
4. Task Solve Directory
Current State
- Issue:
task_solve/accumulates folders (7 visible, unknown total) - Gitignored, so no version control, but grows indefinitely
- No cleanup guidance
Recommendations
A. Add Cleanup Documentation
Create task_solve/README.md section:
## Housekeeping
The `task_solve/` directory is gitignored (your local work area). Clean it periodically:
### After Completing a Task
1. **Promote reusable outputs** to the main repo:
- Tests → `src/test/java/neqsim/`
- Notebooks → `examples/notebooks/`
- Docs → Appropriate docs/ subfolder
- Add task log entry → `docs/development/TASK_LOG.md`
2. **Archive or delete the task folder**:
- Keep if ongoing or reference needed
- Delete if outputs promoted and no longer needed
### Cleanup Old Tasks
```powershell
# List tasks older than 30 days
Get-ChildItem task_solve -Directory | Where-Object {$_.CreationTime -lt (Get-Date).AddDays(-30)}
# Archive to task_solve/archive/
New-Item -ItemType Directory -Path task_solve/archive -Force
Get-ChildItem task_solve -Directory | Where-Object {$_.CreationTime -lt (Get-Date).AddDays(-30)} | Move-Item -Destination task_solve/archive/
# Or delete completed tasks
Get-ChildItem task_solve -Directory -Exclude "TASK_TEMPLATE","archive" | Remove-Item -Recurse
#### B. Add Size Monitoring
Add to `devtools/new_task.py`:
```python
def check_task_solve_size():
"""Warn if task_solve/ exceeds 1GB"""
task_dir = Path("task_solve")
if not task_dir.exists():
return
total_size = sum(f.stat().st_size for f in task_dir.rglob('*') if f.is_file())
size_gb = total_size / (1024**3)
if size_gb > 1.0:
print(f"\n⚠️ Warning: task_solve/ is {size_gb:.2f}GB")
print("Consider archiving or deleting old tasks:")
print(" See task_solve/README.md for cleanup instructions\n")
5. Documentation Structure
Current State
- Excellent structure with
REFERENCE_MANUAL_INDEX.md - Some duplication between
docs/wiki/,docs/tutorials/,docs/examples/
Recommendations
A. Clarify Documentation Purpose
Add to docs/README.md:
# Documentation Structure
NeqSim documentation is organized by **purpose and audience**:
## By Audience
| Directory | Audience | Content Type |
|-----------|----------|--------------|
| `quickstart/` | **New users** | 5-minute getting started guides |
| `tutorials/` | **Learning** | Step-by-step hands-on tutorials (30-120 min) |
| `examples/` | **Reference** | Short code snippets showing specific features |
| `wiki/` | **Concepts** | Explanatory articles on how things work |
| `development/` | **Contributors** | Developer guides, patterns, workflows |
| `manual/` | **API Reference** | Generated API documentation |
## By Topic
- `thermo/` - Thermodynamics and equations of state
- `process/` - Process equipment and flowsheets
- `pvtsimulation/` - PVT lab tests
- `standards/` - Industry standards (ISO, API, NORSOK)
- `fielddevelopment/` - Subsea, wells, field economics
- `troubleshooting/` - Common issues and solutions
## Finding What You Need
1. **New to NeqSim?** → Start with [quickstart/index.md](quickstart/index.md)
2. **Want to learn X?** → Check [tutorials/index.md](tutorials/index.md)
3. **Need code for Y?** → Search [examples/](examples/) or GitHub grep
4. **Understand concept Z?** → Read [wiki/](wiki/)
5. **Contributing code?** → Follow [development/](development/)
For a complete file index, see [REFERENCE_MANUAL_INDEX.md](REFERENCE_MANUAL_INDEX.md).
B. Deprecate or Merge Overlapping Content
Audit these for overlaps:
docs/wiki/getting_started.mdvsdocs/quickstart/java-quickstart.md- Recommendation: Keep quickstart as canonical, link from wiki
docs/examples/vsexamples/notebooks/- Recommendation:
docs/examples/for code snippets in docs,examples/notebooks/for runnable notebooks
- Recommendation:
6. Test Organization
Current State
- Good: Tests mirror
src/main/javastructure - Missing: Test documentation explaining organization
Recommendations
A. Add Test Documentation
Create src/test/java/neqsim/README.md:
# NeqSim Test Suite
This directory contains JUnit 5 unit tests mirroring the production code structure.
## Organization
Tests are organized to match `src/main/java/neqsim/`:
src/test/java/neqsim/ ├── NeqSimTest.java # Base test class (all tests extend this) ├── thermo/ # Thermodynamics tests ├── process/ # Process equipment tests ├── pvtsimulation/ # PVT test simulations ├── standards/ # Standards compliance tests └── … # Other packages
## Running Tests
```bash
# All tests
./mvnw test
# Single test class
./mvnw test -Dtest=SeparatorTest
# Single test method
./mvnw test -Dtest=SeparatorTest#testTwoPhase
# Exclude slow tests (default)
./mvnw test
# Include slow tests
./mvnw test -DexcludedTestGroups=
Writing Tests
- Extend NeqSimTest: All tests should extend this base class
- Mirror package structure: Place tests in the same package as the code under test
- Test naming:
<ClassName>Test.java(e.g.,SeparatorTest.java) - Method naming: Descriptive test names (e.g.,
testTwoPhaseFlashWithWater())
See the wiki test overview for detailed testing guidelines.
#### B. Tag Slow Tests Consistently
Ensure all tests >10 seconds are tagged:
```java
@Tag("slow")
@Test
void testLongRunningSimulation() {
// ...
}
7. Build Configuration Clarity
Current State
- Multiple POM files without clear documentation
- Build commands scattered across README, CONTEXT.md, CONTRIBUTING.md
Recommendations
A. Create Build Reference
Create docs/development/BUILD.md:
# Building NeqSim
## Quick Commands
```powershell
# Windows
.\mvnw.cmd clean install # Full build
.\mvnw.cmd test # Tests only
.\mvnw.cmd package -DskipTests # JAR without tests
# Linux/Mac
./mvnw clean install
./mvnw test
./mvnw package -DskipTests
Maven Wrapper
NeqSim uses Maven Wrapper (mvnw/mvnw.cmd) for consistent builds across environments.
Advantages:
- No need to install Maven separately
- Guaranteed Maven version (defined in
.mvn/wrapper/maven-wrapper.properties) - Works on any system with Java installed
POM Files Explained
| File | Purpose |
|---|---|
pom.xml |
Main build file (use this for all development) |
pomJava8.xml |
Java 8 compatibility testing profile |
pomJava21.xml |
Java 21 testing profile (internal experiments) |
dependency-reduced-pom.xml |
Auto-generated by shade plugin (do not edit) |
Normal development uses pom.xml only.
Build Profiles
# Default (Java 8 target)
./mvnw install
# Skip tests
./mvnw install -DskipTests
# Include slow tests
./mvnw test -DexcludedTestGroups=
# Static analysis
./mvnw checkstyle:check spotbugs:check pmd:check
Troubleshooting
Build fails with “package does not exist”:
- Run
./mvnw clean compileto regenerate classes
Tests fail intermittently:
- Some tests are tagged
@Tag("slow")and may have timing dependencies - Run with
-DexcludedTestGroups=to include them
JAR not updating in Python:
.\mvnw.cmd package -DskipTests
Copy-Item target\neqsim-3.5.0.jar $env:APPDATA\Python\Python312\site-packages\neqsim\lib\java11\ -Force
See CONTRIBUTING.md for code style and formatting setup.
#### B. Consolidate Build Commands
Update `CONTEXT.md` to reference `docs/development/BUILD.md`:
```markdown
## Build & Test (30 seconds)
See [docs/development/BUILD.md](docs/development/BUILD.md) for complete build reference.
Quick commands:
```powershell
.\mvnw.cmd install # Full build
.\mvnw.cmd test -Dtest=SeparatorTest # Single test class
8. Developer Onboarding Path
Current Issue
- New contributors have to piece together information from:
- README.md
- CONTRIBUTING.md
- CONTEXT.md
- docs/development/ (multiple files)
Recommendation: Create Developer Journey Map
Create docs/development/GETTING_STARTED_DEVELOPER.md:
# Getting Started as a NeqSim Developer
**Goal**: From `git clone` to first contribution in 30 minutes.
## Step 1: Environment Setup (5 min)
### Prerequisites
- Java 8+ (JDK, not just JRE)
- Git
- (Optional) VS Code with Java extensions
### Clone and Build
```bash
git clone https://github.com/equinor/neqsim.git
cd neqsim
./mvnw clean install # First build (downloads deps, ~2 min)
./mvnw test # Verify tests pass
Troubleshooting: See BUILD.md
Step 2: Understand Project Structure (10 min)
Read in order:
- CONTEXT.md - 60-second repo overview
- modules.md - Package architecture
- This file - Developer-specific workflows
Key directories:
src/main/java/neqsim/ # Production code
src/test/java/neqsim/ # Unit tests (mirrors main/)
docs/ # Documentation
examples/notebooks/ # Jupyter examples
task_solve/ # Your local work area (gitignored)
Step 3: Pick Your Path (choose one)
A. Fix a Bug or Add Feature
- Check GitHub Issues
- Comment on the issue to claim it
- Create a branch:
git checkout -b fix/issue-123 - Make changes following CODE_PATTERNS.md
- Add tests (mirror structure in
src/test/) - Submit PR using template
B. Solve an Engineering Task
- Use AI workflow: TASK_SOLVING_GUIDE.md
- Or manually:
neqsim new-task "Your task description" - Work through steps 1-3 in
task_solve/<your_task>/ - Promote useful outputs to main repo
C. Write Documentation
- Find gaps or errors in
docs/ - Use AI agent:
@documentationin Copilot Chat - Follow documentation agent guidelines
- Update REFERENCE_MANUAL_INDEX.md
D. Add Examples
- Create Jupyter notebook or Java example
- Follow notebook agent pattern
- Add to examples/ in appropriate category
- Update
examples/README.md
Step 4: Code Style and Validation
Format Code (automatic in VS Code)
Settings in CONTRIBUTING.md
Before Committing
# Run checks
./mvnw checkstyle:check spotbugs:check pmd:check
# Run tests
./mvnw test
# If you modified documentation
cd docs && python generate_manual.py
Step 5: Submit Your Contribution
- Push branch:
git push -u origin your-branch-name - Create PR: Use GitHub UI or
gh pr create - Fill template: Include:
- What changed
- Why (link to issue if applicable)
- Testing performed
- Docs updated (if relevant)
- Respond to reviews: CI runs tests, reviewers check code
- Merge: After approval, squash & merge
Common Workflows
Update Your Branch
git fetch origin
git rebase origin/master # Or merge if you prefer
Run Specific Tests
./mvnw test -Dtest=SeparatorTest#testTwoPhase
Debug in IDE
- VS Code: See .vscode/launch.json
- Eclipse: Import as Maven project
- IntelliJ IDEA: Import as Maven project
Getting Help
- Questions: GitHub Discussions
- Bugs: GitHub Issues
- Code Review: Tag
@equinor/neqsim-maintainersin PR
Next Steps
- Explore Code Patterns - Copy-paste starters
- Read Task Log - Past solutions
- Try AI Agents - Automate common tasks ```
Implementation Priority
Implement in this order for maximum impact:
Phase 1: Documentation (Low Risk, High Value)
- ✅ Create
examples/README.mdindex - ✅ Create
docs/development/BUILD.md - ✅ Create
docs/development/GETTING_STARTED_DEVELOPER.md - ✅ Add
task_solve/README.mdcleanup section - ✅ Add
.github/agents/README.mdindex
Phase 2: File Reorganization (Medium Risk)
- ✅ Create
.config/and move config files (update refs in pom.xml, CONTRIBUTING.md) - ✅ Create
scripts/and move utility scripts - ✅ Consolidate duplicate agents (check content first)
- ✅ Reorganize
examples/notebooks/into categorized folders
Phase 3: Content Consolidation (Higher Risk)
- ✅ Extract shared content to
docs/development/AI_AGENT_REFERENCE.md - ✅ Update
AGENTS.mdand.github/copilot-instructions.mdto reference it - ✅ Audit and merge overlapping docs (wiki vs quickstart)
Success Metrics
After implementation, validate improvements:
- ✅ Discoverability: New users can find their first example in <2 minutes
- ✅ Onboarding: Contributors make first PR in <30 minutes
- ✅ Maintenance: Config file changes require updating only 1-2 places (not 5+)
- ✅ Clarity: Purpose of each directory is obvious from its README
Maintenance
Once structure is improved:
- Document in CONTRIBUTING.md: “Where to put new files”
- Add to PR template: Checklist for updating relevant READMEs
- Quarterly review: Check
task_solve/size,examples/organization - Update this doc: As new patterns emerge
Questions or suggestions? Open a GitHub Discussion.