-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using FBDF solver to deal with super-large-sparse-matrix problems #906
Comments
You didn't define the sparse matrix? https://diffeq.sciml.ai/stable/types/ode_types/#SciMLBase.ODEFunction See https://diffeq.sciml.ai/stable/tutorials/advanced_ode_example/ |
@ChrisRackauckas , thanks for the advice. using SparseArrays
using OrdinaryDiffEq
function func!(dρ, ρ, L, t)
@inbounds dρ .= L * ρ
end
ρ::Vector{ComplexF64} # a vector with size: 9,523,200.
L::SparseMatrixCSC{ComplexF64, Int64} # a large sparse matrix with size: 9,523,200 × 9,523,200 and 92,553,046 stored entries.
tlist = 0:1:1000
# setup ode function and solver
dim, = size(L)
ode = ODEFunction(func!; jac_prototype = spzeros(ComplexF64, dim, dim))
solver = FBDF(autodiff=false)
# set up integrator
integrator = init(
ODEProblem(ode, ρ, (tlist[1], tlist[end]), L),
solver;
reltol = 1.0e-6,
abstol = 1.0e-8,
maxiters = 1e5,
save_everystep = false
)
dt_list = diff(tlist)
for dt in dt_list
step!(integrator, dt, true)
# Do some other things
# basicly like printing some message in each iteration
# and store the solution to a file at each time step
# since this is a long calculation (spend couple days)
end I also tried to change the solver: Maybe this is not the best solver for me to use in this case. |
Is the ODE stiff? If it's non-stiff, then the explicit methods will just be faster. That would be dependent on the eigenvalues of Note that for linear ODEs, using |
@ChrisRackauckas thanks for the advice again. |
Hi,
I have some issues when solving ODE with super-large (but sparse) matrix
$\frac{d\rho(t)}{dt}=L\rho(t)$ ,$\rho$ is a $L$ is a
The ODE problem I want to solve can be considered as:
where
Vector{ComplexF64}
andSparseMatrixCSC{ComplexF64, Int64}
with size: 9,523,200 × 9,523,200 and 92,553,046 stored entries.Therefore, I tried to solve this problem with solver
FBDF
:And here comes a whole bunch of errors:
I know that I'm working in a very large matrix, but the work station I'm using has totally "3TB" of memory.
The memory should be enough if I'm working under sparse matrix (?)
I've also tried another solver
DP5()
and it works fine (just need to take a couple days to get the solution).In Stacktrace [2], I found the keyword
zeromatrix
.I think, during the solving process,
FBDF
tries to construct a zero matrix which has the same size as my input matrixL
but in standard matrix typeMatrix{ComplexF64}
?If then, is it possible for
FBDF
to contruct the zero matrix in type:SparseMatrixCSC
?The reason I'm using other solvers like
FBDF
is because that I follow the suggestions in the documentation, and try to see if it can speed up the calculations I'm working on.Or does anyone have other suggested solvers for my problem? I have tried
CVODE_BDF
in packageSundials.jl
at the beginning but it doesn't support for complex numbers.The text was updated successfully, but these errors were encountered: