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

User-defined critical current density (Jc) or power law exponent (n) function. More...

#include <cl_JcFunction_UserDefined.hpp>

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

Public Member Functions

 JcFunctionUserDefined (Material *Mat)
 Constructor.
 JcFunctionUserDefined (const JcFunctionUserDefined &)=delete
JcFunctionUserDefinedoperator= (const JcFunctionUserDefined &)=delete
 ~JcFunctionUserDefined () override=default
real eval (const real normB, const real angle) const override
 Evaluate the function (2-parameter version).
real eval (const real normB, const real angle, const real T) const override
 Evaluate the function (3-parameter version).
void set_jc_function (MatFunc2 *Function)
 Set the user-defined function pointer (2-parameter version).
void set_jc_function (MatFunc3 *Function)
 Set the user-defined function pointer (3-parameter version).
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.
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 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.

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

Detailed Description

User-defined critical current density (Jc) or power law exponent (n) function.

This class provides a wrapper for user-defined functions that compute Jc or n for superconducting materials. It supports both 2-parameter and 3-parameter function signatures:

  • MatFunc2: f(Material*, normB, angle) - Field and angle dependent
  • MatFunc3: f(Material*, normB, angle, T) - Field, angle, and temperature dependent

ANGLE CONTRACT (changed 2026-08-16): the angle is the UNFOLDED field-to-tape-normal angle θ ∈ [0, π] — before that change it arrived folded into [0, π/2]. A user function that is even in θ (cos², sin² only) is unaffected; one that used cos(θ) linearly or assumed θ ≤ π/2 must fold internally now. Plugins compiled against the old contract get the new angle silently — recompile and review.

The user provides a function pointer that will be called to evaluate the property. This allows complete customization while maintaining compatibility with the material framework.

IMPORTANT: This class is typically created and managed by UserDefinedMaterial. The material owns the JcFunctionUserDefined instance and will delete it.

Example usage (within a user-defined material library):

// User's custom Jc function
real my_jc_function(const Material* mat, real B, real angle, real T) {
// Custom implementation
return 1e9 / (1.0 + B/5.0) * exp(-T/90.0);
}
// In the material initialization function
extern "C" void MyMaterial_init(Material* mat) {
&my_jc_function
);
}
Base class for all materials in BELFEM.
Definition cl_Material.hpp:279
virtual void set_user_defined_function(const MaterialProperty Property, const MaterialDependency Dependency, MatFunc1 *Function)
Set a user-defined function with one dependency (for UserDefinedMaterial).
Definition cl_Material.cpp:749
@ angleNxB
Definition cl_Material.hpp:125
@ normB
Definition cl_Material.hpp:123
@ T
Definition cl_Material.hpp:122
@ jc
Definition cl_Material.hpp:186
double real
Definition typedefs.hpp:36

Constructor & Destructor Documentation

◆ JcFunctionUserDefined() [1/2]

belfem::material::JcFunctionUserDefined::JcFunctionUserDefined ( Material * Mat)
inline

Constructor.

Parameters
MatPointer to the parent material (not owned by this class)

◆ JcFunctionUserDefined() [2/2]

belfem::material::JcFunctionUserDefined::JcFunctionUserDefined ( const JcFunctionUserDefined & )
delete

◆ ~JcFunctionUserDefined()

belfem::material::JcFunctionUserDefined::~JcFunctionUserDefined ( )
overridedefault

Member Function Documentation

◆ eval() [1/2]

real belfem::material::JcFunctionUserDefined::eval ( const real normB,
const real angle ) const
inlineoverridevirtual

Evaluate the function (2-parameter version).

Parameters
normBMagnetic flux density magnitude [T]
angleAngle between field and normal direction [rad]
Returns
Critical current density [A/m²] or power law exponent [dimensionless]

Reimplemented from belfem::material::JcFunction.

◆ eval() [2/2]

real belfem::material::JcFunctionUserDefined::eval ( const real normB,
const real angle,
const real T ) const
inlineoverridevirtual

Evaluate the function (3-parameter version).

Parameters
normBMagnetic flux density magnitude [T]
angleAngle between field and normal direction [rad]
TTemperature [K]
Returns
Critical current density [A/m²] or power law exponent [dimensionless]

Reimplemented from belfem::material::JcFunction.

◆ operator=()

JcFunctionUserDefined & belfem::material::JcFunctionUserDefined::operator= ( const JcFunctionUserDefined & )
delete

◆ set_jc_function() [1/2]

void belfem::material::JcFunctionUserDefined::set_jc_function ( MatFunc2 * Function)
inline

Set the user-defined function pointer (2-parameter version).

Parameters
FunctionPointer to user function with signature: real(Material*, real, real)

◆ set_jc_function() [2/2]

void belfem::material::JcFunctionUserDefined::set_jc_function ( MatFunc3 * Function)
inline

Set the user-defined function pointer (3-parameter version).

Parameters
FunctionPointer to user function with signature: real(Material*, real, real, real)

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