To create a temperature distribution with a plane wall being cooled by a liquid on one side and being heated by a heat flux for 0.2 seconds every 1 second on the other side in Matlab, you can use the Finite Difference Method (FDM) as follows:
Define the geometry of the wall and divide it into nodes. Let N be the total number of nodes.
Define the time step and the total simulation time.
Initialize the temperature vector T of size N x 1 with the initial temperature at each node.
Define the boundary conditions. For example, if the left side of the wall is cooled by a liquid at a constant temperature T_L and the right side is heated by a heat flux Q(x,t), then the boundary conditions can be written as:
T(1) = T_L % left side cooled by a liquid T(N) = T(N-1) + (Q(N-1)delta_t) / (rhoCp*dx) % right side heated by a heat flux, using the Forward Time Central Space (FTCS) scheme, where rho is the density of the wall, Cp is its specific heat, delta_t is the time step, and dx is the distance between two adjacent nodes.
Implement the FDM scheme, which can be written as:
for t = 0 : delta_t : total_time for i = 2 : N-1 T(i) = T(i) + (alphadelta_t/(dxdx)) * (T(i+1) - 2*T(i) + T(i-1)) end end
where alpha is the thermal diffusivity of the wall material.
gistlibby LogSnag