Effacer les filtres
Effacer les filtres

Fluctuating and negative value in pdepe

1 vue (au cours des 30 derniers jours)
Rusty
Rusty le 22 Fév 2016
I am trying to solve a coupled pde in MATLAB. The code is :
function pdex5
m = 0;
x = linspace(0,1,100);
t = linspace(0,6,400);
options=odeset('Reltol',1e-10,'Abstol',1e-8);
sol = pdepe(m,@pdex5pde,@pdex5ic,@pdex5bc,x,t,options);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure
plot(x,u1(end,:))
title('Solution at t = 5')
xlabel('Distance x')
ylabel('u1(x,5)')
figure
plot(x,u2(end,:))
title('Solution at t = 5')
xlabel('Distance x')
ylabel('u2(x,5)')
% --------------------------------------------------------------
function [c,f,s] = pdex5pde(x,t,u,DuDx)
De=.00005; strainrate=0.2;
c = [De; 1];
f = [0;(1+(u(1))^1.2)] .* DuDx;
s = [1;0]+flipud([0;-strainrate*u(1)].* DuDx);
% --------------------------------------------------------------
function u0 = pdex5ic(x)
tw=0;
u0 = [tw; 0];
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex5bc(xl,ul,xr,ur,t)
pl = [0; ul(2)];
ql = [1; 0];
pr = [0;ur(2)-1];
qr = [1; 0];
Here I am getting some negative values of u1. And the values are also fluctuating. I want to minimize the fluctuation and keep the value of u1 always positive.

Réponses (0)

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by