Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
30 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 ...
0
votes
1answer
37 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? ...
3
votes
0answers
49 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-...
1
vote
0answers
48 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 ...
1
vote
1answer
111 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 ...
1
vote
2answers
197 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 ...
2
votes
1answer
82 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
0answers
123 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 ...
1
vote
0answers
46 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. ...
1
vote
3answers
179 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
vote
2answers
305 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
vote
1answer
70 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
vote
1answer
159 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
vote
1answer
176 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 ...
2
votes
1answer
225 views

Distributed (MPI) matrix matrix multiplication

I perform matrix matrix multiplications (between rank-3 and rank-2 arrays) in fortran using following subroutine, ...
0
votes
1answer
185 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 ...
4
votes
1answer
188 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 ...
1
vote
0answers
135 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 ...
10
votes
3answers
818 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 ...
6
votes
2answers
346 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 ...
1
vote
1answer
146 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
0answers
70 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, ...
1
vote
1answer
72 views

PETCs - How should one initialize PetscRandom?

The documentation of PETSc shows an example of usage: ...
0
votes
1answer
63 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: ...
2
votes
0answers
148 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 ...
3
votes
1answer
91 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.
5
votes
1answer
110 views

Can Variational Inequalities handle non-symmetric matrices?

I am trying to enforce the discrete maximum principle (i.e., ensuring non-negative concentrations) for diffusion-type problems that have an anisotropic diffusivity tensor (e.g., tensor dispersion from ...
2
votes
0answers
128 views

preconditioned Uzawa method with Petsc

I am trying to improve the resolution of a Stokes problem (P2/P1 on unstructured mesh) defined by the matrix $M$: $M= \begin{pmatrix} A_u & 0 & B_u \\ 0 & A_v & B_v\\ B_u^T & B_v^...
2
votes
1answer
330 views

How to convert MPIAIJ to SEQAIJ matrix in petsc/petsc4py?

I am curious, if there is a function to convert MPIAIJ (distributed matrices in AIJ format) to a SEQAIJ matrix that lie on a single processor. It is possible to do such an operation for PETSc vectors ...
0
votes
0answers
376 views

generalized eigenvalue problem, SLEPcEigenSolver no eigenvalues with negative reals

We are working on the model of a kinematic fluid dynamo in FEniCS. It tries to explore whether a magnetic field can be excited if a conducting fluid flows with a certain velocity field through some ...
3
votes
1answer
252 views

Sparse matrix vector product using PETSC

I am trying to do a simple parallel sparse matrix vector multiplications using PETSC. My sparse matrix is a simple tridiagonal laplacian matrix, which is distributed over multiple processors using ...
3
votes
1answer
343 views

Why is MPI/PETSc only showing 1 processor even though it works for helloworld?

I am a beginner with Unix and MPI. For the serial program, I run the program by typing make in /directory/buildagain and then <...
7
votes
2answers
256 views

Comparing various implementations/software packages for large-scale finite element simulations

I currently use FEniCS and Deal.II to solve various FEM problems. I am also writing my own implementation of these problems by directly implementing the data structures, routines, and solvers within ...
1
vote
0answers
443 views

Jacobian-Free Newton-Krylov vs explicitly forming jacobian in DG

For a given discontinuous galerkin (DG) implementation for Navier-Stokes, targeting 10,000 to 1,000,000 4th order cells in 3D, I'm using PETSc's suite of linear/non-linear solvers on the back-end. It ...
1
vote
1answer
132 views

Choosing hardware to use with PETSc

I would like to know more on choosing hardware to get the maximum price/performance when using the PETSc library (and various third-party preconditionners) I am currently working on a 2 cpu (2*E5-...
2
votes
1answer
299 views

Construct a preconditioner for the linear system $Ax = b$ from a different matrix

When I use PETSc to solve my linear systems, I always use the subroutine PetscErrorCode KSPSetOperators(KSP ksp,Mat Amat,Mat Pmat) where ...
1
vote
0answers
312 views

Get a single value from a global Vec in petsc [closed]

I don't understand the concept with local and global vec's in petsc when it come to DMDAVecGetArray and VecGetValues. I'm creating some DMDA Vec in parallel which works well. Now I want to access ...
1
vote
1answer
111 views

Parallel Monte Carlo simulation using PETSc

I am trying to do Monte Carlo simulation for a large problem which requires eigensolution of a matrix for each sample. The matrix itself is quite large so much so that I want the eigensolution itself ...
4
votes
0answers
217 views

Is it possible to predict the null space of a structure from contributing elements null spaces?

I am trying to solve an almost incompressible problem with heterogeneous properties by domain decomposition. Solution with CG converges slowly or divergerces completely. My problem becomes ill-...
1
vote
1answer
95 views

Efficiently swap vectors in PETSC

The PETSC function VecSwap after a few layers of abstraction calls the BLAS primitive swap, which essentially copies data around (unless I am missing something). ...
0
votes
1answer
811 views

Domain Decomposition with PETSc

Does anyone have any experience on Domain Decomposition using PETSc library? I have used PETSc for creating my vectors and matrix within my C++ code. I also used KSP to solve the linear system. I ...
2
votes
1answer
405 views

PETSc or Trilinos for GPU?

I have to choose between the PETSc and Trilinos libraries for a project that involves the solution of non-linear systems of equations. From their web sites they both mention support for GPUs, ...
3
votes
0answers
209 views

Method with low memory requirement for large-scale eigenvalue problem

I am working on the flow stability problem. In this work the main complication is solving generalized eigenvalue problem for a large scale Non-Hermitian matrix. I need only one eigenvalue (most left ...
0
votes
1answer
98 views

Writing a 3D array from Petsc

I am trying to do something fairly simple somehow I have made it hard. Is there an example of how to send a 3D array to a binary file?
4
votes
1answer
278 views

Applying Dirichlet b.c. to the Eigenvalue-Problem

If you use a FEM (on the variational formulation), you can discretize some continuous eigenvalue problem, $$L u = \lambda u \ \ \text{on} \ \Omega,$$ into some discrete, generalized eigenvalue problem,...
3
votes
1answer
275 views

Finite Elements Weak Formulation generalization

I am struggling with an equation that represents the Weak form of Galerkin method: $ \phi^{T}F(\textbf{u})\sim \int_{\Omega}^{ } \phi.f_{0}(\mathit{u},\nabla \mathit{u}) + \nabla\phi:f_{1}(\mathit{u},...
1
vote
0answers
293 views

Assembling sparse matrix in PETSC for Poisson equation

I am a novice at PETSC, and I have been trying to write an FVM code for steady heat conduction in 2D using PETSC (square, regular grid, Dirichlet boundaries) Since the large matrix , say A, will be ...
3
votes
2answers
2k views

Developing finite volume (FVM) code in C . General advice

I need to develop a FVM code in C (The multiscale FVM method for heterogeneous media). I know that: Only uniform rectangular grids will be considered (2d now, later 3d) Sparse systems will be large ...
3
votes
0answers
84 views

PETSc: KSP gives strange discontinuity at the edge between MPI processes [closed]

I'm using PETSc's SNES linesearch (NEWTONLS) to solve a system of nonlinear PDEs. SNES+KSP successfully solved a test problem of the same type before without any trouble. However, with my current ...
1
vote
0answers
81 views

Petsc solver problem

I have to resolve the linear equation Ax = B in which A is not symmetrical, either definite positive. I used the solver GMRES of Petsc. It seems to work well but with the same configuration (initial ...