Skip to content

[ADDITION] Add global/local penalty switch to DYREL - #549

Merged
albert-de-montserrat merged 8 commits into
mainfrom
adm/penalty
Oct 14, 2026
Merged

albert-de-montserrat merged 8 commits into
mainfrom
adm/penalty

Conversation

@albert-de-montserrat

@albert-de-montserrat albert-de-montserrat commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Whats the purpose of this PR?

  • Bug fix
  • New feature
  • Documentation update
  • Other, please explain

Describe it in more detail below:

Add global_penalty to DYREL state and constructors. It defaults to true, using mean finite viscosity across the domain; false uses local viscosity. Apply switch in standard and variational DYREL. Preserve variational rock-fraction correction. MPI mode reduces mean viscosity across ranks.

Document the switch in the DYREL guide and solver/API references. Branch also includes a package version bump to 0.8.2.

Checklist

  • The PR title is descriptive and starts with the appropriate tag: [BUGFIX], [ADDITION], [DOC], etc.
  • New tests (either assessing the correct behaviour of new internal functions or the correctness of a miniapps or benchmarks) were added, or old tests were updated
  • Affected miniapps have also been updated
  • The new feature was added in a way that does not break public API
  • New documentation related to the new feature was added
  • The new code follows the contributor guidelines, in particular the Runic Style

Validation: git diff --check passed. Tests and Runic were not run.

albert-de-montserrat and others added 4 commits October 14, 2026 10:14
@nolebase/vitepress-plugin-enhanced-readabilities 2.21 requires
vitepress 2 (alpha) as a peer dependency, which conflicts with the
vitepress ^1.6.4 used by the docs build and makes `npm install` fail.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The `compute_bulk_viscosity_and_penalty!` kernel takes `global_penalty`
as its final argument.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/test/test_PlumeFreeSurface_DYREL.jl b/test/test_PlumeFreeSurface_DYREL.jl
index 7b4bf904..a5100da3 100644
--- a/test/test_PlumeFreeSurface_DYREL.jl
+++ b/test/test_PlumeFreeSurface_DYREL.jl
@@ -6,7 +6,7 @@ elseif ENV["JULIA_JUSTRELAX_BACKEND"] === "CUDA"
     import CUDA
 end
 
-using Test#, Suppressor
+using Test #, Suppressor
 using GeoParams
 using JustRelax, JustRelax.JustRelax2D
 using ParallelStencil, ParallelStencil.FiniteDifferences2D
@@ -200,8 +200,8 @@ end
         # --- free_surface = false (instantaneous Stokes solve from rest) ---
         iters, maxVx, maxVy, allfinite = PlumeFreeSurface_DYREL(igg, nx, ny)
         @test allfinite
-        @test maxVy ≈ 9.28245184590358e-9 rtol = 1.0e-6
-        @test maxVx ≈ 2.486917826860531e-9 rtol = 1.0e-6
+    @test maxVy ≈ 9.28245184590358e-9 rtol = 1.0e-6
+    @test maxVx ≈ 2.486917826860531e-9 rtol = 1.0e-6
         @test maxVy > maxVx
 
 
@@ -214,9 +214,9 @@ end
         iters_fs, maxVx_fs, maxVy_fs, allfinite_fs = PlumeFreeSurface_DYREL(igg, nx, ny; free_surface = true, nsolves = 2)
         @test allfinite_fs
         @test iters_fs.converged
-        @test maxVy_fs ≈ 6.62507771632624e-9 rtol = 1.0e-2
+    @test maxVy_fs ≈ 6.62507771632624e-9 rtol = 1.0e-2
         @test !isapprox(maxVy_fs, 9.6799854388711294e-9; rtol = 5.0e-4)
 
-        # finalize_global_grid(; finalize_MPI = true)
+    # finalize_global_grid(; finalize_MPI = true)
     # end
 end

With the 1e6 viscosity step of SolCx, a penalty scaled by the mean
viscosity is ~5e6 times the weak-side viscosity, and the variational
DYREL solve hits its iteration cap before reaching ϵ. The SolCx runs
now pass `global_penalty = false`; both solvers converge in about
2000 iterations at ϵ = 1e-6, and the reference values are regenerated
from those converged solutions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@albert-de-montserrat
albert-de-montserrat merged commit 5d1b985 into main Oct 14, 2026
19 of 21 checks passed
@albert-de-montserrat
albert-de-montserrat deleted the adm/penalty branch October 14, 2026 12:55
@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.81967% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ext/AMDGPU/2D.jl 0.00% 8 Missing ⚠️
src/ext/CUDA/2D.jl 0.00% 8 Missing ⚠️
src/ext/AMDGPU/3D.jl 0.00% 6 Missing ⚠️
src/ext/CUDA/3D.jl 0.00% 6 Missing ⚠️
src/DYREL/constructors.jl 93.93% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants