Hessian on skeleton
- Dominant language
- Julia
- Stars
- 879
- Forks
- 119
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 4
Description
When trying to compute a hessian on a form including the skeleton:
```julia
module HessianSkeletonTests
using Gridap
model = CartesianDiscreteModel((0.,1.,0.,1.),(2,2))
Λ = SkeletonTriangulation(model)
dΛ = Measure(Λ,2)
reffe = ReferenceFE(lagrangian,Float64,1)
V = FESpace(model,reffe,conformity=:L2)
uh = FEFunction(V,rand(num_free_dofs(V)))
e(uh) = ∫(mean(uh)*mean(uh))*dΛ
hessian(e,uh)
end # module
```
The following error is produced:
```
ERROR: MethodError: no method matching lazy_map(::Gridap.Arrays.AutoDiffMap, ::Gridap.Arrays.LazyArray{…}, ::Gridap.Arrays.VectorBlock{…})
The function `lazy_map` exists, but no method is defined for this combination of argument types.
Closest candidates are:
lazy_map(::Any, ::AbstractArray...)
@ Gridap ~/Documents/Gridap.jl/src/Arrays/LazyArrays.jl:55
lazy_map(::typeof(Gridap.Fields.integrate), ::AbstractArray, ::AbstractArray, ::AbstractArray, ::AbstractArray)
@ Gridap ~/Documents/Gridap.jl/src/Fields/ApplyOptimizations.jl:292
lazy_map(::typeof(Gridap.Fields.integrate), ::AbstractArray, ::AbstractArray, ::AbstractArray)
@ Gridap ~/Documents/Gridap.jl/src/Fields/ApplyOptimizations.jl:285
...
Stacktrace:
[1] autodiff_array_jacobian(a::Gridap.Arrays.var"#148#149"{…}, i_to_x::Gridap.Arrays.LazyArray{…}, j_to_i::Gridap.Geometry.SkeletonPair{…})
@ Gridap.FESpaces ~/Documents/Gridap.jl/src/FESpaces/FEAutodiff.jl:187
[2] autodiff_array_hessian(a::Function, i_to_x::Gridap.Arrays.LazyArray{…}, j_to_i::Gridap.Geometry.SkeletonPair{…})
@ Gridap.Arrays ~/Documents/Gridap.jl/src/Arrays/Autodiff.jl:47
[3] _hessian(f::Function, uh::Gridap.FESpaces.SingleFieldFEFunction{…}, fuh::Gridap.CellData.DomainContribution)
@ Gridap.FESpaces ~/Documents/Gridap.jl/src/FESpaces/FEAutodiff.jl:75
[4] hessian(f::typeof(Main.HessianSkeletonTests.e), uh::Gridap.FESpaces.SingleFieldFEFunction{…})
@ Gridap.FESpaces ~/Documents/Gridap.jl/src/FESpaces/FEAutodiff.jl:57
[5] top-level scope
@ ~/Documents/Gridap.jl/test/FESpacesTests/FEAutodiffTests.jl:10
Some type information was truncated. Use `show(err)` to see complete types.```
Contributor guide
Research direction
Reproduce the example from test/FESpacesTests/FEAutodiffTests.jl and inspect the stack-trace entry points in src/FESpaces/FEAutodiff.jl and src/Arrays/Autodiff.jl. Trace the lazy_map call involving AutoDiffMap, LazyArray, and VectorBlock for SkeletonTriangulation. Done means hessian(e,uh) runs for the skeleton example without the reported MethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100