13. 2次元または3次元ベクトルデータを用いた3次元流線図



ソースプログラム(Fortran 90,自動倍精度利用)
!******************************** ! 3D Graphic Sample No. 8 * ! 3D Flow Lines * !******************************** program gsample13 implicit none real, parameter :: pi = 3.141592653589793 integer, parameter :: ifmax = 31, itmax = 40, imax = 30, jmax = 40 real xx(500),yy(500),zz(500) real bx(-imax:imax,0:jmax),by(-imax:imax,0:jmax),bz(-imax:imax,0:jmax) real f(ifmax),th(itmax) real xmin,xmax,ymin,ymax,zmin,zmax,r,x,y,th1,area integer i,j,nmax,i0 xmin = -0.25*imax xmax = 0.25*imax ymin = 0 ymax = 0.25*jmax zmin = 0 zmax = 5 call fr_ginit call fr_opencanvas(1,'gsample13',101) call fr_project(5.0,1) call margin3d(50,50,50,50) call fr_angle3d(30.0,-60.0) call fr_aspect3d(1.0,1.0,1.0,0) call fr_xyzname('x-ax','y-ax','z-ax') call fr_frame3d(xmin,xmax,ymin,ymax,zmin,zmax,3) do j = 0, jmax do i = -imax, imax x = 0.25*i y = 0.25*j call dipole(x,y,bx(i,j),by(i,j)) bz(i,j) = 1.d-3*(sin(pi*2*y/ymax)+1) enddo enddo r = 1 do i = 1, ifmax th1 = pi*(i-1)/dble(ifmax-1) call dipole(r*cos(th1),r*sin(th1),x,y) f(i) = x*cos(th1)+y*sin(th1) enddo th(1) = 0 th(itmax) = pi call fr_flowspace(f,ifmax,th,itmax,area,i0) call fr_flow3drgn(0.0,xmax,0.0,ymax,zmin,zmax) do i = 1, itmax/2 xx(1) = r*cos(th(i)) yy(1) = r*sin(th(i)) zz(1) = zmin nmax = 500 call fr_flow3dline(xx,yy,zz,nmax,bx,by,bz,2*imax+1,jmax+1,1,2,1.d-7,5) enddo call fr_flow3drgn(xmin,0.0,0.0,ymax,zmin,zmax) do i = itmax/2+1, itmax xx(1) = r*cos(th(i)) yy(1) = r*sin(th(i)) zz(1) = zmax nmax = 500 call fr_flow3dline(xx,yy,zz,nmax,bx,by,bz,2*imax+1,jmax+1,1,1,1.d-7,-5) enddo call fr_gend end program gsample13 subroutine dipole(x,y,bx,by) implicit none real x,y,r2,r5,bx,by r2 = x*x+y*y if (r2.eq.0) then bx = 0 by = 0 else r5 = r2**2.5 bx = (3.0*x*x-r2)/r5 by = 3.0*x*y/r5 endif end subroutine dipole


Copyright (C) Toshihiro Taguchi, Setsunan University, 2000-2012 All rights reserved.