> On Sep 17, 2018, at 5:36 PM, Oleksandr Koshkarov <[email protected]> wrote:
>
> Wow, that is neat, thank you! I think it is exactly what I need. However, can
> you please clarify some details:
>
> 1) does "ofill" represent all non diagonal blocs? meaning they have the same
> pattern. (e.g., in 1d I will have 1+2*stencil_width blocks)
Yes, it represents all the non diagonal blocks, this is a weakness in that
depending on the discretization different diagonal blocks may have different
nonzero structure. You need to use the union of all the off-diagonal block
matrix nonzero structure.
>
> 2) this note: "This only makes sense when you are doing multicomponent
> problems but using the MPIAIJ matrix format". Sounds like MPIAIJ is wrong
> choice for multi component problem. Actually, I do not pick the DMDA matrix
> format myself, and use petsc default (which is probably MPIAIJ).
It is MPIAIJ.
> Maybe, I should something else more heavily multi component problem? My
> matrices appears from discretizing 6D PDE, where I put 3D inside dof... The
> discretization is all stencil based (finite volume method).
The BAIJ format is only appropriate if the "blocks" are essentially dense
(since BAIJ stores them as dense). BAIJ format is not correct for you. You
should be using the MPIAIJ format.
Barry
>
> p.s. All those functions and flexibility imply the enormous beauty in PETSc
> structure. I wish to start reading petsc internal code, to be more
> comfortable using it and to ask more smart questions to you guys. However, it
> is quite intimidating to start. Maybe you have some pointers, how can I start?
>
> Thank you and best regards,
>
> Oleksandr.
>
>
> On 09/17/2018 02:37 PM, Smith, Barry F. wrote:
>> You can use DMDASetBlockFills() or DMDASetBlockFillsSparse().
>>
>> If you need any finer scale control then they offer you need to copy the
>> PETSc source that does the preallocation for DMDA generated matrices and
>> customize it exactly for your problem.
>>
>>
>> Barry
>>
>>
>>> On Sep 17, 2018, at 3:31 PM, Oleksandr Koshkarov <[email protected]>
>>> wrote:
>>>
>>> Hello All,
>>>
>>> I have a question about preallocation of DMDA matrix. As I understand, it
>>> preallocates the number of nonzeros using the stencil width info. However,
>>> it seems it will not be efficient for me: I have a large dof (around 2000),
>>> where only some of those dof's are coupled, so those dof*dof blocks inside
>>> the DMMatrix would be also sparse. I also use this DMDA matrix as
>>> preconditioner, which has lower coupling than original DMDA array, so
>>> stencil is effectively smaller (I precondition higher order finite volume
>>> method with lower order FV method). Can I manually specify how many zeros
>>> needs to be preallocated for the DMDA matrix?
>>>
>>> p.s. I do not want o use normal matrix, as I relay on dmda indexing
>>> (MatSetValuesStencil).
>>>
>>> Thank you and best regards,
>>>
>>> Oleksandr.
>>>
>