Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModBessel.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 ! ******************************************************************************
24 !
25 ! Purpose: Routines to compute Bessel functions, their derivatives, and their
26 ! zeros.
27 !
28 ! Description: None.
29 !
30 ! Notes:
31 ! 1. From: http://perso.wanadoo.fr/jean-pierre.moreau/f_bessel.html,
32 ! labelled: F90 Release 1.0 By J-P Moreau, Paris. The original program
33 ! header included the following reference:
34 ! Ref.: www.esrf.fr/computing/expg/libraries/smf/PROGRAMS/MJYZO.FOR
35 !
36 ! ******************************************************************************
37 !
38 ! $Id: RFLU_ModBessel.F90,v 1.4 2008/12/06 08:44:20 mtcampbe Exp $
39 !
40 ! ******************************************************************************
41 
43 
44  USE moddatatypes
45 
46  IMPLICIT NONE
47 
48  PRIVATE
49  PUBLIC :: rflu_jyndd, &
50  rflu_jyzo, &
52 
53 ! ******************************************************************************
54 ! Declarations and definitions
55 ! ******************************************************************************
56 
57  CHARACTER(CHRLEN) :: RCSIdentString = &
58  '$RCSfile: RFLU_ModBessel.F90,v $ $Revision: 1.4 $'
59 
60 ! ******************************************************************************
61 ! Routines
62 ! ******************************************************************************
63 
64  CONTAINS
65 
66 
67 
68 
69 
70 ! ******************************************************************************
71 !
72 ! Purpose: Compute Bessel functions Jn(x) and Yn(x) and their first and
73 ! second derivatives
74 !
75 ! Description: None.
76 !
77 ! Input:
78 ! n Order of Jn(x) and Yn(x)
79 ! x Argument of Jn(x) and Yn(x) (x>0)
80 !
81 ! Output:
82 ! BJN Jn(x)
83 ! DJN dJn/dx(x)
84 ! FJN d2Jn/dx2(x)
85 ! BYN Yn(x)
86 ! DYN dYn/dx(x)
87 ! FYN d2Yn/dx2(x)
88 !
89 ! Notes:
90 ! 1. Removed labelled loops and CONTINUE statements from original code.
91 !
92 ! ******************************************************************************
93 
94  SUBROUTINE rflu_jyndd(N,X,BJN,DJN,FJN,BYN,DYN,FYN)
95 
96  IMPLICIT NONE
97 
98 ! ******************************************************************************
99 ! Declarations and definitions
100 ! ******************************************************************************
101 
102 ! ==============================================================================
103 ! Arguments
104 ! ==============================================================================
105 
106  INTEGER :: n
107  DOUBLE PRECISION, INTENT(IN) :: x
108  DOUBLE PRECISION, INTENT(OUT) :: bjn,djn,fjn,byn,dyn,fyn
109 
110 ! ==============================================================================
111 ! Locals
112 ! ==============================================================================
113 
114  INTEGER :: k,m,mt,nt
115  DOUBLE PRECISION :: bs,ec,e0,f,f0,f1,su,s1
116  DOUBLE PRECISION :: bj(102),by(102)
117 
118 ! ******************************************************************************
119 ! Start
120 ! ******************************************************************************
121 
122  DO nt=1,900
123  mt=int(0.5*log10(6.28*nt)-nt*log10(1.36*dabs(x)/nt))
124  IF (mt.GT.20) THEN
125  EXIT
126  END IF ! MT
127  END DO ! NT
128  m=nt
129  bs=0.0d0
130  f0=0.0d0
131  f1=1.0d-35
132  su=0.0d0
133  DO k=m,0,-1
134  f=2.0d0*(k+1.0d0)*f1/x-f0
135  IF (k.LE.n+1) THEN
136  bj(k+1)=f
137  END IF ! K
138  IF (k.EQ.2*int(k/2)) THEN
139  bs=bs+2.0d0*f
140  IF (k.NE.0) THEN
141  su=su+(-1)**(k/2)*f/k
142  END IF ! K
143  END IF
144  f0=f1
145  f1=f
146  END DO ! K
147  DO k=0,n+1
148  bj(k+1)=bj(k+1)/(bs-f)
149  END DO ! K
150  bjn=bj(n+1)
151  ec=0.5772156649015329d0
152  e0=0.3183098861837907d0
153  s1=2.0d0*e0*(dlog(x/2.0d0)+ec)*bj(1)
154  f0=s1-8.0d0*e0*su/(bs-f)
155  f1=(bj(2)*f0-2.0d0*e0/x)/bj(1)
156  by(1)=f0
157  by(2)=f1
158  DO k=2,n+1
159  f=2.0d0*(k-1.0d0)*f1/x-f0
160  by(k+1)=f
161  f0=f1
162  f1=f
163  END DO ! K
164  byn=by(n+1)
165  djn=-bj(n+2)+n*bj(n+1)/x
166  dyn=-by(n+2)+n*by(n+1)/x
167  fjn=(n*n/(x*x)-1.0d0)*bjn-djn/x
168  fyn=(n*n/(x*x)-1.0d0)*byn-dyn/x
169 
170 ! ******************************************************************************
171 ! End
172 ! ******************************************************************************
173 
174  END SUBROUTINE rflu_jyndd
175 
176 
177 
178 
179 ! ******************************************************************************
180 !
181 ! Purpose: Compute the zeros of Bessel functions Jn(x) and Yn(x) and their
182 ! first derivatives
183 !
184 ! Description: None.
185 !
186 ! Input:
187 ! N Order of Bessel functions (0 to 100)
188 ! NT Number of zeros
189 !
190 ! Output:
191 ! RJ0(L) L-th zero of Jn(x), L=1,2,...,NT
192 ! RJ1(L) L-th zero of dJn/dx(x), L=1,2,...,NT
193 ! RY0(L) L-th zero of Yn(x), L=1,2,...,NT
194 ! RY1(L) L-th zero of dYn/dx(x), L=1,2,...,NT
195 !
196 ! Notes: None.
197 !
198 ! ******************************************************************************
199 
200  SUBROUTINE rflu_jyzo(N,NT,RJ0,RJ1,RY0,RY1)
201 
202  IMPLICIT NONE
203 
204 ! ******************************************************************************
205 ! Declarations and definitions
206 ! ******************************************************************************
207 
208 ! ==============================================================================
209 ! Arguments
210 ! ==============================================================================
211 
212  INTEGER :: n,nt
213  DOUBLE PRECISION, INTENT(OUT) :: rj0(nt),rj1(nt),ry0(nt),ry1(nt)
214 
215 ! ==============================================================================
216 ! Locals
217 ! ==============================================================================
218 
219  INTEGER :: l
220  DOUBLE PRECISION :: bjn,byn,djn,dyn,fjn,fyn,x,x0
221 
222 ! ******************************************************************************
223 ! Start
224 ! ******************************************************************************
225 
226  IF (n.LE.20) THEN
227  x=2.82141+1.15859*n
228  ELSE
229  x=n+1.85576*n**0.33333+1.03315/n**0.33333
230  ENDIF
231  l=0
232 10 x0=x
233  CALL rflu_jyndd(n,x,bjn,djn,fjn,byn,dyn,fyn)
234  x=x-bjn/djn
235  IF (dabs(x-x0).GT.1.0d-9) go to 10
236  l=l+1
237  rj0(l)=x
238  x=x+3.1416+(0.0972+0.0679*n-0.000354*n**2)/l
239  IF (l.LT.nt) go to 10
240  IF (n.LE.20) THEN
241  x=0.961587+1.07703*n
242  ELSE
243  x=n+0.80861*n**0.33333+0.07249/n**0.33333
244  ENDIF
245  IF (n.EQ.0) x=3.8317
246  l=0
247 15 x0=x
248  CALL rflu_jyndd(n,x,bjn,djn,fjn,byn,dyn,fyn)
249  x=x-djn/fjn
250  IF (dabs(x-x0).GT.1.0d-9) go to 15
251  l=l+1
252  rj1(l)=x
253  x=x+3.1416+(0.4955+0.0915*n-0.000435*n**2)/l
254  IF (l.LT.nt) go to 15
255  IF (n.LE.20) THEN
256  x=1.19477+1.08933*n
257  ELSE
258  x=n+0.93158*n**0.33333+0.26035/n**0.33333
259  ENDIF
260  l=0
261 20 x0=x
262  CALL rflu_jyndd(n,x,bjn,djn,fjn,byn,dyn,fyn)
263  x=x-byn/dyn
264  IF (dabs(x-x0).GT.1.0d-9) go to 20
265  l=l+1
266  ry0(l)=x
267  x=x+3.1416+(0.312+0.0852*n-0.000403*n**2)/l
268  IF (l.LT.nt) go to 20
269  IF (n.LE.20) THEN
270  x=2.67257+1.16099*n
271  ELSE
272  x=n+1.8211*n**0.33333+0.94001/n**0.33333
273  ENDIF
274  l=0
275 25 x0=x
276  CALL rflu_jyndd(n,x,bjn,djn,fjn,byn,dyn,fyn)
277  x=x-dyn/fyn
278  IF (dabs(x-x0).GT.1.0d-9) go to 25
279  l=l+1
280  ry1(l)=x
281  x=x+3.1416+(0.197+0.0643*n-0.000286*n**2)/l
282  IF (l.LT.nt) go to 25
283 
284 ! ******************************************************************************
285 ! End
286 ! ******************************************************************************
287 
288  END SUBROUTINE rflu_jyzo
289 
290 
291 
292 
293 
294 ! ******************************************************************************
295 !
296 ! Purpose: Compute Mth zero of Bessel functions Jn(x) and Yn(x) and their
297 ! first derivatives
298 !
299 ! Description: None.
300 !
301 ! Input:
302 ! N Order of Bessel functions (0 to 100)
303 ! M Index of zero
304 !
305 ! Output:
306 ! RJ0M M-th zero of Jn(x)
307 ! RJ1M M-th zero of dJn/dx(x)
308 ! RY0M M-th zero of Yn(x)
309 ! RY1M M-th zero of dYn/dx(x)
310 !
311 ! Notes: None.
312 !
313 ! ******************************************************************************
314 
315  SUBROUTINE rflu_jyzom(N,M,RJ0M,RJ1M,RY0M,RY1M)
316 
317  IMPLICIT NONE
318 
319 ! ******************************************************************************
320 ! Declarations and definitions
321 ! ******************************************************************************
322 
323 ! ==============================================================================
324 ! Arguments
325 ! ==============================================================================
326 
327  INTEGER :: n,m
328  DOUBLE PRECISION, INTENT(OUT) :: rj0m,rj1m,ry0m,ry1m
329 
330 ! ==============================================================================
331 ! Locals
332 ! ==============================================================================
333 
334  DOUBLE PRECISION :: bjn,byn,djn,dyn,fjn,fyn,x,x0
335  DOUBLE PRECISION :: rj0(m),rj1(m),ry0(m),ry1(m)
336 
337 ! ******************************************************************************
338 ! Start
339 ! ******************************************************************************
340 
341  CALL rflu_jyzo(n,m,rj0,rj1,ry0,ry1)
342 
343  rj0m = rj0(m)
344  rj1m = rj1(m)
345  ry0m = ry0(m)
346  ry1m = ry1(m)
347 
348 ! ******************************************************************************
349 ! End
350 ! ******************************************************************************
351 
352  END SUBROUTINE rflu_jyzom
353 
354 
355 
356 
357 ! ******************************************************************************
358 ! End
359 ! ******************************************************************************
360 
361 END MODULE rflu_modbessel
362 
363 
364 ! ******************************************************************************
365 !
366 ! RCS Revision history:
367 !
368 ! $Log: RFLU_ModBessel.F90,v $
369 ! Revision 1.4 2008/12/06 08:44:20 mtcampbe
370 ! Updated license.
371 !
372 ! Revision 1.3 2008/11/19 22:17:31 mtcampbe
373 ! Added Illinois Open Source License/Copyright
374 !
375 ! Revision 1.2 2006/04/07 15:19:18 haselbac
376 ! Removed tabs
377 !
378 ! Revision 1.1 2005/03/15 20:42:53 haselbac
379 ! Initial revision
380 !
381 ! ******************************************************************************
382 
383 
384 
385 
386 
387 
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed by
Definition: roccomf90.h:7
FT m(int i, int j) const
subroutine, public rflu_jyndd(N, X, BJN, DJN, FJN, BYN, DYN, FYN)
const NT & d
j indices k indices k
Definition: Indexing.h:6
subroutine, public rflu_jyzom(N, M, RJ0M, RJ1M, RY0M, RY1M)
virtual int f1()
Definition: meshtest1.C:4114
void int int REAL * x
Definition: read.cpp:74
subroutine, public rflu_jyzo(N, NT, RJ0, RJ1, RY0, RY1)
const NT & n