Skip to content
Snippets Groups Projects
Commit 25b9abef authored by martamestroni's avatar martamestroni
Browse files

Now steepest gradient computed with central difference.

parent 453000f2
No related branches found
No related tags found
No related merge requests found
......@@ -223,10 +223,14 @@ function solve_D(geometry,IC,AG,B,P,D_i,D_o,Δx,Δt,L,R,BP,x0,T,perc,BE,tE)
#function m computes the steepest gradient
if (D_o/Δxo)>(D_i/Δxi)
Δxm=Δxi
m =(u,Δxm) -> abs(u[Nb-1]-u[Nb-2])/Δxm
m =(u,Δxm) -> abs(u[Nb-1]-u[Nb-3])/(2*Δxm)
#sets the index of the point with steepest derivative
Id=Nb-2
else
Δxm=Δxo
m =(u,Δxm) -> abs(u[Nb+3]-u[Nb+2])/Δxm
m =(u,Δxm) -> abs(u[Nb+4]-u[Nb+2])/(2*Δxm)
#sets the index of the point with steepest derivative
Id=Nb+3
end
m_mat=zeros(Nt)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment