From 88999c847a610f9bb62e90aa2e9ea764411ccb4c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 14 Dec 2015 20:04:59 +0000 Subject: [PATCH] reverted handling of NaN in converged reason, seems to be a compiler bug --- code/DAMASK_spectral_solverAL.f90 | 7 ++++--- code/DAMASK_spectral_solverBasicPETSc.f90 | 15 ++++++++------- code/DAMASK_spectral_solverPolarisation.f90 | 7 ++++--- code/DAMASK_spectral_utilities.f90 | 4 +++- code/IO.f90 | 4 ++++ 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/code/DAMASK_spectral_solverAL.f90 b/code/DAMASK_spectral_solverAL.f90 index 1a7106f43..11fc125b6 100644 --- a/code/DAMASK_spectral_solverAL.f90 +++ b/code/DAMASK_spectral_solverAL.f90 @@ -253,6 +253,8 @@ end subroutine AL_init !-------------------------------------------------------------------------------------------------- type(tSolutionState) function & AL_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) + use IO, only: & + IO_error use numerics, only: & update_gamma use math, only: & @@ -317,9 +319,8 @@ type(tSolutionState) function & CHKERRQ(ierr) AL_solution%termIll = terminallyIll terminallyIll = .false. - AL_solution%converged = .true. - - if (reason < 1 .and. reason /= -4) AL_solution%converged = .false. ! reason -4 (SNES_DIVERGED_FNORM_NAN) happens in case of homogeneous solution + if (reason == -4) call IO_error(893_pInt) + if (reason < 1) AL_solution%converged = .false. AL_solution%iterationsNeeded = totalIter end function AL_solution diff --git a/code/DAMASK_spectral_solverBasicPETSc.f90 b/code/DAMASK_spectral_solverBasicPETSc.f90 index c2a0a08ea..64286ca20 100644 --- a/code/DAMASK_spectral_solverBasicPETSc.f90 +++ b/code/DAMASK_spectral_solverBasicPETSc.f90 @@ -224,11 +224,12 @@ end subroutine basicPETSc_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the Basic PETSC scheme with internal iterations !-------------------------------------------------------------------------------------------------- -type(tSolutionState) function basicPETSc_solution( & - incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) +type(tSolutionState) function & + basicPETSc_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) + use IO, only: & + IO_error use numerics, only: & - update_gamma, & - itmax + update_gamma use DAMASK_spectral_Utilities, only: & tBoundaryCondition, & Utilities_maskedCompliance, & @@ -286,8 +287,8 @@ type(tSolutionState) function basicPETSc_solution( & basicPETSc_solution%termIll = terminallyIll terminallyIll = .false. BasicPETSc_solution%converged =.true. - - if (reason < 1 .and. reason /= -4) basicPETSC_solution%converged = .false. ! reason -4 (SNES_DIVERGED_FNORM_NAN) happens in case of homogeneous solution + if (reason == -4) call IO_error(893_pInt) + if (reason < 1) basicPETSC_solution%converged = .false. basicPETSC_solution%iterationsNeeded = totalIter end function BasicPETSc_solution @@ -372,7 +373,7 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) F_aim_lastIter = F_aim F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%P_BC))) ! S = 0.0 for no bc err_stress = maxval(abs(mask_stress * (P_av - params%P_BC))) ! mask = 0.0 for no bc - + !-------------------------------------------------------------------------------------------------- ! updated deformation gradient using fix point algorithm of basic scheme tensorField_real = 0.0_pReal diff --git a/code/DAMASK_spectral_solverPolarisation.f90 b/code/DAMASK_spectral_solverPolarisation.f90 index 45d078dc9..1aa720249 100644 --- a/code/DAMASK_spectral_solverPolarisation.f90 +++ b/code/DAMASK_spectral_solverPolarisation.f90 @@ -252,6 +252,8 @@ end subroutine Polarisation_init !-------------------------------------------------------------------------------------------------- type(tSolutionState) function & Polarisation_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) + use IO, only: & + IO_error use numerics, only: & update_gamma use math, only: & @@ -316,9 +318,8 @@ type(tSolutionState) function & CHKERRQ(ierr) Polarisation_solution%termIll = terminallyIll terminallyIll = .false. - Polarisation_solution%converged = .true. - - if (reason < 1 .and. reason /= -4) Polarisation_solution%converged = .false. ! reason -4 (SNES_DIVERGED_FNORM_NAN) happens in case of homogeneous solution + if (reason == -4) call IO_error(893_pInt) + if (reason < 1) Polarisation_solution%converged = .false. Polarisation_solution%iterationsNeeded = totalIter end function Polarisation_solution diff --git a/code/DAMASK_spectral_utilities.f90 b/code/DAMASK_spectral_utilities.f90 index 1b94efddd..f8ec4f19c 100644 --- a/code/DAMASK_spectral_utilities.f90 +++ b/code/DAMASK_spectral_utilities.f90 @@ -766,6 +766,8 @@ end function utilities_curlRMS !> @brief calculates mask compliance tensor used to adjust F to fullfill stress BC !-------------------------------------------------------------------------------------------------- function utilities_maskedCompliance(rot_BC,mask_stress,C) + use prec, only: & + prec_isNaN use IO, only: & IO_error use numerics, only: & @@ -799,7 +801,6 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) allocate (c_reduced(size_reduced,size_reduced), source =0.0_pReal) allocate (s_reduced(size_reduced,size_reduced), source =0.0_pReal) allocate (sTimesC(size_reduced,size_reduced), source =0.0_pReal) - temp99_Real = math_Plain3333to99(math_rotate_forward3333(C,rot_BC)) if(debugGeneral .and. worldrank == 0_pInt) then @@ -820,6 +821,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) endif; enddo; endif; enddo call math_invert(size_reduced, c_reduced, s_reduced, errmatinv) ! invert reduced stiffness + if (any(prec_isNaN(s_reduced))) errmatinv = .true. if(errmatinv) call IO_error(error_ID=400_pInt,ext_msg='utilities_maskedCompliance') temp99_Real = 0.0_pReal ! fill up compliance with zeros k = 0_pInt diff --git a/code/IO.f90 b/code/IO.f90 index 5faac1743..74e73e8e9 100644 --- a/code/IO.f90 +++ b/code/IO.f90 @@ -1605,6 +1605,8 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg) msg = 'Polar decomposition error' case (409_pInt) msg = 'math_check: R*v == q*v failed' + case (410_pInt) + msg = 'eigenvalues computation error' case (450_pInt) msg = 'unknown symmetry type specified' @@ -1669,6 +1671,8 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg) msg = 'unknown solver type selected' case (892_pInt) msg = 'unknown filter type selected' + case (893_pInt) + msg = 'PETSc: SNES_DIVERGED_FNORM_NAN' !------------------------------------------------------------------------------------------------- ! error messages related to parsing of Abaqus input file