Inspired by the highly interesting question Solving Burger's equation with NDSolve at large time I'll try to understand Finite-Element-solution for nonlinear pde in more detail:

Burger pde

$u_t(x,t)+u(x,t) u_x(x,t)=0$

with initial condition $u(x,0)=x+1$ is solved by


0==Derivative[0, 1][u][x, t]  + u[x, t] Derivative[1, 0][u][x, t]  
/. u ->Function[{x, t}, (x + 1)/(t + 1) ] (*True*)

Method-FiniteElements is able to approximate this solution quite well

U = NDSolveValue[{Derivative[0, 1][u][x,t]  +  
u[x, t] Derivative[1, 0][u][x, t]  == 
NeumannValue[0, True], 
u[x, 0] == 1 + x}, u, {x, 0, 1}, {t, 0,5}];

Plot[{U[x, #] , (1 + x)/(1 + #)} // Evaluate, {x, 0, 1},AxesLabel -> {"x", "U[x,t]"},PlotStyle -> {Blue, {Dashed, Red}} ] &[1]

enter image description here

To enforce MethodOfLinesand FiniteElement I used NeumannValue on the right hand side of the pde in NDSolveValue

My question

How is NeumannValue defined in this nonlinear case?

I expected something like u[x,t]^2/2 or D[u[x,t]^2/2,x] , but expressions don't vanish at x==0,x==1. Same with D[u[x,t] ,x].


  • 1
    $\begingroup$ Happy to see someone asking this. (I noticed there seems to be an issue when answering the linked question but is too lazy to post a question. ) In principle we can use NDSolve`FEM`GetInactivePDE to determine the NeumannValue, but obviously NDSolve`FEM`GetInactivePDE isn't working properly in this case. (The output is u[x] u'[x] + Derivative[1, 0][u][t, x]! ) user21 should be able to answer this. Let's wait for a moment :) . $\endgroup$
    – xzczd
    May 8, 2022 at 12:00
  • 1
    $\begingroup$ @xzczd Thanks, nice to meet you again today. I'm looking forward to the answer of user21 $\endgroup$ May 8, 2022 at 12:02
  • 1
    $\begingroup$ NeumannValue is defined in relation to anything that is in the Div part of a PDE. There is no such part in this PDE and as such the NeumannValue is not defined. As a side note, note that the coefficient could be parsed as convection coefficient (factor * u') or as a reaction coefficient (factor * u) or possibly also a once size fits all nonlinear right hands side f) but none of those have a relation to a divergence, which is needed for a NeumannValue. $\endgroup$
    – user21
    May 8, 2022 at 16:24
  • $\begingroup$ @user21 Thank you for your detailled answer! That means in this case FiniteElement is some kind of galerkin method? $\endgroup$ May 8, 2022 at 17:42
  • 1
    $\begingroup$ @user21 Thanks. I transformed the second part in the pde u[x, t]Derivative[1, 0][u][x, t] to D[u[x,t]^2,x]/2 $\endgroup$ May 9, 2022 at 12:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.