diff --git a/src/IO.f90 b/src/IO.f90 index 8cc350b10..c83ea1a22 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -479,6 +479,8 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2) ! homogenization errors case (500) msg = 'unknown homogenization specified' + case (501) + msg = 'homogenization description absent' !-------------------------------------------------------------------------------------------------- ! user errors diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index cc4cabd49..e096ec3ef 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -92,6 +92,8 @@ subroutine grid_damage_spectral_init() print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019' print'( 1x,a)', 'https://doi.org/10.1007/978-981-10-6855-3_80' + if (.not. homogenization_damage_active()) call IO_error(501,ext_msg='damage') + !------------------------------------------------------------------------------------------------- ! read numerical parameters and do sanity checks num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict) diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 8932a3adc..a5d9f4ec8 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -87,6 +87,8 @@ subroutine grid_thermal_spectral_init() print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019' print'( 1x,a)', 'https://doi.org/10.1007/978-981-10-6855-3_80' + if (.not. homogenization_thermal_active()) call IO_error(501,ext_msg='thermal') + !------------------------------------------------------------------------------------------------- ! read numerical parameters and do sanity checks num_grid => config_numerics%get_dict('grid',defaultVal=emptyDict) diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 3474e497b..2c89a1859 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -126,6 +126,10 @@ module homogenization logical, dimension(2) :: doneAndHappy end function mechanical_updateState + module function homogenization_thermal_active() result(active) + logical :: active + end function homogenization_thermal_active + module function homogenization_mu_T(ce) result(mu) integer, intent(in) :: ce real(pReal) :: mu @@ -146,6 +150,10 @@ module homogenization real(pReal), intent(in) :: T, dot_T end subroutine homogenization_thermal_setField + module function homogenization_damage_active() result(active) + logical :: active + end function homogenization_damage_active + module function homogenization_mu_phi(ce) result(mu) integer, intent(in) :: ce real(pReal) :: mu @@ -175,10 +183,12 @@ module homogenization homogenization_mechanical_response, & homogenization_mechanical_response2, & homogenization_thermal_response, & + homogenization_thermal_active, & homogenization_mu_T, & homogenization_K_T, & homogenization_f_T, & homogenization_thermal_setfield, & + homogenization_damage_active, & homogenization_mu_phi, & homogenization_K_phi, & homogenization_f_phi, & diff --git a/src/homogenization_damage.f90 b/src/homogenization_damage.f90 index f2b585a72..40c85cd2b 100644 --- a/src/homogenization_damage.f90 +++ b/src/homogenization_damage.f90 @@ -72,6 +72,18 @@ module subroutine damage_init() end subroutine damage_init +!-------------------------------------------------------------------------------------------------- +!> @brief Check if damage homogemization description is present in the configuration file +!-------------------------------------------------------------------------------------------------- +module function homogenization_damage_active() result(active) + + logical :: active + + active = any(damage_active(:)) + +end function homogenization_damage_active + + !-------------------------------------------------------------------------------------------------- !> @brief Partition temperature onto the individual constituents. !-------------------------------------------------------------------------------------------------- diff --git a/src/homogenization_thermal.f90 b/src/homogenization_thermal.f90 index 5f494fedf..274c392e8 100644 --- a/src/homogenization_thermal.f90 +++ b/src/homogenization_thermal.f90 @@ -78,10 +78,21 @@ module subroutine thermal_init() end associate end do - end subroutine thermal_init +!-------------------------------------------------------------------------------------------------- +!> @brief Check if thermal homogemization description is present in the configuration file +!-------------------------------------------------------------------------------------------------- +module function homogenization_thermal_active() result(active) + + logical :: active + + active = any(thermal_active(:)) + +end function homogenization_thermal_active + + !-------------------------------------------------------------------------------------------------- !> @brief Partition temperature onto the individual constituents. !--------------------------------------------------------------------------------------------------