Skip to content

Parrallel Unstructured Mesh Deformation Interface class - #7083

Merged
MFraters merged 2 commits into
geodynamics:mainfrom
danieldouglas92:add_external_tool_interface
Jul 29, 2026
Merged

Parrallel Unstructured Mesh Deformation Interface class#7083
MFraters merged 2 commits into
geodynamics:mainfrom
danieldouglas92:add_external_tool_interface

Conversation

@danieldouglas92

Copy link
Copy Markdown
Contributor

@tjhei @bangerth if there is a proper way to give you credit for this please let me know. This is adding the external_tool_interface mesh deformation plugin that you guys wrote for the ASPECT-Landlab project with the tests that do not require python/landlab.

@bangerth

Copy link
Copy Markdown
Contributor

You'll have to run the indentation script:

diff --git a/include/aspect/mesh_deformation/external_tool_interface.h b/include/aspect/mesh_deformation/external_tool_interface.h
index 7bc9fb9..120b648 100644
--- a/include/aspect/mesh_deformation/external_tool_interface.h
+++ b/include/aspect/mesh_deformation/external_tool_interface.h
@@ -239,4 +239,4 @@ namespace aspect
   }
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/source/mesh_deformation/external_tool_interface.cc b/source/mesh_deformation/external_tool_interface.cc
index 6f4d2ee..444321f 100644
--- a/source/mesh_deformation/external_tool_interface.cc
+++ b/source/mesh_deformation/external_tool_interface.cc
@@ -344,4 +344,4 @@ namespace aspect
 
 #undef INSTANTIATE
   }
-}
\ No newline at end of file
+}

@bangerth bangerth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what the proper protocol is -- @tjhei and I designed and implemented these classes. We probably shouldn't review this patch :-)

We could say that you (@danieldouglas92) should just review your own pull request ;-) Alternatively, perhaps @MFraters or @Minerallo or @Djneu would be willing to take a look?

@danieldouglas92

Copy link
Copy Markdown
Contributor Author

@bangerth I'll quickly go through and at least clean up the documentation and then ping the others once this is ready for a proper review

@danieldouglas92
danieldouglas92 force-pushed the add_external_tool_interface branch 3 times, most recently from 4c25fd4 to 245c029 Compare July 23, 2026 13:30
@MFraters MFraters self-assigned this Jul 25, 2026

@MFraters MFraters left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good. The current openLEM integration works through a moving grid. I see no reason why not, but can you confirm that it is possible (and efficient) to update the evaluation points in between getting the velocities from aspect and interpolating the velocites back to aspect? Can you add a test which does that?

@tjhei

tjhei commented Jul 25, 2026

Copy link
Copy Markdown
Member

can we call it ParallelUnstructuredInterface?

@MFraters

Copy link
Copy Markdown
Member

can we call it ParallelUnstructuredInterface?

Yes, I think that that is probably a more descriptive name.

@tjhei

tjhei commented Jul 25, 2026

Copy link
Copy Markdown
Member

I see no reason why not, but can you confirm that it is possible (and efficient) to update the evaluation points in between getting the velocities from aspect and interpolating the velocites back to aspect?

it involves MPI communication but I expect this to be scalable (we use this in a different deal.II code on 100k MPI ranks).

Can you add a test which does that?

We probably should do that. We can triggers this with a simple example where we have mesh adaptivity for example.

@danieldouglas92
danieldouglas92 force-pushed the add_external_tool_interface branch from 45a39e4 to 0228853 Compare July 25, 2026 13:04
@danieldouglas92

Copy link
Copy Markdown
Contributor Author

@MFraters I added a test which shows that the update() function resets the evaluation_points()!

Comment thread source/mesh_deformation/parallel_unstructured_interface.cc
Comment thread source/mesh_deformation/parallel_unstructured_interface.cc Outdated

if (my_rank == 0)
{
// Combine data coming from all ranks and determine closest evaluation point for each DoF:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this part, this already combines all ranks so later on we don't need to gather everything down to rank 0 in the individual landscape evolution model interfaces?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more documentation about this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece of code is only an implementation detail (and might be replaced in the future) to deterministically make a decision "which points is closest". It forgets about any information exchanged at the end of this function.

@danieldouglas92 can you add a comment like this?

* surface, rather than on the currently deformed top surface
* that describes the current elevation map.
*
* @note This function sets up communication structures that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will I need to think about resetting the evaluation points on mesh refinement for something like fastscape when its mesh will remain fixed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to rebuild the mapping of external evaluation points and degrees of freedom even if the fastscape mesh stays fixed. This already happens using a signal.

@Djneu Djneu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi all, I mostly just had some questions so I understand everything better, but I think it looks like it does everything that would be needed! If I understand, if fastscape.cc is eventually updated to use this the workflow would be something like:

  1. Set up what the fastscape mesh will be and return the values with set_evaluation_points.

  2. compute_velocity_constrains_on_boundary will then evaluate the solution values everywhere (and have them combined on rank 0), and in compute updated velocities I can use these values to find the velocity differences as well as set up all the compositional kd/kf values needed.

@danieldouglas92
danieldouglas92 force-pushed the add_external_tool_interface branch from 0228853 to d84490f Compare July 26, 2026 15:51
@danieldouglas92

Copy link
Copy Markdown
Contributor Author

@MFraters @Djneu I addressed your comments and this should hopefully pass all the testers now

@danieldouglas92
danieldouglas92 force-pushed the add_external_tool_interface branch 4 times, most recently from 0638271 to 7ceea4a Compare July 26, 2026 20:45
@Minerallo

Copy link
Copy Markdown
Contributor

So in the FastScape C++ coupling we used Utilities::MPI::isend() and irecv() with Wolfgang last year. The current interface from what I see use .compress(), this hide how the information is re-distributed. I wonder if we dont need to access this information for future applications ... ?

Comment thread source/mesh_deformation/parallel_unstructured_interface.cc
@danieldouglas92
danieldouglas92 force-pushed the add_external_tool_interface branch from 7ceea4a to d7199d9 Compare July 28, 2026 11:20
@danieldouglas92

Copy link
Copy Markdown
Contributor Author

@Minerallo A new comment has been added about the .compress function

@danieldouglas92
danieldouglas92 force-pushed the add_external_tool_interface branch 2 times, most recently from d6b8452 to e13205c Compare July 28, 2026 12:17
@tjhei
tjhei self-requested a review July 28, 2026 14:26

@tjhei tjhei left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have a few minor comments.

Comment thread source/mesh_deformation/parallel_unstructured_interface.cc Outdated

if (my_rank == 0)
{
// Combine data coming from all ranks and determine closest evaluation point for each DoF:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece of code is only an implementation detail (and might be replaced in the future) to deterministically make a decision "which points is closest". It forgets about any information exchanged at the end of this function.

@danieldouglas92 can you add a comment like this?

@tjhei tjhei changed the title Add External Tool Interface Parrallel Unstructured Mesh Deformation Interface class Jul 28, 2026
@danieldouglas92
danieldouglas92 force-pushed the add_external_tool_interface branch 2 times, most recently from 1b00a6b to 33c1573 Compare July 28, 2026 20:16

@MFraters MFraters left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify what happens to the output vector when points are outside of the domain (as discussed)? Maybe initialize the vector with NaN.

Otherwise looks good to me.


if (!remote_point_evaluator->all_points_found())
{
this->get_pcout() << "WARNING: not all evaluation points were found inside the domain!" << std::endl;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make a this a debug only output?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

danieldouglas92 and others added 2 commits July 29, 2026 06:58
Co-authored-by: Timo Heister <heister@clemson.edu>
Co-authored-by: Wolfgang Bangerth <bangerth@colostate.edu>
@danieldouglas92
danieldouglas92 force-pushed the add_external_tool_interface branch from 33c1573 to abc0d64 Compare July 29, 2026 10:58
@danieldouglas92

Copy link
Copy Markdown
Contributor Author

@MFraters I addressed your comments!

@MFraters MFraters left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments. Looks good to me now.

@MFraters
MFraters merged commit a3b493f into geodynamics:main Jul 29, 2026
9 checks passed
@bangerth

Copy link
Copy Markdown
Contributor

Hi all, I mostly just had some questions so I understand everything better, but I think it looks like it does everything that would be needed! If I understand, if fastscape.cc is eventually updated to use this the workflow would be something like:

  1. Set up what the fastscape mesh will be and return the values with set_evaluation_points.
  2. compute_velocity_constrains_on_boundary will then evaluate the solution values everywhere (and have them combined on rank 0), and in compute updated velocities I can use these values to find the velocity differences as well as set up all the compositional kd/kf values needed.

Yes, this is exactly how we think it would look like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants