Use a coarse grid solution as initial condition for a finer grid

86 views
Skip to first unread message

vachanpo...@gmail.com

unread,
Jul 5, 2021, 6:45:04 AM7/5/21
to deal.II User Group
Dear all,

I want to save a coarse grid solution, load it and set it as the initial condition for a finer grid simulation.

The code I have written is for non-adaptive meshes, the refinement is not happening within the simulation. I wish to start the fine grid simulation using a standalone fine mesh file.

I have seen the answer here that uses solution transfer to restart a simulation. I am thinking of doing something similar by first re-constructing solution vectors from the saved file and then using them along with dof locations (of the fine mesh) to set the initial condition for a fine mesh.

Is there any better way to accomplish what I desire? Also, will this approach work well for curved manifolds, or do I have to take additional steps to somehow reload the manifold data separately? Any help would be gladly appreciated.

Thanking in anticipation
Vachan

Wolfgang Bangerth

unread,
Jul 5, 2021, 11:14:26 PM7/5/21
to dea...@googlegroups.com
On 7/5/21 4:45 AM, vachanpo...@gmail.com wrote:
>
> I have seen the answer here
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fg%2Fdealii%2Fc%2F9Zp57pcB8zU%2Fm%2F3tq_aKVG8FEJ&data=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7C4173e42bdc8248068aff08d93fa1f449%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637610788480398084%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=3x8aw6xDUOYTChyjq4C9Lmu8mzeNLm%2BJrJIkvLB8Dd8%3D&reserved=0> that
> uses solution transfer to restart a simulation. I am thinking of doing
> something similar by first re-constructing solution vectors from the saved
> file and then using them along with dof locations (of the fine mesh) to set
> the initial condition for a fine mesh.

So is your fine mesh a refinement of the coarse one? If not, you may want to
look at FEFieldFunction.


> Is there any better way to accomplish what I desire? Also, will this approach
> work well for curved manifolds, or do I have to take additional steps to
> somehow reload the manifold data separately? Any help would be gladly appreciated.

You would have to attach manifolds to the triangulation object that is being
reconstructed, before reconstruction.

Best
W.



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

vachan potluri

unread,
Jul 6, 2021, 1:04:44 AM7/6/21
to dea...@googlegroups.com
Dr. Wolfgang,

Thank you for the reply.

So is your fine mesh a refinement of the coarse one? If not, you may want to
look at FEFieldFunction.
Yes, it is. But the "refinement" is done by the meshing software, outside dealii. Is there any simplification possible in such a case?

Otherwise, I think FEFieldFunction would be a safe choice. Since I want to use it with p::d::Triangulation, will setting all dofs as relevant do the job? This way the partitioning can also be different.

You would have to attach manifolds to the triangulation object that is being
reconstructed, before reconstruction.
Ok, noted.

Thank you.

Wolfgang Bangerth

unread,
Aug 2, 2021, 7:17:22 PM8/2/21
to dea...@googlegroups.com
On 7/5/21 11:04 PM, vachan potluri wrote:
>
> So is your fine mesh a refinement of the coarse one? If not, you may want to
> look at FEFieldFunction.
>
> Yes, it is. But the "refinement" is done by the meshing software, outside
> dealii. Is there any simplification possible in such a case?

Not really. If deal.II has no knowledge about the relationship between cells
on the two meshes, then it is in essence the interpolation from one
unstructured grid to another unstructured grid.


> Otherwise, I think FEFieldFunction would be a safe choice. Since I want to use
> it with p::d::Triangulation, will setting all dofs as relevant do the job?
> This way the partitioning can also be different.

This becomes a very difficult data transfer problem because you want to
evaluate the solution at a point that the current process may know nothing
about. In essence, you will have to ask all of the other processes about who
owns a part of the mesh on which a given interpolation point is located, and
then that process has to send you the value of the function at that point. You
have to do that for all points. This is going to be an expensive operation.

You might want to check out the Utilities::MPI::RemotePointEvaluation class in
the latest (9.3) release for help with this.

vachan potluri

unread,
Aug 3, 2021, 3:03:02 AM8/3/21
to dea...@googlegroups.com
Dr. Wolfgang,

Thank you for still taking interest in this thread :)

This becomes a very difficult data transfer problem because you want to
evaluate the solution at a point that the current process may know nothing
about. In essence, you will have to ask all of the other processes about who
owns a part of the mesh on which a given interpolation point is located, and
then that process has to send you the value of the function at that point. You
have to do that for all points. This is going to be an expensive operation.
You might want to check out the Utilities::MPI::RemotePointEvaluation class in
the latest (9.3) release for help with this.
I understand that the approach I had mentioned is inefficient. I only need to do this once, to start a simulation, so I thought it might be okay.

I had a look at Utilities::MPI::RemotePointEvaluation. This is how I think it can be used (correct me if wrong)
  1. Call reinit() with the dof locations, along with the corresponding triangulation and mapping, where I want to evaluate FEFieldFunction (I suppose the triangulation and mapping here are not of the FEFieldFunction?).
  2. Call evaluate_and_process() by passing in the FEFieldFunction.
I have a few questions.
  1. What is the "buffer" argument in evaluate_and_process()?
  2. The documentation for this function says get_point_ptrs() must be used to "process" the output in case the point-cell map is not one-one. I will surely encounter such cases. How can I use the data returned by get_point_ptrs() and how exactly should I "process" the output?
I couldn't find this used in any examples. Any clarifications would be greatly helpful.

--
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/61601d83-856e-dd27-dc78-3653bd45ec2f%40colostate.edu.

peterrum

unread,
Aug 3, 2021, 4:39:54 AM8/3/21
to deal.II User Group
Hi Vachan,

I don't think you need to use RPE plane. My guess is that you can use VectorTools::point_values(), which internally uses PRE (see https://github.com/dealii/dealii/blob/e413cbf8ac77606cf4a04e1e2fa75232c08533b4/include/deal.II/numerics/vector_tools_evaluate.h#L230-L343). Here you could collect the support points from the new DoFHandler, let VT::point_values() do the work and finally set the values at the support points.

Further resources are:
- the usage of RPE and VT::point_values() in DataOutResample (https://github.com/dealii/dealii/blob/master/source/numerics/data_out_resample.cc

PM

vachan potluri

unread,
Aug 3, 2021, 10:39:06 AM8/3/21
to dea...@googlegroups.com
Peter,

Thanks very much for taking time and providing the resources. I will go through them and get back if I have any more questions.

I also have a simple related question. Can I skip all these steps if the triangulation, FE and number of processors of the solution being transferred are kept constant? This is one special case which is like restarting a completed simulation. In this case (triangulation, FE, and processors kept constant), is the partition and dof numbering always going out to be the same? I am not doing any mesh refinement (either in dealii or outside).

If yes, then I suppose loading the solution transfer and deserializing it will do the job without having to worry about "evaluating" the solution?

Wolfgang Bangerth

unread,
Aug 3, 2021, 11:48:45 AM8/3/21
to dea...@googlegroups.com
On 8/3/21 8:38 AM, vachan potluri wrote:
>
> I also have a simple related question. Can I skip all these steps if the
> triangulation, FE and number of processors of the solution being transferred
> are kept constant? This is one special case which is like restarting a
> completed simulation. In this case (triangulation, FE, and processors kept
> constant), is the partition and dof numbering always going out to be the same?
> I am not doing any mesh refinement (either in dealii or outside).
>
> If yes, then I suppose loading the solution transfer and deserializing it will
> do the job without having to worry about "evaluating" the solution?

Yes, you can reload solutions onto the same Triangulation and DoFHandler. In
fact, the reload machinery even works if the number of processes is different.

vachanpo...@gmail.com

unread,
Aug 4, 2021, 3:56:26 AM8/4/21
to deal.II User Group
That brings a big simplification, at least when the aim is to just restart a simulation and not to map the solution onto some other grid.

Thanks for all the help!
Reply all
Reply to author
Forward
0 new messages