|
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_thermal_spectral.f90"
4 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_thermal_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_thermal_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_thermal_spectral.f90" 2
1825 real(
preal),
private,
dimension(:,:,:),
allocatable :: &
1826 t_current, & !< field of current temperature
1827 t_lastinc, & !< field of previous temperature
1851 integer(kind=selected_int_kind(5)),
dimension(0:worldsize-1) :: localk
1852 integer :: i, j, k, cell
1853 type(tdm) :: thermal_grid
1854 real(kind=selected_real_kind(10)),
dimension(:,:,:),
pointer :: x_scal
1855 integer(kind=selected_int_kind(5)) :: ierr
1857 write(6,
'(/,a)')
' <<<+- grid_thermal_spectral init -+>>>'
1859 write(6,
'(/,a)')
' Shanthraj et al., Handbook of Mechanics of Materials, 2019'
1860 write(6,
'(a)')
' https://doi.org/10.1007/978-981-10-6855-3_80'
1864 call petscoptionsinsertstring(petsc_null_options,
'-thermal_snes_type ngmres',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,
thermal_snes,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1872 call snessetoptionsprefix(
thermal_snes,
'thermal_',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(
thermal_snes,thermal_grid,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1886 call dmsetfromoptions(thermal_grid,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1887 call dmsetup(thermal_grid,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1888 call dmcreateglobalvector(thermal_grid,
solution_vec,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1889 call dmdasnessetfunctionlocal(thermal_grid,insert_values,
formresidual,petsc_null_snes,ierr)
1890 if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1891 call snessetfromoptions(
thermal_snes,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1896 if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1911 call dmdavecgetarrayf90(thermal_grid,
solution_vec,x_scal,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1913 call dmdavecrestorearrayf90(thermal_grid,
solution_vec,x_scal,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1925 real(
preal),
intent(in) :: &
1926 timeinc, & !< increment in time for current solution
1928 integer :: i, j, k, cell
1930 integer(kind=selected_int_kind(5)) :: devnull
1931 real(kind=selected_real_kind(10)) :: t_min, t_max, stagnorm, solnnorm
1933 integer(kind=selected_int_kind(5)) :: ierr
1934 integer(kind=selected_int_kind(5)) :: reason
1936 solution%converged =.false.
1941 params%timeincOld = timeinc_old
1943 call snessolve(
thermal_snes,petsc_null_vec,
solution_vec,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1944 call snesgetconvergedreason(
thermal_snes,reason,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1946 if (reason < 1)
then
1947 solution%converged = .false.
1948 solution%iterationsNeeded =
itmax
1950 solution%converged = .true.
1955 call mpi_allreduce(mpi_in_place,stagnorm,1,mpi_double,mpi_max,petsc_comm_world,ierr)
1956 call mpi_allreduce(mpi_in_place,solnnorm,1,mpi_double,mpi_max,petsc_comm_world,ierr)
1970 call vecmin(
solution_vec,devnull,t_min,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1971 call vecmax(
solution_vec,devnull,t_max,ierr);
if (ierr .ne. 0) then;
call petscerrorf(ierr);return;
endif
1972 if (solution%converged) &
1973 write(6,
'(/,a)')
' ... thermal conduction converged ..................................'
1974 write(6,
'(/,a,f8.4,2x,f8.4,2x,f8.4,/)',advance=
'no')
' Minimum|Maximum|Delta Temperature / K = ',&
1975 t_min, t_max, stagnorm
1976 write(6,
'(/,a)')
' ==========================================================================='
1987 logical,
intent(in) :: cutback
1988 integer :: i, j, k, cell
1989 type(tdm) :: dm_local
1990 real(kind=selected_real_kind(10)),
dimension(:,:,:),
pointer :: x_scal
1991 integer(kind=selected_int_kind(5)) :: ierr
2000 call snesgetdm(
thermal_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
2024 integer(kind=selected_int_kind(5)),
dimension(25) :: &
2026 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) :: &
2028 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) :: &
2030 integer(kind=selected_int_kind(10)) :: dummy
2031 integer(kind=selected_int_kind(5)) :: ierr
2032 integer :: i, j, k, cell
2033 real(
preal) :: tdot, dtdot_dt
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)
type(thomogmapping), dimension(:), allocatable, public thermalmapping
mapping for thermal state/fields
real(preal), dimension(:,:,:), allocatable, private t_current
field of current temperature
subroutine, public utilities_fftscalarbackward
backward FFT of data in scalarField_fourier to scalarField_real
real(c_double), dimension(:,:,:), pointer, public scalarfield_real
scalar field real representation for fftw
integer(kind=selected_int_kind(5)), private yend
real(preal), public, protected err_thermal_tolrel
relative tolerance for thermal equilibrium
type(group_float), dimension(:), allocatable, public temperature
temperature field
Utilities used by the different spectral solver variants.
integer, public, protected worldsize
MPI worldsize (/=1 for MPI simulations only)
real(preal) function, public thermal_conduction_getmassdensity(ip, el)
returns homogenized mass density
Parses material config file, either solverJobName.materialConfig or material.config.
integer(kind=selected_int_kind(5)), private ystart
integer, public, protected grid3
(local) grid in 3rd direction
integer(kind=selected_int_kind(5)), private xstart
Parse geometry file to set up discretization and geometry for nonlocal model.
setting precision for real and int type
subroutine, public grid_thermal_spectral_forward(cutBack)
forwarding routine
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
subroutine, public thermal_conduction_getsourceanditstangent(Tdot, dTdot_dT, T, ip, el)
returns heat generation rate
subroutine, public utilities_fouriervectordivergence()
calculate vector divergence in fourier field
subroutine, public thermal_conduction_puttemperatureanditsrate(T, Tdot, ip, el)
updates thermal state with solution from heat conduction PDE
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
1 solver for thermal conduction
subroutine updatereference
update reference viscosity and conductivity
subroutine, public utilities_fftvectorforward
forward FFT of data in field_real to field_fourier with highest freqs. removed
real(preal), public, protected err_thermal_tolabs
absolute tolerance for thermal equilibrium
integer(kind=selected_int_kind(5)), private zstart
subroutine, public utilities_fourierscalargradient()
calculate scalar gradient in fourier field
type(tvec), private solution_vec
real(preal) function, public thermal_conduction_getspecificheat(ip, el)
returns homogenized specific heat capacity
material subroutine for temperature evolution from heat conduction
real(preal), dimension(:,:,:), allocatable, private t_lastinc
field of previous temperature
integer, public, protected itmax
maximum number of iterations
type(tsolutionstate) function, public grid_thermal_spectral_solution(timeinc, timeinc_old)
solution for the spectral thermal scheme with internal iterations
integer, dimension(:), allocatable, public, protected material_homogenizationat
homogenization ID of each element (copy of discretization_homogenizationAt)
real(preal), dimension(:,:,:), allocatable, private t_staginc
field of staggered temperature
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 xend
subroutine, private formresidual(in, x_scal, f_scal, dummy, ierr)
forms the spectral thermal residual vector
real(preal), private mu_ref
real(preal) function, dimension(3, 3), public thermal_conduction_getconductivity(ip, el)
returns homogenized thermal conductivity in reference configuration
subroutine, public utilities_fouriergreenconvolution(D_ref, mobility_ref, deltaT)
doing convolution DamageGreenOp_hat * field_real
type(tsolutionparams), private params
real(preal), dimension(3, 3), private k_ref
type(tsnes), private thermal_snes
integer, private totaliter
total iteration in current increment
Managing of parameters related to numerics.
return type of solution from spectral solver variants
subroutine, public grid_thermal_spectral_init
allocates all neccessary fields and fills them with data
integer(kind=selected_int_kind(5)), private zend