Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61747538
variables.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
Wed, May 8, 17:32
Size
1 KB
Mime Type
text/x-c
Expires
Fri, May 10, 17:32 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17553172
Attached To
rSPECMICP SpecMiCP / ReactMiCP
variables.cpp
View Options
#include "catch.hpp"
#include "dfpm/mesh.hpp"
#include "reactmicp/systems/single/variables.hpp"
#include "reactmicp/systems/single/init_variables.hpp"
TEST_CASE("Single Variables test", "[Single, variables, initialisation]") {
SECTION("Creation") {
specmicp::mesh::Uniform1DMeshGeometry geom;
geom.nb_nodes = 5;
geom.dx = 0.1;
geom.section = 5.0;
specmicp::mesh::Mesh1DPtr the_mesh = specmicp::mesh::uniform_mesh1d(geom);
auto vars = specmicp::reactmicp::systems::single::SingleVariables(the_mesh);
REQUIRE( vars.get_mesh()->nb_nodes() == 5);
}
SECTION("Initialisation") {
specmicp::mesh::Uniform1DMeshGeometry geom;
geom.nb_nodes = 5;
geom.dx = 0.1;
geom.section = 5.0;
specmicp::mesh::Mesh1DPtr the_mesh = specmicp::mesh::uniform_mesh1d(geom);
std::vector<specmicp::index_t> fixed_nodes = {1,};
specmicp::Vector liquid_conc(5);
liquid_conc << 1,2,3,4,5;
specmicp::Vector solid_conc(5);
solid_conc << 6,7,8,9,10;
auto vars = specmicp::reactmicp::systems::single::init_variables(
the_mesh, fixed_nodes, liquid_conc, solid_conc);
REQUIRE( vars->get_mesh()->nb_nodes() == 5);
REQUIRE( vars->chemistry_rate()(4)== 0);
REQUIRE( vars->fluid_concentration(2) == 3);
REQUIRE( vars->bound_concentration(4) == 10);
}
}
Event Timeline
Log In to Comment