From 1eb1e54f78f67e70cac35372c3766475ea853bf9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 6 May 2021 08:47:30 +0200 Subject: [PATCH 01/24] adjustment to new structure/names was missing reason: test missing/not good --- src/phase_mechanical_eigen.f90 | 2 +- src/phase_mechanical_eigen_thermalexpansion.f90 | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index 8587b2bc8..b34aee58b 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -70,7 +70,7 @@ module subroutine eigendeformation_init(phases) allocate(model_damage(phases%length), source = KINEMATICS_UNDEFINED_ID) where(damage_anisobrittle_init()) model_damage = KINEMATICS_cleavage_opening_ID - where(damage_isoductile_init()) model_damage = KINEMATICS_slipplane_opening_ID + where(damage_isoductile_init()) model_damage = KINEMATICS_slipplane_opening_ID end subroutine eigendeformation_init diff --git a/src/phase_mechanical_eigen_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 index e47db4f37..cee60d675 100644 --- a/src/phase_mechanical_eigen_thermalexpansion.f90 +++ b/src/phase_mechanical_eigen_thermalexpansion.f90 @@ -33,14 +33,16 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics) class(tNode), pointer :: & phases, & phase, & + mech, & kinematics, & kinematic_type print'(/,a)', ' <<<+- phase:mechanical:eigen:thermalexpansion init -+>>>' - myKinematics = kinematics_active('thermal_expansion',kinematics_length) + myKinematics = kinematics_active('thermalexpansion',kinematics_length) + print*, myKinematics Ninstances = count(myKinematics) - print'(a,i2)', ' # instances: ',Ninstances; flush(IO_STDOUT) + print'(a,i2)', ' # phases: ',Ninstances; flush(IO_STDOUT) if(Ninstances == 0) return phases => config_material%get('phase') @@ -51,7 +53,8 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics) if(any(myKinematics(:,p))) kinematics_thermal_expansion_instance(p) = count(myKinematics(:,1:p)) phase => phases%get(p) if(count(myKinematics(:,p)) == 0) cycle - kinematics => phase%get('kinematics') + mech => phase%get('mechanical') + kinematics => mech%get('eigen') do k = 1, kinematics%length if(myKinematics(k,p)) then associate(prm => param(kinematics_thermal_expansion_instance(p))) From 80b6aaec77b77dff14f1eeb70b77b8482487b6bb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 13:31:18 +0200 Subject: [PATCH 02/24] inclusion of rules not needed --- CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 533b14e85..d78027557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,6 @@ if (PETSC_DIR STREQUAL "") endif () set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables") -set (petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules" ) # Use existing variables from PETSc # https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake @@ -36,7 +35,6 @@ file (WRITE "## This file was auto generated by CMake # PETSC_DIR = ${PETSC_DIR} SHELL = /bin/sh -include ${petsc_conf_rules} include ${petsc_conf_variables} INCLUDE_DIRS := \${PETSC_FC_INCLUDES} LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB} @@ -74,9 +72,9 @@ foreach (exlib ${TMP_LIST}) set (PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}") endforeach (exlib) -message ("Found PETSC_DIR:\n${PETSC_DIR}\n" ) -message ("Found PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" ) -message ("Found PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") +message ("PETSC_DIR:\n${PETSC_DIR}\n" ) +message ("PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" ) +message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") #--------------------------------------------------------------------------------------- # Now start to care about DAMASK From 49d51e196cc08d3d4b8c747445678f8fee15c4e3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 13:39:08 +0200 Subject: [PATCH 03/24] no hope for GPI flang will hopefully work in the near future --- CMakeLists.txt | 2 -- cmake/Compiler-PGI.cmake | 52 ---------------------------------------- src/DAMASK_interface.f90 | 7 +----- src/rotations.f90 | 2 +- 4 files changed, 2 insertions(+), 61 deletions(-) delete mode 100644 cmake/Compiler-PGI.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d78027557..281d65aee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,8 +137,6 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") include (Compiler-Intel) elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") include (Compiler-GNU) -elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI") - include (Compiler-PGI) else () message (FATAL_ERROR "Compiler type (CMAKE_Fortran_COMPILER_ID) not recognized") endif () diff --git a/cmake/Compiler-PGI.cmake b/cmake/Compiler-PGI.cmake deleted file mode 100644 index 8ca8cfc5c..000000000 --- a/cmake/Compiler-PGI.cmake +++ /dev/null @@ -1,52 +0,0 @@ -################################################################################################### -# PGI Compiler -################################################################################################### - -if (OPENMP) - set (OPENMP_FLAGS "-mp") -else () - set (OPENMP_FLAGS "-nomp") -endif () - - -if (OPTIMIZATION STREQUAL "OFF") - set (OPTIMIZATION_FLAGS "-O0" ) -elseif (OPTIMIZATION STREQUAL "DEFENSIVE") - set (OPTIMIZATION_FLAGS "-O2 -fast") -elseif (OPTIMIZATION STREQUAL "AGGRESSIVE") - set (OPTIMIZATION_FLAGS "-O4 -fast -Mvect=sse") -endif () - -set (STANDARD_CHECK "-Mallocatable=03 -Mstandard") - -#------------------------------------------------------------------------------------------------ -# Fine tuning compilation options -set (COMPILE_FLAGS "${COMPILE_FLAGS} -Mpreprocess") -# preprocessor - -set (COMPILE_FLAGS "${COMPILE_FLAGS} -Minfo=all") -# instructs the compiler to produce information on standard error - -set (COMPILE_FLAGS "${COMPILE_FLAGS} -Minform=warn") -# instructs the compiler to display error messages at the specified and higher levels - -set (COMPILE_FLAGS "${COMPILE_FLAGS} -Mdclchk") -# instructs the compiler to require that all program variables be declared - -#------------------------------------------------------------------------------------------------O -# Runtime debugging -set (DEBUG_FLAGS "${DEBUG_FLAGS} -g") -# Includes debugging information in the object module; sets the optimization level to zero unless a -⁠O option is present on the command line -set (DEBUG_FLAGS "${DEBUG_FLAGS} -C") -# Generates code to check array bounds -set (DEBUG_FLAGS "${DEBUG_FLAGS} -Mchkptr") -# Check for NULL pointers (pgf95, pgfortran only) -set (DEBUG_FLAGS "${DEBUG_FLAGS} -Mchkstk") -# Check the stack for available space upon entry to and before the start of a parallel region. Useful when many private variables are declared -set (DEBUG_FLAGS "${DEBUG_FLAGS} -Mbounds") -# Specifies whether array bounds checking is enabled or disabled - -#------------------------------------------------------------------------------------------------ -# precision settings -set (PRECISION_FLAGS "${PRECISION_FLAGS} -r8") -# Determines whether the compiler promotes REAL variables and constants to DOUBLE PRECISION diff --git a/src/DAMASK_interface.f90 b/src/DAMASK_interface.f90 index e01c050fa..43398d0ad 100644 --- a/src/DAMASK_interface.f90 +++ b/src/DAMASK_interface.f90 @@ -96,15 +96,10 @@ subroutine DAMASK_interface_init print'(/,a)', ' Version: '//DAMASKVERSION - ! https://github.com/jeffhammond/HPCInfo/blob/master/docs/Preprocessor-Macros.md -#if defined(__PGI) - print'(/,a,i4.4,a,i8.8)', ' Compiled with PGI fortran version :', __PGIC__,& - '.', __PGIC_MINOR__ -#else print'(/,a)', ' Compiled with: '//compiler_version() print'(a)', ' Compiler options: '//compiler_options() -#endif + ! https://github.com/jeffhammond/HPCInfo/blob/master/docs/Preprocessor-Macros.md print'(/,a)', ' Compiled on: '//__DATE__//' at '//__TIME__ print'(/,a,i0,a,i0,a,i0)', & diff --git a/src/rotations.f90 b/src/rotations.f90 index 531b08d14..8d7b842fc 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -638,7 +638,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 || defined(__INTEL_COMPILER) && INTEL_COMPILER<1800 || defined(__PGI) +#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) From 3a5ecc8be513ee1bd1a9611b8eef862a570020c8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 14:26:17 +0200 Subject: [PATCH 04/24] simplified and in correct order --- CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 281d65aee..a3b477139 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,6 @@ pkg_check_modules (PETSC REQUIRED PETSc>=3.12.0 PETSc<3.16.0) pkg_get_variable (CMAKE_Fortran_COMPILER PETSc fcompiler) pkg_get_variable (CMAKE_C_COMPILER PETSc ccompiler) -find_program (CAT_EXECUTABLE NAMES cat) -execute_process (COMMAND ${CAT_EXECUTABLE} ${PROJECT_SOURCE_DIR}/VERSION - RESULT_VARIABLE DAMASK_VERSION_RETURN - OUTPUT_VARIABLE DAMASK_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) #--------------------------------------------------------------------------------------- # Find PETSc from system environment @@ -90,7 +85,11 @@ elseif (DAMASK_SOLVER STREQUAL "mesh") else () message (FATAL_ERROR "Build target (DAMASK_SOLVER) is not defined") endif () + +file (READ ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) +string (STRIP ${DAMASK_VERSION} DAMASK_VERSION) add_definitions (-DDAMASKVERSION="${DAMASK_VERSION}") + add_definitions (-DPETSc) message ("\nBuilding ${CMAKE_PROJECT_NAME}\n") From 15c498f1ed9cc8e3ad25c8c12b88b9ff95b95bf6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 14:36:20 +0200 Subject: [PATCH 05/24] polishing --- CMakeLists.txt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3b477139..442c61fde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,20 +39,17 @@ extlibs: \t@echo \${LIBRARIES} ") -# CMake will execute each target in the ${petsc_config_makefile} -# to acquire corresponding PETSc Variables. +# CMake will execute each target in petsc_config_makefile to acquire corresponding PETSc Variables. find_program (MAKE_EXECUTABLE NAMES gmake make) -# Find the PETSc includes directory settings execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "includes" RESULT_VARIABLE PETSC_INCLUDES_RETURN OUTPUT_VARIABLE petsc_includes OUTPUT_STRIP_TRAILING_WHITESPACE) -# Find the PETSc external linking directory settings execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "extlibs" RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN OUTPUT_VARIABLE petsc_external_lib OUTPUT_STRIP_TRAILING_WHITESPACE) -# Remove temporary makefile, no need to keep it anymore. + file (REMOVE_RECURSE ${TEMPDIR}) # Remove duplicate compiler and linker flags @@ -75,7 +72,7 @@ message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") # Now start to care about DAMASK # DAMASK solver defines project to build -string(TOLOWER ${DAMASK_SOLVER} DAMASK_SOLVER) +string(TOLOWER "${DAMASK_SOLVER}" DAMASK_SOLVER) if (DAMASK_SOLVER STREQUAL "grid") project (damask-grid HOMEPAGE_URL https://damask.mpie.de LANGUAGES Fortran C) add_definitions (-DGrid) @@ -86,8 +83,7 @@ else () message (FATAL_ERROR "Build target (DAMASK_SOLVER) is not defined") endif () -file (READ ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) -string (STRIP ${DAMASK_VERSION} DAMASK_VERSION) +file (STRINGS ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) add_definitions (-DDAMASKVERSION="${DAMASK_VERSION}") add_definitions (-DPETSc) From d4f439ae8b9443f14675ae8b0b9a664c34afbc11 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 17:19:11 +0200 Subject: [PATCH 06/24] read directly from file detour via dummy makefile not needed --- CMakeLists.txt | 54 +++++++++++--------------------------------------- 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 442c61fde..af84d411d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,54 +16,24 @@ if (PETSC_DIR STREQUAL "") message (FATAL_ERROR "PETSc location (PETSC_DIR) is not defined") endif () -set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables") - -# Use existing variables from PETSc -# https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake - -# Generate a temporary makefile to probe the PETSc configuration -# This file will be deleted once the settings from PETSc are parsed into CMake -exec_program (mktemp ARGS -d OUTPUT_VARIABLE TEMPDIR) -set (petsc_config_makefile "${TEMPDIR}/Makefile.petsc") -file (WRITE -"${petsc_config_makefile}" -"## This file was auto generated by CMake -# PETSC_DIR = ${PETSC_DIR} -SHELL = /bin/sh -include ${petsc_conf_variables} -INCLUDE_DIRS := \${PETSC_FC_INCLUDES} -LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB} -includes: -\t@echo \${INCLUDE_DIRS} -extlibs: -\t@echo \${LIBRARIES} -") - -# CMake will execute each target in petsc_config_makefile to acquire corresponding PETSc Variables. -find_program (MAKE_EXECUTABLE NAMES gmake make) -execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "includes" - RESULT_VARIABLE PETSC_INCLUDES_RETURN - OUTPUT_VARIABLE petsc_includes - OUTPUT_STRIP_TRAILING_WHITESPACE) -execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "extlibs" - RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN - OUTPUT_VARIABLE petsc_external_lib - OUTPUT_STRIP_TRAILING_WHITESPACE) - -file (REMOVE_RECURSE ${TEMPDIR}) - -# Remove duplicate compiler and linker flags -string (REGEX MATCHALL "-I([^\" ]+)" TMP_LIST "${petsc_includes}") -list (REMOVE_DUPLICATES TMP_LIST) -foreach (dir ${TMP_LIST}) - set (PETSC_INCLUDES "${PETSC_INCLUDES} ${dir}") -endforeach (dir) +file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" petsc_external_lib REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?") +string (REPLACE "=" ";" petsc_external_lib "${petsc_external_lib}") +list (GET petsc_external_lib 1 petsc_external_lib) string (REGEX MATCHALL "-[lLW]([^\" ]+)" TMP_LIST "${petsc_external_lib}") list (REMOVE_DUPLICATES TMP_LIST) foreach (exlib ${TMP_LIST}) set (PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}") endforeach (exlib) +file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" petsc_includes REGEX "PETSC_FC_INCLUDES = .*$?") +string (REPLACE "=" ";" petsc_includes "${petsc_includes}") +list (GET petsc_includes 1 petsc_includes) +string (REGEX MATCHALL "-I([^\" ]+)" TMP_LIST "${petsc_includes}") +list (REMOVE_DUPLICATES TMP_LIST) +foreach (dir ${TMP_LIST}) + set (PETSC_INCLUDES "${PETSC_INCLUDES} ${dir}") +endforeach (dir) + message ("PETSC_DIR:\n${PETSC_DIR}\n" ) message ("PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" ) message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") From 3cf2ea17499a46ee64cee001f7a54938fa878bea Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 17:31:59 +0200 Subject: [PATCH 07/24] simplified --- CMakeLists.txt | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af84d411d..3efae3f70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,26 +16,18 @@ if (PETSC_DIR STREQUAL "") message (FATAL_ERROR "PETSc location (PETSC_DIR) is not defined") endif () -file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" petsc_external_lib REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?") -string (REPLACE "=" ";" petsc_external_lib "${petsc_external_lib}") -list (GET petsc_external_lib 1 petsc_external_lib) -string (REGEX MATCHALL "-[lLW]([^\" ]+)" TMP_LIST "${petsc_external_lib}") -list (REMOVE_DUPLICATES TMP_LIST) -foreach (exlib ${TMP_LIST}) - set (PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}") -endforeach (exlib) +file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?") +string (REGEX MATCHALL "-[lLW]([^\" ]+)" PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}") +list (REMOVE_DUPLICATES PETSC_EXTERNAL_LIB) +string (REPLACE ";" " " PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}") -file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" petsc_includes REGEX "PETSC_FC_INCLUDES = .*$?") -string (REPLACE "=" ";" petsc_includes "${petsc_includes}") -list (GET petsc_includes 1 petsc_includes) -string (REGEX MATCHALL "-I([^\" ]+)" TMP_LIST "${petsc_includes}") -list (REMOVE_DUPLICATES TMP_LIST) -foreach (dir ${TMP_LIST}) - set (PETSC_INCLUDES "${PETSC_INCLUDES} ${dir}") -endforeach (dir) +file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_INCLUDES REGEX "PETSC_FC_INCLUDES = .*$?") +string (REGEX MATCHALL "-I([^\" ]+)" PETSC_INCLUDES "${PETSC_INCLUDES}") +list (REMOVE_DUPLICATES PETSC_INCLUDES) +string (REPLACE ";" " " PETSC_INCLUDES "${PETSC_INCLUDES}") -message ("PETSC_DIR:\n${PETSC_DIR}\n" ) -message ("PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" ) +message ("PETSC_DIR:\n${PETSC_DIR}\n") +message ("PETSC_INCLUDES:\n${PETSC_INCLUDES}\n") message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") #--------------------------------------------------------------------------------------- From f6684a0692dd6fdc98296e2f129d30e1082c293a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 18:53:25 +0200 Subject: [PATCH 08/24] easier to read --- CMakeLists.txt | 51 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3efae3f70..6491eafb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required (VERSION 3.10.0) include (FindPkgConfig REQUIRED) +set(PETSC_DIR $ENV{PETSC_DIR}) +if (PETSC_DIR STREQUAL "") + message (FATAL_ERROR "PETSc location (PETSC_DIR) is not defined") +endif () +message ("PETSC_DIR:\n${PETSC_DIR}\n") + # Dummy project to determine compiler names and version project (Prerequisites LANGUAGES) set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig") @@ -8,32 +14,7 @@ pkg_check_modules (PETSC REQUIRED PETSc>=3.12.0 PETSc<3.16.0) pkg_get_variable (CMAKE_Fortran_COMPILER PETSc fcompiler) pkg_get_variable (CMAKE_C_COMPILER PETSc ccompiler) - -#--------------------------------------------------------------------------------------- -# Find PETSc from system environment -set(PETSC_DIR $ENV{PETSC_DIR}) -if (PETSC_DIR STREQUAL "") - message (FATAL_ERROR "PETSc location (PETSC_DIR) is not defined") -endif () - -file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?") -string (REGEX MATCHALL "-[lLW]([^\" ]+)" PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}") -list (REMOVE_DUPLICATES PETSC_EXTERNAL_LIB) -string (REPLACE ";" " " PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}") - -file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_INCLUDES REGEX "PETSC_FC_INCLUDES = .*$?") -string (REGEX MATCHALL "-I([^\" ]+)" PETSC_INCLUDES "${PETSC_INCLUDES}") -list (REMOVE_DUPLICATES PETSC_INCLUDES) -string (REPLACE ";" " " PETSC_INCLUDES "${PETSC_INCLUDES}") - -message ("PETSC_DIR:\n${PETSC_DIR}\n") -message ("PETSC_INCLUDES:\n${PETSC_INCLUDES}\n") -message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") - -#--------------------------------------------------------------------------------------- -# Now start to care about DAMASK - -# DAMASK solver defines project to build +# Solver determines name of project string(TOLOWER "${DAMASK_SOLVER}" DAMASK_SOLVER) if (DAMASK_SOLVER STREQUAL "grid") project (damask-grid HOMEPAGE_URL https://damask.mpie.de LANGUAGES Fortran C) @@ -46,11 +27,11 @@ else () endif () file (STRINGS ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) -add_definitions (-DDAMASKVERSION="${DAMASK_VERSION}") + +message ("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n") add_definitions (-DPETSc) - -message ("\nBuilding ${CMAKE_PROJECT_NAME}\n") +add_definitions (-DDAMASKVERSION="${DAMASK_VERSION}") if (CMAKE_BUILD_TYPE STREQUAL "") set (CMAKE_BUILD_TYPE "RELEASE") @@ -98,6 +79,18 @@ else () message (FATAL_ERROR "Compiler type (CMAKE_Fortran_COMPILER_ID) not recognized") endif () +file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?") +string (REGEX MATCHALL "-[lLW]([^\" ]+)" PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}") +list (REMOVE_DUPLICATES PETSC_EXTERNAL_LIB) +string (REPLACE ";" " " PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}") +message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") + +file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_INCLUDES REGEX "PETSC_FC_INCLUDES = .*$?") +string (REGEX MATCHALL "-I([^\" ]+)" PETSC_INCLUDES "${PETSC_INCLUDES}") +list (REMOVE_DUPLICATES PETSC_INCLUDES) +string (REPLACE ";" " " PETSC_INCLUDES "${PETSC_INCLUDES}") +message ("PETSC_INCLUDES:\n${PETSC_INCLUDES}\n") + set (CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${BUILDCMD_PRE} ${OPENMP_FLAGS} ${STANDARD_CHECK} ${OPTIMIZATION_FLAGS} ${COMPILE_FLAGS} ${PRECISION_FLAGS}") set (CMAKE_Fortran_LINK_EXECUTABLE "${BUILDCMD_PRE} ${CMAKE_Fortran_COMPILER} ${OPENMP_FLAGS} ${OPTIMIZATION_FLAGS} ${LINKER_FLAGS}") From 67352d9ec72b5198e07ce482aa6c9cfe4b44afc1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 19:22:06 +0200 Subject: [PATCH 09/24] location depends on PETSC_ARCH (if set) --- CMakeLists.txt | 10 +++++----- src/CMakeLists.txt | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6491eafb6..a6a133fe4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required (VERSION 3.10.0) include (FindPkgConfig REQUIRED) -set(PETSC_DIR $ENV{PETSC_DIR}) -if (PETSC_DIR STREQUAL "") +if (DEFINED ENV{PETSC_DIR}) + message ("PETSC_DIR:\n$ENV{PETSC_DIR}\n") +else () message (FATAL_ERROR "PETSc location (PETSC_DIR) is not defined") endif () -message ("PETSC_DIR:\n${PETSC_DIR}\n") # Dummy project to determine compiler names and version project (Prerequisites LANGUAGES) @@ -79,13 +79,13 @@ else () message (FATAL_ERROR "Compiler type (CMAKE_Fortran_COMPILER_ID) not recognized") endif () -file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?") +file (STRINGS "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?") string (REGEX MATCHALL "-[lLW]([^\" ]+)" PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}") list (REMOVE_DUPLICATES PETSC_EXTERNAL_LIB) string (REPLACE ";" " " PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}") message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") -file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_INCLUDES REGEX "PETSC_FC_INCLUDES = .*$?") +file (STRINGS "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/petsc/conf/petscvariables" PETSC_INCLUDES REGEX "PETSC_FC_INCLUDES = .*$?") string (REGEX MATCHALL "-I([^\" ]+)" PETSC_INCLUDES "${PETSC_INCLUDES}") list (REMOVE_DUPLICATES PETSC_INCLUDES) string (REPLACE ";" " " PETSC_INCLUDES "${PETSC_INCLUDES}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c20754a67..af0c75223 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,23 +14,23 @@ list(FILTER damask-sources EXCLUDE REGEX ".*commercialFEM_fileList.*.f90") if (PROJECT_NAME STREQUAL "damask-grid") - file(GLOB grid-sources grid/*.f90) + file(GLOB grid-sources grid/*.f90) - if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY") + if (NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY") add_executable(DAMASK_grid ${damask-sources} ${grid-sources}) install (TARGETS DAMASK_grid RUNTIME DESTINATION bin) - else() + else () add_library(DAMASK_grid OBJECT ${damask-sources} ${grid-sources}) exec_program (mktemp OUTPUT_VARIABLE nothing) exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole) install (PROGRAMS ${nothing} DESTINATION ${black_hole}) - endif() + endif () elseif (PROJECT_NAME STREQUAL "damask-mesh") - file(GLOB mesh-sources mesh/*.f90) + file(GLOB mesh-sources mesh/*.f90) - add_executable(DAMASK_mesh ${damask-sources} ${mesh-sources}) - install (TARGETS DAMASK_mesh RUNTIME DESTINATION bin) + add_executable(DAMASK_mesh ${damask-sources} ${mesh-sources}) + install (TARGETS DAMASK_mesh RUNTIME DESTINATION bin) -endif() +endif () From 54a3c2300cdc3ce12a2152b4c6813c140b7558f1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 May 2021 22:10:26 +0200 Subject: [PATCH 10/24] new release instructions modernized cmake allows building on fedora without any modification to system wide files --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index dab246aea..3014c71db 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit dab246aea2cc3f29d57e0043edfebd3aedded124 +Subproject commit 3014c71db7288217b3bde41e8d891485f23e040a From ab070a3c13116c9789316bb6f6724e21195cb75b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 May 2021 10:02:28 +0200 Subject: [PATCH 11/24] data for thermal expansion --- PRIVATE | 2 +- examples/config/phase/Al.yaml | 4 ++-- examples/config/phase/Au.yaml | 4 ++++ examples/config/phase/Cu.yaml | 4 ++++ examples/config/phase/Fe.yaml | 4 ++-- examples/config/phase/Ni.yaml | 4 ++-- examples/config/phase/Ti.yaml | 6 ++++++ examples/config/phase/W.yaml | 4 ++++ examples/config/phase/alpha-Ti.yaml | 2 -- .../mechanical/eigen/thermalexpansion_Al.yaml | 5 +++++ .../mechanical/eigen/thermalexpansion_Au.yaml | 5 +++++ .../eigen/thermalexpansion_C35E.yaml | 5 +++++ .../mechanical/eigen/thermalexpansion_Cu.yaml | 5 +++++ .../mechanical/eigen/thermalexpansion_Fe.yaml | 5 +++++ .../mechanical/eigen/thermalexpansion_W.yaml | 5 +++++ .../eigen/thermalexpansion_X20Cr13.yaml | 5 +++++ .../phase/mechanical/elastic/Hooke_Cu.yaml | 6 ++++++ .../{Hooke_cpTi.yaml => Hooke_Ti.yaml} | 0 .../phase/mechanical/elastic/Hooke_W.yaml | 8 +++++++ .../plastic/dislotwin_IF-steel.yaml | 2 +- .../mechanical/plastic/phenopowerlaw_Au.yaml | 21 +++++++++++-------- examples/config/phase/thermal/Al.yaml | 4 +--- examples/config/phase/thermal/Au.yaml | 4 ++++ examples/config/phase/thermal/Cu.yaml | 4 ++++ examples/config/phase/thermal/Steel-0.5C.yaml | 4 +--- examples/config/phase/thermal/W.yaml | 4 ++++ src/phase_thermal.f90 | 8 +++---- 27 files changed, 105 insertions(+), 29 deletions(-) create mode 100644 examples/config/phase/Au.yaml create mode 100644 examples/config/phase/Cu.yaml create mode 100644 examples/config/phase/Ti.yaml create mode 100644 examples/config/phase/W.yaml delete mode 100644 examples/config/phase/alpha-Ti.yaml create mode 100644 examples/config/phase/mechanical/eigen/thermalexpansion_Al.yaml create mode 100644 examples/config/phase/mechanical/eigen/thermalexpansion_Au.yaml create mode 100644 examples/config/phase/mechanical/eigen/thermalexpansion_C35E.yaml create mode 100644 examples/config/phase/mechanical/eigen/thermalexpansion_Cu.yaml create mode 100644 examples/config/phase/mechanical/eigen/thermalexpansion_Fe.yaml create mode 100644 examples/config/phase/mechanical/eigen/thermalexpansion_W.yaml create mode 100644 examples/config/phase/mechanical/eigen/thermalexpansion_X20Cr13.yaml create mode 100644 examples/config/phase/mechanical/elastic/Hooke_Cu.yaml rename examples/config/phase/mechanical/elastic/{Hooke_cpTi.yaml => Hooke_Ti.yaml} (100%) create mode 100644 examples/config/phase/mechanical/elastic/Hooke_W.yaml create mode 100644 examples/config/phase/thermal/Au.yaml create mode 100644 examples/config/phase/thermal/Cu.yaml create mode 100644 examples/config/phase/thermal/W.yaml diff --git a/PRIVATE b/PRIVATE index 0744cf7f9..37b196668 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 0744cf7f93dbd06423baaae97a67959f11c3e6a5 +Subproject commit 37b19666872a67acdc3c70c270335fd21f11986e diff --git a/examples/config/phase/Al.yaml b/examples/config/phase/Al.yaml index 9d6daf88f..57004df14 100644 --- a/examples/config/phase/Al.yaml +++ b/examples/config/phase/Al.yaml @@ -1,4 +1,4 @@ -lattice: cF -rho: 2700 references: - en.wikipedia.org/wiki/Aluminium +lattice: cF +rho: 2700.0 diff --git a/examples/config/phase/Au.yaml b/examples/config/phase/Au.yaml new file mode 100644 index 000000000..23c1f30f1 --- /dev/null +++ b/examples/config/phase/Au.yaml @@ -0,0 +1,4 @@ +references: + - en.wikipedia.org/wiki/Gold +lattice: cF +rho: 19300.0 diff --git a/examples/config/phase/Cu.yaml b/examples/config/phase/Cu.yaml new file mode 100644 index 000000000..bcf9e8717 --- /dev/null +++ b/examples/config/phase/Cu.yaml @@ -0,0 +1,4 @@ +references: + - en.wikipedia.org/wiki/Copper +lattice: cF +rho: 8960.0 diff --git a/examples/config/phase/Fe.yaml b/examples/config/phase/Fe.yaml index e8d39fdbe..cce09d634 100644 --- a/examples/config/phase/Fe.yaml +++ b/examples/config/phase/Fe.yaml @@ -1,4 +1,4 @@ -lattice: cI -rho: 7874 references: - en.wikipedia.org/wiki/Iron +lattice: cI +rho: 7874.0 diff --git a/examples/config/phase/Ni.yaml b/examples/config/phase/Ni.yaml index 49adb9e11..1f9316118 100644 --- a/examples/config/phase/Ni.yaml +++ b/examples/config/phase/Ni.yaml @@ -1,4 +1,4 @@ -lattice: cF -rho: 8908 references: - en.wikipedia.org/wiki/Nickel +lattice: cF +rho: 8908.0 diff --git a/examples/config/phase/Ti.yaml b/examples/config/phase/Ti.yaml new file mode 100644 index 000000000..a9811786b --- /dev/null +++ b/examples/config/phase/Ti.yaml @@ -0,0 +1,6 @@ +references: + - www.totalmateria.com/page.aspx?ID=CheckArticle&site=ktn&NM=221 + - en.wikipedia.org/wiki/Titanium +lattice: hP +c/a: 1.587 +rho: 4506.0 diff --git a/examples/config/phase/W.yaml b/examples/config/phase/W.yaml new file mode 100644 index 000000000..c770bb891 --- /dev/null +++ b/examples/config/phase/W.yaml @@ -0,0 +1,4 @@ +references: + - en.wikipedia.org/wiki/Tungsten +lattice: cF +rho: 19300.0 diff --git a/examples/config/phase/alpha-Ti.yaml b/examples/config/phase/alpha-Ti.yaml deleted file mode 100644 index 5bd2580a2..000000000 --- a/examples/config/phase/alpha-Ti.yaml +++ /dev/null @@ -1,2 +0,0 @@ -lattice: hP -c/a: 1.587 diff --git a/examples/config/phase/mechanical/eigen/thermalexpansion_Al.yaml b/examples/config/phase/mechanical/eigen/thermalexpansion_Al.yaml new file mode 100644 index 000000000..1876141f6 --- /dev/null +++ b/examples/config/phase/mechanical/eigen/thermalexpansion_Al.yaml @@ -0,0 +1,5 @@ +type: thermalexpansion +references: + - en.wikipedia.org/wiki/Thermal_expansion +A_11: [23.1e-6] +T_ref: 293.15 diff --git a/examples/config/phase/mechanical/eigen/thermalexpansion_Au.yaml b/examples/config/phase/mechanical/eigen/thermalexpansion_Au.yaml new file mode 100644 index 000000000..5d8030e1e --- /dev/null +++ b/examples/config/phase/mechanical/eigen/thermalexpansion_Au.yaml @@ -0,0 +1,5 @@ +type: thermalexpansion +references: + - en.wikipedia.org/wiki/Thermal_expansion +A_11: [14e-6] +T_ref: 293.15 diff --git a/examples/config/phase/mechanical/eigen/thermalexpansion_C35E.yaml b/examples/config/phase/mechanical/eigen/thermalexpansion_C35E.yaml new file mode 100644 index 000000000..dea09aa43 --- /dev/null +++ b/examples/config/phase/mechanical/eigen/thermalexpansion_C35E.yaml @@ -0,0 +1,5 @@ +type: thermalexpansion +references: + - en.wikipedia.org/wiki/Thermal_expansion, fitted from image description +A_11: [12.70371e-6, 7.54e-9, -1.0e-11] +T_ref: 273.0 diff --git a/examples/config/phase/mechanical/eigen/thermalexpansion_Cu.yaml b/examples/config/phase/mechanical/eigen/thermalexpansion_Cu.yaml new file mode 100644 index 000000000..3eb41aa90 --- /dev/null +++ b/examples/config/phase/mechanical/eigen/thermalexpansion_Cu.yaml @@ -0,0 +1,5 @@ +type: thermalexpansion +references: + - en.wikipedia.org/wiki/Thermal_expansion +A_11: [17e-6] +T_ref: 293.15 diff --git a/examples/config/phase/mechanical/eigen/thermalexpansion_Fe.yaml b/examples/config/phase/mechanical/eigen/thermalexpansion_Fe.yaml new file mode 100644 index 000000000..f36250490 --- /dev/null +++ b/examples/config/phase/mechanical/eigen/thermalexpansion_Fe.yaml @@ -0,0 +1,5 @@ +type: thermalexpansion +references: + - en.wikipedia.org/wiki/Thermal_expansion +A_11: [11.8e-6] +T_ref: 293.15 diff --git a/examples/config/phase/mechanical/eigen/thermalexpansion_W.yaml b/examples/config/phase/mechanical/eigen/thermalexpansion_W.yaml new file mode 100644 index 000000000..a6d069bd3 --- /dev/null +++ b/examples/config/phase/mechanical/eigen/thermalexpansion_W.yaml @@ -0,0 +1,5 @@ +type: thermalexpansion +references: + - en.wikipedia.org/wiki/Thermal_expansion +A_11: [4.5e-6] +T_ref: 293.15 diff --git a/examples/config/phase/mechanical/eigen/thermalexpansion_X20Cr13.yaml b/examples/config/phase/mechanical/eigen/thermalexpansion_X20Cr13.yaml new file mode 100644 index 000000000..7842b9d6d --- /dev/null +++ b/examples/config/phase/mechanical/eigen/thermalexpansion_X20Cr13.yaml @@ -0,0 +1,5 @@ +type: thermalexpansion +references: + - en.wikipedia.org/wiki/Thermal_expansion, fitted from image description +A_11: [11.365e-6, 5.0e-9] +T_ref: 273.0 diff --git a/examples/config/phase/mechanical/elastic/Hooke_Cu.yaml b/examples/config/phase/mechanical/elastic/Hooke_Cu.yaml new file mode 100644 index 000000000..b55c83bdf --- /dev/null +++ b/examples/config/phase/mechanical/elastic/Hooke_Cu.yaml @@ -0,0 +1,6 @@ +type: Hooke +references: + - www.mit.edu/~6.777/matprops/copper.htm, fixed typo +C_11: 168.3e9 +C_12: 122.1e9 +C_44: 75.7e9 diff --git a/examples/config/phase/mechanical/elastic/Hooke_cpTi.yaml b/examples/config/phase/mechanical/elastic/Hooke_Ti.yaml similarity index 100% rename from examples/config/phase/mechanical/elastic/Hooke_cpTi.yaml rename to examples/config/phase/mechanical/elastic/Hooke_Ti.yaml diff --git a/examples/config/phase/mechanical/elastic/Hooke_W.yaml b/examples/config/phase/mechanical/elastic/Hooke_W.yaml new file mode 100644 index 000000000..58561106a --- /dev/null +++ b/examples/config/phase/mechanical/elastic/Hooke_W.yaml @@ -0,0 +1,8 @@ +type: Hooke +references: + - D. Cereceda et al., + International Journal of Plasticity, 78, 242-265, 2016, + 10.1016/j.ijplas.2015.09.002 +C_11: 523.e9 +C_12: 202.e9 +C_44: 161.e9 diff --git a/examples/config/phase/mechanical/plastic/dislotwin_IF-steel.yaml b/examples/config/phase/mechanical/plastic/dislotwin_IF-steel.yaml index b5defb6db..3da7038a2 100644 --- a/examples/config/phase/mechanical/plastic/dislotwin_IF-steel.yaml +++ b/examples/config/phase/mechanical/plastic/dislotwin_IF-steel.yaml @@ -1,7 +1,7 @@ type: dislotwin references: - K. Sedighiani et al., - International Journal of Plasticity, 134, 102779, 2020 + International Journal of Plasticity, 134, 102779, 2020, 10.1016/j.ijplas.2020.102779 - K. Sedighiani et al., Mechanics of Materials, submitted diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Au.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Au.yaml index 840f3ff30..baf7c7c14 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Au.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Au.yaml @@ -1,14 +1,17 @@ -# parameters fitted by D. Ma to: -# On the mathematical description of the tensile stress-strain curves of polycrystalline face centered cubic metals -# International Journal of Plasticity, Volume 12, Issue 1, 1996, Pages 35-43 -# DOI: 10.1016/S0749-6419(95)00043-7 type: phenopowerlaw -output: [xi_sl] +references: + - D. Ma et al., + Acta Materialia, 103, 796-808, 2016, + 10.1016/j.actamat.2015.11.016 + - I. Kovács and G.Vörös, + International Journal of Plasticity, 12, 35-43, 1996, + 10.1016/S0749-6419(95)00043-7 +output: [xi_sl, gamma_sl] N_sl: [12] -n_sl: 83 +n_sl: 83.3 dot_gamma_0_sl: 0.001 -h_0_sl_sl: 75e6 +h_0_sl_sl: 75.0e6 h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] a_sl: 1.0 -xi_0_sl: [26e6] -xi_inf_sl: [53e6] +xi_0_sl: [26.25e6] +xi_inf_sl: [53.0e6] diff --git a/examples/config/phase/thermal/Al.yaml b/examples/config/phase/thermal/Al.yaml index 8837f30af..87fadc143 100644 --- a/examples/config/phase/thermal/Al.yaml +++ b/examples/config/phase/thermal/Al.yaml @@ -1,7 +1,5 @@ references: - www.engineeringtoolbox.com/thermal-conductivity-metals-d_858.html - www.engineeringtoolbox.com/specific-heat-metals-d_152.html -c_p: 0.91e3 +c_p: 910.0 K_11: 236.0 -K_22: 236.0 -K_33: 236.0 diff --git a/examples/config/phase/thermal/Au.yaml b/examples/config/phase/thermal/Au.yaml new file mode 100644 index 000000000..68b6c2255 --- /dev/null +++ b/examples/config/phase/thermal/Au.yaml @@ -0,0 +1,4 @@ +references: + - de.wikipedia.org/wiki/Gold +c_p: 128.0 +K_11: 320.0 diff --git a/examples/config/phase/thermal/Cu.yaml b/examples/config/phase/thermal/Cu.yaml new file mode 100644 index 000000000..a5bfdfae0 --- /dev/null +++ b/examples/config/phase/thermal/Cu.yaml @@ -0,0 +1,4 @@ +references: + - www.mit.edu/~6.777/matprops/copper.htm +c_p: 385.0 +K_11: 401.0 diff --git a/examples/config/phase/thermal/Steel-0.5C.yaml b/examples/config/phase/thermal/Steel-0.5C.yaml index 861cbbee5..89d9c8616 100644 --- a/examples/config/phase/thermal/Steel-0.5C.yaml +++ b/examples/config/phase/thermal/Steel-0.5C.yaml @@ -1,7 +1,5 @@ references: - www.engineeringtoolbox.com/thermal-conductivity-metals-d_858.html - www.engineeringtoolbox.com/specific-heat-metals-d_152.html -c_p: 0.49e3 +c_p: 490.0 K_11: 54.0 -K_22: 54.0 -K_33: 54.0 diff --git a/examples/config/phase/thermal/W.yaml b/examples/config/phase/thermal/W.yaml new file mode 100644 index 000000000..39e838075 --- /dev/null +++ b/examples/config/phase/thermal/W.yaml @@ -0,0 +1,4 @@ +references: + - www.mit.edu/~6.777/matprops/tungsten.htm +c_p: 132.51 +K_11: 178.0 diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index 8d6ccaf6f..cbe467838 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -101,10 +101,10 @@ module subroutine thermal_init(phases) phase => phases%get(ph) thermal => phase%get('thermal',defaultVal=emptyDict) param(ph)%C_p = thermal%get_asFloat('c_p',defaultVal=0.0_pReal) - if (param(ph)%C_p <= 0) param(ph)%C_p = thermal%get_asFloat('C_p',defaultVal=0.0_pReal) - param(ph)%K(1,1) = thermal%get_asFloat('K_11',defaultVal=0.0_pReal) - param(ph)%K(2,2) = thermal%get_asFloat('K_22',defaultVal=0.0_pReal) - param(ph)%K(3,3) = thermal%get_asFloat('K_33',defaultVal=0.0_pReal) + if (param(ph)%C_p <= 0) param(ph)%C_p = thermal%get_asFloat('C_p',defaultVal=0.0_pReal) ! ToDo: decide on capitalization + param(ph)%K(1,1) = thermal%get_asFloat('K_11',defaultVal=0.0_pReal) ! ToDo: make mandatory? + param(ph)%K(2,2) = thermal%get_asFloat('K_22',defaultVal=0.0_pReal) ! ToDo: depends on symmtery + param(ph)%K(3,3) = thermal%get_asFloat('K_33',defaultVal=0.0_pReal) ! ToDo: depends on symmtery param(ph)%K = lattice_applyLatticeSymmetry33(param(ph)%K,phase%get_asString('lattice')) sources => thermal%get('source',defaultVal=emptyList) From 40698740aa14057ec44db9e66a7f5943612ea412 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 May 2021 14:17:04 +0200 Subject: [PATCH 12/24] fixed symmetry handling - ort not tested, no examples, no documentation => removed - aP is the opposite of isotropic => removed isostropic materials can be easily specified as cI or cF, using C_44 = 1/2 * (C_11 - C_12). Acceptable extra effort for special use case orthorhombic can be easily implemented if needed, but needs test, documentation, and examples --- PRIVATE | 2 +- .../Phase_Dislotwin_TWIP-Steel-FeMnC.yaml | 2 +- examples/config/Phase_Dislotwin_Tungsten.yaml | 2 +- .../Phase_Isotropic_AluminumIsotropic.yaml | 16 ---- .../config/Phase_Isotropic_FreeSurface.yaml | 4 +- .../config/Phase_Phenopowerlaw_Aluminum.yaml | 2 +- .../Phase_Phenopowerlaw_BCC-Ferrite.yaml | 2 +- .../Phase_Phenopowerlaw_BCC-Martensite.yaml | 2 +- .../config/Phase_Phenopowerlaw_Magnesium.yaml | 2 +- examples/config/Phase_Phenopowerlaw_cpTi.yaml | 2 +- examples/config/phase/thermal/Al.yaml | 2 +- examples/config/phase/thermal/Au.yaml | 2 +- examples/config/phase/thermal/Cu.yaml | 2 +- examples/config/phase/thermal/Steel-0.5C.yaml | 2 +- examples/config/phase/thermal/W.yaml | 2 +- examples/config/phase/thermal/adiabatic.yaml | 2 +- .../config/phase/thermal/fast-convection.yaml | 2 +- .../reference/ConfigMaterial/material.yaml | 4 +- .../Result/12grains6x7x8.material.yaml | 4 +- .../Result/4grains2x4x3.material.yaml | 6 +- .../6grains6x7x8_single_phase.material.yaml | 2 +- src/lattice.f90 | 76 ++++--------------- src/phase_mechanical.f90 | 8 +- 23 files changed, 41 insertions(+), 109 deletions(-) delete mode 100644 examples/config/Phase_Isotropic_AluminumIsotropic.yaml diff --git a/PRIVATE b/PRIVATE index 37b196668..14e754308 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 37b19666872a67acdc3c70c270335fd21f11986e +Subproject commit 14e754308e81545a231220f9d993fb4571729ced diff --git a/examples/config/Phase_Dislotwin_TWIP-Steel-FeMnC.yaml b/examples/config/Phase_Dislotwin_TWIP-Steel-FeMnC.yaml index 610421886..f5353b3b6 100644 --- a/examples/config/Phase_Dislotwin_TWIP-Steel-FeMnC.yaml +++ b/examples/config/Phase_Dislotwin_TWIP-Steel-FeMnC.yaml @@ -1,7 +1,7 @@ TWIP_Steel_FeMnC: lattice: cF mechanical: - elastic: {type: hooke, C_11: 175.0e9, C_12: 115.0e9, C_44: 135.0e9} + elastic: {type: Hooke, C_11: 175.0e9, C_12: 115.0e9, C_44: 135.0e9} plastic: type: dislotwin output: [rho_mob, rho_dip, gamma_sl, Lambda_sl, tau_pass, f_tw, Lambda_tw, tau_hat_tw, f_tr] diff --git a/examples/config/Phase_Dislotwin_Tungsten.yaml b/examples/config/Phase_Dislotwin_Tungsten.yaml index d49149017..397cfb662 100644 --- a/examples/config/Phase_Dislotwin_Tungsten.yaml +++ b/examples/config/Phase_Dislotwin_Tungsten.yaml @@ -1,7 +1,7 @@ Tungsten: lattice: cI mechanical: - elastic: {type: hooke, C_11: 523.0e9, C_12: 202.0e9, C_44: 161.0e9} # Marinica et al. Journal of Physics: Condensed Matter(2013) + elastic: {type: Hooke, C_11: 523.0e9, C_12: 202.0e9, C_44: 161.0e9} # Marinica et al. Journal of Physics: Condensed Matter(2013) plastic: type: dislotwin D: 2.0e-5 # Average grain size / m diff --git a/examples/config/Phase_Isotropic_AluminumIsotropic.yaml b/examples/config/Phase_Isotropic_AluminumIsotropic.yaml deleted file mode 100644 index 684b6dbb2..000000000 --- a/examples/config/Phase_Isotropic_AluminumIsotropic.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Kuo, J. C., Mikrostrukturmechanik von Bikristallen mit Kippkorngrenzen. Shaker-Verlag 2004. http://edoc.mpg.de/204079 -Aluminum: - lattice: aP - mechanical: - output: [F, P, F_e, F_p, L_p] - elastic: {type: hooke, C_11: 110.9e9, C_12: 58.34e9} - plastic: - type: isotropic - output: [xi] - xi_0: 31e6 - xi_inf: 63e6 - dot_gamma_0: 0.001 - n: 20 - M: 3 - h_0: 75e6 - a: 2.25 diff --git a/examples/config/Phase_Isotropic_FreeSurface.yaml b/examples/config/Phase_Isotropic_FreeSurface.yaml index 8d8d1354d..649baf992 100644 --- a/examples/config/Phase_Isotropic_FreeSurface.yaml +++ b/examples/config/Phase_Isotropic_FreeSurface.yaml @@ -1,8 +1,8 @@ FreeSurface: - lattice: aP + lattice: cI mechanical: output: [F, P, F_e, F_p, L_p] - elastic: {type: hooke, C_11: 1e8, C_12: 1e6} + elastic: {type: Hooke, C_11: 1e8, C_12: 1e6, C_44: 4.95e7} plastic: type: isotropic output: [xi] diff --git a/examples/config/Phase_Phenopowerlaw_Aluminum.yaml b/examples/config/Phase_Phenopowerlaw_Aluminum.yaml index 24da127fc..f05c18272 100644 --- a/examples/config/Phase_Phenopowerlaw_Aluminum.yaml +++ b/examples/config/Phase_Phenopowerlaw_Aluminum.yaml @@ -2,7 +2,7 @@ Aluminum: lattice: cF mechanical: output: [F, P, F_e, F_p, L_p, O] - elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} + elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] a_sl: 2.25 diff --git a/examples/config/Phase_Phenopowerlaw_BCC-Ferrite.yaml b/examples/config/Phase_Phenopowerlaw_BCC-Ferrite.yaml index 03b7e2013..609414dad 100644 --- a/examples/config/Phase_Phenopowerlaw_BCC-Ferrite.yaml +++ b/examples/config/Phase_Phenopowerlaw_BCC-Ferrite.yaml @@ -4,7 +4,7 @@ Ferrite: lattice: cI mechanical: - elastic: {C_11: 233.3e9, C_12: 135.5e9, C_44: 118.0e9, type: hooke} + elastic: {C_11: 233.3e9, C_12: 135.5e9, C_44: 118.0e9, type: Hooke} plastic: N_sl: [12, 12] a_sl: 2.0 diff --git a/examples/config/Phase_Phenopowerlaw_BCC-Martensite.yaml b/examples/config/Phase_Phenopowerlaw_BCC-Martensite.yaml index d2667f111..a14a9a182 100644 --- a/examples/config/Phase_Phenopowerlaw_BCC-Martensite.yaml +++ b/examples/config/Phase_Phenopowerlaw_BCC-Martensite.yaml @@ -4,7 +4,7 @@ Martensite: lattice: cI mechanical: - elastic: {C_11: 417.4e9, C_12: 242.4e9, C_44: 211.1e9, type: hooke} + elastic: {C_11: 417.4e9, C_12: 242.4e9, C_44: 211.1e9, type: Hooke} plastic: N_sl: [12, 12] a_sl: 2.0 diff --git a/examples/config/Phase_Phenopowerlaw_Magnesium.yaml b/examples/config/Phase_Phenopowerlaw_Magnesium.yaml index d42cca09f..050ad0790 100644 --- a/examples/config/Phase_Phenopowerlaw_Magnesium.yaml +++ b/examples/config/Phase_Phenopowerlaw_Magnesium.yaml @@ -4,7 +4,7 @@ Magnesium: c/a: 1.62350 mechanical: output: [F, P, F_e, F_p, L_p, O] - elastic: {C_11: 59.3e9, C_12: 25.7e9, C_13: 21.4e9, C_33: 61.5e9, C_44: 16.4e9, type: hooke} + elastic: {C_11: 59.3e9, C_12: 25.7e9, C_13: 21.4e9, C_33: 61.5e9, C_44: 16.4e9, type: Hooke} plastic: N_sl: [3, 3, 0, 6, 0, 6] N_tw: [6, 0, 0, 6] diff --git a/examples/config/Phase_Phenopowerlaw_cpTi.yaml b/examples/config/Phase_Phenopowerlaw_cpTi.yaml index 2a444d570..6300a74e1 100644 --- a/examples/config/Phase_Phenopowerlaw_cpTi.yaml +++ b/examples/config/Phase_Phenopowerlaw_cpTi.yaml @@ -6,7 +6,7 @@ cpTi: c/a: 1.587 mechanical: output: [F, P, F_e, F_p, L_p, O] - elastic: {C_11: 160.0e9, C_12: 90.0e9, C_13: 66.0e9, C_33: 181.7e9, C_44: 46.5e9, type: hooke} + elastic: {C_11: 160.0e9, C_12: 90.0e9, C_13: 66.0e9, C_33: 181.7e9, C_44: 46.5e9, type: Hooke} plastic: N_sl: [3, 3, 0, 6, 12] a_sl: 2.0 diff --git a/examples/config/phase/thermal/Al.yaml b/examples/config/phase/thermal/Al.yaml index 87fadc143..1f714c743 100644 --- a/examples/config/phase/thermal/Al.yaml +++ b/examples/config/phase/thermal/Al.yaml @@ -1,5 +1,5 @@ references: - www.engineeringtoolbox.com/thermal-conductivity-metals-d_858.html - www.engineeringtoolbox.com/specific-heat-metals-d_152.html -c_p: 910.0 +C_p: 910.0 K_11: 236.0 diff --git a/examples/config/phase/thermal/Au.yaml b/examples/config/phase/thermal/Au.yaml index 68b6c2255..f8f4dda4d 100644 --- a/examples/config/phase/thermal/Au.yaml +++ b/examples/config/phase/thermal/Au.yaml @@ -1,4 +1,4 @@ references: - de.wikipedia.org/wiki/Gold -c_p: 128.0 +C_p: 128.0 K_11: 320.0 diff --git a/examples/config/phase/thermal/Cu.yaml b/examples/config/phase/thermal/Cu.yaml index a5bfdfae0..7f5b89fcc 100644 --- a/examples/config/phase/thermal/Cu.yaml +++ b/examples/config/phase/thermal/Cu.yaml @@ -1,4 +1,4 @@ references: - www.mit.edu/~6.777/matprops/copper.htm -c_p: 385.0 +C_p: 385.0 K_11: 401.0 diff --git a/examples/config/phase/thermal/Steel-0.5C.yaml b/examples/config/phase/thermal/Steel-0.5C.yaml index 89d9c8616..736969e1e 100644 --- a/examples/config/phase/thermal/Steel-0.5C.yaml +++ b/examples/config/phase/thermal/Steel-0.5C.yaml @@ -1,5 +1,5 @@ references: - www.engineeringtoolbox.com/thermal-conductivity-metals-d_858.html - www.engineeringtoolbox.com/specific-heat-metals-d_152.html -c_p: 490.0 +C_p: 490.0 K_11: 54.0 diff --git a/examples/config/phase/thermal/W.yaml b/examples/config/phase/thermal/W.yaml index 39e838075..eba6ab7bc 100644 --- a/examples/config/phase/thermal/W.yaml +++ b/examples/config/phase/thermal/W.yaml @@ -1,4 +1,4 @@ references: - www.mit.edu/~6.777/matprops/tungsten.htm -c_p: 132.51 +C_p: 132.51 K_11: 178.0 diff --git a/examples/config/phase/thermal/adiabatic.yaml b/examples/config/phase/thermal/adiabatic.yaml index c0956cb0d..e4e2b1626 100644 --- a/examples/config/phase/thermal/adiabatic.yaml +++ b/examples/config/phase/thermal/adiabatic.yaml @@ -1,4 +1,4 @@ -c_p: 1 +C_p: 1 K_11: 0 K_22: 0 K_33: 0 diff --git a/examples/config/phase/thermal/fast-convection.yaml b/examples/config/phase/thermal/fast-convection.yaml index c266acf1e..5d6cfae52 100644 --- a/examples/config/phase/thermal/fast-convection.yaml +++ b/examples/config/phase/thermal/fast-convection.yaml @@ -1,4 +1,4 @@ -c_p: 1 +C_p: 1 K_11: 1e30 K_22: 1e30 K_33: 1e30 diff --git a/python/tests/reference/ConfigMaterial/material.yaml b/python/tests/reference/ConfigMaterial/material.yaml index 48ebd98e3..6fdbbb52a 100644 --- a/python/tests/reference/ConfigMaterial/material.yaml +++ b/python/tests/reference/ConfigMaterial/material.yaml @@ -36,9 +36,9 @@ phase: lattice: cF mechanics: output: [F, P, F_e, F_p, L_p] - elasticity: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} + elasticity: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} Steel: lattice: cI mechanics: output: [F, P, F_e, F_p, L_p] - elasticity: {C_11: 233.3e9, C_12: 135.5e9, C_44: 118.0e9, type: hooke} + elasticity: {C_11: 233.3e9, C_12: 135.5e9, C_44: 118.0e9, type: Hooke} diff --git a/python/tests/reference/Result/12grains6x7x8.material.yaml b/python/tests/reference/Result/12grains6x7x8.material.yaml index 8d3f53cfb..741f6457e 100644 --- a/python/tests/reference/Result/12grains6x7x8.material.yaml +++ b/python/tests/reference/Result/12grains6x7x8.material.yaml @@ -9,7 +9,7 @@ phase: lattice: cF mechanical: output: [F, P, F_e, F_p, L_p, O] - elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} + elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] a_sl: 2.25 @@ -26,7 +26,7 @@ phase: lattice: cI mechanical: output: [F, P, F_e, F_p, L_p, O] - elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} + elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] a_sl: 2.25 diff --git a/python/tests/reference/Result/4grains2x4x3.material.yaml b/python/tests/reference/Result/4grains2x4x3.material.yaml index ff2c90164..6b7c83809 100644 --- a/python/tests/reference/Result/4grains2x4x3.material.yaml +++ b/python/tests/reference/Result/4grains2x4x3.material.yaml @@ -641,7 +641,7 @@ phase: lattice: cF mechanical: output: [F, F_e, F_p, L_p] - elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} + elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] a_sl: 2.25 @@ -658,7 +658,7 @@ phase: lattice: cI mechanical: output: [F, P, F_e, F_p, L_p, O] - elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} + elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] a_sl: 2.25 @@ -675,4 +675,4 @@ phase: lattice: cI mechanical: output: [F] - elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} + elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} diff --git a/python/tests/reference/Result/6grains6x7x8_single_phase.material.yaml b/python/tests/reference/Result/6grains6x7x8_single_phase.material.yaml index a06d679db..1894d4b2b 100644 --- a/python/tests/reference/Result/6grains6x7x8_single_phase.material.yaml +++ b/python/tests/reference/Result/6grains6x7x8_single_phase.material.yaml @@ -9,7 +9,7 @@ phase: lattice: cF mechanical: output: [F, P, F_e, F_p, L_p, O] - elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} + elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: Hooke} plastic: N_sl: [12] a_sl: 2.25 diff --git a/src/lattice.f90 b/src/lattice.f90 index 055f2d2f1..974baff85 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -296,7 +296,6 @@ module lattice integer, parameter :: & BCT_NSLIP = sum(BCT_NSLIPSYSTEM) !< total # of slip systems for bct - real(pReal), dimension(3+3,BCT_NSLIP), parameter :: & BCT_SYSTEMSLIP = reshape(real([& ! {100)<001] systems @@ -366,30 +365,13 @@ module lattice 1, 1, 1, 1,-2, 1 & ],pReal),shape(BCT_SYSTEMSLIP)) !< bct slip systems for c/a = 0.5456 (Sn), sorted by Bieler 2009 (https://doi.org/10.1007/s11664-009-0909-x) -!-------------------------------------------------------------------------------------------------- -! orthorhombic primitive (oP) - integer, dimension(*), parameter :: & - ORT_NCLEAVAGESYSTEM = [1, 1, 1] !< # of cleavage systems per family for orthorhombic primitive - - integer, parameter :: & - ORT_NCLEAVAGE = sum(ORT_NCLEAVAGESYSTEM) !< total # of cleavage systems for orthorhombic primitive - - real(pReal), dimension(3+3,ORT_NCLEAVAGE), parameter :: & - ORT_SYSTEMCLEAVAGE = reshape(real([& - 0, 1, 0, 1, 0, 0, & - 0, 0, 1, 0, 1, 0, & - 1, 0, 0, 0, 0, 1 & - ],pReal),shape(ORT_SYSTEMCLEAVAGE)) !< orthorhombic primitive cleavage systems - enum, bind(c); enumerator :: & lattice_UNDEFINED_ID, & - lattice_ISO_ID, & lattice_FCC_ID, & lattice_BCC_ID, & - lattice_BCT_ID, & lattice_HEX_ID, & - lattice_ORT_ID + lattice_BCT_ID end enum ! SHOULD NOT BE PART OF LATTICE BEGIN @@ -414,12 +396,10 @@ module lattice public :: & lattice_init, & - lattice_ISO_ID, & lattice_FCC_ID, & lattice_BCC_ID, & - lattice_BCT_ID, & lattice_HEX_ID, & - lattice_ORT_ID, & + lattice_BCT_ID, & lattice_equivalent_nu, & lattice_equivalent_mu, & lattice_applyLatticeSymmetry33, & @@ -479,12 +459,12 @@ subroutine lattice_init elasticity => mech%get('elastic') lattice_C66(1,1,ph) = elasticity%get_asFloat('C_11') lattice_C66(1,2,ph) = elasticity%get_asFloat('C_12') + lattice_C66(4,4,ph) = elasticity%get_asFloat('C_44') lattice_C66(1,3,ph) = elasticity%get_asFloat('C_13',defaultVal=0.0_pReal) lattice_C66(2,2,ph) = elasticity%get_asFloat('C_22',defaultVal=0.0_pReal) lattice_C66(2,3,ph) = elasticity%get_asFloat('C_23',defaultVal=0.0_pReal) lattice_C66(3,3,ph) = elasticity%get_asFloat('C_33',defaultVal=0.0_pReal) - lattice_C66(4,4,ph) = elasticity%get_asFloat('C_44',defaultVal=0.0_pReal) lattice_C66(5,5,ph) = elasticity%get_asFloat('C_55',defaultVal=0.0_pReal) lattice_C66(6,6,ph) = elasticity%get_asFloat('C_66',defaultVal=0.0_pReal) @@ -497,10 +477,6 @@ subroutine lattice_init lattice_structure(ph) = lattice_HEX_ID case('tI') lattice_structure(ph) = lattice_BCT_ID - case('oP') - lattice_structure(ph) = lattice_ORT_ID - case('aP') - lattice_structure(ph) = lattice_ISO_ID case default call IO_error(130,ext_msg='lattice_init: '//phase%get_asString('lattice')) end select @@ -1565,9 +1541,6 @@ function lattice_SchmidMatrix_cleavage(Ncleavage,structure,cOverA) result(Schmid integer :: i select case(structure) - case('oP') - NcleavageMax = ORT_NCLEAVAGESYSTEM - cleavageSystems = ORT_SYSTEMCLEAVAGE case('cF') NcleavageMax = FCC_NCLEAVAGESYSTEM cleavageSystems = FCC_SYSTEMCLEAVAGE @@ -1705,15 +1678,15 @@ function lattice_applyLatticeSymmetry33(T,structure) result(T_sym) T_sym = 0.0_pReal select case(structure) - case('aP','cF','cI') + case('cF','cI') do k=1,3 T_sym(k,k) = T(1,1) enddo - case('hP') + case('hP') ! MD TODO: I think that 'tI' has the same symmetry as 'hP' for 2nd order tensors T_sym(1,1) = T(1,1) T_sym(2,2) = T(1,1) T_sym(3,3) = T(3,3) - case('oP','tI') + case('tI') T_sym(1,1) = T(1,1) T_sym(2,2) = T(2,2) T_sym(3,3) = T(3,3) @@ -1740,21 +1713,13 @@ function applyLatticeSymmetryC66(C66,structure) result(C66_sym) C66_sym = 0.0_pReal select case(structure) - case ('aP') - do k=1,3 - do j=1,3 - C66_sym(k,j) = C66(1,2) - enddo - C66_sym(k,k) = C66(1,1) - C66_sym(k+3,k+3) = 0.5_pReal*(C66(1,1)-C66(1,2)) - enddo case ('cF','cI') do k=1,3 do j=1,3 C66_sym(k,j) = C66(1,2) enddo C66_sym(k,k) = C66(1,1) - C66_sym(k+3,k+3) = C66(4,4) + C66_sym(k+3,k+3) = C66(4,4) ! isotropic C_44 = .5*(C_11-C_12) enddo case ('hP') C66_sym(1,1) = C66(1,1) @@ -1769,19 +1734,6 @@ function applyLatticeSymmetryC66(C66,structure) result(C66_sym) C66_sym(4,4) = C66(4,4) C66_sym(5,5) = C66(4,4) C66_sym(6,6) = 0.5_pReal*(C66(1,1)-C66(1,2)) - case ('oP') - C66_sym(1,1) = C66(1,1) - C66_sym(2,2) = C66(2,2) - C66_sym(3,3) = C66(3,3) - C66_sym(1,2) = C66(1,2) - C66_sym(2,1) = C66(1,2) - C66_sym(1,3) = C66(1,3) - C66_sym(3,1) = C66(1,3) - C66_sym(2,3) = C66(2,3) - C66_sym(3,2) = C66(2,3) - C66_sym(4,4) = C66(4,4) - C66_sym(5,5) = C66(5,5) - C66_sym(6,6) = C66(6,6) case ('tI') C66_sym(1,1) = C66(1,1) C66_sym(2,2) = C66(1,1) @@ -2012,7 +1964,7 @@ function buildCoordinateSystem(active,potential,system,structure,cOverA) select case(structure) - case ('cF','cI','aP','oP','tI') + case ('cF','cI','tI') direction = system(1:3,p) normal = system(4:6,p) @@ -2247,7 +2199,6 @@ function lattice_equivalent_nu(C,assumption) result(nu) / (S(1,1)+S(2,2)+S(3,3) +2.0_pReal*(S(1,2)+S(2,3)+S(1,3))) else error stop 'invalid assumption' - K = 0.0_pReal endif mu = lattice_equivalent_mu(C,assumption) @@ -2280,7 +2231,6 @@ function lattice_equivalent_mu(C,assumption) result(mu) / (4.0_pReal*(S(1,1)+S(2,2)+S(3,3)) -4.0_pReal*(S(1,2)+S(2,3)+S(1,3)) +3.0_pReal*(S(4,4)+S(5,5)+S(6,6))) else error stop 'invalid assumption' - mu = 0.0_pReal endif end function lattice_equivalent_mu @@ -2298,6 +2248,7 @@ subroutine selfTest real(pReal), dimension(2) :: r real(pReal) :: lambda + call random_number(r) system = reshape([1.0_pReal+r(1),0.0_pReal,0.0_pReal, 0.0_pReal,1.0_pReal+r(2),0.0_pReal],[6,1]) @@ -2305,10 +2256,11 @@ subroutine selfTest if(any(dNeq(CoSy(1:3,1:3,1),math_I3))) error stop 'buildCoordinateSystem' call random_number(C) - C(1,1) = C(1,1) + 1.0_pReal - C = applyLatticeSymmetryC66(C,'aP') - if(dNeq(C(6,6),lattice_equivalent_mu(C,'voigt'),1.0e-12_pReal)) error stop 'equivalent_mu/voigt' - if(dNeq(C(6,6),lattice_equivalent_mu(C,'voigt'),1.0e-12_pReal)) error stop 'equivalent_mu/reuss' + C(1,1) = C(1,1) + C(1,2) + 0.1_pReal + C(4,4) = 0.5_pReal * (C(1,1) - C(1,2)) + C = applyLatticeSymmetryC66(C,'cI') + if(dNeq(C(4,4),lattice_equivalent_mu(C,'voigt'),1.0e-12_pReal)) error stop 'equivalent_mu/voigt' + if(dNeq(C(4,4),lattice_equivalent_mu(C,'reuss'),1.0e-12_pReal)) error stop 'equivalent_mu/reuss' lambda = C(1,2) if(dNeq(lambda*0.5_pReal/(lambda+lattice_equivalent_mu(C,'voigt')), & diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index be0bca892..1897d8d5c 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -947,18 +947,14 @@ subroutine crystallite_results(group,ph) 'second Piola-Kirchhoff stress','Pa') case('O') select case(lattice_structure(ph)) - case(lattice_ISO_ID) - structureLabel = 'aP' case(lattice_FCC_ID) structureLabel = 'cF' case(lattice_BCC_ID) structureLabel = 'cI' - case(lattice_BCT_ID) - structureLabel = 'tI' case(lattice_HEX_ID) structureLabel = 'hP' - case(lattice_ORT_ID) - structureLabel = 'oP' + case(lattice_BCT_ID) + structureLabel = 'tI' end select selected_rotations = select_rotations(crystallite_orientation,ph) call results_writeDataset(group//'/mechanical',selected_rotations,output_constituent(ph)%label(ou),& From 0d0bc188ebbfec854003e3517d927ad4029f097f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 May 2021 17:17:27 +0200 Subject: [PATCH 13/24] potentially less error prone (and easier to read) --- src/lattice.f90 | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/lattice.f90 b/src/lattice.f90 index 974baff85..88f18ac2e 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -486,7 +486,7 @@ subroutine lattice_init lattice_nu(ph) = lattice_equivalent_nu(lattice_C66(1:6,1:6,ph),'voigt') lattice_mu(ph) = lattice_equivalent_mu(lattice_C66(1:6,1:6,ph),'voigt') - lattice_C66(1:6,1:6,ph) = math_sym3333to66(math_Voigt66to3333(lattice_C66(1:6,1:6,ph))) ! Literature data is in Voigt notation + lattice_C66(1:6,1:6,ph) = math_sym3333to66(math_Voigt66to3333(lattice_C66(1:6,1:6,ph))) ! Literature data is in Voigt notation do i = 1, 6 if (abs(lattice_C66(i,i,ph)) Date: Mon, 24 May 2021 17:19:38 +0200 Subject: [PATCH 14/24] only Hooke as model and this model should take care of the elastic constants, not lattice --- src/phase_mechanical_elastic.f90 | 35 +++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index e25e5e8d2..a3a204557 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -1,12 +1,11 @@ submodule(phase:mechanical) elastic - enum, bind(c); enumerator :: & - ELASTICITY_UNDEFINED_ID, & - ELASTICITY_HOOKE_ID - end enum + type :: tParameters + real(pReal), dimension(6,6) :: & + C66 !< Elastic constants in Voig notation + end type tParameters - integer(kind(ELASTICITY_UNDEFINED_ID)), dimension(:), allocatable :: & - phase_elasticity !< elasticity of each phase + type(tParameters), allocatable, dimension(:) :: param contains @@ -22,20 +21,28 @@ module subroutine elastic_init(phases) phase, & mech, & elastic - + + print'(/,a)', ' <<<+- phase:mechanical:elastic init -+>>>' - allocate(phase_elasticity(phases%length), source = ELASTICITY_undefined_ID) + allocate(param(phases%length)) do ph = 1, phases%length phase => phases%get(ph) mech => phase%get('mechanical') elastic => mech%get('elastic') - if(IO_lc(elastic%get_asString('type')) == 'hooke') then ! accept small letter h for the moment - phase_elasticity(ph) = ELASTICITY_HOOKE_ID - else - call IO_error(200,ext_msg=elastic%get_asString('type')) - endif + if (elastic%get_asString('type') /= 'Hooke') call IO_error(200,ext_msg=elastic%get_asString('type')) + + associate(prm => param(ph)) + prm%C66(1,1) = elastic%get_asFloat('C_11') + prm%C66(1,2) = elastic%get_asFloat('C_12') + prm%C66(4,4) = elastic%get_asFloat('C_44') + + prm%C66(1,3) = elastic%get_asFloat('C_13',defaultVal=0.0_pReal) + prm%C66(2,3) = elastic%get_asFloat('C_23',defaultVal=0.0_pReal) + prm%C66(3,3) = elastic%get_asFloat('C_33',defaultVal=0.0_pReal) + prm%C66(6,6) = elastic%get_asFloat('C_66',defaultVal=0.0_pReal) + end associate enddo end subroutine elastic_init @@ -63,9 +70,9 @@ module subroutine phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & real(pReal), dimension(3,3) :: E real(pReal), dimension(3,3,3,3) :: C integer :: & - d, & !< counter in degradation loop i, j + C = math_66toSym3333(phase_homogenizedC(ph,en)) C = phase_damage_C(C,ph,en) From f44edb31fc74b031f02d80def49f3fcb9b6fd351 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 May 2021 17:20:33 +0200 Subject: [PATCH 15/24] polishing --- src/phase_mechanical_plastic_isotropic.f90 | 8 ++++---- src/phase_thermal.f90 | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index 0e7920f1d..4701a4514 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -36,10 +36,10 @@ submodule(phase:plastic) isotropic !-------------------------------------------------------------------------------------------------- ! containers for parameters and state - type(tParameters), allocatable, dimension(:) :: param - type(tIsotropicState), allocatable, dimension(:) :: & - dotState, & - state + type(tParameters), allocatable, dimension(:) :: param + type(tIsotropicState), allocatable, dimension(:) :: & + dotState, & + state contains diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index cbe467838..e106d890e 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -100,8 +100,7 @@ module subroutine thermal_init(phases) allocate(current(ph)%dot_T(Nmembers),source=0.0_pReal) phase => phases%get(ph) thermal => phase%get('thermal',defaultVal=emptyDict) - param(ph)%C_p = thermal%get_asFloat('c_p',defaultVal=0.0_pReal) - if (param(ph)%C_p <= 0) param(ph)%C_p = thermal%get_asFloat('C_p',defaultVal=0.0_pReal) ! ToDo: decide on capitalization + param(ph)%C_p = thermal%get_asFloat('C_p',defaultVal=0.0_pReal) param(ph)%K(1,1) = thermal%get_asFloat('K_11',defaultVal=0.0_pReal) ! ToDo: make mandatory? param(ph)%K(2,2) = thermal%get_asFloat('K_22',defaultVal=0.0_pReal) ! ToDo: depends on symmtery param(ph)%K(3,3) = thermal%get_asFloat('K_33',defaultVal=0.0_pReal) ! ToDo: depends on symmtery From f525999f521300ff1410ae3775a7b1d20409ad06 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 May 2021 17:39:09 +0200 Subject: [PATCH 16/24] updated tests --- PRIVATE | 2 +- src/lattice.f90 | 32 +++++++++----------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/PRIVATE b/PRIVATE index 14e754308..51fd42213 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 14e754308e81545a231220f9d993fb4571729ced +Subproject commit 51fd422131bbef9ea37a8e63429d907473b778cd diff --git a/src/lattice.f90 b/src/lattice.f90 index 88f18ac2e..a285d4ffb 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -462,10 +462,8 @@ subroutine lattice_init lattice_C66(4,4,ph) = elasticity%get_asFloat('C_44') lattice_C66(1,3,ph) = elasticity%get_asFloat('C_13',defaultVal=0.0_pReal) - lattice_C66(2,2,ph) = elasticity%get_asFloat('C_22',defaultVal=0.0_pReal) lattice_C66(2,3,ph) = elasticity%get_asFloat('C_23',defaultVal=0.0_pReal) lattice_C66(3,3,ph) = elasticity%get_asFloat('C_33',defaultVal=0.0_pReal) - lattice_C66(5,5,ph) = elasticity%get_asFloat('C_55',defaultVal=0.0_pReal) lattice_C66(6,6,ph) = elasticity%get_asFloat('C_66',defaultVal=0.0_pReal) select case(phase%get_asString('lattice')) @@ -1715,34 +1713,22 @@ function applyLatticeSymmetryC66(C66,structure) result(C66_sym) select case(structure) case ('cF','cI') - C66_sym(1,1) = C66(1,1) - C66_sym(2,2) = C66(1,1) - C66_sym(3,3) = C66(1,1) - C66_sym(1,2) = C66(1,2) - C66_sym(1,3) = C66(1,2) - C66_sym(2,3) = C66(1,2) - C66_sym(4,4) = C66(4,4) ! isotropic C_44 = (C_11-C_12)/2 - C66_sym(5,5) = C66(4,4) - C66_sym(6,6) = C66(4,4) + C66_sym(1,1) = C66(1,1); C66_sym(2,2) = C66(1,1); C66_sym(3,3) = C66(1,1) + C66_sym(1,2) = C66(1,2); C66_sym(1,3) = C66(1,2); C66_sym(2,3) = C66(1,2) + C66_sym(4,4) = C66(4,4); C66_sym(5,5) = C66(4,4); C66_sym(6,6) = C66(4,4) ! isotropic C_44 = (C_11-C_12)/2 case ('hP') - C66_sym(1,1) = C66(1,1) - C66_sym(2,2) = C66(1,1) + C66_sym(1,1) = C66(1,1); C66_sym(2,2) = C66(1,1) C66_sym(3,3) = C66(3,3) C66_sym(1,2) = C66(1,2) - C66_sym(1,3) = C66(1,3) - C66_sym(2,3) = C66(1,3) - C66_sym(4,4) = C66(4,4) - C66_sym(5,5) = C66(4,4) + C66_sym(1,3) = C66(1,3); C66_sym(2,3) = C66(1,3) + C66_sym(4,4) = C66(4,4); C66_sym(5,5) = C66(4,4) C66_sym(6,6) = 0.5_pReal*(C66(1,1)-C66(1,2)) case ('tI') - C66_sym(1,1) = C66(1,1) - C66_sym(2,2) = C66(1,1) + C66_sym(1,1) = C66(1,1); C66_sym(2,2) = C66(1,1) C66_sym(3,3) = C66(3,3) C66_sym(1,2) = C66(1,2) - C66_sym(1,3) = C66(1,3) - C66_sym(2,3) = C66(1,3) - C66_sym(4,4) = C66(4,4) - C66_sym(5,5) = C66(4,4) + C66_sym(1,3) = C66(1,3); C66_sym(2,3) = C66(1,3) + C66_sym(4,4) = C66(4,4); C66_sym(5,5) = C66(4,4) C66_sym(6,6) = C66(6,6) case default call IO_error(137,ext_msg='applyLatticeSymmetryC66: '//trim(structure)) From 299c47fd6f65850f74cef8fbe54179f0d06f7c8e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 May 2021 20:33:50 +0200 Subject: [PATCH 17/24] prepare for varying C66 - check structure centrally - pure function with guaranteed return/no stop --- src/lattice.f90 | 15 +++++---------- src/phase_mechanical_elastic.f90 | 15 +++++++++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/lattice.f90 b/src/lattice.f90 index a285d4ffb..405431189 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -1664,22 +1664,21 @@ end function lattice_labels_slip !-------------------------------------------------------------------------------------------------- !> @brief Return 3x3 tensor with symmetry according to given crystal structure !-------------------------------------------------------------------------------------------------- -function lattice_applyLatticeSymmetry33(T,structure) result(T_sym) +pure function lattice_applyLatticeSymmetry33(T,structure) result(T_sym) real(pReal), dimension(3,3) :: T_sym real(pReal), dimension(3,3), intent(in) :: T character(len=*), intent(in) :: structure - integer :: k T_sym = 0.0_pReal select case(structure) case('cF','cI') - do k=1,3 - T_sym(k,k) = T(1,1) - enddo + T_sym(1,1) = T(1,1) + T_sym(2,2) = T(1,1) + T_sym(3,3) = T(1,1) case('hP') ! MD TODO: I think that 'tI' has the same symmetry as 'hP' for 2nd order tensors T_sym(1,1) = T(1,1) T_sym(2,2) = T(1,1) @@ -1688,8 +1687,6 @@ function lattice_applyLatticeSymmetry33(T,structure) result(T_sym) T_sym(1,1) = T(1,1) T_sym(2,2) = T(2,2) T_sym(3,3) = T(3,3) - case default - call IO_error(137,ext_msg='lattice_applyLatticeSymmetry33: '//trim(structure)) end select end function lattice_applyLatticeSymmetry33 @@ -1699,7 +1696,7 @@ end function lattice_applyLatticeSymmetry33 !> @brief Return stiffness matrix in 6x6 notation with symmetry according to given crystal structure !> @details J. A. Rayne and B. S. Chandrasekhar Phys. Rev. 120, 1658 Erratum Phys. Rev. 122, 1962 !-------------------------------------------------------------------------------------------------- -function applyLatticeSymmetryC66(C66,structure) result(C66_sym) +pure function applyLatticeSymmetryC66(C66,structure) result(C66_sym) real(pReal), dimension(6,6) :: C66_sym @@ -1730,8 +1727,6 @@ function applyLatticeSymmetryC66(C66,structure) result(C66_sym) C66_sym(1,3) = C66(1,3); C66_sym(2,3) = C66(1,3) C66_sym(4,4) = C66(4,4); C66_sym(5,5) = C66(4,4) C66_sym(6,6) = C66(6,6) - case default - call IO_error(137,ext_msg='applyLatticeSymmetryC66: '//trim(structure)) end select do i = 1, 6 diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index a3a204557..3397cc572 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -21,6 +21,7 @@ module subroutine elastic_init(phases) phase, & mech, & elastic + character(len=:), allocatable :: struct print'(/,a)', ' <<<+- phase:mechanical:elastic init -+>>>' @@ -34,14 +35,20 @@ module subroutine elastic_init(phases) if (elastic%get_asString('type') /= 'Hooke') call IO_error(200,ext_msg=elastic%get_asString('type')) associate(prm => param(ph)) + struct = phase%get_asString('lattice') + if (struct /= 'cI' .and. struct /= 'cF' .and. struct /= 'hP' .and. struct /= 'tI') & + call IO_error(137,ext_msg=trim(struct)) + prm%C66(1,1) = elastic%get_asFloat('C_11') prm%C66(1,2) = elastic%get_asFloat('C_12') prm%C66(4,4) = elastic%get_asFloat('C_44') - prm%C66(1,3) = elastic%get_asFloat('C_13',defaultVal=0.0_pReal) - prm%C66(2,3) = elastic%get_asFloat('C_23',defaultVal=0.0_pReal) - prm%C66(3,3) = elastic%get_asFloat('C_33',defaultVal=0.0_pReal) - prm%C66(6,6) = elastic%get_asFloat('C_66',defaultVal=0.0_pReal) + if (struct == 'hP' .or. struct == 'tI') then + prm%C66(1,3) = elastic%get_asFloat('C_13') + prm%C66(2,3) = elastic%get_asFloat('C_23') + prm%C66(3,3) = elastic%get_asFloat('C_33') + endif + if (struct == 'tI') prm%C66(6,6) = elastic%get_asFloat('C_66') end associate enddo From ebd6c355646aca4de40dfa765970493f7019e244 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 24 May 2021 22:26:33 +0200 Subject: [PATCH 18/24] testing thermal expansion --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 51fd42213..16db8902c 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 51fd422131bbef9ea37a8e63429d907473b778cd +Subproject commit 16db8902c4b1aeb445057ee070ffc795d4d7774c From 24e862105c208def42ae7f80109ed05a5cff337f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 25 May 2021 06:05:51 +0200 Subject: [PATCH 19/24] ensuring correct lattice symmetries --- src/lattice.f90 | 48 ++++++++++++++++++++++++++------ src/phase_mechanical_elastic.f90 | 1 - 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/lattice.f90 b/src/lattice.f90 index 405431189..769bf47b4 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -2228,11 +2228,13 @@ subroutine selfTest real(pReal), dimension(:,:,:), allocatable :: CoSy real(pReal), dimension(:,:), allocatable :: system - real(pReal), dimension(6,6) :: C + real(pReal), dimension(6,6) :: C, C_cF, C_cI, C_hP, C_tI + real(pReal), dimension(3,3) :: T, T_cF, T_cI, T_hP, T_tI real(pReal), dimension(2) :: r real(pReal) :: lambda integer :: i + call random_number(r) system = reshape([1.0_pReal+r(1),0.0_pReal,0.0_pReal, 0.0_pReal,1.0_pReal+r(2),0.0_pReal],[6,1]) @@ -2241,14 +2243,42 @@ subroutine selfTest do i = 1, 10 call random_number(C) - if (any(dNeq(applyLatticeSymmetryC66(C,'cI'),transpose(applyLatticeSymmetryC66(C,'cF'))))) & - error stop 'applyLatticeSymmetryC66/cI-cF' - if (any(dNeq(applyLatticeSymmetryC66(C,'cF'),transpose(applyLatticeSymmetryC66(C,'cI'))))) & - error stop 'applyLatticeSymmetryC66/cF-cI' - if (any(dNeq(applyLatticeSymmetryC66(C,'hP'),transpose(applyLatticeSymmetryC66(C,'hP'))))) & - error stop 'applyLatticeSymmetryC66/hP' - if (any(dNeq(applyLatticeSymmetryC66(C,'tI'),transpose(applyLatticeSymmetryC66(C,'tI'))))) & - error stop 'applyLatticeSymmetryC66/tI' + C_cF = applyLatticeSymmetryC66(C,'cI') + C_cI = applyLatticeSymmetryC66(C,'cF') + C_hP = applyLatticeSymmetryC66(C,'hP') + C_tI = applyLatticeSymmetryC66(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' + if (any(dNeq(C_hP,transpose(C_hP)))) error stop 'SymmetryC66/hP' + if (any(dNeq(C_tI,transpose(C_tI)))) error stop 'SymmetryC66/tI' + + if (any(dNeq(C(1,1),[C_cF(1,1),C_cF(2,2),C_cF(3,3)]))) error stop 'SymmetryC_11-22-33/c' + if (any(dNeq(C(1,2),[C_cF(1,2),C_cF(1,3),C_cF(2,3)]))) error stop 'SymmetryC_12-13-23/c' + if (any(dNeq(C(4,4),[C_cF(4,4),C_cF(5,5),C_cF(6,6)]))) error stop 'SymmetryC_44-55-66/c' + + if (any(dNeq(C(1,1),[C_hP(1,1),C_hP(2,2)]))) error stop 'SymmetryC_11-22/hP' + if (any(dNeq(C(1,3),[C_hP(1,3),C_hP(2,3)]))) error stop 'SymmetryC_13-23/hP' + if (any(dNeq(C(4,4),[C_hP(4,4),C_hP(5,5)]))) error stop 'SymmetryC_44-55/hP' + + if (any(dNeq(C(1,1),[C_tI(1,1),C_tI(2,2)]))) error stop 'SymmetryC_11-22/tI' + if (any(dNeq(C(1,3),[C_tI(1,3),C_tI(2,3)]))) error stop 'SymmetryC_13-23/tI' + 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_applyLatticeSymmetry33(T,'cI') + T_cI = lattice_applyLatticeSymmetry33(T,'cF') + T_hP = lattice_applyLatticeSymmetry33(T,'hP') + T_tI = lattice_applyLatticeSymmetry33(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' + if (any(dNeq0(T_tI) .and. math_I3<1.0_pReal)) error stop 'Symmetry33/tI' + + if (any(dNeq(T(1,1),[T_cI(1,1),T_cI(2,2),T_cI(3,3)]))) error stop 'Symmetry33_11-22-33/c' + if (any(dNeq(T(1,1),[T_hP(1,1),T_hP(2,2)]))) error stop 'Symmetry33_11-22/hP' + !if (any(dNeq(T(1,1),[T_tI(1,1),T_tI(2,2)))) error stop 'Symmetry33_11-22/tI' + enddo call random_number(C) diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index 3397cc572..0e3f58609 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -45,7 +45,6 @@ module subroutine elastic_init(phases) if (struct == 'hP' .or. struct == 'tI') then prm%C66(1,3) = elastic%get_asFloat('C_13') - prm%C66(2,3) = elastic%get_asFloat('C_23') prm%C66(3,3) = elastic%get_asFloat('C_33') endif if (struct == 'tI') prm%C66(6,6) = elastic%get_asFloat('C_66') From 019159d328c053c4ad2d7c4fedfc65e3bcdcd383 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 23 May 2021 21:02:35 +0200 Subject: [PATCH 20/24] WIP --- src/DAMASK_interface.f90 | 2 +- src/phase_mechanical_eigen_thermalexpansion.f90 | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DAMASK_interface.f90 b/src/DAMASK_interface.f90 index 43398d0ad..e5fbe20ac 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 14 +#define PETSC_MINOR_MAX 15 module DAMASK_interface use, intrinsic :: ISO_fortran_env diff --git a/src/phase_mechanical_eigen_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 index 94d15cfb1..30e2d0f57 100644 --- a/src/phase_mechanical_eigen_thermalexpansion.f90 +++ b/src/phase_mechanical_eigen_thermalexpansion.f90 @@ -72,7 +72,7 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics) prm%A(1:3,1:3,i) = lattice_applyLatticeSymmetry33(prm%A(1:3,1:3,i),& phase%get_asString('lattice')) enddo - + print*, prm%A end associate endif enddo @@ -95,6 +95,7 @@ module subroutine thermalexpansion_LiAndItsTangent(Li, dLi_dTstar, ph,me) real(pReal) :: T, dot_T + T = thermal_T(ph,me) dot_T = thermal_dot_T(ph,me) From a08b7b02d03809b624d56d87e0c62d509789c9d3 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 26 May 2021 20:56:17 +0200 Subject: [PATCH 21/24] [skip ci] updated version information after successful test of v3.0.0-alpha3-148-g95f7f3c6e --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7567c1527..e44277789 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha3-137-g0b80252d9 +v3.0.0-alpha3-148-g95f7f3c6e From bdb4029fb5202be7b601ab4cce0ff672aa16469e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 26 May 2021 22:49:53 +0200 Subject: [PATCH 22/24] tI symmetry of 2nd order tensor is equivalent to hP --- PRIVATE | 2 +- examples/config/phase/thermal/adiabatic.yaml | 1 - examples/config/phase/thermal/fast-convection.yaml | 1 - src/lattice.f90 | 8 ++------ src/phase_damage.f90 | 1 - src/phase_mechanical_eigen_thermalexpansion.f90 | 2 -- src/phase_thermal.f90 | 1 - 7 files changed, 3 insertions(+), 13 deletions(-) diff --git a/PRIVATE b/PRIVATE index a4542879e..185cb53be 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit a4542879e2d16fecc45605f2ac90d8a68f167657 +Subproject commit 185cb53be76eded17565c5fa91bd9b4499cda4b8 diff --git a/examples/config/phase/thermal/adiabatic.yaml b/examples/config/phase/thermal/adiabatic.yaml index e4e2b1626..9b4932af7 100644 --- a/examples/config/phase/thermal/adiabatic.yaml +++ b/examples/config/phase/thermal/adiabatic.yaml @@ -1,4 +1,3 @@ C_p: 1 K_11: 0 -K_22: 0 K_33: 0 diff --git a/examples/config/phase/thermal/fast-convection.yaml b/examples/config/phase/thermal/fast-convection.yaml index 5d6cfae52..4899baaf2 100644 --- a/examples/config/phase/thermal/fast-convection.yaml +++ b/examples/config/phase/thermal/fast-convection.yaml @@ -1,4 +1,3 @@ C_p: 1 K_11: 1e30 -K_22: 1e30 K_33: 1e30 diff --git a/src/lattice.f90 b/src/lattice.f90 index 769bf47b4..575486ee7 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -1679,14 +1679,10 @@ pure function lattice_applyLatticeSymmetry33(T,structure) result(T_sym) T_sym(1,1) = T(1,1) T_sym(2,2) = T(1,1) T_sym(3,3) = T(1,1) - case('hP') ! MD TODO: I think that 'tI' has the same symmetry as 'hP' for 2nd order tensors + case('hP','tI') T_sym(1,1) = T(1,1) T_sym(2,2) = T(1,1) T_sym(3,3) = T(3,3) - case('tI') - T_sym(1,1) = T(1,1) - T_sym(2,2) = T(2,2) - T_sym(3,3) = T(3,3) end select end function lattice_applyLatticeSymmetry33 @@ -2277,7 +2273,7 @@ subroutine selfTest if (any(dNeq(T(1,1),[T_cI(1,1),T_cI(2,2),T_cI(3,3)]))) error stop 'Symmetry33_11-22-33/c' if (any(dNeq(T(1,1),[T_hP(1,1),T_hP(2,2)]))) error stop 'Symmetry33_11-22/hP' - !if (any(dNeq(T(1,1),[T_tI(1,1),T_tI(2,2)))) error stop 'Symmetry33_11-22/tI' + if (any(dNeq(T(1,1),[T_tI(1,1),T_tI(2,2)]))) error stop 'Symmetry33_11-22/tI' enddo diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 45898f54d..b35c0ecd1 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -121,7 +121,6 @@ module subroutine damage_init source => sources%get(1) param(ph)%mu = source%get_asFloat('M',defaultVal=0.0_pReal) param(ph)%K(1,1) = source%get_asFloat('D_11',defaultVal=0.0_pReal) - param(ph)%K(2,2) = source%get_asFloat('D_22',defaultVal=0.0_pReal) param(ph)%K(3,3) = source%get_asFloat('D_33',defaultVal=0.0_pReal) param(ph)%K = lattice_applyLatticeSymmetry33(param(ph)%K,phase%get_asString('lattice')) endif diff --git a/src/phase_mechanical_eigen_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 index 30e2d0f57..dd2ff5c16 100644 --- a/src/phase_mechanical_eigen_thermalexpansion.f90 +++ b/src/phase_mechanical_eigen_thermalexpansion.f90 @@ -64,8 +64,6 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics) ! read up to three parameters (constant, linear, quadratic with T) temp = kinematic_type%get_as1dFloat('A_11') prm%A(1,1,1:size(temp)) = temp - temp = kinematic_type%get_as1dFloat('A_22',defaultVal=[(0.0_pReal, i=1,size(temp))],requiredSize=size(temp)) - prm%A(2,2,1:size(temp)) = temp temp = kinematic_type%get_as1dFloat('A_33',defaultVal=[(0.0_pReal, i=1,size(temp))],requiredSize=size(temp)) prm%A(3,3,1:size(temp)) = temp do i=1, size(prm%A,3) diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index e106d890e..141cf0249 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -102,7 +102,6 @@ module subroutine thermal_init(phases) thermal => phase%get('thermal',defaultVal=emptyDict) param(ph)%C_p = thermal%get_asFloat('C_p',defaultVal=0.0_pReal) param(ph)%K(1,1) = thermal%get_asFloat('K_11',defaultVal=0.0_pReal) ! ToDo: make mandatory? - param(ph)%K(2,2) = thermal%get_asFloat('K_22',defaultVal=0.0_pReal) ! ToDo: depends on symmtery param(ph)%K(3,3) = thermal%get_asFloat('K_33',defaultVal=0.0_pReal) ! ToDo: depends on symmtery param(ph)%K = lattice_applyLatticeSymmetry33(param(ph)%K,phase%get_asString('lattice')) From 0240bec5b3f3a093b22dc628eb34797c96546a01 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 27 May 2021 08:25:48 +0200 Subject: [PATCH 23/24] consistent reporting --- src/homogenization_mechanical_RGC.f90 | 2 +- src/homogenization_mechanical_isostrain.f90 | 2 +- src/homogenization_mechanical_pass.f90 | 2 +- src/phase_mechanical_eigen_thermalexpansion.f90 | 1 - src/phase_mechanical_elastic.f90 | 3 +++ 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/homogenization_mechanical_RGC.f90 b/src/homogenization_mechanical_RGC.f90 index 745c266d4..8712bb800 100644 --- a/src/homogenization_mechanical_RGC.f90 +++ b/src/homogenization_mechanical_RGC.f90 @@ -89,7 +89,7 @@ module subroutine RGC_init(num_homogMech) print'(/,a)', ' <<<+- homogenization:mechanical:RGC init -+>>>' - print'(a,i2)', ' # instances: ',count(homogenization_type == HOMOGENIZATION_RGC_ID) + print'(a,i0)', ' # homogenizations: ',count(homogenization_type == HOMOGENIZATION_RGC_ID) flush(IO_STDOUT) print*, 'D.D. Tjahjanto et al., International Journal of Material Forming 2(1):939–942, 2009' diff --git a/src/homogenization_mechanical_isostrain.f90 b/src/homogenization_mechanical_isostrain.f90 index 7b114d04f..4a11ecd2a 100644 --- a/src/homogenization_mechanical_isostrain.f90 +++ b/src/homogenization_mechanical_isostrain.f90 @@ -19,7 +19,7 @@ module subroutine isostrain_init print'(/,a)', ' <<<+- homogenization:mechanical:isostrain init -+>>>' - print'(a,i2)', ' # instances: ',count(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID) + print'(a,i0)', ' # homogenizations: ',count(homogenization_type == HOMOGENIZATION_ISOSTRAIN_ID) flush(IO_STDOUT) do ho = 1, size(homogenization_type) diff --git a/src/homogenization_mechanical_pass.f90 b/src/homogenization_mechanical_pass.f90 index e2e44658a..6d2d64eb4 100644 --- a/src/homogenization_mechanical_pass.f90 +++ b/src/homogenization_mechanical_pass.f90 @@ -19,7 +19,7 @@ module subroutine pass_init print'(/,a)', ' <<<+- homogenization:mechanical:pass init -+>>>' - print'(a,i2)', ' # instances: ',count(homogenization_type == HOMOGENIZATION_NONE_ID) + print'(a,i0)', ' # homogenizations: ',count(homogenization_type == HOMOGENIZATION_NONE_ID) flush(IO_STDOUT) do ho = 1, size(homogenization_type) diff --git a/src/phase_mechanical_eigen_thermalexpansion.f90 b/src/phase_mechanical_eigen_thermalexpansion.f90 index dd2ff5c16..3cfeb2f06 100644 --- a/src/phase_mechanical_eigen_thermalexpansion.f90 +++ b/src/phase_mechanical_eigen_thermalexpansion.f90 @@ -70,7 +70,6 @@ module function thermalexpansion_init(kinematics_length) result(myKinematics) prm%A(1:3,1:3,i) = lattice_applyLatticeSymmetry33(prm%A(1:3,1:3,i),& phase%get_asString('lattice')) enddo - print*, prm%A end associate endif enddo diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index 0e3f58609..94622d359 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -25,6 +25,9 @@ module subroutine elastic_init(phases) print'(/,a)', ' <<<+- phase:mechanical:elastic init -+>>>' + print'(/,a)', ' <<<+- phase:mechanical:elastic:Hooke init -+>>>' + + print'(a,i0)', ' # phases: ',phases%length; flush(IO_STDOUT) allocate(param(phases%length)) From 4b523d34a52a2f90172291c30b182f9f30a68e92 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 27 May 2021 14:59:00 +0200 Subject: [PATCH 24/24] [skip ci] updated version information after successful test of v3.0.0-alpha3-166-g4eb78249e --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e44277789..e4f75ea49 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha3-148-g95f7f3c6e +v3.0.0-alpha3-166-g4eb78249e