PDE Neumann boundary condition depends on u; qmatrix(u)
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I want to solve following parabolic equation (heat transfer)
u = parabolic(u0, tlist, b,p,e,t,c,a,f,d,rtol,atol);
The Geometry is a simple rectangle, and to creat the mesh I use
[p, e, t] = initmesh(rectangle, 'Hmax', 1e-3);
Both sides of the rectangle are adiabatic. On the bottom a constant heat flux is given. On top I want to set a heat flux coefficient which depends on the temperature (h = 1.5*u-300; u = temp.)
The boundary conditions are defined as follows:
function [q_matrix,g_matrix,h_matrix,r_matrix] = boundary_conditions(p,e,u,time);
q_matrix = zeros(1,ne);
g_matrix = q_matrix;
h_matrix = zeros(1,2*ne);
r_matrix = h_matrix;
for k = 1:ne
switch e(5,k)
case {1,3} %boundarys edge 1 and 3 adiabatic
q_matrix(k) = 0;
g_matrix(k) = 0;
case {2} %boundary edge 2 heat transfer coefficient
q_matrix(k) = 1.5 * (u(e(1,k))+u(e(2,k)))/2 -300;
g_matrix(k) = (1.5 * (u(e(1,k))+u(e(2,k)))/2 -300) * 273;
%T_ambient = 273K
otherwise %boundary edge 4 heat flux
q_matrix(k) = 0;
g_matrix(k) = 2000;
end
end
My Problem now is, that this is not working when I use a function of u in q_matrix! I get following error:
??? Attempted to access u(2); index out of bounds because numel(u)=0.
Error in ==> boundary_conditions at 53
q_matrix(k) = 1.5 * (u(e(1,k))+u(e(2,k)))/2 -300;
I hope somebody can help me,
Thanks Felix
0 件のコメント
回答 (3 件)
Bill Greene
2013 年 2 月 27 日
Hi,
Are you by any chance using a version of MATLAB older than R2012b?
The capability to have coefficients and boundary conditions that are functions of the dependent variables in parabolic (and hyperbolic) was an enhancement for R2012b.
Other than that, the code snippets you show above basically look OK to me.
Regards.
Bill
0 件のコメント
Bill Greene
2013 年 2 月 28 日
Yes, you have boundary conditions that are a function of u.
That was not supported in PDE Toolbox for transient PDE (parabolic and hyperbolic) before R2012b. Older versions of PDE Toolbox do let you solve a stationary problem with coefficients and boundary conditions that are a function of u using the the pdenonlin function.
Bill
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Boundary Conditions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!