From b11ad8c774e9353558e32fa15b36d9ce834f6c53 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 23 Mar 2023 07:51:34 +0100 Subject: [PATCH 001/198] helpful information on strain calculation --- python/damask/_result.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index f6dddc9a0..b18d9a11c 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1203,7 +1203,7 @@ class Result: 'label': f"epsilon_{t}^{m}({F['label']})", 'meta': { 'unit': F['meta']['unit'], - 'description': f'strain tensor of order {m} based on {side} stretch tensor '+\ + 'description': f'Seth-Hill strain tensor of order {m} based on {side} stretch tensor '+\ f"of {F['label']} ({F['meta']['description']})", 'creator': 'add_strain' } @@ -1212,10 +1212,11 @@ class Result: F: str = 'F', t: Literal['V', 'U'] = 'V', m: float = 0.0): - """ - Add strain tensor of a deformation gradient. + r""" + Add strain tensor (Seth-Hill family) of a deformation gradient. - For details, see damask.mechanics.strain. + By default, the logarithmic strain based on the + left stretch tensor is added. Parameters ---------- @@ -1249,6 +1250,18 @@ class Result: spatial/Eulerian strain measures (based on 'V') for elastic strains when calculating averages. + The strain is defined as: + + .. math:: + + \vb*{\epsilon}_V^{(m)} = \frac{1}{2m} (\vb{V}^{2m} - \vb{I}) \\\\ + \vb*{\epsilon}_U^{(m)} = \frac{1}{2m} (\vb{U}^{2m} - \vb{I}) + + References + ---------- + | https://en.wikipedia.org/wiki/Finite_strain_theory + | https://de.wikipedia.org/wiki/Verzerrungstensor + """ self._add_generic_pointwise(self._add_strain,{'F':F},{'t':t,'m':m}) From 09858317d8c8077df9cbe7c719e34e554804a8ca Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Tue, 4 Jul 2023 16:44:31 +0200 Subject: [PATCH 002/198] add m=0 (default) case in docstring --- PRIVATE | 2 +- python/damask/_result.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 9f4ffce8b..fc04b9ef6 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 9f4ffce8b2df951191a14dc3229de1aee6e544e6 +Subproject commit fc04b9ef621161e60a2f8b72bfa8c99e77687c71 diff --git a/python/damask/_result.py b/python/damask/_result.py index fd70ff1c0..5d04a79b7 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1252,6 +1252,11 @@ class Result: .. math:: + m = 0 \\\\ + \vb*{\epsilon}_V^{(0)} = \ln (\vb{V}) \\\\ + \vb*{\epsilon}_U^{(0)} = \ln (\vb{U}) \\\\ + + m \neq 0 \\\\ \vb*{\epsilon}_V^{(m)} = \frac{1}{2m} (\vb{V}^{2m} - \vb{I}) \\\\ \vb*{\epsilon}_U^{(m)} = \frac{1}{2m} (\vb{U}^{2m} - \vb{I}) From bd0a35a94648478eb2b9c7f3c100b7a07341236e Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Tue, 4 Jul 2023 18:30:06 +0200 Subject: [PATCH 003/198] upd PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index fc04b9ef6..9f4ffce8b 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit fc04b9ef621161e60a2f8b72bfa8c99e77687c71 +Subproject commit 9f4ffce8b2df951191a14dc3229de1aee6e544e6 From bb49289b76ec2cf05d40d16f4de4ae3d5530ab85 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 5 Jul 2023 18:47:49 +0200 Subject: [PATCH 004/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-610-g716600299 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 13e6f3049..888ca7265 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-604-g65fa62b3f +3.0.0-alpha7-610-g716600299 From 40b4062b835c0fc246067dd26093e77b4ac5c150 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 6 Jul 2023 14:39:36 +0200 Subject: [PATCH 005/198] reshape to expected shape --- src/grid/grid_mech_spectral_basic.f90 | 12 +++++++----- src/grid/grid_mech_spectral_polarisation.f90 | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 81d00db3f..f8b317b77 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -375,16 +375,17 @@ end subroutine grid_mechanical_spectral_basic_forward !-------------------------------------------------------------------------------------------------- -!> @brief Update coordinates +!> @brief Update coordinates. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_basic_updateCoords +subroutine grid_mechanical_spectral_basic_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: F + call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) - call utilities_updateCoords(F) + call utilities_updateCoords(reshape(F,[3,3,size(F,2),size(F,3),size(F,4)])) call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) @@ -392,14 +393,15 @@ end subroutine grid_mechanical_spectral_basic_updateCoords !-------------------------------------------------------------------------------------------------- -!> @brief Write current solver and constitutive data for restart to file +!> @brief Write current solver and constitutive data for restart to file. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_basic_restartWrite +subroutine grid_mechanical_spectral_basic_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:,:), pointer :: F + call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 73d2b89f2..3db67a7b1 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -432,16 +432,17 @@ end subroutine grid_mechanical_spectral_polarisation_forward !-------------------------------------------------------------------------------------------------- -!> @brief Update coordinates +!> @brief Update coordinates. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_updateCoords +subroutine grid_mechanical_spectral_polarisation_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau + call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) - call utilities_updateCoords(FandF_tau(0:8,:,:,:)) + call utilities_updateCoords(reshape(FandF_tau(0:8,:,:,:),[3,3,size(FandF_tau,2),size(FandF_tau,3),size(FandF_tau,4)])) call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) @@ -449,14 +450,15 @@ end subroutine grid_mechanical_spectral_polarisation_updateCoords !-------------------------------------------------------------------------------------------------- -!> @brief Write current solver and constitutive data for restart to file +!> @brief Write current solver and constitutive data for restart to file. !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_restartWrite +subroutine grid_mechanical_spectral_polarisation_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau, F, F_tau + call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) F => FandF_tau(0: 8,:,:,:) From 3af61233c942c52c8e48e34e6702d4b3941da381 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Jul 2023 13:25:37 +0200 Subject: [PATCH 006/198] option to specify numerics configuration file and jobname default jobname now includes all CLI arguments (for mesh/grid only) --- PRIVATE | 2 +- src/CLI.f90 | 236 +++++++++++++++++++++++++++++-------------------- src/config.f90 | 38 ++++---- 3 files changed, 163 insertions(+), 113 deletions(-) diff --git a/PRIVATE b/PRIVATE index 9f4ffce8b..3c4052994 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 9f4ffce8b2df951191a14dc3229de1aee6e544e6 +Subproject commit 3c4052994318bf41620af2e4c8795f36cabc3645 diff --git a/src/CLI.f90 b/src/CLI.f90 index e38532268..cc0fec002 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -21,14 +21,16 @@ module CLI implicit none(type,external) private integer, public, protected :: & - CLI_restartInc = 0 !< Increment at which calculation starts + CLI_restartInc = 0 !< increment at which calculation starts character(len=:), allocatable, public, protected :: & - CLI_geomFile, & !< parameter given for geometry file - CLI_loadFile, & !< parameter given for load case file - CLI_materialFile + CLI_geomFile, & !< location of the geometry file + CLI_loadFile, & !< location of the load case file + CLI_materialFile, & !< location of the material configuration file + CLI_numericsFile, & !< location of the numerics configuration file + solverJobname public :: & - getSolverJobName, & + getSolverJobname, & CLI_init contains @@ -47,10 +49,11 @@ subroutine CLI_init() character(len=:), allocatable :: & commandLine, & !< command line call as string arg, & !< individual argument - loadCaseArg, & !< -l argument given to the executable - geometryArg, & !< -g argument given to the executable - materialArg, & !< -m argument given to the executable - workingDirArg !< -w argument given to the executable + geomArg, & !< -g CLI argument + loadArg, & !< -l CLI argument + materialArg, & !< -m CLI argument + numericsArg, & !< -n CLI argument + workingDirArg !< -w CLI argument integer :: & stat, & i @@ -62,94 +65,105 @@ subroutine CLI_init() workingDirArg = getCWD() - print '(/,1x,a)', '<<<+- CLI init -+>>>' + print'(/,1x,a)', '<<<+- CLI init -+>>>' ! http://patorjk.com/software/taag/#p=display&f=Lean&t=DAMASK%203 #ifdef DEBUG - print '(a)', achar(27)//'[31m' - print '(1x,a,/)', 'debug version - debug version - debug version - debug version - debug version' + 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)//'[94m' #endif - print '(1x,a)', ' _/_/_/ _/_/ _/ _/ _/_/ _/_/_/ _/ _/ _/_/_/' - print '(1x,a)', ' _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/' - print '(1x,a)', ' _/ _/ _/_/_/_/ _/ _/ _/ _/_/_/_/ _/_/ _/_/ _/_/' - print '(1x,a)', ' _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/' - print '(1x,a)', '_/_/_/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/ _/_/_/' + print'(1x,a)', ' _/_/_/ _/_/ _/ _/ _/_/ _/_/_/ _/ _/ _/_/_/' + print'(1x,a)', ' _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/' + print'(1x,a)', ' _/ _/ _/_/_/_/ _/ _/ _/ _/_/_/_/ _/_/ _/_/ _/_/' + print'(1x,a)', ' _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/' + print'(1x,a)', '_/_/_/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/ _/_/_/' #if defined(GRID) - print '(1x,a)', 'Grid solver' + print'(1x,a)', 'Grid solver' #elif defined(MESH) - print '(1x,a)', 'Mesh solver' + print'(1x,a)', 'Mesh solver' #endif #ifdef DEBUG - print '(/,1x,a)', 'debug version - debug version - debug version - debug version - debug version' + print'(/,1x,a)', 'debug version - debug version - debug version - debug version - debug version' #endif - print '(a)', achar(27)//'[0m' + print'(a)', achar(27)//'[0m' - print '(1x,a)', 'F. Roters et al., Computational Materials Science 158:420–478, 2019' - print '(1x,a)', 'https://doi.org/10.1016/j.commatsci.2018.04.030' + print'(1x,a)', 'F. Roters et al., Computational Materials Science 158:420–478, 2019' + print'(1x,a)', 'https://doi.org/10.1016/j.commatsci.2018.04.030' - print '(/,1x,a)', 'Version: '//DAMASKVERSION + print'(/,1x,a)', 'Version: '//DAMASKVERSION - print '(/,1x,a)', 'Compiled with: '//compiler_version() - print '(1x,a)', 'Compiled on: '//CMAKE_SYSTEM - print '(1x,a)', 'Compiler options: '//compiler_options() + print'(/,1x,a)', 'Compiled with: '//compiler_version() + print'(1x,a)', 'Compiled on: '//CMAKE_SYSTEM + print'(1x,a)', 'Compiler options: '//compiler_options() ! https://github.com/jeffhammond/HPCInfo/blob/master/docs/Preprocessor-Macros.md - print '(/,1x,a)', 'Compiled on: '//__DATE__//' at '//__TIME__ + print'(/,1x,a)', 'Compiled on: '//__DATE__//' at '//__TIME__ - print '(/,1x,a,1x,i0,a,i0,a,i0)', & + print'(/,1x,a,1x,i0,a,i0,a,i0)', & 'PETSc version:',PETSC_VERSION_MAJOR,'.',PETSC_VERSION_MINOR,'.',PETSC_VERSION_SUBMINOR call date_and_time(values = dateAndTime) - print '(/,1x,a,1x,2(i2.2,a),i4.4)', 'Date:',dateAndTime(3),'/',dateAndTime(2),'/',dateAndTime(1) - print '(1x,a,1x,2(i2.2,a),i2.2)', 'Time:',dateAndTime(5),':',dateAndTime(6),':',dateAndTime(7) + print'(/,1x,a,1x,2(i2.2,a),i4.4)', 'Date:',dateAndTime(3),'/',dateAndTime(2),'/',dateAndTime(1) + print'(1x,a,1x,2(i2.2,a),i2.2)', 'Time:',dateAndTime(5),':',dateAndTime(6),':',dateAndTime(7) do i = 1, command_argument_count() arg = getArg(i) select case(trim(arg)) ! extract key case ('-h','--help') - print '(/,1x,a)','#######################################################################' - print '(1x,a)', 'DAMASK Command Line Interface:' - print '(1x,a)', 'Düsseldorf Advanced Material Simulation Kit with PETSc-based solvers' - print '(1x,a,/)','#######################################################################' - print '(1x,a,/)','Valid command line switches:' - print '(1x,a)', ' --geom (-g, --geometry)' - print '(1x,a)', ' --load (-l, --loadcase)' - print '(1x,a)', ' --material (-m, --materialconfig)' - print '(1x,a)', ' --workingdir (-w, --wd, --workingdirectory)' - print '(1x,a)', ' --restart (-r, --rs)' - print '(1x,a)', ' --help (-h)' - print '(/,1x,a)','-----------------------------------------------------------------------' - print '(1x,a)', 'Mandatory arguments:' - print '(/,1x,a)',' --geom PathToGeomFile/NameOfGeom' - print '(1x,a)', ' Specifies the location of the geometry definition file.' - print '(/,1x,a)',' --load PathToLoadFile/NameOfLoadFile' - print '(1x,a)', ' Specifies the location of the load case definition file.' - print '(/,1x,a)',' --material PathToMaterialConfigurationFile/NameOfMaterialConfigurationFile' - print '(1x,a)', ' Specifies the location of the material configuration file.' - print '(/,1x,a)','-----------------------------------------------------------------------' - print '(1x,a)', 'Optional arguments:' - print '(/,1x,a)',' --workingdirectory PathToWorkingDirectory' - print '(1x,a)', ' Specifies the base directory of relative paths.' - print '(/,1x,a)',' --restart N' - print '(1x,a)', ' Reads in increment N and continues with calculating' - print '(1x,a)', ' increment N+1, N+2, ... based on this.' - print '(1x,a)', ' Appends to existing results file' - print '(1x,a)', ' "NameOfGeom_NameOfLoadFile_NameOfMaterialConfigurationFile.hdf5".' - print '(1x,a)', ' Works only if the restart information for increment N' - print '(1x,a)', ' is available in the base directory.' - print '(/,1x,a)','-----------------------------------------------------------------------' - print '(1x,a)', 'Help:' - print '(/,1x,a)',' --help' - print '(1x,a,/)',' Prints this message and exits' + print'(/,1x,a)','#######################################################################' + print'(1x,a)', 'DAMASK Command Line Interface:' + print'(1x,a)', 'Düsseldorf Advanced Material Simulation Kit with PETSc-based solvers' + print'(1x,a,/)','#######################################################################' + print'(1x,a,/)','Valid command line switches:' + print'(1x,a)', ' --geom (-g, --geometry)' + print'(1x,a)', ' --load (-l, --loadcase)' + print'(1x,a)', ' --material (-m, --materialconfig)' + print'(1x,a)', ' --numerics (-n, --numericsconfig)' + print'(1x,a)', ' --jobname (-j, --job)' + print'(1x,a)', ' --workingdir (-w, --wd, --workingdirectory)' + print'(1x,a)', ' --restart (-r, --rs)' + print'(1x,a)', ' --help (-h)' + print'(/,1x,a)','-----------------------------------------------------------------------' + print'(1x,a)', 'Mandatory arguments:' + print'(/,1x,a)',' --geom GEOMFILE' + print'(1x,a)', ' specify the file path of the geometry definition' + print'(/,1x,a)',' --load LOADFILE' + print'(1x,a)', ' specify the file path of the load case definition' + print'(/,1x,a)',' --material MATERIALFILE' + print'(1x,a)', ' specify the file path of the material configuration' + print'(/,1x,a)','-----------------------------------------------------------------------' + print'(1x,a)', 'Optional arguments:' + print'(/,1x,a)',' --numerics NUMERICSFILE' + print'(1x,a)', ' Specify the file path of the numerics configuration' + print'(/,1x,a)',' --jobname JOBNAME' + print'(1x,a)', ' specify the job name.' + print'(1x,a)', ' Defaults to GEOM_LOAD_MATERIAL[_NUMERICS].' + print'(/,1x,a)',' --workingdirectory WORKINGDIRECTORY' + print'(1x,a)', ' specify the base directory of relative paths.' + print'(1x,a)', ' Defaults to the current working directory' + print'(/,1x,a)',' --restart N' + print'(1x,a)', ' read in increment N and continues with calculating' + print'(1x,a)', ' increment N+1, N+2, ... based on this' + print'(1x,a)', ' works only if the restart information for increment N' + print'(1x,a)', ' is available in JOBNAME_restart.hdf5' + print'(1x,a)', ' append to existing results file JOBNAME.hdf5' + print'(/,1x,a)','-----------------------------------------------------------------------' + print'(1x,a)', 'Help:' + print'(/,1x,a)',' --help' + print'(1x,a,/)',' Prints this message and exits' call quit(0) ! normal Termination - case ('-l', '--load', '--loadcase') - loadCaseArg = getArg(i+1) case ('-g', '--geom', '--geometry') - geometryArg = getArg(i+1) + geomArg = getArg(i+1) + case ('-l', '--load', '--loadcase') + loadArg = getArg(i+1) case ('-m', '--material', '--materialconfig') materialArg = getArg(i+1) + case ('-n', '--numerics', '--numericsconfig') + numericsArg = getArg(i+1) + case ('-j', '--job', '--jobname') + solverJobname = getArg(i+1) case ('-w', '--wd', '--workingdir', '--workingdirectory') workingDirArg = getArg(i+1) case ('-r', '--rs', '--restart') @@ -162,33 +176,46 @@ subroutine CLI_init() end select end do - if (.not. all([allocated(loadcaseArg),allocated(geometryArg),allocated(materialArg)])) then - print '(/,1x,a)', 'ERROR: Please specify geometry AND load case AND material configuration (-h for help)' + 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)' call quit(1) end if call setWorkingDirectory(trim(workingDirArg)) - CLI_geomFile = getPathRelCWD(geometryArg,'geometry') - CLI_loadFile = getPathRelCWD(loadCaseArg,'load case') + CLI_geomFile = getPathRelCWD(geomArg,'geometry') + CLI_loadFile = getPathRelCWD(loadArg,'load case') CLI_materialFile = getPathRelCWD(materialArg,'material configuration') + if (allocated(numericsArg)) then + CLI_numericsFile = getPathRelCWD(numericsArg,'numerics configuration') + else + CLI_numericsFile = '' + endif + + 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' + call quit(1) + endif commandLine = getArg(-1) - print '(/,1x,a)', 'Host name: '//getHostName() - print '(1x,a)', 'User name: '//getUserName() + print'(/,1x,a)', 'Host name: '//getHostName() + print'(1x,a)', 'User name: '//getUserName() - print '(/,1x,a,/)', 'Command line call: '//trim(commandLine) - print '(1x,a)', 'Working directory: '//IO_glueDiffering(getCWD(),workingDirArg) - print '(1x,a)', 'Geometry: '//IO_glueDiffering(CLI_geomFile,geometryArg) - print '(1x,a)', 'Load case: '//IO_glueDiffering(CLI_loadFile,loadCaseArg) - print '(1x,a)', 'Material config: '//IO_glueDiffering(CLI_materialFile,materialArg) - print '(1x,a)', 'Solver job name: '//getSolverJobName() + print'(/,1x,a,/)', 'Command line call: '//trim(commandLine) + print'(1x,a)', 'Working directory: '//IO_glueDiffering(getCWD(),workingDirArg) + print'(1x,a)', 'Geometry: '//IO_glueDiffering(CLI_geomFile,geomArg) + print'(1x,a)', 'Load case: '//IO_glueDiffering(CLI_loadFile,loadArg) + print'(1x,a)', 'Material config: '//IO_glueDiffering(CLI_materialFile,materialArg) + print'(1x,a)', 'Solver job name: '//getSolverJobname() if (CLI_restartInc > 0) & - print '(1x,a,i6.6)', 'Restart from increment: ', CLI_restartInc + print'(1x,a,i6.6)', 'Restart from increment: ', CLI_restartInc end subroutine CLI_init + !-------------------------------------------------------------------------------------------------- !> @brief Get argument from command line. !-------------------------------------------------------------------------------------------------- @@ -242,7 +269,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)', 'ERROR: Invalid Working directory: '//trim(workingDirectory) call quit(1) end if @@ -250,26 +277,43 @@ end subroutine setWorkingDirectory !-------------------------------------------------------------------------------------------------- -!> @brief solver job name (no extension) as combination of geometry and load case name +!> @brief Return solver job name (MSC.Marc compatible). !-------------------------------------------------------------------------------------------------- -function getSolverJobName() +function getSolverJobname() - character(len=:), allocatable :: getSolverJobName - - integer :: posExt,posSep + character(len=:), allocatable :: getSolverJobname - posExt = scan(CLI_geomFile,'.',back=.true.) - posSep = scan(CLI_geomFile,'/',back=.true.) + getSolverJobname = solverJobname - getSolverJobName = CLI_geomFile(posSep+1:posExt-1) +end function getSolverJobname - posExt = scan(CLI_loadFile,'.',back=.true.) - posSep = scan(CLI_loadFile,'/',back=.true.) - getSolverJobName = getSolverJobName//'_'//CLI_loadFile(posSep+1:posExt-1) +!-------------------------------------------------------------------------------------------------- +!> @brief Determine solver job name. +!-------------------------------------------------------------------------------------------------- +function jobname(geomFile,LoadFile,materialsFile,numericsFile) -end function getSolverJobName + character(len=:), allocatable :: jobname + character(len=*), intent(in) :: geomFile,loadFile,materialsFile,numericsFile + + + jobname = stem(geomFile)//'_'//stem(loadFile)//'_'//stem(materialsFile) + if (len_trim(numericsFile) > 0) jobname = jobname//'_'//stem(numericsFile) + + contains + + function stem(fullname) + + character(len=:), allocatable :: stem + character(len=*), intent(in) :: fullname + + + stem = fullname(scan(fullname,'/',back=.true.)+1:scan(fullname,'.',back=.true.)-1) + + end function stem + +end function jobname !-------------------------------------------------------------------------------------------------- @@ -291,7 +335,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)', 'ERROR: '//fileType//' file does not exist: '//trim(getPathRelCWD) call quit(1) end if diff --git a/src/config.f90 b/src/config.f90 index 9006839bf..e0b2dcdad 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -68,11 +68,10 @@ end subroutine config_numerics_deallocate !-------------------------------------------------------------------------------------------------- function config_listReferences(config,indent) result(references) - type(tDict) :: config - integer, optional :: indent + type(tDict), intent(in) :: config + integer, intent(in), optional :: indent character(len=:), allocatable :: references - type(tList), pointer :: ref character(len=:), allocatable :: filler integer :: r @@ -97,13 +96,13 @@ end function config_listReferences !-------------------------------------------------------------------------------------------------- subroutine parse_material() - logical :: fileExists character(len=:), allocatable :: & fileContent, fname + if (worldrank == 0) then print'(/,1x,a)', 'reading material configuration'; flush(IO_STDOUT) -#if defined(MESH) || defined(GRID) +#if defined(MESH) || defined(GRID) fname = CLI_materialFile #else fname = 'material.yaml' @@ -126,23 +125,30 @@ end subroutine parse_material !-------------------------------------------------------------------------------------------------- subroutine parse_numerics() - logical :: fileExists - character(len=:), allocatable :: fileContent + character(len=:), allocatable :: & + fileContent, fname + logical :: parse config_numerics => emptyDict - inquire(file='numerics.yaml', exist=fileExists) - if (fileExists) then +#if defined(MESH) || defined(GRID) + fname = CLI_numericsFile + parse = len_trim(CLI_numericsFile) > 0 +#else + fname = 'numerics.yaml' + inquire(file=fname, exist=parse) +#endif + + if (parse) then if (worldrank == 0) then - print'(1x,a)', 'reading numerics.yaml'; flush(IO_STDOUT) - fileContent = IO_read('numerics.yaml') - if (len(fileContent) > 0) then - call result_openJobFile(parallel=.false.) - call result_writeDataset_str(fileContent,'setup','numerics.yaml','numerics configuration') - call result_closeJobFile() - end if + print'(1x,a)', 'reading numerics configuration'; flush(IO_STDOUT) + fileContent = IO_read(fname) + if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:) + call result_openJobFile(parallel=.false.) + call result_writeDataset_str(fileContent,'setup',fname,'numerics configuration') + call result_closeJobFile() end if call parallelization_bcast_str(fileContent) From 4a1c6e7b4f237ea6331ddeb7f38c3d7dbf6d0dbb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 10 Jul 2023 20:05:17 +0200 Subject: [PATCH 007/198] unified code --- src/CLI.f90 | 10 +++--- src/config.f90 | 82 +++++++++++++++++--------------------------------- 2 files changed, 31 insertions(+), 61 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index cc0fec002..771d6da9f 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -185,11 +185,8 @@ subroutine CLI_init() CLI_geomFile = getPathRelCWD(geomArg,'geometry') CLI_loadFile = getPathRelCWD(loadArg,'load case') CLI_materialFile = getPathRelCWD(materialArg,'material configuration') - if (allocated(numericsArg)) then + if (allocated(numericsArg)) & CLI_numericsFile = getPathRelCWD(numericsArg,'numerics configuration') - else - CLI_numericsFile = '' - endif if (.not. allocated(solverJobname)) then solverJobname = jobname(CLI_geomFile,CLI_loadFile,CLI_materialFile,CLI_numericsFile) @@ -295,11 +292,12 @@ end function getSolverJobname function jobname(geomFile,LoadFile,materialsFile,numericsFile) character(len=:), allocatable :: jobname - character(len=*), intent(in) :: geomFile,loadFile,materialsFile,numericsFile + character(len=*), intent(in) :: geomFile,loadFile,materialsFile + character(len=:), allocatable, intent(in) :: numericsFile jobname = stem(geomFile)//'_'//stem(loadFile)//'_'//stem(materialsFile) - if (len_trim(numericsFile) > 0) jobname = jobname//'_'//stem(numericsFile) + if (allocated(numericsFile)) jobname = jobname//'_'//stem(numericsFile) contains diff --git a/src/config.f90 b/src/config.f90 index e0b2dcdad..edb72fbd3 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -34,8 +34,23 @@ subroutine config_init() print'(/,1x,a)', '<<<+- config init -+>>>'; flush(IO_STDOUT) - call parse_material() - call parse_numerics() +#if defined(MESH) || defined(GRID) + config_material => parse(CLI_materialFile,'material configuration') +#else + config_material => parse('material.yaml','material configuration') +#endif + + config_numerics => emptyDict +#if defined(MESH) || defined(GRID) + if (allocated(CLI_numericsFile)) & + config_numerics => parse(CLI_numericsFile,'numerics configuration') +#else + MSCMarc: block + logical :: exists + inquire(file='numerics.yaml',exist=exists) + if (exists) config_numerics => parse('numerics.yaml','numerics configuration') + end block MSCMarc +#endif end subroutine config_init @@ -92,70 +107,27 @@ end function config_listReferences !-------------------------------------------------------------------------------------------------- -!> @brief Read material.yaml. +!> @brief Read configuration, spread over all processes, and add to DADF5. !-------------------------------------------------------------------------------------------------- -subroutine parse_material() +function parse(fname,description) - character(len=:), allocatable :: & - fileContent, fname + character(len=*), intent(in) :: fname, description + type(tDict), pointer :: parse + + character(len=:), allocatable :: fileContent if (worldrank == 0) then - print'(/,1x,a)', 'reading material configuration'; flush(IO_STDOUT) -#if defined(MESH) || defined(GRID) - fname = CLI_materialFile -#else - fname = 'material.yaml' -#endif + print'(/,1x,a)', 'reading '//description; flush(IO_STDOUT) fileContent = IO_read(fname) - if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:) call result_openJobFile(parallel=.false.) - call result_writeDataset_str(fileContent,'setup',fname,'material configuration') + call result_writeDataset_str(fileContent,'setup',fname(scan(fname,'/',.true.)+1:),description) call result_closeJobFile() end if call parallelization_bcast_str(fileContent) - config_material => YAML_parse_str_asDict(fileContent) + parse => YAML_parse_str_asDict(fileContent) -end subroutine parse_material - - -!-------------------------------------------------------------------------------------------------- -!> @brief Read numerics.yaml. -!-------------------------------------------------------------------------------------------------- -subroutine parse_numerics() - - character(len=:), allocatable :: & - fileContent, fname - logical :: parse - - - config_numerics => emptyDict - -#if defined(MESH) || defined(GRID) - fname = CLI_numericsFile - parse = len_trim(CLI_numericsFile) > 0 -#else - fname = 'numerics.yaml' - inquire(file=fname, exist=parse) -#endif - - if (parse) then - - if (worldrank == 0) then - print'(1x,a)', 'reading numerics configuration'; flush(IO_STDOUT) - fileContent = IO_read(fname) - if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:) - call result_openJobFile(parallel=.false.) - call result_writeDataset_str(fileContent,'setup',fname,'numerics configuration') - call result_closeJobFile() - end if - call parallelization_bcast_str(fileContent) - - config_numerics => YAML_parse_str_asDict(fileContent) - - end if - -end subroutine parse_numerics +end function parse end module config From cf74a687c5e69409282bd8124c73e4f40d2539c6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 10 Jul 2023 20:40:22 +0200 Subject: [PATCH 008/198] not needed --- src/grid/grid_mech_FEM.f90 | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 534cf952f..6500f30ce 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -351,15 +351,8 @@ subroutine grid_mechanical_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remai rotation_BC PetscErrorCode :: err_PETSc - PetscScalar, pointer, dimension(:,:,:,:) :: & - u,u_lastInc - call DMDAVecGetArrayF90(mechanical_grid,solution_current,u,err_PETSc) - CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) - CHKERRQ(err_PETSc) - if (cutBack) then C_volAvg = C_volAvgLastInc else @@ -408,10 +401,6 @@ subroutine grid_mechanical_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remai call VecAXPY(solution_current,Delta_t,solution_rate,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayF90(mechanical_grid,solution_current,u,err_PETSc) - CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) - CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- ! set module wide available data From 15e5bce7e4a535ab54573f50a3b2087139295963 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 10 Jul 2023 20:50:24 +0200 Subject: [PATCH 009/198] indicate read-only access --- src/grid/grid_damage_spectral.f90 | 6 +++--- src/grid/grid_mech_FEM.f90 | 20 ++++++++++---------- src/grid/grid_mech_spectral_basic.f90 | 12 ++++++------ src/grid/grid_mech_spectral_polarisation.f90 | 12 ++++++------ src/grid/grid_thermal_spectral.f90 | 6 +++--- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 4724f03d0..90680daea 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -307,7 +307,7 @@ end subroutine grid_damage_spectral_forward !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file. !-------------------------------------------------------------------------------------------------- -subroutine grid_damage_spectral_restartWrite +subroutine grid_damage_spectral_restartWrite() PetscErrorCode :: err_PETSc DM :: dm_local @@ -316,7 +316,7 @@ subroutine grid_damage_spectral_restartWrite call SNESGetDM(SNES_damage,dm_local,err_PETSc); CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(dm_local,solution_vec,phi,err_PETSc); + call DMDAVecGetArrayReadF90(dm_local,solution_vec,phi,err_PETSc); CHKERRQ(err_PETSc) print'(1x,a)', 'saving damage solver data required for restart'; flush(IO_STDOUT) @@ -328,7 +328,7 @@ subroutine grid_damage_spectral_restartWrite call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) - call DMDAVecRestoreArrayF90(dm_local,solution_vec,phi,err_PETSc); + call DMDAVecRestoreArrayReadF90(dm_local,solution_vec,phi,err_PETSc); CHKERRQ(err_PETSc) end subroutine grid_damage_spectral_restartWrite diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 6500f30ce..17bf01ac0 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -414,7 +414,7 @@ end subroutine grid_mechanical_FEM_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_FEM_updateCoords +subroutine grid_mechanical_FEM_updateCoords() call utilities_updateCoords(F) @@ -424,16 +424,16 @@ end subroutine grid_mechanical_FEM_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_FEM_restartWrite +subroutine grid_mechanical_FEM_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle PetscScalar, dimension(:,:,:,:), pointer :: u,u_lastInc - call DMDAVecGetArrayF90(mechanical_grid,solution_current,u,err_PETSc) + call DMDAVecGetArrayReadF90(mechanical_grid,solution_current,u,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) + call DMDAVecGetArrayReadF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT) @@ -460,9 +460,9 @@ subroutine grid_mechanical_FEM_restartWrite call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayF90(mechanical_grid,solution_current,u,err_PETSc) + call DMDAVecRestoreArrayReadF90(mechanical_grid,solution_current,u,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) + call DMDAVecRestoreArrayReadF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_FEM_restartWrite @@ -555,7 +555,7 @@ subroutine formResidual(da_local,x_local, & !-------------------------------------------------------------------------------------------------- ! get deformation gradient - call DMDAVecGetArrayF90(da_local,x_local,x_scal,err_PETSc) + call DMDAVecGetArrayReadF90(da_local,x_local,x_scal,err_PETSc) CHKERRQ(err_PETSc) do k = cells3Offset+1, cells3Offset+cells3; do j = 1, cells(2); do i = 1, cells(1) ctr = 0 @@ -565,7 +565,7 @@ subroutine formResidual(da_local,x_local, & end do; end do; end do F(1:3,1:3,i,j,k-cells3Offset) = params%rotation_BC%rotate(F_aim,active=.true.) + transpose(matmul(BMat,x_elem)) end do; end do; end do - call DMDAVecRestoreArrayF90(da_local,x_local,x_scal,err_PETSc) + call DMDAVecRestoreArrayReadF90(da_local,x_local,x_scal,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- @@ -585,7 +585,7 @@ subroutine formResidual(da_local,x_local, & ! constructing residual call DMDAVecGetArrayF90(da_local,f_local,r,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(da_local,x_local,x_scal,err_PETSc) + call DMDAVecGetArrayReadF90(da_local,x_local,x_scal,err_PETSc) CHKERRQ(err_PETSc) ele = 0 r = 0.0_pREAL @@ -606,7 +606,7 @@ subroutine formResidual(da_local,x_local, & r(0:2,i+ii,j+jj,k+kk) = r(0:2,i+ii,j+jj,k+kk) + f_elem(ctr,1:3) end do; end do; end do end do; end do; end do - call DMDAVecRestoreArrayF90(da_local,x_local,x_scal,err_PETSc) + call DMDAVecRestoreArrayReadF90(da_local,x_local,x_scal,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 81d00db3f..70e764549 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -377,15 +377,15 @@ end subroutine grid_mechanical_spectral_basic_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_basic_updateCoords +subroutine grid_mechanical_spectral_basic_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: F - call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecGetArrayReadF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) call utilities_updateCoords(F) - call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecRestoreArrayReadF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_basic_updateCoords @@ -394,13 +394,13 @@ end subroutine grid_mechanical_spectral_basic_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_basic_restartWrite +subroutine grid_mechanical_spectral_basic_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:,:), pointer :: F - call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecGetArrayReadF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) if (num%update_gamma) C_minMaxAvgRestart = C_minMaxAvg @@ -428,7 +428,7 @@ subroutine grid_mechanical_spectral_basic_restartWrite call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecRestoreArrayReadF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_basic_restartWrite diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 73d2b89f2..168794316 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -434,15 +434,15 @@ end subroutine grid_mechanical_spectral_polarisation_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_updateCoords +subroutine grid_mechanical_spectral_polarisation_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau - call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecGetArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) call utilities_updateCoords(FandF_tau(0:8,:,:,:)) - call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecRestoreArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_polarisation_updateCoords @@ -451,13 +451,13 @@ end subroutine grid_mechanical_spectral_polarisation_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_restartWrite +subroutine grid_mechanical_spectral_polarisation_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau, F, F_tau - call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecGetArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) F => FandF_tau(0: 8,:,:,:) F_tau => FandF_tau(9:17,:,:,:) @@ -489,7 +489,7 @@ subroutine grid_mechanical_spectral_polarisation_restartWrite call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecRestoreArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_polarisation_restartWrite diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 70d307ed9..1c3f2129a 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -285,7 +285,7 @@ end subroutine grid_thermal_spectral_forward !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file. !-------------------------------------------------------------------------------------------------- -subroutine grid_thermal_spectral_restartWrite +subroutine grid_thermal_spectral_restartWrite() PetscErrorCode :: err_PETSc DM :: dm_local @@ -294,7 +294,7 @@ subroutine grid_thermal_spectral_restartWrite call SNESGetDM(SNES_thermal,dm_local,err_PETSc); CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(dm_local,solution_vec,T,err_PETSc); + call DMDAVecGetArrayReadF90(dm_local,solution_vec,T,err_PETSc); CHKERRQ(err_PETSc) print'(1x,a)', 'saving thermal solver data required for restart'; flush(IO_STDOUT) @@ -307,7 +307,7 @@ subroutine grid_thermal_spectral_restartWrite call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) - call DMDAVecRestoreArrayF90(dm_local,solution_vec,T,err_PETSc); + call DMDAVecRestoreArrayReadF90(dm_local,solution_vec,T,err_PETSc); CHKERRQ(err_PETSc) end subroutine grid_thermal_spectral_restartWrite From 162a009aa9b82408d92acd7437eb95530789992b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 11 Jul 2023 15:11:17 +0200 Subject: [PATCH 010/198] helpful error messages --- src/CLI.f90 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CLI.f90 b/src/CLI.f90 index 771d6da9f..587ae7949 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -155,18 +155,25 @@ subroutine CLI_init() print'(1x,a,/)',' Prints this message and exits' call quit(0) ! normal Termination case ('-g', '--geom', '--geometry') + if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --geom' geomArg = getArg(i+1) case ('-l', '--load', '--loadcase') + if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --load' loadArg = getArg(i+1) case ('-m', '--material', '--materialconfig') + if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --material' materialArg = getArg(i+1) case ('-n', '--numerics', '--numericsconfig') + if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --numerics' numericsArg = getArg(i+1) case ('-j', '--job', '--jobname') + if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --jobname' solverJobname = getArg(i+1) case ('-w', '--wd', '--workingdir', '--workingdirectory') + if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --workingdirectory' workingDirArg = getArg(i+1) case ('-r', '--rs', '--restart') + if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --restart' arg = getArg(i+1) read(arg,*,iostat=stat) CLI_restartInc if (CLI_restartInc < 0 .or. stat /= 0) then From 3dafb26bb10eb5143cc030ca9c0046d7b1712b3b Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 11 Jul 2023 15:13:06 +0200 Subject: [PATCH 011/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-614-gad6220c26 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 888ca7265..772fa9b96 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-610-g716600299 +3.0.0-alpha7-614-gad6220c26 From 295b5348f3637e4f412077f0261a5650b659be97 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 11 Jul 2023 17:32:04 +0200 Subject: [PATCH 012/198] update tests (could fail due to random input) --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 3c4052994..d61d62667 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 3c4052994318bf41620af2e4c8795f36cabc3645 +Subproject commit d61d62667fb683a61dcc41cd90194a2d9b279879 From 70817606db5bc3c95e7ff526cb229195efddea60 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 11 Jul 2023 12:35:23 -0400 Subject: [PATCH 013/198] shorter logic for missing arguments --- src/CLI.f90 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index 587ae7949..f2575657c 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -59,6 +59,8 @@ subroutine CLI_init() i integer, dimension(8) :: & dateAndTime + logical :: & + hasArg external :: & quit @@ -109,6 +111,7 @@ subroutine CLI_init() print'(1x,a,1x,2(i2.2,a),i2.2)', 'Time:',dateAndTime(5),':',dateAndTime(6),':',dateAndTime(7) do i = 1, command_argument_count() + hasArg = i < command_argument_count() arg = getArg(i) select case(trim(arg)) ! extract key case ('-h','--help') @@ -155,25 +158,25 @@ subroutine CLI_init() print'(1x,a,/)',' Prints this message and exits' call quit(0) ! normal Termination case ('-g', '--geom', '--geometry') - if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --geom' + if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --geom' geomArg = getArg(i+1) case ('-l', '--load', '--loadcase') - if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --load' + if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --load' loadArg = getArg(i+1) case ('-m', '--material', '--materialconfig') - if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --material' + if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --material' materialArg = getArg(i+1) case ('-n', '--numerics', '--numericsconfig') - if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --numerics' + if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --numerics' numericsArg = getArg(i+1) case ('-j', '--job', '--jobname') - if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --jobname' + if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --jobname' solverJobname = getArg(i+1) case ('-w', '--wd', '--workingdir', '--workingdirectory') - if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --workingdirectory' + if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --workingdirectory' workingDirArg = getArg(i+1) case ('-r', '--rs', '--restart') - if (i+1 > command_argument_count()) print'(/,1x,a)', 'ERROR: Missing argument for --restart' + if (.not. hasArg) print'(/,1x,a)', 'ERROR: Missing argument for --restart' arg = getArg(i+1) read(arg,*,iostat=stat) CLI_restartInc if (CLI_restartInc < 0 .or. stat /= 0) then @@ -340,7 +343,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)', 'ERROR: '//fileType//' file does not exist: '//trim(getPathRelCWD) call quit(1) end if From 32810cbe8bd870d7cd83b257efc6c83c1dcd338a Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 11 Jul 2023 13:16:00 -0400 Subject: [PATCH 014/198] 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 83db176e1b82c24d31f97cf68de038385d51973c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 11 Jul 2023 13:19:31 -0400 Subject: [PATCH 015/198] specific error per missing mandatory argument --- src/CLI.f90 | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index f2575657c..2774ee855 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)', 'ERROR: 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)', 'ERROR: 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)', 'ERROR: 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)', 'ERROR: 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)', 'ERROR: 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)', 'ERROR: 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)', 'ERROR: 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)', 'ERROR: 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)', 'Error: no load case specified (-h for help)' + call quit(1) + end if + + if (.not. allocated(geomArg)) then + print'(/,1x,a)', 'Error: no geometry specified (-h for help)' + call quit(1) + end if + + if (.not. allocated(materialArg)) then + print'(/,1x,a)', 'Error: no material configuration specified (-h for help)' call quit(1) end if @@ -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)', 'ERROR: invalid working directory: '//trim(workingDirectory) call quit(1) end if From 0e7c9f101c85c98df2aa0cda80ed5182035458ba Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 11 Jul 2023 20:37:21 +0200 Subject: [PATCH 016/198] avoid file name clashes --- src/Marc/discretization_Marc.f90 | 6 ++--- src/config.f90 | 2 +- src/grid/DAMASK_grid.f90 | 2 +- src/grid/discretization_grid.f90 | 2 +- src/result.f90 | 41 ++++++++++++++++++++++++++++---- 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/Marc/discretization_Marc.f90 b/src/Marc/discretization_Marc.f90 index 63fe3f194..3d9778e0e 100644 --- a/src/Marc/discretization_Marc.f90 +++ b/src/Marc/discretization_Marc.f90 @@ -210,9 +210,9 @@ subroutine inputRead(elem,node0_elem,connectivity_elem,materialAt) call result_openJobFile() - call result_writeDataset_str(IO_read(trim(getSolverJobName())//InputFileExtension), 'setup', & - trim(getSolverJobName())//InputFileExtension, & - 'MSC.Marc input deck') + call result_addSetupFile(IO_read(trim(getSolverJobName())//InputFileExtension), & + trim(getSolverJobName())//InputFileExtension, & + 'MSC.Marc input deck') call result_closeJobFile() inputFile = IO_readlines(trim(getSolverJobName())//InputFileExtension) diff --git a/src/config.f90 b/src/config.f90 index edb72fbd3..0d7b9e385 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -121,7 +121,7 @@ function parse(fname,description) print'(/,1x,a)', 'reading '//description; flush(IO_STDOUT) fileContent = IO_read(fname) call result_openJobFile(parallel=.false.) - call result_writeDataset_str(fileContent,'setup',fname(scan(fname,'/',.true.)+1:),description) + call result_addSetupFile(fileContent,fname,description) call result_closeJobFile() end if call parallelization_bcast_str(fileContent) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 6015648b4..443f69f9c 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -146,7 +146,7 @@ program DAMASK_grid fname = CLI_loadFile if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:) call result_openJobFile(parallel=.false.) - call result_writeDataset_str(fileContent,'setup',fname,'load case definition (grid solver)') + call result_addSetupFile(fileContent,fname,'load case definition (grid solver)') call result_closeJobFile() end if diff --git a/src/grid/discretization_grid.f90 b/src/grid/discretization_grid.f90 index f2f9ca126..e77a173e3 100644 --- a/src/grid/discretization_grid.f90 +++ b/src/grid/discretization_grid.f90 @@ -89,7 +89,7 @@ subroutine discretization_grid_init(restart) fname = CLI_geomFile if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:) call result_openJobFile(parallel=.false.) - call result_writeDataset_str(fileContent,'setup',fname,'geometry definition (grid solver)') + call result_addSetupFile(fileContent,fname,'geometry definition (grid solver)') call result_closeJobFile() else allocate(materialAt_global(0)) ! needed for IntelMPI diff --git a/src/result.f90 b/src/result.f90 index b21429fa8..b8facc26a 100644 --- a/src/result.f90 +++ b/src/result.f90 @@ -62,6 +62,7 @@ module result result_writeDataset, & result_writeDataset_str, & result_setLink, & + result_addSetupFile, & result_addAttribute, & result_removeLink, & result_mapping_phase, & @@ -166,7 +167,7 @@ end subroutine result_finalizeIncrement !-------------------------------------------------------------------------------------------------- -!> @brief open a group from the result file +!> @brief Open a group from the result file. !-------------------------------------------------------------------------------------------------- integer(HID_T) function result_openGroup(groupName) @@ -179,7 +180,7 @@ end function result_openGroup !-------------------------------------------------------------------------------------------------- -!> @brief adds a new group to the result file +!> @brief Add a new group to the result file. !-------------------------------------------------------------------------------------------------- integer(HID_T) function result_addGroup(groupName) @@ -192,7 +193,7 @@ end function result_addGroup !-------------------------------------------------------------------------------------------------- -!> @brief close a group +!> @brief Close a group. !-------------------------------------------------------------------------------------------------- subroutine result_closeGroup(group_id) @@ -205,7 +206,7 @@ end subroutine result_closeGroup !-------------------------------------------------------------------------------------------------- -!> @brief set link to object in result file +!> @brief Set link to object in result file. !-------------------------------------------------------------------------------------------------- subroutine result_setLink(path,link) @@ -216,6 +217,38 @@ subroutine result_setLink(path,link) end subroutine result_setLink + +!-------------------------------------------------------------------------------------------------- +!> @brief Add file to setup folder and ensure unique name. +!-------------------------------------------------------------------------------------------------- +subroutine result_addSetupFile(content,fname,description) + + character(len=*), intent(in) :: content, fname, description + + integer(HID_T) :: groupHandle + character(len=:), allocatable :: fname_ + integer :: i + + groupHandle = result_openGroup('setup') + fname_ = fname(scan(fname,'/',.true.)+1:) + if (.not. HDF5_objectExists(groupHandle,fname_)) then + call result_writeDataset_str(content,'setup',fname_,description) + else + i = 1 + do + fname_ = fname(scan(fname,'/',.true.)+1:)//'.'//IO_intAsStr(i) + if (.not. HDF5_objectExists(groupHandle,fname_)) then + call result_writeDataset_str(content,'setup',fname_,description) + exit + i = i+1 + end if + end do + end if + call result_closeGroup(groupHandle) + +end subroutine result_addSetupFile + + !-------------------------------------------------------------------------------------------------- !> @brief Add a string attribute to an object in the result file. !-------------------------------------------------------------------------------------------------- From 4d8fc08a2f1971bab21f3ef9ff583eb866bfa222 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 11 Jul 2023 16:11:59 -0400 Subject: [PATCH 017/198] shorter logic for addSetupFile --- src/result.f90 | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/result.f90 b/src/result.f90 index b8facc26a..de9db4091 100644 --- a/src/result.f90 +++ b/src/result.f90 @@ -226,24 +226,19 @@ subroutine result_addSetupFile(content,fname,description) character(len=*), intent(in) :: content, fname, description integer(HID_T) :: groupHandle - character(len=:), allocatable :: fname_ + character(len=:), allocatable :: name,suffix integer :: i groupHandle = result_openGroup('setup') - fname_ = fname(scan(fname,'/',.true.)+1:) - if (.not. HDF5_objectExists(groupHandle,fname_)) then - call result_writeDataset_str(content,'setup',fname_,description) - else - i = 1 - do - fname_ = fname(scan(fname,'/',.true.)+1:)//'.'//IO_intAsStr(i) - if (.not. HDF5_objectExists(groupHandle,fname_)) then - call result_writeDataset_str(content,'setup',fname_,description) - exit - i = i+1 - end if - end do - end if + name = fname(scan(fname,'/',.true.)+1:) + suffix = '' + i = 0 + + do while (HDF5_objectExists(groupHandle,name//suffix)) + i = i+1 + suffix = '.'//IO_intAsStr(i) + end do + call result_writeDataset_str(content,'setup',name//suffix,description) call result_closeGroup(groupHandle) end subroutine result_addSetupFile From d452a9ce3f99b1eeb3a47963fbff13cd7999a2ff Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 11 Jul 2023 17:15:03 -0400 Subject: [PATCH 018/198] 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 019/198] 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 159506b5e3113a112341e2b0b6a47d76d5bee059 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 12 Jul 2023 18:27:26 +0200 Subject: [PATCH 020/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-624-g61f1cdf70 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 772fa9b96..e29f03c21 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-614-gad6220c26 +3.0.0-alpha7-624-g61f1cdf70 From 12cb043d6d1f6a4e6b1f7fa063e6ace539284b7a Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 12 Jul 2023 18:48:28 +0200 Subject: [PATCH 021/198] 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 022/198] 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 023/198] 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 7427b9b2d0c99e03841b0fc7180c10612467795d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 15 Jul 2023 18:53:12 +0000 Subject: [PATCH 024/198] Use universal Performance repository --- .gitlab-ci.yml | 27 ++++++++++++++++----------- PRIVATE | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d24633468..15244cb24 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -196,7 +196,7 @@ Marc: ################################################################################################### -grid_runtime: +grid_performance: stage: statistics before_script: - ${LOCAL_HOME}/bin/queue ${CI_JOB_ID} --blocking @@ -210,22 +210,27 @@ grid_runtime: - export PATH=${PWD}/bin:${PATH} - cd $(mktemp -d) - git clone -q git@git.damask.mpie.de:damask/performance.git . + - ./measure_performance.py --input_dir ${CI_PROJECT_DIR}/examples/grid --tag ${CI_COMMIT_SHA} - > - ${CI_PROJECT_DIR}/PRIVATE/testing/runtime.py - --input_dir ${CI_PROJECT_DIR}/examples/grid - --output_dir ./ - --tag ${CI_COMMIT_SHA} - - if [ ${CI_COMMIT_BRANCH} == development ]; then git commit -am ${CI_PIPELINE_ID}_${CI_COMMIT_SHA}; git push; fi + if [ ${CI_COMMIT_BRANCH} == development ]; then + git add performance.txt + git commit -m ${CI_PIPELINE_ID}_${CI_COMMIT_SHA} + git push + fi -commit_history: +update_plots: stage: statistics script: - cd $(mktemp -d) - - ${CI_PROJECT_DIR}/PRIVATE/testing/plot_commithistory.py --color green -n 5 -N 100 - - ${CI_PROJECT_DIR}/PRIVATE/testing/plot_commithistory.py --color green -n 5 -N 1000 - - ${CI_PROJECT_DIR}/PRIVATE/testing/plot_commithistory.py --color green -n 5 -N 10000 + - git clone -q git@git.damask.mpie.de:damask/performance.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 - scp -r ./commits_*.html damask3.mpie.de:~/ - - ssh damask3.mpie.de "./update_statistics.sh" + - ssh damask3.mpie.de "./update_statistics_commits.sh" + - ./plot_performance.py --template=xgridoff + - scp -r ./runtime.html ./memory.html damask3.mpie.de:~/ + - ssh damask3.mpie.de "./update_statistics_performance.sh" only: - development diff --git a/PRIVATE b/PRIVATE index d61d62667..39853f7d8 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit d61d62667fb683a61dcc41cd90194a2d9b279879 +Subproject commit 39853f7d8fb06bb0c83aed5083212bcfd5b52a57 From 15b490fd876db5613aac8dd5a1034ecf024cbd36 Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 15 Jul 2023 23:05:01 +0200 Subject: [PATCH 025/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-630-ga63fe8d02 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e29f03c21..07e7a9689 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-624-g61f1cdf70 +3.0.0-alpha7-630-ga63fe8d02 From e1630e4057896047d956da2724277df3397a143a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 15 Jul 2023 20:28:57 +0200 Subject: [PATCH 026/198] 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 09b0cc31015227b4239732c658deb174cd2ce2f3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 16 Jul 2023 03:14:49 +0200 Subject: [PATCH 027/198] avoid duplicated storage of solution vector/T polished variable names and simplified expressions --- src/grid/grid_thermal_spectral.f90 | 155 +++++++++++++++-------------- 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 1c3f2129a..0c7cf3a54 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -46,9 +46,8 @@ module grid_thermal_spectral !-------------------------------------------------------------------------------------------------- ! PETSc data SNES :: SNES_thermal - Vec :: solution_vec + Vec :: T_PETSc real(pREAL), dimension(:,:,:), allocatable :: & - T, & !< field of current temperature T_lastInc, & !< field of previous temperature T_stagInc, & !< field of staggered temperature dotT_lastInc @@ -73,8 +72,8 @@ subroutine grid_thermal_spectral_init() PetscInt, dimension(0:worldsize-1) :: localK integer :: i, j, k, ce - DM :: thermal_grid - real(pREAL), dimension(:,:,:), pointer :: T_PETSc + DM :: DM_thermal + real(pREAL), dimension(:,:,:), pointer :: T ! 0-indexed integer(MPI_INTEGER_KIND) :: err_MPI PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle @@ -108,13 +107,6 @@ subroutine grid_thermal_spectral_init() call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asStr('petsc_options',defaultVal=''),err_PETSc) CHKERRQ(err_PETSc) -!-------------------------------------------------------------------------------------------------- -! init fields - T = discretization_grid_getInitialCondition('T') - T_lastInc = T - T_stagInc = T - dotT_lastInc = 0.0_pREAL * T - !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc call SNESCreate(PETSC_COMM_WORLD,SNES_thermal,err_PETSc) @@ -132,21 +124,23 @@ subroutine grid_thermal_spectral_init() 1_pPetscInt, 1_pPetscInt, int(worldsize,pPetscInt), & 1_pPetscInt, 0_pPetscInt, & ! #dof (T, scalar), ghost boundary width (domain overlap) [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],localK, & ! local cells - thermal_grid,err_PETSc) ! handle, error + DM_thermal,err_PETSc) ! handle, error CHKERRQ(err_PETSc) - call DMsetFromOptions(thermal_grid,err_PETSc) + call DMsetFromOptions(DM_thermal,err_PETSc) CHKERRQ(err_PETSc) - call DMsetUp(thermal_grid,err_PETSc) + call DMsetUp(DM_thermal,err_PETSc) CHKERRQ(err_PETSc) - call DMCreateGlobalVector(thermal_grid,solution_vec,err_PETSc) ! global solution vector (cells x 1, i.e. every def grad tensor) + call DMCreateGlobalVector(DM_thermal,T_PETSc,err_PETSc) ! global solution vector (cells x 1, i.e. every def grad tensor) CHKERRQ(err_PETSc) - call DMDASNESSetFunctionLocal(thermal_grid,INSERT_VALUES,formResidual,PETSC_NULL_SNES,err_PETSc) ! residual vector of same shape as solution vector + call DMDASNESSetFunctionLocal(DM_thermal,INSERT_VALUES,formResidual,PETSC_NULL_SNES,err_PETSc) ! residual vector of same shape as solution vector CHKERRQ(err_PETSc) - call SNESSetDM(SNES_thermal,thermal_grid,err_PETSc) + call SNESSetDM(SNES_thermal,DM_thermal,err_PETSc) CHKERRQ(err_PETSc) call SNESSetFromOptions(SNES_thermal,err_PETSc) ! pull it all together with additional CLI arguments CHKERRQ(err_PETSc) + call DMDAVecGetArrayF90(DM_thermal,T_PETSc,T,err_PETSc) ! returns 0-indexed T + CHKERRQ(err_PETSc) restartRead: if (CLI_restartInc > 0) then print'(/,1x,a,1x,i0)', 'loading restart data of increment', CLI_restartInc @@ -158,20 +152,23 @@ subroutine grid_thermal_spectral_init() T = reshape(tempN,[cells(1),cells(2),cells3]) call HDF5_read(tempN,groupHandle,'T_lastInc',.false.) T_lastInc = reshape(tempN,[cells(1),cells(2),cells3]) + T_stagInc = T_lastInc call HDF5_read(tempN,groupHandle,'dotT_lastInc',.false.) dotT_lastInc = reshape(tempN,[cells(1),cells(2),cells3]) + else + T = discretization_grid_getInitialCondition('T') + T_lastInc = T(0:,0:,0:) + T_stagInc = T_lastInc + dotT_lastInc = 0.0_pREAL * T_lastInc end if restartRead ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1, cells(1) + do k = 0, cells3-1; do j = 0, cells(2)-1; do i = 0, cells(1)-1 ce = ce + 1 call homogenization_thermal_setField(T(i,j,k),0.0_pREAL,ce) end do; end do; end do - call DMDAVecGetArrayF90(thermal_grid,solution_vec,T_PETSc,err_PETSc) - CHKERRQ(err_PETSc) - T_PETSc = T - call DMDAVecRestoreArrayF90(thermal_grid,solution_vec,T_PETSc,err_PETSc) + call DMDAVecRestoreArrayF90(DM_thermal,T_PETSc,T,err_PETSc) CHKERRQ(err_PETSc) call updateReference() @@ -186,37 +183,43 @@ function grid_thermal_spectral_solution(Delta_t) result(solution) real(pREAL), intent(in) :: & Delta_t !< increment in time for current solution + integer :: i, j, k, ce type(tSolutionState) :: solution PetscInt :: devNull PetscReal :: T_min, T_max, stagNorm - + DM :: DM_thermal + real(pREAL), dimension(:,:,:), pointer :: T ! 0-indexed integer(MPI_INTEGER_KIND) :: err_MPI PetscErrorCode :: err_PETSc SNESConvergedReason :: reason + solution%converged = .false. !-------------------------------------------------------------------------------------------------- ! set module wide availabe data params%Delta_t = Delta_t - call SNESSolve(SNES_thermal,PETSC_NULL_VEC,solution_vec,err_PETSc) + call SNESSolve(SNES_thermal,PETSC_NULL_VEC,T_PETSc,err_PETSc) CHKERRQ(err_PETSc) call SNESGetConvergedReason(SNES_thermal,reason,err_PETSc) CHKERRQ(err_PETSc) - if (reason < 1) then - solution%converged = .false. - solution%iterationsNeeded = num%itmax - else - solution%converged = .true. - solution%iterationsNeeded = totalIter - end if + solution%converged = reason > 0 + solution%iterationsNeeded = merge(totalIter,num%itmax,solution%converged) + + call SNESGetDM(SNES_thermal,DM_thermal,err_PETSc) + CHKERRQ(err_PETSc) + call DMDAVecGetArrayF90(DM_thermal,T_PETSc,T,err_PETSc) ! returns 0-indexed T + CHKERRQ(err_PETSc) + stagNorm = maxval(abs(T - T_stagInc)) + T_min = minval(T) + T_max = maxval(T) call MPI_Allreduce(MPI_IN_PLACE,stagNorm,1_MPI_INTEGER_KIND,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' - solution%stagConverged = stagNorm < max(num%eps_thermal_atol, num%eps_thermal_rtol*maxval(T)) + solution%stagConverged = stagNorm < max(num%eps_thermal_atol, num%eps_thermal_rtol*T_max) call MPI_Allreduce(MPI_IN_PLACE,solution%stagConverged,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LAND,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' T_stagInc = T @@ -224,15 +227,14 @@ function grid_thermal_spectral_solution(Delta_t) result(solution) !-------------------------------------------------------------------------------------------------- ! updating thermal state ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) + do k = 0, cells3-1; do j = 0, cells(2)-1; do i = 0, cells(1)-1 ce = ce + 1 - call homogenization_thermal_setField(T(i,j,k),(T(i,j,k)-T_lastInc(i,j,k))/params%Delta_t,ce) + call homogenization_thermal_setField(T(i,j,k),(T(i,j,k)-T_lastInc(i+1,j+1,k+1))/params%Delta_t,ce) end do; end do; end do - call VecMin(solution_vec,devNull,T_min,err_PETSc) - CHKERRQ(err_PETSc) - call VecMax(solution_vec,devNull,T_max,err_PETSc) + call DMDAVecRestoreArrayF90(DM_thermal,T_PETSc,T,err_PETSc) CHKERRQ(err_PETSc) + if (solution%converged) & print'(/,1x,a)', '... thermal conduction converged ..................................' print'(/,1x,a,f8.4,2x,f8.4,2x,f8.4)', 'Minimum|Maximum|Delta Temperature / K = ', T_min, T_max, stagNorm @@ -243,42 +245,40 @@ end function grid_thermal_spectral_solution !-------------------------------------------------------------------------------------------------- -!> @brief forwarding routine +!> @brief Set DAMASK data to current solver status. !-------------------------------------------------------------------------------------------------- subroutine grid_thermal_spectral_forward(cutBack) logical, intent(in) :: cutBack integer :: i, j, k, ce - DM :: dm_local - real(pREAL), dimension(:,:,:), pointer :: T_PETSc + DM :: DM_thermal + real(pREAL), dimension(:,:,:), pointer :: T ! 0-indexed PetscErrorCode :: err_PETSc - if (cutBack) then - T = T_lastInc - T_stagInc = T_lastInc + call SNESGetDM(SNES_thermal,DM_thermal,err_PETSc) + CHKERRQ(err_PETSc) + call DMDAVecGetArrayF90(DM_thermal,T_PETSc,T,err_PETSc) ! returns 0-indexed T + CHKERRQ(err_PETSc) -!-------------------------------------------------------------------------------------------------- -! reverting thermal field state - call SNESGetDM(SNES_thermal,dm_local,err_PETSc) - CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(dm_local,solution_vec,T_PETSc,err_PETSc) !< get the data out of PETSc to work with - CHKERRQ(err_PETSc) - T_PETSc = T - call DMDAVecRestoreArrayF90(dm_local,solution_vec,T_PETSc,err_PETSc) - CHKERRQ(err_PETSc) + if (cutBack) then ce = 0 do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) ce = ce + 1 - call homogenization_thermal_setField(T(i,j,k),dotT_lastInc(i,j,k),ce) + call homogenization_thermal_setField(T_lastInc(i,j,k),dotT_lastInc(i,j,k),ce) end do; end do; end do + T = T_lastInc + T_stagInc = T_lastInc else dotT_lastInc = (T - T_lastInc)/params%Delta_t T_lastInc = T call updateReference() end if + call DMDAVecRestoreArrayF90(DM_thermal,T_PETSc,T,err_PETSc) + CHKERRQ(err_PETSc) + end subroutine grid_thermal_spectral_forward @@ -288,13 +288,13 @@ end subroutine grid_thermal_spectral_forward subroutine grid_thermal_spectral_restartWrite() PetscErrorCode :: err_PETSc - DM :: dm_local + DM :: DM_thermal integer(HID_T) :: fileHandle, groupHandle - real(pREAL), dimension(:,:,:), pointer :: T + real(pREAL), dimension(:,:,:), pointer :: T ! 0-indexed - call SNESGetDM(SNES_thermal,dm_local,err_PETSc); + call SNESGetDM(SNES_thermal,DM_thermal,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayReadF90(dm_local,solution_vec,T,err_PETSc); + call DMDAVecGetArrayReadF90(DM_thermal,T_PETSc,T,err_PETSc) ! returns 0-indexed T CHKERRQ(err_PETSc) print'(1x,a)', 'saving thermal solver data required for restart'; flush(IO_STDOUT) @@ -307,7 +307,7 @@ subroutine grid_thermal_spectral_restartWrite() call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) - call DMDAVecRestoreArrayReadF90(dm_local,solution_vec,T,err_PETSc); + call DMDAVecRestoreArrayReadF90(DM_thermal,T_PETSc,T,err_PETSc); CHKERRQ(err_PETSc) end subroutine grid_thermal_spectral_restartWrite @@ -324,7 +324,7 @@ subroutine formResidual(residual_subdomain,x_scal,r,dummy,err_PETSc) real(pREAL), dimension(cells(1),cells(2),cells3), intent(in) :: & x_scal real(pREAL), dimension(cells(1),cells(2),cells3), intent(out) :: & - r !< residual + r !< residual PetscObject :: dummy PetscErrorCode, intent(out) :: err_PETSc @@ -332,25 +332,26 @@ subroutine formResidual(residual_subdomain,x_scal,r,dummy,err_PETSc) real(pREAL), dimension(3,cells(1),cells(2),cells3) :: vectorField - T = x_scal - vectorField = utilities_ScalarGradient(T) - ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) - ce = ce + 1 - vectorField(1:3,i,j,k) = matmul(homogenization_K_T(ce) - K_ref, vectorField(1:3,i,j,k)) - end do; end do; end do - r = utilities_VectorDivergence(vectorField) - ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) - ce = ce + 1 - r(i,j,k) = params%Delta_t*(r(i,j,k) + homogenization_f_T(ce)) & - + homogenization_mu_T(ce) * (T_lastInc(i,j,k) - T(i,j,k)) & - + mu_ref*T(i,j,k) - end do; end do; end do + associate(T => x_scal) + vectorField = utilities_ScalarGradient(T) + ce = 0 + do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) + ce = ce + 1 + vectorField(1:3,i,j,k) = matmul(homogenization_K_T(ce) - K_ref, vectorField(1:3,i,j,k)) + end do; end do; end do + r = utilities_VectorDivergence(vectorField) + ce = 0 + do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) + ce = ce + 1 + r(i,j,k) = params%Delta_t*(r(i,j,k) + homogenization_f_T(ce)) & + + homogenization_mu_T(ce) * (T_lastInc(i,j,k) - T(i,j,k)) & + + mu_ref*T(i,j,k) + end do; end do; end do - r = T & - - utilities_GreenConvolution(r, K_ref, mu_ref, params%Delta_t) - err_PETSc = 0 + r = T & + - utilities_GreenConvolution(r, K_ref, mu_ref, params%Delta_t) + err_PETSc = 0 + end associate end subroutine formResidual From 6770bedb7d0bcd422d5262f831f7ab06f478b375 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Sun, 16 Jul 2023 15:38:37 +0200 Subject: [PATCH 028/198] 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 029/198] 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 030/198] [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 b54cf03d6d018c5841066c750268343f9583bb14 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 16 Jul 2023 06:35:38 +0200 Subject: [PATCH 031/198] allgather instead of allreduce+sum with contribution from 1 proc --- src/HDF5_utilities.f90 | 29 +++++++------- src/grid/DAMASK_grid.f90 | 2 +- src/grid/discretization_grid.f90 | 12 +++--- src/grid/grid_damage_spectral.f90 | 15 ++++---- src/grid/grid_mech_FEM.f90 | 17 ++++----- src/grid/grid_mech_spectral_basic.f90 | 15 ++++---- src/grid/grid_mech_spectral_polarisation.f90 | 15 ++++---- src/grid/grid_thermal_spectral.f90 | 17 ++++----- src/result.f90 | 40 +++++++++----------- 9 files changed, 75 insertions(+), 87 deletions(-) diff --git a/src/HDF5_utilities.f90 b/src/HDF5_utilities.f90 index 857fd30d1..b87dbad3d 100644 --- a/src/HDF5_utilities.f90 +++ b/src/HDF5_utilities.f90 @@ -1836,15 +1836,13 @@ subroutine initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_ integer(HID_T), intent(in) :: loc_id !< file or group handle character(len=*), intent(in) :: datasetName !< name of the dataset in the file logical, intent(in) :: parallel - integer(HSIZE_T), intent(in), dimension(:) :: & - localShape - integer(HSIZE_T), intent(out), dimension(size(localShape,1)):: & + integer(HSIZE_T), intent(in), dimension(:) :: localShape + integer(HSIZE_T), intent(out), dimension(size(localShape)) :: & myStart, & globalShape !< shape of the dataset (all processes) integer(HID_T), intent(out) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id - integer(MPI_INTEGER_KIND), dimension(worldsize) :: & - readSize !< contribution of all processes + integer(MPI_INTEGER_KIND), dimension(worldsize) :: readSize !< contribution of all processes integer :: hdferr integer(MPI_INTEGER_KIND) :: err_MPI @@ -1860,7 +1858,8 @@ subroutine initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_ if (parallel) then call H5Pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr) call HDF5_chkerr(hdferr) - call MPI_Allreduce(MPI_IN_PLACE,readSize,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) ! get total output size over each process + call MPI_Allgather(int(localShape(ubound(localShape,1)),MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& + readSize,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' end if #endif @@ -1930,15 +1929,14 @@ end subroutine finalize_read !-------------------------------------------------------------------------------------------------- subroutine initialize_write(dset_id, filespace_id, memspace_id, plist_id, & myStart, totalShape, & - loc_id,myShape,datasetName,datatype,parallel) + loc_id,localShape,datasetName,datatype,parallel) integer(HID_T), intent(in) :: loc_id !< file or group handle character(len=*), intent(in) :: datasetName !< name of the dataset in the file logical, intent(in) :: parallel integer(HID_T), intent(in) :: datatype - integer(HSIZE_T), intent(in), dimension(:) :: & - myShape - integer(HSIZE_T), intent(out), dimension(size(myShape,1)):: & + integer(HSIZE_T), intent(in), dimension(:) :: localShape + integer(HSIZE_T), intent(out), dimension(size(localShape)) :: & myStart, & totalShape !< shape of the dataset (all processes) integer(HID_T), intent(out) :: dset_id, filespace_id, memspace_id, plist_id @@ -1964,16 +1962,17 @@ subroutine initialize_write(dset_id, filespace_id, memspace_id, plist_id, & !-------------------------------------------------------------------------------------------------- ! determine the global data layout among all processes writeSize = 0_MPI_INTEGER_KIND - writeSize(worldrank+1) = int(myShape(ubound(myShape,1)),MPI_INTEGER_KIND) + writeSize(worldrank+1) = int(localShape(ubound(localShape,1)),MPI_INTEGER_KIND) #ifdef PETSC if (parallel) then - call MPI_Allreduce(MPI_IN_PLACE,writeSize,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) ! get total output size over each process + call MPI_Allgather(int(localShape(ubound(localShape,1)),MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& + writeSize,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' end if #endif myStart = int(0,HSIZE_T) myStart(ubound(myStart)) = int(sum(writeSize(1:worldrank)),HSIZE_T) - totalShape = [myShape(1:ubound(myShape,1)-1),int(sum(writeSize),HSIZE_T)] + totalShape = [localShape(1:ubound(localShape,1)-1),int(sum(writeSize),HSIZE_T)] !-------------------------------------------------------------------------------------------------- ! chunk dataset, enable compression for larger datasets @@ -2001,7 +2000,7 @@ subroutine initialize_write(dset_id, filespace_id, memspace_id, plist_id, & !-------------------------------------------------------------------------------------------------- ! create dataspace in memory (local shape) and in file (global shape) - call H5Screate_simple_f(size(myShape), myShape, memspace_id, hdferr, myShape) + call H5Screate_simple_f(size(localShape), localShape, memspace_id, hdferr, localShape) call HDF5_chkerr(hdferr) call H5Screate_simple_f(size(totalShape), totalShape, filespace_id, hdferr, totalShape) call HDF5_chkerr(hdferr) @@ -2010,7 +2009,7 @@ subroutine initialize_write(dset_id, filespace_id, memspace_id, plist_id, & ! create dataset in the file and select a hyperslab from it (the portion of the current process) call H5Dcreate_f(loc_id, trim(datasetName), datatype, filespace_id, dset_id, hdferr, dcpl) call HDF5_chkerr(hdferr) - call H5Sselect_hyperslab_f(filespace_id, H5S_SELECT_SET_F, myStart, myShape, hdferr) + call H5Sselect_hyperslab_f(filespace_id, H5S_SELECT_SET_F, myStart, localShape, hdferr) call HDF5_chkerr(hdferr) call H5Pclose_f(dcpl , hdferr) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 443f69f9c..8efb2358a 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -366,7 +366,7 @@ program DAMASK_grid end if Delta_t = Delta_t * real(subStepFactor,pREAL)**real(-cutBackLevel,pREAL) ! depending on cut back level, decrease time step - skipping: if (totalIncsCounter <= CLI_restartInc) then ! not yet at restart inc? + skipping: if (totalIncsCounter <= CLI_restartInc) then ! not yet at restart inc? t = t + Delta_t ! just advance time, skip already performed calculation guess = .true. ! QUESTION:why forced guessing instead of inheriting loadcase preference else skipping diff --git a/src/grid/discretization_grid.f90 b/src/grid/discretization_grid.f90 index e77a173e3..2cb5dbf9f 100644 --- a/src/grid/discretization_grid.f90 +++ b/src/grid/discretization_grid.f90 @@ -68,7 +68,7 @@ subroutine discretization_grid_init(restart) j integer(MPI_INTEGER_KIND) :: err_MPI integer(C_INTPTR_T) :: & - devNull, z, z_offset + devNull, cells3_, cells3Offset_ integer, dimension(worldsize) :: & displs, sendcounts character(len=:), allocatable :: & @@ -113,12 +113,12 @@ subroutine discretization_grid_init(restart) call fftw_mpi_init() devNull = fftw_mpi_local_size_3d(int(cells(3),C_INTPTR_T),int(cells(2),C_INTPTR_T),int(cells(1)/2+1,C_INTPTR_T), & PETSC_COMM_WORLD, & - z, & ! domain cells size along z - z_offset) ! domain cells offset along z - if (z==0_C_INTPTR_T) call IO_error(894, ext_msg='Cannot distribute MPI processes') + cells3_, & ! domain cells size along z + cells3Offset_) ! domain cells offset along z + if (cells3_==0_C_INTPTR_T) call IO_error(894, ext_msg='Cannot distribute MPI processes') - cells3 = int(z) - cells3Offset = int(z_offset) + cells3 = int(cells3_) + cells3Offset = int(cells3Offset_) size3 = geomSize(3)*real(cells3,pREAL) /real(cells(3),pREAL) size3Offset = geomSize(3)*real(cells3Offset,pREAL)/real(cells(3),pREAL) myGrid = [cells(1:2),cells3] diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 90680daea..a2e60cb01 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -72,7 +72,7 @@ contains !-------------------------------------------------------------------------------------------------- subroutine grid_damage_spectral_init() - PetscInt, dimension(0:worldsize-1) :: localK + integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: cells3_global integer :: i, j, k, ce DM :: damage_grid real(pREAL), dimension(:,:,:), pointer :: phi_PETSc @@ -129,17 +129,16 @@ subroutine grid_damage_spectral_init() CHKERRQ(err_PETSc) call SNESSetOptionsPrefix(SNES_damage,'damage_',err_PETSc) CHKERRQ(err_PETSc) - localK = 0_pPetscInt - localK(worldrank) = int(cells3,pPetscInt) - call MPI_Allreduce(MPI_IN_PLACE,localK,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) + call MPI_Allgather(int(cells3,MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& + cells3_global,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' call DMDACreate3D(PETSC_COMM_WORLD, & DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, & ! cut off stencil at boundary DMDA_STENCIL_BOX, & ! Moore (26) neighborhood around central point - int(cells(1),pPetscInt),int(cells(2),pPetscInt),int(cells(3),pPetscInt), & ! global cells - 1_pPetscInt, 1_pPetscInt, int(worldsize,pPetscInt), & - 1_pPetscInt, 0_pPetscInt, & ! #dof (phi, scalar), ghost boundary width (domain overlap) - [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],localK, & ! local cells + int(cells(1),pPETSCINT),int(cells(2),pPETSCINT),int(cells(3),pPETSCINT), & ! global cells + 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & + 1_pPETSCINT, 0_pPETSCINT, & ! #dof (phi, scalar), ghost boundary width (domain overlap) + [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],int(cells3_global,pPETSCINT), & ! local cells damage_grid,err_PETSc) ! handle, error CHKERRQ(err_PETSc) call DMsetFromOptions(damage_grid,err_PETSc) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 17bf01ac0..14f750d73 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -115,7 +115,7 @@ subroutine grid_mechanical_FEM_init integer(MPI_INTEGER_KIND) :: err_MPI PetscScalar, pointer, dimension(:,:,:,:) :: & u,u_lastInc - PetscInt, dimension(0:worldsize-1) :: localK + integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: cells3_global integer(HID_T) :: fileHandle, groupHandle type(tDict), pointer :: & num_grid @@ -167,17 +167,16 @@ subroutine grid_mechanical_FEM_init CHKERRQ(err_PETSc) call SNESSetOptionsPrefix(SNES_mechanical,'mechanical_',err_PETSc) CHKERRQ(err_PETSc) - localK = 0_pPetscInt - localK(worldrank) = int(cells3,pPetscInt) - call MPI_Allreduce(MPI_IN_PLACE,localK,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) + call MPI_Allgather(int(cells3,MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& + cells3_global,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' call DMDACreate3d(PETSC_COMM_WORLD, & DM_BOUNDARY_PERIODIC, DM_BOUNDARY_PERIODIC, DM_BOUNDARY_PERIODIC, & DMDA_STENCIL_BOX, & - int(cells(1),pPetscInt),int(cells(2),pPetscInt),int(cells(3),pPetscInt), & ! global cells - 1_pPetscInt, 1_pPetscInt, int(worldsize,pPetscInt), & - 3_pPetscInt, 1_pPetscInt, & ! #dof (u, vector), ghost boundary width (domain overlap) - [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],localK, & ! local cells + int(cells(1),pPETSCINT),int(cells(2),pPETSCINT),int(cells(3),pPETSCINT), & ! global cells + 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & + 3_pPETSCINT, 1_pPETSCINT, & ! #dof (u, vector), ghost boundary width (domain overlap) + [int(cells(1),pPETSCINT)],[int(cells(2),pPETSCINT)],int(cells3_global,pPETSCINT), & ! local cells mechanical_grid,err_PETSc) CHKERRQ(err_PETSc) call DMsetFromOptions(mechanical_grid,err_PETSc) @@ -198,7 +197,7 @@ subroutine grid_mechanical_FEM_init CHKERRQ(err_PETSc) call SNESSetConvergenceTest(SNES_mechanical,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,err_PETSc) ! specify custom convergence check function "_converged" CHKERRQ(err_PETSc) - call SNESSetMaxLinearSolveFailures(SNES_mechanical, huge(1_pPetscInt), err_PETSc) ! ignore linear solve failures + call SNESSetMaxLinearSolveFailures(SNES_mechanical, huge(1_pPETSCINT), err_PETSc) ! ignore linear solve failures CHKERRQ(err_PETSc) call SNESSetDM(SNES_mechanical,mechanical_grid,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 4bd9c5a96..0ada208c1 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -110,7 +110,7 @@ subroutine grid_mechanical_spectral_basic_init() integer(MPI_INTEGER_KIND) :: err_MPI real(pREAL), pointer, dimension(:,:,:,:) :: & F ! pointer to solution data - PetscInt, dimension(0:worldsize-1) :: localK + integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: cells3_global real(pREAL), dimension(3,3,product(cells(1:2))*cells3) :: temp33n integer(HID_T) :: fileHandle, groupHandle type(tDict), pointer :: & @@ -166,17 +166,16 @@ subroutine grid_mechanical_spectral_basic_init() CHKERRQ(err_PETSc) call SNESSetOptionsPrefix(SNES_mechanical,'mechanical_',err_PETSc) CHKERRQ(err_PETSc) - localK = 0_pPetscInt - localK(worldrank) = int(cells3,pPetscInt) - call MPI_Allreduce(MPI_IN_PLACE,localK,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) + call MPI_Allgather(int(cells3,MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& + cells3_global,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' call DMDACreate3d(PETSC_COMM_WORLD, & DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, & ! cut off stencil at boundary DMDA_STENCIL_BOX, & ! Moore (26) neighborhood around central point - int(cells(1),pPetscInt),int(cells(2),pPetscInt),int(cells(3),pPetscInt), & ! global cells - 1_pPetscInt, 1_pPetscInt, int(worldsize,pPetscInt), & - 9_pPetscInt, 0_pPetscInt, & ! #dof (F, tensor), ghost boundary width (domain overlap) - [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],localK, & ! local cells + int(cells(1),pPETSCINT),int(cells(2),pPETSCINT),int(cells(3),pPETSCINT), & ! global cells + 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & + 9_pPETSCINT, 0_pPETSCINT, & ! #dof (F, tensor), ghost boundary width (domain overlap) + [int(cells(1),pPETSCINT)],[int(cells(2),pPETSCINT)],int(cells3_global,pPETSCINT), & ! local cells da,err_PETSc) ! handle, error CHKERRQ(err_PETSc) call DMsetFromOptions(da,err_PETSc) diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 60e7d676e..bc1c0484c 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -123,7 +123,7 @@ subroutine grid_mechanical_spectral_polarisation_init() FandF_tau, & ! overall pointer to solution data F, & ! specific (sub)pointer F_tau ! specific (sub)pointer - PetscInt, dimension(0:worldsize-1) :: localK + integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: cells3_global real(pREAL), dimension(3,3,product(cells(1:2))*cells3) :: temp33n integer(HID_T) :: fileHandle, groupHandle type(tDict), pointer :: & @@ -187,17 +187,16 @@ subroutine grid_mechanical_spectral_polarisation_init() CHKERRQ(err_PETSc) call SNESSetOptionsPrefix(SNES_mechanical,'mechanical_',err_PETSc) CHKERRQ(err_PETSc) - localK = 0_pPetscInt - localK(worldrank) = int(cells3,pPetscInt) - call MPI_Allreduce(MPI_IN_PLACE,localK,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) + call MPI_Allgather(int(cells3,pPetscInt),1_MPI_INTEGER_KIND,MPI_INTEGER,& + cells3_global,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' call DMDACreate3d(PETSC_COMM_WORLD, & DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, & ! cut off stencil at boundary DMDA_STENCIL_BOX, & ! Moore (26) neighborhood around central point - int(cells(1),pPetscInt),int(cells(2),pPetscInt),int(cells(3),pPetscInt), & ! global cells - 1_pPetscInt, 1_pPetscInt, int(worldsize,pPetscInt), & - 18_pPetscInt, 0_pPetscInt, & ! #dof (2xtensor), ghost boundary width (domain overlap) - [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],localK, & ! local cells + int(cells(1),pPETSCINT),int(cells(2),pPETSCINT),int(cells(3),pPETSCINT), & ! global cells + 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & + 18_pPETSCINT, 0_pPETSCINT, & ! #dof (2xtensor), ghost boundary width (domain overlap) + [int(cells(1),pPETSCINT)],[int(cells(2),pPETSCINT)],int(cells3_global,pPETSCINT), & ! local cells da,err_PETSc) ! handle, error CHKERRQ(err_PETSc) call DMsetFromOptions(da,err_PETSc) diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 0c7cf3a54..e8fd0c914 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -70,7 +70,7 @@ contains !-------------------------------------------------------------------------------------------------- subroutine grid_thermal_spectral_init() - PetscInt, dimension(0:worldsize-1) :: localK + integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: cells3_global integer :: i, j, k, ce DM :: DM_thermal real(pREAL), dimension(:,:,:), pointer :: T ! 0-indexed @@ -113,17 +113,16 @@ subroutine grid_thermal_spectral_init() CHKERRQ(err_PETSc) call SNESSetOptionsPrefix(SNES_thermal,'thermal_',err_PETSc) CHKERRQ(err_PETSc) - localK = 0_pPetscInt - localK(worldrank) = int(cells3,pPetscInt) - call MPI_Allreduce(MPI_IN_PLACE,localK,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) + call MPI_Allgather(int(cells3,pPETSCINT),1_MPI_INTEGER_KIND,MPI_INTEGER,& + cells3_global,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' call DMDACreate3D(PETSC_COMM_WORLD, & DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, & ! cut off stencil at boundary DMDA_STENCIL_BOX, & ! Moore (26) neighborhood around central point - int(cells(1),pPetscInt),int(cells(2),pPetscInt),int(cells(3),pPetscInt), & ! global cells - 1_pPetscInt, 1_pPetscInt, int(worldsize,pPetscInt), & - 1_pPetscInt, 0_pPetscInt, & ! #dof (T, scalar), ghost boundary width (domain overlap) - [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],localK, & ! local cells + int(cells(1),pPETSCINT),int(cells(2),pPETSCINT),int(cells(3),pPETSCINT), & ! global cells + 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & + 1_pPETSCINT, 0_pPETSCINT, & ! #dof (T, scalar), ghost boundary width (domain overlap) + [int(cells(1),pPETSCINT)],[int(cells(2),pPETSCINT)],int(cells3_global,pPETSCINT), & ! local cells DM_thermal,err_PETSc) ! handle, error CHKERRQ(err_PETSc) call DMsetFromOptions(DM_thermal,err_PETSc) @@ -214,9 +213,9 @@ function grid_thermal_spectral_solution(Delta_t) result(solution) call DMDAVecGetArrayF90(DM_thermal,T_PETSc,T,err_PETSc) ! returns 0-indexed T CHKERRQ(err_PETSc) - stagNorm = maxval(abs(T - T_stagInc)) T_min = minval(T) T_max = maxval(T) + stagNorm = maxval(abs(T - T_stagInc)) call MPI_Allreduce(MPI_IN_PLACE,stagNorm,1_MPI_INTEGER_KIND,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' solution%stagConverged = stagNorm < max(num%eps_thermal_atol, num%eps_thermal_rtol*T_max) diff --git a/src/result.f90 b/src/result.f90 index de9db4091..242bdbe28 100644 --- a/src/result.f90 +++ b/src/result.f90 @@ -495,10 +495,9 @@ subroutine result_mapping_phase(ID,entry,label) integer, dimension(:,:), intent(in) :: entry !< phase entry at (co,ce) character(len=*), dimension(:), intent(in) :: label !< label of each phase section - integer(pI64), dimension(size(entry,1),size(entry,2)) :: & - entryGlobal + integer(pI64), dimension(size(entry,1),size(entry,2)) :: entryGlobal integer(pI64), dimension(size(label),0:worldsize-1) :: entryOffset !< offset in entry counting per process - integer, dimension(0:worldsize-1) :: writeSize !< amount of data written per process + integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: writeSize !< amount of data written per process integer(HSIZE_T), dimension(2) :: & myShape, & !< shape of the dataset (this process) myOffset, & @@ -521,21 +520,19 @@ subroutine result_mapping_phase(ID,entry,label) integer(MPI_INTEGER_KIND) :: err_MPI - writeSize = 0 - writeSize(worldrank) = size(entry(1,:)) ! total number of entries of this process - call H5Pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr) call HDF5_chkerr(hdferr) #ifndef PETSC - entryGlobal = int(entry -1,pI64) ! 0-based + entryGlobal = int(entry-1,pI64) ! 0-based + writeSize(0) = size(entry,dim=2,kind=MPI_INTEGER_KIND) ! total number of entries of this process #else !-------------------------------------------------------------------------------------------------- ! MPI settings and communication call H5Pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr) call HDF5_chkerr(hdferr) - - call MPI_Allreduce(MPI_IN_PLACE,writeSize,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) ! get output at each process + call MPI_Allgather(size(entry,dim=2,kind=MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& + writeSize,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) call parallelization_chkerr(err_MPI) entryOffset = 0_pI64 @@ -554,9 +551,9 @@ subroutine result_mapping_phase(ID,entry,label) end do #endif - myShape = int([size(ID,1),writeSize(worldrank)], HSIZE_T) - myOffset = int([0,sum(writeSize(0:worldrank-1))], HSIZE_T) - totalShape = int([size(ID,1),sum(writeSize)], HSIZE_T) + myShape = int([size(ID,1,MPI_INTEGER_KIND),writeSize(worldrank)], HSIZE_T) + myOffset = int([0_MPI_INTEGER_KIND,sum(writeSize(0:worldrank-1))], HSIZE_T) + totalShape = int([size(ID,1,MPI_INTEGER_KIND),sum(writeSize)], HSIZE_T) !--------------------------------------------------------------------------------------------------- ! compound type: label(ID) + entry @@ -651,10 +648,9 @@ subroutine result_mapping_homogenization(ID,entry,label) integer, dimension(:), intent(in) :: entry !< homogenization entry at (ce) character(len=*), dimension(:), intent(in) :: label !< label of each homogenization section - integer(pI64), dimension(size(entry,1)) :: & - entryGlobal + integer(pI64), dimension(size(entry,1)) :: entryGlobal integer(pI64), dimension(size(label),0:worldsize-1) :: entryOffset !< offset in entry counting per process - integer, dimension(0:worldsize-1) :: writeSize !< amount of data written per process + integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: writeSize !< amount of data written per process integer(HSIZE_T), dimension(1) :: & myShape, & !< shape of the dataset (this process) myOffset, & @@ -677,31 +673,29 @@ subroutine result_mapping_homogenization(ID,entry,label) integer(MPI_INTEGER_KIND) :: err_MPI - writeSize = 0 - writeSize(worldrank) = size(entry) ! total number of entries of this process - call H5Pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr) call HDF5_chkerr(hdferr) #ifndef PETSC - entryGlobal = int(entry -1,pI64) ! 0-based + entryGlobal = int(entry-1,pI64) + writeSize(0) = size(entry,kind=MPI_INTEGER_KIND) ! total number of entries of this process ! 0-based #else !-------------------------------------------------------------------------------------------------- ! MPI settings and communication call H5Pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr) call HDF5_chkerr(hdferr) - - call MPI_Allreduce(MPI_IN_PLACE,writeSize,worldsize,MPI_INTEGER,MPI_SUM,MPI_COMM_WORLD,err_MPI) ! get output at each process + call MPI_Allgather(size(entry,kind=MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& + writeSize,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) call parallelization_chkerr(err_MPI) entryOffset = 0_pI64 - do ce = 1, size(ID,1) + do ce = 1, size(ID) entryOffset(ID(ce),worldrank) = entryOffset(ID(ce),worldrank) +1_pI64 end do call MPI_Allreduce(MPI_IN_PLACE,entryOffset,size(entryOffset),MPI_INTEGER8,MPI_SUM,MPI_COMM_WORLD,err_MPI)! get offset at each process call parallelization_chkerr(err_MPI) entryOffset(:,worldrank) = sum(entryOffset(:,0:worldrank-1),2) - do ce = 1, size(ID,1) + do ce = 1, size(ID) entryGlobal(ce) = int(entry(ce),pI64) -1_pI64 + entryOffset(ID(ce),worldrank) end do #endif From 45dd38752737974542bce948ab4bb660c842e176 Mon Sep 17 00:00:00 2001 From: Sharan Date: Sun, 16 Jul 2023 22:04:18 +0200 Subject: [PATCH 032/198] 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 033/198] 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 8682df0e861d3e40f4a52d1af5fe1f54092449a2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 16 Jul 2023 13:17:57 +0200 Subject: [PATCH 034/198] avoiding double storage of phi general adjustments of damage solver to follow thermal solver --- src/grid/grid_damage_spectral.f90 | 154 +++++++++++++++-------------- src/grid/grid_thermal_spectral.f90 | 5 +- 2 files changed, 81 insertions(+), 78 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index a2e60cb01..5f88e283f 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -47,9 +47,8 @@ module grid_damage_spectral !-------------------------------------------------------------------------------------------------- ! PETSc data SNES :: SNES_damage - Vec :: solution_vec + Vec :: phi_PETSc real(pREAL), dimension(:,:,:), allocatable :: & - phi, & !< field of current damage phi_lastInc, & !< field of previous damage phi_stagInc !< field of staggered damage @@ -74,8 +73,8 @@ subroutine grid_damage_spectral_init() integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: cells3_global integer :: i, j, k, ce - DM :: damage_grid - real(pREAL), dimension(:,:,:), pointer :: phi_PETSc + DM :: DM_damage + real(pREAL), dimension(:,:,:), pointer :: phi ! 0-indexed Vec :: uBound, lBound integer(MPI_INTEGER_KIND) :: err_MPI PetscErrorCode :: err_PETSc @@ -87,6 +86,7 @@ subroutine grid_damage_spectral_init() character(len=pSTRLEN) :: & snes_type + print'(/,1x,a)', '<<<+- grid_spectral_damage init -+>>>' print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019' @@ -117,12 +117,6 @@ subroutine grid_damage_spectral_init() call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_grid%get_asStr('petsc_options',defaultVal=''),err_PETSc) CHKERRQ(err_PETSc) -!-------------------------------------------------------------------------------------------------- -! init fields - phi = discretization_grid_getInitialCondition('phi') - phi_lastInc = phi - phi_stagInc = phi - !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc call SNESCreate(PETSC_COMM_WORLD,SNES_damage,err_PETSc) @@ -139,17 +133,17 @@ subroutine grid_damage_spectral_init() 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & 1_pPETSCINT, 0_pPETSCINT, & ! #dof (phi, scalar), ghost boundary width (domain overlap) [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],int(cells3_global,pPETSCINT), & ! local cells - damage_grid,err_PETSc) ! handle, error + DM_damage,err_PETSc) ! handle, error CHKERRQ(err_PETSc) - call DMsetFromOptions(damage_grid,err_PETSc) + call DMsetFromOptions(DM_damage,err_PETSc) CHKERRQ(err_PETSc) - call DMsetUp(damage_grid,err_PETSc) + call DMsetUp(DM_damage,err_PETSc) CHKERRQ(err_PETSc) - call DMCreateGlobalVector(damage_grid,solution_vec,err_PETSc) ! global solution vector (cells x 1, i.e. every def grad tensor) + call DMCreateGlobalVector(DM_damage,phi_PETSc,err_PETSc) ! global solution vector (cells x 1, i.e. every def grad tensor) CHKERRQ(err_PETSc) - call DMDASNESSetFunctionLocal(damage_grid,INSERT_VALUES,formResidual,PETSC_NULL_SNES,err_PETSc) ! residual vector of same shape as solution vector + call DMDASNESSetFunctionLocal(DM_damage,INSERT_VALUES,formResidual,PETSC_NULL_SNES,err_PETSc) ! residual vector of same shape as solution vector CHKERRQ(err_PETSc) - call SNESSetDM(SNES_damage,damage_grid,err_PETSc) + call SNESSetDM(SNES_damage,DM_damage,err_PETSc) CHKERRQ(err_PETSc) call SNESSetFromOptions(SNES_damage,err_PETSc) ! pull it all together with additional CLI arguments CHKERRQ(err_PETSc) @@ -157,9 +151,9 @@ subroutine grid_damage_spectral_init() CHKERRQ(err_PETSc) if (trim(snes_type) == 'vinewtonrsls' .or. & trim(snes_type) == 'vinewtonssls') then - call DMGetGlobalVector(damage_grid,lBound,err_PETSc) + call DMGetGlobalVector(DM_damage,lBound,err_PETSc) CHKERRQ(err_PETSc) - call DMGetGlobalVector(damage_grid,uBound,err_PETSc) + call DMGetGlobalVector(DM_damage,uBound,err_PETSc) CHKERRQ(err_PETSc) call VecSet(lBound,0.0_pREAL,err_PETSc) CHKERRQ(err_PETSc) @@ -167,12 +161,15 @@ subroutine grid_damage_spectral_init() CHKERRQ(err_PETSc) call SNESVISetVariableBounds(SNES_damage,lBound,uBound,err_PETSc) ! variable bounds for variational inequalities CHKERRQ(err_PETSc) - call DMRestoreGlobalVector(damage_grid,lBound,err_PETSc) + call DMRestoreGlobalVector(DM_damage,lBound,err_PETSc) CHKERRQ(err_PETSc) - call DMRestoreGlobalVector(damage_grid,uBound,err_PETSc) + call DMRestoreGlobalVector(DM_damage,uBound,err_PETSc) CHKERRQ(err_PETSc) end if + call DMDAVecGetArrayF90(DM_damage,phi_PETSc,phi,err_PETSc) ! returns 0-indexed phi + CHKERRQ(err_PETSc) + restartRead: if (CLI_restartInc > 0) then print'(/,1x,a,1x,i0)', 'loading restart data of increment', CLI_restartInc @@ -183,18 +180,20 @@ subroutine grid_damage_spectral_init() phi = reshape(tempN,[cells(1),cells(2),cells3]) call HDF5_read(tempN,groupHandle,'phi_lastInc',.false.) phi_lastInc = reshape(tempN,[cells(1),cells(2),cells3]) + phi_stagInc = phi_lastInc + else + phi = discretization_grid_getInitialCondition('phi') + phi_lastInc = phi(0:,0:,0:) + phi_stagInc = phi_lastInc end if restartRead ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1, cells(1) + do k = 0, cells3-1; do j = 0, cells(2)-1; do i = 0, cells(1)-1 ce = ce + 1 call homogenization_set_phi(phi(i,j,k),ce) end do; end do; end do - call DMDAVecGetArrayF90(damage_grid,solution_vec,phi_PETSc,err_PETSc) - CHKERRQ(err_PETSc) - phi_PETSc = phi - call DMDAVecRestoreArrayF90(damage_grid,solution_vec,phi_PETSc,err_PETSc) + call DMDAVecRestoreArrayF90(DM_damage,phi_PETSc,phi,err_PETSc) CHKERRQ(err_PETSc) call updateReference() @@ -209,37 +208,43 @@ function grid_damage_spectral_solution(Delta_t) result(solution) real(pREAL), intent(in) :: & Delta_t !< increment in time for current solution + integer :: i, j, k, ce type(tSolutionState) :: solution PetscInt :: devNull PetscReal :: phi_min, phi_max, stagNorm - + DM :: DM_damage + real(pREAL), dimension(:,:,:), pointer :: phi ! 0-indexed integer(MPI_INTEGER_KIND) :: err_MPI PetscErrorCode :: err_PETSc SNESConvergedReason :: reason + solution%converged = .false. !-------------------------------------------------------------------------------------------------- ! set module wide availabe data params%Delta_t = Delta_t - call SNESSolve(SNES_damage,PETSC_NULL_VEC,solution_vec,err_PETSc) + call SNESSolve(SNES_damage,PETSC_NULL_VEC,phi_PETSc,err_PETSc) CHKERRQ(err_PETSc) call SNESGetConvergedReason(SNES_damage,reason,err_PETSc) CHKERRQ(err_PETSc) - if (reason < 1) then - solution%converged = .false. - solution%iterationsNeeded = num%itmax - else - solution%converged = .true. - solution%iterationsNeeded = totalIter - end if + solution%converged = reason > 0 + solution%iterationsNeeded = merge(totalIter,num%itmax,solution%converged) + + call SNESGetDM(SNES_damage,DM_damage,err_PETSc) + CHKERRQ(err_PETSc) + call DMDAVecGetArrayF90(DM_damage,phi_PETSc,phi,err_PETSc) ! returns 0-indexed phi + CHKERRQ(err_PETSc) + + phi_min = minval(phi) + phi_max = maxval(phi) stagNorm = maxval(abs(phi - phi_stagInc)) call MPI_Allreduce(MPI_IN_PLACE,stagNorm,1_MPI_INTEGER_KIND,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' - solution%stagConverged = stagNorm < max(num%eps_damage_atol, num%eps_damage_rtol*maxval(phi)) + solution%stagConverged = stagNorm < max(num%eps_damage_atol, num%eps_damage_rtol*phi_max) call MPI_Allreduce(MPI_IN_PLACE,solution%stagConverged,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LAND,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' phi_stagInc = phi @@ -247,15 +252,14 @@ function grid_damage_spectral_solution(Delta_t) result(solution) !-------------------------------------------------------------------------------------------------- ! updating damage state ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) + do k = 0, cells3-1; do j = 0, cells(2)-1; do i = 0,cells(1)-1 ce = ce + 1 call homogenization_set_phi(phi(i,j,k),ce) end do; end do; end do - call VecMin(solution_vec,devNull,phi_min,err_PETSc) - CHKERRQ(err_PETSc) - call VecMax(solution_vec,devNull,phi_max,err_PETSc) + call DMDAVecRestoreArrayF90(DM_damage,phi_PETSc,phi,err_PETSc) CHKERRQ(err_PETSc) + if (solution%converged) & print'(/,1x,a)', '... nonlocal damage converged .....................................' print'(/,1x,a,f8.6,2x,f8.6,2x,e11.4)', 'Minimum|Maximum|Delta Damage = ', phi_min, phi_max, stagNorm @@ -266,35 +270,31 @@ end function grid_damage_spectral_solution !-------------------------------------------------------------------------------------------------- -!> @brief spectral damage forwarding routine +!> @brief Set DAMASK data to current solver status. !-------------------------------------------------------------------------------------------------- subroutine grid_damage_spectral_forward(cutBack) logical, intent(in) :: cutBack integer :: i, j, k, ce - DM :: dm_local - real(pREAL), dimension(:,:,:), pointer :: phi_PETSc + DM :: DM_damage + real(pREAL), dimension(:,:,:), pointer :: phi ! 0-indexed PetscErrorCode :: err_PETSc + call SNESGetDM(SNES_damage,DM_damage,err_PETSc) + CHKERRQ(err_PETSc) + call DMDAVecGetArrayF90(DM_damage,phi_PETSc,phi,err_PETSc) ! returns 0-indexed T + CHKERRQ(err_PETSc) + if (cutBack) then - phi = phi_lastInc - phi_stagInc = phi_lastInc -!-------------------------------------------------------------------------------------------------- -! reverting damage field state - call SNESGetDM(SNES_damage,dm_local,err_PETSc) - CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(dm_local,solution_vec,phi_PETSc,err_PETSc) !< get the data out of PETSc to work with - CHKERRQ(err_PETSc) - phi_PETSc = phi - call DMDAVecRestoreArrayF90(dm_local,solution_vec,phi_PETSc,err_PETSc) - CHKERRQ(err_PETSc) ce = 0 do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) ce = ce + 1 - call homogenization_set_phi(phi(i,j,k),ce) + call homogenization_set_phi(phi_lastInc(i,j,k),ce) end do; end do; end do + phi = phi_lastInc + phi_stagInc = phi_lastInc else phi_lastInc = phi call updateReference() @@ -309,13 +309,14 @@ end subroutine grid_damage_spectral_forward subroutine grid_damage_spectral_restartWrite() PetscErrorCode :: err_PETSc - DM :: dm_local + DM :: DM_damage integer(HID_T) :: fileHandle, groupHandle - PetscScalar, dimension(:,:,:), pointer :: phi + real(pREAL), dimension(:,:,:), pointer :: phi ! 0-indexed - call SNESGetDM(SNES_damage,dm_local,err_PETSc); + + call SNESGetDM(SNES_damage,DM_damage,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayReadF90(dm_local,solution_vec,phi,err_PETSc); + call DMDAVecGetArrayReadF90(DM_damage,phi_PETSc,phi,err_PETSc) ! returns 0-indexed T CHKERRQ(err_PETSc) print'(1x,a)', 'saving damage solver data required for restart'; flush(IO_STDOUT) @@ -327,7 +328,7 @@ subroutine grid_damage_spectral_restartWrite() call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) - call DMDAVecRestoreArrayReadF90(dm_local,solution_vec,phi,err_PETSc); + call DMDAVecRestoreArrayReadF90(DM_damage,phi_PETSc,phi,err_PETSc); CHKERRQ(err_PETSc) end subroutine grid_damage_spectral_restartWrite @@ -351,24 +352,25 @@ subroutine formResidual(residual_subdomain,x_scal,r,dummy,err_PETSc) real(pREAL), dimension(3,cells(1),cells(2),cells3) :: vectorField - phi = x_scal - vectorField = utilities_ScalarGradient(phi) - ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) - ce = ce + 1 - vectorField(1:3,i,j,k) = matmul(homogenization_K_phi(ce) - K_ref, vectorField(1:3,i,j,k)) - end do; end do; end do - r = utilities_VectorDivergence(vectorField) - ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) - ce = ce + 1 - r(i,j,k) = params%Delta_t*(r(i,j,k) + homogenization_f_phi(phi(i,j,k),ce)) & - + homogenization_mu_phi(ce)*(phi_lastInc(i,j,k) - phi(i,j,k)) & - + mu_ref*phi(i,j,k) - end do; end do; end do + associate(phi => x_scal) + vectorField = utilities_ScalarGradient(phi) + ce = 0 + do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) + ce = ce + 1 + vectorField(1:3,i,j,k) = matmul(homogenization_K_phi(ce) - K_ref, vectorField(1:3,i,j,k)) + end do; end do; end do + r = utilities_VectorDivergence(vectorField) + ce = 0 + do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) + ce = ce + 1 + r(i,j,k) = params%Delta_t*(r(i,j,k) + homogenization_f_phi(phi(i,j,k),ce)) & + + homogenization_mu_phi(ce)*(phi_lastInc(i,j,k) - phi(i,j,k)) & + + mu_ref*phi(i,j,k) + end do; end do; end do - r = max(min(utilities_GreenConvolution(r, K_ref, mu_ref, params%Delta_t),phi_lastInc),num%phi_min) & - - phi + r = max(min(utilities_GreenConvolution(r, K_ref, mu_ref, params%Delta_t),phi_lastInc),num%phi_min) & + - phi + end associate err_PETSc = 0 end subroutine formResidual diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index e8fd0c914..a3e2ae673 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -81,6 +81,7 @@ subroutine grid_thermal_spectral_init() type(tDict), pointer :: & num_grid + print'(/,1x,a)', '<<<+- grid_thermal_spectral init -+>>>' print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019' @@ -291,6 +292,7 @@ subroutine grid_thermal_spectral_restartWrite() integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:), pointer :: T ! 0-indexed + call SNESGetDM(SNES_thermal,DM_thermal,err_PETSc) CHKERRQ(err_PETSc) call DMDAVecGetArrayReadF90(DM_thermal,T_PETSc,T,err_PETSc) ! returns 0-indexed T @@ -312,7 +314,6 @@ subroutine grid_thermal_spectral_restartWrite() end subroutine grid_thermal_spectral_restartWrite - !-------------------------------------------------------------------------------------------------- !> @brief Construct the residual vector. !-------------------------------------------------------------------------------------------------- @@ -349,8 +350,8 @@ subroutine formResidual(residual_subdomain,x_scal,r,dummy,err_PETSc) r = T & - utilities_GreenConvolution(r, K_ref, mu_ref, params%Delta_t) - err_PETSc = 0 end associate + err_PETSc = 0 end subroutine formResidual From ddeb21872800fa17e3509af37c8009bd079b2704 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 17 Jul 2023 02:52:26 +0200 Subject: [PATCH 035/198] unified naming scheme with damage/thermal --- src/grid/grid_mech_FEM.f90 | 76 ++++++++++---------- src/grid/grid_mech_spectral_basic.f90 | 50 ++++++------- src/grid/grid_mech_spectral_polarisation.f90 | 50 ++++++------- 3 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 14f750d73..f7f72dd9f 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -52,9 +52,9 @@ module grid_mechanical_FEM !-------------------------------------------------------------------------------------------------- ! PETSc data - DM :: mechanical_grid - SNES :: SNES_mechanical - Vec :: solution_current, solution_lastInc, solution_rate + DM :: DM_mech + SNES :: SNES_mech + Vec :: u_PETSc, u_lastInc_PETSc, uDot_PETSc !-------------------------------------------------------------------------------------------------- ! common pointwise data @@ -163,9 +163,9 @@ subroutine grid_mechanical_FEM_init !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc - call SNESCreate(PETSC_COMM_WORLD,SNES_mechanical,err_PETSc) + call SNESCreate(PETSC_COMM_WORLD,SNES_mech,err_PETSc) CHKERRQ(err_PETSc) - call SNESSetOptionsPrefix(SNES_mechanical,'mechanical_',err_PETSc) + call SNESSetOptionsPrefix(SNES_mech,'mechanical_',err_PETSc) CHKERRQ(err_PETSc) call MPI_Allgather(int(cells3,MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& cells3_global,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) @@ -177,44 +177,44 @@ subroutine grid_mechanical_FEM_init 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & 3_pPETSCINT, 1_pPETSCINT, & ! #dof (u, vector), ghost boundary width (domain overlap) [int(cells(1),pPETSCINT)],[int(cells(2),pPETSCINT)],int(cells3_global,pPETSCINT), & ! local cells - mechanical_grid,err_PETSc) + DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call DMsetFromOptions(mechanical_grid,err_PETSc) + call DMsetFromOptions(DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call DMsetUp(mechanical_grid,err_PETSc) + call DMsetUp(DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call DMDASetUniformCoordinates(mechanical_grid,0.0_pREAL,geomSize(1),0.0_pREAL,geomSize(2),0.0_pREAL,geomSize(3),err_PETSc) + call DMDASetUniformCoordinates(DM_mech,0.0_pREAL,geomSize(1),0.0_pREAL,geomSize(2),0.0_pREAL,geomSize(3),err_PETSc) CHKERRQ(err_PETSc) - call DMCreateGlobalVector(mechanical_grid,solution_current,err_PETSc) + call DMCreateGlobalVector(DM_mech,u_PETSc,err_PETSc) CHKERRQ(err_PETSc) - call DMCreateGlobalVector(mechanical_grid,solution_lastInc,err_PETSc) + call DMCreateGlobalVector(DM_mech,u_lastInc_PETSc,err_PETSc) CHKERRQ(err_PETSc) - call DMCreateGlobalVector(mechanical_grid,solution_rate ,err_PETSc) + call DMCreateGlobalVector(DM_mech,uDot_PETSc,err_PETSc) CHKERRQ(err_PETSc) - call DMSNESSetFunctionLocal(mechanical_grid,formResidual,PETSC_NULL_SNES,err_PETSc) + call DMSNESSetFunctionLocal(DM_mech,formResidual,PETSC_NULL_SNES,err_PETSc) CHKERRQ(err_PETSc) - call DMSNESSetJacobianLocal(mechanical_grid,formJacobian,PETSC_NULL_SNES,err_PETSc) + call DMSNESSetJacobianLocal(DM_mech,formJacobian,PETSC_NULL_SNES,err_PETSc) CHKERRQ(err_PETSc) - call SNESSetConvergenceTest(SNES_mechanical,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,err_PETSc) ! specify custom convergence check function "_converged" + call SNESSetConvergenceTest(SNES_mech,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,err_PETSc) ! specify custom convergence check function "_converged" CHKERRQ(err_PETSc) - call SNESSetMaxLinearSolveFailures(SNES_mechanical, huge(1_pPETSCINT), err_PETSc) ! ignore linear solve failures + call SNESSetMaxLinearSolveFailures(SNES_mech, huge(1_pPETSCINT), err_PETSc) ! ignore linear solve failures CHKERRQ(err_PETSc) - call SNESSetDM(SNES_mechanical,mechanical_grid,err_PETSc) + call SNESSetDM(SNES_mech,DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call SNESSetFromOptions(SNES_mechanical,err_PETSc) ! pull it all together with additional cli arguments + call SNESSetFromOptions(SNES_mech,err_PETSc) ! pull it all together with additional cli arguments CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- ! init fields - call VecSet(solution_current,0.0_pREAL,err_PETSc) + call VecSet(u_PETSc,0.0_pREAL,err_PETSc) CHKERRQ(err_PETSc) - call VecSet(solution_lastInc,0.0_pREAL,err_PETSc) + call VecSet(u_lastInc_PETSc,0.0_pREAL,err_PETSc) CHKERRQ(err_PETSc) - call VecSet(solution_rate ,0.0_pREAL,err_PETSc) + call VecSet(uDot_PETSc ,0.0_pREAL,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(mechanical_grid,solution_current,u,err_PETSc) + call DMDAVecGetArrayF90(DM_mech,u_PETSc,u,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) + call DMDAVecGetArrayF90(DM_mech,u_lastInc_PETSc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) delta = geomSize/real(cells,pREAL) ! grid spacing @@ -271,9 +271,9 @@ subroutine grid_mechanical_FEM_init call utilities_constitutiveResponse(P_current,P_av,C_volAvg,devNull, & ! stress field, stress avg, global average of stiffness and (min+max)/2 F, & ! target F 0.0_pREAL) ! time increment - call DMDAVecRestoreArrayF90(mechanical_grid,solution_current,u,err_PETSc) + call DMDAVecRestoreArrayF90(DM_mech,u_PETSc,u,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) + call DMDAVecRestoreArrayF90(DM_mech,u_lastInc_PETSc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) restartRead2: if (CLI_restartInc > 0) then @@ -315,9 +315,9 @@ function grid_mechanical_FEM_solution(incInfoIn) result(solution) ! update stiffness (and gamma operator) S = utilities_maskedCompliance(params%rotation_BC,params%stress_mask,C_volAvg) - call SNESsolve(SNES_mechanical,PETSC_NULL_VEC,solution_current,err_PETSc) + call SNESsolve(SNES_mech,PETSC_NULL_VEC,u_PETSc,err_PETSc) CHKERRQ(err_PETSc) - call SNESGetConvergedReason(SNES_mechanical,reason,err_PETSc) + call SNESGetConvergedReason(SNES_mech,reason,err_PETSc) CHKERRQ(err_PETSc) solution%converged = reason > 0 @@ -374,15 +374,15 @@ subroutine grid_mechanical_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remai end if if (guess) then - call VecWAXPY(solution_rate,-1.0_pREAL,solution_lastInc,solution_current,err_PETSc) + call VecWAXPY(uDot_PETSc,-1.0_pREAL,u_lastInc_PETSc,u_PETSc,err_PETSc) CHKERRQ(err_PETSc) - call VecScale(solution_rate,1.0_pREAL/Delta_t_old,err_PETSc) + call VecScale(uDot_PETSc,1.0_pREAL/Delta_t_old,err_PETSc) CHKERRQ(err_PETSc) else - call VecSet(solution_rate,0.0_pREAL,err_PETSc) + call VecSet(uDot_PETSc,0.0_pREAL,err_PETSc) CHKERRQ(err_PETSc) end if - call VecCopy(solution_current,solution_lastInc,err_PETSc) + call VecCopy(u_PETSc,u_lastInc_PETSc,err_PETSc) CHKERRQ(err_PETSc) F_lastInc = F @@ -398,7 +398,7 @@ subroutine grid_mechanical_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remai if (stress_BC%myType=='dot_P') P_aim = P_aim & + merge(.0_pREAL,stress_BC%values,stress_BC%mask)*Delta_t - call VecAXPY(solution_current,Delta_t,solution_rate,err_PETSc) + call VecAXPY(u_PETSc,Delta_t,uDot_PETSc,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- @@ -430,9 +430,9 @@ subroutine grid_mechanical_FEM_restartWrite() PetscScalar, dimension(:,:,:,:), pointer :: u,u_lastInc - call DMDAVecGetArrayReadF90(mechanical_grid,solution_current,u,err_PETSc) + call DMDAVecGetArrayReadF90(DM_mech,u_PETSc,u,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayReadF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) + call DMDAVecGetArrayReadF90(DM_mech,u_lastInc_PETSc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT) @@ -459,9 +459,9 @@ subroutine grid_mechanical_FEM_restartWrite() call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayReadF90(mechanical_grid,solution_current,u,err_PETSc) + call DMDAVecRestoreArrayReadF90(DM_mech,u_PETSc,u,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayReadF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) + call DMDAVecRestoreArrayReadF90(DM_mech,u_lastInc_PETSc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_FEM_restartWrite @@ -531,9 +531,9 @@ subroutine formResidual(da_local,x_local, & integer(MPI_INTEGER_KIND) :: err_MPI real(pREAL), dimension(3,3,3,3) :: devNull - call SNESGetNumberFunctionEvals(SNES_mechanical,nfuncs,err_PETSc) + call SNESGetNumberFunctionEvals(SNES_mech,nfuncs,err_PETSc) CHKERRQ(err_PETSc) - call SNESGetIterationNumber(SNES_mechanical,PETScIter,err_PETSc) + call SNESGetIterationNumber(SNES_mech,PETScIter,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 0ada208c1..c35c4f8e0 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -51,9 +51,9 @@ module grid_mechanical_spectral_basic !-------------------------------------------------------------------------------------------------- ! PETSc data - DM :: da - SNES :: SNES_mechanical - Vec :: solution_vec + DM :: DM_mech + SNES :: SNES_mech + Vec :: F_PETSc !-------------------------------------------------------------------------------------------------- ! common pointwise data @@ -162,9 +162,9 @@ subroutine grid_mechanical_spectral_basic_init() !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc - call SNESCreate(PETSC_COMM_WORLD,SNES_mechanical,err_PETSc) + call SNESCreate(PETSC_COMM_WORLD,SNES_mech,err_PETSc) CHKERRQ(err_PETSc) - call SNESSetOptionsPrefix(SNES_mechanical,'mechanical_',err_PETSc) + call SNESSetOptionsPrefix(SNES_mech,'mechanical_',err_PETSc) CHKERRQ(err_PETSc) call MPI_Allgather(int(cells3,MPI_INTEGER_KIND),1_MPI_INTEGER_KIND,MPI_INTEGER,& cells3_global,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) @@ -176,26 +176,26 @@ subroutine grid_mechanical_spectral_basic_init() 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & 9_pPETSCINT, 0_pPETSCINT, & ! #dof (F, tensor), ghost boundary width (domain overlap) [int(cells(1),pPETSCINT)],[int(cells(2),pPETSCINT)],int(cells3_global,pPETSCINT), & ! local cells - da,err_PETSc) ! handle, error + DM_mech,err_PETSc) ! handle, error CHKERRQ(err_PETSc) - call DMsetFromOptions(da,err_PETSc) + call DMsetFromOptions(DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call DMsetUp(da,err_PETSc) + call DMsetUp(DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call DMcreateGlobalVector(da,solution_vec,err_PETSc) ! global solution vector (cells x 9, i.e. every def grad tensor) + call DMcreateGlobalVector(DM_mech,F_PETSc,err_PETSc) ! global solution vector (cells x 9, i.e. every def grad tensor) CHKERRQ(err_PETSc) - call DMDASNESsetFunctionLocal(da,INSERT_VALUES,formResidual,PETSC_NULL_SNES,err_PETSc) ! residual vector of same shape as solution vector + call DMDASNESsetFunctionLocal(DM_mech,INSERT_VALUES,formResidual,PETSC_NULL_SNES,err_PETSc) ! residual vector of same shape as solution vector CHKERRQ(err_PETSc) - call SNESsetConvergenceTest(SNES_mechanical,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,err_PETSc) ! specify custom convergence check function "converged" + call SNESsetConvergenceTest(SNES_mech,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,err_PETSc) ! specify custom convergence check function "converged" CHKERRQ(err_PETSc) - call SNESSetDM(SNES_mechanical,da,err_PETSc) + call SNESSetDM(SNES_mech,DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call SNESsetFromOptions(SNES_mechanical,err_PETSc) ! pull it all together with additional CLI arguments + call SNESsetFromOptions(SNES_mech,err_PETSc) ! pull it all together with additional CLI arguments CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- ! init fields - call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) ! places pointer on PETSc data + call DMDAVecGetArrayF90(DM_mech,F_PETSc,F,err_PETSc) ! places pointer on PETSc data CHKERRQ(err_PETSc) restartRead: if (CLI_restartInc > 0) then @@ -231,7 +231,7 @@ subroutine grid_mechanical_spectral_basic_init() call utilities_constitutiveResponse(P,P_av,C_volAvg,C_minMaxAvg, & ! stress field, stress avg, global average of stiffness and (min+max)/2 reshape(F,shape(F_lastInc)), & ! target F 0.0_pREAL) ! time increment - call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) ! deassociate pointer + call DMDAVecRestoreArrayF90(DM_mech,F_PETSc,F,err_PETSc) ! deassociate pointer CHKERRQ(err_PETSc) restartRead2: if (CLI_restartInc > 0) then @@ -280,9 +280,9 @@ function grid_mechanical_spectral_basic_solution(incInfoIn) result(solution) S = utilities_maskedCompliance(params%rotation_BC,params%stress_mask,C_volAvg) if (num%update_gamma) call utilities_updateGamma(C_minMaxAvg) - call SNESsolve(SNES_mechanical,PETSC_NULL_VEC,solution_vec,err_PETSc) + call SNESsolve(SNES_mech,PETSC_NULL_VEC,F_PETSc,err_PETSc) CHKERRQ(err_PETSc) - call SNESGetConvergedReason(SNES_mechanical,reason,err_PETSc) + call SNESGetConvergedReason(SNES_mech,reason,err_PETSc) CHKERRQ(err_PETSc) solution%converged = reason > 0 @@ -317,7 +317,7 @@ subroutine grid_mechanical_spectral_basic_forward(cutBack,guess,Delta_t,Delta_t_ real(pREAL), pointer, dimension(:,:,:,:) :: F - call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecGetArrayF90(DM_mech,F_PETSc,F,err_PETSc) CHKERRQ(err_PETSc) if (cutBack) then @@ -361,7 +361,7 @@ subroutine grid_mechanical_spectral_basic_forward(cutBack,guess,Delta_t,Delta_t_ F = reshape(utilities_forwardField(Delta_t,F_lastInc,Fdot, & ! estimate of F at end of time+Delta_t that matches rotated F_aim on average rotation_BC%rotate(F_aim,active=.true.)),[9,cells(1),cells(2),cells3]) - call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecRestoreArrayF90(DM_mech,F_PETSc,F,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- @@ -381,10 +381,10 @@ subroutine grid_mechanical_spectral_basic_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: F - call DMDAVecGetArrayReadF90(da,solution_vec,F,err_PETSc) + call DMDAVecGetArrayReadF90(DM_mech,F_PETSc,F,err_PETSc) CHKERRQ(err_PETSc) call utilities_updateCoords(reshape(F,[3,3,size(F,2),size(F,3),size(F,4)])) - call DMDAVecRestoreArrayReadF90(da,solution_vec,F,err_PETSc) + call DMDAVecRestoreArrayReadF90(DM_mech,F_PETSc,F,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_basic_updateCoords @@ -399,7 +399,7 @@ subroutine grid_mechanical_spectral_basic_restartWrite() integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:,:), pointer :: F - call DMDAVecGetArrayReadF90(da,solution_vec,F,err_PETSc) + call DMDAVecGetArrayReadF90(DM_mech,F_PETSc,F,err_PETSc) CHKERRQ(err_PETSc) if (num%update_gamma) C_minMaxAvgRestart = C_minMaxAvg @@ -427,7 +427,7 @@ subroutine grid_mechanical_spectral_basic_restartWrite() call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayReadF90(da,solution_vec,F,err_PETSc) + call DMDAVecRestoreArrayReadF90(DM_mech,F_PETSc,F,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_basic_restartWrite @@ -498,9 +498,9 @@ subroutine formResidual(residual_subdomain, F, & integer(MPI_INTEGER_KIND) :: err_MPI - call SNESGetNumberFunctionEvals(SNES_mechanical,nfuncs,err_PETSc) + call SNESGetNumberFunctionEvals(SNES_mech,nfuncs,err_PETSc) CHKERRQ(err_PETSc) - call SNESGetIterationNumber(SNES_mechanical,PETScIter,err_PETSc) + call SNESGetIterationNumber(SNES_mech,PETScIter,err_PETSc) CHKERRQ(err_PETSc) if (nfuncs == 0 .and. PETScIter == 0) totalIter = -1 ! new increment diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index bc1c0484c..a5ad09969 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -56,9 +56,9 @@ module grid_mechanical_spectral_polarisation !-------------------------------------------------------------------------------------------------- ! PETSc data - DM :: da - SNES :: SNES_mechanical - Vec :: solution_vec + DM :: DM_mech + SNES :: SNES_mech + Vec :: FandF_tau_PETSc !-------------------------------------------------------------------------------------------------- ! common pointwise data @@ -183,9 +183,9 @@ subroutine grid_mechanical_spectral_polarisation_init() !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc - call SNESCreate(PETSC_COMM_WORLD,SNES_mechanical,err_PETSc) + call SNESCreate(PETSC_COMM_WORLD,SNES_mech,err_PETSc) CHKERRQ(err_PETSc) - call SNESSetOptionsPrefix(SNES_mechanical,'mechanical_',err_PETSc) + call SNESSetOptionsPrefix(SNES_mech,'mechanical_',err_PETSc) CHKERRQ(err_PETSc) call MPI_Allgather(int(cells3,pPetscInt),1_MPI_INTEGER_KIND,MPI_INTEGER,& cells3_global,1_MPI_INTEGER_KIND,MPI_INTEGER,MPI_COMM_WORLD,err_MPI) @@ -197,26 +197,26 @@ subroutine grid_mechanical_spectral_polarisation_init() 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & 18_pPETSCINT, 0_pPETSCINT, & ! #dof (2xtensor), ghost boundary width (domain overlap) [int(cells(1),pPETSCINT)],[int(cells(2),pPETSCINT)],int(cells3_global,pPETSCINT), & ! local cells - da,err_PETSc) ! handle, error + DM_mech,err_PETSc) ! handle, error CHKERRQ(err_PETSc) - call DMsetFromOptions(da,err_PETSc) + call DMsetFromOptions(DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call DMsetUp(da,err_PETSc) + call DMsetUp(DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call DMcreateGlobalVector(da,solution_vec,err_PETSc) ! global solution vector (cells x 18, i.e. every def grad tensor) + call DMcreateGlobalVector(DM_mech,FandF_tau_PETSc,err_PETSc) ! global solution vector (cells x 18, i.e. every def grad tensor) CHKERRQ(err_PETSc) - call DMDASNESsetFunctionLocal(da,INSERT_VALUES,formResidual,PETSC_NULL_SNES,err_PETSc) ! residual vector of same shape as solution vector + call DMDASNESsetFunctionLocal(DM_mech,INSERT_VALUES,formResidual,PETSC_NULL_SNES,err_PETSc) ! residual vector of same shape as solution vector CHKERRQ(err_PETSc) - call SNESsetConvergenceTest(SNES_mechanical,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,err_PETSc) ! specify custom convergence check function "converged" + call SNESsetConvergenceTest(SNES_mech,converged,PETSC_NULL_SNES,PETSC_NULL_FUNCTION,err_PETSc) ! specify custom convergence check function "converged" CHKERRQ(err_PETSc) - call SNESSetDM(SNES_mechanical,da,err_PETSc) + call SNESSetDM(SNES_mech,DM_mech,err_PETSc) CHKERRQ(err_PETSc) - call SNESsetFromOptions(SNES_mechanical,err_PETSc) ! pull it all together with additional CLI arguments + call SNESsetFromOptions(SNES_mech,err_PETSc) ! pull it all together with additional CLI arguments CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- ! init fields - call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,err_PETSc) ! places pointer on PETSc data + call DMDAVecGetArrayF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc) ! places pointer on PETSc data CHKERRQ(err_PETSc) F => FandF_tau(0: 8,:,:,:) F_tau => FandF_tau(9:17,:,:,:) @@ -260,7 +260,7 @@ subroutine grid_mechanical_spectral_polarisation_init() call utilities_constitutiveResponse(P,P_av,C_volAvg,C_minMaxAvg, & ! stress field, stress avg, global average of stiffness and (min+max)/2 reshape(F,shape(F_lastInc)), & ! target F 0.0_pREAL) ! time increment - call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) ! deassociate pointer + call DMDAVecRestoreArrayF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc) ! deassociate pointer CHKERRQ(err_PETSc) restartRead2: if (CLI_restartInc > 0) then @@ -315,9 +315,9 @@ function grid_mechanical_spectral_polarisation_solution(incInfoIn) result(soluti S_scale = math_invSym3333(C_minMaxAvg) end if - call SNESSolve(SNES_mechanical,PETSC_NULL_VEC,solution_vec,err_PETSc) + call SNESSolve(SNES_mech,PETSC_NULL_VEC,FandF_tau_PETSc,err_PETSc) CHKERRQ(err_PETSc) - call SNESGetConvergedReason(SNES_mechanical,reason,err_PETSc) + call SNESGetConvergedReason(SNES_mech,reason,err_PETSc) CHKERRQ(err_PETSc) solution%converged = reason > 0 @@ -354,7 +354,7 @@ subroutine grid_mechanical_spectral_polarisation_forward(cutBack,guess,Delta_t,D real(pREAL), dimension(3,3) :: F_lambda33 - call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecGetArrayF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) F => FandF_tau(0: 8,:,:,:) F_tau => FandF_tau(9:17,:,:,:) @@ -418,7 +418,7 @@ subroutine grid_mechanical_spectral_polarisation_forward(cutBack,guess,Delta_t,D end do; end do; end do end if - call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecRestoreArrayF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- @@ -438,10 +438,10 @@ subroutine grid_mechanical_spectral_polarisation_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau - call DMDAVecGetArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecGetArrayReadF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) call utilities_updateCoords(reshape(FandF_tau(0:8,:,:,:),[3,3,size(FandF_tau,2),size(FandF_tau,3),size(FandF_tau,4)])) - call DMDAVecRestoreArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecRestoreArrayReadF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_polarisation_updateCoords @@ -456,7 +456,7 @@ subroutine grid_mechanical_spectral_polarisation_restartWrite() integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau, F, F_tau - call DMDAVecGetArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecGetArrayReadF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) F => FandF_tau(0: 8,:,:,:) F_tau => FandF_tau(9:17,:,:,:) @@ -488,7 +488,7 @@ subroutine grid_mechanical_spectral_polarisation_restartWrite() call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecRestoreArrayReadF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_polarisation_restartWrite @@ -576,9 +576,9 @@ subroutine formResidual(residual_subdomain, FandF_tau, & call MPI_Allreduce(MPI_IN_PLACE,F_av,9_MPI_INTEGER_KIND,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' - call SNESGetNumberFunctionEvals(SNES_mechanical,nfuncs,err_PETSc) + call SNESGetNumberFunctionEvals(SNES_mech,nfuncs,err_PETSc) CHKERRQ(err_PETSc) - call SNESGetIterationNumber(SNES_mechanical,PETScIter,err_PETSc) + call SNESGetIterationNumber(SNES_mech,PETScIter,err_PETSc) CHKERRQ(err_PETSc) if (nfuncs == 0 .and. PETScIter == 0) totalIter = -1 ! new increment From 3d9e637f6e09951b86409fe37a71453806f52377 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 17 Jul 2023 13:39:22 +0000 Subject: [PATCH 036/198] 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 037/198] 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 038/198] 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 039/198] 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 040/198] 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 041/198] 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 042/198] 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 043/198] 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 044/198] 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 045/198] 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 046/198] [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 d88b2e713d71f057085981ab80535b6e5d939c37 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 18 Jul 2023 15:31:41 +0200 Subject: [PATCH 047/198] avoid duplicate lc function --- src/Marc/DAMASK_Marc.f90 | 42 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index f2f6488f1..e104ca345 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -16,15 +16,24 @@ #endif #include "../prec.f90" +#include "../parallelization.f90" +#include "../constants.f90" +#include "../misc.f90" +#include "../IO.f90" +#include "../YAML_types.f90" +#include "../YAML_parse.f90" +#include "../HDF5_utilities.f90" module DAMASK_interface - use prec use, intrinsic :: ISO_fortran_env, only: & compiler_version, & compiler_options use ifport, only: & CHDIR + use prec + use IO + implicit none(type,external) private @@ -105,7 +114,7 @@ logical function solverIsSymmetric() status='old', position='rewind', action='read',iostat=myStat) do read (fileUnit,'(A)',END=100) line - if (index(trim(lc(line)),'solver') == 1) then + if (index(trim(IO_lc(line)),'solver') == 1) then read (fileUnit,'(A)',END=100) line ! next line s = verify(line, ' ') ! start of first chunk s = s + verify(line(s+1:),' ') ! start of second chunk @@ -114,40 +123,11 @@ logical function solverIsSymmetric() end if end do 100 close(fileUnit) - contains - - !-------------------------------------------------------------------------------------------------- - !> @brief changes characters in string to lower case - !> @details copied from IO_lc - !-------------------------------------------------------------------------------------------------- - function lc(string) - - character(len=*), intent(in) :: string !< string to convert - character(len=len(string)) :: lc - - character(26), parameter :: LOWER = 'abcdefghijklmnopqrstuvwxyz' - character(26), parameter :: UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - - integer :: i,n - - do i=1,len(string) - lc(i:i) = string(i:i) - n = index(UPPER,lc(i:i)) - if (n/=0) lc(i:i) = LOWER(n:n) - end do - end function lc end function solverIsSymmetric end module DAMASK_interface -#include "../parallelization.f90" -#include "../constants.f90" -#include "../misc.f90" -#include "../IO.f90" -#include "../YAML_types.f90" -#include "../YAML_parse.f90" -#include "../HDF5_utilities.f90" #include "../result.f90" #include "../config.f90" #include "../LAPACK_interface.f90" From 5bd95315772a4717de38789a46710209cf46f176 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 18 Jul 2023 20:27:34 +0200 Subject: [PATCH 048/198] [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 From d85ad0b554301469ee1577012aa210f9359a9725 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 18 Jul 2023 04:12:57 +0200 Subject: [PATCH 049/198] improved naming --- src/Marc/DAMASK_Marc.f90 | 4 +- src/phase_thermal.f90 | 75 ++++++++++--------- ...0 => phase_thermal_source_dissipation.f90} | 14 ++-- ... => phase_thermal_source_externalheat.f90} | 37 ++++----- 4 files changed, 61 insertions(+), 69 deletions(-) rename src/{phase_thermal_dissipation.f90 => phase_thermal_source_dissipation.f90} (90%) rename src/{phase_thermal_externalheat.f90 => phase_thermal_source_externalheat.f90} (78%) diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index 032c77394..b1d9d91ba 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -176,8 +176,8 @@ end module DAMASK_interface #include "../phase_mechanical_eigen_cleavageopening.f90" #include "../phase_mechanical_eigen_thermalexpansion.f90" #include "../phase_thermal.f90" -#include "../phase_thermal_dissipation.f90" -#include "../phase_thermal_externalheat.f90" +#include "../phase_thermal_source_dissipation.f90" +#include "../phase_thermal_source_externalheat.f90" #include "../phase_damage.f90" #include "../phase_damage_isobrittle.f90" #include "../phase_damage_anisobrittle.f90" diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index 449e08ab8..8f59dc874 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -21,13 +21,13 @@ submodule(phase) thermal THERMAL_EXTERNALHEAT_ID end enum - type :: tDataContainer ! ?? not very telling name. Better: "fieldQuantities" ?? + type :: tFieldQuantities real(pREAL), dimension(:), allocatable :: T, dot_T - end type tDataContainer + end type tFieldQuantities integer(kind(THERMAL_UNDEFINED_ID)), dimension(:,:), allocatable :: & thermal_source - type(tDataContainer), dimension(:), allocatable :: current ! ?? not very telling name. Better: "field" ?? MD: current(ho)%T(en) reads quite good + type(tFieldQuantities), dimension(:), allocatable :: current type(tThermalParameters), dimension(:), allocatable :: param @@ -36,36 +36,36 @@ submodule(phase) thermal interface - module function dissipation_init(source_length) result(mySources) + module function source_dissipation_init(source_length) result(mySources) integer, intent(in) :: source_length logical, dimension(:,:), allocatable :: mySources - end function dissipation_init + end function source_dissipation_init - module function externalheat_init(source_length) result(mySources) + module function source_externalheat_init(source_length) result(mySources) integer, intent(in) :: source_length logical, dimension(:,:), allocatable :: mySources - end function externalheat_init + end function source_externalheat_init - module subroutine externalheat_dotState(ph, en) + module subroutine source_externalheat_dotState(ph, en) integer, intent(in) :: & ph, & en - end subroutine externalheat_dotState + end subroutine source_externalheat_dotState - module function dissipation_f_T(ph,en) result(f_T) + module function source_dissipation_f_T(ph,en) result(f_T) integer, intent(in) :: & ph, & en real(pREAL) :: f_T - end function dissipation_f_T + end function source_dissipation_f_T - module function externalheat_f_T(ph,en) result(f_T) + module function source_externalheat_f_T(ph,en) result(f_T) integer, intent(in) :: & ph, & en real(pREAL) :: f_T - end function externalheat_f_T + end function source_externalheat_f_T end interface @@ -132,8 +132,8 @@ module subroutine thermal_init(phases) allocate(thermal_source(maxval(thermal_Nsources),phases%length), source = THERMAL_UNDEFINED_ID) if (maxval(thermal_Nsources) /= 0) then - where(dissipation_init (maxval(thermal_Nsources))) thermal_source = THERMAL_DISSIPATION_ID - where(externalheat_init(maxval(thermal_Nsources))) thermal_source = THERMAL_EXTERNALHEAT_ID + where(source_dissipation_init (maxval(thermal_Nsources))) thermal_source = THERMAL_DISSIPATION_ID + where(source_externalheat_init(maxval(thermal_Nsources))) thermal_source = THERMAL_EXTERNALHEAT_ID end if thermal_source_maxSizeDotState = 0 @@ -151,7 +151,7 @@ end subroutine thermal_init !---------------------------------------------------------------------------------------------- -!< @brief Calculate thermal source. +!< @brief Calculate thermal source (forcing term). !---------------------------------------------------------------------------------------------- module function phase_f_T(ph,en) result(f) @@ -168,10 +168,10 @@ module function phase_f_T(ph,en) result(f) select case(thermal_source(so,ph)) case (THERMAL_DISSIPATION_ID) - f = f + dissipation_f_T(ph,en) + f = f + source_dissipation_f_T(ph,en) case (THERMAL_EXTERNALHEAT_ID) - f = f + externalheat_f_T(ph,en) + f = f + source_externalheat_f_T(ph,en) end select @@ -183,22 +183,22 @@ end function phase_f_T !-------------------------------------------------------------------------------------------------- !> @brief tbd. !-------------------------------------------------------------------------------------------------- -function phase_thermal_collectDotState(ph,en) result(broken) +function phase_thermal_collectDotState(ph,en) result(ok) integer, intent(in) :: ph, en - logical :: broken + logical :: ok integer :: i - broken = .false. + ok = .true. SourceLoop: do i = 1, thermal_Nsources(ph) if (thermal_source(i,ph) == THERMAL_EXTERNALHEAT_ID) & - call externalheat_dotState(ph,en) + call source_externalheat_dotState(ph,en) - broken = broken .or. any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,en))) + ok = ok .and. .not. any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,en))) end do SourceLoop @@ -241,34 +241,35 @@ module function phase_thermal_constitutive(Delta_t,ph,en) result(converged_) logical :: converged_ - converged_ = .not. integrateThermalState(Delta_t,ph,en) + converged_ = integrateThermalState(Delta_t,ph,en) end function phase_thermal_constitutive !-------------------------------------------------------------------------------------------------- -!> @brief integrate state with 1st order explicit Euler method +!> @brief Integrate state with 1st order explicit Euler method. !-------------------------------------------------------------------------------------------------- -function integrateThermalState(Delta_t, ph,en) result(broken) +function integrateThermalState(Delta_t, ph,en) result(converged) real(pREAL), intent(in) :: Delta_t integer, intent(in) :: ph, en - logical :: & - broken + logical :: converged integer :: & so, & sizeDotState - broken = phase_thermal_collectDotState(ph,en) - if (broken) return + converged = phase_thermal_collectDotState(ph,en) + if (converged) then - do so = 1, thermal_Nsources(ph) - sizeDotState = thermalState(ph)%p(so)%sizeDotState - thermalState(ph)%p(so)%state(1:sizeDotState,en) = thermalState(ph)%p(so)%state0(1:sizeDotState,en) & - + thermalState(ph)%p(so)%dotState(1:sizeDotState,en) * Delta_t - end do + do so = 1, thermal_Nsources(ph) + sizeDotState = thermalState(ph)%p(so)%sizeDotState + thermalState(ph)%p(so)%state(1:sizeDotState,en) = thermalState(ph)%p(so)%state0(1:sizeDotState,en) & + + thermalState(ph)%p(so)%dotState(1:sizeDotState,en) * Delta_t + end do + + end if end function integrateThermalState @@ -318,7 +319,7 @@ end subroutine thermal_forward !---------------------------------------------------------------------------------------------- -!< @brief Get temperature (for use by non-thermal physics) +!< @brief Get temperature (for use by non-thermal physics). !---------------------------------------------------------------------------------------------- pure module function thermal_T(ph,en) result(T) @@ -332,7 +333,7 @@ end function thermal_T !---------------------------------------------------------------------------------------------- -!< @brief Get rate of temperature (for use by non-thermal physics) +!< @brief Get rate of temperature (for use by non-thermal physics). !---------------------------------------------------------------------------------------------- module function thermal_dot_T(ph,en) result(dot_T) diff --git a/src/phase_thermal_dissipation.f90 b/src/phase_thermal_source_dissipation.f90 similarity index 90% rename from src/phase_thermal_dissipation.f90 rename to src/phase_thermal_source_dissipation.f90 index 573921670..c42e4a817 100644 --- a/src/phase_thermal_dissipation.f90 +++ b/src/phase_thermal_source_dissipation.f90 @@ -5,7 +5,7 @@ !> @brief material subroutine for thermal source due to plastic dissipation !> @details to be done !-------------------------------------------------------------------------------------------------- -submodule(phase:thermal) dissipation +submodule(phase:thermal) source_dissipation type :: tParameters !< container type for internal constitutive parameters real(pREAL) :: & @@ -22,7 +22,7 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function dissipation_init(source_length) result(mySources) +module function source_dissipation_init(source_length) result(mySources) integer, intent(in) :: source_length logical, dimension(:,:), allocatable :: mySources @@ -41,7 +41,7 @@ module function dissipation_init(source_length) result(mySources) mySources = thermal_active('dissipation',source_length) if (count(mySources) == 0) return - print'(/,1x,a)', '<<<+- phase:thermal:dissipation init -+>>>' + print'(/,1x,a)', '<<<+- phase:thermal:source_dissipation init -+>>>' print'(/,a,i2)', ' # phases: ',count(mySources); flush(IO_STDOUT) @@ -71,13 +71,13 @@ module function dissipation_init(source_length) result(mySources) end do -end function dissipation_init +end function source_dissipation_init !-------------------------------------------------------------------------------------------------- !> @brief Ninstancess dissipation rate !-------------------------------------------------------------------------------------------------- -module function dissipation_f_T(ph,en) result(f_T) +module function source_dissipation_f_T(ph,en) result(f_T) integer, intent(in) :: ph, en real(pREAL) :: & @@ -91,6 +91,6 @@ module function dissipation_f_T(ph,en) result(f_T) f_T = prm%kappa*sum(abs(Mp*mechanical_L_p(ph,en))) end associate -end function dissipation_f_T +end function source_dissipation_f_T -end submodule dissipation +end submodule source_dissipation diff --git a/src/phase_thermal_externalheat.f90 b/src/phase_thermal_source_externalheat.f90 similarity index 78% rename from src/phase_thermal_externalheat.f90 rename to src/phase_thermal_source_externalheat.f90 index cdd037592..f86880e62 100644 --- a/src/phase_thermal_externalheat.f90 +++ b/src/phase_thermal_source_externalheat.f90 @@ -4,11 +4,11 @@ !> @author Philip Eisenlohr, Michigan State University !> @brief material subroutine for variable heat source !-------------------------------------------------------------------------------------------------- -submodule(phase:thermal) externalheat +submodule(phase:thermal) source_externalheat integer, dimension(:), allocatable :: & - source_thermal_externalheat_offset !< which source is my current thermal dissipation mechanism? + source_ID !< which source is my current thermal dissipation mechanism? type :: tParameters !< container type for internal constitutive parameters type(tTable) :: f @@ -24,7 +24,7 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function externalheat_init(source_length) result(mySources) +module function source_externalheat_init(source_length) result(mySources) integer, intent(in) :: source_length logical, dimension(:,:), allocatable :: mySources @@ -43,13 +43,13 @@ module function externalheat_init(source_length) result(mySources) mySources = thermal_active('externalheat',source_length) if (count(mySources) == 0) return - print'(/,1x,a)', '<<<+- phase:thermal:externalheat init -+>>>' + print'(/,1x,a)', '<<<+- phase:thermal:source_externalheat init -+>>>' print'(/,a,i2)', ' # phases: ',count(mySources); flush(IO_STDOUT) phases => config_material%get_dict('phase') allocate(param(phases%length)) - allocate(source_thermal_externalheat_offset (phases%length), source=0) + allocate(source_ID(phases%length), source=0) do ph = 1, phases%length phase => phases%get_dict(ph) @@ -58,7 +58,7 @@ module function externalheat_init(source_length) result(mySources) sources => thermal%get_list('source') do so = 1, sources%length if (mySources(so,ph)) then - source_thermal_externalheat_offset(ph) = so + source_ID(ph) = so associate(prm => param(ph)) src => sources%get_dict(so) print'(1x,a,i0,a,i0)', 'phase ',ph,' source ',so @@ -74,33 +74,29 @@ module function externalheat_init(source_length) result(mySources) end do end do -end function externalheat_init +end function source_externalheat_init !-------------------------------------------------------------------------------------------------- !> @brief rate of change of state !> @details state only contains current time to linearly interpolate given heat powers !-------------------------------------------------------------------------------------------------- -module subroutine externalheat_dotState(ph, en) +module subroutine source_externalheat_dotState(ph, en) integer, intent(in) :: & ph, & en - integer :: & - so - so = source_thermal_externalheat_offset(ph) + thermalState(ph)%p(source_ID(ph))%dotState(1,en) = 1.0_pREAL ! state is current time - thermalState(ph)%p(so)%dotState(1,en) = 1.0_pREAL ! state is current time - -end subroutine externalheat_dotState +end subroutine source_externalheat_dotState !-------------------------------------------------------------------------------------------------- !> @brief returns local heat generation rate !-------------------------------------------------------------------------------------------------- -module function externalheat_f_T(ph,en) result(f_T) +module function source_externalheat_f_T(ph,en) result(f_T) integer, intent(in) :: & ph, & @@ -108,16 +104,11 @@ module function externalheat_f_T(ph,en) result(f_T) real(pREAL) :: & f_T - integer :: & - so - - - so = source_thermal_externalheat_offset(ph) associate(prm => param(ph)) - f_T = prm%f%at(thermalState(ph)%p(so)%state(1,en)) + f_T = prm%f%at(thermalState(ph)%p(source_ID(ph))%state(1,en)) end associate -end function externalheat_f_T +end function source_externalheat_f_T -end submodule externalheat +end submodule source_externalheat From 2ae1f1f829c96e0a418dd58f107e6370b4af9e36 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 18 Jul 2023 04:42:14 +0200 Subject: [PATCH 050/198] simplified --- src/Marc/DAMASK_Marc.f90 | 1 - src/phase_damage.f90 | 6 ++-- src/phase_mechanical_eigen.f90 | 6 ++-- ...phase_mechanical_eigen_cleavageopening.f90 | 30 ------------------- 4 files changed, 6 insertions(+), 37 deletions(-) delete mode 100644 src/phase_mechanical_eigen_cleavageopening.f90 diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index b1d9d91ba..69ee7091c 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -173,7 +173,6 @@ end module DAMASK_interface #include "../phase_mechanical_plastic_dislotungsten.f90" #include "../phase_mechanical_plastic_nonlocal.f90" #include "../phase_mechanical_eigen.f90" -#include "../phase_mechanical_eigen_cleavageopening.f90" #include "../phase_mechanical_eigen_thermalexpansion.f90" #include "../phase_thermal.f90" #include "../phase_thermal_source_dissipation.f90" diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 729309b82..f3afaec99 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -18,14 +18,14 @@ submodule(phase) damage integer :: phase_damage_maxSizeDotState - type :: tDataContainer + type :: tFieldQuantities real(pREAL), dimension(:), allocatable :: phi - end type tDataContainer + end type tFieldQuantities integer(kind(DAMAGE_UNDEFINED_ID)), dimension(:), allocatable :: & phase_damage !< active sources mechanisms of each phase - type(tDataContainer), dimension(:), allocatable :: current + type(tFieldQuantities), dimension(:), allocatable :: current type(tDamageParameters), dimension(:), allocatable :: param diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index ec1bcfbbc..7b965bf23 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -68,7 +68,7 @@ module subroutine eigen_init(phases) allocate(model_damage(phases%length), source = EIGEN_UNDEFINED_ID) - where(damage_anisobrittle_init()) model_damage = EIGEN_cleavage_opening_ID + where(kinematics_active2('anisobrittle')) model_damage = EIGEN_cleavage_opening_ID end subroutine eigen_init @@ -191,13 +191,13 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & end select kinematicsType end do KinematicsLoop - select case (model_damage(ph)) + damageType: select case (model_damage(ph)) case (EIGEN_cleavage_opening_ID) call damage_anisobrittle_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, en) Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS active = .true. - end select + end select damageType if (.not. active) return diff --git a/src/phase_mechanical_eigen_cleavageopening.f90 b/src/phase_mechanical_eigen_cleavageopening.f90 deleted file mode 100644 index 780ed22b2..000000000 --- a/src/phase_mechanical_eigen_cleavageopening.f90 +++ /dev/null @@ -1,30 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Luv Sharma, Max-Planck-Institut für Eisenforschung GmbH -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine incorporating kinematics resulting from opening of cleavage planes -!> @details to be done -!-------------------------------------------------------------------------------------------------- -submodule(phase:eigen) cleavageopening - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -module function damage_anisobrittle_init() result(myKinematics) - - logical, dimension(:), allocatable :: myKinematics - - - myKinematics = kinematics_active2('anisobrittle') - if (count(myKinematics) == 0) return - - print'(/,1x,a)', '<<<+- phase:mechanical:eigen:cleavageopening init -+>>>' - print'(/,a,i2)', ' # phases: ',count(myKinematics); flush(IO_STDOUT) - -end function damage_anisobrittle_init - - -end submodule cleavageopening From 26014aec1f50c88c486a4b90ef051e718f2d74f4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 18 Jul 2023 04:51:16 +0200 Subject: [PATCH 051/198] 'true' kinematics first --- src/phase_mechanical_eigen.f90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 7b965bf23..dc2d3d598 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -173,14 +173,6 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & dLi_dFi = 0.0_pREAL - plasticType: select case (phase_plasticity(ph)) - case (PLASTIC_isotropic_ID) plasticType - call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,ph,en) - Li = Li + my_Li - dLi_dS = dLi_dS + my_dLi_dS - active = .true. - end select plasticType - KinematicsLoop: do k = 1, Nmodels(ph) kinematicsType: select case (model(k,ph)) case (EIGEN_thermal_expansion_ID) kinematicsType @@ -191,6 +183,14 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & end select kinematicsType end do KinematicsLoop + plasticType: select case (phase_plasticity(ph)) + case (PLASTIC_isotropic_ID) plasticType + call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,ph,en) + Li = Li + my_Li + dLi_dS = dLi_dS + my_dLi_dS + active = .true. + end select plasticType + damageType: select case (model_damage(ph)) case (EIGEN_cleavage_opening_ID) call damage_anisobrittle_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, en) From dc9d4bb5a9d26fea87353609812ae86d8a8a8e11 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 18 Jul 2023 05:28:44 +0200 Subject: [PATCH 052/198] centralized ID handling to enable cross-talking --- src/phase.f90 | 22 ++++++++ src/phase_damage.f90 | 47 +++++++--------- src/phase_mechanical.f90 | 34 +++--------- src/phase_mechanical_eigen.f90 | 26 +++------ src/phase_mechanical_elastic.f90 | 4 +- src/phase_mechanical_plastic.f90 | 68 +++++++++++------------ src/phase_mechanical_plastic_nonlocal.f90 | 4 +- src/phase_thermal.f90 | 22 +++----- 8 files changed, 102 insertions(+), 125 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index f889a854f..c82cc9692 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -49,6 +49,28 @@ module phase type(tState), dimension(:), allocatable :: p !< tState for each active source mechanism in a phase end type + enum, bind(c); enumerator :: & + UNDEFINED, & + MECHANICAL_PLASTICITY_NONE, & + MECHANICAL_PLASTICITY_ISOTROPIC, & + MECHANICAL_PLASTICITY_PHENOPOWERLAW, & + MECHANICAL_PLASTICITY_KINEHARDENING, & + MECHANICAL_PLASTICITY_DISLOTWIN, & + MECHANICAL_PLASTICITY_DISLOTUNGSTEN, & + MECHANICAL_PLASTICITY_NONLOCAL, & + MECHANICAL_EIGEN_THERMALEXPANSION, & + DAMAGE_ISOBRITTLE, & + DAMAGE_ANISOBRITTLE, & + THERMAL_SOURCE_DISSIPATION, & + THERMAL_SOURCE_EXTERNALHEAT + end enum + + + integer(kind(UNDEFINED)), dimension(:), allocatable :: & + mechanical_plasticity_type, & !< plasticity of each phase + damage_type !< active sources mechanisms of each phase + integer(kind(UNDEFINED)), dimension(:,:), allocatable :: & + thermal_source_type character(len=2), allocatable, dimension(:) :: phase_lattice real(pREAL), allocatable, dimension(:) :: phase_cOverA diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index f3afaec99..44c52bc80 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -9,21 +9,12 @@ submodule(phase) damage l_c = 0.0_pREAL !< characteristic length end type tDamageParameters - enum, bind(c); enumerator :: & - DAMAGE_UNDEFINED_ID, & - DAMAGE_ISOBRITTLE_ID, & - DAMAGE_ANISOBRITTLE_ID - end enum - integer :: phase_damage_maxSizeDotState - type :: tFieldQuantities real(pREAL), dimension(:), allocatable :: phi end type tFieldQuantities - integer(kind(DAMAGE_UNDEFINED_ID)), dimension(:), allocatable :: & - phase_damage !< active sources mechanisms of each phase type(tFieldQuantities), dimension(:), allocatable :: current @@ -114,11 +105,11 @@ module subroutine damage_init() end do - allocate(phase_damage(phases%length), source = DAMAGE_UNDEFINED_ID) + allocate(damage_type(phases%length), source = UNDEFINED) if (damage_active) then - where(isobrittle_init() ) phase_damage = DAMAGE_ISOBRITTLE_ID - where(anisobrittle_init()) phase_damage = DAMAGE_ANISOBRITTLE_ID + where(isobrittle_init() ) damage_type = DAMAGE_ISOBRITTLE + where(anisobrittle_init()) damage_type = DAMAGE_ANISOBRITTLE end if phase_damage_maxSizeDotState = maxval(damageState%sizeDotState) @@ -159,8 +150,8 @@ module function phase_damage_C66(C66,ph,en) result(C66_degraded) real(pREAL), dimension(6,6) :: C66_degraded - damageType: select case (phase_damage(ph)) - case (DAMAGE_ISOBRITTLE_ID) damageType + damageType: select case (damage_type(ph)) + case (DAMAGE_ISOBRITTLE) damageType C66_degraded = C66 * damage_phi(ph,en)**2 case default damageType C66_degraded = C66 @@ -207,8 +198,8 @@ module function phase_f_phi(phi,co,ce) result(f) ph = material_ID_phase(co,ce) en = material_entry_phase(co,ce) - select case(phase_damage(ph)) - case(DAMAGE_ISOBRITTLE_ID,DAMAGE_ANISOBRITTLE_ID) + select case(damage_type(ph)) + case(DAMAGE_ISOBRITTLE,DAMAGE_ANISOBRITTLE) f = 1.0_pREAL & - 2.0_pREAL * phi*damageState(ph)%state(1,en) case default @@ -318,8 +309,8 @@ module subroutine damage_restartWrite(groupHandle,ph) integer, intent(in) :: ph - select case(phase_damage(ph)) - case(DAMAGE_ISOBRITTLE_ID,DAMAGE_ANISOBRITTLE_ID) + select case(damage_type(ph)) + case(DAMAGE_ISOBRITTLE,DAMAGE_ANISOBRITTLE) call HDF5_write(damageState(ph)%state,groupHandle,'omega_damage') end select @@ -332,8 +323,8 @@ module subroutine damage_restartRead(groupHandle,ph) integer, intent(in) :: ph - select case(phase_damage(ph)) - case(DAMAGE_ISOBRITTLE_ID,DAMAGE_ANISOBRITTLE_ID) + select case(damage_type(ph)) + case(DAMAGE_ISOBRITTLE,DAMAGE_ANISOBRITTLE) call HDF5_read(damageState(ph)%state0,groupHandle,'omega_damage') end select @@ -350,15 +341,15 @@ module subroutine damage_result(group,ph) integer, intent(in) :: ph - if (phase_damage(ph) /= DAMAGE_UNDEFINED_ID) & + if (damage_type(ph) /= UNDEFINED) & call result_closeGroup(result_addGroup(group//'damage')) - sourceType: select case (phase_damage(ph)) + sourceType: select case (damage_type(ph)) - case (DAMAGE_ISOBRITTLE_ID) sourceType + case (DAMAGE_ISOBRITTLE) sourceType call isobrittle_result(ph,group//'damage/') - case (DAMAGE_ANISOBRITTLE_ID) sourceType + case (DAMAGE_ANISOBRITTLE) sourceType call anisobrittle_result(ph,group//'damage/') end select sourceType @@ -381,9 +372,9 @@ function phase_damage_collectDotState(ph,en) result(broken) if (damageState(ph)%sizeState > 0) then - sourceType: select case (phase_damage(ph)) + sourceType: select case (damage_type(ph)) - case (DAMAGE_ANISOBRITTLE_ID) sourceType + case (DAMAGE_ANISOBRITTLE) sourceType call anisobrittle_dotState(mechanical_S(ph,en), ph,en) ! ToDo: use M_d end select sourceType @@ -446,9 +437,9 @@ function phase_damage_deltaState(Fe, ph, en) result(broken) if (damageState(ph)%sizeState == 0) return - sourceType: select case (phase_damage(ph)) + sourceType: select case (damage_type(ph)) - case (DAMAGE_ISOBRITTLE_ID) sourceType + case (DAMAGE_ISOBRITTLE) sourceType call isobrittle_deltaState(phase_homogenizedC66(ph,en), Fe, ph,en) broken = any(IEEE_is_NaN(damageState(ph)%deltaState(:,en))) if (.not. broken) then diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 0f931517a..2ec8956aa 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -3,21 +3,6 @@ !---------------------------------------------------------------------------------------------------- submodule(phase) mechanical - - enum, bind(c); enumerator :: & - PLASTIC_UNDEFINED_ID, & - PLASTIC_NONE_ID, & - PLASTIC_ISOTROPIC_ID, & - PLASTIC_PHENOPOWERLAW_ID, & - PLASTIC_KINEHARDENING_ID, & - PLASTIC_DISLOTWIN_ID, & - PLASTIC_DISLOTUNGSTEN_ID, & - PLASTIC_NONLOCAL_ID, & - EIGEN_UNDEFINED_ID, & - EIGEN_CLEAVAGE_OPENING_ID, & - EIGEN_THERMAL_EXPANSION_ID - end enum - type(tTensorContainer), dimension(:), allocatable :: & ! current value phase_mechanical_Fe, & @@ -37,9 +22,6 @@ submodule(phase) mechanical phase_mechanical_S0 - integer(kind(PLASTIC_undefined_ID)), dimension(:), allocatable :: & - phase_plasticity !< plasticity of each phase - interface module subroutine eigen_init(phases) @@ -283,7 +265,7 @@ module subroutine mechanical_init(phases) call elastic_init(phases) allocate(plasticState(phases%length)) - allocate(phase_plasticity(phases%length),source = PLASTIC_UNDEFINED_ID) + allocate(mechanical_plasticity_type(phases%length),source = UNDEFINED) call plastic_init() do ph = 1,phases%length plasticState(ph)%state0 = plasticState(ph)%state @@ -327,24 +309,24 @@ module subroutine mechanical_result(group,ph) call results(group,ph) - select case(phase_plasticity(ph)) + select case(mechanical_plasticity_type(ph)) - case(PLASTIC_ISOTROPIC_ID) + case(MECHANICAL_PLASTICITY_ISOTROPIC) call plastic_isotropic_result(ph,group//'mechanical/') - case(PLASTIC_PHENOPOWERLAW_ID) + case(MECHANICAL_PLASTICITY_PHENOPOWERLAW) call plastic_phenopowerlaw_result(ph,group//'mechanical/') - case(PLASTIC_KINEHARDENING_ID) + case(MECHANICAL_PLASTICITY_KINEHARDENING) call plastic_kinehardening_result(ph,group//'mechanical/') - case(PLASTIC_DISLOTWIN_ID) + case(MECHANICAL_PLASTICITY_DISLOTWIN) call plastic_dislotwin_result(ph,group//'mechanical/') - case(PLASTIC_DISLOTUNGSTEN_ID) + case(MECHANICAL_PLASTICITY_DISLOTUNGSTEN) call plastic_dislotungsten_result(ph,group//'mechanical/') - case(PLASTIC_NONLOCAL_ID) + case(MECHANICAL_PLASTICITY_NONLOCAL) call plastic_nonlocal_result(ph,group//'mechanical/') end select diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index dc2d3d598..4d5771cca 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -3,15 +3,10 @@ submodule(phase:mechanical) eigen integer, dimension(:), allocatable :: & Nmodels - integer(kind(EIGEN_UNDEFINED_ID)), dimension(:,:), allocatable :: & + integer(kind(UNDEFINED)), dimension(:,:), allocatable :: & model - integer(kind(EIGEN_UNDEFINED_ID)), dimension(:), allocatable :: & - model_damage interface - module function damage_anisobrittle_init() result(myKinematics) - logical, dimension(:), allocatable :: myKinematics - end function damage_anisobrittle_init module function thermalexpansion_init(kinematics_length) result(myKinematics) integer, intent(in) :: kinematics_length @@ -60,17 +55,12 @@ module subroutine eigen_init(phases) Nmodels(ph) = kinematics%length end do - allocate(model(maxval(Nmodels),phases%length), source = EIGEN_undefined_ID) + allocate(model(maxval(Nmodels),phases%length), source = UNDEFINED) if (maxval(Nmodels) /= 0) then - where(thermalexpansion_init(maxval(Nmodels))) model = EIGEN_thermal_expansion_ID + where(thermalexpansion_init(maxval(Nmodels))) model = MECHANICAL_EIGEN_THERMALEXPANSION end if - allocate(model_damage(phases%length), source = EIGEN_UNDEFINED_ID) - - where(kinematics_active2('anisobrittle')) model_damage = EIGEN_cleavage_opening_ID - - end subroutine eigen_init @@ -175,7 +165,7 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & KinematicsLoop: do k = 1, Nmodels(ph) kinematicsType: select case (model(k,ph)) - case (EIGEN_thermal_expansion_ID) kinematicsType + case (MECHANICAL_EIGEN_THERMALEXPANSION) kinematicsType call thermalexpansion_LiAndItsTangent(my_Li, my_dLi_dS, ph,en) Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS @@ -183,16 +173,16 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & end select kinematicsType end do KinematicsLoop - plasticType: select case (phase_plasticity(ph)) - case (PLASTIC_isotropic_ID) plasticType + plasticType: select case (mechanical_plasticity_type(ph)) + case (MECHANICAL_PLASTICITY_ISOTROPIC) plasticType call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,ph,en) Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS active = .true. end select plasticType - damageType: select case (model_damage(ph)) - case (EIGEN_cleavage_opening_ID) + damageType: select case (damage_type(ph)) + case (DAMAGE_ANISOBRITTLE) call damage_anisobrittle_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, en) Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index 75a8753a5..08055af98 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -199,8 +199,8 @@ module function phase_homogenizedC66(ph,en) result(C) integer, intent(in) :: ph, en - plasticType: select case (phase_plasticity(ph)) - case (PLASTIC_DISLOTWIN_ID) plasticType + plasticType: select case (mechanical_plasticity_type(ph)) + case (MECHANICAL_PLASTICITY_DISLOTWIN) plasticType C = plastic_dislotwin_homogenizedC(ph,en) case default plasticType C = elastic_C66(ph,en) diff --git a/src/phase_mechanical_plastic.f90 b/src/phase_mechanical_plastic.f90 index 0c1959660..5d1a462e7 100644 --- a/src/phase_mechanical_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -211,17 +211,17 @@ contains module subroutine plastic_init - print'(/,1x,a)', '<<<+- phase:mechanical:plastic init -+>>>' + print'(/,1x,a)', '<<<+- phase:mechanical:plasticity init -+>>>' - where(plastic_none_init()) phase_plasticity = PLASTIC_NONE_ID - where(plastic_isotropic_init()) phase_plasticity = PLASTIC_ISOTROPIC_ID - where(plastic_phenopowerlaw_init()) phase_plasticity = PLASTIC_PHENOPOWERLAW_ID - where(plastic_kinehardening_init()) phase_plasticity = PLASTIC_KINEHARDENING_ID - where(plastic_dislotwin_init()) phase_plasticity = PLASTIC_DISLOTWIN_ID - where(plastic_dislotungsten_init()) phase_plasticity = PLASTIC_DISLOTUNGSTEN_ID - where(plastic_nonlocal_init()) phase_plasticity = PLASTIC_NONLOCAL_ID + where(plastic_none_init()) mechanical_plasticity_type = MECHANICAL_PLASTICITY_NONE + where(plastic_isotropic_init()) mechanical_plasticity_type = MECHANICAL_PLASTICITY_ISOTROPIC + where(plastic_phenopowerlaw_init()) mechanical_plasticity_type = MECHANICAL_PLASTICITY_PHENOPOWERLAW + where(plastic_kinehardening_init()) mechanical_plasticity_type = MECHANICAL_PLASTICITY_KINEHARDENING + where(plastic_dislotwin_init()) mechanical_plasticity_type = MECHANICAL_PLASTICITY_DISLOTWIN + where(plastic_dislotungsten_init()) mechanical_plasticity_type = MECHANICAL_PLASTICITY_DISLOTUNGSTEN + where(plastic_nonlocal_init()) mechanical_plasticity_type = MECHANICAL_PLASTICITY_NONLOCAL - if (any(phase_plasticity == PLASTIC_undefined_ID)) call IO_error(201) + if (any(mechanical_plasticity_type == UNDEFINED)) call IO_error(201) end subroutine plastic_init @@ -251,7 +251,7 @@ module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & i, j - if (phase_plasticity(ph) == PLASTIC_NONE_ID) then + if (mechanical_plasticity_type(ph) == MECHANICAL_PLASTICITY_NONE) then Lp = 0.0_pREAL dLp_dFi = 0.0_pREAL dLp_dS = 0.0_pREAL @@ -259,24 +259,24 @@ module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & Mp = matmul(matmul(transpose(Fi),Fi),S) - plasticType: select case (phase_plasticity(ph)) + plasticType: select case (mechanical_plasticity_type(ph)) - case (PLASTIC_ISOTROPIC_ID) plasticType + case (MECHANICAL_PLASTICITY_ISOTROPIC) plasticType call isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) - case (PLASTIC_PHENOPOWERLAW_ID) plasticType + case (MECHANICAL_PLASTICITY_PHENOPOWERLAW) plasticType call phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) - case (PLASTIC_KINEHARDENING_ID) plasticType + case (MECHANICAL_PLASTICITY_KINEHARDENING) plasticType call kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) - case (PLASTIC_NONLOCAL_ID) plasticType + case (MECHANICAL_PLASTICITY_NONLOCAL) plasticType call nonlocal_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) - case (PLASTIC_DISLOTWIN_ID) plasticType + case (MECHANICAL_PLASTICITY_DISLOTWIN) plasticType call dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) - case (PLASTIC_DISLOTUNGSTEN_ID) plasticType + case (MECHANICAL_PLASTICITY_DISLOTUNGSTEN) plasticType call dislotungsten_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) end select plasticType @@ -308,28 +308,28 @@ module function plastic_dotState(subdt,ph,en) result(dotState) dotState - if (phase_plasticity(ph) /= PLASTIC_NONE_ID) then + if (mechanical_plasticity_type(ph) /= MECHANICAL_PLASTICITY_NONE) then Mp = matmul(matmul(transpose(phase_mechanical_Fi(ph)%data(1:3,1:3,en)),& phase_mechanical_Fi(ph)%data(1:3,1:3,en)),phase_mechanical_S(ph)%data(1:3,1:3,en)) - plasticType: select case (phase_plasticity(ph)) + plasticType: select case (mechanical_plasticity_type(ph)) - case (PLASTIC_ISOTROPIC_ID) plasticType + case (MECHANICAL_PLASTICITY_ISOTROPIC) plasticType dotState = isotropic_dotState(Mp,ph,en) - case (PLASTIC_PHENOPOWERLAW_ID) plasticType + case (MECHANICAL_PLASTICITY_PHENOPOWERLAW) plasticType dotState = phenopowerlaw_dotState(Mp,ph,en) - case (PLASTIC_KINEHARDENING_ID) plasticType + case (MECHANICAL_PLASTICITY_KINEHARDENING) plasticType dotState = plastic_kinehardening_dotState(Mp,ph,en) - case (PLASTIC_DISLOTWIN_ID) plasticType + case (MECHANICAL_PLASTICITY_DISLOTWIN) plasticType dotState = dislotwin_dotState(Mp,ph,en) - case (PLASTIC_DISLOTUNGSTEN_ID) plasticType + case (MECHANICAL_PLASTICITY_DISLOTUNGSTEN) plasticType dotState = dislotungsten_dotState(Mp,ph,en) - case (PLASTIC_NONLOCAL_ID) plasticType + case (MECHANICAL_PLASTICITY_NONLOCAL) plasticType call nonlocal_dotState(Mp,subdt,ph,en) dotState = plasticState(ph)%dotState(:,en) @@ -349,15 +349,15 @@ module subroutine plastic_dependentState(ph,en) en - plasticType: select case (phase_plasticity(ph)) + plasticType: select case (mechanical_plasticity_type(ph)) - case (PLASTIC_DISLOTWIN_ID) plasticType + case (MECHANICAL_PLASTICITY_DISLOTWIN) plasticType call dislotwin_dependentState(ph,en) - case (PLASTIC_DISLOTUNGSTEN_ID) plasticType + case (MECHANICAL_PLASTICITY_DISLOTUNGSTEN) plasticType call dislotungsten_dependentState(ph,en) - case (PLASTIC_NONLOCAL_ID) plasticType + case (MECHANICAL_PLASTICITY_NONLOCAL) plasticType call nonlocal_dependentState(ph,en) end select plasticType @@ -384,19 +384,19 @@ module function plastic_deltaState(ph, en) result(broken) broken = .false. - select case (phase_plasticity(ph)) - case (PLASTIC_NONLOCAL_ID,PLASTIC_KINEHARDENING_ID) + select case (mechanical_plasticity_type(ph)) + case (MECHANICAL_PLASTICITY_NONLOCAL,MECHANICAL_PLASTICITY_KINEHARDENING) Mp = matmul(matmul(transpose(phase_mechanical_Fi(ph)%data(1:3,1:3,en)),& phase_mechanical_Fi(ph)%data(1:3,1:3,en)),& phase_mechanical_S(ph)%data(1:3,1:3,en)) - plasticType: select case (phase_plasticity(ph)) + plasticType: select case (mechanical_plasticity_type(ph)) - case (PLASTIC_KINEHARDENING_ID) plasticType + case (MECHANICAL_PLASTICITY_KINEHARDENING) plasticType call plastic_kinehardening_deltaState(Mp,ph,en) - case (PLASTIC_NONLOCAL_ID) plasticType + case (MECHANICAL_PLASTICITY_NONLOCAL) plasticType call plastic_nonlocal_deltaState(Mp,ph,en) end select plasticType diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 4e45066b5..272755936 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -1252,7 +1252,7 @@ function rhoDotFlux(timestep,ph,en) !* The entering flux from my neighbor will be distributed on my slip systems according to the !* compatibility if (neighbor_n > 0) then - if (phase_plasticity(np) == PLASTIC_NONLOCAL_ID .and. & + if (mechanical_plasticity_type(np) == MECHANICAL_PLASTICITY_NONLOCAL .and. & any(dependentState(ph)%compatibility(:,:,:,n,en) > 0.0_pREAL)) then forall (s = 1:ns, t = 1:4) @@ -1298,7 +1298,7 @@ function rhoDotFlux(timestep,ph,en) !* In case of reduced transmissivity, part of the leaving flux is stored as dead dislocation density. !* That means for an interface of zero transmissivity the leaving flux is fully converted to dead dislocations. if (opposite_n > 0) then - if (phase_plasticity(np) == PLASTIC_NONLOCAL_ID) then + if (mechanical_plasticity_type(np) == MECHANICAL_PLASTICITY_NONLOCAL) then normal_me2neighbor_defConf = math_det33(Favg) & * matmul(math_inv33(transpose(Favg)),geom(ph)%IPareaNormal(1:3,n,en)) ! normal of the interface in (average) deformed configuration (pointing en => neighbor) diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index 8f59dc874..20b8560ac 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -15,17 +15,9 @@ submodule(phase) thermal type(tSourceState), allocatable, dimension(:) :: & thermalState - enum, bind(c); enumerator :: & - THERMAL_UNDEFINED_ID ,& - THERMAL_DISSIPATION_ID, & - THERMAL_EXTERNALHEAT_ID - end enum - type :: tFieldQuantities real(pREAL), dimension(:), allocatable :: T, dot_T end type tFieldQuantities - integer(kind(THERMAL_UNDEFINED_ID)), dimension(:,:), allocatable :: & - thermal_source type(tFieldQuantities), dimension(:), allocatable :: current @@ -129,11 +121,11 @@ module subroutine thermal_init(phases) end do - allocate(thermal_source(maxval(thermal_Nsources),phases%length), source = THERMAL_UNDEFINED_ID) + allocate(thermal_source_type(maxval(thermal_Nsources),phases%length), source = UNDEFINED) if (maxval(thermal_Nsources) /= 0) then - where(source_dissipation_init (maxval(thermal_Nsources))) thermal_source = THERMAL_DISSIPATION_ID - where(source_externalheat_init(maxval(thermal_Nsources))) thermal_source = THERMAL_EXTERNALHEAT_ID + where(source_dissipation_init (maxval(thermal_Nsources))) thermal_source_type = THERMAL_SOURCE_DISSIPATION + where(source_externalheat_init(maxval(thermal_Nsources))) thermal_source_type = THERMAL_SOURCE_EXTERNALHEAT end if thermal_source_maxSizeDotState = 0 @@ -165,12 +157,12 @@ module function phase_f_T(ph,en) result(f) f = 0.0_pREAL do so = 1, thermal_Nsources(ph) - select case(thermal_source(so,ph)) + select case(thermal_source_type(so,ph)) - case (THERMAL_DISSIPATION_ID) + case (THERMAL_SOURCE_DISSIPATION) f = f + source_dissipation_f_T(ph,en) - case (THERMAL_EXTERNALHEAT_ID) + case (THERMAL_SOURCE_EXTERNALHEAT) f = f + source_externalheat_f_T(ph,en) end select @@ -195,7 +187,7 @@ function phase_thermal_collectDotState(ph,en) result(ok) SourceLoop: do i = 1, thermal_Nsources(ph) - if (thermal_source(i,ph) == THERMAL_EXTERNALHEAT_ID) & + if (thermal_source_type(i,ph) == THERMAL_SOURCE_EXTERNALHEAT) & call source_externalheat_dotState(ph,en) ok = ok .and. .not. any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,en))) From 5b56b13c64ca3e4cbe2578fdc43edb328304c930 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 Jul 2023 02:30:07 +0200 Subject: [PATCH 053/198] report information on staggered iterations --- src/grid/DAMASK_grid.f90 | 10 ++++++---- src/grid/grid_damage_spectral.f90 | 3 --- src/grid/grid_thermal_spectral.f90 | 3 --- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index d52a6f211..9dcae70a1 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -341,7 +341,7 @@ program DAMASK_grid if (worldrank == 0) then writeHeader: if (CLI_restartInc < 1) then open(newunit=statUnit,file=trim(getSolverJobName())//'.sta',form='FORMATTED',status='REPLACE') - write(statUnit,'(a)') 'Increment Time CutbackLevel Converged IterationsNeeded' ! statistics file + write(statUnit,'(a)') 'Increment Time CutbackLevel Converged IterationsNeeded StagIterationsNeeded' ! statistics file else writeHeader open(newunit=statUnit,file=trim(getSolverJobName())//& '.sta',form='FORMATTED', position='APPEND', status='OLD') @@ -415,9 +415,11 @@ program DAMASK_grid !-------------------------------------------------------------------------------------------------- ! solve fields - stagIter = 0 + stagIter = 1 stagIterate = .true. do while (stagIterate) + + if (nActiveFields > 1) print'(/,1x,a,i0)', 'Staggered Iteration ',stagIter do field = 1, nActiveFields select case(ID(field)) case(FIELD_MECH_ID) @@ -432,7 +434,7 @@ program DAMASK_grid end do stagIter = stagIter + 1 - stagIterate = stagIter < stagItMax & + stagIterate = stagIter <= stagItMax & .and. all(solres(:)%converged) & .and. .not. all(solres(:)%stagConverged) ! stationary with respect to staggered iteration end do @@ -448,7 +450,7 @@ program DAMASK_grid guess = .true. ! start guessing after first converged (sub)inc if (worldrank == 0) then write(statUnit,*) totalIncsCounter, t, cutBackLevel, & - solres(1)%converged, solres(1)%iterationsNeeded + solres(1)%converged, solres(1)%iterationsNeeded, StagIter flush(statUnit) end if elseif (cutBackLevel < maxCutBack) then ! further cutbacking tolerated? diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 27295b76f..31aec3912 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -92,7 +92,6 @@ subroutine grid_damage_spectral_init(num_grid) petsc_options - print'(/,1x,a)', '<<<+- grid_spectral_damage init -+>>>' print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019' @@ -227,8 +226,6 @@ function grid_damage_spectral_solution(Delta_t) result(solution) SNESConvergedReason :: reason - solution%converged = .false. - !-------------------------------------------------------------------------------------------------- ! set module wide availabe data params%Delta_t = Delta_t diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index f6b5c19a0..a03af881b 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -88,7 +88,6 @@ subroutine grid_thermal_spectral_init(num_grid) petsc_options - print'(/,1x,a)', '<<<+- grid_thermal_spectral init -+>>>' print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019' @@ -204,8 +203,6 @@ function grid_thermal_spectral_solution(Delta_t) result(solution) SNESConvergedReason :: reason - solution%converged = .false. - !-------------------------------------------------------------------------------------------------- ! set module wide availabe data params%Delta_t = Delta_t From ef5fe61ff65a0d9cfe0c30158268ff8fb8af3dcf Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 Jul 2023 02:58:08 +0200 Subject: [PATCH 054/198] limit scope length --- src/grid/DAMASK_grid.f90 | 241 ++++++++++++++++++++------------------- 1 file changed, 125 insertions(+), 116 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 9dcae70a1..3cf378d7c 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -75,7 +75,7 @@ program DAMASK_grid cutBack = .false.,& sig integer :: & - i, j, m, field, & + i, j, field, & errorID = 0, & cutBackLevel = 0, & !< cut back level \f$ t = \frac{t_{inc}}{2^l} \f$ stepFraction = 0, & !< fraction of current time interval @@ -110,15 +110,8 @@ program DAMASK_grid load, & num_solver, & num_grid, & - load_step, & - solver, & - step_bc, & - step_mech, & - step_discretization + solver type(tList), pointer :: & -#ifdef __INTEL_LLVM_COMPILER - tensor, & -#endif load_steps character(len=:), allocatable :: & fileContent, fname @@ -210,113 +203,6 @@ program DAMASK_grid ID(field) = FIELD_DAMAGE_ID end if damageActive - -!-------------------------------------------------------------------------------------------------- - load_steps => load%get_list('loadstep') - allocate(loadCases(load_steps%length)) ! array of load cases - - do l = 1, load_steps%length - - load_step => load_steps%get_dict(l) - step_bc => load_step%get_dict('boundary_conditions') - step_mech => step_bc%get_dict('mechanical') - loadCases(l)%stress%myType='' - readMech: do m = 1, step_mech%length - select case (step_mech%key(m)) - case ('L','dot_F','F') ! assign values for the deformation BC matrix - loadCases(l)%deformation%myType = step_mech%key(m) -#ifdef __INTEL_LLVM_COMPILER - tensor => step_mech%get_list(m) - call getMaskedTensor(loadCases(l)%deformation%values,loadCases(l)%deformation%mask,tensor) -#else - call getMaskedTensor(loadCases(l)%deformation%values,loadCases(l)%deformation%mask,step_mech%get_list(m)) -#endif - case ('dot_P','P') - loadCases(l)%stress%myType = step_mech%key(m) -#ifdef __INTEL_LLVM_COMPILER - tensor => step_mech%get_list(m) - call getMaskedTensor(loadCases(l)%stress%values,loadCases(l)%stress%mask,tensor) -#else - call getMaskedTensor(loadCases(l)%stress%values,loadCases(l)%stress%mask,step_mech%get_list(m)) -#endif - end select - call loadCases(l)%rot%fromAxisAngle(step_mech%get_as1dReal('R',defaultVal = real([0.0,0.0,1.0,0.0],pREAL)),degrees=.true.) - end do readMech - if (.not. allocated(loadCases(l)%deformation%myType)) call IO_error(error_ID=837,ext_msg = 'L/dot_F/F missing') - - step_discretization => load_step%get_dict('discretization') - loadCases(l)%t = step_discretization%get_asReal('t') - loadCases(l)%N = step_discretization%get_asInt ('N') - loadCases(l)%r = step_discretization%get_asReal('r',defaultVal= 1.0_pREAL) - - loadCases(l)%f_restart = load_step%get_asInt('f_restart', defaultVal=huge(0)) - if (load_step%get_asStr('f_out',defaultVal='n/a') == 'none') then - loadCases(l)%f_out = huge(0) - else - loadCases(l)%f_out = load_step%get_asInt('f_out', defaultVal=1) - end if - loadCases(l)%estimate_rate = (load_step%get_asBool('estimate_rate',defaultVal=.true.) .and. l>1) - - reportAndCheck: if (worldrank == 0) then - print'(/,1x,a,1x,i0)', 'load case:', l - print'(2x,a,1x,l1)', 'estimate_rate:', loadCases(l)%estimate_rate - if (loadCases(l)%deformation%myType == 'F') then - print'(2x,a)', 'F:' - else - print'(2x,a)', loadCases(l)%deformation%myType//' / 1/s:' - end if - do i = 1, 3; do j = 1, 3 - if (loadCases(l)%deformation%mask(i,j)) then - write(IO_STDOUT,'(2x,12a)',advance='no') ' x ' - else - write(IO_STDOUT,'(2x,f12.7)',advance='no') loadCases(l)%deformation%values(i,j) - end if - end do; write(IO_STDOUT,'(/)',advance='no') - end do - if (any(loadCases(l)%stress%mask .eqv. loadCases(l)%deformation%mask)) errorID = 831 - if (any(.not.(loadCases(l)%stress%mask .or. transpose(loadCases(l)%stress%mask)) .and. (math_I3<1))) & - errorID = 838 ! no rotation is allowed by stress BC - - if (loadCases(l)%stress%myType == 'P') print'(2x,a)', 'P / MPa:' - if (loadCases(l)%stress%myType == 'dot_P') print'(2x,a)', 'dot_P / MPa/s:' - - if (loadCases(l)%stress%myType /= '') then - do i = 1, 3; do j = 1, 3 - if (loadCases(l)%stress%mask(i,j)) then - write(IO_STDOUT,'(2x,12a)',advance='no') ' x ' - else - write(IO_STDOUT,'(2x,f12.4)',advance='no') loadCases(l)%stress%values(i,j)*1e-6_pREAL - end if - end do; write(IO_STDOUT,'(/)',advance='no') - end do - end if - if (any(dNeq(loadCases(l)%rot%asMatrix(), math_I3))) & - write(IO_STDOUT,'(2x,a,/,3(3(3x,f12.7,1x)/))',advance='no') 'R:',& - transpose(loadCases(l)%rot%asMatrix()) - - if (loadCases(l)%r <= 0.0_pREAL) errorID = 833 - if (loadCases(l)%t < 0.0_pREAL) errorID = 834 - if (loadCases(l)%N < 1) errorID = 835 - if (loadCases(l)%f_out < 1) errorID = 836 - if (loadCases(l)%f_restart < 1) errorID = 839 - - if (dEq(loadCases(l)%r,1.0_pREAL,1.e-9_pREAL)) then - print'(2x,a)', 'r: 1 (constant step width)' - else - print'(2x,a,1x,f0.3)', 'r:', loadCases(l)%r - end if - print'(2x,a,1x,f0.3)', 't:', loadCases(l)%t - print'(2x,a,1x,i0)', 'N:', loadCases(l)%N - if (loadCases(l)%f_out < huge(0)) & - print'(2x,a,1x,i0)', 'f_out:', loadCases(l)%f_out - if (loadCases(l)%f_restart < huge(0)) & - print'(2x,a,1x,i0)', 'f_restart:', loadCases(l)%f_restart - - if (errorID > 0) call IO_error(errorID,label1='line',ID1=l) - - end if reportAndCheck - end do - !-------------------------------------------------------------------------------------------------- ! doing initialization depending on active solvers call spectral_utilities_init() @@ -354,6 +240,8 @@ program DAMASK_grid call materialpoint_result(0,0.0_pREAL) end if writeUndeformed + loadCases = parseLoadSteps(load%get_list('loadstep')) + loadCaseLooping: do l = 1, size(loadCases) t_0 = t ! load case start time guess = loadCases(l)%estimate_rate ! change of load case? homogeneous guess for the first inc @@ -540,4 +428,125 @@ subroutine getMaskedTensor(values,mask,tensor) end subroutine getMaskedTensor + +function parseLoadsteps(load_steps) result(loadCases) + + type(tList), intent(in), target :: load_steps + type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases + + integer :: l,m + type(tDict), pointer :: & + load_step, & + step_bc, & + step_mech, & + step_discretization +#ifdef __INTEL_LLVM_COMPILER + type(tList), pointer :: & + tensor +#endif + + + allocate(loadCases(load_steps%length)) + do l = 1, load_steps%length + load_step => load_steps%get_dict(l) + step_bc => load_step%get_dict('boundary_conditions') + step_mech => step_bc%get_dict('mechanical') + loadCases(l)%stress%myType='' + readMech: do m = 1, step_mech%length + select case (step_mech%key(m)) + case ('L','dot_F','F') ! assign values for the deformation BC matrix + loadCases(l)%deformation%myType = step_mech%key(m) +#ifdef __INTEL_LLVM_COMPILER + tensor => step_mech%get_list(m) + call getMaskedTensor(loadCases(l)%deformation%values,loadCases(l)%deformation%mask,tensor) +#else + call getMaskedTensor(loadCases(l)%deformation%values,loadCases(l)%deformation%mask,step_mech%get_list(m)) +#endif + case ('dot_P','P') + loadCases(l)%stress%myType = step_mech%key(m) +#ifdef __INTEL_LLVM_COMPILER + tensor => step_mech%get_list(m) + call getMaskedTensor(loadCases(l)%stress%values,loadCases(l)%stress%mask,tensor) +#else + call getMaskedTensor(loadCases(l)%stress%values,loadCases(l)%stress%mask,step_mech%get_list(m)) +#endif + end select + call loadCases(l)%rot%fromAxisAngle(step_mech%get_as1dReal('R',defaultVal = real([0.0,0.0,1.0,0.0],pREAL)),degrees=.true.) + end do readMech + if (.not. allocated(loadCases(l)%deformation%myType)) call IO_error(error_ID=837,ext_msg = 'L/dot_F/F missing') + + step_discretization => load_step%get_dict('discretization') + loadCases(l)%t = step_discretization%get_asReal('t') + loadCases(l)%N = step_discretization%get_asInt ('N') + loadCases(l)%r = step_discretization%get_asReal('r',defaultVal= 1.0_pREAL) + + loadCases(l)%f_restart = load_step%get_asInt('f_restart', defaultVal=huge(0)) + if (load_step%get_asStr('f_out',defaultVal='n/a') == 'none') then + loadCases(l)%f_out = huge(0) + else + loadCases(l)%f_out = load_step%get_asInt('f_out', defaultVal=1) + end if + loadCases(l)%estimate_rate = (load_step%get_asBool('estimate_rate',defaultVal=.true.) .and. l>1) + + reportAndCheck: if (worldrank == 0) then + print'(/,1x,a,1x,i0)', 'load case:', l + print'(2x,a,1x,l1)', 'estimate_rate:', loadCases(l)%estimate_rate + if (loadCases(l)%deformation%myType == 'F') then + print'(2x,a)', 'F:' + else + print'(2x,a)', loadCases(l)%deformation%myType//' / 1/s:' + end if + do i = 1, 3; do j = 1, 3 + if (loadCases(l)%deformation%mask(i,j)) then + write(IO_STDOUT,'(2x,12a)',advance='no') ' x ' + else + write(IO_STDOUT,'(2x,f12.7)',advance='no') loadCases(l)%deformation%values(i,j) + end if + end do; write(IO_STDOUT,'(/)',advance='no') + end do + if (any(loadCases(l)%stress%mask .eqv. loadCases(l)%deformation%mask)) errorID = 831 + if (any(.not.(loadCases(l)%stress%mask .or. transpose(loadCases(l)%stress%mask)) .and. (math_I3<1))) & + errorID = 838 ! no rotation is allowed by stress BC + + if (loadCases(l)%stress%myType == 'P') print'(2x,a)', 'P / MPa:' + if (loadCases(l)%stress%myType == 'dot_P') print'(2x,a)', 'dot_P / MPa/s:' + + if (loadCases(l)%stress%myType /= '') then + do i = 1, 3; do j = 1, 3 + if (loadCases(l)%stress%mask(i,j)) then + write(IO_STDOUT,'(2x,12a)',advance='no') ' x ' + else + write(IO_STDOUT,'(2x,f12.4)',advance='no') loadCases(l)%stress%values(i,j)*1e-6_pREAL + end if + end do; write(IO_STDOUT,'(/)',advance='no') + end do + end if + if (any(dNeq(loadCases(l)%rot%asMatrix(), math_I3))) & + write(IO_STDOUT,'(2x,a,/,3(3(3x,f12.7,1x)/))',advance='no') 'R:',& + transpose(loadCases(l)%rot%asMatrix()) + + if (loadCases(l)%r <= 0.0_pREAL) errorID = 833 + if (loadCases(l)%t < 0.0_pREAL) errorID = 834 + if (loadCases(l)%N < 1) errorID = 835 + if (loadCases(l)%f_out < 1) errorID = 836 + if (loadCases(l)%f_restart < 1) errorID = 839 + + if (dEq(loadCases(l)%r,1.0_pREAL,1.e-9_pREAL)) then + print'(2x,a)', 'r: 1 (constant step width)' + else + print'(2x,a,1x,f0.3)', 'r:', loadCases(l)%r + end if + print'(2x,a,1x,f0.3)', 't:', loadCases(l)%t + print'(2x,a,1x,i0)', 'N:', loadCases(l)%N + if (loadCases(l)%f_out < huge(0)) & + print'(2x,a,1x,i0)', 'f_out:', loadCases(l)%f_out + if (loadCases(l)%f_restart < huge(0)) & + print'(2x,a,1x,i0)', 'f_restart:', loadCases(l)%f_restart + + if (errorID > 0) call IO_error(errorID,label1='line',ID1=l) + + end if reportAndCheck + end do +end function parseLoadsteps + end program DAMASK_grid From 535ccf13781c0d0548f1702a5a065227952ff665 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 Jul 2023 04:19:57 +0200 Subject: [PATCH 055/198] clearer name --- src/grid/grid_mech_spectral_basic.f90 | 2 +- src/grid/grid_mech_spectral_polarization.f90 | 6 +++--- src/grid/spectral_utilities.f90 | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 0db9db64b..ed1ff1e2f 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -365,7 +365,7 @@ subroutine grid_mechanical_spectral_basic_forward(cutBack,guess,Delta_t,Delta_t_ if (stress_BC%myType=='dot_P') P_aim = P_aim & + merge(.0_pREAL,stress_BC%values,stress_BC%mask)*Delta_t - F = reshape(utilities_forwardField(Delta_t,F_lastInc,Fdot, & ! estimate of F at end of time+Delta_t that matches rotated F_aim on average + F = reshape(utilities_forwardTensorField(Delta_t,F_lastInc,Fdot, & ! estimate of F at end of time+Delta_t that matches rotated F_aim on average rotation_BC%rotate(F_aim,active=.true.)),[9,cells(1),cells(2),cells3]) call DMDAVecRestoreArrayF90(DM_mech,F_PETSc,F,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/grid/grid_mech_spectral_polarization.f90 b/src/grid/grid_mech_spectral_polarization.f90 index 5342fa51a..c6c7c2fd5 100644 --- a/src/grid/grid_mech_spectral_polarization.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -408,11 +408,11 @@ subroutine grid_mechanical_spectral_polarization_forward(cutBack,guess,Delta_t,D if (stress_BC%myType=='dot_P') P_aim = P_aim & + merge(.0_pREAL,stress_BC%values,stress_BC%mask)*Delta_t - F = reshape(utilities_forwardField(Delta_t,F_lastInc,Fdot, & ! estimate of F at end of time+Delta_t that matches rotated F_aim on average - rotation_BC%rotate(F_aim,active=.true.)),& + F = reshape(utilities_forwardTensorField(Delta_t,F_lastInc,Fdot, & ! estimate of F at end of time+Delta_t that matches rotated F_aim on average + rotation_BC%rotate(F_aim,active=.true.)),& [9,cells(1),cells(2),cells3]) if (guess) then - F_tau = reshape(Utilities_forwardField(Delta_t,F_tau_lastInc,F_taudot), & + F_tau = reshape(Utilities_forwardTensorField(Delta_t,F_tau_lastInc,F_taudot), & [9,cells(1),cells(2),cells3]) ! does not have any average value as boundary condition else do k = 1, cells3; do j = 1, cells(2); do i = 1, cells(1) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 453723a9b..03d945bee 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -124,7 +124,7 @@ module spectral_utilities utilities_maskedCompliance, & utilities_constitutiveResponse, & utilities_calculateRate, & - utilities_forwardField, & + utilities_forwardTensorField, & utilities_updateCoords contains @@ -864,7 +864,7 @@ end function utilities_calculateRate !> @brief forwards a field with a pointwise given rate, if aim is given, !> ensures that the average matches the aim !-------------------------------------------------------------------------------------------------- -function utilities_forwardField(Delta_t,field_lastInc,rate,aim) +function utilities_forwardTensorField(Delta_t,field_lastInc,rate,aim) real(pREAL), intent(in) :: & Delta_t !< Delta_t of current step @@ -875,22 +875,22 @@ function utilities_forwardField(Delta_t,field_lastInc,rate,aim) aim !< average field value aim real(pREAL), dimension(3,3,cells(1),cells(2),cells3) :: & - utilities_forwardField + utilities_forwardTensorField real(pREAL), dimension(3,3) :: fieldDiff !< - aim integer(MPI_INTEGER_KIND) :: err_MPI - utilities_forwardField = field_lastInc + rate*Delta_t + utilities_forwardTensorField = field_lastInc + rate*Delta_t if (present(aim)) then !< correct to match average - fieldDiff = sum(sum(sum(utilities_forwardField,dim=5),dim=4),dim=3)*wgt + fieldDiff = sum(sum(sum(utilities_forwardTensorField,dim=5),dim=4),dim=3)*wgt call MPI_Allreduce(MPI_IN_PLACE,fieldDiff,9_MPI_INTEGER_KIND,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' fieldDiff = fieldDiff - aim - utilities_forwardField = utilities_forwardField & - - spread(spread(spread(fieldDiff,3,cells(1)),4,cells(2)),5,cells3) + utilities_forwardTensorField = utilities_forwardTensorField & + - spread(spread(spread(fieldDiff,3,cells(1)),4,cells(2)),5,cells3) end if -end function utilities_forwardField +end function utilities_forwardTensorField !-------------------------------------------------------------------------------------------------- From d104f4810eadabb024e976f7f2fdfd8e38e5d0cd Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 19 Jul 2023 11:20:03 +0200 Subject: [PATCH 056/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-668-gbfc2a76a0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1a5ef9e72..4b56feeda 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-665-g341119d70 +3.0.0-alpha7-668-gbfc2a76a0 From 808960104e4343f6758081782b9f7f53b182ba20 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Thu, 20 Jul 2023 09:14:11 +0200 Subject: [PATCH 057/198] ensure performance plots are updated only when performance test is (successfully) completetd --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25ffbc0f1..f270450fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -218,8 +218,10 @@ grid_performance: git push fi + +################################################################################################### update_plots: - stage: statistics + stage: finalize script: - cd $(mktemp -d) - git clone -q git@git.damask.mpie.de:damask/statistics.git . @@ -234,8 +236,6 @@ update_plots: only: - development - -################################################################################################### update_revision: stage: finalize before_script: From 5c2cc1d91dae7bd56745d4198a5436673f0decb4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 20 Jul 2023 21:13:57 +0200 Subject: [PATCH 058/198] include Fortran test suite --- .gitlab-ci.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25ffbc0f1..abfd3e1cf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -85,6 +85,37 @@ mypy: ################################################################################################### +unittest_GNU_DEBUG: + stage: compile + script: + - module load ${COMPILER_GNU} ${MPI_GNU} ${PETSC_GNU} + - TMPDIR=$(mktemp -d) + - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=RELEASE + - cmake --build ${TMPDIR} --target install + - cd ${TMPDIR} + - ./bin/DAMASK_test + +unittest_GNU_RELEASE: + stage: compile + script: + - module load ${COMPILER_GNU} ${MPI_GNU} ${PETSC_GNU} + - TMPDIR=$(mktemp -d) + - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=RELEASE + - cmake --build ${TMPDIR} --target install + - cd ${TMPDIR} + - ./bin/DAMASK_test + +unittest_GNU_PERFORMANCE: + stage: compile + script: + - module load ${COMPILER_GNU} ${MPI_GNU} ${PETSC_GNU} + - TMPDIR=$(mktemp -d) + - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=PERFORMANCE + - cmake --build ${TMPDIR} --target install + - cd ${TMPDIR} + - ./bin/DAMASK_test + + grid_GNU: stage: compile script: From 8da3736d42a78080f0be559236703ca16abe9ae7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 20 Jul 2023 21:16:31 +0200 Subject: [PATCH 059/198] extending test suite --- src/crystal.f90 | 7 ++++--- src/tables.f90 | 9 +++++---- src/test/DAMASK_test.f90 | 19 +++++++++++++++++-- src/test/test_HDF5_utilities.f90 | 14 ++++++-------- src/test/test_crystal.f90 | 17 +++++++++++++++++ src/test/test_prec.f90 | 8 +++----- src/test/test_tables.f90 | 17 +++++++++++++++++ 7 files changed, 69 insertions(+), 22 deletions(-) create mode 100644 src/test/test_crystal.f90 create mode 100644 src/test/test_tables.f90 diff --git a/src/crystal.f90 b/src/crystal.f90 index 724949180..ae460a811 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -377,6 +377,7 @@ module crystal public :: & crystal_init, & + crystal_selfTest, & crystal_isotropic_nu, & crystal_isotropic_mu, & crystal_symmetrize_33, & @@ -412,7 +413,7 @@ subroutine crystal_init() print'(/,1x,a)', '<<<+- crystal init -+>>>'; flush(IO_STDOUT) - call selfTest() + call crystal_selfTest() end subroutine crystal_init @@ -2226,7 +2227,7 @@ end function crystal_isotropic_mu !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some crystal functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest +subroutine crystal_selfTest real(pREAL), dimension(:,:,:), allocatable :: CoSy real(pREAL), dimension(:,:), allocatable :: system @@ -2333,6 +2334,6 @@ subroutine selfTest 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 subroutine crystal_selfTest end module crystal diff --git a/src/tables.f90 b/src/tables.f90 index 65bd7e514..c067492d3 100644 --- a/src/tables.f90 +++ b/src/tables.f90 @@ -25,7 +25,8 @@ module tables public :: & table, & - tables_init + tables_init, & + tables_selfTest contains @@ -37,7 +38,7 @@ subroutine tables_init() print'(/,1x,a)', '<<<+- tables init -+>>>'; flush(IO_STDOUT) - call selfTest() + call tables_selfTest() end subroutine tables_init @@ -106,7 +107,7 @@ end function eval !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of table functionality. !-------------------------------------------------------------------------------------------------- -subroutine selfTest() +subroutine tables_selfTest() type(tTable) :: t real(pREAL), dimension(*), parameter :: & @@ -140,6 +141,6 @@ subroutine selfTest() if (dNeq(y_true(i),t%at(x_eval(i)))) error stop 'table eval/dict' end do -end subroutine selfTest +end subroutine tables_selfTest end module tables diff --git a/src/test/DAMASK_test.f90 b/src/test/DAMASK_test.f90 index 34c1dc88a..8460a9fab 100644 --- a/src/test/DAMASK_test.f90 +++ b/src/test/DAMASK_test.f90 @@ -1,15 +1,30 @@ program DAMASK_test + use parallelization use HDF5_utilities use test_prec + use test_tables + use test_crystal use test_HDF5_utilities - call prec_test() + print('(/,a)'), 'begin test prec' + call test_prec_run() + print('(a)'), 'begin test prec' + + print('(/,a)'), 'begin test tables' + call test_tables_run() + print('(a)'), 'end test tables' + + print('(/,a)'), 'begin test crystal' + call test_crystal_run() + print('(a)'), 'end test crystal' call parallelization_init() call HDF5_utilities_init() - call HDF5_utilities_test() + print('(/,a)'), 'begin test HDF5_utilities' + call test_HDF5_utilities_run() + print('(a)'), 'begin test HDF5_utilities' end program DAMASK_test diff --git a/src/test/test_HDF5_utilities.f90 b/src/test/test_HDF5_utilities.f90 index 94e4175ce..fb43de8e2 100644 --- a/src/test/test_HDF5_utilities.f90 +++ b/src/test/test_HDF5_utilities.f90 @@ -6,20 +6,18 @@ module test_HDF5_utilities implicit none(type,external) private - public :: HDF5_utilities_test + public :: test_HDF5_utilities_run contains -subroutine HDF5_utilities_test() +subroutine test_HDF5_utilities_run() - print*, 'begin test HDF5_utilities' - call test_read_write() - print*, 'end test HDF5_utilities' + call read_write() -end subroutine HDF5_utilities_test +end subroutine test_HDF5_utilities_run -subroutine test_read_write() +subroutine read_write() integer(HID_T) :: f real(pREAL), dimension(3) :: d_in,d_out @@ -34,6 +32,6 @@ subroutine test_read_write() if (any(d_in /= d_out)) error stop 'test_read_write' -end subroutine test_read_write +end subroutine read_write end module test_HDF5_utilities diff --git a/src/test/test_crystal.f90 b/src/test/test_crystal.f90 new file mode 100644 index 000000000..4bb4d8a1e --- /dev/null +++ b/src/test/test_crystal.f90 @@ -0,0 +1,17 @@ +module test_crystal + use crystal + + implicit none(type,external) + + private + public :: test_crystal_run + + contains + +subroutine test_crystal_run() + + call crystal_selfTest() + +end subroutine test_crystal_run + +end module test_crystal diff --git a/src/test/test_prec.f90 b/src/test/test_prec.f90 index fa18d01a1..8aab59817 100644 --- a/src/test/test_prec.f90 +++ b/src/test/test_prec.f90 @@ -4,16 +4,14 @@ module test_prec implicit none(type,external) private - public :: prec_test + public :: test_prec_run contains -subroutine prec_test() +subroutine test_prec_run() - print*, 'begin test prec' call prec_selfTest() - print*, 'end test prec' -end subroutine prec_test +end subroutine test_prec_run end module test_prec diff --git a/src/test/test_tables.f90 b/src/test/test_tables.f90 new file mode 100644 index 000000000..5a66c23d0 --- /dev/null +++ b/src/test/test_tables.f90 @@ -0,0 +1,17 @@ +module test_tables + use tables + + implicit none(type,external) + + private + public :: test_tables_run + + contains + +subroutine test_tables_run() + + call tables_selfTest() + +end subroutine test_tables_run + +end module test_tables From 1fdc5443b295589bb05ca383a70b132316f7cf75 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 20 Jul 2023 23:33:43 +0200 Subject: [PATCH 060/198] avoid code (loop) duplication --- src/grid/grid_damage_spectral.f90 | 25 ++++--------------------- src/grid/grid_thermal_spectral.f90 | 26 +++++++------------------- src/homogenization.f90 | 11 ++++------- src/homogenization_damage.f90 | 19 +++++++++---------- src/homogenization_thermal.f90 | 15 +++++++++------ 5 files changed, 33 insertions(+), 63 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 31aec3912..48023cc54 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -75,7 +75,6 @@ subroutine grid_damage_spectral_init(num_grid) type(tDict), pointer, intent(in) :: num_grid integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: cells3_global - integer :: i, j, k, ce DM :: DM_damage real(pREAL), dimension(:,:,:), pointer :: phi ! 0-indexed Vec :: uBound, lBound @@ -139,7 +138,7 @@ subroutine grid_damage_spectral_init(num_grid) 1_pPETSCINT, 1_pPETSCINT, int(worldsize,pPETSCINT), & 1_pPETSCINT, 0_pPETSCINT, & ! #dof (phi, scalar), ghost boundary width (domain overlap) [int(cells(1),pPetscInt)],[int(cells(2),pPetscInt)],int(cells3_global,pPETSCINT), & ! local cells - DM_damage,err_PETSc) ! handle, error + DM_damage,err_PETSc) ! handle, error CHKERRQ(err_PETSc) call DMsetFromOptions(DM_damage,err_PETSc) CHKERRQ(err_PETSc) @@ -193,11 +192,7 @@ subroutine grid_damage_spectral_init(num_grid) phi_stagInc = phi_lastInc end if restartRead - ce = 0 - do k = 0, cells3-1; do j = 0, cells(2)-1; do i = 0, cells(1)-1 - ce = ce + 1 - call homogenization_set_phi(phi(i,j,k),ce) - end do; end do; end do + call homogenization_set_phi(reshape(phi,[product(cells(1:2))*cells3])) call DMDAVecRestoreArrayF90(DM_damage,phi_PETSc,phi,err_PETSc) CHKERRQ(err_PETSc) @@ -215,7 +210,6 @@ function grid_damage_spectral_solution(Delta_t) result(solution) real(pREAL), intent(in) :: & Delta_t !< increment in time for current solution - integer :: i, j, k, ce type(tSolutionState) :: solution PetscInt :: devNull PetscReal :: phi_min, phi_max, stagNorm @@ -253,13 +247,7 @@ function grid_damage_spectral_solution(Delta_t) result(solution) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' phi_stagInc = phi -!-------------------------------------------------------------------------------------------------- -! updating damage state - ce = 0 - do k = 0, cells3-1; do j = 0, cells(2)-1; do i = 0,cells(1)-1 - ce = ce + 1 - call homogenization_set_phi(phi(i,j,k),ce) - end do; end do; end do + call homogenization_set_phi(reshape(phi,[product(cells(1:2))*cells3])) call DMDAVecRestoreArrayF90(DM_damage,phi_PETSc,phi,err_PETSc) CHKERRQ(err_PETSc) @@ -280,7 +268,6 @@ subroutine grid_damage_spectral_forward(cutBack) logical, intent(in) :: cutBack - integer :: i, j, k, ce DM :: DM_damage real(pREAL), dimension(:,:,:), pointer :: phi ! 0-indexed PetscErrorCode :: err_PETSc @@ -292,11 +279,7 @@ subroutine grid_damage_spectral_forward(cutBack) CHKERRQ(err_PETSc) if (cutBack) then - ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) - ce = ce + 1 - call homogenization_set_phi(phi_lastInc(i,j,k),ce) - end do; end do; end do + call homogenization_set_phi(reshape(phi_lastInc,[product(cells(1:2))*cells3])) phi = phi_lastInc phi_stagInc = phi_lastInc else diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index a03af881b..86d8e04f3 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -74,7 +74,7 @@ subroutine grid_thermal_spectral_init(num_grid) type(tDict), pointer, intent(in) :: num_grid integer(MPI_INTEGER_KIND), dimension(0:worldsize-1) :: cells3_global - integer :: i, j, k, ce + integer :: ce DM :: DM_thermal real(pREAL), dimension(:,:,:), pointer :: T ! 0-indexed integer(MPI_INTEGER_KIND) :: err_MPI @@ -170,11 +170,8 @@ subroutine grid_thermal_spectral_init(num_grid) dotT_lastInc = 0.0_pREAL * T_lastInc end if restartRead - ce = 0 - do k = 0, cells3-1; do j = 0, cells(2)-1; do i = 0, cells(1)-1 - ce = ce + 1 - call homogenization_thermal_setField(T(i,j,k),0.0_pREAL,ce) - end do; end do; end do + call homogenization_thermal_setField(reshape(T,[product(cells(1:2))*cells3]), & + [(0.0_pReal, ce = 1,product(cells(1:2))*cells3)]) call DMDAVecRestoreArrayF90(DM_thermal,T_PETSc,T,err_PETSc) CHKERRQ(err_PETSc) @@ -230,13 +227,8 @@ function grid_thermal_spectral_solution(Delta_t) result(solution) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' T_stagInc = T -!-------------------------------------------------------------------------------------------------- -! updating thermal state - ce = 0 - do k = 0, cells3-1; do j = 0, cells(2)-1; do i = 0, cells(1)-1 - ce = ce + 1 - call homogenization_thermal_setField(T(i,j,k),(T(i,j,k)-T_lastInc(i+1,j+1,k+1))/params%Delta_t,ce) - end do; end do; end do + call homogenization_thermal_setField(reshape(T,[product(cells(1:2))*cells3]), & + reshape(T-T_lastInc,[product(cells(1:2))*cells3])/params%Delta_t) call DMDAVecRestoreArrayF90(DM_thermal,T_PETSc,T,err_PETSc) CHKERRQ(err_PETSc) @@ -257,7 +249,6 @@ subroutine grid_thermal_spectral_forward(cutBack) logical, intent(in) :: cutBack - integer :: i, j, k, ce DM :: DM_thermal real(pREAL), dimension(:,:,:), pointer :: T ! 0-indexed PetscErrorCode :: err_PETSc @@ -269,11 +260,8 @@ subroutine grid_thermal_spectral_forward(cutBack) CHKERRQ(err_PETSc) if (cutBack) then - ce = 0 - do k = 1, cells3; do j = 1, cells(2); do i = 1,cells(1) - ce = ce + 1 - call homogenization_thermal_setField(T_lastInc(i,j,k),dotT_lastInc(i,j,k),ce) - end do; end do; end do + call homogenization_thermal_setField(reshape(T_lastInc,[product(cells(1:2))*cells3]), & + reshape(dotT_lastInc,[product(cells(1:2))*cells3])) T = T_lastInc T_stagInc = T_lastInc else diff --git a/src/homogenization.f90 b/src/homogenization.f90 index c85547917..63eacdf9d 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -145,9 +145,8 @@ module homogenization real(pREAL) :: f end function homogenization_f_T - module subroutine homogenization_thermal_setField(T,dot_T, ce) - integer, intent(in) :: ce - real(pREAL), intent(in) :: T, dot_T + module subroutine homogenization_thermal_setField(T,dot_T) + real(pREAL), dimension(:), intent(in) :: T, dot_T end subroutine homogenization_thermal_setField module function homogenization_damage_active() result(active) @@ -170,10 +169,8 @@ module homogenization real(pREAL) :: f end function homogenization_f_phi - module subroutine homogenization_set_phi(phi,ce) - integer, intent(in) :: ce - real(pREAL), intent(in) :: & - phi + module subroutine homogenization_set_phi(phi) + real(pREAL), dimension(:), intent(in) :: phi end subroutine homogenization_set_phi end interface diff --git a/src/homogenization_damage.f90 b/src/homogenization_damage.f90 index 466b8b47b..233425ebe 100644 --- a/src/homogenization_damage.f90 +++ b/src/homogenization_damage.f90 @@ -151,20 +151,19 @@ end function homogenization_f_phi !-------------------------------------------------------------------------------------------------- !> @brief Set damage field. !-------------------------------------------------------------------------------------------------- -module subroutine homogenization_set_phi(phi,ce) +module subroutine homogenization_set_phi(phi) - integer, intent(in) :: ce - real(pREAL), intent(in) :: phi + real(pREAL), dimension(:), intent(in) :: phi - integer :: & - ho, & - en + integer :: ho, en, ce - ho = material_ID_homogenization(ce) - en = material_entry_homogenization(ce) - damagestate_h(ho)%state(1,en) = phi - current(ho)%phi(en) = phi + do ce=1, ubound(phi,1) + ho = material_ID_homogenization(ce) + en = material_entry_homogenization(ce) + damagestate_h(ho)%state(1,en) = phi(ce) + current(ho)%phi(en) = phi(ce) + end do end subroutine homogenization_set_phi diff --git a/src/homogenization_thermal.f90 b/src/homogenization_thermal.f90 index 789ac994b..791286912 100644 --- a/src/homogenization_thermal.f90 +++ b/src/homogenization_thermal.f90 @@ -173,15 +173,18 @@ end function homogenization_f_T !-------------------------------------------------------------------------------------------------- !> @brief Set thermal field and its rate (T and dot_T). !-------------------------------------------------------------------------------------------------- -module subroutine homogenization_thermal_setField(T,dot_T, ce) +module subroutine homogenization_thermal_setField(T,dot_T) - integer, intent(in) :: ce - real(pREAL), intent(in) :: T, dot_T + real(pREAL), dimension(:), intent(in) :: T, dot_T + + integer :: ce - current(material_ID_homogenization(ce))%T(material_entry_homogenization(ce)) = T - current(material_ID_homogenization(ce))%dot_T(material_entry_homogenization(ce)) = dot_T - call thermal_partition(ce) + do ce=1, min(ubound(T,1),ubound(dot_T,1)) + current(material_ID_homogenization(ce))%T(material_entry_homogenization(ce)) = T(ce) + current(material_ID_homogenization(ce))%dot_T(material_entry_homogenization(ce)) = dot_T(ce) + call thermal_partition(ce) + end do end subroutine homogenization_thermal_setField From 289dceb5842a4663f4041b5035a7fea7d862b96b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Jul 2023 11:46:21 +0200 Subject: [PATCH 061/198] simple coverage report --- .gitlab-ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index abfd3e1cf..5a1b0e700 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -90,30 +90,33 @@ unittest_GNU_DEBUG: script: - module load ${COMPILER_GNU} ${MPI_GNU} ${PETSC_GNU} - TMPDIR=$(mktemp -d) - - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=RELEASE + - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=RELEASE -DBUILDCMD_POST=-coverage - cmake --build ${TMPDIR} --target install - cd ${TMPDIR} - ./bin/DAMASK_test + - find -name \*.gcda | xargs gcov unittest_GNU_RELEASE: stage: compile script: - module load ${COMPILER_GNU} ${MPI_GNU} ${PETSC_GNU} - TMPDIR=$(mktemp -d) - - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=RELEASE + - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=RELEASE -DBUILDCMD_POST=-coverage - cmake --build ${TMPDIR} --target install - cd ${TMPDIR} - ./bin/DAMASK_test + - find -name \*.gcda | xargs gcov unittest_GNU_PERFORMANCE: stage: compile script: - module load ${COMPILER_GNU} ${MPI_GNU} ${PETSC_GNU} - TMPDIR=$(mktemp -d) - - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=PERFORMANCE + - cmake -B ${TMPDIR} -DDAMASK_SOLVER=test -DCMAKE_INSTALL_PREFIX=${TMPDIR} -DCMAKE_BUILD_TYPE=PERFORMANCE -DBUILDCMD_POST=-coverage - cmake --build ${TMPDIR} --target install - cd ${TMPDIR} - ./bin/DAMASK_test + - find -name \*.gcda | xargs gcov grid_GNU: From 4086f40a1661ef56fd0a792baa9ebb85ef15dbcc Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 22 Jul 2023 14:01:53 -0400 Subject: [PATCH 062/198] pull "constants" out of inner loops --- src/phase_thermal_source_dissipation.f90 | 4 ++-- src/phase_thermal_source_externalheat.f90 | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/phase_thermal_source_dissipation.f90 b/src/phase_thermal_source_dissipation.f90 index c42e4a817..4713fb809 100644 --- a/src/phase_thermal_source_dissipation.f90 +++ b/src/phase_thermal_source_dissipation.f90 @@ -49,8 +49,9 @@ module function source_dissipation_init(source_length) result(mySources) allocate(param(phases%length)) do ph = 1, phases%length - phase => phases%get_dict(ph) if (count(mySources(:,ph)) == 0) cycle !ToDo: error if > 1 + Nmembers = count(material_ID_phase == ph) + phase => phases%get_dict(ph) thermal => phase%get_dict('thermal') sources => thermal%get_list('source') do so = 1, sources%length @@ -62,7 +63,6 @@ module function source_dissipation_init(source_length) result(mySources) if (len(refs) > 0) print'(/,1x,a)', refs prm%kappa = src%get_asReal('kappa') - Nmembers = count(material_ID_phase == ph) call phase_allocateState(thermalState(ph)%p(so),Nmembers,0,0,0) end associate diff --git a/src/phase_thermal_source_externalheat.f90 b/src/phase_thermal_source_externalheat.f90 index f86880e62..24a5ea7f8 100644 --- a/src/phase_thermal_source_externalheat.f90 +++ b/src/phase_thermal_source_externalheat.f90 @@ -52,8 +52,9 @@ module function source_externalheat_init(source_length) result(mySources) allocate(source_ID(phases%length), source=0) do ph = 1, phases%length - phase => phases%get_dict(ph) if (count(mySources(:,ph)) == 0) cycle + Nmembers = count(material_ID_phase == ph) + phase => phases%get_dict(ph) thermal => phase%get_dict('thermal') sources => thermal%get_list('source') do so = 1, sources%length @@ -66,8 +67,6 @@ module function source_externalheat_init(source_length) result(mySources) if (len(refs) > 0) print'(/,1x,a)', refs prm%f = table(src,'t','f') - - Nmembers = count(material_ID_phase == ph) call phase_allocateState(thermalState(ph)%p(so),Nmembers,1,1,0) end associate end if From 2d0b64e00dafedf5523355fcab662c0eb12bf47d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 22 Jul 2023 15:04:11 -0400 Subject: [PATCH 063/198] better variable names --- src/phase_thermal.f90 | 12 ++++++------ src/phase_thermal_source_dissipation.f90 | 18 +++++++++--------- src/phase_thermal_source_externalheat.f90 | 22 +++++++++++----------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index 7f31cecb2..e21f173ad 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -28,14 +28,14 @@ submodule(phase) thermal interface - module function source_dissipation_init(source_length) result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + module function source_dissipation_init(maxNsources) result(isMySource) + integer, intent(in) :: maxNsources + logical, dimension(:,:), allocatable :: isMySource end function source_dissipation_init - module function source_externalheat_init(source_length) result(mySources) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + module function source_externalheat_init(maxNsources) result(isMySource) + integer, intent(in) :: maxNsources + logical, dimension(:,:), allocatable :: isMySource end function source_externalheat_init diff --git a/src/phase_thermal_source_dissipation.f90 b/src/phase_thermal_source_dissipation.f90 index 4713fb809..aaaffad13 100644 --- a/src/phase_thermal_source_dissipation.f90 +++ b/src/phase_thermal_source_dissipation.f90 @@ -22,10 +22,10 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function source_dissipation_init(source_length) result(mySources) +module function source_dissipation_init(maxNsources) result(isMySource) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + integer, intent(in) :: maxNsources + logical, dimension(:,:), allocatable :: isMySource type(tDict), pointer :: & phases, & @@ -35,27 +35,27 @@ module function source_dissipation_init(source_length) result(mySources) class(tList), pointer :: & sources character(len=:), allocatable :: refs - integer :: so,Nmembers,ph + integer :: ph,Nmembers,so - mySources = thermal_active('dissipation',source_length) - if (count(mySources) == 0) return + isMySource = thermal_active('dissipation',maxNsources) + if (count(isMySource) == 0) return print'(/,1x,a)', '<<<+- phase:thermal:source_dissipation init -+>>>' - print'(/,a,i2)', ' # phases: ',count(mySources); flush(IO_STDOUT) + print'(/,a,i2)', ' # phases: ',count(isMySource); flush(IO_STDOUT) phases => config_material%get_dict('phase') allocate(param(phases%length)) do ph = 1, phases%length - if (count(mySources(:,ph)) == 0) cycle !ToDo: error if > 1 + if (count(isMySource(:,ph)) == 0) cycle !ToDo: error if > 1 Nmembers = count(material_ID_phase == ph) phase => phases%get_dict(ph) thermal => phase%get_dict('thermal') sources => thermal%get_list('source') do so = 1, sources%length - if (mySources(so,ph)) then + if (isMySource(so,ph)) then associate(prm => param(ph)) src => sources%get_dict(so) print'(1x,a,i0,a,i0)', 'phase ',ph,' source ',so diff --git a/src/phase_thermal_source_externalheat.f90 b/src/phase_thermal_source_externalheat.f90 index 24a5ea7f8..76fd9ac03 100644 --- a/src/phase_thermal_source_externalheat.f90 +++ b/src/phase_thermal_source_externalheat.f90 @@ -8,10 +8,10 @@ submodule(phase:thermal) source_externalheat integer, dimension(:), allocatable :: & - source_ID !< which source is my current thermal dissipation mechanism? + source_ID !< index in phase source list corresponding to this source type :: tParameters !< container type for internal constitutive parameters - type(tTable) :: f + type(tTable) :: f !< external heat power as (tabulated) function of time end type tParameters type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstances) @@ -24,10 +24,10 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module function source_externalheat_init(source_length) result(mySources) +module function source_externalheat_init(maxNsources) result(isMySource) - integer, intent(in) :: source_length - logical, dimension(:,:), allocatable :: mySources + integer, intent(in) :: maxNsources + logical, dimension(:,:), allocatable :: isMySource type(tDict), pointer :: & phases, & @@ -37,14 +37,14 @@ module function source_externalheat_init(source_length) result(mySources) type(tList), pointer :: & sources character(len=:), allocatable :: refs - integer :: so,Nmembers,ph + integer :: ph,Nmembers,so - mySources = thermal_active('externalheat',source_length) - if (count(mySources) == 0) return + isMySource = thermal_active('externalheat',maxNsources) + if (count(isMySource) == 0) return print'(/,1x,a)', '<<<+- phase:thermal:source_externalheat init -+>>>' - print'(/,a,i2)', ' # phases: ',count(mySources); flush(IO_STDOUT) + print'(/,a,i2)', ' # phases: ',count(isMySource); flush(IO_STDOUT) phases => config_material%get_dict('phase') @@ -52,13 +52,13 @@ module function source_externalheat_init(source_length) result(mySources) allocate(source_ID(phases%length), source=0) do ph = 1, phases%length - if (count(mySources(:,ph)) == 0) cycle + if (count(isMySource(:,ph)) == 0) cycle Nmembers = count(material_ID_phase == ph) phase => phases%get_dict(ph) thermal => phase%get_dict('thermal') sources => thermal%get_list('source') do so = 1, sources%length - if (mySources(so,ph)) then + if (isMySource(so,ph)) then source_ID(ph) = so associate(prm => param(ph)) src => sources%get_dict(so) From dafd39566dddcb22bf8c7794f511c2c1d43ebf4b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 22 Jul 2023 15:17:30 -0400 Subject: [PATCH 064/198] can only have one instance per thermal source --- src/IO.f90 | 2 ++ src/phase_thermal_source_dissipation.f90 | 8 +++++--- src/phase_thermal_source_externalheat.f90 | 7 +++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/IO.f90 b/src/IO.f90 index ba33a8a5c..9e0b4c40d 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -548,6 +548,8 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2) !-------------------------------------------------------------------------------------------------- ! user errors + case (600) + msg = 'only one source entry allowed' case (603) msg = 'invalid data for table' case (610) diff --git a/src/phase_thermal_source_dissipation.f90 b/src/phase_thermal_source_dissipation.f90 index aaaffad13..760259286 100644 --- a/src/phase_thermal_source_dissipation.f90 +++ b/src/phase_thermal_source_dissipation.f90 @@ -35,7 +35,7 @@ module function source_dissipation_init(maxNsources) result(isMySource) class(tList), pointer :: & sources character(len=:), allocatable :: refs - integer :: ph,Nmembers,so + integer :: ph,Nmembers,so,Nsources isMySource = thermal_active('dissipation',maxNsources) @@ -49,7 +49,9 @@ module function source_dissipation_init(maxNsources) result(isMySource) allocate(param(phases%length)) do ph = 1, phases%length - if (count(isMySource(:,ph)) == 0) cycle !ToDo: error if > 1 + Nsources = count(isMySource(:,ph)) + if (Nsources == 0) cycle + if (Nsources > 1) call IO_error(600,ext_msg='dissipation') Nmembers = count(material_ID_phase == ph) phase => phases%get_dict(ph) thermal => phase%get_dict('thermal') @@ -64,8 +66,8 @@ module function source_dissipation_init(maxNsources) result(isMySource) prm%kappa = src%get_asReal('kappa') call phase_allocateState(thermalState(ph)%p(so),Nmembers,0,0,0) - end associate + exit end if end do end do diff --git a/src/phase_thermal_source_externalheat.f90 b/src/phase_thermal_source_externalheat.f90 index 76fd9ac03..1a803549c 100644 --- a/src/phase_thermal_source_externalheat.f90 +++ b/src/phase_thermal_source_externalheat.f90 @@ -37,7 +37,7 @@ module function source_externalheat_init(maxNsources) result(isMySource) type(tList), pointer :: & sources character(len=:), allocatable :: refs - integer :: ph,Nmembers,so + integer :: ph,Nmembers,so,Nsources isMySource = thermal_active('externalheat',maxNsources) @@ -52,7 +52,9 @@ module function source_externalheat_init(maxNsources) result(isMySource) allocate(source_ID(phases%length), source=0) do ph = 1, phases%length - if (count(isMySource(:,ph)) == 0) cycle + Nsources = count(isMySource(:,ph)) + if (Nsources == 0) cycle + if (Nsources > 1) call IO_error(600,ext_msg='externalheat') Nmembers = count(material_ID_phase == ph) phase => phases%get_dict(ph) thermal => phase%get_dict('thermal') @@ -69,6 +71,7 @@ module function source_externalheat_init(maxNsources) result(isMySource) prm%f = table(src,'t','f') call phase_allocateState(thermalState(ph)%p(so),Nmembers,1,1,0) end associate + exit end if end do end do From 040b58f7956022ca517a1f40ad805b939be89053 Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 22 Jul 2023 22:27:09 +0200 Subject: [PATCH 065/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-671-g0cace1ef8 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4b56feeda..4c43855b5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-668-gbfc2a76a0 +3.0.0-alpha7-671-g0cace1ef8 From 96871350e49d99c755ae0129db2f36ae7d3bc2a0 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Mon, 24 Jul 2023 09:34:11 +0200 Subject: [PATCH 066/198] add files to support Marc2023.1 --- .../2023.1/Marc_tools/comp_damask_hmp.patch | 49 ++ .../2023.1/Marc_tools/comp_damask_lmp.patch | 49 ++ .../2023.1/Marc_tools/comp_damask_mp.patch | 49 ++ .../2023.1/Marc_tools/include_linux64.patch | 75 +++ .../2023.1/Marc_tools/run_damask_hmp.patch | 517 ++++++++++++++++++ .../2023.1/Marc_tools/run_damask_lmp.patch | 517 ++++++++++++++++++ .../2023.1/Marc_tools/run_damask_mp.patch | 517 ++++++++++++++++++ .../2023.1/Mentat_bin/edit_window.patch | 24 + .../MarcMentat/2023.1/Mentat_bin/kill4.patch | 0 .../MarcMentat/2023.1/Mentat_bin/kill5.patch | 0 .../MarcMentat/2023.1/Mentat_bin/kill6.patch | 0 .../2023.1/Mentat_bin/submit4.patch | 38 ++ .../2023.1/Mentat_bin/submit5.patch | 38 ++ .../2023.1/Mentat_bin/submit6.patch | 38 ++ .../2023.1/Mentat_menus/job_run.ms.patch | 158 ++++++ src/Marc/include/concom2023.1 | 471 ++++++++++++++++ src/Marc/include/creeps2023.1 | 73 +++ 17 files changed, 2613 insertions(+) create mode 100644 install/MarcMentat/2023.1/Marc_tools/comp_damask_hmp.patch create mode 100644 install/MarcMentat/2023.1/Marc_tools/comp_damask_lmp.patch create mode 100644 install/MarcMentat/2023.1/Marc_tools/comp_damask_mp.patch create mode 100644 install/MarcMentat/2023.1/Marc_tools/include_linux64.patch create mode 100644 install/MarcMentat/2023.1/Marc_tools/run_damask_hmp.patch create mode 100644 install/MarcMentat/2023.1/Marc_tools/run_damask_lmp.patch create mode 100644 install/MarcMentat/2023.1/Marc_tools/run_damask_mp.patch create mode 100644 install/MarcMentat/2023.1/Mentat_bin/edit_window.patch create mode 100644 install/MarcMentat/2023.1/Mentat_bin/kill4.patch create mode 100644 install/MarcMentat/2023.1/Mentat_bin/kill5.patch create mode 100644 install/MarcMentat/2023.1/Mentat_bin/kill6.patch create mode 100644 install/MarcMentat/2023.1/Mentat_bin/submit4.patch create mode 100644 install/MarcMentat/2023.1/Mentat_bin/submit5.patch create mode 100644 install/MarcMentat/2023.1/Mentat_bin/submit6.patch create mode 100644 install/MarcMentat/2023.1/Mentat_menus/job_run.ms.patch create mode 100644 src/Marc/include/concom2023.1 create mode 100644 src/Marc/include/creeps2023.1 diff --git a/install/MarcMentat/2023.1/Marc_tools/comp_damask_hmp.patch b/install/MarcMentat/2023.1/Marc_tools/comp_damask_hmp.patch new file mode 100644 index 000000000..886ebf008 --- /dev/null +++ b/install/MarcMentat/2023.1/Marc_tools/comp_damask_hmp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2023.1/Marc_tools/comp_damask_lmp.patch b/install/MarcMentat/2023.1/Marc_tools/comp_damask_lmp.patch new file mode 100644 index 000000000..191cb1a53 --- /dev/null +++ b/install/MarcMentat/2023.1/Marc_tools/comp_damask_lmp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTRANLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2023.1/Marc_tools/comp_damask_mp.patch b/install/MarcMentat/2023.1/Marc_tools/comp_damask_mp.patch new file mode 100644 index 000000000..7c9cf7ba7 --- /dev/null +++ b/install/MarcMentat/2023.1/Marc_tools/comp_damask_mp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2023.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2023.1/Marc_tools/include_linux64.patch new file mode 100644 index 000000000..adea45976 --- /dev/null +++ b/install/MarcMentat/2023.1/Marc_tools/include_linux64.patch @@ -0,0 +1,75 @@ +--- ++++ +@@ -172,6 +178,15 @@ + MARC_COSIM_LIB="$MSCCOSIM_HOME/CoSim$MSCCOSIM_VERSION/Dcosim$MSCCOSIM_VERSION/lib" + fi + ++# DAMASK uses the HDF5 compiler wrapper around the Intel compiler ++H5FC=$(h5fc -shlib -show) ++if [[ "$H5FC" == *"$dir is"* ]]; then ++ H5FC=$(echo $(echo "$H5FC" | tail -n1) | sed -e "s/\-shlib/-fPIC -qopenmp/g") ++ H5FC=${H5FC%-lmpifort*} ++fi ++HDF5_LIB=${H5FC//*ifort/} ++FCOMP="$H5FC" ++ + # AEM + if test "$MARCDLLOUTDIR" = ""; then + DLLOUTDIR="$MARC_LIB" +@@ -604,7 +613,7 @@ + PROFILE=" $PROFILE -pg" + fi + +-FORT_OPT="-c -assume byterecl -safe-cray-ptr -mp1 -WB -fp-model source" ++FORT_OPT="-c -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr -mp1 -WB -fp-model source" + if test "$MTHREAD" = "OPENMP" + then + FORT_OPT=" $FORT_OPT -qopenmp" +@@ -617,7 +626,7 @@ + FORT_OPT=" $FORT_OPT -save -zero" + fi + if test "$MARCHDF_HDF" = "HDF"; then +- FORT_OPT="$FORT_OPT -DMARCHDF_HDF=$MARCHDF_HDF $HDF_INCLUDE" ++ FORT_OPT="$FORT_OPT -DMARCHDF=$MARCHDF_HDF" + fi + + FORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ +@@ -631,6 +640,29 @@ + # for compiling free form f90 files. high opt, integer(4) + FORTF90="$FCOMP -c -O3" + ++# determine DAMASK version ++if test -n "$DAMASK_USER"; then ++ DAMASKROOT=`dirname $DAMASK_USER`/../.. ++ read DAMASKVERSION < $DAMASKROOT/VERSION ++ DAMASKVERSION="'"$DAMASKVERSION"'" ++else ++ DAMASKVERSION="'N/A'" ++fi ++ ++# DAMASK compiler calls ++DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2023.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2023.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2023.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++ + if test "$MARCDEBUG" = "ON" + then + FORTLOW="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \ +@@ -788,7 +820,7 @@ + + SOLVERLIBS="${BCSSOLVERLIBS} ${VKISOLVERLIBS} ${CASISOLVERLIBS} ${MF2SOLVERLIBS} \ + -L$MARC_MKL \ +- $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs -lmg-hybrid -lmg-cadsurf -lmg-hexa $HDF_LIBS $SOLVER2LIBS" ++ $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs -lmg-hybrid -lmg-cadsurf -lmg-hexa $HDF5_LIB $SOLVER2LIBS" + + SOLVERLIBS_DLL=${SOLVERLIBS} + if test "$AEM_DLL" -eq 1 diff --git a/install/MarcMentat/2023.1/Marc_tools/run_damask_hmp.patch b/install/MarcMentat/2023.1/Marc_tools/run_damask_hmp.patch new file mode 100644 index 000000000..7deb005f8 --- /dev/null +++ b/install/MarcMentat/2023.1/Marc_tools/run_damask_hmp.patch @@ -0,0 +1,517 @@ +--- ++++ +@@ -136,6 +136,11 @@ + # is created. For job running in the background, the log # + # file is always created. Default is "yes" # + ############################################################################## ++# remove all Mentat paths from LD_LIBRARY_PATH ++LD_LIBRARY_PATH=:$LD_LIBRARY_PATH: ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH//+([!(:)])mentat2023.1+([!(:)])/:} ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH//+([(:)])/:} ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH#:}; LD_LIBRARY_PATH=${LD_LIBRARY_PATH%:} + # set DIR to the directory in which this script is + REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" + DIR=`dirname $REALCOM` +@@ -302,7 +307,23 @@ + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +426,7 @@ + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -676,50 +697,19 @@ + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -1207,12 +1197,12 @@ + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1531,7 +1521,7 @@ + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1564,7 +1554,7 @@ + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1687,7 +1677,7 @@ + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1686,19 @@ + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2233,12 @@ + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2351,7 @@ + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3234,27 @@ + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usernoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3330,6 +3273,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -3343,6 +3287,9 @@ + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3389,7 +3336,7 @@ + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3555,7 +3502,7 @@ + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3568,21 +3515,21 @@ + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3592,39 +3539,27 @@ + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3643,6 +3578,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -3684,6 +3620,9 @@ + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3777,7 +3716,7 @@ + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3902,7 +3841,7 @@ + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3915,20 +3854,20 @@ + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3938,37 +3877,25 @@ + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3987,6 +3914,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -4027,7 +3955,9 @@ + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4146,7 +4076,7 @@ + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2023.1/Marc_tools/run_damask_lmp.patch b/install/MarcMentat/2023.1/Marc_tools/run_damask_lmp.patch new file mode 100644 index 000000000..4f95e6241 --- /dev/null +++ b/install/MarcMentat/2023.1/Marc_tools/run_damask_lmp.patch @@ -0,0 +1,517 @@ +--- ++++ +@@ -136,6 +136,11 @@ + # is created. For job running in the background, the log # + # file is always created. Default is "yes" # + ############################################################################## ++# remove all Mentat paths from LD_LIBRARY_PATH ++LD_LIBRARY_PATH=:$LD_LIBRARY_PATH: ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH//+([!(:)])mentat2023.1+([!(:)])/:} ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH//+([(:)])/:} ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH#:}; LD_LIBRARY_PATH=${LD_LIBRARY_PATH%:} + # set DIR to the directory in which this script is + REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" + DIR=`dirname $REALCOM` +@@ -302,7 +307,23 @@ + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +426,7 @@ + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -676,50 +697,19 @@ + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -1207,12 +1197,12 @@ + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1531,7 +1521,7 @@ + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1564,7 +1554,7 @@ + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1687,7 +1677,7 @@ + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1686,19 @@ + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2233,12 @@ + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2351,7 @@ + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3234,27 @@ + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usernoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3330,6 +3273,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -3343,6 +3287,9 @@ + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3389,7 +3336,7 @@ + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3555,7 +3502,7 @@ + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3568,21 +3515,21 @@ + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3592,39 +3539,27 @@ + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3643,6 +3578,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -3684,6 +3620,9 @@ + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3777,7 +3716,7 @@ + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3902,7 +3841,7 @@ + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3915,20 +3854,20 @@ + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3938,37 +3877,25 @@ + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3987,6 +3914,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -4027,7 +3955,9 @@ + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4146,7 +4076,7 @@ + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2023.1/Marc_tools/run_damask_mp.patch b/install/MarcMentat/2023.1/Marc_tools/run_damask_mp.patch new file mode 100644 index 000000000..0faf3a042 --- /dev/null +++ b/install/MarcMentat/2023.1/Marc_tools/run_damask_mp.patch @@ -0,0 +1,517 @@ +--- ++++ +@@ -136,6 +136,11 @@ + # is created. For job running in the background, the log # + # file is always created. Default is "yes" # + ############################################################################## ++# remove all Mentat paths from LD_LIBRARY_PATH ++LD_LIBRARY_PATH=:$LD_LIBRARY_PATH: ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH//+([!(:)])mentat2023.1+([!(:)])/:} ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH//+([(:)])/:} ++LD_LIBRARY_PATH=${LD_LIBRARY_PATH#:}; LD_LIBRARY_PATH=${LD_LIBRARY_PATH%:} + # set DIR to the directory in which this script is + REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" + DIR=`dirname $REALCOM` +@@ -302,7 +307,23 @@ + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +426,7 @@ + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -676,50 +697,19 @@ + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -1207,12 +1197,12 @@ + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1531,7 +1521,7 @@ + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1564,7 +1554,7 @@ + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1687,7 +1677,7 @@ + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1686,19 @@ + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2233,12 @@ + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2351,7 @@ + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3234,27 @@ + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usernoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3330,6 +3273,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -3343,6 +3287,9 @@ + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3389,7 +3336,7 @@ + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3555,7 +3502,7 @@ + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3568,21 +3515,21 @@ + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3592,39 +3539,27 @@ + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3643,6 +3578,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -3684,6 +3620,9 @@ + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3777,7 +3716,7 @@ + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3902,7 +3841,7 @@ + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3915,20 +3854,20 @@ + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3938,37 +3877,25 @@ + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3987,6 +3914,7 @@ + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +@@ -4027,7 +3955,9 @@ + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4146,7 +4076,7 @@ + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2023.1/Mentat_bin/edit_window.patch b/install/MarcMentat/2023.1/Mentat_bin/edit_window.patch new file mode 100644 index 000000000..915af9bf6 --- /dev/null +++ b/install/MarcMentat/2023.1/Mentat_bin/edit_window.patch @@ -0,0 +1,24 @@ +--- ++++ +@@ -1,18 +1,5 @@ + #!/bin/sh +-# This script opens a window running an editor. The default window is an +-# xterm, and the default editor is vi. These may be customized. ++# This script opens a window running an editor. ++# The command to invoke the editor is specified during DAMASK installation + +-dir= +-for d in /usr/bin /usr/bin/X11; do +- if test -x "$d/xterm"; then +- dir="$d" +- break +- fi +-done +- +-if test -z "$dir"; then +- echo "$0: Could not find xterm" +- exit 1 +-fi +- +-"$dir/xterm" -T "vi $*" -n "vi $*" -e vi $* ++%EDITOR% $* diff --git a/install/MarcMentat/2023.1/Mentat_bin/kill4.patch b/install/MarcMentat/2023.1/Mentat_bin/kill4.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2023.1/Mentat_bin/kill5.patch b/install/MarcMentat/2023.1/Mentat_bin/kill5.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2023.1/Mentat_bin/kill6.patch b/install/MarcMentat/2023.1/Mentat_bin/kill6.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2023.1/Mentat_bin/submit4.patch b/install/MarcMentat/2023.1/Mentat_bin/submit4.patch new file mode 100644 index 000000000..98c51e76d --- /dev/null +++ b/install/MarcMentat/2023.1/Mentat_bin/submit4.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +63,10 @@ + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +91,7 @@ + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +190,12 @@ + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2023.1/Mentat_bin/submit5.patch b/install/MarcMentat/2023.1/Mentat_bin/submit5.patch new file mode 100644 index 000000000..ab32b1058 --- /dev/null +++ b/install/MarcMentat/2023.1/Mentat_bin/submit5.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +63,10 @@ + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +91,7 @@ + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +190,12 @@ + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_mp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_mp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2023.1/Mentat_bin/submit6.patch b/install/MarcMentat/2023.1/Mentat_bin/submit6.patch new file mode 100644 index 000000000..d5ea3cfde --- /dev/null +++ b/install/MarcMentat/2023.1/Mentat_bin/submit6.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +63,10 @@ + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +91,7 @@ + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +190,12 @@ + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2023.1/Mentat_menus/job_run.ms.patch b/install/MarcMentat/2023.1/Mentat_menus/job_run.ms.patch new file mode 100644 index 000000000..be961cc46 --- /dev/null +++ b/install/MarcMentat/2023.1/Mentat_menus/job_run.ms.patch @@ -0,0 +1,158 @@ +--- ++++ +@@ -362,11 +362,18 @@ + } + button { + position +25 = +- size 25 4 ++ size 18 4 + text "ADVANCED JOB SUBMISSION" + help "job_run#Job Submission And Control" + popmenu job_submit_adv_pm + } ++ button { ++ position +18 = ++ size 7 4 ++ text "DAMASK" ++ help "damask_run#Job Submission And Control" ++ popmenu damask ++ } + button { + position 0 +4 + size 16 4 +@@ -1303,6 +1310,135 @@ + } + + ++#-------------------------------------------------------------------------------------------------- ++popmenu damask { ++ ++#ifdef QT_MENTAT ++ text "DAMASK.MPIE.DE" ++#endif ++ ++ group { ++#ifndef QT_MENTAT ++ label { ++ position 0 0 ++ size 50 4 ++ text "DAMASK.MPIE.DE" ++ } ++#endif ++ ++ label { ++ position 1 6 ++ size 13 6 ++ text "Optimzation" ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position +13 = ++ size 20 6 ++ text "write Input" ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position +18 = ++ size 30 6 ++ text "do not write Inp." ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O3 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 4 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 4 *monitor_job" ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O1 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 5 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 5 *monitor_job" ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O0 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 6 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 6 *monitor_job" ++ } ++ ++ popdown { ++ position 19 +8 ++ size 12 8 ++ text "CANCEL" ++ } ++} ++ ++ window { ++ parent mentat ++ origin 38 8 ++#ifdef DCOM ++ size 50 100 ++#else ++ size 50 94 ++#endif ++ background_color body ++ border_width 1 ++ border_color border ++ buffering single ++ } ++ mode permanent ++} ++ + #-------------------------------------------------------------------------------------------------- + popmenu job_exit_msg_pm { + diff --git a/src/Marc/include/concom2023.1 b/src/Marc/include/concom2023.1 new file mode 100644 index 000000000..3d31760ba --- /dev/null +++ b/src/Marc/include/concom2023.1 @@ -0,0 +1,471 @@ +! common block definition file taken from respective MSC.Marc release and reformated to free format +!*********************************************************************** +! +! File: concom.cmn +! +! MSC.Marc include file +! +integer & + iacous, iasmbl, iautth, ibear, icompl, iconj, icreep, ideva, idyn, idynt,& + ielas, ielcma, ielect, iform, ifour, iharm, ihcps, iheat, iheatt, ihresp,& + ijoule, ilem, ilnmom, iloren, inc, incext, incsub, ipass, iplres, ipois,& + ipoist, irpflo, ismall, ismalt, isoil, ispect, ispnow, istore, iswep, ithcrp,& + itherm, iupblg, iupdat, jacflg, jel, jparks, largst, lfond, loadup, loaduq,& + lodcor, lovl, lsub, magnet, ncycle, newtnt, newton, noshr, linear, ivscpl,& + icrpim, iradrt, ipshft, itshr, iangin, iupmdr, iconjf, jincfl, jpermg, jhour,& + isolvr, jritz, jtable, jshell, jdoubl, jform, jcentr, imini, kautth, iautof,& + ibukty, iassum, icnstd, icnstt, kmakmas, imethvp, iradrte, iradrtp, iupdate, iupdatp,& + ncycnt, marmen , idynme, ihavca, ispf, kmini, imixex, largtt, kdoela, iautofg,& + ipshftp, idntrc, ipore, jtablm, jtablc, isnecma, itrnspo, imsdif, jtrnspo, mcnear,& + imech, imecht, ielcmat, ielectt, magnett, imsdift, noplas, jtabls, jactch, jtablth,& + kgmsto , jpzo, ifricsh, iremkin, iremfor, ishearp, jspf, machining, jlshell, icompsol,& + iupblgfo, jcondir, nstcrp, nactive, ipassref, nstspnt, ibeart, icheckmpc, noline, icuring,& + ishrink, ioffsflg, isetoff, ioffsetm,iharmt, inc_incdat, iautspc, ibrake, icbush, istream_input,& + iprsinp, ivlsinp, ifirst_time,ipin_m, jgnstr_glb, imarc_return,iqvcinp, nqvceid, istpnx, imicro1,& + iaxisymm, jbreakglue,iglstif, jfastasm,iwear, iwearcf, imixmeth, ielcmadyn, idinout, igena_meth,& + magf_meth, non_assumed, iredoboudry, ioffsz0,icomplt, mesh_dual, iactrp, mgnewton, iusedens,igsigd0,& + iaem, icosim, inodels, nlharm, iampini, iphasetr, inonlcl, inonlct, iforminp,ispecerror,& + icsprg, imol, imolt, idatafit,iharmpar, inclcase, imultifreq,init_elas, ifatig, iftgmat,& + nchybrid, ibuckle, iexpande, matfor +dimension :: ideva(60) +integer num_concom +parameter(num_concom=264) +common/marc_concom/& + iacous, iasmbl, iautth, ibear, icompl, iconj, icreep, ideva, idyn, idynt,& + ielas, ielcma, ielect, iform, ifour, iharm, ihcps, iheat, iheatt, ihresp,& + ijoule, ilem, ilnmom, iloren, inc, incext, incsub, ipass, iplres, ipois,& + ipoist, irpflo, ismall, ismalt, isoil, ispect, ispnow, istore, iswep, ithcrp,& + itherm, iupblg, iupdat, jacflg, jel, jparks, largst, lfond, loadup, loaduq,& + lodcor, lovl, lsub, magnet, ncycle, newtnt, newton, noshr, linear, ivscpl,& + icrpim, iradrt, ipshft, itshr, iangin, iupmdr, iconjf, jincfl, jpermg, jhour,& + isolvr, jritz, jtable, jshell, jdoubl, jform, jcentr, imini, kautth, iautof,& + ibukty, iassum, icnstd, icnstt, kmakmas, imethvp, iradrte, iradrtp, iupdate, iupdatp,& + ncycnt, marmen, idynme, ihavca, ispf, kmini, imixex, largtt, kdoela, iautofg,& + ipshftp, idntrc, ipore, jtablm, jtablc, isnecma, itrnspo, imsdif, jtrnspo, mcnear,& + imech, imecht, ielcmat, ielectt, magnett, imsdift, noplas, jtabls, jactch, jtablth,& + kgmsto , jpzo, ifricsh, iremkin, iremfor, ishearp, jspf, machining, jlshell, icompsol,& + iupblgfo, jcondir, nstcrp, nactive, ipassref, nstspnt, ibeart, icheckmpc, noline, icuring,& + ishrink, ioffsflg, isetoff, ioffsetm,iharmt, inc_incdat, iautspc, ibrake, icbush, istream_input,& + iprsinp, ivlsinp, ifirst_time,ipin_m, jgnstr_glb, imarc_return,iqvcinp, nqvceid, istpnx, imicro1,& + iaxisymm, jbreakglue,iglstif, jfastasm,iwear, iwearcf, imixmeth, ielcmadyn, idinout, igena_meth,& + magf_meth, non_assumed, iredoboudry, ioffsz0,icomplt, mesh_dual, iactrp, mgnewton, iusedens,igsigd0,& + iaem, icosim, inodels, nlharm, iampini, iphasetr, inonlcl, inonlct, iforminp,ispecerror,& + icsprg, imol, imolt, idatafit,iharmpar, inclcase, imultifreq,init_elas, ifatig, iftgmat,& + nchybrid, ibuckle, iexpande, matfor +! +! comments of variables: +! +! iacous Control flag for acoustic analysis. Input data. +! iacous=1 modal acoustic analysis. +! iacous=2 harmonic acoustic-structural analysis. +! iasmbl Control flag to indicate that operator matrix should be +! recalculated. +! iautth Control flag for AUTO THERM option. +! ibear Control flag for bearing analysis. Input data. +! icompl Control variable to indicate that a complex analysis is +! being performed. Either a Harmonic analysis with damping, +! or a harmonic electro-magnetic analysis. Input data. +! iconj Flag for EBE conjugate gradient solver (=solver 1, retired) +! Also used for VKI iterative solver. +! icreep Control flag for creep analysis. Input data. +! ideva(60) - debug print out flag +! 1 print element stiffness matrices, mass matrix +! 2 output matrices used in tying +! 3 force the solution of a nonpositive definite matrix +! 4 print info of connections to each node +! 5 info of gap convergence, internal heat generated, contact +! touching and separation +! 6 nodal value array during rezoning +! 7 tying info in CONRAD GAP option, fluid element numbers in +! CHANNEL option +! 8 output incremental displacements in local coord. system +! 9 latent heat output +! 10 stress-strain in local coord. system +! 11 additional info on interlaminar stress +! 12 output right hand side and solution vector +! 13 info of CPU resources used and memory available on NT +! 14 info of mesh adaption process, 2D outline information +! info of penetration checking for remeshing +! save .fem files after afmesh3d meshing +! print local adaptivity info +! 15 surface energy balance flag +! 16 print info regarding pyrolysis +! 17 print info of "streamline topology" +! 18 print mesh data changes after remeshing +! 19 print material flow stress data read in from *.mat file +! if unit flag is on, print out flow stress after conversion +! 20 print information on table input +! 21 print out information regarding kinematic boundary conditions +! 22 print out information regarding dist loads, point loads, film +! and foundations +! 23 print out information about automatic domain decomposition +! 24 print out iteration information in SuperForm status report file +! 25 print out information for ablation +! 26 print out information for films - Table input +! 27 print out the tying forces +! 28 print out for CASI solver, convection, +! 29 DDM single file debug printout +! 30 print out cavity debug info +! 31 print out welding related info +! 32 prints categorized DDM memory usage +! 33 print out the cutting info regarding machining feature +! 34 print out the list of quantities which can be defined via a table +! and for each quantity the supported independent variables +! 35 print out detailed coupling region info +! 36 print out solver debug info level 1 (Least Detailed) +! 37 print out solver debug info level 1 (Medium Detailed) +! 38 print out solver debug info level 1 (Very Detailed) +! 39 print detailed memory allocation info +! 40 print out marc-adams debug info +! 41 output rezone mapping post file for debugging +! 42 output post file after calling oprofos() for debugging +! 43 debug printout for vcct +! 44 debug printout for progressive failure +! 45 print out automatically generated midside node coordinates (arecrd) +! 46 print out message about routine and location, where the ibort is raised (ibort_inc) +! 47 print out summary message of element variables on a +! group-basis after all the automatic changes have been +! made (em_ellibp) +! 48 Automatically generate check results based on max and min vals. +! These vals are stored in the checkr file, which is inserted +! into the *dat file by the generate_check_results script from /marc/tools +! 49 Automatically generate check results based on the real calculated values +! at the sppecified check result locations. +! These vals are stored in the checkr file, which is inserted +! into the *dat file by the update_check_results script from /marc/tools +! 50 generate a file containing the resistance or capacity matrix; +! this file can be used to compare results with a reference file +! 51 print out detailed information for segment-to-segment contact +! 52 print out detailed relative displacement information +! for uniaxial sliding contact +! 53 print out detailed sliding direction information for +! uniaxial sliding contact +! 54 print out detailed information for edges attached to a curve +! 55 print information related to viscoelasticity calculations +! 56 print out detailed information for element coloring for multithreading +! 57 print out extra overheads due to multi-threading. +! These overhead includes (i) time and (ii) memory. +! The memory report will be summed over all the children. +! 58 debug output for ELSTO usage +! 59 print out contact body forces and nodes in contact +! +! idyn Control flag for dynamics. Input data. +! 1 = eigenvalue extraction and / or modal superposition +! 2 = Newmark Beta and Single Step Houbolt (ssh with idynme=1) +! 3 = Houbolt +! 4 = Central difference +! 5 = Newer central difference +! idynt Copy of idyn at begining of increment +! ielas Control flag for ELASTIC analysis. Input data. +! Set by user or automatically turned on by Fourier option. +! Implies that each load case is treated separately. +! In Adaptive meshing analysis , forces re-analysis until +! convergence obtained. +! Also seriously misused to indicate no convergence. +! = 1 elastic option with fourier analysis +! = 2 elastic option without fourier analysis +! =-1 no convergence in recycles or max # increments reached +! Set to 1 if ELASTIC or SUBSTRUC parameter cards are used, +! or if fourier option is used. +! Then set to 2 if not fourier analysis. +! ielcma Control flag for electromagnetic analysis. Input data. +! ielcma = 1 Harmonic formulation +! ielcma = 2 Transient formulation +! ielect Control flag for electrostatic option. Input data. +! iform Control flag indicating that contact will be performed. +! ifour Control flag for Fourier analysis. +! 0 = Odd and even terms. +! 1 = symmetric (cosine) terms +! 2 = antisymmetric (sine) terms. +! iharm Control flag to indicate that a harmonic analysis will +! be performed. May change between passes. +! ihcps Control flag for coupled thermal - stress analysis. +! iheat Control flag for heat transfer analysis. Input data. +! iheatt Permanent control flag for heat transfer analysis. +! Note in coupled analysis iheatt will remain as one, +! but iheat will be zero in stress pass. +! ihresp Control flag to indicate to perform a harmonic subincrement. +! ijoule Control flag for Joule heating. +! ilem Control flag to determin which vector is to be transformed. +! Control flag to see where one is: +! ilem = 1 - elem.f +! ilem = 2 - initst.f +! ilem = 3 - pressr.f +! ilem = 3 - fstif.f +! ilem = 4 - jflux.f +! ilem = 4 - strass.f +! ilem = 5 - mass.f +! ilem = 5 - osolty.f +! ilnmom Control flag for soil - pore pressure calculation. Input data. +! ilnmom = 0 - perform only pore pressure calculation. +! = 1 - couples pore pressure - displacement analysis +! iloren Control flag for DeLorenzi J-Integral evaluation. Input data. +! inc Increment number. +! incext Control flag indicating that currently working on a +! subincrement. +! Could be due to harmonics , damping component (bearing), +! stiffness component (bearing), auto therm creep or +! old viscoplaticity +! incsub Sub-increment number. +! inonlcl control flag for nonlocal pass +! inonlct permanent control flag for nonlocal pass +! ipass Control flag for which part of coupled analysis. +! ipass = -1 - reset to base values +! ipass = 0 - do nothing +! ipass = 1 - stress part +! ipass = 2 - heat transfer part +! 3 - fluid pass +! 4 - joule heating pass +! 5 - pore pressure pass +! 6 - electrostatic pass +! 7 - magnetostatic pass +! 8 - electromagnetic pass +! 9 - diffusion pass +! ipass = 10 - nonlocal part +! iplres Flag indicating that either second matrix is stored. +! dynamic analysis - mass matrix +! heat transfer - specific heat matrix +! buckle - initial stress stiffness +! ipois Control flag indicating Poisson type analysis +! ipois = 1 for heat transfer +! = 1 for heat transfer part of coupled +! = 1 for bearing +! = 1 for electrostatic +! = 1 for magnetostatic +! = 1 for nonlocal part +! ipoist Permanent copy of ipois. In coupled analysis , ipois = 0 +! in stress portion, yet ipoist will still =1. +! irpflo global flag for rigid plastic flow analysis +! = 1 eularian formulation +! = 2 regular formulation; rigid material present in the analysis +! ismall control flag to indicate small displacement analysis. input data. +! ismall = 0 - large disp included. +! ismall = 1 - small displacement. +! the flag is changing between passes. +! ismalt permanent copy of ismall . in heat transfer portion of +! coupled analysis ismall =0 , but ismalt remains the same. +! isoil control flag indicating that soil / pore pressure +! calculation . input data. +! ispect control flag for response spectrum calculation. input data. +! ispnow control flag to indicate to perform a spectrum response +! calculation now. +! istore store stresses flag. +! istore = 0 in elem.f and if first pass of creep +! convergence checking in ogetst.f +! or harmonic analysis or thruc.f if not +! converged. +! iswep control flag for eigenvalue analysis. +! iswep=1 - go do extraction process +! ithcrp control flag for auto therm creep option. input data. +! itherm control flag for either temperature dependent material +! properties and/or thermal loads. +! iupblg control flag for follower force option. input data. +! iupdat control flag for update lagrange option for current element. +! jacflg control flag for lanczos iteration method. input data. +! jel control flag indicating that total load applied in +! increment, ignore previous solution. +! jel = 1 in increment 0 +! = 1 if elastic or fourier +! = 1 in subincrements with elastic and adaptive +! jparks control flag for j integral by parks method. input data. +! largst control flag for finite strain plasticity. input data. +! lfond control variable that indicates if doing elastic +! foundation or film calculation. influences whether +! this is volumetric or surface integration. +! loadup control flag that indicates that nonlinearity occurred +! during previous increment. +! loaduq control flag that indicates that nonlinearity occurred. +! lodcor control flag for switching on the residual load correction. +! notice in input stage lodcor=0 means no loadcor, +! after omarc lodcor=1 means no loadcor +! lovl control flag for determining which "overlay" is to +! be called from ellib. +! lovl = 1 omarc +! = 2 oaread +! = 3 opress +! = 4 oasemb +! = 5 osolty +! = 6 ogetst +! = 7 oscinc +! = 8 odynam +! = 9 opmesh +! = 10 omesh2 +! = 11 osetz +! = 12 oass +! = 13 oincdt +! = 14 oasmas +! = 15 ofluas +! = 16 ofluso +! = 17 oshtra +! = 18 ocass +! = 19 osoltc +! = 20 orezon +! = 21 otest +! = 22 oeigen +! lsub control variable to determine which part of element +! assembly function is being done. +! lsub = 1 - no longer used +! = 2 - beta* +! = 3 - cons* +! = 4 - ldef* +! = 5 - posw* +! = 6 - theta* +! = 7 - tmarx* +! = 8 - geom* +! magnet control flag for magnetostatic analysis. input data. +! ncycle cycle number. accumulated in osolty.f +! note first time through oasemb.f , ncycle = 0. +! newtnt control flag for permanent copy of newton. +! newton iteration type. input data. +! newton : = 1 full newton raphson +! 2 modified newton raphson +! 3 newton raphson with strain correct. +! 4 direct substitution +! 5 direct substitution followed by n.r. +! 6 direct substitution with line search +! 7 full newton raphson with secant initial stress +! 8 secant method +! 9 full newton raphson with line search +! noshr control flag for calculation interlaminar shears for +! elements 22,45, and 75. input data. +!ees +! +! jactch = 1 or 2 if elements are activated or deactivated +! = 3 if elements are adaptively remeshed or rezoned +! = 0 normally / reset to 0 when assembly is done +! ifricsh = 0 call to fricsh in otest not needed +! = 1 call to fricsh (nodal friction) in otest needed +! iremkin = 0 remove deactivated kinematic boundary conditions +! immediately - only in new input format (this is default) +! = 1 remove deactivated kinematic boundary conditions +! gradually - only in new input format +! iremfor = 0 remove force boundary conditions immediately - +! only in new input format (this is default) +! = 1 remove force boundary conditions gradually - +! only in new input format (this is default) +! ishearp set to 1 if shear panel elements are present in the model +! +! jspf = 0 not in spf loadcase +! > 0 in spf loadcase (jspf=1 during first increment) +! machining = 1 if the metal cutting feature is used, for memory allocation purpose +! = 0 (default) if no metal cutting feature required +! +! jlshell = 1 if there is a shell element in the mesh +! icompsol = 1 if there is a composite solid element in the mesh +! iupblgfo = 1 if follower force for point loads +! jcondir = 1 if contact priority option is used +! nstcrp = 0 (default) steady state creep flag (undocumented feature. +! if not 0, turns off special ncycle = 0 code in radial.f) +! nactive = number of active passes, if =1 then it's not a coupled analysis +! ipassref = reference ipass, if not in a multiphysics pass ipass=ipassref +! icheckmpc = value of mpc-check parameter option +! noline = set to 1 in osolty if no line seacrh should be done in ogetst +! icuring = set to 1 if the curing is included for the heat transfer analysis. +! ishrink = set to 1 if shrinkage strain is included for mechancial analysis. +! ioffsflg = 1 for small displacement beam/shell offsets +! = 2 for large displacement beam/shell offsets +! isetoff = 0 - do not apply beam/shell offsets +! = 1 - apply beam/shell offsets +! ioffsetm = min. value of offset flag +! iharmt = 1 global flag if a coupled analysis contains an harmonic pass +! inc_incdat = flag to record increment number of a new loadcase in incdat.f +! iautspc = flag for AutoSPC option +! ibrake = brake squeal in this increment +! icbush = set to 1 if cbush elements present in model +! istream_input = set to 1 for streaming input calling Marc as library +! iprsinp = set to 1 if pressure input, introduced so other variables +! such as h could be a function of pressure +! ivlsinp = set to 1 if velocity input, introduced so other variables +! such as h could be a function of velocity +! ipin_m = # of beam element with PIN flag +! jgnstr_glb = global control over pre or fast integrated composite shells +! imarc_return = Marc return flag for streaming input control +! iqvcimp = if non-zero, then the number of QVECT boundary conditions +! nqvceid = number of QVECT boundary conditions, where emisivity/absorbtion id entered +! istpnx = 1 if to stop at end of increment +! imicro1 = 1 if micro1 interface is used +! iaxisymm = set to 1 if axisymmetric analysis +! jbreakglue = set to 1 if breaking glued option is used +! iglstif = 1 if ddm and global stiffness matrix formed (sgi solver 6 or solver9) +! jfastasm = 1 do fast assembly using SuperForm code +! iwear = set to 1 if wear model, set to 2 if wear model and coordinates updated +! iwearcf = set to 1 to store nodal coefficient of friction for wear calculation +! imixmeth = set=1 then use nonlinear mixture material - allocate memory +! ielcmadyn = flag for magnetodynamics +! 0 - electromagnetics using newmark beta +! 1 - transient magnetics using backward euler +! idinout = flag to control if inside out elements should be deactivated +! igena_meth = 0 - generalized alpha parameters depend on whether or not contact +! is flagged (dynamic,7) +! 10 - generalized alpha parameters are optimized for a contact +! analysis (dynamic,8) +! 11 - generalized alpha parameters are optimized for an analysis +! without contact (dynamic,8) +! magf_meth = - Method to compute force in magnetostatic - structural +! = 1 - Virtual work method based on finite difference for the force computation +! = 2 - Maxwell stress tensor +! = 3 - Virtual work method based on local derivative for the force computation +! non_assumed = 1 no assumed strain formulation (forced) +! iredoboudry set to 1 if contact boundary needs to be recalculated +! ioffsz0 = 1 if composite are used with reference position.ne.0 +! icomplt = 1 global flag if a coupled analysis contains an complex pass +! mesh_dual = 1 two independent meshes are used in magnetodynamic/thermal/structural +! one for magnetodynamic and the other for the remaining passes +! iactrp = 1 in an analysis with global remeshing, include inactive +! rigid bodies on post file +! mgnewton = 1 Use full Newton Raphson iteration for magnetostatic pass +! +! iusedens > 0 if mass density is used in the analysis (dynamics, mass dependent loading) +! igsigd0 = 1 set varselem(igsigd) to zero in next oasemb +! iaem = 1 if marc is called from aem (0 - off - default) +! icosim = 1 if marc is used in co-simulation analysis with ADAMS using the CosimEngine +! = 2 if marc is used in co-simulation analysis with ADAMS using the ACSI interface +! = 3 if marc is used in co-simulation analysis with scFLOW using the CosimEngine +! = 4 if marc is used in co-simulation analysis with scFLOW and ADAMS using the CosimEngine +! inodels = 1 nodal integration elements 239/240/241 present +! nlharm = 0 harmonic subincrements are linear +! = 1 harmonic subincrements are nonlinear +! iampini = 0 amplitude of previous harmonic subinc is initial estimate (default) +! = 1 zero amplitude is initial estimate +! iphasetr = 1 phase transformation material model is used +! iforminp flag indicating that contact is switched on via the CONTACT +! option in the input file (as opposed to the case that contact +! is switched on internally due to cyclic symmetry or model +! section creation) +! ispecerror = a+10*b (only for spectrum response analysis with missing mass option) +! a=0 or a=1 (modal shape with non-zero shift) +! b=0 or b=1 (recover with new assembly of stiffness matrix) +! icsprg = set to 1 if spring elements present in model +! imol Control flag for molecualr diffusion pass +! imolt Permanent control flag for molecualr diffusion pass +! Note in coupled analysis imolt will remain as one, +! but imol will be zero in stress pass or thermal pass. +! idatafit = run Marc to fit parameters +! iharmpar = 1 if harmonic parameter option is used +! inclcase load case increment use for cyclic plasticity data fitting +! imultifreq flag to indicate how many harmonic magnetodynamic passes are computed in coupled +! magnetodynamic/thermal(/structural) analyses. +! 0 or 1 one pass 2 two passes 3 or more is not supported +! init_elas use elastic stress-strain law as the material tangent for +! the first cycle of an increment +! ifatig packed integer telling which fatigue mode is active +! 1 = elastomer +! 10 = stress-life +! 100 = strain-life +! = 2 strain-life fatigue +! iftgmat = 0 no fatigue material properties in the dat file +! = 1 fatigue material properties in the dat file +! nchybrid cycle count used for hybrid contact; meant to force an extra iteration +! if the overlap for a node in hybrid contact is too large +! ibuckle buckle parameter option is active +! iexpande set to 1 if expanded elements (248, 249, 250 or 251) are +! present, 0 otherwise +! matfor flag for material forces computation +! 0: Eshleby stress and material force vector not requested +! 1: output Eshelby stress tensor, but no material force vector +! 2: output material force vector, but no Eshelby stress tensor +! 3: output Eshelby stress tensor and material force vector +! +!*********************************************************************** +!$omp threadprivate(/marc_concom/) +!! diff --git a/src/Marc/include/creeps2023.1 b/src/Marc/include/creeps2023.1 new file mode 100644 index 000000000..b35d2b6bf --- /dev/null +++ b/src/Marc/include/creeps2023.1 @@ -0,0 +1,73 @@ +! common block definition file taken from respective MSC.Marc release and reformated to free format +!*********************************************************************** +! +! File: creeps.cmn +! +! MSC.Marc include file +! +real(pReal) cptim,timinc,timinc_p,timinc_s,timincm,timinc_a,timinc_b +integer icfte,icfst,icfeq,icftm,icetem,mcreep,jcreep,icpa,icftmp,icfstr,& + icfqcp,icfcpm,icrppr,icrcha,icpb,iicpmt,iicpa +real(pReal) time_beg_lcase,time_beg_inc,fractol,time_beg_pst +real(pReal) fraction_donn,timinc_ol2 +! +integer num_creepsr,num_creepsi,num_creeps2r,ncrp_arry +parameter(num_creepsr=7) +parameter(num_creepsi=17) +parameter(num_creeps2r=6) +parameter(ncrp_arry=7) +common/marc_creeps/cptim,timinc,timinc_p,timinc_s,timincm,timinc_a,timinc_b,icfte,icfst,& + icfeq,icftm,icetem,mcreep,jcreep,icpa,icftmp,icfstr,icfqcp,icfcpm,icrppr,icrcha,icpb,iicpmt,iicpa +common/marc_creeps2/time_beg_lcase,time_beg_inc,fractol,time_beg_pst,fraction_donn,timinc_ol2 +! +! cptim Total time at begining of increment. +! timinc Incremental time for this step. +! icfte Local copy number of slopes of creep strain rate function +! versus temperature. Is -1 if exponent law used. +! icfst Local copy number of slopes of creep strain rate function +! versus equivalent stress. Is -1 if exponent law used. +! icfeq Local copy number of slopes of creep strain rate function +! versus equivalent strain. Is -1 if exponent law used. +! icftm Local copy number of slopes of creep strain rate function +! versus time. Is -1 if exponent law used. +! icetem Element number that needs to be checked for creep convergence +! or, if negative, the number of elements that need to +! be checked. In the latter case the elements to check +! are stored in ielcp. +! mcreep Maximum nuber of iterations for explicit creep. +! jcreep Counter of number of iterations for explicit creep +! procedure. jcreep must be .le. mcreep +! icpa(1-6) Pointer to constants in creep strain rate expression. +! icftmp Pointer to temperature dependent creep strain rate data. +! icfstr Pointer to equivalent stress dependent creep strain rate data. +! icfqcp Pointer to equivalent creep strain dependent creep strain +! rate data. +! icfcpm Pointer to equivalent creep strain rate dependent +! creep strain rate data. +! icrppr Permanent copy of icreep +! icrcha Control flag for creep convergence checking , if set to +! 1 then testing on absolute change in stress and creep +! strain, not relative testing. Input data. +! icpb(1-4) Pointer to storage of material id cross reference numbers. +! iicpmt creep law type ID +! =1 - power law +! =2 - solder +! =3 - steady-creep +! =4 - hyperbolic steady-creep +! iicpa Pointer to table IDs for constants in creep strain rate +! expression +! +! +! time_beg_lcase time at the beginning of the current load case +! time_beg_inc time at the beginning of the current increment +! fractol fraction of loadcase or increment time when we +! consider it to be finished +! time_beg_pst time corresponding to first increment to be +! read in from thermal post file for auto step +! +! timinc_old Time step of the previous increment +! +!*********************************************************************** +!!$omp threadprivate(/marc_creeps/) +!!$omp threadprivate(/marc_creeps2/) +!! From 59ae2875640fbb6278a14b7057c0353e6ac169a5 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Fri, 21 Jul 2023 23:41:12 +0200 Subject: [PATCH 067/198] numerical parameters related to phase state and stress integration --- PRIVATE | 2 +- src/phase.f90 | 55 +++++++++++-------------------------- src/phase_mechanical.f90 | 58 ++++++++++++++++++++++++++++++++-------- 3 files changed, 64 insertions(+), 51 deletions(-) diff --git a/PRIVATE b/PRIVATE index 162106e63..5c93094df 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 162106e6379d484ee101981c66e3f159d2f8821a +Subproject commit 5c93094df289da74588a3b5dd644d31923c9c651 diff --git a/src/phase.f90 b/src/phase.f90 index 573e71069..e264f54ac 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -61,6 +61,7 @@ module phase type :: tNumerics integer :: & iJacoLpresiduum, & !< frequency of Jacobian update of residuum in Lp + iJacoLiresiduum, & !< frequency of Jacobian update of residuum in Li nState, & !< state loop limit nStress !< stress loop limit real(pREAL) :: & @@ -69,9 +70,11 @@ module phase subStepSizeLp, & !< size of first substep when cutback in Lp calculation subStepSizeLi, & !< size of first substep when cutback in Li calculation stepIncreaseCryst, & !< increase of next substep size when previous substep converged - rtol_crystalliteState, & !< relative tolerance in state loop - rtol_crystalliteStress, & !< relative tolerance in stress loop - atol_crystalliteStress !< absolute tolerance in stress loop + rtol_crystalliteState, & + rtol_Lp, & !< relative tolerance in stress loop for Lp + atol_Lp, & !< absolute tolerance in stress loop for Lp + rtol_Li, & !< relative tolerance in stress loop for Li + atol_Li !< absolute tolerance in stress loop for Li end type tNumerics type(tNumerics) :: num ! numerics parameters. Better name? @@ -85,8 +88,8 @@ module phase interface ! == cleaned:begin ================================================================================= - module subroutine mechanical_init(phases) - type(tDict), pointer :: phases + module subroutine mechanical_init(phases,num_mech) + type(tDict), pointer :: phases, num_mech end subroutine mechanical_init module subroutine damage_init @@ -381,7 +384,9 @@ subroutine phase_init ph, ce, co, ma type(tDict), pointer :: & phases, & - phase + phase, & + num_phase, & + num_mech character(len=:), allocatable :: refs @@ -420,7 +425,10 @@ subroutine phase_init phase_O(ph)%data = phase_O_0(ph)%data end do - call mechanical_init(phases) + num_phase => config_numerics%get_dict('phase',defaultVal=emptyDict) + num_mech => num_phase%get_dict('mechanical', defaultVal=emptyDict) + + call mechanical_init(phases,num_mech) call damage_init() call thermal_init(phases) @@ -531,39 +539,8 @@ subroutine crystallite_init() el, & !< counter in element loop en, ph type(tDict), pointer :: & - num_crystallite, & + num_phase, & phases - character(len=:), allocatable :: extmsg - - - num_crystallite => config_numerics%get_dict('crystallite',defaultVal=emptyDict) - - num%subStepMinCryst = num_crystallite%get_asReal ('subStepMin', defaultVal=1.0e-3_pREAL) - num%subStepSizeCryst = num_crystallite%get_asReal ('subStepSize', defaultVal=0.25_pREAL) - num%stepIncreaseCryst = num_crystallite%get_asReal ('stepIncrease', defaultVal=1.5_pREAL) - num%subStepSizeLp = num_crystallite%get_asReal ('subStepSizeLp', defaultVal=0.5_pREAL) - num%subStepSizeLi = num_crystallite%get_asReal ('subStepSizeLi', defaultVal=0.5_pREAL) - num%rtol_crystalliteState = num_crystallite%get_asReal ('rtol_State', defaultVal=1.0e-6_pREAL) - num%rtol_crystalliteStress = num_crystallite%get_asReal ('rtol_Stress', defaultVal=1.0e-6_pREAL) - num%atol_crystalliteStress = num_crystallite%get_asReal ('atol_Stress', defaultVal=1.0e-8_pREAL) - num%iJacoLpresiduum = num_crystallite%get_asInt ('iJacoLpresiduum', defaultVal=1) - num%nState = num_crystallite%get_asInt ('nState', defaultVal=20) - num%nStress = num_crystallite%get_asInt ('nStress', defaultVal=40) - - extmsg = '' - if (num%subStepMinCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' subStepMinCryst' - if (num%subStepSizeCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' subStepSizeCryst' - if (num%stepIncreaseCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' stepIncreaseCryst' - if (num%subStepSizeLp <= 0.0_pREAL) extmsg = trim(extmsg)//' subStepSizeLp' - if (num%subStepSizeLi <= 0.0_pREAL) extmsg = trim(extmsg)//' subStepSizeLi' - if (num%rtol_crystalliteState <= 0.0_pREAL) extmsg = trim(extmsg)//' rtol_crystalliteState' - if (num%rtol_crystalliteStress <= 0.0_pREAL) extmsg = trim(extmsg)//' rtol_crystalliteStress' - if (num%atol_crystalliteStress <= 0.0_pREAL) extmsg = trim(extmsg)//' atol_crystalliteStress' - if (num%iJacoLpresiduum < 1) extmsg = trim(extmsg)//' iJacoLpresiduum' - if (num%nState < 1) extmsg = trim(extmsg)//' nState' - if (num%nStress < 1) extmsg = trim(extmsg)//' nStress' - - if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) phases => config_material%get_dict('phase') diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 0f931517a..f131c552b 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -198,10 +198,11 @@ contains !> @brief Initialize mechanical field related constitutive models !> @details Initialize elasticity, plasticity and stiffness degradation models. !-------------------------------------------------------------------------------------------------- -module subroutine mechanical_init(phases) +module subroutine mechanical_init(phases, num_mech) type(tDict), pointer :: & - phases + phases, & + num_mech integer :: & ce, & @@ -211,9 +212,11 @@ module subroutine mechanical_init(phases) en, & Nmembers type(tDict), pointer :: & - num_crystallite, & phase, & - mech + mech, & + num_mech_plastic, & + num_mech_eigen + character(len=:), allocatable :: extmsg print'(/,1x,a)', '<<<+- phase:mechanical init -+>>>' @@ -289,9 +292,42 @@ module subroutine mechanical_init(phases) plasticState(ph)%state0 = plasticState(ph)%state end do - num_crystallite => config_numerics%get_dict('crystallite',defaultVal=emptyDict) + num_mech_plastic => num_mech%get_dict('plastic', defaultVal=emptyDict) + num_mech_eigen => num_mech%get_dict('eigen', defaultVal=emptyDict) - select case(num_crystallite%get_asStr('integrator',defaultVal='FPI')) + num%subStepMinCryst = num_mech%get_asReal ('sub_step_min', defaultVal=1.0e-3_pREAL) + num%subStepSizeCryst = num_mech%get_asReal ('sub_step_size', defaultVal=0.25_pREAL) + num%stepIncreaseCryst = num_mech%get_asReal ('step_increase', defaultVal=1.5_pREAL) + num%rtol_crystalliteState = num_mech%get_asReal ('eps_rel_state', defaultVal=1.0e-6_pREAL) + num%nState = num_mech%get_asInt ('N_iter_state_max', defaultVal=20) + num%nStress = num_mech%get_asInt ('N_iter_stress_max', defaultVal=40) + num%subStepSizeLp = num_mech_plastic%get_asReal ('sub_step_size_Lp', defaultVal=0.5_pREAL) + num%rtol_Lp = num_mech_plastic%get_asReal ('eps_rel_Lp', defaultVal=1.0e-6_pREAL) + num%atol_Lp = num_mech_plastic%get_asReal ('eps_abs_Lp', defaultVal=1.0e-8_pREAL) + num%iJacoLpresiduum = num_mech_plastic%get_asInt ('f_update_jacobi_Lp', defaultVal=1) + num%subStepSizeLi = num_mech_eigen%get_asReal ('sub_step_size_Li', defaultVal=0.5_pREAL) + num%rtol_Li = num_mech_eigen%get_asReal ('eps_rel_Li', defaultVal=num%rtol_Lp) + num%atol_Li = num_mech_eigen%get_asReal ('eps_abs_Li', defaultVal=num%atol_Lp) + num%iJacoLiresiduum = num_mech_eigen%get_asInt ('f_update_jacobi_Li', defaultVal=num%iJacoLpresiduum) + + extmsg = '' + if (num%subStepMinCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_min' + if (num%subStepSizeCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size' + if (num%stepIncreaseCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' step_increase' + if (num%subStepSizeLp <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size_Lp' + if (num%subStepSizeLi <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size_Li' + if (num%rtol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' epl_rel_Lp' + if (num%atol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Lp' + if (num%rtol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_Li' + if (num%atol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Li' + if (num%iJacoLpresiduum < 1) extmsg = trim(extmsg)//' f_jacobi_residuum_update_Lp' + if (num%iJacoLiresiduum < 1) extmsg = trim(extmsg)//' f_jacobi_residuum_update_Li' + if (num%nState < 1) extmsg = trim(extmsg)//' N_iter_state_max' + if (num%nStress < 1) extmsg = trim(extmsg)//' N_iter_stress_max' + + if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) + + select case(num_mech_plastic%get_asStr('integrator_state',defaultVal='FPI')) case('FPI') integrateState => integrateStateFPI @@ -458,8 +494,8 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) S, Fi_new, ph,en) !* update current residuum and check for convergence of loop - atol_Lp = max(num%rtol_crystalliteStress * max(norm2(Lpguess),norm2(Lp_constitutive)), & ! absolute tolerance from largest acceptable relative error - num%atol_crystalliteStress) ! minimum lower cutoff + atol_Lp = max(num%rtol_Lp * max(norm2(Lpguess),norm2(Lp_constitutive)), & ! absolute tolerance from largest acceptable relative error + num%atol_Lp) ! minimum lower cutoff residuumLp = Lpguess - Lp_constitutive if (any(IEEE_is_NaN(residuumLp))) then @@ -499,8 +535,8 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) S, Fi_new, ph,en) !* update current residuum and check for convergence of loop - atol_Li = max(num%rtol_crystalliteStress * max(norm2(Liguess),norm2(Li_constitutive)), & ! absolute tolerance from largest acceptable relative error - num%atol_crystalliteStress) ! minimum lower cutoff + atol_Li = max(num%rtol_Li * max(norm2(Liguess),norm2(Li_constitutive)), & ! absolute tolerance from largest acceptable relative error + num%atol_Li) ! minimum lower cutoff residuumLi = Liguess - Li_constitutive if (any(IEEE_is_NaN(residuumLi))) then return ! error @@ -517,7 +553,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) cycle LiLoop end if - calculateJacobiLi: if (mod(jacoCounterLi, num%iJacoLpresiduum) == 0) then + calculateJacobiLi: if (mod(jacoCounterLi, num%iJacoLiresiduum) == 0) then jacoCounterLi = jacoCounterLi + 1 temp_33 = matmul(matmul(A,B),invFi_current) From d8a1d287975d5f23739da3bd03cdf699defdd3b6 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Mon, 24 Jul 2023 17:06:07 +0200 Subject: [PATCH 068/198] actually use new version --- .gitlab-ci.yml | 2 +- python/damask/solver/_marc.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f270450fb..9c04c7b1d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ variables: PETSC_INTELLLVM: "Libraries/PETSc/3.16.3/oneAPI-2022.0.1-IntelMPI-2021.5.0" PETSC_INTEL: "Libraries/PETSc/3.16.5/Intel-2022.0.1-IntelMPI-2021.5.0" # ++++++++++++ MSC Marc +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - MSC: "FEM/MSC/2022.4" + MSC: "FEM/MSC/2023.1" IntelMarc: "Compiler/Intel/19.1.2 Libraries/IMKL/2020" HDF5Marc: "HDF5/1.12.2/Intel-19.1.2" diff --git a/python/damask/solver/_marc.py b/python/damask/solver/_marc.py index 18bd56e49..c07876c93 100644 --- a/python/damask/solver/_marc.py +++ b/python/damask/solver/_marc.py @@ -4,7 +4,7 @@ import re from pathlib import Path from typing import Literal -_marc_version = '2022.4' +_marc_version = '2023.1' _marc_root = '/opt/msc' _damask_root = str(Path(__file__).parents[3]) From d953e6bedf687a0f4d56079b48bb2a33519250b4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 Jul 2023 18:29:36 +0200 Subject: [PATCH 069/198] unified style --- src/homogenization_damage.f90 | 2 +- src/homogenization_thermal.f90 | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/homogenization_damage.f90 b/src/homogenization_damage.f90 index 233425ebe..7e83c34d8 100644 --- a/src/homogenization_damage.f90 +++ b/src/homogenization_damage.f90 @@ -158,7 +158,7 @@ module subroutine homogenization_set_phi(phi) integer :: ho, en, ce - do ce=1, ubound(phi,1) + do ce=lbound(phi,1), ubound(phi,1) ho = material_ID_homogenization(ce) en = material_entry_homogenization(ce) damagestate_h(ho)%state(1,en) = phi(ce) diff --git a/src/homogenization_thermal.f90 b/src/homogenization_thermal.f90 index 791286912..069c402eb 100644 --- a/src/homogenization_thermal.f90 +++ b/src/homogenization_thermal.f90 @@ -177,12 +177,14 @@ module subroutine homogenization_thermal_setField(T,dot_T) real(pREAL), dimension(:), intent(in) :: T, dot_T - integer :: ce + integer :: ho, en, ce - do ce=1, min(ubound(T,1),ubound(dot_T,1)) - current(material_ID_homogenization(ce))%T(material_entry_homogenization(ce)) = T(ce) - current(material_ID_homogenization(ce))%dot_T(material_entry_homogenization(ce)) = dot_T(ce) + do ce=max(lbound(T,1),lbound(dot_T,1)), min(ubound(T,1),ubound(dot_T,1)) + ho = material_ID_homogenization(ce) + en = material_entry_homogenization(ce) + current(ho)%T(en) = T(ce) + current(ho)%dot_T(en) = dot_T(ce) call thermal_partition(ce) end do From 039d5e0fce7b408ff5907a721c8c994e9c33720e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 Jul 2023 18:30:02 +0200 Subject: [PATCH 070/198] improved comments and naming --- src/phase.f90 | 5 +++-- src/phase_damage.f90 | 3 ++- src/phase_mechanical_eigen.f90 | 9 +++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index 7dbaa9f7c..ab365dbd6 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -68,9 +68,10 @@ module phase integer(kind(UNDEFINED)), dimension(:), allocatable :: & mechanical_plasticity_type, & !< plasticity of each phase - damage_type !< active sources mechanisms of each phase + damage_type !< damage type of each phase integer(kind(UNDEFINED)), dimension(:,:), allocatable :: & - thermal_source_type + thermal_source_type, & + mechanical_eigen_kinematics_type character(len=2), allocatable, dimension(:) :: phase_lattice real(pREAL), allocatable, dimension(:) :: phase_cOverA diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 44c52bc80..2c605c963 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -195,13 +195,14 @@ module function phase_f_phi(phi,co,ce) result(f) ph, & en + ph = material_ID_phase(co,ce) en = material_entry_phase(co,ce) select case(damage_type(ph)) case(DAMAGE_ISOBRITTLE,DAMAGE_ANISOBRITTLE) f = 1.0_pREAL & - - 2.0_pREAL * phi*damageState(ph)%state(1,en) + - 2.0_pREAL * phi*damageState(ph)%state(1,en) ! ToDo: MD: seems to be phi**2 case default f = 0.0_pREAL end select diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 4d5771cca..5bdb57f57 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -3,9 +3,6 @@ submodule(phase:mechanical) eigen integer, dimension(:), allocatable :: & Nmodels - integer(kind(UNDEFINED)), dimension(:,:), allocatable :: & - model - interface module function thermalexpansion_init(kinematics_length) result(myKinematics) @@ -55,10 +52,10 @@ module subroutine eigen_init(phases) Nmodels(ph) = kinematics%length end do - allocate(model(maxval(Nmodels),phases%length), source = UNDEFINED) + allocate(mechanical_eigen_kinematics_type(maxval(Nmodels),phases%length), source = UNDEFINED) if (maxval(Nmodels) /= 0) then - where(thermalexpansion_init(maxval(Nmodels))) model = MECHANICAL_EIGEN_THERMALEXPANSION + where(thermalexpansion_init(maxval(Nmodels))) mechanical_eigen_kinematics_type = MECHANICAL_EIGEN_THERMALEXPANSION end if end subroutine eigen_init @@ -164,7 +161,7 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & KinematicsLoop: do k = 1, Nmodels(ph) - kinematicsType: select case (model(k,ph)) + kinematicsType: select case (mechanical_eigen_kinematics_type(k,ph)) case (MECHANICAL_EIGEN_THERMALEXPANSION) kinematicsType call thermalexpansion_LiAndItsTangent(my_Li, my_dLi_dS, ph,en) Li = Li + my_Li From 33e0048010d4a7b9cf67aae777d78cff6d6eec0a Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Mon, 24 Jul 2023 21:03:35 +0200 Subject: [PATCH 071/198] subStep ---> step --- src/phase.f90 | 8 ++-- src/phase_mechanical.f90 | 86 ++++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index e264f54ac..46b5c052e 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -65,10 +65,10 @@ module phase nState, & !< state loop limit nStress !< stress loop limit real(pREAL) :: & - subStepMinCryst, & !< minimum (relative) size of sub-step allowed during cutback - subStepSizeCryst, & !< size of first substep when cutback - subStepSizeLp, & !< size of first substep when cutback in Lp calculation - subStepSizeLi, & !< size of first substep when cutback in Li calculation + stepMinCryst, & !< minimum (relative) size of sub-step allowed during cutback + stepSizeCryst, & !< size of first substep when cutback + stepSizeLp, & !< size of first substep when cutback in Lp calculation + stepSizeLi, & !< size of first substep when cutback in Li calculation stepIncreaseCryst, & !< increase of next substep size when previous substep converged rtol_crystalliteState, & rtol_Lp, & !< relative tolerance in stress loop for Lp diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index f131c552b..91b373a0e 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -295,35 +295,35 @@ module subroutine mechanical_init(phases, num_mech) num_mech_plastic => num_mech%get_dict('plastic', defaultVal=emptyDict) num_mech_eigen => num_mech%get_dict('eigen', defaultVal=emptyDict) - num%subStepMinCryst = num_mech%get_asReal ('sub_step_min', defaultVal=1.0e-3_pREAL) - num%subStepSizeCryst = num_mech%get_asReal ('sub_step_size', defaultVal=0.25_pREAL) - num%stepIncreaseCryst = num_mech%get_asReal ('step_increase', defaultVal=1.5_pREAL) - num%rtol_crystalliteState = num_mech%get_asReal ('eps_rel_state', defaultVal=1.0e-6_pREAL) - num%nState = num_mech%get_asInt ('N_iter_state_max', defaultVal=20) - num%nStress = num_mech%get_asInt ('N_iter_stress_max', defaultVal=40) - num%subStepSizeLp = num_mech_plastic%get_asReal ('sub_step_size_Lp', defaultVal=0.5_pREAL) - num%rtol_Lp = num_mech_plastic%get_asReal ('eps_rel_Lp', defaultVal=1.0e-6_pREAL) - num%atol_Lp = num_mech_plastic%get_asReal ('eps_abs_Lp', defaultVal=1.0e-8_pREAL) - num%iJacoLpresiduum = num_mech_plastic%get_asInt ('f_update_jacobi_Lp', defaultVal=1) - num%subStepSizeLi = num_mech_eigen%get_asReal ('sub_step_size_Li', defaultVal=0.5_pREAL) - num%rtol_Li = num_mech_eigen%get_asReal ('eps_rel_Li', defaultVal=num%rtol_Lp) - num%atol_Li = num_mech_eigen%get_asReal ('eps_abs_Li', defaultVal=num%atol_Lp) - num%iJacoLiresiduum = num_mech_eigen%get_asInt ('f_update_jacobi_Li', defaultVal=num%iJacoLpresiduum) + num%stepMinCryst = num_mech%get_asReal ('step_min', defaultVal=1.0e-3_pREAL) + num%stepSizeCryst = num_mech%get_asReal ('step_size', defaultVal=0.25_pREAL) + num%stepIncreaseCryst = num_mech%get_asReal ('step_increase', defaultVal=1.5_pREAL) + num%rtol_crystalliteState = num_mech%get_asReal ('eps_rel_state', defaultVal=1.0e-6_pREAL) + num%nState = num_mech%get_asInt ('N_iter_state_max', defaultVal=20) + num%nStress = num_mech%get_asInt ('N_iter_stress_max', defaultVal=40) + num%stepSizeLp = num_mech_plastic%get_asReal ('step_size_Lp', defaultVal=0.5_pREAL) + num%rtol_Lp = num_mech_plastic%get_asReal ('eps_rel_Lp', defaultVal=1.0e-6_pREAL) + num%atol_Lp = num_mech_plastic%get_asReal ('eps_abs_Lp', defaultVal=1.0e-8_pREAL) + num%iJacoLpresiduum = num_mech_plastic%get_asInt ('f_update_jacobi_Lp', defaultVal=1) + num%stepSizeLi = num_mech_eigen%get_asReal ('step_size_Li', defaultVal=0.5_pREAL) + num%rtol_Li = num_mech_eigen%get_asReal ('eps_rel_Li', defaultVal=num%rtol_Lp) + num%atol_Li = num_mech_eigen%get_asReal ('eps_abs_Li', defaultVal=num%atol_Lp) + num%iJacoLiresiduum = num_mech_eigen%get_asInt ('f_update_jacobi_Li', defaultVal=num%iJacoLpresiduum) extmsg = '' - if (num%subStepMinCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_min' - if (num%subStepSizeCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size' - if (num%stepIncreaseCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' step_increase' - if (num%subStepSizeLp <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size_Lp' - if (num%subStepSizeLi <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size_Li' - if (num%rtol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' epl_rel_Lp' - if (num%atol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Lp' - if (num%rtol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_Li' - if (num%atol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Li' - if (num%iJacoLpresiduum < 1) extmsg = trim(extmsg)//' f_jacobi_residuum_update_Lp' - if (num%iJacoLiresiduum < 1) extmsg = trim(extmsg)//' f_jacobi_residuum_update_Li' - if (num%nState < 1) extmsg = trim(extmsg)//' N_iter_state_max' - if (num%nStress < 1) extmsg = trim(extmsg)//' N_iter_stress_max' + if (num%stepMinCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_min' + if (num%stepSizeCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size' + if (num%stepIncreaseCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' step_increase' + if (num%stepSizeLp <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size_Lp' + if (num%stepSizeLi <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size_Li' + if (num%rtol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' epl_rel_Lp' + if (num%atol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Lp' + if (num%rtol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_Li' + if (num%atol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Li' + if (num%iJacoLpresiduum < 1) extmsg = trim(extmsg)//' f_jacobi_residuum_update_Lp' + if (num%iJacoLiresiduum < 1) extmsg = trim(extmsg)//' f_jacobi_residuum_update_Li' + if (num%nState < 1) extmsg = trim(extmsg)//' N_iter_state_max' + if (num%nStress < 1) extmsg = trim(extmsg)//' N_iter_stress_max' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) @@ -507,7 +507,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) Lpguess_old = Lpguess steplengthLp = 1.0_pREAL ! ...proceed with normal step length (calculate new search direction) else ! not converged and residuum not improved... - steplengthLp = num%subStepSizeLp * steplengthLp ! ...try with smaller step length in same direction + steplengthLp = num%stepSizeLp * steplengthLp ! ...try with smaller step length in same direction Lpguess = Lpguess_old & + deltaLp * stepLengthLp cycle LpLoop @@ -547,7 +547,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) Liguess_old = Liguess steplengthLi = 1.0_pREAL ! ...proceed with normal step length (calculate new search direction) else ! not converged and residuum not improved... - steplengthLi = num%subStepSizeLi * steplengthLi ! ...try with smaller step length in same direction + steplengthLi = num%stepSizeLi * steplengthLi ! ...try with smaller step length in same direction Liguess = Liguess_old & + deltaLi * steplengthLi cycle LiLoop @@ -1029,11 +1029,11 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_) logical :: converged_ real(pREAL) :: & - formerSubStep + formerStep integer :: & ph, en, sizeDotState logical :: todo - real(pREAL) :: subFrac,subStep + real(pREAL) :: stepFrac,step real(pREAL), dimension(3,3) :: & subFp0, & subFi0, & @@ -1053,20 +1053,20 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_) subFp0 = phase_mechanical_Fp0(ph)%data(1:3,1:3,en) subFi0 = phase_mechanical_Fi0(ph)%data(1:3,1:3,en) subF0 = phase_mechanical_F0(ph)%data(1:3,1:3,en) - subFrac = 0.0_pREAL + stepFrac = 0.0_pREAL todo = .true. - subStep = 1.0_pREAL/num%subStepSizeCryst - converged_ = .false. ! pretend failed step of 1/subStepSizeCryst + step = 1.0_pREAL/num%stepSizeCryst + converged_ = .false. ! pretend failed step of 1/stepSizeCryst todo = .true. cutbackLooping: do while (todo) if (converged_) then - formerSubStep = subStep - subFrac = subFrac + subStep - subStep = min(1.0_pREAL - subFrac, num%stepIncreaseCryst * subStep) + formerStep = step + stepFrac = stepFrac + step + step = min(1.0_pREAL - stepFrac, num%stepIncreaseCryst * step) - todo = subStep > 0.0_pREAL ! still time left to integrate on? + todo = step > 0.0_pREAL ! still time left to integrate on? if (todo) then subF0 = subF @@ -1079,16 +1079,16 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_) !-------------------------------------------------------------------------------------------------- ! cut back (reduced time and restore) else - subStep = num%subStepSizeCryst * subStep + step = num%stepSizeCryst * step phase_mechanical_Fp(ph)%data(1:3,1:3,en) = subFp0 phase_mechanical_Fi(ph)%data(1:3,1:3,en) = subFi0 phase_mechanical_S(ph)%data(1:3,1:3,en) = phase_mechanical_S0(ph)%data(1:3,1:3,en) - if (subStep < 1.0_pREAL) then ! actual (not initial) cutback + if (step < 1.0_pREAL) then ! actual (not initial) cutback phase_mechanical_Lp(ph)%data(1:3,1:3,en) = subLp0 phase_mechanical_Li(ph)%data(1:3,1:3,en) = subLi0 end if plasticState(ph)%state(:,en) = subState0 - todo = subStep > num%subStepMinCryst ! still on track or already done (beyond repair) + todo = step > num%stepMinCryst ! still on track or already done (beyond repair) end if !-------------------------------------------------------------------------------------------------- @@ -1096,8 +1096,8 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_) if (todo) then sizeDotState = plasticState(ph)%sizeDotState subF = subF0 & - + subStep * (phase_mechanical_F(ph)%data(1:3,1:3,en) - phase_mechanical_F0(ph)%data(1:3,1:3,en)) - converged_ = .not. integrateState(subF0,subF,subFp0,subFi0,subState0(1:sizeDotState),subStep * Delta_t,ph,en) + + step * (phase_mechanical_F(ph)%data(1:3,1:3,en) - phase_mechanical_F0(ph)%data(1:3,1:3,en)) + converged_ = .not. integrateState(subF0,subF,subFp0,subFi0,subState0(1:sizeDotState),step * Delta_t,ph,en) end if end do cutbackLooping From 94cd462c84e9470552712a13ace4342d87e3447c Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Tue, 25 Jul 2023 10:42:35 +0200 Subject: [PATCH 072/198] safe_cray_pointer is deprecheated --- .../MarcMentat/2023.1/Marc_tools/include_linux64.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/MarcMentat/2023.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2023.1/Marc_tools/include_linux64.patch index adea45976..7ef6f3d66 100644 --- a/install/MarcMentat/2023.1/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2023.1/Marc_tools/include_linux64.patch @@ -21,7 +21,7 @@ fi -FORT_OPT="-c -assume byterecl -safe-cray-ptr -mp1 -WB -fp-model source" -+FORT_OPT="-c -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr -mp1 -WB -fp-model source" ++FORT_OPT="-c -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe-cray-ptr -mp1 -WB -fp-model source" if test "$MTHREAD" = "OPENMP" then FORT_OPT=" $FORT_OPT -qopenmp" @@ -48,15 +48,15 @@ +fi + +# DAMASK compiler calls -+DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe-cray-ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2023.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" -+DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe-cray-ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2023.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" -+DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe-cray-ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2023.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" From c4134f2358bcd0a7ba9b079bfdbb6648b936bffd Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Tue, 25 Jul 2023 11:04:38 +0200 Subject: [PATCH 073/198] updated examples --- examples/config/numerics.yaml | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index a0c7cb6b0..dcf330073 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -71,19 +71,26 @@ mesh: eps_struct_atol: 1.0e-10 # absolute tolerance for mechanical equilibrium eps_struct_rtol: 1.0e-4 # relative tolerance for mechanical equilibrium -crystallite: - subStepMin: 1.0e-3 # minimum (relative) size of sub-step allowed during cutback in crystallite - subStepSize: 0.25 # size of substep when cutback introduced in crystallite (value between 0 and 1) - stepIncrease: 1.5 # increase of next substep size when previous substep converged in crystallite (value higher than 1) - subStepSizeLp: 0.5 # size of first substep when cutback in Lp calculation - subStepSizeLi: 0.5 # size of first substep when cutback in Li calculation - nState: 10 # state loop limit - nStress: 40 # stress loop limit - rtol_State: 1.0e-6 # relative tolerance in crystallite state loop (abs tol provided by constitutive law) - rtol_Stress: 1.0e-6 # relative tolerance in crystallite stress loop (Lp residuum) - atol_Stress: 1.0e-8 # absolute tolerance in crystallite stress loop (Lp residuum!) - integrator: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) - iJacoLpresiduum: 1 # frequency of Jacobian update of residuum in Lp +phase: + mechanical: + step_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in crystallite + step_size: 0.25 # size of step when cutback introduced in crystallite (value between 0 and 1) + step_increase: 1.5 # increase of next step size when previous step converged in crystallite (value higher than 1) + eps_rel_state: 1.0e-6 # relative tolerance in crystallite state loop (abs tol provided by constitutive law) + N_iter_state_max: 10 # state loop limit + N_iter_stress_max: 40 # stress loop limit + + plastic: + step_size_Lp: 0.5 # size of first substep when cutback in Lp calculation + eps_rel_Lp: 1.0e-6 # relative tolerance in crystallite stress loop (Lp residuum) + eps_abs_Lp: 1.0e-8 # absolute tolerance in crystallite stress loop (Lp residuum!) + f_update_jacobi_Lp: 1 # frequency of Jacobian update of residuum in Lp + integrator_state: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) + eigen: + step_size_Li: 0.5 # size of first substep when cutback in Li calculation + eps_rel_Li: 1.0e-6 # relative tolerance in crystallite stress loop (Li residuum) + eps_abs_Li: 1.0e-8 # absolute tolerance in crystallite stress loop (Li residuum!) + f_update_jacobi_Li: 1 # frequency of Jacobian update of residuum in Li commercialFEM: unitlength: 1 # physical length of one computational length unit From d4019ec0ef8162e53d563b84de172e9545d6c7be Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 25 Jul 2023 15:09:59 +0200 Subject: [PATCH 074/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-687-gee8876abd --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4c43855b5..8c08faef8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-671-g0cace1ef8 +3.0.0-alpha7-687-gee8876abd From 2547d4a25cfc2a9082687e04e23de3fd7d95eda7 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Tue, 25 Jul 2023 23:04:29 +0200 Subject: [PATCH 075/198] clear names --- examples/config/numerics.yaml | 23 ++++++++++++----------- src/phase.f90 | 3 ++- src/phase_mechanical.f90 | 30 ++++++++++++++++-------------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index dcf330073..ac37e7e08 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -73,23 +73,24 @@ mesh: phase: mechanical: - step_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in crystallite - step_size: 0.25 # size of step when cutback introduced in crystallite (value between 0 and 1) - step_increase: 1.5 # increase of next step size when previous step converged in crystallite (value higher than 1) - eps_rel_state: 1.0e-6 # relative tolerance in crystallite state loop (abs tol provided by constitutive law) + step_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in phase state calculation + r_cutback_step: 0.25 # factor to decrease size of step when cutback introduced in phase state calculation (value between 0 and 1) + r_increase_step: 1.5 # factor to increase size of next step when previous step converged in phase state calculation + eps_rel_state: 1.0e-6 # relative tolerance in phase state loop (abs tol provided by constitutive law) N_iter_state_max: 10 # state loop limit - N_iter_stress_max: 40 # stress loop limit plastic: - step_size_Lp: 0.5 # size of first substep when cutback in Lp calculation - eps_rel_Lp: 1.0e-6 # relative tolerance in crystallite stress loop (Lp residuum) - eps_abs_Lp: 1.0e-8 # absolute tolerance in crystallite stress loop (Lp residuum!) + r_cutback_step_Lp: 0.5 # factor to decrease the step when cutback in Lp calculation + eps_rel_Lp: 1.0e-6 # relative tolerance in phase stress loop (Lp residuum) + eps_abs_Lp: 1.0e-8 # absolute tolerance in phase stress loop (Lp residuum) + N_iter_Lp_max: 40 # stress loop limit for Lp f_update_jacobi_Lp: 1 # frequency of Jacobian update of residuum in Lp integrator_state: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) eigen: - step_size_Li: 0.5 # size of first substep when cutback in Li calculation - eps_rel_Li: 1.0e-6 # relative tolerance in crystallite stress loop (Li residuum) - eps_abs_Li: 1.0e-8 # absolute tolerance in crystallite stress loop (Li residuum!) + r_cutback_step_Li: 0.5 # factor to decrease the step when cutback in Li calculation + eps_rel_Li: 1.0e-6 # relative tolerance in phase stress loop (Li residuum) + eps_abs_Li: 1.0e-8 # absolute tolerance in phase stress loop (Li residuum) + N_iter_Li_max: 40 # stress loop limit for Li f_update_jacobi_Li: 1 # frequency of Jacobian update of residuum in Li commercialFEM: diff --git a/src/phase.f90 b/src/phase.f90 index c233049f5..4b01c6ef0 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -86,7 +86,8 @@ module phase iJacoLpresiduum, & !< frequency of Jacobian update of residuum in Lp iJacoLiresiduum, & !< frequency of Jacobian update of residuum in Li nState, & !< state loop limit - nStress !< stress loop limit + nStress_Lp, & !< stress loop limit for Lp + nStress_Li !< stress loop limit for Li real(pREAL) :: & stepMinCryst, & !< minimum (relative) size of sub-step allowed during cutback stepSizeCryst, & !< size of first substep when cutback diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index e65745121..ddd31cbcc 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -278,34 +278,36 @@ module subroutine mechanical_init(phases, num_mech) num_mech_eigen => num_mech%get_dict('eigen', defaultVal=emptyDict) num%stepMinCryst = num_mech%get_asReal ('step_min', defaultVal=1.0e-3_pREAL) - num%stepSizeCryst = num_mech%get_asReal ('step_size', defaultVal=0.25_pREAL) - num%stepIncreaseCryst = num_mech%get_asReal ('step_increase', defaultVal=1.5_pREAL) + num%stepSizeCryst = num_mech%get_asReal ('r_cutback_step', defaultVal=0.25_pREAL) + num%stepIncreaseCryst = num_mech%get_asReal ('r_increase_step', defaultVal=1.5_pREAL) num%rtol_crystalliteState = num_mech%get_asReal ('eps_rel_state', defaultVal=1.0e-6_pREAL) num%nState = num_mech%get_asInt ('N_iter_state_max', defaultVal=20) - num%nStress = num_mech%get_asInt ('N_iter_stress_max', defaultVal=40) - num%stepSizeLp = num_mech_plastic%get_asReal ('step_size_Lp', defaultVal=0.5_pREAL) + num%nStress_Lp = num_mech_plastic%get_asInt ('N_iter_Lp_max', defaultVal=40) + num%stepSizeLp = num_mech_plastic%get_asReal ('r_cutback_step_Lp', defaultVal=0.5_pREAL) num%rtol_Lp = num_mech_plastic%get_asReal ('eps_rel_Lp', defaultVal=1.0e-6_pREAL) num%atol_Lp = num_mech_plastic%get_asReal ('eps_abs_Lp', defaultVal=1.0e-8_pREAL) num%iJacoLpresiduum = num_mech_plastic%get_asInt ('f_update_jacobi_Lp', defaultVal=1) - num%stepSizeLi = num_mech_eigen%get_asReal ('step_size_Li', defaultVal=0.5_pREAL) + num%nStress_Li = num_mech_eigen%get_asInt ('N_iter_Li_max', defaultVal=40) + num%stepSizeLi = num_mech_eigen%get_asReal ('r_cutback_step_Li', defaultVal=0.5_pREAL) num%rtol_Li = num_mech_eigen%get_asReal ('eps_rel_Li', defaultVal=num%rtol_Lp) num%atol_Li = num_mech_eigen%get_asReal ('eps_abs_Li', defaultVal=num%atol_Lp) num%iJacoLiresiduum = num_mech_eigen%get_asInt ('f_update_jacobi_Li', defaultVal=num%iJacoLpresiduum) extmsg = '' if (num%stepMinCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_min' - if (num%stepSizeCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size' - if (num%stepIncreaseCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' step_increase' - if (num%stepSizeLp <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size_Lp' - if (num%stepSizeLi <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_size_Li' + if (num%stepSizeCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' r_cutback_step' + if (num%stepIncreaseCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' r_increase_step' + if (num%stepSizeLp <= 0.0_pREAL) extmsg = trim(extmsg)//' r_cutback_step_Lp' + if (num%stepSizeLi <= 0.0_pREAL) extmsg = trim(extmsg)//' r_cutback_step_Li' if (num%rtol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' epl_rel_Lp' if (num%atol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Lp' if (num%rtol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_Li' if (num%atol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Li' - if (num%iJacoLpresiduum < 1) extmsg = trim(extmsg)//' f_jacobi_residuum_update_Lp' - if (num%iJacoLiresiduum < 1) extmsg = trim(extmsg)//' f_jacobi_residuum_update_Li' + if (num%iJacoLpresiduum < 1) extmsg = trim(extmsg)//' f_update_jacobi_Lp' + if (num%iJacoLiresiduum < 1) extmsg = trim(extmsg)//' f_update_jacobi_Li' if (num%nState < 1) extmsg = trim(extmsg)//' N_iter_state_max' - if (num%nStress < 1) extmsg = trim(extmsg)//' N_iter_stress_max' + if (num%nStress_Lp < 1) extmsg = trim(extmsg)//' N_iter_Lp_max' + if (num%nStress_Li < 1) extmsg = trim(extmsg)//' N_iter_Li_max' if (extmsg /= '') call IO_error(301,ext_msg=trim(extmsg)) @@ -452,7 +454,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) NiterationStressLi = 0 LiLoop: do NiterationStressLi = NiterationStressLi + 1 - if (NiterationStressLi>num%nStress) return ! error + if (NiterationStressLi>num%nStress_Li) return ! error invFi_new = matmul(invFi_current,math_I3 - Delta_t*Liguess) Fi_new = math_inv33(invFi_new) @@ -465,7 +467,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) NiterationStressLp = 0 LpLoop: do NiterationStressLp = NiterationStressLp + 1 - if (NiterationStressLp>num%nStress) return ! error + if (NiterationStressLp>num%nStress_Lp) return ! error B = math_I3 - Delta_t*Lpguess Fe = matmul(matmul(A,B), invFi_new) From af2a4c6e7290853cc2d0e5c2ca6b6aba9ca81123 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Tue, 25 Jul 2023 23:13:00 +0200 Subject: [PATCH 076/198] more readable --- examples/config/numerics.yaml | 18 ++-- src/phase_mechanical.f90 | 150 +++++++++++++++++----------------- 2 files changed, 84 insertions(+), 84 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index ac37e7e08..97885311d 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -73,23 +73,23 @@ mesh: phase: mechanical: - step_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in phase state calculation - r_cutback_step: 0.25 # factor to decrease size of step when cutback introduced in phase state calculation (value between 0 and 1) - r_increase_step: 1.5 # factor to increase size of next step when previous step converged in phase state calculation + r_cutback_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in phase state calculation + r_cutback: 0.25 # factor to decrease size of step when cutback introduced in phase state calculation (value between 0 and 1) + r_increase: 1.5 # factor to increase size of next step when previous step converged in phase state calculation eps_rel_state: 1.0e-6 # relative tolerance in phase state loop (abs tol provided by constitutive law) N_iter_state_max: 10 # state loop limit plastic: - r_cutback_step_Lp: 0.5 # factor to decrease the step when cutback in Lp calculation - eps_rel_Lp: 1.0e-6 # relative tolerance in phase stress loop (Lp residuum) - eps_abs_Lp: 1.0e-8 # absolute tolerance in phase stress loop (Lp residuum) + r_linesearch_Lp: 0.5 # factor to decrease the step due to non-convergence in Lp calculation + eps_rel_Lp: 1.0e-6 # relative tolerance in Lp residuum + eps_abs_Lp: 1.0e-8 # absolute tolerance in Lp residuum N_iter_Lp_max: 40 # stress loop limit for Lp f_update_jacobi_Lp: 1 # frequency of Jacobian update of residuum in Lp integrator_state: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) eigen: - r_cutback_step_Li: 0.5 # factor to decrease the step when cutback in Li calculation - eps_rel_Li: 1.0e-6 # relative tolerance in phase stress loop (Li residuum) - eps_abs_Li: 1.0e-8 # absolute tolerance in phase stress loop (Li residuum) + r_linesearch_Li: 0.5 # factor to decrease the step due to non-convergence in Li calculation + eps_rel_Li: 1.0e-6 # relative tolerance in Li residuum + eps_abs_Li: 1.0e-8 # absolute tolerance in Li residuum N_iter_Li_max: 40 # stress loop limit for Li f_update_jacobi_Li: 1 # frequency of Jacobian update of residuum in Li diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index ddd31cbcc..e7103bedc 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -277,28 +277,28 @@ module subroutine mechanical_init(phases, num_mech) num_mech_plastic => num_mech%get_dict('plastic', defaultVal=emptyDict) num_mech_eigen => num_mech%get_dict('eigen', defaultVal=emptyDict) - num%stepMinCryst = num_mech%get_asReal ('step_min', defaultVal=1.0e-3_pREAL) - num%stepSizeCryst = num_mech%get_asReal ('r_cutback_step', defaultVal=0.25_pREAL) - num%stepIncreaseCryst = num_mech%get_asReal ('r_increase_step', defaultVal=1.5_pREAL) + num%stepMinCryst = num_mech%get_asReal ('r_cutback_min', defaultVal=1.0e-3_pREAL) + num%stepSizeCryst = num_mech%get_asReal ('r_cutback', defaultVal=0.25_pREAL) + num%stepIncreaseCryst = num_mech%get_asReal ('r_increase', defaultVal=1.5_pREAL) num%rtol_crystalliteState = num_mech%get_asReal ('eps_rel_state', defaultVal=1.0e-6_pREAL) num%nState = num_mech%get_asInt ('N_iter_state_max', defaultVal=20) num%nStress_Lp = num_mech_plastic%get_asInt ('N_iter_Lp_max', defaultVal=40) - num%stepSizeLp = num_mech_plastic%get_asReal ('r_cutback_step_Lp', defaultVal=0.5_pREAL) + num%stepSizeLp = num_mech_plastic%get_asReal ('r_linesearch_Lp', defaultVal=0.5_pREAL) num%rtol_Lp = num_mech_plastic%get_asReal ('eps_rel_Lp', defaultVal=1.0e-6_pREAL) num%atol_Lp = num_mech_plastic%get_asReal ('eps_abs_Lp', defaultVal=1.0e-8_pREAL) num%iJacoLpresiduum = num_mech_plastic%get_asInt ('f_update_jacobi_Lp', defaultVal=1) num%nStress_Li = num_mech_eigen%get_asInt ('N_iter_Li_max', defaultVal=40) - num%stepSizeLi = num_mech_eigen%get_asReal ('r_cutback_step_Li', defaultVal=0.5_pREAL) + num%stepSizeLi = num_mech_eigen%get_asReal ('r_linesearch_Li', defaultVal=0.5_pREAL) num%rtol_Li = num_mech_eigen%get_asReal ('eps_rel_Li', defaultVal=num%rtol_Lp) num%atol_Li = num_mech_eigen%get_asReal ('eps_abs_Li', defaultVal=num%atol_Lp) num%iJacoLiresiduum = num_mech_eigen%get_asInt ('f_update_jacobi_Li', defaultVal=num%iJacoLpresiduum) extmsg = '' - if (num%stepMinCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' sub_step_min' - if (num%stepSizeCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' r_cutback_step' - if (num%stepIncreaseCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' r_increase_step' - if (num%stepSizeLp <= 0.0_pREAL) extmsg = trim(extmsg)//' r_cutback_step_Lp' - if (num%stepSizeLi <= 0.0_pREAL) extmsg = trim(extmsg)//' r_cutback_step_Li' + if (num%stepMinCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' r_cutback_min' + if (num%stepSizeCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' r_cutback' + if (num%stepIncreaseCryst <= 0.0_pREAL) extmsg = trim(extmsg)//' r_increase' + if (num%stepSizeLp <= 0.0_pREAL) extmsg = trim(extmsg)//' r_linesearch_Lp' + if (num%stepSizeLi <= 0.0_pREAL) extmsg = trim(extmsg)//' r_linesearch_Li' if (num%rtol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' epl_rel_Lp' if (num%atol_Lp <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_abs_Lp' if (num%rtol_Li <= 0.0_pREAL) extmsg = trim(extmsg)//' eps_rel_Li' @@ -377,9 +377,9 @@ end subroutine mechanical_result !> @brief calculation of stress (P) with time integration based on a residuum in Lp and !> intermediate acceleration of the Newton-Raphson correction !-------------------------------------------------------------------------------------------------- -function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) +function integrateStress(F,Fp0,Fi0,Delta_t,ph,en) result(broken) - real(pREAL), dimension(3,3), intent(in) :: F,subFp0,subFi0 + real(pREAL), dimension(3,3), intent(in) :: F,Fp0,Fi0 real(pREAL), intent(in) :: Delta_t integer, intent(in) :: ph, en @@ -439,9 +439,9 @@ function integrateStress(F,subFp0,subFi0,Delta_t,ph,en) result(broken) Lpguess = phase_mechanical_Lp(ph)%data(1:3,1:3,en) ! take as first guess Liguess = phase_mechanical_Li(ph)%data(1:3,1:3,en) ! take as first guess - call math_invert33(invFp_current,error=error,A=subFp0) + call math_invert33(invFp_current,error=error,A=Fp0) if (error) return ! error - call math_invert33(invFi_current,error=error,A=subFi0) + call math_invert33(invFi_current,error=error,A=Fi0) if (error) return ! error A = matmul(F,invFp_current) ! intermediate tensor needed later to calculate dFe_dLp @@ -582,10 +582,10 @@ end function integrateStress !> @brief integrate stress, state with adaptive 1st order explicit Euler method !> using Fixed Point Iteration to adapt the stepsize !-------------------------------------------------------------------------------------------------- -function integrateStateFPI(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result(broken) +function integrateStateFPI(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(broken) - real(pREAL), intent(in),dimension(3,3) :: F_0,F,subFp0,subFi0 - real(pREAL), intent(in),dimension(:) :: subState0 + real(pREAL), intent(in),dimension(3,3) :: F_0,F,Fp0,Fi0 + real(pREAL), intent(in),dimension(:) :: state0 real(pREAL), intent(in) :: Delta_t integer, intent(in) :: & ph, & @@ -611,14 +611,14 @@ function integrateStateFPI(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result(b if (any(IEEE_is_NaN(dotState))) return sizeDotState = plasticState(ph)%sizeDotState - plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState * Delta_t + plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState * Delta_t iteration: do NiterationState = 1, num%nState dotState_last(1:sizeDotState,2) = merge(dotState_last(1:sizeDotState,1),0.0_pREAL, nIterationState > 1) dotState_last(1:sizeDotState,1) = dotState - broken = integrateStress(F,subFp0,subFi0,Delta_t,ph,en) + broken = integrateStress(F,Fp0,Fi0,Delta_t,ph,en) if (broken) exit iteration dotState = plastic_dotState(Delta_t,ph,en) @@ -628,7 +628,7 @@ function integrateStateFPI(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result(b dotState = dotState * zeta & + dotState_last(1:sizeDotState,1) * (1.0_pREAL - zeta) r = plasticState(ph)%state(1:sizeDotState,en) & - - subState0 & + - state0 & - dotState * Delta_t plasticState(ph)%state(1:sizeDotState,en) = plasticState(ph)%state(1:sizeDotState,en) - r @@ -670,10 +670,10 @@ end function integrateStateFPI !-------------------------------------------------------------------------------------------------- !> @brief integrate state with 1st order explicit Euler method !-------------------------------------------------------------------------------------------------- -function integrateStateEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result(broken) +function integrateStateEuler(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(broken) - real(pREAL), intent(in),dimension(3,3) :: F_0,F,subFp0,subFi0 - real(pREAL), intent(in),dimension(:) :: subState0 + real(pREAL), intent(in),dimension(3,3) :: F_0,F,Fp0,Fi0 + real(pREAL), intent(in),dimension(:) :: state0 real(pREAL), intent(in) :: Delta_t integer, intent(in) :: & ph, & @@ -694,15 +694,15 @@ function integrateStateEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result sizeDotState = plasticState(ph)%sizeDotState #ifndef __INTEL_LLVM_COMPILER - plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t + plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState*Delta_t #else - plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,state0) #endif broken = plastic_deltaState(ph,en) if (broken) return - broken = integrateStress(F,subFp0,subFi0,Delta_t,ph,en) + broken = integrateStress(F,Fp0,Fi0,Delta_t,ph,en) end function integrateStateEuler @@ -710,10 +710,10 @@ end function integrateStateEuler !-------------------------------------------------------------------------------------------------- !> @brief integrate stress, state with 1st order Euler method with adaptive step size !-------------------------------------------------------------------------------------------------- -function integrateStateAdaptiveEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result(broken) +function integrateStateAdaptiveEuler(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(broken) - real(pREAL), intent(in),dimension(3,3) :: F_0,F,subFp0,subFi0 - real(pREAL), intent(in),dimension(:) :: subState0 + real(pREAL), intent(in),dimension(3,3) :: F_0,F,Fp0,Fi0 + real(pREAL), intent(in),dimension(:) :: state0 real(pREAL), intent(in) :: Delta_t integer, intent(in) :: & ph, & @@ -737,15 +737,15 @@ function integrateStateAdaptiveEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en r = - dotState * 0.5_pREAL * Delta_t #ifndef __INTEL_LLVM_COMPILER - plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t + plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState*Delta_t #else - plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,state0) #endif broken = plastic_deltaState(ph,en) if (broken) return - broken = integrateStress(F,subFp0,subFi0,Delta_t,ph,en) + broken = integrateStress(F,Fp0,Fi0,Delta_t,ph,en) if (broken) return dotState = plastic_dotState(Delta_t,ph,en) @@ -761,10 +761,10 @@ end function integrateStateAdaptiveEuler !--------------------------------------------------------------------------------------------------- !> @brief Integrate state (including stress integration) with the classic Runge Kutta method !--------------------------------------------------------------------------------------------------- -function integrateStateRK4(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result(broken) +function integrateStateRK4(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(broken) - real(pREAL), intent(in),dimension(3,3) :: F_0,F,subFp0,subFi0 - real(pREAL), intent(in),dimension(:) :: subState0 + real(pREAL), intent(in),dimension(3,3) :: F_0,F,Fp0,Fi0 + real(pREAL), intent(in),dimension(:) :: state0 real(pREAL), intent(in) :: Delta_t integer, intent(in) :: ph, en logical :: broken @@ -781,7 +781,7 @@ function integrateStateRK4(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result(b B = [6.0_pREAL, 3.0_pREAL, 3.0_pREAL, 6.0_pREAL]**(-1) - broken = integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C) + broken = integrateStateRK(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en,A,B,C) end function integrateStateRK4 @@ -789,10 +789,10 @@ end function integrateStateRK4 !--------------------------------------------------------------------------------------------------- !> @brief Integrate state (including stress integration) with the Cash-Carp method !--------------------------------------------------------------------------------------------------- -function integrateStateRKCK45(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result(broken) +function integrateStateRKCK45(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(broken) - real(pREAL), intent(in),dimension(3,3) :: F_0,F,subFp0,subFi0 - real(pREAL), intent(in),dimension(:) :: subState0 + real(pREAL), intent(in),dimension(3,3) :: F_0,F,Fp0,Fi0 + real(pREAL), intent(in),dimension(:) :: state0 real(pREAL), intent(in) :: Delta_t integer, intent(in) :: ph, en logical :: broken @@ -816,7 +816,7 @@ function integrateStateRKCK45(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) resul 13525.0_pREAL/55296.0_pREAL, 277.0_pREAL/14336.0_pREAL, 1._pREAL/4._pREAL] - broken = integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) + broken = integrateStateRK(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en,A,B,C,DB) end function integrateStateRKCK45 @@ -825,10 +825,10 @@ end function integrateStateRKCK45 !> @brief Integrate state (including stress integration) with an explicit Runge-Kutta method or an !! embedded explicit Runge-Kutta method !-------------------------------------------------------------------------------------------------- -function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) result(broken) +function integrateStateRK(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en,A,B,C,DB) result(broken) - real(pREAL), intent(in),dimension(3,3) :: F_0,F,subFp0,subFi0 - real(pREAL), intent(in),dimension(:) :: subState0 + real(pREAL), intent(in),dimension(3,3) :: F_0,F,Fp0,Fi0 + real(pREAL), intent(in),dimension(:) :: state0 real(pREAL), intent(in) :: Delta_t real(pREAL), dimension(:,:), intent(in) :: A real(pREAL), dimension(:), intent(in) :: B, C @@ -869,12 +869,12 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) end do #ifndef __INTEL_LLVM_COMPILER - plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t + plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState*Delta_t #else - plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,state0) #endif - broken = integrateStress(F_0+(F-F_0)*Delta_t*C(stage),subFp0,subFi0,Delta_t*C(stage), ph,en) + broken = integrateStress(F_0+(F-F_0)*Delta_t*C(stage),Fp0,Fi0,Delta_t*C(stage), ph,en) if (broken) exit dotState = plastic_dotState(Delta_t*C(stage), ph,en) @@ -887,9 +887,9 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) plastic_RKdotState(1:sizeDotState,size(B)) = dotState dotState = matmul(plastic_RKdotState,B) #ifndef __INTEL_LLVM_COMPILER - plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t + plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState*Delta_t #else - plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,state0) #endif if (present(DB)) & @@ -902,7 +902,7 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) broken = plastic_deltaState(ph,en) if (broken) return - broken = integrateStress(F,subFp0,subFi0,Delta_t,ph,en) + broken = integrateStress(F,Fp0,Fi0,Delta_t,ph,en) end function integrateStateRK @@ -1019,24 +1019,24 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_) logical :: todo real(pREAL) :: stepFrac,step real(pREAL), dimension(3,3) :: & - subFp0, & - subFi0, & - subLp0, & - subLi0, & - subF0, & - subF - real(pREAL), dimension(plasticState(material_ID_phase(co,ce))%sizeState) :: subState0 + Fp0, & + Fi0, & + Lp0, & + Li0, & + F0, & + F + real(pREAL), dimension(plasticState(material_ID_phase(co,ce))%sizeState) :: state0 ph = material_ID_phase(co,ce) en = material_entry_phase(co,ce) - subState0 = plasticState(ph)%state0(:,en) - subLi0 = phase_mechanical_Li0(ph)%data(1:3,1:3,en) - subLp0 = phase_mechanical_Lp0(ph)%data(1:3,1:3,en) - subFp0 = phase_mechanical_Fp0(ph)%data(1:3,1:3,en) - subFi0 = phase_mechanical_Fi0(ph)%data(1:3,1:3,en) - subF0 = phase_mechanical_F0(ph)%data(1:3,1:3,en) + state0 = plasticState(ph)%state0(:,en) + Li0 = phase_mechanical_Li0(ph)%data(1:3,1:3,en) + Lp0 = phase_mechanical_Lp0(ph)%data(1:3,1:3,en) + Fp0 = phase_mechanical_Fp0(ph)%data(1:3,1:3,en) + Fi0 = phase_mechanical_Fi0(ph)%data(1:3,1:3,en) + F0 = phase_mechanical_F0(ph)%data(1:3,1:3,en) stepFrac = 0.0_pREAL todo = .true. step = 1.0_pREAL/num%stepSizeCryst @@ -1053,25 +1053,25 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_) todo = step > 0.0_pREAL ! still time left to integrate on? if (todo) then - subF0 = subF - subLp0 = phase_mechanical_Lp(ph)%data(1:3,1:3,en) - subLi0 = phase_mechanical_Li(ph)%data(1:3,1:3,en) - subFp0 = phase_mechanical_Fp(ph)%data(1:3,1:3,en) - subFi0 = phase_mechanical_Fi(ph)%data(1:3,1:3,en) - subState0 = plasticState(ph)%state(:,en) + F0 = F + Lp0 = phase_mechanical_Lp(ph)%data(1:3,1:3,en) + Li0 = phase_mechanical_Li(ph)%data(1:3,1:3,en) + Fp0 = phase_mechanical_Fp(ph)%data(1:3,1:3,en) + Fi0 = phase_mechanical_Fi(ph)%data(1:3,1:3,en) + state0 = plasticState(ph)%state(:,en) end if !-------------------------------------------------------------------------------------------------- ! cut back (reduced time and restore) else step = num%stepSizeCryst * step - phase_mechanical_Fp(ph)%data(1:3,1:3,en) = subFp0 - phase_mechanical_Fi(ph)%data(1:3,1:3,en) = subFi0 + phase_mechanical_Fp(ph)%data(1:3,1:3,en) = Fp0 + phase_mechanical_Fi(ph)%data(1:3,1:3,en) = Fi0 phase_mechanical_S(ph)%data(1:3,1:3,en) = phase_mechanical_S0(ph)%data(1:3,1:3,en) if (step < 1.0_pREAL) then ! actual (not initial) cutback - phase_mechanical_Lp(ph)%data(1:3,1:3,en) = subLp0 - phase_mechanical_Li(ph)%data(1:3,1:3,en) = subLi0 + phase_mechanical_Lp(ph)%data(1:3,1:3,en) = Lp0 + phase_mechanical_Li(ph)%data(1:3,1:3,en) = Li0 end if - plasticState(ph)%state(:,en) = subState0 + plasticState(ph)%state(:,en) = state0 todo = step > num%stepMinCryst ! still on track or already done (beyond repair) end if @@ -1079,9 +1079,9 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_) ! prepare for integration if (todo) then sizeDotState = plasticState(ph)%sizeDotState - subF = subF0 & + F = F0 & + step * (phase_mechanical_F(ph)%data(1:3,1:3,en) - phase_mechanical_F0(ph)%data(1:3,1:3,en)) - converged_ = .not. integrateState(subF0,subF,subFp0,subFi0,subState0(1:sizeDotState),step * Delta_t,ph,en) + converged_ = .not. integrateState(F0,F,Fp0,Fi0,state0(1:sizeDotState),step * Delta_t,ph,en) end if end do cutbackLooping From 776d75379cfe4007bbf0307ef8a9bc3b662b0986 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 26 Jul 2023 12:59:33 -0400 Subject: [PATCH 077/198] use modified numerics in test --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 5c93094df..8c05965ef 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 5c93094df289da74588a3b5dd644d31923c9c651 +Subproject commit 8c05965ef4437598898f467a213ffa88938e860a From e9eb34692c38799039e68fb798dbdab525abd4c9 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 27 Jul 2023 01:43:03 +0200 Subject: [PATCH 078/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-696-gd2e279da1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8c08faef8..328a7839f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-687-gee8876abd +3.0.0-alpha7-696-gd2e279da1 From 7923f48fa00e4476d7e905b7fc215d2b6514a5bc Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Fri, 28 Jul 2023 11:07:45 +0200 Subject: [PATCH 079/198] update RGC numerical parameters --- src/homogenization_mechanical_RGC.f90 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/homogenization_mechanical_RGC.f90 b/src/homogenization_mechanical_RGC.f90 index aac66ccec..e4a9367eb 100644 --- a/src/homogenization_mechanical_RGC.f90 +++ b/src/homogenization_mechanical_RGC.f90 @@ -108,19 +108,19 @@ module subroutine RGC_init() num_mechanical => num_homogenization%get_dict('mechanical',defaultVal=emptyDict) num_RGC => num_mechanical%get_dict('RGC',defaultVal=emptyDict) - num%atol = num_RGC%get_asReal('atol', defaultVal=1.0e+4_pREAL) - num%rtol = num_RGC%get_asReal('rtol', defaultVal=1.0e-3_pREAL) - num%absMax = num_RGC%get_asReal('amax', defaultVal=1.0e+10_pREAL) - num%relMax = num_RGC%get_asReal('rmax', defaultVal=1.0e+2_pREAL) + num%atol = num_RGC%get_asReal('eps_abs_P', defaultVal=1.0e+4_pREAL) + num%rtol = num_RGC%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) + num%absMax = num_RGC%get_asReal('eps_abs_max', defaultVal=1.0e+10_pREAL) + num%relMax = num_RGC%get_asReal('eps_rel_max', defaultVal=1.0e+2_pREAL) num%pPert = num_RGC%get_asReal('perturbpenalty', defaultVal=1.0e-7_pREAL) - num%xSmoo = num_RGC%get_asReal('relvantmismatch', defaultVal=1.0e-5_pREAL) + num%xSmoo = num_RGC%get_asReal('relevantmismatch', defaultVal=1.0e-5_pREAL) num%viscPower = num_RGC%get_asReal('viscositypower', defaultVal=1.0e+0_pREAL) num%viscModus = num_RGC%get_asReal('viscositymodulus', defaultVal=0.0e+0_pREAL) - num%refRelaxRate = num_RGC%get_asReal('refrelaxationrate', defaultVal=1.0e-3_pREAL) - num%maxdRelax = num_RGC%get_asReal('maxrelaxationrate', defaultVal=1.0e+0_pREAL) - num%maxVolDiscr = num_RGC%get_asReal('maxvoldiscrepancy', defaultVal=1.0e-5_pREAL) - num%volDiscrMod = num_RGC%get_asReal('voldiscrepancymod', defaultVal=1.0e+12_pREAL) - num%volDiscrPow = num_RGC%get_asReal('dicrepancypower', defaultVal=5.0_pREAL) + num%refRelaxRate = num_RGC%get_asReal('dot_a_ref', defaultVal=1.0e-3_pREAL) + num%maxdRelax = num_RGC%get_asReal('dot_a_max', defaultVal=1.0e+0_pREAL) + num%maxVolDiscr = num_RGC%get_asReal('Delta_V_max', defaultVal=1.0e-5_pREAL) + num%volDiscrMod = num_RGC%get_asReal('Delta_V_mod', defaultVal=1.0e+12_pREAL) + num%volDiscrPow = num_RGC%get_asReal('Delta_V_pow', defaultVal=5.0_pREAL) if (num%atol <= 0.0_pREAL) call IO_error(301,ext_msg='absTol_RGC') if (num%rtol <= 0.0_pREAL) call IO_error(301,ext_msg='relTol_RGC') From a113492600195333b8e3d03921c8cfc9f06147ee Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Fri, 28 Jul 2023 11:21:27 +0200 Subject: [PATCH 080/198] example file updated --- examples/config/numerics.yaml | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index 97885311d..fa56bdff4 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -2,28 +2,28 @@ # Case sensitive keys homogenization: - mech: + mechanical: RGC: - atol: 1.0e+4 # absolute tolerance of RGC residuum (in Pa) - rtol: 1.0e-3 # relative ... - amax: 1.0e+10 # absolute upper-limit of RGC residuum (in Pa) - rmax: 1.0e+2 # relative ... - perturbpenalty: 1.0e-7 # perturbation for computing penalty tangent - relevantmismatch: 1.0e-5 # minimum threshold of mismatch - viscositypower: 1.0e+0 # power (sensitivity rate) of numerical viscosity in RGC scheme - viscositymodulus: 0.0e+0 # stress modulus of RGC numerical viscosity (zero = without numerical viscosity) - # suggestion: larger than the aTol_RGC but still far below the expected flow stress of material - refrelaxationrate: 1.0e-3 # reference rate of relaxation (about the same magnitude as straining rate, possibly a bit higher) - maxrelaxationrate: 1.0e+0 # threshold of maximum relaxation vector increment (if exceed this then cutback) - maxvoldiscrepancy: 1.0e-5 # maximum allowable relative volume discrepancy - voldiscrepancymod: 1.0e+12 - discrepancypower: 5.0 - + eps_abs_P: 1.0e+4 # absolute tolerance of RGC residuum (in Pa) + eps_rel_P: 1.0e-3 # relative ... + eps_abs_max: 1.0e+10 # absolute upper-limit of RGC residuum (in Pa) + eps_rel_max: 1.0e+2 # relative ... + perturbpenalty: 1.0e-7 # perturbation for computing penalty tangent + relevantmismatch: 1.0e-5 # minimum threshold of mismatch + viscositypower: 1.0e+0 # power (sensitivity rate) of numerical viscosity in RGC scheme + viscositymodulus: 0.0e+0 # stress modulus of RGC numerical viscosity (zero = without numerical viscosity) + # suggestion: larger than the aTol_RGC but still far below the expected flow stress of material + dot_a_ref: 1.0e-3 # reference rate of relaxation (about the same magnitude as straining rate, possibly a bit higher) + dot_a_max: 1.0e+0 # threshold of maximum relaxation vector increment (if exceed this then cutback) + Delta_V_max: 1.0e-5 # maximum allowable relative volume discrepancy + Delta_V_mod: 1.0e+12 + Delta_V_pow: 5.0 +# Don't think generic is required generic: - subStepMin: 1.0e-3 # minimum (relative) size of sub-step allowed during cutback in homogenization - subStepSize: 0.25 # size of substep when cutback introduced in homogenization (value between 0 and 1) - stepIncrease: 1.5 # increase of next substep size when previous substep converged in homogenization (value higher than 1) - nMPstate: 10 # materialpoint state loop limit + subStepMin: 1.0e-3 #? (not used) minimum (relative) size of sub-step allowed during cutback in homogenization + subStepSize: 0.25 #? (not used) size of substep when cutback introduced in homogenization (value between 0 and 1) + stepIncrease: 1.5 #? (not used) increase of next substep size when previous substep converged in homogenization (value higher than 1) + nMPstate: 10 # (do we need??) materialpoint state loop limit solver: grid: From dbad2a7413380a0cc4d53dd7d7ceaa176e67d1e7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Jul 2023 23:17:21 +0200 Subject: [PATCH 081/198] hints from gfortran --- src/YAML_parse.f90 | 4 ++-- src/grid/grid_mech_spectral_basic.f90 | 6 ------ src/grid/grid_mech_spectral_polarization.f90 | 6 ------ src/grid/grid_thermal_spectral.f90 | 1 - 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index 556b8fe96..527a9b3fc 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -162,7 +162,7 @@ end function parse_flow !> @brief Find location of chunk end: ',' '}', or ']'. !> @details leaves nested lists ( '[...]' and dicts '{...}') intact !-------------------------------------------------------------------------------------------------- -integer function find_end(str,e_char) +integer(pI64) function find_end(str,e_char) character(len=*), intent(in) :: str !< chunk of YAML flow string character, intent(in) :: e_char !< end of list/dict ( '}' or ']') @@ -456,7 +456,7 @@ end subroutine remove_line_break !-------------------------------------------------------------------------------------------------- subroutine list_item_inline(blck,s_blck,inline,offset) - character(len=*), intent(in) :: blck !< YAML in mixed style + character(len=*), intent(in) :: blck !< YAML in mixed style integer, intent(inout) :: s_blck character(len=:), allocatable, intent(out) :: inline integer, intent(inout) :: offset diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index ed1ff1e2f..5bcfec438 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -82,12 +82,6 @@ module grid_mechanical_spectral_basic err_BC, & !< deviation from stress BC err_div !< RMS of div of P -#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>14) && !defined(PETSC_HAVE_MPI_F90MODULE_VISIBILITY) - type(MPI_Status) :: status -#else - integer, dimension(MPI_STATUS_SIZE) :: status -#endif - integer :: & totalIter = 0 !< total iteration in current increment diff --git a/src/grid/grid_mech_spectral_polarization.f90 b/src/grid/grid_mech_spectral_polarization.f90 index c6c7c2fd5..efa1a64a9 100644 --- a/src/grid/grid_mech_spectral_polarization.f90 +++ b/src/grid/grid_mech_spectral_polarization.f90 @@ -94,12 +94,6 @@ module grid_mechanical_spectral_polarization err_curl, & !< RMS of curl of F err_div !< RMS of div of P -#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>14) && !defined(PETSC_HAVE_MPI_F90MODULE_VISIBILITY) - type(MPI_Status) :: status -#else - integer, dimension(MPI_STATUS_SIZE) :: status -#endif - integer :: & totalIter = 0 !< total iteration in current increment diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 86d8e04f3..c178c5810 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -189,7 +189,6 @@ function grid_thermal_spectral_solution(Delta_t) result(solution) real(pREAL), intent(in) :: & Delta_t !< increment in time for current solution - integer :: i, j, k, ce type(tSolutionState) :: solution PetscInt :: devNull PetscReal :: T_min, T_max, stagNorm From efeed13d8fe958dad376a3d292986ec1601d53ed Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 31 Jul 2023 11:04:58 +0200 Subject: [PATCH 082/198] include more unit tests for Fortran --- src/IO.f90 | 7 ++++--- src/misc.f90 | 1 + src/rotations.f90 | 9 +++++---- src/test/DAMASK_test.f90 | 24 ++++++++++++++++++++++-- src/test/test_IO.f90 | 17 +++++++++++++++++ src/test/test_misc.f90 | 17 +++++++++++++++++ src/test/test_rotations.f90 | 17 +++++++++++++++++ 7 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 src/test/test_IO.f90 create mode 100644 src/test/test_misc.f90 create mode 100644 src/test/test_rotations.f90 diff --git a/src/IO.f90 b/src/IO.f90 index 9e0b4c40d..6f34d1b7f 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -26,6 +26,7 @@ module IO public :: & IO_init, & + IO_selfTest, & IO_read, & IO_readlines, & IO_isBlank, & @@ -55,7 +56,7 @@ subroutine IO_init() print'(/,1x,a)', '<<<+- IO init -+>>>'; flush(IO_STDOUT) - call selfTest() + call IO_selfTest() end subroutine IO_init @@ -763,7 +764,7 @@ end subroutine panel !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some IO functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest() +subroutine IO_selfTest() integer, dimension(:), allocatable :: chunkPos character(len=:), allocatable :: str,out @@ -846,6 +847,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' -end subroutine selfTest +end subroutine IO_selfTest end module IO diff --git a/src/misc.f90 b/src/misc.f90 index 47c23757f..902a5b731 100644 --- a/src/misc.f90 +++ b/src/misc.f90 @@ -19,6 +19,7 @@ module misc public :: & misc_init, & + misc_selfTest, & misc_optional, & misc_prefixOptions diff --git a/src/rotations.f90 b/src/rotations.f90 index 58aa87ee0..fa0da2b0a 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -92,6 +92,7 @@ module rotations public :: & rotations_init, & + rotations_selfTest, & eu2om contains @@ -99,14 +100,14 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Do self test. !-------------------------------------------------------------------------------------------------- -subroutine rotations_init +subroutine rotations_init() print'(/,1x,a)', '<<<+- rotations init -+>>>'; flush(IO_STDOUT) print'(/,1x,a)', 'D. Rowenhorst et al., Modelling and Simulation in Materials Science and Engineering 23:083501, 2015' print'( 1x,a)', 'https://doi.org/10.1088/0965-0393/23/8/083501' - call selfTest() + call rotations_selfTest() end subroutine rotations_init @@ -757,7 +758,7 @@ end function conjugateQuaternion !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some rotations functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest() +subroutine rotations_selfTest() type(tRotation) :: R real(pREAL), dimension(4) :: qu @@ -841,7 +842,7 @@ subroutine selfTest() end function quaternion_equal -end subroutine selfTest +end subroutine rotations_selfTest end module rotations diff --git a/src/test/DAMASK_test.f90 b/src/test/DAMASK_test.f90 index 8460a9fab..0904b71a0 100644 --- a/src/test/DAMASK_test.f90 +++ b/src/test/DAMASK_test.f90 @@ -4,10 +4,17 @@ program DAMASK_test use HDF5_utilities use test_prec - use test_tables use test_crystal + use test_IO + use test_rotations + use test_misc + use test_tables use test_HDF5_utilities + external :: quit + + call parallelization_init() + print('(/,a)'), 'begin test prec' call test_prec_run() print('(a)'), 'begin test prec' @@ -20,11 +27,24 @@ program DAMASK_test call test_crystal_run() print('(a)'), 'end test crystal' - call parallelization_init() + print('(/,a)'), 'begin test rotations' + call test_rotations_run() + print('(a)'), 'end test rotations' + + print('(/,a)'), 'begin test IO' + call test_IO_run() + print('(a)'), 'end test IO' + + print('(/,a)'), 'begin test misc' + call test_misc_run() + print('(a)'), 'end test misc' + call HDF5_utilities_init() print('(/,a)'), 'begin test HDF5_utilities' call test_HDF5_utilities_run() print('(a)'), 'begin test HDF5_utilities' + call quit(0) + end program DAMASK_test diff --git a/src/test/test_IO.f90 b/src/test/test_IO.f90 new file mode 100644 index 000000000..cae7f76c4 --- /dev/null +++ b/src/test/test_IO.f90 @@ -0,0 +1,17 @@ +module test_IO + use IO + + implicit none(type,external) + + private + public :: test_IO_run + + contains + +subroutine test_IO_run() + + call IO_selfTest() + +end subroutine test_IO_run + +end module test_IO diff --git a/src/test/test_misc.f90 b/src/test/test_misc.f90 new file mode 100644 index 000000000..3fcdf19b1 --- /dev/null +++ b/src/test/test_misc.f90 @@ -0,0 +1,17 @@ +module test_misc + use misc + + implicit none(type,external) + + private + public :: test_misc_run + + contains + +subroutine test_misc_run() + + call misc_selfTest() + +end subroutine test_misc_run + +end module test_misc diff --git a/src/test/test_rotations.f90 b/src/test/test_rotations.f90 new file mode 100644 index 000000000..9cf9b7ffd --- /dev/null +++ b/src/test/test_rotations.f90 @@ -0,0 +1,17 @@ +module test_rotations + use rotations + + implicit none(type,external) + + private + public :: test_rotations_run + + contains + +subroutine test_rotations_run() + + call rotations_selfTest() + +end subroutine test_rotations_run + +end module test_rotations From 1b5f4000bd123a09f03c2ec3d9d55a427cbcb420 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 31 Jul 2023 15:05:14 +0200 Subject: [PATCH 083/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-702-g39f4bc44e --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 328a7839f..33510fc94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-696-gd2e279da1 +3.0.0-alpha7-702-g39f4bc44e From 4d03d1ab89063ec8dac3eabf53af8515ad18b846 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 31 Jul 2023 17:54:55 +0200 Subject: [PATCH 084/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-706-g43b58c93e --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 328a7839f..a1fca3533 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-696-gd2e279da1 +3.0.0-alpha7-706-g43b58c93e From 6b85ee47d4ebc766655e421ceaf9ffa4230f9f4d Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Tue, 1 Aug 2023 10:49:43 +0200 Subject: [PATCH 085/198] new names --- examples/config/numerics.yaml | 11 +++--- src/homogenization_mechanical_RGC.f90 | 52 +++++++++++++-------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index fa56bdff4..7e7c9895f 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -8,10 +8,10 @@ homogenization: eps_rel_P: 1.0e-3 # relative ... eps_abs_max: 1.0e+10 # absolute upper-limit of RGC residuum (in Pa) eps_rel_max: 1.0e+2 # relative ... - perturbpenalty: 1.0e-7 # perturbation for computing penalty tangent - relevantmismatch: 1.0e-5 # minimum threshold of mismatch - viscositypower: 1.0e+0 # power (sensitivity rate) of numerical viscosity in RGC scheme - viscositymodulus: 0.0e+0 # stress modulus of RGC numerical viscosity (zero = without numerical viscosity) + Delta_a: 1.0e-7 # perturbation for computing penalty tangent + relevant_mismatch: 1.0e-5 # minimum threshold of mismatch + viscosity_exponent: 1.0e+0 # power (sensitivity rate) of numerical viscosity in RGC scheme + viscosity_modulus: 0.0e+0 # stress modulus of RGC numerical viscosity (zero = without numerical viscosity) # suggestion: larger than the aTol_RGC but still far below the expected flow stress of material dot_a_ref: 1.0e-3 # reference rate of relaxation (about the same magnitude as straining rate, possibly a bit higher) dot_a_max: 1.0e+0 # threshold of maximum relaxation vector increment (if exceed this then cutback) @@ -20,9 +20,6 @@ homogenization: Delta_V_pow: 5.0 # Don't think generic is required generic: - subStepMin: 1.0e-3 #? (not used) minimum (relative) size of sub-step allowed during cutback in homogenization - subStepSize: 0.25 #? (not used) size of substep when cutback introduced in homogenization (value between 0 and 1) - stepIncrease: 1.5 #? (not used) increase of next substep size when previous substep converged in homogenization (value higher than 1) nMPstate: 10 # (do we need??) materialpoint state loop limit solver: diff --git a/src/homogenization_mechanical_RGC.f90 b/src/homogenization_mechanical_RGC.f90 index e4a9367eb..3b21ebc37 100644 --- a/src/homogenization_mechanical_RGC.f90 +++ b/src/homogenization_mechanical_RGC.f90 @@ -108,33 +108,33 @@ module subroutine RGC_init() num_mechanical => num_homogenization%get_dict('mechanical',defaultVal=emptyDict) num_RGC => num_mechanical%get_dict('RGC',defaultVal=emptyDict) - num%atol = num_RGC%get_asReal('eps_abs_P', defaultVal=1.0e+4_pREAL) - num%rtol = num_RGC%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) - num%absMax = num_RGC%get_asReal('eps_abs_max', defaultVal=1.0e+10_pREAL) - num%relMax = num_RGC%get_asReal('eps_rel_max', defaultVal=1.0e+2_pREAL) - num%pPert = num_RGC%get_asReal('perturbpenalty', defaultVal=1.0e-7_pREAL) - num%xSmoo = num_RGC%get_asReal('relevantmismatch', defaultVal=1.0e-5_pREAL) - num%viscPower = num_RGC%get_asReal('viscositypower', defaultVal=1.0e+0_pREAL) - num%viscModus = num_RGC%get_asReal('viscositymodulus', defaultVal=0.0e+0_pREAL) - num%refRelaxRate = num_RGC%get_asReal('dot_a_ref', defaultVal=1.0e-3_pREAL) - num%maxdRelax = num_RGC%get_asReal('dot_a_max', defaultVal=1.0e+0_pREAL) - num%maxVolDiscr = num_RGC%get_asReal('Delta_V_max', defaultVal=1.0e-5_pREAL) - num%volDiscrMod = num_RGC%get_asReal('Delta_V_mod', defaultVal=1.0e+12_pREAL) - num%volDiscrPow = num_RGC%get_asReal('Delta_V_pow', defaultVal=5.0_pREAL) + num%atol = num_RGC%get_asReal('eps_abs_P', defaultVal=1.0e+4_pREAL) + num%rtol = num_RGC%get_asReal('eps_rel_P', defaultVal=1.0e-3_pREAL) + num%absMax = num_RGC%get_asReal('eps_abs_max', defaultVal=1.0e+10_pREAL) + num%relMax = num_RGC%get_asReal('eps_rel_max', defaultVal=1.0e+2_pREAL) + num%pPert = num_RGC%get_asReal('Delta_a', defaultVal=1.0e-7_pREAL) + num%xSmoo = num_RGC%get_asReal('relevant_mismatch', defaultVal=1.0e-5_pREAL) + num%viscPower = num_RGC%get_asReal('viscosity_exponent', defaultVal=1.0e+0_pREAL) + num%viscModus = num_RGC%get_asReal('viscosity_modulus', defaultVal=0.0e+0_pREAL) + num%refRelaxRate = num_RGC%get_asReal('dot_a_ref', defaultVal=1.0e-3_pREAL) + num%maxdRelax = num_RGC%get_asReal('dot_a_max', defaultVal=1.0e+0_pREAL) + num%maxVolDiscr = num_RGC%get_asReal('Delta_V_max', defaultVal=1.0e-5_pREAL) + num%volDiscrMod = num_RGC%get_asReal('Delta_V_mod', defaultVal=1.0e+12_pREAL) + num%volDiscrPow = num_RGC%get_asReal('Delta_V_pow', defaultVal=5.0_pREAL) - if (num%atol <= 0.0_pREAL) call IO_error(301,ext_msg='absTol_RGC') - if (num%rtol <= 0.0_pREAL) call IO_error(301,ext_msg='relTol_RGC') - if (num%absMax <= 0.0_pREAL) call IO_error(301,ext_msg='absMax_RGC') - if (num%relMax <= 0.0_pREAL) call IO_error(301,ext_msg='relMax_RGC') - if (num%pPert <= 0.0_pREAL) call IO_error(301,ext_msg='pPert_RGC') - if (num%xSmoo <= 0.0_pREAL) call IO_error(301,ext_msg='xSmoo_RGC') - if (num%viscPower < 0.0_pREAL) call IO_error(301,ext_msg='viscPower_RGC') - if (num%viscModus < 0.0_pREAL) call IO_error(301,ext_msg='viscModus_RGC') - if (num%refRelaxRate <= 0.0_pREAL) call IO_error(301,ext_msg='refRelaxRate_RGC') - if (num%maxdRelax <= 0.0_pREAL) call IO_error(301,ext_msg='maxdRelax_RGC') - if (num%maxVolDiscr <= 0.0_pREAL) call IO_error(301,ext_msg='maxVolDiscr_RGC') - if (num%volDiscrMod < 0.0_pREAL) call IO_error(301,ext_msg='volDiscrMod_RGC') - if (num%volDiscrPow <= 0.0_pREAL) call IO_error(301,ext_msg='volDiscrPw_RGC') + if (num%atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_abs_P') + if (num%rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_P') + if (num%absMax <= 0.0_pREAL) call IO_error(301,ext_msg='eps_abs_max') + if (num%relMax <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_max') + if (num%pPert <= 0.0_pREAL) call IO_error(301,ext_msg='Delta_a') + if (num%xSmoo <= 0.0_pREAL) call IO_error(301,ext_msg='relevant_mismatch') + if (num%viscPower < 0.0_pREAL) call IO_error(301,ext_msg='viscosity_exponent') + if (num%viscModus < 0.0_pREAL) call IO_error(301,ext_msg='viscosity_modulus') + if (num%refRelaxRate <= 0.0_pREAL) call IO_error(301,ext_msg='dot_a_ref') + if (num%maxdRelax <= 0.0_pREAL) call IO_error(301,ext_msg='dot_a_max') + if (num%maxVolDiscr <= 0.0_pREAL) call IO_error(301,ext_msg='Delta_V_max') + if (num%volDiscrMod < 0.0_pREAL) call IO_error(301,ext_msg='Delta_V_mod') + if (num%volDiscrPow <= 0.0_pREAL) call IO_error(301,ext_msg='Delta_V_pow') do ho = 1, size(mechanical_type) From 4191762a41c13f6b65c956015a17b4768fcde1ec Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Tue, 1 Aug 2023 11:07:07 +0200 Subject: [PATCH 086/198] seems redundant --- examples/config/numerics.yaml | 3 --- src/homogenization.f90 | 23 ++--------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index 7e7c9895f..3bedc41ed 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -18,9 +18,6 @@ homogenization: Delta_V_max: 1.0e-5 # maximum allowable relative volume discrepancy Delta_V_mod: 1.0e+12 Delta_V_pow: 5.0 -# Don't think generic is required - generic: - nMPstate: 10 # (do we need??) materialpoint state loop limit solver: grid: diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 63eacdf9d..ebb18b232 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -59,15 +59,6 @@ module homogenization real(pREAL), dimension(:,:,:,:,:), allocatable, public :: & !, protected :: & homogenization_dPdF !< tangent of first P--K stress at IP - -!-------------------------------------------------------------------------------------------------- - type :: tNumerics - integer :: & - nMPstate !< materialpoint state loop limit - end type tNumerics - - type(tNumerics) :: num - !-------------------------------------------------------------------------------------------------- interface @@ -214,12 +205,6 @@ subroutine homogenization_init() allocate(damageState_h (size(material_name_homogenization))) call parseHomogenization() - num_homog => config_numerics%get_dict('homogenization',defaultVal=emptyDict) - num_homogGeneric => num_homog%get_dict('generic',defaultVal=emptyDict) - - num%nMPstate = num_homogGeneric%get_asInt('nMPstate',defaultVal=10) - if (num%nMPstate < 1) call IO_error(301,ext_msg='nMPstate') - call mechanical_init() call thermal_init() call damage_init() @@ -236,7 +221,6 @@ subroutine homogenization_mechanical_response(Delta_t,cell_start,cell_end) integer, intent(in) :: & cell_start, cell_end integer :: & - NiterationMPstate, & co, ce, ho, en logical :: & converged @@ -244,7 +228,7 @@ subroutine homogenization_mechanical_response(Delta_t,cell_start,cell_end) doneAndHappy - !$OMP PARALLEL DO PRIVATE(en,ho,co,NiterationMPstate,converged,doneAndHappy) + !$OMP PARALLEL DO PRIVATE(en,ho,co,converged,doneAndHappy) do ce = cell_start, cell_end en = material_entry_homogenization(ce) @@ -258,10 +242,7 @@ subroutine homogenization_mechanical_response(Delta_t,cell_start,cell_end) doneAndHappy = [.false.,.true.] - NiterationMPstate = 0 - convergenceLooping: do while (.not. (terminallyIll .or. doneAndHappy(1)) & - .and. NiterationMPstate < num%nMPstate) - NiterationMPstate = NiterationMPstate + 1 + convergenceLooping: do while (.not. (terminallyIll .or. doneAndHappy(1))) call mechanical_partition(homogenization_F(1:3,1:3,ce),ce) converged = all([(phase_mechanical_constitutive(Delta_t,co,ce),co=1,homogenization_Nconstituents(ho))]) From 485839b651e7070347256c6aa812f3c0983f74ba Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Tue, 1 Aug 2023 16:42:45 +0200 Subject: [PATCH 087/198] consistent names --- examples/config/numerics.yaml | 4 ++-- src/homogenization_mechanical_RGC.f90 | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index 3bedc41ed..487b6cf88 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -16,8 +16,8 @@ homogenization: dot_a_ref: 1.0e-3 # reference rate of relaxation (about the same magnitude as straining rate, possibly a bit higher) dot_a_max: 1.0e+0 # threshold of maximum relaxation vector increment (if exceed this then cutback) Delta_V_max: 1.0e-5 # maximum allowable relative volume discrepancy - Delta_V_mod: 1.0e+12 - Delta_V_pow: 5.0 + Delta_V_modulus: 1.0e+12 + Delta_V_exponent: 5.0 solver: grid: diff --git a/src/homogenization_mechanical_RGC.f90 b/src/homogenization_mechanical_RGC.f90 index 3b21ebc37..956c5dfb6 100644 --- a/src/homogenization_mechanical_RGC.f90 +++ b/src/homogenization_mechanical_RGC.f90 @@ -119,8 +119,8 @@ module subroutine RGC_init() num%refRelaxRate = num_RGC%get_asReal('dot_a_ref', defaultVal=1.0e-3_pREAL) num%maxdRelax = num_RGC%get_asReal('dot_a_max', defaultVal=1.0e+0_pREAL) num%maxVolDiscr = num_RGC%get_asReal('Delta_V_max', defaultVal=1.0e-5_pREAL) - num%volDiscrMod = num_RGC%get_asReal('Delta_V_mod', defaultVal=1.0e+12_pREAL) - num%volDiscrPow = num_RGC%get_asReal('Delta_V_pow', defaultVal=5.0_pREAL) + num%volDiscrMod = num_RGC%get_asReal('Delta_V_modulus', defaultVal=1.0e+12_pREAL) + num%volDiscrPow = num_RGC%get_asReal('Delta_V_exponent', defaultVal=5.0_pREAL) if (num%atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_abs_P') if (num%rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_P') @@ -133,8 +133,8 @@ module subroutine RGC_init() if (num%refRelaxRate <= 0.0_pREAL) call IO_error(301,ext_msg='dot_a_ref') if (num%maxdRelax <= 0.0_pREAL) call IO_error(301,ext_msg='dot_a_max') if (num%maxVolDiscr <= 0.0_pREAL) call IO_error(301,ext_msg='Delta_V_max') - if (num%volDiscrMod < 0.0_pREAL) call IO_error(301,ext_msg='Delta_V_mod') - if (num%volDiscrPow <= 0.0_pREAL) call IO_error(301,ext_msg='Delta_V_pow') + if (num%volDiscrMod < 0.0_pREAL) call IO_error(301,ext_msg='Delta_V_modulus') + if (num%volDiscrPow <= 0.0_pREAL) call IO_error(301,ext_msg='Delta_V_exponent') do ho = 1, size(mechanical_type) From 72845dce07997fbd1e4049ecb1bf379b5ba01254 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 1 Aug 2023 22:30:08 +0200 Subject: [PATCH 088/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-713-gd73f76901 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a1fca3533..936f2efa1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-706-g43b58c93e +3.0.0-alpha7-713-gd73f76901 From 482ba98b18fc92e8bec7a63b55ab1cc1027e3821 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 2 Aug 2023 13:27:59 +0200 Subject: [PATCH 089/198] mesh numerics changes --- PRIVATE | 2 +- examples/config/numerics.yaml | 21 ++++++++++----------- src/mesh/DAMASK_mesh.f90 | 16 +++++++++------- src/mesh/FEM_utilities.f90 | 20 +++++++++++--------- src/mesh/discretization_mesh.f90 | 4 +++- src/mesh/mesh_mech_FEM.f90 | 20 +++++++++----------- 6 files changed, 43 insertions(+), 40 deletions(-) diff --git a/PRIVATE b/PRIVATE index 8c05965ef..9a067cb27 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 8c05965ef4437598898f467a213ffa88938e860a +Subproject commit 9a067cb2757df91b9242414779a8b52ac9e5ee02 diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index 487b6cf88..247ae21c5 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -40,7 +40,7 @@ solver: 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) + 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) @@ -54,16 +54,15 @@ solver: 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) - maxStaggeredIter: 10 # max number of field level staggered iterations - structorder: 2 # order of displacement shape functions (when mesh is defined) - bbarstabilisation: false - integrationorder: 2 # order of quadrature rule required (when mesh is defined) - itmax: 250 # Maximum iteration number - itmin: 2 # Minimum iteration number - eps_struct_atol: 1.0e-10 # absolute tolerance for mechanical equilibrium - eps_struct_rtol: 1.0e-4 # relative tolerance for mechanical equilibrium + mesh: + N_cutback_max: 3 # maximum cut back level (0: 1, 1: 0.5, 2: 0.25, etc) + N_staggered_iter_max: 10 # max number of field level staggered iterations + p_s: 2 # order of displacement shape functions (when mesh is defined) + bbarstabilisation: false + p_i: 2 # order of quadrature rule required (when mesh is defined) + N_iter_max: 250 # Maximum iteration number + eps_abs_div(P): 1.0e-10 # absolute tolerance for mechanical equilibrium + eps_rel_div(P): 1.0e-4 # relative tolerance for mechanical equilibrium phase: mechanical: diff --git a/src/mesh/DAMASK_mesh.f90 b/src/mesh/DAMASK_mesh.f90 index 4bfd791f5..133a98997 100644 --- a/src/mesh/DAMASK_mesh.f90 +++ b/src/mesh/DAMASK_mesh.f90 @@ -66,6 +66,7 @@ program DAMASK_mesh stagIter, & component type(tDict), pointer :: & + num_solver, & num_mesh character(len=pSTRLEN), dimension(:), allocatable :: fileContent character(len=pSTRLEN) :: & @@ -90,12 +91,13 @@ program DAMASK_mesh !--------------------------------------------------------------------- ! reading field information from numerics file and do sanity checks - num_mesh => config_numerics%get_dict('mesh', defaultVal=emptyDict) - stagItMax = num_mesh%get_asInt('maxStaggeredIter',defaultVal=10) - maxCutBack = num_mesh%get_asInt('maxCutBack',defaultVal=3) + num_solver => config_numerics%get_dict('solver', defaultVal=emptyDict) + num_mesh => num_solver%get_dict('mesh', defaultVal=emptyDict) + stagItMax = num_mesh%get_asInt('N_staggered_iter_max',defaultVal=10) + maxCutBack = num_mesh%get_asInt('N_cutback_max',defaultVal=3) - if (stagItMax < 0) call IO_error(301,ext_msg='maxStaggeredIter') - if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack') + 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') ! reading basic information from load case file and allocate data structure containing load cases call DMGetDimension(geomMesh,dimPlex,err_PETSc) !< dimension of mesh (2D or 3D) @@ -229,8 +231,8 @@ program DAMASK_mesh !-------------------------------------------------------------------------------------------------- ! doing initialization depending on active solvers - call FEM_Utilities_init() - call FEM_mechanical_init(loadCases(1)%fieldBC(1)) + call FEM_Utilities_init(num_mesh) + call FEM_mechanical_init(loadCases(1)%fieldBC(1),num_mesh) call config_numerics_deallocate() if (worldrank == 0) then diff --git a/src/mesh/FEM_utilities.f90 b/src/mesh/FEM_utilities.f90 index d30b223f0..fb54581f1 100644 --- a/src/mesh/FEM_utilities.f90 +++ b/src/mesh/FEM_utilities.f90 @@ -90,11 +90,14 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Allocate all neccessary fields. !-------------------------------------------------------------------------------------------------- -subroutine FEM_utilities_init +subroutine FEM_utilities_init(num_mesh) - character(len=pSTRLEN) :: petsc_optionsOrder - type(tDict), pointer :: & + type(tDict), pointer, intent(in) :: & num_mesh + character(len=pSTRLEN) :: petsc_optionsOrder + character(len=:), allocatable :: & + extmsg, & + petsc_options integer :: & p_s, & !< order of shape functions p_i !< integration order (quadrature rule) @@ -103,8 +106,6 @@ subroutine FEM_utilities_init print'(/,1x,a)', '<<<+- FEM_utilities init -+>>>' - num_mesh => config_numerics%get_dict('mesh',defaultVal=emptyDict) - p_s = num_mesh%get_asInt('p_s',defaultVal = 2) p_i = num_mesh%get_asInt('p_i',defaultVal = p_s) @@ -117,12 +118,13 @@ subroutine FEM_utilities_init call PetscOptionsClear(PETSC_NULL_OPTIONS,err_PETSc) CHKERRQ(err_PETSc) CHKERRQ(err_PETSc) - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,'-mechanical_snes_type newtonls & + + petsc_options = misc_prefixOptions('-mechanical_snes_type newtonls & &-mechanical_snes_linesearch_type cp -mechanical_snes_ksp_ew & &-mechanical_snes_ksp_ew_rtol0 0.01 -mechanical_snes_ksp_ew_rtolmax 0.01 & - &-mechanical_ksp_type fgmres -mechanical_ksp_max_it 25', err_PETSc) - CHKERRQ(err_PETSc) - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,num_mesh%get_asStr('PETSc_options',defaultVal=''),err_PETSc) + &-mechanical_ksp_type fgmres -mechanical_ksp_max_it 25' // & + num_mesh%get_asStr('PETSc_options',defaultVal=''), 'mechanical_') + call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) write(petsc_optionsOrder,'(a,i0)') '-mechFE_petscspace_degree ', p_s call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(petsc_optionsOrder),err_PETSc) diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index 5cd12549e..93476b0fb 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -89,6 +89,7 @@ subroutine discretization_mesh_init(restart) PetscInt, dimension(:), allocatable :: & materialAt type(tDict), pointer :: & + num_solver, & num_mesh integer :: p_i, dim !< integration order (quadrature rule) type(tvec) :: coords_node0 @@ -99,7 +100,8 @@ subroutine discretization_mesh_init(restart) !-------------------------------------------------------------------------------- ! read numerics parameter - num_mesh => config_numerics%get_dict('mesh',defaultVal=emptyDict) + num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) + num_mesh => config_numerics%get_dict('mesh',defaultVal=emptyDict) p_i = num_mesh%get_asInt('p_i',defaultVal = 2) #if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>16) diff --git a/src/mesh/mesh_mech_FEM.f90 b/src/mesh/mesh_mech_FEM.f90 index 43a1b0579..27ff89f9c 100644 --- a/src/mesh/mesh_mech_FEM.f90 +++ b/src/mesh/mesh_mech_FEM.f90 @@ -94,9 +94,10 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all neccessary fields and fills them with data !-------------------------------------------------------------------------------------------------- -subroutine FEM_mechanical_init(fieldBC) +subroutine FEM_mechanical_init(fieldBC,num_mesh) - type(tFieldBC), intent(in) :: fieldBC + type(tFieldBC), intent(in) :: fieldBC + type(tDict), pointer, intent(in) :: num_mesh DM :: mechanical_mesh PetscFE :: mechFE @@ -126,23 +127,20 @@ subroutine FEM_mechanical_init(fieldBC) character(len=*), parameter :: prefix = 'mechFE_' PetscErrorCode :: err_PETSc real(pREAL), dimension(3,3) :: devNull - type(tDict), pointer :: & - num_mesh print'(/,1x,a)', '<<<+- FEM_mech init -+>>>'; flush(IO_STDOUT) !----------------------------------------------------------------------------- ! read numerical parametes and do sanity checks - num_mesh => config_numerics%get_dict('mesh',defaultVal=emptyDict) num%p_i = int(num_mesh%get_asInt('p_i',defaultVal = 2),pPETSCINT) - num%itmax = int(num_mesh%get_asInt('itmax',defaultVal=250),pPETSCINT) + num%itmax = int(num_mesh%get_asInt('N_iter_max',defaultVal=250),pPETSCINT) num%BBarStabilisation = num_mesh%get_asBool('bbarstabilisation',defaultVal = .false.) - num%eps_struct_atol = num_mesh%get_asReal('eps_struct_atol', defaultVal = 1.0e-10_pREAL) - num%eps_struct_rtol = num_mesh%get_asReal('eps_struct_rtol', defaultVal = 1.0e-4_pREAL) + num%eps_struct_atol = num_mesh%get_asReal('eps_abs_div(P)', defaultVal = 1.0e-10_pREAL) + num%eps_struct_rtol = num_mesh%get_asReal('eps_rel_div(P)', defaultVal = 1.0e-4_pREAL) - if (num%itmax <= 1) call IO_error(301,ext_msg='itmax') - if (num%eps_struct_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_struct_rtol') - if (num%eps_struct_atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_struct_atol') + if (num%itmax <= 1) call IO_error(301,ext_msg='N_iter_max') + if (num%eps_struct_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_div(P)') + if (num%eps_struct_atol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_abs_div(P)') !-------------------------------------------------------------------------------------------------- ! Setup FEM mech mesh From ac63ee36008ecbe6ace8a2509649a42a271c5273 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 2 Aug 2023 14:08:25 +0200 Subject: [PATCH 090/198] marc and other minor changes --- examples/config/numerics.yaml | 105 +++++++++++++++--------------- src/Marc/discretization_Marc.f90 | 6 +- src/grid/grid_damage_spectral.f90 | 4 +- src/mesh/FEM_utilities.f90 | 1 - 4 files changed, 59 insertions(+), 57 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index 247ae21c5..8e6a91389 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -1,5 +1,6 @@ # Available numerical parameters # Case sensitive keys +--- homogenization: mechanical: @@ -21,74 +22,74 @@ homogenization: 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) + 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 + 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 + phi_min: 1.0e-6 # non-zero residual damage 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 + 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) + 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 + 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 + 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 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: - N_cutback_max: 3 # maximum cut back level (0: 1, 1: 0.5, 2: 0.25, etc) - N_staggered_iter_max: 10 # max number of field level staggered iterations - p_s: 2 # order of displacement shape functions (when mesh is defined) + N_cutback_max: 3 # maximum cut back level (0: 1, 1: 0.5, 2: 0.25, etc) + N_staggered_iter_max: 10 # max number of field level staggered iterations + p_s: 2 # order of displacement shape functions (when mesh is defined) bbarstabilisation: false - p_i: 2 # order of quadrature rule required (when mesh is defined) - N_iter_max: 250 # Maximum iteration number - eps_abs_div(P): 1.0e-10 # absolute tolerance for mechanical equilibrium - eps_rel_div(P): 1.0e-4 # relative tolerance for mechanical equilibrium + p_i: 2 # order of quadrature rule required (when mesh is defined) + N_iter_max: 250 # Maximum iteration number + eps_abs_div(P): 1.0e-10 # absolute tolerance for mechanical equilibrium + eps_rel_div(P): 1.0e-4 # relative tolerance for mechanical equilibrium + + Marc: + unit_length: 1.0 # physical length of one computational length unit phase: mechanical: - r_cutback_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in phase state calculation - r_cutback: 0.25 # factor to decrease size of step when cutback introduced in phase state calculation (value between 0 and 1) - r_increase: 1.5 # factor to increase size of next step when previous step converged in phase state calculation - eps_rel_state: 1.0e-6 # relative tolerance in phase state loop (abs tol provided by constitutive law) - N_iter_state_max: 10 # state loop limit + r_cutback_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in phase state calculation + r_cutback: 0.25 # factor to decrease size of step when cutback introduced in phase state calculation (value between 0 and 1) + r_increase: 1.5 # factor to increase size of next step when previous step converged in phase state calculation + eps_rel_state: 1.0e-6 # relative tolerance in phase state loop (abs tol provided by constitutive law) + N_iter_state_max: 10 # state loop limit plastic: - r_linesearch_Lp: 0.5 # factor to decrease the step due to non-convergence in Lp calculation - eps_rel_Lp: 1.0e-6 # relative tolerance in Lp residuum - eps_abs_Lp: 1.0e-8 # absolute tolerance in Lp residuum - N_iter_Lp_max: 40 # stress loop limit for Lp - f_update_jacobi_Lp: 1 # frequency of Jacobian update of residuum in Lp - integrator_state: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) + r_linesearch_Lp: 0.5 # factor to decrease the step due to non-convergence in Lp calculation + eps_rel_Lp: 1.0e-6 # relative tolerance in Lp residuum + eps_abs_Lp: 1.0e-8 # absolute tolerance in Lp residuum + N_iter_Lp_max: 40 # stress loop limit for Lp + f_update_jacobi_Lp: 1 # frequency of Jacobian update of residuum in Lp + integrator_state: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) eigen: - r_linesearch_Li: 0.5 # factor to decrease the step due to non-convergence in Li calculation - eps_rel_Li: 1.0e-6 # relative tolerance in Li residuum - eps_abs_Li: 1.0e-8 # absolute tolerance in Li residuum - N_iter_Li_max: 40 # stress loop limit for Li - f_update_jacobi_Li: 1 # frequency of Jacobian update of residuum in Li - -commercialFEM: - unitlength: 1 # physical length of one computational length unit + r_linesearch_Li: 0.5 # factor to decrease the step due to non-convergence in Li calculation + eps_rel_Li: 1.0e-6 # relative tolerance in Li residuum + eps_abs_Li: 1.0e-8 # absolute tolerance in Li residuum + N_iter_Li_max: 40 # stress loop limit for Li + f_update_jacobi_Li: 1 # frequency of Jacobian update of residuum in Li generic: - random_seed: 0 # fixed seeding for pseudo-random number generator, Default 0: use random seed. - phi_min: 1.0e-6 # non-zero residual damage. + random_seed: 0 # fixed seeding for pseudo-random number generator, Default 0: use random seed. diff --git a/src/Marc/discretization_Marc.f90 b/src/Marc/discretization_Marc.f90 index 3d9778e0e..b38e3b2ac 100644 --- a/src/Marc/discretization_Marc.f90 +++ b/src/Marc/discretization_Marc.f90 @@ -69,13 +69,15 @@ subroutine discretization_Marc_init unscaledNormals type(tDict), pointer :: & + num_solver, & num_commercialFEM print'(/,a)', ' <<<+- discretization_Marc init -+>>>'; flush(6) - num_commercialFEM => config_numerics%get_dict('commercialFEM',defaultVal = emptyDict) - mesh_unitlength = num_commercialFEM%get_asReal('unitlength',defaultVal=1.0_pREAL) ! set physical extent of a length unit in mesh + num_solver => config_numerics%get_asDict('solver',defaultVal=emptyDict) + num_commercialFEM => num_solver%get_asDict('Marc', defaultVal = emptyDict) + mesh_unitlength = num_commercialFEM%get_asReal('unit_length',defaultVal=1.0_pREAL) ! set physical extent of a length unit in mesh if (mesh_unitlength <= 0.0_pREAL) call IO_error(301,'unitlength') call inputRead(elem,node0_elem,connectivity_elem,materialAt) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 48023cc54..648f9ebbb 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -102,7 +102,7 @@ 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=100) + 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) @@ -110,7 +110,7 @@ subroutine grid_damage_spectral_init(num_grid) 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%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/mesh/FEM_utilities.f90 b/src/mesh/FEM_utilities.f90 index fb54581f1..d6b0c7b77 100644 --- a/src/mesh/FEM_utilities.f90 +++ b/src/mesh/FEM_utilities.f90 @@ -96,7 +96,6 @@ subroutine FEM_utilities_init(num_mesh) num_mesh character(len=pSTRLEN) :: petsc_optionsOrder character(len=:), allocatable :: & - extmsg, & petsc_options integer :: & p_s, & !< order of shape functions From c960f8ed582334f48bd75e39161adead13028e0b Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 2 Aug 2023 14:20:17 +0200 Subject: [PATCH 091/198] space needed to add new option + marc changes --- src/Marc/discretization_Marc.f90 | 4 ++-- src/mesh/FEM_utilities.f90 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Marc/discretization_Marc.f90 b/src/Marc/discretization_Marc.f90 index b38e3b2ac..a5094b7fa 100644 --- a/src/Marc/discretization_Marc.f90 +++ b/src/Marc/discretization_Marc.f90 @@ -75,8 +75,8 @@ subroutine discretization_Marc_init print'(/,a)', ' <<<+- discretization_Marc init -+>>>'; flush(6) - num_solver => config_numerics%get_asDict('solver',defaultVal=emptyDict) - num_commercialFEM => num_solver%get_asDict('Marc', defaultVal = emptyDict) + num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) + num_commercialFEM => num_solver%get_dict('Marc', defaultVal = emptyDict) mesh_unitlength = num_commercialFEM%get_asReal('unit_length',defaultVal=1.0_pREAL) ! set physical extent of a length unit in mesh if (mesh_unitlength <= 0.0_pREAL) call IO_error(301,'unitlength') diff --git a/src/mesh/FEM_utilities.f90 b/src/mesh/FEM_utilities.f90 index d6b0c7b77..9f326673b 100644 --- a/src/mesh/FEM_utilities.f90 +++ b/src/mesh/FEM_utilities.f90 @@ -125,7 +125,7 @@ subroutine FEM_utilities_init(num_mesh) num_mesh%get_asStr('PETSc_options',defaultVal=''), 'mechanical_') call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) - write(petsc_optionsOrder,'(a,i0)') '-mechFE_petscspace_degree ', p_s + write(petsc_optionsOrder,'(a,i0)') ' -mechFE_petscspace_degree ', p_s call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(petsc_optionsOrder),err_PETSc) CHKERRQ(err_PETSc) From 99292c50819bf62b5e07bf85ce05f6209976378c Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 2 Aug 2023 16:02:51 +0200 Subject: [PATCH 092/198] prefix not required --- PRIVATE | 2 +- src/mesh/FEM_utilities.f90 | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/PRIVATE b/PRIVATE index 9a067cb27..12fe8685a 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 9a067cb2757df91b9242414779a8b52ac9e5ee02 +Subproject commit 12fe8685a2a2c1e37a8bb8e63e03130c99295023 diff --git a/src/mesh/FEM_utilities.f90 b/src/mesh/FEM_utilities.f90 index 9f326673b..cca975724 100644 --- a/src/mesh/FEM_utilities.f90 +++ b/src/mesh/FEM_utilities.f90 @@ -118,20 +118,19 @@ subroutine FEM_utilities_init(num_mesh) CHKERRQ(err_PETSc) CHKERRQ(err_PETSc) - petsc_options = misc_prefixOptions('-mechanical_snes_type newtonls & - &-mechanical_snes_linesearch_type cp -mechanical_snes_ksp_ew & - &-mechanical_snes_ksp_ew_rtol0 0.01 -mechanical_snes_ksp_ew_rtolmax 0.01 & - &-mechanical_ksp_type fgmres -mechanical_ksp_max_it 25' // & + petsc_options = misc_prefixOptions('-snes_type newtonls & + &-snes_linesearch_type cp -snes_ksp_ew & + &-snes_ksp_ew_rtol0 0.01 -snes_ksp_ew_rtolmax 0.01 & + &-ksp_type fgmres -ksp_max_it 25 ' // & num_mesh%get_asStr('PETSc_options',defaultVal=''), 'mechanical_') + + write(petsc_optionsOrder,'(a,i0)') '-mechFE_petscspace_degree ', p_s + petsc_options = petsc_options // ' ' // petsc_optionsOrder call PetscOptionsInsertString(PETSC_NULL_OPTIONS,petsc_options,err_PETSc) CHKERRQ(err_PETSc) - write(petsc_optionsOrder,'(a,i0)') ' -mechFE_petscspace_degree ', p_s - call PetscOptionsInsertString(PETSC_NULL_OPTIONS,trim(petsc_optionsOrder),err_PETSc) - CHKERRQ(err_PETSc) wgt = real(mesh_maxNips*mesh_NcpElemsGlobal,pREAL)**(-1) - end subroutine FEM_utilities_init From e25db6830f3a01e3322b31c0535681d157466b75 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 2 Aug 2023 18:31:49 +0200 Subject: [PATCH 093/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-716-g23cd3fc1f --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 936f2efa1..84cae21df 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-713-gd73f76901 +3.0.0-alpha7-716-g23cd3fc1f From 1d0cd6826e80e9be38f958310e717b0f66e5d879 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Thu, 3 Aug 2023 14:35:07 +0200 Subject: [PATCH 094/198] during update revision update development first then master to minimize critical time frame --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50c239f65..dde542a6c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -284,6 +284,6 @@ update_revision: - > git diff-index --quiet HEAD || git commit VERSION -m "[skip ci] updated version information after successful test of $VERSION" - - if [ ${CI_COMMIT_SHA} == $(git rev-parse HEAD^) ]; then git push origin HEAD:master HEAD:development; fi + - if [ ${CI_COMMIT_SHA} == $(git rev-parse HEAD^) ]; then git push origin HEAD:development HEAD:master; fi only: - development From ab2711390b888e8a0da65a5dbd1814441679367c Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 3 Aug 2023 16:44:57 +0200 Subject: [PATCH 095/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-721-g1d0cd6826 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 84cae21df..70ac65c95 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-716-g23cd3fc1f +3.0.0-alpha7-721-g1d0cd6826 From fe3b58e5017d360b31aa6f69f3e78831fd4e026a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 4 Aug 2023 09:54:59 +0200 Subject: [PATCH 096/198] avoid race conditions --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dde542a6c..e988f6cf9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -284,6 +284,6 @@ update_revision: - > git diff-index --quiet HEAD || git commit VERSION -m "[skip ci] updated version information after successful test of $VERSION" - - if [ ${CI_COMMIT_SHA} == $(git rev-parse HEAD^) ]; then git push origin HEAD:development HEAD:master; fi + - if [ ${CI_COMMIT_SHA} == $(git rev-parse HEAD^) ]; then git push --atomic --no-verify origin HEAD:development HEAD:master; fi only: - development From d428024d4dcde4b1caca4fab20c54a793019f2d7 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 4 Aug 2023 17:56:57 +0200 Subject: [PATCH 097/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-724-ga2c9cfbbe --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 70ac65c95..deab02c80 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-721-g1d0cd6826 +3.0.0-alpha7-724-ga2c9cfbbe From ffdf478b62fd26afcf026ef1af39e2d7c9f2fc3d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 4 Aug 2023 12:43:56 -0400 Subject: [PATCH 098/198] all parameters as slip family-dependent --- PRIVATE | 2 +- .../plastic/phenopowerlaw_AA6022-T4.yaml | 8 +- .../mechanical/plastic/phenopowerlaw_Al.yaml | 8 +- .../mechanical/plastic/phenopowerlaw_Au.yaml | 8 +- .../mechanical/plastic/phenopowerlaw_Cu.yaml | 8 +- .../phenopowerlaw_DP-steel-ferrite.yaml | 8 +- .../mechanical/plastic/phenopowerlaw_Mg.yaml | 18 +-- .../plastic/phenopowerlaw_Pt-5%Cu.yaml | 12 +- .../plastic/phenopowerlaw_Sn-beta.yaml | 8 +- .../mechanical/plastic/phenopowerlaw_Ti.yaml | 12 +- .../phenopowerlaw_bcc_martensite.yaml} | 14 +- examples/grid/material.yaml | 8 +- ...phase_mechanical_plastic_phenopowerlaw.f90 | 131 ++++++++++-------- 13 files changed, 131 insertions(+), 114 deletions(-) rename examples/config/{Phase_Phenopowerlaw_BCC-Martensite.yaml => phase/mechanical/plastic/phenopowerlaw_bcc_martensite.yaml} (78%) diff --git a/PRIVATE b/PRIVATE index 8c05965ef..4e1957339 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 8c05965ef4437598898f467a213ffa88938e860a +Subproject commit 4e195733964bfa36de70abb768a65a7216180d0f diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_AA6022-T4.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_AA6022-T4.yaml index 36e1a1cc8..9dc5b08ad 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_AA6022-T4.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_AA6022-T4.yaml @@ -10,10 +10,10 @@ output: [xi_sl, gamma_sl] N_sl: [12] -n_sl: 20 -a_sl: 3.7 -h_0_sl-sl: 1.02e+9 +dot_gamma_0_sl: [0.001] +n_sl: [20] +a_sl: [3.7] xi_0_sl: [76.e+6] xi_inf_sl: [266.e+6] +h_0_sl-sl: [1.02e+9] h_sl-sl: [1, 1, 5.123, 0.574, 1.123, 1.123, 1] -dot_gamma_0_sl: 0.001 diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Al.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Al.yaml index 76194d700..ab2ac4730 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Al.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Al.yaml @@ -10,10 +10,10 @@ output: [xi_sl, gamma_sl] N_sl: [12] -n_sl: 20 -a_sl: 5.4 -h_0_sl-sl: 281.5e+6 +dot_gamma_0_sl: [7.5e-5] +n_sl: [20] +a_sl: [5.4] xi_0_sl: [2.69e+6] xi_inf_sl: [67.5e+6] +h_0_sl-sl: [0.2815e+9] h_sl-sl: [1, 1, 5.123, 0.574, 1.123, 1.123, 1] -dot_gamma_0_sl: 7.5e-5 diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Au.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Au.yaml index 3eaed00c4..54515a6f7 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Au.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Au.yaml @@ -15,10 +15,10 @@ output: [xi_sl, gamma_sl] N_sl: [12] -n_sl: 83.3 -a_sl: 1.0 -h_0_sl-sl: 75.0e+6 +dot_gamma_0_sl: [0.001] +n_sl: [83.3] +a_sl: [1.0] xi_0_sl: [26.25e+6] xi_inf_sl: [53.0e+6] +h_0_sl-sl: [75.0e+6] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] -dot_gamma_0_sl: 0.001 diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Cu.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Cu.yaml index 08f366b15..5b132453b 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Cu.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Cu.yaml @@ -10,10 +10,10 @@ output: [xi_sl, gamma_sl] N_sl: [12] -n_sl: 20 -a_sl: 0.6 -h_0_sl-sl: 3.5e+8 +dot_gamma_0_sl: [3.e-3] +n_sl: [20] +a_sl: [0.6] xi_0_sl: [1.6e+6] xi_inf_sl: [96.4e+6] +h_0_sl-sl: [0.35e+9] h_sl-sl: [1, 1, 5.123, 0.574, 1.123, 1.123, 1] -dot_gamma_0_sl: 3.e-3 diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_DP-steel-ferrite.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_DP-steel-ferrite.yaml index 023159bb2..0587e222d 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_DP-steel-ferrite.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_DP-steel-ferrite.yaml @@ -12,10 +12,10 @@ output: [xi_sl, gamma_sl] N_sl: [12, 12] -n_sl: 20 -a_sl: 2.25 -h_0_sl-sl: 1.0e+9 +dot_gamma_0_sl: [0.001, 0.001] +n_sl: [20, 20] +a_sl: [2.25, 2.25] xi_0_sl: [95.e+6, 96.e+6] xi_inf_sl: [222.e+6, 412.e+6] +h_0_sl-sl: [1.0e+9, 1.0e+9] h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4] -dot_gamma_0_sl: 0.001 diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Mg.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Mg.yaml index 9ccc0ab3c..9f9e5fbdf 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Mg.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Mg.yaml @@ -14,16 +14,16 @@ xi_0_sl: [10.e+6, 55.e+6, 60.e+6, 0., 60.e+6] xi_inf_sl: [40.e+6, 135.e+6, 150.e+6, 0., 150.e+6] xi_0_tw: [40.e+6, 0., 60.e+6] -a_sl: 2.25 -dot_gamma_0_sl: 0.001 -dot_gamma_0_tw: 0.001 -n_sl: 20 -n_tw: 20 -f_sat_sl-tw: 10.0 +a_sl: [2.25, 2.25, 2.25, 1, 2.25] +dot_gamma_0_sl: [0.001, 0.001, 0.001, 0, 0.001] +dot_gamma_0_tw: [0.001, 0, 0.001] +n_sl: [20, 20, 20, 1, 20] +n_tw: [20, 1, 20] +f_sat_sl-tw: [10.0, 10.0, 10.0, 0, 10.0] -h_0_sl-sl: 500.0e+6 -h_0_tw-tw: 50.0e+6 -h_0_tw-sl: 150.0e+6 +h_0_sl-sl: [0.5e+9, 0.5e+9, 0.5e+9, 0, 0.5e+9] +h_0_tw-tw: [50.0e+6, 0, 50.0e+6] +h_0_tw-sl: [0.15e+9, 0, 0.15e+9] h_sl-sl: [+1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, +1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml index 59b58cdb1..500bb1ca6 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml @@ -10,10 +10,10 @@ output: [xi_sl, gamma_sl] N_sl: [12] -n_sl: 20 -a_sl: 0.9 -h_0_sl-sl: 781.2e+6 -xi_0_sl: [114.e+6] -xi_inf_sl: [207.e+6] +dot_gamma_0_sl: [0.001] +n_sl: [20] +a_sl: [0.9] +xi_0_sl: [0.114e+9] +xi_inf_sl: [0.207e+9] +h_0_sl-sl: [0.7812e+9] h_sl-sl: [1, 1, 5.123, 0.574, 1.123, 1.123, 1] -dot_gamma_0_sl: 0.001 diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Sn-beta.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Sn-beta.yaml index 6877fe229..d8608b0cb 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Sn-beta.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Sn-beta.yaml @@ -9,9 +9,9 @@ output: [xi_sl, gamma_sl] N_sl: [2, 2, 2, 4, 2, 4, 2, 2, 4, 0, 0, 8] -n_sl: 6.0 -a_sl: 2.0 -h_0_sl-sl: 20.0e+6 +n_sl: [6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 1, 1, 6.0] +a_sl: [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 1.0, 1.0, 2.0] +h_0_sl-sl: [20e+6, 20e+6, 20e+6, 20e+6, 20e+6, 20e+6, 20e+6, 20e+6, 20e+6, 0.0, 0.0, 20e+6] xi_0_sl: [8.5e+6, 4.3e+6, 10.4e+6, 4.5e+6, 5.6e+6, 5.1e+6, 7.4e+6, 15.0e+6, 6.6e+6, 0.0, 0.0, 12.0e+6] xi_inf_sl: [11.0e+6, 9.0e+6, 11.0e+6, 9.0e+6, 10.0e+6, 10.0e+6, 10.0e+6, 10.0e+6, 9.0e+6, 0.0, 0.0, 13.0e+6] h_sl-sl: [+1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, @@ -30,4 +30,4 @@ h_sl-sl: [+1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, +1.0, -1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, # 150 +1.0, 1.0, 1.0, 1.0, 1.0, 1.0] # unused entries are indicated by -1.0 -dot_gamma_0_sl: 2.6e-8 +dot_gamma_0_sl: [2.6e-8, 2.6e-8, 2.6e-8, 2.6e-8, 2.6e-8, 2.6e-8, 2.6e-8, 2.6e-8, 2.6e-8, 1.0, 1.0, 2.6e-8] diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Ti.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Ti.yaml index 2dbf81ddc..5da7e2e31 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Ti.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Ti.yaml @@ -12,17 +12,17 @@ output: [gamma_sl] N_sl: [3, 3, 0, 12] # basal, prism, -, 1. pyr -n_sl: 20 -a_sl: 2.0 -dot_gamma_0_sl: 0.001 -h_0_sl-sl: 200.e+6 +dot_gamma_0_sl: [0.001, 0.001, 0.0, 0.001] +n_sl: [20, 20, 1, 20] +a_sl: [2.0, 2.0, 1.0, 2.0] # C. Zambaldi et al.: -xi_0_sl: [349.e+6, 150.e+6, 0.0, 1107.e+6] -xi_inf_sl: [568.e+6, 150.e+7, 0.0, 3420.e+6] +xi_0_sl: [0.349e+9, 0.15e+9, 0.0, 1.107e+9] +xi_inf_sl: [0.568e+9, 1.50e+9, 0.0, 3.420e+9] # L. Wang et al. : # xi_0_sl: [127.e+6, 96.e+6, 0.0, 240.e+6] +h_0_sl-sl: [0.2e+9, 0.2e+9, 0.0, 0.2e+9] h_sl-sl: [+1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, +1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, diff --git a/examples/config/Phase_Phenopowerlaw_BCC-Martensite.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_bcc_martensite.yaml similarity index 78% rename from examples/config/Phase_Phenopowerlaw_BCC-Martensite.yaml rename to examples/config/phase/mechanical/plastic/phenopowerlaw_bcc_martensite.yaml index f2066b373..739302fc3 100644 --- a/examples/config/Phase_Phenopowerlaw_BCC-Martensite.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_bcc_martensite.yaml @@ -1,12 +1,14 @@ # Tasan et.al. 2015 Acta Materalia # Tasan et.al. 2015 International Journal of Plasticity # Diehl et.al. 2015 Meccanica -N_sl: [12, 12] -a_sl: 2.0 -dot_gamma_0_sl: 0.001 -h_0_sl-sl: 563.0e+9 -h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4] -n_sl: 20 type: phenopowerlaw + +N_sl: [12, 12] + +dot_gamma_0_sl: [0.001, 0.001] +n_sl: [20, 20] +a_sl: [2.0, 2.0] xi_0_sl: [405.8e+6, 456.7e+6] xi_inf_sl: [872.9e+6, 971.2e+6] +h_0_sl-sl: [563.0e+9, 563.0e+9] +h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4] diff --git a/examples/grid/material.yaml b/examples/grid/material.yaml index a89068e1b..f5216be96 100644 --- a/examples/grid/material.yaml +++ b/examples/grid/material.yaml @@ -13,12 +13,12 @@ phase: plastic: type: phenopowerlaw N_sl: [12] - a_sl: 2.25 + a_sl: [2.25] atol_xi: 1.0 - dot_gamma_0_sl: 0.001 - h_0_sl-sl: 75.e+6 + dot_gamma_0_sl: [0.001] + h_0_sl-sl: [75.e+6] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] - n_sl: 20 + n_sl: [20] output: [xi_sl] xi_0_sl: [31.e+6] xi_inf_sl: [63.e+6] diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index e9e28658b..95a16e450 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -7,23 +7,21 @@ submodule(phase:plastic) phenopowerlaw type :: tParameters - real(pREAL) :: & - dot_gamma_0_sl = 1.0_pREAL, & !< reference shear strain rate for slip - dot_gamma_0_tw = 1.0_pREAL, & !< reference shear strain rate for twin - n_sl = 1.0_pREAL, & !< stress exponent for slip - n_tw = 1.0_pREAL, & !< stress exponent for twin - f_sat_sl_tw = 1.0_pREAL, & !< push-up factor for slip saturation due to twinning - c_1 = 1.0_pREAL, & - c_2 = 1.0_pREAL, & - c_3 = 1.0_pREAL, & - c_4 = 1.0_pREAL, & - h_0_sl_sl = 1.0_pREAL, & !< reference hardening slip - slip - h_0_tw_sl = 1.0_pREAL, & !< reference hardening twin - slip - h_0_tw_tw = 1.0_pREAL, & !< reference hardening twin - twin - a_sl = 1.0_pREAL real(pREAL), allocatable, dimension(:) :: & + dot_gamma_0_sl, & !< reference shear strain rate for slip + dot_gamma_0_tw, & !< reference shear strain rate for twin + a_sl, & + n_sl, & !< stress exponent for slip + n_tw, & !< stress exponent for twin xi_inf_sl, & !< maximum critical shear stress for slip - h_int, & !< per family hardening activity (optional) + f_sat_sl_tw, & !< push-up factor for slip saturation due to twinning + c_1, & + c_2, & + c_3, & + c_4, & + h_0_sl_sl, & !< reference hardening slip - slip + h_0_tw_sl, & !< reference hardening twin - slip + h_0_tw_tw, & !< reference hardening twin - twin gamma_char !< characteristic shear for twins real(pREAL), allocatable, dimension(:,:) :: & h_sl_sl, & !< slip resistance from slip activity @@ -40,7 +38,7 @@ submodule(phase:plastic) phenopowerlaw sum_N_tw !< total number of active twin systems logical :: & nonSchmidActive = .false. - character(len=pSTRLEN), allocatable, dimension(:) :: & + character(len=pSTRLEN), allocatable, dimension(:) :: & output character(len=:), allocatable, dimension(:) :: & systems_sl, & @@ -81,6 +79,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & ph, i, & + N_fam, & Nmembers, & sizeState, sizeDotState, & startIndex, endIndex @@ -90,7 +89,8 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) real(pREAL), dimension(:), allocatable :: & xi_0_sl, & !< initial critical shear stress for slip xi_0_tw, & !< initial critical shear stress for twin - a !< non-Schmid coefficients + a, & !< non-Schmid coefficients + ones character(len=:), allocatable :: & refs, & extmsg @@ -134,20 +134,26 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) prm%output = pl%get_as1dStr('output',defaultVal=emptyStrArray) #endif + + N_sl = pl%get_as1dInt('N_sl',defaultVal=emptyIntArray) + N_tw = pl%get_as1dInt('N_tw',defaultVal=emptyIntArray) + prm%sum_N_sl = sum(abs(N_sl)) + prm%sum_N_tw = sum(abs(N_tw)) + !-------------------------------------------------------------------------------------------------- ! slip related parameters - 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%dot_gamma_0_sl = pl%get_asReal('dot_gamma_0_sl') - prm%n_sl = pl%get_asReal('n_sl') - prm%a_sl = pl%get_asReal('a_sl') - prm%h_0_sl_sl = pl%get_asReal('h_0_sl-sl') - - xi_0_sl = math_expand(pl%get_as1dReal('xi_0_sl', requiredSize=size(N_sl)),N_sl) - prm%xi_inf_sl = math_expand(pl%get_as1dReal('xi_inf_sl', requiredSize=size(N_sl)),N_sl) - 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) + N_fam = size(N_sl) + ones = [(1.0_pREAL,i=1,N_fam)] + prm%dot_gamma_0_sl = math_expand(pl%get_as1dReal('dot_gamma_0_sl',requiredSize=N_fam,defaultVal= ones), N_sl) + prm%n_sl = math_expand(pl%get_as1dReal('n_sl', requiredSize=N_fam,defaultVal= ones), N_sl) + prm%a_sl = math_expand(pl%get_as1dReal('a_sl', requiredSize=N_fam,defaultVal= ones), N_sl) + prm%h_0_sl_sl = math_expand(pl%get_as1dReal('h_0_sl-sl', requiredSize=N_fam,defaultVal=0.0_pREAL*ones), N_sl) + prm%c_1 = math_expand(pl%get_as1dReal('c_1', requiredSize=N_fam,defaultVal=0.0_pREAL*ones), N_sl) + prm%c_2 = math_expand(pl%get_as1dReal('c_2', requiredSize=N_fam,defaultVal= ones), N_sl) + xi_0_sl = math_expand(pl%get_as1dReal('xi_0_sl', requiredSize=N_fam), N_sl) + prm%xi_inf_sl = math_expand(pl%get_as1dReal('xi_inf_sl', requiredSize=N_fam), N_sl) + prm%f_sat_sl_tw = math_expand(pl%get_as1dReal('f_sat_sl-tw',requiredSize=N_fam,defaultVal=0.0_pREAL*ones), N_sl) prm%h_sl_sl = crystal_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'),phase_lattice(ph)) @@ -166,35 +172,37 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) 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' - if ( prm%a_sl <= 0.0_pREAL) extmsg = trim(extmsg)//' a_sl' - if ( prm%n_sl <= 0.0_pREAL) extmsg = trim(extmsg)//' n_sl' + if (any(prm%dot_gamma_0_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' dot_gamma_0_sl' + if (any(prm%a_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' a_sl' + if (any(prm%n_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' n_sl' if (any(xi_0_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' xi_0_sl' if (any(prm%xi_inf_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' xi_inf_sl' else slipActive xi_0_sl = emptyRealArray - allocate(prm%xi_inf_sl, & - prm%h_int, & + allocate(prm%dot_gamma_0_sl, & !< reference shear strain rate for slip + prm%a_sl, & + prm%n_sl, & !< stress exponent for slip + prm%xi_inf_sl, & !< maximum critical shear stress for slip + prm%f_sat_sl_tw, & !< push-up factor for slip saturation due to twinning + prm%c_1, & + prm%c_2, & + prm%h_0_sl_sl, & !< reference hardening slip - slip source=emptyRealArray) allocate(prm%h_sl_sl(0,0)) end if slipActive !-------------------------------------------------------------------------------------------------- ! twin related parameters - N_tw = pl%get_as1dInt('N_tw', defaultVal=emptyIntArray) - prm%sum_N_tw = sum(abs(N_tw)) twinActive: if (prm%sum_N_tw > 0) then - prm%c_1 = pl%get_asReal('c_1',defaultVal=0.0_pREAL) - prm%c_2 = pl%get_asReal('c_2',defaultVal=1.0_pREAL) - prm%c_3 = pl%get_asReal('c_3',defaultVal=0.0_pREAL) - prm%c_4 = pl%get_asReal('c_4',defaultVal=0.0_pREAL) - prm%dot_gamma_0_tw = pl%get_asReal('dot_gamma_0_tw') - prm%n_tw = pl%get_asReal('n_tw') - prm%f_sat_sl_tw = pl%get_asReal('f_sat_sl-tw') - prm%h_0_tw_tw = pl%get_asReal('h_0_tw-tw') - - xi_0_tw = math_expand(pl%get_as1dReal('xi_0_tw',requiredSize=size(N_tw)),N_tw) + N_fam = size(N_tw) + ones = [(1.0_pREAL,i=1,N_fam)] + prm%dot_gamma_0_tw = math_expand(pl%get_as1dReal('dot_gamma_0_tw', requiredSize=N_fam,defaultVal=ones), N_tw) + prm%n_tw = math_expand(pl%get_as1dReal('n_tw', requiredSize=N_fam,defaultVal= ones), N_tw) + prm%c_3 = math_expand(pl%get_as1dReal('c_3', requiredSize=N_fam,defaultVal=0.0_pREAL*ones), N_tw) + prm%c_4 = math_expand(pl%get_as1dReal('c_4', requiredSize=N_fam,defaultVal=0.0_pREAL*ones), N_tw) + prm%h_0_tw_tw = math_expand(pl%get_as1dReal('h_0_tw-tw', requiredSize=N_fam,defaultVal=0.0_pReal*ones), N_tw) + xi_0_tw = math_expand(pl%get_as1dReal('xi_0_tw', requiredSize=N_fam), N_tw) 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)) @@ -203,27 +211,33 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) 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' - if (prm%n_tw <= 0.0_pREAL) extmsg = trim(extmsg)//' n_tw' + if (any(prm%dot_gamma_0_tw <= 0.0_pREAL)) extmsg = trim(extmsg)//' dot_gamma_0_tw' + if (any(prm%n_tw <= 0.0_pREAL)) extmsg = trim(extmsg)//' n_tw' + if (any(xi_0_tw <= 0.0_pREAL)) extmsg = trim(extmsg)//' xi_0_tw' else twinActive xi_0_tw = emptyRealArray - allocate(prm%gamma_char,source=emptyRealArray) + allocate(prm%dot_gamma_0_tw, & !< reference shear strain rate for twin + prm%n_tw, & !< stress exponent for twin + prm%c_3, & + prm%c_4, & + prm%gamma_char, & !< characteristic shear for twins + prm%h_0_tw_sl, & !< reference hardening twin - slip + prm%h_0_tw_tw, & !< reference hardening twin - twin + source=emptyRealArray) allocate(prm%h_tw_tw(0,0)) end if twinActive !-------------------------------------------------------------------------------------------------- ! 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 = crystal_interaction_SlipByTwin(N_sl,N_tw,pl%get_as1dReal('h_sl-tw'), & - phase_lattice(ph)) - prm%h_tw_sl = crystal_interaction_TwinBySlip(N_tw,N_sl,pl%get_as1dReal('h_tw-sl'), & - phase_lattice(ph)) + prm%h_0_tw_sl = math_expand(pl%get_as1dReal('h_0_tw-sl',requiredSize=N_fam,defaultVal=0.0_pReal*ones), N_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 = 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 allocate(prm%h_tw_sl(prm%sum_N_tw,prm%sum_N_sl)) ! at least one dimension is 0 - prm%h_0_tw_sl = 0.0_pREAL + prm%h_0_tw_sl = [(0.0_pREAL,i=1,size(N_tw))] end if slipAndTwinActive !-------------------------------------------------------------------------------------------------- @@ -242,7 +256,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) endIndex = prm%sum_N_sl idx_dot%xi_sl = [startIndex,endIndex] stt%xi_sl => plasticState(ph)%state(startIndex:endIndex,:) - stt%xi_sl = spread(xi_0_sl, 2, Nmembers) + stt%xi_sl = spread(xi_0_sl, 2, Nmembers) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asReal('atol_xi',defaultVal=1.0_pREAL) if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pREAL)) extmsg = trim(extmsg)//' atol_xi' @@ -250,7 +264,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) endIndex = endIndex + prm%sum_N_tw idx_dot%xi_tw = [startIndex,endIndex] stt%xi_tw => plasticState(ph)%state(startIndex:endIndex,:) - stt%xi_tw = spread(xi_0_tw, 2, Nmembers) + stt%xi_tw = spread(xi_0_tw, 2, Nmembers) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asReal('atol_xi',defaultVal=1.0_pREAL) startIndex = endIndex + 1 @@ -344,10 +358,10 @@ module function phenopowerlaw_dotState(Mp,ph,en) result(dotState) dotState real(pREAL) :: & - xi_sl_sat_offset,& sumF real(pREAL), dimension(param(ph)%sum_N_sl) :: & dot_gamma_sl_pos,dot_gamma_sl_neg, & + xi_sl_sat_offset, & left_SlipSlip associate(prm => param(ph), stt => state(ph), & @@ -362,10 +376,11 @@ module function phenopowerlaw_dotState(Mp,ph,en) result(dotState) sumF = sum(stt%gamma_tw(:,en)/prm%gamma_char) xi_sl_sat_offset = prm%f_sat_sl_tw*sqrt(sumF) + left_SlipSlip = sign(abs(1.0_pREAL-stt%xi_sl(:,en) / (prm%xi_inf_sl+xi_sl_sat_offset))**prm%a_sl, & 1.0_pREAL-stt%xi_sl(:,en) / (prm%xi_inf_sl+xi_sl_sat_offset)) - dot_xi_sl = prm%h_0_sl_sl * (1.0_pREAL + prm%c_1 * sumF**prm%c_2) * (1.0_pREAL + prm%h_int) & + dot_xi_sl = prm%h_0_sl_sl * (1.0_pREAL + prm%c_1 * sumF**prm%c_2) & * left_SlipSlip * matmul(prm%h_sl_sl,dot_gamma_sl) & + matmul(prm%h_sl_tw,dot_gamma_tw) From cc77d5c69b1661d3a20d8ea6c4f642d1c5c8df7c Mon Sep 17 00:00:00 2001 From: Daniel Otto de Mentock Date: Fri, 4 Aug 2023 14:42:51 +0200 Subject: [PATCH 099/198] interfaces are not included in petsc version<=3.16.x yet --- src/mesh/discretization_mesh.f90 | 2 +- src/mesh/mesh_mech_FEM.f90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index 5cd12549e..3f5811a5c 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -56,7 +56,7 @@ module discretization_mesh real(pREAL), dimension(:,:,:), allocatable :: & mesh_ipCoordinates !< IP x,y,z coordinates (after deformation!) -#ifdef PETSC_USE_64BIT_INDICES +#if defined(PETSC_USE_64BIT_INDICES) || PETSC_VERSION_MINOR < 17 external :: & DMDestroy #endif diff --git a/src/mesh/mesh_mech_FEM.f90 b/src/mesh/mesh_mech_FEM.f90 index 43a1b0579..d08906439 100644 --- a/src/mesh/mesh_mech_FEM.f90 +++ b/src/mesh/mesh_mech_FEM.f90 @@ -72,7 +72,7 @@ module mesh_mechanical_FEM real(pREAL), parameter :: eps = 1.0e-18_pREAL external :: & ! ToDo: write interfaces -#ifdef PETSC_USE_64BIT_INDICES +#if defined(PETSC_USE_64BIT_INDICES) || PETSC_VERSION_MINOR < 17 ISDestroy, & #endif PetscSectionGetNumFields, & From 57b2816d3199c606473f4e3138e72ff2382e7f13 Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 5 Aug 2023 00:15:11 +0200 Subject: [PATCH 100/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-727-g7d1adebde --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index deab02c80..942733d9c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-724-ga2c9cfbbe +3.0.0-alpha7-727-g7d1adebde From 81d0002a49a2b03f0b184130d3909b4bcb60a8a7 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 5 Aug 2023 11:50:03 -0400 Subject: [PATCH 101/198] corrected remaining instances of phenopowerlaw configuration --- PRIVATE | 2 +- examples/Marc/material.yaml | 8 ++++---- examples/mesh/material.yaml | 8 ++++---- .../resources/Result/12grains6x7x8.material.yaml | 16 ++++++++-------- .../resources/Result/4grains2x4x3.material.yaml | 16 ++++++++-------- .../6grains6x7x8_single_phase.material.yaml | 8 ++++---- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/PRIVATE b/PRIVATE index 4e1957339..671e09508 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 4e195733964bfa36de70abb768a65a7216180d0f +Subproject commit 671e09508137c7041f272009db654e46b9c0dcdc diff --git a/examples/Marc/material.yaml b/examples/Marc/material.yaml index c0a7be647..be915189a 100644 --- a/examples/Marc/material.yaml +++ b/examples/Marc/material.yaml @@ -13,12 +13,12 @@ phase: plastic: type: phenopowerlaw N_sl: [12] - a_sl: 2.25 + a_sl: [2.25] atol_xi: 1.0 - dot_gamma_0_sl: 0.001 - h_0_sl-sl: 75.e+6 + dot_gamma_0_sl: [0.001] + h_0_sl-sl: [75.e+6] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] - n_sl: 20 + n_sl: [20] output: [xi_sl] xi_0_sl: [31.e+6] xi_inf_sl: [63.e+6] diff --git a/examples/mesh/material.yaml b/examples/mesh/material.yaml index 94bbaa98f..cfa4b4464 100644 --- a/examples/mesh/material.yaml +++ b/examples/mesh/material.yaml @@ -12,12 +12,12 @@ phase: plastic: type: phenopowerlaw N_sl: [12] - a_sl: 2.25 + a_sl: [2.25] atol_xi: 1.0 - dot_gamma_0_sl: 0.001 - h_0_sl-sl: 75.e+6 + dot_gamma_0_sl: [0.001] + h_0_sl-sl: [75.e+6] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] - n_sl: 20 + n_sl: [20] output: [xi_sl] xi_0_sl: [31.e+6] xi_inf_sl: [63.e+6] diff --git a/python/tests/resources/Result/12grains6x7x8.material.yaml b/python/tests/resources/Result/12grains6x7x8.material.yaml index a74e266c3..06045a746 100644 --- a/python/tests/resources/Result/12grains6x7x8.material.yaml +++ b/python/tests/resources/Result/12grains6x7x8.material.yaml @@ -12,12 +12,12 @@ phase: elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] - a_sl: 2.25 + a_sl: [2.25] atol_xi: 1.0 - dot_gamma_0_sl: 0.001 - h_0_sl-sl: 75e6 + dot_gamma_0_sl: [0.001] + h_0_sl-sl: [75e6] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] - n_sl: 20 + n_sl: [20] output: [xi_sl] type: phenopowerlaw xi_0_sl: [31e6] @@ -29,12 +29,12 @@ phase: elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] - a_sl: 2.25 + a_sl: [2.25] atol_xi: 1.0 - dot_gamma_0_sl: 0.001 - h_0_sl-sl: 75e6 + dot_gamma_0_sl: [0.001] + h_0_sl-sl: [75e6] h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4] - n_sl: 20 + n_sl: [20] output: [xi_sl] type: phenopowerlaw xi_0_sl: [31e6] diff --git a/python/tests/resources/Result/4grains2x4x3.material.yaml b/python/tests/resources/Result/4grains2x4x3.material.yaml index 96be5f483..642b7843b 100644 --- a/python/tests/resources/Result/4grains2x4x3.material.yaml +++ b/python/tests/resources/Result/4grains2x4x3.material.yaml @@ -644,12 +644,12 @@ phase: elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] - a_sl: 2.25 + a_sl: [2.25] atol_xi: 1.0 - dot_gamma_0_sl: 0.001 - h_0_sl-sl: 75e6 + dot_gamma_0_sl: [0.001] + h_0_sl-sl: [75e6] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] - n_sl: 20 + n_sl: [20] output: [xi_sl] type: phenopowerlaw xi_0_sl: [31e6] @@ -661,12 +661,12 @@ phase: elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] - a_sl: 2.25 + a_sl: [2.25] atol_xi: 1.0 - dot_gamma_0_sl: 0.001 - h_0_sl-sl: 75e6 + dot_gamma_0_sl: [0.001] + h_0_sl-sl: [75e6] h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4] - n_sl: 20 + n_sl: [20] output: [xi_sl] type: phenopowerlaw xi_0_sl: [31e6] diff --git a/python/tests/resources/Result/6grains6x7x8_single_phase.material.yaml b/python/tests/resources/Result/6grains6x7x8_single_phase.material.yaml index 0f7bf5450..f820e1011 100644 --- a/python/tests/resources/Result/6grains6x7x8_single_phase.material.yaml +++ b/python/tests/resources/Result/6grains6x7x8_single_phase.material.yaml @@ -12,12 +12,12 @@ phase: elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] - a_sl: 2.25 + a_sl: [2.25] atol_xi: 1.0 - dot_gamma_0_sl: 0.001 - h_0_sl-sl: 75e6 + dot_gamma_0_sl: [0.001] + h_0_sl-sl: [75e6] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] - n_sl: 20 + n_sl: [20] output: [xi_sl] type: phenopowerlaw xi_0_sl: [31e6] From 9d3de05816cb0fda3889e55849fae801942d9cf5 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 5 Aug 2023 14:56:02 -0400 Subject: [PATCH 102/198] corrected test resource; more informative error --- PRIVATE | 2 +- src/YAML_types.f90 | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/PRIVATE b/PRIVATE index 671e09508..16585289f 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 671e09508137c7041f272009db654e46b9c0dcdc +Subproject commit 16585289fdbe5d835da61a8e7736e372024a06d8 diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index 6a56d1dbc..5d7411dd3 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -1166,7 +1166,10 @@ function tDict_get_as1dReal(self,k,defaultVal,requiredSize) result(nodeAs1dReal) end if if (present(requiredSize)) then - if (requiredSize /= size(nodeAs1dReal)) call IO_error(146,ext_msg=k) + if (requiredSize /= size(nodeAs1dReal)) & + call IO_error(146,ext_msg=k, & + label1='actual',ID1=size(nodeAs1dReal), & + label2='required',ID2=requiredSize) end if end function tDict_get_as1dReal @@ -1251,7 +1254,10 @@ function tDict_get_as1dInt(self,k,defaultVal,requiredSize) result(nodeAs1dInt) end if if (present(requiredSize)) then - if (requiredSize /= size(nodeAs1dInt)) call IO_error(146,ext_msg=k) + if (requiredSize /= size(nodeAs1dInt)) & + call IO_error(146,ext_msg=k, & + label1='actual',ID1=size(nodeAs1dInt), & + label2='required',ID2=requiredSize) end if end function tDict_get_as1dInt From 2e27236d352f4e3c12df00fcc52a410d98e3c32b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 5 Aug 2023 22:30:17 -0400 Subject: [PATCH 103/198] use updated PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 16585289f..beee59326 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 16585289fdbe5d835da61a8e7736e372024a06d8 +Subproject commit beee5932664a055dbb8d9e8d67c437d2dd2f699e From aa2a20ba1d334a6fb92e43e7bb718d0635632ff6 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 7 Aug 2023 14:08:07 +0000 Subject: [PATCH 104/198] DAMASK_test output polish --- src/test/DAMASK_test.f90 | 60 ++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/src/test/DAMASK_test.f90 b/src/test/DAMASK_test.f90 index 0904b71a0..8c1d92c1a 100644 --- a/src/test/DAMASK_test.f90 +++ b/src/test/DAMASK_test.f90 @@ -2,6 +2,7 @@ program DAMASK_test use parallelization use HDF5_utilities + use IO use test_prec use test_crystal @@ -13,37 +14,42 @@ program DAMASK_test external :: quit + character(len=*), parameter :: & + tab = '19', & + ok = achar(27)//'[32mok'//achar(27)//'[0m' + call parallelization_init() - - print('(/,a)'), 'begin test prec' - call test_prec_run() - print('(a)'), 'begin test prec' - - print('(/,a)'), 'begin test tables' - call test_tables_run() - print('(a)'), 'end test tables' - - print('(/,a)'), 'begin test crystal' - call test_crystal_run() - print('(a)'), 'end test crystal' - - print('(/,a)'), 'begin test rotations' - call test_rotations_run() - print('(a)'), 'end test rotations' - - print('(/,a)'), 'begin test IO' - call test_IO_run() - print('(a)'), 'end test IO' - - print('(/,a)'), 'begin test misc' - call test_misc_run() - print('(a)'), 'end test misc' - call HDF5_utilities_init() - print('(/,a)'), 'begin test HDF5_utilities' + write(IO_STDOUT,fmt='(/,1x,a,/)') achar(27)//'[1m'//'testing'//achar(27)//'[0m' + + write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'prec','...' + call test_prec_run() + write(IO_STDOUT,fmt='(1x,a)') ok + + write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'tables','...' + call test_tables_run() + write(IO_STDOUT,fmt='(1x,a)') ok + + write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'crystal','...' + call test_crystal_run() + write(IO_STDOUT,fmt='(1x,a)') ok + + write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'rotations','...' + call test_rotations_run() + write(IO_STDOUT,fmt='(1x,a)') ok + + write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'IO','...' + call test_IO_run() + write(IO_STDOUT,fmt='(1x,a)') ok + + write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'misc','...' + call test_misc_run() + write(IO_STDOUT,fmt='(1x,a)') ok + + write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'HDF5_utilities','...' call test_HDF5_utilities_run() - print('(a)'), 'begin test HDF5_utilities' + write(IO_STDOUT,fmt='(1x,a)') ok call quit(0) From 05e7ca3ebe86f4b6683c8813abe15a43612f3a79 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 7 Aug 2023 18:14:58 +0200 Subject: [PATCH 105/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-730-g0e7b05799 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 942733d9c..2f545c7ca 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-727-g7d1adebde +3.0.0-alpha7-730-g0e7b05799 From 98fe38a505a2a9dc01976878fc19633e65f0ce13 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 8 Aug 2023 07:19:03 +0200 Subject: [PATCH 106/198] avoid issues with long lines line length <= 132 is already enforced in pre-receive hook --- cmake/Compiler-GNU.cmake | 4 ++-- cmake/Compiler-Intel.cmake | 2 +- cmake/Compiler-IntelLLVM.cmake | 2 +- src/CMakeLists.txt | 15 --------------- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/cmake/Compiler-GNU.cmake b/cmake/Compiler-GNU.cmake index 397d1277b..d024bdc0a 100644 --- a/cmake/Compiler-GNU.cmake +++ b/cmake/Compiler-GNU.cmake @@ -29,8 +29,8 @@ set (COMPILE_FLAGS "${COMPILE_FLAGS} -cpp") set (COMPILE_FLAGS "${COMPILE_FLAGS} -fPIE") # position independent code -set (COMPILE_FLAGS "${COMPILE_FLAGS} -ffree-line-length-132") -# restrict line length to the standard 132 characters (lattice.f90 require more characters) +set (COMPILE_FLAGS "${COMPILE_FLAGS} -ffree-line-length-none") +# PETSc macros are long, line length is enforced in pre-receive hook set (COMPILE_FLAGS "${COMPILE_FLAGS} -fimplicit-none") # assume "implicit none" even if not present in source diff --git a/cmake/Compiler-Intel.cmake b/cmake/Compiler-Intel.cmake index d68eac50b..19e75a9fa 100644 --- a/cmake/Compiler-Intel.cmake +++ b/cmake/Compiler-Intel.cmake @@ -35,7 +35,7 @@ set (COMPILE_FLAGS "${COMPILE_FLAGS} -no-ftz") set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable") # disables warnings ... set (COMPILE_FLAGS "${COMPILE_FLAGS} 5268") -# ... the text exceeds right hand column allowed on the line (we have only comments there) +# ... the text exceeds right hand column allowed on the line (enforced by pre-receive hook) set (COMPILE_FLAGS "${COMPILE_FLAGS},7624") # ... about deprecated forall (has nice syntax and most likely a performance advantage) diff --git a/cmake/Compiler-IntelLLVM.cmake b/cmake/Compiler-IntelLLVM.cmake index f2fb8bce9..86c9d380c 100644 --- a/cmake/Compiler-IntelLLVM.cmake +++ b/cmake/Compiler-IntelLLVM.cmake @@ -37,7 +37,7 @@ set (COMPILE_FLAGS "${COMPILE_FLAGS} -no-ftz") set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable") # disables warnings ... set (COMPILE_FLAGS "${COMPILE_FLAGS} 5268") -# ... the text exceeds right hand column allowed on the line (we have only comments there) +# ... the text exceeds right hand column allowed on the line (enforced by pre-receive hook) set (COMPILE_FLAGS "${COMPILE_FLAGS},7624") # ... about deprecated forall (has nice syntax and most likely a performance advantage) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fc9217f31..4d0d8cef0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,10 +1,3 @@ -# special flags for some files -if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - # long lines for interaction matrix - 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() - file(GLOB damask-sources CONFIGURE_DEPENDS *.f90 *.c) if(PROJECT_NAME STREQUAL "damask-grid") @@ -18,14 +11,6 @@ elseif(PROJECT_NAME STREQUAL "damask-test") file(GLOB solver-sources CONFIGURE_DEPENDS test/*.f90) endif() -foreach(solver-source ${solver-sources}) - file(READ ${solver-source} content) - string(FIND "${content}" "CHKERR" found) - if((NOT ${found} EQUAL -1) AND (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")) - set_source_files_properties(${solver-source} PROPERTIES COMPILE_FLAGS "-ffree-line-length-none") - endif() -endforeach() - if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY") add_executable(${executable-name} ${damask-sources} ${solver-sources}) From 26ad83a29b616c43d9f006089ea363e33d54e838 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 8 Aug 2023 09:22:07 +0200 Subject: [PATCH 107/198] unused --- src/grid/DAMASK_grid.f90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 3cf378d7c..cd6a60abe 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -111,8 +111,6 @@ program DAMASK_grid num_solver, & num_grid, & solver - type(tList), pointer :: & - load_steps character(len=:), allocatable :: & fileContent, fname From 651d0d989b735c4ebd0aed1c47d7b6e7296dc8de Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 10 Aug 2023 18:24:08 +0200 Subject: [PATCH 108/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-736-g91bb315d3 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 2f545c7ca..7a95c7c04 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-730-g0e7b05799 +3.0.0-alpha7-736-g91bb315d3 From 82a55ee28d9fc4820177ff33d1821196f105ee7f Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 10 Aug 2023 12:52:27 -0400 Subject: [PATCH 109/198] report optional numerics config file --- src/CLI.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CLI.f90 b/src/CLI.f90 index ed7fbcd5e..905b1c9f5 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -210,6 +210,8 @@ subroutine CLI_init() print'(1x,a)', 'Geometry: '//IO_glueDiffering(CLI_geomFile,geomArg) print'(1x,a)', 'Load case: '//IO_glueDiffering(CLI_loadFile,loadArg) print'(1x,a)', 'Material config: '//IO_glueDiffering(CLI_materialFile,materialArg) + if (allocated(numericsArg)) & + print'(1x,a)', 'Numerics config: '//IO_glueDiffering(CLI_numericsFile,numericsArg) print'(1x,a)', 'Solver job name: '//getSolverJobname() if (CLI_restartInc > 0) & print'(1x,a,i6.6)', 'Restart from increment: ', CLI_restartInc From fe2cf94d704c4ee72602eee3f0f31b0eb1c4b187 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 10 Aug 2023 23:06:31 +0200 Subject: [PATCH 110/198] use central functionality --- src/CLI.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index ed7fbcd5e..a3503bd43 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -178,7 +178,7 @@ subroutine CLI_init() case ('-r', '--rs', '--restart') if (.not. hasArg) call IO_error(610,ext_msg='--jobname') arg = getArg(i+1) - read(arg,*,iostat=stat) CLI_restartInc + CLI_restartInc = IO_strAsInt(arg) if (CLI_restartInc < 0 .or. stat /= 0) call IO_error(611,ext_msg=arg) end select end do From 7d08286192d2fb4297aa312be53bf4773f172125 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 10 Aug 2023 23:08:58 +0200 Subject: [PATCH 111/198] clearer error message --- src/HDF5_utilities.f90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/HDF5_utilities.f90 b/src/HDF5_utilities.f90 index b87dbad3d..77b87c7ed 100644 --- a/src/HDF5_utilities.f90 +++ b/src/HDF5_utilities.f90 @@ -6,6 +6,7 @@ !> @author Philip Eisenlohr, Michigan State University !-------------------------------------------------------------------------------------------------- module HDF5_utilities + use IO use HDF5 #ifdef PETSC #include @@ -190,6 +191,7 @@ integer(HID_T) function HDF5_openFile(fileName,mode,parallel) character :: m integer(HID_T) :: plist_id integer :: hdferr + logical :: exist m = misc_optional(mode,'r') @@ -214,6 +216,8 @@ integer(HID_T) function HDF5_openFile(fileName,mode,parallel) call H5Fopen_f(fileName,H5F_ACC_RDWR_F,HDF5_openFile,hdferr,access_prp = plist_id) call HDF5_chkerr(hdferr) elseif (m == 'r') then + inquire(file=fileName,exist=exist) + if (.not. exist) call IO_error(100,trim(fileName)) call H5Fopen_f(fileName,H5F_ACC_RDONLY_F,HDF5_openFile,hdferr,access_prp = plist_id) call HDF5_chkerr(hdferr) else From 5cff94c3705d6ec512435195eb1c83d2cab76e76 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 11 Aug 2023 00:54:06 +0200 Subject: [PATCH 112/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-739-g81066f22c --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7a95c7c04..112833618 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-736-g91bb315d3 +3.0.0-alpha7-739-g81066f22c From a1eb7829ee13478873604efd69fc27dc48cb4519 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 11 Aug 2023 08:01:55 +0000 Subject: [PATCH 113/198] Math improvements --- src/math.f90 | 28 +++++++++---------- src/test/DAMASK_test.f90 | 59 ++++++++++++++++++++++------------------ src/test/test_math.f90 | 17 ++++++++++++ 3 files changed, 63 insertions(+), 41 deletions(-) create mode 100644 src/test/test_math.f90 diff --git a/src/math.f90 b/src/math.f90 index 4a1ffb707..4122f5170 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -27,8 +27,10 @@ module math #if __INTEL_COMPILER >= 1900 ! do not make use of associated entities available to other modules private :: & + misc, & IO, & - config + config, & + parallelization #endif real(pREAL), parameter :: & @@ -38,11 +40,11 @@ module math INRAD = TAU/360.0_pREAL !< conversion from degree to radian real(pREAL), dimension(3,3), parameter :: & - math_I3 = reshape([& - 1.0_pREAL,0.0_pREAL,0.0_pREAL, & - 0.0_pREAL,1.0_pREAL,0.0_pREAL, & - 0.0_pREAL,0.0_pREAL,1.0_pREAL & - ],shape(math_I3)) !< 3x3 Identity + math_I3 = real(reshape([& + 1, 0, 0, & + 0, 1, 0, & + 0, 0, 1 & + ],shape(math_I3)),pREAL) !< 3x3 Identity real(pREAL), dimension(*), parameter, private :: & NRMMANDEL = [1.0_pREAL, 1.0_pREAL,1.0_pREAL, sqrt(2.0_pREAL), sqrt(2.0_pREAL), sqrt(2.0_pREAL)] !< forward weighting for Mandel notation @@ -83,9 +85,6 @@ module math 3,3 & ],shape(MAPPLAIN)) !< arrangement in Plain notation -!--------------------------------------------------------------------------------------------------- - private :: & - selfTest contains @@ -109,20 +108,21 @@ subroutine math_init() allocate(seed(randSize)) if (num_generic%contains('random_seed')) then - seed = num_generic%get_as1dInt('random_seed',requiredSize=randSize) + seed = num_generic%get_as1dInt('random_seed',requiredSize=randSize) & + + worldrank*42_MPI_INTEGER_KIND else call random_seed() call random_seed(get = seed) end if - call random_seed(put = seed + worldrank*42_MPI_INTEGER_KIND) + call random_seed(put = seed) call random_number(randTest) print'(/,a,i2)', ' size of random seed: ', randSize print*, 'value of random seed: ', seed print'( a,4(/,26x,f17.14))', ' start of random sequence: ', randTest - call selfTest() + call math_selfTest() end subroutine math_init @@ -1275,7 +1275,7 @@ end function math_clip !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some math functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest() +subroutine math_selfTest() integer, dimension(2,4) :: & sort_in_ = reshape([+1,+5, +5,+6, -1,-1, +3,-2],[2,4]) @@ -1447,6 +1447,6 @@ subroutine selfTest() error stop 'math_normal(sigma)' end block normal_distribution -end subroutine selfTest +end subroutine math_selfTest end module math diff --git a/src/test/DAMASK_test.f90 b/src/test/DAMASK_test.f90 index 8c1d92c1a..ae7a714b8 100644 --- a/src/test/DAMASK_test.f90 +++ b/src/test/DAMASK_test.f90 @@ -5,51 +5,56 @@ program DAMASK_test use IO use test_prec - use test_crystal - use test_IO - use test_rotations use test_misc + use test_math use test_tables + use test_crystal + use test_rotations + use test_IO use test_HDF5_utilities external :: quit character(len=*), parameter :: & - tab = '19', & - ok = achar(27)//'[32mok'//achar(27)//'[0m' + ok = achar(27)//'[32mok'//achar(27)//'[0m', & + fmt = '(3x,a,T19,a,1x)' call parallelization_init() call HDF5_utilities_init() write(IO_STDOUT,fmt='(/,1x,a,/)') achar(27)//'[1m'//'testing'//achar(27)//'[0m' - write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'prec','...' + write(IO_STDOUT,fmt=fmt, advance='no') 'prec','...' call test_prec_run() - write(IO_STDOUT,fmt='(1x,a)') ok + write(IO_STDOUT,fmt='(a)') ok - write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'tables','...' - call test_tables_run() - write(IO_STDOUT,fmt='(1x,a)') ok - - write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'crystal','...' - call test_crystal_run() - write(IO_STDOUT,fmt='(1x,a)') ok - - write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'rotations','...' - call test_rotations_run() - write(IO_STDOUT,fmt='(1x,a)') ok - - write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'IO','...' - call test_IO_run() - write(IO_STDOUT,fmt='(1x,a)') ok - - write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'misc','...' + write(IO_STDOUT,fmt=fmt, advance='no') 'misc','...' call test_misc_run() - write(IO_STDOUT,fmt='(1x,a)') ok + write(IO_STDOUT,fmt='(a)') ok - write(IO_STDOUT,fmt='(3x,a,T'//tab//',a)', advance='no') 'HDF5_utilities','...' + write(IO_STDOUT,fmt=fmt, advance='no') 'math','...' + call test_math_run() + write(IO_STDOUT,fmt='(a)') ok + + write(IO_STDOUT,fmt=fmt, advance='no') 'tables','...' + call test_tables_run() + write(IO_STDOUT,fmt='(a)') ok + + write(IO_STDOUT,fmt=fmt, advance='no') 'crystal','...' + call test_crystal_run() + write(IO_STDOUT,fmt='(a)') ok + + write(IO_STDOUT,fmt=fmt, advance='no') 'rotations','...' + call test_rotations_run() + write(IO_STDOUT,fmt='(a)') ok + + write(IO_STDOUT,fmt=fmt, advance='no') 'IO','...' + call test_IO_run() + write(IO_STDOUT,fmt='(a)') ok + + write(IO_STDOUT,fmt=fmt, advance='no') 'HDF5_utilities','...' call test_HDF5_utilities_run() - write(IO_STDOUT,fmt='(1x,a)') ok + write(IO_STDOUT,fmt='(a)') ok call quit(0) diff --git a/src/test/test_math.f90 b/src/test/test_math.f90 new file mode 100644 index 000000000..e5c013fba --- /dev/null +++ b/src/test/test_math.f90 @@ -0,0 +1,17 @@ +module test_math + use math + + implicit none(type,external) + + private + public :: test_math_run + + contains + +subroutine test_math_run() + + call math_selfTest() + +end subroutine test_math_run + +end module test_math From 0bd826bf4db970b0473e12284dde32c0a7975029 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 11 Aug 2023 12:09:01 +0200 Subject: [PATCH 114/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-742-ge8534d6ff --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 112833618..31ab75d8a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-739-g81066f22c +3.0.0-alpha7-742-ge8534d6ff From e161ef40b3db2b74936ff8870dbbe4000e705c3e Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 11 Aug 2023 10:36:03 -0400 Subject: [PATCH 115/198] per-family parameters for kinehardening --- PRIVATE | 2 +- .../plastic/kinehardening_317L.yaml | 4 +-- ...phase_mechanical_plastic_kinehardening.f90 | 35 ++++++++++--------- ...phase_mechanical_plastic_phenopowerlaw.f90 | 2 +- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/PRIVATE b/PRIVATE index beee59326..ac2758719 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit beee5932664a055dbb8d9e8d67c437d2dd2f699e +Subproject commit ac27587199340ac1ec7a5c4e1ccd92dbf1299742 diff --git a/examples/config/phase/mechanical/plastic/kinehardening_317L.yaml b/examples/config/phase/mechanical/plastic/kinehardening_317L.yaml index 423b504b4..a3a7dfe30 100644 --- a/examples/config/phase/mechanical/plastic/kinehardening_317L.yaml +++ b/examples/config/phase/mechanical/plastic/kinehardening_317L.yaml @@ -18,6 +18,6 @@ chi_inf: [0.027e+9] # τ_1,bs h_0_chi: [55e+9] # θ_0,bs h_inf_chi: [1.3e+9] # θ_1,bs -n: 20 # not mentioned in the reference -dot_gamma_0: 1e-4 # not mentioned in the reference +n: [20] # not mentioned in the reference +dot_gamma_0: [1e-4] # not mentioned in the reference h_sl-sl: [1, 1, 1, 1, 1, 1, 1] diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 153dc03d5..2ce34cd95 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -8,10 +8,9 @@ submodule(phase:plastic) kinehardening type :: tParameters - real(pREAL) :: & - n = 1.0_pREAL, & !< stress exponent for slip - dot_gamma_0 = 1.0_pREAL !< reference shear strain rate for slip real(pREAL), allocatable, dimension(:) :: & + dot_gamma_0, & !< reference shear strain rate for slip + n, & !< stress exponent for slip h_0_xi, & !< initial hardening rate of forest stress per slip family !! θ_0,for h_0_chi, & !< initial hardening rate of back stress per slip family @@ -77,6 +76,7 @@ module function plastic_kinehardening_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & ph, o, & + N_fam, & Nmembers, & sizeState, sizeDeltaState, sizeDotState, & startIndex, endIndex @@ -139,6 +139,7 @@ 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 + N_fam = size(N_sl) prm%systems_sl = crystal_labels_slip(N_sl,phase_lattice(ph)) prm%P = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) @@ -152,32 +153,32 @@ module function plastic_kinehardening_init() result(myPlasticity) prm%P_nS_neg = prm%P end if - prm%dot_gamma_0 = pl%get_asReal('dot_gamma_0') - prm%n = pl%get_asReal('n') - 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) - prm%xi_inf = math_expand(pl%get_as1dReal('xi_inf', requiredSize=size(N_sl)),N_sl) - prm%chi_inf = math_expand(pl%get_as1dReal('chi_inf', requiredSize=size(N_sl)),N_sl) - prm%h_0_xi = math_expand(pl%get_as1dReal('h_0_xi', requiredSize=size(N_sl)),N_sl) - prm%h_0_chi = math_expand(pl%get_as1dReal('h_0_chi', requiredSize=size(N_sl)),N_sl) - prm%h_inf_xi = math_expand(pl%get_as1dReal('h_inf_xi', requiredSize=size(N_sl)),N_sl) - prm%h_inf_chi = math_expand(pl%get_as1dReal('h_inf_chi', requiredSize=size(N_sl)),N_sl) - + xi_0 = math_expand(pl%get_as1dReal('xi_0', requiredSize=N_fam),N_sl) + prm%dot_gamma_0 = math_expand(pl%get_as1dReal('dot_gamma_0', requiredSize=N_fam),N_sl) + prm%n = math_expand(pl%get_as1dReal('n', requiredSize=N_fam),N_sl) + prm%xi_inf = math_expand(pl%get_as1dReal('xi_inf', requiredSize=N_fam),N_sl) + prm%chi_inf = math_expand(pl%get_as1dReal('chi_inf', requiredSize=N_fam),N_sl) + prm%h_0_xi = math_expand(pl%get_as1dReal('h_0_xi', requiredSize=N_fam),N_sl) + prm%h_0_chi = math_expand(pl%get_as1dReal('h_0_chi', requiredSize=N_fam),N_sl) + prm%h_inf_xi = math_expand(pl%get_as1dReal('h_inf_xi', requiredSize=N_fam),N_sl) + prm%h_inf_chi = math_expand(pl%get_as1dReal('h_inf_chi', requiredSize=N_fam),N_sl) !-------------------------------------------------------------------------------------------------- ! sanity checks - if ( prm%dot_gamma_0 <= 0.0_pREAL) extmsg = trim(extmsg)//' dot_gamma_0' - if ( prm%n <= 0.0_pREAL) extmsg = trim(extmsg)//' n' + if (any(prm%dot_gamma_0 <= 0.0_pREAL)) extmsg = trim(extmsg)//' dot_gamma_0' + if (any(prm%n <= 0.0_pREAL)) extmsg = trim(extmsg)//' n' if (any(xi_0 <= 0.0_pREAL)) extmsg = trim(extmsg)//' xi_0' if (any(prm%xi_inf <= 0.0_pREAL)) extmsg = trim(extmsg)//' xi_inf' if (any(prm%chi_inf <= 0.0_pREAL)) extmsg = trim(extmsg)//' chi_inf' else slipActive xi_0 = emptyRealArray - allocate(prm%xi_inf, & + allocate(prm%dot_gamma_0, & + prm%n, & + prm%xi_inf, & prm%chi_inf, & prm%h_0_xi, & prm%h_0_chi, & diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 95a16e450..8a8018892 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -173,8 +173,8 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) ! sanity checks if (any(prm%dot_gamma_0_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' dot_gamma_0_sl' - if (any(prm%a_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' a_sl' if (any(prm%n_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' n_sl' + if (any(prm%a_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' a_sl' if (any(xi_0_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' xi_0_sl' if (any(prm%xi_inf_sl <= 0.0_pREAL)) extmsg = trim(extmsg)//' xi_inf_sl' From fc3c4c0be7eaed566a9a49e079958c4460096f00 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 11 Aug 2023 17:48:55 +0200 Subject: [PATCH 116/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-746-gc93309ed0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 31ab75d8a..a04647d4c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-742-ge8534d6ff +3.0.0-alpha7-746-gc93309ed0 From 214376c10200d7be3709397961405aab1e9b2adb Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 14 Aug 2023 13:49:15 +0200 Subject: [PATCH 117/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-749-g92a500797 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a04647d4c..3052186b3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-746-gc93309ed0 +3.0.0-alpha7-749-g92a500797 From 71b5b954508a5be053a98aef27ceca5647900702 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 14 Aug 2023 21:18:44 +0200 Subject: [PATCH 118/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-753-gaa28fe677 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 3052186b3..2b4efa3f2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-749-g92a500797 +3.0.0-alpha7-753-gaa28fe677 From cc8790908c3b86bf34b024517b82ef6f5ec1dfb4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 16 Aug 2023 22:01:20 +0200 Subject: [PATCH 119/198] there is no "crystal lattice", what we define are the 14 Bravais lattices --- python/damask/_crystal.py | 12 ++++++------ python/damask/_orientation.py | 4 ++-- python/damask/_typehints.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/damask/_crystal.py b/python/damask/_crystal.py index 9434515f5..e084f1eae 100644 --- a/python/damask/_crystal.py +++ b/python/damask/_crystal.py @@ -2,11 +2,11 @@ from typing import Optional, Union, Dict, List, Tuple import numpy as np -from ._typehints import FloatSequence, CrystalFamily, CrystalLattice, CrystalKinematics +from ._typehints import FloatSequence, CrystalFamily, BravaisLattice, CrystalKinematics from . import util from . import Rotation -lattice_symmetries: Dict[CrystalLattice, CrystalFamily] = { +lattice_symmetries: Dict[BravaisLattice, CrystalFamily] = { 'aP': 'triclinic', 'mP': 'monoclinic', @@ -27,7 +27,7 @@ lattice_symmetries: Dict[CrystalLattice, CrystalFamily] = { 'cF': 'cubic', } -orientation_relationships: Dict[str, Dict[CrystalLattice,np.ndarray]] = { +orientation_relationships: Dict[str, Dict[BravaisLattice,np.ndarray]] = { 'KS': { 'cF': np.array([ [[-1, 0, 1],[ 1, 1, 1]], @@ -323,7 +323,7 @@ class Crystal(): def __init__(self, *, family: Optional[CrystalFamily] = None, - lattice: Optional[CrystalLattice] = None, + lattice: Optional[BravaisLattice] = None, a: Optional[float] = None, b: Optional[float] = None, c: Optional[float] = None, alpha: Optional[float] = None, beta: Optional[float] = None, gamma: Optional[float] = None, degrees: bool = False): @@ -772,7 +772,7 @@ class Crystal(): Directions and planes of deformation mode families. """ - _kinematics: Dict[CrystalLattice, Dict[CrystalKinematics, List[np.ndarray]]] = { + _kinematics: Dict[BravaisLattice, Dict[CrystalKinematics, List[np.ndarray]]] = { 'cF': { 'slip': [np.array([ [+0,+1,-1, +1,+1,+1], @@ -1015,7 +1015,7 @@ class Crystal(): def relation_operations(self, - model: str) -> Tuple[CrystalLattice, Rotation]: + model: str) -> Tuple[BravaisLattice, Rotation]: """ Crystallographic orientation relationships for phase transformations. diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index 4db24bae5..cf6684458 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -3,7 +3,7 @@ from typing import Optional, Union, TypeVar import numpy as np -from ._typehints import FloatSequence, IntSequence, CrystalFamily, CrystalLattice +from ._typehints import FloatSequence, IntSequence, CrystalFamily, BravaisLattice from . import Rotation from . import Crystal from . import util @@ -73,7 +73,7 @@ class Orientation(Rotation,Crystal): rotation: Union[FloatSequence, Rotation] = np.array([1.,0.,0.,0.]), *, family: Optional[CrystalFamily] = None, - lattice: Optional[CrystalLattice] = None, + lattice: Optional[BravaisLattice] = None, a: Optional[float] = None, b: Optional[float] = None, c: Optional[float] = None, alpha: Optional[float] = None, beta: Optional[float] = None, gamma: Optional[float] = None, degrees: bool = False): diff --git a/python/damask/_typehints.py b/python/damask/_typehints.py index 5891e6305..29ab9f3ad 100644 --- a/python/damask/_typehints.py +++ b/python/damask/_typehints.py @@ -11,7 +11,7 @@ IntSequence = Union[np.ndarray,Sequence[int]] StrSequence = Union[np.ndarray,Sequence[str]] FileHandle = Union[TextIO, str, Path] CrystalFamily = Union[None,Literal['triclinic', 'monoclinic', 'orthorhombic', 'tetragonal', 'hexagonal', 'cubic']] -CrystalLattice = Union[None,Literal['aP', 'mP', 'mS', 'oP', 'oS', 'oI', 'oF', 'tP', 'tI', 'hP', 'cP', 'cI', 'cF']] +BravaisLattice = Union[None,Literal['aP', 'mP', 'mS', 'oP', 'oS', 'oI', 'oF', 'tP', 'tI', 'hP', 'cP', 'cI', 'cF']] CrystalKinematics = Literal['slip', 'twin'] NumpyRngSeed = Union[int, IntSequence, np.random.SeedSequence, np.random.Generator] # BitGenerator does not exists in older numpy versions From e944ece5ecb74d7a452c02bfd909af90334ee4f7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 17 Aug 2023 14:39:47 +0200 Subject: [PATCH 120/198] document source of symmetry operations --- python/damask/_crystal.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python/damask/_crystal.py b/python/damask/_crystal.py index 9434515f5..ee817496d 100644 --- a/python/damask/_crystal.py +++ b/python/damask/_crystal.py @@ -548,7 +548,17 @@ class Crystal(): @property def symmetry_operations(self) -> Rotation: - """Symmetry operations as Rotations.""" + """ + Return symmetry operations. + + References + ---------- + U.F. Kocks et al., + Texture and Anisotropy: + Preferred Orientations in Polycrystals and their Effect on Materials Properties. + Cambridge University Press 1998. Table II + + """ _symmetry_operations: Dict[CrystalFamily, List] = { 'cubic': [ [ 1.0, 0.0, 0.0, 0.0 ], From fb2d49741a73f387410254f290329c66a02208b9 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 17 Aug 2023 21:10:26 +0000 Subject: [PATCH 121/198] self.shape does not equal broadcastable shape --- python/damask/_rotation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 118234bf1..166863e70 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -307,7 +307,8 @@ class Rotation: p_m = self.quaternion[...,1:] q_o = other.quaternion[...,0:1] p_o = other.quaternion[...,1:] - q = (q_m*q_o - np.einsum('...i,...i',p_m,p_o).reshape(self.shape+(1,))) + qmo = q_m*q_o + q = (qmo - np.einsum('...i,...i',p_m,p_o).reshape(qmo.shape)) p = q_m*p_o + q_o*p_m + _P * np.cross(p_m,p_o) return self.copy(Rotation(np.block([q,p]))._standardize()) else: From 0393bdb2140940004778aaacb72ebda4b839a75b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 17 Aug 2023 21:21:16 +0000 Subject: [PATCH 122/198] added broadcasting test for composite rotations --- python/tests/test_Rotation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index 6e135212f..6b9cd2b1a 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -975,6 +975,13 @@ class TestRotation: assert np.allclose(rot_broadcast.quaternion[...,i,:], rot.quaternion) + @pytest.mark.parametrize('shape',[(3,2),(4,6)]) + def test_broadcastcomposition(self,shape): + a = Rotation.from_random(shape[0]) + b = Rotation.from_random(shape[1]) + assert (a[:,np.newaxis]*b[np.newaxis,:]).allclose(a.broadcast_to(shape)*b.broadcast_to(shape)) + + @pytest.mark.parametrize('function,invalid',[(Rotation.from_quaternion, np.array([-1,0,0,0])), (Rotation.from_quaternion, np.array([1,1,1,0])), (Rotation.from_Euler_angles, np.array([1,4,0])), From f80a8e7f49d2d9183d8f52eb6b867ad63c58e52e Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 18 Aug 2023 17:59:32 +0200 Subject: [PATCH 123/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-756-g32c1711b4 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 2b4efa3f2..97791d001 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-753-gaa28fe677 +3.0.0-alpha7-756-g32c1711b4 From 854211a71f0b3a29f8ecef7777ee0231f7b5219c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 18 Aug 2023 19:12:16 +0200 Subject: [PATCH 124/198] bugfix: wrong definition of bct slip systems --- src/crystal.f90 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/crystal.f90 b/src/crystal.f90 index ae460a811..33ca4dc74 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -1902,7 +1902,7 @@ end function buildInteraction !> @brief Build a local coordinate system on slip, twin, trans, cleavage systems !> @details Order: Direction, plane (normal), and common perpendicular !-------------------------------------------------------------------------------------------------- -function buildCoordinateSystem(active,potential,system,lattice,cOverA) +function buildCoordinateSystem(active,potential,system,lattice,cOverA) result(coordinateSystem) integer, dimension(:), intent(in) :: & active, & !< # of active systems per family @@ -1914,7 +1914,7 @@ function buildCoordinateSystem(active,potential,system,lattice,cOverA) real(pREAL), intent(in) :: & cOverA real(pREAL), dimension(3,3,sum(active)) :: & - buildCoordinateSystem + coordinateSystem real(pREAL), dimension(3) :: & direction, normal @@ -1937,10 +1937,14 @@ function buildCoordinateSystem(active,potential,system,lattice,cOverA) select case(lattice) - case ('cF','cI','tI') + case ('cF','cI') direction = system(1:3,p) normal = system(4:6,p) + case ('tI') + direction = [ system(1,p), system(2,p), system(3,p)*cOverA ] + normal = [ system(4,p), system(5,p), system(6,p)/cOverA ] + case ('hP') direction = [ system(1,p)*1.5_pREAL, & (system(1,p)+2.0_pREAL*system(2,p))*sqrt(0.75_pREAL), & @@ -1954,10 +1958,10 @@ function buildCoordinateSystem(active,potential,system,lattice,cOverA) end select - buildCoordinateSystem(1:3,1,a) = direction/norm2(direction) - buildCoordinateSystem(1:3,2,a) = normal /norm2(normal) - buildCoordinateSystem(1:3,3,a) = math_cross(direction/norm2(direction),& - normal /norm2(normal)) + coordinateSystem(1:3,1,a) = direction/norm2(direction) + coordinateSystem(1:3,2,a) = normal /norm2(normal) + coordinateSystem(1:3,3,a) = math_cross(direction/norm2(direction),& + normal /norm2(normal)) end do activeSystems end do activeFamilies From edd71a09082d7f21501dcf7ef6ef7d2aadd464c1 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 28 Aug 2023 18:00:44 +0200 Subject: [PATCH 125/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-762-g0cda7af7e --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 97791d001..c20fae673 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-756-g32c1711b4 +3.0.0-alpha7-762-g0cda7af7e From 695882934366ac6385e6733536ae4de9397fe623 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 28 Aug 2023 22:05:51 +0200 Subject: [PATCH 126/198] might help during debugging --- cmake/Compiler-GNU.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/Compiler-GNU.cmake b/cmake/Compiler-GNU.cmake index d024bdc0a..a62875d05 100644 --- a/cmake/Compiler-GNU.cmake +++ b/cmake/Compiler-GNU.cmake @@ -131,6 +131,9 @@ set (DEBUG_FLAGS "${DEBUG_FLAGS} -fcheck=all") set (DEBUG_FLAGS "${DEBUG_FLAGS} -fstack-protector-all") # Inserts a guard variable onto the stack frame for all functions +set (DEBUG_FLAGS "${DEBUG_FLAGS} -finit-real=snan -finit-integer=-2147483648") +# "strange" values to simplify debugging + set (DEBUG_FLAGS "${DEBUG_FLAGS} -fsanitize=undefined") # detect undefined behavior # Additional options From b0809a8afe264a3534fe5ec7fe2e942396b67d11 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 28 Aug 2023 17:59:37 -0400 Subject: [PATCH 127/198] function is obsolete --- src/phase_mechanical_eigen.f90 | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 5bdb57f57..8e0f7209a 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -95,34 +95,6 @@ function kinematics_active(kinematics_label,kinematics_length) result(active_ki end function kinematics_active - -!-------------------------------------------------------------------------------------------------- -!> @brief Checks if a damage kinematic mechanism is active. -!-------------------------------------------------------------------------------------------------- -function kinematics_active2(kinematics_label) result(active_kinematics) - - character(len=*), intent(in) :: kinematics_label !< name of kinematic mechanism - logical, dimension(:), allocatable :: active_kinematics - - type(tDict), pointer :: & - phases, & - phase, & - kinematics_type - integer :: ph - - - phases => config_material%get_dict('phase') - allocate(active_kinematics(phases%length), source = .false.) - do ph = 1, phases%length - phase => phases%get_dict(ph) - kinematics_type => phase%get_dict('damage',defaultVal=emptyDict) - active_kinematics(ph) = kinematics_type%get_asStr('type',defaultVal='n/a') == kinematics_label - end do - - -end function kinematics_active2 - - !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the velocity gradient ! ToDo: MD: S is Mi? From aa651e04ae01ea524bf2d55c5058c89e49885b67 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 28 Aug 2023 21:41:48 -0400 Subject: [PATCH 128/198] reverse order of printing --- src/phase_damage_anisobrittle.f90 | 4 ++-- src/phase_damage_isobrittle.f90 | 4 ++-- src/phase_mechanical_eigen_thermalexpansion.f90 | 10 ++++------ src/phase_mechanical_elastic.f90 | 4 ++-- src/phase_mechanical_plastic_dislotungsten.f90 | 2 +- src/phase_mechanical_plastic_dislotwin.f90 | 2 +- src/phase_mechanical_plastic_isotropic.f90 | 2 +- src/phase_mechanical_plastic_kinehardening.f90 | 2 +- src/phase_mechanical_plastic_none.f90 | 2 +- src/phase_mechanical_plastic_nonlocal.f90 | 2 +- src/phase_mechanical_plastic_phenopowerlaw.f90 | 4 ++-- src/phase_thermal_source_dissipation.f90 | 4 ++-- src/phase_thermal_source_externalheat.f90 | 4 ++-- 13 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/phase_damage_anisobrittle.f90 b/src/phase_damage_anisobrittle.f90 index e2ec9922c..fc3fbf5a2 100644 --- a/src/phase_damage_anisobrittle.f90 +++ b/src/phase_damage_anisobrittle.f90 @@ -50,7 +50,7 @@ module function anisobrittle_init() result(mySources) if (count(mySources) == 0) return print'(/,1x,a)', '<<<+- phase:damage:anisobrittle init -+>>>' - print'(/,a,i0)', ' # phases: ',count(mySources); flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',count(mySources); flush(IO_STDOUT) phases => config_material%get_dict('phase') @@ -64,7 +64,7 @@ module function anisobrittle_init() result(mySources) associate(prm => param(ph)) - print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) refs = config_listReferences(src,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs diff --git a/src/phase_damage_isobrittle.f90 b/src/phase_damage_isobrittle.f90 index 2efff9f7d..39bb762cf 100644 --- a/src/phase_damage_isobrittle.f90 +++ b/src/phase_damage_isobrittle.f90 @@ -48,7 +48,7 @@ module function isobrittle_init() result(mySources) if (count(mySources) == 0) return print'(/,1x,a)', '<<<+- phase:damage:isobrittle init -+>>>' - print'(/,a,i0)', ' # phases: ',count(mySources); flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',count(mySources); flush(IO_STDOUT) phases => config_material%get_dict('phase') @@ -66,7 +66,7 @@ module function isobrittle_init() result(mySources) prm%W_crit = src%get_asReal('G_crit')/src%get_asReal('l_c') - print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) refs = config_listReferences(src,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs diff --git a/src/phase_mechanical_eigen_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 index 027f71c81..5bc64bb49 100644 --- a/src/phase_mechanical_eigen_thermalexpansion.f90 +++ b/src/phase_mechanical_eigen_thermalexpansion.f90 @@ -27,7 +27,7 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics) integer, intent(in) :: kinematics_length logical, dimension(:,:), allocatable :: myKinematics - integer :: Ninstances, p, k + integer :: p, k type(tList), pointer :: & kinematics type(tDict), pointer :: & @@ -37,15 +37,13 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics) myKinematics = kinematics_active('thermalexpansion',kinematics_length) - Ninstances = count(myKinematics) - print'(/,a,i2)', ' # phases: ',Ninstances; flush(IO_STDOUT) - if (Ninstances == 0) return + if (count(myKinematics) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:eigen:thermalexpansion init -+>>>' - + print'(/,1x,a,1x,i0)', '# phases:',count(myKinematics); flush(IO_STDOUT) phases => config_material%get_dict('phase') - allocate(param(Ninstances)) + allocate(param(count(myKinematics))) allocate(kinematics_thermal_expansion_instance(phases%length), source=0) do p = 1, phases%length diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index 89b5027ac..40b5e4cf1 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -34,7 +34,7 @@ module subroutine elastic_init(phases) print'(/,1x,a)', '<<<+- phase:mechanical:elastic init -+>>>' print'(/,1x,a)', '<<<+- phase:mechanical:elastic:Hooke init -+>>>' - print'(/,a,i0)', ' # phases: ',phases%length; flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',phases%length; flush(IO_STDOUT) allocate(param(phases%length)) @@ -43,7 +43,7 @@ module subroutine elastic_init(phases) phase => phases%get_dict(ph) mech => phase%get_dict('mechanical') elastic => mech%get_dict('elastic') - print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) refs = config_listReferences(elastic,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs if (elastic%get_asStr('type') /= 'Hooke') call IO_error(200,ext_msg=elastic%get_asStr('type')) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index 08dd3decd..a3567efe4 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -108,11 +108,11 @@ module function plastic_dislotungsten_init() result(myPlasticity) if (count(myPlasticity) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:plastic:dislotungsten init -+>>>' - print'(/,a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print'(/,1x,a)', 'D. Cereceda et al., International Journal of Plasticity 78:242–256, 2016' print'( 1x,a)', 'https://doi.org/10.1016/j.ijplas.2015.09.002' + print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') allocate(param(phases%length)) diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index a1f22baa7..a93c4752a 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -155,7 +155,6 @@ module function plastic_dislotwin_init() result(myPlasticity) if (count(myPlasticity) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:plastic:dislotwin init -+>>>' - print'(/,a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print'(/,1x,a)', 'A. Ma and F. Roters, Acta Materialia 52(12):3603–3612, 2004' print'( 1x,a)', 'https://doi.org/10.1016/j.actamat.2004.04.012' @@ -166,6 +165,7 @@ module function plastic_dislotwin_init() result(myPlasticity) print'(/,1x,a)', 'S.L. Wong et al., Acta Materialia 118:140–151, 2016' print'( 1x,a)', 'https://doi.org/10.1016/j.actamat.2016.07.032' + print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') allocate(param(phases%length)) diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index be859dddb..e7935ddf1 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -68,11 +68,11 @@ module function plastic_isotropic_init() result(myPlasticity) if (count(myPlasticity) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:plastic:isotropic init -+>>>' - print'(/,a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print'(/,1x,a)', 'T. Maiti and P. Eisenlohr, Scripta Materialia 145:37–40, 2018' print'( 1x,a)', 'https://doi.org/10.1016/j.scriptamat.2017.09.047' + print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') allocate(param(phases%length)) diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 2ce34cd95..81fa188c8 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -100,11 +100,11 @@ module function plastic_kinehardening_init() result(myPlasticity) if (count(myPlasticity) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:plastic:kinehardening init -+>>>' - print'(/,a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print'(/,1x,a)', 'J.A. Wollmershauser et al., International Journal of Fatigue 36:181–193, 2012' print'( 1x,a)', 'https://doi.org/10.1016/j.ijfatigue.2011.07.008' + print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') allocate(param(phases%length)) diff --git a/src/phase_mechanical_plastic_none.f90 b/src/phase_mechanical_plastic_none.f90 index 748e0579b..b42c0513c 100644 --- a/src/phase_mechanical_plastic_none.f90 +++ b/src/phase_mechanical_plastic_none.f90 @@ -25,7 +25,7 @@ module function plastic_none_init() result(myPlasticity) if (count(myPlasticity) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:plastic:none init -+>>>' - print'(/,a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 3e34256f1..e90dcae3c 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -203,7 +203,6 @@ module function plastic_nonlocal_init() result(myPlasticity) end if print'(/,1x,a)', '<<<+- phase:mechanical:plastic:nonlocal init -+>>>' - print'(/,a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) print'(/,1x,a)', 'C. Reuber et al., Acta Materialia 71:333–348, 2014' print'( 1x,a)', 'https://doi.org/10.1016/j.actamat.2014.03.012' @@ -211,6 +210,7 @@ module function plastic_nonlocal_init() result(myPlasticity) print'(/,1x,a)', 'C. Kords, Dissertation RWTH Aachen, 2014' print'( 1x,a)', 'http://publications.rwth-aachen.de/record/229993' + print'(/,1x,a,1x,i0)', '# phases:',Ninstances; flush(IO_STDOUT) phases => config_material%get_dict('phase') allocate(geom(phases%length)) diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 8a8018892..4091e0f76 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -105,7 +105,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) if (count(myPlasticity) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:plastic:phenopowerlaw init -+>>>' - print'(/,a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') @@ -124,7 +124,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) refs = config_listReferences(pl,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs diff --git a/src/phase_thermal_source_dissipation.f90 b/src/phase_thermal_source_dissipation.f90 index 760259286..f0e75b10a 100644 --- a/src/phase_thermal_source_dissipation.f90 +++ b/src/phase_thermal_source_dissipation.f90 @@ -42,7 +42,7 @@ module function source_dissipation_init(maxNsources) result(isMySource) if (count(isMySource) == 0) return print'(/,1x,a)', '<<<+- phase:thermal:source_dissipation init -+>>>' - print'(/,a,i2)', ' # phases: ',count(isMySource); flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',count(isMySource); flush(IO_STDOUT) phases => config_material%get_dict('phase') @@ -60,7 +60,7 @@ module function source_dissipation_init(maxNsources) result(isMySource) if (isMySource(so,ph)) then associate(prm => param(ph)) src => sources%get_dict(so) - print'(1x,a,i0,a,i0)', 'phase ',ph,' source ',so + print'(/,1x,a,1x,i0,1x,a,1x,a,1x,i0)', 'phase',ph,'('//phases%key(ph)//')','source',so refs = config_listReferences(src,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs diff --git a/src/phase_thermal_source_externalheat.f90 b/src/phase_thermal_source_externalheat.f90 index 1a803549c..bd642af48 100644 --- a/src/phase_thermal_source_externalheat.f90 +++ b/src/phase_thermal_source_externalheat.f90 @@ -44,7 +44,7 @@ module function source_externalheat_init(maxNsources) result(isMySource) if (count(isMySource) == 0) return print'(/,1x,a)', '<<<+- phase:thermal:source_externalheat init -+>>>' - print'(/,a,i2)', ' # phases: ',count(isMySource); flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',count(isMySource); flush(IO_STDOUT) phases => config_material%get_dict('phase') @@ -64,7 +64,7 @@ module function source_externalheat_init(maxNsources) result(isMySource) source_ID(ph) = so associate(prm => param(ph)) src => sources%get_dict(so) - print'(1x,a,i0,a,i0)', 'phase ',ph,' source ',so + print'(/,1x,a,1x,i0,1x,a,1x,a,1x,i0)', 'phase',ph,'('//phases%key(ph)//')','source',so refs = config_listReferences(src,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs From bc1d7f850cd3037c168698bbcb7851596ec61d52 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 29 Aug 2023 09:21:10 +0200 Subject: [PATCH 129/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-765-gb11807486 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c20fae673..050079be5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-762-g0cda7af7e +3.0.0-alpha7-765-gb11807486 From 3f8a561465cba2e1d2cbe588f65915c9bc2b9b93 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 29 Aug 2023 12:55:42 +0200 Subject: [PATCH 130/198] testing tI slip systems --- src/crystal.f90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/crystal.f90 b/src/crystal.f90 index 33ca4dc74..7bf9dc2f7 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -2249,6 +2249,12 @@ subroutine crystal_selfTest CoSy = buildCoordinateSystem([1],[1],system,'cF',0.0_pREAL) if (any(dNeq(CoSy(1:3,1:3,1),math_I3))) error stop 'buildCoordinateSystem' + if (any(dNeq(buildCoordinateSystem(TI_NSLIPSYSTEM,TI_NSLIPSYSTEM,TI_SYSTEMSLIP,'cI',0.0_pReal), & + buildCoordinateSystem(TI_NSLIPSYSTEM,TI_NSLIPSYSTEM,TI_SYSTEMSLIP,'tI',1.0_pReal)))) & + error stop 'cI/tI coordinate system' + if (all(dEq( buildCoordinateSystem(TI_NSLIPSYSTEM,TI_NSLIPSYSTEM,TI_SYSTEMSLIP,'tI',1.1_pReal + r(1)*0.9_pReal), & + buildCoordinateSystem(TI_NSLIPSYSTEM,TI_NSLIPSYSTEM,TI_SYSTEMSLIP,'tI',1.0_pReal)))) & + error stop 'tI coordinate system' do i = 1, 10 call random_number(C) C_cF = crystal_symmetrize_C66(C,'cI') From 82c96c9573ef9c5fde91f3944ff144901d0ecca2 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 29 Aug 2023 15:47:10 -0400 Subject: [PATCH 131/198] use corresponding PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index ac2758719..f675f2c13 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit ac27587199340ac1ec7a5c4e1ccd92dbf1299742 +Subproject commit f675f2c13a1587c60179fc31caf2e26aa2ee2379 From 8e8fe810a44f309f05623184923ed3b2d97c7c17 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 30 Aug 2023 17:24:27 +0200 Subject: [PATCH 132/198] better test for thermal large strain grid --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index f675f2c13..15241fed4 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit f675f2c13a1587c60179fc31caf2e26aa2ee2379 +Subproject commit 15241fed4cd828d4aa2111a90b019f1f150685d9 From 7eabc17dc9aa3dabfe16b4800f9e323aa47cbe20 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 30 Aug 2023 20:42:03 +0200 Subject: [PATCH 133/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-773-g8748af5dc --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 050079be5..f96af1084 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-765-gb11807486 +3.0.0-alpha7-773-g8748af5dc From dab72465bddba2576028c27a0c6ffe4bfbbc589f Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 31 Aug 2023 11:31:41 -0400 Subject: [PATCH 134/198] use updated PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 15241fed4..cea3296f7 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 15241fed4cd828d4aa2111a90b019f1f150685d9 +Subproject commit cea3296f78f5b48ab949364a80b738d3a7cf2194 From 96137f6768db5697c725680ec767e87d081abe4b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 31 Aug 2023 15:27:22 -0400 Subject: [PATCH 135/198] use 30% faster algorithm --- python/damask/_rotation.py | 55 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 166863e70..66f57820a 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1324,28 +1324,41 @@ class Rotation: @staticmethod def _qu2eu(qu: np.ndarray) -> np.ndarray: - """Quaternion to Bunge Euler angles.""" - q02 = qu[...,0:1]*qu[...,2:3] - q13 = qu[...,1:2]*qu[...,3:4] - q01 = qu[...,0:1]*qu[...,1:2] - q23 = qu[...,2:3]*qu[...,3:4] - q03_s = qu[...,0:1]**2+qu[...,3:4]**2 - q12_s = qu[...,1:2]**2+qu[...,2:3]**2 - chi = np.sqrt(q03_s*q12_s) + """ + Quaternion to Bunge Euler angles. - eu = np.where(np.abs(q12_s) < 1.e-8, - np.block([np.arctan2(-_P*2.*qu[...,0:1]*qu[...,3:4],qu[...,0:1]**2-qu[...,3:4]**2), - np.zeros(qu.shape[:-1]+(2,))]), - np.where(np.abs(q03_s) < 1.e-8, - np.block([np.arctan2( 2.*qu[...,1:2]*qu[...,2:3],qu[...,1:2]**2-qu[...,2:3]**2), - np.broadcast_to(np.pi,qu[...,0:1].shape), - np.zeros(qu.shape[:-1]+(1,))]), - np.block([np.arctan2((-_P*q02+q13)*chi, (-_P*q01-q23)*chi), - np.arctan2( 2.*chi, q03_s-q12_s ), - np.arctan2(( _P*q02+q13)*chi, (-_P*q01+q23)*chi)]) - ) - ) - eu[np.abs(eu) < 1.e-6] = 0. + References + ---------- + E. Bernardes and S. Viollet, PLoS ONE 17(11): e0276302 + https://doi.org/10.1371/journal.pone.0276302 + + """ + a = qu[...,0:1] + b = -_P*qu[...,3:4] + c = -_P*qu[...,1:2] + d = -_P*qu[...,2:3] + + eu = np.block([ + np.arctan2(b,a), + np.arccos(2*(a**2+b**2)/(a**2+b**2+c**2+d**2)-1), + np.arctan2(-d,c), + ]) + + eu_sum = eu[...,0] + eu[...,2] + eu_diff = eu[...,0] - eu[...,2] + + is_zero = np.isclose(eu[...,1],0.0) + is_pi = np.isclose(eu[...,1],np.pi) + is_ok = ~np.logical_or(is_zero,is_pi) + + eu[...,0][is_zero] = 2*eu[...,0][is_zero] + eu[...,0][is_pi] = -2*eu[...,2][is_pi] + eu[...,2][~is_ok] = 0.0 + eu[...,0][is_ok] = eu_diff[is_ok] + eu[...,2][is_ok] = eu_sum [is_ok] + + eu[np.logical_or(np.abs(eu) < 1.e-6, + np.abs(eu-2*np.pi) < 1.e-6)] = 0. return np.where(eu < 0., eu%(np.pi*np.array([2.,1.,2.])),eu) @staticmethod From 872849198893a77145dcf828cc230f4aa3658991 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 31 Aug 2023 21:32:40 +0200 Subject: [PATCH 136/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-777-g76f7f2d2b --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f96af1084..783d290ac 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-773-g8748af5dc +3.0.0-alpha7-777-g76f7f2d2b From 9b0a051737b50e4bc392c48b95316b8dfadd6d63 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 1 Sep 2023 13:05:28 +0200 Subject: [PATCH 137/198] standardized citation --- python/damask/_rotation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 66f57820a..cd3164db4 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1329,7 +1329,7 @@ class Rotation: References ---------- - E. Bernardes and S. Viollet, PLoS ONE 17(11): e0276302 + E. Bernardes and S. Viollet, PLoS ONE 17(11):e0276302, 2022 https://doi.org/10.1371/journal.pone.0276302 """ From 30464c2d9becf9180e5918bcbc735db900630d8e Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 1 Sep 2023 18:04:50 +0200 Subject: [PATCH 138/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-781-gbe87d9eed --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 783d290ac..dbe6586cc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-777-g76f7f2d2b +3.0.0-alpha7-781-gbe87d9eed From 288aa73047616c6ef6321c1521eae758dad4261e Mon Sep 17 00:00:00 2001 From: Cathy Bing Date: Fri, 1 Sep 2023 17:30:17 -0400 Subject: [PATCH 139/198] added sanity check for positive rho,C_p,K in thermal --- src/phase.f90 | 2 +- src/phase_thermal.f90 | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index 4b01c6ef0..4cc341913 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -427,12 +427,12 @@ subroutine phase_init phase => phases%get_dict(ph) refs = config_listReferences(phase,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs + phase_rho(ph) = phase%get_asReal('rho',defaultVal=0.0_pREAL) phase_lattice(ph) = phase%get_asStr('lattice') if (all(phase_lattice(ph) /= ['cF','cI','hP','tI'])) & call IO_error(130,ext_msg='phase_init: '//phase%get_asStr('lattice')) if (any(phase_lattice(ph) == ['hP','tI'])) & phase_cOverA(ph) = phase%get_asReal('c/a') - phase_rho(ph) = phase%get_asReal('rho',defaultVal=0.0_pREAL) allocate(phase_O_0(ph)%data(count(material_ID_phase==ph))) end do diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index e21f173ad..f63eb5e19 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -76,7 +76,9 @@ module subroutine thermal_init(phases) thermal type(tList), pointer :: & sources - character(len=:), allocatable :: refs + character(len=:), allocatable :: & + refs, & + extmsg integer :: & ph, so, & Nmembers @@ -88,6 +90,7 @@ module subroutine thermal_init(phases) allocate(thermalState(phases%length)) allocate(thermal_Nsources(phases%length),source = 0) allocate(param(phases%length)) + extmsg = '' do ph = 1, phases%length Nmembers = count(material_ID_phase == ph) @@ -106,6 +109,15 @@ module subroutine thermal_init(phases) if (any(phase_lattice(ph) == ['hP','tI'])) param(ph)%K(3,3) = thermal%get_asReal('K_33') param(ph)%K = crystal_symmetrize_33(param(ph)%K,phase_lattice(ph)) + ! sanity checks + if ( param(ph)%C_p <= 0.0_pREAL ) extmsg = trim(extmsg)//' C_p' + if (any(param(ph)%K < 0.0_pREAL)) extmsg = trim(extmsg)//' K' + if ( phase_rho(ph) <= 0.0_pREAL ) extmsg = trim(extmsg)//' rho' + +!-------------------------------------------------------------------------------------------------- +! exit if any parameter is out of range + if (extmsg /= '') call IO_error(211,ext_msg=trim(extmsg)) + #if defined(__GFORTRAN__) param(ph)%output = output_as1dStr(thermal) #else From 8399a1170311c34558eadbd7a4e0b36d9d76c579 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 4 Sep 2023 11:39:45 -0400 Subject: [PATCH 140/198] more extensive numerics.yaml documentation --- examples/config/numerics.yaml | 110 +++++++++++++++++----------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index 487b6cf88..4ff1d3863 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -1,5 +1,5 @@ -# Available numerical parameters -# Case sensitive keys +# Default values of all available numerical parameters +# Please note that keys are case sensitive homogenization: mechanical: @@ -21,75 +21,77 @@ homogenization: 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) + 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 + 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 + 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) + N_iter_min: 1 # minimum iteration number + N_iter_max: 100 # maximum iteration number + 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 + update_gamma: false # update Gamma-operator with current dPdF (not possible if FFT:memory_efficient=true) 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 + memory_efficient: true # precalculate Gamma-operator (81 doubles per point) + divergence_correction: size+grid # use size-independent divergence criterion {none, size, size+grid} + derivative: continuous # approximation used for derivatives in Fourier space {continuous, central_difference, FWBW_difference} + FFTW_plan_mode: FFTW_MEASURE # planning-rigor flags, see manual at https://www.fftw.org/fftw3_doc/Planner-Flags.html + FFTW_timelimit: -1.0 # time limit of plan creation for FFTW, see manual on www.fftw.org. (-1.0: disable time limit) + 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) - maxStaggeredIter: 10 # max number of field level staggered iterations - structorder: 2 # order of displacement shape functions (when mesh is defined) + maxCutBack: 3 # maximum cut back level (0: 1, 1: 0.5, 2: 0.25, etc) + maxStaggeredIter: 10 # max number of field level staggered iterations + structorder: 2 # order of displacement shape functions bbarstabilisation: false - integrationorder: 2 # order of quadrature rule required (when mesh is defined) - itmax: 250 # Maximum iteration number - itmin: 2 # Minimum iteration number - eps_struct_atol: 1.0e-10 # absolute tolerance for mechanical equilibrium - eps_struct_rtol: 1.0e-4 # relative tolerance for mechanical equilibrium + integrationorder: 2 # order of quadrature rule required + itmax: 250 # maximum iteration number + itmin: 2 # minimum iteration number + eps_struct_atol: 1.0e-10 # absolute tolerance for mechanical equilibrium + eps_struct_rtol: 1.0e-4 # relative tolerance for mechanical equilibrium phase: mechanical: - r_cutback_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in phase state calculation - r_cutback: 0.25 # factor to decrease size of step when cutback introduced in phase state calculation (value between 0 and 1) - r_increase: 1.5 # factor to increase size of next step when previous step converged in phase state calculation - eps_rel_state: 1.0e-6 # relative tolerance in phase state loop (abs tol provided by constitutive law) - N_iter_state_max: 10 # state loop limit + r_cutback_min: 1.0e-3 # minimum (relative) size of step allowed during cutback in phase state calculation + r_cutback: 0.25 # factor to decrease size of step when cutback introduced in phase state calculation (value between 0 and 1) + r_increase: 1.5 # factor to increase size of next step when previous step converged in phase state calculation + eps_rel_state: 1.0e-6 # relative tolerance in phase state loop (abs tol provided by constitutive law) + N_iter_state_max: 10 # state loop limit plastic: - r_linesearch_Lp: 0.5 # factor to decrease the step due to non-convergence in Lp calculation - eps_rel_Lp: 1.0e-6 # relative tolerance in Lp residuum - eps_abs_Lp: 1.0e-8 # absolute tolerance in Lp residuum - N_iter_Lp_max: 40 # stress loop limit for Lp - f_update_jacobi_Lp: 1 # frequency of Jacobian update of residuum in Lp - integrator_state: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) + r_linesearch_Lp: 0.5 # factor to decrease the step due to non-convergence in Lp calculation + eps_rel_Lp: 1.0e-6 # relative tolerance in Lp residuum + eps_abs_Lp: 1.0e-8 # absolute tolerance in Lp residuum + N_iter_Lp_max: 40 # stress loop limit for Lp + f_update_jacobi_Lp: 1 # frequency of Jacobian update of residuum in Lp + integrator_state: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) + eigen: - r_linesearch_Li: 0.5 # factor to decrease the step due to non-convergence in Li calculation - eps_rel_Li: 1.0e-6 # relative tolerance in Li residuum - eps_abs_Li: 1.0e-8 # absolute tolerance in Li residuum - N_iter_Li_max: 40 # stress loop limit for Li - f_update_jacobi_Li: 1 # frequency of Jacobian update of residuum in Li + r_linesearch_Li: 0.5 # factor to decrease the step due to non-convergence in Li calculation + eps_rel_Li: 1.0e-6 # relative tolerance in Li residuum + eps_abs_Li: 1.0e-8 # absolute tolerance in Li residuum + N_iter_Li_max: 40 # stress loop limit for Li + f_update_jacobi_Li: 1 # frequency of updating the Jacobian of residuum in Li commercialFEM: - unitlength: 1 # physical length of one computational length unit + unitlength: 1 # physical length of one computational length unit generic: - random_seed: 0 # fixed seeding for pseudo-random number generator, Default 0: use random seed. - phi_min: 1.0e-6 # non-zero residual damage. + random_seed: 0 # fixed seeding for pseudo-random number generator (0: use random seed) + phi_min: 1.0e-6 # non-zero residual damage From a0335aa0c4218d64f171c9b872907242c6a14897 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 4 Sep 2023 22:38:03 +0200 Subject: [PATCH 141/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-784-g69239661c --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index dbe6586cc..9bb6a55a4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-781-gbe87d9eed +3.0.0-alpha7-784-g69239661c From 68218672fe62493b1160a254020f5e8e7944704d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 5 Sep 2023 11:44:45 -0400 Subject: [PATCH 142/198] use updated PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index cea3296f7..dfb03cacf 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit cea3296f78f5b48ab949364a80b738d3a7cf2194 +Subproject commit dfb03cacf07dfd77a9318fc842254e0a3e75a860 From 2434c322cadbb9a7a47fc28fc5f3269f509e5d3d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 5 Sep 2023 13:14:20 -0400 Subject: [PATCH 143/198] more sensible sorting of sections; additional polish --- examples/config/numerics.yaml | 68 +++++++++++++++++------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index 4ff1d3863..e04888055 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -1,28 +1,10 @@ # Default values of all available numerical parameters # Please note that keys are case sensitive -homogenization: - mechanical: - RGC: - eps_abs_P: 1.0e+4 # absolute tolerance of RGC residuum (in Pa) - eps_rel_P: 1.0e-3 # relative ... - eps_abs_max: 1.0e+10 # absolute upper-limit of RGC residuum (in Pa) - eps_rel_max: 1.0e+2 # relative ... - Delta_a: 1.0e-7 # perturbation for computing penalty tangent - relevant_mismatch: 1.0e-5 # minimum threshold of mismatch - viscosity_exponent: 1.0e+0 # power (sensitivity rate) of numerical viscosity in RGC scheme - viscosity_modulus: 0.0e+0 # stress modulus of RGC numerical viscosity (zero = without numerical viscosity) - # suggestion: larger than the aTol_RGC but still far below the expected flow stress of material - dot_a_ref: 1.0e-3 # reference rate of relaxation (about the same magnitude as straining rate, possibly a bit higher) - dot_a_max: 1.0e+0 # threshold of maximum relaxation vector increment (if exceed this then cutback) - Delta_V_max: 1.0e-5 # maximum allowable relative volume discrepancy - Delta_V_modulus: 1.0e+12 - Delta_V_exponent: 5.0 - 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) + N_cutback_max: 3 # maximum cutback level (0: 1, 1: 0.5, 2: 0.25, etc) damage: N_iter_max: 100 # maximum iteration number @@ -41,7 +23,7 @@ solver: 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 - update_gamma: false # update Gamma-operator with current dPdF (not possible if FFT:memory_efficient=true) + update_gamma: false # update Gamma-operator with current dPdF (not possible if FFT: memory_efficient == true) FFT: memory_efficient: true # precalculate Gamma-operator (81 doubles per point) @@ -50,21 +32,28 @@ solver: FFTW_plan_mode: FFTW_MEASURE # planning-rigor flags, see manual at https://www.fftw.org/fftw3_doc/Planner-Flags.html FFTW_timelimit: -1.0 # time limit of plan creation for FFTW, see manual on www.fftw.org. (-1.0: disable time limit) 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) + alpha: 1.0 # polarization scheme parameter 0.0 < alpha < 2.0 (1.0: AL scheme, 2.0: accelerated scheme) + beta: 1.0 # polarization scheme parameter 0.0 < beta < 2.0 (1.0: AL scheme, 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) - maxStaggeredIter: 10 # max number of field level staggered iterations - structorder: 2 # order of displacement shape functions - bbarstabilisation: false - integrationorder: 2 # order of quadrature rule required - itmax: 250 # maximum iteration number - itmin: 2 # minimum iteration number - eps_struct_atol: 1.0e-10 # absolute tolerance for mechanical equilibrium - eps_struct_rtol: 1.0e-4 # relative tolerance for mechanical equilibrium +homogenization: + mechanical: + RGC: + eps_abs_P: 1.0e+4 # absolute tolerance of RGC residuum (in Pa) + eps_rel_P: 1.0e-3 # relative ... + eps_abs_max: 1.0e+10 # absolute upper-limit of RGC residuum (in Pa) + eps_rel_max: 1.0e+2 # relative ... + Delta_a: 1.0e-7 # perturbation for computing penalty tangent + relevant_mismatch: 1.0e-5 # minimum threshold of mismatch + viscosity_exponent: 1.0e+0 # power (sensitivity rate) of numerical viscosity in RGC scheme + viscosity_modulus: 0.0e+0 # stress modulus of RGC numerical viscosity (0: without numerical viscosity) + # suggestion: larger than the aTol_RGC but still far below the expected flow stress of material + dot_a_ref: 1.0e-3 # reference rate of relaxation (about the same magnitude as straining rate, possibly a bit higher) + dot_a_max: 1.0e+0 # threshold of maximum relaxation vector increment (if exceed this then cutback) + Delta_V_max: 1.0e-5 # maximum allowable relative volume discrepancy + Delta_V_modulus: 1.0e+12 + Delta_V_exponent: 5.0 phase: mechanical: @@ -75,7 +64,7 @@ phase: N_iter_state_max: 10 # state loop limit plastic: - r_linesearch_Lp: 0.5 # factor to decrease the step due to non-convergence in Lp calculation + r_linesearch_Lp: 0.5 # factor to decrease the step if Lp calculation fails to converge eps_rel_Lp: 1.0e-6 # relative tolerance in Lp residuum eps_abs_Lp: 1.0e-8 # absolute tolerance in Lp residuum N_iter_Lp_max: 40 # stress loop limit for Lp @@ -83,7 +72,7 @@ phase: integrator_state: FPI # integration method (FPI = Fixed Point Iteration, Euler = Euler, AdaptiveEuler = Adaptive Euler, RK4 = classical 4th order Runge-Kutta, RKCK45 = 5th order Runge-Kutta Cash-Karp) eigen: - r_linesearch_Li: 0.5 # factor to decrease the step due to non-convergence in Li calculation + r_linesearch_Li: 0.5 # factor to decrease the step if Li calculation fails to converge eps_rel_Li: 1.0e-6 # relative tolerance in Li residuum eps_abs_Li: 1.0e-8 # absolute tolerance in Li residuum N_iter_Li_max: 40 # stress loop limit for Li @@ -95,3 +84,14 @@ commercialFEM: generic: random_seed: 0 # fixed seeding for pseudo-random number generator (0: use random seed) phi_min: 1.0e-6 # non-zero residual damage + +mesh: + maxCutBack: 3 # maximum cutback level (0: 1, 1: 0.5, 2: 0.25, etc.) + maxStaggeredIter: 10 # max number of field-level staggered iterations + structorder: 2 # order of displacement shape functions + bbarstabilisation: false + integrationorder: 2 # order of quadrature rule required + itmax: 250 # maximum iteration number + itmin: 2 # minimum iteration number + eps_struct_atol: 1.0e-10 # absolute tolerance for mechanical equilibrium + eps_struct_rtol: 1.0e-4 # relative tolerance for mechanical equilibrium From 1de0b62eaba16cd0d8f74a2b93e43dfd165d8e0b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 5 Sep 2023 23:34:27 -0400 Subject: [PATCH 144/198] use corrected conftest.py in PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index dfb03cacf..22997d0e2 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit dfb03cacf07dfd77a9318fc842254e0a3e75a860 +Subproject commit 22997d0e297b689ae07da20fb4baa5aaf0ad4024 From e101b5cca8e18a805c65071b41718007bed2f9b2 Mon Sep 17 00:00:00 2001 From: Sharan Date: Wed, 6 Sep 2023 11:17:39 +0200 Subject: [PATCH 145/198] correct pointer --- src/mesh/discretization_mesh.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index 8cecfbfb2..7790a82fd 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -101,7 +101,7 @@ subroutine discretization_mesh_init(restart) !-------------------------------------------------------------------------------- ! read numerics parameter num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) - num_mesh => config_numerics%get_dict('mesh',defaultVal=emptyDict) + num_mesh => num_solver%get_dict('mesh',defaultVal=emptyDict) p_i = num_mesh%get_asInt('p_i',defaultVal = 2) #if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>16) From 252128a8638a39dcee601ee449516fef75dcbd20 Mon Sep 17 00:00:00 2001 From: Sharan Date: Wed, 6 Sep 2023 12:16:58 +0200 Subject: [PATCH 146/198] updated private repo --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index d85026fcc..1f8e4c450 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit d85026fccb1cad572a24ef19eefc36365df78a0f +Subproject commit 1f8e4c45073b0bd79f95caf034e993c72a74410d From 9c4fa16c7d8f117e6281306d36c2c30b2a9a6577 Mon Sep 17 00:00:00 2001 From: Sharan Date: Wed, 6 Sep 2023 19:57:40 +0200 Subject: [PATCH 147/198] new mech dict --- PRIVATE | 2 +- src/mesh/FEM_utilities.f90 | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/PRIVATE b/PRIVATE index 1f8e4c450..23a19f513 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 1f8e4c45073b0bd79f95caf034e993c72a74410d +Subproject commit 23a19f513e760e0b6d93ebb3bbf03ca3171c71d6 diff --git a/src/mesh/FEM_utilities.f90 b/src/mesh/FEM_utilities.f90 index 2389721b4..4480e412d 100644 --- a/src/mesh/FEM_utilities.f90 +++ b/src/mesh/FEM_utilities.f90 @@ -95,6 +95,9 @@ subroutine FEM_utilities_init(num_mesh) type(tDict), pointer, intent(in) :: & num_mesh + + type(tDict), pointer :: & + num_mech character(len=pSTRLEN) :: petsc_optionsOrder character(len=:), allocatable :: & petsc_options @@ -106,6 +109,8 @@ subroutine FEM_utilities_init(num_mesh) print'(/,1x,a)', '<<<+- FEM_utilities init -+>>>' + num_mech => num_mesh%get_dict('mechanical', defaultVal=emptyDict) + p_s = num_mesh%get_asInt('p_s',defaultVal = 2) p_i = num_mesh%get_asInt('p_i',defaultVal = p_s) @@ -123,7 +128,7 @@ subroutine FEM_utilities_init(num_mesh) &-snes_linesearch_type cp -snes_ksp_ew & &-snes_ksp_ew_rtol0 0.01 -snes_ksp_ew_rtolmax 0.01 & &-ksp_type fgmres -ksp_max_it 25 ' // & - num_mesh%get_asStr('PETSc_options',defaultVal=''), 'mechanical_') + num_mech%get_asStr('PETSc_options',defaultVal=''), 'mechanical_') write(petsc_optionsOrder,'(a,i0)') '-mechFE_petscspace_degree ', p_s petsc_options = petsc_options // ' ' // petsc_optionsOrder From af955df891688949bb7062dce3a049e757538c7c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 6 Sep 2023 15:11:48 -0400 Subject: [PATCH 148/198] added phi_min back to example; more consistency in code syntax --- examples/config/numerics.yaml | 3 ++- src/Marc/discretization_Marc.f90 | 4 ++-- src/mesh/DAMASK_mesh.f90 | 4 ++-- src/mesh/discretization_mesh.f90 | 2 +- src/mesh/mesh_mech_FEM.f90 | 16 ++++++++-------- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/config/numerics.yaml b/examples/config/numerics.yaml index 33bd267fc..cdc487589 100644 --- a/examples/config/numerics.yaml +++ b/examples/config/numerics.yaml @@ -10,6 +10,7 @@ solver: 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 + phi_min: 1.0e-6 # residual integrity thermal: N_iter_max: 100 # maximum iteration number @@ -42,7 +43,7 @@ solver: N_staggered_iter_max: 10 # max number of field level staggered iterations p_s: 2 # order of displacement shape functions p_i: 2 # order of quadrature rule required - bbarstabilisation: false + bbarstabilization: false mechanical: N_iter_max: 250 # Maximum iteration number diff --git a/src/Marc/discretization_Marc.f90 b/src/Marc/discretization_Marc.f90 index a5094b7fa..5e42180de 100644 --- a/src/Marc/discretization_Marc.f90 +++ b/src/Marc/discretization_Marc.f90 @@ -76,9 +76,9 @@ subroutine discretization_Marc_init print'(/,a)', ' <<<+- discretization_Marc init -+>>>'; flush(6) num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) - num_commercialFEM => num_solver%get_dict('Marc', defaultVal = emptyDict) + num_commercialFEM => num_solver%get_dict('Marc',defaultVal=emptyDict) mesh_unitlength = num_commercialFEM%get_asReal('unit_length',defaultVal=1.0_pREAL) ! set physical extent of a length unit in mesh - if (mesh_unitlength <= 0.0_pREAL) call IO_error(301,'unitlength') + if (mesh_unitlength <= 0.0_pREAL) call IO_error(301,'unit_length') call inputRead(elem,node0_elem,connectivity_elem,materialAt) nElems = size(connectivity_elem,2) diff --git a/src/mesh/DAMASK_mesh.f90 b/src/mesh/DAMASK_mesh.f90 index 133a98997..370dc3535 100644 --- a/src/mesh/DAMASK_mesh.f90 +++ b/src/mesh/DAMASK_mesh.f90 @@ -91,8 +91,8 @@ program DAMASK_mesh !--------------------------------------------------------------------- ! reading field information from numerics file and do sanity checks - num_solver => config_numerics%get_dict('solver', defaultVal=emptyDict) - num_mesh => num_solver%get_dict('mesh', defaultVal=emptyDict) + num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) + num_mesh => num_solver%get_dict('mesh',defaultVal=emptyDict) stagItMax = num_mesh%get_asInt('N_staggered_iter_max',defaultVal=10) maxCutBack = num_mesh%get_asInt('N_cutback_max',defaultVal=3) diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index 7790a82fd..be9be3b19 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -102,7 +102,7 @@ subroutine discretization_mesh_init(restart) ! read numerics parameter num_solver => config_numerics%get_dict('solver',defaultVal=emptyDict) num_mesh => num_solver%get_dict('mesh',defaultVal=emptyDict) - p_i = num_mesh%get_asInt('p_i',defaultVal = 2) + p_i = num_mesh%get_asInt('p_i',defaultVal=2) #if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>16) call DMPlexCreateFromFile(PETSC_COMM_WORLD,CLI_geomFile,'n/a',PETSC_TRUE,globalMesh,err_PETSc) diff --git a/src/mesh/mesh_mech_FEM.f90 b/src/mesh/mesh_mech_FEM.f90 index 403372db7..c566990e2 100644 --- a/src/mesh/mesh_mech_FEM.f90 +++ b/src/mesh/mesh_mech_FEM.f90 @@ -47,7 +47,7 @@ module mesh_mechanical_FEM p_i, & !< integration order (quadrature rule) itmax logical :: & - BBarStabilisation + BBarStabilization real(pREAL) :: & eps_struct_atol, & !< absolute tolerance for mechanical equilibrium eps_struct_rtol !< relative tolerance for mechanical equilibrium @@ -135,12 +135,12 @@ subroutine FEM_mechanical_init(fieldBC,num_mesh) ! read numerical parametes and do sanity checks num_mech => num_mesh%get_dict('mechanical', defaultVal=emptyDict) - num%p_i = int(num_mesh%get_asInt('p_i',defaultVal = 2),pPETSCINT) - num%BBarStabilisation = num_mesh%get_asBool('bbarstabilisation',defaultVal = .false.) + num%p_i = int(num_mesh%get_asInt('p_i',defaultVal=2),pPETSCINT) + num%BBarStabilization = num_mesh%get_asBool('bbarstabilization',defaultVal=.false.) num%itmax = int(num_mech%get_asInt('N_iter_max',defaultVal=250),pPETSCINT) - num%eps_struct_atol = num_mech%get_asReal('eps_abs_div(P)', defaultVal = 1.0e-10_pREAL) - num%eps_struct_rtol = num_mech%get_asReal('eps_rel_div(P)', defaultVal = 1.0e-4_pREAL) + num%eps_struct_atol = num_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-10_pREAL) + num%eps_struct_rtol = num_mech%get_asReal('eps_rel_div(P)', defaultVal=1.0e-4_pREAL) if (num%itmax <= 1) call IO_error(301,ext_msg='N_iter_max') if (num%eps_struct_rtol <= 0.0_pREAL) call IO_error(301,ext_msg='eps_rel_div(P)') @@ -439,7 +439,7 @@ subroutine FEM_mechanical_formResidual(dm_local,xx_local,f_local,dummy,err_PETSc end do homogenization_F(1:dimPlex,1:dimPlex,m) = reshape(matmul(BMat,x_scal),shape=[dimPlex,dimPlex], order=[2,1]) end do - if (num%BBarStabilisation) then + if (num%BBarStabilization) then detFAvg = math_det33(sum(homogenization_F(1:3,1:3,cell*nQuadrature+1:(cell+1)*nQuadrature),dim=3)/real(nQuadrature,pREAL)) do qPt = 0, nQuadrature-1 m = cell*nQuadrature + qPt+1 @@ -590,7 +590,7 @@ subroutine FEM_mechanical_formJacobian(dm_local,xx_local,Jac_pre,Jac,dummy,err_P MatA = matmul(reshape(reshape(homogenization_dPdF(1:dimPlex,1:dimPlex,1:dimPlex,1:dimPlex,m), & shape=[dimPlex,dimPlex,dimPlex,dimPlex], order=[2,1,4,3]), & shape=[dimPlex*dimPlex,dimPlex*dimPlex]),BMat)*qWeights(qPt+1_pPETSCINT) - if (num%BBarStabilisation) then + if (num%BBarStabilization) then F(1:dimPlex,1:dimPlex) = reshape(matmul(BMat,x_scal),shape=[dimPlex,dimPlex]) FInv = math_inv33(F) K_eA = K_eA + matmul(transpose(BMat),MatA)*math_det33(FInv)**(1.0_pREAL/real(dimPlex,pREAL)) @@ -606,7 +606,7 @@ subroutine FEM_mechanical_formJacobian(dm_local,xx_local,Jac_pre,Jac,dummy,err_P K_eA = K_eA + matmul(transpose(BMat),MatA) end if end do - if (num%BBarStabilisation) then + if (num%BBarStabilization) then FInv = math_inv33(FAvg) K_e = K_eA*math_det33(FAvg/real(nQuadrature,pREAL))**(1.0_pREAL/real(dimPlex,pREAL)) + & (matmul(matmul(transpose(BMatAvg), & From 7c907fb05d0f1e940e6db359516652ac2c8d4ac4 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 6 Sep 2023 16:08:28 -0400 Subject: [PATCH 149/198] modified PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 22997d0e2..7a5d843c1 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 22997d0e297b689ae07da20fb4baa5aaf0ad4024 +Subproject commit 7a5d843c18b35af1f9879572544876590be7b718 From 60b6e592722ca1915ca001336058ca7763acbac8 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 7 Sep 2023 19:33:34 +0200 Subject: [PATCH 150/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-799-g2f8680e04 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9bb6a55a4..d627535e6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-784-g69239661c +3.0.0-alpha7-799-g2f8680e04 From 49051a7b5238da9a2340f8017ceeb564bc8d38a0 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 11 Sep 2023 18:45:07 +0200 Subject: [PATCH 151/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-805-g0051bacaa --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d627535e6..aa2b31eac 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-799-g2f8680e04 +3.0.0-alpha7-805-g0051bacaa From 104efaed5c8555e27df1a5c0f0f343c65b44c316 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Tue, 12 Sep 2023 09:28:16 +0200 Subject: [PATCH 152/198] use general server name, i.e. damsk.mpie.de --- .gitlab-ci.yml | 8 ++++---- PRIVATE | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e988f6cf9..5f4b0ba45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -262,11 +262,11 @@ update_plots: - ./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 - - scp -r ./commits_*.html damask3.mpie.de:~/ - - ssh damask3.mpie.de "./update_statistics_commits.sh" + - scp -r ./commits_*.html damask.mpie.de:~/ + - ssh damask.mpie.de "./update_statistics_commits.sh" - ./plot_performance.py --template=xgridoff - - scp -r ./runtime.html ./memory.html damask3.mpie.de:~/ - - ssh damask3.mpie.de "./update_statistics_performance.sh" + - scp -r ./runtime.html ./memory.html damask.mpie.de:~/ + - ssh damask.mpie.de "./update_statistics_performance.sh" only: - development diff --git a/PRIVATE b/PRIVATE index 85934fc5b..9623d3d50 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 85934fc5bfa617a3452d8282336c860bc1349d85 +Subproject commit 9623d3d50e11a086e456b7fddc25fae67266911d From f08b4db7b8b44d83ee0ac26aa4afb3f7a52c39a6 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 12 Sep 2023 11:29:45 +0200 Subject: [PATCH 153/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-807-g104efaed5 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index aa2b31eac..7fa9afb07 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-805-g0051bacaa +3.0.0-alpha7-807-g104efaed5 From 0396332b7b69c7b25ec76923715392d23246d602 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Sep 2023 22:43:50 +0200 Subject: [PATCH 154/198] needed for fixed non-Schmid behavior --- src/crystal.f90 | 18 ++++++------- src/grid/spectral_utilities.f90 | 2 ++ src/math.f90 | 48 +++++++++++++++++++++++++++------ 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/src/crystal.f90 b/src/crystal.f90 index 7bf9dc2f7..437e45227 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -1445,10 +1445,10 @@ end function crystal_SchmidMatrix_slip !-------------------------------------------------------------------------------------------------- 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) - real(pREAL), intent(in) :: cOverA !< c/a ratio - real(pREAL), dimension(3,3,sum(Ntwin)) :: SchmidMatrix + integer, dimension(:), intent(in) :: Ntwin !< number of active twin systems per family + character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) + real(pREAL), intent(in) :: cOverA !< c/a ratio + real(pREAL), dimension(3,3,sum(Ntwin)) :: SchmidMatrix real(pREAL), dimension(3,3,sum(Ntwin)) :: coordinateSystem real(pREAL), dimension(:,:), allocatable :: twinSystems @@ -1521,10 +1521,10 @@ end function crystal_SchmidMatrix_trans !-------------------------------------------------------------------------------------------------- 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) - real(pREAL), intent(in) :: cOverA !< c/a ratio - real(pREAL), dimension(3,3,3,sum(Ncleavage)) :: SchmidMatrix + integer, dimension(:), intent(in) :: Ncleavage !< number of active cleavage systems per family + character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) + real(pREAL), intent(in) :: cOverA !< c/a ratio + real(pREAL), dimension(3,3,3,sum(Ncleavage)) :: SchmidMatrix real(pREAL), dimension(3,3,sum(Ncleavage)) :: coordinateSystem real(pREAL), dimension(:,:), allocatable :: cleavageSystems @@ -1904,7 +1904,7 @@ end function buildInteraction !-------------------------------------------------------------------------------------------------- function buildCoordinateSystem(active,potential,system,lattice,cOverA) result(coordinateSystem) - integer, dimension(:), intent(in) :: & + integer, dimension(:), intent(in) :: & active, & !< # of active systems per family potential !< # of potential systems per family real(pREAL), dimension(:,:), intent(in) :: & diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 03d945bee..de9518b8c 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -674,6 +674,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) logical :: errmatinv character(len=pSTRLEN):: formatString + mask_stressVector = .not. reshape(transpose(mask_stress), [9]) size_reduced = count(mask_stressVector) if (size_reduced > 0) then @@ -696,6 +697,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) write(formatString, '(i2)') size_reduced formatString = '(/,1x,a,/,'//trim(formatString)//'('//trim(formatString)//'(2x,es9.2,1x)/))' print trim(formatString), 'C * S (load) ', transpose(matmul(c_reduced,s_reduced)) + print trim(formatString), 'C (load) ', transpose(c_reduced) print trim(formatString), 'S (load) ', transpose(s_reduced) if (errmatinv) error stop 'matrix inversion error' end if diff --git a/src/math.f90 b/src/math.f90 index 4122f5170..24141f4e9 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -24,6 +24,12 @@ module math implicit none(type,external) public + + interface math_expand + module procedure math_expand_int + module procedure math_expand_real + end interface math_expand + #if __INTEL_COMPILER >= 1900 ! do not make use of associated entities available to other modules private :: & @@ -136,7 +142,7 @@ end subroutine math_init pure recursive subroutine math_sort(a, istart, iend, sortDim) integer, dimension(:,:), intent(inout) :: a - integer, intent(in),optional :: istart,iend, sortDim + integer, optional, intent(in) :: istart,iend, sortDim integer :: ipivot,s,e,d @@ -199,11 +205,11 @@ end subroutine math_sort !> @details takes a set of numbers (a,b,c,...) and corresponding multiples (x,y,z,...) !> to return a vector of x times a, y times b, z times c, ... !-------------------------------------------------------------------------------------------------- -pure function math_expand(what,how) +pure function math_expand_int(what,how) - real(pREAL), dimension(:), intent(in) :: what - integer, dimension(:), intent(in) :: how - real(pREAL), dimension(sum(how)) :: math_expand + integer, dimension(:), intent(in) :: what + integer, dimension(:), intent(in) :: how + integer, dimension(sum(how)) :: math_expand_int integer :: i @@ -211,10 +217,33 @@ pure function math_expand(what,how) if (sum(how) == 0) return do i = 1, size(how) - math_expand(sum(how(1:i-1))+1:sum(how(1:i))) = what(mod(i-1,size(what))+1) + math_expand_int(sum(how(1:i-1))+1:sum(how(1:i))) = what(mod(i-1,size(what))+1) end do -end function math_expand +end function math_expand_int + + +!-------------------------------------------------------------------------------------------------- +!> @brief vector expansion +!> @details takes a set of numbers (a,b,c,...) and corresponding multiples (x,y,z,...) +!> to return a vector of x times a, y times b, z times c, ... +!-------------------------------------------------------------------------------------------------- +pure function math_expand_real(what,how) + + real(pREAL), dimension(:), intent(in) :: what + integer, dimension(:), intent(in) :: how + real(pREAL), dimension(sum(how)) :: math_expand_real + + integer :: i + + + if (sum(how) == 0) return + + do i = 1, size(how) + math_expand_real(sum(how(1:i-1))+1:sum(how(1:i))) = what(mod(i-1,size(what))+1) + end do + +end function math_expand_real !-------------------------------------------------------------------------------------------------- @@ -1309,7 +1338,10 @@ subroutine math_selfTest() if (any(abs([1.0_pREAL,2.0_pREAL,2.0_pREAL,1.0_pREAL,1.0_pREAL,1.0_pREAL] - & math_expand([1.0_pREAL,2.0_pREAL],[1,2,3])) > tol_math_check)) & - error stop 'math_expand [1,2] by [1,2,3] => [1,2,2,1,1,1]' + error stop 'math_expand_real [1,2] by [1,2,3] => [1,2,2,1,1,1]' + + if (any(abs([1,2,2,1,1,1] - math_expand([1,2],[1,2,3])) /= 0)) & + error stop 'math_expand_int [1,2] by [1,2,3] => [1,2,2,1,1,1]' call math_sort(sort_in_,1,3,2) if (any(sort_in_ /= sort_out_)) & From a2b571c1fc8f0148087de6ed141801d069d542c0 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 14 Sep 2023 16:45:24 -0400 Subject: [PATCH 155/198] corrected sign definition of <111>{110} slip systems Breaking change: Sign of shear differs --- PRIVATE | 2 +- python/damask/_crystal.py | 196 +++++++++--------- .../tests/resources/Orientation/cI_slip.txt | 24 +-- python/tests/test_Orientation.py | 7 +- src/crystal.f90 | 17 +- 5 files changed, 123 insertions(+), 123 deletions(-) diff --git a/PRIVATE b/PRIVATE index 9623d3d50..b13ed2628 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 9623d3d50e11a086e456b7fddc25fae67266911d +Subproject commit b13ed2628e2ece45bcf433ce88483759b02c946e diff --git a/python/damask/_crystal.py b/python/damask/_crystal.py index adcaf610e..b2fb4edd7 100644 --- a/python/damask/_crystal.py +++ b/python/damask/_crystal.py @@ -785,25 +785,25 @@ class Crystal(): _kinematics: Dict[BravaisLattice, Dict[CrystalKinematics, List[np.ndarray]]] = { 'cF': { 'slip': [np.array([ - [+0,+1,-1, +1,+1,+1], - [-1,+0,+1, +1,+1,+1], - [+1,-1,+0, +1,+1,+1], - [+0,-1,-1, -1,-1,+1], - [+1,+0,+1, -1,-1,+1], - [-1,+1,+0, -1,-1,+1], - [+0,-1,+1, +1,-1,-1], - [-1,+0,-1, +1,-1,-1], - [+1,+1,+0, +1,-1,-1], - [+0,+1,+1, -1,+1,-1], - [+1,+0,-1, -1,+1,-1], - [-1,-1,+0, -1,+1,-1]]), + [ 0,+1,-1, +1,+1,+1], + [-1, 0,+1, +1,+1,+1], + [+1,-1, 0, +1,+1,+1], + [ 0,-1,-1, -1,-1,+1], + [+1, 0,+1, -1,-1,+1], + [-1,+1, 0, -1,-1,+1], + [ 0,-1,+1, +1,-1,-1], + [-1, 0,-1, +1,-1,-1], + [+1,+1, 0, +1,-1,-1], + [ 0,+1,+1, -1,+1,-1], + [+1, 0,-1, -1,+1,-1], + [-1,-1, 0, -1,+1,-1]]), np.array([ - [+1,+1,+0, +1,-1,+0], - [+1,-1,+0, +1,+1,+0], - [+1,+0,+1, +1,+0,-1], - [+1,+0,-1, +1,+0,+1], - [+0,+1,+1, +0,+1,-1], - [+0,+1,-1, +0,+1,+1]])], + [+1,+1, 0, +1,-1, 0], + [+1,-1, 0, +1,+1, 0], + [+1, 0,+1, +1, 0,-1], + [+1, 0,-1, +1, 0,+1], + [ 0,+1,+1, 0,+1,-1], + [ 0,+1,-1, 0,+1,+1]])], 'twin': [np.array([ [-2, 1, 1, 1, 1, 1], [ 1,-2, 1, 1, 1, 1], @@ -820,18 +820,18 @@ class Crystal(): }, 'cI': { 'slip': [np.array([ - [+1,-1,+1, +0,+1,+1], - [-1,-1,+1, +0,+1,+1], - [+1,+1,+1, +0,-1,+1], - [-1,+1,+1, +0,-1,+1], - [-1,+1,+1, +1,+0,+1], - [-1,-1,+1, +1,+0,+1], - [+1,+1,+1, -1,+0,+1], - [+1,-1,+1, -1,+0,+1], - [-1,+1,+1, +1,+1,+0], - [-1,+1,-1, +1,+1,+0], - [+1,+1,+1, -1,+1,+0], - [+1,+1,-1, -1,+1,+0]]), + [+1,-1,+1, 0,+1,+1], + [-1,-1,+1, 0,-1,-1], + [+1,+1,+1, 0,+1,-1], + [-1,+1,+1, 0,-1,+1], + [-1,+1,+1, -1, 0,-1], + [-1,-1,+1, +1, 0,+1], + [+1,+1,+1, -1, 0,+1], + [+1,-1,+1, +1, 0,-1], + [-1,+1,+1, +1,+1, 0], + [+1,-1,+1, -1,-1, 0], + [+1,+1,+1, +1,-1, 0], + [-1,-1,+1, -1,+1, 0]]), np.array([ [-1,+1,+1, +2,+1,+1], [+1,+1,+1, -2,+1,+1], @@ -886,33 +886,33 @@ class Crystal(): }, 'hP': { 'slip': [np.array([ - [+2,-1,-1,+0, +0,+0,+0,+1], - [-1,+2,-1,+0, +0,+0,+0,+1], - [-1,-1,+2,+0, +0,+0,+0,+1]]), + [+2,-1,-1, 0, 0, 0, 0,+1], + [-1,+2,-1, 0, 0, 0, 0,+1], + [-1,-1,+2, 0, 0, 0, 0,+1]]), np.array([ - [+2,-1,-1,+0, +0,+1,-1,+0], - [-1,+2,-1,+0, -1,+0,+1,+0], - [-1,-1,+2,+0, +1,-1,+0,+0]]), + [+2,-1,-1, 0, 0,+1,-1, 0], + [-1,+2,-1, 0, -1, 0,+1, 0], + [-1,-1,+2, 0, +1,-1, 0, 0]]), np.array([ - [-1,+2,-1,+0, +1,+0,-1,+1], - [-2,+1,+1,+0, +0,+1,-1,+1], - [-1,-1,+2,+0, -1,+1,+0,+1], - [+1,-2,+1,+0, -1,+0,+1,+1], - [+2,-1,-1,+0, +0,-1,+1,+1], - [+1,+1,-2,+0, +1,-1,+0,+1]]), + [-1,+2,-1, 0, +1, 0,-1,+1], + [-2,+1,+1, 0, 0,+1,-1,+1], + [-1,-1,+2, 0, -1,+1, 0,+1], + [+1,-2,+1, 0, -1, 0,+1,+1], + [+2,-1,-1, 0, 0,-1,+1,+1], + [+1,+1,-2, 0, +1,-1, 0,+1]]), np.array([ - [-2,+1,+1,+3, +1,+0,-1,+1], - [-1,-1,+2,+3, +1,+0,-1,+1], - [-1,-1,+2,+3, +0,+1,-1,+1], - [+1,-2,+1,+3, +0,+1,-1,+1], - [+1,-2,+1,+3, -1,+1,+0,+1], - [+2,-1,-1,+3, -1,+1,+0,+1], - [+2,-1,-1,+3, -1,+0,+1,+1], - [+1,+1,-2,+3, -1,+0,+1,+1], - [+1,+1,-2,+3, +0,-1,+1,+1], - [-1,+2,-1,+3, +0,-1,+1,+1], - [-1,+2,-1,+3, +1,-1,+0,+1], - [-2,+1,+1,+3, +1,-1,+0,+1]]), + [-2,+1,+1,+3, +1, 0,-1,+1], + [-1,-1,+2,+3, +1, 0,-1,+1], + [-1,-1,+2,+3, 0,+1,-1,+1], + [+1,-2,+1,+3, 0,+1,-1,+1], + [+1,-2,+1,+3, -1,+1, 0,+1], + [+2,-1,-1,+3, -1,+1, 0,+1], + [+2,-1,-1,+3, -1, 0,+1,+1], + [+1,+1,-2,+3, -1, 0,+1,+1], + [+1,+1,-2,+3, 0,-1,+1,+1], + [-1,+2,-1,+3, 0,-1,+1,+1], + [-1,+2,-1,+3, +1,-1, 0,+1], + [-2,+1,+1,+3, +1,-1, 0,+1]]), np.array([ [-1,-1,+2,+3, +1,+1,-2,+2], [+1,-2,+1,+3, -1,+2,-1,+2], @@ -951,61 +951,61 @@ class Crystal(): }, 'tI': { 'slip': [np.array([ - [+0,+0,+1, +1,+0,+0], - [+0,+0,+1, +0,+1,+0]]), + [ 0, 0,+1, +1, 0, 0], + [ 0, 0,+1, 0,+1, 0]]), np.array([ - [+0,+0,+1, +1,+1,+0], - [+0,+0,+1, -1,+1,+0]]), + [ 0, 0,+1, +1,+1, 0], + [ 0, 0,+1, -1,+1, 0]]), np.array([ - [+0,+1,+0, +1,+0,+0], - [+1,+0,+0, +0,+1,+0]]), + [ 0,+1, 0, +1, 0, 0], + [+1, 0, 0, 0,+1, 0]]), np.array([ - [+1,-1,+1, +1,+1,+0], - [+1,-1,-1, +1,+1,+0], - [-1,-1,-1, -1,+1,+0], - [-1,-1,+1, -1,+1,+0]]), + [+1,-1,+1, +1,+1, 0], + [+1,-1,-1, +1,+1, 0], + [-1,-1,-1, -1,+1, 0], + [-1,-1,+1, -1,+1, 0]]), np.array([ - [+1,-1,+0, +1,+1,+0], - [+1,+1,+0, +1,-1,+0]]), + [+1,-1, 0, +1,+1, 0], + [+1,+1, 0, +1,-1, 0]]), np.array([ - [+0,+1,+1, +1,+0,+0], - [+0,-1,+1, +1,+0,+0], - [-1,+0,+1, +0,+1,+0], - [+1,+0,+1, +0,+1,+0]]), + [ 0,+1,+1, +1, 0, 0], + [ 0,-1,+1, +1, 0, 0], + [-1, 0,+1, 0,+1, 0], + [+1, 0,+1, 0,+1, 0]]), np.array([ - [+0,+1,+0, +0,+0,+1], - [+1,+0,+0, +0,+0,+1]]), + [ 0,+1, 0, 0, 0,+1], + [+1, 0, 0, 0, 0,+1]]), np.array([ - [+1,+1,+0, +0,+0,+1], - [-1,+1,+0, +0,+0,+1]]), + [+1,+1, 0, 0, 0,+1], + [-1,+1, 0, 0, 0,+1]]), np.array([ - [+0,+1,-1, +0,+1,+1], - [+0,-1,-1, +0,-1,+1], - [-1,+0,-1, -1,+0,+1], - [+1,+0,-1, +1,+0,+1]]), + [ 0,+1,-1, 0,+1,+1], + [ 0,-1,-1, 0,-1,+1], + [-1, 0,-1, -1, 0,+1], + [+1, 0,-1, +1, 0,+1]]), np.array([ - [+1,-1,+1, +0,+1,+1], - [+1,+1,-1, +0,+1,+1], - [+1,+1,+1, +0,+1,-1], - [-1,+1,+1, +0,+1,-1], - [+1,-1,-1, +1,+0,+1], - [-1,-1,+1, +1,+0,+1], - [+1,+1,+1, +1,+0,-1], - [+1,-1,+1, +1,+0,-1]]), + [+1,-1,+1, 0,+1,+1], + [+1,+1,-1, 0,+1,+1], + [+1,+1,+1, 0,+1,-1], + [-1,+1,+1, 0,+1,-1], + [+1,-1,-1, +1, 0,+1], + [-1,-1,+1, +1, 0,+1], + [+1,+1,+1, +1, 0,-1], + [+1,-1,+1, +1, 0,-1]]), np.array([ - [+1,+0,+0, +0,+1,+1], - [+1,+0,+0, +0,+1,-1], - [+0,+1,+0, +1,+0,+1], - [+0,+1,+0, +1,+0,-1]]), + [+1, 0, 0, 0,+1,+1], + [+1, 0, 0, 0,+1,-1], + [ 0,+1, 0, +1, 0,+1], + [ 0,+1, 0, +1, 0,-1]]), np.array([ - [+0,+1,-1, +2,+1,+1], - [+0,-1,-1, +2,-1,+1], - [+1,+0,-1, +1,+2,+1], - [-1,+0,-1, -1,+2,+1], - [+0,+1,-1, -2,+1,+1], - [+0,-1,-1, -2,-1,+1], - [-1,+0,-1, -1,-2,+1], - [+1,+0,-1, +1,-2,+1]]), + [ 0,+1,-1, +2,+1,+1], + [ 0,-1,-1, +2,-1,+1], + [+1, 0,-1, +1,+2,+1], + [-1, 0,-1, -1,+2,+1], + [ 0,+1,-1, -2,+1,+1], + [ 0,-1,-1, -2,-1,+1], + [-1, 0,-1, -1,-2,+1], + [+1, 0,-1, +1,-2,+1]]), np.array([ [-1,+1,+1, +2,+1,+1], [-1,-1,+1, +2,-1,+1], diff --git a/python/tests/resources/Orientation/cI_slip.txt b/python/tests/resources/Orientation/cI_slip.txt index 0f8db6c21..c4430fcef 100644 --- a/python/tests/resources/Orientation/cI_slip.txt +++ b/python/tests/resources/Orientation/cI_slip.txt @@ -1,23 +1,23 @@ 3x3:1_Schmid 3x3:2_Schmid 3x3:3_Schmid 3x3:4_Schmid 3x3:5_Schmid 3x3:6_Schmid 3x3:7_Schmid 3x3:8_Schmid 3x3:9_Schmid 0.0 0.4082482904638631 0.408248290463863 0.0 -0.408248290463863 -0.40824829046386296 0.0 0.4082482904638631 0.408248290463863 -0.0 -0.408248290463863 -0.40824829046386296 0.0 -0.408248290463863 -0.40824829046386296 0.0 0.4082482904638631 0.408248290463863 -0.0 -0.408248290463863 0.408248290463863 0.0 -0.408248290463863 0.408248290463863 0.0 -0.408248290463863 0.408248290463863 +0.0 0.408248290463863 0.40824829046386296 0.0 0.408248290463863 0.40824829046386296 0.0 -0.4082482904638631 -0.408248290463863 +0.0 0.408248290463863 -0.408248290463863 0.0 0.408248290463863 -0.408248290463863 0.0 0.408248290463863 -0.408248290463863 0.0 0.40824829046386285 -0.40824829046386285 0.0 -0.408248290463863 0.408248290463863 0.0 -0.408248290463863 0.408248290463863 --0.40824829046386296 2.4997998108697434e-17 -0.40824829046386285 0.4082482904638631 -2.4997998108697446e-17 0.408248290463863 0.4082482904638631 -2.4997998108697446e-17 0.408248290463863 +0.40824829046386296 -2.4997998108697434e-17 0.40824829046386285 -0.4082482904638631 2.4997998108697446e-17 -0.408248290463863 -0.4082482904638631 2.4997998108697446e-17 -0.408248290463863 -0.408248290463863 2.499799810869744e-17 -0.40824829046386296 -0.408248290463863 2.499799810869744e-17 -0.40824829046386296 0.4082482904638631 -2.4997998108697446e-17 0.408248290463863 -0.408248290463863 2.499799810869744e-17 0.408248290463863 -0.408248290463863 2.499799810869744e-17 0.408248290463863 -0.408248290463863 2.499799810869744e-17 0.408248290463863 --0.408248290463863 2.499799810869744e-17 0.408248290463863 0.40824829046386296 -2.4997998108697437e-17 -0.40824829046386296 -0.408248290463863 2.499799810869744e-17 0.408248290463863 +0.408248290463863 -2.499799810869744e-17 -0.408248290463863 -0.40824829046386296 2.4997998108697437e-17 0.40824829046386296 0.408248290463863 -2.499799810869744e-17 -0.408248290463863 -0.40824829046386296 -0.40824829046386285 4.999599621739487e-17 0.4082482904638631 0.408248290463863 -4.999599621739489e-17 0.4082482904638631 0.408248290463863 -4.999599621739489e-17 -0.4082482904638631 -0.408248290463863 4.999599621739489e-17 0.408248290463863 0.40824829046386296 -4.999599621739488e-17 -0.4082482904638631 -0.408248290463863 4.999599621739489e-17 --0.408248290463863 0.408248290463863 0.0 -0.408248290463863 0.408248290463863 0.0 -0.408248290463863 0.408248290463863 0.0 --0.40824829046386296 0.40824829046386296 0.0 -0.40824829046386296 0.40824829046386296 0.0 0.408248290463863 -0.408248290463863 0.0 +0.408248290463863 -0.408248290463863 0.0 0.408248290463863 -0.408248290463863 0.0 0.408248290463863 -0.408248290463863 0.0 +0.40824829046386296 -0.40824829046386296 0.0 0.40824829046386296 -0.40824829046386296 0.0 -0.408248290463863 0.408248290463863 0.0 -0.4714045207910316 -0.23570226039551578 -0.23570226039551576 0.4714045207910318 0.23570226039551587 0.23570226039551584 0.4714045207910318 0.23570226039551587 0.23570226039551584 --0.4714045207910318 0.23570226039551595 0.2357022603955159 -0.4714045207910318 0.23570226039551595 0.2357022603955159 -0.4714045207910318 0.23570226039551595 0.2357022603955159 -0.47140452079103173 -0.2357022603955159 0.23570226039551584 0.47140452079103173 -0.2357022603955159 0.23570226039551584 -0.4714045207910318 0.23570226039551595 -0.23570226039551587 +-0.4714045207910318 0.23570226039551595 0.23570226039551595 -0.4714045207910318 0.23570226039551595 0.23570226039551595 -0.4714045207910318 0.23570226039551595 0.23570226039551595 +0.47140452079103173 -0.2357022603955159 0.23570226039551587 0.47140452079103173 -0.2357022603955159 0.23570226039551587 -0.4714045207910318 0.23570226039551595 -0.2357022603955159 0.4714045207910318 0.23570226039551587 -0.23570226039551595 -0.47140452079103173 -0.23570226039551584 0.2357022603955159 0.4714045207910318 0.23570226039551587 -0.23570226039551595 0.2357022603955159 0.4714045207910318 0.23570226039551584 -0.23570226039551587 -0.47140452079103173 -0.23570226039551578 0.2357022603955159 0.4714045207910318 0.23570226039551584 --0.23570226039551587 0.47140452079103173 0.23570226039551587 -0.23570226039551587 0.47140452079103173 0.23570226039551587 0.2357022603955159 -0.4714045207910318 -0.2357022603955159 -0.2357022603955159 -0.4714045207910318 0.23570226039551595 0.2357022603955159 -0.4714045207910318 0.23570226039551595 0.2357022603955159 -0.4714045207910318 0.23570226039551595 +-0.23570226039551587 0.47140452079103173 0.23570226039551584 -0.23570226039551587 0.47140452079103173 0.23570226039551584 0.2357022603955159 -0.4714045207910318 -0.23570226039551587 +0.2357022603955159 -0.4714045207910318 0.2357022603955159 0.2357022603955159 -0.4714045207910318 0.2357022603955159 0.2357022603955159 -0.4714045207910318 0.2357022603955159 -0.2357022603955158 -0.4714045207910316 0.23570226039551584 0.2357022603955159 0.4714045207910318 -0.23570226039551595 0.2357022603955159 0.4714045207910318 -0.23570226039551595 0.23570226039551587 0.23570226039551584 0.47140452079103173 0.23570226039551587 0.23570226039551584 0.47140452079103173 -0.2357022603955159 -0.23570226039551587 -0.4714045207910318 -0.2357022603955159 0.2357022603955159 0.4714045207910318 0.23570226039551587 -0.23570226039551587 -0.47140452079103173 -0.2357022603955159 0.2357022603955159 0.4714045207910318 @@ -36,7 +36,7 @@ -0.30860669992418377 0.1543033499620919 -0.46291004988627565 0.3086066999241839 -0.15430334996209197 0.4629100498862758 0.3086066999241839 -0.15430334996209197 0.4629100498862758 0.3086066999241839 0.1543033499620919 -0.4629100498862758 0.3086066999241839 0.1543033499620919 -0.4629100498862758 0.3086066999241839 0.1543033499620919 -0.4629100498862758 0.3086066999241839 0.4629100498862758 0.15430334996209188 -0.3086066999241838 -0.4629100498862757 -0.15430334996209186 0.3086066999241839 0.4629100498862758 0.15430334996209188 --0.3086066999241838 0.4629100498862757 0.15430334996209188 -0.3086066999241838 0.4629100498862757 0.15430334996209188 0.3086066999241839 -0.4629100498862758 -0.1543033499620919 +-0.3086066999241838 0.4629100498862757 0.1543033499620919 -0.3086066999241838 0.4629100498862757 0.1543033499620919 0.3086066999241839 -0.4629100498862758 -0.15430334996209194 0.3086066999241839 -0.4629100498862758 0.15430334996209194 0.3086066999241839 -0.4629100498862758 0.15430334996209194 0.3086066999241839 -0.4629100498862758 0.15430334996209194 -0.30860669992418377 -0.46291004988627565 0.15430334996209194 0.3086066999241839 0.4629100498862758 -0.154303349962092 0.3086066999241839 0.4629100498862758 -0.154303349962092 -0.46291004988627565 -0.15430334996209186 -0.3086066999241837 0.4629100498862758 0.1543033499620919 0.3086066999241838 0.4629100498862758 0.1543033499620919 0.3086066999241838 @@ -45,5 +45,5 @@ 0.4629100498862758 0.1543033499620919 -0.3086066999241839 -0.4629100498862757 -0.15430334996209188 0.3086066999241838 0.4629100498862758 0.1543033499620919 -0.3086066999241839 -0.46291004988627565 -0.3086066999241837 -0.1543033499620918 0.4629100498862758 0.3086066999241838 0.15430334996209188 0.4629100498862758 0.3086066999241838 0.15430334996209188 -0.4629100498862758 0.3086066999241839 0.15430334996209194 -0.4629100498862758 0.3086066999241839 0.15430334996209194 -0.4629100498862758 0.3086066999241839 0.15430334996209194 -0.4629100498862757 -0.3086066999241838 0.1543033499620919 0.4629100498862757 -0.3086066999241838 0.1543033499620919 -0.4629100498862758 0.3086066999241839 -0.15430334996209194 +0.4629100498862757 -0.3086066999241838 0.15430334996209188 0.4629100498862757 -0.3086066999241838 0.15430334996209188 -0.4629100498862758 0.3086066999241839 -0.1543033499620919 0.4629100498862758 0.3086066999241838 -0.154303349962092 -0.4629100498862757 -0.30860669992418377 0.15430334996209197 0.4629100498862758 0.3086066999241838 -0.154303349962092 diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index a45444908..8346397cc 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -319,9 +319,7 @@ class TestOrientation: eu = o.related(model).as_Euler_angles(degrees=True) if update: coords = np.array([(1,i+1) for i,x in enumerate(eu)]) - Table(eu,{'Eulers':(3,)})\ - .add('pos',coords)\ - .save(reference) + Table({'Eulers':(3,)},eu).set('pos',coords).save(reference) assert np.allclose(eu,Table.load(reference).get('Eulers')) def test_basis_real(self): @@ -369,8 +367,7 @@ class TestOrientation: reference = res_path/f'{lattice}_{mode}.txt' P = O.Schmid(N_slip='*') if mode == 'slip' else O.Schmid(N_twin='*') if update: - table = Table(P.reshape(-1,9),{'Schmid':(3,3,)}) - table.save(reference) + Table({'Schmid':(3,3,)},P.reshape(-1,9)).save(reference) assert np.allclose(P,Table.load(reference).get('Schmid')) def test_Schmid_invalid(self): diff --git a/src/crystal.f90 b/src/crystal.f90 index 437e45227..9fa19f04a 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -123,18 +123,21 @@ module crystal real(pREAL), dimension(3+3,CI_NSLIP), parameter :: & CI_SYSTEMSLIP = reshape(real([& ! <111>{110} systems + ! Sign convention follows Table 1 of 10.1016/j.ijplas.2020.102733 + ! to allow for universal calculation of non-glide plane normal n1 = Rot(-m,60°) @ n + ! The choice matters since Rot(-m,60°) @ n ≠ Rot(m,60°) @ -n ..! 1,-1, 1, 0, 1, 1, & - -1,-1, 1, 0, 1, 1, & - 1, 1, 1, 0,-1, 1, & + -1,-1, 1, 0,-1,-1, & + 1, 1, 1, 0, 1,-1, & -1, 1, 1, 0,-1, 1, & - -1, 1, 1, 1, 0, 1, & + -1, 1, 1, -1, 0,-1, & -1,-1, 1, 1, 0, 1, & 1, 1, 1, -1, 0, 1, & - 1,-1, 1, -1, 0, 1, & + 1,-1, 1, 1, 0,-1, & -1, 1, 1, 1, 1, 0, & - -1, 1,-1, 1, 1, 0, & - 1, 1, 1, -1, 1, 0, & - 1, 1,-1, -1, 1, 0, & + 1,-1, 1, -1,-1, 0, & + 1, 1, 1, 1,-1, 0, & + -1,-1, 1, -1, 1, 0, & ! <111>{112} systems -1, 1, 1, 2, 1, 1, & 1, 1, 1, -2, 1, 1, & From 4de21b5f8692f3c27b3d1dc100104040728dbcf4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Sep 2023 00:06:00 +0200 Subject: [PATCH 156/198] more systematic name --- PRIVATE | 2 +- examples/config/phase/mechanical/plastic/dislotungsten_W.yaml | 2 +- src/phase_mechanical_plastic_dislotungsten.f90 | 2 +- src/phase_mechanical_plastic_kinehardening.f90 | 2 +- src/phase_mechanical_plastic_nonlocal.f90 | 2 +- src/phase_mechanical_plastic_phenopowerlaw.f90 | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PRIVATE b/PRIVATE index b13ed2628..ed4e161d4 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit b13ed2628e2ece45bcf433ce88483759b02c946e +Subproject commit ed4e161d4302852a31c59a1d1d9b11d49f1a5427 diff --git a/examples/config/phase/mechanical/plastic/dislotungsten_W.yaml b/examples/config/phase/mechanical/plastic/dislotungsten_W.yaml index 42aebec22..d20e82413 100644 --- a/examples/config/phase/mechanical/plastic/dislotungsten_W.yaml +++ b/examples/config/phase/mechanical/plastic/dislotungsten_W.yaml @@ -26,7 +26,7 @@ h_sl-sl: [0.009, 0.72, 0.009, 0.05, 0.05, 0.06, 0.09] w: [2.992e-09] # 11b # values in Cereceda et al. are high, using parameters from Gröger et al. -a_nonSchmid: [0.0, 0.56, 0.75] # Tab. 2 +a_nonSchmid_110: [0.0, 0.56, 0.75] # Tab. 2 # (almost) no annhilation, adjustment needed for simulations beyond the yield point i_sl: [1] # c, eq. (25) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index a3567efe4..b11d9e95b 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -153,7 +153,7 @@ module function plastic_dislotungsten_init() result(myPlasticity) 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) + a = pl%get_as1dReal('a_nonSchmid_110',defaultVal = emptyRealArray) prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) else diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 81fa188c8..9ecbde9c0 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -144,7 +144,7 @@ module function plastic_kinehardening_init() result(myPlasticity) 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) + a = pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray) prm%nonSchmidActive = size(a) > 0 prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index e90dcae3c..28107f54e 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -253,7 +253,7 @@ module function plastic_nonlocal_init() result(myPlasticity) 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) + a = pl%get_as1dReal('a_nonSchmid_110',defaultVal = emptyRealArray) if (size(a) > 0) prm%nonSchmidActive = .true. prm%P_nS_pos = crystal_nonSchmidMatrix(ini%N_sl,a,+1) prm%P_nS_neg = crystal_nonSchmidMatrix(ini%N_sl,a,-1) diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 4091e0f76..00f072780 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -160,7 +160,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) 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) + a = pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray) if (size(a) > 0) prm%nonSchmidActive = .true. prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) From 2a88285088385d977345b5e3088ed4314635fa0c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 15 Sep 2023 10:50:41 -0400 Subject: [PATCH 157/198] adapted phenopowerlaw --- PRIVATE | 2 +- src/crystal.f90 | 48 ++++++-- ...phase_mechanical_plastic_phenopowerlaw.f90 | 115 +++++++----------- 3 files changed, 88 insertions(+), 77 deletions(-) diff --git a/PRIVATE b/PRIVATE index ed4e161d4..b4a2af3be 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit ed4e161d4302852a31c59a1d1d9b11d49f1a5427 +Subproject commit b4a2af3be9551e267a10554b1692a81b935882fd diff --git a/src/crystal.f90 b/src/crystal.f90 index 9fa19f04a..4688bdb1d 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -1395,17 +1395,26 @@ end function crystal_interaction_TwinBySlip !-------------------------------------------------------------------------------------------------- !> @brief Schmid matrix for slip !> details only active slip systems are considered +! Non-schmid projections for cI with up to 6 coefficients +! 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 crystal_SchmidMatrix_slip(Nslip,lattice,cOverA) result(SchmidMatrix) +function crystal_SchmidMatrix_slip(Nslip,lattice,cOverA,nonSchmidCoefficients,sense) result(SchmidMatrix) - integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family - character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) - real(pREAL), intent(in) :: cOverA - real(pREAL), dimension(3,3,sum(Nslip)) :: SchmidMatrix + integer, dimension(:), intent(in) :: Nslip !< number of active slip systems per family + character(len=*), intent(in) :: lattice !< Bravais lattice (Pearson symbol) + real(pREAL), intent(in) :: cOverA + real(pREAL), dimension(:,:), optional, intent(in) :: nonSchmidCoefficients !< non-Schmid coefficients for projections + integer, optional, intent(in) :: sense !< sense (-1,+1) + real(pREAL), dimension(3,3,sum(Nslip)) :: SchmidMatrix real(pREAL), dimension(3,3,sum(Nslip)) :: coordinateSystem real(pREAL), dimension(:,:), allocatable :: slipSystems integer, dimension(:), allocatable :: NslipMax + integer, dimension(:), allocatable :: slipFamily + real(pREAL), dimension(3) :: direction, normal, np + real(pREAL), dimension(:), allocatable :: coeff + type(tRotation) :: R integer :: i select case(lattice) @@ -1431,12 +1440,37 @@ function crystal_SchmidMatrix_slip(Nslip,lattice,cOverA) result(SchmidMatrix) if (any(Nslip < 0)) & call IO_error(144,ext_msg='Nslip '//trim(lattice)) + slipFamily = math_expand([(i, i=1,size(Nslip))],Nslip) coordinateSystem = buildCoordinateSystem(Nslip,NslipMax,slipSystems,lattice,cOverA) + if (present(sense)) then + if (abs(sense) /= 1) error stop 'neither +1 nor -1 sense in crystal_SchmidMatrix_slip' + coordinateSystem(1:3,1,1:sum(Nslip)) = coordinateSystem(1:3,1,1:sum(Nslip)) * real(sense,pREAL) + end if - do i = 1, sum(Nslip) - SchmidMatrix(1:3,1:3,i) = math_outer(coordinateSystem(1:3,1,i),coordinateSystem(1:3,2,i)) + do i = 1,sum(Nslip) + direction = coordinateSystem(1:3,1,i) + normal = coordinateSystem(1:3,2,i) + + SchmidMatrix(1:3,1:3,i) = math_outer(direction,normal) if (abs(math_trace33(SchmidMatrix(1:3,1:3,i))) > tol_math_check) & error stop 'dilatational Schmid matrix for slip' + + if (present(nonSchmidCoefficients)) then + select case(lattice) + case('cI') + coeff = nonSchmidCoefficients(slipFamily(i),:) + call R%fromAxisAngle([direction,60.0_pREAL],degrees=.true.,P=1) + np = R%rotate(normal) + SchmidMatrix(1:3,1:3,i) = SchmidMatrix(1:3,1:3,i) & + + coeff(1) * math_outer(direction, np) & + + coeff(2) * math_outer(math_cross(normal, direction), normal) & + + coeff(3) * math_outer(math_cross(np, direction), np) & + + coeff(4) * math_outer(normal, normal) & + + coeff(5) * math_outer(math_cross(normal, direction), & + math_cross(normal, direction)) & + + coeff(6) * math_outer(direction, direction) + end select + end if end do end function crystal_SchmidMatrix_slip diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 00f072780..045e9d60e 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -36,8 +36,6 @@ submodule(phase:plastic) phenopowerlaw integer :: & sum_N_sl, & !< total number of active slip system sum_N_tw !< total number of active twin systems - logical :: & - nonSchmidActive = .false. character(len=pSTRLEN), allocatable, dimension(:) :: & output character(len=:), allocatable, dimension(:) :: & @@ -89,8 +87,9 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) real(pREAL), dimension(:), allocatable :: & xi_0_sl, & !< initial critical shear stress for slip xi_0_tw, & !< initial critical shear stress for twin - a, & !< non-Schmid coefficients ones + real(pREAL), dimension(:,:), allocatable :: & + a_nS !< non-Schmid coefficients character(len=:), allocatable :: & refs, & extmsg @@ -105,7 +104,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) if (count(myPlasticity) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:plastic:phenopowerlaw init -+>>>' - print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) + print'(/,a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') @@ -124,7 +123,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) + print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) refs = config_listReferences(pl,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs @@ -160,13 +159,13 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) 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_110',defaultVal=emptyRealArray) - if (size(a) > 0) prm%nonSchmidActive = .true. - prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) - prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) + allocate(a_nS(3,size(pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray))),source=0.0_pREAL) + a_nS(1,:) = pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray) + prm%P_nS_pos = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph),nonSchmidCoefficients=a_nS,sense=+1) + prm%P_nS_neg = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph),nonSchmidCoefficients=a_nS,sense=-1) else - prm%P_nS_pos = prm%P_sl - prm%P_nS_neg = prm%P_sl + prm%P_nS_pos = +prm%P_sl + prm%P_nS_neg = -prm%P_sl end if prm%systems_sl = crystal_labels_slip(N_sl,phase_lattice(ph)) @@ -312,8 +311,7 @@ pure module subroutine phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) integer :: & i,k,l,m,n real(pREAL), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_sl_pos,dot_gamma_sl_neg, & - ddot_gamma_dtau_sl_pos,ddot_gamma_dtau_sl_neg + dot_gamma_sl,ddot_gamma_dtau_sl real(pREAL), dimension(param(ph)%sum_N_tw) :: & dot_gamma_tw,ddot_gamma_dtau_tw @@ -322,13 +320,14 @@ pure module subroutine phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) associate(prm => param(ph)) - call kinetics_sl(Mp,ph,en,dot_gamma_sl_pos,dot_gamma_sl_neg,ddot_gamma_dtau_sl_pos,ddot_gamma_dtau_sl_neg) + call kinetics_sl(Mp,ph,en,dot_gamma_sl,ddot_gamma_dtau_sl) slipSystems: do i = 1, prm%sum_N_sl - Lp = Lp + (dot_gamma_sl_pos(i)+dot_gamma_sl_neg(i))*prm%P_sl(1:3,1:3,i) + Lp = Lp + dot_gamma_sl(i)*prm%P_sl(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & - + ddot_gamma_dtau_sl_pos(i) * prm%P_sl(k,l,i) * prm%P_nS_pos(m,n,i) & - + ddot_gamma_dtau_sl_neg(i) * prm%P_sl(k,l,i) * prm%P_nS_neg(m,n,i) + + ddot_gamma_dtau_sl(i) * prm%P_sl(k,l,i) & + * merge(prm%P_nS_pos(m,n,i), & + prm%P_nS_neg(m,n,i), dot_gamma_sl(i)>0.0_pREAL) end do slipSystems call kinetics_tw(Mp,ph,en,dot_gamma_tw,ddot_gamma_dtau_tw) @@ -370,23 +369,23 @@ module function phenopowerlaw_dotState(Mp,ph,en) result(dotState) dot_gamma_sl => dotState(indexDotState(ph)%gamma_sl(1):indexDotState(ph)%gamma_sl(2)), & dot_gamma_tw => dotState(indexDotState(ph)%gamma_tw(1):indexDotState(ph)%gamma_tw(2))) - call kinetics_sl(Mp,ph,en, dot_gamma_sl_pos,dot_gamma_sl_neg) - dot_gamma_sl = abs(dot_gamma_sl_pos+dot_gamma_sl_neg) + call kinetics_sl(Mp,ph,en, dot_gamma_sl) call kinetics_tw(Mp,ph,en, dot_gamma_tw) + dot_gamma_sl = abs(dot_gamma_sl) sumF = sum(stt%gamma_tw(:,en)/prm%gamma_char) xi_sl_sat_offset = prm%f_sat_sl_tw*sqrt(sumF) - left_SlipSlip = sign(abs(1.0_pREAL-stt%xi_sl(:,en) / (prm%xi_inf_sl+xi_sl_sat_offset))**prm%a_sl, & - 1.0_pREAL-stt%xi_sl(:,en) / (prm%xi_inf_sl+xi_sl_sat_offset)) + left_SlipSlip = sign(abs(1.0_pREAL - stt%xi_sl(:,en) / (prm%xi_inf_sl+xi_sl_sat_offset))**prm%a_sl, & + 1.0_pREAL - stt%xi_sl(:,en) / (prm%xi_inf_sl+xi_sl_sat_offset)) dot_xi_sl = prm%h_0_sl_sl * (1.0_pREAL + prm%c_1 * sumF**prm%c_2) & - * left_SlipSlip * matmul(prm%h_sl_sl,dot_gamma_sl) & + * left_SlipSlip & + * matmul(prm%h_sl_sl,dot_gamma_sl) & + matmul(prm%h_sl_tw,dot_gamma_tw) - dot_xi_tw = prm%h_0_tw_sl * sum(stt%gamma_sl(:,en))**prm%c_3 & - * matmul(prm%h_tw_sl,dot_gamma_sl) & - + prm%h_0_tw_tw * sumF**prm%c_4 * matmul(prm%h_tw_tw,dot_gamma_tw) + dot_xi_tw = prm%h_0_tw_sl * sum(stt%gamma_sl(:,en))**prm%c_3 * matmul(prm%h_tw_sl,dot_gamma_sl) & + + prm%h_0_tw_tw * sumF **prm%c_4 * matmul(prm%h_tw_tw,dot_gamma_tw) end associate @@ -436,25 +435,23 @@ end subroutine plastic_phenopowerlaw_result !-------------------------------------------------------------------------------------------------- !> @brief Calculate shear rates on slip systems and their derivatives with respect to resolved ! stress. -!> @details Derivatives are calculated only optionally. -! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put -! at the end since some of them are optional. +!> @details Sign of dot_gamma_sl conveys sense of shear. +! Derivatives are calculated only optionally, hence, contrary to common convention, +! here the result (i.e. intent(out)) variables have to be put at the end. !-------------------------------------------------------------------------------------------------- pure subroutine kinetics_sl(Mp,ph,en, & - dot_gamma_sl_pos,dot_gamma_sl_neg,ddot_gamma_dtau_sl_pos,ddot_gamma_dtau_sl_neg) + dot_gamma_sl,ddot_gamma_dtau_sl) - real(pREAL), dimension(3,3), intent(in) :: & + real(pREAL), dimension(3,3), intent(in) :: & Mp !< Mandel stress - integer, intent(in) :: & + integer, intent(in) :: & ph, & en - real(pREAL), intent(out), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_sl_pos, & - dot_gamma_sl_neg - real(pREAL), intent(out), optional, dimension(param(ph)%sum_N_sl) :: & - ddot_gamma_dtau_sl_pos, & - ddot_gamma_dtau_sl_neg + real(pREAL), dimension(param(ph)%sum_N_sl), intent(out) :: & + dot_gamma_sl + real(pREAL), dimension(param(ph)%sum_N_sl), optional, intent(out) :: & + ddot_gamma_dtau_sl real(pREAL), dimension(param(ph)%sum_N_sl) :: & tau_sl_pos, & @@ -463,38 +460,18 @@ pure subroutine kinetics_sl(Mp,ph,en, & associate(prm => param(ph), stt => state(ph)) - do i = 1, prm%sum_N_sl - tau_sl_pos(i) = math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,i)) - tau_sl_neg(i) = merge(math_tensordot(Mp,prm%P_nS_neg(1:3,1:3,i)), & - 0.0_pREAL, prm%nonSchmidActive) - end do + tau_sl_pos = [(math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,i)),i=1,prm%sum_N_sl)] + tau_sl_neg = [(math_tensordot(Mp,prm%P_nS_neg(1:3,1:3,i)),i=1,prm%sum_N_sl)] - where(dNeq0(tau_sl_pos)) - dot_gamma_sl_pos = prm%dot_gamma_0_sl * merge(0.5_pREAL,1.0_pREAL, prm%nonSchmidActive) & ! 1/2 if non-Schmid active - * sign(abs(tau_sl_pos/stt%xi_sl(:,en))**prm%n_sl, tau_sl_pos) - else where - dot_gamma_sl_pos = 0.0_pREAL - end where + dot_gamma_sl = merge(+1.0_pREAL,-1.0_pREAL, tau_sl_pos>tau_sl_neg) & + * prm%dot_gamma_0_sl & + * (merge(tau_sl_pos,tau_sl_neg, tau_sl_pos>tau_sl_neg)/stt%xi_sl(:,en))**prm%n_sl - where(dNeq0(tau_sl_neg)) - dot_gamma_sl_neg = prm%dot_gamma_0_sl * 0.5_pREAL & ! only used if non-Schmid active, always 1/2 - * sign(abs(tau_sl_neg/stt%xi_sl(:,en))**prm%n_sl, tau_sl_neg) - else where - dot_gamma_sl_neg = 0.0_pREAL - end where - - if (present(ddot_gamma_dtau_sl_pos)) then - where(dNeq0(dot_gamma_sl_pos)) - ddot_gamma_dtau_sl_pos = dot_gamma_sl_pos*prm%n_sl/tau_sl_pos + if (present(ddot_gamma_dtau_sl)) then + where(dNeq0(dot_gamma_sl)) + ddot_gamma_dtau_sl = dot_gamma_sl*prm%n_sl/merge(tau_sl_pos,tau_sl_neg, tau_sl_pos>tau_sl_neg) else where - ddot_gamma_dtau_sl_pos = 0.0_pREAL - end where - end if - if (present(ddot_gamma_dtau_sl_neg)) then - where(dNeq0(dot_gamma_sl_neg)) - ddot_gamma_dtau_sl_neg = dot_gamma_sl_neg*prm%n_sl/tau_sl_neg - else where - ddot_gamma_dtau_sl_neg = 0.0_pREAL + ddot_gamma_dtau_sl = 0.0_pREAL end where end if @@ -504,8 +481,8 @@ end subroutine kinetics_sl !-------------------------------------------------------------------------------------------------- -!> @brief Calculate shear rates on twin systems and their derivatives with respect to resolved -! stress. Twinning is assumed to take place only in an untwinned volume. +!> @brief Calculate shear rates on twin systems and their derivatives with respect to resolved stress. +! Twinning is assumed to take place only in an untwinned volume. !> @details Derivatives are calculated and returned if corresponding output variables are present in the argument list. ! NOTE: Contrary to common convention, here the result (i.e. intent(out)) variables have to be put ! at the end since some of them are optional. @@ -535,7 +512,7 @@ pure subroutine kinetics_tw(Mp,ph,en,& where(tau_tw > 0.0_pREAL) dot_gamma_tw = (1.0_pREAL-sum(stt%gamma_tw(:,en)/prm%gamma_char)) & ! only twin in untwinned volume fraction - * prm%dot_gamma_0_tw*(abs(tau_tw)/stt%xi_tw(:,en))**prm%n_tw + * prm%dot_gamma_0_tw*(tau_tw/stt%xi_tw(:,en))**prm%n_tw else where dot_gamma_tw = 0.0_pREAL end where From 7ac552ee49855372131b6903e39b59ced2911689 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 15 Sep 2023 11:13:58 -0400 Subject: [PATCH 158/198] adapted kinehardening --- ...phase_mechanical_plastic_kinehardening.f90 | 108 +++++++----------- ...phase_mechanical_plastic_phenopowerlaw.f90 | 4 +- 2 files changed, 44 insertions(+), 68 deletions(-) diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 9ecbde9c0..1f370db56 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -29,8 +29,6 @@ submodule(phase:plastic) kinehardening P_nS_neg integer :: & sum_N_sl - logical :: & - nonSchmidActive = .false. character(len=pSTRLEN), allocatable, dimension(:) :: & output character(len=:), allocatable, dimension(:) :: & @@ -83,9 +81,10 @@ module function plastic_kinehardening_init() result(myPlasticity) integer, dimension(:), allocatable :: & N_sl real(pREAL), dimension(:), allocatable :: & - xi_0, & !< initial forest stress + xi_0 !< initial forest stress !! τ_for,0 - a !< non-Schmid coefficients + real(pREAL), dimension(:,:), allocatable :: & + a_nS !< non-Schmid coefficients character(len=:), allocatable :: & refs, & extmsg @@ -144,13 +143,13 @@ module function plastic_kinehardening_init() result(myPlasticity) 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_110',defaultVal=emptyRealArray) - prm%nonSchmidActive = size(a) > 0 - prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) - prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) + allocate(a_nS(3,size(pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray))),source=0.0_pREAL) + a_nS(1,:) = pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray) + prm%P_nS_pos = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph),nonSchmidCoefficients=a_nS,sense=+1) + prm%P_nS_neg = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph),nonSchmidCoefficients=a_nS,sense=-1) else - prm%P_nS_pos = prm%P - prm%P_nS_neg = prm%P + prm%P_nS_pos = +prm%P + prm%P_nS_neg = -prm%P end if prm%h_sl_sl = crystal_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'), & @@ -256,38 +255,37 @@ end function plastic_kinehardening_init !-------------------------------------------------------------------------------------------------- !> @brief Calculate plastic velocity gradient and its tangent. !-------------------------------------------------------------------------------------------------- -pure module subroutine kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) +pure module subroutine kinehardening_LpAndItsTangent(Lp,dLp_dMp, Mp,ph,en) real(pREAL), dimension(3,3), intent(out) :: & Lp !< plastic velocity gradient real(pREAL), dimension(3,3,3,3), intent(out) :: & dLp_dMp !< derivative of Lp with respect to the Mandel stress - real(pREAL), dimension(3,3), intent(in) :: & + real(pREAL), dimension(3,3), intent(in) :: & Mp !< Mandel stress - integer, intent(in) :: & + integer, intent(in) :: & ph, & en integer :: & i,k,l,m,n real(pREAL), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_pos,dot_gamma_neg, & - ddot_gamma_dtau_pos,ddot_gamma_dtau_neg + dot_gamma, ddot_gamma_dtau Lp = 0.0_pREAL dLp_dMp = 0.0_pREAL associate(prm => param(ph)) - call kinetics(Mp,ph,en, dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg) - + call kinetics(Mp,ph,en, dot_gamma,ddot_gamma_dtau) do i = 1, prm%sum_N_sl - Lp = Lp + (dot_gamma_pos(i)+dot_gamma_neg(i))*prm%P(1:3,1:3,i) + Lp = Lp + dot_gamma(i)*prm%P(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & - + ddot_gamma_dtau_pos(i) * prm%P(k,l,i) * prm%P_nS_pos(m,n,i) & - + ddot_gamma_dtau_neg(i) * prm%P(k,l,i) * prm%P_nS_neg(m,n,i) + + ddot_gamma_dtau(i) * prm%P(k,l,i) & + * merge(prm%P_nS_pos(m,n,i), & + prm%P_nS_neg(m,n,i), dot_gamma(i)>0.0_pREAL) end do end associate @@ -311,7 +309,7 @@ module function plastic_kinehardening_dotState(Mp,ph,en) result(dotState) real(pREAL) :: & sumGamma real(pREAL), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_pos,dot_gamma_neg + dot_gamma associate(prm => param(ph), stt => state(ph), & @@ -319,9 +317,9 @@ module function plastic_kinehardening_dotState(Mp,ph,en) result(dotState) dot_chi => dotState(IndexDotState(ph)%chi(1):IndexDotState(ph)%chi(2)),& dot_gamma => dotState(IndexDotState(ph)%gamma(1):IndexDotState(ph)%gamma(2))) - call kinetics(Mp,ph,en, dot_gamma_pos,dot_gamma_neg) - dot_gamma = abs(dot_gamma_pos+dot_gamma_neg) + call kinetics(Mp,ph,en, dot_gamma) sumGamma = sum(stt%gamma(:,en)) + dot_gamma = abs(dot_gamma) dot_xi = matmul(prm%h_sl_sl,dot_gamma) & @@ -338,6 +336,7 @@ module function plastic_kinehardening_dotState(Mp,ph,en) result(dotState) * exp(-(stt%gamma(:,en)-stt%gamma_flip(:,en))*prm%h_0_chi/(prm%chi_inf+stt%chi_flip(:,en))) & ) + end associate end function plastic_kinehardening_dotState @@ -355,16 +354,16 @@ module subroutine plastic_kinehardening_deltaState(Mp,ph,en) en real(pREAL), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_pos,dot_gamma_neg, & + dot_gamma, & sgn_gamma associate(prm => param(ph), stt => state(ph), dlt => deltaState(ph)) - call kinetics(Mp,ph,en, dot_gamma_pos,dot_gamma_neg) + call kinetics(Mp,ph,en, dot_gamma) sgn_gamma = merge(state(ph)%sgn_gamma(:,en), & - sign(1.0_pREAL,dot_gamma_pos+dot_gamma_neg), & - dEq0(dot_gamma_pos+dot_gamma_neg,1e-10_pREAL)) + sign(1.0_pREAL,dot_gamma), & + dEq0(dot_gamma,1e-10_pREAL)) where(dNeq(sgn_gamma,stt%sgn_gamma(:,en),0.1_pREAL)) ! ToDo sgn_gamma*stt%sgn_gamma(:,en)<0 dlt%sgn_gamma (:,en) = sgn_gamma - stt%sgn_gamma (:,en) @@ -433,61 +432,38 @@ end subroutine plastic_kinehardening_result ! at the end since some of them are optional. !-------------------------------------------------------------------------------------------------- pure subroutine kinetics(Mp,ph,en, & - dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg) + dot_gamma,ddot_gamma_dtau) - real(pREAL), dimension(3,3), intent(in) :: & + real(pREAL), dimension(3,3), intent(in) :: & Mp !< Mandel stress - integer, intent(in) :: & + integer, intent(in) :: & ph, & en - real(pREAL), intent(out), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_pos, & - dot_gamma_neg - real(pREAL), intent(out), dimension(param(ph)%sum_N_sl), optional :: & - ddot_gamma_dtau_pos, & - ddot_gamma_dtau_neg + real(pREAL), dimension(param(ph)%sum_N_sl), intent(out) :: & + dot_gamma + real(pREAL), dimension(param(ph)%sum_N_sl), optional, intent(out) :: & + ddot_gamma_dtau real(pREAL), dimension(param(ph)%sum_N_sl) :: & tau_pos, & tau_neg integer :: i - associate(prm => param(ph), stt => state(ph)) - do i = 1, prm%sum_N_sl - tau_pos(i) = math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,i)) - stt%chi(i,en) - tau_neg(i) = merge(math_tensordot(Mp,prm%P_nS_neg(1:3,1:3,i)) - stt%chi(i,en), & - 0.0_pREAL, prm%nonSchmidActive) - end do + tau_pos = [(math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,i)) - stt%chi(i,en),i=1,prm%sum_N_sl)] + tau_neg = [(math_tensordot(Mp,prm%P_nS_neg(1:3,1:3,i)) + stt%chi(i,en),i=1,prm%sum_N_sl)] - where(dNeq0(tau_pos)) - dot_gamma_pos = prm%dot_gamma_0 * merge(0.5_pREAL,1.0_pREAL, prm%nonSchmidActive) & ! 1/2 if non-Schmid active - * sign(abs(tau_pos/stt%xi(:,en))**prm%n, tau_pos) - else where - dot_gamma_pos = 0.0_pREAL - end where + dot_gamma = merge(+1.0_pREAL,-1.0_pREAL, tau_pos>tau_neg) & + * prm%dot_gamma_0 & + * (merge(tau_pos,tau_neg, tau_pos>tau_neg)/stt%xi(:,en))**prm%n - where(dNeq0(tau_neg)) - dot_gamma_neg = prm%dot_gamma_0 * 0.5_pREAL & ! only used if non-Schmid active, always 1/2 - * sign(abs(tau_neg/stt%xi(:,en))**prm%n, tau_neg) - else where - dot_gamma_neg = 0.0_pREAL - end where - - if (present(ddot_gamma_dtau_pos)) then - where(dNeq0(dot_gamma_pos)) - ddot_gamma_dtau_pos = dot_gamma_pos*prm%n/tau_pos + if (present(ddot_gamma_dtau)) then + where(dNeq0(dot_gamma)) + ddot_gamma_dtau = dot_gamma*prm%n/merge(tau_pos,tau_neg, tau_pos>tau_neg) else where - ddot_gamma_dtau_pos = 0.0_pREAL - end where - end if - if (present(ddot_gamma_dtau_neg)) then - where(dNeq0(dot_gamma_neg)) - ddot_gamma_dtau_neg = dot_gamma_neg*prm%n/tau_neg - else where - ddot_gamma_dtau_neg = 0.0_pREAL + ddot_gamma_dtau = 0.0_pREAL end where end if diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 045e9d60e..450bf6f6b 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -104,7 +104,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) if (count(myPlasticity) == 0) return print'(/,1x,a)', '<<<+- phase:mechanical:plastic:phenopowerlaw init -+>>>' - print'(/,a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') @@ -123,7 +123,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) refs = config_listReferences(pl,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs From 715bc1bb832e2829a6f32cdcae6e4860aa72607d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 15 Sep 2023 12:56:27 -0400 Subject: [PATCH 159/198] adapted nonlocal --- src/phase_mechanical_plastic_nonlocal.f90 | 55 ++++++++++------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 28107f54e..545dec4e6 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -116,8 +116,7 @@ submodule(phase:plastic) nonlocal character(len=pSTRLEN), dimension(:), allocatable :: & output logical :: & - shortRangeStressCorrection, & !< use of short range stress correction by excess density gradient term - nonSchmidActive = .false. + shortRangeStressCorrection !< use of short range stress correction by excess density gradient term character(len=:), allocatable, dimension(:) :: & systems_sl end type tParameters @@ -125,7 +124,7 @@ submodule(phase:plastic) nonlocal type :: tNonlocalDependentState real(pREAL), allocatable, dimension(:,:) :: & tau_pass, & - tau_Back + tau_back real(pREAL), allocatable, dimension(:,:,:,:,:) :: & compatibility end type tNonlocalDependentState @@ -150,10 +149,10 @@ submodule(phase:plastic) nonlocal rho_forest, & gamma, & v, & - v_edg_pos, & - v_edg_neg, & - v_scr_pos, & - v_scr_neg + v_edg_pos, & + v_edg_neg, & + v_scr_pos, & + v_scr_neg end type tNonlocalState type(tNonlocalState), allocatable, dimension(:) :: & @@ -176,14 +175,13 @@ module function plastic_nonlocal_init() result(myPlasticity) logical, dimension(:), allocatable :: myPlasticity integer :: & - Ninstances, & ph, & Nmembers, & sizeState, sizeDotState, sizeDependentState, sizeDeltaState, & s1, s2, & s, t, l - real(pREAL), dimension(:), allocatable :: & - a + real(pREAL), dimension(:,:), allocatable :: & + a_nS !< non-Schmid coefficients character(len=:), allocatable :: & refs, & extmsg @@ -196,8 +194,7 @@ module function plastic_nonlocal_init() result(myPlasticity) pl myPlasticity = plastic_active('nonlocal') - Ninstances = count(myPlasticity) - if (Ninstances == 0) then + if (count(myPlasticity) == 0) then call geometry_plastic_nonlocal_disable() return end if @@ -210,7 +207,7 @@ module function plastic_nonlocal_init() result(myPlasticity) print'(/,1x,a)', 'C. Kords, Dissertation RWTH Aachen, 2014' print'( 1x,a)', 'http://publications.rwth-aachen.de/record/229993' - print'(/,1x,a,1x,i0)', '# phases:',Ninstances; flush(IO_STDOUT) + print'(/,1x,a,1x,i0)', '# phases:',count(myPlasticity); flush(IO_STDOUT) phases => config_material%get_dict('phase') allocate(geom(phases%length)) @@ -253,13 +250,13 @@ module function plastic_nonlocal_init() result(myPlasticity) 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_110',defaultVal = emptyRealArray) - if (size(a) > 0) prm%nonSchmidActive = .true. - prm%P_nS_pos = crystal_nonSchmidMatrix(ini%N_sl,a,+1) - prm%P_nS_neg = crystal_nonSchmidMatrix(ini%N_sl,a,-1) + allocate(a_nS(3,size(pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray))),source=0.0_pREAL) ! anticipating parameters for all three families + a_nS(1,:) = pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray) + prm%P_nS_pos = crystal_SchmidMatrix_slip(ini%N_sl,phase_lattice(ph),phase_cOverA(ph),nonSchmidCoefficients=a_nS,sense=+1) + prm%P_nS_neg = crystal_SchmidMatrix_slip(ini%N_sl,phase_lattice(ph),phase_cOverA(ph),nonSchmidCoefficients=a_nS,sense=-1) else - prm%P_nS_pos = prm%P_sl - prm%P_nS_neg = prm%P_sl + prm%P_nS_pos = +prm%P_sl + prm%P_nS_neg = -prm%P_sl end if prm%h_sl_sl = crystal_interaction_SlipBySlip(ini%N_sl,pl%get_as1dReal('h_sl-sl'), & @@ -801,16 +798,10 @@ module subroutine nonlocal_LpAndItsTangent(Lp,dLp_dMp, & dv_dtauNS(:,2) = dv_dtauNS(:,1) !screws - if (prm%nonSchmidActive) then - do t = 3,4 - call kinetics(v(:,t), dv_dtau(:,t), dv_dtauNS(:,t), & - tau, tauNS(:,t), dst%tau_pass(:,en),2,Temperature, ph) - end do - else - v(:,3:4) = spread(v(:,1),2,2) - dv_dtau(:,3:4) = spread(dv_dtau(:,1),2,2) - dv_dtauNS(:,3:4) = spread(dv_dtauNS(:,1),2,2) - end if + do t = 3,4 + call kinetics(v(:,t), dv_dtau(:,t), dv_dtauNS(:,t), & + tau, tauNS(:,t), dst%tau_pass(:,en),2,Temperature, ph) + end do stt%v(:,en) = pack(v,.true.) @@ -1592,12 +1583,12 @@ pure subroutine kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, tauThreshold, c, T, integer, intent(in) :: & c, & !< dislocation character (1:edge, 2:screw) ph - real(pREAL), intent(in) :: & - T !< T real(pREAL), dimension(param(ph)%sum_N_sl), intent(in) :: & tau, & !< resolved external shear stress (without non Schmid effects) tauNS, & !< resolved external shear stress (including non Schmid effects) tauThreshold !< threshold shear stress + real(pREAL), intent(in) :: & + T !< T real(pREAL), dimension(param(ph)%sum_N_sl), intent(out) :: & v, & !< velocity dv_dtau, & !< velocity derivative with respect to resolved shear stress (without non Schmid contributions) @@ -1634,7 +1625,7 @@ pure subroutine kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, tauThreshold, c, T, !* Peierls contribution tauEff = max(0.0_pREAL, abs(tauNS(s)) - tauThreshold(s)) lambda_P = prm%b_sl(s) - activationVolume_P = prm%w *prm%b_sl(s)**3 + activationVolume_P = prm%w * prm%b_sl(s)**3 criticalStress_P = prm%peierlsStress(s,c) activationEnergy_P = criticalStress_P * activationVolume_P tauRel_P = min(1.0_pREAL, tauEff / criticalStress_P) From 0604e510ec46a36cb70e7c48664758f1da77ae57 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 15 Sep 2023 22:52:14 +0200 Subject: [PATCH 160/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-812-g96699f994 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7fa9afb07..821be3454 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-807-g104efaed5 +3.0.0-alpha7-812-g96699f994 From dd3d5483d60bda04967c5cd6c14b6ae90f783f12 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 15 Sep 2023 21:20:55 -0400 Subject: [PATCH 161/198] adapted dislotungsten; does not converge with large(r) coefficients... --- PRIVATE | 2 +- ...phase_mechanical_plastic_dislotungsten.f90 | 164 +++++++----------- 2 files changed, 64 insertions(+), 102 deletions(-) diff --git a/PRIVATE b/PRIVATE index b4a2af3be..4125c71c1 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit b4a2af3be9551e267a10554b1692a81b935882fd +Subproject commit 4125c71c17a7f876b9766c52f0d7ca7d5e8110a5 diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index b11d9e95b..46c5df02e 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -92,8 +92,9 @@ module function plastic_dislotungsten_init() result(myPlasticity) real(pREAL),dimension(:), allocatable :: & f_edge, & !< edge character fraction of total dislocation density rho_mob_0, & !< initial dislocation density - rho_dip_0, & !< initial dipole density - a !< non-Schmid coefficients + rho_dip_0 !< initial dipole density + real(pREAL), dimension(:,:), allocatable :: & + a_nS !< non-Schmid coefficients character(len=:), allocatable :: & refs, & extmsg @@ -153,12 +154,14 @@ module function plastic_dislotungsten_init() result(myPlasticity) 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_110',defaultVal = emptyRealArray) - prm%P_nS_pos = crystal_nonSchmidMatrix(N_sl,a,+1) - prm%P_nS_neg = crystal_nonSchmidMatrix(N_sl,a,-1) + allocate(a_nS(3,size(pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray)))) + a_nS(1,:) = pl%get_as1dReal('a_nonSchmid_110',defaultVal=emptyRealArray) + prm%P_nS_pos = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph),nonSchmidCoefficients=a_nS,sense=+1) + prm%P_nS_neg = crystal_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph),nonSchmidCoefficients=a_nS,sense=-1) + deallocate(a_nS) else - prm%P_nS_pos = prm%P_sl - prm%P_nS_neg = prm%P_sl + prm%P_nS_pos = +prm%P_sl + prm%P_nS_neg = -prm%P_sl end if prm%dipoleformation = .not. pl%get_asBool('no_dipole_formation', defaultVal=.false.) @@ -280,9 +283,9 @@ pure module subroutine dislotungsten_LpAndItsTangent(Lp,dLp_dMp, & Lp !< plastic velocity gradient real(pREAL), dimension(3,3,3,3), intent(out) :: & dLp_dMp !< derivative of Lp with respect to the Mandel stress - real(pREAL), dimension(3,3), intent(in) :: & + real(pREAL), dimension(3,3), intent(in) :: & Mp !< Mandel stress - integer, intent(in) :: & + integer, intent(in) :: & ph, & en @@ -291,8 +294,7 @@ pure module subroutine dislotungsten_LpAndItsTangent(Lp,dLp_dMp, & real(pREAL) :: & T !< temperature real(pREAL), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_pos,dot_gamma_neg, & - ddot_gamma_dtau_pos,ddot_gamma_dtau_neg + dot_gamma, ddot_gamma_dtau T = thermal_T(ph,en) @@ -301,13 +303,14 @@ pure module subroutine dislotungsten_LpAndItsTangent(Lp,dLp_dMp, & associate(prm => param(ph)) - call kinetics(Mp,T,ph,en,dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg) + call kinetics(Mp,T,ph,en, dot_gamma,ddot_gamma_dtau) do i = 1, prm%sum_N_sl - Lp = Lp + (dot_gamma_pos(i)+dot_gamma_neg(i))*prm%P_sl(1:3,1:3,i) + Lp = Lp + dot_gamma(i)*prm%P_sl(1:3,1:3,i) forall (k=1:3,l=1:3,m=1:3,n=1:3) & dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & - + ddot_gamma_dtau_pos(i) * prm%P_sl(k,l,i) * prm%P_nS_pos(m,n,i) & - + ddot_gamma_dtau_neg(i) * prm%P_sl(k,l,i) * prm%P_nS_neg(m,n,i) + + ddot_gamma_dtau(i) * prm%P_sl(k,l,i) & + * merge(prm%P_nS_pos(m,n,i), & + prm%P_nS_neg(m,n,i), dot_gamma(i)>0.0_pREAL) end do end associate @@ -329,52 +332,50 @@ module function dislotungsten_dotState(Mp,ph,en) result(dotState) dotState real(pREAL), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_pos, dot_gamma_neg,& - tau_pos,& - tau_neg, & + tau_eff, & v_cl, & dot_rho_dip_formation, & dot_rho_dip_climb, & d_hat real(pREAL) :: & - mu, T + mu, nu, T associate(prm => param(ph), stt => state(ph), dst => dependentState(ph), & dot_rho_mob => dotState(indexDotState(ph)%rho_mob(1):indexDotState(ph)%rho_mob(2)), & dot_rho_dip => dotState(indexDotState(ph)%rho_dip(1):indexDotState(ph)%rho_dip(2)), & - dot_gamma_sl => dotState(indexDotState(ph)%gamma_sl(1):indexDotState(ph)%gamma_sl(2))) + dot_gamma => dotState(indexDotState(ph)%gamma_sl(1):indexDotState(ph)%gamma_sl(2))) mu = elastic_mu(ph,en,prm%isotropic_bound) + nu = elastic_nu(ph,en,prm%isotropic_bound) T = thermal_T(ph,en) call kinetics(Mp,T,ph,en,& - dot_gamma_pos,dot_gamma_neg, & - tau_pos_out = tau_pos,tau_neg_out = tau_neg) + dot_gamma, tau = tau_eff) - dot_gamma_sl = abs(dot_gamma_pos+dot_gamma_neg) + dot_gamma = abs(dot_gamma) - where(dEq0((tau_pos+tau_neg)*0.5_pREAL)) + where(dEq0(dot_gamma)) dot_rho_dip_formation = 0.0_pREAL dot_rho_dip_climb = 0.0_pREAL else where - d_hat = math_clip(3.0_pREAL*mu*prm%b_sl/(16.0_pREAL*PI*abs(tau_pos+tau_neg)*0.5_pREAL), & - prm%d_caron, & ! lower limit - dst%Lambda_sl(:,en)) ! upper limit - dot_rho_dip_formation = merge(2.0_pREAL*(d_hat-prm%d_caron)*stt%rho_mob(:,en)*dot_gamma_sl/prm%b_sl, & + d_hat = math_clip(mu*prm%b_sl/(8.0_pREAL*PI*(1.0_pREAL-nu)*tau_eff), & + left = prm%d_caron, & ! lower limit + right = dst%Lambda_sl(:,en)) ! upper limit + dot_rho_dip_formation = merge(dot_gamma * 2.0_pREAL*(d_hat-prm%d_caron)/prm%b_sl * stt%rho_mob(:,en), & 0.0_pREAL, & prm%dipoleformation) - v_cl = (3.0_pREAL*mu*prm%D_0*exp(-prm%Q_cl/(K_B*T))*prm%f_at/(TAU*K_B*T)) & + v_cl = (3.0_pREAL*mu*prm%D_0*exp(-prm%Q_cl/(K_B*T))*prm%f_at/(2.0_pREAL*PI*K_B*T)) & * (1.0_pREAL/(d_hat+prm%d_caron)) dot_rho_dip_climb = (4.0_pREAL*v_cl*stt%rho_dip(:,en))/(d_hat-prm%d_caron) ! ToDo: Discuss with Franz: Stress dependency? end where - dot_rho_mob = dot_gamma_sl/(prm%b_sl*dst%Lambda_sl(:,en)) & ! multiplication - - dot_rho_dip_formation & - - (2.0_pREAL*prm%d_caron)/prm%b_sl*stt%rho_mob(:,en)*dot_gamma_sl ! Spontaneous annihilation of 2 edges + dot_rho_mob = dot_gamma / (prm%b_sl*dst%Lambda_sl(:,en)) & ! multiplication + - dot_rho_dip_formation & + - dot_gamma * 2.0_pREAL*prm%d_caron/prm%b_sl * stt%rho_mob(:,en) ! spontaneous annihilation of 2 edges dot_rho_dip = dot_rho_dip_formation & - - (2.0_pREAL*prm%d_caron)/prm%b_sl*stt%rho_dip(:,en)*dot_gamma_sl & ! Spontaneous annihilation of an edge with a dipole - - dot_rho_dip_climb + - dot_rho_dip_climb & + - dot_gamma * 2.0_pREAL*prm%d_caron/prm%b_sl * stt%rho_dip(:,en) ! spontaneous annihilation of an edge with a dipole end associate @@ -457,51 +458,44 @@ end subroutine plastic_dislotungsten_result ! at the end since some of them are optional. !-------------------------------------------------------------------------------------------------- pure subroutine kinetics(Mp,T,ph,en, & - dot_gamma_pos,dot_gamma_neg,ddot_gamma_dtau_pos,ddot_gamma_dtau_neg,tau_pos_out,tau_neg_out) + dot_gamma,ddot_gamma_dtau,tau) - real(pREAL), dimension(3,3), intent(in) :: & + real(pREAL), dimension(3,3), intent(in) :: & Mp !< Mandel stress - real(pREAL), intent(in) :: & + real(pREAL), intent(in) :: & T !< temperature - integer, intent(in) :: & + integer, intent(in) :: & ph, & en - real(pREAL), intent(out), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_pos, & - dot_gamma_neg - real(pREAL), intent(out), optional, dimension(param(ph)%sum_N_sl) :: & - ddot_gamma_dtau_pos, & - ddot_gamma_dtau_neg, & - tau_pos_out, & - tau_neg_out + real(pREAL), dimension(param(ph)%sum_N_sl), intent(out) :: & + dot_gamma + real(pREAL), dimension(param(ph)%sum_N_sl), optional, intent(out) :: & + ddot_gamma_dtau, & + tau real(pREAL), dimension(param(ph)%sum_N_sl) :: & StressRatio, & StressRatio_p,StressRatio_pminus1, & - dvel, & tau_pos, tau_neg, tau_eff, & - t_n, t_k, dtk,dtn - integer :: j + t_n,t_k, dtk,dtn + integer :: i associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) - do j = 1, prm%sum_N_sl - tau_pos(j) = math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,j)) - tau_neg(j) = math_tensordot(Mp,prm%P_nS_neg(1:3,1:3,j)) - end do + tau_pos = [(math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,i)),i=1,prm%sum_N_sl)] + tau_neg = [(math_tensordot(Mp,prm%P_nS_neg(1:3,1:3,i)),i=1,prm%sum_N_sl)] + tau_eff = math_clip(merge(tau_pos,tau_neg, tau_pos>tau_neg) - dst%tau_pass(:,en),left = 0.0_pREAL) - if (present(tau_pos_out)) tau_pos_out = tau_pos - if (present(tau_neg_out)) tau_neg_out = tau_neg + if (present(tau)) tau = tau_eff associate(BoltzmannRatio => prm%Q_s/(K_B*T), & - b_rho_half => stt%rho_mob(:,en) * prm%b_sl * 0.5_pREAL, & + b_rho => stt%rho_mob(:,en) * prm%b_sl, & effectiveLength => dst%Lambda_sl(:,en) - prm%w) - tau_eff = abs(tau_pos)-dst%tau_pass(:,en) - significantPositiveTau: where(tau_eff > tol_math_check) + where(tau_eff > tol_math_check) StressRatio = tau_eff/prm%tau_Peierls StressRatio_p = StressRatio** prm%p StressRatio_pminus1 = StressRatio**(prm%p-1.0_pREAL) @@ -510,53 +504,21 @@ pure subroutine kinetics(Mp,T,ph,en, & / (prm%omega*effectiveLength) t_k = effectiveLength * prm%B /(2.0_pREAL*prm%b_sl*tau_eff) ! corrected eq. (14) - dot_gamma_pos = b_rho_half * sign(prm%h/(t_n + t_k),tau_pos) - else where significantPositiveTau - dot_gamma_pos = 0.0_pREAL - end where significantPositiveTau + dot_gamma = b_rho * prm%h/(t_n + t_k) * merge(+1.0_pREAL,-1.0_pREAL, tau_pos>tau_neg) + else where + dot_gamma = 0.0_pREAL + end where - if (present(ddot_gamma_dtau_pos)) then - significantPositiveTau2: where(abs(tau_pos)-dst%tau_pass(:,en) > tol_math_check) + if (present(ddot_gamma_dtau)) then + where(tau_eff > tol_math_check) dtn = -1.0_pREAL * t_n * BoltzmannRatio * prm%p * prm%q * (1.0_pREAL-StressRatio_p)**(prm%q - 1.0_pREAL) & * StressRatio_pminus1 / prm%tau_Peierls - dtk = -1.0_pREAL * t_k / tau_pos + dtk = -1.0_pREAL * t_k / tau_eff - dvel = -1.0_pREAL * prm%h * (dtk + dtn) / (t_n + t_k)**2 - - ddot_gamma_dtau_pos = b_rho_half * dvel - else where significantPositiveTau2 - ddot_gamma_dtau_pos = 0.0_pREAL - end where significantPositiveTau2 - end if - - tau_eff = abs(tau_neg)-dst%tau_pass(:,en) - - significantNegativeTau: where(tau_eff > tol_math_check) - StressRatio = tau_eff/prm%tau_Peierls - StressRatio_p = StressRatio** prm%p - StressRatio_pminus1 = StressRatio**(prm%p-1.0_pREAL) - - t_n = prm%b_sl*exp(BoltzmannRatio*(1.0_pREAL-StressRatio_p) ** prm%q) & - / (prm%omega*effectiveLength) - t_k = effectiveLength * prm%B /(2.0_pREAL*prm%b_sl*tau_eff) ! corrected eq. (14) - - dot_gamma_neg = b_rho_half * sign(prm%h/(t_n + t_k),tau_neg) - else where significantNegativeTau - dot_gamma_neg = 0.0_pREAL - end where significantNegativeTau - - if (present(ddot_gamma_dtau_neg)) then - significantNegativeTau2: where(abs(tau_neg)-dst%tau_pass(:,en) > tol_math_check) - dtn = -1.0_pREAL * t_n * BoltzmannRatio * prm%p * prm%q * (1.0_pREAL-StressRatio_p)**(prm%q - 1.0_pREAL) & - * StressRatio_pminus1 / prm%tau_Peierls - dtk = -1.0_pREAL * t_k / tau_neg - - dvel = -1.0_pREAL * prm%h * (dtk + dtn) / (t_n + t_k)**2 - - ddot_gamma_dtau_neg = b_rho_half * dvel - else where significantNegativeTau2 - ddot_gamma_dtau_neg = 0.0_pREAL - end where significantNegativeTau2 + ddot_gamma_dtau = -1.0_pREAL * dot_gamma * (dtn + dtk) / (t_n + t_k) + else where + ddot_gamma_dtau = 0.0_pREAL + end where end if end associate From ee058c53ec433834ceef11b2dfd6a4b9c79e288d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 15 Sep 2023 21:21:50 -0400 Subject: [PATCH 162/198] extended math_expand docstring --- src/math.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/math.f90 b/src/math.f90 index 24141f4e9..1c9110dee 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -204,6 +204,7 @@ end subroutine math_sort !> @brief vector expansion !> @details takes a set of numbers (a,b,c,...) and corresponding multiples (x,y,z,...) !> to return a vector of x times a, y times b, z times c, ... +!> If there are more multiples than numbers, the numbers are treated as a ring, i.e. looped modulo their size !-------------------------------------------------------------------------------------------------- pure function math_expand_int(what,how) @@ -227,6 +228,7 @@ end function math_expand_int !> @brief vector expansion !> @details takes a set of numbers (a,b,c,...) and corresponding multiples (x,y,z,...) !> to return a vector of x times a, y times b, z times c, ... +!> If there are more multiples than numbers, the numbers are treated as a ring, i.e. looped modulo their size !-------------------------------------------------------------------------------------------------- pure function math_expand_real(what,how) From 6d2b175018cd76f88e01855200aeea38e9db9b24 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 15 Sep 2023 21:41:37 -0400 Subject: [PATCH 163/198] removed obsolete function --- src/crystal.f90 | 49 ------------------- ...phase_mechanical_plastic_dislotungsten.f90 | 4 +- 2 files changed, 2 insertions(+), 51 deletions(-) diff --git a/src/crystal.f90 b/src/crystal.f90 index 4688bdb1d..d8359503b 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -389,7 +389,6 @@ module crystal crystal_SchmidMatrix_twin, & crystal_SchmidMatrix_trans, & crystal_SchmidMatrix_cleavage, & - crystal_nonSchmidMatrix, & crystal_interaction_SlipBySlip, & crystal_interaction_TwinByTwin, & crystal_interaction_TransByTrans, & @@ -594,54 +593,6 @@ function crystal_C66_trans(Ntrans,C_parent66,crystal_target, & end function crystal_C66_trans -!-------------------------------------------------------------------------------------------------- -!> @brief Non-schmid projections for cI with up to 6 coefficients -! 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 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 - integer, intent(in) :: sense !< sense (-1,+1) - real(pREAL), dimension(1:3,1:3,sum(Nslip)) :: nonSchmidMatrix - - real(pREAL), dimension(1:3,1:3,sum(Nslip)) :: coordinateSystem !< coordinate system of slip system - real(pREAL), dimension(3) :: direction, normal, np - type(tRotation) :: R - integer :: i - - - 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 = crystal_SchmidMatrix_slip(Nslip,'cI',0.0_pREAL) ! Schmid contribution - - do i = 1,sum(Nslip) - direction = coordinateSystem(1:3,1,i) - normal = coordinateSystem(1:3,2,i) - call R%fromAxisAngle([direction,60.0_pREAL],degrees=.true.,P=1) - np = R%rotate(normal) - - if (size(nonSchmidCoefficients)>0) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) & - + nonSchmidCoefficients(1) * math_outer(direction, np) - if (size(nonSchmidCoefficients)>1) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) & - + nonSchmidCoefficients(2) * math_outer(math_cross(normal, direction), normal) - if (size(nonSchmidCoefficients)>2) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) & - + nonSchmidCoefficients(3) * math_outer(math_cross(np, direction), np) - if (size(nonSchmidCoefficients)>3) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) & - + nonSchmidCoefficients(4) * math_outer(normal, normal) - if (size(nonSchmidCoefficients)>4) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) & - + nonSchmidCoefficients(5) * math_outer(math_cross(normal, direction), & - math_cross(normal, direction)) - if (size(nonSchmidCoefficients)>5) nonSchmidMatrix(1:3,1:3,i) = nonSchmidMatrix(1:3,1:3,i) & - + nonSchmidCoefficients(6) * math_outer(direction, direction) - end do - -end function crystal_nonSchmidMatrix - - !-------------------------------------------------------------------------------------------------- !> @brief Slip-slip interaction matrix !> @details only active slip systems are considered diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index 46c5df02e..c099cfd30 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -360,8 +360,8 @@ module function dislotungsten_dotState(Mp,ph,en) result(dotState) dot_rho_dip_climb = 0.0_pREAL else where d_hat = math_clip(mu*prm%b_sl/(8.0_pREAL*PI*(1.0_pREAL-nu)*tau_eff), & - left = prm%d_caron, & ! lower limit - right = dst%Lambda_sl(:,en)) ! upper limit + left = prm%d_caron, & ! lower limit + right = dst%Lambda_sl(:,en)) ! upper limit dot_rho_dip_formation = merge(dot_gamma * 2.0_pREAL*(d_hat-prm%d_caron)/prm%b_sl * stt%rho_mob(:,en), & 0.0_pREAL, & prm%dipoleformation) From fbeb5a15f05ead2f5c3b45facb5809c591b86048 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 15 Sep 2023 21:53:42 -0400 Subject: [PATCH 164/198] include updated conftest.py in PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index ed4e161d4..3c511e078 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit ed4e161d4302852a31c59a1d1d9b11d49f1a5427 +Subproject commit 3c511e078243d8652506039549c3234572e0b3bb From e4fee4aba4735de095f5cb22f964fef4dcbdadff Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 16 Sep 2023 14:30:24 -0400 Subject: [PATCH 165/198] updated PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 3c511e078..8811a8c33 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 3c511e078243d8652506039549c3234572e0b3bb +Subproject commit 8811a8c331030db5bc55336a84d4874fb449d09e From 4d34c407337d371fb9983c95a960413b1e27aff4 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 16 Sep 2023 15:04:05 -0400 Subject: [PATCH 166/198] use correct plastic_detect_changes test --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 8811a8c33..dba037dec 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 8811a8c331030db5bc55336a84d4874fb449d09e +Subproject commit dba037dec5be4f5b616bb021c4cca9f1c0b96e84 From 6a75a1ad231a8eb52e1061767c96fe48a76273e9 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 17 Sep 2023 15:08:54 -0400 Subject: [PATCH 167/198] avoid uninitialized mem access --- src/crystal.f90 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/crystal.f90 b/src/crystal.f90 index d8359503b..dd418298b 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -1364,7 +1364,7 @@ function crystal_SchmidMatrix_slip(Nslip,lattice,cOverA,nonSchmidCoefficients,se integer, dimension(:), allocatable :: NslipMax integer, dimension(:), allocatable :: slipFamily real(pREAL), dimension(3) :: direction, normal, np - real(pREAL), dimension(:), allocatable :: coeff + real(pREAL), dimension(6) :: coeff !< local nonSchmid coefficient variable type(tRotation) :: R integer :: i @@ -1409,17 +1409,21 @@ function crystal_SchmidMatrix_slip(Nslip,lattice,cOverA,nonSchmidCoefficients,se if (present(nonSchmidCoefficients)) then select case(lattice) case('cI') - coeff = nonSchmidCoefficients(slipFamily(i),:) - call R%fromAxisAngle([direction,60.0_pREAL],degrees=.true.,P=1) - np = R%rotate(normal) - SchmidMatrix(1:3,1:3,i) = SchmidMatrix(1:3,1:3,i) & - + coeff(1) * math_outer(direction, np) & - + coeff(2) * math_outer(math_cross(normal, direction), normal) & - + coeff(3) * math_outer(math_cross(np, direction), np) & - + coeff(4) * math_outer(normal, normal) & - + coeff(5) * math_outer(math_cross(normal, direction), & - math_cross(normal, direction)) & - + coeff(6) * math_outer(direction, direction) + coeff = 0.0_pREAL + coeff(:size(nonSchmidCoefficients(i,:))) = nonSchmidCoefficients(i,:) + select case(slipFamily(i)) + case(1) + call R%fromAxisAngle([direction,60.0_pREAL],degrees=.true.,P=1) + np = R%rotate(normal) + SchmidMatrix(1:3,1:3,i) = SchmidMatrix(1:3,1:3,i) & + + coeff(1) * math_outer(direction, np) & + + coeff(2) * math_outer(math_cross(normal, direction), normal) & + + coeff(3) * math_outer(math_cross(np, direction), np) & + + coeff(4) * math_outer(normal, normal) & + + coeff(5) * math_outer(math_cross(normal, direction), & + math_cross(normal, direction)) & + + coeff(6) * math_outer(direction, direction) + end select end select end if end do From 16b029cf394d7afeda3fcf9e77a45b943a621758 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 18 Sep 2023 09:42:58 -0400 Subject: [PATCH 168/198] bug fix: used wrong index for slip family-dependent coeffs --- src/crystal.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crystal.f90 b/src/crystal.f90 index dd418298b..b405f5afe 100644 --- a/src/crystal.f90 +++ b/src/crystal.f90 @@ -1409,10 +1409,10 @@ function crystal_SchmidMatrix_slip(Nslip,lattice,cOverA,nonSchmidCoefficients,se if (present(nonSchmidCoefficients)) then select case(lattice) case('cI') - coeff = 0.0_pREAL - coeff(:size(nonSchmidCoefficients(i,:))) = nonSchmidCoefficients(i,:) + coeff(:) = 0.0_pREAL select case(slipFamily(i)) case(1) + coeff(:size(nonSchmidCoefficients(1,:))) = nonSchmidCoefficients(1,:) call R%fromAxisAngle([direction,60.0_pREAL],degrees=.true.,P=1) np = R%rotate(normal) SchmidMatrix(1:3,1:3,i) = SchmidMatrix(1:3,1:3,i) & From 4b6f66b254e16797536aa9732ea85a6f9a12b3a1 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 19 Sep 2023 09:17:06 -0400 Subject: [PATCH 169/198] new PRIVATE content --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index dba037dec..60984d0da 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit dba037dec5be4f5b616bb021c4cca9f1c0b96e84 +Subproject commit 60984d0da1215c61d2c1a76f75980cd0dd634b30 From b3f98ab87762f195384ad91f6677ae009a830f7d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 19 Sep 2023 17:43:27 -0400 Subject: [PATCH 170/198] more flexible shapeblending --- python/damask/util.py | 29 +++++++++++++++++++++++++---- python/tests/test_util.py | 24 ++++++++++++++---------- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/python/damask/util.py b/python/damask/util.py index d61ca221b..e4b7ddcb5 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -512,7 +512,8 @@ def shapeshifter(fro: _Tuple[int, ...], return tuple(final_shape[::-1] if mode == 'left' else final_shape) def shapeblender(a: _Tuple[int, ...], - b: _Tuple[int, ...]) -> _Tuple[int, ...]: + b: _Tuple[int, ...], + keep_ones: bool = True) -> _Tuple[int, ...]: """ Return a shape that overlaps the rightmost entries of 'a' with the leftmost of 'b'. @@ -522,6 +523,9 @@ def shapeblender(a: _Tuple[int, ...], Shape of first array. b : tuple Shape of second array. + keep_ones : bool, optional + Treat innermost '1's as literal value instead of dimensional placeholder. + Defaults to True. Examples -------- @@ -531,13 +535,30 @@ def shapeblender(a: _Tuple[int, ...], (1,2,3) >>> shapeblender((1,),(2,2,1)) (1,2,2,1) + >>> shapeblender((1,),(2,2,1),False) + (2,2,1) >>> shapeblender((3,2),(3,2)) (3,2) """ - i = min(len(a),len(b)) - while i > 0 and a[-i:] != b[:i]: i -= 1 - return a + b[i:] + def is_broadcastable(a,b): + try: + _np.broadcast_shapes(a,b) + return True + except ValueError: + return False + + a_,_b = a,b + if keep_ones: + i = min(len(a_),len(_b)) + while i > 0 and a_[-i:] != _b[:i]: i -= 1 + return a_ + _b[i:] + else: + a_ += max(0,len(_b)-len(a_))*(1,) + while not is_broadcastable(a_,_b): + a_ = a_ + ((1,) if len(a_)<=len(_b) else ()) + _b = ((1,) if len(_b) Date: Tue, 19 Sep 2023 17:50:28 -0400 Subject: [PATCH 171/198] result (and object interpretation) "flows" from rotation and data shapes --- python/damask/_rotation.py | 48 ++++++++++++++++++++--------------- python/tests/test_Rotation.py | 2 +- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index cd3164db4..3353cce6d 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -375,6 +375,11 @@ class Rotation: Return self@other. Rotate vector, second-order tensor, or fourth-order tensor. + `other` is interpreted as an array of tensor quantities with the highest-possible order + considering the shape of `self`. + For instance, shapes of (2,) and (3,3) for `self` and `other` prompt interpretation of + `other` as a second-rank tensor and result in (2,) rotated tensors, whereas + shapes of (2,1) and (3,3) for `self` and `other` result in (2,3) rotated vectors. Parameters ---------- @@ -388,27 +393,30 @@ class Rotation: """ if isinstance(other, np.ndarray): - if self.shape + (3,) == other.shape: - q_m = self.quaternion[...,0] - p_m = self.quaternion[...,1:] - A = q_m**2 - np.einsum('...i,...i',p_m,p_m) - B = 2. * np.einsum('...i,...i',p_m,other) - C = 2. * _P * q_m - return np.block([(A * other[...,i]).reshape(self.shape+(1,)) + - (B * p_m[...,i]).reshape(self.shape+(1,)) + - (C * ( p_m[...,(i+1)%3]*other[...,(i+2)%3]\ - - p_m[...,(i+2)%3]*other[...,(i+1)%3])).reshape(self.shape+(1,)) - for i in [0,1,2]]) - if self.shape + (3,3) == other.shape: - R = self.as_matrix() - return np.einsum('...im,...jn,...mn',R,R,other) - if self.shape + (3,3,3,3) == other.shape: - R = self.as_matrix() - return np.einsum('...im,...jn,...ko,...lp,...mnop',R,R,R,R,other) - else: - raise ValueError('can only rotate vectors, second-order tensors, and fourth-order tensors') + obs = util.shapeblender(self.shape,other.shape,keep_ones=False)[len(self.shape):] + for l in [4,2,1]: + if obs[-l:] == l*(3,): + bs = util.shapeblender(self.shape,other.shape[:-l],False) + self_ = self.broadcast_to(bs) if self.shape != bs else self + if l==1: + q_m = self_.quaternion[...,0] + p_m = self_.quaternion[...,1:] + A = q_m**2 - np.einsum('...i,...i',p_m,p_m) + B = 2. * np.einsum('...i,...i',p_m,other) + C = 2. * _P * q_m + return np.block([(A * other[...,i]) + + (B * p_m[...,i]) + + (C * ( p_m[...,(i+1)%3]*other[...,(i+2)%3] + - p_m[...,(i+2)%3]*other[...,(i+1)%3])) + for i in [0,1,2]]).reshape(bs+(3,),order='F') + else: + return np.einsum({2: '...im,...jn,...mn', + 4: '...im,...jn,...ko,...lp,...mnop'}[l], + *l*[self_.as_matrix()], + other) + raise ValueError('can only rotate vectors, second-order tensors, and fourth-order tensors') elif isinstance(other, Rotation): - raise TypeError('use "R1*R2", i.e. multiplication, to compose rotations "R1" and "R2"') + raise TypeError('use "R2*R1", i.e. multiplication, to compose rotations "R1" and "R2"') else: raise TypeError(f'cannot rotate "{type(other)}"') diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index 6b9cd2b1a..5a2d91a6e 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -1065,7 +1065,7 @@ class TestRotation: @pytest.mark.parametrize('data',[np.random.rand(4), np.random.rand(3,2), - np.random.rand(3,2,3,3)]) + np.random.rand(3,3,3,1)]) def test_rotate_invalid_shape(self,data): R = Rotation.from_random() with pytest.raises(ValueError): From 4c4c1fbcc8af13d8b730ce9a7937a7c4c3d77bd2 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 19 Sep 2023 18:03:55 -0400 Subject: [PATCH 172/198] small polish --- python/damask/_orientation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index cf6684458..15f8464fd 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -804,7 +804,7 @@ class Orientation(Rotation,Crystal): blend += sym_ops.shape v = sym_ops.broadcast_to(shape) \ @ np.broadcast_to(v.reshape(util.shapeshifter(v.shape,shape+(3,))),shape+(3,)) - return ~(self.broadcast_to(blend))@ np.broadcast_to(v,blend+(3,)) + return ~(self.broadcast_to(blend))@np.broadcast_to(v,blend+(3,)) def Schmid(self, *, @@ -833,7 +833,7 @@ class Orientation(Rotation,Crystal): >>> import damask >>> np.set_printoptions(3,suppress=True,floatmode='fixed') >>> O = damask.Orientation.from_Euler_angles(phi=[0,45,0],degrees=True,lattice='cF') - >>> O.Schmid(N_slip=[1]) + >>> O.Schmid(N_slip=[12])[0] array([[ 0.000, 0.000, 0.000], [ 0.577, -0.000, 0.816], [ 0.000, 0.000, 0.000]]) From 108ef2a954ecb99335ee4b85a1a3fc2127c00d5c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 19 Sep 2023 18:05:12 -0400 Subject: [PATCH 173/198] reflect updated shape blending --- python/tests/test_Orientation.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 8346397cc..9836ee16e 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -162,7 +162,7 @@ class TestOrientation: ([np.arccos(3**(-.5)),np.pi/4,0],[0,0],[0,0,1],[0,0,1])]) def test_fiber_IPF(self,crystal,sample,direction,color): fiber = Orientation.from_fiber_component(crystal=crystal,sample=sample,family='cubic',shape=200) - print(np.allclose(fiber.IPF_color(direction),color)) + assert np.allclose(fiber.IPF_color(direction),color) @pytest.mark.parametrize('kwargs',[ @@ -455,11 +455,9 @@ class TestOrientation: p = Orientation.from_random(family=family,shape=right) blend = util.shapeblender(o.shape,p.shape) for loc in np.random.randint(0,blend,(10,len(blend))): - # print(f'{a}/{b} @ {loc}') - # print(o[tuple(loc[:len(o.shape)])].disorientation(p[tuple(loc[-len(p.shape):])])) - # print(o.disorientation(p)[tuple(loc)]) - assert o[tuple(loc[:len(o.shape)])].disorientation(p[tuple(loc[-len(p.shape):])]) \ - .isclose(o.disorientation(p)[tuple(loc)]) + l = () if left is None else tuple(np.minimum(np.array(left )-1,loc[:len(left)])) + r = () if right is None else tuple(np.minimum(np.array(right)-1,loc[-len(right):])) + assert o[l].disorientation(p[r]).isclose(o.disorientation(p)[tuple(loc)]) @pytest.mark.parametrize('family',crystal_families) @pytest.mark.parametrize('left,right',[ @@ -467,13 +465,16 @@ class TestOrientation: ((2,2),(4,4)), ((3,1),(1,3)), (None,(3,)), + (None,()), ]) def test_IPF_color_blending(self,family,left,right): o = Orientation.from_random(family=family,shape=left) v = np.random.random(right+(3,)) blend = util.shapeblender(o.shape,v.shape[:-1]) for loc in np.random.randint(0,blend,(10,len(blend))): - assert np.allclose(o[tuple(loc[:len(o.shape)])].IPF_color(v[tuple(loc[-len(v.shape[:-1]):])]), + l = () if left is None else tuple(np.minimum(np.array(left )-1,loc[:len(left)])) + r = () if right is None else tuple(np.minimum(np.array(right)-1,loc[-len(right):])) + assert np.allclose(o[l].IPF_color(v[r]), o.IPF_color(v)[tuple(loc)]) @pytest.mark.parametrize('family',crystal_families) @@ -488,7 +489,9 @@ class TestOrientation: v = np.random.random(right+(3,)) blend = util.shapeblender(o.shape,v.shape[:-1]) for loc in np.random.randint(0,blend,(10,len(blend))): - assert np.allclose(o[tuple(loc[:len(o.shape)])].to_SST(v[tuple(loc[-len(v.shape[:-1]):])]), + l = () if left is None else tuple(np.minimum(np.array(left )-1,loc[:len(left)])) + r = () if right is None else tuple(np.minimum(np.array(right)-1,loc[-len(right):])) + assert np.allclose(o[l].to_SST(v[r]), o.to_SST(v)[tuple(loc)]) @pytest.mark.parametrize('lattice,a,b,c,alpha,beta,gamma', @@ -514,8 +517,10 @@ class TestOrientation: v = np.random.random(right+(3,)) blend = util.shapeblender(o.shape,v.shape[:-1]) for loc in np.random.randint(0,blend,(10,len(blend))): - assert np.allclose(o[tuple(loc[:len(o.shape)])].to_pole(uvw=v[tuple(loc[-len(v.shape[:-1]):])]), - o.to_pole(uvw=v)[tuple(loc)]) + l = () if left is None else tuple(np.minimum(np.array(left )-1,loc[:len(left)])) + r = () if right is None else tuple(np.minimum(np.array(right)-1,loc[-len(right):])) + assert np.allclose(o[l].to_pole(uvw=v[r]), + o.to_pole(uvw=v)[tuple(loc)]) def test_mul_invalid(self): with pytest.raises(TypeError): From 177da6e2cbcf9e3656ec628147d00b9ee958d1f8 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 21 Sep 2023 08:15:56 -0400 Subject: [PATCH 174/198] use clean PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 60984d0da..b752a1e5d 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 60984d0da1215c61d2c1a76f75980cd0dd634b30 +Subproject commit b752a1e5d3a10a579329b386ed23d961fe2d35cb From eeb5de0531ea50a07303aed0ca7dea42c9ec5631 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 21 Sep 2023 22:32:38 +0200 Subject: [PATCH 175/198] easier to understand --- src/phase_mechanical_plastic_dislotungsten.f90 | 2 +- src/phase_mechanical_plastic_kinehardening.f90 | 5 ++--- src/phase_mechanical_plastic_phenopowerlaw.f90 | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index c099cfd30..2d3da1534 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -486,7 +486,7 @@ pure subroutine kinetics(Mp,T,ph,en, & tau_pos = [(math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,i)),i=1,prm%sum_N_sl)] tau_neg = [(math_tensordot(Mp,prm%P_nS_neg(1:3,1:3,i)),i=1,prm%sum_N_sl)] - tau_eff = math_clip(merge(tau_pos,tau_neg, tau_pos>tau_neg) - dst%tau_pass(:,en),left = 0.0_pREAL) + tau_eff = math_clip(max(tau_pos,tau_neg) - dst%tau_pass(:,en),left = 0.0_pREAL) if (present(tau)) tau = tau_eff diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 1f370db56..9ca963e83 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -336,7 +336,6 @@ module function plastic_kinehardening_dotState(Mp,ph,en) result(dotState) * exp(-(stt%gamma(:,en)-stt%gamma_flip(:,en))*prm%h_0_chi/(prm%chi_inf+stt%chi_flip(:,en))) & ) - end associate end function plastic_kinehardening_dotState @@ -457,11 +456,11 @@ pure subroutine kinetics(Mp,ph,en, & dot_gamma = merge(+1.0_pREAL,-1.0_pREAL, tau_pos>tau_neg) & * prm%dot_gamma_0 & - * (merge(tau_pos,tau_neg, tau_pos>tau_neg)/stt%xi(:,en))**prm%n + * (max(tau_pos,tau_neg)/stt%xi(:,en))**prm%n if (present(ddot_gamma_dtau)) then where(dNeq0(dot_gamma)) - ddot_gamma_dtau = dot_gamma*prm%n/merge(tau_pos,tau_neg, tau_pos>tau_neg) + ddot_gamma_dtau = dot_gamma*prm%n/max(tau_pos,tau_neg) else where ddot_gamma_dtau = 0.0_pREAL end where diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 450bf6f6b..e078ab986 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -465,11 +465,11 @@ pure subroutine kinetics_sl(Mp,ph,en, & dot_gamma_sl = merge(+1.0_pREAL,-1.0_pREAL, tau_sl_pos>tau_sl_neg) & * prm%dot_gamma_0_sl & - * (merge(tau_sl_pos,tau_sl_neg, tau_sl_pos>tau_sl_neg)/stt%xi_sl(:,en))**prm%n_sl + * (max(tau_sl_pos,tau_sl_neg)/stt%xi_sl(:,en))**prm%n_sl if (present(ddot_gamma_dtau_sl)) then where(dNeq0(dot_gamma_sl)) - ddot_gamma_dtau_sl = dot_gamma_sl*prm%n_sl/merge(tau_sl_pos,tau_sl_neg, tau_sl_pos>tau_sl_neg) + ddot_gamma_dtau_sl = dot_gamma_sl*prm%n_sl/max(tau_sl_pos,tau_sl_neg) else where ddot_gamma_dtau_sl = 0.0_pREAL end where From 23c6270d4aef59c23347ff6a1a059b1be933ad06 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 21 Sep 2023 17:27:38 -0400 Subject: [PATCH 176/198] added examples --- python/damask/_rotation.py | 43 +++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 3353cce6d..c03bff4b2 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -376,7 +376,7 @@ class Rotation: Rotate vector, second-order tensor, or fourth-order tensor. `other` is interpreted as an array of tensor quantities with the highest-possible order - considering the shape of `self`. + considering the shape of `self`. Compatible innermost dimensions will blend. For instance, shapes of (2,) and (3,3) for `self` and `other` prompt interpretation of `other` as a second-rank tensor and result in (2,) rotated tensors, whereas shapes of (2,1) and (3,3) for `self` and `other` result in (2,3) rotated vectors. @@ -391,6 +391,47 @@ class Rotation: rotated : numpy.ndarray, shape (...,3), (...,3,3), or (...,3,3,3,3) Rotated vector or tensor, i.e. transformed to frame defined by rotation. + Examples + -------- + All below examples rely on imported modules: + >>> import numpy as np + >>> import damask + + Application of twelve (random) rotations to a set of five vectors. + + >>> r = damask.Rotation.from_random(shape=(12)) + >>> o = np.ones((5,3)) + >>> (r@o).shape # (12) @ (5, 3) + (12,5, 3) + + Application of a (random) rotation to all twelve second-rank tensors. + + >>> r = damask.Rotation.from_random() + >>> o = np.ones((12,3,3)) + >>> (r@o).shape # (1) @ (12, 3,3) + (12,3,3) + + Application of twelve (random) rotations to the corresponding twelve second-rank tensors. + + >>> r = damask.Rotation.from_random(shape=(12)) + >>> o = np.ones((12,3,3)) + >>> (r@o).shape # (12) @ (3,3) + (12,3,3) + + Application of each of three (random) rotations to all three vectors. + + >>> r = damask.Rotation.from_random(shape=(3)) + >>> o = np.ones((3,3)) + >>> (r[...,np.newaxis]@o[np.newaxis,...]).shape # (3,1) @ (1,3, 3) + (3,3,3) + + Application of twelve (random) rotations to all twelve second-rank tensors. + + >>> r = damask.Rotation.from_random(shape=(12)) + >>> o = np.ones((12,3,3)) + >>> (r@o[np.newaxis,...]).shape # (12) @ (1,12, 3,3) + (12,3,3,3) + """ if isinstance(other, np.ndarray): obs = util.shapeblender(self.shape,other.shape,keep_ones=False)[len(self.shape):] From 7c2e870d17f74d9761e11a67b4c2851701e725f6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Sep 2023 07:10:08 +0200 Subject: [PATCH 177/198] polishing --- ...phase_mechanical_plastic_kinehardening.f90 | 22 ++++++------ ...phase_mechanical_plastic_phenopowerlaw.f90 | 36 ++++++++++--------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 9ca963e83..549fd15ef 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -273,20 +273,21 @@ pure module subroutine kinehardening_LpAndItsTangent(Lp,dLp_dMp, Mp,ph,en) real(pREAL), dimension(param(ph)%sum_N_sl) :: & dot_gamma, ddot_gamma_dtau + Lp = 0.0_pREAL dLp_dMp = 0.0_pREAL associate(prm => param(ph)) - call kinetics(Mp,ph,en, dot_gamma,ddot_gamma_dtau) - do i = 1, prm%sum_N_sl - Lp = Lp + dot_gamma(i)*prm%P(1:3,1:3,i) - forall (k=1:3,l=1:3,m=1:3,n=1:3) & - dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & - + ddot_gamma_dtau(i) * prm%P(k,l,i) & - * merge(prm%P_nS_pos(m,n,i), & - prm%P_nS_neg(m,n,i), dot_gamma(i)>0.0_pREAL) - end do + call kinetics(Mp,ph,en, dot_gamma,ddot_gamma_dtau) + do i = 1, prm%sum_N_sl + Lp = Lp + dot_gamma(i)*prm%P(1:3,1:3,i) + forall (k=1:3,l=1:3,m=1:3,n=1:3) & + dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & + + ddot_gamma_dtau(i) * prm%P(k,l,i) & + * merge(prm%P_nS_pos(m,n,i), & + prm%P_nS_neg(m,n,i), dot_gamma(i)>0.0_pREAL) + end do end associate @@ -308,8 +309,6 @@ module function plastic_kinehardening_dotState(Mp,ph,en) result(dotState) real(pREAL) :: & sumGamma - real(pREAL), dimension(param(ph)%sum_N_sl) :: & - dot_gamma associate(prm => param(ph), stt => state(ph), & @@ -449,6 +448,7 @@ pure subroutine kinetics(Mp,ph,en, & tau_neg integer :: i + associate(prm => param(ph), stt => state(ph)) tau_pos = [(math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,i)) - stt%chi(i,en),i=1,prm%sum_N_sl)] diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index e078ab986..77c6db4dd 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -315,28 +315,29 @@ pure module subroutine phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) real(pREAL), dimension(param(ph)%sum_N_tw) :: & dot_gamma_tw,ddot_gamma_dtau_tw + Lp = 0.0_pREAL dLp_dMp = 0.0_pREAL associate(prm => param(ph)) - call kinetics_sl(Mp,ph,en,dot_gamma_sl,ddot_gamma_dtau_sl) - slipSystems: do i = 1, prm%sum_N_sl - Lp = Lp + dot_gamma_sl(i)*prm%P_sl(1:3,1:3,i) - forall (k=1:3,l=1:3,m=1:3,n=1:3) & - dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & - + ddot_gamma_dtau_sl(i) * prm%P_sl(k,l,i) & - * merge(prm%P_nS_pos(m,n,i), & - prm%P_nS_neg(m,n,i), dot_gamma_sl(i)>0.0_pREAL) - end do slipSystems + call kinetics_sl(Mp,ph,en,dot_gamma_sl,ddot_gamma_dtau_sl) + slipSystems: do i = 1, prm%sum_N_sl + Lp = Lp + dot_gamma_sl(i)*prm%P_sl(1:3,1:3,i) + forall (k=1:3,l=1:3,m=1:3,n=1:3) & + dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & + + ddot_gamma_dtau_sl(i) * prm%P_sl(k,l,i) & + * merge(prm%P_nS_pos(m,n,i), & + prm%P_nS_neg(m,n,i), dot_gamma_sl(i)>0.0_pREAL) + end do slipSystems - call kinetics_tw(Mp,ph,en,dot_gamma_tw,ddot_gamma_dtau_tw) - twinSystems: do i = 1, prm%sum_N_tw - Lp = Lp + dot_gamma_tw(i)*prm%P_tw(1:3,1:3,i) - forall (k=1:3,l=1:3,m=1:3,n=1:3) & - dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & - + ddot_gamma_dtau_tw(i)*prm%P_tw(k,l,i)*prm%P_tw(m,n,i) - end do twinSystems + call kinetics_tw(Mp,ph,en,dot_gamma_tw,ddot_gamma_dtau_tw) + twinSystems: do i = 1, prm%sum_N_tw + Lp = Lp + dot_gamma_tw(i)*prm%P_tw(1:3,1:3,i) + forall (k=1:3,l=1:3,m=1:3,n=1:3) & + dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & + + ddot_gamma_dtau_tw(i)*prm%P_tw(k,l,i)*prm%P_tw(m,n,i) + end do twinSystems end associate @@ -359,10 +360,10 @@ module function phenopowerlaw_dotState(Mp,ph,en) result(dotState) real(pREAL) :: & sumF real(pREAL), dimension(param(ph)%sum_N_sl) :: & - dot_gamma_sl_pos,dot_gamma_sl_neg, & xi_sl_sat_offset, & left_SlipSlip + associate(prm => param(ph), stt => state(ph), & dot_xi_sl => dotState(indexDotState(ph)%xi_sl(1):indexDotState(ph)%xi_sl(2)), & dot_xi_tw => dotState(indexDotState(ph)%xi_tw(1):indexDotState(ph)%xi_tw(2)), & @@ -458,6 +459,7 @@ pure subroutine kinetics_sl(Mp,ph,en, & tau_sl_neg integer :: i + associate(prm => param(ph), stt => state(ph)) tau_sl_pos = [(math_tensordot(Mp,prm%P_nS_pos(1:3,1:3,i)),i=1,prm%sum_N_sl)] From d7a9b76ba9b948a6cda87f09a90ce1b1188d96ed Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 21 Sep 2023 23:49:13 +0200 Subject: [PATCH 178/198] better debug for Intel LLVM compiler --- cmake/Compiler-IntelLLVM.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/Compiler-IntelLLVM.cmake b/cmake/Compiler-IntelLLVM.cmake index 86c9d380c..76fc0386a 100644 --- a/cmake/Compiler-IntelLLVM.cmake +++ b/cmake/Compiler-IntelLLVM.cmake @@ -98,6 +98,9 @@ set (DEBUG_FLAGS "${DEBUG_FLAGS},uninit") set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all=0 -ftz") # ... capture all floating-point exceptions, need to overwrite -no-ftz +set (DEBUG_FLAGS "${DEBUG_FLAGS} -init=arrays,zero,minus_huge,snan") +# ... initialize logical to false, integer to -huge, float+complex to signaling NaN + # disable due to compiler bug https://community.intel.com/t5/Intel-Fortran-Compiler/false-positive-stand-f18-and-IEEE-SELECTED-REAL-KIND/m-p/1227336 #set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn") # enables warnings ... From b0bb904c89e0307f71c3624014917a728b1d8ea1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 21 Sep 2023 21:24:45 +0200 Subject: [PATCH 179/198] no multiprocessing for adding datasets multiprocessing was not reliable on different platform and caused all kinds of weird behavior --- python/damask/_result.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 5d04a79b7..ce2cb8896 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1,5 +1,3 @@ -import multiprocessing as mp -from multiprocessing.synchronize import Lock import re import fnmatch import os @@ -1450,12 +1448,10 @@ class Result: group: str, callback: Callable, datasets: Dict[str, str], - args: Dict[str, str], - lock: Lock) -> List[Union[None, Any]]: + args: Dict[str, str]) -> List[Union[None, Any]]: """Execute job for _add_generic_pointwise.""" try: datasets_in = {} - lock.acquire() with h5py.File(self.fname,'r') as f: for arg,label in datasets.items(): loc = f[group+'/'+label] @@ -1463,7 +1459,6 @@ class Result: 'label':label, 'meta': {k:(v.decode() if not h5py3 and type(v) is bytes else v) \ for k,v in loc.attrs.items()}} - lock.release() r = callback(**datasets_in,**args) return [group,r] except Exception as err: @@ -1490,9 +1485,6 @@ class Result: Arguments parsed to func. """ - pool = mp.Pool(int(os.environ.get('OMP_NUM_THREADS',4))) - lock = mp.Manager().Lock() - groups = [] with h5py.File(self.fname,'r') as f: for inc in self.visible['increments']: @@ -1506,12 +1498,12 @@ class Result: print('No matching dataset found, no data was added.') return - default_arg = partial(self._job_pointwise,callback=func,datasets=datasets,args=args,lock=lock) + default_arg = partial(self._job_pointwise,callback=func,datasets=datasets,args=args) - for group,result in util.show_progress(pool.imap_unordered(default_arg,groups),len(groups)):# type: ignore + for grp in util.show_progress(groups): + group, result = default_arg(grp) # type: ignore if not result: continue - lock.acquire() with h5py.File(self.fname, 'a') as f: try: if not self._protected and '/'.join([group,result['label']]) in f: @@ -1543,10 +1535,6 @@ class Result: except (OSError,RuntimeError) as err: print(f'Could not add dataset: {err}.') - lock.release() - - pool.close() - pool.join() def _mappings(self): From 36c13d2e58cdd47dc4ce5b671d7769177cd4d998 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 21 Sep 2023 23:54:53 +0200 Subject: [PATCH 180/198] no need to have this as class method definition as class method was needed to be visible in multiprocessing --- python/damask/_result.py | 681 ++++++++++++++++++++------------------- 1 file changed, 343 insertions(+), 338 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index ce2cb8896..9cef7093d 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -599,17 +599,6 @@ class Result: f['/geometry/T_c'].attrs['VTK_TYPE'].decode()) - @staticmethod - def _add_absolute(x: Dict[str, Any]) -> Dict[str, Any]: - return { - 'data': np.abs(x['data']), - 'label': f'|{x["label"]}|', - 'meta': { - 'unit': x['meta']['unit'], - 'description': f"absolute value of {x['label']} ({x['meta']['description']})", - 'creator': 'add_absolute' - } - } def add_absolute(self, x: str): """ Add absolute value. @@ -620,28 +609,20 @@ class Result: Name of scalar, vector, or tensor dataset to take absolute value of. """ - self._add_generic_pointwise(self._add_absolute,{'x':x}) + def absolute(x: Dict[str, Any]) -> Dict[str, Any]: + return { + 'data': np.abs(x['data']), + 'label': f'|{x["label"]}|', + 'meta': { + 'unit': x['meta']['unit'], + 'description': f"absolute value of {x['label']} ({x['meta']['description']})", + 'creator': 'add_absolute' + } + } + + self._add_generic_pointwise(absolute,{'x':x}) - @staticmethod - def _add_calculation(**kwargs) -> Dict[str, Any]: - formula = kwargs['formula'] - for d in re.findall(r'#(.*?)#',formula): - formula = formula.replace(f'#{d}#',f"kwargs['{d}']['data']") - data = eval(formula) - - if not hasattr(data,'shape') or data.shape[0] != kwargs[d]['data'].shape[0]: - raise ValueError('"{}" results in invalid shape'.format(kwargs['formula'])) - - return { - 'data': data, - 'label': kwargs['label'], - 'meta': { - 'unit': kwargs['unit'], - 'description': f"{kwargs['description']} (formula: {kwargs['formula']})", - 'creator': 'add_calculation' - } - } def add_calculation(self, formula: str, name: str, @@ -690,24 +671,30 @@ class Result: ... 'Mises equivalent of the Cauchy stress') """ + def calculation(**kwargs) -> Dict[str, Any]: + formula = kwargs['formula'] + for d in re.findall(r'#(.*?)#',formula): + formula = formula.replace(f'#{d}#',f"kwargs['{d}']['data']") + data = eval(formula) + + if not hasattr(data,'shape') or data.shape[0] != kwargs[d]['data'].shape[0]: + raise ValueError('"{}" results in invalid shape'.format(kwargs['formula'])) + + return { + 'data': data, + 'label': kwargs['label'], + 'meta': { + 'unit': kwargs['unit'], + 'description': f"{kwargs['description']} (formula: {kwargs['formula']})", + 'creator': 'add_calculation' + } + } + dataset_mapping = {d:d for d in set(re.findall(r'#(.*?)#',formula))} # datasets used in the formula args = {'formula':formula,'label':name,'unit':unit,'description':description} - self._add_generic_pointwise(self._add_calculation,dataset_mapping,args) + self._add_generic_pointwise(calculation,dataset_mapping,args) - @staticmethod - def _add_stress_Cauchy(P: Dict[str, Any], F: Dict[str, Any]) -> Dict[str, Any]: - return { - 'data': mechanics.stress_Cauchy(P['data'],F['data']), - 'label': 'sigma', - 'meta': { - 'unit': P['meta']['unit'], - 'description': "Cauchy stress calculated " - f"from {P['label']} ({P['meta']['description']})" - f" and {F['label']} ({F['meta']['description']})", - 'creator': 'add_stress_Cauchy' - } - } def add_stress_Cauchy(self, P: str = 'P', F: str = 'F'): @@ -724,20 +711,23 @@ class Result: Defaults to 'F'. """ - self._add_generic_pointwise(self._add_stress_Cauchy,{'P':P,'F':F}) + + def stress_Cauchy(P: Dict[str, Any], F: Dict[str, Any]) -> Dict[str, Any]: + return { + 'data': mechanics.stress_Cauchy(P['data'],F['data']), + 'label': 'sigma', + 'meta': { + 'unit': P['meta']['unit'], + 'description': "Cauchy stress calculated " + f"from {P['label']} ({P['meta']['description']})" + f" and {F['label']} ({F['meta']['description']})", + 'creator': 'add_stress_Cauchy' + } + } + + self._add_generic_pointwise(stress_Cauchy,{'P':P,'F':F}) - @staticmethod - def _add_determinant(T: Dict[str, Any]) -> Dict[str, Any]: - return { - 'data': np.linalg.det(T['data']), - 'label': f"det({T['label']})", - 'meta': { - 'unit': T['meta']['unit'], - 'description': f"determinant of tensor {T['label']} ({T['meta']['description']})", - 'creator': 'add_determinant' - } - } def add_determinant(self, T: str): """ Add the determinant of a tensor. @@ -756,20 +746,21 @@ class Result: >>> r.add_determinant('F_p') """ - self._add_generic_pointwise(self._add_determinant,{'T':T}) + + def determinant(T: Dict[str, Any]) -> Dict[str, Any]: + return { + 'data': np.linalg.det(T['data']), + 'label': f"det({T['label']})", + 'meta': { + 'unit': T['meta']['unit'], + 'description': f"determinant of tensor {T['label']} ({T['meta']['description']})", + 'creator': 'add_determinant' + } + } + + self._add_generic_pointwise(determinant,{'T':T}) - @staticmethod - def _add_deviator(T: Dict[str, Any]) -> Dict[str, Any]: - return { - 'data': tensor.deviatoric(T['data']), - 'label': f"s_{T['label']}", - 'meta': { - 'unit': T['meta']['unit'], - 'description': f"deviator of tensor {T['label']} ({T['meta']['description']})", - 'creator': 'add_deviator' - } - } def add_deviator(self, T: str): """ Add the deviatoric part of a tensor. @@ -788,29 +779,21 @@ class Result: >>> r.add_deviator('sigma') """ - self._add_generic_pointwise(self._add_deviator,{'T':T}) + + def deviator(T: Dict[str, Any]) -> Dict[str, Any]: + return { + 'data': tensor.deviatoric(T['data']), + 'label': f"s_{T['label']}", + 'meta': { + 'unit': T['meta']['unit'], + 'description': f"deviator of tensor {T['label']} ({T['meta']['description']})", + 'creator': 'add_deviator' + } + } + + self._add_generic_pointwise(deviator,{'T':T}) - @staticmethod - def _add_eigenvalue(T_sym: Dict[str, Any], eigenvalue: Literal['max, mid, min']) -> Dict[str, Any]: - if eigenvalue == 'max': - label,p = 'maximum',2 - elif eigenvalue == 'mid': - label,p = 'intermediate',1 - elif eigenvalue == 'min': - label,p = 'minimum',0 - else: - raise ValueError(f'invalid eigenvalue: {eigenvalue}') - - return { - 'data': tensor.eigenvalues(T_sym['data'])[:,p], - 'label': f"lambda_{eigenvalue}({T_sym['label']})", - 'meta' : { - 'unit': T_sym['meta']['unit'], - 'description': f"{label} eigenvalue of {T_sym['label']} ({T_sym['meta']['description']})", - 'creator': 'add_eigenvalue' - } - } def add_eigenvalue(self, T_sym: str, eigenvalue: Literal['max', 'mid', 'min'] = 'max'): @@ -833,30 +816,30 @@ class Result: >>> r.add_eigenvalue('sigma','min') """ - self._add_generic_pointwise(self._add_eigenvalue,{'T_sym':T_sym},{'eigenvalue':eigenvalue}) + + def eigenval(T_sym: Dict[str, Any], eigenvalue: Literal['max, mid, min']) -> Dict[str, Any]: + if eigenvalue == 'max': + label,p = 'maximum',2 + elif eigenvalue == 'mid': + label,p = 'intermediate',1 + elif eigenvalue == 'min': + label,p = 'minimum',0 + else: + raise ValueError(f'invalid eigenvalue: {eigenvalue}') + + return { + 'data': tensor.eigenvalues(T_sym['data'])[:,p], + 'label': f"lambda_{eigenvalue}({T_sym['label']})", + 'meta' : { + 'unit': T_sym['meta']['unit'], + 'description': f"{label} eigenvalue of {T_sym['label']} ({T_sym['meta']['description']})", + 'creator': 'add_eigenvalue' + } + } + + self._add_generic_pointwise(eigenval,{'T_sym':T_sym},{'eigenvalue':eigenvalue}) - @staticmethod - def _add_eigenvector(T_sym: Dict[str, Any], eigenvalue: Literal['max', 'mid', 'min']) -> Dict[str, Any]: - if eigenvalue == 'max': - label,p = 'maximum',2 - elif eigenvalue == 'mid': - label,p = 'intermediate',1 - elif eigenvalue == 'min': - label,p = 'minimum',0 - else: - raise ValueError(f'invalid eigenvalue: {eigenvalue}') - - return { - 'data': tensor.eigenvectors(T_sym['data'])[:,p], - 'label': f"v_{eigenvalue}({T_sym['label']})", - 'meta' : { - 'unit': '1', - 'description': f"eigenvector corresponding to {label} eigenvalue" - f" of {T_sym['label']} ({T_sym['meta']['description']})", - 'creator': 'add_eigenvector' - } - } def add_eigenvector(self, T_sym: str, eigenvalue: Literal['max', 'mid', 'min'] = 'max'): @@ -872,25 +855,31 @@ class Result: Defaults to 'max'. """ - self._add_generic_pointwise(self._add_eigenvector,{'T_sym':T_sym},{'eigenvalue':eigenvalue}) + + def eigenvector(T_sym: Dict[str, Any], eigenvalue: Literal['max', 'mid', 'min']) -> Dict[str, Any]: + if eigenvalue == 'max': + label,p = 'maximum',2 + elif eigenvalue == 'mid': + label,p = 'intermediate',1 + elif eigenvalue == 'min': + label,p = 'minimum',0 + else: + raise ValueError(f'invalid eigenvalue: {eigenvalue}') + + return { + 'data': tensor.eigenvectors(T_sym['data'])[:,p], + 'label': f"v_{eigenvalue}({T_sym['label']})", + 'meta' : { + 'unit': '1', + 'description': f"eigenvector corresponding to {label} eigenvalue" + f" of {T_sym['label']} ({T_sym['meta']['description']})", + 'creator': 'add_eigenvector' + } + } + + self._add_generic_pointwise(eigenvector,{'T_sym':T_sym},{'eigenvalue':eigenvalue}) - @staticmethod - def _add_IPF_color(l: FloatSequence, q: Dict[str, Any]) -> Dict[str, Any]: - m = util.scale_to_coprime(np.array(l)) - lattice = q['meta']['lattice'] - o = Orientation(rotation = q['data'],lattice=lattice) - - return { - 'data': np.uint8(o.IPF_color(l)*255), - 'label': 'IPFcolor_({} {} {})'.format(*m), - 'meta' : { - 'unit': '8-bit RGB', - 'lattice': q['meta']['lattice'], - 'description': 'Inverse Pole Figure (IPF) colors along sample direction ({} {} {})'.format(*m), - 'creator': 'add_IPF_color' - } - } def add_IPF_color(self, l: FloatSequence, q: str = 'O'): @@ -914,20 +903,26 @@ class Result: >>> r.add_IPF_color(np.array([0,1,1])) """ - self._add_generic_pointwise(self._add_IPF_color,{'q':q},{'l':l}) + + def IPF_color(l: FloatSequence, q: Dict[str, Any]) -> Dict[str, Any]: + m = util.scale_to_coprime(np.array(l)) + lattice = q['meta']['lattice'] + o = Orientation(rotation = q['data'],lattice=lattice) + + return { + 'data': np.uint8(o.IPF_color(l)*255), + 'label': 'IPFcolor_({} {} {})'.format(*m), + 'meta' : { + 'unit': '8-bit RGB', + 'lattice': q['meta']['lattice'], + 'description': 'Inverse Pole Figure (IPF) colors along sample direction ({} {} {})'.format(*m), + 'creator': 'add_IPF_color' + } + } + + self._add_generic_pointwise(IPF_color,{'q':q},{'l':l}) - @staticmethod - def _add_maximum_shear(T_sym: Dict[str, Any]) -> Dict[str, Any]: - return { - 'data': mechanics.maximum_shear(T_sym['data']), - 'label': f"max_shear({T_sym['label']})", - 'meta': { - 'unit': T_sym['meta']['unit'], - 'description': f"maximum shear component of {T_sym['label']} ({T_sym['meta']['description']})", - 'creator': 'add_maximum_shear' - } - } def add_maximum_shear(self, T_sym: str): """ Add maximum shear components of symmetric tensor. @@ -938,30 +933,20 @@ class Result: Name of symmetric tensor dataset. """ - self._add_generic_pointwise(self._add_maximum_shear,{'T_sym':T_sym}) + def maximum_shear(T_sym: Dict[str, Any]) -> Dict[str, Any]: + return { + 'data': mechanics.maximum_shear(T_sym['data']), + 'label': f"max_shear({T_sym['label']})", + 'meta': { + 'unit': T_sym['meta']['unit'], + 'description': f"maximum shear component of {T_sym['label']} ({T_sym['meta']['description']})", + 'creator': 'add_maximum_shear' + } + } + + self._add_generic_pointwise(maximum_shear,{'T_sym':T_sym}) - @staticmethod - def _add_equivalent_Mises(T_sym: Dict[str, Any], kind: str) -> Dict[str, Any]: - k = kind - if k is None: - if T_sym['meta']['unit'] == '1': - k = 'strain' - elif T_sym['meta']['unit'] == 'Pa': - k = 'stress' - if k not in ['stress', 'strain']: - raise ValueError(f'invalid von Mises kind "{kind}"') - - return { - 'data': (mechanics.equivalent_strain_Mises if k=='strain' else \ - mechanics.equivalent_stress_Mises)(T_sym['data']), - 'label': f"{T_sym['label']}_vM", - 'meta': { - 'unit': T_sym['meta']['unit'], - 'description': f"Mises equivalent {k} of {T_sym['label']} ({T_sym['meta']['description']})", - 'creator': 'add_Mises' - } - } def add_equivalent_Mises(self, T_sym: str, kind: Optional[str] = None): @@ -991,32 +976,30 @@ class Result: >>> r.add_equivalent_Mises('epsilon_V^0.0(F)') """ - self._add_generic_pointwise(self._add_equivalent_Mises,{'T_sym':T_sym},{'kind':kind}) + def equivalent_Mises(T_sym: Dict[str, Any], kind: str) -> Dict[str, Any]: + k = kind + if k is None: + if T_sym['meta']['unit'] == '1': + k = 'strain' + elif T_sym['meta']['unit'] == 'Pa': + k = 'stress' + if k not in ['stress', 'strain']: + raise ValueError(f'invalid von Mises kind "{kind}"') + + return { + 'data': (mechanics.equivalent_strain_Mises if k=='strain' else \ + mechanics.equivalent_stress_Mises)(T_sym['data']), + 'label': f"{T_sym['label']}_vM", + 'meta': { + 'unit': T_sym['meta']['unit'], + 'description': f"Mises equivalent {k} of {T_sym['label']} ({T_sym['meta']['description']})", + 'creator': 'add_Mises' + } + } + + self._add_generic_pointwise(equivalent_Mises,{'T_sym':T_sym},{'kind':kind}) - @staticmethod - def _add_norm(x: Dict[str, Any], ord: Union[int, float, Literal['fro', 'nuc']]) -> Dict[str, Any]: - o = ord - if len(x['data'].shape) == 2: - axis: Union[int, Tuple[int, int]] = 1 - t = 'vector' - if o is None: o = 2 - elif len(x['data'].shape) == 3: - axis = (1,2) - t = 'tensor' - if o is None: o = 'fro' - else: - raise ValueError(f'invalid shape of {x["label"]}') - - return { - 'data': np.linalg.norm(x['data'],ord=o,axis=axis,keepdims=True), - 'label': f"|{x['label']}|_{o}", - 'meta': { - 'unit': x['meta']['unit'], - 'description': f"{o}-norm of {t} {x['label']} ({x['meta']['description']})", - 'creator': 'add_norm' - } - } def add_norm(self, x: str, ord: Union[None, int, float, Literal['fro', 'nuc']] = None): @@ -1031,22 +1014,32 @@ class Result: Order of the norm. inf means NumPy's inf object. For details refer to numpy.linalg.norm. """ - self._add_generic_pointwise(self._add_norm,{'x':x},{'ord':ord}) + def norm(x: Dict[str, Any], ord: Union[int, float, Literal['fro', 'nuc']]) -> Dict[str, Any]: + o = ord + if len(x['data'].shape) == 2: + axis: Union[int, Tuple[int, int]] = 1 + t = 'vector' + if o is None: o = 2 + elif len(x['data'].shape) == 3: + axis = (1,2) + t = 'tensor' + if o is None: o = 'fro' + else: + raise ValueError(f'invalid shape of {x["label"]}') + + return { + 'data': np.linalg.norm(x['data'],ord=o,axis=axis,keepdims=True), + 'label': f"|{x['label']}|_{o}", + 'meta': { + 'unit': x['meta']['unit'], + 'description': f"{o}-norm of {t} {x['label']} ({x['meta']['description']})", + 'creator': 'add_norm' + } + } + + self._add_generic_pointwise(norm,{'x':x},{'ord':ord}) - @staticmethod - def _add_stress_second_Piola_Kirchhoff(P: Dict[str, Any], F: Dict[str, Any]) -> Dict[str, Any]: - return { - 'data': mechanics.stress_second_Piola_Kirchhoff(P['data'],F['data']), - 'label': 'S', - 'meta': { - 'unit': P['meta']['unit'], - 'description': "second Piola-Kirchhoff stress calculated " - f"from {P['label']} ({P['meta']['description']})" - f" and {F['label']} ({F['meta']['description']})", - 'creator': 'add_stress_second_Piola_Kirchhoff' - } - } def add_stress_second_Piola_Kirchhoff(self, P: str = 'P', F: str = 'F'): @@ -1069,34 +1062,23 @@ class Result: is taken into account. """ - self._add_generic_pointwise(self._add_stress_second_Piola_Kirchhoff,{'P':P,'F':F}) + def stress_second_Piola_Kirchhoff(P: Dict[str, Any], F: Dict[str, Any]) -> Dict[str, Any]: + return { + 'data': mechanics.stress_second_Piola_Kirchhoff(P['data'],F['data']), + 'label': 'S', + 'meta': { + 'unit': P['meta']['unit'], + 'description': "second Piola-Kirchhoff stress calculated " + f"from {P['label']} ({P['meta']['description']})" + f" and {F['label']} ({F['meta']['description']})", + 'creator': 'add_stress_second_Piola_Kirchhoff' + } + } + + self._add_generic_pointwise(stress_second_Piola_Kirchhoff,{'P':P,'F':F}) - @staticmethod - def _add_pole(q: Dict[str, Any], - uvw: FloatSequence, - hkl: FloatSequence, - with_symmetry: bool, - normalize: bool) -> Dict[str, Any]: - c = q['meta']['c/a'] if 'c/a' in q['meta'] else 1 - brackets = ['[]','()','⟨⟩','{}'][(uvw is None)*1+with_symmetry*2] - label = 'p^' + '{}{} {} {}{}'.format(brackets[0], - *(uvw if uvw else hkl), - brackets[-1],) - ori = Orientation(q['data'],lattice=q['meta']['lattice'],a=1,c=c) - - return { - 'data': ori.to_pole(uvw=uvw,hkl=hkl,with_symmetry=with_symmetry,normalize=normalize), - 'label': label, - 'meta' : { - 'unit': '1', - 'description': f'{"normalized " if normalize else ""}lab frame vector along lattice ' \ - + ('direction' if uvw is not None else 'plane') \ - + ('s' if with_symmetry else ''), - 'creator': 'add_pole' - } - } def add_pole(self, q: str = 'O', *, @@ -1122,22 +1104,33 @@ class Result: Defaults to True. """ - self._add_generic_pointwise(self._add_pole, - {'q':q}, - {'uvw':uvw,'hkl':hkl,'with_symmetry':with_symmetry,'normalize':normalize}) + def pole(q: Dict[str, Any], + uvw: FloatSequence, + hkl: FloatSequence, + with_symmetry: bool, + normalize: bool) -> Dict[str, Any]: + c = q['meta']['c/a'] if 'c/a' in q['meta'] else 1 + brackets = ['[]','()','⟨⟩','{}'][(uvw is None)*1+with_symmetry*2] + label = 'p^' + '{}{} {} {}{}'.format(brackets[0], + *(uvw if uvw else hkl), + brackets[-1],) + ori = Orientation(q['data'],lattice=q['meta']['lattice'],a=1,c=c) + + return { + 'data': ori.to_pole(uvw=uvw,hkl=hkl,with_symmetry=with_symmetry,normalize=normalize), + 'label': label, + 'meta' : { + 'unit': '1', + 'description': f'{"normalized " if normalize else ""}lab frame vector along lattice ' \ + + ('direction' if uvw is not None else 'plane') \ + + ('s' if with_symmetry else ''), + 'creator': 'add_pole' + } + } + + self._add_generic_pointwise(pole,{'q':q},{'uvw':uvw,'hkl':hkl,'with_symmetry':with_symmetry,'normalize':normalize}) - @staticmethod - def _add_rotation(F: Dict[str, Any]) -> Dict[str, Any]: - return { - 'data': mechanics.rotation(F['data']).as_matrix(), - 'label': f"R({F['label']})", - 'meta': { - 'unit': F['meta']['unit'], - 'description': f"rotational part of {F['label']} ({F['meta']['description']})", - 'creator': 'add_rotation' - } - } def add_rotation(self, F: str): """ Add rotational part of a deformation gradient. @@ -1156,20 +1149,20 @@ class Result: >>> r.add_rotation('F') """ - self._add_generic_pointwise(self._add_rotation,{'F':F}) + def rotation(F: Dict[str, Any]) -> Dict[str, Any]: + return { + 'data': mechanics.rotation(F['data']).as_matrix(), + 'label': f"R({F['label']})", + 'meta': { + 'unit': F['meta']['unit'], + 'description': f"rotational part of {F['label']} ({F['meta']['description']})", + 'creator': 'add_rotation' + } + } + + self._add_generic_pointwise(rotation,{'F':F}) - @staticmethod - def _add_spherical(T: Dict[str, Any]) -> Dict[str, Any]: - return { - 'data': tensor.spherical(T['data'],False), - 'label': f"p_{T['label']}", - 'meta': { - 'unit': T['meta']['unit'], - 'description': f"spherical component of tensor {T['label']} ({T['meta']['description']})", - 'creator': 'add_spherical' - } - } def add_spherical(self, T: str): """ Add the spherical (hydrostatic) part of a tensor. @@ -1188,22 +1181,20 @@ class Result: >>> r.add_spherical('sigma') """ - self._add_generic_pointwise(self._add_spherical,{'T':T}) + def spherical(T: Dict[str, Any]) -> Dict[str, Any]: + return { + 'data': tensor.spherical(T['data'],False), + 'label': f"p_{T['label']}", + 'meta': { + 'unit': T['meta']['unit'], + 'description': f"spherical component of tensor {T['label']} ({T['meta']['description']})", + 'creator': 'add_spherical' + } + } + + self._add_generic_pointwise(spherical,{'T':T}) - @staticmethod - def _add_strain(F: Dict[str, Any], t: Literal['V', 'U'], m: float) -> Dict[str, Any]: - side = 'left' if t == 'V' else 'right' - return { - 'data': mechanics.strain(F['data'],t,m), - 'label': f"epsilon_{t}^{m}({F['label']})", - 'meta': { - 'unit': F['meta']['unit'], - 'description': f'Seth-Hill strain tensor of order {m} based on {side} stretch tensor '+\ - f"of {F['label']} ({F['meta']['description']})", - 'creator': 'add_strain' - } - } def add_strain(self, F: str = 'F', t: Literal['V', 'U'] = 'V', @@ -1264,21 +1255,22 @@ class Result: | https://de.wikipedia.org/wiki/Verzerrungstensor """ - self._add_generic_pointwise(self._add_strain,{'F':F},{'t':t,'m':m}) + def strain(F: Dict[str, Any], t: Literal['V', 'U'], m: float) -> Dict[str, Any]: + side = 'left' if t == 'V' else 'right' + return { + 'data': mechanics.strain(F['data'],t,m), + 'label': f"epsilon_{t}^{m}({F['label']})", + 'meta': { + 'unit': F['meta']['unit'], + 'description': f'Seth-Hill strain tensor of order {m} based on {side} stretch tensor '+\ + f"of {F['label']} ({F['meta']['description']})", + 'creator': 'add_strain' + } + } + + self._add_generic_pointwise(strain,{'F':F},{'t':t,'m':m}) - @staticmethod - def _add_stretch_tensor(F: Dict[str, Any], t: str) -> Dict[str, Any]: - return { - 'data': (mechanics.stretch_left if t.upper() == 'V' else mechanics.stretch_right)(F['data']), - 'label': f"{t}({F['label']})", - 'meta': { - 'unit': F['meta']['unit'], - 'description': f"{'left' if t.upper() == 'V' else 'right'} stretch tensor "\ - +f"of {F['label']} ({F['meta']['description']})", # noqa - 'creator': 'add_stretch_tensor' - } - } def add_stretch_tensor(self, F: str = 'F', t: Literal['V', 'U'] = 'V'): @@ -1294,20 +1286,21 @@ class Result: Defaults to 'V'. """ - self._add_generic_pointwise(self._add_stretch_tensor,{'F':F},{'t':t}) + def stretch_tensor(F: Dict[str, Any], t: str) -> Dict[str, Any]: + return { + 'data': (mechanics.stretch_left if t.upper() == 'V' else mechanics.stretch_right)(F['data']), + 'label': f"{t}({F['label']})", + 'meta': { + 'unit': F['meta']['unit'], + 'description': f"{'left' if t.upper() == 'V' else 'right'} stretch tensor "\ + +f"of {F['label']} ({F['meta']['description']})", # noqa + 'creator': 'add_stretch_tensor' + } + } + + self._add_generic_pointwise(stretch_tensor,{'F':F},{'t':t}) - @staticmethod - def _add_curl(f: Dict[str, Any], size: np.ndarray) -> Dict[str, Any]: - return { - 'data': grid_filters.curl(size,f['data']), - 'label': f"curl({f['label']})", - 'meta': { - 'unit': f['meta']['unit']+'/m', - 'description': f"curl of {f['label']} ({f['meta']['description']})", - 'creator': 'add_curl' - } - } def add_curl(self, f: str): """ Add curl of a field. @@ -1323,20 +1316,20 @@ class Result: i.e. fields resulting from the grid solver. """ - self._add_generic_grid(self._add_curl,{'f':f},{'size':self.size}) + def curl(f: Dict[str, Any], size: np.ndarray) -> Dict[str, Any]: + return { + 'data': grid_filters.curl(size,f['data']), + 'label': f"curl({f['label']})", + 'meta': { + 'unit': f['meta']['unit']+'/m', + 'description': f"curl of {f['label']} ({f['meta']['description']})", + 'creator': 'add_curl' + } + } + + self._add_generic_grid(curl,{'f':f},{'size':self.size}) - @staticmethod - def _add_divergence(f: Dict[str, Any], size: np.ndarray) -> Dict[str, Any]: - return { - 'data': grid_filters.divergence(size,f['data']), - 'label': f"divergence({f['label']})", - 'meta': { - 'unit': f['meta']['unit']+'/m', - 'description': f"divergence of {f['label']} ({f['meta']['description']})", - 'creator': 'add_divergence' - } - } def add_divergence(self, f: str): """ Add divergence of a field. @@ -1352,21 +1345,20 @@ class Result: i.e. fields resulting from the grid solver. """ - self._add_generic_grid(self._add_divergence,{'f':f},{'size':self.size}) + def divergence(f: Dict[str, Any], size: np.ndarray) -> Dict[str, Any]: + return { + 'data': grid_filters.divergence(size,f['data']), + 'label': f"divergence({f['label']})", + 'meta': { + 'unit': f['meta']['unit']+'/m', + 'description': f"divergence of {f['label']} ({f['meta']['description']})", + 'creator': 'add_divergence' + } + } + + self._add_generic_grid(divergence,{'f':f},{'size':self.size}) - @staticmethod - def _add_gradient(f: Dict[str, Any], size: np.ndarray) -> Dict[str, Any]: - return { - 'data': grid_filters.gradient(size,f['data'] if len(f['data'].shape) == 4 else \ - f['data'].reshape(f['data'].shape+(1,))), - 'label': f"gradient({f['label']})", - 'meta': { - 'unit': f['meta']['unit']+'/m', - 'description': f"gradient of {f['label']} ({f['meta']['description']})", - 'creator': 'add_gradient' - } - } def add_gradient(self, f: str): """ Add gradient of a field. @@ -1382,7 +1374,19 @@ class Result: i.e. fields resulting from the grid solver. """ - self._add_generic_grid(self._add_gradient,{'f':f},{'size':self.size}) + def gradient(f: Dict[str, Any], size: np.ndarray) -> Dict[str, Any]: + return { + 'data': grid_filters.gradient(size,f['data'] if len(f['data'].shape) == 4 else \ + f['data'].reshape(f['data'].shape+(1,))), + 'label': f"gradient({f['label']})", + 'meta': { + 'unit': f['meta']['unit']+'/m', + 'description': f"gradient of {f['label']} ({f['meta']['description']})", + 'creator': 'add_gradient' + } + } + + self._add_generic_grid(gradient,{'f':f},{'size':self.size}) def _add_generic_grid(self, @@ -1444,26 +1448,6 @@ class Result: f'damask.Result.{creator} v{damask.version}'.encode() - def _job_pointwise(self, - group: str, - callback: Callable, - datasets: Dict[str, str], - args: Dict[str, str]) -> List[Union[None, Any]]: - """Execute job for _add_generic_pointwise.""" - try: - datasets_in = {} - with h5py.File(self.fname,'r') as f: - for arg,label in datasets.items(): - loc = f[group+'/'+label] - datasets_in[arg]={'data' :loc[()], - 'label':label, - 'meta': {k:(v.decode() if not h5py3 and type(v) is bytes else v) \ - for k,v in loc.attrs.items()}} - r = callback(**datasets_in,**args) - return [group,r] - except Exception as err: - print(f'Error during calculation: {err}.') - return [None,None] def _add_generic_pointwise(self, @@ -1485,6 +1469,27 @@ class Result: Arguments parsed to func. """ + + def job_pointwise(group: str, + callback: Callable, + datasets: Dict[str, str], + args: Dict[str, str]) -> List[Union[None, Any]]: + """Execute job for _add_generic_pointwise.""" + try: + datasets_in = {} + with h5py.File(self.fname,'r') as f: + for arg,label in datasets.items(): + loc = f[group+'/'+label] + datasets_in[arg]={'data' :loc[()], + 'label':label, + 'meta': {k:(v.decode() if not h5py3 and type(v) is bytes else v) \ + for k,v in loc.attrs.items()}} + r = callback(**datasets_in,**args) + return [group,r] + except Exception as err: + print(f'Error during calculation: {err}.') + return [None,None] + groups = [] with h5py.File(self.fname,'r') as f: for inc in self.visible['increments']: @@ -1498,7 +1503,7 @@ class Result: print('No matching dataset found, no data was added.') return - default_arg = partial(self._job_pointwise,callback=func,datasets=datasets,args=args) + default_arg = partial(job_pointwise,callback=func,datasets=datasets,args=args) for grp in util.show_progress(groups): group, result = default_arg(grp) # type: ignore From ee4cfe4b24db49c832fbd27cac2f14159d7667b7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Sep 2023 10:58:46 +0200 Subject: [PATCH 181/198] new name 'prod' was introduced in numpy 1.7, 'product' will be removed in 2.0 --- python/tests/test_Result.py | 2 +- python/tests/test_grid_filters.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index a775e1c2d..8b92238ae 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -326,7 +326,7 @@ class TestResult: if shape == 'pseudo_scalar': default.add_calculation('#F#[:,0,0:1]','x','1','a pseudo scalar') if shape == 'scalar': default.add_calculation('#F#[:,0,0]','x','1','just a scalar') if shape == 'vector': default.add_calculation('#F#[:,:,1]','x','1','just a vector') - x = default.place('x').reshape((np.product(default.cells),-1)) + x = default.place('x').reshape((np.prod(default.cells),-1)) default.add_gradient('x') in_file = default.place('gradient(x)') in_memory = grid_filters.gradient(default.size,x.reshape(tuple(default.cells)+x.shape[1:])).reshape(in_file.shape) diff --git a/python/tests/test_grid_filters.py b/python/tests/test_grid_filters.py index 20575f2bd..d19bf03e9 100644 --- a/python/tests/test_grid_filters.py +++ b/python/tests/test_grid_filters.py @@ -398,7 +398,7 @@ class TestGridFilters: np.arange(cells[1]), np.arange(cells[2]),indexing='ij')).reshape(tuple(cells)+(3,),order='F') x,y,z = map(np.random.randint,cells) - assert grid_filters.ravel_index(indices)[x,y,z] == np.arange(0,np.product(cells)).reshape(cells,order='F')[x,y,z] + assert grid_filters.ravel_index(indices)[x,y,z] == np.arange(0,np.prod(cells)).reshape(cells,order='F')[x,y,z] def test_unravel_index(self): cells = np.random.randint(8,32,(3)) From d832d4cf17e1ecfa8a6c2932cae1c973478bfb6b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Sep 2023 14:11:25 +0200 Subject: [PATCH 182/198] improved documentation --- python/damask/_configmaterial.py | 22 +++++++++++++--------- python/damask/_grid.py | 14 +++++++++++--- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index 2eba905a6..f83c12147 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -106,11 +106,8 @@ class ConfigMaterial(Config): Load DREAM.3D (HDF5) file. Data in DREAM.3D files can be stored per cell ('CellData') - and/or per grain ('Grain Data'). Per default, cell-wise data - is assumed. - - damask.Grid.load_DREAM3D allows to get the corresponding geometry - for the grid solver. + and/or per grain ('Grain Data'). Per default, i.e. if + 'grain_data' is None, cell-wise data is assumed. Parameters ---------- @@ -140,15 +137,22 @@ class ConfigMaterial(Config): and grain- or cell-wise data. Defaults to None, in which case it is set as the path that contains _SIMPL_GEOMETRY/SPACING. - Notes - ----- - Homogenization and phase entries are emtpy and need to be defined separately. - Returns ------- loaded : damask.ConfigMaterial Material configuration from file. + Notes + ----- + damask.Grid.load_DREAM3D gives the corresponding geometry for + the grid solver. + + For cell-wise data, only unique combinations of + orientation and phase are considered. + + Homogenization and phase entries are emtpy and need to be + defined separately. + """ b = util.DREAM3D_base_group(fname) if base_group is None else base_group c = util.DREAM3D_cell_data_group(fname) if cell_data is None else cell_data diff --git a/python/damask/_grid.py b/python/damask/_grid.py index a0571279c..01ad3ad6f 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -358,10 +358,10 @@ class Grid: """ Load DREAM.3D (HDF5) file. - Data in DREAM.3D files can be stored per cell ('CellData') and/or - per grain ('Grain Data'). Per default, cell-wise data is assumed. + Data in DREAM.3D files can be stored per cell ('CellData') + and/or per grain ('Grain Data'). Per default, i.e. if + 'feature_IDs' is None, cell-wise data is assumed. - damask.ConfigMaterial.load_DREAM3D gives the corresponding material definition. Parameters ---------- @@ -392,6 +392,14 @@ class Grid: loaded : damask.Grid Grid-based geometry from file. + Notes + ----- + damask.ConfigMaterial.load_DREAM3D gives the corresponding + material definition. + + For cell-wise data, only unique combinations of + orientation and phase are considered. + """ b = util.DREAM3D_base_group(fname) if base_group is None else base_group c = util.DREAM3D_cell_data_group(fname) if cell_data is None else cell_data From 36d2ae1c2a2ed14e018384d437314374b1fd4627 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Sep 2023 15:14:54 +0200 Subject: [PATCH 183/198] avoid repeated opening of files --- python/damask/util.py | 34 +++++++++++++++++++++------------- python/tests/test_util.py | 18 ++++++++++++------ 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/python/damask/util.py b/python/damask/util.py index d61ca221b..5e5495e43 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -698,7 +698,7 @@ def pass_on(keyword: str, return wrapper return decorator -def DREAM3D_base_group(fname: _Union[str, _Path]) -> str: +def DREAM3D_base_group(fname: _Union[str, _Path, _h5py.File]) -> str: """ Determine the base group of a DREAM.3D file. @@ -707,7 +707,7 @@ def DREAM3D_base_group(fname: _Union[str, _Path]) -> str: Parameters ---------- - fname : str or pathlib.Path + fname : str, pathlib.Path, or _h5py.File Filename of the DREAM.3D (HDF5) file. Returns @@ -716,15 +716,19 @@ def DREAM3D_base_group(fname: _Union[str, _Path]) -> str: Path to the base group. """ - with _h5py.File(_Path(fname).expanduser(),'r') as f: + def get_base_group(f: _h5py.File) -> str: base_group = f.visit(lambda path: path.rsplit('/',2)[0] if '_SIMPL_GEOMETRY/SPACING' in path else None) + if base_group is None: + raise ValueError(f'could not determine base group in file "{fname}"') + return base_group - if base_group is None: - raise ValueError(f'could not determine base group in file "{fname}"') + if isinstance(fname,_h5py.File): + return get_base_group(fname) - return base_group + with _h5py.File(_Path(fname).expanduser(),'r') as f: + return get_base_group(f) -def DREAM3D_cell_data_group(fname: _Union[str, _Path]) -> str: +def DREAM3D_cell_data_group(fname: _Union[str, _Path, _h5py.File]) -> str: """ Determine the cell data group of a DREAM.3D file. @@ -734,7 +738,7 @@ def DREAM3D_cell_data_group(fname: _Union[str, _Path]) -> str: Parameters ---------- - fname : str or pathlib.Path + fname : str, pathlib.Path, or h5py.File Filename of the DREAM.3D (HDF5) file. Returns @@ -743,17 +747,21 @@ def DREAM3D_cell_data_group(fname: _Union[str, _Path]) -> str: Path to the cell data group. """ - base_group = DREAM3D_base_group(fname) - with _h5py.File(_Path(fname).expanduser(),'r') as f: + def get_cell_data_group(f: _h5py.File) -> str: + base_group = DREAM3D_base_group(f) cells = tuple(f['/'.join([base_group,'_SIMPL_GEOMETRY','DIMENSIONS'])][()][::-1]) cell_data_group = f[base_group].visititems(lambda path,obj: path.split('/')[0] \ if isinstance(obj,_h5py._hl.dataset.Dataset) and _np.shape(obj)[:-1] == cells \ else None) + if cell_data_group is None: + raise ValueError(f'could not determine cell-data group in file "{fname}/{base_group}"') + return cell_data_group - if cell_data_group is None: - raise ValueError(f'could not determine cell-data group in file "{fname}/{base_group}"') + if isinstance(fname,_h5py.File): + return get_cell_data_group(fname) - return cell_data_group + with _h5py.File(_Path(fname).expanduser(),'r') as f: + return get_cell_data_group(f) def Bravais_to_Miller(*, diff --git a/python/tests/test_util.py b/python/tests/test_util.py index 1c765727c..28e90f9f3 100644 --- a/python/tests/test_util.py +++ b/python/tests/test_util.py @@ -146,21 +146,25 @@ class TestUtil: assert 'DAMASK' in style('DAMASK') @pytest.mark.parametrize('complete',[True,False]) - def test_D3D_base_group(self,tmp_path,complete): + @pytest.mark.parametrize('fhandle',[True,False]) + def test_D3D_base_group(self,tmp_path,complete,fhandle): base_group = ''.join(random.choices('DAMASK', k=10)) with h5py.File(tmp_path/'base_group.dream3d','w') as f: f.create_group('/'.join((base_group,'_SIMPL_GEOMETRY'))) if complete: f['/'.join((base_group,'_SIMPL_GEOMETRY'))].create_dataset('SPACING',data=np.ones(3)) + fname = tmp_path/'base_group.dream3d' + if fhandle: fname = h5py.File(fname) if complete: - assert base_group == util.DREAM3D_base_group(tmp_path/'base_group.dream3d') + assert base_group == util.DREAM3D_base_group(fname) else: with pytest.raises(ValueError): - util.DREAM3D_base_group(tmp_path/'base_group.dream3d') + util.DREAM3D_base_group(fname) @pytest.mark.parametrize('complete',[True,False]) - def test_D3D_cell_data_group(self,tmp_path,complete): + @pytest.mark.parametrize('fhandle',[True,False]) + def test_D3D_cell_data_group(self,tmp_path,complete,fhandle): base_group = ''.join(random.choices('DAMASK', k=10)) cell_data_group = ''.join(random.choices('KULeuven', k=10)) cells = np.random.randint(1,50,3) @@ -172,11 +176,13 @@ class TestUtil: if complete: f['/'.join((base_group,cell_data_group))].create_dataset('data',shape=np.append(cells,1)) + fname = tmp_path/'cell_data_group.dream3d' + if fhandle: fname = h5py.File(fname) if complete: - assert cell_data_group == util.DREAM3D_cell_data_group(tmp_path/'cell_data_group.dream3d') + assert cell_data_group == util.DREAM3D_cell_data_group(fname) else: with pytest.raises(ValueError): - util.DREAM3D_cell_data_group(tmp_path/'cell_data_group.dream3d') + util.DREAM3D_cell_data_group(fname) @pytest.mark.parametrize('full,reduced',[({}, {}), From 4a943ff844b90e9f402ea1bebeb429c4b2929c91 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Sep 2023 15:15:52 +0200 Subject: [PATCH 184/198] ensure closed file --- python/damask/_configmaterial.py | 38 ++++++++++++++++---------------- python/damask/_grid.py | 30 ++++++++++++------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index f83c12147..20037737e 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -111,7 +111,7 @@ class ConfigMaterial(Config): Parameters ---------- - fname : str + fname : str or pathlib.Path Filename of the DREAM.3D (HDF5) file. grain_data : str Name of the group (folder) containing grain-wise data. Defaults @@ -154,26 +154,26 @@ class ConfigMaterial(Config): defined separately. """ - b = util.DREAM3D_base_group(fname) if base_group is None else base_group - c = util.DREAM3D_cell_data_group(fname) if cell_data is None else cell_data - f = h5py.File(fname,'r') + with h5py.File(fname, 'r') as f: + b = util.DREAM3D_base_group(f) if base_group is None else base_group + c = util.DREAM3D_cell_data_group(f) if cell_data is None else cell_data - if grain_data is None: - phase = f['/'.join([b,c,phases])][()].flatten() - O = Rotation.from_Euler_angles(f['/'.join([b,c,Euler_angles])]).as_quaternion().reshape(-1,4) # noqa - _,idx = np.unique(np.hstack([O,phase.reshape(-1,1)]),return_index=True,axis=0) - idx = np.sort(idx) - else: - phase = f['/'.join([b,grain_data,phases])][()] - O = Rotation.from_Euler_angles(f['/'.join([b,grain_data,Euler_angles])]).as_quaternion() # noqa - idx = np.arange(phase.size) + if grain_data is None: + phase = f['/'.join([b,c,phases])][()].flatten() + O = Rotation.from_Euler_angles(f['/'.join([b,c,Euler_angles])]).as_quaternion().reshape(-1,4) # noqa + _,idx = np.unique(np.hstack([O,phase.reshape(-1,1)]),return_index=True,axis=0) + idx = np.sort(idx) + else: + phase = f['/'.join([b,grain_data,phases])][()] + O = Rotation.from_Euler_angles(f['/'.join([b,grain_data,Euler_angles])]).as_quaternion() # noqa + idx = np.arange(phase.size) - if cell_ensemble_data is not None and phase_names is not None: - try: - names = np.array([s.decode() for s in f['/'.join([b,cell_ensemble_data,phase_names])]]) - phase = names[phase] - except KeyError: - pass + if cell_ensemble_data is not None and phase_names is not None: + try: + names = np.array([s.decode() for s in f['/'.join([b,cell_ensemble_data,phase_names])]]) + phase = names[phase] + except KeyError: + pass base_config = ConfigMaterial({'phase':{k if isinstance(k,int) else str(k): None for k in np.unique(phase)}, diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 01ad3ad6f..a8df4f877 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -365,7 +365,7 @@ class Grid: Parameters ---------- - fname : str or or pathlib.Path + fname : str or pathlib.Path Filename of the DREAM.3D (HDF5) file. feature_IDs : str, optional Name of the dataset containing the mapping between cells and @@ -401,22 +401,22 @@ class Grid: orientation and phase are considered. """ - b = util.DREAM3D_base_group(fname) if base_group is None else base_group - c = util.DREAM3D_cell_data_group(fname) if cell_data is None else cell_data - f = h5py.File(fname, 'r') + with h5py.File(fname, 'r') as f: + b = util.DREAM3D_base_group(f) if base_group is None else base_group + c = util.DREAM3D_cell_data_group(f) if cell_data is None else cell_data - cells = f['/'.join([b,'_SIMPL_GEOMETRY','DIMENSIONS'])][()] - size = f['/'.join([b,'_SIMPL_GEOMETRY','SPACING'])] * cells - origin = f['/'.join([b,'_SIMPL_GEOMETRY','ORIGIN'])][()] + cells = f['/'.join([b,'_SIMPL_GEOMETRY','DIMENSIONS'])][()] + size = f['/'.join([b,'_SIMPL_GEOMETRY','SPACING'])] * cells + origin = f['/'.join([b,'_SIMPL_GEOMETRY','ORIGIN'])][()] - if feature_IDs is None: - phase = f['/'.join([b,c,phases])][()].reshape(-1,1) - O = Rotation.from_Euler_angles(f['/'.join([b,c,Euler_angles])]).as_quaternion().reshape(-1,4) # noqa - unique,unique_inverse = np.unique(np.hstack([O,phase]),return_inverse=True,axis=0) - ma = np.arange(cells.prod()) if len(unique) == cells.prod() else \ - np.arange(unique.size)[np.argsort(pd.unique(unique_inverse))][unique_inverse] - else: - ma = f['/'.join([b,c,feature_IDs])][()].flatten() + if feature_IDs is None: + phase = f['/'.join([b,c,phases])][()].reshape(-1,1) + O = Rotation.from_Euler_angles(f['/'.join([b,c,Euler_angles])]).as_quaternion().reshape(-1,4) # noqa + unique,unique_inverse = np.unique(np.hstack([O,phase]),return_inverse=True,axis=0) + ma = np.arange(cells.prod()) if len(unique) == cells.prod() else \ + np.arange(unique.size)[np.argsort(pd.unique(unique_inverse))][unique_inverse] + else: + ma = f['/'.join([b,c,feature_IDs])][()].flatten() return Grid(material = ma.reshape(cells,order='F'), size = size, From 8b421ba7a77123ea47019ddfd420075308e2acab Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 23 Sep 2023 06:20:25 +0200 Subject: [PATCH 185/198] simplified --- python/damask/_result.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 9cef7093d..69662cd02 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1473,8 +1473,7 @@ class Result: def job_pointwise(group: str, callback: Callable, datasets: Dict[str, str], - args: Dict[str, str]) -> List[Union[None, Any]]: - """Execute job for _add_generic_pointwise.""" + args: Dict[str, str]) -> Union[None, Any]: try: datasets_in = {} with h5py.File(self.fname,'r') as f: @@ -1484,11 +1483,10 @@ class Result: 'label':label, 'meta': {k:(v.decode() if not h5py3 and type(v) is bytes else v) \ for k,v in loc.attrs.items()}} - r = callback(**datasets_in,**args) - return [group,r] + return callback(**datasets_in,**args) except Exception as err: print(f'Error during calculation: {err}.') - return [None,None] + return None groups = [] with h5py.File(self.fname,'r') as f: @@ -1505,9 +1503,8 @@ class Result: default_arg = partial(job_pointwise,callback=func,datasets=datasets,args=args) - for grp in util.show_progress(groups): - group, result = default_arg(grp) # type: ignore - if not result: + for group in util.show_progress(groups): + if not (result := default_arg(group)): # type: ignore continue with h5py.File(self.fname, 'a') as f: try: From a99daf5e14c16c746c9e3daf70e5f6ee7bfbfa77 Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 24 Sep 2023 03:16:13 +0200 Subject: [PATCH 186/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-817-g57d8a6c43 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 821be3454..08a0d8e9c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-812-g96699f994 +3.0.0-alpha7-817-g57d8a6c43 From c619bed9753316c55a67ade41b9ca07ac1a07d62 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 24 Sep 2023 06:31:36 +0200 Subject: [PATCH 187/198] let the compiler do the work compilers are aware of the FMA instruction and use it --- src/math.f90 | 10 ---------- src/phase_mechanical.f90 | 30 ------------------------------ src/polynomials.f90 | 4 ---- 3 files changed, 44 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 24141f4e9..0fd3a9ba7 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -1047,26 +1047,16 @@ pure subroutine math_eigh33(w,v,m) U = max(T, T**2) threshold = sqrt(5.68e-14_pREAL * U**2) -#ifndef __INTEL_LLVM_COMPILER v(1:3,1) = [m(1,3)*w(1) + v(1,2), & m(2,3)*w(1) + v(2,2), & -#else - v(1:3,1) = [IEEE_FMA(m(1,3),w(1),v(1,2)), & - IEEE_FMA(m(2,3),w(1),v(2,2)), & -#endif (m(1,1) - w(1)) * (m(2,2) - w(1)) - v(3,2)] norm = norm2(v(1:3, 1)) fallback1: if (norm < threshold) then call math_eigh(w,v,error,m) else fallback1 v(1:3,1) = v(1:3, 1) / norm -#ifndef __INTEL_LLVM_COMPILER v(1:3,2) = [m(1,3)*w(2) + v(1,2), & m(2,3)*w(2) + v(2,2), & -#else - v(1:3,2) = [IEEE_FMA(m(1,3),w(2),v(1,2)), & - IEEE_FMA(m(2,3),w(2),v(2,2)), & -#endif (m(1,1) - w(2)) * (m(2,2) - w(2)) - v(3,2)] norm = norm2(v(1:3, 2)) fallback2: if (norm < threshold) then diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index e7103bedc..beb968875 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -693,11 +693,7 @@ function integrateStateEuler(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(broken) if (any(IEEE_is_NaN(dotState))) return sizeDotState = plasticState(ph)%sizeDotState -#ifndef __INTEL_LLVM_COMPILER plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState*Delta_t -#else - plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,state0) -#endif broken = plastic_deltaState(ph,en) if (broken) return @@ -736,11 +732,7 @@ function integrateStateAdaptiveEuler(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result( sizeDotState = plasticState(ph)%sizeDotState r = - dotState * 0.5_pREAL * Delta_t -#ifndef __INTEL_LLVM_COMPILER plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState*Delta_t -#else - plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,state0) -#endif broken = plastic_deltaState(ph,en) if (broken) return @@ -861,18 +853,10 @@ function integrateStateRK(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en,A,B,C,DB) result(br dotState = A(1,stage) * plastic_RKdotState(1:sizeDotState,1) do n = 2, stage -#ifndef __INTEL_LLVM_COMPILER dotState = dotState + A(n,stage)*plastic_RKdotState(1:sizeDotState,n) -#else - dotState = IEEE_FMA(A(n,stage),plastic_RKdotState(1:sizeDotState,n),dotState) -#endif end do -#ifndef __INTEL_LLVM_COMPILER plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState*Delta_t -#else - plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,state0) -#endif broken = integrateStress(F_0+(F-F_0)*Delta_t*C(stage),Fp0,Fi0,Delta_t*C(stage), ph,en) if (broken) exit @@ -886,11 +870,7 @@ function integrateStateRK(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en,A,B,C,DB) result(br plastic_RKdotState(1:sizeDotState,size(B)) = dotState dotState = matmul(plastic_RKdotState,B) -#ifndef __INTEL_LLVM_COMPILER plasticState(ph)%state(1:sizeDotState,en) = state0 + dotState*Delta_t -#else - plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,state0) -#endif if (present(DB)) & broken = .not. converged(matmul(plastic_RKdotState(1:sizeDotState,1:size(DB)),DB) * Delta_t, & @@ -1174,18 +1154,12 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) else lhs_3333 = 0.0_pREAL; rhs_3333 = 0.0_pREAL do o=1,3; do p=1,3 -#ifndef __INTEL_LLVM_COMPILER lhs_3333(1:3,1:3,o,p) = lhs_3333(1:3,1:3,o,p) & + matmul(invSubFi0,dLidFi(1:3,1:3,o,p)) * Delta_t lhs_3333(1:3,o,1:3,p) = lhs_3333(1:3,o,1:3,p) & + invFi*invFi(p,o) rhs_3333(1:3,1:3,o,p) = rhs_3333(1:3,1:3,o,p) & - matmul(invSubFi0,dLidS(1:3,1:3,o,p)) * Delta_t -#else - lhs_3333(1:3,1:3,o,p) = IEEE_FMA(matmul(invSubFi0,dLidFi(1:3,1:3,o,p)),Delta_t,lhs_3333(1:3,1:3,o,p)) - lhs_3333(1:3,o,1:3,p) = IEEE_FMA(invFi,invFi(p,o),lhs_3333(1:3,o,1:3,p)) - rhs_3333(1:3,1:3,o,p) = IEEE_FMA(matmul(invSubFi0,dLidS(1:3,1:3,o,p)),-Delta_t,rhs_3333(1:3,1:3,o,p)) -#endif end do; end do call math_invert(temp_99,error,math_3333to99(lhs_3333)) if (error) then @@ -1214,12 +1188,8 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) temp_3333(1:3,1:3,p,o) = matmul(matmul(temp_33_2,dLpdS(1:3,1:3,p,o)), invFi) & + matmul(temp_33_3,dLidS(1:3,1:3,p,o)) end do; end do -#ifndef __INTEL_LLVM_COMPILER lhs_3333 = math_mul3333xx3333(dSdFe,temp_3333) * Delta_t & + math_mul3333xx3333(dSdFi,dFidS) -#else - lhs_3333 = IEEE_FMA(math_mul3333xx3333(dSdFe,temp_3333),Delta_t,math_mul3333xx3333(dSdFi,dFidS)) -#endif call math_invert(temp_99,error,math_eye(9)+math_3333to99(lhs_3333)) if (error) then diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 062f99911..162b40cea 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -107,11 +107,7 @@ pure function eval(self,x) result(y) y = self%coef(ubound(self%coef,1)) do o = ubound(self%coef,1)-1, 0, -1 -#ifndef __INTEL_LLVM_COMPILER y = y*(x-self%x_ref) +self%coef(o) -#else - y = IEEE_FMA(y,x-self%x_ref,self%coef(o)) -#endif end do end function eval From eff54f9566e6a21086e21308c98697cbc15ad63f Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 24 Sep 2023 23:43:25 +0200 Subject: [PATCH 188/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-824-g5b6aeaf4b --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 08a0d8e9c..ea07b92eb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-817-g57d8a6c43 +3.0.0-alpha7-824-g5b6aeaf4b From 28cb72ced0f39b8f61c77945bfa2f9b259af9fb3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 25 Sep 2023 13:58:17 +0200 Subject: [PATCH 189/198] simplified --- python/damask/_result.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 69662cd02..f36e1e83a 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -5,8 +5,8 @@ import copy import datetime import xml.etree.ElementTree as ET # noqa import xml.dom.minidom +import functools from pathlib import Path -from functools import partial from collections import defaultdict from collections.abc import Iterable from typing import Optional, Union, Callable, Any, Sequence, Literal, Dict, List, Tuple @@ -1501,10 +1501,9 @@ class Result: print('No matching dataset found, no data was added.') return - default_arg = partial(job_pointwise,callback=func,datasets=datasets,args=args) for group in util.show_progress(groups): - if not (result := default_arg(group)): # type: ignore + if not (result := job_pointwise(group, callback=func, datasets=datasets, args=args)): # type: ignore continue with h5py.File(self.fname, 'a') as f: try: @@ -2054,7 +2053,7 @@ class Result: cfg_dir = (Path.cwd() if target_dir is None else Path(target_dir)) with h5py.File(self.fname,'r') as f_in: - f_in['setup'].visititems(partial(export, - output=output, - cfg_dir=cfg_dir, - overwrite=overwrite)) + f_in['setup'].visititems(functools.partial(export, + output=output, + cfg_dir=cfg_dir, + overwrite=overwrite)) From 96ee2af27986df9000f98e1283967a095a3a3691 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 25 Sep 2023 21:01:01 +0200 Subject: [PATCH 190/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-837-gc3d3ea658 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ea07b92eb..c4779575c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-824-g5b6aeaf4b +3.0.0-alpha7-837-gc3d3ea658 From 3621f0e8a13779587962fb71f386cc0b94472632 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 26 Sep 2023 09:17:25 -0400 Subject: [PATCH 191/198] check for N_tr, not twice N_tw --- src/phase_mechanical_plastic_dislotwin.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index a93c4752a..0bd0e1355 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -358,7 +358,7 @@ module function plastic_dislotwin_init() result(myPlasticity) !-------------------------------------------------------------------------------------------------- ! parameters required for several mechanisms and their interactions - if (prm%sum_N_sl + prm%sum_N_tw + prm%sum_N_tw > 0) & + if (prm%sum_N_sl + prm%sum_N_tw + prm%sum_N_tr > 0) & prm%D = pl%get_asReal('D') if (prm%sum_N_tw + prm%sum_N_tr > 0) then From 5f2b73f8155469d56c3bcb31cdc20a41b502202e Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 26 Sep 2023 09:44:48 -0400 Subject: [PATCH 192/198] use merged PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 4125c71c1..9d2a98d72 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 4125c71c17a7f876b9766c52f0d7ca7d5e8110a5 +Subproject commit 9d2a98d72d9bf547dd697124cb795cf6a9668d30 From 836ddb4ba570a176c6648c5b416bfe04371fba68 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 26 Sep 2023 22:27:28 +0000 Subject: [PATCH 193/198] easier to understand (and maybe failsafe against empty coef) --- src/polynomials.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 162b40cea..910441d0d 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -105,9 +105,9 @@ pure function eval(self,x) result(y) integer :: o - y = self%coef(ubound(self%coef,1)) - do o = ubound(self%coef,1)-1, 0, -1 - y = y*(x-self%x_ref) +self%coef(o) + y = 0.0_pREAL + do o = ubound(self%coef,1), 0, -1 + y = y*(x-self%x_ref) + self%coef(o) end do end function eval From 03259c8895c83089c712162b7b5531bfc74efd84 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 27 Sep 2023 12:52:14 +0200 Subject: [PATCH 194/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-854-g44916cfc4 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c4779575c..31f3e7f70 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-837-gc3d3ea658 +3.0.0-alpha7-854-g44916cfc4 From 8489658cb414f4e91d388f36fd6f8d36542d2bd9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Sep 2023 19:19:54 +0200 Subject: [PATCH 195/198] avoid use of unitialized variable (x_ref) further polishing for better readability --- src/polynomials.f90 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 910441d0d..84961a57e 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -68,26 +68,24 @@ function polynomial_from_dict(dict,y,x) result(p) type(tPolynomial) :: p real(pREAL), dimension(:), allocatable :: coef - real(pREAL) :: x_ref integer :: i, o - character(len=1) :: o_s + character :: o_s allocate(coef(1),source=dict%get_asReal(y)) - if (dict%contains(y//','//x)) then - x_ref = dict%get_asReal(x//'_ref') - coef = [coef,dict%get_asReal(y//','//x)] - end if + if (dict%contains(y//','//x)) coef = [coef,dict%get_asReal(y//','//x)] do o = 2,4 write(o_s,'(I0.0)') o - if (dict%contains(y//','//x//'^'//o_s)) then - x_ref = dict%get_asReal(x//'_ref') + if (dict%contains(y//','//x//'^'//o_s)) & coef = [coef,[(0.0_pREAL,i=size(coef),o-1)],dict%get_asReal(y//','//x//'^'//o_s)] - end if end do - p = Polynomial(coef,x_ref) + if (size(coef) > 1) then + p = polynomial(coef,dict%get_asReal(x//'_ref')) + else + p = polynomial(coef,-huge(1.0_pREAL)) + end if end function polynomial_from_dict @@ -105,8 +103,8 @@ pure function eval(self,x) result(y) integer :: o - y = 0.0_pREAL - do o = ubound(self%coef,1), 0, -1 + y = self%coef(ubound(self%coef,1)) + do o = ubound(self%coef,1)-1, 0, -1 y = y*(x-self%x_ref) + self%coef(o) end do From dab5ba1e605a801d5d7a9132916698ddc5286e83 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 26 Sep 2023 18:31:09 -0400 Subject: [PATCH 196/198] call polynomials_selfTest in DAMASK_test --- src/polynomials.f90 | 21 +++++++++++++-------- src/test/DAMASK_test.f90 | 5 +++++ src/test/test_polynomials.f90 | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 src/test/test_polynomials.f90 diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 84961a57e..3bbe5f28f 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -25,7 +25,8 @@ module polynomials public :: & polynomial, & - polynomials_init + polynomials_init, & + polynomials_selfTest contains @@ -37,7 +38,7 @@ subroutine polynomials_init() print'(/,1x,a)', '<<<+- polynomials init -+>>>'; flush(IO_STDOUT) - call selfTest() + call polynomials_selfTest() end subroutine polynomials_init @@ -114,7 +115,7 @@ end function eval !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of polynomical functionality. !-------------------------------------------------------------------------------------------------- -subroutine selfTest() +subroutine polynomials_selfTest() type(tPolynomial) :: p1, p2 real(pREAL), dimension(5) :: coef @@ -129,9 +130,9 @@ subroutine selfTest() call random_number(x_ref) call random_number(x) - coef = coef*10_pREAL -0.5_pREAL - x_ref = x_ref*10_pREAL -0.5_pREAL - x = x*10_pREAL -0.5_pREAL + coef = 10_pREAL*(coef-0.5_pREAL) + x_ref = 10_pREAL*(x_ref-0.5_pREAL) + x = 10_pREAL*(x-0.5_pREAL) p1 = polynomial([coef(1)],x_ref) if (dNeq(p1%at(x),coef(1))) error stop 'polynomial: eval(constant)' @@ -153,7 +154,11 @@ subroutine selfTest() dict => YAML_parse_str_asDict(trim(YAML_s)) p2 = polynomial(dict,'C','T') if (dNeq(p1%at(x),p2%at(x),1.0e-6_pREAL)) error stop 'polynomials: init' - y = coef(1)+coef(2)*(x-x_ref)+coef(3)*(x-x_ref)**2+coef(4)*(x-x_ref)**3+coef(5)*(x-x_ref)**4 + y = coef(1)*(x-x_ref)**0 & + + coef(2)*(x-x_ref)**1 & + + coef(3)*(x-x_ref)**2 & + + coef(4)*(x-x_ref)**3 & + + coef(5)*(x-x_ref)**4 if (dNeq(p1%at(x),y,1.0e-6_pREAL)) error stop 'polynomials: eval(full)' YAML_s = 'C: 0.0'//IO_EOL//& @@ -185,6 +190,6 @@ subroutine selfTest() if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1.0e-6_pREAL)) error stop 'polynomials: eval(quartic)' -end subroutine selfTest +end subroutine polynomials_selfTest end module polynomials diff --git a/src/test/DAMASK_test.f90 b/src/test/DAMASK_test.f90 index ae7a714b8..003519ba3 100644 --- a/src/test/DAMASK_test.f90 +++ b/src/test/DAMASK_test.f90 @@ -7,6 +7,7 @@ program DAMASK_test use test_prec use test_misc use test_math + use test_polynomials use test_tables use test_crystal use test_rotations @@ -36,6 +37,10 @@ program DAMASK_test call test_math_run() write(IO_STDOUT,fmt='(a)') ok + write(IO_STDOUT,fmt=fmt, advance='no') 'polynomials','...' + call test_polynomials_run() + write(IO_STDOUT,fmt='(a)') ok + write(IO_STDOUT,fmt=fmt, advance='no') 'tables','...' call test_tables_run() write(IO_STDOUT,fmt='(a)') ok diff --git a/src/test/test_polynomials.f90 b/src/test/test_polynomials.f90 new file mode 100644 index 000000000..dea6206a5 --- /dev/null +++ b/src/test/test_polynomials.f90 @@ -0,0 +1,17 @@ +module test_polynomials + use polynomials + + implicit none(type,external) + + private + public :: test_polynomials_run + + contains + +subroutine test_polynomials_run() + + call polynomials_selfTest() + +end subroutine test_polynomials_run + +end module test_polynomials From f1b0f680004ce5b46d347ac6a51610d2168816de Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 28 Sep 2023 07:20:09 +0200 Subject: [PATCH 197/198] do not report "self coverage" --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5f4b0ba45..0a2439020 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,7 +94,7 @@ unittest_GNU_DEBUG: - cmake --build ${TMPDIR} --target install - cd ${TMPDIR} - ./bin/DAMASK_test - - find -name \*.gcda | xargs gcov + - find -name \*.gcda -not -path "**/test/*" | xargs gcov unittest_GNU_RELEASE: stage: compile @@ -105,7 +105,7 @@ unittest_GNU_RELEASE: - cmake --build ${TMPDIR} --target install - cd ${TMPDIR} - ./bin/DAMASK_test - - find -name \*.gcda | xargs gcov + - find -name \*.gcda -not -path "**/test/*" | xargs gcov unittest_GNU_PERFORMANCE: stage: compile @@ -116,7 +116,7 @@ unittest_GNU_PERFORMANCE: - cmake --build ${TMPDIR} --target install - cd ${TMPDIR} - ./bin/DAMASK_test - - find -name \*.gcda | xargs gcov + - find -name \*.gcda -not -path "**/test/*" | xargs gcov grid_GNU: From 77675e589041e9ad7dce76f466006a13f04f85f3 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 28 Sep 2023 15:32:49 +0200 Subject: [PATCH 198/198] [skip ci] updated version information after successful test of v3.0.0-alpha7-864-g9cf37c493 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 31f3e7f70..cd37d7af8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-854-g44916cfc4 +3.0.0-alpha7-864-g9cf37c493