Actual source code: ex62f90.F90
1: #include "petsc/finclude/petsc.h"
2: program ex62f90
3: use petsc
4: implicit none
5: #include "exodusII.inc"
7: type(tDM) :: dm, dmU, dmA, dmS, dmUA, dmUA2, pDM
8: type(tDM), dimension(:), pointer :: dmList
9: type(tVec) :: X, U, A, S, UA, UA2
10: type(tIS) :: isU, isA, isS, isUA
11: type(tPetscSection) :: section, rootSection, leafSection
12: PetscInt, parameter :: fieldU = 0, fieldS = 1, fieldA = 2
13: PetscInt, dimension(2) :: fieldUA = [0, 2]
14: character(len=PETSC_MAX_PATH_LEN) :: ifilename, ofilename, IOBuffer
15: integer :: exoid = -1
16: type(tIS) :: csIS
17: PetscInt, dimension(:), pointer :: csID
18: PetscInt, dimension(:), pointer :: pStartDepth, pEndDepth
19: PetscInt :: order = 1
20: PetscInt :: sdim, d, pStart, pEnd, p, numCS, set, i, j
21: PetscMPIInt :: rank, numProc
22: PetscBool :: flg
23: PetscErrorCode :: ierr
24: MPIU_Comm :: comm
25: type(tPetscViewer) :: viewer
27: character(len=MXSTLN) :: sJunk
28: PetscInt, parameter :: numstep = 3
29: PetscInt :: step
30: PetscInt :: numNodalVar, numZonalVar
31: character(len=MXSTLN) :: nodalVarName(4)
32: character(len=MXSTLN) :: zonalVarName(6)
33: logical, dimension(:, :), pointer :: truthtable
35: type(tIS) :: cellIS
36: PetscInt, dimension(:), pointer :: cellID
37: PetscInt :: numCells, cell, closureSize
38: PetscInt, dimension(:), pointer :: closureA, closure
40: type(tPetscSection) :: sectionUA, coordSection
41: type(tVec) :: UALoc, coord
42: PetscScalar, dimension(:), pointer :: cval, xyz
43: PetscInt :: dofUA, offUA, c
45: ! dof layout ordered by increasing height in the DAG: cell, face, edge, vertex
46: PetscInt, dimension(3), target :: dofS2D = [0, 0, 3]
47: PetscInt, dimension(3), target :: dofUP1Tri = [2, 0, 0]
48: PetscInt, dimension(3), target :: dofAP1Tri = [1, 0, 0]
49: PetscInt, dimension(3), target :: dofUP2Tri = [2, 2, 0]
50: PetscInt, dimension(3), target :: dofAP2Tri = [1, 1, 0]
51: PetscInt, dimension(3), target :: dofUP1Quad = [2, 0, 0]
52: PetscInt, dimension(3), target :: dofAP1Quad = [1, 0, 0]
53: PetscInt, dimension(3), target :: dofUP2Quad = [2, 2, 2]
54: PetscInt, dimension(3), target :: dofAP2Quad = [1, 1, 1]
55: PetscInt, dimension(4), target :: dofS3D = [0, 0, 0, 6]
56: PetscInt, dimension(4), target :: dofUP1Tet = [3, 0, 0, 0]
57: PetscInt, dimension(4), target :: dofAP1Tet = [1, 0, 0, 0]
58: PetscInt, dimension(4), target :: dofUP2Tet = [3, 3, 0, 0]
59: PetscInt, dimension(4), target :: dofAP2Tet = [1, 1, 0, 0]
60: PetscInt, dimension(4), target :: dofUP1Hex = [3, 0, 0, 0]
61: PetscInt, dimension(4), target :: dofAP1Hex = [1, 0, 0, 0]
62: PetscInt, dimension(4), target :: dofUP2Hex = [3, 3, 3, 3]
63: PetscInt, dimension(4), target :: dofAP2Hex = [1, 1, 1, 1]
64: PetscInt, dimension(:), pointer :: dofU, dofA, dofS
66: type(tPetscSF) :: migrationSF, natSF, natPointSF, natPointSFInv
67: PetscPartitioner :: part
69: type(tVec) :: tmpVec
70: PetscReal :: norm
71: PetscReal :: time
72: PetscInt, pointer :: remoteOffsets(:)
74: PetscCallA(PetscInitialize(PETSC_NULL_CHARACTER, ierr))
75: if (ierr /= 0) then
76: print *, 'Unable to initialize PETSc'
77: stop
78: end if
80: PetscCallA(MPI_Comm_rank(PETSC_COMM_WORLD, rank, ierr))
81: PetscCallA(MPI_Comm_size(PETSC_COMM_WORLD, numProc, ierr))
82: PetscCallA(PetscOptionsGetString(PETSC_NULL_OPTIONS, PETSC_NULL_CHARACTER, '-i', ifilename, flg, ierr))
83: PetscCheckA(flg, PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, 'missing input file name -i ')
84: PetscCallA(PetscOptionsGetString(PETSC_NULL_OPTIONS, PETSC_NULL_CHARACTER, '-o', ofilename, flg, ierr))
85: PetscCheckA(flg, PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE, 'missing output file name -o