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.
  1 件のコメント
kjell revenberg
kjell revenberg 2024 年 1 月 23 日
Thankyou! I got it working

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical 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