Skip to content

fault_friction: the viscosity, cohesion, weight and wall speed as quantities - #1241

Open
lmoresi wants to merge 1 commit into
developmentfrom
docs/fault-friction-explicit-quantities
Open

lmoresi wants to merge 1 commit into
developmentfrom
docs/fault-friction-explicit-quantities

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 19, 2026

Copy link
Copy Markdown
Member

What changes for users: the fault_friction example runs in its model with reference quantities. It stopped at eta_0 = 1, because a bare number for a dimensional parameter is refused.

Documentation only: docs/examples/adjoint/fault_segments/fault_friction.py and its notebook. It needs #1240 to run: without it the gradient raises on the left wall's datum. Runs were by H3 (the units desk, a Claude session) on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH), on development 4ab522a.

The change

The example's parameters are now expressions holding the scales it already declares:

was now
eta_0 = 1 uw.expression(r"\eta_0", REF_VISCOSITY, ...)
cohesion = _nd(params.uw_cohesion / REF_STRESS) uw.expression("C", params.uw_cohesion, ...)
rho_g = _nd(DENSITY * GRAVITY * DOMAIN_DEPTH / REF_STRESS) uw.expression(r"\rho g", DENSITY * GRAVITY, ...)
side walls (0.5, None), (-0.5, None) (V_wall, None), (-V_wall, None), with V_wall an expression for CONVERGENCE_RATE / 2

The wall speed is an expression, not a bare uw.quantity. A quantity in add_essential_bc is applied at its SI magnitude, 1.3e-10 where 0.5 is right, with no warning (#1238). The bottom keeps (0.0, 0.0).

Check

python fault_friction.py -uw_check_only 1 (the adjoint-against-finite-difference check) gives the same numbers as the original example run with its reference quantities removed, the same non-dimensional problem, to every printed digit:

J ratio (flat, lower ramp, upper ramp, near surface)
original, no reference quantities 1.484255e-03 0.99999, 1.00000, 1.00000, 1.00000
this branch, with #1240 1.484255e-03 0.99999, 1.00000, 1.00000, 1.00000

The gradients dJ/dlog mu agree to every printed digit too: -1.00332984e-06, -4.38767782e-04, -3.23950066e-03, -3.98863135e-03.

#1197 (open) divides the example's coordinates by its depth, on other lines of the same files. The two changes touch different hunks.

Underworld development team with AI support from Claude Code

…ntities

In a model with reference quantities a bare number for a dimensional
parameter is refused, and the example stopped at eta_0 = 1. The bulk
viscosity, the cohesion, the weight per unit volume and the side-wall speed
are now expressions holding the scales the example declares. The wall speed
is an expression, not a bare uw.quantity, because a quantity in
add_essential_bc is applied at its SI magnitude (#1238). The adjoint needs
the fix for a datum that is one named constant (fix/adjoint-named-constant-datum).

With that fix, `-uw_check_only 1` gives J = 1.484255e-03 and the four
gradients of the same problem with no reference quantities, to every
printed digit, with adjoint-to-difference ratios of 1.00000 (0.99999 flat).

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 19, 2026 22:16

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
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.

3 participants