can only have one instance per thermal source

This commit is contained in:
Philip Eisenlohr 2023-07-22 15:17:30 -04:00
parent 2d0b64e00d
commit dafd39566d
3 changed files with 12 additions and 5 deletions

View File

@ -548,6 +548,8 @@ subroutine IO_error(error_ID,ext_msg,label1,ID1,label2,ID2)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! user errors ! user errors
case (600)
msg = 'only one source entry allowed'
case (603) case (603)
msg = 'invalid data for table' msg = 'invalid data for table'
case (610) case (610)

View File

@ -35,7 +35,7 @@ module function source_dissipation_init(maxNsources) result(isMySource)
class(tList), pointer :: & class(tList), pointer :: &
sources sources
character(len=:), allocatable :: refs character(len=:), allocatable :: refs
integer :: ph,Nmembers,so integer :: ph,Nmembers,so,Nsources
isMySource = thermal_active('dissipation',maxNsources) isMySource = thermal_active('dissipation',maxNsources)
@ -49,7 +49,9 @@ module function source_dissipation_init(maxNsources) result(isMySource)
allocate(param(phases%length)) allocate(param(phases%length))
do ph = 1, 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) Nmembers = count(material_ID_phase == ph)
phase => phases%get_dict(ph) phase => phases%get_dict(ph)
thermal => phase%get_dict('thermal') thermal => phase%get_dict('thermal')
@ -64,8 +66,8 @@ module function source_dissipation_init(maxNsources) result(isMySource)
prm%kappa = src%get_asReal('kappa') prm%kappa = src%get_asReal('kappa')
call phase_allocateState(thermalState(ph)%p(so),Nmembers,0,0,0) call phase_allocateState(thermalState(ph)%p(so),Nmembers,0,0,0)
end associate end associate
exit
end if end if
end do end do
end do end do

View File

@ -37,7 +37,7 @@ module function source_externalheat_init(maxNsources) result(isMySource)
type(tList), pointer :: & type(tList), pointer :: &
sources sources
character(len=:), allocatable :: refs character(len=:), allocatable :: refs
integer :: ph,Nmembers,so integer :: ph,Nmembers,so,Nsources
isMySource = thermal_active('externalheat',maxNsources) isMySource = thermal_active('externalheat',maxNsources)
@ -52,7 +52,9 @@ module function source_externalheat_init(maxNsources) result(isMySource)
allocate(source_ID(phases%length), source=0) allocate(source_ID(phases%length), source=0)
do ph = 1, phases%length 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) Nmembers = count(material_ID_phase == ph)
phase => phases%get_dict(ph) phase => phases%get_dict(ph)
thermal => phase%get_dict('thermal') thermal => phase%get_dict('thermal')
@ -69,6 +71,7 @@ module function source_externalheat_init(maxNsources) result(isMySource)
prm%f = table(src,'t','f') prm%f = table(src,'t','f')
call phase_allocateState(thermalState(ph)%p(so),Nmembers,1,1,0) call phase_allocateState(thermalState(ph)%p(so),Nmembers,1,1,0)
end associate end associate
exit
end if end if
end do end do
end do end do