Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78441092
numbering.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
Tue, Aug 20, 21:54
Size
2 KB
Mime Type
text/x-c
Expires
Thu, Aug 22, 21:54 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
20034512
Attached To
rSPECMICP SpecMiCP / ReactMiCP
numbering.cpp
View Options
#include "catch.hpp"
#include "test_database.hpp"
#include "reactmicp/systems/diffusion/diffusion_numbering.hpp"
#include "utils.hpp"
using namespace specmicp;
using namespace specmicp::reactmicp::systems::diffusion;
TEST_CASE("Correct numbering for the reactive diffusion 1d", "[Diffusion,Numbering]") {
ListBoundaryCondition void_bcs;
DiffusionNumbering::Variables var;
std::shared_ptr<specmicp::database::DataContainer> database = get_test_carbo_database();
SECTION("3 component and 5 mineral, 5 nodes, no bc") {
DiffusionNumbering numberer(5, 3, 5, void_bcs, var);
CHECK( numberer.get_ndf() == 11 );
CHECK( numberer.get_ndof_diffusion(1) == 0 );
CHECK( numberer.get_ndof_diffusion(3) == 2 );
CHECK( numberer.get_ndof_massbalance(1) == 3 );
CHECK( numberer.get_ndof_massbalance(2) == 4 );
CHECK( numberer.get_ndof_mineral(0) == 6 );
CHECK( numberer.get_ndof_mineral(4) == 10 );
CHECK( numberer.get_dof_diffusion(0, 3) == numberer.get_ndof_diffusion(3) );
CHECK( numberer.get_dof(3, 2) == 11*3+2 );
CHECK( numberer.get_neq() == 5*11 );
CHECK( numberer.id_equation_diffusion(3, 3) == numberer.get_dof_diffusion(3, 3) );
CHECK( numberer.id_equation_massbalance(3, 3) == numberer.get_dof_massbalance(3, 3) );
CHECK( numberer.id_equation_mineral(3, 3) == numberer.get_dof_mineral(3, 3) );
}
SECTION("Initialization from database") {
DiffusionNumbering numberer(5, database, void_bcs, var);
REQUIRE( numberer.get_ndf() == 4+4+database->nb_mineral );
}
SECTION("Boundary conditions") {
EquilibriumState comp_bc;
REQUIRE_NOTHROW(comp_bc = blank_composition(database));
BoundaryCondition bc_node0;
bc_node0.node = 0;
bc_node0.composition = comp_bc;
bc_node0.fix_all();
CHECK(bc_node0.mineral.size() == database->nb_mineral);
REQUIRE(bc_node0.component.size() == database->nb_component -1);
ListBoundaryCondition bcs = {bc_node0,};
DiffusionNumbering numberer(5, database, bcs, var);
REQUIRE(numberer.get_neq() == numberer.get_ndf()*4);
REQUIRE(numberer.node_has_bc(0) == true);
REQUIRE(numberer.node_has_bc(1) == false);
REQUIRE(std::abs(std::pow(10.0, numberer.component_concentration(0, 2, var)) - comp_bc.molality_component(2)) < 1e-7);
}
}
Event Timeline
Log In to Comment