Page MenuHomec4science

variables.cpp
No OneTemporary

File Metadata

Created
Wed, May 8, 17:32

variables.cpp

#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