# [petsc-users] Solving advection equations implicitly

Zou, Ling ling.zou at inl.gov
Mon May 7 17:00:58 CDT 2018

```I played with implicitly (BDF1 and BDF2) solving a linear advection
equation before.
For spatial discretization, I used upwind donor cell method.
I did not give any specifications to the solver, so I suppose default works
just fine. I did supply a Jacobian matrix for preconditioning purpose.

Here a screen shot of -snes_view and -ksp_view is attached.
Maybe PETSc team member could provide more useful info from this screenshot.

Hope this helps.

-Ling

SNES Object: 1 MPI processes

type: newtonls

maximum iterations=50, maximum function evaluations=10000

tolerances: relative=1e-08, absolute=1e-50, solution=1e-08

total number of linear solver iterations=6

total number of function evaluations=11

norm schedule ALWAYS

SNESLineSearch Object: 1 MPI processes

type: bt

interpolation: cubic

alpha=1.000000e-04

maxstep=1.000000e+08, minlambda=1.000000e-12

tolerances: relative=1.000000e-08, absolute=1.000000e-15,
lambda=1.000000e-08

maximum iterations=40

KSP Object: 1 MPI processes

type: gmres

restart=30, using Classical (unmodified) Gram-Schmidt
Orthogonalization with no iterative refinement

happy breakdown tolerance 1e-30

maximum iterations=30, initial guess is zero

tolerances:  relative=0.001, absolute=1e-50, divergence=10000.

left preconditioning

using PRECONDITIONED norm type for convergence test

PC Object: 1 MPI processes

type: ilu

out-of-place factorization

0 levels of fill

tolerance for zero pivot 2.22045e-14

matrix ordering: natural

factor fill ratio given 1., needed 1.

Factored matrix follows:

Mat Object: 1 MPI processes

type: seqaij

rows=600, cols=600

package used to perform factorization: petsc

total: nonzeros=2994, allocated nonzeros=2994

total number of mallocs used during MatSetValues calls =0

not using I-node routines

linear system matrix followed by preconditioner matrix:

Mat Object: 1 MPI processes

type: mffd

rows=600, cols=600

Matrix-free approximation:

err=1.49012e-08 (relative error in function evaluation)

Using wp compute h routine

Does not compute normU

Mat Object: 1 MPI processes

type: seqaij

rows=600, cols=600

total: nonzeros=2994, allocated nonzeros=2994

total number of mallocs used during MatSetValues calls =0

not using I-node routines

On Mon, May 7, 2018 at 3:24 PM, Nishant Nangia <nishantnangia329 at gmail.com>
wrote:

> Hi all,
>
> I want to implicitly solve a linear advection equation of the form:
> dQ/dt + div(u*Q) = 0
>
> for a scalar quantity Q, with some known velocity field u. Note that it is
> purely advection with no diffusion term.
>
> Is there a recommended solver/preconditioner combination to solve
> something like this?
>
> *Nishant Nangia*
> Northwestern University
> Ph.D. Candidate | Engineering Sciences and Applied Mathematics
> Tech L386
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180507/0c793485/attachment-0001.html>
```