MultiMineralSolver¶
petrophys.interpretation.lithology.MultiMineralSolver
Also available as petrophys.interpretation.MultiMineralSolver
- class MultiMineralSolver(
- minerals=None,
- minerals_no_pef=None,
- minerals_reduced=None,
- clay_mineral='clay',
- fluid='water',
- row_uncertainty=ROW_UNCERTAINTY,
- sonic_without_pef=False,
- solve_porosity=True,
- endpoint_overrides=None,
Multi-mineral solver: quartz, calcite, dolomite and anhydrite volumes.
VCL (from VclModule) is a fixed input. Porosity is fixed or solved per sample:
PHIE given where the sample has NPHI and a finite
phie: VCL and PHIE are subtracted from the right-hand side and the minerals solved. When the solved total misses1 - VCL - PHIEby more than 0.05, the sample is not solved (NaN volumes,qc_flagset).Porosity solved elsewhere (no NPHI, or no PHIE as on a raw well): porosity is one more unknown, so the minerals do not rest on a porosity computed with an assumed matrix. A core porosity (
core_phi) fixes it where one is given. Density and closure with PEF or with NPHI give porosity and two minerals, the density-photoelectric or density-neutron lithology of the chartbooks; sonic is fitted beside them but does not stand in for either. More rows (NPHI and PEF together) solve more minerals, up tominerals; with fewer the minerals come fromminerals_reducedin its order (quartz and calcite by default, calcite and dolomite in carbonate). The same 0.05 closure check applies.
The active mineral set where PHIE is given:
PEF available -> ``minerals`` (quartz, calcite, dolomite, anhydrite) + PEF row (+ DTC if present) PEF absent -> ``minerals_no_pef``, RHOB + NPHI only; with ``sonic_without_pef`` a DTC row makes it ``minerals`` + DTC rowTool Response Equations (linear mixing), with porosity φ:
Unity: V1 + ... + Vn + φ = 1 - Vcl Density: V1·ρ1 + ... + Vn·ρn + φ·ρfl = ρlog - Vcl·ρcl Neutron: V1·N1 + ... + Vn·Nn + φ·Nfl = Nlog - Vcl·Ncl U: V1·U1 + ... + Vn·Un + φ·Ufl = Ulog - Vcl·Ucl Sonic: V1·D1 + ... + Vn·Dn + φ·Dfl = Dlog - Vcl·Dcl
where U = PEF × ρ; a fixed φ moves to the right-hand side. Each row is divided by its
row_uncertaintybefore the non-negative least-squares solve. Solved volumes are clipped to the available rock volume and scaled down only when their total exceeds it.- Parameters:
minerals (list, optional) – Full mineral set (default: [“quartz”, “calcite”, “dolomite”, “anhydrite”]).
minerals_no_pef (list, optional) – Minerals solved where PHIE is given and PEF is not (default: the first three of
minerals).minerals_reduced (list, optional) – Minerals, in order of preference, solved where porosity is solved and the logs cannot resolve
minerals(default: [“quartz”, “calcite”]).clay_mineral (str, optional) – Clay endpoint name (default: “clay”).
fluid (str, optional) – Pore-fluid endpoint name (default: “water”).
row_uncertainty (mapping or None, optional) – One-sigma uncertainty of each equation row, keyed
unity(v/v),rhob(g/cm³),nphi(v/v),u(b/cm³) anddt(μs/ft). Rows are divided by these values before the solve; keys left out keepROW_UNCERTAINTY(0.01, 0.02, 0.02, 0.5, 2.0). None solves the rows unscaled, the calculation behind the “geolink” calculation profile.sonic_without_pef (bool, optional) – Let a sonic row stand in for a missing PEF and solve
minerals(the calculation of the benchmark profiles). Default False: sonic is used beside PEF, not in its place, as it follows pore shape and compaction as much as mineralogy.solve_porosity (bool, optional) – Solve porosity with the minerals where NPHI or PHIE is missing (default True). False leaves those samples unsolved, the calculation of the benchmark profiles.
endpoint_overrides (mapping, optional) – Endpoint values replacing the table’s, keyed by endpoint name and then
density(g/cm³),nphi,pef,uordt(μs/ft): e.g.{"water": {"density": 1.1}, "clay": {"density": 2.45}}. Thefluidandclay_mineralnames address the fluid and clay.
Examples
>>> solver = MultiMineralSolver() >>> result = solver.solve(rhob, nphi, vcl, phie, pef=pef, dt=dt)
Methods
Add mineral volume curves to the well.
Return the exact linear system solved at one depth, for auditing and teaching.
Solve for mineral fractions.
- solve(
- rhob,
- nphi=None,
- vcl=None,
- phie=None,
- pef=None,
- dt=None,
- core_phi=None,
- samples=None,
Solve for mineral fractions.
- Parameters:
rhob (float or np.ndarray) – Bulk density (g/cm³).
nphi (float or np.ndarray, optional) – Neutron porosity (v/v); None when unavailable.
vcl (float or np.ndarray, optional) – Pre-computed clay volume (0-1); 0 when not given.
phie (float or np.ndarray, optional) – Effective porosity (0-1), used where the sample has NPHI. Where it is missing, porosity is solved with the minerals.
pef (float or np.ndarray, optional) – Photoelectric factor (b/e) and sonic slowness (μs/ft).
dt (float or np.ndarray, optional) – Photoelectric factor (b/e) and sonic slowness (μs/ft).
core_phi (float or np.ndarray, optional) – Core porosity (0-1): where porosity is solved, a finite value fixes it instead.
samples (np.ndarray of bool, optional) – Samples to solve; the others are left unsolved. Each sample is solved on its own, so the solved ones are as a full solve gives them.
- Returns:
Volumes for every mineral (0 where a mineral was not active at that depth, NaN where the sample was not solved), the input
vcl,phie(the porosity used: the input, or the solved one),porosity_solved(True where porosity was solved or fixed by core),qc_flag(True where not solved) andsolved(its inverse).- Return type:
- explain_sample(
- well=None,
- index=0,
- *,
- depth=None,
- rhob=None,
- nphi=None,
- vcl=None,
- phie=None,
- pef=None,
- dt=None,
- core_phi=None,
Return the exact linear system solved at one depth, for auditing and teaching.
Pass a
well(uses sampleindex, or the nearest sample todepth) or the log values directly. The returned dict has the labelled response matrixAand right-hand sideb(before the rows are divided byrow_uncertainty), the solutionx, the row and column labels, and the porosity used, so you can see precisely how a mineral solution was produced.