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=default | |
| Destructor - deletes the database. | |
| real | min_value () const override |
| void | finalize_self_field () |
| real | self_field (const real T, real &aDT) const |
| void | edge (const real angle, const real T, const bool aWithT, const bool aWithAngle, Edge &aEdge) const |
| bool | continued (const real normB) const |
| true if B lies on the continuation of this label | |
| real | anchor (const real a, const real V, const real S, const real aA_q, const real aV_q, const real aS_q, real &aJ_q) const |
| real | jc_join (const real x, const real J, const real V, const real S, const real aJ_q, const real aV_q, const real aS_q, real &aValue_q, real &aDB) const |
| real | continuation (const real normB, const real angle, const real T, const uint aMode, real &aDerivative) const |
| bool | angle_is_snapped (const real angle) const |
| Wrap the caller's angle into the table window. | |
| real | wrap_angle (const real angle) const |
| 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|, the exact derivative of eval | |
| real | deval_dbeta (const real normB, const real angle, const real T) const override |
| d(value)/dθ, the exact derivative of eval | |
| real | deval_dT (const real normB, const real angle, const real T) const override |
| d(value)/dT, the exact derivative of eval | |
| Public Member Functions inherited from belfem::material::JcFunction | |
| JcFunction ()=default | |
| virtual | ~JcFunction ()=default |
| bool | depends_on (const JcParameter aParameter) const |
| bool | is_constant () const |
| virtual real | eval (const real normB, const real angle) const |
| Evaluate with field and angle dependence. | |
Static Public Member Functions | |
| static Database * | open_checked (const string &aPath, const string &aLabel) |
| Open the table and refuse one the reader cannot serve. | |
| 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, n and a jc table with a measured self-field curve continue the table C1 and non-increasing in |B| ( see the low-field notes below ); a jc table without that curve keeps the 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. Only "jc" reads the measured self-field curve ( icw column, Icw/t_eff calibration ); anything else is an n table, continued below Bmin from the table alone. |
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):
|
overridedefault |
Destructor - deletes the database.
|
inline |
the jc anchor J = smax( a, b ) and its derivative along one of T or angle; aA_q, aV_q, aS_q are that derivative of a, V, S
|
inline |
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.
true where wrap_angle holds the angle on a window end, so the value does not change with it
|
inline |
value below Bmin and one derivative of it: aMode 0 d/dB, 1 d/dT, 2 d/dangle
|
inline |
true if B lies on the continuation of this label
|
inlineoverridevirtual |
d(value)/d|B|, the exact derivative of eval
The table stores f = log10( value ) over u = log10 B, so d(value)/dB = value · (∂f/∂u) / B — ln10 cancels. Zero where eval clamps B ( above Bmax, and below Bmin for a jc table without a measured self-field curve ); at Bmin itself the continuation and the table share the slope.
Reimplemented from belfem::material::JcFunction.
|
inlineoverridevirtual |
d(value)/dθ, the exact derivative of eval
θ is stored linearly, so d(value)/dθ = value · ln10 · ∂f/∂θ; the ±π wrap is a shift ( dθ_wrapped/dθ = 1 ), and the snap onto a window end holds the value ( zero ).
Reimplemented from belfem::material::JcFunction.
|
inlineoverridevirtual |
d(value)/dT, the exact derivative of eval
T is stored linearly: d(value)/dT = value · ln10 · ∂f/∂T. Outside the temperature window the value is held, so the tangent is zero.
Reimplemented from belfem::material::JcFunction.
|
inline |
the table on the face log10 B = log10 Bmin; d/dT and d/dangle terms only when asked for
|
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] |
T is clamped to [ Tmin, Tmax ] and B above Bmax to Bmax; the angle is wrapped into the table window. Below Bmin the value is the continuation described above ( a jc table without a measured self-field curve keeps the clamp ).
Reimplemented from belfem::material::JcFunction.
|
inline |
isotonic projection ( the running maximum from high to low T ) of the measured curve, and its knot slopes ( Fritsch & Butland 1984, Eq. 5; one-sided secants at the ends ), which keep every segment monotone ( Fritsch & Carlson 1980, §4 )
|
inlinestatic |
linear interpolation on the raw curve, clamped at both ends; used only to calibrate the curve at 77.5 K
|
inline |
the jc Hermite on [ 0, Bmin ]: value, and the slope at B = 0 with its derivative along T or angle
|
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 the jc table keeps the clamp below Bmin.
|
inlineoverridevirtual |
smallest value the table can produce; values are stored as log10, so exponentiate the raw minimum
Reimplemented from belfem::material::JcFunction.
|
inlinestatic |
Open the table and refuse one the reader cannot serve.
Runs before any member reads the database, and owns it until every check has passed, so a refusal does not leak it. Every rank holds the same values ( Database broadcasts them ), so every rank refuses together.
|
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.
the measured anchor and its dT: the C1 Hermite of the knots, continued linearly from the end knots outside them