[petsc-users] petsc4py
Jed Brown
jed at 59A2.org
Sun Sep 26 05:54:46 CDT 2010
2010/9/26 Николай Кутузов <kutuzovnp at gmail.com>:
> 1) First of all, can you describe in a bit more detailed way the usage of
> AppCtx class of matfree.py module to solve ODE systems
> (determined as in rober.py), without jacobian initialisation, in other words
> how can change rober.py to solve this issue?
You can just skip the ts.setIJacobian call and run with -snes_mf. Or
set an approximate Jacobian that way, but use it only for
preconditioning, with -snes_mf_operator. Run with -ts_view to confirm
that you are running what you think you are.
> 2) Does THETA integration implement time step adaptation?
No, and it doesn't come with a built-in error estimate. TSGL does
adaptation, but the controller for adaptive order (-ts_adapt_type
both) is not at all robust, so I recommend using -ts_adapt_type step
or writing your own controller (see src/ts/impls/implicit/gl/gladapt.c
for examples).
> 3) Suppose i have a large ODE system, how can i implement multiprocessor
> (parallel) integration in a way similar with those (function definition and
> plotting) in rober.py?
Lisandro might have other suggestions, but
src/ts/examples/tutorials/ex8.py solves a transient Bratu problem in
parallel. Get it from dev, the copy in 3.1 does not work correctly in
parallel for superficial indexing reasons:
http://petsc.cs.iit.edu/petsc/petsc-dev/file/c03db8f211dd/src/ts/examples/tutorials/ex8.py
You can run it like (it uses TSGL by default)
mpiexec -n 4 python ex8.py -M 40 -ts_monitor -ts_monitor_solution
-ts_max_steps 1000 -ts_adapt_type size
Note that theta=0.5 is highly oscillatory for this problem, use
something like -ts_type theta -ts_theta_theta 0.8 for a more stable
solution.
You could of course plot the solution using Matplotlib (as in, e.g.
bratu2d.py) instead, but you would have to gather it to process 0
because Matplotlib is not parallel. Other options include just
writing out the state at the time steps you are interested in, or
(much more effort) using libsim from VisIt to get live visualization
and interaction with your running parallel program.
Jed
More information about the petsc-users
mailing list