To solve this problem, we need to use the finite difference method to discretize the governing equation and apply the temporal and spatial discretization techniques to calculate the temperature at each time step and position.
Assuming the wall is a homogeneous material and has a constant thermal conductivity, the governing equation for transient heat conduction can be written in the following form:
$$\rho C_p \frac{\partial T}{\partial t} = \frac{\partial}{\partial x}\left(k\frac{\partial T}{\partial x}\right) + q_x$$
where $\rho$ is the material density, $C_p$ is the specific heat capacity, $k$ is the thermal conductivity, $q_x$ is the heat flux on the wall surface, and $T$ is the temperature as a function of time and position.
We can discretize this equation using the central difference method to obtain:
$$\frac{T_{i}^{n+1}-T_i^{n}}{\Delta t}=\frac{k}{\rho C_p}\frac{T_{i+1}^n-2T_i^n+T_{i-1}^n}{\Delta x^2}+\frac{q_x}{\rho C_p}$$
where $n$ is the time index, $i$ is the spatial index, $\Delta t$ and $\Delta x$ are the time step and spatial step, respectively.
The heat flux $q_x$ is specified on one side of the wall and lasts for 0.2 seconds every 1 second. One way to implement this is to use a time-dependent boundary condition with a switch function:
$$q_x(t) = \begin{cases} q_0 & \text{if} , 0 \leq t \mod 1 < 0.2 \ 0 & \text{otherwise} \end{cases} $$
where $q_0$ is the constant heat flux value.
To solve this problem, we can follow these steps in Matlab:
main.m548 chars22 lines
main.m323 chars13 lines
main.m405 chars17 lines
surf
function.main.m444 chars20 lines
This code will generate a 3D surface plot of the temperature distribution in the wall as a function of position and time. The plot will show how the temperature changes over time due to the periodic heat flux on one side of the wall.
Note that this code assumes a 1D problem with a uniform cross-section. To model more complex geometries, boundary conditions, or material properties, the code will need to be adapted accordingly.
gistlibby LogSnag