systematic naming of status code enums

This commit is contained in:
Martin Diehl 2024-01-13 08:27:17 +01:00
parent 9d3b4a270f
commit 1d60ce29c6
No known key found for this signature in database
GPG Key ID: 1FD50837275A0A9B
6 changed files with 24 additions and 24 deletions

View File

@ -23,15 +23,15 @@ module constants
enum, bind(c); enumerator :: & enum, bind(c); enumerator :: &
STATUS_OK, & STATUS_OK, &
STATUS_ITERATING, & STATUS_ITERATING, &
STATUS_FAILED_PHASE_STATE, & STATUS_FAIL_PHASE_MECHANICAL, &
STATUS_FAILED_PHASE_DELTASTATE, & STATUS_FAIL_PHASE_MECHANICAL_STATE, &
STATUS_FAILED_PHASE_STRESS, & STATUS_FAIL_PHASE_MECHANICAL_DELTASTATE, &
STATUS_FAILED_DAMAGE_STATE, & STATUS_FAIL_PHASE_MECHANICAL_STRESS, &
STATUS_FAILED_DAMAGE_DELTASTATE, & STATUS_FAIL_PHASE_DAMAGE, &
STATUS_FAILED_DAMAGE, & STATUS_FAIL_PHASE_DAMAGE_STATE, &
STATUS_FAILED_MECHANICAL, & STATUS_FAIL_PHASE_DAMAGE_DELTASTATE, &
STATUS_PHASE_THERMAL, & STATUS_FAIL_PHASE_THERMAL, &
STATUS_PHASE_THERMAL_DOTSTATE STATUS_FAIL_PHASE_THERMAL_DOTSTATE
end enum end enum
end module constants end module constants

View File

@ -252,13 +252,13 @@ subroutine homogenization_mechanical_response(status,Delta_t,cell_start,cell_end
end do convergenceLooping end do convergenceLooping
if (.not. converged) then if (.not. converged) then
if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (mechanics)' if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (mechanics)'
status = STATUS_FAILED_MECHANICAL status = STATUS_FAIL_PHASE_MECHANICAL
end if end if
converged = converged .and. all([(phase_damage_constitutive(Delta_t,co,ce)==STATUS_OK,co=1,homogenization_Nconstituents(ho))]) converged = converged .and. all([(phase_damage_constitutive(Delta_t,co,ce)==STATUS_OK,co=1,homogenization_Nconstituents(ho))])
if (.not. converged) then if (.not. converged) then
if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (damage)' if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (damage)'
status = STATUS_FAILED_DAMAGE status = STATUS_FAIL_PHASE_DAMAGE
end if end if
end do end do
!$OMP END PARALLEL DO !$OMP END PARALLEL DO
@ -301,7 +301,7 @@ subroutine homogenization_thermal_response(status, &
do co = 1, homogenization_Nconstituents(ho) do co = 1, homogenization_Nconstituents(ho)
if (phase_thermal_constitutive(Delta_t,material_ID_phase(co,ce),material_entry_phase(co,ce)) /= STATUS_OK) then if (phase_thermal_constitutive(Delta_t,material_ID_phase(co,ce),material_entry_phase(co,ce)) /= STATUS_OK) then
if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (thermal)' if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (thermal)'
status = STATUS_PHASE_THERMAL status = STATUS_FAIL_PHASE_THERMAL
end if end if
end do end do
end do end do

View File

@ -276,7 +276,7 @@ function integrateDamageState(Delta_t,ph,en) result(status)
end do iteration end do iteration
if (.not. converged_) status = STATUS_FAILED_DAMAGE_STATE if (.not. converged_) status = STATUS_FAIL_PHASE_DAMAGE_STATE
contains contains
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -379,7 +379,7 @@ function phase_damage_collectDotState(ph,en) result(status)
end select sourceType end select sourceType
if (any(IEEE_is_NaN(damageState(ph)%dotState(:,en)))) status = STATUS_FAILED_DAMAGE_STATE if (any(IEEE_is_NaN(damageState(ph)%dotState(:,en)))) status = STATUS_FAIL_PHASE_DAMAGE_STATE
end if end if
@ -440,7 +440,7 @@ function phase_damage_deltaState(Fe, ph, en) result(status)
case (DAMAGE_ISOBRITTLE) sourceType case (DAMAGE_ISOBRITTLE) sourceType
call isobrittle_deltaState(phase_homogenizedC66(ph,en), Fe, ph,en) call isobrittle_deltaState(phase_homogenizedC66(ph,en), Fe, ph,en)
if (any(IEEE_is_NaN(damageState(ph)%deltaState(:,en)))) status = STATUS_FAILED_DAMAGE_DELTASTATE if (any(IEEE_is_NaN(damageState(ph)%deltaState(:,en)))) status = STATUS_FAIL_PHASE_DAMAGE_DELTASTATE
if (status == STATUS_OK) then if (status == STATUS_OK) then
myOffset = damageState(ph)%offsetDeltaState myOffset = damageState(ph)%offsetDeltaState
mySize = damageState(ph)%sizeDeltaState mySize = damageState(ph)%sizeDeltaState

View File

@ -434,7 +434,7 @@ function integrateStress(F,Fp0,Fi0,Delta_t,ph,en) result(status)
logical :: error logical :: error
status = STATUS_FAILED_PHASE_STRESS status = STATUS_FAIL_PHASE_MECHANICAL_STRESS
call plastic_dependentState(ph,en) call plastic_dependentState(ph,en)
Lpguess = phase_mechanical_Lp(ph)%data(1:3,1:3,en) ! take as first guess Lpguess = phase_mechanical_Lp(ph)%data(1:3,1:3,en) ! take as first guess
@ -605,7 +605,7 @@ function integrateStateFPI(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(status)
dotState_last dotState_last
status = STATUS_FAILED_PHASE_STATE status = STATUS_FAIL_PHASE_MECHANICAL_STATE
dotState = plastic_dotState(Delta_t,ph,en) dotState = plastic_dotState(Delta_t,ph,en)
if (any(IEEE_is_NaN(dotState))) return if (any(IEEE_is_NaN(dotState))) return
@ -687,7 +687,7 @@ function integrateStateEuler(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(status)
sizeDotState sizeDotState
status = STATUS_FAILED_PHASE_STATE status = STATUS_FAIL_PHASE_MECHANICAL_STATE
dotState = plastic_dotState(Delta_t,ph,en) dotState = plastic_dotState(Delta_t,ph,en)
if (any(IEEE_is_NaN(dotState))) return if (any(IEEE_is_NaN(dotState))) return
@ -724,7 +724,7 @@ function integrateStateAdaptiveEuler(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(
dotState dotState
status = STATUS_FAILED_PHASE_STATE status = STATUS_FAIL_PHASE_MECHANICAL_STATE
dotState = plastic_dotState(Delta_t,ph,en) dotState = plastic_dotState(Delta_t,ph,en)
if (any(IEEE_is_NaN(dotState))) return if (any(IEEE_is_NaN(dotState))) return
@ -745,7 +745,7 @@ function integrateStateAdaptiveEuler(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en) result(
if (any(IEEE_is_NaN(dotState))) return if (any(IEEE_is_NaN(dotState))) return
status = merge(STATUS_OK, & status = merge(STATUS_OK, &
STATUS_FAILED_PHASE_STATE, & STATUS_FAIL_PHASE_MECHANICAL_STATE, &
converged(r + 0.5_pREAL * dotState * Delta_t, & converged(r + 0.5_pREAL * dotState * Delta_t, &
plasticState(ph)%state(1:sizeDotState,en), & plasticState(ph)%state(1:sizeDotState,en), &
plasticState(ph)%atol(1:sizeDotState))) plasticState(ph)%atol(1:sizeDotState)))
@ -843,7 +843,7 @@ function integrateStateRK(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en,A,B,C,DB) result(st
plastic_RKdotState plastic_RKdotState
status = STATUS_FAILED_PHASE_STATE status = STATUS_FAIL_PHASE_MECHANICAL_STATE
dotState = plastic_dotState(Delta_t,ph,en) dotState = plastic_dotState(Delta_t,ph,en)
if (any(IEEE_is_NaN(dotState))) return if (any(IEEE_is_NaN(dotState))) return
@ -878,7 +878,7 @@ function integrateStateRK(F_0,F,Fp0,Fi0,state0,Delta_t,ph,en,A,B,C,DB) result(st
if (present(DB)) & if (present(DB)) &
status = merge(STATUS_OK, & status = merge(STATUS_OK, &
STATUS_FAILED_PHASE_STATE, & STATUS_FAIL_PHASE_MECHANICAL_STATE, &
converged(matmul(plastic_RKdotState(1:sizeDotState,1:size(DB)),DB) * Delta_t, & converged(matmul(plastic_RKdotState(1:sizeDotState,1:size(DB)),DB) * Delta_t, &
plasticState(ph)%state(1:sizeDotState,en), & plasticState(ph)%state(1:sizeDotState,en), &
plasticState(ph)%atol(1:sizeDotState))) plasticState(ph)%atol(1:sizeDotState)))

View File

@ -407,7 +407,7 @@ module function plastic_deltaState(ph, en) result(status)
end select plasticType end select plasticType
if (any(IEEE_is_NaN(plasticState(ph)%deltaState(:,en)))) status = STATUS_FAILED_PHASE_DELTASTATE if (any(IEEE_is_NaN(plasticState(ph)%deltaState(:,en)))) status = STATUS_FAIL_PHASE_MECHANICAL_DELTASTATE
if (status == STATUS_OK) then if (status == STATUS_OK) then
mySize = plasticState(ph)%sizeDeltaState mySize = plasticState(ph)%sizeDeltaState
plasticState(ph)%deltaState2(1:mySize,en) = plasticState(ph)%deltaState2(1:mySize,en) & plasticState(ph)%deltaState2(1:mySize,en) = plasticState(ph)%deltaState2(1:mySize,en) &

View File

@ -202,7 +202,7 @@ function phase_thermal_collectDotState(ph,en) result(status)
if (thermal_source_type(i,ph) == THERMAL_SOURCE_EXTERNALHEAT) & if (thermal_source_type(i,ph) == THERMAL_SOURCE_EXTERNALHEAT) &
call source_externalheat_dotState(ph,en) call source_externalheat_dotState(ph,en)
if (any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,en)))) status = STATUS_PHASE_THERMAL_DOTSTATE if (any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,en)))) status = STATUS_FAIL_PHASE_THERMAL_DOTSTATE
end do SourceLoop end do SourceLoop