consistently use status code as return value
This commit is contained in:
parent
0384f93d46
commit
7ca02b3f3d
|
@ -29,7 +29,9 @@ module constants
|
||||||
STATUS_FAILED_DAMAGE_DELTASTATE, &
|
STATUS_FAILED_DAMAGE_DELTASTATE, &
|
||||||
STATUS_FAILED_DAMAGE, &
|
STATUS_FAILED_DAMAGE, &
|
||||||
STATUS_FAILED_MECHANICAL, &
|
STATUS_FAILED_MECHANICAL, &
|
||||||
STATUS_PHASE_THERMAL
|
STATUS_PHASE_THERMAL, &
|
||||||
|
STATUS_PHASE_THERMAL_DOTSTATE, &
|
||||||
|
STATUS_ITERATING
|
||||||
end enum
|
end enum
|
||||||
|
|
||||||
end module constants
|
end module constants
|
||||||
|
|
|
@ -242,7 +242,7 @@ subroutine homogenization_mechanical_response(status,Delta_t,cell_start,cell_end
|
||||||
convergenceLooping: do while (status == STATUS_OK .and. .not. 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) == STATUS_OK,co=1,homogenization_Nconstituents(ho))])
|
||||||
if (converged) then
|
if (converged) then
|
||||||
doneAndHappy = mechanical_updateState(Delta_t,homogenization_F(1:3,1:3,ce),ce)
|
doneAndHappy = mechanical_updateState(Delta_t,homogenization_F(1:3,1:3,ce),ce)
|
||||||
converged = all(doneAndHappy)
|
converged = all(doneAndHappy)
|
||||||
|
@ -254,7 +254,7 @@ subroutine homogenization_mechanical_response(status,Delta_t,cell_start,cell_end
|
||||||
if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (mechanics)'
|
if (status == STATUS_OK) print*, ' Cell ', ce, ' failed (mechanics)'
|
||||||
status = STATUS_FAILED_MECHANICAL
|
status = STATUS_FAILED_MECHANICAL
|
||||||
end if
|
end if
|
||||||
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)==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)'
|
||||||
|
@ -299,7 +299,7 @@ subroutine homogenization_thermal_response(status, &
|
||||||
if (status /= STATUS_OK) 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 (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_PHASE_THERMAL
|
||||||
end if
|
end if
|
||||||
|
|
|
@ -282,24 +282,22 @@ module phase
|
||||||
|
|
||||||
! == cleaned:end ===================================================================================
|
! == cleaned:end ===================================================================================
|
||||||
|
|
||||||
module function phase_thermal_constitutive(Delta_t,ph,en) result(converged_)
|
module function phase_thermal_constitutive(Delta_t,ph,en) result(status)
|
||||||
|
|
||||||
real(pREAL), intent(in) :: Delta_t
|
real(pREAL), intent(in) :: Delta_t
|
||||||
integer, intent(in) :: ph, en
|
integer, intent(in) :: ph, en
|
||||||
logical :: converged_
|
integer(kind(STATUS_OK)) :: status
|
||||||
|
|
||||||
end function phase_thermal_constitutive
|
end function phase_thermal_constitutive
|
||||||
|
|
||||||
module function phase_damage_constitutive(Delta_t,co,ce) result(converged_)
|
module function phase_damage_constitutive(Delta_t,co,ce) result(status)
|
||||||
real(pREAL), intent(in) :: Delta_t
|
real(pREAL), intent(in) :: Delta_t
|
||||||
integer, intent(in) :: co, ce
|
integer, intent(in) :: co, ce
|
||||||
logical :: converged_
|
integer(kind(STATUS_OK)) :: status
|
||||||
end function phase_damage_constitutive
|
end function phase_damage_constitutive
|
||||||
|
|
||||||
module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_)
|
module function phase_mechanical_constitutive(Delta_t,co,ce) result(status)
|
||||||
real(pREAL), intent(in) :: Delta_t
|
real(pREAL), intent(in) :: Delta_t
|
||||||
integer, intent(in) :: co, ce
|
integer, intent(in) :: co, ce
|
||||||
logical :: converged_
|
integer(kind(STATUS_OK)) :: status
|
||||||
end function phase_mechanical_constitutive
|
end function phase_mechanical_constitutive
|
||||||
|
|
||||||
!ToDo: Merge all the stiffness functions
|
!ToDo: Merge all the stiffness functions
|
||||||
|
|
|
@ -120,13 +120,13 @@ end subroutine damage_init
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculate stress (P)
|
!> @brief calculate stress (P)
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module function phase_damage_constitutive(Delta_t,co,ce) result(converged_)
|
module function phase_damage_constitutive(Delta_t,co,ce) result(status)
|
||||||
|
|
||||||
real(pREAL), intent(in) :: Delta_t
|
real(pREAL), intent(in) :: Delta_t
|
||||||
integer, intent(in) :: &
|
integer, intent(in) :: &
|
||||||
co, &
|
co, &
|
||||||
ce
|
ce
|
||||||
logical :: converged_
|
integer(kind(STATUS_OK)) :: status
|
||||||
|
|
||||||
integer :: &
|
integer :: &
|
||||||
ph, en
|
ph, en
|
||||||
|
@ -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_ = integrateDamageState(Delta_t,ph,en) == STATUS_OK
|
status = integrateDamageState(Delta_t,ph,en)
|
||||||
|
|
||||||
end function phase_damage_constitutive
|
end function phase_damage_constitutive
|
||||||
|
|
||||||
|
|
|
@ -990,13 +990,13 @@ end subroutine mechanical_forward
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief calculate stress (P)
|
!> @brief calculate stress (P)
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_)
|
module function phase_mechanical_constitutive(Delta_t,co,ce) result(status)
|
||||||
|
|
||||||
real(pREAL), intent(in) :: Delta_t
|
real(pREAL), intent(in) :: Delta_t
|
||||||
integer, intent(in) :: &
|
integer, intent(in) :: &
|
||||||
co, &
|
co, &
|
||||||
ce
|
ce
|
||||||
logical :: converged_
|
integer(kind(STATUS_OK)) :: status
|
||||||
|
|
||||||
real(pREAL) :: &
|
real(pREAL) :: &
|
||||||
formerStep
|
formerStep
|
||||||
|
@ -1025,13 +1025,13 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_)
|
||||||
F0 = phase_mechanical_F0(ph)%data(1:3,1:3,en)
|
F0 = phase_mechanical_F0(ph)%data(1:3,1:3,en)
|
||||||
stepFrac = 0.0_pREAL
|
stepFrac = 0.0_pREAL
|
||||||
todo = .true.
|
todo = .true.
|
||||||
step = 1.0_pREAL/num%stepSizeCryst
|
step = 1.0_pREAL/num%stepSizeCryst ! pretend failed step of 1/stepSizeCryst
|
||||||
converged_ = .false. ! pretend failed step of 1/stepSizeCryst
|
status = STATUS_ITERATING
|
||||||
|
|
||||||
todo = .true.
|
todo = .true.
|
||||||
cutbackLooping: do while (todo)
|
cutbackLooping: do while (todo)
|
||||||
|
|
||||||
if (converged_) then
|
if (status == STATUS_OK) then
|
||||||
formerStep = step
|
formerStep = step
|
||||||
stepFrac = stepFrac + step
|
stepFrac = stepFrac + step
|
||||||
step = min(1.0_pREAL - stepFrac, num%stepIncreaseCryst * step)
|
step = min(1.0_pREAL - stepFrac, num%stepIncreaseCryst * step)
|
||||||
|
@ -1067,7 +1067,7 @@ module function phase_mechanical_constitutive(Delta_t,co,ce) result(converged_)
|
||||||
sizeDotState = plasticState(ph)%sizeDotState
|
sizeDotState = plasticState(ph)%sizeDotState
|
||||||
F = F0 &
|
F = F0 &
|
||||||
+ step * (phase_mechanical_F(ph)%data(1:3,1:3,en) - phase_mechanical_F0(ph)%data(1:3,1:3,en))
|
+ step * (phase_mechanical_F(ph)%data(1:3,1:3,en) - phase_mechanical_F0(ph)%data(1:3,1:3,en))
|
||||||
converged_ = STATUS_OK == integrateState(F0,F,Fp0,Fi0,state0(1:sizeDotState),step * Delta_t,ph,en)
|
status = integrateState(F0,F,Fp0,Fi0,state0(1:sizeDotState),step * Delta_t,ph,en)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
end do cutbackLooping
|
end do cutbackLooping
|
||||||
|
|
|
@ -187,22 +187,22 @@ end function phase_f_T
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief tbd.
|
!> @brief tbd.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function phase_thermal_collectDotState(ph,en) result(ok)
|
function phase_thermal_collectDotState(ph,en) result(status)
|
||||||
|
|
||||||
integer, intent(in) :: ph, en
|
integer, intent(in) :: ph, en
|
||||||
logical :: ok
|
integer(kind(STATUS_OK)) :: status
|
||||||
|
|
||||||
integer :: i
|
integer :: i
|
||||||
|
|
||||||
|
|
||||||
ok = .true.
|
status = STATUS_OK
|
||||||
|
|
||||||
SourceLoop: do i = 1, thermal_Nsources(ph)
|
SourceLoop: do i = 1, thermal_Nsources(ph)
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
ok = ok .and. .not. any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,en)))
|
if (any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,en)))) status = STATUS_PHASE_THERMAL_DOTSTATE
|
||||||
|
|
||||||
end do SourceLoop
|
end do SourceLoop
|
||||||
|
|
||||||
|
@ -238,14 +238,14 @@ module function phase_K_T(co,ce) result(K)
|
||||||
end function phase_K_T
|
end function phase_K_T
|
||||||
|
|
||||||
|
|
||||||
module function phase_thermal_constitutive(Delta_t,ph,en) result(converged_)
|
module function phase_thermal_constitutive(Delta_t,ph,en) result(status)
|
||||||
|
|
||||||
real(pREAL), intent(in) :: Delta_t
|
real(pREAL), intent(in) :: Delta_t
|
||||||
integer, intent(in) :: ph, en
|
integer, intent(in) :: ph, en
|
||||||
logical :: converged_
|
integer(kind(STATUS_OK)) :: status
|
||||||
|
|
||||||
|
|
||||||
converged_ = integrateThermalState(Delta_t,ph,en)
|
status = integrateThermalState(Delta_t,ph,en)
|
||||||
|
|
||||||
end function phase_thermal_constitutive
|
end function phase_thermal_constitutive
|
||||||
|
|
||||||
|
@ -253,19 +253,19 @@ end function phase_thermal_constitutive
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Integrate state with 1st order explicit Euler method.
|
!> @brief Integrate state with 1st order explicit Euler method.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function integrateThermalState(Delta_t, ph,en) result(converged)
|
function integrateThermalState(Delta_t, ph,en) result(status)
|
||||||
|
|
||||||
real(pREAL), intent(in) :: Delta_t
|
real(pREAL), intent(in) :: Delta_t
|
||||||
integer, intent(in) :: ph, en
|
integer, intent(in) :: ph, en
|
||||||
logical :: converged
|
integer(kind(STATUS_OK)) :: status
|
||||||
|
|
||||||
integer :: &
|
integer :: &
|
||||||
so, &
|
so, &
|
||||||
sizeDotState
|
sizeDotState
|
||||||
|
|
||||||
|
|
||||||
converged = phase_thermal_collectDotState(ph,en)
|
status = phase_thermal_collectDotState(ph,en)
|
||||||
if (converged) then
|
if (status == STATUS_OK) then
|
||||||
|
|
||||||
do so = 1, thermal_Nsources(ph)
|
do so = 1, thermal_Nsources(ph)
|
||||||
sizeDotState = thermalState(ph)%p(so)%sizeDotState
|
sizeDotState = thermalState(ph)%p(so)%sizeDotState
|
||||||
|
|
Loading…
Reference in New Issue