Azzera filtri
Azzera filtri

ThermalIC heat transfer transient model

2 visualizzazioni (ultimi 30 giorni)
Arlan Pacheco Figueiredo
Arlan Pacheco Figueiredo il 25 Apr 2023
I'm working on a MATLAB script that performs an analysis of a heat transfer phenomenon in transient mode.
As my heat source is mobile, I need to create a time loop where each time step repositions the heat source.
Therefore, each FOR loop is a transient analysis.
I record each step in a graph where I should follow the variation of the temperature field over time (summing up all dt time steps).
The issue is that despite the script running without syntax errors, I verify that the temperature condition, or the temperature distribution of the previous step, is not being considered as the initial condition of the next step.
I need to start the problem with:
thermalIC(thermalModel,25); % Set the initial temperature condition
Which only accepts a scalar value and in my case determines that all the finite elements of the mesh have a temperature of 25°C.
But after the first time loop the initial condition should be the temperature distribution calculated by the MATLAB solver:
thermalresults = solve(thermalModel, tlist);
This temperature result is in:
thermalresults.Temperature(:, end)
But as it is an array, the 'thermalIC' function does not accept this condition as an initial condition.
Even though thermalIC is outside my temporal FOR loop, I always see my process evolution as an initial step of first step temperatures and heat source position changes.
Could anyone tell me how I can fix this issue in my code.
% Loop temporal
for i=[1:6]
% Atualizar a posição da fonte de calor
x_center = x_start + v * t1(i);
y_center = 0;
z_center = e;
% Atualizar a função Q_intermediate com a temperatura do passo de tempo anterior
Q_intermediate = @(region, state) Q_heat_flux(region, state, x_center, y_center, Q1, Cd, roo5, prevTemp);
%for faceIndex = 1:5
bc{faceIndex}.HeatFlux = 0;
%end
bc{6}.HeatFlux = Q_intermediate;
% Definindo tlist
tlist = [t1(i), t1(i) + t_prime];
% Resolvendo o problema transiente
thermalresults = solve(thermalModel, tlist);
% Atualizar prevTemp após resolver o modelo
prevTemp = thermalresults.Temperature(:, end);
% Atualizar a condição inicial
% Visualizar a distribuição de calor
%figure(4)
%pdeplot3D(thermalModel, 'ColorMapData', Qfem, 'FaceAlpha', 0.5, 'FaceColor', 'interp');
%xlabel('x')
%ylabel('y')
%zlabel('z')
%colormap jet
%colorbar
%title(sprintf('Fonte móvel com distribuição Gaussiana (t = %.2f s)', t(i)))
%axis equal
% Visualizar a distribuição de calor para cada tempo em tlist
figure(5)
pdeplot3D(thermalModel, 'ColorMapData', thermalresults.Temperature(:, end), 'FaceAlpha', 0.5, 'FaceColor', 'interp');
title(sprintf('Fonte móvel com distribuição Gaussiana (t1 = %.2f s)', t1(i)))
xlabel('Comprimento (metros)')
ylabel('Largura (metros)')
zlabel('Espessura (metros)')
colormap jet
cbar = colorbar;
cbar.Label.String = 'Temperatura (°C)';
cbar.TickLabels = cellfun(@cbar_tick_format, num2cell(cbar.Ticks), 'UniformOutput', false);
title(sprintf('Fonte móvel com distribuição Gaussiana (t = %.2f s)', t(i)))
axis equal
% Capturar a imagem atual da animação
frame = getframe(gcf);
% Escrever a imagem capturada no arquivo de vídeo
writeVideo(VDHeatSubplots, frame);
pause(0.1);

Risposte (0)

Categorie

Scopri di più su Thermal Analysis in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by