prefix to global variables increases readability
This commit is contained in:
parent
b499578a95
commit
38a4118dc5
|
@ -25,21 +25,21 @@ module DAMASK_interface
|
||||||
implicit none
|
implicit none
|
||||||
private
|
private
|
||||||
logical, volatile, public, protected :: &
|
logical, volatile, public, protected :: &
|
||||||
SIGTERM, & !< termination signal
|
interface_SIGTERM, & !< termination signal
|
||||||
SIGUSR1, & !< 1. user-defined signal
|
interface_SIGUSR1, & !< 1. user-defined signal
|
||||||
SIGUSR2 !< 2. user-defined signal
|
interface_SIGUSR2 !< 2. user-defined signal
|
||||||
integer, public, protected :: &
|
integer, public, protected :: &
|
||||||
interface_restartInc = 0 !< Increment at which calculation starts
|
interface_restartInc = 0 !< Increment at which calculation starts
|
||||||
character(len=:), allocatable, public, protected :: &
|
character(len=:), allocatable, public, protected :: &
|
||||||
geometryFile, & !< parameter given for geometry file
|
interface_geomFile, & !< parameter given for geometry file
|
||||||
loadCaseFile !< parameter given for load case file
|
interface_loadFile !< parameter given for load case file
|
||||||
|
|
||||||
public :: &
|
public :: &
|
||||||
getSolverJobName, &
|
getSolverJobName, &
|
||||||
DAMASK_interface_init, &
|
DAMASK_interface_init, &
|
||||||
setSIGTERM, &
|
interface_setSIGTERM, &
|
||||||
setSIGUSR1, &
|
interface_setSIGUSR1, &
|
||||||
setSIGUSR2
|
interface_setSIGUSR2
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
|
@ -186,8 +186,8 @@ subroutine DAMASK_interface_init
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (len_trim(workingDirArg) > 0) call setWorkingDirectory(trim(workingDirArg))
|
if (len_trim(workingDirArg) > 0) call setWorkingDirectory(trim(workingDirArg))
|
||||||
geometryFile = getGeometryFile(geometryArg)
|
interface_geomFile = getGeometryFile(geometryArg)
|
||||||
loadCaseFile = getLoadCaseFile(loadCaseArg)
|
interface_loadFile = getLoadCaseFile(loadCaseArg)
|
||||||
|
|
||||||
call get_command(commandLine)
|
call get_command(commandLine)
|
||||||
call get_environment_variable('USER',userName)
|
call get_environment_variable('USER',userName)
|
||||||
|
@ -202,8 +202,8 @@ subroutine DAMASK_interface_init
|
||||||
write(6,'(a,a)') ' Geometry argument: ', trim(geometryArg)
|
write(6,'(a,a)') ' Geometry argument: ', trim(geometryArg)
|
||||||
write(6,'(a,a)') ' Load case argument: ', trim(loadcaseArg)
|
write(6,'(a,a)') ' Load case argument: ', trim(loadcaseArg)
|
||||||
write(6,'(a,a)') ' Working directory: ', getCWD()
|
write(6,'(a,a)') ' Working directory: ', getCWD()
|
||||||
write(6,'(a,a)') ' Geometry file: ', geometryFile
|
write(6,'(a,a)') ' Geometry file: ', interface_geomFile
|
||||||
write(6,'(a,a)') ' Loadcase file: ', loadCaseFile
|
write(6,'(a,a)') ' Loadcase file: ', interface_loadFile
|
||||||
write(6,'(a,a)') ' Solver job name: ', getSolverJobName()
|
write(6,'(a,a)') ' Solver job name: ', getSolverJobName()
|
||||||
if (interface_restartInc > 0) &
|
if (interface_restartInc > 0) &
|
||||||
write(6,'(a,i6.6)') ' Restart from increment: ', interface_restartInc
|
write(6,'(a,i6.6)') ' Restart from increment: ', interface_restartInc
|
||||||
|
@ -211,9 +211,9 @@ subroutine DAMASK_interface_init
|
||||||
!call signalterm_c(c_funloc(catchSIGTERM))
|
!call signalterm_c(c_funloc(catchSIGTERM))
|
||||||
call signalusr1_c(c_funloc(catchSIGUSR1))
|
call signalusr1_c(c_funloc(catchSIGUSR1))
|
||||||
call signalusr2_c(c_funloc(catchSIGUSR2))
|
call signalusr2_c(c_funloc(catchSIGUSR2))
|
||||||
call setSIGTERM(.false.)
|
call interface_setSIGTERM(.false.)
|
||||||
call setSIGUSR1(.false.)
|
call interface_setSIGUSR1(.false.)
|
||||||
call setSIGUSR2(.false.)
|
call interface_setSIGUSR2(.false.)
|
||||||
|
|
||||||
end subroutine DAMASK_interface_init
|
end subroutine DAMASK_interface_init
|
||||||
|
|
||||||
|
@ -254,15 +254,15 @@ function getSolverJobName()
|
||||||
character(len=:), allocatable :: getSolverJobName
|
character(len=:), allocatable :: getSolverJobName
|
||||||
integer :: posExt,posSep
|
integer :: posExt,posSep
|
||||||
|
|
||||||
posExt = scan(geometryFile,'.',back=.true.)
|
posExt = scan(interface_geomFile,'.',back=.true.)
|
||||||
posSep = scan(geometryFile,'/',back=.true.)
|
posSep = scan(interface_geomFile,'/',back=.true.)
|
||||||
|
|
||||||
getSolverJobName = geometryFile(posSep+1:posExt-1)
|
getSolverJobName = interface_geomFile(posSep+1:posExt-1)
|
||||||
|
|
||||||
posExt = scan(loadCaseFile,'.',back=.true.)
|
posExt = scan(interface_loadFile,'.',back=.true.)
|
||||||
posSep = scan(loadCaseFile,'/',back=.true.)
|
posSep = scan(interface_loadFile,'/',back=.true.)
|
||||||
|
|
||||||
getSolverJobName = getSolverJobName//'_'//loadCaseFile(posSep+1:posExt-1)
|
getSolverJobName = getSolverJobName//'_'//interface_loadFile(posSep+1:posExt-1)
|
||||||
|
|
||||||
end function getSolverJobName
|
end function getSolverJobName
|
||||||
|
|
||||||
|
@ -389,75 +389,78 @@ end function makeRelativePath
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief sets global variable SIGTERM to .true.
|
!> @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)
|
subroutine catchSIGTERM(signal) bind(C)
|
||||||
|
|
||||||
integer(C_INT), value :: signal
|
integer(C_INT), value :: signal
|
||||||
SIGTERM = .true.
|
interface_SIGTERM = .true.
|
||||||
|
|
||||||
write(6,'(a,i2.2,a)') ' received signal ',signal, ', set SIGTERM'
|
write(6,'(a,i2.2,a)') ' received signal ',signal, ', set SIGTERM=TRUE'
|
||||||
|
|
||||||
end subroutine catchSIGTERM
|
end subroutine catchSIGTERM
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief sets global variable SIGTERM
|
!> @brief Set global variable interface_SIGTERM.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine setSIGTERM(state)
|
subroutine interface_setSIGTERM(state)
|
||||||
|
|
||||||
logical, intent(in) :: state
|
logical, intent(in) :: state
|
||||||
SIGTERM = state
|
interface_SIGTERM = state
|
||||||
|
|
||||||
end subroutine setSIGTERM
|
end subroutine interface_setSIGTERM
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief sets global variable SIGUSR1 to .true.
|
!> @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)
|
subroutine catchSIGUSR1(signal) bind(C)
|
||||||
|
|
||||||
integer(C_INT), value :: signal
|
integer(C_INT), value :: signal
|
||||||
SIGUSR1 = .true.
|
interface_SIGUSR1 = .true.
|
||||||
|
|
||||||
write(6,'(a,i2.2,a)') ' received signal ',signal, ', set SIGUSR1'
|
write(6,'(a,i2.2,a)') ' received signal ',signal, ', set SIGUSR1=TRUE'
|
||||||
|
|
||||||
end subroutine catchSIGUSR1
|
end subroutine catchSIGUSR1
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief sets global variable SIGUSR1
|
!> @brief Set global variable interface_SIGUSR.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine setSIGUSR1(state)
|
subroutine interface_setSIGUSR1(state)
|
||||||
|
|
||||||
logical, intent(in) :: state
|
logical, intent(in) :: state
|
||||||
SIGUSR1 = state
|
interface_SIGUSR1 = state
|
||||||
|
|
||||||
end subroutine setSIGUSR1
|
end subroutine interface_setSIGUSR1
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief sets global variable SIGUSR2 to .true. if program receives SIGUSR2
|
!> @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)
|
subroutine catchSIGUSR2(signal) bind(C)
|
||||||
|
|
||||||
integer(C_INT), value :: signal
|
integer(C_INT), value :: signal
|
||||||
SIGUSR2 = .true.
|
interface_SIGUSR2 = .true.
|
||||||
|
|
||||||
write(6,'(a,i2.2,a)') ' received signal ',signal, ', set SIGUSR2'
|
write(6,'(a,i2.2,a)') ' received signal ',signal, ', set SIGUSR2=TRUE'
|
||||||
|
|
||||||
end subroutine catchSIGUSR2
|
end subroutine catchSIGUSR2
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief sets global variable SIGUSR2
|
!> @brief Set global variable interface_SIGUSR2.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine setSIGUSR2(state)
|
subroutine interface_setSIGUSR2(state)
|
||||||
|
|
||||||
logical, intent(in) :: state
|
logical, intent(in) :: state
|
||||||
SIGUSR2 = state
|
interface_SIGUSR2 = state
|
||||||
|
|
||||||
end subroutine setSIGUSR2
|
end subroutine interface_setSIGUSR2
|
||||||
|
|
||||||
|
|
||||||
end module
|
end module
|
||||||
|
|
|
@ -159,7 +159,7 @@ program DAMASK_grid
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! reading information from load case file and to sanity checks
|
! reading information from load case file and to sanity checks
|
||||||
fileContent = IO_readlines(trim(loadCaseFile))
|
fileContent = IO_readlines(trim(interface_loadFile))
|
||||||
if(size(fileContent) == 0) call IO_error(307,ext_msg='No load case specified')
|
if(size(fileContent) == 0) call IO_error(307,ext_msg='No load case specified')
|
||||||
|
|
||||||
allocate (loadCases(0)) ! array of load cases
|
allocate (loadCases(0)) ! array of load cases
|
||||||
|
@ -179,7 +179,7 @@ program DAMASK_grid
|
||||||
end select
|
end select
|
||||||
enddo
|
enddo
|
||||||
if ((N_def /= N_n) .or. (N_n /= N_t) .or. N_n < 1) & ! sanity check
|
if ((N_def /= N_n) .or. (N_n /= N_t) .or. N_n < 1) & ! sanity check
|
||||||
call IO_error(error_ID=837,el=currentLoadCase,ext_msg = trim(loadCaseFile)) ! error message for incomplete loadcase
|
call IO_error(error_ID=837,el=currentLoadCase,ext_msg = trim(interface_loadFile)) ! error message for incomplete loadcase
|
||||||
|
|
||||||
newLoadCase%stress%myType='stress'
|
newLoadCase%stress%myType='stress'
|
||||||
field = 1
|
field = 1
|
||||||
|
|
|
@ -67,7 +67,7 @@ subroutine discretization_grid_init(restart)
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- discretization_grid init -+>>>'; flush(6)
|
write(6,'(/,a)') ' <<<+- discretization_grid init -+>>>'; flush(6)
|
||||||
|
|
||||||
if(index(geometryFile,'.vtr') /= 0) then
|
if(index(interface_geomFile,'.vtr') /= 0) then
|
||||||
call readVTR(grid,geomSize,origin,microstructureAt)
|
call readVTR(grid,geomSize,origin,microstructureAt)
|
||||||
else
|
else
|
||||||
call readGeom(grid,geomSize,origin,microstructureAt)
|
call readGeom(grid,geomSize,origin,microstructureAt)
|
||||||
|
@ -173,10 +173,10 @@ subroutine readGeom(grid,geomSize,origin,microstructure)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! read raw data as stream
|
! read raw data as stream
|
||||||
inquire(file = trim(geometryFile), size=fileLength)
|
inquire(file = trim(interface_geomFile), size=fileLength)
|
||||||
open(newunit=fileUnit, file=trim(geometryFile), access='stream',&
|
open(newunit=fileUnit, file=trim(interface_geomFile), access='stream',&
|
||||||
status='old', position='rewind', action='read',iostat=myStat)
|
status='old', position='rewind', action='read',iostat=myStat)
|
||||||
if(myStat /= 0) call IO_error(100,ext_msg=trim(geometryFile))
|
if(myStat /= 0) call IO_error(100,ext_msg=trim(interface_geomFile))
|
||||||
allocate(character(len=fileLength)::rawData)
|
allocate(character(len=fileLength)::rawData)
|
||||||
read(fileUnit) rawData
|
read(fileUnit) rawData
|
||||||
close(fileUnit)
|
close(fileUnit)
|
||||||
|
@ -327,10 +327,10 @@ subroutine readVTR(grid,geomSize,origin,microstructure)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! read raw data as stream
|
! read raw data as stream
|
||||||
inquire(file = trim(geometryFile), size=fileLength)
|
inquire(file = trim(interface_geomFile), size=fileLength)
|
||||||
open(newunit=fileUnit, file=trim(geometryFile), access='stream',&
|
open(newunit=fileUnit, file=trim(interface_geomFile), access='stream',&
|
||||||
status='old', position='rewind', action='read',iostat=myStat)
|
status='old', position='rewind', action='read',iostat=myStat)
|
||||||
if(myStat /= 0) call IO_error(100,ext_msg=trim(geometryFile))
|
if(myStat /= 0) call IO_error(100,ext_msg=trim(interface_geomFile))
|
||||||
allocate(character(len=fileLength)::fileContent)
|
allocate(character(len=fileLength)::fileContent)
|
||||||
read(fileUnit) fileContent
|
read(fileUnit) fileContent
|
||||||
close(fileUnit)
|
close(fileUnit)
|
||||||
|
|
|
@ -96,7 +96,7 @@ program DAMASK_mesh
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! reading basic information from load case file and allocate data structure containing load cases
|
! reading basic information from load case file and allocate data structure containing load cases
|
||||||
fileContent = IO_read_ASCII(trim(loadCaseFile))
|
fileContent = IO_readline(trim(interface_loadFile))
|
||||||
do l = 1, size(fileContent)
|
do l = 1, size(fileContent)
|
||||||
line = fileContent(l)
|
line = fileContent(l)
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
||||||
|
|
|
@ -96,7 +96,7 @@ subroutine discretization_mesh_init(restart)
|
||||||
debug_ip = debug_root%get_asInt('integrationpoint',defaultVal=1)
|
debug_ip = debug_root%get_asInt('integrationpoint',defaultVal=1)
|
||||||
|
|
||||||
|
|
||||||
call DMPlexCreateFromFile(PETSC_COMM_WORLD,geometryFile,PETSC_TRUE,globalMesh,ierr)
|
call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,PETSC_TRUE,globalMesh,ierr)
|
||||||
CHKERRQ(ierr)
|
CHKERRQ(ierr)
|
||||||
call DMGetDimension(globalMesh,dimPlex,ierr)
|
call DMGetDimension(globalMesh,dimPlex,ierr)
|
||||||
CHKERRQ(ierr)
|
CHKERRQ(ierr)
|
||||||
|
@ -124,7 +124,7 @@ subroutine discretization_mesh_init(restart)
|
||||||
call MPI_Bcast(mesh_boundaries,mesh_Nboundaries,MPI_INTEGER,0,PETSC_COMM_WORLD,ierr)
|
call MPI_Bcast(mesh_boundaries,mesh_Nboundaries,MPI_INTEGER,0,PETSC_COMM_WORLD,ierr)
|
||||||
|
|
||||||
if (worldrank == 0) then
|
if (worldrank == 0) then
|
||||||
fileContent = IO_readlines(geometryFile)
|
fileContent = IO_readlines(interface_geomFile)
|
||||||
l = 0
|
l = 0
|
||||||
do
|
do
|
||||||
l = l + 1
|
l = l + 1
|
||||||
|
|
Loading…
Reference in New Issue