Skip to content

Commit 1023a4f

Browse files
authored
docs: update index variable references to eqn_idx struct (#1365) (#1371)
1 parent 2e09ff7 commit 1023a4f

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

.claude/rules/common-pitfalls.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313

1414
## Field Variable Indexing
1515
- Conserved variables: `q_cons_vf(1:sys_size)`. Primitive: `q_prim_vf(1:sys_size)`.
16-
- Index ranges depend on `model_eqns` and enabled features (set in `m_global_parameters.fpp`):
17-
- `cont_idx` — continuity (partial densities, one per fluid)
18-
- `mom_idx` — momentum components
19-
- `E_idx` — total energy (scalar)
20-
- `adv_idx` — volume fractions (advection equations)
21-
- `bub_idx`, `stress_idx`, `xi_idx`, `species_idx`, `B_idx`, `c_idx` — optional
22-
- Shorthand scalars: `momxb`/`momxe`, `contxb`/`contxe`, `advxb`/`advxe`, etc.
16+
- All equation indices live in the unified `eqn_idx` struct (`eqn_idx_info` type in `m_derived_types.fpp`).
17+
Index ranges depend on `model_eqns` and enabled features (set in `m_global_parameters.fpp`):
18+
- `eqn_idx%cont` — continuity range (partial densities, one per fluid)
19+
- `eqn_idx%mom` — momentum range
20+
- `eqn_idx%E` — total energy (scalar)
21+
- `eqn_idx%adv` — volume fractions (advection equations)
22+
- `eqn_idx%bub`, `eqn_idx%stress`, `eqn_idx%xi`, `eqn_idx%species`, `eqn_idx%B` — optional
23+
- `eqn_idx%gamma`, `eqn_idx%pi_inf`, `eqn_idx%alf`, `eqn_idx%int_en` — additional scalars/ranges
24+
- Use `eqn_idx%cont%beg`/`eqn_idx%cont%end`, `eqn_idx%mom%beg`/`eqn_idx%mom%end`, etc. (old `contxb`/`contxe`, `momxb`/`momxe` shorthands are gone)
2325
- `sys_size` = total number of conserved variables (computed at startup)
2426
- Changing `model_eqns` or enabling features changes ALL index positions
2527

docs/documentation/architecture.md.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ The index layout within `q_cons_vf` depends on the flow model:
4949
```
5050
For model_eqns == 2 (5-equation, multi-fluid):
5151

52-
Index: 1 .. num_fluids | num_fluids+1 .. +num_vels | E_idx | adv_idx
53-
Meaning: alpha*rho_k | momentum components | energy | volume fractions
52+
Index: 1 .. num_fluids | num_fluids+1 .. +num_vels | eqn_idx%E | eqn_idx%adv
53+
Meaning: alpha*rho_k | momentum components | energy | volume fractions
5454
```
5555

5656
Additional variables are appended for bubbles, elastic stress, magnetic fields, or chemistry species when those models are enabled. The total count is `sys_size`.

docs/documentation/case.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ In the example above, the following code is generated:
235235

236236
```f90
237237
if (patch_id == 2) then
238-
q_prim_vf(contxb)%sf(i, 0, 0) = 1 + 0.1*sin(20*x_cc(i)*3.141592653589793)
238+
q_prim_vf(eqn_idx%cont%beg)%sf(i, 0, 0) = 1 + 0.1*sin(20*x_cc(i)*3.141592653589793)
239239
end if
240240
```
241241

docs/documentation/contributing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ do l = 0, p
334334
do k = 0, n
335335
do j = 0, m
336336
rho = q_prim_vf(1)%sf(j, k, l)
337-
pres = q_prim_vf(E_idx)%sf(j, k, l)
337+
pres = q_prim_vf(eqn_idx%E)%sf(j, k, l)
338338
! ... use rho, pres as thread-local ...
339339
end do
340340
end do
@@ -369,7 +369,7 @@ do l = 0, p
369369
do j = 0, m
370370
$:GPU_LOOP(parallelism='[seq]')
371371
do i = 1, num_fluids
372-
alpha(i) = q_prim_vf(advxb + i - 1)%sf(j, k, l)
372+
alpha(i) = q_prim_vf(eqn_idx%adv%beg + i - 1)%sf(j, k, l)
373373
end do
374374
end do
375375
end do

0 commit comments

Comments
 (0)