Skip to content

V2.17.x -> main#755

Merged
julesghub merged 210 commits into
mainfrom
v2.17.x
May 14, 2026
Merged

V2.17.x -> main#755
julesghub merged 210 commits into
mainfrom
v2.17.x

Conversation

@julesghub
Copy link
Copy Markdown
Member

@julesghub julesghub commented May 12, 2026

PR Checklist

  • I have read the CONTRIBUTING.rst document.
  • I have updated the docstrings accordingly.
  • I have updated CHANGES.md.
  • I have added tests which give complete coverage for my changes.
  • I have provided a usage example for my changes.
  • All new and existing tests pass.

julesghub and others added 30 commits October 31, 2023 17:53
* starting for new release uw2.15

* Update surfaceProcesses.py

Update timeField to record time of deposition of sediment in SP functions

* Update surfaceProcesses.py

Fix typo in 3D surface.

Also reset time of the air material to the model time

* Update surfaceProcesses.py

fixed typo in func

* updating the setonix jobs runners

* Update surfaceProcesses.py

Simplify 2D velocity and diffusivity SP functions

* Update surfaceProcesses.py

Didn't create object to bcast surface function to

* Update surfaceProcesses

Revert back to MPI gather of data over evaluate_global

Update the examples

* Adding melt dynamic heating to the advection diffusion solver
see issue #669

* docker utils updates

* Adding some final fixes to the dockerfile scripts

* Update CHANGES.md

* Remove obsolete glucifer bits

* Update dockerfile Badlands install and CHANGES.md

* Update CI for docker builds

* Fixing the velocitySurface 2D and 3D implementation to handle restarts.

Changes also include:
* Renaming the surface tracers to prevent unexpected overwrites
* The surfaceProcess class saving the passive tracer key to use during
initialisation and solve. This is to make the code not save an instance
of the pt to the swarm incase the pt is swapped in/out of Model memory.
And helps with code readability.

* Get the latest release of badlands from pypi

---------

Co-authored-by: Ben Knight <55677727+bknight1@users.noreply.github.com>
1. update the free surface function in UWGeodynamics to a 3D version (see details in _freesurface.py).
2. add an example 1_23_05_FreeSurface_3D_Relaxation in docs/UWGeodynamics/examples/.
Unfortunately GA4 isn't the same as the previous UA system by google. So location tracking is not enabled.

Every import (where the python interpreter is up for ~2 seconds) will produce a GA4 event that records:
- the version of Underworld used
- the platform it's being used on
- the number of mpi processors in the execution of python.

This event is anonymous and no user data other than the above, and a random key (assigned during install) is sent to the GA4 server.
This will provide valuable metrics to the Underworld development team.

As previous users can disable this trojan by setting the environment
variable UW_NO_USAGE_METRICS to any value, eg.
export UW_NO_USAGE_METRICS=1

Also updating the version number to 2.16.0
fixing some missing links, pointed out to me by a user
'imp' module is not longer in python 3.12. Moving to 'runpy' instead.
…nt conversion code that trips up sensitive compilers
Not the best implementation but G4A doesn't support geographic data via
it's Measurement Protocol. So the workaround ("hack") I came up with is
to put the country name in the event title.

The existing issue of G4A's lack of geo info.
https://issuetracker.google.com/issues/237566549?pli=1
1. setup.py -> pyproject.toml new standard, PEP 621.
2. all source code now under `src`.

This is a start for the new standard. Main issue is build isolation
forces CMake caching to break, so I have disabled the caching for now.
The path ressources is still symlinked for backwards compatibility.
julesghub and others added 16 commits February 11, 2026 11:33
This is to support a new container design to reduce the size of
container image
This was an attribute of the hdf5 file, now it's a dataset. Due to issue #749.
* Update GitHub Actions to use latest versions

* update required py version 3.9-3.12

* Add month issue metric workflow

* Update Uplift test tolerance

Change CHANGES.md to CHANGELOG.md

* Replace .yaml -> .yml

* Update failing 3D risingball (fssa) quick test

* Removing obsolete `actions` directory

* Updating CHANGE.md -> CHANGELOG.md

* `Containerfile` for uw-2.17.2 it includes badlands

* Update rhel Containerfile script

* Playing with PostHog payload.

Moving `distinct_id` to the top level to capture stable users better

* fix regex in clean.sh

* Cleaning up documentation re: running the container
Port number was 8888, but should be 20000. Now fixed

* Fix for multi issue metric workflow
* update ALEIB

* update for pytest

* Add UWGeo examples to CI tests

* Revise CHANGELOG for release 2.17.2

Updated changelog for release 2.17.2 with new features, changes, and fixes.

---------

Co-authored-by: julian <house.of.jules@gmail.com>
Co-authored-by: Julian Giordani <julesghub@users.noreply.github.com>
Update to run the new badlands
The idea is this files should be updated each release.
1. Add codes in _ freesurface.py and surfaceProcesses.py that are related to the coupling modelling within the ALEIB scheme. Now we can use this coupling framework by setting Model._freeSurface_ALEIB = True.

2. Add an example 1_23_08_CouplingModellingALEIB_TopographyRelaxation.ipynb
@julesghub julesghub self-assigned this May 12, 2026
@julesghub julesghub marked this pull request as ready for review May 12, 2026 03:55
Copilot AI review requested due to automatic review settings May 12, 2026 03:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR merges the v2.17.x line into main, updating Underworld2 to the 2.17.x feature set. It includes ALE-IB free-surface capabilities and Badlands coupling updates, modernizes packaging/build workflows (CMake/SWIG, pyproject, conda/CI, pixi/spack), and updates usage-metrics plumbing to PostHog.

Changes:

  • Add ALE-IB workflow support and extend Badlands↔UW coupling to provide a reusable surface interpolation function for free-surface evolution.
  • Modernize packaging/build tooling (pyproject metadata, SWIG/CMake wrapper build, conda CI lockfile usage, pixi/spack scaffolding).
  • Update telemetry dispatch to PostHog and adjust checkpoint/swarm I/O metadata handling.

Reviewed changes

Copilot reviewed 78 out of 90 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/underworld/UWGeodynamics/surfaceProcesses.py Badlands coupling refactor (sample-point helper, caching, returns surface interpolation fn).
src/underworld/UWGeodynamics/_rheology.py Switch resource loading from pkg_resources to importlib.resources.
src/underworld/UWGeodynamics/_model.py Add ALE-IB flags/utilities; adjust surfaceProcesses call site; restart_badlands arg propagation.
src/underworld/UWGeodynamics/_melt.py Switch resource loading from pkg_resources to importlib.resources.
src/underworld/UWGeodynamics/_material.py Remove pkg_resources import; use importlib.resources for materials JSON.
src/underworld/UWGeodynamics/_freesurface.py Add ALE-IB “interface” handling and surface-process-driven surface advection path.
src/underworld/utils/init.py Remove commented legacy IPython call.
src/underworld/swarm/_swarmvariable.py Write proc_offset as an HDF5 dataset (not attribute).
src/underworld/swarm/_swarm.py Read proc_offset via dataset helper for load optimization.
src/underworld/libUnderworld/Underworld/libUnderworld/Toolbox/Toolbox.h Update toolbox init/finalize signatures.
src/underworld/libUnderworld/StgFEM/libStgFEM/Toolbox/Toolbox.h Update toolbox init/finalize signatures.
src/underworld/libUnderworld/StgFEM/Discretisation/src/FeMesh_ElementType.c Update constructor signature usage.
src/underworld/libUnderworld/StGermain/Base/Container/src/List.c Update constructor signature usage.
src/underworld/libUnderworld/StgDomain/Mesh/src/MeshClass.c Update IGraph_New call signature.
src/underworld/libUnderworld/StgDomain/Mesh/src/Mesh_HexType.c Update constructor signature usage.
src/underworld/libUnderworld/StgDomain/Mesh/src/Mesh_CentroidType.c Update constructor signature usage.
src/underworld/libUnderworld/StgDomain/libStgDomain/Toolbox/Toolbox.h Update toolbox init/finalize signatures.
src/underworld/libUnderworld/Solvers/libSolvers/Toolbox/Toolbox.h Update toolbox init/finalize signatures.
src/underworld/libUnderworld/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.c Update List_New() usage.
src/underworld/libUnderworld/PICellerator/libPICellerator/Toolbox/Toolbox.h Update toolbox init/finalize signatures.
src/underworld/libUnderworld/libUnderworldPy/numpy.i Modernize SWIG NumPy typemaps for newer NumPy/Python APIs.
src/underworld/libUnderworld/libUnderworldPy/CMakeLists.txt Rework SWIG wrapper build targets; adjust RPATH behavior for macOS.
src/underworld/libUnderworld/gLucifer/libgLucifer/Toolbox/Toolbox.h Update toolbox init/finalize signatures.
src/underworld/libUnderworld/CMakeLists.txt Modernize top-level CMake config; add libUnderworldPy subdir build.
src/underworld/_version.py Bump package version to 2.17.2.
src/underworld/_net/init.py Add PostHog telemetry posting alongside GA4 logic and rename client id variable.
src/underworld/init.py Update metrics dispatch to PostHog and adjust event payload structure.
setup.py Small build arg tweak; prepend conda prefix into CMAKE_PREFIX_PATH.
requirements.txt Remove legacy “.” shim requirements file.
pyproject.toml Update python version bounds; tweak optional deps; make license dynamic.
pixi.toml Add pixi workspace definition for reproducible builds/tests.
pixi_dev_notes.md Add developer notes for pixi usage.
LICENSE.md Update copyright years/holders.
Installation.rst Reorganize installation docs (container/HPC/native sections).
docs/UWGeodynamics/examples/resources/badlands_1en5.xml Add Badlands XML resource for ALE-IB coupling example.
docs/UWGeodynamics/examples/1_23_08_CouplingModellingALEIB_TopographyRelaxation.ipynb Add ALE-IB + surface-process topography relaxation example notebook.
docs/UWGeodynamics/examples/1_23_07_FreeSurfaceALEIB_Crameri2012Case1_Relaxation.ipynb Add ALE-IB free-surface relaxation example notebook.
docs/UWGeodynamics/examples/1_23_06_FreeSurfaceALEIB_Kaus2010_Rayleigh-Taylor_Instability.ipynb Add ALE-IB Rayleigh–Taylor instability example notebook.
docs/UWGeodynamics/examples/1_23_05_FreeSurface_3D_Relaxation.ipynb Update 3D free-surface example to support longtest gating and doc formatting.
docs/UWGeodynamics/examples/1_12_Uplift_TractionBCs.py Add jupytext-exported python example with traction BC verification.
docs/install_guides/spack.yaml Add experimental spack env spec for dependencies.
docs/install_guides/spack_guide.md Add spack build instructions.
docs/development/release_guidelines.md Expand release guidance and update changelog filename references.
docs/development/gadi_singularity/underworld.rhel Update Rocky base/versions and restructure builder/runtime stages for Gadi image.
docs/development/gadi_singularity/README.md Add build instructions for Gadi container images.
docs/development/gadi_singularity/petsc.rhel Update PETSc image build to Rocky 8.10 and PETSc 3.22.5.
docs/development/docs_generator/UWGeoUserGuide.rst Fix links/typos and update API docs snippets.
docs/development/docs_generator/README.md Remove napoleon dependency note.
docs/development/docs_generator/index.rst Minor formatting tweak.
docs/development/docs_generator/conf.py Update copyright year; tweak theme path usage; fix subprocess arg type.
docs/development/docker/docker.md Add security notes for container guidance.
docs/development/docker.md Remove legacy docker schema doc (superseded).
docs/development/development_guidelines.md Update changelog filename reference.
docs/development/container/start Add Xvfb startup helper script.
docs/development/container/README.md Add container build/run notes (podman focus).
docs/development/container/launch-container.sh Add podman run script with uid/gid mapping notes.
docs/development/container/Containerfile.dev Add dev containerfile using micromamba base.
docs/development/container/Containerfile Add containerfile building UW2 from conda env + source install.
Dockerfile Remove legacy binder Dockerfile.
conda/meta.yaml Update conda recipe version/source and build script deps.
conda/environment.yml Update dev conda environment (python 3.12, tooling, badlands).
conda/conda_build_config.yaml Switch linux MPI preference to openmpi.
clean.sh Limit cleanup globs to src/ to avoid deleting unrelated artifacts.
CHANGELOG.md Rename header and add 2.17.x release notes.
actions/globalprotect/scripts/entrypoint.sh Remove unused globalprotect action scripts.
actions/globalprotect/README.md Remove unused globalprotect action docs.
actions/globalprotect/LICENSE Remove vendored license file for removed action.
actions/globalprotect/Dockerfile Remove unused action dockerfile.
actions/globalprotect/action.yml Remove unused GitHub action definition.
actions/globalprotect/.github/workflows/main.yml Remove unused workflow for removed action.
.zenodo.json Update creator ordering and metadata.
.gitignore Ignore pixi env dir and egg-info.
.github/workflows/publish-to-pypi.yml Add PyPI publish workflow (build on push; publish on tags).
.github/workflows/issue-metrics.yml Add scheduled/monthly issue metrics workflow.
.github/workflows/conda-build-test.yml Update CI to use lockfile env and expanded UWGeo tests.
.github/pull_request_template.md Update checklist to reference CHANGELOG.md.
.gitattributes Mark pixi lock as binary/linguist-generated to avoid merge conflicts.
.binder/postBuild Add binder postBuild hook to pip install ..
Comments suppressed due to low confidence (1)

src/underworld/swarm/_swarm.py:366

  • Swarm.load() now calls h5_get_dataset(h5f, 'proc_offset'). If the dataset is absent (older checkpoint files, or files written before this PR), h5_get_dataset will raise KeyError and abort loading. To preserve backward compatibility, wrap this lookup in a try/except and/or fall back to reading the legacy attribute (h5f.attrs.get('proc_offset')).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +111 to +115
if self.model.mesh.dim == 3:
interpolate_x = self.model.mesh.data[self.interface.data,0]
interpolate_x = self.model.mesh.data[self.interface.data,1]
interpolate_z = surf_fn_badlands((interpolate_x,interpolate_y))
self.TField.data[self.interface.data, 0] = interpolate_z.copy()
Comment on lines +103 to +110
def _advect_surface_sp(self,dt):
surf_fn_badlands = self.model.surfaceProcesses.solve(dt)
if self.interface:
if self.model.mesh.dim == 2:
interpolate_x = self.model.mesh.data[self.interface.data,0]
interpolate_z = surf_fn_badlands(interpolate_x)
self.TField.data[self.interface.data, 0] = interpolate_z.copy()

Comment on lines 371 to 382
@@ -227,7 +378,7 @@ def solve(self, dt, sigma=0):
print(purple + "Processing surface with Badlands...Done" + endcol)
sys.stdout.flush()

return
return surf_fn_badlands if self.Model._freeSurface_ALEIB else None

Comment on lines +86 to +98
try:
import requests
# build payload for PostHog comms
payload = {
"api_key": POSTHOG_API_KEY,
"event": event_name,
}
payload.update( ev_dict )

url = f"{POSTHOG_PROJECT_URL}/capture/"
headers = {"Content-Type": "application/json"}
r = requests.post(url, json=payload, headers=headers, timeout=10)

Comment on lines +101 to +104
# print(f"request.post status: {r.status_code}")
except Exception as e:
print(f"PostHog telemetry failed: {e}")

Comment on lines 109 to 114
Current Underworld2 only dispatches a GA event when the underworld module
is imported. This is effected by the calling of this function from
underworld/__init__.py.
underworld/__init__.mpy.

Google Analytics uses the client id (GA4_CLIENT_ID) to determine unique users. In
Google Analytics uses the UW_CLIENT_ID to determine a unique users. In
Underworld, we generate a random string for this id and record it in _uwid.py (the
Comment on lines +32 to +41
message("Swig section diagnostics:")
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
message(STATUS "INCLUDE_DIRECTORIES")
foreach(dir ${dirs})
message(STATUS " '${dir}'")
endforeach()
message(STATUS "UW_LIBRARIES=${UW_LIBRARIES}")
message(STATUS "PETSc_LIBRARIES=${PETSc_LIBRARIES}")
message("End Swig diagnostics:")

Comment on lines +38 to +46
message(STATUS "UW_LIBRARIES=${UW_LIBRARIES}")
message(STATUS "PETSc_LIBRARIES=${PETSc_LIBRARIES}")
message("End Swig diagnostics:")

set_source_files_properties(Function.i PROPERTIES CPLUSPLUS ON SWIG_MODULE_NAME Function)
swig_add_library(FunctionSwig TYPE SHARED LANGUAGE python SOURCES Function.i)
set_target_properties(FunctionSwig PROPERTIES SUFFIX ".so" OUTPUT_NAME "Function")
target_link_libraries(FunctionSwig PRIVATE ${UW_LIBRARIES} PRIVATE ${PETSc_LIBRARIES} PRIVATE Python3::Module)

Comment on lines +56 to +69
"""
Creates a SurfaceProcesses object to encapsulate a Badlands model.
The arguments for this function will override, or change the behaviour, of the
badlands .xml file that usually parametises a Badlands model.
Note Badlands is only made available on processor rank 0 in parallel. Information is sent
to proc 0, computed via Badlands, and then broadcast to all procs for Underworld processing.

Paramemters
-----------

XML : str
The xml file that parametrises the Badlands model to be coupled with UWGeo.
Note aguments defined here will override the values of the xml file.
resolution : int array
Comment thread src/underworld/UWGeodynamics/_freesurface.py Outdated
* Updating clean.sh
* improving publish-to-pypi.yml
* disabling old github runners
@julesghub julesghub merged commit 00febfe into main May 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants