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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
47 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: ...
Sardine's user avatar
  • 368
0 votes
0 answers
49 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 ...
durianice's user avatar
  • 101
0 votes
1 answer
148 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: ...
Joaquim José da Silva Xavier's user avatar
1 vote
0 answers
66 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 ...
Joaquim José da Silva Xavier's user avatar
2 votes
1 answer
174 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 ...
hahn76's user avatar
  • 243
2 votes
0 answers
114 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 ...
Kürşat Yurt's user avatar
1 vote
1 answer
138 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 ...
Xu Hui's user avatar
  • 323
6 votes
1 answer
429 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 ...
lokit khemka's user avatar
0 votes
0 answers
81 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 ...
Spy123's user avatar
  • 21
2 votes
1 answer
565 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 ...
akr's user avatar
  • 55
2 votes
2 answers
128 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/...
zstreet's user avatar
  • 21
1 vote
2 answers
133 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 ...
Chenna K's user avatar
  • 875
1 vote
1 answer
93 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 ...
emprice's user avatar
  • 245
0 votes
1 answer
278 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 ...
akr's user avatar
  • 55
0 votes
0 answers
137 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 ...
Hoarsehinghing's user avatar
3 votes
0 answers
170 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 ...
janou195's user avatar
  • 151
2 votes
1 answer
279 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 ...
Pedro H. N. Vieira's user avatar
0 votes
1 answer
182 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 ...
D Patel's user avatar
1 vote
0 answers
84 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/...
G. Fougeron's user avatar
2 votes
1 answer
127 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 ...
Matthias Beaupère's user avatar
3 votes
1 answer
100 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 ...
Matthias Beaupère's user avatar
2 votes
1 answer
418 views

Solving nonlinear PDE with finite difference based on Newton-Krylov

I am now working on solving MHD equations with finite difference method, which include nonlinear equations: $$ \frac{\partial\rho}{\partial t}+\nabla\cdot\left[\left(\rho_0+\rho\right){v}\right]-\...
Nothingts's user avatar
0 votes
1 answer
191 views

PCJACOBI works but the default PCBJACOBI failed in PETSc

I am using PETSc and libmesh to solve a simple linear elastic problem with quite complicated geometry, using linear tetrahedral elements. I am always using the KSP CG as the solver. I noticed that ...
Shawn Wang's user avatar
0 votes
1 answer
120 views

Access PETSc data in totalview?

Is it possible to view the data stored in the various PETSc data types from within totalview? Ordinarily, PETSc types are integers which act as pointers to the actual data (obviously my understanding ...
Mr.Weathers's user avatar
2 votes
1 answer
143 views

is it more efficient to use ghosted vector in PETSC for PDE solving on unstructured mesh?

In a traditional PDE solver on unstructured meshes, we know exactly the sparse pattern of the Jacobian matrix, and we know that the amount of data to communicate is far smaller than the amount of ...
jfyan's user avatar
  • 23
0 votes
1 answer
118 views

How to access solution to linear system in PETSc?

I have just started with PETSc hence it might seem like a very stupid question but I couldn't find any answer in manual. After Calling KSPSolve, where can I access the soluition for my linear system? ...
ipcamit's user avatar
  • 135
3 votes
0 answers
98 views

PETSc SNES for user defined state

How to use PETSc SNES (scalable nonlinear equation solver), when the solution is not a vector but a user defined state? I am implementing a non-linear mechanics problem (geometrically exact shell 5-...
akr's user avatar
  • 55
1 vote
0 answers
331 views

Getting started with FEM: Ill-conditioned matrix when evaluating flux terms in conservation law?

I have a system of conservation laws of the form $$ \frac{\partial \mathbf{q}}{\partial t} + \nabla \cdot \mathbf{F}\!\left(\mathbf{q}\right) = 0 $$ I want to use finite elements to solve this ...
emprice's user avatar
  • 245
1 vote
1 answer
257 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 ...
shidi.yan1992's user avatar
2 votes
2 answers
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 ...
hakeem's user avatar
  • 61
2 votes
1 answer
309 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 ...
shidi.yan1992's user avatar
1 vote
0 answers
449 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 ...
josh_eime's user avatar
  • 153
1 vote
0 answers
74 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. ...
Toon's user avatar
  • 31
1 vote
3 answers
393 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 ...
BlaB's user avatar
  • 1,147
1 vote
2 answers
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 ...
Michael's user avatar
  • 1,463
1 vote
1 answer
90 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 ...
Michael's user avatar
  • 1,463
1 vote
1 answer
790 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 ...
Michael's user avatar
  • 1,463
1 vote
1 answer
458 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 ...
EssentialAnonymity's user avatar
2 votes
1 answer
753 views

Distributed (MPI) matrix matrix multiplication

I perform matrix matrix multiplications (between rank-3 and rank-2 arrays) in fortran using following subroutine, ...
trblnc's user avatar
  • 125
0 votes
1 answer
361 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 ...
Ray Celmans's user avatar
3 votes
1 answer
375 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 ...
Bodhi's user avatar
  • 31
1 vote
1 answer
400 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 ...
nukeguy's user avatar
  • 158
10 votes
3 answers
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 ...
Michael's user avatar
  • 1,463
5 votes
2 answers
674 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 ...
singularity's user avatar
1 vote
1 answer
300 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 ...
Henry Watkins's user avatar
1 vote
0 answers
141 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, ...
guhur's user avatar
  • 133
1 vote
1 answer
106 views

PETCs - How should one initialize PetscRandom?

The documentation of PETSc shows an example of usage: ...
guhur's user avatar
  • 133
0 votes
1 answer
145 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: ...
guhur's user avatar
  • 133
2 votes
0 answers
190 views

Is it worth switching to timesteppers provided by PETSc if I can't write down a Jacobian for my problem? Case study with "the amoeba" toy problem

I am considering using petsc4py instead of scipy.integrate.odeint (which is a wrapper for Fortran solvers) for a problem ...
bzm3r's user avatar
  • 669
3 votes
1 answer
184 views

Get a matrix with absolute values in PETSc [closed]

Is there any function to create or change a matrix, to have $A_{ij} = \text{abs}(A_{ij})$ in PETSc? If possible it should work with MPIAIJ matrices, not only local.
allo's user avatar
  • 607