Skip to content

Commit

Permalink
Updated dependancies
Browse files Browse the repository at this point in the history
  • Loading branch information
MatFi committed Jul 18, 2023
1 parent b7e3db7 commit 7ee2ae3
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 43 deletions.
25 changes: 13 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
NumericalIntegration = "e7bfaba1-d571-5449-8927-abc22e82249b"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Expand All @@ -24,18 +25,18 @@ SparseMatricesCSR = "a0a7dd2c-ebf4-11e9-1f05-cf50bc540ca1"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
DataFrames = "0.22, 1.0"
DataStructures = "0.15, 0.16.1, 0.17, 0.18"
DataFrames = "0.22, 1.0,0"
DataStructures = "0.15, 0.16.1, 0.17, 0.18,0"
DiffEqBase = "6"
DiffEqCallbacks = "2.16, 2.17"
DoubleFloats = "1.1"
ForwardDiff = "0.10"
Interpolations = "0.13"
DiffEqCallbacks = "2"
DoubleFloats = "1"
ForwardDiff = "0"
Interpolations = "0"
LoopVectorization = "0.12"
NumericalIntegration = "0.3.2"
OrdinaryDiffEq = "5"
Roots = "1"
Setfield = "0.5, 0.6, 0.7, 0.8"
SparseDiffTools = "1"
Unitful = "1.7"
julia = "1.5, 1.6"
OrdinaryDiffEq = "5, 6"
Roots = "1, 2"
Setfield = "0,1"
SparseDiffTools = "1,2"
Unitful = "1"
julia = "1.5, 1.6 ,1.7, 1.8, 1.9"
3 changes: 2 additions & 1 deletion src/AnnA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using SparseDiffTools: matrix_colors, forwarddiff_color_jacobian!
using Unitful
using Unitful.DefaultSymbols
using LoopVectorization
import PreallocationTools
import Base:length, getproperty, setproperty!, propertynames

using SparseMatricesCSR
Expand Down Expand Up @@ -46,7 +47,7 @@ Creates a new `Parameters` object. A list of modifications to the defaults can b
!!! note "Parameters.jl file"
The `Parameters.jl` file does not have do contain the full specifications of all parameters., it will fallback to the `AbstractParameters` struct when specified or to the internal defaults if not.
The `Parameters.jl` fil]e does not have do contain the full specifications of all parameters., it will fallback to the `AbstractParameters` struct when specified or to the internal defaults if not.
"""
function load_parameters(
Expand Down
2 changes: 1 addition & 1 deletion src/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Base.@kwdef mutable struct AlgControl
tend = 1e5u"s"
initializealg = OrdinaryDiffEq.NoInit()
numtype = Float64
linsolve=OrdinaryDiffEq.DefaultLinSolve()
linsolve = nothing #OrdinaryDiffEq.DefaultLinSolve()
kwargs = (; :reltol => reltol,
:abstol => abstol,
:dtmin => dtmin,
Expand Down
58 changes: 29 additions & 29 deletions src/routines/rhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Rhs(parameters, g::Grid, ndim::NodimParameters, op::Operators, mode::Sy


if numtype <: Union{Float64}
cache = (u, n) -> DiffEqBase.dualcache(u, n)
cache = (u, n) -> PreallocationTools.dualcache(u, n)
else
cache = (u, n) -> lcache(length(u))
end
Expand Down Expand Up @@ -116,10 +116,10 @@ function (rhs!::Rhs)(du, u, pr, t)
Nₑ = rhs!.g.Nₑ
Nₕ = rhs!.g.Nₕ

P = DiffEqBase.get_tmp(rhs!.P, u)
ϕ = DiffEqBase.get_tmp(rhs!.ϕ, u)
n = DiffEqBase.get_tmp(rhs!.n, u)
p = DiffEqBase.get_tmp(rhs!.p, u)
P = PreallocationTools.get_tmp(rhs!.P, u)
ϕ = PreallocationTools.get_tmp(rhs!.ϕ, u)
n = PreallocationTools.get_tmp(rhs!.n, u)
p = PreallocationTools.get_tmp(rhs!.p, u)

@avx warn_check_args=false for i in 1:N + 1
P[i] = u[i]
Expand All @@ -128,8 +128,8 @@ function (rhs!::Rhs)(du, u, pr, t)
p[i] = u[3 * N + 3 + i]
end

ϕₑ = DiffEqBase.get_tmp(rhs!.ϕₑ, u)
nₑ = DiffEqBase.get_tmp(rhs!.nₑ, u)
ϕₑ = PreallocationTools.get_tmp(rhs!.ϕₑ, u)
nₑ = PreallocationTools.get_tmp(rhs!.nₑ, u)

@avx warn_check_args=false for i in 1:rhs!.g.Nₑ
ϕₑ[i] = u[4 * N + 4 + i]
Expand All @@ -138,8 +138,8 @@ function (rhs!::Rhs)(du, u, pr, t)
ϕₑ[Nₑ + 1] = ϕ[1]
nₑ[Nₑ + 1] = n[1] / rhs!.ndim.kₑ

ϕₕ = DiffEqBase.get_tmp(rhs!.ϕₕ, u)
pₕ = DiffEqBase.get_tmp(rhs!.pₕ, u)
ϕₕ = PreallocationTools.get_tmp(rhs!.ϕₕ, u)
pₕ = PreallocationTools.get_tmp(rhs!.pₕ, u)
ϕₕ[1] = ϕ[N + 1]
pₕ[1] = p[N + 1] / rhs!.ndim.kₕ
# @inbounds @simd
Expand All @@ -148,68 +148,68 @@ function (rhs!::Rhs)(du, u, pr, t)
pₕ[i + 1] = u[4 * N + 2 * Nₑ + Nₕ + 4 + i]
end

mE = DiffEqBase.get_tmp(rhs!.mE, u)
mE = PreallocationTools.get_tmp(rhs!.mE, u)
mul!(mE, rhs!.o.𝔇, ϕ)
mEₑ = DiffEqBase.get_tmp(rhs!.mEₑ, u)
mEₑ = PreallocationTools.get_tmp(rhs!.mEₑ, u)
mul!(mEₑ, rhs!.o.𝔇ₑ, ϕₑ)
mEₕ = DiffEqBase.get_tmp(rhs!.mEₕ, u)
mEₕ = PreallocationTools.get_tmp(rhs!.mEₕ, u)
mul!(mEₕ, rhs!.o.𝔇ₕ, ϕₕ)

Buff_N = DiffEqBase.get_tmp(rhs!.Buff_N, u)
Buff_Nₑ = DiffEqBase.get_tmp(rhs!.Buff_Nₑ, u)
Buff_Nₕ = DiffEqBase.get_tmp(rhs!.Buff_Nₕ, u)
Buff_N = PreallocationTools.get_tmp(rhs!.Buff_N, u)
Buff_Nₑ = PreallocationTools.get_tmp(rhs!.Buff_Nₑ, u)
Buff_Nₕ = PreallocationTools.get_tmp(rhs!.Buff_Nₕ, u)

if rhs!.parameters.freeze_ions
FP = DiffEqBase.get_tmp(rhs!.FP, u) .* 0
FP = PreallocationTools.get_tmp(rhs!.FP, u) .* 0
else
FP = DiffEqBase.get_tmp(rhs!.FP, u)
FP = PreallocationTools.get_tmp(rhs!.FP, u)
mul!(FP, rhs!.o.𝕴, P); FP .= FP .* mE;
mul!(Buff_N, rhs!.o.𝔇, P)
FP .= λ .* (Buff_N .+ FP)
end

fn = DiffEqBase.get_tmp(rhs!.fn, u)
fn = PreallocationTools.get_tmp(rhs!.fn, u)
mul!(fn, rhs!.o.𝕴, n); fn .= fn .* mE;
mul!(Buff_N, rhs!.o.𝔇, n)
fn .= κₙ .* (Buff_N .- fn)

fp = DiffEqBase.get_tmp(rhs!.fp, u)
fp = PreallocationTools.get_tmp(rhs!.fp, u)
mul!(fp, rhs!.o.𝕴, p); fp .= fp .* mE;
mul!(Buff_N, rhs!.o.𝔇, p)
fp .= κₚ .* (Buff_N .+ fp)

fnₑ = DiffEqBase.get_tmp(rhs!.fnₑ, u)
fnₑ = PreallocationTools.get_tmp(rhs!.fnₑ, u)
mul!(fnₑ, rhs!.o.𝕴ₑ, nₑ); fnₑ .= fnₑ .* mEₑ;
mul!(Buff_Nₑ, rhs!.o.𝔇ₑ, nₑ)
fnₑ .= κₑ .* (Buff_Nₑ .- fnₑ)

fpₕ = DiffEqBase.get_tmp(rhs!.fpₕ, pₕ)
fpₕ = PreallocationTools.get_tmp(rhs!.fpₕ, pₕ)
mul!(fpₕ, rhs!.o.𝕴ₕ, pₕ); fpₕ .= fpₕ .* mEₕ;
mul!(Buff_Nₕ, rhs!.o.𝔇ₕ, pₕ)
fpₕ .= κₕ .* (Buff_Nₕ .+ fpₕ)

cd = DiffEqBase.get_tmp(rhs!.cd, u)
cd = PreallocationTools.get_tmp(rhs!.cd, u)

cd_buff = DiffEqBase.get_tmp(rhs!.Buff_N₋₁, u)
cd_buff = PreallocationTools.get_tmp(rhs!.Buff_N₋₁, u)
mul!(cd_buff, rhs!.o.𝔏, P)
cd .= rhs!.g.NN .- cd_buff .- ϰ
mul!(cd_buff, rhs!.o.𝔏, n)
cd .= cd .+ δ .* cd_buff
mul!(cd_buff, rhs!.o.𝔏, p)
cd .= cd .- δ .* χ .* cd_buff

cdₑ = DiffEqBase.get_tmp(rhs!.cdₑ, u)
cdₑ = PreallocationTools.get_tmp(rhs!.cdₑ, u)
mul!(cdₑ, rhs!.o.𝔏ₑ, nₑ)
cdₑ .= cdₑ .- rhs!.g.ddE

cdₕ = DiffEqBase.get_tmp(rhs!.cdₕ, u)
cdₕ = PreallocationTools.get_tmp(rhs!.cdₕ, u)
mul!(cdₕ, rhs!.o.𝔏ₕ, pₕ)
cdₕ .= rhs!.g.ddH .- cdₕ

if t isa ForwardDiff.Dual
GR = DiffEqBase.get_tmp(rhs!.GRt, t)
GR = PreallocationTools.get_tmp(rhs!.GRt, t)
else
GR = DiffEqBase.get_tmp(rhs!.GRu, u)
GR = PreallocationTools.get_tmp(rhs!.GRu, u)
end
mul!(Buff_N, rhs!.o.𝕴, n) # Buff_N now contains the interpolatet n
mul!(GR, rhs!.o.𝕴, p) # GR contains interpolated p
Expand Down Expand Up @@ -299,13 +299,13 @@ end

lcache(n::Int) = LCache(Dict{DataType,AbstractArray}(), n)

function DiffEqBase.get_tmp(lc::LCache, u::T)::T where {T <: AbstractArray}
function PreallocationTools.get_tmp(lc::LCache, u::T)::T where {T <: AbstractArray}
ltype = eltype(u)
!(haskey(lc.du, ltype)) && (lc.du[ltype] = u[1:lc.length])
return lc.du[ltype]
end

function DiffEqBase.get_tmp(lc::LCache, u::T)::Array{T,1} where {T <: Number}
function PreallocationTools.get_tmp(lc::LCache, u::T)::Array{T,1} where {T <: Number}

!(haskey(lc.du, T)) && (lc.du[T] = Array{T,1}(undef, lc.length))
return lc.du[T]
Expand Down

0 comments on commit 7ee2ae3

Please sign in to comment.