modernized

- no pInt
- consistent indentation by 2 spaces
- no leftovers from old file parsing
This commit is contained in:
Martin Diehl 2019-03-24 11:18:59 +01:00
parent 0f2013e78a
commit 320f39925a
2 changed files with 64 additions and 74 deletions

View File

@ -877,7 +877,8 @@ subroutine constitutive_collectDotState(S, FeArray, Fi, FpArray, subdt, ipc, ip,
call source_damage_anisoDuctile_dotState ( ipc, ip, el) call source_damage_anisoDuctile_dotState ( ipc, ip, el)
case (SOURCE_thermal_externalheat_ID) sourceType case (SOURCE_thermal_externalheat_ID) sourceType
call source_thermal_externalheat_dotState( ipc, ip, el) of = phasememberAt(ipc,ip,el)
call source_thermal_externalheat_dotState(material_phase(ipc,ip,el),of)
end select sourceType end select sourceType

View File

@ -6,29 +6,28 @@
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module source_thermal_externalheat module source_thermal_externalheat
use prec, only: & use prec, only: &
pReal, & pReal
pInt
implicit none implicit none
private private
integer(pInt), dimension(:), allocatable, public, protected :: & integer, dimension(:), allocatable, public, protected :: &
source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism? source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism?
source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism
integer(pInt), dimension(:,:), allocatable, target, public :: & integer, dimension(:,:), allocatable, target, public :: &
source_thermal_externalheat_sizePostResult !< size of each post result output source_thermal_externalheat_sizePostResult !< size of each post result output
character(len=64), dimension(:,:), allocatable, target, public :: & character(len=64), dimension(:,:), allocatable, target, public :: &
source_thermal_externalheat_output !< name of each post result output source_thermal_externalheat_output !< name of each post result output
integer(pInt), dimension(:), allocatable, target, public :: & integer, dimension(:), allocatable, target, public :: &
source_thermal_externalheat_Noutput !< number of outputs per instance of this source source_thermal_externalheat_Noutput !< number of outputs per instance of this source
type, private :: tParameters !< container type for internal constitutive parameters type, private :: tParameters !< container type for internal constitutive parameters
real(pReal), dimension(:), allocatable :: & real(pReal), dimension(:), allocatable :: &
time, & time, &
heat_rate heat_rate
integer(pInt) :: & integer :: &
nIntervals nIntervals
end type tParameters end type tParameters
@ -66,20 +65,18 @@ subroutine source_thermal_externalheat_init
implicit none implicit none
real(pReal), allocatable, dimension(:) :: tempVar integer :: maxNinstance,instance,source,sourceOffset,NofMyPhase,p
integer(pInt) :: maxNinstance,instance,source,sourceOffset
integer(pInt) :: NofMyPhase,p
write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_externalheat_label//' init -+>>>' write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_externalheat_label//' init -+>>>'
maxNinstance = int(count(phase_source == SOURCE_thermal_externalheat_ID),pInt) maxNinstance = count(phase_source == SOURCE_thermal_externalheat_ID)
if (maxNinstance == 0_pInt) return if (maxNinstance == 0) return
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0) &
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
allocate(source_thermal_externalheat_offset(material_Nphase), source=0_pInt) allocate(source_thermal_externalheat_offset(material_Nphase), source=0)
allocate(source_thermal_externalheat_instance(material_Nphase), source=0_pInt) allocate(source_thermal_externalheat_instance(material_Nphase), source=0)
do p = 1, material_Nphase do p = 1, material_Nphase
source_thermal_externalheat_instance(p) = count(phase_source(:,1:p) == SOURCE_thermal_externalheat_ID) source_thermal_externalheat_instance(p) = count(phase_source(:,1:p) == SOURCE_thermal_externalheat_ID)
@ -89,10 +86,10 @@ subroutine source_thermal_externalheat_init
enddo enddo
enddo enddo
allocate(source_thermal_externalheat_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) allocate(source_thermal_externalheat_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0)
allocate(source_thermal_externalheat_output (maxval(phase_Noutput),maxNinstance)) allocate(source_thermal_externalheat_output (maxval(phase_Noutput),maxNinstance))
source_thermal_externalheat_output = '' source_thermal_externalheat_output = ''
allocate(source_thermal_externalheat_Noutput(maxNinstance), source=0_pInt) allocate(source_thermal_externalheat_Noutput(maxNinstance), source=0)
allocate(param(maxNinstance)) allocate(param(maxNinstance))
@ -102,15 +99,13 @@ subroutine source_thermal_externalheat_init
sourceOffset = source_thermal_externalheat_offset(p) sourceOffset = source_thermal_externalheat_offset(p)
NofMyPhase=count(material_phase==p) NofMyPhase=count(material_phase==p)
tempVar = config_phase(p)%getFloats('externalheat_time') param(instance)%time = config_phase(p)%getFloats('externalheat_time')
param(instance)%nIntervals = size(tempVar) - 1_pInt param(instance)%nIntervals = size(param(instance)%time) - 1
param(instance)%time= tempVar
tempVar = config_phase(p)%getFloats('externalheat_rate',requiredSize = size(tempVar)) param(instance)%heat_rate = config_phase(p)%getFloats('externalheat_rate',requiredSize = size(param(instance)%time))
param(instance)%heat_rate = tempVar
call material_allocateSourceState(p,sourceOffset,NofMyPhase,1_pInt,1_pInt,0_pInt) call material_allocateSourceState(p,sourceOffset,NofMyPhase,1,1,0)
enddo enddo
@ -121,64 +116,58 @@ end subroutine source_thermal_externalheat_init
!> @brief rate of change of state !> @brief rate of change of state
!> @details state only contains current time to linearly interpolate given heat powers !> @details state only contains current time to linearly interpolate given heat powers
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine source_thermal_externalheat_dotState(ipc, ip, el) subroutine source_thermal_externalheat_dotState(phase, of)
use material, only: & use material, only: &
phaseAt, phasememberAt, & sourceState
sourceState
implicit none
integer(pInt), intent(in) :: &
ipc, & !< component-ID of integration point
ip, & !< integration point
el !< element
integer(pInt) :: &
phase, &
constituent, &
sourceOffset
phase = phaseAt(ipc,ip,el)
constituent = phasememberAt(ipc,ip,el)
sourceOffset = source_thermal_externalheat_offset(phase)
sourceState(phase)%p(sourceOffset)%dotState(1,constituent) = 1.0_pReal ! state is current time implicit none
integer, intent(in) :: &
phase, &
of
integer :: &
sourceOffset
sourceOffset = source_thermal_externalheat_offset(phase)
sourceState(phase)%p(sourceOffset)%dotState(1,of) = 1.0_pReal ! state is current time
end subroutine source_thermal_externalheat_dotState end subroutine source_thermal_externalheat_dotState
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief returns local heat generation rate !> @brief returns local heat generation rate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine source_thermal_externalheat_getRateAndItsTangent(TDot, dTDot_dT, phase, constituent) subroutine source_thermal_externalheat_getRateAndItsTangent(TDot, dTDot_dT, phase, of)
use material, only: & use material, only: &
sourceState sourceState
implicit none implicit none
integer(pInt), intent(in) :: & integer, intent(in) :: &
phase, & phase, &
constituent of
real(pReal), intent(out) :: & real(pReal), intent(out) :: &
TDot, & TDot, &
dTDot_dT dTDot_dT
integer(pInt) :: & integer :: &
instance, sourceOffset, interval instance, sourceOffset, interval
real(pReal) :: & real(pReal) :: &
frac_time frac_time
instance = source_thermal_externalheat_instance(phase) instance = source_thermal_externalheat_instance(phase)
sourceOffset = source_thermal_externalheat_offset(phase) sourceOffset = source_thermal_externalheat_offset(phase)
do interval = 1, param(instance)%nIntervals ! scan through all rate segments do interval = 1, param(instance)%nIntervals ! scan through all rate segments
frac_time = (sourceState(phase)%p(sourceOffset)%state(1,constituent) - & frac_time = (sourceState(phase)%p(sourceOffset)%state(1,of) - &
param(instance)%time(interval)) / & param(instance)%time(interval)) / &
(param(instance)%time(interval+1) - & (param(instance)%time(interval+1) - &
param(instance)%time(interval)) ! fractional time within segment param(instance)%time(interval)) ! fractional time within segment
if ( (frac_time < 0.0_pReal .and. interval == 1) & if ( (frac_time < 0.0_pReal .and. interval == 1) &
.or. (frac_time >= 1.0_pReal .and. interval == param(instance)%nIntervals) & .or. (frac_time >= 1.0_pReal .and. interval == param(instance)%nIntervals) &
.or. (frac_time >= 0.0_pReal .and. frac_time < 1.0_pReal) ) & .or. (frac_time >= 0.0_pReal .and. frac_time < 1.0_pReal) ) &
TDot = param(instance)%heat_rate(interval ) * (1.0_pReal - frac_time) + & TDot = param(instance)%heat_rate(interval ) * (1.0_pReal - frac_time) + &
param(instance)%heat_rate(interval+1) * frac_time ! interpolate heat rate between segment boundaries... param(instance)%heat_rate(interval+1) * frac_time ! interpolate heat rate between segment boundaries...
! ...or extrapolate if outside of bounds ! ...or extrapolate if outside of bounds
enddo enddo
dTDot_dT = 0.0 dTDot_dT = 0.0
end subroutine source_thermal_externalheat_getRateAndItsTangent end subroutine source_thermal_externalheat_getRateAndItsTangent