Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F62241459
kinetic_system_euler_solver.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, May 11, 21:22
Size
821 B
Mime Type
text/x-c
Expires
Mon, May 13, 21:22 (2 d)
Engine
blob
Format
Raw Data
Handle
17623632
Attached To
rSPECMICP SpecMiCP / ReactMiCP
kinetic_system_euler_solver.cpp
View Options
#include "kinetic_system_euler_solver.hpp"
#include "kinetic_model.hpp"
#include "odeint/runge_kutta_step.hpp"
#include <functional>
namespace
specmicp
{
namespace
kinetics
{
void
AdimKineticSystemEulerSolver
::
solve
(
scalar_t
dt
,
scalar_t
total
)
{
double
t
=
0.0
;
Vector
y
=
m_system
.
variables
().
concentration_minerals
();
Vector
dydx
(
y
.
rows
());
dydx
.
setZero
();
while
(
t
<
total
)
{
m_system
.
rhs
(
t
,
y
,
dydx
,
get_options
().
speciation_options
);
y
+=
dt
*
dydx
;
m_system
.
update_to_new_initial_condition
(
y
,
dt
);
t
+=
dt
;
if
(
t
+
dt
>
total
)
dt
=
(
total
-
t
);
}
m_system
.
update_total_concentrations
(
y
);
m_system
.
compute_equilibrium
(
m_system
.
constraints
(),
get_options
().
speciation_options
);
}
}
// end namespace kinetics
}
// end namespace specmicp
Event Timeline
Log In to Comment