Reference states - #1696
Merged
Merged
Conversation
IvarStefansson
left a comment
Contributor
There was a problem hiding this comment.
Main comment: Think about precendence for reference - time step - iteration
13 tasks
keileg
reviewed
Jun 29, 2026
keileg
reviewed
Jun 29, 2026
keileg
reviewed
Jun 29, 2026
Contributor
|
I have done a partial re-implementation of this PR. Main points:
|
6 tasks
IvarStefansson
left a comment
Contributor
There was a problem hiding this comment.
Mainly very good. Not a huge fan of the new tests, though. Please have a look, then we can discuss if needed.
…ate module Also make these mixins to be added to operators
…operators These have been replaced with a more refined suite of tests
…r initialisation and THM-linearisation as well as thermodynamics.
Co-authored-by: Ivar Stefansson <ivar.stefansson@uib.no>
IvarStefansson
approved these changes
Jul 6, 2026
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.
Proposed changes
This PR introduces an additional state of
VariableandTimeDependentDenseArrayfollowing the style ofprevious_iterationandprevious_time_step. These now also are able to hold reference values which can be obtained in AD operator form through call of the methodop.reference()for any AD operatorop, e.g.,model.pressure(subdomains).reference(). In addition, perturbations to reference states can be conventiently fetched byop.perturbation_from_reference(). If not set, reference values are 0. No optimization in terms of emtpy operators has been implemented but could be foreseen in near future.The API for setting values has been extended aiming at canonical extension of current workflows (
EquationSystem.set/get_variable_valuesandpp.set/get_solution_values). An additional keywordreferenceneeds to be set true.As an example (hopefully of actual value) is added utilizing perturbations from reference states: Porosity with mere rock compressibility simplifying standard two-way coupled poromechanics. It currently mainly serves for testing the potential integration of reference states in models.
NOTE: This PR does not integrate reference states in models and variables like currently proposed in #1686 (initialization). The aim is to base further work on initialization on the current PR.
Types of changes
What types of changes does this PR introduce to PorePy?
Put an
xin the boxes that apply.Checklist
Put an
xin the boxes that apply or explain briefly why the box is not relevant.pytestwas run with the--run-skippedflag.