From 8d44c551414165ccd157bf09dbfec54d5bfdf3ee Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 3 Apr 2022 17:56:17 +0200 Subject: [PATCH 01/36] support for PETSc 3.17.0 DCHKERRQ has been replaced by PetscCall --- .github/workflows/Fortran.yml | 2 +- CMakeLists.txt | 7 ++++++- src/DAMASK_interface.f90 | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Fortran.yml b/.github/workflows/Fortran.yml index 5cc241e00..d93cdd27f 100644 --- a/.github/workflows/Fortran.yml +++ b/.github/workflows/Fortran.yml @@ -2,7 +2,7 @@ name: Grid and Mesh Solver on: [push] env: - PETSC_VERSION: '3.16.2' + PETSC_VERSION: '3.17.0' HOMEBREW_NO_ANALYTICS: 'ON' # Make Homebrew installation a little quicker HOMEBREW_NO_AUTO_UPDATE: 'ON' HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 'ON' diff --git a/CMakeLists.txt b/CMakeLists.txt index b4c405319..e9d37f281 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,9 @@ endif() # Dummy project to determine compiler names and version project(Prerequisites LANGUAGES) set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig") -pkg_check_modules(PETSC REQUIRED PETSc>=3.12.0 PETSc<3.17.0) +pkg_check_modules(PETSC_MIN REQUIRED PETSc>=3.12.0 QUIET) #CMake does not support version range +pkg_check_modules(PETSC REQUIRED PETSc<3.18.0) + pkg_get_variable(CMAKE_Fortran_COMPILER PETSc fcompiler) pkg_get_variable(CMAKE_C_COMPILER PETSc ccompiler) @@ -32,6 +34,9 @@ message("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n") add_definitions(-DPETSC) add_definitions(-DDAMASKVERSION="${DAMASK_VERSION}") add_definitions(-DCMAKE_SYSTEM="${CMAKE_SYSTEM}") +if(PETSC_VERSION VERSION_GREATER_EQUAL 3.17.0) + add_definitions("-DCHKERRQ=PetscCall") +endif() if(CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE "RELEASE") diff --git a/src/DAMASK_interface.f90 b/src/DAMASK_interface.f90 index e958c8a29..1a6bb3ee6 100644 --- a/src/DAMASK_interface.f90 +++ b/src/DAMASK_interface.f90 @@ -11,7 +11,7 @@ !-------------------------------------------------------------------------------------------------- #define PETSC_MAJOR 3 #define PETSC_MINOR_MIN 12 -#define PETSC_MINOR_MAX 16 +#define PETSC_MINOR_MAX 17 module DAMASK_interface use, intrinsic :: ISO_fortran_env From 3bf52d832f6e7aa875ec5269684742198909dd43 Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 3 Apr 2022 23:33:19 +0200 Subject: [PATCH 02/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-187-gbf7da2c71 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 65787866a..04e0c3d12 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-184-g1f98b04d4 +v3.0.0-alpha6-187-gbf7da2c71 From 34cc66f1bfdaf2d9e7186ff85e752099049b4dc2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 4 Apr 2022 08:14:48 +0200 Subject: [PATCH 03/36] use old interface for previous PETSc versions --- src/mesh/discretization_mesh.f90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index 9baff52fb..70ee28343 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -100,7 +100,11 @@ subroutine discretization_mesh_init(restart) debug_element = config_debug%get_asInt('element',defaultVal=1) debug_ip = config_debug%get_asInt('integrationpoint',defaultVal=1) +#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>16) + call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,'n/a',PETSC_TRUE,globalMesh,err_PETSc) +#else call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,PETSC_TRUE,globalMesh,err_PETSc) +#endif CHKERRQ(err_PETSc) call DMGetDimension(globalMesh,dimPlex,err_PETSc) CHKERRQ(err_PETSc) From 0376de4a1134df952d36fa591a33b6900420a5e1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 4 Apr 2022 08:17:06 +0200 Subject: [PATCH 04/36] not needed --- src/VTI.f90 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/VTI.f90 b/src/VTI.f90 index d8b8f7778..a5918137e 100644 --- a/src/VTI.f90 +++ b/src/VTI.f90 @@ -81,7 +81,7 @@ subroutine VTI_readDataset_raw(base64_str,dataType,headerType,compressed, & character(len=:), allocatable, intent(out) :: dataType, headerType, base64_str logical, intent(out) :: compressed - logical :: inFile,inImage,gotCellData + logical :: inFile, inImage integer(pI64) :: & startPos, endPos, & s @@ -152,10 +152,9 @@ subroutine VTI_readCellsSizeOrigin(cells,geomSize,origin, & fileContent character(len=:), allocatable :: dataType, headerType - logical :: inFile,inImage,gotCellData,compressed + logical :: inFile, inImage, compressed integer(pI64) :: & - startPos, endPos, & - s + startPos, endPos cells = -1 From 700f256b7cadb6985df00e91dae4a26ed3b00644 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 4 Apr 2022 13:04:27 +0200 Subject: [PATCH 05/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-191-gf8d4e3cf5 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 04e0c3d12..b2ee5ef1f 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-187-gbf7da2c71 +v3.0.0-alpha6-191-gf8d4e3cf5 From 16f5a27e089077f242dbaca13f88c1215fcd7665 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 9 Apr 2022 21:10:15 +0200 Subject: [PATCH 06/36] detecting HDF5 and FFTW some PETSc installations are not aware of them, so it might make sense to become independent of PETSc. But PETSc-defined variables should take precedence --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9d37f281..d535492dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ endif() # Dummy project to determine compiler names and version project(Prerequisites LANGUAGES) -set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig") +set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") pkg_check_modules(PETSC_MIN REQUIRED PETSc>=3.12.0 QUIET) #CMake does not support version range pkg_check_modules(PETSC REQUIRED PETSc<3.18.0) @@ -27,6 +27,12 @@ else() endif() add_definitions("-D${DAMASK_SOLVER}") +# EXPERIMENTAL: This might help to detect HDF5 and FFTW3 in the future if PETSc is not aware of them +set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/externalpackages:$ENV{PKG_CONFIG_PATH}") +message($ENV{PKG_CONFIG_PATH}) +pkg_check_modules(HDF5 hdf5) +pkg_check_modules(FFTW3 fftw3) + file(STRINGS ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) message("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n") From 8ebd234aafaf3c7cb49ddfb30d4379acdf406c03 Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 10 Apr 2022 15:18:41 +0200 Subject: [PATCH 07/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-194-ga4c396949 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index b2ee5ef1f..735877ed3 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-191-gf8d4e3cf5 +v3.0.0-alpha6-194-ga4c396949 From 58b67007a9ed6ea3790f7af1c4e703f2c66d9476 Mon Sep 17 00:00:00 2001 From: Nikhil Prabhu Date: Tue, 12 Apr 2022 12:02:00 +0200 Subject: [PATCH 08/36] fixed missing add_strain --- python/damask/_result.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index f3b649a30..9195d2dd1 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1151,14 +1151,14 @@ class Result: >>> import damask >>> r = damask.Result('my_file.hdf5') - >>> r.strain(t='U',m=0.5) + >>> r.add_strain(t='U',m=0.5) Add the plastic Euler-Almansi strain based on the plastic deformation gradient 'F_p': >>> import damask >>> r = damask.Result('my_file.hdf5') - >>> r.strain('F_p','V',-1) + >>> r.add_strain('F_p','V',-1) """ self._add_generic_pointwise(self._add_strain,{'F':F},{'t':t,'m':m}) From affa7baa223c1ea0d98376cdcf959717c702a634 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 12 Apr 2022 21:02:09 +0200 Subject: [PATCH 09/36] search for libfyaml no consequences so far --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d535492dc..cad36e42c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,9 +29,9 @@ add_definitions("-D${DAMASK_SOLVER}") # EXPERIMENTAL: This might help to detect HDF5 and FFTW3 in the future if PETSc is not aware of them set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/externalpackages:$ENV{PKG_CONFIG_PATH}") -message($ENV{PKG_CONFIG_PATH}) pkg_check_modules(HDF5 hdf5) pkg_check_modules(FFTW3 fftw3) +pkg_check_modules(fYAML libfyaml) file(STRINGS ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) From 4622380134ad2f438968ed6e487cb7301512cd8c Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 12 Apr 2022 23:19:28 +0200 Subject: [PATCH 10/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-197-g39d79c23b --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 735877ed3..f71bd0cab 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-194-ga4c396949 +v3.0.0-alpha6-197-g39d79c23b From 723252ef15e613d3a7f5706a50d6a5f6ba519710 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 12 Apr 2022 22:14:04 +0200 Subject: [PATCH 11/36] libfyaml backend currently it simply converts the whole file content to flow mode. The nice thing is: It can convert EVERYTHING to flow mode. libfyaml is the only library that passes the whole YAML test suite --- CMakeLists.txt | 10 ++++-- src/C_routines.c | 27 ++++++++++++++ src/IO.f90 | 4 ++- src/YAML_parse.f90 | 75 ++++++++++++++++++++++++++++++++------ src/system_routines.f90 | 80 ++++++++++++++++++++++------------------- 5 files changed, 146 insertions(+), 50 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cad36e42c..6994afc77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,8 +115,14 @@ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} ${DEBUG_FLAGS}") endif() -set(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}} ${PETSC_INCLUDES} ${BUILDCMD_POST}") -set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -o -L${PETSC_LIBRARY_DIRS} -lpetsc ${PETSC_EXTERNAL_LIB} -lz ${BUILDCMD_POST}") +set(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}} ${PETSC_INCLUDES} ${BUILDCMD_POST}") + +set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -o -L${PETSC_LIBRARY_DIRS} -lpetsc ${PETSC_EXTERNAL_LIB} -lz") +if(fYAML_FOUND STREQUAL "1") + set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -L${fYAML_LIBRARY_DIRS} -l${fYAML_LIBRARIES}") + add_definitions(-DFYAML) +endif() +set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} ${BUILDCMD_POST}") message("Fortran Compiler Flags:\n${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}\n") message("C Compiler Flags:\n${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}\n") diff --git a/src/C_routines.c b/src/C_routines.c index 3d62a87c2..c4ebb4d6b 100644 --- a/src/C_routines.c +++ b/src/C_routines.c @@ -9,6 +9,10 @@ #include #include "zlib.h" +#ifdef FYAML +#include +#endif + #define PATHLEN 4096 #define STRLEN 256 @@ -80,3 +84,26 @@ void inflate_c(const uLong *s_deflated, const uLong *s_inflated, const Byte defl } } } + +#ifdef FYAML +void to_flow_c(char **flow, int* length_flow, const char *mixed){ + struct fy_document *fyd = NULL; + enum fy_emitter_cfg_flags emit_flags = FYECF_MODE_FLOW_ONELINE | FYECF_STRIP_LABELS | FYECF_STRIP_DOC; + + fyd = fy_document_build_from_string(NULL, mixed, -1); + if (!fyd) { + *length_flow = -1; + return; + } + int err = fy_document_resolve(fyd); + if (err) { + *length_flow = -1; + return; + } + + *flow = fy_emit_document_to_string(fyd,emit_flags); + *length_flow = strlen(*flow); + + fy_document_destroy(fyd); +} +#endif diff --git a/src/IO.f90 b/src/IO.f90 index 493970824..240c9e992 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -483,7 +483,9 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) case (701) msg = 'Incorrect indent/Null value not allowed' case (702) - msg = 'Invalid use of flow yaml' + msg = 'Invalid use of flow YAML' + case (703) + msg = 'Invalid YAML' case (704) msg = 'Space expected after a colon for : pair' case (705) diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index 8a3264cff..e589758c9 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -8,6 +8,9 @@ module YAML_parse use prec use IO use YAML_types +#ifdef FYAML + use system_routines +#endif implicit none private @@ -16,14 +19,34 @@ module YAML_parse YAML_parse_init, & YAML_parse_str +#ifdef FYAML + interface + + subroutine to_flow_C(flow,length_flow,mixed) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR, C_PTR + + type(C_PTR), intent(out) :: flow + integer(C_INT), intent(out) :: length_flow + character(kind=C_CHAR), dimension(*), intent(in) :: mixed + end subroutine to_flow_C + + end interface +#endif + + contains !-------------------------------------------------------------------------------------------------- !> @brief Do sanity checks. !-------------------------------------------------------------------------------------------------- -subroutine YAML_parse_init +subroutine YAML_parse_init() - call selfTest + print'(/,1x,a)', '<<<+- YAML_parse init -+>>>' +#ifdef FYAML + print'(/,1x,a)', 'libfyaml powered' +#else + call selfTest() +#endif end subroutine YAML_parse_init @@ -155,8 +178,37 @@ logical function quotedString(line) end function quotedString +#ifdef FYAML !-------------------------------------------------------------------------------------------------- -! @brief Returns Indentation. +! @brief Convert all block style YAML parts to flow style. +!-------------------------------------------------------------------------------------------------- +function to_flow(mixed) result(flow) + + character(len=*), intent(in) :: mixed + character(:,C_CHAR), allocatable :: flow + + type(C_PTR) :: str_ptr + integer(C_INT) :: strlen + + + call to_flow_C(str_ptr,strlen,f_c_string(mixed)) + if (strlen < 1) call IO_error(703,ext_msg='libyfaml') + allocate(character(len=strlen,kind=c_char) :: flow) + + block + character(len=strlen,kind=c_char), pointer :: s + call c_f_pointer(str_ptr,s) + flow = s + end block + + call free_C(str_ptr) + +end function to_flow + + +#else +!-------------------------------------------------------------------------------------------------- +! @brief Determine Indentation. ! @details It determines the indentation level for a given block/line. ! In cases for nested lists, an offset is added to determine the indent of the item block (skip ! leading dashes) @@ -280,7 +332,7 @@ subroutine skip_empty_lines(blck,s_blck) enddo end subroutine skip_empty_lines - + !-------------------------------------------------------------------------------------------------- ! @brief skip file header @@ -303,7 +355,7 @@ subroutine skip_file_header(blck,s_blck) call IO_error(708,ext_msg = line) end if end if - + end subroutine skip_file_header @@ -371,7 +423,7 @@ subroutine list_item_inline(blck,s_blck,inline,offset) character(len=:), allocatable :: line integer :: indent,indent_next - + indent = indentDepth(blck(s_blck:),offset) line = IO_rmComment(blck(s_blck:s_blck + index(blck(s_blck:),IO_EOL) - 2)) inline = line(indent-offset+3:) @@ -385,7 +437,7 @@ subroutine list_item_inline(blck,s_blck,inline,offset) indent_next = indentDepth(blck(s_blck:)) enddo - if(scan(inline,",") > 0) inline = '"'//inline//'"' + if(scan(inline,",") > 0) inline = '"'//inline//'"' end subroutine list_item_inline @@ -737,7 +789,7 @@ end subroutine !-------------------------------------------------------------------------------------------------- -! @brief convert all block style YAML parts to flow style +! @brief Convert all block style YAML parts to flow style. !-------------------------------------------------------------------------------------------------- function to_flow(blck) @@ -749,7 +801,7 @@ function to_flow(blck) s_flow, & !< start position in flow offset, & !< counts leading '- ' in nested lists end_line - + allocate(character(len=len(blck)*2)::to_flow) s_flow = 1 s_blck = 1 @@ -876,7 +928,7 @@ subroutine selfTest character(len=*), parameter :: flow = & '{a: ["b", {c: "d"}, "e"]}' - + if( .not. to_flow(flow_multi) == flow) error stop 'to_flow' end block multi_line_flow1 @@ -889,7 +941,7 @@ subroutine selfTest "[c,"//IO_EOL//& "d"//IO_EOL//& "e, f]}"//IO_EOL - + character(len=*), parameter :: flow = & "[{a: {b: [c, d e, f]}}]" @@ -921,5 +973,6 @@ subroutine selfTest end block basic_mixed end subroutine selfTest +#endif end module YAML_parse diff --git a/src/system_routines.f90 b/src/system_routines.f90 index 2eb0b7958..e0adf9dc0 100644 --- a/src/system_routines.f90 +++ b/src/system_routines.f90 @@ -17,59 +17,67 @@ module system_routines getUserName, & signalterm_C, & signalusr1_C, & - signalusr2_C + signalusr2_C, & + f_c_string, & + free_C interface - function setCWD_C(cwd) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR + function setCWD_C(cwd) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR - integer(C_INT) :: setCWD_C - character(kind=C_CHAR), dimension(*), intent(in) :: cwd - end function setCWD_C + integer(C_INT) :: setCWD_C + character(kind=C_CHAR), dimension(*), intent(in) :: cwd + end function setCWD_C - subroutine getCWD_C(cwd, stat) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR - use prec + subroutine getCWD_C(cwd, stat) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR + use prec - character(kind=C_CHAR), dimension(pPathLen+1), intent(out) :: cwd ! NULL-terminated array - integer(C_INT), intent(out) :: stat - end subroutine getCWD_C + character(kind=C_CHAR), dimension(pPathLen+1), intent(out) :: cwd ! NULL-terminated array + integer(C_INT), intent(out) :: stat + end subroutine getCWD_C - subroutine getHostName_C(hostname, stat) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR - use prec + subroutine getHostName_C(hostname, stat) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR + use prec - character(kind=C_CHAR), dimension(pStringLen+1), intent(out) :: hostname ! NULL-terminated array - integer(C_INT), intent(out) :: stat - end subroutine getHostName_C + character(kind=C_CHAR), dimension(pStringLen+1), intent(out) :: hostname ! NULL-terminated array + integer(C_INT), intent(out) :: stat + end subroutine getHostName_C - subroutine getUserName_C(username, stat) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR - use prec + subroutine getUserName_C(username, stat) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR + use prec - character(kind=C_CHAR), dimension(pStringLen+1), intent(out) :: username ! NULL-terminated array - integer(C_INT), intent(out) :: stat - end subroutine getUserName_C + character(kind=C_CHAR), dimension(pStringLen+1), intent(out) :: username ! NULL-terminated array + integer(C_INT), intent(out) :: stat + end subroutine getUserName_C - subroutine signalterm_C(handler) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_FUNPTR + subroutine signalterm_C(handler) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_FUNPTR - type(C_FUNPTR), intent(in), value :: handler - end subroutine signalterm_C + type(C_FUNPTR), intent(in), value :: handler + end subroutine signalterm_C - subroutine signalusr1_C(handler) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_FUNPTR + subroutine signalusr1_C(handler) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_FUNPTR - type(C_FUNPTR), intent(in), value :: handler - end subroutine signalusr1_C + type(C_FUNPTR), intent(in), value :: handler + end subroutine signalusr1_C - subroutine signalusr2_C(handler) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_FUNPTR + subroutine signalusr2_C(handler) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_FUNPTR + + type(C_FUNPTR), intent(in), value :: handler + end subroutine signalusr2_C + + subroutine free_C(ptr) bind(C,name='free') + import c_ptr + type(c_ptr), value :: ptr + end subroutine free_C - type(C_FUNPTR), intent(in), value :: handler - end subroutine signalusr2_C end interface From c806885cb5309f90a85d184bd7f27ceb8c2b0087 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 13 Apr 2022 05:55:34 +0200 Subject: [PATCH 12/36] include libfyaml headers from non-standard locations the CMake manual promises more than it holds. Also adding some diagnostics+fixes for zlib, we still assume that it exists (true on most systems, HDF5 also requires it normally) see also https://stackoverflow.com/questions/21593 --- CMakeLists.txt | 5 +++++ src/C_routines.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6994afc77..6b341dbbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/externalpackages:$ENV pkg_check_modules(HDF5 hdf5) pkg_check_modules(FFTW3 fftw3) pkg_check_modules(fYAML libfyaml) +pkg_check_modules(zlib zlib) file(STRINGS ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) @@ -118,10 +119,14 @@ endif() set(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}} ${PETSC_INCLUDES} ${BUILDCMD_POST}") set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -o -L${PETSC_LIBRARY_DIRS} -lpetsc ${PETSC_EXTERNAL_LIB} -lz") + if(fYAML_FOUND STREQUAL "1") set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -L${fYAML_LIBRARY_DIRS} -l${fYAML_LIBRARIES}") add_definitions(-DFYAML) + pkg_get_variable(fYAML_INCLUDE_DIR libfyaml includedir) # fYAML_INCLUDE_DIRS and fYAML_CFLAGS are not working + set(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}} -I${fYAML_INCLUDE_DIR}") endif() + set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} ${BUILDCMD_POST}") message("Fortran Compiler Flags:\n${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}\n") diff --git a/src/C_routines.c b/src/C_routines.c index c4ebb4d6b..3a1db91a0 100644 --- a/src/C_routines.c +++ b/src/C_routines.c @@ -7,7 +7,7 @@ #include #include #include -#include "zlib.h" +#include #ifdef FYAML #include From 03b9a7679f4c9c34247f1458dc0f3e40fdf16c74 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 13 Apr 2022 18:17:32 +0200 Subject: [PATCH 13/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-202-g87b5097ff --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index f71bd0cab..946c163c0 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-197-g39d79c23b +v3.0.0-alpha6-202-g87b5097ff From 00671f943bfe41e77f303238909e14b056dcfbad Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 13 Apr 2022 23:45:14 +0200 Subject: [PATCH 14/36] easier to understand --- src/YAML_types.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index d7ca71cbb..c4dcc0a83 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -1348,8 +1348,8 @@ subroutine tList_append(self,node) type(tItem), pointer :: item if (.not. associated(self%first)) then - allocate(self%first) - item => self%first + allocate(item) + self%first => item else item => self%first do while (associated(item%next)) From ca0df3389a96c7d867c0e884128662a3ee9a4c37 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 00:06:54 +0200 Subject: [PATCH 15/36] avoid long pointer transversal --- src/YAML_types.f90 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index c4dcc0a83..b32651905 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -119,7 +119,8 @@ module YAML_types type, extends(tNode), public :: tList - class(tItem), pointer :: first => NULL() + class(tItem), pointer :: first => NULL(), & + last => NULL() contains procedure :: asFormattedString => tList_asFormattedString @@ -1350,13 +1351,11 @@ subroutine tList_append(self,node) if (.not. associated(self%first)) then allocate(item) self%first => item + self%last => item else - item => self%first - do while (associated(item%next)) - item => item%next - enddo - allocate(item%next) - item => item%next + allocate(self%last%next) + item => self%last%next + self%last => item end if item%node => node From 563d566a3f699af85a8fe558ebf7c724d4fd4756 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 01:06:47 +0200 Subject: [PATCH 16/36] made two loops faster the most annoying one is still slow. --- src/YAML_types.f90 | 2 +- src/material.f90 | 50 ++++++++++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index b32651905..857b24bd0 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -145,7 +145,7 @@ module YAML_types end type tDict - type :: tItem + type, public :: tItem character(len=:), allocatable :: key class(tNode), pointer :: node => NULL() class(tItem), pointer :: next => NULL() diff --git a/src/material.f90 b/src/material.f90 index 3ff280b0d..4d6bc361d 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -91,6 +91,7 @@ subroutine parse() homogenizations, & homogenization + class(tItem), pointer :: item integer, dimension(:), allocatable :: & counterPhase, & counterHomogenization @@ -102,6 +103,7 @@ subroutine parse() co, ce, & ma + materials => config_material%get('material') phases => config_material%get('phase') homogenizations => config_material%get('homogenization') @@ -169,17 +171,23 @@ subroutine parse() allocate(material_O_0(materials%length)) allocate(material_F_i_0(materials%length)) - do ma = 1, materials%length - material => materials%get(ma) - constituents => material%get('constituents') - allocate(material_O_0(ma)%data(constituents%length)) - allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) - do co = 1, constituents%length - constituent => constituents%get(co) - call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) - material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) - enddo - enddo + ! manual iteration for performance + select type(materials) + class is(tList) + item => materials%first + do ma = 1, materials%length + material => item%node + constituents => material%get('constituents') + allocate(material_O_0(ma)%data(constituents%length)) + allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) + do co = 1, constituents%length + constituent => constituents%get(co) + call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) + material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) + end do + item => item%next + end do + end select end subroutine parse @@ -195,17 +203,25 @@ subroutine sanityCheck(materials,homogenizations) class(tNode), pointer :: material, & homogenization, & constituents + class(tItem), pointer :: item integer :: m + if (maxval(discretization_materialAt) > materials%length) & call IO_error(155,ext_msg='More materials requested than found in material.yaml') - do m = 1, materials%length - material => materials%get(m) - constituents => material%get('constituents') - homogenization => homogenizations%get(material%get_asString('homogenization')) - if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) - end do + ! manual iteration for performance + select type(materials) + class is(tList) + item => materials%first + do m = 1, materials%length + material => materials%get(m) + constituents => material%get('constituents') + homogenization => homogenizations%get(material%get_asString('homogenization')) + if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) + item => item%next + end do + end select end subroutine sanityCheck From 3309360e4bf96ee32d156b825098b8e573cbea67 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 07:19:56 +0200 Subject: [PATCH 17/36] avoit out of bounds access --- src/YAML_parse.f90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index e589758c9..8013089e1 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -168,8 +168,11 @@ logical function quotedString(line) character(len=*), intent(in) :: line + quotedString = .false. + if (len(line) == 0) return + if (scan(line(:1),IO_QUOTES) == 1) then quotedString = .true. if(line(len(line):len(line)) /= line(:1)) call IO_error(710,ext_msg=line) From b56176d670d22616ec512e7c0c11326849f8aaf1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 12:55:11 +0200 Subject: [PATCH 18/36] all YAML related initialization is constant (linear in number of points) --- src/material.f90 | 125 +++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 69 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index 4d6bc361d..40d178540 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -94,7 +94,10 @@ subroutine parse() class(tItem), pointer :: item integer, dimension(:), allocatable :: & counterPhase, & - counterHomogenization + counterHomogenization, & + temp_ho + integer, dimension(:,:), allocatable :: temp_ph + real(pReal), dimension(:,:), allocatable :: temp_v real(pReal) :: v integer :: & @@ -108,8 +111,6 @@ subroutine parse() phases => config_material%get('phase') homogenizations => config_material%get('homogenization') - call sanityCheck(materials, homogenizations) - #if defined (__GFORTRAN__) material_name_phase = getKeys(phases) material_name_homogenization = getKeys(homogenizations) @@ -136,10 +137,56 @@ subroutine parse() allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) - do el = 1, discretization_Nelems - material => materials%get(discretization_materialAt(el)) + allocate(material_O_0(materials%length)) + allocate(material_F_i_0(materials%length)) + + select type(materials) + + class is(tList) + + if (maxval(discretization_materialAt) > materials%length) & + call IO_error(155,ext_msg='More materials requested than found in material.yaml') + + allocate(temp_ho(materials%length)) + allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) + allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) + + item => materials%first + do ma = 1, materials%length + material => item%node + temp_ho(ma) = homogenizations%getIndex(material%get_asString('homogenization')) + constituents => material%get('constituents') + + homogenization => homogenizations%get(temp_ho(ma)) + if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) + + allocate(material_O_0(ma)%data(constituents%length)) + allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) + + do co = 1, constituents%length + constituent => constituents%get(co) + temp_v(ma,co) = constituent%get_asFloat('v') + temp_ph(ma,co) = phases%getIndex(constituent%get_asString('phase')) + + call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) + material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) + + end do + if (dNeq(sum(temp_v(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') + + item => item%next + + end do + + end select + + + ! build mappings + do el = 1, discretization_Nelems + + ma = discretization_materialAt(el) + ho = temp_ho(ma) - ho = homogenizations%getIndex(material%get_asString('homogenization')) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip material_homogenizationID(ce) = ho @@ -147,13 +194,11 @@ subroutine parse() material_homogenizationEntry(ce) = counterHomogenization(ho) end do - constituents => material%get('constituents') - do co = 1, constituents%length - constituent => constituents%get(co) + do co = 1, size(temp_ph(ma,:)>0) - v = constituent%get_asFloat('v') + v = temp_v(ma,co) + ph = temp_ph(ma,co) - ph = phases%getIndex(constituent%get_asString('phase')) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip material_phaseID(co,ce) = ph @@ -163,68 +208,10 @@ subroutine parse() end do end do - if (dNeq(sum(material_v(1:constituents%length,ce)),1.0_pReal,1.e-9_pReal)) & - call IO_error(153,ext_msg='constituent') - end do - allocate(material_O_0(materials%length)) - allocate(material_F_i_0(materials%length)) - - ! manual iteration for performance - select type(materials) - class is(tList) - item => materials%first - do ma = 1, materials%length - material => item%node - constituents => material%get('constituents') - allocate(material_O_0(ma)%data(constituents%length)) - allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) - do co = 1, constituents%length - constituent => constituents%get(co) - call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) - material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) - end do - item => item%next - end do - end select - end subroutine parse - -!-------------------------------------------------------------------------------------------------- -!> @brief Check if material.yaml is consistent and contains sufficient # of materials -!-------------------------------------------------------------------------------------------------- -subroutine sanityCheck(materials,homogenizations) - - class(tNode), intent(in) :: materials, & - homogenizations - - class(tNode), pointer :: material, & - homogenization, & - constituents - class(tItem), pointer :: item - integer :: m - - - if (maxval(discretization_materialAt) > materials%length) & - call IO_error(155,ext_msg='More materials requested than found in material.yaml') - - ! manual iteration for performance - select type(materials) - class is(tList) - item => materials%first - do m = 1, materials%length - material => materials%get(m) - constituents => material%get('constituents') - homogenization => homogenizations%get(material%get_asString('homogenization')) - if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) - item => item%next - end do - end select - -end subroutine sanityCheck - #if defined (__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief %keys() is broken on gfortran From dbf5ee84cb997febff4a10949c1bfa352e751188 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 20:14:08 +0200 Subject: [PATCH 19/36] better readable --- src/material.f90 | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index 40d178540..7264738e5 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -111,6 +111,10 @@ subroutine parse() phases => config_material%get('phase') homogenizations => config_material%get('homogenization') + + if (maxval(discretization_materialAt) > materials%length) & + call IO_error(155,ext_msg='More materials requested than found in material.yaml') + #if defined (__GFORTRAN__) material_name_phase = getKeys(phases) material_name_homogenization = getKeys(homogenizations) @@ -126,31 +130,20 @@ subroutine parse() end do homogenization_maxNconstituents = maxval(homogenization_Nconstituents) - allocate(counterPhase(phases%length),source=0) - allocate(counterHomogenization(homogenizations%length),source=0) - - allocate(material_homogenizationID(discretization_Ncells),source=0) - allocate(material_homogenizationEntry(discretization_Ncells),source=0) - - allocate(material_phaseID(homogenization_maxNconstituents,discretization_Ncells),source=0) - allocate(material_phaseEntry(homogenization_maxNconstituents,discretization_Ncells),source=0) - allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) allocate(material_O_0(materials%length)) allocate(material_F_i_0(materials%length)) + allocate(temp_ho(materials%length)) + allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) + allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) + + ! parse YAML structure select type(materials) class is(tList) - if (maxval(discretization_materialAt) > materials%length) & - call IO_error(155,ext_msg='More materials requested than found in material.yaml') - - allocate(temp_ho(materials%length)) - allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) - allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) - item => materials%first do ma = 1, materials%length material => item%node @@ -175,12 +168,21 @@ subroutine parse() if (dNeq(sum(temp_v(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') item => item%next - end do end select + allocate(counterPhase(phases%length),source=0) + allocate(counterHomogenization(homogenizations%length),source=0) + + allocate(material_homogenizationID(discretization_Ncells),source=0) + allocate(material_homogenizationEntry(discretization_Ncells),source=0) + + allocate(material_phaseID(homogenization_maxNconstituents,discretization_Ncells),source=0) + allocate(material_phaseEntry(homogenization_maxNconstituents,discretization_Ncells),source=0) + + ! build mappings do el = 1, discretization_Nelems @@ -212,6 +214,7 @@ subroutine parse() end subroutine parse + #if defined (__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief %keys() is broken on gfortran From f11b6f54e55420a75887d4d823c88a075dde2ae1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Apr 2022 15:35:09 +0200 Subject: [PATCH 20/36] markdown - as for PRIVATE --- README | 13 ------------- README.md | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 543de378f..000000000 --- a/README +++ /dev/null @@ -1,13 +0,0 @@ -DAMASK - The Düsseldorf Advanced Material Simulation Kit -Visit damask.mpie.de for installation and usage instructions - -CONTACT INFORMATION - -Max-Planck-Institut für Eisenforschung GmbH -Max-Planck-Str. 1 -40237 Düsseldorf -Germany - -damask@mpie.de -https://damask.mpie.de -https://git.damask.mpie.de diff --git a/README.md b/README.md new file mode 100644 index 000000000..a2178e0ab --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# DAMASK - The Düsseldorf Advanced Material Simulation Kit + +Visit [damask.mpie.de](https://damask.mpie.de) for installation and usage instructions + +## Contact Information + +Max-Planck-Institut für Eisenforschung GmbH +Max-Planck-Str. 1 +40237 Düsseldorf +Germany + +damask@mpie.de +https://damask.mpie.de +https://git.damask.mpie.de + From 5f49f38a018971454f4f319aed36ed81a12d1b6b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Apr 2022 15:40:24 +0200 Subject: [PATCH 21/36] nicely formatted readmes --- PRIVATE | 2 +- README.md | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/PRIVATE b/PRIVATE index 459326e98..f6a94aeaa 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 459326e9840c843ade72b04cf28e50889c9779f1 +Subproject commit f6a94aeaaa3a81347821e7a092d43dd04115f5f6 diff --git a/README.md b/README.md index a2178e0ab..5b5edf677 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ Visit [damask.mpie.de](https://damask.mpie.de) for installation and usage instru ## Contact Information -Max-Planck-Institut für Eisenforschung GmbH -Max-Planck-Str. 1 -40237 Düsseldorf -Germany +Max-Planck-Institut für Eisenforschung GmbH +Max-Planck-Str. 1 +40237 Düsseldorf +Germany -damask@mpie.de -https://damask.mpie.de -https://git.damask.mpie.de +damask@mpie.de +https://damask.mpie.de +https://git.damask.mpie.de From 51582b80f8882fc9032d90980f94168bec01365e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Apr 2022 15:48:21 +0200 Subject: [PATCH 22/36] don't fail windows is unreliable --- .github/workflows/Python.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Python.yml b/.github/workflows/Python.yml index ca74c0016..3b6bb0df4 100644 --- a/.github/workflows/Python.yml +++ b/.github/workflows/Python.yml @@ -11,6 +11,7 @@ jobs: matrix: python-version: ['3.8', '3.9'] #, '3.10'] os: [ubuntu-latest, macos-latest, windows-latest] + fail-fast: false steps: - uses: actions/checkout@v2 From 5d99b152eec889030486252988723a3d39a56ee5 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 15 Apr 2022 21:23:03 +0200 Subject: [PATCH 23/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-206-g51582b80f --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 946c163c0..7ce9e687d 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-202-g87b5097ff +v3.0.0-alpha6-206-g51582b80f From 3cc3229792c82ef496f5bf3c376452a61652584e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 16 Apr 2022 16:19:33 +0200 Subject: [PATCH 24/36] string new line which is added by libfyaml --- src/YAML_parse.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index 8013089e1..bfce06bc9 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -83,7 +83,7 @@ recursive function parse_flow(YAML_flow) result(node) s, & ! start position of dictionary or list d ! position of key: value separator (':') - flow_string = trim(adjustl(YAML_flow(:))) + flow_string = trim(adjustl(YAML_flow)) if (len_trim(flow_string) == 0) then node => emptyDict return @@ -201,7 +201,7 @@ function to_flow(mixed) result(flow) block character(len=strlen,kind=c_char), pointer :: s call c_f_pointer(str_ptr,s) - flow = s + flow = s(:len(s)-1) end block call free_C(str_ptr) From 954a336d92c278227525ee174e25d196f7a328b2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 16 Apr 2022 16:24:29 +0200 Subject: [PATCH 25/36] Fortran side does not support tags (i.e. 'type hints') --- src/C_routines.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/C_routines.c b/src/C_routines.c index 3a1db91a0..a25fde688 100644 --- a/src/C_routines.c +++ b/src/C_routines.c @@ -88,7 +88,7 @@ void inflate_c(const uLong *s_deflated, const uLong *s_inflated, const Byte defl #ifdef FYAML void to_flow_c(char **flow, int* length_flow, const char *mixed){ struct fy_document *fyd = NULL; - enum fy_emitter_cfg_flags emit_flags = FYECF_MODE_FLOW_ONELINE | FYECF_STRIP_LABELS | FYECF_STRIP_DOC; + enum fy_emitter_cfg_flags emit_flags = FYECF_MODE_FLOW_ONELINE | FYECF_STRIP_LABELS | FYECF_STRIP_TAGS |FYECF_STRIP_DOC; fyd = fy_document_build_from_string(NULL, mixed, -1); if (!fyd) { From 808ef139aefc56a530a1bcf6451b8035acf5d3b4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Apr 2022 13:16:45 +0200 Subject: [PATCH 26/36] avoid code duplication by using assumed rank "(..)" - lack of modern Fortran interface for HDF5 still requires branching to call the same code - not sure how to handle the read function (assumed rank and intent(out) ) does not work together --- src/HDF5_utilities.f90 | 137 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 1 deletion(-) diff --git a/src/HDF5_utilities.f90 b/src/HDF5_utilities.f90 index 93de4053b..86807507b 100644 --- a/src/HDF5_utilities.f90 +++ b/src/HDF5_utilities.f90 @@ -48,6 +48,7 @@ module HDF5_utilities !> @details for parallel IO, all dimension except for the last need to match !-------------------------------------------------------------------------------------------------- interface HDF5_write +#if defined(__GFORTRAN__) && __GNUC__<11 module procedure HDF5_write_real1 module procedure HDF5_write_real2 module procedure HDF5_write_real3 @@ -55,7 +56,6 @@ module HDF5_utilities module procedure HDF5_write_real5 module procedure HDF5_write_real6 module procedure HDF5_write_real7 - module procedure HDF5_write_int1 module procedure HDF5_write_int2 module procedure HDF5_write_int3 @@ -63,6 +63,10 @@ module HDF5_utilities module procedure HDF5_write_int5 module procedure HDF5_write_int6 module procedure HDF5_write_int7 +#else + module procedure HDF5_write_real + module procedure HDF5_write_int +#endif end interface HDF5_write !-------------------------------------------------------------------------------------------------- @@ -1210,6 +1214,7 @@ subroutine HDF5_read_int7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_read_int7 +#if defined(__GFORTRAN__) && __GNUC__<11 !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type real with 1 dimension @@ -1499,6 +1504,71 @@ subroutine HDF5_write_real7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_write_real7 +#else + +!-------------------------------------------------------------------------------------------------- +!> @brief write dataset of type real with 1-7 dimension +!-------------------------------------------------------------------------------------------------- +subroutine HDF5_write_real(dataset,loc_id,datasetName,parallel) + + real(pReal), intent(in), dimension(..) :: dataset !< data written to file + 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), optional :: parallel !< dataset is distributed over multiple processes + + + integer :: hdferr + integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id + integer(HSIZE_T), dimension(rank(dataset)) :: & + myStart, & + myShape, & !< shape of the dataset (this process) + totalShape !< shape of the dataset (all processes) + +!--------------------------------------------------------------------------------------------------- +! determine shape of dataset + myShape = int(shape(dataset),HSIZE_T) + if (any(myShape(1:size(myShape)-1) == 0)) return !< empty dataset (last dimension can be empty) + + if (present(parallel)) then + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape,loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,parallel) + else + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape,loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,parallel_default) + end if + + if (product(totalShape) /= 0) then + select rank(dataset) + rank (1) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (2) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (3) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (4) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (5) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (6) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (7) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + end select + if(hdferr < 0) error stop 'HDF5 error' + end if + + call finalize_write(plist_id, dset_id, filespace_id, memspace_id) + +end subroutine HDF5_write_real +#endif + !-------------------------------------------------------------------------------------------------- !> @brief Write dataset of type string (scalar). @@ -1561,6 +1631,7 @@ subroutine HDF5_write_str(dataset,loc_id,datasetName) end subroutine HDF5_write_str +#if defined(__GFORTRAN__) && __GNUC__<11 !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type integer with 1 dimension @@ -1849,6 +1920,70 @@ subroutine HDF5_write_int7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_write_int7 +#else + +!-------------------------------------------------------------------------------------------------- +!> @brief write dataset of type integer with 1-7 dimension +!-------------------------------------------------------------------------------------------------- +subroutine HDF5_write_int(dataset,loc_id,datasetName,parallel) + + integer, intent(in), dimension(..) :: dataset !< data written to file + 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), optional :: parallel !< dataset is distributed over multiple processes + + + integer :: hdferr + integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id + integer(HSIZE_T), dimension(rank(dataset)) :: & + myStart, & + myShape, & !< shape of the dataset (this process) + totalShape !< shape of the dataset (all processes) + +!--------------------------------------------------------------------------------------------------- +! determine shape of dataset + myShape = int(shape(dataset),HSIZE_T) + if (any(myShape(1:size(myShape)-1) == 0)) return !< empty dataset (last dimension can be empty) + + if (present(parallel)) then + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,parallel) + else + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,parallel_default) + end if + + if (product(totalShape) /= 0) then + select rank(dataset) + rank(1) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(2) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(3) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(4) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(5) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(6) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(7) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + end select + if(hdferr < 0) error stop 'HDF5 error' + end if + + call finalize_write(plist_id, dset_id, filespace_id, memspace_id) + +end subroutine HDF5_write_int +#endif !-------------------------------------------------------------------------------------------------- !> @brief initialize HDF5 handles, determines global shape and start for parallel read From b796ccb04a3b2e3e0ffac0f74f31d8c5b2ff1553 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Apr 2022 13:18:14 +0200 Subject: [PATCH 27/36] DAMASK requires gfortran >= 9 --- src/rotations.f90 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/rotations.f90 b/src/rotations.f90 index 53f1fe976..7aa81fcab 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -658,11 +658,7 @@ function om2ax(om) result(ax) else call dgeev('N','V',3,om_,3,Wr,Wi,devNull,3,VR,3,work,size(work,1),ierr) if (ierr /= 0) error stop 'LAPACK error' -#if defined(__GFORTRAN__) && __GNUC__<9 - i = maxloc(merge(1,0,cEq(cmplx(Wr,Wi,pReal),cmplx(1.0_pReal,0.0_pReal,pReal),tol=1.0e-14_pReal)),dim=1) -#else i = findloc(cEq(cmplx(Wr,Wi,pReal),cmplx(1.0_pReal,0.0_pReal,pReal),tol=1.0e-14_pReal),.true.,dim=1) !find eigenvalue (1,0) -#endif if (i == 0) error stop 'om2ax conversion failed' ax(1:3) = VR(1:3,i) where ( dNeq0([om(2,3)-om(3,2), om(3,1)-om(1,3), om(1,2)-om(2,1)])) & @@ -1427,10 +1423,6 @@ subroutine selfTest() do i = 1, 20 -#if defined(__GFORTRAN__) && __GNUC__<9 - if(i<7) cycle -#endif - if(i==1) then qu = om2qu(math_I3) elseif(i==2) then From 4a93dbec117cbb0092ddc8f33e1a5cbe00097d2b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 19 Apr 2022 13:11:40 -0400 Subject: [PATCH 28/36] more descriptive variable names --- src/material.f90 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index 7264738e5..2258c40a1 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -95,9 +95,9 @@ subroutine parse() integer, dimension(:), allocatable :: & counterPhase, & counterHomogenization, & - temp_ho - integer, dimension(:,:), allocatable :: temp_ph - real(pReal), dimension(:,:), allocatable :: temp_v + ho_of + integer, dimension(:,:), allocatable :: ph_of + real(pReal), dimension(:,:), allocatable :: v_of real(pReal) :: v integer :: & @@ -135,9 +135,9 @@ subroutine parse() allocate(material_O_0(materials%length)) allocate(material_F_i_0(materials%length)) - allocate(temp_ho(materials%length)) - allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) - allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) + allocate(ho_of(materials%length)) + allocate(ph_of(materials%length,homogenization_maxNconstituents),source=-1) + allocate( v_of(materials%length,homogenization_maxNconstituents),source=0.0_pReal) ! parse YAML structure select type(materials) @@ -147,10 +147,10 @@ subroutine parse() item => materials%first do ma = 1, materials%length material => item%node - temp_ho(ma) = homogenizations%getIndex(material%get_asString('homogenization')) + ho_of(ma) = homogenizations%getIndex(material%get_asString('homogenization')) constituents => material%get('constituents') - homogenization => homogenizations%get(temp_ho(ma)) + homogenization => homogenizations%get(ho_of(ma)) if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) allocate(material_O_0(ma)%data(constituents%length)) @@ -158,14 +158,14 @@ subroutine parse() do co = 1, constituents%length constituent => constituents%get(co) - temp_v(ma,co) = constituent%get_asFloat('v') - temp_ph(ma,co) = phases%getIndex(constituent%get_asString('phase')) + v_of(ma,co) = constituent%get_asFloat('v') + ph_of(ma,co) = phases%getIndex(constituent%get_asString('phase')) call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) end do - if (dNeq(sum(temp_v(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') + if (dNeq(sum(v_of(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') item => item%next end do @@ -187,7 +187,7 @@ subroutine parse() do el = 1, discretization_Nelems ma = discretization_materialAt(el) - ho = temp_ho(ma) + ho = ho_of(ma) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip @@ -196,10 +196,10 @@ subroutine parse() material_homogenizationEntry(ce) = counterHomogenization(ho) end do - do co = 1, size(temp_ph(ma,:)>0) + do co = 1, size(ph_of(ma,:)>0) - v = temp_v(ma,co) - ph = temp_ph(ma,co) + v = v_of(ma,co) + ph = ph_of(ma,co) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip From 9e2fcfc9df47b1fb3fdb2a89fdcb5c8c540f3e81 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 20 Apr 2022 05:24:57 +0200 Subject: [PATCH 29/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-210-ge8c1f8453 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 7ce9e687d..c2c4f8316 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-206-g51582b80f +v3.0.0-alpha6-210-ge8c1f8453 From df3f4d9480524dc84a815f3149354d2c235fd0f5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 20 Apr 2022 07:00:02 +0200 Subject: [PATCH 30/36] testing forward/backward FFT --- src/grid/spectral_utilities.f90 | 39 ++++++++++++++++++++++++++++++++- src/prec.f90 | 6 ++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 525f68d7e..3f7c32668 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -142,7 +142,7 @@ contains !> level chosen. !> Initializes FFTW. !-------------------------------------------------------------------------------------------------- -subroutine spectral_utilities_init +subroutine spectral_utilities_init() PetscErrorCode :: err_PETSc integer :: i, j, k, & @@ -1146,4 +1146,41 @@ subroutine utilities_saveReferenceStiffness end subroutine utilities_saveReferenceStiffness + +!-------------------------------------------------------------------------------------------------- +!> @brief Check correctness of forward-backward transform. +!-------------------------------------------------------------------------------------------------- +subroutine selfTest() + + real(pReal), allocatable, dimension(:,:,:,:,:) :: tensorField_real_ + real(pReal), allocatable, dimension(:,:,:,:) :: vectorField_real_ + real(pReal), allocatable, dimension(:,:,:) :: scalarField_real_ + + + call random_number(tensorField_real) + tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + tensorField_real_ = tensorField_real + call utilities_FFTtensorForward() + call utilities_FFTtensorBackward() + tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(tensorField_real_ - tensorField_real))>1.0e-15_pReal) error stop 'tensorField' + + call random_number(vectorField_real) + vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + vectorField_real_ = vectorField_real + call utilities_FFTvectorForward() + call utilities_FFTvectorBackward() + vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(vectorField_real_ - vectorField_real))>1.0e-15_pReal) error stop 'vectorField' + + call random_number(scalarField_real) + scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + scalarField_real_ = scalarField_real + call utilities_FFTscalarForward() + call utilities_FFTscalarBackward() + scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(scalarField_real_ - scalarField_real))>1.0e-15_pReal) error stop 'scalarField' + +end subroutine selfTest + end module spectral_utilities diff --git a/src/prec.f90 b/src/prec.f90 index d0753790e..73563d4f2 100644 --- a/src/prec.f90 +++ b/src/prec.f90 @@ -48,7 +48,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Report precision and do self test. !-------------------------------------------------------------------------------------------------- -subroutine prec_init +subroutine prec_init() print'(/,1x,a)', '<<<+- prec init -+>>>' @@ -60,7 +60,7 @@ subroutine prec_init print'( a,e10.3)', ' epsilon value: ',PREAL_EPSILON print'( a,i3)', ' decimal precision: ',precision(0.0_pReal) - call selfTest + call selfTest() end subroutine prec_init @@ -245,7 +245,7 @@ end function prec_bytesToC_INT64_T !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some prec functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest +subroutine selfTest() integer, allocatable, dimension(:) :: realloc_lhs_test real(pReal), dimension(1) :: f From d6f2b99199a770512634544f018d1ed451b0d75d Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 20 Apr 2022 10:02:55 +0200 Subject: [PATCH 31/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-221-gdff78154a --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index c2c4f8316..b96558745 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-210-ge8c1f8453 +v3.0.0-alpha6-221-gdff78154a From d916c7c6b19da5c83af152d81571a42e872845b2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 21 Apr 2022 17:32:30 +0200 Subject: [PATCH 32/36] small polishing --- PRIVATE | 2 +- python/damask/_grid.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PRIVATE b/PRIVATE index f6a94aeaa..e3d9c0cc3 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit f6a94aeaaa3a81347821e7a092d43dd04115f5f6 +Subproject commit e3d9c0cc3ffa1435003f934a0f0e6c7d969a022a diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 6dc9879ce..d4a7ea02f 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -292,7 +292,7 @@ class Grid: >>> import damask >>> N_grains = 20 >>> cells = (32,32,32) - >>> damask.util.run(f'neper -T -n {N_grains} -tesrsize {cells[0]}:{cells[1]}:{cells[2]} -periodicity "all" -format "vtk"') + >>> damask.util.run(f'neper -T -n {N_grains} -tesrsize {cells[0]}:{cells[1]}:{cells[2]} -periodicity all -format vtk') >>> damask.Grid.load_Neper(f'n{N_grains}-id1.vtk') cells: 32 × 32 × 32 size: 1.0 × 1.0 × 1.0 m³ From 8e668a565ec500007adabccf06fdad5d4afbf5a1 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 21 Apr 2022 21:58:03 +0200 Subject: [PATCH 33/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-223-gd916c7c6b --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index b96558745..f5c5e0426 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-221-gdff78154a +v3.0.0-alpha6-223-gd916c7c6b From 745f5348cd0bc4c816cfb694cc9c1b7bac9f5302 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Apr 2022 00:01:54 +0200 Subject: [PATCH 34/36] running new tests --- src/grid/spectral_utilities.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 3f7c32668..8e7da7647 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -350,6 +350,8 @@ subroutine spectral_utilities_init() allocate (gamma_hat(3,3,3,3,cells1Red,cells(2),cells3), source = cmplx(0.0_pReal,0.0_pReal,pReal)) endif + call selfTest() + end subroutine spectral_utilities_init From 690b2e9c21c2dbcaf8725666a7c6fe51cba116ff Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Apr 2022 07:18:53 +0200 Subject: [PATCH 35/36] tolerances were to strict for certain operations --- src/grid/spectral_utilities.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 8e7da7647..4375ec860 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -1165,7 +1165,7 @@ subroutine selfTest() call utilities_FFTtensorForward() call utilities_FFTtensorBackward() tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal - if (maxval(abs(tensorField_real_ - tensorField_real))>1.0e-15_pReal) error stop 'tensorField' + if (maxval(abs(tensorField_real_ - tensorField_real))>5.0e-15_pReal) error stop 'tensorField' call random_number(vectorField_real) vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal @@ -1173,7 +1173,7 @@ subroutine selfTest() call utilities_FFTvectorForward() call utilities_FFTvectorBackward() vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal - if (maxval(abs(vectorField_real_ - vectorField_real))>1.0e-15_pReal) error stop 'vectorField' + if (maxval(abs(vectorField_real_ - vectorField_real))>5.0e-15_pReal) error stop 'vectorField' call random_number(scalarField_real) scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal @@ -1181,7 +1181,7 @@ subroutine selfTest() call utilities_FFTscalarForward() call utilities_FFTscalarBackward() scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal - if (maxval(abs(scalarField_real_ - scalarField_real))>1.0e-15_pReal) error stop 'scalarField' + if (maxval(abs(scalarField_real_ - scalarField_real))>5.0e-15_pReal) error stop 'scalarField' end subroutine selfTest From 5d12ef5b9f0c59ec9203c32b1c6f5c2b70ffdfba Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 22 Apr 2022 18:07:42 +0200 Subject: [PATCH 36/36] [skip ci] updated version information after successful test of v3.0.0-alpha6-228-g758ad6072 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index f5c5e0426..f8dcddc79 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-223-gd916c7c6b +v3.0.0-alpha6-228-g758ad6072