Skip to main content
added 271 characters in body
Source Link
Domen
  • 33.4k
  • 3
  • 47
  • 66

You can try with finer discretization by making MaxCellMeasure smaller:

usol = NDSolveValue[{\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) + 
          0.5 Exp[-u[x, y]] - 2. Exp[u[x, y]] == 0., 
      DirichletCondition[
     u[x, y] == 2. Log[1. - 0.5 Sin[2. ArcTan[x, y]]],
         True]}, u, {x, y} \[Element] Disk[], 
   Method -> {FiniteElement, 
     MeshOptions -> {MaxCellMeasure -> 0.0001, 
       MeshElementType -> TriangleElement}}];

Eqsol[x_, y_] := Derivative[2, 0][usol][x, y] + Derivative[0, 2][usol][x, y] +
   0.5 Exp[-usol[x, y]] - 2. Exp[usol[x, y]];

Plot3D[Evaluate@Eqsol[x, y], {x, y} \[Element] Disk[], PlotRange -> Full, AxesLabel -> Automatic]

Finer mesh Error

FurthermoreHowever, you canplease read in this Mathematica FEM Tutorial about why thisyour way of verifying the result of NDSolveValue results in an overestimatedNDSolveValue gives you falsely exaggerated error. It has to do with calculating the derivative of interpolating function, which is not numerically stable.

You can try with finer discretization by making MaxCellMeasure smaller:

usol = NDSolveValue[{\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) + 
          0.5 Exp[-u[x, y]] - 2. Exp[u[x, y]] == 0., 
      DirichletCondition[
     u[x, y] == 2. Log[1. - 0.5 Sin[2. ArcTan[x, y]]],
         True]}, u, {x, y} \[Element] Disk[], 
   Method -> {FiniteElement, 
     MeshOptions -> {MaxCellMeasure -> 0.0001, 
       MeshElementType -> TriangleElement}}];

Eqsol[x_, y_] := Derivative[2, 0][usol][x, y] + Derivative[0, 2][usol][x, y] +
   0.5 Exp[-usol[x, y]] - 2. Exp[usol[x, y]];

Plot3D[Evaluate@Eqsol[x, y], {x, y} \[Element] Disk[], PlotRange -> Full, AxesLabel -> Automatic]

Finer mesh Error

Furthermore, you can read in this Mathematica FEM Tutorial why this way of verifying the result of NDSolveValue results in an overestimated error.

You can try with finer discretization by making MaxCellMeasure smaller:

usol = NDSolveValue[{\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) + 
          0.5 Exp[-u[x, y]] - 2. Exp[u[x, y]] == 0., 
      DirichletCondition[
     u[x, y] == 2. Log[1. - 0.5 Sin[2. ArcTan[x, y]]],
         True]}, u, {x, y} \[Element] Disk[], 
   Method -> {FiniteElement, 
     MeshOptions -> {MaxCellMeasure -> 0.0001, 
       MeshElementType -> TriangleElement}}];

Eqsol[x_, y_] := Derivative[2, 0][usol][x, y] + Derivative[0, 2][usol][x, y] +
   0.5 Exp[-usol[x, y]] - 2. Exp[usol[x, y]];

Plot3D[Evaluate@Eqsol[x, y], {x, y} \[Element] Disk[], PlotRange -> Full, AxesLabel -> Automatic]

Finer mesh Error

However, please read this Mathematica FEM Tutorial about why your way of verifying the result of NDSolveValue gives you falsely exaggerated error. It has to do with calculating the derivative of interpolating function, which is not numerically stable.

added 271 characters in body
Source Link
Domen
  • 33.4k
  • 3
  • 47
  • 66

You can try with finer discretization by making MaxCellMeasure smaller:

usol = NDSolveValue[{\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) + 
          0.5 Exp[-u[x, y]] - 2. Exp[u[x, y]] == 0., 
      DirichletCondition[
     u[x, y] == 2. Log[1. - 0.5 Sin[2. ArcTan[x, y]]],
         True]}, u, {x, y} \[Element] Disk[], 
   Method -> {FiniteElement, 
     MeshOptions -> {MaxCellMeasure -> 0.0001, 
       MeshElementType -> TriangleElement}}];

Eqsol[x_, y_] := Derivative[2, 0][usol][x, y] + Derivative[0, 2][usol][x, y] +
   0.5 Exp[-usol[x, y]] - 2. Exp[usol[x, y]];

Plot3D[Evaluate@Eqsol[x, y], {x, y} \[Element] Disk[], PlotRange -> Full, AxesLabel -> Automatic]

Finer mesh Error

Furthermore, you can read in this Mathematica FEM Tutorial why this way of verifying the result of NDSolveValue results in an overestimated error.

You can try with finer discretization by making MaxCellMeasure smaller:

usol = NDSolveValue[{\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) + 
          0.5 Exp[-u[x, y]] - 2. Exp[u[x, y]] == 0., 
      DirichletCondition[
     u[x, y] == 2. Log[1. - 0.5 Sin[2. ArcTan[x, y]]],
         True]}, u, {x, y} \[Element] Disk[], 
   Method -> {FiniteElement, 
     MeshOptions -> {MaxCellMeasure -> 0.0001, 
       MeshElementType -> TriangleElement}}];

Eqsol[x_, y_] := Derivative[2, 0][usol][x, y] + Derivative[0, 2][usol][x, y] +
   0.5 Exp[-usol[x, y]] - 2. Exp[usol[x, y]];

Plot3D[Evaluate@Eqsol[x, y], {x, y} \[Element] Disk[], PlotRange -> Full, AxesLabel -> Automatic]

Finer mesh Error

You can try with finer discretization by making MaxCellMeasure smaller:

usol = NDSolveValue[{\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) + 
          0.5 Exp[-u[x, y]] - 2. Exp[u[x, y]] == 0., 
      DirichletCondition[
     u[x, y] == 2. Log[1. - 0.5 Sin[2. ArcTan[x, y]]],
         True]}, u, {x, y} \[Element] Disk[], 
   Method -> {FiniteElement, 
     MeshOptions -> {MaxCellMeasure -> 0.0001, 
       MeshElementType -> TriangleElement}}];

Eqsol[x_, y_] := Derivative[2, 0][usol][x, y] + Derivative[0, 2][usol][x, y] +
   0.5 Exp[-usol[x, y]] - 2. Exp[usol[x, y]];

Plot3D[Evaluate@Eqsol[x, y], {x, y} \[Element] Disk[], PlotRange -> Full, AxesLabel -> Automatic]

Finer mesh Error

Furthermore, you can read in this Mathematica FEM Tutorial why this way of verifying the result of NDSolveValue results in an overestimated error.

Source Link
Domen
  • 33.4k
  • 3
  • 47
  • 66

You can try with finer discretization by making MaxCellMeasure smaller:

usol = NDSolveValue[{\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) + 
          0.5 Exp[-u[x, y]] - 2. Exp[u[x, y]] == 0., 
      DirichletCondition[
     u[x, y] == 2. Log[1. - 0.5 Sin[2. ArcTan[x, y]]],
         True]}, u, {x, y} \[Element] Disk[], 
   Method -> {FiniteElement, 
     MeshOptions -> {MaxCellMeasure -> 0.0001, 
       MeshElementType -> TriangleElement}}];

Eqsol[x_, y_] := Derivative[2, 0][usol][x, y] + Derivative[0, 2][usol][x, y] +
   0.5 Exp[-usol[x, y]] - 2. Exp[usol[x, y]];

Plot3D[Evaluate@Eqsol[x, y], {x, y} \[Element] Disk[], PlotRange -> Full, AxesLabel -> Automatic]

Finer mesh Error