# problem of parallel MatAssembled

Gong Ding gdiso at ustc.edu
Fri May 30 11:36:03 CDT 2008

```----- Original Message -----
From: "Lisandro Dalcin" <dalcinl at gmail.com>
To: <petsc-users at mcs.anl.gov>
Sent: Friday, May 30, 2008 11:37 PM
Subject: Re: problem of parallel MatAssembled
> Are you completelly sure that you collectively called at ALL processes
>
> MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY)
> MatAssemblyEndA, MAT_FINAL_ASSEMBLY)
>
> Please, note the MAT_FINAL_ASSEMBLY. If you used MAT_FLUSH_ASSEMBLY at
> some process, then what you get is expected.

I will check it.

> Not sure what you are trying to do, please elaborate a bit more. Why a
> call like this
>
> PetscInt row = ...
> PetscInt ncols = ...
> PetscInt *cols_indices = ...
> PetscScalar *cols_values = ...
>
> MatSetValues(A, 1, &row, ncols, cols_indices, cols_values, ADD_VALUES)
>
> is not enough for you?

I am using a complex way to deal with multi-material domain.
The domain is  decomposed into several regions with different material.
Each region has its own governing equation. As a result, I first build
equation on each region, then processing
region interface and boundary.
Many boundary types (more than 10) exising to my problem.

For a node located on the region interface, the two region both own a copy
of the node, so I need to combine
the governing equation of the two node. For a variable with continuous value
on the interface, the sum of 2 equation should be zero and the
value of two node should be equal. So I need to add some rows to other rows
to the petsc vector.and give a euqation as  v1-v2=0

And the equation is nonlinear, I have to evaluate  Jacobian matrix, which is
done by AD from the equation evaluation in each region.
So I also need to add some rows of jacobian matrix to other rows.
I wonder how others process multi-material problem?

G.D.

```

More information about the petsc-users mailing list