[petsc-users] matrix preallocation for unstructured finite element

Matthew Knepley knepley at gmail.com
Fri Jan 19 06:00:58 CST 2018


On Fri, Jan 19, 2018 at 12:04 AM, saturday luis <luis.saturday at gmail.com>
wrote:

> I am not exactly sure what you mean.
>
> Given an IEN array, how do you get dnz and onz? Do you have any algorithm
> or pseudocode for that? Any reference will be appreciated!
>

You use a hash table the size of the number of rows, and insert columns for
each entry. Then you read out those columns, checking whether
they are in the diagonal block or not. This is exactly the code I use in
Plex.

   Matt


> Thanks,
>
> Luis
>
> 2018-01-18 20:59 GMT-08:00 Sanjay Govindjee <s_g at berkeley.edu>:
>
>> If you are doing FEA, then you should have the element connectivity data
>> available from the input.  From this it is an easy task to compute the the
>> assembly pattern and hence the precise allocation data, dnz and onz.  There
>> should be no need to perform a 'trial' assembly.
>>
>> -sanjay
>>
>>
>> On 1/18/18 8:49 PM, saturday luis wrote:
>>
>>> Hi PETSc team:
>>>
>>> Is there a way to make precise matrix preallocation for an unstructured
>>> grid (I am not using the DMPlex object). Or do you have any example code
>>> for estimating the dnz & onz data?
>>>
>>> On top of my head, I can do a two-phase calculation. I can first give a
>>> rough estimate and do one finite element assembly, then I will call
>>> MatGetRow to locate the column indices for nonzero entries. Then in the
>>> second step, I will destroy the Mat and create a new Mat with this obtained
>>> sparsity pattern.
>>>
>>> Do you have any suggestions?
>>>
>>> Thanks!
>>>
>>> Luis
>>>
>>
>>
>


-- 
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.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180119/b8302c2a/attachment.html>


More information about the petsc-users mailing list