Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F68705588
adimensional_system_structs.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
Fri, Jun 28, 14:26
Size
6 KB
Mime Type
text/x-c
Expires
Sun, Jun 30, 14:26 (2 d)
Engine
blob
Format
Raw Data
Handle
18598024
Attached To
rSPECMICP SpecMiCP / ReactMiCP
adimensional_system_structs.hpp
View Options
#ifndef SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP
#define SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP
#include "common.hpp"
//! \file adimensional_system_structs.hpp Options and constraints for the AdimensionalSystem
namespace
specmicp
{
//! \struct AdimensionalSystemOptions
//! \brief Options for the Adimensional Systems
//!
//! It is mainly about the secondary variables fixed-point iterations
struct
AdimensionalSystemOptions
{
bool
non_ideality
;
//!< Solve for non ideality
scalar_t
non_ideality_tolerance
;
//!< Tolerance for non ideality
index_t
non_ideality_max_iter
;
//!< Max iterations fornon ideality
scalar_t
under_relaxation_factor
;
//!< Under relaxation factor for the conservation of water
scalar_t
restart_concentration
;
//!< Log of the molality used to restart the computation
scalar_t
start_non_ideality_computation
;
//!< Factor to start the non-ideality computation
AdimensionalSystemOptions
()
:
non_ideality
(
true
),
non_ideality_tolerance
(
1e-8
),
non_ideality_max_iter
(
10
),
under_relaxation_factor
(
0.9
),
restart_concentration
(
-
6
),
start_non_ideality_computation
(
0.1
)
{}
};
//! \enum AqueousComponentEquationType
//! \brief Type of an aqueous component equation
enum
class
AqueousComponentEquationType
{
NoEquation
=
no_equation
,
//!< Not an equation, component is not present in the system
MassConservation
,
//!< Mass balance
ChargeBalance
,
//!< M.B. replaced by charge balance
FixedFugacity
,
//!< M.B. replaced by a fixed fugacity equation
FixedActivity
//!< M.B. replaced by a fixed activity equation
};
//! \enum WaterEquationType
//! \brief The type of the equation solved for the water
enum
class
WaterEquationType
{
NoEquation
=
no_equation
,
//!< Amount of water is not solved
MassConservation
,
//!< Water is conserved
SaturatedSystem
//!< System is saturated
};
//! \struct FixedFugacityConstraint
//! \brief Struct to contain information needed to solve a fix fugacity problem
struct
FixedFugacityConstraint
{
index_t
id_gas
;
//!< Index of the fixed-fugacity gas
index_t
id_component
;
//!< Index of the corresponding component
scalar_t
log_value
;
//!< Log_10 of the fugacity
FixedFugacityConstraint
(
index_t
gas
,
index_t
component
,
scalar_t
logvalue
)
:
id_gas
(
gas
),
id_component
(
component
),
log_value
(
logvalue
)
{}
};
//! \struct FixedActivityConstraint
//! \brief Struct to contain information needed to solve a fix activity problem.
struct
FixedActivityConstraint
{
index_t
id_component
;
//!< Index of the fixed-activity component
scalar_t
log_value
;
//!< Log_10 of the activity
FixedActivityConstraint
(
index_t
component
,
scalar_t
logvalue
)
:
id_component
(
component
),
log_value
(
logvalue
)
{}
};
//! \struct AdimensionalSystemConstraints
//! \brief Struct to contains the "Boundary conditions" for the AdimensionalSystem
struct
AdimensionalSystemConstraints
{
Vector
total_concentrations
;
//!< Total concentrations
WaterEquationType
water_equation
;
//!< Water equation
index_t
charge_keeper
;
//!< The equation for this component is replace by the charge balance
bool
saturated_system
;
//!> System is saturated - no gas phase
std
::
vector
<
FixedFugacityConstraint
>
fixed_fugacity_cs
;
//!< Contains information about fixed fugacity gas
std
::
vector
<
FixedActivityConstraint
>
fixed_activity_cs
;
//!< Contains information about fixed activity component
scalar_t
inert_volume_fraction
;
//! Volume fraction of inert solid (inert in the equilibrium computation)
AdimensionalSystemConstraints
()
:
water_equation
(
WaterEquationType
::
MassConservation
),
charge_keeper
(
no_species
),
inert_volume_fraction
(
0.0
)
{}
AdimensionalSystemConstraints
(
const
Vector
&
total_concs
)
:
total_concentrations
(
total_concs
),
water_equation
(
WaterEquationType
::
MassConservation
),
charge_keeper
(
no_species
),
inert_volume_fraction
(
0.0
)
{}
//! \brief Enable the conservation of water
void
enable_conservation_water
()
{
water_equation
=
WaterEquationType
::
MassConservation
;}
//! \brief Disable the conservation of water
void
disable_conservation_water
()
{
water_equation
=
WaterEquationType
::
NoEquation
;}
//! \brief The system is saturated
void
set_saturated_system
()
{
water_equation
=
WaterEquationType
::
SaturatedSystem
;}
//! \brief Set the charge keeper to 'component'
//!
//! \param component Index of the component (in the database)
void
set_charge_keeper
(
index_t
component
)
{
charge_keeper
=
component
;
}
//! \brief Add a fixed fugacity gas condition
//!
//! \param constraint struct containing the information about a fixed-fugacity constraint
void
add_fixed_fugacity_gas
(
const
FixedFugacityConstraint
&
constraint
)
{
fixed_fugacity_cs
.
push_back
(
constraint
);
}
//! \brief Add a fixed fugacity gas condition
//!
//! \param gas Index of the gas (in the database)
//! \param component Index of the corresponding component (in the database)
//! \param logvalue Log_10 of the fugacity
void
add_fixed_fugacity_gas
(
index_t
gas
,
index_t
component
,
scalar_t
logvalue
)
{
fixed_fugacity_cs
.
push_back
(
FixedFugacityConstraint
(
gas
,
component
,
logvalue
));
}
//! \brief Add a fixed activity component condition
//!
//! \param constraint struct containing the information about a fixed-activity constraint
void
add_fixed_activity_component
(
const
FixedActivityConstraint
&
constraint
)
{
fixed_activity_cs
.
push_back
(
constraint
);
}
//! \brief Add a fixed activity component condition
//!
//! \param component Index of the corresponding component (in the database)
//! \param log_value Log_10 of the activity
void
add_fixed_activity_component
(
index_t
component
,
scalar_t
log_value
)
{
fixed_activity_cs
.
push_back
(
FixedActivityConstraint
(
component
,
log_value
));
}
//! \brief Set the inert volume fraction
//!
//! The volume fraction of the inert phase is used to offset the saturation.
//! This inert phase may correspond to aggregates or solid phases governed by kinetics.
//!
//! \param value volume fraction of the inert phase
void
set_inert_volume_fraction
(
scalar_t
value
){
inert_volume_fraction
=
value
;
}
};
}
// end namespace specmicp
#endif
// SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP
Event Timeline
Log In to Comment