[petsc-users] Advice on small block matrix vector multiplication
Matthew Knepley
knepley at gmail.com
Sun Jun 18 13:35:25 CDT 2023
On Sun, Jun 18, 2023 at 2:13 PM Duan Junming via petsc-users <
petsc-users at mcs.anl.gov> wrote:
> Dear all,
>
> I am using DMPlex to manage the unknowns, two fields, one for pressure,
> and one for velocities with two/three components, defined in each cell.
> They're represented by polynomials, with N (10~50) dofs for each component.
> I have an operator which can be written in a matrix form (N-by-N, dense),
> to be applied on the pressure field or each component of the velocities in
> each cell (the same for each cell and also for each component).
> I was wondering which matrix should be defined to implement the block
> matrix-vector multiplication, here block means the pressure or the
> component of the velocities. Maybe a sequential block mat? Could you
> recommend any example?
> Or I just implement this matrix-vector multiplication by hand?
>
1) It sounds like you have a collocated discretization, meaning p,u,v,w are
all at the same spots. Is this true?
2) You have a dense operator, like FFT, that can act on each component
3) I think you should make a vector with blocksize d+1 and extract the
components with
https://petsc.org/main/manualpages/Vec/VecStrideGather/
then act on them, then restore with
https://petsc.org/main/manualpages/Vec/VecStrideScatter/
You can use the *All() versions to do all the components at once.
Thanks,
Matt
> Thanks!
> Junming
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230618/187f1fbf/attachment-0001.html>
More information about the petsc-users
mailing list