avoid global variables
This commit is contained in:
parent
54881a6ca9
commit
8700d7784c
|
@ -18,6 +18,8 @@ module kinematics_thermal_expansion
|
|||
integer, dimension(:), allocatable :: kinematics_thermal_expansion_instance
|
||||
|
||||
type :: tParameters
|
||||
real(pReal) :: &
|
||||
T_ref
|
||||
real(pReal), allocatable, dimension(:,:,:) :: &
|
||||
expansion
|
||||
end type tParameters
|
||||
|
@ -54,8 +56,11 @@ subroutine kinematics_thermal_expansion_init
|
|||
do p = 1, size(config_phase)
|
||||
kinematics_thermal_expansion_instance(p) = count(phase_kinematics(:,1:p) == KINEMATICS_thermal_expansion_ID)
|
||||
if (all(phase_kinematics(:,p) /= KINEMATICS_thermal_expansion_ID)) cycle
|
||||
associate(config => config_phase(p))
|
||||
|
||||
associate(prm => param(kinematics_thermal_expansion_instance(p)), &
|
||||
config => config_phase(p))
|
||||
|
||||
prm%T_ref = config%getFloat('reference_temperature', defaultVal=0.0_pReal)
|
||||
! read up to three parameters (constant, linear, quadratic with T)
|
||||
temp = config%getFloats('thermal_expansion11')
|
||||
!lattice_thermalExpansion33(1,1,1:size(temp),p) = temp
|
||||
|
@ -82,13 +87,15 @@ pure function kinematics_thermal_expansion_initialStrain(homog,phase,offset)
|
|||
real(pReal), dimension(3,3) :: &
|
||||
kinematics_thermal_expansion_initialStrain !< initial thermal strain (should be small strain, though)
|
||||
|
||||
associate(prm => param(kinematics_thermal_expansion_instance(phase)))
|
||||
kinematics_thermal_expansion_initialStrain = &
|
||||
(temperature(homog)%p(offset) - lattice_referenceTemperature(phase))**1 / 1. * &
|
||||
(temperature(homog)%p(offset) - prm%T_ref)**1 / 1. * &
|
||||
lattice_thermalExpansion33(1:3,1:3,1,phase) + & ! constant coefficient
|
||||
(temperature(homog)%p(offset) - lattice_referenceTemperature(phase))**2 / 2. * &
|
||||
(temperature(homog)%p(offset) - prm%T_ref)**2 / 2. * &
|
||||
lattice_thermalExpansion33(1:3,1:3,2,phase) + & ! linear coefficient
|
||||
(temperature(homog)%p(offset) - lattice_referenceTemperature(phase))**3 / 3. * &
|
||||
(temperature(homog)%p(offset) - prm%T_ref)**3 / 3. * &
|
||||
lattice_thermalExpansion33(1:3,1:3,3,phase) ! quadratic coefficient
|
||||
end associate
|
||||
|
||||
end function kinematics_thermal_expansion_initialStrain
|
||||
|
||||
|
@ -111,24 +118,25 @@ subroutine kinematics_thermal_expansion_LiAndItsTangent(Li, dLi_dTstar, ipc, ip,
|
|||
phase, &
|
||||
homog
|
||||
real(pReal) :: &
|
||||
T, TRef, TDot
|
||||
T, TDot
|
||||
|
||||
phase = material_phaseAt(ipc,el)
|
||||
homog = material_homogenizationAt(el)
|
||||
T = temperature(homog)%p(thermalMapping(homog)%p(ip,el))
|
||||
TDot = temperatureRate(homog)%p(thermalMapping(homog)%p(ip,el))
|
||||
TRef = lattice_referenceTemperature(phase)
|
||||
|
||||
associate(prm => param(kinematics_thermal_expansion_instance(phase)))
|
||||
Li = TDot * ( &
|
||||
lattice_thermalExpansion33(1:3,1:3,1,phase)*(T - TRef)**0 & ! constant coefficient
|
||||
+ lattice_thermalExpansion33(1:3,1:3,2,phase)*(T - TRef)**1 & ! linear coefficient
|
||||
+ lattice_thermalExpansion33(1:3,1:3,3,phase)*(T - TRef)**2 & ! quadratic coefficient
|
||||
lattice_thermalExpansion33(1:3,1:3,1,phase)*(T - prm%T_ref)**0 & ! constant coefficient
|
||||
+ lattice_thermalExpansion33(1:3,1:3,2,phase)*(T - prm%T_ref)**1 & ! linear coefficient
|
||||
+ lattice_thermalExpansion33(1:3,1:3,3,phase)*(T - prm%T_ref)**2 & ! quadratic coefficient
|
||||
) / &
|
||||
(1.0_pReal &
|
||||
+ lattice_thermalExpansion33(1:3,1:3,1,phase)*(T - TRef)**1 / 1. &
|
||||
+ lattice_thermalExpansion33(1:3,1:3,2,phase)*(T - TRef)**2 / 2. &
|
||||
+ lattice_thermalExpansion33(1:3,1:3,3,phase)*(T - TRef)**3 / 3. &
|
||||
+ lattice_thermalExpansion33(1:3,1:3,1,phase)*(T - prm%T_ref)**1 / 1. &
|
||||
+ lattice_thermalExpansion33(1:3,1:3,2,phase)*(T - prm%T_ref)**2 / 2. &
|
||||
+ lattice_thermalExpansion33(1:3,1:3,3,phase)*(T - prm%T_ref)**3 / 3. &
|
||||
)
|
||||
end associate
|
||||
dLi_dTstar = 0.0_pReal
|
||||
|
||||
end subroutine kinematics_thermal_expansion_LiAndItsTangent
|
||||
|
|
|
@ -395,8 +395,7 @@ module lattice
|
|||
real(pReal), dimension(:), allocatable, public, protected :: &
|
||||
lattice_damageMobility, &
|
||||
lattice_massDensity, &
|
||||
lattice_specificHeat, &
|
||||
lattice_referenceTemperature
|
||||
lattice_specificHeat
|
||||
! SHOULD NOT BE PART OF LATTICE END
|
||||
|
||||
enum, bind(c)
|
||||
|
@ -476,7 +475,6 @@ subroutine lattice_init
|
|||
allocate(lattice_damageMobility ( Nphases), source=0.0_pReal)
|
||||
allocate(lattice_massDensity ( Nphases), source=0.0_pReal)
|
||||
allocate(lattice_specificHeat ( Nphases), source=0.0_pReal)
|
||||
allocate(lattice_referenceTemperature ( Nphases), source=300.0_pReal)
|
||||
|
||||
allocate(lattice_mu(Nphases), source=0.0_pReal)
|
||||
allocate(lattice_nu(Nphases), source=0.0_pReal)
|
||||
|
@ -539,7 +537,6 @@ subroutine lattice_init
|
|||
|
||||
lattice_specificHeat(p) = config_phase(p)%getFloat( 'specific_heat',defaultVal=0.0_pReal)
|
||||
lattice_massDensity(p) = config_phase(p)%getFloat( 'mass_density',defaultVal=0.0_pReal)
|
||||
lattice_referenceTemperature(p) = config_phase(p)%getFloat( 'reference_temperature',defaultVal=0.0_pReal)
|
||||
lattice_DamageDiffusion33(1,1,p) = config_phase(p)%getFloat( 'damage_diffusion11',defaultVal=0.0_pReal)
|
||||
lattice_DamageDiffusion33(2,2,p) = config_phase(p)%getFloat( 'damage_diffusion22',defaultVal=0.0_pReal)
|
||||
lattice_DamageDiffusion33(3,3,p) = config_phase(p)%getFloat( 'damage_diffusion33',defaultVal=0.0_pReal)
|
||||
|
|
|
@ -60,7 +60,7 @@ subroutine source_thermal_externalheat_init
|
|||
do sourceOffset = 1, phase_Nsources(p)
|
||||
if (phase_source(sourceOffset,p) == SOURCE_thermal_externalheat_ID) then
|
||||
source_thermal_externalheat_offset(p) = sourceOffset
|
||||
exit
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
|
||||
|
|
Loading…
Reference in New Issue