How can I stop matlab pde solver in pde tool box when solution is unstable?
Show older comments
I am solving two coupled time dependent PDE eqations using pde tool box.The simulation box size is x=6 and y=10.Currently I solve it properly and acces the solution data using results = solvepde(model,tlist); u = results.NodalSolution(:,1,:);
What I need to do is now to stop the code when the solution u is unstable along the y axis.That means I want to monitor solution of u along y axis while running the code and stop it when it meets a criteria that I want.(For example I want to stop the code when solution of u along y equals to 0)..How can I do it using pde tool box?
Here is what I tried so far.Is there easy way to access the results while code is running?.That is I want to access the solution for each time step.
%calculate solutions
n=4000;
tlist = linspace(0,200,n);
partial=zeros(49,1);
for i=1:n
results = solvepde(model,tlist(i:i+1));
u = results.NodalSolution(:,1,1);
v=results.NodalSolution(:,2,1);
u1=results.NodalSolution(113:161,1,1);
u2=results.NodalSolution(1,1,1);
u3=results.NodalSolution(4,1,1);
for j=1:49
partial(j)=u1(j)-0.5*u2-0.5*u3;
end
sigma=sum(partial);
if sigma>1e-4
disp('verified')
return
end
end
Answers (0)
Categories
Find more on Boundary Conditions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!