From cdef60136f9a077f61dc2d598bcd40aa617ea593 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 30 Jan 2012 20:06:12 -0500 Subject: [PATCH] added cmfd timing and options printout --- src/DEPENDENCIES | 3 ++- src/cmfd_execute.F90 | 10 +++++++++- src/cmfd_slepc_solver.F90 | 2 ++ src/cmfd_snes_solver.F90 | 23 ++++++++++++++++++++--- src/global.F90 | 4 +--- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/DEPENDENCIES b/src/DEPENDENCIES index 6a56d25eab..0b603791ff 100644 --- a/src/DEPENDENCIES +++ b/src/DEPENDENCIES @@ -19,10 +19,11 @@ cmfd_data.o: mesh.o cmfd_data.o: mesh_header.o cmfd_execute.o: cmfd_data.o -cmfd_output.o : cmfd_output.o +cmfd_execute.o: cmfd_output.o cmfd_execute.o: cmfd_power_solver.o cmfd_execute.o: cmfd_slepc_solver.o cmfd_execute.o: cmfd_snes_solver.o +cmfd_execute.o: timing.o cmfd_input.o: datatypes.o cmfd_input.o: error.o diff --git a/src/cmfd_execute.F90 b/src/cmfd_execute.F90 index ba609e25c4..c0c55b5134 100644 --- a/src/cmfd_execute.F90 +++ b/src/cmfd_execute.F90 @@ -5,7 +5,8 @@ module cmfd_execute use cmfd_power_solver, only: cmfd_power_execute use cmfd_slepc_solver, only: cmfd_slepc_execute use cmfd_snes_solver, only: cmfd_snes_execute - use global, only: cmfd,cmfd_only + use global, only: cmfd,cmfd_only,time_cmfd + use timing, only: timer_start,timer_stop implicit none @@ -24,6 +25,9 @@ contains integer :: ierr ! petsc error code + ! begin timer + call timer_start(time_cmfd) + ! set up cmfd if(.not. cmfd_only) call set_up_cmfd() @@ -33,8 +37,12 @@ contains ! execute snes solver call cmfd_snes_execute() + ! stop timer + call timer_stop(time_cmfd) + ! print results print *,'SNES Eigenvalue is:',cmfd%keff + print *,'CMFD Time:',time_cmfd%elapsed,' seconds.' ! finalize slepc call SlepcFinalize(ierr) diff --git a/src/cmfd_slepc_solver.F90 b/src/cmfd_slepc_solver.F90 index 6ae1880517..c294c4cc49 100644 --- a/src/cmfd_slepc_solver.F90 +++ b/src/cmfd_slepc_solver.F90 @@ -111,6 +111,8 @@ contains call PCGetType(pc,pctype,ierr) ! display information to user + write(*,'(/,A)') 'SLEPC SOLVER OPTIONS:' + write(*,*) '---------------------' write(*,*) 'EPS TYPE IS: ',epstype write(*,*) 'ST TYPE IS: ',sttype write(*,*) 'KSP TYPE IS: ',ksptype diff --git a/src/cmfd_snes_solver.F90 b/src/cmfd_snes_solver.F90 index 8c328c783c..e13e959391 100644 --- a/src/cmfd_snes_solver.F90 +++ b/src/cmfd_snes_solver.F90 @@ -15,6 +15,7 @@ implicit none type(prod_operator) :: prod Mat :: jac ! jacobian matrix + Mat :: jacpc ! preconditioned jacobian matrix Vec :: resvec ! residual vector Vec :: xvec ! results KSP :: ksp ! linear solver context @@ -95,6 +96,8 @@ contains subroutine init_solver() + character(LEN=20) :: snestype,ksptype,pctype + ! create SNES context call SNESCreate(PETSC_COMM_SELF,snes,ierr) @@ -111,11 +114,25 @@ contains ! set matrix free finite difference call MatCreateSNESMF(snes,jac,ierr) - call SNESSetJacobian(snes,jac,jac,MatMFFDComputeJacobian,PETSC_NULL,ierr) + call MatCreateSNESMF(snes,jacpc,ierr) + call SNESSetJacobian(snes,jac,jacpc,MatMFFDComputeJacobian,PETSC_NULL,ierr) ! set SNES options call SNESSetFromOptions(snes,ierr) + ! get all types and print + call SNESGetType(snes,snestype,ierr) + call KSPGetType(ksp,ksptype,ierr) + call PCGetType(pc,pctype,ierr) + + + ! display information to user + write(*,'(/,A)') 'SNES SOLVER OPTIONS:' + write(*,*) '---------------------' + write(*,*) 'SNES TYPE IS: ',snestype + write(*,*) 'KSP TYPE IS: ',ksptype + write(*,*) 'PC TYPE IS: ',pctype + end subroutine init_solver !=============================================================================== @@ -197,9 +214,9 @@ contains end subroutine compute_nonlinear_residual -!============================================================================== +!=============================================================================== ! EXTRACT_RESULTS -!============================================================================== +!=============================================================================== subroutine extract_results() diff --git a/src/global.F90 b/src/global.F90 index 0f0661eecc..076a91fc64 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -204,9 +204,7 @@ module global type(cmfd_obj) :: cmfd ! Timing objects - type(Timer) :: time_cmfd ! timer for whole calculation - type(Timer) :: time_mat ! timer for mat building - type(Timer) :: time_eigen ! timer for eigenvalue calculation + type(Timer) :: time_cmfd ! timer for whole cmfd calculation ! Flag for CMFD only logical :: cmfd_only = .FALSE.