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

learn more… | top users | synonyms

1
vote
0answers
99 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 ...
2
votes
0answers
27 views

Get a matrix with absolute values in PETSc

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
59 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
67 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 & ...
1
vote
0answers
73 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
89 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 ...
2
votes
1answer
71 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 ...
2
votes
1answer
122 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 ...
4
votes
2answers
141 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
153 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
96 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
votes
1answer
216 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
86 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
77 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 ...
3
votes
0answers
170 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 ...
1
vote
1answer
73 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
311 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
171 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
141 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
0answers
60 views

LaPlacian 3D example 34.c - how do you invoke multiGrid

I am having trouble running this code while exercising the ksp_type GMRES pc_Type mg -da_refine 1. Error Reports arguments are incompatible I read somewhere the pc_type MG works with all of the ...
0
votes
1answer
47 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
137 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 ...
3
votes
1answer
201 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}) + ...
1
vote
0answers
196 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
1k 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
62 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
62 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 ...
2
votes
0answers
86 views

How to reduce RAM requirement in PETSC and SLEPCreading large binary matrices [closed]

I have two 50000 x 50000 binary matrices A and B for solving A*x=lambda*B*x eigenvalue problem. These matrices are sparse. I am trying to solve using PETSC and SLEPC. My memory requirement shoots off ...
1
vote
1answer
86 views

How to allocate memory for successive iterative solutions with potentially different non-zero structure?

Background I am solving the unsteady heat equation in 3D using an alternating direction implicit (ADI) method. This means that I am solving three different tridiagonal systems within a single ...
5
votes
2answers
100 views

Odd accuracy barrier in C/PETSc regarding finite elements

I’m implementing a finite element code (translating from a working MATLAB version, so I have results to compare to) and for some odd reason, some of my computations are only accurate to around 6 ...
4
votes
1answer
262 views

PETSc input format for linear solvers

I’m going through some considerable effort to translate one of my codes from MATLAB. It’s a type of finite element code and I haven’t implemented the solver yet but comparing CPU times for simply ...
2
votes
1answer
176 views

Sparse linear solvers in C?

I'm working on translating a discontinuous Galerkin code from MATLAB to C and I'm at the final point where I need to solve a sparse system. I've taken a course in C before but I'm very rusty and ...
1
vote
2answers
247 views

mpi retrieve a variable value from process with known rank to process that made an mpi_something call

I have a need to get a variable value from another process rank of which I know. This happens in context of a parallel solver of a "A x = b" equation, for which process with rank 0 knows matrix A, and ...
4
votes
1answer
159 views

Using PAPI in PETSc code

I am trying to count the number of cache misses, total cycles, etc. per iteration of a for loop inside MatMult_SeqSBAIJ_2() . ...
4
votes
1answer
216 views

Is PETSc's DMDA relying on undefined behavior?

I was looking at the documentation for DMDAVecGetArray and was surprised that it could create a plain ordinary C array whose indices somehow ranged from, say, ...
5
votes
3answers
257 views

Preconditioner for finding the smallest eigenpairs of a large, but structured, matrix

I'm trying to find the eigenvector corresponding to the second smallest eigenvalue of a large $(4,000,000 \times 4,000,000)$ matrix $L$. $L$ is a graph Laplacian, with the following structure: $L = D ...
9
votes
4answers
1k views

Any recommendations for unit-testing frameworks compatible with code/libraries that use MPI?

Usually, I write serial code, and when I do, I write unit tests with some xUnit-style testing framework (MATLAB xUnit, PyUnit/nose, or Google's C++ testing framework). Based on a cursory Google ...
1
vote
1answer
230 views

PETSc: Blocking matrices using MatCreateSeqBAIJ and MatSetValuesBlocked

I am a little confused with PETSc's documentation for MatSetValuesBlocked. The code below works fine for matrices when I choose small block sizes, but I get errors ...
3
votes
2answers
756 views

Solve a linear system with BiCGStab instead of GMRES in PETSC

Below a piece of code is shown to solve a linear system. ...
2
votes
0answers
89 views

PETSc KSP Tutorial ex7 Output [closed]

I am learning PETSc following the tutorials of the distribution (version 3.4.1). My question is about the KSPView(ksp,PETSC_VIEWER_STDOUT_WORLD); (line 216) of ex7.c (KSP tutorial). It teaches how to ...
5
votes
1answer
299 views

Basic questions regarding slepc4py/petsc4py

I am brand new to slepc4py and petsc4py (and SLEPc and PETSc in general), and I have a few basic questions. I apologize if these have been answered somewhere - I've looked around for a while and ...
7
votes
1answer
490 views

Solving a large non-hermitian generalised eigenvalue problem from a linear stability analysis using SLEPc

I have a generalised matrix problem: $A x = \lambda B x$ from a spectral method on a linear stability analysis problem. My matrix B is diagonal and positive semi-definite. A is non-hermitian and ...
1
vote
1answer
296 views

PETSc Krylov Subspace and nullspace

How is the nullspace correction implemented in the PETSc conjugate gradient solver? I searched the source code and documentation, but could not find references on the actual implementation. For ...
6
votes
1answer
184 views

Advice on solving a coupled physics problem

I am taking a shot at solving a coupled physics problem. I have this matrix formed: $\mathbf{J}=\begin{bmatrix} \mathbf{A} & \mathbf{B}\\ \mathbf{C} & \mathbf{D} \end{bmatrix}$ where ...
4
votes
2answers
294 views

What is the basic requirement to understand the PETSc library?

I want to use the PETSc library to do some numerical work on finite element and parallel computing, but I wonder what I should know first to use these libraries. Could you give me some guiding ...
4
votes
2answers
115 views

Installing only a portion of PETSc

I want to incorporate matrix solver into my program. Is it possible to separate out any library of matrix solver from PETSc? I am working in C language. It will be very helpful if I get any library ...
5
votes
1answer
280 views

Reference BLAS/LAPACK from NETLIB is twice as fast as MKL for complex numbers

I'm solving the Helmholtz equation using PETSc. I found with the PETSc configure option --download-f-blas-lapack my program runs twice as fast over running it with ...
10
votes
2answers
806 views

Which preconditioners (and solver) in PETSc for indefinite symmetric systems should I use?

My system is a symmetric FE problem with lagrange multipliers (e.g. incompressible Stokes' flow): \begin{pmatrix}A & B^T \\ B & C\end{pmatrix} where $C = 0$ is the typical case (I have even ...
2
votes
1answer
355 views

Creating a local vector in a parallel PETSC program

In one of my PETSc programs, I need a processor to access values from another processor. So in the PETSc FAQ's this issue has been briefly addressed here. To create a local vector, I tried this ...
4
votes
2answers
622 views

Computing matrix exponential with PETSc/SLEPc

My question is basically the best way to compute the matrix exponential in parallel. I've got a sequential code written in Python (https://github.com/hadsed/AdiaQC) and I need to extend it to run in a ...