[petsc-users] from standard fortran program to PETSc

Anthony Haas aph at email.arizona.edu
Fri Jun 19 12:46:11 CDT 2015


Hi,

I have a Fortran90 program that solves a complex linear generalized 
eigenvalue problem (GEVP) using standard fortran 90 programming:

Subroutines, modules, allocatable arrays, real(8), int,...

This program uses Lapack to solve the GEVP. The program is mainly made off:

1) set dimensions of problem and initialize arrays,...
2) compute the baseflow (for instance boundary layer flow)
3) build the (stability) complex generalized eigenvalue problem ==> 
build (dense) matrices A and B
4) solve the GEVP with Lapack

Now I want to use PETSc + SLEPc to use sparse matrices. Do I need to 
rewrite/modify everything in terms of PETSc variables as follows:

- int -> PetscInt
- real(8) -> PetscScalar
- complex*16 -> PetscScalar

or is it possible to reuse all that F90 code? For instance I have a 
similarity solver that computes Blasius solution. If that similarity 
solver provides me with u and v velocities in terms of standard 
fortran90 real(8) variables, how should I do to use these variables to 
build my complex matrix? Should I convert them to Petsc variables? How?

what should I do with my Fortran90 allocatable arrays?

real(dp),allocatable,dimension(:,:) :: u--> 
PetscScalar,allocatable,dimension(:,:) :: u ????


Thanks a lot,

Anthony


More information about the petsc-users mailing list