Skip to content

Fixed L2 projection for TensorValue - #213

Merged
miguelmaso merged 1 commit into
mainfrom
fix-L2-proj
Jul 31, 2026
Merged

Fixed L2 projection for TensorValue#213
miguelmaso merged 1 commit into
mainfrom
fix-L2-proj

Conversation

@miguelmaso

Copy link
Copy Markdown
Collaborator

Replacing · by is a more generic implementation since the last operator has more overloads:

  • scalar: -> *
  • vector: -> ·
  • matrix: ->

@github-actions

Copy link
Copy Markdown

Benchmark Results (Julia v1)

Time benchmarks
main 26d1d3e... main / 26d1d3e...
Constitutive models/Visco-elastic Ψ 0.0394 ± 0.017 ms 0.0397 ± 0.018 ms 0.992 ± 0.62
Constitutive models/Visco-elastic ∂Ψ∂F 0.0328 ± 0.015 ms 0.033 ± 0.014 ms 0.994 ± 0.62
Constitutive models/Visco-elastic ∂∂Ψ∂FF 0.069 ± 0.032 ms 0.0686 ± 0.033 ms 1.01 ± 0.67
Constitutive models/Visco-polyconvex Ψ 0.161 ± 0.01 μs 0.161 ± 0.01 μs 1 ± 0.088
Constitutive models/Visco-polyconvex ∂Ψ∂F 0.18 ± 0.009 μs 0.181 ± 0.01 μs 0.994 ± 0.074
Constitutive models/Visco-polyconvex ∂∂Ψ∂FF 7.39 ± 5.8 μs 7.48 ± 5.9 μs 0.988 ± 1.1
Simulations/StaticMechanicalDirichlet 0.138 ± 0.0079 s 0.138 ± 0.0097 s 1 ± 0.091
Simulations/StaticMechanicalNeumann 0.13 ± 0.018 s 0.127 ± 0.019 s 1.02 ± 0.21
Simulations/ViscoElastic 13 s 12.7 s 1.02
Tensor algebra/Cofactor 0.08 ± 0.01 μs 0.081 ± 0.03 μs 0.988 ± 0.39
Tensor algebra/Det(A)Inv(A') 0.121 ± 0.051 μs 0.13 ± 0.061 μs 0.931 ± 0.59
Tensor algebra/IIsym 0.07 ± 0.001 μs 0.08 ± 0.03 μs 0.875 ± 0.33
Tensor algebra/push_forward_C_to_F 0.301 ± 0.001 μs 0.301 ± 0.019 μs 1 ± 0.063
Tensor algebra/×ᵢ⁴ 0.07 ± 0.001 μs 0.07 ± 0.02 μs 1 ± 0.29
Tensor algebra/δδ_λ_2d 30 ± 0 ns 30 ± 0 ns 1 ± 0
Tensor algebra/δδ_μ_2d 30 ± 0 ns 30 ± 0 ns 1 ± 0
time_to_load 2.73 ± 0.016 s 2.7 ± 0.075 s 1.01 ± 0.029
Memory benchmarks
main 26d1d3e... main / 26d1d3e...
Constitutive models/Visco-elastic Ψ 0.542 k allocs: 0.0443 MB 0.542 k allocs: 0.0443 MB 1
Constitutive models/Visco-elastic ∂Ψ∂F 0.593 k allocs: 0.0492 MB 0.593 k allocs: 0.0492 MB 1
Constitutive models/Visco-elastic ∂∂Ψ∂FF 1.05 k allocs: 0.0853 MB 1.05 k allocs: 0.0853 MB 1
Constitutive models/Visco-polyconvex Ψ 0 allocs: 0 B 0 allocs: 0 B
Constitutive models/Visco-polyconvex ∂Ψ∂F 0 allocs: 0 B 0 allocs: 0 B
Constitutive models/Visco-polyconvex ∂∂Ψ∂FF 0.187 k allocs: 15.2 kB 0.187 k allocs: 15.2 kB 1
Simulations/StaticMechanicalDirichlet 1.51 M allocs: 0.108 GB 1.51 M allocs: 0.108 GB 1
Simulations/StaticMechanicalNeumann 1.48 M allocs: 0.0927 GB 1.48 M allocs: 0.0927 GB 1
Simulations/ViscoElastic 0.162 G allocs: 12.8 GB 0.162 G allocs: 12.8 GB 1
Tensor algebra/Cofactor 2 allocs: 0.156 kB 2 allocs: 0.156 kB 1
Tensor algebra/Det(A)Inv(A') 4 allocs: 0.25 kB 4 allocs: 0.25 kB 1
Tensor algebra/IIsym 1 allocs: 0.656 kB 1 allocs: 0.656 kB 1
Tensor algebra/push_forward_C_to_F 1 allocs: 0.656 kB 1 allocs: 0.656 kB 1
Tensor algebra/×ᵢ⁴ 1 allocs: 0.656 kB 1 allocs: 0.656 kB 1
Tensor algebra/δδ_λ_2d 0 allocs: 0 B 0 allocs: 0 B
Tensor algebra/δδ_μ_2d 0 allocs: 0 B 0 allocs: 0 B
time_to_load 0.149 k allocs: 11.1 kB 0.149 k allocs: 11.1 kB 1

@miguelmaso
miguelmaso merged commit 8829184 into main Jul 31, 2026
4 checks passed
@miguelmaso
miguelmaso deleted the fix-L2-proj branch July 31, 2026 10:13
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.

1 participant