Would it suit the deal.II concept to replace the constraint matrix by a map periodic_neighbor between opposite cellsin order to use fluxes rather than constraints?
In building the sparsity pattern and assembling the system, I could just add periodic_neigbor.at(cell) along the periodic boundary, according to the usual cell.get_neighbor() calls.
// collect periodic faces and extend halo layer of ghost cells across periodic boundaries
// take care: collect_periodic_faces must not be called for a refined grid
if (m_triangulation->n_levels() > 1) {
throw PeriodicBoundaryNotPossible(
"The periodic boundaries have to be set before the refinement.");
}
std::vector<
dealii::GridTools::PeriodicFacePair<
typename Mesh<dim>::cell_iterator> > matched_pairs;
dealii::GridTools::collect_periodic_faces(*m_triangulation,
m_boundaryIndicator1, m_boundaryIndicator2, m_direction,
matched_pairs);
// add halo layer
m_triangulation->add_periodicity(matched_pairs);
PeriodicCellMap<dim> m_cells;
DealIIExtensions::make_periodicity_map_dg(doFHandler, m_boundaryIndicator1, m_boundaryIndicator2, m_direction, m_cells);// loop over all cells
...
// loop over all faces
for (size_t j = 0; j < dealii::GeometryInfo<dim>::faces_per_cell; j++) {
//Faces at boundary
if (cell->face(j)->at_boundary()) {
size_t boundaryIndicator = cell->face(j)->boundary_id();
if (m_boundaries->isPeriodic(boundaryIndicator)) {
// Apply periodic boundaries
const boost::shared_ptr<PeriodicBoundary<dim> >& periodicBoundary =
m_boundaries->getPeriodicBoundary(boundaryIndicator);
assert(periodicBoundary->isFaceInBoundary(cell, j));
typename dealii::DoFHandler<dim>::cell_iterator neighborCell;
size_t opposite_face =
periodicBoundary->getOppositeCellAtPeriodicBoundary(
cell, neighborCell); // this function extracts the neighbor cell from the PeriodicCellMap
// now assemble And Distribute Internal Face with the periodic neighbor cell
PeriodicCellMap, make_periodicity_map_dg and make_sparser_flux_sparsity pattern are defined in the attached file to give you a rough idea (this version works better than the one posted before).
The code is part of a
bigger framework, so you will have to change it quite a bit before using
it. However, the most important function, make_periodicity_map_dg,
should also work for your code.
If you have further questions, I'm happy to help.
Best,
Andreas
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/zdiXh-NRcYk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
PeriodicBoundary's functionality into simple arrays of boundary_ids and directions - https://github.com/l-korous/mhdeal/blob/master/DealiiExtensions.h#L54