diff --git a/.github/workflows/Fortran.yml b/.github/workflows/Fortran.yml index d93cdd27f..e9175bd53 100644 --- a/.github/workflows/Fortran.yml +++ b/.github/workflows/Fortran.yml @@ -2,7 +2,7 @@ name: Grid and Mesh Solver on: [push] env: - PETSC_VERSION: '3.17.0' + PETSC_VERSION: '3.17.1' HOMEBREW_NO_ANALYTICS: 'ON' # Make Homebrew installation a little quicker HOMEBREW_NO_AUTO_UPDATE: 'ON' HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 'ON' diff --git a/.github/workflows/Python.yml b/.github/workflows/Python.yml index 9329fb6fc..2f2a5d111 100644 --- a/.github/workflows/Python.yml +++ b/.github/workflows/Python.yml @@ -32,16 +32,23 @@ jobs: export VERSION=$(cat VERSION) echo ${VERSION%-*} > VERSION + - name: Strip git hash (Windows) + if: runner.os == 'Windows' + run: | + $VERSION = Get-Content VERSION -first 1 + $VERSION,$_ = $VERSION -Split '-g',2,"simplematch" + $VERSION | Out-File VERSION + - name: Install and run unit tests (Unix) if: runner.os != 'Windows' run: | - python -m pip install ./python --no-deps -vv --use-feature=in-tree-build + python -m pip install ./python --no-deps -vv COLUMNS=256 pytest python - name: Install and run unit tests (Windows) if: runner.os == 'Windows' run: | - python -m pip install ./python --no-deps -vv --use-feature=in-tree-build + python -m pip install ./python --no-deps -vv pytest python -k 'not XDMF' apt: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c19d36f35..faaf66564 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ variables: PETSC_INTELLLVM: "Libraries/PETSc/3.16.3/oneAPI-2022.0.1-IntelMPI-2021.5.0" PETSC_INTEL: "Libraries/PETSc/3.16.5/Intel-2022.0.1-IntelMPI-2021.5.0" # ++++++++++++ MSC Marc +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - MSC: "FEM/MSC/2021.3.1" + MSC: "FEM/MSC/2022.1" IntelMarc: "Compiler/Intel/19.1.2 Libraries/IMKL/2020" HDF5Marc: "HDF5/1.12.1/Intel-19.1.2" @@ -164,8 +164,8 @@ setup_Marc: - cd $(mktemp -d) - cp ${CI_PROJECT_DIR}/examples/Marc/* . - python3 -c "import damask;damask.solver.Marc().submit_job('r-value','texture',True,'h')" - - mkdir ${TESTROOT}/src - - mv ${CI_PROJECT_DIR}/src/DAMASK_Marc.marc ${TESTROOT}/src + - mkdir -p ${TESTROOT}/src/Marc + - mv ${CI_PROJECT_DIR}/src/Marc/DAMASK_Marc.marc ${TESTROOT}/src/Marc ################################################################################################### diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b341dbbe..d24d9b8b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ message("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n") add_definitions(-DPETSC) add_definitions(-DDAMASKVERSION="${DAMASK_VERSION}") add_definitions(-DCMAKE_SYSTEM="${CMAKE_SYSTEM}") -if(PETSC_VERSION VERSION_GREATER_EQUAL 3.17.0) +if(PETSC_VERSION VERSION_EQUAL 3.17.0) add_definitions("-DCHKERRQ=PetscCall") endif() diff --git a/PRIVATE b/PRIVATE index 3561f74a5..0e82975b2 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 3561f74a5852c32e2c3da4dc48090b517cfa8e90 +Subproject commit 0e82975b23a1bd4310c523388f1cadf1b8e03dd0 diff --git a/VERSION b/VERSION index c5ac07ef6..323a6d77e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-266-g5776891b7 +3.0.0-alpha6-381-gd2c072604 diff --git a/examples/config/debug.yaml b/examples/config/debug.yaml index 900873b25..fef3cedeb 100644 --- a/examples/config/debug.yaml +++ b/examples/config/debug.yaml @@ -1,5 +1,5 @@ phase: [basic, extensive, selective] -CPFEM: [basic, extensive, selective] +materialpoint: [basic, extensive, selective] # options for selective debugging element: 1 diff --git a/examples/config/phase/Pt.yaml b/examples/config/phase/Pt.yaml new file mode 100644 index 000000000..90d8ba2f2 --- /dev/null +++ b/examples/config/phase/Pt.yaml @@ -0,0 +1,5 @@ +references: + - https://en.wikipedia.org/wiki/Platinum + +lattice: cF +rho: 21450.0 diff --git a/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml b/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml new file mode 100644 index 000000000..1411de6f4 --- /dev/null +++ b/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml @@ -0,0 +1,21 @@ +type: Hooke + +references: + - Wang et al., + Materials Science and Engineering:A 674:406-412, 2016, + https://doi.org/10.1016/j.msea.2016.08.010, + fitted to Tab. 2 (last 3 rows) + +C_11: 243.3e+9 +C_11,T: -6.380e+5 +C_11,T^2: -8.362e+4 + +C_12: 156.7e+9 +C_12,T: 2.091e+7 +C_12,T^2: -4.675e+4 + +C_44: 117.8e+9 +C_44,T: -3.800e+7 +C_44,T^2: 1.587e+4 + +T_ref: 293.15 diff --git a/examples/config/phase/mechanical/elastic/Hooke_Pt.yaml b/examples/config/phase/mechanical/elastic/Hooke_Pt.yaml new file mode 100644 index 000000000..88513b8ac --- /dev/null +++ b/examples/config/phase/mechanical/elastic/Hooke_Pt.yaml @@ -0,0 +1,26 @@ +type: Hooke + +references: + - S.M. Collard and R.B. McLellan, + Acta Metallurgica et Materialia 40:699-702, 1992, + https://doi.org/10.1016/0956-7151(92)90011-3 + +C_11: 373.42e+9 +C_11,T: -8.929e+7 +C_11,T^2: -1.298e+5 +C_11,T^3: 1.2807e+2 +C_11,T^4: -4.6114e-2 + +C_12: 241.74e+9 +C_12,T: 5.705e+7 +C_12,T^2: 0.4511e+5 +C_12,T^3: -0.4860e+2 +C_12,T^4: 1.446e-2 + +C_44: 77.65e+9 +C_44,T: -1.342e+7 +C_44,T^2: -0.1493e+5 +C_44,T^3: 0.1260e+2 +C_44,T^4: -0.6470e-2 + +T_ref: 0 diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml new file mode 100644 index 000000000..864237825 --- /dev/null +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml @@ -0,0 +1,20 @@ +type: phenopowerlaw + +references: + - K.M. Jackson and C. Lang, + Platinum Metals Review 50:15-19, 2006, + https://doi.org/10.1595/147106705X93359, + fitted from Fig. 5 (Pt-5% Cu recrystallised) + - U.F. Kocks, + Metallurgical and Materials Transactions B 1:1121–1143, 1970, + https://doi.org/10.1007/BF02900224 + +N_sl: [12] + +n_sl: 1.6 +a_sl: 0.8 +h_0_sl-sl: 300.0e+6 +xi_0_sl: [150.0e+6] +xi_inf_sl: [500.0e+6] +h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] +dot_gamma_0_sl: 0.0001 diff --git a/install/MarcMentat/2020/Marc_tools/include_linux64.patch b/install/MarcMentat/2020/Marc_tools/include_linux64.patch index 133ca07cb..043b887f0 100644 --- a/install/MarcMentat/2020/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2020/Marc_tools/include_linux64.patch @@ -56,15 +56,15 @@ + +# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3 +DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD" +DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD" +DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD" diff --git a/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch b/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch index 452618457..e8dede2ea 100644 --- a/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch @@ -56,15 +56,15 @@ + +# DAMASK compiler calls +DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" +DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" +DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" diff --git a/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch index 4adec9db1..5d78b22f8 100644 --- a/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch @@ -21,6 +21,7 @@ I8DEFINES="-DI64" I8CDEFINES="-U_DOUBLE -D_SINGLE" fi + @@ -556,7 +561,7 @@ then PROFILE=" $PROFILE -pg" fi @@ -55,15 +56,15 @@ + +# DAMASK compiler calls +DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" +DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" +DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" + diff --git a/install/MarcMentat/2022.1/Marc_tools/comp_damask_hmp.patch b/install/MarcMentat/2022.1/Marc_tools/comp_damask_hmp.patch new file mode 100644 index 000000000..8dda8e1ce --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/comp_damask_hmp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ echo "program: $program" + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2022.1/Marc_tools/comp_damask_lmp.patch b/install/MarcMentat/2022.1/Marc_tools/comp_damask_lmp.patch new file mode 100644 index 000000000..6ea9c098f --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/comp_damask_lmp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTRANLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ echo "program: $program" + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2022.1/Marc_tools/comp_damask_mp.patch b/install/MarcMentat/2022.1/Marc_tools/comp_damask_mp.patch new file mode 100644 index 000000000..3316227d6 --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/comp_damask_mp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ echo "program: $program" + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch new file mode 100644 index 000000000..8cf6d2113 --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch @@ -0,0 +1,99 @@ +--- ++++ +@@ -166,6 +166,11 @@ if test -n "$MSCCOSIM_HOME"; then + MARC_COSIM_LIB="$MSCCOSIM_HOME/Cosim$MSCCOSIM_VERSION/Dcosim$MSCCOSIM_VERSION/lib" + fi + ++# DAMASK uses the HDF5 compiler wrapper around the Intel compiler ++H5FC="$(h5fc -shlib -show)" ++HDF5_LIB=${H5FC//ifort/} ++FCOMP="$H5FC" ++ + # AEM + if test "$MARCDLLOUTDIR" = ""; then + DLLOUTDIR="$MARC_LIB" +@@ -477,8 +482,8 @@ if test "$MARC_INTEGER_SIZE" = "i4" ; then + I8DEFINES= + I8CDEFINES= + else +- I8FFLAGS="-i8" ++ I8FFLAGS="-i8 -integer-size 64" + I8DEFINES="-DI64" + I8CDEFINES="-U_DOUBLE -D_SINGLE" + fi + +@@ -594,7 +599,7 @@ then + PROFILE=" $PROFILE -pg" + fi + +-FORT_OPT="-c -assume byterecl -safe_cray_ptr -mp1 -WB -fp-model source" ++FORT_OPT="-c -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr -mp1 -WB -fp-model source" + if test "$MTHREAD" = "OPENMP" + then + FORT_OPT=" $FORT_OPT -qopenmp" +@@ -607,7 +612,7 @@ else + FORT_OPT=" $FORT_OPT -save -zero" + fi + if test "$MARCHDF_HDF" = "HDF"; then +- FORT_OPT="$FORT_OPT -DMARCHDF_HDF=$MARCHDF_HDF $HDF_INCLUDE" ++ FORT_OPT="$FORT_OPT -DMARCHDF=$MARCHDF_HDF" + fi + + FORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ +@@ -621,6 +626,29 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ + # for compiling free form f90 files. high opt, integer(4) + FORTF90="$FCOMP -c -O3" + ++# determine DAMASK version ++if test -n "$DAMASK_USER"; then ++ DAMASKROOT=`dirname $DAMASK_USER`/.. ++ read DAMASKVERSION < $DAMASKROOT/VERSION ++ DAMASKVERSION="'"$DAMASKVERSION"'" ++else ++ DAMASKVERSION="'N/A'" ++fi ++ ++# DAMASK compiler calls ++DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2022.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2022.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2022.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++ + if test "$MARCDEBUG" = "ON" + then + FORTLOW="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \ +@@ -778,7 +806,7 @@ SECLIBS="-L$MARC_LIB -llapi" + + SOLVERLIBS="${BCSSOLVERLIBS} ${VKISOLVERLIBS} ${CASISOLVERLIBS} ${MF2SOLVERLIBS} \ + -L$MARC_MKL \ +- $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs $HDF_LIBS $SOLVER2LIBS" ++ $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs $HDF5_LIB $SOLVER2LIBS" + + SOLVERLIBS_DLL=${SOLVERLIBS} + if test "$AEM_DLL" -eq 1 +@@ -802,7 +830,7 @@ then + OPENSSL=NONE + fi + +-SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib $MARC_RPC_LIB" ++SYSLIBS=" $OPENMP -lpthread -cxxlib $MARC_RPC_LIB" + + # Uncomment the following lines to turn on the trace and comment out the next 4 lines + # if test $MPITYPE = intelmpi +@@ -812,7 +840,7 @@ SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib $MARC_RPC_LIB" + # fi + if test $MPITYPE = intelmpi + then +- SYSLIBS="-L${MPI_ROOT}/lib/release -lmpi -L${MPI_ROOT}/lib -lmpifort -lrt $OPENMP -threads -lpthread -shared-intel -cxxlib $MARC_RPC_LIB" ++ SYSLIBS="-L${MPI_ROOT}/lib/release -lmpi -L${MPI_ROOT}/lib -lmpifort -lrt $OPENMP -threads -lpthread -cxxlib $MARC_RPC_LIB" + fi + + if test "$ZLIB" = "ZLIB"; then diff --git a/install/MarcMentat/2022.1/Marc_tools/run_damask_hmp.patch b/install/MarcMentat/2022.1/Marc_tools/run_damask_hmp.patch new file mode 100644 index 000000000..e3a364e00 --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/run_damask_hmp.patch @@ -0,0 +1,710 @@ +--- ++++ +@@ -302,7 +302,23 @@ fi + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +421,7 @@ sid= + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -573,7 +589,7 @@ do + justlist=yes + ;; + -fe* | -FE*) +- feature=$value ++ feature=$value + + ;; + -pr* | -PR*) +@@ -676,50 +692,19 @@ do + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -739,19 +724,19 @@ do + ;; + esac + ;; +- -dl | -DL) +- case $value in +- y* | Y*) +- deletelog=yes +- ;; +- n* | N*) +- deletelog=no +- ;; +- *) +- ;; +- esac ++ -dl | -DL) ++ case $value in ++ y* | Y*) ++ deletelog=yes ++ ;; ++ n* | N*) ++ deletelog=no ++ ;; ++ *) ++ ;; ++ esac + +- ;; ++ ;; + -at | -AT) + att=$value + ;; +@@ -1207,12 +1192,12 @@ post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 or $DIRPID/$pid.h5 not accessible + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1386,7 +1371,7 @@ else + else + error="$error + job id required" +- fi ++fi + fi + + case $qid in +@@ -1531,7 +1516,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1564,7 +1549,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1687,7 +1672,7 @@ Program name ($prog)? $ECHOTXT" + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1681,19 @@ Program name ($prog)? $ECHOTXT" + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in +- \/*) +- ;; +- *) ++ \/*) ++ ;; ++ *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname +- ;; +- esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ ;; ++ esac ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2228,12 @@ fi + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2346,7 @@ fi + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3229,27 @@ then + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usermoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3331,10 +3269,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -3344,6 +3283,9 @@ else + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3390,7 +3332,7 @@ if test $dllrun -eq 0; then + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3556,7 +3498,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3569,21 +3511,21 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3593,39 +3535,27 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3645,10 +3575,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + echo " $PRODUCT Exit number 3" +@@ -3686,6 +3617,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3744,42 +3678,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3904,7 +3838,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3917,20 +3851,20 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3940,37 +3874,25 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3990,10 +3912,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -4030,7 +3953,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4070,7 +3995,7 @@ if test $ddm_arc -gt 0; then + RUN_JOB="$BINDIR/exeddm $RUN_JOB -ddm $ddm_arc " + fi + +-$RUN_JOB ++ $RUN_JOB + + if test $nprocd -gt 1 + then +@@ -4114,42 +4039,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2022.1/Marc_tools/run_damask_lmp.patch b/install/MarcMentat/2022.1/Marc_tools/run_damask_lmp.patch new file mode 100644 index 000000000..a5989bfca --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/run_damask_lmp.patch @@ -0,0 +1,710 @@ +--- ++++ +@@ -302,7 +302,23 @@ fi + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +421,7 @@ sid= + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -573,7 +589,7 @@ do + justlist=yes + ;; + -fe* | -FE*) +- feature=$value ++ feature=$value + + ;; + -pr* | -PR*) +@@ -676,50 +692,19 @@ do + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -739,19 +724,19 @@ do + ;; + esac + ;; +- -dl | -DL) +- case $value in +- y* | Y*) +- deletelog=yes +- ;; +- n* | N*) +- deletelog=no +- ;; +- *) +- ;; +- esac ++ -dl | -DL) ++ case $value in ++ y* | Y*) ++ deletelog=yes ++ ;; ++ n* | N*) ++ deletelog=no ++ ;; ++ *) ++ ;; ++ esac + +- ;; ++ ;; + -at | -AT) + att=$value + ;; +@@ -1207,12 +1192,12 @@ post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 or $DIRPID/$pid.h5 not accessible + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1386,7 +1371,7 @@ else + else + error="$error + job id required" +- fi ++fi + fi + + case $qid in +@@ -1531,7 +1516,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1564,7 +1549,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1687,7 +1672,7 @@ Program name ($prog)? $ECHOTXT" + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1681,19 @@ Program name ($prog)? $ECHOTXT" + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in +- \/*) +- ;; +- *) ++ \/*) ++ ;; ++ *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname +- ;; +- esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ ;; ++ esac ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2228,12 @@ fi + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2346,7 @@ fi + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3229,27 @@ then + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usermoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3331,10 +3269,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -3344,6 +3283,9 @@ else + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3390,7 +3332,7 @@ if test $dllrun -eq 0; then + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3556,7 +3498,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3569,21 +3511,21 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3593,39 +3535,27 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3645,10 +3575,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + echo " $PRODUCT Exit number 3" +@@ -3686,6 +3617,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3744,42 +3678,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3904,7 +3838,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3917,20 +3851,20 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3940,37 +3874,25 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3990,10 +3912,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -4030,7 +3953,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4070,7 +3995,7 @@ if test $ddm_arc -gt 0; then + RUN_JOB="$BINDIR/exeddm $RUN_JOB -ddm $ddm_arc " + fi + +-$RUN_JOB ++ $RUN_JOB + + if test $nprocd -gt 1 + then +@@ -4114,42 +4039,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2022.1/Marc_tools/run_damask_mp.patch b/install/MarcMentat/2022.1/Marc_tools/run_damask_mp.patch new file mode 100644 index 000000000..924af6fbd --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/run_damask_mp.patch @@ -0,0 +1,730 @@ +diff --git "a/C:\\Users\\f.roters\\Documents\\Forschung\\FEM\\Kristallplastizit\303\244t\\Programme\\Userroutinen\\Marc\\Marc_mods\\2022.1\\Marc_tools\\run_marc.original" "b/C:\\Users\\f.roters\\Documents\\Forschung\\FEM\\Kristallplastizit\303\244t\\Programme\\Userroutinen\\Marc\\Marc_mods\\2022.1\\Marc_tools\\run_damask_mp" +index 88a3027..85beabe 100644 +--- "a/C:\\Users\\f.roters\\Documents\\Forschung\\FEM\\Kristallplastizit\303\244t\\Programme\\Userroutinen\\Marc\\Marc_mods\\2022.1\\Marc_tools\\run_marc.original" ++++ "b/C:\\Users\\f.roters\\Documents\\Forschung\\FEM\\Kristallplastizit\303\244t\\Programme\\Userroutinen\\Marc\\Marc_mods\\2022.1\\Marc_tools\\run_damask_mp" +@@ -302,7 +302,23 @@ fi + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +421,7 @@ sid= + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -573,7 +589,7 @@ do + justlist=yes + ;; + -fe* | -FE*) +- feature=$value ++ feature=$value + + ;; + -pr* | -PR*) +@@ -676,50 +692,19 @@ do + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -739,19 +724,19 @@ do + ;; + esac + ;; +- -dl | -DL) +- case $value in +- y* | Y*) +- deletelog=yes +- ;; +- n* | N*) +- deletelog=no +- ;; +- *) +- ;; +- esac ++ -dl | -DL) ++ case $value in ++ y* | Y*) ++ deletelog=yes ++ ;; ++ n* | N*) ++ deletelog=no ++ ;; ++ *) ++ ;; ++ esac + +- ;; ++ ;; + -at | -AT) + att=$value + ;; +@@ -1207,12 +1192,12 @@ post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 or $DIRPID/$pid.h5 not accessible + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1386,7 +1371,7 @@ else + else + error="$error + job id required" +- fi ++fi + fi + + case $qid in +@@ -1531,7 +1516,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1548,8 +1533,6 @@ GPGPU option : $gpuids + Host file name : $host" > $jid.log + if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +- echo "Mapper directory : $MESHERDIR" >> $jid.log +- echo "Meshing directory : $MESHERDIR" >> $jid.log + fi + echo \ + "Message passing type : $itree +@@ -1564,7 +1547,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1579,6 +1562,8 @@ Solver processes : $nsolverprint + Solver threads : $ntsprint" + if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" ++ echo "Mapper directory : $MESHERDIR" >> $jid.log ++ echo "Meshing directory : $MESHERDIR" >> $jid.log + fi + echo \ + "GPGPU option : $gpuids +@@ -1687,7 +1672,7 @@ Program name ($prog)? $ECHOTXT" + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1681,19 @@ Program name ($prog)? $ECHOTXT" + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in +- \/*) +- ;; +- *) ++ \/*) ++ ;; ++ *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname +- ;; +- esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ ;; ++ esac ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2228,12 @@ fi + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2346,7 @@ fi + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3229,27 @@ then + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usermoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3331,10 +3269,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -3344,6 +3283,9 @@ else + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3390,7 +3332,7 @@ if test $dllrun -eq 0; then + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3556,7 +3498,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3569,21 +3511,21 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3593,39 +3535,27 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3645,10 +3575,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + echo " $PRODUCT Exit number 3" +@@ -3686,6 +3617,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3744,42 +3678,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3904,7 +3838,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3917,20 +3851,20 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3940,37 +3874,25 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3990,10 +3912,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -4030,7 +3953,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4070,7 +3995,7 @@ if test $ddm_arc -gt 0; then + RUN_JOB="$BINDIR/exeddm $RUN_JOB -ddm $ddm_arc " + fi + +-$RUN_JOB ++ $RUN_JOB + + if test $nprocd -gt 1 + then +@@ -4114,42 +4039,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2022.1/Mentat_bin/edit_window.patch b/install/MarcMentat/2022.1/Mentat_bin/edit_window.patch new file mode 100644 index 000000000..915af9bf6 --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_bin/edit_window.patch @@ -0,0 +1,24 @@ +--- ++++ +@@ -1,18 +1,5 @@ + #!/bin/sh +-# This script opens a window running an editor. The default window is an +-# xterm, and the default editor is vi. These may be customized. ++# This script opens a window running an editor. ++# The command to invoke the editor is specified during DAMASK installation + +-dir= +-for d in /usr/bin /usr/bin/X11; do +- if test -x "$d/xterm"; then +- dir="$d" +- break +- fi +-done +- +-if test -z "$dir"; then +- echo "$0: Could not find xterm" +- exit 1 +-fi +- +-"$dir/xterm" -T "vi $*" -n "vi $*" -e vi $* ++%EDITOR% $* diff --git a/install/MarcMentat/2022.1/Mentat_bin/kill4.patch b/install/MarcMentat/2022.1/Mentat_bin/kill4.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2022.1/Mentat_bin/kill5.patch b/install/MarcMentat/2022.1/Mentat_bin/kill5.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2022.1/Mentat_bin/kill6.patch b/install/MarcMentat/2022.1/Mentat_bin/kill6.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2022.1/Mentat_bin/submit4.patch b/install/MarcMentat/2022.1/Mentat_bin/submit4.patch new file mode 100644 index 000000000..3f1371fdb --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_bin/submit4.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +64,10 @@ doe_nparallel=$6 + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +92,7 @@ if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +191,12 @@ unset PYTHONHOME + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2022.1/Mentat_bin/submit5.patch b/install/MarcMentat/2022.1/Mentat_bin/submit5.patch new file mode 100644 index 000000000..9614d8c69 --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_bin/submit5.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +64,10 @@ doe_nparallel=$6 + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +92,7 @@ if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +191,12 @@ unset PYTHONHOME + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_mp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_mp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2022.1/Mentat_bin/submit6.patch b/install/MarcMentat/2022.1/Mentat_bin/submit6.patch new file mode 100644 index 000000000..a3ed16135 --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_bin/submit6.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +64,10 @@ doe_nparallel=$6 + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +92,7 @@ if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +191,12 @@ unset PYTHONHOME + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2022.1/Mentat_menus/job_run.ms.patch b/install/MarcMentat/2022.1/Mentat_menus/job_run.ms.patch new file mode 100644 index 000000000..6cbcf895c --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_menus/job_run.ms.patch @@ -0,0 +1,158 @@ +--- ++++ +@@ -261,11 +261,18 @@ popmenu job_run_popmenu { + } + button { + position +25 = +- size 25 4 ++ size 18 4 + text "ADVANCED JOB SUBMISSION" + help "job_run#Job Submission And Control" + popmenu job_submit_adv_pm + } ++ button { ++ position +18 = ++ size 7 4 ++ text "DAMASK" ++ help "damask_run#Job Submission And Control" ++ popmenu damask ++ } + button { + position 0 +4 + size 12 4 +@@ -1189,6 +1196,135 @@ popmenu job_submit_adv_pm { + } + + ++#-------------------------------------------------------------------------------------------------- ++popmenu damask { ++ ++#ifdef QT_MENTAT ++ text "DAMASK.MPIE.DE" ++#endif ++ ++ group { ++#ifndef QT_MENTAT ++ label { ++ position 0 0 ++ size 50 4 ++ text "DAMASK.MPIE.DE" ++ } ++#endif ++ ++ label { ++ position 1 6 ++ size 13 6 ++ text "Optimzation" ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position +13 = ++ size 20 6 ++ text "write Input" ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position +18 = ++ size 30 6 ++ text "do not write Inp." ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O2 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 4 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 4 *monitor_job" ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O1 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 5 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 5 *monitor_job" ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O0 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 6 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 6 *monitor_job" ++ } ++ ++ popdown { ++ position 19 +8 ++ size 12 8 ++ text "CANCEL" ++ } ++} ++ ++ window { ++ parent mentat ++ origin 38 8 ++#ifdef DCOM ++ size 50 100 ++#else ++ size 50 94 ++#endif ++ background_color body ++ border_width 1 ++ border_color border ++ buffering single ++ } ++ mode permanent ++} ++ + #-------------------------------------------------------------------------------------------------- + popmenu job_exit_msg_pm { + diff --git a/install/MarcMentat/apply_DAMASK_modifications.py b/install/MarcMentat/apply_DAMASK_modifications.py index 9ffe187c5..a17120895 100755 --- a/install/MarcMentat/apply_DAMASK_modifications.py +++ b/install/MarcMentat/apply_DAMASK_modifications.py @@ -76,6 +76,7 @@ damask.util.run(f'xvfb-run -a {executable} -compile {menu_file}') print('setting file access rights...') for file in (glob.glob(str(marc_root/f'marc{marc_version}/tools/*_damask*')) + + glob.glob(str(marc_root/f'mentat{marc_version}/bin/edit_window')) + glob.glob(str(marc_root/f'mentat{marc_version}/bin/kill[4-6]')) + glob.glob(str(marc_root/f'mentat{marc_version}/bin/submit[4-6]'))): os.chmod(file , 0o755) diff --git a/python/README b/python/README deleted file mode 120000 index 59a23c461..000000000 --- a/python/README +++ /dev/null @@ -1 +0,0 @@ -../README \ No newline at end of file diff --git a/python/README.md b/python/README.md new file mode 120000 index 000000000..32d46ee88 --- /dev/null +++ b/python/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/python/damask/_config.py b/python/damask/_config.py index 6dd6a8328..ff889bf5d 100644 --- a/python/damask/_config.py +++ b/python/damask/_config.py @@ -6,6 +6,10 @@ from typing import Union, Dict, Any, Type, TypeVar import numpy as np import yaml +try: + from yaml import CSafeLoader as SafeLoader +except ImportError: + from yaml import SafeLoader # type: ignore from ._typehints import FileHandle from . import Rotation @@ -53,7 +57,7 @@ class Config(dict): **kwargs): """Initialize from YAML, dict, or key=value pairs.""" if isinstance(yml,str): - kwargs.update(yaml.safe_load(yml)) + kwargs.update(yaml.load(yml, Loader=SafeLoader)) elif isinstance(yml,dict): kwargs.update(yml) @@ -144,7 +148,7 @@ class Config(dict): Configuration from file. """ - return cls(yaml.safe_load(util.open_text(fname))) + return cls(yaml.load(util.open_text(fname), Loader=SafeLoader)) def save(self, fname: FileHandle, diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index 725567b7f..7a06a2c69 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -482,7 +482,7 @@ class ConfigMaterial(Config): """ N,n,shaped = 1,1,{} - map_dim = {'O':-1,'F_i':-2} + map_dim = {'O':-1,'V_e':-2} for k,v in kwargs.items(): shaped[k] = np.array(v) s = shaped[k].shape[:map_dim.get(k,None)] @@ -494,12 +494,12 @@ class ConfigMaterial(Config): if 'v' not in kwargs: shaped['v'] = np.broadcast_to(1/n,(N,n)) - map_shape = {'O':(N,n,4),'F_i':(N,n,3,3)} + map_shape = {'O':(N,n,4),'V_e':(N,n,3,3)} for k,v in shaped.items(): target = map_shape.get(k,(N,n)) obj = np.broadcast_to(v.reshape(util.shapeshifter(v.shape, target, mode = 'right')), target) for i in range(N): - if k in ['phase','O','v','F_i']: + if k in ['phase','O','v','V_e']: for j in range(n): mat[i]['constituents'][j][k] = obj[i,j].item() if isinstance(obj[i,j],np.generic) else obj[i,j] else: diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 471ba36bd..f7acfe5aa 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -694,9 +694,9 @@ class Grid: """ v = VTK.from_image_data(self.cells,self.size,self.origin)\ - .add('material',self.material.flatten(order='F')) + .set('material',self.material.flatten(order='F')) for label,data in self.initial_conditions.items(): - v = v.add(label,data.flatten(order='F')) + v = v.set(label,data.flatten(order='F')) v.comments = self.comments v.save(fname,parallel=False,compress=compress) @@ -745,7 +745,7 @@ class Grid: """ VTK.from_image_data(self.cells,self.size,self.origin) \ - .add('material',self.material.flatten('F'),) \ + .set('material',self.material.flatten('F'),) \ .show('material',colormap) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index 534a9548d..dcc139b7c 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -786,7 +786,8 @@ class Orientation(Rotation,Crystal): def to_pole(self, *, uvw: FloatSequence = None, hkl: FloatSequence = None, - with_symmetry: bool = False) -> np.ndarray: + with_symmetry: bool = False, + normalize: bool = True) -> np.ndarray: """ Calculate lab frame vector along lattice direction [uvw] or plane normal (hkl). @@ -795,18 +796,26 @@ class Orientation(Rotation,Crystal): uvw|hkl : numpy.ndarray, shape (...,3) Miller indices of crystallographic direction or plane normal. Shape of vector blends with shape of own rotation array. - For example, a rotation array, shape (3,2) and a vector array of shape (2,4) result in (3,2,4) outputs. + For example, a rotation array of shape (3,2) and a vector + array of shape (2,4) result in (3,2,4) outputs. with_symmetry : bool, optional Calculate all N symmetrically equivalent vectors. + Defaults to False. + normalize : bool, optional + Normalize output vector. + Defaults to True. Returns ------- vector : numpy.ndarray, shape (...,3) or (...,N,3) - Lab frame vector (or vectors if with_symmetry) along [uvw] direction or (hkl) plane normal. + Lab frame vector (or vectors if with_symmetry) along + [uvw] direction or (hkl) plane normal. """ v = self.to_frame(uvw=uvw,hkl=hkl) blend = util.shapeblender(self.shape,v.shape[:-1]) + if normalize: + v /= np.linalg.norm(v,axis=-1,keepdims=len(v.shape)>1) if with_symmetry: sym_ops = self.symmetry_operations shape = v.shape[:-1]+sym_ops.shape diff --git a/python/damask/_result.py b/python/damask/_result.py index c26b4c927..a3e906bb9 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -612,7 +612,7 @@ class Result: @staticmethod - def _add_calculation(**kwargs): + def _add_calculation(**kwargs) -> Dict[str, Any]: formula = kwargs['formula'] for d in re.findall(r'#(.*?)#',formula): formula = formula.replace(f'#{d}#',f"kwargs['{d}']['data']") @@ -786,7 +786,7 @@ class Result: elif eigenvalue == 'min': label,p = 'minimum',0 else: - raise ValueError(f'invalid value for "eigenvalue": {eigenvalue}') + raise ValueError(f'invalid eigenvalue: {eigenvalue}') return { 'data': tensor.eigenvalues(T_sym['data'])[:,p], @@ -831,7 +831,7 @@ class Result: elif eigenvalue == 'min': label,p = 'minimum',0 else: - raise ValueError(f'invalid value for "eigenvalue": {eigenvalue}') + raise ValueError(f'invalid eigenvalue: {eigenvalue}') return { 'data': tensor.eigenvectors(T_sym['data'])[:,p], @@ -981,7 +981,7 @@ class Result: @staticmethod - def _add_norm(x: Dict[str, Any], ord: Union[int, Literal['fro', 'nuc']]) -> Dict[str, Any]: + def _add_norm(x: Dict[str, Any], ord: Union[int, float, Literal['fro', 'nuc']]) -> Dict[str, Any]: o = ord if len(x['data'].shape) == 2: axis: Union[int, Tuple[int, int]] = 1 @@ -1005,7 +1005,7 @@ class Result: } def add_norm(self, x: str, - ord: Union[int, Literal['fro', 'nuc']] = None): + ord: Union[int, float, Literal['fro', 'nuc']] = None): """ Add the norm of vector or tensor. @@ -1062,19 +1062,24 @@ class Result: def _add_pole(q: Dict[str, Any], uvw: FloatSequence, hkl: FloatSequence, - with_symmetry: bool) -> Dict[str, Any]: + with_symmetry: bool, + normalize: bool) -> Dict[str, Any]: c = q['meta']['c/a'] if 'c/a' in q['meta'] else 1 - pole = Orientation(q['data'],lattice=q['meta']['lattice'],a=1,c=c).to_pole(uvw=uvw,hkl=hkl,with_symmetry=with_symmetry) + brackets = ['[]','()','⟨⟩','{}'][(uvw is None)*1+with_symmetry*2] + label = 'p^' + '{}{} {} {}{}'.format(brackets[0], + *(uvw if uvw else hkl), + brackets[-1],) + ori = Orientation(q['data'],lattice=q['meta']['lattice'],a=1,c=c) return { - 'data': pole, - 'label': 'p^[{} {} {}]'.format(*uvw) if uvw else 'p^({} {} {})'.format(*hkl), + 'data': ori.to_pole(uvw=uvw,hkl=hkl,with_symmetry=with_symmetry,normalize=normalize), + 'label': label, 'meta' : { - 'unit': '1', - 'description': 'lab frame vector along lattice ' \ - + ('direction' if uvw else 'plane') \ - + ('s' if with_symmetry else ''), - 'creator': 'add_pole' + 'unit': '1', + 'description': f'{"normalized " if normalize else ""}lab frame vector along lattice ' \ + + ('direction' if uvw is not None else 'plane') \ + + ('s' if with_symmetry else ''), + 'creator': 'add_pole' } } def add_pole(self, @@ -1082,7 +1087,8 @@ class Result: *, uvw: FloatSequence = None, hkl: FloatSequence = None, - with_symmetry: bool = False): + with_symmetry: bool = False, + normalize: bool = True): """ Add lab frame vector along lattice direction [uvw] or plane normal (hkl). @@ -1095,9 +1101,15 @@ class Result: Miller indices of crystallographic direction or plane normal. with_symmetry : bool, optional Calculate all N symmetrically equivalent vectors. + Defaults to True. + normalize : bool, optional + Normalize output vector. + Defaults to True. """ - self._add_generic_pointwise(self._add_pole,{'q':q},{'uvw':uvw,'hkl':hkl,'with_symmetry':with_symmetry}) + self._add_generic_pointwise(self._add_pole, + {'q':q}, + {'uvw':uvw,'hkl':hkl,'with_symmetry':with_symmetry,'normalize':normalize}) @staticmethod @@ -1376,18 +1388,18 @@ class Result: result1 = result[at_cell_ho[x]] path = '/'.join(['/',increment[0],ty[0],x,field[0]]) - h5_dataset : h5py._hl.dataset.Dataset = f[path].create_dataset(r['label'],data=result1) + h5_dataset = f[path].create_dataset(r['label'],data=result1) now = datetime.datetime.now().astimezone() h5_dataset.attrs['created'] = now.strftime('%Y-%m-%d %H:%M:%S%z') if h5py3 else \ - now.strftime('%Y-%m-%d %H:%M:%S%z').encode() + now.strftime('%Y-%m-%d %H:%M:%S%z').encode() for l,v in r['meta'].items(): h5_dataset.attrs[l.lower()]=v if h5py3 else v.encode() creator = h5_dataset.attrs['creator'] if h5py3 else \ h5_dataset.attrs['creator'].decode() h5_dataset.attrs['creator'] = f'damask.Result.{creator} v{damask.version}' if h5py3 else \ - f'damask.Result.{creator} v{damask.version}'.encode() + f'damask.Result.{creator} v{damask.version}'.encode() def _job_pointwise(self, @@ -1414,6 +1426,7 @@ class Result: print(f'Error during calculation: {err}.') return [None,None] + def _add_generic_pointwise(self, func: Callable, datasets: Dict[str, Any], @@ -1465,13 +1478,14 @@ class Result: shape = result['data'].shape if result['data'].size >= chunk_size*2: chunks = (chunk_size//np.prod(shape[1:]),)+shape[1:] - compression: Tuple[Optional[str], Optional[int]] = ('gzip',6) + compress = True else: chunks = shape - compression = (None,None) + compress = False dataset = f[group].create_dataset(result['label'],data=result['data'], maxshape=shape, chunks=chunks, - compression=compression[0], compression_opts=compression[1], + compression = 'gzip' if compress else None, + compression_opts = 6 if compress else None, shuffle=True,fletcher32=True) now = datetime.datetime.now().astimezone() @@ -1693,7 +1707,7 @@ class Result: for inc in util.show_progress(self.visible['increments']): u = _read(f['/'.join([inc,'geometry','u_n' if mode.lower() == 'cell' else 'u_p'])]) - v = v.add('u',u) + v = v.set('u',u) for ty in ['phase','homogenization']: for field in self.visible['fields']: @@ -1720,7 +1734,7 @@ class Result: outs[out][at_cell_ho[label]] = data[in_data_ho[label]] for label,dataset in outs.items(): - v = v.add(' / '.join(['/'.join([ty,field,label]),dataset.dtype.metadata['unit']]),dataset) + v = v.set(' / '.join(['/'.join([ty,field,label]),dataset.dtype.metadata['unit']]),dataset) v.save(f'{self.fname.stem}_inc{inc[10:].zfill(N_digits)}',parallel=parallel) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index f138fbb8a..0e443ee62 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -721,7 +721,7 @@ class Rotation: Parameters ---------- q : numpy.ndarray, shape (...,4) - Unit quaternion (q_0, q_1, q_2, q_3) in positive real hemisphere, i.e. ǀqǀ = 1, q_0 ≥ 0. + Unit quaternion (q_0, q_1, q_2, q_3) in positive real hemisphere, i.e. ǀqǀ = 1 and q_0 ≥ 0. accept_homomorph : bool, optional Allow homomorphic variants, i.e. q_0 < 0 (negative real hemisphere). Defaults to False. @@ -777,11 +777,11 @@ class Rotation: @staticmethod def from_axis_angle(axis_angle: np.ndarray, - degrees:bool = False, + degrees: bool = False, normalize: bool = False, P: Literal[1, -1] = -1) -> 'Rotation': """ - Initialize from Axis angle pair. + Initialize from axis–angle pair. Parameters ---------- @@ -818,12 +818,12 @@ class Rotation: orthonormal: bool = True, reciprocal: bool = False) -> 'Rotation': """ - Initialize from lattice basis vectors. + Initialize from basis vector triplet. Parameters ---------- basis : numpy.ndarray, shape (...,3,3) - Three three-dimensional lattice basis vectors. + Three three-dimensional basis vectors. orthonormal : bool, optional Basis is strictly orthonormal, i.e. is free of stretch components. Defaults to True. reciprocal : bool, optional @@ -857,7 +857,7 @@ class Rotation: Parameters ---------- R : numpy.ndarray, shape (...,3,3) - Rotation matrix with det(R) = 1, R.T ∙ R = I. + Rotation matrix with det(R) = 1 and R.T ∙ R = I. """ return Rotation.from_basis(R) @@ -866,14 +866,14 @@ class Rotation: def from_parallel(a: np.ndarray, b: np.ndarray ) -> 'Rotation': """ - Initialize from pairs of two orthogonal lattice basis vectors. + Initialize from pairs of two orthogonal basis vectors. Parameters ---------- a : numpy.ndarray, shape (...,2,3) - Two three-dimensional lattice vectors of first orthogonal basis. + Two three-dimensional vectors of first orthogonal basis. b : numpy.ndarray, shape (...,2,3) - Corresponding three-dimensional lattice vectors of second basis. + Corresponding three-dimensional vectors of second basis. """ a_ = np.array(a) @@ -896,7 +896,7 @@ class Rotation: normalize: bool = False, P: Literal[1, -1] = -1) -> 'Rotation': """ - Initialize from Rodrigues–Frank vector (angle separated from axis). + Initialize from Rodrigues–Frank vector (with angle separated from axis). Parameters ---------- @@ -1010,7 +1010,7 @@ class Rotation: def from_ODF(weights: np.ndarray, phi: np.ndarray, shape: Union[int, IntSequence] = None, - degrees: bool = True, + degrees: bool = False, fractions: bool = True, rng_seed: NumpyRngSeed = None) -> 'Rotation': """ @@ -1063,7 +1063,7 @@ class Rotation: def from_spherical_component(center: 'Rotation', sigma: float, shape: Union[int, IntSequence] = None, - degrees: bool = True, + degrees: bool = False, rng_seed: NumpyRngSeed = None) -> 'Rotation': """ Initialize with samples from a Gaussian distribution around a given center. @@ -1100,7 +1100,7 @@ class Rotation: sample: IntSequence, sigma: float = 0.0, shape: Union[int, IntSequence] = None, - degrees: bool = True, + degrees: bool = False, rng_seed: NumpyRngSeed = None): """ Initialize with samples from a Gaussian distribution around a given direction. @@ -1108,9 +1108,11 @@ class Rotation: Parameters ---------- crystal : numpy.ndarray, shape (2) - Polar coordinates (phi from x, theta from z) of fiber direction in crystal frame. + Polar coordinates (polar angle θ from [0 0 1], azimuthal angle φ from [1 0 0]) + of fiber direction in crystal frame. sample : numpy.ndarray, shape (2) - Polar coordinates (phi from x, theta from z) of fiber direction in sample frame. + Polar coordinates (polar angle θ from z, azimuthal angle φ from x) + of fiber direction in sample frame. sigma : float, optional Standard deviation of (Gaussian) misorientation distribution. Defaults to 0. @@ -1122,13 +1124,39 @@ class Rotation: A seed to initialize the BitGenerator. Defaults to None, i.e. unpredictable entropy will be pulled from the OS. + Notes + ----- + The crystal direction for (θ=0,φ=0) is [0 0 1], + the sample direction for (θ=0,φ=0) is z. + + Polar coordinates follow the ISO 80000-2:2019 convention + typically used in physics. + See https://en.wikipedia.org/wiki/Spherical_coordinate_system. + + Ranges 0≤θ≤π and 0≤φ≤2π give a unique set of coordinates. + + Examples + -------- + Create an ideal α-fiber texture (<1 1 0> ǀǀ RD=x) consisting of + 200 orientations: + + >>> import damask + >>> import numpy as np + >>> alpha = damask.Rotation.from_fiber_component([np.pi/4.,0.],[np.pi/2.,0.],shape=200) + + Create an ideal γ-fiber texture (<1 1 1> ǀǀ ND=z) consisting of + 100 orientations: + + >>> import damask + >>> gamma = damask.Rotation.from_fiber_component([54.7,45.0],[0.,0.],shape=100,degrees=True) + """ rng = np.random.default_rng(rng_seed) - sigma_,alpha_,beta_ = (np.radians(coordinate) for coordinate in (sigma,crystal,sample)) if degrees else \ - map(np.array, (sigma,crystal,sample)) + sigma_,alpha,beta = (np.radians(coordinate) for coordinate in (sigma,crystal,sample)) if degrees else \ + map(np.array, (sigma,crystal,sample)) - d_cr = np.array([np.sin(alpha_[0])*np.cos(alpha_[1]), np.sin(alpha_[0])*np.sin(alpha_[1]), np.cos(alpha_[0])]) - d_lab = np.array([np.sin( beta_[0])*np.cos( beta_[1]), np.sin( beta_[0])*np.sin( beta_[1]), np.cos( beta_[0])]) + d_cr = np.array([np.sin(alpha[0])*np.cos(alpha[1]), np.sin(alpha[0])*np.sin(alpha[1]), np.cos(alpha[0])]) + d_lab = np.array([np.sin( beta[0])*np.cos( beta[1]), np.sin( beta[0])*np.sin( beta[1]), np.cos( beta[0])]) ax_align = np.append(np.cross(d_lab,d_cr), np.arccos(np.dot(d_lab,d_cr))) if np.isclose(ax_align[3],0.0): ax_align[:3] = np.array([1,0,0]) R_align = Rotation.from_axis_angle(ax_align if ax_align[3] > 0.0 else -ax_align,normalize=True) # rotate fiber axis from sample to crystal frame diff --git a/python/damask/_table.py b/python/damask/_table.py index 841842fc0..2d2c30c00 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -363,16 +363,16 @@ class Table: data: np.ndarray, info: str = None) -> 'Table': """ - Set column data. + Add new or replace existing column data. Parameters ---------- label : str Column label. data : numpy.ndarray - Replacement data. + Column data. First dimension needs to match number of rows. info : str, optional - Human-readable information about the modified data. + Human-readable information about the data. Returns ------- @@ -382,49 +382,32 @@ class Table: """ dup = self.copy() dup._add_comment(label, data.shape[1:], info) + if m := re.match(r'(.*)\[((\d+,)*(\d+))\]',label): key = m.group(1) - idx = np.ravel_multi_index(tuple(map(int,m.group(2).split(","))), - self.shapes[key]) - iloc = dup.data.columns.get_loc(key).tolist().index(True) + idx - dup.data.iloc[:,iloc] = data else: - dup.data[label] = data.reshape(dup.data[label].shape) - return dup + key = label + if key in dup.shapes: - def add(self, - label: str, - data: np.ndarray, - info: str = None) -> 'Table': - """ - Add column data. + if m: + idx = np.ravel_multi_index(tuple(map(int,m.group(2).split(","))), + self.shapes[key]) + iloc = dup.data.columns.get_loc(key).tolist().index(True) + idx + dup.data.iloc[:,iloc] = data + else: + dup.data[label] = data.reshape(dup.data[label].shape) - Parameters - ---------- - label : str - Column label. - data : numpy.ndarray - New data. - info : str, optional - Human-readable information about the new data. + else: - Returns - ------- - updated : damask.Table - Updated table. + dup.shapes[label] = data.shape[1:] if len(data.shape) > 1 else (1,) + size = np.prod(data.shape[1:],dtype=int) + new = pd.DataFrame(data=data.reshape(-1,size), + columns=[label]*size, + ) + new.index = dup.data.index + dup.data = pd.concat([dup.data,new],axis=1) - """ - dup = self.copy() - dup._add_comment(label,data.shape[1:],info) - - dup.shapes[label] = data.shape[1:] if len(data.shape) > 1 else (1,) - size = np.prod(data.shape[1:],dtype=int) - new = pd.DataFrame(data=data.reshape(-1,size), - columns=[label]*size, - ) - new.index = dup.data.index - dup.data = pd.concat([dup.data,new],axis=1) return dup diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 92ec08aee..6baa16214 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -1,7 +1,7 @@ import os import multiprocessing as mp from pathlib import Path -from typing import Union, Literal +from typing import Union, Literal, List, Sequence import numpy as np import vtk @@ -86,7 +86,7 @@ class VTK: @property - def comments(self): + def comments(self) -> List[str]: """Return the comments.""" field_data = self.vtk_data.GetFieldData() for a in range(field_data.GetNumberOfArrays()): @@ -97,7 +97,7 @@ class VTK: @comments.setter def comments(self, - comments): + comments: Union[str, Sequence[str]]): """ Set comments. @@ -401,13 +401,14 @@ class VTK: # Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data - def add(self, + def set(self, label: str = None, data: Union[np.ndarray, np.ma.MaskedArray] = None, + info: str = None, *, table: 'Table' = None): """ - Add data to either cells or points. + Add new or replace existing point or cell data. Data can either be a numpy.array, which requires a corresponding label, or a damask.Table. @@ -417,11 +418,17 @@ class VTK: label : str, optional Label of data array. data : numpy.ndarray or numpy.ma.MaskedArray, optional - Data to add. First dimension needs to match either + Data to add or replace. First array dimension needs to match either number of cells or number of points. + info : str, optional + Human-readable information about the data. table: damask.Table, optional - Data to add. Number of rows needs to match either - number of cells or number of points. + Data to add or replace. Each table label is individually considered. + Number of rows needs to match either number of cells or number of points. + + Notes + ----- + If the number of cells equals the number of points, the data is added to both. """ @@ -429,7 +436,10 @@ class VTK: label: str, data: np.ndarray): - N_data = data.shape[0] + N_p,N_c = vtk_data.GetNumberOfPoints(),vtk_data.GetNumberOfCells() + if (N_data := data.shape[0]) not in [N_p,N_c]: + raise ValueError(f'data count mismatch ({N_data} ≠ {N_p} & {N_c})') + data_ = data.reshape(N_data,-1) \ .astype(np.single if data.dtype in [np.double,np.longdouble] else data.dtype) @@ -442,12 +452,10 @@ class VTK: d.SetName(label) - if N_data == vtk_data.GetNumberOfPoints(): + if N_data == N_p: vtk_data.GetPointData().AddArray(d) - elif N_data == vtk_data.GetNumberOfCells(): + if N_data == N_c: vtk_data.GetCellData().AddArray(d) - else: - raise ValueError(f'data count mismatch ({N_data} ≠ {self.N_points} & {self.N_cells})') if data is None and table is None: raise KeyError('no data given') @@ -460,14 +468,17 @@ class VTK: _add_array(dup.vtk_data, label, np.where(data.mask,data.fill_value,data) if isinstance(data,np.ma.MaskedArray) else data) + if info is not None: dup.comments += f'{label}: {info}' else: raise ValueError('no label defined for data') elif isinstance(table,Table): for l in table.labels: _add_array(dup.vtk_data,l,table.get(l)) + if info is not None: dup.comments += f'{l}: {info}' else: raise TypeError + return dup diff --git a/python/damask/solver/_marc.py b/python/damask/solver/_marc.py index 135736d14..8b7f7acba 100644 --- a/python/damask/solver/_marc.py +++ b/python/damask/solver/_marc.py @@ -3,7 +3,7 @@ import shlex import re from pathlib import Path -_marc_version = '2021.3.1' +_marc_version = '2022.1' _marc_root = '/opt/msc' _damask_root = str(Path(__file__).parents[3]) @@ -64,7 +64,7 @@ class Marc: Defaults to ''. """ - usersub = (self.damask_root/'src/DAMASK_Marc').with_suffix('.f90' if compile else '.marc') + usersub = (self.damask_root/'src/Marc/DAMASK_Marc').with_suffix('.f90' if compile else '.marc') if not usersub.is_file(): raise FileNotFoundError(f'subroutine ({"source" if compile else "binary"}) "{usersub}" not found') diff --git a/python/setup.cfg b/python/setup.cfg index 30107fd10..321040658 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -15,7 +15,7 @@ classifiers = Operating System :: OS Independent [options] -packages = damask +packages = find: include_package_data = true python_requires = >= 3.8 install_requires = diff --git a/python/tests/reference/VTK/polyData.vtp b/python/tests/reference/VTK/polyData.vtp index dc4b5f149..5f4606535 100644 --- a/python/tests/reference/VTK/polyData.vtp +++ b/python/tests/reference/VTK/polyData.vtp @@ -16,6 +16,17 @@ + + AQAAAACAAAB4AAAAVgAAAA==eF5jYICBhv2WfY9tLfuS7Ypk3PeDaCDf7okF3/7Vq1bZrV6lZQ+k94HEgHL2QHovUM7+iUUfiG0LlQdhkH77Ipnj9iB5qFp7kBjQDiBmcADRANsaLXM= + + + 0.74535601471 + + + 2.4494897428 + + + diff --git a/python/tests/test_ConfigMaterial.py b/python/tests/test_ConfigMaterial.py index d3ea986c5..f003e254e 100644 --- a/python/tests/test_ConfigMaterial.py +++ b/python/tests/test_ConfigMaterial.py @@ -113,15 +113,15 @@ class TestConfigMaterial: @pytest.mark.parametrize('N,n,kw',[ (1,1,{'phase':'Gold', 'O':[1,0,0,0], - 'F_i':np.eye(3), + 'V_e':np.eye(3), 'homogenization':'SX'}), (3,1,{'phase':'Gold', 'O':Rotation.from_random(3), - 'F_i':np.broadcast_to(np.eye(3),(3,3,3)), + 'V_e':np.broadcast_to(np.eye(3),(3,3,3)), 'homogenization':'SX'}), (2,3,{'phase':np.broadcast_to(['a','b','c'],(2,3)), 'O':Rotation.from_random((2,3)), - 'F_i':np.broadcast_to(np.eye(3),(2,3,3,3)), + 'V_e':np.broadcast_to(np.eye(3),(2,3,3,3)), 'homogenization':['SX','PX']}), ]) def test_material_add(self,kw,N,n): diff --git a/python/tests/test_Grid.py b/python/tests/test_Grid.py index 9fb2f310c..05344d28d 100644 --- a/python/tests/test_Grid.py +++ b/python/tests/test_Grid.py @@ -441,7 +441,7 @@ class TestGrid: z = np.ones(cells.prod()) z[cells[:2].prod()*int(cells[2]/2):] = 0 t = Table({'coords':3,'z':1},np.column_stack((coords,z))) - t = t.add('indicator',t.get('coords')[:,0]) + t = t.set('indicator',t.get('coords')[:,0]) g = Grid.from_table(t,'coords',['indicator','z']) assert g.N_materials == g.cells[0]*2 and (g.material[:,:,-1]-g.material[:,:,0] == cells[0]).all() diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 729967539..5f9b83e70 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -158,6 +158,13 @@ class TestOrientation: sigma=0.0,shape=None,rng_seed=0,lattice='cI').quaternion == r.quaternion) + @pytest.mark.parametrize('crystal,sample,direction,color',[([np.pi/4,0],[np.pi/2,0],[1,0,0],[0,1,0]), + ([np.arccos(3**(-.5)),np.pi/4,0],[0,0],[0,0,1],[0,0,1])]) + def test_fiber_IPF(self,crystal,sample,direction,color): + fiber = Orientation.from_fiber_component(crystal=crystal,sample=sample,family='cubic',shape=200) + print(np.allclose(fiber.IPF_color(direction),color)) + + @pytest.mark.parametrize('kwargs',[ dict(lattice='aP',a=1.0,b=1.1,c=1.2,alpha=np.pi/4.5,beta=np.pi/3.5,gamma=np.pi/2.5), dict(lattice='mP',a=1.0,b=1.1,c=1.2, beta=np.pi/3.5), @@ -169,12 +176,12 @@ class TestOrientation: def test_from_directions(self,kwargs): for a,b in np.random.random((10,2,3)): c = np.cross(b,a) - if np.all(np.isclose(c,0)): continue + if np.allclose(c,0): continue o = Orientation.from_directions(uvw=a,hkl=c,**kwargs) x = o.to_pole(uvw=a) z = o.to_pole(hkl=c) - assert np.isclose(np.dot(x/np.linalg.norm(x),np.array([1,0,0])),1) \ - and np.isclose(np.dot(z/np.linalg.norm(z),np.array([0,0,1])),1) + assert np.isclose(np.dot(x,np.array([1,0,0])),1) \ + and np.isclose(np.dot(z,np.array([0,0,1])),1) @pytest.mark.parametrize('function',[Orientation.from_random, Orientation.from_quaternion, diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index 9cc8f5643..7e107494a 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -24,8 +24,7 @@ def default(tmp_path,ref_path): """Small Result file in temp location for modification.""" fname = '12grains6x7x8_tensionY.hdf5' shutil.copy(ref_path/fname,tmp_path) - f = Result(tmp_path/fname) - return f.view(times=20.0) + return Result(tmp_path/fname).view(times=20.0) @pytest.fixture def single_phase(tmp_path,ref_path): @@ -226,15 +225,19 @@ class TestResult: assert np.allclose(in_memory,in_file) @pytest.mark.parametrize('options',[{'uvw':[1,0,0],'with_symmetry':False}, - {'hkl':[0,1,1],'with_symmetry':True}]) + {'uvw':[1,1,0],'with_symmetry':True}, + {'hkl':[0,1,1],'with_symmetry':True}, + {'hkl':[1,1,1],'with_symmetry':False}, + ]) def test_add_pole(self,default,options): default.add_pole(**options) rot = default.place('O') in_memory = Orientation(rot,lattice=rot.dtype.metadata['lattice']).to_pole(**options) - brackets = ['[[]','[]]'] if 'uvw' in options.keys() else ['(',')'] # escape fnmatch - label = '{}{} {} {}{}'.format(brackets[0],*(list(options.values())[0]),brackets[1]) - in_file = default.place(f'p^{label}') - print(in_file - in_memory) + brackets = [['[[]','[]]'],'()','⟨⟩','{}'][('hkl' in options)*1+(options['with_symmetry'])*2] # escape fnmatch + label = 'p^{}{} {} {}{}'.format(brackets[0], + *(list(options.values())[0]), + brackets[-1]) + in_file = default.place(label) assert np.allclose(in_memory,in_file) def test_add_rotation(self,default): diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index a9b8b36f0..c9dfc68b8 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -1061,7 +1061,7 @@ class TestRotation: p = [] for run in range(5): c = Rotation.from_random() - o = Rotation.from_spherical_component(c,sigma,shape) + o = Rotation.from_spherical_component(c,sigma,shape,degrees=True) _, angles = c.misorientation(o).as_axis_angle(pair=True,degrees=True) angles[::2] *= -1 # flip angle for every second to symmetrize distribution @@ -1077,11 +1077,11 @@ class TestRotation: def test_from_fiber_component(self,sigma,shape): p = [] for run in range(5): - alpha = np.random.random()*2*np.pi,np.arccos(np.random.random()) - beta = np.random.random()*2*np.pi,np.arccos(np.random.random()) + alpha = np.arccos(np.random.random()),np.random.random()*2*np.pi + beta = np.arccos(np.random.random()),np.random.random()*2*np.pi f_in_C = np.array([np.sin(alpha[0])*np.cos(alpha[1]), np.sin(alpha[0])*np.sin(alpha[1]), np.cos(alpha[0])]) - f_in_S = np.array([np.sin(beta[0] )*np.cos(beta[1] ), np.sin(beta[0] )*np.sin(beta[1] ), np.cos(beta[0] )]) + f_in_S = np.array([np.sin( beta[0])*np.cos( beta[1]), np.sin( beta[0])*np.sin( beta[1]), np.cos( beta[0])]) ax = np.append(np.cross(f_in_C,f_in_S), - np.arccos(np.dot(f_in_C,f_in_S))) n = Rotation.from_axis_angle(ax if ax[3] > 0.0 else ax*-1.0 ,normalize=True) # rotation to align fiber axis in crystal and sample system diff --git a/python/tests/test_Table.py b/python/tests/test_Table.py index 812f2848f..e530abe58 100644 --- a/python/tests/test_Table.py +++ b/python/tests/test_Table.py @@ -51,7 +51,7 @@ class TestTable: def test_add(self,default): d = np.random.random((5,9)) - assert np.allclose(d,default.add('nine',d,'random data').get('nine')) + assert np.allclose(d,default.set('nine',d,'random data').get('nine')) def test_isclose(self,default): assert default.isclose(default).all() @@ -200,6 +200,6 @@ class TestTable: t = Table({'v':(2,)}, np.array([[0,1,],[2,1,]]), ['test data'])\ - .add('s',np.array(['b','a']))\ + .set('s',np.array(['b','a']))\ .sort_by('s') assert np.all(t.get('v')[:,0] == np.array([2,0])) diff --git a/python/tests/test_VTK.py b/python/tests/test_VTK.py index b0a7ef4c5..58855c831 100644 --- a/python/tests/test_VTK.py +++ b/python/tests/test_VTK.py @@ -147,24 +147,24 @@ class TestVTK: with pytest.raises(KeyError): default.get('does_not_exist') - def test_invalid_add_shape(self,default): + def test_invalid_set_shape(self,default): with pytest.raises(ValueError): - default.add('valid',np.ones(3)) + default.set('valid',np.ones(3)) - def test_invalid_add_missing_label(self,default): + def test_invalid_set_missing_label(self,default): data = np.random.randint(9,size=np.prod(np.array(default.vtk_data.GetDimensions())-1)) with pytest.raises(ValueError): - default.add(data=data) + default.set(data=data) - def test_invalid_add_type(self,default): + def test_invalid_set_type(self,default): with pytest.raises(TypeError): - default.add(label='valid',data='invalid_type') + default.set(label='valid',data='invalid_type') with pytest.raises(TypeError): - default.add(label='valid',table='invalid_type') + default.set(label='valid',table='invalid_type') - def test_invalid_add_dual(self,default): + def test_invalid_set_dual(self,default): with pytest.raises(KeyError): - default.add(label='valid',data=0,table=0) + default.set(label='valid',data=0,table=0) @pytest.mark.parametrize('data_type,shape',[(float,(3,)), (float,(3,3)), @@ -172,31 +172,31 @@ class TestVTK: (int,(4,)), (str,(1,))]) @pytest.mark.parametrize('N_values',[5*6*7,6*7*8]) - def test_add_get(self,default,data_type,shape,N_values): + def test_set_get(self,default,data_type,shape,N_values): data = np.squeeze(np.random.randint(0,100,(N_values,)+shape)).astype(data_type) - new = default.add('data',data) + new = default.set('data',data) assert (np.squeeze(data.reshape(N_values,-1)) == new.get('data')).all() @pytest.mark.parametrize('shapes',[{'scalar':(1,),'vector':(3,),'tensor':(3,3)}, {'vector':(6,),'tensor':(3,3)}, {'tensor':(3,3),'scalar':(1,)}]) - def test_add_table(self,default,shapes): + def test_set_table(self,default,shapes): N = np.random.choice([default.N_points,default.N_cells]) d = dict() for k,s in shapes.items(): d[k] = dict(shape = s, data = np.random.random(N*np.prod(s)).reshape((N,-1))) - new = default.add(table=Table(shapes,np.column_stack([d[k]['data'] for k in shapes.keys()]))) + new = default.set(table=Table(shapes,np.column_stack([d[k]['data'] for k in shapes.keys()]))) for k,s in shapes.items(): assert np.allclose(np.squeeze(d[k]['data']),new.get(k),rtol=1e-7) - def test_add_masked(self,default): + def test_set_masked(self,default): data = np.random.rand(5*6*7,3) masked = ma.MaskedArray(data,mask=data<.4,fill_value=42.) - mask_auto = default.add('D',masked) - mask_manual = default.add('D',np.where(masked.mask,masked.fill_value,masked)) + mask_auto = default.set('D',masked) + mask_manual = default.set('D',np.where(masked.mask,masked.fill_value,masked)) assert mask_manual == mask_auto @@ -210,7 +210,7 @@ class TestVTK: data = np.squeeze(np.random.randint(0,100,(N_values,)+shape)).astype(data_type) ALPHABET = np.array(list(string.ascii_lowercase + ' ')) label = ''.join(np.random.choice(ALPHABET, size=10)) - new = default.add(label,data) + new = default.set(label,data) if N_values == default.N_points: assert label in new.labels['Point Data'] if N_values == default.N_cells: assert label in new.labels['Cell Data'] @@ -225,7 +225,7 @@ class TestVTK: @pytest.mark.xfail(int(vtk.vtkVersion.GetVTKVersion().split('.')[0])<8, reason='missing METADATA') def test_compare_reference_polyData(self,update,ref_path,tmp_path): points=np.dstack((np.linspace(0.,1.,10),np.linspace(0.,2.,10),np.linspace(-1.,1.,10))).squeeze() - polyData = VTK.from_poly_data(points).add('coordinates',points) + polyData = VTK.from_poly_data(points).set('coordinates',points) if update: polyData.save(ref_path/'polyData') else: @@ -242,8 +242,8 @@ class TestVTK: c = coords[:-1,:-1,:-1,:].reshape(-1,3,order='F') n = coords[:,:,:,:].reshape(-1,3,order='F') rectilinearGrid = VTK.from_rectilinear_grid(grid) \ - .add('cell',np.ascontiguousarray(c)) \ - .add('node',np.ascontiguousarray(n)) + .set('cell',np.ascontiguousarray(c)) \ + .set('node',np.ascontiguousarray(n)) if update: rectilinearGrid.save(ref_path/'rectilinearGrid') else: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 82efe8748..a473069b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,12 +6,6 @@ endif() file(GLOB damask-sources CONFIGURE_DEPENDS *.f90 *.c) -# probably we should have a subfolder for MSC.Marc -list(FILTER damask-sources EXCLUDE REGEX ".*CPFEM.f90") -list(FILTER damask-sources EXCLUDE REGEX ".*DAMASK_Marc.*.f90") -list(FILTER damask-sources EXCLUDE REGEX ".*commercialFEM_fileList.*.f90") - - if(PROJECT_NAME STREQUAL "damask-grid") set(executable-name "DAMASK_grid") file(GLOB solver-sources CONFIGURE_DEPENDS grid/*.f90) diff --git a/src/C_routines.c b/src/C_routines.c index a25fde688..37364543d 100644 --- a/src/C_routines.c +++ b/src/C_routines.c @@ -58,8 +58,8 @@ void getusername_c(char username[], int *stat){ } -void signalterm_c(void (*handler)(int)){ - signal(SIGTERM, handler); +void signalint_c(void (*handler)(int)){ + signal(SIGINT, handler); } void signalusr1_c(void (*handler)(int)){ diff --git a/src/HDF5_utilities.f90 b/src/HDF5_utilities.f90 index 86807507b..fcd2c189a 100644 --- a/src/HDF5_utilities.f90 +++ b/src/HDF5_utilities.f90 @@ -48,7 +48,7 @@ module HDF5_utilities !> @details for parallel IO, all dimension except for the last need to match !-------------------------------------------------------------------------------------------------- interface HDF5_write -#if defined(__GFORTRAN__) && __GNUC__<11 +#if defined(__GFORTRAN__) module procedure HDF5_write_real1 module procedure HDF5_write_real2 module procedure HDF5_write_real3 @@ -1214,7 +1214,7 @@ subroutine HDF5_read_int7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_read_int7 -#if defined(__GFORTRAN__) && __GNUC__<11 +#if defined(__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type real with 1 dimension @@ -1631,7 +1631,7 @@ subroutine HDF5_write_str(dataset,loc_id,datasetName) end subroutine HDF5_write_str -#if defined(__GFORTRAN__) && __GNUC__<11 +#if defined(__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type integer with 1 dimension diff --git a/src/IO.f90 b/src/IO.f90 index 240c9e992..047d11add 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -428,6 +428,8 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) msg = 'too many systems requested' case (146) msg = 'number of values does not match' + case (147) + msg = 'V_e needs to be symmetric' case (148) msg = 'Nconstituents mismatch between homogenization and material' diff --git a/src/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 similarity index 87% rename from src/DAMASK_Marc.f90 rename to src/Marc/DAMASK_Marc.f90 index 6e969ced4..28cdf9223 100644 --- a/src/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -15,7 +15,7 @@ #define MARC4DAMASK Marc4DAMASK #endif -#include "prec.f90" +#include "../prec.f90" module DAMASK_interface use prec @@ -46,7 +46,7 @@ subroutine DAMASK_interface_init integer :: ierr character(len=pPathLen) :: wd - print'(/,1x,a)', '<<<+- DAMASK_marc init -+>>>' + print'(/,1x,a)', '<<<+- DAMASK_Marc init -+>>>' print*, 'Roters et al., Computational Materials Science 158:420–478, 2019' print*, 'https://doi.org/10.1016/j.commatsci.2018.04.030' @@ -139,8 +139,55 @@ end function solverIsSymmetric end module DAMASK_interface - -#include "commercialFEM_fileList.f90" +#include "../parallelization.f90" +#include "../constants.f90" +#include "../IO.f90" +#include "../YAML_types.f90" +#include "../YAML_parse.f90" +#include "../HDF5_utilities.f90" +#include "../results.f90" +#include "../config.f90" +#include "../LAPACK_interface.f90" +#include "../math.f90" +#include "../rotations.f90" +#include "../polynomials.f90" +#include "../lattice.f90" +#include "element.f90" +#include "../geometry_plastic_nonlocal.f90" +#include "../discretization.f90" +#include "discretization_Marc.f90" +#include "../material.f90" +#include "../phase.f90" +#include "../phase_mechanical.f90" +#include "../phase_mechanical_elastic.f90" +#include "../phase_mechanical_plastic.f90" +#include "../phase_mechanical_plastic_none.f90" +#include "../phase_mechanical_plastic_isotropic.f90" +#include "../phase_mechanical_plastic_phenopowerlaw.f90" +#include "../phase_mechanical_plastic_kinehardening.f90" +#include "../phase_mechanical_plastic_dislotwin.f90" +#include "../phase_mechanical_plastic_dislotungsten.f90" +#include "../phase_mechanical_plastic_nonlocal.f90" +#include "../phase_mechanical_eigen.f90" +#include "../phase_mechanical_eigen_cleavageopening.f90" +#include "../phase_mechanical_eigen_thermalexpansion.f90" +#include "../phase_thermal.f90" +#include "../phase_thermal_dissipation.f90" +#include "../phase_thermal_externalheat.f90" +#include "../phase_damage.f90" +#include "../phase_damage_isobrittle.f90" +#include "../phase_damage_anisobrittle.f90" +#include "../homogenization.f90" +#include "../homogenization_mechanical.f90" +#include "../homogenization_mechanical_pass.f90" +#include "../homogenization_mechanical_isostrain.f90" +#include "../homogenization_mechanical_RGC.f90" +#include "../homogenization_thermal.f90" +#include "../homogenization_thermal_pass.f90" +#include "../homogenization_thermal_isotemperature.f90" +#include "../homogenization_damage.f90" +#include "../homogenization_damage_pass.f90" +#include "materialpoint_Marc.f90" !-------------------------------------------------------------------------------------------------- !> @brief This is the MSC.Marc user subroutine for defining material behavior @@ -158,12 +205,12 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & use DAMASK_interface use config use YAML_types - use discretization_marc + use discretization_Marc use homogenization - use CPFEM + use materialpoint_Marc + use OMP_LIB implicit none - include "omp_lib.h" ! the openMP function library integer, intent(in) :: & ! according to MSC.Marc 2012 Manual D ngens, & !< size of stress-strain law nn, & !< integration point number @@ -214,8 +261,8 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & ! Marc common blocks are in fixed format so they have to be reformated to free format (f90) ! Beware of changes in newer Marc versions -#include QUOTE(PASTE(./Marc/include/concom,MARC4DAMASK)) ! concom is needed for inc, lovl -#include QUOTE(PASTE(./Marc/include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) +#include QUOTE(PASTE(include/concom,MARC4DAMASK)) ! concom is needed for inc, lovl +#include QUOTE(PASTE(include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) logical :: cutBack real(pReal), dimension(6) :: stress @@ -232,7 +279,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & logical, save :: & lastIncConverged = .false., & !< needs description outdatedByNewInc = .false., & !< needs description - CPFEM_init_done = .false., & !< remember whether init has been done already + materialpoint_init_done = .false., & !< remember whether init has been done already debug_basic = .true. class(tNode), pointer :: & debug_Marc ! pointer to Marc debug options @@ -255,9 +302,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc call omp_set_num_threads(1_pI32) ! no openMP - if (.not. CPFEM_init_done) then - CPFEM_init_done = .true. - call CPFEM_initAll + if (.not. materialpoint_init_done) then + materialpoint_init_done = .true. + call materialpoint_initAll debug_Marc => config_debug%get('Marc',defaultVal=emptyList) debug_basic = debug_Marc%contains('basic') endif @@ -265,9 +312,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & computationMode = 0 ! save initialization value, since it does not result in any calculation if (lovl == 4 ) then ! jacobian requested by marc if (timinc < theDelta .and. theInc == inc .and. lastLovl /= lovl) & ! first after cutback - computationMode = CPFEM_RESTOREJACOBIAN + computationMode = materialpoint_RESTOREJACOBIAN elseif (lovl == 6) then ! stress requested by marc - computationMode = CPFEM_CALCRESULTS + computationMode = materialpoint_CALCRESULTS if (cptim > theTime .or. inc /= theInc) then ! reached "convergence" terminallyIll = .false. cycleCounter = -1 ! first calc step increments this to cycle = 0 @@ -300,11 +347,11 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & !call mesh_build_ipCoordinates() ! update ip coordinates endif if (outdatedByNewInc) then - computationMode = ior(computationMode,CPFEM_AGERESULTS) + computationMode = ior(computationMode,materialpoint_AGERESULTS) outdatedByNewInc = .false. endif if (lastIncConverged) then - computationMode = ior(computationMode,CPFEM_BACKUPJACOBIAN) + computationMode = ior(computationMode,materialpoint_BACKUPJACOBIAN) lastIncConverged = .false. endif @@ -315,7 +362,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & endif lastLovl = lovl - call CPFEM_general(computationMode,ffn,ffn1,t(1),timinc,m(1),nn,stress,ddsdde) + call materialpoint_general(computationMode,ffn,ffn1,t(1),timinc,m(1),nn,stress,ddsdde) d = ddsdde(1:ngens,1:ngens) s = stress(1:ndi+nshear) @@ -333,7 +380,7 @@ end subroutine hypela2 subroutine flux(f,ts,n,time) use prec use homogenization - use discretization_marc + use discretization_Marc implicit none real(pReal), dimension(6), intent(in) :: & @@ -359,15 +406,15 @@ subroutine flux(f,ts,n,time) !-------------------------------------------------------------------------------------------------- subroutine uedinc(inc,incsub) use prec - use CPFEM - use discretization_marc + use materialpoint_Marc + use discretization_Marc implicit none integer, intent(in) :: inc, incsub integer :: n, nqncomp, nqdatatype integer, save :: inc_written real(pReal), allocatable, dimension(:,:) :: d_n -#include QUOTE(PASTE(./Marc/include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) +#include QUOTE(PASTE(include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) if (inc > inc_written) then @@ -379,8 +426,8 @@ subroutine uedinc(inc,incsub) endif enddo - call discretization_marc_UpdateNodeAndIpCoords(d_n) - call CPFEM_results(inc,cptim) + call discretization_Marc_UpdateNodeAndIpCoords(d_n) + call materialpoint_results(inc,cptim) inc_written = inc endif diff --git a/src/Marc/discretization_Marc.f90 b/src/Marc/discretization_Marc.f90 index fd6b8699d..c1525b05e 100644 --- a/src/Marc/discretization_Marc.f90 +++ b/src/Marc/discretization_Marc.f90 @@ -136,7 +136,7 @@ end subroutine discretization_Marc_updateNodeAndIpCoords !-------------------------------------------------------------------------------------------------- !> @brief Calculate and set current nodal and IP positions (including cell nodes) !-------------------------------------------------------------------------------------------------- -function discretization_marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell) +function discretization_Marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell) integer, intent(in) :: IP_FEM, elem_FEM integer :: cell @@ -147,7 +147,7 @@ function discretization_marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell) cell = (discretization_Marc_FEM2DAMASK_elem(elem_FEM)-1)*discretization_nIPs + IP_FEM -end function discretization_marc_FEM2DAMASK_cell +end function discretization_Marc_FEM2DAMASK_cell !-------------------------------------------------------------------------------------------------- @@ -1212,5 +1212,4 @@ logical function containsRange(str,chunkPos) end function containsRange - end module discretization_Marc diff --git a/src/element.f90 b/src/Marc/element.f90 similarity index 88% rename from src/element.f90 rename to src/Marc/element.f90 index c8e3b0416..295a41547 100644 --- a/src/element.f90 +++ b/src/Marc/element.f90 @@ -152,22 +152,14 @@ module element reshape([& -2,-3,-1 & ! Note: This fix is for gfortran 9 only. gfortran 8 supports neither, gfortran > 9 both variants -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR1)) -#else ],[NIPNEIGHBOR(CELLTYPE(1)),NIP(1)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(2)),NIP(2)), parameter :: IPNEIGHBOR2 = & reshape([& 2,-3, 3,-1, & -2, 1, 3,-1, & 2,-3,-2, 1 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR2)) -#else ],[NIPNEIGHBOR(CELLTYPE(2)),NIP(2)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(3)),NIP(3)), parameter :: IPNEIGHBOR3 = & reshape([& @@ -175,11 +167,7 @@ module element -2, 1, 4,-1, & 4,-4,-3, 1, & -2, 3,-3, 2 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR3)) -#else ],[NIPNEIGHBOR(CELLTYPE(3)),NIP(3)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(4)),NIP(4)), parameter :: IPNEIGHBOR4 = & reshape([& @@ -192,20 +180,12 @@ module element 8,-4,-3, 4, & 9, 7,-3, 5, & -2, 8,-3, 6 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR4)) -#else ],[NIPNEIGHBOR(CELLTYPE(4)),NIP(4)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(5)),NIP(5)), parameter :: IPNEIGHBOR5 = & reshape([& -1,-2,-3,-4 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR5)) -#else ],[NIPNEIGHBOR(CELLTYPE(5)),NIP(5)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(6)),NIP(6)), parameter :: IPNEIGHBOR6 = & reshape([& @@ -213,11 +193,7 @@ module element -2, 1, 3,-2, 4,-1, & 2,-4,-3, 1, 4,-1, & 2,-4, 3,-2,-3, 1 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR6)) -#else ],[NIPNEIGHBOR(CELLTYPE(6)),NIP(6)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(7)),NIP(7)), parameter :: IPNEIGHBOR7 = & reshape([& @@ -227,20 +203,12 @@ module element 5,-4, 6,-2,-5, 1, & -3, 4, 6,-2,-5, 2, & 5,-4,-3, 4,-5, 3 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR7)) -#else ],[NIPNEIGHBOR(CELLTYPE(7)),NIP(7)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(8)),NIP(8)), parameter :: IPNEIGHBOR8 = & reshape([& -3,-5,-4,-2,-6,-1 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR8)) -#else ],[NIPNEIGHBOR(CELLTYPE(8)),NIP(8)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(9)),NIP(9)), parameter :: IPNEIGHBOR9 = & reshape([& @@ -252,11 +220,7 @@ module element -3, 5, 8,-2,-6, 2, & 8,-5,-4, 5,-6, 3, & -3, 7,-4, 6,-6, 4 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR9)) -#else ],[NIPNEIGHBOR(CELLTYPE(9)),NIP(9)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(10)),NIP(10)), parameter :: IPNEIGHBOR10 = & reshape([& @@ -287,11 +251,7 @@ module element 26,-5,-4,22,-6,16, & 27,25,-4,23,-6,17, & -3,26,-4,24,-6,18 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR10)) -#else ],[NIPNEIGHBOR(CELLTYPE(10)),NIP(10)]) -#endif integer, dimension(NNODE(1),NCELLNODE(GEOMTYPE(1))), parameter :: CELLNODEPARENTNODEWEIGHTS1 = & @@ -299,11 +259,7 @@ module element 1, 0, 0, & 0, 1, 0, & 0, 0, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS1)) !< 2D 3node 1ip -#else ],[NNODE(1),NCELLNODE(GEOMTYPE(1))]) -#endif integer, dimension(NNODE(2),NCELLNODE(GEOMTYPE(2))), parameter :: CELLNODEPARENTNODEWEIGHTS2 = & reshape([& @@ -314,11 +270,7 @@ module element 0, 0, 0, 0, 1, 0, & 0, 0, 0, 0, 0, 1, & 1, 1, 1, 2, 2, 2 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS2)) !< 2D 6node 3ip -#else ],[NNODE(2),NCELLNODE(GEOMTYPE(2))]) -#endif integer, dimension(NNODE(3),NCELLNODE(GEOMTYPE(3))), parameter :: CELLNODEPARENTNODEWEIGHTS3 = & reshape([& @@ -331,11 +283,7 @@ module element 0, 0, 1, 1, & 1, 0, 0, 1, & 1, 1, 1, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS3)) !< 2D 6node 3ip -#else ],[NNODE(3),NCELLNODE(GEOMTYPE(3))]) -#endif integer, dimension(NNODE(4),NCELLNODE(GEOMTYPE(4))), parameter :: CELLNODEPARENTNODEWEIGHTS4 = & reshape([& @@ -355,11 +303,7 @@ module element 1, 4, 1, 1, 8, 8, 2, 2, & 1, 1, 4, 1, 2, 8, 8, 2, & 1, 1, 1, 4, 2, 2, 8, 8 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS4)) !< 2D 8node 9ip -#else ],[NNODE(4),NCELLNODE(GEOMTYPE(4))]) -#endif integer, dimension(NNODE(5),NCELLNODE(GEOMTYPE(5))), parameter :: CELLNODEPARENTNODEWEIGHTS5 = & reshape([& @@ -372,11 +316,7 @@ module element 0, 0, 0, 0, 0, 0, 1, 0, & 0, 0, 0, 0, 0, 0, 0, 1, & 1, 1, 1, 1, 2, 2, 2, 2 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS5)) !< 2D 8node 4ip -#else ],[NNODE(5),NCELLNODE(GEOMTYPE(5))]) -#endif integer, dimension(NNODE(6),NcellNode(GEOMTYPE(6))), parameter :: CELLNODEPARENTNODEWEIGHTS6 = & reshape([& @@ -384,11 +324,7 @@ module element 0, 1, 0, 0, & 0, 0, 1, 0, & 0, 0, 0, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS6)) !< 3D 4node 1ip -#else ],[NNODE(6),NcellNode(GEOMTYPE(6))]) -#endif integer, dimension(NNODE(7),NCELLNODE(GEOMTYPE(7))), parameter :: CELLNODEPARENTNODEWEIGHTS7 = & reshape([& @@ -407,11 +343,7 @@ module element 0, 1, 1, 1, 0, & 1, 0, 1, 1, 0, & 0, 0, 0, 0, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS7)) !< 3D 5node 4ip -#else ],[NNODE(7),NCELLNODE(GEOMTYPE(7))]) -#endif integer, dimension(NNODE(8),NCELLNODE(GEOMTYPE(8))), parameter :: CELLNODEPARENTNODEWEIGHTS8 = & reshape([& @@ -430,11 +362,7 @@ module element 0, 1, 1, 1, 0, 2, 0, 0, 2, 2, & 1, 0, 1, 1, 0, 0, 2, 2, 0, 2, & 3, 3, 3, 3, 4, 4, 4, 4, 4, 4 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS8)) !< 3D 10node 4ip -#else ],[NNODE(8),NCELLNODE(GEOMTYPE(8))]) -#endif integer, dimension(NNODE(9),NCELLNODE(GEOMTYPE(9))), parameter :: CELLNODEPARENTNODEWEIGHTS9 = & reshape([& @@ -459,11 +387,7 @@ module element 1, 0, 1, 1, 0, 1, & 0, 0, 0, 1, 1, 1, & 1, 1, 1, 1, 1, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS9)) !< 3D 6node 6ip -#else ],[NNODE(9),NCELLNODE(GEOMTYPE(9))]) -#endif integer, dimension(NNODE(10),NCELLNODE(GEOMTYPE(10))), parameter :: CELLNODEPARENTNODEWEIGHTS10 = & reshape([& @@ -475,11 +399,7 @@ module element 0, 0, 0, 0, 0, 1, 0, 0, & 0, 0, 0, 0, 0, 0, 1, 0, & 0, 0, 0, 0, 0, 0, 0, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS10)) !< 3D 8node 1ip -#else ],[NNODE(10),NCELLNODE(GEOMTYPE(10))]) -#endif integer, dimension(NNODE(11),NCELLNODE(GEOMTYPE(11))), parameter :: CELLNODEPARENTNODEWEIGHTS11 = & reshape([& @@ -510,11 +430,7 @@ module element 1, 0, 0, 1, 1, 0, 0, 1, & ! 25 0, 0, 0, 0, 1, 1, 1, 1, & ! 1, 1, 1, 1, 1, 1, 1, 1 & ! -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS11)) !< 3D 8node 8ip -#else ],[NNODE(11),NCELLNODE(GEOMTYPE(11))]) -#endif integer, dimension(NNODE(12),NCELLNODE(GEOMTYPE(12))), parameter :: CELLNODEPARENTNODEWEIGHTS12 = & reshape([& @@ -545,11 +461,7 @@ module element 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 2, 2, 0, 0, 2, & ! 25 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, & ! 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 & ! -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS12)) !< 3D 20node 8ip -#else ],[NNODE(12),NCELLNODE(GEOMTYPE(12))]) -#endif integer, dimension(NNODE(13),NCELLNODE(GEOMTYPE(13))), parameter :: CELLNODEPARENTNODEWEIGHTS13 = & reshape([& @@ -617,32 +529,20 @@ module element 4, 8, 4, 3, 8,24, 8, 4, 12,12, 4, 4, 32,32,12,12, 12,32,12, 4, & ! 3, 4, 8, 4, 4, 8,24, 8, 4,12,12, 4, 12,32,32,12, 4,12,32,12, & ! 4, 3, 4, 8, 8, 4, 8,24, 4, 4,12,12, 12,12,32,32, 12, 4,12,32 & ! -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS13)) !< 3D 20node 27ip -#else ],[NNODE(13),NCELLNODE(GEOMTYPE(13))]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(1)),NIP(1)), parameter :: CELL1 = & reshape([& 1,2,3 & -#if !defined(__GFORTRAN__) - ],shape(CELL1)) -#else ],[NCELLNODEPERCELL(CELLTYPE(1)),NIP(1)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(2)),NIP(2)), parameter :: CELL2 = & reshape([& 1, 4, 7, 6, & 2, 5, 7, 4, & 3, 6, 7, 5 & -#if !defined(__GFORTRAN__) - ],shape(CELL2)) -#else ],[NCELLNODEPERCELL(CELLTYPE(2)),NIP(2)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(3)),NIP(3)), parameter :: CELL3 = & reshape([& @@ -650,11 +550,7 @@ module element 5, 2, 6, 9, & 8, 9, 7, 4, & 9, 6, 3, 7 & -#if !defined(__GFORTRAN__) - ],shape(CELL3)) -#else ],[NCELLNODEPERCELL(CELLTYPE(3)),NIP(3)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(4)),NIP(4)), parameter :: CELL4 = & reshape([& @@ -667,20 +563,12 @@ module element 11,16,10, 4, & 16,15, 9,10, & 15, 8, 3, 9 & -#if !defined(__GFORTRAN__) - ],shape(CELL4)) -#else ],[NCELLNODEPERCELL(CELLTYPE(4)),NIP(4)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(5)),NIP(5)), parameter :: CELL5 = & reshape([& 1, 2, 3, 4 & -#if !defined(__GFORTRAN__) - ],shape(CELL5)) -#else ],[NCELLNODEPERCELL(CELLTYPE(5)),NIP(5)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(6)),NIP(6)), parameter :: CELL6 = & reshape([& @@ -688,11 +576,7 @@ module element 5, 2, 6,11,12, 9,13,15, & 7,11, 6, 3,14,15,13,10, & 8,12,15,14, 4, 9,13,10 & -#if !defined(__GFORTRAN__) - ],shape(CELL6)) -#else ],[NCELLNODEPERCELL(CELLTYPE(6)),NIP(6)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(7)),NIP(7)), parameter :: CELL7 = & reshape([& @@ -702,20 +586,12 @@ module element 10,17,21,19, 4,13,20,15, & 17,11,18,21,13, 5,14,20, & 19,21,18,12,15,20,14, 6 & -#if !defined(__GFORTRAN__) - ],shape(CELL7)) -#else ],[NCELLNODEPERCELL(CELLTYPE(7)),NIP(7)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(8)),NIP(8)), parameter :: CELL8 = & reshape([& 1, 2, 3, 4, 5, 6, 7, 8 & -#if !defined(__GFORTRAN__) - ],shape(CELL8)) -#else ],[NCELLNODEPERCELL(CELLTYPE(8)),NIP(8)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(9)),NIP(9)), parameter :: CELL9 = & reshape([& @@ -727,11 +603,7 @@ module element 22,18,23,27,13, 6,14,26, & 25,27,24,20,16,26,15, 8, & 27,23,19,24,26,14, 7,15 & -#if !defined(__GFORTRAN__) - ],shape(CELL9)) -#else ],[NCELLNODEPERCELL(CELLTYPE(9)),NIP(9)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(10)),NIP(10)), parameter :: CELL10 = & reshape([& @@ -762,11 +634,7 @@ module element 51,64,50,24,31,56,30, 8, & 64,63,49,50,56,55,29,30, & 63,48,23,49,55,28, 7,29 & -#if !defined(__GFORTRAN__) - ],shape(CELL10)) -#else ],[NCELLNODEPERCELL(CELLTYPE(10)),NIP(10)]) -#endif integer, dimension(NCELLNODEPERCELLFACE(1),NIPNEIGHBOR(1)), parameter :: CELLFACE1 = & @@ -774,11 +642,7 @@ module element 2,3, & 3,1, & 1,2 & -#if !defined(__GFORTRAN__) - ],shape(CELLFACE1)) !< 2D 3node, VTK_TRIANGLE (5) -#else ],[NCELLNODEPERCELLFACE(1),NIPNEIGHBOR(1)]) -#endif integer, dimension(NCELLNODEPERCELLFACE(2),NIPNEIGHBOR(2)), parameter :: CELLFACE2 = & reshape([& @@ -786,11 +650,7 @@ module element 4,1, & 3,4, & 1,2 & -#if !defined(__GFORTRAN__) - ],shape(CELLFACE2)) !< 2D 4node, VTK_QUAD (9) -#else ],[NCELLNODEPERCELLFACE(2),NIPNEIGHBOR(2)]) -#endif integer, dimension(NCELLNODEPERCELLFACE(3),NIPNEIGHBOR(3)), parameter :: CELLFACE3 = & reshape([& @@ -798,11 +658,7 @@ module element 1,2,4, & 2,3,4, & 1,4,3 & -#if !defined(__GFORTRAN__) - ],shape(CELLFACE3)) !< 3D 4node, VTK_TETRA (10) -#else ],[NCELLNODEPERCELLFACE(3),NIPNEIGHBOR(3)]) -#endif integer, dimension(NCELLNODEPERCELLFACE(4),NIPNEIGHBOR(4)), parameter :: CELLFACE4 = & reshape([& @@ -812,12 +668,7 @@ module element 1,2,6,5, & 5,6,7,8, & 1,4,3,2 & -#if !defined(__GFORTRAN__) - ],shape(CELLFACE4)) !< 3D 8node, VTK_HEXAHEDRON (12) -#else ],[NCELLNODEPERCELLFACE(4),NIPNEIGHBOR(4)]) -#endif - contains diff --git a/src/Marc/include/concom2022.1 b/src/Marc/include/concom2022.1 new file mode 100644 index 000000000..86cd4440c --- /dev/null +++ b/src/Marc/include/concom2022.1 @@ -0,0 +1,464 @@ +! common block definition file taken from respective MSC.Marc release and reformated to free format +!*********************************************************************** +! +! File: concom.cmn +! +! MSC.Marc include file +! +integer & + iacous, iasmbl, iautth, ibear, icompl, iconj, icreep, ideva, idyn, idynt,& + ielas, ielcma, ielect, iform, ifour, iharm, ihcps, iheat, iheatt, ihresp,& + ijoule, ilem, ilnmom, iloren, inc, incext, incsub, ipass, iplres, ipois,& + ipoist, irpflo, ismall, ismalt, isoil, ispect, ispnow, istore, iswep, ithcrp,& + itherm, iupblg, iupdat, jacflg, jel, jparks, largst, lfond, loadup, loaduq,& + lodcor, lovl, lsub, magnet, ncycle, newtnt, newton, noshr, linear, ivscpl,& + icrpim, iradrt, ipshft, itshr, iangin, iupmdr, iconjf, jincfl, jpermg, jhour,& + isolvr, jritz, jtable, jshell, jdoubl, jform, jcentr, imini, kautth, iautof,& + ibukty, iassum, icnstd, icnstt, kmakmas, imethvp, iradrte, iradrtp, iupdate, iupdatp,& + ncycnt, marmen , idynme, ihavca, ispf, kmini, imixex, largtt, kdoela, iautofg,& + ipshftp, idntrc, ipore, jtablm, jtablc, isnecma, itrnspo, imsdif, jtrnspo, mcnear,& + imech, imecht, ielcmat, ielectt, magnett, imsdift, noplas, jtabls, jactch, jtablth,& + kgmsto , jpzo, ifricsh, iremkin, iremfor, ishearp, jspf, machining, jlshell, icompsol,& + iupblgfo, jcondir, nstcrp, nactive, ipassref, nstspnt, ibeart, icheckmpc, noline, icuring,& + ishrink, ioffsflg, isetoff, ioffsetm,iharmt, inc_incdat, iautspc, ibrake, icbush, istream_input,& + iprsinp, ivlsinp, ifirst_time,ipin_m, jgnstr_glb, imarc_return,iqvcinp, nqvceid, istpnx, imicro1,& + iaxisymm, jbreakglue,iglstif, jfastasm,iwear, iwearcf, imixmeth, ielcmadyn, idinout, igena_meth,& + magf_meth, non_assumed, iredoboudry, ioffsz0,icomplt, mesh_dual, iactrp, mgnewton, iusedens,igsigd0,& + iaem, icosim, inodels, nlharm, iampini, iphasetr, inonlcl, inonlct, iforminp,ispecerror,& + icsprg, imol, imolt, idatafit,iharmpar, inclcase, imultifreq,init_elas, ifatig, iftgmat,& + nchybrid, ibuckle +dimension :: ideva(60) +integer num_concom +parameter(num_concom=262) +common/marc_concom/& + iacous, iasmbl, iautth, ibear, icompl, iconj, icreep, ideva, idyn, idynt,& + ielas, ielcma, ielect, iform, ifour, iharm, ihcps, iheat, iheatt, ihresp,& + ijoule, ilem, ilnmom, iloren, inc, incext, incsub, ipass, iplres, ipois,& + ipoist, irpflo, ismall, ismalt, isoil, ispect, ispnow, istore, iswep, ithcrp,& + itherm, iupblg, iupdat, jacflg, jel, jparks, largst, lfond, loadup, loaduq,& + lodcor, lovl, lsub, magnet, ncycle, newtnt, newton, noshr, linear, ivscpl,& + icrpim, iradrt, ipshft, itshr, iangin, iupmdr, iconjf, jincfl, jpermg, jhour,& + isolvr, jritz, jtable, jshell, jdoubl, jform, jcentr, imini, kautth, iautof,& + ibukty, iassum, icnstd, icnstt, kmakmas, imethvp, iradrte, iradrtp, iupdate, iupdatp,& + ncycnt, marmen, idynme, ihavca, ispf, kmini, imixex, largtt, kdoela, iautofg,& + ipshftp, idntrc, ipore, jtablm, jtablc, isnecma, itrnspo, imsdif, jtrnspo, mcnear,& + imech, imecht, ielcmat, ielectt, magnett, imsdift, noplas, jtabls, jactch, jtablth,& + kgmsto , jpzo, ifricsh, iremkin, iremfor, ishearp, jspf, machining, jlshell, icompsol,& + iupblgfo, jcondir, nstcrp, nactive, ipassref, nstspnt, ibeart, icheckmpc, noline, icuring,& + ishrink, ioffsflg, isetoff, ioffsetm,iharmt, inc_incdat, iautspc, ibrake, icbush, istream_input,& + iprsinp, ivlsinp, ifirst_time,ipin_m, jgnstr_glb, imarc_return,iqvcinp, nqvceid, istpnx, imicro1,& + iaxisymm, jbreakglue,iglstif, jfastasm,iwear, iwearcf, imixmeth, ielcmadyn, idinout, igena_meth,& + magf_meth, non_assumed, iredoboudry, ioffsz0,icomplt, mesh_dual, iactrp, mgnewton, iusedens,igsigd0,& + iaem, icosim, inodels, nlharm, iampini, iphasetr, inonlcl, inonlct, iforminp,ispecerror,& + icsprg, imol, imolt, idatafit,iharmpar, inclcase, imultifreq,init_elas, ifatig, iftgmat,& + nchybrid, ibuckle +! +! comments of variables: +! +! iacous Control flag for acoustic analysis. Input data. +! iacous=1 modal acoustic analysis. +! iacous=2 harmonic acoustic-structural analysis. +! iasmbl Control flag to indicate that operator matrix should be +! recalculated. +! iautth Control flag for AUTO THERM option. +! ibear Control flag for bearing analysis. Input data. +! icompl Control variable to indicate that a complex analysis is +! being performed. Either a Harmonic analysis with damping, +! or a harmonic electro-magnetic analysis. Input data. +! iconj Flag for EBE conjugate gradient solver (=solver 1, retired) +! Also used for VKI iterative solver. +! icreep Control flag for creep analysis. Input data. +! ideva(60) - debug print out flag +! 1 print element stiffness matrices, mass matrix +! 2 output matrices used in tying +! 3 force the solution of a nonpositive definite matrix +! 4 print info of connections to each node +! 5 info of gap convergence, internal heat generated, contact +! touching and separation +! 6 nodal value array during rezoning +! 7 tying info in CONRAD GAP option, fluid element numbers in +! CHANNEL option +! 8 output incremental displacements in local coord. system +! 9 latent heat output +! 10 stress-strain in local coord. system +! 11 additional info on interlaminar stress +! 12 output right hand side and solution vector +! 13 info of CPU resources used and memory available on NT +! 14 info of mesh adaption process, 2D outline information +! info of penetration checking for remeshing +! save .fem files after afmesh3d meshing +! print local adaptivity info +! 15 surface energy balance flag +! 16 print info regarding pyrolysis +! 17 print info of "streamline topology" +! 18 print mesh data changes after remeshing +! 19 print material flow stress data read in from *.mat file +! if unit flag is on, print out flow stress after conversion +! 20 print information on table input +! 21 print out information regarding kinematic boundary conditions +! 22 print out information regarding dist loads, point loads, film +! and foundations +! 23 print out information about automatic domain decomposition +! 24 print out iteration information in SuperForm status report file +! 25 print out information for ablation +! 26 print out information for films - Table input +! 27 print out the tying forces +! 28 print out for CASI solver, convection, +! 29 DDM single file debug printout +! 30 print out cavity debug info +! 31 print out welding related info +! 32 prints categorized DDM memory usage +! 33 print out the cutting info regarding machining feature +! 34 print out the list of quantities which can be defined via a table +! and for each quantity the supported independent variables +! 35 print out detailed coupling region info +! 36 print out solver debug info level 1 (Least Detailed) +! 37 print out solver debug info level 1 (Medium Detailed) +! 38 print out solver debug info level 1 (Very Detailed) +! 39 print detailed memory allocation info +! 40 print out marc-adams debug info +! 41 output rezone mapping post file for debugging +! 42 output post file after calling oprofos() for debugging +! 43 debug printout for vcct +! 44 debug printout for progressive failure +! 45 print out automatically generated midside node coordinates (arecrd) +! 46 print out message about routine and location, where the ibort is raised (ibort_inc) +! 47 print out summary message of element variables on a +! group-basis after all the automatic changes have been +! made (em_ellibp) +! 48 Automatically generate check results based on max and min vals. +! These vals are stored in the checkr file, which is inserted +! into the *dat file by the generate_check_results script from /marc/tools +! 49 Automatically generate check results based on the real calculated values +! at the sppecified check result locations. +! These vals are stored in the checkr file, which is inserted +! into the *dat file by the update_check_results script from /marc/tools +! 50 generate a file containing the resistance or capacity matrix; +! this file can be used to compare results with a reference file +! 51 print out detailed information for segment-to-segment contact +! 52 print out detailed relative displacement information +! for uniaxial sliding contact +! 53 print out detailed sliding direction information for +! uniaxial sliding contact +! 54 print out detailed information for edges attached to a curve +! 55 print information related to viscoelasticity calculations +! 56 print out detailed information for element coloring for multithreading +! 57 print out extra overheads due to multi-threading. +! These overhead includes (i) time and (ii) memory. +! The memory report will be summed over all the children. +! 58 debug output for ELSTO usage +! 59 print out contact body forces and nodes in contact +! +! idyn Control flag for dynamics. Input data. +! 1 = eigenvalue extraction and / or modal superposition +! 2 = Newmark Beta and Single Step Houbolt (ssh with idynme=1) +! 3 = Houbolt +! 4 = Central difference +! 5 = Newer central difference +! idynt Copy of idyn at begining of increment +! ielas Control flag for ELASTIC analysis. Input data. +! Set by user or automatically turned on by Fourier option. +! Implies that each load case is treated separately. +! In Adaptive meshing analysis , forces re-analysis until +! convergence obtained. +! Also seriously misused to indicate no convergence. +! = 1 elastic option with fourier analysis +! = 2 elastic option without fourier analysis +! =-1 no convergence in recycles or max # increments reached +! Set to 1 if ELASTIC or SUBSTRUC parameter cards are used, +! or if fourier option is used. +! Then set to 2 if not fourier analysis. +! ielcma Control flag for electromagnetic analysis. Input data. +! ielcma = 1 Harmonic formulation +! ielcma = 2 Transient formulation +! ielect Control flag for electrostatic option. Input data. +! iform Control flag indicating that contact will be performed. +! ifour Control flag for Fourier analysis. +! 0 = Odd and even terms. +! 1 = symmetric (cosine) terms +! 2 = antisymmetric (sine) terms. +! iharm Control flag to indicate that a harmonic analysis will +! be performed. May change between passes. +! ihcps Control flag for coupled thermal - stress analysis. +! iheat Control flag for heat transfer analysis. Input data. +! iheatt Permanent control flag for heat transfer analysis. +! Note in coupled analysis iheatt will remain as one, +! but iheat will be zero in stress pass. +! ihresp Control flag to indicate to perform a harmonic subincrement. +! ijoule Control flag for Joule heating. +! ilem Control flag to determin which vector is to be transformed. +! Control flag to see where one is: +! ilem = 1 - elem.f +! ilem = 2 - initst.f +! ilem = 3 - pressr.f +! ilem = 3 - fstif.f +! ilem = 4 - jflux.f +! ilem = 4 - strass.f +! ilem = 5 - mass.f +! ilem = 5 - osolty.f +! ilnmom Control flag for soil - pore pressure calculation. Input data. +! ilnmom = 0 - perform only pore pressure calculation. +! = 1 - couples pore pressure - displacement analysis +! iloren Control flag for DeLorenzi J-Integral evaluation. Input data. +! inc Increment number. +! incext Control flag indicating that currently working on a +! subincrement. +! Could be due to harmonics , damping component (bearing), +! stiffness component (bearing), auto therm creep or +! old viscoplaticity +! incsub Sub-increment number. +! inonlcl control flag for nonlocal pass +! inonlct permanent control flag for nonlocal pass +! ipass Control flag for which part of coupled analysis. +! ipass = -1 - reset to base values +! ipass = 0 - do nothing +! ipass = 1 - stress part +! ipass = 2 - heat transfer part +! 3 - fluid pass +! 4 - joule heating pass +! 5 - pore pressure pass +! 6 - electrostatic pass +! 7 - magnetostatic pass +! 8 - electromagnetic pass +! 9 - diffusion pass +! ipass = 10 - nonlocal part +! iplres Flag indicating that either second matrix is stored. +! dynamic analysis - mass matrix +! heat transfer - specific heat matrix +! buckle - initial stress stiffness +! ipois Control flag indicating Poisson type analysis +! ipois = 1 for heat transfer +! = 1 for heat transfer part of coupled +! = 1 for bearing +! = 1 for electrostatic +! = 1 for magnetostatic +! = 1 for nonlocal part +! ipoist Permanent copy of ipois. In coupled analysis , ipois = 0 +! in stress portion, yet ipoist will still =1. +! irpflo global flag for rigid plastic flow analysis +! = 1 eularian formulation +! = 2 regular formulation; rigid material present in the analysis +! ismall control flag to indicate small displacement analysis. input data. +! ismall = 0 - large disp included. +! ismall = 1 - small displacement. +! the flag is changing between passes. +! ismalt permanent copy of ismall . in heat transfer portion of +! coupled analysis ismall =0 , but ismalt remains the same. +! isoil control flag indicating that soil / pore pressure +! calculation . input data. +! ispect control flag for response spectrum calculation. input data. +! ispnow control flag to indicate to perform a spectrum response +! calculation now. +! istore store stresses flag. +! istore = 0 in elem.f and if first pass of creep +! convergence checking in ogetst.f +! or harmonic analysis or thruc.f if not +! converged. +! iswep control flag for eigenvalue analysis. +! iswep=1 - go do extraction process +! ithcrp control flag for auto therm creep option. input data. +! itherm control flag for either temperature dependent material +! properties and/or thermal loads. +! iupblg control flag for follower force option. input data. +! iupdat control flag for update lagrange option for current element. +! jacflg control flag for lanczos iteration method. input data. +! jel control flag indicating that total load applied in +! increment, ignore previous solution. +! jel = 1 in increment 0 +! = 1 if elastic or fourier +! = 1 in subincrements with elastic and adaptive +! jparks control flag for j integral by parks method. input data. +! largst control flag for finite strain plasticity. input data. +! lfond control variable that indicates if doing elastic +! foundation or film calculation. influences whether +! this is volumetric or surface integration. +! loadup control flag that indicates that nonlinearity occurred +! during previous increment. +! loaduq control flag that indicates that nonlinearity occurred. +! lodcor control flag for switching on the residual load correction. +! notice in input stage lodcor=0 means no loadcor, +! after omarc lodcor=1 means no loadcor +! lovl control flag for determining which "overlay" is to +! be called from ellib. +! lovl = 1 omarc +! = 2 oaread +! = 3 opress +! = 4 oasemb +! = 5 osolty +! = 6 ogetst +! = 7 oscinc +! = 8 odynam +! = 9 opmesh +! = 10 omesh2 +! = 11 osetz +! = 12 oass +! = 13 oincdt +! = 14 oasmas +! = 15 ofluas +! = 16 ofluso +! = 17 oshtra +! = 18 ocass +! = 19 osoltc +! = 20 orezon +! = 21 otest +! = 22 oeigen +! lsub control variable to determine which part of element +! assembly function is being done. +! lsub = 1 - no longer used +! = 2 - beta* +! = 3 - cons* +! = 4 - ldef* +! = 5 - posw* +! = 6 - theta* +! = 7 - tmarx* +! = 8 - geom* +! magnet control flag for magnetostatic analysis. input data. +! ncycle cycle number. accumulated in osolty.f +! note first time through oasemb.f , ncycle = 0. +! newtnt control flag for permanent copy of newton. +! newton iteration type. input data. +! newton : = 1 full newton raphson +! 2 modified newton raphson +! 3 newton raphson with strain correct. +! 4 direct substitution +! 5 direct substitution followed by n.r. +! 6 direct substitution with line search +! 7 full newton raphson with secant initial stress +! 8 secant method +! 9 full newton raphson with line search +! noshr control flag for calculation interlaminar shears for +! elements 22,45, and 75. input data. +!ees +! +! jactch = 1 or 2 if elements are activated or deactivated +! = 3 if elements are adaptively remeshed or rezoned +! = 0 normally / reset to 0 when assembly is done +! ifricsh = 0 call to fricsh in otest not needed +! = 1 call to fricsh (nodal friction) in otest needed +! iremkin = 0 remove deactivated kinematic boundary conditions +! immediately - only in new input format (this is default) +! = 1 remove deactivated kinematic boundary conditions +! gradually - only in new input format +! iremfor = 0 remove force boundary conditions immediately - +! only in new input format (this is default) +! = 1 remove force boundary conditions gradually - +! only in new input format (this is default) +! ishearp set to 1 if shear panel elements are present in the model +! +! jspf = 0 not in spf loadcase +! > 0 in spf loadcase (jspf=1 during first increment) +! machining = 1 if the metal cutting feature is used, for memory allocation purpose +! = 0 (default) if no metal cutting feature required +! +! jlshell = 1 if there is a shell element in the mesh +! icompsol = 1 if there is a composite solid element in the mesh +! iupblgfo = 1 if follower force for point loads +! jcondir = 1 if contact priority option is used +! nstcrp = 0 (default) steady state creep flag (undocumented feature. +! if not 0, turns off special ncycle = 0 code in radial.f) +! nactive = number of active passes, if =1 then it's not a coupled analysis +! ipassref = reference ipass, if not in a multiphysics pass ipass=ipassref +! icheckmpc = value of mpc-check parameter option +! noline = set to 1 in osolty if no line seacrh should be done in ogetst +! icuring = set to 1 if the curing is included for the heat transfer analysis. +! ishrink = set to 1 if shrinkage strain is included for mechancial analysis. +! ioffsflg = 1 for small displacement beam/shell offsets +! = 2 for large displacement beam/shell offsets +! isetoff = 0 - do not apply beam/shell offsets +! = 1 - apply beam/shell offsets +! ioffsetm = min. value of offset flag +! iharmt = 1 global flag if a coupled analysis contains an harmonic pass +! inc_incdat = flag to record increment number of a new loadcase in incdat.f +! iautspc = flag for AutoSPC option +! ibrake = brake squeal in this increment +! icbush = set to 1 if cbush elements present in model +! istream_input = set to 1 for streaming input calling Marc as library +! iprsinp = set to 1 if pressure input, introduced so other variables +! such as h could be a function of pressure +! ivlsinp = set to 1 if velocity input, introduced so other variables +! such as h could be a function of velocity +! ipin_m = # of beam element with PIN flag +! jgnstr_glb = global control over pre or fast integrated composite shells +! imarc_return = Marc return flag for streaming input control +! iqvcimp = if non-zero, then the number of QVECT boundary conditions +! nqvceid = number of QVECT boundary conditions, where emisivity/absorbtion id entered +! istpnx = 1 if to stop at end of increment +! imicro1 = 1 if micro1 interface is used +! iaxisymm = set to 1 if axisymmetric analysis +! jbreakglue = set to 1 if breaking glued option is used +! iglstif = 1 if ddm and global stiffness matrix formed (sgi solver 6 or solver9) +! jfastasm = 1 do fast assembly using SuperForm code +! iwear = set to 1 if wear model, set to 2 if wear model and coordinates updated +! iwearcf = set to 1 to store nodal coefficient of friction for wear calculation +! imixmeth = set=1 then use nonlinear mixture material - allocate memory +! ielcmadyn = flag for magnetodynamics +! 0 - electromagnetics using newmark beta +! 1 - transient magnetics using backward euler +! idinout = flag to control if inside out elements should be deactivated +! igena_meth = 0 - generalized alpha parameters depend on whether or not contact +! is flagged (dynamic,7) +! 10 - generalized alpha parameters are optimized for a contact +! analysis (dynamic,8) +! 11 - generalized alpha parameters are optimized for an analysis +! without contact (dynamic,8) +! magf_meth = - Method to compute force in magnetostatic - structural +! = 1 - Virtual work method based on finite difference for the force computation +! = 2 - Maxwell stress tensor +! = 3 - Virtual work method based on local derivative for the force computation +! non_assumed = 1 no assumed strain formulation (forced) +! iredoboudry set to 1 if contact boundary needs to be recalculated +! ioffsz0 = 1 if composite are used with reference position.ne.0 +! icomplt = 1 global flag if a coupled analysis contains an complex pass +! mesh_dual = 1 two independent meshes are used in magnetodynamic/thermal/structural +! one for magnetodynamic and the other for the remaining passes +! iactrp = 1 in an analysis with global remeshing, include inactive +! rigid bodies on post file +! mgnewton = 1 Use full Newton Raphson iteration for magnetostatic pass +! +! iusedens > 0 if mass density is used in the analysis (dynamics, mass dependent loading) +! igsigd0 = 1 set varselem(igsigd) to zero in next oasemb +! iaem = 1 if marc is called from aem (0 - off - default) +! icosim = 1 if marc is used in co-simulation analysis with ADAMS using the CosimEngine +! = 2 if marc is used in co-simulation analysis with ADAMS using the ACSI interface +! = 3 if marc is used in co-simulation analysis with scFLOW using the CosimEngine +! = 4 if marc is used in co-simulation analysis with scFLOW and ADAMS using the CosimEngine +! inodels = 1 nodal integration elements 239/240/241 present +! nlharm = 0 harmonic subincrements are linear +! = 1 harmonic subincrements are nonlinear +! iampini = 0 amplitude of previous harmonic subinc is initial estimate (default) +! = 1 zero amplitude is initial estimate +! iphasetr = 1 phase transformation material model is used +! iforminp flag indicating that contact is switched on via the CONTACT +! option in the input file (as opposed to the case that contact +! is switched on internally due to cyclic symmetry or model +! section creation) +! ispecerror = a+10*b (only for spectrum response analysis with missing mass option) +! a=0 or a=1 (modal shape with non-zero shift) +! b=0 or b=1 (recover with new assembly of stiffness matrix) +! icsprg = set to 1 if spring elements present in model +! imol Control flag for molecualr diffusion pass +! imolt Permanent control flag for molecualr diffusion pass +! Note in coupled analysis imolt will remain as one, +! but imol will be zero in stress pass or thermal pass. +! idatafit = run Marc to fit parameters +! iharmpar = 1 if harmonic parameter option is used +! inclcase load case increment use for cyclic plasticity data fitting +! imultifreq flag to indicate how many harmonic magnetodynamic passes are computed in coupled +! magnetodynamic/thermal(/structural) analyses. +! 0 or 1 one pass 2 two passes 3 or more is not supported +! init_elas use elastic stress-strain law as the material tangent for +! the first cycle of an increment +! ifatig packed integer telling which fatigue mode is active +! 1 = elastomer +! 10 = stress-life +! 100 = strain-life +! = 2 strain-life fatigue +! iftgmat = 0 no fatigue material properties in the dat file +! = 1 fatigue material properties in the dat file +! nchybrid cycle count used for hybrid contact; meant to force an extra iteration +! if the overlap for a node in hybrid contact is too large +! ibuckle buckle parameter option is active +! +!*********************************************************************** +!$omp threadprivate(/marc_concom/) +!! diff --git a/src/Marc/include/creeps2022.1 b/src/Marc/include/creeps2022.1 new file mode 100644 index 000000000..8fa4c8401 --- /dev/null +++ b/src/Marc/include/creeps2022.1 @@ -0,0 +1,72 @@ +! common block definition file taken from respective MSC.Marc release and reformated to free format +!*********************************************************************** +! +! File: creeps.cmn +! +! MSC.Marc include file +! +real(pReal) cptim,timinc,timinc_p,timinc_s,timincm,timinc_a,timinc_b +integer icfte,icfst,icfeq,icftm,icetem,mcreep,jcreep,icpa,icftmp,icfstr,& + icfqcp,icfcpm,icrppr,icrcha,icpb,iicpmt,iicpa +real(pReal) time_beg_lcase,time_beg_inc,fractol,time_beg_pst +real(pReal) fraction_donn,timinc_ol2 +! +integer num_creepsr,num_creepsi,num_creeps2r +parameter(num_creepsr=7) +parameter(num_creepsi=17) +parameter(num_creeps2r=6) +common/marc_creeps/cptim,timinc,timinc_p,timinc_s,timincm,timinc_a,timinc_b,icfte,icfst,& + icfeq,icftm,icetem,mcreep,jcreep,icpa,icftmp,icfstr,icfqcp,icfcpm,icrppr,icrcha,icpb,iicpmt,iicpa +common/marc_creeps2/time_beg_lcase,time_beg_inc,fractol,time_beg_pst,fraction_donn,timinc_ol2 +! +! cptim Total time at begining of increment. +! timinc Incremental time for this step. +! icfte Local copy number of slopes of creep strain rate function +! versus temperature. Is -1 if exponent law used. +! icfst Local copy number of slopes of creep strain rate function +! versus equivalent stress. Is -1 if exponent law used. +! icfeq Local copy number of slopes of creep strain rate function +! versus equivalent strain. Is -1 if exponent law used. +! icftm Local copy number of slopes of creep strain rate function +! versus time. Is -1 if exponent law used. +! icetem Element number that needs to be checked for creep convergence +! or, if negative, the number of elements that need to +! be checked. In the latter case the elements to check +! are stored in ielcp. +! mcreep Maximum nuber of iterations for explicit creep. +! jcreep Counter of number of iterations for explicit creep +! procedure. jcreep must be .le. mcreep +! icpa(1-6) Pointer to constants in creep strain rate expression. +! icftmp Pointer to temperature dependent creep strain rate data. +! icfstr Pointer to equivalent stress dependent creep strain rate data. +! icfqcp Pointer to equivalent creep strain dependent creep strain +! rate data. +! icfcpm Pointer to equivalent creep strain rate dependent +! creep strain rate data. +! icrppr Permanent copy of icreep +! icrcha Control flag for creep convergence checking , if set to +! 1 then testing on absolute change in stress and creep +! strain, not relative testing. Input data. +! icpb(1-4) Pointer to storage of material id cross reference numbers. +! iicpmt creep law type ID +! =1 - power law +! =2 - solder +! =3 - steady-creep +! =4 - hyperbolic steady-creep +! iicpa Pointer to table IDs for constants in creep strain rate +! expression +! +! +! time_beg_lcase time at the beginning of the current load case +! time_beg_inc time at the beginning of the current increment +! fractol fraction of loadcase or increment time when we +! consider it to be finished +! time_beg_pst time corresponding to first increment to be +! read in from thermal post file for auto step +! +! timinc_old Time step of the previous increment +! +!*********************************************************************** +!!$omp threadprivate(/marc_creeps/) +!!$omp threadprivate(/marc_creeps2/) +!! diff --git a/src/CPFEM.f90 b/src/Marc/materialpoint_Marc.f90 similarity index 66% rename from src/CPFEM.f90 rename to src/Marc/materialpoint_Marc.f90 index 37e4ba737..79b06b80d 100644 --- a/src/CPFEM.f90 +++ b/src/Marc/materialpoint_Marc.f90 @@ -1,9 +1,9 @@ !-------------------------------------------------------------------------------------------------- !> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH -!> @brief CPFEM engine +!> @brief materialpoint engine !-------------------------------------------------------------------------------------------------- -module CPFEM +module materialpoint_Marc use DAMASK_interface use prec use IO @@ -21,30 +21,30 @@ module CPFEM use homogenization use discretization - use discretization_marc + use discretization_Marc implicit none private real(pReal), dimension (:,:,:), allocatable, private :: & - CPFEM_cs !< Cauchy stress + materialpoint_cs !< Cauchy stress real(pReal), dimension (:,:,:,:), allocatable, private :: & - CPFEM_dcsdE !< Cauchy stress tangent + materialpoint_dcsdE !< Cauchy stress tangent real(pReal), dimension (:,:,:,:), allocatable, private :: & - CPFEM_dcsdE_knownGood !< known good tangent + materialpoint_dcsdE_knownGood !< known good tangent integer, public :: & cycleCounter = 0 !< needs description integer, parameter, public :: & - CPFEM_CALCRESULTS = 2**0, & - CPFEM_AGERESULTS = 2**1, & - CPFEM_BACKUPJACOBIAN = 2**2, & - CPFEM_RESTOREJACOBIAN = 2**3 + materialpoint_CALCRESULTS = 2**0, & + materialpoint_AGERESULTS = 2**1, & + materialpoint_BACKUPJACOBIAN = 2**2, & + materialpoint_RESTOREJACOBIAN = 2**3 type, private :: tNumerics integer :: & - iJacoStiffness !< frequency of stiffness update + iJacoStiffness !< frequency of stiffness update end type tNumerics type(tNumerics), private :: num @@ -59,12 +59,12 @@ module CPFEM ip end type tDebugOptions - type(tDebugOptions), private :: debugCPFEM + type(tDebugOptions), private :: debugmaterialpoint public :: & - CPFEM_general, & - CPFEM_initAll, & - CPFEM_results + materialpoint_general, & + materialpoint_initAll, & + materialpoint_results contains @@ -72,7 +72,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Initialize all modules. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_initAll +subroutine materialpoint_initAll call DAMASK_interface_init call prec_init @@ -86,54 +86,54 @@ subroutine CPFEM_initAll call rotations_init call polynomials_init call lattice_init - call discretization_marc_init + call discretization_Marc_init call material_init(.false.) call phase_init call homogenization_init - call CPFEM_init + call materialpoint_init call config_deallocate -end subroutine CPFEM_initAll +end subroutine materialpoint_initAll !-------------------------------------------------------------------------------------------------- -!> @brief allocate the arrays defined in module CPFEM and initialize them +!> @brief allocate the arrays defined in module materialpoint and initialize them !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_init +subroutine materialpoint_init class(tNode), pointer :: & - debug_CPFEM + debug_materialpoint - print'(/,1x,a)', '<<<+- CPFEM init -+>>>'; flush(IO_STDOUT) + print'(/,1x,a)', '<<<+- materialpoint init -+>>>'; flush(IO_STDOUT) - allocate(CPFEM_cs( 6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) - allocate(CPFEM_dcsdE( 6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) - allocate(CPFEM_dcsdE_knownGood(6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) + allocate(materialpoint_cs( 6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) + allocate(materialpoint_dcsdE( 6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) + allocate(materialpoint_dcsdE_knownGood(6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) !------------------------------------------------------------------------------ ! read debug options - debug_CPFEM => config_debug%get('CPFEM',defaultVal=emptyList) - debugCPFEM%basic = debug_CPFEM%contains('basic') - debugCPFEM%extensive = debug_CPFEM%contains('extensive') - debugCPFEM%selective = debug_CPFEM%contains('selective') - debugCPFEM%element = config_debug%get_asInt('element',defaultVal = 1) - debugCPFEM%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1) + debug_materialpoint => config_debug%get('materialpoint',defaultVal=emptyList) + debugmaterialpoint%basic = debug_materialpoint%contains('basic') + debugmaterialpoint%extensive = debug_materialpoint%contains('extensive') + debugmaterialpoint%selective = debug_materialpoint%contains('selective') + debugmaterialpoint%element = config_debug%get_asInt('element',defaultVal = 1) + debugmaterialpoint%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1) - if(debugCPFEM%basic) then - print'(a32,1x,6(i8,1x))', 'CPFEM_cs: ', shape(CPFEM_cs) - print'(a32,1x,6(i8,1x))', 'CPFEM_dcsdE: ', shape(CPFEM_dcsdE) - print'(a32,1x,6(i8,1x),/)', 'CPFEM_dcsdE_knownGood: ', shape(CPFEM_dcsdE_knownGood) + if(debugmaterialpoint%basic) then + print'(a32,1x,6(i8,1x))', 'materialpoint_cs: ', shape(materialpoint_cs) + print'(a32,1x,6(i8,1x))', 'materialpoint_dcsdE: ', shape(materialpoint_dcsdE) + print'(a32,1x,6(i8,1x),/)', 'materialpoint_dcsdE_knownGood: ', shape(materialpoint_dcsdE_knownGood) flush(IO_STDOUT) endif -end subroutine CPFEM_init +end subroutine materialpoint_init !-------------------------------------------------------------------------------------------------- -!> @brief perform initialization at first call, update variables and call the actual material model +!> @brief Update variables and call the material model. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian) +subroutine materialpoint_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian) integer, intent(in) :: elFE, & !< FE element number ip !< integration point number @@ -161,7 +161,7 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS elCP = discretization_Marc_FEM2DAMASK_elem(elFE) ce = discretization_Marc_FEM2DAMASK_cell(ip,elFE) - if (debugCPFEM%basic .and. elCP == debugCPFEM%element .and. ip == debugCPFEM%ip) then + if (debugmaterialpoint%basic .and. elCP == debugmaterialpoint%element .and. ip == debugmaterialpoint%ip) then print'(/,a)', '#############################################' print'(a1,a22,1x,i8,a13)', '#','element', elCP, '#' print'(a1,a22,1x,i8,a13)', '#','ip', ip, '#' @@ -172,26 +172,26 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS print'(a,/)', '#############################################'; flush (6) endif - if (iand(mode, CPFEM_BACKUPJACOBIAN) /= 0) & - CPFEM_dcsde_knownGood = CPFEM_dcsde - if (iand(mode, CPFEM_RESTOREJACOBIAN) /= 0) & - CPFEM_dcsde = CPFEM_dcsde_knownGood + if (iand(mode, materialpoint_BACKUPJACOBIAN) /= 0) & + materialpoint_dcsde_knownGood = materialpoint_dcsde + if (iand(mode, materialpoint_RESTOREJACOBIAN) /= 0) & + materialpoint_dcsde = materialpoint_dcsde_knownGood - if (iand(mode, CPFEM_AGERESULTS) /= 0) call CPFEM_forward + if (iand(mode, materialpoint_AGERESULTS) /= 0) call materialpoint_forward homogenization_F0(1:3,1:3,ce) = ffn homogenization_F(1:3,1:3,ce) = ffn1 - if (iand(mode, CPFEM_CALCRESULTS) /= 0) then + if (iand(mode, materialpoint_CALCRESULTS) /= 0) then validCalculation: if (terminallyIll) then call random_number(rnd) if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal - CPFEM_cs(1:6,ip,elCP) = ODD_STRESS * rnd - CPFEM_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6) + materialpoint_cs(1:6,ip,elCP) = ODD_STRESS * rnd + materialpoint_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6) else validCalculation - if (debugCPFEM%extensive) print'(a,i8,1x,i2)', '<< CPFEM >> calculation for elFE ip ',elFE,ip + if (debugmaterialpoint%extensive) print'(a,i8,1x,i2)', '<< materialpoint >> calculation for elFE ip ',elFE,ip call homogenization_mechanical_response(dt,(elCP-1)*discretization_nIPs + ip,(elCP-1)*discretization_nIPs + ip) if (.not. terminallyIll) & call homogenization_mechanical_response2(dt,[ip,ip],[elCP,elCP]) @@ -200,15 +200,15 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS call random_number(rnd) if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal - CPFEM_cs(1:6,ip,elCP) = ODD_STRESS * rnd - CPFEM_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6) + materialpoint_cs(1:6,ip,elCP) = ODD_STRESS * rnd + materialpoint_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6) else terminalIllness ! translate from P to sigma Kirchhoff = matmul(homogenization_P(1:3,1:3,ce), transpose(homogenization_F(1:3,1:3,ce))) J_inverse = 1.0_pReal / math_det33(homogenization_F(1:3,1:3,ce)) - CPFEM_cs(1:6,ip,elCP) = math_sym33to6(J_inverse * Kirchhoff,weighted=.false.) + materialpoint_cs(1:6,ip,elCP) = math_sym33to6(J_inverse * Kirchhoff,weighted=.false.) ! translate from dP/dF to dCS/dE H = 0.0_pReal @@ -224,45 +224,45 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS forall(i=1:3, j=1:3,k=1:3,l=1:3) & H_sym(i,j,k,l) = 0.25_pReal * (H(i,j,k,l) + H(j,i,k,l) + H(i,j,l,k) + H(j,i,l,k)) - CPFEM_dcsde(1:6,1:6,ip,elCP) = math_sym3333to66(J_inverse * H_sym,weighted=.false.) + materialpoint_dcsde(1:6,1:6,ip,elCP) = math_sym3333to66(J_inverse * H_sym,weighted=.false.) endif terminalIllness endif validCalculation - if (debugCPFEM%extensive & - .and. ((debugCPFEM%element == elCP .and. debugCPFEM%ip == ip) .or. .not. debugCPFEM%selective)) then + if (debugmaterialpoint%extensive & + .and. ((debugmaterialpoint%element == elCP .and. debugmaterialpoint%ip == ip) .or. .not. debugmaterialpoint%selective)) then print'(a,i8,1x,i2,/,12x,6(f10.3,1x)/)', & - '<< CPFEM >> stress/MPa at elFE ip ', elFE, ip, CPFEM_cs(1:6,ip,elCP)*1.0e-6_pReal + '<< materialpoint >> stress/MPa at elFE ip ', elFE, ip, materialpoint_cs(1:6,ip,elCP)*1.0e-6_pReal print'(a,i8,1x,i2,/,6(12x,6(f10.3,1x)/))', & - '<< CPFEM >> Jacobian/GPa at elFE ip ', elFE, ip, transpose(CPFEM_dcsdE(1:6,1:6,ip,elCP))*1.0e-9_pReal + '<< materialpoint >> Jacobian/GPa at elFE ip ', elFE, ip, transpose(materialpoint_dcsdE(1:6,1:6,ip,elCP))*1.0e-9_pReal flush(IO_STDOUT) endif endif - if (all(abs(CPFEM_dcsdE(1:6,1:6,ip,elCP)) < 1e-10_pReal)) call IO_warning(601,elCP,ip) + if (all(abs(materialpoint_dcsdE(1:6,1:6,ip,elCP)) < 1e-10_pReal)) call IO_warning(601,elCP,ip) - cauchyStress = CPFEM_cs (1:6, ip,elCP) - jacobian = CPFEM_dcsdE(1:6,1:6,ip,elCP) + cauchyStress = materialpoint_cs (1:6, ip,elCP) + jacobian = materialpoint_dcsdE(1:6,1:6,ip,elCP) -end subroutine CPFEM_general +end subroutine materialpoint_general !-------------------------------------------------------------------------------------------------- !> @brief Forward data for new time increment. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_forward +subroutine materialpoint_forward call homogenization_forward call phase_forward -end subroutine CPFEM_forward +end subroutine materialpoint_forward !-------------------------------------------------------------------------------------------------- !> @brief Trigger writing of results. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_results(inc,time) +subroutine materialpoint_results(inc,time) integer, intent(in) :: inc real(pReal), intent(in) :: time @@ -275,6 +275,6 @@ subroutine CPFEM_results(inc,time) call results_finalizeIncrement call results_closeJobFile -end subroutine CPFEM_results +end subroutine materialpoint_results -end module CPFEM +end module materialpoint_Marc diff --git a/src/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 deleted file mode 100644 index 8dbbea706..000000000 --- a/src/commercialFEM_fileList.f90 +++ /dev/null @@ -1,54 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief all DAMASK files without solver -!> @details List of files needed by MSC.Marc -!-------------------------------------------------------------------------------------------------- -#include "parallelization.f90" -#include "constants.f90" -#include "IO.f90" -#include "YAML_types.f90" -#include "YAML_parse.f90" -#include "HDF5_utilities.f90" -#include "results.f90" -#include "config.f90" -#include "LAPACK_interface.f90" -#include "math.f90" -#include "rotations.f90" -#include "polynomials.f90" -#include "lattice.f90" -#include "element.f90" -#include "geometry_plastic_nonlocal.f90" -#include "discretization.f90" -#include "Marc/discretization_Marc.f90" -#include "material.f90" -#include "phase.f90" -#include "phase_mechanical.f90" -#include "phase_mechanical_elastic.f90" -#include "phase_mechanical_plastic.f90" -#include "phase_mechanical_plastic_none.f90" -#include "phase_mechanical_plastic_isotropic.f90" -#include "phase_mechanical_plastic_phenopowerlaw.f90" -#include "phase_mechanical_plastic_kinehardening.f90" -#include "phase_mechanical_plastic_dislotwin.f90" -#include "phase_mechanical_plastic_dislotungsten.f90" -#include "phase_mechanical_plastic_nonlocal.f90" -#include "phase_mechanical_eigen.f90" -#include "phase_mechanical_eigen_cleavageopening.f90" -#include "phase_mechanical_eigen_thermalexpansion.f90" -#include "phase_thermal.f90" -#include "phase_thermal_dissipation.f90" -#include "phase_thermal_externalheat.f90" -#include "phase_damage.f90" -#include "phase_damage_isobrittle.f90" -#include "phase_damage_anisobrittle.f90" -#include "homogenization.f90" -#include "homogenization_mechanical.f90" -#include "homogenization_mechanical_pass.f90" -#include "homogenization_mechanical_isostrain.f90" -#include "homogenization_mechanical_RGC.f90" -#include "homogenization_thermal.f90" -#include "homogenization_thermal_pass.f90" -#include "homogenization_thermal_isotemperature.f90" -#include "homogenization_damage.f90" -#include "homogenization_damage_pass.f90" -#include "CPFEM.f90" diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index a290ac194..824d867c5 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -20,7 +20,7 @@ program DAMASK_grid use IO use config use math - use CPFEM2 + use materialpoint use material use spectral_utilities use grid_mechanical_spectral_basic @@ -117,7 +117,7 @@ program DAMASK_grid !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) - call CPFEM_initAll + call materialpoint_initAll() print'(/,1x,a)', '<<<+- DAMASK_grid init -+>>>'; flush(IO_STDOUT) print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019' @@ -327,7 +327,7 @@ program DAMASK_grid writeUndeformed: if (CLI_restartInc < 1) then print'(/,1x,a)', '... writing initial configuration to file .................................' flush(IO_STDOUT) - call CPFEM_results(0,0.0_pReal) + call materialpoint_results(0,0.0_pReal) endif writeUndeformed loadCaseLooping: do l = 1, size(loadCases) @@ -387,7 +387,7 @@ program DAMASK_grid case(FIELD_DAMAGE_ID); call grid_damage_spectral_forward(cutBack) end select enddo - if (.not. cutBack) call CPFEM_forward + if (.not. cutBack) call materialpoint_forward !-------------------------------------------------------------------------------------------------- ! solve fields @@ -454,7 +454,7 @@ program DAMASK_grid if (mod(inc,loadCases(l)%f_out) == 0 .or. signal) then print'(/,1x,a)', '... writing results to file ...............................................' flush(IO_STDOUT) - call CPFEM_results(totalIncsCounter,t) + call materialpoint_results(totalIncsCounter,t) endif if (signal) call signals_setSIGUSR1(.false.) call MPI_Allreduce(signals_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) @@ -468,10 +468,10 @@ program DAMASK_grid call grid_thermal_spectral_restartWrite end select end do - call CPFEM_restartWrite + call materialpoint_restartWrite endif if (signal) call signals_setSIGUSR2(.false.) - call MPI_Allreduce(signals_SIGTERM,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) + call MPI_Allreduce(signals_SIGINT,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' if (signal) exit loadCaseLooping endif skipping diff --git a/src/VTI.f90 b/src/grid/VTI.f90 similarity index 100% rename from src/VTI.f90 rename to src/grid/VTI.f90 diff --git a/src/base64.f90 b/src/grid/base64.f90 similarity index 100% rename from src/base64.f90 rename to src/grid/base64.f90 diff --git a/src/zlib.f90 b/src/grid/zlib.f90 similarity index 100% rename from src/zlib.f90 rename to src/grid/zlib.f90 diff --git a/src/lattice.f90 b/src/lattice.f90 index 79e3c1615..afff2a309 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -1966,8 +1966,8 @@ end function buildCoordinateSystem !-------------------------------------------------------------------------------------------------- !> @brief Helper function to define transformation systems ! Needed to calculate Schmid matrix and rotated stiffness matrices. -! @details: use c/a for cF -> cI transformation -! use a_cX for cF -> hP transformation +! @details: use c/a for cF -> hP transformation +! use a_cX for cF -> cI transformation !-------------------------------------------------------------------------------------------------- subroutine buildTransformationSystem(Q,S,Ntrans,cOverA,a_cF,a_cI) diff --git a/src/material.f90 b/src/material.f90 index 2258c40a1..eafc411cd 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -27,7 +27,7 @@ module material type(tRotationContainer), dimension(:), allocatable, public, protected :: material_O_0 - type(tTensorContainer), dimension(:), allocatable, public, protected :: material_F_i_0 + type(tTensorContainer), dimension(:), allocatable, public, protected :: material_V_e_0 integer, dimension(:), allocatable, public, protected :: & homogenization_Nconstituents !< number of grains in each homogenization @@ -133,7 +133,7 @@ subroutine parse() allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) allocate(material_O_0(materials%length)) - allocate(material_F_i_0(materials%length)) + allocate(material_V_e_0(materials%length)) allocate(ho_of(materials%length)) allocate(ph_of(materials%length,homogenization_maxNconstituents),source=-1) @@ -154,7 +154,7 @@ subroutine parse() if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) allocate(material_O_0(ma)%data(constituents%length)) - allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) + allocate(material_V_e_0(ma)%data(1:3,1:3,constituents%length)) do co = 1, constituents%length constituent => constituents%get(co) @@ -162,7 +162,9 @@ subroutine parse() ph_of(ma,co) = phases%getIndex(constituent%get_asString('phase')) call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) - material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) + material_V_e_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('V_e',defaultVal=math_I3,requiredShape=[3,3]) + if (any(dNeq(material_V_e_0(ma)%data(1:3,1:3,co),transpose(material_V_e_0(ma)%data(1:3,1:3,co))))) & + call IO_error(147) end do if (dNeq(sum(v_of(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') diff --git a/src/CPFEM2.f90 b/src/materialpoint.f90 similarity index 88% rename from src/CPFEM2.f90 rename to src/materialpoint.f90 index 186441f3a..d83307738 100644 --- a/src/CPFEM2.f90 +++ b/src/materialpoint.f90 @@ -3,7 +3,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief needs a good name and description !-------------------------------------------------------------------------------------------------- -module CPFEM2 +module materialpoint use parallelization use signals use CLI @@ -40,7 +40,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Initialize all modules. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_initAll +subroutine materialpoint_initAll call parallelization_init call CLI_init ! Spectral and FEM interface to commandline @@ -69,21 +69,21 @@ subroutine CPFEM_initAll call material_init(restart=CLI_restartInc>0) call phase_init call homogenization_init - call CPFEM_init + call materialpoint_init call config_deallocate -end subroutine CPFEM_initAll +end subroutine materialpoint_initAll !-------------------------------------------------------------------------------------------------- !> @brief Read restart information if needed. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_init +subroutine materialpoint_init integer(HID_T) :: fileHandle - print'(/,1x,a)', '<<<+- CPFEM init -+>>>'; flush(IO_STDOUT) + print'(/,1x,a)', '<<<+- materialpoint init -+>>>'; flush(IO_STDOUT) if (CLI_restartInc > 0) then @@ -97,13 +97,13 @@ subroutine CPFEM_init call HDF5_closeFile(fileHandle) endif -end subroutine CPFEM_init +end subroutine materialpoint_init !-------------------------------------------------------------------------------------------------- !> @brief Write restart information. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_restartWrite +subroutine materialpoint_restartWrite integer(HID_T) :: fileHandle @@ -117,24 +117,24 @@ subroutine CPFEM_restartWrite call HDF5_closeFile(fileHandle) -end subroutine CPFEM_restartWrite +end subroutine materialpoint_restartWrite !-------------------------------------------------------------------------------------------------- !> @brief Forward data for new time increment. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_forward +subroutine materialpoint_forward call homogenization_forward call phase_forward -end subroutine CPFEM_forward +end subroutine materialpoint_forward !-------------------------------------------------------------------------------------------------- !> @brief Trigger writing of results. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_results(inc,time) +subroutine materialpoint_results(inc,time) integer, intent(in) :: inc real(pReal), intent(in) :: time @@ -147,6 +147,6 @@ subroutine CPFEM_results(inc,time) call results_finalizeIncrement call results_closeJobFile -end subroutine CPFEM_results +end subroutine materialpoint_results -end module CPFEM2 +end module materialpoint diff --git a/src/math.f90 b/src/math.f90 index 75b9ddea2..25c90ccf4 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -82,7 +82,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief initialization of random seed generator and internal checks !-------------------------------------------------------------------------------------------------- -subroutine math_init +subroutine math_init() real(pReal), dimension(4) :: randTest integer :: randSize @@ -127,8 +127,10 @@ pure recursive subroutine math_sort(a, istart, iend, sortDim) integer, dimension(:,:), intent(inout) :: a integer, intent(in),optional :: istart,iend, sortDim + integer :: ipivot,s,e,d + if (present(istart)) then s = istart else @@ -164,9 +166,11 @@ pure recursive subroutine math_sort(a, istart, iend, sortDim) integer, dimension(:,:), intent(inout) :: a integer, intent(out) :: p ! Pivot element integer, intent(in) :: istart,iend,sort - integer, dimension(size(a,1)) :: tmp + + integer, dimension(size(a,1)) :: tmp integer :: i,j + do ! find the first element on the right side less than or equal to the pivot point do j = iend, istart, -1 @@ -204,8 +208,10 @@ pure function math_expand(what,how) real(pReal), dimension(:), intent(in) :: what integer, dimension(:), intent(in) :: how real(pReal), dimension(sum(how)) :: math_expand + integer :: i + if (sum(how) == 0) return do i = 1, size(how) @@ -221,9 +227,11 @@ end function math_expand pure function math_range(N) integer, intent(in) :: N !< length of range - integer :: i integer, dimension(N) :: math_range + integer :: i + + math_range = [(i,i=1,N)] end function math_range @@ -235,9 +243,11 @@ end function math_range pure function math_eye(d) integer, intent(in) :: d !< tensor dimension - integer :: i real(pReal), dimension(d,d) :: math_eye + integer :: i + + math_eye = 0.0_pReal do i=1,d math_eye(i,i) = 1.0_pReal @@ -302,6 +312,7 @@ real(pReal) pure function math_delta(i,j) integer, intent (in) :: i,j + math_delta = merge(0.0_pReal, 1.0_pReal, i /= j) end function math_delta @@ -315,6 +326,7 @@ pure function math_cross(A,B) real(pReal), dimension(3), intent(in) :: A,B real(pReal), dimension(3) :: math_cross + math_cross = [ A(2)*B(3) -A(3)*B(2), & A(3)*B(1) -A(1)*B(3), & A(1)*B(2) -A(2)*B(1) ] @@ -329,6 +341,7 @@ pure function math_outer(A,B) real(pReal), dimension(:), intent(in) :: A,B real(pReal), dimension(size(A,1),size(B,1)) :: math_outer + integer :: i,j @@ -351,6 +364,7 @@ real(pReal) pure function math_inner(A,B) real(pReal), dimension(:), intent(in) :: A real(pReal), dimension(size(A,1)), intent(in) :: B + math_inner = sum(A*B) end function math_inner @@ -363,6 +377,7 @@ real(pReal) pure function math_tensordot(A,B) real(pReal), dimension(3,3), intent(in) :: A,B + math_tensordot = sum(A*B) end function math_tensordot @@ -376,6 +391,7 @@ pure function math_mul3333xx33(A,B) real(pReal), dimension(3,3,3,3), intent(in) :: A real(pReal), dimension(3,3), intent(in) :: B real(pReal), dimension(3,3) :: math_mul3333xx33 + integer :: i,j @@ -395,11 +411,12 @@ end function math_mul3333xx33 !-------------------------------------------------------------------------------------------------- pure function math_mul3333xx3333(A,B) - integer :: i,j,k,l real(pReal), dimension(3,3,3,3), intent(in) :: A real(pReal), dimension(3,3,3,3), intent(in) :: B real(pReal), dimension(3,3,3,3) :: math_mul3333xx3333 + integer :: i,j,k,l + #ifndef __INTEL_COMPILER do concurrent(i=1:3, j=1:3, k=1:3, l=1:3) @@ -424,6 +441,7 @@ pure function math_exp33(A,n) real(pReal) :: invFac integer :: n_,i + if (present(n)) then n_ = n else @@ -456,6 +474,7 @@ pure function math_inv33(A) real(pReal) :: DetA logical :: error + call math_invert33(math_inv33,DetA,error,A) if (error) math_inv33 = 0.0_pReal @@ -474,6 +493,7 @@ pure subroutine math_invert33(InvA, DetA, error, A) logical, intent(out) :: error real(pReal), dimension(3,3), intent(in) :: A + InvA(1,1) = A(2,2) * A(3,3) - A(2,3) * A(3,2) InvA(2,1) = -A(2,1) * A(3,3) + A(2,3) * A(3,1) InvA(3,1) = A(2,1) * A(3,2) - A(2,2) * A(3,1) @@ -504,7 +524,7 @@ end subroutine math_invert33 !-------------------------------------------------------------------------------------------------- pure function math_invSym3333(A) - real(pReal),dimension(3,3,3,3) :: math_invSym3333 + real(pReal),dimension(3,3,3,3) :: math_invSym3333 real(pReal),dimension(3,3,3,3),intent(in) :: A @@ -513,6 +533,7 @@ pure function math_invSym3333(A) real(pReal), dimension(6*6) :: work integer :: ierr_i, ierr_f + temp66 = math_sym3333to66(A) call dgetrf(6,6,temp66,6,ipiv6,ierr_i) call dgetri(6,temp66,6,ipiv6,work,size(work,1),ierr_f) @@ -538,6 +559,7 @@ pure subroutine math_invert(InvA, error, A) real(pReal), dimension(size(A,1)**2) :: work integer :: ierr + invA = A call dgetrf(size(A,1),size(A,1),invA,size(A,1),ipiv,ierr) error = (ierr /= 0) @@ -555,6 +577,7 @@ pure function math_symmetric33(m) real(pReal), dimension(3,3) :: math_symmetric33 real(pReal), dimension(3,3), intent(in) :: m + math_symmetric33 = 0.5_pReal * (m + transpose(m)) end function math_symmetric33 @@ -568,6 +591,7 @@ pure function math_skew33(m) real(pReal), dimension(3,3) :: math_skew33 real(pReal), dimension(3,3), intent(in) :: m + math_skew33 = m - math_symmetric33(m) end function math_skew33 @@ -581,6 +605,7 @@ pure function math_spherical33(m) real(pReal), dimension(3,3) :: math_spherical33 real(pReal), dimension(3,3), intent(in) :: m + math_spherical33 = math_I3 * math_trace33(m)/3.0_pReal end function math_spherical33 @@ -594,6 +619,7 @@ pure function math_deviatoric33(m) real(pReal), dimension(3,3) :: math_deviatoric33 real(pReal), dimension(3,3), intent(in) :: m + math_deviatoric33 = m - math_spherical33(m) end function math_deviatoric33 @@ -606,6 +632,7 @@ real(pReal) pure function math_trace33(m) real(pReal), dimension(3,3), intent(in) :: m + math_trace33 = m(1,1) + m(2,2) + m(3,3) end function math_trace33 @@ -618,6 +645,7 @@ real(pReal) pure function math_det33(m) real(pReal), dimension(3,3), intent(in) :: m + math_det33 = m(1,1)* (m(2,2)*m(3,3)-m(2,3)*m(3,2)) & - m(1,2)* (m(2,1)*m(3,3)-m(2,3)*m(3,1)) & + m(1,3)* (m(2,1)*m(3,2)-m(2,2)*m(3,1)) @@ -632,6 +660,7 @@ real(pReal) pure function math_detSym33(m) real(pReal), dimension(3,3), intent(in) :: m + math_detSym33 = -(m(1,1)*m(2,3)**2 + m(2,2)*m(1,3)**2 + m(3,3)*m(1,2)**2) & + m(1,1)*m(2,2)*m(3,3) + 2.0_pReal * m(1,2)*m(1,3)*m(2,3) @@ -761,6 +790,7 @@ pure function math_99to3333(m99) integer :: i,j + #ifndef __INTEL_COMPILER do concurrent(i=1:9, j=1:9) math_99to3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) = m99(i,j) @@ -1012,26 +1042,37 @@ pure subroutine math_eigh33(w,v,m) real(pReal) :: T, U, norm, threshold logical :: error + w = math_eigvalsh33(m) - v(1:3,2) = [ m(1, 2) * m(2, 3) - m(1, 3) * m(2, 2), & - m(1, 3) * m(1, 2) - m(2, 3) * m(1, 1), & - m(1, 2)**2] + v(1:3,2) = [ m(1,2) * m(2,3) - m(1,3) * m(2,2), & + m(1,3) * m(1,2) - m(2,3) * m(1,1), & + m(1,2)**2] T = maxval(abs(w)) U = max(T, T**2) threshold = sqrt(5.68e-14_pReal * U**2) - v(1:3,1) = [ v(1,2) + m(1, 3) * w(1), & - v(2,2) + m(2, 3) * w(1), & +#ifndef __INTEL_LLVM_COMPILER + v(1:3,1) = [m(1,3)*w(1) + v(1,2), & + m(2,3)*w(1) + v(2,2), & +#else + v(1:3,1) = [IEEE_FMA(m(1,3),w(1),v(1,2)), & + IEEE_FMA(m(2,3),w(1),v(2,2)), & +#endif (m(1,1) - w(1)) * (m(2,2) - w(1)) - v(3,2)] norm = norm2(v(1:3, 1)) fallback1: if (norm < threshold) then call math_eigh(w,v,error,m) else fallback1 v(1:3,1) = v(1:3, 1) / norm - v(1:3,2) = [ v(1,2) + m(1, 3) * w(2), & - v(2,2) + m(2, 3) * w(2), & +#ifndef __INTEL_LLVM_COMPILER + v(1:3,2) = [m(1,3)*w(2) + v(1,2), & + m(2,3)*w(2) + v(2,2), & +#else + v(1:3,2) = [IEEE_FMA(m(1,3),w(2),v(1,2)), & + IEEE_FMA(m(2,3),w(2),v(2,2)), & +#endif (m(1,1) - w(2)) * (m(2,2) - w(2)) - v(3,2)] norm = norm2(v(1:3, 2)) fallback2: if (norm < threshold) then @@ -1066,6 +1107,7 @@ pure function math_rotationalPart(F) result(R) I_F ! first two invariants of F real(pReal) :: x,Phi + C = matmul(transpose(F),F) I_C = math_invariantsSym33(C) I_F = [math_trace33(F), 0.5*(math_trace33(F)**2 - math_trace33(matmul(F,F)))] @@ -1105,6 +1147,7 @@ pure function math_eigvalsh(m) integer :: ierr real(pReal), dimension(size(m,1)**2) :: work + m_= m ! copy matrix to input (will be destroyed) call dsyev('N','U',size(m,1),m_,size(m,1),math_eigvalsh,work,size(work,1),ierr) if (ierr /= 0) math_eigvalsh = IEEE_value(1.0_pReal,IEEE_quiet_NaN) @@ -1126,6 +1169,7 @@ pure function math_eigvalsh33(m) real(pReal) :: P, Q, rho, phi real(pReal), parameter :: TOL=1.e-14_pReal + I = math_invariantsSym33(m) ! invariants are coefficients in characteristic polynomial apart for the sign of c0 and c2 in http://arxiv.org/abs/physics/0610206 P = I(2)-I(1)**2/3.0_pReal ! different from http://arxiv.org/abs/physics/0610206 (this formulation was in DAMASK) @@ -1157,6 +1201,7 @@ pure function math_invariantsSym33(m) real(pReal), dimension(3,3), intent(in) :: m real(pReal), dimension(3) :: math_invariantsSym33 + math_invariantsSym33(1) = math_trace33(m) math_invariantsSym33(2) = m(1,1)*m(2,2) + m(1,1)*m(3,3) + m(2,2)*m(3,3) & -(m(1,2)**2 + m(1,3)**2 + m(2,3)**2) @@ -1265,7 +1310,7 @@ end function math_clip !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some math functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest +subroutine selfTest() integer, dimension(2,4) :: & sort_in_ = reshape([+1,+5, +5,+6, -1,-1, +3,-2],[2,4]) diff --git a/src/mesh/DAMASK_mesh.f90 b/src/mesh/DAMASK_mesh.f90 index 85ce0e922..f0f2a872e 100644 --- a/src/mesh/DAMASK_mesh.f90 +++ b/src/mesh/DAMASK_mesh.f90 @@ -14,7 +14,7 @@ program DAMASK_mesh use parallelization use IO use math - use CPFEM2 + use materialpoint use config use discretization_mesh use FEM_Utilities @@ -85,7 +85,7 @@ program DAMASK_mesh !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) - call CPFEM_initAll + call materialpoint_initAll() print'(/,1x,a)', '<<<+- DAMASK_mesh init -+>>>'; flush(IO_STDOUT) !--------------------------------------------------------------------- @@ -239,7 +239,7 @@ program DAMASK_mesh print'(/,1x,a)', '... writing initial configuration to file .................................' flush(IO_STDOUT) - call CPFEM_results(0,0.0_pReal) + call materialpoint_results(0,0.0_pReal) loadCaseLooping: do currentLoadCase = 1, size(loadCases) time0 = time ! load case start time @@ -325,7 +325,7 @@ program DAMASK_mesh if (mod(inc,loadCases(currentLoadCase)%outputFrequency) == 0) then ! at output frequency print'(/,1x,a)', '... writing results to file ...............................................' call FEM_mechanical_updateCoords - call CPFEM_results(totalIncsCounter,time) + call materialpoint_results(totalIncsCounter,time) end if diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index b13675e38..88b86a8d9 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -210,7 +210,6 @@ module subroutine mechanical_init(phases) Nmembers class(tNode), pointer :: & num_crystallite, & - phase, & mech @@ -239,11 +238,8 @@ module subroutine mechanical_init(phases) allocate(phase_mechanical_Fe(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_Fi(ph)%data(3,3,Nmembers)) - allocate(phase_mechanical_Fi0(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_Fp(ph)%data(3,3,Nmembers)) - allocate(phase_mechanical_Fp0(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_F(ph)%data(3,3,Nmembers)) - allocate(phase_mechanical_F0(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_Li(ph)%data(3,3,Nmembers),source=0.0_pReal) allocate(phase_mechanical_Li0(ph)%data(3,3,Nmembers),source=0.0_pReal) allocate(phase_mechanical_Lp(ph)%data(3,3,Nmembers),source=0.0_pReal) @@ -265,23 +261,19 @@ module subroutine mechanical_init(phases) ma = discretization_materialAt((ce-1)/discretization_nIPs+1) do co = 1,homogenization_Nconstituents(material_homogenizationID(ce)) ph = material_phaseID(co,ce) - phase_mechanical_Fi0(ph)%data(1:3,1:3,material_phaseEntry(co,ce)) = material_F_i_0(ma)%data(1:3,1:3,co) + en = material_phaseEntry(co,ce) + phase_mechanical_F(ph)%data(1:3,1:3,en) = math_I3 + phase_mechanical_Fp(ph)%data(1:3,1:3,en) = material_O_0(ma)%data(co)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005) + phase_mechanical_Fe(ph)%data(1:3,1:3,en) = matmul(material_V_e_0(ma)%data(1:3,1:3,co), & + transpose(phase_mechanical_Fp(ph)%data(1:3,1:3,en))) + phase_mechanical_Fi(ph)%data(1:3,1:3,en) = material_O_0(ma)%data(co)%rotate(math_inv33(material_V_e_0(ma)%data(1:3,1:3,co))) enddo enddo do ph = 1, phases%length - do en = 1, count(material_phaseID == ph) - - phase_mechanical_Fp0(ph)%data(1:3,1:3,en) = phase_O_0(ph)%data(en)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005) - phase_mechanical_Fp0(ph)%data(1:3,1:3,en) = phase_mechanical_Fp0(ph)%data(1:3,1:3,en) & - / math_det33(phase_mechanical_Fp0(ph)%data(1:3,1:3,en))**(1.0_pReal/3.0_pReal) - phase_mechanical_F0(ph)%data(1:3,1:3,en) = math_I3 - phase_mechanical_Fe(ph)%data(1:3,1:3,en) = math_inv33(matmul(phase_mechanical_Fi0(ph)%data(1:3,1:3,en), & - phase_mechanical_Fp0(ph)%data(1:3,1:3,en))) ! assuming that euler angles are given in internal strain free configuration - enddo - phase_mechanical_Fp(ph)%data = phase_mechanical_Fp0(ph)%data - phase_mechanical_Fi(ph)%data = phase_mechanical_Fi0(ph)%data - phase_mechanical_F(ph)%data = phase_mechanical_F0(ph)%data + phase_mechanical_F0(ph)%data = phase_mechanical_F(ph)%data + phase_mechanical_Fp0(ph)%data = phase_mechanical_Fp(ph)%data + phase_mechanical_Fi0(ph)%data = phase_mechanical_Fi(ph)%data enddo @@ -318,7 +310,6 @@ module subroutine mechanical_init(phases) end select - call eigen_init(phases) @@ -680,8 +671,11 @@ function integrateStateEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result if (any(IEEE_is_NaN(dotState))) return sizeDotState = plasticState(ph)%sizeDotState - plasticState(ph)%state(1:sizeDotState,en) = subState0 & - + dotState * Delta_t +#ifndef __INTEL_LLVM_COMPILER + plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t +#else + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) +#endif broken = plastic_deltaState(ph,en) if(broken) return @@ -720,8 +714,11 @@ function integrateStateAdaptiveEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en sizeDotState = plasticState(ph)%sizeDotState r = - dotState * 0.5_pReal * Delta_t - plasticState(ph)%state(1:sizeDotState,en) = subState0 & - + dotState * Delta_t +#ifndef __INTEL_LLVM_COMPILER + plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t +#else + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) +#endif broken = plastic_deltaState(ph,en) if(broken) return @@ -842,12 +839,18 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) dotState = A(1,stage) * plastic_RKdotState(1:sizeDotState,1) do n = 2, stage - dotState = dotState & - + A(n,stage) * plastic_RKdotState(1:sizeDotState,n) +#ifndef __INTEL_LLVM_COMPILER + dotState = dotState + A(n,stage)*plastic_RKdotState(1:sizeDotState,n) +#else + dotState = IEEE_FMA(A(n,stage),plastic_RKdotState(1:sizeDotState,n),dotState) +#endif enddo - plasticState(ph)%state(1:sizeDotState,en) = subState0 & - + dotState * Delta_t +#ifndef __INTEL_LLVM_COMPILER + plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t +#else + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) +#endif broken = integrateStress(F_0+(F-F_0)*Delta_t*C(stage),subFp0,subFi0,Delta_t*C(stage), ph,en) if(broken) exit @@ -861,8 +864,11 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) plastic_RKdotState(1:sizeDotState,size(B)) = dotState dotState = matmul(plastic_RKdotState,B) - plasticState(ph)%state(1:sizeDotState,en) = subState0 & - + dotState * Delta_t +#ifndef __INTEL_LLVM_COMPILER + plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t +#else + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) +#endif if(present(DB)) & broken = .not. converged(matmul(plastic_RKdotState(1:sizeDotState,1:size(DB)),DB) * Delta_t, & @@ -1146,12 +1152,18 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) else lhs_3333 = 0.0_pReal; rhs_3333 = 0.0_pReal do o=1,3; do p=1,3 +#ifndef __INTEL_LLVM_COMPILER lhs_3333(1:3,1:3,o,p) = lhs_3333(1:3,1:3,o,p) & + matmul(invSubFi0,dLidFi(1:3,1:3,o,p)) * Delta_t lhs_3333(1:3,o,1:3,p) = lhs_3333(1:3,o,1:3,p) & + invFi*invFi(p,o) rhs_3333(1:3,1:3,o,p) = rhs_3333(1:3,1:3,o,p) & - matmul(invSubFi0,dLidS(1:3,1:3,o,p)) * Delta_t +#else + lhs_3333(1:3,1:3,o,p) = IEEE_FMA(matmul(invSubFi0,dLidFi(1:3,1:3,o,p)),Delta_t,lhs_3333(1:3,1:3,o,p)) + lhs_3333(1:3,o,1:3,p) = IEEE_FMA(invFi,invFi(p,o),lhs_3333(1:3,o,1:3,p)) + rhs_3333(1:3,1:3,o,p) = IEEE_FMA(matmul(invSubFi0,dLidS(1:3,1:3,o,p)),-Delta_t,rhs_3333(1:3,1:3,o,p)) +#endif enddo; enddo call math_invert(temp_99,error,math_3333to99(lhs_3333)) if (error) then @@ -1180,8 +1192,12 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) temp_3333(1:3,1:3,p,o) = matmul(matmul(temp_33_2,dLpdS(1:3,1:3,p,o)), invFi) & + matmul(temp_33_3,dLidS(1:3,1:3,p,o)) enddo; enddo +#ifndef __INTEL_LLVM_COMPILER lhs_3333 = math_mul3333xx3333(dSdFe,temp_3333) * Delta_t & + math_mul3333xx3333(dSdFi,dFidS) +#else + lhs_3333 = IEEE_FMA(math_mul3333xx3333(dSdFe,temp_3333),Delta_t,math_mul3333xx3333(dSdFi,dFidS)) +#endif call math_invert(temp_99,error,math_eye(9)+math_3333to99(lhs_3333)) if (error) then @@ -1219,6 +1235,9 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) end function phase_mechanical_dPdF +!-------------------------------------------------------------------------------------------------- +!< @brief Write restart information to file. +!-------------------------------------------------------------------------------------------------- module subroutine mechanical_restartWrite(groupHandle,ph) integer(HID_T), intent(in) :: groupHandle @@ -1226,36 +1245,41 @@ module subroutine mechanical_restartWrite(groupHandle,ph) call HDF5_write(plasticState(ph)%state,groupHandle,'omega_plastic') - call HDF5_write(phase_mechanical_Fi(ph)%data,groupHandle,'F_i') - call HDF5_write(phase_mechanical_Li(ph)%data,groupHandle,'L_i') - call HDF5_write(phase_mechanical_Lp(ph)%data,groupHandle,'L_p') - call HDF5_write(phase_mechanical_Fp(ph)%data,groupHandle,'F_p') call HDF5_write(phase_mechanical_S(ph)%data,groupHandle,'S') call HDF5_write(phase_mechanical_F(ph)%data,groupHandle,'F') + call HDF5_write(phase_mechanical_Fp(ph)%data,groupHandle,'F_p') + call HDF5_write(phase_mechanical_Fi(ph)%data,groupHandle,'F_i') + call HDF5_write(phase_mechanical_Lp(ph)%data,groupHandle,'L_p') + call HDF5_write(phase_mechanical_Li(ph)%data,groupHandle,'L_i') end subroutine mechanical_restartWrite +!-------------------------------------------------------------------------------------------------- +!< @brief Read restart information from file. +!-------------------------------------------------------------------------------------------------- module subroutine mechanical_restartRead(groupHandle,ph) integer(HID_T), intent(in) :: groupHandle integer, intent(in) :: ph + integer :: en + call HDF5_read(plasticState(ph)%state0,groupHandle,'omega_plastic') - call HDF5_read(phase_mechanical_Fi0(ph)%data,groupHandle,'F_i') - call HDF5_read(phase_mechanical_Li0(ph)%data,groupHandle,'L_i') - call HDF5_read(phase_mechanical_Lp0(ph)%data,groupHandle,'L_p') - call HDF5_read(phase_mechanical_Fp0(ph)%data,groupHandle,'F_p') call HDF5_read(phase_mechanical_S0(ph)%data,groupHandle,'S') call HDF5_read(phase_mechanical_F0(ph)%data,groupHandle,'F') + call HDF5_read(phase_mechanical_Fp0(ph)%data,groupHandle,'F_p') + call HDF5_read(phase_mechanical_Fi0(ph)%data,groupHandle,'F_i') + call HDF5_read(phase_mechanical_Lp0(ph)%data,groupHandle,'L_p') + call HDF5_read(phase_mechanical_Li0(ph)%data,groupHandle,'L_i') end subroutine mechanical_restartRead -!---------------------------------------------------------------------------------------------- -!< @brief Get first Piola-Kichhoff stress (for use by non-mech physics) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get first Piola-Kichhoff stress (for use by non-mech physics). +!-------------------------------------------------------------------------------------------------- module function mechanical_S(ph,en) result(S) integer, intent(in) :: ph,en @@ -1267,9 +1291,9 @@ module function mechanical_S(ph,en) result(S) end function mechanical_S -!---------------------------------------------------------------------------------------------- -!< @brief Get plastic velocity gradient (for use by non-mech physics) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get plastic velocity gradient (for use by non-mech physics). +!-------------------------------------------------------------------------------------------------- module function mechanical_L_p(ph,en) result(L_p) integer, intent(in) :: ph,en @@ -1281,9 +1305,9 @@ module function mechanical_L_p(ph,en) result(L_p) end function mechanical_L_p -!---------------------------------------------------------------------------------------------- -!< @brief Get elastic deformation gradient (for use by non-mech physics) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get elastic deformation gradient (for use by non-mech physics). +!-------------------------------------------------------------------------------------------------- module function mechanical_F_e(ph,en) result(F_e) integer, intent(in) :: ph,en @@ -1295,9 +1319,9 @@ module function mechanical_F_e(ph,en) result(F_e) end function mechanical_F_e -!---------------------------------------------------------------------------------------------- -!< @brief Get second Piola-Kichhoff stress (for use by homogenization) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get second Piola-Kichhoff stress (for use by homogenization). +!-------------------------------------------------------------------------------------------------- module function phase_P(co,ce) result(P) integer, intent(in) :: co, ce @@ -1309,9 +1333,9 @@ module function phase_P(co,ce) result(P) end function phase_P -!---------------------------------------------------------------------------------------------- -!< @brief Get deformation gradient (for use by homogenization) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get deformation gradient (for use by homogenization). +!-------------------------------------------------------------------------------------------------- module function phase_F(co,ce) result(F) integer, intent(in) :: co, ce @@ -1323,9 +1347,9 @@ module function phase_F(co,ce) result(F) end function phase_F -!---------------------------------------------------------------------------------------------- -!< @brief Set deformation gradient (for use by homogenization) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Set deformation gradient (for use by homogenization). +!-------------------------------------------------------------------------------------------------- module subroutine phase_set_F(F,co,ce) real(pReal), dimension(3,3), intent(in) :: F diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 155f54bf8..c883528ca 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -13,10 +13,9 @@ module polynomials type, public :: tPolynomial real(pReal), dimension(:), allocatable :: coef - real(pReal) :: x_ref + real(pReal) :: x_ref = huge(0.0_pReal) contains procedure, public :: at => eval - procedure, public :: der1_at => eval_der1 end type tPolynomial interface polynomial @@ -46,14 +45,14 @@ end subroutine polynomials_init !-------------------------------------------------------------------------------------------------- !> @brief Initialize a Polynomial from Coefficients. !-------------------------------------------------------------------------------------------------- -function polynomial_from_coef(coef,x_ref) result(p) +pure function polynomial_from_coef(coef,x_ref) result(p) - real(pReal), dimension(:), intent(in) :: coef + real(pReal), dimension(0:), intent(in) :: coef real(pReal), intent(in) :: x_ref type(tPolynomial) :: p - allocate(p%coef(0:size(coef)-1),source=coef) ! should be zero based + p%coef = coef p%x_ref = x_ref end function polynomial_from_coef @@ -70,6 +69,8 @@ function polynomial_from_dict(dict,y,x) result(p) real(pReal), dimension(:), allocatable :: coef real(pReal) :: x_ref + integer :: i, o + character(len=1) :: o_s allocate(coef(1),source=dict%get_asFloat(y)) @@ -77,12 +78,14 @@ function polynomial_from_dict(dict,y,x) result(p) if (dict%contains(y//','//x)) then x_ref = dict%get_asFloat(x//'_ref') coef = [coef,dict%get_asFloat(y//','//x)] - if (dict%contains(y//','//x//'^2')) then - coef = [coef,dict%get_asFloat(y//','//x//'^2')] - end if - else - x_ref = huge(0.0_pReal) ! Simplify debugging end if + do o = 2,4 + write(o_s,'(I0.0)') o + if (dict%contains(y//','//x//'^'//o_s)) then + x_ref = dict%get_asFloat(x//'_ref') + coef = [coef,[(0.0_pReal,i=size(coef),o-1)],dict%get_asFloat(y//','//x//'^'//o_s)] + end if + end do p = Polynomial(coef,x_ref) @@ -91,6 +94,7 @@ end function polynomial_from_dict !-------------------------------------------------------------------------------------------------- !> @brief Evaluate a Polynomial. +!> @details https://nvlpubs.nist.gov/nistpubs/jres/71b/jresv71bn1p11_a1b.pdf (eq. 1.2) !-------------------------------------------------------------------------------------------------- pure function eval(self,x) result(y) @@ -98,49 +102,35 @@ pure function eval(self,x) result(y) real(pReal), intent(in) :: x real(pReal) :: y - integer :: i + integer :: o - y = self%coef(0) - do i = 1, ubound(self%coef,1) - y = y + self%coef(i) * (x-self%x_ref)**i + y = self%coef(ubound(self%coef,1)) + do o = ubound(self%coef,1)-1, 0, -1 +#ifndef __INTEL_LLVM_COMPILER + y = y*(x-self%x_ref) +self%coef(o) +#else + y = IEEE_FMA(y,x-self%x_ref,self%coef(o)) +#endif enddo end function eval -!-------------------------------------------------------------------------------------------------- -!> @brief Evaluate a first derivative of Polynomial. -!-------------------------------------------------------------------------------------------------- -pure function eval_der1(self,x) result(y) - - class(tPolynomial), intent(in) :: self - real(pReal), intent(in) :: x - real(pReal) :: y - - integer :: i - - - y = 0.0_pReal - do i = 1, ubound(self%coef,1) - y = y + real(i,pReal)*self%coef(i) * (x-self%x_ref)**(i-1) - enddo - -end function eval_der1 - - !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of polynomical functionality. !-------------------------------------------------------------------------------------------------- -subroutine selfTest +subroutine selfTest() type(tPolynomial) :: p1, p2 - real(pReal), dimension(3) :: coef - real(pReal) :: x_ref, x + real(pReal), dimension(5) :: coef + integer :: i + real(pReal) :: x_ref, x, y class(tNode), pointer :: dict - character(len=pStringLen), dimension(3) :: coef_s + character(len=pStringLen), dimension(size(coef)) :: coef_s character(len=pStringLen) :: x_ref_s, x_s, YAML_s + call random_number(coef) call random_number(x_ref) call random_number(x) @@ -149,29 +139,56 @@ subroutine selfTest x_ref = x_ref*10_pReal -0.5_pReal x = x*10_pReal -0.5_pReal + p1 = polynomial([coef(1)],x_ref) + if (dNeq(p1%at(x),coef(1))) error stop 'polynomial: eval(constant)' + p1 = polynomial(coef,x_ref) if (dNeq(p1%at(x_ref),coef(1))) error stop 'polynomial: @ref' - write(coef_s(1),*) coef(1) - write(coef_s(2),*) coef(2) - write(coef_s(3),*) coef(3) + do i = 1, size(coef_s) + write(coef_s(i),*) coef(i) + end do write(x_ref_s,*) x_ref write(x_s,*) x YAML_s = 'C: '//trim(adjustl(coef_s(1)))//IO_EOL//& 'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//& 'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//& + 'C,T^3: '//trim(adjustl(coef_s(4)))//IO_EOL//& + 'C,T^4: '//trim(adjustl(coef_s(5)))//IO_EOL//& 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p2 = polynomial(dict%asDict(),'C','T') - if (dNeq(p1%at(x),p2%at(x),1.0e-10_pReal)) error stop 'polynomials: init' + if (dNeq(p1%at(x),p2%at(x),1.0e-6_pReal)) error stop 'polynomials: init' + y = coef(1)+coef(2)*(x-x_ref)+coef(3)*(x-x_ref)**2+coef(4)*(x-x_ref)**3+coef(5)*(x-x_ref)**4 + if (dNeq(p1%at(x),y,1.0e-6_pReal)) error stop 'polynomials: eval(full)' - p1 = polynomial(coef*[0.0_pReal,1.0_pReal,0.0_pReal],x_ref) - if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(odd)' - if (dNeq(p1%der1_at(x),p1%der1_at(5.0_pReal*x),1.0e-10_pReal)) error stop 'polynomials: eval_der(odd)' + YAML_s = 'C: 0.0'//IO_EOL//& + 'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//& + 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL + Dict => YAML_parse_str(trim(YAML_s)) + p1 = polynomial(dict%asDict(),'C','T') + if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(linear)' - p1 = polynomial(coef*[0.0_pReal,0.0_pReal,1.0_pReal],x_ref) - if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval(even)' - if (dNeq(p1%der1_at(x_ref+x),-p1%der1_at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval_der(even)' + YAML_s = 'C: 0.0'//IO_EOL//& + 'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//& + 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL + Dict => YAML_parse_str(trim(YAML_s)) + p1 = polynomial(dict%asDict(),'C','T') + if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval(quadratic)' + + YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//& + 'Y,X^3: '//trim(adjustl(coef_s(2)))//IO_EOL//& + 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL + Dict => YAML_parse_str(trim(YAML_s)) + p1 = polynomial(dict%asDict(),'Y','X') + if (dNeq(p1%at(x_ref+x)-coef(1),-(p1%at(x_ref-x)-coef(1)),1.0e-8_pReal)) error stop 'polynomials: eval(cubic)' + + YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//& + 'Y,X^4: '//trim(adjustl(coef_s(2)))//IO_EOL//& + 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL + Dict => YAML_parse_str(trim(YAML_s)) + p1 = polynomial(dict%asDict(),'Y','X') + if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1.0e-6_pReal)) error stop 'polynomials: eval(quartic)' end subroutine selfTest diff --git a/src/rotations.f90 b/src/rotations.f90 index 7aa81fcab..5367f2c07 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -323,17 +323,16 @@ pure function rotTensor2(self,T,active) result(tRot) logical :: passive + if (present(active)) then passive = .not. active else passive = .true. endif - if (passive) then - tRot = matmul(matmul(self%asMatrix(),T),transpose(self%asMatrix())) - else - tRot = matmul(matmul(transpose(self%asMatrix()),T),self%asMatrix()) - endif + tRot = merge(matmul(matmul(self%asMatrix(),T),transpose(self%asMatrix())), & + matmul(matmul(transpose(self%asMatrix()),T),self%asMatrix()), & + passive) end function rotTensor2 @@ -450,6 +449,7 @@ pure function qu2om(qu) result(om) om(1,3) = 2.0_pReal*(qu(2)*qu(4)+qu(1)*qu(3)) if (sign(1.0_pReal,P) < 0.0_pReal) om = transpose(om) + om = om/math_det33(om)**(1.0_pReal/3.0_pReal) end function qu2om @@ -575,7 +575,7 @@ end function qu2cu !--------------------------------------------------------------------------------------------------- !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief convert rotation matrix to cubochoric +!> @brief convert rotation matrix to unit quaternion !> @details the original formulation (direct conversion) had (numerical?) issues !--------------------------------------------------------------------------------------------------- pure function om2qu(om) result(qu) @@ -602,14 +602,15 @@ pure function om2qu(om) result(qu) endif endif if(sign(1.0_pReal,qu(1))<0.0_pReal) qu =-1.0_pReal * qu - qu = qu*[1.0_pReal,P,P,P] + qu(2:4) = merge(qu(2:4),qu(2:4)*P,dEq0(qu(2:4))) + qu = qu/norm2(qu) end function om2qu !--------------------------------------------------------------------------------------------------- !> @author Marc De Graef, Carnegie Mellon University -!> @brief orientation matrix to Euler angles +!> @brief convert orientation matrix to Euler angles !> @details Two step check for special cases to avoid invalid operations (not needed for python) !--------------------------------------------------------------------------------------------------- pure function om2eu(om) result(eu) @@ -1334,8 +1335,8 @@ pure function cu2ho(cu) result(ho) ! transform to sphere grid (inverse Lambert) ! [note that there is no need to worry about dividing by zero, since XYZ(3) can not become zero] c = sum(T**2) - s = PI * c/(24.0*XYZ(3)**2) - c = sqrt(PI) * c / sqrt(24.0_pReal) / XYZ(3) + s = c * PI/(24.0*XYZ(3)**2) + c = c * sqrt(PI/24.0_pReal) / XYZ(3) q = sqrt( 1.0 - s ) LamXYZ = [ T(order(2)) * q, T(order(1)) * q, PREF * XYZ(3) - c ] end if special diff --git a/src/signals.f90 b/src/signals.f90 index bf53912f4..7db101f94 100644 --- a/src/signals.f90 +++ b/src/signals.f90 @@ -10,13 +10,13 @@ module signals private logical, volatile, public, protected :: & - signals_SIGTERM, & !< termination signal - signals_SIGUSR1, & !< 1. user-defined signal - signals_SIGUSR2 !< 2. user-defined signal + signals_SIGINT = .false., & !< interrupt signal + signals_SIGUSR1 = .false., & !< 1. user-defined signal + signals_SIGUSR2 = .false. !< 2. user-defined signal public :: & signals_init, & - signals_setSIGTERM, & + signals_setSIGINT, & signals_setSIGUSR1, & signals_setSIGUSR2 @@ -28,29 +28,26 @@ contains !-------------------------------------------------------------------------------------------------- subroutine signals_init() - call signalterm_c(c_funloc(catchSIGTERM)) + call signalint_c(c_funloc(catchSIGINT)) call signalusr1_c(c_funloc(catchSIGUSR1)) call signalusr2_c(c_funloc(catchSIGUSR2)) - call signals_setSIGTERM(.false.) - call signals_setSIGUSR1(.false.) - call signals_setSIGUSR2(.false.) end subroutine signals_init !-------------------------------------------------------------------------------------------------- -!> @brief Set global variable signals_SIGTERM to .true. +!> @brief Set global variable signals_SIGINT to .true. !> @details This function can be registered to catch signals send to the executable. !-------------------------------------------------------------------------------------------------- -subroutine catchSIGTERM(signal) bind(C) +subroutine catchSIGINT(signal) bind(C) integer(C_INT), value :: signal print'(a,i0)', ' received signal ',signal - call signals_setSIGTERM(.true.) + call signals_setSIGINT(.true.) -end subroutine catchSIGTERM +end subroutine catchSIGINT !-------------------------------------------------------------------------------------------------- @@ -84,17 +81,17 @@ end subroutine catchSIGUSR2 !-------------------------------------------------------------------------------------------------- -!> @brief Set global variable signals_SIGTERM. +!> @brief Set global variable signals_SIGINT. !-------------------------------------------------------------------------------------------------- -subroutine signals_setSIGTERM(state) +subroutine signals_setSIGINT(state) logical, intent(in) :: state - signals_SIGTERM = state - print*, 'set SIGTERM to',state + signals_SIGINT = state + print*, 'set SIGINT to',state -end subroutine signals_setSIGTERM +end subroutine signals_setSIGINT !-------------------------------------------------------------------------------------------------- diff --git a/src/system_routines.f90 b/src/system_routines.f90 index e0adf9dc0..2af1e12a9 100644 --- a/src/system_routines.f90 +++ b/src/system_routines.f90 @@ -15,7 +15,7 @@ module system_routines getCWD, & getHostName, & getUserName, & - signalterm_C, & + signalint_C, & signalusr1_C, & signalusr2_C, & f_c_string, & @@ -55,11 +55,11 @@ module system_routines integer(C_INT), intent(out) :: stat end subroutine getUserName_C - subroutine signalterm_C(handler) bind(C) + subroutine signalint_C(handler) bind(C) use, intrinsic :: ISO_C_Binding, only: C_FUNPTR type(C_FUNPTR), intent(in), value :: handler - end subroutine signalterm_C + end subroutine signalint_C subroutine signalusr1_C(handler) bind(C) use, intrinsic :: ISO_C_Binding, only: C_FUNPTR