Effacer les filtres
Effacer les filtres

pdepe: why does spatial discretization fail?

2 vues (au cours des 30 derniers jours)
Wim Bergmans
Wim Bergmans le 6 Avr 2015
Commenté : Wim Bergmans le 7 Avr 2015
Hi,
when trying to solve a PDE very similar to the heat equation pdepe yields the following:
>> pdetest
Error using pdepe (line 293)
Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.
Error in pdetest (line 5)
sol = pdepe(0,@pde,@pdeic,@pdebc,xmesh,tspan);
What am I missing here? Please see the used code below:
function pdetest
xmesh = linspace(-4,3,82);
tspan = linspace(0,1,12);
sol = pdepe(0,@pde,@pdeic,@pdebc,xmesh,tspan);
function [c,f,s] = pde(x,t,u,DuDx)
c = 1;
f = 0.0968*DuDx;
s = 0;
function u0 = pdeic(x)
xmesh = linspace(-4,3,82);
[~, index] = min(abs(xmesh-x));
initial_values = [0.3639 0.3720 0.3801 0.3884 0.3968 ...
0.4054 0.4141 0.4229 0.4319 0.4411 0.4504 0.4599 0.4696 ...
0.4794 0.4894 0.4995 0.5098 0.5204 0.5310 0.5419 0.5530 ...
0.5642 0.5756 0.5873 0.5991 0.6111 0.6234 0.6358 0.6485 ...
0.6614 0.6745 0.6878 0.7014 0.7152 0.7292 0.7435 0.7580 ...
0.7727 0.7878 0.8030 0.8186 0.8344 0.8504 0.8668 0.8834 ...
0.9003 0.9175 0.9350 0.9528 0.9709 0.9893 1.0081 1.0271 ...
1.0465 1.0662 1.0863 1.1067 1.1274 1.1485 1.1700 1.1918 ...
1.2140 1.2366 1.2596 1.2829 1.3067 1.3309 1.3555 1.3805 ...
1.4059 1.4318 1.4581 1.4849 1.5121 1.5398 1.5680 1.5966 ...
1.6258 1.6554 1.6856 1.7163 1.7475];
u0 = initial_values(index);
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t)
pl = 0.3639;
ql = 0;
pr = 1.7475;
qr = 0;

Réponse acceptée

Bill Greene
Bill Greene le 6 Avr 2015
I think you want the following in your pdebc function:
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t)
pl = ul-0.3639;
ql = 0;
pr = ur-1.7475;
qr = 0;
  1 commentaire
Wim Bergmans
Wim Bergmans le 7 Avr 2015
That is it, thank you very much!

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by