For example I consider a heat equation that I want to solve numerically : $$u_t=u_{xx},$$ In order to have a uniqueness on a computational bounded domain I have to have boundary condition specified for both $x_{min}$ and $x_{max}$. Ideally I can specify the value of the function, if it is not known I can specify the value of the derivative. However, even if I use the exact solution to specify value of the derivative I noticed that the error at the boundaries is larger than in the middle of the grid. It might be a bug in the code or a fundamental error that I don't get.

Therefore, my question is: does Neumann boundary condition maintains uniqueness of a solution or it is only valid for Dirichlet? And when I can safely use gradient value on the boundary compare to the value of the function itself? Sometimes, I have no idea about the value of the function on the boundary, however, it is more natural to set the boundary values though the derivatives.

  • $\begingroup$ How are you discretizing the heat equation? $\endgroup$
    – gnzlbg
    Commented Aug 5, 2012 at 12:35
  • $\begingroup$ I apply Crank Nicolson method $\endgroup$
    – Kamil
    Commented Aug 5, 2012 at 23:14

1 Answer 1


Yes, for the heat equation Neumann boundary conditions all around the boundary is sufficient to maintain uniqueness of the solution. Whether you choose Neumann or Dirichlet conditions is dictated by the physical situation you try to model: if you know the temperature, then you need Dirichlet conditions; if you know the heat flux, then you need Neumann conditions.

As for the error: in a 1d situation I would expect the error to be roughly uniformly distributed after a few time steps. That may mean that you have an error, but it's of course hard to tell without more details.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.