Skip to content Skip to sidebar Skip to footer

Using F2py On A Fortran Code Linked To PETSc

My question is related to this post: Including a compiled module in module that is wrapped with f2py (Minimum working example)? in which the poster was trying to compile a Fortran

Solution 1:

@VladimirF, has a point.

It looks like if the VecDestrou is not in the PETSC module you are using.

Seems to me following parts of PETSc are required in your module.

#include <petsc/finclude/petscsysdef.h>
#include <petsc/finclude/petscvecdef.h>
! Optional
#include <petsc/finclude/petscdef.h>
#include <petsc/finclude/petscdm.h>
#include <petsc/finclude/petscvec.h> 
#include <petsc/finclude/petscvec.h90>  
#include <petsc/finclude/petscmat.h>
#include <petsc/finclude/petscmat.h90>
! might be not completed
! Or
use petscksp
use petscdm
use petscvec
use petscmat 
!might be not completed

How to use PETSc with Fortran is diccussed here, personally I go for option 2 in that page. Most of the existing PETSc examples are following option 2 as well.

Please let me clarify that I am not encouraging you to use include over use, that's the way I am used to do only. PETSc documentation has an example that using Fortran modules, for example here. So you can choose any of these methods/or have both optionally (please realize that preprocessor option in that example, PETSC_USE_FORTRAN_MODULES), but still need to add required modules depends on what you are using.


Post a Comment for "Using F2py On A Fortran Code Linked To PETSc"