-
Notifications
You must be signed in to change notification settings - Fork 8
Add solver barrier for VEP and fix is_viscoplastic #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -950,6 +950,16 @@ class SolverBaseClass(uw_object): | |||||||||||
| "constitutive_model must be a valid class or instance of a valid class" | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| # Check that the solver can support this constitutive model's requirements. | ||||||||||||
| # Models with stress history (VEP) need a solver that manages DFDt — e.g. VE_Stokes. | ||||||||||||
| # Using them on a plain Stokes solver silently drops the history terms. | ||||||||||||
| if self._constitutive_model.requires_stress_history and self.Unknowns.DFDt is None: | ||||||||||||
| raise TypeError( | ||||||||||||
| f"{type(self._constitutive_model).__name__} requires stress history tracking " | ||||||||||||
| f"(DFDt). Use uw.systems.VE_Stokes instead of uw.systems.Stokes, or provide " | ||||||||||||
| f"a DFDt object when constructing the solver." | ||||||||||||
|
Comment on lines
+959
to
+960
|
||||||||||||
| f"(DFDt). Use uw.systems.VE_Stokes instead of uw.systems.Stokes, or provide " | |
| f"a DFDt object when constructing the solver." | |
| f"(DFDt). Use uw.systems.VE_Stokes instead of uw.systems.Stokes. If you " | |
| f"provide a DFDt object when constructing a non-VE solver, you must manually " | |
| f"call DFDt.update_pre_solve() and DFDt.update_post_solve() each timestep." |
Copilot
AI
Mar 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new runtime guard changes behavior for existing code/tests that currently set ViscoElasticPlasticFlowModel on uw.systems.Stokes (e.g. tests/test_1050_VEstokesCart.py uses plain Stokes). Please add/adjust pytest coverage to (a) assert the new TypeError on plain Stokes, and (b) update any existing tests/examples to use VE_Stokes (or to expect the error), so CI doesn’t regress silently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring says assigning a stress-history model to a plain
Stokessolver “will raise an error”, but the enforcement depends on solver-side checks and can be bypassed (e.g. ifUnknowns.DFDtis non-None). Consider rewording this to reflect the actual contract (e.g. “requires a solver that manages stress history such as VE_Stokes; plain Stokes is unsupported”) so it stays accurate even if the solver-side guard changes.