Share Your Experience: Take the 2024 Developer Survey

# Questions tagged [petsc]

PETSc is an open source suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations.

158 questions
Filter by
Sorted by
Tagged with
92 views

### Why multigrid is inefficient？

I am trying to solve the Stokes equation containing viscosity nonlinearity using the open source finite element software underworld2 with nested PETSc. The resolution is 2000*200. The solution results ...
• 21
61 views

### PETSc non-linear solvers (SNES): specifying single Eval & Jacobian function

The PETSc documentation example of a non-linear solver call has the user provide separate functions for the Jacobian and function evaluations: ...
• 378
53 views

### PETSC: Solving a simpler PDE results in error while solving the original equation works in snes/tutorials/ex13.c

In snes/tutorials/ex13.c, there is a function SetupPrimalProblem(), which sets up the $f_0$ and $f_1$ in ...
• 101
203 views

### How to efficiently fill in, in parallel, a PETSc matrix from a COO sparse matrix?

Considering the following COO sparse matrix format, with repeated indices: ...
1 vote
67 views

### How can I optimize the solution of linear systems in my Finite Element Method code for solving nonlinear computational mechanics problems?

Currently, I use Eigen3 for linear algebra operations on sparse matrices and either UMFPACK or CHOLMOD from SuiteSparse to solve sparse linear systems. However, as my model grows larger and the need ...
175 views

### Solution of linear system doesn't work, in parallel

I'm solving $Ax = b$ with PETSc, $A$ sparse and asymmetric. I'm using BCGS or FGMRES or TFQMR as a solver, and ILU as a preconditioner. When I use 1 core, everything works as expected. But with 8 ...
• 259
124 views

### Starting point to use Trilinos linear algebra packages?

I have experience with classical linear algebra packages in C++ like Eigen, Blaze, etc. I have never wrote my own PetSC back-end solver but I used/modified several of them. In a new project I would ...
1 vote
163 views

### How to reuse the symbolic factorization when using MUMPS in petsc?

I have a problem when using petsc. I want to solve a series of linear equations. A1x1=b1, A2x2=b2, A3*x3=b3 ... The A1,A2,A3 have the same sparstiy pattern. I want to use MUMPS to solve the system. In ...
• 323
483 views

### PETSc-like library for Julia

I want to build an application for Material Point Method (and probably other meshfree methods too) in Julia and I am looking for library for direct and iterative solvers that can help me with it. One ...
• 163
84 views

### Output solution vector in Petsc

I am using petsc to solve a linear elasticity problem discretized by finite elements.The initial mesh is read by a mesh file and the distribution in each processor is done using METIS.I am using only ...
• 21
618 views

### How to solve a linear problem A x = b in PETSC when matrix A has zero diagonal enteries?

I am solving a structural mechanics problem that involves setting constraints, and I use Lagrange multipliers to set it. Consequently, some diagonal entries of the tangent stiffness matrix vanish, and ...
• 55
131 views

### Petsc Mat object in class

[Relatively new to Petsc] I am writing an object oriented project and my idea is to have parallel objects when the user constructs the object with MPI arguments. So have member data Mat and fill/...
• 21
1 vote
136 views

### Parallelisation strategies for mixed FE formulations

Mixed FE formulations with LBB-stable elements require two different meshes for the primary and the constraint variables, for example, displacement and pressure. With continuous approximation for the ...
• 944
1 vote
95 views

### Issue solving nonlinear equation containing a quotient

I have a coupled set of PDEs that need to be solved as part of a larger problem. I am currently approaching this by computing spatial derivatives with finite differences and using PETSc's nonlinear ...
• 255
318 views

### How to delete $n^{th}$ row and $n^{th}$ column of a matrix K in Petsc and restructure it?

I have a matrix K in Petsc. I want to delete the $n^{th}$ row and $n^{th}$ column of this matrix and restructure it. I am a beginner in Petsc. Can you suggest how to do it? Example: I have matrix K ...
• 55
150 views

### Petsc matrix with DM objects takes too much memory

I have been learning petsc recently and made a simple solver for stokes equation on 3D staggered grid. My code is running on server with 200GB ram, but if I run a solver on 256^3 grid, memory used by ...
175 views

### Solving saddle point problem having non-invertible top-left block with a PETSc nested matrix

My system is a symmetric FE problem with lagrange multipliers: $Z=\begin{pmatrix}A & C^T \\ C & 0\end{pmatrix}$ The matrix $A$ is positive semi-definite, non-invertible. The whole matrix is ...
• 161
316 views

### What method to solve a sparse complex symmetric (non-Hermitian) system?

I have a sparse system (about 78% of zero entries) that is complex and symmetric (but not Hermitian). The following figure shows the structure of the problem. The off-diagonal blocks are incidence ...
190 views

### Why PETSc/MPI uses only 1 processor a number of times, rather than using several as prescribed by mpiexec [closed]

I am a beginner to PETSc and MPI, so after installing PETSc I was compiling some basic tutorial. But whenever I give the number of processors i.e mpiexec -n 4 ./ex1 ...
1 vote
87 views

### Orientation of cones and transitive closures of a dmplex in Petsc

From the Petsc manual pages, I fail to understand what the orientations of cones and transitive closures mean. In particular, how can I relate these numbers to the orientation of the length/area/...
• 253
141 views

### Send Petsc sequential matrix to another MPI rank

I am doing specific tests on matrices, so forgive me if this question doesn't seem related to Petsc typical use. I have a SEQAIJ matrix on one process and I need ...
102 views

### PETSc - Manipulate BAIJ matrix locally

My program loads a parallel PETSc matrix $A$ on several MPI processes, each holding a block submatrix $A_i$. I would like to retrieve the local submatrix $A_i$, the one corresponding to the current ...
426 views

• 255
1 vote
278 views

### Efficiency of parallel direct linear solver

I am currently working on solving a positive definite symmetric systems in parallel. The parallel direct solver I used is MUMPS. However, the performance and efficiency of the parallel direct solver ...
3k views

### Which python library for GPU sparse linear system solver library

I have a fluid dynamic solver written in python which I want to accelerate by moving the most expensive computations to the GPU. Ideally all arrays and sparse matrices used in my code should remain on ...
• 61
350 views

### Which iterative method and preconditioner from petsc should be used when solving linear algebra in parallel?

I am currently trying to parallelize the incompressible flow solver code. However, when I run the code I realise that the parallel code takes much longer time than sequential code to finish one ...
1 vote
472 views

### Why does PETSc take unexpectedly long to set up its KSP solver with a custom preconditioner? [closed]

I am attempting to solve a large system, $\bf{Ax} = \bf{b}$ with the help of PETSc. Due to the size of the problem, I'm using a matrix-free approach, where $\bf{A}$ is just a shell. I'm also providing ...
• 163
1 vote
77 views

### Parallel dense solve with submatrices from mesh refinement with Petsc

For a Bounday Element Method problem I require the solution of a system of linear equations with multiple right-hand sides. Though this is a dense system, I still want to do it via Petsc in parallel. ...
• 31
1 vote
399 views

### Practical reference on sparse linear solvers for PDEs (Navier-Stokes, Poisson) and on learning PETSc

My background is mainly engineering and applied research and I have been a developer or some CFD software, but mostly at high level without worrying about linear solvers and the like. This has been ...
• 1,157
1 vote
1k views

### Linear solvers: How to deal with a singular system? (Poisson equation with Neumann boundary conditions)

The question is in the context of iterative numerical solution of large PDE systems with Finite Differences or Finite Elements: Stating the Poisson equation with Neumann boundary conditions will lead ...
• 1,463
1 vote
93 views

### How to deal with multi-region problems (in PETSc)

Consider a problem where space is filled with a liquid and a solid phase, with a large, complicated geometry. On each of the phases, there's an electrical potential/poisson equation. The equations are ...
• 1,463
1 vote
853 views

### Algebraic multigrid in PETSc

Consider a potential/poisson equation on a very large, complicated geometry. Currently, an self-written FEM and linear solvers from NumPy are used. Performance is, of course, not good enough for ...
• 1,463
1 vote
475 views

### Why does PETSc matrix memory allocation improve performance so much?

Context In the Portable, Extensible Toolkit for Scientific Computing (PETSc), the user often creates matrices and vectors. These objects are then used as input for other routines like iterative ...
762 views

### Distributed (MPI) matrix matrix multiplication

I perform matrix matrix multiplications (between rank-3 and rank-2 arrays) in fortran using following subroutine, ...
• 125
371 views

### setting COMM_WORLD size from petsc4py without mpiexec command line

I would like to create a parallel solver using petsc4py as one component of a larger application. I can easily get PETSc.COMM_WORLD.getSize() to be 4 by calling mpiexec -n 4 python my_prog.py ...
394 views

### SLEPc eigensolvers take long time to converge for large sparse symmetric matrices

I am leveraging the SLEPc library for solving the first $k$ (where $k = 3$ or $4$) eigenvalues and their corresponding vectors for a matrix of size 200,000. The matrix is sparse and symmetric. I ...
• 31
1 vote
418 views

### What is the default smoother for the "PCMG" preconditioner in PETSc?

For a large parallel sparse matrix (mpiaij type matrix) in my code, I was experimenting with various preconditioners to see which one would do best with GMRES/BiCGSTAB. I tried the PCMG ...
• 158
2k views

### Are there any "light-weight" FEM packages around?

Basically, FEM seems to be a problem that is pretty much "solved". There are numerous powerful frameworks existing, like Trilinos, PETSc, FEniCS, Libmesh or MOOSE. One thing they have in common: They ...
• 1,463
697 views

### PetSc vs Sundials for serial numerical computations?

I am currently working on a physics problem that turns into a non-linear boundary value problem. I need an efficient numerical solver that I could run on my laptop with i5 dual core CPU. I am ...
• 151
1 vote
307 views

### The alternative to using PETSc's SNES solvers in parallel without using the DMDA methods

I am using the PETSc libraries, in particular using the SNES solver package to solve a nonlinear matrix equation. Is there a way of parallelising the solution to this problem problem without using ...
1 vote
143 views

### PETSc - difference between PetscNew and PetscMalloc

I wonder what is the difference between both functions. In C++, the difference between new and malloc is easier: new allocates memory by calling the constructor. What about PETSc ? In the example, ...
• 133
1 vote
107 views

### PETCs - How should one initialize PetscRandom?

The documentation of PETSc shows an example of usage: ...
• 133
148 views

### PETSc - how computing a random number between 0 and 1?

In PETSc, I need to generate a random number between 1 and 0. With the include cstdlib, the classical trick is: ...
• 133
1 vote