@@ -232,39 +232,33 @@ end
232232end
233233
234234
235- @testset " ViscousPolyconvex_Base " begin
235+ @testset " ViscousPolyconvex " begin
236236 model = ViscousPolyconvex (τ= 1.15 , μ= 7e4 )
237+ Fn = I3
237238 F1 = I3 + 0.1 * TensorValue (rand (9 )... )
238239 C1 = F1' · F1
239240 Cv = I3
240241
242+ # --- Test neo-Hookean model ---
241243 Ψv = HyperFEM. PhysicalModels. Ψv
242244 Sv = HyperFEM. PhysicalModels. Sv
243245 ∂Sv∂C_Cᵥfix = HyperFEM. PhysicalModels.∂Sv∂C_Cᵥfix
244246
245247 Sv_ref = 2 * TensorValue (ForwardDiff. gradient (C -> Ψv (model, TensorValue (C), Cv), get_array (C1)))
246248 ∂Sv_ref = 2 * TensorValue (ForwardDiff. hessian (C -> Ψv (model, TensorValue (C), Cv), get_array (C1)))
247249
248- @test isapprox (Sv (model, C1, Cv), Sv_ref, rtol= 1e-8 ) # Pass
249- @test isapprox (∂Sv∂C_Cᵥfix (model, C1, Cv), ∂Sv_ref, rtol= 1e-8 ) # Pass
250- end
250+ @test isapprox (Sv (model, C1, Cv), Sv_ref, rtol= 1e-8 )
251+ @test isapprox (∂Sv∂C_Cᵥfix (model, C1, Cv), ∂Sv_ref, rtol= 1e-8 )
251252
253+ # --- Test return mapping ---
254+ return_mapping = HyperFEM. PhysicalModels. return_mapping
255+ ∂invCv∂C = HyperFEM. PhysicalModels.∂invCv∂C
252256
253- @testset " ViscousPolyconvex" begin
254- long_term = NeoHookean3D (λ= 1e7 , μ= 8e4 )
255- branch_1 = ViscousPolyconvex (τ= 1.15 , μ= 7e4 )
256- model = GeneralizedMaxwell (long_term, branch_1)
257- update_time_step! (model, 0.01 )
258- Ψ, ∂Ψ∂F, ∂∂Ψ∂FF = model ()
259- Fn = I3
260- A = I3
261- F1 = I3 + 0.1 * TensorValue (rand (9 )... )
257+ ∂invCv_ref = TensorValue (ForwardDiff. jacobian (C -> get_array (return_mapping (model, TensorValue (C), C1, Cv)), get_array (C1)))
258+ @test isapprox (∂invCv∂C (model, C1, C1, Cv), ∂invCv_ref, rtol= 1e-8 )
262259
263- # ∂Ψ∂F_ref = TensorValue(ForwardDiff.gradient(F -> Ψ(TensorValue(F), Fn, A), get_array(F1)))
264- # ∂∂Ψ∂FF_ref = TensorValue(ForwardDiff.hessian(F -> Ψ(TensorValue(F), Fn, A), get_array(F1)))
265- ∂∂Ψ∂FF_ref = TensorValue (ForwardDiff. jacobian (F -> get_array (∂Ψ∂F (TensorValue (F), Fn, A)), get_array (F1)))
266-
267- @test isapprox (∂∂Ψ∂FF (F1, Fn, A), ∂∂Ψ∂FF_ref, rtol= 1e-8 )
268- # @test isapprox(∂Ψ∂F(F1, Fn, A), ∂Ψ∂F_ref, rtol=1e-8) # Fail!!!
269- # @test isapprox(∂∂Ψ∂FF(F1, Fn, A), ∂∂Ψ∂FF_ref, rtol=1e-8)
260+ # --- Test full model tangent operator ---
261+ Ψ, ∂Ψ∂F, ∂∂Ψ∂FF = model ()
262+ ∂∂Ψ∂FF_ref = TensorValue (ForwardDiff. jacobian (F -> get_array (∂Ψ∂F (TensorValue (F), Fn, Cv)), get_array (F1)))
263+ @test isapprox (∂∂Ψ∂FF (F1, Fn, Cv), ∂∂Ψ∂FF_ref, rtol= 1e-8 )
270264end
0 commit comments