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