introduced option for regridding to numerics.f90, working as follows:
first cut back is tried if material point model oder BVP solver does not converge. If no regridding is enabled after max cut back, in case of non-converged material point the simulation stops and in case of non-converged BVP solver it continues. set regridMode to 2 to enable regridding if BVP solver OR materialPoint model do not converge, set regridMode to 1 to enable regridding if materialPoint model do not converge, non-converged BVP solver will be ignored as in the standard case. For regridding, the load case need to have a restart freq set. enabled restarting for Basic PETSc variant
This commit is contained in:
parent
64d9c70dc7
commit
7b87987751
|
@ -44,7 +44,8 @@ program DAMASK_spectral_Driver
|
|||
use numerics, only: &
|
||||
maxCutBack, &
|
||||
rotation_tol, &
|
||||
mySpectralSolver
|
||||
mySpectralSolver, &
|
||||
regridMode
|
||||
use homogenization, only: &
|
||||
materialpoint_sizeResults, &
|
||||
materialpoint_results
|
||||
|
@ -100,7 +101,7 @@ program DAMASK_spectral_Driver
|
|||
integer(pInt) :: currentLoadcase = 0_pInt, inc, &
|
||||
totalIncsCounter = 0_pInt,&
|
||||
notConvergedCounter = 0_pInt, convergedCounter = 0_pInt, &
|
||||
resUnit = 0_pInt, statUnit = 0_pInt
|
||||
resUnit = 0_pInt, statUnit = 0_pInt, lastRestartWritten = 0_pInt
|
||||
character(len=6) :: loadcase_string
|
||||
character(len=1024) :: incInfo
|
||||
type(tLoadCase), allocatable, dimension(:) :: loadCases
|
||||
|
@ -405,8 +406,10 @@ program DAMASK_spectral_Driver
|
|||
timeinc_old = timeinc
|
||||
timeinc = timeinc/2.0_pReal
|
||||
elseif (solres%termIll) then ! material point model cannot find a solution
|
||||
if(regridMode > 0_pInt) call quit(-1*(lastRestartWritten+1))
|
||||
call IO_error(850_pInt)
|
||||
else
|
||||
if(regridMode == 2_pInt) call quit(-1*(lastRestartWritten+1))
|
||||
guess = .true. ! start guessing after first accepted (not converged) (sub)inc
|
||||
endif
|
||||
else
|
||||
|
@ -433,6 +436,7 @@ program DAMASK_spectral_Driver
|
|||
if( loadCases(currentLoadCase)%restartFrequency > 0_pInt .and. &
|
||||
mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0_pInt) then ! at frequency of writing restart information set restart parameter for FEsolving (first call to CPFEM_general will write ToDo: true?)
|
||||
restartWrite = .true.
|
||||
lastRestartWritten = inc
|
||||
endif
|
||||
else !just time forwarding
|
||||
time = time + timeinc
|
||||
|
|
|
@ -73,11 +73,10 @@ subroutine basic_init()
|
|||
integer(pInt) :: &
|
||||
i, j, k
|
||||
real(pReal), dimension(3,3) :: &
|
||||
temp33_Real
|
||||
temp33_Real = 0.0_pReal
|
||||
real(pReal), dimension(3,3,3,3) :: &
|
||||
temp3333_Real
|
||||
|
||||
|
||||
call Utilities_Init()
|
||||
write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverBasic init -+>>>'
|
||||
write(6,'(a)') ' $Id$'
|
||||
|
@ -86,9 +85,9 @@ subroutine basic_init()
|
|||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! allocate global fields
|
||||
allocate (F ( 3,3,res(1), res(2),res(3)), source = 0.0_pReal)
|
||||
allocate (F_lastInc ( 3,3,res(1), res(2),res(3)), source = 0.0_pReal)
|
||||
allocate (Fdot ( 3,3,res(1), res(2),res(3)), source = 0.0_pReal)
|
||||
allocate (F (3,3,res(1), res(2),res(3)), source = 0.0_pReal)
|
||||
allocate (F_lastInc (3,3,res(1), res(2),res(3)), source = 0.0_pReal)
|
||||
allocate (Fdot (3,3,res(1), res(2),res(3)), source = 0.0_pReal)
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! init fields and average quantities
|
||||
|
@ -355,6 +354,9 @@ logical function basic_Converged(err_div,pAvgDiv,err_stress,pAvgStress)
|
|||
end function basic_Converged
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief does the cleaning up after the simulation has finished
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine basic_destroy()
|
||||
|
||||
use DAMASK_spectral_Utilities, only: &
|
||||
|
|
|
@ -49,7 +49,8 @@ module DAMASK_spectral_SolverBasicPETSc
|
|||
real(pReal), private, dimension(3,3) :: &
|
||||
F_aim = math_I3, &
|
||||
F_aim_lastInc = math_I3, &
|
||||
P_av
|
||||
P_av, &
|
||||
F_aimDot=0.0_pReal
|
||||
character(len=1024), private :: incInfo
|
||||
real(pReal), private, dimension(3,3,3,3) :: &
|
||||
C = 0.0_pReal, C_lastInc= 0.0_pReal, &
|
||||
|
@ -102,7 +103,11 @@ subroutine basicPETSc_init()
|
|||
PetscScalar, dimension(:,:,:,:), pointer :: F
|
||||
PetscErrorCode :: ierr
|
||||
PetscObject :: dummy
|
||||
|
||||
real(pReal), dimension(3,3) :: &
|
||||
temp33_Real = 0.0_pReal
|
||||
real(pReal), dimension(3,3,3,3) :: &
|
||||
temp3333_Real = 0.0_pReal
|
||||
|
||||
call Utilities_init()
|
||||
write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverBasicPETSc init -+>>>'
|
||||
write(6,'(a)') ' $Id: DAMASK_spectral_SolverBasicPETSC.f90 1654 2012-08-03 09:25:48Z MPIE\m.diehl $'
|
||||
|
@ -151,34 +156,37 @@ subroutine basicPETSc_init()
|
|||
close (777)
|
||||
call IO_read_jobBinaryFile(777,'convergedSpectralDefgrad_lastInc',&
|
||||
trim(getSolverJobName()),size(F_lastInc))
|
||||
|
||||
read (777,rec=1) F_lastInc
|
||||
close (777)
|
||||
F_aim = reshape(sum(sum(sum(F,dim=4),dim=3),dim=2) * wgt, [3,3]) ! average of F
|
||||
F_aim_lastInc = sum(sum(sum(F_lastInc,dim=5),dim=4),dim=3) * wgt ! average of F_lastInc
|
||||
|
||||
|
||||
call IO_read_jobBinaryFile(777,'C_lastInc',trim(getSolverJobName()),size(C_lastInc))
|
||||
read (777,rec=1) C_lastInc
|
||||
close (777)
|
||||
call IO_read_jobBinaryFile(777,'C',trim(getSolverJobName()),size(C))
|
||||
read (777,rec=1) C
|
||||
close (777)
|
||||
call IO_read_jobBinaryFile(777,'F_aimDot',trim(getSolverJobName()),size(f_aimDot))
|
||||
read (777,rec=1) f_aimDot
|
||||
close (777)
|
||||
call IO_read_jobBinaryFile(777,'C_ref',trim(getSolverJobName()),size(temp3333_Real))
|
||||
read (777,rec=1) temp3333_Real
|
||||
close (777)
|
||||
endif
|
||||
mesh_ipCoordinates = 0.0_pReal !reshape(mesh_deformedCoordsFFT(geomdim,&
|
||||
!reshape(F,[3,3,res(1),res(2),res(3)])),[3,1,mesh_NcpElems])
|
||||
call Utilities_constitutiveResponse(&
|
||||
reshape(F(0:8,0:res(1)-1_pInt,0:res(2)-1_pInt,0:res(3)-1_pInt),[3,3,res(1),res(2),res(3)]),&
|
||||
reshape(F(0:8,0:res(1)-1_pInt,0:res(2)-1_pInt,0:res(3)-1_pInt),[3,3,res(1),res(2),res(3)]),&
|
||||
temperature,0.0_pReal,P,C,P_av,.false.,math_I3)
|
||||
temperature,0.0_pReal,P,C,temp33_Real,.false.,math_I3)
|
||||
call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr) ! write data back into PETSc
|
||||
CHKERRQ(ierr)
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! reference stiffness and Gamma operator
|
||||
if (restartInc == 1_pInt) then
|
||||
call IO_write_jobBinaryFile(777,'C_ref',size(C))
|
||||
write (777,rec=1) C
|
||||
close(777)
|
||||
elseif (restartInc > 1_pInt) then
|
||||
call IO_read_jobBinaryFile(777,'C_ref',trim(getSolverJobName()),size(C))
|
||||
read (777,rec=1) C
|
||||
close (777)
|
||||
endif
|
||||
call Utilities_updateGamma(C,.True.)
|
||||
if (restartInc == 1_pInt) then ! use initial stiffness as reference stiffness
|
||||
temp3333_Real = C
|
||||
endif
|
||||
|
||||
call Utilities_updateGamma(temp3333_Real,.True.)
|
||||
|
||||
end subroutine basicPETSc_init
|
||||
|
||||
|
@ -220,7 +228,6 @@ type(tSolutionState) function &
|
|||
type(tBoundaryCondition), intent(in) :: P_BC,F_BC
|
||||
real(pReal), dimension(3,3), intent(in) :: rotation_BC
|
||||
character(len=*), intent(in) :: incInfoIn
|
||||
real(pReal), dimension(3,3),save :: F_aimDot=0.0_pReal
|
||||
real(pReal), dimension(3,3) :: &
|
||||
F_aim_lab
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
@ -233,19 +240,29 @@ type(tSolutionState) function &
|
|||
PetscErrorCode :: ierr
|
||||
SNESConvergedReason :: reason
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! restart information for spectral solver
|
||||
incInfo = incInfoIn
|
||||
|
||||
call DMDAVecGetArrayF90(da,solution_vec,F,ierr)
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! write restart information for spectral solver
|
||||
if (restartWrite) then
|
||||
write(6,'(a)') 'writing converged results for restart'
|
||||
call IO_write_jobBinaryFile(777,'convergedSpectralDefgrad',size(F_lastInc))
|
||||
write (777,rec=1) F_LastInc
|
||||
call IO_write_jobBinaryFile(777,'convergedSpectralDefgrad',size(F)) ! writing deformation gradient field to file
|
||||
write (777,rec=1) F
|
||||
close (777)
|
||||
call IO_write_jobBinaryFile(777,'convergedSpectralDefgrad_lastInc',size(F_lastInc)) ! writing F_lastInc field to file
|
||||
write (777,rec=1) F_lastInc
|
||||
close (777)
|
||||
call IO_write_jobBinaryFile(777,'C',size(C))
|
||||
write (777,rec=1) C
|
||||
close(777)
|
||||
call IO_write_jobBinaryFile(777,'C_lastInc',size(C_lastInc))
|
||||
write (777,rec=1) C_lastInc
|
||||
close(777)
|
||||
call IO_write_jobBinaryFile(777,'F_aimDot',size(f_aimDot))
|
||||
write (777,rec=1) f_aimDot
|
||||
close(777)
|
||||
endif
|
||||
call DMDAVecGetArrayF90(da,solution_vec,F,ierr)
|
||||
mesh_ipCoordinates = reshape(mesh_deformedCoordsFFT(geomdim,reshape(F,[3,3,res(1),res(2),res(3)])),&
|
||||
[3,1,mesh_NcpElems])
|
||||
if ( cutBack) then
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
!$Id$
|
||||
#ifdef __GFORTRAN__
|
||||
#if __GNUC__<=4 && __GNUC_MINOR__<=5
|
||||
write(6,'(a,i1.1,a,i1.1,a,i2.2))') ' Compiled with GCC version ', __GNUC__,'.',__GNUC_MINOR__,&
|
||||
'.',__GNUC_PATCHLEVEL__
|
||||
#else
|
||||
write(6,*) 'Compiled with ', compiler_version() !not supported by GFORTRAN 4.5 and ifort 12
|
||||
write(6,*) 'With options ', compiler_options()
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __INTEL_COMPILER
|
||||
write(6,'(a,i4.4,a,i8.8)') ' Compiled with Intel fortran version ', __INTEL_COMPILER,&
|
||||
|
|
|
@ -103,7 +103,8 @@ integer(pInt), protected, public :: &
|
|||
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
|
||||
maxCutBack = 3_pInt !< max number of cut backs
|
||||
maxCutBack = 3_pInt, & !< max number of cut backs
|
||||
regridMode = 0_pInt !< 0: no regrid; 1: regrid if DAMASK doesn't converge; 2: regrid if DAMASK or BVP Solver doesn't converge
|
||||
logical, protected , public :: &
|
||||
memory_efficient = .true., & !< for fast execution (pre calculation of gamma_hat), Default .true.: do not precalculate
|
||||
divergence_correction = .false., & !< correct divergence calculation in fourier space, Default .false.: no correction
|
||||
|
@ -273,6 +274,8 @@ subroutine numerics_init
|
|||
itmin = IO_intValue(line,positions,2_pInt)
|
||||
case ('maxcutback')
|
||||
maxCutBack = IO_intValue(line,positions,2_pInt)
|
||||
case ('regridmode')
|
||||
regridMode = IO_intValue(line,positions,2_pInt)
|
||||
case ('memory_efficient')
|
||||
memory_efficient = IO_intValue(line,positions,2_pInt) > 0_pInt
|
||||
case ('fftw_timelimit')
|
||||
|
@ -401,6 +404,7 @@ numerics_timeSyncing = numerics_timeSyncing .and. all(numerics_integrator==2_pIn
|
|||
write(6,'(a24,1x,i8)') ' itmax: ',itmax
|
||||
write(6,'(a24,1x,i8)') ' itmin: ',itmin
|
||||
write(6,'(a24,1x,i8)') ' maxCutBack: ',maxCutBack
|
||||
write(6,'(a24,1x,i8)') ' regridMode: ',regridMode
|
||||
write(6,'(a24,1x,L8)') ' memory_efficient: ',memory_efficient
|
||||
if(fftw_timelimit<0.0_pReal) then
|
||||
write(6,'(a24,1x,L8)') ' fftw_timelimit: ',.false.
|
||||
|
|
Loading…
Reference in New Issue