Effacer les filtres
Effacer les filtres

Calculate total heat loss by conduction given temperature and depth profile vectors

5 vues (au cours des 30 derniers jours)
Hi all,
I need to solve this problem in Matlab. I have a hot body placed over cold ground, this having a thermal conductivity k = 1.
I need to estimate the total heat loss by conduction into the substratum at each timestep.
For each of these timesteps I have a temperature profile and the associated vertical profile at 1cm intervals (see .mat files attached).
How can I estimate the total heat loss (w/m2) at each time interval (i.e., the heat loss for every profile)?
Any help woud be grately appreciated!

Réponse acceptée

Torsten
Torsten le 31 Mai 2024
Déplacé(e) : Torsten le 31 Mai 2024
Here is another way to determine the temporal change of heat content in the substratum.
rho*cp*dT/dt = d/dx (k*dT/dx)
Integrating with respect to x gives
d/dt (integral_{x=-20}^{x=0} (rho*cp*T) dx ) = k*dT/dx @h=0 - k*dT/dx @h=-20
Above, we tried to approximate the right-hand side. Here, we try to approximate the left-hand side.
close all
clc
load("time_in_days.mat")
load("Depth_Profiles.mat")
load("Temperature_Profiles.mat")
num_intervals = size(Temperature_Profiles, 2);
depth_index = find(Depth_Profiles <= -20, 1, 'last');
rhocp = 1.0; % Specify rho*cp of the substratum [J/(m^3*K)]
for i = 1:num_intervals
temperature_profile = Temperature_Profiles(:, i);
energy_content(i) = trapz(Depth_Profiles(depth_index:end),temperature_profile(depth_index:end))*rhocp; %[J/m^2]
end
figure(1)
plot(time_in_days,energy_content) %[J/m^2]
change_of_energy_content = gradient(energy_content)./gradient(time_in_days*24*3600);%[W/m^2]
figure(2)
plot(time_in_days,change_of_energy_content*1e3) %[mW/m^2]
  8 commentaires
Simone
Simone le 1 Juin 2024
Thanks a lot @Torsten for your step by step eplanation and support, it was superb.
Torsten
Torsten le 1 Juin 2024
Here is a second-order approximation of the temperature gradients at the boundaries, but it doesn't seem to change that much:
dT_dh_surface = (1.5*temperature_profile(end) - 2*temperature_profile(end-1) + 0.5*temperature_profile(end-2)) / 0.01;
dT_dh_Depth = (-1.5*temperature_profile(2+depth_index) + 2*temperature_profile(1+depth_index) - 0.5*temperature_profile(1+depth_index - 1)) / 0.01;
For reference:

Connectez-vous pour commenter.

Plus de réponses (1)

Torsten
Torsten le 31 Mai 2024
Modifié(e) : Torsten le 31 Mai 2024
How can I estimate the total heat loss (w/m2) at each time interval (i.e., the heat loss for every profile)?
Total heat flow into the domain is (k*dT/dh @h=0) - (k*dT/dh @h=-20). Maybe you only want to evaluate this at one end.
To estimate the gradient, use a finite difference approximation.
  2 commentaires
Simone
Simone le 31 Mai 2024
Modifié(e) : Simone le 31 Mai 2024
Hi @Torsten, thanks for getting back!
Maybe you only want to evaluate this at one end. Sorry, can you provide more details on this? What does it mean?
To estimate the gradient, use a finite difference approximation: I came up with this code, but the output does not make any sense... :
close all
clc
k = 1; % thermal conductivity
num_intervals = size(Temperature_Profiles, 2);
total_heat_loss = zeros(1, num_intervals);
for i = 1:num_intervals
temperature_profile = Temperature_Profiles(:, i);
depth_index = find(Depth_Profiles <= -20, 1, 'last');
dT_dh_surface = (temperature_profile(2) - temperature_profile(1)) / 0.01;
dT_dh_Depth = (temperature_profile(depth_index) - temperature_profile(depth_index - 1)) / 0.01;
total_heat_loss(i) = k * (dT_dh_surface - dT_dh_Depth);
end
figure
plot(time_in_days,total_heat_loss)
set(gca, 'yScale', 'log');
set(gca, 'xScale', 'log');
% I have attached time_in_days vector
Could you kindly provide further assistance?
Torsten
Torsten le 31 Mai 2024
Modifié(e) : Torsten le 31 Mai 2024
Maybe you only want to evaluate this at one end. Sorry, can you provide more details on this? What does it mean?
It means that at h = 0, you have a heat flow into the domain and at h = -20, you have a heat flow out of the domain. Maybe you only want to compute the flow into the domain (k*dT/dh @h=0) or only the flow out of the domain (-k*dT/dh @h=-20) and not the net flow (k*dT/dh @h=0) - (k*dT/dh @h=-20).
To estimate the gradient, use a finite difference approximation: I came up with this code, but the output does not make any sense... :
You could use difference quotients of higher order that involve more h-points than only two to approximate the temperature gradient. But if it's correct that the distance between two adjacent h-points is 0.01 m, your code looks fine in principle. But you have to use
dT_dh_surface = (temperature_profile(end) - temperature_profile(end-1)) / 0.01;
instead of
dT_dh_surface = (temperature_profile(2) - temperature_profile(1)) / 0.01;

Connectez-vous pour commenter.

Catégories

En savoir plus sur General Applications dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by