I am trying to numerically solve (and eventually plot evolving through time) the following differential equation
$\frac{\partial f(x,y,t)}{\partial t} = i C_{0}\left(\frac{\partial^{2}f(x,y,t)}{\partial x^{2}} - \frac{\partial^{2}f(x,y,t)}{\partial y^{2}} \right) \\ - C_{1}\left( x - y\right) \left(\frac{\partial f(x,y,t)}{\partial x} - \frac{\partial f(x,y,t)}{\partial y} \right) \\ - C_{2}\left( x - y \right)^{2}f(x,y,t) \\ + iC_{3}(x-y)\left(\frac{\partial^{3}f(x,y,t)}{\partial x^{3}} - \frac{\partial^{3}f(x,y,t)}{\partial y \partial x^{2}} - \frac{\partial^{3}f(x,y,t)}{\partial x \partial y^{2}} + \frac{\partial^{3}f(x,y,t)}{\partial y^{3}} \right) \\ - C_{4} \left( x - y\right)^{2} \left(\frac{\partial^{2} f(x,y,t)}{\partial x^{2}} - 2\frac{\partial^{2} f(x,y,t)}{\partial x \partial y} + \frac{\partial^{2} f(x,y,t)}{\partial y^{2}} \right)$
for simplicity I'm taking the case where
$C_{0}=C_{1}=C_{2}=C_{3}=1$
I want the function and all its spatial derivatives to be zero at the edges of a rectangle of an arbitrary length L (T is also arbitrary). My attempt at doing this is
DiffEq[C0_, C1_, C2_, C3_] := (x - y)*(C0*(f[x, y, t]) + C1*(D[f[x, y, t] , x] - D[f[x, y, t] , y]) + C2*(D[ f[x, y, t] , {x, 2}] - D[ f[x, y, t] , {y, 2}]) + C3*(D[ f[x, y, t] , {x, 3}] - D[ f[x, y, t] , {y, 3}]))
L = 3;
T = 10;
NDSolve[{D[f[x, y, t], t] == Evaluate[DiffEq[-1, -1, -1, -1]], f[x, y, 0] == Exp[-(x^2 + y^2)], (D[f[x, y, t], x] /. x -> L) == 0, (D[f[x, y, t], y] /. y -> L) == 0, (D[f[x, y, t], x] /. x -> -L) == 0, (D[f[x, y, t], y] /. y -> -L) == 0, (D[f[x, y, t], x, x] /. x -> L) == 0, (D[f[x, y, t], y, y] /. y -> L) == 0, (D[f[x, y, t], x, x] /. x -> -L) == 0, (D[f[x, y, t], y, y] /. y -> -L) == 0}, f, {x, -L, L}, {y, -L, L}, {t, 0, T}, Method -> {"PDEDiscretization" -> {"MethodOfLines", "SpatialDiscretization" -> "TensorProductGrid"}}]
I get the following error
NDSolve::ibcinc: Warning: boundary and initial conditions are inconsistent.
NDSolve::mxst: Maximum number of 10000 steps reached at the point t == 0.03311714832347852`.
NDSolve::eerr: Warning: scaled local spatial error estimate of 5317.243100921993` at t = 0.03311714832347852` in the direction of independent variable x is much greater than the prescribed error tolerance. Grid spacing with 69 points may be too large to achieve the desired accuracy or precision. A singularity may have formed or a smaller grid spacing can be specified using the MaxStepSize or MinPoints method options.
I'm finding it difficult to insert any initial conditions at t=0 that will get rid of this error. I've tried switching up the method of inserting initial conditions too.
f[x, y, 0] == If[-L < x < L && -L < y < L, Exp[-(x^2 + y^2)], 0]
f[x, y, 0] == Exp[-(x^2 + y^2)]
then neither it nor its derivatives are zero at the edges of your rectange... I guess that's what Mathematica means when it saysboundary and initial conditions are inconsistent
. $\endgroup$