Yuyun,
DMDA is an add-on on top of Vec/Mat (it doesn't replace anything in them)
DMDA manages the parallel layout of your structured grid across the
processes so you don't have to manage that yourself. So, for structured grids
using DMDA is actually easier than you having to manage partitioning the domain
and setting up communication yourself. DMDA does it for you and choices
partitions to minimize communications needed.
You should look at the examples in src/ksp/ksp/examples/tutorials for
linear problems and src/snes/examples/tutorials/ for nonlinear problems that
use DMDACreate to see what the code looks like. Pick an example that is like
your problem and copy it as a starting point.
Barry
> On Mar 11, 2019, at 3:17 PM, Yuyun Yang via petsc-users
> <[email protected]> wrote:
>
> Hello team,
>
> May I know for what types of computations is DMDA better to use compared to
> regular Vec/Mat? It is more complicated in terms of usage, thus so far I’ve
> only used Vec/Mat. Would DMDA improve the performance of solving large linear
> systems (say for variable grid spacing as a result of coordinate transforms,
> with finite difference method)? What considerations should go into
> implementing it?
>
> Thank you very much!
> Yuyun