fixed some buggy last minute changes in the last commit
This commit is contained in:
parent
4cb6c0a706
commit
7f3c24e1f1
|
@ -557,7 +557,7 @@ program DAMASK_spectral_Driver
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! report summary of whole calculation
|
! report summary of whole calculation
|
||||||
write(6,'(/,a)') ' ##################################################################'
|
write(6,'(/,a)') ' ###########################################################################'
|
||||||
write(6,'(1x,i6.6,a,i6.6,a,f5.1,a)') convergedCounter, ' out of ', &
|
write(6,'(1x,i6.6,a,i6.6,a,f5.1,a)') convergedCounter, ' out of ', &
|
||||||
notConvergedCounter + convergedCounter, ' (', &
|
notConvergedCounter + convergedCounter, ' (', &
|
||||||
real(convergedCounter, pReal)/&
|
real(convergedCounter, pReal)/&
|
||||||
|
|
|
@ -131,7 +131,7 @@ subroutine AL_init(temperature)
|
||||||
IO_read_JobBinaryFile, &
|
IO_read_JobBinaryFile, &
|
||||||
IO_write_JobBinaryFile, &
|
IO_write_JobBinaryFile, &
|
||||||
IO_timeStamp
|
IO_timeStamp
|
||||||
use debug, only : &
|
use debug, only: &
|
||||||
debug_level, &
|
debug_level, &
|
||||||
debug_spectral, &
|
debug_spectral, &
|
||||||
debug_spectralRestart
|
debug_spectralRestart
|
||||||
|
@ -172,7 +172,7 @@ subroutine AL_init(temperature)
|
||||||
call Utilities_init()
|
call Utilities_init()
|
||||||
write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverAL init -+>>>'
|
write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverAL init -+>>>'
|
||||||
write(6,'(a)') ' $Id$'
|
write(6,'(a)') ' $Id$'
|
||||||
write(6,'(a16,a)') ' Current time : ',IO_timeStamp()
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
||||||
#include "compilation_info.f90"
|
#include "compilation_info.f90"
|
||||||
|
|
||||||
allocate (P (3,3,grid(1),grid(2),grid(3)),source = 0.0_pReal)
|
allocate (P (3,3,grid(1),grid(2),grid(3)),source = 0.0_pReal)
|
||||||
|
@ -308,7 +308,7 @@ use mesh, only: &
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! input data for solution
|
! input data for solution
|
||||||
real(pReal), intent(in) :: &
|
real(pReal), intent(in) :: &
|
||||||
timeinc, & !< increment in time for current solution
|
timeinc, & !< increment in time for current solution
|
||||||
timeinc_old, & !< increment in time of last increment
|
timeinc_old, & !< increment in time of last increment
|
||||||
loadCaseTime, & !< remaining time of current load case
|
loadCaseTime, & !< remaining time of current load case
|
||||||
|
@ -327,7 +327,7 @@ use mesh, only: &
|
||||||
! PETSc Data
|
! PETSc Data
|
||||||
PetscScalar, dimension(:,:,:,:), pointer :: xx_psc, F, F_lambda
|
PetscScalar, dimension(:,:,:,:), pointer :: xx_psc, F, F_lambda
|
||||||
PetscErrorCode :: ierr
|
PetscErrorCode :: ierr
|
||||||
SNESConvergedReason ::reason
|
SNESConvergedReason :: reason
|
||||||
|
|
||||||
integer(pInt) :: i, j, k
|
integer(pInt) :: i, j, k
|
||||||
real(pReal), dimension(3,3) :: F_lambda33
|
real(pReal), dimension(3,3) :: F_lambda33
|
||||||
|
@ -381,7 +381,7 @@ use mesh, only: &
|
||||||
f_aimDot = F_BC%maskFloat * F_BC%values
|
f_aimDot = F_BC%maskFloat * F_BC%values
|
||||||
elseif(F_BC%myType=='f') then ! aim at end of load case is prescribed
|
elseif(F_BC%myType=='f') then ! aim at end of load case is prescribed
|
||||||
f_aimDot = F_BC%maskFloat * (F_BC%values -F_aim)/loadCaseTime
|
f_aimDot = F_BC%maskFloat * (F_BC%values -F_aim)/loadCaseTime
|
||||||
endif
|
endif
|
||||||
if (guess) f_aimDot = f_aimDot + P_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old
|
if (guess) f_aimDot = f_aimDot + P_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old
|
||||||
F_aim_lastInc = F_aim
|
F_aim_lastInc = F_aim
|
||||||
|
|
||||||
|
@ -403,7 +403,8 @@ use mesh, only: &
|
||||||
! update local deformation gradient
|
! update local deformation gradient
|
||||||
F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! ensure that it matches rotated F_aim
|
F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! ensure that it matches rotated F_aim
|
||||||
math_rotate_backward33(F_aim,rotation_BC)),[9,grid(1),grid(2),grid(3)])
|
math_rotate_backward33(F_aim,rotation_BC)),[9,grid(1),grid(2),grid(3)])
|
||||||
F_lambda = reshape(Utilities_forwardField(timeinc,F_lambda_lastInc,F_lambdadot), [9,grid(1),grid(2),grid(3)]) ! does not have any average value as boundary condition
|
F_lambda = reshape(Utilities_forwardField(timeinc,F_lambda_lastInc,F_lambdadot), &
|
||||||
|
[9,grid(1),grid(2),grid(3)]) ! does not have any average value as boundary condition
|
||||||
if (.not. guess) then ! large strain forwarding
|
if (.not. guess) then ! large strain forwarding
|
||||||
do k = 1_pInt, grid(3); do j = 1_pInt, grid(2); do i = 1_pInt, grid(1)
|
do k = 1_pInt, grid(3); do j = 1_pInt, grid(2); do i = 1_pInt, grid(1)
|
||||||
F_lambda33 = reshape(F_lambda(:,i,j,k),[3,3])
|
F_lambda33 = reshape(F_lambda(:,i,j,k),[3,3])
|
||||||
|
@ -548,11 +549,11 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr)
|
||||||
! evaluate inertia
|
! evaluate inertia
|
||||||
dynamic: if (params%density > 0.0_pReal) then
|
dynamic: if (params%density > 0.0_pReal) then
|
||||||
residual_F = ((F - F_lastInc)/params%timeinc - (F_lastInc - F_lastInc2)/params%timeincOld)/&
|
residual_F = ((F - F_lastInc)/params%timeinc - (F_lastInc - F_lastInc2)/params%timeincOld)/&
|
||||||
((params%timeinc + params%timeincOld)/2.0_pReal)
|
((params%timeinc + params%timeincOld)/2.0_pReal)
|
||||||
residual_F = params%density*product(geomSize/grid)*residual_F
|
residual_F = params%density*product(geomSize/grid)*residual_F
|
||||||
field_real = 0.0_pReal
|
field_real = 0.0_pReal
|
||||||
field_real(1:grid(1),1:grid(2),1:grid(3),1:3,1:3) = reshape(residual_F,[grid(1),grid(2),grid(3),3,3],&
|
field_real(1:grid(1),1:grid(2),1:grid(3),1:3,1:3) = reshape(residual_F,[grid(1),grid(2),grid(3),3,3],&
|
||||||
order=[4,5,1,2,3]) ! field real has a different order
|
order=[4,5,1,2,3]) ! field real has a different order
|
||||||
call Utilities_FFTforward()
|
call Utilities_FFTforward()
|
||||||
call Utilities_inverseLaplace()
|
call Utilities_inverseLaplace()
|
||||||
inertiaField_fourier = field_fourier
|
inertiaField_fourier = field_fourier
|
||||||
|
@ -625,8 +626,6 @@ end subroutine AL_formResidual
|
||||||
!> @brief convergence check
|
!> @brief convergence check
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr)
|
subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr)
|
||||||
use math, only: &
|
|
||||||
math_mul3333xx33
|
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
itmax, &
|
itmax, &
|
||||||
itmin, &
|
itmin, &
|
||||||
|
@ -634,8 +633,10 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr
|
||||||
err_div_tolAbs, &
|
err_div_tolAbs, &
|
||||||
err_curl_tolRel, &
|
err_curl_tolRel, &
|
||||||
err_curl_tolAbs, &
|
err_curl_tolAbs, &
|
||||||
err_stress_tolabs, &
|
err_stress_tolAbs, &
|
||||||
err_stress_tolrel
|
err_stress_tolRel
|
||||||
|
use math, only: &
|
||||||
|
math_mul3333xx33
|
||||||
use FEsolving, only: &
|
use FEsolving, only: &
|
||||||
terminallyIll
|
terminallyIll
|
||||||
|
|
||||||
|
@ -658,15 +659,18 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr
|
||||||
! stress BC handling
|
! stress BC handling
|
||||||
F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%P_BC))) ! S = 0.0 for no bc
|
F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%P_BC))) ! S = 0.0 for no bc
|
||||||
err_stress = maxval(abs(mask_stress * (P_av - params%P_BC))) ! mask = 0.0 for no bc
|
err_stress = maxval(abs(mask_stress * (P_av - params%P_BC))) ! mask = 0.0 for no bc
|
||||||
curlTol = max(maxval(abs(F_aim-math_I3))*err_curl_tolRel,err_curl_tolAbs)
|
|
||||||
divTol = max(maxval(abs(P_av)) *err_div_tolRel,err_div_tolAbs)
|
!--------------------------------------------------------------------------------------------------
|
||||||
stressTol = max(maxval(abs(P_av)) *err_stress_tolrel,err_stress_tolabs)
|
! error calculation
|
||||||
|
curlTol = max(maxval(abs(F_aim-math_I3))*err_curl_tolRel,err_curl_tolAbs)
|
||||||
|
divTol = max(maxval(abs(P_av)) *err_div_tolRel,err_div_tolAbs)
|
||||||
|
stressTol = max(maxval(abs(P_av)) *err_stress_tolrel,err_stress_tolabs)
|
||||||
|
|
||||||
converged: if ((totalIter >= itmin .and. &
|
converged: if ((totalIter >= itmin .and. &
|
||||||
all([ err_div/divTol, &
|
all([ err_div/divTol, &
|
||||||
err_curl/curlTol, &
|
err_curl/curlTol, &
|
||||||
err_stress/err_stress_tol ] < 1.0_pReal)) &
|
err_stress/stressTol ] < 1.0_pReal)) &
|
||||||
.or. terminallyIll)
|
.or. terminallyIll) then
|
||||||
reason = 1
|
reason = 1
|
||||||
elseif (totalIter >= itmax) then converged
|
elseif (totalIter >= itmax) then converged
|
||||||
reason = -1
|
reason = -1
|
||||||
|
|
|
@ -74,12 +74,14 @@ module DAMASK_spectral_SolverBasicPETSc
|
||||||
F_aimDot=0.0_pReal
|
F_aimDot=0.0_pReal
|
||||||
character(len=1024), private :: incInfo
|
character(len=1024), private :: incInfo
|
||||||
real(pReal), private, dimension(3,3,3,3) :: &
|
real(pReal), private, dimension(3,3,3,3) :: &
|
||||||
C = 0.0_pReal, C_minmaxAvg = 0.0_pReal, C_lastInc= 0.0_pReal, &
|
C_volAvg = 0.0_pReal, & !< current volume average stiffness
|
||||||
S = 0.0_pReal
|
C_volAvgLastInc = 0.0_pReal, & !< previous volume average stiffness
|
||||||
|
C_minMaxAvg = 0.0_pReal, & !< current (min+max)/2 stiffness
|
||||||
|
S = 0.0_pReal !< current compliance (filled up with zeros)
|
||||||
real(pReal), private :: err_stress, err_div
|
real(pReal), private :: err_stress, err_div
|
||||||
logical, private :: ForwardData
|
logical, private :: ForwardData
|
||||||
integer(pInt), private :: reportIter = 0_pInt
|
integer(pInt), private :: &
|
||||||
|
totalIter = 0_pInt !< total iteration in current increment
|
||||||
real(pReal), private, dimension(3,3) :: mask_stress = 0.0_pReal
|
real(pReal), private, dimension(3,3) :: mask_stress = 0.0_pReal
|
||||||
|
|
||||||
public :: &
|
public :: &
|
||||||
|
@ -112,9 +114,9 @@ contains
|
||||||
subroutine basicPETSc_init(temperature)
|
subroutine basicPETSc_init(temperature)
|
||||||
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran >4.6 at the moment)
|
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran >4.6 at the moment)
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
|
IO_intOut, &
|
||||||
IO_read_JobBinaryFile, &
|
IO_read_JobBinaryFile, &
|
||||||
IO_write_JobBinaryFile, &
|
IO_write_JobBinaryFile, &
|
||||||
IO_intOut, &
|
|
||||||
IO_timeStamp
|
IO_timeStamp
|
||||||
use debug, only: &
|
use debug, only: &
|
||||||
debug_level, &
|
debug_level, &
|
||||||
|
@ -212,11 +214,11 @@ subroutine basicPETSc_init(temperature)
|
||||||
call IO_read_jobBinaryFile(777,'F_aimDot',trim(getSolverJobName()),size(f_aimDot))
|
call IO_read_jobBinaryFile(777,'F_aimDot',trim(getSolverJobName()),size(f_aimDot))
|
||||||
read (777,rec=1) f_aimDot
|
read (777,rec=1) f_aimDot
|
||||||
close (777)
|
close (777)
|
||||||
call IO_read_jobBinaryFile(777,'C',trim(getSolverJobName()),size(C))
|
call IO_read_jobBinaryFile(777,'C_volAvg',trim(getSolverJobName()),size(C_volAvg))
|
||||||
read (777,rec=1) C
|
read (777,rec=1) C_volAvg
|
||||||
close (777)
|
close (777)
|
||||||
call IO_read_jobBinaryFile(777,'C_lastInc',trim(getSolverJobName()),size(C_lastInc))
|
call IO_read_jobBinaryFile(777,'C_volAvgLastInc',trim(getSolverJobName()),size(C_volAvgLastInc))
|
||||||
read (777,rec=1) C_lastInc
|
read (777,rec=1) C_volAvgLastInc
|
||||||
close (777)
|
close (777)
|
||||||
call IO_read_jobBinaryFile(777,'C_ref',trim(getSolverJobName()),size(temp3333_Real))
|
call IO_read_jobBinaryFile(777,'C_ref',trim(getSolverJobName()),size(temp3333_Real))
|
||||||
read (777,rec=1) temp3333_Real
|
read (777,rec=1) temp3333_Real
|
||||||
|
@ -227,10 +229,10 @@ subroutine basicPETSc_init(temperature)
|
||||||
call Utilities_constitutiveResponse(&
|
call Utilities_constitutiveResponse(&
|
||||||
reshape(F(0:8,0:grid(1)-1_pInt,0:grid(2)-1_pInt,0:grid(3)-1_pInt),[3,3,grid(1),grid(2),grid(3)]),&
|
reshape(F(0:8,0:grid(1)-1_pInt,0:grid(2)-1_pInt,0:grid(3)-1_pInt),[3,3,grid(1),grid(2),grid(3)]),&
|
||||||
reshape(F(0:8,0:grid(1)-1_pInt,0:grid(2)-1_pInt,0:grid(3)-1_pInt),[3,3,grid(1),grid(2),grid(3)]),&
|
reshape(F(0:8,0:grid(1)-1_pInt,0:grid(2)-1_pInt,0:grid(3)-1_pInt),[3,3,grid(1),grid(2),grid(3)]),&
|
||||||
temperature,0.0_pReal,P,C,C_minmaxAvg,temp33_Real,.false.,math_I3)
|
temperature,0.0_pReal,P,C_volAvg,C_minmaxAvg,temp33_Real,.false.,math_I3)
|
||||||
call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! write data back into PETSc
|
call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! write data back into PETSc
|
||||||
if (restartInc == 1_pInt) then ! use initial stiffness as reference stiffness
|
if (restartInc == 1_pInt) then ! use initial stiffness as reference stiffness
|
||||||
temp3333_Real = C_minmaxAvg
|
temp3333_Real = C_minMaxAvg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call Utilities_updateGamma(temp3333_Real,.True.)
|
call Utilities_updateGamma(temp3333_Real,.True.)
|
||||||
|
@ -257,8 +259,8 @@ type(tSolutionState) function basicPETSc_solution( &
|
||||||
grid, &
|
grid, &
|
||||||
geomSize, &
|
geomSize, &
|
||||||
tBoundaryCondition, &
|
tBoundaryCondition, &
|
||||||
Utilities_calculateRate, &
|
|
||||||
Utilities_forwardField, &
|
Utilities_forwardField, &
|
||||||
|
Utilities_calculateRate, &
|
||||||
Utilities_maskedCompliance, &
|
Utilities_maskedCompliance, &
|
||||||
Utilities_updateGamma, &
|
Utilities_updateGamma, &
|
||||||
cutBack
|
cutBack
|
||||||
|
@ -269,21 +271,26 @@ type(tSolutionState) function basicPETSc_solution( &
|
||||||
implicit none
|
implicit none
|
||||||
#include <finclude/petscdmda.h90>
|
#include <finclude/petscdmda.h90>
|
||||||
#include <finclude/petscsnes.h90>
|
#include <finclude/petscsnes.h90>
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! input data for solution
|
! input data for solution
|
||||||
real(pReal), intent(in) :: &
|
real(pReal), intent(in) :: &
|
||||||
timeinc, & !< increment in time for current solution
|
timeinc, & !< increment in time for current solution
|
||||||
timeinc_old, & !< increment in time of last increment
|
timeinc_old, & !< increment in time of last increment
|
||||||
loadCaseTime, & !< remaining time of current load case
|
loadCaseTime, & !< remaining time of current load case
|
||||||
temperature_bc
|
temperature_bc, &
|
||||||
logical, intent(in):: guess
|
density
|
||||||
type(tBoundaryCondition), intent(in) :: P_BC,F_BC
|
logical, intent(in) :: &
|
||||||
|
guess
|
||||||
|
type(tBoundaryCondition), intent(in) :: &
|
||||||
|
P_BC, &
|
||||||
|
F_BC
|
||||||
|
character(len=*), intent(in) :: &
|
||||||
|
incInfoIn
|
||||||
real(pReal), dimension(3,3), intent(in) :: rotation_BC
|
real(pReal), dimension(3,3), intent(in) :: rotation_BC
|
||||||
character(len=*), intent(in) :: incInfoIn
|
|
||||||
real(pReal), intent(in) :: density
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!
|
! PETSc Data
|
||||||
PetscScalar, pointer :: F(:,:,:,:)
|
PetscScalar, pointer :: F(:,:,:,:)
|
||||||
PetscErrorCode :: ierr
|
PetscErrorCode :: ierr
|
||||||
SNESConvergedReason :: reason
|
SNESConvergedReason :: reason
|
||||||
|
@ -291,7 +298,7 @@ type(tSolutionState) function basicPETSc_solution( &
|
||||||
|
|
||||||
call DMDAVecGetArrayF90(da,solution_vec,F,ierr)
|
call DMDAVecGetArrayF90(da,solution_vec,F,ierr)
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! write restart information for spectral solver
|
! restart information for spectral solver
|
||||||
if (restartWrite) then
|
if (restartWrite) then
|
||||||
write(6,'(/,a)') ' writing converged results for restart'
|
write(6,'(/,a)') ' writing converged results for restart'
|
||||||
flush(6)
|
flush(6)
|
||||||
|
@ -304,29 +311,28 @@ type(tSolutionState) function basicPETSc_solution( &
|
||||||
call IO_write_jobBinaryFile(777,'F_aimDot',size(F_aimDot))
|
call IO_write_jobBinaryFile(777,'F_aimDot',size(F_aimDot))
|
||||||
write (777,rec=1) F_aimDot
|
write (777,rec=1) F_aimDot
|
||||||
close(777)
|
close(777)
|
||||||
call IO_write_jobBinaryFile(777,'C',size(C))
|
call IO_write_jobBinaryFile(777,'C_volAvg',size(C_volAvg))
|
||||||
write (777,rec=1) C
|
write (777,rec=1) C_volAvg
|
||||||
close(777)
|
close(777)
|
||||||
call IO_write_jobBinaryFile(777,'C_lastInc',size(C_lastInc))
|
call IO_write_jobBinaryFile(777,'C_volAvgLastInc',size(C_volAvgLastInc))
|
||||||
write (777,rec=1) C_lastInc
|
write (777,rec=1) C_volAvgLastInc
|
||||||
close(777)
|
close(777)
|
||||||
endif
|
endif
|
||||||
mesh_ipCoordinates = reshape(mesh_deformedCoordsFFT(geomSize,reshape(&
|
mesh_ipCoordinates = reshape(mesh_deformedCoordsFFT(geomSize,reshape(&
|
||||||
F,[3,3,grid(1),grid(2),grid(3)])),[3,1,product(grid)])
|
F,[3,3,grid(1),grid(2),grid(3)])),[3,1,product(grid)])
|
||||||
if ( cutBack) then
|
if (cutBack) then
|
||||||
F_aim = F_aim_lastInc
|
F_aim = F_aim_lastInc
|
||||||
F = reshape(F_lastInc,[9,grid(1),grid(2),grid(3)])
|
F = reshape(F_lastInc,[9,grid(1),grid(2),grid(3)])
|
||||||
C = C_lastInc
|
C_volAvg = C_volAvgLastInc
|
||||||
else
|
else
|
||||||
C_lastInc = C
|
C_volAvgLastInc = C_volAvg
|
||||||
mesh_ipCoordinates = reshape(mesh_deformedCoordsFFT(geomSize,reshape(&
|
|
||||||
F,[3,3,grid(1),grid(2),grid(3)])),[3,1,product(grid)])
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! calculate rate for aim
|
! calculate rate for aim
|
||||||
if (F_BC%myType=='l') then ! calculate f_aimDot from given L and current F
|
if (F_BC%myType=='l') then ! calculate f_aimDot from given L and current F
|
||||||
f_aimDot = F_BC%maskFloat * math_mul33x33(F_BC%values, F_aim)
|
f_aimDot = F_BC%maskFloat * math_mul33x33(F_BC%values, F_aim)
|
||||||
elseif(F_BC%myType=='fdot') then ! f_aimDot is prescribed
|
elseif(F_BC%myType=='fdot') then ! f_aimDot is prescribed
|
||||||
f_aimDot = F_BC%maskFloat * F_BC%values
|
f_aimDot = F_BC%maskFloat * F_BC%values
|
||||||
elseif(F_BC%myType=='f') then ! aim at end of load case is prescribed
|
elseif(F_BC%myType=='f') then ! aim at end of load case is prescribed
|
||||||
f_aimDot = F_BC%maskFloat * (F_BC%values -F_aim)/loadCaseTime
|
f_aimDot = F_BC%maskFloat * (F_BC%values -F_aim)/loadCaseTime
|
||||||
|
@ -335,7 +341,9 @@ type(tSolutionState) function basicPETSc_solution( &
|
||||||
F_aim_lastInc = F_aim
|
F_aim_lastInc = F_aim
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! update rate and forward last inc
|
! update coordinates and rate and forward last inc
|
||||||
|
mesh_ipCoordinates = reshape(mesh_deformedCoordsFFT(geomSize,reshape(&
|
||||||
|
F,[3,3,grid(1),grid(2),grid(3)])),[3,1,product(grid)])
|
||||||
Fdot = Utilities_calculateRate(math_rotate_backward33(f_aimDot,params%rotation_BC), &
|
Fdot = Utilities_calculateRate(math_rotate_backward33(f_aimDot,params%rotation_BC), &
|
||||||
timeinc_old,guess,F_lastInc,reshape(F,[3,3,grid(1),grid(2),grid(3)]))
|
timeinc_old,guess,F_lastInc,reshape(F,[3,3,grid(1),grid(2),grid(3)]))
|
||||||
F_lastInc2 = F_lastInc
|
F_lastInc2 = F_lastInc
|
||||||
|
@ -349,7 +357,7 @@ type(tSolutionState) function basicPETSc_solution( &
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! update stiffness (and gamma operator)
|
! update stiffness (and gamma operator)
|
||||||
S = Utilities_maskedCompliance(rotation_BC,P_BC%maskLogical,C)
|
S = Utilities_maskedCompliance(rotation_BC,P_BC%maskLogical,C_volAvg)
|
||||||
if (update_gamma) call Utilities_updateGamma(C_minmaxAvg,restartWrite)
|
if (update_gamma) call Utilities_updateGamma(C_minmaxAvg,restartWrite)
|
||||||
|
|
||||||
ForwardData = .True.
|
ForwardData = .True.
|
||||||
|
@ -374,7 +382,7 @@ type(tSolutionState) function basicPETSc_solution( &
|
||||||
basicPETSC_solution%iterationsNeeded = itmax
|
basicPETSC_solution%iterationsNeeded = itmax
|
||||||
else
|
else
|
||||||
basicPETSC_solution%converged = .true.
|
basicPETSC_solution%converged = .true.
|
||||||
basicPETSC_solution%iterationsNeeded = reportIter
|
basicPETSC_solution%iterationsNeeded = totalIter
|
||||||
endif
|
endif
|
||||||
|
|
||||||
end function BasicPETSc_solution
|
end function BasicPETSc_solution
|
||||||
|
@ -417,25 +425,23 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr)
|
||||||
x_scal, &
|
x_scal, &
|
||||||
f_scal
|
f_scal
|
||||||
PetscInt :: &
|
PetscInt :: &
|
||||||
iter, &
|
PETScIter, &
|
||||||
nfuncs
|
nfuncs
|
||||||
PetscObject :: dummy
|
PetscObject :: dummy
|
||||||
PetscErrorCode :: ierr
|
PetscErrorCode :: ierr
|
||||||
|
|
||||||
call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr)
|
call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr)
|
||||||
call SNESGetIterationNumber(snes,iter,ierr); CHKERRQ(ierr)
|
call SNESGetIterationNumber(snes,PETScIter,ierr); CHKERRQ(ierr)
|
||||||
|
|
||||||
|
if(nfuncs== 0 .and. PETScIter == 0) totalIter = -1_pInt ! new increment
|
||||||
|
if (totalIter <= PETScIter) then ! new iteration
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! report begin of new iteration
|
! report begin of new iteration
|
||||||
if (iter == 0 .and. nfuncs == 0) then ! new increment
|
totalIter = totalIter + 1_pInt
|
||||||
reportIter = -1_pInt
|
|
||||||
endif
|
|
||||||
if (reportIter <= iter) then ! new iteration
|
|
||||||
reportIter = reportIter + 1_pInt
|
|
||||||
write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), &
|
write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), &
|
||||||
' @ Iteration ', itmin, '≤',reportIter, '≤', itmax
|
' @ Iteration ', itmin, '≤',totalIter, '≤', itmax
|
||||||
if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) &
|
if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) &
|
||||||
write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab)=', &
|
write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', &
|
||||||
math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC))
|
math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC))
|
||||||
write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', &
|
write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', &
|
||||||
math_transpose33(F_aim)
|
math_transpose33(F_aim)
|
||||||
|
@ -461,7 +467,7 @@ if (params%density > 0.0_pReal) then
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! evaluate constitutive response
|
! evaluate constitutive response
|
||||||
call Utilities_constitutiveResponse(F_lastInc,x_scal,params%temperature,params%timeinc, &
|
call Utilities_constitutiveResponse(F_lastInc,x_scal,params%temperature,params%timeinc, &
|
||||||
f_scal,C,C_minmaxAvg,P_av,ForwardData,params%rotation_BC)
|
f_scal,C_volAvg,C_minmaxAvg,P_av,ForwardData,params%rotation_BC)
|
||||||
ForwardData = .false.
|
ForwardData = .false.
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
@ -491,12 +497,12 @@ end subroutine BasicPETSc_formResidual
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief convergence check
|
!> @brief convergence check
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine BasicPETSc_converged(snes_local,it,xnorm,snorm,fnorm,reason,dummy,ierr)
|
subroutine BasicPETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr)
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
itmax, &
|
itmax, &
|
||||||
itmin, &
|
itmin, &
|
||||||
err_div_TolAbs, &
|
err_div_tolRel, &
|
||||||
err_div_TolRel, &
|
err_div_tolAbs, &
|
||||||
err_stress_tolRel, &
|
err_stress_tolRel, &
|
||||||
err_stress_tolAbs
|
err_stress_tolAbs
|
||||||
use math, only: &
|
use math, only: &
|
||||||
|
@ -508,7 +514,7 @@ subroutine BasicPETSc_converged(snes_local,it,xnorm,snorm,fnorm,reason,dummy,ier
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
SNES :: snes_local
|
SNES :: snes_local
|
||||||
PetscInt :: it
|
PetscInt :: PETScIter
|
||||||
PetscReal :: &
|
PetscReal :: &
|
||||||
xnorm, &
|
xnorm, &
|
||||||
snorm, &
|
snorm, &
|
||||||
|
@ -523,10 +529,10 @@ subroutine BasicPETSc_converged(snes_local,it,xnorm,snorm,fnorm,reason,dummy,ier
|
||||||
divTol = max(maxval(abs(P_av))*err_div_tolRel,err_div_tolAbs)
|
divTol = max(maxval(abs(P_av))*err_div_tolRel,err_div_tolAbs)
|
||||||
stressTol = max(maxval(abs(P_av))*err_stress_tolrel,err_stress_tolabs)
|
stressTol = max(maxval(abs(P_av))*err_stress_tolrel,err_stress_tolabs)
|
||||||
|
|
||||||
converged: if ((it >= itmin .and. &
|
converged: if ((totalIter>= itmin .and. &
|
||||||
all([ err_div/divTol, &
|
all([ err_div/divTol, &
|
||||||
err_stress/err_stress_tol ] < 1.0_pReal)) &
|
err_stress/stressTol ] < 1.0_pReal)) &
|
||||||
.or. terminallyIll)
|
.or. terminallyIll) then
|
||||||
reason = 1
|
reason = 1
|
||||||
elseif (totalIter >= itmax) then converged
|
elseif (totalIter >= itmax) then converged
|
||||||
reason = -1
|
reason = -1
|
||||||
|
|
|
@ -601,7 +601,6 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr)
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! constructing residual
|
! constructing residual
|
||||||
e = 0_pInt
|
e = 0_pInt
|
||||||
err_p = 0.0_pReal
|
|
||||||
do k = 1_pInt, grid(3); do j = 1_pInt, grid(2); do i = 1_pInt, grid(1)
|
do k = 1_pInt, grid(3); do j = 1_pInt, grid(2); do i = 1_pInt, grid(1)
|
||||||
e = e + 1_pInt
|
e = e + 1_pInt
|
||||||
residual_F(1:3,1:3,i,j,k) = math_mul3333xx33(math_invSym3333(materialpoint_dPdF(:,:,:,:,1,e) + C_scale), &
|
residual_F(1:3,1:3,i,j,k) = math_mul3333xx33(math_invSym3333(materialpoint_dPdF(:,:,:,:,1,e) + C_scale), &
|
||||||
|
@ -627,14 +626,16 @@ end subroutine Polarisation_formResidual
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr)
|
subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr)
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
itmax, &
|
itmax, &
|
||||||
itmin, &
|
itmin, &
|
||||||
err_div_tolRel, &
|
err_div_tolRel, &
|
||||||
err_div_tolAbs, &
|
err_div_tolAbs, &
|
||||||
err_curl_tolRel, &
|
err_curl_tolRel, &
|
||||||
err_curl_tolAbs, &
|
err_curl_tolAbs, &
|
||||||
err_stress_tolabs, &
|
err_stress_tolabs, &
|
||||||
err_stress_tolrel
|
err_stress_tolrel
|
||||||
|
use math, only: &
|
||||||
|
math_mul3333xx33
|
||||||
use FEsolving, only: &
|
use FEsolving, only: &
|
||||||
terminallyIll
|
terminallyIll
|
||||||
|
|
||||||
|
@ -651,21 +652,24 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,
|
||||||
real(pReal) :: &
|
real(pReal) :: &
|
||||||
curlTol, &
|
curlTol, &
|
||||||
divTol, &
|
divTol, &
|
||||||
stressBC_tol
|
stressTol
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! stress BC handling
|
! stress BC handling
|
||||||
F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%P_BC))) ! S = 0.0 for no bc
|
F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%P_BC))) ! S = 0.0 for no bc
|
||||||
err_stress = maxval(abs(mask_stress * (P_av - params%P_BC))) ! mask = 0.0 for no bc
|
err_stress = maxval(abs(mask_stress * (P_av - params%P_BC))) ! mask = 0.0 for no bc
|
||||||
curlTol = max(maxval(abs(F_aim-math_I3))*err_curl_tolRel,err_curl_tolAbs)
|
|
||||||
divTol = max(maxval(abs(P_av)) *err_div_tolRel,err_div_tolAbs)
|
!--------------------------------------------------------------------------------------------------
|
||||||
stressBC_tol = max(maxval(abs(P_av)) *err_stress_tolrel,err_stress_tolabs)
|
! error calculation
|
||||||
|
curlTol = max(maxval(abs(F_aim-math_I3))*err_curl_tolRel,err_curl_tolAbs)
|
||||||
|
divTol = max(maxval(abs(P_av)) *err_div_tolRel,err_div_tolAbs)
|
||||||
|
stressTol = max(maxval(abs(P_av)) *err_stress_tolrel,err_stress_tolabs)
|
||||||
|
|
||||||
converged: if ((totalIter >= itmin .and. &
|
converged: if ((totalIter >= itmin .and. &
|
||||||
all([ err_div/divTol, &
|
all([ err_div/divTol, &
|
||||||
err_curl/curlTol, &
|
err_curl/curlTol, &
|
||||||
err_stress/err_stress_tol ] < 1.0_pReal)) &
|
err_stress/stressTol ] < 1.0_pReal)) &
|
||||||
.or. terminallyIll)
|
.or. terminallyIll) then
|
||||||
reason = 1
|
reason = 1
|
||||||
elseif (totalIter >= itmax) then converged
|
elseif (totalIter >= itmax) then converged
|
||||||
reason = -1
|
reason = -1
|
||||||
|
@ -676,12 +680,12 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! report
|
! report
|
||||||
write(6,'(1/,a)') ' ... reporting .............................................................'
|
write(6,'(1/,a)') ' ... reporting .............................................................'
|
||||||
write(6,'(/,a,f12.2,a,es12.2,a,es12.2,a)') ' error curl = ', &
|
write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', &
|
||||||
err_curl/curlTol,' (',err_curl,' -, tol =',curlTol,')'
|
err_curl/curlTol,' (',err_curl,' -, tol =',curlTol,')'
|
||||||
write(6,'(a,f12.2,a,es12.8,a,es12.8,a)') ' error divergence = ', &
|
write(6,'(a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', &
|
||||||
err_div/divTol, ' (',err_div,' / m, tol =',divTol,')'
|
err_div/divTol, ' (',err_div,' / m, tol =',divTol,')'
|
||||||
write(6,'(a,f8.2,a,es11.5,a,es11.4,a)') ' error stress BC = ', &
|
write(6,'(a,f12.2,a,es8.2,a,es9.2,a)') ' error stress BC = ', &
|
||||||
err_stress/stressBC_tol, ' (',err_stress, ' Pa, tol =',stressBC_tol,')'
|
err_stress/stressTol, ' (',err_stress, ' Pa, tol =',stressTol,')'
|
||||||
write(6,'(/,a)') ' ==========================================================================='
|
write(6,'(/,a)') ' ==========================================================================='
|
||||||
flush(6)
|
flush(6)
|
||||||
|
|
||||||
|
|
|
@ -650,7 +650,7 @@ real(pReal) function utilities_curlRMS()
|
||||||
integer(pInt) :: i, j, k, l
|
integer(pInt) :: i, j, k, l
|
||||||
complex(pReal), dimension(3,3) :: curl_fourier
|
complex(pReal), dimension(3,3) :: curl_fourier
|
||||||
|
|
||||||
write(6,'(/,a)') ' ... calculating curl ................................................'
|
write(6,'(/,a)') ' ... calculating curl ......................................................'
|
||||||
flush(6)
|
flush(6)
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! calculating max curl criterion in Fourier space
|
! calculating max curl criterion in Fourier space
|
||||||
|
|
|
@ -331,11 +331,11 @@ subroutine numerics_init
|
||||||
case ('err_div_tolabs','err_div_tolrel','err_stress_tolrel','err_stress_tolabs',& ! found spectral parameter for FEM build
|
case ('err_div_tolabs','err_div_tolrel','err_stress_tolrel','err_stress_tolabs',& ! found spectral parameter for FEM build
|
||||||
'itmax', 'itmin','memory_efficient','fftw_timelimit','fftw_plan_mode', &
|
'itmax', 'itmin','memory_efficient','fftw_timelimit','fftw_plan_mode', &
|
||||||
'rotation_tol','divergence_correction','update_gamma','myfilter', &
|
'rotation_tol','divergence_correction','update_gamma','myfilter', &
|
||||||
'err_div_tolabs','err_div_tolrel', &
|
'err_curl_tolabs','err_curl_tolrel', &
|
||||||
'maxcutback','polaralpha','polarbeta')
|
'maxcutback','polaralpha','polarbeta')
|
||||||
call IO_warning(40_pInt,ext_msg=tag)
|
call IO_warning(40_pInt,ext_msg=tag)
|
||||||
#endif
|
#endif
|
||||||
case default ! found unknown keyword
|
case default ! found unknown keyword
|
||||||
call IO_error(300_pInt,ext_msg=tag)
|
call IO_error(300_pInt,ext_msg=tag)
|
||||||
endselect
|
endselect
|
||||||
enddo
|
enddo
|
||||||
|
@ -346,7 +346,7 @@ subroutine numerics_init
|
||||||
endif fileExists
|
endif fileExists
|
||||||
|
|
||||||
#ifdef Spectral
|
#ifdef Spectral
|
||||||
select case(IO_lc(fftw_plan_mode)) ! setting parameters for the plan creation of FFTW. Basically a translation from fftw3.f
|
select case(IO_lc(fftw_plan_mode)) ! setting parameters for the plan creation of FFTW. Basically a translation from fftw3.f
|
||||||
case('estimate','fftw_estimate') ! ordered from slow execution (but fast plan creation) to fast execution
|
case('estimate','fftw_estimate') ! ordered from slow execution (but fast plan creation) to fast execution
|
||||||
fftw_planner_flag = 64_pInt
|
fftw_planner_flag = 64_pInt
|
||||||
case('measure','fftw_measure')
|
case('measure','fftw_measure')
|
||||||
|
|
Loading…
Reference in New Issue