Doublet Streamline Model Physics Knowledge
This skill provides physics knowledge for the 2-D doublet (injection-production well pair) model using streamline methods. The model solves advection-reaction-dispersion problems along circular streamlines in a potential flow field.
When This Skill Applies
- Modifying streamline geometry calculations (bipolar coordinates)
- Changing transport solvers (hydrodynamic, chemical, thermal)
- Implementing or modifying breakthrough curve integration
- Working with Green's function kernels for thermal transport
- Debugging unexpected breakthrough behavior
- Planning changes to physics-related code
- Explaining why the model behaves a certain way
Core Physics Reference
The model tracks transport in a 2-D potential flow field between an injector (+a, 0) and producer (-a, 0):
| Module |
Transport Type |
Solution Method |
| Hydrodynamic |
Pure advection |
Time-of-flight along streamlines |
| Chemical |
Advection + capacity-limited reaction |
Logistic traveling wave |
| Thermal |
Advection + fluid-matrix exchange |
Bessel-function Green's kernel |
Key state variables:
| Variable |
Symbol |
Meaning |
Units |
| Take-off angle |
β |
Angle at which streamline leaves injector |
rad |
| Time-of-flight |
τ(β) |
Travel time from injector to producer |
s |
| Arc position |
φ |
Angle along circular streamline |
rad |
| Concentration |
C(φ,t) |
Solute mass fraction |
kg/kg |
| Capacity |
S(φ,t) |
Remaining reaction capacity |
kg/kg |
| Fluid temperature |
Tf(φ,t) |
Fluid temperature along streamline |
°C |
| Matrix temperature |
Tm(φ,t) |
Rock matrix temperature |
°C |
For detailed equations, see EQUATIONS.md.
For symbol definitions and units, see SYMBOLS.md.
For derivation logic, see DERIVATIONS.md.
For edge cases and sanity checks, see SANITY_CHECKS.md.
Workflow A: Physics Validation
Use this workflow when reviewing or planning code changes.
Step 1: Identify affected transport type
Determine which transport physics is affected:
- Hydrodynamic: Streamline geometry, time-of-flight, velocity field
- Chemical: Capacity-limited reaction, logistic traveling wave
- Thermal: Fluid-matrix exchange, Bessel function kernel
Step 2: Check coordinate system consistency
The model uses multiple coordinate systems:
- Cartesian (x, y) for plotting
- Bipolar (ξ, β) for streamline parameterization
- Polar about streamline center (R, φ) for local calculations
Verify transformations are applied correctly.
Step 3: Verify breakthrough integration
Breakthrough curves integrate over all streamlines:
C_prod(t) = (1/π) ∫_0^π C(β, t) dβ
Check that:
- Integration weights are correct (trapezoidal or custom)
- β limits span [0, π] (or arrived streamlines only)
- Singularities at β → 0, π are handled
Step 4: Check Green's function stability (thermal)
For thermal transport, the Bessel kernel G(τ, t) can overflow:
- Verify exponent recentering is applied
- Check that i1e (scaled Bessel I1) is used instead of i1
- Verify prefix integrals use cumulative_trapezoid
Step 5: Report findings
Summarize:
- Which transport type is affected
- Any coordinate transformation issues
- Any integration boundary issues
- Any numerical stability concerns
- Recommendations for correction
Workflow B: Physics Reasoning
Use this workflow when explaining behavior, debugging, or proposing solutions.
For explaining physics concepts:
- Identify the relevant equations and parameters
- State the physical interpretation
- Explain cause-and-effect relationships
- Use the derivation steps from DERIVATIONS.md to show connections
For debugging simulation issues:
- Identify which transport type shows unexpected behavior
- Check if the issue relates to:
- Breakthrough timing (τ calculation)
- Front retardation (reaction capacity)
- Thermal lag (fluid-matrix exchange rates)
- Trace through the analytical solution
- Check edge cases against SANITY_CHECKS.md
For proposing physics-consistent changes:
- Identify which equations are affected
- Show how new terms integrate into the transport equations
- Demonstrate that mass/energy balance is preserved
- Identify any new sanity checks needed
Quick Reference: Module Structure
| Module |
Purpose |
Key Functions |
doublet.py |
Main model (streamlines, chemical, thermal) |
Tf, Ctf, Cxf, Ttf, Txf, breakthrough |
streamlines.py |
Bipolar coordinate streamlines |
streamline_bipolar, streamtube_width |
diffusion.py |
Green's kernel solver with diffusion |
solve_kernel_capacity, cxfD, ctDf |
thermal.py |
Thermal kernel (alternative impl.) |
thermal_kernel_Tf_Tm_xvec_t |
thermal2.py |
Optimized thermal solver |
G_grid_efficient, run_breakthrough, Tprodf |
notebook_widgets.py |
Interactive Jupyter visualizations |
visualize_* functions |
Key Physical Constraints
These must always hold:
- Streamline geometry: Streamlines are circular arcs through (±a, 0)
- Travel time bounds: T(β=0) = 4πna²/(3Q) is minimum arrival time
- Velocity singularity: v → ∞ at wells (handled by coordinate transformation)
- Conservation: Integrated flux across all streamlines equals Q
- Retardation: Chemical front travels at speed v·C_inj/(C_inj + S_0)
- Thermal equilibrium: As t → ∞, Tf → Tm → T_inj (behind the front)
Transport Type Classification
| Transport |
Governing Equation |
Solution Type |
| Hydrodynamic |
∂C/∂t + v·∇C = 0 |
Method of characteristics |
| Chemical (no diffusion) |
∂C/∂t + v·∇C = -kCS |
Logistic traveling wave |
| Chemical (with diffusion) |
∂C/∂t + v·∇C = D∇²C - kCS |
Green's function convolution |
| Thermal |
∂Tf/∂t + v·∇Tf = -γ(Tf - Tm) |
Bessel kernel (Eq. 47) |
| Matrix |
∂Tm/∂t = β(Tf - Tm) |
Exponential convolution (Eq. 48) |
Dimensionless Groups
| Group |
Definition |
Physical Meaning |
| Retardation R |
(C_inj + S_0)/C_inj |
Front slowdown factor |
| Damköhler Da |
k·τ |
Reaction extent over travel time |
| Péclet Pe |
v·L/D |
Advection vs diffusion |
| β·τ |
(exchange rate)·(travel time) |
Matrix equilibration extent |
| γ·τ |
(exchange rate)·(travel time) |
Fluid cooling extent |
1---
2name: doublet
3description: Validates code and provides physics reasoning for the 2-D injection-production doublet model using streamline methods. Use when modifying streamline geometry, transport calculations (hydrodynamic, chemical, thermal), breakthrough curves, or Green's function kernels. Also use when debugging simulation behavior or explaining physics concepts.
4allowed-tools: Read, Grep, Glob, Bash
5metadata:
6 source: https://skillmd.com/skills/aibot88/doublet
7---
8
9# Doublet Streamline Model Physics Knowledge
10
11This skill provides physics knowledge for the 2-D doublet (injection-production well pair) model using streamline methods. The model solves advection-reaction-dispersion problems along circular streamlines in a potential flow field.
12
13## When This Skill Applies
14
15- Modifying streamline geometry calculations (bipolar coordinates)
16- Changing transport solvers (hydrodynamic, chemical, thermal)
17- Implementing or modifying breakthrough curve integration
18- Working with Green's function kernels for thermal transport
19- Debugging unexpected breakthrough behavior
20- Planning changes to physics-related code
21- Explaining why the model behaves a certain way
22
23## Core Physics Reference
24
25The model tracks transport in a 2-D potential flow field between an injector (+a, 0) and producer (-a, 0):
26
27| Module | Transport Type | Solution Method |
28|--------|----------------|-----------------|
29| Hydrodynamic | Pure advection | Time-of-flight along streamlines |
30| Chemical | Advection + capacity-limited reaction | Logistic traveling wave |
31| Thermal | Advection + fluid-matrix exchange | Bessel-function Green's kernel |
32
33Key state variables:
34
35| Variable | Symbol | Meaning | Units |
36|----------|--------|---------|-------|
37| Take-off angle | β | Angle at which streamline leaves injector | rad |
38| Time-of-flight | τ(β) | Travel time from injector to producer | s |
39| Arc position | φ | Angle along circular streamline | rad |
40| Concentration | C(φ,t) | Solute mass fraction | kg/kg |
41| Capacity | S(φ,t) | Remaining reaction capacity | kg/kg |
42| Fluid temperature | Tf(φ,t) | Fluid temperature along streamline | °C |
43| Matrix temperature | Tm(φ,t) | Rock matrix temperature | °C |
44
45For detailed equations, see [EQUATIONS.md](EQUATIONS.md).
46For symbol definitions and units, see [SYMBOLS.md](SYMBOLS.md).
47For derivation logic, see [DERIVATIONS.md](DERIVATIONS.md).
48For edge cases and sanity checks, see [SANITY_CHECKS.md](SANITY_CHECKS.md).
49
50---
51
52## Workflow A: Physics Validation
53
54Use this workflow when reviewing or planning code changes.
55
56### Step 1: Identify affected transport type
57
58Determine which transport physics is affected:
59- **Hydrodynamic**: Streamline geometry, time-of-flight, velocity field
60- **Chemical**: Capacity-limited reaction, logistic traveling wave
61- **Thermal**: Fluid-matrix exchange, Bessel function kernel
62
63### Step 2: Check coordinate system consistency
64
65The model uses multiple coordinate systems:
66- Cartesian (x, y) for plotting
67- Bipolar (ξ, β) for streamline parameterization
68- Polar about streamline center (R, φ) for local calculations
69
70Verify transformations are applied correctly.
71
72### Step 3: Verify breakthrough integration
73
74Breakthrough curves integrate over all streamlines:
75```
76C_prod(t) = (1/π) ∫_0^π C(β, t) dβ
77```
78
79Check that:
80- Integration weights are correct (trapezoidal or custom)
81- β limits span [0, π] (or arrived streamlines only)
82- Singularities at β → 0, π are handled
83
84### Step 4: Check Green's function stability (thermal)
85
86For thermal transport, the Bessel kernel G(τ, t) can overflow:
87- Verify exponent recentering is applied
88- Check that i1e (scaled Bessel I1) is used instead of i1
89- Verify prefix integrals use cumulative_trapezoid
90
91### Step 5: Report findings
92
93Summarize:
94- Which transport type is affected
95- Any coordinate transformation issues
96- Any integration boundary issues
97- Any numerical stability concerns
98- Recommendations for correction
99
100---
101
102## Workflow B: Physics Reasoning
103
104Use this workflow when explaining behavior, debugging, or proposing solutions.
105
106### For explaining physics concepts:
107
1081. Identify the relevant equations and parameters
1092. State the physical interpretation
1103. Explain cause-and-effect relationships
1114. Use the derivation steps from [DERIVATIONS.md](DERIVATIONS.md) to show connections
112
113### For debugging simulation issues:
114
1151. Identify which transport type shows unexpected behavior
1162. Check if the issue relates to:
117 - Breakthrough timing (τ calculation)
118 - Front retardation (reaction capacity)
119 - Thermal lag (fluid-matrix exchange rates)
1203. Trace through the analytical solution
1214. Check edge cases against [SANITY_CHECKS.md](SANITY_CHECKS.md)
122
123### For proposing physics-consistent changes:
124
1251. Identify which equations are affected
1262. Show how new terms integrate into the transport equations
1273. Demonstrate that mass/energy balance is preserved
1284. Identify any new sanity checks needed
129
130---
131
132## Quick Reference: Module Structure
133
134| Module | Purpose | Key Functions |
135|--------|---------|---------------|
136| `doublet.py` | Main model (streamlines, chemical, thermal) | `Tf`, `Ctf`, `Cxf`, `Ttf`, `Txf`, `breakthrough` |
137| `streamlines.py` | Bipolar coordinate streamlines | `streamline_bipolar`, `streamtube_width` |
138| `diffusion.py` | Green's kernel solver with diffusion | `solve_kernel_capacity`, `cxfD`, `ctDf` |
139| `thermal.py` | Thermal kernel (alternative impl.) | `thermal_kernel_Tf_Tm_xvec_t` |
140| `thermal2.py` | Optimized thermal solver | `G_grid_efficient`, `run_breakthrough`, `Tprodf` |
141| `notebook_widgets.py` | Interactive Jupyter visualizations | `visualize_*` functions |
142
143---
144
145## Key Physical Constraints
146
147These must always hold:
148
1491. **Streamline geometry**: Streamlines are circular arcs through (±a, 0)
1502. **Travel time bounds**: T(β=0) = 4πna²/(3Q) is minimum arrival time
1513. **Velocity singularity**: v → ∞ at wells (handled by coordinate transformation)
1524. **Conservation**: Integrated flux across all streamlines equals Q
1535. **Retardation**: Chemical front travels at speed v·C_inj/(C_inj + S_0)
1546. **Thermal equilibrium**: As t → ∞, Tf → Tm → T_inj (behind the front)
155
156---
157
158## Transport Type Classification
159
160| Transport | Governing Equation | Solution Type |
161|-----------|-------------------|---------------|
162| Hydrodynamic | ∂C/∂t + v·∇C = 0 | Method of characteristics |
163| Chemical (no diffusion) | ∂C/∂t + v·∇C = -kCS | Logistic traveling wave |
164| Chemical (with diffusion) | ∂C/∂t + v·∇C = D∇²C - kCS | Green's function convolution |
165| Thermal | ∂Tf/∂t + v·∇Tf = -γ(Tf - Tm) | Bessel kernel (Eq. 47) |
166| Matrix | ∂Tm/∂t = β(Tf - Tm) | Exponential convolution (Eq. 48) |
167
168---
169
170## Dimensionless Groups
171
172| Group | Definition | Physical Meaning |
173|-------|------------|------------------|
174| Retardation R | (C_inj + S_0)/C_inj | Front slowdown factor |
175| Damköhler Da | k·τ | Reaction extent over travel time |
176| Péclet Pe | v·L/D | Advection vs diffusion |
177| β·τ | (exchange rate)·(travel time) | Matrix equilibration extent |
178| γ·τ | (exchange rate)·(travel time) | Fluid cooling extent |