0
$\begingroup$

have some problem with Neumann boundary conditions over simple rectangle. Here my code

currentTime := 0;
bounds := 4;
timeLimit := 50;
rect = Rectangle[{-bounds, -bounds}, {+bounds, +bounds}]
bsf = Interpolation@Flatten[Table[{{x, y}, 0.5 + 0.2 * RandomReal[{-1, 1}]}, {x, -bounds, +bounds}, {y, -bounds, +bounds}], 1];
initial = {f[x, y, 0] == bsf[x, y], D[f[-bounds, -bounds, t], t] == D[f[bounds, -bounds, t], t] ==D[f[-bounds, bounds, t], t] == D[f[bounds, bounds, t], t] == 0}
equation := With[{d = 0.1, a = 0.8, b = 0.005, c = 0.0005, g = 0.000005,    tm = 0.3, tmc = 0.2}, D[f[x, y, t], t] == d*Laplacian[a*(tm - tmc)*f[x, y, t] - (b*f[x, y, t]^3) + (c*f[x, y, t]^5) - g*Laplacian[f[x, y, t], {x, y}], {x, y}]]
ProgressIndicator[Dynamic[currentTime], {0, timeLimit}]
result = NDSolve[{equation, initial}, f[x, y, t], {x, y} \[Element] rect, {t, 0.1, timeLimit}, EvaluationMonitor :> (currentTime = t;), Method -> {"MethodOfLines", Method -> {"FixedStep", "StepSize" -> .5, 
  Method -> "ImplicitRungeKutta"}, "SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 50, "MaxPoints" -> 100}}]
plots = Table[DensityPlot[f[x, y, t] /. result, {x, y} \[Element] rect], {t,0,timeLimit, 0.5}];
ListAnimate[plots]

There are error "Boundary conditions is not specified on a single edge of the boundary of the computational domain", but i already specified conditions. What's wrong ?

Thanks for attention !

$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Jan 10 '16 at 23:08
0
$\begingroup$

What's wrong: at least the boundary condition. They are defined only in 4 points, (-bounds,-bounds), (bounds,-bounds), etc.

You need to define them on the edge, that is

f[x,bounds,0] == Sin[x]

for example. Redefine your initial variable and try again, there may be other errors.

$\endgroup$
2
  • $\begingroup$ I defined boundaries on edges initial = {f[x, y, 0] == bsf[x, y], D[f[x, -bounds, t], t] == D[f[x, +bounds, t], t] == D[f[-bounds, y, t], t] == D[f[bounds, y, t], t] == 0} but still have same error. May be exist more.. correct way to define Neumann boundaries over rectangle ? $\endgroup$
    – K. Lonhus
    Jan 11 '16 at 9:29
  • $\begingroup$ Your derivative is with respect to time, so that's not a neumann condition, you need to derivate with respect to space. Have you looked at the reference $\endgroup$ Jan 11 '16 at 13:42

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.