Actual source code: ex4f90.F90
petsc-3.13.6 2020-09-29
1: ! setting up DMPlex for finite elements
2: ! Contributed by Pratheek Shanthraj <p.shanthraj@mpie.de>
3: program main
4: implicit none
5: #include <petsc/finclude/petsc.h90>
6: DM :: dm
7: PetscDS :: prob
8: PetscInt :: dim = 3
9: PetscBool :: simplex = PETSC_TRUE
10: PetscBool :: interpolate = PETSC_TRUE
11: PetscBool :: refinementUniform = PETSC_FALSE
12: PetscReal :: refinementLimit = 0.0
13: PetscErrorCode :: ierr
15: call PetscInitialize(PETSC_NULL_CHARACTER, ierr)
16: if (ierr .ne. 0) then
17: print*,'Unable to initialize PETSc'
18: stop
19: endif
20: call DMPlexCreateDoublet(PETSC_COMM_WORLD, dim, simplex,interpolate, refinementUniform, refinementLimit, dm, ierr);CHKERRA(ierr)
21: call DMSetUp(dm,ierr);CHKERRA(ierr)
22: call PetscDSCreate(PETSC_COMM_WORLD,prob,ierr);CHKERRA(ierr)
23: call DMGetDS(dm,prob,ierr);CHKERRA(ierr)
25: call DMDestroy(dm, ierr);CHKERRA(ierr)
26: call PetscFinalize(ierr)
27: end program main