diff --git a/.gitignore b/.gitignore index 87bc986f1..f199b8bb4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -code +.noH5py *.pyc *.mod *.o @@ -6,5 +6,4 @@ code *.bak *~ bin -PRIVATE build diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..e65d9df60 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,490 @@ +stages: + - prepareAll + - preprocessing + - postprocessing + - compileSpectralIntel + - compileSpectralGNU + - prepareSpectral + - spectral + - compileMarc2014 + - compileMarc2014.2 + - compileMarc2015 + - compileMarc2016 + - marc + - compileAbaqus2016 + - compileAbaqus2017 + - example + - updateMaster + - createDocumentation + - clean + +################################################################################################### +before_script: + - source $DAMASKROOT/DAMASK_env.sh + - module purge + - cd $DAMASKROOT/PRIVATE/testing + +################################################################################################### +variables: + #================================================================================================ + # GitLab Settings + #================================================================================================ + GIT_SUBMODULE_STRATEGY: none + + #================================================================================================ + # Shortcut names + #================================================================================================ + DAMASKROOT: "$HOME/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_6_4MPICH3_2Intel17_0: "Libraries/PETSc/3.6.4/Intel-17.0-MPICH-3.2" + PETSc3_7_5MPICH3_2Intel17_0: "Libraries/PETSc/3.7.5/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_5MPICH3_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 >> $HOME/GitLabCI.queue + - while [ $(awk "/$CI_PIPELINE_ID/{print NR}" $HOME/GitLabCI.queue) -ne 1 ];do sleep 5m; done + script: + - mkdir -p $DAMASKROOT + - git clone -q git@magit1.mpie.de:damask/DAMASK.git $DAMASKROOT + - cd $DAMASKROOT + - git checkout $CI_COMMIT_SHA + - git clone -q git@magit1.mpie.de:damask/PRIVATE.git + - source $DAMASKROOT/DAMASK_env.sh + - make install + 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_compileIfort/test.py + except: + - master + - release + +################################################################################################### +Compile_GNU: + stage: compileSpectralGNU + script: + - module load $GNUCompiler $MPICH_GNU $PETSc_MPICH_GNU + - SpectralAll_compileGfortran/test.py + except: + - master + - release + +################################################################################################### +Compile_Intel_Prepare: + stage: prepareSpectral + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel + - make -C $DAMASKROOT clean spectral install tidy + 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 + +################################################################################################## +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 + - git push origin master # master is now tested version and has updated VERSION file + - git checkout development + - git pull + - git merge master -s ours # 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 + +################################################################################################### +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 + +################################################################################################### +removeLock: + stage: clean + before_script: + - echo 'Do nothing' + when: always + script: sed -i "/$CI_PIPELINE_ID/d" $HOME/GitLabCI.queue + except: + - master + - release 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 fa3171c48..0ae3a2abf 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -25,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 @@ -39,12 +39,15 @@ 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 \ + || echo "cannot unlimit stack..." \ + && 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 dbb781894..0d043c390 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -19,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/VERSION b/VERSION index 2aa809898..1d89fa753 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-357-g38471c1 +v2.0.1-414-g81d0752 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/apply_DAMASK_modifications.sh b/installation/mods_MarcMentat/apply_DAMASK_modifications.sh index ff49ba368..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 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/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/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/test/test.py b/lib/damask/test/test.py index 5445ee443..94a8d3ef1 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -203,58 +203,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/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/mentat_pbcOnBoxMesh.py b/processing/pre/mentat_pbcOnBoxMesh.py index 71bc0d121..f71247618 100755 --- a/processing/pre/mentat_pbcOnBoxMesh.py +++ b/processing/pre/mentat_pbcOnBoxMesh.py @@ -153,34 +153,31 @@ 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.set_defaults(port = 40007, + verbose = False) (options, args) = parser.parse_args() -if options.verbose: - file={'croak':sys.stderr} -else: - file={'croak':sys.stdout} - try: import py_mentat except: - file['croak'].write('error: no valid Mentat release found') + damask.util.croak('error: no valid Mentat release found') sys.exit(-1) outputLocals = {} -file['croak'].write('\033[1m'+scriptName+'\033[0m\n\n') -file['croak'].write( 'waiting to connect...\n') +damask.util.report(scriptName,'waiting to connect...') + 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 +# 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') + damask.util.croak('Could not connect. Set Tools/Python/"Run as Separate Process" & "Initiate"...') sys.exit() -file['croak'].write( 'connected...\n') + +damask.util.croak('connected...') output(['*remove_all_servos', '*sweep_all', @@ -190,6 +187,10 @@ output(['*remove_all_servos', cmds = servoLink() output(cmds,outputLocals,'Mentat') + +output(['*draw_automatic', + ],outputLocals,'Mentat') # script depends on consecutive numbering of nodes + py_mentat.py_disconnect() if options.verbose: 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/src/DAMASK_marc.f90 b/src/DAMASK_marc.f90 index 8425f3e1e..27640e5f2 100644 --- a/src/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 @@ -244,13 +244,13 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & 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/IO.f90 b/src/IO.f90 index 894e81852..acac40785 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -878,7 +878,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 +1669,33 @@ 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(0,'(/,a)') ' +--------------------------------------------------------+' + write(0,'(a)') ' + error +' + write(0,'(a,i3,a)') ' + ',error_ID,' +' + write(0,'(a)') ' + +' write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,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))),',',& 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,'(a15,1x,i9,33x,a1)') ' + for instance',ip,'+' endif - write(6,'(a)') ' +--------------------------------------------------------+' - flush(6) + write(0,'(a)') ' +--------------------------------------------------------+' + flush(0) call quit(9000_pInt+error_ID) !$OMP END CRITICAL (write2out) diff --git a/src/lattice.f90 b/src/lattice.f90 index 184c85937..55be144ac 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -1283,11 +1283,9 @@ subroutine lattice_init 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) @@ -1718,7 +1716,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 @@ -1751,7 +1749,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 diff --git a/src/material.f90 b/src/material.f90 index cd1d21808..1945bb7da 100644 --- a/src/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 @@ -758,7 +758,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 +801,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 +816,11 @@ subroutine material_parseMicrostructure(fileUnit,myPart) endif enddo + !sanity check +do section = 1_pInt, Nsections + if (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/src/math.f90 b/src/math.f90 index e592ae1a9..9629401ca 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -1180,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/src/mesh.f90 b/src/mesh.f90 index f60fde905..c0d3cf862 100644 --- a/src/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, & diff --git a/src/numerics.f90 b/src/numerics.f90 index 6569d7cb4..4358624de 100644 --- a/src/numerics.f90 +++ b/src/numerics.f90 @@ -694,9 +694,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/src/spectral_interface.f90 b/src/spectral_interface.f90 index 8d9a41619..f37f083d6 100644 --- a/src/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, & @@ -95,6 +94,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 +171,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 +197,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 +231,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 +283,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 +314,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 +348,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 +379,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 +417,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/src/spectral_utilities.f90 b/src/spectral_utilities.f90 index 34eb0eab0..a33c7a9f5 100644 --- a/src/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