Skip to content

Commit

Permalink
replace pwr
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrKryslUCSD committed Jan 4, 2024
1 parent b5da527 commit 956086b
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions examples/shells/dynamics/plate_with_crack_examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using PlotlyJS
using Gnuplot; #@gp "clear"
using FinEtools.MeshExportModule.VTKWrite: vtkwritecollection
using ThreadedSparseCSR
using UnicodePlots
using GEPHelpers: pwr_largest
# using InteractiveUtils.#
# using BenchmarkTools
using FinEtools.MeshExportModule.VTKWrite: vtkwritecollection, vtkwrite
Expand Down Expand Up @@ -175,22 +175,7 @@ function _execute_parallel_csr(nref = 2, nthr = 0, color = "red")
K_ff = SparseMatricesCSR.sparsecsr(findnz(K_ff)..., size(K_ff)...)

# Solve
function pwr(K, M)
invM = fill(0.0, size(M, 1))
invM .= 1.0 ./ (vec(diag(M)))
v = rand(size(M, 1))
w = fill(0.0, size(M, 1))
for i in 1:30
ThreadedSparseCSR.bmul!(w, K, v)
wn = norm(w)
w .*= (1.0/wn)
v .= invM .* w
vn = norm(v)
v .*= (1.0/vn)
end
sqrt((v' * (K * v)) / (v' * M * v))
end
@time omega_max = pwr(K_ff, M_ff)
@time omega_max = pwr_largest(K_ff, M_ff)
@show omega_max = max(omega_max, 20*2*pi*carrier_frequency)
@show dt = Float64(0.9* 2/omega_max) * (sqrt(1+ksi^2) - ksi)

Expand Down

0 comments on commit 956086b

Please sign in to comment.