diff --git a/src/IO.f90 b/src/IO.f90 index ba33a8a5c..9e0b4c40d 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -548,6 +548,8 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2) !-------------------------------------------------------------------------------------------------- ! user errors + case (600) + msg = 'only one source entry allowed' case (603) msg = 'invalid data for table' case (610) diff --git a/src/phase_thermal_source_dissipation.f90 b/src/phase_thermal_source_dissipation.f90 index aaaffad13..760259286 100644 --- a/src/phase_thermal_source_dissipation.f90 +++ b/src/phase_thermal_source_dissipation.f90 @@ -35,7 +35,7 @@ module function source_dissipation_init(maxNsources) result(isMySource) class(tList), pointer :: & sources character(len=:), allocatable :: refs - integer :: ph,Nmembers,so + integer :: ph,Nmembers,so,Nsources isMySource = thermal_active('dissipation',maxNsources) @@ -49,7 +49,9 @@ module function source_dissipation_init(maxNsources) result(isMySource) allocate(param(phases%length)) do ph = 1, phases%length - if (count(isMySource(:,ph)) == 0) cycle !ToDo: error if > 1 + Nsources = count(isMySource(:,ph)) + if (Nsources == 0) cycle + if (Nsources > 1) call IO_error(600,ext_msg='dissipation') Nmembers = count(material_ID_phase == ph) phase => phases%get_dict(ph) thermal => phase%get_dict('thermal') @@ -64,8 +66,8 @@ module function source_dissipation_init(maxNsources) result(isMySource) prm%kappa = src%get_asReal('kappa') call phase_allocateState(thermalState(ph)%p(so),Nmembers,0,0,0) - end associate + exit end if end do end do diff --git a/src/phase_thermal_source_externalheat.f90 b/src/phase_thermal_source_externalheat.f90 index 76fd9ac03..1a803549c 100644 --- a/src/phase_thermal_source_externalheat.f90 +++ b/src/phase_thermal_source_externalheat.f90 @@ -37,7 +37,7 @@ module function source_externalheat_init(maxNsources) result(isMySource) type(tList), pointer :: & sources character(len=:), allocatable :: refs - integer :: ph,Nmembers,so + integer :: ph,Nmembers,so,Nsources isMySource = thermal_active('externalheat',maxNsources) @@ -52,7 +52,9 @@ module function source_externalheat_init(maxNsources) result(isMySource) allocate(source_ID(phases%length), source=0) do ph = 1, phases%length - if (count(isMySource(:,ph)) == 0) cycle + Nsources = count(isMySource(:,ph)) + if (Nsources == 0) cycle + if (Nsources > 1) call IO_error(600,ext_msg='externalheat') Nmembers = count(material_ID_phase == ph) phase => phases%get_dict(ph) thermal => phase%get_dict('thermal') @@ -69,6 +71,7 @@ module function source_externalheat_init(maxNsources) result(isMySource) prm%f = table(src,'t','f') call phase_allocateState(thermalState(ph)%p(so),Nmembers,1,1,0) end associate + exit end if end do end do