[petsc-users] Matrix assembly takes too long

Barry Smith bsmith at petsc.dev
Sun Jul 14 17:36:44 CDT 2024



> On Jul 14, 2024, at 6:04 PM, Alex Sp <alex.sp2408 at gmail.com> wrote:
> 
> This Message Is From an External Sender
> This message came from outside your organization.
> Hello,
> 
> I am trying to solve the problem of the 3D fluid flow around a cylinder using an in-house finite element Fortran code. I want to apply periodic boundary conditions in the neutral direction (the z direction which coincides with the axis of the cylinder). The method works fine and it gives correct results. However the assembly of the matrix for the Newton Raphson method takes too long. The whole process takes about 10 minutes for a single Newton iteration. For the same system size it takes only 10 seconds if instead of periodic conditions I set wall boundaries (no slip, no penetration). What is also strange is that the very first matrix assembly is quite normal (takes about 30 seconds). 

   Does the matrix non-zero structure change between the first and later matrix assemblies? Your behavior is generally a result of new non-zero locations being entered into the matrix after the first assembly is done. 

   What version of PETSc are you using?

   You can run with the option -info and grep for mallocs to see if additional mallocs are needed



> What could be the reason for this? It seems like some matrix entries are allocated anew every time. However this happens only when I apply periodicity. I do not do any matrix preallocation.
> 
> Thanks in advance,
> Alex

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240714/6545ed24/attachment-0001.html>


More information about the petsc-users mailing list