Skip to content

Conversation

@NiklasVin
Copy link
Collaborator

Addresses the crashes when using subcycling as described in precice/fenics-adapter#172.

The current implementation of solid-fenics.py operates directly on the dof vectors of u, a and v at one point. This also changes the values stored in the checkpoint which ultimately leads to the crash described in the PR above.
Updating values of a function object via assign(), does not change the values stored in a checkpoint, since the old dof vector of the function to be updated is overwritten by calling assign() .

@BenjaminRodenberg
Copy link
Member

I think this clearly improves the readability of solid.py.

It also hints at a problem with the FEniCS adapter: From my perspective it should not be possible to alter a checkpoint -- intentionally or by accident -- as soon as it is handed over to the FEniCS adapter. Meaning: As far as I understand this PR cures the symptom but we can only solve the original problem with precice/fenics-adapter#172.

@NiklasVin
Copy link
Collaborator Author

Yes, it is true that it only cures the symptom. With this PR, I also wanted to show, that the current issue is easily avoidable from the user's side. And since I am not working that long with FEniCS, I am not sure how common it is to directly change the values by directly accessing vector(). If it is more of an exception, I wouldn't be that content with the deepcopy solution, since it is, in the rest of the cases, a bit pointless, but I don't want to be a nitpicker. So yes, the deepcopy solves the original problem for all cases.

Copy link
Member

@BenjaminRodenberg BenjaminRodenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and definitely improves readability. Let's merge it.

Let's discuss the deepcopy issue directly in precice/fenics-adapter#172 because it is now not really related to this tutorial anymore.

@BenjaminRodenberg BenjaminRodenberg merged commit 0df4f00 into precice:develop Aug 14, 2024
BenjaminRodenberg added a commit that referenced this pull request Nov 7, 2024
* Revert changes from #554
* Remove changelog entry (#554 was not included in any release)
* Require fenicsprecice==2.2.0 to avoid subcycling bug.

---------

Co-authored-by: Benjamin Rodenberg <[email protected]>
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