From 24ba08c2ccb0747d3007513f9e4ee5863f0752e5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 1 Feb 2018 07:56:55 +0100 Subject: [PATCH 01/42] modularized --- DAMASK_prerequisites.sh | 77 +++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 26 deletions(-) diff --git a/DAMASK_prerequisites.sh b/DAMASK_prerequisites.sh index d8f6824b9..4334afd92 100755 --- a/DAMASK_prerequisites.sh +++ b/DAMASK_prerequisites.sh @@ -9,14 +9,28 @@ OUTFILE="system_report.txt" echo =========================================== echo + Generating $OUTFILE echo + Send to damask@mpie.de for support +echo + view with \'cat $OUTFILE\' echo =========================================== - +function getDetails { +if which $1 &> /dev/null; then + echo ---------------------------------------------------------------------------------------------- + echo $1: + echo ---------------------------------------------------------------------------------------------- + echo + location: + which $1 + echo + $1 $2: + $1 $2 + echo -e '\n' +else + echo $ does not exist +fi +} # redirect STDOUT and STDERR to logfile # https://stackoverflow.com/questions/11229385/redirect-all-output-in-a-bash-script-when-using-set-x^ exec > $OUTFILE 2>&1 - + # directory, file is not a symlink by definition # https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within DAMASK_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -28,13 +42,19 @@ echo echo ============================================================================================== echo DAMASK settings echo ============================================================================================== +echo ---------------------------------------------------------------------------------------------- echo DAMASK_ROOT: +echo ---------------------------------------------------------------------------------------------- echo $DAMASK_ROOT echo +echo ---------------------------------------------------------------------------------------------- echo Version: +echo ---------------------------------------------------------------------------------------------- cat VERSION echo +echo ---------------------------------------------------------------------------------------------- echo Settings in CONFIG: +echo ---------------------------------------------------------------------------------------------- cat CONFIG echo echo ============================================================================================== @@ -46,6 +66,8 @@ echo PATH: $PATH echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH echo PYTHONPATH: $PYTHONPATH echo SHELL: $SHELL +echo PETSC_ARCH: $PETSC_ARCH +echo PETSC_DIR: $PETSC_DIR echo echo ============================================================================================== echo Python @@ -53,16 +75,14 @@ echo =========================================================================== DEFAULT_PYTHON=python2.7 for executable in python python2 python3 python2.7; do - if which $executable &> /dev/null; then - echo $executable version: $($executable --version 2>&1) - else - echo $executable does not exist - fi + getDetails $executable '--version' done -echo Details on $DEFAULT_PYTHON: $(ls -la $(which $DEFAULT_PYTHON)) -echo +echo ---------------------------------------------------------------------------------------------- +echo Details on $DEFAULT_PYTHON: +echo ---------------------------------------------------------------------------------------------- +echo $(ls -la $(which $DEFAULT_PYTHON)) for module in numpy scipy;do - echo ---------------------------------------------------------------------------------------------- + echo -e '\n----------------------------------------------------------------------------------------------' echo $module echo ---------------------------------------------------------------------------------------------- $DEFAULT_PYTHON -c "import $module; \ @@ -86,31 +106,36 @@ echo =========================================================================== echo GCC echo ============================================================================================== for executable in gcc g++ gfortran ;do - if which $executable &> /dev/null; then - echo $(which $executable) version: $($executable --version 2>&1) - else - echo $executable does not exist - fi + getDetails $executable '--version' done echo echo ============================================================================================== echo Intel Compiler Suite echo ============================================================================================== for executable in icc icpc ifort ;do - if which $executable &> /dev/null; then - echo $(which $executable) version: $($executable --version 2>&1) - else - echo $executable does not exist - fi + getDetails $executable '--version' done echo echo ============================================================================================== echo MPI Wrappers echo ============================================================================================== -for executable in mpicc mpiCC mpicxx mpicxx mpifort mpif90 mpif77; do - if which $executable &> /dev/null; then - echo $(which $executable) version: $($executable --show 2>&1) - else - echo $executable does not exist - fi +for executable in mpicc mpiCC mpic++ mpicxx mpifort mpif90 mpif77; do + getDetails $executable '-show' done +echo +echo ============================================================================================== +echo MPI Launchers +echo ============================================================================================== +for executable in mpirun mpiexec; do + getDetails $executable '--version' +done +echo +echo ============================================================================================== +echo Abaqus +echo ============================================================================================== +cd installation/mods_Abaqus # to have the right environment file +for executable in abaqus abq2016 abq2017; do + getDetails $executable 'information=all' +done +cd ../.. + From d80e15bd7659234a63c52b226f4ac55a0b16b9d9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 2 Feb 2018 12:36:09 +0100 Subject: [PATCH 02/42] compiler_options and compiler_version supported by new Intel compiler --- DAMASK_prerequisites.sh | 2 +- src/CPFEM.f90 | 2 +- src/CPFEM2.f90 | 2 +- src/DAMASK_spectral.f90 | 2 +- src/FEsolving.f90 | 2 +- src/IO.f90 | 2 +- src/compilation_info.f90 | 7 +++---- src/constitutive.f90 | 2 +- src/crystallite.f90 | 2 +- src/damage_local.f90 | 2 +- src/damage_none.f90 | 2 +- src/damage_nonlocal.f90 | 2 +- src/debug.f90 | 2 +- src/homogenization.f90 | 2 +- src/homogenization_RGC.f90 | 2 +- src/homogenization_isostrain.f90 | 2 +- src/homogenization_none.f90 | 2 +- src/hydrogenflux_cahnhilliard.f90 | 2 +- src/hydrogenflux_isoconc.f90 | 2 +- src/kinematics_cleavage_opening.f90 | 2 +- src/kinematics_hydrogen_strain.f90 | 2 +- src/kinematics_slipplane_opening.f90 | 2 +- src/kinematics_thermal_expansion.f90 | 2 +- src/kinematics_vacancy_strain.f90 | 2 +- src/lattice.f90 | 2 +- src/material.f90 | 2 +- src/math.f90 | 2 +- src/mesh.f90 | 2 +- src/numerics.f90 | 2 +- src/plastic_disloUCLA.f90 | 2 +- src/plastic_dislotwin.f90 | 2 +- src/plastic_isotropic.f90 | 2 +- src/plastic_none.f90 | 2 +- src/plastic_phenopowerlaw.f90 | 2 +- src/porosity_none.f90 | 2 +- src/porosity_phasefield.f90 | 2 +- src/prec.f90 | 2 +- src/source_damage_anisoBrittle.f90 | 2 +- src/source_damage_anisoDuctile.f90 | 2 +- src/source_damage_isoBrittle.f90 | 2 +- src/source_damage_isoDuctile.f90 | 2 +- src/source_thermal_dissipation.f90 | 2 +- src/source_thermal_externalheat.f90 | 2 +- src/source_vacancy_irradiation.f90 | 2 +- src/source_vacancy_phenoplasticity.f90 | 2 +- src/source_vacancy_thermalfluc.f90 | 2 +- src/spectral_damage.f90 | 2 +- src/spectral_mech_AL.f90 | 2 +- src/spectral_mech_Basic.f90 | 2 +- src/spectral_mech_Polarisation.f90 | 2 +- src/spectral_thermal.f90 | 2 +- src/spectral_utilities.f90 | 2 +- src/thermal_adiabatic.f90 | 2 +- src/thermal_conduction.f90 | 2 +- src/thermal_isothermal.f90 | 2 +- src/vacancyflux_cahnhilliard.f90 | 2 +- src/vacancyflux_isochempot.f90 | 2 +- src/vacancyflux_isoconc.f90 | 2 +- 58 files changed, 60 insertions(+), 61 deletions(-) diff --git a/DAMASK_prerequisites.sh b/DAMASK_prerequisites.sh index 4334afd92..12dd9bd07 100755 --- a/DAMASK_prerequisites.sh +++ b/DAMASK_prerequisites.sh @@ -119,7 +119,7 @@ echo echo ============================================================================================== echo MPI Wrappers echo ============================================================================================== -for executable in mpicc mpiCC mpic++ mpicxx mpifort mpif90 mpif77; do +for executable in mpicc mpiCC mpic++ mpicpc mpicxx mpifort mpif90 mpif77; do getDetails $executable '-show' done echo diff --git a/src/CPFEM.f90 b/src/CPFEM.f90 index b3848a9eb..44e7e5693 100644 --- a/src/CPFEM.f90 +++ b/src/CPFEM.f90 @@ -113,7 +113,7 @@ end subroutine CPFEM_initAll !> @brief allocate the arrays defined in module CPFEM and initialize them !-------------------------------------------------------------------------------------------------- subroutine CPFEM_init -#ifdef __GFORTRAN__ +#if __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index 0ac916046..aa2615b5f 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -82,7 +82,7 @@ end subroutine CPFEM_initAll !> @brief allocate the arrays defined in module CPFEM and initialize them !-------------------------------------------------------------------------------------------------- subroutine CPFEM_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/DAMASK_spectral.f90 b/src/DAMASK_spectral.f90 index f32bfb7b3..e84ead9cc 100644 --- a/src/DAMASK_spectral.f90 +++ b/src/DAMASK_spectral.f90 @@ -7,7 +7,7 @@ !> results !-------------------------------------------------------------------------------------------------- program DAMASK_spectral -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/FEsolving.f90 b/src/FEsolving.f90 index 5fdb2ebf8..92feaa926 100644 --- a/src/FEsolving.f90 +++ b/src/FEsolving.f90 @@ -43,7 +43,7 @@ contains !> solver the information is provided by the interface module !-------------------------------------------------------------------------------------------------- subroutine FE_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/IO.f90 b/src/IO.f90 index a6c3a7da8..0df8f171f 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -82,7 +82,7 @@ contains !> @brief only outputs revision number !-------------------------------------------------------------------------------------------------- subroutine IO_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/compilation_info.f90 b/src/compilation_info.f90 index 3fc12f1ee..f0ca4d4cc 100644 --- a/src/compilation_info.f90 +++ b/src/compilation_info.f90 @@ -1,8 +1,7 @@ -#ifdef __GFORTRAN__ - write(6,*) 'Compiled with ', compiler_version() !not supported by and ifort <= 15 (and old gfortran) +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 + write(6,*) 'Compiled with ', compiler_version() write(6,*) 'With options ', compiler_options() -#endif -#ifdef __INTEL_COMPILER +#else write(6,'(a,i4.4,a,i8.8)') ' Compiled with Intel fortran version ', __INTEL_COMPILER,& ', build date ', __INTEL_COMPILER_BUILD_DATE #endif diff --git a/src/constitutive.f90 b/src/constitutive.f90 index f124e545b..be9899d73 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -37,7 +37,7 @@ contains !> @brief allocates arrays pointing to array of the various constitutive modules !-------------------------------------------------------------------------------------------------- subroutine constitutive_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/crystallite.f90 b/src/crystallite.f90 index 7f4f6fa44..a9f4c88cc 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -137,7 +137,7 @@ contains !> @brief allocates and initialize per grain variables !-------------------------------------------------------------------------------------------------- subroutine crystallite_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/damage_local.f90 b/src/damage_local.f90 index 2f3014937..59956e7d1 100644 --- a/src/damage_local.f90 +++ b/src/damage_local.f90 @@ -41,7 +41,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine damage_local_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/damage_none.f90 b/src/damage_none.f90 index 4750f5949..a1f0f0cd5 100644 --- a/src/damage_none.f90 +++ b/src/damage_none.f90 @@ -16,7 +16,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine damage_none_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/damage_nonlocal.f90 b/src/damage_nonlocal.f90 index cd6ba8a5b..92ad183e1 100644 --- a/src/damage_nonlocal.f90 +++ b/src/damage_nonlocal.f90 @@ -46,7 +46,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine damage_nonlocal_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/debug.f90 b/src/debug.f90 index 396454c19..c4c3ddd60 100644 --- a/src/debug.f90 +++ b/src/debug.f90 @@ -102,7 +102,7 @@ contains !> @brief reads in parameters from debug.config and allocates arrays !-------------------------------------------------------------------------------------------------- subroutine debug_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 5a30a72c8..7cc5fbd04 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -71,7 +71,7 @@ contains !> @brief module initialization !-------------------------------------------------------------------------------------------------- subroutine homogenization_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/homogenization_RGC.f90 b/src/homogenization_RGC.f90 index 84cb594db..611268393 100644 --- a/src/homogenization_RGC.f90 +++ b/src/homogenization_RGC.f90 @@ -72,7 +72,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine homogenization_RGC_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/homogenization_isostrain.f90 b/src/homogenization_isostrain.f90 index 055bfbb46..b569e3737 100644 --- a/src/homogenization_isostrain.f90 +++ b/src/homogenization_isostrain.f90 @@ -49,7 +49,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine homogenization_isostrain_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/homogenization_none.f90 b/src/homogenization_none.f90 index 75d8bcd3a..b2d2f52a7 100644 --- a/src/homogenization_none.f90 +++ b/src/homogenization_none.f90 @@ -18,7 +18,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine homogenization_none_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/hydrogenflux_cahnhilliard.f90 b/src/hydrogenflux_cahnhilliard.f90 index 89479a9c9..569be97dc 100644 --- a/src/hydrogenflux_cahnhilliard.f90 +++ b/src/hydrogenflux_cahnhilliard.f90 @@ -51,7 +51,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine hydrogenflux_cahnhilliard_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/hydrogenflux_isoconc.f90 b/src/hydrogenflux_isoconc.f90 index bef2a8437..d1b13aa76 100644 --- a/src/hydrogenflux_isoconc.f90 +++ b/src/hydrogenflux_isoconc.f90 @@ -16,7 +16,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine hydrogenflux_isoconc_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/kinematics_cleavage_opening.f90 b/src/kinematics_cleavage_opening.f90 index fffa26165..74af0a52d 100644 --- a/src/kinematics_cleavage_opening.f90 +++ b/src/kinematics_cleavage_opening.f90 @@ -51,7 +51,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine kinematics_cleavage_opening_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/kinematics_hydrogen_strain.f90 b/src/kinematics_hydrogen_strain.f90 index c3af7e2a2..f3ea4df38 100644 --- a/src/kinematics_hydrogen_strain.f90 +++ b/src/kinematics_hydrogen_strain.f90 @@ -41,7 +41,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine kinematics_hydrogen_strain_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/kinematics_slipplane_opening.f90 b/src/kinematics_slipplane_opening.f90 index 07b98aa23..ba38ac05b 100644 --- a/src/kinematics_slipplane_opening.f90 +++ b/src/kinematics_slipplane_opening.f90 @@ -51,7 +51,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine kinematics_slipplane_opening_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/kinematics_thermal_expansion.f90 b/src/kinematics_thermal_expansion.f90 index e7cbca673..bb9083efb 100644 --- a/src/kinematics_thermal_expansion.f90 +++ b/src/kinematics_thermal_expansion.f90 @@ -41,7 +41,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine kinematics_thermal_expansion_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/kinematics_vacancy_strain.f90 b/src/kinematics_vacancy_strain.f90 index 9558f506d..227a86e0c 100644 --- a/src/kinematics_vacancy_strain.f90 +++ b/src/kinematics_vacancy_strain.f90 @@ -41,7 +41,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine kinematics_vacancy_strain_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/lattice.f90 b/src/lattice.f90 index 9635643e8..f46d0ef93 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -1243,7 +1243,7 @@ contains !> @brief Module initialization !-------------------------------------------------------------------------------------------------- subroutine lattice_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/material.f90 b/src/material.f90 index aad71d49c..090b94023 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -361,7 +361,7 @@ contains !> material.config !-------------------------------------------------------------------------------------------------- subroutine material_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/math.f90 b/src/math.f90 index 29d401162..43c24e7c2 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -172,7 +172,7 @@ contains !-------------------------------------------------------------------------------------------------- subroutine math_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/mesh.f90 b/src/mesh.f90 index 827875d2f..9f8ce33ea 100644 --- a/src/mesh.f90 +++ b/src/mesh.f90 @@ -477,7 +477,7 @@ contains !! Order and routines strongly depend on type of solver !-------------------------------------------------------------------------------------------------- subroutine mesh_init(ip,el) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/numerics.f90 b/src/numerics.f90 index 70c7f3c30..00d97297e 100644 --- a/src/numerics.f90 +++ b/src/numerics.f90 @@ -198,7 +198,7 @@ contains ! a sanity check !-------------------------------------------------------------------------------------------------- subroutine numerics_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index c02a7c4d4..9c0a6c494 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -119,7 +119,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine plastic_disloUCLA_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/plastic_dislotwin.f90 b/src/plastic_dislotwin.f90 index d6c73e8f3..c7aaf5400 100644 --- a/src/plastic_dislotwin.f90 +++ b/src/plastic_dislotwin.f90 @@ -198,7 +198,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine plastic_dislotwin_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index 14c282f9a..2ba1238b2 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -90,7 +90,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine plastic_isotropic_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/plastic_none.f90 b/src/plastic_none.f90 index 839a4fa9f..140754556 100644 --- a/src/plastic_none.f90 +++ b/src/plastic_none.f90 @@ -26,7 +26,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine plastic_none_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 55d31fa9b..229d03c26 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -123,7 +123,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine plastic_phenopowerlaw_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/porosity_none.f90 b/src/porosity_none.f90 index 2bca99384..c273baf3b 100644 --- a/src/porosity_none.f90 +++ b/src/porosity_none.f90 @@ -16,7 +16,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine porosity_none_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/porosity_phasefield.f90 b/src/porosity_phasefield.f90 index 3f1c853a4..6ab7263e4 100644 --- a/src/porosity_phasefield.f90 +++ b/src/porosity_phasefield.f90 @@ -48,7 +48,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine porosity_phasefield_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/prec.f90 b/src/prec.f90 index 912a02533..f35735780 100644 --- a/src/prec.f90 +++ b/src/prec.f90 @@ -111,7 +111,7 @@ contains !> @brief reporting precision !-------------------------------------------------------------------------------------------------- subroutine prec_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_damage_anisoBrittle.f90 b/src/source_damage_anisoBrittle.f90 index cad6bf1e4..22236a636 100644 --- a/src/source_damage_anisoBrittle.f90 +++ b/src/source_damage_anisoBrittle.f90 @@ -63,7 +63,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_damage_anisoBrittle_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_damage_anisoDuctile.f90 b/src/source_damage_anisoDuctile.f90 index 959e62e26..944a65918 100644 --- a/src/source_damage_anisoDuctile.f90 +++ b/src/source_damage_anisoDuctile.f90 @@ -67,7 +67,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_damage_anisoDuctile_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_damage_isoBrittle.f90 b/src/source_damage_isoBrittle.f90 index bd1026765..b9fb2c22c 100644 --- a/src/source_damage_isoBrittle.f90 +++ b/src/source_damage_isoBrittle.f90 @@ -53,7 +53,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_damage_isoBrittle_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_damage_isoDuctile.f90 b/src/source_damage_isoDuctile.f90 index 5d7e4f862..ed08e0a41 100644 --- a/src/source_damage_isoDuctile.f90 +++ b/src/source_damage_isoDuctile.f90 @@ -53,7 +53,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_damage_isoDuctile_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_thermal_dissipation.f90 b/src/source_thermal_dissipation.f90 index 99c41f062..7a4e85c75 100644 --- a/src/source_thermal_dissipation.f90 +++ b/src/source_thermal_dissipation.f90 @@ -39,7 +39,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_thermal_dissipation_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_thermal_externalheat.f90 b/src/source_thermal_externalheat.f90 index 6b015689a..2907ddf85 100644 --- a/src/source_thermal_externalheat.f90 +++ b/src/source_thermal_externalheat.f90 @@ -45,7 +45,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_thermal_externalheat_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_vacancy_irradiation.f90 b/src/source_vacancy_irradiation.f90 index 8f24b39be..566d97e68 100644 --- a/src/source_vacancy_irradiation.f90 +++ b/src/source_vacancy_irradiation.f90 @@ -41,7 +41,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_vacancy_irradiation_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_vacancy_phenoplasticity.f90 b/src/source_vacancy_phenoplasticity.f90 index 26c3ae828..8834a067a 100644 --- a/src/source_vacancy_phenoplasticity.f90 +++ b/src/source_vacancy_phenoplasticity.f90 @@ -39,7 +39,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_vacancy_phenoplasticity_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/source_vacancy_thermalfluc.f90 b/src/source_vacancy_thermalfluc.f90 index e5d3b0574..91047fbf2 100644 --- a/src/source_vacancy_thermalfluc.f90 +++ b/src/source_vacancy_thermalfluc.f90 @@ -41,7 +41,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine source_vacancy_thermalfluc_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/spectral_damage.f90 b/src/spectral_damage.f90 index 727659870..1ac3c4c73 100644 --- a/src/spectral_damage.f90 +++ b/src/spectral_damage.f90 @@ -60,7 +60,7 @@ contains !> @brief allocates all neccessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- subroutine spectral_damage_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/spectral_mech_AL.f90 b/src/spectral_mech_AL.f90 index 6d0fff286..f2b9d3f7f 100644 --- a/src/spectral_mech_AL.f90 +++ b/src/spectral_mech_AL.f90 @@ -84,7 +84,7 @@ contains !> @todo use sourced allocation, e.g. allocate(Fdot,source = F_lastInc) !-------------------------------------------------------------------------------------------------- subroutine AL_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/spectral_mech_Basic.f90 b/src/spectral_mech_Basic.f90 index 55403ee7c..00502b6b5 100644 --- a/src/spectral_mech_Basic.f90 +++ b/src/spectral_mech_Basic.f90 @@ -72,7 +72,7 @@ contains !> @brief allocates all neccessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- subroutine basicPETSc_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/spectral_mech_Polarisation.f90 b/src/spectral_mech_Polarisation.f90 index ecf707d46..2d261ff1b 100644 --- a/src/spectral_mech_Polarisation.f90 +++ b/src/spectral_mech_Polarisation.f90 @@ -84,7 +84,7 @@ contains !> @todo use sourced allocation, e.g. allocate(Fdot,source = F_lastInc) !-------------------------------------------------------------------------------------------------- subroutine Polarisation_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/spectral_thermal.f90 b/src/spectral_thermal.f90 index 322f12031..f89184543 100644 --- a/src/spectral_thermal.f90 +++ b/src/spectral_thermal.f90 @@ -60,7 +60,7 @@ contains !> @brief allocates all neccessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- subroutine spectral_thermal_init -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 index 1bbf2e608..f0cf5db12 100644 --- a/src/spectral_utilities.f90 +++ b/src/spectral_utilities.f90 @@ -160,7 +160,7 @@ contains !> Initializes FFTW. !-------------------------------------------------------------------------------------------------- subroutine utilities_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/thermal_adiabatic.f90 b/src/thermal_adiabatic.f90 index 7f23a81b5..62ffabf9c 100644 --- a/src/thermal_adiabatic.f90 +++ b/src/thermal_adiabatic.f90 @@ -46,7 +46,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine thermal_adiabatic_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/thermal_conduction.f90 b/src/thermal_conduction.f90 index c55d1d3eb..151eb7aa3 100644 --- a/src/thermal_conduction.f90 +++ b/src/thermal_conduction.f90 @@ -47,7 +47,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine thermal_conduction_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/thermal_isothermal.f90 b/src/thermal_isothermal.f90 index 87e846f12..68e09de8c 100644 --- a/src/thermal_isothermal.f90 +++ b/src/thermal_isothermal.f90 @@ -16,7 +16,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine thermal_isothermal_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/vacancyflux_cahnhilliard.f90 b/src/vacancyflux_cahnhilliard.f90 index 9f6ecd8b0..e40772d11 100644 --- a/src/vacancyflux_cahnhilliard.f90 +++ b/src/vacancyflux_cahnhilliard.f90 @@ -61,7 +61,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine vacancyflux_cahnhilliard_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/vacancyflux_isochempot.f90 b/src/vacancyflux_isochempot.f90 index 8c256467f..f98379eba 100644 --- a/src/vacancyflux_isochempot.f90 +++ b/src/vacancyflux_isochempot.f90 @@ -44,7 +44,7 @@ contains !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- subroutine vacancyflux_isochempot_init(fileUnit) -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options diff --git a/src/vacancyflux_isoconc.f90 b/src/vacancyflux_isoconc.f90 index ad7842e3f..470560206 100644 --- a/src/vacancyflux_isoconc.f90 +++ b/src/vacancyflux_isoconc.f90 @@ -16,7 +16,7 @@ contains !> @brief allocates all neccessary fields, reads information from material configuration file !-------------------------------------------------------------------------------------------------- subroutine vacancyflux_isoconc_init() -#ifdef __GFORTRAN__ +#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & compiler_options From 99087347102d4263a42175a9998cfe8cb4824002 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 3 Feb 2018 09:04:49 +0100 Subject: [PATCH 03/42] wrong random number, simplified --- PRIVATE | 2 +- src/math.f90 | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/PRIVATE b/PRIVATE index 5fc3188c8..bdbf2da71 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 5fc3188c86ea1f4159db87529ac3e3169fb56e5d +Subproject commit bdbf2da71cd9e0825d17f673ec2fbabc2c8027f8 diff --git a/src/math.f90 b/src/math.f90 index 43c24e7c2..73b642764 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -1780,9 +1780,8 @@ function math_sampleGaussOri(center,noise) real(pReal), dimension(3), intent(in) :: center real(pReal) :: cosScatter,scatter real(pReal), dimension(3) :: math_sampleGaussOri, disturb - real(pReal), dimension(3), parameter :: ORIGIN = [0.0_pReal,0.0_pReal,0.0_pReal] + real(pReal), dimension(3), parameter :: ORIGIN = 0.0_pReal real(pReal), dimension(5) :: rnd - integer(pInt) :: i if (abs(noise) < tol_math_check) then math_sampleGaussOri = center @@ -1796,10 +1795,10 @@ function math_sampleGaussOri(center,noise) do call halton(5_pInt,rnd) - forall (i=1_pInt:3_pInt) rnd(i) = 2.0_pReal*rnd(i)-1.0_pReal ! expand 1:3 to range [-1,+1] + rnd(1:3) = 2.0_pReal*rnd(1:3)-1.0_pReal ! expand 1:3 to range [-1,+1] disturb = [ scatter * rnd(1), & ! phi1 sign(1.0_pReal,rnd(2))*acos(cosScatter+(1.0_pReal-cosScatter)*rnd(4)), & ! Phi - scatter * rnd(2)] ! phi2 + scatter * rnd(3)] ! phi2 if (rnd(5) <= exp(-1.0_pReal*(math_EulerMisorientation(ORIGIN,disturb)/scatter)**2_pReal)) exit enddo From b455fcd0a3a0b16a70b90f5607da30073bc3a3ba Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 3 Feb 2018 09:21:19 +0100 Subject: [PATCH 04/42] acos has the same limits/stability as indirect asin calculation, enforing limits directly instead of scaling --- src/math.f90 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 73b642764..912771cf9 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -1741,13 +1741,12 @@ real(pReal) pure function math_EulerMisorientation(EulerA,EulerB) implicit none real(pReal), dimension(3), intent(in) :: EulerA,EulerB - real(pReal), dimension(3,3) :: r - real(pReal) :: tr + real(pReal) :: cosTheta - r = math_mul33x33(math_EulerToR(EulerB),transpose(math_EulerToR(EulerA))) + cosTheta = (math_trace33(math_mul33x33(math_EulerToR(EulerB), & + transpose(math_EulerToR(EulerA)))) - 1.0_pReal) * 0.5_pReal - tr = (math_trace33(r)-1.0_pReal)*0.4999999_pReal - math_EulerMisorientation = abs(0.5_pReal*PI-asin(tr)) + math_EulerMisorientation = acos(math_limit(cosTheta,-1.0_pReal,1.0_pReal)) end function math_EulerMisorientation From ba3a4e1254fa3840ebcf26f5f1fc7fad8335cb0b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 5 Feb 2018 17:34:08 +0100 Subject: [PATCH 05/42] indicating vectors with 1_, ..., n_ is standard now, "euler" also (more or less) --- processing/pre/hybridIA_linODFsampling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/pre/hybridIA_linODFsampling.py b/processing/pre/hybridIA_linODFsampling.py index 128d054e1..e4735674a 100755 --- a/processing/pre/hybridIA_linODFsampling.py +++ b/processing/pre/hybridIA_linODFsampling.py @@ -251,7 +251,7 @@ for name in filenames: table.head_read() errors = [] - labels = ['phi1','Phi','phi2','intensity'] + labels = ['1_euler','2_euler','3_euler','intensity'] for i,index in enumerate(table.label_index(labels)): if index < 0: errors.append('label {} not present.'.format(labels[i])) From 5f0531b997a591b40a721e3f464b48dcf722a589 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 6 Feb 2018 10:49:06 +0100 Subject: [PATCH 06/42] using the new compression --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index bdbf2da71..2933d1043 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit bdbf2da71cd9e0825d17f673ec2fbabc2c8027f8 +Subproject commit 2933d104333d4b930fba55527caeaad16a604d85 From 89f815c23c08000220e25117f2b16e0d6e708eb4 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 8 Feb 2018 03:32:16 +0100 Subject: [PATCH 07/42] [skip ci] updated version information after successful test of v2.0.1-1054-gb834b2a --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 35191bcab..23dae8438 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1035-gd80a255 +v2.0.1-1054-gb834b2a From 9b37c6605c1680283d5494f975057c3970da992d Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 8 Feb 2018 17:09:01 +0100 Subject: [PATCH 08/42] [skip ci] updated version information after successful test of v2.0.1-1055-g208c4af --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 35191bcab..066a72dfa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1035-gd80a255 +v2.0.1-1055-g208c4af From b6abbfca9dbb1bd6af32fb10e6c2be829a6e3faf Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 12 Feb 2018 11:45:42 +0100 Subject: [PATCH 09/42] early return not needed here --- src/math.f90 | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 78c4ea09b..ee228834a 100755 --- a/src/math.f90 +++ b/src/math.f90 @@ -1783,26 +1783,25 @@ function math_sampleGaussOri(center,noise) real(pReal), dimension(3), parameter :: ORIGIN = 0.0_pReal real(pReal), dimension(5) :: rnd - if (abs(noise) < tol_math_check) then + noScatter: if (abs(noise) < tol_math_check) then math_sampleGaussOri = center - return - endif + else noScatter + ! Helming uses different distribution with Bessel functions + ! therefore the gauss scatter width has to be scaled differently + scatter = 0.95_pReal * noise + cosScatter = cos(scatter) -! Helming uses different distribution with Bessel functions -! therefore the gauss scatter width has to be scaled differently - scatter = 0.95_pReal * noise - cosScatter = cos(scatter) + do + call halton(5_pInt,rnd) + rnd(1:3) = 2.0_pReal*rnd(1:3)-1.0_pReal ! expand 1:3 to range [-1,+1] + disturb = [ scatter * rnd(1), & ! phi1 + sign(1.0_pReal,rnd(2))*acos(cosScatter+(1.0_pReal-cosScatter)*rnd(4)), & ! Phi + scatter * rnd(3)] ! phi2 + if (rnd(5) <= exp(-1.0_pReal*(math_EulerMisorientation(ORIGIN,disturb)/scatter)**2_pReal)) exit + enddo - do - call halton(5_pInt,rnd) - rnd(1:3) = 2.0_pReal*rnd(1:3)-1.0_pReal ! expand 1:3 to range [-1,+1] - disturb = [ scatter * rnd(1), & ! phi1 - sign(1.0_pReal,rnd(2))*acos(cosScatter+(1.0_pReal-cosScatter)*rnd(4)), & ! Phi - scatter * rnd(3)] ! phi2 - if (rnd(5) <= exp(-1.0_pReal*(math_EulerMisorientation(ORIGIN,disturb)/scatter)**2_pReal)) exit - enddo - - math_sampleGaussOri = math_RtoEuler(math_mul33x33(math_EulerToR(disturb),math_EulerToR(center))) + math_sampleGaussOri = math_RtoEuler(math_mul33x33(math_EulerToR(disturb),math_EulerToR(center))) + endif noScatter end function math_sampleGaussOri From 4e62d7793ad72e8f181557b4a28ca8b8cbb31c96 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 12 Feb 2018 11:46:01 +0100 Subject: [PATCH 10/42] more detailed comments --- src/DAMASK_spectral.f90 | 2 ++ src/spectral_interface.f90 | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/DAMASK_spectral.f90 b/src/DAMASK_spectral.f90 index 87b00f12e..fe7d78621 100755 --- a/src/DAMASK_spectral.f90 +++ b/src/DAMASK_spectral.f90 @@ -831,6 +831,8 @@ subroutine quit(stop_id) call PETScFinalize(ierr) if (ierr /= 0) write(6,'(a)') ' Error in PETScFinalize' #ifdef _OPENMP + ! If openMP is enabled, MPI is initialized before and independently of PETSc. Hence, also + ! take care of the finalization call MPI_finalize(error) if (error /= 0) write(6,'(a)') ' Error in MPI_finalize' #endif diff --git a/src/spectral_interface.f90 b/src/spectral_interface.f90 index 3c8489d04..25421cc78 100644 --- a/src/spectral_interface.f90 +++ b/src/spectral_interface.f90 @@ -82,8 +82,10 @@ subroutine DAMASK_interface_init() !-------------------------------------------------------------------------------------------------- ! PETSc Init -#ifdef _OPENMP - call MPI_Init_Thread(MPI_THREAD_FUNNELED,threadLevel,ierr);CHKERRQ(ierr) ! in case of OpenMP, don't rely on PETScInitialize doing MPI init +#ifdef _OPENM + ! If openMP is enabled, check if the MPI libary supports it and initialize accordingly. + ! Otherwise, the first call to PETSc will do the initialization. + call MPI_Init_Thread(MPI_THREAD_FUNNELED,threadLevel,ierr);CHKERRQ(ierr) if (threadLevel Date: Mon, 12 Feb 2018 12:40:56 +0100 Subject: [PATCH 11/42] test with correct labels for hybridIA --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 2933d1043..17d61f88c 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 2933d104333d4b930fba55527caeaad16a604d85 +Subproject commit 17d61f88ce2d386d40b45a002d43556bfbb27340 From fe07a34c69fb108826beebf59e57aff5c48a5840 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 12 Feb 2018 12:42:18 +0100 Subject: [PATCH 12/42] source code should not be executable --- src/DAMASK_spectral.f90 | 0 src/crystallite.f90 | 0 src/math.f90 | 0 src/spectral_utilities.f90 | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/DAMASK_spectral.f90 mode change 100755 => 100644 src/crystallite.f90 mode change 100755 => 100644 src/math.f90 mode change 100755 => 100644 src/spectral_utilities.f90 diff --git a/src/DAMASK_spectral.f90 b/src/DAMASK_spectral.f90 old mode 100755 new mode 100644 diff --git a/src/crystallite.f90 b/src/crystallite.f90 old mode 100755 new mode 100644 diff --git a/src/math.f90 b/src/math.f90 old mode 100755 new mode 100644 diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 old mode 100755 new mode 100644 From c544fa1b344298f01df9ae80aecde3be6db38137 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 12 Feb 2018 15:03:35 +0100 Subject: [PATCH 13/42] typo, cause wrong finalization sequence --- src/spectral_interface.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spectral_interface.f90 b/src/spectral_interface.f90 index 25421cc78..9aa4d1069 100644 --- a/src/spectral_interface.f90 +++ b/src/spectral_interface.f90 @@ -82,7 +82,7 @@ subroutine DAMASK_interface_init() !-------------------------------------------------------------------------------------------------- ! PETSc Init -#ifdef _OPENM +#ifdef _OPENMP ! If openMP is enabled, check if the MPI libary supports it and initialize accordingly. ! Otherwise, the first call to PETSc will do the initialization. call MPI_Init_Thread(MPI_THREAD_FUNNELED,threadLevel,ierr);CHKERRQ(ierr) From 408524daac0fc669aa3390c87adb12309f3c45ad Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 13 Feb 2018 00:22:33 +0100 Subject: [PATCH 14/42] [skip ci] updated version information after successful test of v2.0.1-1073-gc544fa1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 23dae8438..6abb5795c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1054-gb834b2a +v2.0.1-1073-gc544fa1 From 15b0fa90a18c68c18393c30f4853443ab11fa8a9 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 16 Feb 2018 08:23:55 -0500 Subject: [PATCH 15/42] New spectral method example on thermally expanding Eshelby inclusion --- .../EshelbyInclusion/config/elastic_Ti.config | 7 + .../config/elastic_fullyAnisotropic.config | 11 + .../config/elastic_isotropic.config | 4 + .../EshelbyInclusion/config/thermal.config | 3 + .../config/thermalExpansion_Ti.config | 8 + .../thermalExpansion_fullyAnisotropic.config | 9 + .../config/thermalExpansion_isotropic.config | 6 + .../EshelbyInclusion/geom/Ti_Ti.geom | 427 ++++++++++++++++++ .../geom/isotropic_anisotropic.geom | 427 ++++++++++++++++++ .../geom/isotropic_isotropic.geom | 427 ++++++++++++++++++ .../geom/isotropic_rotated.geom | 427 ++++++++++++++++++ .../EshelbyInclusion/material.config | 111 +++++ .../EshelbyInclusion/numerics.config | 5 + .../SpectralMethod/EshelbyInclusion/runAll.sh | 56 +++ .../EshelbyInclusion/thermal.load | 1 + 15 files changed, 1929 insertions(+) create mode 100644 examples/SpectralMethod/EshelbyInclusion/config/elastic_Ti.config create mode 100644 examples/SpectralMethod/EshelbyInclusion/config/elastic_fullyAnisotropic.config create mode 100644 examples/SpectralMethod/EshelbyInclusion/config/elastic_isotropic.config create mode 100644 examples/SpectralMethod/EshelbyInclusion/config/thermal.config create mode 100644 examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_Ti.config create mode 100644 examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_fullyAnisotropic.config create mode 100644 examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_isotropic.config create mode 100644 examples/SpectralMethod/EshelbyInclusion/geom/Ti_Ti.geom create mode 100644 examples/SpectralMethod/EshelbyInclusion/geom/isotropic_anisotropic.geom create mode 100644 examples/SpectralMethod/EshelbyInclusion/geom/isotropic_isotropic.geom create mode 100644 examples/SpectralMethod/EshelbyInclusion/geom/isotropic_rotated.geom create mode 100644 examples/SpectralMethod/EshelbyInclusion/material.config create mode 100644 examples/SpectralMethod/EshelbyInclusion/numerics.config create mode 100755 examples/SpectralMethod/EshelbyInclusion/runAll.sh create mode 100644 examples/SpectralMethod/EshelbyInclusion/thermal.load diff --git a/examples/SpectralMethod/EshelbyInclusion/config/elastic_Ti.config b/examples/SpectralMethod/EshelbyInclusion/config/elastic_Ti.config new file mode 100644 index 000000000..b103eb112 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/config/elastic_Ti.config @@ -0,0 +1,7 @@ +elasticity hooke + +c11 160.0e9 +c12 90.0e9 +c13 66.0e9 +c33 181.7e9 +c44 46.5e9 diff --git a/examples/SpectralMethod/EshelbyInclusion/config/elastic_fullyAnisotropic.config b/examples/SpectralMethod/EshelbyInclusion/config/elastic_fullyAnisotropic.config new file mode 100644 index 000000000..700a37dbd --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/config/elastic_fullyAnisotropic.config @@ -0,0 +1,11 @@ +elasticity hooke + +c11 100.0e9 +c22 100.0e9 +c33 100.0e9 +c12 0.0e9 +c13 0.0e9 +c23 0.0e9 +c44 50.0e9 +c55 50.0e9 +c66 50.0e9 diff --git a/examples/SpectralMethod/EshelbyInclusion/config/elastic_isotropic.config b/examples/SpectralMethod/EshelbyInclusion/config/elastic_isotropic.config new file mode 100644 index 000000000..7574e9301 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/config/elastic_isotropic.config @@ -0,0 +1,4 @@ +elasticity hooke + +c11 100.0e9 +c12 0.0e9 diff --git a/examples/SpectralMethod/EshelbyInclusion/config/thermal.config b/examples/SpectralMethod/EshelbyInclusion/config/thermal.config new file mode 100644 index 000000000..50e50f3b3 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/config/thermal.config @@ -0,0 +1,3 @@ +reference_temperature 300.0 +specific_heat 1 +mass_density 1 diff --git a/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_Ti.config b/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_Ti.config new file mode 100644 index 000000000..5457be845 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_Ti.config @@ -0,0 +1,8 @@ +(kinematics) thermal_expansion +thermal_expansion11 9.5e-6 +thermal_expansion22 9.5e-6 +thermal_expansion33 5.6e-6 + +(source) thermal_externalheat +externalheat_time 0 500 500.001 1000 # 500 secs supplying 1 Watt, then removing 1 Watt +externalheat_rate 1 1 -1 -1 diff --git a/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_fullyAnisotropic.config b/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_fullyAnisotropic.config new file mode 100644 index 000000000..7190656d3 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_fullyAnisotropic.config @@ -0,0 +1,9 @@ +(kinematics) thermal_expansion +thermal_expansion11 5e-6 +thermal_expansion22 10e-6 +thermal_expansion33 20e-6 +lattice_structure orthorhombic + +(source) thermal_externalheat +externalheat_time 0 500 500.001 1000 # 500 secs supplying 1 Watt, then removing 1 Watt +externalheat_rate 1 1 -1 -1 diff --git a/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_isotropic.config b/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_isotropic.config new file mode 100644 index 000000000..5d039bec9 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/config/thermalExpansion_isotropic.config @@ -0,0 +1,6 @@ +(kinematics) thermal_expansion +thermal_expansion11 10e-6 + +(source) thermal_externalheat +externalheat_time 0 500 500.001 1000 # 500 secs supplying 1 Watt, then removing 1 Watt +externalheat_rate 1 1 -1 -1 diff --git a/examples/SpectralMethod/EshelbyInclusion/geom/Ti_Ti.geom b/examples/SpectralMethod/EshelbyInclusion/geom/Ti_Ti.geom new file mode 100644 index 000000000..28b49f368 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/geom/Ti_Ti.geom @@ -0,0 +1,427 @@ +9 header +geom_addPrimitive v2.0.1-1073-gc544fa1 -c 32 32 32 -d -16 -16 -16 inclusion.geom +geom_canvas v2.0.1-1073-gc544fa1 -o 16 16 16 -g 32 32 32 +geom_translate v2.0.1-1073-gc544fa1 -s 1,2,2,6 Ti_Ti.geom +geom_pack v2.0.1-1073-gc544fa1 Ti_Ti.geom isotropic_anisotropic.geom isotropic_isotropic.geom isotropic_rotated.geom +grid a 32 b 32 c 32 +size x 0.5 y 0.5 z 0.5 +origin x 0.25 y 0.25 z 0.25 +homogenization 1 +microstructures 2 +8623 of 2 +2 of 6 +29 of 2 +4 of 6 +27 of 2 +6 of 6 +26 of 2 +6 of 6 +27 of 2 +4 of 6 +29 of 2 +2 of 6 +798 of 2 +2 of 6 +28 of 2 +6 of 6 +25 of 2 +8 of 6 +24 of 2 +8 of 6 +23 of 2 +10 of 6 +22 of 2 +10 of 6 +23 of 2 +8 of 6 +24 of 2 +8 of 6 +25 of 2 +6 of 6 +28 of 2 +2 of 6 +701 of 2 +4 of 6 +26 of 2 +8 of 6 +23 of 2 +10 of 6 +22 of 2 +10 of 6 +21 of 2 +12 of 6 +20 of 2 +12 of 6 +20 of 2 +12 of 6 +20 of 2 +12 of 6 +21 of 2 +10 of 6 +22 of 2 +10 of 6 +23 of 2 +8 of 6 +26 of 2 +4 of 6 +637 of 2 +2 of 6 +27 of 2 +8 of 6 +23 of 2 +10 of 6 +21 of 2 +12 of 6 +20 of 2 +12 of 6 +20 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +20 of 2 +12 of 6 +20 of 2 +12 of 6 +21 of 2 +10 of 6 +23 of 2 +8 of 6 +27 of 2 +2 of 6 +604 of 2 +6 of 6 +24 of 2 +10 of 6 +21 of 2 +12 of 6 +20 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +20 of 2 +12 of 6 +21 of 2 +10 of 6 +24 of 2 +6 of 6 +572 of 2 +2 of 6 +27 of 2 +8 of 6 +23 of 2 +10 of 6 +21 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +17 of 2 +16 of 6 +16 of 2 +16 of 6 +17 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +21 of 2 +10 of 6 +23 of 2 +8 of 6 +27 of 2 +2 of 6 +541 of 2 +4 of 6 +26 of 2 +8 of 6 +22 of 2 +12 of 6 +20 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +17 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +17 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +20 of 2 +12 of 6 +22 of 2 +8 of 6 +26 of 2 +4 of 6 +539 of 2 +6 of 6 +24 of 2 +10 of 6 +21 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +17 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +17 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +21 of 2 +10 of 6 +24 of 2 +6 of 6 +538 of 2 +6 of 6 +24 of 2 +10 of 6 +21 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +17 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +17 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +21 of 2 +10 of 6 +24 of 2 +6 of 6 +539 of 2 +4 of 6 +26 of 2 +8 of 6 +22 of 2 +12 of 6 +20 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +17 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +16 of 2 +16 of 6 +17 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +20 of 2 +12 of 6 +22 of 2 +8 of 6 +26 of 2 +4 of 6 +541 of 2 +2 of 6 +27 of 2 +8 of 6 +23 of 2 +10 of 6 +21 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +17 of 2 +16 of 6 +16 of 2 +16 of 6 +17 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +21 of 2 +10 of 6 +23 of 2 +8 of 6 +27 of 2 +2 of 6 +572 of 2 +6 of 6 +24 of 2 +10 of 6 +21 of 2 +12 of 6 +20 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +20 of 2 +12 of 6 +21 of 2 +10 of 6 +24 of 2 +6 of 6 +604 of 2 +2 of 6 +27 of 2 +8 of 6 +23 of 2 +10 of 6 +21 of 2 +12 of 6 +20 of 2 +12 of 6 +20 of 2 +12 of 6 +19 of 2 +14 of 6 +18 of 2 +14 of 6 +19 of 2 +12 of 6 +20 of 2 +12 of 6 +20 of 2 +12 of 6 +21 of 2 +10 of 6 +23 of 2 +8 of 6 +27 of 2 +2 of 6 +637 of 2 +4 of 6 +26 of 2 +8 of 6 +23 of 2 +10 of 6 +22 of 2 +10 of 6 +21 of 2 +12 of 6 +20 of 2 +12 of 6 +20 of 2 +12 of 6 +20 of 2 +12 of 6 +21 of 2 +10 of 6 +22 of 2 +10 of 6 +23 of 2 +8 of 6 +26 of 2 +4 of 6 +701 of 2 +2 of 6 +28 of 2 +6 of 6 +25 of 2 +8 of 6 +24 of 2 +8 of 6 +23 of 2 +10 of 6 +22 of 2 +10 of 6 +23 of 2 +8 of 6 +24 of 2 +8 of 6 +25 of 2 +6 of 6 +28 of 2 +2 of 6 +798 of 2 +2 of 6 +29 of 2 +4 of 6 +27 of 2 +6 of 6 +26 of 2 +6 of 6 +27 of 2 +4 of 6 +29 of 2 +2 of 6 +8623 of 2 diff --git a/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_anisotropic.geom b/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_anisotropic.geom new file mode 100644 index 000000000..3d4d3eab5 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_anisotropic.geom @@ -0,0 +1,427 @@ +9 header +geom_addPrimitive v2.0.1-1073-gc544fa1 -c 32 32 32 -d -16 -16 -16 inclusion.geom +geom_canvas v2.0.1-1073-gc544fa1 -o 16 16 16 -g 32 32 32 +geom_translate v2.0.1-1073-gc544fa1 -s 2,4 isotropic_anisotropic.geom +geom_pack v2.0.1-1073-gc544fa1 Ti_Ti.geom isotropic_anisotropic.geom isotropic_isotropic.geom isotropic_rotated.geom +grid a 32 b 32 c 32 +size x 0.5 y 0.5 z 0.5 +origin x 0.25 y 0.25 z 0.25 +homogenization 1 +microstructures 2 +8623 of 1 +2 of 4 +29 of 1 +4 of 4 +27 of 1 +6 of 4 +26 of 1 +6 of 4 +27 of 1 +4 of 4 +29 of 1 +2 of 4 +798 of 1 +2 of 4 +28 of 1 +6 of 4 +25 of 1 +8 of 4 +24 of 1 +8 of 4 +23 of 1 +10 of 4 +22 of 1 +10 of 4 +23 of 1 +8 of 4 +24 of 1 +8 of 4 +25 of 1 +6 of 4 +28 of 1 +2 of 4 +701 of 1 +4 of 4 +26 of 1 +8 of 4 +23 of 1 +10 of 4 +22 of 1 +10 of 4 +21 of 1 +12 of 4 +20 of 1 +12 of 4 +20 of 1 +12 of 4 +20 of 1 +12 of 4 +21 of 1 +10 of 4 +22 of 1 +10 of 4 +23 of 1 +8 of 4 +26 of 1 +4 of 4 +637 of 1 +2 of 4 +27 of 1 +8 of 4 +23 of 1 +10 of 4 +21 of 1 +12 of 4 +20 of 1 +12 of 4 +20 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +20 of 1 +12 of 4 +20 of 1 +12 of 4 +21 of 1 +10 of 4 +23 of 1 +8 of 4 +27 of 1 +2 of 4 +604 of 1 +6 of 4 +24 of 1 +10 of 4 +21 of 1 +12 of 4 +20 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +20 of 1 +12 of 4 +21 of 1 +10 of 4 +24 of 1 +6 of 4 +572 of 1 +2 of 4 +27 of 1 +8 of 4 +23 of 1 +10 of 4 +21 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +17 of 1 +16 of 4 +16 of 1 +16 of 4 +17 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +21 of 1 +10 of 4 +23 of 1 +8 of 4 +27 of 1 +2 of 4 +541 of 1 +4 of 4 +26 of 1 +8 of 4 +22 of 1 +12 of 4 +20 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +17 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +17 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +20 of 1 +12 of 4 +22 of 1 +8 of 4 +26 of 1 +4 of 4 +539 of 1 +6 of 4 +24 of 1 +10 of 4 +21 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +17 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +17 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +21 of 1 +10 of 4 +24 of 1 +6 of 4 +538 of 1 +6 of 4 +24 of 1 +10 of 4 +21 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +17 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +17 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +21 of 1 +10 of 4 +24 of 1 +6 of 4 +539 of 1 +4 of 4 +26 of 1 +8 of 4 +22 of 1 +12 of 4 +20 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +17 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +16 of 1 +16 of 4 +17 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +20 of 1 +12 of 4 +22 of 1 +8 of 4 +26 of 1 +4 of 4 +541 of 1 +2 of 4 +27 of 1 +8 of 4 +23 of 1 +10 of 4 +21 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +17 of 1 +16 of 4 +16 of 1 +16 of 4 +17 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +21 of 1 +10 of 4 +23 of 1 +8 of 4 +27 of 1 +2 of 4 +572 of 1 +6 of 4 +24 of 1 +10 of 4 +21 of 1 +12 of 4 +20 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +20 of 1 +12 of 4 +21 of 1 +10 of 4 +24 of 1 +6 of 4 +604 of 1 +2 of 4 +27 of 1 +8 of 4 +23 of 1 +10 of 4 +21 of 1 +12 of 4 +20 of 1 +12 of 4 +20 of 1 +12 of 4 +19 of 1 +14 of 4 +18 of 1 +14 of 4 +19 of 1 +12 of 4 +20 of 1 +12 of 4 +20 of 1 +12 of 4 +21 of 1 +10 of 4 +23 of 1 +8 of 4 +27 of 1 +2 of 4 +637 of 1 +4 of 4 +26 of 1 +8 of 4 +23 of 1 +10 of 4 +22 of 1 +10 of 4 +21 of 1 +12 of 4 +20 of 1 +12 of 4 +20 of 1 +12 of 4 +20 of 1 +12 of 4 +21 of 1 +10 of 4 +22 of 1 +10 of 4 +23 of 1 +8 of 4 +26 of 1 +4 of 4 +701 of 1 +2 of 4 +28 of 1 +6 of 4 +25 of 1 +8 of 4 +24 of 1 +8 of 4 +23 of 1 +10 of 4 +22 of 1 +10 of 4 +23 of 1 +8 of 4 +24 of 1 +8 of 4 +25 of 1 +6 of 4 +28 of 1 +2 of 4 +798 of 1 +2 of 4 +29 of 1 +4 of 4 +27 of 1 +6 of 4 +26 of 1 +6 of 4 +27 of 1 +4 of 4 +29 of 1 +2 of 4 +8623 of 1 diff --git a/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_isotropic.geom b/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_isotropic.geom new file mode 100644 index 000000000..bf63f03d7 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_isotropic.geom @@ -0,0 +1,427 @@ +9 header +geom_addPrimitive v2.0.1-1073-gc544fa1 -c 32 32 32 -d -16 -16 -16 inclusion.geom +geom_canvas v2.0.1-1073-gc544fa1 -o 16 16 16 -g 32 32 32 +geom_translate v2.0.1-1073-gc544fa1 -s 2,3 isotropic_isotropic.geom +geom_pack v2.0.1-1073-gc544fa1 Ti_Ti.geom isotropic_anisotropic.geom isotropic_isotropic.geom isotropic_rotated.geom +grid a 32 b 32 c 32 +size x 0.5 y 0.5 z 0.5 +origin x 0.25 y 0.25 z 0.25 +homogenization 1 +microstructures 2 +8623 of 1 +2 of 3 +29 of 1 +4 of 3 +27 of 1 +6 of 3 +26 of 1 +6 of 3 +27 of 1 +4 of 3 +29 of 1 +2 of 3 +798 of 1 +2 of 3 +28 of 1 +6 of 3 +25 of 1 +8 of 3 +24 of 1 +8 of 3 +23 of 1 +10 of 3 +22 of 1 +10 of 3 +23 of 1 +8 of 3 +24 of 1 +8 of 3 +25 of 1 +6 of 3 +28 of 1 +2 of 3 +701 of 1 +4 of 3 +26 of 1 +8 of 3 +23 of 1 +10 of 3 +22 of 1 +10 of 3 +21 of 1 +12 of 3 +20 of 1 +12 of 3 +20 of 1 +12 of 3 +20 of 1 +12 of 3 +21 of 1 +10 of 3 +22 of 1 +10 of 3 +23 of 1 +8 of 3 +26 of 1 +4 of 3 +637 of 1 +2 of 3 +27 of 1 +8 of 3 +23 of 1 +10 of 3 +21 of 1 +12 of 3 +20 of 1 +12 of 3 +20 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +20 of 1 +12 of 3 +20 of 1 +12 of 3 +21 of 1 +10 of 3 +23 of 1 +8 of 3 +27 of 1 +2 of 3 +604 of 1 +6 of 3 +24 of 1 +10 of 3 +21 of 1 +12 of 3 +20 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +20 of 1 +12 of 3 +21 of 1 +10 of 3 +24 of 1 +6 of 3 +572 of 1 +2 of 3 +27 of 1 +8 of 3 +23 of 1 +10 of 3 +21 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +17 of 1 +16 of 3 +16 of 1 +16 of 3 +17 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +21 of 1 +10 of 3 +23 of 1 +8 of 3 +27 of 1 +2 of 3 +541 of 1 +4 of 3 +26 of 1 +8 of 3 +22 of 1 +12 of 3 +20 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +17 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +17 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +20 of 1 +12 of 3 +22 of 1 +8 of 3 +26 of 1 +4 of 3 +539 of 1 +6 of 3 +24 of 1 +10 of 3 +21 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +17 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +17 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +21 of 1 +10 of 3 +24 of 1 +6 of 3 +538 of 1 +6 of 3 +24 of 1 +10 of 3 +21 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +17 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +17 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +21 of 1 +10 of 3 +24 of 1 +6 of 3 +539 of 1 +4 of 3 +26 of 1 +8 of 3 +22 of 1 +12 of 3 +20 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +17 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +16 of 1 +16 of 3 +17 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +20 of 1 +12 of 3 +22 of 1 +8 of 3 +26 of 1 +4 of 3 +541 of 1 +2 of 3 +27 of 1 +8 of 3 +23 of 1 +10 of 3 +21 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +17 of 1 +16 of 3 +16 of 1 +16 of 3 +17 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +21 of 1 +10 of 3 +23 of 1 +8 of 3 +27 of 1 +2 of 3 +572 of 1 +6 of 3 +24 of 1 +10 of 3 +21 of 1 +12 of 3 +20 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +20 of 1 +12 of 3 +21 of 1 +10 of 3 +24 of 1 +6 of 3 +604 of 1 +2 of 3 +27 of 1 +8 of 3 +23 of 1 +10 of 3 +21 of 1 +12 of 3 +20 of 1 +12 of 3 +20 of 1 +12 of 3 +19 of 1 +14 of 3 +18 of 1 +14 of 3 +19 of 1 +12 of 3 +20 of 1 +12 of 3 +20 of 1 +12 of 3 +21 of 1 +10 of 3 +23 of 1 +8 of 3 +27 of 1 +2 of 3 +637 of 1 +4 of 3 +26 of 1 +8 of 3 +23 of 1 +10 of 3 +22 of 1 +10 of 3 +21 of 1 +12 of 3 +20 of 1 +12 of 3 +20 of 1 +12 of 3 +20 of 1 +12 of 3 +21 of 1 +10 of 3 +22 of 1 +10 of 3 +23 of 1 +8 of 3 +26 of 1 +4 of 3 +701 of 1 +2 of 3 +28 of 1 +6 of 3 +25 of 1 +8 of 3 +24 of 1 +8 of 3 +23 of 1 +10 of 3 +22 of 1 +10 of 3 +23 of 1 +8 of 3 +24 of 1 +8 of 3 +25 of 1 +6 of 3 +28 of 1 +2 of 3 +798 of 1 +2 of 3 +29 of 1 +4 of 3 +27 of 1 +6 of 3 +26 of 1 +6 of 3 +27 of 1 +4 of 3 +29 of 1 +2 of 3 +8623 of 1 diff --git a/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_rotated.geom b/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_rotated.geom new file mode 100644 index 000000000..66f8a8f1a --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/geom/isotropic_rotated.geom @@ -0,0 +1,427 @@ +9 header +geom_addPrimitive v2.0.1-1073-gc544fa1 -c 32 32 32 -d -16 -16 -16 inclusion.geom +geom_canvas v2.0.1-1073-gc544fa1 -o 16 16 16 -g 32 32 32 +geom_translate v2.0.1-1073-gc544fa1 -s 2,5 isotropic_rotated.geom +geom_pack v2.0.1-1073-gc544fa1 Ti_Ti.geom isotropic_anisotropic.geom isotropic_isotropic.geom isotropic_rotated.geom +grid a 32 b 32 c 32 +size x 0.5 y 0.5 z 0.5 +origin x 0.25 y 0.25 z 0.25 +homogenization 1 +microstructures 2 +8623 of 1 +2 of 5 +29 of 1 +4 of 5 +27 of 1 +6 of 5 +26 of 1 +6 of 5 +27 of 1 +4 of 5 +29 of 1 +2 of 5 +798 of 1 +2 of 5 +28 of 1 +6 of 5 +25 of 1 +8 of 5 +24 of 1 +8 of 5 +23 of 1 +10 of 5 +22 of 1 +10 of 5 +23 of 1 +8 of 5 +24 of 1 +8 of 5 +25 of 1 +6 of 5 +28 of 1 +2 of 5 +701 of 1 +4 of 5 +26 of 1 +8 of 5 +23 of 1 +10 of 5 +22 of 1 +10 of 5 +21 of 1 +12 of 5 +20 of 1 +12 of 5 +20 of 1 +12 of 5 +20 of 1 +12 of 5 +21 of 1 +10 of 5 +22 of 1 +10 of 5 +23 of 1 +8 of 5 +26 of 1 +4 of 5 +637 of 1 +2 of 5 +27 of 1 +8 of 5 +23 of 1 +10 of 5 +21 of 1 +12 of 5 +20 of 1 +12 of 5 +20 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +20 of 1 +12 of 5 +20 of 1 +12 of 5 +21 of 1 +10 of 5 +23 of 1 +8 of 5 +27 of 1 +2 of 5 +604 of 1 +6 of 5 +24 of 1 +10 of 5 +21 of 1 +12 of 5 +20 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +20 of 1 +12 of 5 +21 of 1 +10 of 5 +24 of 1 +6 of 5 +572 of 1 +2 of 5 +27 of 1 +8 of 5 +23 of 1 +10 of 5 +21 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +17 of 1 +16 of 5 +16 of 1 +16 of 5 +17 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +21 of 1 +10 of 5 +23 of 1 +8 of 5 +27 of 1 +2 of 5 +541 of 1 +4 of 5 +26 of 1 +8 of 5 +22 of 1 +12 of 5 +20 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +17 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +17 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +20 of 1 +12 of 5 +22 of 1 +8 of 5 +26 of 1 +4 of 5 +539 of 1 +6 of 5 +24 of 1 +10 of 5 +21 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +17 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +17 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +21 of 1 +10 of 5 +24 of 1 +6 of 5 +538 of 1 +6 of 5 +24 of 1 +10 of 5 +21 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +17 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +17 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +21 of 1 +10 of 5 +24 of 1 +6 of 5 +539 of 1 +4 of 5 +26 of 1 +8 of 5 +22 of 1 +12 of 5 +20 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +17 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +16 of 1 +16 of 5 +17 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +20 of 1 +12 of 5 +22 of 1 +8 of 5 +26 of 1 +4 of 5 +541 of 1 +2 of 5 +27 of 1 +8 of 5 +23 of 1 +10 of 5 +21 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +17 of 1 +16 of 5 +16 of 1 +16 of 5 +17 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +21 of 1 +10 of 5 +23 of 1 +8 of 5 +27 of 1 +2 of 5 +572 of 1 +6 of 5 +24 of 1 +10 of 5 +21 of 1 +12 of 5 +20 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +20 of 1 +12 of 5 +21 of 1 +10 of 5 +24 of 1 +6 of 5 +604 of 1 +2 of 5 +27 of 1 +8 of 5 +23 of 1 +10 of 5 +21 of 1 +12 of 5 +20 of 1 +12 of 5 +20 of 1 +12 of 5 +19 of 1 +14 of 5 +18 of 1 +14 of 5 +19 of 1 +12 of 5 +20 of 1 +12 of 5 +20 of 1 +12 of 5 +21 of 1 +10 of 5 +23 of 1 +8 of 5 +27 of 1 +2 of 5 +637 of 1 +4 of 5 +26 of 1 +8 of 5 +23 of 1 +10 of 5 +22 of 1 +10 of 5 +21 of 1 +12 of 5 +20 of 1 +12 of 5 +20 of 1 +12 of 5 +20 of 1 +12 of 5 +21 of 1 +10 of 5 +22 of 1 +10 of 5 +23 of 1 +8 of 5 +26 of 1 +4 of 5 +701 of 1 +2 of 5 +28 of 1 +6 of 5 +25 of 1 +8 of 5 +24 of 1 +8 of 5 +23 of 1 +10 of 5 +22 of 1 +10 of 5 +23 of 1 +8 of 5 +24 of 1 +8 of 5 +25 of 1 +6 of 5 +28 of 1 +2 of 5 +798 of 1 +2 of 5 +29 of 1 +4 of 5 +27 of 1 +6 of 5 +26 of 1 +6 of 5 +27 of 1 +4 of 5 +29 of 1 +2 of 5 +8623 of 1 diff --git a/examples/SpectralMethod/EshelbyInclusion/material.config b/examples/SpectralMethod/EshelbyInclusion/material.config new file mode 100644 index 000000000..83298680b --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/material.config @@ -0,0 +1,111 @@ +#-------------------# + +#-------------------# + +[direct] +type none # isostrain 1 grain + +thermal adiabatic # thermal strain (stress) induced mass transport +initialT 300.0 +(output) temperature + +#-------------------# + +#-------------------# + +[aLittleSomething] + +(output) texture +(output) f +(output) p +(output) fe +(output) fi +(output) fp + +#-------------------# + +#-------------------# + +#................. +[isotropic matrix] + +lattice_structure isotropic +plasticity none +{config/elastic_isotropic.config} +{config/thermal.config} + +#................. +[Ti matrix] + +lattice_structure hex +covera_ratio 1.587 +plasticity none +{config/elastic_Ti.config} +{config/thermal.config} + +#................. +[isotropic inclusion] + +lattice_structure isotropic +plasticity none +{config/elastic_isotropic.config} +{config/thermal.config} +{config/thermalExpansion_isotropic.config} + +#................. +[anisotropic inclusion] + +lattice_structure orthorhombic +plasticity none +{config/elastic_fullyAnisotropic.config} +{config/thermal.config} +{config/thermalExpansion_fullyAnisotropic.config} + +#................. +[Ti inclusion] + +lattice_structure hex +covera_ratio 1.587 +plasticity none +{config/elastic_Ti.config} +{config/thermal.config} +{config/thermalExpansion_Ti.config} + +#--------------------------# + +#--------------------------# + +[isotropic matrix] +crystallite 1 +(constituent) phase 1 texture 1 fraction 1.0 + +[Ti matrix] +crystallite 1 +(constituent) phase 2 texture 1 fraction 1.0 + +[isotropic inclusion] +crystallite 1 +(constituent) phase 3 texture 1 fraction 1.0 + +[anisotropic inclusion] +crystallite 1 +(constituent) phase 4 texture 1 fraction 1.0 + +[rotated inclusion] +crystallite 1 +(constituent) phase 4 texture 2 fraction 1.0 + +[Ti inclusion] +crystallite 1 +(constituent) phase 5 texture 1 fraction 1.0 + +#--------------------------# + +#--------------------------# + +[cube] +(gauss) phi1 0.0 Phi 0.0 phi2 0.0 scatter 0.0 fraction 1.0 + +[rotated] +(gauss) phi1 0.0 Phi 45.0 phi2 0.0 scatter 0.0 fraction 1.0 + diff --git a/examples/SpectralMethod/EshelbyInclusion/numerics.config b/examples/SpectralMethod/EshelbyInclusion/numerics.config new file mode 100644 index 000000000..191c204c8 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/numerics.config @@ -0,0 +1,5 @@ +#spectralsolver polarisation +spectralderivative fwbw_difference +err_div_tolrel 1e-3 +itmin 2 +petsc_options -mech_snes_type anderson -mech_snes_anderson_beta 1.0 -mech_snes_anderson_restart 10 -thermal_snes_type anderson -thermal_snes_anderson_beta 1.0 diff --git a/examples/SpectralMethod/EshelbyInclusion/runAll.sh b/examples/SpectralMethod/EshelbyInclusion/runAll.sh new file mode 100755 index 000000000..27630bc39 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/runAll.sh @@ -0,0 +1,56 @@ +#!/usr/local/bin/bash + +for geom in $(ls geom/*.geom) +do + base=${geom%.geom} + base=${base#geom/} + name=${base}_thermal + vtr=${base}.vtr + + [[ -f ${name}.spectralOut ]] || \ + DAMASK_spectral \ + --workingdir ./ \ + --load thermal.load \ + --geom $geom \ + > ${name}.out + + if [ ! -f postProc/${name}_inc10.txt ] + then + postResults ${name}.spectralOut \ + --ho temperature \ + --cr f,fe,fi,fp,p \ + --split \ + --separation x,y,z \ + + addCauchy postProc/${name}_inc*.txt \ + + addDeviator postProc/${name}_inc*.txt \ + --spherical \ + --tensor p,Cauchy \ + + addDisplacement postProc/${name}_inc*.txt \ + --nodal \ + + fi + + geom_check ${geom} + + for inc in {00..10} + do + echo "generating postProc/${name}_inc${inc}.vtr" + cp geom/${vtr} postProc/${name}_inc${inc}.vtr + vtk_addRectilinearGridData \ + postProc/${name}_inc${inc}.txt \ + --inplace \ + --vtk postProc/${name}_inc${inc}.vtr \ + --data 'sph(p)','sph(Cauchy)',temperature \ + --tensor f,fe,fi,fp,p,Cauchy \ + + vtk_addRectilinearGridData \ + postProc/${name}_inc${inc}_nodal.txt \ + --inplace \ + --vtk postProc/${name}_inc${inc}.vtr \ + --data 'avg(f).pos','fluct(f).pos' \ + + done +done diff --git a/examples/SpectralMethod/EshelbyInclusion/thermal.load b/examples/SpectralMethod/EshelbyInclusion/thermal.load new file mode 100644 index 000000000..a13aaa9e3 --- /dev/null +++ b/examples/SpectralMethod/EshelbyInclusion/thermal.load @@ -0,0 +1 @@ +Fdot 0 0 0 0 0 0 0 0 0 stress * * * * * * * * * time 1000 incs 10 From 0a763ff1164aab772c79e4dac4e366d85e136c83 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 16 Feb 2018 09:36:18 -0500 Subject: [PATCH 16/42] included changes to correct cutback issue of spectral solver --- .../{ => Polycrystal}/20grains.seeds | 0 .../{ => Polycrystal}/20grains16x16x16.geom | 0 .../{ => Polycrystal}/20grains32x32x32.geom | 0 .../{ => Polycrystal}/20grains64x64x64.geom | 0 .../{ => Polycrystal}/material.config | 0 .../{ => Polycrystal}/numerics.config | 0 .../{ => Polycrystal}/shearXY.load | 0 .../{ => Polycrystal}/shearZX.load | 0 .../{ => Polycrystal}/tensionX.load | 0 src/CPFEM2.f90 | 182 +++---- src/DAMASK_spectral.f90 | 258 +++------ src/IO.f90 | 6 +- src/crystallite.f90 | 58 +- src/homogenization.f90 | 40 +- src/numerics.f90 | 14 +- src/spectral_mech_AL.f90 | 496 +++++++++--------- src/spectral_mech_Basic.f90 | 378 ++++++------- src/spectral_mech_Polarisation.f90 | 463 ++++++++-------- src/spectral_utilities.f90 | 236 ++------- 19 files changed, 952 insertions(+), 1179 deletions(-) rename examples/SpectralMethod/{ => Polycrystal}/20grains.seeds (100%) rename examples/SpectralMethod/{ => Polycrystal}/20grains16x16x16.geom (100%) rename examples/SpectralMethod/{ => Polycrystal}/20grains32x32x32.geom (100%) rename examples/SpectralMethod/{ => Polycrystal}/20grains64x64x64.geom (100%) rename examples/SpectralMethod/{ => Polycrystal}/material.config (100%) rename examples/SpectralMethod/{ => Polycrystal}/numerics.config (100%) rename examples/SpectralMethod/{ => Polycrystal}/shearXY.load (100%) rename examples/SpectralMethod/{ => Polycrystal}/shearZX.load (100%) rename examples/SpectralMethod/{ => Polycrystal}/tensionX.load (100%) mode change 100644 => 100755 src/DAMASK_spectral.f90 mode change 100644 => 100755 src/crystallite.f90 mode change 100644 => 100755 src/spectral_utilities.f90 diff --git a/examples/SpectralMethod/20grains.seeds b/examples/SpectralMethod/Polycrystal/20grains.seeds similarity index 100% rename from examples/SpectralMethod/20grains.seeds rename to examples/SpectralMethod/Polycrystal/20grains.seeds diff --git a/examples/SpectralMethod/20grains16x16x16.geom b/examples/SpectralMethod/Polycrystal/20grains16x16x16.geom similarity index 100% rename from examples/SpectralMethod/20grains16x16x16.geom rename to examples/SpectralMethod/Polycrystal/20grains16x16x16.geom diff --git a/examples/SpectralMethod/20grains32x32x32.geom b/examples/SpectralMethod/Polycrystal/20grains32x32x32.geom similarity index 100% rename from examples/SpectralMethod/20grains32x32x32.geom rename to examples/SpectralMethod/Polycrystal/20grains32x32x32.geom diff --git a/examples/SpectralMethod/20grains64x64x64.geom b/examples/SpectralMethod/Polycrystal/20grains64x64x64.geom similarity index 100% rename from examples/SpectralMethod/20grains64x64x64.geom rename to examples/SpectralMethod/Polycrystal/20grains64x64x64.geom diff --git a/examples/SpectralMethod/material.config b/examples/SpectralMethod/Polycrystal/material.config similarity index 100% rename from examples/SpectralMethod/material.config rename to examples/SpectralMethod/Polycrystal/material.config diff --git a/examples/SpectralMethod/numerics.config b/examples/SpectralMethod/Polycrystal/numerics.config similarity index 100% rename from examples/SpectralMethod/numerics.config rename to examples/SpectralMethod/Polycrystal/numerics.config diff --git a/examples/SpectralMethod/shearXY.load b/examples/SpectralMethod/Polycrystal/shearXY.load similarity index 100% rename from examples/SpectralMethod/shearXY.load rename to examples/SpectralMethod/Polycrystal/shearXY.load diff --git a/examples/SpectralMethod/shearZX.load b/examples/SpectralMethod/Polycrystal/shearZX.load similarity index 100% rename from examples/SpectralMethod/shearZX.load rename to examples/SpectralMethod/Polycrystal/shearZX.load diff --git a/examples/SpectralMethod/tensionX.load b/examples/SpectralMethod/Polycrystal/tensionX.load similarity index 100% rename from examples/SpectralMethod/tensionX.load rename to examples/SpectralMethod/Polycrystal/tensionX.load diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index aa2615b5f..a89bfc294 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -9,7 +9,7 @@ module CPFEM2 private public :: & - CPFEM_general, & + CPFEM_age, & CPFEM_initAll contains @@ -127,6 +127,7 @@ subroutine CPFEM_init write(6,'(/,a)') ' <<<+- CPFEM init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" + flush(6) endif mainProcess ! *** restore the last converged values of each essential variable from the binary file @@ -139,36 +140,28 @@ subroutine CPFEM_init write(rankStr,'(a1,i0)')'_',worldrank call IO_read_intFile(777,'recordedPhase'//trim(rankStr),modelName,size(material_phase)) - read (777,rec=1) material_phase - close (777) + read (777,rec=1) material_phase; close (777) call IO_read_realFile(777,'convergedF'//trim(rankStr),modelName,size(crystallite_F0)) - read (777,rec=1) crystallite_F0 - close (777) + read (777,rec=1) crystallite_F0; close (777) call IO_read_realFile(777,'convergedFp'//trim(rankStr),modelName,size(crystallite_Fp0)) - read (777,rec=1) crystallite_Fp0 - close (777) + read (777,rec=1) crystallite_Fp0; close (777) call IO_read_realFile(777,'convergedFi'//trim(rankStr),modelName,size(crystallite_Fi0)) - read (777,rec=1) crystallite_Fi0 - close (777) + read (777,rec=1) crystallite_Fi0; close (777) call IO_read_realFile(777,'convergedLp'//trim(rankStr),modelName,size(crystallite_Lp0)) - read (777,rec=1) crystallite_Lp0 - close (777) + read (777,rec=1) crystallite_Lp0; close (777) call IO_read_realFile(777,'convergedLi'//trim(rankStr),modelName,size(crystallite_Li0)) - read (777,rec=1) crystallite_Li0 - close (777) + read (777,rec=1) crystallite_Li0; close (777) call IO_read_realFile(777,'convergeddPdF'//trim(rankStr),modelName,size(crystallite_dPdF0)) - read (777,rec=1) crystallite_dPdF0 - close (777) + read (777,rec=1) crystallite_dPdF0; close (777) call IO_read_realFile(777,'convergedTstar'//trim(rankStr),modelName,size(crystallite_Tstar0_v)) - read (777,rec=1) crystallite_Tstar0_v - close (777) + read (777,rec=1) crystallite_Tstar0_v; close (777) call IO_read_realFile(777,'convergedStateConst'//trim(rankStr),modelName) m = 0_pInt @@ -194,7 +187,6 @@ subroutine CPFEM_init restartRead = .false. endif - flush(6) end subroutine CPFEM_init @@ -202,7 +194,7 @@ end subroutine CPFEM_init !-------------------------------------------------------------------------------------------------- !> @brief perform initialization at first call, update variables and call the actual material model !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_general(age, dt) +subroutine CPFEM_age() use prec, only: & pReal, & pInt @@ -215,7 +207,6 @@ subroutine CPFEM_general(age, dt) debug_levelExtensive, & debug_levelSelective use FEsolving, only: & - terminallyIll, & restartWrite use math, only: & math_identity2nd, & @@ -254,114 +245,99 @@ subroutine CPFEM_general(age, dt) crystallite_dPdF, & crystallite_Tstar0_v, & crystallite_Tstar_v - use homogenization, only: & - materialpoint_stressAndItsTangent, & - materialpoint_postResults use IO, only: & IO_write_jobRealFile, & IO_warning use DAMASK_interface implicit none - real(pReal), intent(in) :: dt !< time increment - logical, intent(in) :: age !< age results integer(pInt) :: i, k, l, m, ph, homog, mySource - character(len=1024) :: rankStr + character(len=32) :: rankStr - !*** age results and write restart data if requested - if (age) then - crystallite_F0 = crystallite_partionedF ! crystallite deformation (_subF is perturbed...) - crystallite_Fp0 = crystallite_Fp ! crystallite plastic deformation - crystallite_Lp0 = crystallite_Lp ! crystallite plastic velocity - crystallite_Fi0 = crystallite_Fi ! crystallite intermediate deformation - crystallite_Li0 = crystallite_Li ! crystallite intermediate velocity - crystallite_dPdF0 = crystallite_dPdF ! crystallite stiffness - crystallite_Tstar0_v = crystallite_Tstar_v ! crystallite 2nd Piola Kirchhoff stress +if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0_pInt) & + write(6,'(a)') '<< CPFEM >> aging states' - forall ( i = 1:size(plasticState )) plasticState(i)%state0 = plasticState(i)%state ! copy state in this lenghty way because: A component cannot be an array if the encompassing structure is an array - do i = 1, size(sourceState) - do mySource = 1,phase_Nsources(i) - sourceState(i)%p(mySource)%state0 = sourceState(i)%p(mySource)%state ! copy state in this lenghty way because: A component cannot be an array if the encompassing structure is an array - enddo; enddo - if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0_pInt) & - write(6,'(a)') '<< CPFEM >> aging states' +crystallite_F0 = crystallite_partionedF ! crystallite deformation (_subF is perturbed...) +crystallite_Fp0 = crystallite_Fp ! crystallite plastic deformation +crystallite_Lp0 = crystallite_Lp ! crystallite plastic velocity +crystallite_Fi0 = crystallite_Fi ! crystallite intermediate deformation +crystallite_Li0 = crystallite_Li ! crystallite intermediate velocity +crystallite_dPdF0 = crystallite_dPdF ! crystallite stiffness +crystallite_Tstar0_v = crystallite_Tstar_v ! crystallite 2nd Piola Kirchhoff stress - do homog = 1_pInt, material_Nhomogenization - homogState (homog)%state0 = homogState (homog)%state - thermalState (homog)%state0 = thermalState (homog)%state - damageState (homog)%state0 = damageState (homog)%state - vacancyfluxState (homog)%state0 = vacancyfluxState (homog)%state - hydrogenfluxState(homog)%state0 = hydrogenfluxState(homog)%state - enddo +forall (i = 1:size(plasticState)) plasticState(i)%state0 = plasticState(i)%state ! copy state in this lengthy way because: A component cannot be an array if the encompassing structure is an array +do i = 1, size(sourceState) + do mySource = 1,phase_Nsources(i) + sourceState(i)%p(mySource)%state0 = sourceState(i)%p(mySource)%state ! copy state in this lengthy way because: A component cannot be an array if the encompassing structure is an array +enddo; enddo - if (restartWrite) then - if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0_pInt) & - write(6,'(a)') '<< CPFEM >> writing state variables of last converged step to binary files' - - write(rankStr,'(a1,i0)')'_',worldrank +do homog = 1_pInt, material_Nhomogenization + homogState (homog)%state0 = homogState (homog)%state + thermalState (homog)%state0 = thermalState (homog)%state + damageState (homog)%state0 = damageState (homog)%state + vacancyfluxState (homog)%state0 = vacancyfluxState (homog)%state + hydrogenfluxState(homog)%state0 = hydrogenfluxState(homog)%state +enddo - call IO_write_jobRealFile(777,'recordedPhase'//trim(rankStr),size(material_phase)) - write (777,rec=1) material_phase - close (777) +if (restartWrite) then + if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0_pInt) & + write(6,'(a)') '<< CPFEM >> writing state variables of last converged step to binary files' - call IO_write_jobRealFile(777,'convergedF'//trim(rankStr),size(crystallite_F0)) - write (777,rec=1) crystallite_F0 - close (777) + write(rankStr,'(a1,i0)')'_',worldrank - call IO_write_jobRealFile(777,'convergedFp'//trim(rankStr),size(crystallite_Fp0)) - write (777,rec=1) crystallite_Fp0 - close (777) + call IO_write_jobRealFile(777,'recordedPhase'//trim(rankStr),size(material_phase)) + write (777,rec=1) material_phase; close (777) - call IO_write_jobRealFile(777,'convergedFi'//trim(rankStr),size(crystallite_Fi0)) - write (777,rec=1) crystallite_Fi0 - close (777) + call IO_write_jobRealFile(777,'convergedF'//trim(rankStr),size(crystallite_F0)) + write (777,rec=1) crystallite_F0; close (777) - call IO_write_jobRealFile(777,'convergedLp'//trim(rankStr),size(crystallite_Lp0)) - write (777,rec=1) crystallite_Lp0 - close (777) + call IO_write_jobRealFile(777,'convergedFp'//trim(rankStr),size(crystallite_Fp0)) + write (777,rec=1) crystallite_Fp0; close (777) - call IO_write_jobRealFile(777,'convergedLi'//trim(rankStr),size(crystallite_Li0)) - write (777,rec=1) crystallite_Li0 - close (777) + call IO_write_jobRealFile(777,'convergedFi'//trim(rankStr),size(crystallite_Fi0)) + write (777,rec=1) crystallite_Fi0; close (777) - call IO_write_jobRealFile(777,'convergeddPdF'//trim(rankStr),size(crystallite_dPdF0)) - write (777,rec=1) crystallite_dPdF0 - close (777) + call IO_write_jobRealFile(777,'convergedLp'//trim(rankStr),size(crystallite_Lp0)) + write (777,rec=1) crystallite_Lp0; close (777) - call IO_write_jobRealFile(777,'convergedTstar'//trim(rankStr),size(crystallite_Tstar0_v)) - write (777,rec=1) crystallite_Tstar0_v - close (777) + call IO_write_jobRealFile(777,'convergedLi'//trim(rankStr),size(crystallite_Li0)) + write (777,rec=1) crystallite_Li0; close (777) - call IO_write_jobRealFile(777,'convergedStateConst'//trim(rankStr)) - m = 0_pInt - writePlasticityInstances: do ph = 1_pInt, size(phase_plasticity) - do k = 1_pInt, plasticState(ph)%sizeState - do l = 1, size(plasticState(ph)%state0(1,:)) - m = m+1_pInt - write(777,rec=m) plasticState(ph)%state0(k,l) - enddo; enddo - enddo writePlasticityInstances - close (777) + call IO_write_jobRealFile(777,'convergeddPdF'//trim(rankStr),size(crystallite_dPdF0)) + write (777,rec=1) crystallite_dPdF0; close (777) - call IO_write_jobRealFile(777,'convergedStateHomog'//trim(rankStr)) - m = 0_pInt - writeHomogInstances: do homog = 1_pInt, material_Nhomogenization - do k = 1_pInt, homogState(homog)%sizeState - do l = 1, size(homogState(homog)%state0(1,:)) - m = m+1_pInt - write(777,rec=m) homogState(homog)%state0(k,l) - enddo; enddo - enddo writeHomogInstances - close (777) + call IO_write_jobRealFile(777,'convergedTstar'//trim(rankStr),size(crystallite_Tstar0_v)) + write (777,rec=1) crystallite_Tstar0_v; close (777) - endif - endif + call IO_write_jobRealFile(777,'convergedStateConst'//trim(rankStr)) + m = 0_pInt + writePlasticityInstances: do ph = 1_pInt, size(phase_plasticity) + do k = 1_pInt, plasticState(ph)%sizeState + do l = 1, size(plasticState(ph)%state0(1,:)) + m = m+1_pInt + write(777,rec=m) plasticState(ph)%state0(k,l) + enddo; enddo + enddo writePlasticityInstances + close (777) - if (.not. terminallyIll) & - call materialpoint_stressAndItsTangent(.True., dt) + call IO_write_jobRealFile(777,'convergedStateHomog'//trim(rankStr)) + m = 0_pInt + writeHomogInstances: do homog = 1_pInt, material_Nhomogenization + do k = 1_pInt, homogState(homog)%sizeState + do l = 1, size(homogState(homog)%state0(1,:)) + m = m+1_pInt + write(777,rec=m) homogState(homog)%state0(k,l) + enddo; enddo + enddo writeHomogInstances + close (777) -end subroutine CPFEM_general +endif + +if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0_pInt) & + write(6,'(a)') '<< CPFEM >> done aging states' + +end subroutine CPFEM_age end module CPFEM2 diff --git a/src/DAMASK_spectral.f90 b/src/DAMASK_spectral.f90 old mode 100644 new mode 100755 index fe7d78621..7ec2dde4c --- a/src/DAMASK_spectral.f90 +++ b/src/DAMASK_spectral.f90 @@ -78,8 +78,7 @@ program DAMASK_spectral FIELD_UNDEFINED_ID, & FIELD_MECH_ID, & FIELD_THERMAL_ID, & - FIELD_DAMAGE_ID, & - utilities_calcPlasticity + FIELD_DAMAGE_ID use spectral_mech_Basic use spectral_mech_AL use spectral_mech_Polarisation @@ -157,19 +156,6 @@ program DAMASK_spectral MPI_finalize, & MPI_allreduce, & PETScFinalize -!-------------------------------------------------------------------------------------------------- -! variables related to stop criterion for yielding - real(pReal) :: plasticWorkOld, plasticWorkNew, & ! plastic work - eqTotalStrainOld, eqTotalStrainNew, & ! total equivalent strain - eqPlasticStrainOld, eqPlasticStrainNew, & ! total equivalent plastic strain - eqStressOld, eqStressNew , & ! equivalent stress - yieldStopValue - real(pReal), dimension(3,3) :: yieldStress,yieldStressOld,yieldStressNew, & - plasticStrainOld, plasticStrainNew, plasticStrainRate - integer(pInt) :: yieldResUnit = 0_pInt - integer(pInt) :: stressstrainUnit = 0_pInt - character(len=13) :: stopFlag - logical :: yieldStop, yieldStopSatisfied !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) @@ -227,8 +213,6 @@ program DAMASK_spectral !-------------------------------------------------------------------------------------------------- ! reading the load case and assign values to the allocated data structure - yieldStop = .False. - yieldStopSatisfied = .False. rewind(FILEUNIT) do line = IO_read(FILEUNIT) @@ -303,30 +287,10 @@ program DAMASK_spectral temp_valueVector(j) = IO_floatValue(line,chunkPos,i+j) enddo loadCases(currentLoadCase)%rotation = math_plain9to33(temp_valueVector) - case('totalstrain') - yieldStop = .True. - stopFlag = 'totalStrain' - yieldStopValue = IO_floatValue(line,chunkPos,i+1_pInt) - case('plasticstrain') - yieldStop = .True. - stopFlag = 'plasticStrain' - yieldStopValue = IO_floatValue(line,chunkPos,i+1_pInt) - case('plasticwork') - yieldStop = .True. - stopFlag = 'plasticWork' - yieldStopValue = IO_floatValue(line,chunkPos,i+1_pInt) end select enddo; enddo close(FILEUNIT) - if(yieldStop) then ! initialize variables related to yield stop - yieldStressNew = 0.0_pReal - plasticStrainNew = 0.0_pReal - eqStressNew = 0.0_pReal - eqTotalStrainNew = 0.0_pReal - eqPlasticStrainNew = 0.0_pReal - plasticWorkNew = 0.0_pReal - endif !-------------------------------------------------------------------------------------------------- ! consistency checks and output of load case loadCases(1)%followFormerTrajectory = .false. ! cannot guess along trajectory for first inc of first currentLoadCase @@ -387,7 +351,7 @@ program DAMASK_spectral if (loadCases(currentLoadCase)%outputfrequency < 1_pInt) errorID = 836_pInt ! non-positive result frequency write(6,'(2x,a,i5)') 'output frequency: ', & loadCases(currentLoadCase)%outputfrequency - write(6,'(2x,a,i5,/)') 'restart frequency: ', & + write(6,'(2x,a,i5,/)') 'restart frequency: ', & loadCases(currentLoadCase)%restartfrequency if (errorID > 0_pInt) call IO_error(error_ID = errorID, ext_msg = loadcase_string) ! exit with error message enddo checkLoadcases @@ -478,8 +442,9 @@ program DAMASK_spectral if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_seek') if (.not. appendToOutFile) then ! if not restarting, write 0th increment + write(6,'(1/,a)') ' ... writing initial configuration to file ........................' do i = 1, size(materialpoint_results,3)/(maxByteOut/(materialpoint_sizeResults*pReal))+1 ! slice the output of my process in chunks not exceeding the limit for one output - outputIndex = int([(i-1_pInt)*((maxRealOut)/materialpoint_sizeResults)+1_pInt, & + outputIndex = int([(i-1_pInt)*((maxRealOut)/materialpoint_sizeResults)+1_pInt, & ! QUESTION: why not starting i at 0 instead of murky 1? min(i*((maxRealOut)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt) call MPI_file_write(resUnit, & reshape(materialpoint_results(:,:,outputIndex(1):outputIndex(2)), & @@ -489,24 +454,23 @@ program DAMASK_spectral if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_write') enddo fileOffset = fileOffset + sum(outputSize) ! forward to current file position - write(6,'(1/,a)') ' ... writing initial configuration to file ........................' endif !-------------------------------------------------------------------------------------------------- -! loopping over loadcases +! looping over loadcases loadCaseLooping: do currentLoadCase = 1_pInt, size(loadCases) time0 = time ! currentLoadCase start time guess = loadCases(currentLoadCase)%followFormerTrajectory ! change of load case? homogeneous guess for the first inc !-------------------------------------------------------------------------------------------------- -! loop oper incs defined in input file for current currentLoadCase +! loop over incs defined in input file for current currentLoadCase incLooping: do inc = 1_pInt, loadCases(currentLoadCase)%incs totalIncsCounter = totalIncsCounter + 1_pInt !-------------------------------------------------------------------------------------------------- ! forwarding time - timeIncOld = timeinc + timeIncOld = timeinc ! last timeinc that brought former inc to an end if (loadCases(currentLoadCase)%logscale == 0_pInt) then ! linear scale - timeinc = loadCases(currentLoadCase)%time/real(loadCases(currentLoadCase)%incs,pReal) ! only valid for given linear time scale. will be overwritten later in case loglinear scale is used + timeinc = loadCases(currentLoadCase)%time/real(loadCases(currentLoadCase)%incs,pReal) else if (currentLoadCase == 1_pInt) then ! 1st currentLoadCase of logarithmic scale if (inc == 1_pInt) then ! 1st inc of 1st currentLoadCase of logarithmic scale @@ -519,37 +483,43 @@ program DAMASK_spectral ( (1.0_pReal + loadCases(currentLoadCase)%time/time0 )**(real( inc,pReal)/& real(loadCases(currentLoadCase)%incs ,pReal))& -(1.0_pReal + loadCases(currentLoadCase)%time/time0 )**(real( (inc-1_pInt),pReal)/& - real(loadCases(currentLoadCase)%incs ,pReal))) + real(loadCases(currentLoadCase)%incs ,pReal))) endif endif - timeinc = timeinc / 2.0_pReal**real(cutBackLevel,pReal) ! depending on cut back level, decrease time step + timeinc = timeinc * real(subStepFactor,pReal)**real(-cutBackLevel,pReal) ! depending on cut back level, decrease time step - forwarding: if (totalIncsCounter >= restartInc) then - stepFraction = 0_pInt + skipping: if (totalIncsCounter < restartInc) then ! not yet at restart inc? + time = time + timeinc ! just advance time, skip already performed calculation + guess = .true. ! QUESTION:why forced guessing instead of inheriting loadcase preference + else skipping + stepFraction = 0_pInt ! fraction scaled by stepFactor**cutLevel !-------------------------------------------------------------------------------------------------- -! loop over sub incs - subIncLooping: do while (stepFraction/subStepFactor**cutBackLevel <1_pInt) - time = time + timeinc ! forward time - stepFraction = stepFraction + 1_pInt - remainingLoadCaseTime = time0 - time + loadCases(currentLoadCase)%time + timeInc +! loop over sub step + subStepLooping: do while (stepFraction < subStepFactor**cutBackLevel) + remainingLoadCaseTime = loadCases(currentLoadCase)%time+time0 - time + time = time + timeinc ! forward target time + stepFraction = stepFraction + 1_pInt ! count step !-------------------------------------------------------------------------------------------------- -! report begin of new increment +! report begin of new step write(6,'(/,a)') ' ###########################################################################' write(6,'(1x,a,es12.5'//& - ',a,'//IO_intOut(inc)//',a,'//IO_intOut(loadCases(currentLoadCase)%incs)//& - ',a,'//IO_intOut(stepFraction)//',a,'//IO_intOut(subStepFactor**cutBackLevel)//& + ',a,'//IO_intOut(inc) //',a,'//IO_intOut(loadCases(currentLoadCase)%incs)//& + ',a,'//IO_intOut(stepFraction) //',a,'//IO_intOut(subStepFactor**cutBackLevel)//& ',a,'//IO_intOut(currentLoadCase)//',a,'//IO_intOut(size(loadCases))//')') & 'Time', time, & 's: Increment ', inc, '/', loadCases(currentLoadCase)%incs,& '-', stepFraction, '/', subStepFactor**cutBackLevel,& ' of load case ', currentLoadCase,'/',size(loadCases) + write(incInfo,& + '(a,'//IO_intOut(totalIncsCounter)//& + ',a,'//IO_intOut(sum(loadCases%incs))//& + ',a,'//IO_intOut(stepFraction)//& + ',a,'//IO_intOut(subStepFactor**cutBackLevel)//')') & + 'Increment ',totalIncsCounter,'/',sum(loadCases%incs),& + '-',stepFraction, '/', subStepFactor**cutBackLevel flush(6) - write(incInfo,'(a,'//IO_intOut(totalIncsCounter)//',a,'//IO_intOut(sum(loadCases%incs))//& - ',a,'//IO_intOut(stepFraction)//',a,'//IO_intOut(subStepFactor**cutBackLevel)//')') & - 'Increment ',totalIncsCounter,'/',sum(loadCases%incs),& - '-',stepFraction, '/', subStepFactor**cutBackLevel !-------------------------------------------------------------------------------------------------- ! forward fields @@ -578,7 +548,7 @@ program DAMASK_spectral end select case(FIELD_THERMAL_ID); call spectral_thermal_forward() - case(FIELD_DAMAGE_ID); call spectral_damage_forward() + case(FIELD_DAMAGE_ID); call spectral_damage_forward() end select enddo @@ -618,65 +588,63 @@ program DAMASK_spectral solres(field) = spectral_damage_solution(timeinc,timeIncOld,remainingLoadCaseTime) end select + if (.not. solres(field)%converged) exit ! no solution found + enddo stagIter = stagIter + 1_pInt - stagIterate = stagIter < stagItMax .and. & - all(solres(:)%converged) .and. & - .not. all(solres(:)%stagConverged) + stagIterate = stagIter < stagItMax & + .and. all(solres(:)%converged) & + .and. .not. all(solres(:)%stagConverged) ! stationary with respect to staggered iteration enddo !-------------------------------------------------------------------------------------------------- -! check solution - cutBack = .False. - if(solres(1)%termIll .or. .not. all(solres(:)%converged .and. solres(:)%stagConverged)) then ! no solution found - if (cutBackLevel < maxCutBack) then ! do cut back - write(6,'(/,a)') ' cut back detected' - cutBack = .True. - stepFraction = (stepFraction - 1_pInt) * subStepFactor ! adjust to new denominator - cutBackLevel = cutBackLevel + 1_pInt - time = time - timeinc ! rewind time - timeinc = timeinc/2.0_pReal - elseif (solres(1)%termIll) then ! material point model cannot find a solution, exit in any casy - call IO_warning(850_pInt) - call MPI_file_close(resUnit,ierr) - close(statUnit) - call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written - elseif (continueCalculation == 1_pInt) then - guess = .true. ! accept non converged BVP solution - else ! default behavior, exit if spectral solver does not converge - call IO_warning(850_pInt) - call MPI_file_close(resUnit,ierr) - close(statUnit) - call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written - endif - else +! check solution for either advance or retry + + if ( (continueCalculation .or. all(solres(:)%converged .and. solres(:)%stagConverged)) & ! don't care or did converge + .and. .not. solres(1)%termIll) then ! and acceptable solution found + timeIncOld = timeinc + cutBack = .false. guess = .true. ! start guessing after first converged (sub)inc - endif - if (.not. cutBack) then if (worldrank == 0) then write(statUnit,*) totalIncsCounter, time, cutBackLevel, & - solres%converged, solres%iterationsNeeded ! write statistics about accepted solution + solres%converged, solres%iterationsNeeded flush(statUnit) endif + elseif (cutBackLevel < maxCutBack) then ! further cutbacking tolerated? + cutBack = .true. + stepFraction = (stepFraction - 1_pInt) * subStepFactor ! adjust to new denominator + cutBackLevel = cutBackLevel + 1_pInt + time = time - timeinc ! rewind time + timeinc = timeinc/real(subStepFactor,pReal) ! cut timestep + write(6,'(/,a)') ' cutting back ' + else ! no more options to continue + call IO_warning(850_pInt) + call MPI_file_close(resUnit,ierr) + close(statUnit) + call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written endif - enddo subIncLooping + + enddo subStepLooping + cutBackLevel = max(0_pInt, cutBackLevel - 1_pInt) ! try half number of subincs next inc - if(all(solres(:)%converged)) then ! report converged inc + + if (all(solres(:)%converged)) then convergedCounter = convergedCounter + 1_pInt - write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & + write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & ! report converged inc ' increment ', totalIncsCounter, ' converged' else - write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & ! report non-converged inc - ' increment ', totalIncsCounter, ' NOT converged' notConvergedCounter = notConvergedCounter + 1_pInt + write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & ! report non-converged inc + ' increment ', totalIncsCounter, ' NOT converged' endif; flush(6) + if (mod(inc,loadCases(currentLoadCase)%outputFrequency) == 0_pInt) then ! at output frequency - if (worldrank == 0) & - write(6,'(1/,a)') ' ... writing results to file ......................................' + write(6,'(1/,a)') ' ... writing results to file ......................................' + flush(6) call materialpoint_postResults() call MPI_file_seek (resUnit,fileOffset,MPI_SEEK_SET,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_seek') + if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_seek') do i=1, size(materialpoint_results,3)/(maxByteOut/(materialpoint_sizeResults*pReal))+1 ! slice the output of my process in chunks not exceeding the limit for one output outputIndex=int([(i-1_pInt)*((maxRealOut)/materialpoint_sizeResults)+1_pInt, & min(i*((maxRealOut)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt) @@ -688,93 +656,29 @@ program DAMASK_spectral enddo fileOffset = fileOffset + sum(outputSize) ! forward to current file position endif - if( loadCases(currentLoadCase)%restartFrequency > 0_pInt .and. & ! at frequency of writing restart information set restart parameter for FEsolving - mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0_pInt) then ! first call to CPFEM_general will write? - restartWrite = .true. - lastRestartWritten = inc + if ( loadCases(currentLoadCase)%restartFrequency > 0_pInt & ! writing of restart info requested ... + .and. mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0_pInt) then ! ... and at frequency of writing restart information + restartWrite = .true. ! set restart parameter for FEsolving + lastRestartWritten = inc ! QUESTION: first call to CPFEM_general will write? endif - else forwarding - time = time + timeinc - guess = .true. - endif forwarding - - yieldCheck: if(yieldStop) then ! check if it yields or satisfies the certain stop condition - yieldStressOld = yieldStressNew - plasticStrainOld = plasticStrainNew - eqStressOld = eqStressNew - eqTotalStrainOld = eqTotalStrainNew - eqPlasticStrainOld = eqPlasticStrainNew - plasticWorkOld = plasticWorkNew - - call utilities_calcPlasticity(yieldStressNew, plasticStrainNew, eqStressNew, eqTotalStrainNew, & - eqPlasticStrainNew, plasticWorkNew, loadCases(currentLoadCase)%rotation) - - if (worldrank == 0) then ! output the stress-strain curve to file if yield stop criterion is used - if ((currentLoadCase == 1_pInt) .and. (inc == 1_pInt)) then - open(newunit=stressstrainUnit,file=trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//& - '.stressstrain',form='FORMATTED',status='REPLACE') - write(stressstrainUnit,*) 0.0_pReal, 0.0_pReal - write(stressstrainUnit,*) eqTotalStrainNew, eqStressNew - close(stressstrainUnit) - else - open(newunit=stressstrainUnit,file=trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//& - '.stressstrain',form='FORMATTED', position='APPEND', status='OLD') - write(stressstrainUnit,*) eqTotalStrainNew, eqStressNew - close(stressstrainUnit) - endif - endif - - if(stopFlag == 'totalStrain') then - if(eqTotalStrainNew > yieldStopValue) then - yieldStress = yieldStressOld * (eqTotalStrainNew - yieldStopValue)/(eqTotalStrainNew - eqTotalStrainOld) & ! linear interpolation of stress values - + yieldStressNew * (yieldStopValue - eqTotalStrainOld)/(eqTotalStrainNew - eqTotalStrainOld) - plasticStrainRate = (plasticStrainNew - plasticStrainOld)/(time - time0) ! calculate plastic strain rate - yieldStopSatisfied = .True. - endif - elseif(stopFlag == 'plasticStrain') then - if(eqPlasticStrainNew > yieldStopValue) then - yieldStress = yieldStressOld * (eqPlasticStrainNew - yieldStopValue)/(eqPlasticStrainNew - eqPlasticStrainOld) & - + yieldStressNew * (yieldStopValue - eqPlasticStrainOld)/(eqPlasticStrainNew - eqPlasticStrainOld) - plasticStrainRate = (plasticStrainNew - plasticStrainOld)/(time - time0) - yieldStopSatisfied = .True. - endif - elseif(stopFlag == 'plasticWork') then - if(plasticWorkNew > yieldStopValue) then - yieldStress = yieldStressOld * (plasticWorkNew - yieldStopValue)/(plasticWorkNew - plasticWorkOld) & - + yieldStressNew * (yieldStopValue - plasticWorkOld)/(plasticWorkNew - plasticWorkOld) - plasticStrainRate = (plasticStrainNew - plasticStrainOld)/(time - time0) - yieldStopSatisfied = .True. - endif - endif - endif yieldCheck - if (yieldStopSatisfied) then ! when yield, write the yield stress and strain rate to file and quit the job - if (worldrank == 0) then - open(newunit=yieldResUnit,file=trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//& - '.yield',form='FORMATTED',status='REPLACE') - do i = 1_pInt,3_pInt - write(yieldResUnit,*) (yieldStress(i,j), j=1,3) - enddo - do i = 1_pInt,3_pInt - write(yieldResUnit,*) (plasticStrainRate(i,j), j=1,3) - enddo - close(yieldResUnit) - call quit(0_pInt) - endif - endif + endif skipping enddo incLooping + enddo loadCaseLooping !-------------------------------------------------------------------------------------------------- ! report summary of whole calculation write(6,'(/,a)') ' ###########################################################################' - write(6,'(1x,i6.6,a,i6.6,a,f5.1,a)') convergedCounter, ' out of ', & - notConvergedCounter + convergedCounter, ' (', & - real(convergedCounter, pReal)/& - real(notConvergedCounter + convergedCounter,pReal)*100.0_pReal, & - ' %) increments converged!' + write(6,'(1x,'//IO_intOut(convergedCounter)//',a,'//IO_intOut(notConvergedCounter + convergedCounter)//',a,f5.1,a)') & + convergedCounter, ' out of ', & + notConvergedCounter + convergedCounter, ' (', & + real(convergedCounter, pReal)/& + real(notConvergedCounter + convergedCounter,pReal)*100.0_pReal, & + ' %) increments converged!' + flush(6) call MPI_file_close(resUnit,ierr) close(statUnit) @@ -831,8 +735,6 @@ subroutine quit(stop_id) call PETScFinalize(ierr) if (ierr /= 0) write(6,'(a)') ' Error in PETScFinalize' #ifdef _OPENMP - ! If openMP is enabled, MPI is initialized before and independently of PETSc. Hence, also - ! take care of the finalization call MPI_finalize(error) if (error /= 0) write(6,'(a)') ' Error in MPI_finalize' #endif diff --git a/src/IO.f90 b/src/IO.f90 index d024d04ff..9e8033f73 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -1268,11 +1268,11 @@ integer(pInt) function IO_countNumericalDataLines(fileUnit) line = IO_read(fileUnit) chunkPos = IO_stringPos(line) tmp = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) - if (verify(trim(tmp) ,"0123456789")/=0) then ! found keyword + if (verify(trim(tmp),'0123456789') == 0) then ! numerical values + IO_countNumericalDataLines = IO_countNumericalDataLines + 1_pInt + else line = IO_read(fileUnit, .true.) ! reset IO_read exit - else - IO_countNumericalDataLines = IO_countNumericalDataLines + 1_pInt endif enddo backspace(fileUnit) diff --git a/src/crystallite.f90 b/src/crystallite.f90 old mode 100644 new mode 100755 index dd6a01786..3ff4417fe --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -55,14 +55,14 @@ module crystallite crystallite_Li0, & !< intermediate velocitiy grad at start of FE inc crystallite_partionedLi0,& !< intermediate velocity grad at start of homog inc crystallite_Fe, & !< current "elastic" def grad (end of converged time step) - crystallite_P, & !< 1st Piola-Kirchhoff stress per grain - crystallite_subF !< def grad to be reached at end of crystallite inc + crystallite_P !< 1st Piola-Kirchhoff stress per grain real(pReal), dimension(:,:,:,:,:), allocatable, private :: & crystallite_subFe0,& !< "elastic" def grad at start of crystallite inc crystallite_invFp, & !< inverse of current plastic def grad (end of converged time step) crystallite_subFp0,& !< plastic def grad at start of crystallite inc crystallite_invFi, & !< inverse of current intermediate def grad (end of converged time step) crystallite_subFi0,& !< intermediate def grad at start of crystallite inc + crystallite_subF, & !< def grad to be reached at end of crystallite inc crystallite_subF0, & !< def grad at start of crystallite inc crystallite_subLp0,& !< plastic velocity grad at start of crystallite inc crystallite_subLi0,& !< intermediate velocity grad at start of crystallite inc @@ -193,7 +193,7 @@ subroutine crystallite_init c, & !< counter in integration point component loop i, & !< counter in integration point loop e, & !< counter in element loop - o, & !< counter in output loop + o = 0_pInt, & !< counter in output loop r, & !< counter in crystallite loop cMax, & !< maximum number of integration point components iMax, & !< maximum number of integration points @@ -1239,14 +1239,16 @@ subroutine crystallite_integrateStateRK4() use numerics, only: & numerics_integrationMode use debug, only: & +#ifdef DEBUG + debug_e, & + debug_i, & + debug_g, & +#endif debug_level, & debug_crystallite, & debug_levelBasic, & debug_levelExtensive, & debug_levelSelective, & - debug_e, & - debug_i, & - debug_g, & debug_StateLoopDistribution use FEsolving, only: & FEsolving_execElem, & @@ -1533,14 +1535,16 @@ subroutine crystallite_integrateStateRKCK45() use, intrinsic :: & IEEE_arithmetic use debug, only: & +#ifdef DEBUG + debug_e, & + debug_i, & + debug_g, & +#endif debug_level, & debug_crystallite, & debug_levelBasic, & debug_levelExtensive, & debug_levelSelective, & - debug_e, & - debug_i, & - debug_g, & debug_StateLoopDistribution use numerics, only: & rTol_crystalliteState, & @@ -2036,14 +2040,16 @@ subroutine crystallite_integrateStateAdaptiveEuler() use, intrinsic :: & IEEE_arithmetic use debug, only: & +#ifdef DEBUG + debug_e, & + debug_i, & + debug_g, & +#endif debug_level, & debug_crystallite, & debug_levelBasic, & debug_levelExtensive, & debug_levelSelective, & - debug_e, & - debug_i, & - debug_g, & debug_StateLoopDistribution use numerics, only: & rTol_crystalliteState, & @@ -2396,14 +2402,16 @@ subroutine crystallite_integrateStateEuler() use, intrinsic :: & IEEE_arithmetic use debug, only: & +#ifdef DEBUG + debug_e, & + debug_i, & + debug_g, & +#endif debug_level, & debug_crystallite, & debug_levelBasic, & debug_levelExtensive, & debug_levelSelective, & - debug_e, & - debug_i, & - debug_g, & debug_StateLoopDistribution use numerics, only: & numerics_integrationMode, & @@ -2619,9 +2627,11 @@ subroutine crystallite_integrateStateFPI() use, intrinsic :: & IEEE_arithmetic use debug, only: & +#ifdef DEBUG debug_e, & debug_i, & debug_g, & +#endif debug_level,& debug_crystallite, & debug_levelBasic, & @@ -3068,14 +3078,16 @@ logical function crystallite_stateJump(ipc,ip,el) IEEE_arithmetic use prec, only: & dNeq0 +#ifdef DEBUG use debug, only: & + debug_e, & + debug_i, & + debug_g, & debug_level, & debug_crystallite, & debug_levelExtensive, & - debug_levelSelective, & - debug_e, & - debug_i, & - debug_g + debug_levelSelective +#endif use material, only: & plasticState, & sourceState, & @@ -3205,9 +3217,11 @@ logical function crystallite_integrateStress(& debug_levelBasic, & debug_levelExtensive, & debug_levelSelective, & +#ifdef DEBUG debug_e, & debug_i, & debug_g, & +#endif debug_cumLpCalls, & debug_cumLpTicks, & debug_StressLoopLpDistribution, & @@ -3233,7 +3247,9 @@ logical function crystallite_integrateStress(& math_Plain33to9, & math_Plain9to33, & math_Plain99to3333 +#ifdef DEBUG use mesh, only: mesh_element +#endif implicit none integer(pInt), intent(in):: el, & ! element index @@ -3297,8 +3313,8 @@ logical function crystallite_integrateStress(& p, & jacoCounterLp, & jacoCounterLi ! counters to check for Jacobian update - integer(pLongInt) tick, & - tock, & + integer(pLongInt) :: tick = 0_pLongInt, & + tock = 0_pLongInt, & tickrate, & maxticks diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 7cc5fbd04..7dbea41d5 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -16,7 +16,7 @@ module homogenization ! General variables for the homogenization at a material point implicit none private - real(pReal), dimension(:,:,:,:), allocatable, public :: & + real(pReal), dimension(:,:,:,:), allocatable, public :: & materialpoint_F0, & !< def grad of IP at start of FE increment materialpoint_F, & !< def grad of IP to be reached at end of FE increment materialpoint_P !< first P--K stress of IP @@ -128,7 +128,7 @@ subroutine homogenization_init integer(pInt), dimension(:) , pointer :: thisNoutput character(len=64), dimension(:,:), pointer :: thisOutput character(len=32) :: outputName !< name of output, intermediate fix until HDF5 output is ready - logical :: knownHomogenization, knownThermal, knownDamage, knownVacancyflux, knownPorosity, knownHydrogenflux + logical :: valid !-------------------------------------------------------------------------------------------------- @@ -199,7 +199,7 @@ subroutine homogenization_init do p = 1,material_Nhomogenization if (any(material_homog == p)) then i = homogenization_typeInstance(p) ! which instance of this homogenization type - knownHomogenization = .true. ! assume valid + valid = .true. ! assume valid select case(homogenization_type(p)) ! split per homogenization type case (HOMOGENIZATION_NONE_ID) outputName = HOMOGENIZATION_NONE_label @@ -217,10 +217,10 @@ subroutine homogenization_init thisOutput => homogenization_RGC_output thisSize => homogenization_RGC_sizePostResult case default - knownHomogenization = .false. + valid = .false. end select write(FILEUNIT,'(/,a,/)') '['//trim(homogenization_name(p))//']' - if (knownHomogenization) then + if (valid) then write(FILEUNIT,'(a)') '(type)'//char(9)//trim(outputName) write(FILEUNIT,'(a,i4)') '(ngrains)'//char(9),homogenization_Ngrains(p) if (homogenization_type(p) /= HOMOGENIZATION_NONE_ID) then @@ -230,7 +230,7 @@ subroutine homogenization_init endif endif i = thermal_typeInstance(p) ! which instance of this thermal type - knownThermal = .true. ! assume valid + valid = .true. ! assume valid select case(thermal_type(p)) ! split per thermal type case (THERMAL_isothermal_ID) outputName = THERMAL_isothermal_label @@ -248,9 +248,9 @@ subroutine homogenization_init thisOutput => thermal_conduction_output thisSize => thermal_conduction_sizePostResult case default - knownThermal = .false. + valid = .false. end select - if (knownThermal) then + if (valid) then write(FILEUNIT,'(a)') '(thermal)'//char(9)//trim(outputName) if (thermal_type(p) /= THERMAL_isothermal_ID) then do e = 1,thisNoutput(i) @@ -259,7 +259,7 @@ subroutine homogenization_init endif endif i = damage_typeInstance(p) ! which instance of this damage type - knownDamage = .true. ! assume valid + valid = .true. ! assume valid select case(damage_type(p)) ! split per damage type case (DAMAGE_none_ID) outputName = DAMAGE_none_label @@ -277,9 +277,9 @@ subroutine homogenization_init thisOutput => damage_nonlocal_output thisSize => damage_nonlocal_sizePostResult case default - knownDamage = .false. + valid = .false. end select - if (knownDamage) then + if (valid) then write(FILEUNIT,'(a)') '(damage)'//char(9)//trim(outputName) if (damage_type(p) /= DAMAGE_none_ID) then do e = 1,thisNoutput(i) @@ -288,7 +288,7 @@ subroutine homogenization_init endif endif i = vacancyflux_typeInstance(p) ! which instance of this vacancy flux type - knownVacancyflux = .true. ! assume valid + valid = .true. ! assume valid select case(vacancyflux_type(p)) ! split per vacancy flux type case (VACANCYFLUX_isoconc_ID) outputName = VACANCYFLUX_isoconc_label @@ -306,9 +306,9 @@ subroutine homogenization_init thisOutput => vacancyflux_cahnhilliard_output thisSize => vacancyflux_cahnhilliard_sizePostResult case default - knownVacancyflux = .false. + valid = .false. end select - if (knownVacancyflux) then + if (valid) then write(FILEUNIT,'(a)') '(vacancyflux)'//char(9)//trim(outputName) if (vacancyflux_type(p) /= VACANCYFLUX_isoconc_ID) then do e = 1,thisNoutput(i) @@ -317,7 +317,7 @@ subroutine homogenization_init endif endif i = porosity_typeInstance(p) ! which instance of this porosity type - knownPorosity = .true. ! assume valid + valid = .true. ! assume valid select case(porosity_type(p)) ! split per porosity type case (POROSITY_none_ID) outputName = POROSITY_none_label @@ -330,9 +330,9 @@ subroutine homogenization_init thisOutput => porosity_phasefield_output thisSize => porosity_phasefield_sizePostResult case default - knownPorosity = .false. + valid = .false. end select - if (knownPorosity) then + if (valid) then write(FILEUNIT,'(a)') '(porosity)'//char(9)//trim(outputName) if (porosity_type(p) /= POROSITY_none_ID) then do e = 1,thisNoutput(i) @@ -341,7 +341,7 @@ subroutine homogenization_init endif endif i = hydrogenflux_typeInstance(p) ! which instance of this hydrogen flux type - knownHydrogenflux = .true. ! assume valid + valid = .true. ! assume valid select case(hydrogenflux_type(p)) ! split per hydrogen flux type case (HYDROGENFLUX_isoconc_ID) outputName = HYDROGENFLUX_isoconc_label @@ -354,9 +354,9 @@ subroutine homogenization_init thisOutput => hydrogenflux_cahnhilliard_output thisSize => hydrogenflux_cahnhilliard_sizePostResult case default - knownHydrogenflux = .false. + valid = .false. end select - if (knownHydrogenflux) then + if (valid) then write(FILEUNIT,'(a)') '(hydrogenflux)'//char(9)//trim(outputName) if (hydrogenflux_type(p) /= HYDROGENFLUX_isoconc_ID) then do e = 1,thisNoutput(i) diff --git a/src/numerics.f90 b/src/numerics.f90 index 00d97297e..c854d9d2b 100644 --- a/src/numerics.f90 +++ b/src/numerics.f90 @@ -120,9 +120,9 @@ module numerics petsc_options = '' integer(pInt), protected, public :: & fftw_planner_flag = 32_pInt, & !< conversion of fftw_plan_mode to integer, basically what is usually done in the include file of fftw - continueCalculation = 0_pInt, & !< 0: exit if BVP solver does not converge, 1: continue calculation if BVP solver does not converge divergence_correction = 2_pInt !< correct divergence calculation in fourier space 0: no correction, 1: size scaled to 1, 2: size scaled to Npoints logical, protected, public :: & + continueCalculation = .false., & !< false:exit if BVP solver does not converge, true: continue calculation despite BVP solver not converging memory_efficient = .true., & !< for fast execution (pre calculation of gamma_hat), Default .true.: do not precalculate update_gamma = .false. !< update gamma operator with current stiffness, Default .false.: use initial stiffness #endif @@ -424,9 +424,9 @@ subroutine numerics_init case ('err_stress_tolabs') err_stress_tolabs = IO_floatValue(line,chunkPos,2_pInt) case ('continuecalculation') - continueCalculation = IO_intValue(line,chunkPos,2_pInt) + continueCalculation = IO_intValue(line,chunkPos,2_pInt) > 0_pInt case ('memory_efficient') - memory_efficient = IO_intValue(line,chunkPos,2_pInt) > 0_pInt + memory_efficient = IO_intValue(line,chunkPos,2_pInt) > 0_pInt case ('fftw_timelimit') fftw_timelimit = IO_floatValue(line,chunkPos,2_pInt) case ('fftw_plan_mode') @@ -436,7 +436,7 @@ subroutine numerics_init case ('divergence_correction') divergence_correction = IO_intValue(line,chunkPos,2_pInt) case ('update_gamma') - update_gamma = IO_intValue(line,chunkPos,2_pInt) > 0_pInt + update_gamma = IO_intValue(line,chunkPos,2_pInt) > 0_pInt case ('petsc_options') petsc_options = trim(line(chunkPos(4):)) case ('spectralsolver','myspectralsolver') @@ -599,7 +599,7 @@ subroutine numerics_init !-------------------------------------------------------------------------------------------------- ! spectral parameters #ifdef Spectral - write(6,'(a24,1x,i8)') ' continueCalculation: ',continueCalculation + write(6,'(a24,1x,L8)') ' continueCalculation: ',continueCalculation write(6,'(a24,1x,L8)') ' memory_efficient: ',memory_efficient write(6,'(a24,1x,i8)') ' divergence_correction: ',divergence_correction write(6,'(a24,1x,a)') ' spectral_derivative: ',trim(spectral_derivative) @@ -698,8 +698,6 @@ subroutine numerics_init if (err_hydrogenflux_tolabs <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_hydrogenflux_tolabs') if (err_hydrogenflux_tolrel <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_hydrogenflux_tolrel') #ifdef Spectral - if (continueCalculation /= 0_pInt .and. & - continueCalculation /= 1_pInt) call IO_error(301_pInt,ext_msg='continueCalculation') if (divergence_correction < 0_pInt .or. & divergence_correction > 2_pInt) call IO_error(301_pInt,ext_msg='divergence_correction') if (update_gamma .and. & @@ -713,7 +711,7 @@ subroutine numerics_init if (polarAlpha <= 0.0_pReal .or. & polarAlpha > 2.0_pReal) call IO_error(301_pInt,ext_msg='polarAlpha') if (polarBeta < 0.0_pReal .or. & - polarBeta > 2.0_pReal) call IO_error(301_pInt,ext_msg='polarBeta') + polarBeta > 2.0_pReal) call IO_error(301_pInt,ext_msg='polarBeta') #endif end subroutine numerics_init diff --git a/src/spectral_mech_AL.f90 b/src/spectral_mech_AL.f90 index f2b9d3f7f..176ac7194 100644 --- a/src/spectral_mech_AL.f90 +++ b/src/spectral_mech_AL.f90 @@ -43,17 +43,20 @@ module spectral_mech_AL !-------------------------------------------------------------------------------------------------- ! stress, stiffness and compliance average etc. real(pReal), private, dimension(3,3) :: & - F_aimDot, & !< assumed rate of average deformation gradient + F_aimDot = 0.0_pReal, & !< assumed rate of average deformation gradient F_aim = math_I3, & !< current prescribed deformation gradient F_aim_lastInc = math_I3, & !< previous average deformation gradient F_av = 0.0_pReal, & !< average incompatible def grad field P_av = 0.0_pReal, & !< average 1st Piola--Kirchhoff stress P_avLastEval = 0.0_pReal !< average 1st Piola--Kirchhoff stress last call of CPFEM_general - character(len=1024), private :: incInfo !< time and increment information + + character(len=1024), private :: incInfo !< time and increment information + real(pReal), private, dimension(3,3,3,3) :: & C_volAvg = 0.0_pReal, & !< current volume average stiffness C_volAvgLastInc = 0.0_pReal, & !< previous volume average stiffness C_minMaxAvg = 0.0_pReal, & !< current (min+max)/2 stiffness + C_minMaxAvgLastInc = 0.0_pReal, & !< previous (min+max)/2 stiffness S = 0.0_pReal, & !< current compliance (filled up with zeros) C_scale = 0.0_pReal, & S_scale = 0.0_pReal @@ -62,7 +65,7 @@ module spectral_mech_AL err_BC, & !< deviation from stress BC err_curl, & !< RMS of curl of F err_div !< RMS of div of P - logical, private :: ForwardData + integer(pInt), private :: & totalIter = 0_pInt !< total iteration in current increment @@ -80,7 +83,7 @@ module spectral_mech_AL contains !-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields and fills them with data, potentially from restart info +!> @brief allocates all necessary fields and fills them with data, potentially from restart info !> @todo use sourced allocation, e.g. allocate(Fdot,source = F_lastInc) !-------------------------------------------------------------------------------------------------- subroutine AL_init @@ -102,12 +105,15 @@ subroutine AL_init use numerics, only: & worldrank, & worldsize + use homogenization, only: & + materialpoint_F0 use DAMASK_interface, only: & getSolverJobName use spectral_utilities, only: & Utilities_constitutiveResponse, & Utilities_updateGamma, & - Utilities_updateIPcoords + Utilities_updateIPcoords, & + wgt use mesh, only: & grid, & grid3 @@ -120,7 +126,11 @@ subroutine AL_init temp33_Real = 0.0_pReal PetscErrorCode :: ierr - PetscScalar, pointer, dimension(:,:,:,:) :: xx_psc, F, F_lambda + PetscScalar, pointer, dimension(:,:,:,:) :: & + FandF_lambda, & ! overall pointer to solution data + F, & ! specific (sub)pointer + F_lambda ! specific (sub)pointer + integer(pInt), dimension(:), allocatable :: localK integer(pInt) :: proc character(len=1024) :: rankStr @@ -160,51 +170,43 @@ subroutine AL_init DMDA_STENCIL_BOX, & ! Moore (26) neighborhood around central point grid(1),grid(2),grid(3), & ! global grid 1 , 1, worldsize, & - 18, 0, & ! #dof (F tensor), ghost boundary width (domain overlap) + 18, 0, & ! #dof (F tensor), ghost boundary width (domain overlap) grid(1),grid(2),localK, & ! local grid da,ierr) ! handle, error CHKERRQ(ierr) - call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) - call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) - call DMDASNESSetFunctionLocal(da,INSERT_VALUES,AL_formResidual,PETSC_NULL_OBJECT,ierr) + call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) ! connect snes to da + call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) ! global solution vector (grid x 9, i.e. every def grad tensor) + call DMDASNESSetFunctionLocal(da,INSERT_VALUES,AL_formResidual,PETSC_NULL_OBJECT,ierr) ! residual vector of same shape as solution vector + CHKERRQ(ierr) + call SNESSetConvergenceTest(snes,AL_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged" CHKERRQ(ierr) - call SNESSetConvergenceTest(snes,AL_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) - CHKERRQ(ierr) - call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) + call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) ! pull it all together with additional cli arguments !-------------------------------------------------------------------------------------------------- ! init fields - call DMDAVecGetArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) ! places pointer xx_psc on PETSc data - F => xx_psc(0:8,:,:,:) - F_lambda => xx_psc(9:17,:,:,:) + call DMDAVecGetArrayF90(da,solution_vec,FandF_lambda,ierr); CHKERRQ(ierr) ! places pointer on PETSc data + F => FandF_lambda( 0: 8,:,:,:) + F_lambda => FandF_lambda( 9:17,:,:,:) + restart: if (restartInc > 1_pInt) then - if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & + if (iand(debug_level(debug_spectral),debug_spectralRestart) /= 0) then write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading values of increment ', restartInc - 1_pInt, ' from file' - flush(6) + 'reading values of increment ', restartInc-1_pInt, ' from file' + flush(6) + endif write(rankStr,'(a1,i0)')'_',worldrank call IO_read_realFile(777,'F'//trim(rankStr),trim(getSolverJobName()),size(F)) - read (777,rec=1) F - close (777) + read (777,rec=1) F; close (777) call IO_read_realFile(777,'F_lastInc'//trim(rankStr),trim(getSolverJobName()),size(F_lastInc)) - read (777,rec=1) F_lastInc - close (777) + read (777,rec=1) F_lastInc; close (777) call IO_read_realFile(777,'F_lambda'//trim(rankStr),trim(getSolverJobName()),size(F_lambda)) - read (777,rec=1) F_lambda - close (777) - call IO_read_realFile(777,'F_lambda_lastInc'//trim(rankStr),& - trim(getSolverJobName()),size(F_lambda_lastInc)) - read (777,rec=1) F_lambda_lastInc - close (777) - call IO_read_realFile(777,'F_aim', trim(getSolverJobName()),size(F_aim)) - read (777,rec=1) F_aim - close (777) - call IO_read_realFile(777,'F_aim_lastInc', trim(getSolverJobName()),size(F_aim_lastInc)) - read (777,rec=1) F_aim_lastInc - close (777) - call IO_read_realFile(777,'F_aimDot',trim(getSolverJobName()),size(f_aimDot)) - read (777,rec=1) f_aimDot - close (777) + read (777,rec=1) F_lambda; close (777) + call IO_read_realFile(777,'F_lambda_lastInc'//trim(rankStr),trim(getSolverJobName()),size(F_lambda_lastInc)) + read (777,rec=1) F_lambda_lastInc; close (777) + call IO_read_realFile(777,'F_aimDot',trim(getSolverJobName()),size(F_aimDot)) + read (777,rec=1) F_aimDot; close (777) + F_aim = reshape(sum(sum(sum(F,dim=4),dim=3),dim=2) * wgt, [3,3]) ! average of F + F_aim_lastInc = sum(sum(sum(F_lastInc,dim=5),dim=4),dim=3) * wgt ! average of F_lastInc elseif (restartInc == 1_pInt) then restart F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity F = reshape(F_lastInc,[9,grid(1),grid(2),grid3]) @@ -212,30 +214,30 @@ subroutine AL_init F_lambda_lastInc = F_lastInc endif restart + materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent call Utilities_updateIPcoords(reshape(F,shape(F_lastInc))) - call Utilities_constitutiveResponse(F_lastInc, reshape(F,shape(F_lastInc)), & - 0.0_pReal,P,C_volAvg,C_minMaxAvg,temp33_Real,.false.,math_I3) + call Utilities_constitutiveResponse(P,temp33_Real,C_volAvg,C_minMaxAvg, & ! stress field, stress avg, global average of stiffness and (min+max)/2 + reshape(F,shape(F_lastInc)), & ! target F + 0.0_pReal, & ! time increment + math_I3) ! no rotation of boundary condition nullify(F) nullify(F_lambda) - call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) ! write data back to PETSc + call DMDAVecRestoreArrayF90(da,solution_vec,FandF_lambda,ierr); CHKERRQ(ierr) ! write data back to PETSc restartRead: if (restartInc > 1_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading more values of increment', restartInc - 1_pInt, 'from file' + 'reading more values of increment ', restartInc-1_pInt, ' from file' flush(6) call IO_read_realFile(777,'C_volAvg',trim(getSolverJobName()),size(C_volAvg)) - read (777,rec=1) C_volAvg - close (777) + read (777,rec=1) C_volAvg; close (777) call IO_read_realFile(777,'C_volAvgLastInc',trim(getSolverJobName()),size(C_volAvgLastInc)) - read (777,rec=1) C_volAvgLastInc - close (777) + read (777,rec=1) C_volAvgLastInc; close (777) call IO_read_realFile(777,'C_ref',trim(getSolverJobName()),size(C_minMaxAvg)) - read (777,rec=1) C_minMaxAvg - close (777) + read (777,rec=1) C_minMaxAvg; close (777) endif restartRead - call Utilities_updateGamma(C_minMaxAvg,.True.) + call Utilities_updateGamma(C_minMaxAvg,.true.) C_scale = C_minMaxAvg S_scale = math_invSym3333(C_minMaxAvg) @@ -245,8 +247,7 @@ end subroutine AL_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the AL scheme with internal iterations !-------------------------------------------------------------------------------------------------- -type(tSolutionState) function & - AL_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) +type(tSolutionState) function AL_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) use IO, only: & IO_error use numerics, only: & @@ -265,13 +266,13 @@ type(tSolutionState) function & !-------------------------------------------------------------------------------------------------- ! input data for solution - real(pReal), intent(in) :: & - timeinc, & !< increment in time for current solution - timeinc_old !< increment in time of last increment - type(tBoundaryCondition), intent(in) :: & - stress_BC character(len=*), intent(in) :: & incInfoIn + real(pReal), intent(in) :: & + timeinc, & !< increment time for current solution + timeinc_old !< increment time of last successful increment + type(tBoundaryCondition), intent(in) :: & + stress_BC real(pReal), dimension(3,3), intent(in) :: rotation_BC !-------------------------------------------------------------------------------------------------- @@ -304,18 +305,17 @@ type(tSolutionState) function & !-------------------------------------------------------------------------------------------------- ! solve BVP - call SNESSolve(snes,PETSC_NULL_OBJECT,solution_vec,ierr) - CHKERRQ(ierr) + call SNESSolve(snes,PETSC_NULL_OBJECT,solution_vec,ierr); CHKERRQ(ierr) !-------------------------------------------------------------------------------------------------- ! check convergence - call SNESGetConvergedReason(snes,reason,ierr) - CHKERRQ(ierr) + call SNESGetConvergedReason(snes,reason,ierr); CHKERRQ(ierr) + + AL_solution%converged = reason > 0 + AL_solution%iterationsNeeded = totalIter AL_solution%termIll = terminallyIll terminallyIll = .false. - if (reason == -4) call IO_error(893_pInt) - if (reason < 1) AL_solution%converged = .false. - AL_solution%iterationsNeeded = totalIter + if (reason == -4) call IO_error(893_pInt) ! MPI error end function AL_solution @@ -330,8 +330,8 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) polarAlpha, & polarBeta use mesh, only: & - grid3, & - grid + grid, & + grid3 use IO, only: & IO_intOut use math, only: & @@ -340,6 +340,10 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) math_mul3333xx33, & math_invSym3333, & math_mul33x33 + use debug, only: & + debug_level, & + debug_spectral, & + debug_spectralRotation use spectral_utilities, only: & wgt, & tensorField_real, & @@ -349,27 +353,17 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) Utilities_constitutiveResponse, & Utilities_divergenceRMS, & Utilities_curlRMS - use debug, only: & - debug_level, & - debug_spectral, & - debug_spectralRotation use homogenization, only: & materialpoint_dPdF use FEsolving, only: & terminallyIll implicit none -!-------------------------------------------------------------------------------------------------- -! strange syntax in the next line because otherwise macros expand beyond 132 character limit - DMDALocalInfo, dimension(& - DMDA_LOCAL_INFO_SIZE) :: & - in - PetscScalar, target, dimension(3,3,2, & - XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & - x_scal - PetscScalar, target, dimension(3,3,2, & - X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & - f_scal + DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: in + PetscScalar, & + target, dimension(3,3,2, XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: x_scal !< what is this? + PetscScalar, & + target, dimension(3,3,2, X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: f_scal !< what is this? PetscScalar, pointer, dimension(:,:,:,:,:) :: & F, & F_lambda, & @@ -387,33 +381,33 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) SNESGetNumberFunctionEvals, & SNESGetIterationNumber - F => x_scal(1:3,1:3,1,& - XG_RANGE,YG_RANGE,ZG_RANGE) - F_lambda => x_scal(1:3,1:3,2,& - XG_RANGE,YG_RANGE,ZG_RANGE) - residual_F => f_scal(1:3,1:3,1,& - X_RANGE,Y_RANGE,Z_RANGE) + F => x_scal(1:3,1:3,1,& + XG_RANGE,YG_RANGE,ZG_RANGE) + F_lambda => x_scal(1:3,1:3,2,& + XG_RANGE,YG_RANGE,ZG_RANGE) + residual_F => f_scal(1:3,1:3,1,& + X_RANGE, Y_RANGE, Z_RANGE) residual_F_lambda => f_scal(1:3,1:3,2,& - X_RANGE,Y_RANGE,Z_RANGE) - - call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr) - call SNESGetIterationNumber(snes,PETScIter,ierr); CHKERRQ(ierr) + X_RANGE, Y_RANGE, Z_RANGE) F_av = sum(sum(sum(F,dim=5),dim=4),dim=3) * wgt call MPI_Allreduce(MPI_IN_PLACE,F_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - if(nfuncs== 0 .and. PETScIter == 0) totalIter = -1_pInt ! new increment - newIteration: if(totalIter <= PETScIter) then + call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr) + call SNESGetIterationNumber(snes,PETScIter,ierr); CHKERRQ(ierr) + + if (nfuncs == 0 .and. PETScIter == 0) totalIter = -1_pInt ! new increment !-------------------------------------------------------------------------------------------------- -! report begin of new iteration +! begin of new iteration + newIteration: if (totalIter <= PETScIter) then totalIter = totalIter + 1_pInt - write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & - ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax + write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') & + trim(incInfo), ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & - math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & - math_transpose33(F_aim) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & + ' deformation gradient aim (lab) =', math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & + ' deformation gradient aim =', math_transpose33(F_aim) flush(6) endif newIteration @@ -425,7 +419,6 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) polarBeta*math_mul3333xx33(C_scale,F(1:3,1:3,i,j,k) - math_I3) -& polarAlpha*math_mul33x33(F(1:3,1:3,i,j,k), & math_mul3333xx33(C_scale,F_lambda(1:3,1:3,i,j,k) - math_I3)) - enddo; enddo; enddo !-------------------------------------------------------------------------------------------------- @@ -435,24 +428,23 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) call utilities_FFTtensorBackward() !-------------------------------------------------------------------------------------------------- -! constructing residual - residual_F_lambda = polarBeta*F - tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) +! constructing F_lambda residual + residual_F_lambda = polarBeta*F - tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) !< eq (16) in doi: 10.1016/j.ijplas.2014.02.006 !-------------------------------------------------------------------------------------------------- ! evaluate constitutive response P_avLastEval = P_av - call Utilities_constitutiveResponse(F_lastInc,F - residual_F_lambda/polarBeta,params%timeinc, & - residual_F,C_volAvg,C_minMaxAvg,P_av,ForwardData,params%rotation_BC) + + call Utilities_constitutiveResponse(residual_F,P_av,C_volAvg,C_minMaxAvg, & + F - residual_F_lambda/polarBeta,params%timeinc, params%rotation_BC) call MPI_Allreduce(MPI_IN_PLACE,terminallyIll,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr) - ForwardData = .False. !-------------------------------------------------------------------------------------------------- ! calculate divergence tensorField_real = 0.0_pReal - tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = residual_F + tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = residual_F !< stress field in disguise call utilities_FFTtensorForward() - err_div = Utilities_divergenceRMS() - call utilities_FFTtensorBackward() + err_div = Utilities_divergenceRMS() !< root mean squared error in divergence of stress !-------------------------------------------------------------------------------------------------- ! constructing residual @@ -463,7 +455,7 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) residual_F(1:3,1:3,i,j,k) - & math_mul33x33(F(1:3,1:3,i,j,k), & math_mul3333xx33(C_scale,F_lambda(1:3,1:3,i,j,k) - math_I3))) & - + residual_F_lambda(1:3,1:3,i,j,k) + + residual_F_lambda(1:3,1:3,i,j,k) !< eq (16) in doi: 10.1016/j.ijplas.2014.02.006 enddo; enddo; enddo !-------------------------------------------------------------------------------------------------- @@ -472,8 +464,11 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = F call utilities_FFTtensorForward() err_curl = Utilities_curlRMS() - call utilities_FFTtensorBackward() - + + nullify(F) + nullify(F_lambda) + nullify(residual_F) + nullify(residual_F_lambda) end subroutine AL_formResidual @@ -488,8 +483,8 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr err_div_tolAbs, & err_curl_tolRel, & err_curl_tolAbs, & - err_stress_tolAbs, & - err_stress_tolRel + err_stress_tolRel, & + err_stress_tolAbs use math, only: & math_mul3333xx33 use FEsolving, only: & @@ -508,24 +503,24 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr real(pReal) :: & curlTol, & divTol, & - BC_tol + BCTol !-------------------------------------------------------------------------------------------------- ! stress BC handling F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%stress_BC))) ! S = 0.0 for no bc - err_BC = maxval(abs((-mask_stress+1.0_pReal)*math_mul3333xx33(C_scale,F_aim-F_av) + & - mask_stress *(P_av - params%stress_BC))) ! mask = 0.0 for no bc + err_BC = maxval(abs((1.0_pReal-mask_stress) * math_mul3333xx33(C_scale,F_aim-F_av) + & + mask_stress * (P_av-params%stress_BC))) ! mask = 0.0 for no bc !-------------------------------------------------------------------------------------------------- ! error calculation - curlTol = max(maxval(abs(F_aim-math_I3))*err_curl_tolRel,err_curl_tolAbs) - divTol = max(maxval(abs(P_av)) *err_div_tolRel,err_div_tolAbs) - BC_tol = max(maxval(abs(P_av)) *err_stress_tolrel,err_stress_tolabs) + curlTol = max(maxval(abs(F_aim-math_I3))*err_curl_tolRel ,err_curl_tolAbs) + divTol = max(maxval(abs(P_av)) *err_div_tolRel ,err_div_tolAbs) + BCTol = max(maxval(abs(P_av)) *err_stress_tolRel,err_stress_tolAbs) converged: if ((totalIter >= itmin .and. & - all([ err_div/divTol, & + all([ err_div /divTol, & err_curl/curlTol, & - err_BC/BC_tol ] < 1.0_pReal)) & + err_BC /BCTol ] < 1.0_pReal)) & .or. terminallyIll) then reason = 1 elseif (totalIter >= itmax) then converged @@ -537,12 +532,12 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr !-------------------------------------------------------------------------------------------------- ! report write(6,'(1/,a)') ' ... reporting .............................................................' - write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', & - err_curl/curlTol,' (',err_curl,' -, tol =',curlTol,')' - write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & - err_div/divTol, ' (',err_div, ' / m, tol =',divTol,')' - write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error BC = ', & - err_BC/BC_tol, ' (',err_BC, ' Pa, tol =',BC_tol,')' + write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & + err_div/divTol, ' (',err_div, ' / m, tol = ',divTol,')' + write(6, '(a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', & + err_curl/curlTol,' (',err_curl,' -, tol = ',curlTol,')' + write(6, '(a,f12.2,a,es8.2,a,es9.2,a)') ' error BC = ', & + err_BC/BCTol, ' (',err_BC, ' Pa, tol = ',BCTol,')' write(6,'(/,a)') ' ===========================================================================' flush(6) @@ -550,130 +545,142 @@ end subroutine AL_converged !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine +!> @details find new boundary conditions and best F estimate for end of current timestep +!> possibly writing restart information, triggering of state increment in DAMASK, and updating of IPcoordinates !-------------------------------------------------------------------------------------------------- subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stress_BC,rotation_BC) - use math, only: & - math_mul33x33, & - math_mul3333xx33, & - math_transpose33, & - math_rotate_backward33 - use numerics, only: & - worldrank - use mesh, only: & - grid3, & - grid - use spectral_utilities, only: & - Utilities_calculateRate, & - Utilities_forwardField, & - Utilities_updateIPcoords, & - tBoundaryCondition, & - cutBack - use IO, only: & - IO_write_JobRealFile - use FEsolving, only: & - restartWrite + use math, only: & + math_mul33x33, & + math_mul3333xx33, & + math_transpose33, & + math_rotate_backward33 + use numerics, only: & + worldrank + use homogenization, only: & + materialpoint_F0 + use mesh, only: & + grid, & + grid3 + use CPFEM2, only: & + CPFEM_age + use spectral_utilities, only: & + Utilities_calculateRate, & + Utilities_forwardField, & + Utilities_updateIPcoords, & + tBoundaryCondition, & + cutBack + use IO, only: & + IO_write_JobRealFile + use FEsolving, only: & + restartWrite - implicit none - real(pReal), intent(in) :: & - timeinc_old, & - timeinc, & - loadCaseTime !< remaining time of current load case - type(tBoundaryCondition), intent(in) :: & - stress_BC, & - deformation_BC - real(pReal), dimension(3,3), intent(in) :: rotation_BC - logical, intent(in) :: & - guess - PetscErrorCode :: ierr - PetscScalar, dimension(:,:,:,:), pointer :: xx_psc, F, F_lambda - integer(pInt) :: i, j, k - real(pReal), dimension(3,3) :: F_lambda33 - character(len=1024) :: rankStr + implicit none + logical, intent(in) :: & + guess + real(pReal), intent(in) :: & + timeinc_old, & + timeinc, & + loadCaseTime !< remaining time of current load case + type(tBoundaryCondition), intent(in) :: & + stress_BC, & + deformation_BC + real(pReal), dimension(3,3), intent(in) ::& + rotation_BC + PetscErrorCode :: ierr + PetscScalar, dimension(:,:,:,:), pointer :: FandF_lambda, F, F_lambda + integer(pInt) :: i, j, k + real(pReal), dimension(3,3) :: F_lambda33 + character(len=32) :: rankStr !-------------------------------------------------------------------------------------------------- ! update coordinates and rate and forward last inc - call DMDAVecGetArrayF90(da,solution_vec,xx_psc,ierr) - F => xx_psc(0:8,:,:,:) - F_lambda => xx_psc(9:17,:,:,:) - if (restartWrite) then - write(6,'(/,a)') ' writing converged results for restart' - flush(6) - write(rankStr,'(a1,i0)')'_',worldrank - call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file - write (777,rec=1) F - close (777) - call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file - write (777,rec=1) F_lastInc - close (777) - call IO_write_jobRealFile(777,'F_lambda'//trim(rankStr),size(F_lambda)) ! writing deformation gradient field to file - write (777,rec=1) F_lambda - close (777) - call IO_write_jobRealFile(777,'F_lambda_lastInc'//trim(rankStr),size(F_lambda_lastInc)) ! writing F_lastInc field to file - write (777,rec=1) F_lambda_lastInc - close (777) - if (worldrank == 0_pInt) then - call IO_write_jobRealFile(777,'F_aim',size(F_aim)) - write (777,rec=1) F_aim - close(777) - call IO_write_jobRealFile(777,'F_aim_lastInc',size(F_aim_lastInc)) - write (777,rec=1) F_aim_lastInc - close(777) - call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot)) - write (777,rec=1) F_aimDot - close(777) - call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg)) - write (777,rec=1) C_volAvg - close(777) - call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc)) - write (777,rec=1) C_volAvgLastInc - close(777) - endif - endif + call DMDAVecGetArrayF90(da,solution_vec,FandF_lambda,ierr); CHKERRQ(ierr) + F => FandF_lambda( 0: 8,:,:,:) + F_lambda => FandF_lambda( 9:17,:,:,:) - call utilities_updateIPcoords(F) + if (cutBack) then + C_volAvg = C_volAvgLastInc ! QUESTION: where is this required? + C_minMaxAvg = C_minMaxAvgLastInc ! QUESTION: where is this required? + else + !-------------------------------------------------------------------------------------------------- + ! restart information for spectral solver + if (restartWrite) then ! QUESTION: where is this logical properly set? + write(6,'(/,a)') ' writing converged results for restart' + flush(6) - if (cutBack) then - F_aim = F_aim_lastInc - F_lambda = reshape(F_lambda_lastInc,[9,grid(1),grid(2),grid3]) - F = reshape(F_lastInc, [9,grid(1),grid(2),grid3]) - C_volAvg = C_volAvgLastInc - else - ForwardData = .True. - C_volAvgLastInc = C_volAvg -!-------------------------------------------------------------------------------------------------- -! calculate rate for aim - if (deformation_BC%myType=='l') then ! calculate f_aimDot from given L and current F - f_aimDot = deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim) - elseif(deformation_BC%myType=='fdot') then ! f_aimDot is prescribed - f_aimDot = deformation_BC%maskFloat * deformation_BC%values - elseif(deformation_BC%myType=='f') then ! aim at end of load case is prescribed - f_aimDot = deformation_BC%maskFloat * (deformation_BC%values -F_aim)/loadCaseTime - endif - if (guess) f_aimDot = f_aimDot + stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old - F_aim_lastInc = F_aim + if (worldrank == 0_pInt) then + call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg)) + write (777,rec=1) C_volAvg; close(777) + call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc)) + write (777,rec=1) C_volAvgLastInc; close(777) + ! call IO_write_jobRealFile(777,'C_minMaxAvg',size(C_volAvg)) + ! write (777,rec=1) C_minMaxAvg; close(777) + ! call IO_write_jobRealFile(777,'C_minMaxAvgLastInc',size(C_volAvgLastInc)) + ! write (777,rec=1) C_minMaxAvgLastInc; close(777) + call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot)) + write (777,rec=1) F_aimDot; close(777) + endif + + write(rankStr,'(a1,i0)')'_',worldrank + call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file + write (777,rec=1) F; close (777) + call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file + write (777,rec=1) F_lastInc; close (777) + call IO_write_jobRealFile(777,'F_lambda'//trim(rankStr),size(F_lambda)) ! writing deformation gradient field to file + write (777,rec=1) F_lambda; close (777) + call IO_write_jobRealFile(777,'F_lambda_lastInc'//trim(rankStr),size(F_lambda_lastInc)) ! writing F_lastInc field to file + write (777,rec=1) F_lambda_lastInc; close (777) + endif + + call CPFEM_age() ! age state and kinematics + call utilities_updateIPcoords(F) + + C_volAvgLastInc = C_volAvg + C_minMaxAvgLastInc = C_minMaxAvg + + if (guess) then ! QUESTION: better with a = L ? x:y + F_aimDot = stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old ! initialize with correction based on last inc + else + F_aimDot = 0.0_pReal + endif + F_aim_lastInc = F_aim + !-------------------------------------------------------------------------------------------------- + ! calculate rate for aim + if (deformation_BC%myType=='l') then ! calculate F_aimDot from given L and current F + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim_lastInc) + elseif(deformation_BC%myType=='fdot') then ! F_aimDot is prescribed + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * deformation_BC%values + elseif (deformation_BC%myType=='f') then ! aim at end of load case is prescribed + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * (deformation_BC%values - F_aim_lastInc)/loadCaseTime + endif + + + Fdot = Utilities_calculateRate(guess, & + F_lastInc,reshape(F,[3,3,grid(1),grid(2),grid3]),timeinc_old, & + math_rotate_backward33(F_aimDot,rotation_BC)) + F_lambdaDot = Utilities_calculateRate(guess, & + F_lambda_lastInc,reshape(F_lambda,[3,3,grid(1),grid(2),grid3]), timeinc_old, & + math_rotate_backward33(F_aimDot,rotation_BC)) + F_lastInc = reshape(F, [3,3,grid(1),grid(2),grid3]) ! winding F forward + F_lambda_lastInc = reshape(F_lambda, [3,3,grid(1),grid(2),grid3]) ! winding F_lambda forward + materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent + endif !-------------------------------------------------------------------------------------------------- -! update coordinates and rate and forward last inc - call utilities_updateIPcoords(F) - Fdot = Utilities_calculateRate(math_rotate_backward33(f_aimDot,rotation_BC), & - timeinc_old,guess,F_lastInc,reshape(F,[3,3,grid(1),grid(2),grid3])) - F_lambdaDot = Utilities_calculateRate(math_rotate_backward33(f_aimDot,rotation_BC), & - timeinc_old,guess,F_lambda_lastInc,reshape(F_lambda,[3,3,grid(1),grid(2),grid3])) - F_lastInc = reshape(F, [3,3,grid(1),grid(2),grid3]) - F_lambda_lastInc = reshape(F_lambda,[3,3,grid(1),grid(2),grid3]) - endif +! update average and local deformation gradients + F_aim = F_aim_lastInc + F_aimDot * timeinc - F_aim = F_aim + f_aimDot * timeinc - -!-------------------------------------------------------------------------------------------------- -! update local deformation gradient - F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! ensure that it matches rotated F_aim - math_rotate_backward33(F_aim,rotation_BC)), & - [9,grid(1),grid(2),grid3]) - F_lambda = reshape(Utilities_forwardField(timeinc,F_lambda_lastInc,F_lambdadot), & - [9,grid(1),grid(2),grid3]) ! does not have any average value as boundary condition - if (.not. guess) then ! large strain forwarding - do k = 1_pInt, grid3; do j = 1_pInt, grid(2); do i = 1_pInt, grid(1) + F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! estimate of F at end of time+timeinc that matches rotated F_aim on average + math_rotate_backward33(F_aim,rotation_BC)),& + [9,grid(1),grid(2),grid3]) + if (guess) then + F_lambda = reshape(Utilities_forwardField(timeinc,F_lambda_lastInc,F_lambdadot), & + [9,grid(1),grid(2),grid3]) ! does not have any average value as boundary condition + else + do k = 1_pInt, grid3; do j = 1_pInt, grid(2); do i = 1_pInt, grid(1) F_lambda33 = reshape(F_lambda(1:9,i,j,k),[3,3]) F_lambda33 = math_mul3333xx33(S_scale,math_mul33x33(F_lambda33, & math_mul3333xx33(C_scale,& @@ -681,9 +688,12 @@ subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stre F_lambda33) -math_I3))*0.5_pReal)& + math_I3 F_lambda(1:9,i,j,k) = reshape(F_lambda33,[9]) - enddo; enddo; enddo - endif - call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) + enddo; enddo; enddo + endif + + nullify(F) + nullify(F_lambda) + call DMDAVecRestoreArrayF90(da,solution_vec,FandF_lambda,ierr); CHKERRQ(ierr) end subroutine AL_forward diff --git a/src/spectral_mech_Basic.f90 b/src/spectral_mech_Basic.f90 index 00502b6b5..44e043575 100644 --- a/src/spectral_mech_Basic.f90 +++ b/src/spectral_mech_Basic.f90 @@ -38,21 +38,27 @@ module spectral_mech_basic !-------------------------------------------------------------------------------------------------- ! stress, stiffness and compliance average etc. real(pReal), private, dimension(3,3) :: & - F_aim = math_I3, & - F_aim_lastIter = math_I3, & - F_aim_lastInc = math_I3, & - P_av = 0.0_pReal, & - F_aimDot=0.0_pReal - character(len=1024), private :: incInfo + F_aimDot = 0.0_pReal, & !< assumed rate of average deformation gradient + F_aim = math_I3, & !< current prescribed deformation gradient + F_aim_lastInc = math_I3, & !< previous average deformation gradient + P_av = 0.0_pReal !< average 1st Piola--Kirchhoff stress + + character(len=1024), private :: incInfo !< time and increment information + real(pReal), private, dimension(3,3,3,3) :: & C_volAvg = 0.0_pReal, & !< current volume average stiffness C_volAvgLastInc = 0.0_pReal, & !< previous volume average stiffness C_minMaxAvg = 0.0_pReal, & !< current (min+max)/2 stiffness - S = 0.0_pReal !< current compliance (filled up with zeros) - real(pReal), private :: err_stress, err_div - logical, private :: ForwardData + C_minMaxAvgLastInc = 0.0_pReal, & !< previous (min+max)/2 stiffness + S = 0.0_pReal !< current compliance (filled up with zeros) + + real(pReal), private :: & + err_BC, & !< deviation from stress BC + err_div !< RMS of div of P + integer(pInt), private :: & totalIter = 0_pInt !< total iteration in current increment + real(pReal), private, dimension(3,3) :: mask_stress = 0.0_pReal public :: & @@ -69,7 +75,7 @@ module spectral_mech_basic contains !-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields and fills them with data, potentially from restart info +!> @brief allocates all necessary fields and fills them with data, potentially from restart info !-------------------------------------------------------------------------------------------------- subroutine basicPETSc_init #if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 @@ -90,6 +96,8 @@ subroutine basicPETSc_init use numerics, only: & worldrank, & worldsize + use homogenization, only: & + materialpoint_F0 use DAMASK_interface, only: & getSolverJobName use spectral_utilities, only: & @@ -132,8 +140,8 @@ subroutine basicPETSc_init !-------------------------------------------------------------------------------------------------- ! allocate global fields - allocate (F_lastInc (3,3,grid(1),grid(2),grid3),source = 0.0_pReal) - allocate (Fdot (3,3,grid(1),grid(2),grid3),source = 0.0_pReal) + allocate (F_lastInc (3,3,grid(1),grid(2),grid3),source = 0.0_pReal) + allocate (Fdot (3,3,grid(1),grid(2),grid3),source = 0.0_pReal) !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc @@ -152,11 +160,10 @@ subroutine basicPETSc_init grid(1),grid(2),localK, & ! local grid da,ierr) ! handle, error CHKERRQ(ierr) - call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) + call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) ! connect snes to da call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) ! global solution vector (grid x 9, i.e. every def grad tensor) call DMDASNESSetFunctionLocal(da,INSERT_VALUES,BasicPETSC_formResidual,PETSC_NULL_OBJECT,ierr) ! residual vector of same shape as solution vector CHKERRQ(ierr) - call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) ! connect snes to da call SNESSetConvergenceTest(snes,BasicPETSC_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged" CHKERRQ(ierr) call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) ! pull it all together with additional cli arguments @@ -166,62 +173,55 @@ subroutine basicPETSc_init call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! get the data out of PETSc to work with restart: if (restartInc > 1_pInt) then - if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0) & + if (iand(debug_level(debug_spectral),debug_spectralRestart) /= 0) then write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading values of increment ', restartInc - 1_pInt, ' from file' - flush(6) + 'reading values of increment ', restartInc-1_pInt, ' from file' + flush(6) + endif write(rankStr,'(a1,i0)')'_',worldrank call IO_read_realFile(777,'F'//trim(rankStr),trim(getSolverJobName()),size(F)) - read (777,rec=1) F - close (777) + read (777,rec=1) F; close (777) call IO_read_realFile(777,'F_lastInc'//trim(rankStr),trim(getSolverJobName()),size(F_lastInc)) - read (777,rec=1) F_lastInc - close (777) - call IO_read_realFile(777,'F_aimDot',trim(getSolverJobName()),size(f_aimDot)) - read (777,rec=1) f_aimDot - close (777) + read (777,rec=1) F_lastInc; close (777) + call IO_read_realFile(777,'F_aimDot',trim(getSolverJobName()),size(F_aimDot)) + read (777,rec=1) F_aimDot; close (777) F_aim = reshape(sum(sum(sum(F,dim=4),dim=3),dim=2) * wgt, [3,3]) ! average of F F_aim_lastInc = sum(sum(sum(F_lastInc,dim=5),dim=4),dim=3) * wgt ! average of F_lastInc - elseif (restartInc == 1_pInt) then restart + elseif (restartInc == 1_pInt) then restart F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity F = reshape(F_lastInc,[9,grid(1),grid(2),grid3]) endif restart + materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent call Utilities_updateIPcoords(reshape(F,shape(F_lastInc))) - call Utilities_constitutiveResponse(F_lastInc, reshape(F,shape(F_lastInc)), & - 0.0_pReal, & - P, & - C_volAvg,C_minMaxAvg, & ! global average of stiffness and (min+max)/2 - temp33_Real, & - .false., & - math_I3) + call Utilities_constitutiveResponse(P,temp33_Real,C_volAvg,C_minMaxAvg, & ! stress field, stress avg, global average of stiffness and (min+max)/2 + reshape(F,shape(F_lastInc)), & ! target F + 0.0_pReal, & ! time increment + math_I3) ! no rotation of boundary condition call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! write data back to PETSc + ! QUESTION: why not writing back right after reading (l.189)? - restartRead: if (restartInc > 1_pInt) then + restartRead: if (restartInc > 1_pInt) then ! QUESTION: are those values not calc'ed by constitutiveResponse? why reading from file? if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading more values of increment', restartInc - 1_pInt, 'from file' + 'reading more values of increment ', restartInc-1_pInt, ' from file' flush(6) call IO_read_realFile(777,'C_volAvg',trim(getSolverJobName()),size(C_volAvg)) - read (777,rec=1) C_volAvg - close (777) + read (777,rec=1) C_volAvg; close (777) call IO_read_realFile(777,'C_volAvgLastInc',trim(getSolverJobName()),size(C_volAvgLastInc)) - read (777,rec=1) C_volAvgLastInc - close (777) + read (777,rec=1) C_volAvgLastInc; close (777) call IO_read_realFile(777,'C_ref',trim(getSolverJobName()),size(C_minMaxAvg)) - read (777,rec=1) C_minMaxAvg - close (777) + read (777,rec=1) C_minMaxAvg; close (777) endif restartRead - - call Utilities_updateGamma(C_minmaxAvg,.True.) + + call Utilities_updateGamma(C_minMaxAvg,.true.) end subroutine basicPETSc_init - + !-------------------------------------------------------------------------------------------------- !> @brief solution for the Basic PETSC scheme with internal iterations !-------------------------------------------------------------------------------------------------- -type(tSolutionState) function & - basicPETSc_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) +type(tSolutionState) function basicPETSc_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) use IO, only: & IO_error use numerics, only: & @@ -238,13 +238,13 @@ type(tSolutionState) function & !-------------------------------------------------------------------------------------------------- ! input data for solution - real(pReal), intent(in) :: & - timeinc, & !< increment in time for current solution - timeinc_old !< increment in time of last increment - type(tBoundaryCondition), intent(in) :: & - stress_BC character(len=*), intent(in) :: & incInfoIn + real(pReal), intent(in) :: & + timeinc, & !< increment time for current solution + timeinc_old !< increment time of last successful increment + type(tBoundaryCondition), intent(in) :: & + stress_BC real(pReal), dimension(3,3), intent(in) :: rotation_BC !-------------------------------------------------------------------------------------------------- @@ -261,7 +261,7 @@ type(tSolutionState) function & !-------------------------------------------------------------------------------------------------- ! update stiffness (and gamma operator) S = Utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg) - if (update_gamma) call Utilities_updateGamma(C_minmaxAvg,restartWrite) + if (update_gamma) call Utilities_updateGamma(C_minMaxAvg,restartWrite) !-------------------------------------------------------------------------------------------------- @@ -274,19 +274,17 @@ type(tSolutionState) function & !-------------------------------------------------------------------------------------------------- ! solve BVP - call SNESSolve(snes,PETSC_NULL_OBJECT,solution_vec,ierr) - CHKERRQ(ierr) + call SNESSolve(snes,PETSC_NULL_OBJECT,solution_vec,ierr); CHKERRQ(ierr) !-------------------------------------------------------------------------------------------------- ! check convergence - call SNESGetConvergedReason(snes,reason,ierr) - CHKERRQ(ierr) + call SNESGetConvergedReason(snes,reason,ierr); CHKERRQ(ierr) + + BasicPETSc_solution%converged = reason > 0 + basicPETSC_solution%iterationsNeeded = totalIter basicPETSc_solution%termIll = terminallyIll terminallyIll = .false. - BasicPETSc_solution%converged =.true. - if (reason == -4) call IO_error(893_pInt) - if (reason < 1) basicPETSC_solution%converged = .false. - basicPETSC_solution%iterationsNeeded = totalIter + if (reason == -4) call IO_error(893_pInt) ! MPI error end function BasicPETSc_solution @@ -322,19 +320,18 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) terminallyIll implicit none - DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: & - in - PetscScalar, dimension(3,3, & - XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & - x_scal - PetscScalar, dimension(3,3, & - X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & - f_scal + DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: in + PetscScalar, & + dimension(3,3, XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: x_scal !< what is this? + PetscScalar, & + dimension(3,3, X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: f_scal !< what is this? PetscInt :: & PETScIter, & nfuncs PetscObject :: dummy PetscErrorCode :: ierr + real(pReal), dimension(3,3) :: & + deltaF_aim external :: & SNESGetNumberFunctionEvals, & @@ -343,46 +340,45 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr) call SNESGetIterationNumber(snes,PETScIter,ierr); CHKERRQ(ierr) - if(nfuncs== 0 .and. PETScIter == 0) totalIter = -1_pInt ! new increment - newIteration: if(totalIter <= PETScIter) then + if (nfuncs == 0 .and. PETScIter == 0) totalIter = -1_pInt ! new increment !-------------------------------------------------------------------------------------------------- -! report begin of new iteration +! begin of new iteration + newIteration: if (totalIter <= PETScIter) then totalIter = totalIter + 1_pInt - write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & - ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax + write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') & + trim(incInfo), ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & - math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & - math_transpose33(F_aim) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & + ' deformation gradient aim (lab) =', math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & + ' deformation gradient aim =', math_transpose33(F_aim) flush(6) endif newIteration !-------------------------------------------------------------------------------------------------- ! evaluate constitutive response - call Utilities_constitutiveResponse(F_lastInc,x_scal,params%timeinc, & - f_scal,C_volAvg,C_minmaxAvg,P_av,ForwardData,params%rotation_BC) + call Utilities_constitutiveResponse(f_scal,P_av,C_volAvg,C_minMaxAvg, & + x_scal,params%timeinc, params%rotation_BC) call MPI_Allreduce(MPI_IN_PLACE,terminallyIll,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr) - ForwardData = .false. !-------------------------------------------------------------------------------------------------- ! stress BC handling - F_aim_lastIter = F_aim - F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%stress_BC))) ! S = 0.0 for no bc - err_stress = maxval(abs(mask_stress * (P_av - params%stress_BC))) ! mask = 0.0 for no bc + deltaF_aim = math_mul3333xx33(S, P_av - params%stress_BC) + F_aim = F_aim - deltaF_aim + err_BC = maxval(abs(mask_stress * (P_av - params%stress_BC))) ! mask = 0.0 when no stress bc !-------------------------------------------------------------------------------------------------- ! updated deformation gradient using fix point algorithm of basic scheme tensorField_real = 0.0_pReal tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = f_scal - call utilities_FFTtensorForward() - err_div = Utilities_divergenceRMS() - call utilities_fourierGammaConvolution(math_rotate_backward33(F_aim_lastIter-F_aim,params%rotation_BC)) - call utilities_FFTtensorBackward() + call utilities_FFTtensorForward() ! FFT forward of global "tensorField_real" + err_div = Utilities_divergenceRMS() ! divRMS of tensorField_fourier + call utilities_fourierGammaConvolution(math_rotate_backward33(deltaF_aim,params%rotation_BC)) ! convolution of Gamma and tensorField_fourier, with arg + call utilities_FFTtensorBackward() ! FFT backward of global tensorField_fourier !-------------------------------------------------------------------------------------------------- ! constructing residual - f_scal = tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) + f_scal = tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) ! Gamma*P gives correction towards div(P) = 0, so needs to be zero, too end subroutine BasicPETSc_formResidual @@ -413,14 +409,14 @@ subroutine BasicPETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,du PetscErrorCode :: ierr real(pReal) :: & divTol, & - stressTol + BCTol - divTol = max(maxval(abs(P_av))*err_div_tolRel,err_div_tolAbs) - stressTol = max(maxval(abs(P_av))*err_stress_tolrel,err_stress_tolabs) + divTol = max(maxval(abs(P_av))*err_div_tolRel ,err_div_tolAbs) + BCTol = max(maxval(abs(P_av))*err_stress_tolRel,err_stress_tolAbs) converged: if ((totalIter >= itmin .and. & all([ err_div/divTol, & - err_stress/stressTol ] < 1.0_pReal)) & + err_BC /BCTol ] < 1.0_pReal)) & .or. terminallyIll) then reason = 1 elseif (totalIter >= itmax) then converged @@ -433,9 +429,9 @@ subroutine BasicPETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,du ! report write(6,'(1/,a)') ' ... reporting .............................................................' write(6,'(1/,a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & - err_div/divTol, ' (',err_div,' / m, tol =',divTol,')' - write(6,'(a,f12.2,a,es8.2,a,es9.2,a)') ' error stress BC = ', & - err_stress/stressTol, ' (',err_stress, ' Pa, tol =',stressTol,')' + err_div/divTol, ' (',err_div,' / m, tol = ',divTol,')' + write(6,'(a,f12.2,a,es8.2,a,es9.2,a)') ' error stress BC = ', & + err_BC/BCTol, ' (',err_BC, ' Pa, tol = ',BCTol,')' write(6,'(/,a)') ' ===========================================================================' flush(6) @@ -443,106 +439,118 @@ end subroutine BasicPETSc_converged !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine +!> @details find new boundary conditions and best F estimate for end of current timestep +!> possibly writing restart information, triggering of state increment in DAMASK, and updating of IPcoordinates !-------------------------------------------------------------------------------------------------- subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stress_BC,rotation_BC) - use math, only: & - math_mul33x33 ,& - math_rotate_backward33 - use numerics, only: & - worldrank - use mesh, only: & - grid, & - grid3 - use spectral_utilities, only: & - Utilities_calculateRate, & - Utilities_forwardField, & - Utilities_updateIPcoords, & - tBoundaryCondition, & - cutBack - use IO, only: & - IO_write_JobRealFile - use FEsolving, only: & - restartWrite + use math, only: & + math_mul33x33 ,& + math_rotate_backward33 + use numerics, only: & + worldrank + use homogenization, only: & + materialpoint_F0 + use mesh, only: & + grid, & + grid3 + use CPFEM2, only: & + CPFEM_age + use spectral_utilities, only: & + Utilities_calculateRate, & + Utilities_forwardField, & + Utilities_updateIPcoords, & + tBoundaryCondition, & + cutBack + use IO, only: & + IO_write_JobRealFile + use FEsolving, only: & + restartWrite - implicit none - real(pReal), intent(in) :: & - timeinc_old, & - timeinc, & - loadCaseTime !< remaining time of current load case - type(tBoundaryCondition), intent(in) :: & - stress_BC, & - deformation_BC - real(pReal), dimension(3,3), intent(in) :: rotation_BC - logical, intent(in) :: & - guess - PetscErrorCode :: ierr - PetscScalar, pointer :: F(:,:,:,:) + implicit none + logical, intent(in) :: & + guess + real(pReal), intent(in) :: & + timeinc_old, & + timeinc, & + loadCaseTime !< remaining time of current load case + type(tBoundaryCondition), intent(in) :: & + stress_BC, & + deformation_BC + real(pReal), dimension(3,3), intent(in) ::& + rotation_BC + PetscErrorCode :: ierr + PetscScalar, dimension(:,:,:,:), pointer :: F - character(len=1024) :: rankStr + character(len=32) :: rankStr - call DMDAVecGetArrayF90(da,solution_vec,F,ierr) -!-------------------------------------------------------------------------------------------------- -! restart information for spectral solver - if (restartWrite) then - write(6,'(/,a)') ' writing converged results for restart' - flush(6) - write(rankStr,'(a1,i0)')'_',worldrank - call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file - write (777,rec=1) F - close (777) - call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file - write (777,rec=1) F_lastInc - close (777) - if (worldrank == 0_pInt) then - call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot)) - write (777,rec=1) F_aimDot - close(777) - call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg)) - write (777,rec=1) C_volAvg - close(777) - call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc)) - write (777,rec=1) C_volAvgLastInc - close(777) - endif - endif + call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) + + if (cutBack) then + C_volAvg = C_volAvgLastInc ! QUESTION: where is this required? + C_minMaxAvg = C_minMaxAvgLastInc ! QUESTION: where is this required? + else + !-------------------------------------------------------------------------------------------------- + ! restart information for spectral solver + if (restartWrite) then ! QUESTION: where is this logical properly set? + write(6,'(/,a)') ' writing converged results for restart' + flush(6) - call utilities_updateIPcoords(F) + if (worldrank == 0_pInt) then + call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg)) + write (777,rec=1) C_volAvg; close(777) + call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc)) + write (777,rec=1) C_volAvgLastInc; close(777) + call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot)) + write (777,rec=1) F_aimDot; close(777) + endif - if (cutBack) then - F_aim = F_aim_lastInc - F = reshape(F_lastInc, [9,grid(1),grid(2),grid3]) - C_volAvg = C_volAvgLastInc - else - ForwardData = .True. - C_volAvgLastInc = C_volAvg -!-------------------------------------------------------------------------------------------------- -! calculate rate for aim - if (deformation_BC%myType=='l') then ! calculate f_aimDot from given L and current F - f_aimDot = deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim) - elseif(deformation_BC%myType=='fdot') then ! f_aimDot is prescribed - f_aimDot = deformation_BC%maskFloat * deformation_BC%values - elseif(deformation_BC%myType=='f') then ! aim at end of load case is prescribed - f_aimDot = deformation_BC%maskFloat * (deformation_BC%values -F_aim)/loadCaseTime - endif - if (guess) f_aimDot = f_aimDot + stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old - F_aim_lastInc = F_aim + write(rankStr,'(a1,i0)')'_',worldrank + call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file + write (777,rec=1) F; close (777) + call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file + write (777,rec=1) F_lastInc; close (777) + endif + + call CPFEM_age() ! age state and kinematics + call utilities_updateIPcoords(F) + + C_volAvgLastInc = C_volAvg + C_minMaxAvgLastInc = C_minMaxAvg + + if (guess) then ! QUESTION: better with a = L ? x:y + F_aimDot = stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old ! initialize with correction based on last inc + else + F_aimDot = 0.0_pReal + endif ! components of deformation_BC%maskFloat always start out with zero + F_aim_lastInc = F_aim + !-------------------------------------------------------------------------------------------------- + ! calculate rate for aim + if (deformation_BC%myType=='l') then ! calculate F_aimDot from given L and current F + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim_lastInc) + elseif(deformation_BC%myType=='fdot') then ! F_aimDot is prescribed + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * deformation_BC%values + elseif (deformation_BC%myType=='f') then ! aim at end of load case is prescribed + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * (deformation_BC%values - F_aim_lastInc)/loadCaseTime + endif + + + Fdot = Utilities_calculateRate(guess, & + F_lastInc,reshape(F,[3,3,grid(1),grid(2),grid3]),timeinc_old, & + math_rotate_backward33(F_aimDot,rotation_BC)) + F_lastInc = reshape(F, [3,3,grid(1),grid(2),grid3]) ! winding F forward + materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent + endif !-------------------------------------------------------------------------------------------------- -! update coordinates and rate and forward last inc - call utilities_updateIPcoords(F) - Fdot = Utilities_calculateRate(math_rotate_backward33(f_aimDot,rotation_BC), & - timeinc_old,guess,F_lastInc,reshape(F,[3,3,grid(1),grid(2),grid3])) - F_lastInc = reshape(F, [3,3,grid(1),grid(2),grid3]) - endif - - F_aim = F_aim + f_aimDot * timeinc - -!-------------------------------------------------------------------------------------------------- -! update local deformation gradient - F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! ensure that it matches rotated F_aim - math_rotate_backward33(F_aim,rotation_BC)),[9,grid(1),grid(2),grid3]) - call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) - +! update average and local deformation gradients + F_aim = F_aim_lastInc + F_aimDot * timeinc + F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! estimate of F at end of time+timeinc that matches rotated F_aim on average + math_rotate_backward33(F_aim,rotation_BC)),[9,grid(1),grid(2),grid3]) + call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) + end subroutine BasicPETSc_forward !-------------------------------------------------------------------------------------------------- diff --git a/src/spectral_mech_Polarisation.f90 b/src/spectral_mech_Polarisation.f90 index 2d261ff1b..1a89718da 100644 --- a/src/spectral_mech_Polarisation.f90 +++ b/src/spectral_mech_Polarisation.f90 @@ -43,7 +43,7 @@ module spectral_mech_Polarisation !-------------------------------------------------------------------------------------------------- ! stress, stiffness and compliance average etc. real(pReal), private, dimension(3,3) :: & - F_aimDot, & !< assumed rate of average deformation gradient + F_aimDot = 0.0_pReal, & !< assumed rate of average deformation gradient F_aim = math_I3, & !< current prescribed deformation gradient F_aim_lastInc = math_I3, & !< previous average deformation gradient F_av = 0.0_pReal, & !< average incompatible def grad field @@ -54,6 +54,7 @@ module spectral_mech_Polarisation C_volAvg = 0.0_pReal, & !< current volume average stiffness C_volAvgLastInc = 0.0_pReal, & !< previous volume average stiffness C_minMaxAvg = 0.0_pReal, & !< current (min+max)/2 stiffness + C_minMaxAvgLastInc = 0.0_pReal, & !< previous (min+max)/2 stiffness S = 0.0_pReal, & !< current compliance (filled up with zeros) C_scale = 0.0_pReal, & S_scale = 0.0_pReal @@ -62,7 +63,7 @@ module spectral_mech_Polarisation err_BC, & !< deviation from stress BC err_curl, & !< RMS of curl of F err_div !< RMS of div of P - logical, private :: ForwardData + integer(pInt), private :: & totalIter = 0_pInt !< total iteration in current increment @@ -80,7 +81,7 @@ module spectral_mech_Polarisation contains !-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields and fills them with data, potentially from restart info +!> @brief allocates all necessary fields and fills them with data, potentially from restart info !> @todo use sourced allocation, e.g. allocate(Fdot,source = F_lastInc) !-------------------------------------------------------------------------------------------------- subroutine Polarisation_init @@ -102,12 +103,15 @@ subroutine Polarisation_init use numerics, only: & worldrank, & worldsize + use homogenization, only: & + materialpoint_F0 use DAMASK_interface, only: & getSolverJobName use spectral_utilities, only: & Utilities_constitutiveResponse, & Utilities_updateGamma, & - Utilities_updateIPcoords + Utilities_updateIPcoords, & + wgt use mesh, only: & grid, & grid3 @@ -120,7 +124,11 @@ subroutine Polarisation_init temp33_Real = 0.0_pReal PetscErrorCode :: ierr - PetscScalar, pointer, dimension(:,:,:,:) :: xx_psc, F, F_tau + PetscScalar, pointer, dimension(:,:,:,:) :: & + FandF_tau, & ! overall pointer to solution data + F, & ! specific (sub)pointer + F_tau ! specific (sub)pointer + integer(pInt), dimension(:), allocatable :: localK integer(pInt) :: proc character(len=1024) :: rankStr @@ -164,78 +172,69 @@ subroutine Polarisation_init grid(1),grid(2),localK, & ! local grid da,ierr) ! handle, error CHKERRQ(ierr) - call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) - call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) - call DMDASNESSetFunctionLocal(da,INSERT_VALUES,Polarisation_formResidual,PETSC_NULL_OBJECT,ierr) + call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) ! connect snes to da + call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) ! global solution vector (grid x 9, i.e. every def grad tensor) + call DMDASNESSetFunctionLocal(da,INSERT_VALUES,Polarisation_formResidual,PETSC_NULL_OBJECT,ierr) ! residual vector of same shape as solution vector + CHKERRQ(ierr) + call SNESSetConvergenceTest(snes,Polarisation_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged" CHKERRQ(ierr) - call SNESSetConvergenceTest(snes,Polarisation_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) - CHKERRQ(ierr) - call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) + call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) ! pull it all together with additional cli arguments !-------------------------------------------------------------------------------------------------- ! init fields - call DMDAVecGetArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) ! places pointer xx_psc on PETSc data - F => xx_psc(0:8,:,:,:) - F_tau => xx_psc(9:17,:,:,:) - restart: if (restartInc > 1_pInt) then - if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0) & + call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) ! places pointer on PETSc data + F => FandF_tau( 0: 8,:,:,:) + F_tau => FandF_tau( 9:17,:,:,:) + restart: if (restartInc > 1_pInt) then + if (iand(debug_level(debug_spectral),debug_spectralRestart) /= 0) then write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & 'reading values of increment ', restartInc - 1_pInt, ' from file' - flush(6) + flush(6) + endif write(rankStr,'(a1,i0)')'_',worldrank call IO_read_realFile(777,'F'//trim(rankStr),trim(getSolverJobName()),size(F)) - read (777,rec=1) F - close (777) + read (777,rec=1) F; close (777) call IO_read_realFile(777,'F_lastInc'//trim(rankStr),trim(getSolverJobName()),size(F_lastInc)) - read (777,rec=1) F_lastInc - close (777) + read (777,rec=1) F_lastInc; close (777) call IO_read_realFile(777,'F_tau'//trim(rankStr),trim(getSolverJobName()),size(F_tau)) - read (777,rec=1) F_tau - close (777) - call IO_read_realFile(777,'F_tau_lastInc'//trim(rankStr),& - trim(getSolverJobName()),size(F_tau_lastInc)) - read (777,rec=1) F_tau_lastInc - close (777) - call IO_read_realFile(777,'F_aim', trim(getSolverJobName()),size(F_aim)) - read (777,rec=1) F_aim - close (777) - call IO_read_realFile(777,'F_aim_lastInc', trim(getSolverJobName()),size(F_aim_lastInc)) - read (777,rec=1) F_aim_lastInc - close (777) - call IO_read_realFile(777,'F_aimDot',trim(getSolverJobName()),size(f_aimDot)) - read (777,rec=1) f_aimDot - close (777) + read (777,rec=1) F_tau; close (777) + call IO_read_realFile(777,'F_tau_lastInc'//trim(rankStr),trim(getSolverJobName()),size(F_tau_lastInc)) + read (777,rec=1) F_tau_lastInc; close (777) + call IO_read_realFile(777,'F_aimDot',trim(getSolverJobName()),size(F_aimDot)) + read (777,rec=1) F_aimDot; close (777) + F_aim = reshape(sum(sum(sum(F,dim=4),dim=3),dim=2) * wgt, [3,3]) ! average of F + F_aim_lastInc = sum(sum(sum(F_lastInc,dim=5),dim=4),dim=3) * wgt ! average of F_lastInc elseif (restartInc == 1_pInt) then restart - F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity + F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity F = reshape(F_lastInc,[9,grid(1),grid(2),grid3]) - F_tau = 2.0_pReal* F + F_tau = 2.0_pReal*F F_tau_lastInc = 2.0_pReal*F_lastInc endif restart + materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent call Utilities_updateIPcoords(reshape(F,shape(F_lastInc))) - call Utilities_constitutiveResponse(F_lastInc, reshape(F,shape(F_lastInc)), & - 0.0_pReal,P,C_volAvg,C_minMaxAvg,temp33_Real,.false.,math_I3) + call Utilities_constitutiveResponse(P,temp33_Real,C_volAvg,C_minMaxAvg, & ! stress field, stress avg, global average of stiffness and (min+max)/2 + reshape(F,shape(F_lastInc)), & ! target F + 0.0_pReal, & ! time increment + math_I3) ! no rotation of boundary condition nullify(F) nullify(F_tau) - call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) ! write data back to PETSc + call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) ! write data back to PETSc restartRead: if (restartInc > 1_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading more values of increment', restartInc - 1_pInt, 'from file' + 'reading more values of increment ', restartInc-1_pInt, ' from file' flush(6) call IO_read_realFile(777,'C_volAvg',trim(getSolverJobName()),size(C_volAvg)) - read (777,rec=1) C_volAvg - close (777) + read (777,rec=1) C_volAvg; close (777) call IO_read_realFile(777,'C_volAvgLastInc',trim(getSolverJobName()),size(C_volAvgLastInc)) - read (777,rec=1) C_volAvgLastInc - close (777) + read (777,rec=1) C_volAvgLastInc; close (777) call IO_read_realFile(777,'C_ref',trim(getSolverJobName()),size(C_minMaxAvg)) - read (777,rec=1) C_minMaxAvg - close (777) + read (777,rec=1) C_minMaxAvg; close (777) endif restartRead - call Utilities_updateGamma(C_minMaxAvg,.True.) + call Utilities_updateGamma(C_minMaxAvg,.true.) C_scale = C_minMaxAvg S_scale = math_invSym3333(C_minMaxAvg) @@ -245,8 +244,7 @@ end subroutine Polarisation_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the Polarisation scheme with internal iterations !-------------------------------------------------------------------------------------------------- -type(tSolutionState) function & - Polarisation_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) +type(tSolutionState) function Polarisation_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) use IO, only: & IO_error use numerics, only: & @@ -265,13 +263,13 @@ type(tSolutionState) function & !-------------------------------------------------------------------------------------------------- ! input data for solution - real(pReal), intent(in) :: & - timeinc, & !< increment in time for current solution - timeinc_old !< increment in time of last increment - type(tBoundaryCondition), intent(in) :: & - stress_BC character(len=*), intent(in) :: & incInfoIn + real(pReal), intent(in) :: & + timeinc, & !< increment time for current solution + timeinc_old !< increment time of last successful increment + type(tBoundaryCondition), intent(in) :: & + stress_BC real(pReal), dimension(3,3), intent(in) :: rotation_BC !-------------------------------------------------------------------------------------------------- @@ -304,18 +302,17 @@ type(tSolutionState) function & !-------------------------------------------------------------------------------------------------- ! solve BVP - call SNESSolve(snes,PETSC_NULL_OBJECT,solution_vec,ierr) - CHKERRQ(ierr) + call SNESSolve(snes,PETSC_NULL_OBJECT,solution_vec,ierr); CHKERRQ(ierr) !-------------------------------------------------------------------------------------------------- ! check convergence - call SNESGetConvergedReason(snes,reason,ierr) - CHKERRQ(ierr) + call SNESGetConvergedReason(snes,reason,ierr); CHKERRQ(ierr) + + Polarisation_solution%converged = reason > 0 + Polarisation_solution%iterationsNeeded = totalIter Polarisation_solution%termIll = terminallyIll terminallyIll = .false. - if (reason == -4) call IO_error(893_pInt) - if (reason < 1) Polarisation_solution%converged = .false. - Polarisation_solution%iterationsNeeded = totalIter + if (reason == -4) call IO_error(893_pInt) ! MPI error end function Polarisation_solution @@ -330,8 +327,8 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) polarAlpha, & polarBeta use mesh, only: & - grid3, & - grid + grid, & + grid3 use IO, only: & IO_intOut use math, only: & @@ -340,6 +337,10 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) math_mul3333xx33, & math_invSym3333, & math_mul33x33 + use debug, only: & + debug_level, & + debug_spectral, & + debug_spectralRotation use spectral_utilities, only: & wgt, & tensorField_real, & @@ -349,27 +350,17 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) Utilities_constitutiveResponse, & Utilities_divergenceRMS, & Utilities_curlRMS - use debug, only: & - debug_level, & - debug_spectral, & - debug_spectralRotation use homogenization, only: & materialpoint_dPdF use FEsolving, only: & terminallyIll implicit none -!-------------------------------------------------------------------------------------------------- -! strange syntax in the next line because otherwise macros expand beyond 132 character limit - DMDALocalInfo, dimension(& - DMDA_LOCAL_INFO_SIZE) :: & - in - PetscScalar, target, dimension(3,3,2, & - XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & - x_scal - PetscScalar, target, dimension(3,3,2, & - X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & - f_scal + DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: in + PetscScalar, & + target, dimension(3,3,2, XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: x_scal + PetscScalar, & + target, dimension(3,3,2, X_RANGE, Y_RANGE, Z_RANGE), intent(out) :: f_scal PetscScalar, pointer, dimension(:,:,:,:,:) :: & F, & F_tau, & @@ -387,33 +378,33 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) SNESGetNumberFunctionEvals, & SNESGetIterationNumber - F => x_scal(1:3,1:3,1,& - XG_RANGE,YG_RANGE,ZG_RANGE) - F_tau => x_scal(1:3,1:3,2,& - XG_RANGE,YG_RANGE,ZG_RANGE) - residual_F => f_scal(1:3,1:3,1,& - X_RANGE,Y_RANGE,Z_RANGE) - residual_F_tau => f_scal(1:3,1:3,2,& - X_RANGE,Y_RANGE,Z_RANGE) - - call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr) - call SNESGetIterationNumber(snes,PETScIter,ierr); CHKERRQ(ierr) + F => x_scal(1:3,1:3,1,& + XG_RANGE,YG_RANGE,ZG_RANGE) + F_tau => x_scal(1:3,1:3,2,& + XG_RANGE,YG_RANGE,ZG_RANGE) + residual_F => f_scal(1:3,1:3,1,& + X_RANGE, Y_RANGE, Z_RANGE) + residual_F_tau => f_scal(1:3,1:3,2,& + X_RANGE, Y_RANGE, Z_RANGE) F_av = sum(sum(sum(F,dim=5),dim=4),dim=3) * wgt call MPI_Allreduce(MPI_IN_PLACE,F_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - if(nfuncs== 0 .and. PETScIter == 0) totalIter = -1_pInt ! new increment - newIteration: if(totalIter <= PETScIter) then + call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr) + call SNESGetIterationNumber(snes,PETScIter,ierr); CHKERRQ(ierr) + + if (nfuncs == 0 .and. PETScIter == 0) totalIter = -1_pInt ! new increment !-------------------------------------------------------------------------------------------------- -! report begin of new iteration +! begin of new iteration + newIteration: if (totalIter <= PETScIter) then totalIter = totalIter + 1_pInt - write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & - ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax + write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') & + trim(incInfo), ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & - math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & - math_transpose33(F_aim) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & + ' deformation gradient aim (lab) =', math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & + ' deformation gradient aim =', math_transpose33(F_aim) flush(6) endif newIteration @@ -440,18 +431,16 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) !-------------------------------------------------------------------------------------------------- ! evaluate constitutive response P_avLastEval = P_av - call Utilities_constitutiveResponse(F_lastInc,F - residual_F_tau/polarBeta,params%timeinc, & - residual_F,C_volAvg,C_minMaxAvg,P_av,ForwardData,params%rotation_BC) + call Utilities_constitutiveResponse(residual_F,P_av,C_volAvg,C_minMaxAvg, & + F - residual_F_tau/polarBeta,params%timeinc,params%rotation_BC) call MPI_Allreduce(MPI_IN_PLACE,terminallyIll,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr) - ForwardData = .False. !-------------------------------------------------------------------------------------------------- ! calculate divergence tensorField_real = 0.0_pReal - tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = residual_F + tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = residual_F !< stress field in disguise call utilities_FFTtensorForward() - err_div = Utilities_divergenceRMS() - call utilities_FFTtensorBackward() + err_div = Utilities_divergenceRMS() !< root mean squared error in divergence of stress !-------------------------------------------------------------------------------------------------- ! constructing residual @@ -471,8 +460,11 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = F call utilities_FFTtensorForward() err_curl = Utilities_curlRMS() - call utilities_FFTtensorBackward() - + + nullify(F) + nullify(F_tau) + nullify(residual_F) + nullify(residual_F_tau) end subroutine Polarisation_formResidual @@ -487,8 +479,8 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason, err_div_tolAbs, & err_curl_tolRel, & err_curl_tolAbs, & - err_stress_tolAbs, & - err_stress_tolRel + err_stress_tolRel, & + err_stress_tolAbs use math, only: & math_mul3333xx33 use FEsolving, only: & @@ -507,24 +499,24 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason, real(pReal) :: & curlTol, & divTol, & - BC_tol + BCTol !-------------------------------------------------------------------------------------------------- ! stress BC handling F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%stress_BC))) ! S = 0.0 for no bc - err_BC = maxval(abs((-mask_stress+1.0_pReal)*math_mul3333xx33(C_scale,F_aim-F_av) + & - mask_stress *(P_av - params%stress_BC))) ! mask = 0.0 for no bc + err_BC = maxval(abs((1.0_pReal-mask_stress) * math_mul3333xx33(C_scale,F_aim-F_av) + & + mask_stress * (P_av-params%stress_BC))) ! mask = 0.0 for no bc !-------------------------------------------------------------------------------------------------- ! error calculation - curlTol = max(maxval(abs(F_aim-math_I3))*err_curl_tolRel,err_curl_tolAbs) - divTol = max(maxval(abs(P_av)) *err_div_tolRel,err_div_tolAbs) - BC_tol = max(maxval(abs(P_av)) *err_stress_tolrel,err_stress_tolabs) + curlTol = max(maxval(abs(F_aim-math_I3))*err_curl_tolRel ,err_curl_tolAbs) + divTol = max(maxval(abs(P_av)) *err_div_tolRel ,err_div_tolAbs) + BCTol = max(maxval(abs(P_av)) *err_stress_tolRel,err_stress_tolAbs) converged: if ((totalIter >= itmin .and. & - all([ err_div/divTol, & + all([ err_div /divTol, & err_curl/curlTol, & - err_BC/BC_tol ] < 1.0_pReal)) & + err_BC /BCTol ] < 1.0_pReal)) & .or. terminallyIll) then reason = 1 elseif (totalIter >= itmax) then converged @@ -536,12 +528,12 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason, !-------------------------------------------------------------------------------------------------- ! report write(6,'(1/,a)') ' ... reporting .............................................................' - write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', & - err_curl/curlTol,' (',err_curl,' -, tol =',curlTol,')' - write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & - err_div/divTol, ' (',err_div, ' / m, tol =',divTol,')' - write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error BC = ', & - err_BC/BC_tol, ' (',err_BC, ' Pa, tol =',BC_tol,')' + write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & + err_div/divTol, ' (',err_div, ' / m, tol = ',divTol,')' + write(6, '(a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', & + err_curl/curlTol,' (',err_curl,' -, tol = ',curlTol,')' + write(6, '(a,f12.2,a,es8.2,a,es9.2,a)') ' error BC = ', & + err_BC/BCTol, ' (',err_BC, ' Pa, tol = ',BCTol,')' write(6,'(/,a)') ' ===========================================================================' flush(6) @@ -549,6 +541,8 @@ end subroutine Polarisation_converged !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine +!> @details find new boundary conditions and best F estimate for end of current timestep +!> possibly writing restart information, triggering of state increment in DAMASK, and updating of IPcoordinates !-------------------------------------------------------------------------------------------------- subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stress_BC,rotation_BC) use math, only: & @@ -558,133 +552,140 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,deformati math_rotate_backward33 use numerics, only: & worldrank + use homogenization, only: & + materialpoint_F0 use mesh, only: & - grid3, & - grid - use spectral_utilities, only: & - Utilities_calculateRate, & - Utilities_forwardField, & - Utilities_updateIPcoords, & - tBoundaryCondition, & - cutBack - use IO, only: & - IO_write_JobRealFile - use FEsolving, only: & - restartWrite + grid, & + grid3 + use CPFEM2, only: & + CPFEM_age + use spectral_utilities, only: & + Utilities_calculateRate, & + Utilities_forwardField, & + Utilities_updateIPcoords, & + tBoundaryCondition, & + cutBack + use IO, only: & + IO_write_JobRealFile + use FEsolving, only: & + restartWrite implicit none - real(pReal), intent(in) :: & - timeinc_old, & - timeinc, & - loadCaseTime !< remaining time of current load case - type(tBoundaryCondition), intent(in) :: & - stress_BC, & - deformation_BC - real(pReal), dimension(3,3), intent(in) :: rotation_BC - logical, intent(in) :: & - guess - PetscErrorCode :: ierr - PetscScalar, dimension(:,:,:,:), pointer :: xx_psc, F, F_tau - integer(pInt) :: i, j, k - real(pReal), dimension(3,3) :: F_lambda33 - character(len=1024) :: rankStr + logical, intent(in) :: & + guess + real(pReal), intent(in) :: & + timeinc_old, & + timeinc, & + loadCaseTime !< remaining time of current load case + type(tBoundaryCondition), intent(in) :: & + stress_BC, & + deformation_BC + real(pReal), dimension(3,3), intent(in) ::& + rotation_BC + PetscErrorCode :: ierr + PetscScalar, dimension(:,:,:,:), pointer :: FandF_tau, F, F_tau + integer(pInt) :: i, j, k + real(pReal), dimension(3,3) :: F_lambda33 + character(len=32) :: rankStr !-------------------------------------------------------------------------------------------------- ! update coordinates and rate and forward last inc - call DMDAVecGetArrayF90(da,solution_vec,xx_psc,ierr) - F => xx_psc(0:8,:,:,:) - F_tau => xx_psc(9:17,:,:,:) - if (restartWrite) then - write(6,'(/,a)') ' writing converged results for restart' - flush(6) - write(rankStr,'(a1,i0)')'_',worldrank - call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file - write (777,rec=1) F - close (777) - call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file - write (777,rec=1) F_lastInc - close (777) - call IO_write_jobRealFile(777,'F_tau'//trim(rankStr),size(F_tau)) ! writing deformation gradient field to file - write (777,rec=1) F_tau - close (777) - call IO_write_jobRealFile(777,'F_tau_lastInc'//trim(rankStr),size(F_tau_lastInc)) ! writing F_lastInc field to file - write (777,rec=1) F_tau_lastInc - close (777) - if (worldrank == 0_pInt) then - call IO_write_jobRealFile(777,'F_aim',size(F_aim)) - write (777,rec=1) F_aim - close(777) - call IO_write_jobRealFile(777,'F_aim_lastInc',size(F_aim_lastInc)) - write (777,rec=1) F_aim_lastInc - close (777) - call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot)) - write (777,rec=1) F_aimDot - close(777) - call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg)) - write (777,rec=1) C_volAvg - close(777) - call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc)) - write (777,rec=1) C_volAvgLastInc - close(777) - endif - endif + call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) + F => FandF_tau( 0: 8,:,:,:) + F_tau => FandF_tau( 9:17,:,:,:) - call utilities_updateIPcoords(F) + if (cutBack) then + C_volAvg = C_volAvgLastInc ! QUESTION: where is this required? + C_minMaxAvg = C_minMaxAvgLastInc ! QUESTION: where is this required? + else + !-------------------------------------------------------------------------------------------------- + ! restart information for spectral solver + if (restartWrite) then ! QUESTION: where is this logical properly set? + write(6,'(/,a)') ' writing converged results for restart' + flush(6) - if (cutBack) then - F_aim = F_aim_lastInc - F_tau= reshape(F_tau_lastInc,[9,grid(1),grid(2),grid3]) - F = reshape(F_lastInc, [9,grid(1),grid(2),grid3]) - C_volAvg = C_volAvgLastInc - else - ForwardData = .True. - C_volAvgLastInc = C_volAvg -!-------------------------------------------------------------------------------------------------- -! calculate rate for aim - if (deformation_BC%myType=='l') then ! calculate f_aimDot from given L and current F - f_aimDot = deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim) - elseif(deformation_BC%myType=='fdot') then ! f_aimDot is prescribed - f_aimDot = deformation_BC%maskFloat * deformation_BC%values - elseif(deformation_BC%myType=='f') then ! aim at end of load case is prescribed - f_aimDot = deformation_BC%maskFloat * (deformation_BC%values -F_aim)/loadCaseTime - endif - if (guess) f_aimDot = f_aimDot + stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old - F_aim_lastInc = F_aim + if (worldrank == 0_pInt) then + call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg)) + write (777,rec=1) C_volAvg; close(777) + call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc)) + write (777,rec=1) C_volAvgLastInc; close(777) + call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot)) + write (777,rec=1) F_aimDot; close(777) + endif + + write(rankStr,'(a1,i0)')'_',worldrank + call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file + write (777,rec=1) F; close (777) + call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file + write (777,rec=1) F_lastInc; close (777) + call IO_write_jobRealFile(777,'F_tau'//trim(rankStr),size(F_tau)) ! writing deformation gradient field to file + write (777,rec=1) F_tau; close (777) + call IO_write_jobRealFile(777,'F_tau_lastInc'//trim(rankStr),size(F_tau_lastInc)) ! writing F_tau_lastInc field to file + write (777,rec=1) F_tau_lastInc; close (777) + endif + + call CPFEM_age() ! age state and kinematics + call utilities_updateIPcoords(F) + + C_volAvgLastInc = C_volAvg + C_minMaxAvgLastInc = C_minMaxAvg + + if (guess) then ! QUESTION: better with a = L ? x:y + F_aimDot = stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old ! initialize with correction based on last inc + else + F_aimDot = 0.0_pReal + endif + F_aim_lastInc = F_aim + !-------------------------------------------------------------------------------------------------- + ! calculate rate for aim + if (deformation_BC%myType=='l') then ! calculate F_aimDot from given L and current F + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim_lastInc) + elseif(deformation_BC%myType=='fdot') then ! F_aimDot is prescribed + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * deformation_BC%values + elseif (deformation_BC%myType=='f') then ! aim at end of load case is prescribed + F_aimDot = & + F_aimDot + deformation_BC%maskFloat * (deformation_BC%values - F_aim_lastInc)/loadCaseTime + endif + + + Fdot = Utilities_calculateRate(guess, & + F_lastInc,reshape(F,[3,3,grid(1),grid(2),grid3]),timeinc_old, & + math_rotate_backward33(F_aimDot,rotation_BC)) + F_tauDot = Utilities_calculateRate(guess, & + F_tau_lastInc,reshape(F_tau,[3,3,grid(1),grid(2),grid3]), timeinc_old, & + math_rotate_backward33(F_aimDot,rotation_BC)) + F_lastInc = reshape(F, [3,3,grid(1),grid(2),grid3]) ! winding F forward + F_tau_lastInc = reshape(F_tau, [3,3,grid(1),grid(2),grid3]) ! winding F_tau forward + materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) ! set starting condition for materialpoint_stressAndItsTangent + endif !-------------------------------------------------------------------------------------------------- -! update coordinates and rate and forward last inc - call utilities_updateIPcoords(F) - Fdot = Utilities_calculateRate(math_rotate_backward33(f_aimDot,rotation_BC), & - timeinc_old,guess,F_lastInc, & - reshape(F,[3,3,grid(1),grid(2),grid3])) - F_tauDot = Utilities_calculateRate(math_rotate_backward33(2.0_pReal*f_aimDot,rotation_BC), & - timeinc_old,guess,F_tau_lastInc, & - reshape(F_tau,[3,3,grid(1),grid(2),grid3])) - F_lastInc = reshape(F, [3,3,grid(1),grid(2),grid3]) - F_tau_lastInc = reshape(F_tau,[3,3,grid(1),grid(2),grid3]) - endif +! update average and local deformation gradients + F_aim = F_aim_lastInc + F_aimDot * timeinc - F_aim = F_aim + f_aimDot * timeinc - -!-------------------------------------------------------------------------------------------------- -! update local deformation gradient - F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! ensure that it matches rotated F_aim - math_rotate_backward33(F_aim,rotation_BC)), & - [9,grid(1),grid(2),grid3]) - F_tau = reshape(Utilities_forwardField(timeinc,F_tau_lastInc,F_taudot), & ! does not have any average value as boundary condition - [9,grid(1),grid(2),grid3]) - if (.not. guess) then ! large strain forwarding + F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! estimate of F at end of time+timeinc that matches rotated F_aim on average + math_rotate_backward33(F_aim,rotation_BC)),& + [9,grid(1),grid(2),grid3]) + if (guess) then + F_tau = reshape(Utilities_forwardField(timeinc,F_tau_lastInc,F_taudot), & + [9,grid(1),grid(2),grid3]) ! does not have any average value as boundary condition + else do k = 1_pInt, grid3; do j = 1_pInt, grid(2); do i = 1_pInt, grid(1) F_lambda33 = reshape(F_tau(1:9,i,j,k)-F(1:9,i,j,k),[3,3]) F_lambda33 = math_mul3333xx33(S_scale,math_mul33x33(F_lambda33, & math_mul3333xx33(C_scale,& math_mul33x33(math_transpose33(F_lambda33),& - F_lambda33) -math_I3))*0.5_pReal)& + F_lambda33)-math_I3))*0.5_pReal)& + math_I3 F_tau(1:9,i,j,k) = reshape(F_lambda33,[9])+F(1:9,i,j,k) enddo; enddo; enddo endif - call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) + + nullify(F) + nullify(F_tau) + call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) end subroutine Polarisation_forward diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 old mode 100644 new mode 100755 index 5a3361fcf..7b6f08a7d --- a/src/spectral_utilities.f90 +++ b/src/spectral_utilities.f90 @@ -16,7 +16,7 @@ module spectral_utilities #include include 'fftw3-mpi.f03' - logical, public :: cutBack =.false. !< cut back of BVP solver in case convergence is not achieved or a material point is terminally ill + logical, public :: cutBack = .false. !< cut back of BVP solver in case convergence is not achieved or a material point is terminally ill integer(pInt), public, parameter :: maxPhaseFields = 2_pInt integer(pInt), public :: nActiveFields = 0_pInt @@ -145,8 +145,7 @@ module spectral_utilities FIELD_UNDEFINED_ID, & FIELD_MECH_ID, & FIELD_THERMAL_ID, & - FIELD_DAMAGE_ID, & - utilities_calcPlasticity + FIELD_DAMAGE_ID private :: & utilities_getFreqDerivative @@ -414,8 +413,7 @@ subroutine utilities_updateGamma(C,saveReference) write(6,'(/,a)') ' writing reference stiffness to file' flush(6) call IO_write_jobRealFile(777,'C_ref',size(C_ref)) - write (777,rec=1) C_ref - close(777) + write (777,rec=1) C_ref; close(777) endif endif @@ -800,7 +798,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) call math_invert(size_reduced, c_reduced, s_reduced, errmatinv) ! invert reduced stiffness if (any(IEEE_is_NaN(s_reduced))) errmatinv = .true. - if(errmatinv) call IO_error(error_ID=400_pInt,ext_msg='utilities_maskedCompliance') + if (errmatinv) call IO_error(error_ID=400_pInt,ext_msg='utilities_maskedCompliance') temp99_Real = 0.0_pReal ! fill up compliance with zeros k = 0_pInt do n = 1_pInt,9_pInt @@ -818,28 +816,30 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) sTimesC = matmul(c_reduced,s_reduced) do m=1_pInt, size_reduced do n=1_pInt, size_reduced - if(m==n .and. abs(sTimesC(m,n)) > (1.0_pReal + 10.0e-12_pReal)) errmatinv = .true. ! diagonal elements of S*C should be 1 - if(m/=n .and. abs(sTimesC(m,n)) > (0.0_pReal + 10.0e-12_pReal)) errmatinv = .true. ! off diagonal elements of S*C should be 0 + errmatinv = errmatinv & + .or. (m==n .and. abs(sTimesC(m,n)-1.0_pReal) > 1.0e-12_pReal) & ! diagonal elements of S*C should be 1 + .or. (m/=n .and. abs(sTimesC(m,n)) > 1.0e-12_pReal) ! off-diagonal elements of S*C should be 0 enddo enddo - if(debugGeneral .or. errmatinv) then - write(formatString, '(I16.16)') size_reduced + if (debugGeneral .or. errmatinv) then + write(formatString, '(i2)') size_reduced formatString = '(/,a,/,'//trim(formatString)//'('//trim(formatString)//'(2x,es9.2,1x)/))' write(6,trim(formatString),advance='no') ' C * S (load) ', & transpose(matmul(c_reduced,s_reduced)) write(6,trim(formatString),advance='no') ' S (load) ', transpose(s_reduced) + if(errmatinv) call IO_error(error_ID=400_pInt,ext_msg='utilities_maskedCompliance') endif - if(errmatinv) call IO_error(error_ID=400_pInt,ext_msg='utilities_maskedCompliance') deallocate(c_reduced) deallocate(s_reduced) deallocate(sTimesC) else temp99_real = 0.0_pReal endif - if(debugGeneral) & - write(6,'(/,a,/,9(9(2x,f12.7,1x)/),/)',advance='no') ' Masked Compliance (load) * GPa =', & - transpose(temp99_Real*1.e9_pReal) - flush(6) + if(debugGeneral) then + write(6,'(/,a,/,9(9(2x,f10.5,1x)/),/)',advance='no') & + ' Masked Compliance (load) / GPa =', transpose(temp99_Real*1.e-9_pReal) + flush(6) + endif utilities_maskedCompliance = math_Plain99to3333(temp99_Real) end function utilities_maskedCompliance @@ -925,10 +925,10 @@ end subroutine utilities_fourierTensorDivergence !-------------------------------------------------------------------------------------------------- -!> @brief calculates constitutive response +!> @brief calculate constitutive response from materialpoint_F0 to F during timeinc !-------------------------------------------------------------------------------------------------- -subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & - P,C_volAvg,C_minmaxAvg,P_av,forwardData,rotation_BC) +subroutine utilities_constitutiveResponse(P,P_av,C_volAvg,C_minmaxAvg,& + F,timeinc,rotation_BC) use IO, only: & IO_error use debug, only: & @@ -941,31 +941,22 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & use mesh, only: & grid,& grid3 - use FEsolving, only: & - restartWrite - use CPFEM2, only: & - CPFEM_general use homogenization, only: & - materialpoint_F0, & materialpoint_F, & materialpoint_P, & - materialpoint_dPdF + materialpoint_dPdF, & + materialpoint_stressAndItsTangent implicit none - real(pReal), intent(in), dimension(3,3,grid(1),grid(2),grid3) :: & - F_lastInc, & !< target deformation gradient - F !< previous deformation gradient - real(pReal), intent(in) :: timeinc !< loading time - logical, intent(in) :: forwardData !< age results - real(pReal), intent(in), dimension(3,3) :: rotation_BC !< rotation of load frame - real(pReal),intent(out), dimension(3,3,3,3) :: C_volAvg, C_minmaxAvg !< average stiffness real(pReal),intent(out), dimension(3,3) :: P_av !< average PK stress real(pReal),intent(out), dimension(3,3,grid(1),grid(2),grid3) :: P !< PK stress - logical :: & - age + real(pReal), intent(in), dimension(3,3,grid(1),grid(2),grid3) :: F !< deformation gradient target !< previous deformation gradient + real(pReal), intent(in) :: timeinc !< loading time + real(pReal), intent(in), dimension(3,3) :: rotation_BC !< rotation of load frame + integer(pInt) :: & j,k,ierr real(pReal), dimension(3,3,3,3) :: max_dPdF, min_dPdF @@ -976,17 +967,9 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & write(6,'(/,a)') ' ... evaluating constitutive response ......................................' flush(6) - age = .False. - - if (forwardData) then ! aging results - age = .True. - materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) - endif - if (cutBack) age = .False. ! restore saved variables - - materialpoint_F = reshape(F,[3,3,1,product(grid(1:2))*grid3]) - call debug_reset() ! this has no effect on rank >0 - + + materialpoint_F = reshape(F,[3,3,1,product(grid(1:2))*grid3]) ! set materialpoint target F to estimated field + !-------------------------------------------------------------------------------------------------- ! calculate bounds of det(F) and report if(debugGeneral) then @@ -1003,7 +986,19 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & flush(6) endif - call CPFEM_general(age,timeinc) + call debug_reset() ! this has no effect on rank >0 + call materialpoint_stressAndItsTangent(.true.,timeinc) ! calculate P field + + P = reshape(materialpoint_P, [3,3,grid(1),grid(2),grid3]) + P_av = sum(sum(sum(P,dim=5),dim=4),dim=3) * wgt ! average of P + call MPI_Allreduce(MPI_IN_PLACE,P_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) + if (debugRotation) & + write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress (lab) / MPa =',& + math_transpose33(P_av)*1.e-6_pReal + P_av = math_rotate_forward33(P_av,rotation_BC) + write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',& + math_transpose33(P_av)*1.e-6_pReal + flush(6) max_dPdF = 0.0_pReal max_dPdF_norm = 0.0_pReal @@ -1021,157 +1016,24 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & end do call MPI_Allreduce(MPI_IN_PLACE,max_dPdF,81,MPI_DOUBLE,MPI_MAX,PETSC_COMM_WORLD,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max') + if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max') call MPI_Allreduce(MPI_IN_PLACE,min_dPdF,81,MPI_DOUBLE,MPI_MIN,PETSC_COMM_WORLD,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min') + if (ierr /= 0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min') C_minmaxAvg = 0.5_pReal*(max_dPdF + min_dPdF) - C_volAvg = sum(sum(materialpoint_dPdF,dim=6),dim=5) * wgt + C_volAvg = sum(sum(materialpoint_dPdF,dim=6),dim=5) * wgt call MPI_Allreduce(MPI_IN_PLACE,C_volAvg,81,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) call debug_info() ! this has no effect on rank >0 - restartWrite = .false. ! reset restartWrite status - cutBack = .false. ! reset cutBack status - - P = reshape(materialpoint_P, [3,3,grid(1),grid(2),grid3]) - P_av = sum(sum(sum(P,dim=5),dim=4),dim=3) * wgt ! average of P - call MPI_Allreduce(MPI_IN_PLACE,P_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - if (debugRotation) & - write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress (lab) / MPa =',& - math_transpose33(P_av)*1.e-6_pReal - P_av = math_rotate_forward33(P_av,rotation_BC) - write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',& - math_transpose33(P_av)*1.e-6_pReal - flush(6) - end subroutine utilities_constitutiveResponse -!-------------------------------------------------------------------------------------------------- -!> @brief calculates yield stress, plastic strain, total strain and their equivalent values -!-------------------------------------------------------------------------------------------------- -subroutine utilities_calcPlasticity(yieldStress, plasticStrain, eqStress, eqTotalStrain, & - eqPlasticStrain, plasticWork, rotation_BC) - use crystallite, only: & - crystallite_Fe, & - crystallite_P, & - crystallite_subF - use material, only: & - homogenization_maxNgrains - use mesh, only: & - mesh_maxNips,& - mesh_NcpElems - use math, only: & - math_det33, & - math_inv33, & - math_mul33x33, & - math_trace33, & - math_transpose33, & - math_equivStrain33, & - math_equivStress33, & - math_rotate_forward33, & - math_identity2nd, & - math_crossproduct, & - math_eigenvectorBasisSym, & - math_eigenvectorBasisSym33, & - math_eigenvectorBasisSym33_log, & - math_eigenValuesVectorsSym33 - - implicit none - - real(pReal), intent(inout) :: eqStress, eqPlasticStrain, plasticWork - real(pReal), intent(out) :: eqTotalStrain - real(pReal), dimension(3,3),intent(out) :: yieldStress, plasticStrain - real(pReal), intent(in), dimension(3,3) :: rotation_BC !< rotation of load frame - real(pReal), dimension(3,3) :: cauchy, P_av, F_av, Ve_av !< average - real(pReal), dimension(3) :: Values, S - real(pReal), dimension(3,3) :: Vectors, diag - real(pReal), dimension(3,3) :: & - Vp, F_temp, U, VT, R, V, V_total - real(pReal), dimension(3,3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems) :: & - Be, Ve, Fe - real(pReal), dimension(15) :: WORK !< previous deformation gradient - integer(pInt) :: INFO, i, j, k, l, ierr - real(pReal) :: wgtm - real(pReal) :: eqStressOld, eqPlasticStrainOld, plasticWorkOld - - external :: dgesvd - - eqStressOld = eqStress - eqPlasticStrainOld = eqPlasticStrain - plasticWorkOld = plasticWork - wgtm = 1.0_pReal/real(mesh_NcpElems*mesh_maxNips*homogenization_maxNgrains,pReal) - diag = 0.0_pReal - - P_av = sum(sum(sum(crystallite_P,dim=5),dim=4),dim=3) * wgtm - call MPI_Allreduce(MPI_IN_PLACE,P_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - P_av = math_rotate_forward33(P_av,rotation_BC) - - F_av = sum(sum(sum(crystallite_subF,dim=5),dim=4),dim=3) * wgtm - call MPI_Allreduce(MPI_IN_PLACE,F_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - F_av = math_rotate_forward33(F_av,rotation_BC) - - cauchy = 1.0_pReal/math_det33(F_av)*math_mul33x33(P_av,transpose(F_av)) - yieldStress = cauchy - eqStress = math_equivStress33(cauchy) - - F_temp = F_av - call dgesvd ('A', 'A', 3, 3, F_temp, 3, S, U, 3, VT, 3, WORK, 15, INFO) ! singular value decomposition - - R = math_mul33x33(U, VT) ! rotation of polar decomposition - V = math_mul33x33(F_av,math_inv33(R)) - - call math_eigenValuesVectorsSym33(V,Values,Vectors) - do l = 1_pInt, 3_pInt - if (Values(l) < 0.0_pReal) then - Values(l) = -Values(l) - Vectors(1:3, l) = -Vectors(1:3, l) - endif - Values(l) = log(Values(l)) - diag(l,l) = Values(l) - enddo - if (dot_product(Vectors(1:3,1),Vectors(1:3,2)) /= 0) then - Vectors(1:3,2) = math_crossproduct(Vectors(1:3,3), Vectors(1:3,1)) - Vectors(1:3,2) = Vectors(1:3,2)/sqrt(dot_product(Vectors(1:3,2),Vectors(1:3,2))) - endif - if (dot_product(Vectors(1:3,2),Vectors(1:3,3)) /= 0) then - Vectors(1:3,3) = math_crossproduct(Vectors(1:3,1), Vectors(1:3,2)) - Vectors(1:3,3) = Vectors(1:3,3)/sqrt(dot_product(Vectors(1:3,3),Vectors(1:3,3))) - endif - if (dot_product(Vectors(1:3,3),Vectors(1:3,1)) /= 0) then - Vectors(1:3,1) = math_crossproduct(Vectors(1:3,2), Vectors(1:3,3)) - Vectors(1:3,1) = Vectors(1:3,1)/sqrt(dot_product(Vectors(1:3,1),Vectors(1:3,1))) - endif - - V_total = REAL(math_mul33x33(Vectors, math_mul33x33(diag, transpose(Vectors)))) - eqTotalStrain = math_equivStrain33(V_total) - - do k = 1_pInt, mesh_NcpElems; do j = 1_pInt, mesh_maxNips; do i = 1_pInt,homogenization_maxNgrains - Fe(1:3,1:3,i,j,k) = crystallite_Fe(1:3,1:3,i,j,k) - Fe(1:3,1:3,i,j,k) = math_rotate_forward33(Fe(1:3,1:3,i,j,k),rotation_BC) - Be(1:3,1:3,i,j,k) = math_mul33x33(Fe(1:3,1:3,i,j,k),math_transpose33(Fe(1:3,1:3,i,j,k))) ! elastic part of left Cauchy–Green deformation tensor - Ve(1:3,1:3,i,j,k) = math_eigenvectorBasisSym33_log(Be(1:3,1:3,i,j,k)) - enddo; enddo; enddo - - Ve_av = sum(sum(sum(Ve,dim=5),dim=4),dim=3) * wgtm - call MPI_Allreduce(MPI_IN_PLACE,Ve_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - - Vp = V_total - Ve_av - - eqPlasticStrain = math_equivStrain33(Vp) - - plasticStrain = Vp - - plasticWork = plasticWorkOld + 0.5*(eqStressOld + eqStress) * (eqPlasticStrain - eqPlasticStrainOld) - -end subroutine utilities_calcPlasticity - !-------------------------------------------------------------------------------------------------- !> @brief calculates forward rate, either guessing or just add delta/timeinc !-------------------------------------------------------------------------------------------------- -pure function utilities_calculateRate(avRate,timeinc_old,guess,field_lastInc,field) +pure function utilities_calculateRate(heterogeneous,field0,field,dt,avRate) use mesh, only: & grid3, & grid @@ -1179,17 +1041,17 @@ pure function utilities_calculateRate(avRate,timeinc_old,guess,field_lastInc,fie implicit none real(pReal), intent(in), dimension(3,3) :: avRate !< homogeneous addon real(pReal), intent(in) :: & - timeinc_old !< timeinc of last step + dt !< timeinc between field0 and field logical, intent(in) :: & - guess !< guess along former trajectory + heterogeneous !< calculate field of rates real(pReal), intent(in), dimension(3,3,grid(1),grid(2),grid3) :: & - field_lastInc, & !< data of previous step + field0, & !< data of previous step field !< data of current step real(pReal), dimension(3,3,grid(1),grid(2),grid3) :: & utilities_calculateRate - if (guess) then - utilities_calculateRate = (field-field_lastInc) / timeinc_old + if (heterogeneous) then + utilities_calculateRate = (field-field0) / dt else utilities_calculateRate = spread(spread(spread(avRate,3,grid(1)),4,grid(2)),5,grid3) endif From d2e8621a0f4e43ce7e212168b8ed9a207690eba3 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 16 Feb 2018 09:55:04 -0500 Subject: [PATCH 17/42] consistent testing suite with relocated spectral method example --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 17d61f88c..83c2b5a14 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 17d61f88ce2d386d40b45a002d43556bfbb27340 +Subproject commit 83c2b5a14b4e4cba569e4bb89c5ec97b2484dbfd From 8949d3cb7cd3d7e37db5d7d6ff5578cc9a5a9551 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 16 Feb 2018 10:59:50 -0500 Subject: [PATCH 18/42] use consistency tests with increased itmin --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 83c2b5a14..eb3f941ff 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 83c2b5a14b4e4cba569e4bb89c5ec97b2484dbfd +Subproject commit eb3f941ff55b2a0fe83c8812d0cfb84448dd8aa5 From ad1179117d0a72c92aab8fa6e033c6f440b62cb9 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 16 Feb 2018 16:41:07 -0500 Subject: [PATCH 19/42] modified meaning of restart increment to "restart from" instead of "restart at" --- PRIVATE | 2 +- src/DAMASK_spectral.f90 | 26 ++++++------- src/FEsolving.f90 | 32 +++++++-------- src/constitutive.f90 | 3 +- src/mesh.f90 | 62 +++++++++++++++--------------- src/spectral_interface.f90 | 40 +++++++++---------- src/spectral_mech_AL.f90 | 14 +++---- src/spectral_mech_Basic.f90 | 16 ++++---- src/spectral_mech_Polarisation.f90 | 14 +++---- src/spectral_utilities.f90 | 8 ++-- 10 files changed, 111 insertions(+), 106 deletions(-) diff --git a/PRIVATE b/PRIVATE index eb3f941ff..8de4f792a 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit eb3f941ff55b2a0fe83c8812d0cfb84448dd8aa5 +Subproject commit 8de4f792a46d98d98418dbf2d3e621b22c13b18a diff --git a/src/DAMASK_spectral.f90 b/src/DAMASK_spectral.f90 index 7ec2dde4c..068aebbc6 100755 --- a/src/DAMASK_spectral.f90 +++ b/src/DAMASK_spectral.f90 @@ -393,23 +393,23 @@ program DAMASK_spectral !-------------------------------------------------------------------------------------------------- ! write header of output file if (worldrank == 0) then - if (.not. appendToOutFile) then ! after restart, append to existing results file + if (.not. appendToOutFile) then ! after restart, append to existing results file open(newunit=resUnit,file=trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//& '.spectralOut',form='UNFORMATTED',status='REPLACE') - write(resUnit) 'load:', trim(loadCaseFile) ! ... and write header + write(resUnit) 'load:', trim(loadCaseFile) ! ... and write header write(resUnit) 'workingdir:', trim(getSolverWorkingDirectoryName()) write(resUnit) 'geometry:', trim(geometryFile) write(resUnit) 'grid:', grid write(resUnit) 'size:', geomSize write(resUnit) 'materialpoint_sizeResults:', materialpoint_sizeResults write(resUnit) 'loadcases:', size(loadCases) - write(resUnit) 'frequencies:', loadCases%outputfrequency ! one entry per LoadCase - write(resUnit) 'times:', loadCases%time ! one entry per LoadCase + write(resUnit) 'frequencies:', loadCases%outputfrequency ! one entry per LoadCase + write(resUnit) 'times:', loadCases%time ! one entry per LoadCase write(resUnit) 'logscales:', loadCases%logscale - write(resUnit) 'increments:', loadCases%incs ! one entry per LoadCase - write(resUnit) 'startingIncrement:', restartInc - 1_pInt ! start with writing out the previous inc + write(resUnit) 'increments:', loadCases%incs ! one entry per LoadCase + write(resUnit) 'startingIncrement:', restartInc ! start with writing out the previous inc write(resUnit) 'eoh' - close(resUnit) ! end of header + close(resUnit) ! end of header open(newunit=statUnit,file=trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//& '.sta',form='FORMATTED',status='REPLACE') write(statUnit,'(a)') 'Increment Time CutbackLevel Converged IterationsNeeded' ! statistics file @@ -480,15 +480,15 @@ program DAMASK_spectral endif else ! not-1st currentLoadCase of logarithmic scale timeinc = time0 * & - ( (1.0_pReal + loadCases(currentLoadCase)%time/time0 )**(real( inc,pReal)/& + ( (1.0_pReal + loadCases(currentLoadCase)%time/time0 )**(real( inc ,pReal)/& real(loadCases(currentLoadCase)%incs ,pReal))& - -(1.0_pReal + loadCases(currentLoadCase)%time/time0 )**(real( (inc-1_pInt),pReal)/& + -(1.0_pReal + loadCases(currentLoadCase)%time/time0 )**(real( inc-1_pInt ,pReal)/& real(loadCases(currentLoadCase)%incs ,pReal))) endif endif timeinc = timeinc * real(subStepFactor,pReal)**real(-cutBackLevel,pReal) ! depending on cut back level, decrease time step - skipping: if (totalIncsCounter < restartInc) then ! not yet at restart inc? + skipping: if (totalIncsCounter <= restartInc) then ! not yet at restart inc? time = time + timeinc ! just advance time, skip already performed calculation guess = .true. ! QUESTION:why forced guessing instead of inheriting loadcase preference else skipping @@ -509,8 +509,8 @@ program DAMASK_spectral ',a,'//IO_intOut(stepFraction) //',a,'//IO_intOut(subStepFactor**cutBackLevel)//& ',a,'//IO_intOut(currentLoadCase)//',a,'//IO_intOut(size(loadCases))//')') & 'Time', time, & - 's: Increment ', inc, '/', loadCases(currentLoadCase)%incs,& - '-', stepFraction, '/', subStepFactor**cutBackLevel,& + 's: Increment ', inc,'/',loadCases(currentLoadCase)%incs,& + '-', stepFraction,'/',subStepFactor**cutBackLevel,& ' of load case ', currentLoadCase,'/',size(loadCases) write(incInfo,& '(a,'//IO_intOut(totalIncsCounter)//& @@ -518,7 +518,7 @@ program DAMASK_spectral ',a,'//IO_intOut(stepFraction)//& ',a,'//IO_intOut(subStepFactor**cutBackLevel)//')') & 'Increment ',totalIncsCounter,'/',sum(loadCases%incs),& - '-',stepFraction, '/', subStepFactor**cutBackLevel + '-', stepFraction,'/',subStepFactor**cutBackLevel flush(6) !-------------------------------------------------------------------------------------------------- diff --git a/src/FEsolving.f90 b/src/FEsolving.f90 index 92feaa926..3853cb37f 100644 --- a/src/FEsolving.f90 +++ b/src/FEsolving.f90 @@ -79,20 +79,22 @@ subroutine FE_init #include "compilation_info.f90" modelName = getSolverJobName() + +#if defined(Spectral) || defined(FEM) + #ifdef Spectral restartInc = spectralRestartInc - if(restartInc <= 0_pInt) then - call IO_warning(warning_ID=34_pInt) - restartInc = 1_pInt - endif - restartRead = restartInc > 1_pInt ! only read in if "true" restart requested -#elif defined FEM +#endif +#ifdef FEM restartInc = FEMRestartInc - if(restartInc <= 0_pInt) then +#endif + + if(restartInc < 0_pInt) then call IO_warning(warning_ID=34_pInt) - restartInc = 1_pInt + restartInc = 0_pInt endif - restartRead = restartInc > 1_pInt + restartRead = restartInc > 0_pInt ! only read in if "true" restart requested + #else call IO_open_inputFile(FILEUNIT,modelName) rewind(FILEUNIT) @@ -131,19 +133,19 @@ subroutine FE_init do read (FILEUNIT,'(a1024)',END=200) line chunkPos = IO_stringPos(line) - if ( IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == 'restart' .and. & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'file' .and. & - IO_lc(IO_stringValue(line,chunkPos,3_pInt)) == 'job' .and. & - IO_lc(IO_stringValue(line,chunkPos,4_pInt)) == 'id' ) & + if ( IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == 'restart' & + .and. IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'file' & + .and. IO_lc(IO_stringValue(line,chunkPos,3_pInt)) == 'job' & + .and. IO_lc(IO_stringValue(line,chunkPos,4_pInt)) == 'id' ) & modelName = IO_StringValue(line,chunkPos,6_pInt) enddo -#else +#else ! QUESTION: is this meaningful for the spectral/FEM case? call IO_open_inputFile(FILEUNIT,modelName) rewind(FILEUNIT) do read (FILEUNIT,'(a1024)',END=200) line chunkPos = IO_stringPos(line) - if ( IO_lc(IO_stringValue(line,chunkPos,1_pInt))=='*heading') then + if (IO_lc(IO_stringValue(line,chunkPos,1_pInt))=='*heading') then read (FILEUNIT,'(a1024)',END=200) line chunkPos = IO_stringPos(line) modelName = IO_StringValue(line,chunkPos,1_pInt) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index be9899d73..8efd387e0 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -885,7 +885,8 @@ subroutine constitutive_collectDotState(Tstar_v, FeArray, FpArray, subdt, subfra real(pReal), intent(in), dimension(6) :: & Tstar_v !< 2nd Piola Kirchhoff stress tensor (Mandel) integer(pLongInt) :: & - tick, tock, & + tick = 0_pLongInt, & + tock = 0_pLongInt, & tickrate, & maxticks integer(pInt) :: & diff --git a/src/mesh.f90 b/src/mesh.f90 index 2c7ecc8ed..74bb55a3b 100644 --- a/src/mesh.f90 +++ b/src/mesh.f90 @@ -379,30 +379,30 @@ module mesh ],pInt) - integer(pInt), dimension(FE_Nelemtypes), parameter, private :: MESH_VTKELEMTYPE = & - int([ & - 5, & ! element 6 (2D 3node 1ip) - 22, & ! element 125 (2D 6node 3ip) - 9, & ! element 11 (2D 4node 4ip) - 23, & ! element 27 (2D 8node 9ip) - 23, & ! element 54 (2D 8node 4ip) - 10, & ! element 134 (3D 4node 1ip) - 10, & ! element 157 (3D 5node 4ip) - 24, & ! element 127 (3D 10node 4ip) - 13, & ! element 136 (3D 6node 6ip) - 12, & ! element 117 (3D 8node 1ip) - 12, & ! element 7 (3D 8node 8ip) - 25, & ! element 57 (3D 20node 8ip) - 25 & ! element 21 (3D 20node 27ip) - ],pInt) - - integer(pInt), dimension(FE_Ncelltypes), parameter, private :: MESH_VTKCELLTYPE = & - int([ & - 5, & ! (2D 3node) - 9, & ! (2D 4node) - 10, & ! (3D 4node) - 12 & ! (3D 8node) - ],pInt) +! integer(pInt), dimension(FE_Nelemtypes), parameter, private :: MESH_VTKELEMTYPE = & +! int([ & +! 5, & ! element 6 (2D 3node 1ip) +! 22, & ! element 125 (2D 6node 3ip) +! 9, & ! element 11 (2D 4node 4ip) +! 23, & ! element 27 (2D 8node 9ip) +! 23, & ! element 54 (2D 8node 4ip) +! 10, & ! element 134 (3D 4node 1ip) +! 10, & ! element 157 (3D 5node 4ip) +! 24, & ! element 127 (3D 10node 4ip) +! 13, & ! element 136 (3D 6node 6ip) +! 12, & ! element 117 (3D 8node 1ip) +! 12, & ! element 7 (3D 8node 8ip) +! 25, & ! element 57 (3D 20node 8ip) +! 25 & ! element 21 (3D 20node 27ip) +! ],pInt) +! +! integer(pInt), dimension(FE_Ncelltypes), parameter, private :: MESH_VTKCELLTYPE = & +! int([ & +! 5, & ! (2D 3node) +! 9, & ! (2D 4node) +! 10, & ! (3D 4node) +! 12 & ! (3D 8node) +! ],pInt) public :: & @@ -2848,16 +2848,18 @@ use IO, only: & implicit none integer(pInt), intent(in) :: fileUnit -#ifndef Spectral +#ifdef Spectral + mesh_periodicSurface = .true. + + end subroutine mesh_get_damaskOptions + +#else + integer(pInt), allocatable, dimension(:) :: chunkPos integer(pInt) chunk, Nchunks character(len=300) :: line, damaskOption, v character(len=300) :: keyword -#endif -#ifdef Spectral - mesh_periodicSurface = .true. -#else mesh_periodicSurface = .false. #ifdef Marc4DAMASK keyword = '$damask' @@ -2886,9 +2888,9 @@ use IO, only: & enddo 610 FORMAT(A300) -#endif 620 end subroutine mesh_get_damaskOptions +#endif !-------------------------------------------------------------------------------------------------- diff --git a/src/spectral_interface.f90 b/src/spectral_interface.f90 index 9aa4d1069..b45e8316c 100644 --- a/src/spectral_interface.f90 +++ b/src/spectral_interface.f90 @@ -15,7 +15,7 @@ module DAMASK_interface private #include logical, public, protected :: appendToOutFile = .false. !< Append to existing spectralOut file (in case of restart, not in case of regridding) - integer(pInt), public, protected :: spectralRestartInc = 1_pInt !< Increment at which calculation starts + integer(pInt), public, protected :: spectralRestartInc = 0_pInt !< Increment at which calculation starts character(len=1024), public, protected :: & geometryFile = '', & !< parameter given for geometry file loadCaseFile = '' !< parameter given for load case file @@ -167,12 +167,12 @@ subroutine DAMASK_interface_init() write(6,'(a)') ' For further configuration place "numerics.config"' write(6,'(a)')' and "debug.config" in that directory.' write(6,'(/,a)')' --restart XX' - write(6,'(a)') ' Reads in total increment No. XX-1 and continues to' - write(6,'(a)') ' calculate total increment No. XX.' - write(6,'(a)') ' Appends to existing results file ' + write(6,'(a)') ' Reads in increment XX and continues with calculating' + write(6,'(a)') ' increment XX+1 based on this.' + write(6,'(a)') ' Appends to existing results file' write(6,'(a)') ' "NameOfGeom_NameOfLoadFile.spectralOut".' - write(6,'(a)') ' Works only if the restart information for total increment' - write(6,'(a)') ' No. XX-1 is available in the working directory.' + write(6,'(a)') ' Works only if the restart information for increment XX' + write(6,'(a)') ' is available in the working directory.' write(6,'(/,a)')' -----------------------------------------------------------------------' write(6,'(a)') ' Help:' write(6,'(/,a)')' --help' @@ -201,20 +201,20 @@ subroutine DAMASK_interface_init() call get_environment_variable('USER',userName) error = getHostName(hostName) - write(6,'(a,a)') ' Host name: ', trim(hostName) - write(6,'(a,a)') ' User name: ', trim(userName) - write(6,'(a,a)') ' Command line call: ', trim(commandLine) - if (len(trim(workingDirArg))>0) & - write(6,'(a,a)') ' Working dir argument: ', trim(workingDirArg) - write(6,'(a,a)') ' Geometry argument: ', trim(geometryArg) - write(6,'(a,a)') ' Loadcase argument: ', trim(loadcaseArg) - write(6,'(a,a)') ' Working directory: ', trim(getSolverWorkingDirectoryName()) - write(6,'(a,a)') ' Geometry file: ', trim(geometryFile) - write(6,'(a,a)') ' Loadcase file: ', trim(loadCaseFile) - write(6,'(a,a)') ' Solver job name: ', trim(getSolverJobName()) - if (SpectralRestartInc > 1_pInt) & - write(6,'(a,i6.6)') ' Restart at increment: ', spectralRestartInc - write(6,'(a,l1,/)') ' Append to result file: ', appendToOutFile + write(6,'(a,a)') ' Host name: ', trim(hostName) + write(6,'(a,a)') ' User name: ', trim(userName) + write(6,'(a,a)') ' Command line call: ', trim(commandLine) + if (len(trim(workingDirArg)) > 0) & + write(6,'(a,a)') ' Working dir argument: ', trim(workingDirArg) + write(6,'(a,a)') ' Geometry argument: ', trim(geometryArg) + write(6,'(a,a)') ' Loadcase argument: ', trim(loadcaseArg) + write(6,'(a,a)') ' Working directory: ', trim(getSolverWorkingDirectoryName()) + write(6,'(a,a)') ' Geometry file: ', trim(geometryFile) + write(6,'(a,a)') ' Loadcase file: ', trim(loadCaseFile) + write(6,'(a,a)') ' Solver job name: ', trim(getSolverJobName()) + if (SpectralRestartInc > 0_pInt) & + write(6,'(a,i6.6)') ' Restart from increment: ', spectralRestartInc + write(6,'(a,l1,/)') ' Append to result file: ', appendToOutFile end subroutine DAMASK_interface_init diff --git a/src/spectral_mech_AL.f90 b/src/spectral_mech_AL.f90 index 176ac7194..27a1def0c 100644 --- a/src/spectral_mech_AL.f90 +++ b/src/spectral_mech_AL.f90 @@ -188,10 +188,10 @@ subroutine AL_init F => FandF_lambda( 0: 8,:,:,:) F_lambda => FandF_lambda( 9:17,:,:,:) - restart: if (restartInc > 1_pInt) then + restart: if (restartInc > 0_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart) /= 0) then - write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading values of increment ', restartInc-1_pInt, ' from file' + write(6,'(/,a,'//IO_intOut(restartInc)//',a)') & + 'reading values of increment ', restartInc, ' from file' flush(6) endif write(rankStr,'(a1,i0)')'_',worldrank @@ -207,7 +207,7 @@ subroutine AL_init read (777,rec=1) F_aimDot; close (777) F_aim = reshape(sum(sum(sum(F,dim=4),dim=3),dim=2) * wgt, [3,3]) ! average of F F_aim_lastInc = sum(sum(sum(F_lastInc,dim=5),dim=4),dim=3) * wgt ! average of F_lastInc - elseif (restartInc == 1_pInt) then restart + elseif (restartInc == 0_pInt) then restart F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity F = reshape(F_lastInc,[9,grid(1),grid(2),grid3]) F_lambda = F @@ -224,10 +224,10 @@ subroutine AL_init nullify(F_lambda) call DMDAVecRestoreArrayF90(da,solution_vec,FandF_lambda,ierr); CHKERRQ(ierr) ! write data back to PETSc - restartRead: if (restartInc > 1_pInt) then + restartRead: if (restartInc > 0_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & - write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading more values of increment ', restartInc-1_pInt, ' from file' + write(6,'(/,a,'//IO_intOut(restartInc)//',a)') & + 'reading more values of increment ', restartInc, ' from file' flush(6) call IO_read_realFile(777,'C_volAvg',trim(getSolverJobName()),size(C_volAvg)) read (777,rec=1) C_volAvg; close (777) diff --git a/src/spectral_mech_Basic.f90 b/src/spectral_mech_Basic.f90 index 44e043575..2a5e1838d 100644 --- a/src/spectral_mech_Basic.f90 +++ b/src/spectral_mech_Basic.f90 @@ -172,10 +172,10 @@ subroutine basicPETSc_init ! init fields call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! get the data out of PETSc to work with - restart: if (restartInc > 1_pInt) then + restart: if (restartInc > 0_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart) /= 0) then - write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading values of increment ', restartInc-1_pInt, ' from file' + write(6,'(/,a,'//IO_intOut(restartInc)//',a)') & + 'reading values of increment ', restartInc, ' from file' flush(6) endif write(rankStr,'(a1,i0)')'_',worldrank @@ -187,7 +187,7 @@ subroutine basicPETSc_init read (777,rec=1) F_aimDot; close (777) F_aim = reshape(sum(sum(sum(F,dim=4),dim=3),dim=2) * wgt, [3,3]) ! average of F F_aim_lastInc = sum(sum(sum(F_lastInc,dim=5),dim=4),dim=3) * wgt ! average of F_lastInc - elseif (restartInc == 1_pInt) then restart + elseif (restartInc == 0_pInt) then restart F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity F = reshape(F_lastInc,[9,grid(1),grid(2),grid3]) endif restart @@ -201,10 +201,10 @@ subroutine basicPETSc_init call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! write data back to PETSc ! QUESTION: why not writing back right after reading (l.189)? - restartRead: if (restartInc > 1_pInt) then ! QUESTION: are those values not calc'ed by constitutiveResponse? why reading from file? - if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & - write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading more values of increment ', restartInc-1_pInt, ' from file' + restartRead: if (restartInc > 0_pInt) then ! QUESTION: are those values not calc'ed by constitutiveResponse? why reading from file? + if (iand(debug_level(debug_spectral),debug_spectralRestart) /= 0 .and. worldrank == 0_pInt) & + write(6,'(/,a,'//IO_intOut(restartInc)//',a)') & + 'reading more values of increment ', restartInc, ' from file' flush(6) call IO_read_realFile(777,'C_volAvg',trim(getSolverJobName()),size(C_volAvg)) read (777,rec=1) C_volAvg; close (777) diff --git a/src/spectral_mech_Polarisation.f90 b/src/spectral_mech_Polarisation.f90 index 1a89718da..300b50142 100644 --- a/src/spectral_mech_Polarisation.f90 +++ b/src/spectral_mech_Polarisation.f90 @@ -185,10 +185,10 @@ subroutine Polarisation_init call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) ! places pointer on PETSc data F => FandF_tau( 0: 8,:,:,:) F_tau => FandF_tau( 9:17,:,:,:) - restart: if (restartInc > 1_pInt) then + restart: if (restartInc > 0_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart) /= 0) then - write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading values of increment ', restartInc - 1_pInt, ' from file' + write(6,'(/,a,'//IO_intOut(restartInc)//',a)') & + 'reading values of increment ', restartInc, ' from file' flush(6) endif write(rankStr,'(a1,i0)')'_',worldrank @@ -204,7 +204,7 @@ subroutine Polarisation_init read (777,rec=1) F_aimDot; close (777) F_aim = reshape(sum(sum(sum(F,dim=4),dim=3),dim=2) * wgt, [3,3]) ! average of F F_aim_lastInc = sum(sum(sum(F_lastInc,dim=5),dim=4),dim=3) * wgt ! average of F_lastInc - elseif (restartInc == 1_pInt) then restart + elseif (restartInc == 0_pInt) then restart F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid3) ! initialize to identity F = reshape(F_lastInc,[9,grid(1),grid(2),grid3]) F_tau = 2.0_pReal*F @@ -221,10 +221,10 @@ subroutine Polarisation_init nullify(F_tau) call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) ! write data back to PETSc - restartRead: if (restartInc > 1_pInt) then + restartRead: if (restartInc > 0_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & - write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading more values of increment ', restartInc-1_pInt, ' from file' + write(6,'(/,a,'//IO_intOut(restartInc)//',a)') & + 'reading more values of increment ', restartInc, ' from file' flush(6) call IO_read_realFile(777,'C_volAvg',trim(getSolverJobName()),size(C_volAvg)) read (777,rec=1) C_volAvg; close (777) diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 index 7b6f08a7d..874558c57 100755 --- a/src/spectral_utilities.f90 +++ b/src/spectral_utilities.f90 @@ -153,9 +153,9 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief allocates all neccessary fields, sets debug flags, create plans for FFTW -!> @details Sets the debug levels for general, divergence, restart and FFTW from the biwise coding +!> @details Sets the debug levels for general, divergence, restart, and FFTW from the bitwise coding !> provided by the debug module to logicals. -!> Allocates all fields used by FFTW and create the corresponding plans depending on the debug +!> Allocate all fields used by FFTW and create the corresponding plans depending on the debug !> level chosen. !> Initializes FFTW. !-------------------------------------------------------------------------------------------------- @@ -377,10 +377,10 @@ end subroutine utilities_init !-------------------------------------------------------------------------------------------------- -!> @brief updates references stiffness and potentially precalculated gamma operator +!> @brief updates reference stiffness and potentially precalculated gamma operator !> @details Sets the current reference stiffness to the stiffness given as an argument. !> If the gamma operator is precalculated, it is calculated with this stiffness. -!> In case of a on-the-fly calculation, only the reference stiffness is updated. +!> In case of an on-the-fly calculation, only the reference stiffness is updated. !> Also writes out the current reference stiffness for restart. !-------------------------------------------------------------------------------------------------- subroutine utilities_updateGamma(C,saveReference) From 328c35a099b5963f9a36ebe0db31a14101c1c4bb Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 17 Feb 2018 02:26:51 +0100 Subject: [PATCH 20/42] [skip ci] updated version information after successful test of v2.0.1-1078-g8949d3c --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 6abb5795c..4263ef828 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1073-gc544fa1 +v2.0.1-1078-g8949d3c From f5177b6d2dc3150a2eddbfa733959e2fdd221c76 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 20 Feb 2018 10:20:35 -0500 Subject: [PATCH 21/42] [skip ci] added option for non-periodic geometries --- processing/pre/geom_vicinityOffset.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/processing/pre/geom_vicinityOffset.py b/processing/pre/geom_vicinityOffset.py index 263b4e8d9..d4eb8e097 100755 --- a/processing/pre/geom_vicinityOffset.py +++ b/processing/pre/geom_vicinityOffset.py @@ -29,9 +29,14 @@ parser.add_option('-m', '--microstructureoffset', type = 'int', metavar = 'int', help = 'offset (positive or negative) for tagged microstructure indices. '+ '"0" selects maximum microstructure index [%default]') +parser.add_option('-n', '--nonperiodic', + dest = 'mode', + action = 'store_const', const = 'nearest', + help = 'assume geometry to be non-periodic') parser.set_defaults(vicinity = 1, offset = 0, + mode = 'wrap', ) (options, filenames) = parser.parse_args() @@ -79,8 +84,8 @@ for name in filenames: if options.offset == 0: options.offset = microstructure.max() - microstructure = np.where(ndimage.filters.maximum_filter(microstructure,size=1+2*options.vicinity,mode='wrap') == - ndimage.filters.minimum_filter(microstructure,size=1+2*options.vicinity,mode='wrap'), + microstructure = np.where(ndimage.filters.maximum_filter(microstructure,size=1+2*options.vicinity,mode=options.mode) == + ndimage.filters.minimum_filter(microstructure,size=1+2*options.vicinity,mode=options.mode), microstructure, microstructure + options.offset) newInfo['microstructures'] = microstructure.max() From a901a81ba83e81ea916fa805a352cbbe6eb467e5 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 21 Feb 2018 01:41:57 +0100 Subject: [PATCH 22/42] [skip ci] updated version information after successful test of v2.0.1-1082-g8d81e12 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4263ef828..46acd019d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1078-g8949d3c +v2.0.1-1082-g8d81e12 From 86768c38d9bac4c977679e12693b8166b402bba7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Feb 2018 10:16:27 +0100 Subject: [PATCH 23/42] source code should not be executable --- src/DAMASK_spectral.f90 | 0 src/crystallite.f90 | 0 src/spectral_utilities.f90 | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/DAMASK_spectral.f90 mode change 100755 => 100644 src/crystallite.f90 mode change 100755 => 100644 src/spectral_utilities.f90 diff --git a/src/DAMASK_spectral.f90 b/src/DAMASK_spectral.f90 old mode 100755 new mode 100644 diff --git a/src/crystallite.f90 b/src/crystallite.f90 old mode 100755 new mode 100644 diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 old mode 100755 new mode 100644 From eedec74a6a9b01208f7df726d66f62206be2eb2f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Feb 2018 12:31:23 +0100 Subject: [PATCH 24/42] correct debug reporting --- src/spectral_utilities.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 index 874558c57..c0863cebb 100644 --- a/src/spectral_utilities.f90 +++ b/src/spectral_utilities.f90 @@ -782,7 +782,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) if(debugGeneral) then write(6,'(/,a)') ' ... updating masked compliance ............................................' write(6,'(/,a,/,9(9(2x,f12.7,1x)/))',advance='no') ' Stiffness C (load) / GPa =',& - transpose(temp99_Real)/1.e9_pReal + transpose(temp99_Real)*1.0e-9_pReal flush(6) endif k = 0_pInt ! calculate reduced stiffness @@ -837,7 +837,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) endif if(debugGeneral) then write(6,'(/,a,/,9(9(2x,f10.5,1x)/),/)',advance='no') & - ' Masked Compliance (load) / GPa =', transpose(temp99_Real*1.e-9_pReal) + ' Masked Compliance (load) * GPa =', transpose(temp99_Real)*1.0e9_pReal flush(6) endif utilities_maskedCompliance = math_Plain99to3333(temp99_Real) From 42500eabffc627e76dc1dba00bc35be593b082bf Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Feb 2018 12:48:58 +0100 Subject: [PATCH 25/42] simplified (math_transpose33 does not provide any benefit here) --- src/spectral_mech_Basic.f90 | 14 +++++--------- src/spectral_mech_Polarisation.f90 | 20 +++++++------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/spectral_mech_Basic.f90 b/src/spectral_mech_Basic.f90 index 2a5e1838d..171eeacad 100644 --- a/src/spectral_mech_Basic.f90 +++ b/src/spectral_mech_Basic.f90 @@ -301,7 +301,6 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) grid3 use math, only: & math_rotate_backward33, & - math_transpose33, & math_mul3333xx33 use debug, only: & debug_level, & @@ -349,9 +348,9 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) trim(incInfo), ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & - ' deformation gradient aim (lab) =', math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) + ' deformation gradient aim (lab) =', transpose(math_rotate_backward33(F_aim,params%rotation_BC)) write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & - ' deformation gradient aim =', math_transpose33(F_aim) + ' deformation gradient aim =', transpose(F_aim) flush(6) endif newIteration @@ -516,13 +515,10 @@ subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation C_volAvgLastInc = C_volAvg C_minMaxAvgLastInc = C_minMaxAvg - - if (guess) then ! QUESTION: better with a = L ? x:y - F_aimDot = stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old ! initialize with correction based on last inc - else - F_aimDot = 0.0_pReal - endif ! components of deformation_BC%maskFloat always start out with zero + + F_aimDot = merge(stress_BC%maskFloat*(F_aim-F_aim_lastInc)/timeinc_old, 0.0_pReal, guess) F_aim_lastInc = F_aim + !-------------------------------------------------------------------------------------------------- ! calculate rate for aim if (deformation_BC%myType=='l') then ! calculate F_aimDot from given L and current F diff --git a/src/spectral_mech_Polarisation.f90 b/src/spectral_mech_Polarisation.f90 index 300b50142..acd713c70 100644 --- a/src/spectral_mech_Polarisation.f90 +++ b/src/spectral_mech_Polarisation.f90 @@ -333,7 +333,6 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) IO_intOut use math, only: & math_rotate_backward33, & - math_transpose33, & math_mul3333xx33, & math_invSym3333, & math_mul33x33 @@ -402,9 +401,9 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) trim(incInfo), ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & - ' deformation gradient aim (lab) =', math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) + ' deformation gradient aim (lab) =', transpose(math_rotate_backward33(F_aim,params%rotation_BC)) write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') & - ' deformation gradient aim =', math_transpose33(F_aim) + ' deformation gradient aim =', transpose(F_aim) flush(6) endif newIteration @@ -548,7 +547,6 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,deformati use math, only: & math_mul33x33, & math_mul3333xx33, & - math_transpose33, & math_rotate_backward33 use numerics, only: & worldrank @@ -630,11 +628,7 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,deformati C_volAvgLastInc = C_volAvg C_minMaxAvgLastInc = C_minMaxAvg - if (guess) then ! QUESTION: better with a = L ? x:y - F_aimDot = stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old ! initialize with correction based on last inc - else - F_aimDot = 0.0_pReal - endif + F_aimDot = merge(stress_BC%maskFloat*(F_aim-F_aim_lastInc)/timeinc_old, 0.0_pReal, guess) F_aim_lastInc = F_aim !-------------------------------------------------------------------------------------------------- ! calculate rate for aim @@ -676,16 +670,16 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,deformati F_lambda33 = reshape(F_tau(1:9,i,j,k)-F(1:9,i,j,k),[3,3]) F_lambda33 = math_mul3333xx33(S_scale,math_mul33x33(F_lambda33, & math_mul3333xx33(C_scale,& - math_mul33x33(math_transpose33(F_lambda33),& + math_mul33x33(transpose(F_lambda33),& F_lambda33)-math_I3))*0.5_pReal)& + math_I3 F_tau(1:9,i,j,k) = reshape(F_lambda33,[9])+F(1:9,i,j,k) enddo; enddo; enddo endif - nullify(F) - nullify(F_tau) - call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) + nullify(F) + nullify(F_tau) + call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,ierr); CHKERRQ(ierr) end subroutine Polarisation_forward From d5d71d2321c4ae766d5f1c6cc1e50dbd0881a3b7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Feb 2018 13:42:02 +0100 Subject: [PATCH 26/42] math_transpose33 has no benefit here --- src/spectral_utilities.f90 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 index c0863cebb..1a277ef63 100644 --- a/src/spectral_utilities.f90 +++ b/src/spectral_utilities.f90 @@ -935,7 +935,6 @@ subroutine utilities_constitutiveResponse(P,P_av,C_volAvg,C_minmaxAvg,& debug_reset, & debug_info use math, only: & - math_transpose33, & math_rotate_forward33, & math_det33 use mesh, only: & @@ -994,10 +993,10 @@ subroutine utilities_constitutiveResponse(P,P_av,C_volAvg,C_minmaxAvg,& call MPI_Allreduce(MPI_IN_PLACE,P_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) if (debugRotation) & write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress (lab) / MPa =',& - math_transpose33(P_av)*1.e-6_pReal + transpose(P_av)*1.e-6_pReal P_av = math_rotate_forward33(P_av,rotation_BC) write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',& - math_transpose33(P_av)*1.e-6_pReal + transpose(P_av)*1.e-6_pReal flush(6) max_dPdF = 0.0_pReal From c2ced6a27403576b1daed640ac6134b63bd12238 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Feb 2018 14:45:35 +0100 Subject: [PATCH 27/42] not needed anymore --- src/spectral_utilities.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 index 1a277ef63..e3383f3d1 100644 --- a/src/spectral_utilities.f90 +++ b/src/spectral_utilities.f90 @@ -70,7 +70,6 @@ module spectral_utilities ! derived types type, public :: tSolutionState !< return type of solution from spectral solver variants logical :: converged = .true. - logical :: regrid = .false. logical :: stagConverged = .true. logical :: termIll = .false. integer(pInt) :: iterationsNeeded = 0_pInt From bc998846abd15532cf705c5f3455e87d4ccf9921 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 25 Feb 2018 14:14:03 -0500 Subject: [PATCH 28/42] thermal expansion coefficient alpha = a + b(T-T_0) + c(T-T_0)^2 --- src/kinematics_thermal_expansion.f90 | 21 +++++++++--- src/lattice.f90 | 49 ++++++++++++++++------------ 2 files changed, 45 insertions(+), 25 deletions(-) diff --git a/src/kinematics_thermal_expansion.f90 b/src/kinematics_thermal_expansion.f90 index bb9083efb..0de483d70 100644 --- a/src/kinematics_thermal_expansion.f90 +++ b/src/kinematics_thermal_expansion.f90 @@ -174,8 +174,12 @@ pure function kinematics_thermal_expansion_initialStrain(ipc, ip, el) offset = thermalMapping(homog)%p(ip,el) kinematics_thermal_expansion_initialStrain = & - (temperature(homog)%p(offset) - lattice_referenceTemperature(phase)) * & - lattice_thermalExpansion33(1:3,1:3,phase) + (temperature(homog)%p(offset) - lattice_referenceTemperature(phase))**1 / 1. * & + lattice_thermalExpansion33(1:3,1:3,1,phase) + & ! constant coefficient + (temperature(homog)%p(offset) - lattice_referenceTemperature(phase))**2 / 2. * & + lattice_thermalExpansion33(1:3,1:3,2,phase) + & ! linear coefficient + (temperature(homog)%p(offset) - lattice_referenceTemperature(phase))**3 / 3. * & + lattice_thermalExpansion33(1:3,1:3,3,phase) ! quadratic coefficient end function kinematics_thermal_expansion_initialStrain @@ -215,9 +219,16 @@ subroutine kinematics_thermal_expansion_LiAndItsTangent(Li, dLi_dTstar3333, ipc, TDot = temperatureRate(homog)%p(offset) TRef = lattice_referenceTemperature(phase) - Li = TDot* & - lattice_thermalExpansion33(1:3,1:3,phase)/ & - (1.0_pReal + lattice_thermalExpansion33(1:3,1:3,phase)*(T - TRef)) + Li = TDot * ( & + lattice_thermalExpansion33(1:3,1:3,1,phase)*(T - TRef)**0 & ! constant coefficient + + lattice_thermalExpansion33(1:3,1:3,2,phase)*(T - TRef)**1 & ! linear coefficient + + lattice_thermalExpansion33(1:3,1:3,3,phase)*(T - TRef)**2 & ! quadratic coefficient + ) / & + (1.0_pReal \ + + lattice_thermalExpansion33(1:3,1:3,1,phase)*(T - TRef)**1 / 1. & + + lattice_thermalExpansion33(1:3,1:3,2,phase)*(T - TRef)**2 / 2. & + + lattice_thermalExpansion33(1:3,1:3,3,phase)*(T - TRef)**3 / 3. & + ) dLi_dTstar3333 = 0.0_pReal end subroutine kinematics_thermal_expansion_LiAndItsTangent diff --git a/src/lattice.f90 b/src/lattice.f90 index f46d0ef93..37393b82e 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -1082,9 +1082,10 @@ module lattice lattice_nu, & lattice_trans_mu, & lattice_trans_nu + real(pReal), dimension(:,:,:,:), allocatable, public, protected :: & ! with higher-order parameters (e.g. temperature-dependent) + lattice_thermalExpansion33 real(pReal), dimension(:,:,:), allocatable, public, protected :: & lattice_thermalConductivity33, & - lattice_thermalExpansion33, & lattice_damageDiffusion33, & lattice_vacancyfluxDiffusion33, & lattice_vacancyfluxMobility33, & @@ -1380,8 +1381,8 @@ subroutine lattice_init allocate(lattice_C3333(3,3,3,3,Nphases), source=0.0_pReal) allocate(lattice_trans_C66(6,6,Nphases), source=0.0_pReal) allocate(lattice_trans_C3333(3,3,3,3,Nphases), source=0.0_pReal) + allocate(lattice_thermalExpansion33 (3,3,3,Nphases), source=0.0_pReal) ! constant, linear, quadratic coefficients allocate(lattice_thermalConductivity33 (3,3,Nphases), source=0.0_pReal) - allocate(lattice_thermalExpansion33 (3,3,Nphases), source=0.0_pReal) allocate(lattice_damageDiffusion33 (3,3,Nphases), source=0.0_pReal) allocate(lattice_vacancyfluxDiffusion33 (3,3,Nphases), source=0.0_pReal) allocate(lattice_vacancyfluxMobility33 (3,3,Nphases), source=0.0_pReal) @@ -1545,11 +1546,17 @@ subroutine lattice_init case ('thermal_conductivity33') lattice_thermalConductivity33(3,3,section) = IO_floatValue(line,chunkPos,2_pInt) case ('thermal_expansion11') - lattice_thermalExpansion33(1,1,section) = IO_floatValue(line,chunkPos,2_pInt) + do i = 2_pInt, min(4,chunkPos(1)) ! read up to three parameters (constant, linear, quadratic with T) + lattice_thermalExpansion33(1,1,i-1_pInt,section) = IO_floatValue(line,chunkPos,i) + enddo case ('thermal_expansion22') - lattice_thermalExpansion33(2,2,section) = IO_floatValue(line,chunkPos,2_pInt) + do i = 2_pInt, min(4,chunkPos(1)) ! read up to three parameters (constant, linear, quadratic with T) + lattice_thermalExpansion33(2,2,i-1_pInt,section) = IO_floatValue(line,chunkPos,i) + enddo case ('thermal_expansion33') - lattice_thermalExpansion33(3,3,section) = IO_floatValue(line,chunkPos,2_pInt) + do i = 2_pInt, min(4,chunkPos(1)) ! read up to three parameters (constant, linear, quadratic with T) + lattice_thermalExpansion33(3,3,i-1_pInt,section) = IO_floatValue(line,chunkPos,i) + enddo case ('specific_heat') lattice_specificHeat(section) = IO_floatValue(line,chunkPos,2_pInt) case ('vacancyformationenergy') @@ -1756,22 +1763,24 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) end select end select - lattice_thermalConductivity33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& - lattice_thermalConductivity33(1:3,1:3,myPhase)) - lattice_thermalExpansion33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& - lattice_thermalExpansion33(1:3,1:3,myPhase)) - lattice_DamageDiffusion33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& - lattice_DamageDiffusion33(1:3,1:3,myPhase)) - lattice_vacancyfluxDiffusion33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& - lattice_vacancyfluxDiffusion33(1:3,1:3,myPhase)) - lattice_vacancyfluxMobility33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& - lattice_vacancyfluxMobility33(1:3,1:3,myPhase)) - lattice_PorosityDiffusion33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& - lattice_PorosityDiffusion33(1:3,1:3,myPhase)) + forall (i = 1_pInt:3_pInt) & + lattice_thermalExpansion33 (1:3,1:3,i,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& + lattice_thermalExpansion33 (1:3,1:3,i,myPhase)) + + lattice_thermalConductivity33 (1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& + lattice_thermalConductivity33 (1:3,1:3,myPhase)) + lattice_DamageDiffusion33 (1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& + lattice_DamageDiffusion33 (1:3,1:3,myPhase)) + lattice_vacancyfluxDiffusion33 (1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& + lattice_vacancyfluxDiffusion33 (1:3,1:3,myPhase)) + lattice_vacancyfluxMobility33 (1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& + lattice_vacancyfluxMobility33 (1:3,1:3,myPhase)) + lattice_PorosityDiffusion33 (1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& + lattice_PorosityDiffusion33 (1:3,1:3,myPhase)) lattice_hydrogenfluxDiffusion33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& - lattice_hydrogenfluxDiffusion33(1:3,1:3,myPhase)) - lattice_hydrogenfluxMobility33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& - lattice_hydrogenfluxMobility33(1:3,1:3,myPhase)) + lattice_hydrogenfluxDiffusion33(1:3,1:3,myPhase)) + lattice_hydrogenfluxMobility33 (1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& + lattice_hydrogenfluxMobility33 (1:3,1:3,myPhase)) select case(lattice_structure(myPhase)) !-------------------------------------------------------------------------------------------------- From b07823464477b1fadf4f7897eaeec1130c27ccaf Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 25 Feb 2018 14:16:55 -0500 Subject: [PATCH 29/42] added scipy and scipy.linalg as known modules for calculations --- processing/post/addCalculation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 85c52621b..0e1f1c8d8 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -2,7 +2,7 @@ # -*- coding: UTF-8 no BOM -*- import os,re,sys,collections -import math # noqa +import math,scipy,scipy.linalg # noqa import numpy as np from optparse import OptionParser import damask From e1c4c7e6e8feedd1bcb40fd7574f499489d1ab33 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Feb 2018 21:01:23 +0100 Subject: [PATCH 30/42] wrong indices in matrix rotation fixing this resolves issue 14: "Poor performance after load case rotation" now inline with http://www.continuummechanics.org/rotationmatrix.html C'_mnop = R_mi R_nj R_ok R_pl C_ijkl --- src/math.f90 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index ee228834a..055ec6c62 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -2755,8 +2755,7 @@ pure function math_rotate_forward33(tensor,rot_tensor) real(pReal), dimension(3,3) :: math_rotate_forward33 real(pReal), dimension(3,3), intent(in) :: tensor, rot_tensor - math_rotate_forward33 = math_mul33x33(rot_tensor,& - math_mul33x33(tensor,math_transpose33(rot_tensor))) + math_rotate_forward33 = math_mul33x33(rot_tensor,math_mul33x33(tensor,transpose(rot_tensor))) end function math_rotate_forward33 @@ -2770,8 +2769,7 @@ pure function math_rotate_backward33(tensor,rot_tensor) real(pReal), dimension(3,3) :: math_rotate_backward33 real(pReal), dimension(3,3), intent(in) :: tensor, rot_tensor - math_rotate_backward33 = math_mul33x33(math_transpose33(rot_tensor),& - math_mul33x33(tensor,rot_tensor)) + math_rotate_backward33 = math_mul33x33(transpose(rot_tensor),math_mul33x33(tensor,rot_tensor)) end function math_rotate_backward33 @@ -2791,7 +2789,7 @@ pure function math_rotate_forward3333(tensor,rot_tensor) do i = 1_pInt,3_pInt; do j = 1_pInt,3_pInt; do k = 1_pInt,3_pInt; do l = 1_pInt,3_pInt do m = 1_pInt,3_pInt; do n = 1_pInt,3_pInt; do o = 1_pInt,3_pInt; do p = 1_pInt,3_pInt - math_rotate_forward3333(i,j,k,l) = math_rotate_forward3333(i,j,k,l) & + math_rotate_forward3333(m,n,o,p) = math_rotate_forward3333(i,j,k,l) & + rot_tensor(m,i) * rot_tensor(n,j) & * rot_tensor(o,k) * rot_tensor(p,l) * tensor(m,n,o,p) enddo; enddo; enddo; enddo; enddo; enddo; enddo; enddo From 30d66c2d678772f0ea96fc9dd5b9ab1a1f8f4827 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 26 Feb 2018 09:50:06 +0100 Subject: [PATCH 31/42] [skip ci] updated version information after successful test of v2.0.1-1084-gb078234 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 46acd019d..089a50732 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1082-g8d81e12 +v2.0.1-1084-gb078234 From cd4115bada88783012b6cd6014457768cb95465f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 26 Feb 2018 11:14:02 +0100 Subject: [PATCH 32/42] now using the correct rotation formula --- src/math.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 055ec6c62..de27519e8 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -2789,9 +2789,9 @@ pure function math_rotate_forward3333(tensor,rot_tensor) do i = 1_pInt,3_pInt; do j = 1_pInt,3_pInt; do k = 1_pInt,3_pInt; do l = 1_pInt,3_pInt do m = 1_pInt,3_pInt; do n = 1_pInt,3_pInt; do o = 1_pInt,3_pInt; do p = 1_pInt,3_pInt - math_rotate_forward3333(m,n,o,p) = math_rotate_forward3333(i,j,k,l) & + math_rotate_forward3333(m,n,o,p) = math_rotate_forward3333(m,n,o,p) & + rot_tensor(m,i) * rot_tensor(n,j) & - * rot_tensor(o,k) * rot_tensor(p,l) * tensor(m,n,o,p) + * rot_tensor(o,k) * rot_tensor(p,l) * tensor(i,j,k,l) enddo; enddo; enddo; enddo; enddo; enddo; enddo; enddo end function math_rotate_forward3333 From e716441787d620d39ae9f3dd01f2e4476ebb40cc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 26 Feb 2018 20:18:38 +0100 Subject: [PATCH 33/42] indexing now follows description --- src/math.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index de27519e8..7e35ca390 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -2789,9 +2789,9 @@ pure function math_rotate_forward3333(tensor,rot_tensor) do i = 1_pInt,3_pInt; do j = 1_pInt,3_pInt; do k = 1_pInt,3_pInt; do l = 1_pInt,3_pInt do m = 1_pInt,3_pInt; do n = 1_pInt,3_pInt; do o = 1_pInt,3_pInt; do p = 1_pInt,3_pInt - math_rotate_forward3333(m,n,o,p) = math_rotate_forward3333(m,n,o,p) & - + rot_tensor(m,i) * rot_tensor(n,j) & - * rot_tensor(o,k) * rot_tensor(p,l) * tensor(i,j,k,l) + math_rotate_forward3333(i,j,k,l) = math_rotate_forward3333(i,j,k,l) & + + rot_tensor(i,m) * rot_tensor(j,n) & + * rot_tensor(k,o) * rot_tensor(l,p) * tensor(m,n,o,p) enddo; enddo; enddo; enddo; enddo; enddo; enddo; enddo end function math_rotate_forward3333 From 6046a7ae3d0ca9c5cf6c603ef6e965250acc9b2a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 26 Feb 2018 20:22:57 +0100 Subject: [PATCH 34/42] there is no scipy.linalg (at least on my system) numpy.linalg is automatically imported together with numpy --- processing/post/addCalculation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 0e1f1c8d8..64f55cde3 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -2,7 +2,7 @@ # -*- coding: UTF-8 no BOM -*- import os,re,sys,collections -import math,scipy,scipy.linalg # noqa +import math,scipy # noqa import numpy as np from optparse import OptionParser import damask From 1bbaa7cefe455876b092849ba55436ad29470a81 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 26 Feb 2018 23:50:44 +0100 Subject: [PATCH 35/42] reverted last commit, scipy.linalg is different from numpy.linalg --- processing/post/addCalculation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 64f55cde3..024e81cb6 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -2,7 +2,7 @@ # -*- coding: UTF-8 no BOM -*- import os,re,sys,collections -import math,scipy # noqa +import math,scipy,scipy.linalg # noqa import numpy as np from optparse import OptionParser import damask From f35a88d2c4ed30a08d1a80326da1b1798180e1c9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 26 Feb 2018 23:51:23 +0100 Subject: [PATCH 36/42] it's 2018 already --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index f6371f259..630dc3a84 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2011-17 Max-Planck-Institut für Eisenforschung GmbH +Copyright 2011-18 Max-Planck-Institut für Eisenforschung GmbH DAMASK is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From 3a4506c5aeaaf6c68de59a2570d022773a9d014d Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 27 Feb 2018 10:01:02 +0100 Subject: [PATCH 37/42] [skip ci] updated version information after successful test of v2.0.1-1088-gf35a88d --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 089a50732..ee3681e62 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1084-gb078234 +v2.0.1-1088-gf35a88d From 5c2aeedb73f03da0b75f1e5250a54f6cbaa1a820 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 27 Feb 2018 19:18:18 +0100 Subject: [PATCH 38/42] [skip ci] updated version information after successful test of v2.0.1-1097-gcb073fe --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 089a50732..1a8166caf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1084-gb078234 +v2.0.1-1097-gcb073fe From 03c643c4335b35e13261d0bbb524f9faca3f7edc Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 1 Mar 2018 06:25:54 +0100 Subject: [PATCH 39/42] [skip ci] updated version information after successful test of v2.0.1-1104-g88c46d5 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ee3681e62..aa98e7d3f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1088-gf35a88d +v2.0.1-1104-g88c46d5 From 32c34457c28a558a6afefa3b3d8d87e6e07fd78c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 7 Mar 2018 17:45:22 -0500 Subject: [PATCH 40/42] direct selection of valid seed coordinates within subfraction of unit cube instead of check and repeat --- processing/pre/seeds_fromRandom.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/processing/pre/seeds_fromRandom.py b/processing/pre/seeds_fromRandom.py index 0df292ed2..3045359ef 100755 --- a/processing/pre/seeds_fromRandom.py +++ b/processing/pre/seeds_fromRandom.py @@ -166,25 +166,11 @@ for name in filenames: grainEuler[2,:] *= 360.0 # phi_2 is uniformly distributed if not options.selective: - seeds = np.array([]) + n = np.array(options.grid * options.fraction,dtype=int) # find valid grid indices within fraction + meshgrid = np.meshgrid(*map(np.arange,n),indexing='ij') # create a meshgrid within fraction - while len(seeds) < options.N: - - theSeeds = np.zeros((options.N,3),dtype=float) # seed positions array - gridpoints = random.sample(range(gridSize),options.N) # choose first N from random permutation of grid positions - - theSeeds[:,0] = (np.mod(gridpoints ,options.grid[0])\ - +np.random.random(options.N)) /options.grid[0] - theSeeds[:,1] = (np.mod(gridpoints// options.grid[0] ,options.grid[1])\ - +np.random.random(options.N)) /options.grid[1] - theSeeds[:,2] = (np.mod(gridpoints//(options.grid[1]*options.grid[0]),options.grid[2])\ - +np.random.random(options.N)) /options.grid[2] - - goodSeeds = theSeeds[np.all(theSeeds<=options.fraction,axis=1)] # pick seeds within threshold fraction - seeds = goodSeeds if len(seeds) == 0 else np.vstack((seeds,goodSeeds)) - if len(seeds) > options.N: seeds = seeds[:min(options.N,len(seeds))] - - seeds = seeds.T # switch layout to point index as last index + coords = np.vstack((meshgrid[0],meshgrid[1],meshgrid[2])).reshape(3,n.prod()).T # assemble list of 3D coordinates + seeds = ((random.sample(coords,options.N)+np.random.random(options.N*3).reshape(options.N,3))/options.grid).T # pick options.N of those and rattle position else: From 2c3eae6bf0b43d6cab68c12ac5430209c67976ce Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 7 Mar 2018 18:58:28 -0500 Subject: [PATCH 41/42] fixed tests and bug for very small unit cube fractions when grid is also small --- PRIVATE | 2 +- processing/pre/seeds_fromRandom.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/PRIVATE b/PRIVATE index 8de4f792a..8546f9bda 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 8de4f792a46d98d98418dbf2d3e621b22c13b18a +Subproject commit 8546f9bda04b58c3b26979048288a8a01f607876 diff --git a/processing/pre/seeds_fromRandom.py b/processing/pre/seeds_fromRandom.py index 3045359ef..77bacdc8e 100755 --- a/processing/pre/seeds_fromRandom.py +++ b/processing/pre/seeds_fromRandom.py @@ -166,14 +166,15 @@ for name in filenames: grainEuler[2,:] *= 360.0 # phi_2 is uniformly distributed if not options.selective: - n = np.array(options.grid * options.fraction,dtype=int) # find valid grid indices within fraction + n = np.maximum(np.ones(3),np.array(options.grid*options.fraction), + dtype=int,casting='unsafe') # find max grid indices within fraction meshgrid = np.meshgrid(*map(np.arange,n),indexing='ij') # create a meshgrid within fraction - coords = np.vstack((meshgrid[0],meshgrid[1],meshgrid[2])).reshape(3,n.prod()).T # assemble list of 3D coordinates - seeds = ((random.sample(coords,options.N)+np.random.random(options.N*3).reshape(options.N,3))/options.grid).T # pick options.N of those and rattle position - + seeds = ((random.sample(coords,options.N)+np.random.random(options.N*3).reshape(options.N,3))\ + / \ + (n/options.fraction)).T # pick options.N of those, rattle position, + # and rescale to fall within fraction else: - seeds = np.zeros((options.N,3),dtype=float) # seed positions array seeds[0] = np.random.random(3)*options.grid/max(options.grid) i = 1 # start out with one given point From 48fce3a49eff13b69936e72c5341325d5f9d5b23 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 8 Mar 2018 10:15:17 +0100 Subject: [PATCH 42/42] [skip ci] updated version information after successful test of v2.0.1-1107-g2c3eae6 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index aa98e7d3f..becfecaca 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-1104-g88c46d5 +v2.0.1-1107-g2c3eae6