Skip to content

Commit

Permalink
make it run again in Julia 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
MatFi committed Jul 17, 2023
1 parent 6c7b215 commit b7e3db7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Base.@kwdef mutable struct Parameters <: AbstractParameters
Dₕ = 1e-7u"m^2/s" # HTL electron diffusion coefficient
end

propertynames(p::AbstractParameters,private::Bool=true) = begin
propertynames(p::AbstractParameters,private::Bool=false) = begin
pubs = fieldnames(typeof(p))
privs = (:gc, :gv, :gcₑ, :gvₕ, :εₚ, :εₕ, :εₑ, :Eg, :Dᵢ, :nᵢ, :Efₑ, :Efₕ, :Vbi, :VT, :τᵢ, :G₀, :jay, :n0, :p0)
private && return (pubs..., privs...)
Expand Down
4 changes: 2 additions & 2 deletions src/routines/initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ function initial_conditions(c::Cell)
# initializealg=BrownFullBasicInit(),
)

if sol.retcode ==:Success
if !(SciMLBase.successful_retcode(sol))
@warn "Initialisation did not reach steady state within ss_tol"
elseif sol.retcode !=:Terminated
#elseif sol.retcode != ReturnCode.Terminated
@warn "Initialisation failed"
#@show "Initialized V_oc =" get_V(c,sol)[end] sol.t[end]*c.parameters.τᵢ
end
Expand Down
6 changes: 3 additions & 3 deletions src/routines/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function DiffOperator(dx)
end

function LinearAlgebra.mul!(dfdx,dx::DiffOperator,f)
@avx for i in 1:dx.size[1]
@avx warn_check_args=false for i in 1:dx.size[1]
dfdx[i] = f[i+1]*dx.dx[i,2]+f[i]*dx.dx[i,1]
end
nothing
Expand All @@ -104,7 +104,7 @@ function LinearAlgebra.mul!(interp,o::InterpolationOperator,f)
# if o.size[2] != length(f)
# error("length of operator is $(o.size[2]), while length(f) is $(length(f)) ")
# end
@avx for i in 1:o.size[1]
@avx warn_check_args=false for i in 1:o.size[1]
interp[i] = (f[i+1]+f[i])/2.0
end
nothing
Expand Down Expand Up @@ -132,7 +132,7 @@ function LinearAlgebra.mul!(lin,o::LinOperator,f)
# if o.size[2] != length(f)
# error("length of operator is $(o.size[2]), while length(f) is $(length(f)) ")
# end
@avx for i in 1:o.size[1]
@avx warn_check_args=false for i in 1:o.size[1]
lin[i] = f[i]*o.dx[i,1]+f[i+1]*o.dx[i,2]+f[i+2]*o.dx[i,3]
end
nothing
Expand Down
13 changes: 7 additions & 6 deletions src/routines/rhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ function (rhs!::Rhs)(du, u, pr, t)
ϕ = DiffEqBase.get_tmp(rhs!.ϕ, u)
n = DiffEqBase.get_tmp(rhs!.n, u)
p = DiffEqBase.get_tmp(rhs!.p, u)
@avx for i in 1:N + 1

@avx warn_check_args=false for i in 1:N + 1
P[i] = u[i]
ϕ[i] = u[N + 1 + i]
n[i] = u[2 * N + 2 + i]
Expand All @@ -130,7 +131,7 @@ function (rhs!::Rhs)(du, u, pr, t)
ϕₑ = DiffEqBase.get_tmp(rhs!.ϕₑ, u)
nₑ = DiffEqBase.get_tmp(rhs!.nₑ, u)

@avx for i in 1:rhs!.g.Nₑ
@avx warn_check_args=false for i in 1:rhs!.g.Nₑ
ϕₑ[i] = u[4 * N + 4 + i]
nₑ[i] = u[4 * N + Nₑ + 4 + i]
end
Expand All @@ -142,7 +143,7 @@ function (rhs!::Rhs)(du, u, pr, t)
ϕₕ[1] = ϕ[N + 1]
pₕ[1] = p[N + 1] / rhs!.ndim.kₕ
# @inbounds @simd
@avx for i in 1:rhs!.g.Nₕ
@avx warn_check_args=false for i in 1:rhs!.g.Nₕ
ϕₕ[i + 1] = u[4 * N + 2 * Nₑ + 4 + i]
pₕ[i + 1] = u[4 * N + 2 * Nₑ + Nₕ + 4 + i]
end
Expand Down Expand Up @@ -224,7 +225,7 @@ function (rhs!::Rhs)(du, u, pr, t)
# temporarely in the return du vector
GR .= muladd(rhs!.G, l, -GR)

@avx for i in 1:N - 1
@avx warn_check_args=false for i in 1:N - 1
du[N + 2 + i] = mE[i + 1] - mE[i] - cd[i] / λ²;
end
@inbounds for i in 1:N - 1
Expand Down Expand Up @@ -259,14 +260,14 @@ function (rhs!::Rhs)(du, u, pr, t)
### ETM ###
du[4 * N + 5] = ϕₑ[1]# -rhs!.ndim.V(t);
du[4 * N + Nₑ + 5] = nₑ[1] - 1;
@avx for i in 1:Nₑ - 1
@avx warn_check_args=false for i in 1:Nₑ - 1
du[4 * N + 5 + i] = mEₑ[i + 1] - mEₑ[i] - cdₑ[i] / λₑ²;
du[4 * N + Nₑ + 5 + i] = fnₑ[i + 1] - fnₑ[i]
end
### HTM ###
# du[4*N+2*Nₑ+Nₕ+4] = ϕₕ[end] + rhs!.ndim.Vbi - rhs!.ndim.V(t);
du[4 * N + 2 * Nₑ + 2 * Nₕ + 4] = pₕ[end] - 1;
@avx for i in 1:Nₕ - 1
@avx warn_check_args=false for i in 1:Nₕ - 1
du[4 * N + 2 * Nₑ + 4 + i] = mEₕ[i + 1] - mEₕ[i] - cdₕ[i] / λₕ²;
du[4 * N + 2 * Nₑ + Nₕ + 4 + i] = fpₕ[i + 1] - fpₕ[i];
end
Expand Down

0 comments on commit b7e3db7

Please sign in to comment.