BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::material::JcFunction Class Reference

Base class for critical current density (Jc) and n-value functions. More...

#include <cl_JcFunction.hpp>

Inheritance diagram for belfem::material::JcFunction:
[legend]
Collaboration diagram for belfem::material::JcFunction:
[legend]

Public Member Functions

 JcFunction ()=default
 Default constructor.
virtual ~JcFunction ()=default
 Virtual destructor.
bool depends_on (const JcParameter aParameter) const
 Check if function depends on a parameter.
virtual real min_value () const
 Smallest value this function can return, when known.
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.
virtual real eval (const real normB, const real angle, const real T) const
 Evaluate with full temperature, field, and angle dependence.
virtual real deval_dB (const real normB, const real angle, const real T) const
 Derivative of eval with respect to the field magnitude.
virtual real deval_dbeta (const real normB, const real angle, const real T) const
 Derivative of eval with respect to the field angle.
virtual real deval_dT (const real normB, const real angle, const real T) const
 Derivative of eval with respect to temperature.

Protected Member Functions

void set_dependency (const JcParameter aParameter)
 Mark function as depending on a parameter.

Protected Attributes

JcDependency mDependency

Detailed Description

Base class for critical current density (Jc) and n-value functions.

This abstract base class provides the interface for computing:

  • Jc(B, angle, T): Critical current density [A/m²]
  • n(B, angle, T): Power law exponent [-]

The same class is used for both properties since they have identical functional dependencies and evaluation signatures.

Derived Classes

  • JcFunctionModifiedKim: Analytical modified Kim model
    • Dependencies: normB, angleNxB
    • Overrides: eval(B, angle)
  • JcFunctionDatabase: Lookup table from HDF5 file
    • Dependencies: normB, angleNxB, T
    • Overrides: eval(B, angle, T)

Virtual Function Behavior

Both eval() methods have default implementations that throw errors. Derived classes override the appropriate method(s) based on their dependency set:

  • If depends on T: Override eval(B, angle, T)
  • If no T dependence: Override eval(B, angle)

The Material class calls the appropriate eval() based on the dependency flags queried via depends_on().

Ownership and Lifetime

Material takes ownership of assigned JcFunction objects:

JcFunction* jc = factory.create_jc_function(1e9, 5.0, 0.5, 2.0);
hts->set_jc_function(jc); // Material deletes jc in destructor
// Do NOT call delete jc!
JcFunction()=default
Default constructor.
@ jc
Definition cl_Material.hpp:186
See also
BELFEM Materials Module - Usage Guide

Constructor & Destructor Documentation

◆ JcFunction()

belfem::material::JcFunction::JcFunction ( )
default

Default constructor.

◆ ~JcFunction()

virtual belfem::material::JcFunction::~JcFunction ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ depends_on()

bool belfem::material::JcFunction::depends_on ( const JcParameter aParameter) const
inline

Check if function depends on a parameter.

Parameters
aParameterParameter to check (normB, angleNxB, or T)
Returns
True if function depends on this parameter

◆ deval_dB()

real belfem::material::JcFunction::deval_dB ( const real normB,
const real angle,
const real T ) const
virtual

Derivative of eval with respect to the field magnitude.

Parameters
normBMagnetic field magnitude [T]
angleAngle between surface normal and field [rad]
TTemperature [K]
Returns
d(jc)/d|B| [A/m²/T] or d(n)/d|B| [1/T]

The base implementation returns 0, which is EXACT for constant functions and the conservative fallback for derived classes that have not implemented an analytic form ( ModifiedKim, UserDefined ): a zero here reproduces the pre-lookup-derivative tangent for that function rather than inventing a wrong one. Unlike eval(), it does not abort — the Newton consumer ( add_rho_field_tangent ) treats 0 as "no field channel" and early-outs.

Reimplemented in belfem::material::JcFunctionDatabase.

◆ deval_dbeta()

real belfem::material::JcFunction::deval_dbeta ( const real normB,
const real angle,
const real T ) const
virtual

Derivative of eval with respect to the field angle.

Returns
d(jc)/dθ [A/m²/rad] or d(n)/dθ [1/rad]

Same zero-default contract as deval_dB. NOTE: for HTS the angle is bn_angle ( field to tape normal, UNFOLDED [ 0, pi ] since 2026-08-16 ), and the existing Newton kernel differentiates bj_angle ( field to current, the metal Kohler variable ) — so this hook must NOT be wired into add_rho_field_tangent's beta channel until a signed bn_angle d(theta)/dq chain exists there ( 2026-08-13 audit, both voices; known residual ).

Reimplemented in belfem::material::JcFunctionDatabase.

◆ deval_dT()

real belfem::material::JcFunction::deval_dT ( const real normB,
const real angle,
const real T ) const
virtual

Derivative of eval with respect to temperature.

Returns
d(jc)/dT [A/m²/K] or d(n)/dT [1/K]

Same zero-default contract as deval_dB.

Reimplemented in belfem::material::JcFunctionDatabase.

◆ eval() [1/2]

real belfem::material::JcFunction::eval ( const real normB,
const real angle ) const
virtual

Evaluate with field and angle dependence.

Parameters
normBMagnetic field magnitude [T]
angleAngle between surface normal and field [rad]
Returns
Jc or n value [A/m²] or [-]

Reimplemented in belfem::material::JcFunctionModifiedKim, and belfem::material::JcFunctionUserDefined.

◆ eval() [2/2]

real belfem::material::JcFunction::eval ( const real normB,
const real angle,
const real T ) const
virtual

Evaluate with full temperature, field, and angle dependence.

Parameters
normBMagnetic field magnitude [T]
angleAngle between surface normal and field [rad]
TTemperature [K]
Returns
Jc or n value [A/m²] or [-]

Reimplemented in belfem::material::JcFunctionDatabase, and belfem::material::JcFunctionUserDefined.

◆ is_constant()

bool belfem::material::JcFunction::is_constant ( ) const
inline

Check if function is constant (no dependencies).

Returns
True if function has no dependencies

◆ min_value()

virtual real belfem::material::JcFunction::min_value ( ) const
inlinevirtual

Smallest value this function can return, when known.

Returns
min over the table for database-driven functions; NaN when no cheap bound exists ( analytic laws )

Used by Material::set_n_function for a load-time sanity warning on measured n tables that soften toward n = 1.

Reimplemented in belfem::material::JcFunctionDatabase.

◆ set_dependency()

void belfem::material::JcFunction::set_dependency ( const JcParameter aParameter)
protected

Mark function as depending on a parameter.

Parameters
aParameterParameter to add to dependency set

Used by derived class constructors to declare which parameters their implementation depends on.

Member Data Documentation

◆ mDependency

JcDependency belfem::material::JcFunction::mDependency
protected

The documentation for this class was generated from the following files: