π Week 2
June 16β18, 2026 β’ + July 18, 2026
June 16, 2026
Updates
Website visual explainer: I made this website visual explainer using the visual annotator tool.
Lit review (nvPM emissions test campaigns): I was trying to use an agent to do a lit review of nvPM emissions test campaigns. That process clarified a key constraint for building a thrust-normalized dataset: sources need real engine/flight thrust values (idle ~15%, cruise ~85%, max ~100%). Many combustor rig studies report power settings or equivalence ratio instead of thrust, which makes them difficult to normalize and less useful for this specific model.
Conversation summary: Literature Review Strategy Pivot (June 16, 2026)
Literature classification
β Keep β papers with real engine/flight thrust data
- Voigt 2024 β ECLIF2 flight campaign; Airbus A350 (Rolls-Royce Trent XWB-84); thrust: 85% cruise; status: data already extracted.
- Durdina series (2019β2021) β real engine/APU tests; expected: 35β55 data points; likely to have thrust settings documented.
- AAFEX campaign (Moore et al.) β real engines with documented thrust data; expected: 20β40+ data points; access: NASA NTRS (fully public).
- SAMPLE campaign (Benito et al. 2025) β multi-year program with real engine testing; likely has thrust documentation; expected: 20β30 data points.
- Flight campaign series β ECLIF, A-PRIDE, ACCESS; flight-based data with real thrust values; lead authors include Voigt (ECLIF) and Brem (A-PRIDE).
β Deprioritize β lab combustor rigs without thrust data
- Harper 2022 β RQL combustor (no real thrust)
- Harper 2024 β RQL combustor (no real thrust)
- Smith 2024 β combustor rig (no real thrust)
- Brem 2015 β lab-based (likely combustor, not flight)
- Gierens 2024 β literature review (may primarily cite rig data)
Action items
- Reprioritize search strategy: focus on AAFEX, ECLIF, SAMPLE campaigns first.
- Search NASA NTRS for AAFEX Moore et al. complete data.
- Search DLR/ACP for ECLIF Voigt and Schripp papers with flight thrust data.
- Check Cardiff ORCA for SAMPLE Benito 2025 deliverable.
Search queries to try
Google Scholar:
- "AAFEX" "Moore" nvPM hydrogen site:ntrs.nasa.gov
- site:acp.copernicus.org "Voigt" ECLIF nvPM fuel
- "SAMPLE campaign" hydrogen content site:ntrs.nasa.gov
- "A-PRIDE" Brem aromatic emissions
ResearchGate:
- Ulrich Voigt (ECLIF lead)
- Mark Moore (AAFEX lead)
Expected data yield (revised plan)
- Voigt 2024: 1 point (done)
- Durdina 2019β2021: 35β55 points
- AAFEX campaign: 20β40 points
- SAMPLE campaign: 20β30 points
- ECLIF/A-PRIDE/ACCESS campaigns: 30β50 points
Total realistic: 106β176 points with real thrust values.
Next steps
- Create revised literature priority list focused on engine/flight campaigns.
- Design project visualization showing literature β data extraction β model improvement.
- Begin AAFEX search (highest expected yield per hour of work).
- Verify paper types before extracting (confirm thrust documentation).
Notes
- Lab rig data isnβt uselessβjust not suitable for this modelβs thrust normalization needs.
- Combustor studies might be useful later for different analysis (e.g., fuel composition trends without thrust normalization).
- Flight campaign data is βgoldβ: real-world conditions + thrust documentation = cleanest data.
July 18, 2026
Seal swell analysis: I used ChatGPT Deep Research to draft a short technical writeup: Seal Swell After Aromatic Saturation in Hydrotreated Jet Fuel (PDF).
I also worked on seal_swell_analysis with pi to build a regression workflow modeling O-ring swell as a function of fuel composition (aromatics, N-/iso-paraffins, cyclo-paraffins), comparing linear / ridge / lasso and random forest baselines.
June 18, 2026
Working with the Improve Codebase Architecture skill: I used the architecture deepening skill to review the refinery_process_model code and identify refactors that improve testability and AI navigability.
I exported the Pi conversation here:
Open Pi conversation.
PI Session Summary β June 16, 2026
Purpose of the Session
The primary goal of this session was to refactor the refinery model into a cleaner architecture while preserving existing functionality, especially the hydrotreatment premium calculations.
The work focused on:
- Separating model computation from file output generation
- Creating a reusable scenario-running interface
- Restoring hydrotreatment premium calculations
- Eliminating duplicate calculations
- Introducing automated regression testing
- Making the codebase easier to run from scripts, notebooks, and batch studies
1. Architecture Review
Pi reviewed the following modules:
refinery_process_model/core.pyrefinery_process_model/main.pyrefinery_process_model/config.pyrefinery_process_model/dcf_adapter.py
The review concluded that the code should revolve around a single callable scenario function:
result = run_scenario(config)
This function would become the central interface to the model.
2. Defining the New Architecture
Core Layer
Responsible only for computations.
run_scenario(config)
Produces:
- process results
- economics
- utility consumption
- product properties
- premiums
without writing files.
Adapter Layer
Responsible for:
- Excel output
- plots
- reports
- command-line execution
These become wrappers around the core model.
3. Output Adapter Created
A new module was added:
refinery_process_model/outputs.py
Purpose:
- Move file-writing logic out of the model core
- Keep calculations separate from presentation
- Improve testability
This establishes a cleaner separation between:
COMPUTATION
OUTPUT GENERATION
4. Hydrotreatment Premium Calculations Restored
This was the most important functional achievement of the session.
Prior to the refactor:
build_dcf_arg_lists_for_hydrotreatment(...)
was incomplete. Parts of the premium calculation pathway still contained:
raise NotImplementedError(...)
making some calculations unusable.
Added Missing Consumables
Hydrotreatment consumables were expanded to include:
catalyst_replacement_kg_per_yr
amine_makeup_lb_per_yr
These were added to utility and operating-cost calculations.
Added Missing Operating Costs
Hydrotreatment operating costs were extended to include:
- NiMo catalyst replacement
- Amine makeup costs
using existing price assumptions rather than assuming zero cost.
Completed DCF Inputs
The DCF input builder was updated so that treated-fuel pathways could generate complete economic input lists.
Result: Hydrotreatment premium calculations became operational again.
5. Temporary Legacy Bridge
A temporary compatibility bridge was introduced. Example:
compute_hydrotreatment_premium_legacy_context()
Purpose:
- Allow the new architecture to access information still computed in legacy code.
Initially this bridge existed because some calculations still depended on variables buried inside the original workflow.
Later Removed
As refactoring progressed, the bridge became unnecessary. The following were removed:
legacy_main_extract.pycompute_hydrotreatment_premium_legacy_context()
This indicates the architecture moved closer to a proper separation of concerns.
6. Duplicate Hydrotreatment Calculations Eliminated
Before refactoring, hydrotreatment calculations occurred in multiple locations (risk of divergence).
Solution
Hydrotreatment is now computed once:
ht = run_hydrotreatment_slice(...)
The result is then passed downstream.
Benefits:
- Single source of truth
- Easier debugging
- Lower risk of inconsistent results
- Improved maintainability
7. Regression Testing Added
The first automated regression test was created. Files added:
tests_regression_premium.py
test_premium_regression_pytest.py
Purpose
Verify that important economic outputs do not change unexpectedly after future code modifications.
Example checks:
premium_min_per_bbl
premium_max_per_bbl
untreated_min_per_bbl
are compared against known-good reference values.
8. Pytest Infrastructure Installed
Pytest was installed and configured. Files added:
pytest.ini
test_premium_regression_pytest.py
This establishes a testing framework for future development.
9. Import Issues Fixed
Testing initially failed due to import-path problems. Example:
Old:
from functions.labor_hours import ...
New:
from refinery_process_model.functions.labor_hours import ...
After corrections:
pytest
ran successfully. At least one regression test passed.
Final Architecture After Session
config.py
β
core.run_scenario()
β
process calculations
β
economics
β
premium calculations
β
ScenarioResult
β
outputs.py
The key idea is: calculations happen in the core; outputs happen in adapters.
What Was Most Valuable
High Value
- β Restored hydrotreatment premium calculations
- β Eliminated duplicate hydrotreatment computations
- β Added automated regression testing
- β Installed pytest infrastructure
- β Separated outputs from computations
Lower Value
The temporary legacy bridge introduced some complexity and was later removed. This was largely transitional work rather than a long-term improvement.
Recommended Next Steps
1. Property-Based Testing
Add tests for:
- mass balance closure
- recovery fractions between 0 and 1
- non-negative aromatics
- non-negative sulfur
- hydrogen consumption bounds
Examples:
assert abs(feed - products) < tolerance
assert 0 <= recovery <= 1
2. Replace Giant Argument Lists
Move from:
build_dcf_arg_lists_for_hydrotreatment(
a,
b,
c,
d,
...
)
to dataclasses:
HydrotreatmentDCFInputs(...)
Benefits: safer refactoring, easier debugging, better readability.
3. Literature Validation
Validate hydrotreatment predictions against published cases:
- aromatics removal
- sulfur removal
- hydrogen consumption
- utility consumption
This provides scientific confidence in the model.
4. Fuel Property Modules
Future modules could include:
- viscosity prediction
- lubricity prediction
- seal swell prediction
- density prediction
- hydrogen-content prediction
These should be independent model components that plug into the scenario framework.
Overall Assessment
The session successfully transitioned the refinery model toward a cleaner architecture while preserving economic functionality.
The biggest practical gains were:
- Restoring premium calculations
- Eliminating duplicate computations
- Introducing automated testing
These changes improve confidence that future model development will not accidentally break existing results.