BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_ODE_Integrator.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_ODE_INTEGRATOR_HPP
13#define BELFEM_CL_ODE_INTEGRATOR_HPP
14
15#include "typedefs.hpp"
16#include "cl_Cell.hpp"
17#include "cl_Vector.hpp"
18#include "en_ODE_Type.hpp"
19#include "cl_ODE.hpp"
20
21namespace belfem
22{
23 namespace ode
24 {
26 {
27 // equation object
28 ODE & mODE ;
29
30 // type of this integrator
31 Type mType ;
32
33 // memory for integration equation
34 Cell< Vector< real > > mWork ;
35
36 // convergence criterion
37 real mEpsilon = 1.0e-7 ;
38
39 // maximum number of iterations per step
40 uint mMaxNumIterations = 1000 ;
41
42 // maximum T-value
43 real mMaxTime = BELFEM_REAL_MAX ;
44
45 // current time
46 real mTime = 0.0;
47
48 // timestep
49 real mDeltaTime = 1.0;
50
51 // flag if timestep is adapted
52 bool mAutoTimestep = true ;
53
54 Status
55 ( * mIntegrationFunction ) ( ODE & aODE,
56 real & aT,
57 Vector< real > & aY,
58 real & aStep,
59 Cell< Vector< real > > & aWork,
60 const real aEpsilon ,
61 const uint aMaxIterations ,
62 const real aXmax,
63 const bool aAutoTimestep ) ;
64
65//------------------------------------------------------------------------------
66 public:
67//------------------------------------------------------------------------------
68
69 Integrator( ODE & aObject, const Type aType );
70
71//------------------------------------------------------------------------------
72
73 ~Integrator() = default ;
74
75//------------------------------------------------------------------------------
76
80 inline real &
81 epsilon();
82
83//------------------------------------------------------------------------------
84
88 inline uint &
90
91//------------------------------------------------------------------------------
92
96 inline real &
97 time();
98
99 inline real &
100 maxtime();
101
102//------------------------------------------------------------------------------
103
107 inline real &
108 timestep();
109
110//------------------------------------------------------------------------------
111
115 Status
116 step( real & aT, Vector< real > & aY );
117
118//------------------------------------------------------------------------------
119
123 const Type &
124 type() const ;
125
126//------------------------------------------------------------------------------
127
131 void
132 set_auto_timestep( const bool aAutoTimestep=true );
133
134//-----------------------------------------------------------------------------
135
136 };
137
138//------------------------------------------------------------------------------
139
140 inline real &
142 {
143 return mEpsilon;
144 }
145
146//------------------------------------------------------------------------------
147
148 inline uint &
150 {
151 return mMaxNumIterations;
152 }
153
154//------------------------------------------------------------------------------
155
156 inline real &
158 {
159 return mTime;
160 }
161
162//------------------------------------------------------------------------------
163
164 inline real &
166 {
167 return mMaxTime;
168 }
169
170//------------------------------------------------------------------------------
171
172 inline real &
174 {
175 return mDeltaTime;
176 }
177
178//------------------------------------------------------------------------------
179
180 inline const Type &
182 {
183 return mType ;
184 }
185
186//------------------------------------------------------------------------------
187
188 inline void
189 Integrator::set_auto_timestep( const bool aAutoTimestep )
190 {
191 mAutoTimestep = aAutoTimestep ;
192 }
193
194//------------------------------------------------------------------------------
195 }
196}
197#endif //BELFEM_CL_ODE_INTEGRATOR_HPP
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
const Type & type() const
return the type
Definition cl_ODE_Integrator.hpp:181
uint & max_num_iterations()
set the maximum number of iterations
Definition cl_ODE_Integrator.hpp:149
real & maxtime()
Definition cl_ODE_Integrator.hpp:165
Integrator(ODE &aObject, const Type aType)
Definition cl_ODE_Integrator.cpp:24
Status step(real &aT, Vector< real > &aY)
perform one single step
Definition cl_ODE_Integrator.cpp:53
real & timestep()
return the current timestep
Definition cl_ODE_Integrator.hpp:173
void set_auto_timestep(const bool aAutoTimestep=true)
set the autotimestep flag
Definition cl_ODE_Integrator.hpp:189
real & time()
return t-coordinate
Definition cl_ODE_Integrator.hpp:157
real & epsilon()
return the convergence criterion
Definition cl_ODE_Integrator.hpp:141
an object that can create an ordinary differential equation
Definition cl_ODE.hpp:28
Definition cl_BDF.cpp:21
Type
Definition en_ODE_Type.hpp:20
Status
Definition en_ODE_Status.hpp:20
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
double real
Definition typedefs.hpp:36
#define BELFEM_REAL_MAX
Definition typedefs.hpp:81