Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80110153
adimensional_system_configuration.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
Thu, Aug 29, 22:44
Size
1 KB
Mime Type
text/x-c
Expires
Sat, Aug 31, 22:44 (2 d)
Engine
blob
Format
Raw Data
Handle
20301565
Attached To
rSPECMICP SpecMiCP / ReactMiCP
adimensional_system_configuration.cpp
View Options
#include "catch.hpp"
#include "utils/io/yaml.hpp"
#include <yaml-cpp/yaml.h>
#include "database.hpp"
#include "database/io/configuration.hpp"
#include "specmicp/io/configuration.hpp"
#include "specmicp/adimensional/adimensional_system_structs.hpp"
#include "specmicp/adimensional/adimensional_system_solver_structs.hpp"
#include "specmicp/problem_solver/formulation.hpp"
TEST_CASE
(
"Configuration"
,
"[SpecMiCP],[io],[configuration]"
)
{
YAML
::
Node
conf
=
specmicp
::
io
::
parse_config_file
(
"specmicp_conf_test.yaml"
);
specmicp
::
RawDatabasePtr
raw_db
=
specmicp
::
io
::
configure_database
(
conf
);
specmicp
::
AdimensionalSystemSolverOptions
opts
;
specmicp
::
io
::
configure_specmicp_options
(
opts
,
conf
);
SECTION
(
"Formulation"
)
{
specmicp
::
Formulation
formulation
;
specmicp
::
io
::
check_mandatory_yaml_node
(
conf
,
"speciation"
,
"__main__"
);
specmicp
::
io
::
check_mandatory_yaml_node
(
conf
[
"speciation"
][
0
],
"formulation"
,
"speciation 0"
);
specmicp
::
io
::
configure_specmicp_formulation
(
formulation
,
conf
[
"speciation"
][
0
][
"formulation"
],
raw_db
,
opts
.
units_set
);
CHECK
(
formulation
.
mass_solution
==
0.5
);
CHECK
(
formulation
.
concentration_aqueous
[
"H2CO3"
]
==
2.0
);
CHECK
(
formulation
.
concentration_aqueous
[
"NaOH"
]
==
Approx
(
0.2
/
(
22.99
+
16.00
+
1.008
)
/
0.5
));
CHECK
(
formulation
.
amount_minerals
[
"Portlandite"
]
==
5.0
);
}
SECTION
(
"Constraints"
)
{
specmicp
::
AdimensionalSystemConstraints
constraints
;
specmicp
::
io
::
check_mandatory_yaml_node
(
conf
,
"speciation"
,
"__main__"
);
specmicp
::
io
::
check_mandatory_yaml_node
(
conf
[
"speciation"
][
0
],
"constraints"
,
"speciation 0"
);
specmicp
::
io
::
configure_specmicp_constraints
(
constraints
,
conf
[
"speciation"
][
0
][
"constraints"
],
raw_db
);
CHECK
(
constraints
.
charge_keeper
==
raw_db
->
get_id_component
(
"Cl[-]"
));
CHECK
(
constraints
.
fixed_activity_cs
[
0
].
id_component
==
raw_db
->
get_id_component
(
"HO[-]"
));
CHECK
(
constraints
.
fixed_activity_cs
[
0
].
log_value
==
-
10.0
);
}
}
Event Timeline
Log In to Comment