diff --git a/.gitignore b/.gitignore index d195179bb..3fe721b7a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.noH5py *.pyc *.mod *.o @@ -6,3 +7,4 @@ *~ bin PRIVATE +build diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..b523aaf34 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,535 @@ +stages: + - prepareAll + - preprocessing + - postprocessing + - compileSpectralIntel + - compileSpectralGNU + - prepareSpectral + - spectral + - compileMarc2014 + - compileMarc2014.2 + - compileMarc2015 + - compileMarc2016 + - marc + - compileAbaqus2016 + - compileAbaqus2017 + - example + - performance + - createDocumentation + - saveDocumentation + - updateMaster + - clean + - releaseLock + +################################################################################################### +before_script: + - if [ $(awk "/$CI_PIPELINE_ID/{print NR}" $TESTROOT/GitLabCI.queue)x == 'x' ]; then echo $CI_PIPELINE_ID >> $TESTROOT/GitLabCI.queue; fi + - while [ $(awk "/$CI_PIPELINE_ID/{print NR}" $TESTROOT/GitLabCI.queue) -ne 1 ];do sleep 5m; done + - source $DAMASKROOT/DAMASK_env.sh + - cd $DAMASKROOT/PRIVATE/testing + +################################################################################################### +variables: + #================================================================================================ + # GitLab Settings + #================================================================================================ + GIT_SUBMODULE_STRATEGY: none + + #================================================================================================ + # Shortcut names + #================================================================================================ + DAMASKROOT: "$TESTROOT/GitLabCI_Pipeline_$CI_PIPELINE_ID/DAMASK" + + #================================================================================================ + # Names of module files to load + #================================================================================================ + # ++++++++++++ Compiler ++++++++++++++++++++++++++++++++++++++++++++++ + IntelCompiler16_0: "Compiler/Intel/16.0 Libraries/IMKL/2016" + IntelCompiler17_0: "Compiler/Intel/17.0 Libraries/IMKL/2017" + GNUCompiler5_3: "Compiler/GNU/5.3" + # ------------ Defaults ---------------------------------------------- + IntelCompiler: "$IntelCompiler17_0" + GNUCompiler: "$GNUCompiler5_3" + # ++++++++++++ MPI +++++++++++++++++++++++++++++++++++++++++++++++++++ + MPICH3_2Intel17_0: "MPI/Intel/17.0/MPICH/3.2" + MPICH3_2GNU5_3: "MPI/GNU/5.3/MPICH/3.2" + # ------------ Defaults ---------------------------------------------- + MPICH_GNU: "$MPICH3_2GNU5_3" + MPICH_Intel: "$MPICH3_2Intel17_0" + # ++++++++++++ PETSc +++++++++++++++++++++++++++++++++++++++++++++++++ + PETSc3_7_6MPICH3_2Intel17_0: "Libraries/PETSc/3.7.6/Intel-17.0-MPICH-3.2" + PETSc3_7_5MPICH3_2Intel17_0: "Libraries/PETSc/3.7.5/Intel-17.0-MPICH-3.2" + PETSc3_6_4MPICH3_2Intel17_0: "Libraries/PETSc/3.6.4/Intel-17.0-MPICH-3.2" + PETSc3_7_5MPICH3_2GNU5_3: "Libraries/PETSc/3.7.5/GNU-5.3-MPICH-3.2" + # ------------ Defaults ---------------------------------------------- + PETSc_MPICH_Intel: "$PETSc3_7_6MPICH3_2Intel17_0" + PETSc_MPICH_GNU: "$PETSc3_7_5MPICH3_2GNU5_3" + # ++++++++++++ FEM +++++++++++++++++++++++++++++++++++++++++++++++++++ + Abaqus2016: "FEM/Abaqus/2016" + Abaqus2017: "FEM/Abaqus/2017" + MSC2014: "FEM/MSC/2014" + MSC2014_2: "FEM/MSC/2014.2" + MSC2015: "FEM/MSC/2015" + MSC2016: "FEM/MSC/2016" + # ------------ Defaults ---------------------------------------------- + Abaqus: "$Abaqus2017" + MSC: "$MSC2016" + # ++++++++++++ Documentation +++++++++++++++++++++++++++++++++++++++++ + Doxygen1_8_13: "Documentation/Doxygen/1.8.13" + # ------------ Defaults ---------------------------------------------- + Doxygen: "$Doxygen1_8_13" + + +################################################################################################### +checkout: + stage: prepareAll + before_script: + - echo $CI_PIPELINE_ID >> $TESTROOT/GitLabCI.queue + - while [ $(awk "/$CI_PIPELINE_ID/{print NR}" $TESTROOT/GitLabCI.queue) -ne 1 ];do sleep 5m; done + script: + - mkdir -p $DAMASKROOT + - cd $DAMASKROOT + - git clone -q git@magit1.mpie.de:damask/DAMASK.git . + - git checkout $CI_COMMIT_SHA + - git submodule update --init + - source DAMASK_env.sh + - make processing + - mkdir $BACKUP/$CI_COMMIT_SHA + except: + - master + - release + +################################################################################################### +OrientationRelationship: + stage: preprocessing + script: OrientationRelationship/test.py + except: + - master + - release + +Pre_SeedGeneration: + stage: preprocessing + script: PreProcessing_SeedGeneration/test.py + except: + - master + - release + +Pre_GeomGeneration: + stage: preprocessing + script: PreProcessing_GeomGeneration/test.py + except: + - master + - release + +Pre_GeomModification: + stage: preprocessing + script: PreProcessing_GeomModification/test.py + except: + - master + - release + +Pre_General: + stage: preprocessing + script: PreProcessing/test.py + except: + - master + - release + +Spectral_geometryPacking: + stage: preprocessing + script: Spectral_geometryPacking/test.py + except: + - master + - release + +################################################################################################### +Post_General: + stage: postprocessing + script: PostProcessing/test.py + except: + - master + - release + +Post_GeometryReconstruction: + stage: postprocessing + script: Spectral_geometryReconstruction/test.py + except: + - master + - release + +Post_addCurl: + stage: postprocessing + script: addCurl/test.py + except: + - master + - release + +Post_addDivergence: + stage: postprocessing + script: addDivergence/test.py + except: + - master + - release + +Post_addGradient: + stage: postprocessing + script: addGradient/test.py + except: + - master + - release + +Post_ParaviewRelated: + stage: postprocessing + script: ParaviewRelated/test.py + except: + - master + - release + +################################################################################################### +Compile_Intel: + stage: compileSpectralIntel + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel + - SpectralAll_compile/test.py + except: + - master + - release + +################################################################################################### +Compile_GNU: + stage: compileSpectralGNU + script: + - module load $GNUCompiler $MPICH_GNU $PETSc_MPICH_GNU + - SpectralAll_compile/test.py + except: + - master + - release + +################################################################################################### +Compile_Intel_Prepare: + stage: prepareSpectral + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel + - cd $DAMASKROOT + - make clean spectral processing + except: + - master + - release + +################################################################################################### +Spectral_PackedGeometry: + stage: spectral + script: Spectral_PackedGeometry/test.py + except: + - master + - release + +Spectral_parsingArguments: + stage: spectral + script: Spectral_parsingArguments/test.py + except: + - master + - release + +StateIntegration_compareVariants: + stage: spectral + script: StateIntegration_compareVariants/test.py + except: + - master + - release + +nonlocal_densityConservation: + stage: spectral + script: nonlocal_densityConservation/test.py + except: + - master + - release + +Spectral_ipNeighborhood: + stage: spectral + script: Spectral_ipNeighborhood/test.py + except: + - master + - release + +Nonlocal_Damage_DetectChanges: + stage: spectral + script: Nonlocal_Damage_DetectChanges/test.py + except: + - master + - release + +SpectralAll_restart: + stage: spectral + script: SpectralAll_restart/test.py + except: + - master + - release + +SpectralAll_parsingLoadCase: + stage: spectral + script: SpectralAll_parsingLoadCase/test.py + except: + - master + - release + +SpectralBasic_loadCaseRotation: + stage: spectral + script: SpectralBasic_loadCaseRotation/test.py + except: + - master + - release + +Spectral_MPI: + stage: spectral + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel + - Spectral_MPI/test.py + except: + - master + - release + +Plasticity_DetectChanges: + stage: spectral + script: Plasticity_DetectChanges/test.py + except: + - master + - release + +Homogenization: + stage: spectral + script: Homogenization/test.py + except: + - master + - release + +Phenopowerlaw_singleSlip: + stage: spectral + script: Phenopowerlaw_singleSlip/test.py + except: + - master + - release + +HybridIA: + stage: spectral + script: HybridIA/test.py + except: + - master + - release + +################################################################################################### +Marc_compileIfort2014: + stage: compileMarc2014 + script: + - module load $IntelCompiler16_0 $MSC2014 + - Marc_compileIfort/test.py -m 2014 + except: + - master + - release + +################################################################################################### +Marc_compileIfort2014.2: + stage: compileMarc2014.2 + script: + - module load $IntelCompiler16_0 $MSC2014_2 + - Marc_compileIfort/test.py -m 2014.2 + except: + - master + - release + +################################################################################################### +Marc_compileIfort2015: + stage: compileMarc2015 + script: + - module load $IntelCompiler16_0 $MSC2015 + - Marc_compileIfort/test.py -m 2015 + except: + - master + - release + +################################################################################################### +Marc_compileIfort2016: + stage: compileMarc2016 + script: + - module load $IntelCompiler16_0 $MSC2016 + - Marc_compileIfort/test.py -m 2016 + except: + - master + - release + +################################################################################################### +Hex_elastic: + stage: marc + script: + - module load $IntelCompiler16_0 $MSC + - Hex_elastic/test.py + except: + - master + - release + +CubicFCC_elastic: + stage: marc + script: + - module load $IntelCompiler16_0 $MSC + - CubicFCC_elastic/test.py + except: + - master + - release + +CubicBCC_elastic: + stage: marc + script: + - module load $IntelCompiler16_0 $MSC + - CubicBCC_elastic/test.py + except: + - master + - release + +J2_plasticBehavior: + stage: marc + script: + - module load $IntelCompiler16_0 $MSC + - J2_plasticBehavior/test.py + except: + - master + - release + +################################################################################################### +Abaqus_compile2016: + stage: compileAbaqus2016 + script: + - module load $IntelCompiler16_0 $Abaqus2016 + - Abaqus_compileIfort/test.py -a 2016 + except: + - master + - release + +################################################################################################### +Abaqus_compile2017: + stage: compileAbaqus2017 + script: + - module load $IntelCompiler16_0 $Abaqus2017 + - Abaqus_compileIfort/test.py -a 2017 + except: + - master + - release + +################################################################################################### +SpectralExample: + stage: example + script: SpectralAll_example/test.py + only: + - development + +AbaqusExample: + stage: example + script: + - module load $IntelCompiler16_0 $Abaqus + - Abaqus_example/test.py + only: + - development + +################################################################################################### +SpectralRuntime: + stage: performance + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel + - cd $DAMASKROOT + - make clean spectral processing OPTIMIZATION=AGGRESSIVE + - cd $DAMASKROOT/PRIVATE/testing + - SpectralAll_runtime/test.py -d $TESTROOT + except: + - master + - release + +################################################################################################### +AbaqusExp: + stage: createDocumentation + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen + - $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT abaqus_exp + except: + - master + - release + +AbaqusStd: + stage: createDocumentation + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen + - $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT abaqus_std + except: + - master + - release + +Marc: + stage: createDocumentation + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen + - $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT marc + except: + - master + - release + +Spectral: + stage: createDocumentation + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen + - $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT spectral + except: + - master + - release + +################################################################################################## +mergeIntoMaster: + stage: saveDocumentation + script: + - cp $TESTROOT/time.txt $BACKUP/$CI_COMMIT_SHA + - mv $TESTROOT/time.png $BACKUP/$CI_COMMIT_SHA + - cp $TESTROOT/time.txt $BACKUP/$CI_COMMIT_SHA + - mv $TESTROOT/time.png $BACKUP/$CI_COMMIT_SHA + - mv $DAMASKROOT/PRIVATE/documenting/DAMASK_* $BACKUP/$CI_COMMIT_SHA/ + except: + - master + - release + +################################################################################################## +mergeIntoMaster: + stage: updateMaster + script: + - cd $DAMASKROOT + - export TESTEDREV=$(git describe) # might be detached from development branch + - echo $TESTEDREV > VERSION + - git commit VERSION -m "[skip ci] updated version information after successful test of $TESTEDREV" + - export UPDATEDREV=$(git describe) # tested state + 1 commit + - git checkout master + - git merge $UPDATEDREV -s recursive -X ours # conflicts occur only for inconsistent state + - git push origin master # master is now tested version and has updated VERSION file + - git checkout development + - git pull + - git merge master -s recursive -X ours -m "[skip ci] Merge branch 'master' into development" # only possible conflict is in VERSION file + - git push origin development # development is unchanged (as master is based on it) but has updated VERSION file + only: + - development + +################################################################################################### +removeData: + stage: clean + before_script: + - echo 'Do nothing' + script: + - rm -rf $TESTROOT/GitLabCI_Pipeline_$CI_PIPELINE_ID + - sed -i "/$CI_PIPELINE_ID/d" $TESTROOT/GitLabCI.queue # in case pipeline was manually (web GUI) restarted and releaseLock was performed already + except: + - master + - release + +################################################################################################### +removeLock: + stage: releaseLock + before_script: + - echo 'Do nothing' + when: always + script: sed -i "/$CI_PIPELINE_ID/d" $TESTROOT/GitLabCI.queue + except: + - master + - release diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..5d17eb0cb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "PRIVATE"] + path = PRIVATE + url = ../PRIVATE.git + branch = master diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..9770996b1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,483 @@ +######################################################################################## +# Compiler options for building DAMASK +cmake_minimum_required (VERSION 2.8.8 FATAL_ERROR) + +#--------------------------------------------------------------------------------------- +# Find PETSc from system environment +set(PETSC_DIR $ENV{PETSC_DIR}) +if ("${PETSC_DIR}" STREQUAL "") + message (FATAL_ERROR "PETSC_DIR is not defined") +endif () + +set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables") +set (petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules" ) + +# Use existing variables from PETSc +# https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake + +# Generate a temporary makefile to probe the PETSc configuration +# This file will be deleted +# once the settings from PETSc are parsed into CMake + +exec_program (mktemp ARGS -d OUTPUT_VARIABLE TEMPDIR) +set (petsc_config_makefile "${TEMPDIR}/Makefile.petsc") +file (WRITE +"${petsc_config_makefile}" +"## This file was auto generated by CMake +# PETSC_DIR = ${PETSC_DIR} +SHELL = /bin/sh +include ${petsc_conf_rules} +include ${petsc_conf_variables} +INCLUDE_DIRS := \${PETSC_FC_INCLUDES} +LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB} +COMPILERF := \${FC} +COMPILERC := \${CC} +LINKERNAME := \${FLINKER} +includes: +\t@echo \${INCLUDE_DIRS} +extlibs: +\t@echo \${LIBRARIES} +compilerf: +\t@echo \${COMPILERF} +compilerc: +\t@echo \${COMPILERC} +linker: +\t@echo \${LINKERNAME} +") + +# CMake will execute each target in the ${petsc_config_makefile} +# to acquire corresponding PETSc Variables. +find_program (MAKE_EXECUTABLE NAMES make gmake) +# Find the PETSc includes directory settings +execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "includes" + RESULT_VARIABLE PETSC_INCLUDES_RETURN + OUTPUT_VARIABLE petsc_includes + OUTPUT_STRIP_TRAILING_WHITESPACE) +# Find the PETSc external linking directory settings +# required for final linking, must be appended after the executable +execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "extlibs" + RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN + OUTPUT_VARIABLE petsc_external_lib + OUTPUT_STRIP_TRAILING_WHITESPACE) +# PETSc specified fortran compiler +execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "compilerf" + RESULT_VARIABLE PETSC_MPIFC_RETURN + OUTPUT_VARIABLE PETSC_MPIFC + OUTPUT_STRIP_TRAILING_WHITESPACE) +# PETSc specified C compiler +execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "compilerc" + RESULT_VARIABLE PETSC_MPICC_RETURN + OUTPUT_VARIABLE PETSC_MPICC + OUTPUT_STRIP_TRAILING_WHITESPACE) +# PETSc specified linker (MPIF90 + PETSc linking flags) +execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "linker" + RESULT_VARIABLE PETSC_LINKER_RETURN + OUTPUT_VARIABLE PETSC_LINKER + OUTPUT_STRIP_TRAILING_WHITESPACE) +# Remove temporary makefile, no need to keep it anymore. +file (REMOVE_RECURSE ${TEMPDIR}) + +# Remove duplicate compiler and linker flags +string (REGEX MATCHALL "-I([^\" ]+)" TMP_LIST "${petsc_includes}") +list (REMOVE_DUPLICATES TMP_LIST) +foreach (dir ${TMP_LIST}) + set (PETSC_INCLUDES "${PETSC_INCLUDES} ${dir}") +endforeach (dir) +string (REGEX MATCHALL "-[lLW]([^\" ]+)" TMP_LIST "${petsc_external_lib}") +list (REMOVE_DUPLICATES TMP_LIST) +foreach (exlib ${TMP_LIST}) + set (PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}") +endforeach (exlib) + +message ("Found PETSC_DIR:\n${PETSC_DIR}\n" ) +message ("Found PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" ) +message ("Found PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n") +message ("Found PETSC_LINKER:\n${PETSC_LINKER}\n" ) +message ("Found MPI Fortran Compiler:\n${PETSC_MPIFC}\n" ) +message ("Found MPI C Compiler:\n${PETSC_MPICC}\n" ) + +# set compiler commands to match PETSc (needs to be done before defining the project) +# https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F +set (CMAKE_Fortran_COMPILER "${PETSC_MPIFC}") +set (CMAKE_C_COMPILER "${PETSC_MPICC}") + +#--------------------------------------------------------------------------------------- +# Now start to care about DAMASK + +# DAMASK solver defines project to build +if ("${DAMASK_SOLVER}" STREQUAL "SPECTRAL") + project (DAMASK_spectral Fortran C) + add_definitions (-DSpectral) + message ("Building Spectral Solver\n") +elseif ("${DAMASK_SOLVER}" STREQUAL "FEM") + project (DAMASK_FEM Fortran C) + add_definitions (-DFEM) + message ("Building FEM Solver\n") +endif () + +# set linker commands (needs to be done after defining the project) +set (CMAKE_LINKER "${PETSC_LINKER}") + +if ("${CMAKE_BUILD_TYPE}" STREQUAL "") + set (CMAKE_BUILD_TYPE "RELEASE") +endif () + +# Predefined sets for OPTIMIZATION/OPENMP based on BUILD_TYPE +if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG" OR "${CMAKE_BUILD_TYPE}" STREQUAL "SYNTAXONLY" ) + set (PARALLEL "OFF") + set (OPTI "OFF") +elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") + set (PARALLEL "ON") + set (OPTI "DEFENSIVE") +elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "PERFORMANCE") + set (PARALLEL "ON") + set (OPTI "AGGRESSIVE") +endif () + +# $OPTIMIZATION takes precedence over $BUILD_TYPE defaults +if ("${OPTIMIZATION}" STREQUAL "") + set (OPTIMIZATION "${OPTI}") +else () + set (OPTIMIZATION "${OPTIMIZATION}") +endif () + +# $OPENMP takes precedence over $BUILD_TYPE defaults +if ("${OPENMP}" STREQUAL "") + set (OPENMP "${PARALLEL}") +else () + set(OPENMP "${OPENMP}") +endif () + +# syntax check only (mainly for pre-receive hook, works only with gfortran) +if ("${CMAKE_BUILD_TYPE}" STREQUAL "SYNTAXONLY" ) + set (BUILDCMD_POST "${BUILDCMD_POST} -fsyntax-only") +endif () + +# Parse DAMASK_BIN from CONFIG file +file (READ "CONFIG" CONFIGFILE) +string (REGEX REPLACE ";" "\\\\;" CONFIGFILE "${CONFIGFILE}") +string (REGEX REPLACE "\n" ";" CONFIGFILE "${CONFIGFILE}") +foreach (item ${CONFIGFILE}) + string (REGEX MATCH ".+DAMASK_BIN.+" item ${item}) + if (item) + string (REGEX REPLACE "set" "" item "${item}") + string (REGEX REPLACE "=" " " item "${item}") + string (REGEX REPLACE "\\\${DAMASK_ROOT}" "${PROJECT_SOURCE_DIR}" item "${item}") + string (REPLACE "DAMASK_BIN" ";" STRING_LIST ${item}) + list (GET STRING_LIST 1 item) + string (STRIP "${item}" CMAKE_INSTALL_PREFIX) + endif () +endforeach(item ${CONFIGFILE}) + +# Parse DAMASK version from VERSION file +find_program (CAT_EXECUTABLE NAMES cat) +execute_process (COMMAND ${CAT_EXECUTABLE} ${PROJECT_SOURCE_DIR}/VERSION + RESULT_VARIABLE DAMASK_VERSION_RETURN + OUTPUT_VARIABLE DAMASK_V + OUTPUT_STRIP_TRAILING_WHITESPACE) +add_definitions (-DDAMASKVERSION="${DAMASK_V}") + +# definition of other macros +add_definitions (-DPETSc) +add_definitions (-DFLOAT=8) +add_definitions (-DINT=4) + +set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} ${PETSC_INCLUDES}") + +################################################################################################### +# Intel Compiler +################################################################################################### +if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") + + if (OPENMP) + set (OPENMP_FLAGS "-qopenmp -parallel") + endif () + + if ("${OPTIMIZATION}" STREQUAL "OFF") + set (OPTIMIZATION_FLAGS "-O0 -no-ip") + elseif ("${OPTIMIZATION}" STREQUAL "DEFENSIVE") + set (OPTIMIZATION_FLAGS "-O2") + elseif ("${OPTIMIZATION}" STREQUAL "AGGRESSIVE") + set (OPTIMIZATION_FLAGS "-ipo -O3 -no-prec-div -fp-model fast=2 -xHost") + # -fast = -ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost" + endif () + + set (STANDARD_CHECK "-stand f08 -standard-semantics") + set (LINKER_FLAGS "${LINKER_FLAGS} -shared-intel") + # Link against shared Intel libraries instead of static ones + +#------------------------------------------------------------------------------------------------ +# Fine tuning compilation options + set (COMPILE_FLAGS "${COMPILE_FLAGS} -fpp") + # preprocessor + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -ftz") + # flush underflow to zero, automatically set if -O[1,2,3] + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -assume") + # assume ... + set (COMPILE_FLAGS "${COMPILE_FLAGS} byterecl") + # ... record length is given in bytes (also set by -standard-semantics) + set (COMPILE_FLAGS "${COMPILE_FLAGS},fpe_summary") + # ... print list of floating point exceptions occured during execution + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable") + # disables warnings ... + set (COMPILE_FLAGS "${COMPILE_FLAGS} 5268") + # ... the text exceeds right hand column allowed on the line (we have only comments there) + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn") + # enables warnings ... + set (COMPILE_FLAGS "${COMPILE_FLAGS} declarations") + # ... any undeclared names (alternative name: -implicitnone) + set (COMPILE_FLAGS "${COMPILE_FLAGS},general") + # ... warning messages and informational messages are issued by the compiler + set (COMPILE_FLAGS "${COMPILE_FLAGS},usage") + # ... questionable programming practices + set (COMPILE_FLAGS "${COMPILE_FLAGS},interfaces") + # ... checks the interfaces of all SUBROUTINEs called and FUNCTIONs invoked in your compilation against an external set of interface blocks + set (COMPILE_FLAGS "${COMPILE_FLAGS},ignore_loc") + # ... %LOC is stripped from an actual argument + set (COMPILE_FLAGS "${COMPILE_FLAGS},alignments") + # ... data that is not naturally aligned + set (COMPILE_FLAGS "${COMPILE_FLAGS},unused") + # ... declared variables that are never used + + # Additional options + # -warn: enables warnings, where + # truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. + # (too many warnings because we have comments beyond character 132) + # uncalled: Determines whether warnings occur when a statement function is never called + # all: + # -name as_is: case sensitive Fortran! + +#------------------------------------------------------------------------------------------------ +# Runtime debugging + set (DEBUG_FLAGS "${DEBUG_FLAGS} -g") + # Generate symbolic debugging information in the object file + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -traceback") + # Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -gen-interfaces") + # Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/ + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-stack-check") + # Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-model strict") + # Trap uninitalized variables + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -check" ) + # Checks at runtime ... + set (DEBUG_FLAGS "${DEBUG_FLAGS} bounds") + # ... if an array index is too small (<1) or too large! + set (DEBUG_FLAGS "${DEBUG_FLAGS},format") + # ... for the data type of an item being formatted for output. + set (DEBUG_FLAGS "${DEBUG_FLAGS},output_conversion") + # ... for the fit of data items within a designated format descriptor field. + set (DEBUG_FLAGS "${DEBUG_FLAGS},pointers") + # ... for certain disassociated or uninitialized pointers or unallocated allocatable objects. + set (DEBUG_FLAGS "${DEBUG_FLAGS},uninit") + # ... for uninitialized variables. + set (DEBUG_FLAGS "${DEBUG_FLAGS} -ftrapuv") + # ... initializes stack local variables to an unusual value to aid error detection + set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all0") + # ... capture all floating-point exceptions, sets -ftz automatically + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn") + # enables warnings ... + set (DEBUG_FLAGS "${DEBUG_FLAGS} errors") + # ... warnings are changed to errors + set (DEBUG_FLAGS "${DEBUG_FLAGS},stderrors") + # ... warnings about Fortran standard violations are changed to errors + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -debug-parameters all") + # generate debug information for parameters + + # Additional options + # -heap-arrays: Should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits + # -check: Checks at runtime, where + # arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?) + # stack: + +#------------------------------------------------------------------------------------------------ +# precision settings + set (PRECISION_FLAGS "${PRECISION_FLAGS} -real-size 64") + # set precision for standard real to 32 | 64 | 128 (= 4 | 8 | 16 bytes, type pReal is always 8 bytes) + set (PRECISION_FLAGS "${PRECISION_FLAGS} -integer-size 32") + # set precision for standard int to 16 | 32 | 64 (= 2 | 4 | 8 bytes, type pInt is always 4 bytes) + + +################################################################################################### +# GNU Compiler +################################################################################################### +elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") + + if (OPENMP) + set (OPENMP_FLAGS "-fopenmp") + endif () + + if ("${OPTIMIZATION}" STREQUAL "OFF") + set (OPTIMIZATION_FLAGS "-O0" ) + elseif ("${OPTIMIZATION}" STREQUAL "DEFENSIVE") + set (OPTIMIZATION_FLAGS "-O2") + elseif ("${OPTIMIZATION}" STREQUAL "AGGRESSIVE") + set (OPTIMIZATION_FLAGS "-O3 -ffast-math -funroll-loops -ftree-vectorize") + endif () + + set (STANDARD_CHECK "-std=f2008ts -pedantic-errors" ) + set (LINKER_FLAGS "${LINKER_FLAGS} -Wl") + # options parsed directly to the linker + set (LINKER_FLAGS "${LINKER_FLAGS},-undefined,dynamic_lookup" ) + # ensure to link against dynamic libraries + +#------------------------------------------------------------------------------------------------ +# Fine tuning compilation options + set (COMPILE_FLAGS "${COMPILE_FLAGS} -xf95-cpp-input") + # preprocessor + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -ffree-line-length-132") + # restrict line length to the standard 132 characters (lattice.f90 require more characters) + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -fimplicit-none") + # assume "implicit none" even if not present in source + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -fmodule-private") + # assume "private" even if not present in source + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wall") + # sets the following Fortran options: + # -Waliasing: warn about possible aliasing of dummy arguments. Specifically, it warns if the same actual argument is associated with a dummy argument with "INTENT(IN)" and a dummy argument with "INTENT(OUT)" in a call with an explicit interface. + # -Wampersand: checks if a character expression is continued proberly by an ampersand at the end of the line and at the beginning of the new line + # -Warray-bounds: checks if array reference is out of bounds at compile time. use -fcheck-bounds to also check during runtime + # -Wconversion: warn about implicit conversions between different type + # -Wsurprising: warn when "suspicious" code constructs are encountered. While technically legal these usually indicate that an error has been made. + # -Wc-binding-type: + # -Wintrinsics-std: only standard intrisics are available, e.g. "call flush(6)" will cause an error + # -Wno-tabs: do not allow tabs in source + # -Wintrinsic-shadow: warn if a user-defined procedure or module procedure has the same name as an intrinsic + # -Wline-truncation: + # -Wtarget-lifetime: + # -Wreal-q-constant: warn about real-literal-constants with 'q' exponent-letter + # -Wunused: a number of unused-xxx warnings + # and sets the general (non-Fortran options) options: + # -Waddress + # -Warray-bounds (only with -O2) + # -Wc++11-compat + # -Wchar-subscripts + # -Wcomment + # -Wformat + # -Wmaybe-uninitialized + # -Wnonnull + # -Wparentheses + # -Wpointer-sign + # -Wreorder + # -Wreturn-type + # -Wsequence-point + # -Wstrict-aliasing + # -Wstrict-overflow=1 + # -Wswitch + # -Wtrigraphs + # -Wuninitialized + # -Wunknown-pragmas + # -Wunused-function + # -Wunused-label + # -Wunused-value + # -Wunused-variable + # -Wvolatile-register-var + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wextra") + # sets the following Fortran options: + # -Wunuses-parameter: + # -Wcompare-reals: + # and sets the general (non-Fortran options) options: + # -Wclobbered + # -Wempty-body + # -Wignored-qualifiers + # -Wmissing-field-initializers + # -Woverride-init + # -Wsign-compare + # -Wtype-limits + # -Wuninitialized + # -Wunused-but-set-parameter (only with -Wunused or -Wall) + # -Wno-globals + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wcharacter-truncation") + # warn if character expressions (strings) are truncated + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wunderflow") + # produce a warning when numerical constant expressions are encountered, which yield an UNDERFLOW during compilation + + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wsuggest-attribute=pure") + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wsuggest-attribute=noreturn") + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wconversion-extra") + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wimplicit-procedure") + set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-unused-parameter") + set (COMPILE_FLAGS "${COMPILE_FLAGS} -ffpe-summary=all") + # print summary of floating point exeptions (invalid,zero,overflow,underflow,inexact,denormal) + + # Additional options + # -Warray-temporarieswarnings: because we have many temporary arrays (performance issue?): + # -Wimplicit-interface: no interfaces for lapack/MPI routines + # -Wunsafe-loop-optimizations: warn if the loop cannot be optimized due to nontrivial assumptions. + +#------------------------------------------------------------------------------------------------ +# Runtime debugging + set (DEBUG_FLAGS "${DEBUG_FLAGS} -ffpe-trap=invalid,zero,overflow") + # stop execution if floating point exception is detected (NaN is silent) + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -g") + # Generate symbolic debugging information in the object file + + set (DEBUG_FLAGS "${DEBUG_FLAGS} -fbacktrace") + set (DEBUG_FLAGS "${DEBUG_FLAGS} -fdump-core") + set (DEBUG_FLAGS "${DEBUG_FLAGS} -fcheck=all") + # checks for (array-temps,bounds,do,mem,pointer,recursion) + + # Additional options + # -ffpe-trap=precision,denormal,underflow +#------------------------------------------------------------------------------------------------ +# precision settings + set (PRECISION_FLAGS "${PRECISION_FLAGS} -fdefault-real-8") + # set precision to 8 bytes for standard real (=8 for pReal). Will set size of double to 16 bytes as long as -fdefault-double-8 is not set + + set (PRECISION_FLAGS "${PRECISION_FLAGS} -fdefault-double-8") + # set precision to 8 bytes for double real, would be 16 bytes if -fdefault-real-8 is used + + # Additional options + # -fdefault-integer-8: Use it to set precision to 8 bytes for integer, don't use it for the standard case of pInt=4 (there is no -fdefault-integer-4) +endif () + +set (CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${BUILDCMD_PRE} ${OPENMP_FLAGS} ${STANDARD_CHECK} ${OPTIMIZATION_FLAGS} ${COMPILE_FLAGS} ${PRECISION_FLAGS}") +set (CMAKE_Fortran_LINK_EXECUTABLE "${BUILDCMD_PRE} ${CMAKE_LINKER} ${OPENMP_FLAGS} ${OPTIMIZATION_FLAGS} ${LINKER_FLAGS}") + +if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") + set (CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}} ${DEBUG_FLAGS}") + set (CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} ${DEBUG_FLAGS}") +endif () + +set (CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}") +set (CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -o ${PETSC_EXTERNAL_LIB} ${BUILDCMD_POST}") + +message ("Fortran Compiler Flags:\n${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}\n") +message ("C Compiler Flags:\n${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}\n") +message ("Fortran Linker Command:\n${CMAKE_Fortran_LINK_EXECUTABLE}\n") + +# location of code +add_subdirectory (src) + +# INSTALL BUILT BINARIES +if ("${CMAKE_BUILD_TYPE}" STREQUAL "SYNTAXONLY") + exec_program (mktemp ARGS -d OUTPUT_VARIABLE BLACK_HOLE) + install (PROGRAMS ${PROJECT_BINARY_DIR}/src/prec.mod + DESTINATION ${BLACK_HOLE}) +else () + if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral") + install (PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral + DESTINATION ${CMAKE_INSTALL_PREFIX}) + elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM") + install (PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM + DESTINATION ${CMAKE_INSTALL_PREFIX}) + endif () +endif () diff --git a/CONFIG b/CONFIG index 9be3a95fb..db75fa811 100644 --- a/CONFIG +++ b/CONFIG @@ -5,7 +5,7 @@ set DAMASK_BIN = ${DAMASK_ROOT}/bin set DAMASK_NUM_THREADS = 4 -set MSC_ROOT = /opt/MSC -set MARC_VERSION = 2015 +set MSC_ROOT = /opt/msc +set MARC_VERSION = 2016 -set ABAQUS_VERSION = 6.14-5 +set ABAQUS_VERSION = 2017 diff --git a/DAMASK_env.sh b/DAMASK_env.sh index e45e16d42..264ae9c94 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -10,6 +10,9 @@ else DAMASK_ROOT=${STAT##* } fi +# shorthand command to change to DAMASK_ROOT directory +eval "function damask() { cd $DAMASK_ROOT; }" + # defining set() allows to source the same file for tcsh and bash, with and without space around = set() { export $1$2$3 @@ -22,11 +25,11 @@ if [[ "x$DAMASK_BIN" != "x" && ! $(echo ":$PATH:" | grep $DAMASK_BIN:) ]]; then export PATH=$DAMASK_BIN:$PATH fi -SOLVER=$(which DAMASK_spectral 2>/dev/null) +SOLVER=$(which DAMASK_spectral || true 2>/dev/null) if [ "x$SOLVER" == "x" ]; then SOLVER='Not found!' fi -PROCESSING=$(which postResults 2>/dev/null) +PROCESSING=$(which postResults || true 2>/dev/null) if [ "x$PROCESSING" == "x" ]; then PROCESSING='Not found!' fi @@ -36,12 +39,14 @@ fi # according to http://software.intel.com/en-us/forums/topic/501500 # this seems to make sense for the stack size -FREE=$(which free 2>/dev/null) +FREE=$(type -p free 2>/dev/null) if [ "x$FREE" != "x" ]; then freeMem=$(free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}') # http://superuser.com/questions/220059/what-parameters-has-ulimit - ulimit -d $(expr $freeMem / 2) 2>/dev/null # maximum heap size (kB) - ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB) + ulimit -d unlimited 2>/dev/null \ + || ulimit -d $(expr $freeMem / 2) 2>/dev/null # maximum heap size (kB) + ulimit -s unlimited 2>/dev/null \ + || ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB) fi ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index 81cbd45bf..9098352bf 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -3,6 +3,9 @@ DAMASK_ROOT=${0:a:h} +# shorthand command to change to DAMASK_ROOT directory +eval "function damask() { cd $DAMASK_ROOT; }" + # defining set() allows to source the same file for tcsh and zsh, with and without space around = set() { export $1$2$3 @@ -16,8 +19,8 @@ if [[ ( "x$DAMASK_BIN" != "x" ) && ( "x$MATCH" = "x" ) ]]; then export PATH=$DAMASK_BIN:$PATH fi -SOLVER=`which DAMASK_spectral 2>/dev/null` -PROCESSING=`which postResults 2>/dev/null` +SOLVER=`which DAMASK_spectral || True 2>/dev/null` +PROCESSING=`which postResults || True 2>/dev/null` if [ "x$DAMASK_NUM_THREADS" = "x" ]; then DAMASK_NUM_THREADS=1 fi diff --git a/LICENSE b/LICENSE index 5a76343a0..97d799216 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2011-16 Max-Planck-Institut für Eisenforschung GmbH +Copyright 2011-17 Max-Planck-Institut für Eisenforschung GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 68ffb7033..0ba67963e --- a/Makefile +++ b/Makefile @@ -3,30 +3,36 @@ SHELL = /bin/sh # Makefile for the installation of DAMASK ######################################################################################## .PHONY: all -all: spectral marc processing +all: spectral FEM marc processing .PHONY: spectral -spectral: - $(MAKE) DAMASK_spectral.exe -C code +spectral: build/spectral + @(cd build/spectral;make --no-print-directory -ws all install;) .PHONY: FEM -FEM: - $(MAKE) DAMASK_FEM.exe -C code +FEM: build/FEM + @(cd build/FEM; make --no-print-directory -ws all install;) + +.PHONY: build/spectral +build/spectral: + @mkdir -p build/spectral + @(cd build/spectral; cmake -Wno-dev -DDAMASK_SOLVER=SPECTRAL -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;) + +.PHONY: build/FEM +build/FEM: + @mkdir -p build/FEM + @(cd build/FEM; cmake -Wno-dev -DDAMASK_SOLVER=FEM -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;) .PHONY: marc marc: + @./installation/symLink_Code.sh @./installation/mods_MarcMentat/apply_DAMASK_modifications.sh ${MAKEFLAGS} -.PHONY: tidy -tidy: - @$(MAKE) tidy -C code >/dev/null - .PHONY: clean clean: - @$(MAKE) cleanDAMASK -C code >/dev/null + @rm -rf build -.PHONY: install -install: - @./installation/symlink_Code.py ${MAKEFLAGS} +.PHONY: processing +processing: @./installation/symlink_Processing.py ${MAKEFLAGS} diff --git a/PRIVATE b/PRIVATE new file mode 160000 index 000000000..a629ee95c --- /dev/null +++ b/PRIVATE @@ -0,0 +1 @@ +Subproject commit a629ee95c53924f2da16e8981855f9abcc1d50f7 diff --git a/README b/README index 6705c13fa..5c5d976b6 100644 --- a/README +++ b/README @@ -1,4 +1,5 @@ -visit damask.mpie.de for installation and usage instructions +DAMASK - The Düsseldorf Advanced Material Simulation Kit +Visit damask.mpie.de for installation and usage instructions CONTACT INFORMATION @@ -8,4 +9,4 @@ Max-Planck-Str. 1 Germany Email: DAMASK@mpie.de -http://damask.mpie.de +https://damask.mpie.de diff --git a/VERSION b/VERSION index 3440f8734..239d87251 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-339-gd67be0e +v2.0.1-705-g5f90230 diff --git a/code/.gitattributes b/code/.gitattributes deleted file mode 100644 index 8035e26a7..000000000 --- a/code/.gitattributes +++ /dev/null @@ -1,8 +0,0 @@ -# from https://help.github.com/articles/dealing-with-line-endings/ -# -# always use LF, even if the files are edited on windows, they need to be compiled/used on unix -* text eol=lf - -# Denote all files that are truly binary and should not be modified. -*.png binary -*.jpg binary diff --git a/code/Makefile b/code/Makefile deleted file mode 100644 index 49ce9c50e..000000000 --- a/code/Makefile +++ /dev/null @@ -1,740 +0,0 @@ -SHELL = /bin/sh -######################################################################################## -# Makefile to compile the Material subroutine for BVP solution using spectral method -######################################################################################## -# Be sure to remove all files compiled with different options by using "make clean" -######################################################################################## -# OPTIONS = standard (alternative): meaning -#------------------------------------------------------------- -# F90 = ifort (gfortran): compiler type, choose Intel or GNU -# FCOMPILERNAME = name of the compiler executable (if not the same as the type), e.g. using mpich-g90 instead of ifort -# PORTABLE = TRUE (FALSE): decision, if executable is optimized for the machine on which it was built. -# OPTIMIZATION = DEFENSIVE (OFF,AGGRESSIVE,ULTRA): Optimization mode: O2, O0, O3 + further options for most files, O3 + further options for all files -# OPENMP = TRUE (FALSE): OpenMP multiprocessor support -# PREFIX = arbitrary prefix (before FCOMPILERNAME) -# OPTION = arbitrary option (just before file to compile) -# SUFFIX = arbitrary suffix (after file to compile) -# STANDARD_CHECK = checking for Fortran 2008, compiler dependend -######################################################################################## -# including PETSc files. PETSC_ARCH is loaded from these files. -DAMASKVERSION :=$(shell cat ../VERSION) - -include ${PETSC_DIR}/lib/petsc/conf/variables -include ${PETSC_DIR}/lib/petsc/conf/rules - -INCLUDE_DIRS := $(PETSC_FC_INCLUDES) -DPETSc -LIBRARIES := $(PETSC_WITH_EXTERNAL_LIB) -FCOMPILERNAME ?= $(FC) -CCOMPILERNAME ?= $(CC) -LINKERNAME ?= $(FLINKER) - -# MPI compiler wrappers will tell if they are pointing to ifort or gfortran -COMPILEROUT :=$(shell $(FC) -show) -# search in FC or COMPILEROUT for gfortran/ifort if not defined -ifeq ($(strip $(F90)),) - F90 :=$(findstring gfortran,$(FC) $(COMPILEROUT)) -endif -ifeq ($(strip $(F90)),) - F90 :=$(findstring ifort,$(FC) $(COMPILEROUT)) -endif - -OPENMP ?= ON -OPTIMIZATION ?= DEFENSIVE - -ifeq "$(OPTIMIZATION)" "OFF" -OPTI := OFF -MAXOPTI := OFF -endif -ifeq "$(OPTIMIZATION)" "DEFENSIVE" -OPTI := DEFENSIVE -MAXOPTI := DEFENSIVE -endif -ifeq "$(OPTIMIZATION)" "AGGRESSIVE" -OPTI := AGGRESSIVE -MAXOPTI := DEFENSIVE -endif -ifeq "$(OPTIMIZATION)" "ULTRA" -OPTI := AGGRESSIVE -MAXOPTI := AGGRESSIVE -endif - -ifndef OPTI -OPTI := DEFENSIVE -MAXOPTI := DEFENSIVE -endif - -# settings for shared memory multicore support -ifeq "$(OPENMP)" "ON" -OPENMP_FLAG_ifort =-qopenmp -parallel -OPENMP_FLAG_gfortran =-fopenmp -endif - -ifdef STANDARD_CHECK -STANDARD_CHECK_ifort =$(STANDARD_CHECK) -STANDARD_CHECK_gfortran =$(STANDARD_CHECK) -endif - -STANDARD_CHECK_ifort ?=-stand f08 -standard-semantics -STANDARD_CHECK_gfortran ?=-std=f2008ts -pedantic-errors - -#-pedantic: more strict on standard, enables some warnings -# -pedantic-errors: like pedantic, but errors instead of warnings -OPTIMIZATION_OFF_ifort :=-O0 -no-ip -OPTIMIZATION_OFF_gfortran :=-O0 -OPTIMIZATION_DEFENSIVE_ifort :=-O2 -OPTIMIZATION_DEFENSIVE_gfortran :=-O2 -OPTIMIZATION_AGGRESSIVE_ifort :=-ipo -O3 -no-prec-div -fp-model fast=2 -xHost #-fast = -ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost -OPTIMIZATION_AGGRESSIVE_gfortran :=-O3 -ffast-math -funroll-loops -ftree-vectorize - - -LINK_OPTIONS_ifort :=-shared-intel -COMPILE_OPTIONS_ifort :=-DDAMASKVERSION=\"${DAMASKVERSION}\"\ - -fpp\ - -ftz\ - -assume byterecl,fpe_summary\ - -diag-disable 5268\ - -warn declarations\ - -warn general\ - -warn usage\ - -warn interfaces\ - -warn ignore_loc\ - -warn alignments\ - -warn unused - -################################################################################################### -#COMPILE SWITCHES -#-shared-intel: Link against shared Intel libraries instead of static ones -#-fpp: preprocessor -#-ftz: flush unterflow to zero, automatically set if O<0,1,2,3> >0 -#-assume byterecl record length is given in bytes (also set by -standard-semantics) -# fpe_summary print list of floating point exceptions occured during execution -#-fimplicit-none: assume "implicit-none" even if not present in source -#-diag-disable: disables warnings, where -# warning ID 5268: the text exceeds right hand column allowed on the line (we have only comments there) -#-warn: enables warnings, where -# declarations: any undeclared names (alternative name: -implicitnone) -# general: warning messages and informational messages are issued by the compiler -# usage: questionable programming practices -# interfaces: checks the interfaces of all SUBROUTINEs called and FUNCTIONs invoked in your compilation against an external set of interface blocks -# ignore_loc: %LOC is stripped from an actual argument -# alignments: data that is not naturally aligned -# unused: declared variables that are never used -# stderrors: warnings about Fortran standard violations are changed to errors (STANDARD_CHECK) -# -################################################################################################### -#MORE OPTIONS FOR DEBUGGING DURING COMPILATION -#-warn: enables warnings, where -# truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. (too many warnings because we have comments beyond character 132) -# uncalled: Determines whether warnings occur when a statement function is never called -# all: -# -name as_is: case sensitive Fortran! - -DEBUG_OPTIONS_ifort :=-g\ - -traceback\ - -gen-interfaces\ - -fp-stack-check\ - -fp-model strict\ - -check bounds,format,output_conversion,pointers,uninit\ - -ftrapuv\ - -fpe-all0\ - -warn errors\ - -warn stderrors\ - -debug-parameters all - -################################################################################################### -#COMPILE SWITCHES FOR RUNTIME DEBUGGING -#-g: Generate symbolic debugging information in the object file -#-traceback: Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time. -#-gen-interfaces: Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/ -#-fp-stack-check: Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state. -#-ftrapuv Trap uninitalized variables -#-check: checks at runtime, where -# bounds: check if an array index is too small (<1) or too large! -# format: Checking for the data type of an item being formatted for output. -# output_conversion: Checking for the fit of data items within a designated format descriptor field. -# pointers: Checking for certain disassociated or uninitialized pointers or unallocated allocatable objects. -# uninit: Checking for uninitialized variables. -#-fpe-all0 capture all floating-point exceptions, sets -ftz automatically -#-warn: enables warnings, where -# errors: warnings are changed to errors -# stderrors: warnings about Fortran standard violations are changed to errors -# information on http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/ -################################################################################################### -#MORE OPTIONS FOR RUNTIME DEBUGGING -#-heap-arrays: should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits -#-check: checks at runtime, where -# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?) -# stack: -LINK_OPTIONS_gfortran :=-Wl,-undefined,dynamic_lookup -COMPILE_OPTIONS_gfortran :=-DDAMASKVERSION=\"${DAMASKVERSION}\"\ - -xf95-cpp-input\ - -ffree-line-length-132\ - -fimplicit-none\ - -fmodule-private\ - -Wall\ - -Wextra\ - -Wcharacter-truncation\ - -Wunderflow\ - -Wsuggest-attribute=pure\ - -Wsuggest-attribute=noreturn\ - -Wconversion-extra\ - -Wimplicit-procedure\ - -Wno-unused-parameter -#-ffpe-summary=all only for newer gfortran -################################################################################################### -#COMPILE SWITCHES -#-shared -#-Wl,-undefined,dynamic_lookup:ensure to link against dynamic libraries -#-xf95-cpp-input: preprocessor -#-ffree-line-length-132: restrict line length to the standard 132 characters -#-ffpe-summary: print summary of floating point exeptions (‘invalid’, ‘zero’, ‘overflow’, ‘underflow’, ‘inexact’ and ‘denormal’) -#-fimplicit-none: assume "implicit-none" even if not present in source -#-fmodule-private: assume "private" even if not present in source -#-Wcharacter-truncation: warn if character expressions (strings) are truncated -#-Wunderflow: produce a warning when numerical constant expressions are encountered, which yield an UNDERFLOW during compilation -#-Wsuggest-attribute=pure: -#-Wsuggest-attribute=noreturn: -#-Wconversion-extra -#-Wimplicit-procedure -#-Wall: sets the following Fortran options: -# -Waliasing: warn about possible aliasing of dummy arguments. Specifically, it warns if the same actual argument is associated with a dummy argument with "INTENT(IN)" and a dummy argument with "INTENT(OUT)" in a call with an explicit interface. -# -Wampersand: checks if a character expression is continued proberly by an ampersand at the end of the line and at the beginning of the new line -# -Warray-bounds: checks if array reference is out of bounds at compile time. use -fcheck-bounds to also check during runtime -# -Wconversion: warn about implicit conversions between different type -# -Wsurprising: warn when "suspicious" code constructs are encountered. While technically legal these usually indicate that an error has been made. -# -Wc-binding-type: -# -Wintrinsics-std: only standard intrisics are available, e.g. "call flush(6)" will cause an error -# -Wno-tabs: do not allow tabs in source -# -Wintrinsic-shadow: warn if a user-defined procedure or module procedure has the same name as an intrinsic -# -Wline-truncation: -# -Wtarget-lifetime: -# -Wreal-q-constant: warn about real-literal-constants with 'q' exponent-letter -# -Wunused: a number of unused-xxx warnings -# these are general (non -Fortran options) implied by -Wall -# -Waddress -# -Warray-bounds (only with -O2) -# -Wc++11-compat -# -Wchar-subscripts -# -Wcomment -# -Wformat -# -Wmaybe-uninitialized -# -Wnonnull -# -Wparentheses -# -Wpointer-sign -# -Wreorder -# -Wreturn-type -# -Wsequence-point -# -Wstrict-aliasing -# -Wstrict-overflow=1 -# -Wswitch -# -Wtrigraphs -# -Wuninitialized -# -Wunknown-pragmas -# -Wunused-function -# -Wunused-label -# -Wunused-value -# -Wunused-variable -# -Wvolatile-register-var -#-Wextra: sets the following Fortran options: -# -Wunuses-parameter: -# -Wcompare-reals: -# these are general (non -Fortran options) implied by -Wextra -# -Wclobbered -# -Wempty-body -# -Wignored-qualifiers -# -Wmissing-field-initializers -# -Woverride-init -# -Wsign-compare -# -Wtype-limits -# -Wuninitialized -# -Wunused-but-set-parameter (only with -Wunused or -Wall) -# -Wno-globals - -################################################################################################### -#MORE OPTIONS FOR DEBUGGING DURING COMPILATION -#-Warray-temporarieswarnings: because we have many temporary arrays (performance issue?): -#-Wimplicit-interface: no interfaces for lapack routines -#-Wunsafe-loop-optimizations: warn if the loop cannot be optimized due to nontrivial assumptions. -#-Wstrict-overflow: - -DEBUG_OPTIONS_gfortran :=-g \ - -fbacktrace \ - -fdump-core \ - -fcheck=all \ - -ffpe-trap=invalid,zero,overflow - -################################################################################################### -#COMPILE SWITCHES FOR RUNTIME DEBUGGING -#-ffpe-trap=invalid,\ stop execution if floating point exception is detected (NaN is silent) -# zero,\ -# overflow -#-fcheck=all: sets the following Fortran options: -#array-temps -#bounds -#do -#mem -#pointer -#recursion -################################################################################################### -#MORE OPTIONS FOR RUNTIME DEBUGGING -#-ffpe-trap=precision,\ -# denormal, \ -# underflow - -ifeq "$(DEBUG)" "ON" -COMPILE_OPTIONS_$(F90) +=$(DEBUG_OPTIONS_$(F90)) -LINK_OPTIONS_$(F90) +=$(DEBUG_OPTIONS_$(F90)) -endif -LINK_OPTIONS_$(F90) += $(OPTIMIZATION_$(MAXOPTI)_$(F90)) - -PRECISION_ifort :=-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4 -#-real-size 32: set precision to one of those 32/64/128 (= 4/8/16 bytes) for standard real (=8 for pReal) -#-integer-size 16: set precision to one of those 16/32/64 (= 2/4/8 bytes) for standard integer (=4 for pInt) -PRECISION_gfortran :=-fdefault-real-8 -fdefault-double-8 -DFLOAT=8 -DINT=4 -#-fdefault-real-8: set precision to 8 bytes for standard real (=8 for pReal). Will set size of double to 16 bytes as long as -fdefault-double-8 is not set -#-fdefault-double-8: set precision to 8 bytes for double real, would be 16 bytes because -fdefault-real-8 is used -#-fdefault-integer-8: Use it to set precision to 8 bytes for integer, don't use it for the standard case of pInt=4 (there is no -fdefault-integer-4) - -################################################################################################### -COMPILE =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(OPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90)) -COMPILE_MAXOPTI =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90)) -################################################################################################### -SOURCE_FILES = \ - source_thermal_dissipation.o \ - source_thermal_externalheat.o \ - source_damage_isoBrittle.o \ - source_damage_isoDuctile.o \ - source_damage_anisoBrittle.o \ - source_damage_anisoDuctile.o \ - source_vacancy_phenoplasticity.o \ - source_vacancy_irradiation.o \ - source_vacancy_thermalfluc.o - -KINEMATICS_FILES = \ - kinematics_cleavage_opening.o \ - kinematics_slipplane_opening.o \ - kinematics_thermal_expansion.o \ - kinematics_vacancy_strain.o \ - kinematics_hydrogen_strain.o - -PLASTIC_FILES = \ - plastic_dislotwin.o \ - plastic_disloUCLA.o \ - plastic_isotropic.o \ - plastic_phenopowerlaw.o \ - plastic_titanmod.o \ - plastic_nonlocal.o \ - plastic_none.o \ - plastic_phenoplus.o - -THERMAL_FILES = \ - thermal_isothermal.o \ - thermal_adiabatic.o \ - thermal_conduction.o - -DAMAGE_FILES = \ - damage_none.o \ - damage_local.o \ - damage_nonlocal.o - -VACANCYFLUX_FILES = \ - vacancyflux_isoconc.o \ - vacancyflux_isochempot.o \ - vacancyflux_cahnhilliard.o - -POROSITY_FILES = \ - porosity_none.o \ - porosity_phasefield.o - -HYDROGENFLUX_FILES = \ - hydrogenflux_isoconc.o \ - hydrogenflux_cahnhilliard.o - -HOMOGENIZATION_FILES = \ - homogenization_RGC.o \ - homogenization_isostrain.o \ - homogenization_none.o - -##################### -# Spectral Solver -##################### -DAMASK_spectral.exe: IGNORE := \# -DAMASK_spectral.exe: COMPILE += -DSpectral -DAMASK_spectral.exe: COMPILE_MAXOPTI += -DSpectral -DAMASK_spectral.exe: MESHNAME := mesh.f90 -DAMASK_spectral.exe: INTERFACENAME := spectral_interface.f90 - -DAMASK_spectral.o: IGNORE := \# -DAMASK_spectral.o: COMPILE += -DSpectral -DAMASK_spectral.o: COMPILE_MAXOPTI += -DSpectral -DAMASK_spectral.o: MESHNAME := mesh.f90 -DAMASK_spectral.o: INTERFACENAME := spectral_interface.f90 - - -SPECTRAL_SOLVER_FILES = spectral_mech_AL.o spectral_mech_Basic.o spectral_mech_Polarisation.o \ - spectral_thermal.o spectral_damage.o - -SPECTRAL_FILES = C_routines.o \ - system_routines.o \ - prec.o \ - DAMASK_interface.o \ - IO.o \ - numerics.o \ - debug.o \ - math.o \ - FEsolving.o \ - mesh.o \ - material.o \ - lattice.o \ - $(SOURCE_FILES) \ - $(KINEMATICS_FILES) \ - $(PLASTIC_FILES) \ - constitutive.o \ - crystallite.o \ - $(THERMAL_FILES) \ - $(DAMAGE_FILES) \ - $(VACANCYFLUX_FILES) \ - $(HYDROGENFLUX_FILES) \ - $(POROSITY_FILES) \ - $(HOMOGENIZATION_FILES) homogenization.o \ - CPFEM2.o \ - spectral_utilities.o \ - $(SPECTRAL_SOLVER_FILES) - -DAMASK_spectral.exe: DAMASK_spectral.o - $(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \ - -o DAMASK_spectral.exe DAMASK_spectral.o \ - $(SPECTRAL_FILES) $(LIBRARIES) $(SUFFIX) - - -DAMASK_spectral.o: DAMASK_spectral.f90 \ - $(SPECTRAL_SOLVER_FILES) - $(PREFIX) $(FCOMPILERNAME) $(COMPILE_MAXOPTI) -c DAMASK_spectral.f90 $(SUFFIX) - -spectral_mech_AL.o: spectral_mech_AL.f90 \ - spectral_utilities.o - -spectral_mech_Polarisation.o: spectral_mech_Polarisation.f90 \ - spectral_utilities.o - -spectral_mech_Basic.o: spectral_mech_Basic.f90 \ - spectral_utilities.o - -spectral_thermal.o: spectral_thermal.f90 \ - spectral_utilities.o - -spectral_damage.o: spectral_damage.f90 \ - spectral_utilities.o - -spectral_utilities.o: spectral_utilities.f90 \ - CPFEM2.o - -##################### -# FEM Solver -##################### -VPATH := ../private/FEM/code -DAMASK_FEM.exe: COMPILE += -DFEM -DAMASK_FEM.exe: COMPILE_MAXOPTI += -DFEM -DAMASK_FEM.exe: MESHNAME := ../private/FEM/code/meshFEM.f90 -DAMASK_FEM.exe: INTERFACENAME := ../private/FEM/code/DAMASK_FEM_interface.f90 -DAMASK_FEM.exe: INCLUDE_DIRS += -I./ - -FEM_SOLVER_FILES = FEM_mech.o FEM_thermal.o FEM_damage.o FEM_vacancyflux.o FEM_porosity.o FEM_hydrogenflux.o - -FEM_FILES = prec.o \ - DAMASK_interface.o \ - FEZoo.o \ - IO.o \ - numerics.o \ - debug.o \ - math.o \ - FEsolving.o \ - mesh.o \ - material.o \ - lattice.o \ - $(SOURCE_FILES) \ - $(KINEMATICS_FILES) \ - $(PLASTIC_FILES) \ - constitutive.o \ - crystallite.o \ - $(THERMAL_FILES) \ - $(DAMAGE_FILES) \ - $(VACANCYFLUX_FILES) \ - $(HYDROGENFLUX_FILES) \ - $(POROSITY_FILES) \ - $(HOMOGENIZATION_FILES) homogenization.o \ - CPFEM.o \ - FEM_utilities.o \ - $(FEM_SOLVER_FILES) - -DAMASK_FEM.exe: DAMASK_FEM_driver.o - $(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \ - -o DAMASK_FEM.exe DAMASK_FEM_driver.o \ - $(FEM_FILES) $(LIBRARIES) $(SUFFIX) - -DAMASK_FEM_driver.o: DAMASK_FEM_driver.f90 $(FEM_SOLVER_FILES) - $(PREFIX) $(FCOMPILERNAME) $(COMPILE_MAXOPTI) -c ../private/FEM/code/DAMASK_FEM_driver.f90 $(SUFFIX) - -FEM_mech.o: FEM_mech.f90 \ - FEM_utilities.o - -FEM_thermal.o: FEM_thermal.f90 \ - FEM_utilities.o - -FEM_damage.o: FEM_damage.f90 \ - FEM_utilities.o - -FEM_vacancyflux.o: FEM_vacancyflux.f90 \ - FEM_utilities.o - -FEM_porosity.o: FEM_porosity.f90 \ - FEM_utilities.o - -FEM_hydrogenflux.o: FEM_hydrogenflux.f90 \ - FEM_utilities.o - -FEM_utilities.o: FEM_utilities.f90 \ - CPFEM.o - -FEZoo.o: $(wildcard FEZoo.f90) \ - IO.o - $(IGNORE) $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c ../private/FEM/code/FEZoo.f90 $(SUFFIX) - touch FEZoo.o - -CPFEM.o: CPFEM.f90 \ - homogenization.o - -CPFEM2.o: CPFEM2.f90 \ - homogenization.o - -homogenization.o: homogenization.f90 \ - $(THERMAL_FILES) \ - $(DAMAGE_FILES) \ - $(VACANCYFLUX_FILES) \ - $(POROSITY_FILES) \ - $(HYDROGENFLUX_FILES) \ - $(HOMOGENIZATION_FILES) - -thermal_isothermal.o: thermal_isothermal.f90 \ - crystallite.o - -thermal_adiabatic.o: thermal_adiabatic.f90 \ - crystallite.o - -thermal_conduction.o: thermal_conduction.f90 \ - crystallite.o - -damage_none.o: damage_none.f90 \ - crystallite.o - -damage_local.o: damage_local.f90 \ - crystallite.o - -damage_nonlocal.o: damage_nonlocal.f90 \ - crystallite.o - -thermal_conduction.o: thermal_conduction.f90 \ - crystallite.o - -vacancyflux_isoconc.o: vacancyflux_isoconc.f90 \ - crystallite.o - -vacancyflux_isochempot.o: vacancyflux_isochempot.f90 \ - crystallite.o - -vacancyflux_cahnhilliard.o: vacancyflux_cahnhilliard.f90 \ - crystallite.o - -porosity_none.o: porosity_none.f90 \ - crystallite.o - -porosity_phasefield.o: porosity_phasefield.f90 \ - crystallite.o - -hydrogenflux_isoconc.o: hydrogenflux_isoconc.f90 \ - crystallite.o - -hydrogenflux_cahnhilliard.o: hydrogenflux_cahnhilliard.f90 \ - crystallite.o - -homogenization_RGC.o: homogenization_RGC.f90 \ - crystallite.o - -homogenization_isostrain.o: homogenization_isostrain.f90 \ - crystallite.o - -homogenization_none.o: homogenization_none.f90 \ - crystallite.o - -crystallite.o: crystallite.f90 \ - constitutive.o - -constitutive.o: constitutive.f90 \ - $(SOURCE_FILES) \ - $(KINEMATICS_FILES) \ - $(PLASTIC_FILES) - -source_thermal_dissipation.o: source_thermal_dissipation.f90 \ - lattice.o - -source_thermal_externalheat.o: source_thermal_externalheat.f90 \ - lattice.o - -source_damage_isoBrittle.o: source_damage_isoBrittle.f90 \ - lattice.o - -source_damage_isoDuctile.o: source_damage_isoDuctile.f90 \ - lattice.o - -source_damage_anisoBrittle.o: source_damage_anisoBrittle.f90 \ - lattice.o - -source_damage_anisoDuctile.o: source_damage_anisoDuctile.f90 \ - lattice.o - -source_vacancy_phenoplasticity.o: source_vacancy_phenoplasticity.f90 \ - lattice.o - -source_vacancy_irradiation.o: source_vacancy_irradiation.f90 \ - lattice.o - -source_vacancy_thermalfluc.o: source_vacancy_thermalfluc.f90 \ - lattice.o - -kinematics_cleavage_opening.o: kinematics_cleavage_opening.f90 \ - lattice.o - -kinematics_slipplane_opening.o: kinematics_slipplane_opening.f90 \ - lattice.o - -kinematics_thermal_expansion.o: kinematics_thermal_expansion.f90 \ - lattice.o - -kinematics_vacancy_strain.o: kinematics_vacancy_strain.f90 \ - lattice.o - -kinematics_hydrogen_strain.o: kinematics_hydrogen_strain.f90 \ - lattice.o - -plastic_nonlocal.o: plastic_nonlocal.f90 \ - lattice.o - -plastic_titanmod.o: plastic_titanmod.f90 \ - lattice.o - -plastic_disloUCLA.o: plastic_disloUCLA.f90 \ - lattice.o - -plastic_dislotwin.o: plastic_dislotwin.f90 \ - lattice.o - -plastic_phenopowerlaw.o: plastic_phenopowerlaw.f90 \ - lattice.o - -plastic_phenoplus.o: plastic_phenoplus.f90 \ - lattice.o - -plastic_isotropic.o: plastic_isotropic.f90 \ - lattice.o - -plastic_none.o: plastic_none.f90 \ - lattice.o -ifeq "$(F90)" "gfortran" -lattice.o: lattice.f90 \ - material.o - $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -ffree-line-length-240 -c lattice.f90 $(SUFFIX) -# long lines for interaction matrix -else -lattice.o: lattice.f90 \ - material.o -endif - -material.o: material.f90 \ - mesh.o - -mesh.o: mesh.f90 \ - $(wildcard meshFEM.f90) \ - FEsolving.o \ - math.o \ - FEZoo.o - $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c $(MESHNAME) -o mesh.o $(SUFFIX) - -FEsolving.o: FEsolving.f90 \ - debug.o - -math.o: math.f90 \ - debug.o - -debug.o: debug.f90 \ - numerics.o - -numerics.o: numerics.f90 \ - IO.o - -IO.o: IO.f90 \ - DAMASK_interface.o - -DAMASK_interface.o: spectral_interface.f90 \ - $(wildcard DAMASK_FEM_interface.f90) \ - prec.o - $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c $(INTERFACENAME) -o DAMASK_interface.o $(SUFFIX) - -ifeq "$(F90)" "gfortran" -prec.o: prec.f90 \ - system_routines.o - $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c prec.f90 -fno-range-check -fall-intrinsics -fno-fast-math $(SUFFIX) -# fno-range-check: Disable range checking on results of simplification of constant expressions during compilation -# --> allows the definition of DAMASK_NaN -#-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored -# and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared external -# --> allows the use of 'isnan' -#-fno-fast-math: -# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug) -else - -prec.o: prec.f90 \ - system_routines.o -endif - -system_routines.o: system_routines.f90 \ - C_routines.o - -C_routines.o: C_routines.c - - -%.o : %.f90 - $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c $< $(SUFFIX) - -%.o : %.c - $(CCOMPILERNAME) -c $< - -.PHONY: tidy -tidy: - @rm -rf *.o - @rm -rf *.mod - @rm -rf *.optrpt - @rm -rf *.inst.f90 # for instrumentation - @rm -rf *.pomp.f90 # for instrumentation - @rm -rf *.pp.f90 # for instrumentation - @rm -rf *.pdb # for instrumentation - @rm -rf *.opari.inc # for instrumentation - -.PHONY: cleanDAMASK -cleanDAMASK: - @rm -rf *.exe - @rm -rf *.marc - @rm -rf *.o - @rm -rf *.mod - @rm -rf *.optrpt - @rm -rf *.inst.f90 # for instrumentation - @rm -rf *.pomp.f90 # for instrumentation - @rm -rf *.pp.f90 # for instrumentation - @rm -rf *.pdb # for instrumentation - @rm -rf *.opari.inc # for instrumentation - -.PHONY: help -help: - F90="$(F90)" - FCOMPILERNAME="$(FCOMPILERNAME)" - COMPILEROUT="$(COMPILEROUT)" - diff --git a/examples/ConfigFiles/Phase_Dislotwin_TWIP-Steel-FeMnC.config b/examples/ConfigFiles/Phase_Dislotwin_TWIP-Steel-FeMnC.config index 2570b1b95..e7c9d4e19 100644 --- a/examples/ConfigFiles/Phase_Dislotwin_TWIP-Steel-FeMnC.config +++ b/examples/ConfigFiles/Phase_Dislotwin_TWIP-Steel-FeMnC.config @@ -50,7 +50,7 @@ interactionSlipSlip 0.122 0.122 0.625 0.07 0.137 0.122 # Interaction coefficient ### Shearband parameters ### shearbandresistance 180e6 -shearbandvelocity 1e-4 # set to zero to turn shear banding of +shearbandvelocity 0e-4 # set to zero to turn shear banding of QedgePerSbSystem 3.7e-19 # Activation energy for shear banding [J] p_shearband 1.0 # p-exponent in glide velocity q_shearband 1.0 # q-exponent in glide velocity diff --git a/examples/ConfigFiles/Phase_None_Orthorombic.config b/examples/ConfigFiles/Phase_None_Orthorombic.config index 006b0e048..d7955cf2a 100644 --- a/examples/ConfigFiles/Phase_None_Orthorombic.config +++ b/examples/ConfigFiles/Phase_None_Orthorombic.config @@ -12,4 +12,4 @@ c13 60.41e9 c23 60.41e9 c44 28.34e9 c55 28.34e9 -c66 28.34e9 \ No newline at end of file +c66 28.34e9 diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config index 6efd84f65..594c5dc22 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config @@ -18,8 +18,5 @@ tau0_slip 95.e6 97.e6 # per family, optimization long tausat_slip 222.e6 412.7e6 # per family, optimization long simplex 109 h0_slipslip 1000.0e6 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 -interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 w0_slip 2.0 (output) totalshear diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config index 89ae0339b..6e005f251 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config @@ -18,8 +18,5 @@ tau0_slip 405.8e6 456.7e6 # per family tausat_slip 872.9e6 971.2e6 # per family h0_slipslip 563.0e9 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 -interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 w0_slip 2.0 (output) totalshear diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config index fdae9c8e7..a2e06fc07 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config @@ -35,18 +35,7 @@ tausat_slip 53.00e6 # per family a_slip 1.0 gdot0_twin 0.001 n_twin 20 -tau0_twin 0 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 h0_slipslip 75e6 -h0_twinslip 0 -h0_twintwin 0 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 -interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 atol_resistance 1 diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config b/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config index 4436564cc..05503a6e7 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config @@ -29,18 +29,8 @@ a_slip 2.25 gdot0_twin 0.001 n_twin 20 tau0_twin 31e6 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 h0_slipslip 75e6 -h0_twinslip 0 -h0_twintwin 0 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 -interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 atol_resistance 1 (stiffness_degradation) damage diff --git a/examples/ConfigFiles/Source_Damage_IsoBrittle.config b/examples/ConfigFiles/Source_Damage_IsoBrittle.config index b248bb8fc..b36165ab4 100644 --- a/examples/ConfigFiles/Source_Damage_IsoBrittle.config +++ b/examples/ConfigFiles/Source_Damage_IsoBrittle.config @@ -2,4 +2,4 @@ isobrittle_criticalStrainEnergy 1400000.0 isobrittle_atol 0.01 isobrittle_N 1.0 -(output) isoBrittle_DrivingForce \ No newline at end of file +(output) isoBrittle_DrivingForce diff --git a/examples/ConfigFiles/Texture_Gauss_001.config b/examples/ConfigFiles/Texture_Gauss_001.config index 153fab381..4711c4135 100644 --- a/examples/ConfigFiles/Texture_Gauss_001.config +++ b/examples/ConfigFiles/Texture_Gauss_001.config @@ -1,2 +1,2 @@ [001] -(gauss) phi1 0.000 Phi 0.000 phi2 0.000 scatter 0.000 fraction 1.000 \ No newline at end of file +(gauss) phi1 0.000 Phi 0.000 phi2 0.000 scatter 0.000 fraction 1.000 diff --git a/examples/ConfigFiles/Texture_Gauss_101.config b/examples/ConfigFiles/Texture_Gauss_101.config index 28351eece..79457aeac 100644 --- a/examples/ConfigFiles/Texture_Gauss_101.config +++ b/examples/ConfigFiles/Texture_Gauss_101.config @@ -1,2 +1,2 @@ [101] -(gauss) phi1 0.000 Phi 45.000 phi2 90.000 scatter 0.000 fraction 1.000 \ No newline at end of file +(gauss) phi1 0.000 Phi 45.000 phi2 90.000 scatter 0.000 fraction 1.000 diff --git a/examples/ConfigFiles/Texture_Gauss_111.config b/examples/ConfigFiles/Texture_Gauss_111.config index e4dc139f8..8204bfb69 100644 --- a/examples/ConfigFiles/Texture_Gauss_111.config +++ b/examples/ConfigFiles/Texture_Gauss_111.config @@ -1,2 +1,2 @@ [111] -(gauss) phi1 0.000 Phi 54.7356 phi2 45.000 scatter 0.000 fraction 1.000 \ No newline at end of file +(gauss) phi1 0.000 Phi 54.7356 phi2 45.000 scatter 0.000 fraction 1.000 diff --git a/examples/ConfigFiles/Texture_Gauss_123.config b/examples/ConfigFiles/Texture_Gauss_123.config index 374674e09..32d28442f 100644 --- a/examples/ConfigFiles/Texture_Gauss_123.config +++ b/examples/ConfigFiles/Texture_Gauss_123.config @@ -1,2 +1,2 @@ [123] -(gauss) phi1 209.805 Phi 29.206 phi2 63.435 scatter 0.000 fraction 1.000 \ No newline at end of file +(gauss) phi1 209.805 Phi 29.206 phi2 63.435 scatter 0.000 fraction 1.000 diff --git a/examples/ConfigFiles/Texture_RandomSingleCrystals.config b/examples/ConfigFiles/Texture_RandomSingleCrystals.config index fac65ae20..6e1f98a3d 100644 --- a/examples/ConfigFiles/Texture_RandomSingleCrystals.config +++ b/examples/ConfigFiles/Texture_RandomSingleCrystals.config @@ -1,2 +1,2 @@ [RandomSingleCrystals] -(random) scatter 0.000 fraction 1.000 \ No newline at end of file +(random) scatter 0.000 fraction 1.000 diff --git a/examples/MSC.Marc/material.config b/examples/MSC.Marc/material.config index c9c23ba84..92a3ed38e 100644 --- a/examples/MSC.Marc/material.config +++ b/examples/MSC.Marc/material.config @@ -2,7 +2,7 @@ #-------------------# -{../../code/config/Homogenization_None_Dummy.config} +{../ConfigFiles/Homogenization_None_Dummy.config} #-------------------# @@ -524,12 +524,12 @@ crystallite 1 #-------------------# -{../../code/config/Crystallite_All.config} +{../ConfigFiles/Crystallite_All.config} #-------------------# #-------------------# -{../../code/config/Phase_Phenopowerlaw_Aluminum.config} +{../ConfigFiles/Phase_Phenopowerlaw_Aluminum.config} -{../../code/config/Phase_J2_AluminumIsotropic.config} +{../ConfigFiles/Phase_Isotropic_AluminumIsotropic.config} diff --git a/examples/SpectralMethod/material.config b/examples/SpectralMethod/material.config index 14437c5d8..978e0f511 100644 --- a/examples/SpectralMethod/material.config +++ b/examples/SpectralMethod/material.config @@ -52,22 +52,8 @@ n_slip 20 tau0_slip 31e6 # per family tausat_slip 63e6 # per family a_slip 2.25 -gdot0_twin 0.001 -n_twin 20 -tau0_twin 31e6 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 h0_slipslip 75e6 -h0_sliptwin 0 -h0_twinslip 0 -h0_twintwin 0 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 -interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 atol_resistance 1 diff --git a/installation/mods_Abaqus/abaqus_v6.env b/installation/mods_Abaqus/abaqus_v6.env index fd9f2ed51..0bc5063a1 100644 --- a/installation/mods_Abaqus/abaqus_v6.env +++ b/installation/mods_Abaqus/abaqus_v6.env @@ -31,7 +31,7 @@ fortCmd = "ifort" # -integer-size 32 -DINT=4 assume size of integer to be 4 bytes, matches our definition of pInt compile_fortran = (fortCmd + " -c -fPIC -auto -shared-intel " + - "-I%I -I../lib -free -O1 -fpp -openmp " + + "-I%I -free -O1 -fpp -openmp " + "-ftz -diag-disable 5268 " + "-implicitnone -assume byterecl -stand f08 -standard-semantics " + "-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4 " + @@ -58,4 +58,4 @@ ask_delete=OFF # Remove the temporary names from the namespace del fortCmd - +del DAMASKVERSION diff --git a/installation/mods_Abaqus/abaqus_v6_serial.env b/installation/mods_Abaqus/abaqus_v6_serial.env index f1a6b2208..0469dc5f9 100644 --- a/installation/mods_Abaqus/abaqus_v6_serial.env +++ b/installation/mods_Abaqus/abaqus_v6_serial.env @@ -31,7 +31,7 @@ fortCmd = "ifort" # -integer-size 32 -DINT=4 assume size of integer to be 4 bytes, matches our definition of pInt compile_fortran = (fortCmd + " -c -fPIC -auto -shared-intel " + - "-I%I -I../lib -free -O1 -fpp " + + "-I%I -free -O1 -fpp " + "-ftz -diag-disable 5268 " + "-implicitnone -assume byterecl -stand f08 -standard-semantics " + "-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4 " + @@ -58,4 +58,4 @@ ask_delete=OFF # Remove the temporary names from the namespace del fortCmd - +del DAMASKVERSION diff --git a/installation/mods_MarcMentat/2015/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2015/Marc_tools/include_linux64 index 9b1e2bec7..0a315f85b 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/include_linux64 +++ b/installation/mods_MarcMentat/2015/Marc_tools/include_linux64 @@ -442,20 +442,13 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" # determine DAMASK version -HIT=0 -for arg in "$@" -do - if [ $HIT = 1 ] - then - DAMASKPATH=`dirname $arg` - break - elif [ ${arg:0:2} = -u -o ${arg:0:2} = -U ] - then - HIT=1 - fi -done -read DAMASKVERSION < $DAMASKPATH/../VERSION -DAMASKVERSION="'"$DAMASKVERSION"'" +if test -n "$DAMASK_USER"; then + DAMASKROOT=`dirname $DAMASK_USER`/.. + read DAMASKVERSION < $DAMASKROOT/VERSION + DAMASKVERSION="'"$DAMASKVERSION"'" +else + DAMASKVERSION="'N/A'" +fi # DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3 DFORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask b/installation/mods_MarcMentat/2015/Marc_tools/run_damask index 5286ccfa0..ef792247a 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask @@ -299,6 +299,20 @@ 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 # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_h b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_h index 5ed49f3a2..b77e80157 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_h +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_h @@ -299,6 +299,20 @@ 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 # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_hmp b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_hmp index 3e3053f04..270e78f17 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_hmp +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_hmp @@ -299,6 +299,20 @@ 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 # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_l b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_l index 86d5464bd..87c63f05a 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_l +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_l @@ -299,6 +299,20 @@ 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 # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_lmp b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_lmp index 5fe65b829..9c10c5229 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_lmp +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_lmp @@ -299,6 +299,20 @@ 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 # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_mp b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_mp index 1e3eadf37..5f34b18f5 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_mp +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_mp @@ -299,6 +299,20 @@ 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 # diff --git a/installation/mods_MarcMentat/2016/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2016/Marc_tools/include_linux64 index 39562d9d0..a6cc7e2f9 100644 --- a/installation/mods_MarcMentat/2016/Marc_tools/include_linux64 +++ b/installation/mods_MarcMentat/2016/Marc_tools/include_linux64 @@ -452,10 +452,10 @@ fi FORT_OPT="-c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -mp1 -WB -fp-model source" if test "$MTHREAD" = "OPENMP" then - FORT_OPT=" $FORT_OPT -openmp" + FORT_OPT=" $FORT_OPT -qopenmp" if test "$OMP_COMPAT" = "YES" then - FORT_OPT=" $FORT_OPT -openmp-threadprivate=compat" + FORT_OPT=" $FORT_OPT -qopenmp-threadprivate=compat" fi else # FORT_OPT=" $FORT_OPT -auto " @@ -471,21 +471,14 @@ FORTHIGH="$FCOMP $FORT_OPT $PROFILE -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/comm FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - # determine DAMASK version -HIT=0 -for arg in "$@" -do - if [ $HIT = 1 ] - then - DAMASKPATH=`dirname $arg` - break - elif [ ${arg:0:2} = -u -o ${arg:0:2} = -U ] - then - HIT=1 - fi -done -read DAMASKVERSION < $DAMASKPATH/../VERSION -DAMASKVERSION="'"$DAMASKVERSION"'" +# 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: additional flags are in line 2 OpenMP flags in line 3 DFORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ @@ -493,21 +486,21 @@ DFORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTRAN="$FCOMP $FORT_OPT $PROFILE -O1 $I8FFLAGS -I$MARC_SOURCE/common \ -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTHIGH="$FCOMP $FORT_OPT $PROFILE -fno-alias -O2 $I8FFLAGS -I$MARC_SOURCE/common \ -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias -O2 $I8FFLAGS -I$MARC_SOURCE/common \ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" if test "$MARCDEBUG" = "ON" @@ -527,21 +520,21 @@ then -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -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=2016 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTRAN="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \ -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -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=2016 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTHIGH="$FCOMP $FORT_OPT $PROFILE -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" fi @@ -726,7 +719,7 @@ else SFLIB=" " fi -OPENMP="-openmp" +OPENMP="-qopenmp" SYSLIBS=" $OPENMP -lpthread " diff --git a/installation/mods_MarcMentat/2016/Marc_tools/run_damask b/installation/mods_MarcMentat/2016/Marc_tools/run_damask index e3d746b55..0fc2e639a 100644 --- a/installation/mods_MarcMentat/2016/Marc_tools/run_damask +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask @@ -299,7 +299,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 + # # diff --git a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_h b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_h index 9ca45c335..182b5fc25 100644 --- a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_h +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_h @@ -299,7 +299,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 + # # diff --git a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_hmp b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_hmp index 7af233017..69aa8d652 100644 --- a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_hmp +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_hmp @@ -299,7 +299,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 + # # diff --git a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_l b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_l index 579c49856..87cd1e5c6 100644 --- a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_l +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_l @@ -299,7 +299,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 + # # diff --git a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_lmp b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_lmp index 72348a618..227ac1110 100644 --- a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_lmp +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_lmp @@ -299,7 +299,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 + # # diff --git a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_mp b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_mp index 7e1d7265d..03cf4b951 100644 --- a/installation/mods_MarcMentat/2016/Marc_tools/run_damask_mp +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_mp @@ -299,7 +299,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 + # # diff --git a/installation/mods_MarcMentat/apply_DAMASK_modifications.sh b/installation/mods_MarcMentat/apply_DAMASK_modifications.sh index f52b70e36..761883de5 100755 --- a/installation/mods_MarcMentat/apply_DAMASK_modifications.sh +++ b/installation/mods_MarcMentat/apply_DAMASK_modifications.sh @@ -25,6 +25,7 @@ do if [ -z "$VERSION" ]; then VERSION=${DEFAULT_VERSION} fi + [[ -d "$SCRIPTLOCATION/$VERSION" ]] || echo -e "$VERSION not supported..!\n" done echo "MSC version: $VERSION" @@ -35,6 +36,7 @@ do if [ -z "$INSTALLDIR" ]; then INSTALLDIR=${DEFAULT_DIR} fi + [[ -d "$INSTALLDIR" ]] || echo -e "$INSTALLDIR not found..!\n" done INSTALLDIR=${INSTALLDIR%/} # remove trailing slash @@ -54,7 +56,7 @@ echo "Editor: $EDITOR" # tools echo '' -echo 'copying Marc tools...' +echo 'adapting Marc tools...' theDIR=$INSTALLDIR/marc$VERSION/tools for filename in 'comp_damask' \ 'comp_damask_l' \ @@ -77,7 +79,7 @@ done # Mentat scripts echo '' -echo 'copying Mentat scripts...' +echo 'adapting Mentat scripts...' theDIR=$INSTALLDIR/mentat$VERSION/bin for filename in 'edit_window' \ 'submit4' \ @@ -101,7 +103,7 @@ done # Mentat scripts echo '' -echo 'copying Mentat menus...' +echo 'adapting Mentat menus...' theDIR=$INSTALLDIR/mentat$VERSION/menus for filename in 'job_run.ms'; do cp $SCRIPTLOCATION/$VERSION/Mentat_menus/$filename $theDIR @@ -112,16 +114,20 @@ done # compile menus echo '' -echo 'compiling menus...' -$INSTALLDIR/mentat$VERSION/bin/mentat -compile $INSTALLDIR/mentat$VERSION/menus/linux64/main.msb +echo 'compiling Mentat menu binaries...' +$(which xvfb-run 2>/dev/null) $INSTALLDIR/mentat$VERSION/bin/mentat -compile $INSTALLDIR/mentat$VERSION/menus/linux64/main.msb +[[ $? != 0 ]] && echo '...failed. Try installing xvfb-run on your system.' # setting access rights echo '' echo 'setting file access rights...' -chmod 755 $INSTALLDIR/marc$VERSION/tools/run_damask* -chmod 755 $INSTALLDIR/marc$VERSION/tools/comp_damask* -chmod 755 $INSTALLDIR/mentat$VERSION/bin/submit{4..9} -chmod 755 $INSTALLDIR/mentat$VERSION/bin/kill{4..9} +for filename in marc$VERSION/tools/run_damask* \ + marc$VERSION/tools/comp_damask* \ + mentat$VERSION/bin/submit{4..9} \ + mentat$VERSION/bin/kill{4..9} \ + + chmod 755 $INSTALLDIR/${filename} +done #creating symlinks for run_damask_scripts in /usr/local/bin @@ -152,5 +158,15 @@ if [ -d "$BIN_DIR" ]; then esac fi +# cloning user subroutine +echo '' +echo 'cloning $VERSION HYPELA2 user subroutine...' +ln -s DAMASK_marc.f90 ${DAMASK_ROOT}/src/DAMASK_marc${VERSION}.f90 + +# precompiling user subroutine +echo '' +echo 'precompiling $VERSION HYPELA2 user subroutine...' +echo 'not yet implemented..!' + echo '' echo 'done.' diff --git a/installation/patch/README.md b/installation/patch/README.md index 86ed44f0d..f5b9f9706 100644 --- a/installation/patch/README.md +++ b/installation/patch/README.md @@ -13,5 +13,3 @@ patch -p1 < installation/patch/nameOfPatch * **fwbw_derivative** switches the default spatial derivative from continuous to forward/backward difference. This generally reduces spurious oscillations in the result as the spatial accuracy of the derivative is then compatible with the underlying solution grid. - * **petsc3.7** adapts to API changes introduced between PETSc 3.6.x and 3.7.x for setting PETSc options. - Use this patch if your system runs PETSc 3.7.x. diff --git a/installation/patch/petsc3.7 b/installation/patch/petsc3.7 deleted file mode 100644 index b5fd696fb..000000000 --- a/installation/patch/petsc3.7 +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/code/spectral_utilities.f90 b/code/spectral_utilities.f90 -index 34eb0ea..a33c7a9 100644 ---- a/code/spectral_utilities.f90 -+++ b/code/spectral_utilities.f90 -@@ -227,12 +227,13 @@ subroutine utilities_init() - trim(PETScDebug), & - ' add more using the PETSc_Options keyword in numerics.config '; flush(6) - -- call PetscOptionsClear(ierr); CHKERRQ(ierr) -- if(debugPETSc) call PetscOptionsInsertString(trim(PETSCDEBUG),ierr) -+ call PetscOptionsClear(PETSC_NULL_OBJECT,ierr) - CHKERRQ(ierr) -- call PetscOptionsInsertString(trim(petsc_defaultOptions),ierr) -+ if(debugPETSc) call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(PETSCDEBUG),ierr) - CHKERRQ(ierr) -- call PetscOptionsInsertString(trim(petsc_options),ierr) -+ call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(petsc_defaultOptions),ierr) -+ CHKERRQ(ierr) -+ call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(petsc_options),ierr) - CHKERRQ(ierr) - - grid1Red = grid(1)/2_pInt + 1_pInt diff --git a/installation/symlink_Code.py b/installation/symlink_Code.py deleted file mode 100755 index c215a841e..000000000 --- a/installation/symlink_Code.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python2.7 -# -*- coding: UTF-8 no BOM -*- - -import os,sys -import damask - -bin_link = { \ - '.' : [ - 'DAMASK_spectral.exe', - 'DAMASK_FEM.exe' - ], - } - -MarcReleases =[ \ - '2014', - '2014.2', - '2015', - '2016' - ] - -damaskEnv = damask.Environment() -baseDir = damaskEnv.relPath('code/') -binDir = damaskEnv.options['DAMASK_BIN'] - -if not os.path.isdir(binDir): - os.mkdir(binDir) - -sys.stdout.write('\nsymbolic linking...\n') - -for subDir in bin_link: - theDir = os.path.abspath(os.path.join(baseDir,subDir)) - sys.stdout.write('\n'+binDir+' ->\n'+theDir+damask.util.deemph(' ...')+'\n') - - for theFile in bin_link[subDir]: - theName,theExt = os.path.splitext(theFile) - src = os.path.abspath(os.path.join(theDir,theFile)) - - if os.path.exists(src): - sym_link = os.path.abspath(os.path.join(binDir,subDir if theFile == '' else theName)) - - if os.path.lexists(sym_link): - os.remove(sym_link) - output = theName+damask.util.deemph(theExt) - else: - output = damask.util.emph(theName)+damask.util.deemph(theExt) - - sys.stdout.write(damask.util.deemph('... ')+output+'\n') - os.symlink(src,sym_link) - - -sys.stdout.write('\nMSC.Marc versioning...\n\n') -theMaster = 'DAMASK_marc.f90' - -for version in MarcReleases: - src = os.path.abspath(os.path.join(baseDir,theMaster)) - if os.path.exists(src): - sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc{}.f90'.format(version))) - if os.path.lexists(sym_link): - os.remove(sym_link) - output = version - else: - output = damask.util.emph(version) - - sys.stdout.write(' '+output+'\n') - os.symlink(theMaster,sym_link) diff --git a/lib/damask/__init__.py b/lib/damask/__init__.py index c71d50a94..1875ffdae 100644 --- a/lib/damask/__init__.py +++ b/lib/damask/__init__.py @@ -1,7 +1,13 @@ # -*- coding: UTF-8 no BOM -*- """Main aggregator""" -import os +import os,sys,time + +h5py_flag = os.path.join(os.path.dirname(__file__),'../../.noH5py') +h5py_grace = 7200 # only complain once every 7200 sec (2 hours) +h5py_msg = "h5py module not found." + +now = time.time() with open(os.path.join(os.path.dirname(__file__),'../../VERSION')) as f: version = f.readline()[:-1] @@ -9,9 +15,18 @@ with open(os.path.join(os.path.dirname(__file__),'../../VERSION')) as f: from .environment import Environment # noqa from .asciitable import ASCIItable # noqa try: - from .h5table import H5Table # noqa + from .h5table import H5Table # noqa + if os.path.exists(h5py_flag): os.remove(h5py_flag) # delete flagging file on success except ImportError: - print("h5py module not found") + if os.path.exists(h5py_flag): + if now - os.path.getmtime(h5py_flag) > h5py_grace: # complain (again) every so-and-so often + sys.stderr.write(h5py_msg+'\n') + with open(h5py_flag, 'a'): + os.utime(h5py_flag,(now,now)) # update flag modification time to "now" + else: + open(h5py_flag, 'a').close() # create flagging file + sys.stderr.write(h5py_msg+'\n') # complain for the first time + from .config import Material # noqa from .colormaps import Colormap, Color # noqa from .orientation import Quaternion, Rodrigues, Symmetry, Orientation # noqa diff --git a/lib/damask/asciitable.py b/lib/damask/asciitable.py index 771ae76a5..446770313 100644 --- a/lib/damask/asciitable.py +++ b/lib/damask/asciitable.py @@ -547,7 +547,10 @@ class ASCIItable(): except: output = [fmt % row] if fmt else [repr(row)] - self.__IO__['out'].write(delimiter.join(output) + '\n') + try: + self.__IO__['out'].write(delimiter.join(output) + '\n') + except: + pass # ------------------------------------------------------------------ def data_append(self, diff --git a/lib/damask/environment.py b/lib/damask/environment.py index a37f9dc5c..6ec0bff79 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -33,7 +33,7 @@ class Environment(): 'explicit':5} if Nneeded == -1: Nneeded = licensesNeeded[software] try: - cmd = """ ssh mulicense2 "/Stat_Flexlm | grep 'Users of %s: ' | cut -d' ' -f7,13" """%software + cmd = """ ssh mulicense2 "/lm-status | grep 'Users of %s: ' | cut -d' ' -f7,13" """%software process = subprocess.Popen(shlex.split(cmd),stdout = subprocess.PIPE,stderr = subprocess.PIPE) licenses = list(map(int, process.stdout.readline().split())) try: diff --git a/lib/damask/solver/abaqus.py b/lib/damask/solver/abaqus.py index c1777b4bf..04c626eea 100644 --- a/lib/damask/solver/abaqus.py +++ b/lib/damask/solver/abaqus.py @@ -2,6 +2,7 @@ from .solver import Solver import damask +import subprocess,re class Abaqus(Solver): @@ -20,8 +21,6 @@ class Abaqus(Solver): raise Exception('unknown Abaqus solver %'%solver) def return_run_command(self,model): - import subprocess - import re env=damask.Environment() shortVersion = re.sub('[\.,-]', '',self.version) try: @@ -33,4 +32,4 @@ class Abaqus(Solver): detectedVersion = process.stdout.readlines()[1].split()[1] if self.version != detectedVersion: raise Exception('found Abaqus version %s, but requested %s'%(detectedVersion,self.version)) - return '%s -job %s -user %s/code/DAMASK_abaqus_%s interactive'%(cmd,model,env.rootDir(),self.solver) + return '%s -job %s -user %s/src/DAMASK_abaqus_%s interactive'%(cmd,model,env.rootDir(),self.solver) diff --git a/lib/damask/solver/marc.py b/lib/damask/solver/marc.py index 873d08cdb..16f3c8451 100644 --- a/lib/damask/solver/marc.py +++ b/lib/damask/solver/marc.py @@ -13,9 +13,6 @@ class Marc(Solver): '2015': ['linux64',''], '2014.2':['linux64',''], '2014' :['linux64',''], - '2013.1':['linux64',''], - '2013': ['linux64',''], - '2012': ['linux64',''], } @@ -86,13 +83,13 @@ class Marc(Solver): damaskEnv = damask.environment.Environment() - user = os.path.join(damaskEnv.relPath('code/'),'DAMASK_marc') # might be updated if special version (symlink) is found + user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc') # might be updated if special version (symlink) is found if compile: - if os.path.isfile(os.path.join(damaskEnv.relPath('code/'),'DAMASK_marc%s.f90'%release)): - user = os.path.join(damaskEnv.relPath('code/'),'DAMASK_marc%s'%release) + if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s.f90'%release)): + user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s'%release) else: - if os.path.isfile(os.path.join(damaskEnv.relPath('code/'),'DAMASK_marc%s.marc'%release)): - user = os.path.join(damaskEnv.relPath('code/'),'DAMASK_marc%s'%release) + if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s.marc'%release)): + user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s'%release) # Define options [see Marc Installation and Operation Guide, pp 23] script = 'run_damask%s'%({False:'',True:'_'}[optimization!='' or openMP]) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index 5445ee443..1bb80a939 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -74,6 +74,10 @@ class Test(): ) + def variantName(self,variant): + """Generate name of (numerical) variant.""" + return str(variant) + def execute(self): """Run all variants and report first failure.""" if not self.options.keep: @@ -81,7 +85,8 @@ class Test(): self.clean() self.prepareAll() - for variant,name in enumerate(self.variants): + for variant,object in enumerate(self.variants): + name = self.variantName(variant) if self.options.show: logging.critical('{}: {}'.format(variant+1,name)) elif self.options.select is not None \ @@ -203,58 +208,63 @@ class Test(): shutil.copy2(source,target) except: logging.critical('error copying {} to {}'.format(source,target)) + raise def copy_Reference2Current(self,sourcefiles=[],targetfiles=[]): if len(targetfiles) == 0: targetfiles = sourcefiles - for i,file in enumerate(sourcefiles): + for i,f in enumerate(sourcefiles): try: - shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInReference(f),self.fileInCurrent(targetfiles[i])) except: - logging.critical('Reference2Current: Unable to copy file "{}"'.format(file)) + logging.critical('Reference2Current: Unable to copy file "{}"'.format(f)) + raise def copy_Base2Current(self,sourceDir,sourcefiles=[],targetfiles=[]): source=os.path.normpath(os.path.join(self.dirBase,'../../..',sourceDir)) if len(targetfiles) == 0: targetfiles = sourcefiles - for i,file in enumerate(sourcefiles): + for i,f in enumerate(sourcefiles): try: - shutil.copy2(os.path.join(source,file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(os.path.join(source,f),self.fileInCurrent(targetfiles[i])) except: - logging.error(os.path.join(source,file)) - logging.critical('Base2Current: Unable to copy file "{}"'.format(file)) + logging.error(os.path.join(source,f)) + logging.critical('Base2Current: Unable to copy file "{}"'.format(f)) + raise def copy_Current2Reference(self,sourcefiles=[],targetfiles=[]): if len(targetfiles) == 0: targetfiles = sourcefiles - for i,file in enumerate(sourcefiles): + for i,f in enumerate(sourcefiles): try: - shutil.copy2(self.fileInCurrent(file),self.fileInReference(targetfiles[i])) + shutil.copy2(self.fileInCurrent(f),self.fileInReference(targetfiles[i])) except: - logging.critical('Current2Reference: Unable to copy file "{}"'.format(file)) + logging.critical('Current2Reference: Unable to copy file "{}"'.format(f)) + raise def copy_Proof2Current(self,sourcefiles=[],targetfiles=[]): if len(targetfiles) == 0: targetfiles = sourcefiles - for i,file in enumerate(sourcefiles): + for i,f in enumerate(sourcefiles): try: - shutil.copy2(self.fileInProof(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInProof(f),self.fileInCurrent(targetfiles[i])) except: - logging.critical('Proof2Current: Unable to copy file "{}"'.format(file)) + logging.critical('Proof2Current: Unable to copy file "{}"'.format(f)) + raise def copy_Current2Current(self,sourcefiles=[],targetfiles=[]): - for i,file in enumerate(sourcefiles): + for i,f in enumerate(sourcefiles): try: - shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInReference(f),self.fileInCurrent(targetfiles[i])) except: - logging.critical('Current2Current: Unable to copy file "{}"'.format(file)) - + logging.critical('Current2Current: Unable to copy file "{}"'.format(f)) + raise def execute_inCurrentDir(self,cmd,streamIn=None): diff --git a/lib/damask/util.py b/lib/damask/util.py index 1baaaaea8..54de9acf9 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -52,7 +52,7 @@ def croak(what, newline = True): def report(who = None, what = None): """Reports script and file name""" - croak( (emph(who)+': ' if who else '') + (what if what else '') ) + croak( (emph(who)+': ' if who is not None else '') + (what if what is not None else '') ) # ----------------------------- diff --git a/misc/DAMASK favicon.ico b/misc/DAMASK_Favicon.ico similarity index 100% rename from misc/DAMASK favicon.ico rename to misc/DAMASK_Favicon.ico diff --git a/misc/DAMASK_Logo_large.png b/misc/DAMASK_Favicon.png similarity index 100% rename from misc/DAMASK_Logo_large.png rename to misc/DAMASK_Favicon.png diff --git a/misc/DAMASK.png b/misc/DAMASK_LogoLarge.png similarity index 100% rename from misc/DAMASK.png rename to misc/DAMASK_LogoLarge.png diff --git a/misc/DAMASK_Logo.png b/misc/DAMASK_LogoSmall.png similarity index 100% rename from misc/DAMASK_Logo.png rename to misc/DAMASK_LogoSmall.png diff --git a/processing/post/addDisplacement.py b/processing/post/addDisplacement.py index 611e21db2..bc1d7377b 100755 --- a/processing/post/addDisplacement.py +++ b/processing/post/addDisplacement.py @@ -128,7 +128,8 @@ for name in filenames: outname = outname, buffered = False) except: continue - damask.util.report(scriptName,'{}{}'.format(name,' --> {}'.format(outname) if outname else '')) + damask.util.report(scriptName,'{}{}'.format(name if name else '', + ' --> {}'.format(outname) if outname else '')) # ------------------------------------------ read header ------------------------------------------ diff --git a/processing/post/binXY.py b/processing/post/binXY.py index 819e07df5..aac9aaffa 100755 --- a/processing/post/binXY.py +++ b/processing/post/binXY.py @@ -89,15 +89,13 @@ if options.weight is not None: labels += [options.weight] if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - outname = os.path.join(os.path.dirname(name), - 'binned-{}-{}_'.format(*options.data)+ \ - ('weighted-{}_'.format(options.weight) if options.weight else '') + \ - os.path.basename(name)) if name else name, - buffered = False) - except: - continue + try: table = damask.ASCIItable(name = name, + outname = os.path.join(os.path.dirname(name), + 'binned-{}-{}_'.format(*options.data) + + ('weighted-{}_'.format(options.weight) if options.weight else '') + + os.path.basename(name)) if name else name, + buffered = False) + except: continue damask.util.report(scriptName,name) # ------------------------------------------ read header ------------------------------------------ diff --git a/processing/post/postResults.py b/processing/post/postResults.py index a3501bc81..23550e980 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -851,7 +851,7 @@ for opt in ['nodalScalar','elemScalar','elemTensor','homogenizationResult','crys if options.info: if options.filetype == 'marc': - print('\n\nMentat release {}'.format(damask.solver.Marc().version('../../'))) + print('\n\nMentat release {}'.format(damask.solver.Marc().version())) if options.filetype == 'spectral': print('\n\n{}'.format(p)) diff --git a/processing/pre/geom_addPrimitive.py b/processing/pre/geom_addPrimitive.py index 8d934368f..607e5facd 100755 --- a/processing/pre/geom_addPrimitive.py +++ b/processing/pre/geom_addPrimitive.py @@ -9,8 +9,6 @@ import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) -oversampling = 2. - #-------------------------------------------------------------------------------------------------- # MAIN #-------------------------------------------------------------------------------------------------- @@ -33,40 +31,49 @@ Depending on the sign of the dimension parameters, these objects can be boxes, c """, version = scriptID) -parser.add_option('-c', '--center', dest='center', type='int', nargs = 3, metavar=' '.join(['int']*3), +parser.add_option('-c', '--center', dest='center', type='float', nargs = 3, metavar=' '.join(['float']*3), help='a,b,c origin of primitive %default') -parser.add_option('-d', '--dimension', dest='dimension', type='int', nargs = 3, metavar=' '.join(['int']*3), +parser.add_option('-d', '--dimension', dest='dimension', type='float', nargs = 3, metavar=' '.join(['float']*3), help='a,b,c extension of hexahedral box; negative values are diameters') +parser.add_option('-e', '--exponent', dest='exponent', type='float', nargs = 3, metavar=' '.join(['float']*3), + help='i,j,k exponents for axes - 2 gives a sphere (x^2 + y^2 + z^2 < 1), 1 makes \ +octahedron (|x| + |y| + |z| < 1). Large values produce boxes, 0 - 1 is concave. ') parser.add_option('-f', '--fill', dest='fill', type='int', metavar = 'int', help='grain index to fill primitive. "0" selects maximum microstructure index + 1 [%default]') parser.add_option('-q', '--quaternion', dest='quaternion', type='float', nargs = 4, metavar=' '.join(['float']*4), help = 'rotation of primitive as quaternion') parser.add_option('-a', '--angleaxis', dest='angleaxis', nargs = 4, metavar=' '.join(['float']*4), - help = 'rotation of primitive as angle and axis') + help = 'angle,x,y,z clockwise rotation of primitive about axis by angle') parser.add_option( '--degrees', dest='degrees', action='store_true', help = 'angle is given in degrees [%default]') - -parser.set_defaults(center = [0,0,0], +parser.add_option( '--nonperiodic', dest='periodic', action='store_false', + help = 'wrap around edges [%default]') +parser.add_option( '--voxelspace', dest='voxelspace', action='store_true', + help = '-c and -d are given in (0 to grid) coordinates instead of (origin to origin+size) \ +coordinates [%default]') +parser.set_defaults(center = (.0,.0,.0), fill = 0, - quaternion = [], - angleaxis = [], degrees = False, + exponent = (1e10,1e10,1e10), # box shape by default + periodic = True, + voxelspace = False ) (options, filenames) = parser.parse_args() - -if options.angleaxis != []: +if options.dimension is None: + parser.error('no dimension specified.') +if options.angleaxis is not None: options.angleaxis = map(float,options.angleaxis) rotation = damask.Quaternion().fromAngleAxis(np.radians(options.angleaxis[0]) if options.degrees else options.angleaxis[0], - options.angleaxis[1:4]).conjugated() -elif options.quaternion != []: + options.angleaxis[1:4]) +elif options.quaternion is not None: options.quaternion = map(float,options.quaternion) - rotation = damask.Quaternion(options.quaternion).conjugated() + rotation = damask.Quaternion(options.quaternion) else: - rotation = damask.Quaternion().conjugated() + rotation = damask.Quaternion() options.center = np.array(options.center) -invRotation = rotation.conjugated() # rotation of gridpos into primitive coordinate system +options.dimension = np.array(options.dimension) # --- loop over input files ------------------------------------------------------------------------- if filenames == []: filenames = [None] @@ -108,33 +115,92 @@ for name in filenames: 'microstructures': 0, } - if options.fill == 0: options.fill = microstructure.max()+1 - + + # If we have a negative dimension, make it an ellipsoid for backwards compatibility + options.exponent = np.where(np.array(options.dimension) > 0, options.exponent, 2) microstructure = microstructure.reshape(info['grid'],order='F') + + # coordinates given in real space (default) vs voxel space + if not options.voxelspace: + options.center += info['origin'] + options.center *= np.array(info['grid']) / np.array(info['size']) + options.dimension *= np.array(info['grid']) / np.array(info['size']) - if options.dimension is not None: - mask = (np.array(options.dimension) < 0).astype(float) # zero where positive dimension, otherwise one - dim = abs(np.array(options.dimension)) # dimensions of primitive body - pos = np.zeros(3,dtype='float') -# hiresPrimitive = np.zeros((2*dim[0],2*dim[1],2*dim[2],3)) # primitive discretized at twice the grid resolution - for i,pos[0] in enumerate(np.arange(-dim[0]/oversampling,(dim[0]+1)/oversampling,1./oversampling)): - for j,pos[1] in enumerate(np.arange(-dim[1]/oversampling,(dim[1]+1)/oversampling,1./oversampling)): - for k,pos[2] in enumerate(np.arange(-dim[2]/oversampling,(dim[2]+1)/oversampling,1./oversampling)): - gridpos = np.floor(rotation*pos) # rotate and lock into spacial grid - primPos = invRotation*gridpos # rotate back to primitive coordinate system - if np.dot(mask*primPos/dim,mask*primPos/dim) <= 0.25 and \ - np.all(abs((1.-mask)*primPos/dim) <= 0.5): # inside ellipsoid and inside box - microstructure[int((gridpos[0]+options.center[0])%info['grid'][0]), - int((gridpos[1]+options.center[1])%info['grid'][1]), - int((gridpos[2]+options.center[2])%info['grid'][2])] = options.fill # assign microstructure index + size = microstructure.shape + # change to coordinate space where the primitive is the unit sphere/cube/etc + if options.periodic: # use padding to achieve periodicity + (X, Y, Z) = np.meshgrid(np.arange(-size[0]/2, (3*size[0])/2, dtype=np.float32), # 50% padding on each side + np.arange(-size[1]/2, (3*size[1])/2, dtype=np.float32), + np.arange(-size[2]/2, (3*size[2])/2, dtype=np.float32), + indexing='ij') + # Padding handling + X = np.roll(np.roll(np.roll(X, + -size[0]/2, axis=0), + -size[1]/2, axis=1), + -size[2]/2, axis=2) + Y = np.roll(np.roll(np.roll(Y, + -size[0]/2, axis=0), + -size[1]/2, axis=1), + -size[2]/2, axis=2) + Z = np.roll(np.roll(np.roll(Z, + -size[0]/2, axis=0), + -size[1]/2, axis=1), + -size[2]/2, axis=2) + else: # nonperiodic, much lighter on resources + # change to coordinate space where the primitive is the unit sphere/cube/etc + (X, Y, Z) = np.meshgrid(np.arange(0, size[0], dtype=np.float32), + np.arange(0, size[1], dtype=np.float32), + np.arange(0, size[2], dtype=np.float32), + indexing='ij') + + # first by translating the center onto 0, 0.5 shifts the voxel origin onto the center of the voxel + X -= options.center[0] - 0.5 + Y -= options.center[1] - 0.5 + Z -= options.center[2] - 0.5 + # and then by applying the quaternion + # this should be rotation.conjugate() * (X,Y,Z), but it is this way for backwards compatibility with the older version of this script + (X, Y, Z) = rotation * (X, Y, Z) + # and finally by scaling (we don't worry about options.dimension being negative, np.abs occurs on the microstructure = np.where... line) + X /= options.dimension[0] * 0.5 + Y /= options.dimension[1] * 0.5 + Z /= options.dimension[2] * 0.5 + + + # High exponents can cause underflow & overflow - loss of precision is okay here, we just compare it to 1, so +infinity and 0 are fine + old_settings = np.seterr() + np.seterr(over='ignore', under='ignore') + + if options.periodic: # use padding to achieve periodicity + inside = np.zeros(size, dtype=bool) + for i in range(2): + for j in range(2): + for k in range(2): + inside = inside | ( # Most of this is handling the padding + np.abs(X[size[0] * i : size[0] * (i+1), + size[1] * j : size[1] * (j+1), + size[2] * k : size[2] * (k+1)])**options.exponent[0] + + np.abs(Y[size[0] * i : size[0] * (i+1), + size[1] * j : size[1] * (j+1), + size[2] * k : size[2] * (k+1)])**options.exponent[1] + + np.abs(Z[size[0] * i : size[0] * (i+1), + size[1] * j : size[1] * (j+1), + size[2] * k : size[2] * (k+1)])**options.exponent[2] < 1) + + microstructure = np.where(inside, options.fill, microstructure) + + else: # nonperiodic, much lighter on resources + microstructure = np.where(np.abs(X)**options.exponent[0] + + np.abs(Y)**options.exponent[1] + + np.abs(Z)**options.exponent[2] < 1, options.fill, microstructure) + + np.seterr(**old_settings) # Reset warnings to old state newInfo['microstructures'] = microstructure.max() - # --- report --------------------------------------------------------------------------------------- - if ( newInfo['microstructures'] != info['microstructures']): + if (newInfo['microstructures'] != info['microstructures']): damask.util.croak('--> microstructures: %i'%newInfo['microstructures']) diff --git a/processing/pre/geom_fromVPSC.py b/processing/pre/geom_fromVPSC.py index a1208170b..9c6940c41 100755 --- a/processing/pre/geom_fromVPSC.py +++ b/processing/pre/geom_fromVPSC.py @@ -74,10 +74,10 @@ for name in filenames: while outputAlive and table.data_read(): if table.data != []: currPos = table.data[3:6] - for i in xrange(3): + for i in range(3): coords[i][currPos[i]] = True currPos = map(float,currPos) - for i in xrange(3): + for i in range(3): pos['min'][i] = min(pos['min'][i],currPos[i]) pos['max'][i] = max(pos['max'][i],currPos[i]) eulerangles.append(map(math.degrees,map(float,table.data[:3]))) @@ -94,10 +94,10 @@ for name in filenames: limits = [360,180,360] if any([np.any(eulerangles[:,i]>=limits[i]) for i in [0,1,2]]): - file['croak'].write('Error: euler angles out of bound. Ang file might contain unidexed poins.\n') + damask.util.croak.write('Error: euler angles out of bound. Ang file might contain unidexed poins.\n') for i,angle in enumerate(['phi1','PHI','phi2']): for n in np.nditer(np.where(eulerangles[:,i]>=limits[i]),['zerosize_ok']): - file['croak'].write('%s in line %i (%4.2f %4.2f %4.2f)\n' + damask.util.croak.write('%s in line %i (%4.2f %4.2f %4.2f)\n' %(angle,n,eulerangles[n,0],eulerangles[n,1],eulerangles[n,2])) continue eulerangles=np.around(eulerangles,int(options.precision)) # round to desired precision @@ -114,9 +114,9 @@ for name in filenames: formatString='{0:0>'+str(int(options.precision)+3)+'}' euleranglesRadInt = (eulerangles*10**int(options.precision)).astype('int') eulerKeys = np.array([int(''.join(map(formatString.format,euleranglesRadInt[i,:]))) \ - for i in xrange(info['grid'].prod())]) + for i in range(info['grid'].prod())]) devNull, texture, eulerKeys_idx = np.unique(eulerKeys, return_index = True, return_inverse=True) - msFull = np.array([[eulerKeys_idx[i],phase[i]] for i in xrange(info['grid'].prod())],'i8') + msFull = np.array([[eulerKeys_idx[i],phase[i]] for i in range(info['grid'].prod())],'i8') devNull,msUnique,matPoints = np.unique(msFull.view('c16'),True,True) matPoints+=1 microstructure = np.array([msFull[i] for i in msUnique]) # pick only unique microstructures @@ -129,7 +129,7 @@ for name in filenames: formatwidth = 1+int(math.log10(len(microstructure))) config_header += [''] - for i in xrange(len(microstructure)): + for i in range(len(microstructure)): config_header += ['[Grain%s]'%str(i+1).zfill(formatwidth), 'crystallite\t%i'%options.crystallite, '(constituent)\tphase %i\ttexture %i\tfraction 1.0'%(microstructure[i,1],microstructure[i,0]+1) @@ -138,7 +138,7 @@ for name in filenames: eulerFormatOut='%%%i.%if'%(int(options.precision)+4,int(options.precision)) outStringAngles='(gauss) phi1 '+eulerFormatOut+' Phi '+eulerFormatOut+' phi2 '+eulerFormatOut+' scatter 0.0 fraction 1.0' - for i in xrange(len(texture)): + for i in range(len(texture)): config_header += ['[Texture%s]'%str(i+1).zfill(formatOut), outStringAngles%tuple(eulerangles[texture[i],...]) ] diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index 9c16a6213..95fb1cab7 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -178,7 +178,7 @@ parser.add_option_group(group) group = OptionGroup(parser, "Configuration","") -group.add_option('--no-config', +group.add_option('--without-config', dest = 'config', action = 'store_false', help = 'omit material configuration header') diff --git a/processing/pre/geom_pack.py b/processing/pre/geom_pack.py index 24636c7d7..4932b8795 100755 --- a/processing/pre/geom_pack.py +++ b/processing/pre/geom_pack.py @@ -36,12 +36,12 @@ for name in filenames: table.head_read() info,extra_header = table.head_getGeom() - damask.util.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))), - 'size x y z: %s'%(' x '.join(map(str,info['size']))), - 'origin x y z: %s'%(' : '.join(map(str,info['origin']))), - 'homogenization: %i'%info['homogenization'], - 'microstructures: %i'%info['microstructures'], - ]) + damask.util.croak(['grid a b c: {}'.format(' x '.join(map(str,info['grid']))), + 'size x y z: {}'.format(' x '.join(map(str,info['size']))), + 'origin x y z: {}'.format(' : '.join(map(str,info['origin']))), + 'homogenization: {}'.format(info['homogenization']), + 'microstructures: {}'.format(info['microstructures']), + ]) errors = [] if np.any(info['grid'] < 1): errors.append('invalid grid a b c.') @@ -81,7 +81,7 @@ for name in filenames: else: items = map(int,items) for current in items: - if abs(current - former) == 1 and abs(start-former) == reps - 1: + if abs(current - former) == 1 and (start - current) == reps*(former - current): compressType = 'to' reps += 1 elif current == former and start == former: diff --git a/processing/pre/mentat_pbcOnBoxMesh.py b/processing/pre/mentat_pbcOnBoxMesh.py old mode 100755 new mode 100644 index 71bc0d121..afd8d95f0 --- a/processing/pre/mentat_pbcOnBoxMesh.py +++ b/processing/pre/mentat_pbcOnBoxMesh.py @@ -1,67 +1,101 @@ #!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- -import sys,os +import sys,os,re,time,tempfile import numpy as np from optparse import OptionParser import damask +sys.path.append(damask.solver.Marc().libraryPath()) + scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) -sys.path.append(damask.solver.Marc().libraryPath()) +# Convert .mfd file into a usable format +# Broken into labeled sections (eg. nodes, links, etc) +# Each section has a list of labeled elements with formatted numerical data +def parseMFD(dat): + formatted = [] + section = 0 + formatted.append({'label': 'header', 'uid': -1, 'els': []}) + # in between =beg= and =end= part of file + in_block = False + for line in dat: + if in_block: # currently in a section + # lines that start with a space are numerical data + if line[0] == ' ': + formatted[section]['els'].append([]) + + # grab numbers + nums = re.split(r'\s+', line.strip()) + + for num in nums: + # floating point has format ' -x.xxxxxxxxxxxxe+yy' + # scientific notation is used for float + if (len(num) >= 4) and (num[-4] == 'e'): + formatted[section]['els'][-1].append(float(num)) + else: # integer + formatted[section]['els'][-1].append(int(num)) + else: # not numerical data, so it is a label for an element or section end + if line[0] == '=' and re.search(r'=end=$', line) is not None: # End of section, avoiding regex if possible + in_block = False + else: + formatted[section]['els'].append([]) + formatted[section]['els'][-1] = line + + else: # Not in a section, we are looking for a =beg= now + search = re.search(r'=beg=\s+(\d+)\s\((.*?)\)', line) + if search is not None: # found start of a new section + section += 1 + in_block = True + formatted.append({'label': search.group(2), 'uid': int(search.group(1)), 'els': []}) + else: # No =beg= found, probably in the header + # Either header or somthing we didn't plan for - just save the line so it isn't lost + if formatted[section]['uid'] > 0: + section += 1 + formatted.append({'label': '', 'uid': -2, 'els': []}) # make dummy section to store unrecognized data + formatted[section]['els'].append(line) + + return formatted -active=[True,True,True] # directions on which to add PBC -def outMentat(cmd,locals): - if cmd[0:3] == '(!)': - exec(cmd[3:]) - elif cmd[0:3] == '(?)': - cmd = eval(cmd[3:]) - py_mentat.py_send(cmd) - else: - py_mentat.py_send(cmd) - return - -#------------------------------------------------------------------------------------------------- -def outFile(cmd,locals,dest): - if cmd[0:3] == '(!)': - exec(cmd[3:]) - elif cmd[0:3] == '(?)': - cmd = eval(cmd[3:]) - dest.write(cmd+'\n') - else: - dest.write(cmd+'\n') - return - - -#------------------------------------------------------------------------------------------------- -def output(cmds,locals,dest): - for cmd in cmds: - if isinstance(cmd,list): - output(cmd,locals,dest) - else: - if dest == 'Mentat': - outMentat(str(cmd),locals) +def asMFD(mfd_data): + result = '' + for section in mfd_data: + if section['uid'] > 0: + result += '=beg={0:5d} ({1})\n'.format(section['uid'], section['label']) + for el in section['els']: + if type(el) == str: + result += el + elif type(el) == list: + for num in el: + if type(num) == int: + result += '{:20d}'.format(num) + elif type(num) == float: + result += '{:20.12e}'.format(num) + else: + damask.util.croak('WARNING: encountered unknown type: ' + str(type(el))) + result += '\n' else: - outFile(str(cmd),locals,dest) - return + damask.util.croak('WARNING: encountered unknown type: ' + str(type(el))) + if section['uid'] > 0: + result += '=end=\n' + return result.strip() - -def servoLink(): - - cmds = [] +def add_servoLinks(mfd_data,active=[True,True,True]): # directions on which to add PBC base = ['x','y','z'] box = {'min': np.zeros(3,dtype='d'), 'max': np.zeros(3,dtype='d'), 'delta': np.zeros(3,dtype='d'), } - Nnodes = py_mentat.py_get_int("nnodes()") - NodeCoords = np.zeros((Nnodes,3),dtype='d') - for node in range(Nnodes): - NodeCoords[node,0] = py_mentat.py_get_float("node_x(%i)"%(node+1)) - NodeCoords[node,1] = py_mentat.py_get_float("node_y(%i)"%(node+1)) - NodeCoords[node,2] = py_mentat.py_get_float("node_z(%i)"%(node+1)) + + mfd_dict = {} + for i in range(len(mfd_data)): + mfd_dict[mfd_data[i]['label']] = i + + NodeCoords = np.array(mfd_data[mfd_dict['nodes']]['els'][0::4])[:,1:4] + Nnodes = NodeCoords.shape[0] + box['min'] = NodeCoords.min(axis=0) # find the bounding box box['max'] = NodeCoords.max(axis=0) box['delta'] = box['max']-box['min'] @@ -108,9 +142,12 @@ def servoLink(): if any([maxFlag[i] and active[i] for i in range(3)]): linkNodes.append({'id': node+1,'coord': NodeCoords[node], 'faceMember': [maxFlag[i] and active[i] for i in range(3)]}) + mfd_data[mfd_dict['entities']]['els'][0][0] += len(linkNodes) * 3 + baseCorner = baseNode["%.8e"%box['min'][0]]["%.8e"%box['min'][1]]["%.8e"%box['min'][2]] # detect ultimate base node - + links = {'uid': 1705, 'label': 'links', 'els': [[7,0],[9,0]]} + linkID = 0 for node in linkNodes: # loop over all linked nodes linkCoord = [node['coord']] # start list of control node coords with my coords for dir in range(3): # check for each direction @@ -121,76 +158,104 @@ def servoLink(): nLinks = len(linkCoord) for dof in [1,2,3]: - cmds.append([ - "*new_link *link_class servo", - "*link_class servo *tied_node %i"%node['id'], - "*link_class servo *tied_dof %i"%dof, - "*servo_nterms %i"%(1+nLinks), - ]) - for i in range(nLinks): - cmds.append([ - "*link_class servo *servo_ret_node %i %i"\ - %(i+1,baseNode["%.8e"%linkCoord[i][0]]["%.8e"%linkCoord[i][1]]["%.8e"%linkCoord[i][2]]), - "*link_class servo *servo_ret_dof %i %i"%(i+1,dof), - "*link_class servo *servo_ret_coef %i 1"%(i+1), - ]) - cmds.append([ - "*link_class servo *servo_ret_node %i %i"%(1+nLinks,baseCorner), - "*link_class servo *servo_ret_dof %i %i"%(1+nLinks,dof), - "*link_class servo *servo_ret_coef %i -%i"%(1+nLinks,nLinks-1), - ]) - return cmds + tied_node = node['id'] + nterms = 1 + nLinks + + linkID += 1 + # Link header + links['els'].append('link{0}\n'.format(linkID)) + links['els'].append([linkID, 1]) + links['els'].append([0]) + links['els'].append([0]) + links['els'].append([0, 0, 0, tied_node]) + + # these need to be put in groups of four + link_payload = [dof, 0, nterms] + + # Individual node contributions (node, dof, coef.) + for i in range(nterms): + if i == nLinks: + link_payload.append(baseCorner) + else: + link_payload.append(baseNode["%.8e"%linkCoord[i][0]]["%.8e"%linkCoord[i][1]]["%.8e"%linkCoord[i][2]]) + for i in range(nterms): + link_payload.append(dof) + for i in range(nterms): + if i == nLinks: + link_payload.append(1.0 - nLinks) + else: + link_payload.append(1.0) + + # Needs to be formatted 4 data points per row, character width of 20, so 80 total + for j in range(0, len(link_payload), 4): + links['els'].append(link_payload[j:j+4]) + if j+4 < len(link_payload): + links['els'].append(link_payload[j+4:]) + i = 0 + while i < len(mfd_data) and mfd_data[i]['uid'] < 1705: i += 1 + + if mfd_data[i]['uid'] == 1705: del mfd_data[i] + mfd_data.insert(i, links) + #-------------------------------------------------------------------------------------------------- # MAIN #-------------------------------------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage = '%prog [options]', description = """ -Set up servo linking to achieve periodic boundary conditions for a regular hexahedral mesh presently opened in MSC.Mentat +parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ +Set up servo linking to achieve periodic boundary conditions for a regular hexahedral mesh. +Use *py_connection to operate on model presently opened in MSC.Mentat. """, version = scriptID) -parser.add_option("-p", "--port", type="int", dest="port", metavar='int', - help="Mentat connection port [%default]") -parser.add_option("-v", "--verbose", action="store_true", dest="verbose", - help="write Mentat command stream also to stdout [%default]") -parser.set_defaults(port = 40007) -parser.set_defaults(verbose = False) +parser.add_option('-p', '--port', + type = int, metavar = 'int', default = None, + help = 'Mentat connection port') +parser.add_option('-x', + action = 'store_false', default = True, + help = 'no PBC along x direction') +parser.add_option('-y', + action = 'store_false', default = True, + help = 'no PBC along y direction') +parser.add_option('-z', + action = 'store_false', default = True, + help = 'no PBC along z direction') -(options, args) = parser.parse_args() +(options, filenames) = parser.parse_args() -if options.verbose: - file={'croak':sys.stderr} -else: - file={'croak':sys.stdout} +remote = options.port is not None -try: - import py_mentat -except: - file['croak'].write('error: no valid Mentat release found') - sys.exit(-1) +if remote and filenames != []: + parser.error('file can not be specified when port is given.') +if filenames == []: filenames = [None] -outputLocals = {} +if remote: + try: import py_mentat + except: + damask.util.croak('no valid Mentat release found.') + sys.exit(-1) -file['croak'].write('\033[1m'+scriptName+'\033[0m\n\n') -file['croak'].write( 'waiting to connect...\n') -try: - py_mentat.py_connect('',options.port) -# prevent redrawing in Mentat, should be much faster. Since py_connect has no return value, try this to determine if failed or not - output(['*draw_manual'],outputLocals,'Mentat') -except: - file['croak'].write('Could not connect. Set Tools/Python/"Run as Separate Process" & "Initiate"...\n') - sys.exit() -file['croak'].write( 'connected...\n') + damask.util.report(scriptName, 'waiting to connect...') + filenames = [os.path.join(tempfile._get_default_tempdir(), next(tempfile._get_candidate_names()) + '.mfd')] + try: + py_mentat.py_connect('',options.port) + py_mentat.py_send('*set_save_formatted on') + py_mentat.py_send('*save_as_model "{}" yes'.format(filenames[0])) + py_mentat.py_get_int("nnodes()") # hopefully blocks until file is written + except: + damask.util.croak('failed. try setting Tools/Python/"Run as Separate Process" & "Initiate".') + sys.exit() + damask.util.croak( 'connected...') -output(['*remove_all_servos', - '*sweep_all', - '*renumber_nodes', - '*set_links off', - ],outputLocals,'Mentat') # script depends on consecutive numbering of nodes +for name in filenames: + while remote and not os.path.exists(name): time.sleep(0.5) # wait for Mentat to write MFD file + with open( name,'r') if name is not None else sys.stdin as fileIn: + damask.util.report(scriptName, name) + mfd = parseMFD(fileIn) -cmds = servoLink() -output(cmds,outputLocals,'Mentat') -py_mentat.py_disconnect() + add_servoLinks(mfd,[options.x,options.y,options.z]) + with open( name,'w') if name is not None else sys.stdout as fileOut: + fileOut.write(asMFD(mfd)) -if options.verbose: - output(cmds,outputLocals,sys.stdout) +if remote: + try: py_mentat.py_send('*open_model "{}"'.format(filenames[0])) + except: damask.util.croak('lost connection on sending open command for "{}".'.format(filenames[0])) diff --git a/processing/pre/mentat_spectralBox.py b/processing/pre/mentat_spectralBox.py index 681aca724..16c982f82 100755 --- a/processing/pre/mentat_spectralBox.py +++ b/processing/pre/mentat_spectralBox.py @@ -247,6 +247,7 @@ for name in filenames: '*identify_sets', '*show_model', '*redraw', + '*draw_automatic', ] outputLocals = {} diff --git a/code/.gitignore b/src/.gitignore similarity index 58% rename from code/.gitignore rename to src/.gitignore index bc33403b4..c90e213cf 100644 --- a/code/.gitignore +++ b/src/.gitignore @@ -1,3 +1,5 @@ DAMASK_marc*.f90 +Makefile +cmake_install.cmake quit__genmod.f90 *.marc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..83647d8d0 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,205 @@ +# special flags for some files +if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") + + SET_SOURCE_FILES_PROPERTIES( "prec.f90" PROPERTIES + COMPILE_FLAGS "-fno-range-check -fall-intrinsics -fno-fast-math") + # fno-range-check: Disable range checking on results of simplification of constant expressions during compilation + # --> allows the definition of DAMASK_NaN + #-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored + # and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared external + # --> allows the use of 'isnan' + #-fno-fast-math: + # --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug) + + SET_SOURCE_FILES_PROPERTIES( "lattice.f90" PROPERTIES + COMPILE_FLAGS "-ffree-line-length-240") + # long lines for interaction matrix +endif() + +# The dependency detection in CMake is not functioning for Fortran, +# hence we declare the dependencies from top to bottom in the following +add_library(C_ROUTINES OBJECT "C_routines.c") +set(OBJECTFILES $) + +add_library(SYSTEM_ROUTINES OBJECT "system_routines.f90") +add_dependencies(SYSTEM_ROUTINES C_ROUTINES) +list(APPEND OBJECTFILES $) + +add_library(PREC OBJECT "prec.f90") +add_dependencies(PREC SYSTEM_ROUTINES) +list(APPEND OBJECTFILES $) + +if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral") + add_library(DAMASK_INTERFACE OBJECT "spectral_interface.f90") +elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM") + add_library(DAMASK_INTERFACE OBJECT "FEM_interface.f90") +endif() +add_dependencies(DAMASK_INTERFACE PREC) +list(APPEND OBJECTFILES $) + +add_library(IO OBJECT "IO.f90") +add_dependencies(IO DAMASK_INTERFACE) +list(APPEND OBJECTFILES $) + +add_library(NUMERICS OBJECT "numerics.f90") +add_dependencies(NUMERICS IO) +list(APPEND OBJECTFILES $) + +add_library(DEBUG OBJECT "debug.f90") +add_dependencies(DEBUG NUMERICS) +list(APPEND OBJECTFILES $) + +add_library(FEsolving OBJECT "FEsolving.f90") +add_dependencies(FEsolving DEBUG) +list(APPEND OBJECTFILES $) + +add_library(DAMASK_MATH OBJECT "math.f90") +add_dependencies(DAMASK_MATH FEsolving) +list(APPEND OBJECTFILES $) + +# SPECTRAL solver and FEM solver use different mesh files +if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral") + add_library(MESH OBJECT "mesh.f90") + add_dependencies(MESH DAMASK_MATH) + list(APPEND OBJECTFILES $) +elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM") + add_library(FEZoo OBJECT "FEZoo.f90") + add_dependencies(FEZoo DAMASK_MATH) + list(APPEND OBJECTFILES $) + add_library(MESH OBJECT "meshFEM.f90") + add_dependencies(MESH FEZoo) + list(APPEND OBJECTFILES $) +endif() + +add_library(MATERIAL OBJECT "material.f90") +add_dependencies(MATERIAL MESH) +list(APPEND OBJECTFILES $) + +add_library(DAMASK_HELPERS OBJECT "lattice.f90") +add_dependencies(DAMASK_HELPERS MATERIAL) +list(APPEND OBJECTFILES $) + +# For each modular section +add_library (PLASTIC OBJECT + "plastic_dislotwin.f90" + "plastic_disloUCLA.f90" + "plastic_isotropic.f90" + "plastic_phenopowerlaw.f90" + "plastic_titanmod.f90" + "plastic_nonlocal.f90" + "plastic_none.f90" + "plastic_phenoplus.f90") +add_dependencies(PLASTIC DAMASK_HELPERS) +list(APPEND OBJECTFILES $) + +add_library (KINEMATICS OBJECT + "kinematics_cleavage_opening.f90" + "kinematics_slipplane_opening.f90" + "kinematics_thermal_expansion.f90" + "kinematics_vacancy_strain.f90" + "kinematics_hydrogen_strain.f90") +add_dependencies(KINEMATICS DAMASK_HELPERS) +list(APPEND OBJECTFILES $) + +add_library (SOURCE OBJECT + "source_thermal_dissipation.f90" + "source_thermal_externalheat.f90" + "source_damage_isoBrittle.f90" + "source_damage_isoDuctile.f90" + "source_damage_anisoBrittle.f90" + "source_damage_anisoDuctile.f90" + "source_vacancy_phenoplasticity.f90" + "source_vacancy_irradiation.f90" + "source_vacancy_thermalfluc.f90") +add_dependencies(SOURCE DAMASK_HELPERS) +list(APPEND OBJECTFILES $) + +add_library(CONSTITUTIVE OBJECT "constitutive.f90") +add_dependencies(CONSTITUTIVE PLASTIC KINEMATICS SOURCE) +list(APPEND OBJECTFILES $) + +add_library(CRYSTALLITE OBJECT "crystallite.f90") +add_dependencies(CRYSTALLITE CONSTITUTIVE) +list(APPEND OBJECTFILES $) + +add_library(HOMOGENIZATION OBJECT + "homogenization_RGC.f90" + "homogenization_isostrain.f90" + "homogenization_none.f90") +add_dependencies(HOMOGENIZATION CRYSTALLITE) +list(APPEND OBJECTFILES $) + +add_library(HYDROGENFLUX OBJECT + "hydrogenflux_isoconc.f90" + "hydrogenflux_cahnhilliard.f90") +add_dependencies(HYDROGENFLUX CRYSTALLITE) +list(APPEND OBJECTFILES $) + +add_library(POROSITY OBJECT + "porosity_none.f90" + "porosity_phasefield.f90") +add_dependencies(POROSITY CRYSTALLITE) +list(APPEND OBJECTFILES $) + +add_library(VACANCYFLUX OBJECT + "vacancyflux_isoconc.f90" + "vacancyflux_isochempot.f90" + "vacancyflux_cahnhilliard.f90") +add_dependencies(VACANCYFLUX CRYSTALLITE) +list(APPEND OBJECTFILES $) + +add_library(DAMAGE OBJECT + "damage_none.f90" + "damage_local.f90" + "damage_nonlocal.f90") +add_dependencies(DAMAGE CRYSTALLITE) +list(APPEND OBJECTFILES $) + +add_library(THERMAL OBJECT + "thermal_isothermal.f90" + "thermal_adiabatic.f90" + "thermal_conduction.f90") +add_dependencies(THERMAL CRYSTALLITE) +list(APPEND OBJECTFILES $) + +add_library(DAMASK_ENGINE OBJECT "homogenization.f90") +add_dependencies(DAMASK_ENGINE THERMAL DAMAGE VACANCYFLUX POROSITY HYDROGENFLUX HOMOGENIZATION) +list(APPEND OBJECTFILES $) + +add_library(DAMASK_CPFE OBJECT "CPFEM2.f90") +add_dependencies(DAMASK_CPFE DAMASK_ENGINE) +list(APPEND OBJECTFILES $) + +if ("${PROJECT_NAME}" STREQUAL "DAMASK_spectral") + add_library(SPECTRAL_UTILITIES OBJECT "spectral_utilities.f90") + add_dependencies(SPECTRAL_UTILITIES DAMASK_CPFE) + list(APPEND OBJECTFILES $) + + add_library(SPECTRAL_SOLVER OBJECT + "spectral_thermal.f90" + "spectral_damage.f90" + "spectral_mech_AL.f90" + "spectral_mech_Polarisation.f90" + "spectral_mech_Basic.f90") + add_dependencies(SPECTRAL_SOLVER SPECTRAL_UTILITIES) + list(APPEND OBJECTFILES $) + if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "SYNTAXONLY") + add_executable(DAMASK_spectral "DAMASK_spectral.f90" ${OBJECTFILES}) + add_dependencies(DAMASK_spectral SPECTRAL_SOLVER) + endif() +elseif ("${PROJECT_NAME}" STREQUAL "DAMASK_FEM") + add_library(FEM_UTILITIES OBJECT "FEM_utilities.f90") + add_dependencies(FEM_UTILITIES DAMASK_CPFE) + + add_library(FEM_SOLVER OBJECT + "FEM_hydrogenflux.f90" + "FEM_porosity.f90" + "FEM_vacancyflux.f90" + "FEM_damage.f90" + "FEM_thermal.f90" + "FEM_mech.f90") + add_dependencies(FEM_SOLVER FEM_UTILITIES) + + add_executable(DAMASK_FEM "DAMASK_FEM_driver.f90") + add_dependencies(DAMASK_FEM FEM_SOLVER) +endif() diff --git a/code/CPFEM.f90 b/src/CPFEM.f90 similarity index 97% rename from code/CPFEM.f90 rename to src/CPFEM.f90 index a1dac9801..eef56506f 100644 --- a/code/CPFEM.f90 +++ b/src/CPFEM.f90 @@ -302,6 +302,8 @@ subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt phase_plasticity, & temperature, & thermalMapping, & + thermal_type, & + THERMAL_conduction_ID, & phase_Nsources, & material_homog, & material_Nhomogenization @@ -489,8 +491,11 @@ subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt !* If no parallel execution is required, there is no need to collect FEM input if (.not. parallelExecution) then - temperature(material_homog(ip,elCP))%p(thermalMapping(material_homog(ip,elCP))%p(ip,elCP)) = & - temperature_inp + chosenThermal1: select case (thermal_type(mesh_element(3,elCP))) + case (THERMAL_conduction_ID) chosenThermal1 + temperature(material_homog(ip,elCP))%p(thermalMapping(material_homog(ip,elCP))%p(ip,elCP)) = & + temperature_inp + end select chosenThermal1 materialpoint_F0(1:3,1:3,ip,elCP) = ffn materialpoint_F(1:3,1:3,ip,elCP) = ffn1 @@ -499,8 +504,11 @@ subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal CPFEM_cs(1:6,ip,elCP) = rnd * CPFEM_odd_stress CPFEM_dcsde(1:6,1:6,ip,elCP) = CPFEM_odd_jacobian * math_identity2nd(6) - temperature(material_homog(ip,elCP))%p(thermalMapping(material_homog(ip,elCP))%p(ip,elCP)) = & - temperature_inp + chosenThermal2: select case (thermal_type(mesh_element(3,elCP))) + case (THERMAL_conduction_ID) chosenThermal2 + temperature(material_homog(ip,elCP))%p(thermalMapping(material_homog(ip,elCP))%p(ip,elCP)) = & + temperature_inp + end select chosenThermal2 materialpoint_F0(1:3,1:3,ip,elCP) = ffn materialpoint_F(1:3,1:3,ip,elCP) = ffn1 CPFEM_calc_done = .false. diff --git a/code/CPFEM2.f90 b/src/CPFEM2.f90 similarity index 100% rename from code/CPFEM2.f90 rename to src/CPFEM2.f90 diff --git a/code/C_routines.c b/src/C_routines.c similarity index 100% rename from code/C_routines.c rename to src/C_routines.c diff --git a/code/DAMASK_abaqus_exp.f b/src/DAMASK_abaqus_exp.f similarity index 100% rename from code/DAMASK_abaqus_exp.f rename to src/DAMASK_abaqus_exp.f diff --git a/code/DAMASK_abaqus_std.f b/src/DAMASK_abaqus_std.f similarity index 100% rename from code/DAMASK_abaqus_std.f rename to src/DAMASK_abaqus_std.f diff --git a/code/DAMASK_marc.f90 b/src/DAMASK_marc.f90 similarity index 95% rename from code/DAMASK_marc.f90 rename to src/DAMASK_marc.f90 index 50bc82f76..27640e5f2 100644 --- a/code/DAMASK_marc.f90 +++ b/src/DAMASK_marc.f90 @@ -1,5 +1,5 @@ -#define QUOTE(x) #x -#define PASTE(x,y) x ## y +#define QUOTE(x) #x +#define PASTE(x,y) x ## y #ifndef INT #define INT 4 @@ -35,7 +35,7 @@ !> @details - creeps: timinc !-------------------------------------------------------------------------------------------------- module DAMASK_interface - + implicit none character(len=4), parameter :: InputFileExtension = '.dat' character(len=4), parameter :: LogFileExtension = '.log' @@ -57,18 +57,18 @@ subroutine DAMASK_interface_init write(6,'(/,a)') ' Version: '//DAMASKVERSION write(6,'(a,2(i2.2,a),i4.4)') ' Date: ',dateAndTime(3),'/',& dateAndTime(2),'/',& - dateAndTime(1) + dateAndTime(1) write(6,'(a,2(i2.2,a),i2.2)') ' Time: ',dateAndTime(5),':',& dateAndTime(6),':',& - dateAndTime(7) + dateAndTime(7) write(6,'(/,a)') ' <<<+- DAMASK_interface init -+>>>' -#include "compilation_info.f90" +#include "compilation_info.f90" end subroutine DAMASK_interface_init !-------------------------------------------------------------------------------------------------- -!> @brief returns the current workingDir +!> @brief returns the current workingDir !-------------------------------------------------------------------------------------------------- function getSolverWorkingDirectoryName() @@ -185,7 +185,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & !$ include "omp_lib.h" ! the openMP function library integer(pInt), intent(in) :: & ! according to MSC.Marc 2012 Manual D ngens, & !< size of stress-strain law - nn, & !< integration point number + nn, & !< integration point number ndi, & !< number of direct components nshear, & !< number of shear components ncrd, & !< number of coordinates @@ -199,7 +199,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & integer(pInt), dimension(2), intent(in) :: & ! according to MSC.Marc 2012 Manual D m, & !< (1) user element number, (2) internal element number matus, & !< (1) user material identification number, (2) internal material identification number - kcus, & !< (1) layer number, (2) internal layer number + kcus, & !< (1) layer number, (2) internal layer number lclass !< (1) element class, (2) 0: displacement, 1: low order Herrmann, 2: high order Herrmann real(pReal), dimension(*), intent(in) :: & ! has dimension(1) according to MSC.Marc 2012 Manual D, but according to example hypela2.f dimension(*) e, & !< total elastic strain @@ -240,17 +240,17 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & real(pReal), dimension(6) :: stress real(pReal), dimension(6,6) :: ddsdde integer(pInt) :: computationMode, i, cp_en, node, CPnodeID - !$ integer :: defaultNumThreadsInt !< default value set by Marc + !$ integer(4) :: defaultNumThreadsInt !< default value set by Marc if (iand(debug_level(debug_MARC),debug_LEVELBASIC) /= 0_pInt) then write(6,'(a,/,i8,i8,i2)') ' MSC.MARC information on shape of element(2), IP:', m, nn - write(6,'(a,2(i1))') ' Jacobian: ', ngens,ngens - write(6,'(a,i1)') ' Direct stress: ', ndi - write(6,'(a,i1)') ' Shear stress: ', nshear + write(6,'(a,2(i1))') ' Jacobian: ', ngens,ngens + write(6,'(a,i1)') ' Direct stress: ', ndi + write(6,'(a,i1)') ' Shear stress: ', nshear write(6,'(a,i2)') ' DoF: ', ndeg write(6,'(a,i2)') ' Coordinates: ', ncrd - write(6,'(a,i12)') ' Nodes: ', nnode - write(6,'(a,i1)') ' Deformation gradient: ', itel + write(6,'(a,i12)') ' Nodes: ', nnode + write(6,'(a,i1)') ' Deformation gradient: ', itel write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' Deformation gradient at t=n:', & math_transpose33(ffn) write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' Deformation gradient at t=n+1:', & @@ -310,7 +310,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & !$OMP END CRITICAL (write2out) endif ! convergence treatment end - + if (usePingPong) then calcMode(nn,cp_en) = .not. calcMode(nn,cp_en) ! ping pong (calc <--> collect) if (calcMode(nn,cp_en)) then ! now --- CALC --- @@ -339,7 +339,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & mesh_node(1:ndeg,CPnodeID) = mesh_node0(1:ndeg,CPnodeID) + numerics_unitlength * dispt(1:ndeg,node) enddo endif - + else ! --- PLAIN MODE --- computationMode = CPFEM_CALCRESULTS ! always calc if (lastLovl /= lovl) then @@ -378,12 +378,39 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & s(1:ndi+nshear) = stress(1:ndi+nshear)*invnrmMandel(1:ndi+nshear) g = 0.0_pReal if(symmetricSolver) d = 0.5_pReal*(d+transpose(d)) - + !$ call omp_set_num_threads(defaultNumThreadsInt) ! reset number of threads to stored default value end subroutine hypela2 +!-------------------------------------------------------------------------------------------------- +!> @brief calculate internal heat generated due to inelastic energy dissipation +!-------------------------------------------------------------------------------------------------- +subroutine flux(f,ts,n,time) + use prec, only: & + pReal, & + pInt + use thermal_conduction, only: & + thermal_conduction_getSourceAndItsTangent + use mesh, only: & + mesh_FEasCP + + implicit none + real(pReal), dimension(6), intent(in) :: & + ts + integer(pInt), dimension(10), intent(in) :: & + n + real(pReal), intent(in) :: & + time + real(pReal), dimension(2), intent(out) :: & + f + + call thermal_conduction_getSourceAndItsTangent(f(1), f(2), ts(3), n(3),mesh_FEasCP('elem',n(1))) + + end subroutine flux + + !-------------------------------------------------------------------------------------------------- !> @brief sets user defined output variables for Marc !> @details select a variable contour plotting (user subroutine). @@ -399,7 +426,7 @@ subroutine plotv(v,s,sp,etot,eplas,ecreep,t,m,nn,layer,ndi,nshear,jpltcd) use homogenization, only: & materialpoint_results,& materialpoint_sizeResults - + implicit none integer(pInt), intent(in) :: & m, & !< element number @@ -411,7 +438,7 @@ subroutine plotv(v,s,sp,etot,eplas,ecreep,t,m,nn,layer,ndi,nshear,jpltcd) real(pReal), dimension(*), intent(in) :: & s, & !< stress array sp, & !< stresses in preferred direction - etot, & !< total strain (generalized) + etot, & !< total strain (generalized) eplas, & !< total plastic strain ecreep, & !< total creep strain t !< current temperature diff --git a/src/DAMASK_marc2011.f90 b/src/DAMASK_marc2011.f90 new file mode 120000 index 000000000..2c5bec706 --- /dev/null +++ b/src/DAMASK_marc2011.f90 @@ -0,0 +1 @@ +DAMASK_marc.f90 \ No newline at end of file diff --git a/src/DAMASK_marc2012.f90 b/src/DAMASK_marc2012.f90 new file mode 120000 index 000000000..2c5bec706 --- /dev/null +++ b/src/DAMASK_marc2012.f90 @@ -0,0 +1 @@ +DAMASK_marc.f90 \ No newline at end of file diff --git a/src/DAMASK_marc2013.1.f90 b/src/DAMASK_marc2013.1.f90 new file mode 120000 index 000000000..2c5bec706 --- /dev/null +++ b/src/DAMASK_marc2013.1.f90 @@ -0,0 +1 @@ +DAMASK_marc.f90 \ No newline at end of file diff --git a/src/DAMASK_marc2013.f90 b/src/DAMASK_marc2013.f90 new file mode 120000 index 000000000..2c5bec706 --- /dev/null +++ b/src/DAMASK_marc2013.f90 @@ -0,0 +1 @@ +DAMASK_marc.f90 \ No newline at end of file diff --git a/src/DAMASK_marc2014.2.f90 b/src/DAMASK_marc2014.2.f90 new file mode 120000 index 000000000..2c5bec706 --- /dev/null +++ b/src/DAMASK_marc2014.2.f90 @@ -0,0 +1 @@ +DAMASK_marc.f90 \ No newline at end of file diff --git a/src/DAMASK_marc2014.f90 b/src/DAMASK_marc2014.f90 new file mode 120000 index 000000000..2c5bec706 --- /dev/null +++ b/src/DAMASK_marc2014.f90 @@ -0,0 +1 @@ +DAMASK_marc.f90 \ No newline at end of file diff --git a/src/DAMASK_marc2015.f90 b/src/DAMASK_marc2015.f90 new file mode 120000 index 000000000..2c5bec706 --- /dev/null +++ b/src/DAMASK_marc2015.f90 @@ -0,0 +1 @@ +DAMASK_marc.f90 \ No newline at end of file diff --git a/code/DAMASK_spectral.f90 b/src/DAMASK_spectral.f90 similarity index 100% rename from code/DAMASK_spectral.f90 rename to src/DAMASK_spectral.f90 diff --git a/code/FEsolving.f90 b/src/FEsolving.f90 similarity index 100% rename from code/FEsolving.f90 rename to src/FEsolving.f90 diff --git a/code/IO.f90 b/src/IO.f90 similarity index 98% rename from code/IO.f90 rename to src/IO.f90 index 894e81852..452bc0588 100644 --- a/code/IO.f90 +++ b/src/IO.f90 @@ -14,7 +14,10 @@ module IO private character(len=5), parameter, public :: & IO_EOF = '#EOF#' !< end of file string - + character(len=168), parameter, private :: & + IO_divider = '───────────────────'//& + '───────────────────'//& + '──────────────────' public :: & IO_init, & IO_read, & @@ -878,7 +881,7 @@ function IO_spotTagInPart(fileUnit,part,tag,Nsections) IO_spotTagInPart = .false. ! assume to nowhere spot tag section = 0_pInt - line ='' + line = '' rewind(fileUnit) do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= part) ! search for part @@ -1669,33 +1672,35 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg) end select !$OMP CRITICAL (write2out) - write(6,'(/,a)') ' +--------------------------------------------------------+' - write(6,'(a)') ' + error +' - write(6,'(a,i3,a)') ' + ',error_ID,' +' - write(6,'(a)') ' + +' - write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(msg))),',',& + write(0,'(/,a)') ' ┌'//IO_divider//'┐' + write(0,'(a)') ' │ error │' + write(0,'(a)') ' ├'//IO_divider//'┤' + write(0,'(a,i3,a)') ' │ ',error_ID,' │' + write(0,'(a)') ' │ │' + write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a4,a',max(1,len(trim(msg))),',',& max(1,60-len(trim(msg))-5),'x,a)' - write(6,formatString) '+ ', trim(msg),'+' + write(0,formatString) '│ ',trim(msg),'│' if (present(ext_msg)) then - write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(ext_msg))),',',& + write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a4,a',max(1,len(trim(ext_msg))),',',& max(1,60-len(trim(ext_msg))-5),'x,a)' - write(6,formatString) '+ ', trim(ext_msg),'+' + write(0,formatString) '│ ',trim(ext_msg),'│' endif if (present(el)) then if (present(ip)) then if (present(g)) then - write(6,'(a13,1x,i9,1x,a2,1x,i2,1x,a5,1x,i4,18x,a1)') ' + at element',el,'IP',ip,'grain',g,'+' + write(0,'(a13,1x,i9,1x,a2,1x,i2,1x,a5,1x,i4,18x,a1)') ' │ at element',el,'IP',ip,'grain',g,'│' else - write(6,'(a13,1x,i9,1x,a2,1x,i2,29x,a1)') ' + at element',el,'IP',ip,'+' + write(0,'(a13,1x,i9,1x,a2,1x,i2,29x,a1)') ' │ at element',el,'IP',ip,'│' endif else - write(6,'(a13,1x,i9,35x,a1)') ' + at element',el,'+' + write(0,'(a13,1x,i9,35x,a1)') ' │ at element',el,'│' endif elseif (present(ip)) then ! now having the meaning of "instance" - write(6,'(a15,1x,i9,33x,a1)') ' + for instance',ip,'+' + write(0,'(a14,1x,i9,34x,a1)') ' │ at instance',ip,'│' endif - write(6,'(a)') ' +--------------------------------------------------------+' - flush(6) + write(0,'(a)') ' │ │' + write(0,'(a)') ' └'//IO_divider//'┘' + flush(0) call quit(9000_pInt+error_ID) !$OMP END CRITICAL (write2out) diff --git a/code/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 similarity index 100% rename from code/commercialFEM_fileList.f90 rename to src/commercialFEM_fileList.f90 diff --git a/code/compilation_info.f90 b/src/compilation_info.f90 similarity index 100% rename from code/compilation_info.f90 rename to src/compilation_info.f90 diff --git a/code/constitutive.f90 b/src/constitutive.f90 similarity index 99% rename from code/constitutive.f90 rename to src/constitutive.f90 index 7d4efd289..de8f61c2a 100644 --- a/code/constitutive.f90 +++ b/src/constitutive.f90 @@ -207,7 +207,7 @@ subroutine constitutive_init() outputName = PLASTICITY_NONE_label thisNoutput => null() thisOutput => null() - thisSize => null() + thisSize => null() case (PLASTICITY_ISOTROPIC_ID) plasticityType outputName = PLASTICITY_ISOTROPIC_label thisNoutput => plastic_isotropic_Noutput diff --git a/code/crystallite.f90 b/src/crystallite.f90 similarity index 99% rename from code/crystallite.f90 rename to src/crystallite.f90 index a570ad714..efeab9dcd 100644 --- a/code/crystallite.f90 +++ b/src/crystallite.f90 @@ -421,7 +421,7 @@ subroutine crystallite_init crystallite_partionedFp0 = crystallite_Fp0 crystallite_partionedFi0 = crystallite_Fi0 crystallite_partionedF0 = crystallite_F0 - crystallite_partionedF = crystallite_F0 + crystallite_partionedF = crystallite_F0 call crystallite_orientations() crystallite_orientation0 = crystallite_orientation ! store initial orientations for calculation of grain rotations @@ -1428,7 +1428,6 @@ subroutine crystallite_integrateStateRK4() !$OMP DO do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains if (crystallite_todo(g,i,e)) & - !***dirty way to pass orientation information call constitutive_microstructure(crystallite_orientation, & crystallite_Fe(1:3,1:3,g,i,e), & crystallite_Fp(1:3,1:3,g,i,e), & @@ -1754,7 +1753,6 @@ subroutine crystallite_integrateStateRKCK45() !$OMP DO do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains if (crystallite_todo(g,i,e)) & - !***dirty way to pass orientations to constitutive_microstructure call constitutive_microstructure(crystallite_orientation, & crystallite_Fe(1:3,1:3,g,i,e), & crystallite_Fp(1:3,1:3,g,i,e), & @@ -1974,7 +1972,6 @@ subroutine crystallite_integrateStateRKCK45() !$OMP DO do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains if (crystallite_todo(g,i,e)) & - !***dirty way to pass orientations to constitutive_microstructure call constitutive_microstructure(crystallite_orientation, & crystallite_Fe(1:3,1:3,g,i,e), & crystallite_Fp(1:3,1:3,g,i,e), & @@ -2209,7 +2206,6 @@ subroutine crystallite_integrateStateAdaptiveEuler() !$OMP DO do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains if (crystallite_todo(g,i,e)) & - !***dirty way to pass orientations to constitutive_microstructure call constitutive_microstructure(crystallite_orientation, & crystallite_Fe(1:3,1:3,g,i,e), & crystallite_Fp(1:3,1:3,g,i,e), & @@ -2553,7 +2549,6 @@ eIter = FEsolving_execElem(1:2) !$OMP DO do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) & - !***dirty way to pass orientations to constitutive_microstructure call constitutive_microstructure(crystallite_orientation, & crystallite_Fe(1:3,1:3,g,i,e), & crystallite_Fp(1:3,1:3,g,i,e), & @@ -2798,7 +2793,6 @@ subroutine crystallite_integrateStateFPI() !$OMP DO PRIVATE(p,c) do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) & - !***dirty way to pass orientations to constitutive_micrsotructure call constitutive_microstructure(crystallite_orientation, & crystallite_Fe(1:3,1:3,g,i,e), & crystallite_Fp(1:3,1:3,g,i,e), & diff --git a/code/damage_local.f90 b/src/damage_local.f90 similarity index 100% rename from code/damage_local.f90 rename to src/damage_local.f90 diff --git a/code/damage_none.f90 b/src/damage_none.f90 similarity index 100% rename from code/damage_none.f90 rename to src/damage_none.f90 diff --git a/code/damage_nonlocal.f90 b/src/damage_nonlocal.f90 similarity index 100% rename from code/damage_nonlocal.f90 rename to src/damage_nonlocal.f90 diff --git a/code/debug.f90 b/src/debug.f90 similarity index 100% rename from code/debug.f90 rename to src/debug.f90 diff --git a/code/homogenization.f90 b/src/homogenization.f90 similarity index 100% rename from code/homogenization.f90 rename to src/homogenization.f90 diff --git a/code/homogenization_RGC.f90 b/src/homogenization_RGC.f90 similarity index 100% rename from code/homogenization_RGC.f90 rename to src/homogenization_RGC.f90 diff --git a/code/homogenization_isostrain.f90 b/src/homogenization_isostrain.f90 similarity index 100% rename from code/homogenization_isostrain.f90 rename to src/homogenization_isostrain.f90 diff --git a/code/homogenization_none.f90 b/src/homogenization_none.f90 similarity index 100% rename from code/homogenization_none.f90 rename to src/homogenization_none.f90 diff --git a/code/hydrogenflux_cahnhilliard.f90 b/src/hydrogenflux_cahnhilliard.f90 similarity index 100% rename from code/hydrogenflux_cahnhilliard.f90 rename to src/hydrogenflux_cahnhilliard.f90 diff --git a/code/hydrogenflux_isoconc.f90 b/src/hydrogenflux_isoconc.f90 similarity index 100% rename from code/hydrogenflux_isoconc.f90 rename to src/hydrogenflux_isoconc.f90 diff --git a/code/kinematics_cleavage_opening.f90 b/src/kinematics_cleavage_opening.f90 similarity index 100% rename from code/kinematics_cleavage_opening.f90 rename to src/kinematics_cleavage_opening.f90 diff --git a/code/kinematics_hydrogen_strain.f90 b/src/kinematics_hydrogen_strain.f90 similarity index 100% rename from code/kinematics_hydrogen_strain.f90 rename to src/kinematics_hydrogen_strain.f90 diff --git a/code/kinematics_slipplane_opening.f90 b/src/kinematics_slipplane_opening.f90 similarity index 100% rename from code/kinematics_slipplane_opening.f90 rename to src/kinematics_slipplane_opening.f90 diff --git a/code/kinematics_thermal_expansion.f90 b/src/kinematics_thermal_expansion.f90 similarity index 100% rename from code/kinematics_thermal_expansion.f90 rename to src/kinematics_thermal_expansion.f90 diff --git a/code/kinematics_vacancy_strain.f90 b/src/kinematics_vacancy_strain.f90 similarity index 100% rename from code/kinematics_vacancy_strain.f90 rename to src/kinematics_vacancy_strain.f90 diff --git a/code/lattice.f90 b/src/lattice.f90 similarity index 97% rename from code/lattice.f90 rename to src/lattice.f90 index 06f9c84d9..7726c772d 100644 --- a/code/lattice.f90 +++ b/src/lattice.f90 @@ -18,7 +18,7 @@ module lattice LATTICE_maxNtwinFamily = 4_pInt, & !< max # of twin system families over lattice structures LATTICE_maxNtransFamily = 2_pInt, & !< max # of transformation system families over lattice structures LATTICE_maxNcleavageFamily = 3_pInt !< max # of transformation system families over lattice structures - + integer(pInt), allocatable, dimension(:,:), protected, public :: & lattice_NslipSystem, & !< total # of slip systems in each family lattice_NtwinSystem, & !< total # of twin systems in each family @@ -26,22 +26,22 @@ module lattice lattice_NcleavageSystem !< total # of transformation systems in each family integer(pInt), allocatable, dimension(:,:,:), protected, public :: & - lattice_interactionSlipSlip, & !< Slip--slip interaction type - lattice_interactionSlipTwin, & !< Slip--twin interaction type - lattice_interactionTwinSlip, & !< Twin--slip interaction type - lattice_interactionTwinTwin, & !< Twin--twin interaction type - lattice_interactionSlipTrans, & !< Slip--trans interaction type - lattice_interactionTransSlip, & !< Trans--slip interaction type + lattice_interactionSlipSlip, & !< Slip--slip interaction type + lattice_interactionSlipTwin, & !< Slip--twin interaction type + lattice_interactionTwinSlip, & !< Twin--slip interaction type + lattice_interactionTwinTwin, & !< Twin--twin interaction type + lattice_interactionSlipTrans, & !< Slip--trans interaction type + lattice_interactionTransSlip, & !< Trans--slip interaction type lattice_interactionTransTrans !< Trans--trans interaction type real(pReal), allocatable, dimension(:,:,:,:,:), protected, public :: & lattice_Sslip, & !< Schmid and non-Schmid matrices lattice_Scleavage !< Schmid matrices for cleavage systems - + real(pReal), allocatable, dimension(:,:,:,:), protected, public :: & lattice_Sslip_v, & !< Mandel notation of lattice_Sslip lattice_Scleavage_v !< Mandel notation of lattice_Scleavege - + real(pReal), allocatable, dimension(:,:,:), protected, public :: & lattice_sn, & !< normal direction of slip system lattice_sd, & !< slip direction of slip system @@ -75,25 +75,25 @@ module lattice !-------------------------------------------------------------------------------------------------- ! face centered cubic - integer(pInt), dimension(LATTICE_maxNslipFamily), parameter, public :: & + integer(pInt), dimension(LATTICE_maxNslipFamily), parameter, public :: & LATTICE_fcc_NslipSystem = int([12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],pInt) !< # of slip systems per family for fcc - + integer(pInt), dimension(LATTICE_maxNtwinFamily), parameter, public :: & LATTICE_fcc_NtwinSystem = int([12, 0, 0, 0],pInt) !< # of twin systems per family for fcc integer(pInt), dimension(LATTICE_maxNtransFamily), parameter, public :: & LATTICE_fcc_NtransSystem = int([12, 0],pInt) !< # of transformation systems per family for fcc - + integer(pInt), dimension(LATTICE_maxNcleavageFamily), parameter, public :: & LATTICE_fcc_NcleavageSystem = int([3, 4, 0],pInt) !< # of cleavage systems per family for fcc - + integer(pInt), parameter, private :: & LATTICE_fcc_Nslip = 12_pInt, & !sum(lattice_fcc_NslipSystem), & !< total # of slip systems for fcc LATTICE_fcc_Ntwin = 12_pInt, & !sum(lattice_fcc_NtwinSystem), & !< total # of twin systems for fcc LATTICE_fcc_NnonSchmid = 0_pInt, & !< total # of non-Schmid contributions for fcc LATTICE_fcc_Ntrans = 12_pInt, & !sum(lattice_fcc_NtransSystem), & !< total # of transformation systems for fcc LATTICE_fcc_Ncleavage = 7_pInt !sum(lattice_fcc_NcleavageSystem) !< total # of cleavage systems for fcc - + real(pReal), dimension(3+3,LATTICE_fcc_Nslip), parameter, private :: & LATTICE_fcc_systemSlip = reshape(real([& ! Slip direction Plane normal @@ -254,10 +254,10 @@ module lattice 2,2,2,2,2,2,2,2,2,1,1,1, & 2,2,2,2,2,2,2,2,2,1,1,1 & ],pInt),[LATTICE_fcc_Ntrans,LATTICE_fcc_Ntrans],order=[2,1]) !< Trans--trans interaction types for fcc - + real(pReal), dimension(LATTICE_fcc_Ntrans), parameter, private :: & LATTICE_fccTohex_shearTrans = sqrt(2.0_pReal)/4.0_pReal - + real(pReal), dimension(4,LATTICE_fcc_Ntrans), parameter, private :: & LATTICE_fccTobcc_systemTrans = reshape([& 0.0, 1.0, 0.0, 10.26, & ! Pitsch OR (Ma & Hartmaier 2014, Table 3) @@ -287,7 +287,7 @@ module lattice 0, 0, 1, 1, 0, 0, 0, 1, 0, & 0, 0, 1, 1, 0, 0, 0, 1, 0, & 0, 0, 1, 1, 0, 0, 0, 1, 0, & - 0, 0, 1, 1, 0, 0, 0, 1, 0 & + 0, 0, 1, 1, 0, 0, 0, 1, 0 & ],pInt),[ 9_pInt, LATTICE_fcc_Ntrans]) real(pReal), dimension(4,LATTICE_fcc_Ntrans), parameter, private :: & @@ -308,7 +308,7 @@ module lattice real(pReal), dimension(LATTICE_fcc_Ntrans,LATTICE_fcc_Ntrans), parameter, private :: & ! Matrix for projection of shear from slip system to fault-band (twin) systems LATTICE_fccTobcc_projectionTrans = reshape(real([& ! For ns = nt = nr - 0, 1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, & + 0, 1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, & -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, & 1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & 0, 0, 0, 0, 1,-1, 0, 0, 0, 0, 0, 0, & @@ -357,10 +357,10 @@ module lattice ],pReal),[ 3_pInt + 3_pInt,LATTICE_fcc_Ncleavage]) !-------------------------------------------------------------------------------------------------- -! body centered cubic +! body centered cubic integer(pInt), dimension(LATTICE_maxNslipFamily), parameter, public :: & LATTICE_bcc_NslipSystem = int([ 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], pInt) !< # of slip systems per family for bcc - + integer(pInt), dimension(LATTICE_maxNtwinFamily), parameter, public :: & LATTICE_bcc_NtwinSystem = int([ 12, 0, 0, 0], pInt) !< # of twin systems per family for bcc @@ -369,7 +369,7 @@ module lattice integer(pInt), dimension(LATTICE_maxNcleavageFamily), parameter, public :: & LATTICE_bcc_NcleavageSystem = int([3,6,0],pInt) !< # of cleavage systems per family for bcc - + integer(pInt), parameter, private :: & LATTICE_bcc_Nslip = 24_pInt, & !sum(lattice_bcc_NslipSystem), & !< total # of slip systems for bcc LATTICE_bcc_Ntwin = 12_pInt, & !sum(lattice_bcc_NtwinSystem), & !< total # of twin systems for bcc @@ -380,7 +380,7 @@ module lattice real(pReal), dimension(3+3,LATTICE_bcc_Nslip), parameter, private :: & LATTICE_bcc_systemSlip = reshape(real([& ! Slip direction Plane normal - ! Slip system <111>{110} + ! Slip system <111>{110} 1,-1, 1, 0, 1, 1, & -1,-1, 1, 0, 1, 1, & 1, 1, 1, 0,-1, 1, & @@ -455,7 +455,7 @@ module lattice integer(pInt), dimension(LATTICE_bcc_Nslip,LATTICE_bcc_Nslip), parameter, public :: & LATTICE_bcc_interactionSlipSlip = reshape(int( [& - 1,2,6,6,5,4,4,3,4,3,5,4, 6,6,4,3,3,4,6,6,4,3,6,6, & ! ---> slip + 1,2,6,6,5,4,4,3,4,3,5,4, 6,6,4,3,3,4,6,6,4,3,6,6, & ! ---> slip 2,1,6,6,4,3,5,4,5,4,4,3, 6,6,3,4,4,3,6,6,3,4,6,6, & ! | 6,6,1,2,4,5,3,4,4,5,3,4, 4,3,6,6,6,6,3,4,6,6,4,3, & ! | 6,6,2,1,3,4,4,5,3,4,4,5, 3,4,6,6,6,6,4,3,6,6,3,4, & ! v slip @@ -492,7 +492,7 @@ module lattice 3,3,3,2,2,3,3,3,3,2,3,3, & ! ---> twin 3,3,2,3,3,2,3,3,2,3,3,3, & ! | 3,2,3,3,3,3,2,3,3,3,3,2, & ! | - 2,3,3,3,3,3,3,2,3,3,2,3, & ! v slip + 2,3,3,3,3,3,3,2,3,3,2,3, & ! v slip 2,3,3,3,3,3,3,2,3,3,2,3, & 3,3,2,3,3,2,3,3,2,3,3,3, & 3,2,3,3,3,3,2,3,3,3,3,2, & @@ -556,17 +556,17 @@ module lattice !-------------------------------------------------------------------------------------------------- ! hexagonal integer(pInt), dimension(LATTICE_maxNslipFamily), parameter, public :: & - lattice_hex_NslipSystem = int([ 3, 3, 3, 6, 12, 6, 0, 0, 0, 0, 0, 0, 0],pInt) !< # of slip systems per family for hex - + lattice_hex_NslipSystem = int([ 3, 3, 3, 6, 12, 6, 0, 0, 0, 0, 0, 0, 0],pInt) !< # of slip systems per family for hex + integer(pInt), dimension(LATTICE_maxNtwinFamily), parameter, public :: & - lattice_hex_NtwinSystem = int([ 6, 6, 6, 6],pInt) !< # of slip systems per family for hex + lattice_hex_NtwinSystem = int([ 6, 6, 6, 6],pInt) !< # of slip systems per family for hex integer(pInt), dimension(LATTICE_maxNtransFamily), parameter, public :: & LATTICE_hex_NtransSystem = int([0,0],pInt) !< # of transformation systems per family for hex - + integer(pInt), dimension(LATTICE_maxNcleavageFamily), parameter, public :: & LATTICE_hex_NcleavageSystem = int([3,0,0],pInt) !< # of cleavage systems per family for hex - + integer(pInt), parameter, private :: & LATTICE_hex_Nslip = 33_pInt, & !sum(lattice_hex_NslipSystem), & !< total # of slip systems for hex LATTICE_hex_Ntwin = 24_pInt, & !sum(lattice_hex_NtwinSystem), & !< total # of twin systems for hex @@ -577,26 +577,26 @@ module lattice real(pReal), dimension(4+4,LATTICE_hex_Nslip), parameter, private :: & LATTICE_hex_systemSlip = reshape(real([& ! Slip direction Plane normal - ! Basal systems <11.0>{00.1} (independent of c/a-ratio, Bravais notation (4 coordinate base)) + ! Basal systems <11.0>{00.1} (independent of c/a-ratio, Bravais notation (4 coordinate base)) 2, -1, -1, 0, 0, 0, 0, 1, & -1, 2, -1, 0, 0, 0, 0, 1, & -1, -1, 2, 0, 0, 0, 0, 1, & - ! 1st type prismatic systems <11.0>{10.0} (independent of c/a-ratio) + ! 1st type prismatic systems <11.0>{10.0} (independent of c/a-ratio) 2, -1, -1, 0, 0, 1, -1, 0, & -1, 2, -1, 0, -1, 0, 1, 0, & -1, -1, 2, 0, 1, -1, 0, 0, & - ! 2nd type prismatic systems <10.0>{11.0} -- a slip; plane normals independent of c/a-ratio + ! 2nd type prismatic systems <10.0>{11.0} -- a slip; plane normals independent of c/a-ratio 0, 1, -1, 0, 2, -1, -1, 0, & -1, 0, 1, 0, -1, 2, -1, 0, & 1, -1, 0, 0, -1, -1, 2, 0, & - ! 1st type 1st order pyramidal systems <11.0>{-11.1} -- plane normals depend on the c/a-ratio + ! 1st type 1st order pyramidal systems <11.0>{-11.1} -- plane normals depend on the c/a-ratio 2, -1, -1, 0, 0, 1, -1, 1, & -1, 2, -1, 0, -1, 0, 1, 1, & -1, -1, 2, 0, 1, -1, 0, 1, & 1, 1, -2, 0, -1, 1, 0, 1, & -2, 1, 1, 0, 0, -1, 1, 1, & 1, -2, 1, 0, 1, 0, -1, 1, & - ! pyramidal system: c+a slip <11.3>{-10.1} -- plane normals depend on the c/a-ratio + ! pyramidal system: c+a slip <11.3>{-10.1} -- plane normals depend on the c/a-ratio 2, -1, -1, 3, -1, 1, 0, 1, & 1, -2, 1, 3, -1, 1, 0, 1, & -1, -1, 2, 3, 1, 0, -1, 1, & @@ -609,7 +609,7 @@ module lattice 2, -1, -1, 3, -1, 0, 1, 1, & 1, -2, 1, 3, 0, 1, -1, 1, & -1, -1, 2, 3, 0, 1, -1, 1, & - ! pyramidal system: c+a slip <11.3>{-1-1.2} -- as for hexagonal ice (Castelnau et al. 1996, similar to twin system found below) + ! pyramidal system: c+a slip <11.3>{-1-1.2} -- as for hexagonal ice (Castelnau et al. 1996, similar to twin system found below) 2, -1, -1, 3, -2, 1, 1, 2, & ! sorted according to similar twin system -1, 2, -1, 3, 1, -2, 1, 2, & ! <11.3>{-1-1.2} shear = 2((c/a)^2-2)/(3 c/a) -1, -1, 2, 3, 1, 1, -2, 2, & @@ -648,7 +648,7 @@ module lattice -2, 1, 1, -3, -2, 1, 1, 2, & 1, -2, 1, -3, 1, -2, 1, 2, & 1, 1, -2, -3, 1, 1, -2, 2 & - ],pReal),[ 4_pInt + 4_pInt ,LATTICE_hex_Ntwin]) !< twin systems for hex, order follows Prof. Tom Bieler's scheme; but numbering in data was restarted from 1 + ],pReal),[ 4_pInt + 4_pInt ,LATTICE_hex_Ntwin]) !< twin systems for hex, order follows Prof. Tom Bieler's scheme; but numbering in data was restarted from 1 integer(pInt), dimension(LATTICE_hex_Ntwin), parameter, private :: & LATTICE_hex_shearTwin = reshape(int( [& ! indicator to formula further below @@ -677,7 +677,7 @@ module lattice 4, & 4 & ],pInt),[LATTICE_hex_Ntwin]) - + integer(pInt), dimension(LATTICE_hex_Nslip,LATTICE_hex_Nslip), parameter, public :: & LATTICE_hex_interactionSlipSlip = reshape(int( [& 1, 2, 2, 3, 3, 3, 7, 7, 7, 13,13,13,13,13,13, 21,21,21,21,21,21,21,21,21,21,21,21, 31,31,31,31,31,31, & ! ---> slip @@ -717,10 +717,10 @@ module lattice 42,42,42, 41,41,41, 40,40,40, 39,39,39,39,39,39, 38,38,38,38,38,38,38,38,38,38,38,38, 37,37,36,37,37,37, & 42,42,42, 41,41,41, 40,40,40, 39,39,39,39,39,39, 38,38,38,38,38,38,38,38,38,38,38,38, 37,37,37,36,37,37, & 42,42,42, 41,41,41, 40,40,40, 39,39,39,39,39,39, 38,38,38,38,38,38,38,38,38,38,38,38, 37,37,37,37,36,37, & - 42,42,42, 41,41,41, 40,40,40, 39,39,39,39,39,39, 38,38,38,38,38,38,38,38,38,38,38,38, 37,37,37,37,37,36 & + 42,42,42, 41,41,41, 40,40,40, 39,39,39,39,39,39, 38,38,38,38,38,38,38,38,38,38,38,38, 37,37,37,37,37,36 & ! ],pInt),[LATTICE_hex_Nslip,LATTICE_hex_Nslip],order=[2,1]) !< Slip--slip interaction types for hex (onion peel naming scheme) - + integer(pInt), dimension(LATTICE_hex_Nslip,LATTICE_hex_Ntwin), parameter, public :: & LATTICE_hex_interactionSlipTwin = reshape(int( [& 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, & ! --> twin @@ -728,7 +728,7 @@ module lattice 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, & ! | ! v 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, & ! slip - 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, & + 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, & 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, & ! 9, 9, 9, 9, 9, 9, 10,10,10,10,10,10, 11,11,11,11,11,11, 12,12,12,12,12,12, & @@ -762,7 +762,7 @@ module lattice 21,21,21,21,21,21, 22,22,22,22,22,22, 23,23,23,23,23,23, 24,24,24,24,24,24, & 21,21,21,21,21,21, 22,22,22,22,22,22, 23,23,23,23,23,23, 24,24,24,24,24,24 & ! - ],pInt),[LATTICE_hex_Nslip,LATTICE_hex_Ntwin],order=[2,1]) !< Slip--twin interaction types for hex (isotropic, 24 in total) + ],pInt),[LATTICE_hex_Nslip,LATTICE_hex_Ntwin],order=[2,1]) !< Slip--twin interaction types for hex (isotropic, 24 in total) integer(pInt), dimension(LATTICE_hex_Ntwin,LATTICE_hex_Nslip), parameter, public :: & LATTICE_hex_interactionTwinSlip = reshape(int( [& @@ -848,14 +848,14 @@ module lattice integer(pInt), dimension(LATTICE_maxNcleavageFamily), parameter, public :: & LATTICE_bct_NcleavageSystem = int([0,0,0],pInt) !< # of cleavage systems per family for bct - + integer(pInt), parameter, private :: & LATTICE_bct_Nslip = 52_pInt, & !sum(lattice_bct_NslipSystem), & !< total # of slip systems for bct LATTICE_bct_Ntwin = 0_pInt, & !sum(lattice_bct_NtwinSystem), & !< total # of twin systems for bct LATTICE_bct_NnonSchmid = 0_pInt, & !< total # of non-Schmid contributions for bct LATTICE_bct_Ntrans = 0_pInt, & !sum(lattice_bct_NtransSystem), & !< total # of transformation systems for bct LATTICE_bct_Ncleavage = 0_pInt !sum(lattice_bct_NcleavageSystem) !< total # of cleavage systems for bct - + real(pReal), dimension(3+3,LATTICE_bct_Nslip), parameter, private :: & LATTICE_bct_systemSlip = reshape(real([& ! Slip direction Plane normal @@ -865,7 +865,7 @@ module lattice ! Slip family 2 {110)<001] 0, 0, 1, 1, 1, 0, & 0, 0, 1, -1, 1, 0, & - ! slip family 3 {100)<010] + ! slip family 3 {100)<010] 0, 1, 0, 1, 0, 0, & 1, 0, 0, 0, 1, 0, & ! Slip family 4 {110)<1-11]/2 @@ -876,54 +876,54 @@ module lattice ! Slip family 5 {110)<1-10] 1, -1, 0, 1, 1, 0, & 1, 1, 0, 1,-1, 0, & - ! Slip family 6 {100)<011] + ! Slip family 6 {100)<011] 0, 1, 1, 1, 0, 0, & 0,-1, 1, 1, 0, 0, & -1, 0, 1, 0, 1, 0, & - 1, 0, 1, 0, 1, 0, & - ! Slip family 7 {001)<010] + 1, 0, 1, 0, 1, 0, & + ! Slip family 7 {001)<010] 0, 1, 0, 0, 0, 1, & 1, 0, 0, 0, 0, 1, & - ! Slip family 8 {001)<110] + ! Slip family 8 {001)<110] 1, 1, 0, 0, 0, 1, & - -1, 1, 0, 0, 0, 1, & - ! Slip family 9 {011)<01-1] + -1, 1, 0, 0, 0, 1, & + ! Slip family 9 {011)<01-1] 0, 1,-1, 0, 1, 1, & 0,-1,-1, 0,-1, 1, & -1, 0,-1, -1, 0, 1, & - 1, 0,-1, 1, 0, 1, & - ! Slip family 10 {011)<1-11]/2 + 1, 0,-1, 1, 0, 1, & + ! Slip family 10 {011)<1-11]/2 1,-1, 1, 0, 1, 1, & 1, 1,-1, 0, 1, 1, & 1, 1, 1, 0, 1,-1, & - -1, 1, 1, 0, 1,-1, & + -1, 1, 1, 0, 1,-1, & 1,-1,-1, 1, 0, 1, & -1,-1, 1, 1, 0, 1, & 1, 1, 1, 1, 0,-1, & - 1,-1, 1, 1, 0,-1, & - ! Slip family 11 {011)<100] + 1,-1, 1, 1, 0,-1, & + ! Slip family 11 {011)<100] 1, 0, 0, 0, 1, 1, & 1, 0, 0, 0, 1,-1, & 0, 1, 0, 1, 0, 1, & - 0, 1, 0, 1, 0,-1, & - ! Slip family 12 {211)<01-1] + 0, 1, 0, 1, 0,-1, & + ! Slip family 12 {211)<01-1] 0, 1,-1, 2, 1, 1, & 0,-1,-1, 2,-1, 1, & 1, 0,-1, 1, 2, 1, & - -1, 0,-1, -1, 2, 1, & + -1, 0,-1, -1, 2, 1, & 0, 1,-1, -2, 1, 1, & 0,-1,-1, -2,-1, 1, & -1, 0,-1, -1,-2, 1, & - 1, 0,-1, 1,-2, 1, & - ! Slip family 13 {211)<-111]/2 + 1, 0,-1, 1,-2, 1, & + ! Slip family 13 {211)<-111]/2 -1, 1, 1, 2, 1, 1, & -1,-1, 1, 2,-1, 1, & 1,-1, 1, 1, 2, 1, & - -1,-1, 1, -1, 2, 1, & + -1,-1, 1, -1, 2, 1, & 1, 1, 1, -2, 1, 1, & 1,-1, 1, -2,-1, 1, & -1, 1, 1, -1,-2, 1, & - 1, 1, 1, 1,-2, 1 & + 1, 1, 1, 1,-2, 1 & ],pReal),[ 3_pInt + 3_pInt,LATTICE_bct_Nslip]) !< slip systems for bct sorted by Bieler integer(pInt), dimension(LATTICE_bct_Nslip,LATTICE_bct_Nslip), parameter, public :: & @@ -933,7 +933,7 @@ module lattice ! 6, 6, 4, 5, 8, 8, 14, 14, 14, 14, 22, 22, 32, 32, 32, 32, 44, 44, 58, 58, 74, 74, 74, 74, 92, 92, 92, 92, 92, 92, 92, 92, 112, 112, 112, 112, 134,134,134,134,134,134,134,134, 158,158,158,158,158,158,158,158, & 6, 6, 5, 4, 8, 8, 14, 14, 14, 14, 22, 22, 32, 32, 32, 32, 44, 44, 58, 58, 74, 74, 74, 74, 92, 92, 92, 92, 92, 92, 92, 92, 112, 112, 112, 112, 134,134,134,134,134,134,134,134, 158,158,158,158,158,158,158,158, & - ! + ! 12, 12, 11, 11, 9, 10, 15, 15, 15, 15, 23, 23, 33, 33, 33, 33, 45, 45, 59, 59, 75, 75, 75, 75, 93, 93, 93, 93, 93, 93, 93, 93, 113, 113, 113, 113, 135,135,135,135,135,135,135,135, 159,159,159,159,159,159,159,159, & 12, 12, 11, 11, 10, 9, 15, 15, 15, 15, 23, 23, 33, 33, 33, 33, 45, 45, 59, 59, 75, 75, 75, 75, 93, 93, 93, 93, 93, 93, 93, 93, 113, 113, 113, 113, 135,135,135,135,135,135,135,135, 159,159,159,159,159,159,159,159, & ! @@ -993,7 +993,7 @@ module lattice 182,182, 181,181, 180,180, 179,179,179,179, 178,178, 177,177,177,177, 176,176, 175,175, 174,174,174,174, 173,173,173,173,173,173,173,173, 172, 172, 172, 172, 171,171,171,171,171,171,171,171, 169,170,170,170,170,170,169,170, & 182,182, 181,181, 180,180, 179,179,179,179, 178,178, 177,177,177,177, 176,176, 175,175, 174,174,174,174, 173,173,173,173,173,173,173,173, 172, 172, 172, 172, 171,171,171,171,171,171,171,171, 169,170,170,170,170,170,170,169 & - ],pInt),[lattice_bct_Nslip,lattice_bct_Nslip],order=[2,1]) + ],pInt),[lattice_bct_Nslip,lattice_bct_Nslip],order=[2,1]) !-------------------------------------------------------------------------------------------------- ! isotropic @@ -1008,14 +1008,14 @@ module lattice integer(pInt), dimension(LATTICE_maxNcleavageFamily), parameter, public :: & LATTICE_iso_NcleavageSystem = int([3,0,0],pInt) !< # of cleavage systems per family for iso - + integer(pInt), parameter, private :: & LATTICE_iso_Nslip = 0_pInt, & !sum(lattice_iso_NslipSystem), & !< total # of slip systems for iso LATTICE_iso_Ntwin = 0_pInt, & !sum(lattice_iso_NtwinSystem), & !< total # of twin systems for iso LATTICE_iso_NnonSchmid = 0_pInt, & !< total # of non-Schmid contributions for iso LATTICE_iso_Ntrans = 0_pInt, & !sum(lattice_iso_NtransSystem), & !< total # of transformation systems for iso LATTICE_iso_Ncleavage = 3_pInt !sum(lattice_iso_NcleavageSystem) !< total # of cleavage systems for iso - + real(pReal), dimension(3+3,LATTICE_iso_Ncleavage), parameter, private :: & LATTICE_iso_systemCleavage = reshape(real([& ! Cleavage direction Plane normal @@ -1037,14 +1037,14 @@ module lattice integer(pInt), dimension(LATTICE_maxNcleavageFamily), parameter, public :: & LATTICE_ortho_NcleavageSystem = int([1,1,1],pInt) !< # of cleavage systems per family for ortho - + integer(pInt), parameter, private :: & LATTICE_ortho_Nslip = 0_pInt, & !sum(lattice_ortho_NslipSystem), & !< total # of slip systems for ortho LATTICE_ortho_Ntwin = 0_pInt, & !sum(lattice_ortho_NtwinSystem), & !< total # of twin systems for ortho LATTICE_ortho_NnonSchmid = 0_pInt, & !< total # of non-Schmid contributions for ortho LATTICE_ortho_Ntrans = 0_pInt, & !sum(lattice_ortho_NtransSystem), & !< total # of transformation systems for ortho LATTICE_ortho_Ncleavage = 3_pInt !sum(lattice_ortho_NcleavageSystem) !< total # of cleavage systems for ortho - + real(pReal), dimension(3+3,LATTICE_ortho_Ncleavage), parameter, private :: & LATTICE_ortho_systemCleavage = reshape(real([& ! Cleavage direction Plane normal @@ -1075,14 +1075,14 @@ module lattice real(pReal), dimension(:,:,:), allocatable, public, protected :: & lattice_C66, lattice_trans_C66 - real(pReal), dimension(:,:,:,:,:), allocatable, public, protected :: & + real(pReal), dimension(:,:,:,:,:), allocatable, public, protected :: & lattice_C3333, lattice_trans_C3333 - real(pReal), dimension(:), allocatable, public, protected :: & + real(pReal), dimension(:), allocatable, public, protected :: & lattice_mu, & lattice_nu, & lattice_trans_mu, & lattice_trans_nu - real(pReal), dimension(:,:,:), allocatable, public, protected :: & + real(pReal), dimension(:,:,:), allocatable, public, protected :: & lattice_thermalConductivity33, & lattice_thermalExpansion33, & lattice_damageDiffusion33, & @@ -1091,7 +1091,7 @@ module lattice lattice_porosityDiffusion33, & lattice_hydrogenfluxDiffusion33, & lattice_hydrogenfluxMobility33 - real(pReal), dimension(:), allocatable, public, protected :: & + real(pReal), dimension(:), allocatable, public, protected :: & lattice_damageMobility, & lattice_porosityMobility, & lattice_massDensity, & @@ -1120,7 +1120,7 @@ module lattice integer(pInt), dimension(2), parameter, private :: & - lattice_NsymOperations = [24_pInt,12_pInt] + lattice_NsymOperations = [24_pInt,12_pInt] real(pReal), dimension(4,36), parameter, private :: & lattice_symOperations = reshape([& @@ -1266,9 +1266,7 @@ subroutine lattice_init debug_level, & debug_lattice, & debug_levelBasic - use numerics, only: & - worldrank - + implicit none integer(pInt), parameter :: FILEUNIT = 200_pInt integer(pInt) :: Nphases @@ -1279,15 +1277,13 @@ subroutine lattice_init integer(pInt) :: section = 0_pInt,i real(pReal), dimension(:), allocatable :: & CoverA, & !!!!!!< c/a ratio for low symmetry type lattice - CoverA_trans, & !< c/a ratio for transformed hex type lattice + CoverA_trans, & !< c/a ratio for transformed hex type lattice a_fcc, & !< lattice parameter a for fcc austenite a_bcc !< lattice paramater a for bcc martensite - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- lattice init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- lattice init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess !-------------------------------------------------------------------------------------------------- ! consistency checks (required since ifort 15.0 does not support sum/maxval in parameter definition) @@ -1373,7 +1369,7 @@ subroutine lattice_init if (iand(debug_level(debug_lattice),debug_levelBasic) /= 0_pInt) then write(6,'(a16,1x,i5)') ' # phases:',Nphases endif - + allocate(lattice_structure(Nphases),source = LATTICE_undefined_ID) allocate(trans_lattice_structure(Nphases),source = LATTICE_undefined_ID) allocate(lattice_C66(6,6,Nphases), source=0.0_pReal) @@ -1461,7 +1457,7 @@ subroutine lattice_init if (IO_isBlank(line)) cycle ! skip empty lines if (IO_getTag(line,'<','>') /= '') then ! stop at next part line = IO_read(fileUnit, .true.) ! reset IO_read - exit + exit endif if (IO_getTag(line,'[',']') /= '') then ! next section section = section + 1_pInt @@ -1615,7 +1611,7 @@ subroutine lattice_init end select endif enddo - + do i = 1_pInt,Nphases if ((CoverA(i) < 1.0_pReal .or. CoverA(i) > 2.0_pReal) & .and. lattice_structure(i) == LATTICE_hex_ID) call IO_error(131_pInt,el=i) ! checking physical significance of c/a @@ -1652,7 +1648,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) use IO, only: & IO_error, & IO_warning - + implicit none integer(pInt), intent(in) :: myPhase real(pReal), intent(in) :: & @@ -1689,7 +1685,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) lattice_C66(1:6,1:6,myPhase) = lattice_symmetrizeC66(lattice_structure(myPhase),& lattice_C66(1:6,1:6,myPhase)) - + lattice_mu(myPhase) = 0.2_pReal *( lattice_C66(1,1,myPhase) & - lattice_C66(1,2,myPhase) & + 3.0_pReal*lattice_C66(4,4,myPhase)) ! (C11iso-C12iso)/2 with C11iso=(3*C11+2*C12+4*C44)/5 and C12iso=(C11+4*C12-2*C44)/5 @@ -1718,7 +1714,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) lattice_trans_C66(1:6,1:6,myPhase) = math_Mandel3333to66(lattice_trans_C3333(1:3,1:3,1:3,1:3,myPhase)) do i = 1_pInt, 6_pInt if (abs(lattice_trans_C66(i,i,myPhase))bcc transformation') enddo case (LATTICE_hex_ID) c11bar = (lattice_C66(1,1,myPhase) + lattice_C66(1,2,myPhase) + 2.0_pReal*lattice_C66(4,4,myPhase))/2.0_pReal @@ -1735,7 +1731,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) lattice_trans_C66(1,3,myPhase) = c13bar lattice_trans_C66(3,3,myPhase) = c33bar lattice_trans_C66(4,4,myPhase) = c44bar - B - + lattice_trans_C66(1:6,1:6,myPhase) = lattice_symmetrizeC66(trans_lattice_structure(myPhase),& lattice_trans_C66(1:6,1:6,myPhase)) lattice_trans_mu(myPhase) = 0.2_pReal *( lattice_trans_C66(1,1,myPhase) & @@ -1751,7 +1747,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) lattice_trans_C66(1:6,1:6,myPhase) = math_Mandel3333to66(lattice_trans_C3333(1:3,1:3,1:3,1:3,myPhase)) do i = 1_pInt, 6_pInt if (abs(lattice_trans_C66(i,i,myPhase))hex transformation') enddo end select end select @@ -1772,7 +1768,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) lattice_hydrogenfluxDiffusion33(1:3,1:3,myPhase)) lattice_hydrogenfluxMobility33(1:3,1:3,myPhase) = lattice_symmetrize33(lattice_structure(myPhase),& lattice_hydrogenfluxMobility33(1:3,1:3,myPhase)) - + select case(lattice_structure(myPhase)) !-------------------------------------------------------------------------------------------------- ! fcc @@ -1784,7 +1780,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) do i = 1_pInt,myNslip ! assign slip system vectors sd(1:3,i) = lattice_fcc_systemSlip(1:3,i) sn(1:3,i) = lattice_fcc_systemSlip(4:6,i) - enddo + enddo do i = 1_pInt,myNtwin ! assign twin system vectors and shears td(1:3,i) = lattice_fcc_systemTwin(1:3,i) tn(1:3,i) = lattice_fcc_systemTwin(4:6,i) @@ -1794,11 +1790,11 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) cd(1:3,i) = lattice_fcc_systemCleavage(1:3,i)/norm2(lattice_fcc_systemCleavage(1:3,i)) cn(1:3,i) = lattice_fcc_systemCleavage(4:6,i)/norm2(lattice_fcc_systemCleavage(4:6,i)) ct(1:3,i) = math_crossproduct(cd(1:3,i),cn(1:3,i)) - enddo + enddo ! Phase transformation select case(trans_lattice_structure(myPhase)) - case (LATTICE_bcc_ID) ! fcc to bcc transformation + case (LATTICE_bcc_ID) ! fcc to bcc transformation do i = 1_pInt,myNtrans Rtr(1:3,1:3,i) = math_axisAngleToR(lattice_fccTobcc_systemTrans(1:3,i), & ! Pitsch rotation lattice_fccTobcc_systemTrans(4,i)*INRAD) @@ -1894,7 +1890,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) cd(1:3,i) = lattice_bcc_systemCleavage(1:3,i)/norm2(lattice_bcc_systemCleavage(1:3,i)) cn(1:3,i) = lattice_bcc_systemCleavage(4:6,i)/norm2(lattice_bcc_systemCleavage(4:6,i)) ct(1:3,i) = math_crossproduct(cd(1:3,i),cn(1:3,i)) - enddo + enddo lattice_NslipSystem(1:lattice_maxNslipFamily,myPhase) = lattice_bcc_NslipSystem lattice_NtwinSystem(1:lattice_maxNtwinFamily,myPhase) = lattice_bcc_NtwinSystem lattice_NtransSystem(1:lattice_maxNtransFamily,myPhase) = lattice_bcc_NtransSystem @@ -1904,7 +1900,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) lattice_interactionSlipTwin(1:myNslip,1:myNtwin,myPhase) = lattice_bcc_interactionSlipTwin lattice_interactionTwinSlip(1:myNtwin,1:myNslip,myPhase) = lattice_bcc_interactionTwinSlip lattice_interactionTwinTwin(1:myNtwin,1:myNtwin,myPhase) = lattice_bcc_interactionTwinTwin - + !-------------------------------------------------------------------------------------------------- ! hex (including conversion from miller-bravais (a1=a2=a3=c) to miller (a, b, c) indices) case (LATTICE_hex_ID) @@ -1912,7 +1908,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) myNtwin = lattice_hex_Ntwin myNtrans = lattice_hex_Ntrans myNcleavage = lattice_hex_Ncleavage - do i = 1_pInt,myNslip ! assign slip system vectors + do i = 1_pInt,myNslip ! assign slip system vectors sd(1,i) = lattice_hex_systemSlip(1,i)*1.5_pReal ! direction [uvtw]->[3u/2 (u+2v)*sqrt(3)/2 w*(c/a)] sd(2,i) = (lattice_hex_systemSlip(1,i)+2.0_pReal*lattice_hex_systemSlip(2,i))*& 0.5_pReal*sqrt(3.0_pReal) @@ -1920,7 +1916,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) sn(1,i) = lattice_hex_systemSlip(5,i) ! plane (hkil)->(h (h+2k)/sqrt(3) l/(c/a)) sn(2,i) = (lattice_hex_systemSlip(5,i)+2.0_pReal*lattice_hex_systemSlip(6,i))/sqrt(3.0_pReal) sn(3,i) = lattice_hex_systemSlip(8,i)/CoverA - enddo + enddo do i = 1_pInt,myNtwin ! assign twin system vectors and shears td(1,i) = lattice_hex_systemTwin(1,i)*1.5_pReal td(2,i) = (lattice_hex_systemTwin(1,i)+2.0_pReal*lattice_hex_systemTwin(2,i))*& @@ -1940,7 +1936,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) ts(i) = 2.0_pReal*(CoverA*CoverA-2.0_pReal)/3.0_pReal/CoverA end select enddo - do i = 1_pInt, myNcleavage ! cleavage system vectors + do i = 1_pInt, myNcleavage ! cleavage system vectors cd(1,i) = lattice_hex_systemCleavage(1,i)*1.5_pReal ! direction [uvtw]->[3u/2 (u+2v)*sqrt(3)/2 w*(c/a)] cd(2,i) = (lattice_hex_systemCleavage(1,i)+2.0_pReal*lattice_hex_systemCleavage(2,i))*& 0.5_pReal*sqrt(3.0_pReal) @@ -1951,7 +1947,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) cn(3,i) = lattice_hex_systemCleavage(8,i)/CoverA cn(1:3,1) = cn(1:3,i)/norm2(cn(1:3,i)) ct(1:3,i) = math_crossproduct(cd(1:3,i),cn(1:3,i)) - enddo + enddo lattice_NslipSystem(1:lattice_maxNslipFamily,myPhase) = lattice_hex_NslipSystem lattice_NtwinSystem(1:lattice_maxNtwinFamily,myPhase) = lattice_hex_NtwinSystem lattice_NtransSystem(1:lattice_maxNtransFamily,myPhase) = lattice_hex_NtransSystem @@ -1994,7 +1990,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) cd(1:3,i) = lattice_iso_systemCleavage(1:3,i)/norm2(LATTICE_ortho_systemCleavage(1:3,i)) cn(1:3,i) = lattice_iso_systemCleavage(4:6,i)/norm2(LATTICE_ortho_systemCleavage(4:6,i)) ct(1:3,i) = math_crossproduct(cd(1:3,i),cn(1:3,i)) - enddo + enddo lattice_NcleavageSystem(1:lattice_maxNcleavageFamily,myPhase) = lattice_iso_NcleavageSystem !-------------------------------------------------------------------------------------------------- @@ -2008,7 +2004,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) cd(1:3,i) = lattice_iso_systemCleavage(1:3,i)/norm2(lattice_iso_systemCleavage(1:3,i)) cn(1:3,i) = lattice_iso_systemCleavage(4:6,i)/norm2(lattice_iso_systemCleavage(4:6,i)) ct(1:3,i) = math_crossproduct(cd(1:3,i),cn(1:3,i)) - enddo + enddo lattice_NcleavageSystem(1:lattice_maxNcleavageFamily,myPhase) = lattice_iso_NcleavageSystem !-------------------------------------------------------------------------------------------------- @@ -2028,7 +2024,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) do j = 1_pInt,lattice_NnonSchmid(myPhase) lattice_Sslip(1:3,1:3,2*j ,i,myPhase) = sns(1:3,1:3,1,j,i) lattice_Sslip(1:3,1:3,2*j+1,i,myPhase) = sns(1:3,1:3,2,j,i) - enddo + enddo do j = 1_pInt,1_pInt+2_pInt*lattice_NnonSchmid(myPhase) lattice_Sslip_v(1:6,j,i,myPhase) = & math_Mandel33to6(math_symmetric33(lattice_Sslip(1:3,1:3,j,i,myPhase))) @@ -2064,7 +2060,7 @@ subroutine lattice_initializeStructure(myPhase,CoverA,CoverA_trans,a_fcc,a_bcc) math_Mandel33to6(math_symmetric33(lattice_Scleavage(1:3,1:3,j,i,myPhase))) enddo enddo - + end subroutine lattice_initializeStructure @@ -2080,7 +2076,7 @@ pure function lattice_symmetrizeC66(struct,C66) integer(pInt) :: j,k lattice_symmetrizeC66 = 0.0_pReal - + select case(struct) case (LATTICE_iso_ID) forall(k=1_pInt:3_pInt) @@ -2093,7 +2089,7 @@ pure function lattice_symmetrizeC66(struct,C66) forall(j=1_pInt:3_pInt) lattice_symmetrizeC66(k,j) = C66(1,2) lattice_symmetrizeC66(k,k) = C66(1,1) lattice_symmetrizeC66(k+3_pInt,k+3_pInt) = C66(4,4) - end forall + end forall case (LATTICE_hex_ID) lattice_symmetrizeC66(1,1) = C66(1,1) lattice_symmetrizeC66(2,2) = C66(1,1) @@ -2136,7 +2132,7 @@ pure function lattice_symmetrizeC66(struct,C66) case default lattice_symmetrizeC66 = C66 end select - + end function lattice_symmetrizeC66 !-------------------------------------------------------------------------------------------------- @@ -2151,7 +2147,7 @@ pure function lattice_symmetrize33(struct,T33) integer(pInt) :: k lattice_symmetrize33 = 0.0_pReal - + select case(struct) case (LATTICE_iso_ID,LATTICE_fcc_ID,LATTICE_bcc_ID) forall(k=1_pInt:3_pInt) lattice_symmetrize33(k,k) = T33(1,1) @@ -2166,7 +2162,7 @@ pure function lattice_symmetrize33(struct,T33) case default lattice_symmetrize33 = T33 end select - + end function lattice_symmetrize33 @@ -2250,7 +2246,7 @@ pure function lattice_qDisorientation(Q1, Q2, struct) dQ = math_qMul(math_qConj(Q1),Q2) lattice_qDisorientation = dQ - select case(symmetry) + select case(symmetry) case (1_pInt,2_pInt) s = sum(lattice_NsymOperations(1:symmetry-1_pInt)) diff --git a/code/material.f90 b/src/material.f90 similarity index 99% rename from code/material.f90 rename to src/material.f90 index cd1d21808..a77c4871a 100644 --- a/code/material.f90 +++ b/src/material.f90 @@ -619,7 +619,7 @@ subroutine material_parseHomogenization(fileUnit,myPart) chunkPos = IO_stringPos(line) tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key select case(tag) - case ('type') + case ('type','mech','mechanical') select case (IO_lc(IO_stringValue(line,chunkPos,2_pInt))) case(HOMOGENIZATION_NONE_label) homogenization_type(section) = HOMOGENIZATION_NONE_ID @@ -729,6 +729,8 @@ end subroutine material_parseHomogenization !> @brief parses the microstructure part in the material configuration file !-------------------------------------------------------------------------------------------------- subroutine material_parseMicrostructure(fileUnit,myPart) + use prec, only: & + dNeq use IO use mesh, only: & mesh_element, & @@ -738,7 +740,6 @@ subroutine material_parseMicrostructure(fileUnit,myPart) character(len=*), intent(in) :: myPart integer(pInt), intent(in) :: fileUnit - integer(pInt), allocatable, dimension(:) :: chunkPos integer(pInt) :: Nsections, section, constituent, e, i character(len=65536) :: & @@ -758,7 +759,7 @@ subroutine material_parseMicrostructure(fileUnit,myPart) allocate(microstructure_elemhomo(Nsections), source=.false.) if(any(mesh_element(4,1:mesh_NcpElems) > Nsections)) & - call IO_error(155_pInt,ext_msg='Microstructure in geometry > Sections in material.config') + call IO_error(155_pInt,ext_msg='More microstructures in geometry than sections in material.config') forall (e = 1_pInt:mesh_NcpElems) microstructure_active(mesh_element(4,e)) = .true. ! current microstructure used in model? Elementwise view, maximum N operations for N elements @@ -801,7 +802,7 @@ subroutine material_parseMicrostructure(fileUnit,myPart) microstructure_crystallite(section) = IO_intValue(line,chunkPos,2_pInt) case ('(constituent)') constituent = constituent + 1_pInt - do i=2_pInt,6_pInt,2_pInt + do i = 2_pInt,6_pInt,2_pInt tag = IO_lc(IO_stringValue(line,chunkPos,i)) select case (tag) case('phase') @@ -816,6 +817,12 @@ subroutine material_parseMicrostructure(fileUnit,myPart) endif enddo + !sanity check +do section = 1_pInt, Nsections + if (dNeq(sum(microstructure_fraction(:,section)),1.0_pReal)) & + call IO_error(153_pInt,ext_msg=microstructure_name(section)) +enddo + end subroutine material_parseMicrostructure diff --git a/code/math.f90 b/src/math.f90 similarity index 99% rename from code/math.f90 rename to src/math.f90 index 315da2642..9629401ca 100644 --- a/code/math.f90 +++ b/src/math.f90 @@ -452,7 +452,6 @@ pure function math_tensorproduct(A,B) implicit none real(pReal), dimension(:), intent(in) :: A,B real(pReal), dimension(size(A,1),size(B,1)) :: math_tensorproduct - integer(pInt) :: i,j forall (i=1_pInt:size(A,1),j=1_pInt:size(B,1)) math_tensorproduct(i,j) = A(i)*B(j) @@ -1181,6 +1180,9 @@ end function math_Voigt66to3333 !-------------------------------------------------------------------------------------------------- !> @brief random quaternion +! http://math.stackexchange.com/questions/131336/uniform-random-quaternion-in-a-restricted-angle-range +! K. Shoemake. Uniform random rotations. In D. Kirk, editor, Graphics Gems III, pages 124-132. +! Academic, New York, 1992. !-------------------------------------------------------------------------------------------------- function math_qRand() diff --git a/code/mesh.f90 b/src/mesh.f90 similarity index 99% rename from code/mesh.f90 rename to src/mesh.f90 index 7da3d4968..b7b1ad8da 100644 --- a/code/mesh.f90 +++ b/src/mesh.f90 @@ -472,9 +472,8 @@ contains !! Order and routines strongly depend on type of solver !-------------------------------------------------------------------------------------------------- subroutine mesh_init(ip,el) - use, intrinsic :: iso_c_binding - use DAMASK_interface use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) + use DAMASK_interface use IO, only: & #ifdef Abaqus IO_abaqus_hasNoPart, & @@ -922,24 +921,22 @@ subroutine mesh_build_ipCoordinates integer(pInt) :: e,t,g,c,i,n real(pReal), dimension(3) :: myCoords - if (.not. allocated(mesh_ipCoordinates)) then - allocate(mesh_ipCoordinates(3,mesh_maxNips,mesh_NcpElems)) - mesh_ipCoordinates = 0.0_pReal - endif + if (.not. allocated(mesh_ipCoordinates)) & + allocate(mesh_ipCoordinates(3,mesh_maxNips,mesh_NcpElems),source=0.0_pReal) !$OMP PARALLEL DO PRIVATE(t,g,c,myCoords) - do e = 1_pInt,mesh_NcpElems ! loop over cpElems - t = mesh_element(2_pInt,e) ! get element type - g = FE_geomtype(t) ! get geometry type - c = FE_celltype(g) ! get cell type - do i = 1_pInt,FE_Nips(g) ! loop over ips=cells in this element - myCoords = 0.0_pReal - do n = 1_pInt,FE_NcellnodesPerCell(c) ! loop over cell nodes in this cell - myCoords = myCoords + mesh_cellnode(1:3,mesh_cell(n,i,e)) - enddo - mesh_ipCoordinates(1:3,i,e) = myCoords / FE_NcellnodesPerCell(c) + do e = 1_pInt,mesh_NcpElems ! loop over cpElems + t = mesh_element(2_pInt,e) ! get element type + g = FE_geomtype(t) ! get geometry type + c = FE_celltype(g) ! get cell type + do i = 1_pInt,FE_Nips(g) ! loop over ips=cells in this element + myCoords = 0.0_pReal + do n = 1_pInt,FE_NcellnodesPerCell(c) ! loop over cell nodes in this cell + myCoords = myCoords + mesh_cellnode(1:3,mesh_cell(n,i,e)) enddo + mesh_ipCoordinates(1:3,i,e) = myCoords / real(FE_NcellnodesPerCell(c),pReal) enddo + enddo !$OMP END PARALLEL DO end subroutine mesh_build_ipCoordinates @@ -956,7 +953,6 @@ pure function mesh_cellCenterCoordinates(ip,el) real(pReal), dimension(3) :: mesh_cellCenterCoordinates !< x,y,z coordinates of the cell center of the requested IP cell integer(pInt) :: t,g,c,n - t = mesh_element(2_pInt,el) ! get element type g = FE_geomtype(t) ! get geometry type c = FE_celltype(g) ! get cell type @@ -964,7 +960,7 @@ pure function mesh_cellCenterCoordinates(ip,el) do n = 1_pInt,FE_NcellnodesPerCell(c) ! loop over cell nodes in this cell mesh_cellCenterCoordinates = mesh_cellCenterCoordinates + mesh_cellnode(1:3,mesh_cell(n,ip,el)) enddo - mesh_cellCenterCoordinates = mesh_cellCenterCoordinates / FE_NcellnodesPerCell(c) + mesh_cellCenterCoordinates = mesh_cellCenterCoordinates / real(FE_NcellnodesPerCell(c),pReal) end function mesh_cellCenterCoordinates @@ -1512,8 +1508,8 @@ function mesh_nodesAroundCentres(gDim,Favg,centres) result(nodes) shift = sign(abs(iRes+diag-2_pInt*me)/(iRes+diag),iRes+diag-2_pInt*me) lookup = me-diag+shift*iRes wrappedCentres(1:3,i+1_pInt, j+1_pInt, k+1_pInt) = & - centres(1:3,lookup(1)+1_pInt,lookup(2)+1_pInt,lookup(3)+1_pInt) - & - math_mul33x3(Favg, shift*gDim) + centres(1:3,lookup(1)+1_pInt,lookup(2)+1_pInt,lookup(3)+1_pInt) & + - math_mul33x3(Favg, real(shift,pReal)*gDim) endif enddo; enddo; enddo @@ -3353,15 +3349,10 @@ end function FE_mapElemtype subroutine mesh_faceMatch(elem, face ,matchingElem, matchingFace) implicit none -!*** output variables integer(pInt), intent(out) :: matchingElem, & ! matching CP element ID matchingFace ! matching face ID - -!*** input variables integer(pInt), intent(in) :: face, & ! face ID elem ! CP elem ID - -!*** local variables integer(pInt), dimension(FE_NmatchingNodesPerFace(face,FE_geomtype(mesh_element(2,elem)))) :: & myFaceNodes ! global node ids on my face integer(pInt) :: myType, & diff --git a/code/numerics.f90 b/src/numerics.f90 similarity index 99% rename from code/numerics.f90 rename to src/numerics.f90 index 24bd19018..eb974b3c4 100644 --- a/code/numerics.f90 +++ b/src/numerics.f90 @@ -28,7 +28,7 @@ module numerics fixedSeed = 0_pInt, & !< fixed seeding for pseudo-random number generator, Default 0: use random seed worldrank = 0_pInt, & !< MPI worldrank (/=0 for MPI simulations only) worldsize = 0_pInt !< MPI worldsize (/=0 for MPI simulations only) - integer, protected, public :: & + integer(4), protected, public :: & DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive integer(pInt), public :: & numerics_integrationMode = 0_pInt !< integrationMode 1 = central solution; integrationMode 2 = perturbation, Default 0: undefined, is not read from file @@ -210,7 +210,6 @@ subroutine numerics_init IO_warning, & IO_timeStamp, & IO_EOF - #if defined(Spectral) || defined(FEM) !$ use OMP_LIB, only: omp_set_num_threads ! Use the standard conforming module file for omp if using the spectral solver implicit none @@ -242,20 +241,18 @@ subroutine numerics_init !$ call GET_ENVIRONMENT_VARIABLE(NAME='DAMASK_NUM_THREADS',VALUE=DAMASK_NumThreadsString,STATUS=gotDAMASK_NUM_THREADS) ! get environment variable DAMASK_NUM_THREADS... !$ if(gotDAMASK_NUM_THREADS /= 0) then ! could not get number of threads, set it to 1 !$ call IO_warning(35_pInt,ext_msg='BEGIN:'//DAMASK_NumThreadsString//':END') -!$ DAMASK_NumThreadsInt = 1 +!$ DAMASK_NumThreadsInt = 1_4 !$ else !$ read(DAMASK_NumThreadsString,'(i6)') DAMASK_NumThreadsInt ! read as integer -!$ if (DAMASK_NumThreadsInt < 1) DAMASK_NumThreadsInt = 1 ! in case of string conversion fails, set it to one +!$ if (DAMASK_NumThreadsInt < 1_4) DAMASK_NumThreadsInt = 1_4 ! in case of string conversion fails, set it to one !$ endif !$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution !-------------------------------------------------------------------------------------------------- ! try to open the config file fileExists: if(IO_open_file_stat(FILEUNIT,numerics_configFile)) then - mainProcess2: if (worldrank == 0) then - write(6,'(a,/)') ' using values from config file' - flush(6) - endif mainProcess2 + write(6,'(a,/)') ' using values from config file' + flush(6) !-------------------------------------------------------------------------------------------------- ! read variables from config file and overwrite default parameters if keyword is present @@ -695,9 +692,9 @@ subroutine numerics_init .not. memory_efficient) call IO_error(error_ID = 847_pInt) if (err_stress_tolrel <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_stress_tolRel') if (err_stress_tolabs <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_stress_tolAbs') - if (err_div_tolRel <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_div_tolRel') + if (err_div_tolRel < 0.0_pReal) call IO_error(301_pInt,ext_msg='err_div_tolRel') if (err_div_tolAbs <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_div_tolAbs') - if (err_curl_tolRel <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_curl_tolRel') + if (err_curl_tolRel < 0.0_pReal) call IO_error(301_pInt,ext_msg='err_curl_tolRel') if (err_curl_tolAbs <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_curl_tolAbs') if (polarAlpha <= 0.0_pReal .or. & polarAlpha > 2.0_pReal) call IO_error(301_pInt,ext_msg='polarAlpha') diff --git a/code/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 similarity index 100% rename from code/plastic_disloUCLA.f90 rename to src/plastic_disloUCLA.f90 diff --git a/code/plastic_dislotwin.f90 b/src/plastic_dislotwin.f90 similarity index 100% rename from code/plastic_dislotwin.f90 rename to src/plastic_dislotwin.f90 diff --git a/code/plastic_isotropic.f90 b/src/plastic_isotropic.f90 similarity index 95% rename from code/plastic_isotropic.f90 rename to src/plastic_isotropic.f90 index c26b63cfe..a82b9c820 100644 --- a/code/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -186,7 +186,6 @@ subroutine plastic_isotropic_init(fileUnit) instance = phase_plasticityInstance(phase) ! which instance of my plasticity is present phase chunkPos = IO_stringPos(line) tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - extmsg = trim(tag)//' ('//PLASTICITY_ISOTROPIC_label//')' ! prepare error message identifier select case(tag) case ('(output)') @@ -200,7 +199,6 @@ subroutine plastic_isotropic_init(fileUnit) plastic_isotropic_Noutput(instance) = plastic_isotropic_Noutput(instance) + 1_pInt param(instance)%outputID (plastic_isotropic_Noutput(instance)) = strainrate_ID plastic_isotropic_output(plastic_isotropic_Noutput(instance),instance) = outputtag - end select case ('/dilatation/') @@ -208,15 +206,12 @@ subroutine plastic_isotropic_init(fileUnit) case ('tau0') param(instance)%tau0 = IO_floatValue(line,chunkPos,2_pInt) - if (param(instance)%tau0 < 0.0_pReal) call IO_error(211_pInt,ext_msg=extmsg) case ('gdot0') param(instance)%gdot0 = IO_floatValue(line,chunkPos,2_pInt) - if (param(instance)%gdot0 <= 0.0_pReal) call IO_error(211_pInt,ext_msg=extmsg) case ('n') param(instance)%n = IO_floatValue(line,chunkPos,2_pInt) - if (param(instance)%n <= 0.0_pReal) call IO_error(211_pInt,ext_msg=extmsg) case ('h0') param(instance)%h0 = IO_floatValue(line,chunkPos,2_pInt) @@ -226,7 +221,6 @@ subroutine plastic_isotropic_init(fileUnit) case ('tausat') param(instance)%tausat = IO_floatValue(line,chunkPos,2_pInt) - if (param(instance)%tausat <= 0.0_pReal) call IO_error(211_pInt,ext_msg=extmsg) case ('tausat_sinhfita') param(instance)%tausat_SinhFitA = IO_floatValue(line,chunkPos,2_pInt) @@ -242,15 +236,12 @@ subroutine plastic_isotropic_init(fileUnit) case ('a', 'w0') param(instance)%a = IO_floatValue(line,chunkPos,2_pInt) - if (param(instance)%a <= 0.0_pReal) call IO_error(211_pInt,ext_msg=extmsg) case ('taylorfactor') param(instance)%fTaylor = IO_floatValue(line,chunkPos,2_pInt) - if (param(instance)%fTaylor <= 0.0_pReal) call IO_error(211_pInt,ext_msg=extmsg) case ('atol_flowstress') param(instance)%aTolFlowstress = IO_floatValue(line,chunkPos,2_pInt) - if (param(instance)%aTolFlowstress <= 0.0_pReal) call IO_error(211_pInt,ext_msg=extmsg) case ('atol_shear') param(instance)%aTolShear = IO_floatValue(line,chunkPos,2_pInt) @@ -270,11 +261,21 @@ subroutine plastic_isotropic_init(fileUnit) myPhase: if (phase_plasticity(phase) == PLASTICITY_isotropic_ID) then ! isolate instances of own constitutive description NipcMyPhase = count(material_phase == phase) ! number of own material points (including point components ipc) instance = phase_plasticityInstance(phase) + extmsg = '' !-------------------------------------------------------------------------------------------------- ! sanity checks - if (param(instance)%aTolShear <= 0.0_pReal) & - param(instance)%aTolShear = 1.0e-6_pReal ! default absolute tolerance 1e-6 - + if (param(instance)%aTolShear <= 0.0_pReal) param(instance)%aTolShear = 1.0e-6_pReal ! default absolute tolerance 1e-6 + if (param(instance)%tau0 < 0.0_pReal) extmsg = trim(extmsg)//' tau0' + if (param(instance)%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//' gdot0' + if (param(instance)%n <= 0.0_pReal) extmsg = trim(extmsg)//' n' + if (param(instance)%tausat <= 0.0_pReal) extmsg = trim(extmsg)//' tausat' + if (param(instance)%a <= 0.0_pReal) extmsg = trim(extmsg)//' a' + if (param(instance)%fTaylor <= 0.0_pReal) extmsg = trim(extmsg)//' taylorfactor' + if (param(instance)%aTolFlowstress <= 0.0_pReal) extmsg = trim(extmsg)//' atol_flowstress' + if (extmsg /= '') then + extmsg = trim(extmsg)//' ('//PLASTICITY_ISOTROPIC_label//')' ! prepare error message identifier + call IO_error(211_pInt,ip=instance,ext_msg=extmsg) + endif !-------------------------------------------------------------------------------------------------- ! Determine size of postResults array outputsLoop: do o = 1_pInt,plastic_isotropic_Noutput(instance) @@ -567,18 +568,13 @@ subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el) if (dEq0(param(instance)%tausat_SinhFitA)) then saturation = param(instance)%tausat else - saturation = ( param(instance)%tausat & - + ( log( ( gamma_dot / param(instance)%tausat_SinhFitA& - )**(1.0_pReal / param(instance)%tausat_SinhFitD)& - + sqrt( ( gamma_dot / param(instance)%tausat_SinhFitA & - )**(2.0_pReal / param(instance)%tausat_SinhFitD) & - + 1.0_pReal ) & - ) & ! asinh(K) = ln(K + sqrt(K^2 +1)) + saturation = param(instance)%tausat & + + asinh( (gamma_dot / param(instance)%tausat_SinhFitA& + )**(1.0_pReal / param(instance)%tausat_SinhFitD)& )**(1.0_pReal / param(instance)%tausat_SinhFitC) & - / ( param(instance)%tausat_SinhFitB & - * (gamma_dot / param(instance)%gdot0)**(1.0_pReal / param(instance)%n) & - ) & - ) + / ( param(instance)%tausat_SinhFitB & + * (gamma_dot / param(instance)%gdot0)**(1.0_pReal / param(instance)%n) & + ) endif hardening = ( param(instance)%h0 + param(instance)%h0_slopeLnRate * log(gamma_dot) ) & * abs( 1.0_pReal - state(instance)%flowstress(of)/saturation )**param(instance)%a & diff --git a/code/plastic_none.f90 b/src/plastic_none.f90 similarity index 100% rename from code/plastic_none.f90 rename to src/plastic_none.f90 diff --git a/code/plastic_nonlocal.f90 b/src/plastic_nonlocal.f90 similarity index 100% rename from code/plastic_nonlocal.f90 rename to src/plastic_nonlocal.f90 diff --git a/code/plastic_phenoplus.f90 b/src/plastic_phenoplus.f90 similarity index 100% rename from code/plastic_phenoplus.f90 rename to src/plastic_phenoplus.f90 diff --git a/code/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 similarity index 100% rename from code/plastic_phenopowerlaw.f90 rename to src/plastic_phenopowerlaw.f90 diff --git a/code/plastic_titanmod.f90 b/src/plastic_titanmod.f90 similarity index 100% rename from code/plastic_titanmod.f90 rename to src/plastic_titanmod.f90 diff --git a/code/porosity_none.f90 b/src/porosity_none.f90 similarity index 100% rename from code/porosity_none.f90 rename to src/porosity_none.f90 diff --git a/code/porosity_phasefield.f90 b/src/porosity_phasefield.f90 similarity index 100% rename from code/porosity_phasefield.f90 rename to src/porosity_phasefield.f90 diff --git a/code/prec.f90 b/src/prec.f90 similarity index 100% rename from code/prec.f90 rename to src/prec.f90 diff --git a/code/source_damage_anisoBrittle.f90 b/src/source_damage_anisoBrittle.f90 similarity index 100% rename from code/source_damage_anisoBrittle.f90 rename to src/source_damage_anisoBrittle.f90 diff --git a/code/source_damage_anisoDuctile.f90 b/src/source_damage_anisoDuctile.f90 similarity index 100% rename from code/source_damage_anisoDuctile.f90 rename to src/source_damage_anisoDuctile.f90 diff --git a/code/source_damage_isoBrittle.f90 b/src/source_damage_isoBrittle.f90 similarity index 100% rename from code/source_damage_isoBrittle.f90 rename to src/source_damage_isoBrittle.f90 diff --git a/code/source_damage_isoDuctile.f90 b/src/source_damage_isoDuctile.f90 similarity index 100% rename from code/source_damage_isoDuctile.f90 rename to src/source_damage_isoDuctile.f90 diff --git a/code/source_thermal_dissipation.f90 b/src/source_thermal_dissipation.f90 similarity index 100% rename from code/source_thermal_dissipation.f90 rename to src/source_thermal_dissipation.f90 diff --git a/code/source_thermal_externalheat.f90 b/src/source_thermal_externalheat.f90 similarity index 100% rename from code/source_thermal_externalheat.f90 rename to src/source_thermal_externalheat.f90 diff --git a/code/source_vacancy_irradiation.f90 b/src/source_vacancy_irradiation.f90 similarity index 100% rename from code/source_vacancy_irradiation.f90 rename to src/source_vacancy_irradiation.f90 diff --git a/code/source_vacancy_phenoplasticity.f90 b/src/source_vacancy_phenoplasticity.f90 similarity index 100% rename from code/source_vacancy_phenoplasticity.f90 rename to src/source_vacancy_phenoplasticity.f90 diff --git a/code/source_vacancy_thermalfluc.f90 b/src/source_vacancy_thermalfluc.f90 similarity index 100% rename from code/source_vacancy_thermalfluc.f90 rename to src/source_vacancy_thermalfluc.f90 diff --git a/code/spectral_damage.f90 b/src/spectral_damage.f90 similarity index 100% rename from code/spectral_damage.f90 rename to src/spectral_damage.f90 diff --git a/code/spectral_interface.f90 b/src/spectral_interface.f90 similarity index 92% rename from code/spectral_interface.f90 rename to src/spectral_interface.f90 index 8d9a41619..80a109a10 100644 --- a/code/spectral_interface.f90 +++ b/src/spectral_interface.f90 @@ -20,7 +20,6 @@ module DAMASK_interface geometryFile = '', & !< parameter given for geometry file loadCaseFile = '' !< parameter given for load case file character(len=1024), private :: workingDirectory !< accessed by getSolverWorkingDirectoryName for compatibility reasons - character, private,parameter :: pathSep = '/' public :: & getSolverWorkingDirectoryName, & @@ -58,7 +57,9 @@ subroutine DAMASK_interface_init() tag integer :: & i, & +#ifdef _OPENMP threadLevel, & +#endif worldrank = 0, & worldsize = 0 integer, allocatable, dimension(:) :: & @@ -95,6 +96,14 @@ subroutine DAMASK_interface_init() write(output_unit,'(a)') ' STDOUT != 6' call quit(1_pInt) endif + if (error_unit /= 0) then + write(output_unit,'(a)') ' STDERR != 0' + call quit(1_pInt) + endif + if (PETSC_VERSION_MAJOR /= 3 .or. PETSC_VERSION_MINOR /= 7) then + write(6,'(a,2(i1.1,a))') 'PETSc ',PETSC_VERSION_MAJOR,'.',PETSC_VERSION_MINOR,'.x not supported' + call quit(1_pInt) + endif else mainProcess close(6) ! disable output for non-master processes (open 6 to rank specific file for debug) open(6,file='/dev/null',status='replace') ! close(6) alone will leave some temp files in cwd @@ -164,7 +173,7 @@ subroutine DAMASK_interface_init() write(6,'(a)') ' Help:' write(6,'(/,a)')' --help' write(6,'(a,/)')' Prints this message and exits' - call quit(0_pInt) ! normal Termination + call quit(0_pInt) ! normal Termination case ('-l', '--load', '--loadcase') loadcaseArg = IIO_stringValue(commandLine,chunkPos,i+1_pInt) case ('-g', '--geom', '--geometry') @@ -190,7 +199,6 @@ subroutine DAMASK_interface_init() error = getHostName(hostName) write(6,'(a,a)') ' Host name: ', trim(hostName) write(6,'(a,a)') ' User name: ', trim(userName) - write(6,'(a,a)') ' Path separator: ', pathSep write(6,'(a,a)') ' Command line call: ', trim(commandLine) if (len(trim(workingDirArg))>0) & write(6,'(a,a)') ' Working dir argument: ', trim(workingDirArg) @@ -225,22 +233,22 @@ character(len=1024) function storeWorkingDirectory(workingDirectoryArg,geometryA external :: quit wdGiven: if (len(workingDirectoryArg)>0) then - absolutePath: if (workingDirectoryArg(1:1) == pathSep) then + absolutePath: if (workingDirectoryArg(1:1) == '/') then storeWorkingDirectory = workingDirectoryArg else absolutePath error = getCWD(cwd) if (error) call quit(1_pInt) - storeWorkingDirectory = trim(cwd)//pathSep//workingDirectoryArg + storeWorkingDirectory = trim(cwd)//'/'//workingDirectoryArg endif absolutePath - if (storeWorkingDirectory(len(trim(storeWorkingDirectory)):len(trim(storeWorkingDirectory))) /= pathSep) & - storeWorkingDirectory = trim(storeWorkingDirectory)//pathSep ! if path seperator is not given, append it + if (storeWorkingDirectory(len(trim(storeWorkingDirectory)):len(trim(storeWorkingDirectory))) /= '/') & + storeWorkingDirectory = trim(storeWorkingDirectory)//'/' ! if path seperator is not given, append it else wdGiven - if (geometryArg(1:1) == pathSep) then ! absolute path given as command line argument - storeWorkingDirectory = geometryArg(1:scan(geometryArg,pathSep,back=.true.)) + if (geometryArg(1:1) == '/') then ! absolute path given as command line argument + storeWorkingDirectory = geometryArg(1:scan(geometryArg,'/',back=.true.)) else error = getCWD(cwd) ! relative path given as command line argument if (error) call quit(1_pInt) - storeWorkingDirectory = trim(cwd)//pathSep//geometryArg(1:scan(geometryArg,pathSep,back=.true.)) + storeWorkingDirectory = trim(cwd)//'/'//geometryArg(1:scan(geometryArg,'/',back=.true.)) endif endif wdGiven @@ -277,13 +285,13 @@ character(len=1024) function getSolverJobName() tempString = geometryFile posExt = scan(tempString,'.',back=.true.) - posSep = scan(tempString,pathSep,back=.true.) + posSep = scan(tempString,'/',back=.true.) getSolverJobName = tempString(posSep+1:posExt-1) tempString = loadCaseFile posExt = scan(tempString,'.',back=.true.) - posSep = scan(tempString,pathSep,back=.true.) + posSep = scan(tempString,'/',back=.true.) getSolverJobName = trim(getSolverJobName)//'_'//tempString(posSep+1:posExt-1) @@ -308,13 +316,13 @@ character(len=1024) function getGeometryFile(geometryParameter) getGeometryFile = geometryParameter posExt = scan(getGeometryFile,'.',back=.true.) - posSep = scan(getGeometryFile,pathSep,back=.true.) + posSep = scan(getGeometryFile,'/',back=.true.) if (posExt <= posSep) getGeometryFile = trim(getGeometryFile)//('.geom') ! no extension present - if (scan(getGeometryFile,pathSep) /= 1) then ! relative path given as command line argument + if (scan(getGeometryFile,'/') /= 1) then ! relative path given as command line argument error = getcwd(cwd) if (error) call quit(1_pInt) - getGeometryFile = rectifyPath(trim(cwd)//pathSep//getGeometryFile) + getGeometryFile = rectifyPath(trim(cwd)//'/'//getGeometryFile) else getGeometryFile = rectifyPath(getGeometryFile) endif @@ -342,13 +350,13 @@ character(len=1024) function getLoadCaseFile(loadCaseParameter) getLoadCaseFile = loadcaseParameter posExt = scan(getLoadCaseFile,'.',back=.true.) - posSep = scan(getLoadCaseFile,pathSep,back=.true.) + posSep = scan(getLoadCaseFile,'/',back=.true.) if (posExt <= posSep) getLoadCaseFile = trim(getLoadCaseFile)//('.load') ! no extension present - if (scan(getLoadCaseFile,pathSep) /= 1) then ! relative path given as command line argument + if (scan(getLoadCaseFile,'/') /= 1) then ! relative path given as command line argument error = getcwd(cwd) if (error) call quit(1_pInt) - getLoadCaseFile = rectifyPath(trim(cwd)//pathSep//getLoadCaseFile) + getLoadCaseFile = rectifyPath(trim(cwd)//'/'//getLoadCaseFile) else getLoadCaseFile = rectifyPath(getLoadCaseFile) endif @@ -373,26 +381,26 @@ function rectifyPath(path) l = len_trim(path) rectifyPath = path do i = l,3,-1 - if (rectifyPath(i-2:i) == pathSep//'.'//pathSep) & + if (rectifyPath(i-2:i) == '/'//'.'//'/') & rectifyPath(i-1:l) = rectifyPath(i+1:l)//' ' enddo !-------------------------------------------------------------------------------------------------- ! remove ../ and corresponding directory from rectifyPath l = len_trim(rectifyPath) - i = index(rectifyPath(i:l),'..'//pathSep) + i = index(rectifyPath(i:l),'..'//'/') j = 0 do while (i > j) - j = scan(rectifyPath(1:i-2),pathSep,back=.true.) + j = scan(rectifyPath(1:i-2),'/',back=.true.) rectifyPath(j+1:l) = rectifyPath(i+3:l)//repeat(' ',2+i-j) - if (rectifyPath(j+1:j+1) == pathSep) then !search for '//' that appear in case of XXX/../../XXX + if (rectifyPath(j+1:j+1) == '/') then !search for '//' that appear in case of XXX/../../XXX k = len_trim(rectifyPath) rectifyPath(j+1:k-1) = rectifyPath(j+2:k) rectifyPath(k:k) = ' ' endif - i = j+index(rectifyPath(j+1:l),'..'//pathSep) + i = j+index(rectifyPath(j+1:l),'..'//'/') enddo - if(len_trim(rectifyPath) == 0) rectifyPath = pathSep + if(len_trim(rectifyPath) == 0) rectifyPath = '/' end function rectifyPath @@ -411,12 +419,12 @@ character(len=1024) function makeRelativePath(a,b) do i = 1, min(1024,len_trim(a),len_trim(b)) if (a(i:i) /= b(i:i)) exit - if (a(i:i) == pathSep) posLastCommonSlash = i + if (a(i:i) == '/') posLastCommonSlash = i enddo do i = posLastCommonSlash+1,len_trim(a) - if (a(i:i) == pathSep) remainingSlashes = remainingSlashes + 1 + if (a(i:i) == '/') remainingSlashes = remainingSlashes + 1 enddo - makeRelativePath = repeat('..'//pathSep,remainingSlashes)//b(posLastCommonSlash+1:len_trim(b)) + makeRelativePath = repeat('..'//'/',remainingSlashes)//b(posLastCommonSlash+1:len_trim(b)) end function makeRelativePath diff --git a/code/spectral_mech_AL.f90 b/src/spectral_mech_AL.f90 similarity index 100% rename from code/spectral_mech_AL.f90 rename to src/spectral_mech_AL.f90 diff --git a/code/spectral_mech_Basic.f90 b/src/spectral_mech_Basic.f90 similarity index 100% rename from code/spectral_mech_Basic.f90 rename to src/spectral_mech_Basic.f90 diff --git a/code/spectral_mech_Polarisation.f90 b/src/spectral_mech_Polarisation.f90 similarity index 100% rename from code/spectral_mech_Polarisation.f90 rename to src/spectral_mech_Polarisation.f90 diff --git a/code/spectral_thermal.f90 b/src/spectral_thermal.f90 similarity index 100% rename from code/spectral_thermal.f90 rename to src/spectral_thermal.f90 diff --git a/code/spectral_utilities.f90 b/src/spectral_utilities.f90 similarity index 99% rename from code/spectral_utilities.f90 rename to src/spectral_utilities.f90 index 34eb0eab0..a33c7a9f5 100644 --- a/code/spectral_utilities.f90 +++ b/src/spectral_utilities.f90 @@ -227,12 +227,13 @@ subroutine utilities_init() trim(PETScDebug), & ' add more using the PETSc_Options keyword in numerics.config '; flush(6) - call PetscOptionsClear(ierr); CHKERRQ(ierr) - if(debugPETSc) call PetscOptionsInsertString(trim(PETSCDEBUG),ierr) + call PetscOptionsClear(PETSC_NULL_OBJECT,ierr) CHKERRQ(ierr) - call PetscOptionsInsertString(trim(petsc_defaultOptions),ierr) + if(debugPETSc) call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(PETSCDEBUG),ierr) CHKERRQ(ierr) - call PetscOptionsInsertString(trim(petsc_options),ierr) + call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(petsc_defaultOptions),ierr) + CHKERRQ(ierr) + call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(petsc_options),ierr) CHKERRQ(ierr) grid1Red = grid(1)/2_pInt + 1_pInt diff --git a/code/system_routines.f90 b/src/system_routines.f90 similarity index 100% rename from code/system_routines.f90 rename to src/system_routines.f90 diff --git a/code/thermal_adiabatic.f90 b/src/thermal_adiabatic.f90 similarity index 100% rename from code/thermal_adiabatic.f90 rename to src/thermal_adiabatic.f90 diff --git a/code/thermal_conduction.f90 b/src/thermal_conduction.f90 similarity index 100% rename from code/thermal_conduction.f90 rename to src/thermal_conduction.f90 diff --git a/code/thermal_isothermal.f90 b/src/thermal_isothermal.f90 similarity index 100% rename from code/thermal_isothermal.f90 rename to src/thermal_isothermal.f90 diff --git a/code/vacancyflux_cahnhilliard.f90 b/src/vacancyflux_cahnhilliard.f90 similarity index 100% rename from code/vacancyflux_cahnhilliard.f90 rename to src/vacancyflux_cahnhilliard.f90 diff --git a/code/vacancyflux_isochempot.f90 b/src/vacancyflux_isochempot.f90 similarity index 100% rename from code/vacancyflux_isochempot.f90 rename to src/vacancyflux_isochempot.f90 diff --git a/code/vacancyflux_isoconc.f90 b/src/vacancyflux_isoconc.f90 similarity index 100% rename from code/vacancyflux_isoconc.f90 rename to src/vacancyflux_isoconc.f90