Skip to content

Add Landlab Mesh Deformation Plugin - #7213

Open
danieldouglas92 wants to merge 3 commits into
geodynamics:mainfrom
danieldouglas92:ll_mesh_def
Open

Add Landlab Mesh Deformation Plugin#7213
danieldouglas92 wants to merge 3 commits into
geodynamics:mainfrom
danieldouglas92:ll_mesh_def

Conversation

@danieldouglas92

Copy link
Copy Markdown
Contributor

This PR adds a Landlab mesh deformation plugin. This enables ASPECT to interface with the landscape evolution library Landlab to deform the surface of the ASPECT model based on an arbitrary landscape evolution model run in a python script.

Comment thread source/mesh_deformation/landlab.cc Outdated
@danieldouglas92
danieldouglas92 force-pushed the ll_mesh_def branch 2 times, most recently from 0d75ee2 to 62560bd Compare August 4, 2026 15:01
Comment thread include/aspect/config.h.in Outdated
Comment thread tests/mesh_deformation_landlab_01.prm Outdated
Comment thread tests/mesh_deformation_landlab_01.py Outdated
Comment thread tests/mesh_deformation_landlab_01.py Outdated



mesh_deformation_landlab_01.py

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.

Interesting that the python output appears but only at the end. Any idea why?

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.

I think I fixed this, pushing the new tests in a sec

Comment thread source/mesh_deformation/landlab.cc Outdated
Comment thread source/mesh_deformation/landlab.cc Outdated
Comment thread source/mesh_deformation/landlab.cc Outdated
Comment thread source/mesh_deformation/landlab.cc Outdated
Comment thread source/mesh_deformation/landlab.cc Outdated
@danieldouglas92

Copy link
Copy Markdown
Contributor Author

@tjhei Thanks for taking a look at this! I addressed your comments on the code, I'll add a couple more tests later today for spherical and more than 1 ASPECT process

@tjhei

tjhei commented Aug 7, 2026

Copy link
Copy Markdown
Member

Awesome. Otherwise, I think this is good to go. I would prefer if someone else would take a look and merge though, as I wrote large parts of this.

Comment thread tests/mesh_deformation_landlab_01.prm Outdated
# Test "landlab" mesh deformation Landlab Python module in a
# 3d box
#
# Enable if: ASPECT_WITH_PYTHON

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.

Suggested change
# Enable if: ASPECT_WITH_PYTHON
# Enable if: ASPECT_WITH_LANDLAB

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.

I'm not sure if it's the right syntax, but I made it # Enable if: ASPECT_WITH_LANDLAB && ASPECT_WITH_PYTHON. They should both be true right?

@tjhei tjhei Aug 10, 2026

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.

Well, WITH_LANDLAB can only be true if we have python so it is enough to just do # Enable if: ASPECT_WITH_LANDLAB

and if you take a look at

aspect/tests/CMakeLists.txt

Lines 137 to 153 in bf1b061

file(STRINGS ${_filename} _input_lines
REGEX "Enable if: ASPECT_WITH_PYTHON")
if(NOT "${_input_lines}" STREQUAL "")
if (${_input_lines} MATCHES "Enable if: ASPECT_WITH_PYTHON"
AND NOT ASPECT_WITH_PYTHON)
set(_use_test OFF PARENT_SCOPE)
endif()
endif()
file(STRINGS ${_filename} _input_lines
REGEX "Enable if: ASPECT_WITH_LANDLAB")
if(NOT "${_input_lines}" STREQUAL "")
if (${_input_lines} MATCHES "Enable if: ASPECT_WITH_LANDLAB"
AND NOT ASPECT_WITH_LANDLAB)
set(_use_test OFF PARENT_SCOPE)
endif()
endif()
it would need to be:

# Enable if: ASPECT_WITH_PYTHON
# Enable if: ASPECT_WITH_LANDLAB

@danieldouglas92
danieldouglas92 force-pushed the ll_mesh_def branch 2 times, most recently from 355c7ee to 805329f Compare August 7, 2026 15:20
@danieldouglas92

Copy link
Copy Markdown
Contributor Author

@tjhei I modified the #if statements in the tests and also in landlab.cc. From what I gathered from #7209 this is the approach to ensure that the parameters are consistently documented regardless of whether ASPECT_WITH_PYTHON==True and ASPECT_WITH_LANDLAB=True?

@tjhei

tjhei commented Aug 10, 2026

Copy link
Copy Markdown
Member

Correct

The names of the boundaries listed here can either be numbers (in which case they correspond to the numerical boundary indicators assigned by the geometry object), or they can correspond to any of the symbolic names the geometry object may have provided for each part of the boundary. You may want to compare this with the documentation of the geometry model you use in your model.

The format is id1: object1 \& object2, id2: object3 \& object2, where objects are one of ‘ascii data’: Implementation of a model in which the initial mesh deformation (initial topography) is derived from a file containing data in ascii format. The following geometry models are currently supported: box, chunk, spherical. Note the required format of the input data: The first lines may contain any number of comments if they begin with ‘#’, but one of these lines needs to contain the number of grid points in each dimension as for example ‘# POINTS: 3 3’. The order of the data columns has to be ‘x’, ‘Topography [m]’ in a 2d model and ‘x’, ‘y’, ‘Topography [m]’ in a 3d model, which means that there has to be a single column containing the topography. Note that the data in the input file needs to be sorted in a specific order: the first coordinate needs to ascend first, followed by the second in order to assign the correct data to the prescribed coordinates. If you use a spherical model, then the assumed grid changes. ‘x’ will be replaced by the azimuth angle in radians and ‘y’ by the polar angle in radians measured positive from the north pole. The grid will be assumed to be a longitude-colatitude grid. Note that the order of spherical coordinates is ‘phi’, ‘theta’ and not ‘theta’, ‘phi’, since this allows for dimension independent expressions.
The format is id1: object1 \& object2, id2: object3 \& object2, where objects are one of ‘Landlab’: A mesh deformation plugin that lets a Python script control the deformation of the surface. It is meant for coupling with the landscape evolution code Landlab, but any other script that provides the necessary functions can be used. It is necessary to have Python and numpy with their C APIs installed and that ASPECT_WITH_PYTHON and ASPECT_WITH_LANDLAB are enabled when ASPECT is configured with CMake.

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.

Now it shows up in the documentation. 👍

Comment thread source/mesh_deformation/landlab.cc
Comment thread source/mesh_deformation/landlab.cc Outdated
Comment thread source/mesh_deformation/landlab.cc
@tjhei

tjhei commented Aug 11, 2026

Copy link
Copy Markdown
Member

Could you squash please?

danieldouglas92 and others added 3 commits August 11, 2026 14:54
Co-authored-by: Timo Heister <heister@clemson.edu>
@danieldouglas92

Copy link
Copy Markdown
Contributor Author

@tjhei Squashed!

@tjhei

tjhei commented Aug 13, 2026

Copy link
Copy Markdown
Member

This is ready for review by someone else! @geodynamics/aspect-developers

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.

2 participants