Commits

Anonymous committed 7b31019

Updated output prefix for uniformity among filenames.

  • Participants
  • Parent commits 184c07e

Comments (0)

Files changed (5)

File src/pflotran/checkpoint.F90

   ! Open the checkpoint file.
   call PetscGetTime(tstart,ierr)   
   if (id < 0) then
-    filename = 'restart' // trim(option%group_prefix) // '.chk'
+    filename = trim(option%global_prefix) // trim(option%group_prefix) // &
+               '-restart.chk'
   else 
     write(id_string,'(i8)') id
     filename = trim(option%global_prefix) // trim(option%group_prefix) // &

File src/pflotran/option.F90

     character(len=MAXSTRINGLENGTH) :: initialize_flow_filename
     character(len=MAXSTRINGLENGTH) :: initialize_transport_filename
         
+    character(len=MAXSTRINGLENGTH) :: input_prefix
     character(len=MAXSTRINGLENGTH) :: global_prefix
     character(len=MAXWORDLENGTH) :: group_prefix
     
   option%mygroup = 0
   option%mygroup_id = 0
   
-  option%global_prefix = 'pflotran'
+  option%input_prefix = 'pflotran'
   option%group_prefix = ''
+  option%global_prefix = ''
     
   option%broadcast_read = PETSC_FALSE
   option%io_rank = 0

File src/pflotran/output_observation.F90

   
   
   if (open_file) then
-
-    if (option%myrank < 10) then
-      write(string,'(i1)') option%myrank  
-    else if (option%myrank < 100) then
-      write(string,'(i2)') option%myrank  
-    else if (option%myrank < 1000) then
-      write(string,'(i3)') option%myrank  
-    else if (option%myrank < 10000) then
-      write(string,'(i4)') option%myrank  
-    else if (option%myrank < 100000) then
-      write(string,'(i5)') option%myrank  
-    endif
-    filename = 'observation' // trim(option%group_prefix) // '-' // &
-               trim(string) // '.tec'
+    write(string,'(i6)') option%myrank
+    filename = trim(option%global_prefix) // trim(option%group_prefix) // &
+               '-obs-' // trim(adjustl(string)) // '.tec'
   
     ! open file
     fid = 86
   output_option => realization_base%output_option
  
   if (len_trim(output_option%plot_name) > 2) then
-    filename = trim(output_option%plot_name) // '.dat'
+    filename = trim(output_option%plot_name) // '-mas.dat'
   else
-    filename = 'mass_balance' // trim(option%group_prefix) // '.dat'
+    filename = trim(option%global_prefix) // trim(option%group_prefix) // &
+               '-mas.dat'
   endif
   
   ! open file

File src/pflotran/output_vtk.F90

   output_option => realization_base%output_option
   
   ! open file
-  if (len_trim(output_option%plot_name) > 2) then
-    filename = trim(output_option%plot_name) // '.vtk'
-  else
-    string = OutputFilenameID(output_option,option)
-    filename = trim(option%global_prefix) // trim(option%group_prefix) // &
-               '-' // trim(string) // '.vtk'    
-  endif
+  filename = OutputFilename(output_option,option,'vtk','')
   
   if (option%myrank == option%io_rank) then
     option%io_buffer = '--> write vtk output file: ' // trim(filename)
   discretization => realization_base%discretization
   
   ! open file
-  if (len_trim(output_option%plot_name) > 2) then
-    filename = trim(output_option%plot_name) // '-vel.vtk'
-  else  
-    string = OutputFilenameID(output_option,option)
-    filename = trim(option%global_prefix) // trim(option%group_prefix) // &
-               '-vel-' // trim(string) // '.vtk'
-  endif
+  filename = OutputFilename(output_option,option,'vtk','vel')
   
   if (option%myrank == option%io_rank) then
    option%io_buffer = '--> write vtk velocity output file: ' // &

File src/pflotran/pflotran.F90

   PetscErrorCode :: ierr
   character(len=MAXSTRINGLENGTH) :: string
   character(len=MAXSTRINGLENGTH), pointer :: filenames(:)
+  character(len=MAXSTRINGLENGTH), pointer :: strings(:)
   type(stochastic_type), pointer :: stochastic
   type(simulation_type), pointer :: simulation
   type(realization_type), pointer :: realization
   option%myrank = option%global_rank
   option%mycommsize = option%global_commsize
   option%mygroup = option%global_group
+
   ! check for non-default input filename
-  option%input_filename = "pflotran.in"
+  option%input_filename = 'pflotran.in'
   string = '-pflotranin'
   call InputGetCommandLineString(string,option%input_filename,option_found,option)
+  if (option_found) then
+    !TODO(geh): replace this with StringSplit()
+    i = index(option%input_filename,'.',PETSC_TRUE)
+    if (i > 1) then
+      i = i-1
+    else
+      ! for some reason len_trim doesn't work on MS Visual Studio in 
+      ! this location
+      i = len(trim(option%input_filename)) 
+    endif
+    option%input_prefix = option%input_filename(1:i)
+  endif
 
   string = '-screen_output'
   call InputGetCommandLineTruth(string,option%print_to_screen,option_found,option)
 
   string = '-output_prefix'
   call InputGetCommandLineString(string,option%global_prefix,option_found,option)
+  if (.not.option_found) option%global_prefix = option%input_prefix
 
   string = '-v'
   call InputGetCommandLineTruth(string,truth,option_found,option)