Skip to content
Get started

Identify layered conductivity and retain a research dataset

This example follows a one-metre layered rod from a forward solve to conductivity inference and a reusable dataset using the public Eqiora 0.1.5 package. Clean installations outside the source checkout have exercised its ordinary public APIs and reopened every saved study in a second fresh environment.

Download conductivity.eqi and research_workflow.py into the same directory if you want to inspect or edit them. These links pin the same source release as the installed example and its independent checks.

The checked environment is Linux x86-64, ordinary-GIL CPython 3.13.14, NumPy 2.5.4, and SciPy 1.18.1. Eqiora performs the equations, linear solves, observations and implicit derivative products. SciPy supplies the bounded optimizer.

Install the published version from PyPI:

Terminal windowbash
uv init --python 3.13 conductivity-study
cd conductivity-study
uv add --index-url https://pypi.org/simple eqiora==0.1.5 numpy==2.5.4 scipy==1.18.1
uv run python -m eqiora.examples.research_conductivity --output accepted
uv run python -m eqiora.examples.research_conductivity --output accepted --reopen

The installed module includes the equation source beside the Python program. It can run in an empty working directory; downloading the two files is optional for inspection or editing. To execute an edited download, use uv run python research_workflow.py --output edited with conductivity.eqi beside it.

Retain pyproject.toml, uv.lock and the accepted output with the study. A new environment can use uv sync --frozen and the same --reopen command. The package and source downloads require no editable installation, Rust toolchain, GPU, repository fixtures or private API. The output directory must be new; a rerun uses a different directory and preserves the previous history.

The published validation ran direct and iterative solvers, changed conductivities, heating and boundary temperature, and a 32-cell refinement. Its 22 independent research and parameter-map checks passed, as did all four saved-study reopens in a separately installed environment with the exact dependency freeze. On the checked Linux host, whole-process wall time / peak RSS were 5.05 s / 80,240 KiB (default), 3.40 s / 78,992 KiB (iterative), 3.41 s / 79,164 KiB (changed inputs), and 5.83 s / 78,524 KiB (32 cells). These are observations from that environment, not portable performance promises. Publication and reproduction record.

The published example uses the ordinary ordered Parameter-Run study described below, alongside its differentiable evaluation maps for fitting and datasets.

The rod has fixed interface x=0.5 mx=0.5\,\mathrm{m}, a fixed mesh, and perfect thermal contact. It solves

−ddx(k(x)dTdx)=q,T(0)=300 K,T(1)=TR.-\frac{\mathrm{d}}{\mathrm{d}x}\left(k(x)\frac{\mathrm{d}T}{\mathrm{d}x}\right)=q, \qquad T(0)=300\,\mathrm{K},\qquad T(1)=T_R.

The two conductivity coordinates are dimensionless logarithms: ki=exp⁡(ηi) W/(m K)k_i=\exp(\eta_i)\,\mathrm{W/(m\,K)}. The default truth is (2,5)(2,5) in those units. Geometry, interface, observation supports and mesh topology stay fixed through the inverse problem. Even cell counts align the interface with a node.

conductivity.eqi
public component LayeredRod(
support body:volume(ambient_dimension=1),
support left:boundary(parent=body),
support right:boundary(parent=body),
parameter log_k:array<1,2>,
parameter heating:W/m^3,
parameter right_temperature:K
) {
coordinate x:m on body from body[0];
let conductivity:W/m/K =
(if x < 0.5[m] then math.exp(log_k[0]) else math.exp(log_k[1])) * 1[W/m/K];
variable temperature:K on body in h1;
relation balance on body {
-div(conductivity * grad(temperature)) = heating;
}
relation left_value on left {trace(temperature)=300[K];}
relation right_value on right {trace(temperature)=right_temperature;}
observable left_mean:K = integral(
(if x < 0.5[m] then 2[1/m] else 0[1/m])*temperature, measure(body));
observable right_mean:K = integral(
(if x < 0.5[m] then 0[1/m] else 2[1/m])*temperature, measure(body));
observable mean_flux:W/m^2 = integral(
-conductivity * partial(temperature,wrt=x) / 1[m], measure(body));
observable profile:K on body = temperature;
}

The calibration loads are explicitly ordered: calibration-a uses (q,TR)=(20 W/m3,310 K)(q,T_R)=(20\,\mathrm{W/m^3},310\,\mathrm K); calibration-b uses (40 W/m3,302 K)(40\,\mathrm{W/m^3},302\,\mathrm K). The withheld load uses (15 W/m3,307 K)(15\,\mathrm{W/m^3},307\,\mathrm K) and never enters the fit.

Two regional mean temperatures have units K. The third observation is the mean axial heat flux, positive toward increasing xx, in W/m2\mathrm{W/m^2}. These are physical reduced observations, evaluated with an explicit two-point quadrature rule. Their identities, types and rule are retained by the differentiable program and saved collections. The ordinary Result also exposes the labeled temperature field and definition.profile for typed point queries.

Change physical and numerical inputs through the same entry point:

Terminal windowbash
uv run python -m eqiora.examples.research_conductivity --output changed-physical \
--conductivities 2.5 4.0 --heating 25 --right-temperature 308
uv run python -m eqiora.examples.research_conductivity --output finer --cells 32
uv run python -m eqiora.examples.research_conductivity --output iterative --solver iterative

The inverse search bounds are 0.5≤ki≤10 W/(m K)0.5\leq k_i\leq10\,\mathrm{W/(m\,K)}. Choose synthetic truths within those bounds. Nonpositive or nonfinite physical conductivity inputs reject before conversion to log coordinates.

Substitution Meaning and checked boundary
Sparse LU / faer to BiCGStab / reference Compatible linear solver swap on the same Q1 problem; Run fields/observations, native JVP/VJP, ordered maps and reopened collections retain exact provider provenance and the independently derived accuracy criterion.
16 to 32 Q1 cells A different discrete problem; compare spatial error and convergence rather than exact result identity.
Fixed positive conductivities, known source and boundary values Ordinary parameter changes; the map retains each exact point and solved output.
FVM or another mesh family A distinct discretization; this example’s Q1 accuracy and derivative checks do not establish its behavior.
Source-free temperature-only calibration Mathematically unable to identify the common conductivity scale.
Nonpositive conductivity or a temperature coordinate supplied in seconds Invalid physical input or units; reject instead of fitting.

The objective is 12∑ℓ,s[(ys(η;ℓ)−dℓ,s)/σs]2\frac12\sum_{\ell,s}[(y_s(\eta;\ell)-d_{\ell,s})/\sigma_s]^2 with scales (0.02 K,0.02 K,0.05 W/m2)(0.02\,\mathrm K,0.02\,\mathrm K,0.05\,\mathrm{W/m^2}). There is no regularizer. Native VJPs supply the objective gradient; Python only reduces the scaled residuals. SciPy’s bounded trust-region reflective least-squares method uses the native observation Jacobian, ftol=1e-10, xtol=1e-10, gtol=1e-8, and at most 100 residual evaluations. Failure is reported, never converted to a successful fit.

Synthetic observations come from a separate four-times-finer Eqiora mesh. Noise-free observations and an independent Gaussian perturbation with fixed seed 20261026 are both fitted. Reported parameter errors remain distinct from the observation residuals. The bounded checks require relative parameter errors below 0.5% without noise and 2% with this fixed noise realization; neither bound is a promise for other data, starting points or global convergence.

The script reports sensitivity singular values at the truth and at nine points of the declared parameter box. This samples conditioning; it does not certify rank everywhere. The deficient control removes heating and flux observations. Scaling both conductivities leaves its temperatures unchanged, so the common scale sensitivity vanishes even if an optimizer could report success.

The focused checks derive an independent continuum reference by integrating j′=qj'=q and T′=−j/kT'=-j/k. With R=1/(2kL)+1/(2kR)R=1/(2k_L)+1/(2k_R) and A=1/(8kL)+3/(8kR)A=1/(8k_L)+3/(8k_R), j(x)=qx+Cj(x)=qx+C, where C=−(TR−300+qA)/RC=-(T_R-300+qA)/R in coherent SI units. On each half, TT is quadratic. Aligned Q1 nodal temperatures equal this exact solution; each regional mean has interpolation error −qh2/(12ki)-q h^2/(12k_i). Doubling cell count must reduce that error by four. The default fine-reference mean error is bounded by 0.5 mK, smaller than the declared temperature noise scale.

A centred difference independently checks the fixed-mesh objective gradient. The first-order-corrected Taylor remainder must decay quadratically. Deliberately negating the gradient produces a first-order remainder and fails that criterion. The solver comparison also checks the forward/reverse transpose pairing for the complete field and all three reduced observations, including ordered maps. A fresh interpreter reopens both providers’ saved collections and ordinary Results with execution entry points disabled. This is a check of these two declared host profiles on this Q1 problem, without a general solver-interchangeability claim. These checks establish derivatives of the selected discrete program; continuum sensitivity is a separate mesh-dependence question.

summary.json separates solver residual and acceptance target, reference spatial error bound, observation fit, relative parameter error, withheld-load prediction, and errors in withheld parameter regions. It records environment versions and costs for preparation, forward solve plus observation, objective plus gradient, repeated multi-load execution, dataset generation and process peak memory. Timings include the native work requested in each phase; they are measurements of that process and host, without a throughput or cross-environment promise.

The exact model.json, plan.json and result.json reopen through Model, Plan and Result. reference-plan.json and reference collections identify the separate observation discretization. Fitted, held-out and dataset collections retain their own Plan, full input point, field and observation signatures, accepted outputs, occurrence identities, status and diagnostics. Offline opening does not solve again. The script is copied into the output folder beside its equation source.

samples.csv labels 18 samples: six parameter cases across three loads. All loads of a parameter case stay in the same train, validation or test split. Test cases (1,7)(1,7) and (3,3)(3,3) lie outside the training parameter range. The withheld load is also excluded from normalization. This explicit grid uses no sampling RNG; the measurement noise has its separately recorded seed. targets.npz projects the accepted temperature field and three observations, preserving sample IDs and units; its normalization is fitted only to accepted training calibration rows. Native collection bytes remain authoritative. No derivative targets or surrogate accuracy are claimed by this dataset.

Inspect ordinary ordered studies, failure and retry

Section titled “Inspect ordinary ordered studies, failure and retry”

The example deliberately requests log_k_left=1000. Eqiora reports EQ0505, “unary mathematics produced a nonfinite result”. Inspect the saved collection:

python
import eqiora as q
history = q.EvaluationCollection.read("accepted/retry-history.eqcollection")
for group in history:
for member in group:
print(member.occurrence_id, member.status,
[(d.code, d.message) for d in member.diagnostics])

The installed recipe uses EvaluationMapPlan.from_parameters for ordinary stationary Runs, selecting the original Model’s log_k, heating and right_temperature Parameters. Its ordered points are the command-line baseline, a changed case with conductivities (1.5,4.5)(1.5,4.5), heating 40 and right temperature 302 K, the baseline again, an invalid log_k_left=1000 input, and the changed case again. Each accepted occurrence retains its own exact Plan and typed temperature Field.

The first group contains three accepted occurrences, then failed and not_started. The duplicate baseline stays a separate occurrence. An exact retry reads the selected Parameters and two unsuccessful points from the reopened group; it still fails at the invalid point. A third execution explicitly restores that point’s conductivity to the command-line baseline (default (2,5)(2,5)) and evaluates the previously unstarted changed case. It is a changed request, with a new input identity and new execution occurrences. All three initially accepted members retain their exact bytes and occurrence identities.

summary.json exposes this group as ordered_parameter_study: Parameter IDs, ordered typed input values, statuses and diagnostics, each accepted Plan identity, and nodal temperatures in K. --reopen projects the same information without solving. The dataset and inverse derivative calculations still use their existing differentiable maps; the ordinary study does not change their accepted targets. This uses the common map and collection owners, without a separate study scheduler or generic retry API.

If a multi-load objective fails, its IncompleteEvaluation exception retains exception.collection for inspection. No partial objective or training statistic is accepted silently. Numerical continuation and restoration of provider memory are separate capabilities.

The installed checks also reject wrong source/coordinate units, stale observation handles and reordered sample attribution, and reopen saved results in a fresh interpreter with solver/compiler entry points disabled. See the focused checks for the exact scientific expectations and falsifiers. Published-package installation and study evidence are tracked in the existing capability index and the released-user delivery.