pdepe help!! incorrect answer

Hi guys,
Script is working, however I don't get the correct result for the XvsC graph, what is the problam, how can I solve that, is there any other way to solve this?
clc
clear
%% defining the mash points
x = linspace(0,15000,10); %defining distance from 0 to 15000m which is divaded in to 10
t = linspace(0, 30, 30); %defining time from 0 to 30th day which is divided in to 30
m = 0;
sol = pdepe(m, @pde,@pdeic,@pdebc,x,t);
%% ploting for the x(m) vs C(30, x)(mg/L) for t = 30 day
sol(30,:);
plot(x, sol(30,:))
xlabel('Distance (m)')
ylabel('Concentration (mg/L)')
title('x vs C for t = 30 day')
%% ploting for the t(day) vs C(t, 5)(mg/L) for x = 7500 m
sol(:, 5);
plot(t, sol(:, 5))
xlabel('Time (days)')
ylabel('Concentration (mg/L)')
title('t vs C for x = 50 m')
%% main function that represent our governing equation
function [c, f, s] = pde(x, t, C, dCdx)
c = 1;
f = -49680*C;
s = -(0.24+0.45/5)*C;
end
%% defining the initial condition
function u0 = pdeic(x)
u0 = 25;
end
%% defining the boundry condition
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t)
pl = ul - 13.75;
ql = 0;
pr = ur - 0.05;
qr = 0;
end

4 comentarios

KALYAN ACHARJYA
KALYAN ACHARJYA el 29 de Dic. de 2019
Can you share the correct results?
Hüseyin Cagdas Yatkin
Hüseyin Cagdas Yatkin el 29 de Dic. de 2019
I don't have the correct results but I said incorrect becuse of the profile of the graph. It is increse and decrease continously but I know that it should be stablized at some point.
Bill Greene
Bill Greene el 29 de Dic. de 2019
The problem you have modeled makes little sense to me. You have a flow velocity of 49680 m/day and you are looking for a solution after 30 days yet you have modelled a domain of just 15000 m. What were you expecting the solution to look like in this domain after 30 days?
Hüseyin Cagdas Yatkin
Hüseyin Cagdas Yatkin el 30 de Dic. de 2019
You gat a point yeah, I never thought in that way. Since the boundry conditions are hypothetical, I will rearrange the conditions and try again. Thanks a lot.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 29 de Dic. de 2019

Comentada:

el 30 de Dic. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by