Saving an extra variable from PDEPE

조회 수: 2 (최근 30일)
kjell revenberg
kjell revenberg 2024년 1월 23일
댓글: kjell revenberg 2024년 1월 23일
Hi, I am solving a heat problem using the PDEPE. Everything is working, however I want to save some extra variables from the main function of the PDEPE that I solve. How can I do this? Adding it to the function handle does not work for me. I want to save the value for Q.
removing the ; indicates that the value is being calculated, but I cannot save it.
function [c,f,s,Q] = heatpde(x_d,t_d,u,dudx,C)
k_d = C.k_d;
STE = C.STE;
w = C.w;
W = C.W;
Cp_d = C.Cp_d;
theta_f = u(1);
y_LS = u(2);
eps = 1e-15;
eps2 = 1e-8;
dtheta_fdx =dudx(1);
d_y_LS_dx = (1/y_LS)*(dudx(2))+eps2;
q_eff = -k_d*w*dtheta_fdx;
c = [Cp_d/k_d;y_LS;1];
f =[dudx(1);0;0];
s = [-1/(k_d*(w))*(theta_f/y_LS+(STE*theta_f*(theta_f+2*dtheta_fdx/d_y_LS_dx*y_LS))/(6*y_LS) ;...
(theta_f/y_LS+STE*theta_f*(theta_f+2*dtheta_fdx/d_y_LS_dx*y_LS)/(6*y_LS); ...
-STE^2*theta_f*(40*(dtheta_fdx/d_y_LS_dx)^2*(y_LS)^2+85*theta_f*dtheta_fdx/d_y_LS_dx*y_LS+19*theta_f^2)/(360*y_LS))];
Q = (theta_f/y_LS+STE*theta_f*(theta_f+2*dtheta_fdx/d_y_LS_dx*y_LS))/(6*y_LS);

채택된 답변

Torsten
Torsten 2024년 1월 23일
After the computation with "pdepe" is completed, call "pdeval" to get the spatial derivatives of your solution on the x-mesh and then call "heatpde" in a loop for all spatial points and times that you like to get Q returned.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by