|
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/DAMASK_interface.f90"
4 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/DAMASK_interface.f90"
23 use,
intrinsic :: iso_fortran_env
32 logical,
public,
protected :: &
33 sigterm, & !< termination signal
34 sigusr1, & !< 1. user-defined signal
36 integer,
public,
protected :: &
38 character(len=:),
allocatable,
public,
protected :: &
57 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 1
70 # 1 "/opt/petsc-3.10.3/Intel-18.4-IntelMPI-2018/include/petscconf.h" 1
1278 # 13 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1283 # 1 "/opt/petsc-3.10.3/include/petscversion.h" 1
1329 # 17 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1331 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h" 1
1348 # 31 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h"
1350 # 18 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1352 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h" 1
1361 # 24 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h"
1363 # 38 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h"
1380 # 19 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1382 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petsclog.h" 1
1385 # 20 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1387 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscbag.h" 1
1400 # 21 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1408 # 41 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1418 # 63 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1432 # 85 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1451 # 128 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1453 # 150 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1457 # 174 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1490 # 215 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1503 # 53 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/DAMASK_interface.f90" 2
1504 # 64 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/DAMASK_interface.f90"
1506 # 76 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/DAMASK_interface.f90"
1508 # 88 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/DAMASK_interface.f90"
1510 character(len=pPathLen*3+pStringLen) :: &
1512 character(len=pPathLen) :: &
1513 arg, & !< individual argument
1514 loadcasearg =
'', & !< -l argument given to the executable
1517 character(len=pStringLen) :: &
1528 integer,
dimension(8) :: &
1531 integer(kind=selected_int_kind(5)) :: petsc_err
1535 open(6, encoding=
'UTF-8')
1539 # 128 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/DAMASK_interface.f90"
1540 call petscinitializenoarguments(petsc_err)
1541 if (petsc_err .ne. 0) then;
call petscerrorf(petsc_err);return;
endif
1543 call mpi_comm_rank(petsc_comm_world,worldrank,mpi_err)
1544 if (mpi_err /= 0)
call quit(1)
1545 call mpi_comm_size(petsc_comm_world,worldsize,mpi_err)
1546 if (mpi_err /= 0)
call quit(1)
1548 mainprocess:
if (worldrank == 0)
then
1549 if (output_unit /= 6)
then
1550 write(output_unit,
'(/,a)')
' ERROR: STDOUT != 6'
1553 if (error_unit /= 0)
then
1554 write(output_unit,
'(/,a)')
' ERROR: STDERR != 0'
1559 open(6,file=
'/dev/null',status=
'replace')
1562 write(6,
'(/,a)')
' <<<+- DAMASK_interface init -+>>>'
1565 write(6,*) achar(27)//
'[94m'
1566 write(6,*)
' _/_/_/ _/_/ _/ _/ _/_/ _/_/_/ _/ _/'
1567 write(6,*)
' _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/'
1568 write(6,*)
' _/ _/ _/_/_/_/ _/ _/ _/ _/_/_/_/ _/_/ _/_/'
1569 write(6,*)
' _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/'
1570 write(6,*)
' _/_/_/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/'
1571 write(6,*) achar(27)//
'[0m'
1573 write(6,
'(/,a)')
' Roters et al., Computational Materials Science 158:420–478, 2019'
1574 write(6,
'(a)')
' https://doi.org/10.1016/j.commatsci.2018.04.030'
1576 write(6,
'(/,a)')
' Version: '//damaskversion
1580 write(6,
'(/,a)')
' Compiled with: '//compiler_version()
1581 write(6,
'(a)')
' Compiler options: '//compiler_options()
1590 write(6,
'(/,a)')
' Compiled on: '//
"Apr 1 2020"//
' at '//
"18:44:57"
1592 call date_and_time(values = dateandtime)
1593 write(6,
'(/,a,2(i2.2,a),i4.4)')
' Date: ',dateandtime(3),
'/',dateandtime(2),
'/', dateandtime(1)
1594 write(6,
'(a,2(i2.2,a),i2.2)')
' Time: ',dateandtime(5),
':', dateandtime(6),
':', dateandtime(7)
1596 call mpi_type_size(mpi_integer,typesize,mpi_err)
1597 if (mpi_err /= 0)
call quit(1)
1598 if (typesize*8 /= bit_size(0))
then
1599 write(6,
'(a)')
' Mismatch between MPI and DAMASK integer'
1603 call mpi_type_size(mpi_double,typesize,mpi_err)
1604 if (mpi_err /= 0)
call quit(1)
1605 if (typesize*8 /= storage_size(0.0_preal))
then
1606 write(6,
'(a)')
' Mismatch between MPI and DAMASK real'
1610 do i = 1, command_argument_count()
1611 call get_command_argument(i,arg)
1612 select case(trim(arg))
1613 case (
'-h',
'--help')
1614 write(6,
'(a)')
' #######################################################################'
1615 write(6,
'(a)')
' DAMASK Command Line Interface:'
1616 write(6,
'(a)')
' For PETSc-based solvers for the Düsseldorf Advanced Material Simulation Kit'
1617 write(6,
'(a,/)')
' #######################################################################'
1618 write(6,
'(a,/)')
' Valid command line switches:'
1619 write(6,
'(a)')
' --geom (-g, --geometry)'
1620 write(6,
'(a)')
' --load (-l, --loadcase)'
1621 write(6,
'(a)')
' --workingdir (-w, --wd, --workingdirectory, -d, --directory)'
1622 write(6,
'(a)')
' --restart (-r, --rs)'
1623 write(6,
'(a)')
' --help (-h)'
1624 write(6,
'(/,a)')
' -----------------------------------------------------------------------'
1625 write(6,
'(a)')
' Mandatory arguments:'
1626 write(6,
'(/,a)')
' --geom PathToGeomFile/NameOfGeom'
1627 write(6,
'(a)')
' Specifies the location of the geometry definition file.'
1628 write(6,
'(/,a)')
' --load PathToLoadFile/NameOfLoadFile'
1629 write(6,
'(a)')
' Specifies the location of the load case definition file.'
1630 write(6,
'(/,a)')
' -----------------------------------------------------------------------'
1631 write(6,
'(a)')
' Optional arguments:'
1632 write(6,
'(/,a)')
' --workingdirectory PathToWorkingDirectory'
1633 write(6,
'(a)')
' Specifies the working directory and overwrites the default ./'
1634 write(6,
'(a)')
' Make sure the file "material.config" exists in the working'
1635 write(6,
'(a)')
' directory.'
1636 write(6,
'(a)')
' For further configuration place "numerics.config"'
1637 write(6,
'(a)')
' and "debug.config" in that directory.'
1638 write(6,
'(/,a)')
' --restart XX'
1639 write(6,
'(a)')
' Reads in increment XX and continues with calculating'
1640 write(6,
'(a)')
' increment XX+1 based on this.'
1641 write(6,
'(a)')
' Appends to existing results file'
1642 write(6,
'(a)')
' "NameOfGeom_NameOfLoadFile".'
1643 write(6,
'(a)')
' Works only if the restart information for increment XX'
1644 write(6,
'(a)')
' is available in the working directory.'
1645 write(6,
'(/,a)')
' -----------------------------------------------------------------------'
1646 write(6,
'(a)')
' Help:'
1647 write(6,
'(/,a)')
' --help'
1648 write(6,
'(a,/)')
' Prints this message and exits'
1650 case (
'-l',
'--load',
'--loadcase')
1651 call get_command_argument(i+1,loadcasearg)
1652 case (
'-g',
'--geom',
'--geometry')
1653 call get_command_argument(i+1,geometryarg)
1654 case (
'-w',
'-d',
'--wd',
'--directory',
'--workingdir',
'--workingdirectory')
1655 call get_command_argument(i+1,workingdirarg)
1656 case (
'-r',
'--rs',
'--restart')
1657 call get_command_argument(i+1,arg)
1660 write(6,
'(/,a)')
' ERROR: Could not parse restart increment: '//trim(arg)
1666 if (len_trim(loadcasearg) == 0 .or. len_trim(geometryarg) == 0)
then
1667 write(6,
'(/,a)')
' ERROR: Please specify geometry AND load case (-h for help)'
1675 call get_command(commandline)
1676 call get_environment_variable(
'USER',username)
1678 write(6,
'(/,a,i4.1)')
' MPI processes: ',worldsize
1679 write(6,
'(a,a)')
' Host name: ', trim(
gethostname())
1680 write(6,
'(a,a)')
' User name: ', trim(username)
1682 write(6,
'(/a,a)')
' Command line call: ', trim(commandline)
1683 if (len_trim(workingdirarg) > 0) &
1684 write(6,
'(a,a)')
' Working dir argument: ', trim(workingdirarg)
1685 write(6,
'(a,a)')
' Geometry argument: ', trim(geometryarg)
1686 write(6,
'(a,a)')
' Load case argument: ', trim(loadcasearg)
1687 write(6,
'(a,a)')
' Working directory: ',
getcwd()
1711 character(len=*),
intent(in) :: workingDirectoryArg
1712 character(len=pPathLen) :: workingDirectory
1716 absolutepath:
if (workingdirectoryarg(1:1) ==
'/')
then
1717 workingdirectory = workingdirectoryarg
1719 workingdirectory =
getcwd()
1720 workingdirectory = trim(workingdirectory)//
'/'//workingdirectoryarg
1723 workingdirectory = trim(
rectifypath(workingdirectory))
1724 error =
setcwd(trim(workingdirectory))
1726 write(6,
'(/,a)')
' ERROR: Invalid Working directory: '//trim(workingdirectory)
1739 integer :: posext,possep
1760 character(len=*),
intent(in) :: geometryparameter
1761 logical :: file_exists
1769 if (.not. file_exists)
then
1770 write(6,
'(/,a)')
' ERROR: Geometry file does not exists ('//trim(
getgeometryfile)//
')'
1783 character(len=*),
intent(in) :: loadcaseparameter
1784 logical :: file_exists
1792 if (.not. file_exists)
then
1793 write(6,
'(/,a)')
' ERROR: Load case file does not exists ('//trim(
getloadcasefile)//
')'
1806 character(len=*),
intent(in) :: path
1852 character (len=*),
intent(in) :: a,b
1853 character (len=pPathLen) :: a_cleaned,b_cleaned
1855 integer :: i,poslastcommonslash,remainingslashes
1857 poslastcommonslash = 0
1858 remainingslashes = 0
1862 do i = 1, min(1024,len_trim(a_cleaned),len_trim(
rectifypath(b_cleaned)))
1863 if (a_cleaned(i:i) /= b_cleaned(i:i))
exit
1864 if (a_cleaned(i:i) ==
'/') poslastcommonslash = i
1866 do i = poslastcommonslash+1,len_trim(a_cleaned)
1867 if (a_cleaned(i:i) ==
'/') remainingslashes = remainingslashes + 1
1870 makerelativepath = repeat(
'..'//
'/',remainingslashes)//b_cleaned(poslastcommonslash+1:len_trim(b_cleaned))
1880 integer(C_INT),
value :: signal
1883 write(6,
'(a,i2.2,a)')
' received signal ',signal,
', set SIGTERM'
1893 logical,
intent(in) :: state
1904 integer(C_INT),
value :: signal
1907 write(6,
'(a,i2.2,a)')
' received signal ',signal,
', set SIGUSR1'
1917 logical,
intent(in) :: state
1928 integer(C_INT),
value :: signal
1931 write(6,
'(a,i2.2,a)')
' received signal ',signal,
', set SIGUSR2'
1941 logical,
intent(in) :: state
character(len=:) function, allocatable makerelativepath(a, b)
relative path from absolute a to absolute b
subroutine, public setsigterm(state)
sets global variable SIGTERM
logical function, public setcwd(path)
changes the current working directory
subroutine, public setsigusr1(state)
sets global variable SIGUSR1
character(len=:), allocatable, public, protected geometryfile
parameter given for geometry file
subroutine catchsigusr2(signal)
sets global variable SIGUSR2 to .true. if program receives SIGUSR2
character(len=:) function, allocatable getloadcasefile(loadCaseParameter)
relative path of loadcase from command line arguments
character(len=:), allocatable, public, protected loadcasefile
parameter given for load case file
character(len=:) function, allocatable, public getcwd()
gets the current working directory
logical, public, protected sigusr1
user-defined signal
subroutine catchsigusr1(signal)
sets global variable SIGUSR1 to .true.
setting precision for real and int type
subroutine, public damask_interface_init
initializes the solver by interpreting the command line arguments. Also writes information on computa...
subroutine setworkingdirectory(workingDirectoryArg)
extract working directory from given argument or from location of geometry file, possibly converting ...
subroutine quit(stop_id)
quit subroutine
logical, public, protected sigusr2
character(len=:) function, allocatable getgeometryfile(geometryParameter)
basename of geometry file with extension from command line arguments
provides wrappers to C routines
logical, public, protected sigterm
termination signal
character(len=:) function, allocatable rectifypath(path)
remove ../, /./, and // from path.
integer, public, protected interface_restartinc
Increment at which calculation starts.
Interfacing between the 1-based solvers and the material subroutines provided by DAMASK.
character(len=:) function, allocatable, public getsolverjobname()
solver job name (no extension) as combination of geometry and load case name
subroutine catchsigterm(signal)
sets global variable SIGTERM to .true.
subroutine, public setsigusr2(state)
sets global variable SIGUSR2
character(len=:) function, allocatable, public gethostname()
gets the current host name