consistent ordering of status logical tests

This commit is contained in:
Philip Eisenlohr 2024-01-09 10:00:42 -05:00
parent 48a38f3cf5
commit 89ebad19d5
7 changed files with 13 additions and 13 deletions

View File

@ -325,7 +325,7 @@ function grid_mechanical_FEM_solution(incInfoIn) result(solution)
solution%converged = reason > 0 solution%converged = reason > 0
solution%iterationsNeeded = totalIter solution%iterationsNeeded = totalIter
solution%termIll = STATUS_OK /= status solution%termIll = status /= STATUS_OK
P_aim = merge(P_av,P_aim,params%stress_mask) P_aim = merge(P_av,P_aim,params%stress_mask)
end function grid_mechanical_FEM_solution end function grid_mechanical_FEM_solution
@ -492,7 +492,7 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,fnorm,reason,dummy,e
BCTol = max(maxval(abs(P_av))*num%eps_stress_rtol, num%eps_stress_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)) & if ((totalIter >= num%itmin .and. all([err_div/divTol, err_BC/BCTol] < 1.0_pREAL)) &
.or. STATUS_OK /= status) then .or. status /= STATUS_OK) then
reason = 1 reason = 1
elseif (totalIter >= num%itmax) then elseif (totalIter >= num%itmax) then
reason = -1 reason = -1

View File

@ -288,7 +288,7 @@ function grid_mechanical_spectral_basic_solution(incInfoIn) result(solution)
solution%converged = reason > 0 solution%converged = reason > 0
solution%iterationsNeeded = totalIter solution%iterationsNeeded = totalIter
solution%termIll = STATUS_OK /= status solution%termIll = status /= STATUS_OK
P_aim = merge(P_av,P_aim,params%stress_mask) P_aim = merge(P_av,P_aim,params%stress_mask)
end function grid_mechanical_spectral_basic_solution end function grid_mechanical_spectral_basic_solution
@ -453,7 +453,7 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,devNull3,reason,dumm
BCTol = max(maxval(abs(P_av))*num%eps_stress_rtol, num%eps_stress_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)) & if ((totalIter >= num%itmin .and. all([err_div/divTol, err_BC/BCTol] < 1.0_pREAL)) &
.or. STATUS_OK /= status) then .or. status /= STATUS_OK) then
reason = 1 reason = 1
elseif (totalIter >= num%itmax) then elseif (totalIter >= num%itmax) then
reason = -1 reason = -1

View File

@ -323,7 +323,7 @@ function grid_mechanical_spectral_polarization_solution(incInfoIn) result(soluti
solution%converged = reason > 0 solution%converged = reason > 0
solution%iterationsNeeded = totalIter solution%iterationsNeeded = totalIter
solution%termIll = STATUS_OK /= status solution%termIll = status /= STATUS_OK
P_aim = merge(P_av,P_aim,params%stress_mask) P_aim = merge(P_av,P_aim,params%stress_mask)
end function grid_mechanical_spectral_polarization_solution end function grid_mechanical_spectral_polarization_solution
@ -517,7 +517,7 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,devNull3,reason,dumm
BCTol = max(maxval(abs(P_av))*num%eps_stress_rtol, num%eps_stress_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)) & if ((totalIter >= num%itmin .and. all([err_div/divTol, err_curl/curlTol, err_BC/BCTol] < 1.0_pREAL)) &
.or. STATUS_OK /= status) then .or. status /= STATUS_OK) then
reason = 1 reason = 1
elseif (totalIter >= num%itmax) then elseif (totalIter >= num%itmax) then
reason = -1 reason = -1

View File

@ -327,7 +327,7 @@ subroutine formResidual(residual_subdomain,x_scal,r,dummy,err_PETSc)
call homogenization_thermal_response(status,Delta_t_,1,product(cells(1:2))*cells3) call homogenization_thermal_response(status,Delta_t_,1,product(cells(1:2))*cells3)
broken = STATUS_OK /= status broken = status /= STATUS_OK
associate(T => x_scal) associate(T => x_scal)
vectorField = utilities_ScalarGradient(T) vectorField = utilities_ScalarGradient(T)

View File

@ -239,7 +239,7 @@ subroutine homogenization_mechanical_response(status,Delta_t,cell_start,cell_end
doneAndHappy = [.false.,.true.] doneAndHappy = [.false.,.true.]
convergenceLooping: do while (.not. (status /= STATUS_OK .or. doneAndHappy(1))) convergenceLooping: do while (status == STATUS_OK .and. .not. doneAndHappy(1))
call mechanical_partition(homogenization_F(1:3,1:3,ce),ce) call mechanical_partition(homogenization_F(1:3,1:3,ce),ce)
converged = all([(phase_mechanical_constitutive(Delta_t,co,ce),co=1,homogenization_Nconstituents(ho))]) converged = all([(phase_mechanical_constitutive(Delta_t,co,ce),co=1,homogenization_Nconstituents(ho))])
@ -257,7 +257,7 @@ subroutine homogenization_mechanical_response(status,Delta_t,cell_start,cell_end
converged = converged .and. all([(phase_damage_constitutive(Delta_t,co,ce),co=1,homogenization_Nconstituents(ho))]) converged = converged .and. all([(phase_damage_constitutive(Delta_t,co,ce),co=1,homogenization_Nconstituents(ho))])
if (.not. converged) then if (.not. converged) then
if (STATUS_OK == status) print*, ' Cell ', ce, ' failed (damage)' if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (damage)'
status = STATUS_FAILED_DAMAGE status = STATUS_FAILED_DAMAGE
end if end if
end do end do
@ -296,11 +296,11 @@ subroutine homogenization_thermal_response(status, &
status = STATUS_OK status = STATUS_OK
!$OMP PARALLEL DO PRIVATE(ho) !$OMP PARALLEL DO PRIVATE(ho)
do ce = cell_start, cell_end do ce = cell_start, cell_end
if (STATUS_OK /= status) continue if (status /= STATUS_OK) continue
ho = material_ID_homogenization(ce) ho = material_ID_homogenization(ce)
do co = 1, homogenization_Nconstituents(ho) do co = 1, homogenization_Nconstituents(ho)
if (.not. phase_thermal_constitutive(Delta_t,material_ID_phase(co,ce),material_entry_phase(co,ce))) then if (.not. phase_thermal_constitutive(Delta_t,material_ID_phase(co,ce),material_entry_phase(co,ce))) then
if (STATUS_OK == status) print*, ' Cell ', ce, ' failed (thermal)' if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (thermal)'
status = STATUS_PHASE_THERMAL status = STATUS_PHASE_THERMAL
end if end if
end do end do

View File

@ -135,7 +135,7 @@ subroutine utilities_constitutiveResponse(broken, Delta_t,P_av,forwardData)
print'(/,1x,a)', '... evaluating constitutive response ......................................' print'(/,1x,a)', '... evaluating constitutive response ......................................'
call homogenization_mechanical_response(status,Delta_t,1,mesh_maxNips*mesh_NcpElems) ! calculate P field call homogenization_mechanical_response(status,Delta_t,1,mesh_maxNips*mesh_NcpElems) ! calculate P field
broken = STATUS_OK /= status broken = status /= STATUS_OK
cutBack = .false. cutBack = .false.
P_av = sum(homogenization_P,dim=3) * wgt P_av = sum(homogenization_P,dim=3) * wgt

View File

@ -135,7 +135,7 @@ module function phase_damage_constitutive(Delta_t,co,ce) result(converged_)
ph = material_ID_phase(co,ce) ph = material_ID_phase(co,ce)
en = material_entry_phase(co,ce) en = material_entry_phase(co,ce)
converged_ = STATUS_OK == integrateDamageState(Delta_t,ph,en) converged_ = integrateDamageState(Delta_t,ph,en) == STATUS_OK
end function phase_damage_constitutive end function phase_damage_constitutive