# Extract data from NDSolveValue result

Okay this is a very newbie question. I have coded a sample problem that solves the heat diffusion equation on an annulus. Here's what I have:

Dom = ImplicitRegion[x^2 + y^2 >= 1 && x^2 + y^2 <= 5, {x, y}];
C = {DirichletCondition[u[x, y] == 200., x^2 + y^2 == 1], DirichletCondition[u[x, y] == 0., x^2 + y^2 == 5]};

result = NDSolveValue[{\!$$\*SubsuperscriptBox[\(\[Del]$$, $${x, y}$$, $$2$$]$$u[x, y]$$\) ==  0, C}, u, {x, y} \[Element] Dom];


I can plot the data as a contour plot. All that is good. Now, say I want to get the mean of the temperature. How I do that? I imagine the data is contained in the variable 'result', but it is very opaque to me.

You can use NIntegrate to do that, like this

NIntegrate[result[x, y], {x, y} \[Element] Dom]/
NIntegrate[1, {x, y} \[Element] Dom] // Chop // AbsoluteTiming
(*74.23246590163654*)


Chop is nessary because the result contains a very small imaginary part I'm sorry for that I don't know why these warnings occurs, but it seems harmless.

There is another way which can avoid the warnings but give a result with larger error and spend more time

dom = DiscretizeRegion[Dom, AccuracyGoal -> 2];
NIntegrate[result[x, y], {x, y} \[Element] dom]/
NIntegrate[1, {x, y} \[Element] dom]
(*74.8653680261704*)


Chose larger AccuaryGoal can improve the accuary of the result, but costs more time Dom = ImplicitRegion[
x^2 + y^2 >= 1 && x^2 + y^2 <= 5, {x, y}];

c = {
DirichletCondition[u[x, y] == 200, x^2 + y^2 == 1],
DirichletCondition[u[x, y] == 0, x^2 + y^2 == 5]};

result = NDSolveValue[{\!$$\*SubsuperscriptBox[\(\[Del]$$, $${x, y}$$, $$2$$]$$u[x, y]$$\) ==  0, c},
u, {x, y} \[Element] Dom];

GraphicsRow[{
ContourPlot[result[x, y],
{x, -Sqrt, Sqrt},
{y, -Sqrt[5 - x^2], Sqrt[5 - x^2]},
PlotPoints -> 75,
Contours -> Range[0, 200, 25],
ColorFunction -> "Temperature",
RegionFunction ->
Function[{x, y, z}, Dom[]]],
Plot3D[result[x, y],
{x, -Sqrt, Sqrt},
{y, -Sqrt[5 - x^2], Sqrt[5 - x^2]},
PlotPoints -> 50,
ColorFunction -> "Temperature",
RegionFunction ->
Function[{x, y, z}, Dom[]]]},
ImageSize -> 500] The area is given by RegionMeasure[Dom]

avg = NIntegrate[result[x, y], {x, y} \[Element] Dom]/
RegionMeasure[Dom] // Quiet


74.2325