project/ interpolate solution from adaptive mesh to uniform mesh

51 views
Skip to first unread message

Giang Huynh

unread,
Apr 14, 2022, 8:07:01 PM4/14/22
to deal.II User Group
Hi all,

Are there anyway to project or interpolate solution data from adaptive mesh back to uniform mesh?
Thank you in advance,

Giang

SebG

unread,
Apr 15, 2022, 7:37:41 AM4/15/22
to deal.II User Group
Dear Giang,

I think that the SolutionTransfer class could be used for this purpose if the Triangulation is coarsened. Moreover, the VectorTools namespace contains a variant of VectorToosl::interpolate using two DoFHandler objects and there is also VectorTools::interpolate_to_different_mesh.

Best wishes,
Sebastian

Giang Huynh

unread,
Apr 15, 2022, 9:58:09 AM4/15/22
to deal.II User Group
Hi Sebastian,

I tried to use interpolate_to_different_mesh(), but it causes an error below. How can I overcome this?

Thanks,
Giang
---------------------------------------
error: no matching function for call to ‘interpolate_to_different_mesh(const dealii::DoFHandler<2>&, const dealii::Vector<double>&, const dealii::DoFHandler<2>&, const dealii::Vector<double>&)’
   VectorTools::interpolate_to_different_mesh(dof_handler, solution, reg_dof_handler,reg_sol);

deal.II-v9.2.0/include/deal.II/numerics/vector_tools_interpolate.h:252:3: note:   template argument deduction/substitution failed:
/deal.II-v9.2.0/examples/step-3/step-3.cc:591:93: note:   ‘const dealii::DoFHandler<2>’ is not derived from ‘const dealii::InterGridMap<DoFHandlerType<dim, spacedim> >’
   VectorTools::interpolate_to_different_mesh(dof_handler, solution, reg_dof_handler,reg_sol);

----------------------------------------
DoFHandler<2> dof_handler, reg_dof_handler;
Vector<double> solution;
Vector<double> reg_sol;
VectorTools::interpolate_to_different_mesh(dof_handler, solution, reg_dof_handler,reg_sol);
----------------------------------------

Wolfgang Bangerth

unread,
Apr 15, 2022, 12:01:45 PM4/15/22
to dea...@googlegroups.com
On 4/15/22 07:58, Giang Huynh wrote:
> ---------------------------------------
> error: no matching function for call to ‘interpolate_to_different_mesh(const
> dealii::DoFHandler<2>&, const dealii::Vector<double>&, const
> dealii::DoFHandler<2>&, const dealii::Vector<double>&)’
>    VectorTools::interpolate_to_different_mesh(dof_handler, solution,
> reg_dof_handler,reg_sol);
>
> deal.II-v9.2.0/include/deal.II/numerics/vector_tools_interpolate.h:252:3:
> note:   template argument deduction/substitution failed:
> /deal.II-v9.2.0/examples/step-3/step-3.cc:591:93: note:   ‘const
> dealii::DoFHandler<2>’ is not derived from ‘const
> dealii::InterGridMap<DoFHandlerType<dim, spacedim> >’
>    VectorTools::interpolate_to_different_mesh(dof_handler, solution,
> reg_dof_handler,reg_sol);
>
> ----------------------------------------
> DoFHandler<2> dof_handler, reg_dof_handler;
> Vector<double> solution;
> Vector<double> reg_sol;
> VectorTools::interpolate_to_different_mesh(dof_handler, solution,
> reg_dof_handler,reg_sol);
> ----------------------------------------

Giang -- you need to take a look at the arguments in the function call. The
compiler actually tells you what arguments it wants to see and that you are
not providing: The last argument you pass is a 'const Vector', but the
function you are trying to call requires a non-const vector. You can also see
this from the documentation of the function you are trying to call.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Giang Huynh

unread,
Apr 15, 2022, 1:59:31 PM4/15/22
to dea...@googlegroups.com
Thank Wolfgang for the support. It worked now.

Giang 

--
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/7x1-GdBcCMs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/21ac71b9-25b6-10f9-208b-85f3c475ecab%40colostate.edu.
Reply all
Reply to author
Forward
0 new messages