From 50769b52a58288421ae71202359572f215486320 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 24 Oct 2019 06:32:46 +0200 Subject: [PATCH] don't continue if calculation did not converge --- src/grid/DAMASK_grid.f90 | 13 +------------ src/mesh/DAMASK_FEM.f90 | 11 ----------- src/numerics.f90 | 6 ------ src/quit.f90 | 1 - 4 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 573cba13e..5af6e4430 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -70,8 +70,6 @@ program DAMASK_spectral currentLoadcase = 0, & !< current load case inc, & !< current increment in current load case totalIncsCounter = 0, & !< total # of increments - convergedCounter = 0, & !< # of converged increments - notConvergedCounter = 0, & !< # of non-converged increments fileUnit = 0, & !< file unit for reading load case and writing results myStat, & statUnit = 0, & !< file unit for statistics output @@ -508,7 +506,7 @@ program DAMASK_spectral !-------------------------------------------------------------------------------------------------- ! check solution for either advance or retry - if ( (continueCalculation .or. all(solres(:)%converged .and. solres(:)%stagConverged)) & ! don't care or did converge + if ( (all(solres(:)%converged .and. solres(:)%stagConverged)) & ! converged .and. .not. solres(1)%termIll) then ! and acceptable solution found timeIncOld = timeinc cutBack = .false. @@ -537,11 +535,9 @@ program DAMASK_spectral cutBackLevel = max(0, cutBackLevel - 1) ! try half number of subincs next inc if (all(solres(:)%converged)) then - convergedCounter = convergedCounter + 1 write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & ! report converged inc ' increment ', totalIncsCounter, ' converged' else - notConvergedCounter = notConvergedCounter + 1 write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & ! report non-converged inc ' increment ', totalIncsCounter, ' NOT converged' endif; flush(6) @@ -579,16 +575,9 @@ program DAMASK_spectral !-------------------------------------------------------------------------------------------------- ! report summary of whole calculation write(6,'(/,a)') ' ###########################################################################' - write(6,'(1x,'//IO_intOut(convergedCounter)//',a,'//IO_intOut(notConvergedCounter + convergedCounter)//',a,f5.1,a)') & - convergedCounter, ' out of ', & - notConvergedCounter + convergedCounter, ' (', & - real(convergedCounter, pReal)/& - real(notConvergedCounter + convergedCounter,pReal)*100.0_pReal, ' %) increments converged!' - flush(6) call MPI_file_close(fileUnit,ierr) close(statUnit) - if (notConvergedCounter > 0) call quit(2) ! error if some are not converged call quit(0) ! no complains ;) end program DAMASK_spectral diff --git a/src/mesh/DAMASK_FEM.f90 b/src/mesh/DAMASK_FEM.f90 index c56302da0..3d4c332a0 100644 --- a/src/mesh/DAMASK_FEM.f90 +++ b/src/mesh/DAMASK_FEM.f90 @@ -53,8 +53,6 @@ program DAMASK_FEM currentFace = 0, & inc, & !< current increment in current load case totalIncsCounter = 0, & !< total # of increments - convergedCounter = 0, & !< # of converged increments - notConvergedCounter = 0, & !< # of non-converged increments fileUnit = 0, & !< file unit for reading load case and writing results myStat, & statUnit = 0, & !< file unit for statistics output @@ -375,11 +373,9 @@ program DAMASK_FEM cutBackLevel = max(0, cutBackLevel - 1) ! try half number of subincs next inc if (all(solres(:)%converged)) then - convergedCounter = convergedCounter + 1 write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & ! report converged inc ' increment ', totalIncsCounter, ' converged' else - notConvergedCounter = notConvergedCounter + 1 write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & ! report non-converged inc ' increment ', totalIncsCounter, ' NOT converged' endif; flush(6) @@ -398,15 +394,8 @@ program DAMASK_FEM !-------------------------------------------------------------------------------------------------- ! report summary of whole calculation write(6,'(/,a)') ' ###########################################################################' - write(6,'(1x,'//IO_intOut(convergedCounter)//',a,'//IO_intOut(notConvergedCounter + convergedCounter)//',a,f5.1,a)') & - convergedCounter, ' out of ', & - notConvergedCounter + convergedCounter, ' (', & - real(convergedCounter, pReal)/& - real(notConvergedCounter + convergedCounter,pReal)*100.0_pReal, ' %) increments converged!' - flush(6) close(statUnit) - if (notConvergedCounter > 0) call quit(2) ! error if some are not converged call quit(0) ! no complains ;) end program DAMASK_FEM diff --git a/src/numerics.f90 b/src/numerics.f90 index 0f63f87ab..6776ec178 100644 --- a/src/numerics.f90 +++ b/src/numerics.f90 @@ -82,9 +82,6 @@ module numerics &-damage_snes_type ngmres & &-thermal_snes_type ngmres ', & petsc_options = '' - logical, protected, public :: & - continueCalculation = .false. !< false:exit if BVP solver does not converge, true: continue calculation despite BVP solver not converging - #endif !-------------------------------------------------------------------------------------------------- @@ -259,8 +256,6 @@ subroutine numerics_init err_stress_tolrel = IO_floatValue(line,chunkPos,2) case ('err_stress_tolabs') err_stress_tolabs = IO_floatValue(line,chunkPos,2) - case ('continuecalculation') - continueCalculation = IO_intValue(line,chunkPos,2) > 0 case ('petsc_options') petsc_options = trim(line(chunkPos(4):)) case ('err_curl_tolabs') @@ -354,7 +349,6 @@ subroutine numerics_init !-------------------------------------------------------------------------------------------------- ! spectral parameters #ifdef Grid - write(6,'(a24,1x,L8)') ' continueCalculation: ',continueCalculation write(6,'(a24,1x,es8.1)') ' err_stress_tolAbs: ',err_stress_tolAbs write(6,'(a24,1x,es8.1)') ' err_stress_tolRel: ',err_stress_tolRel write(6,'(a24,1x,es8.1)') ' err_div_tolAbs: ',err_div_tolAbs diff --git a/src/quit.f90 b/src/quit.f90 index 5f492de36..146071600 100644 --- a/src/quit.f90 +++ b/src/quit.f90 @@ -42,7 +42,6 @@ subroutine quit(stop_id) dateAndTime(7) if (stop_id == 0 .and. ierr == 0 .and. error == 0) stop 0 ! normal termination - if (stop_id == 2 .and. ierr == 0 .and. error == 0) stop 2 ! not all incs converged stop 1 ! error (message from IO_error) end subroutine quit