Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122673373
reaction_path.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
Mon, Jul 21, 12:03
Size
2 KB
Mime Type
text/x-c++
Expires
Wed, Jul 23, 12:03 (2 d)
Engine
blob
Format
Raw Data
Handle
27540474
Attached To
rSPECMICP SpecMiCP / ReactMiCP
reaction_path.hpp
View Options
/*-------------------------------------------------------
- Module : specmicp
- File : reaction_path.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget, Princeton University
---------------------------------------------------------*/
#ifndef SPECMICP_SPECMICP_REACTIONPATH_HPP
#define SPECMICP_SPECMICP_REACTIONPATH_HPP
//! \file reaction_path.hpp reaction path driver
#include <memory>
#include <map>
#include "database/database.hpp"
#include "micpsolver/micpsolver_structs.hpp"
#include "reduced_system_solver.hpp"
namespace
specmicp
{
//! \brief typedef to a reaction path amount
//!
//! The first element is the inital amount,
//! The second element is the increase to add at every step
using
reaction_amount_t
=
std
::
pair
<
double
,
double
>
;
//! \brief A reaction path model
//!
//! Contains every data we need to run a reaction path model
struct
ReactionPathModel
{
//! The amount of components
std
::
map
<
std
::
string
,
reaction_amount_t
>
amount_components
;
//! The amount of aqueous species
std
::
map
<
std
::
string
,
reaction_amount_t
>
amount_aqueous
;
//! The amount of minerals
std
::
map
<
std
::
string
,
reaction_amount_t
>
amount_minerals
;
//! the number of step
int
nb_step
;
//! the path to the database - optional
std
::
string
database_path
;
};
//! \brief Driver to solve a reaction path model
class
ReactionPathDriver
{
public
:
//! \brief Initialise from a model
//!
//! Build a database from the attribute database_path of the model
ReactionPathDriver
(
std
::
shared_ptr
<
ReactionPathModel
>
model
)
:
m_model
(
model
)
{
read_database
();
}
//! \brief Initialise the driver from a model and a raw database
ReactionPathDriver
(
std
::
shared_ptr
<
ReactionPathModel
>
model
,
std
::
shared_ptr
<
database
::
DataContainer
>
data
)
:
m_model
(
model
),
m_database
(
data
),
m_data
(
data
)
{}
//! Initialize the database
void
read_database
();
//! Dissolve everything into components
void
dissolve_to_components
();
//! \brief Return the id of a species in 'list_labels' from its id
int
label_to_id
(
const
std
::
string
&
label
,
const
std
::
vector
<
std
::
string
>&
list_labels
);
//! \brief Perform one step
micpsolver
::
MiCPPerformance
one_step
(
Eigen
::
VectorXd
&
x
);
//! Set total aqueous concentrations
void
total_aqueous_concentration
(
const
Eigen
::
VectorXd
&
x
,
Eigen
::
VectorXd
&
totaq
)
{
m_current_solver
.
total_aqueous_concentration
(
x
,
totaq
);
}
private
:
std
::
shared_ptr
<
ReactionPathModel
>
m_model
;
specmicp
::
database
::
Database
m_database
;
std
::
shared_ptr
<
specmicp
::
database
::
DataContainer
>
m_data
;
Eigen
::
VectorXd
m_tot_conc
;
Eigen
::
VectorXd
m_tot_conc_increase
;
micpsolver
::
MiCPSolverOptions
m_options
;
ReducedSystemSolver
m_current_solver
;
//std::shared_ptr<ThermoData> m_thermo;
};
}
// end namespace specmicp
#endif
// SPECMICP_SPECMICP_REACTIONPATH_HPP
Event Timeline
Log In to Comment