Problem with BC for upwind discretization causing oscillating/negative solution (tested in 1D scalarTransportFoam)
As described here https://www.cfd-online.com/Forums/openfoam-bugs/188749-negative-values-scalartransportfoam-upwind-discretization.html the usage of upwind discretization does not prevent the appearance of oscillations in the scalar field with scalarTransportFoam in the standard 1D convection-diffusion test case (i.e. T(0)=0 and T(L)=1 with advection dominated flow), where the region with the high gradient is located directly at the x=L boundary. If the gradient is located in the volume (by adding a volume source term for T vie the fvOptions and setting the BC at x=L to zeroGradient), the upwind discretization behaves as expected, giving a smooth (overly-diffusive) solution over the entire volume. This points to a problem with the boundary conditions.