Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120105771
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
Tue, Jul 1, 23:47
Size
821 B
Mime Type
text/x-c
Expires
Thu, Jul 3, 23:47 (2 d)
Engine
blob
Format
Raw Data
Handle
27140094
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