0
$\begingroup$

I am new to solving PDE's in Mathematica (so I think I'm making rudimentary mistakes here) and I am attempting to solve a 3-dimensional PDE with a particular initial condition.

The initial function takes the form

f[0., x, y] == Exp[-(x^2. + y^2.) + 2*x*y]

which looks like

whilst my PDE is of the form

D[f[t, x, y], t] ==-I(D[f[t, x, y], {x, 2}]-D[f[t, x, y], {y, 2}])-(x-y)(D[f[t, x, y],{x, 1}]-D[f[t, x, y], {y, 1}])-((x-y)^2)f[t, x, y]

and I'm having trouble working out how to solve this PDE with this particular initial function as I'd like to define the periodicity along the x=y line.

Thus far I have successfully solved this for the simpler initial condition of

f[0., x, y] == Exp[-(x^2. + y^2.)]

which looks like

and is far easier to solve

L := 4
UX1 := D[f[t, x, y], {x, 1}] /. x -> L
UX2 := D[f[t, x, y], {x, 1}] /. x -> -L
UY1 := D[f[t, x, y], {y, 1}] /. y -> L
UY2 := D[f[t, x, y], {y, 1}] /. y -> -L
sol = f /.
        First@
         NDSolve[{D[f[t, x, y],t] == -I (D[f[t, x, y], {x, 2}] - D[f[t, x, y], {y, 2}]) - (x - y)*(D[f[t, x, y], {x, 1}] - D[f[t, x, y], {y, 1}]) - ((x - y)^2)*f[t, x, y], f[0., x, y] == Exp[-(x^2. + y^2.)], UX1 == UX2, UY1 == UY2}, f, {t, 0., L}, {x, -L, L}, {y, -L, L}, Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "DifferenceOrder" -> "Pseudospectral"}}];

which can then be plotted etc. If I attempt a similar solution with my new initial function, and try to insert some of the desired periodicity, ie

L := 4
UX1 := D[f[t, x, y], {x, 1}] /. x -> L
UX2 := D[f[t, x, y], {x, 1}] /. x -> -L
UY1 := D[f[t, x, y], {y, 1}] /. y -> L
UY2 := D[f[t, x, y], {y, 1}] /. y -> -L
sol = f /.
        First@
         NDSolve[{D[f[t, x, y],t] == -I (D[f[t, x, y], {x, 2}] - D[f[t, x, y], {y, 2}]) - (x - y)*(D[f[t, x, y], {x, 1}] - D[f[t, x, y], {y, 1}]) - ((x - y)^2)*f[t, x, y], f[0., x, y] == Exp[-(x^2. + y^2.)+2*x*y], UX1 == UY1, UX2 == UY2}, f, {t, 0., L}, {x, -L, L}, {y, -L, L}, Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "DifferenceOrder" -> "Pseudospectral"}}];

I receive the error

NDSolve::bcedge: Boundary condition (f^(0,1,0))[t,4,y]==(f^(0,0,1))[t,x,4] is not specified on a single edge of the boundary of the computational domain. >>

Which seems to suggest that defining the boundary conditions in the manner that I am trying to solve this with isn't possible. Is there any way to solve this PDE in Mathematica the way I'd like to without rotating the coordinates?

$\endgroup$
  • $\begingroup$ What do you mean by "periodicity along the x=y line"? To me this seems to represent b.c. like f[t, x, L] == f[t, L, x], which isn't the one in your code. $\endgroup$ – xzczd Nov 25 '17 at 13:09
1
$\begingroup$

Sorry I only want to place a comment, but as a new user I'm not allowed to do. In the boundary conditions you set x==y!

UX1 = Derivative[0, 1, 0][f][t, L, x]
UX2 = Derivative[0, 1, 0][f][t, -L, x]
UY1 = Derivative[0, 0, 1 ][f][t, x, L ]
UY2 = Derivative[0, 0, 1 ][f][t, x, -L ]

If you omit these boundary conditions in a first step your problem can be solved after editing your code a little bit:

L = 4 ; 
sol = 
 NDSolveValue[{Derivative[1,0,0][f][t,x,y]==-I(Derivative[0,2,0][f][t,x,y] - 
    Derivative[0, 0, 2][f] [t, x, y] ) - (x - 
    y) (Derivative[0, 1, 0][f] [t, x, y] - 
    Derivative[0, 0, 1][f] [t, x, y] ) - ((x - y)^2)*f[t, x, y],
    f[0 , x, y] == Exp[-(x^2 + y^2 ) + 2 x y]},
    f, {t, 0  , L}, {x, -L, L}, {y, -L, L}
, Method -> {"MethodOfLines", "TemporalVariable" -> t, 
"SpatialDiscretization" -> {"FiniteElement"}}] 


Manipulate[Plot3D[Im[sol[t, x, y]], {x, -L, L}, {y, -L, L} , PlotRange ->{0,1} , Mesh -> All] , {{t, 1}, 0, 4, Appearance -> "Labeled"(*,Animator*)}]
$\endgroup$
  • $\begingroup$ Doing that I get the error message "DSolve::conarg: The arguments should be ordered consistently" $\endgroup$ – Tbone Willsone Nov 24 '17 at 10:14
  • $\begingroup$ Have you got any idea as to what I might be doing wrong? I would've thought this would be simple, I must be missing something silly! $\endgroup$ – Tbone Willsone Nov 24 '17 at 18:38
  • $\begingroup$ I have no idea, the problem lies in the boundary conditions. My answer-edit gives you a running version of your problem without the boundary conditions. $\endgroup$ – Ulrich Neumann Nov 25 '17 at 12:16
  • $\begingroup$ That has certainly worked! Thank you for your help! $\endgroup$ – Tbone Willsone Nov 27 '17 at 9:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.