Saving an extra variable from PDEPE

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 个)

类别

帮助中心File 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