4
$\begingroup$

When solving ODE's one can use options like MaxStepFraction to control the number of grid points.

When solving PDE's SpatialDiscretization option in MethodOfLines allows one to choose MinPoints for the spatial grid.

However there seem to be no such option as TemporalDiscretization.

How can one customize discretization along t-axis in MethodOfLines ?

$\endgroup$

1 Answer 1

3
$\begingroup$

Still, it's MaxStepSize/MaxStepFraction.

If you give a single number as the option value of these options, that option value will be used for every dimension of the PDE.

If you give a number list whose length is the same as the number of independent variable of the PDE as the option value (yeah this syntax is undocumented but valid), the list of numbers will be used as the option values for corresponding dimension. Here is an example.

All of the statement above can be verified by checking "Coordinates" of InterpolatingFunction generated by NDSolve. (If you don't know how to check, read this post. )

Nevertheless, notice that:

  1. The initial value problem (IVP) solver of NDSolve is quite robust and we don't need to adjust time step choosing in most cases.

  2. There's no MinStepSize/MinStepFraction option for NDSolve so we still need to adjust sub-option of TensorProductGrid if we need to control the spatial step size accurately.

$\endgroup$
3
  • $\begingroup$ So if I use "MinPoints" -> 70 along with MaxStepFraction -> {Automatic, Automatic, 0.1} then which option will be actually used by NDSolve? (I think Automatic corresponds to "MinPoints" -> 20 or "MinPoints" -> 25). $\endgroup$
    – user67126
    Commented Sep 4, 2019 at 6:51
  • 1
    $\begingroup$ @jheidk51 "MinPoints"/"MaxPoints" will override Automatic of MaxStepFraction/MaxStepSize. You can verify this by checking "Coordinates" of the generated InterpolatingFunction. $\endgroup$
    – xzczd
    Commented Sep 4, 2019 at 6:57
  • $\begingroup$ @Harry As mentioned above, MinStepSize isn't an option for NDSolve. When being a sub-option of TensorProductGrid, it only controls spatial discretization. I think it's reasonable: the ODE solver is already self-adaptive, manually setting a MinStepSize for it will probably break the solver. If you really want to set a MinStepSize in t direction, I think your only choice is the FixedStep method. $\endgroup$
    – xzczd
    Commented Nov 5, 2020 at 14:49

Your Answer

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