fix write_solution for vector fields#49
Open
marinlauber wants to merge 1 commit into
Open
Conversation
Member
|
Thanks for tackling this Marin! Yes, that would be indeed an interesting addition to the docs here to show the Newton-Raphson in distributed. |
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.
This PR fixes the
write_solutioncrashes for vector-valued fields (e.g. 3D displacementLagrange{RefHexahedron,1}()^3) with the error:number of base functions (8) does not match length of vector (24)The issue is that
_evaluate_at_grid_nodes!contains a type check to decide whether to reinterpret the local dof vector as aVec:However,
CellValuesis parameterised asCellValues{FV<:FunctionValues, GM, QR, detT}without the interpolation is no longer in the type parameter. Theisacheck therefore always returnsfalsefor vector fields, souer = ue(length 24) is passed tofunction_value(cv, qp, uer)which expects length 8.The fix is very simple and only requires changing the check to
RT <: Vec && Ferrite.function_interpolation(cv) isa Ferrite.ScalarInterpolation.This PR was co-authored by Claude Code v2.1.146 (Sonnet 4.6).
PS. I'm happy to add my example with vector field to the docs if you want? (Neohookean cube under prescribed extension rotation with NR solver.)