Skip to content

Commit

Permalink
Merge branch 'patch-2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jul 1, 2019
2 parents 860bf69 + 2913a1e commit c6a5566
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ode/filament_prob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function (f::FilamentCache)(dr, r, p, t)
mul!(S1, A, r)
S1 .+= F
mul!(S2, P, S1)
copy!(dr, S2)
copyto!(dr, S2)
return dr
end

Expand All @@ -183,10 +183,10 @@ end
function projection!(f::FilamentCache)
# implement P[:] = I - J'/(J*J')*J in an optimized way to avoid temporaries
J, P, J_JT, J_JT_LDLT, P0 = f.P.J, f.P.P, f.P.J_JT, f.P.J_JT_LDLT, f.P.P0
A_mul_Bt!(J_JT, J, J)
mul!(J_JT, J, J')
LDLt_inplace!(J_JT_LDLT, J_JT)
A_ldiv_B!(P0, J_JT_LDLT, J)
At_mul_B!(P, P0, J)
ldiv!(P0, J_JT_LDLT, J)
mul!(P', P0, J)
subtract_from_identity!(P)
nothing
end
Expand Down
12 changes: 12 additions & 0 deletions src/ode/nonlinchem.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function nonLinChem(dy,y,p,t)
dy[1] = -y[1]
dy[2] = y[1]-(y[2])^2
dy[3] = (y[2])^2
end
y0 = [1.0;0.0;0.0]
tspan = (0.0,20)
nlc_analytic(u0,p,t) = [exp(-t);
(2sqrt(exp(-t))besselk(1,2sqrt(exp(-t)))-2besselk(1,2)/besseli(1,2)*sqrt(exp(-t))besseli(1,2sqrt(exp(-t))))/(2besselk(0,2sqrt(exp(-t)))+(2besselk(1,2)/besseli(1,2))besseli(0,2sqrt(exp(-t))));
-exp(-t)+1+(-2sqrt(exp(-t))*besselk(1,2sqrt(exp(-t)))+sqrt(exp(-t))*besseli(1,2sqrt(exp(-t)))*2besselk(1,2)/besseli(1,2))/(2besselk(0,2sqrt(exp(-t)))+2besselk(1,2)/besseli(1,2)*besseli(0,2sqrt(exp(-t))))]
nonLinChem_f = ODEFunction(nonLinChem,analytic = nlc_analytic)
prob_ode_nonlinchem = ODEProblem(nonLinChem,y0,tspan)
2 changes: 2 additions & 0 deletions src/ode/ode_premade_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ export prob_ode_linear, prob_ode_bigfloatlinear, prob_ode_2Dlinear,
prob_ode_lorenz, prob_ode_rober, prob_ode_threebody, prob_ode_mm_linear, prob_ode_pleiades,
prob_ode_brusselator_1d, prob_ode_brusselator_2d, prob_ode_orego,
prob_ode_hires, prob_ode_pollution, prob_ode_filament,
prob_ode_nonlinchem,
SolverDiffEq, filament_prob

include("ode_linear_prob.jl")
include("ode_simple_nonlinear_prob.jl")
include("brusselator_prob.jl")
include("pollution_prob.jl")
include("filament_prob.jl")
include("nonlinchem.jl")

0 comments on commit c6a5566

Please sign in to comment.