Database-driven Jc function using lookup tables. More...
#include <cl_JcFunction_Database.hpp>
Public Member Functions | |
| JcFunctionDatabase (const string &aPath, const string &aLabel) | |
| Constructor - loads database from file. | |
| void | load_self_field (const string &aPath, const string &aLabel) |
| Read the measured B = 0 level from the table's /source. | |
| void | reduce_self_field_rows (const Matrix< real > &aPoints, const index_t aColT, const index_t aColB, const index_t aColV, const real aScale, Vector< real > &aT, Vector< real > &aValue) const |
| Bin the B = 0 rows by temperature and average over angle. | |
| ~JcFunctionDatabase () override | |
| Destructor - deletes the database. | |
| real | min_value () const override |
| real | self_field (const real T, real &dJ0dT) const |
| void | edge_value_and_slope (const real angle, const real T, real &V, real &S) const |
| the table's own value and d/dB at the low-field edge | |
| real | wrap_angle (const real angle) const |
| Wrap the caller's angle into the table window. | |
| real | eval (const real normB, const real angle, const real T) const override |
| Evaluate Jc or n at given field, angle, and temperature. | |
| real | deval_dB (const real normB, const real angle, const real T) const override |
| d(value)/d|B| from the spline, clamp-consistent | |
| real | deval_dbeta (const real normB, const real angle, const real T) const override |
| d(value)/dθ from the spline | |
| real | deval_dT (const real normB, const real angle, const real T) const override |
| d(value)/dT from the spline, clamp-consistent | |
| Public Member Functions inherited from belfem::material::JcFunction | |
| JcFunction ()=default | |
| Default constructor. | |
| virtual | ~JcFunction ()=default |
| Virtual destructor. | |
| bool | depends_on (const JcParameter aParameter) const |
| Check if function depends on a parameter. | |
| bool | is_constant () const |
| Check if function is constant (no dependencies). | |
| virtual real | eval (const real normB, const real angle) const |
| Evaluate with field and angle dependence. | |
Static Public Member Functions | |
| static real | interp_curve (const Vector< real > &aT, const Vector< real > &aValue, const real T, real &dJ0dT) |
Additional Inherited Members | |
| Protected Member Functions inherited from belfem::material::JcFunction | |
| void | set_dependency (const JcParameter aParameter) |
| Mark function as depending on a parameter. | |
| Protected Attributes inherited from belfem::material::JcFunction | |
| JcDependency | mDependency |
Database-driven Jc function using lookup tables.
Implements Jc(B, angle, T) or n(B, angle, T) through interpolation of tabulated data stored in HDF5 format.
The database uses a structured tensor grid with higher-order finite element interpolation (quad4/9/16 for 2D, hex8/27/64 for 3D).
Coordinate system:
The database clamps out-of-range T and high-field inputs to the valid domain and handles periodic angle wrapping (angle ± π); below Bmin a table with a /source group uses the self-field bridge instead of a clamp.
Dependencies: normB, angleNxB, T
Database file format:
Usage:
|
inline |
Constructor - loads database from file.
| aPath | Path to HDF5 database file |
| aLabel | Group name inside the HDF5 file — "jc" or "n" for the shipped tables. The self-field bridge keys on this label: only "jc" reads the icw column and applies the Icw/t_eff calibration; anything else is treated as an n table. |
Loads a database-driven Jc or n function from file. The constructor reads the database dimensions and extracts the valid ranges for each coordinate.
The database stores:
Example database creation (Python with h5py):
|
inlineoverride |
Destructor - deletes the database.
|
inlineoverridevirtual |
d(value)/d|B| from the spline, clamp-consistent
The table stores f = log10(value) over ( T, u = log10 B, θ ), so with value = 10^f and du/dB = 1/( B ln10 ):
d(value)/dB = value · ln10 · (∂f/∂u) · du/dB
= value · (∂f/∂u) / B — ln10 CANCELS.
( Verified independently by both audit voices 2026-08-13; an earlier plan note carried a spurious ln10 here. ) When |B| is outside the table window, eval() returns the CLAMPED value, which is constant in |B| — the consistent tangent is exactly zero, and the derivative implements that clamp decision itself rather than trusting a caller to.
Reimplemented from belfem::material::JcFunction.
|
inlineoverridevirtual |
d(value)/dθ from the spline
θ is stored linearly, so the log10 storage contributes the full ln10: d(value)/dθ = value · ln10 · ∂f/∂θ. The ±π wrap is a shift ( dθ_wrapped/dθ = 1 ), applied identically to eval().
Reimplemented from belfem::material::JcFunction.
|
inlineoverridevirtual |
d(value)/dT from the spline, clamp-consistent
T is stored linearly: d(value)/dT = value · ln10 · ∂f/∂T. Outside the temperature window the clamped value is constant in T — the consistent tangent is zero.
Reimplemented from belfem::material::JcFunction.
|
inline |
the table's own value and d/dB at the low-field edge
|
inlineoverridevirtual |
Evaluate Jc or n at given field, angle, and temperature.
| normB | Magnetic field magnitude [T] |
| angle | Angle between surface normal and field [rad] |
| T | Temperature [K] |
Performs 3D tensor interpolation:
Above Bmax and outside [Tmin, Tmax] inputs are clamped to the database bounds; below Bmin only tables without /source clamp.
Reimplemented from belfem::material::JcFunction.
|
inlinestatic |
measured angle-free value at B = 0 and its dT, by linear interpolation on the stored curve. Clamped at both ends: the curve spans the measured temperature range, not the table's
|
inline |
Read the measured B = 0 level from the table's /source.
The rebuilt tables embed their raw measurement rows as /source/points with /source/columns naming them, and those rows include the self-field scans the log10 B axis structurally cannot hold ( log10( 0 ) is undefined ). Rows at exactly B = 0 are binned by temperature and averaged over the stage angles – the average is the whole point, the measured angular scatter there being only a few tenths of a percent.
Silently inert on any file without /source: mHaveSelfField stays false and every accessor keeps the historical clamp, so older tables behave exactly as before.
|
inlineoverridevirtual |
smallest value the table can produce; values are stored as log10, so exponentiate the raw minimum
Reimplemented from belfem::material::JcFunction.
|
inline |
Bin the B = 0 rows by temperature and average over angle.
The angular average IS the physics: at zero field there is no field direction, and the measured rows scatter only a few tenths of a percent across the stage angles. A temperature is a distinct bin when it differs by more than the tolerance, which is loose enough to merge one setpoint's jitter ( 77.48-77.51 K ) and tight enough to keep 2.5 K spacing apart.
Wrap the caller's angle into the table window.
theta in [ 0, pi ] passes through untouched; values within the same 1e-6 tolerance the ctor coverage guard uses are snapped onto the boundary — a table whose endpoints sit an ulp inside 0 or pi must not swap poles at exactly theta = 0 or pi. Anything further out uses the +-pi periodicity.