From 4e209d67138e4f8d3818eec2097f089254523f18 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Wed, 7 Dec 2016 15:06:01 -0500 Subject: [PATCH] Fix a bug in 3D when using supercapacitor geometry. --- cpp/source/deal.II/geometry.templates.h | 14 +++++++------- cpp/test/test_geometry.cc | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/cpp/source/deal.II/geometry.templates.h b/cpp/source/deal.II/geometry.templates.h index 6fd555d..784502a 100644 --- a/cpp/source/deal.II/geometry.templates.h +++ b/cpp/source/deal.II/geometry.templates.h @@ -190,10 +190,10 @@ void Component::build_triangulation() } else if (shape.compare("hyper_trapezoid_2") == 0) { - // Create the following trapezoid: - // 2-3 - // / \ - // 0-----1 + /* Create the following trapezoid: + 2-3 + / \ + 0-----1 */ build_trapezoid_2(box_dimensions[1], edge, triangulation); offset = box_dimensions[1][0] + 1e-5; } @@ -389,10 +389,10 @@ Geometry::Geometry(std::shared_ptr database, } else { - std::string collector_div("3,3,3"); - std::string anode_div("5,5,2"); + std::string collector_div("4,4,3"); + std::string anode_div("4,4,2"); std::string separator_div("4,4,2"); - std::string cathode_div("5,5,2"); + std::string cathode_div("4,4,2"); database->put("collector.divisions", collector_div); database->put("anode.divisions", anode_div); database->put("separator.divisions", separator_div); diff --git a/cpp/test/test_geometry.cc b/cpp/test/test_geometry.cc index f775a11..2a599a8 100644 --- a/cpp/test/test_geometry.cc +++ b/cpp/test/test_geometry.cc @@ -158,6 +158,26 @@ BOOST_AUTO_TEST_CASE(test_3d_geometry) BOOST_CHECK(n_cells == triangulation->n_active_cells()); } +BOOST_AUTO_TEST_CASE(test_3d_supercapacitor) +{ + boost::property_tree::ptree device_database; + boost::property_tree::info_parser::read_info("super_capacitor.info", + device_database); + device_database.put("dim", 3); + + std::shared_ptr device = + cap::EnergyStorageDevice::build(device_database, + boost::mpi::communicator()); + std::shared_ptr> supercapacitor = + std::static_pointer_cast>(device); + std::shared_ptr> geometry = supercapacitor->get_geometry(); + std::shared_ptr const> triangulation = + geometry->get_triangulation(); + write_mesh("output_test_geometry_2.vtu", geometry->get_triangulation()); + const unsigned int n_cells = 1536; + BOOST_CHECK(n_cells == triangulation->n_active_cells()); +} + BOOST_AUTO_TEST_CASE(n_refinements) { boost::property_tree::ptree ptree;