Thanks for your response.
I tried to assert assemble function as you suggested, but I didn't receive
any error message.
What make me more confuse me is the code is working with global refinement.
if I input 100% cells to be refined..
GridRefinement::refine_and_coarsen_fixed_number (triangulation,
estimated_error_per_cell,
*1.0, 0.0);*
if I input 90 cells to be refined, it goes at least one cycle,
but same or less than 80 cell, I keep receiving error message that...
Might AMR be related to my program?
*An error occurred in line <1668> of file
</Users/kimjaekwang/dealii-8.4.1/include/deal.II/lac/constraint_matrix.templates.h>
in function*
* void dealii::internals::dealiiSparseMatrix::add_value(const LocalType,
const size_type, const size_type, SparseMatrixIterator &)
[SparseMatrixIterator = dealii::SparseMatrixIterators::Iterator<double,
false>, LocalType = double]*
*The violated condition was: *
* matrix_values->column() == column*
*The name and call sequence of the exception was:*
* typename SparseMatrix<typename
SparseMatrixIterator::MatrixType::value_type>::ExcInvalidIndex(row, column)*
*Additional Information: *
*You are trying to access the matrix entry with index <1,305>, but this
entry does not exist in the sparsity pattern of this matrix.*
*The most common cause for this problem is that you used a method to build
the sparsity pattern that did not (completely) take into account all of the
entries you will later try to write into. An example would be building a
sparsity pattern that does not include the entries you will write into due
to constraints on degrees of freedom such as hanging nodes or periodic
boundary conditions. In such cases, building the sparsity pattern will
succeed, but you will get errors such as the current one at one point or
other when trying to write into the entries of the matrix.*
template <int dim>
void nonlinear<dim>::refine_grid ()
{
Vector<float> estimated_error_per_cell (triangulation.n_active_cells());
KellyErrorEstimator<dim>::estimate (dof_handler,
QGauss<dim-1>(3),
typename FunctionMap<dim>::type(),
solution,
estimated_error_per_cell);
GridRefinement::refine_and_coarsen_fixed_number (triangulation,
estimated_error_per_cell,
1.0, 0.0);
/* You need to tranfer solution (n-1 step) domain into previous
solution (n step)*/
triangulation.prepare_coarsening_and_refinement ();
SolutionTransfer<dim> solution_transfer(dof_handler);
solution_transfer.prepare_for_coarsening_and_refinement(solution);
triangulation.execute_coarsening_and_refinement(); // I think n_dof()
has increased here. You need to check this if necessary
dof_handler.distribute_dofs(fe);
// Vector<double> tmp(dof_handler.n_dofs()); //tmp - n step dof
previous_solution.reinit (dof_handler.n_dofs());
solution_transfer.interpolate(solution, previous_solution); //
interpolate (input, output)
DynamicSparsityPattern dsp(dof_handler.n_dofs());
DoFTools::make_sparsity_pattern (dof_handler, dsp);
sparsity_pattern.copy_from(dsp);
solution.reinit (dof_handler.n_dofs());
system_matrix.reinit (sparsity_pattern);
system_rhs.reinit (dof_handler.n_dofs());
constraints.clear ();
DoFTools::make_hanging_node_constraints (dof_handler,
constraints);
VectorTools::interpolate_boundary_values (dof_handler,1,
BoundaryValues<dim>(),
constraints);
constraints.close ();
}
--
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 the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.