BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_JcFunction.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_CL_JCFUNCTION_HPP
13#define BELFEM_CL_JCFUNCTION_HPP
14
62
63#include "typedefs.hpp"
64#include "cl_Bitset.hpp"
65
66namespace belfem
67{
68 namespace material
69 {
70//------------------------------------------------------------------------------
71
79 enum class JcParameter
80 {
81 normB = 1,
83 T = 3,
84 UNDEFINED = 4
85 };
86
91
92//------------------------------------------------------------------------------
93
138 {
139 protected:
140
142
143 public:
144
148 JcFunction() = default;
149
153 virtual
154 ~JcFunction() = default;
155
161 bool
162 depends_on( const JcParameter aParameter ) const;
163
172 virtual real
173 min_value() const
174 {
175 return BELFEM_QUIET_NAN ;
176 }
177
182 bool
183 is_constant() const ;
184
191 virtual real
192 eval(
193 const real normB,
194 const real angle
195 ) const;
196
204 virtual real
205 eval(
206 const real normB,
207 const real angle,
208 const real T
209 ) const;
210
227 virtual real
228 deval_dB(
229 const real normB,
230 const real angle,
231 const real T
232 ) const;
233
246 virtual real
248 const real normB,
249 const real angle,
250 const real T
251 ) const;
252
259 virtual real
260 deval_dT(
261 const real normB,
262 const real angle,
263 const real T
264 ) const;
265
266 protected:
267
275 void
276 set_dependency( const JcParameter aParameter );
277
278 };
279
280 inline bool
281 JcFunction::depends_on( const JcParameter aParameter ) const
282 {
283 return mDependency.test( static_cast< uint >( aParameter ) );
284 }
285
286 inline bool
288 {
289 return mDependency.count() == 0 ;
290 }
291
292 }
293}
294#endif //BELFEM_CL_JCFUNCTION_HPP
bool test(const index_t aIndex) const
test if a bit is set
Definition cl_Bitset.hpp:138
index_t count() const
count the number of true bits
Definition cl_Bitset.hpp:149
Bitset()=default
trivial constructor
virtual real deval_dB(const real normB, const real angle, const real T) const
Derivative of eval with respect to the field magnitude.
Definition cl_JcFunction.cpp:52
virtual real min_value() const
Smallest value this function can return, when known.
Definition cl_JcFunction.hpp:173
virtual real eval(const real normB, const real angle) const
Evaluate with field and angle dependence.
Definition cl_JcFunction.cpp:26
virtual real deval_dbeta(const real normB, const real angle, const real T) const
Derivative of eval with respect to the field angle.
Definition cl_JcFunction.cpp:62
void set_dependency(const JcParameter aParameter)
Mark function as depending on a parameter.
Definition cl_JcFunction.cpp:20
bool is_constant() const
Check if function is constant (no dependencies).
Definition cl_JcFunction.hpp:287
JcDependency mDependency
Definition cl_JcFunction.hpp:141
virtual ~JcFunction()=default
Virtual destructor.
bool depends_on(const JcParameter aParameter) const
Check if function depends on a parameter.
Definition cl_JcFunction.hpp:281
virtual real deval_dT(const real normB, const real angle, const real T) const
Derivative of eval with respect to temperature.
Definition cl_JcFunction.cpp:72
JcFunction()=default
Default constructor.
Definition cl_BhCurve.cpp:19
JcParameter
Parameters that Jc (or n) can depend on.
Definition cl_JcFunction.hpp:80
@ UNDEFINED
Definition cl_JcFunction.hpp:84
@ angleNxB
Definition cl_JcFunction.hpp:82
Bitset< static_cast< uint >(JcParameter::UNDEFINED) > JcDependency
Bitset for tracking Jc function dependencies.
Definition cl_JcFunction.hpp:90
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
double real
Definition typedefs.hpp:36
#define BELFEM_QUIET_NAN
Definition typedefs.hpp:87