[petsc-users] Construct Matrix based on row and column values

Elias Karabelas karabelaselias at gmail.com
Mon Mar 23 07:41:06 CDT 2020


Thanks I'll have a look at it. So I understand correctly, that purely 
algebraic is not the way to go through PETSc here?

Cheers

Elias

On 23/03/2020 13:39, Matthew Knepley wrote:
> On Mon, Mar 23, 2020 at 8:38 AM Elias Karabelas 
> <karabelaselias at gmail.com <mailto:karabelaselias at gmail.com>> wrote:
>
>
>     On 23/03/2020 13:36, Matthew Knepley wrote:
>>     On Mon, Mar 23, 2020 at 8:31 AM Elias Karabelas
>>     <karabelaselias at gmail.com <mailto:karabelaselias at gmail.com>> wrote:
>>
>>         Dear Matt,
>>
>>         I've just found this answer from 2014
>>
>>         https://lists.mcs.anl.gov/pipermail/petsc-users/2014-August/022450.html
>>
>>         wondering if this would theoretically work.
>>
>>     In serial certainly, I just don't see how it works in parallel
>>     since you might not own the row you need from the transpose.
>>
>>         And the thing with this FCT-Schemes is, that they're build on
>>         purely algebraic considerations (like AMG) so I don't want to
>>         break it back down to mesh information if possible at all.
>>
>>     The FEM-FCT I am familiar with from Lohner was phrased on a mesh.
>
>     Can you give me a reference to that? I based my things on this
>     work
>     https://www.sciencedirect.com/science/article/pii/S0045782508003150#!
>
> Volker is of course great. I believe I was thinking of 
> https://onlinelibrary.wiley.com/doi/abs/10.1002/fld.1650071007
>
>   Thanks,
>
>     Matt
>
>     Best regards
>
>     Elias
>
>
>>
>>       Thanks,
>>
>>         Matt
>>
>>         Best regards
>>
>>         Elias
>>
>>         On 23/03/2020 13:02, Matthew Knepley wrote:
>>>         On Mon, Mar 23, 2020 at 7:46 AM Elias Karabelas
>>>         <karabelaselias at gmail.com <mailto:karabelaselias at gmail.com>>
>>>         wrote:
>>>
>>>             Dear Users,
>>>
>>>             I want to implement a FCT (flux corrected transport)
>>>             scheme with PETSc.
>>>             To this end I have amongst other things create a Matrix
>>>             whose entries
>>>             are given by
>>>
>>>             L_ij = -max(0, A_ij, A_ji) for i neq j
>>>
>>>             L_ii = Sum_{j=0,..n, j neq i} L_ij
>>>
>>>             where Mat A is an (non-symmetric) Input Matrix created
>>>             beforehand.
>>>
>>>             I was wondering how to do this. My first search brought
>>>             me to
>>>             https://www.mcs.anl.gov/petsc/petsc-current/src/mat/examples/tutorials/ex16.c.html
>>>
>>>
>>>
>>>             but this just goes over the rows of one matrix to set
>>>             new values and now
>>>             I would need to run over the rows and columns of the
>>>             matrix. My Idea was
>>>             to just create a transpose of A and do the same but then
>>>             the row-layout
>>>             will be different and I can't use the same for loop for
>>>             A and AT and
>>>             thus also won't be able to calculate the max's above.
>>>
>>>             Any help would be appreciated
>>>
>>>
>>>         I think it would likely be much easier to write your
>>>         algorithm directly on the mesh, rather than using matrices,
>>>         since the locality information is explicit with the mesh,
>>>         but has to be reconstructed with the matrix.
>>>
>>>         The problem here is that in parallel there would be no easy
>>>         way to get the halo you need using a matrix. You
>>>         really want the ghosted space for assembly, and that is
>>>         provided by the DM objects. Does this make sense?
>>>         Unless anybody in PETSc has a better idea.
>>>
>>>           Thanks,
>>>
>>>              Matt
>>>
>>>             Best regards
>>>
>>>             Elias
>>>
>>>
>>>
>>>         -- 
>>>         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/>
>>
>>
>>
>>     -- 
>>     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/>
>
>
>
> -- 
> 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/20200323/77aa694d/attachment-0001.html>


More information about the petsc-users mailing list