DENG-MIT / ArrheniusActiveSubspace

Use Arrhenius.jl to compute active subspace
MIT License
3 stars 2 forks source link

Test Sensitivity Method #1

Open jiweiqi opened 3 years ago

jiweiqi commented 3 years ago

'h2o2 brute force' p_diff = 5e-4 image

p_diff = 5e-3 image

p_diff = 5e-2 image

p_diff = 5e-1 image

jiweiqi commented 3 years ago

'sens_BVP'

image

mthread=10 image

jiweiqi commented 3 years ago

thread = 18 on Linux

![eigs](https://user-images.githubusercontent.com/8445647/112236163-45042200-8c16-11eb-8a85-93531cf0a9a9.png)
jiweiqi commented 3 years ago

Debuging code

for i = 2:ng
        u = @view(pred[:, i])
        du = similar(u)
        i_F = 1 + (i - 1) * nu:i * nu - 1
        @view(Fp[i_F, :]) .= jacobian((du, x) -> dudt!(du, u, x, 0.0),
                                        du, p)::Array{Float64,2} .* (-idt)
        @view(Fy[i_F, i_F]) .= jacobian((du, x) -> dudt!(du, x, p, 0.0),
                                        du, u)::Array{Float64,2} .* (-idt)
    end
    @show sum(Fp) sum(Fy)
    @show sum(Fy[end-nu:end, end-nu:end])
    @show sum(Fy[end-20*nu:end, end-20*nu:end])

    @threads for i = 2:ng
        u = @view(pred[:, i])
        du = similar(u)
        i_F = 1 + (i - 1) * nu:i * nu - 1
        Fp[i_F, :] .= jacobian((du, x) -> dudt!(du, u, x, 0.0),
                                    du, p)::Array{Float64,2} .* (-idt)
    end
    @threads for i = 2:ng
        u = @view(pred[:, i])
        du = similar(u)
        i_F = 1 + (i - 1) * nu:i * nu - 1
        Fy[i_F, i_F] .= jacobian((du, x) -> dudt!(du, x, p, 0.0),
                                    du, u)::Array{Float64,2} .* (-idt)
    end
    @show sum(Fp) sum(Fy)
    @show sum(Fy[end-nu:end, end-nu:end])
    @show sum(Fy[end-20*nu:end, end-20*nu:end])