diff --git a/src/solvers_modal.jl b/src/solvers_modal.jl index 849fa08..b1f80da 100644 --- a/src/solvers_modal.jl +++ b/src/solvers_modal.jl @@ -236,26 +236,30 @@ function (solver::Solver{Modal})(; show_info=true, debug=false, end dim = size(K, 1) - tic() nboundary_problems = length(get_boundary_problems(solver)) K_red = K M_red = M + if !(P == nothing) - info("using custom P") + tic() + info("Using custom P to make transform K_red = P'*K*P and M_red = P'*M*P") K_red = P'*K_red*P M_red = P'*M_red*P - else + t1 = round(toq(), 2) + info("Transform ready in $t1 seconds.") + elseif nboundary_problems != 0 info("Eliminate boundary conditions from system.") for boundary_problem in get_boundary_problems(solver) eliminate_boundary_conditions!(K_red, M_red, boundary_problem, dim) end + t1 = round(toq(), 2) + info("Eliminated boundary conditions in $t1 seconds.") + else + info("No boundary Dirichlet boundary conditions found for system.") end - t1 = round(toq(), 2) - info("Eliminated boundary conditions in $t1 seconds.") - # free up some memory before solution if empty_assemblies_before_solution for problem in get_field_problems(solver) diff --git a/test/test_modal_analysis_zero_eigenmodes.jl b/test/test_modal_analysis_zero_eigenmodes.jl new file mode 100644 index 0000000..d987b3a --- /dev/null +++ b/test/test_modal_analysis_zero_eigenmodes.jl @@ -0,0 +1,25 @@ +# This file is a part of JuliaFEM. +# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md + +using JuliaFEM +using JuliaFEM.Preprocess +using JuliaFEM.Postprocess +using JuliaFEM.Testing + +@testset "zero eigenmode model" begin + meshfile = Pkg.dir("JuliaFEM") * "/test/testdata/primitives.med" + mesh = aster_read_mesh(meshfile, "TETRA_TET10_1") + model = Problem(mesh, Elasticity, "TET", 3) + update!(model.elements, "youngs modulus", 10.0) + update!(model.elements, "poissons ratio", 1.0/3.0) + update!(model.elements, "density", 10.0) + solver = Solver(Modal) + solver.properties.nev = 30 + push!(solver, model) + solver() + freqs = solver.properties.eigvals + info("freqs: $freqs") + freqs_expected = [0.0,0.0,0.0,0.0,0.0,0.0,5.05743,5.05743,7.30374,9.55885,9.55885,18.3471,18.3471,19.124,37.008,37.008,47.25,59.8844,63.0,65.3975,65.3975,88.1879,108.854,108.854,131.702,131.702,221.374,301.326,301.326] + @test isapprox(freqs, freqs_expected; atol=1.0e-3) +end +