Time dependent external heat flux in PDE Toolbox

18 views (last 30 days)
Dear Community;
i am dealing with an issue with my model of a heat distribution of a cylindrical circular rod. My model is quite similar to https://de.mathworks.com/help/pde/examples/heat-distribution-in-a-circular-cylindrical-rod.html, but i am trying to create a heat flux, which is time-dependent. None of the tutorials or examples is really helpful. Unfortunately i am a beginner with Matlab, so i dont offer much skills in programming.
This is my code for the heatflux at the moment. Right now i am just working with an average heatflux, but i would like to use a time-dependent formula.
y_dach = 600;
n=2;
ts=1/8000; %increment
T=4; %T_max
t=0:ts:T; %timelist
heat = y_dach*sin(2*pi*n*t+pi/2); %Formula i want to use
heatflux_percentage = 0.35;
Positive = heat >0;
heat(~Positive)=0; % only positive values
heatflux = heat/ V_cyl; ,
avg_heatflux=mean(heatflux_percentage*heatflux);
thermalBC(thermalModelT,'Edge',[7,8],'HeatFlux',avg_heatflux)
This is my solver:
tfinal = 50; %tmax
tlist = 0:2:tfinal; %timeincrements
thermalModelT.SolverOptions.ReportStatistics = 'on';
result = solve(thermalModelT,tlist);
T = result.Temperature;
I know that i somehow have to use a function handle with state.time, but i dont know how to use it.
Many thanks in advance!

Accepted Answer

Ravi Kumar
Ravi Kumar on 21 Nov 2019
Hi Pascal,
You are on the right track, refer to the externalHeatFlux in the example:
Thought the example is for spatial variaion, you can make your heat flux funciton of time using state.time, state is available to you as second argument.
function Qflux = timeDepHeatFlux(region,state)
if isnan(state.time)
Qflux = nan(size(region.x));
return;
end
% Write you time dependent function here....
end
Regards,
Ravi
  4 Comments
Pascal Kobuß
Pascal Kobuß on 22 Nov 2019
Hi Ravi,
thank you. So, the problem is the very large time vector. I cant change the vector though, because my analysis lasts such a long period of time. But besides that, is there a possiblity to say, that the heatflux will stop at a certain amount of time, so that my model will cool down after the heating phase?
Ravi Kumar
Ravi Kumar on 25 Nov 2019
You should be able to do this in the function. Use state.time to switch from 'on' and 'off' conditions using, if-statement for example.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!