0
$\begingroup$

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]
$\endgroup$
  • $\begingroup$ Uh, if 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 says boundary and initial conditions are inconsistent. $\endgroup$ – Marius Ladegård Meyer Jul 17 '18 at 16:29
  • $\begingroup$ @MariusLadegårdMeyer That's a good point, although I haven't encountered that issue with the same equation with lower order derivatives. I'm finding it difficult to insert any appropriate initial conditions that will fix this inconsistency. $\endgroup$ – Tbone Willsone Jul 19 '18 at 15:05
  • $\begingroup$ Are you sure the equation itself is correct? I've tested various settings for your equation, but the solution always becomes unstable very fast. And, the equation does look like something related to backward heat conduction problem, which is a well-known ill-posed problem. $\endgroup$ – xzczd Jul 26 '18 at 14:48
  • $\begingroup$ @xzczd I simplified the equation into what I thought were the "problematic" terms. I notice that I did omit a very important piece of information: the third order derivatives are imaginary. Here is an image of the full equation I am worknig with. I shall also change my equations on here accordingly drive.google.com/file/d/1_nd8a83-oYxrgFHlzehwEDK24lK9qL4p/… $\endgroup$ – Tbone Willsone Jul 26 '18 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.