Skip to content

Commit

Permalink
Fix indexing of TransientSolution.
Browse files Browse the repository at this point in the history
* Address deprecation warnings: we now should write tsol.u[end] instead of tsol[end]
* At once replace hardcoded relative path "../..." with joinpath(@__DIR__, ...)
  • Loading branch information
j-fu committed Oct 7, 2024
1 parent f8bb802 commit d1f9460
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions examples/Ex104_PSC_Photogeneration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function main(;n = 5,
Plotter = PyPlot, # you can also use other Plotters, if you add them to the example file
plotting = false, verbose = false, test = false,
########################
parameter_file = "../parameter_files/Params_PSC_TiO2_MAPI_spiro.jl", # choose the parameter file
parameter_file = joinpath(@__DIR__,"..","parameter_files","Params_PSC_TiO2_MAPI_spiro.jl"), # choose the parameter file
########################
userdefinedGeneration = false) # you can choose between predefined and user-defined generation profiles

Expand Down Expand Up @@ -363,7 +363,6 @@ function main(;n = 5,
println("Reverse scan protocol")
end
################################################################################

inivalReverse = sol(tend)
solReverse = solve(ctsys, inival = inivalReverse, times=(tend, 2 * tend), control = control)

Expand All @@ -387,8 +386,8 @@ function main(;n = 5,

for istep = 2:number_tsteps
Δt = tvalues[istep] - tvalues[istep-1] # Time step size
inival = sol[istep-1]
solution = sol[istep]
inival = sol.u[istep-1]
solution = sol.u[istep]

I = integrate(ctsys, tf, solution, inival, Δt)

Expand All @@ -408,8 +407,8 @@ function main(;n = 5,

for istep = 2:number_tstepsReverse
Δt = tvaluesReverse[istep] - tvaluesReverse[istep-1] # Time step size
inival = solReverse[istep-1]
solution = solReverse[istep]
inival = solReverse.u[istep-1]
solution = solReverse.u[istep]

I = integrate(ctsys, tf, solution, inival, Δt)

Expand Down
6 changes: 3 additions & 3 deletions examples/Ex107_MoS2_withIons_BarrierLowering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ function main(;Plotter = PyPlot, plotting = false, verbose = false, test = false
push!(IV, 0.0)
for istep = 2:number_tsteps
Δt = tvalues[istep] - tvalues[istep-1] # Time step size
inival = sol[istep-1]
solution = sol[istep]
inival = sol.u[istep-1]
solution = sol.u[istep]

I = integrate(ctsys, tf, solution, inival, Δt)

Expand Down Expand Up @@ -330,4 +330,4 @@ function test()
end


end # module
end # module

0 comments on commit d1f9460

Please sign in to comment.