How to define a non-continuous boundary condition in PDE toolbox.

2 views (last 30 days)
Hi,
Im trying to solve the heat equation in 2D, which I can do with the documentation provided. I have a square with dimensions lx by ly. One boundary will act as an insulator, two other will be constant temperature and the last bc will have to define via a function. The problem I have, is the following. I need to make the function a step function along the x direction for a a heat flux, what I mean by that is the following: between lx/2-5 to lx/2+5 q= 10, everywhere else q=0.
I have tried to access the discreet points on the grid so I can define a vector of 1 where I want a heat flux, and 0 where I don't. However, I'm not sure how to access these points. what I have done with a finite difference code is the following:
bc = zeros(length(lx));
bc(lx/2-5:lx/2+5) = q;
which gives me exactly what I want, a heat soure at the center and an insulator around it. For the PDE case the relevat code and function is below.
thermalBC(thermT,'Edge',4,'HeatFlux',@botq);% in main program
%Below is a seprate function call botq.m
function bot = botq(location,~)
if((location.x >=4.7000e-04) && (location<=5.3000e-04))
bot = 10/5e-5;
else
bot = 0;
end
end
I'm not even sure if Im doing this correct. I am having trouble accessing actual values of anything, so I'm not sure if Im even really callign anything. Is there a similar way to do this with PDE toolbox, is there a simple way to accomplish this bc, and how does one access the x and y locations of nodes?
Thakns in advance

Answers (0)

Community Treasure Hunt

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

Start Hunting!