Create time dependent internal heat source for heat transfer problem
Mostrar comentarios más antiguos
Hello,
I am writing a heat source function that is supposed to be time dependent, but it is not produccing the right results. I wrote a internal heat source function "HeatSourceFunc" that will be used as follows:
internalHeatSource(model,@HeatSourceFunc);
I have written two different heat source functions that basically do the same thing, except that the first case is not time-dependent, and the second case is time-dependent and is supposed to start at time t = 5 seconds.
Here is case 1 (not time dependent):
function Q = HeatSourceFunc(location,~) % case 1
xx = location.x;
yy = location.y;
Q = zeros(size(xx));
idx = (xx-0.006).^2 + (yy-0.004).^2 <= 0.002^2; % circular heat source
Q(idx) = 50;
end
Here is case 2 (time dependent):
function Q = HeatSourceFunc(location,state) % case 2
xx = location.x;
yy = location.y;
tt = state.time;
Q = zeros(size(xx));
if tt < 5 % no heat sources before t = 5 seconds
return;
else % circular heat source starting at t = 5 seconds
idx = (xx-0.006).^2 + (yy-0.004).^2 <= 0.002^2;
Q(idx) = 20 - tt;
end
end
I ran the simulation from t = 0 seconds to t = 100 seconds as follows:
time = 0:100; % times at which to sample solution
sol = solve(model,time); % solve problem
Then I obtained the following graphs. Why am I not getting a similar picture in case 2 as in case 1? 100 seconds is plenty of time for a temperature change to occur. Any help would be appreciated, thank you.

Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Heat Transfer en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!