From cc7cf49a55ea32b7cfb96bc56986a349c356a946 Mon Sep 17 00:00:00 2001 From: "Vasco C. B. Ferreira" Date: Wed, 8 Jul 2026 11:11:35 +0200 Subject: [PATCH] update on poisson :: refine --- nufi/poisson_problem.h | 28 ++++++++++++++++++++-------- src/nufi_solver.cc | 1 - 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/nufi/poisson_problem.h b/nufi/poisson_problem.h index 54755e7..475cd62 100644 --- a/nufi/poisson_problem.h +++ b/nufi/poisson_problem.h @@ -369,8 +369,14 @@ template void PoissonProblem::assemble_system() { } } -template void PoissonProblem::coarse_and_refine_grid() { +template +void PoissonProblem::coarse_and_refine_grid( + std::vector> &solution_history) { // Add refinement and coasring algorithm here + + //======//======// + // CHECK step-15. + //======//======// Vector error_per_cell(triangulation.n_active_cells()); KellyErrorEstimator::estimate( @@ -384,15 +390,21 @@ template void PoissonProblem::coarse_and_refine_grid() { triangulation.prepare_coarsening_and_refinement(); - // solution tranafer + // old solutions transfer + const size_t N_sols = solution_history.size(); - // setup_system + SolutionTransfer> transfer(dof_handler); + transfer.prepare_for_coarsening_and_refinement(solution_history); - // solution_transfer interpolate - // non_zero_constraint.distribute(current solution) - // - //======//======// - // CHECK step-15. + triangulation.execute_coarsening_and_refinement(); + + setup_system(); + + transfer.interpolate(solution_history); + + solution = solution_history.back(); + + constraints.distribute(solution); // rebuild cells with the grid cell_locator.rebuild(dof_handler, triangulation); diff --git a/src/nufi_solver.cc b/src/nufi_solver.cc index d5aa1dc..75637eb 100644 --- a/src/nufi_solver.cc +++ b/src/nufi_solver.cc @@ -205,7 +205,6 @@ void NuFISolver::run() { }); poisson.solve_step(); - phi_history.push_back(poisson.get_solution()); // std::vector sampled_potential =