Skip to content

Commit

Permalink
Fix a bug in 3D when using supercapacitor geometry.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rombur committed Dec 7, 2016
1 parent 25e4e3d commit 4e209d6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cpp/source/deal.II/geometry.templates.h
Expand Up @@ -190,10 +190,10 @@ void Component<dim>::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;
}
Expand Down Expand Up @@ -389,10 +389,10 @@ Geometry<dim>::Geometry(std::shared_ptr<boost::property_tree::ptree> 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);
Expand Down
20 changes: 20 additions & 0 deletions cpp/test/test_geometry.cc
Expand Up @@ -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<cap::EnergyStorageDevice> device =
cap::EnergyStorageDevice::build(device_database,
boost::mpi::communicator());
std::shared_ptr<cap::SuperCapacitor<3>> supercapacitor =
std::static_pointer_cast<cap::SuperCapacitor<3>>(device);
std::shared_ptr<cap::Geometry<3>> geometry = supercapacitor->get_geometry();
std::shared_ptr<dealii::distributed::Triangulation<3> 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;
Expand Down

0 comments on commit 4e209d6

Please sign in to comment.