Skip to main content
deleted 21 characters in body
Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489

Rule of thumb: if NDSolve doesn't work well on solving PDE, and you're sure you haven't made any simple mistake, then the first thing to do is to increaseusually the points forproblem lies in spatial discretization. When TensorProductGrid is chosen for spatial discretization, usually we adjust MinPoints and MaxPoints sub-option, here is an example. When FiniteElement is chosen for spatial discretization, usually we adjust MaxCellMeasure sub-option for the task.

molfem[measure_: Automatic] := {"MethodOfLines", 
   "SpatialDiscretization" -> {"FiniteElement", 
     "MeshOptions" -> MaxCellMeasure -> measure}};

sol = NDSolveValue[
       {MvFP,
         p[x, y, 0] == delt[x, y], DirichletCondition[p[x, y, t] == 0, True]
         },
       p, {t, 0, 1}, {y, -5, 5}, {x, -5, 5}, Method -> molfem[0.01]
       ]; // AbsoluteTiming
(* {4.31252, Null} *)

enter image description here

molfem is a function I keep in my SystemOpen@"init.m" file because adjustion of MaxCellMeasure option is so frequently needed when playing with NDSolve. DirichletCondition[p[x, y, t] == 0, True] is equivalent to your original b.c.s but conciser.

Rule of thumb: if NDSolve doesn't work well on solving PDE, and you're sure you haven't made any simple mistake, then the first thing to do is to increase the points for spatial discretization. When TensorProductGrid is chosen for spatial discretization, usually we adjust MinPoints sub-option, here is an example. When FiniteElement is chosen for spatial discretization, usually we adjust MaxCellMeasure sub-option for the task.

molfem[measure_: Automatic] := {"MethodOfLines", 
   "SpatialDiscretization" -> {"FiniteElement", 
     "MeshOptions" -> MaxCellMeasure -> measure}};

sol = NDSolveValue[
       {MvFP,
         p[x, y, 0] == delt[x, y], DirichletCondition[p[x, y, t] == 0, True]
         },
       p, {t, 0, 1}, {y, -5, 5}, {x, -5, 5}, Method -> molfem[0.01]
       ]; // AbsoluteTiming
(* {4.31252, Null} *)

enter image description here

molfem is a function I keep in my SystemOpen@"init.m" file because adjustion of MaxCellMeasure option is so frequently needed when playing with NDSolve. DirichletCondition[p[x, y, t] == 0, True] is equivalent to your original b.c.s but conciser.

Rule of thumb: if NDSolve doesn't work well on solving PDE, and you're sure you haven't made any simple mistake, then usually the problem lies in spatial discretization. When TensorProductGrid is chosen for spatial discretization, usually we adjust MinPoints and MaxPoints sub-option, here is an example. When FiniteElement is chosen for spatial discretization, usually we adjust MaxCellMeasure sub-option.

molfem[measure_: Automatic] := {"MethodOfLines", 
   "SpatialDiscretization" -> {"FiniteElement", 
     "MeshOptions" -> MaxCellMeasure -> measure}};

sol = NDSolveValue[
       {MvFP,
         p[x, y, 0] == delt[x, y], DirichletCondition[p[x, y, t] == 0, True]
         },
       p, {t, 0, 1}, {y, -5, 5}, {x, -5, 5}, Method -> molfem[0.01]
       ]; // AbsoluteTiming
(* {4.31252, Null} *)

enter image description here

molfem is a function I keep in my SystemOpen@"init.m" file because adjustion of MaxCellMeasure option is so frequently needed when playing with NDSolve. DirichletCondition[p[x, y, t] == 0, True] is equivalent to your original b.c.s but conciser.

Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489

Rule of thumb: if NDSolve doesn't work well on solving PDE, and you're sure you haven't made any simple mistake, then the first thing to do is to increase the points for spatial discretization. When TensorProductGrid is chosen for spatial discretization, usually we adjust MinPoints sub-option, here is an example. When FiniteElement is chosen for spatial discretization, usually we adjust MaxCellMeasure sub-option for the task.

molfem[measure_: Automatic] := {"MethodOfLines", 
   "SpatialDiscretization" -> {"FiniteElement", 
     "MeshOptions" -> MaxCellMeasure -> measure}};

sol = NDSolveValue[
       {MvFP,
         p[x, y, 0] == delt[x, y], DirichletCondition[p[x, y, t] == 0, True]
         },
       p, {t, 0, 1}, {y, -5, 5}, {x, -5, 5}, Method -> molfem[0.01]
       ]; // AbsoluteTiming
(* {4.31252, Null} *)

enter image description here

molfem is a function I keep in my SystemOpen@"init.m" file because adjustion of MaxCellMeasure option is so frequently needed when playing with NDSolve. DirichletCondition[p[x, y, t] == 0, True] is equivalent to your original b.c.s but conciser.