On Fri, 19 Jun 2015, Anthony Haas wrote: > 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 perhaps you mean: PetscReal
> - 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? > You can use the current datatypes used in your code - And always make sure the types match manually. [Fortran does not have typecheck anyway..] > what should I do with my Fortran90 allocatable arrays? > > real(dp),allocatable,dimension(:,:) :: u--> > PetscScalar,allocatable,dimension(:,:) :: u ???? Either should work. You can add the following to your code: #if !defined(PETSC_USE_COMPLEX) #error "this code requires PETSc --with-scalar-type=complex build" #endif #if !defined(PETSC_USE_REAL_DOUBLE) #error "this code requires PETSc --with-precision=real build" #endif Satish
