You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
using OrdinaryDiffEq, LinearAlgebra, SparseArrays, SparsityDetection
# Define the constants for the PDEconst α₂ =1.0const α₃ =1.0const β₁ =1.0const β₂ =1.0const β₃ =1.0const r₁ =1.0const r₂ =1.0const _DD =100.0const γ₁ =0.1const γ₂ =0.1const γ₃ =0.1const N =32const X =reshape([i for i in1:N for j in1:N],N,N)
const Y =reshape([j for i in1:N for j in1:N],N,N)
const α₁ =1.0.*(X.>=4*N/5)
const Mx =Tridiagonal([1.0for i in1:N-1],[-2.0for i in1:N],[1.0for i in1:N-1])
const My =copy(Mx)
Mx[2,1] =2.0
Mx[end-1,end] =2.0
My[1,2] =2.0
My[end,end-1] =2.0# Define the discretized PDE as an ODE functionfunctionf(u,p,t)
A =@view u[:,:,1]
B =@view u[:,:,2]
C =@view u[:,:,3]
MyA = My*A
AMx = A*Mx
DA =@. _DD*(MyA + AMx)
dA =@. DA + α₁ - β₁*A - r₁*A*B + r₂*C
dB =@. α₂ - β₂*B - r₁*A*B + r₂*C
dC =@. α₃ - β₃*C + r₁*A*B - r₂*C
cat(dA,dB,dC,dims=3)
end
u0 =zeros(N,N,3)
MyA =zeros(N,N);
AMx =zeros(N,N);
DA =zeros(N,N);
prob =ODEProblem(f,u0,(0.0,10.0))
inp =similar(u0)
out =similar(u0)
functionf2(du,u,p,t)
du .=f(u,p,t)
endjacobian_sparsity(f2,out,inp,SparsityDetection.Fixed(nothing),0.0)
For some reason, this code doesn't work. P.S - The model is badly designed delibrately @shashi@ChrisRackauckas
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
For some reason, this code doesn't work. P.S - The model is badly designed delibrately
@shashi @ChrisRackauckas
The text was updated successfully, but these errors were encountered: