Fluctuating and negative value in pdepe
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 PDE Solvers에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!