How to implement Neumann BC on non-Poisson PDE

All the examples I have seen regarding Neumann BCs are for the Poisson problem. The thing is that Poisson’s equation has a unique structure regarding the application of the BC. Because you use integration by parts to get the weak form, you have a surface integral that you can use to apply said condition. If the normal derivative is 0, you just remove the surface integral from the form and it applies the condition automatically.

The case I am considering is where you don’t use integration by parts to get the weak form. In particular, consider the transport equation with reflective (i.e. zero Neumann BCs) at both boundaries.

\begin{align} u_t + u_x &= f \text{ on } [x_0, X] \times [t_0, T] \\ \frac{\partial u}{\partial \vec{n}} &= 0 \text{ on } \{x=x_0 \text{ or } x=X\} \times [t_0, T] \end{align}

After discretizing in time one gets a series of stationary problems to solve. How do I implement said boundary conditions in Fenics? I’ve found no examples on how to do so. I’d appreciate any help.

Take a look at this thread, for example. There’s no concept of a Neumann boundary condition for an advection problem. You need to consider fluxes of your solution on the boundary.

Edited post

I understand the issue regarding the boundary conditions now. They revolve around not putting data inconsistent with the characteristics on the boundary. Will diagonalize the system, choose a combination of the variables, and finagle things to get the desired reflection at the boundary. Thanks for the help.