Merge branch 'development' into structure-improvements
This commit is contained in:
commit
bb83d20fe9
|
@ -233,7 +233,8 @@ update_revision:
|
|||
- cd $(mktemp -d)
|
||||
- git clone -q git@git.damask.mpie.de:damask/DAMASK.git .
|
||||
- git pull
|
||||
- export VERSION=$(git describe ${CI_COMMIT_SHA})
|
||||
- VERSION=$(git describe ${CI_COMMIT_SHA})
|
||||
- export VERSION="${VERSION:1}"
|
||||
- echo ${VERSION} > python/damask/VERSION
|
||||
- >
|
||||
git diff-index --quiet HEAD ||
|
||||
|
|
|
@ -1 +1 @@
|
|||
v3.0.0-alpha6-249-gd2cf972b2
|
||||
3.0.0-alpha6-258-gea7c8ef23
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
[metadata]
|
||||
name = damask
|
||||
version = file: damask/VERSION
|
||||
author = The DAMASK team
|
||||
author_email = damask@mpie.de
|
||||
url = https://damask.mpie.de
|
||||
description = DAMASK processing tools
|
||||
long_description = Pre- and post-processing tools for DAMASK
|
||||
license: AGPL3
|
||||
classifiers =
|
||||
Intended Audience :: Science/Research
|
||||
Topic :: Scientific/Engineering
|
||||
Programming Language :: Python :: 3
|
||||
License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
||||
Operating System :: OS Independent
|
||||
|
||||
[options]
|
||||
packages = damask
|
||||
include_package_data = true
|
||||
python_requires = >= 3.8
|
||||
install_requires =
|
||||
importlib-metadata; python_version<"3.8"
|
||||
pandas; python_version<="0.24" # requires numpy
|
||||
numpy; python_version<="1.17" # needed for default_rng
|
||||
scipy; python_version<="1.2"
|
||||
h5py; python_version<="2.9" # requires numpy
|
||||
vtk; python_version<="8.1"
|
||||
matplotlib; python_version<="3.0" # requires numpy, pillow
|
||||
pyyaml; python_version<="3.12"
|
||||
setup_requires = setuptools
|
|
@ -1,36 +0,0 @@
|
|||
import setuptools
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
# https://www.python.org/dev/peps/pep-0440
|
||||
with open(Path(__file__).parent/'damask/VERSION') as f:
|
||||
version = re.sub(r'(-([^-]*)).*$',r'.\2',re.sub(r'^v(\d+\.\d+(\.\d+)?)',r'\1',f.readline().strip()))
|
||||
|
||||
setuptools.setup(
|
||||
name='damask',
|
||||
version=version,
|
||||
author='The DAMASK team',
|
||||
author_email='damask@mpie.de',
|
||||
description='DAMASK processing tools',
|
||||
long_description='Pre- and post-processing tools for DAMASK',
|
||||
url='https://damask.mpie.de',
|
||||
packages=setuptools.find_packages(),
|
||||
include_package_data=True,
|
||||
python_requires = '>=3.8',
|
||||
install_requires = [
|
||||
'pandas>=0.24', # requires numpy
|
||||
'numpy>=1.17', # needed for default_rng
|
||||
'scipy>=1.2',
|
||||
'h5py>=2.9', # requires numpy
|
||||
'vtk>=8.1',
|
||||
'matplotlib>=3.0', # requires numpy, pillow
|
||||
'pyyaml>=3.12'
|
||||
],
|
||||
classifiers = [
|
||||
'Intended Audience :: Science/Research',
|
||||
'Topic :: Scientific/Engineering',
|
||||
'Programming Language :: Python :: 3',
|
||||
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
|
||||
'Operating System :: OS Independent',
|
||||
],
|
||||
)
|
|
@ -3,17 +3,13 @@
|
|||
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
||||
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
||||
!> @brief Interfacing between the PETSc-based solvers and the material subroutines provided
|
||||
!! by DAMASK
|
||||
!> @details Interfacing between the PETSc-based solvers and the material subroutines provided
|
||||
!> by DAMASK. Interpreting the command line arguments to get load case, geometry file,
|
||||
!> and working directory.
|
||||
!> @brief Parse command line interface for PETSc-based solvers
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
#define PETSC_MAJOR 3
|
||||
#define PETSC_MINOR_MIN 12
|
||||
#define PETSC_MINOR_MAX 17
|
||||
|
||||
module DAMASK_interface
|
||||
module CLI
|
||||
use, intrinsic :: ISO_fortran_env
|
||||
|
||||
use PETScSys
|
||||
|
@ -24,22 +20,15 @@ module DAMASK_interface
|
|||
|
||||
implicit none
|
||||
private
|
||||
logical, volatile, public, protected :: &
|
||||
interface_SIGTERM, & !< termination signal
|
||||
interface_SIGUSR1, & !< 1. user-defined signal
|
||||
interface_SIGUSR2 !< 2. user-defined signal
|
||||
integer, public, protected :: &
|
||||
interface_restartInc = 0 !< Increment at which calculation starts
|
||||
CLI_restartInc = 0 !< Increment at which calculation starts
|
||||
character(len=:), allocatable, public, protected :: &
|
||||
interface_geomFile, & !< parameter given for geometry file
|
||||
interface_loadFile !< parameter given for load case file
|
||||
CLI_geomFile, & !< parameter given for geometry file
|
||||
CLI_loadFile !< parameter given for load case file
|
||||
|
||||
public :: &
|
||||
getSolverJobName, &
|
||||
DAMASK_interface_init, &
|
||||
interface_setSIGTERM, &
|
||||
interface_setSIGUSR1, &
|
||||
interface_setSIGUSR2
|
||||
CLI_init
|
||||
|
||||
contains
|
||||
|
||||
|
@ -47,7 +36,7 @@ contains
|
|||
!> @brief initializes the solver by interpreting the command line arguments. Also writes
|
||||
!! information on computation to screen
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine DAMASK_interface_init
|
||||
subroutine CLI_init
|
||||
#include <petsc/finclude/petscsys.h>
|
||||
|
||||
#if PETSC_VERSION_MAJOR!=3 || PETSC_VERSION_MINOR<PETSC_MINOR_MIN || PETSC_VERSION_MINOR>PETSC_MINOR_MAX
|
||||
|
@ -71,7 +60,7 @@ subroutine DAMASK_interface_init
|
|||
quit
|
||||
|
||||
|
||||
print'(/,1x,a)', '<<<+- DAMASK_interface init -+>>>'
|
||||
print'(/,1x,a)', '<<<+- CLI init -+>>>'
|
||||
|
||||
! http://patorjk.com/software/taag/#p=display&f=Lean&t=DAMASK%203
|
||||
#ifdef DEBUG
|
||||
|
@ -163,8 +152,8 @@ subroutine DAMASK_interface_init
|
|||
call get_command_argument(i+1,workingDirArg,status=err)
|
||||
case ('-r', '--rs', '--restart')
|
||||
call get_command_argument(i+1,arg,status=err)
|
||||
read(arg,*,iostat=stat) interface_restartInc
|
||||
if (interface_restartInc < 0 .or. stat /=0) then
|
||||
read(arg,*,iostat=stat) CLI_restartInc
|
||||
if (CLI_restartInc < 0 .or. stat /=0) then
|
||||
print'(/,a)', ' ERROR: Could not parse restart increment: '//trim(arg)
|
||||
call quit(1)
|
||||
endif
|
||||
|
@ -178,8 +167,8 @@ subroutine DAMASK_interface_init
|
|||
endif
|
||||
|
||||
if (len_trim(workingDirArg) > 0) call setWorkingDirectory(trim(workingDirArg))
|
||||
interface_geomFile = getGeometryFile(geometryArg)
|
||||
interface_loadFile = getLoadCaseFile(loadCaseArg)
|
||||
CLI_geomFile = getGeometryFile(geometryArg)
|
||||
CLI_loadFile = getLoadCaseFile(loadCaseArg)
|
||||
|
||||
call get_command(commandLine)
|
||||
print'(/,a)', ' Host name: '//getHostName()
|
||||
|
@ -191,20 +180,13 @@ subroutine DAMASK_interface_init
|
|||
print'(a)', ' Geometry argument: '//trim(geometryArg)
|
||||
print'(a)', ' Load case argument: '//trim(loadcaseArg)
|
||||
print'(/,a)', ' Working directory: '//getCWD()
|
||||
print'(a)', ' Geometry file: '//interface_geomFile
|
||||
print'(a)', ' Load case file: '//interface_loadFile
|
||||
print'(a)', ' Geometry file: '//CLI_geomFile
|
||||
print'(a)', ' Load case file: '//CLI_loadFile
|
||||
print'(a)', ' Solver job name: '//getSolverJobName()
|
||||
if (interface_restartInc > 0) &
|
||||
print'(a,i6.6)', ' Restart from increment: ', interface_restartInc
|
||||
if (CLI_restartInc > 0) &
|
||||
print'(a,i6.6)', ' Restart from increment: ', CLI_restartInc
|
||||
|
||||
call signalterm_c(c_funloc(catchSIGTERM))
|
||||
call signalusr1_c(c_funloc(catchSIGUSR1))
|
||||
call signalusr2_c(c_funloc(catchSIGUSR2))
|
||||
call interface_setSIGTERM(.false.)
|
||||
call interface_setSIGUSR1(.false.)
|
||||
call interface_setSIGUSR2(.false.)
|
||||
|
||||
end subroutine DAMASK_interface_init
|
||||
end subroutine CLI_init
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
@ -243,15 +225,15 @@ function getSolverJobName()
|
|||
character(len=:), allocatable :: getSolverJobName
|
||||
integer :: posExt,posSep
|
||||
|
||||
posExt = scan(interface_geomFile,'.',back=.true.)
|
||||
posSep = scan(interface_geomFile,'/',back=.true.)
|
||||
posExt = scan(CLI_geomFile,'.',back=.true.)
|
||||
posSep = scan(CLI_geomFile,'/',back=.true.)
|
||||
|
||||
getSolverJobName = interface_geomFile(posSep+1:posExt-1)
|
||||
getSolverJobName = CLI_geomFile(posSep+1:posExt-1)
|
||||
|
||||
posExt = scan(interface_loadFile,'.',back=.true.)
|
||||
posSep = scan(interface_loadFile,'/',back=.true.)
|
||||
posExt = scan(CLI_loadFile,'.',back=.true.)
|
||||
posSep = scan(CLI_loadFile,'/',back=.true.)
|
||||
|
||||
getSolverJobName = getSolverJobName//'_'//interface_loadFile(posSep+1:posExt-1)
|
||||
getSolverJobName = getSolverJobName//'_'//CLI_loadFile(posSep+1:posExt-1)
|
||||
|
||||
end function getSolverJobName
|
||||
|
||||
|
@ -376,92 +358,4 @@ function makeRelativePath(a,b)
|
|||
|
||||
end function makeRelativePath
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable interface_SIGTERM to .true.
|
||||
!> @details This function can be registered to catch signals send to the executable.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine catchSIGTERM(signal) bind(C)
|
||||
|
||||
integer(C_INT), value :: signal
|
||||
|
||||
|
||||
print'(a,i0)', ' received signal ',signal
|
||||
call interface_setSIGTERM(.true.)
|
||||
|
||||
end subroutine catchSIGTERM
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable interface_SIGUSR1 to .true.
|
||||
!> @details This function can be registered to catch signals send to the executable.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine catchSIGUSR1(signal) bind(C)
|
||||
|
||||
integer(C_INT), value :: signal
|
||||
|
||||
|
||||
print'(a,i0)', ' received signal ',signal
|
||||
call interface_setSIGUSR1(.true.)
|
||||
|
||||
end subroutine catchSIGUSR1
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable interface_SIGUSR2 to .true.
|
||||
!> @details This function can be registered to catch signals send to the executable.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine catchSIGUSR2(signal) bind(C)
|
||||
|
||||
integer(C_INT), value :: signal
|
||||
|
||||
|
||||
print'(a,i0,a)', ' received signal ',signal
|
||||
call interface_setSIGUSR2(.true.)
|
||||
|
||||
end subroutine catchSIGUSR2
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable interface_SIGTERM.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine interface_setSIGTERM(state)
|
||||
|
||||
logical, intent(in) :: state
|
||||
|
||||
|
||||
interface_SIGTERM = state
|
||||
print*, 'set SIGTERM to',state
|
||||
|
||||
end subroutine interface_setSIGTERM
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable interface_SIGUSR.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine interface_setSIGUSR1(state)
|
||||
|
||||
logical, intent(in) :: state
|
||||
|
||||
|
||||
interface_SIGUSR1 = state
|
||||
print*, 'set SIGUSR1 to',state
|
||||
|
||||
end subroutine interface_setSIGUSR1
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable interface_SIGUSR2.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine interface_setSIGUSR2(state)
|
||||
|
||||
logical, intent(in) :: state
|
||||
|
||||
|
||||
interface_SIGUSR2 = state
|
||||
print*, 'set SIGUSR2 to',state
|
||||
|
||||
end subroutine interface_setSIGUSR2
|
||||
|
||||
|
||||
end module
|
||||
end module CLI
|
|
@ -1,8 +1,6 @@
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||
!> @brief Reads in the material, numerics & debug configuration from their respective file
|
||||
!> @details Reads the material configuration file, where solverJobName.yaml takes
|
||||
!! precedence over material.yaml.
|
||||
!> @brief Read in the configuration of material, numerics, and debug from their respective file
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
module config
|
||||
use IO
|
||||
|
@ -28,19 +26,19 @@ contains
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Real *.yaml configuration files.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine config_init
|
||||
subroutine config_init()
|
||||
|
||||
print'(/,1x,a)', '<<<+- config init -+>>>'; flush(IO_STDOUT)
|
||||
|
||||
call parse_material
|
||||
call parse_numerics
|
||||
call parse_debug
|
||||
call parse_material()
|
||||
call parse_numerics()
|
||||
call parse_debug()
|
||||
|
||||
end subroutine config_init
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Read material.yaml or <jobname>.yaml.
|
||||
!> @brief Read material.yaml.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine parse_material()
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ program DAMASK_grid
|
|||
|
||||
use prec
|
||||
use parallelization
|
||||
use DAMASK_interface
|
||||
use signals
|
||||
use CLI
|
||||
use IO
|
||||
use config
|
||||
use math
|
||||
|
@ -133,8 +134,8 @@ program DAMASK_grid
|
|||
if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack')
|
||||
|
||||
if (worldrank == 0) then
|
||||
fileContent = IO_read(interface_loadFile)
|
||||
fname = interface_loadFile
|
||||
fileContent = IO_read(CLI_loadFile)
|
||||
fname = CLI_loadFile
|
||||
if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:)
|
||||
call results_openJobFile(parallel=.false.)
|
||||
call results_writeDataset_str(fileContent,'setup',fname,'load case definition (grid solver)')
|
||||
|
@ -314,7 +315,7 @@ program DAMASK_grid
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
! write header of output file
|
||||
if (worldrank == 0) then
|
||||
writeHeader: if (interface_restartInc < 1) then
|
||||
writeHeader: if (CLI_restartInc < 1) then
|
||||
open(newunit=statUnit,file=trim(getSolverJobName())//'.sta',form='FORMATTED',status='REPLACE')
|
||||
write(statUnit,'(a)') 'Increment Time CutbackLevel Converged IterationsNeeded' ! statistics file
|
||||
else writeHeader
|
||||
|
@ -323,7 +324,7 @@ program DAMASK_grid
|
|||
endif writeHeader
|
||||
endif
|
||||
|
||||
writeUndeformed: if (interface_restartInc < 1) then
|
||||
writeUndeformed: if (CLI_restartInc < 1) then
|
||||
print'(/,1x,a)', '... writing initial configuration to file .................................'
|
||||
flush(IO_STDOUT)
|
||||
call materialpoint_results(0,0.0_pReal)
|
||||
|
@ -347,7 +348,7 @@ program DAMASK_grid
|
|||
endif
|
||||
Delta_t = Delta_t * real(subStepFactor,pReal)**real(-cutBackLevel,pReal) ! depending on cut back level, decrease time step
|
||||
|
||||
skipping: if (totalIncsCounter <= interface_restartInc) then ! not yet at restart inc?
|
||||
skipping: if (totalIncsCounter <= CLI_restartInc) then ! not yet at restart inc?
|
||||
t = t + Delta_t ! just advance time, skip already performed calculation
|
||||
guess = .true. ! QUESTION:why forced guessing instead of inheriting loadcase preference
|
||||
else skipping
|
||||
|
@ -448,15 +449,15 @@ program DAMASK_grid
|
|||
print'(/,1x,a,i0,a)', 'increment ', totalIncsCounter, ' NOT converged'
|
||||
endif; flush(IO_STDOUT)
|
||||
|
||||
call MPI_Allreduce(interface_SIGUSR1,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
|
||||
call MPI_Allreduce(signals_SIGUSR1,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
|
||||
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
|
||||
if (mod(inc,loadCases(l)%f_out) == 0 .or. signal) then
|
||||
print'(/,1x,a)', '... writing results to file ...............................................'
|
||||
flush(IO_STDOUT)
|
||||
call materialpoint_results(totalIncsCounter,t)
|
||||
endif
|
||||
if (signal) call interface_setSIGUSR1(.false.)
|
||||
call MPI_Allreduce(interface_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
|
||||
if (signal) call signals_setSIGUSR1(.false.)
|
||||
call MPI_Allreduce(signals_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
|
||||
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
|
||||
if (mod(inc,loadCases(l)%f_restart) == 0 .or. signal) then
|
||||
do field = 1, nActiveFields
|
||||
|
@ -469,8 +470,8 @@ program DAMASK_grid
|
|||
end do
|
||||
call materialpoint_restartWrite
|
||||
endif
|
||||
if (signal) call interface_setSIGUSR2(.false.)
|
||||
call MPI_Allreduce(interface_SIGTERM,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
|
||||
if (signal) call signals_setSIGUSR2(.false.)
|
||||
call MPI_Allreduce(signals_SIGTERM,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
|
||||
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
|
||||
if (signal) exit loadCaseLooping
|
||||
endif skipping
|
||||
|
|
|
@ -15,7 +15,7 @@ module discretization_grid
|
|||
use parallelization
|
||||
use system_routines
|
||||
use VTI
|
||||
use DAMASK_interface
|
||||
use CLI
|
||||
use IO
|
||||
use config
|
||||
use results
|
||||
|
@ -76,14 +76,14 @@ subroutine discretization_grid_init(restart)
|
|||
|
||||
|
||||
if (worldrank == 0) then
|
||||
fileContent = IO_read(interface_geomFile)
|
||||
fileContent = IO_read(CLI_geomFile)
|
||||
call VTI_readCellsSizeOrigin(cells,geomSize,origin,fileContent)
|
||||
materialAt_global = VTI_readDataset_int(fileContent,'material') + 1
|
||||
if (any(materialAt_global < 1)) &
|
||||
call IO_error(180,ext_msg='material ID < 1')
|
||||
if (size(materialAt_global) /= product(cells)) &
|
||||
call IO_error(180,ext_msg='mismatch in # of material IDs and cells')
|
||||
fname = interface_geomFile
|
||||
fname = CLI_geomFile
|
||||
if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:)
|
||||
call results_openJobFile(parallel=.false.)
|
||||
call results_writeDataset_str(fileContent,'setup',fname,'geometry definition (grid solver)')
|
||||
|
@ -329,7 +329,7 @@ function discretization_grid_getInitialCondition(label) result(ic)
|
|||
displs, sendcounts
|
||||
|
||||
if (worldrank == 0) then
|
||||
ic_global = VTI_readDataset_real(IO_read(interface_geomFile),label)
|
||||
ic_global = VTI_readDataset_real(IO_read(CLI_geomFile),label)
|
||||
else
|
||||
allocate(ic_global(0)) ! needed for IntelMPI
|
||||
endif
|
||||
|
|
|
@ -15,7 +15,7 @@ module grid_mechanical_FEM
|
|||
|
||||
use prec
|
||||
use parallelization
|
||||
use DAMASK_interface
|
||||
use CLI
|
||||
use IO
|
||||
use HDF5
|
||||
use HDF5_utilities
|
||||
|
@ -231,8 +231,8 @@ subroutine grid_mechanical_FEM_init
|
|||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! init fields
|
||||
restartRead: if (interface_restartInc > 0) then
|
||||
print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file'
|
||||
restartRead: if (CLI_restartInc > 0) then
|
||||
print'(/,1x,a,i0,a)', 'reading restart data of increment ', CLI_restartInc, ' from file'
|
||||
|
||||
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
|
||||
groupHandle = HDF5_openGroup(fileHandle,'solver')
|
||||
|
@ -254,7 +254,7 @@ subroutine grid_mechanical_FEM_init
|
|||
call HDF5_read(u_current,groupHandle,'u')
|
||||
call HDF5_read(u_lastInc,groupHandle,'u_lastInc')
|
||||
|
||||
elseif (interface_restartInc == 0) then restartRead
|
||||
elseif (CLI_restartInc == 0) then restartRead
|
||||
F_lastInc = spread(spread(spread(math_I3,3,cells(1)),4,cells(2)),5,cells3) ! initialize to identity
|
||||
F = spread(spread(spread(math_I3,3,cells(1)),4,cells(2)),5,cells3)
|
||||
endif restartRead
|
||||
|
@ -269,8 +269,8 @@ subroutine grid_mechanical_FEM_init
|
|||
call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc)
|
||||
CHKERRQ(err_PETSc)
|
||||
|
||||
restartRead2: if (interface_restartInc > 0) then
|
||||
print'(1x,a,i0,a)', 'reading more restart data of increment ', interface_restartInc, ' from file'
|
||||
restartRead2: if (CLI_restartInc > 0) then
|
||||
print'(1x,a,i0,a)', 'reading more restart data of increment ', CLI_restartInc, ' from file'
|
||||
call HDF5_read(C_volAvg,groupHandle,'C_volAvg',.false.)
|
||||
call MPI_Bcast(C_volAvg,81_MPI_INTEGER_KIND,MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI)
|
||||
if(err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
|
||||
|
|
|
@ -15,7 +15,7 @@ module grid_mechanical_spectral_basic
|
|||
|
||||
use prec
|
||||
use parallelization
|
||||
use DAMASK_interface
|
||||
use CLI
|
||||
use IO
|
||||
use HDF5
|
||||
use HDF5_utilities
|
||||
|
@ -201,8 +201,8 @@ subroutine grid_mechanical_spectral_basic_init
|
|||
call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) ! places pointer on PETSc data
|
||||
CHKERRQ(err_PETSc)
|
||||
|
||||
restartRead: if (interface_restartInc > 0) then
|
||||
print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file'
|
||||
restartRead: if (CLI_restartInc > 0) then
|
||||
print'(/,1x,a,i0,a)', 'reading restart data of increment ', CLI_restartInc, ' from file'
|
||||
|
||||
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
|
||||
groupHandle = HDF5_openGroup(fileHandle,'solver')
|
||||
|
@ -222,7 +222,7 @@ subroutine grid_mechanical_spectral_basic_init
|
|||
call HDF5_read(F,groupHandle,'F')
|
||||
call HDF5_read(F_lastInc,groupHandle,'F_lastInc')
|
||||
|
||||
elseif (interface_restartInc == 0) then restartRead
|
||||
elseif (CLI_restartInc == 0) then restartRead
|
||||
F_lastInc = spread(spread(spread(math_I3,3,cells(1)),4,cells(2)),5,cells3) ! initialize to identity
|
||||
F = reshape(F_lastInc,[9,cells(1),cells(2),cells3])
|
||||
end if restartRead
|
||||
|
@ -235,8 +235,8 @@ subroutine grid_mechanical_spectral_basic_init
|
|||
call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) ! deassociate pointer
|
||||
CHKERRQ(err_PETSc)
|
||||
|
||||
restartRead2: if (interface_restartInc > 0) then
|
||||
print'(1x,a,i0,a)', 'reading more restart data of increment ', interface_restartInc, ' from file'
|
||||
restartRead2: if (CLI_restartInc > 0) then
|
||||
print'(1x,a,i0,a)', 'reading more restart data of increment ', CLI_restartInc, ' from file'
|
||||
call HDF5_read(C_volAvg,groupHandle,'C_volAvg',.false.)
|
||||
call MPI_Bcast(C_volAvg,81_MPI_INTEGER_KIND,MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI)
|
||||
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
|
||||
|
|
|
@ -15,7 +15,7 @@ module grid_mechanical_spectral_polarisation
|
|||
|
||||
use prec
|
||||
use parallelization
|
||||
use DAMASK_interface
|
||||
use CLI
|
||||
use IO
|
||||
use HDF5
|
||||
use HDF5_utilities
|
||||
|
@ -223,8 +223,8 @@ subroutine grid_mechanical_spectral_polarisation_init
|
|||
F => FandF_tau(0: 8,:,:,:)
|
||||
F_tau => FandF_tau(9:17,:,:,:)
|
||||
|
||||
restartRead: if (interface_restartInc > 0) then
|
||||
print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file'
|
||||
restartRead: if (CLI_restartInc > 0) then
|
||||
print'(/,1x,a,i0,a)', 'reading restart data of increment ', CLI_restartInc, ' from file'
|
||||
|
||||
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
|
||||
groupHandle = HDF5_openGroup(fileHandle,'solver')
|
||||
|
@ -246,7 +246,7 @@ subroutine grid_mechanical_spectral_polarisation_init
|
|||
call HDF5_read(F_tau,groupHandle,'F_tau')
|
||||
call HDF5_read(F_tau_lastInc,groupHandle,'F_tau_lastInc')
|
||||
|
||||
elseif (interface_restartInc == 0) then restartRead
|
||||
elseif (CLI_restartInc == 0) then restartRead
|
||||
F_lastInc = spread(spread(spread(math_I3,3,cells(1)),4,cells(2)),5,cells3) ! initialize to identity
|
||||
F = reshape(F_lastInc,[9,cells(1),cells(2),cells3])
|
||||
F_tau = 2.0_pReal*F
|
||||
|
@ -261,8 +261,8 @@ subroutine grid_mechanical_spectral_polarisation_init
|
|||
call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) ! deassociate pointer
|
||||
CHKERRQ(err_PETSc)
|
||||
|
||||
restartRead2: if (interface_restartInc > 0) then
|
||||
print'(1x,a,i0,a)', 'reading more restart data of increment ', interface_restartInc, ' from file'
|
||||
restartRead2: if (CLI_restartInc > 0) then
|
||||
print'(1x,a,i0,a)', 'reading more restart data of increment ', CLI_restartInc, ' from file'
|
||||
call HDF5_read(C_volAvg,groupHandle,'C_volAvg',.false.)
|
||||
call MPI_Bcast(C_volAvg,81_MPI_INTEGER_KIND,MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI)
|
||||
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
|
||||
|
|
|
@ -16,7 +16,7 @@ module grid_thermal_spectral
|
|||
use prec
|
||||
use parallelization
|
||||
use IO
|
||||
use DAMASK_interface
|
||||
use CLI
|
||||
use HDF5_utilities
|
||||
use HDF5
|
||||
use spectral_utilities
|
||||
|
@ -140,8 +140,8 @@ subroutine grid_thermal_spectral_init()
|
|||
CHKERRQ(err_PETSc)
|
||||
|
||||
|
||||
restartRead: if (interface_restartInc > 0) then
|
||||
print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file'
|
||||
restartRead: if (CLI_restartInc > 0) then
|
||||
print'(/,1x,a,i0,a)', 'reading restart data of increment ', CLI_restartInc, ' from file'
|
||||
|
||||
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
|
||||
groupHandle = HDF5_openGroup(fileHandle,'solver')
|
||||
|
|
|
@ -13,7 +13,7 @@ module spectral_utilities
|
|||
#endif
|
||||
|
||||
use prec
|
||||
use DAMASK_interface
|
||||
use CLI
|
||||
use parallelization
|
||||
use math
|
||||
use rotations
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
module materialpoint2
|
||||
use parallelization
|
||||
use DAMASK_interface
|
||||
use signals
|
||||
use CLI
|
||||
use prec
|
||||
use IO
|
||||
use YAML_types
|
||||
|
@ -21,7 +22,6 @@ module materialpoint2
|
|||
use material
|
||||
use phase
|
||||
use homogenization
|
||||
|
||||
use discretization
|
||||
#if defined(MESH)
|
||||
use FEM_quadrature
|
||||
|
@ -43,7 +43,8 @@ contains
|
|||
subroutine materialpoint_initAll
|
||||
|
||||
call parallelization_init
|
||||
call DAMASK_interface_init ! Spectral and FEM interface to commandline
|
||||
call CLI_init ! Spectral and FEM interface to commandline
|
||||
call signals_init
|
||||
call prec_init
|
||||
call IO_init
|
||||
#if defined(MESH)
|
||||
|
@ -54,18 +55,18 @@ subroutine materialpoint_initAll
|
|||
call YAML_types_init
|
||||
call YAML_parse_init
|
||||
call HDF5_utilities_init
|
||||
call results_init(restart=interface_restartInc>0)
|
||||
call results_init(restart=CLI_restartInc>0)
|
||||
call config_init
|
||||
call math_init
|
||||
call rotations_init
|
||||
call polynomials_init
|
||||
call lattice_init
|
||||
#if defined(MESH)
|
||||
call discretization_mesh_init(restart=interface_restartInc>0)
|
||||
call discretization_mesh_init(restart=CLI_restartInc>0)
|
||||
#elif defined(GRID)
|
||||
call discretization_grid_init(restart=interface_restartInc>0)
|
||||
call discretization_grid_init(restart=CLI_restartInc>0)
|
||||
#endif
|
||||
call material_init(restart=interface_restartInc>0)
|
||||
call material_init(restart=CLI_restartInc>0)
|
||||
call phase_init
|
||||
call homogenization_init
|
||||
call materialpoint_init
|
||||
|
@ -85,7 +86,7 @@ subroutine materialpoint_init
|
|||
print'(/,1x,a)', '<<<+- materialpoint init -+>>>'; flush(IO_STDOUT)
|
||||
|
||||
|
||||
if (interface_restartInc > 0) then
|
||||
if (CLI_restartInc > 0) then
|
||||
print'(/,a,i0,a)', ' reading restart information of increment from file'; flush(IO_STDOUT)
|
||||
|
||||
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
|
||||
|
|
|
@ -10,7 +10,7 @@ program DAMASK_mesh
|
|||
#include <petsc/finclude/petscsys.h>
|
||||
use PetscDM
|
||||
use prec
|
||||
use DAMASK_interface
|
||||
use CLI
|
||||
use parallelization
|
||||
use IO
|
||||
use math
|
||||
|
@ -104,7 +104,7 @@ program DAMASK_mesh
|
|||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! reading basic information from load case file and allocate data structure containing load cases
|
||||
fileContent = IO_readlines(trim(interface_loadFile))
|
||||
fileContent = IO_readlines(trim(CLI_loadFile))
|
||||
do l = 1, size(fileContent)
|
||||
line = fileContent(l)
|
||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
||||
|
|
|
@ -15,7 +15,7 @@ module discretization_mesh
|
|||
use MPI_f08
|
||||
#endif
|
||||
|
||||
use DAMASK_interface
|
||||
use CLI
|
||||
use parallelization
|
||||
use IO
|
||||
use config
|
||||
|
@ -101,9 +101,9 @@ subroutine discretization_mesh_init(restart)
|
|||
debug_ip = config_debug%get_asInt('integrationpoint',defaultVal=1)
|
||||
|
||||
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>16)
|
||||
call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,'n/a',PETSC_TRUE,globalMesh,err_PETSc)
|
||||
call DMPlexCreateFromFile(PETSC_COMM_WORLD,CLI_geomFile,'n/a',PETSC_TRUE,globalMesh,err_PETSc)
|
||||
#else
|
||||
call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,PETSC_TRUE,globalMesh,err_PETSc)
|
||||
call DMPlexCreateFromFile(PETSC_COMM_WORLD,CLI_geomFile,PETSC_TRUE,globalMesh,err_PETSc)
|
||||
#endif
|
||||
CHKERRQ(err_PETSc)
|
||||
call DMGetDimension(globalMesh,dimPlex,err_PETSc)
|
||||
|
|
|
@ -20,7 +20,6 @@ module mesh_mechanical_FEM
|
|||
use FEM_utilities
|
||||
use discretization
|
||||
use discretization_mesh
|
||||
use DAMASK_interface
|
||||
use config
|
||||
use IO
|
||||
use FEM_quadrature
|
||||
|
|
|
@ -6,17 +6,19 @@
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
module results
|
||||
use prec
|
||||
use DAMASK_interface
|
||||
use parallelization
|
||||
use IO
|
||||
use HDF5_utilities
|
||||
use HDF5
|
||||
#ifdef PETSC
|
||||
use CLI
|
||||
#include <petsc/finclude/petscsys.h>
|
||||
use PETScSys
|
||||
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>14) && !defined(PETSC_HAVE_MPI_F90MODULE_VISIBILITY)
|
||||
use MPI_f08
|
||||
#endif
|
||||
#else
|
||||
use DAMASK_interface
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||
!> @brief Handling of UNIX signals.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
module signals
|
||||
use prec
|
||||
use system_routines
|
||||
|
||||
implicit none
|
||||
private
|
||||
|
||||
logical, volatile, public, protected :: &
|
||||
signals_SIGTERM, & !< termination signal
|
||||
signals_SIGUSR1, & !< 1. user-defined signal
|
||||
signals_SIGUSR2 !< 2. user-defined signal
|
||||
|
||||
public :: &
|
||||
signals_init, &
|
||||
signals_setSIGTERM, &
|
||||
signals_setSIGUSR1, &
|
||||
signals_setSIGUSR2
|
||||
|
||||
contains
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Register signal handlers.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine signals_init()
|
||||
|
||||
call signalterm_c(c_funloc(catchSIGTERM))
|
||||
call signalusr1_c(c_funloc(catchSIGUSR1))
|
||||
call signalusr2_c(c_funloc(catchSIGUSR2))
|
||||
call signals_setSIGTERM(.false.)
|
||||
call signals_setSIGUSR1(.false.)
|
||||
call signals_setSIGUSR2(.false.)
|
||||
|
||||
end subroutine signals_init
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable signals_SIGTERM to .true.
|
||||
!> @details This function can be registered to catch signals send to the executable.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine catchSIGTERM(signal) bind(C)
|
||||
|
||||
integer(C_INT), value :: signal
|
||||
|
||||
|
||||
print'(a,i0)', ' received signal ',signal
|
||||
call signals_setSIGTERM(.true.)
|
||||
|
||||
end subroutine catchSIGTERM
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable signals_SIGUSR1 to .true.
|
||||
!> @details This function can be registered to catch signals send to the executable.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine catchSIGUSR1(signal) bind(C)
|
||||
|
||||
integer(C_INT), value :: signal
|
||||
|
||||
|
||||
print'(a,i0)', ' received signal ',signal
|
||||
call signals_setSIGUSR1(.true.)
|
||||
|
||||
end subroutine catchSIGUSR1
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable signals_SIGUSR2 to .true.
|
||||
!> @details This function can be registered to catch signals send to the executable.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine catchSIGUSR2(signal) bind(C)
|
||||
|
||||
integer(C_INT), value :: signal
|
||||
|
||||
|
||||
print'(a,i0,a)', ' received signal ',signal
|
||||
call signals_setSIGUSR2(.true.)
|
||||
|
||||
end subroutine catchSIGUSR2
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable signals_SIGTERM.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine signals_setSIGTERM(state)
|
||||
|
||||
logical, intent(in) :: state
|
||||
|
||||
|
||||
signals_SIGTERM = state
|
||||
print*, 'set SIGTERM to',state
|
||||
|
||||
end subroutine signals_setSIGTERM
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable signals_SIGUSR.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine signals_setSIGUSR1(state)
|
||||
|
||||
logical, intent(in) :: state
|
||||
|
||||
|
||||
signals_SIGUSR1 = state
|
||||
print*, 'set SIGUSR1 to',state
|
||||
|
||||
end subroutine signals_setSIGUSR1
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Set global variable signals_SIGUSR2.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine signals_setSIGUSR2(state)
|
||||
|
||||
logical, intent(in) :: state
|
||||
|
||||
|
||||
signals_SIGUSR2 = state
|
||||
print*, 'set SIGUSR2 to',state
|
||||
|
||||
end subroutine signals_setSIGUSR2
|
||||
|
||||
|
||||
end module signals
|
Loading…
Reference in New Issue