Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80121696
test_axisymmetric_uniform_mesh_1d.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
Fri, Aug 30, 00:21
Size
3 KB
Mime Type
text/x-c
Expires
Sun, Sep 1, 00:21 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20301192
Attached To
rSPECMICP SpecMiCP / ReactMiCP
test_axisymmetric_uniform_mesh_1d.cpp
View Options
#include "catch.hpp"
#include "dfpm/meshes/axisymmetric_uniform_mesh1d.hpp"
#include "dfpm/meshes/axisymmetric_mesh1d.hpp"
using namespace specmicp::mesh;
TEST_CASE("Axisymmetric uniform mesh 1d", "[Reactmicp, mesh, axisymmetric, uniform, 1D]") {
SECTION("test uniform mesh 1d") {
double nb_node = 6;
double radius = 5;
double dx = 1;
double height = 2;
AxisymmetricUniformMesh1D mesh(nb_node, radius, height);
REQUIRE(mesh.nb_nodes() == nb_node);
REQUIRE(mesh.nb_elements() == nb_node - 1);
REQUIRE(mesh.get_dx(0) == dx);
REQUIRE(mesh.get_radius_face(0) == 4.5);
REQUIRE(mesh.get_radius_face(1) == 3.5);
REQUIRE(std::abs(mesh.get_face_area(0) - 2*M_PI*4.5*height) < 1e-10);
REQUIRE(std::abs(mesh.get_volume_element(0) - M_PI*height*(5*5-4*4)) < 1e-10);
REQUIRE(std::abs(mesh.get_volume_cell(0) - M_PI*height*(5*5-4.5*4.5)) < 1e-10);
REQUIRE(std::abs(mesh.get_volume_element(1) - M_PI*height*(4*4-3*3)) < 1e-10);
REQUIRE(std::abs(mesh.get_volume_cell(1) - M_PI*height*(4.5*4.5-3.5*3.5)) < 1e-10);
int check_nb_node = 0;
for (int node: mesh.range_nodes()) {++check_nb_node;}
REQUIRE(check_nb_node == nb_node);
int check_nb_element = 0;
for (int element: mesh.range_elements()) {++check_nb_element;}
REQUIRE(check_nb_element == mesh.nb_elements());
int check_nen = 0;
for (int node: mesh.range_nen()) {++check_nen;}
REQUIRE(check_nen == 2);
}
}
TEST_CASE("Axisymmetric mesh 1d", "[Reactmicp, mesh, axisymmetric, 1D]") {
SECTION("test uniform mesh 1d") {
double nb_node = 6;
double radius = 5;
double dx = 1;
double height = 2;
UniformAxisymmetricMesh1DGeometry geometry;
geometry.nb_nodes = nb_node;
geometry.radius = radius;
geometry.dx = dx;
geometry.height = height;
Mesh1DPtr uniform_mesh = axisymmetric_uniform_mesh1d(nb_node, radius, dx, height);
Mesh1DPtr generic_mesh = uniform_axisymmetric_mesh1d(geometry);
CHECK(generic_mesh->nb_nodes() == nb_node);
CHECK(uniform_mesh->nb_nodes() == generic_mesh->nb_nodes());
CHECK(uniform_mesh->nb_elements() == generic_mesh->nb_elements());
CHECK(generic_mesh->get_dx(0) == dx);
CHECK(generic_mesh->get_face_area(0) == Approx(2*M_PI*4.5*height));
CHECK(generic_mesh->get_face_area(0) == uniform_mesh->get_face_area(0));
CHECK(generic_mesh->get_volume_element(0) == Approx(M_PI*height*(5*5-4*4)));
CHECK(generic_mesh->get_volume_cell(0) == Approx(M_PI*height*(5*5-4.5*4.5)));
CHECK(generic_mesh->get_volume_element(1) == Approx(M_PI*height*(4*4-3*3)));
CHECK(generic_mesh->get_volume_cell(1) == Approx(M_PI*height*(4.5*4.5-3.5*3.5)));
int check_nb_node = 0;
for (int node: generic_mesh->range_nodes()) {++check_nb_node;}
CHECK(check_nb_node == nb_node);
int check_nb_element = 0;
for (int element: generic_mesh->range_elements()) {++check_nb_element;}
CHECK(check_nb_element == generic_mesh->nb_elements());
int check_nen = 0;
for (int node: generic_mesh->range_nen()) {++check_nen;}
CHECK(check_nen == 2);
}
}
Event Timeline
Log In to Comment