CMFD runs on 1 proc

This commit is contained in:
Bryan Herman 2012-03-27 08:23:23 -07:00
parent 115fdd7990
commit 8ebfb22c12
5 changed files with 57 additions and 13 deletions

View file

@ -23,6 +23,7 @@ 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: tally.o
cmfd_execute.o: timing.o
cmfd_input.o: datatypes.o

View file

@ -536,6 +536,7 @@ contains
! record dtilde in cmfd object
cmfd%dhat(l,g,i,j,k) = dhat
! cmfd%dhat(l,g,i,j,k) = 0.0_8
end do LEAK

View file

@ -34,7 +34,7 @@ contains
call petsc_init_mpi()
! filter procs
if (rank < 6) then
if (rank < 1) then
! initialize slepc/petsc (communicates to world)
if(current_cycle == n_inactive + 1) call SlepcInitialize &
@ -59,6 +59,7 @@ contains
! execute snes solver
call cmfd_snes_execute()
! call cmfd_slepc_execute()
! only run if master process
if (master) then
@ -133,6 +134,44 @@ contains
end subroutine cmfd_bcast
!===============================================================================
! PETSC_INIT_MPI
!===============================================================================
!
! subroutine petsc_init_mpi()
!
! integer :: new_comm ! new communicator
! integer :: orig_group ! original MPI group for MPI_COMM_WORLD
! integer :: new_group ! new MPI group subset of orig_group
! integer,allocatable :: ranks(:) ! ranks to include for petsc
! integer :: k ! iteration counter
!
! ! set ranks 0-6 or min
! if (n_procs >= 6) then
! if (.not. allocated(ranks)) allocate(ranks(0:5))
! ranks = (/0,1,2,3,4,5/)
! else
! if (.not. allocated(ranks)) allocate(ranks(0:n_procs-1))
! ranks = (/(k,k=0,n_procs-1)/)
! end if
!
! ! get the original mpi group
! call MPI_COMM_GROUP(MPI_COMM_WORLD,orig_group,mpi_err)
!
! ! new group init
! call MPI_GROUP_INCL(orig_group,size(ranks),ranks,new_group,mpi_err)
!
! ! create new communicator
! call MPI_COMM_CREATE(MPI_COMM_WORLD,new_group,new_comm,mpi_err)
!
! ! deallocate ranks
! if (allocated(ranks)) deallocate(ranks)
!
! ! set PETSC_COMM_WORLD to this subset
! PETSC_COMM_WORLD = new_comm
!
! end subroutine petsc_init_mpi
!===============================================================================
! PETSC_INIT_MPI
!===============================================================================
@ -144,28 +183,31 @@ contains
integer :: new_group ! new MPI group subset of orig_group
integer,allocatable :: ranks(:) ! ranks to include for petsc
integer :: k ! iteration counter
integer :: nprocs
nprocs = 1
! set ranks 0-6 or min
if (n_procs >= 6) then
if (nprocs >= 6) then
if (.not. allocated(ranks)) allocate(ranks(0:5))
ranks = (/0,1,2,3,4,5/)
else
if (.not. allocated(ranks)) allocate(ranks(0:n_procs-1))
ranks = (/(k,k=0,n_procs-1)/)
if (.not. allocated(ranks)) allocate(ranks(0:nprocs-1))
ranks = (/(k,k=0,nprocs-1)/)
end if
! get the original mpi group
call MPI_COMM_GROUP(MPI_COMM_WORLD,orig_group,mpi_err)
! new group init
call MPI_GROUP_INCL(orig_group,size(ranks),ranks,new_group,mpi_err)
! create new communicator
call MPI_COMM_CREATE(MPI_COMM_WORLD,new_group,new_comm,mpi_err)
! deallocate ranks
if (allocated(ranks)) deallocate(ranks)
! set PETSC_COMM_WORLD to this subset
PETSC_COMM_WORLD = new_comm

View file

@ -339,11 +339,11 @@ contains
end if
! write out cmfd eigenvector
dim1 = (/cmfd%mat_dim*cmfd%indices(4)/)
call h5screate_simple_f(1,dim1,dataspace_id,hdf5_err)
dim4 = (/ng,nx,ny,nz/)
call h5screate_simple_f(4,dim4,dataspace_id,hdf5_err)
call h5dcreate_f(hdf5_output_file,trim(cycname)//"/cmfd_source", &
& H5T_NATIVE_DOUBLE,dataspace_id,dataset_id,hdf5_err)
call h5dwrite_f(dataset_id,H5T_NATIVE_DOUBLE,cmfd%source,dim1,hdf5_err)
call h5dwrite_f(dataset_id,H5T_NATIVE_DOUBLE,cmfd%source,dim4,hdf5_err)
call h5dclose_f(dataset_id,hdf5_err)
! write out openmc source vector

View file

@ -138,7 +138,7 @@ contains
call SNESSetLagPreconditioner(snes,-1,ierr)
! set convergence
call SNESSetTolerances(snes,1.0e-8_8,1.0e-8_8,1.0e-8_8,50,10000,ierr)
! call SNESSetTolerances(snes,1.0e-8_8,1.0e-8_8,1.0e-8_8,50,10000,ierr)
! set SNES options
call SNESSetFromOptions(snes,ierr)