I've just coded my finite difference solver in Python for the heat equation in the unit square, and in order to check an important property of the equation I need to give as initial data a discountinuous function.
My domain in [0,1] x [0,1]
and I'd like to have a function like the following, but in 2D,i.e. a piecewise function of the variables (x,y).
The problem is that I tried to use numpy.piecewise, but it doesn't seem to work. Does anyone know how to build such an initial datum?