BELFEM 0.9.3
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
88
89//------------------------------------------------------------------------------
90
135 {
136 protected:
137
139
140 public:
141
142 JcFunction() = default;
143
144 virtual
145 ~JcFunction() = default;
146
147 bool
148 depends_on( const JcParameter aParameter ) const;
149
158 virtual real
159 min_value() const
160 {
161 return BELFEM_QUIET_NAN ;
162 }
163
164 bool
165 is_constant() const ;
166
173 virtual real
174 eval(
175 const real normB,
176 const real angle
177 ) const;
178
186 virtual real
187 eval(
188 const real normB,
189 const real angle,
190 const real T
191 ) const;
192
209 virtual real
210 deval_dB(
211 const real normB,
212 const real angle,
213 const real T
214 ) const;
215
227 virtual real
229 const real normB,
230 const real angle,
231 const real T
232 ) const;
233
240 virtual real
241 deval_dT(
242 const real normB,
243 const real angle,
244 const real T
245 ) const;
246
247 protected:
248
256 void
257 set_dependency( const JcParameter aParameter );
258
259 };
260
261 inline bool
262 JcFunction::depends_on( const JcParameter aParameter ) const
263 {
264 return mDependency.test( static_cast< uint >( aParameter ) );
265 }
266
267 inline bool
269 {
270 return mDependency.count() == 0 ;
271 }
272
273 }
274}
275#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:159
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
Definition cl_JcFunction.hpp:268
JcDependency mDependency
Definition cl_JcFunction.hpp:138
virtual ~JcFunction()=default
bool depends_on(const JcParameter aParameter) const
Definition cl_JcFunction.hpp:262
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
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
Definition cl_JcFunction.hpp:87
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:86