1
$\begingroup$

I'm trying to solve a system of PDEs with periodic boundary conditions using NDSolve. This works if I don't specify an initial condition (but is uninteresting, giving the trivial solution $u(x,y,t)=0$). I tried specifying random initial conditions, but I get the following error messages:

Boundary condition discretization failed errors.

Here is my code

eps = 0.1
g1 = 1
random = Table[{x, y, RandomReal[]}, {x, 0, 2 π, 2 π/10}, {y, 0, 2 π, 2 π/10}];
random[[All, -1, -1]] = random[[All, 1, -1]];
random[[-1, All, -1]] = random[[1, All, -1]];
iniIF = Interpolation[Flatten[random, 1]];
ini[x_, y_] := 1 + iniIF[x, y]

sols = 
  NDSolve[
    {D[u[x, y, t], t] == 
       (1 + eps) u[x, y, t] + 2 (ψ[x, y, t] + ϕ[x, y, t]) + 
       Laplacian[ψ[x, y, t], {x, y}] + 
       Laplacian[ϕ[x, y, t], {x, y}] + g1 u[x, y, t]^2 - u[x, y, t]^3,
     ϕ[x, y, t] == D[u, {y, 2}],
     ψ[x, y, t] == D[u, {x, 2}],
     u[x, y, 0] == ini[x, y],
     PeriodicBoundaryCondition[u[x, y, t], x == 2 π, Function[x, x - 2 π]], 
     PeriodicBoundaryCondition[u[x, y, t], y == 2 π, Function[y, y - 2 π]],
    {u, ψ, ϕ},
    {t, 0, 100}, {x, 0, 2 π}, {y, 0, 2 π}]

Why would I be getting "The boundary condition discretization failed"? How can I circumvent this?

(P.S.: Cross-posted to Wolfram Community to get some more eyes, as I have not been able to find any reference to this error online)

$\endgroup$
  • 3
    $\begingroup$ You have a missing }. Probably needs to be inserted before the {u, ψ, ϕ} argument. With that change, I get a only one error saying "Nonlinear coefficients are not supported in this version of NDSolve". $\endgroup$ – m_goldberg Jun 13 at 15:40
  • $\begingroup$ @m_goldberg sorry, that was an omission when I copied it over and edited lightly for readability. However, my original code that gave the error had the } in the right place $\endgroup$ – Zhen Jun 14 at 9:17
3
$\begingroup$

Here are a couple of corrections. I am not sure this is what you are looking for:

eps = 0.1
g1 = 1
random = Table[{x, y, RandomReal[]}, {x, 0, 2 π, 2 π/10}, {y, 
    0, 2 π, 2 π/10}];
random[[All, -1, -1]] = random[[All, 1, -1]];
random[[-1, All, -1]] = random[[1, All, -1]];
iniIF = Interpolation[Flatten[random, 1]];
ini[x_, y_] := 1 + iniIF[x, y]

sols = NDSolve[{
   D[u[x, y, t], t] == (1 + eps) u[x, y, t] + 
     2 (ψ[x, y, t] + ϕ[x, y, t]) + 
     Laplacian[ψ[x, y, t], {x, y}] + 
     Laplacian[ϕ[x, y, t], {x, y}] + g1 u[x, y, t]^2 - 
     u[x, y, t]^3,
   ϕ[x, y, t] == D[u[x, y, t], {y, 2}],
   ψ[x, y, t] == D[u[x, y, t], {x, 2}],
   u[x, y, 0] == ini[x, y],
   ψ[x, y, 0] == 0,
   ϕ[x, y, 0] == 0,
   PeriodicBoundaryCondition[u[x, y, t], x == 2 π, 
    Function[X, X - {2 π, 0}]], 
   PeriodicBoundaryCondition[u[x, y, t], y == 2 π, 
    Function[X, X - {0, 2 π}]]
   }, {u, ψ, ϕ}, {t, 0, 100}, {x, 0, 2 π}, {y, 0, 
   2 π}]

Think about the initial conditions for all dependent variables. Right now, this problem can not be solved. LinearSolve can not find a solution. It's nonlinear so you'd need version 12 for this. If you change the set up to use the TensorGridProduct spatial discretization then you can use an earlier version to solve this. For that replace the PeriodicBoundaryConditions with u[...]==u[...], something like:

sols = NDSolve[{
   D[u[x, y, t], t] == (1 + eps) u[x, y, t] + 
     2 (ψ[x, y, t] + ϕ[x, y, t]) + 
     Laplacian[ψ[x, y, t], {x, y}] + 
     Laplacian[ϕ[x, y, t], {x, y}] + g1 u[x, y, t]^2 - 
     u[x, y, t]^3,
   ϕ[x, y, t] == D[u[x, y, t], {y, 2}],
   ψ[x, y, t] == D[u[x, y, t], {x, 2}],
   u[x, y, 0] == ini[x, y],
   ψ[x, y, 0] == 0,
   ϕ[x, y, 0] == 0,
   u[2 π, y, t] == u[0, y, t], u[x, 2 π, t] == u[x, 0, t]
   }, {u, ψ, ϕ}, {t, 0, 100}, {x, 0, 2 π}, {y, 0, 
   2 π}]

But again, this gives messages. To sort these out more information is needed.

$\endgroup$

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.