00001 subroutine save_solution(icycle)
00002   use phys_constant, only  : long
00003   use def_bh_parameter
00004   use def_quantities
00005   use grid_parameter, only : rgin
00006   implicit none 
00007   integer :: icycle
00008   character(40) :: char1, char2, char3, char4, char5
00009   character(100) :: dircommand
00010 
00011   write(char1, '(i5)') icycle
00012   char2 = adjustl(char1)
00013 
00014 
00015 
00016   if (icycle < 10) then
00017     char5 = 'cycle_0' // trim(char2) 
00018   else
00019     char5 = 'cycle_' // trim(char2)
00020   endif
00021 
00022   dircommand = 'mkdir ' // char5
00023   call system(dircommand)
00024 
00025 
00026 
00027 
00028 
00029   call chdir(char5)
00030 
00031 
00032 
00033 
00034   open(15,file='global_' // trim(char5) // '.txt',status='unknown')
00035   write(15,'(1p,13e16.8)') rgin, spin_bh, ome_bh, admmass, komarmass,admmass_thr,  &
00036                    &       app_hor_area_bh, irredmass, bindingene,   &
00037                    &       angmom, angmom_thr, angmom_smarr, qua_loc_spin
00038   close(15)
00039   call chdir('../')
00040 
00041 end subroutine save_solution