Skip to content
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

Higher order gradients in CellValues #891

Closed
wants to merge 11 commits into from

Conversation

lijas
Copy link
Collaborator

@lijas lijas commented Mar 6, 2024

Implementation of higher order gradients in CellValues. This was quite easy to do thanks to Knuts new FunctionValues and GeometryMapping.

  • Tests for FaceValues
  • Update changelog
  • Type stable CellValues constructor (?)

@KnutAM
Copy link
Member

KnutAM commented Mar 6, 2024

Type stable CellValues constructor

Merging with master and using the same concept for update_hessian as for update_gradient should solve this problem.

Copy link
Member

@KnutAM KnutAM left a comment

Choose a reason for hiding this comment

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

Haven't checked all the details yet, but very nice to include this!

I think it would be nice to include the used formulas here, and also short derivation in a collapsed block as for the non-identity mappings.

Comment on lines 205 to 215
Jinv = calculate_Jinv(getjacobian(mapping_values))
H = gethessian(mapping_values)
@inbounds for j in 1:getnbasefunctions(funvals)
dNdx = dothelper(funvals.dNdξ[j, q_point], Jinv)

is_vector_valued = first(funvals.Nx) isa Vec
if is_vector_valued #TODO - combine with helper function ?
d2Ndx2 = (funvals.d2Ndξ2[j, q_point] - dNdx⋅H) ⊡ otimesu(Jinv,Jinv)
else
d2Ndx2 = Jinv'⋅(funvals.d2Ndξ2[j, q_point] - dNdx⋅H)⋅Jinv
end
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Jinv = calculate_Jinv(getjacobian(mapping_values))
H = gethessian(mapping_values)
@inbounds for j in 1:getnbasefunctions(funvals)
dNdx = dothelper(funvals.dNdξ[j, q_point], Jinv)
is_vector_valued = first(funvals.Nx) isa Vec
if is_vector_valued #TODO - combine with helper function ?
d2Ndx2 = (funvals.d2Ndξ2[j, q_point] - dNdxH) otimesu(Jinv,Jinv)
else
d2Ndx2 = Jinv'(funvals.d2Ndξ2[j, q_point] - dNdxH)Jinv
end
Jinv = calculate_Jinv(getjacobian(mapping_values))
H = gethessian(mapping_values)
is_vector_valued = first(funvals.Nx) isa Vec
Jinv_otimesu_Jinv = is_vector_valued ? otimesu(Jinv, Jinv) : nothing
@inbounds for j in 1:getnbasefunctions(funvals)
dNdx = dothelper(funvals.dNdξ[j, q_point], Jinv)
if is_vector_valued #TODO - combine with helper function ?
d2Ndx2 = (funvals.d2Ndξ2[j, q_point] - dNdxH) Jinv_otimesu_Jinv
else
d2Ndx2 = Jinv'(funvals.d2Ndξ2[j, q_point] - dNdxH)Jinv
end

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 92.24138% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 93.12%. Comparing base (8e92196) to head (f16e2a5).
Report is 1 commits behind head on master.

Files Patch % Lines
src/FEValues/FunctionValues.jl 87.27% 7 Missing ⚠️
src/interpolations.jl 92.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #891      +/-   ##
==========================================
- Coverage   93.30%   93.12%   -0.18%     
==========================================
  Files          36       36              
  Lines        5257     5384     +127     
==========================================
+ Hits         4905     5014     +109     
- Misses        352      370      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

None yet

2 participants