Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F71395830
kinetic_system.hpp
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
Thu, Jul 11, 12:04
Size
2 KB
Mime Type
text/x-c++
Expires
Sat, Jul 13, 12:04 (2 d)
Engine
blob
Format
Raw Data
Handle
18946067
Attached To
rSPECMICP SpecMiCP / ReactMiCP
kinetic_system.hpp
View Options
#ifndef SPECMICP_SPECMICP_KINETICS_KINETICSYSTEM_HPP
#define SPECMICP_SPECMICP_KINETICS_KINETICSYSTEM_HPP
#include <memory>
#include "common.hpp"
#include "database.hpp"
#include "kinetic_variables.hpp"
#include "specmicp/reduced_system_solver_structs.hpp"
namespace
specmicp
{
namespace
kinetics
{
class
KineticModel
;
//! \brief Kinetics System,
//!
//! Wrapper for a kinetic model
class
KineticSystem
{
public
:
KineticSystem
(
std
::
shared_ptr
<
KineticModel
>
model
,
const
Vector
&
total_concentrations
,
const
Vector
&
mineral_moles
,
RawDatabasePtr
data
)
:
m_data
(
data
),
m_model
(
model
),
m_variables
(
total_concentrations
,
mineral_moles
)
{}
KineticSystem
(
std
::
shared_ptr
<
KineticModel
>
model
,
const
Vector
&
total_concentrations
,
const
Vector
&
mineral_moles
,
const
EquilibriumState
&
equilibrium_solution
)
:
m_data
(
equilibrium_solution
.
get_database
()),
m_model
(
model
),
m_variables
(
total_concentrations
,
mineral_moles
,
equilibrium_solution
)
{}
//! \brief Compute the kinetics rates to be solved
//!
//! Use the kinetic model provided by the user
void
compute_rates
(
scalar_t
x
,
const
Vector
&
y
,
Vector
&
dydt
);
//! \brief Compute the equilibrium state of the solution
void
compute_equilibrium
(
ReducedSystemSolverOptions
options
=
ReducedSystemSolverOptions
());
//! \brief Update the total concentrations
//!
//! \param y vector of variables (mols of minerals)
void
update_total_concentrations
(
const
Vector
&
y
);
void
update_to_new_initial_condition
(
const
Vector
&
y
,
scalar_t
dt
);
//! \brief Right Hand side function for the integrator
void
rhs
(
scalar_t
x
,
const
Vector
&
y
,
Vector
&
dydt
,
ReducedSystemSolverOptions
options
=
ReducedSystemSolverOptions
())
{
update_total_concentrations
(
y
);
compute_equilibrium
(
options
);
compute_rates
(
x
,
y
,
dydt
);
}
KineticVariables
&
variables
()
{
return
m_variables
;}
private
:
RawDatabasePtr
m_data
;
std
::
shared_ptr
<
KineticModel
>
m_model
;
KineticVariables
m_variables
;
};
}
// end namespace kinetics
}
// end namespace specmicp
#endif
//SPECMICP_SPECMICP_KINETICS_KINETICSYSTEM_HPP
Event Timeline
Log In to Comment