mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Added HYPRE parallel preconditiong, default is parallel algebraic multigrid. Also cleaned up solver routines
This commit is contained in:
parent
ca531024f7
commit
40590b8aa9
7 changed files with 30 additions and 36 deletions
|
|
@ -15,14 +15,14 @@ include OBJECTS
|
|||
# User Options
|
||||
#===============================================================================
|
||||
|
||||
F90X = /home/bherman/petsc/release/bin/mpif90
|
||||
F90X = /home/bherman/petsc/release-ifort/bin/mpif90
|
||||
F90XFLAGS = -Wall -Wno-unused-variable
|
||||
COMPILER = petsc
|
||||
DEBUG = no
|
||||
PROFILE = no
|
||||
OPTIMIZE = no
|
||||
USE_MPI = no
|
||||
USE_HDF5 = yes
|
||||
USE_HDF5 = no
|
||||
|
||||
#===============================================================================
|
||||
# GNU Fortran compiler options
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ contains
|
|||
if (master) then
|
||||
|
||||
! begin timer
|
||||
! call timer_start(time_cmfd)
|
||||
call timer_start(time_cmfd)
|
||||
|
||||
! set up cmfd
|
||||
if(.not. cmfd_only) call set_up_cmfd()
|
||||
|
|
@ -57,7 +57,7 @@ contains
|
|||
#endif
|
||||
|
||||
! stop timer
|
||||
! call timer_stop(time_cmfd)
|
||||
call timer_stop(time_cmfd)
|
||||
|
||||
! write vtk file
|
||||
!if(.not. cmfd_only) call write_cmfd_vtk()
|
||||
|
|
|
|||
|
|
@ -323,7 +323,6 @@ contains
|
|||
use global, only: hdf5_output_file,hdf5_err
|
||||
use hdf5
|
||||
use hdf5_interface, only: hdf5_open_output, hdf5_close_output
|
||||
#endif
|
||||
|
||||
! integer(HID_T) :: file_id ! File identifier
|
||||
integer(HID_T) :: dataset_id ! Dataset identifier
|
||||
|
|
@ -474,6 +473,8 @@ contains
|
|||
! close output file
|
||||
call hdf5_close_output()
|
||||
|
||||
#endif
|
||||
|
||||
end subroutine read_cmfd_hdf5
|
||||
|
||||
end module cmfd_input
|
||||
|
|
|
|||
|
|
@ -210,7 +210,6 @@ contains
|
|||
real(8), pointer :: sptr(:) ! pointer to source vector
|
||||
real(8), allocatable :: vals(:) ! vector of row values
|
||||
real(8), allocatable :: phi_tmp(:) ! temp buffer for flux
|
||||
print *,'In Jacobian'
|
||||
|
||||
! create operators
|
||||
call build_loss_matrix(ctx%loss)
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ contains
|
|||
#ifdef HDF5
|
||||
use hdf5
|
||||
use global, only: hdf5_output_file,hdf5_err
|
||||
#endif
|
||||
|
||||
! character(LEN=7), parameter :: filename = "cmfd.h5" ! File name
|
||||
! character(LEN=4) :: grpname = "cmfd" ! Group name
|
||||
|
|
@ -328,6 +327,8 @@ contains
|
|||
! close the cycle
|
||||
call h5gclose_f(cycle_id,hdf5_err)
|
||||
|
||||
#endif
|
||||
|
||||
end subroutine write_cmfd_hdf5
|
||||
|
||||
!===============================================================================
|
||||
|
|
|
|||
|
|
@ -40,17 +40,17 @@ call timer_start(time_cmfd)
|
|||
|
||||
! initialize solver
|
||||
call init_solver()
|
||||
call timer_stop(time_cmfd)
|
||||
if(master) print *,'Init Time:',time_cmfd%elapsed
|
||||
call timer_reset(time_cmfd)
|
||||
call timer_start(time_cmfd)
|
||||
!all timer_stop(time_cmfd)
|
||||
!f(master) print *,'Init Time:',time_cmfd%elapsed
|
||||
!all timer_reset(time_cmfd)
|
||||
!all timer_start(time_cmfd)
|
||||
! build operators
|
||||
call build_loss_matrix(loss)
|
||||
call build_prod_matrix(prod)
|
||||
call timer_stop(time_cmfd)
|
||||
if(master) print *,'Build Time',time_cmfd%elapsed
|
||||
call timer_reset(time_cmfd)
|
||||
call timer_start(time_cmfd)
|
||||
!all timer_stop(time_cmfd)
|
||||
!f(master) print *,'Build Time',time_cmfd%elapsed
|
||||
!all timer_reset(time_cmfd)
|
||||
!all timer_start(time_cmfd)
|
||||
! set operators to EPS object
|
||||
call EPSSetOperators(eps,prod%F,loss%M,ierr)
|
||||
|
||||
|
|
@ -59,15 +59,15 @@ call timer_start(time_cmfd)
|
|||
|
||||
! solve the system
|
||||
call EPSSolve(eps,ierr)
|
||||
call timer_stop(time_cmfd)
|
||||
if(master) print *,'Solve Time:',time_cmfd%elapsed
|
||||
call timer_reset(time_cmfd)
|
||||
call timer_start(time_cmfd)
|
||||
!all timer_stop(time_cmfd)
|
||||
!f(master) print *,'Solve Time:',time_cmfd%elapsed
|
||||
!all timer_reset(time_cmfd)
|
||||
!all timer_start(time_cmfd)
|
||||
! extracts results to cmfd object
|
||||
call extract_results()
|
||||
call timer_stop(time_cmfd)
|
||||
if(master) print *,'Extraction Time:',time_cmfd%elapsed
|
||||
call timer_reset(time_cmfd)
|
||||
!all timer_stop(time_cmfd)
|
||||
!f(master) print *,'Extraction Time:',time_cmfd%elapsed
|
||||
!all timer_reset(time_cmfd)
|
||||
! deallocate all slepc data
|
||||
call finalize()
|
||||
|
||||
|
|
|
|||
|
|
@ -33,20 +33,16 @@ contains
|
|||
!===============================================================================
|
||||
|
||||
subroutine cmfd_snes_execute()
|
||||
print *,'executing slepc'
|
||||
call MPI_Barrier(MPI_COMM_WORLD,ierr)
|
||||
|
||||
! call slepc solver
|
||||
call cmfd_slepc_execute()
|
||||
print *,'initing data'
|
||||
call MPI_Barrier(MPI_COMM_WORLD,ierr)
|
||||
|
||||
! initialize data
|
||||
call init_data()
|
||||
print *,'initing solver'
|
||||
call MPI_Barrier(MPI_COMM_WORLD,ierr)
|
||||
|
||||
! initialize solver
|
||||
call init_solver()
|
||||
print *,'solving system'
|
||||
call MPI_Barrier(MPI_COMM_WORLD,ierr)
|
||||
|
||||
! solve the system
|
||||
call SNESSolve(snes,PETSC_NULL,xvec,ierr)
|
||||
|
||||
|
|
@ -80,8 +76,7 @@ print *,'solving system'
|
|||
|
||||
! get problem size
|
||||
n = jac_prec%n
|
||||
print *,cmfd%phi
|
||||
print *,cmfd%keff
|
||||
|
||||
! create PETSc vectors
|
||||
call VecCreateMPI(PETSC_COMM_WORLD,jac_prec%localn,PETSC_DECIDE,resvec,ierr)
|
||||
call VecCreateMPI(PETSC_COMM_WORLD,jac_prec%localn,PETSC_DECIDE,xvec,ierr)
|
||||
|
|
@ -129,9 +124,8 @@ print *,cmfd%keff
|
|||
|
||||
! set preconditioner
|
||||
call KSPGetPC(ksp,pc,ierr)
|
||||
! call PCSetType(pc,PCILU,ierr)
|
||||
! call PCFactorSetLevels(pc,25,ierr)
|
||||
call PCSetType(pc,PCBJACOBI,ierr)
|
||||
call PCSetType(pc,PCHYPRE,ierr)
|
||||
call PCSetFromOptions(pc,ierr)
|
||||
call KSPSetFromOptions(ksp,ierr)
|
||||
|
||||
! create matrix free jacobian
|
||||
|
|
@ -192,7 +186,6 @@ print *,cmfd%keff
|
|||
real(8), pointer :: xptr(:) ! pointer to solution vector
|
||||
real(8), pointer :: rptr(:) ! pointer to residual vector
|
||||
PetscViewer :: viewer
|
||||
print *,'In residual'
|
||||
|
||||
! create operators
|
||||
call build_loss_matrix(ctx%loss)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue