-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbl.f
742 lines (670 loc) · 21.9 KB
/
bl.f
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
C> \file bl.f
C> \brief Solve the Blasius equation using spectral collocation
C> \author S. Scott Collis
c******************************************************************************
program Solve_Similar_BL
c******************************************************************************
c
c Purpose: This program solves the Boundary Layer similarity equation
c using a Chebyshev collocation method. Written originally
c for ME 308 and ME 351B final projects.
c
c This code works reasonably well but the convergence is rather
c slow. I think it can be made faster but I am not sure that
c it is worth it. I now have an RK4 boundary layer equation
c integrator that works quite well. See CONTEBL.F for example.
c
c Author: S. Scott Collis
c
c Date: 2-22-92
c
c Revised: 9-18-92
c
c******************************************************************************
integer idim
parameter (idim=128)
real u(0:idim), v(0:idim), xi(0:idim), th(0:idim)
real maxerr
integer i, j, k, n, nbig, maxcount
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
write (*,10)
10 format (/,/,10x,'Solve Boundary Layer Similarity Equation')
write (*,20)
20 format (/,1x,'Enter the number of modes ==> ',$)
read (*,*) n
write (*,60)
60 format (/,1x,'Enter Beta ==> ',$)
read (*,*) beta
write (*,30)
30 format (/,1x,'Enter alpha (alpha < 0) ==> ',$)
read (*,*) alpha
write (*,40)
40 format (/,1x,'Enter the max allowable error ==> ',$)
read (*,*) maxerr
write (*,70)
70 format (/,1x,'Enter the max number of iterations ==> ',$)
read (*,*) maxcount
write (*,50)
50 format (/,1x,'Interpolate to mesh size ==> ',$)
read (*,*) nbig
gamma = 1.2
etaout = 15.0
call MAKE_MESH (n, th, xi)
call MAKE_METRICS (n, xi)
call INIT_PROFILE (n, u, v, th, xi)
call SOLVE_BL (n, u, v, th, xi, maxerr, maxcount)
call SAVE_VELOCITY(n,u,v,xi)
call CHEBYINT(n,u,v,nbig)
stop
end
C******************************************************************************
subroutine MAKE_MESH(n, th, xi)
C******************************************************************************
C
C Setup the collocation points in the mapped coordinate, xi and in
C chebyshev space, th.
C
C******************************************************************************
integer n
real th(0:n), xi(0:n)
real pi, dth
integer i
pi = Acos (-1.0)
dth = pi/float(n)
do i = 0, n
th(i) = i*dth
xi(i) = cos(th(i))
end do
return
end
C******************************************************************************
subroutine MAKE_METRICS(n, xi)
C******************************************************************************
C
C Compute the first and second metrics for the coordinate transformation
C I am using the truncated mapping of Street et. al.
C
C******************************************************************************
integer n
real xi(0:n), A, B
integer i
parameter (idim=128)
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
write (*,*)
write (*,*) 'Mesh and Metrics'
write (*,*)
do i = 0, n
A = etaout/2.*(1-TANH(gamma))
B = gamma/2.
eta = etaout*(1-tanh(gamma))*.5*(xi(i)+1)/
. (1-tanh(gamma/2.*(xi(i)+1)))
phi1(i) = 1./(A/2.*(1+EXP(2.*B*(1+xi(i))))+A*B*
. EXP(2.*B*(1+xi(i)))*(1+xi(i)))
phi2(i) = -2.*A*B*(1+B*(xi(i)+1))*EXP(2.*B*(xi(i)+1))*phi1(i)**3
write (*,10) eta, xi(i), phi1(i), phi2(i)
10 format (4(es12.5,1x))
end do
return
end
C******************************************************************************
subroutine INIT_PROFILE(n, u, v, th, xi)
C******************************************************************************
C
C Setup the initial boundary layer profiles
C
C******************************************************************************
integer n
real u(0:n), v(0:n), th(0:n), xi(0:n)
real eta
integer i, ans
parameter (idim=128)
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
write (*,10)
10 format (/,1x,'Read in a profile (1,0) ==> ',$)
read (*,*) ans
if (ans.eq.1) then
call READ_VELOCITY(n,u,v)
else
do i = 0, n
eta = etaout*(1-tanh(gamma))*.5*(xi(i)+1)/
. (1-tanh(gamma/2.*(xi(i)+1)))
u(i) = .5*(xi(i)+1)
end do
c
c Now given the initial u, v must be set to satisfy continuity
c
call COMPUTE_V (n, u, v, xi)
end if
write (*,*) 'Initial profiles'
write (*,*)
do i = 0, n
eta = etaout*(1-tanh(gamma))*.5*(xi(i)+1)/
. (1-tanh(gamma/2.*(xi(i)+1)))
write (*,12) eta, u(i), v(i)
12 format (1x,3(e12.5,2x))
end do
write (*,*)
return
end
C******************************************************************************
subroutine SPECTRAL(n, u, v, th, xi, L)
C******************************************************************************
C
C Compute the spectral operator given a velocity field using Fast
C Chebyshev transform
C
C******************************************************************************
integer n
real u(0:n), v(0:n), th(0:n), xi(0:n), L(1:n-1)
integer i, j
real eta
parameter (idim=128)
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
real u1(0:idim), u2(0:idim)
if (n.gt.idim) then
write (*,*) 'Error. N > idim in SPECTRAL'
stop
end if
c
c Compute the first derivative
c
call DCHEBYSHEV (u, u1, u2, n)
c write (*,*)
c do i = 0, n
c eta = etaout*(1-tanh(gamma))*.5*(xi(i)+1)/
c . (1-tanh(gamma/2.*(xi(i)+1)))
c write (*,10) eta,u(i),phi1(i)*u1(i),
c . (phi1(i)**2*u2(i)+phi2(i)*u1(i)),phi1(i),phi2(i)
c 10 format (1x,6(e11.5,1x))
c end do
c
C Now form the spectral operator, L
c
do i = 1, n-1
L(i) = phi1(i)**2*u2(i)+(phi2(i)-v(i)*phi1(i))*u1(i)
end do
return
end
C******************************************************************************
subroutine COMPUTE_V (n, u, v, xi)
C******************************************************************************
C
C Compute v(i) from continuity given u(i).
C
C******************************************************************************
integer n, i
real u(0:n), v(0:n), xi(0:n)
parameter (idim=128)
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
real utemp(0:idim)
do i = 0, n
utemp(i) = -1./phi1(i)*u(i)
end do
call ICHEBYSHEV (utemp,v,n)
return
end
C******************************************************************************
subroutine FINITE_DIFF(n, u, v, xi, Ha, Hb, Hc, b, L)
C******************************************************************************
C
C Generate the second order finite difference preconditioning matrix.
C Note that central difference is used which results in a tridiagonal
C matrix. Note that phi1 and phi2 are the first and
C second metrics of the coordinate transformation.
C
C******************************************************************************
integer n
real u(0:n), v(0:n), xi(0:n), Ha(n-1), Hb(n-1), Hc(n-1)
real b(1:n-1), L(1:n-1)
real x10, x11, x01
integer i, j
parameter (idim=128)
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
c
c Finite difference operator must also have beta(1-u**2) term. maybe
c
do i = 1, n-1
x10 = xi(i+1)-xi(i)
x11 = xi(i+1)-xi(i-1)
x01 = xi(i)-xi(i-1)
c
c Richardson Iteration
c
Ha(i) = (phi1(i)**2/x01-(phi2(i)-v(i)*phi1(i)))/x11
Hb(i) = -1.0*phi1(i)**2*(1./x10 + 1./x01)/x11
Hc(i) = (phi1(i)**2/x10+(phi2(i)-v(i)*phi1(i)))/x11
c
c Simple pseudo time-step
c
c Ha(i) = -(phi1(i)**2/x01-(phi2(i)-v(i)*phi1(i)))/x11
c Hb(i) = alpha+phi1(i)**2*(1./x10 + 1./x01)/x11
c Hc(i) = -(phi1(i)**2/x10+(phi2(i)-v(i)*phi1(i)))/x11
end do
Ha(1) = 0.0
Hc(n-1) = 0.0
c
c Form the R.H.S. and include the boundary conditions. Note that
c u(0) = 1.0 and u(n) = 0.0
c
do i = 1, n-1
b(i) = alpha*(L(i)+beta*(1.-u(i)**2))
end do
c i = 1
c x10 = xi(i+1)-xi(i)
c x11 = xi(i+1)-xi(i-1)
c x01 = xi(i)-xi(i-1)
c b(i) = b(i)-(phi1(i)**2/x01-(phi2(i)-v(i)*phi1(i)))/x11*u(0)
c i = n
c x10 = xi(i+1)-xi(i)
c x11 = xi(i+1)-xi(i-1)
c x01 = xi(i)-xi(i-1)
c b(i) = b(i)-(phi1(i)**2/x10+(phi2(i)-v(i)*phi1(i)))/x11*u(n)
return
end
C******************************************************************************
subroutine SOLVE_BL(n, u, v, th, xi, maxerr, maxcount)
C******************************************************************************
C
C Solve the similar boundary layer equations using a Chebyshev collocation
C method. On input u, and v contain the initial 'guess' and the non-linear
C problem is solved iteratively starting from these inital profiles. On
C output u and v contain the solution
C
C******************************************************************************
integer n
real u(0:n), v(0:n), th(0:n), xi(0:n), maxerr
parameter (idim=128)
real du(idim), b(idim), L(idim)
real Ha(idim), Hb(idim), Hc(idim)
real residual, eta, oldresidual
integer i, j, icount, maxcount
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
real H(idim,idim), work(idim), cond, z(idim), oa(idim,idim)
integer ipvt(idim)
real Ldiff
real u1(0:idim), u2(0:idim)
if (n.gt.idim) then
write (*,*) 'Error: N > idim in SOLVE_BL'
stop
end if
write(*,*) "Beginning Iterative Solve"
write(*,*)
residual = 100.
oldresidual = 1000.
icount = 0
do while ((residual .gt. maxerr).and.(icount.lt.maxcount))
icount = icount + 1
c do i = 1, idim
c du(i) = 0.0
c Ha(i) = 0.0
c Hb(i) = 0.0
c Hc(i) = 0.0
c L(i) = 0.0
c b(i) = 0.0
c end do
c
c Setup the spectral R.H.S.
c
call SPECTRAL (n, u, v, th, xi, L)
c
c Setup the finite difference opperator
c
call FINITE_DIFF (n, u, v, xi, Ha, Hb, Hc, b, L)
c
c Build the matrix
c
c do i = 2, n-2
c H(i,i-1) = Ha(i)
c H(i,i) = Hb(i)
c H(i,i+1) = Hc(i)
c end do
c H(1,1) = Hb(1)
c H(1,2) = Hc(1)
c H(n-1,n-2) = Ha(n-1)
c H(n-1,n-1) = Hb(n-1)
c ndim = idim
c
c H(u) should about equal L
c
c write (*,*)
c write (*,*) 'Spectral Finite Difference Comparison'
c write (*,*)
c do i = 1, n-1
c Ldiff = 0.0
c do j = 1, n-1
c Ldiff = Ldiff + H(i,j)*u(j)
c end do
c if (i.eq.1) then
c Ldiff = Ldiff - b(1) + L(i)+beta*(1.-u(i)**2)
c end if
c write (*,*) xi(i), Ldiff, L(i)
c end do
c write (*,*)
c call DECOMP(ndim,n-1,H,COND,IPVT,WORK,OA,Z)
c write (*,*) 'Condition = ',cond
c call SOLVE(ndim,n-1,H,B,IPVT,du)
c
call TRIDIAG (n-1,du,Ha,Hb,Hc,b)
c
c try without preconditioning
c
c do i = 1, n-1
c du(i) = b(i)
c end do
c
c Update u vector, of course the b.c. don't change
c
do i = 1, n-1
u(i) = u(i) + du(i)
end do
c
c Now Chebyshev integrate to get the new v
c
call COMPUTE_V (n, u, v, xi)
c
c Check the residual to seen if it is small enough
c
oldresidual = residual
residual = 0.0
do i = 1, n-1
residual = residual + (du(i))**2
end do
residual = SQRT(residual/(n-1))
write(*,*) icount, residual
if ((mod(icount,50).eq.0)) then
open(UNIT=10)
call DCHEBYSHEV (u, u1, u2, n)
do i = 0, n
eta = etaout*(1-tanh(gamma))*.5*(xi(i)+1)/
. (1-tanh(gamma/2.*(xi(i)+1)))
write (10,10) eta,u(i),phi1(i)*u1(i),
. (phi1(i)**2*u2(i)+phi2(i)*u1(i))
10 format (1x,4(e11.5,2x))
end do
close(UNIT=10)
end if
end do
write (*,*)
write (*,*) "Completed solve with interations, residual"
write (*,*) icount, residual
return
end
C******************************************************************************
C******************************************************************************
SUBROUTINE DCHEBYSHEV(Y, Y1, Y2, N)
C******************************************************************************
C
C Calculate the Chebyshev transform of a set Y of N+1 real-valued data
C points and compute the first and second derivatives in Chebyshev space.
C Then inverse transform and return the derivatives in Y1 and Y2 in real
C space. Note that Y is returned unscathed.
C
C******************************************************************************
REAL Y(0:N), Y1(0:N), Y2(0:N)
PARAMETER (idim=128)
REAL WORK(0:IDIM)
IF (N.GT.IDIM) THEN
WRITE (*,*) 'ERROR. N > IDIM in DCHEBYSHEV'
STOP
END IF
C
C SAVE THE INPUT VECTOR
C
DO I = 0, N
WORK(I) = Y(I)
END DO
C
C COMPUTE THE CHEBYSHEV TRANSFORM
C
CALL chebyshev(Y,N,1)
C
C NOW USE THE RECURSIVE RELATION TO TAKE THE FIRST DERIVATIVE
C
Y1(N) = 0.0
Y1(N-1) = 2.*FLOAT(N)*Y(N)
DO K = N-2, 0, -1
Y1(K) = Y1(K+2) + 2.*(K+1.)*Y(K+1)
END DO
Y1(0) = Y1(0)/2.
C
C NOW REPEAT THE RECURSIVE RELATION TO TAKE THE SECOND DERIVATIVE
C
Y2(N) = 0.0
Y2(N-1) = 2.*FLOAT(N)*Y1(N)
DO K = N-2, 0, -1
Y2(K) = Y2(K+2) + 2.*(K+1.)*Y1(K+1)
END DO
Y2(0) = Y2(0)/2.
C
C INVERSE TRANSFORM TO GET BACK TO REAL SPACE
C
CALL chebyshev(Y1,N,-1)
CALL chebyshev(Y2,N,-1)
DO I = 0, N
Y(I) = WORK(I)
END DO
RETURN
END
C***********************************************************************
subroutine CHEBYSHEV (Y, N, ISIGN)
C***********************************************************************
C
C Take the Chebyshev transform and normalize
C
C***********************************************************************
integer n, isign
real y(0:n), t(0:256)
if (isign .ne. 1) then
if (isign .ne. -1) then
write (*,*) 'ERROR: Invalid Isign in CHEBYSHEV'
stop
end if
end if
do i = 1, n
t(i) = y(i)
end do
call COSFT3 (y,n,isign)
c call COSFT (y,n,isign)
if (isign .eq. 1) then
do i = 0,n
y(i) = y(i)/float(n)*2.
end do
end if
return
end
C******************************************************************************
SUBROUTINE COSFT3 (Y,N,ISIGN)
C******************************************************************************
C
C Do a brute force transform. ISIGN = 1 does a forward transform.
C ISIGN = -1 a backward transform. This is a hybrid double/single
C precision routine.
C
C******************************************************************************
integer N, ISIGN
real Y(0:N), T(0:N)
real YY(0:N), TT(0:N), PI
PI = DACOS(-1.0D0)
DO I = 0, N
TT(I) = DBLE(Y(I))
END DO
if (isign .eq. 1) then
DO I = 0, N
YY(I) = TT(0)/2.D0 + TT(N)*COS(DFLOAT(I)*PI)/2.D0
DO M = 1, N-1
YY(I) = YY(I) + TT(M)*COS(DFLOAT(M)*DFLOAT(I)*PI/DFLOAT(N))
END DO
YY(I) = YY(I)*2./DFLOAT(N)
end do
YY(0) = YY(0)/2.D0
YY(N) = YY(N)/2.D0
else
DO I = 0, N
YY(I) = 0.0
DO M = 0, N
YY(I) = YY(I) + TT(M)*COS(DFLOAT(M)*DFLOAT(I)*PI/DFLOAT(N))
END DO
END DO
end if
C
C GO BACK TO SINGLE PRECISION
C
DO I = 0, N
if (Y(i).le.1e-14) then
Y(I) = 0.0
end if
Y(I) = SNGL(YY(I))
END DO
RETURN
END
C*****************************************************************************
subroutine TRIDIAG(num,u,a,b,c,f)
C*****************************************************************************
c
c Solves the tridiagonal system B[a,b,c]u = f
c
c*****************************************************************************
real u(num), a(num), b(num), c(num), f(num)
a(num) = a(num)/b(num)
do i = num-1,1,-1
b(i) = b(i)-c(i)*a(i+1)
a(i) = a(i)/b(i)
end do
u(num) = f(num)/b(num)
do i = num-1,1,-1
u(i) = (f(i)-c(i)*u(i+1))/b(i)
end do
do i = 2, num
u(i)=u(i)-a(i)*u(i-1)
end do
return
end
C******************************************************************************
SUBROUTINE ICHEBYSHEV(Y,YI,N)
C******************************************************************************
C
C Calculate the Chebyshev transform of a set Y of N+1 real-valued data
C points and integrate in Chebyshev space. The integral is returned
C in real space in YI and Y is unscathed.
C
C******************************************************************************
REAL Y(0:N), YI(0:N+1)
PARAMETER (idim=128)
REAL WORK(0:IDIM)
DO I = 0, N
WORK(I) = Y(I)
END DO
C
C COMPUTE THE CHEBYSHEV TRANSFORM
C
CALL Chebyshev(Y,N,1)
C
C NOW INTEGRATE
C NOTE I AM ASSUMING THAT Y(N) IS SMALL SUCH THAT YI(N+1) = 0.0
C
YI(N+1) = Y(N)/(2.*(N+1.))
YI(N) = Y(N-1)/(2.*N)
YI(1) = 1./2.*(2.*Y(0)-Y(2))
YI(0) = YI(1)
DO K = 2, N-1
YI(K) = 1./(2.*K)*(Y(K-1)-Y(K+1))
YI(0) = YI(0) + (-1.)**(K-1)*YI(K)
END DO
CALL Chebyshev(YI,N,-1)
DO I = 0, N
Y(I) = WORK(I)
END DO
RETURN
END
C******************************************************************************
SUBROUTINE CHEBYINT(N,U,V,NBIG)
C******************************************************************************
C
C
C******************************************************************************
INTEGER N, NBIG
REAL U(0:N), V(0:N)
REAL IU, IV, X, PI
parameter (idim=128)
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
PI = ACOS(-1.0)
call Chebyshev (u,n,1)
call Chebyshev (v,n,1)
open(10)
do i = 0, NBIG
X = I*PI/NBIG
IU = 0.0
IV = 0.0
DO M = 0, N
IU = IU + U(M)*COS(FLOAT(M)*X)
IV = IV + V(M)*COS(FLOAT(M)*X)
END DO
IU = FLOAT(N)*IU*0.5
IV = FLOAT(N)*IV*0.5
eta = etaout*(1-tanh(gamma))*.5*(cos(X)+1)/
. (1-tanh(gamma/2.*(cos(X)+1)))
write (10,10) eta, IU, IV
end do
close(10)
10 format (1x,3(e16.8,4x))
RETURN
END
C******************************************************************************
SUBROUTINE SAVE_VELOCITY(N,U,V, xi)
C******************************************************************************
C
C
C******************************************************************************
INTEGER N, i, j
REAL U(0:N), V(0:N), xi(0:N), eta
character*15 filename
parameter (idim=128)
real gamma, etaout, phi1(0:idim), phi2(0:idim), beta, alpha
common /metrics/ gamma, etaout, phi1, phi2, beta, alpha
write (*,5)
5 format (/,1x,'Write file')
write (*,10)
10 format (1x,'Enter filename ==> ',$)
read (*,'(a)') filename
open (unit=11,file=filename,status='unknown')
write (11,*) N
do i = 0, n
eta = etaout*(1.-tanh(gamma))*.5*(xi(i)+1.)/
. (1.-tanh(gamma/2.*(xi(i)+1.)))
write (11,*) eta,u(i),v(i)
end do
close (11)
write (*,*)
write (*,*) 'Wrote file = ', filename
RETURN
END
C******************************************************************************
SUBROUTINE READ_VELOCITY(N,U,V)
C******************************************************************************
C
C
C******************************************************************************
INTEGER N, i, j, nmode
REAL U(0:N), V(0:N),eta
character*15 filename
write (*,5)
5 format (/,1x,'Read file',/)
write (*,10)
10 format (1x,'Enter filename ==> ',$)
read (*,'(a)') filename
open (unit=11,file=filename,status='unknown')
read (11,*) nmode
do i = 0, n
read (11,*) eta,u(i),v(i)
end do
close (11)
RETURN
END