Skip to content

Commit

Permalink
Merge branch 'solver-clean' into 'development'
Browse files Browse the repository at this point in the history
cleaning solver

See merge request damask/DAMASK!917
  • Loading branch information
MarDiehl committed Mar 5, 2024
2 parents 2f80154 + bd4f9a6 commit 9391165
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/grid/DAMASK_grid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,7 @@ program DAMASK_grid
!--------------------------------------------------------------------------------------------------
! check solution and either advance or retry with smaller timestep

if ( (all(solres(:)%converged .and. solres(:)%stagConverged)) & ! converged
.and. .not. solres(1)%termIll) then ! and acceptable solution found
if (all(solres(:)%converged .and. solres(:)%stagConverged)) then ! converged and acceptable solution found
call mechanical_updateCoords()
Delta_t_prev = Delta_t
cutBack = .false.
Expand Down
5 changes: 2 additions & 3 deletions src/grid/grid_mech_FEM.f90
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ function grid_mechanical_FEM_solution(incInfoIn) result(solution)

solution%converged = reason > 0
solution%iterationsNeeded = totalIter
solution%termIll = status /= STATUS_OK
P_aim = merge(P_av,P_aim,params%stress_mask)

end function grid_mechanical_FEM_solution
Expand Down Expand Up @@ -491,8 +490,8 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,fnorm,reason,dummy,e
divTol = max(maxval(abs(P_av))*num%eps_div_rtol, num%eps_div_atol)
BCTol = max(maxval(abs(P_av))*num%eps_stress_rtol, num%eps_stress_atol)

if ((totalIter >= num%itmin .and. all([err_div/divTol, err_BC/BCTol] < 1.0_pREAL)) &
.or. status /= STATUS_OK) then
if (totalIter >= num%itmin .and. all([err_div/divTol, err_BC/BCTol] < 1.0_pREAL) &
.and. status == STATUS_OK) then
reason = 1
elseif (totalIter >= num%itmax) then
reason = -1
Expand Down
5 changes: 2 additions & 3 deletions src/grid/grid_mech_spectral_basic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ function grid_mechanical_spectral_basic_solution(incInfoIn) result(solution)

solution%converged = reason > 0
solution%iterationsNeeded = totalIter
solution%termIll = status /= STATUS_OK
P_aim = merge(P_av,P_aim,params%stress_mask)

end function grid_mechanical_spectral_basic_solution
Expand Down Expand Up @@ -452,8 +451,8 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,devNull3,reason,dumm
divTol = max(maxval(abs(P_av))*num%eps_div_rtol, num%eps_div_atol)
BCTol = max(maxval(abs(P_av))*num%eps_stress_rtol, num%eps_stress_atol)

if ((totalIter >= num%itmin .and. all([err_div/divTol, err_BC/BCTol] < 1.0_pREAL)) &
.or. status /= STATUS_OK) then
if (totalIter >= num%itmin .and. all([err_div/divTol, err_BC/BCTol] < 1.0_pREAL) &
.and. status == STATUS_OK) then
reason = 1
elseif (totalIter >= num%itmax) then
reason = -1
Expand Down
5 changes: 2 additions & 3 deletions src/grid/grid_mech_spectral_polarization.f90
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ function grid_mechanical_spectral_polarization_solution(incInfoIn) result(soluti

solution%converged = reason > 0
solution%iterationsNeeded = totalIter
solution%termIll = status /= STATUS_OK
P_aim = merge(P_av,P_aim,params%stress_mask)

end function grid_mechanical_spectral_polarization_solution
Expand Down Expand Up @@ -516,8 +515,8 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,devNull3,reason,dumm
divTol = max(maxval(abs(P_av))*num%eps_div_rtol, num%eps_div_atol)
BCTol = max(maxval(abs(P_av))*num%eps_stress_rtol, num%eps_stress_atol)

if ((totalIter >= num%itmin .and. all([err_div/divTol, err_curl/curlTol, err_BC/BCTol] < 1.0_pREAL)) &
.or. status /= STATUS_OK) then
if (totalIter >= num%itmin .and. all([err_div/divTol, err_curl/curlTol, err_BC/BCTol] < 1.0_pREAL) &
.and. status == STATUS_OK) then
reason = 1
elseif (totalIter >= num%itmax) then
reason = -1
Expand Down
3 changes: 1 addition & 2 deletions src/grid/spectral_utilities.f90
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ module spectral_utilities
iterationsNeeded = 0
logical :: &
converged = .true., &
stagConverged = .true., &
termIll = .false.
stagConverged = .true.
end type tSolutionState

type :: tNumerics
Expand Down

0 comments on commit 9391165

Please sign in to comment.