moved petsc option string to numerics and added new numerics parameters to config file

This commit is contained in:
Pratheek Shanthraj 2012-08-06 17:27:53 +00:00
parent 93658c72db
commit 32f8c9c6ea
3 changed files with 29 additions and 20 deletions

View File

@ -56,7 +56,6 @@ module DAMASK_spectral_SolverAL
PetscInt, private :: xs,xm,gxs,gxm
PetscInt, private :: ys,ym,gys,gym
PetscInt, private :: zs,zm,gzs,gzm
character(len=1024), private :: PetSc_options = '-snes_type ngmres -snes_ngmres_anderson -snes_monitor -snes_view'
!--------------------------------------------------------------------------------------------------
! common pointwise data
@ -105,9 +104,13 @@ module DAMASK_spectral_SolverAL
Utilities_updateGamma, &
debugrestart
use numerics, only: &
petsc_options
use mesh, only: &
res, &
geomdim
use math, only: &
math_invSym3333
@ -208,7 +211,7 @@ module DAMASK_spectral_SolverAL
call SNESSetDM(snes,da,ierr_psc)
call SNESSetFunction(snes,residual,AL_FormRHS,dummy,ierr_psc)
call SNESSetConvergenceTest(snes,AL_converged,dummy,PETSC_NULL_FUNCTION,ierr_psc)
call PetscOptionsInsertString(PetSc_options,ierr_psc)
call PetscOptionsInsertString(petsc_options,ierr_psc)
call SNESSetFromOptions(snes,ierr_psc)
call DMDAGetCorners(da,xs,ys,zs,xm,ym,zm,ierr_psc)
call DMDAGetCorners(da,gxs,gys,gzs,gxm,gym,gzm,ierr_psc)
@ -321,8 +324,9 @@ module DAMASK_spectral_SolverAL
end function AL_solution
! -------------------------------------------------------------------
!--------------------------------------------------------------------------------------------------
!> @brief fills solution vector with forwarded fields
!--------------------------------------------------------------------------------------------------
subroutine AL_InitialGuess(xx_psc)
implicit none
@ -360,6 +364,9 @@ module DAMASK_spectral_SolverAL
return
end subroutine AL_InitialGuess
!--------------------------------------------------------------------------------------------------
!> @brief forms the AL residual vector
!--------------------------------------------------------------------------------------------------
subroutine AL_FormRHS(snes_local,X_local,F_local,dummy,ierr_psc)
! Input/output variables:
@ -409,18 +416,9 @@ module DAMASK_spectral_SolverAL
end subroutine AL_FormRHS
! ---------------------------------------------------------------------
!
! Input Parameter:
! x - local vector data
!
! Output Parameters:
! f - local vector data, f(x)
! ierr - error code
!
! Notes:
! This routine uses standard Fortran-style computations over a 3-dim array.
!
!--------------------------------------------------------------------------------------------------
!> @brief forms the AL residual vector
!--------------------------------------------------------------------------------------------------
subroutine AL_FormRHS_local(x_scal,f_scal,dummy,ierr_psc)
use numerics, only: &
@ -545,9 +543,9 @@ module DAMASK_spectral_SolverAL
return
end subroutine AL_FormRHS_local
! ---------------------------------------------------------------------
! User defined convergence check
!
!--------------------------------------------------------------------------------------------------
!> @brief convergence check
!--------------------------------------------------------------------------------------------------
subroutine AL_converged(snes_local,it,xnorm,snorm,fnorm,reason,dummy,ierr_psc)
use numerics, only: &
@ -589,6 +587,9 @@ module DAMASK_spectral_SolverAL
end subroutine AL_converged
!--------------------------------------------------------------------------------------------------
!> @brief destroy routine
!--------------------------------------------------------------------------------------------------
subroutine AL_destroy()
use DAMASK_spectral_Utilities, only: &
Utilities_destroy

View File

@ -55,6 +55,8 @@ fixed_seed 0 # put any number larger than zero, intege
err_div_tol 0.1 # Div(P)/avg(P)*meter
err_stress_tolrel 0.01 # relative tolerance for fulfillment of stress BC
err_stress_tolabs 9.9e40 # absolute tolerance for fulfillment of stress BC
err_f_tol 1e-6 # tolerance for compatible and incompatible deformation gradient fields in AL solver
err_p_tol 1e-5 # tolerance for compatible and incompatible stress fields in AL solver
fftw_timelimit -1.0 # timelimit of plan creation for FFTW, see manual on www.fftw.org, Default -1.0: disable timelimit
rotation_tol 1.0e-12 # tolerance of rotation specified in loadcase, Default 1.0e-12: first guess
fftw_plan_mode FFTW_PATIENT # reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag
@ -63,3 +65,5 @@ itmin 2 # Minimum iteration number
memory_efficient 1 # Precalculate Gamma-operator (81 double per point)
update_gamma 0 # Update Gamma-operator with current dPdF (not possible if memory_efficient=1)
divergence_correction 0 # Use dimension-independent divergence criterion
myspectralsolver AL # Type of spectral solver (AL-augmented lagrange, basic-basic)
petsc_options -snes_type ngmres -snes_ngmres_anderson -snes_view # PetSc solver options

View File

@ -83,6 +83,7 @@ real(pReal) :: err_div_tol = 0.1_pReal, &
rotation_tol = 1.0e-12_pReal ! tolerance of rotation specified in loadcase, Default 1.0e-12: first guess
character(len=64) :: fftw_plan_mode = 'FFTW_PATIENT', & ! reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag
myspectralsolver = 'basic' ! spectral solution method
character(len=1024) :: petsc_options = '-snes_type ngmres -snes_ngmres_anderson -snes_view'
integer(pInt) :: fftw_planner_flag = 32_pInt, & ! conversion of fftw_plan_mode to integer, basically what is usually done in the include file of fftw
itmax = 20_pInt, & ! maximum number of iterations
itmin = 2_pInt ! minimum number of iterations
@ -256,6 +257,8 @@ subroutine numerics_init
fftw_plan_mode = IO_stringValue(line,positions,2_pInt)
case ('myspectralsolver')
myspectralsolver = IO_stringValue(line,positions,2_pInt)
case ('petsc_options')
petsc_options = IO_stringValue(line,positions,2_pInt)
case ('rotation_tol')
rotation_tol = IO_floatValue(line,positions,2_pInt)
case ('divergence_correction')
@ -266,7 +269,7 @@ subroutine numerics_init
#ifndef Spectral
case ('err_div_tol','err_stress_tolrel','err_stress_tolabs',&
'itmax', 'itmin','memory_efficient','fftw_timelimit','fftw_plan_mode','myspectralsolver', &
'rotation_tol','divergence_correction','update_gamma')
'rotation_tol','divergence_correction','update_gamma','petsc_options')
call IO_warning(40_pInt,ext_msg=tag)
#endif
case default
@ -360,6 +363,7 @@ subroutine numerics_init
endif
write(6,'(a24,1x,a)') ' fftw_plan_mode: ',trim(fftw_plan_mode)
write(6,'(a24,1x,a)') ' myspectralsolver: ',trim(myspectralsolver)
write(6,'(a24,1x,a)') ' PetSc_options: ',trim(petsc_options)
write(6,'(a24,1x,i8)') ' fftw_planner_flag: ',fftw_planner_flag
write(6,'(a24,1x,es8.1)') ' rotation_tol: ',rotation_tol
write(6,'(a24,1x,L8,/)') ' divergence_correction: ',divergence_correction