Actual source code: mex34f90.F
1: !
2: module mex34f90
3: #include "finclude/petsc.h90"
5: ! Data structure used to contain information about the problem
6: ! You can add physical values etc here
8: type appctx
9: MPI_Comm :: comm = MPI_COMM_WORLD
10: integer :: nxc = 5 ! number of grid points in channel
11: integer :: np = 2,nc = 3 ! number of unknowns in pool and channel
12: end type appctx
14: ! The names of the fields in the pool and in the channel
15: ! These are accessed via variablename%p0, variablename%p1
16: ! change these to names appropriate for your physics
18: type poolfield
19: double precision :: p0,p1 ! unknowns in pool
20: end type poolfield
22: type channelfield
23: double precision :: c0,c1,c2 ! unknowns in channel
24: end type channelfield
26: end module mex34f90
28: !
29: ! These are interface definitions that allow PETSc routines to be
30: ! called with "nice" names from Fortran90.
31: !
32: ! You should not need to change these, someday I hope to be able
33: ! to no longer require them
34: !
35: #define USERMODULE mex34f90
36: #define USERFIELD1 channelfield
37: #define USERFIELD2 poolfield
39: module mex34finterfaces
40: use mex34f90
41: Interface DAVecGetArrayF90
42: Subroutine DAVecGetArrayF90user1(Da, v,d1,ierr)
43: use USERMODULE
44: DA da
45: Vec v
46: type(USERFIELD1), pointer :: d1(:)
47: PetscErrorCode ierr
48: End Subroutine
49: End Interface DAVecGetArrayF90
51: interface DAVecRestoreArrayF90
52: Subroutine DAVecRestoreArrayF90user1(Da, v,d1,ierr)
53: use USERMODULE
54: DA da
55: Vec v
56: type(USERFIELD1), pointer :: d1(:)
57: PetscErrorCode ierr
58: End Subroutine
59: End Interface DAVecRestoreArrayF90
61: interface DMMGSetUser
62: Subroutine DMMGSetUser(dmmg, level,app,ierr)
63: use USERMODULE
64: DMMG dmmg
65: type(appctx), pointer :: app
66: PetscErrorCode ierr
67: integer level
68: End Subroutine
69: End Interface DMMGSetUser
71: interface DMMGGetUser
72: Subroutine DMMGGetUser(dmmg, app,ierr)
73: use USERMODULE
74: DM dmmg
75: type(appctx), pointer :: app
76: PetscErrorCode ierr
77: End Subroutine
78: End Interface DMMGGetUser
80: Interface DMCompositeGetAccess
81: Subroutine DMCompositeGetAccess4(dm, v,d1,d2,d3,d4,ierr)
82: use USERMODULE
83: DM dm
84: Vec v,d1,d3
85: type(poolfield),pointer :: d2,d4
86: PetscErrorCode ierr
87: End Subroutine
88: End Interface
90: Interface DMCompositeRestoreAccess
91: Subroutine DMCompositeRestoreAccess4(dm, v,d1,d2,d3,d4,ierr)
92: use USERMODULE
93: DMComposite dm
94: Vec v,d1,d3
95: type(poolfield),pointer :: d2,d4
96: PetscErrorCode ierr
97: End Subroutine
98: End Interface
100: Interface DMCompositeGetLocalVectors
101: Subroutine DMCompositeGetLocalVectors4(dm, d1,p1,d2,p2,ierr)
102: use USERMODULE
103: DMComposite dm
104: type(poolfield),pointer :: p1,p2
105: Vec d1,d2
106: PetscErrorCode ierr
107: End Subroutine
108: End Interface
110: Interface DMCompositeRestoreLocalVectors
111: Subroutine DMCompositeRestoreLocalVectors4(dm, d1,p1,d2,p2,ierr)
112: use USERMODULE
113: DMComposite dm
114: type(poolfield),pointer :: p1,p2
115: Vec d1,d2
116: PetscErrorCode ierr
117: End Subroutine
118: End Interface
120: Interface DMCompositeScatter
121: Subroutine DMCompositeScatter4(dm, v,d1,d2,d3,d4,ierr)
122: use USERMODULE
123: DM dm
124: Vec v,d1,d3
125: type(poolfield) d2,d4
126: PetscErrorCode ierr
127: End Subroutine
128: End Interface
130: end module mex34finterfaces