File: functns2.f

package info (click to toggle)
sparskit 2.0.0-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,236 kB
  • ctags: 2,396
  • sloc: fortran: 15,251; makefile: 294; sh: 136; ansic: 76
file content (225 lines) | stat: -rw-r--r-- 5,253 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
c-----------------------------------------------------------------------
c     contains the functions needed for defining the PDE poroblems. 
c
c     first for the scalar 5-point and 7-point PDE 
c-----------------------------------------------------------------------
      function afun (x,y,z)
      real*8 afun, x,y,z 
      afun = -1.0
      return 
      end

      function bfun (x,y,z)
      real*8 bfun, x,y,z 
      bfun = -1.0
      return 
      end

      function cfun (x,y,z)
      real*8 cfun, x,y,z 
      cfun = -1.0d0
      return 
      end

      function dfun (x,y,z)
      real*8 dfun, x,y,z 
      dfun = 10.d0
      return 
      end

      function efun (x,y,z)
      real*8 efun, x,y,z
      efun = 0.0d0
      return 
      end

      function ffun (x,y,z)
      real*8 ffun, x,y,z 
      ffun = 0.0
      return 
      end

      function gfun (x,y,z)
      real*8 gfun, x,y,z 
      gfun = 0.0 
      return 
      end

      function hfun(x, y, z)
      real*8 hfun, x, y, z
      hfun = 0.0
      return
      end

      function betfun(side, x, y, z)
      real*8 betfun, x, y, z
      character*2 side
      betfun = 1.0
      return
      end

      function gamfun(side, x, y, z)
      real*8 gamfun, x, y, z
      character*2 side
      if (side.eq.'x2') then
         gamfun = 5.0
      else if (side.eq.'y1') then
         gamfun = 2.0
      else if (side.eq.'y2') then
         gamfun = 7.0
      else
         gamfun = 0.0
      endif
      return
      end

c-----------------------------------------------------------------------
c     functions for the block PDE's 
c-----------------------------------------------------------------------
      subroutine afunbl (nfree,x,y,z,coeff)
      real*8 x, y, z, coeff(100) 
      do 2 j=1, nfree
         do 1 i=1, nfree
            coeff((j-1)*nfree+i) = 0.0d0
 1       continue
         coeff((j-1)*nfree+j) = -1.0d0
 2    continue
      return 
      end

      subroutine bfunbl (nfree,x,y,z,coeff)
      real*8 x, y, z, coeff(100) 
      do 2 j=1, nfree
         do 1 i=1, nfree
            coeff((j-1)*nfree+i) = 0.0d0
 1       continue
         coeff((j-1)*nfree+j) = -1.0d0
 2    continue
      return 
      end

      subroutine cfunbl (nfree,x,y,z,coeff)
      real*8 x, y, z, coeff(100) 
      do 2 j=1, nfree
         do 1 i=1, nfree
            coeff((j-1)*nfree+i) = 0.0d0
 1       continue
         coeff((j-1)*nfree+j) = -1.0d0
 2    continue
      return 
      end

      subroutine dfunbl (nfree,x,y,z,coeff)
      real*8 x, y, z, coeff(100) 
      do 2 j=1, nfree
         do 1 i=1, nfree
            coeff((j-1)*nfree+i) = 0.0d0
 1       continue
 2    continue
      return 
      end

      subroutine efunbl (nfree,x,y,z,coeff)
      real*8 x, y, z, coeff(100) 
      do 2 j=1, nfree
         do 1 i=1, nfree
            coeff((j-1)*nfree+i) = 0.0d0
 1       continue
 2    continue
      return 
      end

      subroutine ffunbl (nfree,x,y,z,coeff)
      real*8 x, y, z, coeff(100) 
      do 2 j=1, nfree
         do 1 i=1, nfree
            coeff((j-1)*nfree+i) = 0.0d0
 1       continue
 2    continue
      return 
      end

      subroutine gfunbl (nfree,x,y,z,coeff)
      real*8 x, y, z, coeff(100) 
      do 2 j=1, nfree
         do 1 i=1, nfree
            coeff((j-1)*nfree+i) = 0.0d0
 1       continue
 2    continue
      return 
      end
c-----------------------------------------------------------------------
c     The material property function xyk for the 
c     finite element problem 
c-----------------------------------------------------------------------
c        subroutine xyk(nel,xyke,x,y,ijk,node)
c        implicit real*8 (a-h,o-z)
c        dimension xyke(2,2), x(*), y(*), ijk(node,*)
cc
cc this is the identity matrix.
cc
c        xyke(1,1) = 1.0d0
c        xyke(2,2) = 1.0d0
c        xyke(1,2) = 0.0d0
c        xyke(2,1) = 0.0d0
cc
c        return
c        end
c
        subroutine xyk (xyke, x, y)
        implicit real*8(a-h,o-z)
        dimension xyke(2,2)

        xyke(1,1) = 1.
        xyke(1,1) = exp(x+y)
        xyke(1,2) = 0.
        xyke(2,1) = 0.
        xyke(2,2) = 1.
        xyke(2,2) = exp(x+y)
        return
        end

        function funb(x,y)
        implicit real*8(a-h,o-z)

        funb = 0.
        funb = 2.5
        funb = 2*x
        return
        end

        function func(x,y)
        implicit real*8(a-h,o-z)

        func = 0.
        func = -1.5
        func = -5*y
        return
        end

        function fung(x,y)
c  Right hand side corresponding to the exact solution of
c   u = exp(x+y)*x*(1.-x)*y*(1.-y)
c   (That exact solution is defined in the function exact)
        implicit real*8(a-h,o-z)

c        fung = 1. + x
c        fung = 2*y*(1.-y) + 2*x*(1.-x)
c        fung = 2*y*(1.-y) + 2*x*(1.-x) +2.5*(1-2*x)*y*(1-y) 
c     1        - 1.5*(1.-2*y)*x*(1-x)
        r = exp(x+y)
        fung = r*r*((x*x+3.*x)*y*(1.-y) +
     1                    (y*y+3.*y)*x*(1.-x)) 
     2          + r*(r-2.*x)*(x*x+x-1.)*y*(1.-y)
     3                + r*(r+5.*y)*(y*y+y-1.)*x*(1.-x)
        return
        end

         function exact(x,y)
C  Exact Solution.
         implicit real*8(a-h,o-z)

         exact = exp(x+y)*x*(1.-x)*y*(1.-y)

         return
         end