3

I am solving a 2D PDE in space and time b(r,t) and would like to find the maximum value of b in space as a function of time t.

Using the solution for maximising a 1D interpolating function from here, I tried the following minimal working example, but it doesn't work:

largerad = 10;
tmax = 80;
b0 = 0.1;

pde = {D[b[r, t], t] == D[b[r, t], r, r] - b[r, t]}; ic = {b[r, 0] == b0}; bc = {Derivative[1, 0][b][largerad, t] == 0, Derivative[1, 0][b][0, t] == 0};

zsolv = NDSolve[{pde, ic, bc}, {b}, {r, 0, largerad}, {t, 0, tmax}, MaxStepSize -> 0.01];

Nbins = 200;

mytableb = Table[NMaximize[{ b[r, t] /. zsolv, 0 <= r <= rad}, r, Method -> "SimulatedAnnealing"], {t, 0, tmax, tmax/Nbins}];

Does anyone have a suggestion for an alternative implementation that would give b_max(t) as a list of values?

Edit: I'm looking for a general solution, also for PDE's that are not exactly solvable using DSolve. I just gave this as a simple example.

  • DSolve [{pde, ic, bc}, b , {r, 0, largerad}, {t, 0, tmax} ] evaluates the exact solution {b -> Function[{r, t}, 0.1 2.71828^(-1. t)]}} which doesn't depend on r! – Ulrich Neumann Mar 29 '22 at 16:54
  • Thanks! However, I'm looking for a general solution, also for PDE's that are not exactly solvable using DSolve. I just gave this as a simple example. I clarified that in an edit. – selforgphysics Mar 31 '22 at 13:27
  • In my comment I tried to emphasize that your example has no unique solution, that's why a numerical solution can't be found – Ulrich Neumann Mar 31 '22 at 14:30

1 Answers1

3

An easy approximation is to pick out the max values from the interpolation grid.

bval = b@"ValuesOnGrid" /. First@zsolv // Transpose;

bmax = Interpolation[ Transpose@{Last[b@"Coordinates" /. First@zsolv], Max /@ bval}]; ListLogPlot[bmax, Joined -> True]

Michael E2
  • 235,386
  • 17
  • 334
  • 747