d_splot3d_animate Subroutine

subroutine d_splot3d_animate(pname, X1, X2, Y, xmin, xmax, ymin, ymax)

Arguments

Type IntentOptional Attributes Name
character(len=*) :: pname
real(kind=8), dimension(:) :: X1
real(kind=8), dimension(:) :: X2
real(kind=8), dimension(:,:,:) :: Y
real(kind=8), optional :: xmin
real(kind=8), optional :: xmax
real(kind=8), optional :: ymin
real(kind=8), optional :: ymax

Calls

proc~~d_splot3d_animate~~CallsGraph proc~d_splot3d_animate d_splot3d_animate get_filename get_filename proc~d_splot3d_animate->get_filename get_filepath get_filepath proc~d_splot3d_animate->get_filepath str str proc~d_splot3d_animate->str txtfy txtfy proc~d_splot3d_animate->txtfy

Source Code

subroutine d_splot3d_animate(pname,X1,X2,Y,xmin,xmax,ymin,ymax)
  integer                  :: i,j,m,Nx1,Nx2,Nt
  character(len=*)         :: pname
  real(8),dimension(:)     :: X1
  real(8),dimension(:)     :: X2
  real(8),dimension(:,:,:) :: Y
  real(8)                  :: X1min,X1max
  real(8)                  :: X2min,X2max
  real(8),optional         :: xmin,xmax,ymin,ymax
  real(8)                  :: Rmin(3),Rmax(3),Zmin,Zmax
  Character(len=256)       :: fname,dname
  fname=get_filename(pname)
  dname=get_filepath(pname)
  Nx1=size(X1) ; Nx2=size(X2)
  if(size(Y,1)/=Nx1) stop "Error Nx1"
  if(size(Y,2)/=Nx2) stop "Error Nx2"
  Nt=size(Y,3)
  write(*,*) "splot3d_animate "//str(fname)//" ("//str(Nx1)//","//str(Nx2)//","//str(Nt)//")"
  open(719,file=adjustl(trim(pname)))
  do m=1,Nt
     do i=1,Nx1
        do j=1,Nx2
           write(719,*)X1(i),X2(j),Y(i,j,m)
        enddo
        write(719,*)""
     enddo
  enddo
  close(719)
  X1min=minval(X1);if(present(xmin))X1min=xmin
  X1max=maxval(X1);if(present(xmax))X1max=xmax
  X2min=minval(X2);if(present(ymin))X2min=ymin
  X2max=maxval(X2);if(present(ymax))X2max=ymax
  Rmin=minval(Y);Rmax=maxval(Y)
  Zmin=minval(Rmin);Zmax=maxval(Rmax)
  open(10,file=adjustl(trim(pname))//"_map.gp")
  ! write(10,*)"gnuplot -persist << EOF"
  write(10,*)"reset"
  write(10,*)"#set term gif animate"
  write(10,*)"#set output '"//trim(fname)//".gif'"
  write(10,*)"set term wxt"
  write(10,*)"set pm3d map"
  write(10,*)"set size square"
  write(10,*)"set xrange ["//trim(adjustl(trim(txtfy(X1min))))//":"//trim(adjustl(trim(txtfy(X1max))))//"]"
  write(10,*)"set yrange ["//trim(adjustl(trim(txtfy(X2min))))//":"//trim(adjustl(trim(txtfy(X2max))))//"]"
  write(10,*)"set cbrange ["//trim(adjustl(trim(txtfy(Zmin))))//":"//trim(adjustl(trim(txtfy(Zmax))))//"]"
  write(10,*)"n="//trim(txtfy(Nt))
  write(10,*)"do for [i=0:n-1]{"
  write(10,*)"set title sprintf('"//trim(fname)//"; i=%i',i+1)"
  write(10,*)"splot '"//trim(fname)//"' every :::("//trim(adjustl(trim(txtfy(Nx2))))//&
       "*i)::("//trim(adjustl(trim(txtfy(Nx2))))//"*i+"//trim(adjustl(trim(txtfy(Nx1-1))))//") title '' "
  write(10,*)"}"
  write(10,*)"#set output"
  ! write(10,"(A)")"EOF"
  close(10)
  ! call system("chmod +x "//adjustl(trim(pname))//"_map.gp")
end subroutine d_splot3D_animate