1. Glenn Hammond
  2. pflotran-dev

Commits

Glenn Hammond  committed aecd9e7

First attempt to fix PETSc logging in process model version.

  • Participants
  • Parent commits 19fb4e8
  • Branches default

Comments (0)

Files changed (5)

File src/pflotran/hydrogeophysics_factory.F90

View file
  • Ignore whitespace
   use Subsurface_Factory_module
   use PMC_Hydrogeophysics_class
   use Option_module
+  use Logging_module
   
   implicit none
   
   type(option_type), pointer :: option
   
   class(pmc_hydrogeophysics_type), pointer :: hydrogeophysics_coupler
+  character(len=MAXSTRINGLENGTH) :: string
   PetscErrorCode :: ierr
   
   ! Init() is called in SubsurfaceInitializePostPetsc
   hydrogeophysics_coupler%option => simulation%option
   hydrogeophysics_coupler%realization => simulation%realization
   simulation%hydrogeophysics_coupler => hydrogeophysics_coupler
+  ! set up logging stage
+  string = 'Hydrogeophysics'
+  call LoggingCreateStage(string,hydrogeophysics_coupler%stage)
   if (associated(simulation%process_model_coupler_list%below)) then
     simulation%process_model_coupler_list%below%below => hydrogeophysics_coupler
   else

File src/pflotran/logging.F90

View file
  • Ignore whitespace
 
 #include "finclude/petscsys.h"
 
-! stages
-PetscInt, parameter, public :: INIT_STAGE = 1
-PetscInt, parameter, public :: TS_STAGE = 2
-PetscInt, parameter, public :: FLOW_STAGE = 3
-PetscInt, parameter, public :: TRAN_STAGE = 4
-PetscInt, parameter, public :: OUTPUT_STAGE = 5
-PetscInt, parameter, public :: FINAL_STAGE = 6
+  ! stages
+  PetscInt, parameter, public :: INIT_STAGE = 1
+  PetscInt, parameter, public :: TS_STAGE = 2
+  PetscInt, parameter, public :: OUTPUT_STAGE = 3
+  PetscInt, parameter, public :: FINAL_STAGE = 4
 
   type, public :: logging_type 
   
+    PetscInt :: stage_count
     PetscLogStage :: stage(10)
     
     PetscClassId :: class_pflotran
   type(logging_type), pointer, public :: logging
   
   public :: LoggingCreate, &
+            LoggingCreateStage, &
             LoggingDestroy
 
 contains
   
   allocate(logging)
 
+  logging%stage_count = FINAL_STAGE
+  
   call PetscLogStageRegister('Init Stage',  & 
                              logging%stage(INIT_STAGE),ierr)
   call PetscLogStageRegister('Time Step Stage', &
                              logging%stage(TS_STAGE),ierr)
-  call PetscLogStageRegister('Flow Stage', &
-                             logging%stage(FLOW_STAGE),ierr)
-  call PetscLogStageRegister('Transport Stage', &
-                             logging%stage(TRAN_STAGE),ierr)
   call PetscLogStageRegister('Output Stage', &
                              logging%stage(OUTPUT_STAGE),ierr)
   call PetscLogStageRegister('Finalization Stage', &
 
 ! ************************************************************************** !
 
+subroutine LoggingCreateStage(stage_name,stage_id)
+  ! 
+  ! OptionDestroy: Deallocates a logging object
+  ! 
+  ! Author: Glenn Hammond
+  ! Date: 10/26/07
+  ! 
+
+  implicit none
+  
+  character(len=MAXSTRINGLENGTH) :: stage_name
+  PetscInt :: stage_id
+  
+  character(len=MAXSTRINGLENGTH) :: full_stage_name
+  PetscErrorCode :: ierr
+  
+  logging%stage_count = logging%stage_count + 1
+  full_stage_name = stage_name // ' Stage'
+  call PetscLogStageRegister(full_stage_name,stage_id,ierr)
+  stage_id = logging%stage_count
+  
+end subroutine LoggingCreateStage
+  
+! ************************************************************************** !
+
 subroutine LoggingDestroy()
   ! 
   ! OptionDestroy: Deallocates a logging object

File src/pflotran/pmc_base.F90

View file
  • Ignore whitespace
   ! process model coupler type
   type, public :: pmc_base_type
     character(len=MAXWORDLENGTH) :: name
+    PetscInt :: stage
     PetscBool :: is_master
     type(option_type), pointer :: option
     class(stepper_base_type), pointer :: timestepper
 #endif
   
   this%name = 'PMCBase'
+  this%stage = 0
   this%is_master = PETSC_FALSE
   nullify(this%option)
   nullify(this%timestepper)
   PetscViewer :: viewer
   PetscErrorCode :: ierr
   
+  if (this%stage /= 0) call PetscLogStagePush(this%stage,ierr)
   this%option%io_buffer = trim(this%name) // ':' // trim(this%pm_list%name)  
   call printVerboseMsg(this%option)
   
 
   stop_flag = max(stop_flag,local_stop_flag)
   
+  if (this%stage /= 0) call PetscLogStagePop(ierr)
+  
 end subroutine PMCBaseRunToTime
 
 ! ************************************************************************** !

File src/pflotran/subsurface_factory.F90

View file
  • Ignore whitespace
   use PM_TH_class
   use PM_module
   use Timestepper_BE_class
+  use Logging_module
   
   implicit none
   
   
   class(realization_type), pointer :: realization
   type(option_type), pointer :: option
+  character(len=MAXSTRINGLENGTH) :: string
   PetscErrorCode :: ierr
   
   realization => simulation_old%realization
 
   nullify(flow_process_model_coupler)
   nullify(tran_process_model_coupler)
-
+  
   ! Create Subsurface-flow ProcessModel & ProcessModelCoupler
   if (option%nflowdof > 0) then
     select case(option%iflowmode)
     flow_process_model_coupler%realization => realization
     call HijackTimestepper(simulation_old%flow_stepper, &
                            flow_process_model_coupler%timestepper)
+    ! set up logging stage
+    string = trim(cur_process_model%name) // 'Flow'
+    call LoggingCreateStage(string,flow_process_model_coupler%stage)
     nullify(cur_process_model)
   endif
 
     tran_process_model_coupler%realization => realization
     call HijackTimestepper(simulation_old%tran_stepper, &
                            tran_process_model_coupler%timestepper)
+    ! set up logging stage
+    string = 'Reactive Transport'
+    call LoggingCreateStage(string,tran_process_model_coupler%stage)
     nullify(cur_process_model)
   endif
 

File src/pflotran/surface_factory.F90

View file
  • Ignore whitespace
   use PM_Base_class
   use PM_module
   use Timestepper_Surface_class
+  use Logging_module
 
   implicit none
   
   
   class(surface_realization_type), pointer :: surf_realization
   type(option_type), pointer :: option
+  character(len=MAXSTRINGLENGTH) :: string  
   PetscErrorCode :: ierr
   
   surf_realization => simulation_old%surf_realization
     surf_flow_process_model_coupler%pm_ptr%ptr => cur_process_model
     call HijackTimestepper(simulation_old%surf_flow_stepper, &
                            surf_flow_process_model_coupler%timestepper)
+    ! set up logging stage
+    string = 'Surface'
+    call LoggingCreateStage(string,surf_flow_process_model_coupler%stage)                           
     nullify(cur_process_model)
   endif