I'm trying to set up and solve the heat equation in 1D that conforms to conservation of energy. So intuitively in addition to the initial condition $$u(x,0) = f(x)$$ the boundary condition would be $$\int_0^L u(x,t) dx = k,\quad t\in (0,\infty)$$
But I'm not very familiar with multivariate calculus and PDEs in general so I'm not sure how to proceed from here. I'm not really looking for an analytical solution as I suspect it'll be very complicated, but it'd be nice if someone pointed me in the correct solution. I am hoping to solve this in MATLAB if possible. Thanks.