BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
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
21
namespace
belfem
22
{
23
namespace
ode
24
{
25
class
Integrator
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
&
89
max_num_iterations
();
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
&
141
Integrator::epsilon
()
142
{
143
return
mEpsilon;
144
}
145
146
//------------------------------------------------------------------------------
147
148
inline
uint
&
149
Integrator::max_num_iterations
()
150
{
151
return
mMaxNumIterations;
152
}
153
154
//------------------------------------------------------------------------------
155
156
inline
real
&
157
Integrator::time
()
158
{
159
return
mTime;
160
}
161
162
//------------------------------------------------------------------------------
163
164
inline
real
&
165
Integrator::maxtime
()
166
{
167
return
mMaxTime;
168
}
169
170
//------------------------------------------------------------------------------
171
172
inline
real
&
173
Integrator::timestep
()
174
{
175
return
mDeltaTime;
176
}
177
178
//------------------------------------------------------------------------------
179
180
inline
const
Type
&
181
Integrator::type
()
const
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
cl_Cell.hpp
cl_ODE.hpp
cl_Vector.hpp
belfem::Cell
Cell is a wrapper around the standard vector.
Definition
cl_Cell.hpp:42
belfem::Vector< real >
belfem::ode::Integrator::type
const Type & type() const
return the type
Definition
cl_ODE_Integrator.hpp:181
belfem::ode::Integrator::max_num_iterations
uint & max_num_iterations()
set the maximum number of iterations
Definition
cl_ODE_Integrator.hpp:149
belfem::ode::Integrator::maxtime
real & maxtime()
Definition
cl_ODE_Integrator.hpp:165
belfem::ode::Integrator::Integrator
Integrator(ODE &aObject, const Type aType)
Definition
cl_ODE_Integrator.cpp:24
belfem::ode::Integrator::step
Status step(real &aT, Vector< real > &aY)
perform one single step
Definition
cl_ODE_Integrator.cpp:53
belfem::ode::Integrator::timestep
real & timestep()
return the current timestep
Definition
cl_ODE_Integrator.hpp:173
belfem::ode::Integrator::set_auto_timestep
void set_auto_timestep(const bool aAutoTimestep=true)
set the autotimestep flag
Definition
cl_ODE_Integrator.hpp:189
belfem::ode::Integrator::~Integrator
~Integrator()=default
belfem::ode::Integrator::time
real & time()
return t-coordinate
Definition
cl_ODE_Integrator.hpp:157
belfem::ode::Integrator::epsilon
real & epsilon()
return the convergence criterion
Definition
cl_ODE_Integrator.hpp:141
belfem::ode::ODE
an object that can create an ordinary differential equation
Definition
cl_ODE.hpp:28
en_ODE_Type.hpp
belfem::ode
Definition
cl_BDF.cpp:21
belfem::ode::Type
Type
Definition
en_ODE_Type.hpp:20
belfem::ode::Status
Status
Definition
en_ODE_Status.hpp:20
belfem
USER GUIDES:
Definition
cl_Capacitor.cpp:16
belfem::uint
unsigned int uint
Definition
typedefs.hpp:30
belfem::real
double real
Definition
typedefs.hpp:36
typedefs.hpp
BELFEM_REAL_MAX
#define BELFEM_REAL_MAX
Definition
typedefs.hpp:81
src
numerics
ode
cl_ODE_Integrator.hpp
Generated by
1.18.0