Skip to content

Commit

Permalink
Merge pull request #257 from Rombur/update_dealii
Browse files Browse the repository at this point in the history
Clean up
  • Loading branch information
Rombur committed Aug 29, 2017
2 parents d946120 + d138f8f commit 926f5b3
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 157 deletions.
6 changes: 3 additions & 3 deletions cpp/source/deal.II/electrochemical_physics.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, the Cap authors.
/* Copyright (c) 2016 - 2017, the Cap authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
Expand Down Expand Up @@ -61,8 +61,8 @@ class ElectrochemicalPhysics : public Physics<dim>
void assemble_system(std::shared_ptr<PhysicsParameters<dim> const> parameters,
bool const inhomogeneous_bc);

unsigned int solid_potential_component;
unsigned int liquid_potential_component;
unsigned int _solid_potential_component;
unsigned int _liquid_potential_component;
Timer _assembly_timer;
Timer _setup_timer;
};
Expand Down
16 changes: 8 additions & 8 deletions cpp/source/deal.II/electrochemical_physics.templates.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, the Cap authors.
/* Copyright (c) 2016 - 2017, the Cap authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
Expand All @@ -22,17 +22,17 @@ template <int dim>
ElectrochemicalPhysics<dim>::ElectrochemicalPhysics(
std::shared_ptr<PhysicsParameters<dim> const> parameters,
boost::mpi::communicator mpi_communicator)
: Physics<dim>(parameters, mpi_communicator), solid_potential_component(-1),
liquid_potential_component(-1),
: Physics<dim>(parameters, mpi_communicator),
_solid_potential_component(-1), _liquid_potential_component(-1),
_assembly_timer(mpi_communicator, "ElectrochemicalPhysics assembly"),
_setup_timer(mpi_communicator, "ElectrochemicalPhysics setup")
{
_setup_timer.start();
boost::property_tree::ptree const &database = parameters->database;

// clang-format off
this->solid_potential_component = database.get<unsigned int>("solid_potential_component");
this->liquid_potential_component = database.get<unsigned int>("liquid_potential_component");
this->_solid_potential_component = database.get<unsigned int>("solid_potential_component");
this->_liquid_potential_component = database.get<unsigned int>("liquid_potential_component");
// clang-format on

auto const &anode_boundary_ids = (*this->geometry->get_boundaries())["anode"];
Expand Down Expand Up @@ -63,7 +63,7 @@ ElectrochemicalPhysics<dim>::ElectrochemicalPhysics(
unsigned int const n_components =
dealii::DoFTools::n_components(*(this->dof_handler));
std::vector<bool> mask(n_components, false);
mask[this->solid_potential_component] = true;
mask[this->_solid_potential_component] = true;
dealii::ComponentMask component_mask(mask);
typename dealii::FunctionMap<dim>::type dirichlet_boundary_condition;
dealii::ZeroFunction<dim> homogeneous_bc(n_components);
Expand Down Expand Up @@ -133,9 +133,9 @@ void ElectrochemicalPhysics<dim>::assemble_system(
dealii::FiniteElement<dim> const &fe = dof_handler.get_fe();

dealii::FEValuesExtractors::Scalar const solid_potential(
this->solid_potential_component);
this->_solid_potential_component);
dealii::FEValuesExtractors::Scalar const liquid_potential(
this->liquid_potential_component);
this->_liquid_potential_component);
dealii::QGauss<dim> quadrature_rule(fe.degree + 1);
dealii::FEValues<dim> fe_values(
fe, quadrature_rule, dealii::update_values | dealii::update_gradients |
Expand Down
12 changes: 6 additions & 6 deletions cpp/source/deal.II/post_processor.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, the Cap authors.
/* Copyright (c) 2016 - 2017, the Cap authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
Expand Down Expand Up @@ -94,11 +94,11 @@ class SuperCapacitorPostprocessor : public Postprocessor<dim>
std::shared_ptr<PostprocessorParameters<dim> const> parameters) override;

private:
bool debug_material_ids;
bool debug_boundary_ids;
std::vector<std::string> debug_material_properties;
std::vector<std::string> debug_solution_fields;
std::vector<std::string> debug_solution_fluxes;
bool _debug_material_ids;
bool _debug_boundary_ids;
std::vector<std::string> _debug_material_properties;
std::vector<std::string> _debug_solution_fields;
std::vector<std::string> _debug_solution_fluxes;
std::shared_ptr<Geometry<dim> const> _geometry;
};

Expand Down
48 changes: 24 additions & 24 deletions cpp/source/deal.II/post_processor.templates.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, the Cap authors.
/* Copyright (c) 2016 - 2017, the Cap authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
Expand Down Expand Up @@ -82,9 +82,9 @@ SuperCapacitorPostprocessor<dim>::SuperCapacitorPostprocessor(
std::shared_ptr<Geometry<dim> const> geometry,
boost::mpi::communicator mpi_communicator)
: Postprocessor<dim>(parameters, mpi_communicator),
debug_material_ids(false), debug_boundary_ids(false),
debug_material_properties(), debug_solution_fields(),
debug_solution_fluxes(), _geometry(geometry)
_debug_material_ids(false), _debug_boundary_ids(false),
_debug_material_properties(), _debug_solution_fields(),
_debug_solution_fluxes(), _geometry(geometry)
{
dealii::DoFHandler<dim> const &dof_handler = *(this->dof_handler);
this->values["voltage"] = 0.0;
Expand All @@ -102,34 +102,34 @@ SuperCapacitorPostprocessor<dim>::SuperCapacitorPostprocessor(
std::shared_ptr<boost::property_tree::ptree const> database =
parameters->database;

this->debug_material_properties = cap::to_vector<std::string>(
this->_debug_material_properties = cap::to_vector<std::string>(
database->get("debug.material_properties", ""));
this->debug_solution_fields =
this->_debug_solution_fields =
cap::to_vector<std::string>(database->get("debug.solution_fields", ""));
this->debug_solution_fluxes =
this->_debug_solution_fluxes =
cap::to_vector<std::string>(database->get("debug.solution_fluxes", ""));
this->debug_boundary_ids = database->get("debug.boundary_ids", false);
this->debug_material_ids = database->get("debug.material_ids", false);
this->_debug_boundary_ids = database->get("debug.boundary_ids", false);
this->_debug_material_ids = database->get("debug.material_ids", false);

// n_active_cells is the total number of locally owned cells. This includes
// the ghost cells and the artificial cells. They are filtered out by DataOut.
unsigned int const n_active_cells =
dof_handler.get_triangulation().n_active_cells();
if (this->debug_material_ids)
if (this->_debug_material_ids)
this->vectors["material_id"] = dealii::Vector<double>(n_active_cells);
if (this->debug_boundary_ids)
if (this->_debug_boundary_ids)
throw dealii::StandardExceptions::ExcMessage("not implemented yet");
for (std::vector<std::string>::const_iterator it =
this->debug_material_properties.begin();
it != this->debug_material_properties.end(); ++it)
this->_debug_material_properties.begin();
it != this->_debug_material_properties.end(); ++it)
this->vectors[*it] = dealii::Vector<double>(n_active_cells);
for (std::vector<std::string>::const_iterator it =
this->debug_solution_fields.begin();
it != this->debug_solution_fields.end(); ++it)
this->_debug_solution_fields.begin();
it != this->_debug_solution_fields.end(); ++it)
this->vectors[*it] = dealii::Vector<double>(n_active_cells);
for (std::vector<std::string>::const_iterator it =
this->debug_solution_fluxes.begin();
it != this->debug_solution_fluxes.end(); ++it)
this->_debug_solution_fluxes.begin();
it != this->_debug_solution_fluxes.end(); ++it)
for (int d = 0; d < dim; ++d)
this->vectors[(*it) + "_" + std::to_string(d)] =
dealii::Vector<double>(n_active_cells);
Expand Down Expand Up @@ -289,12 +289,12 @@ void SuperCapacitorPostprocessor<dim>::reset(
// do nothing
}
} // end for quadrature point
if (this->debug_material_ids)
if (this->_debug_material_ids)
this->vectors["material_id"][cell->active_cell_index()] =
static_cast<double>(cell->material_id());
for (std::vector<std::string>::const_iterator it =
this->debug_material_properties.begin();
it != this->debug_material_properties.end(); ++it)
this->_debug_material_properties.begin();
it != this->_debug_material_properties.end(); ++it)
{
std::vector<double> values(n_q_points);
this->mp_values->get_values(*it, fe_values, values);
Expand All @@ -307,8 +307,8 @@ void SuperCapacitorPostprocessor<dim>::reset(
this->vectors[*it][cell->active_cell_index()] = cell_averaged_value;
}
for (std::vector<std::string>::const_iterator it =
this->debug_solution_fields.begin();
it != this->debug_solution_fields.end(); ++it)
this->_debug_solution_fields.begin();
it != this->_debug_solution_fields.end(); ++it)
{
std::vector<double> values(n_q_points);
if (it->compare("solid_potential") == 0)
Expand Down Expand Up @@ -351,8 +351,8 @@ void SuperCapacitorPostprocessor<dim>::reset(
this->vectors[*it][cell->active_cell_index()] = cell_averaged_value;
}
for (std::vector<std::string>::const_iterator it =
this->debug_solution_fluxes.begin();
it != this->debug_solution_fluxes.end(); ++it)
this->_debug_solution_fluxes.begin();
it != this->_debug_solution_fluxes.end(); ++it)
{
std::vector<dealii::Tensor<1, dim>> values(n_q_points);
if (it->compare("solid_current_density") == 0)
Expand Down
28 changes: 14 additions & 14 deletions cpp/source/deal.II/supercapacitor.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, the Cap authors.
/* Copyright (c) 2016 - 2017, the Cap authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
Expand Down Expand Up @@ -28,7 +28,7 @@ class SuperCapacitorInspector : public EnergyStorageDeviceInspector
SuperCapacitorInspector() = default;

/**
* Output the mesh with the suddomain IDs associated to each cells. It can
* Output the mesh with the subdomain IDs associated to each cells. It can
* also be used to output some quantities of interest.
*/
void inspect(EnergyStorageDevice *device) override;
Expand Down Expand Up @@ -146,40 +146,40 @@ class SuperCapacitor : public EnergyStorageDevice
* Maximum number of iterations of the Krylov solver in
* evolve_one_time_step().
*/
unsigned int max_iter;
unsigned int _max_iter;
/**
* Verbosity level of the Krylov solver in evolve_one_time_step().
*/
unsigned int verbose_lvl;
unsigned int _verbose_lvl;
/**
* Absolute tolerance of the Krylov solver in evolve_one_time_step(). The
* tolerance used by the Krylov solver is the maximum of the relative and the
* absolute tolerance.
*/
double abs_tolerance;
double _abs_tolerance;
/**
* Relative tolerance of the Krylov solver in evolve_one_time_step(), i.e. the
* tolerance is @p rel_toleracne \f$ \times ||b||_{2}\f$. The tolerance used
* tolerance is @p rel_tolerance \f$ \times ||b||_{2}\f$. The tolerance used
* by the Krylov solver is the maximum of the relative and the absolute
* tolerance.
*/
double rel_tolerance;
double _rel_tolerance;
/**
* Area of the cathode.
*/
double surface_area;
double _surface_area;

std::shared_ptr<Geometry<dim>> _geometry;
std::shared_ptr<dealii::FESystem<dim>> _fe;
std::shared_ptr<dealii::DoFHandler<dim>> dof_handler;
std::shared_ptr<dealii::Trilinos::MPI::BlockVector> solution;
std::shared_ptr<dealii::DoFHandler<dim>> _dof_handler;
std::shared_ptr<dealii::Trilinos::MPI::BlockVector> _solution;

std::shared_ptr<ElectrochemicalPhysicsParameters<dim>>
electrochemical_physics_params;
std::shared_ptr<ElectrochemicalPhysics<dim>> electrochemical_physics;
_electrochemical_physics_params;
std::shared_ptr<ElectrochemicalPhysics<dim>> _electrochemical_physics;
std::shared_ptr<SuperCapacitorPostprocessorParameters<dim>>
post_processor_params;
std::shared_ptr<SuperCapacitorPostprocessor<dim>> post_processor;
_post_processor_params;
std::shared_ptr<SuperCapacitorPostprocessor<dim>> _post_processor;
boost::property_tree::ptree const _ptree;
Timer _setup_timer;
Timer _solver_timer;
Expand Down

0 comments on commit 926f5b3

Please sign in to comment.