final value of x in PDE

1 view (last 30 days)
br
br on 15 Feb 2024
Commented: br on 19 Feb 2024
if i have PDE as following:
u=M
t=t
x=r
and i want to calculate the value of x at t=0 u0, and final value of it t=infinity and u=final
i have the initial and final value of u
how can i write a command to solve this one?
  5 Comments
Torsten
Torsten on 18 Feb 2024
Edited: Torsten on 18 Feb 2024
Why don't you plot x against u for all given times t ? It's much more natural than plotting u against x.
But see my answer below.
br
br on 19 Feb 2024
becuse i want then to draw u and x but not at all time only at specific time i can chose
so i made it like this, but the remaning point is to calculate the end point of x, and how to make time in linspace from 0 to infinity
kp0=140270;
Eap=43900;
kd0=0.355;
Ead=17400;
T=333;
kp=kp0*exp(-Eap/(8.314*T));
kd=kd0*exp(-Ead/(8.314*T));
m=2;
t=linspace(0,999999,1000);
u=linspace(0.506405,110,1000);
x=linspace(0,0.0000000006,1000);
x1=pdepe(m,@(x,t,u,DuDx)eqn111(x,t,u,DuDx,T),@initial111,@(xl,ul,xr,ur,t)bc111(xl,ul,xr,ur,t,kp,kd),u,t);
u1=pdepe(m,@(x,t,u,DuDx)eqn11(x,t,u,DuDx,T),@initial11,@(xl,ul,xr,ur,t)bc11(xl,ul,xr,ur,t,kp,kd),x,t);
t_indices = find(t >= 0 & t <= 3600);
figure
hold on
for j = t_indices
plot(x1(j,:),u1(j,:));
hold off
end
xlabel('radius');
ylabel('concentration');
function [c,f,s]=eqn111(x,t,u,DuDx,T)
c=1;
f=(1.34*10^-6)*exp(-16000/(8.314.*T))*exp(-(0.57*1.225+0.43*1.005*0.524)/(0.57*2.91*(-8.675+T)+0.43*0.5*(-205+T)))*DuDx;
s=0;
end

Sign in to comment.

Answers (2)

Vishisht
Vishisht on 18 Feb 2024
To solve the given partial differential equation (PDE) using the method of characteristics, we can start by rewriting the PDE in characteristic variables.
Given:
- \( u = M \)
- \( t = t \)
- \( x = r \)
The PDE in characteristic variables becomes:
\[ \frac{\partial u}{\partial t} = 0 \]
\[ \frac{\partial x}{\partial t} = M \]
Now, we integrate these characteristic equations to obtain expressions for \( u \) and \( x \) in terms of \( t \) and initial conditions:
1. Integrating \( \frac{\partial u}{\partial t} = 0 \) gives \( u = u_0 \), where \( u_0 \) is the initial value of \( u \).
2. Integrating \( \frac{\partial x}{\partial t} = M \) gives \( x = Mr + x_0 \), where \( x_0 \) is the initial value of \( x \).
Given the initial and final values of \( u \) and the final value of \( x \), you can find the constants \( u_0 \) and \( x_0 \) using the provided information.
Once you have \( u_0 \) and \( x_0 \), you can use these expressions to find the values of \( x \) at \( t = 0 \) and the final value of \( x \) as \( t \rightarrow \infty \).
For example, if you know the initial value of \( u \) (\( u_0 \)), you can directly set \( x = x_0 \) to find the value of \( x \) at \( t = 0 \). And if you have the final value of \( u \), you can set \( u = \text{final} \) and solve for \( x \) as \( t \rightarrow \infty \).
Please provide the specific initial and final values of \( u \) and any other relevant information so that a more detailed solution can be provided.
  1 Comment
br
br on 18 Feb 2024
Dov=(1.34*10^-7)*exp(-16000/(8.314.*T))*exp(-(0.57*1.225+0.43*1.005*0.524)/(0.57*2.91 (-8.675+T)+0.43*0.5*(-205+T)))*
u0=0.036405
u(final)=111.3494528
x0=0
t0=0

Sign in to comment.


Torsten
Torsten on 18 Feb 2024
Edited: Torsten on 18 Feb 2024
i want to solve this equation for r at given time and concentration
I assume that the time for which you want to get r is in the output of "pdepe".
If c is the concentration vector at time t and r is the vector of radial discretization points, you can try
rq = interp1(c,r,cq)
where cq is the concentration for which you want to get the corresponding radius rq.
This might cause problems if c is not monotonic.
If so, try
c = [0 0 3 5 8 10 14];
r = [0 1/6 1/3 1/2 2/3 5/6 1];
cq = 6.25;
idx = find(diff(sign(c-cq)),1);
rq = ((cq-c(idx))*r(idx+1) + (c(idx+1)-cq)*r(idx))/(c(idx+1)-c(idx))
rq = 0.5694
  1 Comment
br
br on 19 Feb 2024
sorry for that but can you explane that much easer, and how and were i put it, thanks for your time and help

Sign in to comment.

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!