Merge branch 'development' into long-YAML-files

This commit is contained in:
Martin Diehl 2023-02-14 17:33:48 +01:00
commit 3eb9545573
27 changed files with 67 additions and 326 deletions

View File

@ -1 +1 @@
3.0.0-alpha7-389-g4ae3274ac
3.0.0-alpha7-395-gb4e706f09

View File

@ -1,12 +0,0 @@
phase: [basic, extensive, selective]
materialpoint: [basic, extensive, selective]
# options for selective debugging
element: 1
integrationpoint: 1
constituent: 1
# solver-specific
mesh: [PETSc]
grid: [basic, rotation, PETSc]
Marc: [basic]

View File

@ -130,7 +130,7 @@ subroutine CLI_init
print'(a)', ' Make sure the file "material.yaml" exists in the working'
print'(a)', ' directory.'
print'(a)', ' For further configuration place "numerics.yaml"'
print'(a)',' and "debug.yaml" in that directory.'
print'(a)',' in that directory.'
print'(/,a)',' --restart N'
print'(a)', ' Reads in increment N and continues with calculating'
print'(a)', ' increment N+1, N+2, ... based on this.'

View File

@ -484,8 +484,6 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2)
!--------------------------------------------------------------------------------------------------
! user errors
case (602)
msg = 'invalid selection for debug'
case (603)
msg = 'invalid data for table'

View File

@ -282,34 +282,15 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
logical, save :: &
lastIncConverged = .false., & !< needs description
outdatedByNewInc = .false., & !< needs description
materialpoint_init_done = .false., & !< remember whether init has been done already
debug_basic = .true.
type(tList), pointer :: &
debug_Marc ! pointer to Marc debug options
materialpoint_init_done = .false. !< remember whether init has been done already
if (debug_basic) then
print'(a,/,i8,i8,i2)', ' MSC.Marc information on shape of element(2), IP:', m, nn
print'(a,2(i1))', ' Jacobian: ', ngens,ngens
print'(a,i1)', ' Direct stress: ', ndi
print'(a,i1)', ' Shear stress: ', nshear
print'(a,i2)', ' DoF: ', ndeg
print'(a,i2)', ' Coordinates: ', ncrd
print'(a,i12)', ' Nodes: ', nnode
print'(a,i1)', ' Deformation gradient: ', itel
write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' Deformation gradient at t=n:', &
transpose(ffn)
write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' Deformation gradient at t=n+1:', &
transpose(ffn1)
end if
defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc
call omp_set_num_threads(1_pI32) ! no openMP
if (.not. materialpoint_init_done) then
materialpoint_init_done = .true.
call materialpoint_initAll
debug_Marc => config_debug%get_list('Marc',defaultVal=emptyList)
debug_basic = debug_Marc%contains('basic')
call materialpoint_initAll()
end if
computationMode = 0 ! save initialization value, since it does not result in any calculation

View File

@ -59,8 +59,7 @@ subroutine discretization_Marc_init
integer, dimension(:), allocatable :: &
materialAt
integer:: &
Nelems, & !< total number of elements in the mesh
debug_e, debug_i
Nelems !< total number of elements in the mesh
real(pReal), dimension(:,:), allocatable :: &
IP_reshaped
@ -75,9 +74,6 @@ subroutine discretization_Marc_init
print'(/,a)', ' <<<+- discretization_Marc init -+>>>'; flush(6)
debug_e = config_debug%get_asInt('element',defaultVal=1)
debug_i = config_debug%get_asInt('integrationpoint',defaultVal=1)
num_commercialFEM => config_numerics%get_dict('commercialFEM',defaultVal = emptyDict)
mesh_unitlength = num_commercialFEM%get_asFloat('unitlength',defaultVal=1.0_pReal) ! set physical extent of a length unit in mesh
if (mesh_unitlength <= 0.0_pReal) call IO_error(301,'unitlength')
@ -85,9 +81,6 @@ subroutine discretization_Marc_init
call inputRead(elem,node0_elem,connectivity_elem,materialAt)
nElems = size(connectivity_elem,2)
if (debug_e < 1 .or. debug_e > nElems) call IO_error(602,'element')
if (debug_i < 1 .or. debug_i > elem%nIPs) call IO_error(602,'IP')
allocate(cellNodeDefinition(elem%nNodes-1))
allocate(connectivity_cell(elem%NcellNodesPerCell,elem%nIPs,nElems))

View File

@ -50,18 +50,6 @@ module materialpoint_Marc
type(tNumerics), private :: num
type, private :: tDebugOptions
logical :: &
basic, &
extensive, &
selective
integer:: &
element, &
ip
end type tDebugOptions
type(tDebugOptions), private :: debugmaterialpoint
public :: &
materialpoint_general, &
materialpoint_initAll, &
@ -99,36 +87,16 @@ end subroutine materialpoint_initAll
!--------------------------------------------------------------------------------------------------
!> @brief allocate the arrays defined in module materialpoint and initialize them
!> @brief Allocate the arrays defined in module materialpoint and initialize them.
!--------------------------------------------------------------------------------------------------
subroutine materialpoint_init()
type(tList), pointer :: &
debug_materialpoint
print'(/,1x,a)', '<<<+- materialpoint init -+>>>'; flush(IO_STDOUT)
allocate(materialpoint_cs( 6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
allocate(materialpoint_dcsdE( 6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
allocate(materialpoint_dcsdE_knownGood(6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
!------------------------------------------------------------------------------
! read debug options
debug_materialpoint => config_debug%get_list('materialpoint',defaultVal=emptyList)
debugmaterialpoint%basic = debug_materialpoint%contains('basic')
debugmaterialpoint%extensive = debug_materialpoint%contains('extensive')
debugmaterialpoint%selective = debug_materialpoint%contains('selective')
debugmaterialpoint%element = config_debug%get_asInt('element',defaultVal = 1)
debugmaterialpoint%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1)
if (debugmaterialpoint%basic) then
print'(a32,1x,6(i8,1x))', 'materialpoint_cs: ', shape(materialpoint_cs)
print'(a32,1x,6(i8,1x))', 'materialpoint_dcsdE: ', shape(materialpoint_dcsdE)
print'(a32,1x,6(i8,1x),/)', 'materialpoint_dcsdE_knownGood: ', shape(materialpoint_dcsdE_knownGood)
flush(IO_STDOUT)
end if
end subroutine materialpoint_init
@ -164,16 +132,6 @@ subroutine materialpoint_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip,
elCP = discretization_Marc_FEM2DAMASK_elem(elFE)
ce = discretization_Marc_FEM2DAMASK_cell(ip,elFE)
if (debugmaterialpoint%basic .and. elCP == debugmaterialpoint%element .and. ip == debugmaterialpoint%ip) then
print'(/,a)', '#############################################'
print'(a1,a22,1x,i8,a13)', '#','element', elCP, '#'
print'(a1,a22,1x,i8,a13)', '#','ip', ip, '#'
print'(a1,a22,1x,i8,a13)', '#','cycleCounter', cycleCounter, '#'
print'(a1,a22,1x,i8,a13)', '#','computationMode',mode, '#'
if (terminallyIll) &
print'(a,/)', '# --- terminallyIll --- #'
print'(a,/)', '#############################################'; flush (6)
end if
if (iand(mode, materialpoint_BACKUPJACOBIAN) /= 0) &
materialpoint_dcsde_knownGood = materialpoint_dcsde
@ -194,7 +152,6 @@ subroutine materialpoint_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip,
materialpoint_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6)
else validCalculation
if (debugmaterialpoint%extensive) print'(a,i8,1x,i2)', '<< materialpoint >> calculation for elFE ip ',elFE,ip
call homogenization_mechanical_response(dt,(elCP-1)*discretization_nIPs + ip,(elCP-1)*discretization_nIPs + ip)
if (.not. terminallyIll) &
call homogenization_mechanical_response2(dt,[ip,ip],[elCP,elCP])
@ -232,15 +189,6 @@ subroutine materialpoint_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip,
end if terminalIllness
end if validCalculation
if (debugmaterialpoint%extensive &
.and. ((debugmaterialpoint%element == elCP .and. debugmaterialpoint%ip == ip) .or. .not. debugmaterialpoint%selective)) then
print'(a,i8,1x,i2,/,12x,6(f10.3,1x)/)', &
'<< materialpoint >> stress/MPa at elFE ip ', elFE, ip, materialpoint_cs(1:6,ip,elCP)*1.0e-6_pReal
print'(a,i8,1x,i2,/,6(12x,6(f10.3,1x)/))', &
'<< materialpoint >> Jacobian/GPa at elFE ip ', elFE, ip, transpose(materialpoint_dcsdE(1:6,1:6,ip,elCP))*1.0e-9_pReal
flush(IO_STDOUT)
end if
end if
if (all(abs(materialpoint_dcsdE(1:6,1:6,ip,elCP)) < 1e-10_pReal)) &

View File

@ -473,7 +473,7 @@ end subroutine list_item_inline
!--------------------------------------------------------------------------------------------------
! @brief reads a line of YAML block which is already in flow style
! @details Dicts should be enlcosed within '{}' for it to be consistent with DAMASK YAML parser
! @details A dict should be enclosed within '{}' for it to be consistent with the DAMASK YAML parser
!--------------------------------------------------------------------------------------------------
recursive subroutine line_isFlow(flow,s_flow,line)
@ -591,7 +591,7 @@ end subroutine line_toFlow
! @details enters the function when encountered with the list indicator '- '
! reads each scalar list item and separates each other with a ','
! If list item is non scalar, it stores the offset for that list item block
! Increase in the indentation level or when list item is not scalar -> 'decide' function is called.
! Call the 'decide' function if there is an increase in the indentation level or the list item is not a scalar
! decrease in indentation level indicates the end of an indentation block
!-------------------------------------------------------------------------------------------------
recursive subroutine lst(blck,flow,s_blck,s_flow,offset)

View File

@ -1,6 +1,6 @@
!--------------------------------------------------------------------------------------------------
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Read in the configuration of material, numerics, and debug from their respective file
!> @brief Read in the material and numerics configuration from their respective file.
!--------------------------------------------------------------------------------------------------
module config
use IO
@ -14,8 +14,7 @@ module config
type(tDict), pointer, public :: &
config_material, &
config_numerics, &
config_debug
config_numerics
public :: &
config_init, &
@ -24,7 +23,7 @@ module config
contains
!--------------------------------------------------------------------------------------------------
!> @brief Real *.yaml configuration files.
!> @brief Read *.yaml configuration files.
!--------------------------------------------------------------------------------------------------
subroutine config_init()
@ -32,7 +31,6 @@ subroutine config_init()
call parse_material()
call parse_numerics()
call parse_debug()
end subroutine config_init
@ -95,41 +93,9 @@ subroutine parse_numerics()
end subroutine parse_numerics
!--------------------------------------------------------------------------------------------------
!> @brief Read debug.yaml.
!--------------------------------------------------------------------------------------------------
subroutine parse_debug()
logical :: fileExists
character(len=:), allocatable :: fileContent
config_debug => emptyDict
inquire(file='debug.yaml', exist=fileExists)
if (fileExists) then
if (worldrank == 0) then
print'(1x,a)', 'reading debug.yaml'; flush(IO_STDOUT)
fileContent = IO_read('debug.yaml')
if (len(fileContent) > 0) then
call result_openJobFile(parallel=.false.)
call result_writeDataset_str(fileContent,'setup','debug.yaml','debug configuration')
call result_closeJobFile
end if
end if
call parallelization_bcast_str(fileContent)
config_debug => YAML_parse_str_asDict(fileContent)
end if
end subroutine parse_debug
!--------------------------------------------------------------------------------------------------
!> @brief Deallocate config_material.
!ToDo: deallocation of numerics and debug (optional)
!ToDo: deallocation of numerics (optional)
!--------------------------------------------------------------------------------------------------
subroutine config_deallocate

View File

@ -37,7 +37,7 @@ program DAMASK_grid
#endif
type :: tLoadCase
type(tRotation) :: rot !< rotation of BC
type(tRotation) :: rot !< rotation of BC
type(tBoundaryCondition) :: stress, & !< stress BC
deformation !< deformation BC (dot_F, F, or L)
real(pReal) :: t, & !< length of increment
@ -133,7 +133,7 @@ program DAMASK_grid
!-------------------------------------------------------------------------------------------------
! reading field paramters from numerics file and do sanity checks
! read (and check) field parameters from numerics file
num_grid => config_numerics%get_dict('grid', defaultVal=emptyDict)
stagItMax = num_grid%get_asInt('maxStaggeredIter',defaultVal=10)
maxCutBack = num_grid%get_asInt('maxCutBack',defaultVal=3)
@ -376,7 +376,7 @@ program DAMASK_grid
stepFraction = stepFraction + 1 ! count step
!--------------------------------------------------------------------------------------------------
! report begin of new step
! report beginning of new step
print'(/,1x,a)', '###########################################################################'
print'(1x,a,1x,es12.5,6(a,i0))', &
'Time', t, &
@ -430,7 +430,7 @@ program DAMASK_grid
end do
!--------------------------------------------------------------------------------------------------
! check solution for either advance or retry
! check solution and either advance or retry with smaller timestep
if ( (all(solres(:)%converged .and. solres(:)%stagConverged)) & ! converged
.and. .not. solres(1)%termIll) then ! and acceptable solution found

View File

@ -65,8 +65,7 @@ subroutine discretization_grid_init(restart)
materialAt, materialAt_global
integer :: &
j, &
debug_element, debug_ip
j
integer(MPI_INTEGER_KIND) :: err_MPI
integer(C_INTPTR_T) :: &
devNull, z, z_offset
@ -163,13 +162,6 @@ subroutine discretization_grid_init(restart)
call geometry_plastic_nonlocal_setIPareaNormal (cellSurfaceNormal(product(myGrid)))
call geometry_plastic_nonlocal_setIPneighborhood(IPneighborhood(myGrid))
!-------------------------------------------------------------------------------------------------
! debug parameters
debug_element = config_debug%get_asInt('element',defaultVal=1)
if (debug_element < 1 .or. debug_element > product(myGrid)) call IO_error(602,ext_msg='element')
debug_ip = config_debug%get_asInt('integrationpoint',defaultVal=1)
if (debug_ip /= 1) call IO_error(602,ext_msg='IP')
end subroutine discretization_grid_init

View File

@ -50,8 +50,6 @@ module grid_mechanical_FEM
type(tNumerics) :: num ! numerics parameters. Better name?
logical :: debugRotation
!--------------------------------------------------------------------------------------------------
! PETSc data
DM :: mechanical_grid
@ -121,19 +119,12 @@ subroutine grid_mechanical_FEM_init
integer(HID_T) :: fileHandle, groupHandle
type(tDict), pointer :: &
num_grid
type(tList), pointer :: &
debug_grid
character(len=pStringLen) :: &
extmsg = ''
print'(/,1x,a)', '<<<+- grid_mechanical_FEM init -+>>>'; flush(IO_STDOUT)
!-------------------------------------------------------------------------------------------------
! debugging options
debug_grid => config_debug%get_list('grid',defaultVal=emptyList)
debugRotation = debug_grid%contains('rotation')
!-------------------------------------------------------------------------------------------------
! read numerical parameters and do sanity checks
num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict)
@ -565,7 +556,8 @@ subroutine formResidual(da_local,x_local, &
newIteration: if (totalIter <= PETScIter) then
totalIter = totalIter + 1
print'(1x,a,3(a,i0))', trim(incInfo), ' @ Iteration ', num%itmin, '≤',totalIter+1, '≤', num%itmax
if (debugRotation) print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
if (any(dNeq(params%rotation_BC%asQuaternion(), real([1.0, 0.0, 0.0, 0.0],pReal)))) &
print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
'deformation gradient aim (lab) =', transpose(params%rotation_BC%rotate(F_aim,active=.true.))
print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
'deformation gradient aim =', transpose(F_aim)

View File

@ -49,8 +49,6 @@ module grid_mechanical_spectral_basic
type(tNumerics) :: num ! numerics parameters. Better name?
logical :: debugRotation
!--------------------------------------------------------------------------------------------------
! PETSc data
DM :: da
@ -117,8 +115,6 @@ subroutine grid_mechanical_spectral_basic_init()
integer(HID_T) :: fileHandle, groupHandle
type(tDict), pointer :: &
num_grid
type(tList), pointer :: &
debug_grid
character(len=pStringLen) :: &
extmsg = ''
@ -131,11 +127,6 @@ subroutine grid_mechanical_spectral_basic_init()
print'( 1x,a)', 'P. Shanthraj et al., International Journal of Plasticity 66:3145, 2015'
print'( 1x,a)', 'https://doi.org/10.1016/j.ijplas.2014.02.006'
!-------------------------------------------------------------------------------------------------
! debugging options
debug_grid => config_debug%get_list('grid',defaultVal=emptyList)
debugRotation = debug_grid%contains('rotation')
!-------------------------------------------------------------------------------------------------
! read numerical parameters and do sanity checks
num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict)
@ -518,7 +509,8 @@ subroutine formResidual(residual_subdomain, F, &
newIteration: if (totalIter <= PETScIter) then
totalIter = totalIter + 1
print'(1x,a,3(a,i0))', trim(incInfo), ' @ Iteration ', num%itmin, '≤',totalIter, '≤', num%itmax
if (debugRotation) print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
if (any(dNeq(params%rotation_BC%asQuaternion(), real([1.0, 0.0, 0.0, 0.0],pReal)))) &
print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
'deformation gradient aim (lab) =', transpose(params%rotation_BC%rotate(F_aim,active=.true.))
print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
'deformation gradient aim =', transpose(F_aim)

View File

@ -54,8 +54,6 @@ module grid_mechanical_spectral_polarisation
type(tNumerics) :: num ! numerics parameters. Better name?
logical :: debugRotation
!--------------------------------------------------------------------------------------------------
! PETSc data
DM :: da
@ -130,8 +128,6 @@ subroutine grid_mechanical_spectral_polarisation_init()
integer(HID_T) :: fileHandle, groupHandle
type(tDict), pointer :: &
num_grid
type(tList), pointer :: &
debug_grid
character(len=pStringLen) :: &
extmsg = ''
@ -141,10 +137,6 @@ subroutine grid_mechanical_spectral_polarisation_init()
print'(/,1x,a)', 'P. Shanthraj et al., International Journal of Plasticity 66:3145, 2015'
print'( 1x,a)', 'https://doi.org/10.1016/j.ijplas.2014.02.006'
!-------------------------------------------------------------------------------------------------
! debugging options
debug_grid => config_debug%get_list('grid',defaultVal=emptyList)
debugRotation = debug_grid%contains('rotation')
!-------------------------------------------------------------------------------------------------
! read numerical parameters and do sanity checks
@ -595,7 +587,8 @@ subroutine formResidual(residual_subdomain, FandF_tau, &
newIteration: if (totalIter <= PETScIter) then
totalIter = totalIter + 1
print'(1x,a,3(a,i0))', trim(incInfo), ' @ Iteration ', num%itmin, '≤',totalIter, '≤', num%itmax
if (debugRotation) print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
if (any(dNeq(params%rotation_BC%asQuaternion(), real([1.0, 0.0, 0.0, 0.0],pReal)))) &
print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
'deformation gradient aim (lab) =', transpose(params%rotation_BC%rotate(F_aim,active=.true.))
print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
'deformation gradient aim =', transpose(F_aim)

View File

@ -64,13 +64,6 @@ module spectral_utilities
planScalarForth, & !< FFTW MPI plan s(x) to s(k)
planScalarBack !< FFTW MPI plan s(k) to s(x)
!--------------------------------------------------------------------------------------------------
! variables controlling debugging
logical :: &
debugGeneral, & !< general debugging of spectral solver
debugRotation, & !< also printing out results in lab frame
debugPETSc !< use some in debug defined options for more verbose PETSc solution
!--------------------------------------------------------------------------------------------------
! derived types
type, public :: tSolutionState !< return type of solution from spectral solver variants
@ -131,12 +124,7 @@ module spectral_utilities
contains
!--------------------------------------------------------------------------------------------------
!> @brief allocates all neccessary fields, sets debug flags, create plans for FFTW
!> @details Sets the debug levels for general, divergence, restart, and FFTW from the bitwise coding
!> provided by the debug module to logicals.
!> Allocate all fields used by FFTW and create the corresponding plans depending on the debug
!> level chosen.
!> Initializes FFTW.
!> @brief Allocate all neccessary fields and create plans for FFTW.
!--------------------------------------------------------------------------------------------------
subroutine spectral_utilities_init()
@ -157,12 +145,8 @@ subroutine spectral_utilities_init()
integer(C_INTPTR_T), parameter :: &
vectorSize = 3_C_INTPTR_T, &
tensorSize = 9_C_INTPTR_T
character(len=*), parameter :: &
PETSCDEBUG = ' -snes_view -snes_monitor '
type(tDict) , pointer :: &
num_grid
type(tList) , pointer :: &
debug_grid
print'(/,1x,a)', '<<<+- spectral_utilities init -+>>>'
@ -179,25 +163,10 @@ subroutine spectral_utilities_init()
print'( 1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019'
print'( 1x,a)', 'https://doi.org/10.1007/978-981-10-6855-3_80'
!--------------------------------------------------------------------------------------------------
! set debugging parameters
num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict)
debug_grid => config_debug%get_List('grid',defaultVal=emptyList)
debugGeneral = debug_grid%contains('basic')
debugRotation = debug_grid%contains('rotation')
debugPETSc = debug_grid%contains('PETSc')
if (debugPETSc) print'(3(/,1x,a),/)', &
'Initializing PETSc with debug options: ', &
trim(PETScDebug), &
'add more using the "PETSc_options" keyword in numerics.yaml'
flush(IO_STDOUT)
num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict)
call PetscOptionsClear(PETSC_NULL_OPTIONS,err_PETSc)
CHKERRQ(err_PETSc)
if (debugPETSc) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(PETSCDEBUG),err_PETSc)
CHKERRQ(err_PETSc)
call PetscOptionsInsertString(PETSC_NULL_OPTIONS,&
num_grid%get_asString('PETSc_options',defaultVal=''),err_PETSc)
CHKERRQ(err_PETSc)
@ -704,13 +673,6 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C)
if (size_reduced > 0) then
temp99_real = math_3333to99(rot_BC%rotate(C))
if (debugGeneral) then
print'(/,1x,a)', '... updating masked compliance ............................................'
print'(/,1x,a,/,8(9(2x,f12.7,1x)/),9(2x,f12.7,1x))', &
'Stiffness C (load) / GPa =', transpose(temp99_Real)*1.0e-9_pReal
flush(IO_STDOUT)
end if
do i = 1,9; do j = 1,9
mask(i,j) = mask_stressVector(i) .and. mask_stressVector(j)
end do; end do
@ -724,7 +686,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C)
! check if inversion was successful
sTimesC = matmul(c_reduced,s_reduced)
errmatinv = errmatinv .or. any(dNeq(sTimesC,math_eye(size_reduced),1.0e-12_pReal))
if (debugGeneral .or. errmatinv) then
if (errmatinv) then
write(formatString, '(i2)') size_reduced
formatString = '(/,1x,a,/,'//trim(formatString)//'('//trim(formatString)//'(2x,es9.2,1x)/))'
print trim(formatString), 'C * S (load) ', transpose(matmul(c_reduced,s_reduced))
@ -738,12 +700,6 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C)
utilities_maskedCompliance = math_99to3333(temp99_Real)
if (debugGeneral) then
print'(/,1x,a,/,9(9(2x,f10.5,1x)/),9(2x,f10.5,1x))', &
'Masked Compliance (load) * GPa =', transpose(temp99_Real)*1.0e9_pReal
flush(IO_STDOUT)
end if
end function utilities_maskedCompliance
@ -825,9 +781,12 @@ subroutine utilities_constitutiveResponse(P,P_av,C_volAvg,C_minmaxAvg,&
P_av = sum(sum(sum(P,dim=5),dim=4),dim=3) * wgt
call MPI_Allreduce(MPI_IN_PLACE,P_av,9_MPI_INTEGER_KIND,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD,err_MPI)
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
if (debugRotation) print'(/,1x,a,/,2(3(2x,f12.4,1x)/),3(2x,f12.4,1x))', &
'Piola--Kirchhoff stress (lab) / MPa =', transpose(P_av)*1.e-6_pReal
if (present(rotation_BC)) P_av = rotation_BC%rotate(P_av)
if (present(rotation_BC)) then
if (any(dNeq(rotation_BC%asQuaternion(), real([1.0, 0.0, 0.0, 0.0],pReal)))) &
print'(/,1x,a,/,2(3(2x,f12.4,1x)/),3(2x,f12.4,1x))', &
'Piola--Kirchhoff stress (lab) / MPa =', transpose(P_av)*1.e-6_pReal
P_av = rotation_BC%rotate(P_av)
end if
print'(/,1x,a,/,2(3(2x,f12.4,1x)/),3(2x,f12.4,1x))', &
'Piola--Kirchhoff stress / MPa =', transpose(P_av)*1.e-6_pReal
flush(IO_STDOUT)

View File

@ -88,21 +88,17 @@ contains
!ToDo: use functions in variable call
!--------------------------------------------------------------------------------------------------
!> @brief allocates all neccessary fields, sets debug flags
!> @brief Allocate all neccessary fields.
!--------------------------------------------------------------------------------------------------
subroutine FEM_utilities_init
character(len=pStringLen) :: petsc_optionsOrder
type(tDict), pointer :: &
num_mesh, &
debug_mesh ! pointer to mesh debug options
num_mesh
integer :: &
p_s, & !< order of shape functions
p_i !< integration order (quadrature rule)
character(len=*), parameter :: &
PETSCDEBUG = ' -snes_view -snes_monitor '
PetscErrorCode :: err_PETSc
logical :: debugPETSc !< use some in debug defined options for more verbose PETSc solution
print'(/,1x,a)', '<<<+- FEM_utilities init -+>>>'
@ -117,17 +113,9 @@ subroutine FEM_utilities_init
if (p_i < max(1,p_s-1) .or. p_i > p_s) &
call IO_error(821,ext_msg='integration order (p_i) out of bounds')
debug_mesh => config_debug%get_dict('mesh',defaultVal=emptyDict)
debugPETSc = debug_mesh%contains('PETSc')
if (debugPETSc) print'(3(/,1x,a),/)', &
'Initializing PETSc with debug options: ', &
trim(PETScDebug), &
'add more using the "PETSc_options" keyword in numerics.yaml'
flush(IO_STDOUT)
call PetscOptionsClear(PETSC_NULL_OPTIONS,err_PETSc)
CHKERRQ(err_PETSc)
if (debugPETSc) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(PETSCDEBUG),err_PETSc)
CHKERRQ(err_PETSc)
call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mechanical_snes_type newtonls &
&-mechanical_snes_linesearch_type cp -mechanical_snes_ksp_ew &

View File

@ -78,8 +78,7 @@ subroutine discretization_mesh_init(restart)
PetscInt :: dimPlex, &
mesh_Nnodes, & !< total number of nodes in mesh
j, &
debug_element, debug_ip
j
PetscSF :: sf
DM :: globalMesh
PetscInt :: nFaceSets, Nboundaries, NelemsGlobal, Nelems
@ -103,11 +102,6 @@ subroutine discretization_mesh_init(restart)
num_mesh => config_numerics%get_dict('mesh',defaultVal=emptyDict)
p_i = num_mesh%get_asInt('p_i',defaultVal = 2)
!---------------------------------------------------------------------------------
! read debug parameters
debug_element = config_debug%get_asInt('element',defaultVal=1)
debug_ip = config_debug%get_asInt('integrationpoint',defaultVal=1)
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>16)
call DMPlexCreateFromFile(PETSC_COMM_WORLD,CLI_geomFile,'n/a',PETSC_TRUE,globalMesh,err_PETSc)
#else
@ -182,9 +176,6 @@ subroutine discretization_mesh_init(restart)
end do
materialAt = materialAt + 1_pPETSCINT
if (debug_element < 1 .or. debug_element > mesh_NcpElems) call IO_error(602,ext_msg='element')
if (debug_ip < 1 .or. debug_ip > mesh_maxNips) call IO_error(602,ext_msg='IP')
allocate(mesh_node0(3,mesh_Nnodes),source=0.0_pReal)
mesh_node0(1:dimPlex,:) = reshape(mesh_node0_temp,[dimPlex,mesh_Nnodes])

View File

@ -76,17 +76,6 @@ module phase
type(tNumerics) :: num ! numerics parameters. Better name?
type :: tDebugOptions
logical :: &
basic, &
extensive, &
selective
integer :: &
element, &
ip, &
grain
end type tDebugOptions
type(tPlasticState), allocatable, dimension(:), public :: &
plasticState
type(tState), allocatable, dimension(:), public :: &
@ -334,7 +323,6 @@ module phase
end interface
type(tDebugOptions) :: debugConstitutive
#if __INTEL_COMPILER >= 1900
public :: &
prec, &
@ -390,21 +378,10 @@ subroutine phase_init
type(tDict), pointer :: &
phases, &
phase
type(tList), pointer :: &
debug_constitutive
print'(/,1x,a)', '<<<+- phase init -+>>>'; flush(IO_STDOUT)
debug_constitutive => config_debug%get_list('phase', defaultVal=emptyList)
debugConstitutive%basic = debug_constitutive%contains('basic')
debugConstitutive%extensive = debug_constitutive%contains('extensive')
debugConstitutive%selective = debug_constitutive%contains('selective')
debugConstitutive%element = config_debug%get_asInt('element', defaultVal = 1)
debugConstitutive%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1)
debugConstitutive%grain = config_debug%get_asInt('constituent', defaultVal = 1)
phases => config_material%get_dict('phase')
allocate(phase_lattice(phases%length))
allocate(phase_cOverA(phases%length),source=-1.0_pReal)

View File

@ -416,8 +416,8 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken)
broken = .true.
call plastic_dependentState(ph,en)
Lpguess = phase_mechanical_Lp(ph)%data(1:3,1:3,en) ! take as first guess
Liguess = phase_mechanical_Li(ph)%data(1:3,1:3,en) ! take as first guess
Lpguess = phase_mechanical_Lp(ph)%data(1:3,1:3,en) ! take as first guess
Liguess = phase_mechanical_Li(ph)%data(1:3,1:3,en) ! take as first guess
call math_invert33(invFp_current,error=error,A=subFp0)
if (error) return ! error

View File

@ -226,7 +226,7 @@ module subroutine plastic_init
end subroutine plastic_init
!--------------------------------------------------------------------------------------------------
!> @brief contains the constitutive equation for calculating the velocity gradient
!> @brief constitutive equation for calculating the velocity gradient
! ToDo: Discuss whether it makes sense if crystallite handles the configuration conversion, i.e.
! Mp in, dLp_dMp out
!--------------------------------------------------------------------------------------------------
@ -366,7 +366,7 @@ end subroutine plastic_dependentState
!--------------------------------------------------------------------------------------------------
!> @brief for constitutive models having an instantaneous change of state
!> @brief for constitutive models that have an instantaneous change of state
!> will return false if delta state is not needed/supported by the constitutive model
!--------------------------------------------------------------------------------------------------
module function plastic_deltaState(ph, en) result(broken)

View File

@ -446,8 +446,8 @@ end subroutine plastic_dislotungsten_result
!> @brief Calculate shear rates on slip systems, their derivatives with respect to resolved
! stress, and the resolved stress.
!> @details Derivatives and resolved stress are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end
! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put
! at the end since some of them are optional.
!--------------------------------------------------------------------------------------------------
pure subroutine kinetics(Mp,T,ph,en, &
dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg,tau_pos_out,tau_neg_out)

View File

@ -64,9 +64,9 @@ submodule(phase:plastic) dislotwin
P_tw, &
P_tr
integer :: &
sum_N_sl, & !< total number of active slip system
sum_N_tw, & !< total number of active twin system
sum_N_tr !< total number of active transformation system
sum_N_sl, & !< total number of active slip systems
sum_N_tw, & !< total number of active twin systems
sum_N_tr !< total number of active transformation systems
integer, allocatable, dimension(:) :: &
N_tw, &
N_tr
@ -822,8 +822,8 @@ end subroutine plastic_dislotwin_result
!> @brief Calculate shear rates on slip systems, their derivatives with respect to resolved
! stress, and the resolved stress.
!> @details Derivatives and resolved stress are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end
! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put
! at the end since some of them are optional.
!--------------------------------------------------------------------------------------------------
pure subroutine kinetics_sl(Mp,T,ph,en, &
dot_gamma_sl,ddot_gamma_dtau_sl,tau_sl)
@ -898,8 +898,8 @@ end subroutine kinetics_sl
!> @brief Calculate shear rates on twin systems and their derivatives with respect to resolved
! stress.
!> @details Derivatives are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end.
! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put
! at the end since some of them are optional.
!--------------------------------------------------------------------------------------------------
pure subroutine kinetics_tw(Mp,T,abs_dot_gamma_sl,ph,en,&
dot_gamma_tw,ddot_gamma_dtau_tw)
@ -974,8 +974,8 @@ end subroutine kinetics_tw
!> @brief Calculate shear rates on transformation systems and their derivatives with respect to
! resolved stress.
!> @details Derivatives are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end.
! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put
! at the end since some of them are optional.
!--------------------------------------------------------------------------------------------------
pure subroutine kinetics_tr(Mp,T,abs_dot_gamma_sl,ph,en,&
dot_gamma_tr,ddot_gamma_dtau_tr)

View File

@ -407,8 +407,8 @@ end subroutine plastic_kinehardening_result
!> @brief Calculate shear rates on slip systems and their derivatives with respect to resolved
! stress.
!> @details: Derivatives are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end.
! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put
! at the end since some of them are optional.
!--------------------------------------------------------------------------------------------------
pure subroutine kinetics(Mp,ph,en, &
dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg)

View File

@ -1114,12 +1114,6 @@ module subroutine nonlocal_dotState(Mp,timestep, &
if ( any(rho(:,mob) + rhoDot(:,1:4) * timestep < -prm%atol_rho) &
.or. any(rho(:,dip) + rhoDot(:,9:10) * timestep < -prm%atol_rho)) then
#ifdef DEBUG
if (debugConstitutive%extensive) then
print'(a,i5,a,i2)', '<< CONST >> evolution rate leads to negative density at ph ',ph,' en ',en
print'(a)', '<< CONST >> enforcing cutback !!!'
end if
#endif
plasticState(ph)%dotState = IEEE_value(1.0_pReal,IEEE_quiet_NaN)
else
dot%rho(:,en) = pack(rhoDot,.true.)
@ -1219,17 +1213,6 @@ function rhoDotFlux(timestep,ph,en)
if (any( abs(dot_gamma) > 0.0_pReal & ! any active slip system ...
.and. prm%C_CFL * abs(v0) * timestep &
> geom(ph)%V_0(en)/ maxval(geom(ph)%IParea(:,en)))) then ! ...with velocity above critical value (we use the reference volume and area for simplicity here)
#ifdef DEBUG
if (debugConstitutive%extensive) then
print'(a,i5,a,i2)', '<< CONST >> CFL condition not fullfilled at ph ',ph,' en ',en
print'(a,e10.3,a,e10.3)', '<< CONST >> velocity is at ', &
maxval(abs(v0), abs(dot_gamma) > 0.0_pReal &
.and. prm%C_CFL * abs(v0) * timestep &
> geom(ph)%V_0(en) / maxval(geom(ph)%IParea(:,en))), &
' at a timestep of ',timestep
print*, '<< CONST >> enforcing cutback !!!'
end if
#endif
rhoDotFlux = IEEE_value(1.0_pReal,IEEE_quiet_NaN) ! enforce cutback
return
end if

View File

@ -279,7 +279,7 @@ end function plastic_phenopowerlaw_init
!--------------------------------------------------------------------------------------------------
!> @brief Calculate plastic velocity gradient and its tangent.
!> @details asummes that deformation by dislocation glide affects twinned and untwinned volume
!> @details assumes that deformation by dislocation glide affects twinned and untwinned volume
! equally (Taylor assumption). Twinning happens only in untwinned volume
!--------------------------------------------------------------------------------------------------
pure module subroutine phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en)
@ -422,8 +422,8 @@ end subroutine plastic_phenopowerlaw_result
!> @brief Calculate shear rates on slip systems and their derivatives with respect to resolved
! stress.
!> @details Derivatives are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end.
! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put
! at the end since some of them are optional.
!--------------------------------------------------------------------------------------------------
pure subroutine kinetics_sl(Mp,ph,en, &
dot_gamma_sl_pos,dot_gamma_sl_neg,ddot_gamma_dtau_sl_pos,ddot_gamma_dtau_sl_neg)
@ -490,10 +490,10 @@ end subroutine kinetics_sl
!--------------------------------------------------------------------------------------------------
!> @brief Calculate shear rates on twin systems and their derivatives with respect to resolved
! stress. Twinning is assumed to take place only in untwinned volume.
!> @details Derivatives are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end.
! stress. Twinning is assumed to take place only in an untwinned volume.
!> @details Derivatives are calculated and returned if corresponding output variables are present in the argument list.
! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put
! at the end since some of them are optional.
!--------------------------------------------------------------------------------------------------
pure subroutine kinetics_tw(Mp,ph,en,&
dot_gamma_tw,ddot_gamma_dtau_tw)

View File

@ -234,7 +234,7 @@ end subroutine result_addAttribute_str
!--------------------------------------------------------------------------------------------------
!> @brief Add an integer attribute an object in the result file.
!> @brief Add an integer attribute to an object in the result file.
!--------------------------------------------------------------------------------------------------
subroutine result_addAttribute_int(attrLabel,attrValue,path)
@ -253,7 +253,7 @@ end subroutine result_addAttribute_int
!--------------------------------------------------------------------------------------------------
!> @brief Add a real attribute an object in the result file.
!> @brief Add a real (float) attribute to an object in the result file.
!--------------------------------------------------------------------------------------------------
subroutine result_addAttribute_real(attrLabel,attrValue,path)
@ -272,7 +272,7 @@ end subroutine result_addAttribute_real
!--------------------------------------------------------------------------------------------------
!> @brief Add a string array attribute an object in the result file.
!> @brief Add a string array attribute to an object in the result file.
!--------------------------------------------------------------------------------------------------
subroutine result_addAttribute_str_array(attrLabel,attrValue,path)
@ -291,7 +291,7 @@ end subroutine result_addAttribute_str_array
!--------------------------------------------------------------------------------------------------
!> @brief Add an integer array attribute an object in the result file.
!> @brief Add an integer array attribute to an object in the result file.
!--------------------------------------------------------------------------------------------------
subroutine result_addAttribute_int_array(attrLabel,attrValue,path)
@ -310,7 +310,7 @@ end subroutine result_addAttribute_int_array
!--------------------------------------------------------------------------------------------------
!> @brief Add a real array attribute an object in the result file.
!> @brief Add a real (float) array attribute to an object in the result file.
!--------------------------------------------------------------------------------------------------
subroutine result_addAttribute_real_array(attrLabel,attrValue,path)

View File

@ -37,7 +37,7 @@ end subroutine signal_init
!--------------------------------------------------------------------------------------------------
!> @brief Set global variable signal_SIGINT to .true.
!> @details This function can be registered to catch signals send to the executable.
!> @details This function can be registered to catch signals sent to the executable.
!--------------------------------------------------------------------------------------------------
subroutine catchSIGINT(sig) bind(C)
@ -52,7 +52,7 @@ end subroutine catchSIGINT
!--------------------------------------------------------------------------------------------------
!> @brief Set global variable signal_SIGUSR1 to .true.
!> @details This function can be registered to catch signals send to the executable.
!> @details This function can be registered to catch signals sent to the executable.
!--------------------------------------------------------------------------------------------------
subroutine catchSIGUSR1(sig) bind(C)
@ -67,7 +67,7 @@ end subroutine catchSIGUSR1
!--------------------------------------------------------------------------------------------------
!> @brief Set global variable signal_SIGUSR2 to .true.
!> @details This function can be registered to catch signals send to the executable.
!> @details This function can be registered to catch signals sent to the executable.
!--------------------------------------------------------------------------------------------------
subroutine catchSIGUSR2(sig) bind(C)