|
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/DAMASK_grid.f90"
4 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/DAMASK_grid.f90"
15 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 1
28 # 1 "/opt/petsc-3.10.3/Intel-18.4-IntelMPI-2018/include/petscconf.h" 1
1236 # 13 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1241 # 1 "/opt/petsc-3.10.3/include/petscversion.h" 1
1287 # 17 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1289 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h" 1
1306 # 31 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h"
1308 # 18 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1310 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h" 1
1319 # 24 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h"
1321 # 38 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h"
1338 # 19 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1340 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petsclog.h" 1
1343 # 20 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1345 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscbag.h" 1
1358 # 21 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1366 # 41 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1376 # 63 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1390 # 85 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1409 # 128 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1411 # 150 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1415 # 174 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1448 # 215 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1461 # 11 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/DAMASK_grid.f90" 2
1483 real(
preal),
dimension(9) :: temp_valuevector = 0.0_preal
1484 logical,
dimension(9) :: temp_maskvector = .false.
1485 integer,
allocatable,
dimension(:) :: chunkpos
1487 n_t = 0, & !< # of time indicators found in load case file
1490 character(len=pStringLen) :: &
1495 real(
preal),
dimension(3,3),
parameter :: &
1498 integer,
parameter :: &
1502 time0 = 0.0_preal, &
1503 timeinc = 1.0_preal, &
1504 timeincold = 0.0_preal, &
1505 remainingloadcasetime = 0.0_preal
1507 guess, & !< guess along former trajectory
1511 i, j, k, l, field, &
1516 currentloadcase = 0, & !< current load case
1518 totalincscounter = 0, &
1522 character(len=pStringLen),
dimension(:),
allocatable :: filecontent
1523 character(len=pStringLen) :: &
1526 type(
tloadcase),
allocatable,
dimension(:) :: loadcases
1546 write(6,
'(/,a)')
' <<<+- DAMASK_spectral init -+>>>';
flush(6)
1548 write(6,
'(/,a)')
' Shanthraj et al., Handbook of Mechanics of Materials, 2019'
1549 write(6,
'(a)')
' https://doi.org/10.1007/978-981-10-6855-3_80'
1556 allocate(solres(nactivefields))
1557 allocate(newloadcase%ID(nactivefields))
1561 select case (trim(
config_numerics%getString(
'spectral_solver',defaultval=
'basic')))
1569 case (
'polarisation')
1571 call io_warning(42, ext_msg=
'debug Divergence')
1580 call io_warning(42, ext_msg=
'debug Divergence')
1596 allocate (loadcases(0))
1597 do currentloadcase = 1,
size(filecontent)
1598 line = filecontent(currentloadcase)
1602 do i = 1, chunkpos(1)
1604 case(
'l',
'fdot',
'dotf',
'f')
1606 case(
't',
'time',
'delta')
1608 case(
'n',
'incs',
'increments',
'logincs',
'logincrements')
1612 if ((n_def /= n_n) .or. (n_n /= n_t) .or. n_n < 1) &
1615 newloadcase%stress%myType=
'stress'
1627 call newloadcase%rot%fromEulers(real([0.0,0.0,0.0],
preal))
1628 readin:
do i = 1, chunkpos(1)
1630 case(
'fdot',
'dotf',
'l',
'f')
1631 temp_valuevector = 0.0_preal
1634 newloadcase%deformation%myType =
'fdot'
1636 newloadcase%deformation%myType =
'f'
1638 newloadcase%deformation%myType =
'l'
1642 if (temp_maskvector(j)) temp_valuevector(j) =
io_floatvalue(line,chunkpos,i+j)
1644 newloadcase%deformation%maskLogical = transpose(reshape(temp_maskvector,[ 3,3]))
1645 newloadcase%deformation%maskFloat = merge(ones,zeros,newloadcase%deformation%maskLogical)
1646 newloadcase%deformation%values =
math_9to33(temp_valuevector)
1647 case(
'p',
'stress',
's')
1648 temp_valuevector = 0.0_preal
1651 if (temp_maskvector(j)) temp_valuevector(j) =
io_floatvalue(line,chunkpos,i+j)
1653 newloadcase%stress%maskLogical = transpose(reshape(temp_maskvector,[ 3,3]))
1654 newloadcase%stress%maskFloat = merge(ones,zeros,newloadcase%stress%maskLogical)
1655 newloadcase%stress%values =
math_9to33(temp_valuevector)
1656 case(
't',
'time',
'delta')
1658 case(
'n',
'incs',
'increments')
1660 case(
'logincs',
'logincrements')
1662 newloadcase%logscale = 1
1663 case(
'freq',
'frequency',
'outputfreq')
1664 newloadcase%outputfrequency =
io_intvalue(line,chunkpos,i+1)
1665 case(
'r',
'restart',
'restartwrite')
1666 newloadcase%restartfrequency =
io_intvalue(line,chunkpos,i+1)
1667 case(
'guessreset',
'dropguessing')
1668 newloadcase%followFormerTrajectory = .false.
1670 temp_valuevector = 0.0_preal
1674 case(
'deg',
'degree')
1675 case(
'rad',
'radian')
1683 call newloadcase%rot%fromEulers(temp_valuevector(1:3),degrees=(l==1))
1684 case(
'rotation',
'rot')
1685 temp_valuevector = 0.0_preal
1689 call newloadcase%rot%fromMatrix(
math_9to33(temp_valuevector))
1693 newloadcase%followFormerTrajectory = merge(.true.,.false.,currentloadcase > 1)
1695 reportandcheck:
if (worldrank == 0)
then
1696 write (loadcase_string,
'(i0)' ) currentloadcase
1697 write(6,
'(/,1x,a,i0)')
'load case: ', currentloadcase
1698 if (.not. newloadcase%followFormerTrajectory)
write(6,
'(2x,a)')
'drop guessing along trajectory'
1699 if (newloadcase%deformation%myType ==
'l')
then
1701 if (any(newloadcase%deformation%maskLogical(j,1:3) .eqv. .true.) .and. &
1702 any(newloadcase%deformation%maskLogical(j,1:3) .eqv. .false.)) errorid = 832
1704 write(6,
'(2x,a)')
'velocity gradient:'
1705 else if (newloadcase%deformation%myType ==
'f')
then
1706 write(6,
'(2x,a)')
'deformation gradient at end of load case:'
1708 write(6,
'(2x,a)')
'deformation gradient rate:'
1710 do i = 1, 3;
do j = 1, 3
1711 if(newloadcase%deformation%maskLogical(i,j))
then
1712 write(6,
'(2x,f12.7)',advance=
'no') newloadcase%deformation%values(i,j)
1714 write(6,
'(2x,12a)',advance=
'no')
' * '
1716 enddo;
write(6,
'(/)',advance=
'no')
1718 if (any(newloadcase%stress%maskLogical .eqv. &
1719 newloadcase%deformation%maskLogical)) errorid = 831
1720 if (any(newloadcase%stress%maskLogical .and. transpose(newloadcase%stress%maskLogical) &
1721 .and. (
math_i3<1))) errorid = 838
1722 write(6,
'(2x,a)')
'stress / GPa:'
1723 do i = 1, 3;
do j = 1, 3
1724 if(newloadcase%stress%maskLogical(i,j))
then
1725 write(6,
'(2x,f12.7)',advance=
'no') newloadcase%stress%values(i,j)*1e-9_preal
1727 write(6,
'(2x,12a)',advance=
'no')
' * '
1729 enddo;
write(6,
'(/)',advance=
'no')
1731 if (any(abs(matmul(newloadcase%rot%asMatrix(), &
1732 transpose(newloadcase%rot%asMatrix()))-
math_i3) > &
1734 if (any(
dneq(newloadcase%rot%asMatrix(),
math_i3))) &
1735 write(6,
'(2x,a,/,3(3(3x,f12.7,1x)/))',advance=
'no')
'rotation of loadframe:',&
1736 transpose(newloadcase%rot%asMatrix())
1737 if (newloadcase%time < 0.0_preal) errorid = 834
1738 write(6,
'(2x,a,f0.3)')
'time: ', newloadcase%time
1739 if (newloadcase%incs < 1) errorid = 835
1740 write(6,
'(2x,a,i0)')
'increments: ', newloadcase%incs
1741 if (newloadcase%outputfrequency < 1) errorid = 836
1742 write(6,
'(2x,a,i0)')
'output frequency: ', newloadcase%outputfrequency
1743 if (newloadcase%restartfrequency < 1) errorid = 839
1744 if (newloadcase%restartfrequency < huge(0)) &
1745 write(6,
'(2x,a,i0)')
'restart frequency: ', newloadcase%restartfrequency
1746 if (errorid > 0)
call io_error(error_id = errorid, ext_msg = loadcase_string)
1747 endif reportandcheck
1748 loadcases = [loadcases,newloadcase]
1755 do field = 1, nactivefields
1756 select case (loadcases(1)%ID(field))
1771 if (worldrank == 0)
then
1773 open(newunit=statunit,file=trim(
getsolverjobname())//
'.sta',form=
'FORMATTED',status=
'REPLACE')
1774 write(statunit,
'(a)')
'Increment Time CutbackLevel Converged IterationsNeeded'
1776 write(6,
'(/,a)')
' header of statistics file written out'
1780 '.sta',form=
'FORMATTED', position=
'APPEND', status=
'OLD')
1785 write(6,
'(1/,a)')
' ... writing initial configuration to file ........................'
1787 endif writeundeformed
1789 loadcaselooping:
do currentloadcase = 1,
size(loadcases)
1791 guess = loadcases(currentloadcase)%followFormerTrajectory
1793 inclooping:
do inc = 1, loadcases(currentloadcase)%incs
1794 totalincscounter = totalincscounter + 1
1798 timeincold = timeinc
1799 if (loadcases(currentloadcase)%logscale == 0)
then
1800 timeinc = loadcases(currentloadcase)%time/real(loadcases(currentloadcase)%incs,
preal)
1802 if (currentloadcase == 1)
then
1804 timeinc = loadcases(1)%time*(2.0_preal**real( 1-loadcases(1)%incs ,
preal))
1806 timeinc = loadcases(1)%time*(2.0_preal**real(inc-1-loadcases(1)%incs ,
preal))
1810 ( (1.0_preal + loadcases(currentloadcase)%time/time0 )**(real( inc ,
preal)/&
1811 real(loadcases(currentloadcase)%incs ,
preal))&
1812 -(1.0_preal + loadcases(currentloadcase)%time/time0 )**(
real( inc-1 ,
preal)/&
1813 real(loadcases(currentloadcase)%incs ,
preal)))
1816 timeinc = timeinc * real(substepfactor,
preal)**real(-cutbacklevel,
preal)
1819 time = time + timeinc
1824 substeplooping:
do while (stepfraction < substepfactor**cutbacklevel)
1825 remainingloadcasetime = loadcases(currentloadcase)%time+time0 - time
1826 time = time + timeinc
1827 stepfraction = stepfraction + 1
1831 write(6,
'(/,a)')
' ###########################################################################'
1832 write(6,
'(1x,a,es12.5,6(a,i0))') &
1834 's: Increment ', inc,
'/',loadcases(currentloadcase)%incs,&
1835 '-', stepfraction,
'/',substepfactor**cutbacklevel,&
1836 ' of load case ', currentloadcase,
'/',
size(loadcases)
1838 'Increment ',totalincscounter,
'/',sum(loadcases%incs),&
1839 '-', stepfraction,
'/',substepfactor**cutbacklevel
1844 do field = 1, nactivefields
1845 select case(loadcases(currentloadcase)%ID(field))
1847 call mech_forward (&
1848 cutback,guess,timeinc,timeincold,remainingloadcasetime, &
1849 deformation_bc = loadcases(currentloadcase)%deformation, &
1850 stress_bc = loadcases(currentloadcase)%stress, &
1851 rotation_bc = loadcases(currentloadcase)%rot)
1862 stagiterate = .true.
1863 do while (stagiterate)
1864 do field = 1, nactivefields
1865 select case(loadcases(currentloadcase)%ID(field))
1867 solres(field) = mech_solution(&
1869 stress_bc = loadcases(currentloadcase)%stress, &
1870 rotation_bc = loadcases(currentloadcase)%rot)
1880 if (.not. solres(field)%converged)
exit
1883 stagiter = stagiter + 1
1884 stagiterate = stagiter < stagitmax &
1885 .and. all(solres(:)%converged) &
1886 .and. .not. all(solres(:)%stagConverged)
1892 if ( (all(solres(:)%converged .and. solres(:)%stagConverged)) &
1893 .and. .not. solres(1)%termIll)
then
1894 call mech_updatecoords
1895 timeincold = timeinc
1898 if (worldrank == 0)
then
1899 write(statunit,*) totalincscounter, time, cutbacklevel, &
1900 solres%converged, solres%iterationsNeeded
1903 elseif (cutbacklevel < maxcutback)
then
1905 stepfraction = (stepfraction - 1) * substepfactor
1906 cutbacklevel = cutbacklevel + 1
1907 time = time - timeinc
1908 timeinc = timeinc/real(substepfactor,
preal)
1909 write(6,
'(/,a)')
' cutting back '
1912 if (worldrank == 0)
close(statunit)
1916 enddo substeplooping
1918 cutbacklevel = max(0, cutbacklevel - 1)
1920 if (all(solres(:)%converged))
then
1921 write(6,
'(/,a,i0,a)')
' increment ', totalincscounter,
' converged'
1923 write(6,
'(/,a,i0,a)')
' increment ', totalincscounter,
' NOT converged'
1926 if (mod(inc,loadcases(currentloadcase)%outputFrequency) == 0)
then
1927 write(6,
'(1/,a)')
' ... writing results to file ......................................'
1931 if (mod(inc,loadcases(currentloadcase)%restartFrequency) == 0)
then
1932 call mech_restartwrite
1939 enddo loadcaselooping
1944 write(6,
'(/,a)')
' ###########################################################################'
1945 if (worldrank == 0)
close(statunit)
needs a good name and description
pure integer function, dimension(:), allocatable, public io_stringpos(string)
locates all whitespace-separated chunks in given string and returns array containing number them and ...
character(len=pstringlen) function, dimension(:), allocatable, public io_read_ascii(fileName)
reads an entire ASCII file into an array
subroutine, public grid_mech_spectral_polarisation_updatecoords
Age.
subroutine cpfem_results(inc, time)
Trigger writing of results.
subroutine, public grid_mech_fem_forward(cutBack, guess, timeinc, timeinc_old, loadCaseTime, deformation_BC, stress_BC, rotation_BC)
forwarding routine
type(tsolutionstate) function, public grid_damage_spectral_solution(timeinc, timeinc_old)
solution for the spectral damage scheme with internal iterations
real(preal), parameter tol_math_check
tolerance for internal math self-checks (rotation)
subroutine, public io_error(error_ID, el, ip, g, instance, ext_msg)
write error statements to standard out and terminate the Marc/spectral run with exit #9xxx
subroutine cpfem_initall
call all module initializations
character(len=pstringlen), private incinfo
time and increment information
subroutine cpfem_forward
Forward data for new time increment.
integer, dimension(debug_maxntype+2), public, protected debug_level
type(tsolutionstate) function, public grid_mech_spectral_polarisation_solution(incInfoIn, timeinc, timeinc_old, stress_BC, rotation_BC)
solution for the Polarisation scheme with internal iterations
@, public field_thermal_id
subroutine, public grid_mech_spectral_basic_updatecoords
Age.
subroutine, public grid_mech_spectral_basic_restartwrite
Write current solver and constitutive data for restart to file.
@, public damage_nonlocal_id
character(len=:), allocatable, public, protected loadcasefile
parameter given for load case file
Utilities used by the different spectral solver variants.
Grid solver for mechanics: 1 Polarisation.
program damask_spectral
Driver controlling inner and outer load case looping of the various spectral solvers.
Parses material config file, either solverJobName.materialConfig or material.config.
Reads in the material configuration from file.
@, public field_damage_id
integer(kind(thermal_isothermal_id)), dimension(:), allocatable, public, protected thermal_type
thermal transport model
setting precision for real and int type
subroutine, public grid_thermal_spectral_forward(cutBack)
forwarding routine
Grid solver for mechanics: 1 basic.
Grid solver for mechanics: FEM.
subroutine, public utilities_init
allocates all neccessary fields, sets debug flags, create plans for FFTW
subroutine, public grid_mech_spectral_polarisation_forward(cutBack, guess, timeinc, timeinc_old, loadCaseTime, deformation_BC, stress_BC, rotation_BC)
forwarding routine
subroutine, public grid_mech_fem_updatecoords
Age.
subroutine, public io_warning(warning_ID, el, ip, g, ext_msg)
writes warning statement to standard out
input/output functions, partly depending on chosen solver
integer, parameter, public debug_levelbasic
integer, parameter preal
number with 15 significant digits, up to 1e+-307 (typically 64 bit)
Reading in and interpretating the debugging settings for the various modules.
subroutine quit(stop_id)
quit subroutine
1 solver for thermal conduction
subroutine, public grid_mech_fem_init
allocates all necessary fields and fills them with data, potentially from restart info
logical pure function, public io_isblank(string)
identifies strings without content
logical elemental pure function dneq(a, b, tol)
inequality comparison for float with double precision
subroutine, public grid_mech_spectral_polarisation_restartwrite
Write current solver and constitutive data for restart to file.
subroutine, public grid_mech_fem_restartwrite
Write current solver and constitutive data for restart to file.
subroutine, public grid_damage_spectral_init
allocates all neccessary fields and fills them with data
type(tsolutionstate) function, public grid_mech_fem_solution(incInfoIn, timeinc, timeinc_old, stress_BC, rotation_BC)
solution for the FEM scheme with internal iterations
integer function, public io_intvalue(string, chunkPos, myChunk)
reads integer value at myChunk from string
integer, public, protected interface_restartinc
Increment at which calculation starts.
Interfacing between the 1-based solvers and the material subroutines provided by DAMASK.
type(tpartitionedstringlist), public, protected config_numerics
subroutine cpfem_restartwrite
Write restart information.
type(tsolutionstate) function, public grid_thermal_spectral_solution(timeinc, timeinc_old)
solution for the spectral thermal scheme with internal iterations
integer, parameter, public debug_spectral
Mathematical library, including random number generation and tensor representations.
pure real(preal) function, dimension(3, 3) math_9to33(v9)
convert 9 vector into 3x3 matrix
1 solver for nonlocal damage
subroutine, public grid_damage_spectral_forward(cutBack)
spectral damage forwarding routine
character(len=:) function, allocatable, public getsolverjobname()
solver job name (no extension) as combination of geometry and load case name
pure character(len=len(string)) function, public io_lc(string)
changes characters in string to lower case
character(len=:) function, allocatable, public io_stringvalue(string, chunkPos, myChunk)
reads string value at myChunk from string
subroutine, public grid_mech_spectral_basic_init
allocates all necessary fields and fills them with data, potentially from restart info
integer(kind(damage_none_id)), dimension(:), allocatable, public, protected damage_type
nonlocal damage model
return type of solution from spectral solver variants
subroutine, public grid_thermal_spectral_init
allocates all neccessary fields and fills them with data
subroutine, public grid_mech_spectral_basic_forward(cutBack, guess, timeinc, timeinc_old, loadCaseTime, deformation_BC, stress_BC, rotation_BC)
forwarding routine
subroutine, public grid_mech_spectral_polarisation_init
allocates all necessary fields and fills them with data, potentially from restart info
real(preal) function, public io_floatvalue(string, chunkPos, myChunk)
reads float value at myChunk from string
@, public thermal_conduction_id
type(tsolutionstate) function, public grid_mech_spectral_basic_solution(incInfoIn, timeinc, timeinc_old, stress_BC, rotation_BC)
solution for the basic scheme with internal iterations
real(preal), dimension(3, 3), parameter math_i3
3x3 Identity