Skip to main content
edited tags
Link
user21
  • 42.2k
  • 8
  • 116
  • 176
edited tags
Link
Karsten7
  • 27.7k
  • 5
  • 76
  • 138
deleted 41 characters in body
Source Link
chris
  • 23.4k
  • 5
  • 63
  • 154

I would like to understand, how to obtain gradients of the PDE solution obtained with NDSolve. To be precise let us consider a Laplace equation from one of the examples:

 Clear[x, y, f]; Needs["NDSolve`FEM`"] emesh = ToElementMesh[Disk[]]; f = NDSolveValue[{\!\( \*SubsuperscriptBox[\(\[Del]\)Derivative[0, \({x2][u][x, y}\)y] + Derivative[2, \(2\)]\(u[x0][u][x, y]\)\)y] == 0, DirichletCondition[u[x, y] == Sin[x y], True]}, u, {x, y} \[Element] emesh] 

This returns the interpolation function which one can plot and integrate:

 NIntegrate[f[x, y], {x, y} \[Element] emesh] (* 1.52794*10^-8 *) Plot3D[f[x, y], {x, y} \[Element] emesh] 

enter image description here

This, however, does not work:

 g[x_, y_] := D[f[x, y], x]; Plot3D[g[x, y], {x, y} \[Element] emesh] 

Since Integrate does not work on this result, only NIntegrate does, the problem is probably that one needs to apply a numeric derivative. What and how?

I would like to understand, how to obtain gradients of the PDE solution obtained with NDSolve. To be precise let us consider a Laplace equation from one of the examples:

 Clear[x, y, f]; Needs["NDSolve`FEM`"] emesh = ToElementMesh[Disk[]]; f = NDSolveValue[{\!\( \*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[x, y]\)\) == 0, DirichletCondition[u[x, y] == Sin[x y], True]}, u, {x, y} \[Element] emesh] 

This returns the interpolation function which one can plot and integrate:

 NIntegrate[f[x, y], {x, y} \[Element] emesh] (* 1.52794*10^-8 *) Plot3D[f[x, y], {x, y} \[Element] emesh] 

enter image description here

This, however, does not work:

 g[x_, y_] := D[f[x, y], x]; Plot3D[g[x, y], {x, y} \[Element] emesh] 

Since Integrate does not work on this result, only NIntegrate does, the problem is probably that one needs to apply a numeric derivative. What and how?

I would like to understand, how to obtain gradients of the PDE solution obtained with NDSolve. To be precise let us consider a Laplace equation from one of the examples:

 Clear[x, y, f]; Needs["NDSolve`FEM`"] emesh = ToElementMesh[Disk[]]; f = NDSolveValue[{Derivative[0, 2][u][x, y] + Derivative[2, 0][u][x, y] == 0, DirichletCondition[u[x, y] == Sin[x y], True]}, u, {x, y}  emesh] 

This returns the interpolation function which one can plot and integrate:

 NIntegrate[f[x, y], {x, y}  emesh] (* 1.52794*10^-8 *) Plot3D[f[x, y], {x, y}  emesh] 

enter image description here

This, however, does not work:

 g[x_, y_] := D[f[x, y], x]; Plot3D[g[x, y], {x, y}  emesh] 

Since Integrate does not work on this result, only NIntegrate does, the problem is probably that one needs to apply a numeric derivative. What and how?

added 1 character in body
Source Link
chris
  • 23.4k
  • 5
  • 63
  • 154
Loading
added 2 characters in body
Source Link
chris
  • 23.4k
  • 5
  • 63
  • 154
Loading
Source Link
Alexei Boulbitch
  • 40.8k
  • 2
  • 51
  • 102
Loading