|
DAMASK with grid solvers
Revision: v2.0.3-2204-gdb1f2151
The Düsseldorf Advanced Material Simulation Kit with Grid Solvers
|
|
Go to the documentation of this file. 1 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_damage_spectral.f90"
4 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_damage_spectral.f90"
13 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h" 1
21 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscksp.h" 1
30 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h" 1
39 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h" 1
48 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h" 1
57 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscao.h" 1
66 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 1
75 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 1
88 # 1 "/opt/petsc-3.10.3/Intel-18.4-IntelMPI-2018/include/petscconf.h" 1
1296 # 13 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1301 # 1 "/opt/petsc-3.10.3/include/petscversion.h" 1
1347 # 17 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1349 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h" 1
1366 # 31 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h"
1368 # 18 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1370 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h" 1
1379 # 24 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h"
1381 # 38 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h"
1398 # 19 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1400 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petsclog.h" 1
1403 # 20 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1405 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscbag.h" 1
1418 # 21 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1426 # 41 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1436 # 63 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1450 # 85 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1469 # 128 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1471 # 150 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1475 # 174 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1508 # 215 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1521 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 2
1523 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h" 1
1527 # 10 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 2
1549 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscao.h" 2
1559 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h" 2
1573 # 30 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h"
1577 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h" 2
1583 # 49 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1597 # 71 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1601 # 115 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1603 # 140 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1614 # 168 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1627 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h" 2
1629 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 1
1638 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 1
1643 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 2
1645 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h" 1
1650 # 10 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 2
1652 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h" 1
1657 # 11 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 2
1669 # 32 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h"
1672 # 47 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h"
1674 # 10 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h" 2
1678 # 26 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h"
1687 # 74 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h"
1689 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscksp.h" 2
1694 # 21 "/opt/petsc-3.10.3/include/petsc/finclude/petscksp.h"
1698 # 57 "/opt/petsc-3.10.3/include/petsc/finclude/petscksp.h"
1702 # 8 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h" 2
1708 # 30 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h"
1713 # 47 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h"
1737 # 78 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h"
1741 # 9 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_damage_spectral.f90" 2
1743 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 1
1752 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 1
1757 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 2
1759 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h" 1
1764 # 10 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 2
1766 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h" 1
1771 # 11 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 2
1773 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 1
1778 # 12 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 2
1788 # 39 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h"
1802 # 10 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_damage_spectral.f90" 2
1824 real(
preal),
private,
dimension(:,:,:),
allocatable :: &
1850 integer(kind=selected_int_kind(5)),
dimension(0:worldsize-1) :: localk
1851 type(tdm) :: damage_grid
1852 type(tvec) :: ubound, lbound
1853 integer(kind=selected_int_kind(5)) :: ierr
1854 character(len=pStringLen) :: snes_type
1856 write(6,
'(/,a)')
' <<<+- grid_spectral_damage init -+>>>'
1858 write(6,
'(/,a)')
' Shanthraj et al., Handbook of Mechanics of Materials, 2019'
1859 write(6,
'(a)')
' https://doi.org/10.1007/978-981-10-6855-3_80'
1863 call petscoptionsinsertstring(petsc_null_options,
'-damage_snes_type newtonls -damage_snes_mf &
1864 &-damage_snes_ksp_ew -damage_ksp_type fgmres',ierr)
1865 if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1866 call petscoptionsinsertstring(petsc_null_options,trim(petsc_options),ierr)
1867 if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1871 call snescreate(petsc_comm_world,
damage_snes,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1872 call snessetoptionsprefix(
damage_snes,
'damage_',ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1875 call mpi_allreduce(mpi_in_place,localk,
worldsize,mpi_integer,mpi_sum,petsc_comm_world,ierr)
1876 call dmdacreate3d(petsc_comm_world, &
1877 dm_boundary_none, dm_boundary_none, dm_boundary_none, &
1884 if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1885 call snessetdm(
damage_snes,damage_grid,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1886 call dmsetfromoptions(damage_grid,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1887 call dmsetup(damage_grid,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1888 call dmcreateglobalvector(damage_grid,
solution_vec,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1889 call dmdasnessetfunctionlocal(damage_grid,insert_values,
formresidual,petsc_null_snes,ierr)
1890 if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1891 call snessetfromoptions(
damage_snes,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1892 call snesgettype(
damage_snes,snes_type,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1893 if (trim(snes_type) ==
'vinewtonrsls' .or. &
1894 trim(snes_type) ==
'vinewtonssls')
then
1895 call dmgetglobalvector(damage_grid,lbound,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1896 call dmgetglobalvector(damage_grid,ubound,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1897 call vecset(lbound,0.0_preal,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1898 call vecset(ubound,1.0_preal,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1899 call snesvisetvariablebounds(
damage_snes,lbound,ubound,ierr)
1900 call dmrestoreglobalvector(damage_grid,lbound,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1901 call dmrestoreglobalvector(damage_grid,ubound,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1907 if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1914 call vecset(
solution_vec,1.0_preal,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1928 real(
preal),
intent(in) :: &
1929 timeinc, & !< increment in time for current solution
1931 integer :: i, j, k, cell
1933 integer(kind=selected_int_kind(5)) :: devnull
1934 real(kind=selected_real_kind(10)) :: phi_min, phi_max, stagnorm, solnnorm
1936 integer(kind=selected_int_kind(5)) :: ierr
1937 integer(kind=selected_int_kind(5)) :: reason
1939 solution%converged =.false.
1944 params%timeincOld = timeinc_old
1946 call snessolve(
damage_snes,petsc_null_vec,
solution_vec,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1947 call snesgetconvergedreason(
damage_snes,reason,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1949 if (reason < 1)
then
1950 solution%converged = .false.
1951 solution%iterationsNeeded =
itmax
1953 solution%converged = .true.
1958 call mpi_allreduce(mpi_in_place,stagnorm,1,mpi_double,mpi_max,petsc_comm_world,ierr)
1959 call mpi_allreduce(mpi_in_place,solnnorm,1,mpi_double,mpi_max,petsc_comm_world,ierr)
1971 call vecmin(
solution_vec,devnull,phi_min,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1972 call vecmax(
solution_vec,devnull,phi_max,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1973 if (solution%converged) &
1974 write(6,
'(/,a)')
' ... nonlocal damage converged .....................................'
1975 write(6,
'(/,a,f8.6,2x,f8.6,2x,f8.6,/)',advance=
'no')
' Minimum|Maximum|Delta Damage = ',&
1976 phi_min, phi_max, stagnorm
1977 write(6,
'(/,a)')
' ==========================================================================='
1988 logical,
intent(in) :: cutback
1989 integer :: i, j, k, cell
1990 type(tdm) :: dm_local
1991 real(kind=selected_real_kind(10)),
dimension(:,:,:),
pointer :: x_scal
1992 integer(kind=selected_int_kind(5)) :: ierr
2000 call snesgetdm(
damage_snes,dm_local,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
2001 call dmdavecgetarrayf90(dm_local,
solution_vec,x_scal,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
2003 call dmdavecrestorearrayf90(dm_local,
solution_vec,x_scal,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
2021 integer(kind=selected_int_kind(5)),
dimension(25) :: &
2023 real(kind=selected_real_kind(10)),
dimension( &
in(13)+1:in(13)+in(16),in(14)+1:in(14)+in(17),in(15)+1:in(15)+in(18)),
intent(in) :: &
2025 real(kind=selected_real_kind(10)),
dimension( &
in(7)+1:in(7)+in(10),in(8)+1:in(8)+in(11),in(9)+1:in(9)+in(12)),
intent(out) :: &
2027 integer(kind=selected_int_kind(10)) :: dummy
2028 integer(kind=selected_int_kind(5)) :: ierr
2029 integer :: i, j, k, cell
2030 real(
preal) :: phidot, dphidot_dphi, mobility
2081 integer :: i,j,k,cell,ierr
2092 call mpi_allreduce(mpi_in_place,
k_ref,9,mpi_double,mpi_sum,petsc_comm_world,ierr)
2094 call mpi_allreduce(mpi_in_place,
mu_ref,1,mpi_double,mpi_sum,petsc_comm_world,ierr)
integer(kind=selected_int_kind(5)), private zend
subroutine, public utilities_fftscalarbackward
backward FFT of data in scalarField_fourier to scalarField_real
subroutine, private formresidual(in, x_scal, f_scal, dummy, ierr)
forms the spectral damage residual vector
material subroutine for non-locally evolving damage field
real(c_double), dimension(:,:,:), pointer, public scalarfield_real
scalar field real representation for fftw
type(tsolutionstate) function, public grid_damage_spectral_solution(timeinc, timeinc_old)
solution for the spectral damage scheme with internal iterations
integer(kind=selected_int_kind(5)), private xend
integer(kind=selected_int_kind(5)), private yend
real(preal), dimension(3, 3), private k_ref
real(preal), public, protected residualstiffness
non-zero residual damage
real(preal), dimension(:,:,:), allocatable, private phi_current
field of current damage
integer(kind=selected_int_kind(5)), private zstart
Utilities used by the different spectral solver variants.
integer, public, protected worldsize
MPI worldsize (/=1 for MPI simulations only)
real(preal), dimension(:,:,:), allocatable, private phi_lastinc
field of previous damage
integer, public, protected grid3
(local) grid in 3rd direction
subroutine, public damage_nonlocal_putnonlocaldamage(phi, ip, el)
updated nonlocal damage field with solution from damage phase field PDE
Parse geometry file to set up discretization and geometry for nonlocal model.
setting precision for real and int type
subroutine, public utilities_fftvectorbackward
backward FFT of data in field_fourier to field_real
real(c_double), dimension(:,:,:,:), pointer, public vectorfield_real
vector field real representation for fftw
real(preal) function, public damage_nonlocal_getmobility(ip, el)
Returns homogenized nonlocal damage mobility.
subroutine updatereference
update reference viscosity and conductivity
type(tsolutionparams), private params
subroutine, public utilities_fouriervectordivergence()
calculate vector divergence in fourier field
integer, parameter preal
number with 15 significant digits, up to 1e+-307 (typically 64 bit)
subroutine, public utilities_fftscalarforward
forward FFT of data in scalarField_real to scalarField_fourier
real(preal), dimension(:,:,:), allocatable, private phi_staginc
field of staggered damage
subroutine, public utilities_fftvectorforward
forward FFT of data in field_real to field_fourier with highest freqs. removed
subroutine, public utilities_fourierscalargradient()
calculate scalar gradient in fourier field
real(preal), private mu_ref
type(tvec), private solution_vec
integer, public, protected itmax
maximum number of iterations
subroutine, public grid_damage_spectral_init
allocates all neccessary fields and fills them with data
integer(kind=selected_int_kind(5)), private ystart
real(preal), public, protected err_damage_tolabs
absolute tolerance for damage evolution
type(tsnes), private damage_snes
integer, public, protected worldrank
MPI worldrank (/=0 for MPI simulations only)
real(preal), public, protected wgt
weighting factor 1/Nelems
integer, dimension(3), public, protected grid
(global) grid
integer(kind=selected_int_kind(5)), private xstart
1 solver for nonlocal damage
subroutine, public grid_damage_spectral_forward(cutBack)
spectral damage forwarding routine
subroutine, public utilities_fouriergreenconvolution(D_ref, mobility_ref, deltaT)
doing convolution DamageGreenOp_hat * field_real
integer, private totaliter
total iteration in current increment
real(preal), public, protected err_damage_tolrel
relative tolerance for damage evolution
Managing of parameters related to numerics.
return type of solution from spectral solver variants
real(preal) function, dimension(3, 3), public damage_nonlocal_getdiffusion(ip, el)
returns homogenized non local damage diffusion tensor in reference configuration
subroutine, public damage_nonlocal_getsourceanditstangent(phiDot, dPhiDot_dPhi, phi, ip, el)
calculates homogenized damage driving forces