Dear all,
I recently experienced an error when I added an upper limit for the number of cells (i.e. defining max_n_cells) using the function refine_and_coarsen_fixed_fraction.
The message that I get is the following:
Mesh refinement ...
--------------------------------------------------------
An error occurred in line <292> of file </home/claire/Logiciels/dealii/tmp/unpack/deal.II-master/source/grid/grid_refinement.cc> in function
void dealii::GridRefinement::refine_and_coarsen_fixed_number(dealii::Triangulation<dim, spacedim>&, const VectorType&, double, double, unsigned int) [with int dim = 3; VectorType = dealii::Vector<float>; int spacedim = 3]
The violated condition was:
top_fraction+bottom_fraction <= 1
Additional information:
(none)
Stacktrace:
-----------
#0 /home/claire/Logiciels/dealii/deal.II-master/lib/libdeal_II.g.so.9.0.0-pre: void dealii::GridRefinement::refine_and_coarsen_fixed_number<3, dealii::Vector<float>, 3>(dealii::Triangulation<3, 3>&, dealii::Vector<float> const&, double, double, unsigned int)
#1 /home/claire/Logiciels/dealii/deal.II-master/lib/libdeal_II.g.so.9.0.0-pre: void dealii::GridRefinement::refine_and_coarsen_fixed_fraction<3, dealii::Vector<float>, 3>(dealii::Triangulation<3, 3>&, dealii::Vector<float> const&, double, double, unsigned int)
#2 ./ThermoMech: Manager<3>::refine_mesh(std::vector<dealii::Vector<double>, std::allocator<dealii::Vector<double> > >&, unsigned int, unsigned int)
#3 ./ThermoMech: ThermoMechSolver<3>::run()
#4 ./ThermoMech: main
--------------------------------------------------------
Abandon (core dumped)
Looking at the source code, it seems that the problem comes from the call to the function refine_and_coarsen_fixed_number using the top_fraction and bottom_fraction defined in the function refine_and_coarsen_fixed_fraction
const unsigned int refine_cells = pp - tmp.begin(),
coarsen_cells = tmp.end() - qq;
if (static_cast<unsigned int>
(tria.n_active_cells()
+ refine_cells * (GeometryInfo<dim>::max_children_per_cell - 1)
- (coarsen_cells *
(GeometryInfo<dim>::max_children_per_cell - 1) /
GeometryInfo<dim>::max_children_per_cell))
>
max_n_cells)
{
refine_and_coarsen_fixed_number (tria,
criteria,
1.*refine_cells/criteria.size(),
1.*coarsen_cells/criteria.size(),
max_n_cells);
return;
}
I am sorry that could not figure out the origin of the error...
I currently use 0.6 as top fraction and 0.4 as bottom fraction
Are those fractions wrong and responsible for the triggered exception, or is there any other possible explanation?
If you need any more information, please don't hesitate to ask.
Thanks a lot in advance for all the help or suggestions that I may get.
Best,
Claire