Lag label#228
Open
danshapero wants to merge 5 commits into
Open
Conversation
danshapero
commented
May 15, 2026
| return enew | ||
| else: | ||
| return ufl_replace(e, cmapping) | ||
| new_terms = [] |
Collaborator
Author
There was a problem hiding this comment.
I had a bit of help from Claude for this code path. The alternate path below (not a LabelledForm) was straightforward.
pbrubeck
requested changes
May 15, 2026
Comment on lines
+125
to
+127
| for var in extract_type(e, Variable): | ||
| if var.ufl_operands[1] is lag_label: | ||
| cmapping.setdefault(var, var) |
Collaborator
There was a problem hiding this comment.
This should go at the top of the function, and the rest of the diff could go away
Collaborator
|
I just noticed that #227 might potentially be useful for similar purposes.
I think it's fine to support both modes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #221. This PR adds a function
lagwhich labels a single expression in a form for holding back to the start of a timestep. As @pbrubeck thought, implementing it amounted to modifyingirksome.tools.replace. I added a test based on lagging the conductivity in the Stefan problem. Without lagging, that fails because of the conditional.In addition to giving you an escape hatch, you can use lagging to define nonlinear preconditioners. I have a demo of this for the Allen-Cahn equation coded up just using petsc4py which I think is pretty compelling. @JHopeCollins and I are working on getting AuxiliaryOperatorSNES merged into Firedrake: firedrakeproject/firedrake#5119. Once that's merged I can write an Irksome demo showing that off, either in this PR or a separate one.