[deal.II] How to refine mesh in different field

48 views
Skip to first unread message

陈敏

unread,
Apr 3, 2021, 10:48:48 AM4/3/21
to dea...@googlegroups.com
Dear deal.II community,

In a fluid-structure interaction simulation, Computational domain was divided into fluid domain and solid domain, for example, cell->material_id() == 0 and cell->material_id() == 1(the way that deal.ii presents which field the cell belong to) respectively, Now I want to refine the mesh in fluid field and that in solid field separately in a fixed time interval.

The tutorial guides, for example, tutorial step-40, show follow example code:

template <int dim>
void LaplaceProblem<dim>::refine_grid()
{
TimerOutput::Scope t(computing_timer, "refine");
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
dof_handler,
QGauss<dim - 1>(fe.degree + 1),
std::map<types::boundary_id, const Function<dim> *>(),
locally_relevant_solution,
estimated_error_per_cell);
triangulation, estimated_error_per_cell, 0.3, 0.03);
}

I think the code refines on the whole mesh domain, for my purpose, how to change the code to meet me?
Could anyone help me out?

Sincerely,
Chen

Michał Wichrowski

unread,
Apr 3, 2021, 3:44:11 PM4/3/21
to deal.II User Group
Jest overwrite error estimate in one domain by zeros:

unsigned int cell_n = 0;
for (const auto & cell : triangulation.active_cell_iterators ){
    if (cell-> material_id() == 0 )
        estimated_error_per_cell(i) = 0;
    ++i;
}

Marc Fehling

unread,
Apr 3, 2021, 11:54:35 PM4/3/21
to deal.II User Group
Hi Chen,

step-46 gives you a good example on how to perform grid refinement when coupling different kinds of equations in different parts of the domain. I would highly suggest reading this tutorial first.

Do you only consider refinement or also coarsening? In case of coarsening, overwriting your error estimates with zeros (at the interface or anywhere else) is not a good solution as this would ultimately mean that these cells will be coarsened. It might make sense to set the values there to a different value here.

Best,
Marc

陈敏

unread,
Apr 4, 2021, 10:17:02 AM4/4/21
to dea...@googlegroups.com
Dear Marc, 

Thanks for your reply, I consider refinement and coarsening too.
I would read the step-46, I think it real helpful.

Best,
Chen

Marc Fehling <mafe...@gmail.com> 于2021年4月4日周日 上午11:54写道:
--
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 dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/57a02e63-29da-40f6-ac93-8475e3d03725n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages