From 32810cbe8bd870d7cd83b257efc6c83c1dcd338a Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 11 Jul 2023 13:16:00 -0400 Subject: [PATCH 01/24] error formatting through function --- src/CLI.f90 | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index f2575657c..d616ae5d2 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -158,36 +158,46 @@ subroutine CLI_init() print'(1x,a,/)',' Prints this message and exits' call quit(0) ! normal Termination case ('-g', '--geom', '--geometry') - if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --geom' + if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --geom') geomArg = getArg(i+1) case ('-l', '--load', '--loadcase') - if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --load' + if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --load') loadArg = getArg(i+1) case ('-m', '--material', '--materialconfig') - if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --material' + if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --material') materialArg = getArg(i+1) case ('-n', '--numerics', '--numericsconfig') - if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --numerics' + if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --numerics') numericsArg = getArg(i+1) case ('-j', '--job', '--jobname') - if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --jobname' + if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --jobname') solverJobname = getArg(i+1) case ('-w', '--wd', '--workingdir', '--workingdirectory') - if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --workingdirectory' + if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --workingdirectory') workingDirArg = getArg(i+1) case ('-r', '--rs', '--restart') - if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --restart' + if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --restart') arg = getArg(i+1) read(arg,*,iostat=stat) CLI_restartInc if (CLI_restartInc < 0 .or. stat /= 0) then - print'(/,1x,a)', 'ERROR: Could not parse restart increment: '//trim(arg) + print'(/,1x,a)', asError('could not parse restart increment: '//trim(arg)) call quit(1) end if end select end do - if (.not. all([allocated(loadArg),allocated(geomArg),allocated(materialArg)])) then - print'(/,1x,a)', 'ERROR: Please specify geometry AND load case AND material configuration (-h for help)' + if (.not. allocated(loadArg)) then + print'(/,1x,a)', asError('no load case specified (-h for help)') + call quit(1) + end if + + if (.not. allocated(geomArg)) then + print'(/,1x,a)', asError('no geometry specified (-h for help)') + call quit(1) + end if + + if (.not. allocated(materialArg)) then + print'(/,1x,a)', asError('no material configuration specified (-h for help)') call quit(1) end if @@ -201,7 +211,7 @@ subroutine CLI_init() if (.not. allocated(solverJobname)) then solverJobname = jobname(CLI_geomFile,CLI_loadFile,CLI_materialFile,CLI_numericsFile) elseif (scan(solverJobname,'/') > 0) then - print'(/,1x,a)', 'ERROR: JOBNAME must not contain any slashes' + print'(/,1x,a)', asError('JOBNAME must not contain any slashes') call quit(1) endif @@ -276,7 +286,7 @@ subroutine setWorkingDirectory(workingDirectoryArg) workingDirectory = trim(normpath(workingDirectory)) error = setCWD(trim(workingDirectory)) if (error) then - print'(1x,a)', 'ERROR: Invalid Working directory: '//trim(workingDirectory) + print'(1x,a)', asError('invalid Working directory: '//trim(workingDirectory)) call quit(1) end if @@ -343,7 +353,7 @@ function getPathRelCWD(path,fileType) inquire(file=getPathRelCWD, exist=file_exists) if (.not. file_exists) then - print'(/,1x,a)', 'ERROR: '//fileType//' file does not exist: '//trim(getPathRelCWD) + print'(/,1x,a)', asError(fileType//' file does not exist: '//trim(getPathRelCWD)) call quit(1) end if @@ -428,4 +438,18 @@ function relpath(path,start) end function relpath +!-------------------------------------------------------------------------------------------------- +!> @brief Prefix string with 'ERROR: ' and color it red. +!-------------------------------------------------------------------------------------------------- +function asError(str) + + character(len=*), intent(in) :: str + character(len=:), allocatable :: asError + + asError = 'ERROR: '//achar(27)//'[31m'//trim(str)//achar(27)//'[0m' + +end function asError + + + end module CLI From d452a9ce3f99b1eeb3a47963fbff13cd7999a2ff Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 11 Jul 2023 17:15:03 -0400 Subject: [PATCH 02/24] use IO_error in CLI --- src/CLI.f90 | 69 ++++++++++++----------------------------------------- src/IO.f90 | 48 ++++++++++++++++++++++++++++++------- 2 files changed, 54 insertions(+), 63 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index d616ae5d2..a94cb2e60 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -74,7 +74,7 @@ subroutine CLI_init() print'(a)', achar(27)//'[31m' print'(1x,a,/)', 'debug version - debug version - debug version - debug version - debug version' #else - print'(a)', achar(27)//'[94m' + print'(a)', achar(27)//'[1;94m' #endif print'(1x,a)', ' _/_/_/ _/_/ _/ _/ _/_/ _/_/_/ _/ _/ _/_/_/' print'(1x,a)', ' _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/' @@ -158,48 +158,34 @@ subroutine CLI_init() print'(1x,a,/)',' Prints this message and exits' call quit(0) ! normal Termination case ('-g', '--geom', '--geometry') - if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --geom') + if (.not. hasArg) call IO_error(610) geomArg = getArg(i+1) case ('-l', '--load', '--loadcase') - if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --load') + if (.not. hasArg) call IO_error(611) loadArg = getArg(i+1) case ('-m', '--material', '--materialconfig') - if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --material') + if (.not. hasArg) call IO_error(612) materialArg = getArg(i+1) case ('-n', '--numerics', '--numericsconfig') - if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --numerics') + if (.not. hasArg) call IO_error(613) numericsArg = getArg(i+1) case ('-j', '--job', '--jobname') - if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --jobname') + if (.not. hasArg) call IO_error(614) solverJobname = getArg(i+1) case ('-w', '--wd', '--workingdir', '--workingdirectory') - if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --workingdirectory') + if (.not. hasArg) call IO_error(615) workingDirArg = getArg(i+1) case ('-r', '--rs', '--restart') - if (.not. hasArg) print'(/,1x,a)', asError('missing argument for --restart') + if (.not. hasArg) call IO_error(616) arg = getArg(i+1) read(arg,*,iostat=stat) CLI_restartInc - if (CLI_restartInc < 0 .or. stat /= 0) then - print'(/,1x,a)', asError('could not parse restart increment: '//trim(arg)) - call quit(1) - end if + if (CLI_restartInc < 0 .or. stat /= 0) call IO_error(617,ext_msg=arg) end select end do - if (.not. allocated(loadArg)) then - print'(/,1x,a)', asError('no load case specified (-h for help)') - call quit(1) - end if - - if (.not. allocated(geomArg)) then - print'(/,1x,a)', asError('no geometry specified (-h for help)') - call quit(1) - end if - - if (.not. allocated(materialArg)) then - print'(/,1x,a)', asError('no material configuration specified (-h for help)') - call quit(1) - end if + if (.not. allocated(geomArg)) call IO_error(620,ext_msg='-h for help') + if (.not. allocated(loadArg)) call IO_error(621,ext_msg='-h for help') + if (.not. allocated(materialArg)) call IO_error(622,ext_msg='-h for help') call setWorkingDirectory(trim(workingDirArg)) CLI_geomFile = getPathRelCWD(geomArg,'geometry') @@ -211,8 +197,7 @@ subroutine CLI_init() if (.not. allocated(solverJobname)) then solverJobname = jobname(CLI_geomFile,CLI_loadFile,CLI_materialFile,CLI_numericsFile) elseif (scan(solverJobname,'/') > 0) then - print'(/,1x,a)', asError('JOBNAME must not contain any slashes') - call quit(1) + call IO_error(630) endif commandLine = getArg(-1) @@ -272,9 +257,6 @@ subroutine setWorkingDirectory(workingDirectoryArg) character(len=*), intent(in) :: workingDirectoryArg !< working directory argument character(len=:), allocatable :: workingDirectory - logical :: error - external :: quit - absolutePath: if (workingDirectoryArg(1:1) == '/') then workingDirectory = workingDirectoryArg @@ -284,11 +266,7 @@ subroutine setWorkingDirectory(workingDirectoryArg) end if absolutePath workingDirectory = trim(normpath(workingDirectory)) - error = setCWD(trim(workingDirectory)) - if (error) then - print'(1x,a)', asError('invalid Working directory: '//trim(workingDirectory)) - call quit(1) - end if + if (setCWD(trim(workingDirectory))) call IO_error(640,ext_msg=workingDirectory) end subroutine setWorkingDirectory @@ -344,7 +322,6 @@ function getPathRelCWD(path,fileType) character(len=*), intent(in) :: fileType logical :: file_exists - external :: quit getPathRelCWD = trim(path) @@ -352,10 +329,7 @@ function getPathRelCWD(path,fileType) getPathRelCWD = trim(relpath(getPathRelCWD,getCWD())) inquire(file=getPathRelCWD, exist=file_exists) - if (.not. file_exists) then - print'(/,1x,a)', asError(fileType//' file does not exist: '//trim(getPathRelCWD)) - call quit(1) - end if + if (.not. file_exists) call IO_error(100,ext_msg=fileType//' "'//trim(getPathRelCWD)//'"') end function getPathRelCWD @@ -438,18 +412,5 @@ function relpath(path,start) end function relpath -!-------------------------------------------------------------------------------------------------- -!> @brief Prefix string with 'ERROR: ' and color it red. -!-------------------------------------------------------------------------------------------------- -function asError(str) - - character(len=*), intent(in) :: str - character(len=:), allocatable :: asError - - asError = 'ERROR: '//achar(27)//'[31m'//trim(str)//achar(27)//'[0m' - -end function asError - - end module CLI diff --git a/src/IO.f90 b/src/IO.f90 index 39a48e1e5..a0cf850b6 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -555,6 +555,34 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2) ! user errors case (603) msg = 'invalid data for table' + case (610) + msg = 'missing argument for --geom' + case (611) + msg = 'missing argument for --load' + case (612) + msg = 'missing argument for --material' + case (613) + msg = 'missing argument for --numerics' + case (614) + msg = 'missing argument for --jobname' + case (615) + msg = 'missing argument for --workingdirectory' + case (616) + msg = 'missing argument for --restart' + case (617) + msg = 'could not parse restart increment' + case (620) + msg = 'no geometry specified' + case (621) + msg = 'no load case specified' + case (622) + msg = 'no material configuration specified' + case (630) + msg = 'JOBNAME must not contain any slashes' + case (640) + msg = 'invalid working directory' + + !------------------------------------------------------------------------------------------------ ! errors related to YAML data @@ -622,9 +650,9 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2) end select call panel('error',error_ID,msg, & - ext_msg=ext_msg, & - label1=label1,ID1=ID1, & - label2=label2,ID2=ID2) + ext_msg=ext_msg, & + label1=label1,ID1=ID1, & + label2=label2,ID2=ID2) call quit(9000+error_ID) end subroutine IO_error @@ -704,6 +732,7 @@ subroutine panel(paneltype,ID,msg,ext_msg,label1,ID1,label2,ID2) character(len=pSTRLEN) :: formatString integer, parameter :: panelwidth = 69 + character(len=:), allocatable :: msg_,ID_ character(len=*), parameter :: DIVIDER = repeat('─',panelwidth) @@ -712,16 +741,17 @@ subroutine panel(paneltype,ID,msg,ext_msg,label1,ID1,label2,ID2) if ( present(label1) .and. .not. present(ID1)) error stop 'missing value for label 1' if ( present(label2) .and. .not. present(ID2)) error stop 'missing value for label 2' + if (paneltype == 'error') msg_ = achar(27)//'[31m'//trim(msg)//achar(27)//'[0m' + if (paneltype == 'warning') msg_ = achar(27)//'[33m'//trim(msg)//achar(27)//'[0m' + ID_ = IO_intAsStr(ID) !$OMP CRITICAL (write2out) write(IO_STDERR,'(/,a)') ' ┌'//DIVIDER//'┐' - write(formatString,'(a,i2,a)') '(a,24x,a,',max(1,panelwidth-24-len_trim(paneltype)),'x,a)' - write(IO_STDERR,formatString) ' │',trim(paneltype), '│' - write(formatString,'(a,i2,a)') '(a,24x,i3,',max(1,panelwidth-24-3),'x,a)' - write(IO_STDERR,formatString) ' │',ID, '│' + write(formatString,'(a,i2,a)') '(a,24x,a,1x,i0,',max(1,panelwidth-24-len_trim(paneltype)-1-len_trim(ID_)),'x,a)' + write(IO_STDERR,formatString) ' │',trim(paneltype),ID, '│' write(IO_STDERR,'(a)') ' ├'//DIVIDER//'┤' - write(formatString,'(a,i3.3,a,i3.3,a)') '(1x,a4,a',max(1,len_trim(msg)),',',& + write(formatString,'(a,i3.3,a,i3.3,a)') '(1x,a4,a',max(1,len_trim(msg_)),',',& max(1,panelwidth+3-len_trim(msg)-4),'x,a)' - write(IO_STDERR,formatString) '│ ',trim(msg), '│' + write(IO_STDERR,formatString) '│ ',trim(msg_), '│' if (present(ext_msg)) then write(formatString,'(a,i3.3,a,i3.3,a)') '(1x,a4,a',max(1,len_trim(ext_msg)),',',& max(1,panelwidth+3-len_trim(ext_msg)-4),'x,a)' From d9cf3983b49fc6a04139b32e79fff6ab44aa1354 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 12 Jul 2023 12:45:39 +0200 Subject: [PATCH 03/24] more generic error codes allow label without ID in IO_error --- src/CLI.f90 | 22 +++++++++++----------- src/IO.f90 | 45 ++++++++++++++++----------------------------- 2 files changed, 27 insertions(+), 40 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index a94cb2e60..ce2f68ed7 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -158,34 +158,34 @@ subroutine CLI_init() print'(1x,a,/)',' Prints this message and exits' call quit(0) ! normal Termination case ('-g', '--geom', '--geometry') - if (.not. hasArg) call IO_error(610) + if (.not. hasArg) call IO_error(610,ext_msg='--geom') geomArg = getArg(i+1) case ('-l', '--load', '--loadcase') - if (.not. hasArg) call IO_error(611) + if (.not. hasArg) call IO_error(610,ext_msg='--load') loadArg = getArg(i+1) case ('-m', '--material', '--materialconfig') - if (.not. hasArg) call IO_error(612) + if (.not. hasArg) call IO_error(610,ext_msg='--material') materialArg = getArg(i+1) case ('-n', '--numerics', '--numericsconfig') - if (.not. hasArg) call IO_error(613) + if (.not. hasArg) call IO_error(610,ext_msg='--numerics') numericsArg = getArg(i+1) case ('-j', '--job', '--jobname') - if (.not. hasArg) call IO_error(614) + if (.not. hasArg) call IO_error(610,ext_msg='--jobname') solverJobname = getArg(i+1) case ('-w', '--wd', '--workingdir', '--workingdirectory') - if (.not. hasArg) call IO_error(615) + if (.not. hasArg) call IO_error(610,ext_msg='--workingdirectory') workingDirArg = getArg(i+1) case ('-r', '--rs', '--restart') - if (.not. hasArg) call IO_error(616) + if (.not. hasArg) call IO_error(610,ext_msg='--jobname') arg = getArg(i+1) read(arg,*,iostat=stat) CLI_restartInc - if (CLI_restartInc < 0 .or. stat /= 0) call IO_error(617,ext_msg=arg) + if (CLI_restartInc < 0 .or. stat /= 0) call IO_error(611,ext_msg=arg) end select end do - if (.not. allocated(geomArg)) call IO_error(620,ext_msg='-h for help') - if (.not. allocated(loadArg)) call IO_error(621,ext_msg='-h for help') - if (.not. allocated(materialArg)) call IO_error(622,ext_msg='-h for help') + if (.not. allocated(geomArg)) call IO_error(612,ext_msg='--help for instructions',label1='--geom') + if (.not. allocated(loadArg)) call IO_error(612,ext_msg='--help for instructions',label1='--load') + if (.not. allocated(materialArg)) call IO_error(612,ext_msg='--help for instructions',label1='--material') call setWorkingDirectory(trim(workingDirArg)) CLI_geomFile = getPathRelCWD(geomArg,'geometry') diff --git a/src/IO.f90 b/src/IO.f90 index a0cf850b6..86eb6558e 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -556,27 +556,11 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2) case (603) msg = 'invalid data for table' case (610) - msg = 'missing argument for --geom' + msg = 'no argument value specified' case (611) - msg = 'missing argument for --load' - case (612) - msg = 'missing argument for --material' - case (613) - msg = 'missing argument for --numerics' - case (614) - msg = 'missing argument for --jobname' - case (615) - msg = 'missing argument for --workingdirectory' - case (616) - msg = 'missing argument for --restart' - case (617) msg = 'could not parse restart increment' - case (620) - msg = 'no geometry specified' - case (621) - msg = 'no load case specified' - case (622) - msg = 'no material configuration specified' + case (612) + msg = 'missing argument' case (630) msg = 'JOBNAME must not contain any slashes' case (640) @@ -732,18 +716,21 @@ subroutine panel(paneltype,ID,msg,ext_msg,label1,ID1,label2,ID2) character(len=pSTRLEN) :: formatString integer, parameter :: panelwidth = 69 - character(len=:), allocatable :: msg_,ID_ + character(len=:), allocatable :: msg_,ID_,msg1,msg2 character(len=*), parameter :: DIVIDER = repeat('─',panelwidth) if (.not. present(label1) .and. present(ID1)) error stop 'missing label for value 1' if (.not. present(label2) .and. present(ID2)) error stop 'missing label for value 2' - if ( present(label1) .and. .not. present(ID1)) error stop 'missing value for label 1' - if ( present(label2) .and. .not. present(ID2)) error stop 'missing value for label 2' + + ID_ = IO_intAsStr(ID) + if (present(label1)) msg1 = label1 + if (present(label2)) msg2 = label2 + if (present(ID1)) msg1 = msg1//' '//IO_intAsStr(ID1) + if (present(ID2)) msg2 = msg2//' '//IO_intAsStr(ID2) if (paneltype == 'error') msg_ = achar(27)//'[31m'//trim(msg)//achar(27)//'[0m' if (paneltype == 'warning') msg_ = achar(27)//'[33m'//trim(msg)//achar(27)//'[0m' - ID_ = IO_intAsStr(ID) !$OMP CRITICAL (write2out) write(IO_STDERR,'(/,a)') ' ┌'//DIVIDER//'┐' write(formatString,'(a,i2,a)') '(a,24x,a,1x,i0,',max(1,panelwidth-24-len_trim(paneltype)-1-len_trim(ID_)),'x,a)' @@ -758,14 +745,14 @@ subroutine panel(paneltype,ID,msg,ext_msg,label1,ID1,label2,ID2) write(IO_STDERR,formatString) '│ ',trim(ext_msg), '│' end if if (present(label1)) then - write(formatString,'(a,i3.3,a,i3.3,a)') '(1x,a7,a',max(1,len_trim(label1)),',i9,',& - max(1,panelwidth+3-len_trim(label1)-9-7),'x,a)' - write(IO_STDERR,formatString) '│ at ',trim(label1),ID1, '│' + write(formatString,'(a,i3.3,a,i3.3,a)') '(1x,a7,a',max(1,len_trim(msg1)),',',& + max(1,panelwidth+3-len_trim(msg1)-7),'x,a)' + write(IO_STDERR,formatString) '│ at ',trim(msg1), '│' end if if (present(label2)) then - write(formatString,'(a,i3.3,a,i3.3,a)') '(1x,a7,a',max(1,len_trim(label2)),',i9,',& - max(1,panelwidth+3-len_trim(label2)-9-7),'x,a)' - write(IO_STDERR,formatString) '│ at ',trim(label2),ID2, '│' + write(formatString,'(a,i3.3,a,i3.3,a)') '(1x,a7,a',max(1,len_trim(msg2)),',',& + max(1,panelwidth+3-len_trim(msg2)-7),'x,a)' + write(IO_STDERR,formatString) '│ at ',trim(msg2), '│' end if write(formatString,'(a,i2.2,a)') '(a,',max(1,panelwidth),'x,a)' write(IO_STDERR,formatString) ' │', '│' From 12cb043d6d1f6a4e6b1f7fa063e6ace539284b7a Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 12 Jul 2023 18:48:28 +0200 Subject: [PATCH 04/24] grid solver related changes --- PRIVATE | 2 +- src/IO.f90 | 34 ++++++++++- src/grid/DAMASK_grid.f90 | 15 +++-- src/grid/grid_damage_spectral.f90 | 39 ++++++------ src/grid/grid_mech_FEM.f90 | 47 +++++++------- src/grid/grid_mech_spectral_basic.f90 | 46 ++++++++------ src/grid/grid_mech_spectral_polarisation.f90 | 64 +++++++++++--------- src/grid/grid_thermal_spectral.f90 | 34 ++++++----- src/grid/spectral_utilities.f90 | 23 ++++--- 9 files changed, 182 insertions(+), 122 deletions(-) diff --git a/PRIVATE b/PRIVATE index d61d62667..6c1a6993d 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit d61d62667fb683a61dcc41cd90194a2d9b279879 +Subproject commit 6c1a6993d31c62711553a5ba5d6b0cf5b6620634 diff --git a/src/IO.f90 b/src/IO.f90 index 39a48e1e5..559e60d69 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -22,6 +22,8 @@ module IO character, parameter, public :: & IO_EOL = new_line('DAMASK'), & !< end of line character IO_COMMENT = '#' + character(len=*), parameter :: LOWER = 'abcdefghijklmnopqrstuvwxyz' + character(len=len(LOWER)), parameter :: UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' character, parameter :: & CR = achar(13), & LF = IO_EOL @@ -32,6 +34,7 @@ module IO IO_readlines, & IO_isBlank, & IO_wrapLines, & + IO_postfix, & IO_strPos, & IO_strValue, & IO_intValue, & @@ -238,6 +241,30 @@ pure function IO_strPos(str) end function IO_strPos +!-------------------------------------------------------------------------------------------------- +!> @brief Append postfix to each indicator character that is followed by a lowercase letter. +!-------------------------------------------------------------------------------------------------- +function IO_postfix(string,indicator,postfix) + + character(len=*), intent(in) :: string + character, intent(in) :: indicator + character(len=*), intent(in) :: postfix + character(len=:), allocatable :: IO_postfix + + integer :: i,N + + + IO_postfix = '' + N = len(string) + do i = 1, N + IO_postfix = IO_postfix//string(i:i) + if (string(i:i) == indicator .and. verify(IO_lc(string(min(i+1,N):min(i+1,N))),LOWER) == 0) & + IO_postfix = IO_postfix//postfix + end do + +end function IO_postfix + + !-------------------------------------------------------------------------------------------------- !> @brief Read string value at myChunk from string. !-------------------------------------------------------------------------------------------------- @@ -294,9 +321,6 @@ pure function IO_lc(str) character(len=*), intent(in) :: str !< string to convert character(len=len(str)) :: IO_lc - character(len=*), parameter :: LOWER = 'abcdefghijklmnopqrstuvwxyz' - character(len=len(LOWER)), parameter :: UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - integer :: i,n @@ -832,6 +856,10 @@ subroutine selfTest() if ('abc,'//IO_EOL//'xxdefg,'//IO_EOL//'xxhij' /= IO_wrapLines('abc,defg, hij',filler='xx',length=4)) & error stop 'IO_wrapLines/7' + str='-a -1 -more 123 -flag -' + out=IO_postfix(str,'-+','p_') + if (out /= '-p_a -1 -p_more 123 -p_flag -') error stop 'IO_postfix' + end subroutine selfTest end module IO diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 443f69f9c..63ef96b4c 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -108,6 +108,7 @@ program DAMASK_grid quit type(tDict), pointer :: & config_load, & + num_solver, & num_grid, & load_step, & solver, & @@ -122,6 +123,7 @@ program DAMASK_grid character(len=:), allocatable :: & fileContent, fname + !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) @@ -151,9 +153,12 @@ program DAMASK_grid end if call parallelization_bcast_str(fileContent) - config_load => YAML_parse_str_asDict(fileContent) + config_load => YAML_parse_str_asDict(fileContent) !ToDo: misleading prefix (overlaps with entities from config module) solver => config_load%get_dict('solver') + num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) + num_grid => num_solver%get_dict('grid',defaultVal=emptyDict) + !-------------------------------------------------------------------------------------------------- ! assign mechanics solver depending on selected type @@ -313,21 +318,21 @@ program DAMASK_grid !-------------------------------------------------------------------------------------------------- ! doing initialization depending on active solvers - call spectral_Utilities_init() + call spectral_utilities_init() do field = 2, nActiveFields select case (ID(field)) case (FIELD_THERMAL_ID) - call grid_thermal_spectral_init() + call grid_thermal_spectral_init(num_grid) case (FIELD_DAMAGE_ID) - call grid_damage_spectral_init() + call grid_damage_spectral_init(num_grid) end select end do - call mechanical_init() + call mechanical_init(num_grid) call config_numerics_deallocate() !-------------------------------------------------------------------------------------------------- diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 90680daea..d50d7d775 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -70,7 +70,9 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all neccessary fields and fills them with data !-------------------------------------------------------------------------------------------------- -subroutine grid_damage_spectral_init() +subroutine grid_damage_spectral_init(num_grid) + + type(tDict), pointer, intent(in) :: num_grid PetscInt, dimension(0:worldsize-1) :: localK integer :: i, j, k, ce @@ -82,10 +84,12 @@ subroutine grid_damage_spectral_init() integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(1,product(cells(1:2))*cells3) :: tempN type(tDict), pointer :: & - num_grid, & - num_generic + num_grid_damage character(len=pSTRLEN) :: & snes_type + character(len=:), allocatable :: & + petsc_options + print'(/,1x,a)', '<<<+- grid_spectral_damage init -+>>>' @@ -96,26 +100,25 @@ subroutine grid_damage_spectral_init() !------------------------------------------------------------------------------------------------- ! read numerical parameters and do sanity checks - num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict) - num%itmax = num_grid%get_asInt ('itmax',defaultVal=250) - num%eps_damage_atol = num_grid%get_asReal ('eps_damage_atol',defaultVal=1.0e-2_pREAL) - num%eps_damage_rtol = num_grid%get_asReal ('eps_damage_rtol',defaultVal=1.0e-6_pREAL) + num_grid_damage => num_grid%get_dict('damage',defaultVal=emptyDict) - num_generic => config_numerics%get_dict('generic',defaultVal=emptyDict) - num%phi_min = num_generic%get_asReal('phi_min', defaultVal=1.0e-6_pREAL) + num%itmax = num_grid_damage%get_asInt('N_iter_max', defaultVal=250) - if (num%phi_min < 0.0_pREAL) call IO_error(301,ext_msg='phi_min') - if (num%itmax <= 1) call IO_error(301,ext_msg='itmax') - if (num%eps_damage_atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_damage_atol') - if (num%eps_damage_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_damage_rtol') + num%eps_damage_atol = num_grid_damage%get_asReal('eps_abs_phi',defaultVal=1.0e-2_pReal) + num%eps_damage_rtol = num_grid_damage%get_asReal('eps_rel_phi',defaultVal=1.0e-6_pReal) + num%phi_min = num_grid_damage%get_asReal('phi_min', defaultVal=1.0e-6_pReal) + + if (num%phi_min < 0.0_pReal) call IO_error(301,ext_msg='phi_min') + if (num%itmax <= 1) call IO_error(301,ext_msg='N_iter_max') + if (num%eps_damage_atol <= 0.0_pReal) call IO_error(301,ext_msg='eps_abs_phi') + if (num%eps_damage_rtol <= 0.0_pReal) call IO_error(301,ext_msg='eps_rel_phi') !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-damage_snes_type newtonls -damage_snes_mf & - &-damage_snes_ksp_ew -damage_ksp_type fgmres',err_PETSc) - CHKERRQ(err_PETSc) - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asStr('petsc_options',defaultVal=''),err_PETSc) - CHKERRQ(err_PETSc) + petsc_options = IO_postfix('-snes_type newtonls -snes_mf -snes_ksp_ew -ksp_type fgmres '// & + num_grid_damage%get_asStr('PETSc_options',defaultVal=''), '-','damage_') + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) + CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- ! init fields diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 17bf01ac0..5974a0ab8 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -94,9 +94,11 @@ module grid_mechanical_FEM contains !-------------------------------------------------------------------------------------------------- -!> @brief allocates all necessary fields and fills them with data, potentially from restart info +!> @brief Allocate all necessary fields and fills them with data, potentially from restart info. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_FEM_init +subroutine grid_mechanical_FEM_init(num_grid) + + type(tDict), pointer, intent(in) :: num_grid real(pREAL), parameter :: HGCoeff = 0.0e-2_pREAL real(pREAL), parameter, dimension(4,8) :: & @@ -118,41 +120,42 @@ subroutine grid_mechanical_FEM_init PetscInt, dimension(0:worldsize-1) :: localK integer(HID_T) :: fileHandle, groupHandle type(tDict), pointer :: & - num_grid + num_grid_mech character(len=pSTRLEN) :: & extmsg = '' + character(len=:), allocatable :: & + petsc_options print'(/,1x,a)', '<<<+- grid_mechanical_FEM init -+>>>'; flush(IO_STDOUT) !------------------------------------------------------------------------------------------------- ! read numerical parameters and do sanity checks - num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict) + num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) - num%eps_div_atol = num_grid%get_asReal('eps_div_atol', defaultVal=1.0e-4_pREAL) - num%eps_div_rtol = num_grid%get_asReal('eps_div_rtol', defaultVal=5.0e-4_pREAL) - num%eps_stress_atol = num_grid%get_asReal('eps_stress_atol',defaultVal=1.0e3_pREAL) - num%eps_stress_rtol = num_grid%get_asReal('eps_stress_rtol',defaultVal=1.0e-3_pREAL) - num%itmin = num_grid%get_asInt ('itmin',defaultVal=1) - num%itmax = num_grid%get_asInt ('itmax',defaultVal=250) + num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)',defaultVal=1.0e-4_pReal) + num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)',defaultVal=5.0e-4_pReal) + num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pReal) + num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) - if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_div_atol' - if (num%eps_div_rtol < 0.0_pREAL) extmsg = trim(extmsg)//' eps_div_rtol' - if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_stress_atol' - if (num%eps_stress_rtol < 0.0_pREAL) extmsg = trim(extmsg)//' eps_stress_rtol' - if (num%itmax <= 1) extmsg = trim(extmsg)//' itmax' - if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' itmin' + num%itmin = num_grid_mech%get_asInt('N_iter_min',defaultVal=1) + num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=250) + + if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%itmax <= 1) extmsg = trim(extmsg)//' N_iter_max' + if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - call PetscOptionsInsertString(PETSC_NULL_OPTIONS, & - '-mechanical_snes_type newtonls -mechanical_ksp_type fgmres & - &-mechanical_ksp_max_it 25', & - err_PETSc) - CHKERRQ(err_PETSc) - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asStr('petsc_options',defaultVal=''),err_PETSc) + + petsc_options = IO_postfix('-snes_type newtonls -ksp_type fgmres -ksp_max_it 25 '// & + num_grid_mech%get_asStr('PETSc_options',defaultVal=''), '-','mechanical_') + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 70e764549..6cf5c6d0d 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -22,7 +22,6 @@ module grid_mechanical_spectral_basic use math use rotations use spectral_utilities - use config use homogenization use discretization_grid @@ -103,7 +102,9 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all necessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_basic_init() +subroutine grid_mechanical_spectral_basic_init(num_grid) + + type(tDict), pointer, intent(in) :: num_grid real(pREAL), dimension(3,3,cells(1),cells(2),cells3) :: P PetscErrorCode :: err_PETSc @@ -114,9 +115,12 @@ subroutine grid_mechanical_spectral_basic_init() real(pREAL), dimension(3,3,product(cells(1:2))*cells3) :: temp33n integer(HID_T) :: fileHandle, groupHandle type(tDict), pointer :: & - num_grid + num_grid_fft, & + num_grid_mech character(len=pSTRLEN) :: & extmsg = '' + character(len=:), allocatable :: & + petsc_options print'(/,1x,a)', '<<<+- grid_mechanical_spectral_basic init -+>>>'; flush(IO_STDOUT) @@ -129,30 +133,32 @@ subroutine grid_mechanical_spectral_basic_init() !------------------------------------------------------------------------------------------------- ! read numerical parameters and do sanity checks - num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict) + num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict) + num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) - num%update_gamma = num_grid%get_asBool('update_gamma', defaultVal=.false.) - num%eps_div_atol = num_grid%get_asReal('eps_div_atol', defaultVal=1.0e-4_pREAL) - num%eps_div_rtol = num_grid%get_asReal('eps_div_rtol', defaultVal=5.0e-4_pREAL) - num%eps_stress_atol = num_grid%get_asReal('eps_stress_atol',defaultVal=1.0e3_pREAL) - num%eps_stress_rtol = num_grid%get_asReal('eps_stress_rtol',defaultVal=1.0e-3_pREAL) - num%itmin = num_grid%get_asInt ('itmin',defaultVal=1) - num%itmax = num_grid%get_asInt ('itmax',defaultVal=250) + num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) + num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=250) - if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_div_atol' - if (num%eps_div_rtol < 0.0_pREAL) extmsg = trim(extmsg)//' eps_div_rtol' - if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_stress_atol' - if (num%eps_stress_rtol < 0.0_pREAL) extmsg = trim(extmsg)//' eps_stress_rtol' - if (num%itmax <= 1) extmsg = trim(extmsg)//' itmax' - if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' itmin' + num%update_gamma = num_grid_fft%get_asBool ('update_gamma',defaultVal=.false.) + + num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal) + num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal) + num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pReal) + num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) + + if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%itmax <= 1) extmsg = trim(extmsg)//' N_iter_max' + if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mechanical_snes_type ngmres',err_PETSc) - CHKERRQ(err_PETSc) - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asStr('petsc_options',defaultVal=''),err_PETSc) + petsc_options = IO_postfix('-snes_type ngmres '//num_grid_mech%get_asStr('PETSc_options',defaultVal=''), '-','mechanical_') + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 168794316..9111f160c 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -112,9 +112,11 @@ module grid_mechanical_spectral_polarisation contains !-------------------------------------------------------------------------------------------------- -!> @brief allocates all necessary fields and fills them with data, potentially from restart info +!> @brief Allocate all necessary fields and fills them with data, potentially from restart info. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_init() +subroutine grid_mechanical_spectral_polarisation_init(num_grid) + + type(tDict), pointer, intent(in) :: num_grid real(pREAL), dimension(3,3,cells(1),cells(2),cells3) :: P PetscErrorCode :: err_PETSc @@ -127,9 +129,12 @@ subroutine grid_mechanical_spectral_polarisation_init() real(pREAL), dimension(3,3,product(cells(1:2))*cells3) :: temp33n integer(HID_T) :: fileHandle, groupHandle type(tDict), pointer :: & - num_grid + num_grid_fft,& + num_grid_mech character(len=pSTRLEN) :: & extmsg = '' + character(len=:), allocatable :: & + petsc_options print '(/,1x,a)', '<<<+- grid_mechanical_spectral_polarization init -+>>>'; flush(IO_STDOUT) @@ -137,41 +142,42 @@ subroutine grid_mechanical_spectral_polarisation_init() print '(/,1x,a)', 'P. Shanthraj et al., International Journal of Plasticity 66:31–45, 2015' print '( 1x,a)', 'https://doi.org/10.1016/j.ijplas.2014.02.006' - !------------------------------------------------------------------------------------------------- ! read numerical parameters and do sanity checks - num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict) + num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict) + num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) - num%update_gamma = num_grid%get_asBool('update_gamma', defaultVal=.false.) - num%eps_div_atol = num_grid%get_asReal('eps_div_atol', defaultVal=1.0e-4_pREAL) - num%eps_div_rtol = num_grid%get_asReal('eps_div_rtol', defaultVal=5.0e-4_pREAL) - num%eps_curl_atol = num_grid%get_asReal('eps_curl_atol', defaultVal=1.0e-10_pREAL) - num%eps_curl_rtol = num_grid%get_asReal('eps_curl_rtol', defaultVal=5.0e-4_pREAL) - num%eps_stress_atol = num_grid%get_asReal('eps_stress_atol',defaultVal=1.0e3_pREAL) - num%eps_stress_rtol = num_grid%get_asReal('eps_stress_rtol',defaultVal=1.0e-3_pREAL) - num%itmin = num_grid%get_asInt ('itmin', defaultVal=1) - num%itmax = num_grid%get_asInt ('itmax', defaultVal=250) - num%alpha = num_grid%get_asReal('alpha', defaultVal=1.0_pREAL) - num%beta = num_grid%get_asReal('beta', defaultVal=1.0_pREAL) + num%update_gamma = num_grid_fft%get_asBool ('update_gamma',defaultVal=.false.) - if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_div_atol' - if (num%eps_div_rtol < 0.0_pREAL) extmsg = trim(extmsg)//' eps_div_rtol' - if (num%eps_curl_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_curl_atol' - if (num%eps_curl_rtol < 0.0_pREAL) extmsg = trim(extmsg)//' eps_curl_rtol' - if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_stress_atol' - if (num%eps_stress_rtol < 0.0_pREAL) extmsg = trim(extmsg)//' eps_stress_rtol' - if (num%itmax <= 1) extmsg = trim(extmsg)//' itmax' - if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' itmin' - if (num%alpha <= 0.0_pREAL .or. num%alpha > 2.0_pREAL) extmsg = trim(extmsg)//' alpha' - if (num%beta < 0.0_pREAL .or. num%beta > 2.0_pREAL) extmsg = trim(extmsg)//' beta' + num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal) + num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal) + num%eps_curl_atol = num_grid_mech%get_asReal('eps_abs_curl(F)',defaultVal=1.0e-10_pReal) + num%eps_curl_rtol = num_grid_mech%get_asReal('eps_rel_curl(F)',defaultVal=5.0e-4_pReal) + num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pReal) + num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) + num%alpha = num_grid_mech%get_asReal('alpha', defaultVal=1.0_pReal) + num%beta = num_grid_mech%get_asReal('beta', defaultVal=1.0_pReal) + + num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) + num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=250) + + if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_curl_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_curl(F)' + if (num%eps_curl_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)' + if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%itmax <= 1) extmsg = trim(extmsg)//' N_iter_max' + if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' + if (num%alpha <= 0.0_pReal .or. num%alpha > 2.0_pReal) extmsg = trim(extmsg)//' alpha' + if (num%beta < 0.0_pReal .or. num%beta > 2.0_pReal) extmsg = trim(extmsg)//' beta' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mechanical_snes_type ngmres',err_PETSc) - CHKERRQ(err_PETSc) - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asStr('petsc_options',defaultVal=''),err_PETSc) + petsc_options = IO_postfix('-snes_type ngmres '//num_grid_mech%get_asStr('PETSc_options',defaultVal=''), '-','mechanical_') + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 1c3f2129a..9fa471751 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -69,7 +69,9 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all neccessary fields and fills them with data !-------------------------------------------------------------------------------------------------- -subroutine grid_thermal_spectral_init() +subroutine grid_thermal_spectral_init(num_grid) + + type(tDict), pointer, intent(in) :: num_grid PetscInt, dimension(0:worldsize-1) :: localK integer :: i, j, k, ce @@ -80,7 +82,10 @@ subroutine grid_thermal_spectral_init() integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(1,product(cells(1:2))*cells3) :: tempN type(tDict), pointer :: & - num_grid + num_grid_thermal + character(len=:), allocatable :: & + petsc_options + print'(/,1x,a)', '<<<+- grid_thermal_spectral init -+>>>' @@ -91,22 +96,23 @@ subroutine grid_thermal_spectral_init() !------------------------------------------------------------------------------------------------- ! read numerical parameters and do sanity checks - num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict) - num%itmax = num_grid%get_asInt ('itmax', defaultVal=250) - num%eps_thermal_atol = num_grid%get_asReal('eps_thermal_atol',defaultVal=1.0e-2_pREAL) - num%eps_thermal_rtol = num_grid%get_asReal('eps_thermal_rtol',defaultVal=1.0e-6_pREAL) + num_grid_thermal => num_grid%get_dict('thermal',defaultVal=emptyDict) - if (num%itmax <= 1) call IO_error(301,ext_msg='itmax') - if (num%eps_thermal_atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_thermal_atol') - if (num%eps_thermal_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_thermal_rtol') + num%itmax = num_grid_thermal%get_asInt('N_iter_max', defaultVal=250) + + num%eps_thermal_atol = num_grid_thermal%get_asReal('eps_abs_T', defaultVal=1.0e-2_pReal) + num%eps_thermal_rtol = num_grid_thermal%get_asReal('eps_rel_T', defaultVal=1.0e-6_pReal) + + if (num%itmax <= 1) call IO_error(301,ext_msg='N_iter_max') + if (num%eps_thermal_atol <= 0.0_pReal) call IO_error(301,ext_msg='eps_abs_T') + if (num%eps_thermal_rtol <= 0.0_pReal) call IO_error(301,ext_msg='eps_rel_T') !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-thermal_snes_type newtonls -thermal_snes_mf & - &-thermal_snes_ksp_ew -thermal_ksp_type fgmres',err_PETSc) - CHKERRQ(err_PETSc) - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asStr('petsc_options',defaultVal=''),err_PETSc) - CHKERRQ(err_PETSc) + petsc_options = IO_postfix('-snes_type newtonls -snes_mf -snes_ksp_ew -ksp_type fgmres '// & + num_grid_thermal%get_asStr('PETSc_options',defaultVal=''), '-','thermal_') + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) + CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- ! init fields diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 5f82b5a8f..f87dbf3e0 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -146,8 +146,9 @@ subroutine spectral_utilities_init() vectorSize = 3_C_INTPTR_T, & tensorSize = 9_C_INTPTR_T type(tDict) , pointer :: & - num_grid - + num_solver, & + num_grid, & + num_grid_fft print'(/,1x,a)', '<<<+- spectral_utilities init -+>>>' @@ -163,8 +164,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' + num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) + num_grid => num_solver%get_dict('grid',defaultVal=emptyDict) + num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict) - num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict) call PetscOptionsClear(PETSC_NULL_OPTIONS,err_PETSc) CHKERRQ(err_PETSc) call PetscOptionsInsertString(PETSC_NULL_OPTIONS,& @@ -174,13 +177,13 @@ subroutine spectral_utilities_init() cells1Red = cells(1)/2 + 1 wgt = real(product(cells),pREAL)**(-1) - num%memory_efficient = num_grid%get_asInt('memory_efficient', defaultVal=1) > 0 ! ToDo: should be logical in YAML file - num%divergence_correction = num_grid%get_asInt('divergence_correction', defaultVal=2) + num%memory_efficient = num_grid_fft%get_asBool('memory_efficient', defaultVal=.true.) + num%divergence_correction = num_grid_fft%get_asInt('divergence_correction', defaultVal=2) if (num%divergence_correction < 0 .or. num%divergence_correction > 2) & call IO_error(301,ext_msg='divergence_correction') - select case (num_grid%get_asStr('derivative',defaultVal='continuous')) + select case (num_grid_fft%get_asStr('derivative',defaultVal='continuous')) case ('continuous') spectral_derivative_ID = DERIVATIVE_CONTINUOUS_ID case ('central_difference') @@ -188,7 +191,7 @@ subroutine spectral_utilities_init() case ('FWBW_difference') spectral_derivative_ID = DERIVATIVE_FWBW_DIFF_ID case default - call IO_error(892,ext_msg=trim(num_grid%get_asStr('derivative'))) + call IO_error(892,ext_msg=trim(num_grid_fft%get_asStr('derivative'))) end select !-------------------------------------------------------------------------------------------------- @@ -209,7 +212,7 @@ subroutine spectral_utilities_init() scaledGeomSize = geomSize end if - select case(IO_lc(num_grid%get_asStr('fftw_plan_mode',defaultVal='FFTW_MEASURE'))) + select case(IO_lc(num_grid_fft%get_asStr('plan_mode',defaultVal='FFTW_MEASURE'))) case('fftw_estimate') ! ordered from slow execution (but fast plan creation) to fast execution FFTW_planner_flag = FFTW_ESTIMATE case('fftw_measure') @@ -219,14 +222,14 @@ subroutine spectral_utilities_init() case('fftw_exhaustive') FFTW_planner_flag = FFTW_EXHAUSTIVE case default - call IO_warning(47,'using default FFTW_MEASURE instead of "'//trim(num_grid%get_asStr('fftw_plan_mode'))//'"') + call IO_warning(47,'using default FFTW_MEASURE instead of "'//trim(num_grid_fft%get_asStr('plan_mode'))//'"') FFTW_planner_flag = FFTW_MEASURE end select !-------------------------------------------------------------------------------------------------- ! general initialization of FFTW (see manual on fftw.org for more details) if (pREAL /= C_DOUBLE .or. kind(1) /= C_INT) error stop 'C and Fortran datatypes do not match' - call fftw_set_timelimit(num_grid%get_asReal('fftw_timelimit',defaultVal=300.0_pREAL)) + call fftw_set_timelimit(num_grid_fft%get_asReal('fftw_timelimit',defaultVal=300.0_pREAL)) print'(/,1x,a)', 'FFTW initialized'; flush(IO_STDOUT) From 35b8d5fc7fa87bb11b088be7e6bbfe1a93ee516e Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Thu, 13 Jul 2023 18:02:00 +0200 Subject: [PATCH 05/24] missing parameters of grid added to the current structure --- src/grid/DAMASK_grid.f90 | 17 +++++++++-------- src/grid/grid_damage_spectral.f90 | 8 ++++---- src/grid/grid_mech_FEM.f90 | 6 +++--- src/grid/grid_mech_spectral_basic.f90 | 6 +++--- src/grid/grid_mech_spectral_polarisation.f90 | 6 +++--- src/grid/grid_thermal_spectral.f90 | 6 +++--- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 63ef96b4c..f55927186 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -136,12 +136,16 @@ program DAMASK_grid !------------------------------------------------------------------------------------------------- ! 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) - if (stagItMax < 0) call IO_error(301,ext_msg='maxStaggeredIter') - if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack') + num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) + num_grid => num_solver%get_dict('grid',defaultVal=emptyDict) + + stagItMax = num_grid%get_asInt('N_staggered_iter_max',defaultVal=10) + maxCutBack = num_grid%get_asInt('N_cutback_max',defaultVal=3) + + if (stagItMax < 0) call IO_error(301,ext_msg='N_staggered_iter_max') + if (maxCutBack < 0) call IO_error(301,ext_msg='N_cutback_max') + if (worldrank == 0) then fileContent = IO_read(CLI_loadFile) @@ -156,9 +160,6 @@ program DAMASK_grid config_load => YAML_parse_str_asDict(fileContent) !ToDo: misleading prefix (overlaps with entities from config module) solver => config_load%get_dict('solver') - num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) - num_grid => num_solver%get_dict('grid',defaultVal=emptyDict) - !-------------------------------------------------------------------------------------------------- ! assign mechanics solver depending on selected type diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index d50d7d775..a98d31a41 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -68,7 +68,7 @@ module grid_damage_spectral contains !-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields and fills them with data +!> @brief Allocate all necessary fields and fill them with data, potentially from restart file. !-------------------------------------------------------------------------------------------------- subroutine grid_damage_spectral_init(num_grid) @@ -102,14 +102,14 @@ subroutine grid_damage_spectral_init(num_grid) ! read numerical parameters and do sanity checks num_grid_damage => num_grid%get_dict('damage',defaultVal=emptyDict) - num%itmax = num_grid_damage%get_asInt('N_iter_max', defaultVal=250) + num%itmax = num_grid_damage%get_asInt('N_iter_max', defaultVal=100) num%eps_damage_atol = num_grid_damage%get_asReal('eps_abs_phi',defaultVal=1.0e-2_pReal) num%eps_damage_rtol = num_grid_damage%get_asReal('eps_rel_phi',defaultVal=1.0e-6_pReal) num%phi_min = num_grid_damage%get_asReal('phi_min', defaultVal=1.0e-6_pReal) - if (num%phi_min < 0.0_pReal) call IO_error(301,ext_msg='phi_min') - if (num%itmax <= 1) call IO_error(301,ext_msg='N_iter_max') + if (num%phi_min < 0.0_pReal) call IO_error(301,ext_msg='phi_min') + if (num%itmax < 1) call IO_error(301,ext_msg='N_iter_max') if (num%eps_damage_atol <= 0.0_pReal) call IO_error(301,ext_msg='eps_abs_phi') if (num%eps_damage_rtol <= 0.0_pReal) call IO_error(301,ext_msg='eps_rel_phi') diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 5974a0ab8..742dea552 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -94,7 +94,7 @@ module grid_mechanical_FEM contains !-------------------------------------------------------------------------------------------------- -!> @brief Allocate all necessary fields and fills them with data, potentially from restart info. +!> @brief Allocate all necessary fields and fill them with data, potentially from restart info. !-------------------------------------------------------------------------------------------------- subroutine grid_mechanical_FEM_init(num_grid) @@ -139,13 +139,13 @@ subroutine grid_mechanical_FEM_init(num_grid) num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) num%itmin = num_grid_mech%get_asInt('N_iter_min',defaultVal=1) - num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=250) + num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100) if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' - if (num%itmax <= 1) extmsg = trim(extmsg)//' N_iter_max' + if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 6cf5c6d0d..a4dc1dd1c 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -100,7 +100,7 @@ module grid_mechanical_spectral_basic contains !-------------------------------------------------------------------------------------------------- -!> @brief allocates all necessary fields and fills them with data, potentially from restart info +!> @brief Allocate all necessary fields and fill them with data, potentially from restart info. !-------------------------------------------------------------------------------------------------- subroutine grid_mechanical_spectral_basic_init(num_grid) @@ -137,7 +137,7 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) - num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=250) + num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) num%update_gamma = num_grid_fft%get_asBool ('update_gamma',defaultVal=.false.) @@ -150,7 +150,7 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' - if (num%itmax <= 1) extmsg = trim(extmsg)//' N_iter_max' + if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 9111f160c..9f64539d4 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -112,7 +112,7 @@ module grid_mechanical_spectral_polarisation contains !-------------------------------------------------------------------------------------------------- -!> @brief Allocate all necessary fields and fills them with data, potentially from restart info. +!> @brief Allocate all necessary fields and fill them with data, potentially from restart info. !-------------------------------------------------------------------------------------------------- subroutine grid_mechanical_spectral_polarisation_init(num_grid) @@ -159,7 +159,7 @@ subroutine grid_mechanical_spectral_polarisation_init(num_grid) num%beta = num_grid_mech%get_asReal('beta', defaultVal=1.0_pReal) num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) - num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=250) + num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' @@ -167,7 +167,7 @@ subroutine grid_mechanical_spectral_polarisation_init(num_grid) if (num%eps_curl_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' - if (num%itmax <= 1) extmsg = trim(extmsg)//' N_iter_max' + if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (num%alpha <= 0.0_pReal .or. num%alpha > 2.0_pReal) extmsg = trim(extmsg)//' alpha' if (num%beta < 0.0_pReal .or. num%beta > 2.0_pReal) extmsg = trim(extmsg)//' beta' diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 9fa471751..bb69ce8ae 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -67,7 +67,7 @@ module grid_thermal_spectral contains !-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields and fills them with data +!> @brief Allocate all necessary fields and fill them with data, potentially from restart info. !-------------------------------------------------------------------------------------------------- subroutine grid_thermal_spectral_init(num_grid) @@ -98,12 +98,12 @@ subroutine grid_thermal_spectral_init(num_grid) ! read numerical parameters and do sanity checks num_grid_thermal => num_grid%get_dict('thermal',defaultVal=emptyDict) - num%itmax = num_grid_thermal%get_asInt('N_iter_max', defaultVal=250) + num%itmax = num_grid_thermal%get_asInt('N_iter_max', defaultVal=100) num%eps_thermal_atol = num_grid_thermal%get_asReal('eps_abs_T', defaultVal=1.0e-2_pReal) num%eps_thermal_rtol = num_grid_thermal%get_asReal('eps_rel_T', defaultVal=1.0e-6_pReal) - if (num%itmax <= 1) call IO_error(301,ext_msg='N_iter_max') + if (num%itmax < 1) call IO_error(301,ext_msg='N_iter_max') if (num%eps_thermal_atol <= 0.0_pReal) call IO_error(301,ext_msg='eps_abs_T') if (num%eps_thermal_rtol <= 0.0_pReal) call IO_error(301,ext_msg='eps_rel_T') From b235742472c083e7fe97183269f671ac763241ff Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 14 Jul 2023 10:23:23 -0400 Subject: [PATCH 06/24] clearer error messages --- src/CLI.f90 | 6 +++--- src/IO.f90 | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index ce2f68ed7..ed7fbcd5e 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -183,9 +183,9 @@ subroutine CLI_init() end select end do - if (.not. allocated(geomArg)) call IO_error(612,ext_msg='--help for instructions',label1='--geom') - if (.not. allocated(loadArg)) call IO_error(612,ext_msg='--help for instructions',label1='--load') - if (.not. allocated(materialArg)) call IO_error(612,ext_msg='--help for instructions',label1='--material') + if (.not. allocated(geomArg)) call IO_error(612,ext_msg='--geom') + if (.not. allocated(loadArg)) call IO_error(612,ext_msg='--load') + if (.not. allocated(materialArg)) call IO_error(612,ext_msg='--material') call setWorkingDirectory(trim(workingDirArg)) CLI_geomFile = getPathRelCWD(geomArg,'geometry') diff --git a/src/IO.f90 b/src/IO.f90 index 86eb6558e..0a8f7b07e 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -556,11 +556,11 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2) case (603) msg = 'invalid data for table' case (610) - msg = 'no argument value specified' + msg = 'missing argument for option' case (611) msg = 'could not parse restart increment' case (612) - msg = 'missing argument' + msg = 'missing option' case (630) msg = 'JOBNAME must not contain any slashes' case (640) From e1630e4057896047d956da2724277df3397a143a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 15 Jul 2023 20:28:57 +0200 Subject: [PATCH 07/24] consistent naming with Python module --- src/CMakeLists.txt | 2 +- src/IO.f90 | 2 +- src/Marc/DAMASK_Marc.f90 | 2 +- src/Marc/materialpoint_Marc.f90 | 4 +- src/{lattice.f90 => crystal.f90} | 316 +++++++++--------- src/homogenization.f90 | 2 +- src/homogenization_mechanical_RGC.f90 | 4 +- src/materialpoint.f90 | 4 +- src/phase.f90 | 4 +- src/phase_damage_anisobrittle.f90 | 2 +- ...hase_mechanical_eigen_thermalexpansion.f90 | 2 +- src/phase_mechanical_elastic.f90 | 6 +- ...phase_mechanical_plastic_dislotungsten.f90 | 14 +- src/phase_mechanical_plastic_dislotwin.f90 | 36 +- ...phase_mechanical_plastic_kinehardening.f90 | 10 +- src/phase_mechanical_plastic_nonlocal.f90 | 20 +- ...phase_mechanical_plastic_phenopowerlaw.f90 | 22 +- src/phase_thermal.f90 | 2 +- 18 files changed, 227 insertions(+), 227 deletions(-) rename src/{lattice.f90 => crystal.f90} (94%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2cf442bf8..fc9217f31 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ # special flags for some files if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") # long lines for interaction matrix - set_source_files_properties("lattice.f90" PROPERTIES COMPILE_FLAGS "-ffree-line-length-240") + set_source_files_properties("crystal.f90" PROPERTIES COMPILE_FLAGS "-ffree-line-length-240") set_source_files_properties("parallelization.f90" PROPERTIES COMPILE_FLAGS "-ffree-line-length-none") endif() diff --git a/src/IO.f90 b/src/IO.f90 index 39a48e1e5..e1b9f4578 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -476,7 +476,7 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2) case (131) msg = 'hex lattice structure with invalid c/a ratio' case (132) - msg = 'trans_lattice_structure not possible' + msg = 'invalid parameters for transformation' case (134) msg = 'negative lattice parameter' case (135) diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index 032c77394..fc63a8ab1 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -155,7 +155,7 @@ end module DAMASK_interface #include "../rotations.f90" #include "../polynomials.f90" #include "../tables.f90" -#include "../lattice.f90" +#include "../crystal.f90" #include "element.f90" #include "../geometry_plastic_nonlocal.f90" #include "../discretization.f90" diff --git a/src/Marc/materialpoint_Marc.f90 b/src/Marc/materialpoint_Marc.f90 index 151b9c1d2..0e3835924 100644 --- a/src/Marc/materialpoint_Marc.f90 +++ b/src/Marc/materialpoint_Marc.f90 @@ -16,7 +16,7 @@ module materialpoint_Marc use rotations use polynomials use tables - use lattice + use crystal use material use phase use homogenization @@ -75,7 +75,7 @@ subroutine materialpoint_initAll() call rotations_init() call polynomials_init() call tables_init() - call lattice_init() + call crystal_init() call discretization_Marc_init() call material_init(.false.) call phase_init() diff --git a/src/lattice.f90 b/src/crystal.f90 similarity index 94% rename from src/lattice.f90 rename to src/crystal.f90 index c44e775db..724949180 100644 --- a/src/lattice.f90 +++ b/src/crystal.f90 @@ -3,10 +3,10 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief contains lattice definitions including Schmid matrices for slip, twin, trans, -! and cleavage as well as interaction among the various systems +!> @brief Contains crystal definitions including Schmid matrices for slip, twin, trans, +! and cleavage as well as interaction among the various systems. !-------------------------------------------------------------------------------------------------- -module lattice +module crystal use prec use misc use IO @@ -80,7 +80,7 @@ module lattice ],pREAL),shape(CF_SYSTEMTWIN)) !< cF twin systems integer, dimension(2,CF_NTWIN), parameter, public :: & - lattice_CF_TWINNUCLEATIONSLIPPAIR = reshape( [& + crystal_CF_TWINNUCLEATIONSLIPPAIR = reshape( [& 2,3, & 1,3, & 1,2, & @@ -93,7 +93,7 @@ module lattice 11,12, & 10,12, & 10,11 & - ],shape(lattice_CF_TWINNUCLEATIONSLIPPAIR)) + ],shape(crystal_CF_TWINNUCLEATIONSLIPPAIR)) real(pREAL), dimension(3+3,CF_NCLEAVAGE), parameter :: & CF_SYSTEMCLEAVAGE = reshape(real([& @@ -367,60 +367,60 @@ module lattice ],pREAL),shape(TI_SYSTEMSLIP)) !< tI slip systems for c/a = 0.5456 (Sn), sorted by Bieler 2009 (https://doi.org/10.1007/s11664-009-0909-x) - interface lattice_forestProjection_edge + interface crystal_forestProjection_edge module procedure slipProjection_transverse - end interface lattice_forestProjection_edge + end interface crystal_forestProjection_edge - interface lattice_forestProjection_screw + interface crystal_forestProjection_screw module procedure slipProjection_direction - end interface lattice_forestProjection_screw + end interface crystal_forestProjection_screw public :: & - lattice_init, & - lattice_isotropic_nu, & - lattice_isotropic_mu, & - lattice_symmetrize_33, & - lattice_symmetrize_C66, & - lattice_SchmidMatrix_slip, & - lattice_SchmidMatrix_twin, & - lattice_SchmidMatrix_trans, & - lattice_SchmidMatrix_cleavage, & - lattice_nonSchmidMatrix, & - lattice_interaction_SlipBySlip, & - lattice_interaction_TwinByTwin, & - lattice_interaction_TransByTrans, & - lattice_interaction_SlipByTwin, & - lattice_interaction_SlipByTrans, & - lattice_interaction_TwinBySlip, & - lattice_characteristicShear_Twin, & - lattice_C66_twin, & - lattice_C66_trans, & - lattice_forestProjection_edge, & - lattice_forestProjection_screw, & - lattice_slip_normal, & - lattice_slip_direction, & - lattice_slip_transverse, & - lattice_labels_slip, & - lattice_labels_twin + crystal_init, & + crystal_isotropic_nu, & + crystal_isotropic_mu, & + crystal_symmetrize_33, & + crystal_symmetrize_C66, & + crystal_SchmidMatrix_slip, & + crystal_SchmidMatrix_twin, & + crystal_SchmidMatrix_trans, & + crystal_SchmidMatrix_cleavage, & + crystal_nonSchmidMatrix, & + crystal_interaction_SlipBySlip, & + crystal_interaction_TwinByTwin, & + crystal_interaction_TransByTrans, & + crystal_interaction_SlipByTwin, & + crystal_interaction_SlipByTrans, & + crystal_interaction_TwinBySlip, & + crystal_characteristicShear_Twin, & + crystal_C66_twin, & + crystal_C66_trans, & + crystal_forestProjection_edge, & + crystal_forestProjection_screw, & + crystal_slip_normal, & + crystal_slip_direction, & + crystal_slip_transverse, & + crystal_labels_slip, & + crystal_labels_twin contains !-------------------------------------------------------------------------------------------------- !> @brief Run self test. !-------------------------------------------------------------------------------------------------- -subroutine lattice_init() +subroutine crystal_init() - print'(/,1x,a)', '<<<+- lattice init -+>>>'; flush(IO_STDOUT) + print'(/,1x,a)', '<<<+- crystal init -+>>>'; flush(IO_STDOUT) call selfTest() -end subroutine lattice_init +end subroutine crystal_init !-------------------------------------------------------------------------------------------------- !> @brief Characteristic shear for twinning !-------------------------------------------------------------------------------------------------- -function lattice_characteristicShear_Twin(Ntwin,lattice,CoverA) result(characteristicShear) +function crystal_characteristicShear_Twin(Ntwin,lattice,CoverA) result(characteristicShear) integer, dimension(:), intent(in) :: Ntwin !< number of active twin systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -470,7 +470,7 @@ function lattice_characteristicShear_Twin(Ntwin,lattice,CoverA) result(character characteristicShear(a) = 0.5_pREAL*sqrt(2.0_pREAL) case('hP') if (cOverA < 1.0_pREAL .or. cOverA > 2.0_pREAL) & - call IO_error(131,ext_msg='lattice_characteristicShear_Twin') + call IO_error(131,ext_msg='crystal_characteristicShear_Twin') p = sum(HP_NTWINSYSTEM(1:f-1))+s select case(HP_SHEARTWIN(p)) ! from Christian & Mahajan 1995 p.29 case (1) ! <-10.1>{10.2} @@ -483,24 +483,24 @@ function lattice_characteristicShear_Twin(Ntwin,lattice,CoverA) result(character characteristicShear(a) = 2.0_pREAL*(cOverA**2-2.0_pREAL)/3.0_pREAL/cOverA end select case default - call IO_error(137,ext_msg='lattice_characteristicShear_Twin: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_characteristicShear_Twin: '//trim(lattice)) end select end do mySystems end do myFamilies -end function lattice_characteristicShear_Twin +end function crystal_characteristicShear_Twin !-------------------------------------------------------------------------------------------------- !> @brief Rotated elasticity matrices for twinning in 6x6-matrix notation !-------------------------------------------------------------------------------------------------- -function lattice_C66_twin(Ntwin,C66,lattice,CoverA) +function crystal_C66_twin(Ntwin,C66,lattice,CoverA) integer, dimension(:), intent(in) :: Ntwin !< number of active twin systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) real(pREAL), dimension(6,6), intent(in) :: C66 !< unrotated parent stiffness matrix real(pREAL), intent(in) :: cOverA !< c/a ratio - real(pREAL), dimension(6,6,sum(Ntwin)) :: lattice_C66_twin + real(pREAL), dimension(6,6,sum(Ntwin)) :: crystal_C66_twin real(pREAL), dimension(3,3,sum(Ntwin)):: coordinateSystem type(tRotation) :: R @@ -518,28 +518,28 @@ function lattice_C66_twin(Ntwin,C66,lattice,CoverA) coordinateSystem = buildCoordinateSystem(Ntwin,HP_NSLIPSYSTEM,HP_SYSTEMTWIN,& lattice,cOverA) case default - call IO_error(137,ext_msg='lattice_C66_twin: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_C66_twin: '//trim(lattice)) end select do i = 1, sum(Ntwin) call R%fromAxisAngle([coordinateSystem(1:3,2,i),PI],P=1) ! ToDo: Why always 180 deg? - lattice_C66_twin(1:6,1:6,i) = R%rotStiffness(C66) + crystal_C66_twin(1:6,1:6,i) = R%rotStiffness(C66) end do -end function lattice_C66_twin +end function crystal_C66_twin !-------------------------------------------------------------------------------------------------- !> @brief Rotated elasticity matrices for transformation in 6x6-matrix notation !-------------------------------------------------------------------------------------------------- -function lattice_C66_trans(Ntrans,C_parent66,lattice_target, & +function crystal_C66_trans(Ntrans,C_parent66,crystal_target, & cOverA_trans,a_cF,a_cI) integer, dimension(:), intent(in) :: Ntrans !< number of active twin systems per family - character(len=*), intent(in) :: lattice_target !< Bravais lattice (Pearson symbol) + character(len=*), intent(in) :: crystal_target !< Bravais lattice (Pearson symbol) real(pREAL), dimension(6,6), intent(in) :: C_parent66 real(pREAL), optional, intent(in) :: cOverA_trans, a_cF, a_cI - real(pREAL), dimension(6,6,sum(Ntrans)) :: lattice_C66_trans + real(pREAL), dimension(6,6,sum(Ntrans)) :: crystal_C66_trans real(pREAL), dimension(6,6) :: C_bar66, C_target_unrotated66 real(pREAL), dimension(3,3,sum(Ntrans)) :: Q,S @@ -548,11 +548,11 @@ function lattice_C66_trans(Ntrans,C_parent66,lattice_target, & !-------------------------------------------------------------------------------------------------- ! elasticity matrix of the target phase in cube orientation - if (lattice_target == 'hP' .and. present(cOverA_trans)) then + if (crystal_target == 'hP' .and. present(cOverA_trans)) then ! https://doi.org/10.1063/1.1663858 eq. (16), eq. (18), eq. (19) ! https://doi.org/10.1016/j.actamat.2016.07.032 eq. (47), eq. (48) if (cOverA_trans < 1.0_pREAL .or. cOverA_trans > 2.0_pREAL) & - call IO_error(131,ext_msg='lattice_C66_trans: '//trim(lattice_target)) + call IO_error(131,ext_msg='crystal_C66_trans: '//trim(crystal_target)) C_bar66(1,1) = (C_parent66(1,1) + C_parent66(1,2) + 2.0_pREAL*C_parent66(4,4))/2.0_pREAL C_bar66(1,2) = (C_parent66(1,1) + 5.0_pREAL*C_parent66(1,2) - 2.0_pREAL*C_parent66(4,4))/6.0_pREAL C_bar66(3,3) = (C_parent66(1,1) + 2.0_pREAL*C_parent66(1,2) + 4.0_pREAL*C_parent66(4,4))/3.0_pREAL @@ -566,13 +566,13 @@ function lattice_C66_trans(Ntrans,C_parent66,lattice_target, & C_target_unrotated66(1,3) = C_bar66(1,3) C_target_unrotated66(3,3) = C_bar66(3,3) C_target_unrotated66(4,4) = C_bar66(4,4) - C_bar66(1,4)**2/(0.5_pREAL*(C_bar66(1,1) - C_bar66(1,2))) - C_target_unrotated66 = lattice_symmetrize_C66(C_target_unrotated66,'hP') - elseif (lattice_target == 'cI' .and. present(a_cF) .and. present(a_cI)) then + C_target_unrotated66 = crystal_symmetrize_C66(C_target_unrotated66,'hP') + elseif (crystal_target == 'cI' .and. present(a_cF) .and. present(a_cI)) then if (a_cI <= 0.0_pREAL .or. a_cF <= 0.0_pREAL) & - call IO_error(134,ext_msg='lattice_C66_trans: '//trim(lattice_target)) + call IO_error(134,ext_msg='crystal_C66_trans: '//trim(crystal_target)) C_target_unrotated66 = C_parent66 else - call IO_error(137,ext_msg='lattice_C66_trans : '//trim(lattice_target)) + call IO_error(137,ext_msg='crystal_C66_trans : '//trim(crystal_target)) end if do i = 1,6 @@ -584,10 +584,10 @@ function lattice_C66_trans(Ntrans,C_parent66,lattice_target, & do i = 1,sum(Ntrans) call R%fromMatrix(Q(1:3,1:3,i)) - lattice_C66_trans(1:6,1:6,i) = R%rotStiffness(C_target_unrotated66) + crystal_C66_trans(1:6,1:6,i) = R%rotStiffness(C_target_unrotated66) end do - end function lattice_C66_trans + end function crystal_C66_trans !-------------------------------------------------------------------------------------------------- @@ -595,7 +595,7 @@ function lattice_C66_trans(Ntrans,C_parent66,lattice_target, & ! https://doi.org/10.1016/j.actamat.2012.03.053, eq. (17) ! https://doi.org/10.1016/j.actamat.2008.07.037, table 1 !-------------------------------------------------------------------------------------------------- -function lattice_nonSchmidMatrix(Nslip,nonSchmidCoefficients,sense) result(nonSchmidMatrix) +function crystal_nonSchmidMatrix(Nslip,nonSchmidCoefficients,sense) result(nonSchmidMatrix) integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family real(pREAL), dimension(:), intent(in) :: nonSchmidCoefficients !< non-Schmid coefficients for projections @@ -608,11 +608,11 @@ function lattice_nonSchmidMatrix(Nslip,nonSchmidCoefficients,sense) result(nonSc integer :: i - if (abs(sense) /= 1) error stop 'Sense in lattice_nonSchmidMatrix' + if (abs(sense) /= 1) error stop 'Sense in crystal_nonSchmidMatrix' coordinateSystem = buildCoordinateSystem(Nslip,CI_NSLIPSYSTEM,CI_SYSTEMSLIP,'cI',0.0_pREAL) coordinateSystem(1:3,1,1:sum(Nslip)) = coordinateSystem(1:3,1,1:sum(Nslip))*real(sense,pREAL) ! convert unidirectional coordinate system - nonSchmidMatrix = lattice_SchmidMatrix_slip(Nslip,'cI',0.0_pREAL) ! Schmid contribution + nonSchmidMatrix = crystal_SchmidMatrix_slip(Nslip,'cI',0.0_pREAL) ! Schmid contribution do i = 1,sum(Nslip) direction = coordinateSystem(1:3,1,i) @@ -635,7 +635,7 @@ function lattice_nonSchmidMatrix(Nslip,nonSchmidCoefficients,sense) result(nonSc + nonSchmidCoefficients(6) * math_outer(direction, direction) end do -end function lattice_nonSchmidMatrix +end function crystal_nonSchmidMatrix !-------------------------------------------------------------------------------------------------- @@ -644,7 +644,7 @@ end function lattice_nonSchmidMatrix !> @details https://doi.org/10.1016/j.actamat.2016.12.040 (cF: Tab S4-1, cI: Tab S5-1) !> @details https://doi.org/10.1016/j.ijplas.2014.06.010 (hP: Tab 3b) !-------------------------------------------------------------------------------------------------- -function lattice_interaction_SlipBySlip(Nslip,interactionValues,lattice) result(interactionMatrix) +function crystal_interaction_SlipBySlip(Nslip,interactionValues,lattice) result(interactionMatrix) integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family real(pREAL), dimension(:), intent(in) :: interactionValues !< values for slip-slip interaction @@ -950,19 +950,19 @@ function lattice_interaction_SlipBySlip(Nslip,interactionValues,lattice) result( interactionTypes = TI_INTERACTIONSLIPSLIP NslipMax = TI_NSLIPSYSTEM case default - call IO_error(137,ext_msg='lattice_interaction_SlipBySlip: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_interaction_SlipBySlip: '//trim(lattice)) end select interactionMatrix = buildInteraction(Nslip,Nslip,NslipMax,NslipMax,interactionValues,interactionTypes) -end function lattice_interaction_SlipBySlip +end function crystal_interaction_SlipBySlip !-------------------------------------------------------------------------------------------------- !> @brief Twin-twin interaction matrix !> details only active twin systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_interaction_TwinByTwin(Ntwin,interactionValues,lattice) result(interactionMatrix) +function crystal_interaction_TwinByTwin(Ntwin,interactionValues,lattice) result(interactionMatrix) integer, dimension(:), intent(in) :: Ntwin !< number of active twin systems per family real(pREAL), dimension(:), intent(in) :: interactionValues !< values for twin-twin interaction @@ -1049,19 +1049,19 @@ function lattice_interaction_TwinByTwin(Ntwin,interactionValues,lattice) result( interactionTypes = HP_INTERACTIONTWINTWIN NtwinMax = HP_NTWINSYSTEM case default - call IO_error(137,ext_msg='lattice_interaction_TwinByTwin: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_interaction_TwinByTwin: '//trim(lattice)) end select interactionMatrix = buildInteraction(Ntwin,Ntwin,NtwinMax,NtwinMax,interactionValues,interactionTypes) -end function lattice_interaction_TwinByTwin +end function crystal_interaction_TwinByTwin !-------------------------------------------------------------------------------------------------- !> @brief Trans-trans interaction matrix !> details only active trans systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_interaction_TransByTrans(Ntrans,interactionValues,lattice) result(interactionMatrix) +function crystal_interaction_TransByTrans(Ntrans,interactionValues,lattice) result(interactionMatrix) integer, dimension(:), intent(in) :: Ntrans !< number of active trans systems per family real(pREAL), dimension(:), intent(in) :: interactionValues !< values for trans-trans interaction @@ -1091,19 +1091,19 @@ function lattice_interaction_TransByTrans(Ntrans,interactionValues,lattice) resu interactionTypes = CF_INTERACTIONTRANSTRANS NtransMax = CF_NTRANSSYSTEM else - call IO_error(137,ext_msg='lattice_interaction_TransByTrans: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_interaction_TransByTrans: '//trim(lattice)) end if interactionMatrix = buildInteraction(Ntrans,Ntrans,NtransMax,NtransMax,interactionValues,interactionTypes) -end function lattice_interaction_TransByTrans +end function crystal_interaction_TransByTrans !-------------------------------------------------------------------------------------------------- !> @brief Slip-twin interaction matrix !> details only active slip and twin systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_interaction_SlipByTwin(Nslip,Ntwin,interactionValues,lattice) result(interactionMatrix) +function crystal_interaction_SlipByTwin(Nslip,Ntwin,interactionValues,lattice) result(interactionMatrix) integer, dimension(:), intent(in) :: Nslip, & !< number of active slip systems per family Ntwin !< number of active twin systems per family @@ -1251,19 +1251,19 @@ function lattice_interaction_SlipByTwin(Nslip,Ntwin,interactionValues,lattice) r NslipMax = HP_NSLIPSYSTEM NtwinMax = HP_NTWINSYSTEM case default - call IO_error(137,ext_msg='lattice_interaction_SlipByTwin: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_interaction_SlipByTwin: '//trim(lattice)) end select interactionMatrix = buildInteraction(Nslip,Ntwin,NslipMax,NtwinMax,interactionValues,interactionTypes) -end function lattice_interaction_SlipByTwin +end function crystal_interaction_SlipByTwin !-------------------------------------------------------------------------------------------------- !> @brief Slip-trans interaction matrix !> details only active slip and trans systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_interaction_SlipByTrans(Nslip,Ntrans,interactionValues,lattice) result(interactionMatrix) +function crystal_interaction_SlipByTrans(Nslip,Ntrans,interactionValues,lattice) result(interactionMatrix) integer, dimension(:), intent(in) :: Nslip, & !< number of active slip systems per family Ntrans !< number of active trans systems per family @@ -1304,19 +1304,19 @@ function lattice_interaction_SlipByTrans(Nslip,Ntrans,interactionValues,lattice) NslipMax = CF_NSLIPSYSTEM NtransMax = CF_NTRANSSYSTEM case default - call IO_error(137,ext_msg='lattice_interaction_SlipByTrans: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_interaction_SlipByTrans: '//trim(lattice)) end select interactionMatrix = buildInteraction(Nslip,Ntrans,NslipMax,NtransMax,interactionValues,interactionTypes) - end function lattice_interaction_SlipByTrans + end function crystal_interaction_SlipByTrans !-------------------------------------------------------------------------------------------------- !> @brief Twin-slip interaction matrix !> details only active twin and slip systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_interaction_TwinBySlip(Ntwin,Nslip,interactionValues,lattice) result(interactionMatrix) +function crystal_interaction_TwinBySlip(Ntwin,Nslip,interactionValues,lattice) result(interactionMatrix) integer, dimension(:), intent(in) :: Ntwin, & !< number of active twin systems per family Nslip !< number of active slip systems per family @@ -1380,19 +1380,19 @@ function lattice_interaction_TwinBySlip(Ntwin,Nslip,interactionValues,lattice) r NtwinMax = HP_NTWINSYSTEM NslipMax = HP_NSLIPSYSTEM case default - call IO_error(137,ext_msg='lattice_interaction_TwinBySlip: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_interaction_TwinBySlip: '//trim(lattice)) end select interactionMatrix = buildInteraction(Ntwin,Nslip,NtwinMax,NslipMax,interactionValues,interactionTypes) -end function lattice_interaction_TwinBySlip +end function crystal_interaction_TwinBySlip !-------------------------------------------------------------------------------------------------- !> @brief Schmid matrix for slip !> details only active slip systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_SchmidMatrix_slip(Nslip,lattice,cOverA) result(SchmidMatrix) +function crystal_SchmidMatrix_slip(Nslip,lattice,cOverA) result(SchmidMatrix) integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -1419,7 +1419,7 @@ function lattice_SchmidMatrix_slip(Nslip,lattice,cOverA) result(SchmidMatrix) slipSystems = TI_SYSTEMSLIP case default allocate(NslipMax(0)) - call IO_error(137,ext_msg='lattice_SchmidMatrix_slip: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_SchmidMatrix_slip: '//trim(lattice)) end select if (any(NslipMax(1:size(Nslip)) - Nslip < 0)) & @@ -1435,14 +1435,14 @@ function lattice_SchmidMatrix_slip(Nslip,lattice,cOverA) result(SchmidMatrix) error stop 'dilatational Schmid matrix for slip' end do -end function lattice_SchmidMatrix_slip +end function crystal_SchmidMatrix_slip !-------------------------------------------------------------------------------------------------- !> @brief Schmid matrix for twinning !> details only active twin systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_SchmidMatrix_twin(Ntwin,lattice,cOverA) result(SchmidMatrix) +function crystal_SchmidMatrix_twin(Ntwin,lattice,cOverA) result(SchmidMatrix) integer, dimension(:), intent(in) :: Ntwin !< number of active twin systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -1466,7 +1466,7 @@ function lattice_SchmidMatrix_twin(Ntwin,lattice,cOverA) result(SchmidMatrix) twinSystems = HP_SYSTEMTWIN case default allocate(NtwinMax(0)) - call IO_error(137,ext_msg='lattice_SchmidMatrix_twin: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_SchmidMatrix_twin: '//trim(lattice)) end select if (any(NtwinMax(1:size(Ntwin)) - Ntwin < 0)) & @@ -1482,43 +1482,43 @@ function lattice_SchmidMatrix_twin(Ntwin,lattice,cOverA) result(SchmidMatrix) error stop 'dilatational Schmid matrix for twin' end do -end function lattice_SchmidMatrix_twin +end function crystal_SchmidMatrix_twin !-------------------------------------------------------------------------------------------------- !> @brief Schmid matrix for transformation !> details only active twin systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_SchmidMatrix_trans(Ntrans,lattice_target,cOverA,a_cF,a_cI) result(SchmidMatrix) +function crystal_SchmidMatrix_trans(Ntrans,crystal_target,cOverA,a_cF,a_cI) result(SchmidMatrix) integer, dimension(:), intent(in) :: Ntrans !< number of active twin systems per family - character(len=*), intent(in) :: lattice_target !< Bravais lattice (Pearson symbol) + character(len=*), intent(in) :: crystal_target !< Bravais lattice (Pearson symbol) real(pREAL), optional, intent(in) :: cOverA, a_cI, a_cF real(pREAL), dimension(3,3,sum(Ntrans)) :: SchmidMatrix real(pREAL), dimension(3,3,sum(Ntrans)) :: devNull - if (lattice_target == 'hP' .and. present(cOverA)) then + if (crystal_target == 'hP' .and. present(cOverA)) then if (cOverA < 1.0_pREAL .or. cOverA > 2.0_pREAL) & - call IO_error(131,ext_msg='lattice_SchmidMatrix_trans: '//trim(lattice_target)) + call IO_error(131,ext_msg='crystal_SchmidMatrix_trans: '//trim(crystal_target)) call buildTransformationSystem(devNull,SchmidMatrix,Ntrans,cOverA=cOverA) - else if (lattice_target == 'cI' .and. present(a_cF) .and. present(a_cI)) then + else if (crystal_target == 'cI' .and. present(a_cF) .and. present(a_cI)) then if (a_cI <= 0.0_pREAL .or. a_cF <= 0.0_pREAL) & - call IO_error(134,ext_msg='lattice_SchmidMatrix_trans: '//trim(lattice_target)) + call IO_error(134,ext_msg='crystal_SchmidMatrix_trans: '//trim(crystal_target)) call buildTransformationSystem(devNull,SchmidMatrix,Ntrans,a_cF=a_cF,a_cI=a_cI) else - call IO_error(131,ext_msg='lattice_SchmidMatrix_trans: '//trim(lattice_target)) + call IO_error(131,ext_msg='crystal_SchmidMatrix_trans: '//trim(crystal_target)) end if -end function lattice_SchmidMatrix_trans +end function crystal_SchmidMatrix_trans !-------------------------------------------------------------------------------------------------- !> @brief Schmid matrix for cleavage !> details only active cleavage systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_SchmidMatrix_cleavage(Ncleavage,lattice,cOverA) result(SchmidMatrix) +function crystal_SchmidMatrix_cleavage(Ncleavage,lattice,cOverA) result(SchmidMatrix) integer, dimension(:), intent(in) :: Ncleavage !< number of active cleavage systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -1539,7 +1539,7 @@ function lattice_SchmidMatrix_cleavage(Ncleavage,lattice,cOverA) result(SchmidMa cleavageSystems = CI_SYSTEMCLEAVAGE case default allocate(NcleavageMax(0)) - call IO_error(137,ext_msg='lattice_SchmidMatrix_cleavage: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_SchmidMatrix_cleavage: '//trim(lattice)) end select if (any(NcleavageMax(1:size(Ncleavage)) - Ncleavage < 0)) & @@ -1555,13 +1555,13 @@ function lattice_SchmidMatrix_cleavage(Ncleavage,lattice,cOverA) result(SchmidMa SchmidMatrix(1:3,1:3,3,i) = math_outer(coordinateSystem(1:3,2,i),coordinateSystem(1:3,2,i)) end do -end function lattice_SchmidMatrix_cleavage +end function crystal_SchmidMatrix_cleavage !-------------------------------------------------------------------------------------------------- !> @brief Slip direction of slip systems (|| b) !-------------------------------------------------------------------------------------------------- -function lattice_slip_direction(Nslip,lattice,cOverA) result(d) +function crystal_slip_direction(Nslip,lattice,cOverA) result(d) integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -1573,13 +1573,13 @@ function lattice_slip_direction(Nslip,lattice,cOverA) result(d) coordinateSystem = coordinateSystem_slip(Nslip,lattice,cOverA) d = coordinateSystem(1:3,1,1:sum(Nslip)) -end function lattice_slip_direction +end function crystal_slip_direction !-------------------------------------------------------------------------------------------------- !> @brief Normal direction of slip systems (|| n) !-------------------------------------------------------------------------------------------------- -function lattice_slip_normal(Nslip,lattice,cOverA) result(n) +function crystal_slip_normal(Nslip,lattice,cOverA) result(n) integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -1591,13 +1591,13 @@ function lattice_slip_normal(Nslip,lattice,cOverA) result(n) coordinateSystem = coordinateSystem_slip(Nslip,lattice,cOverA) n = coordinateSystem(1:3,2,1:sum(Nslip)) -end function lattice_slip_normal +end function crystal_slip_normal !-------------------------------------------------------------------------------------------------- !> @brief Transverse direction of slip systems (|| t = b x n) !-------------------------------------------------------------------------------------------------- -function lattice_slip_transverse(Nslip,lattice,cOverA) result(t) +function crystal_slip_transverse(Nslip,lattice,cOverA) result(t) integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -1609,14 +1609,14 @@ function lattice_slip_transverse(Nslip,lattice,cOverA) result(t) coordinateSystem = coordinateSystem_slip(Nslip,lattice,cOverA) t = coordinateSystem(1:3,3,1:sum(Nslip)) -end function lattice_slip_transverse +end function crystal_slip_transverse !-------------------------------------------------------------------------------------------------- !> @brief Labels of slip systems !> details only active slip systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_labels_slip(Nslip,lattice) result(labels) +function crystal_labels_slip(Nslip,lattice) result(labels) integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -1640,7 +1640,7 @@ function lattice_labels_slip(Nslip,lattice) result(labels) NslipMax = TI_NSLIPSYSTEM slipSystems = TI_SYSTEMSLIP case default - call IO_error(137,ext_msg='lattice_labels_slip: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_labels_slip: '//trim(lattice)) end select if (any(NslipMax(1:size(Nslip)) - Nslip < 0)) & @@ -1650,13 +1650,13 @@ function lattice_labels_slip(Nslip,lattice) result(labels) labels = getLabels(Nslip,NslipMax,slipSystems) -end function lattice_labels_slip +end function crystal_labels_slip !-------------------------------------------------------------------------------------------------- !> @brief Return 3x3 tensor with symmetry according to given Bravais lattice !-------------------------------------------------------------------------------------------------- -pure function lattice_symmetrize_33(T,lattice) result(T_sym) +pure function crystal_symmetrize_33(T,lattice) result(T_sym) real(pREAL), dimension(3,3) :: T_sym @@ -1677,14 +1677,14 @@ pure function lattice_symmetrize_33(T,lattice) result(T_sym) T_sym(3,3) = T(3,3) end select -end function lattice_symmetrize_33 +end function crystal_symmetrize_33 !-------------------------------------------------------------------------------------------------- !> @brief Return stiffness matrix in 6x6 notation with symmetry according to given Bravais lattice !> @details J. A. Rayne and B. S. Chandrasekhar Phys. Rev. 120, 1658 Erratum Phys. Rev. 122, 1962 !-------------------------------------------------------------------------------------------------- -pure function lattice_symmetrize_C66(C66,lattice) result(C66_sym) +pure function crystal_symmetrize_C66(C66,lattice) result(C66_sym) real(pREAL), dimension(6,6) :: C66_sym @@ -1723,14 +1723,14 @@ pure function lattice_symmetrize_C66(C66,lattice) result(C66_sym) end do end do -end function lattice_symmetrize_C66 +end function crystal_symmetrize_C66 !-------------------------------------------------------------------------------------------------- !> @brief Labels for twin systems !> details only active twin systems are considered !-------------------------------------------------------------------------------------------------- -function lattice_labels_twin(Ntwin,lattice) result(labels) +function crystal_labels_twin(Ntwin,lattice) result(labels) integer, dimension(:), intent(in) :: Ntwin !< number of active slip systems per family character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) @@ -1751,7 +1751,7 @@ function lattice_labels_twin(Ntwin,lattice) result(labels) NtwinMax = HP_NTWINSYSTEM twinSystems = HP_SYSTEMTWIN case default - call IO_error(137,ext_msg='lattice_labels_twin: '//trim(lattice)) + call IO_error(137,ext_msg='crystal_labels_twin: '//trim(lattice)) end select if (any(NtwinMax(1:size(Ntwin)) - Ntwin < 0)) & @@ -1761,7 +1761,7 @@ function lattice_labels_twin(Ntwin,lattice) result(labels) labels = getLabels(Ntwin,NtwinMax,twinSystems) -end function lattice_labels_twin +end function crystal_labels_twin !-------------------------------------------------------------------------------------------------- @@ -1778,8 +1778,8 @@ function slipProjection_transverse(Nslip,lattice,cOverA) result(projection) real(pREAL), dimension(3,sum(Nslip)) :: n, t integer :: i, j - n = lattice_slip_normal (Nslip,lattice,cOverA) - t = lattice_slip_transverse(Nslip,lattice,cOverA) + n = crystal_slip_normal (Nslip,lattice,cOverA) + t = crystal_slip_transverse(Nslip,lattice,cOverA) do i=1, sum(Nslip); do j=1, sum(Nslip) projection(i,j) = abs(math_inner(n(:,i),t(:,j))) @@ -1802,8 +1802,8 @@ function slipProjection_direction(Nslip,lattice,cOverA) result(projection) real(pREAL), dimension(3,sum(Nslip)) :: n, d integer :: i, j - n = lattice_slip_normal (Nslip,lattice,cOverA) - d = lattice_slip_direction(Nslip,lattice,cOverA) + n = crystal_slip_normal (Nslip,lattice,cOverA) + d = crystal_slip_direction(Nslip,lattice,cOverA) do i=1, sum(Nslip); do j=1, sum(Nslip) projection(i,j) = abs(math_inner(n(:,i),d(:,j))) @@ -2150,7 +2150,7 @@ end function getlabels !> @brief Equivalent Poisson's ratio (ν) !> @details https://doi.org/10.1143/JPSJ.20.635 !-------------------------------------------------------------------------------------------------- -pure function lattice_isotropic_nu(C,assumption,lattice) result(nu) +pure function crystal_isotropic_nu(C,assumption,lattice) result(nu) real(pREAL), dimension(6,6), intent(in) :: C !< Stiffness tensor (Voigt notation) character(len=*), intent(in) :: assumption !< Assumption (isostrain = 'Voigt', isostress = 'Reuss') @@ -2172,10 +2172,10 @@ pure function lattice_isotropic_nu(C,assumption,lattice) result(nu) error stop 'invalid assumption' end if - mu = lattice_isotropic_mu(C,assumption,lattice) + mu = crystal_isotropic_mu(C,assumption,lattice) nu = (1.5_pREAL*K-mu)/(3.0_pREAL*K+mu) -end function lattice_isotropic_nu +end function crystal_isotropic_nu !-------------------------------------------------------------------------------------------------- @@ -2183,7 +2183,7 @@ end function lattice_isotropic_nu !> @details https://doi.org/10.1143/JPSJ.20.635 !> @details Nonlinear Mechanics of Crystals 10.1007/978-94-007-0350-6, pp 563 !-------------------------------------------------------------------------------------------------- -pure function lattice_isotropic_mu(C,assumption,lattice) result(mu) +pure function crystal_isotropic_mu(C,assumption,lattice) result(mu) real(pREAL), dimension(6,6), intent(in) :: C !< Stiffness tensor (Voigt notation) character(len=*), intent(in) :: assumption !< Assumption (isostrain = 'Voigt', isostress = 'Reuss') @@ -2220,11 +2220,11 @@ pure function lattice_isotropic_mu(C,assumption,lattice) result(mu) error stop 'invalid assumption' end if -end function lattice_isotropic_mu +end function crystal_isotropic_mu !-------------------------------------------------------------------------------------------------- -!> @brief Check correctness of some lattice functions. +!> @brief Check correctness of some crystal functions. !-------------------------------------------------------------------------------------------------- subroutine selfTest @@ -2246,10 +2246,10 @@ subroutine selfTest do i = 1, 10 call random_number(C) - C_cF = lattice_symmetrize_C66(C,'cI') - C_cI = lattice_symmetrize_C66(C,'cF') - C_hP = lattice_symmetrize_C66(C,'hP') - C_tI = lattice_symmetrize_C66(C,'tI') + C_cF = crystal_symmetrize_C66(C,'cI') + C_cI = crystal_symmetrize_C66(C,'cF') + C_hP = crystal_symmetrize_C66(C,'hP') + C_tI = crystal_symmetrize_C66(C,'tI') if (any(dNeq(C_cI,transpose(C_cF)))) error stop 'SymmetryC66/cI-cF' if (any(dNeq(C_cF,transpose(C_cI)))) error stop 'SymmetryC66/cF-cI' @@ -2269,10 +2269,10 @@ subroutine selfTest if (any(dNeq(C(4,4),[C_tI(4,4),C_tI(5,5)]))) error stop 'SymmetryC_44-55/tI' call random_number(T) - T_cF = lattice_symmetrize_33(T,'cI') - T_cI = lattice_symmetrize_33(T,'cF') - T_hP = lattice_symmetrize_33(T,'hP') - T_tI = lattice_symmetrize_33(T,'tI') + T_cF = crystal_symmetrize_33(T,'cI') + T_cI = crystal_symmetrize_33(T,'cF') + T_hP = crystal_symmetrize_33(T,'hP') + T_tI = crystal_symmetrize_33(T,'tI') if (any(dNeq0(T_cF) .and. math_I3<1.0_pREAL)) error stop 'Symmetry33/c' if (any(dNeq0(T_hP) .and. math_I3<1.0_pREAL)) error stop 'Symmetry33/hP' @@ -2291,48 +2291,48 @@ subroutine selfTest C(4,4) = 0.5_pREAL * (C(1,1) - C(1,2)) C(6,6) = C(4,4) - C_cI = lattice_symmetrize_C66(C,'cI') - if (dNeq(C_cI(4,4),lattice_isotropic_mu(C_cI,'isostrain','cI'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostrain/cI' - if (dNeq(C_cI(4,4),lattice_isotropic_mu(C_cI,'isostress','cI'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostress/cI' + C_cI = crystal_symmetrize_C66(C,'cI') + if (dNeq(C_cI(4,4),crystal_isotropic_mu(C_cI,'isostrain','cI'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostrain/cI' + if (dNeq(C_cI(4,4),crystal_isotropic_mu(C_cI,'isostress','cI'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostress/cI' lambda = C_cI(1,2) - if (dNeq(lambda*0.5_pREAL/(lambda+lattice_isotropic_mu(C_cI,'isostrain','cI')), & - lattice_isotropic_nu(C_cI,'isostrain','cI'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostrain/cI' - if (dNeq(lambda*0.5_pREAL/(lambda+lattice_isotropic_mu(C_cI,'isostress','cI')), & - lattice_isotropic_nu(C_cI,'isostress','cI'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostress/cI' + if (dNeq(lambda*0.5_pREAL/(lambda+crystal_isotropic_mu(C_cI,'isostrain','cI')), & + crystal_isotropic_nu(C_cI,'isostrain','cI'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostrain/cI' + if (dNeq(lambda*0.5_pREAL/(lambda+crystal_isotropic_mu(C_cI,'isostress','cI')), & + crystal_isotropic_nu(C_cI,'isostress','cI'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostress/cI' - C_hP = lattice_symmetrize_C66(C,'hP') - if (dNeq(C(4,4),lattice_isotropic_mu(C_hP,'isostrain','hP'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostrain/hP' - if (dNeq(C(4,4),lattice_isotropic_mu(C_hP,'isostress','hP'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostress/hP' + C_hP = crystal_symmetrize_C66(C,'hP') + if (dNeq(C(4,4),crystal_isotropic_mu(C_hP,'isostrain','hP'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostrain/hP' + if (dNeq(C(4,4),crystal_isotropic_mu(C_hP,'isostress','hP'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostress/hP' lambda = C_hP(1,2) - if (dNeq(lambda*0.5_pREAL/(lambda+lattice_isotropic_mu(C_hP,'isostrain','hP')), & - lattice_isotropic_nu(C_hP,'isostrain','hP'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostrain/hP' - if (dNeq(lambda*0.5_pREAL/(lambda+lattice_isotropic_mu(C_hP,'isostress','hP')), & - lattice_isotropic_nu(C_hP,'isostress','hP'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostress/hP' + if (dNeq(lambda*0.5_pREAL/(lambda+crystal_isotropic_mu(C_hP,'isostrain','hP')), & + crystal_isotropic_nu(C_hP,'isostrain','hP'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostrain/hP' + if (dNeq(lambda*0.5_pREAL/(lambda+crystal_isotropic_mu(C_hP,'isostress','hP')), & + crystal_isotropic_nu(C_hP,'isostress','hP'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostress/hP' - C_tI = lattice_symmetrize_C66(C,'tI') - if (dNeq(C(6,6),lattice_isotropic_mu(C_tI,'isostrain','tI'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostrain/tI' - if (dNeq(C(6,6),lattice_isotropic_mu(C_tI,'isostress','tI'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostress/tI' + C_tI = crystal_symmetrize_C66(C,'tI') + if (dNeq(C(6,6),crystal_isotropic_mu(C_tI,'isostrain','tI'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostrain/tI' + if (dNeq(C(6,6),crystal_isotropic_mu(C_tI,'isostress','tI'),1.0e-12_pREAL)) error stop 'isotropic_mu/isostress/tI' lambda = C_tI(1,2) - if (dNeq(lambda*0.5_pREAL/(lambda+lattice_isotropic_mu(C_tI,'isostrain','tI')), & - lattice_isotropic_nu(C_tI,'isostrain','tI'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostrain/tI' - if (dNeq(lambda*0.5_pREAL/(lambda+lattice_isotropic_mu(C_tI,'isostress','tI')), & - lattice_isotropic_nu(C_tI,'isostress','tI'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostress/tI' + if (dNeq(lambda*0.5_pREAL/(lambda+crystal_isotropic_mu(C_tI,'isostrain','tI')), & + crystal_isotropic_nu(C_tI,'isostrain','tI'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostrain/tI' + if (dNeq(lambda*0.5_pREAL/(lambda+crystal_isotropic_mu(C_tI,'isostress','tI')), & + crystal_isotropic_nu(C_tI,'isostress','tI'),1.0e-12_pREAL)) error stop 'isotropic_nu/isostress/tI' call random_number(C) - C = lattice_symmetrize_C66(C+math_eye(6),'cI') - if (dNeq(lattice_isotropic_mu(C,'isostrain','cI'), lattice_isotropic_mu(C,'isostrain','hP'), 1.0e-12_pREAL)) & + C = crystal_symmetrize_C66(C+math_eye(6),'cI') + if (dNeq(crystal_isotropic_mu(C,'isostrain','cI'), crystal_isotropic_mu(C,'isostrain','hP'), 1.0e-12_pREAL)) & error stop 'isotropic_mu/isostrain/cI-hP' - if (dNeq(lattice_isotropic_nu(C,'isostrain','cF'), lattice_isotropic_nu(C,'isostrain','cI'), 1.0e-12_pREAL)) & + if (dNeq(crystal_isotropic_nu(C,'isostrain','cF'), crystal_isotropic_nu(C,'isostrain','cI'), 1.0e-12_pREAL)) & error stop 'isotropic_nu/isostrain/cF-tI' - if (dNeq(lattice_isotropic_mu(C,'isostress','cI'), lattice_isotropic_mu(C,'isostress'), 1.0e-12_pREAL)) & + if (dNeq(crystal_isotropic_mu(C,'isostress','cI'), crystal_isotropic_mu(C,'isostress'), 1.0e-12_pREAL)) & error stop 'isotropic_mu/isostress/cI-hP' - if (dNeq(lattice_isotropic_nu(C,'isostress','cF'), lattice_isotropic_nu(C,'isostress'), 1.0e-12_pREAL)) & + if (dNeq(crystal_isotropic_nu(C,'isostress','cF'), crystal_isotropic_nu(C,'isostress'), 1.0e-12_pREAL)) & error stop 'isotropic_nu/isostress/cF-tI' end subroutine selfTest -end module lattice +end module crystal diff --git a/src/homogenization.f90 b/src/homogenization.f90 index f322c2c07..c85547917 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -16,7 +16,7 @@ module homogenization use HDF5 use HDF5_utilities use result - use lattice + use crystal implicit none(type,external) private diff --git a/src/homogenization_mechanical_RGC.f90 b/src/homogenization_mechanical_RGC.f90 index da8bce7c5..aac66ccec 100644 --- a/src/homogenization_mechanical_RGC.f90 +++ b/src/homogenization_mechanical_RGC.f90 @@ -8,7 +8,7 @@ !-------------------------------------------------------------------------------------------------- submodule(homogenization:mechanical) RGC use rotations - use lattice + use crystal type :: tParameters integer, dimension(:), allocatable :: & @@ -654,7 +654,7 @@ module function RGC_updateState(P,F,avgF,dt,dPdF,ce) result(doneAndHappy) C = phase_homogenizedC66(material_ID_phase(co,ce),material_entry_phase(co,ce)) ! damage not included! - equivalentMu = lattice_isotropic_mu(C,'isostrain') + equivalentMu = crystal_isotropic_mu(C,'isostrain') end function equivalentMu diff --git a/src/materialpoint.f90 b/src/materialpoint.f90 index ea02b1e6f..b92559a72 100644 --- a/src/materialpoint.f90 +++ b/src/materialpoint.f90 @@ -20,7 +20,7 @@ module materialpoint use rotations use polynomials use tables - use lattice + use crystal use material use phase use homogenization @@ -64,7 +64,7 @@ subroutine materialpoint_initAll() call rotations_init() call polynomials_init() call tables_init() - call lattice_init() + call crystal_init() #if defined(MESH) call discretization_mesh_init(restart=CLI_restartInc>0) #elif defined(GRID) diff --git a/src/phase.f90 b/src/phase.f90 index f889a854f..573e71069 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -14,7 +14,7 @@ module phase use config use material use result - use lattice + use crystal use discretization use parallelization use HDF5 @@ -336,7 +336,7 @@ module phase config, & material, & result, & - lattice, & + crystal, & discretization, & HDF5_utilities #endif diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index 788b8292c..e2ec9922c 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -77,7 +77,7 @@ module function anisobrittle_init() result(mySources) prm%s_crit = src%get_as1dReal('s_crit',requiredSize=size(N_cl)) prm%g_crit = src%get_as1dReal('g_crit',requiredSize=size(N_cl)) - prm%cleavage_systems = lattice_SchmidMatrix_cleavage(N_cl,phase_lattice(ph),phase_cOverA(ph)) + prm%cleavage_systems = crystal_SchmidMatrix_cleavage(N_cl,phase_lattice(ph),phase_cOverA(ph)) ! expand: family => system prm%s_crit = math_expand(prm%s_crit,N_cl) diff --git a/src/phase_mechanical_eigen_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 index 75a2ae0d0..027f71c81 100644 --- a/src/phase_mechanical_eigen_thermalexpansion.f90 +++ b/src/phase_mechanical_eigen_thermalexpansion.f90 @@ -92,7 +92,7 @@ module subroutine thermalexpansion_LiAndItsTangent(Li, dLi_dTstar, ph,me) Alpha = 0.0_pREAL Alpha(1,1) = prm%Alpha_11%at(T) if (any(phase_lattice(ph) == ['hP','tI'])) Alpha(3,3) = prm%Alpha_33%at(T) - Alpha = lattice_symmetrize_33(Alpha,phase_lattice(ph)) + Alpha = crystal_symmetrize_33(Alpha,phase_lattice(ph)) Li = dot_T * Alpha end associate diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index 75a8753a5..a2b5becff 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -97,7 +97,7 @@ pure module function elastic_C66(ph,en) result(C66) if (phase_lattice(ph) == 'tI') C66(6,6) = prm%C_66%at(T) - C66 = lattice_symmetrize_C66(C66,phase_lattice(ph)) + C66 = crystal_symmetrize_C66(C66,phase_lattice(ph)) end associate @@ -119,7 +119,7 @@ pure module function elastic_mu(ph,en,isotropic_bound) result(mu) associate(prm => param(ph)) - mu = lattice_isotropic_mu(elastic_C66(ph,en),isotropic_bound,phase_lattice(ph)) + mu = crystal_isotropic_mu(elastic_C66(ph,en),isotropic_bound,phase_lattice(ph)) end associate @@ -141,7 +141,7 @@ pure module function elastic_nu(ph,en,isotropic_bound) result(nu) associate(prm => param(ph)) - nu = lattice_isotropic_nu(elastic_C66(ph,en),isotropic_bound,phase_lattice(ph)) + nu = crystal_isotropic_nu(elastic_C66(ph,en),isotropic_bound,phase_lattice(ph)) end associate diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index 0dcd1cd84..08dd3decd 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -149,13 +149,13 @@ module function plastic_dislotungsten_init() result(myPlasticity) N_sl = pl%get_as1dInt('N_sl',defaultVal=emptyIntArray) prm%sum_N_sl = sum(abs(N_sl)) slipActive: if (prm%sum_N_sl > 0) then - prm%systems_sl = lattice_labels_slip(N_sl,phase_lattice(ph)) - prm%P_sl = lattice_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) + prm%systems_sl = crystal_labels_slip(N_sl,phase_lattice(ph)) + prm%P_sl = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) if (phase_lattice(ph) == 'cI') then a = pl%get_as1dReal('a_nonSchmid',defaultVal = emptyRealArray) - prm%P_nS_pos = lattice_nonSchmidMatrix(N_sl,a,+1) - prm%P_nS_neg = lattice_nonSchmidMatrix(N_sl,a,-1) + prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) + prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) else prm%P_nS_pos = prm%P_sl prm%P_nS_neg = prm%P_sl @@ -184,13 +184,13 @@ module function plastic_dislotungsten_init() result(myPlasticity) prm%d_caron = prm%b_sl * pl%get_asReal('D_a') prm%f_at = prm%b_sl**3*pl%get_asReal('f_at') - prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'), & + prm%h_sl_sl = crystal_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'), & phase_lattice(ph)) prm%forestProjection = spread( f_edge,1,prm%sum_N_sl) & - * lattice_forestProjection_edge (N_sl,phase_lattice(ph),phase_cOverA(ph)) & + * crystal_forestProjection_edge (N_sl,phase_lattice(ph),phase_cOverA(ph)) & + spread(1.0_pREAL-f_edge,1,prm%sum_N_sl) & - * lattice_forestProjection_screw(N_sl,phase_lattice(ph),phase_cOverA(ph)) + * crystal_forestProjection_screw(N_sl,phase_lattice(ph),phase_cOverA(ph)) ! sanity checks if ( prm%D_0 < 0.0_pREAL) extmsg = trim(extmsg)//' D_0' diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index 9f221c910..a1f22baa7 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -73,7 +73,7 @@ submodule(phase:plastic) dislotwin integer, allocatable, dimension(:,:) :: & fcc_twinNucleationSlipPair ! ToDo: Better name? Is also used for trans character(len=:), allocatable :: & - lattice_tr, & + crystal_tr, & isotropic_bound character(len=pSTRLEN), allocatable, dimension(:) :: & output @@ -202,9 +202,9 @@ module function plastic_dislotwin_init() result(myPlasticity) N_sl = pl%get_as1dInt('N_sl',defaultVal=emptyIntArray) prm%sum_N_sl = sum(abs(N_sl)) slipActive: if (prm%sum_N_sl > 0) then - prm%systems_sl = lattice_labels_slip(N_sl,phase_lattice(ph)) - prm%P_sl = lattice_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) - prm%n0_sl = lattice_slip_normal(N_sl,phase_lattice(ph),phase_cOverA(ph)) + prm%systems_sl = crystal_labels_slip(N_sl,phase_lattice(ph)) + prm%P_sl = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) + prm%n0_sl = crystal_slip_normal(N_sl,phase_lattice(ph),phase_cOverA(ph)) prm%extendedDislocations = pl%get_asBool('extend_dislocations',defaultVal=.false.) prm%omitDipoles = pl%get_asBool('omit_dipoles', defaultVal=.false.) @@ -226,15 +226,15 @@ module function plastic_dislotwin_init() result(myPlasticity) defaultVal=[(0.0_pREAL,i=1,size(N_sl))]),N_sl) prm%d_caron = prm%b_sl * pl%get_asReal('D_a') - prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'),phase_lattice(ph)) + prm%h_sl_sl = crystal_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'),phase_lattice(ph)) prm%forestProjection = spread( f_edge,1,prm%sum_N_sl) & - * lattice_forestProjection_edge (N_sl,phase_lattice(ph),phase_cOverA(ph)) & + * crystal_forestProjection_edge (N_sl,phase_lattice(ph),phase_cOverA(ph)) & + spread(1.0_pREAL-f_edge,1,prm%sum_N_sl) & - * lattice_forestProjection_screw(N_sl,phase_lattice(ph),phase_cOverA(ph)) + * crystal_forestProjection_screw(N_sl,phase_lattice(ph),phase_cOverA(ph)) prm%fccTwinTransNucleation = phase_lattice(ph) == 'cF' .and. N_sl(1) == 12 - if (prm%fccTwinTransNucleation) prm%fcc_twinNucleationSlipPair = lattice_CF_TWINNUCLEATIONSLIPPAIR + if (prm%fccTwinTransNucleation) prm%fcc_twinNucleationSlipPair = crystal_CF_TWINNUCLEATIONSLIPPAIR ! multiplication factor according to crystal structure (nearest neighbors bcc vs fcc/hex) ! details: Argon & Moffat, Acta Metallurgica, Vol. 29, pg 293 to 299, 1981 @@ -274,9 +274,9 @@ module function plastic_dislotwin_init() result(myPlasticity) prm%N_tw = pl%get_as1dInt('N_tw', defaultVal=emptyIntArray) prm%sum_N_tw = sum(abs(prm%N_tw)) twinActive: if (prm%sum_N_tw > 0) then - prm%systems_tw = lattice_labels_twin(prm%N_tw,phase_lattice(ph)) - prm%P_tw = lattice_SchmidMatrix_twin(prm%N_tw,phase_lattice(ph),phase_cOverA(ph)) - prm%gamma_char_tw = lattice_characteristicShear_Twin(prm%N_tw,phase_lattice(ph),phase_cOverA(ph)) + prm%systems_tw = crystal_labels_twin(prm%N_tw,phase_lattice(ph)) + prm%P_tw = crystal_SchmidMatrix_twin(prm%N_tw,phase_lattice(ph),phase_cOverA(ph)) + prm%gamma_char_tw = crystal_characteristicShear_Twin(prm%N_tw,phase_lattice(ph),phase_cOverA(ph)) prm%L_tw = pl%get_asReal('L_tw') prm%i_tw = pl%get_asReal('i_tw') @@ -285,7 +285,7 @@ module function plastic_dislotwin_init() result(myPlasticity) prm%t_tw = math_expand(pl%get_as1dReal('t_tw', requiredSize=size(prm%N_tw)),prm%N_tw) prm%r = math_expand(pl%get_as1dReal('p_tw', requiredSize=size(prm%N_tw)),prm%N_tw) - prm%h_tw_tw = lattice_interaction_TwinByTwin(prm%N_tw,pl%get_as1dReal('h_tw-tw'), & + prm%h_tw_tw = crystal_interaction_TwinByTwin(prm%N_tw,pl%get_as1dReal('h_tw-tw'), & phase_lattice(ph)) ! sanity checks @@ -309,7 +309,7 @@ module function plastic_dislotwin_init() result(myPlasticity) prm%N_tr = pl%get_as1dInt('N_tr', defaultVal=emptyIntArray) prm%sum_N_tr = sum(abs(prm%N_tr)) transActive: if (prm%sum_N_tr > 0) then - prm%P_tr = lattice_SchmidMatrix_trans(prm%N_tr,'hP',prm%cOverA_hP) + prm%P_tr = crystal_SchmidMatrix_trans(prm%N_tr,'hP',prm%cOverA_hP) prm%Delta_G = polynomial(pl,'Delta_G','T') prm%i_tr = pl%get_asReal('i_tr') @@ -324,7 +324,7 @@ module function plastic_dislotwin_init() result(myPlasticity) a_cF = prm%b_tr(1)*sqrt(6.0_pREAL) ! b_tr is Shockley partial prm%h = 5.0_pREAL * a_cF/sqrt(3.0_pREAL) prm%rho = 4.0_pREAL/(sqrt(3.0_pREAL)*a_cF**2)/N_A - prm%h_tr_tr = lattice_interaction_TransByTrans(prm%N_tr,pl%get_as1dReal('h_tr-tr'),& + prm%h_tr_tr = crystal_interaction_TransByTrans(prm%N_tr,pl%get_as1dReal('h_tr-tr'),& phase_lattice(ph)) @@ -372,13 +372,13 @@ module function plastic_dislotwin_init() result(myPlasticity) prm%Gamma_sf = polynomial(pl,'Gamma_sf','T') slipAndTwinActive: if (prm%sum_N_sl * prm%sum_N_tw > 0) then - prm%h_sl_tw = lattice_interaction_SlipByTwin(N_sl,prm%N_tw,pl%get_as1dReal('h_sl-tw'), & + prm%h_sl_tw = crystal_interaction_SlipByTwin(N_sl,prm%N_tw,pl%get_as1dReal('h_sl-tw'), & phase_lattice(ph)) if (prm%fccTwinTransNucleation .and. size(prm%N_tw) /= 1) extmsg = trim(extmsg)//' N_tw: nucleation' end if slipAndTwinActive slipAndTransActive: if (prm%sum_N_sl * prm%sum_N_tr > 0) then - prm%h_sl_tr = lattice_interaction_SlipByTrans(N_sl,prm%N_tr,pl%get_as1dReal('h_sl-tr'), & + prm%h_sl_tr = crystal_interaction_SlipByTrans(N_sl,prm%N_tr,pl%get_as1dReal('h_sl-tr'), & phase_lattice(ph)) if (prm%fccTwinTransNucleation .and. size(prm%N_tr) /= 1) extmsg = trim(extmsg)//' N_tr: nucleation' end if slipAndTransActive @@ -480,7 +480,7 @@ module function plastic_dislotwin_homogenizedC(ph,en) result(homogenizedC) homogenizedC = f_matrix * C twinActive: if (prm%sum_N_tw > 0) then - C66_tw = lattice_C66_twin(prm%N_tw,C,phase_lattice(ph),phase_cOverA(ph)) + C66_tw = crystal_C66_twin(prm%N_tw,C,phase_lattice(ph),phase_cOverA(ph)) do i = 1, prm%sum_N_tw homogenizedC = homogenizedC & + stt%f_tw(i,en)*C66_tw(1:6,1:6,i) @@ -488,7 +488,7 @@ module function plastic_dislotwin_homogenizedC(ph,en) result(homogenizedC) end if twinActive transActive: if (prm%sum_N_tr > 0) then - C66_tr = lattice_C66_trans(prm%N_tr,C,'hP',prm%cOverA_hP) + C66_tr = crystal_C66_trans(prm%N_tr,C,'hP',prm%cOverA_hP) do i = 1, prm%sum_N_tr homogenizedC = homogenizedC & + stt%f_tr(i,en)*C66_tr(1:6,1:6,i) diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 0bebe3368..153dc03d5 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -139,14 +139,14 @@ module function plastic_kinehardening_init() result(myPlasticity) N_sl = pl%get_as1dInt('N_sl',defaultVal=emptyIntArray) prm%sum_N_sl = sum(abs(N_sl)) slipActive: if (prm%sum_N_sl > 0) then - prm%systems_sl = lattice_labels_slip(N_sl,phase_lattice(ph)) - prm%P = lattice_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) + prm%systems_sl = crystal_labels_slip(N_sl,phase_lattice(ph)) + prm%P = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) if (phase_lattice(ph) == 'cI') then a = pl%get_as1dReal('a_nonSchmid',defaultVal=emptyRealArray) prm%nonSchmidActive = size(a) > 0 - prm%P_nS_pos = lattice_nonSchmidMatrix(N_sl,a,+1) - prm%P_nS_neg = lattice_nonSchmidMatrix(N_sl,a,-1) + prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) + prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) else prm%P_nS_pos = prm%P prm%P_nS_neg = prm%P @@ -155,7 +155,7 @@ module function plastic_kinehardening_init() result(myPlasticity) prm%dot_gamma_0 = pl%get_asReal('dot_gamma_0') prm%n = pl%get_asReal('n') - prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'), & + prm%h_sl_sl = crystal_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'), & phase_lattice(ph)) xi_0 = math_expand(pl%get_as1dReal('xi_0', requiredSize=size(N_sl)),N_sl) diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 4e45066b5..d436f1095 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -249,30 +249,30 @@ module function plastic_nonlocal_init() result(myPlasticity) ini%N_sl = pl%get_as1dInt('N_sl',defaultVal=emptyIntArray) prm%sum_N_sl = sum(abs(ini%N_sl)) slipActive: if (prm%sum_N_sl > 0) then - prm%systems_sl = lattice_labels_slip(ini%N_sl,phase_lattice(ph)) - prm%P_sl = lattice_SchmidMatrix_slip(ini%N_sl,phase_lattice(ph), phase_cOverA(ph)) + prm%systems_sl = crystal_labels_slip(ini%N_sl,phase_lattice(ph)) + prm%P_sl = crystal_SchmidMatrix_slip(ini%N_sl,phase_lattice(ph), phase_cOverA(ph)) if (phase_lattice(ph) == 'cI') then a = pl%get_as1dReal('a_nonSchmid',defaultVal = emptyRealArray) if (size(a) > 0) prm%nonSchmidActive = .true. - prm%P_nS_pos = lattice_nonSchmidMatrix(ini%N_sl,a,+1) - prm%P_nS_neg = lattice_nonSchmidMatrix(ini%N_sl,a,-1) + prm%P_nS_pos = crystal_nonSchmidMatrix(ini%N_sl,a,+1) + prm%P_nS_neg = crystal_nonSchmidMatrix(ini%N_sl,a,-1) else prm%P_nS_pos = prm%P_sl prm%P_nS_neg = prm%P_sl end if - prm%h_sl_sl = lattice_interaction_SlipBySlip(ini%N_sl,pl%get_as1dReal('h_sl-sl'), & + prm%h_sl_sl = crystal_interaction_SlipBySlip(ini%N_sl,pl%get_as1dReal('h_sl-sl'), & phase_lattice(ph)) - prm%forestProjection_edge = lattice_forestProjection_edge (ini%N_sl,phase_lattice(ph),& + prm%forestProjection_edge = crystal_forestProjection_edge (ini%N_sl,phase_lattice(ph),& phase_cOverA(ph)) - prm%forestProjection_screw = lattice_forestProjection_screw(ini%N_sl,phase_lattice(ph),& + prm%forestProjection_screw = crystal_forestProjection_screw(ini%N_sl,phase_lattice(ph),& phase_cOverA(ph)) - prm%slip_direction = lattice_slip_direction (ini%N_sl,phase_lattice(ph),phase_cOverA(ph)) - prm%slip_transverse = lattice_slip_transverse(ini%N_sl,phase_lattice(ph),phase_cOverA(ph)) - prm%slip_normal = lattice_slip_normal (ini%N_sl,phase_lattice(ph),phase_cOverA(ph)) + prm%slip_direction = crystal_slip_direction (ini%N_sl,phase_lattice(ph),phase_cOverA(ph)) + prm%slip_transverse = crystal_slip_transverse(ini%N_sl,phase_lattice(ph),phase_cOverA(ph)) + prm%slip_normal = crystal_slip_normal (ini%N_sl,phase_lattice(ph),phase_cOverA(ph)) ! collinear systems (only for octahedral slip systems in fcc) allocate(prm%colinearSystem(prm%sum_N_sl), source = -1) diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 1fcc5eb69..e9e28658b 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -149,21 +149,21 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) prm%h_int = math_expand(pl%get_as1dReal('h_int', requiredSize=size(N_sl), & defaultVal=[(0.0_pREAL,i=1,size(N_sl))]),N_sl) - prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'),phase_lattice(ph)) + prm%h_sl_sl = crystal_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'),phase_lattice(ph)) - prm%P_sl = lattice_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) + prm%P_sl = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) if (phase_lattice(ph) == 'cI') then a = pl%get_as1dReal('a_nonSchmid',defaultVal=emptyRealArray) if (size(a) > 0) prm%nonSchmidActive = .true. - prm%P_nS_pos = lattice_nonSchmidMatrix(N_sl,a,+1) - prm%P_nS_neg = lattice_nonSchmidMatrix(N_sl,a,-1) + prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) + prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) else prm%P_nS_pos = prm%P_sl prm%P_nS_neg = prm%P_sl end if - prm%systems_sl = lattice_labels_slip(N_sl,phase_lattice(ph)) + prm%systems_sl = crystal_labels_slip(N_sl,phase_lattice(ph)) ! sanity checks if ( prm%dot_gamma_0_sl <= 0.0_pREAL) extmsg = trim(extmsg)//' dot_gamma_0_sl' @@ -196,11 +196,11 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) xi_0_tw = math_expand(pl%get_as1dReal('xi_0_tw',requiredSize=size(N_tw)),N_tw) - prm%gamma_char = lattice_characteristicShear_twin(N_tw,phase_lattice(ph),phase_cOverA(ph)) - prm%h_tw_tw = lattice_interaction_TwinByTwin(N_tw,pl%get_as1dReal('h_tw-tw'),phase_lattice(ph)) + prm%gamma_char = crystal_characteristicShear_twin(N_tw,phase_lattice(ph),phase_cOverA(ph)) + prm%h_tw_tw = crystal_interaction_TwinByTwin(N_tw,pl%get_as1dReal('h_tw-tw'),phase_lattice(ph)) - prm%P_tw = lattice_SchmidMatrix_twin(N_tw,phase_lattice(ph),phase_cOverA(ph)) - prm%systems_tw = lattice_labels_twin(N_tw,phase_lattice(ph)) + prm%P_tw = crystal_SchmidMatrix_twin(N_tw,phase_lattice(ph),phase_cOverA(ph)) + prm%systems_tw = crystal_labels_twin(N_tw,phase_lattice(ph)) ! sanity checks if (prm%dot_gamma_0_tw <= 0.0_pREAL) extmsg = trim(extmsg)//' dot_gamma_0_tw' @@ -216,9 +216,9 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) ! slip-twin related parameters slipAndTwinActive: if (prm%sum_N_sl > 0 .and. prm%sum_N_tw > 0) then prm%h_0_tw_sl = pl%get_asReal('h_0_tw-sl') - prm%h_sl_tw = lattice_interaction_SlipByTwin(N_sl,N_tw,pl%get_as1dReal('h_sl-tw'), & + prm%h_sl_tw = crystal_interaction_SlipByTwin(N_sl,N_tw,pl%get_as1dReal('h_sl-tw'), & phase_lattice(ph)) - prm%h_tw_sl = lattice_interaction_TwinBySlip(N_tw,N_sl,pl%get_as1dReal('h_tw-sl'), & + prm%h_tw_sl = crystal_interaction_TwinBySlip(N_tw,N_sl,pl%get_as1dReal('h_tw-sl'), & phase_lattice(ph)) else slipAndTwinActive allocate(prm%h_sl_tw(prm%sum_N_sl,prm%sum_N_tw)) ! at least one dimension is 0 diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index 449e08ab8..5ef4dc7fd 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -112,7 +112,7 @@ module subroutine thermal_init(phases) param(ph)%C_p = thermal%get_asReal('C_p') param(ph)%K(1,1) = thermal%get_asReal('K_11') if (any(phase_lattice(ph) == ['hP','tI'])) param(ph)%K(3,3) = thermal%get_asReal('K_33') - param(ph)%K = lattice_symmetrize_33(param(ph)%K,phase_lattice(ph)) + param(ph)%K = crystal_symmetrize_33(param(ph)%K,phase_lattice(ph)) #if defined(__GFORTRAN__) param(ph)%output = output_as1dStr(thermal) From 6770bedb7d0bcd422d5262f831f7ab06f478b375 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Sun, 16 Jul 2023 15:38:37 +0200 Subject: [PATCH 08/24] point to development in PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 39853f7d8..1a5922536 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 39853f7d8fb06bb0c83aed5083212bcfd5b52a57 +Subproject commit 1a592253655a79ca26e29059339ed2bcb34eff9d From 915d03f2bf2a7d5f840b552b336805dc193267d6 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Sun, 16 Jul 2023 11:35:24 +0200 Subject: [PATCH 09/24] updated tests --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 6c1a6993d..864fa1b17 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 6c1a6993d31c62711553a5ba5d6b0cf5b6620634 +Subproject commit 864fa1b1709bb313073d6b312064637970396409 From 4cd1587f711ff37b1e6a815639e50e854a1289dc Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 16 Jul 2023 18:43:37 +0200 Subject: [PATCH 10/24] [skip ci] updated version information after successful test of v3.0.0-alpha7-640-g6770bedb7 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 07e7a9689..ca8e9e763 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-630-ga63fe8d02 +3.0.0-alpha7-640-g6770bedb7 From 45dd38752737974542bce948ab4bb660c842e176 Mon Sep 17 00:00:00 2001 From: Sharan Date: Sun, 16 Jul 2023 22:04:18 +0200 Subject: [PATCH 11/24] polarisation --> polarization --- src/grid/DAMASK_grid.f90 | 12 +++---- ...90 => grid_mech_spectral_polarization.f90} | 34 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) rename src/grid/{grid_mech_spectral_polarisation.f90 => grid_mech_spectral_polarization.f90} (97%) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index f55927186..e38a88240 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -24,7 +24,7 @@ program DAMASK_grid use material use spectral_utilities use grid_mechanical_spectral_basic - use grid_mechanical_spectral_polarisation + use grid_mechanical_spectral_polarization use grid_mechanical_FEM use grid_damage_spectral use grid_thermal_spectral @@ -173,11 +173,11 @@ program DAMASK_grid mechanical_restartWrite => grid_mechanical_spectral_basic_restartWrite case ('spectral_polarization') - mechanical_init => grid_mechanical_spectral_polarisation_init - mechanical_forward => grid_mechanical_spectral_polarisation_forward - mechanical_solution => grid_mechanical_spectral_polarisation_solution - mechanical_updateCoords => grid_mechanical_spectral_polarisation_updateCoords - mechanical_restartWrite => grid_mechanical_spectral_polarisation_restartWrite + mechanical_init => grid_mechanical_spectral_polarization_init + mechanical_forward => grid_mechanical_spectral_polarization_forward + mechanical_solution => grid_mechanical_spectral_polarization_solution + mechanical_updateCoords => grid_mechanical_spectral_polarization_updateCoords + mechanical_restartWrite => grid_mechanical_spectral_polarization_restartWrite case ('FEM') mechanical_init => grid_mechanical_FEM_init diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarization.f90 similarity index 97% rename from src/grid/grid_mech_spectral_polarisation.f90 rename to src/grid/grid_mech_spectral_polarization.f90 index 21aa449db..78d0e5c3a 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -4,7 +4,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief Grid solver for mechanics: Spectral Polarisation !-------------------------------------------------------------------------------------------------- -module grid_mechanical_spectral_polarisation +module grid_mechanical_spectral_polarization #include #include use PETScDMDA @@ -103,18 +103,18 @@ module grid_mechanical_spectral_polarisation totalIter = 0 !< total iteration in current increment public :: & - grid_mechanical_spectral_polarisation_init, & - grid_mechanical_spectral_polarisation_solution, & - grid_mechanical_spectral_polarisation_forward, & - grid_mechanical_spectral_polarisation_updateCoords, & - grid_mechanical_spectral_polarisation_restartWrite + grid_mechanical_spectral_polarization_init, & + grid_mechanical_spectral_polarization_solution, & + grid_mechanical_spectral_polarization_forward, & + grid_mechanical_spectral_polarization_updateCoords, & + grid_mechanical_spectral_polarization_restartWrite contains !-------------------------------------------------------------------------------------------------- !> @brief Allocate all necessary fields and fill them with data, potentially from restart info. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_init(num_grid) +subroutine grid_mechanical_spectral_polarization_init(num_grid) type(tDict), pointer, intent(in) :: num_grid @@ -292,13 +292,13 @@ subroutine grid_mechanical_spectral_polarisation_init(num_grid) C_scale = C_minMaxAvg S_scale = math_invSym3333(C_minMaxAvg) -end subroutine grid_mechanical_spectral_polarisation_init +end subroutine grid_mechanical_spectral_polarization_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the Polarisation scheme with internal iterations !-------------------------------------------------------------------------------------------------- -function grid_mechanical_spectral_polarisation_solution(incInfoIn) result(solution) +function grid_mechanical_spectral_polarization_solution(incInfoIn) result(solution) !-------------------------------------------------------------------------------------------------- ! input data for solution @@ -333,14 +333,14 @@ function grid_mechanical_spectral_polarisation_solution(incInfoIn) result(soluti terminallyIll = .false. P_aim = merge(P_av,P_aim,params%stress_mask) -end function grid_mechanical_spectral_polarisation_solution +end function grid_mechanical_spectral_polarization_solution !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !> @details find new boundary conditions and best F estimate for end of current timestep !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& +subroutine grid_mechanical_spectral_polarization_forward(cutBack,guess,Delta_t,Delta_t_old,t_remaining,& deformation_BC,stress_BC,rotation_BC) logical, intent(in) :: & @@ -434,13 +434,13 @@ subroutine grid_mechanical_spectral_polarisation_forward(cutBack,guess,Delta_t,D params%rotation_BC = rotation_BC params%Delta_t = Delta_t -end subroutine grid_mechanical_spectral_polarisation_forward +end subroutine grid_mechanical_spectral_polarization_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_updateCoords() +subroutine grid_mechanical_spectral_polarization_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau @@ -451,13 +451,13 @@ subroutine grid_mechanical_spectral_polarisation_updateCoords() call DMDAVecRestoreArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) -end subroutine grid_mechanical_spectral_polarisation_updateCoords +end subroutine grid_mechanical_spectral_polarization_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_restartWrite() +subroutine grid_mechanical_spectral_polarization_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle @@ -498,7 +498,7 @@ subroutine grid_mechanical_spectral_polarisation_restartWrite() call DMDAVecRestoreArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) -end subroutine grid_mechanical_spectral_polarisation_restartWrite +end subroutine grid_mechanical_spectral_polarization_restartWrite !-------------------------------------------------------------------------------------------------- @@ -651,4 +651,4 @@ subroutine formResidual(residual_subdomain, FandF_tau, & end subroutine formResidual -end module grid_mechanical_spectral_polarisation +end module grid_mechanical_spectral_polarization From a1f797de3e815531c2b7a6357293b3ce8d2ccd75 Mon Sep 17 00:00:00 2001 From: Sharan Date: Sun, 16 Jul 2023 22:43:10 +0200 Subject: [PATCH 12/24] consistency --- src/grid/grid_mech_FEM.f90 | 4 +-- src/grid/grid_mech_spectral_basic.f90 | 7 +++--- src/grid/grid_mech_spectral_polarization.f90 | 9 +++---- src/grid/spectral_utilities.f90 | 26 +++++++++++++++----- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 742dea552..801810eb7 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -142,9 +142,9 @@ subroutine grid_mechanical_FEM_init(num_grid) num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100) if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index ea2fd63c6..98d93b7b0 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -138,8 +138,7 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) - - num%update_gamma = num_grid_fft%get_asBool ('update_gamma',defaultVal=.false.) + num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.) num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal) @@ -147,9 +146,9 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' diff --git a/src/grid/grid_mech_spectral_polarization.f90 b/src/grid/grid_mech_spectral_polarization.f90 index 78d0e5c3a..e90c8a66c 100644 --- a/src/grid/grid_mech_spectral_polarization.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -147,8 +147,7 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict) num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) - num%update_gamma = num_grid_fft%get_asBool ('update_gamma',defaultVal=.false.) - + num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.) num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal) num%eps_curl_atol = num_grid_mech%get_asReal('eps_abs_curl(F)',defaultVal=1.0e-10_pReal) @@ -162,11 +161,11 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' if (num%eps_curl_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_curl(F)' - if (num%eps_curl_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)' + if (num%eps_curl_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (num%alpha <= 0.0_pReal .or. num%alpha > 2.0_pReal) extmsg = trim(extmsg)//' alpha' diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index f87dbf3e0..d43f4d029 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -100,12 +100,18 @@ module spectral_utilities enum, bind(c); enumerator :: & DERIVATIVE_CONTINUOUS_ID, & DERIVATIVE_CENTRAL_DIFF_ID, & - DERIVATIVE_FWBW_DIFF_ID + DERIVATIVE_FWBW_DIFF_ID, & + DIVERGENCE_CORRECTION_NONE_ID, & + DIVERGENCE_CORRECTION_SIZE_ID, & + DIVERGENCE_CORRECTION_SIZE_GRID_ID end enum integer(kind(DERIVATIVE_CONTINUOUS_ID)) :: & spectral_derivative_ID + integer(kind(DIVERGENCE_CORRECTION_NONE_ID)) :: & + divergence_correction_ID + public :: & spectral_utilities_init, & utilities_updateGamma, & @@ -178,10 +184,18 @@ subroutine spectral_utilities_init() wgt = real(product(cells),pREAL)**(-1) num%memory_efficient = num_grid_fft%get_asBool('memory_efficient', defaultVal=.true.) - num%divergence_correction = num_grid_fft%get_asInt('divergence_correction', defaultVal=2) - if (num%divergence_correction < 0 .or. num%divergence_correction > 2) & - call IO_error(301,ext_msg='divergence_correction') + select case (num_grid_fft%get_asStr('divergence_correction',defaultVal='grid+size')) + case ('none') + divergence_correction_ID = DIVERGENCE_CORRECTION_NONE_ID + case ('size') + divergence_correction_ID = DIVERGENCE_CORRECTION_SIZE_ID + case ('grid+size', 'size+grid') + divergence_correction_ID = DIVERGENCE_CORRECTION_SIZE_GRID_ID + case default + call IO_error(301,ext_msg=trim(num_grid_fft%get_asStr('divergence_correction'))) + end select + select case (num_grid_fft%get_asStr('derivative',defaultVal='continuous')) case ('continuous') @@ -197,12 +211,12 @@ subroutine spectral_utilities_init() !-------------------------------------------------------------------------------------------------- ! scale dimension to calculate either uncorrected, dimension-independent, or dimension- and ! resolution-independent divergence - if (num%divergence_correction == 1) then + if (divergence_correction_ID == DIVERGENCE_CORRECTION_NONE_ID) then do j = 1, 3 if (j /= minloc(geomSize,1) .and. j /= maxloc(geomSize,1)) & scaledGeomSize = geomSize/geomSize(j) end do - elseif (num%divergence_correction == 2) then + elseif (divergence_correction_ID == DIVERGENCE_CORRECTION_SIZE_GRID_ID) then do j = 1, 3 if ( j /= int(minloc(geomSize/real(cells,pREAL),1)) & .and. j /= int(maxloc(geomSize/real(cells,pREAL),1))) & From 3d9e637f6e09951b86409fe37a71453806f52377 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 17 Jul 2023 13:39:22 +0000 Subject: [PATCH 13/24] rename performance.git to statistics.git --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15244cb24..25ffbc0f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -209,7 +209,7 @@ grid_performance: - make -j2 all install - export PATH=${PWD}/bin:${PATH} - cd $(mktemp -d) - - git clone -q git@git.damask.mpie.de:damask/performance.git . + - git clone -q git@git.damask.mpie.de:damask/statistics.git . - ./measure_performance.py --input_dir ${CI_PROJECT_DIR}/examples/grid --tag ${CI_COMMIT_SHA} - > if [ ${CI_COMMIT_BRANCH} == development ]; then @@ -222,7 +222,7 @@ update_plots: stage: statistics script: - cd $(mktemp -d) - - git clone -q git@git.damask.mpie.de:damask/performance.git . + - git clone -q git@git.damask.mpie.de:damask/statistics.git . - ./plot_commithistory.py --color green -n 5 -N 100 - ./plot_commithistory.py --color green -n 5 -N 1000 - ./plot_commithistory.py --color green -n 5 -N 10000 From 78431783ba7b23357149969b51ef2c16cec72f8f Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Mon, 17 Jul 2023 17:26:11 +0200 Subject: [PATCH 14/24] capitalisation indicate constants --- src/grid/grid_damage_spectral.f90 | 12 ++++---- src/grid/grid_mech_FEM.f90 | 16 +++++----- src/grid/grid_mech_spectral_basic.f90 | 16 +++++----- src/grid/grid_mech_spectral_polarization.f90 | 32 ++++++++++---------- src/grid/grid_thermal_spectral.f90 | 8 ++--- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index a98d31a41..c0de8ec2a 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -104,14 +104,14 @@ subroutine grid_damage_spectral_init(num_grid) num%itmax = num_grid_damage%get_asInt('N_iter_max', defaultVal=100) - num%eps_damage_atol = num_grid_damage%get_asReal('eps_abs_phi',defaultVal=1.0e-2_pReal) - num%eps_damage_rtol = num_grid_damage%get_asReal('eps_rel_phi',defaultVal=1.0e-6_pReal) - num%phi_min = num_grid_damage%get_asReal('phi_min', defaultVal=1.0e-6_pReal) + num%eps_damage_atol = num_grid_damage%get_asReal('eps_abs_phi',defaultVal=1.0e-2_pREAL) + num%eps_damage_rtol = num_grid_damage%get_asReal('eps_rel_phi',defaultVal=1.0e-6_pREAL) + num%phi_min = num_grid_damage%get_asReal('phi_min', defaultVal=1.0e-6_pREAL) - if (num%phi_min < 0.0_pReal) call IO_error(301,ext_msg='phi_min') + if (num%phi_min < 0.0_pREAL) call IO_error(301,ext_msg='phi_min') if (num%itmax < 1) call IO_error(301,ext_msg='N_iter_max') - if (num%eps_damage_atol <= 0.0_pReal) call IO_error(301,ext_msg='eps_abs_phi') - if (num%eps_damage_rtol <= 0.0_pReal) call IO_error(301,ext_msg='eps_rel_phi') + if (num%eps_damage_atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_abs_phi') + if (num%eps_damage_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_phi') !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 801810eb7..a86535e41 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -133,18 +133,18 @@ subroutine grid_mechanical_FEM_init(num_grid) ! read numerical parameters and do sanity checks num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) - num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)',defaultVal=1.0e-4_pReal) - num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)',defaultVal=5.0e-4_pReal) - num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pReal) - num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) + num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)',defaultVal=1.0e-4_pREAL) + num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)',defaultVal=5.0e-4_pREAL) + num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pREAL) + num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) num%itmin = num_grid_mech%get_asInt('N_iter_min',defaultVal=1) num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100) - if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 98d93b7b0..a94a680a6 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -140,15 +140,15 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.) - num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal) - num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal) - num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pReal) - num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) + num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pREAL) + num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pREAL) + num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pREAL) + num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) - if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' diff --git a/src/grid/grid_mech_spectral_polarization.f90 b/src/grid/grid_mech_spectral_polarization.f90 index e90c8a66c..ff15807b2 100644 --- a/src/grid/grid_mech_spectral_polarization.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -148,28 +148,28 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.) - num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal) - num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal) - num%eps_curl_atol = num_grid_mech%get_asReal('eps_abs_curl(F)',defaultVal=1.0e-10_pReal) - num%eps_curl_rtol = num_grid_mech%get_asReal('eps_rel_curl(F)',defaultVal=5.0e-4_pReal) - num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pReal) - num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) - num%alpha = num_grid_mech%get_asReal('alpha', defaultVal=1.0_pReal) - num%beta = num_grid_mech%get_asReal('beta', defaultVal=1.0_pReal) + num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pREAL) + num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pREAL) + num%eps_curl_atol = num_grid_mech%get_asReal('eps_abs_curl(F)',defaultVal=1.0e-10_pREAL) + num%eps_curl_rtol = num_grid_mech%get_asReal('eps_rel_curl(F)',defaultVal=5.0e-4_pREAL) + num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pREAL) + num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) + num%alpha = num_grid_mech%get_asReal('alpha', defaultVal=1.0_pREAL) + num%beta = num_grid_mech%get_asReal('beta', defaultVal=1.0_pREAL) num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) - if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_curl_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_curl(F)' - if (num%eps_curl_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)' - if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_curl_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_curl(F)' + if (num%eps_curl_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_curl(F)' + if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' - if (num%alpha <= 0.0_pReal .or. num%alpha > 2.0_pReal) extmsg = trim(extmsg)//' alpha' - if (num%beta < 0.0_pReal .or. num%beta > 2.0_pReal) extmsg = trim(extmsg)//' beta' + if (num%alpha <= 0.0_pREAL .or. num%alpha > 2.0_pREAL) extmsg = trim(extmsg)//' alpha' + if (num%beta < 0.0_pREAL .or. num%beta > 2.0_pREAL) extmsg = trim(extmsg)//' beta' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index bb69ce8ae..b896f157d 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -100,12 +100,12 @@ subroutine grid_thermal_spectral_init(num_grid) num%itmax = num_grid_thermal%get_asInt('N_iter_max', defaultVal=100) - num%eps_thermal_atol = num_grid_thermal%get_asReal('eps_abs_T', defaultVal=1.0e-2_pReal) - num%eps_thermal_rtol = num_grid_thermal%get_asReal('eps_rel_T', defaultVal=1.0e-6_pReal) + num%eps_thermal_atol = num_grid_thermal%get_asReal('eps_abs_T', defaultVal=1.0e-2_pREAL) + num%eps_thermal_rtol = num_grid_thermal%get_asReal('eps_rel_T', defaultVal=1.0e-6_pREAL) if (num%itmax < 1) call IO_error(301,ext_msg='N_iter_max') - if (num%eps_thermal_atol <= 0.0_pReal) call IO_error(301,ext_msg='eps_abs_T') - if (num%eps_thermal_rtol <= 0.0_pReal) call IO_error(301,ext_msg='eps_rel_T') + if (num%eps_thermal_atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_abs_T') + if (num%eps_thermal_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_T') !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc From 2bd216ab3a8ff18e5603cbd987530fb5d0cd3006 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Mon, 17 Jul 2023 17:28:03 +0200 Subject: [PATCH 15/24] avoid confusion with config module --- src/grid/DAMASK_grid.f90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index e38a88240..272fcf4f7 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -107,7 +107,7 @@ program DAMASK_grid external :: & quit type(tDict), pointer :: & - config_load, & + load, & num_solver, & num_grid, & load_step, & @@ -157,8 +157,8 @@ program DAMASK_grid end if call parallelization_bcast_str(fileContent) - config_load => YAML_parse_str_asDict(fileContent) !ToDo: misleading prefix (overlaps with entities from config module) - solver => config_load%get_dict('solver') + load => YAML_parse_str_asDict(fileContent) + solver => load%get_dict('solver') !-------------------------------------------------------------------------------------------------- ! assign mechanics solver depending on selected type @@ -212,7 +212,7 @@ program DAMASK_grid !-------------------------------------------------------------------------------------------------- - load_steps => config_load%get_list('loadstep') + load_steps => load%get_list('loadstep') allocate(loadCases(load_steps%length)) ! array of load cases do l = 1, load_steps%length From 223d321a94292c2d9477519d313a9750f358e2ea Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 17 Jul 2023 11:31:05 -0400 Subject: [PATCH 16/24] concatenated error reporting --- src/grid/grid_damage_spectral.f90 | 13 ++++++---- src/grid/grid_mech_FEM.f90 | 17 +++++++------ src/grid/grid_mech_spectral_basic.f90 | 13 +++++----- src/grid/grid_mech_spectral_polarization.f90 | 25 ++++++++++---------- src/grid/grid_thermal_spectral.f90 | 14 ++++++----- 5 files changed, 42 insertions(+), 40 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index c0de8ec2a..fa1951d90 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -88,6 +88,7 @@ subroutine grid_damage_spectral_init(num_grid) character(len=pSTRLEN) :: & snes_type character(len=:), allocatable :: & + extmsg, & petsc_options @@ -103,15 +104,17 @@ subroutine grid_damage_spectral_init(num_grid) num_grid_damage => num_grid%get_dict('damage',defaultVal=emptyDict) num%itmax = num_grid_damage%get_asInt('N_iter_max', defaultVal=100) - num%eps_damage_atol = num_grid_damage%get_asReal('eps_abs_phi',defaultVal=1.0e-2_pREAL) num%eps_damage_rtol = num_grid_damage%get_asReal('eps_rel_phi',defaultVal=1.0e-6_pREAL) num%phi_min = num_grid_damage%get_asReal('phi_min', defaultVal=1.0e-6_pREAL) - if (num%phi_min < 0.0_pREAL) call IO_error(301,ext_msg='phi_min') - if (num%itmax < 1) call IO_error(301,ext_msg='N_iter_max') - if (num%eps_damage_atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_abs_phi') - if (num%eps_damage_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_phi') + extmsg = '' + if (num%eps_damage_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_phi' + if (num%eps_damage_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_phi' + if (num%phi_min < 0.0_pReal) extmsg = trim(extmsg)//' phi_min' + if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' + + if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index a86535e41..bcc0fb648 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -121,9 +121,8 @@ subroutine grid_mechanical_FEM_init(num_grid) integer(HID_T) :: fileHandle, groupHandle type(tDict), pointer :: & num_grid_mech - character(len=pSTRLEN) :: & - extmsg = '' character(len=:), allocatable :: & + extmsg, & petsc_options @@ -133,18 +132,18 @@ subroutine grid_mechanical_FEM_init(num_grid) ! read numerical parameters and do sanity checks num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) + num%itmin = num_grid_mech%get_asInt('N_iter_min',defaultVal=1) + num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100) num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)',defaultVal=1.0e-4_pREAL) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)',defaultVal=5.0e-4_pREAL) num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pREAL) num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) - num%itmin = num_grid_mech%get_asInt('N_iter_min',defaultVal=1) - num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100) - - if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' + extmsg = '' + if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index a94a680a6..ed0652aef 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -117,9 +117,8 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) type(tDict), pointer :: & num_grid_fft, & num_grid_mech - character(len=pSTRLEN) :: & - extmsg = '' character(len=:), allocatable :: & + extmsg, & petsc_options @@ -139,16 +138,16 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.) - num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pREAL) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pREAL) num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pREAL) num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) - if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' + extmsg = '' + if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' diff --git a/src/grid/grid_mech_spectral_polarization.f90 b/src/grid/grid_mech_spectral_polarization.f90 index ff15807b2..d3fa93b13 100644 --- a/src/grid/grid_mech_spectral_polarization.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -131,9 +131,8 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) type(tDict), pointer :: & num_grid_fft,& num_grid_mech - character(len=pSTRLEN) :: & - extmsg = '' character(len=:), allocatable :: & + extmsg, & petsc_options @@ -147,6 +146,8 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict) num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) + num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) + num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.) num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pREAL) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pREAL) @@ -157,19 +158,17 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) num%alpha = num_grid_mech%get_asReal('alpha', defaultVal=1.0_pREAL) num%beta = num_grid_mech%get_asReal('beta', defaultVal=1.0_pREAL) - num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) - num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) - - if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_curl_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_curl(F)' - if (num%eps_curl_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_curl(F)' - if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' - if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' - if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' + extmsg = '' + if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_curl_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_curl(F)' + if (num%eps_curl_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)' + if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%alpha <= 0.0_pREAL .or. num%alpha > 2.0_pREAL) extmsg = trim(extmsg)//' alpha' if (num%beta < 0.0_pREAL .or. num%beta > 2.0_pREAL) extmsg = trim(extmsg)//' beta' + if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' + if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index b896f157d..ac57e028e 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -84,6 +84,7 @@ subroutine grid_thermal_spectral_init(num_grid) type(tDict), pointer :: & num_grid_thermal character(len=:), allocatable :: & + extmsg, & petsc_options @@ -99,14 +100,15 @@ subroutine grid_thermal_spectral_init(num_grid) num_grid_thermal => num_grid%get_dict('thermal',defaultVal=emptyDict) num%itmax = num_grid_thermal%get_asInt('N_iter_max', defaultVal=100) + num%eps_thermal_atol = num_grid_thermal%get_asReal('eps_abs_T', defaultVal=1.0e-2_pReal) + num%eps_thermal_rtol = num_grid_thermal%get_asReal('eps_rel_T', defaultVal=1.0e-6_pReal) - num%eps_thermal_atol = num_grid_thermal%get_asReal('eps_abs_T', defaultVal=1.0e-2_pREAL) - num%eps_thermal_rtol = num_grid_thermal%get_asReal('eps_rel_T', defaultVal=1.0e-6_pREAL) - - if (num%itmax < 1) call IO_error(301,ext_msg='N_iter_max') - if (num%eps_thermal_atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_abs_T') - if (num%eps_thermal_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_T') + extmsg = '' + if (num%eps_thermal_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_T' + if (num%eps_thermal_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_T' + if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' + if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc petsc_options = IO_postfix('-snes_type newtonls -snes_mf -snes_ksp_ew -ksp_type fgmres '// & From 6f3b409a25b9a2d1e5d2e3c1bebe1cb313d361a4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 17 Jul 2023 17:48:47 +0200 Subject: [PATCH 17/24] enable FFTW planner flags in CAPITALS --- src/grid/spectral_utilities.f90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index d43f4d029..2fde2484f 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -227,13 +227,13 @@ subroutine spectral_utilities_init() end if select case(IO_lc(num_grid_fft%get_asStr('plan_mode',defaultVal='FFTW_MEASURE'))) - case('fftw_estimate') ! ordered from slow execution (but fast plan creation) to fast execution + case('fftw_estimate', 'FFTW_ESTIMATE') ! ordered from slow execution (but fast plan creation) to fast execution FFTW_planner_flag = FFTW_ESTIMATE - case('fftw_measure') + case('fftw_measure', 'FFTW_MEASURE') FFTW_planner_flag = FFTW_MEASURE - case('fftw_patient') + case('fftw_patient', 'FFTW_PATIENT') FFTW_planner_flag = FFTW_PATIENT - case('fftw_exhaustive') + case('fftw_exhaustive', 'FFTW_EXHAUSTIVE') FFTW_planner_flag = FFTW_EXHAUSTIVE case default call IO_warning(47,'using default FFTW_MEASURE instead of "'//trim(num_grid_fft%get_asStr('plan_mode'))//'"') From 0479db85ae1f28675cafb6c4c1696c3b67a1bc94 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 17 Jul 2023 17:51:34 +0200 Subject: [PATCH 18/24] indicate constant with CAPITALS --- src/grid/grid_damage_spectral.f90 | 6 +++--- src/grid/grid_mech_FEM.f90 | 8 ++++---- src/grid/grid_mech_spectral_basic.f90 | 8 ++++---- src/grid/grid_mech_spectral_polarization.f90 | 12 ++++++------ src/grid/grid_thermal_spectral.f90 | 8 ++++---- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index fa1951d90..3ab994f93 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -109,9 +109,9 @@ subroutine grid_damage_spectral_init(num_grid) num%phi_min = num_grid_damage%get_asReal('phi_min', defaultVal=1.0e-6_pREAL) extmsg = '' - if (num%eps_damage_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_phi' - if (num%eps_damage_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_phi' - if (num%phi_min < 0.0_pReal) extmsg = trim(extmsg)//' phi_min' + if (num%eps_damage_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_phi' + if (num%eps_damage_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_phi' + if (num%phi_min < 0.0_pREAL) extmsg = trim(extmsg)//' phi_min' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index bcc0fb648..d9824dc63 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -140,10 +140,10 @@ subroutine grid_mechanical_FEM_init(num_grid) num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) extmsg = '' - if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index ed0652aef..fcc4ff50e 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -144,10 +144,10 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) extmsg = '' - if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' diff --git a/src/grid/grid_mech_spectral_polarization.f90 b/src/grid/grid_mech_spectral_polarization.f90 index d3fa93b13..382a0556a 100644 --- a/src/grid/grid_mech_spectral_polarization.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -159,12 +159,12 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) num%beta = num_grid_mech%get_asReal('beta', defaultVal=1.0_pREAL) extmsg = '' - if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' - if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' - if (num%eps_curl_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_curl(F)' - if (num%eps_curl_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)' - if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' - if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' + if (num%eps_div_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_div(P)' + if (num%eps_div_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_div(P)' + if (num%eps_curl_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_curl(F)' + if (num%eps_curl_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_curl(F)' + if (num%eps_stress_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_P' + if (num%eps_stress_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_P' if (num%alpha <= 0.0_pREAL .or. num%alpha > 2.0_pREAL) extmsg = trim(extmsg)//' alpha' if (num%beta < 0.0_pREAL .or. num%beta > 2.0_pREAL) extmsg = trim(extmsg)//' beta' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index ac57e028e..1bfaa89d4 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -100,12 +100,12 @@ subroutine grid_thermal_spectral_init(num_grid) num_grid_thermal => num_grid%get_dict('thermal',defaultVal=emptyDict) num%itmax = num_grid_thermal%get_asInt('N_iter_max', defaultVal=100) - num%eps_thermal_atol = num_grid_thermal%get_asReal('eps_abs_T', defaultVal=1.0e-2_pReal) - num%eps_thermal_rtol = num_grid_thermal%get_asReal('eps_rel_T', defaultVal=1.0e-6_pReal) + num%eps_thermal_atol = num_grid_thermal%get_asReal('eps_abs_T', defaultVal=1.0e-2_pREAL) + num%eps_thermal_rtol = num_grid_thermal%get_asReal('eps_rel_T', defaultVal=1.0e-6_pREAL) extmsg = '' - if (num%eps_thermal_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_T' - if (num%eps_thermal_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_T' + if (num%eps_thermal_atol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_T' + if (num%eps_thermal_rtol <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_T' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) From 9651f3e486a225e4c52c250b86a7f51eef09a34e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 17 Jul 2023 18:03:31 +0200 Subject: [PATCH 19/24] examples follow current implementation small polishing/consistent capitalization --- examples/config/numerics.yaml | 58 ++++++++++++-------- examples/grid/numerics.yaml | 5 +- src/grid/grid_mech_spectral_basic.f90 | 6 +- src/grid/grid_mech_spectral_polarization.f90 | 6 +- src/grid/spectral_utilities.f90 | 4 +- 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index e2759ab92..a0c7cb6b0 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -25,30 +25,40 @@ homogenization: stepIncrease: 1.5 # increase of next substep size when previous substep converged in homogenization (value higher than 1) nMPstate: 10 # materialpoint state loop limit -grid: - eps_div_atol: 1.0e-3 # absolute tolerance for fulfillment of stress equilibrium - eps_div_rtol: 5.0e-4 # relative tolerance for fulfillment of stress equilibrium - eps_curl_atol: 1.0e-12 # absolute tolerance for fulfillment of strain compatibility - eps_curl_rtol: 5.0e-4 # relative tolerance for fulfillment of strain compatibility - eps_stress_atol: 1.0e+3 # absolute tolerance for fulfillment of stress BC - eps_stress_rtol: 0.01 # relative tolerance for fulfillment of stress BC - eps_damage_atol: 1.0e-2 # absolute tolerance for damage evolution - eps_damage_rtol: 1.0e-6 # relative tolerance for damage evolution - eps_thermal_atol: 1.0e-2 # absolute tolerance for thermal equilibrium - eps_thermal_rtol: 1.0e-6 # relative tolerance for thermal equilibrium - itmax: 250 # Maximum iteration number - itmin: 2 # Minimum iteration number - fftw_timelimit: -1.0 # timelimit of plan creation for FFTW, see manual on www.fftw.org, Default -1.0: disable timelimit - fftw_plan_mode: FFTW_PATIENT # reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag - maxCutBack: 3 # maximum cut back level (0: 1, 1: 0.5, 2: 0.25, etc) - maxStaggeredIter: 10 # max number of field level staggered iterations - memory_efficient: 1 # Precalculate Gamma-operator (81 double per point) - update_gamma: false # Update Gamma-operator with current dPdF (not possible if memory_efficient=1) - divergence_correction: 2 # Use size-independent divergence criterion - derivative: continuous # Approximation used for derivatives in Fourier space - petsc_options: -snes_type ngmres -snes_ngmres_anderson # PetSc solver options - alpha: 1.0 # polarization scheme parameter 0.0 < alpha < 2.0. alpha = 1.0 ==> AL scheme, alpha = 2.0 ==> accelerated scheme - beta: 1.0 # polarization scheme parameter 0.0 < beta < 2.0. beta = 1.0 ==> AL scheme, beta = 2.0 ==> accelerated scheme +solver: + grid: + N_staggered_iter_max: 10 # max number of field level staggered iterations + N_cutback_max: 3 # maximum cut back level (0: 1, 1: 0.5, 2: 0.25, etc) + + damage: + N_iter_max: 100 # maximum iteration number + eps_abs_phi: 1.0e-2 # absolute tolerance for damage evolution + eps_rel_phi: 1.0e-6 # relative tolerance for damage evolution + thermal: + N_iter_max: 100 # maximum iteration number + eps_abs_T: 1.0e-2 # absolute tolerance for thermal equilibrium + eps_rel_T: 1.0e-6 # relative tolerance for thermal equilibrium + + mechanical: + eps_abs_div(P): 1.0e-4 # absolute tolerance for fulfillment of stress equilibrium + eps_rel_div(P): 5.0e-4 # relative tolerance for fulfillment of stress equilibrium + eps_abs_P: 1.0e3 # absolute tolerance for fulfillment of stress BC + eps_rel_P: 1.0e-3 # relative tolerance for fulfillment of stress BC + N_iter_min: 1 # minimum iteration number + N_iter_max: 100 # maximum iteration number + update_gamma: false # Update Gamma-operator with current dPdF (not possible if memory_efficient=1) + + FFT: + memory_efficient: True # Precalculate Gamma-operator (81 double per point) + divergence_correction: size+grid # Use size-independent divergence criterion + derivative: continuous # Approximation used for derivatives in Fourier space + FFTW_plan_mode: FFTW_MEASURE # planing-rigor flag, see manual on www.fftw.org + FFTW_timelimit: -1.0 # timelimit of plan creation for FFTW, see manual on www.fftw.org. -1.0: disable timelimit + PETSc_options: -snes_type ngmres -snes_ngmres_anderson # PETSc solver options + alpha: 1.0 # polarization scheme parameter 0.0 < alpha < 2.0. alpha = 1.0 ==> AL scheme, alpha = 2.0 ==> accelerated scheme + beta: 1.0 # polarization scheme parameter 0.0 < beta < 2.0. beta = 1.0 ==> AL scheme, beta = 2.0 ==> accelerated scheme + eps_abs_curl(F): 1.0e-10 # absolute tolerance for fulfillment of strain compatibility + eps_rel_curl(F): 5.0e-4 # relative tolerance for fulfillment of strain compatibility mesh: maxCutBack: 3 # maximum cut back level (0: 1, 1: 0.5, 2: 0.25, etc) diff --git a/examples/grid/numerics.yaml b/examples/grid/numerics.yaml index 1a069cb76..47582521f 100644 --- a/examples/grid/numerics.yaml +++ b/examples/grid/numerics.yaml @@ -1,3 +1,4 @@ grid: - itmin: 4 - itmax: 40 + mechanical: + itmin: 4 + itmax: 40 diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index fcc4ff50e..7c0ba2e37 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -135,9 +135,9 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict) num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) - num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) - num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) - num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.) + num%itmin = num_grid_mech%get_asInt('N_iter_min',defaultVal=1) + num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100) + num%update_gamma = num_grid_mech%get_asBool('update_gamma',defaultVal=.false.) num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pREAL) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pREAL) num%eps_stress_atol = num_grid_mech%get_asReal('eps_abs_P', defaultVal=1.0e3_pREAL) diff --git a/src/grid/grid_mech_spectral_polarization.f90 b/src/grid/grid_mech_spectral_polarization.f90 index 382a0556a..df7beb077 100644 --- a/src/grid/grid_mech_spectral_polarization.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -146,9 +146,9 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict) num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) - num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) - num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) - num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.) + num%itmin = num_grid_mech%get_asInt('N_iter_min',defaultVal=1) + num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100) + num%update_gamma = num_grid_mech%get_asBool('update_gamma',defaultVal=.false.) num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pREAL) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pREAL) num%eps_curl_atol = num_grid_mech%get_asReal('eps_abs_curl(F)',defaultVal=1.0e-10_pREAL) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 2fde2484f..453723a9b 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -226,7 +226,7 @@ subroutine spectral_utilities_init() scaledGeomSize = geomSize end if - select case(IO_lc(num_grid_fft%get_asStr('plan_mode',defaultVal='FFTW_MEASURE'))) + select case(IO_lc(num_grid_fft%get_asStr('FFTW_plan_mode',defaultVal='FFTW_MEASURE'))) case('fftw_estimate', 'FFTW_ESTIMATE') ! ordered from slow execution (but fast plan creation) to fast execution FFTW_planner_flag = FFTW_ESTIMATE case('fftw_measure', 'FFTW_MEASURE') @@ -243,7 +243,7 @@ subroutine spectral_utilities_init() !-------------------------------------------------------------------------------------------------- ! general initialization of FFTW (see manual on fftw.org for more details) if (pREAL /= C_DOUBLE .or. kind(1) /= C_INT) error stop 'C and Fortran datatypes do not match' - call fftw_set_timelimit(num_grid_fft%get_asReal('fftw_timelimit',defaultVal=300.0_pREAL)) + call fftw_set_timelimit(num_grid_fft%get_asReal('FFTW_timelimit',defaultVal=300.0_pREAL)) print'(/,1x,a)', 'FFTW initialized'; flush(IO_STDOUT) From 497974ccbbc177bb8d2fbe4d1c094adb458974c0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 17 Jul 2023 18:48:56 +0200 Subject: [PATCH 20/24] adjusted tests --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 864fa1b17..162106e63 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 864fa1b1709bb313073d6b312064637970396409 +Subproject commit 162106e6379d484ee101981c66e3f159d2f8821a From 8117e9f54c45bcee2afdb3f4303fbde761dbd4d9 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Mon, 17 Jul 2023 19:07:03 +0200 Subject: [PATCH 21/24] correct hierarchy --- examples/grid/numerics.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/grid/numerics.yaml b/examples/grid/numerics.yaml index 47582521f..4f8eaba2f 100644 --- a/examples/grid/numerics.yaml +++ b/examples/grid/numerics.yaml @@ -1,4 +1,5 @@ -grid: - mechanical: - itmin: 4 - itmax: 40 +solver: + grid: + mechanical: + N_iter_min: 4 + N_iter_max: 40 From 37c0b59afddf428f05ea79549af78426fca1e984 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 18 Jul 2023 01:34:40 +0200 Subject: [PATCH 22/24] clearer name for (non-general) postfix --- src/IO.f90 | 37 ++------------------ src/Marc/DAMASK_Marc.f90 | 2 +- src/constants.f90 | 7 ++++ src/grid/grid_damage_spectral.f90 | 5 +-- src/grid/grid_mech_FEM.f90 | 7 ++-- src/grid/grid_mech_spectral_basic.f90 | 4 ++- src/grid/grid_mech_spectral_polarization.f90 | 4 ++- src/grid/grid_thermal_spectral.f90 | 5 +-- src/misc.f90 | 32 ++++++++++++++++- 9 files changed, 57 insertions(+), 46 deletions(-) diff --git a/src/IO.f90 b/src/IO.f90 index 4fcd43c7b..ba33a8a5c 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -11,6 +11,7 @@ module IO IO_STDERR => ERROR_UNIT use prec + use constants use misc implicit none(type,external) @@ -20,13 +21,8 @@ module IO IO_WHITESPACE = achar(44)//achar(32)//achar(9)//achar(10)//achar(13), & !< whitespace characters IO_QUOTES = "'"//'"' character, parameter, public :: & - IO_EOL = new_line('DAMASK'), & !< end of line character + IO_EOL = LF, & !< end of line character IO_COMMENT = '#' - character(len=*), parameter :: LOWER = 'abcdefghijklmnopqrstuvwxyz' - character(len=len(LOWER)), parameter :: UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - character, parameter :: & - CR = achar(13), & - LF = IO_EOL public :: & IO_init, & @@ -34,7 +30,6 @@ module IO IO_readlines, & IO_isBlank, & IO_wrapLines, & - IO_postfix, & IO_strPos, & IO_strValue, & IO_intValue, & @@ -241,30 +236,6 @@ pure function IO_strPos(str) end function IO_strPos -!-------------------------------------------------------------------------------------------------- -!> @brief Append postfix to each indicator character that is followed by a lowercase letter. -!-------------------------------------------------------------------------------------------------- -function IO_postfix(string,indicator,postfix) - - character(len=*), intent(in) :: string - character, intent(in) :: indicator - character(len=*), intent(in) :: postfix - character(len=:), allocatable :: IO_postfix - - integer :: i,N - - - IO_postfix = '' - N = len(string) - do i = 1, N - IO_postfix = IO_postfix//string(i:i) - if (string(i:i) == indicator .and. verify(IO_lc(string(min(i+1,N):min(i+1,N))),LOWER) == 0) & - IO_postfix = IO_postfix//postfix - end do - -end function IO_postfix - - !-------------------------------------------------------------------------------------------------- !> @brief Read string value at myChunk from string. !-------------------------------------------------------------------------------------------------- @@ -873,10 +844,6 @@ subroutine selfTest() if ('abc,'//IO_EOL//'xxdefg,'//IO_EOL//'xxhij' /= IO_wrapLines('abc,defg, hij',filler='xx',length=4)) & error stop 'IO_wrapLines/7' - str='-a -1 -more 123 -flag -' - out=IO_postfix(str,'-+','p_') - if (out /= '-p_a -1 -p_more 123 -p_flag -') error stop 'IO_postfix' - end subroutine selfTest end module IO diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index fc63a8ab1..f2f6488f1 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -142,8 +142,8 @@ end function solverIsSymmetric end module DAMASK_interface #include "../parallelization.f90" -#include "../misc.f90" #include "../constants.f90" +#include "../misc.f90" #include "../IO.f90" #include "../YAML_types.f90" #include "../YAML_parse.f90" diff --git a/src/constants.f90 b/src/constants.f90 index 29d5ac69a..1402154c7 100644 --- a/src/constants.f90 +++ b/src/constants.f90 @@ -13,4 +13,11 @@ module constants K_B = 1.380649e-23_pREAL, & !< Boltzmann constant in J/Kelvin (https://doi.org/10.1351/goldbook) N_A = 6.02214076e23_pREAL !< Avogadro constant in 1/mol (https://doi.org/10.1351/goldbook) + character, parameter :: & + CR = achar(13), & + LF = new_line('DAMASK') + + character(len=*), parameter :: LOWER = 'abcdefghijklmnopqrstuvwxyz' + character(len=len(LOWER)), parameter :: UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + end module constants diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 3ab994f93..47809a04e 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -16,6 +16,7 @@ module grid_damage_spectral use prec use parallelization use IO + use misc use CLI use HDF5_utilities use HDF5 @@ -118,8 +119,8 @@ subroutine grid_damage_spectral_init(num_grid) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - petsc_options = IO_postfix('-snes_type newtonls -snes_mf -snes_ksp_ew -ksp_type fgmres '// & - num_grid_damage%get_asStr('PETSc_options',defaultVal=''), '-','damage_') + petsc_options = misc_prefixOptions('-snes_type newtonls -snes_mf -snes_ksp_ew -ksp_type fgmres '// & + num_grid_damage%get_asStr('PETSc_options',defaultVal=''),'damage_') call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index d9824dc63..424f60c07 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -15,8 +15,9 @@ module grid_mechanical_FEM use prec use parallelization - use CLI use IO + use misc + use CLI use HDF5 use HDF5_utilities use math @@ -152,8 +153,8 @@ subroutine grid_mechanical_FEM_init(num_grid) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - petsc_options = IO_postfix('-snes_type newtonls -ksp_type fgmres -ksp_max_it 25 '// & - num_grid_mech%get_asStr('PETSc_options',defaultVal=''), '-','mechanical_') + petsc_options = misc_prefixOptions('-snes_type newtonls -ksp_type fgmres -ksp_max_it 25 '// & + num_grid_mech%get_asStr('PETSc_options',defaultVal='') ,'mechanical_') call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 7c0ba2e37..03dbfdbf0 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -16,6 +16,7 @@ module grid_mechanical_spectral_basic use prec use parallelization use CLI + use misc use IO use HDF5 use HDF5_utilities @@ -155,7 +156,8 @@ subroutine grid_mechanical_spectral_basic_init(num_grid) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - petsc_options = IO_postfix('-snes_type ngmres '//num_grid_mech%get_asStr('PETSc_options',defaultVal=''), '-','mechanical_') + petsc_options = misc_prefixOptions('-snes_type ngmres '//num_grid_mech%get_asStr('PETSc_options',defaultVal=''), & + 'mechanical_') call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/grid/grid_mech_spectral_polarization.f90 b/src/grid/grid_mech_spectral_polarization.f90 index df7beb077..a5a5f4809 100644 --- a/src/grid/grid_mech_spectral_polarization.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -16,6 +16,7 @@ module grid_mechanical_spectral_polarization use prec use parallelization use CLI + use misc use IO use HDF5 use HDF5_utilities @@ -174,7 +175,8 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - petsc_options = IO_postfix('-snes_type ngmres '//num_grid_mech%get_asStr('PETSc_options',defaultVal=''), '-','mechanical_') + petsc_options = misc_prefixOptions('-snes_type ngmres '//num_grid_mech%get_asStr('PETSc_options',defaultVal=''), & + 'mechanical_') call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 1bfaa89d4..cc5d79e1b 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -16,6 +16,7 @@ module grid_thermal_spectral use prec use parallelization use IO + use misc use CLI use HDF5_utilities use HDF5 @@ -111,8 +112,8 @@ subroutine grid_thermal_spectral_init(num_grid) if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) !-------------------------------------------------------------------------------------------------- ! set default and user defined options for PETSc - petsc_options = IO_postfix('-snes_type newtonls -snes_mf -snes_ksp_ew -ksp_type fgmres '// & - num_grid_thermal%get_asStr('PETSc_options',defaultVal=''), '-','thermal_') + petsc_options = misc_prefixOptions('-snes_type newtonls -snes_mf -snes_ksp_ew -ksp_type fgmres '// & + num_grid_thermal%get_asStr('PETSc_options',defaultVal=''), 'thermal_') call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/misc.f90 b/src/misc.f90 index 0ba3d6970..47c23757f 100644 --- a/src/misc.f90 +++ b/src/misc.f90 @@ -5,6 +5,7 @@ !-------------------------------------------------------------------------------------------------- module misc use prec + use constants implicit none(type,external) private @@ -18,7 +19,8 @@ module misc public :: & misc_init, & - misc_optional + misc_optional, & + misc_prefixOptions contains @@ -110,6 +112,28 @@ pure function misc_optional_str(given,default) result(var) end function misc_optional_str +!-------------------------------------------------------------------------------------------------- +!> @brief Add prefix to options in string. +!> @detail An option starts with a dash followed by at least one letter. +!-------------------------------------------------------------------------------------------------- +pure function misc_prefixOptions(string,prefix) result(prefixed) + + character(len=*), intent(in) :: string,prefix + character(len=:), allocatable :: prefixed + + integer :: i,N + + + prefixed = '' + N = len(string) + do i = 1, N + prefixed = prefixed//string(i:i) + if (string(i:i) == '-' .and. verify(string(min(i+1,N):min(i+1,N)),LOWER//UPPER) == 0) & + prefixed = prefixed//prefix + end do + +end function misc_prefixOptions + !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some misc functions. @@ -117,6 +141,8 @@ end function misc_optional_str subroutine misc_selfTest() real(pREAL) :: r + character(len=:), allocatable :: str,out + call random_number(r) if (test_str('DAMASK') /= 'DAMASK') error stop 'optional_str, present' @@ -132,6 +158,10 @@ subroutine misc_selfTest() if (.not. test_bool()) error stop 'optional_bool, not present' if (misc_optional(default=r>0.5_pREAL) .neqv. r>0.5_pREAL) error stop 'optional_bool, default only' + str='-a -1 -more 123 -flag -' + out=misc_prefixOptions(str,'p_') + if (out /= '-p_a -1 -p_more 123 -p_flag -') error stop 'misc_prefixOptions' + contains function test_str(str_in) result(str_out) From a5a533d2dc9eed7f3fcb6ad1bc14a8e852a84475 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 18 Jul 2023 07:32:13 +0200 Subject: [PATCH 23/24] [skip ci] updated version information after successful test of v3.0.0-alpha7-659-gaab541218 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ca8e9e763..ae14fb4d6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-640-g6770bedb7 +3.0.0-alpha7-659-gaab541218 From 5bd95315772a4717de38789a46710209cf46f176 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 18 Jul 2023 20:27:34 +0200 Subject: [PATCH 24/24] [skip ci] updated version information after successful test of v3.0.0-alpha7-665-g341119d70 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ae14fb4d6..1a5ef9e72 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-659-gaab541218 +3.0.0-alpha7-665-g341119d70