Message Boards Message Boards

Solve an Elliptic PDE for u[x,y] with the rhs given by numerical f[u]?

GROUPS:

I have a somewhat unusual mathematical problem. I need to solve numerically a second order elliptic PDE for u[x,y] with the right hand side given by numerical function F[u], that is, some give function of u, not of [x,y].

In 1D things work well

(* make interpolation of a linear function: *)
FofA = Interpolation[Table[{x, x}, {x, 0, 1, 10^-2}]]; 
 (*construct a numerical function from the interpolation: *)
FofA1[x_] := FofA[z] /. z -> x 
(* Find solutions for u’ = FofA1[u] *)
uofx = Flatten[
    NDSolve[{Dt[u[x], x] == (FofA1[u[x]]), u[1] == 1}, 
     u, {x, 0, 1}]].{1};
(*  Plot it and compare with analytical *)
Show[{Plot[u[x] /. uofx, {x, 0, 1}, PlotRange -> All], 
  Plot[E^(-1 + x), {x, 0, 1}]}]

But in 2D it fails. One of the hints, I think is: if I try to solve Poisson equation in the form

D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}] == u[x, y]

the NDSolveValue works OK, but it fails for

D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}] == u[x, y]^{1.}

(when the rhs is numerically evaluated)

Thanks a lot for the insight.

POSTED BY: Maxim Lyutikov
Answer
7 months ago

Perhaps you meant u[x, y]^(1.) in the last equation, instead of u[x, y]^{1.}?

However, I think only linear F's are supported in the current version of NDSolve for pde. Try

NDSolve[{Laplacian[u[x, y], {x, y}] == u[x, y]^2, 
  DirichletCondition[u[x, y] == x + y, True]}, u, {x, y} \[Element] 
  Disk[]]
POSTED BY: Gianluca Gorni
Answer
7 months ago

D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}] == u[x, y]^(1.) is still a linear PDE, but Mathematica cannot handle it.

Yes, a related problem is NDSolve::femnonlinear: Nonlinear coefficients are not supported in this version of NDSolve.

POSTED BY: Maxim Lyutikov
Answer
7 months ago

For some purposes a floating point real exponent is not treated the same as an integer exponent, and it calls different algorithms. Try

PolynomialQ[x^1., x]
POSTED BY: Gianluca Gorni
Answer
7 months ago

OK. Still, is there a way to solve elliptic equation with the numerically given right hand side?

POSTED BY: Maxim Lyutikov
Answer
7 months ago

Group Abstract Group Abstract