style unification, no enums for output

This commit is contained in:
Martin Diehl 2020-02-14 09:23:09 +01:00
parent 8d6c82e704
commit b1780e71c8
2 changed files with 236 additions and 298 deletions

View File

@ -12,24 +12,6 @@ submodule(constitutive) plastic_dislotwin
real(pReal), parameter :: & real(pReal), parameter :: &
kB = 1.38e-23_pReal !< Boltzmann constant in J/Kelvin kB = 1.38e-23_pReal !< Boltzmann constant in J/Kelvin
enum, bind(c)
enumerator :: &
undefined_ID, &
rho_mob_ID, &
rho_dip_ID, &
dot_gamma_sl_ID, &
gamma_sl_ID, &
Lambda_sl_ID, &
resolved_stress_slip_ID, &
tau_pass_ID, &
edge_dipole_distance_ID, &
f_tw_ID, &
Lambda_tw_ID, &
resolved_stress_twin_ID, &
tau_hat_tw_ID, &
f_tr_ID
end enum
type :: tParameters type :: tParameters
real(pReal) :: & real(pReal) :: &
mu, & mu, &
@ -59,7 +41,7 @@ submodule(constitutive) plastic_dislotwin
gamma_fcc_hex, & !< Free energy difference between austensite and martensite gamma_fcc_hex, & !< Free energy difference between austensite and martensite
i_tr, & !< i_tr, & !<
h !< Stack height of hex nucleus h !< Stack height of hex nucleus
real(pReal), dimension(:), allocatable :: & real(pReal), allocatable, dimension(:) :: &
rho_mob_0, & !< initial unipolar dislocation density per slip system rho_mob_0, & !< initial unipolar dislocation density per slip system
rho_dip_0, & !< initial dipole dislocation density per slip system rho_dip_0, & !< initial dipole dislocation density per slip system
b_sl, & !< absolute length of burgers vector [m] for each slip system b_sl, & !< absolute length of burgers vector [m] for each slip system
@ -79,19 +61,16 @@ submodule(constitutive) plastic_dislotwin
s, & !< s-exponent in trans nucleation rate s, & !< s-exponent in trans nucleation rate
gamma_char, & !< characteristic shear for twins gamma_char, & !< characteristic shear for twins
B !< drag coefficient B !< drag coefficient
real(pReal), dimension(:,:), allocatable :: & real(pReal), allocatable, dimension(:,:) :: &
h_sl_sl, & !< h_sl_sl, & !<
h_sl_tw, & !< h_sl_tw, & !<
h_tw_tw, & !< h_tw_tw, & !<
h_sl_tr, & !< h_sl_tr, & !<
h_tr_tr !< h_tr_tr, & !<
integer, dimension(:,:), allocatable :: &
fcc_twinNucleationSlipPair ! ToDo: Better name? Is also use for trans
real(pReal), dimension(:,:), allocatable :: &
n0_sl, & !< slip system normal n0_sl, & !< slip system normal
forestProjection, & forestProjection, &
C66 C66
real(pReal), dimension(:,:,:), allocatable :: & real(pReal), allocatable, dimension(:,:,:) :: &
P_tr, & P_tr, &
P_sl, & P_sl, &
P_tw, & P_tw, &
@ -101,12 +80,14 @@ submodule(constitutive) plastic_dislotwin
sum_N_sl, & !< total number of active slip system sum_N_sl, & !< total number of active slip system
sum_N_tw, & !< total number of active twin system sum_N_tw, & !< total number of active twin system
sum_N_tr !< total number of active transformation system sum_N_tr !< total number of active transformation system
integer, dimension(:), allocatable :: & integer, allocatable, dimension(:) :: &
N_sl, & !< number of active slip systems for each family N_sl, & !< number of active slip systems for each family
N_tw, & !< number of active twin systems for each family N_tw, & !< number of active twin systems for each family
N_tr !< number of active transformation systems for each family N_tr !< number of active transformation systems for each family
integer(kind(undefined_ID)), dimension(:), allocatable :: & integer, allocatable, dimension(:,:) :: &
outputID !< ID of each post result output fcc_twinNucleationSlipPair ! ToDo: Better name? Is also use for trans
character(len=pStringLen), allocatable, dimension(:) :: &
output
logical :: & logical :: &
ExtendedDislocations, & !< consider split into partials for climb calculation ExtendedDislocations, & !< consider split into partials for climb calculation
fccTwinTransNucleation, & !< twinning and transformation models are for fcc fccTwinTransNucleation, & !< twinning and transformation models are for fcc
@ -148,7 +129,7 @@ contains
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief module initialization !> @brief Perform module initialization.
!> @details reads in material parameters, allocates arrays, and does sanity checks !> @details reads in material parameters, allocates arrays, and does sanity checks
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_dislotwin_init module subroutine plastic_dislotwin_init
@ -156,19 +137,14 @@ module subroutine plastic_dislotwin_init
integer :: & integer :: &
Ninstance, & Ninstance, &
p, i, & p, i, &
NipcMyPhase, outputSize, & NipcMyPhase, &
sizeState, sizeDotState, & sizeState, sizeDotState, &
startIndex, endIndex startIndex, endIndex
integer(kind(undefined_ID)) :: &
outputID
character(len=pStringLen) :: & character(len=pStringLen) :: &
extmsg = '' extmsg = ''
character(len=pStringLen), dimension(:), allocatable :: &
outputs
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOTWIN_label//' init -+>>>' write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOTWIN_label//' init -+>>>'; flush(6)
write(6,'(/,a)') ' Ma and Roters, Acta Materialia 52(12):36033612, 2004' write(6,'(/,a)') ' Ma and Roters, Acta Materialia 52(12):36033612, 2004'
write(6,'(a)') ' https://doi.org/10.1016/j.actamat.2004.04.012' write(6,'(a)') ' https://doi.org/10.1016/j.actamat.2004.04.012'
@ -206,7 +182,6 @@ module subroutine plastic_dislotwin_init
prm%nu = lattice_nu(p) prm%nu = lattice_nu(p)
prm%C66 = lattice_C66(1:6,1:6,p) prm%C66 = lattice_C66(1:6,1:6,p)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! slip related parameters ! slip related parameters
prm%N_sl = config%getInts('nslip',defaultVal=emptyIntArray) prm%N_sl = config%getInts('nslip',defaultVal=emptyIntArray)
@ -411,8 +386,6 @@ module subroutine plastic_dislotwin_init
if (prm%q_sb <= 0.0_pReal) extmsg = trim(extmsg)//' q_shearband' if (prm%q_sb <= 0.0_pReal) extmsg = trim(extmsg)//' q_shearband'
endif endif
prm%D = config%getFloat('grainsize') prm%D = config%getFloat('grainsize')
if (config%keyExists('dipoleformationfactor')) call IO_error(1,ext_msg='use /nodipoleformation/') if (config%keyExists('dipoleformationfactor')) call IO_error(1,ext_msg='use /nodipoleformation/')
@ -435,48 +408,7 @@ module subroutine plastic_dislotwin_init
call IO_error(211,el=p,ext_msg='aTol_f_tr ('//PLASTICITY_DISLOTWIN_label//')') call IO_error(211,el=p,ext_msg='aTol_f_tr ('//PLASTICITY_DISLOTWIN_label//')')
endif endif
outputs = config%getStrings('(output)', defaultVal=emptyStringArray) prm%output = config%getStrings('(output)', defaultVal=emptyStringArray)
allocate(prm%outputID(0))
do i= 1, size(outputs)
outputID = undefined_ID
select case(outputs(i))
case ('rho_mob')
outputID = merge(rho_mob_ID,undefined_ID,prm%sum_N_sl > 0)
outputSize = prm%sum_N_sl
case ('rho_dip')
outputID = merge(rho_dip_ID,undefined_ID,prm%sum_N_sl > 0)
outputSize = prm%sum_N_sl
case ('gamma_sl')
outputID = merge(gamma_sl_ID,undefined_ID,prm%sum_N_sl > 0)
outputSize = prm%sum_N_sl
case ('lambda_sl')
outputID = merge(Lambda_sl_ID,undefined_ID,prm%sum_N_sl > 0)
outputSize = prm%sum_N_sl
case ('tau_pass')
outputID= merge(tau_pass_ID,undefined_ID,prm%sum_N_sl > 0)
outputSize = prm%sum_N_sl
case ('f_tw')
outputID = merge(f_tw_ID,undefined_ID,prm%sum_N_tw >0)
outputSize = prm%sum_N_tw
case ('lambda_tw')
outputID = merge(Lambda_tw_ID,undefined_ID,prm%sum_N_tw >0)
outputSize = prm%sum_N_tw
case ('tau_hat_tw')
outputID = merge(tau_hat_tw_ID,undefined_ID,prm%sum_N_tw >0)
outputSize = prm%sum_N_tw
case ('f_tr')
outputID = f_tr_ID
outputSize = prm%sum_N_tr
end select
if (outputID /= undefined_ID) then
prm%outputID = [prm%outputID, outputID]
endif
enddo
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
@ -548,7 +480,7 @@ end subroutine plastic_dislotwin_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief returns the homogenized elasticity matrix !> @brief Return the homogenized elasticity matrix.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module function plastic_dislotwin_homogenizedC(ipc,ip,el) result(homogenizedC) module function plastic_dislotwin_homogenizedC(ipc,ip,el) result(homogenizedC)
@ -587,7 +519,7 @@ end function plastic_dislotwin_homogenizedC
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief calculates plastic velocity gradient and its tangent !> @brief Calculate plastic velocity gradient and its tangent.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,instance,of) module subroutine plastic_dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp,T,instance,of)
@ -703,7 +635,7 @@ end subroutine plastic_dislotwin_LpAndItsTangent
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief calculates the rate of change of microstructure !> @brief Calculate the rate of change of microstructure.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_dislotwin_dotState(Mp,T,instance,of) module subroutine plastic_dislotwin_dotState(Mp,T,instance,of)
@ -806,7 +738,7 @@ end subroutine plastic_dislotwin_dotState
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief calculates derived quantities from state !> @brief Calculate derived quantities from state.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_dislotwin_dependentState(T,instance,of) module subroutine plastic_dislotwin_dependentState(T,instance,of)
@ -898,46 +830,47 @@ end subroutine plastic_dislotwin_dependentState
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief writes results to HDF5 output file !> @brief Write results to HDF5 output file.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module subroutine plastic_dislotwin_results(instance,group) module subroutine plastic_dislotwin_results(instance,group)
integer, intent(in) :: instance integer, intent(in) :: instance
character(len=*), intent(in) :: group character(len=*), intent(in) :: group
integer :: o integer :: o
associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) associate(prm => param(instance), stt => state(instance), dst => dependentState(instance))
outputsLoop: do o = 1,size(prm%outputID) outputsLoop: do o = 1,size(prm%output)
select case(prm%outputID(o)) select case(trim(prm%output(o)))
case (rho_mob_ID) case('rho_mob')
call results_writeDataset(group,stt%rho_mob,'rho_mob',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_mob,'rho_mob',&
'mobile dislocation density','1/m²') 'mobile dislocation density','1/m²')
case (rho_dip_ID) case('rho_dip')
call results_writeDataset(group,stt%rho_dip,'rho_dip',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%rho_dip,'rho_dip',&
'dislocation dipole density''1/m²') 'dislocation dipole density''1/m²')
case (gamma_sl_ID) case('gamma_sl')
call results_writeDataset(group,stt%gamma_sl,'gamma_sl',& if(prm%sum_N_sl>0) call results_writeDataset(group,stt%gamma_sl,'gamma_sl',&
'plastic shear','1') 'plastic shear','1')
case (Lambda_sl_ID) case('lambda_sl')
call results_writeDataset(group,dst%Lambda_sl,'Lambda_sl',& if(prm%sum_N_sl>0) call results_writeDataset(group,dst%Lambda_sl,'Lambda_sl',&
'mean free path for slip','m') 'mean free path for slip','m')
case (tau_pass_ID) case('tau_pass')
call results_writeDataset(group,dst%tau_pass,'tau_pass',& if(prm%sum_N_sl>0) call results_writeDataset(group,dst%tau_pass,'tau_pass',&
'passing stress for slip','Pa') 'passing stress for slip','Pa')
case (f_tw_ID) case('f_tw')
call results_writeDataset(group,stt%f_tw,'f_tw',& if(prm%sum_N_tw>0) call results_writeDataset(group,stt%f_tw,'f_tw',&
'twinned volume fraction','m³/m³') 'twinned volume fraction','m³/m³')
case (Lambda_tw_ID) case('lambda_tw')
call results_writeDataset(group,dst%Lambda_tw,'Lambda_tw',& if(prm%sum_N_tw>0) call results_writeDataset(group,dst%Lambda_tw,'Lambda_tw',&
'mean free path for twinning','m') 'mean free path for twinning','m')
case (tau_hat_tw_ID) case('tau_hat_tw')
call results_writeDataset(group,dst%tau_hat_tw,'tau_hat_tw',& if(prm%sum_N_tw>0) call results_writeDataset(group,dst%tau_hat_tw,'tau_hat_tw',&
'threshold stress for twinning','Pa') 'threshold stress for twinning','Pa')
case (f_tr_ID) case('f_tr')
call results_writeDataset(group,stt%f_tr,'f_tr',& if(prm%sum_N_tr>0) call results_writeDataset(group,stt%f_tr,'f_tr',&
'martensite volume fraction','m³/m³') 'martensite volume fraction','m³/m³')
end select end select
@ -948,8 +881,8 @@ end subroutine plastic_dislotwin_results
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Shear rates on slip systems, their derivatives with respect to resolved stress and the !> @brief Calculate shear rates on slip systems, their derivatives with respect to resolved
! resolved stresss ! stress, and the resolved stress.
!> @details Derivatives and resolved stress are calculated only optionally. !> @details Derivatives and resolved stress are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end ! have the optional arguments at the end
@ -1025,7 +958,11 @@ end subroutine kinetics_slip
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief calculates shear rates on twin systems !> @brief Calculate shear rates on twin systems and their derivatives with respect to resolved
! stress.
!> @details Derivatives are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
pure subroutine kinetics_twin(Mp,T,dot_gamma_sl,instance,of,& pure subroutine kinetics_twin(Mp,T,dot_gamma_sl,instance,of,&
dot_gamma_twin,ddot_gamma_dtau_twin) dot_gamma_twin,ddot_gamma_dtau_twin)
@ -1090,7 +1027,11 @@ end subroutine kinetics_twin
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief calculates shear rates on twin systems !> @brief Calculate shear rates on transformation systems and their derivatives with respect to
! resolved stress.
!> @details Derivatives are calculated only optionally.
! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to
! have the optional arguments at the end.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
pure subroutine kinetics_trans(Mp,T,dot_gamma_sl,instance,of,& pure subroutine kinetics_trans(Mp,T,dot_gamma_sl,instance,of,&
dot_gamma_tr,ddot_gamma_dtau_trans) dot_gamma_tr,ddot_gamma_dtau_trans)

View File

@ -377,24 +377,21 @@ module subroutine plastic_kinehardening_results(instance,group)
case('resistance') case('resistance')
if(prm%totalNslip>0) call results_writeDataset(group,stt%crss,'xi_sl', & if(prm%totalNslip>0) call results_writeDataset(group,stt%crss,'xi_sl', &
'resistance against plastic slip','Pa') 'resistance against plastic slip','Pa')
case('backstress') ! ToDo: should be 'tau_back' case('backstress') ! ToDo: should be 'tau_back'
if(prm%totalNslip>0) call results_writeDataset(group,stt%crss_back,'tau_back', & if(prm%totalNslip>0) call results_writeDataset(group,stt%crss_back,'tau_back', &
'back stress against plastic slip','Pa') 'back stress against plastic slip','Pa')
case ('sense') case ('sense')
if(prm%totalNslip>0) call results_writeDataset(group,stt%sense,'sense_of_shear','tbd','1') if(prm%totalNslip>0) call results_writeDataset(group,stt%sense,'sense_of_shear', &
'tbd','1')
case ('chi0') case ('chi0')
if(prm%totalNslip>0) call results_writeDataset(group,stt%chi0,'chi0','tbd','Pa') if(prm%totalNslip>0) call results_writeDataset(group,stt%chi0,'chi0', &
'tbd','Pa')
case ('gamma0') case ('gamma0')
if(prm%totalNslip>0) call results_writeDataset(group,stt%gamma0,'gamma0','tbd','1') if(prm%totalNslip>0) call results_writeDataset(group,stt%gamma0,'gamma0', &
'tbd','1')
case ('accumulatedshear') case ('accumulatedshear')
if(prm%totalNslip>0) call results_writeDataset(group,stt%accshear,'gamma_sl', & if(prm%totalNslip>0) call results_writeDataset(group,stt%accshear,'gamma_sl', &
'plastic shear','1') 'plastic shear','1')
end select end select
enddo outputsLoop enddo outputsLoop
end associate end associate