@@ -16,7 +16,11 @@ iter_mandel = ( ([2,3,4,5,6,7,8,9],[2,3,4,5,6]),
1616 ared = rand (TT{2 ,_getdim (stress_state)})
1717 afull = MMB. expand_tensordim (stress_state, ared)
1818 @test _getdim (afull) == 3 # Full dimensional tensor
19- @test norm (ared) ≈ norm (afull) # Only add zeros
19+ if TT == SymmetricTensor
20+ @test norm (ared) ≈ norm (afull) # Only add zeros
21+ else # Add ones to diagonal
22+ @test sqrt (norm (ared)^ 2 + (3 - _getdim (ared))) ≈ norm (afull)
23+ end
2024 # Test invertability of conversions
2125 @test ared ≈ MMB. reduce_tensordim (stress_state, afull)
2226 end
137141 @test ϵfull_w == ϵfull
138142end
139143
144+ @testset " hyperelastic" begin
145+ G = 80.e3 # Shear modulus (μ)
146+ K = 160.e3 # Bulk modulus
147+ E = 9 * K* G/ (3 * K+ G) # Young's modulus
148+ ν = E/ 2 G - 1 # Poisson's ratio
149+ λ = K - 2 G/ 3 # Lame parameter
150+
151+ Δϵ = 1e-6 # Small strain to compare with linear case
152+ rtol = 1e-5 # Relative tolerance to compare with linear case
153+ @testset for m in (StVenant (;G, K), NeoHooke (;G, K))
154+ old = initial_material_state (m)
155+ # UniaxialStress
156+ P, dPdF, state, Ffull = material_response (UniaxialStress (), m, Tensor {2,1} ((1 + Δϵ,)), old, 0.0 )
157+ @test isapprox (P[1 ,1 ], E* Δϵ; rtol)
158+ @test isapprox (dPdF[1 ,1 ,1 ,1 ], E; rtol)
159+ @test Ffull[2 ,2 ] ≈ Ffull[3 ,3 ]
160+ @test Ffull[2 ,2 ] ≈ 1 - ν* Δϵ
161+
162+ # UniaxialStrain
163+ P, dPdF, state, Ffull = material_response (UniaxialStrain (), m, Tensor {2,1} ((1 + Δϵ,)), old, 0.0 )
164+ @test isapprox (P[1 ,1 ], (2 G+ λ)* Δϵ; rtol)
165+ @test isapprox (dPdF[1 ,1 ,1 ,1 ], (2 G+ λ); rtol)
166+ P_full, dPdF_full, _ = material_response (m, Ffull, old, 0.0 )
167+ @test isapprox (P_full[2 ,2 ], λ* Δϵ; rtol)
168+
169+ # PlaneStress
170+ ϵ = Δϵ * rand (SymmetricTensor{2 ,2 })
171+ F = one (Tensor{2 ,2 }) + ϵ
172+ P, dPdF, state, Ffull = material_response (PlaneStress (), m, F, old, 0.0 )
173+ Dvoigt = (E/ (1 - ν^ 2 ))* [1 ν 0 ; ν 1 0 ; 0 0 (1 - ν)/ 2 ]
174+ @test isapprox (tovoigt (symmetric (dPdF)), Dvoigt; rtol)
175+ @test isapprox (P, fromvoigt (SymmetricTensor{4 ,2 }, Dvoigt)⊡ ϵ; rtol)
176+ end
177+ end
178+
140179@testset " visco_elastic" begin
141180 # Test a nonlinear, state and rate dependent, material by running stress iterations.
142181 # Check that state variables and time dependence are handled correctly
0 commit comments