Solving an integral within a partial derivative

1 回表示 (過去 30 日間)
kjell revenberg
kjell revenberg 2023 年 12 月 21 日
コメント済み: Torsten 2024 年 1 月 9 日
Hi everyone,
I am having trouble solving the following heat equation in Matlab
As you can see there will be an integral within the partial derivative.
When solving my equations work, but do not work over time. Thus i have a feeling I do something wrong with solving the integral. This is how I currently describe the problem. I did not fully iplement the higher order terms, as it does not work yet.
P = dimensionless term cf/kf
Z = 1/kf(w/W)
tmax = 1000 s
Any help would be greatly appreciated
m = 0;
sol = pdepe(m,@heatpde,@heatic,@heatbc,x,t);
function [c,f,s] = heatpde(x,t,u,dudx)
global B tmax Z P
c =P;
f = dudx;
y = @(u) (u.*(1-B/3*u+7*B^2/45*u.^2));
A = sqrt(2*B *integral(y,0,tmax))
s = -Z*u/A;
end
function u0 = heatic(x)
u0 = 0;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = ul-1;
ql = 0;
pr = ur;
qr = 0;

回答 (1 件)

Torsten
Torsten 2023 年 12 月 21 日
編集済み: Torsten 2023 年 12 月 21 日
You have to solve a second ordinary differential equation for y:
dy/dt = 2*Ste * theta_f*(1-Ste/3 * theta_f + 7/45*Ste^2*theta_f^2)
y(t=0,x) = 0
Then y_LS = sqrt(y) in your equation for theta_f.
This can give problems because "pdepe" is designed to solve partial differential equations, not ordinary differential equations.
But since you prescribe theta_f at both ends of the spatial interval, you can compute y at these endpoints, too, and prescribe its value in "heatbc":
at x = 0: y = 2*Ste*integral(1-Ste/3+7/45*Ste^2) dt = 2*Ste*(1-Ste/3+7/45*Ste^2)*t
at x = L: y = 2*Ste*integral(0 dt) = 0
Is y_LS' differentiation with respect to t or with respect to x ? Same question for theta_f'.
  13 件のコメント
kjell revenberg
kjell revenberg 2024 年 1 月 9 日
HI Torsten,
I think I found a solution to part of the problem.
dtheta_fdx and dy_ls_dx are both 0 at some points. Thus creating singularity to the equation.
I solved this by adding a small epsilon to the problem, some of the results seem accurate while the PCM temperature is not right.
I wondered how you came to the formula for
dy_ls_dx as I think there lies the error.
Thanks in advance
Torsten
Torsten 2024 年 1 月 9 日
I wondered how you came to the formula for
dy_ls_dx as I think there lies the error.
Thanks in advance
Yes, it's sqrt(u(2)) instead of u(2) in the denominator:
y_ls = sqrt(u(2)) -> d(y_ls)/dx = 1/(2*sqrt(u(2))) * dudx(2)

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by