From 1808b37357ed53180b1092dbd1a2e11e1d19b354 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Nov 2018 11:17:12 +0100 Subject: [PATCH 001/147] can be easily computed during postprocessing --- src/plastic_phenopowerlaw.f90 | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 57d48d109..0e85a65c9 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -24,12 +24,10 @@ module plastic_phenopowerlaw accumulatedshear_slip_ID, & shearrate_slip_ID, & resolvedstress_slip_ID, & - totalshear_ID, & resistance_twin_ID, & accumulatedshear_twin_ID, & shearrate_twin_ID, & - resolvedstress_twin_ID, & - totalvolfrac_twin_ID + resolvedstress_twin_ID end enum type, private :: tParameters @@ -338,12 +336,6 @@ subroutine plastic_phenopowerlaw_init outputID = merge(resolvedstress_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) outputSize = prm%totalNtwin - case ('totalshear') - outputID = merge(totalshear_ID,undefined_ID,prm%totalNslip>0_pInt) - outputSize = 1_pInt - case ('totalvolfrac_twin') - outputID = merge(totalvolfrac_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) - outputSize = 1_pInt end select if (outputID /= undefined_ID) then @@ -732,13 +724,6 @@ function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) enddo c = c + prm%totalNtwin - case (totalshear_ID) - postResults(c+1_pInt) = stt%sumGamma(of) - c = c + 1_pInt - case (totalvolfrac_twin_ID) - postResults(c+1_pInt) = stt%sumF(of) - c = c + 1_pInt - end select enddo outputsLoop end associate From 8a253856f1262b10bad16bd71b74c51f25c23407 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Nov 2018 15:38:14 +0100 Subject: [PATCH 002/147] no need to perform the state integration --- src/plastic_phenopowerlaw.f90 | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 0e85a65c9..c777bff8c 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -79,7 +79,6 @@ module plastic_phenopowerlaw type, private :: tPhenopowerlawState real(pReal), pointer, dimension(:) :: & - sumGamma, & ! ToDo: why not make a dependent state? sumF ! ToDo: why not make a dependent state? real(pReal), pointer, dimension(:,:) :: & xi_slip, & @@ -351,7 +350,7 @@ subroutine plastic_phenopowerlaw_init NipcMyPhase = count(material_phase == p) ! number of IPCs containing my phase sizeState = size(['tau_slip ','gamma_slip']) * prm%TotalNslip & + size(['tau_twin ','gamma_twin']) * prm%TotalNtwin & - + size(['sum(gamma)','sum(f) ']) ! ToDo: only needed if either twin or slip active! + + size(['sum(f) ']) ! ToDo: only needed if either twin or slip active! sizeDotState = sizeState call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & @@ -375,12 +374,6 @@ subroutine plastic_phenopowerlaw_init dot%xi_twin => plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolResistance - startIndex = endIndex + 1_pInt - endIndex = endIndex + 1_pInt - stt%sumGamma => plasticState(p)%state (startIndex,:) - dot%sumGamma => plasticState(p)%dotState(startIndex,:) - plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolShear - startIndex = endIndex + 1_pInt endIndex = endIndex + 1_pInt stt%sumF=>plasticState(p)%state (startIndex,:) @@ -482,7 +475,7 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) i real(pReal) :: & c_SlipSlip,c_TwinSlip,c_TwinTwin, & - xi_slip_sat_offset + xi_slip_sat_offset,sumGamma real(pReal), dimension(param(instance)%totalNslip) :: & left_SlipSlip,right_SlipSlip, & @@ -494,11 +487,12 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) associate(prm => param(instance), stt => state(instance), dot => dotState(instance)) dot%whole(:,of) = 0.0_pReal + sumGamma = sum(stt%gamma_slip(:,of)) !-------------------------------------------------------------------------------------------------- ! system-independent (nonlinear) prefactors to M_Xx (X influenced by x) matrices c_SlipSlip = prm%h0_slipslip * (1.0_pReal + prm%twinC*stt%sumF(of)** prm%twinB) - c_TwinSlip = prm%h0_TwinSlip * stt%sumGamma(of)**prm%twinE + c_TwinSlip = prm%h0_TwinSlip * sumGamma**prm%twinE c_TwinTwin = prm%h0_TwinTwin * stt%sumF(of)**prm%twinD !-------------------------------------------------------------------------------------------------- @@ -512,7 +506,6 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) ! shear rates call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg) dot%gamma_slip(:,of) = abs(gdot_slip_pos+gdot_slip_neg) - dot%sumGamma(of) = sum(dot%gamma_slip(:,of)) call kinetics_twin(prm,stt,of,Mp,dot%gamma_twin(:,of)) if (prm%totalNtwin > 0_pInt) dot%sumF(of) = merge(sum(dot%gamma_twin(:,of)/prm%gamma_twin_char), & 0.0_pReal, & From 7cc2892e646eb25dc61953d3e85e7ec31ad9fab0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Nov 2018 16:14:46 +0100 Subject: [PATCH 003/147] no need to calculate twinned volume fraction as state --- src/plastic_phenopowerlaw.f90 | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index c777bff8c..c2f5edb68 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -78,8 +78,6 @@ module plastic_phenopowerlaw type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance) type, private :: tPhenopowerlawState - real(pReal), pointer, dimension(:) :: & - sumF ! ToDo: why not make a dependent state? real(pReal), pointer, dimension(:,:) :: & xi_slip, & xi_twin, & @@ -349,8 +347,7 @@ subroutine plastic_phenopowerlaw_init ! allocate state arrays NipcMyPhase = count(material_phase == p) ! number of IPCs containing my phase sizeState = size(['tau_slip ','gamma_slip']) * prm%TotalNslip & - + size(['tau_twin ','gamma_twin']) * prm%TotalNtwin & - + size(['sum(f) ']) ! ToDo: only needed if either twin or slip active! + + size(['tau_twin ','gamma_twin']) * prm%TotalNtwin sizeDotState = sizeState call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & @@ -374,12 +371,6 @@ subroutine plastic_phenopowerlaw_init dot%xi_twin => plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolResistance - startIndex = endIndex + 1_pInt - endIndex = endIndex + 1_pInt - stt%sumF=>plasticState(p)%state (startIndex,:) - dot%sumF=>plasticState(p)%dotState(startIndex,:) - plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolTwinFrac - startIndex = endIndex + 1_pInt endIndex = endIndex + prm%totalNslip stt%gamma_slip => plasticState(p)%state (startIndex:endIndex,:) @@ -439,7 +430,8 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) slipSystems: do i = 1_pInt, prm%totalNslip - Lp = Lp + (1.0_pReal-stt%sumF(of))*(gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) + Lp = Lp + (1.0_pReal- sum(stt%gamma_twin(:,of)/prm%gamma_twin_char)) & ! only shear in untwinned volume + * (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & + dgdot_dtauslip_pos(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_pos(m,n,i) & @@ -475,8 +467,8 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) i real(pReal) :: & c_SlipSlip,c_TwinSlip,c_TwinTwin, & - xi_slip_sat_offset,sumGamma - + xi_slip_sat_offset,& + sumGamma,sumF real(pReal), dimension(param(instance)%totalNslip) :: & left_SlipSlip,right_SlipSlip, & gdot_slip_pos,gdot_slip_neg @@ -488,17 +480,18 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) dot%whole(:,of) = 0.0_pReal sumGamma = sum(stt%gamma_slip(:,of)) + sumF = sum(stt%gamma_twin(:,of)/prm%gamma_twin_char) !-------------------------------------------------------------------------------------------------- ! system-independent (nonlinear) prefactors to M_Xx (X influenced by x) matrices - c_SlipSlip = prm%h0_slipslip * (1.0_pReal + prm%twinC*stt%sumF(of)** prm%twinB) + c_SlipSlip = prm%h0_slipslip * (1.0_pReal + prm%twinC*sumF** prm%twinB) c_TwinSlip = prm%h0_TwinSlip * sumGamma**prm%twinE - c_TwinTwin = prm%h0_TwinTwin * stt%sumF(of)**prm%twinD + c_TwinTwin = prm%h0_TwinTwin * sumF**prm%twinD !-------------------------------------------------------------------------------------------------- ! calculate left and right vectors left_SlipSlip = 1.0_pReal + prm%H_int - xi_slip_sat_offset = prm%spr*sqrt(stt%sumF(of)) + xi_slip_sat_offset = prm%spr*sqrt(sumF) right_SlipSlip = abs(1.0_pReal-stt%xi_slip(:,of) / (prm%xi_slip_sat+xi_slip_sat_offset)) **prm%a_slip & * sign(1.0_pReal,1.0_pReal-stt%xi_slip(:,of) / (prm%xi_slip_sat+xi_slip_sat_offset)) @@ -507,9 +500,6 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg) dot%gamma_slip(:,of) = abs(gdot_slip_pos+gdot_slip_neg) call kinetics_twin(prm,stt,of,Mp,dot%gamma_twin(:,of)) - if (prm%totalNtwin > 0_pInt) dot%sumF(of) = merge(sum(dot%gamma_twin(:,of)/prm%gamma_twin_char), & - 0.0_pReal, & - stt%sumF(of) < 0.98_pReal) !-------------------------------------------------------------------------------------------------- ! hardening @@ -605,7 +595,7 @@ end subroutine kinetics_slip !-------------------------------------------------------------------------------------------------- !> @brief calculates shear rates on twin systems and derivatives with respect to resolved stress -!> @details: Shear rates are calculated only optionally. NOTE: Against the common convention, the +!> @details: Derivates 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(prm,stt,of,Mp,gdot_twin,dgdot_dtau_twin) @@ -637,7 +627,8 @@ pure subroutine kinetics_twin(prm,stt,of,Mp,gdot_twin,dgdot_dtau_twin) enddo where(tau_twin > 0.0_pReal) - gdot_twin = (1.0_pReal-stt%sumF(of))*prm%gdot0_twin*(abs(tau_twin)/stt%xi_twin(:,of))**prm%n_twin + gdot_twin = (1.0_pReal-sum(stt%gamma_twin(:,of)/prm%gamma_twin_char)) & ! only twin in untwinned volume fraction + * prm%gdot0_twin*(abs(tau_twin)/stt%xi_twin(:,of))**prm%n_twin else where gdot_twin = 0.0_pReal end where From 638789b111d1540b6133b8c4449f9d4878d368c7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Nov 2018 16:16:46 +0100 Subject: [PATCH 004/147] totalvolfrac and totalshear don't exist anymore use postprocessing tools if needed --- examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config | 1 - examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config | 1 - examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config | 1 - examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config | 2 -- examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config | 2 -- examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config | 2 -- examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config | 2 -- 7 files changed, 11 deletions(-) diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config index 63ec8f3c8..938961d8e 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config @@ -6,7 +6,6 @@ plasticity phenopowerlaw (output) shearrate_slip (output) resolvedstress_slip (output) accumulated_shear_slip -(output) totalshear lattice_structure fcc Nslip 12 # per family diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config index 594c5dc22..87b4e2312 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config @@ -19,4 +19,3 @@ tausat_slip 222.e6 412.7e6 # per family, optimization long h0_slipslip 1000.0e6 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 w0_slip 2.0 -(output) totalshear diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config index c86d516a9..a04f27e7f 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config @@ -19,4 +19,3 @@ tausat_slip 872.9e6 971.2e6 # per family h0_slipslip 563.0e9 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 a_slip 2.0 -(output) totalshear diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config index a2e06fc07..bb6f8fc83 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config @@ -14,11 +14,9 @@ plasticity phenopowerlaw (output) resistance_slip (output) shearrate_slip (output) resolvedstress_slip -(output) totalshear (output) resistance_twin (output) shearrate_twin (output) resolvedstress_twin -(output) totalvolfrac_twin lattice_structure fcc Nslip 12 # per family diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config index ce6b06ff9..137606093 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config @@ -9,11 +9,9 @@ elasticity hooke (output) resistance_slip (output) shearrate_slip (output) resolvedstress_slip -(output) totalshear (output) resistance_twin (output) shearrate_twin (output) resolvedstress_twin -(output) totalvolfrac_twin lattice_structure hex covera_ratio 1.62350 # from Tromans 2011, Elastic Anisotropy of HCP Metal Crystals and Polycrystals diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config b/examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config index 64ecbca25..565cf02d9 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config @@ -5,11 +5,9 @@ elasticity hooke # (output) resistance_slip # (output) shearrate_slip # (output) resolvedstress_slip -# (output) totalshear # (output) resistance_twin # (output) shearrate_twin # (output) resolvedstress_twin -# (output) totalvolfrac_twin lattice_structure hex covera_ratio 1.587 diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config b/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config index 05503a6e7..adad3710e 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config @@ -6,12 +6,10 @@ plasticity phenopowerlaw (output) shearrate_slip (output) resolvedstress_slip (output) accumulated_shear_slip -(output) totalshear (output) resistance_twin (output) shearrate_twin (output) resolvedstress_twin (output) accumulated_shear_twin -(output) totalvolfrac_twin lattice_structure fcc Nslip 12 # per family From cf4a0a69fd64b300fe161d314ee170d63386d45f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 26 Nov 2018 09:15:44 +0100 Subject: [PATCH 005/147] Intel compiler detected use of unallocated variable bug was in for a while --- src/plastic_phenopowerlaw.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index c2f5edb68..5fd8d8e3c 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -278,6 +278,7 @@ subroutine plastic_phenopowerlaw_init else twinActive allocate(prm%interaction_TwinTwin(0,0)) allocate(prm%xi_twin_0(0)) + allocate(prm%gamma_twin_char(0)) endif twinActive !-------------------------------------------------------------------------------------------------- From d451a3a7a09ff03cb7bd537e9b799283d873983b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 27 Nov 2018 18:25:06 +0100 Subject: [PATCH 006/147] calculation of shearrates etc in one function --- src/plastic_disloUCLA.f90 | 176 +++++++++++++++++++++++++------------- 1 file changed, 118 insertions(+), 58 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 7c4d87fff..1e33f82b0 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -1241,6 +1241,123 @@ function plastic_disloUCLA_postResults(Tstar_v,Temperature,ipc,ip,el) plastic_disloUCLA_postResults(c+1_pInt:c+ns) = state(instance)%rhoEdgeDip(1_pInt:ns,of) c = c + ns case (shear_rate_slip_ID,stress_exponent_ID) + call kinetics(Tstar_v,Temperature,ipc,ip,el, & + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + + if (plastic_disloUCLA_outputID(o,instance) == shear_rate_slip_ID) then + plastic_disloUCLA_postResults(c+1:c+ns) = (gdot_slip_pos + gdot_slip_neg)*0.5_pReal + c = c + ns + elseif(plastic_disloUCLA_outputID(o,instance) == stress_exponent_ID) then + do j = 1_pInt, ns + if (dEq(gdot_slip_pos(j)+gdot_slip_neg(j),0.0_pReal)) then + plastic_disloUCLA_postResults(c+j) = 0.0_pReal + else + plastic_disloUCLA_postResults(c+j) = (tau_slip_pos(j)+tau_slip_neg(j))/& + (gdot_slip_pos(j)+gdot_slip_neg(j))*& + (dgdot_dtauslip_pos(j)+dgdot_dtauslip_neg(j))* 0.5_pReal + endif + enddo + c = c + ns + endif + + case (accumulated_shear_slip_ID) + plastic_disloUCLA_postResults(c+1_pInt:c+ns) = & + state(instance)%accshear_slip(1_pInt:ns, of) + c = c + ns + case (mfp_slip_ID) + plastic_disloUCLA_postResults(c+1_pInt:c+ns) =& + state(instance)%mfp_slip(1_pInt:ns, of) + c = c + ns + case (resolved_stress_slip_ID) + j = 0_pInt + slipFamilies1: do f = 1_pInt,lattice_maxNslipFamily + index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family + slipSystems1: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) + j = j + 1_pInt + plastic_disloUCLA_postResults(c+j) =& + dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph)) + enddo slipSystems1; enddo slipFamilies1 + c = c + ns + case (threshold_stress_slip_ID) + plastic_disloUCLA_postResults(c+1_pInt:c+ns) = & + state(instance)%threshold_stress_slip(1_pInt:ns,of) + c = c + ns + case (edge_dipole_distance_ID) + j = 0_pInt + slipFamilies2: do f = 1_pInt,lattice_maxNslipFamily + index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family + slipSystems2: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) + j = j + 1_pInt + if (dNeq0(abs(dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph))))) then + plastic_disloUCLA_postResults(c+j) = & + (3.0_pReal*lattice_mu(ph)*plastic_disloUCLA_burgersPerSlipSystem(j,instance))/& + (16.0_pReal*pi*abs(dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph)))) + else + plastic_disloUCLA_postResults(c+j) = huge(1.0_pReal) + endif + plastic_disloUCLA_postResults(c+j)=min(plastic_disloUCLA_postResults(c+j),& + state(instance)%mfp_slip(j,of)) + enddo slipSystems2; enddo slipFamilies2 + c = c + ns + end select + enddo +end function plastic_disloUCLA_postResults + + +!-------------------------------------------------------------------------------------------------- +!> @brief return array of constitutive results +!-------------------------------------------------------------------------------------------------- +subroutine kinetics(Tstar_v,Temperature,ipc,ip,el, & + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + use prec, only: & + tol_math_check, & + dEq, dNeq0 + use math, only: & + pi + use material, only: & + material_phase, & + phase_plasticityInstance,& + !plasticState, & + phaseAt, phasememberAt + use lattice, only: & + lattice_Sslip_v, & + lattice_maxNslipFamily, & + lattice_NslipSystem, & + lattice_NnonSchmid, & + lattice_mu + + implicit none + real(pReal), dimension(6), intent(in) :: & + Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation + real(pReal), intent(in) :: & + temperature !< temperature at integration point + integer(pInt), intent(in) :: & + ipc, & !< component-ID of integration point + ip, & !< integration point + el !< element + + real(pReal), dimension(plastic_disloUCLA_sizePostResults(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + plastic_disloUCLA_postResults + + integer(pInt) :: & + instance,& + ns,& + f,o,i,c,j,k,index_myFamily,& + ph, & + of + real(pReal) :: StressRatio_p,StressRatio_pminus1,& + BoltzmannRatio,DotGamma0,stressRatio,& + dvel_slip, vel_slip + real(pReal), intent(out), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg + + !* Shortened notation + of = phasememberAt(ipc,ip,el) + ph = phaseAt(ipc,ip,el) + instance = phase_plasticityInstance(ph) + ns = plastic_disloUCLA_totalNslip(instance) + + gdot_slip_pos = 0.0_pReal gdot_slip_neg = 0.0_pReal dgdot_dtauslip_pos = 0.0_pReal @@ -1404,63 +1521,6 @@ function plastic_disloUCLA_postResults(Tstar_v,Temperature,ipc,ip,el) enddo slipSystems enddo slipFamilies - if (plastic_disloUCLA_outputID(o,instance) == shear_rate_slip_ID) then - plastic_disloUCLA_postResults(c+1:c+ns) = (gdot_slip_pos + gdot_slip_neg)*0.5_pReal - c = c + ns - elseif(plastic_disloUCLA_outputID(o,instance) == stress_exponent_ID) then - do j = 1_pInt, ns - if (dEq(gdot_slip_pos(j)+gdot_slip_neg(j),0.0_pReal)) then - plastic_disloUCLA_postResults(c+j) = 0.0_pReal - else - plastic_disloUCLA_postResults(c+j) = (tau_slip_pos(j)+tau_slip_neg(j))/& - (gdot_slip_pos(j)+gdot_slip_neg(j))*& - (dgdot_dtauslip_pos(j)+dgdot_dtauslip_neg(j))* 0.5_pReal - endif - enddo - c = c + ns - endif - - case (accumulated_shear_slip_ID) - plastic_disloUCLA_postResults(c+1_pInt:c+ns) = & - state(instance)%accshear_slip(1_pInt:ns, of) - c = c + ns - case (mfp_slip_ID) - plastic_disloUCLA_postResults(c+1_pInt:c+ns) =& - state(instance)%mfp_slip(1_pInt:ns, of) - c = c + ns - case (resolved_stress_slip_ID) - j = 0_pInt - slipFamilies1: do f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family - slipSystems1: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - j = j + 1_pInt - plastic_disloUCLA_postResults(c+j) =& - dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph)) - enddo slipSystems1; enddo slipFamilies1 - c = c + ns - case (threshold_stress_slip_ID) - plastic_disloUCLA_postResults(c+1_pInt:c+ns) = & - state(instance)%threshold_stress_slip(1_pInt:ns,of) - c = c + ns - case (edge_dipole_distance_ID) - j = 0_pInt - slipFamilies2: do f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family - slipSystems2: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - j = j + 1_pInt - if (dNeq0(abs(dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph))))) then - plastic_disloUCLA_postResults(c+j) = & - (3.0_pReal*lattice_mu(ph)*plastic_disloUCLA_burgersPerSlipSystem(j,instance))/& - (16.0_pReal*pi*abs(dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph)))) - else - plastic_disloUCLA_postResults(c+j) = huge(1.0_pReal) - endif - plastic_disloUCLA_postResults(c+j)=min(plastic_disloUCLA_postResults(c+j),& - state(instance)%mfp_slip(j,of)) - enddo slipSystems2; enddo slipFamilies2 - c = c + ns - end select - enddo -end function plastic_disloUCLA_postResults +end subroutine kinetics end module plastic_disloUCLA From d89dc6cc007c84488bb79a7e930d39d35e37ae98 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 27 Nov 2018 18:41:33 +0100 Subject: [PATCH 007/147] preparing for the use of kinetics --- src/plastic_disloUCLA.f90 | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 1e33f82b0..017bdf548 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -1017,8 +1017,6 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) EdgeDipMinDistance,& AtomicVolume,& VacancyDiffusion,& - tau_slip_pos,& - tau_slip_neg,& DotRhoMultiplication,& EdgeDipDistance, & DotRhoEdgeDipAnnihilation, & @@ -1029,7 +1027,9 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) vel_slip, & gdot_slip real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & - gdot_slip_pos, gdot_slip_neg + gdot_slip_pos, gdot_slip_neg,& + tau_slip_pos,& + tau_slip_neg !* Shortened notation of = phasememberAt(ipc,ip,el) @@ -1054,19 +1054,19 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) state(instance)%rhoEdge(j,of)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)*& plastic_disloUCLA_v0PerSlipSystem(j,instance) !* Resolved shear stress on slip system - tau_slip_pos = dot_product(Tstar_v,lattice_Sslip_v(1:6,1,index_myFamily+i,ph)) - tau_slip_neg = tau_slip_pos + tau_slip_pos(j) = dot_product(Tstar_v,lattice_Sslip_v(1:6,1,index_myFamily+i,ph)) + tau_slip_neg(j) = tau_slip_pos(j) nonSchmidSystems: do k = 1,lattice_NnonSchmid(ph) - tau_slip_pos = tau_slip_pos + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & + tau_slip_pos(j) = tau_slip_pos(j) + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k, index_myFamily+i,ph)) - tau_slip_neg = tau_slip_neg + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & + tau_slip_neg(j) = tau_slip_neg(j) + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k+1,index_myFamily+i,ph)) enddo nonSchmidSystems - significantPositiveStress: if((abs(tau_slip_pos)-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then + significantPositiveStress: if((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then !* Stress ratios - stressRatio = ((abs(tau_slip_pos)-state(instance)%threshold_stress_slip(j,of))/& + stressRatio = ((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j,of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) @@ -1074,10 +1074,10 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * (tau_slip_pos & + * (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos & + 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & @@ -1085,11 +1085,11 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) gdot_slip_pos(j) = DotGamma0 & * vel_slip & - * sign(1.0_pReal,tau_slip_pos) + * sign(1.0_pReal,tau_slip_pos(j)) endif significantPositiveStress - significantNegativeStress: if((abs(tau_slip_neg)-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then + significantNegativeStress: if((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then !* Stress ratios - stressRatio = ((abs(tau_slip_neg)-state(instance)%threshold_stress_slip(j,of))/& + stressRatio = ((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j,of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) @@ -1097,10 +1097,10 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * (tau_slip_neg & + * (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg & + 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & @@ -1108,7 +1108,7 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) gdot_slip_neg(j) = DotGamma0 & * vel_slip & - * sign(1.0_pReal,tau_slip_neg) + * sign(1.0_pReal,tau_slip_neg(j)) endif significantNegativeStress gdot_slip = (gdot_slip_pos(j)+gdot_slip_neg(j))*0.5_pReal !* Multiplication @@ -1119,12 +1119,12 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) !* Dipole formation EdgeDipMinDistance = & plastic_disloUCLA_CEdgeDipMinDistance(instance)*plastic_disloUCLA_burgersPerSlipSystem(j,instance) - if (dEq0(tau_slip_pos)) then + if (dEq0(tau_slip_pos(j))) then DotRhoDipFormation = 0.0_pReal else EdgeDipDistance = & (3.0_pReal*lattice_mu(ph)*plastic_disloUCLA_burgersPerSlipSystem(j,instance))/& - (16.0_pReal*pi*abs(tau_slip_pos)) + (16.0_pReal*pi*abs(tau_slip_pos(j))) if (EdgeDipDistance>state(instance)%mfp_slip(j,of)) EdgeDipDistance=state(instance)%mfp_slip(j,of) if (EdgeDipDistance Date: Tue, 27 Nov 2018 18:53:01 +0100 Subject: [PATCH 008/147] don't need to repeat code --- src/plastic_disloUCLA.f90 | 63 +++------------------------------------ 1 file changed, 4 insertions(+), 59 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 017bdf548..3d91a6fd3 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -1029,7 +1029,8 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & gdot_slip_pos, gdot_slip_neg,& tau_slip_pos,& - tau_slip_neg + tau_slip_neg, & + dgdot_dtauslip_neg,dgdot_dtauslip_pos !* Shortened notation of = phasememberAt(ipc,ip,el) @@ -1040,8 +1041,8 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) plasticState(ph)%dotState(:,of) = 0.0_pReal !* Dislocation density evolution - gdot_slip_pos = 0.0_pReal - gdot_slip_neg = 0.0_pReal + call kinetics(Tstar_v,Temperature,ipc,ip,el, & + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) j = 0_pInt slipFamilies: do f = 1_pInt,lattice_maxNslipFamily index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family @@ -1053,63 +1054,7 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) DotGamma0 = & state(instance)%rhoEdge(j,of)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)*& plastic_disloUCLA_v0PerSlipSystem(j,instance) - !* Resolved shear stress on slip system - tau_slip_pos(j) = dot_product(Tstar_v,lattice_Sslip_v(1:6,1,index_myFamily+i,ph)) - tau_slip_neg(j) = tau_slip_pos(j) - nonSchmidSystems: do k = 1,lattice_NnonSchmid(ph) - tau_slip_pos(j) = tau_slip_pos(j) + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & - dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k, index_myFamily+i,ph)) - tau_slip_neg(j) = tau_slip_neg(j) + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & - dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k+1,index_myFamily+i,ph)) - enddo nonSchmidSystems - - significantPositiveStress: if((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then - !* Stress ratios - stressRatio = ((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j,of))/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+& - plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) - stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) - !* Shear rates due to slip - vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & - / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - ) - - gdot_slip_pos(j) = DotGamma0 & - * vel_slip & - * sign(1.0_pReal,tau_slip_pos(j)) - endif significantPositiveStress - significantNegativeStress: if((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then - !* Stress ratios - stressRatio = ((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j,of))/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+& - plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) - stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) - - vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & - / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - ) - - gdot_slip_neg(j) = DotGamma0 & - * vel_slip & - * sign(1.0_pReal,tau_slip_neg(j)) - endif significantNegativeStress gdot_slip = (gdot_slip_pos(j)+gdot_slip_neg(j))*0.5_pReal !* Multiplication DotRhoMultiplication = abs(gdot_slip)/& From 87b7569eb5df64daca02e910938ad54a1c034d07 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 27 Nov 2018 19:01:55 +0100 Subject: [PATCH 009/147] preparing use of kinetics function --- src/plastic_disloUCLA.f90 | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 3d91a6fd3..b335cce26 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -774,14 +774,14 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature integer(pInt) :: instance,ph,of,ns,f,i,j,k,l,m,n,index_myFamily real(pReal) :: StressRatio_p,StressRatio_pminus1,BoltzmannRatio,DotGamma0, & - tau_slip_pos,tau_slip_neg,vel_slip,dvel_slip,& - dgdot_dtauslip_pos,dgdot_dtauslip_neg,stressRatio + vel_slip,dvel_slip,& + stressRatio real(pReal), dimension(3,3,2) :: & nonSchmid_tensor real(pReal), dimension(3,3,3,3) :: & dLp_dTstar3333 real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & - gdot_slip_pos,gdot_slip_neg + gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg !* Shortened notation of = phasememberAt(ipc,ip,el) @@ -811,14 +811,14 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature state(instance)%rhoEdge(j,of)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)*& plastic_disloUCLA_v0PerSlipSystem(j,instance) !* Resolved shear stress on slip system - tau_slip_pos = dot_product(Tstar_v,lattice_Sslip_v(1:6,1,index_myFamily+i,ph)) - tau_slip_neg = tau_slip_pos + tau_slip_pos(j) = dot_product(Tstar_v,lattice_Sslip_v(1:6,1,index_myFamily+i,ph)) + tau_slip_neg(j) = tau_slip_pos(j) nonSchmid_tensor(1:3,1:3,1) = lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) nonSchmid_tensor(1:3,1:3,2) = nonSchmid_tensor(1:3,1:3,1) nonSchmidSystems: do k = 1,lattice_NnonSchmid(ph) - tau_slip_pos = tau_slip_pos + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & + tau_slip_pos(j) = tau_slip_pos(j) + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k, index_myFamily+i,ph)) - tau_slip_neg = tau_slip_neg + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & + tau_slip_neg(j) = tau_slip_neg(j) + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k+1,index_myFamily+i,ph)) nonSchmid_tensor(1:3,1:3,1) = nonSchmid_tensor(1:3,1:3,1) + plastic_disloUCLA_nonSchmidCoeff(k,instance)*& lattice_Sslip(1:3,1:3,2*k, index_myFamily+i,ph) @@ -826,9 +826,9 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature lattice_Sslip(1:3,1:3,2*k+1,index_myFamily+i,ph) enddo nonSchmidSystems - significantPostitiveStress: if((abs(tau_slip_pos)-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then + significantPostitiveStress: if((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then !* Stress ratio - stressRatio = ((abs(tau_slip_pos)-state(instance)%threshold_stress_slip(j,of))/& + stressRatio = ((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j,of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) @@ -837,10 +837,10 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * (tau_slip_pos & + * (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos & + 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & @@ -848,7 +848,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature gdot_slip_pos(j) = DotGamma0 & * vel_slip & - * sign(1.0_pReal,tau_slip_pos) + * sign(1.0_pReal,tau_slip_pos(j)) !* Derivatives of shear rates dvel_slip = & @@ -857,19 +857,19 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - + tau_slip_pos & + + tau_slip_pos(j) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& *plastic_disloUCLA_qPerSlipFamily(f,instance)/& (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) ) &!deltaf(f) ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos & + * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & ) & - - (tau_slip_pos & + - (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & @@ -883,18 +883,18 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature ) & / ( & ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos & + 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & )**2.0_pReal & ) - dgdot_dtauslip_pos = DotGamma0 * dvel_slip + dgdot_dtauslip_pos(j) = DotGamma0 * dvel_slip endif significantPostitiveStress - significantNegativeStress: if((abs(tau_slip_neg)-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then + significantNegativeStress: if((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then !* Stress ratio - stressRatio = ((abs(tau_slip_neg)-state(instance)%threshold_stress_slip(j,of))/& + stressRatio = ((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j,of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) @@ -903,10 +903,10 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * (tau_slip_neg & + * (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg & + 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & @@ -914,7 +914,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature gdot_slip_neg(j) = DotGamma0 & * vel_slip & - * sign(1.0_pReal,tau_slip_neg) + * sign(1.0_pReal,tau_slip_neg(j)) !* Derivatives of shear rates dvel_slip = & @@ -923,19 +923,19 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - + tau_slip_neg & + + tau_slip_neg(j) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& *plastic_disloUCLA_qPerSlipFamily(f,instance)/& (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) ) &!deltaf(f) ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg & + * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & ) & - - (tau_slip_neg & + - (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & @@ -949,14 +949,14 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature ) & / ( & ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg & + 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & )**2.0_pReal & ) - dgdot_dtauslip_neg = DotGamma0 * dvel_slip + dgdot_dtauslip_neg(j) = DotGamma0 * dvel_slip endif significantNegativeStress !* Plastic velocity gradient for dislocation glide @@ -964,8 +964,8 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature !* Calculation of the tangent of Lp forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dTstar3333(k,l,m,n) = & - dLp_dTstar3333(k,l,m,n) + (dgdot_dtauslip_pos*nonSchmid_tensor(m,n,1)+& - dgdot_dtauslip_neg*nonSchmid_tensor(m,n,2))*0.5_pReal*& + dLp_dTstar3333(k,l,m,n) + (dgdot_dtauslip_pos(j)*nonSchmid_tensor(m,n,1)+& + dgdot_dtauslip_neg(j)*nonSchmid_tensor(m,n,2))*0.5_pReal*& lattice_Sslip(k,l,1,index_myFamily+i,ph) enddo slipSystems enddo slipFamilies From 01bc94557911203d764fca7d726b579fd115efb9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 27 Nov 2018 19:19:36 +0100 Subject: [PATCH 010/147] avoid code duplication --- src/plastic_disloUCLA.f90 | 147 +------------------------------------- 1 file changed, 3 insertions(+), 144 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index b335cce26..eed8aac91 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -794,11 +794,10 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature !-------------------------------------------------------------------------------------------------- ! Dislocation glide part - gdot_slip_pos = 0.0_pReal - gdot_slip_neg = 0.0_pReal - dgdot_dtauslip_pos = 0.0_pReal - dgdot_dtauslip_neg = 0.0_pReal + !* Dislocation density evolution + call kinetics(Tstar_v,Temperature,ipc,ip,el, & + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) j = 0_pInt slipFamilies: do f = 1_pInt,lattice_maxNslipFamily index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family @@ -810,155 +809,15 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature DotGamma0 = & state(instance)%rhoEdge(j,of)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)*& plastic_disloUCLA_v0PerSlipSystem(j,instance) - !* Resolved shear stress on slip system - tau_slip_pos(j) = dot_product(Tstar_v,lattice_Sslip_v(1:6,1,index_myFamily+i,ph)) - tau_slip_neg(j) = tau_slip_pos(j) nonSchmid_tensor(1:3,1:3,1) = lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) nonSchmid_tensor(1:3,1:3,2) = nonSchmid_tensor(1:3,1:3,1) nonSchmidSystems: do k = 1,lattice_NnonSchmid(ph) - tau_slip_pos(j) = tau_slip_pos(j) + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & - dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k, index_myFamily+i,ph)) - tau_slip_neg(j) = tau_slip_neg(j) + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & - dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k+1,index_myFamily+i,ph)) nonSchmid_tensor(1:3,1:3,1) = nonSchmid_tensor(1:3,1:3,1) + plastic_disloUCLA_nonSchmidCoeff(k,instance)*& lattice_Sslip(1:3,1:3,2*k, index_myFamily+i,ph) nonSchmid_tensor(1:3,1:3,2) = nonSchmid_tensor(1:3,1:3,2) + plastic_disloUCLA_nonSchmidCoeff(k,instance)*& lattice_Sslip(1:3,1:3,2*k+1,index_myFamily+i,ph) enddo nonSchmidSystems - significantPostitiveStress: if((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then - !* Stress ratio - stressRatio = ((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j,of))/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+& - plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) - stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) - stressRatio_pminus1 = stressRatio**(plastic_disloUCLA_pPerSlipFamily(f,instance)-1.0_pReal) - !* Shear rates due to slip - vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & - / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - ) - - gdot_slip_pos(j) = DotGamma0 & - * vel_slip & - * sign(1.0_pReal,tau_slip_pos(j)) - - !* Derivatives of shear rates - dvel_slip = & - 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - + tau_slip_pos(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) - *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& - *plastic_disloUCLA_qPerSlipFamily(f,instance)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& - StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) ) &!deltaf(f) - ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - ) & - - (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) - *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& - *plastic_disloUCLA_qPerSlipFamily(f,instance)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& - StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) )& !deltaf(f) - ) & - ) & - / ( & - ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - )**2.0_pReal & - ) - dgdot_dtauslip_pos(j) = DotGamma0 * dvel_slip - - endif significantPostitiveStress - significantNegativeStress: if((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j,of)) > tol_math_check) then - !* Stress ratio - stressRatio = ((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j,of))/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+& - plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) - stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) - stressRatio_pminus1 = stressRatio**(plastic_disloUCLA_pPerSlipFamily(f,instance)-1.0_pReal) - !* Shear rates due to slip - vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & - / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - ) - - gdot_slip_neg(j) = DotGamma0 & - * vel_slip & - * sign(1.0_pReal,tau_slip_neg(j)) - - !* Derivatives of shear rates - dvel_slip = & - 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & - * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - + tau_slip_neg(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) - *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& - *plastic_disloUCLA_qPerSlipFamily(f,instance)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& - StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) ) &!deltaf(f) - ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - ) & - - (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) - *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& - *plastic_disloUCLA_qPerSlipFamily(f,instance)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& - StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) )& !deltaf(f) - ) & - ) & - / ( & - ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & - )**2.0_pReal & - ) - - dgdot_dtauslip_neg(j) = DotGamma0 * dvel_slip - - endif significantNegativeStress !* Plastic velocity gradient for dislocation glide Lp = Lp + (gdot_slip_pos(j)+gdot_slip_neg(j))*0.5_pReal*lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) !* Calculation of the tangent of Lp From 6c23e9feb8174611b2d9913a908ebab2c116ed56 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 27 Nov 2018 19:28:00 +0100 Subject: [PATCH 011/147] be lazy, use a function --- src/plastic_disloUCLA.f90 | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index eed8aac91..eabaa3a9e 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -152,7 +152,8 @@ subroutine plastic_disloUCLA_init(fileUnit) PLASTICITY_DISLOUCLA_label, & PLASTICITY_DISLOUCLA_ID, & material_phase, & - plasticState + plasticState, & +material_allocatePlasticState use config, only: & MATERIAL_partPhase use lattice @@ -486,29 +487,11 @@ subroutine plastic_disloUCLA_init(fileUnit) + int(size(['invLambdaSlip ',& 'meanFreePathSlip ','tauSlipThreshold ']),pInt) * ns - plasticState(phase)%sizeState = sizeState - plasticState(phase)%sizeDotState = sizeDotState - plasticState(phase)%sizeDeltaState = sizeDeltaState - plasticState(phase)%sizePostResults = plastic_disloUCLA_sizePostResults(instance) - plasticState(phase)%nSlip = plastic_disloucla_totalNslip(instance) - plasticState(phase)%nTwin = 0_pInt - plasticState(phase)%nTrans= 0_pInt - allocate(plasticState(phase)%aTolState (sizeState), source=0.0_pReal) - allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%subState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%state (sizeState,NofMyPhase), source=0.0_pReal) + call material_allocatePlasticState(phase,NofMyPhase,sizeState,sizeDotState,0_pInt, & + ns,0_pInt,0_pInt) + +plasticState(phase)%sizePostResults = plastic_disloUCLA_sizePostResults(instance) - allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 1_pInt)) then - allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) - endif - if (any(numerics_integrator == 4_pInt)) & - allocate(plasticState(phase)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 5_pInt)) & - allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) offset_slip = 2_pInt*plasticState(phase)%nSlip plasticState(phase)%slipRate => & plasticState(phase)%dotState(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) From e305e99541a1f0c89821293ae3fec73532ec2d0c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 27 Nov 2018 19:49:04 +0100 Subject: [PATCH 012/147] cleaning --- src/plastic_disloUCLA.f90 | 59 ++++++++------------------------------- 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index eabaa3a9e..e094fcd87 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -157,8 +157,6 @@ material_allocatePlasticState use config, only: & MATERIAL_partPhase use lattice - use numerics,only: & - numerics_integrator implicit none integer(pInt), intent(in) :: fileUnit @@ -743,7 +741,6 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature phaseAt, phasememberAt use lattice, only: & lattice_Sslip, & - lattice_Sslip_v, & lattice_maxNslipFamily,& lattice_NslipSystem, & lattice_NnonSchmid @@ -756,9 +753,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature real(pReal), dimension(9,9), intent(out) :: dLp_dTstar99 integer(pInt) :: instance,ph,of,ns,f,i,j,k,l,m,n,index_myFamily - real(pReal) :: StressRatio_p,StressRatio_pminus1,BoltzmannRatio,DotGamma0, & - vel_slip,dvel_slip,& - stressRatio + real(pReal), dimension(3,3,2) :: & nonSchmid_tensor real(pReal), dimension(3,3,3,3) :: & @@ -786,12 +781,6 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family slipSystems: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) j = j+1_pInt - !* Boltzmann ratio - BoltzmannRatio = plastic_disloUCLA_QedgePerSlipSystem(j,instance)/(kB*Temperature) - !* Initial shear rates - DotGamma0 = & - state(instance)%rhoEdge(j,of)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)*& - plastic_disloUCLA_v0PerSlipSystem(j,instance) nonSchmid_tensor(1:3,1:3,1) = lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) nonSchmid_tensor(1:3,1:3,2) = nonSchmid_tensor(1:3,1:3,1) nonSchmidSystems: do k = 1,lattice_NnonSchmid(ph) @@ -832,10 +821,8 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) plasticState, & phaseAt, phasememberAt use lattice, only: & - lattice_Sslip_v, & lattice_maxNslipFamily, & lattice_NslipSystem, & - lattice_NnonSchmid, & lattice_mu implicit none @@ -848,14 +835,10 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) ip, & !< integration point el !< element - integer(pInt) :: instance,ns,f,i,j,k,index_myFamily, & + integer(pInt) :: instance,ns,f,i,j,index_myFamily, & ph, & of real(pReal) :: & - stressRatio_p,& - BoltzmannRatio,& - DotGamma0,& - stressRatio, & EdgeDipMinDistance,& AtomicVolume,& VacancyDiffusion,& @@ -865,9 +848,7 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) DotRhoEdgeEdgeAnnihilation, & ClimbVelocity, & DotRhoEdgeDipClimb, & - DotRhoDipFormation, & - vel_slip, & - gdot_slip + DotRhoDipFormation real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & gdot_slip_pos, gdot_slip_neg,& tau_slip_pos,& @@ -890,16 +871,10 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family slipSystems: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) j = j+1_pInt - !* Boltzmann ratio - BoltzmannRatio = plastic_disloUCLA_QedgePerSlipSystem(j,instance)/(kB*Temperature) - !* Initial shear rates - DotGamma0 = & - state(instance)%rhoEdge(j,of)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)*& - plastic_disloUCLA_v0PerSlipSystem(j,instance) - gdot_slip = (gdot_slip_pos(j)+gdot_slip_neg(j))*0.5_pReal + dotState(instance)%accshear_slip(j,of) = (gdot_slip_pos(j)+gdot_slip_neg(j))*0.5_pReal !* Multiplication - DotRhoMultiplication = abs(gdot_slip)/& + DotRhoMultiplication = abs(dotState(instance)%accshear_slip(j,of))/& (plastic_disloUCLA_burgersPerSlipSystem(j,instance)* & state(instance)%mfp_slip(j,of)) @@ -916,18 +891,18 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) if (EdgeDipDistance Date: Tue, 27 Nov 2018 20:00:45 +0100 Subject: [PATCH 013/147] introducing parameter structure --- src/plastic_disloUCLA.f90 | 72 +++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index e094fcd87..59480ef1f 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -84,6 +84,26 @@ module plastic_disloUCLA edge_dipole_distance_ID, & stress_exponent_ID end enum + + type, private :: tParameters + real(pReal), allocatable, dimension(:) :: & + nonSchmidCoeff + real(pReal), allocatable, dimension(:,:) :: & + interaction_SlipSlip !< slip resistance from slip activity + real(pReal), allocatable, dimension(:,:,:) :: & + Schmid_slip, & + Schmid_twin, & + nonSchmid_pos, & + nonSchmid_neg + integer(pInt) :: & + totalNslip !< total number of active slip system + integer(pInt), allocatable, dimension(:) :: & + Nslip !< number of active slip systems for each family + integer(kind(undefined_ID)), allocatable, dimension(:) :: & + outputID !< ID of each post result output + end type !< container type for internal constitutive parameters + + type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance) integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & plastic_disloUCLA_outputID !< ID of each post result output @@ -155,7 +175,8 @@ subroutine plastic_disloUCLA_init(fileUnit) plasticState, & material_allocatePlasticState use config, only: & - MATERIAL_partPhase + MATERIAL_partPhase, & + config_phase use lattice implicit none @@ -167,13 +188,18 @@ material_allocatePlasticState Nchunks_SlipSlip = 0_pInt, & Nchunks_SlipFamilies = 0_pInt,Nchunks_nonSchmid = 0_pInt, & offset_slip, index_myFamily, index_otherFamily, & - startIndex, endIndex + startIndex, endIndex, p integer(pInt) :: sizeState, sizeDotState, sizeDeltaState integer(pInt) :: NofMyPhase character(len=65536) :: & + structure = '',& tag = '', & line = '' real(pReal), dimension(:), allocatable :: tempPerSlip + + integer(pInt), dimension(0), parameter :: emptyIntArray = [integer(pInt)::] + real(pReal), dimension(0), parameter :: emptyRealArray = [real(pReal)::] + character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::] write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOUCLA_label//' init -+>>>' write(6,'(/,a)') ' Cereceda et al., International Journal of Plasticity 78, 2016, 242-256' @@ -225,6 +251,43 @@ material_allocatePlasticState allocate(plastic_disloUCLA_nonSchmidCoeff(lattice_maxNnonSchmid,maxNinstance), source=0.0_pReal) + allocate(param(maxNinstance)) + allocate(state(maxNinstance)) + allocate(state0(maxNinstance)) + allocate(dotState(maxNinstance)) + + +do p = 1_pInt, size(phase_plasticityInstance) + if (phase_plasticity(p) /= PLASTICITY_DISLOUCLA_ID) cycle + associate(prm => param(phase_plasticityInstance(p)), & + dot => dotState(phase_plasticityInstance(p)), & + stt => state(phase_plasticityInstance(p))) + + structure = config_phase(p)%getString('lattice_structure') + + +!-------------------------------------------------------------------------------------------------- +! slip related parameters + prm%Nslip = config_phase(p)%getInts('nslip',defaultVal=emptyIntArray) + prm%totalNslip = sum(prm%Nslip) + slipActive: if (prm%totalNslip > 0_pInt) then + prm%Schmid_slip = lattice_SchmidMatrix_slip(prm%Nslip,structure(1:3),& + config_phase(p)%getFloat('c/a',defaultVal=0.0_pReal)) + if(structure=='bcc') then + prm%nonSchmidCoeff = config_phase(p)%getFloats('nonschmid_coefficients',& + defaultVal = emptyRealArray) + prm%nonSchmid_pos = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,+1_pInt) + prm%nonSchmid_neg = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,-1_pInt) + else + prm%nonSchmid_pos = prm%Schmid_slip + prm%nonSchmid_neg = prm%Schmid_slip + endif + prm%interaction_SlipSlip = lattice_interaction_SlipSlip(prm%Nslip, & + config_phase(p)%getFloats('interaction_slipslip'), & + structure(1:3)) + endif slipActive + end associate + enddo rewind(fileUnit) phase = 0_pInt @@ -442,10 +505,7 @@ material_allocatePlasticState maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_forestProjectionEdge(maxTotalNslip,maxTotalNslip,maxNinstance), & source=0.0_pReal) - - allocate(state(maxNinstance)) - allocate(state0(maxNinstance)) - allocate(dotState(maxNinstance)) + initializeInstances: do phase = 1_pInt, size(phase_plasticity) myPhase2: if (phase_plasticity(phase) == PLASTICITY_disloUCLA_ID) then From 6e22a76a9114800ffafb2d7d855feb5c78830ece Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 28 Nov 2018 05:59:03 +0100 Subject: [PATCH 014/147] parameters from old 22-NewStyle branch --- src/plastic_disloUCLA.f90 | 96 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 6 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 59480ef1f..1218b7b45 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -82,11 +82,36 @@ module plastic_disloUCLA resolved_stress_slip_ID, & threshold_stress_slip_ID, & edge_dipole_distance_ID, & - stress_exponent_ID + stress_exponent_ID, & + rho_ID, & + rhoDip_ID, & + shearrate_ID, & + accumulatedshear_ID, & + mfp_ID, & + resolvedstress_ID, & + thresholdstress_ID, & + dipoledistance_ID, & + stressexponent_ID end enum type, private :: tParameters real(pReal), allocatable, dimension(:) :: & + rho0, & !< initial edge dislocation density per slip system for each family and instance + rhoDip0, & !< initial edge dipole density per slip system for each family and instance + burgers, & !< absolute length of burgers vector [m] for each slip system and instance + H0kp, & !< activation energy for glide [J] for each slip system and instance + v0, & !< dislocation velocity prefactor [m/s] for each family and instance + CLambda, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance + p, & !< p-exponent in glide velocity + q, & !< q-exponent in glide velocity + !* mobility law parameters + kinkheight, & !< height of the kink pair + nu0, & !< attempt frequency for kink pair nucleation + kinkwidth, & !< width of the kink pair + !dislolength, & !< dislocation length (lamda) + viscosity, & !< friction coeff. B (kMC) + !* + tauPeierls, & nonSchmidCoeff real(pReal), allocatable, dimension(:,:) :: & interaction_SlipSlip !< slip resistance from slip activity @@ -184,8 +209,8 @@ material_allocatePlasticState integer(pInt), allocatable, dimension(:) :: chunkPos integer(pInt) :: maxNinstance,mySize=0_pInt,phase,maxTotalNslip,& - f,instance,j,k,o,ns, & - Nchunks_SlipSlip = 0_pInt, & + f,instance,j,k,o,ns, i, & + Nchunks_SlipSlip = 0_pInt, output_ID, outputSize, & Nchunks_SlipFamilies = 0_pInt,Nchunks_nonSchmid = 0_pInt, & offset_slip, index_myFamily, index_otherFamily, & startIndex, endIndex, p @@ -196,7 +221,8 @@ material_allocatePlasticState tag = '', & line = '' real(pReal), dimension(:), allocatable :: tempPerSlip - + character(len=65536), dimension(:), allocatable :: outputs + integer(kind(undefined_ID)) :: outputID integer(pInt), dimension(0), parameter :: emptyIntArray = [integer(pInt)::] real(pReal), dimension(0), parameter :: emptyRealArray = [real(pReal)::] character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::] @@ -285,7 +311,65 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%interaction_SlipSlip = lattice_interaction_SlipSlip(prm%Nslip, & config_phase(p)%getFloats('interaction_slipslip'), & structure(1:3)) + !prm%rho0 = config_phase(p)%getFloats('rho0') + !prm%rhoDip0 = config_phase(p)%getFloats('dipole_rho0') + !prm%burgers = config_phase(p)%getFloats('burgers') + !prm%H0kp = config_phase(p)%getFloats('h0') + !prm%v0 = config_phase(p)%getFloats('v0') + !prm%clambda = config_phase(p)%getFloats('clambda') + !prm%tauPeierls = config_phase(p)%getFloats('peierls_stress') + !prm%p = config_phase(p)%getFloats('pexponent',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) + !prm%q = config_phase(p)%getFloats('qexponent',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) + !prm%kinkHeight = config_phase(p)%getFloats('kink_height') + !prm%kinkWidth = config_phase(p)%getFloats('kink_width') + !prm%nu0 = config_phase(p)%getFloats('attemptfrequency') + !prm%dislolength = config_phase(p)%getFloats('dislolength') ! what is this used for? + !prm%viscosity = config_phase(p)%getFloats('viscosity') endif slipActive + + +!-------------------------------------------------------------------------------------------------- +! phase outputs + +#if defined(__GFORTRAN__) + outputs = ['GfortranBug86277'] + outputs = config_phase(p)%getStrings('(output)',defaultVal=outputs) + if (outputs(1) == 'GfortranBug86277') outputs = emptyStringArray +#else + outputs = config_phase(p)%getStrings('(output)',defaultVal=emptyStringArray) +#endif + allocate(prm%outputID(0)) + + do i = 1_pInt, size(outputs) + outputID = undefined_ID + outputSize = prm%totalNslip + select case(trim(outputs(i))) + case ('edge_density') + outputID = rho_ID + case ('dipole_density') + output_ID = rhoDip_ID + case ('shear_rate','shearrate') + output_ID = shearrate_ID + case ('accumulated_shear','accumulatedshear') + output_ID = accumulatedshear_ID + case ('mfp') + output_ID = mfp_ID + case ('resolved_stress') + output_ID = resolvedstress_ID + case ('threshold_stress') + output_ID = thresholdstress_ID + case ('edge_dipole_distance') + output_ID = dipoleDistance_ID + case ('stress_exponent') + output_ID = stressexponent_ID + end select + + !if (outputID /= undefined_ID) then + ! plastic_disloUCLA_output(i,instance) = outputs(i) + ! plastic_disloUCLA_sizePostResult(i,instance) = outputSize + ! prm%outputID = [prm%outputID, outputID] + !endif + enddo end associate enddo @@ -515,7 +599,7 @@ do p = 1_pInt, size(phase_plasticityInstance) !-------------------------------------------------------------------------------------------------- ! Determine size of postResults array - outputs: do o = 1_pInt,plastic_disloUCLA_Noutput(instance) + do o = 1_pInt,plastic_disloUCLA_Noutput(instance) select case(plastic_disloUCLA_outputID(o,instance)) case(edge_density_ID, & dipole_density_ID, & @@ -534,7 +618,7 @@ do p = 1_pInt, size(phase_plasticityInstance) plastic_disloUCLA_sizePostResult(o,instance) = mySize plastic_disloUCLA_sizePostResults(instance) = plastic_disloUCLA_sizePostResults(instance) + mySize endif - enddo outputs + enddo !-------------------------------------------------------------------------------------------------- ! allocate state arrays From b923839b1de9fd6b27d07bed5c1bf75e86afd5f8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 28 Nov 2018 06:44:32 +0100 Subject: [PATCH 015/147] no need for conversion 33<->6 --- src/constitutive.f90 | 7 ++--- src/plastic_disloUCLA.f90 | 61 +++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index eca8af08a..bb52ab3cc 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -530,9 +530,8 @@ subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, S6, Fi, ipc, ip, e call plastic_dislotwin_LpAndItsTangent (Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of) case (PLASTICITY_DISLOUCLA_ID) plasticityType - call plastic_disloucla_LpAndItsTangent (Lp,dLp_dMp99, math_Mandel33to6(Mp), & + call plastic_disloucla_LpAndItsTangent (Lp,dLp_dMp,Mp, & temperature(ho)%p(tme), ipc,ip,el) - dLp_dMp = math_Plain99to3333(dLp_dMp99) ! ToDo: We revert here the last statement in plastic_xx_LpAndItsTanget end select plasticityType @@ -927,7 +926,7 @@ subroutine constitutive_collectDotState(S6, FeArray, Fi, FpArray, subdt, subfrac call plastic_dislotwin_dotState (Mp,temperature(ho)%p(tme),instance,of) case (PLASTICITY_DISLOUCLA_ID) plasticityType - call plastic_disloucla_dotState (math_Mandel33to6(Mp),temperature(ho)%p(tme), & + call plastic_disloucla_dotState (Mp,temperature(ho)%p(tme), & ipc,ip,el) case (PLASTICITY_NONLOCAL_ID) plasticityType @@ -1155,7 +1154,7 @@ function constitutive_postResults(S6, Fi, FeArray, ipc, ip, el) case (PLASTICITY_DISLOUCLA_ID) plasticityType constitutive_postResults(startPos:endPos) = & - plastic_disloucla_postResults(S6,temperature(ho)%p(tme),ipc,ip,el) + plastic_disloucla_postResults(Mp,temperature(ho)%p(tme),ipc,ip,el) case (PLASTICITY_NONLOCAL_ID) plasticityType constitutive_postResults(startPos:endPos) = & diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 1218b7b45..a4b4b554f 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -870,7 +870,7 @@ end subroutine plastic_disloUCLA_microstructure !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature,ipc,ip,el) +subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el) use prec, only: & tol_math_check use math, only: & @@ -892,16 +892,14 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature implicit none integer(pInt), intent(in) :: ipc,ip,el real(pReal), intent(in) :: Temperature - real(pReal), dimension(6), intent(in) :: Tstar_v + real(pReal), dimension(3,3), intent(in) :: Mp real(pReal), dimension(3,3), intent(out) :: Lp - real(pReal), dimension(9,9), intent(out) :: dLp_dTstar99 + real(pReal), dimension(3,3,3,3), intent(out) :: dLp_dMp integer(pInt) :: instance,ph,of,ns,f,i,j,k,l,m,n,index_myFamily real(pReal), dimension(3,3,2) :: & nonSchmid_tensor - real(pReal), dimension(3,3,3,3) :: & - dLp_dTstar3333 real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg @@ -912,13 +910,13 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature ns = plastic_disloUCLA_totalNslip(instance) Lp = 0.0_pReal - dLp_dTstar3333 = 0.0_pReal + dLp_dMp = 0.0_pReal !-------------------------------------------------------------------------------------------------- ! Dislocation glide part !* Dislocation density evolution - call kinetics(Tstar_v,Temperature,ipc,ip,el, & + call kinetics(Mp,Temperature,ipc,ip,el, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) j = 0_pInt slipFamilies: do f = 1_pInt,lattice_maxNslipFamily @@ -938,14 +936,13 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature Lp = Lp + (gdot_slip_pos(j)+gdot_slip_neg(j))*0.5_pReal*lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) !* Calculation of the tangent of Lp forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & - dLp_dTstar3333(k,l,m,n) = & - dLp_dTstar3333(k,l,m,n) + (dgdot_dtauslip_pos(j)*nonSchmid_tensor(m,n,1)+& + dLp_dMp(k,l,m,n) = & + dLp_dMp(k,l,m,n) + (dgdot_dtauslip_pos(j)*nonSchmid_tensor(m,n,1)+& dgdot_dtauslip_neg(j)*nonSchmid_tensor(m,n,2))*0.5_pReal*& lattice_Sslip(k,l,1,index_myFamily+i,ph) enddo slipSystems enddo slipFamilies - dLp_dTstar99 = math_Plain3333to99(dLp_dTstar3333) end subroutine plastic_disloUCLA_LpAndItsTangent @@ -953,7 +950,7 @@ end subroutine plastic_disloUCLA_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief calculates the rate of change of microstructure !-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) +subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) use prec, only: & tol_math_check, & dEq0 @@ -970,8 +967,8 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) lattice_mu implicit none - real(pReal), dimension(6), intent(in):: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation + real(pReal), dimension(3,3), intent(in):: & + Mp !< 2nd Piola Kirchhoff stress tensor in Mandel notation real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & @@ -1008,7 +1005,7 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) plasticState(ph)%dotState(:,of) = 0.0_pReal !* Dislocation density evolution - call kinetics(Tstar_v,Temperature,ipc,ip,el, & + call kinetics(Mp,Temperature,ipc,ip,el, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) j = 0_pInt slipFamilies: do f = 1_pInt,lattice_maxNslipFamily @@ -1082,26 +1079,27 @@ end subroutine plastic_disloUCLA_dotState !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -function plastic_disloUCLA_postResults(Tstar_v,Temperature,ipc,ip,el) +function plastic_disloUCLA_postResults(Mp,Temperature,ipc,ip,el) use prec, only: & tol_math_check, & dEq, dNeq0 use math, only: & - pi + pi, & +math_mul33xx33 use material, only: & material_phase, & phase_plasticityInstance,& !plasticState, & phaseAt, phasememberAt use lattice, only: & - lattice_Sslip_v, & + lattice_Sslip, & lattice_maxNslipFamily, & lattice_NslipSystem, & lattice_mu implicit none - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation + real(pReal), dimension(3,3), intent(in) :: & + Mp !< 2nd Piola Kirchhoff stress tensor in Mandel notation real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & @@ -1141,7 +1139,7 @@ function plastic_disloUCLA_postResults(Tstar_v,Temperature,ipc,ip,el) plastic_disloUCLA_postResults(c+1_pInt:c+ns) = state(instance)%rhoEdgeDip(1_pInt:ns,of) c = c + ns case (shear_rate_slip_ID,stress_exponent_ID) - call kinetics(Tstar_v,Temperature,ipc,ip,el, & + call kinetics(Mp,Temperature,ipc,ip,el, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) if (plastic_disloUCLA_outputID(o,instance) == shear_rate_slip_ID) then @@ -1175,7 +1173,7 @@ function plastic_disloUCLA_postResults(Tstar_v,Temperature,ipc,ip,el) slipSystems1: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) j = j + 1_pInt plastic_disloUCLA_postResults(c+j) =& - dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph)) + math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)) enddo slipSystems1; enddo slipFamilies1 c = c + ns case (threshold_stress_slip_ID) @@ -1188,10 +1186,10 @@ function plastic_disloUCLA_postResults(Tstar_v,Temperature,ipc,ip,el) index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family slipSystems2: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) j = j + 1_pInt - if (dNeq0(abs(dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph))))) then + if (dNeq0(abs(math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph))))) then plastic_disloUCLA_postResults(c+j) = & (3.0_pReal*lattice_mu(ph)*plastic_disloUCLA_burgersPerSlipSystem(j,instance))/& - (16.0_pReal*pi*abs(dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph)))) + (16.0_pReal*pi*abs(math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)))) else plastic_disloUCLA_postResults(c+j) = huge(1.0_pReal) endif @@ -1207,27 +1205,28 @@ end function plastic_disloUCLA_postResults !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -subroutine kinetics(Tstar_v,Temperature,ipc,ip,el, & +subroutine kinetics(Mp,Temperature,ipc,ip,el, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) use prec, only: & tol_math_check, & dEq, dNeq0 use math, only: & - pi + pi, & +math_mul33xx33 use material, only: & material_phase, & phase_plasticityInstance,& !plasticState, & phaseAt, phasememberAt use lattice, only: & - lattice_Sslip_v, & + lattice_Sslip, & lattice_maxNslipFamily, & lattice_NslipSystem, & lattice_NnonSchmid implicit none - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation + real(pReal), dimension(3,3), intent(in) :: & + Mp !< 2nd Piola Kirchhoff stress tensor in Mandel notation real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & @@ -1270,14 +1269,14 @@ subroutine kinetics(Tstar_v,Temperature,ipc,ip,el, & state(instance)%rhoEdge(j,of)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)*& plastic_disloUCLA_v0PerSlipSystem(j,instance) !* Resolved shear stress on slip system - tau_slip_pos(j) = dot_product(Tstar_v,lattice_Sslip_v(:,1,index_myFamily+i,ph)) + tau_slip_pos(j) = math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)) tau_slip_neg(j) = tau_slip_pos(j) nonSchmidSystems: do k = 1,lattice_NnonSchmid(ph) tau_slip_pos = tau_slip_pos + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & - dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k,index_myFamily+i,ph)) + math_mul33xx33(Mp,lattice_Sslip(1:3,1:3,2*k,index_myFamily+i,ph)) tau_slip_neg = tau_slip_neg + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & - dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k+1,index_myFamily+i,ph)) + math_mul33xx33(Mp,lattice_Sslip(1:3,1:3,2*k+1,index_myFamily+i,ph)) enddo nonSchmidSystems significantPositiveTau: if((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j, of)) > tol_math_check) then From 6af633aa28809e43088d82fa2082923bd60a8f74 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 28 Nov 2018 07:18:50 +0100 Subject: [PATCH 016/147] going towards the new API (ipc,ip,el not of interest) --- src/plastic_disloUCLA.f90 | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index a4b4b554f..08edae241 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -916,7 +916,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el ! Dislocation glide part !* Dislocation density evolution - call kinetics(Mp,Temperature,ipc,ip,el, & + call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) j = 0_pInt slipFamilies: do f = 1_pInt,lattice_maxNslipFamily @@ -1005,7 +1005,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) plasticState(ph)%dotState(:,of) = 0.0_pReal !* Dislocation density evolution - call kinetics(Mp,Temperature,ipc,ip,el, & + call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) j = 0_pInt slipFamilies: do f = 1_pInt,lattice_maxNslipFamily @@ -1139,7 +1139,7 @@ math_mul33xx33 plastic_disloUCLA_postResults(c+1_pInt:c+ns) = state(instance)%rhoEdgeDip(1_pInt:ns,of) c = c + ns case (shear_rate_slip_ID,stress_exponent_ID) - call kinetics(Mp,Temperature,ipc,ip,el, & + call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) if (plastic_disloUCLA_outputID(o,instance) == shear_rate_slip_ID) then @@ -1205,7 +1205,7 @@ end function plastic_disloUCLA_postResults !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -subroutine kinetics(Mp,Temperature,ipc,ip,el, & +subroutine kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) use prec, only: & tol_math_check, & @@ -1230,26 +1230,18 @@ math_mul33xx33 real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element +ph, instance,of integer(pInt) :: & - instance,& ns,& - f,i,j,k,index_myFamily,& - ph, & - of + f,i,j,k,index_myFamily real(pReal) :: StressRatio_p,StressRatio_pminus1,& BoltzmannRatio,DotGamma0,stressRatio,& dvel_slip, vel_slip - real(pReal), intent(out), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + real(pReal), intent(out), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg !* Shortened notation - of = phasememberAt(ipc,ip,el) - ph = phaseAt(ipc,ip,el) - instance = phase_plasticityInstance(ph) ns = plastic_disloUCLA_totalNslip(instance) From 5983496c35668334cb5b0001495147035f1c0938 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 28 Nov 2018 16:45:45 +0100 Subject: [PATCH 017/147] get output from config module --- src/plastic_disloUCLA.f90 | 151 ++++++++++---------------------------- 1 file changed, 39 insertions(+), 112 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 08edae241..74373136c 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -74,15 +74,6 @@ module plastic_disloUCLA enum, bind(c) enumerator :: undefined_ID, & - edge_density_ID, & - dipole_density_ID, & - shear_rate_slip_ID, & - accumulated_shear_slip_ID, & - mfp_slip_ID, & - resolved_stress_slip_ID, & - threshold_stress_slip_ID, & - edge_dipole_distance_ID, & - stress_exponent_ID, & rho_ID, & rhoDip_ID, & shearrate_ID, & @@ -210,7 +201,7 @@ material_allocatePlasticState integer(pInt), allocatable, dimension(:) :: chunkPos integer(pInt) :: maxNinstance,mySize=0_pInt,phase,maxTotalNslip,& f,instance,j,k,o,ns, i, & - Nchunks_SlipSlip = 0_pInt, output_ID, outputSize, & + Nchunks_SlipSlip = 0_pInt, outputSize, & Nchunks_SlipFamilies = 0_pInt,Nchunks_nonSchmid = 0_pInt, & offset_slip, index_myFamily, index_otherFamily, & startIndex, endIndex, p @@ -345,34 +336,40 @@ do p = 1_pInt, size(phase_plasticityInstance) outputSize = prm%totalNslip select case(trim(outputs(i))) case ('edge_density') - outputID = rho_ID + outputID = merge(rho_ID,undefined_ID,prm%totalNslip>0_pInt) case ('dipole_density') - output_ID = rhoDip_ID - case ('shear_rate','shearrate') - output_ID = shearrate_ID - case ('accumulated_shear','accumulatedshear') - output_ID = accumulatedshear_ID - case ('mfp') - output_ID = mfp_ID - case ('resolved_stress') - output_ID = resolvedstress_ID - case ('threshold_stress') - output_ID = thresholdstress_ID + outputID = merge(rhoDip_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('shear_rate','shearrate','shear_rate_slip','shearrate_slip') + outputID = merge(shearrate_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('accumulated_shear','accumulatedshear','accumulated_shear_slip') + outputID = merge(accumulatedshear_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('mfp','mfp_slip') + outputID = merge(mfp_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('resolved_stress','resolved_stress_slip') + outputID = merge(resolvedstress_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('threshold_stress','threshold_stress_slip') + outputID = merge(thresholdstress_ID,undefined_ID,prm%totalNslip>0_pInt) case ('edge_dipole_distance') - output_ID = dipoleDistance_ID + outputID = merge(dipoleDistance_ID,undefined_ID,prm%totalNslip>0_pInt) case ('stress_exponent') - output_ID = stressexponent_ID + outputID = merge(stressexponent_ID,undefined_ID,prm%totalNslip>0_pInt) end select - - !if (outputID /= undefined_ID) then - ! plastic_disloUCLA_output(i,instance) = outputs(i) - ! plastic_disloUCLA_sizePostResult(i,instance) = outputSize - ! prm%outputID = [prm%outputID, outputID] - !endif + + if (outputID /= undefined_ID) then + plastic_disloUCLA_output(i,phase_plasticityInstance(p)) = outputs(i) + plastic_disloUCLA_sizePostResult(i,phase_plasticityInstance(p)) = outputSize + prm%outputID = [prm%outputID, outputID] + plastic_disloUCLA_outputID(i,phase_plasticityInstance(p)) = outputID + plastic_disloUCLA_sizePostResults(phase_plasticityInstance(p)) = & + plastic_disloUCLA_sizePostResults(phase_plasticityInstance(p)) + outputSize +plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) + 1_pInt + endif + enddo end associate enddo - + print*, plastic_disloUCLA_sizePostResults + print*, plastic_disloUCLA_output rewind(fileUnit) phase = 0_pInt do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to @@ -402,54 +399,6 @@ do p = 1_pInt, size(phase_plasticityInstance) chunkPos = IO_stringPos(line) tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key select case(tag) - case ('(output)') - select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt))) - case ('edge_density') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = edge_density_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - case ('dipole_density') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = dipole_density_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - case ('shear_rate_slip','shearrate_slip') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = shear_rate_slip_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - case ('accumulated_shear_slip') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = accumulated_shear_slip_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - case ('mfp_slip') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = mfp_slip_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - case ('resolved_stress_slip') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = resolved_stress_slip_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - case ('threshold_stress_slip') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = threshold_stress_slip_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - case ('edge_dipole_distance') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = edge_dipole_distance_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - case ('stress_exponent') - plastic_disloUCLA_Noutput(instance) = plastic_disloUCLA_Noutput(instance) + 1_pInt - plastic_disloUCLA_outputID(plastic_disloUCLA_Noutput(instance),instance) = stress_exponent_ID - plastic_disloUCLA_output(plastic_disloUCLA_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - end select !-------------------------------------------------------------------------------------------------- ! parameters depending on number of slip system families case ('nslip') @@ -597,28 +546,6 @@ do p = 1_pInt, size(phase_plasticityInstance) instance = phase_plasticityInstance(phase) ns = plastic_disloUCLA_totalNslip(instance) -!-------------------------------------------------------------------------------------------------- -! Determine size of postResults array - do o = 1_pInt,plastic_disloUCLA_Noutput(instance) - select case(plastic_disloUCLA_outputID(o,instance)) - case(edge_density_ID, & - dipole_density_ID, & - shear_rate_slip_ID, & - accumulated_shear_slip_ID, & - mfp_slip_ID, & - resolved_stress_slip_ID, & - threshold_stress_slip_ID, & - edge_dipole_distance_ID, & - stress_exponent_ID & - ) - mySize = ns - end select - - if (mySize > 0_pInt) then ! any meaningful output found - plastic_disloUCLA_sizePostResult(o,instance) = mySize - plastic_disloUCLA_sizePostResults(instance) = plastic_disloUCLA_sizePostResults(instance) + mySize - endif - enddo !-------------------------------------------------------------------------------------------------- ! allocate state arrays @@ -632,7 +559,7 @@ do p = 1_pInt, size(phase_plasticityInstance) call material_allocatePlasticState(phase,NofMyPhase,sizeState,sizeDotState,0_pInt, & ns,0_pInt,0_pInt) -plasticState(phase)%sizePostResults = plastic_disloUCLA_sizePostResults(instance) + plasticState(phase)%sizePostResults = plastic_disloUCLA_sizePostResults(instance) offset_slip = 2_pInt*plasticState(phase)%nSlip plasticState(phase)%slipRate => & @@ -1132,20 +1059,20 @@ math_mul33xx33 do o = 1_pInt,plastic_disloUCLA_Noutput(instance) select case(plastic_disloUCLA_outputID(o,instance)) - case (edge_density_ID) + case (rho_ID) plastic_disloUCLA_postResults(c+1_pInt:c+ns) = state(instance)%rhoEdge(1_pInt:ns,of) c = c + ns - case (dipole_density_ID) + case (rhoDip_ID) plastic_disloUCLA_postResults(c+1_pInt:c+ns) = state(instance)%rhoEdgeDip(1_pInt:ns,of) c = c + ns - case (shear_rate_slip_ID,stress_exponent_ID) + case (shearrate_ID,stressexponent_ID) call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) - if (plastic_disloUCLA_outputID(o,instance) == shear_rate_slip_ID) then + if (plastic_disloUCLA_outputID(o,instance) == shearrate_ID) then plastic_disloUCLA_postResults(c+1:c+ns) = (gdot_slip_pos + gdot_slip_neg)*0.5_pReal c = c + ns - elseif(plastic_disloUCLA_outputID(o,instance) == stress_exponent_ID) then + elseif(plastic_disloUCLA_outputID(o,instance) == stressexponent_ID) then do j = 1_pInt, ns if (dEq(gdot_slip_pos(j)+gdot_slip_neg(j),0.0_pReal)) then plastic_disloUCLA_postResults(c+j) = 0.0_pReal @@ -1158,15 +1085,15 @@ math_mul33xx33 c = c + ns endif - case (accumulated_shear_slip_ID) + case (accumulatedshear_ID) plastic_disloUCLA_postResults(c+1_pInt:c+ns) = & state(instance)%accshear_slip(1_pInt:ns, of) c = c + ns - case (mfp_slip_ID) + case (mfp_ID) plastic_disloUCLA_postResults(c+1_pInt:c+ns) =& state(instance)%mfp_slip(1_pInt:ns, of) c = c + ns - case (resolved_stress_slip_ID) + case (resolvedstress_ID) j = 0_pInt slipFamilies1: do f = 1_pInt,lattice_maxNslipFamily index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family @@ -1176,11 +1103,11 @@ math_mul33xx33 math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)) enddo slipSystems1; enddo slipFamilies1 c = c + ns - case (threshold_stress_slip_ID) + case (thresholdstress_ID) plastic_disloUCLA_postResults(c+1_pInt:c+ns) = & state(instance)%threshold_stress_slip(1_pInt:ns,of) c = c + ns - case (edge_dipole_distance_ID) + case (dipoleDistance_ID) j = 0_pInt slipFamilies2: do f = 1_pInt,lattice_maxNslipFamily index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family From b917ae2cca64d7bbcb3c135905ec80c30551977a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 28 Nov 2018 17:12:06 +0100 Subject: [PATCH 018/147] function to initialize absolute tolerance for state not needed --- src/plastic_disloUCLA.f90 | 53 +++++++++------------------------------ 1 file changed, 12 insertions(+), 41 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 74373136c..f2e32ffcb 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -63,8 +63,7 @@ module plastic_disloUCLA !* mobility law parameters plastic_disloUCLA_kinkheight, & !< height of the kink pair plastic_disloUCLA_omega, & !< attempt frequency for kink pair nucleation - plastic_disloUCLA_kinkwidth, & !< width of the kink pair - plastic_disloUCLA_dislolength, & !< dislocation length (lamda) + plastic_disloUCLA_kinkwidth, & !< width of the kink pair plastic_disloUCLA_friction, & !< friction coeff. B (kMC) !* plastic_disloUCLA_nonSchmidCoeff !< non-Schmid coefficients (bcc) @@ -144,8 +143,8 @@ module plastic_disloUCLA plastic_disloUCLA_dotState, & plastic_disloUCLA_postResults private :: & - plastic_disloUCLA_stateInit, & - plastic_disloUCLA_aTolState + plastic_disloUCLA_stateInit + contains @@ -252,7 +251,6 @@ material_allocatePlasticState allocate(plastic_disloUCLA_kinkheight(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_omega(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_kinkwidth(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_dislolength(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_friction(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_QedgePerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_v0PerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) @@ -368,8 +366,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp enddo end associate enddo - print*, plastic_disloUCLA_sizePostResults - print*, plastic_disloUCLA_output + rewind(fileUnit) phase = 0_pInt do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to @@ -445,9 +442,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp case ('kink_width') plastic_disloUCLA_kinkwidth(1:Nchunks_SlipFamilies,instance) = & tempPerSlip(1:Nchunks_SlipFamilies) - case ('dislolength') - plastic_disloUCLA_dislolength(1:Nchunks_SlipFamilies,instance) = & - tempPerSlip(1:Nchunks_SlipFamilies) case ('friction_coeff') plastic_disloUCLA_friction(1:Nchunks_SlipFamilies,instance) = & tempPerSlip(1:Nchunks_SlipFamilies) @@ -542,6 +536,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp initializeInstances: do phase = 1_pInt, size(phase_plasticity) myPhase2: if (phase_plasticity(phase) == PLASTICITY_disloUCLA_ID) then + p = phase NofMyPhase=count(material_phase==phase) instance = phase_plasticityInstance(phase) ns = plastic_disloUCLA_totalNslip(instance) @@ -610,38 +605,36 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp startIndex=1_pInt endIndex=ns state(instance)%rhoEdge=>plasticState(phase)%state(startIndex:endIndex,:) - state0(instance)%rhoEdge=>plasticState(phase)%state0(startIndex:endIndex,:) - dotState(instance)%rhoEdge=>plasticState(phase)%dotState(startIndex:endIndex,:) + dotState(instance)%rhoEdge=>plasticState(phase)%dotState(startIndex:endIndex,:) + plasticState(p)%aTolState(startIndex:endIndex) = plastic_disloUCLA_aTolRho(instance) startIndex=endIndex+1_pInt endIndex=endIndex+ns state(instance)%rhoEdgeDip=>plasticState(phase)%state(startIndex:endIndex,:) - state0(instance)%rhoEdgeDip=>plasticState(phase)%state0(startIndex:endIndex,:) dotState(instance)%rhoEdgeDip=>plasticState(phase)%dotState(startIndex:endIndex,:) + plasticState(p)%aTolState(startIndex:endIndex) = plastic_disloUCLA_aTolRho(instance) startIndex=endIndex+1_pInt endIndex=endIndex+ns state(instance)%accshear_slip=>plasticState(phase)%state(startIndex:endIndex,:) - state0(instance)%accshear_slip=>plasticState(phase)%state0(startIndex:endIndex,:) dotState(instance)%accshear_slip=>plasticState(phase)%dotState(startIndex:endIndex,:) + plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal startIndex=endIndex+1_pInt endIndex=endIndex+ns state(instance)%invLambdaSlip=>plasticState(phase)%state(startIndex:endIndex,:) - state0(instance)%invLambdaSlip=>plasticState(phase)%state0(startIndex:endIndex,:) startIndex=endIndex+1_pInt endIndex=endIndex+ns state(instance)%mfp_slip=>plasticState(phase)%state(startIndex:endIndex,:) - state0(instance)%mfp_slip=>plasticState(phase)%state0(startIndex:endIndex,:) startIndex=endIndex+1_pInt endIndex=endIndex+ns state(instance)%threshold_stress_slip=>plasticState(phase)%state(startIndex:endIndex,:) - state0(instance)%threshold_stress_slip=>plasticState(phase)%state0(startIndex:endIndex,:) call plastic_disloUCLA_stateInit(phase,instance) - call plastic_disloUCLA_aTolState(phase,instance) + + plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally endif myPhase2 enddo initializeInstances @@ -711,32 +704,10 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) tempState(5_pInt*ns+1:6_pInt*ns) = tauSlipThreshold0 -plasticState(ph)%state0 = spread(tempState,2,size(plasticState(ph)%state(1,:))) +plasticState(ph)%state = spread(tempState,2,size(plasticState(ph)%state(1,:))) end subroutine plastic_disloUCLA_stateInit -!-------------------------------------------------------------------------------------------------- -!> @brief sets the relevant state values for a given instance of this plasticity -!-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_aTolState(ph,instance) - use material, only: & - plasticState - - implicit none - integer(pInt), intent(in) :: & - ph, & - instance ! number specifying the current instance of the plasticity - - ! Tolerance state for dislocation densities - plasticState(ph)%aTolState(1_pInt:2_pInt*plastic_disloUCLA_totalNslip(instance)) = & - plastic_disloUCLA_aTolRho(instance) - - ! Tolerance state for accumulated shear due to slip - plasticState(ph)%aTolState(2_pInt*plastic_disloUCLA_totalNslip(instance)+1_pInt: & - 3_pInt*plastic_disloUCLA_totalNslip(instance))=1e6_pReal - -end subroutine plastic_disloUCLA_aTolState - !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state From 0649eafdedf68290e82721a2ef8a3bf44a22f970 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 28 Nov 2018 22:22:13 +0100 Subject: [PATCH 019/147] simpler way of Lp calculation --- src/plastic_disloUCLA.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index f2e32ffcb..50e3f37f2 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -806,6 +806,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el ph = phaseAt(ipc,ip,el) instance = phase_plasticityInstance(ph) ns = plastic_disloUCLA_totalNslip(instance) + associate(prm => param(instance), stt => state(instance)) Lp = 0.0_pReal dLp_dMp = 0.0_pReal @@ -830,8 +831,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el lattice_Sslip(1:3,1:3,2*k+1,index_myFamily+i,ph) enddo nonSchmidSystems - !* Plastic velocity gradient for dislocation glide - Lp = Lp + (gdot_slip_pos(j)+gdot_slip_neg(j))*0.5_pReal*lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) + Lp = Lp + (gdot_slip_pos(j)+gdot_slip_neg(j))*prm%Schmid_slip(1:3,1:3,j)*0.5_pReal !* Calculation of the tangent of Lp forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dMp(k,l,m,n) = & @@ -840,7 +840,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el lattice_Sslip(k,l,1,index_myFamily+i,ph) enddo slipSystems enddo slipFamilies - +end associate end subroutine plastic_disloUCLA_LpAndItsTangent From 5dc696c24e94a8f6edc43d8e1d30d3577bd242b1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 28 Nov 2018 22:38:14 +0100 Subject: [PATCH 020/147] calculating Lp is simple if appropriate data structures are used --- src/plastic_disloUCLA.f90 | 60 +++++++++------------------------------ 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 50e3f37f2..3fd8d5447 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -769,23 +769,10 @@ end subroutine plastic_disloUCLA_microstructure !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el) - use prec, only: & - tol_math_check - use math, only: & - math_Plain3333to99, & - math_Mandel6to33, & - math_Mandel33to6, & - math_symmetric33, & - math_mul33x3 use material, only: & material_phase, & phase_plasticityInstance, & phaseAt, phasememberAt - use lattice, only: & - lattice_Sslip, & - lattice_maxNslipFamily,& - lattice_NslipSystem, & - lattice_NnonSchmid implicit none integer(pInt), intent(in) :: ipc,ip,el @@ -794,10 +781,8 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el real(pReal), dimension(3,3), intent(out) :: Lp real(pReal), dimension(3,3,3,3), intent(out) :: dLp_dMp - integer(pInt) :: instance,ph,of,ns,f,i,j,k,l,m,n,index_myFamily + integer(pInt) :: instance,ph,of,i,k,l,m,n - real(pReal), dimension(3,3,2) :: & - nonSchmid_tensor real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg @@ -805,43 +790,25 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el of = phasememberAt(ipc,ip,el) ph = phaseAt(ipc,ip,el) instance = phase_plasticityInstance(ph) - ns = plastic_disloUCLA_totalNslip(instance) associate(prm => param(instance), stt => state(instance)) Lp = 0.0_pReal dLp_dMp = 0.0_pReal -!-------------------------------------------------------------------------------------------------- -! Dislocation glide part - - !* Dislocation density evolution call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) - j = 0_pInt - slipFamilies: do f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family - slipSystems: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - j = j+1_pInt - nonSchmid_tensor(1:3,1:3,1) = lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) - nonSchmid_tensor(1:3,1:3,2) = nonSchmid_tensor(1:3,1:3,1) - nonSchmidSystems: do k = 1,lattice_NnonSchmid(ph) - nonSchmid_tensor(1:3,1:3,1) = nonSchmid_tensor(1:3,1:3,1) + plastic_disloUCLA_nonSchmidCoeff(k,instance)*& - lattice_Sslip(1:3,1:3,2*k, index_myFamily+i,ph) - nonSchmid_tensor(1:3,1:3,2) = nonSchmid_tensor(1:3,1:3,2) + plastic_disloUCLA_nonSchmidCoeff(k,instance)*& - lattice_Sslip(1:3,1:3,2*k+1,index_myFamily+i,ph) - enddo nonSchmidSystems - - Lp = Lp + (gdot_slip_pos(j)+gdot_slip_neg(j))*prm%Schmid_slip(1:3,1:3,j)*0.5_pReal - !* Calculation of the tangent of Lp - forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & - dLp_dMp(k,l,m,n) = & - dLp_dMp(k,l,m,n) + (dgdot_dtauslip_pos(j)*nonSchmid_tensor(m,n,1)+& - dgdot_dtauslip_neg(j)*nonSchmid_tensor(m,n,2))*0.5_pReal*& - lattice_Sslip(k,l,1,index_myFamily+i,ph) - enddo slipSystems - enddo slipFamilies + slipSystems: do i = 1_pInt, prm%totalNslip + Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) + forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & + dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & + + dgdot_dtauslip_pos(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_pos(m,n,i) & + + dgdot_dtauslip_neg(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_neg(m,n,i) + enddo slipSystems end associate - + + Lp = 0.5_pReal * Lp + dLp_dMp = 0.5_pReal * dLp_dMp + end subroutine plastic_disloUCLA_LpAndItsTangent @@ -905,13 +872,14 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) !* Dislocation density evolution call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + dotState(instance)%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal + j = 0_pInt slipFamilies: do f = 1_pInt,lattice_maxNslipFamily index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family slipSystems: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) j = j+1_pInt - dotState(instance)%accshear_slip(j,of) = (gdot_slip_pos(j)+gdot_slip_neg(j))*0.5_pReal !* Multiplication DotRhoMultiplication = abs(dotState(instance)%accshear_slip(j,of))/& (plastic_disloUCLA_burgersPerSlipSystem(j,instance)* & From c0663b9fba214b37e9d9336285bd60f5f1a50cbb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 28 Nov 2018 23:02:46 +0100 Subject: [PATCH 021/147] storing per family makes loops obsolete --- src/plastic_disloUCLA.f90 | 340 ++++++++++++++++---------------------- 1 file changed, 145 insertions(+), 195 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 3fd8d5447..edaba83db 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -42,31 +42,20 @@ module plastic_disloUCLA plastic_disloUCLA_GrainSize, & !< grain size plastic_disloUCLA_CEdgeDipMinDistance, & !< plastic_disloUCLA_SolidSolutionStrength, & !< Strength due to elements in solid solution - plastic_disloUCLA_dipoleFormationFactor, & !< scaling factor for dipole formation: 0: off, 1: on. other values not useful - plastic_disloUCLA_aTolRho !< absolute tolerance for integration of dislocation density + plastic_disloUCLA_dipoleFormationFactor !< scaling factor for dipole formation: 0: off, 1: on. other values not useful real(pReal), dimension(:,:), allocatable, private :: & plastic_disloUCLA_rhoEdge0, & !< initial edge dislocation density per slip system for each family and instance plastic_disloUCLA_rhoEdgeDip0, & !< initial edge dipole density per slip system for each family and instance - plastic_disloUCLA_burgersPerSlipFamily, & !< absolute length of burgers vector [m] for each slip family and instance - plastic_disloUCLA_burgersPerSlipSystem, & !< absolute length of burgers vector [m] for each slip system and instance - plastic_disloUCLA_QedgePerSlipFamily, & !< activation energy for glide [J] for each slip family and instance - plastic_disloUCLA_QedgePerSlipSystem, & !< activation energy for glide [J] for each slip system and instance plastic_disloUCLA_v0PerSlipFamily, & !< dislocation velocity prefactor [m/s] for each family and instance plastic_disloUCLA_v0PerSlipSystem, & !< dislocation velocity prefactor [m/s] for each slip system and instance plastic_disloUCLA_tau_peierlsPerSlipFamily, & !< Peierls stress [Pa] for each family and instance plastic_disloUCLA_CLambdaSlipPerSlipFamily, & !< Adj. parameter for distance between 2 forest dislocations for each slip family and instance plastic_disloUCLA_CLambdaSlipPerSlipSystem, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance - plastic_disloUCLA_interaction_SlipSlip, & !< coefficients for slip-slip interaction for each interaction type and instance - plastic_disloUCLA_pPerSlipFamily, & !< p-exponent in glide velocity - plastic_disloUCLA_qPerSlipFamily, & !< q-exponent in glide velocity - !* mobility law parameters - plastic_disloUCLA_kinkheight, & !< height of the kink pair - plastic_disloUCLA_omega, & !< attempt frequency for kink pair nucleation - plastic_disloUCLA_kinkwidth, & !< width of the kink pair - plastic_disloUCLA_friction, & !< friction coeff. B (kMC) - !* - plastic_disloUCLA_nonSchmidCoeff !< non-Schmid coefficients (bcc) + plastic_disloUCLA_interaction_SlipSlip, & !< coefficients for slip-slip interaction for each interaction type and instance + !* mobility law parameters + plastic_disloUCLA_friction !< friction coeff. B (kMC) + real(pReal), dimension(:,:,:), allocatable, private :: & plastic_disloUCLA_interactionMatrix_SlipSlip, & !< interaction matrix of the different slip systems for each instance plastic_disloUCLA_forestProjectionEdge !< matrix of forest projections of edge dislocations for each instance @@ -85,6 +74,8 @@ module plastic_disloUCLA end enum type, private :: tParameters + real(pReal) :: & + aTolRho real(pReal), allocatable, dimension(:) :: & rho0, & !< initial edge dislocation density per slip system for each family and instance rhoDip0, & !< initial edge dipole density per slip system for each family and instance @@ -95,10 +86,9 @@ module plastic_disloUCLA p, & !< p-exponent in glide velocity q, & !< q-exponent in glide velocity !* mobility law parameters - kinkheight, & !< height of the kink pair - nu0, & !< attempt frequency for kink pair nucleation - kinkwidth, & !< width of the kink pair - !dislolength, & !< dislocation length (lamda) + kink_height, & !< height of the kink pair + kink_width, & !< width of the kink pair + omega, & !< attempt frequency for kink pair nucleation viscosity, & !< friction coeff. B (kMC) !* tauPeierls, & @@ -166,7 +156,8 @@ subroutine plastic_disloUCLA_init(fileUnit) use math, only: & math_Mandel3333to66, & math_Voigt66to3333, & - math_mul3x3 + math_mul3x3, & + math_expand use IO, only: & IO_read, & IO_lc, & @@ -243,28 +234,19 @@ material_allocatePlasticState allocate(plastic_disloUCLA_GrainSize(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_SolidSolutionStrength(maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_aTolRho(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default allocate(plastic_disloUCLA_rhoEdge0(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_rhoEdgeDip0(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_burgersPerSlipFamily(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal) - allocate(plastic_disloUCLA_kinkheight(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_omega(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_kinkwidth(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_friction(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_QedgePerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_v0PerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_tau_peierlsPerSlipFamily(lattice_maxNslipFamily,maxNinstance), & source=0.0_pReal) - allocate(plastic_disloUCLA_pPerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_qPerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CLambdaSlipPerSlipFamily(lattice_maxNslipFamily,maxNinstance), & source=0.0_pReal) allocate(plastic_disloUCLA_interaction_SlipSlip(lattice_maxNinteraction,maxNinstance),source=0.0_pReal) - allocate(plastic_disloUCLA_nonSchmidCoeff(lattice_maxNnonSchmid,maxNinstance), source=0.0_pReal) allocate(param(maxNinstance)) allocate(state(maxNinstance)) @@ -280,7 +262,7 @@ do p = 1_pInt, size(phase_plasticityInstance) structure = config_phase(p)%getString('lattice_structure') - + prm%aTolRho = config_phase(p)%getFloat('atol_rho') !-------------------------------------------------------------------------------------------------- ! slip related parameters prm%Nslip = config_phase(p)%getInts('nslip',defaultVal=emptyIntArray) @@ -302,18 +284,27 @@ do p = 1_pInt, size(phase_plasticityInstance) structure(1:3)) !prm%rho0 = config_phase(p)%getFloats('rho0') !prm%rhoDip0 = config_phase(p)%getFloats('dipole_rho0') - !prm%burgers = config_phase(p)%getFloats('burgers') - !prm%H0kp = config_phase(p)%getFloats('h0') + prm%burgers = config_phase(p)%getFloats('slipburgers') + prm%H0kp = config_phase(p)%getFloats('qedge') !prm%v0 = config_phase(p)%getFloats('v0') !prm%clambda = config_phase(p)%getFloats('clambda') !prm%tauPeierls = config_phase(p)%getFloats('peierls_stress') - !prm%p = config_phase(p)%getFloats('pexponent',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) - !prm%q = config_phase(p)%getFloats('qexponent',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) - !prm%kinkHeight = config_phase(p)%getFloats('kink_height') - !prm%kinkWidth = config_phase(p)%getFloats('kink_width') - !prm%nu0 = config_phase(p)%getFloats('attemptfrequency') - !prm%dislolength = config_phase(p)%getFloats('dislolength') ! what is this used for? + prm%p = config_phase(p)%getFloats('p_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) + prm%q = config_phase(p)%getFloats('q_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) + prm%kink_height = config_phase(p)%getFloats('kink_height') + prm%kink_width = config_phase(p)%getFloats('kink_width') + prm%omega = config_phase(p)%getFloats('omega') !prm%viscosity = config_phase(p)%getFloats('viscosity') + + + ! expand: family => system + prm%q = math_expand(prm%q, prm%Nslip) + prm%p = math_expand(prm%p, prm%Nslip) + prm%H0kp = math_expand(prm%H0kp, prm%Nslip) + prm%burgers = math_expand(prm%burgers, prm%Nslip) + prm%kink_height = math_expand(prm%kink_height, prm%Nslip) + prm%kink_width = math_expand(prm%kink_width, prm%Nslip) + prm%omega = math_expand(prm%omega, prm%Nslip) endif slipActive @@ -417,10 +408,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp plastic_disloUCLA_rhoEdge0(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('rhoedgedip0') plastic_disloUCLA_rhoEdgeDip0(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - case ('slipburgers') - plastic_disloUCLA_burgersPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - case ('qedge') - plastic_disloUCLA_QedgePerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('v0') plastic_disloUCLA_v0PerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('clambdaslip') @@ -429,19 +416,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp if (lattice_structure(phase) /= LATTICE_bcc_ID) & call IO_warning(42_pInt,ext_msg=trim(tag)//' for non-bcc ('//PLASTICITY_DISLOUCLA_label//')') plastic_disloUCLA_tau_peierlsPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - case ('p_slip') - plastic_disloUCLA_pPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - case ('q_slip') - plastic_disloUCLA_qPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - case ('kink_height') - plastic_disloUCLA_kinkheight(1:Nchunks_SlipFamilies,instance) = & - tempPerSlip(1:Nchunks_SlipFamilies) - case ('omega') - plastic_disloUCLA_omega(1:Nchunks_SlipFamilies,instance) = & - tempPerSlip(1:Nchunks_SlipFamilies) - case ('kink_width') - plastic_disloUCLA_kinkwidth(1:Nchunks_SlipFamilies,instance) = & - tempPerSlip(1:Nchunks_SlipFamilies) case ('friction_coeff') plastic_disloUCLA_friction(1:Nchunks_SlipFamilies,instance) = & tempPerSlip(1:Nchunks_SlipFamilies) @@ -455,12 +429,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp do j = 1_pInt, Nchunks_SlipSlip plastic_disloUCLA_interaction_SlipSlip(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j) enddo - case ('nonschmid_coefficients') - if (chunkPos(1) < 1_pInt + Nchunks_nonSchmid) & - call IO_warning(52_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_DISLOUCLA_label//')') - do j = 1_pInt,Nchunks_nonSchmid - plastic_disloUCLA_nonSchmidCoeff(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j) - enddo !-------------------------------------------------------------------------------------------------- ! parameters independent of number of slip systems case ('grainsize') @@ -469,8 +437,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp plastic_disloUCLA_D0(instance) = IO_floatValue(line,chunkPos,2_pInt) case ('qsd') plastic_disloUCLA_Qsd(instance) = IO_floatValue(line,chunkPos,2_pInt) - case ('atol_rho') - plastic_disloUCLA_aTolRho(instance) = IO_floatValue(line,chunkPos,2_pInt) case ('solidsolutionstrength') plastic_disloUCLA_SolidSolutionStrength(instance) = IO_floatValue(line,chunkPos,2_pInt) case ('cedgedipmindistance') @@ -494,8 +460,8 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp call IO_error(211_pInt,el=instance,ext_msg='rhoEdge0 ('//PLASTICITY_DISLOUCLA_label//')') if (plastic_disloUCLA_rhoEdgeDip0(f,instance) < 0.0_pReal) & call IO_error(211_pInt,el=instance,ext_msg='rhoEdgeDip0 ('//PLASTICITY_DISLOUCLA_label//')') - if (plastic_disloUCLA_burgersPerSlipFamily(f,instance) <= 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='slipBurgers ('//PLASTICITY_DISLOUCLA_label//')') + !if (plastic_disloUCLA_burgersPerSlipFamily(f,instance) <= 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='slipBurgers ('//PLASTICITY_DISLOUCLA_label//')') if (plastic_disloUCLA_v0PerSlipFamily(f,instance) <= 0.0_pReal) & call IO_error(211_pInt,el=instance,ext_msg='v0 ('//PLASTICITY_DISLOUCLA_label//')') if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & @@ -522,8 +488,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! allocation of variables whose size depends on the total number of active slip systems maxTotalNslip = maxval(plastic_disloUCLA_totalNslip) - allocate(plastic_disloUCLA_burgersPerSlipSystem(maxTotalNslip, maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_QedgePerSlipSystem(maxTotalNslip, maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_v0PerSlipSystem(maxTotalNslip, maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CLambdaSlipPerSlipSystem(maxTotalNslip, maxNinstance),source=0.0_pReal) @@ -541,7 +505,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp instance = phase_plasticityInstance(phase) ns = plastic_disloUCLA_totalNslip(instance) - + associate(prm => param(instance), stt=>state(instance)) !-------------------------------------------------------------------------------------------------- ! allocate state arrays @@ -567,16 +531,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp index_myFamily = sum(plastic_disloUCLA_Nslip(1:f-1_pInt,instance)) ! index in truncated slip system list mySlipSystems: do j = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - !* Burgers vector, - ! dislocation velocity prefactor, - ! mean free path prefactor, - ! and minimum dipole distance - - plastic_disloUCLA_burgersPerSlipSystem(index_myFamily+j,instance) = & - plastic_disloUCLA_burgersPerSlipFamily(f,instance) - - plastic_disloUCLA_QedgePerSlipSystem(index_myFamily+j,instance) = & - plastic_disloUCLA_QedgePerSlipFamily(f,instance) + plastic_disloUCLA_v0PerSlipSystem(index_myFamily+j,instance) = & plastic_disloUCLA_v0PerSlipFamily(f,instance) @@ -606,13 +561,13 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp endIndex=ns state(instance)%rhoEdge=>plasticState(phase)%state(startIndex:endIndex,:) dotState(instance)%rhoEdge=>plasticState(phase)%dotState(startIndex:endIndex,:) - plasticState(p)%aTolState(startIndex:endIndex) = plastic_disloUCLA_aTolRho(instance) + plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho startIndex=endIndex+1_pInt endIndex=endIndex+ns state(instance)%rhoEdgeDip=>plasticState(phase)%state(startIndex:endIndex,:) dotState(instance)%rhoEdgeDip=>plasticState(phase)%dotState(startIndex:endIndex,:) - plasticState(p)%aTolState(startIndex:endIndex) = plastic_disloUCLA_aTolRho(instance) + plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho startIndex=endIndex+1_pInt endIndex=endIndex+ns @@ -635,8 +590,9 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp call plastic_disloUCLA_stateInit(phase,instance) plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + end associate endif myPhase2 - + enddo initializeInstances end subroutine plastic_disloUCLA_init @@ -669,7 +625,7 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) tauSlipThreshold0 tempState = 0.0_pReal ns = plastic_disloUCLA_totalNslip(instance) - + associate(prm => param(instance), stt => state(instance)) !-------------------------------------------------------------------------------------------------- ! initialize basic slip state variables do f = 1_pInt,lattice_maxNslipFamily @@ -699,13 +655,13 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) forall (i = 1_pInt:ns) & tauSlipThreshold0(i) = & - lattice_mu(ph)*plastic_disloUCLA_burgersPerSlipSystem(i,instance) * & + lattice_mu(ph)*prm%burgers(i) * & sqrt(dot_product((rhoEdge0+rhoEdgeDip0),plastic_disloUCLA_interactionMatrix_SlipSlip(i,1:ns,instance))) tempState(5_pInt*ns+1:6_pInt*ns) = tauSlipThreshold0 plasticState(ph)%state = spread(tempState,2,size(plasticState(ph)%state(1,:))) - +end associate end subroutine plastic_disloUCLA_stateInit @@ -740,7 +696,7 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) ph = phaseAt(ipc,ip,el) instance = phase_plasticityInstance(ph) ns = plastic_disloUCLA_totalNslip(instance) - + associate(prm => param(instance), stt => state(instance)) !* 1/mean free distance between 2 forest dislocations seen by a moving dislocation forall (s = 1_pInt:ns) & state(instance)%invLambdaSlip(s,of) = & @@ -758,10 +714,10 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) !* threshold stress for dislocation motion forall (s = 1_pInt:ns) & state(instance)%threshold_stress_slip(s,of) = & - lattice_mu(ph)*plastic_disloUCLA_burgersPerSlipSystem(s,instance)*& + lattice_mu(ph)*prm%burgers(s)*& sqrt(dot_product((state(instance)%rhoEdge(1_pInt:ns,of)+state(instance)%rhoEdgeDip(1_pInt:ns,of)),& plastic_disloUCLA_interactionMatrix_SlipSlip(s,1:ns,instance))) - + end associate end subroutine plastic_disloUCLA_microstructure @@ -868,7 +824,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) ns = plastic_disloUCLA_totalNslip(instance) plasticState(ph)%dotState(:,of) = 0.0_pReal - + associate(prm => param(instance), stt => state(instance)) !* Dislocation density evolution call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) @@ -882,38 +838,38 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) !* Multiplication DotRhoMultiplication = abs(dotState(instance)%accshear_slip(j,of))/& - (plastic_disloUCLA_burgersPerSlipSystem(j,instance)* & + (prm%burgers(j)* & state(instance)%mfp_slip(j,of)) !* Dipole formation EdgeDipMinDistance = & - plastic_disloUCLA_CEdgeDipMinDistance(instance)*plastic_disloUCLA_burgersPerSlipSystem(j,instance) + plastic_disloUCLA_CEdgeDipMinDistance(instance)*prm%burgers(j) if (dEq0(tau_slip_pos(j))) then DotRhoDipFormation = 0.0_pReal else EdgeDipDistance = & - (3.0_pReal*lattice_mu(ph)*plastic_disloUCLA_burgersPerSlipSystem(j,instance))/& + (3.0_pReal*lattice_mu(ph)*prm%burgers(j))/& (16.0_pReal*pi*abs(tau_slip_pos(j))) if (EdgeDipDistance>state(instance)%mfp_slip(j,of)) EdgeDipDistance=state(instance)%mfp_slip(j,of) if (EdgeDipDistance @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -function plastic_disloUCLA_postResults(Mp,Temperature,ipc,ip,el) +function plastic_disloUCLA_postResults(Mp,Temperature,ipc,ip,el) result(postResults) use prec, only: & tol_math_check, & dEq, dNeq0 @@ -974,7 +930,7 @@ math_mul33xx33 el !< element real(pReal), dimension(plastic_disloUCLA_sizePostResults(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & - plastic_disloUCLA_postResults + postResults integer(pInt) :: & instance,& @@ -993,30 +949,30 @@ math_mul33xx33 !* Required output c = 0_pInt - plastic_disloUCLA_postResults = 0.0_pReal - + postResults = 0.0_pReal + associate (prm => param(instance)) do o = 1_pInt,plastic_disloUCLA_Noutput(instance) select case(plastic_disloUCLA_outputID(o,instance)) case (rho_ID) - plastic_disloUCLA_postResults(c+1_pInt:c+ns) = state(instance)%rhoEdge(1_pInt:ns,of) + postResults(c+1_pInt:c+ns) = state(instance)%rhoEdge(1_pInt:ns,of) c = c + ns case (rhoDip_ID) - plastic_disloUCLA_postResults(c+1_pInt:c+ns) = state(instance)%rhoEdgeDip(1_pInt:ns,of) + postResults(c+1_pInt:c+ns) = state(instance)%rhoEdgeDip(1_pInt:ns,of) c = c + ns case (shearrate_ID,stressexponent_ID) call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) if (plastic_disloUCLA_outputID(o,instance) == shearrate_ID) then - plastic_disloUCLA_postResults(c+1:c+ns) = (gdot_slip_pos + gdot_slip_neg)*0.5_pReal + postResults(c+1:c+ns) = (gdot_slip_pos + gdot_slip_neg)*0.5_pReal c = c + ns elseif(plastic_disloUCLA_outputID(o,instance) == stressexponent_ID) then do j = 1_pInt, ns if (dEq(gdot_slip_pos(j)+gdot_slip_neg(j),0.0_pReal)) then - plastic_disloUCLA_postResults(c+j) = 0.0_pReal + postResults(c+j) = 0.0_pReal else - plastic_disloUCLA_postResults(c+j) = (tau_slip_pos(j)+tau_slip_neg(j))/& + postResults(c+j) = (tau_slip_pos(j)+tau_slip_neg(j))/& (gdot_slip_pos(j)+gdot_slip_neg(j))*& (dgdot_dtauslip_pos(j)+dgdot_dtauslip_neg(j))* 0.5_pReal endif @@ -1025,11 +981,11 @@ math_mul33xx33 endif case (accumulatedshear_ID) - plastic_disloUCLA_postResults(c+1_pInt:c+ns) = & + postResults(c+1_pInt:c+ns) = & state(instance)%accshear_slip(1_pInt:ns, of) c = c + ns case (mfp_ID) - plastic_disloUCLA_postResults(c+1_pInt:c+ns) =& + postResults(c+1_pInt:c+ns) =& state(instance)%mfp_slip(1_pInt:ns, of) c = c + ns case (resolvedstress_ID) @@ -1038,12 +994,12 @@ math_mul33xx33 index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family slipSystems1: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) j = j + 1_pInt - plastic_disloUCLA_postResults(c+j) =& + postResults(c+j) =& math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)) enddo slipSystems1; enddo slipFamilies1 c = c + ns case (thresholdstress_ID) - plastic_disloUCLA_postResults(c+1_pInt:c+ns) = & + postResults(c+1_pInt:c+ns) = & state(instance)%threshold_stress_slip(1_pInt:ns,of) c = c + ns case (dipoleDistance_ID) @@ -1053,18 +1009,19 @@ math_mul33xx33 slipSystems2: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) j = j + 1_pInt if (dNeq0(abs(math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph))))) then - plastic_disloUCLA_postResults(c+j) = & - (3.0_pReal*lattice_mu(ph)*plastic_disloUCLA_burgersPerSlipSystem(j,instance))/& + postResults(c+j) = & + (3.0_pReal*lattice_mu(ph)*prm%burgers(j))/& (16.0_pReal*pi*abs(math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)))) else - plastic_disloUCLA_postResults(c+j) = huge(1.0_pReal) + postResults(c+j) = huge(1.0_pReal) endif - plastic_disloUCLA_postResults(c+j)=min(plastic_disloUCLA_postResults(c+j),& + postResults(c+j)=min(postResults(c+j),& state(instance)%mfp_slip(j,of)) enddo slipSystems2; enddo slipFamilies2 c = c + ns end select enddo +end associate end function plastic_disloUCLA_postResults @@ -1106,7 +1063,7 @@ ph, instance,of dvel_slip, vel_slip real(pReal), intent(out), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg - + associate(prm => param(instance), stt => state(instance)) !* Shortened notation ns = plastic_disloUCLA_totalNslip(instance) @@ -1121,40 +1078,33 @@ ph, instance,of slipSystems: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) j = j + 1_pInt !* Boltzmann ratio - BoltzmannRatio = plastic_disloUCLA_QedgePerSlipSystem(j,instance)/(kB*Temperature) + BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) !* Initial shear rates DotGamma0 = & - state(instance)%rhoEdge(j,of)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)*& + state(instance)%rhoEdge(j,of)*prm%burgers(j)*& plastic_disloUCLA_v0PerSlipSystem(j,instance) !* Resolved shear stress on slip system - tau_slip_pos(j) = math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)) - tau_slip_neg(j) = tau_slip_pos(j) - - nonSchmidSystems: do k = 1,lattice_NnonSchmid(ph) - tau_slip_pos = tau_slip_pos + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & - math_mul33xx33(Mp,lattice_Sslip(1:3,1:3,2*k,index_myFamily+i,ph)) - tau_slip_neg = tau_slip_neg + plastic_disloUCLA_nonSchmidCoeff(k,instance)* & - math_mul33xx33(Mp,lattice_Sslip(1:3,1:3,2*k+1,index_myFamily+i,ph)) - enddo nonSchmidSystems + tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) + tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) significantPositiveTau: if((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j, of)) > tol_math_check) then !* Stress ratio stressRatio = ((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j, of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) - stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) - stressRatio_pminus1 = stressRatio**(plastic_disloUCLA_pPerSlipFamily(f,instance)-1.0_pReal) + stressRatio_p = stressRatio** prm%p(j) + stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) !* Shear rates due to slip - vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & + vel_slip = 2.0_pReal*prm%burgers(j) & + * prm%kink_height(j) * prm%omega(j) & + * ( state(instance)%mfp_slip(j,of) - prm%kink_width(j) ) & * (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & + 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) gdot_slip_pos(j) = DotGamma0 & @@ -1163,41 +1113,41 @@ ph, instance,of !* Derivatives of shear rates dvel_slip = & - 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & + 2.0_pReal*prm%burgers(j) & + * prm%kink_height(j) * prm%omega(j) & + * ( state(instance)%mfp_slip(j,of) - prm%kink_width(j) ) & * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & + (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_pos(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) - *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& - *plastic_disloUCLA_qPerSlipFamily(f,instance)/& + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) + *BoltzmannRatio*prm%p(j)& + *prm%q(j)/& (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& - StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) ) &!deltaf(f) + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & + * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) - *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& - *plastic_disloUCLA_qPerSlipFamily(f,instance)/& + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) + *BoltzmannRatio*prm%p(j)& + *prm%q(j)/& (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& - StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) )& !deltaf(f) + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& !deltaf(f) ) & ) & / ( & ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_pos(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & + 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & ) @@ -1209,19 +1159,19 @@ ph, instance,of stressRatio = ((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j, of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) - stressRatio_p = stressRatio** plastic_disloUCLA_pPerSlipFamily(f,instance) - stressRatio_pminus1 = stressRatio**(plastic_disloUCLA_pPerSlipFamily(f,instance)-1.0_pReal) + stressRatio_p = stressRatio** prm%p(j) + stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) !* Shear rates due to slip - vel_slip = 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & + vel_slip = 2.0_pReal*prm%burgers(j) & + * prm%kink_height(j) * prm%omega(j) & + * ( state(instance)%mfp_slip(j,of) - prm%kink_width(j) ) & * (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & + 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) gdot_slip_neg(j) = DotGamma0 & @@ -1229,41 +1179,41 @@ ph, instance,of * sign(1.0_pReal,tau_slip_neg(j)) !* Derivatives of shear rates dvel_slip = & - 2.0_pReal*plastic_disloUCLA_burgersPerSlipFamily(f,instance) & - * plastic_disloUCLA_kinkheight(f,instance) * plastic_disloUCLA_omega(f,instance) & - * ( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) ) & + 2.0_pReal*prm%burgers(j) & + * prm%kink_height(j) * prm%omega(j) & + * ( state(instance)%mfp_slip(j,of) - prm%kink_width(j) ) & * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & + (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_neg(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) - *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& - *plastic_disloUCLA_qPerSlipFamily(f,instance)/& + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) + *BoltzmannRatio*prm%p(j)& + *prm%q(j)/& (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& - StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) ) &!deltaf(f) + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & + * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) ) & - * (2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)))& !deltaf(i) - *BoltzmannRatio*plastic_disloUCLA_pPerSlipFamily(f,instance)& - *plastic_disloUCLA_qPerSlipFamily(f,instance)/& + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) + *BoltzmannRatio*prm%p(j)& + *prm%q(j)/& (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& - StressRatio_pminus1*(1-StressRatio_p)**(plastic_disloUCLA_qPerSlipFamily(f,instance)-1.0_pReal) )& !deltaf(f) + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& !deltaf(f) ) & ) & / ( & ( & - 2.0_pReal*(plastic_disloUCLA_burgersPerSlipFamily(f,instance)**2.0_pReal)*tau_slip_neg(j) & - + plastic_disloUCLA_omega(f,instance) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - plastic_disloUCLA_kinkwidth(f,instance) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** plastic_disloUCLA_qPerSlipFamily(f,instance)) & + 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & ) @@ -1273,7 +1223,7 @@ ph, instance,of endif significantNegativeTau enddo slipSystems enddo slipFamilies - + end associate end subroutine kinetics end module plastic_disloUCLA From 9aec5f6db0f14868f8fd17b191a79b86e45203ee Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Nov 2018 07:27:35 +0100 Subject: [PATCH 022/147] shorter notation --- src/plastic_disloUCLA.f90 | 88 +++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index edaba83db..28feb94a7 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -559,33 +559,33 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp startIndex=1_pInt endIndex=ns - state(instance)%rhoEdge=>plasticState(phase)%state(startIndex:endIndex,:) + stt%rhoEdge=>plasticState(phase)%state(startIndex:endIndex,:) dotState(instance)%rhoEdge=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho startIndex=endIndex+1_pInt endIndex=endIndex+ns - state(instance)%rhoEdgeDip=>plasticState(phase)%state(startIndex:endIndex,:) + stt%rhoEdgeDip=>plasticState(phase)%state(startIndex:endIndex,:) dotState(instance)%rhoEdgeDip=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho startIndex=endIndex+1_pInt endIndex=endIndex+ns - state(instance)%accshear_slip=>plasticState(phase)%state(startIndex:endIndex,:) + stt%accshear_slip=>plasticState(phase)%state(startIndex:endIndex,:) dotState(instance)%accshear_slip=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal startIndex=endIndex+1_pInt endIndex=endIndex+ns - state(instance)%invLambdaSlip=>plasticState(phase)%state(startIndex:endIndex,:) + stt%invLambdaSlip=>plasticState(phase)%state(startIndex:endIndex,:) startIndex=endIndex+1_pInt endIndex=endIndex+ns - state(instance)%mfp_slip=>plasticState(phase)%state(startIndex:endIndex,:) + stt%mfp_slip=>plasticState(phase)%state(startIndex:endIndex,:) startIndex=endIndex+1_pInt endIndex=endIndex+ns - state(instance)%threshold_stress_slip=>plasticState(phase)%state(startIndex:endIndex,:) + stt%threshold_stress_slip=>plasticState(phase)%state(startIndex:endIndex,:) call plastic_disloUCLA_stateInit(phase,instance) @@ -625,7 +625,7 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) tauSlipThreshold0 tempState = 0.0_pReal ns = plastic_disloUCLA_totalNslip(instance) - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(instance)) !-------------------------------------------------------------------------------------------------- ! initialize basic slip state variables do f = 1_pInt,lattice_maxNslipFamily @@ -699,23 +699,23 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) associate(prm => param(instance), stt => state(instance)) !* 1/mean free distance between 2 forest dislocations seen by a moving dislocation forall (s = 1_pInt:ns) & - state(instance)%invLambdaSlip(s,of) = & - sqrt(dot_product((state(instance)%rhoEdge(1_pInt:ns,of)+state(instance)%rhoEdgeDip(1_pInt:ns,of)),& + stt%invLambdaSlip(s,of) = & + sqrt(dot_product((stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of)),& plastic_disloUCLA_forestProjectionEdge(1:ns,s,instance)))/ & plastic_disloUCLA_CLambdaSlipPerSlipSystem(s,instance) !* mean free path between 2 obstacles seen by a moving dislocation do s = 1_pInt,ns - state(instance)%mfp_slip(s,of) = & + stt%mfp_slip(s,of) = & plastic_disloUCLA_GrainSize(instance)/& - (1.0_pReal+plastic_disloUCLA_GrainSize(instance)*(state(instance)%invLambdaSlip(s,of))) + (1.0_pReal+plastic_disloUCLA_GrainSize(instance)*(stt%invLambdaSlip(s,of))) enddo !* threshold stress for dislocation motion forall (s = 1_pInt:ns) & - state(instance)%threshold_stress_slip(s,of) = & + stt%threshold_stress_slip(s,of) = & lattice_mu(ph)*prm%burgers(s)*& - sqrt(dot_product((state(instance)%rhoEdge(1_pInt:ns,of)+state(instance)%rhoEdgeDip(1_pInt:ns,of)),& + sqrt(dot_product((stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of)),& plastic_disloUCLA_interactionMatrix_SlipSlip(s,1:ns,instance))) end associate end subroutine plastic_disloUCLA_microstructure @@ -746,7 +746,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el of = phasememberAt(ipc,ip,el) ph = phaseAt(ipc,ip,el) instance = phase_plasticityInstance(ph) - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(instance)) Lp = 0.0_pReal dLp_dMp = 0.0_pReal @@ -839,7 +839,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) !* Multiplication DotRhoMultiplication = abs(dotState(instance)%accshear_slip(j,of))/& (prm%burgers(j)* & - state(instance)%mfp_slip(j,of)) + stt%mfp_slip(j,of)) !* Dipole formation EdgeDipMinDistance = & @@ -850,22 +850,22 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) EdgeDipDistance = & (3.0_pReal*lattice_mu(ph)*prm%burgers(j))/& (16.0_pReal*pi*abs(tau_slip_pos(j))) - if (EdgeDipDistance>state(instance)%mfp_slip(j,of)) EdgeDipDistance=state(instance)%mfp_slip(j,of) + if (EdgeDipDistance>stt%mfp_slip(j,of)) EdgeDipDistance=stt%mfp_slip(j,of) if (EdgeDipDistance param(instance)) + associate (prm => param(instance),stt =>state(instance)) do o = 1_pInt,plastic_disloUCLA_Noutput(instance) select case(plastic_disloUCLA_outputID(o,instance)) case (rho_ID) - postResults(c+1_pInt:c+ns) = state(instance)%rhoEdge(1_pInt:ns,of) + postResults(c+1_pInt:c+ns) = stt%rhoEdge(1_pInt:ns,of) c = c + ns case (rhoDip_ID) - postResults(c+1_pInt:c+ns) = state(instance)%rhoEdgeDip(1_pInt:ns,of) + postResults(c+1_pInt:c+ns) = stt%rhoEdgeDip(1_pInt:ns,of) c = c + ns case (shearrate_ID,stressexponent_ID) call kinetics(Mp,Temperature,ph,instance,of, & @@ -982,11 +982,11 @@ math_mul33xx33 case (accumulatedshear_ID) postResults(c+1_pInt:c+ns) = & - state(instance)%accshear_slip(1_pInt:ns, of) + stt%accshear_slip(1_pInt:ns, of) c = c + ns case (mfp_ID) postResults(c+1_pInt:c+ns) =& - state(instance)%mfp_slip(1_pInt:ns, of) + stt%mfp_slip(1_pInt:ns, of) c = c + ns case (resolvedstress_ID) j = 0_pInt @@ -1000,7 +1000,7 @@ math_mul33xx33 c = c + ns case (thresholdstress_ID) postResults(c+1_pInt:c+ns) = & - state(instance)%threshold_stress_slip(1_pInt:ns,of) + stt%threshold_stress_slip(1_pInt:ns,of) c = c + ns case (dipoleDistance_ID) j = 0_pInt @@ -1016,7 +1016,7 @@ math_mul33xx33 postResults(c+j) = huge(1.0_pReal) endif postResults(c+j)=min(postResults(c+j),& - state(instance)%mfp_slip(j,of)) + stt%mfp_slip(j,of)) enddo slipSystems2; enddo slipFamilies2 c = c + ns end select @@ -1081,15 +1081,15 @@ ph, instance,of BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) !* Initial shear rates DotGamma0 = & - state(instance)%rhoEdge(j,of)*prm%burgers(j)*& + stt%rhoEdge(j,of)*prm%burgers(j)*& plastic_disloUCLA_v0PerSlipSystem(j,instance) !* Resolved shear stress on slip system tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) - significantPositiveTau: if((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j, of)) > tol_math_check) then + significantPositiveTau: if((abs(tau_slip_pos(j))-stt%threshold_stress_slip(j, of)) > tol_math_check) then !* Stress ratio - stressRatio = ((abs(tau_slip_pos(j))-state(instance)%threshold_stress_slip(j, of))/& + stressRatio = ((abs(tau_slip_pos(j))-stt%threshold_stress_slip(j, of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) stressRatio_p = stressRatio** prm%p(j) @@ -1097,13 +1097,13 @@ ph, instance,of !* Shear rates due to slip vel_slip = 2.0_pReal*prm%burgers(j) & * prm%kink_height(j) * prm%omega(j) & - * ( state(instance)%mfp_slip(j,of) - prm%kink_width(j) ) & + * ( stt%mfp_slip(j,of) - prm%kink_width(j) ) & * (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) @@ -1115,7 +1115,7 @@ ph, instance,of dvel_slip = & 2.0_pReal*prm%burgers(j) & * prm%kink_height(j) * prm%omega(j) & - * ( state(instance)%mfp_slip(j,of) - prm%kink_width(j) ) & + * ( stt%mfp_slip(j,of) - prm%kink_width(j) ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_pos(j) & @@ -1127,14 +1127,14 @@ ph, instance,of ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& @@ -1146,7 +1146,7 @@ ph, instance,of ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & ) @@ -1154,9 +1154,9 @@ ph, instance,of dgdot_dtauslip_pos(j) = DotGamma0 * dvel_slip endif significantPositiveTau - significantNegativeTau: if((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j, of)) > tol_math_check) then + significantNegativeTau: if((abs(tau_slip_neg(j))-stt%threshold_stress_slip(j, of)) > tol_math_check) then !* Stress ratios - stressRatio = ((abs(tau_slip_neg(j))-state(instance)%threshold_stress_slip(j, of))/& + stressRatio = ((abs(tau_slip_neg(j))-stt%threshold_stress_slip(j, of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) stressRatio_p = stressRatio** prm%p(j) @@ -1164,13 +1164,13 @@ ph, instance,of !* Shear rates due to slip vel_slip = 2.0_pReal*prm%burgers(j) & * prm%kink_height(j) * prm%omega(j) & - * ( state(instance)%mfp_slip(j,of) - prm%kink_width(j) ) & + * ( stt%mfp_slip(j,of) - prm%kink_width(j) ) & * (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) @@ -1181,7 +1181,7 @@ ph, instance,of dvel_slip = & 2.0_pReal*prm%burgers(j) & * prm%kink_height(j) * prm%omega(j) & - * ( state(instance)%mfp_slip(j,of) - prm%kink_width(j) ) & + * ( stt%mfp_slip(j,of) - prm%kink_width(j) ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_neg(j) & @@ -1193,14 +1193,14 @@ ph, instance,of ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& @@ -1212,7 +1212,7 @@ ph, instance,of ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( state(instance)%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & ) From 228ef831f0019ed126a22d7a87e0c791c27ce438 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Nov 2018 08:14:20 +0100 Subject: [PATCH 023/147] cleanding dependentState/microstructure don't need to be part of the complex state handling --- src/plastic_disloUCLA.f90 | 63 ++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 28feb94a7..dd46c0ca9 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -45,8 +45,6 @@ module plastic_disloUCLA plastic_disloUCLA_dipoleFormationFactor !< scaling factor for dipole formation: 0: off, 1: on. other values not useful real(pReal), dimension(:,:), allocatable, private :: & - plastic_disloUCLA_rhoEdge0, & !< initial edge dislocation density per slip system for each family and instance - plastic_disloUCLA_rhoEdgeDip0, & !< initial edge dipole density per slip system for each family and instance plastic_disloUCLA_v0PerSlipFamily, & !< dislocation velocity prefactor [m/s] for each family and instance plastic_disloUCLA_v0PerSlipSystem, & !< dislocation velocity prefactor [m/s] for each slip system and instance plastic_disloUCLA_tau_peierlsPerSlipFamily, & !< Peierls stress [Pa] for each family and instance @@ -121,10 +119,20 @@ module plastic_disloUCLA mfp_slip, & threshold_stress_slip end type + + type, private :: tDisloUCLAMicrostructure + real(pReal), allocatable, dimension(:,:) :: & + invLambda, & + mfp, & + threshold_stress + end type tDisloUCLAMicrostructure + type(tDisloUCLAState ), allocatable, dimension(:), private :: & state, & - state0, & dotState + + type(tDisloUCLAMicrostructure), allocatable, dimension(:), private :: & + microstructure public :: & plastic_disloUCLA_init, & @@ -235,8 +243,6 @@ material_allocatePlasticState allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_SolidSolutionStrength(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default - allocate(plastic_disloUCLA_rhoEdge0(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_rhoEdgeDip0(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_friction(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_v0PerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_tau_peierlsPerSlipFamily(lattice_maxNslipFamily,maxNinstance), & @@ -250,8 +256,8 @@ material_allocatePlasticState allocate(param(maxNinstance)) allocate(state(maxNinstance)) - allocate(state0(maxNinstance)) allocate(dotState(maxNinstance)) + allocate(microstructure(maxNinstance)) do p = 1_pInt, size(phase_plasticityInstance) @@ -282,8 +288,8 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%interaction_SlipSlip = lattice_interaction_SlipSlip(prm%Nslip, & config_phase(p)%getFloats('interaction_slipslip'), & structure(1:3)) - !prm%rho0 = config_phase(p)%getFloats('rho0') - !prm%rhoDip0 = config_phase(p)%getFloats('dipole_rho0') + prm%rho0 = config_phase(p)%getFloats('rhoedge0') + prm%rhoDip0 = config_phase(p)%getFloats('rhoedgedip0') prm%burgers = config_phase(p)%getFloats('slipburgers') prm%H0kp = config_phase(p)%getFloats('qedge') !prm%v0 = config_phase(p)%getFloats('v0') @@ -298,6 +304,8 @@ do p = 1_pInt, size(phase_plasticityInstance) ! expand: family => system + prm%rho0 = math_expand(prm%rho0, prm%Nslip) + prm%rhoDip0 = math_expand(prm%rhoDip0, prm%Nslip) prm%q = math_expand(prm%q, prm%Nslip) prm%p = math_expand(prm%p, prm%Nslip) prm%H0kp = math_expand(prm%H0kp, prm%Nslip) @@ -404,10 +412,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp tempPerSlip(j) = IO_floatValue(line,chunkPos,1_pInt+j) enddo select case(tag) - case ('rhoedge0') - plastic_disloUCLA_rhoEdge0(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - case ('rhoedgedip0') - plastic_disloUCLA_rhoEdgeDip0(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('v0') plastic_disloUCLA_v0PerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('clambdaslip') @@ -456,10 +460,10 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp call IO_error(211_pInt,el=instance,ext_msg='Nslip ('//PLASTICITY_DISLOUCLA_label//')') do f = 1_pInt,lattice_maxNslipFamily if (plastic_disloUCLA_Nslip(f,instance) > 0_pInt) then - if (plastic_disloUCLA_rhoEdge0(f,instance) < 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='rhoEdge0 ('//PLASTICITY_DISLOUCLA_label//')') - if (plastic_disloUCLA_rhoEdgeDip0(f,instance) < 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='rhoEdgeDip0 ('//PLASTICITY_DISLOUCLA_label//')') + !if (plastic_disloUCLA_rhoEdge0(f,instance) < 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdge0 ('//PLASTICITY_DISLOUCLA_label//')') + !if (plastic_disloUCLA_rhoEdgeDip0(f,instance) < 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdgeDip0 ('//PLASTICITY_DISLOUCLA_label//')') !if (plastic_disloUCLA_burgersPerSlipFamily(f,instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='slipBurgers ('//PLASTICITY_DISLOUCLA_label//')') if (plastic_disloUCLA_v0PerSlipFamily(f,instance) <= 0.0_pReal) & @@ -505,7 +509,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp instance = phase_plasticityInstance(phase) ns = plastic_disloUCLA_totalNslip(instance) - associate(prm => param(instance), stt=>state(instance)) + associate(prm => param(instance), stt=>state(instance),mse => microstructure(phase_plasticityInstance(p))) !-------------------------------------------------------------------------------------------------- ! allocate state arrays @@ -587,6 +591,10 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp endIndex=endIndex+ns stt%threshold_stress_slip=>plasticState(phase)%state(startIndex:endIndex,:) + allocate(mse%invLambda(prm%totalNslip,NofMyPhase),source=0.0_pReal) + allocate(mse%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) + allocate(mse%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) + call plastic_disloUCLA_stateInit(phase,instance) plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally @@ -618,33 +626,20 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) integer(pInt) :: i,f,ns, index_myFamily real(pReal), dimension(plastic_disloUCLA_totalNslip(instance)) :: & - rhoEdge0, & - rhoEdgeDip0, & invLambdaSlip0, & MeanFreePathSlip0, & tauSlipThreshold0 tempState = 0.0_pReal ns = plastic_disloUCLA_totalNslip(instance) associate(prm => param(instance)) -!-------------------------------------------------------------------------------------------------- -! initialize basic slip state variables - do f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(plastic_disloUCLA_Nslip(1:f-1_pInt,instance)) ! index in truncated slip system list - rhoEdge0(index_myFamily+1_pInt: & - index_myFamily+plastic_disloUCLA_Nslip(f,instance)) = & - plastic_disloUCLA_rhoEdge0(f,instance) - rhoEdgeDip0(index_myFamily+1_pInt: & - index_myFamily+plastic_disloUCLA_Nslip(f,instance)) = & - plastic_disloUCLA_rhoEdgeDip0(f,instance) - enddo - tempState(1_pInt:ns) = rhoEdge0 - tempState(ns+1_pInt:2_pInt*ns) = rhoEdgeDip0 + tempState(1_pInt:ns) = prm%rho0 + tempState(ns+1_pInt:2_pInt*ns) = prm%rhoDip0 !-------------------------------------------------------------------------------------------------- ! initialize dependent slip microstructural variables forall (i = 1_pInt:ns) & - invLambdaSlip0(i) = sqrt(dot_product((rhoEdge0+rhoEdgeDip0),plastic_disloUCLA_forestProjectionEdge(1:ns,i,instance)))/ & + invLambdaSlip0(i) = sqrt(dot_product((prm%rho0+prm%rhoDip0),plastic_disloUCLA_forestProjectionEdge(1:ns,i,instance)))/ & plastic_disloUCLA_CLambdaSlipPerSlipSystem(i,instance) tempState(3_pInt*ns+1:4_pInt*ns) = invLambdaSlip0 @@ -656,7 +651,7 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) forall (i = 1_pInt:ns) & tauSlipThreshold0(i) = & lattice_mu(ph)*prm%burgers(i) * & - sqrt(dot_product((rhoEdge0+rhoEdgeDip0),plastic_disloUCLA_interactionMatrix_SlipSlip(i,1:ns,instance))) + sqrt(dot_product((prm%rho0+prm%rhoDip0),plastic_disloUCLA_interactionMatrix_SlipSlip(i,1:ns,instance))) tempState(5_pInt*ns+1:6_pInt*ns) = tauSlipThreshold0 From 252f1a6a7531679f49d45337feb1e63920ce8956 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Nov 2018 08:32:15 +0100 Subject: [PATCH 024/147] invlabmdaslip does not need to be stored --- src/plastic_disloUCLA.f90 | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index dd46c0ca9..4e3f48e6c 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -115,14 +115,12 @@ module plastic_disloUCLA rhoEdge, & rhoEdgeDip, & accshear_slip, & - invLambdaSlip, & mfp_slip, & threshold_stress_slip end type type, private :: tDisloUCLAMicrostructure real(pReal), allocatable, dimension(:,:) :: & - invLambda, & mfp, & threshold_stress end type tDisloUCLAMicrostructure @@ -516,8 +514,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * ns sizeDeltaState = 0_pInt sizeState = sizeDotState & - + int(size(['invLambdaSlip ',& - 'meanFreePathSlip ','tauSlipThreshold ']),pInt) * ns + + int(size(['meanFreePathSlip ','tauSlipThreshold ']),pInt) * ns call material_allocatePlasticState(phase,NofMyPhase,sizeState,sizeDotState,0_pInt, & ns,0_pInt,0_pInt) @@ -579,10 +576,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp dotState(instance)%accshear_slip=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal - startIndex=endIndex+1_pInt - endIndex=endIndex+ns - stt%invLambdaSlip=>plasticState(phase)%state(startIndex:endIndex,:) - startIndex=endIndex+1_pInt endIndex=endIndex+ns stt%mfp_slip=>plasticState(phase)%state(startIndex:endIndex,:) @@ -591,7 +584,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp endIndex=endIndex+ns stt%threshold_stress_slip=>plasticState(phase)%state(startIndex:endIndex,:) - allocate(mse%invLambda(prm%totalNslip,NofMyPhase),source=0.0_pReal) allocate(mse%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) allocate(mse%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) @@ -615,7 +607,8 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) lattice_maxNslipFamily, & lattice_mu use material, only: & - plasticState + plasticState, & + material_phase implicit none integer(pInt), intent(in) :: & @@ -641,19 +634,18 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) forall (i = 1_pInt:ns) & invLambdaSlip0(i) = sqrt(dot_product((prm%rho0+prm%rhoDip0),plastic_disloUCLA_forestProjectionEdge(1:ns,i,instance)))/ & plastic_disloUCLA_CLambdaSlipPerSlipSystem(i,instance) - tempState(3_pInt*ns+1:4_pInt*ns) = invLambdaSlip0 forall (i = 1_pInt:ns) & MeanFreePathSlip0(i) = & plastic_disloUCLA_GrainSize(instance)/(1.0_pReal+invLambdaSlip0(i)*plastic_disloUCLA_GrainSize(instance)) - tempState(4_pInt*ns+1:5_pInt*ns) = MeanFreePathSlip0 + tempState(3_pInt*ns+1:4_pInt*ns) = MeanFreePathSlip0 forall (i = 1_pInt:ns) & tauSlipThreshold0(i) = & lattice_mu(ph)*prm%burgers(i) * & sqrt(dot_product((prm%rho0+prm%rhoDip0),plastic_disloUCLA_interactionMatrix_SlipSlip(i,1:ns,instance))) - tempState(5_pInt*ns+1:6_pInt*ns) = tauSlipThreshold0 + tempState(4_pInt*ns+1:5_pInt*ns) = tauSlipThreshold0 plasticState(ph)%state = spread(tempState,2,size(plasticState(ph)%state(1,:))) end associate @@ -668,7 +660,8 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) pi use material, only: & phase_plasticityInstance, & - phaseAt, phasememberAt + phaseAt, phasememberAt, & + material_phase use lattice, only: & lattice_mu @@ -685,7 +678,8 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) ns,s, & ph, & of - + real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + invLambdaSlip !* Shortened notation of = phasememberAt(ipc,ip,el) ph = phaseAt(ipc,ip,el) @@ -694,7 +688,7 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) associate(prm => param(instance), stt => state(instance)) !* 1/mean free distance between 2 forest dislocations seen by a moving dislocation forall (s = 1_pInt:ns) & - stt%invLambdaSlip(s,of) = & + invLambdaSlip(s) = & sqrt(dot_product((stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of)),& plastic_disloUCLA_forestProjectionEdge(1:ns,s,instance)))/ & plastic_disloUCLA_CLambdaSlipPerSlipSystem(s,instance) @@ -703,7 +697,7 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) do s = 1_pInt,ns stt%mfp_slip(s,of) = & plastic_disloUCLA_GrainSize(instance)/& - (1.0_pReal+plastic_disloUCLA_GrainSize(instance)*(stt%invLambdaSlip(s,of))) + (1.0_pReal+plastic_disloUCLA_GrainSize(instance)*(invLambdaSlip(s))) enddo !* threshold stress for dislocation motion From 28ec50a6a9f37d2f6d5b45666ba4a5c25a18f07d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Nov 2018 08:44:31 +0100 Subject: [PATCH 025/147] simpler reading in --- src/plastic_disloUCLA.f90 | 48 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 4e3f48e6c..7752a33ef 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -39,7 +39,6 @@ module plastic_disloUCLA plastic_disloUCLA_CAtomicVolume, & !< atomic volume in Bugers vector unit plastic_disloUCLA_D0, & !< prefactor for self-diffusion coefficient plastic_disloUCLA_Qsd, & !< activation energy for dislocation climb - plastic_disloUCLA_GrainSize, & !< grain size plastic_disloUCLA_CEdgeDipMinDistance, & !< plastic_disloUCLA_SolidSolutionStrength, & !< Strength due to elements in solid solution plastic_disloUCLA_dipoleFormationFactor !< scaling factor for dipole formation: 0: off, 1: on. other values not useful @@ -47,7 +46,6 @@ module plastic_disloUCLA real(pReal), dimension(:,:), allocatable, private :: & plastic_disloUCLA_v0PerSlipFamily, & !< dislocation velocity prefactor [m/s] for each family and instance plastic_disloUCLA_v0PerSlipSystem, & !< dislocation velocity prefactor [m/s] for each slip system and instance - plastic_disloUCLA_tau_peierlsPerSlipFamily, & !< Peierls stress [Pa] for each family and instance plastic_disloUCLA_CLambdaSlipPerSlipFamily, & !< Adj. parameter for distance between 2 forest dislocations for each slip family and instance plastic_disloUCLA_CLambdaSlipPerSlipSystem, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance plastic_disloUCLA_interaction_SlipSlip, & !< coefficients for slip-slip interaction for each interaction type and instance @@ -73,7 +71,8 @@ module plastic_disloUCLA type, private :: tParameters real(pReal) :: & - aTolRho + aTolRho, & + grainSize real(pReal), allocatable, dimension(:) :: & rho0, & !< initial edge dislocation density per slip system for each family and instance rhoDip0, & !< initial edge dipole density per slip system for each family and instance @@ -89,7 +88,7 @@ module plastic_disloUCLA omega, & !< attempt frequency for kink pair nucleation viscosity, & !< friction coeff. B (kMC) !* - tauPeierls, & + tau_Peierls, & nonSchmidCoeff real(pReal), allocatable, dimension(:,:) :: & interaction_SlipSlip !< slip resistance from slip activity @@ -237,14 +236,11 @@ material_allocatePlasticState allocate(plastic_disloUCLA_CAtomicVolume(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_D0(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_Qsd(maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_GrainSize(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_SolidSolutionStrength(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default allocate(plastic_disloUCLA_friction(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_v0PerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_tau_peierlsPerSlipFamily(lattice_maxNslipFamily,maxNinstance), & - source=0.0_pReal) allocate(plastic_disloUCLA_CLambdaSlipPerSlipFamily(lattice_maxNslipFamily,maxNinstance), & source=0.0_pReal) @@ -292,7 +288,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%H0kp = config_phase(p)%getFloats('qedge') !prm%v0 = config_phase(p)%getFloats('v0') !prm%clambda = config_phase(p)%getFloats('clambda') - !prm%tauPeierls = config_phase(p)%getFloats('peierls_stress') + prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls') prm%p = config_phase(p)%getFloats('p_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) prm%q = config_phase(p)%getFloats('q_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) prm%kink_height = config_phase(p)%getFloats('kink_height') @@ -301,6 +297,9 @@ do p = 1_pInt, size(phase_plasticityInstance) !prm%viscosity = config_phase(p)%getFloats('viscosity') + prm%grainSize = config_phase(p)%getFloat('grainsize') + + ! expand: family => system prm%rho0 = math_expand(prm%rho0, prm%Nslip) prm%rhoDip0 = math_expand(prm%rhoDip0, prm%Nslip) @@ -311,6 +310,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%kink_height = math_expand(prm%kink_height, prm%Nslip) prm%kink_width = math_expand(prm%kink_width, prm%Nslip) prm%omega = math_expand(prm%omega, prm%Nslip) + prm%tau_Peierls = math_expand(prm%tau_Peierls, prm%Nslip) endif slipActive @@ -414,10 +414,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp plastic_disloUCLA_v0PerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('clambdaslip') plastic_disloUCLA_CLambdaSlipPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - case ('tau_peierls') - if (lattice_structure(phase) /= LATTICE_bcc_ID) & - call IO_warning(42_pInt,ext_msg=trim(tag)//' for non-bcc ('//PLASTICITY_DISLOUCLA_label//')') - plastic_disloUCLA_tau_peierlsPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('friction_coeff') plastic_disloUCLA_friction(1:Nchunks_SlipFamilies,instance) = & tempPerSlip(1:Nchunks_SlipFamilies) @@ -433,8 +429,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp enddo !-------------------------------------------------------------------------------------------------- ! parameters independent of number of slip systems - case ('grainsize') - plastic_disloUCLA_GrainSize(instance) = IO_floatValue(line,chunkPos,2_pInt) case ('d0') plastic_disloUCLA_D0(instance) = IO_floatValue(line,chunkPos,2_pInt) case ('qsd') @@ -466,8 +460,8 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! call IO_error(211_pInt,el=instance,ext_msg='slipBurgers ('//PLASTICITY_DISLOUCLA_label//')') if (plastic_disloUCLA_v0PerSlipFamily(f,instance) <= 0.0_pReal) & call IO_error(211_pInt,el=instance,ext_msg='v0 ('//PLASTICITY_DISLOUCLA_label//')') - if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') + !if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') endif enddo if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & @@ -637,7 +631,7 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) forall (i = 1_pInt:ns) & MeanFreePathSlip0(i) = & - plastic_disloUCLA_GrainSize(instance)/(1.0_pReal+invLambdaSlip0(i)*plastic_disloUCLA_GrainSize(instance)) + prm%grainSize/(1.0_pReal+invLambdaSlip0(i)*prm%grainSize) tempState(3_pInt*ns+1:4_pInt*ns) = MeanFreePathSlip0 forall (i = 1_pInt:ns) & @@ -685,6 +679,8 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) ph = phaseAt(ipc,ip,el) instance = phase_plasticityInstance(ph) ns = plastic_disloUCLA_totalNslip(instance) + + associate(prm => param(instance), stt => state(instance)) !* 1/mean free distance between 2 forest dislocations seen by a moving dislocation forall (s = 1_pInt:ns) & @@ -696,8 +692,8 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) !* mean free path between 2 obstacles seen by a moving dislocation do s = 1_pInt,ns stt%mfp_slip(s,of) = & - plastic_disloUCLA_GrainSize(instance)/& - (1.0_pReal+plastic_disloUCLA_GrainSize(instance)*(invLambdaSlip(s))) + prm%grainSize/& + (1.0_pReal+prm%grainSize*(invLambdaSlip(s))) enddo !* threshold stress for dislocation motion @@ -707,6 +703,8 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) sqrt(dot_product((stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of)),& plastic_disloUCLA_interactionMatrix_SlipSlip(s,1:ns,instance))) end associate + + end subroutine plastic_disloUCLA_microstructure @@ -1080,7 +1078,7 @@ ph, instance,of !* Stress ratio stressRatio = ((abs(tau_slip_pos(j))-stt%threshold_stress_slip(j, of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& - plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) + prm%tau_Peierls(j))) stressRatio_p = stressRatio** prm%p(j) stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) !* Shear rates due to slip @@ -1111,7 +1109,7 @@ ph, instance,of * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& + (plastic_disloUCLA_SolidSolutionStrength(instance)+prm%tau_Peierls(j))*& StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & @@ -1127,7 +1125,7 @@ ph, instance,of * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& + (plastic_disloUCLA_SolidSolutionStrength(instance)+prm%tau_Peierls(j))*& StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& !deltaf(f) ) & ) & @@ -1147,7 +1145,7 @@ ph, instance,of !* Stress ratios stressRatio = ((abs(tau_slip_neg(j))-stt%threshold_stress_slip(j, of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& - plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))) + prm%tau_Peierls(j))) stressRatio_p = stressRatio** prm%p(j) stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) !* Shear rates due to slip @@ -1177,7 +1175,7 @@ ph, instance,of * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& + (plastic_disloUCLA_SolidSolutionStrength(instance)+prm%tau_Peierls(j))*& StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & @@ -1193,7 +1191,7 @@ ph, instance,of * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance))*& + (plastic_disloUCLA_SolidSolutionStrength(instance)+prm%tau_Peierls(j))*& StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& !deltaf(f) ) & ) & From 64e9c7fb7705c4110f39daf569e30ed997bf2b32 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Nov 2018 08:56:57 +0100 Subject: [PATCH 026/147] mean free path and threshold stres don't have to be part of the state --- src/plastic_disloUCLA.f90 | 80 ++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 7752a33ef..f80457392 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -113,9 +113,7 @@ module plastic_disloUCLA real(pReal), pointer, dimension(:,:) :: & rhoEdge, & rhoEdgeDip, & - accshear_slip, & - mfp_slip, & - threshold_stress_slip + accshear_slip end type type, private :: tDisloUCLAMicrostructure @@ -507,8 +505,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * ns sizeDeltaState = 0_pInt - sizeState = sizeDotState & - + int(size(['meanFreePathSlip ','tauSlipThreshold ']),pInt) * ns + sizeState = sizeDotState call material_allocatePlasticState(phase,NofMyPhase,sizeState,sizeDotState,0_pInt, & ns,0_pInt,0_pInt) @@ -555,12 +552,14 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp startIndex=1_pInt endIndex=ns stt%rhoEdge=>plasticState(phase)%state(startIndex:endIndex,:) + stt%rhoEdge= spread(prm%rho0,2,NofMyPhase) dotState(instance)%rhoEdge=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho startIndex=endIndex+1_pInt endIndex=endIndex+ns stt%rhoEdgeDip=>plasticState(phase)%state(startIndex:endIndex,:) + stt%rhoEdgeDip= spread(prm%rhoDip0,2,NofMyPhase) dotState(instance)%rhoEdgeDip=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho @@ -570,13 +569,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp dotState(instance)%accshear_slip=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal - startIndex=endIndex+1_pInt - endIndex=endIndex+ns - stt%mfp_slip=>plasticState(phase)%state(startIndex:endIndex,:) - - startIndex=endIndex+1_pInt - endIndex=endIndex+ns - stt%threshold_stress_slip=>plasticState(phase)%state(startIndex:endIndex,:) allocate(mse%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) allocate(mse%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) @@ -618,7 +610,7 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) tauSlipThreshold0 tempState = 0.0_pReal ns = plastic_disloUCLA_totalNslip(instance) - associate(prm => param(instance)) + associate(prm => param(instance),mse => microstructure(instance)) tempState(1_pInt:ns) = prm%rho0 tempState(ns+1_pInt:2_pInt*ns) = prm%rhoDip0 @@ -632,16 +624,16 @@ subroutine plastic_disloUCLA_stateInit(ph,instance) forall (i = 1_pInt:ns) & MeanFreePathSlip0(i) = & prm%grainSize/(1.0_pReal+invLambdaSlip0(i)*prm%grainSize) - tempState(3_pInt*ns+1:4_pInt*ns) = MeanFreePathSlip0 + + mse%mfp= spread(MeanFreePathSlip0,2,size(plasticState(ph)%state(1,:))) forall (i = 1_pInt:ns) & tauSlipThreshold0(i) = & lattice_mu(ph)*prm%burgers(i) * & sqrt(dot_product((prm%rho0+prm%rhoDip0),plastic_disloUCLA_interactionMatrix_SlipSlip(i,1:ns,instance))) - tempState(4_pInt*ns+1:5_pInt*ns) = tauSlipThreshold0 + mse%threshold_stress= spread(tauSlipThreshold0,2,size(plasticState(ph)%state(1,:))) -plasticState(ph)%state = spread(tempState,2,size(plasticState(ph)%state(1,:))) end associate end subroutine plastic_disloUCLA_stateInit @@ -681,7 +673,7 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) ns = plastic_disloUCLA_totalNslip(instance) - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) !* 1/mean free distance between 2 forest dislocations seen by a moving dislocation forall (s = 1_pInt:ns) & invLambdaSlip(s) = & @@ -691,14 +683,14 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) !* mean free path between 2 obstacles seen by a moving dislocation do s = 1_pInt,ns - stt%mfp_slip(s,of) = & + mse%mfp(s,of) = & prm%grainSize/& (1.0_pReal+prm%grainSize*(invLambdaSlip(s))) enddo - + !* threshold stress for dislocation motion forall (s = 1_pInt:ns) & - stt%threshold_stress_slip(s,of) = & + mse%threshold_stress(s,of) = & lattice_mu(ph)*prm%burgers(s)*& sqrt(dot_product((stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of)),& plastic_disloUCLA_interactionMatrix_SlipSlip(s,1:ns,instance))) @@ -811,7 +803,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) ns = plastic_disloUCLA_totalNslip(instance) plasticState(ph)%dotState(:,of) = 0.0_pReal - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) !* Dislocation density evolution call kinetics(Mp,Temperature,ph,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) @@ -826,7 +818,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) !* Multiplication DotRhoMultiplication = abs(dotState(instance)%accshear_slip(j,of))/& (prm%burgers(j)* & - stt%mfp_slip(j,of)) + mse%mfp(j,of)) !* Dipole formation EdgeDipMinDistance = & @@ -837,7 +829,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) EdgeDipDistance = & (3.0_pReal*lattice_mu(ph)*prm%burgers(j))/& (16.0_pReal*pi*abs(tau_slip_pos(j))) - if (EdgeDipDistance>stt%mfp_slip(j,of)) EdgeDipDistance=stt%mfp_slip(j,of) + if (EdgeDipDistance>mse%mfp(j,of)) EdgeDipDistance=mse%mfp(j,of) if (EdgeDipDistance param(instance),stt =>state(instance)) + associate (prm => param(instance),stt =>state(instance),mse => microstructure(instance)) do o = 1_pInt,plastic_disloUCLA_Noutput(instance) select case(plastic_disloUCLA_outputID(o,instance)) @@ -973,7 +965,7 @@ math_mul33xx33 c = c + ns case (mfp_ID) postResults(c+1_pInt:c+ns) =& - stt%mfp_slip(1_pInt:ns, of) + mse%mfp(1_pInt:ns, of) c = c + ns case (resolvedstress_ID) j = 0_pInt @@ -987,7 +979,7 @@ math_mul33xx33 c = c + ns case (thresholdstress_ID) postResults(c+1_pInt:c+ns) = & - stt%threshold_stress_slip(1_pInt:ns,of) + mse%threshold_stress(1_pInt:ns,of) c = c + ns case (dipoleDistance_ID) j = 0_pInt @@ -1003,7 +995,7 @@ math_mul33xx33 postResults(c+j) = huge(1.0_pReal) endif postResults(c+j)=min(postResults(c+j),& - stt%mfp_slip(j,of)) + mse%mfp(j,of)) enddo slipSystems2; enddo slipFamilies2 c = c + ns end select @@ -1050,7 +1042,7 @@ ph, instance,of dvel_slip, vel_slip real(pReal), intent(out), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) !* Shortened notation ns = plastic_disloUCLA_totalNslip(instance) @@ -1074,9 +1066,9 @@ ph, instance,of tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) - significantPositiveTau: if((abs(tau_slip_pos(j))-stt%threshold_stress_slip(j, of)) > tol_math_check) then + significantPositiveTau: if((abs(tau_slip_pos(j))-mse%threshold_stress(j, of)) > tol_math_check) then !* Stress ratio - stressRatio = ((abs(tau_slip_pos(j))-stt%threshold_stress_slip(j, of))/& + stressRatio = ((abs(tau_slip_pos(j))-mse%threshold_stress(j, of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& prm%tau_Peierls(j))) stressRatio_p = stressRatio** prm%p(j) @@ -1084,13 +1076,13 @@ ph, instance,of !* Shear rates due to slip vel_slip = 2.0_pReal*prm%burgers(j) & * prm%kink_height(j) * prm%omega(j) & - * ( stt%mfp_slip(j,of) - prm%kink_width(j) ) & + * ( mse%mfp(j,of) - prm%kink_width(j) ) & * (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) @@ -1102,7 +1094,7 @@ ph, instance,of dvel_slip = & 2.0_pReal*prm%burgers(j) & * prm%kink_height(j) * prm%omega(j) & - * ( stt%mfp_slip(j,of) - prm%kink_width(j) ) & + * ( mse%mfp(j,of) - prm%kink_width(j) ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_pos(j) & @@ -1114,14 +1106,14 @@ ph, instance,of ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& @@ -1133,7 +1125,7 @@ ph, instance,of ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & ) @@ -1141,9 +1133,9 @@ ph, instance,of dgdot_dtauslip_pos(j) = DotGamma0 * dvel_slip endif significantPositiveTau - significantNegativeTau: if((abs(tau_slip_neg(j))-stt%threshold_stress_slip(j, of)) > tol_math_check) then + significantNegativeTau: if((abs(tau_slip_neg(j))-mse%threshold_stress(j, of)) > tol_math_check) then !* Stress ratios - stressRatio = ((abs(tau_slip_neg(j))-stt%threshold_stress_slip(j, of))/& + stressRatio = ((abs(tau_slip_neg(j))-mse%threshold_stress(j, of))/& (plastic_disloUCLA_SolidSolutionStrength(instance)+& prm%tau_Peierls(j))) stressRatio_p = stressRatio** prm%p(j) @@ -1151,13 +1143,13 @@ ph, instance,of !* Shear rates due to slip vel_slip = 2.0_pReal*prm%burgers(j) & * prm%kink_height(j) * prm%omega(j) & - * ( stt%mfp_slip(j,of) - prm%kink_width(j) ) & + * ( mse%mfp(j,of) - prm%kink_width(j) ) & * (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) @@ -1168,7 +1160,7 @@ ph, instance,of dvel_slip = & 2.0_pReal*prm%burgers(j) & * prm%kink_height(j) * prm%omega(j) & - * ( stt%mfp_slip(j,of) - prm%kink_width(j) ) & + * ( mse%mfp(j,of) - prm%kink_width(j) ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_neg(j) & @@ -1180,14 +1172,14 @@ ph, instance,of ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& @@ -1199,7 +1191,7 @@ ph, instance,of ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & - *(( stt%mfp_slip(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & ) From bbddb2558c6d09767be9a493f96adb437720d81b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Nov 2018 09:21:58 +0100 Subject: [PATCH 027/147] cleaning --- src/plastic_disloUCLA.f90 | 71 +++------------------------------------ 1 file changed, 5 insertions(+), 66 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index f80457392..7726b9291 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -136,7 +136,7 @@ module plastic_disloUCLA plastic_disloUCLA_dotState, & plastic_disloUCLA_postResults private :: & - plastic_disloUCLA_stateInit + kinetics contains @@ -192,7 +192,7 @@ material_allocatePlasticState integer(pInt), intent(in) :: fileUnit integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,mySize=0_pInt,phase,maxTotalNslip,& + integer(pInt) :: maxNinstance,phase,maxTotalNslip,& f,instance,j,k,o,ns, i, & Nchunks_SlipSlip = 0_pInt, outputSize, & Nchunks_SlipFamilies = 0_pInt,Nchunks_nonSchmid = 0_pInt, & @@ -573,7 +573,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp allocate(mse%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) allocate(mse%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) - call plastic_disloUCLA_stateInit(phase,instance) + !call plastic_disloUCLA_stateInit(phase,instance) plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally end associate @@ -583,60 +583,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp end subroutine plastic_disloUCLA_init -!-------------------------------------------------------------------------------------------------- -!> @brief sets the relevant state values for a given instance of this plasticity -!-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_stateInit(ph,instance) - use math, only: & - pi - use lattice, only: & - lattice_maxNslipFamily, & - lattice_mu - use material, only: & - plasticState, & - material_phase - - implicit none - integer(pInt), intent(in) :: & - instance, & !< number specifying the instance of the plasticity - ph - - real(pReal), dimension(plasticState(ph)%sizeState) :: tempState - - integer(pInt) :: i,f,ns, index_myFamily - real(pReal), dimension(plastic_disloUCLA_totalNslip(instance)) :: & - invLambdaSlip0, & - MeanFreePathSlip0, & - tauSlipThreshold0 - tempState = 0.0_pReal - ns = plastic_disloUCLA_totalNslip(instance) - associate(prm => param(instance),mse => microstructure(instance)) - - tempState(1_pInt:ns) = prm%rho0 - tempState(ns+1_pInt:2_pInt*ns) = prm%rhoDip0 - -!-------------------------------------------------------------------------------------------------- -! initialize dependent slip microstructural variables - forall (i = 1_pInt:ns) & - invLambdaSlip0(i) = sqrt(dot_product((prm%rho0+prm%rhoDip0),plastic_disloUCLA_forestProjectionEdge(1:ns,i,instance)))/ & - plastic_disloUCLA_CLambdaSlipPerSlipSystem(i,instance) - - forall (i = 1_pInt:ns) & - MeanFreePathSlip0(i) = & - prm%grainSize/(1.0_pReal+invLambdaSlip0(i)*prm%grainSize) - - mse%mfp= spread(MeanFreePathSlip0,2,size(plasticState(ph)%state(1,:))) - - forall (i = 1_pInt:ns) & - tauSlipThreshold0(i) = & - lattice_mu(ph)*prm%burgers(i) * & - sqrt(dot_product((prm%rho0+prm%rhoDip0),plastic_disloUCLA_interactionMatrix_SlipSlip(i,1:ns,instance))) - - mse%threshold_stress= spread(tauSlipThreshold0,2,size(plasticState(ph)%state(1,:))) - -end associate -end subroutine plastic_disloUCLA_stateInit - !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state @@ -1015,16 +961,9 @@ subroutine kinetics(Mp,Temperature,ph,instance,of, & use math, only: & pi, & math_mul33xx33 - use material, only: & - material_phase, & - phase_plasticityInstance,& - !plasticState, & - phaseAt, phasememberAt use lattice, only: & - lattice_Sslip, & lattice_maxNslipFamily, & - lattice_NslipSystem, & - lattice_NnonSchmid + lattice_NslipSystem implicit none real(pReal), dimension(3,3), intent(in) :: & @@ -1036,7 +975,7 @@ ph, instance,of integer(pInt) :: & ns,& - f,i,j,k,index_myFamily + f,i,j,index_myFamily real(pReal) :: StressRatio_p,StressRatio_pminus1,& BoltzmannRatio,DotGamma0,stressRatio,& dvel_slip, vel_slip From 39c1df75426e8bfa4c83b7366a1c8bea7fb18e0b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Nov 2018 10:31:02 +0100 Subject: [PATCH 028/147] further simplifications --- src/plastic_disloUCLA.f90 | 106 ++++++++++---------------------------- 1 file changed, 28 insertions(+), 78 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 7726b9291..2050cf5b7 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -40,20 +40,15 @@ module plastic_disloUCLA plastic_disloUCLA_D0, & !< prefactor for self-diffusion coefficient plastic_disloUCLA_Qsd, & !< activation energy for dislocation climb plastic_disloUCLA_CEdgeDipMinDistance, & !< - plastic_disloUCLA_SolidSolutionStrength, & !< Strength due to elements in solid solution plastic_disloUCLA_dipoleFormationFactor !< scaling factor for dipole formation: 0: off, 1: on. other values not useful real(pReal), dimension(:,:), allocatable, private :: & - plastic_disloUCLA_v0PerSlipFamily, & !< dislocation velocity prefactor [m/s] for each family and instance - plastic_disloUCLA_v0PerSlipSystem, & !< dislocation velocity prefactor [m/s] for each slip system and instance plastic_disloUCLA_CLambdaSlipPerSlipFamily, & !< Adj. parameter for distance between 2 forest dislocations for each slip family and instance plastic_disloUCLA_CLambdaSlipPerSlipSystem, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance - plastic_disloUCLA_interaction_SlipSlip, & !< coefficients for slip-slip interaction for each interaction type and instance !* mobility law parameters plastic_disloUCLA_friction !< friction coeff. B (kMC) real(pReal), dimension(:,:,:), allocatable, private :: & - plastic_disloUCLA_interactionMatrix_SlipSlip, & !< interaction matrix of the different slip systems for each instance plastic_disloUCLA_forestProjectionEdge !< matrix of forest projections of edge dislocations for each instance enum, bind(c) @@ -72,7 +67,8 @@ module plastic_disloUCLA type, private :: tParameters real(pReal) :: & aTolRho, & - grainSize + grainSize, & +SolidSolutionStrength !< Strength due to elements in solid solution real(pReal), allocatable, dimension(:) :: & rho0, & !< initial edge dislocation density per slip system for each family and instance rhoDip0, & !< initial edge dipole density per slip system for each family and instance @@ -198,7 +194,7 @@ material_allocatePlasticState Nchunks_SlipFamilies = 0_pInt,Nchunks_nonSchmid = 0_pInt, & offset_slip, index_myFamily, index_otherFamily, & startIndex, endIndex, p - integer(pInt) :: sizeState, sizeDotState, sizeDeltaState + integer(pInt) :: sizeState, sizeDotState integer(pInt) :: NofMyPhase character(len=65536) :: & structure = '',& @@ -235,16 +231,12 @@ material_allocatePlasticState allocate(plastic_disloUCLA_D0(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_Qsd(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_SolidSolutionStrength(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default allocate(plastic_disloUCLA_friction(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_v0PerSlipFamily(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CLambdaSlipPerSlipFamily(lattice_maxNslipFamily,maxNinstance), & source=0.0_pReal) - allocate(plastic_disloUCLA_interaction_SlipSlip(lattice_maxNinteraction,maxNinstance),source=0.0_pReal) - allocate(param(maxNinstance)) allocate(state(maxNinstance)) @@ -284,7 +276,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%rhoDip0 = config_phase(p)%getFloats('rhoedgedip0') prm%burgers = config_phase(p)%getFloats('slipburgers') prm%H0kp = config_phase(p)%getFloats('qedge') - !prm%v0 = config_phase(p)%getFloats('v0') + prm%v0 = config_phase(p)%getFloats('v0') !prm%clambda = config_phase(p)%getFloats('clambda') prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls') prm%p = config_phase(p)%getFloats('p_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) @@ -295,8 +287,15 @@ do p = 1_pInt, size(phase_plasticityInstance) !prm%viscosity = config_phase(p)%getFloats('viscosity') + prm%SolidSolutionStrength = config_phase(p)%getFloat('solidsolutionstrength') + prm%grainSize = config_phase(p)%getFloat('grainsize') + plastic_disloUCLA_D0(phase_plasticityInstance(p)) = config_phase(p)%getFloat('qsd') + plastic_disloUCLA_Qsd(phase_plasticityInstance(p)) = config_phase(p)%getFloat('qsd') + plastic_disloUCLA_CEdgeDipMinDistance(phase_plasticityInstance(p)) = config_phase(p)%getFloat('cedgedipmindistance') + plastic_disloUCLA_CAtomicVolume(phase_plasticityInstance(p)) = config_phase(p)%getFloat('catomicvolume') + plastic_disloUCLA_dipoleFormationFactor(phase_plasticityInstance(p)) = config_phase(p)%getFloat('dipoleformationfactor') ! expand: family => system prm%rho0 = math_expand(prm%rho0, prm%Nslip) @@ -309,6 +308,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%kink_width = math_expand(prm%kink_width, prm%Nslip) prm%omega = math_expand(prm%omega, prm%Nslip) prm%tau_Peierls = math_expand(prm%tau_Peierls, prm%Nslip) + prm%v0 = math_expand(prm%v0, prm%Nslip) endif slipActive @@ -379,7 +379,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp phase = phase + 1_pInt ! advance phase section counter if (phase_plasticity(phase) == PLASTICITY_DISLOUCLA_ID) then Nchunks_SlipFamilies = count(lattice_NslipSystem(:,phase) > 0_pInt) - Nchunks_SlipSlip = maxval(lattice_interactionSlipSlip(:,:,phase)) Nchunks_nonSchmid = lattice_NnonSchmid(phase) if(allocated(tempPerSlip)) deallocate(tempPerSlip) allocate(tempPerSlip(Nchunks_SlipFamilies)) @@ -402,43 +401,17 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp do j = 1_pInt, Nchunks_SlipFamilies plastic_disloUCLA_Nslip(j,instance) = IO_intValue(line,chunkPos,1_pInt+j) enddo - case ('rhoedge0','rhoedgedip0','slipburgers','qedge','v0','clambdaslip','tau_peierls','p_slip','q_slip',& - 'kink_height','omega','kink_width','dislolength','friction_coeff') + case ('clambdaslip','friction_coeff') do j = 1_pInt, Nchunks_SlipFamilies tempPerSlip(j) = IO_floatValue(line,chunkPos,1_pInt+j) enddo select case(tag) - case ('v0') - plastic_disloUCLA_v0PerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('clambdaslip') plastic_disloUCLA_CLambdaSlipPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) case ('friction_coeff') plastic_disloUCLA_friction(1:Nchunks_SlipFamilies,instance) = & tempPerSlip(1:Nchunks_SlipFamilies) end select - -!-------------------------------------------------------------------------------------------------- -! parameters depending on number of interactions - case ('interaction_slipslip','interactionslipslip') - if (chunkPos(1) < 1_pInt + Nchunks_SlipSlip) & - call IO_warning(52_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_DISLOUCLA_label//')') - do j = 1_pInt, Nchunks_SlipSlip - plastic_disloUCLA_interaction_SlipSlip(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j) - enddo -!-------------------------------------------------------------------------------------------------- -! parameters independent of number of slip systems - case ('d0') - plastic_disloUCLA_D0(instance) = IO_floatValue(line,chunkPos,2_pInt) - case ('qsd') - plastic_disloUCLA_Qsd(instance) = IO_floatValue(line,chunkPos,2_pInt) - case ('solidsolutionstrength') - plastic_disloUCLA_SolidSolutionStrength(instance) = IO_floatValue(line,chunkPos,2_pInt) - case ('cedgedipmindistance') - plastic_disloUCLA_CEdgeDipMinDistance(instance) = IO_floatValue(line,chunkPos,2_pInt) - case ('catomicvolume') - plastic_disloUCLA_CAtomicVolume(instance) = IO_floatValue(line,chunkPos,2_pInt) - case ('dipoleformationfactor') - plastic_disloUCLA_dipoleFormationFactor(instance) = IO_floatValue(line,chunkPos,2_pInt) end select endif; endif enddo parsingFile @@ -456,8 +429,8 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdgeDip0 ('//PLASTICITY_DISLOUCLA_label//')') !if (plastic_disloUCLA_burgersPerSlipFamily(f,instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='slipBurgers ('//PLASTICITY_DISLOUCLA_label//')') - if (plastic_disloUCLA_v0PerSlipFamily(f,instance) <= 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='v0 ('//PLASTICITY_DISLOUCLA_label//')') + !if (plastic_disloUCLA_v0PerSlipFamily(f,instance) <= 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='v0 ('//PLASTICITY_DISLOUCLA_label//')') !if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') endif @@ -482,12 +455,8 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! allocation of variables whose size depends on the total number of active slip systems maxTotalNslip = maxval(plastic_disloUCLA_totalNslip) - allocate(plastic_disloUCLA_v0PerSlipSystem(maxTotalNslip, maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CLambdaSlipPerSlipSystem(maxTotalNslip, maxNinstance),source=0.0_pReal) - allocate(plastic_disloUCLA_interactionMatrix_SlipSlip(maxval(plastic_disloUCLA_totalNslip),& ! slip resistance from slip activity - maxval(plastic_disloUCLA_totalNslip),& - maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_forestProjectionEdge(maxTotalNslip,maxTotalNslip,maxNinstance), & source=0.0_pReal) @@ -504,7 +473,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! allocate state arrays sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * ns - sizeDeltaState = 0_pInt sizeState = sizeDotState call material_allocatePlasticState(phase,NofMyPhase,sizeState,sizeDotState,0_pInt, & @@ -523,27 +491,17 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp index_myFamily = sum(plastic_disloUCLA_Nslip(1:f-1_pInt,instance)) ! index in truncated slip system list mySlipSystems: do j = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - - - plastic_disloUCLA_v0PerSlipSystem(index_myFamily+j,instance) = & - plastic_disloUCLA_v0PerSlipFamily(f,instance) plastic_disloUCLA_CLambdaSlipPerSlipSystem(index_myFamily+j,instance) = & plastic_disloUCLA_CLambdaSlipPerSlipFamily(f,instance) !* Calculation of forest projections for edge dislocations - !* Interaction matrices otherSlipFamilies: do o = 1_pInt,lattice_maxNslipFamily index_otherFamily = sum(plastic_disloUCLA_Nslip(1:o-1_pInt,instance)) otherSlipSystems: do k = 1_pInt,plastic_disloUCLA_Nslip(o,instance) plastic_disloUCLA_forestProjectionEdge(index_myFamily+j,index_otherFamily+k,instance) = & abs(math_mul3x3(lattice_sn(:,sum(lattice_NslipSystem(1:f-1,phase))+j,phase), & lattice_st(:,sum(lattice_NslipSystem(1:o-1,phase))+k,phase))) - plastic_disloUCLA_interactionMatrix_SlipSlip(index_myFamily+j,index_otherFamily+k,instance) = & - plastic_disloUCLA_interaction_SlipSlip(lattice_interactionSlipSlip( & - sum(lattice_NslipSystem(1:f-1,phase))+j, & - sum(lattice_NslipSystem(1:o-1,phase))+k, & - phase), instance ) enddo otherSlipSystems; enddo otherSlipFamilies enddo mySlipSystems @@ -573,7 +531,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp allocate(mse%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) allocate(mse%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) - !call plastic_disloUCLA_stateInit(phase,instance) plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally end associate @@ -628,18 +585,15 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) plastic_disloUCLA_CLambdaSlipPerSlipSystem(s,instance) !* mean free path between 2 obstacles seen by a moving dislocation - do s = 1_pInt,ns - mse%mfp(s,of) = & - prm%grainSize/& - (1.0_pReal+prm%grainSize*(invLambdaSlip(s))) - enddo + + mse%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*invLambdaSlip) !* threshold stress for dislocation motion forall (s = 1_pInt:ns) & mse%threshold_stress(s,of) = & lattice_mu(ph)*prm%burgers(s)*& - sqrt(dot_product((stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of)),& - plastic_disloUCLA_interactionMatrix_SlipSlip(s,1:ns,instance))) + sqrt(dot_product(stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of),& + prm%interaction_SlipSlip(s,1:ns))) end associate @@ -910,8 +864,7 @@ math_mul33xx33 stt%accshear_slip(1_pInt:ns, of) c = c + ns case (mfp_ID) - postResults(c+1_pInt:c+ns) =& - mse%mfp(1_pInt:ns, of) + postResults(c+1_pInt:c+ns) = mse%mfp(1_pInt:ns, of) c = c + ns case (resolvedstress_ID) j = 0_pInt @@ -924,8 +877,7 @@ math_mul33xx33 enddo slipSystems1; enddo slipFamilies1 c = c + ns case (thresholdstress_ID) - postResults(c+1_pInt:c+ns) = & - mse%threshold_stress(1_pInt:ns,of) + postResults(c+1_pInt:c+ns) = mse%threshold_stress(1_pInt:ns,of) c = c + ns case (dipoleDistance_ID) j = 0_pInt @@ -998,9 +950,7 @@ ph, instance,of !* Boltzmann ratio BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) !* Initial shear rates - DotGamma0 = & - stt%rhoEdge(j,of)*prm%burgers(j)*& - plastic_disloUCLA_v0PerSlipSystem(j,instance) + DotGamma0 = stt%rhoEdge(j,of)*prm%burgers(j)*prm%v0(j) !* Resolved shear stress on slip system tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) @@ -1008,7 +958,7 @@ ph, instance,of significantPositiveTau: if((abs(tau_slip_pos(j))-mse%threshold_stress(j, of)) > tol_math_check) then !* Stress ratio stressRatio = ((abs(tau_slip_pos(j))-mse%threshold_stress(j, of))/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+& + (prm%solidSolutionStrength+& prm%tau_Peierls(j))) stressRatio_p = stressRatio** prm%p(j) stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) @@ -1040,7 +990,7 @@ ph, instance,of * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+prm%tau_Peierls(j))*& + (prm%solidSolutionStrength+prm%tau_Peierls(j))*& StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & @@ -1056,7 +1006,7 @@ ph, instance,of * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+prm%tau_Peierls(j))*& + (prm%solidSolutionStrength+prm%tau_Peierls(j))*& StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& !deltaf(f) ) & ) & @@ -1075,7 +1025,7 @@ ph, instance,of significantNegativeTau: if((abs(tau_slip_neg(j))-mse%threshold_stress(j, of)) > tol_math_check) then !* Stress ratios stressRatio = ((abs(tau_slip_neg(j))-mse%threshold_stress(j, of))/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+& + (prm%solidSolutionStrength+& prm%tau_Peierls(j))) stressRatio_p = stressRatio** prm%p(j) stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) @@ -1106,7 +1056,7 @@ ph, instance,of * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+prm%tau_Peierls(j))*& + (prm%solidSolutionStrength+prm%tau_Peierls(j))*& StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & @@ -1122,7 +1072,7 @@ ph, instance,of * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& *prm%q(j)/& - (plastic_disloUCLA_SolidSolutionStrength(instance)+prm%tau_Peierls(j))*& + (prm%solidSolutionStrength+prm%tau_Peierls(j))*& StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& !deltaf(f) ) & ) & From 0387486a5288fb5629532375cce014e9cd3023f1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 29 Nov 2018 10:37:06 +0100 Subject: [PATCH 029/147] same name as in dislotwin --- src/plastic_disloUCLA.f90 | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 2050cf5b7..9428d714a 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -44,9 +44,7 @@ module plastic_disloUCLA real(pReal), dimension(:,:), allocatable, private :: & plastic_disloUCLA_CLambdaSlipPerSlipFamily, & !< Adj. parameter for distance between 2 forest dislocations for each slip family and instance - plastic_disloUCLA_CLambdaSlipPerSlipSystem, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance - !* mobility law parameters - plastic_disloUCLA_friction !< friction coeff. B (kMC) + plastic_disloUCLA_CLambdaSlipPerSlipSystem !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance real(pReal), dimension(:,:,:), allocatable, private :: & plastic_disloUCLA_forestProjectionEdge !< matrix of forest projections of edge dislocations for each instance @@ -70,6 +68,7 @@ module plastic_disloUCLA grainSize, & SolidSolutionStrength !< Strength due to elements in solid solution real(pReal), allocatable, dimension(:) :: & + B, & !< friction coeff. B (kMC) rho0, & !< initial edge dislocation density per slip system for each family and instance rhoDip0, & !< initial edge dipole density per slip system for each family and instance burgers, & !< absolute length of burgers vector [m] for each slip system and instance @@ -232,7 +231,6 @@ material_allocatePlasticState allocate(plastic_disloUCLA_Qsd(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default - allocate(plastic_disloUCLA_friction(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CLambdaSlipPerSlipFamily(lattice_maxNslipFamily,maxNinstance), & source=0.0_pReal) @@ -284,6 +282,8 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%kink_height = config_phase(p)%getFloats('kink_height') prm%kink_width = config_phase(p)%getFloats('kink_width') prm%omega = config_phase(p)%getFloats('omega') + + prm%B = config_phase(p)%getFloats('friction_coeff') !prm%viscosity = config_phase(p)%getFloats('viscosity') @@ -309,6 +309,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%omega = math_expand(prm%omega, prm%Nslip) prm%tau_Peierls = math_expand(prm%tau_Peierls, prm%Nslip) prm%v0 = math_expand(prm%v0, prm%Nslip) + prm%B = math_expand(prm%B, prm%Nslip) endif slipActive @@ -401,16 +402,13 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp do j = 1_pInt, Nchunks_SlipFamilies plastic_disloUCLA_Nslip(j,instance) = IO_intValue(line,chunkPos,1_pInt+j) enddo - case ('clambdaslip','friction_coeff') + case ('clambdaslip') do j = 1_pInt, Nchunks_SlipFamilies tempPerSlip(j) = IO_floatValue(line,chunkPos,1_pInt+j) enddo select case(tag) case ('clambdaslip') plastic_disloUCLA_CLambdaSlipPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - case ('friction_coeff') - plastic_disloUCLA_friction(1:Nchunks_SlipFamilies,instance) = & - tempPerSlip(1:Nchunks_SlipFamilies) end select end select endif; endif @@ -487,7 +485,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp plasticState(phase)%state (offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) !* Process slip related parameters ------------------------------------------------ - mySlipFamilies: do f = 1_pInt,lattice_maxNslipFamily + mySlipFamilies: do f = 1_pInt,size(prm%Nslip,1) index_myFamily = sum(plastic_disloUCLA_Nslip(1:f-1_pInt,instance)) ! index in truncated slip system list mySlipSystems: do j = 1_pInt,plastic_disloUCLA_Nslip(f,instance) @@ -496,7 +494,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp plastic_disloUCLA_CLambdaSlipPerSlipFamily(f,instance) !* Calculation of forest projections for edge dislocations - otherSlipFamilies: do o = 1_pInt,lattice_maxNslipFamily + otherSlipFamilies: do o = 1_pInt,size(prm%Nslip,1) index_otherFamily = sum(plastic_disloUCLA_Nslip(1:o-1_pInt,instance)) otherSlipSystems: do k = 1_pInt,plastic_disloUCLA_Nslip(o,instance) plastic_disloUCLA_forestProjectionEdge(index_myFamily+j,index_otherFamily+k,instance) = & @@ -970,7 +968,7 @@ ph, instance,of * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) @@ -994,14 +992,14 @@ ph, instance,of StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & - + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& @@ -1013,7 +1011,7 @@ ph, instance,of / ( & ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & @@ -1037,7 +1035,7 @@ ph, instance,of * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) @@ -1060,14 +1058,14 @@ ph, instance,of StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & - + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) *BoltzmannRatio*prm%p(j)& @@ -1079,7 +1077,7 @@ ph, instance,of / ( & ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * plastic_disloUCLA_friction(f,instance) & + + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & From 47e32b39b9df37f4729b289e5937c7a4ff19951b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 30 Nov 2018 07:27:23 +0100 Subject: [PATCH 030/147] avoid unallocated array for elasticity only --- src/plastic_disloUCLA.f90 | 66 +++++++++++++++------------------------ 1 file changed, 26 insertions(+), 40 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 9428d714a..2c7fd9b6d 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -42,9 +42,6 @@ module plastic_disloUCLA plastic_disloUCLA_CEdgeDipMinDistance, & !< plastic_disloUCLA_dipoleFormationFactor !< scaling factor for dipole formation: 0: off, 1: on. other values not useful - real(pReal), dimension(:,:), allocatable, private :: & - plastic_disloUCLA_CLambdaSlipPerSlipFamily, & !< Adj. parameter for distance between 2 forest dislocations for each slip family and instance - plastic_disloUCLA_CLambdaSlipPerSlipSystem !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance real(pReal), dimension(:,:,:), allocatable, private :: & plastic_disloUCLA_forestProjectionEdge !< matrix of forest projections of edge dislocations for each instance @@ -231,10 +228,6 @@ material_allocatePlasticState allocate(plastic_disloUCLA_Qsd(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default - - allocate(plastic_disloUCLA_CLambdaSlipPerSlipFamily(lattice_maxNslipFamily,maxNinstance), & - source=0.0_pReal) - allocate(param(maxNinstance)) allocate(state(maxNinstance)) @@ -275,7 +268,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%burgers = config_phase(p)%getFloats('slipburgers') prm%H0kp = config_phase(p)%getFloats('qedge') prm%v0 = config_phase(p)%getFloats('v0') - !prm%clambda = config_phase(p)%getFloats('clambda') + prm%clambda = config_phase(p)%getFloats('clambdaslip') prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls') prm%p = config_phase(p)%getFloats('p_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) prm%q = config_phase(p)%getFloats('q_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) @@ -310,6 +303,22 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%tau_Peierls = math_expand(prm%tau_Peierls, prm%Nslip) prm%v0 = math_expand(prm%v0, prm%Nslip) prm%B = math_expand(prm%B, prm%Nslip) + prm%clambda = math_expand(prm%clambda, prm%Nslip) + + instance = phase_plasticityInstance(p) + if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & + call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') + if (plastic_disloUCLA_D0(instance) <= 0.0_pReal) & + call IO_error(211_pInt,el=instance,ext_msg='D0 ('//PLASTICITY_DISLOUCLA_label//')') + if (plastic_disloUCLA_Qsd(instance) <= 0.0_pReal) & + call IO_error(211_pInt,el=instance,ext_msg='Qsd ('//PLASTICITY_DISLOUCLA_label//')') + ! if (plastic_disloUCLA_aTolRho(instance) <= 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='aTolRho ('//PLASTICITY_DISLOUCLA_label//')') + + else slipActive + allocate(prm%rho0(0)) + allocate(prm%rhoDip0(0)) + endif slipActive @@ -402,14 +411,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp do j = 1_pInt, Nchunks_SlipFamilies plastic_disloUCLA_Nslip(j,instance) = IO_intValue(line,chunkPos,1_pInt+j) enddo - case ('clambdaslip') - do j = 1_pInt, Nchunks_SlipFamilies - tempPerSlip(j) = IO_floatValue(line,chunkPos,1_pInt+j) - enddo - select case(tag) - case ('clambdaslip') - plastic_disloUCLA_CLambdaSlipPerSlipFamily(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies) - end select end select endif; endif enddo parsingFile @@ -433,15 +434,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') endif enddo - if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') - if (plastic_disloUCLA_D0(instance) <= 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='D0 ('//PLASTICITY_DISLOUCLA_label//')') - if (plastic_disloUCLA_Qsd(instance) <= 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='Qsd ('//PLASTICITY_DISLOUCLA_label//')') - ! if (plastic_disloUCLA_aTolRho(instance) <= 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='aTolRho ('//PLASTICITY_DISLOUCLA_label//')') - !-------------------------------------------------------------------------------------------------- ! Determine total number of active slip systems plastic_disloUCLA_Nslip(:,instance) = min(lattice_NslipSystem(:,phase),plastic_disloUCLA_Nslip(:,instance)) @@ -453,8 +445,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! allocation of variables whose size depends on the total number of active slip systems maxTotalNslip = maxval(plastic_disloUCLA_totalNslip) - allocate(plastic_disloUCLA_CLambdaSlipPerSlipSystem(maxTotalNslip, maxNinstance),source=0.0_pReal) - allocate(plastic_disloUCLA_forestProjectionEdge(maxTotalNslip,maxTotalNslip,maxNinstance), & source=0.0_pReal) @@ -488,10 +478,6 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp mySlipFamilies: do f = 1_pInt,size(prm%Nslip,1) index_myFamily = sum(plastic_disloUCLA_Nslip(1:f-1_pInt,instance)) ! index in truncated slip system list mySlipSystems: do j = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - - - plastic_disloUCLA_CLambdaSlipPerSlipSystem(index_myFamily+j,instance) = & - plastic_disloUCLA_CLambdaSlipPerSlipFamily(f,instance) !* Calculation of forest projections for edge dislocations otherSlipFamilies: do o = 1_pInt,size(prm%Nslip,1) @@ -580,7 +566,7 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) invLambdaSlip(s) = & sqrt(dot_product((stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of)),& plastic_disloUCLA_forestProjectionEdge(1:ns,s,instance)))/ & - plastic_disloUCLA_CLambdaSlipPerSlipSystem(s,instance) + prm%Clambda(s) !* mean free path between 2 obstacles seen by a moving dislocation @@ -985,11 +971,11 @@ ph, instance,of * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_pos(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& *BoltzmannRatio*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * prm%B(j) & @@ -1001,11 +987,11 @@ ph, instance,of * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& *BoltzmannRatio*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& !deltaf(f) + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& ) & ) & / ( & @@ -1051,11 +1037,11 @@ ph, instance,of * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_neg(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& *BoltzmannRatio*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) &!deltaf(f) + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * prm%B(j) & @@ -1067,11 +1053,11 @@ ph, instance,of * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * prm%B(j) & *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& !deltaf(i) + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& *BoltzmannRatio*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& !deltaf(f) + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& ) & ) & / ( & From c4df2eeac49483164c32dc63b2e03ba0799695df Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 30 Nov 2018 07:46:26 +0100 Subject: [PATCH 031/147] no need to know the phase id --- src/plastic_disloUCLA.f90 | 70 ++++++++++++++------------------------- 1 file changed, 24 insertions(+), 46 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 2c7fd9b6d..ce562a437 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -556,7 +556,7 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) !* Shortened notation of = phasememberAt(ipc,ip,el) ph = phaseAt(ipc,ip,el) - instance = phase_plasticityInstance(ph) + instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) ns = plastic_disloUCLA_totalNslip(instance) @@ -600,21 +600,20 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el real(pReal), dimension(3,3), intent(out) :: Lp real(pReal), dimension(3,3,3,3), intent(out) :: dLp_dMp - integer(pInt) :: instance,ph,of,i,k,l,m,n + integer(pInt) :: instance,of,i,k,l,m,n real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg !* Shortened notation of = phasememberAt(ipc,ip,el) - ph = phaseAt(ipc,ip,el) - instance = phase_plasticityInstance(ph) + instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) associate(prm => param(instance)) Lp = 0.0_pReal dLp_dMp = 0.0_pReal - call kinetics(Mp,Temperature,ph,instance,of, & + call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) slipSystems: do i = 1_pInt, prm%totalNslip Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) @@ -689,7 +688,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) plasticState(ph)%dotState(:,of) = 0.0_pReal associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) !* Dislocation density evolution - call kinetics(Mp,Temperature,ph,instance,of, & + call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) dotState(instance)%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal @@ -777,9 +776,6 @@ math_mul33xx33 !plasticState, & phaseAt, phasememberAt use lattice, only: & - lattice_Sslip, & - lattice_maxNslipFamily, & - lattice_NslipSystem, & lattice_mu implicit none @@ -798,7 +794,7 @@ math_mul33xx33 integer(pInt) :: & instance,& ns,& - f,o,i,c,j,index_myFamily,& + o,i,c,j,& ph, & of real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & @@ -824,7 +820,7 @@ math_mul33xx33 postResults(c+1_pInt:c+ns) = stt%rhoEdgeDip(1_pInt:ns,of) c = c + ns case (shearrate_ID,stressexponent_ID) - call kinetics(Mp,Temperature,ph,instance,of, & + call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) if (plastic_disloUCLA_outputID(o,instance) == shearrate_ID) then @@ -851,34 +847,25 @@ math_mul33xx33 postResults(c+1_pInt:c+ns) = mse%mfp(1_pInt:ns, of) c = c + ns case (resolvedstress_ID) - j = 0_pInt - slipFamilies1: do f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family - slipSystems1: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - j = j + 1_pInt - postResults(c+j) =& - math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)) - enddo slipSystems1; enddo slipFamilies1 + do j = 1_pInt, prm%totalNslip + + postResults(c+j) =math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) + enddo c = c + ns case (thresholdstress_ID) postResults(c+1_pInt:c+ns) = mse%threshold_stress(1_pInt:ns,of) c = c + ns case (dipoleDistance_ID) - j = 0_pInt - slipFamilies2: do f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family - slipSystems2: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - j = j + 1_pInt - if (dNeq0(abs(math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph))))) then + do j = 1_pInt, prm%totalNslip + if (dNeq0(abs(math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j))))) then postResults(c+j) = & (3.0_pReal*lattice_mu(ph)*prm%burgers(j))/& - (16.0_pReal*pi*abs(math_mul33xx33(Mp,lattice_Sslip(:,:,1,index_myFamily+i,ph)))) + (16.0_pReal*pi*abs(math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)))) else postResults(c+j) = huge(1.0_pReal) endif - postResults(c+j)=min(postResults(c+j),& - mse%mfp(j,of)) - enddo slipSystems2; enddo slipFamilies2 + postResults(c+j)=min(postResults(c+j),mse%mfp(j,of)) + enddo c = c + ns end select enddo @@ -889,7 +876,7 @@ end function plastic_disloUCLA_postResults !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -subroutine kinetics(Mp,Temperature,ph,instance,of, & +subroutine kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) use prec, only: & tol_math_check, & @@ -897,9 +884,6 @@ subroutine kinetics(Mp,Temperature,ph,instance,of, & use math, only: & pi, & math_mul33xx33 - use lattice, only: & - lattice_maxNslipFamily, & - lattice_NslipSystem implicit none real(pReal), dimension(3,3), intent(in) :: & @@ -907,10 +891,9 @@ math_mul33xx33 real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & -ph, instance,of +instance,of integer(pInt) :: & - ns,& f,i,j,index_myFamily real(pReal) :: StressRatio_p,StressRatio_pminus1,& BoltzmannRatio,DotGamma0,stressRatio,& @@ -918,19 +901,14 @@ ph, instance,of real(pReal), intent(out), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) - !* Shortened notation - ns = plastic_disloUCLA_totalNslip(instance) + gdot_slip_pos = 0.0_pReal gdot_slip_neg = 0.0_pReal dgdot_dtauslip_pos = 0.0_pReal dgdot_dtauslip_neg = 0.0_pReal - j = 0_pInt - slipFamilies: do f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family - slipSystems: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - j = j + 1_pInt + do j = 1_pInt, prm%totalNslip !* Boltzmann ratio BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) !* Initial shear rates @@ -1006,6 +984,8 @@ ph, instance,of dgdot_dtauslip_pos(j) = DotGamma0 * dvel_slip endif significantPositiveTau + + significantNegativeTau: if((abs(tau_slip_neg(j))-mse%threshold_stress(j, of)) > tol_math_check) then !* Stress ratios stressRatio = ((abs(tau_slip_neg(j))-mse%threshold_stress(j, of))/& @@ -1071,10 +1051,8 @@ ph, instance,of dgdot_dtauslip_neg(j) = DotGamma0 * dvel_slip - - endif significantNegativeTau - enddo slipSystems - enddo slipFamilies + endif significantNegativeTau + enddo end associate end subroutine kinetics From 4e86d239de890bdc0c4234ef033d320808bb0ef3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 30 Nov 2018 08:25:23 +0100 Subject: [PATCH 032/147] simplified --- src/plastic_disloUCLA.f90 | 59 +++++++++++++-------------------------- 1 file changed, 19 insertions(+), 40 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index ce562a437..866dfbee6 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -63,7 +63,8 @@ module plastic_disloUCLA real(pReal) :: & aTolRho, & grainSize, & -SolidSolutionStrength !< Strength due to elements in solid solution + SolidSolutionStrength, & !< Strength due to elements in solid solution + mu real(pReal), allocatable, dimension(:) :: & B, & !< friction coeff. B (kMC) rho0, & !< initial edge dislocation density per slip system for each family and instance @@ -242,6 +243,7 @@ do p = 1_pInt, size(phase_plasticityInstance) stt => state(phase_plasticityInstance(p))) structure = config_phase(p)%getString('lattice_structure') + prm%mu = lattice_mu(p) prm%aTolRho = config_phase(p)%getFloat('atol_rho') !-------------------------------------------------------------------------------------------------- @@ -306,6 +308,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%clambda = math_expand(prm%clambda, prm%Nslip) instance = phase_plasticityInstance(p) + plastic_disloUCLA_totalNslip(instance) = prm%totalNslip if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') if (plastic_disloUCLA_D0(instance) <= 0.0_pReal) & @@ -418,10 +421,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp sanityChecks: do phase = 1_pInt, size(phase_plasticity) myPhase: if (phase_plasticity(phase) == PLASTICITY_disloUCLA_ID) then instance = phase_plasticityInstance(phase) - if (sum(plastic_disloUCLA_Nslip(:,instance)) < 0_pInt) & - call IO_error(211_pInt,el=instance,ext_msg='Nslip ('//PLASTICITY_DISLOUCLA_label//')') do f = 1_pInt,lattice_maxNslipFamily - if (plastic_disloUCLA_Nslip(f,instance) > 0_pInt) then !if (plastic_disloUCLA_rhoEdge0(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdge0 ('//PLASTICITY_DISLOUCLA_label//')') !if (plastic_disloUCLA_rhoEdgeDip0(f,instance) < 0.0_pReal) & @@ -432,12 +432,10 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! call IO_error(211_pInt,el=instance,ext_msg='v0 ('//PLASTICITY_DISLOUCLA_label//')') !if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') - endif enddo !-------------------------------------------------------------------------------------------------- ! Determine total number of active slip systems plastic_disloUCLA_Nslip(:,instance) = min(lattice_NslipSystem(:,phase),plastic_disloUCLA_Nslip(:,instance)) - plastic_disloUCLA_totalNslip(instance) = sum(plastic_disloUCLA_Nslip(:,instance)) endif myPhase enddo sanityChecks @@ -476,13 +474,13 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp !* Process slip related parameters ------------------------------------------------ mySlipFamilies: do f = 1_pInt,size(prm%Nslip,1) - index_myFamily = sum(plastic_disloUCLA_Nslip(1:f-1_pInt,instance)) ! index in truncated slip system list - mySlipSystems: do j = 1_pInt,plastic_disloUCLA_Nslip(f,instance) + index_myFamily = sum(prm%Nslip(1:f-1_pInt)) ! index in truncated slip system list + mySlipSystems: do j = 1_pInt,prm%Nslip(f) !* Calculation of forest projections for edge dislocations otherSlipFamilies: do o = 1_pInt,size(prm%Nslip,1) - index_otherFamily = sum(plastic_disloUCLA_Nslip(1:o-1_pInt,instance)) - otherSlipSystems: do k = 1_pInt,plastic_disloUCLA_Nslip(o,instance) + index_otherFamily = sum(prm%Nslip(1:o-1_pInt)) + otherSlipSystems: do k = 1_pInt,prm%Nslip(o) plastic_disloUCLA_forestProjectionEdge(index_myFamily+j,index_otherFamily+k,instance) = & abs(math_mul3x3(lattice_sn(:,sum(lattice_NslipSystem(1:f-1,phase))+j,phase), & lattice_st(:,sum(lattice_NslipSystem(1:o-1,phase))+k,phase))) @@ -535,8 +533,6 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) phase_plasticityInstance, & phaseAt, phasememberAt, & material_phase - use lattice, only: & - lattice_mu implicit none integer(pInt), intent(in) :: & @@ -549,13 +545,11 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) integer(pInt) :: & instance, & ns,s, & - ph, & of real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & invLambdaSlip !* Shortened notation of = phasememberAt(ipc,ip,el) - ph = phaseAt(ipc,ip,el) instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) ns = plastic_disloUCLA_totalNslip(instance) @@ -575,7 +569,7 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) !* threshold stress for dislocation motion forall (s = 1_pInt:ns) & mse%threshold_stress(s,of) = & - lattice_mu(ph)*prm%burgers(s)*& + prm%mu*prm%burgers(s)*& sqrt(dot_product(stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of),& prm%interaction_SlipSlip(s,1:ns))) end associate @@ -644,10 +638,6 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) phase_plasticityInstance, & plasticState, & phaseAt, phasememberAt - use lattice, only: & - lattice_maxNslipFamily, & - lattice_NslipSystem, & - lattice_mu implicit none real(pReal), dimension(3,3), intent(in):: & @@ -659,8 +649,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) ip, & !< integration point el !< element - integer(pInt) :: instance,ns,f,i,j,index_myFamily, & - ph, & + integer(pInt) :: instance,ns,f,i,j, & of real(pReal) :: & EdgeDipMinDistance,& @@ -681,22 +670,17 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) !* Shortened notation of = phasememberAt(ipc,ip,el) - ph = phaseAt(ipc,ip,el) - instance = phase_plasticityInstance(ph) + instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) ns = plastic_disloUCLA_totalNslip(instance) - plasticState(ph)%dotState(:,of) = 0.0_pReal + plasticState(phaseAt(ipc,ip,el))%dotState(:,of) = 0.0_pReal associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) !* Dislocation density evolution call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) dotState(instance)%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal - j = 0_pInt - slipFamilies: do f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family - slipSystems: do i = 1_pInt,plastic_disloUCLA_Nslip(f,instance) - j = j+1_pInt +do j = 1_pInt, prm%totalNslip !* Multiplication DotRhoMultiplication = abs(dotState(instance)%accshear_slip(j,of))/& @@ -710,7 +694,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) DotRhoDipFormation = 0.0_pReal else EdgeDipDistance = & - (3.0_pReal*lattice_mu(ph)*prm%burgers(j))/& + (3.0_pReal*prm%mu*prm%burgers(j))/& (16.0_pReal*pi*abs(tau_slip_pos(j))) if (EdgeDipDistance>mse%mfp(j,of)) EdgeDipDistance=mse%mfp(j,of) if (EdgeDipDistance Date: Fri, 30 Nov 2018 08:36:56 +0100 Subject: [PATCH 033/147] no need to parse the file --- src/plastic_disloUCLA.f90 | 74 ++++----------------------------------- 1 file changed, 6 insertions(+), 68 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 866dfbee6..3f7fe52d9 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -155,18 +155,8 @@ subroutine plastic_disloUCLA_init(fileUnit) math_mul3x3, & math_expand use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & IO_error, & - IO_timeStamp, & - IO_EOF + IO_timeStamp use material, only: & phase_plasticity, & phase_plasticityInstance, & @@ -184,11 +174,9 @@ material_allocatePlasticState implicit none integer(pInt), intent(in) :: fileUnit - integer(pInt), allocatable, dimension(:) :: chunkPos integer(pInt) :: maxNinstance,phase,maxTotalNslip,& f,instance,j,k,o,ns, i, & - Nchunks_SlipSlip = 0_pInt, outputSize, & - Nchunks_SlipFamilies = 0_pInt,Nchunks_nonSchmid = 0_pInt, & + outputSize, & offset_slip, index_myFamily, index_otherFamily, & startIndex, endIndex, p integer(pInt) :: sizeState, sizeDotState @@ -375,53 +363,8 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp end associate enddo - rewind(fileUnit) - phase = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to - line = IO_read(fileUnit) - enddo - parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next phase section - phase = phase + 1_pInt ! advance phase section counter - if (phase_plasticity(phase) == PLASTICITY_DISLOUCLA_ID) then - Nchunks_SlipFamilies = count(lattice_NslipSystem(:,phase) > 0_pInt) - Nchunks_nonSchmid = lattice_NnonSchmid(phase) - if(allocated(tempPerSlip)) deallocate(tempPerSlip) - allocate(tempPerSlip(Nchunks_SlipFamilies)) - endif - cycle ! skip to next line - endif - if (phase > 0_pInt ) then; if (phase_plasticity(phase) == PLASTICITY_DISLOUCLA_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - instance = phase_plasticityInstance(phase) ! which instance of my plasticity is present phase - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) -!-------------------------------------------------------------------------------------------------- -! parameters depending on number of slip system families - case ('nslip') - if (chunkPos(1) < Nchunks_SlipFamilies + 1_pInt) & - call IO_warning(50_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_DISLOUCLA_label//')') - if (chunkPos(1) > Nchunks_SlipFamilies + 1_pInt) & - call IO_error(150_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_DISLOUCLA_label//')') - Nchunks_SlipFamilies = chunkPos(1) - 1_pInt - do j = 1_pInt, Nchunks_SlipFamilies - plastic_disloUCLA_Nslip(j,instance) = IO_intValue(line,chunkPos,1_pInt+j) - enddo - end select - endif; endif - enddo parsingFile - - sanityChecks: do phase = 1_pInt, size(phase_plasticity) - myPhase: if (phase_plasticity(phase) == PLASTICITY_disloUCLA_ID) then - instance = phase_plasticityInstance(phase) - do f = 1_pInt,lattice_maxNslipFamily + !if (plastic_disloUCLA_rhoEdge0(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdge0 ('//PLASTICITY_DISLOUCLA_label//')') !if (plastic_disloUCLA_rhoEdgeDip0(f,instance) < 0.0_pReal) & @@ -432,12 +375,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp ! call IO_error(211_pInt,el=instance,ext_msg='v0 ('//PLASTICITY_DISLOUCLA_label//')') !if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') - enddo -!-------------------------------------------------------------------------------------------------- -! Determine total number of active slip systems - plastic_disloUCLA_Nslip(:,instance) = min(lattice_NslipSystem(:,phase),plastic_disloUCLA_Nslip(:,instance)) - endif myPhase - enddo sanityChecks + !-------------------------------------------------------------------------------------------------- ! allocation of variables whose size depends on the total number of active slip systems @@ -649,7 +587,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) ip, & !< integration point el !< element - integer(pInt) :: instance,ns,f,i,j, & + integer(pInt) :: instance,ns,j, & of real(pReal) :: & EdgeDipMinDistance,& @@ -775,7 +713,7 @@ math_mul33xx33 integer(pInt) :: & instance,& ns,& - o,i,c,j,& + o,c,j,& of real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg From bbba2013626144ebe5cc936b9e817a8f40a4fae7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 30 Nov 2018 10:04:41 +0100 Subject: [PATCH 034/147] simpler API --- src/constitutive.f90 | 9 ++++--- src/plastic_disloUCLA.f90 | 53 ++++++++++++--------------------------- 2 files changed, 22 insertions(+), 40 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index bb52ab3cc..f01c82f75 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -926,8 +926,9 @@ subroutine constitutive_collectDotState(S6, FeArray, Fi, FpArray, subdt, subfrac call plastic_dislotwin_dotState (Mp,temperature(ho)%p(tme),instance,of) case (PLASTICITY_DISLOUCLA_ID) plasticityType - call plastic_disloucla_dotState (Mp,temperature(ho)%p(tme), & - ipc,ip,el) + of = phasememberAt(ipc,ip,el) + instance = phase_plasticityInstance(material_phase(ipc,ip,el)) + call plastic_disloucla_dotState (Mp,temperature(ho)%p(tme),instance,of) case (PLASTICITY_NONLOCAL_ID) plasticityType call plastic_nonlocal_dotState (math_Mandel33to6(Mp),FeArray,FpArray,temperature(ho)%p(tme), & @@ -1153,8 +1154,10 @@ function constitutive_postResults(S6, Fi, FeArray, ipc, ip, el) plastic_dislotwin_postResults(Mp,temperature(ho)%p(tme),instance,of) case (PLASTICITY_DISLOUCLA_ID) plasticityType + of = phasememberAt(ipc,ip,el) + instance = phase_plasticityInstance(material_phase(ipc,ip,el)) constitutive_postResults(startPos:endPos) = & - plastic_disloucla_postResults(Mp,temperature(ho)%p(tme),ipc,ip,el) + plastic_disloucla_postResults(Mp,temperature(ho)%p(tme),instance,of) case (PLASTICITY_NONLOCAL_ID) plasticityType constitutive_postResults(startPos:endPos) = & diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 3f7fe52d9..20badb904 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -106,7 +106,8 @@ module plastic_disloUCLA real(pReal), pointer, dimension(:,:) :: & rhoEdge, & rhoEdgeDip, & - accshear_slip + accshear_slip, & + whole end type type, private :: tDisloUCLAMicrostructure @@ -447,6 +448,8 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp dotState(instance)%accshear_slip=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal + dotState(instance)%whole => plasticState(phase)%dotState + allocate(mse%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) allocate(mse%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) @@ -565,17 +568,12 @@ end subroutine plastic_disloUCLA_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief calculates the rate of change of microstructure !-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) +subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) use prec, only: & tol_math_check, & dEq0 use math, only: & pi - use material, only: & - material_phase, & - phase_plasticityInstance, & - plasticState, & - phaseAt, phasememberAt implicit none real(pReal), dimension(3,3), intent(in):: & @@ -583,12 +581,9 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element + instance, of + integer(pInt) :: ns,j - integer(pInt) :: instance,ns,j, & - of real(pReal) :: & EdgeDipMinDistance,& AtomicVolume,& @@ -600,18 +595,15 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,ipc,ip,el) ClimbVelocity, & DotRhoEdgeDipClimb, & DotRhoDipFormation - real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + real(pReal), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos, gdot_slip_neg,& tau_slip_pos,& tau_slip_neg, & dgdot_dtauslip_neg,dgdot_dtauslip_pos - !* Shortened notation - of = phasememberAt(ipc,ip,el) - instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) ns = plastic_disloUCLA_totalNslip(instance) + dotState(instance)%whole(:,of) = 0.0_pReal - plasticState(phaseAt(ipc,ip,el))%dotState(:,of) = 0.0_pReal associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) !* Dislocation density evolution call kinetics(Mp,Temperature,instance,of, & @@ -684,18 +676,13 @@ end subroutine plastic_disloUCLA_dotState !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -function plastic_disloUCLA_postResults(Mp,Temperature,ipc,ip,el) result(postResults) +function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postResults) use prec, only: & tol_math_check, & dEq, dNeq0 use math, only: & pi, & math_mul33xx33 - use material, only: & - material_phase, & - phase_plasticityInstance,& - !plasticState, & - phaseAt, phasememberAt implicit none real(pReal), dimension(3,3), intent(in) :: & @@ -703,27 +690,19 @@ math_mul33xx33 real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element + instance,of - real(pReal), dimension(plastic_disloUCLA_sizePostResults(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + real(pReal), dimension(plastic_disloUCLA_sizePostResults(instance)) :: & postResults integer(pInt) :: & - instance,& ns,& - o,c,j,& - of - real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + o,c,j + real(pReal), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg - - !* Shortened notation - of = phasememberAt(ipc,ip,el) - instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) + ns = plastic_disloUCLA_totalNslip(instance) - - !* Required output + c = 0_pInt postResults = 0.0_pReal associate (prm => param(instance),stt =>state(instance),mse => microstructure(instance)) From fb651e24efbf798435fdf2b71a48d2057d48df22 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 3 Dec 2018 10:48:37 +0100 Subject: [PATCH 035/147] same structure as in phenopowerlaw --- src/plastic_disloUCLA.f90 | 136 +++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 74 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 20badb904..02b8d3c34 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -678,94 +678,82 @@ end subroutine plastic_disloUCLA_dotState !-------------------------------------------------------------------------------------------------- function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postResults) use prec, only: & - tol_math_check, & dEq, dNeq0 use math, only: & pi, & -math_mul33xx33 + math_mul33xx33 implicit none - real(pReal), dimension(3,3), intent(in) :: & - Mp !< 2nd Piola Kirchhoff stress tensor in Mandel notation - real(pReal), intent(in) :: & - temperature !< temperature at integration point - integer(pInt), intent(in) :: & - instance,of + real(pReal), dimension(3,3), intent(in) :: & + Mp !< Mandel stress + real(pReal), intent(in) :: & + Temperature !< Mandel stress + integer(pInt), intent(in) :: & + instance, & + of - real(pReal), dimension(plastic_disloUCLA_sizePostResults(instance)) :: & - postResults + real(pReal), dimension(sum(plastic_disloUCLA_sizePostResult(:,instance))) :: & + postResults integer(pInt) :: & - ns,& - o,c,j - real(pReal), dimension(plastic_disloUCLA_totalNslip(instance)) :: & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg + o,c,i + real(pReal), dimension(param(instance)%totalNslip) :: & + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos, & + gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg - ns = plastic_disloUCLA_totalNslip(instance) + associate( prm => param(instance), stt => state(instance), mse => microstructure(instance)) - c = 0_pInt postResults = 0.0_pReal - associate (prm => param(instance),stt =>state(instance),mse => microstructure(instance)) - do o = 1_pInt,plastic_disloUCLA_Noutput(instance) - select case(plastic_disloUCLA_outputID(o,instance)) - - case (rho_ID) - postResults(c+1_pInt:c+ns) = stt%rhoEdge(1_pInt:ns,of) - c = c + ns - case (rhoDip_ID) - postResults(c+1_pInt:c+ns) = stt%rhoEdgeDip(1_pInt:ns,of) - c = c + ns - case (shearrate_ID,stressexponent_ID) - call kinetics(Mp,Temperature,instance,of, & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + c = 0_pInt - if (plastic_disloUCLA_outputID(o,instance) == shearrate_ID) then - postResults(c+1:c+ns) = (gdot_slip_pos + gdot_slip_neg)*0.5_pReal - c = c + ns - elseif(plastic_disloUCLA_outputID(o,instance) == stressexponent_ID) then - do j = 1_pInt, ns - if (dEq(gdot_slip_pos(j)+gdot_slip_neg(j),0.0_pReal)) then - postResults(c+j) = 0.0_pReal - else - postResults(c+j) = (tau_slip_pos(j)+tau_slip_neg(j))/& - (gdot_slip_pos(j)+gdot_slip_neg(j))*& - (dgdot_dtauslip_pos(j)+dgdot_dtauslip_neg(j))* 0.5_pReal - endif - enddo - c = c + ns - endif + outputsLoop: do o = 1_pInt,size(prm%outputID) + select case(prm%outputID(o)) - case (accumulatedshear_ID) - postResults(c+1_pInt:c+ns) = & - stt%accshear_slip(1_pInt:ns, of) - c = c + ns - case (mfp_ID) - postResults(c+1_pInt:c+ns) = mse%mfp(1_pInt:ns, of) - c = c + ns - case (resolvedstress_ID) - do j = 1_pInt, prm%totalNslip + case (rho_ID) + postResults(c+1_pInt:c+prm%totalNslip) = stt%rhoEdge(1_pInt:prm%totalNslip,of) + case (rhoDip_ID) + postResults(c+1_pInt:c+prm%totalNslip) = stt%rhoEdgeDip(1_pInt:prm%totalNslip,of) + case (shearrate_ID,stressexponent_ID) + call kinetics(Mp,Temperature,instance,of, & + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + + if (prm%outputID(o) == shearrate_ID) then + postResults(c+1:c+prm%totalNslip) = (gdot_slip_pos + gdot_slip_neg)*0.5_pReal + elseif(prm%outputID(o) == stressexponent_ID) then + where (dNeq0(gdot_slip_pos+gdot_slip_neg)) + postResults(c+1_pInt:c + prm%totalNslip) = (tau_slip_pos+tau_slip_neg) * 0.5_pReal & + / (gdot_slip_pos+gdot_slip_neg) & + * (dgdot_dtauslip_pos+dgdot_dtauslip_neg) + else where + postResults(c+1_pInt:c + prm%totalNslip) = 0.0_pReal + end where + endif + case (accumulatedshear_ID) + postResults(c+1_pInt:c+prm%totalNslip) = stt%accshear_slip(1_pInt:prm%totalNslip, of) + case (mfp_ID) + postResults(c+1_pInt:c+prm%totalNslip) = mse%mfp(1_pInt:prm%totalNslip, of) + case (resolvedstress_ID) + do i = 1_pInt, prm%totalNslip + postResults(c+i) =math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,i)) + enddo + case (thresholdstress_ID) + postResults(c+1_pInt:c+prm%totalNslip) = mse%threshold_stress(1_pInt:prm%totalNslip,of) + case (dipoleDistance_ID) + do i = 1_pInt, prm%totalNslip + if (dNeq0(abs(math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,i))))) then + postResults(c+i) = (3.0_pReal*prm%mu*prm%burgers(i)) & + / (16.0_pReal*pi*abs(math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,i)))) + else + postResults(c+i) = huge(1.0_pReal) + endif + postResults(c+i)=min(postResults(c+i),mse%mfp(i,of)) + enddo + end select + + c = c + prm%totalNslip + enddo outputsLoop + end associate - postResults(c+j) =math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) - enddo - c = c + ns - case (thresholdstress_ID) - postResults(c+1_pInt:c+ns) = mse%threshold_stress(1_pInt:ns,of) - c = c + ns - case (dipoleDistance_ID) - do j = 1_pInt, prm%totalNslip - if (dNeq0(abs(math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j))))) then - postResults(c+j) = & - (3.0_pReal*prm%mu*prm%burgers(j))/& - (16.0_pReal*pi*abs(math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)))) - else - postResults(c+j) = huge(1.0_pReal) - endif - postResults(c+j)=min(postResults(c+j),mse%mfp(j,of)) - enddo - c = c + ns - end select - enddo -end associate end function plastic_disloUCLA_postResults From 49b5271ca4d403684b05697cd1be610277563c4e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 3 Dec 2018 11:25:29 +0100 Subject: [PATCH 036/147] simplified --- src/plastic_disloUCLA.f90 | 41 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 02b8d3c34..5e8e76052 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -13,9 +13,6 @@ module plastic_disloUCLA implicit none private - integer(pInt), dimension(:), allocatable, public, protected :: & - plastic_disloUCLA_sizePostResults !< cumulative size of post results - integer(pInt), dimension(:,:), allocatable, target, public :: & plastic_disloUCLA_sizePostResult !< size of each post result output @@ -25,9 +22,6 @@ module plastic_disloUCLA real(pReal), parameter, private :: & kB = 1.38e-23_pReal !< Boltzmann constant in J/Kelvin - integer(pInt), dimension(:), allocatable, target, public :: & - plastic_disloUCLA_Noutput !< number of outputs per instance of this plasticity - integer(pInt), dimension(:), allocatable, private :: & plastic_disloUCLA_totalNslip !< total number of active slip systems for each instance @@ -37,7 +31,6 @@ module plastic_disloUCLA real(pReal), dimension(:), allocatable, private :: & plastic_disloUCLA_CAtomicVolume, & !< atomic volume in Bugers vector unit - plastic_disloUCLA_D0, & !< prefactor for self-diffusion coefficient plastic_disloUCLA_Qsd, & !< activation energy for dislocation climb plastic_disloUCLA_CEdgeDipMinDistance, & !< plastic_disloUCLA_dipoleFormationFactor !< scaling factor for dipole formation: 0: off, 1: on. other values not useful @@ -64,7 +57,8 @@ module plastic_disloUCLA aTolRho, & grainSize, & SolidSolutionStrength, & !< Strength due to elements in solid solution - mu + mu, & + D0 !< prefactor for self-diffusion coefficient real(pReal), allocatable, dimension(:) :: & B, & !< friction coeff. B (kMC) rho0, & !< initial edge dislocation density per slip system for each family and instance @@ -99,8 +93,6 @@ module plastic_disloUCLA end type !< container type for internal constitutive parameters type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance) - integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & - plastic_disloUCLA_outputID !< ID of each post result output type, private :: tDisloUCLAState real(pReal), pointer, dimension(:,:) :: & @@ -183,10 +175,7 @@ material_allocatePlasticState integer(pInt) :: sizeState, sizeDotState integer(pInt) :: NofMyPhase character(len=65536) :: & - structure = '',& - tag = '', & - line = '' - real(pReal), dimension(:), allocatable :: tempPerSlip + structure = '' character(len=65536), dimension(:), allocatable :: outputs integer(kind(undefined_ID)) :: outputID integer(pInt), dimension(0), parameter :: emptyIntArray = [integer(pInt)::] @@ -205,16 +194,15 @@ material_allocatePlasticState if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance - allocate(plastic_disloUCLA_sizePostResults(maxNinstance), source=0_pInt) allocate(plastic_disloUCLA_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) allocate(plastic_disloUCLA_output(maxval(phase_Noutput),maxNinstance)) plastic_disloUCLA_output = '' - allocate(plastic_disloUCLA_outputID(maxval(phase_Noutput),maxNinstance), source=undefined_ID) - allocate(plastic_disloUCLA_Noutput(maxNinstance), source=0_pInt) + + allocate(plastic_disloUCLA_Nslip(lattice_maxNslipFamily,maxNinstance), source=0_pInt) allocate(plastic_disloUCLA_totalNslip(maxNinstance), source=0_pInt) allocate(plastic_disloUCLA_CAtomicVolume(maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_D0(maxNinstance), source=0.0_pReal) + allocate(plastic_disloUCLA_Qsd(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default @@ -275,7 +263,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%grainSize = config_phase(p)%getFloat('grainsize') - plastic_disloUCLA_D0(phase_plasticityInstance(p)) = config_phase(p)%getFloat('qsd') + prm%D0 = config_phase(p)%getFloat('d0') plastic_disloUCLA_Qsd(phase_plasticityInstance(p)) = config_phase(p)%getFloat('qsd') plastic_disloUCLA_CEdgeDipMinDistance(phase_plasticityInstance(p)) = config_phase(p)%getFloat('cedgedipmindistance') plastic_disloUCLA_CAtomicVolume(phase_plasticityInstance(p)) = config_phase(p)%getFloat('catomicvolume') @@ -298,9 +286,9 @@ do p = 1_pInt, size(phase_plasticityInstance) instance = phase_plasticityInstance(p) plastic_disloUCLA_totalNslip(instance) = prm%totalNslip - if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') - if (plastic_disloUCLA_D0(instance) <= 0.0_pReal) & + !if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') + if (prm%D0 <= 0.0_pReal) & call IO_error(211_pInt,el=instance,ext_msg='D0 ('//PLASTICITY_DISLOUCLA_label//')') if (plastic_disloUCLA_Qsd(instance) <= 0.0_pReal) & call IO_error(211_pInt,el=instance,ext_msg='Qsd ('//PLASTICITY_DISLOUCLA_label//')') @@ -354,10 +342,6 @@ do p = 1_pInt, size(phase_plasticityInstance) plastic_disloUCLA_output(i,phase_plasticityInstance(p)) = outputs(i) plastic_disloUCLA_sizePostResult(i,phase_plasticityInstance(p)) = outputSize prm%outputID = [prm%outputID, outputID] - plastic_disloUCLA_outputID(i,phase_plasticityInstance(p)) = outputID - plastic_disloUCLA_sizePostResults(phase_plasticityInstance(p)) = & - plastic_disloUCLA_sizePostResults(phase_plasticityInstance(p)) + outputSize -plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) + 1_pInt endif enddo @@ -403,7 +387,7 @@ plastic_disloUCLA_Noutput(phase_plasticityInstance(p)) = plastic_disloUCLA_Noutp call material_allocatePlasticState(phase,NofMyPhase,sizeState,sizeDotState,0_pInt, & ns,0_pInt,0_pInt) - plasticState(phase)%sizePostResults = plastic_disloUCLA_sizePostResults(instance) + plasticState(phase)%sizePostResults = sum(plastic_disloUCLA_sizePostResult(:,phase_plasticityInstance(p))) offset_slip = 2_pInt*plasticState(phase)%nSlip plasticState(phase)%slipRate => & @@ -646,8 +630,7 @@ do j = 1_pInt, prm%totalNslip !* Dislocation dipole climb AtomicVolume = & plastic_disloUCLA_CAtomicVolume(instance)*prm%burgers(j)**(3.0_pReal) - VacancyDiffusion = & - plastic_disloUCLA_D0(instance)*exp(-plastic_disloUCLA_Qsd(instance)/(kB*Temperature)) + VacancyDiffusion = prm%D0*exp(-plastic_disloUCLA_Qsd(instance)/(kB*Temperature)) if (dEq0(tau_slip_pos(j))) then DotRhoEdgeDipClimb = 0.0_pReal else From e604a3d9cc09ad1992faddf506c02cbe5f618dac Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 4 Dec 2018 00:06:46 +0100 Subject: [PATCH 037/147] simplified --- src/plastic_disloUCLA.f90 | 129 ++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 68 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 5e8e76052..a6ff87323 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -25,10 +25,6 @@ module plastic_disloUCLA integer(pInt), dimension(:), allocatable, private :: & plastic_disloUCLA_totalNslip !< total number of active slip systems for each instance - integer(pInt), dimension(:,:), allocatable, private :: & - plastic_disloUCLA_Nslip !< number of active slip systems for each family and instance - - real(pReal), dimension(:), allocatable, private :: & plastic_disloUCLA_CAtomicVolume, & !< atomic volume in Bugers vector unit plastic_disloUCLA_Qsd, & !< activation energy for dislocation climb @@ -76,7 +72,9 @@ module plastic_disloUCLA viscosity, & !< friction coeff. B (kMC) !* tau_Peierls, & - nonSchmidCoeff + nonSchmidCoeff, & + atomicVolume, & + minDipDistance real(pReal), allocatable, dimension(:,:) :: & interaction_SlipSlip !< slip resistance from slip activity real(pReal), allocatable, dimension(:,:,:) :: & @@ -90,6 +88,8 @@ module plastic_disloUCLA Nslip !< number of active slip systems for each family integer(kind(undefined_ID)), allocatable, dimension(:) :: & outputID !< ID of each post result output + logical :: & + dipoleformation end type !< container type for internal constitutive parameters type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance) @@ -168,7 +168,7 @@ material_allocatePlasticState integer(pInt), intent(in) :: fileUnit integer(pInt) :: maxNinstance,phase,maxTotalNslip,& - f,instance,j,k,o,ns, i, & + f,instance,j,k,o, i, & outputSize, & offset_slip, index_myFamily, index_otherFamily, & startIndex, endIndex, p @@ -199,12 +199,13 @@ material_allocatePlasticState plastic_disloUCLA_output = '' - allocate(plastic_disloUCLA_Nslip(lattice_maxNslipFamily,maxNinstance), source=0_pInt) allocate(plastic_disloUCLA_totalNslip(maxNinstance), source=0_pInt) + allocate(plastic_disloUCLA_CAtomicVolume(maxNinstance), source=0.0_pReal) + allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) allocate(plastic_disloUCLA_Qsd(maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) + allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default allocate(param(maxNinstance)) @@ -217,7 +218,8 @@ do p = 1_pInt, size(phase_plasticityInstance) if (phase_plasticity(p) /= PLASTICITY_DISLOUCLA_ID) cycle associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & - stt => state(phase_plasticityInstance(p))) + stt => state(phase_plasticityInstance(p)), & + mse => microstructure(phase_plasticityInstance(p))) structure = config_phase(p)%getString('lattice_structure') prm%mu = lattice_mu(p) @@ -302,9 +304,6 @@ do p = 1_pInt, size(phase_plasticityInstance) endif slipActive -!-------------------------------------------------------------------------------------------------- -! phase outputs - #if defined(__GFORTRAN__) outputs = ['GfortranBug86277'] outputs = config_phase(p)%getStrings('(output)',defaultVal=outputs) @@ -345,8 +344,7 @@ do p = 1_pInt, size(phase_plasticityInstance) endif enddo - end associate - enddo + @@ -361,31 +359,18 @@ do p = 1_pInt, size(phase_plasticityInstance) !if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') - -!-------------------------------------------------------------------------------------------------- -! allocation of variables whose size depends on the total number of active slip systems - maxTotalNslip = maxval(plastic_disloUCLA_totalNslip) - - allocate(plastic_disloUCLA_forestProjectionEdge(maxTotalNslip,maxTotalNslip,maxNinstance), & - source=0.0_pReal) - - - initializeInstances: do phase = 1_pInt, size(phase_plasticity) - myPhase2: if (phase_plasticity(phase) == PLASTICITY_disloUCLA_ID) then - p = phase + phase = p NofMyPhase=count(material_phase==phase) instance = phase_plasticityInstance(phase) - ns = plastic_disloUCLA_totalNslip(instance) - associate(prm => param(instance), stt=>state(instance),mse => microstructure(phase_plasticityInstance(p))) !-------------------------------------------------------------------------------------------------- ! allocate state arrays - sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * ns + sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * prm%totalNslip sizeState = sizeDotState call material_allocatePlasticState(phase,NofMyPhase,sizeState,sizeDotState,0_pInt, & - ns,0_pInt,0_pInt) + prm%totalNslip,0_pInt,0_pInt) plasticState(phase)%sizePostResults = sum(plastic_disloUCLA_sizePostResult(:,phase_plasticityInstance(p))) @@ -394,40 +379,23 @@ do p = 1_pInt, size(phase_plasticityInstance) plasticState(phase)%dotState(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) plasticState(phase)%accumulatedSlip => & plasticState(phase)%state (offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) - !* Process slip related parameters ------------------------------------------------ - - mySlipFamilies: do f = 1_pInt,size(prm%Nslip,1) - index_myFamily = sum(prm%Nslip(1:f-1_pInt)) ! index in truncated slip system list - mySlipSystems: do j = 1_pInt,prm%Nslip(f) - - !* Calculation of forest projections for edge dislocations - otherSlipFamilies: do o = 1_pInt,size(prm%Nslip,1) - index_otherFamily = sum(prm%Nslip(1:o-1_pInt)) - otherSlipSystems: do k = 1_pInt,prm%Nslip(o) - plastic_disloUCLA_forestProjectionEdge(index_myFamily+j,index_otherFamily+k,instance) = & - abs(math_mul3x3(lattice_sn(:,sum(lattice_NslipSystem(1:f-1,phase))+j,phase), & - lattice_st(:,sum(lattice_NslipSystem(1:o-1,phase))+k,phase))) - enddo otherSlipSystems; enddo otherSlipFamilies - - enddo mySlipSystems - enddo mySlipFamilies startIndex=1_pInt - endIndex=ns + endIndex=prm%totalNslip stt%rhoEdge=>plasticState(phase)%state(startIndex:endIndex,:) stt%rhoEdge= spread(prm%rho0,2,NofMyPhase) dotState(instance)%rhoEdge=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho startIndex=endIndex+1_pInt - endIndex=endIndex+ns + endIndex=endIndex+prm%totalNslip stt%rhoEdgeDip=>plasticState(phase)%state(startIndex:endIndex,:) stt%rhoEdgeDip= spread(prm%rhoDip0,2,NofMyPhase) dotState(instance)%rhoEdgeDip=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho startIndex=endIndex+1_pInt - endIndex=endIndex+ns + endIndex=endIndex+prm%totalNslip stt%accshear_slip=>plasticState(phase)%state(startIndex:endIndex,:) dotState(instance)%accshear_slip=>plasticState(phase)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal @@ -441,9 +409,39 @@ do p = 1_pInt, size(phase_plasticityInstance) plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally end associate - endif myPhase2 - enddo initializeInstances + enddo + + + allocate(plastic_disloUCLA_forestProjectionEdge(maxval(plastic_disloUCLA_totalNslip),& + maxval(plastic_disloUCLA_totalNslip),maxNinstance), & + source=0.0_pReal) + +do p = 1_pInt, size(phase_plasticityInstance) + if (phase_plasticity(p) /= PLASTICITY_DISLOUCLA_ID) cycle + associate(prm => param(phase_plasticityInstance(p)), & + dot => dotState(phase_plasticityInstance(p)), & + stt => state(phase_plasticityInstance(p)), & + mse => microstructure(phase_plasticityInstance(p))) + + mySlipFamilies: do f = 1_pInt,size(prm%Nslip,1) + index_myFamily = sum(prm%Nslip(1:f-1_pInt)) ! index in truncated slip system list + mySlipSystems: do j = 1_pInt,prm%Nslip(f) + + !* Calculation of forest projections for edge dislocations + otherSlipFamilies: do o = 1_pInt,size(prm%Nslip,1) + index_otherFamily = sum(prm%Nslip(1:o-1_pInt)) + otherSlipSystems: do k = 1_pInt,prm%Nslip(o) + plastic_disloUCLA_forestProjectionEdge(index_myFamily+j,index_otherFamily+k,instance) = & + abs(math_mul3x3(lattice_sn(:,sum(lattice_NslipSystem(1:f-1,p))+j,p), & + lattice_st(:,sum(lattice_NslipSystem(1:o-1,p))+k,p))) + enddo otherSlipSystems; enddo otherSlipFamilies + + enddo mySlipSystems + enddo mySlipFamilies + end associate + +enddo end subroutine plastic_disloUCLA_init @@ -572,7 +570,6 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) EdgeDipMinDistance,& AtomicVolume,& VacancyDiffusion,& - DotRhoMultiplication,& EdgeDipDistance, & DotRhoEdgeDipAnnihilation, & DotRhoEdgeEdgeAnnihilation, & @@ -588,22 +585,18 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) ns = plastic_disloUCLA_totalNslip(instance) dotState(instance)%whole(:,of) = 0.0_pReal - associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) + associate(prm => param(instance), stt => state(instance),dot => dotState(instance), mse => microstructure(instance)) !* Dislocation density evolution call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) dotState(instance)%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal do j = 1_pInt, prm%totalNslip + EdgeDipMinDistance = plastic_disloUCLA_CEdgeDipMinDistance(instance)*prm%burgers(j) + AtomicVolume = plastic_disloUCLA_CAtomicVolume(instance)*prm%burgers(j)**(3.0_pReal) + - !* Multiplication - DotRhoMultiplication = abs(dotState(instance)%accshear_slip(j,of))/& - (prm%burgers(j)* & - mse%mfp(j,of)) - !* Dipole formation - EdgeDipMinDistance = & - plastic_disloUCLA_CEdgeDipMinDistance(instance)*prm%burgers(j) if (dEq0(tau_slip_pos(j))) then DotRhoDipFormation = 0.0_pReal else @@ -620,7 +613,7 @@ do j = 1_pInt, prm%totalNslip !* Spontaneous annihilation of 2 single edge dislocations DotRhoEdgeEdgeAnnihilation = & ((2.0_pReal*EdgeDipMinDistance)/prm%burgers(j))*& - stt%rhoEdge(j,of)*abs(dotState(instance)%accshear_slip(j,of)) + stt%rhoEdge(j,of)*abs(dot%accshear_slip(j,of)) !* Spontaneous annihilation of a single edge dislocation with a dipole constituent DotRhoEdgeDipAnnihilation = & @@ -628,8 +621,6 @@ do j = 1_pInt, prm%totalNslip stt%rhoEdgeDip(j,of)*abs(dotState(instance)%accshear_slip(j,of)) !* Dislocation dipole climb - AtomicVolume = & - plastic_disloUCLA_CAtomicVolume(instance)*prm%burgers(j)**(3.0_pReal) VacancyDiffusion = prm%D0*exp(-plastic_disloUCLA_Qsd(instance)/(kB*Temperature)) if (dEq0(tau_slip_pos(j))) then DotRhoEdgeDipClimb = 0.0_pReal @@ -642,12 +633,14 @@ do j = 1_pInt, prm%totalNslip endif !* Edge dislocation density rate of change - dotState(instance)%rhoEdge(j,of) = & - DotRhoMultiplication-DotRhoDipFormation-DotRhoEdgeEdgeAnnihilation + dot%rhoEdge(j,of) = abs(dot%accshear_slip(j,of))/(prm%burgers(j)*mse%mfp(j,of)) & ! multiplication + - DotRhoDipFormation & + - DotRhoEdgeEdgeAnnihilation !* Edge dislocation dipole density rate of change - dotState(instance)%rhoEdgeDip(j,of) = & - DotRhoDipFormation-DotRhoEdgeDipAnnihilation-DotRhoEdgeDipClimb + dot%rhoEdgeDip(j,of) = DotRhoDipFormation & + - DotRhoEdgeDipAnnihilation & + - DotRhoEdgeDipClimb enddo From 91a2748131bd86baf7332bcd14e818226eac77dd Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 4 Dec 2018 19:35:29 +0100 Subject: [PATCH 038/147] simplifying --- src/math.f90 | 2 +- src/plastic_disloUCLA.f90 | 108 ++++++++++++++++---------------------- 2 files changed, 45 insertions(+), 65 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 440ee5303..75d7f4490 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -2617,7 +2617,7 @@ end function math_rotate_forward3333 !> @brief limits a scalar value to a certain range (either one or two sided) ! Will return NaN if left > right !-------------------------------------------------------------------------------------------------- -real(pReal) pure function math_clip(a, left, right) +real(pReal) pure elemental function math_clip(a, left, right) use, intrinsic :: & IEEE_arithmetic diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index a6ff87323..d3385d755 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -26,10 +26,7 @@ module plastic_disloUCLA plastic_disloUCLA_totalNslip !< total number of active slip systems for each instance real(pReal), dimension(:), allocatable, private :: & - plastic_disloUCLA_CAtomicVolume, & !< atomic volume in Bugers vector unit - plastic_disloUCLA_Qsd, & !< activation energy for dislocation climb - plastic_disloUCLA_CEdgeDipMinDistance, & !< - plastic_disloUCLA_dipoleFormationFactor !< scaling factor for dipole formation: 0: off, 1: on. other values not useful + plastic_disloUCLA_Qsd !< activation energy for dislocation climb real(pReal), dimension(:,:,:), allocatable, private :: & @@ -200,13 +197,8 @@ material_allocatePlasticState allocate(plastic_disloUCLA_totalNslip(maxNinstance), source=0_pInt) - - allocate(plastic_disloUCLA_CAtomicVolume(maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_CEdgeDipMinDistance(maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_Qsd(maxNinstance), source=0.0_pReal) - allocate(plastic_disloUCLA_dipoleFormationFactor(maxNinstance), source=1.0_pReal) !should be on by default allocate(param(maxNinstance)) allocate(state(maxNinstance)) @@ -267,9 +259,11 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%D0 = config_phase(p)%getFloat('d0') plastic_disloUCLA_Qsd(phase_plasticityInstance(p)) = config_phase(p)%getFloat('qsd') - plastic_disloUCLA_CEdgeDipMinDistance(phase_plasticityInstance(p)) = config_phase(p)%getFloat('cedgedipmindistance') - plastic_disloUCLA_CAtomicVolume(phase_plasticityInstance(p)) = config_phase(p)%getFloat('catomicvolume') - plastic_disloUCLA_dipoleFormationFactor(phase_plasticityInstance(p)) = config_phase(p)%getFloat('dipoleformationfactor') + + + prm%dipoleformation = config_phase(p)%getFloat('dipoleformationfactor') > 0.0_pReal !should be on by default + prm%atomicVolume = config_phase(p)%getFloat('catomicvolume') * prm%burgers**3.0_pReal + prm%minDipDistance = config_phase(p)%getFloat('cedgedipmindistance') * prm%burgers ! expand: family => system prm%rho0 = math_expand(prm%rho0, prm%Nslip) @@ -285,15 +279,17 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%v0 = math_expand(prm%v0, prm%Nslip) prm%B = math_expand(prm%B, prm%Nslip) prm%clambda = math_expand(prm%clambda, prm%Nslip) + prm%atomicVolume = math_expand(prm%atomicVolume, prm%Nslip) + prm%minDipDistance = math_expand(prm%minDipDistance, prm%Nslip) instance = phase_plasticityInstance(p) plastic_disloUCLA_totalNslip(instance) = prm%totalNslip !if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') - if (prm%D0 <= 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='D0 ('//PLASTICITY_DISLOUCLA_label//')') - if (plastic_disloUCLA_Qsd(instance) <= 0.0_pReal) & - call IO_error(211_pInt,el=instance,ext_msg='Qsd ('//PLASTICITY_DISLOUCLA_label//')') + ! if (prm%D0 <= 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='D0 ('//PLASTICITY_DISLOUCLA_label//')') + ! if (plastic_disloUCLA_Qsd(instance) <= 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='Qsd ('//PLASTICITY_DISLOUCLA_label//')') ! if (plastic_disloUCLA_aTolRho(instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='aTolRho ('//PLASTICITY_DISLOUCLA_label//')') @@ -564,82 +560,70 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) temperature !< temperature at integration point integer(pInt), intent(in) :: & instance, of - integer(pInt) :: ns,j + integer(pInt) :: j real(pReal) :: & - EdgeDipMinDistance,& - AtomicVolume,& VacancyDiffusion,& - EdgeDipDistance, & DotRhoEdgeDipAnnihilation, & DotRhoEdgeEdgeAnnihilation, & - ClimbVelocity, & - DotRhoEdgeDipClimb, & - DotRhoDipFormation + DotRhoEdgeDipClimb real(pReal), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos, gdot_slip_neg,& tau_slip_pos,& tau_slip_neg, & - dgdot_dtauslip_neg,dgdot_dtauslip_pos + dgdot_dtauslip_neg,dgdot_dtauslip_pos,DotRhoDipFormation, ClimbVelocity, EdgeDipDistance - ns = plastic_disloUCLA_totalNslip(instance) - dotState(instance)%whole(:,of) = 0.0_pReal - associate(prm => param(instance), stt => state(instance),dot => dotState(instance), mse => microstructure(instance)) - !* Dislocation density evolution + + + associate(prm => param(instance), stt => state(instance),dot => dotState(instance), mse => microstructure(instance)) + call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) - dotState(instance)%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal + + dot%whole(:,of) = 0.0_pReal + dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal -do j = 1_pInt, prm%totalNslip - EdgeDipMinDistance = plastic_disloUCLA_CEdgeDipMinDistance(instance)*prm%burgers(j) - AtomicVolume = plastic_disloUCLA_CAtomicVolume(instance)*prm%burgers(j)**(3.0_pReal) + do j = 1_pInt, prm%totalNslip !* Dipole formation - if (dEq0(tau_slip_pos(j))) then - DotRhoDipFormation = 0.0_pReal + if (dEq0(tau_slip_pos(j)) .or. (.not. prm%dipoleformation)) then + DotRhoDipFormation(j) = 0.0_pReal + EdgeDipDistance(j)=mse%mfp(j,of) !ToDo MD@FR: correct? was not handled properly before else - EdgeDipDistance = & + EdgeDipDistance(j) = & (3.0_pReal*prm%mu*prm%burgers(j))/& (16.0_pReal*pi*abs(tau_slip_pos(j))) - if (EdgeDipDistance>mse%mfp(j,of)) EdgeDipDistance=mse%mfp(j,of) - if (EdgeDipDistancemse%mfp(j,of)) EdgeDipDistance(j)=mse%mfp(j,of) + if (EdgeDipDistance(j) Date: Tue, 4 Dec 2018 20:50:02 +0100 Subject: [PATCH 039/147] vectorized --- src/plastic_disloUCLA.f90 | 66 +++++++++++++++------------------------ 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index d3385d755..f205c34f2 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -551,7 +551,8 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) tol_math_check, & dEq0 use math, only: & - pi + PI, & + math_clip implicit none real(pReal), dimension(3,3), intent(in):: & @@ -559,22 +560,17 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & - instance, of + instance, of integer(pInt) :: j real(pReal) :: & - VacancyDiffusion,& - DotRhoEdgeDipAnnihilation, & - DotRhoEdgeEdgeAnnihilation, & - DotRhoEdgeDipClimb + VacancyDiffusion real(pReal), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos, gdot_slip_neg,& tau_slip_pos,& tau_slip_neg, & - dgdot_dtauslip_neg,dgdot_dtauslip_pos,DotRhoDipFormation, ClimbVelocity, EdgeDipDistance - - - + dgdot_dtauslip_neg,dgdot_dtauslip_pos,DotRhoDipFormation, ClimbVelocity, EdgeDipDistance, & + DotRhoEdgeDipClimb associate(prm => param(instance), stt => state(instance),dot => dotState(instance), mse => microstructure(instance)) @@ -584,47 +580,35 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) dot%whole(:,of) = 0.0_pReal dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal + VacancyDiffusion = prm%D0*exp(-plastic_disloUCLA_Qsd(instance)/(kB*Temperature)) + + where(dEq0(tau_slip_pos) .or. (.not. prm%dipoleformation)) + EdgeDipDistance = mse%mfp(:,of) !ToDo MD@FR: correct? was not handled properly before + DotRhoDipFormation = 0.0_pReal + DotRhoEdgeDipClimb = 0.0_pReal + else where + EdgeDipDistance = math_clip((3.0_pReal*prm%mu*prm%burgers)/(16.0_pReal*PI*abs(tau_slip_pos)), & + prm%minDipDistance, & ! lower limit + mse%mfp(:,of)) ! upper limit + DotRhoDipFormation = merge(((2.0_pReal*EdgeDipDistance)/prm%burgers)* stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)), & + 0.0_pReal, & + prm%dipoleformation) + ClimbVelocity = ((3.0_pReal*prm%mu*VacancyDiffusion*prm%atomicVolume)/(2.0_pReal*pi*kB*Temperature)) & + * (1.0_pReal/(EdgeDipDistance+prm%minDipDistance)) + DotRhoEdgeDipClimb = (4.0_pReal*ClimbVelocity*stt%rhoEdgeDip(:,of))/(EdgeDipDistance-prm%minDipDistance) + end where + do j = 1_pInt, prm%totalNslip - - - !* Dipole formation - if (dEq0(tau_slip_pos(j)) .or. (.not. prm%dipoleformation)) then - DotRhoDipFormation(j) = 0.0_pReal - EdgeDipDistance(j)=mse%mfp(j,of) !ToDo MD@FR: correct? was not handled properly before - else - EdgeDipDistance(j) = & - (3.0_pReal*prm%mu*prm%burgers(j))/& - (16.0_pReal*pi*abs(tau_slip_pos(j))) - if (EdgeDipDistance(j)>mse%mfp(j,of)) EdgeDipDistance(j)=mse%mfp(j,of) - if (EdgeDipDistance(j) Date: Tue, 4 Dec 2018 21:05:34 +0100 Subject: [PATCH 040/147] simplified --- src/plastic_disloUCLA.f90 | 54 ++++++++++++++------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index f205c34f2..4df9c9779 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -446,8 +446,6 @@ end subroutine plastic_disloUCLA_init !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) - use math, only: & - pi use material, only: & phase_plasticityInstance, & phaseAt, phasememberAt, & @@ -463,34 +461,27 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) integer(pInt) :: & instance, & - ns,s, & + s, & of real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & - invLambdaSlip - !* Shortened notation + invLambdaSlip ! 1/mean free distance between 2 forest dislocations seen by a moving dislocation + of = phasememberAt(ipc,ip,el) instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) - ns = plastic_disloUCLA_totalNslip(instance) - associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) - !* 1/mean free distance between 2 forest dislocations seen by a moving dislocation - forall (s = 1_pInt:ns) & - invLambdaSlip(s) = & - sqrt(dot_product((stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of)),& - plastic_disloUCLA_forestProjectionEdge(1:ns,s,instance)))/ & - prm%Clambda(s) - !* mean free path between 2 obstacles seen by a moving dislocation - + forall (s = 1_pInt:prm%totalNslip) & + invLambdaSlip(s) = sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & + plastic_disloUCLA_forestProjectionEdge(:,s,instance))) & + / prm%Clambda(s) + mse%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*invLambdaSlip) - !* threshold stress for dislocation motion - forall (s = 1_pInt:ns) & - mse%threshold_stress(s,of) = & - prm%mu*prm%burgers(s)*& - sqrt(dot_product(stt%rhoEdge(1_pInt:ns,of)+stt%rhoEdgeDip(1_pInt:ns,of),& - prm%interaction_SlipSlip(s,1:ns))) + forall (s = 1_pInt:prm%totalNslip) & + mse%threshold_stress(s,of) = prm%mu*prm%burgers(s) & + * sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & + prm%interaction_SlipSlip(s,:))) end associate @@ -518,7 +509,6 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg - !* Shortened notation of = phasememberAt(ipc,ip,el) instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) associate(prm => param(instance)) @@ -598,20 +588,14 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) DotRhoEdgeDipClimb = (4.0_pReal*ClimbVelocity*stt%rhoEdgeDip(:,of))/(EdgeDipDistance-prm%minDipDistance) end where - do j = 1_pInt, prm%totalNslip - - dot%rhoEdge(j,of) = abs(dot%accshear_slip(j,of))/(prm%burgers(j)*mse%mfp(j,of)) & ! multiplication - - DotRhoDipFormation(j) & - - ((2.0_pReal*prm%minDipDistance(j))/prm%burgers(j))*& - stt%rhoEdge(j,of)*abs(dot%accshear_slip(j,of)) !* Spontaneous annihilation of 2 single edge dislocations - - dot%rhoEdgeDip(j,of) = DotRhoDipFormation(j) & - - ((2.0_pReal*prm%minDipDistance(j))/prm%burgers(j))*& - stt%rhoEdgeDip(j,of)*abs(dot%accshear_slip(j,of)) & !* Spontaneous annihilation of a single edge dislocation with a dipole constituent - - DotRhoEdgeDipClimb(j) + dot%rhoEdge(:,of) = abs(dot%accshear_slip(:,of))/(prm%burgers*mse%mfp(:,of)) & ! multiplication + - DotRhoDipFormation & + - ((2.0_pReal*prm%minDipDistance)/prm%burgers)*stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)) !* Spontaneous annihilation of 2 single edge dislocations + + dot%rhoEdgeDip(:,of) = DotRhoDipFormation & + - ((2.0_pReal*prm%minDipDistance)/prm%burgers)* stt%rhoEdgeDip(:,of)*abs(dot%accshear_slip(:,of)) & !* Spontaneous annihilation of a single edge dislocation with a dipole constituent + - DotRhoEdgeDipClimb - - enddo end associate end subroutine plastic_disloUCLA_dotState From 10445606ba9a89511e01ecefdf3ef08f2ab0c1f3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 4 Dec 2018 21:33:32 +0100 Subject: [PATCH 041/147] simplified API + general polishing --- src/constitutive.f90 | 7 +- src/plastic_disloUCLA.f90 | 329 ++++++++++++++++++-------------------- 2 files changed, 161 insertions(+), 175 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index f01c82f75..d8fb42bd2 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -164,7 +164,7 @@ subroutine constitutive_init() if (any(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID)) call plastic_phenopowerlaw_init if (any(phase_plasticity == PLASTICITY_KINEHARDENING_ID)) call plastic_kinehardening_init(FILEUNIT) if (any(phase_plasticity == PLASTICITY_DISLOTWIN_ID)) call plastic_dislotwin_init(FILEUNIT) - if (any(phase_plasticity == PLASTICITY_DISLOUCLA_ID)) call plastic_disloucla_init(FILEUNIT) + if (any(phase_plasticity == PLASTICITY_DISLOUCLA_ID)) call plastic_disloucla_init if (any(phase_plasticity == PLASTICITY_NONLOCAL_ID)) then call plastic_nonlocal_init(FILEUNIT) call plastic_nonlocal_stateInit() @@ -530,8 +530,9 @@ subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, S6, Fi, ipc, ip, e call plastic_dislotwin_LpAndItsTangent (Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of) case (PLASTICITY_DISLOUCLA_ID) plasticityType - call plastic_disloucla_LpAndItsTangent (Lp,dLp_dMp,Mp, & - temperature(ho)%p(tme), ipc,ip,el) + of = phasememberAt(ipc,ip,el) + instance = phase_plasticityInstance(material_phase(ipc,ip,el)) + call plastic_disloucla_LpAndItsTangent (Lp,dLp_dMp,Mp,temperature(ho)%p(tme),instance,of) end select plasticityType diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 4df9c9779..b61672221 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -25,9 +25,6 @@ module plastic_disloUCLA integer(pInt), dimension(:), allocatable, private :: & plastic_disloUCLA_totalNslip !< total number of active slip systems for each instance - real(pReal), dimension(:), allocatable, private :: & - plastic_disloUCLA_Qsd !< activation energy for dislocation climb - real(pReal), dimension(:,:,:), allocatable, private :: & plastic_disloUCLA_forestProjectionEdge !< matrix of forest projections of edge dislocations for each instance @@ -51,7 +48,8 @@ module plastic_disloUCLA grainSize, & SolidSolutionStrength, & !< Strength due to elements in solid solution mu, & - D0 !< prefactor for self-diffusion coefficient + D0, & !< prefactor for self-diffusion coefficient + Qsd !< activation energy for dislocation climb real(pReal), allocatable, dimension(:) :: & B, & !< friction coeff. B (kMC) rho0, & !< initial edge dislocation density per slip system for each family and instance @@ -129,7 +127,7 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_init(fileUnit) +subroutine plastic_disloUCLA_init() #if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & compiler_version, & @@ -140,8 +138,6 @@ subroutine plastic_disloUCLA_init(fileUnit) debug_constitutive,& debug_levelBasic use math, only: & - math_Mandel3333to66, & - math_Voigt66to3333, & math_mul3x3, & math_expand use IO, only: & @@ -155,18 +151,16 @@ subroutine plastic_disloUCLA_init(fileUnit) PLASTICITY_DISLOUCLA_ID, & material_phase, & plasticState, & -material_allocatePlasticState + material_allocatePlasticState use config, only: & MATERIAL_partPhase, & config_phase use lattice implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt) :: maxNinstance,phase,maxTotalNslip,& + integer(pInt) :: maxNinstance,& f,instance,j,k,o, i, & - outputSize, & + outputSize, phase, & offset_slip, index_myFamily, index_otherFamily, & startIndex, endIndex, p integer(pInt) :: sizeState, sizeDotState @@ -197,7 +191,6 @@ material_allocatePlasticState allocate(plastic_disloUCLA_totalNslip(maxNinstance), source=0_pInt) - allocate(plastic_disloUCLA_Qsd(maxNinstance), source=0.0_pReal) allocate(param(maxNinstance)) @@ -250,7 +243,6 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%omega = config_phase(p)%getFloats('omega') prm%B = config_phase(p)%getFloats('friction_coeff') - !prm%viscosity = config_phase(p)%getFloats('viscosity') prm%SolidSolutionStrength = config_phase(p)%getFloat('solidsolutionstrength') @@ -258,7 +250,7 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%grainSize = config_phase(p)%getFloat('grainsize') prm%D0 = config_phase(p)%getFloat('d0') - plastic_disloUCLA_Qsd(phase_plasticityInstance(p)) = config_phase(p)%getFloat('qsd') + prm%Qsd= config_phase(p)%getFloat('qsd') prm%dipoleformation = config_phase(p)%getFloat('dipoleformationfactor') > 0.0_pReal !should be on by default @@ -296,7 +288,6 @@ do p = 1_pInt, size(phase_plasticityInstance) else slipActive allocate(prm%rho0(0)) allocate(prm%rhoDip0(0)) - endif slipActive @@ -491,26 +482,20 @@ end subroutine plastic_disloUCLA_microstructure !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el) - use material, only: & - material_phase, & - phase_plasticityInstance, & - phaseAt, phasememberAt +subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,instance,of) implicit none - integer(pInt), intent(in) :: ipc,ip,el + integer(pInt), intent(in) :: instance, of real(pReal), intent(in) :: Temperature real(pReal), dimension(3,3), intent(in) :: Mp real(pReal), dimension(3,3), intent(out) :: Lp real(pReal), dimension(3,3,3,3), intent(out) :: dLp_dMp - integer(pInt) :: instance,of,i,k,l,m,n + integer(pInt) :: i,k,l,m,n - real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + real(pReal), dimension(param(instance)%totalNslip) :: & gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg - of = phasememberAt(ipc,ip,el) - instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) associate(prm => param(instance)) Lp = 0.0_pReal @@ -525,7 +510,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,ipc,ip,el + dgdot_dtauslip_pos(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_pos(m,n,i) & + dgdot_dtauslip_neg(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_neg(m,n,i) enddo slipSystems -end associate + end associate Lp = 0.5_pReal * Lp dLp_dMp = 0.5_pReal * dLp_dMp @@ -551,7 +536,6 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) temperature !< temperature at integration point integer(pInt), intent(in) :: & instance, of - integer(pInt) :: j real(pReal) :: & VacancyDiffusion @@ -570,9 +554,9 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) dot%whole(:,of) = 0.0_pReal dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal - VacancyDiffusion = prm%D0*exp(-plastic_disloUCLA_Qsd(instance)/(kB*Temperature)) + VacancyDiffusion = prm%D0*exp(-prm%Qsd/(kB*Temperature)) - where(dEq0(tau_slip_pos) .or. (.not. prm%dipoleformation)) + where(dEq0(tau_slip_pos)) EdgeDipDistance = mse%mfp(:,of) !ToDo MD@FR: correct? was not handled properly before DotRhoDipFormation = 0.0_pReal DotRhoEdgeDipClimb = 0.0_pReal @@ -706,7 +690,7 @@ math_mul33xx33 instance,of integer(pInt) :: & - i,j + j real(pReal) :: StressRatio_p,StressRatio_pminus1,& BoltzmannRatio,DotGamma0,stressRatio,& dvel_slip, vel_slip @@ -716,152 +700,153 @@ instance,of - gdot_slip_pos = 0.0_pReal - gdot_slip_neg = 0.0_pReal - dgdot_dtauslip_pos = 0.0_pReal - dgdot_dtauslip_neg = 0.0_pReal - do j = 1_pInt, prm%totalNslip - !* Boltzmann ratio - BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) - !* Initial shear rates - DotGamma0 = stt%rhoEdge(j,of)*prm%burgers(j)*prm%v0(j) - !* Resolved shear stress on slip system - tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) - tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) + gdot_slip_pos = 0.0_pReal + gdot_slip_neg = 0.0_pReal + dgdot_dtauslip_pos = 0.0_pReal + dgdot_dtauslip_neg = 0.0_pReal + do j = 1_pInt, prm%totalNslip + !* Boltzmann ratio + BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) + !* Initial shear rates + DotGamma0 = stt%rhoEdge(j,of)*prm%burgers(j)*prm%v0(j) + !* Resolved shear stress on slip system + tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) + tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) - significantPositiveTau: if((abs(tau_slip_pos(j))-mse%threshold_stress(j, of)) > tol_math_check) then - !* Stress ratio - stressRatio = ((abs(tau_slip_pos(j))-mse%threshold_stress(j, of))/& - (prm%solidSolutionStrength+& - prm%tau_Peierls(j))) - stressRatio_p = stressRatio** prm%p(j) - stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) - !* Shear rates due to slip - vel_slip = 2.0_pReal*prm%burgers(j) & - * prm%kink_height(j) * prm%omega(j) & - * ( mse%mfp(j,of) - prm%kink_width(j) ) & - * (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & - / ( & - 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & - ) - - gdot_slip_pos(j) = DotGamma0 * sign(vel_slip,tau_slip_pos(j)) - !* Derivatives of shear rates - - dvel_slip = & - 2.0_pReal*prm%burgers(j) & - * prm%kink_height(j) * prm%omega(j) & - * ( mse%mfp(j,of) - prm%kink_width(j) ) & - * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & - + tau_slip_pos(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& - *BoltzmannRatio*prm%p(j)& - *prm%q(j)/& - (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & - ) & - * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & - ) & - - (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & - * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & - + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& - *BoltzmannRatio*prm%p(j)& - *prm%q(j)/& - (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& - ) & - ) & - / ( & - ( & - 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & - )**2.0_pReal & - ) - - dgdot_dtauslip_pos(j) = DotGamma0 * dvel_slip - - endif significantPositiveTau - - - significantNegativeTau: if((abs(tau_slip_neg(j))-mse%threshold_stress(j, of)) > tol_math_check) then - !* Stress ratios - stressRatio = ((abs(tau_slip_neg(j))-mse%threshold_stress(j, of))/& - (prm%solidSolutionStrength+& - prm%tau_Peierls(j))) - stressRatio_p = stressRatio** prm%p(j) - stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) - !* Shear rates due to slip - vel_slip = 2.0_pReal*prm%burgers(j) & - * prm%kink_height(j) * prm%omega(j) & - * ( mse%mfp(j,of) - prm%kink_width(j) ) & - * (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & - / ( & - 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & - ) + significantPositiveTau: if((abs(tau_slip_pos(j))-mse%threshold_stress(j, of)) > tol_math_check) then + !* Stress ratio + stressRatio = ((abs(tau_slip_pos(j))-mse%threshold_stress(j, of))/& + (prm%solidSolutionStrength+& + prm%tau_Peierls(j))) + stressRatio_p = stressRatio** prm%p(j) + stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) + !* Shear rates due to slip + vel_slip = 2.0_pReal*prm%burgers(j) & + * prm%kink_height(j) * prm%omega(j) & + * ( mse%mfp(j,of) - prm%kink_width(j) ) & + * (tau_slip_pos(j) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + / ( & + 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + + prm%omega(j) * prm%B(j) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + ) - gdot_slip_neg(j) = DotGamma0 * sign(vel_slip,tau_slip_neg(j)) - !* Derivatives of shear rates - dvel_slip = & - 2.0_pReal*prm%burgers(j) & - * prm%kink_height(j) * prm%omega(j) & - * ( mse%mfp(j,of) - prm%kink_width(j) ) & - * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & - + tau_slip_neg(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& - *BoltzmannRatio*prm%p(j)& - *prm%q(j)/& - (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & - ) & - * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & - ) & - - (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & - * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & - + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& - *BoltzmannRatio*prm%p(j)& - *prm%q(j)/& - (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& - ) & - ) & - / ( & - ( & - 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & - )**2.0_pReal & - ) + gdot_slip_pos(j) = DotGamma0 * sign(vel_slip,tau_slip_pos(j)) + !* Derivatives of shear rates + + dvel_slip = & + 2.0_pReal*prm%burgers(j) & + * prm%kink_height(j) * prm%omega(j) & + * ( mse%mfp(j,of) - prm%kink_width(j) ) & + * ( & + (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + + tau_slip_pos(j) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& + *BoltzmannRatio*prm%p(j)& + *prm%q(j)/& + (prm%solidSolutionStrength+prm%tau_Peierls(j))*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & + ) & + * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + + prm%omega(j) * prm%B(j) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + ) & + - (tau_slip_pos(j) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + + prm%omega(j) * prm%B(j) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& + *BoltzmannRatio*prm%p(j)& + *prm%q(j)/& + (prm%solidSolutionStrength+prm%tau_Peierls(j))*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& + ) & + ) & + / ( & + ( & + 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + + prm%omega(j) * prm%B(j) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + )**2.0_pReal & + ) + + dgdot_dtauslip_pos(j) = DotGamma0 * dvel_slip + + endif significantPositiveTau - dgdot_dtauslip_neg(j) = DotGamma0 * dvel_slip - endif significantNegativeTau - enddo + significantNegativeTau: if((abs(tau_slip_neg(j))-mse%threshold_stress(j, of)) > tol_math_check) then + !* Stress ratios + stressRatio = ((abs(tau_slip_neg(j))-mse%threshold_stress(j, of))/& + (prm%solidSolutionStrength+& + prm%tau_Peierls(j))) + stressRatio_p = stressRatio** prm%p(j) + stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) + !* Shear rates due to slip + vel_slip = 2.0_pReal*prm%burgers(j) & + * prm%kink_height(j) * prm%omega(j) & + * ( mse%mfp(j,of) - prm%kink_width(j) ) & + * (tau_slip_neg(j) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + / ( & + 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + + prm%omega(j) * prm%B(j) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + ) + + gdot_slip_neg(j) = DotGamma0 * sign(vel_slip,tau_slip_neg(j)) + !* Derivatives of shear rates + dvel_slip = & + 2.0_pReal*prm%burgers(j) & + * prm%kink_height(j) * prm%omega(j) & + * ( mse%mfp(j,of) - prm%kink_width(j) ) & + * ( & + (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + + tau_slip_neg(j) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& + *BoltzmannRatio*prm%p(j)& + *prm%q(j)/& + (prm%solidSolutionStrength+prm%tau_Peierls(j))*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & + ) & + * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + + prm%omega(j) * prm%B(j) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + ) & + - (tau_slip_neg(j) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + + prm%omega(j) * prm%B(j) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& + *BoltzmannRatio*prm%p(j)& + *prm%q(j)/& + (prm%solidSolutionStrength+prm%tau_Peierls(j))*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& + ) & + ) & + / ( & + ( & + 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + + prm%omega(j) * prm%B(j) & + *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + )**2.0_pReal & + ) + + + dgdot_dtauslip_neg(j) = DotGamma0 * dvel_slip + endif significantNegativeTau + enddo end associate + end subroutine kinetics end module plastic_disloUCLA From a34e27cfcd164393b63e9f20a7a85c1d18b57e88 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 4 Dec 2018 21:53:22 +0100 Subject: [PATCH 042/147] dependentState is more descriptive than microstructure --- src/constitutive.f90 | 13 +++++++++---- src/plastic_disloUCLA.f90 | 24 ++++++------------------ 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index d8fb42bd2..e3c118bad 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -384,7 +384,9 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el) use prec, only: & pReal use material, only: & + phasememberAt, & phase_plasticity, & + phase_plasticityInstance, & material_phase, & material_homogenizationAt, & temperature, & @@ -396,8 +398,8 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el) plastic_nonlocal_microstructure use plastic_dislotwin, only: & plastic_dislotwin_microstructure - use plastic_disloucla, only: & - plastic_disloucla_microstructure + use plastic_disloUCLA, only: & + plastic_disloUCLA_dependentState implicit none integer(pInt), intent(in) :: & @@ -409,7 +411,8 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el) Fp !< plastic deformation gradient integer(pInt) :: & ho, & !< homogenization - tme !< thermal member position + tme, & !< thermal member position + instance, of real(pReal), intent(in), dimension(:,:,:,:) :: & orientations !< crystal orientations as quaternions @@ -420,7 +423,9 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el) case (PLASTICITY_DISLOTWIN_ID) plasticityType call plastic_dislotwin_microstructure(temperature(ho)%p(tme),ipc,ip,el) case (PLASTICITY_DISLOUCLA_ID) plasticityType - call plastic_disloucla_microstructure(temperature(ho)%p(tme),ipc,ip,el) + of = phasememberAt(ipc,ip,el) + instance = phase_plasticityInstance(material_phase(ipc,ip,el)) + call plastic_disloUCLA_dependentState(temperature(ho)%p(tme),instance,of) case (PLASTICITY_NONLOCAL_ID) plasticityType call plastic_nonlocal_microstructure (Fe,Fp,ip,el) end select plasticityType diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index b61672221..51fabe042 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -112,7 +112,7 @@ module plastic_disloUCLA public :: & plastic_disloUCLA_init, & - plastic_disloUCLA_microstructure, & + plastic_disloUCLA_dependentState, & plastic_disloUCLA_LpAndItsTangent, & plastic_disloUCLA_dotState, & plastic_disloUCLA_postResults @@ -436,30 +436,18 @@ end subroutine plastic_disloUCLA_init !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) - use material, only: & - phase_plasticityInstance, & - phaseAt, phasememberAt, & - material_phase +subroutine plastic_disloUCLA_dependentState(temperature,instance,of) implicit none - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element + integer(pInt), intent(in) :: instance, of real(pReal), intent(in) :: & temperature !< temperature at IP integer(pInt) :: & - instance, & - s, & - of - real(pReal), dimension(plastic_disloUCLA_totalNslip(phase_plasticityInstance(material_phase(ipc,ip,el)))) :: & + s + real(pReal), dimension(param(instance)%totalNslip) :: & invLambdaSlip ! 1/mean free distance between 2 forest dislocations seen by a moving dislocation - of = phasememberAt(ipc,ip,el) - instance = phase_plasticityInstance(phaseAt(ipc,ip,el)) - associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) forall (s = 1_pInt:prm%totalNslip) & @@ -476,7 +464,7 @@ subroutine plastic_disloUCLA_microstructure(temperature,ipc,ip,el) end associate -end subroutine plastic_disloUCLA_microstructure +end subroutine plastic_disloUCLA_dependentState !-------------------------------------------------------------------------------------------------- From 9caa91ee149d19fe1c3f6a61cc7edad69e3ec2fb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 4 Dec 2018 22:30:07 +0100 Subject: [PATCH 043/147] polishing --- src/constitutive.f90 | 2 +- src/plastic_disloUCLA.f90 | 396 ++++++++++++++++++-------------------- 2 files changed, 190 insertions(+), 208 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index e3c118bad..8294047e7 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -425,7 +425,7 @@ subroutine constitutive_microstructure(orientations, Fe, Fp, ipc, ip, el) case (PLASTICITY_DISLOUCLA_ID) plasticityType of = phasememberAt(ipc,ip,el) instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - call plastic_disloUCLA_dependentState(temperature(ho)%p(tme),instance,of) + call plastic_disloUCLA_dependentState(instance,of) case (PLASTICITY_NONLOCAL_ID) plasticityType call plastic_nonlocal_microstructure (Fe,Fp,ip,el) end select plasticityType diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 51fabe042..bb06618e4 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -29,7 +29,7 @@ module plastic_disloUCLA real(pReal), dimension(:,:,:), allocatable, private :: & plastic_disloUCLA_forestProjectionEdge !< matrix of forest projections of edge dislocations for each instance - enum, bind(c) + enum, bind(c) enumerator :: undefined_ID, & rho_ID, & rhoDip_ID, & @@ -59,13 +59,13 @@ module plastic_disloUCLA v0, & !< dislocation velocity prefactor [m/s] for each family and instance CLambda, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance p, & !< p-exponent in glide velocity - q, & !< q-exponent in glide velocity - !* mobility law parameters - kink_height, & !< height of the kink pair - kink_width, & !< width of the kink pair - omega, & !< attempt frequency for kink pair nucleation + q, & !< q-exponent in glide velocity + !* mobility law parameters + kink_height, & !< height of the kink pair + kink_width, & !< width of the kink pair + omega, & !< attempt frequency for kink pair nucleation viscosity, & !< friction coeff. B (kMC) - !* + !* tau_Peierls, & nonSchmidCoeff, & atomicVolume, & @@ -88,28 +88,28 @@ module plastic_disloUCLA end type !< container type for internal constitutive parameters type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance) - - type, private :: tDisloUCLAState + + type, private :: tDisloUCLAState real(pReal), pointer, dimension(:,:) :: & rhoEdge, & rhoEdgeDip, & accshear_slip, & whole - end type + end type - type, private :: tDisloUCLAMicrostructure + type, private :: tDisloUCLAdependentState real(pReal), allocatable, dimension(:,:) :: & mfp, & threshold_stress - end type tDisloUCLAMicrostructure + end type tDisloUCLAdependentState type(tDisloUCLAState ), allocatable, dimension(:), private :: & state, & dotState - type(tDisloUCLAMicrostructure), allocatable, dimension(:), private :: & - microstructure - + type(tDisloUCLAdependentState), allocatable, dimension(:), private :: & + dependentState + public :: & plastic_disloUCLA_init, & plastic_disloUCLA_dependentState, & @@ -156,15 +156,15 @@ subroutine plastic_disloUCLA_init() MATERIAL_partPhase, & config_phase use lattice - + implicit none integer(pInt) :: maxNinstance,& - f,instance,j,k,o, i, & - outputSize, phase, & + f,j,k,o, i, & + outputSize, & offset_slip, index_myFamily, index_otherFamily, & - startIndex, endIndex, p - integer(pInt) :: sizeState, sizeDotState - integer(pInt) :: NofMyPhase + startIndex, endIndex, p, & + sizeState, sizeDotState, & + NofMyPhase character(len=65536) :: & structure = '' character(len=65536), dimension(:), allocatable :: outputs @@ -172,16 +172,16 @@ subroutine plastic_disloUCLA_init() integer(pInt), dimension(0), parameter :: emptyIntArray = [integer(pInt)::] real(pReal), dimension(0), parameter :: emptyRealArray = [real(pReal)::] character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::] - + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOUCLA_label//' init -+>>>' write(6,'(/,a)') ' Cereceda et al., International Journal of Plasticity 78, 2016, 242-256' write(6,'(/,a)') ' http://dx.doi.org/10.1016/j.ijplas.2015.09.002' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - + maxNinstance = int(count(phase_plasticity == PLASTICITY_DISLOUCLA_ID),pInt) if (maxNinstance == 0_pInt) return - + if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance @@ -192,19 +192,19 @@ subroutine plastic_disloUCLA_init() allocate(plastic_disloUCLA_totalNslip(maxNinstance), source=0_pInt) - + allocate(param(maxNinstance)) allocate(state(maxNinstance)) allocate(dotState(maxNinstance)) - allocate(microstructure(maxNinstance)) + allocate(dependentState(maxNinstance)) -do p = 1_pInt, size(phase_plasticityInstance) + do p = 1_pInt, size(phase_plasticityInstance) if (phase_plasticity(p) /= PLASTICITY_DISLOUCLA_ID) cycle associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & stt => state(phase_plasticityInstance(p)), & - mse => microstructure(phase_plasticityInstance(p))) + dst => dependentState(phase_plasticityInstance(p))) structure = config_phase(p)%getString('lattice_structure') prm%mu = lattice_mu(p) @@ -273,9 +273,8 @@ do p = 1_pInt, size(phase_plasticityInstance) prm%clambda = math_expand(prm%clambda, prm%Nslip) prm%atomicVolume = math_expand(prm%atomicVolume, prm%Nslip) prm%minDipDistance = math_expand(prm%minDipDistance, prm%Nslip) - - instance = phase_plasticityInstance(p) - plastic_disloUCLA_totalNslip(instance) = prm%totalNslip + + plastic_disloUCLA_totalNslip(phase_plasticityInstance(p)) = prm%totalNslip !if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') ! if (prm%D0 <= 0.0_pReal) & @@ -283,61 +282,10 @@ do p = 1_pInt, size(phase_plasticityInstance) ! if (plastic_disloUCLA_Qsd(instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='Qsd ('//PLASTICITY_DISLOUCLA_label//')') ! if (plastic_disloUCLA_aTolRho(instance) <= 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='aTolRho ('//PLASTICITY_DISLOUCLA_label//')') - - else slipActive - allocate(prm%rho0(0)) - allocate(prm%rhoDip0(0)) - endif slipActive - - -#if defined(__GFORTRAN__) - outputs = ['GfortranBug86277'] - outputs = config_phase(p)%getStrings('(output)',defaultVal=outputs) - if (outputs(1) == 'GfortranBug86277') outputs = emptyStringArray -#else - outputs = config_phase(p)%getStrings('(output)',defaultVal=emptyStringArray) -#endif - allocate(prm%outputID(0)) - - do i = 1_pInt, size(outputs) - outputID = undefined_ID - outputSize = prm%totalNslip - select case(trim(outputs(i))) - case ('edge_density') - outputID = merge(rho_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('dipole_density') - outputID = merge(rhoDip_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('shear_rate','shearrate','shear_rate_slip','shearrate_slip') - outputID = merge(shearrate_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('accumulated_shear','accumulatedshear','accumulated_shear_slip') - outputID = merge(accumulatedshear_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('mfp','mfp_slip') - outputID = merge(mfp_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('resolved_stress','resolved_stress_slip') - outputID = merge(resolvedstress_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('threshold_stress','threshold_stress_slip') - outputID = merge(thresholdstress_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('edge_dipole_distance') - outputID = merge(dipoleDistance_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('stress_exponent') - outputID = merge(stressexponent_ID,undefined_ID,prm%totalNslip>0_pInt) - end select - - if (outputID /= undefined_ID) then - plastic_disloUCLA_output(i,phase_plasticityInstance(p)) = outputs(i) - plastic_disloUCLA_sizePostResult(i,phase_plasticityInstance(p)) = outputSize - prm%outputID = [prm%outputID, outputID] - endif - - enddo - - - - - !if (plastic_disloUCLA_rhoEdge0(f,instance) < 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='aTolRho ('//PLASTICITY_DISLOUCLA_label//')') + !if (plastic_disloUCLA_rhoEdge0(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdge0 ('//PLASTICITY_DISLOUCLA_label//')') - !if (plastic_disloUCLA_rhoEdgeDip0(f,instance) < 0.0_pReal) & + !if (plastic_disloUCLA_rhoEdgeDip0(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdgeDip0 ('//PLASTICITY_DISLOUCLA_label//')') !if (plastic_disloUCLA_burgersPerSlipFamily(f,instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='slipBurgers ('//PLASTICITY_DISLOUCLA_label//')') @@ -346,55 +294,101 @@ do p = 1_pInt, size(phase_plasticityInstance) !if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') - phase = p - NofMyPhase=count(material_phase==phase) - instance = phase_plasticityInstance(phase) + + else slipActive + allocate(prm%rho0(0)) + allocate(prm%rhoDip0(0)) + endif slipActive + + +#if defined(__GFORTRAN__) + outputs = ['GfortranBug86277'] + outputs = config_phase(p)%getStrings('(output)',defaultVal=outputs) + if (outputs(1) == 'GfortranBug86277') outputs = emptyStringArray +#else + outputs = config_phase(p)%getStrings('(output)',defaultVal=emptyStringArray) +#endif + allocate(prm%outputID(0)) + + do i = 1_pInt, size(outputs) + outputID = undefined_ID + outputSize = prm%totalNslip + select case(trim(outputs(i))) + case ('edge_density') + outputID = merge(rho_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('dipole_density') + outputID = merge(rhoDip_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('shear_rate','shearrate','shear_rate_slip','shearrate_slip') + outputID = merge(shearrate_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('accumulated_shear','accumulatedshear','accumulated_shear_slip') + outputID = merge(accumulatedshear_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('mfp','mfp_slip') + outputID = merge(mfp_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('resolved_stress','resolved_stress_slip') + outputID = merge(resolvedstress_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('threshold_stress','threshold_stress_slip') + outputID = merge(thresholdstress_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('edge_dipole_distance') + outputID = merge(dipoleDistance_ID,undefined_ID,prm%totalNslip>0_pInt) + case ('stress_exponent') + outputID = merge(stressexponent_ID,undefined_ID,prm%totalNslip>0_pInt) + end select + + if (outputID /= undefined_ID) then + plastic_disloUCLA_output(i,phase_plasticityInstance(p)) = outputs(i) + plastic_disloUCLA_sizePostResult(i,phase_plasticityInstance(p)) = outputSize + prm%outputID = [prm%outputID, outputID] + endif + + enddo + + NofMyPhase=count(material_phase==p) !-------------------------------------------------------------------------------------------------- ! allocate state arrays - sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * prm%totalNslip - sizeState = sizeDotState + sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * prm%totalNslip + sizeState = sizeDotState - call material_allocatePlasticState(phase,NofMyPhase,sizeState,sizeDotState,0_pInt, & + call material_allocatePlasticState(p,NofMyPhase,sizeState,sizeDotState,0_pInt, & prm%totalNslip,0_pInt,0_pInt) - plasticState(phase)%sizePostResults = sum(plastic_disloUCLA_sizePostResult(:,phase_plasticityInstance(p))) + plasticState(p)%sizePostResults = sum(plastic_disloUCLA_sizePostResult(:,phase_plasticityInstance(p))) - offset_slip = 2_pInt*plasticState(phase)%nSlip - plasticState(phase)%slipRate => & - plasticState(phase)%dotState(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) - plasticState(phase)%accumulatedSlip => & - plasticState(phase)%state (offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) - - startIndex=1_pInt - endIndex=prm%totalNslip - stt%rhoEdge=>plasticState(phase)%state(startIndex:endIndex,:) - stt%rhoEdge= spread(prm%rho0,2,NofMyPhase) - dotState(instance)%rhoEdge=>plasticState(phase)%dotState(startIndex:endIndex,:) - plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho + offset_slip = 2_pInt*plasticState(p)%nSlip + plasticState(p)%slipRate => & + plasticState(p)%dotState(offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NofMyPhase) + plasticState(p)%accumulatedSlip => & + plasticState(p)%state (offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NofMyPhase) - startIndex=endIndex+1_pInt - endIndex=endIndex+prm%totalNslip - stt%rhoEdgeDip=>plasticState(phase)%state(startIndex:endIndex,:) - stt%rhoEdgeDip= spread(prm%rhoDip0,2,NofMyPhase) - dotState(instance)%rhoEdgeDip=>plasticState(phase)%dotState(startIndex:endIndex,:) - plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho + startIndex=1_pInt + endIndex=prm%totalNslip + stt%rhoEdge=>plasticState(p)%state(startIndex:endIndex,:) + stt%rhoEdge= spread(prm%rho0,2,NofMyPhase) + dot%rhoEdge=>plasticState(p)%dotState(startIndex:endIndex,:) + plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho - startIndex=endIndex+1_pInt - endIndex=endIndex+prm%totalNslip - stt%accshear_slip=>plasticState(phase)%state(startIndex:endIndex,:) - dotState(instance)%accshear_slip=>plasticState(phase)%dotState(startIndex:endIndex,:) - plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal + startIndex=endIndex+1_pInt + endIndex=endIndex+prm%totalNslip + stt%rhoEdgeDip=>plasticState(p)%state(startIndex:endIndex,:) + stt%rhoEdgeDip= spread(prm%rhoDip0,2,NofMyPhase) + dot%rhoEdgeDip=>plasticState(p)%dotState(startIndex:endIndex,:) + plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho - dotState(instance)%whole => plasticState(phase)%dotState + startIndex=endIndex+1_pInt + endIndex=endIndex+prm%totalNslip + stt%accshear_slip=>plasticState(p)%state(startIndex:endIndex,:) + dot%accshear_slip=>plasticState(p)%dotState(startIndex:endIndex,:) + plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal + + dot%whole => plasticState(p)%dotState - allocate(mse%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) - allocate(mse%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) + allocate(dst%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) + allocate(dst%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) - plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally end associate enddo @@ -404,63 +398,60 @@ do p = 1_pInt, size(phase_plasticityInstance) maxval(plastic_disloUCLA_totalNslip),maxNinstance), & source=0.0_pReal) -do p = 1_pInt, size(phase_plasticityInstance) + do p = 1_pInt, size(phase_plasticityInstance) if (phase_plasticity(p) /= PLASTICITY_DISLOUCLA_ID) cycle associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & stt => state(phase_plasticityInstance(p)), & - mse => microstructure(phase_plasticityInstance(p))) + dst => dependentState(phase_plasticityInstance(p))) mySlipFamilies: do f = 1_pInt,size(prm%Nslip,1) index_myFamily = sum(prm%Nslip(1:f-1_pInt)) ! index in truncated slip system list mySlipSystems: do j = 1_pInt,prm%Nslip(f) - + !* Calculation of forest projections for edge dislocations otherSlipFamilies: do o = 1_pInt,size(prm%Nslip,1) index_otherFamily = sum(prm%Nslip(1:o-1_pInt)) otherSlipSystems: do k = 1_pInt,prm%Nslip(o) - plastic_disloUCLA_forestProjectionEdge(index_myFamily+j,index_otherFamily+k,instance) = & + plastic_disloUCLA_forestProjectionEdge(index_myFamily+j,index_otherFamily+k,phase_plasticityInstance(p)) = & abs(math_mul3x3(lattice_sn(:,sum(lattice_NslipSystem(1:f-1,p))+j,p), & lattice_st(:,sum(lattice_NslipSystem(1:o-1,p))+k,p))) enddo otherSlipSystems; enddo otherSlipFamilies - + enddo mySlipSystems enddo mySlipFamilies end associate enddo - + end subroutine plastic_disloUCLA_init !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_dependentState(temperature,instance,of) +subroutine plastic_disloUCLA_dependentState(instance,of) implicit none integer(pInt), intent(in) :: instance, of - real(pReal), intent(in) :: & - temperature !< temperature at IP integer(pInt) :: & - s + i real(pReal), dimension(param(instance)%totalNslip) :: & invLambdaSlip ! 1/mean free distance between 2 forest dislocations seen by a moving dislocation - associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) - - forall (s = 1_pInt:prm%totalNslip) & - invLambdaSlip(s) = sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & - plastic_disloUCLA_forestProjectionEdge(:,s,instance))) & - / prm%Clambda(s) - - mse%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*invLambdaSlip) + associate(prm => param(instance), stt => state(instance),dst => dependentState(instance)) - forall (s = 1_pInt:prm%totalNslip) & - mse%threshold_stress(s,of) = prm%mu*prm%burgers(s) & + forall (i = 1_pInt:prm%totalNslip) + invLambdaSlip(i) = sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & + plastic_disloUCLA_forestProjectionEdge(:,i,instance))) & + / prm%Clambda(i) + dst%threshold_stress(i,of) = prm%mu*prm%burgers(i) & * sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & - prm%interaction_SlipSlip(s,:))) + prm%interaction_SlipSlip(i,:))) + end forall + + dst%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*invLambdaSlip) end associate @@ -471,7 +462,7 @@ end subroutine plastic_disloUCLA_dependentState !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,instance,of) - + implicit none integer(pInt), intent(in) :: instance, of real(pReal), intent(in) :: Temperature @@ -483,13 +474,13 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,instance, real(pReal), dimension(param(instance)%totalNslip) :: & gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg - + associate(prm => param(instance)) - + Lp = 0.0_pReal dLp_dMp = 0.0_pReal - - call kinetics(Mp,Temperature,instance,of, & + + call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) slipSystems: do i = 1_pInt, prm%totalNslip Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) @@ -534,24 +525,24 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) dgdot_dtauslip_neg,dgdot_dtauslip_pos,DotRhoDipFormation, ClimbVelocity, EdgeDipDistance, & DotRhoEdgeDipClimb - associate(prm => param(instance), stt => state(instance),dot => dotState(instance), mse => microstructure(instance)) + associate(prm => param(instance), stt => state(instance),dot => dotState(instance), dst => dependentState(instance)) - call kinetics(Mp,Temperature,instance,of, & + call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) - + dot%whole(:,of) = 0.0_pReal dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal VacancyDiffusion = prm%D0*exp(-prm%Qsd/(kB*Temperature)) where(dEq0(tau_slip_pos)) - EdgeDipDistance = mse%mfp(:,of) !ToDo MD@FR: correct? was not handled properly before + EdgeDipDistance = dst%mfp(:,of) !ToDo MD@FR: correct? was not handled properly before DotRhoDipFormation = 0.0_pReal DotRhoEdgeDipClimb = 0.0_pReal else where EdgeDipDistance = math_clip((3.0_pReal*prm%mu*prm%burgers)/(16.0_pReal*PI*abs(tau_slip_pos)), & prm%minDipDistance, & ! lower limit - mse%mfp(:,of)) ! upper limit + dst%mfp(:,of)) ! upper limit DotRhoDipFormation = merge(((2.0_pReal*EdgeDipDistance)/prm%burgers)* stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)), & 0.0_pReal, & prm%dipoleformation) @@ -560,7 +551,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) DotRhoEdgeDipClimb = (4.0_pReal*ClimbVelocity*stt%rhoEdgeDip(:,of))/(EdgeDipDistance-prm%minDipDistance) end where - dot%rhoEdge(:,of) = abs(dot%accshear_slip(:,of))/(prm%burgers*mse%mfp(:,of)) & ! multiplication + dot%rhoEdge(:,of) = abs(dot%accshear_slip(:,of))/(prm%burgers*dst%mfp(:,of)) & ! multiplication - DotRhoDipFormation & - ((2.0_pReal*prm%minDipDistance)/prm%burgers)*stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)) !* Spontaneous annihilation of 2 single edge dislocations @@ -569,10 +560,10 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) - DotRhoEdgeDipClimb end associate - + end subroutine plastic_disloUCLA_dotState - + !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- @@ -601,7 +592,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos, & gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg - associate( prm => param(instance), stt => state(instance), mse => microstructure(instance)) + associate( prm => param(instance), stt => state(instance), dst => dependentState(instance)) postResults = 0.0_pReal c = 0_pInt @@ -614,7 +605,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe case (rhoDip_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%rhoEdgeDip(1_pInt:prm%totalNslip,of) case (shearrate_ID,stressexponent_ID) - call kinetics(Mp,Temperature,instance,of, & + call kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) if (prm%outputID(o) == shearrate_ID) then @@ -631,13 +622,13 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe case (accumulatedshear_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%accshear_slip(1_pInt:prm%totalNslip, of) case (mfp_ID) - postResults(c+1_pInt:c+prm%totalNslip) = mse%mfp(1_pInt:prm%totalNslip, of) + postResults(c+1_pInt:c+prm%totalNslip) = dst%mfp(1_pInt:prm%totalNslip, of) case (resolvedstress_ID) do i = 1_pInt, prm%totalNslip postResults(c+i) =math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,i)) enddo case (thresholdstress_ID) - postResults(c+1_pInt:c+prm%totalNslip) = mse%threshold_stress(1_pInt:prm%totalNslip,of) + postResults(c+1_pInt:c+prm%totalNslip) = dst%threshold_stress(1_pInt:prm%totalNslip,of) case (dipoleDistance_ID) do i = 1_pInt, prm%totalNslip if (dNeq0(abs(math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,i))))) then @@ -646,7 +637,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe else postResults(c+i) = huge(1.0_pReal) endif - postResults(c+i)=min(postResults(c+i),mse%mfp(i,of)) + postResults(c+i)=min(postResults(c+i),dst%mfp(i,of)) enddo end select @@ -684,50 +675,45 @@ instance,of dvel_slip, vel_slip real(pReal), intent(out), dimension(plastic_disloUCLA_totalNslip(instance)) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg - associate(prm => param(instance), stt => state(instance),mse => microstructure(instance)) - - gdot_slip_pos = 0.0_pReal gdot_slip_neg = 0.0_pReal dgdot_dtauslip_pos = 0.0_pReal dgdot_dtauslip_neg = 0.0_pReal + + associate(prm => param(instance), stt => state(instance),dst => dependentState(instance)) + + do j = 1_pInt, prm%totalNslip - !* Boltzmann ratio + BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) - !* Initial shear rates DotGamma0 = stt%rhoEdge(j,of)*prm%burgers(j)*prm%v0(j) - !* Resolved shear stress on slip system + tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) - significantPositiveTau: if((abs(tau_slip_pos(j))-mse%threshold_stress(j, of)) > tol_math_check) then - !* Stress ratio - stressRatio = ((abs(tau_slip_pos(j))-mse%threshold_stress(j, of))/& - (prm%solidSolutionStrength+& - prm%tau_Peierls(j))) + significantPositiveTau: if((abs(tau_slip_pos(j))-dst%threshold_stress(j, of)) > tol_math_check) then + + stressRatio = ((abs(tau_slip_pos(j))-dst%threshold_stress(j, of)) & + / (prm%solidSolutionStrength+prm%tau_Peierls(j))) stressRatio_p = stressRatio** prm%p(j) stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) - !* Shear rates due to slip - vel_slip = 2.0_pReal*prm%burgers(j) & - * prm%kink_height(j) * prm%omega(j) & - * ( mse%mfp(j,of) - prm%kink_width(j) ) & + + vel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & + * ( dst%mfp(j,of) - prm%kink_width(j) ) & * (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) - - gdot_slip_pos(j) = DotGamma0 * sign(vel_slip,tau_slip_pos(j)) - !* Derivatives of shear rates - dvel_slip = & - 2.0_pReal*prm%burgers(j) & - * prm%kink_height(j) * prm%omega(j) & - * ( mse%mfp(j,of) - prm%kink_width(j) ) & + gdot_slip_pos(j) = DotGamma0 * sign(vel_slip,tau_slip_pos(j)) + + dvel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & + * ( dst%mfp(j,of) - prm%kink_width(j) ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_pos(j) & @@ -739,14 +725,14 @@ instance,of ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_pos(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& *BoltzmannRatio*prm%p(j)& *prm%q(j)/& @@ -758,7 +744,7 @@ instance,of ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & ) @@ -768,63 +754,59 @@ instance,of endif significantPositiveTau - significantNegativeTau: if((abs(tau_slip_neg(j))-mse%threshold_stress(j, of)) > tol_math_check) then - !* Stress ratios - stressRatio = ((abs(tau_slip_neg(j))-mse%threshold_stress(j, of))/& - (prm%solidSolutionStrength+& - prm%tau_Peierls(j))) + significantNegativeTau: if((abs(tau_slip_neg(j))-dst%threshold_stress(j, of)) > tol_math_check) then + + stressRatio = ((abs(tau_slip_neg(j))-dst%threshold_stress(j, of)) & + / (prm%solidSolutionStrength+prm%tau_Peierls(j))) stressRatio_p = stressRatio** prm%p(j) stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) - !* Shear rates due to slip - vel_slip = 2.0_pReal*prm%burgers(j) & - * prm%kink_height(j) * prm%omega(j) & - * ( mse%mfp(j,of) - prm%kink_width(j) ) & + + vel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & + * ( dst%mfp(j,of) - prm%kink_width(j) ) & * (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) - + gdot_slip_neg(j) = DotGamma0 * sign(vel_slip,tau_slip_neg(j)) - !* Derivatives of shear rates - dvel_slip = & - 2.0_pReal*prm%burgers(j) & - * prm%kink_height(j) * prm%omega(j) & - * ( mse%mfp(j,of) - prm%kink_width(j) ) & + + dvel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & + * ( dst%mfp(j,of) - prm%kink_width(j) ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + tau_slip_neg(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& *BoltzmannRatio*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & ) & - (tau_slip_neg(j) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& + *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& *BoltzmannRatio*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& ) & ) & / ( & ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * prm%B(j) & - *(( mse%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & + *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & )**2.0_pReal & ) From d7f505f24e3369f2e09c28b089b9fce0a8f41e79 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 7 Dec 2018 10:34:45 -0500 Subject: [PATCH 044/147] making sure that roots are taken from strictly non-negative summation results --- lib/damask/orientation.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index c1862e13c..7b90c5c09 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -311,10 +311,12 @@ class Quaternion: randomSeed = int(binascii.hexlify(os.urandom(4)),16) np.random.seed(randomSeed) r = np.random.random(3) - w = math.cos(2.0*math.pi*r[0])*math.sqrt(r[2]) - x = math.sin(2.0*math.pi*r[1])*math.sqrt(1.0-r[2]) - y = math.cos(2.0*math.pi*r[1])*math.sqrt(1.0-r[2]) - z = math.sin(2.0*math.pi*r[0])*math.sqrt(r[2]) + A = math.sqrt(max(0.0,r[2])) + B = math.sqrt(max(0.0,1.0-r[2])) + w = math.cos(2.0*math.pi*r[0])*A + x = math.sin(2.0*math.pi*r[1])*B + y = math.cos(2.0*math.pi*r[1])*B + z = math.sin(2.0*math.pi*r[0])*A return cls(quat=[w,x,y,z]) @@ -372,10 +374,10 @@ class Quaternion: # Rowenhorst_etal2015 MSMSE: value of P is selected as -1 P = -1.0 - w = 0.5*math.sqrt(1.+m[0,0]+m[1,1]+m[2,2]) - x = P*0.5*math.sqrt(1.+m[0,0]-m[1,1]-m[2,2]) - y = P*0.5*math.sqrt(1.-m[0,0]+m[1,1]-m[2,2]) - z = P*0.5*math.sqrt(1.-m[0,0]-m[1,1]+m[2,2]) + w = 0.5*math.sqrt(max(0.0,1.0+m[0,0]+m[1,1]+m[2,2])) + x = P*0.5*math.sqrt(max(0.0,1.0+m[0,0]-m[1,1]-m[2,2])) + y = P*0.5*math.sqrt(max(0.0,1.0-m[0,0]+m[1,1]-m[2,2])) + z = P*0.5*math.sqrt(max(0.0,1.0-m[0,0]-m[1,1]+m[2,2])) x *= -1 if m[2,1] < m[1,2] else 1 y *= -1 if m[0,2] < m[2,0] else 1 @@ -668,7 +670,7 @@ class Symmetry: if color: # have to return color array if inSST: rgb = np.power(theComponents/np.linalg.norm(theComponents),0.5) # smoothen color ramps - rgb = np.minimum(np.ones(3,dtype=float),rgb) # limit to maximum intensity + rgb = np.minimum(np.ones(3,dtype=float),rgb) # limit to maximum intensity rgb /= max(rgb) # normalize to (HS)V = 1 else: rgb = np.zeros(3,dtype=float) From 3d7a73a0dee6ec30d57a7e078a05d523b9f06088 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 7 Dec 2018 22:02:30 -0500 Subject: [PATCH 045/147] added option to return angleAxis as flat list --- lib/damask/orientation.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 7b90c5c09..6fd0993ea 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -257,7 +257,8 @@ class Quaternion: ]) def asAngleAxis(self, - degrees = False): + degrees = False, + flat = False): if self.q > 1.: self.normalize() @@ -270,8 +271,12 @@ class Quaternion: angle *= -1. s *= -1. - return (np.degrees(angle) if degrees else angle, - np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s)) + if flat: + return np.hstack((np.degrees(angle) if degrees else angle, + np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s))) + else: + return (np.degrees(angle) if degrees else angle, + np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s)) def asRodrigues(self): return np.inf*np.ones(3) if self.q == 0.0 else self.p/self.q @@ -749,8 +754,9 @@ class Orientation: rodrigues = property(asRodrigues) def asAngleAxis(self, - degrees = False): - return self.quaternion.asAngleAxis(degrees) + degrees = False, + flat = False): + return self.quaternion.asAngleAxis(degrees,flat) angleAxis = property(asAngleAxis) def asMatrix(self): From ac45a9e2d33c2e10ea037c19632c695df92c6bff Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 7 Dec 2018 22:03:14 -0500 Subject: [PATCH 046/147] more output options, frame input changed to "lab expressed in crystal" --- processing/post/addOrientations.py | 76 +++++++++++++++--------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index b4bda4770..b4a8ed07c 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -21,19 +21,22 @@ Additional (globally fixed) rotations of the lab frame and/or crystal frame can """, version = scriptID) -outputChoices = ['quaternion','rodrigues','eulers'] +outputChoices = { + 'quaternion': ['quat',4], + 'rodrigues': ['rodr',3], + 'eulers': ['eulr',3], + 'matrix': ['mtrx',9], + 'angleaxis': ['aaxs',4], + } + parser.add_option('-o', '--output', dest = 'output', action = 'extend', metavar = '', help = 'output orientation formats {{{}}}'.format(', '.join(outputChoices))) -parser.add_option('-s', '--symmetry', - dest = 'symmetry', - type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string', - help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:]))) parser.add_option('-d', '--degrees', dest = 'degrees', action = 'store_true', - help = 'angles are given in degrees [%default]') + help = 'all angles in degrees') parser.add_option('-R', '--labrotation', dest='labrotation', type = 'float', nargs = 4, metavar = ' '.join(['float']*4), @@ -58,21 +61,20 @@ parser.add_option( '--quaternion', dest = 'quaternion', type = 'string', metavar = 'string', help = 'quaternion label') -parser.add_option('-a', - dest = 'a', +parser.add_option('-x', + dest = 'x', type = 'string', metavar = 'string', - help = 'crystal frame a vector label') -parser.add_option('-b', - dest = 'b', + help = 'label of lab x vector (expressed in crystal coords)') +parser.add_option('-y', + dest = 'y', type = 'string', metavar = 'string', - help = 'crystal frame b vector label') -parser.add_option('-c', - dest = 'c', + help = 'label of lab y vector (expressed in crystal coords)') +parser.add_option('-z', + dest = 'z', type = 'string', metavar = 'string', - help = 'crystal frame c vector label') + help = 'label of lab z vector (expressed in crystal coords)') parser.set_defaults(output = [], - symmetry = damask.Symmetry.lattices[-1], labrotation = (0.,1.,1.,1.), # no rotation about 1,1,1 crystalrotation = (0.,1.,1.,1.), # no rotation about 1,1,1 degrees = False, @@ -86,9 +88,9 @@ if options.output == [] or (not set(options.output).issubset(set(outputChoices)) input = [options.eulers is not None, options.rodrigues is not None, - options.a is not None and \ - options.b is not None and \ - options.c is not None, + options.x is not None and \ + options.y is not None and \ + options.z is not None, options.matrix is not None, options.quaternion is not None, ] @@ -97,13 +99,13 @@ if np.sum(input) != 1: parser.error('needs exactly one input format.') (label,dim,inputtype) = [(options.eulers,3,'eulers'), (options.rodrigues,3,'rodrigues'), - ([options.a,options.b,options.c],[3,3,3],'frame'), + ([options.x,options.y,options.z],[3,3,3],'frame'), (options.matrix,9,'matrix'), (options.quaternion,4,'quaternion'), ][np.where(input)[0][0]] # select input label that was requested toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians -r = damask.Quaternion().fromAngleAxis(toRadians*options.crystalrotation[0],options.crystalrotation[1:]) # crystal frame rotation -R = damask.Quaternion().fromAngleAxis(toRadians*options. labrotation[0],options. labrotation[1:]) # lab frame rotation +r = damask.Quaternion.fromAngleAxis(toRadians*options.crystalrotation[0],options.crystalrotation[1:]) # crystal frame rotation +R = damask.Quaternion.fromAngleAxis(toRadians*options. labrotation[0],options. labrotation[1:]) # lab frame rotation # --- loop over input files ------------------------------------------------------------------------ @@ -137,32 +139,28 @@ for name in filenames: table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) for output in options.output: - if output == 'quaternion': table.labels_append(['{}_{}_{}({})'.format(i+1,'quat',options.symmetry,label) for i in range(4)]) - elif output == 'rodrigues': table.labels_append(['{}_{}_{}({})'.format(i+1,'rodr',options.symmetry,label) for i in range(3)]) - elif output == 'eulers': table.labels_append(['{}_{}_{}({})'.format(i+1,'eulr',options.symmetry,label) for i in range(3)]) + if output in outputChoices: + table.labels_append(['{}_{}({})'.format(i+1,outputChoices[output][0],label) \ + for i in range(outputChoices[output][1])]) table.head_write() # ------------------------------------------ process data ------------------------------------------ outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table - if inputtype == 'eulers': - o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians, - symmetry = options.symmetry).reduced() + if inputtype == 'eulers': + o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians) elif inputtype == 'rodrigues': - o = damask.Orientation(Rodrigues= np.array(list(map(float,table.data[column:column+3]))), - symmetry = options.symmetry).reduced() + o = damask.Orientation(Rodrigues= np.array(list(map(float,table.data[column:column+3])))) elif inputtype == 'matrix': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3).transpose(), - symmetry = options.symmetry).reduced() + o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3)) elif inputtype == 'frame': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column[0]:column[0]+3] + \ - table.data[column[1]:column[1]+3] + \ - table.data[column[2]:column[2]+3]))).reshape(3,3), - symmetry = options.symmetry).reduced() + M = np.array(list(map(float,table.data[column[0]:column[0]+3] + \ + table.data[column[1]:column[1]+3] + \ + table.data[column[2]:column[2]+3]))).reshape(3,3).T + o = damask.Orientation(matrix = M/np.linalg.norm(M,axis=0)) elif inputtype == 'quaternion': - o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))), - symmetry = options.symmetry).reduced() + o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4])))) o.quaternion = r*o.quaternion*R # apply additional lab and crystal frame rotations @@ -170,6 +168,8 @@ for name in filenames: if output == 'quaternion': table.data_append(o.asQuaternion()) elif output == 'rodrigues': table.data_append(o.asRodrigues()) elif output == 'eulers': table.data_append(o.asEulers(degrees=options.degrees)) + elif output == 'matrix': table.data_append(o.asMatrix()) + elif output == 'angleaxis': table.data_append(o.asAngleAxis(degrees=options.degrees,flat=True)) outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization ----------------------------------- From 18b791bb63ce946720d4cd5d9cbffb0beeebc096 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 7 Dec 2018 22:06:47 -0500 Subject: [PATCH 047/147] fixed bug (not clear how it escaped up to now) --- lib/damask/asciitable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/damask/asciitable.py b/lib/damask/asciitable.py index 839adb944..448587db0 100644 --- a/lib/damask/asciitable.py +++ b/lib/damask/asciitable.py @@ -493,8 +493,8 @@ class ASCIItable(): (d if str(c) != str(labels[present[i]]) else 1))) use = np.array(columns) if len(columns) > 0 else None - - self.tags = list(np.array(self.tags)[use]) # update labels with valid subset + + self.tags = list(np.array(self.__IO__['tags'])[use]) # update labels with valid subset self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2) # self.data = np.genfromtxt(self.__IO__['in'],dtype=None,names=self.tags,usecols=use) From 02c2e902a7a89d3e0bffbc2dcb7ff0d86527959b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 6 Dec 2018 22:23:34 +0100 Subject: [PATCH 048/147] texture component test also needs a closer look --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 368ca94db..99daef5e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -364,12 +364,12 @@ Phenopowerlaw_singleSlip: - master - release -TextureComponents: - stage: spectral - script: TextureComponents/test.py - except: - - master - - release +#TextureComponents: +# stage: spectral +# script: TextureComponents/test.py +# except: +# - master +# - release ################################################################################################### From bb81731bc7d19e85f1e58a961cdbfe4de9fcc5ed Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 7 Dec 2018 03:32:36 +0100 Subject: [PATCH 049/147] [skip ci] updated version information after successful test of v2.0.2-1122-g2349341e --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 85ef1a02a..3ad5cdbde 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1107-g17716b4f +v2.0.2-1122-g2349341e From 0b99c92fb575344269cee3f4c4b31449eb3f278f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 8 Dec 2018 07:25:39 +0100 Subject: [PATCH 050/147] updated tests --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index e9f93abae..64c39e902 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit e9f93abaecafbfbf11072ae70bca213a7201ed38 +Subproject commit 64c39e90200a8dd90dff3665e27050d9db81ac0d From b777253dd64997a0f97717636fb221ff47fa5d83 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 8 Dec 2018 11:52:55 -0500 Subject: [PATCH 051/147] quat->Eulers now returns always positive angles --- lib/damask/orientation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 6fd0993ea..7131d39e3 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -263,8 +263,8 @@ class Quaternion: self.normalize() s = math.sqrt(1. - self.q**2) - x = 2*self.q**2 - 1. - y = 2*self.q * s + x = 2.*self.q**2 - 1. + y = 2.*self.q * s angle = math.atan2(y,x) if angle < 0.0: @@ -300,6 +300,7 @@ class Quaternion: math.atan2((P*self.q*self.p[1]+self.p[0]*self.p[2])/chi,( self.p[1]*self.p[2]-P*self.q*self.p[0])/chi), ]) + eulers %= 2.0*math.pi return np.degrees(eulers) if degrees else eulers From 1de37b9397b3c294beecc474d32694395ccff0b9 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 8 Dec 2018 12:01:46 -0500 Subject: [PATCH 052/147] polished formatting of comments --- lib/damask/orientation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 7131d39e3..db2baad92 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -87,11 +87,11 @@ class Quaternion: """Multiplication""" # Rowenhorst_etal2015 MSMSE: value of P is selected as -1 P = -1.0 - try: # quaternion + try: # quaternion return self.__class__(q=self.q*other.q - np.dot(self.p,other.p), p=self.q*other.p + other.q*self.p + P * np.cross(self.p,other.p)) except: pass - try: # vector (perform passive rotation) + try: # vector (perform passive rotation) ( x, y, z) = self.p (Vx,Vy,Vz) = other[0:3] A = self.q*self.q - np.dot(self.p,self.p) @@ -104,7 +104,7 @@ class Quaternion: A*Vz + B*z + C*(x*Vy - y*Vx), ]) except: pass - try: # scalar + try: # scalar return self.__class__(q=self.q*other, p=self.p*other) except: @@ -114,7 +114,7 @@ class Quaternion: """In-place multiplication""" # Rowenhorst_etal2015 MSMSE: value of P is selected as -1 P = -1.0 - try: # Quaternion + try: # Quaternion self.q = self.q*other.q - np.dot(self.p,other.p) self.p = self.q*other.p + other.q*self.p + P * np.cross(self.p,other.p) except: pass @@ -237,7 +237,7 @@ class Quaternion: def asList(self): return [self.q]+list(self.p) - def asM(self): # to find Averaging Quaternions (see F. Landis Markley et al.) + def asM(self): # to find Averaging Quaternions (see F. Landis Markley et al.) return np.outer(self.asList(),self.asList()) def asMatrix(self): @@ -300,7 +300,7 @@ class Quaternion: math.atan2((P*self.q*self.p[1]+self.p[0]*self.p[2])/chi,( self.p[1]*self.p[2]-P*self.q*self.p[0])/chi), ]) - eulers %= 2.0*math.pi + eulers %= 2.0*math.pi # enforce positive angles return np.degrees(eulers) if degrees else eulers From 3f8726464d20e3bdc37961a08a58309524ef4e70 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 8 Dec 2018 13:22:22 -0500 Subject: [PATCH 053/147] addOrientations now checks its input for convention conformity --- processing/post/addOrientations.py | 37 ++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index b4a8ed07c..efd4dac24 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -9,6 +9,29 @@ import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) +# -------------------------------------------------------------------- +# convention conformity checks +# -------------------------------------------------------------------- + +def check_Eulers(eulers): + if np.any(eulers < 0.0) or np.any(eulers > 2.0*math.pi) or eulers[1] > math.pi: # Euler angles within valid range? + raise ValueError('Euler angles outside of [0..2π],[0..π],[0..2π].\n{} {} {}.'.format(*eulers)) + return eulers + +def check_quaternion(q): + if q.q < 0.0: # positive first quaternion component? + raise ValueError('quaternion has negative first component.\n{}'.format(q)) + return q + +def check_matrix(M): + if abs(1.0-np.linalg.det(M)) > 1e-8: # proper rotation? + raise ValueError('matrix is not a proper rotation.\n{}'.format(M)) + if abs(np.dot(M[0],M[1])) > 1e-8 \ + or abs(np.dot(M[1],M[2])) > 1e-8 \ + or abs(np.dot(M[2],M[0])) > 1e-8: # all orthogonal? + raise ValueError('matrix is not orthogonal.\n{}'.format(M)) + return M + # -------------------------------------------------------------------- # MAIN # -------------------------------------------------------------------- @@ -103,6 +126,7 @@ if np.sum(input) != 1: parser.error('needs exactly one input format.') (options.matrix,9,'matrix'), (options.quaternion,4,'quaternion'), ][np.where(input)[0][0]] # select input label that was requested + toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians r = damask.Quaternion.fromAngleAxis(toRadians*options.crystalrotation[0],options.crystalrotation[1:]) # crystal frame rotation R = damask.Quaternion.fromAngleAxis(toRadians*options. labrotation[0],options. labrotation[1:]) # lab frame rotation @@ -149,18 +173,21 @@ for name in filenames: outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table if inputtype == 'eulers': - o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians) + + o = damask.Orientation(Eulers = check_Eulers(np.array(list(map(float,table.data[column:column+3])))*toRadians)) elif inputtype == 'rodrigues': - o = damask.Orientation(Rodrigues= np.array(list(map(float,table.data[column:column+3])))) + o = damask.Orientation(Rodrigues = np.array(list(map(float,table.data[column:column+3])))) elif inputtype == 'matrix': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3)) + + o = damask.Orientation(matrix = check_matrix(np.array(list(map(float,table.data[column:column+9]))).reshape(3,3))) elif inputtype == 'frame': M = np.array(list(map(float,table.data[column[0]:column[0]+3] + \ table.data[column[1]:column[1]+3] + \ table.data[column[2]:column[2]+3]))).reshape(3,3).T - o = damask.Orientation(matrix = M/np.linalg.norm(M,axis=0)) + o = damask.Orientation(matrix = check_matrix(M/np.linalg.norm(M,axis=0))) elif inputtype == 'quaternion': - o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4])))) + + o = damask.Orientation(quaternion = check_quaternion(np.array(list(map(float,table.data[column:column+4]))))) o.quaternion = r*o.quaternion*R # apply additional lab and crystal frame rotations From 4130cbcffa7705c360530a1b4ec7ecc3bc5e3637 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 07:10:31 +0100 Subject: [PATCH 054/147] simplified - always use quaternion as input for orientation - addAPS34IDEstrainCoords uses table functionality - rotateData can figure out whether input is vector or tensor --- processing/post/addAPS34IDEstrainCoords.py | 30 +++++---- processing/post/addGrainID.py | 76 +++------------------- processing/post/addIPFcolor.py | 64 ++---------------- processing/post/addPole.py | 70 +++----------------- processing/post/rotateData.py | 65 ++++++++---------- 5 files changed, 67 insertions(+), 238 deletions(-) diff --git a/processing/post/addAPS34IDEstrainCoords.py b/processing/post/addAPS34IDEstrainCoords.py index 2e753bfa4..0b54637f6 100755 --- a/processing/post/addAPS34IDEstrainCoords.py +++ b/processing/post/addAPS34IDEstrainCoords.py @@ -35,21 +35,27 @@ datainfo = {'len':3, datainfo['label'] += options.frame -# --- loop over input files ------------------------------------------------------------------------- -if filenames == []: - filenames = ['STDIN'] +# --- loop over input files ------------------------------------------------------------------------ + +if filenames == []: filenames = [None] for name in filenames: - if name == 'STDIN': - file = {'name':'STDIN', 'input':sys.stdin, 'output':sys.stdout, 'croak':sys.stderr} - file['croak'].write('\033[1m'+scriptName+'\033[0m\n') - else: - if not os.path.exists(name): continue - file = {'name':name, 'input':open(name), 'output':open(name+'_tmp','w'), 'croak':sys.stderr} - file['croak'].write('\033[1m'+scriptName+'\033[0m: '+file['name']+'\n') + try: table = damask.ASCIItable(name = name, + buffered = False) + except: continue + damask.util.report(scriptName,name) + +# ------------------------------------------ read header ------------------------------------------ + + table.head_read() + + if not table.label_dimension(options.quaternion) == 4: + damask.util.croak('input {} does not have dimension 4.'.format(options.quaternion)) + table.close(dismiss = True) # close ASCIItable and remove empty file + continue + + - table = damask.ASCIItable(file['input'],file['output'],buffered=False) # make unbuffered ASCII_table - table.head_read() # read ASCII header info table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) # --------------- figure out columns to process --------------------------------------------------- diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index c3b98f4e6..dedf5b278 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -31,32 +31,6 @@ parser.add_option('-s', dest = 'symmetry', type = 'string', metavar = 'string', help = 'crystal symmetry [%default]') -parser.add_option('-e', - '--eulers', - dest = 'eulers', - type = 'string', metavar = 'string', - help = 'label of Euler angles') -parser.add_option('--degrees', - dest = 'degrees', - action = 'store_true', - help = 'Euler angles are given in degrees [%default]') -parser.add_option('-m', - '--matrix', - dest = 'matrix', - type = 'string', metavar = 'string', - help = 'label of orientation matrix') -parser.add_option('-a', - dest = 'a', - type = 'string', metavar = 'string', - help = 'label of crystal frame a vector') -parser.add_option('-b', - dest = 'b', - type = 'string', metavar = 'string', - help = 'label of crystal frame b vector') -parser.add_option('-c', - dest = 'c', - type = 'string', metavar = 'string', - help = 'label of crystal frame c vector') parser.add_option('-q', '--quaternion', dest = 'quaternion', @@ -69,9 +43,9 @@ parser.add_option('-p', help = 'label of coordinates [%default]') parser.set_defaults(disorientation = 5, + quaternion = 'orientation', symmetry = 'cubic', pos = 'pos', - degrees = False, ) (options, filenames) = parser.parse_args() @@ -79,22 +53,6 @@ parser.set_defaults(disorientation = 5, if options.radius is None: parser.error('no radius specified.') -input = [options.eulers is not None, - options.a is not None and \ - options.b is not None and \ - options.c is not None, - options.matrix is not None, - options.quaternion is not None, - ] - -if np.sum(input) != 1: parser.error('needs exactly one input format.') - -(label,dim,inputtype) = [(options.eulers,3,'eulers'), - ([options.a,options.b,options.c],[3,3,3],'frame'), - (options.matrix,9,'matrix'), - (options.quaternion,4,'quaternion'), - ][np.where(input)[0][0]] # select input label that was requested -toRadians = np.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians cos_disorientation = np.cos(np.radians(options.disorientation/2.)) # cos of half the disorientation angle # --- loop over input files ------------------------------------------------------------------------- @@ -118,8 +76,8 @@ for name in filenames: if not 3 >= table.label_dimension(options.pos) >= 1: errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos)) - if not np.all(table.label_dimension(label) == dim): - errors.append('input "{}" does not have dimension {}.'.format(label,dim)) + if not np.all(table.label_dimension(options.quaternion) == 4): + errors.append('input "{}" does not have dimension 4.'.format(options.quaternion)) else: column = table.label_index(label) if remarks != []: damask.util.croak(remarks) @@ -131,9 +89,7 @@ for name in filenames: # ------------------------------------------ assemble header --------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append('grainID_{}@{:g}'.format('+'.join(label) - if isinstance(label, (list,tuple)) - else label, + table.labels_append('grainID_{}@{:g}'.format('+'.join(options.quaternion), options.disorientation)) # report orientation source and disorientation table.head_write() @@ -141,16 +97,14 @@ for name in filenames: # ------------------------------------------ build KD tree ----------------------------------------- + table.data_readArray(options.pos) # read position vectors + grainID = -np.ones(len(table.data),dtype=int) + # --- start background messaging bg = damask.util.backgroundMessage() bg.start() - bg.set_message('reading positions...') - - table.data_readArray(options.pos) # read position vectors - grainID = -np.ones(len(table.data),dtype=int) - start = tick = time.clock() bg.set_message('building KD tree...') kdtree = spatial.KDTree(copy.deepcopy(table.data)) @@ -175,20 +129,8 @@ for name in filenames: bg.set_message('(%02i:%02i:%02i) processing point %i of %i (grain count %i)...'\ %(time_delta//3600,time_delta%3600//60,time_delta%60,p,len(grainID),np.count_nonzero(memberCounts))) - if inputtype == 'eulers': - o = damask.Orientation(Eulers = np.array(map(float,table.data[column:column+3]))*toRadians, - symmetry = options.symmetry).reduced() - elif inputtype == 'matrix': - o = damask.Orientation(matrix = np.array(map(float,table.data[column:column+9])).reshape(3,3).transpose(), - symmetry = options.symmetry).reduced() - elif inputtype == 'frame': - o = damask.Orientation(matrix = np.array(map(float,table.data[column[0]:column[0]+3] + \ - table.data[column[1]:column[1]+3] + \ - table.data[column[2]:column[2]+3])).reshape(3,3), - symmetry = options.symmetry).reduced() - elif inputtype == 'quaternion': - o = damask.Orientation(quaternion = np.array(map(float,table.data[column:column+4])), - symmetry = options.symmetry).reduced() + o = damask.Orientation(quaternion = np.array(map(float,table.data[column:column+4])), + symmetry = options.symmetry).reduced() matched = False alreadyChecked = {} diff --git a/processing/post/addIPFcolor.py b/processing/post/addIPFcolor.py index ffe3dac3f..1e5d8c2f3 100755 --- a/processing/post/addIPFcolor.py +++ b/processing/post/addIPFcolor.py @@ -26,58 +26,18 @@ parser.add_option('-s', '--symmetry', dest = 'symmetry', type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string', help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:]))) -parser.add_option('-e', '--eulers', - dest = 'eulers', - type = 'string', metavar = 'string', - help = 'Euler angles label') -parser.add_option('-d', '--degrees', - dest = 'degrees', - action = 'store_true', - help = 'Euler angles are given in degrees [%default]') -parser.add_option('-m', '--matrix', - dest = 'matrix', - type = 'string', metavar = 'string', - help = 'orientation matrix label') -parser.add_option('-a', - dest = 'a', - type = 'string', metavar = 'string', - help = 'crystal frame a vector label') -parser.add_option('-b', - dest = 'b', - type = 'string', metavar = 'string', - help = 'crystal frame b vector label') -parser.add_option('-c', - dest = 'c', - type = 'string', metavar = 'string', - help = 'crystal frame c vector label') parser.add_option('-q', '--quaternion', dest = 'quaternion', type = 'string', metavar = 'string', help = 'quaternion label') parser.set_defaults(pole = (0.0,0.0,1.0), + quaternion = 'orientation', symmetry = damask.Symmetry.lattices[-1], - degrees = False, ) (options, filenames) = parser.parse_args() -input = [options.eulers is not None, - options.a is not None and \ - options.b is not None and \ - options.c is not None, - options.matrix is not None, - options.quaternion is not None, - ] - -if np.sum(input) != 1: parser.error('needs exactly one input format.') - -(label,dim,inputtype) = [(options.eulers,3,'eulers'), - ([options.a,options.b,options.c],[3,3,3],'frame'), - (options.matrix,9,'matrix'), - (options.quaternion,4,'quaternion'), - ][np.where(input)[0][0]] # select input label that was requested -toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians pole = np.array(options.pole) pole /= np.linalg.norm(pole) @@ -98,12 +58,12 @@ for name in filenames: # ------------------------------------------ sanity checks ---------------------------------------- - if not np.all(table.label_dimension(label) == dim): - damask.util.croak('input {} does not have dimension {}.'.format(label,dim)) + if not table.label_dimension(options.quaternion) == 4: + damask.util.croak('input {} does not have dimension 4.'.format(options.quaternion)) table.close(dismiss = True) # close ASCIItable and remove empty file continue - column = table.label_index(label) + column = table.label_index(options.quaternion) # ------------------------------------------ assemble header --------------------------------------- @@ -115,20 +75,8 @@ for name in filenames: outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table - if inputtype == 'eulers': - o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians, - symmetry = options.symmetry).reduced() - elif inputtype == 'matrix': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3).transpose(), - symmetry = options.symmetry).reduced() - elif inputtype == 'frame': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column[0]:column[0]+3] + \ - table.data[column[1]:column[1]+3] + \ - table.data[column[2]:column[2]+3]))).reshape(3,3), - symmetry = options.symmetry).reduced() - elif inputtype == 'quaternion': - o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))), - symmetry = options.symmetry).reduced() + o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))), + symmetry = options.symmetry).reduced() table.data_append(o.IPFcolor(pole)) outputAlive = table.data_write() # output processed line diff --git a/processing/post/addPole.py b/processing/post/addPole.py index 95bc87637..83a031d46 100755 --- a/processing/post/addPole.py +++ b/processing/post/addPole.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -26,58 +26,18 @@ parser.add_option('--polar', dest = 'polar', action = 'store_true', help = 'output polar coordinates r,phi [%default]') -parser.add_option('-e', '--eulers', - dest = 'eulers', - type = 'string', metavar = 'string', - help = 'Euler angles label') -parser.add_option('-d', '--degrees', - dest = 'degrees', - action = 'store_true', - help = 'Euler angles are given in degrees [%default]') -parser.add_option('-m', '--matrix', - dest = 'matrix', - type = 'string', metavar = 'string', - help = 'orientation matrix label') -parser.add_option('-a', - dest = 'a', - type = 'string', metavar = 'string', - help = 'crystal frame a vector label') -parser.add_option('-b', - dest = 'b', - type = 'string', metavar = 'string', - help = 'crystal frame b vector label') -parser.add_option('-c', - dest = 'c', - type = 'string', metavar = 'string', - help = 'crystal frame c vector label') parser.add_option('-q', '--quaternion', dest = 'quaternion', type = 'string', metavar = 'string', help = 'quaternion label') parser.set_defaults(pole = (1.0,0.0,0.0), - degrees = False, + quaternion = 'orientation', polar = False, ) (options, filenames) = parser.parse_args() -input = [options.eulers is not None, - options.a is not None and \ - options.b is not None and \ - options.c is not None, - options.matrix is not None, - options.quaternion is not None, - ] - -if np.sum(input) != 1: parser.error('needs exactly one input format.') - -(label,dim,inputtype) = [(options.eulers,3,'eulers'), - ([options.a,options.b,options.c],[3,3,3],'frame'), - (options.matrix,9,'matrix'), - (options.quaternion,4,'quaternion'), - ][np.where(input)[0][0]] # select input label that was requested -toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians pole = np.array(options.pole) pole /= np.linalg.norm(pole) @@ -98,18 +58,13 @@ for name in filenames: # ------------------------------------------ sanity checks ---------------------------------------- - errors = [] - remarks = [] - - if not np.all(table.label_dimension(label) == dim): errors.append('input {} does not have dimension {}.'.format(label,dim)) - else: column = table.label_index(label) - - if remarks != []: damask.util.croak(remarks) - if errors != []: - damask.util.croak(errors) - table.close(dismiss = True) + if not table.label_dimension(options.quaternion) == 4: + damask.util.croak('input {} does not have dimension 4.'.format(options.quaternion)) + table.close(dismiss = True) # close ASCIItable and remove empty file continue + column = table.label_index(options.quaternion) + # ------------------------------------------ assemble header --------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) @@ -119,16 +74,7 @@ for name in filenames: # ------------------------------------------ process data ------------------------------------------ outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table - if inputtype == 'eulers': - o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians) - elif inputtype == 'matrix': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3).transpose()) - elif inputtype == 'frame': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column[0]:column[0]+3] + \ - table.data[column[1]:column[1]+3] + \ - table.data[column[2]:column[2]+3]))).reshape(3,3)) - elif inputtype == 'quaternion': - o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4])))) + o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4])))) rotatedPole = o.quaternion*pole # rotate pole according to crystal orientation (x,y) = rotatedPole[0:2]/(1.+abs(pole[2])) # stereographic projection diff --git a/processing/post/rotateData.py b/processing/post/rotateData.py index 84d4cd3e1..683fbf863 100755 --- a/processing/post/rotateData.py +++ b/processing/post/rotateData.py @@ -18,19 +18,15 @@ Rotate vector and/or tensor column data by given angle around given axis. """, version = scriptID) -parser.add_option('-v','--vector', - dest = 'vector', +parser.add_option('-d', '--data', + dest = 'data', action = 'extend', metavar = '', - help = 'column heading of vector(s) to rotate') -parser.add_option('-t','--tensor', - dest = 'tensor', - action = 'extend', metavar = '', - help = 'column heading of tensor(s) to rotate') + help = 'vector/tensor value(s) label(s)') parser.add_option('-r', '--rotation', dest = 'rotation', type = 'float', nargs = 4, metavar = ' '.join(['float']*4), help = 'angle and axis to rotate data [%default]') -parser.add_option('-d', '--degrees', +parser.add_option('--degrees', dest = 'degrees', action = 'store_true', help = 'angles are given in degrees [%default]') @@ -41,7 +37,7 @@ parser.set_defaults(rotation = (0.,1.,1.,1.), (options,filenames) = parser.parse_args() -if options.vector is None and options.tensor is None: +if options.data is None: parser.error('no data column specified.') toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians @@ -59,27 +55,24 @@ for name in filenames: except: continue damask.util.report(scriptName,name) -# ------------------------------------------ read header ------------------------------------------ +# --- interpret header ---------------------------------------------------------------------------- table.head_read() -# ------------------------------------------ sanity checks ---------------------------------------- - - items = { - 'tensor': {'dim': 9, 'shape': [3,3], 'labels':options.tensor, 'active':[], 'column': []}, - 'vector': {'dim': 3, 'shape': [3], 'labels':options.vector, 'active':[], 'column': []}, - } errors = [] remarks = [] - column = {} - - for type, data in items.items(): - for what in data['labels']: - dim = table.label_dimension(what) - if dim != data['dim']: remarks.append('column {} is not a {}.'.format(what,type)) - else: - items[type]['active'].append(what) - items[type]['column'].append(table.label_index(what)) + active = {'vector':[],'tensor':[]} + + for i,dim in enumerate(table.label_dimension(options.data)): + label = options.data[i] + if dim == -1: + remarks.append('{} "{}" not found...'.format(datatype,me)) + elif dim == 3: + remarks.append('adding vector "{}"...'.format(label)) + active['vector'].append(label) + elif dim == 9: + remarks.append('adding tensor "{}"...'.format(label)) + active['tensor'].append(label) if remarks != []: damask.util.croak(remarks) if errors != []: @@ -95,20 +88,14 @@ for name in filenames: # ------------------------------------------ process data ------------------------------------------ outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table - - datatype = 'vector' - - for column in items[datatype]['column']: # loop over all requested labels - table.data[column:column+items[datatype]['dim']] = \ - q * np.array(list(map(float,table.data[column:column+items[datatype]['dim']]))) - - datatype = 'tensor' - - for column in items[datatype]['column']: # loop over all requested labels - table.data[column:column+items[datatype]['dim']] = \ - np.dot(R,np.dot(np.array(list(map(float,table.data[column:column+items[datatype]['dim']]))).\ - reshape(items[datatype]['shape']),R.transpose())).reshape(items[datatype]['dim']) - + for v in active['vector']: + column = table.label_index(v) + table.data[column:column+3] = q * np.array(list(map(float,table.data[column:column+3]))) + for t in active['tensor']: + column = table.label_index(v) + table.data[column:column+9] = \ + np.dot(R,np.dot(np.array(list(map(float,table.data[column:column+9]]))).\ + reshape((3,3)),R.transpose())).reshape((9)) outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization ----------------------------------- From d145b257aaf433f255e9b739130be894af039fb3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 07:57:05 +0100 Subject: [PATCH 055/147] new version of numpy complain about overlong range argument --- processing/post/binXY.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/processing/post/binXY.py b/processing/post/binXY.py index aac9aaffa..726fca39f 100755 --- a/processing/post/binXY.py +++ b/processing/post/binXY.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -118,10 +118,9 @@ for name in filenames: minmax[c] = np.log(minmax[c]) # change minmax to log, too delta = minmax[:,1]-minmax[:,0] - (grid,xedges,yedges) = np.histogram2d(table.data[:,0],table.data[:,1], bins=options.bins, - range=minmax, + range=minmax[0:2,0:2], weights=None if options.weight is None else table.data[:,2]) if options.normCol: From 83a3628765d4a876610f2e3afb73f921106faefe Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 07:58:42 +0100 Subject: [PATCH 056/147] bug fixes --- processing/post/rotateData.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/processing/post/rotateData.py b/processing/post/rotateData.py index 683fbf863..7ed9542cf 100755 --- a/processing/post/rotateData.py +++ b/processing/post/rotateData.py @@ -92,10 +92,10 @@ for name in filenames: column = table.label_index(v) table.data[column:column+3] = q * np.array(list(map(float,table.data[column:column+3]))) for t in active['tensor']: - column = table.label_index(v) + column = table.label_index(t) table.data[column:column+9] = \ - np.dot(R,np.dot(np.array(list(map(float,table.data[column:column+9]]))).\ - reshape((3,3)),R.transpose())).reshape((9)) + np.dot(R,np.dot(np.array(list(map(float,table.data[column:column+9]))).reshape((3,3)), + R.transpose())).reshape((9)) outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization ----------------------------------- From 6b73840853b1418d9176de22a8fd14d27a9d1b2b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 08:07:40 +0100 Subject: [PATCH 057/147] works with python3 --- processing/post/addInfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/addInfo.py b/processing/post/addInfo.py index 50f003d6b..59efcd973 100755 --- a/processing/post/addInfo.py +++ b/processing/post/addInfo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- import os From 7eaea64d091ba06add88bee16ed5d759edeb5286 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 09:08:33 +0100 Subject: [PATCH 058/147] python3 compatible hope that the new bar causes less trouble than the background message --- lib/damask/util.py | 24 ++++++++++++++++++++++++ processing/post/addGrainID.py | 28 ++++++---------------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/lib/damask/util.py b/lib/damask/util.py index 8727a1473..39715730c 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -132,6 +132,30 @@ class extendableOption(Option): else: Option.take_action(self, action, dest, opt, value, values, parser) +# Print iterations progress +# from https://gist.github.com/aubricus/f91fb55dc6ba5557fbab06119420dd6a +def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100): + """ + Call in a loop to create terminal progress bar + @params: + iteration - Required : current iteration (Int) + total - Required : total iterations (Int) + prefix - Optional : prefix string (Str) + suffix - Optional : suffix string (Str) + decimals - Optional : positive number of decimals in percent complete (Int) + bar_length - Optional : character length of bar (Int) + """ + str_format = "{0:." + str(decimals) + "f}" + percents = str_format.format(100 * (iteration / float(total))) + filled_length = int(round(bar_length * iteration / float(total))) + bar = '█' * filled_length + '-' * (bar_length - filled_length) + + sys.stdout.write('\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix)), + + if iteration == total: + sys.stdout.write('\n') +sys.stdout.flush() + # ----------------------------- class backgroundMessage(threading.Thread): """Reporting with animation to indicate progress""" diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index dedf5b278..84bdaa30d 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- import os,sys,time,copy @@ -78,7 +78,7 @@ for name in filenames: errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos)) if not np.all(table.label_dimension(options.quaternion) == 4): errors.append('input "{}" does not have dimension 4.'.format(options.quaternion)) - else: column = table.label_index(label) + else: column = table.label_index(options.quaternion) if remarks != []: damask.util.croak(remarks) if errors != []: @@ -93,26 +93,15 @@ for name in filenames: options.disorientation)) # report orientation source and disorientation table.head_write() -# ------------------------------------------ process data ------------------------------------------ - # ------------------------------------------ build KD tree ----------------------------------------- table.data_readArray(options.pos) # read position vectors grainID = -np.ones(len(table.data),dtype=int) - -# --- start background messaging - - bg = damask.util.backgroundMessage() - bg.start() - - start = tick = time.clock() - bg.set_message('building KD tree...') + Npoints = table.data.shape[0] kdtree = spatial.KDTree(copy.deepcopy(table.data)) # ------------------------------------------ assign grain IDs -------------------------------------- - tick = time.clock() - orientations = [] # quaternions found for grain memberCounts = [] # number of voxels in grain p = 0 # point counter @@ -123,13 +112,10 @@ for name in filenames: table.data_rewind() while table.data_read(): # read next data line of ASCII table - if p > 0 and p % 1000 == 0: + if Npoints > 100 and p%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero + damask.util.print_progress(iteration=p,total=Npoints) - time_delta = (time.clock()-tick) * (len(grainID) - p) / p - bg.set_message('(%02i:%02i:%02i) processing point %i of %i (grain count %i)...'\ - %(time_delta//3600,time_delta%3600//60,time_delta%60,p,len(grainID),np.count_nonzero(memberCounts))) - - o = damask.Orientation(quaternion = np.array(map(float,table.data[column:column+4])), + o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))), symmetry = options.symmetry).reduced() matched = False @@ -180,8 +166,6 @@ for name in filenames: outputAlive = table.data_write() # output processed line p += 1 - bg.set_message('done after {} seconds'.format(time.clock()-start)) - # ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables From d9b47f09bc3f5a311194d793bcf4e0eb36c36e9c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 10:52:37 +0100 Subject: [PATCH 059/147] modernized split arguments logically, assume 3-vector for coordinates --- processing/post/addAPS34IDEstrainCoords.py | 71 ++++++++-------------- 1 file changed, 27 insertions(+), 44 deletions(-) diff --git a/processing/post/addAPS34IDEstrainCoords.py b/processing/post/addAPS34IDEstrainCoords.py index 0b54637f6..1071baa91 100755 --- a/processing/post/addAPS34IDEstrainCoords.py +++ b/processing/post/addAPS34IDEstrainCoords.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -19,21 +19,22 @@ Transform X,Y,Z,F APS BeamLine 34 coordinates to x,y,z APS strain coordinates. """, version = scriptID) -parser.add_option('-f','--frame', dest='frame', nargs=4, type='string', metavar='string string string string', - help='APS X,Y,Z coords, and depth F') -parser.set_defaults(frame = None) +parser.add_option('-f', + '--frame', + dest='frame', + metavar='string', + help='APS X,Y,Z coords') +parser.add_option('--depth', + dest='depth', + metavar='string', + help='depth') (options,filenames) = parser.parse_args() if options.frame is None: - parser.error('no data column specified...') - - -datainfo = {'len':3, - 'label':[] - } - -datainfo['label'] += options.frame + parser.error('frame not specified') +if options.depth is None: + parser.error('depth not specified') # --- loop over input files ------------------------------------------------------------------------ @@ -49,31 +50,19 @@ for name in filenames: table.head_read() - if not table.label_dimension(options.quaternion) == 4: - damask.util.croak('input {} does not have dimension 4.'.format(options.quaternion)) - table.close(dismiss = True) # close ASCIItable and remove empty file +# ------------------------------------------ sanity checks ----------------------------------------- + errors = [] + if table.label_dimension(options.frame) != 3: + errors.append('input {} does not have dimension 3.'.format(options.frame)) + if table.label_dimension(options.depth) != 1: + errors.append('input {} does not have dimension 1.'.format(options.depth)) + if errors != []: + damask.util.croak(errors) + table.close(dismiss = True) continue - - table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) -# --------------- figure out columns to process --------------------------------------------------- - active = [] - column = {} - columnMissing = False - - for label in datainfo['label']: - key = label - if key in table.labels(raw = True): - active.append(label) - column[label] = table.labels.index(key) # remember columns of requested data - else: - file['croak'].write('column %s not found...\n'%label) - columnMissing = True - - if columnMissing: continue - # ------------------------------------------ assemble header --------------------------------------- table.labels_append(['%i_coord'%(i+1) for i in range(3)]) # extend ASCII header with new labels table.head_write() @@ -83,21 +72,15 @@ for name in filenames: RotMat2TSL=np.array([[1., 0., 0.], [0., np.cos(theta), np.sin(theta)], # Orientation to account for -135 deg [0., -np.sin(theta), np.cos(theta)]]) # rotation for TSL convention - vec = np.zeros(4) - outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table - for i,label in enumerate(active): - vec[i] = table.data[column[label]] + coord = list(map(float,table.data[table.label_index(options.frame):table.label_index(options.frame)+3])) + depth = float(table.data[table.label_index(options.depth)]) - table.data_append(np.dot(RotMat2TSL,np.array([-vec[0], -vec[1],-vec[2]+vec[3]]))) + table.data_append(np.dot(RotMat2TSL,np.array([-coord[0],-coord[1],-coord[2]+depth]))) outputAlive = table.data_write() # output processed line -# ------------------------------------------ output result ----------------------------------------- - outputAlive and table.output_flush() # just in case of buffered ASCII table +# ------------------------------------------ output finalization ----------------------------------- - table.input_close() # close input ASCII table (works for stdin) - table.output_close() # close output ASCII table (works for stdout) - if file['name'] != 'STDIN': - os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new + table.close() # close ASCII tables From 213e31ff8700279df8264f8d135b9d030c63cba8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 10:53:25 +0100 Subject: [PATCH 060/147] string was split into letters --- processing/post/addGrainID.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index 84bdaa30d..ac2c53a02 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -89,8 +89,7 @@ for name in filenames: # ------------------------------------------ assemble header --------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append('grainID_{}@{:g}'.format('+'.join(options.quaternion), - options.disorientation)) # report orientation source and disorientation + table.labels_append('grainID_{}@{:g}'.format(options.quaternion,options.disorientation)) # report orientation source and disorientation table.head_write() # ------------------------------------------ build KD tree ----------------------------------------- From aefa006d090fe2ebecd7c1b8b7e808ec756fdc15 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 10:53:53 +0100 Subject: [PATCH 061/147] simplified assume quaternions as input --- processing/post/addSchmidfactors.py | 64 +++-------------------------- 1 file changed, 5 insertions(+), 59 deletions(-) diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index 9c5e9b0b4..a64708e1e 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -123,46 +123,19 @@ parser.add_option('-n', '--normal', dest = 'normal', type = 'float', nargs = 3, metavar = 'float float float', help = 'stress plane normal in lab frame [%default]') -parser.add_option('-e', '--eulers', - dest = 'eulers', - type = 'string', metavar = 'string', - help = 'Euler angles label') -parser.add_option('-d', '--degrees', - dest = 'degrees', - action = 'store_true', - help = 'Euler angles are given in degrees [%default]') -parser.add_option('-m', '--matrix', - dest = 'matrix', - type = 'string', metavar = 'string', - help = 'orientation matrix label') -parser.add_option('-a', - dest = 'a', - type = 'string', metavar = 'string', - help = 'crystal frame a vector label') -parser.add_option('-b', - dest = 'b', - type = 'string', metavar = 'string', - help = 'crystal frame b vector label') -parser.add_option('-c', - dest = 'c', - type = 'string', metavar = 'string', - help = 'crystal frame c vector label') parser.add_option('-q', '--quaternion', dest = 'quaternion', - type = 'string', metavar = 'string', + metavar = 'string', help = 'quaternion label') parser.set_defaults(force = (0.0,0.0,1.0), normal = None, lattice = latticeChoices[0], CoverA = math.sqrt(8./3.), - degrees = False, ) (options, filenames) = parser.parse_args() -toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians - force = np.array(options.force) force /= np.linalg.norm(force) @@ -174,22 +147,6 @@ if options.normal: else: normal = force -input = [options.eulers is not None, - options.a is not None and \ - options.b is not None and \ - options.c is not None, - options.matrix is not None, - options.quaternion is not None, - ] - -if np.sum(input) != 1: parser.error('needs exactly one input format.') - -(label,dim,inputtype) = [(options.eulers,3,'eulers'), - ([options.a,options.b,options.c],[3,3,3],'frame'), - (options.matrix,9,'matrix'), - (options.quaternion,4,'quaternion'), - ][np.where(input)[0][0]] # select input label that was requested - slip_direction = np.zeros((len(slipSystems[options.lattice]),3),'f') slip_normal = np.zeros_like(slip_direction) @@ -227,13 +184,12 @@ for name in filenames: table.head_read() # ------------------------------------------ sanity checks ---------------------------------------- - - if not np.all(table.label_dimension(label) == dim): - damask.util.croak('input {} does not have dimension {}.'.format(label,dim)) + if not table.label_dimension(options.quaternion) == 4: + damask.util.croak('input {} does not have dimension 4.'.format(options.quaternion)) table.close(dismiss = True) # close ASCIItable and remove empty file continue - column = table.label_index(label) + column = table.label_index(options.quaternion) # ------------------------------------------ assemble header --------------------------------------- @@ -251,17 +207,7 @@ for name in filenames: outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table - if inputtype == 'eulers': - o = damask.Orientation(Eulers = np.array(list(map(float,table.data[column:column+3])))*toRadians,) - elif inputtype == 'matrix': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column:column+9]))).reshape(3,3).transpose(),) - elif inputtype == 'frame': - o = damask.Orientation(matrix = np.array(list(map(float,table.data[column[0]:column[0]+3] + \ - table.data[column[1]:column[1]+3] + \ - table.data[column[2]:column[2]+3]))).reshape(3,3),) - elif inputtype == 'quaternion': - o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))),) - + o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4])))) table.data_append( np.abs( np.sum(slip_direction * (o.quaternion * force) ,axis=1) \ * np.sum(slip_normal * (o.quaternion * normal),axis=1))) From f7af4eba9cb6ec8719311080aa4ed0c090fa2a1b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 10:59:48 +0100 Subject: [PATCH 062/147] updated + new tests all tests python3 compatible and with quaternions for orientations --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 64c39e902..efa9fe4e9 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 64c39e90200a8dd90dff3665e27050d9db81ac0d +Subproject commit efa9fe4e97cf2dfebff97f3a07503fc277dabf8a From 4a58fd98f96a6da70e0dec442ccf5e5c15cafda5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 11:02:28 +0100 Subject: [PATCH 063/147] pep257 compatible --- lib/damask/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/damask/util.py b/lib/damask/util.py index 39715730c..754dd7c5d 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -137,6 +137,7 @@ class extendableOption(Option): def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100): """ Call in a loop to create terminal progress bar + @params: iteration - Required : current iteration (Int) total - Required : total iterations (Int) From 741032339e43bd880fdeb6e72e87d267f84d2d51 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 11:03:18 +0100 Subject: [PATCH 064/147] time/math/datatype are not used/defined any more --- processing/post/addGrainID.py | 2 +- processing/post/addIPFcolor.py | 2 +- processing/post/addPole.py | 2 +- processing/post/rotateData.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index ac2c53a02..2eb3aec3a 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- -import os,sys,time,copy +import os,sys,copy import numpy as np import damask from optparse import OptionParser diff --git a/processing/post/addIPFcolor.py b/processing/post/addIPFcolor.py index 1e5d8c2f3..2916df703 100755 --- a/processing/post/addIPFcolor.py +++ b/processing/post/addIPFcolor.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- -import os,sys,math +import os,sys import numpy as np from optparse import OptionParser import damask diff --git a/processing/post/addPole.py b/processing/post/addPole.py index 83a031d46..f2e9b978d 100755 --- a/processing/post/addPole.py +++ b/processing/post/addPole.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- -import os,sys,math +import os,sys import numpy as np from optparse import OptionParser import damask diff --git a/processing/post/rotateData.py b/processing/post/rotateData.py index 7ed9542cf..95102345b 100755 --- a/processing/post/rotateData.py +++ b/processing/post/rotateData.py @@ -66,7 +66,7 @@ for name in filenames: for i,dim in enumerate(table.label_dimension(options.data)): label = options.data[i] if dim == -1: - remarks.append('{} "{}" not found...'.format(datatype,me)) + remarks.append('"{}" not found...'.format(label)) elif dim == 3: remarks.append('adding vector "{}"...'.format(label)) active['vector'].append(label) From 50542915579ef549381a22d863c03d39fc2e29ac Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 12:25:31 +0100 Subject: [PATCH 065/147] python3 compatible status message --- processing/post/postResults.py | 51 +++++++++++++++------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/processing/post/postResults.py b/processing/post/postResults.py index c6ed25d4b..74477d6a8 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -803,12 +803,6 @@ if not options.constitutiveResult: options.constitutiveResult = [] options.sort.reverse() options.sep.reverse() -# --- start background messaging - -if options.verbose: - bg = damask.util.backgroundMessage() - bg.start() - # --- parse .output and .t16 files if os.path.splitext(files[0])[1] == '': @@ -825,18 +819,13 @@ me = { 'Constitutive': options.phase, } -if options.verbose: bg.set_message('parsing .output files...') - for what in me: outputFormat[what] = ParseOutputFormat(filename, what, me[what]) if '_id' not in outputFormat[what]['specials']: print("\nsection '{}' not found in <{}>".format(me[what], what)) print('\n'.join(map(lambda x:' [%s]'%x, outputFormat[what]['specials']['brothers']))) -if options.verbose: bg.set_message('opening result file...') - p = OpenPostfile(filename+extension,options.filetype,options.nodal) -if options.verbose: bg.set_message('parsing result file...') stat = ParsePostfile(p, filename, outputFormat) if options.filetype == 'marc': stat['NumberOfIncrements'] -= 1 # t16 contains one "virtual" increment (at 0) @@ -879,8 +868,10 @@ if options.info: # --- build connectivity maps elementsOfNode = {} -for e in range(stat['NumberOfElements']): - if options.verbose and e%1000 == 0: bg.set_message('connect elem %i...'%e) +Nelems = stat['NumberOfElements'] +for e in range(Nelems): + if Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero + damask.util.print_progress(iteration=e,total=Nelems,prefix='1/3: connecting elements') for n in map(p.node_sequence,p.element(e).items): if n not in elementsOfNode: elementsOfNode[n] = [p.element_id(e)] @@ -899,10 +890,12 @@ index = {} groups = [] groupCount = 0 memberCount = 0 - +print('\n') if options.nodalScalar: - for n in range(stat['NumberOfNodes']): - if options.verbose and n%1000 == 0: bg.set_message('scan node %i...'%n) + Npoints = stat['NumberOfNodes'] + for n in range(Npoints): + if Npoints > 100 and e%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero + damask.util.print_progress(iteration=n,total=Npoints,prefix='2/3: scanning nodes ') myNodeID = p.node_id(n) myNodeCoordinates = [p.node(n).x, p.node(n).y, p.node(n).z] myElemID = 0 @@ -933,10 +926,13 @@ if options.nodalScalar: myNodeCoordinates) # incrementally update average location groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member memberCount += 1 + print('\n') else: - for e in range(stat['NumberOfElements']): - if options.verbose and e%1000 == 0: bg.set_message('scan elem %i...'%e) + Nelems = stat['NumberOfElements'] + for e in range(Nelems): + if Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero + damask.util.print_progress(iteration=e,total=Nelems,prefix='2/3: scanning elements ') myElemID = p.element_id(e) myIpCoordinates = ipCoords(p.element(e).type, list(map(lambda node: [node.x, node.y, node.z], list(map(p.node, map(p.node_sequence, p.element(e).items)))))) @@ -976,6 +972,7 @@ else: myIpCoordinates[n]) # incrementally update average location groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,n]) # append a new list defining each group member memberCount += 1 + print('\n') # --------------------------- sort groups -------------------------------- @@ -1002,7 +999,6 @@ if 'none' not in map(str.lower, options.sort): theKeys.append('x[0][%i]'%where[criterium]) sortKeys = eval('lambda x:(%s)'%(','.join(theKeys))) -if options.verbose: bg.set_message('sorting groups...') groups.sort(key = sortKeys) # in-place sorting to save mem @@ -1021,8 +1017,6 @@ standard = ['inc'] + \ # --------------------------- loop over positions -------------------------------- -if options.verbose: bg.set_message('getting map between positions and increments...') - incAtPosition = {} positionOfInc = {} @@ -1048,8 +1042,8 @@ increments = [incAtPosition[x] for x in locations] # build list of increments to time_start = time.time() +Nincs = len([i for i in locations]) for incCount,position in enumerate(locations): # walk through locations - p.moveto(position+offset_pos) # wind to correct position # --------------------------- file management -------------------------------- @@ -1075,16 +1069,14 @@ for incCount,position in enumerate(locations): # walk through locations # --------------------------- read and map data per group -------------------------------- member = 0 - for group in groups: - + Ngroups = len(groups) + for j,group in enumerate(groups): + f = incCount*Ngroups + j + if (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero + damask.util.print_progress(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ') N = 0 # group member counter for (e,n,i,g,n_local) in group[1:]: # loop over group members member += 1 - if member%1000 == 0: - time_delta = ((len(locations)*memberCount)/float(member+incCount*memberCount)-1.0)*(time.time()-time_start) - if options.verbose: bg.set_message('(%02i:%02i:%02i) processing point %i of %i from increment %i (position %i)...' - %(time_delta//3600,time_delta%3600//60,time_delta%60,member,memberCount,increments[incCount],position)) - newby = [] # current member's data if options.nodalScalar: @@ -1172,6 +1164,7 @@ for incCount,position in enumerate(locations): # walk through locations group[0] + \ mappedResult) )) + '\n') +print('') if fileOpen: file.close() From 697d97cd3839d21f8e298c4a501fdb2fdf937960 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 12:30:07 +0100 Subject: [PATCH 066/147] cleaned legacy format was for pre-MPI output where the extra bytes at start and end of a chunk (Fortran out) had to be handled manually --- processing/post/postResults.py | 66 +++++++--------------------------- 1 file changed, 12 insertions(+), 54 deletions(-) diff --git a/processing/post/postResults.py b/processing/post/postResults.py index 74477d6a8..66142be43 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -121,12 +121,8 @@ class MPIEspectral_result: # mimic py_post result object self._logscales = self._keyedPackedArray('logscales',count=self.N_loadcases,type='i') self.size = self._keyedPackedArray('size:',count=3,type='d') - if self.size == [None,None,None]: # no 'size' found, try legacy alias 'dimension' - self.size = self._keyedPackedArray('dimension',count=3,type='d') self.grid = self._keyedPackedArray('grid:',count=3,type='i') - if self.grid == [None,None,None]: # no 'grid' found, try legacy alias 'resolution' - self.grid = self._keyedPackedArray('resolution',count=3,type='i') self.N_nodes = (self.grid[0]+1)*(self.grid[1]+1)*(self.grid[2]+1) self.N_elements = self.grid[0] * self.grid[1] * self.grid[2] @@ -142,13 +138,8 @@ class MPIEspectral_result: # mimic py_post result object # parameters for file handling depending on output format - if options.legacy: - self.tagLen=8 - self.fourByteLimit = 2**31 -1 -8 - else: - self.tagLen=0 + self.tagLen=0 self.expectedFileSize = self.dataOffset+self.N_increments*(self.tagLen+self.N_elements*self.N_element_scalars*8) - if options.legacy: self.expectedFileSize+=self.expectedFileSize//self.fourByteLimit*8 # add extra 8 bytes for additional headers at 4 GB limits if self.expectedFileSize != self.filesize: print('\n**\n* Unexpected file size. Incomplete simulation or file corrupted!\n**') @@ -280,42 +271,16 @@ class MPIEspectral_result: # mimic py_post result object return self.N_element_scalars def element_scalar(self,e,idx): - if not options.legacy: - incStart = self.dataOffset \ - + self.position*8*self.N_elements*self.N_element_scalars - where = (e*self.N_element_scalars + idx)*8 - try: - self.file.seek(incStart+where) - value = struct.unpack('d',self.file.read(8))[0] - except: - print('seeking {}'.format(incStart+where)) - print('e {} idx {}'.format(e,idx)) - sys.exit(1) - - else: - self.fourByteLimit = 2**31 -1 -8 -# header & footer + extra header and footer for 4 byte int range (Fortran) -# values - incStart = self.dataOffset \ - + self.position*8*( 1 + self.N_elements*self.N_element_scalars*8//self.fourByteLimit \ - + self.N_elements*self.N_element_scalars) - - where = (e*self.N_element_scalars + idx)*8 - try: - if where%self.fourByteLimit + 8 >= self.fourByteLimit: # danger of reading into fortran record footer at 4 byte limit - data='' - for i in range(8): - self.file.seek(incStart+where+(where//self.fourByteLimit)*8+4) - data += self.file.read(1) - where += 1 - value = struct.unpack('d',data)[0] - else: - self.file.seek(incStart+where+(where//self.fourByteLimit)*8+4) - value = struct.unpack('d',self.file.read(8))[0] - except: - print('seeking {}'.format(incStart+where+(where//self.fourByteLimit)*8+4)) - print('e {} idx {}'.format(e,idx)) - sys.exit(1) + incStart = self.dataOffset \ + + self.position*8*self.N_elements*self.N_element_scalars + where = (e*self.N_element_scalars + idx)*8 + try: + self.file.seek(incStart+where) + value = struct.unpack('d',self.file.read(8))[0] + except: + print('seeking {}'.format(incStart+where)) + print('e {} idx {}'.format(e,idx)) + sys.exit(1) return [elemental_scalar(node,value) for node in self.element(e).items] @@ -645,8 +610,6 @@ of already processed data points for evaluation. parser.add_option('-i','--info', action='store_true', dest='info', help='list contents of resultfile') -parser.add_option('-l','--legacy', action='store_true', dest='legacy', - help='data format of spectral solver is in legacy format (no MPI out)') parser.add_option('-n','--nodal', action='store_true', dest='nodal', help='data is extrapolated to nodal value') parser.add_option( '--prefix', dest='prefix', @@ -673,10 +636,7 @@ parser.add_option('-p','--type', dest='filetype', help = 'type of result file [auto]') parser.add_option('-q','--quiet', dest='verbose', action = 'store_false', - help = 'suppress verbose output') -parser.add_option('--verbose', dest='verbose', - action = 'store_true', - help = 'enable verbose output') + help = 'legacy switch, no effect') group_material = OptionGroup(parser,'Material identifier') @@ -718,8 +678,6 @@ parser.add_option_group(group_general) parser.add_option_group(group_special) parser.set_defaults(info = False, - verbose = False, - legacy = False, nodal = False, prefix = '', suffix = '', From 65165ffc5ed31fd9159ad2b9f304d792eac2fae6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 12:35:32 +0100 Subject: [PATCH 067/147] assumed wrong type quaternion should have lenght one --- processing/post/addOrientations.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index efd4dac24..27cc92b1f 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -14,21 +14,23 @@ scriptID = ' '.join([scriptName,damask.version]) # -------------------------------------------------------------------- def check_Eulers(eulers): - if np.any(eulers < 0.0) or np.any(eulers > 2.0*math.pi) or eulers[1] > math.pi: # Euler angles within valid range? + if np.any(eulers < 0.0) or np.any(eulers > 2.0*math.pi) or eulers[1] > math.pi: # Euler angles within valid range? raise ValueError('Euler angles outside of [0..2π],[0..π],[0..2π].\n{} {} {}.'.format(*eulers)) return eulers def check_quaternion(q): - if q.q < 0.0: # positive first quaternion component? + if q[0] < 0.0: # positive first quaternion component? raise ValueError('quaternion has negative first component.\n{}'.format(q)) + if not(np.isclose(np.linalg.norm(q), 1.0)): # unit quaternion? + raise ValueError('quaternion is not of unit length.\n{} {} {} {}'.format(*q)) return q def check_matrix(M): - if abs(1.0-np.linalg.det(M)) > 1e-8: # proper rotation? + if abs(1.0-np.linalg.det(M)) > 1e-8: # proper rotation? raise ValueError('matrix is not a proper rotation.\n{}'.format(M)) if abs(np.dot(M[0],M[1])) > 1e-8 \ or abs(np.dot(M[1],M[2])) > 1e-8 \ - or abs(np.dot(M[2],M[0])) > 1e-8: # all orthogonal? + or abs(np.dot(M[2],M[0])) > 1e-8: # all orthogonal? raise ValueError('matrix is not orthogonal.\n{}'.format(M)) return M From d43dfa569b0fc08569b17ba1db0b260d18706588 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 12:37:27 +0100 Subject: [PATCH 068/147] lines too long --- processing/post/postResults.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/processing/post/postResults.py b/processing/post/postResults.py index 66142be43..e075acdf5 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -852,7 +852,7 @@ print('\n') if options.nodalScalar: Npoints = stat['NumberOfNodes'] for n in range(Npoints): - if Npoints > 100 and e%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero + if Npoints > 100 and e%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero damask.util.print_progress(iteration=n,total=Npoints,prefix='2/3: scanning nodes ') myNodeID = p.node_id(n) myNodeCoordinates = [p.node(n).x, p.node(n).y, p.node(n).z] @@ -862,27 +862,27 @@ if options.nodalScalar: # generate an expression that is only true for the locations specified by options.filter filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates) - if filter != '' and not eval(filter): # for all filter expressions that are not true:... - continue # ... ignore this data point and continue with next + if filter != '' and not eval(filter): # for all filter expressions that are not true:... + continue # ... ignore this data point and continue with next # --- group data locations # generate a unique key for a group of separated data based on the separation criterium for the location grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates) - if grp not in index: # create a new group if not yet present + if grp not in index: # create a new group if not yet present index[grp] = groupCount - groups.append([[0,0,0,0,0.0,0.0,0.0]]) # initialize with avg location + groups.append([[0,0,0,0,0.0,0.0,0.0]]) # initialize with avg location groupCount += 1 groups[index[grp]][0][:4] = mapIncremental('','unique', len(groups[index[grp]])-1, groups[index[grp]][0][:4], - [myElemID,myNodeID,myIpID,myGrainID]) # keep only if unique average location + [myElemID,myNodeID,myIpID,myGrainID]) # keep only if unique average location groups[index[grp]][0][4:] = mapIncremental('','avg', len(groups[index[grp]])-1, groups[index[grp]][0][4:], - myNodeCoordinates) # incrementally update average location - groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member + myNodeCoordinates) # incrementally update average location + groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member memberCount += 1 print('\n') @@ -1030,7 +1030,7 @@ for incCount,position in enumerate(locations): # walk through locations Ngroups = len(groups) for j,group in enumerate(groups): f = incCount*Ngroups + j - if (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero + if (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero damask.util.print_progress(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ') N = 0 # group member counter for (e,n,i,g,n_local) in group[1:]: # loop over group members From 130fac21c6dd676072d5b06d5a15ee5c6f03b801 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 13:02:07 +0100 Subject: [PATCH 069/147] cleaning --- lib/damask/util.py | 35 +++++++++++++++++----------------- processing/post/addGrainID.py | 14 ++++++++++---- processing/post/postResults.py | 22 ++++++++++++--------- 3 files changed, 40 insertions(+), 31 deletions(-) diff --git a/lib/damask/util.py b/lib/damask/util.py index 754dd7c5d..a701a1288 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -135,27 +135,26 @@ class extendableOption(Option): # Print iterations progress # from https://gist.github.com/aubricus/f91fb55dc6ba5557fbab06119420dd6a def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100): - """ - Call in a loop to create terminal progress bar + """ + Call in a loop to create terminal progress bar - @params: - iteration - Required : current iteration (Int) - total - Required : total iterations (Int) - prefix - Optional : prefix string (Str) - suffix - Optional : suffix string (Str) - decimals - Optional : positive number of decimals in percent complete (Int) - bar_length - Optional : character length of bar (Int) - """ - str_format = "{0:." + str(decimals) + "f}" - percents = str_format.format(100 * (iteration / float(total))) - filled_length = int(round(bar_length * iteration / float(total))) - bar = '█' * filled_length + '-' * (bar_length - filled_length) + @params: + iteration - Required : current iteration (Int) + total - Required : total iterations (Int) + prefix - Optional : prefix string (Str) + suffix - Optional : suffix string (Str) + decimals - Optional : positive number of decimals in percent complete (Int) + bar_length - Optional : character length of bar (Int) + """ + str_format = "{0:." + str(decimals) + "f}" + percents = str_format.format(100 * (iteration / float(total))) + filled_length = int(round(bar_length * iteration / float(total))) + bar = '█' * filled_length + '-' * (bar_length - filled_length) - sys.stdout.write('\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix)), + sys.stderr.write('\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix)), - if iteration == total: - sys.stdout.write('\n') -sys.stdout.flush() + if iteration == total: sys.stderr.write('\n\n') + sys.stderr.flush() # ----------------------------- class backgroundMessage(threading.Thread): diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index 2eb3aec3a..2c4cfe5d6 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -29,20 +29,25 @@ parser.add_option('-d', parser.add_option('-s', '--symmetry', dest = 'symmetry', - type = 'string', metavar = 'string', + metavar = 'string', help = 'crystal symmetry [%default]') parser.add_option('-q', '--quaternion', dest = 'quaternion', - type = 'string', metavar = 'string', + metavar = 'string', help = 'label of quaternion') parser.add_option('-p', '--pos', '--position', dest = 'pos', - type = 'string', metavar = 'string', + metavar = 'string', help = 'label of coordinates [%default]') +parser.add_option('--quiet', + dest='verbose', + action = 'store_false', + help = 'hide status bar (useful when piping to file)') parser.set_defaults(disorientation = 5, + verbose = True, quaternion = 'orientation', symmetry = 'cubic', pos = 'pos', @@ -111,7 +116,7 @@ for name in filenames: table.data_rewind() while table.data_read(): # read next data line of ASCII table - if Npoints > 100 and p%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero + if options.verbose and Npoints > 100 and p%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero damask.util.print_progress(iteration=p,total=Npoints) o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))), @@ -160,6 +165,7 @@ for name in filenames: outputAlive = True p = 0 + damask.util.print_progress(iteration=1,total=1) while outputAlive and table.data_read(): # read next data line of ASCII table table.data_append(1+packingMap[grainID[p]]) # add (condensed) grain ID outputAlive = table.data_write() # output processed line diff --git a/processing/post/postResults.py b/processing/post/postResults.py index e075acdf5..6ccdd7c3f 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -636,7 +636,7 @@ parser.add_option('-p','--type', dest='filetype', help = 'type of result file [auto]') parser.add_option('-q','--quiet', dest='verbose', action = 'store_false', - help = 'legacy switch, no effect') + help = 'hide status bar (useful when piping to file)') group_material = OptionGroup(parser,'Material identifier') @@ -679,6 +679,7 @@ parser.add_option_group(group_special) parser.set_defaults(info = False, nodal = False, + verbose = True, prefix = '', suffix = '', dir = 'postProc', @@ -705,6 +706,8 @@ if files == []: parser.print_help() parser.error('no file specified...') +damask.util.report(scriptName,files[0]) + if not os.path.exists(files[0]): parser.print_help() parser.error('invalid file "%s" specified...'%files[0]) @@ -828,7 +831,7 @@ if options.info: elementsOfNode = {} Nelems = stat['NumberOfElements'] for e in range(Nelems): - if Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero + if options.verbose and Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero damask.util.print_progress(iteration=e,total=Nelems,prefix='1/3: connecting elements') for n in map(p.node_sequence,p.element(e).items): if n not in elementsOfNode: @@ -848,11 +851,12 @@ index = {} groups = [] groupCount = 0 memberCount = 0 -print('\n') +damask.util.print_progress(iteration=1,total=1,prefix='1/3: connecting elements') + if options.nodalScalar: Npoints = stat['NumberOfNodes'] for n in range(Npoints): - if Npoints > 100 and e%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero + if options.verbose and Npoints > 100 and e%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero damask.util.print_progress(iteration=n,total=Npoints,prefix='2/3: scanning nodes ') myNodeID = p.node_id(n) myNodeCoordinates = [p.node(n).x, p.node(n).y, p.node(n).z] @@ -884,12 +888,12 @@ if options.nodalScalar: myNodeCoordinates) # incrementally update average location groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member memberCount += 1 - print('\n') + damask.util.print_progress(iteration=1,total=1,prefix='2/3: scanning nodes ') else: Nelems = stat['NumberOfElements'] for e in range(Nelems): - if Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero + if options.verbose and Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero damask.util.print_progress(iteration=e,total=Nelems,prefix='2/3: scanning elements ') myElemID = p.element_id(e) myIpCoordinates = ipCoords(p.element(e).type, list(map(lambda node: [node.x, node.y, node.z], @@ -930,7 +934,7 @@ else: myIpCoordinates[n]) # incrementally update average location groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,n]) # append a new list defining each group member memberCount += 1 - print('\n') + damask.util.print_progress(iteration=1,total=1,prefix='2/3: scanning elements ') # --------------------------- sort groups -------------------------------- @@ -1030,7 +1034,7 @@ for incCount,position in enumerate(locations): # walk through locations Ngroups = len(groups) for j,group in enumerate(groups): f = incCount*Ngroups + j - if (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero + if options.verbose and (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero damask.util.print_progress(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ') N = 0 # group member counter for (e,n,i,g,n_local) in group[1:]: # loop over group members @@ -1122,7 +1126,7 @@ for incCount,position in enumerate(locations): # walk through locations group[0] + \ mappedResult) )) + '\n') -print('') +damask.util.print_progress(iteration=1,total=1,prefix='3/3: processing points ') if fileOpen: file.close() From 92c356a2c8fc9345a165850282a38f84d19a4436 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 13:18:03 +0100 Subject: [PATCH 070/147] updated tests --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index efa9fe4e9..d15faafa8 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit efa9fe4e97cf2dfebff97f3a07503fc277dabf8a +Subproject commit d15faafa81e7133977dcc6a160ed73a58de69ccb From 08ac49fac026e91fd45d695de5f32ebfa852a839 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 13:21:48 +0100 Subject: [PATCH 071/147] line too long --- processing/post/postResults.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/postResults.py b/processing/post/postResults.py index 6ccdd7c3f..de78180c1 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -1034,7 +1034,7 @@ for incCount,position in enumerate(locations): # walk through locations Ngroups = len(groups) for j,group in enumerate(groups): f = incCount*Ngroups + j - if options.verbose and (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero + if options.verbose and (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero damask.util.print_progress(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ') N = 0 # group member counter for (e,n,i,g,n_local) in group[1:]: # loop over group members From bc04b83d8ad5082545cdef8d4a5cf5c571dec7e0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 14:09:26 +0100 Subject: [PATCH 072/147] no reason for using python2.7 --- processing/post/addMises.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/addMises.py b/processing/post/addMises.py index 4719c2e35..55cf6552e 100755 --- a/processing/post/addMises.py +++ b/processing/post/addMises.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- import os,sys,math From 89b054e67b49edd700efc41b89197ae047034ed5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 14:29:19 +0100 Subject: [PATCH 073/147] ordered --- src/plastic_disloUCLA.f90 | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index bb06618e4..2716e7828 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -46,32 +46,32 @@ module plastic_disloUCLA real(pReal) :: & aTolRho, & grainSize, & - SolidSolutionStrength, & !< Strength due to elements in solid solution + SolidSolutionStrength, & !< Strength due to elements in solid solution mu, & D0, & !< prefactor for self-diffusion coefficient Qsd !< activation energy for dislocation climb real(pReal), allocatable, dimension(:) :: & - B, & !< friction coeff. B (kMC) rho0, & !< initial edge dislocation density per slip system for each family and instance rhoDip0, & !< initial edge dipole density per slip system for each family and instance burgers, & !< absolute length of burgers vector [m] for each slip system and instance + nonSchmidCoeff, & + minDipDistance, & + CLambda, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance + atomicVolume, & + !* mobility law parameters H0kp, & !< activation energy for glide [J] for each slip system and instance v0, & !< dislocation velocity prefactor [m/s] for each family and instance - CLambda, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance p, & !< p-exponent in glide velocity q, & !< q-exponent in glide velocity - !* mobility law parameters + B, & !< friction coeff. B (kMC) kink_height, & !< height of the kink pair kink_width, & !< width of the kink pair - omega, & !< attempt frequency for kink pair nucleation - viscosity, & !< friction coeff. B (kMC) - !* - tau_Peierls, & - nonSchmidCoeff, & - atomicVolume, & - minDipDistance + omega, & !< attempt frequency for kink pair nucleation + tau_Peierls + real(pReal), allocatable, dimension(:,:) :: & - interaction_SlipSlip !< slip resistance from slip activity + interaction_SlipSlip, & !< slip resistance from slip activity + forestProjectionEdge real(pReal), allocatable, dimension(:,:,:) :: & Schmid_slip, & Schmid_twin, & @@ -90,11 +90,11 @@ module plastic_disloUCLA type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance) type, private :: tDisloUCLAState - real(pReal), pointer, dimension(:,:) :: & - rhoEdge, & - rhoEdgeDip, & - accshear_slip, & - whole + real(pReal), pointer, dimension(:,:) :: & + rhoEdge, & + rhoEdgeDip, & + accshear_slip, & + whole end type type, private :: tDisloUCLAdependentState @@ -637,7 +637,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe else postResults(c+i) = huge(1.0_pReal) endif - postResults(c+i)=min(postResults(c+i),dst%mfp(i,of)) + postResults(c+i)=min(postResults(c+i),dst%mfp(i,of)) enddo end select From 331a2b9b78e5301091ce57203ce558033d76fa41 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 14:49:08 +0100 Subject: [PATCH 074/147] simplified --- src/plastic_disloUCLA.f90 | 82 +++++++++++++++------------------------ 1 file changed, 32 insertions(+), 50 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 2716e7828..7a84f4d0a 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -26,9 +26,6 @@ module plastic_disloUCLA plastic_disloUCLA_totalNslip !< total number of active slip systems for each instance - real(pReal), dimension(:,:,:), allocatable, private :: & - plastic_disloUCLA_forestProjectionEdge !< matrix of forest projections of edge dislocations for each instance - enum, bind(c) enumerator :: undefined_ID, & rho_ID, & @@ -68,7 +65,6 @@ module plastic_disloUCLA kink_width, & !< width of the kink pair omega, & !< attempt frequency for kink pair nucleation tau_Peierls - real(pReal), allocatable, dimension(:,:) :: & interaction_SlipSlip, & !< slip resistance from slip activity forestProjectionEdge @@ -192,7 +188,6 @@ subroutine plastic_disloUCLA_init() allocate(plastic_disloUCLA_totalNslip(maxNinstance), source=0_pInt) - allocate(param(maxNinstance)) allocate(state(maxNinstance)) allocate(dotState(maxNinstance)) @@ -355,6 +350,24 @@ subroutine plastic_disloUCLA_init() plasticState(p)%sizePostResults = sum(plastic_disloUCLA_sizePostResult(:,phase_plasticityInstance(p))) + allocate(prm%forestProjectionEdge(prm%totalNslip,prm%totalNslip),source = 0.0_pReal) + + i = 0_pInt + mySlipFamilies: do f = 1_pInt,size(prm%Nslip,1) + index_myFamily = sum(prm%Nslip(1:f-1_pInt)) + + slipSystemsLoop: do j = 1_pInt,prm%Nslip(f) + i = i + 1_pInt + do o = 1_pInt, size(prm%Nslip,1) + index_otherFamily = sum(prm%Nslip(1:o-1_pInt)) + do k = 1_pInt,prm%Nslip(o) ! loop over (active) systems in other family (slip) + prm%forestProjectionEdge(index_myFamily+j,index_otherFamily+k) = & + abs(math_mul3x3(lattice_sn(:,sum(lattice_NslipSystem(1:f-1,p))+j,p), & + lattice_st(:,sum(lattice_NslipSystem(1:o-1,p))+k,p))) + enddo; enddo + enddo slipSystemsLoop + enddo mySlipFamilies + offset_slip = 2_pInt*plasticState(p)%nSlip plasticState(p)%slipRate => & plasticState(p)%dotState(offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NofMyPhase) @@ -390,40 +403,8 @@ subroutine plastic_disloUCLA_init() plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally end associate - enddo - - allocate(plastic_disloUCLA_forestProjectionEdge(maxval(plastic_disloUCLA_totalNslip),& - maxval(plastic_disloUCLA_totalNslip),maxNinstance), & - source=0.0_pReal) - - do p = 1_pInt, size(phase_plasticityInstance) - if (phase_plasticity(p) /= PLASTICITY_DISLOUCLA_ID) cycle - associate(prm => param(phase_plasticityInstance(p)), & - dot => dotState(phase_plasticityInstance(p)), & - stt => state(phase_plasticityInstance(p)), & - dst => dependentState(phase_plasticityInstance(p))) - - mySlipFamilies: do f = 1_pInt,size(prm%Nslip,1) - index_myFamily = sum(prm%Nslip(1:f-1_pInt)) ! index in truncated slip system list - mySlipSystems: do j = 1_pInt,prm%Nslip(f) - - !* Calculation of forest projections for edge dislocations - otherSlipFamilies: do o = 1_pInt,size(prm%Nslip,1) - index_otherFamily = sum(prm%Nslip(1:o-1_pInt)) - otherSlipSystems: do k = 1_pInt,prm%Nslip(o) - plastic_disloUCLA_forestProjectionEdge(index_myFamily+j,index_otherFamily+k,phase_plasticityInstance(p)) = & - abs(math_mul3x3(lattice_sn(:,sum(lattice_NslipSystem(1:f-1,p))+j,p), & - lattice_st(:,sum(lattice_NslipSystem(1:o-1,p))+k,p))) - enddo otherSlipSystems; enddo otherSlipFamilies - - enddo mySlipSystems - enddo mySlipFamilies - end associate - -enddo - end subroutine plastic_disloUCLA_init @@ -444,7 +425,7 @@ subroutine plastic_disloUCLA_dependentState(instance,of) forall (i = 1_pInt:prm%totalNslip) invLambdaSlip(i) = sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & - plastic_disloUCLA_forestProjectionEdge(:,i,instance))) & + prm%forestProjectionEdge(:,i))) & / prm%Clambda(i) dst%threshold_stress(i,of) = prm%mu*prm%burgers(i) & * sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & @@ -480,8 +461,8 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,instance, Lp = 0.0_pReal dLp_dMp = 0.0_pReal - call kinetics(Mp,Temperature,instance,of, & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + call kinetics(prm,stt,dst,Mp,Temperature,of, & + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) slipSystems: do i = 1_pInt, prm%totalNslip Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & @@ -527,7 +508,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) associate(prm => param(instance), stt => state(instance),dot => dotState(instance), dst => dependentState(instance)) - call kinetics(Mp,Temperature,instance,of, & + call kinetics(prm,stt,dst,Mp,Temperature,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) dot%whole(:,of) = 0.0_pReal @@ -546,17 +527,17 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) DotRhoDipFormation = merge(((2.0_pReal*EdgeDipDistance)/prm%burgers)* stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)), & 0.0_pReal, & prm%dipoleformation) - ClimbVelocity = ((3.0_pReal*prm%mu*VacancyDiffusion*prm%atomicVolume)/(2.0_pReal*pi*kB*Temperature)) & + ClimbVelocity = (3.0_pReal*prm%mu*VacancyDiffusion*prm%atomicVolume/(2.0_pReal*pi*kB*Temperature)) & * (1.0_pReal/(EdgeDipDistance+prm%minDipDistance)) DotRhoEdgeDipClimb = (4.0_pReal*ClimbVelocity*stt%rhoEdgeDip(:,of))/(EdgeDipDistance-prm%minDipDistance) end where dot%rhoEdge(:,of) = abs(dot%accshear_slip(:,of))/(prm%burgers*dst%mfp(:,of)) & ! multiplication - DotRhoDipFormation & - - ((2.0_pReal*prm%minDipDistance)/prm%burgers)*stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)) !* Spontaneous annihilation of 2 single edge dislocations + - (2.0_pReal*prm%minDipDistance)/prm%burgers*stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)) !* Spontaneous annihilation of 2 single edge dislocations dot%rhoEdgeDip(:,of) = DotRhoDipFormation & - - ((2.0_pReal*prm%minDipDistance)/prm%burgers)* stt%rhoEdgeDip(:,of)*abs(dot%accshear_slip(:,of)) & !* Spontaneous annihilation of a single edge dislocation with a dipole constituent + - (2.0_pReal*prm%minDipDistance)/prm%burgers* stt%rhoEdgeDip(:,of)*abs(dot%accshear_slip(:,of)) & !* Spontaneous annihilation of a single edge dislocation with a dipole constituent - DotRhoEdgeDipClimb end associate @@ -592,7 +573,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos, & gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg - associate( prm => param(instance), stt => state(instance), dst => dependentState(instance)) + associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) postResults = 0.0_pReal c = 0_pInt @@ -605,7 +586,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe case (rhoDip_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%rhoEdgeDip(1_pInt:prm%totalNslip,of) case (shearrate_ID,stressexponent_ID) - call kinetics(Mp,Temperature,instance,of, & + call kinetics(prm,stt,dst,Mp,Temperature,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) if (prm%outputID(o) == shearrate_ID) then @@ -685,12 +666,13 @@ instance,of do j = 1_pInt, prm%totalNslip - - BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) - DotGamma0 = stt%rhoEdge(j,of)*prm%burgers(j)*prm%v0(j) - tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) + enddo + + do j = 1_pInt, prm%totalNslip + BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) + DotGamma0 = stt%rhoEdge(j,of)*prm%burgers(j)*prm%v0(j) significantPositiveTau: if((abs(tau_slip_pos(j))-dst%threshold_stress(j, of)) > tol_math_check) then From a0b389776d968f5d5a59f186f2ecdc1ab79f478c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 15:00:37 +0100 Subject: [PATCH 075/147] same structure as for dislotwin --- src/plastic_disloUCLA.f90 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 7a84f4d0a..9a5997a34 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -456,7 +456,7 @@ subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,instance, real(pReal), dimension(param(instance)%totalNslip) :: & gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg - associate(prm => param(instance)) + associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) Lp = 0.0_pReal dLp_dMp = 0.0_pReal @@ -632,7 +632,7 @@ end function plastic_disloUCLA_postResults !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -subroutine kinetics(Mp,Temperature,instance,of, & +subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) use prec, only: & tol_math_check, & @@ -642,19 +642,25 @@ subroutine kinetics(Mp,Temperature,instance,of, & math_mul33xx33 implicit none + type(tParameters), intent(in) :: & + prm + type(tDisloUCLAState), intent(in) :: & + stt + type(tDisloUCLAdependentState), intent(in) :: & + dst real(pReal), dimension(3,3), intent(in) :: & Mp !< 2nd Piola Kirchhoff stress tensor in Mandel notation real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & -instance,of + of integer(pInt) :: & j real(pReal) :: StressRatio_p,StressRatio_pminus1,& BoltzmannRatio,DotGamma0,stressRatio,& dvel_slip, vel_slip - real(pReal), intent(out), dimension(plastic_disloUCLA_totalNslip(instance)) :: & + real(pReal), intent(out), dimension(prm%totalNslip) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg gdot_slip_pos = 0.0_pReal @@ -662,9 +668,6 @@ instance,of dgdot_dtauslip_pos = 0.0_pReal dgdot_dtauslip_neg = 0.0_pReal - associate(prm => param(instance), stt => state(instance),dst => dependentState(instance)) - - do j = 1_pInt, prm%totalNslip tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) @@ -797,7 +800,6 @@ instance,of dgdot_dtauslip_neg(j) = DotGamma0 * dvel_slip endif significantNegativeTau enddo - end associate end subroutine kinetics From e0cd88d98a8b7d9538f763c7ac0af7258d257497 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 15:25:54 +0100 Subject: [PATCH 076/147] preparing for vectorization --- src/plastic_disloUCLA.f90 | 81 ++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 9a5997a34..840114e22 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -657,11 +657,13 @@ math_mul33xx33 integer(pInt) :: & j - real(pReal) :: StressRatio_p,StressRatio_pminus1,& - BoltzmannRatio,DotGamma0,stressRatio,& - dvel_slip, vel_slip + real(pReal) :: dvel_slip, vel_slip real(pReal), intent(out), dimension(prm%totalNslip) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg + real(pReal), dimension(prm%totalNslip) :: & + StressRatio, BoltzmannRatio, & + StressRatio_p,StressRatio_pminus1, & + DotGamma0 gdot_slip_pos = 0.0_pReal gdot_slip_neg = 0.0_pReal @@ -673,56 +675,57 @@ math_mul33xx33 tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) enddo + BoltzmannRatio = prm%H0kp/(kB*Temperature) + DotGamma0 = stt%rhoEdge(:,of)*prm%burgers*prm%v0 + do j = 1_pInt, prm%totalNslip - BoltzmannRatio = prm%H0kp(j)/(kB*Temperature) - DotGamma0 = stt%rhoEdge(j,of)*prm%burgers(j)*prm%v0(j) significantPositiveTau: if((abs(tau_slip_pos(j))-dst%threshold_stress(j, of)) > tol_math_check) then - stressRatio = ((abs(tau_slip_pos(j))-dst%threshold_stress(j, of)) & + StressRatio(j) = ((abs(tau_slip_pos(j))-dst%threshold_stress(j, of)) & / (prm%solidSolutionStrength+prm%tau_Peierls(j))) - stressRatio_p = stressRatio** prm%p(j) - stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) + StressRatio_p(j) = StressRatio(j)** prm%p(j) + StressRatio_pminus1(j) = StressRatio(j)**(prm%p(j)-1.0_pReal) vel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & * ( dst%mfp(j,of) - prm%kink_width(j) ) & * (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * prm%B(j) & *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & ) - gdot_slip_pos(j) = DotGamma0 * sign(vel_slip,tau_slip_pos(j)) + gdot_slip_pos(j) = DotGamma0(j) * sign(vel_slip,tau_slip_pos(j)) dvel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & * ( dst%mfp(j,of) - prm%kink_width(j) ) & * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + (exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & + tau_slip_pos(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& - *BoltzmannRatio*prm%p(j)& + * (abs(exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)))& + *BoltzmannRatio(j)*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & + StressRatio_pminus1(j)*(1-StressRatio_p(j))**(prm%q(j)-1.0_pReal) ) & ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * prm%B(j) & *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & ) & - (tau_slip_pos(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * prm%B(j) & *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& - *BoltzmannRatio*prm%p(j)& + * (abs(exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)))& + *BoltzmannRatio(j)*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& + StressRatio_pminus1(j)*(1-StressRatio_p(j))**(prm%q(j)-1.0_pReal) )& ) & ) & / ( & @@ -730,61 +733,61 @@ math_mul33xx33 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & + prm%omega(j) * prm%B(j) & *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & )**2.0_pReal & ) - dgdot_dtauslip_pos(j) = DotGamma0 * dvel_slip + dgdot_dtauslip_pos(j) = DotGamma0(j) * dvel_slip endif significantPositiveTau significantNegativeTau: if((abs(tau_slip_neg(j))-dst%threshold_stress(j, of)) > tol_math_check) then - stressRatio = ((abs(tau_slip_neg(j))-dst%threshold_stress(j, of)) & + StressRatio(j) = ((abs(tau_slip_neg(j))-dst%threshold_stress(j, of)) & / (prm%solidSolutionStrength+prm%tau_Peierls(j))) - stressRatio_p = stressRatio** prm%p(j) - stressRatio_pminus1 = stressRatio**(prm%p(j)-1.0_pReal) + StressRatio_p(j) = StressRatio(j)** prm%p(j) + StressRatio_pminus1(j) = StressRatio(j)**(prm%p(j)-1.0_pReal) vel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & * ( dst%mfp(j,of) - prm%kink_width(j) ) & * (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & / ( & 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * prm%B(j) & *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & ) - gdot_slip_neg(j) = DotGamma0 * sign(vel_slip,tau_slip_neg(j)) + gdot_slip_neg(j) = DotGamma0(j) * sign(vel_slip,tau_slip_neg(j)) dvel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & * ( dst%mfp(j,of) - prm%kink_width(j) ) & * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + (exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & + tau_slip_neg(j) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& - *BoltzmannRatio*prm%p(j)& + * (abs(exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)))& + *BoltzmannRatio(j)*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) ) & + StressRatio_pminus1(j)*(1-StressRatio_p(j))**(prm%q(j)-1.0_pReal) ) & ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * prm%B(j) & *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & ) & - (tau_slip_neg(j) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) ) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & + prm%omega(j) * prm%B(j) & *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)))& - *BoltzmannRatio*prm%p(j)& + * (abs(exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)))& + *BoltzmannRatio(j)*prm%p(j)& *prm%q(j)/& (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q(j)-1.0_pReal) )& + StressRatio_pminus1(j)*(1-StressRatio_p(j))**(prm%q(j)-1.0_pReal) )& ) & ) & / ( & @@ -792,12 +795,12 @@ math_mul33xx33 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & + prm%omega(j) * prm%B(j) & *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q(j)) & + * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & )**2.0_pReal & ) - dgdot_dtauslip_neg(j) = DotGamma0 * dvel_slip + dgdot_dtauslip_neg(j) = DotGamma0(j) * dvel_slip endif significantNegativeTau enddo From accd39b27f7ec255636b0cacb2362f9bd25fd9c8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 15:58:51 +0100 Subject: [PATCH 077/147] structuring --- src/plastic_disloUCLA.f90 | 45 ++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 840114e22..86c1dd887 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -224,33 +224,30 @@ subroutine plastic_disloUCLA_init() prm%interaction_SlipSlip = lattice_interaction_SlipSlip(prm%Nslip, & config_phase(p)%getFloats('interaction_slipslip'), & structure(1:3)) - prm%rho0 = config_phase(p)%getFloats('rhoedge0') - prm%rhoDip0 = config_phase(p)%getFloats('rhoedgedip0') - prm%burgers = config_phase(p)%getFloats('slipburgers') - prm%H0kp = config_phase(p)%getFloats('qedge') - prm%v0 = config_phase(p)%getFloats('v0') - prm%clambda = config_phase(p)%getFloats('clambdaslip') - prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls') - prm%p = config_phase(p)%getFloats('p_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) - prm%q = config_phase(p)%getFloats('q_slip',defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) - prm%kink_height = config_phase(p)%getFloats('kink_height') - prm%kink_width = config_phase(p)%getFloats('kink_width') - prm%omega = config_phase(p)%getFloats('omega') - - prm%B = config_phase(p)%getFloats('friction_coeff') - + prm%rho0 = config_phase(p)%getFloats('rhoedge0', requiredShape=shape(prm%Nslip)) + prm%rhoDip0 = config_phase(p)%getFloats('rhoedgedip0', requiredShape=shape(prm%Nslip)) + prm%burgers = config_phase(p)%getFloats('slipburgers', requiredShape=shape(prm%Nslip)) + prm%H0kp = config_phase(p)%getFloats('qedge', requiredShape=shape(prm%Nslip)) + prm%v0 = config_phase(p)%getFloats('v0', requiredShape=shape(prm%Nslip)) + prm%clambda = config_phase(p)%getFloats('clambdaslip', requiredShape=shape(prm%Nslip)) + prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls', requiredShape=shape(prm%Nslip)) + prm%p = config_phase(p)%getFloats('p_slip', requiredShape=shape(prm%Nslip), & + defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) + prm%q = config_phase(p)%getFloats('q_slip', requiredShape=shape(prm%Nslip), & + defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) + prm%kink_height = config_phase(p)%getFloats('kink_height', requiredShape=shape(prm%Nslip)) + prm%kink_width = config_phase(p)%getFloats('kink_width', requiredShape=shape(prm%Nslip)) + prm%omega = config_phase(p)%getFloats('omega', requiredShape=shape(prm%Nslip)) + prm%B = config_phase(p)%getFloats('friction_coeff', requiredShape=shape(prm%Nslip)) prm%SolidSolutionStrength = config_phase(p)%getFloat('solidsolutionstrength') + prm%grainSize = config_phase(p)%getFloat('grainsize') + prm%D0 = config_phase(p)%getFloat('d0') + prm%Qsd = config_phase(p)%getFloat('qsd') + prm%atomicVolume = config_phase(p)%getFloat('catomicvolume') * prm%burgers**3.0_pReal + prm%minDipDistance = config_phase(p)%getFloat('cedgedipmindistance') * prm%burgers + prm%dipoleformation = config_phase(p)%getFloat('dipoleformationfactor') > 0.0_pReal !should be on by default - prm%grainSize = config_phase(p)%getFloat('grainsize') - - prm%D0 = config_phase(p)%getFloat('d0') - prm%Qsd= config_phase(p)%getFloat('qsd') - - - prm%dipoleformation = config_phase(p)%getFloat('dipoleformationfactor') > 0.0_pReal !should be on by default - prm%atomicVolume = config_phase(p)%getFloat('catomicvolume') * prm%burgers**3.0_pReal - prm%minDipDistance = config_phase(p)%getFloat('cedgedipmindistance') * prm%burgers ! expand: family => system prm%rho0 = math_expand(prm%rho0, prm%Nslip) From ddecacb1727e3906f45f84ebced466e774430b03 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 16:35:28 +0100 Subject: [PATCH 078/147] ready for vectorization --- src/plastic_disloUCLA.f90 | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 86c1dd887..010e383a1 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -654,13 +654,12 @@ math_mul33xx33 integer(pInt) :: & j - real(pReal) :: dvel_slip, vel_slip real(pReal), intent(out), dimension(prm%totalNslip) :: & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg real(pReal), dimension(prm%totalNslip) :: & StressRatio, BoltzmannRatio, & StressRatio_p,StressRatio_pminus1, & - DotGamma0 + DotGamma0, dvel_slip, vel_slip gdot_slip_pos = 0.0_pReal gdot_slip_neg = 0.0_pReal @@ -676,15 +675,13 @@ math_mul33xx33 DotGamma0 = stt%rhoEdge(:,of)*prm%burgers*prm%v0 do j = 1_pInt, prm%totalNslip - - significantPositiveTau: if((abs(tau_slip_pos(j))-dst%threshold_stress(j, of)) > tol_math_check) then - - StressRatio(j) = ((abs(tau_slip_pos(j))-dst%threshold_stress(j, of)) & - / (prm%solidSolutionStrength+prm%tau_Peierls(j))) + significantPositiveTau: if(abs(tau_slip_pos(j))-dst%threshold_stress(j,of) > tol_math_check) then + StressRatio(j) = (abs(tau_slip_pos(j))-dst%threshold_stress(j,of)) & + / (prm%solidSolutionStrength+prm%tau_Peierls(j)) StressRatio_p(j) = StressRatio(j)** prm%p(j) StressRatio_pminus1(j) = StressRatio(j)**(prm%p(j)-1.0_pReal) - vel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & + vel_slip(j) = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & * ( dst%mfp(j,of) - prm%kink_width(j) ) & * (tau_slip_pos(j) & * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & @@ -695,9 +692,9 @@ math_mul33xx33 * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & ) - gdot_slip_pos(j) = DotGamma0(j) * sign(vel_slip,tau_slip_pos(j)) + gdot_slip_pos(j) = DotGamma0(j) * sign(vel_slip(j),tau_slip_pos(j)) - dvel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & + dvel_slip(j) = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & * ( dst%mfp(j,of) - prm%kink_width(j) ) & * ( & (exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & @@ -734,19 +731,17 @@ math_mul33xx33 )**2.0_pReal & ) - dgdot_dtauslip_pos(j) = DotGamma0(j) * dvel_slip + dgdot_dtauslip_pos(j) = DotGamma0(j) * dvel_slip(j) endif significantPositiveTau - - significantNegativeTau: if((abs(tau_slip_neg(j))-dst%threshold_stress(j, of)) > tol_math_check) then - - StressRatio(j) = ((abs(tau_slip_neg(j))-dst%threshold_stress(j, of)) & - / (prm%solidSolutionStrength+prm%tau_Peierls(j))) + significantNegativeTau: if(abs(tau_slip_neg(j))-dst%threshold_stress(j,of) > tol_math_check) then + StressRatio(j) = (abs(tau_slip_neg(j))-dst%threshold_stress(j,of)) & + / (prm%solidSolutionStrength+prm%tau_Peierls(j)) StressRatio_p(j) = StressRatio(j)** prm%p(j) StressRatio_pminus1(j) = StressRatio(j)**(prm%p(j)-1.0_pReal) - vel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & + vel_slip(j) = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & * ( dst%mfp(j,of) - prm%kink_width(j) ) & * (tau_slip_neg(j) & * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & @@ -757,9 +752,9 @@ math_mul33xx33 * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & ) - gdot_slip_neg(j) = DotGamma0(j) * sign(vel_slip,tau_slip_neg(j)) + gdot_slip_neg(j) = DotGamma0(j) * sign(vel_slip(j),tau_slip_neg(j)) - dvel_slip = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & + dvel_slip(j) = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & * ( dst%mfp(j,of) - prm%kink_width(j) ) & * ( & (exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & @@ -797,7 +792,7 @@ math_mul33xx33 ) - dgdot_dtauslip_neg(j) = DotGamma0(j) * dvel_slip + dgdot_dtauslip_neg(j) = DotGamma0(j) * dvel_slip(j) endif significantNegativeTau enddo From 9e03aae3bf57fce6095523dd4581f9dc2db68d6b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 17:35:48 +0100 Subject: [PATCH 079/147] vectorized --- src/plastic_disloUCLA.f90 | 232 ++++++++++++++++++-------------------- 1 file changed, 111 insertions(+), 121 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 010e383a1..a10121318 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -22,10 +22,6 @@ module plastic_disloUCLA real(pReal), parameter, private :: & kB = 1.38e-23_pReal !< Boltzmann constant in J/Kelvin - integer(pInt), dimension(:), allocatable, private :: & - plastic_disloUCLA_totalNslip !< total number of active slip systems for each instance - - enum, bind(c) enumerator :: undefined_ID, & rho_ID, & @@ -185,9 +181,6 @@ subroutine plastic_disloUCLA_init() allocate(plastic_disloUCLA_output(maxval(phase_Noutput),maxNinstance)) plastic_disloUCLA_output = '' - - allocate(plastic_disloUCLA_totalNslip(maxNinstance), source=0_pInt) - allocate(param(maxNinstance)) allocate(state(maxNinstance)) allocate(dotState(maxNinstance)) @@ -248,25 +241,23 @@ subroutine plastic_disloUCLA_init() prm%minDipDistance = config_phase(p)%getFloat('cedgedipmindistance') * prm%burgers prm%dipoleformation = config_phase(p)%getFloat('dipoleformationfactor') > 0.0_pReal !should be on by default - ! expand: family => system - prm%rho0 = math_expand(prm%rho0, prm%Nslip) - prm%rhoDip0 = math_expand(prm%rhoDip0, prm%Nslip) - prm%q = math_expand(prm%q, prm%Nslip) - prm%p = math_expand(prm%p, prm%Nslip) - prm%H0kp = math_expand(prm%H0kp, prm%Nslip) - prm%burgers = math_expand(prm%burgers, prm%Nslip) - prm%kink_height = math_expand(prm%kink_height, prm%Nslip) - prm%kink_width = math_expand(prm%kink_width, prm%Nslip) - prm%omega = math_expand(prm%omega, prm%Nslip) - prm%tau_Peierls = math_expand(prm%tau_Peierls, prm%Nslip) - prm%v0 = math_expand(prm%v0, prm%Nslip) - prm%B = math_expand(prm%B, prm%Nslip) - prm%clambda = math_expand(prm%clambda, prm%Nslip) - prm%atomicVolume = math_expand(prm%atomicVolume, prm%Nslip) - prm%minDipDistance = math_expand(prm%minDipDistance, prm%Nslip) + prm%rho0 = math_expand(prm%rho0, prm%Nslip) + prm%rhoDip0 = math_expand(prm%rhoDip0, prm%Nslip) + prm%q = math_expand(prm%q, prm%Nslip) + prm%p = math_expand(prm%p, prm%Nslip) + prm%H0kp = math_expand(prm%H0kp, prm%Nslip) + prm%burgers = math_expand(prm%burgers, prm%Nslip) + prm%kink_height = math_expand(prm%kink_height, prm%Nslip) + prm%kink_width = math_expand(prm%kink_width, prm%Nslip) + prm%omega = math_expand(prm%omega, prm%Nslip) + prm%tau_Peierls = math_expand(prm%tau_Peierls, prm%Nslip) + prm%v0 = math_expand(prm%v0, prm%Nslip) + prm%B = math_expand(prm%B, prm%Nslip) + prm%clambda = math_expand(prm%clambda, prm%Nslip) + prm%atomicVolume = math_expand(prm%atomicVolume, prm%Nslip) + prm%minDipDistance = math_expand(prm%minDipDistance, prm%Nslip) - plastic_disloUCLA_totalNslip(phase_plasticityInstance(p)) = prm%totalNslip !if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') ! if (prm%D0 <= 0.0_pReal) & @@ -439,7 +430,7 @@ end subroutine plastic_disloUCLA_dependentState !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- -subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,instance,of) +pure subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,instance,of) implicit none integer(pInt), intent(in) :: instance, of @@ -496,7 +487,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) real(pReal) :: & VacancyDiffusion - real(pReal), dimension(plastic_disloUCLA_totalNslip(instance)) :: & + real(pReal), dimension(param(instance)%totalNslip) :: & gdot_slip_pos, gdot_slip_neg,& tau_slip_pos,& tau_slip_neg, & @@ -629,7 +620,7 @@ end function plastic_disloUCLA_postResults !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & +pure subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) use prec, only: & tol_math_check, & @@ -661,11 +652,6 @@ math_mul33xx33 StressRatio_p,StressRatio_pminus1, & DotGamma0, dvel_slip, vel_slip - gdot_slip_pos = 0.0_pReal - gdot_slip_neg = 0.0_pReal - dgdot_dtauslip_pos = 0.0_pReal - dgdot_dtauslip_neg = 0.0_pReal - do j = 1_pInt, prm%totalNslip tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) @@ -674,127 +660,131 @@ math_mul33xx33 BoltzmannRatio = prm%H0kp/(kB*Temperature) DotGamma0 = stt%rhoEdge(:,of)*prm%burgers*prm%v0 - do j = 1_pInt, prm%totalNslip - significantPositiveTau: if(abs(tau_slip_pos(j))-dst%threshold_stress(j,of) > tol_math_check) then - StressRatio(j) = (abs(tau_slip_pos(j))-dst%threshold_stress(j,of)) & - / (prm%solidSolutionStrength+prm%tau_Peierls(j)) - StressRatio_p(j) = StressRatio(j)** prm%p(j) - StressRatio_pminus1(j) = StressRatio(j)**(prm%p(j)-1.0_pReal) + significantPositiveTau: where(abs(tau_slip_pos)-dst%threshold_stress(:,of) > tol_math_check) + StressRatio = (abs(tau_slip_pos)-dst%threshold_stress(:,of)) & + / (prm%solidSolutionStrength+prm%tau_Peierls) + StressRatio_p = StressRatio** prm%p + StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) - vel_slip(j) = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & - * ( dst%mfp(j,of) - prm%kink_width(j) ) & - * (tau_slip_pos(j) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & + vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & + * ( dst%mfp(:,of) - prm%kink_width ) & + * (tau_slip_pos & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & / ( & - 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * prm%B(j) & - *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & + 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) - gdot_slip_pos(j) = DotGamma0(j) * sign(vel_slip(j),tau_slip_pos(j)) + gdot_slip_pos = DotGamma0 * sign(vel_slip,tau_slip_pos) - dvel_slip(j) = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & - * ( dst%mfp(j,of) - prm%kink_width(j) ) & + dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & + * ( dst%mfp(:,of) - prm%kink_width ) & * ( & - (exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & - + tau_slip_pos(j) & - * (abs(exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)))& - *BoltzmannRatio(j)*prm%p(j)& - *prm%q(j)/& - (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1(j)*(1-StressRatio_p(j))**(prm%q(j)-1.0_pReal) ) & + (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + + tau_slip_pos & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& + *BoltzmannRatio*prm%p& + *prm%q/& + (prm%solidSolutionStrength+prm%tau_Peierls)*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) ) & ) & - * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * prm%B(j) & - *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & + * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) & - - (tau_slip_pos(j) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & - * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & - + prm%omega(j) * prm%B(j) & - *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)))& - *BoltzmannRatio(j)*prm%p(j)& - *prm%q(j)/& - (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1(j)*(1-StressRatio_p(j))**(prm%q(j)-1.0_pReal) )& + - (tau_slip_pos & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & + * (2.0_pReal*(prm%burgers**2.0_pReal) & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& + *BoltzmannRatio*prm%p& + *prm%q/& + (prm%solidSolutionStrength+prm%tau_Peierls)*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& ) & ) & / ( & ( & - 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_pos(j) & - + prm%omega(j) * prm%B(j) & - *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & + 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & )**2.0_pReal & ) - dgdot_dtauslip_pos(j) = DotGamma0(j) * dvel_slip(j) + dgdot_dtauslip_pos = DotGamma0 * dvel_slip +else where significantPositiveTau + gdot_slip_pos = 0.0_pReal + dgdot_dtauslip_pos = 0.0_pReal +end where significantPositiveTau - endif significantPositiveTau + significantNegativeTau: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) + StressRatio = (abs(tau_slip_neg)-dst%threshold_stress(:,of)) & + / (prm%solidSolutionStrength+prm%tau_Peierls) + StressRatio_p = StressRatio** prm%p + StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) - significantNegativeTau: if(abs(tau_slip_neg(j))-dst%threshold_stress(j,of) > tol_math_check) then - StressRatio(j) = (abs(tau_slip_neg(j))-dst%threshold_stress(j,of)) & - / (prm%solidSolutionStrength+prm%tau_Peierls(j)) - StressRatio_p(j) = StressRatio(j)** prm%p(j) - StressRatio_pminus1(j) = StressRatio(j)**(prm%p(j)-1.0_pReal) - - vel_slip(j) = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & - * ( dst%mfp(j,of) - prm%kink_width(j) ) & - * (tau_slip_neg(j) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & + vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & + * ( dst%mfp(:,of) - prm%kink_width ) & + * (tau_slip_neg & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & / ( & - 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * prm%B(j) & - *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & + 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) - gdot_slip_neg(j) = DotGamma0(j) * sign(vel_slip(j),tau_slip_neg(j)) + gdot_slip_neg = DotGamma0 * sign(vel_slip,tau_slip_neg) - dvel_slip(j) = 2.0_pReal*prm%burgers(j) * prm%kink_height(j) * prm%omega(j) & - * ( dst%mfp(j,of) - prm%kink_width(j) ) & + dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & + * ( dst%mfp(:,of) - prm%kink_width ) & * ( & - (exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & - + tau_slip_neg(j) & - * (abs(exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)))& - *BoltzmannRatio(j)*prm%p(j)& - *prm%q(j)/& - (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1(j)*(1-StressRatio_p(j))**(prm%q(j)-1.0_pReal) ) & + (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + + tau_slip_neg & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& + *BoltzmannRatio*prm%p& + *prm%q/& + (prm%solidSolutionStrength+prm%tau_Peierls)*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) ) & ) & - * (2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * prm%B(j) & - *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & + * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) & - - (tau_slip_neg(j) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) ) & - * (2.0_pReal*(prm%burgers(j)**2.0_pReal) & - + prm%omega(j) * prm%B(j) & - *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)))& - *BoltzmannRatio(j)*prm%p(j)& - *prm%q(j)/& - (prm%solidSolutionStrength+prm%tau_Peierls(j))*& - StressRatio_pminus1(j)*(1-StressRatio_p(j))**(prm%q(j)-1.0_pReal) )& + - (tau_slip_neg & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & + * (2.0_pReal*(prm%burgers**2.0_pReal) & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& + *BoltzmannRatio*prm%p& + *prm%q/& + (prm%solidSolutionStrength+prm%tau_Peierls)*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& ) & ) & / ( & ( & - 2.0_pReal*(prm%burgers(j)**2.0_pReal)*tau_slip_neg(j) & - + prm%omega(j) * prm%B(j) & - *(( dst%mfp(j,of) - prm%kink_width(j) )**2.0_pReal) & - * exp(-BoltzmannRatio(j)*(1-StressRatio_p(j)) ** prm%q(j)) & + 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & )**2.0_pReal & ) - dgdot_dtauslip_neg(j) = DotGamma0(j) * dvel_slip(j) - endif significantNegativeTau - enddo + dgdot_dtauslip_neg = DotGamma0 * dvel_slip +else where significantNegativeTau + gdot_slip_neg = 0.0_pReal + dgdot_dtauslip_neg = 0.0_pReal +end where significantNegativeTau + end subroutine kinetics From aa9cacdcb087c3fcde9aa8c0aacf6ea95942c1b9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 17:36:01 +0100 Subject: [PATCH 080/147] naming as in dislotwin+phenopowerlaw --- src/plastic_disloUCLA.f90 | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index a10121318..b58e9320b 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -150,13 +150,13 @@ subroutine plastic_disloUCLA_init() use lattice implicit none - integer(pInt) :: maxNinstance,& + integer(pInt) :: Ninstance,& f,j,k,o, i, & outputSize, & offset_slip, index_myFamily, index_otherFamily, & startIndex, endIndex, p, & sizeState, sizeDotState, & - NofMyPhase + NipcMyPhase character(len=65536) :: & structure = '' character(len=65536), dimension(:), allocatable :: outputs @@ -171,20 +171,20 @@ subroutine plastic_disloUCLA_init() write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - maxNinstance = int(count(phase_plasticity == PLASTICITY_DISLOUCLA_ID),pInt) - if (maxNinstance == 0_pInt) return + Ninstance = int(count(phase_plasticity == PLASTICITY_DISLOUCLA_ID),pInt) + if (Ninstance == 0_pInt) return if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance + write(6,'(a16,1x,i5,/)') '# instances:',Ninstance - allocate(plastic_disloUCLA_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) - allocate(plastic_disloUCLA_output(maxval(phase_Noutput),maxNinstance)) + allocate(plastic_disloUCLA_sizePostResult(maxval(phase_Noutput),Ninstance),source=0_pInt) + allocate(plastic_disloUCLA_output(maxval(phase_Noutput),Ninstance)) plastic_disloUCLA_output = '' - allocate(param(maxNinstance)) - allocate(state(maxNinstance)) - allocate(dotState(maxNinstance)) - allocate(dependentState(maxNinstance)) + allocate(param(Ninstance)) + allocate(state(Ninstance)) + allocate(dotState(Ninstance)) + allocate(dependentState(Ninstance)) do p = 1_pInt, size(phase_plasticityInstance) @@ -325,7 +325,7 @@ subroutine plastic_disloUCLA_init() enddo - NofMyPhase=count(material_phase==p) + NipcMyPhase=count(material_phase==p) !-------------------------------------------------------------------------------------------------- ! allocate state arrays @@ -333,7 +333,7 @@ subroutine plastic_disloUCLA_init() sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * prm%totalNslip sizeState = sizeDotState - call material_allocatePlasticState(p,NofMyPhase,sizeState,sizeDotState,0_pInt, & + call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & prm%totalNslip,0_pInt,0_pInt) plasticState(p)%sizePostResults = sum(plastic_disloUCLA_sizePostResult(:,phase_plasticityInstance(p))) @@ -358,21 +358,21 @@ subroutine plastic_disloUCLA_init() offset_slip = 2_pInt*plasticState(p)%nSlip plasticState(p)%slipRate => & - plasticState(p)%dotState(offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NofMyPhase) + plasticState(p)%dotState(offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NipcMyPhase) plasticState(p)%accumulatedSlip => & - plasticState(p)%state (offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NofMyPhase) + plasticState(p)%state (offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NipcMyPhase) startIndex=1_pInt endIndex=prm%totalNslip stt%rhoEdge=>plasticState(p)%state(startIndex:endIndex,:) - stt%rhoEdge= spread(prm%rho0,2,NofMyPhase) + stt%rhoEdge= spread(prm%rho0,2,NipcMyPhase) dot%rhoEdge=>plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho startIndex=endIndex+1_pInt endIndex=endIndex+prm%totalNslip stt%rhoEdgeDip=>plasticState(p)%state(startIndex:endIndex,:) - stt%rhoEdgeDip= spread(prm%rhoDip0,2,NofMyPhase) + stt%rhoEdgeDip= spread(prm%rhoDip0,2,NipcMyPhase) dot%rhoEdgeDip=>plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho @@ -385,8 +385,8 @@ subroutine plastic_disloUCLA_init() dot%whole => plasticState(p)%dotState - allocate(dst%mfp(prm%totalNslip,NofMyPhase),source=0.0_pReal) - allocate(dst%threshold_stress(prm%totalNslip,NofMyPhase),source=0.0_pReal) + allocate(dst%mfp(prm%totalNslip,NipcMyPhase),source=0.0_pReal) + allocate(dst%threshold_stress(prm%totalNslip,NipcMyPhase),source=0.0_pReal) plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally From 6256de8785697a20435c9d99bffc29a0a33adcd3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 17:53:20 +0100 Subject: [PATCH 081/147] re-implemented sanity checks --- src/plastic_disloUCLA.f90 | 49 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index b58e9320b..9006b092d 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -125,6 +125,8 @@ subroutine plastic_disloUCLA_init() compiler_version, & compiler_options #endif + use prec, only: & + pStringLen use debug, only: & debug_level,& debug_constitutive,& @@ -157,8 +159,9 @@ subroutine plastic_disloUCLA_init() startIndex, endIndex, p, & sizeState, sizeDotState, & NipcMyPhase - character(len=65536) :: & - structure = '' + character(len=pStringLen) :: & + structure = '',& + extmsg = '' character(len=65536), dimension(:), allocatable :: outputs integer(kind(undefined_ID)) :: outputID integer(pInt), dimension(0), parameter :: emptyIntArray = [integer(pInt)::] @@ -218,11 +221,12 @@ subroutine plastic_disloUCLA_init() config_phase(p)%getFloats('interaction_slipslip'), & structure(1:3)) prm%rho0 = config_phase(p)%getFloats('rhoedge0', requiredShape=shape(prm%Nslip)) - prm%rhoDip0 = config_phase(p)%getFloats('rhoedgedip0', requiredShape=shape(prm%Nslip)) - prm%burgers = config_phase(p)%getFloats('slipburgers', requiredShape=shape(prm%Nslip)) - prm%H0kp = config_phase(p)%getFloats('qedge', requiredShape=shape(prm%Nslip)) - prm%v0 = config_phase(p)%getFloats('v0', requiredShape=shape(prm%Nslip)) - prm%clambda = config_phase(p)%getFloats('clambdaslip', requiredShape=shape(prm%Nslip)) + prm%rhoDip0 = config_phase(p)%getFloats('rhoedgedip0', requiredShape=shape(prm%Nslip)) + prm%v0 = config_phase(p)%getFloats('v0', requiredShape=shape(prm%Nslip)) + prm%burgers = config_phase(p)%getFloats('slipburgers', requiredShape=shape(prm%Nslip)) + prm%H0kp = config_phase(p)%getFloats('qedge', requiredShape=shape(prm%Nslip)) + + prm%clambda = config_phase(p)%getFloats('clambdaslip', requiredShape=shape(prm%Nslip)) prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls', requiredShape=shape(prm%Nslip)) prm%p = config_phase(p)%getFloats('p_slip', requiredShape=shape(prm%Nslip), & defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) @@ -258,25 +262,22 @@ subroutine plastic_disloUCLA_init() prm%atomicVolume = math_expand(prm%atomicVolume, prm%Nslip) prm%minDipDistance = math_expand(prm%minDipDistance, prm%Nslip) - !if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') - ! if (prm%D0 <= 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='D0 ('//PLASTICITY_DISLOUCLA_label//')') - ! if (plastic_disloUCLA_Qsd(instance) <= 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='Qsd ('//PLASTICITY_DISLOUCLA_label//')') + ! sanity checks + if (any(prm%rho0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedge0' + if (any(prm%rhoDip0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedgedip0' + if (any(prm%v0 < 0.0_pReal)) extmsg = trim(extmsg)//' v0' + if (any(prm%burgers <= 0.0_pReal)) extmsg = trim(extmsg)//' slipburgers' + if (any(prm%H0kp <= 0.0_pReal)) extmsg = trim(extmsg)//' qedge' + if (any(prm%tau_peierls < 0.0_pReal)) extmsg = trim(extmsg)//' tau_peierls' + + if ( prm%D0 <= 0.0_pReal) extmsg = trim(extmsg)//' d0' + if ( prm%Qsd <= 0.0_pReal) extmsg = trim(extmsg)//' qsd' + + !if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & + ! call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') + ! if (plastic_disloUCLA_aTolRho(instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='aTolRho ('//PLASTICITY_DISLOUCLA_label//')') - !if (plastic_disloUCLA_rhoEdge0(f,instance) < 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdge0 ('//PLASTICITY_DISLOUCLA_label//')') - !if (plastic_disloUCLA_rhoEdgeDip0(f,instance) < 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='rhoEdgeDip0 ('//PLASTICITY_DISLOUCLA_label//')') - !if (plastic_disloUCLA_burgersPerSlipFamily(f,instance) <= 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='slipBurgers ('//PLASTICITY_DISLOUCLA_label//')') - !if (plastic_disloUCLA_v0PerSlipFamily(f,instance) <= 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='v0 ('//PLASTICITY_DISLOUCLA_label//')') - !if (plastic_disloUCLA_tau_peierlsPerSlipFamily(f,instance) < 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='tau_peierls ('//PLASTICITY_DISLOUCLA_label//')') - else slipActive allocate(prm%rho0(0)) From 60686fb72c3191defbce5523f6e5c710f37ca7e6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 18:05:37 +0100 Subject: [PATCH 082/147] [skip ci] improved reporting --- processing/post/addOrientations.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 27cc92b1f..141083036 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- -import os,sys,math +import os,sys import numpy as np from optparse import OptionParser import damask @@ -14,19 +14,19 @@ scriptID = ' '.join([scriptName,damask.version]) # -------------------------------------------------------------------- def check_Eulers(eulers): - if np.any(eulers < 0.0) or np.any(eulers > 2.0*math.pi) or eulers[1] > math.pi: # Euler angles within valid range? + if np.any(eulers < 0.0) or np.any(eulers > 2.0*np.pi) or eulers[1] > np.pi: # Euler angles within valid range? raise ValueError('Euler angles outside of [0..2π],[0..π],[0..2π].\n{} {} {}.'.format(*eulers)) return eulers def check_quaternion(q): if q[0] < 0.0: # positive first quaternion component? - raise ValueError('quaternion has negative first component.\n{}'.format(q)) - if not(np.isclose(np.linalg.norm(q), 1.0)): # unit quaternion? + raise ValueError('quaternion has negative first component.\n{}'.format(q[0])) + if not np.isclose(np.linalg.norm(q), 1.0): # unit quaternion? raise ValueError('quaternion is not of unit length.\n{} {} {} {}'.format(*q)) return q def check_matrix(M): - if abs(1.0-np.linalg.det(M)) > 1e-8: # proper rotation? + if not np.isclose(np.linalg.det(M),1.0): # proper rotation? raise ValueError('matrix is not a proper rotation.\n{}'.format(M)) if abs(np.dot(M[0],M[1])) > 1e-8 \ or abs(np.dot(M[1],M[2])) > 1e-8 \ @@ -129,7 +129,7 @@ if np.sum(input) != 1: parser.error('needs exactly one input format.') (options.quaternion,4,'quaternion'), ][np.where(input)[0][0]] # select input label that was requested -toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians +toRadians = np.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians r = damask.Quaternion.fromAngleAxis(toRadians*options.crystalrotation[0],options.crystalrotation[1:]) # crystal frame rotation R = damask.Quaternion.fromAngleAxis(toRadians*options. labrotation[0],options. labrotation[1:]) # lab frame rotation From d219842ad86b93392c06b3d2ee1cf674ae1e5fed Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 9 Dec 2018 20:19:17 +0100 Subject: [PATCH 083/147] [skip ci] consistent tolerances --- processing/post/addOrientations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 141083036..803d585e3 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -28,9 +28,9 @@ def check_quaternion(q): def check_matrix(M): if not np.isclose(np.linalg.det(M),1.0): # proper rotation? raise ValueError('matrix is not a proper rotation.\n{}'.format(M)) - if abs(np.dot(M[0],M[1])) > 1e-8 \ - or abs(np.dot(M[1],M[2])) > 1e-8 \ - or abs(np.dot(M[2],M[0])) > 1e-8: # all orthogonal? + if not np.isclose(np.dot(M[0],M[1]), 0.0) \ + or not np.isclose(np.dot(M[1],M[2]), 0.0) \ + or not np.isclose(np.dot(M[2],M[0]), 0.0): # all orthogonal? raise ValueError('matrix is not orthogonal.\n{}'.format(M)) return M From c038dc9f93cdfc69b8ceccb80c62e737e3a9b5ed Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 10 Dec 2018 06:53:20 +0100 Subject: [PATCH 084/147] [skip ci] updated version information after successful test of v2.0.2-1124-g0ff9e9fa --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 3ad5cdbde..8817d8cc0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1122-g2349341e +v2.0.2-1124-g0ff9e9fa From 767650e0023176ac6b47720a9d5c2645db3f098a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 10 Dec 2018 09:27:39 +0100 Subject: [PATCH 085/147] more general option + improved descriptions hopefully more user friendly --- PRIVATE | 2 +- processing/post/addGrainID.py | 6 ++--- processing/post/addIPFcolor.py | 13 ++++++----- processing/post/addOrientations.py | 34 ++++++++++++++++------------- processing/post/addPole.py | 14 +++++++----- processing/post/addSchmidfactors.py | 19 ++++++++++------ 6 files changed, 51 insertions(+), 37 deletions(-) diff --git a/PRIVATE b/PRIVATE index d15faafa8..e3dac27b7 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit d15faafa81e7133977dcc6a160ed73a58de69ccb +Subproject commit e3dac27b709d7fb3630bbd75271b220827221492 diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index 2c4cfe5d6..ed707f9ea 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -31,11 +31,11 @@ parser.add_option('-s', dest = 'symmetry', metavar = 'string', help = 'crystal symmetry [%default]') -parser.add_option('-q', - '--quaternion', +parser.add_option('-o', + '--orientation', dest = 'quaternion', metavar = 'string', - help = 'label of quaternion') + help = 'label of crystal orientation given as unit quaternion [%default]') parser.add_option('-p', '--pos', '--position', dest = 'pos', diff --git a/processing/post/addIPFcolor.py b/processing/post/addIPFcolor.py index 2916df703..c5a59a63a 100755 --- a/processing/post/addIPFcolor.py +++ b/processing/post/addIPFcolor.py @@ -18,18 +18,21 @@ Add RGB color value corresponding to TSL-OIM scheme for inverse pole figures. """, version = scriptID) -parser.add_option('-p', '--pole', +parser.add_option('-p', + '--pole', dest = 'pole', type = 'float', nargs = 3, metavar = 'float float float', help = 'lab frame direction for inverse pole figure [%default]') -parser.add_option('-s', '--symmetry', +parser.add_option('-s', + '--symmetry', dest = 'symmetry', type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string', help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:]))) -parser.add_option('-q', '--quaternion', +parser.add_option('-o', + '--orientation', dest = 'quaternion', - type = 'string', metavar = 'string', - help = 'quaternion label') + metavar = 'string', + help = 'label of crystal orientation given as unit quaternion [%default]') parser.set_defaults(pole = (0.0,0.0,1.0), quaternion = 'orientation', diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 803d585e3..a33f96b91 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -54,49 +54,53 @@ outputChoices = { 'angleaxis': ['aaxs',4], } -parser.add_option('-o', '--output', +parser.add_option('-o', + '--output', dest = 'output', action = 'extend', metavar = '', help = 'output orientation formats {{{}}}'.format(', '.join(outputChoices))) -parser.add_option('-d', '--degrees', +parser.add_option('-d', + '--degrees', dest = 'degrees', action = 'store_true', help = 'all angles in degrees') -parser.add_option('-R', '--labrotation', +parser.add_option('-R', + '--labrotation', dest='labrotation', type = 'float', nargs = 4, metavar = ' '.join(['float']*4), help = 'angle and axis of additional lab frame rotation') -parser.add_option('-r', '--crystalrotation', +parser.add_option('-r', + '--crystalrotation', dest='crystalrotation', type = 'float', nargs = 4, metavar = ' '.join(['float']*4), help = 'angle and axis of additional crystal frame rotation') -parser.add_option( '--eulers', +parser.add_option('--eulers', dest = 'eulers', - type = 'string', metavar = 'string', + metavar = 'string', help = 'Euler angles label') -parser.add_option( '--rodrigues', +parser.add_option('--rodrigues', dest = 'rodrigues', - type = 'string', metavar = 'string', + metavar = 'string', help = 'Rodrigues vector label') -parser.add_option( '--matrix', +parser.add_option('--matrix', dest = 'matrix', - type = 'string', metavar = 'string', + metavar = 'string', help = 'orientation matrix label') -parser.add_option( '--quaternion', +parser.add_option('--quaternion', dest = 'quaternion', - type = 'string', metavar = 'string', + metavar = 'string', help = 'quaternion label') parser.add_option('-x', dest = 'x', - type = 'string', metavar = 'string', + metavar = 'string', help = 'label of lab x vector (expressed in crystal coords)') parser.add_option('-y', dest = 'y', - type = 'string', metavar = 'string', + metavar = 'string', help = 'label of lab y vector (expressed in crystal coords)') parser.add_option('-z', dest = 'z', - type = 'string', metavar = 'string', + metavar = 'string', help = 'label of lab z vector (expressed in crystal coords)') parser.set_defaults(output = [], diff --git a/processing/post/addPole.py b/processing/post/addPole.py index f2e9b978d..3098effc7 100755 --- a/processing/post/addPole.py +++ b/processing/post/addPole.py @@ -14,22 +14,24 @@ scriptID = ' '.join([scriptName,damask.version]) # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add x,y coordinates of stereographic projection of given direction (pole) in crystal frame. +Add coordinates of stereographic projection of given direction (pole) in crystal frame. """, version = scriptID) -parser.add_option('-p', '--pole', +parser.add_option('-p', + '--pole', dest = 'pole', type = 'float', nargs = 3, metavar = 'float float float', help = 'crystal frame direction for pole figure [%default]') parser.add_option('--polar', dest = 'polar', action = 'store_true', - help = 'output polar coordinates r,phi [%default]') -parser.add_option('-q', '--quaternion', + help = 'output polar coordinates (r,φ) instead of Cartesian coordinates (x,y)') +parser.add_option('-o', + '--orientation', dest = 'quaternion', - type = 'string', metavar = 'string', - help = 'quaternion label') + metavar = 'string', + help = 'label of crystal orientation given as unit quaternion [%default]') parser.set_defaults(pole = (1.0,0.0,0.0), quaternion = 'orientation', diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index a64708e1e..6335b419e 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -109,26 +109,31 @@ Add columns listing Schmid factors (and optional trace vector of selected system """, version = scriptID) latticeChoices = ('fcc','bcc','hex') -parser.add_option('-l','--lattice', +parser.add_option('-l', + '--lattice', dest = 'lattice', type = 'choice', choices = latticeChoices, metavar='string', help = 'type of lattice structure [%default] {}'.format(latticeChoices)) parser.add_option('--covera', dest = 'CoverA', type = 'float', metavar = 'float', help = 'C over A ratio for hexagonal systems') -parser.add_option('-f', '--force', +parser.add_option('-f', + '--force', dest = 'force', type = 'float', nargs = 3, metavar = 'float float float', help = 'force direction in lab frame [%default]') -parser.add_option('-n', '--normal', +parser.add_option('-n', + '--normal', dest = 'normal', type = 'float', nargs = 3, metavar = 'float float float', - help = 'stress plane normal in lab frame [%default]') -parser.add_option('-q', '--quaternion', + help = 'stress plane normal in lab frame, per default perpendicular to the force') +parser.add_option('-o', + '--orientation', dest = 'quaternion', metavar = 'string', - help = 'quaternion label') + help = 'label of crystal orientation given as unit quaternion [%default]') parser.set_defaults(force = (0.0,0.0,1.0), + quaternion='orientation', normal = None, lattice = latticeChoices[0], CoverA = math.sqrt(8./3.), @@ -139,7 +144,7 @@ parser.set_defaults(force = (0.0,0.0,1.0), force = np.array(options.force) force /= np.linalg.norm(force) -if options.normal: +if options.normal is not None: normal = np.array(options.normal) normal /= np.linalg.norm(normal) if abs(np.dot(force,normal)) > 1e-3: From 1f2fbbee21ff50c6fcf746655fd2a8ce0a3b234f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 10 Dec 2018 09:38:57 +0100 Subject: [PATCH 086/147] consistent name --- lib/damask/util.py | 2 +- processing/post/addGrainID.py | 4 ++-- processing/post/postResults.py | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/damask/util.py b/lib/damask/util.py index a701a1288..e7d4a16bc 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -134,7 +134,7 @@ class extendableOption(Option): # Print iterations progress # from https://gist.github.com/aubricus/f91fb55dc6ba5557fbab06119420dd6a -def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100): +def progressBar(iteration, total, prefix='', suffix='', decimals=1, bar_length=100): """ Call in a loop to create terminal progress bar diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index ed707f9ea..3c4eaf4fa 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -117,7 +117,7 @@ for name in filenames: while table.data_read(): # read next data line of ASCII table if options.verbose and Npoints > 100 and p%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.print_progress(iteration=p,total=Npoints) + damask.util.progressBar(iteration=p,total=Npoints) o = damask.Orientation(quaternion = np.array(list(map(float,table.data[column:column+4]))), symmetry = options.symmetry).reduced() @@ -165,7 +165,7 @@ for name in filenames: outputAlive = True p = 0 - damask.util.print_progress(iteration=1,total=1) + damask.util.progressBar(iteration=1,total=1) while outputAlive and table.data_read(): # read next data line of ASCII table table.data_append(1+packingMap[grainID[p]]) # add (condensed) grain ID outputAlive = table.data_write() # output processed line diff --git a/processing/post/postResults.py b/processing/post/postResults.py index de78180c1..a5a2669d7 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -832,7 +832,7 @@ elementsOfNode = {} Nelems = stat['NumberOfElements'] for e in range(Nelems): if options.verbose and Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.print_progress(iteration=e,total=Nelems,prefix='1/3: connecting elements') + damask.util.progressBar(iteration=e,total=Nelems,prefix='1/3: connecting elements') for n in map(p.node_sequence,p.element(e).items): if n not in elementsOfNode: elementsOfNode[n] = [p.element_id(e)] @@ -851,13 +851,13 @@ index = {} groups = [] groupCount = 0 memberCount = 0 -damask.util.print_progress(iteration=1,total=1,prefix='1/3: connecting elements') +damask.util.progressBar(iteration=1,total=1,prefix='1/3: connecting elements') if options.nodalScalar: Npoints = stat['NumberOfNodes'] for n in range(Npoints): if options.verbose and Npoints > 100 and e%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.print_progress(iteration=n,total=Npoints,prefix='2/3: scanning nodes ') + damask.util.progressBar(iteration=n,total=Npoints,prefix='2/3: scanning nodes ') myNodeID = p.node_id(n) myNodeCoordinates = [p.node(n).x, p.node(n).y, p.node(n).z] myElemID = 0 @@ -888,13 +888,13 @@ if options.nodalScalar: myNodeCoordinates) # incrementally update average location groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member memberCount += 1 - damask.util.print_progress(iteration=1,total=1,prefix='2/3: scanning nodes ') + damask.util.progressBar(iteration=1,total=1,prefix='2/3: scanning nodes ') else: Nelems = stat['NumberOfElements'] for e in range(Nelems): if options.verbose and Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.print_progress(iteration=e,total=Nelems,prefix='2/3: scanning elements ') + damask.util.progressBar(iteration=e,total=Nelems,prefix='2/3: scanning elements ') myElemID = p.element_id(e) myIpCoordinates = ipCoords(p.element(e).type, list(map(lambda node: [node.x, node.y, node.z], list(map(p.node, map(p.node_sequence, p.element(e).items)))))) @@ -934,7 +934,7 @@ else: myIpCoordinates[n]) # incrementally update average location groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,n]) # append a new list defining each group member memberCount += 1 - damask.util.print_progress(iteration=1,total=1,prefix='2/3: scanning elements ') + damask.util.progressBar(iteration=1,total=1,prefix='2/3: scanning elements ') # --------------------------- sort groups -------------------------------- @@ -1035,7 +1035,7 @@ for incCount,position in enumerate(locations): # walk through locations for j,group in enumerate(groups): f = incCount*Ngroups + j if options.verbose and (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.print_progress(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ') + damask.util.progressBar(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ') N = 0 # group member counter for (e,n,i,g,n_local) in group[1:]: # loop over group members member += 1 @@ -1126,7 +1126,7 @@ for incCount,position in enumerate(locations): # walk through locations group[0] + \ mappedResult) )) + '\n') -damask.util.print_progress(iteration=1,total=1,prefix='3/3: processing points ') +damask.util.progressBar(iteration=1,total=1,prefix='3/3: processing points ') if fileOpen: file.close() From 2aa6b12126b62c9c2d9e282f971877e2f71f36d1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 12 Dec 2018 16:13:57 +0100 Subject: [PATCH 087/147] IMPORTANT Behavior change: Slip (Lp) happens in twinned volume fraction aliases for associate do not have to be defined --- src/plastic_phenopowerlaw.f90 | 52 ++++++++++++++--------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 5fd8d8e3c..136fe07e6 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -148,12 +148,6 @@ subroutine plastic_phenopowerlaw_init real(pReal), dimension(0), parameter :: emptyRealArray = [real(pReal)::] character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::] - type(tParameters) :: & - prm - type(tPhenopowerlawState) :: & - stt, & - dot - integer(kind(undefined_ID)) :: & outputID !< ID of each post result output @@ -161,7 +155,7 @@ subroutine plastic_phenopowerlaw_init structure = '',& extmsg = '' character(len=65536), dimension(:), allocatable :: & - outputs + outputs write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() @@ -398,6 +392,8 @@ end subroutine plastic_phenopowerlaw_init !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent +!> @details asumme that deformation by dislocation glide affects twinned and untwinned volume +! equally (Taylor assumption). Twinning happens only in untwinned volume ( !-------------------------------------------------------------------------------------------------- subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) @@ -420,19 +416,15 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) gdot_slip_pos,gdot_slip_neg real(pReal), dimension(param(instance)%totalNtwin) :: & gdot_twin,dgdot_dtautwin - - type(tParameters) :: prm - type(tPhenopowerlawState) :: stt - - associate(prm => param(instance), stt => state(instance)) - + Lp = 0.0_pReal dLp_dMp = 0.0_pReal - + + associate(prm => param(instance), stt => state(instance)) + call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) slipSystems: do i = 1_pInt, prm%totalNslip - Lp = Lp + (1.0_pReal- sum(stt%gamma_twin(:,of)/prm%gamma_twin_char)) & ! only shear in untwinned volume - * (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) + Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & + dgdot_dtauslip_pos(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_pos(m,n,i) & @@ -446,9 +438,9 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) dLp_dMp(k,l,m,n) = dLp_dMp(k,l,m,n) & + dgdot_dtautwin(i)*prm%Schmid_twin(k,l,i)*prm%Schmid_twin(m,n,i) enddo twinSystems + end associate - end subroutine plastic_phenopowerlaw_LpAndItsTangent @@ -474,9 +466,6 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) left_SlipSlip,right_SlipSlip, & gdot_slip_pos,gdot_slip_neg - type(tParameters) :: prm - type(tPhenopowerlawState) :: dot,stt - associate(prm => param(instance), stt => state(instance), dot => dotState(instance)) dot%whole(:,of) = 0.0_pReal @@ -506,7 +495,7 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) ! hardening hardeningSlip: do i = 1_pInt, prm%totalNslip dot%xi_slip(i,of) = dot_product(prm%interaction_SlipSlip(i,:),right_SlipSlip*dot%gamma_slip(:,of)) & - * c_SlipSlip * left_SlipSlip(i) & + * c_SlipSlip * left_SlipSlip(i) & + dot_product(prm%interaction_SlipTwin(i,:),dot%gamma_twin(:,of)) enddo hardeningSlip @@ -522,8 +511,9 @@ end subroutine plastic_phenopowerlaw_dotState !-------------------------------------------------------------------------------------------------- !> @brief calculates shear rates on slip systems and derivatives with respect to resolved stress -!> @details: Shear rates 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 +!> @details Shear rates 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_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg, & dgdot_dtau_slip_pos,dgdot_dtau_slip_neg) @@ -595,9 +585,11 @@ end subroutine kinetics_slip !-------------------------------------------------------------------------------------------------- -!> @brief calculates shear rates on twin systems and derivatives with respect to resolved stress -!> @details: Derivates 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 +!> @brief calculates shear rates on twin systems and derivatives with respect to resolved stress. +! twinning is assumed to take place only in untwinned volume. +!> @details Derivates 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(prm,stt,of,Mp,gdot_twin,dgdot_dtau_twin) use prec, only: & @@ -667,13 +659,10 @@ function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) real(pReal), dimension(param(instance)%totalNslip) :: & gdot_slip_pos,gdot_slip_neg - type(tParameters) :: prm - type(tPhenopowerlawState) :: stt - - associate( prm => param(instance), stt => state(instance)) - postResults = 0.0_pReal c = 0_pInt + + associate( prm => param(instance), stt => state(instance)) outputsLoop: do o = 1_pInt,size(prm%outputID) select case(prm%outputID(o)) @@ -711,6 +700,7 @@ function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) end select enddo outputsLoop + end associate end function plastic_phenopowerlaw_postResults From 15f1badb60b915f8eeea60085608a88c4d809b75 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 13 Dec 2018 17:27:45 +0100 Subject: [PATCH 088/147] test with reference solution for modified phenopowerlaw --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 2e0ab3e25..58137906b 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 2e0ab3e2564fea6ac3779623065b47dfc3261ef5 +Subproject commit 58137906b84b6cf0e273dfdde623a2986d03f98e From 4dd064a2753868b2a8bec0d9522ec892a9a9992e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 14 Dec 2018 09:23:52 +0100 Subject: [PATCH 089/147] polishing --- DAMASK_prerequisites.sh | 2 +- src/plastic_phenopowerlaw.f90 | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DAMASK_prerequisites.sh b/DAMASK_prerequisites.sh index f0a525c34..5e96f4aee 100755 --- a/DAMASK_prerequisites.sh +++ b/DAMASK_prerequisites.sh @@ -79,7 +79,7 @@ ls $PETSC_DIR/lib firstLevel "Python" DEFAULT_PYTHON=python3 -for executable in python python2 python3 python2.7; do +for executable in python python3; do getDetails $executable '--version' done secondLevel "Details on $DEFAULT_PYTHON:" diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 136fe07e6..053fe958b 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -53,7 +53,7 @@ module plastic_phenopowerlaw xi_twin_0, & !< initial critical shear stress for twin xi_slip_sat, & !< maximum critical shear stress for slip nonSchmidCoeff, & - H_int, & !< per family hardening activity (optional) !ToDo: Better name! + H_int, & !< per family hardening activity (optional) gamma_twin_char !< characteristic shear for twins real(pReal), allocatable, dimension(:,:) :: & interaction_SlipSlip, & !< slip resistance from slip activity @@ -234,8 +234,8 @@ subroutine plastic_phenopowerlaw_init ! sanity checks if (prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_slip ' - if (dEq0(prm%a_slip)) extmsg = trim(extmsg)//'a_slip ' ! ToDo: negative values ok? - if (dEq0(prm%n_slip)) extmsg = trim(extmsg)//'n_slip ' ! ToDo: negative values ok? + if (dEq0(prm%a_slip)) extmsg = trim(extmsg)//'a_slip ' ! ToDo: negative values ok? + if (dEq0(prm%n_slip)) extmsg = trim(extmsg)//'n_slip ' ! ToDo: negative values ok? if (any(prm%xi_slip_0 <= 0.0_pReal)) extmsg = trim(extmsg)//'xi_slip_0 ' if (any(prm%xi_slip_sat < prm%xi_slip_0)) extmsg = trim(extmsg)//'xi_slip_sat ' else slipActive @@ -268,7 +268,7 @@ subroutine plastic_phenopowerlaw_init ! sanity checks if (prm%gdot0_twin <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_twin ' - if (dEq0(prm%n_twin)) extmsg = trim(extmsg)//'n_twin ' ! ToDo: negative values ok? + if (dEq0(prm%n_twin)) extmsg = trim(extmsg)//'n_twin ' ! ToDo: negative values ok? else twinActive allocate(prm%interaction_TwinTwin(0,0)) allocate(prm%xi_twin_0(0)) @@ -285,8 +285,8 @@ subroutine plastic_phenopowerlaw_init config_phase(p)%getFloats('interaction_twinslip'), & structure(1:3)) else slipAndTwinActive - allocate(prm%interaction_SlipTwin(prm%totalNslip,prm%TotalNtwin)) ! at least one dimension is 0 - allocate(prm%interaction_TwinSlip(prm%totalNtwin,prm%TotalNslip)) ! at least one dimension is 0 + allocate(prm%interaction_SlipTwin(prm%totalNslip,prm%TotalNtwin)) ! at least one dimension is 0 + allocate(prm%interaction_TwinSlip(prm%totalNtwin,prm%TotalNslip)) ! at least one dimension is 0 prm%h0_TwinSlip = 0.0_pReal endif slipAndTwinActive From afe34feff55e1d0b984ba178045e894e4f6e82fb Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 15 Dec 2018 00:55:09 +0100 Subject: [PATCH 090/147] [skip ci] updated version information after successful test of v2.0.2-1137-g4dd064a2 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8817d8cc0..99b9812a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1124-g0ff9e9fa +v2.0.2-1137-g4dd064a2 From e82d3557d1d13327612944ab24ab79d5a1ae65e6 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 17 Dec 2018 09:55:02 -0500 Subject: [PATCH 091/147] removed Rodrigues class; removed quaternion "inverse" method; adopted Rowenhorst algorithm for angle--axis; use math.isclose(...,0.0) to check for ==0.0 --- lib/damask/__init__.py | 2 +- lib/damask/orientation.py | 81 +++++++++++---------------------------- 2 files changed, 24 insertions(+), 59 deletions(-) diff --git a/lib/damask/__init__.py b/lib/damask/__init__.py index 9809ce5b2..c8981069d 100644 --- a/lib/damask/__init__.py +++ b/lib/damask/__init__.py @@ -13,7 +13,7 @@ from .asciitable import ASCIItable # noqa from .config import Material # noqa from .colormaps import Colormap, Color # noqa -from .orientation import Quaternion, Rodrigues, Symmetry, Orientation # noqa +from .orientation import Quaternion, Symmetry, Orientation # noqa #from .block import Block # only one class from .result import Result # noqa diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index db2baad92..fbf4dd8a8 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -7,24 +7,6 @@ import math,os import numpy as np -# ****************************************************************************************** -class Rodrigues: - - def __init__(self, vector = np.zeros(3)): - self.vector = vector - - def asQuaternion(self): - norm = np.linalg.norm(self.vector) - halfAngle = np.arctan(norm) - return Quaternion(np.cos(halfAngle),np.sin(halfAngle)*self.vector/norm) - - def asAngleAxis(self): - norm = np.linalg.norm(self.vector) - halfAngle = np.arctan(norm) - return (2.0*halfAngle,self.vector/norm) - - - # ****************************************************************************************** class Quaternion: u""" @@ -178,12 +160,13 @@ class Quaternion: magnitude = __abs__ def __eq__(self,other): - """Equal at e-8 precision""" - return (self-other).magnitude() < 1e-8 or (-self-other).magnitude() < 1e-8 + """Equal (sufficiently close) to each other""" + return math.isclose(( self-other).magnitude(),0.0) \ + or math.isclose((-self-other).magnitude(),0.0) def __ne__(self,other): - """Not equal at e-8 precision""" - return not self.__eq__(self,other) + """Not equal (sufficiently close) to each other""" + return not self.__eq__(other) def __cmp__(self,other): """Linear ordering""" @@ -193,11 +176,6 @@ class Quaternion: def magnitude_squared(self): return self.q ** 2 + np.dot(self.p,self.p) - def identity(self): - self.q = 1. - self.p = np.zeros(3,dtype=float) - return self - def normalize(self): d = self.magnitude() if d > 0.0: @@ -209,13 +187,6 @@ class Quaternion: self.p = -self.p return self - def inverse(self): - d = self.magnitude() - if d > 0.0: - self.conjugate() - self /= d - return self - def homomorph(self): if self.q < 0.0: self.q = -self.q @@ -228,9 +199,6 @@ class Quaternion: def conjugated(self): return self.copy().conjugate() - def inversed(self): - return self.copy().inverse() - def homomorphed(self): return self.copy().homomorph() @@ -259,27 +227,24 @@ class Quaternion: def asAngleAxis(self, degrees = False, flat = False): - if self.q > 1.: - self.normalize() - s = math.sqrt(1. - self.q**2) - x = 2.*self.q**2 - 1. - y = 2.*self.q * s + angle = 2.0*math.acos(self.q) - angle = math.atan2(y,x) - if angle < 0.0: - angle *= -1. - s *= -1. - - if flat: - return np.hstack((np.degrees(angle) if degrees else angle, - np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s))) + if math.isclose(angle,0.0): + angle = 0.0 + axis = np.array([0.0,0.0,1.0]) + elif math.isclose(self.q,0.0): + angle = math.pi + axis = self.p else: - return (np.degrees(angle) if degrees else angle, - np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-6 else self.p / s)) + axis = np.sign(self.q)*self.p/np.linalg.norm(self.p) + + angle = np.degrees(angle) if degrees else angle + + return np.hstack((angle,axis)) if flat else (angle,axis) def asRodrigues(self): - return np.inf*np.ones(3) if self.q == 0.0 else self.p/self.q + return np.inf*np.ones(3) if math.isclose(self.q,0.0) else self.p/self.q def asEulers(self, degrees = False): @@ -290,9 +255,9 @@ class Quaternion: q12 = self.p[0]**2 + self.p[1]**2 chi = np.sqrt(q03*q12) - if abs(chi) < 1e-10 and abs(q12) < 1e-10: + if math.isclose(chi,0.0) and math.isclose(q12,0.0): eulers = np.array([math.atan2(-2*P*self.q*self.p[2],self.q**2-self.p[2]**2),0,0]) - elif abs(chi) < 1e-10 and abs(q03) < 1e-10: + elif math.isclose(chi,0.0) and math.isclose(q03,0.0): eulers = np.array([math.atan2( 2 *self.p[0]*self.p[1],self.p[0]**2-self.p[1]**2),np.pi,0]) else: eulers = np.array([math.atan2((self.p[0]*self.p[2]-P*self.q*self.p[1])/chi,(-P*self.q*self.p[0]-self.p[1]*self.p[2])/chi), @@ -456,11 +421,11 @@ class Symmetry: def __eq__(self, other): - """Equal""" + """Equal to other""" return self.lattice == other.lattice def __neq__(self, other): - """Not equal""" + """Not equal to other""" return not self.__eq__(other) def __cmp__(self,other): @@ -549,7 +514,7 @@ class Symmetry: def inFZ(self,R): """Check whether given Rodrigues vector falls into fundamental zone of own symmetry.""" - if isinstance(R, Quaternion): R = R.asRodrigues() # translate accidentially passed quaternion + if isinstance(R, Quaternion): R = R.asRodrigues() # translate accidentally passed quaternion # fundamental zone in Rodrigues space is point symmetric around origin R = abs(R) if self.lattice == 'cubic': From 5d7f9305920c1e76b59986ceb7eab8c23a1c9d8a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 17 Dec 2018 20:04:16 +0100 Subject: [PATCH 092/147] math.isclose does not exist for older versions np.isclose does the same --- lib/damask/orientation.py | 14 +++++++------- processing/pre/geom_rotate.py | 2 -- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index fbf4dd8a8..946c97d1e 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -161,8 +161,8 @@ class Quaternion: def __eq__(self,other): """Equal (sufficiently close) to each other""" - return math.isclose(( self-other).magnitude(),0.0) \ - or math.isclose((-self-other).magnitude(),0.0) + return np.isclose(( self-other).magnitude(),0.0) \ + or np.isclose((-self-other).magnitude(),0.0) def __ne__(self,other): """Not equal (sufficiently close) to each other""" @@ -230,10 +230,10 @@ class Quaternion: angle = 2.0*math.acos(self.q) - if math.isclose(angle,0.0): + if np.isclose(angle,0.0): angle = 0.0 axis = np.array([0.0,0.0,1.0]) - elif math.isclose(self.q,0.0): + elif np.isclose(self.q,0.0): angle = math.pi axis = self.p else: @@ -244,7 +244,7 @@ class Quaternion: return np.hstack((angle,axis)) if flat else (angle,axis) def asRodrigues(self): - return np.inf*np.ones(3) if math.isclose(self.q,0.0) else self.p/self.q + return np.inf*np.ones(3) if np.isclose(self.q,0.0) else self.p/self.q def asEulers(self, degrees = False): @@ -255,9 +255,9 @@ class Quaternion: q12 = self.p[0]**2 + self.p[1]**2 chi = np.sqrt(q03*q12) - if math.isclose(chi,0.0) and math.isclose(q12,0.0): + if np.isclose(chi,0.0) and np.isclose(q12,0.0): eulers = np.array([math.atan2(-2*P*self.q*self.p[2],self.q**2-self.p[2]**2),0,0]) - elif math.isclose(chi,0.0) and math.isclose(q03,0.0): + elif np.isclose(chi,0.0) and np.isclose(q03,0.0): eulers = np.array([math.atan2( 2 *self.p[0]*self.p[1],self.p[0]**2-self.p[1]**2),np.pi,0]) else: eulers = np.array([math.atan2((self.p[0]*self.p[2]-P*self.q*self.p[1])/chi,(-P*self.q*self.p[0]-self.p[1]*self.p[2])/chi), diff --git a/processing/pre/geom_rotate.py b/processing/pre/geom_rotate.py index 939f2b943..eb70f7137 100755 --- a/processing/pre/geom_rotate.py +++ b/processing/pre/geom_rotate.py @@ -60,8 +60,6 @@ eulers = np.array(damask.orientation.Orientation( degrees = options.degrees, ).asEulers(degrees=True)) -damask.util.croak('{} {} {}'.format(*eulers)) - # --- loop over input files ------------------------------------------------------------------------- if filenames == []: filenames = [None] From d794e152491fcfb63de2b768360f310272410070 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 17 Dec 2018 16:07:51 -0500 Subject: [PATCH 093/147] [skip ci] small polish --- lib/damask/orientation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 946c97d1e..63880a3e6 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -416,7 +416,7 @@ class Symmetry: def __repr__(self): - """Readbable string""" + """Readable string""" return '{}'.format(self.lattice) @@ -502,7 +502,7 @@ class Symmetry: ] return list(map(Quaternion, - np.array(symQuats)[np.atleast_1d(np.array(who)) if who != [] else range(len(symQuats))])) + np.array(symQuats)[np.atleast_1d(np.array(who)) if who != [] else range(len(symQuats))])) def equivalentQuaternions(self, From f34111cf31992d2507333526de9b88d4ef4ec7f2 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 18 Dec 2018 09:11:44 -0500 Subject: [PATCH 094/147] [skip ci] env/DAMASK.xxx now reports current repository branch of DAMASK_ROOT --- env/DAMASK.csh | 7 ++++++- env/DAMASK.sh | 7 +++++-- env/DAMASK.zsh | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/env/DAMASK.csh b/env/DAMASK.csh index 2e1dc979c..6b6c58d9d 100644 --- a/env/DAMASK.csh +++ b/env/DAMASK.csh @@ -7,6 +7,11 @@ set DAMASK_ROOT=`python -c "import os,sys; print(os.path.realpath(os.path.expand source $DAMASK_ROOT/CONFIG +# add BRANCH if DAMASK_ROOT is a git repository +cd $DAMASK_ROOT >/dev/null +set BRANCH = `git branch 2>/dev/null| grep -E '^\* ')` +cd - >/dev/null + # if DAMASK_BIN is present if ( $?DAMASK_BIN) then set path = ($DAMASK_BIN $path) @@ -41,7 +46,7 @@ if ( $?prompt ) then echo https://damask.mpie.de echo echo Using environment with ... - echo "DAMASK $DAMASK_ROOT" + echo "DAMASK $DAMASK_ROOT $BRANCH" echo "Spectral Solver $SOLVER" echo "Post Processing $PROCESSING" if ( $?PETSC_DIR) then diff --git a/env/DAMASK.sh b/env/DAMASK.sh index e790ae3cc..bd26a3ebb 100644 --- a/env/DAMASK.sh +++ b/env/DAMASK.sh @@ -30,6 +30,9 @@ set() { source $DAMASK_ROOT/CONFIG unset -f set +# add BRANCH if DAMASK_ROOT is a git repository +cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null + # add DAMASK_BIN if present [ "x$DAMASK_BIN" != "x" ] && PATH=$DAMASK_BIN:$PATH @@ -59,7 +62,7 @@ if [ ! -z "$PS1" ]; then echo https://damask.mpie.de echo echo Using environment with ... - echo "DAMASK $DAMASK_ROOT" + echo "DAMASK $DAMASK_ROOT $BRANCH" echo "Spectral Solver $SOLVER" echo "Post Processing $PROCESSING" if [ "x$PETSC_DIR" != "x" ]; then @@ -94,7 +97,7 @@ fi export DAMASK_NUM_THREADS export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH -for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN; do +for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN BRANCH; do unset "${var}" done for var in DAMASK MSC; do diff --git a/env/DAMASK.zsh b/env/DAMASK.zsh index dbfde767d..ae34fdfd2 100644 --- a/env/DAMASK.zsh +++ b/env/DAMASK.zsh @@ -21,6 +21,9 @@ set() { source $DAMASK_ROOT/CONFIG unset -f set +# add BRANCH if DAMASK_ROOT is a git repository +cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null + # add DAMASK_BIN if present [ "x$DAMASK_BIN != x" ] && PATH=$DAMASK_BIN:$PATH @@ -50,7 +53,7 @@ if [ ! -z "$PS1" ]; then echo https://damask.mpie.de echo echo "Using environment with ..." - echo "DAMASK $DAMASK_ROOT" + echo "DAMASK $DAMASK_ROOT $BRANCH" echo "Spectral Solver $SOLVER" echo "Post Processing $PROCESSING" if [ "x$PETSC_DIR" != "x" ]; then @@ -87,7 +90,7 @@ fi export DAMASK_NUM_THREADS export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH -for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN; do +for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN BRANCH; do unset "${var}" done for var in DAMASK MSC; do From 576c4492d49c1456188ca7c2cf290bf821d20b0d Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 18 Dec 2018 09:24:25 -0500 Subject: [PATCH 095/147] [skip ci] bugfix for DAMASK_BIN==empty check; [ logical ] --> [[ logical ]] to align with bash syntax --- env/DAMASK.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/env/DAMASK.zsh b/env/DAMASK.zsh index ae34fdfd2..4d5a1e47d 100644 --- a/env/DAMASK.zsh +++ b/env/DAMASK.zsh @@ -25,15 +25,15 @@ unset -f set cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null # add DAMASK_BIN if present -[ "x$DAMASK_BIN != x" ] && PATH=$DAMASK_BIN:$PATH +[[ "x$DAMASK_BIN" != "x" ]] && PATH=$DAMASK_BIN:$PATH SOLVER=$(which DAMASK_spectral || true 2>/dev/null) -[ "x$SOLVER" = "x" ] && SOLVER=$(blink 'Not found!') +[[ "x$SOLVER" == "x" ]] && SOLVER=$(blink 'Not found!') PROCESSING=$(which postResults || true 2>/dev/null) -[ "x$PROCESSING" = "x" ] && PROCESSING=$(blink 'Not found!') +[[ "x$PROCESSING" == "x" ]] && PROCESSING=$(blink 'Not found!') -[ "x$DAMASK_NUM_THREADS" = "x" ] && DAMASK_NUM_THREADS=1 +[[ "x$DAMASK_NUM_THREADS" == "x" ]] && DAMASK_NUM_THREADS=1 # currently, there is no information that unlimited causes problems # still, http://software.intel.com/en-us/forums/topic/501500 suggest to fix it @@ -56,13 +56,13 @@ if [ ! -z "$PS1" ]; then echo "DAMASK $DAMASK_ROOT $BRANCH" echo "Spectral Solver $SOLVER" echo "Post Processing $PROCESSING" - if [ "x$PETSC_DIR" != "x" ]; then + if [ "x$PETSC_DIR" != "x" ]; then echo -n "PETSc location " [ -d $PETSC_DIR ] && echo $PETSC_DIR || blink $PETSC_DIR [[ $(canonicalPath "$PETSC_DIR") == $PETSC_DIR ]] \ || echo " ~~> "$(canonicalPath "$PETSC_DIR") fi - [[ "x$PETSC_ARCH" == "x" ]] \ + [[ "x$PETSC_ARCH" == "x" ]] \ || echo "PETSc architecture $PETSC_ARCH" echo -n "MSC.Marc/Mentat " [ -d $MSC_ROOT ] && echo $MSC_ROOT || blink $MSC_ROOT From 7df6dfbf3fdb07bc55e3fc7518d7068a14d22852 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 18 Dec 2018 15:10:26 -0500 Subject: [PATCH 096/147] renamed "showTable" to "viewTable" to avoid clashing with astropy.table module --- processing/post/{showTable.py => viewTable.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename processing/post/{showTable.py => viewTable.py} (100%) diff --git a/processing/post/showTable.py b/processing/post/viewTable.py similarity index 100% rename from processing/post/showTable.py rename to processing/post/viewTable.py From 6a0a0c37542e82f6f745a3ae553427e2b2d5256c Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 19 Dec 2018 04:20:41 +0100 Subject: [PATCH 097/147] [skip ci] updated version information after successful test of v2.0.2-1187-gcd8ee450 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 99b9812a2..4fd318a98 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1137-g4dd064a2 +v2.0.2-1187-gcd8ee450 From 10266bad5c1eef069dd75859568eef91b088f931 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 19 Dec 2018 16:57:40 +0100 Subject: [PATCH 098/147] using updated branch in PRIVATE due to changes in the behavior, testing needs a separate branch which is also called orientationClass_with_negative_P --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 58137906b..b9a52a85c 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 58137906b84b6cf0e273dfdde623a2986d03f98e +Subproject commit b9a52a85cd65cc27a8e863302bd984abdcad1455 From 6fe17e05f6fb9b8e8e6644ff8670dc079c22ebe4 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 20 Dec 2018 07:37:39 +0100 Subject: [PATCH 099/147] [skip ci] updated version information after successful test of v2.0.2-1190-g7df6dfbf --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 99b9812a2..23cc93ef2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1137-g4dd064a2 +v2.0.2-1190-g7df6dfbf From 25a80723c0c5b477779bb82beec4d47311b1c175 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 20 Dec 2018 17:09:53 -0500 Subject: [PATCH 100/147] numpy interface changed to be strict about 2D array shape in histogram --- processing/post/binXY.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/post/binXY.py b/processing/post/binXY.py index 726fca39f..ea73d13b9 100755 --- a/processing/post/binXY.py +++ b/processing/post/binXY.py @@ -120,7 +120,7 @@ for name in filenames: delta = minmax[:,1]-minmax[:,0] (grid,xedges,yedges) = np.histogram2d(table.data[:,0],table.data[:,1], bins=options.bins, - range=minmax[0:2,0:2], + range=minmax[:2], weights=None if options.weight is None else table.data[:,2]) if options.normCol: From a1ff380ef4b6cecdf89e17950a0fec624a022627 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 20 Dec 2018 17:10:43 -0500 Subject: [PATCH 101/147] slightly better aligned debug output --- src/config.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.f90 b/src/config.f90 index 7ae800f30..441dd953c 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -142,7 +142,7 @@ subroutine config_init() case (trim(material_partPhase)) call parseFile(phase_name,config_phase,line,fileContent(i+1:)) - if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Phase parsed'; flush(6) + if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Phase parsed'; flush(6) case (trim(material_partMicrostructure)) call parseFile(microstructure_name,config_microstructure,line,fileContent(i+1:)) @@ -150,7 +150,7 @@ subroutine config_init() case (trim(material_partCrystallite)) call parseFile(crystallite_name,config_crystallite,line,fileContent(i+1:)) - if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Crystallite parsed'; flush(6) + if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Crystallite parsed'; flush(6) case (trim(material_partHomogenization)) call parseFile(homogenization_name,config_homogenization,line,fileContent(i+1:)) @@ -158,7 +158,7 @@ subroutine config_init() case (trim(material_partTexture)) call parseFile(texture_name,config_texture,line,fileContent(i+1:)) - if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Texture parsed'; flush(6) + if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Texture parsed'; flush(6) end select From 9bdd4d1d684fc026832127a794aab5547da799a1 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 20 Dec 2018 17:12:05 -0500 Subject: [PATCH 102/147] added line to stop config parser from trying to interpret rest of geom description---huge speedup!! --- processing/pre/geom_fromVoronoiTessellation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index 359acb366..5610c939a 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -323,12 +323,13 @@ for name in filenames: ] if hasEulers: config_header += [''] + theAxes = [] if options.axes is None else ['axes\t{} {} {}'.format(*options.axes)] for ID in grainIDs: eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)), '(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}\tscatter 0.0\tfraction 1.0'.format(*eulers[eulerID]) - ] - if options.axes is not None: config_header.append('axes\t{} {} {}'.format(*options.axes)) + ] + theAxes + config_header += [''] table.labels_clear() table.info_clear() From fe1183e010f781c910ca6565ea3bdeaed56859b7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 06:15:01 +0100 Subject: [PATCH 103/147] polishing --- src/plastic_disloUCLA.f90 | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 9006b092d..b3d5321bc 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -39,30 +39,30 @@ module plastic_disloUCLA real(pReal) :: & aTolRho, & grainSize, & - SolidSolutionStrength, & !< Strength due to elements in solid solution + SolidSolutionStrength, & !< Strength due to elements in solid solution mu, & - D0, & !< prefactor for self-diffusion coefficient - Qsd !< activation energy for dislocation climb + D0, & !< prefactor for self-diffusion coefficient + Qsd !< activation energy for dislocation climb real(pReal), allocatable, dimension(:) :: & - rho0, & !< initial edge dislocation density per slip system for each family and instance - rhoDip0, & !< initial edge dipole density per slip system for each family and instance - burgers, & !< absolute length of burgers vector [m] for each slip system and instance + rho0, & !< initial edge dislocation density per slip system for each family and instance + rhoDip0, & !< initial edge dipole density per slip system for each family and instance + burgers, & !< absolute length of burgers vector [m] for each slip system and instance nonSchmidCoeff, & minDipDistance, & - CLambda, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance + CLambda, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance atomicVolume, & !* mobility law parameters - H0kp, & !< activation energy for glide [J] for each slip system and instance - v0, & !< dislocation velocity prefactor [m/s] for each family and instance - p, & !< p-exponent in glide velocity - q, & !< q-exponent in glide velocity - B, & !< friction coeff. B (kMC) - kink_height, & !< height of the kink pair - kink_width, & !< width of the kink pair - omega, & !< attempt frequency for kink pair nucleation + H0kp, & !< activation energy for glide [J] for each slip system and instance + v0, & !< dislocation velocity prefactor [m/s] for each family and instance + p, & !< p-exponent in glide velocity + q, & !< q-exponent in glide velocity + B, & !< friction coefficient + kink_height, & !< height of the kink pair + kink_width, & !< width of the kink pair + omega, & !< attempt frequency for kink pair nucleation tau_Peierls real(pReal), allocatable, dimension(:,:) :: & - interaction_SlipSlip, & !< slip resistance from slip activity + interaction_SlipSlip, & !< slip resistance from slip activity forestProjectionEdge real(pReal), allocatable, dimension(:,:,:) :: & Schmid_slip, & @@ -152,13 +152,14 @@ subroutine plastic_disloUCLA_init() use lattice implicit none - integer(pInt) :: Ninstance,& - f,j,k,o, i, & - outputSize, & - offset_slip, index_myFamily, index_otherFamily, & - startIndex, endIndex, p, & - sizeState, sizeDotState, & - NipcMyPhase + integer(pInt) :: & + Ninstance, & + f,j,k,o, i, & + outputSize, & + offset_slip, index_myFamily, index_otherFamily, & + startIndex, endIndex, p, & + sizeState, sizeDotState, & + NipcMyPhase character(len=pStringLen) :: & structure = '',& extmsg = '' @@ -403,25 +404,24 @@ end subroutine plastic_disloUCLA_init subroutine plastic_disloUCLA_dependentState(instance,of) implicit none - integer(pInt), intent(in) :: instance, of + integer(pInt), intent(in) :: instance, of integer(pInt) :: & i real(pReal), dimension(param(instance)%totalNslip) :: & - invLambdaSlip ! 1/mean free distance between 2 forest dislocations seen by a moving dislocation + dislocationSpacing ! 1/mean free distance between 2 forest dislocations seen by a moving dislocation associate(prm => param(instance), stt => state(instance),dst => dependentState(instance)) forall (i = 1_pInt:prm%totalNslip) - invLambdaSlip(i) = sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & - prm%forestProjectionEdge(:,i))) & - / prm%Clambda(i) + dislocationSpacing(i) = sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & + prm%forestProjectionEdge(:,i))) dst%threshold_stress(i,of) = prm%mu*prm%burgers(i) & * sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & prm%interaction_SlipSlip(i,:))) end forall - dst%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*invLambdaSlip) + dst%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*dislocationSpacing/prm%Clambda) end associate From c1b77693274ef7e532c59bc20db40d44b813595a Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 21 Dec 2018 07:22:54 +0100 Subject: [PATCH 104/147] [skip ci] updated version information after successful test of v2.0.2-1236-g1ef82e35 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4fd318a98..2ad825361 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1187-gcd8ee450 +v2.0.2-1236-g1ef82e35 From ded65d250a3cb25e096b02d1de803e05c141e1e2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 07:27:03 +0100 Subject: [PATCH 105/147] re-enabled tests that were deactivated after orientation changes doxygen documentation only needed for development --- .gitlab-ci.yml | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 99daef5e5..2464ae7d7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -158,12 +158,12 @@ Post_AverageDown: - master - release -#Post_General: -# stage: postprocessing -# script: PostProcessing/test.py -# except: -# - master -# - release +Post_General: + stage: postprocessing + script: PostProcessing/test.py + except: + - master + - release Post_GeometryReconstruction: stage: postprocessing @@ -364,12 +364,12 @@ Phenopowerlaw_singleSlip: - master - release -#TextureComponents: -# stage: spectral -# script: TextureComponents/test.py -# except: -# - master -# - release +TextureComponents: + stage: spectral + script: TextureComponents/test.py + except: + - master + - release ################################################################################################### @@ -468,27 +468,24 @@ AbaqusStd: script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen - $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT abaqus - except: - - master - - release + only: + - development Marc: stage: createDocumentation script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen - $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT marc - except: - - master - - release + only: + - development Spectral: stage: createDocumentation script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel $Doxygen - $DAMASKROOT/PRIVATE/documenting/runDoxygen.sh $DAMASKROOT spectral - except: - - master - - release + only: + - development ################################################################################################## backupData: From 2dc7b4cac64a76c5126af22d76523b71c12034fb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 08:40:28 +0100 Subject: [PATCH 106/147] building in parallel --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a8a7a6e0f..cd2690cc7 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,11 @@ all: spectral FEM processing .PHONY: spectral spectral: build/spectral - @(cd build/spectral;make --no-print-directory -ws all install;) + @(cd build/spectral;make -j4 --no-print-directory -ws all install;) .PHONY: FEM FEM: build/FEM - @(cd build/FEM; make --no-print-directory -ws all install;) + @(cd build/FEM; make -j4 --no-print-directory -ws all install;) .PHONY: build/spectral build/spectral: From 8832c04dd01842b6887cce5d6908c5b9a44b0f27 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 11:52:23 +0100 Subject: [PATCH 107/147] more sanity checks number of arguments for values per system needs to match the number of systems that are defined --- src/IO.f90 | 2 ++ src/config.f90 | 16 ++++++++++++---- src/plastic_phenopowerlaw.f90 | 8 ++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/IO.f90 b/src/IO.f90 index af59b11b9..193580fcc 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -1251,6 +1251,8 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) msg = 'negative number systems requested' case (145_pInt) msg = 'too many systems requested' + case (146_pInt) + msg = 'number of values does not match' !-------------------------------------------------------------------------------------------------- ! material error messages and related messages in mesh diff --git a/src/config.f90 b/src/config.f90 index 441dd953c..c7fd95b43 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -550,7 +550,7 @@ end function getString !> @details for cumulative keys, "()", values from all occurrences are return. Otherwise only all !! values from the last occurrence. If key is not found exits with error unless default is given. !-------------------------------------------------------------------------------------------------- -function getFloats(this,key,defaultVal,requiredShape) +function getFloats(this,key,defaultVal,requiredShape,requiredSize) use IO, only: & IO_error, & IO_stringValue, & @@ -561,7 +561,8 @@ function getFloats(this,key,defaultVal,requiredShape) class(tPartitionedStringList), target, intent(in) :: this character(len=*), intent(in) :: key real(pReal), dimension(:), intent(in), optional :: defaultVal - integer(pInt), dimension(:), intent(in), optional :: requiredShape + integer(pInt), dimension(:), intent(in), optional :: requiredShape ! not useful (is always 1D array) + integer(pInt), intent(in), optional :: requiredSize type(tPartitionedStringList), pointer :: item integer(pInt) :: i logical :: found, & @@ -588,6 +589,9 @@ function getFloats(this,key,defaultVal,requiredShape) if (.not. found) then if (present(defaultVal)) then; getFloats = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif endif + if (present(requiredSize)) then + if(requiredSize /= size(getFloats)) call IO_error(146,ext_msg=key) + endif end function getFloats @@ -597,7 +601,7 @@ end function getFloats !> @details for cumulative keys, "()", values from all occurrences are return. Otherwise only all !! values from the last occurrence. If key is not found exits with error unless default is given. !-------------------------------------------------------------------------------------------------- -function getInts(this,key,defaultVal,requiredShape) +function getInts(this,key,defaultVal,requiredShape,requiredSize) use IO, only: & IO_error, & IO_stringValue, & @@ -608,7 +612,8 @@ function getInts(this,key,defaultVal,requiredShape) class(tPartitionedStringList), target, intent(in) :: this character(len=*), intent(in) :: key integer(pInt), dimension(:), intent(in), optional :: defaultVal, & - requiredShape + requiredShape ! not useful (is always 1D array) + integer(pInt), intent(in), optional :: requiredSize type(tPartitionedStringList), pointer :: item integer(pInt) :: i logical :: found, & @@ -635,6 +640,9 @@ function getInts(this,key,defaultVal,requiredShape) if (.not. found) then if (present(defaultVal)) then; getInts = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif endif + if (present(requiredSize)) then + if(requiredSize /= size(getInts)) call IO_error(146,ext_msg=key) + endif end function getInts diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 053fe958b..531c1946d 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -217,9 +217,9 @@ subroutine plastic_phenopowerlaw_init config_phase(p)%getFloats('interaction_slipslip'), & structure(1:3)) - prm%xi_slip_0 = config_phase(p)%getFloats('tau0_slip', requiredShape=shape(prm%Nslip)) - prm%xi_slip_sat = config_phase(p)%getFloats('tausat_slip', requiredShape=shape(prm%Nslip)) - prm%H_int = config_phase(p)%getFloats('h_int', requiredShape=shape(prm%Nslip), & + prm%xi_slip_0 = config_phase(p)%getFloats('tau0_slip', requiredSize=size(prm%Nslip)) + prm%xi_slip_sat = config_phase(p)%getFloats('tausat_slip', requiredSize=size(prm%Nslip)) + prm%H_int = config_phase(p)%getFloats('h_int', requiredSize=size(prm%Nslip), & defaultVal=[(0.0_pReal,i=1_pInt,size(prm%Nslip))]) prm%gdot0_slip = config_phase(p)%getFloat('gdot0_slip') @@ -256,7 +256,7 @@ subroutine plastic_phenopowerlaw_init prm%gamma_twin_char = lattice_characteristicShear_twin(prm%Ntwin,structure(1:3),& config_phase(p)%getFloat('c/a')) - prm%xi_twin_0 = config_phase(p)%getFloats('tau0_twin',requiredShape=shape(prm%Ntwin)) + prm%xi_twin_0 = config_phase(p)%getFloats('tau0_twin',requiredSize=size(prm%Ntwin)) prm%gdot0_twin = config_phase(p)%getFloat('gdot0_twin') prm%n_twin = config_phase(p)%getFloat('n_twin') From fc171f388ab89f6e2115680413c99dbcfb6e1580 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 11:53:41 +0100 Subject: [PATCH 108/147] tests were updated --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index b9a52a85c..59b0cbe89 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit b9a52a85cd65cc27a8e863302bd984abdcad1455 +Subproject commit 59b0cbe899f272476fb6f00f0f8860428e6ceba3 From 0541cceb2cec4475a73e42919a9c7ad4405b9849 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 21 Dec 2018 12:26:41 +0100 Subject: [PATCH 109/147] [skip ci] updated version information after successful test of v2.0.2-1239-g9bdd4d1d --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4fd318a98..d161a8ad6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1187-gcd8ee450 +v2.0.2-1239-g9bdd4d1d From 2e8072b7681e9e8056ccb9cfa35f2b693c98d691 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 12:33:31 +0100 Subject: [PATCH 110/147] simplifying --- src/plastic_disloUCLA.f90 | 42 +++++++++------------------------------ 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index b3d5321bc..b07e9927a 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -29,10 +29,8 @@ module plastic_disloUCLA shearrate_ID, & accumulatedshear_ID, & mfp_ID, & - resolvedstress_ID, & thresholdstress_ID, & - dipoledistance_ID, & - stressexponent_ID + dipoledistance_ID end enum type, private :: tParameters @@ -309,14 +307,10 @@ subroutine plastic_disloUCLA_init() outputID = merge(accumulatedshear_ID,undefined_ID,prm%totalNslip>0_pInt) case ('mfp','mfp_slip') outputID = merge(mfp_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('resolved_stress','resolved_stress_slip') - outputID = merge(resolvedstress_ID,undefined_ID,prm%totalNslip>0_pInt) case ('threshold_stress','threshold_stress_slip') outputID = merge(thresholdstress_ID,undefined_ID,prm%totalNslip>0_pInt) case ('edge_dipole_distance') outputID = merge(dipoleDistance_ID,undefined_ID,prm%totalNslip>0_pInt) - case ('stress_exponent') - outputID = merge(stressexponent_ID,undefined_ID,prm%totalNslip>0_pInt) end select if (outputID /= undefined_ID) then @@ -461,9 +455,6 @@ pure subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,inst enddo slipSystems end associate - Lp = 0.5_pReal * Lp - dLp_dMp = 0.5_pReal * dLp_dMp - end subroutine plastic_disloUCLA_LpAndItsTangent @@ -501,7 +492,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) dot%whole(:,of) = 0.0_pReal - dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg)*0.5_pReal + dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg) VacancyDiffusion = prm%D0*exp(-prm%Qsd/(kB*Temperature)) @@ -574,29 +565,14 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe postResults(c+1_pInt:c+prm%totalNslip) = stt%rhoEdge(1_pInt:prm%totalNslip,of) case (rhoDip_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%rhoEdgeDip(1_pInt:prm%totalNslip,of) - case (shearrate_ID,stressexponent_ID) + case (shearrate_ID) call kinetics(prm,stt,dst,Mp,Temperature,of, & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) - - if (prm%outputID(o) == shearrate_ID) then - postResults(c+1:c+prm%totalNslip) = (gdot_slip_pos + gdot_slip_neg)*0.5_pReal - elseif(prm%outputID(o) == stressexponent_ID) then - where (dNeq0(gdot_slip_pos+gdot_slip_neg)) - postResults(c+1_pInt:c + prm%totalNslip) = (tau_slip_pos+tau_slip_neg) * 0.5_pReal & - / (gdot_slip_pos+gdot_slip_neg) & - * (dgdot_dtauslip_pos+dgdot_dtauslip_neg) - else where - postResults(c+1_pInt:c + prm%totalNslip) = 0.0_pReal - end where - endif + gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + postResults(c+1:c+prm%totalNslip) = gdot_slip_pos + gdot_slip_neg case (accumulatedshear_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%accshear_slip(1_pInt:prm%totalNslip, of) case (mfp_ID) postResults(c+1_pInt:c+prm%totalNslip) = dst%mfp(1_pInt:prm%totalNslip, of) - case (resolvedstress_ID) - do i = 1_pInt, prm%totalNslip - postResults(c+i) =math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,i)) - enddo case (thresholdstress_ID) postResults(c+1_pInt:c+prm%totalNslip) = dst%threshold_stress(1_pInt:prm%totalNslip,of) case (dipoleDistance_ID) @@ -678,7 +654,7 @@ math_mul33xx33 * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) - gdot_slip_pos = DotGamma0 * sign(vel_slip,tau_slip_pos) + gdot_slip_pos = DotGamma0 * sign(vel_slip,tau_slip_pos) * 0.5_pReal dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & * ( dst%mfp(:,of) - prm%kink_width ) & @@ -717,7 +693,7 @@ math_mul33xx33 )**2.0_pReal & ) - dgdot_dtauslip_pos = DotGamma0 * dvel_slip + dgdot_dtauslip_pos = DotGamma0 * dvel_slip* 0.5_pReal else where significantPositiveTau gdot_slip_pos = 0.0_pReal dgdot_dtauslip_pos = 0.0_pReal @@ -740,7 +716,7 @@ end where significantPositiveTau * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) - gdot_slip_neg = DotGamma0 * sign(vel_slip,tau_slip_neg) + gdot_slip_neg = DotGamma0 * sign(vel_slip,tau_slip_neg) * 0.5_pReal dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & * ( dst%mfp(:,of) - prm%kink_width ) & @@ -780,7 +756,7 @@ end where significantPositiveTau ) - dgdot_dtauslip_neg = DotGamma0 * dvel_slip + dgdot_dtauslip_neg = DotGamma0 * dvel_slip * 0.5_pReal else where significantNegativeTau gdot_slip_neg = 0.0_pReal dgdot_dtauslip_neg = 0.0_pReal From 24ddd8362d38b957859275c0ac6a80c8eae9b0d0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 12:46:43 +0100 Subject: [PATCH 111/147] cleaning and simplifying --- src/plastic_disloUCLA.f90 | 231 +++++++++++++++++++------------------- 1 file changed, 115 insertions(+), 116 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index b07e9927a..c3309ff89 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -90,6 +90,7 @@ module plastic_disloUCLA type, private :: tDisloUCLAdependentState real(pReal), allocatable, dimension(:,:) :: & mfp, & + dislocationSpacing, & threshold_stress end type tDisloUCLAdependentState @@ -382,6 +383,7 @@ subroutine plastic_disloUCLA_init() allocate(dst%mfp(prm%totalNslip,NipcMyPhase),source=0.0_pReal) + allocate(dst%dislocationSpacing(prm%totalNslip,NipcMyPhase),source=0.0_pReal) allocate(dst%threshold_stress(prm%totalNslip,NipcMyPhase),source=0.0_pReal) @@ -402,20 +404,18 @@ subroutine plastic_disloUCLA_dependentState(instance,of) integer(pInt) :: & i - real(pReal), dimension(param(instance)%totalNslip) :: & - dislocationSpacing ! 1/mean free distance between 2 forest dislocations seen by a moving dislocation associate(prm => param(instance), stt => state(instance),dst => dependentState(instance)) forall (i = 1_pInt:prm%totalNslip) - dislocationSpacing(i) = sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & + dst%dislocationSpacing(i,of) = sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & prm%forestProjectionEdge(:,i))) dst%threshold_stress(i,of) = prm%mu*prm%burgers(i) & * sqrt(dot_product(stt%rhoEdge(:,of)+stt%rhoEdgeDip(:,of), & prm%interaction_SlipSlip(i,:))) end forall - dst%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*dislocationSpacing/prm%Clambda) + dst%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*dst%dislocationSpacing(:,of)/prm%Clambda) end associate @@ -471,7 +471,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) implicit none real(pReal), dimension(3,3), intent(in):: & - Mp !< 2nd Piola Kirchhoff stress tensor in Mandel notation + Mp !< Mandel stress real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & @@ -492,12 +492,11 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) dot%whole(:,of) = 0.0_pReal - dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg) + dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg) ! ToDo: needs to be abs VacancyDiffusion = prm%D0*exp(-prm%Qsd/(kB*Temperature)) where(dEq0(tau_slip_pos)) - EdgeDipDistance = dst%mfp(:,of) !ToDo MD@FR: correct? was not handled properly before DotRhoDipFormation = 0.0_pReal DotRhoEdgeDipClimb = 0.0_pReal else where @@ -517,7 +516,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) - (2.0_pReal*prm%minDipDistance)/prm%burgers*stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)) !* Spontaneous annihilation of 2 single edge dislocations dot%rhoEdgeDip(:,of) = DotRhoDipFormation & - - (2.0_pReal*prm%minDipDistance)/prm%burgers* stt%rhoEdgeDip(:,of)*abs(dot%accshear_slip(:,of)) & !* Spontaneous annihilation of a single edge dislocation with a dipole constituent + - (2.0_pReal*prm%minDipDistance)/prm%burgers*stt%rhoEdgeDip(:,of)*abs(dot%accshear_slip(:,of)) & !* Spontaneous annihilation of a single edge dislocation with a dipole constituent - DotRhoEdgeDipClimb end associate @@ -603,8 +602,8 @@ pure subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & tol_math_check, & dEq, dNeq0 use math, only: & - pi, & -math_mul33xx33 + PI, & + math_mul33xx33 implicit none type(tParameters), intent(in) :: & @@ -637,132 +636,132 @@ math_mul33xx33 BoltzmannRatio = prm%H0kp/(kB*Temperature) DotGamma0 = stt%rhoEdge(:,of)*prm%burgers*prm%v0 - significantPositiveTau: where(abs(tau_slip_pos)-dst%threshold_stress(:,of) > tol_math_check) - StressRatio = (abs(tau_slip_pos)-dst%threshold_stress(:,of)) & - / (prm%solidSolutionStrength+prm%tau_Peierls) - StressRatio_p = StressRatio** prm%p - StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) + significantPositiveTau: where(abs(tau_slip_pos)-dst%threshold_stress(:,of) > tol_math_check) + StressRatio = (abs(tau_slip_pos)-dst%threshold_stress(:,of)) & + / (prm%solidSolutionStrength+prm%tau_Peierls) + StressRatio_p = StressRatio** prm%p + StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) - vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%kink_width ) & - * (tau_slip_pos & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & - / ( & - 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - ) - - gdot_slip_pos = DotGamma0 * sign(vel_slip,tau_slip_pos) * 0.5_pReal - - dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%kink_width ) & - * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - + tau_slip_pos & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& - *BoltzmannRatio*prm%p& - *prm%q/& - (prm%solidSolutionStrength+prm%tau_Peierls)*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) ) & - ) & - * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - ) & - - (tau_slip_pos & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & - * (2.0_pReal*(prm%burgers**2.0_pReal) & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& - *BoltzmannRatio*prm%p& - *prm%q/& - (prm%solidSolutionStrength+prm%tau_Peierls)*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& - ) & - ) & - / ( & - ( & + vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & + * ( dst%mfp(:,of) - prm%kink_width ) & + * (tau_slip_pos & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & + / ( & 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + prm%omega * prm%B & *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - )**2.0_pReal & ) - dgdot_dtauslip_pos = DotGamma0 * dvel_slip* 0.5_pReal -else where significantPositiveTau - gdot_slip_pos = 0.0_pReal - dgdot_dtauslip_pos = 0.0_pReal -end where significantPositiveTau + gdot_slip_pos = DotGamma0 * sign(vel_slip,tau_slip_pos) * 0.5_pReal - significantNegativeTau: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) - StressRatio = (abs(tau_slip_neg)-dst%threshold_stress(:,of)) & - / (prm%solidSolutionStrength+prm%tau_Peierls) - StressRatio_p = StressRatio** prm%p - StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) + dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & + * ( dst%mfp(:,of) - prm%kink_width ) & + * ( & + (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + + tau_slip_pos & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& + *BoltzmannRatio*prm%p& + *prm%q/& + (prm%solidSolutionStrength+prm%tau_Peierls)*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) ) & + ) & + * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + ) & + - (tau_slip_pos & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & + * (2.0_pReal*(prm%burgers**2.0_pReal) & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& + *BoltzmannRatio*prm%p& + *prm%q/& + (prm%solidSolutionStrength+prm%tau_Peierls)*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& + ) & + ) & + / ( & + ( & + 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + )**2.0_pReal & + ) - vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%kink_width ) & - * (tau_slip_neg & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & - / ( & - 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - ) + dgdot_dtauslip_pos = DotGamma0 * dvel_slip* 0.5_pReal + else where significantPositiveTau + gdot_slip_pos = 0.0_pReal + dgdot_dtauslip_pos = 0.0_pReal + end where significantPositiveTau - gdot_slip_neg = DotGamma0 * sign(vel_slip,tau_slip_neg) * 0.5_pReal + significantNegativeTau: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) + StressRatio = (abs(tau_slip_neg)-dst%threshold_stress(:,of)) & + / (prm%solidSolutionStrength+prm%tau_Peierls) + StressRatio_p = StressRatio** prm%p + StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) - dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%kink_width ) & - * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - + tau_slip_neg & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& - *BoltzmannRatio*prm%p& - *prm%q/& - (prm%solidSolutionStrength+prm%tau_Peierls)*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) ) & - ) & - * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - ) & - - (tau_slip_neg & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & - * (2.0_pReal*(prm%burgers**2.0_pReal) & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& - *BoltzmannRatio*prm%p& - *prm%q/& - (prm%solidSolutionStrength+prm%tau_Peierls)*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& - ) & - ) & - / ( & - ( & + vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & + * ( dst%mfp(:,of) - prm%kink_width ) & + * (tau_slip_neg & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & + / ( & 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + prm%omega * prm%B & *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - )**2.0_pReal & ) + gdot_slip_neg = DotGamma0 * sign(vel_slip,tau_slip_neg) * 0.5_pReal - dgdot_dtauslip_neg = DotGamma0 * dvel_slip * 0.5_pReal -else where significantNegativeTau - gdot_slip_neg = 0.0_pReal - dgdot_dtauslip_neg = 0.0_pReal -end where significantNegativeTau + dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & + * ( dst%mfp(:,of) - prm%kink_width ) & + * ( & + (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + + tau_slip_neg & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& + *BoltzmannRatio*prm%p& + *prm%q/& + (prm%solidSolutionStrength+prm%tau_Peierls)*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) ) & + ) & + * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + ) & + - (tau_slip_neg & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & + * (2.0_pReal*(prm%burgers**2.0_pReal) & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& + *BoltzmannRatio*prm%p& + *prm%q/& + (prm%solidSolutionStrength+prm%tau_Peierls)*& + StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& + ) & + ) & + / ( & + ( & + 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + + prm%omega * prm%B & + *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + )**2.0_pReal & + ) + dgdot_dtauslip_neg = DotGamma0 * dvel_slip * 0.5_pReal + else where significantNegativeTau + gdot_slip_neg = 0.0_pReal + dgdot_dtauslip_neg = 0.0_pReal + end where significantNegativeTau + end subroutine kinetics + end module plastic_disloUCLA From da3f105875de285d1c60d5b51bc68a4705972a7c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 13:02:51 +0100 Subject: [PATCH 112/147] cleaner interface to kinetics --- src/plastic_disloUCLA.f90 | 67 +++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index c3309ff89..4c0c8e4e9 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -437,15 +437,15 @@ pure subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,inst integer(pInt) :: i,k,l,m,n real(pReal), dimension(param(instance)%totalNslip) :: & - gdot_slip_pos,gdot_slip_neg,tau_slip_pos,tau_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg + gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) Lp = 0.0_pReal dLp_dMp = 0.0_pReal - call kinetics(prm,stt,dst,Mp,Temperature,of, & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + call kinetics(Mp,Temperature,instance,of, & + gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) slipSystems: do i = 1_pInt, prm%totalNslip Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & @@ -488,8 +488,8 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) associate(prm => param(instance), stt => state(instance),dot => dotState(instance), dst => dependentState(instance)) - call kinetics(prm,stt,dst,Mp,Temperature,of, & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + call kinetics(Mp,Temperature,instance,of, & + gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg,tau_slip_pos,tau_slip_neg) dot%whole(:,of) = 0.0_pReal dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg) ! ToDo: needs to be abs @@ -549,8 +549,8 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe integer(pInt) :: & o,c,i real(pReal), dimension(param(instance)%totalNslip) :: & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos, & - gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg + gdot_slip_pos,dgdot_dtauslip_pos, & + gdot_slip_neg,dgdot_dtauslip_neg associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) @@ -565,8 +565,8 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe case (rhoDip_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%rhoEdgeDip(1_pInt:prm%totalNslip,of) case (shearrate_ID) - call kinetics(prm,stt,dst,Mp,Temperature,of, & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) + call kinetics(Mp,Temperature,instance,of, & + gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) postResults(c+1:c+prm%totalNslip) = gdot_slip_pos + gdot_slip_neg case (accumulatedshear_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%accshear_slip(1_pInt:prm%totalNslip, of) @@ -596,8 +596,8 @@ end function plastic_disloUCLA_postResults !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -pure subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg) +pure subroutine kinetics(Mp,Temperature,instance,of, & + gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg,tau_slip_pos1,tau_slip_neg1) use prec, only: & tol_math_check, & dEq, dNeq0 @@ -606,32 +606,35 @@ pure subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & math_mul33xx33 implicit none - type(tParameters), intent(in) :: & - prm - type(tDisloUCLAState), intent(in) :: & - stt - type(tDisloUCLAdependentState), intent(in) :: & - dst real(pReal), dimension(3,3), intent(in) :: & Mp !< 2nd Piola Kirchhoff stress tensor in Mandel notation real(pReal), intent(in) :: & temperature !< temperature at integration point integer(pInt), intent(in) :: & - of + of, instance integer(pInt) :: & j - real(pReal), intent(out), dimension(prm%totalNslip) :: & - gdot_slip_pos,dgdot_dtauslip_pos,tau_slip_pos,gdot_slip_neg,dgdot_dtauslip_neg,tau_slip_neg - real(pReal), dimension(prm%totalNslip) :: & + real(pReal), intent(out), dimension(param(instance)%totalNslip) :: & + gdot_slip_pos,gdot_slip_neg + real(pReal), intent(out), optional, dimension(param(instance)%totalNslip) :: & + dgdot_dtauslip_pos,tau_slip_pos1,dgdot_dtauslip_neg,tau_slip_neg1 + real(pReal), dimension(param(instance)%totalNslip) :: & StressRatio, BoltzmannRatio, & StressRatio_p,StressRatio_pminus1, & - DotGamma0, dvel_slip, vel_slip + DotGamma0, dvel_slip, vel_slip, & + tau_slip_pos,tau_slip_neg + associate(prm => param(instance), stt => state(instance),dot => dotState(instance), dst => dependentState(instance)) + do j = 1_pInt, prm%totalNslip tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) tau_slip_neg(j) = math_mul33xx33(Mp,prm%nonSchmid_neg(1:3,1:3,j)) enddo + + + if (present(tau_slip_pos1)) tau_slip_pos1 = tau_slip_pos + if (present(tau_slip_neg1)) tau_slip_neg1 = tau_slip_neg BoltzmannRatio = prm%H0kp/(kB*Temperature) DotGamma0 = stt%rhoEdge(:,of)*prm%burgers*prm%v0 @@ -654,7 +657,11 @@ pure subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & ) gdot_slip_pos = DotGamma0 * sign(vel_slip,tau_slip_pos) * 0.5_pReal + else where significantPositiveTau + gdot_slip_pos = 0.0_pReal + end where significantPositiveTau + significantPositiveTau2: where(abs(tau_slip_pos)-dst%threshold_stress(:,of) > tol_math_check) dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & * ( dst%mfp(:,of) - prm%kink_width ) & * ( & @@ -693,10 +700,9 @@ pure subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & ) dgdot_dtauslip_pos = DotGamma0 * dvel_slip* 0.5_pReal - else where significantPositiveTau - gdot_slip_pos = 0.0_pReal + else where significantPositiveTau2 dgdot_dtauslip_pos = 0.0_pReal - end where significantPositiveTau + end where significantPositiveTau2 significantNegativeTau: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) StressRatio = (abs(tau_slip_neg)-dst%threshold_stress(:,of)) & @@ -716,7 +722,11 @@ pure subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & ) gdot_slip_neg = DotGamma0 * sign(vel_slip,tau_slip_neg) * 0.5_pReal + else where significantNegativeTau + gdot_slip_neg = 0.0_pReal + end where significantNegativeTau + significantNegativeTau2: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & * ( dst%mfp(:,of) - prm%kink_width ) & * ( & @@ -756,10 +766,11 @@ pure subroutine kinetics(prm,stt,dst,Mp,Temperature,of, & dgdot_dtauslip_neg = DotGamma0 * dvel_slip * 0.5_pReal - else where significantNegativeTau - gdot_slip_neg = 0.0_pReal + else where significantNegativeTau2 dgdot_dtauslip_neg = 0.0_pReal - end where significantNegativeTau + end where significantNegativeTau2 + + end associate end subroutine kinetics From dcd22ccb6a4f04dcef23e59921f07c1ea05f8865 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 14:56:32 +0100 Subject: [PATCH 113/147] put private functions at the end for easy separation --- src/plastic_phenopowerlaw.f90 | 202 +++++++++++++++++----------------- 1 file changed, 103 insertions(+), 99 deletions(-) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 531c1946d..602f7701b 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -381,7 +381,7 @@ subroutine plastic_phenopowerlaw_init dot%gamma_twin => plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolShear - plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally dot%whole => plasticState(p)%dotState end associate @@ -398,7 +398,7 @@ end subroutine plastic_phenopowerlaw_init subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) implicit none - real(pReal), dimension(3,3), intent(out) :: & + real(pReal), dimension(3,3), intent(out) :: & Lp !< plastic velocity gradient real(pReal), dimension(3,3,3,3), intent(out) :: & dLp_dMp !< derivative of Lp with respect to the Mandel stress @@ -420,9 +420,9 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) Lp = 0.0_pReal dLp_dMp = 0.0_pReal - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(instance)) - call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) + call kinetics_slip(Mp,instance,of,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) slipSystems: do i = 1_pInt, prm%totalNslip Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & @@ -431,7 +431,7 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) + dgdot_dtauslip_neg(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_neg(m,n,i) enddo slipSystems - call kinetics_twin(prm,stt,of,Mp,gdot_twin,dgdot_dtautwin) + call kinetics_twin(Mp,instance,of,gdot_twin,dgdot_dtautwin) twinSystems: do i = 1_pInt, prm%totalNtwin Lp = Lp + gdot_twin(i)*prm%Schmid_twin(1:3,1:3,i) forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & @@ -452,7 +452,7 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) implicit none real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress - integer(pInt), intent(in) :: & + integer(pInt), intent(in) :: & instance, & of @@ -487,9 +487,9 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) !-------------------------------------------------------------------------------------------------- ! shear rates - call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg) + call kinetics_slip(Mp,instance,of,gdot_slip_pos,gdot_slip_neg) dot%gamma_slip(:,of) = abs(gdot_slip_pos+gdot_slip_neg) - call kinetics_twin(prm,stt,of,Mp,dot%gamma_twin(:,of)) + call kinetics_twin(Mp,instance,of,dot%gamma_twin(:,of)) !-------------------------------------------------------------------------------------------------- ! hardening @@ -509,41 +509,110 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) end subroutine plastic_phenopowerlaw_dotState +!-------------------------------------------------------------------------------------------------- +!> @brief return array of constitutive results +!-------------------------------------------------------------------------------------------------- +function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) + use math, only: & + math_mul33xx33 + + implicit none + real(pReal), dimension(3,3), intent(in) :: & + Mp !< Mandel stress + integer(pInt), intent(in) :: & + instance, & + of + + real(pReal), dimension(sum(plastic_phenopowerlaw_sizePostResult(:,instance))) :: & + postResults + + integer(pInt) :: & + o,c,i + real(pReal), dimension(param(instance)%totalNslip) :: & + gdot_slip_pos,gdot_slip_neg + + postResults = 0.0_pReal + c = 0_pInt + + associate( prm => param(instance), stt => state(instance)) + + outputsLoop: do o = 1_pInt,size(prm%outputID) + select case(prm%outputID(o)) + + case (resistance_slip_ID) + postResults(c+1_pInt:c+prm%totalNslip) = stt%xi_slip(1:prm%totalNslip,of) + c = c + prm%totalNslip + case (accumulatedshear_slip_ID) + postResults(c+1_pInt:c+prm%totalNslip) = stt%gamma_slip(1:prm%totalNslip,of) + c = c + prm%totalNslip + case (shearrate_slip_ID) + call kinetics_slip(Mp,instance,of,gdot_slip_pos,gdot_slip_neg) + postResults(c+1_pInt:c+prm%totalNslip) = gdot_slip_pos+gdot_slip_neg + c = c + prm%totalNslip + case (resolvedstress_slip_ID) + do i = 1_pInt, prm%totalNslip + postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_slip(1:3,1:3,i)) + enddo + c = c + prm%totalNslip + + case (resistance_twin_ID) + postResults(c+1_pInt:c+prm%totalNtwin) = stt%xi_twin(1:prm%totalNtwin,of) + c = c + prm%totalNtwin + case (accumulatedshear_twin_ID) + postResults(c+1_pInt:c+prm%totalNtwin) = stt%gamma_twin(1:prm%totalNtwin,of) + c = c + prm%totalNtwin + case (shearrate_twin_ID) + call kinetics_twin(Mp,instance,of,postResults(c+1_pInt:c+prm%totalNtwin)) + c = c + prm%totalNtwin + case (resolvedstress_twin_ID) + do i = 1_pInt, prm%totalNtwin + postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_twin(1:3,1:3,i)) + enddo + c = c + prm%totalNtwin + + end select + enddo outputsLoop + + end associate + +end function plastic_phenopowerlaw_postResults + + !-------------------------------------------------------------------------------------------------- !> @brief calculates shear rates on slip systems and derivatives with respect to resolved stress !> @details Shear rates 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_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg, & - dgdot_dtau_slip_pos,dgdot_dtau_slip_neg) +pure subroutine kinetics_slip(Mp,instance,of, & + gdot_slip_pos,gdot_slip_neg,dgdot_dtau_slip_pos,dgdot_dtau_slip_neg) use prec, only: & dNeq0 use math, only: & math_mul33xx33 implicit none - type(tParameters), intent(in) :: & - prm - type(tPhenopowerlawState), intent(in) :: & - stt - integer(pInt), intent(in) :: & + real(pReal), dimension(3,3), intent(in) :: & + Mp !< Mandel stress + integer(pInt), intent(in) :: & + instance, & of - real(pReal), dimension(prm%totalNslip), intent(out) :: & + + real(pReal), dimension(param(instance)%totalNslip), intent(out) :: & gdot_slip_pos, & gdot_slip_neg - real(pReal), dimension(prm%totalNslip), optional, intent(out) :: & + real(pReal), dimension(param(instance)%totalNslip), intent(out), optional :: & dgdot_dtau_slip_pos, & dgdot_dtau_slip_neg - real(pReal), dimension(3,3), intent(in) :: & - Mp - real(pReal), dimension(prm%totalNslip) :: & + real(pReal), dimension(param(instance)%totalNslip) :: & tau_slip_pos, & tau_slip_neg integer(pInt) :: i logical :: nonSchmidActive + associate(prm => param(instance), stt => state(instance)) + nonSchmidActive = size(prm%nonSchmidCoeff) > 0_pInt do i = 1_pInt, prm%totalNslip @@ -580,6 +649,7 @@ pure subroutine kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg, & dgdot_dtau_slip_neg = 0.0_pReal end where endif + end associate end subroutine kinetics_slip @@ -591,29 +661,30 @@ end subroutine kinetics_slip ! 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(prm,stt,of,Mp,gdot_twin,dgdot_dtau_twin) +pure subroutine kinetics_twin(Mp,instance,of,& + gdot_twin,dgdot_dtau_twin) use prec, only: & dNeq0 use math, only: & math_mul33xx33 implicit none - type(tParameters), intent(in) :: & - prm - type(tPhenopowerlawState), intent(in) :: & - stt - integer(pInt), intent(in) :: & + real(pReal), dimension(3,3), intent(in) :: & + Mp !< Mandel stress + integer(pInt), intent(in) :: & + instance, & of - real(pReal), dimension(3,3), intent(in) :: & - Mp - real(pReal), dimension(prm%totalNtwin), intent(out) :: & + + real(pReal), dimension(param(instance)%totalNtwin), intent(out) :: & gdot_twin - real(pReal), dimension(prm%totalNtwin), optional, intent(out) :: & + real(pReal), dimension(param(instance)%totalNtwin), intent(out), optional :: & dgdot_dtau_twin - real(pReal), dimension(prm%totalNtwin) :: & + real(pReal), dimension(param(instance)%totalNtwin) :: & tau_twin integer(pInt) :: i + + associate(prm => param(instance), stt => state(instance)) do i = 1_pInt, prm%totalNtwin tau_twin(i) = math_mul33xx33(Mp,prm%Schmid_twin(1:3,1:3,i)) @@ -633,76 +704,9 @@ pure subroutine kinetics_twin(prm,stt,of,Mp,gdot_twin,dgdot_dtau_twin) dgdot_dtau_twin = 0.0_pReal end where endif - -end subroutine kinetics_twin - - -!-------------------------------------------------------------------------------------------------- -!> @brief return array of constitutive results -!-------------------------------------------------------------------------------------------------- -function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) - use math, only: & - math_mul33xx33 - - implicit none - real(pReal), dimension(3,3), intent(in) :: & - Mp !< Mandel stress - integer(pInt), intent(in) :: & - instance, & - of - - real(pReal), dimension(sum(plastic_phenopowerlaw_sizePostResult(:,instance))) :: & - postResults - - integer(pInt) :: & - o,c,i - real(pReal), dimension(param(instance)%totalNslip) :: & - gdot_slip_pos,gdot_slip_neg - - postResults = 0.0_pReal - c = 0_pInt - - associate( prm => param(instance), stt => state(instance)) - - outputsLoop: do o = 1_pInt,size(prm%outputID) - select case(prm%outputID(o)) - - case (resistance_slip_ID) - postResults(c+1_pInt:c+prm%totalNslip) = stt%xi_slip(1:prm%totalNslip,of) - c = c + prm%totalNslip - case (accumulatedshear_slip_ID) - postResults(c+1_pInt:c+prm%totalNslip) = stt%gamma_slip(1:prm%totalNslip,of) - c = c + prm%totalNslip - case (shearrate_slip_ID) - call kinetics_slip(prm,stt,of,Mp,gdot_slip_pos,gdot_slip_neg) - postResults(c+1_pInt:c+prm%totalNslip) = gdot_slip_pos+gdot_slip_neg - c = c + prm%totalNslip - case (resolvedstress_slip_ID) - do i = 1_pInt, prm%totalNslip - postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_slip(1:3,1:3,i)) - enddo - c = c + prm%totalNslip - - case (resistance_twin_ID) - postResults(c+1_pInt:c+prm%totalNtwin) = stt%xi_twin(1:prm%totalNtwin,of) - c = c + prm%totalNtwin - case (accumulatedshear_twin_ID) - postResults(c+1_pInt:c+prm%totalNtwin) = stt%gamma_twin(1:prm%totalNtwin,of) - c = c + prm%totalNtwin - case (shearrate_twin_ID) - call kinetics_twin(prm,stt,of,Mp,postResults(c+1_pInt:c+prm%totalNtwin)) - c = c + prm%totalNtwin - case (resolvedstress_twin_ID) - do i = 1_pInt, prm%totalNtwin - postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_twin(1:3,1:3,i)) - enddo - c = c + prm%totalNtwin - - end select - enddo outputsLoop end associate -end function plastic_phenopowerlaw_postResults +end subroutine kinetics_twin end module plastic_phenopowerlaw From 939cd0e5bfd9b7f80a1b46224a29d10e06671bad Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 16:01:16 +0100 Subject: [PATCH 114/147] cleaning/adjusting names to paper --- src/plastic_disloUCLA.f90 | 133 ++++++++++++++++++++------------------ 1 file changed, 71 insertions(+), 62 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 4c0c8e4e9..de06d1863 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -42,21 +42,21 @@ module plastic_disloUCLA D0, & !< prefactor for self-diffusion coefficient Qsd !< activation energy for dislocation climb real(pReal), allocatable, dimension(:) :: & - rho0, & !< initial edge dislocation density per slip system for each family and instance - rhoDip0, & !< initial edge dipole density per slip system for each family and instance - burgers, & !< absolute length of burgers vector [m] for each slip system and instance + rho0, & !< initial edge dislocation density + rhoDip0, & !< initial edge dipole density + burgers, & !< absolute length of burgers vector [m] nonSchmidCoeff, & minDipDistance, & - CLambda, & !< Adj. parameter for distance between 2 forest dislocations for each slip system and instance + CLambda, & !< Adj. parameter for distance between 2 forest dislocations atomicVolume, & !* mobility law parameters - H0kp, & !< activation energy for glide [J] for each slip system and instance - v0, & !< dislocation velocity prefactor [m/s] for each family and instance + H0kp, & !< activation energy for glide [J] + v0, & !< dislocation velocity prefactor [m/s] p, & !< p-exponent in glide velocity q, & !< q-exponent in glide velocity B, & !< friction coefficient kink_height, & !< height of the kink pair - kink_width, & !< width of the kink pair + w, & !< width of the kink pair omega, & !< attempt frequency for kink pair nucleation tau_Peierls real(pReal), allocatable, dimension(:,:) :: & @@ -113,7 +113,6 @@ module plastic_disloUCLA contains - !-------------------------------------------------------------------------------------------------- !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks @@ -233,7 +232,7 @@ subroutine plastic_disloUCLA_init() prm%q = config_phase(p)%getFloats('q_slip', requiredShape=shape(prm%Nslip), & defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) prm%kink_height = config_phase(p)%getFloats('kink_height', requiredShape=shape(prm%Nslip)) - prm%kink_width = config_phase(p)%getFloats('kink_width', requiredShape=shape(prm%Nslip)) + prm%w = config_phase(p)%getFloats('kink_width', requiredShape=shape(prm%Nslip)) prm%omega = config_phase(p)%getFloats('omega', requiredShape=shape(prm%Nslip)) prm%B = config_phase(p)%getFloats('friction_coeff', requiredShape=shape(prm%Nslip)) @@ -253,7 +252,7 @@ subroutine plastic_disloUCLA_init() prm%H0kp = math_expand(prm%H0kp, prm%Nslip) prm%burgers = math_expand(prm%burgers, prm%Nslip) prm%kink_height = math_expand(prm%kink_height, prm%Nslip) - prm%kink_width = math_expand(prm%kink_width, prm%Nslip) + prm%w = math_expand(prm%w, prm%Nslip) prm%omega = math_expand(prm%omega, prm%Nslip) prm%tau_Peierls = math_expand(prm%tau_Peierls, prm%Nslip) prm%v0 = math_expand(prm%v0, prm%Nslip) @@ -386,8 +385,7 @@ subroutine plastic_disloUCLA_init() allocate(dst%dislocationSpacing(prm%totalNslip,NipcMyPhase),source=0.0_pReal) allocate(dst%threshold_stress(prm%totalNslip,NipcMyPhase),source=0.0_pReal) - - plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally end associate enddo @@ -416,6 +414,8 @@ subroutine plastic_disloUCLA_dependentState(instance,of) end forall dst%mfp(:,of) = prm%grainSize/(1.0_pReal+prm%grainSize*dst%dislocationSpacing(:,of)/prm%Clambda) + dst%dislocationSpacing(:,of) = dst%mfp(:,of) ! ToDo: Hack to recover wrong behavior for the moment + end associate @@ -428,24 +428,29 @@ end subroutine plastic_disloUCLA_dependentState pure subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,instance,of) implicit none - integer(pInt), intent(in) :: instance, of - real(pReal), intent(in) :: Temperature - real(pReal), dimension(3,3), intent(in) :: Mp - real(pReal), dimension(3,3), intent(out) :: Lp - real(pReal), dimension(3,3,3,3), intent(out) :: dLp_dMp + real(pReal), dimension(3,3), intent(out) :: & + Lp + real(pReal), dimension(3,3,3,3), intent(out) :: & + dLp_dMp + + real(pReal), dimension(3,3), intent(in):: & + Mp !< Mandel stress + real(pReal), intent(in) :: & + temperature !< temperature + integer(pInt), intent(in) :: & + instance, of integer(pInt) :: i,k,l,m,n - real(pReal), dimension(param(instance)%totalNslip) :: & gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg - associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) + associate(prm => param(instance)) Lp = 0.0_pReal dLp_dMp = 0.0_pReal call kinetics(Mp,Temperature,instance,of, & - gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) + gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) slipSystems: do i = 1_pInt, prm%totalNslip Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & @@ -453,6 +458,7 @@ pure subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,inst + dgdot_dtauslip_pos(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_pos(m,n,i) & + dgdot_dtauslip_neg(i) * prm%Schmid_slip(k,l,i) * prm%nonSchmid_neg(m,n,i) enddo slipSystems + end associate end subroutine plastic_disloUCLA_LpAndItsTangent @@ -473,7 +479,7 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) real(pReal), dimension(3,3), intent(in):: & Mp !< Mandel stress real(pReal), intent(in) :: & - temperature !< temperature at integration point + temperature !< temperature integer(pInt), intent(in) :: & instance, of @@ -483,43 +489,42 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) gdot_slip_pos, gdot_slip_neg,& tau_slip_pos,& tau_slip_neg, & - dgdot_dtauslip_neg,dgdot_dtauslip_pos,DotRhoDipFormation, ClimbVelocity, EdgeDipDistance, & + DotRhoDipFormation, ClimbVelocity, EdgeDipDistance, & DotRhoEdgeDipClimb associate(prm => param(instance), stt => state(instance),dot => dotState(instance), dst => dependentState(instance)) - call kinetics(Mp,Temperature,instance,of, & - gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg,tau_slip_pos,tau_slip_neg) + call kinetics(Mp,Temperature,instance,of,& + gdot_slip_pos,gdot_slip_neg, & + tau_slip_pos1 = tau_slip_pos,tau_slip_neg1 = tau_slip_neg) dot%whole(:,of) = 0.0_pReal dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg) ! ToDo: needs to be abs - VacancyDiffusion = prm%D0*exp(-prm%Qsd/(kB*Temperature)) - where(dEq0(tau_slip_pos)) + where(dEq0(tau_slip_pos)) ! ToDo: use avg of pos and neg DotRhoDipFormation = 0.0_pReal DotRhoEdgeDipClimb = 0.0_pReal else where EdgeDipDistance = math_clip((3.0_pReal*prm%mu*prm%burgers)/(16.0_pReal*PI*abs(tau_slip_pos)), & - prm%minDipDistance, & ! lower limit - dst%mfp(:,of)) ! upper limit - DotRhoDipFormation = merge(((2.0_pReal*EdgeDipDistance)/prm%burgers)* stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)), & + prm%minDipDistance, & ! lower limit + dst%mfp(:,of)) ! upper limit + DotRhoDipFormation = merge(((2.0_pReal*EdgeDipDistance)/prm%burgers)* stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)), & ! ToDo: ignore region of spontaneous annihilation 0.0_pReal, & prm%dipoleformation) ClimbVelocity = (3.0_pReal*prm%mu*VacancyDiffusion*prm%atomicVolume/(2.0_pReal*pi*kB*Temperature)) & * (1.0_pReal/(EdgeDipDistance+prm%minDipDistance)) - DotRhoEdgeDipClimb = (4.0_pReal*ClimbVelocity*stt%rhoEdgeDip(:,of))/(EdgeDipDistance-prm%minDipDistance) + DotRhoEdgeDipClimb = (4.0_pReal*ClimbVelocity*stt%rhoEdgeDip(:,of))/(EdgeDipDistance-prm%minDipDistance) ! ToDo: Discuss with Franz: Stress dependency? end where - dot%rhoEdge(:,of) = abs(dot%accshear_slip(:,of))/(prm%burgers*dst%mfp(:,of)) & ! multiplication + dot%rhoEdge(:,of) = abs(dot%accshear_slip(:,of))/(prm%burgers*dst%mfp(:,of)) & ! multiplication - DotRhoDipFormation & - (2.0_pReal*prm%minDipDistance)/prm%burgers*stt%rhoEdge(:,of)*abs(dot%accshear_slip(:,of)) !* Spontaneous annihilation of 2 single edge dislocations - dot%rhoEdgeDip(:,of) = DotRhoDipFormation & - (2.0_pReal*prm%minDipDistance)/prm%burgers*stt%rhoEdgeDip(:,of)*abs(dot%accshear_slip(:,of)) & !* Spontaneous annihilation of a single edge dislocation with a dipole constituent - DotRhoEdgeDipClimb -end associate + end associate end subroutine plastic_disloUCLA_dotState @@ -538,7 +543,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress real(pReal), intent(in) :: & - Temperature !< Mandel stress + temperature !< temperature integer(pInt), intent(in) :: & instance, & of @@ -549,8 +554,8 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe integer(pInt) :: & o,c,i real(pReal), dimension(param(instance)%totalNslip) :: & - gdot_slip_pos,dgdot_dtauslip_pos, & - gdot_slip_neg,dgdot_dtauslip_neg + gdot_slip_pos, & + gdot_slip_neg associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) @@ -565,8 +570,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe case (rhoDip_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%rhoEdgeDip(1_pInt:prm%totalNslip,of) case (shearrate_ID) - call kinetics(Mp,Temperature,instance,of, & - gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) + call kinetics(Mp,Temperature,instance,of,gdot_slip_pos,gdot_slip_neg) postResults(c+1:c+prm%totalNslip) = gdot_slip_pos + gdot_slip_neg case (accumulatedshear_ID) postResults(c+1_pInt:c+prm%totalNslip) = stt%accshear_slip(1_pInt:prm%totalNslip, of) @@ -574,7 +578,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe postResults(c+1_pInt:c+prm%totalNslip) = dst%mfp(1_pInt:prm%totalNslip, of) case (thresholdstress_ID) postResults(c+1_pInt:c+prm%totalNslip) = dst%threshold_stress(1_pInt:prm%totalNslip,of) - case (dipoleDistance_ID) + case (dipoleDistance_ID) ! ToDo: Discuss required changes with Franz do i = 1_pInt, prm%totalNslip if (dNeq0(abs(math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,i))))) then postResults(c+i) = (3.0_pReal*prm%mu*prm%burgers(i)) & @@ -607,9 +611,9 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & implicit none real(pReal), dimension(3,3), intent(in) :: & - Mp !< 2nd Piola Kirchhoff stress tensor in Mandel notation + Mp !< Mandel stress real(pReal), intent(in) :: & - temperature !< temperature at integration point + temperature !< temperature integer(pInt), intent(in) :: & of, instance @@ -620,12 +624,13 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & real(pReal), intent(out), optional, dimension(param(instance)%totalNslip) :: & dgdot_dtauslip_pos,tau_slip_pos1,dgdot_dtauslip_neg,tau_slip_neg1 real(pReal), dimension(param(instance)%totalNslip) :: & - StressRatio, BoltzmannRatio, & + StressRatio, & StressRatio_p,StressRatio_pminus1, & - DotGamma0, dvel_slip, vel_slip, & - tau_slip_pos,tau_slip_neg + dvel_slip, vel_slip, & + tau_slip_pos,tau_slip_neg, & + needsGoodName ! ToDo: @Karo: any idea? - associate(prm => param(instance), stt => state(instance),dot => dotState(instance), dst => dependentState(instance)) + associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) do j = 1_pInt, prm%totalNslip tau_slip_pos(j) = math_mul33xx33(Mp,prm%nonSchmid_pos(1:3,1:3,j)) @@ -636,23 +641,24 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & if (present(tau_slip_pos1)) tau_slip_pos1 = tau_slip_pos if (present(tau_slip_neg1)) tau_slip_neg1 = tau_slip_neg - BoltzmannRatio = prm%H0kp/(kB*Temperature) - DotGamma0 = stt%rhoEdge(:,of)*prm%burgers*prm%v0 + associate(BoltzmannRatio => prm%H0kp/(kB*Temperature), & + DotGamma0 => stt%rhoEdge(:,of)*prm%burgers*prm%v0) significantPositiveTau: where(abs(tau_slip_pos)-dst%threshold_stress(:,of) > tol_math_check) StressRatio = (abs(tau_slip_pos)-dst%threshold_stress(:,of)) & / (prm%solidSolutionStrength+prm%tau_Peierls) StressRatio_p = StressRatio** prm%p StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) + needsGoodName = exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%kink_width ) & + * ( dst%mfp(:,of) - prm%w ) & * (tau_slip_pos & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & / ( & 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) @@ -661,9 +667,10 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & gdot_slip_pos = 0.0_pReal end where significantPositiveTau + if (present(dgdot_dtauslip_pos)) then significantPositiveTau2: where(abs(tau_slip_pos)-dst%threshold_stress(:,of) > tol_math_check) dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%kink_width ) & + * ( dst%mfp(:,of) - prm%w ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + tau_slip_pos & @@ -675,14 +682,14 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & ) & * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) & - (tau_slip_pos & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & * (2.0_pReal*(prm%burgers**2.0_pReal) & + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& *BoltzmannRatio*prm%p& *prm%q/& @@ -694,7 +701,7 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & ( & 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & )**2.0_pReal & ) @@ -703,21 +710,23 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & else where significantPositiveTau2 dgdot_dtauslip_pos = 0.0_pReal end where significantPositiveTau2 + endif significantNegativeTau: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) StressRatio = (abs(tau_slip_neg)-dst%threshold_stress(:,of)) & / (prm%solidSolutionStrength+prm%tau_Peierls) StressRatio_p = StressRatio** prm%p StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) + needsGoodName = exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%kink_width ) & + * ( dst%mfp(:,of) - prm%w ) & * (tau_slip_neg & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & / ( & 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) @@ -726,9 +735,10 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & gdot_slip_neg = 0.0_pReal end where significantNegativeTau + if (present(dgdot_dtauslip_neg)) then significantNegativeTau2: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%kink_width ) & + * ( dst%mfp(:,of) - prm%w ) & * ( & (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & + tau_slip_neg & @@ -740,14 +750,14 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & ) & * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & ) & - (tau_slip_neg & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & * (2.0_pReal*(prm%burgers**2.0_pReal) & + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& *BoltzmannRatio*prm%p& *prm%q/& @@ -759,20 +769,19 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & ( & 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%kink_width )**2.0_pReal) & + *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & )**2.0_pReal & ) - dgdot_dtauslip_neg = DotGamma0 * dvel_slip * 0.5_pReal else where significantNegativeTau2 dgdot_dtauslip_neg = 0.0_pReal end where significantNegativeTau2 - + end if + end associate end associate end subroutine kinetics - end module plastic_disloUCLA From 2d47af7f56a73c9b9e9e0f0be2af7bc7d1c3dd5b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 17:04:26 +0100 Subject: [PATCH 115/147] shortened --- src/plastic_disloUCLA.f90 | 154 +++++++++++++------------------------- 1 file changed, 54 insertions(+), 100 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index de06d1863..19d5de6f9 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -58,7 +58,8 @@ module plastic_disloUCLA kink_height, & !< height of the kink pair w, & !< width of the kink pair omega, & !< attempt frequency for kink pair nucleation - tau_Peierls + tau_Peierls, & + tau0 real(pReal), allocatable, dimension(:,:) :: & interaction_SlipSlip, & !< slip resistance from slip activity forestProjectionEdge @@ -110,7 +111,6 @@ module plastic_disloUCLA private :: & kinetics - contains !-------------------------------------------------------------------------------------------------- @@ -226,7 +226,7 @@ subroutine plastic_disloUCLA_init() prm%H0kp = config_phase(p)%getFloats('qedge', requiredShape=shape(prm%Nslip)) prm%clambda = config_phase(p)%getFloats('clambdaslip', requiredShape=shape(prm%Nslip)) - prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls', requiredShape=shape(prm%Nslip)) + prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls', requiredShape=shape(prm%Nslip)) ! ToDo: Deprecated prm%p = config_phase(p)%getFloats('p_slip', requiredShape=shape(prm%Nslip), & defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) prm%q = config_phase(p)%getFloats('q_slip', requiredShape=shape(prm%Nslip), & @@ -236,7 +236,7 @@ subroutine plastic_disloUCLA_init() prm%omega = config_phase(p)%getFloats('omega', requiredShape=shape(prm%Nslip)) prm%B = config_phase(p)%getFloats('friction_coeff', requiredShape=shape(prm%Nslip)) - prm%SolidSolutionStrength = config_phase(p)%getFloat('solidsolutionstrength') + prm%SolidSolutionStrength = config_phase(p)%getFloat('solidsolutionstrength') ! ToDo: Deprecated prm%grainSize = config_phase(p)%getFloat('grainsize') prm%D0 = config_phase(p)%getFloat('d0') prm%Qsd = config_phase(p)%getFloat('qsd') @@ -260,6 +260,9 @@ subroutine plastic_disloUCLA_init() prm%clambda = math_expand(prm%clambda, prm%Nslip) prm%atomicVolume = math_expand(prm%atomicVolume, prm%Nslip) prm%minDipDistance = math_expand(prm%minDipDistance, prm%Nslip) + + prm%tau0 = prm%tau_peierls + prm%SolidSolutionStrength + ! sanity checks if (any(prm%rho0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedge0' @@ -642,25 +645,20 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & if (present(tau_slip_neg1)) tau_slip_neg1 = tau_slip_neg associate(BoltzmannRatio => prm%H0kp/(kB*Temperature), & - DotGamma0 => stt%rhoEdge(:,of)*prm%burgers*prm%v0) + DotGamma0 => stt%rhoEdge(:,of)*prm%burgers*prm%v0, & + effectiveLength => dst%mfp(:,of) - prm%w) significantPositiveTau: where(abs(tau_slip_pos)-dst%threshold_stress(:,of) > tol_math_check) - StressRatio = (abs(tau_slip_pos)-dst%threshold_stress(:,of)) & - / (prm%solidSolutionStrength+prm%tau_Peierls) + StressRatio = (abs(tau_slip_pos)-dst%threshold_stress(:,of))/prm%tau0 StressRatio_p = StressRatio** prm%p StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) needsGoodName = exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%w ) & - * (tau_slip_pos & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & - / ( & - 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - ) + * effectiveLength * tau_slip_pos * needsGoodName & + / ( 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + + prm%omega * prm%B * effectiveLength**2.0_pReal* needsGoodName & + ) gdot_slip_pos = DotGamma0 * sign(vel_slip,tau_slip_pos) * 0.5_pReal else where significantPositiveTau @@ -669,42 +667,23 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & if (present(dgdot_dtauslip_pos)) then significantPositiveTau2: where(abs(tau_slip_pos)-dst%threshold_stress(:,of) > tol_math_check) - dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%w ) & - * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - + tau_slip_pos & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& - *BoltzmannRatio*prm%p& - *prm%q/& - (prm%solidSolutionStrength+prm%tau_Peierls)*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) ) & - ) & - * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - ) & - - (tau_slip_pos & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & - * (2.0_pReal*(prm%burgers**2.0_pReal) & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& - *BoltzmannRatio*prm%p& - *prm%q/& - (prm%solidSolutionStrength+prm%tau_Peierls)*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& - ) & - ) & - / ( & - ( & - 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - )**2.0_pReal & - ) + dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega* effectiveLength & + * ( & + (needsGoodName + tau_slip_pos * abs(needsGoodName)*BoltzmannRatio*prm%p & + * prm%q/prm%tau0 & + * StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) & + ) & + * ( 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_pos & + + prm%omega * prm%B* effectiveLength **2.0_pReal* needsGoodName & + ) & + - tau_slip_pos * needsGoodName * (2.0_pReal*prm%burgers**2.0_pReal & + + prm%omega * prm%B *effectiveLength **2.0_pReal& + * (abs(needsGoodName)*BoltzmannRatio*prm%p *prm%q/prm%tau0 & + *StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& + ) & + ) & + /(2.0_pReal*prm%burgers**2.0_pReal*tau_slip_pos & + + prm%omega * prm%B* effectiveLength**2.0_pReal* needsGoodName )**2.0_pReal dgdot_dtauslip_pos = DotGamma0 * dvel_slip* 0.5_pReal else where significantPositiveTau2 @@ -713,22 +692,16 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & endif significantNegativeTau: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) - StressRatio = (abs(tau_slip_neg)-dst%threshold_stress(:,of)) & - / (prm%solidSolutionStrength+prm%tau_Peierls) + StressRatio = (abs(tau_slip_neg)-dst%threshold_stress(:,of))/prm%tau0 StressRatio_p = StressRatio** prm%p StressRatio_pminus1 = StressRatio**(prm%p-1.0_pReal) needsGoodName = exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) vel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%w ) & - * (tau_slip_neg & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & - / ( & - 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - ) + * effectiveLength * tau_slip_neg * needsGoodName & + / ( 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + + prm%omega * prm%B * effectiveLength**2.0_pReal* needsGoodName & + ) gdot_slip_neg = DotGamma0 * sign(vel_slip,tau_slip_neg) * 0.5_pReal else where significantNegativeTau @@ -737,43 +710,24 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & if (present(dgdot_dtauslip_neg)) then significantNegativeTau2: where(abs(tau_slip_neg)-dst%threshold_stress(:,of) > tol_math_check) - dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega & - * ( dst%mfp(:,of) - prm%w ) & - * ( & - (exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - + tau_slip_neg & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& - *BoltzmannRatio*prm%p& - *prm%q/& - (prm%solidSolutionStrength+prm%tau_Peierls)*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) ) & - ) & - * (2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - ) & - - (tau_slip_neg & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) ) & - * (2.0_pReal*(prm%burgers**2.0_pReal) & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & - * (abs(exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q))& - *BoltzmannRatio*prm%p& - *prm%q/& - (prm%solidSolutionStrength+prm%tau_Peierls)*& - StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& - ) & - ) & - / ( & - ( & - 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & - + prm%omega * prm%B & - *(( dst%mfp(:,of) - prm%w )**2.0_pReal) & - * exp(-BoltzmannRatio*(1-StressRatio_p) ** prm%q) & - )**2.0_pReal & - ) - + dvel_slip = 2.0_pReal*prm%burgers * prm%kink_height * prm%omega* effectiveLength & + * ( & + (needsGoodName + tau_slip_neg * abs(needsGoodName)*BoltzmannRatio*prm%p & + * prm%q/prm%tau0 & + * StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) & + ) & + * ( 2.0_pReal*(prm%burgers**2.0_pReal)*tau_slip_neg & + + prm%omega * prm%B* effectiveLength **2.0_pReal* needsGoodName & + ) & + - tau_slip_neg * needsGoodName * (2.0_pReal*prm%burgers**2.0_pReal & + + prm%omega * prm%B *effectiveLength **2.0_pReal& + * (abs(needsGoodName)*BoltzmannRatio*prm%p *prm%q/prm%tau0 & + *StressRatio_pminus1*(1-StressRatio_p)**(prm%q-1.0_pReal) )& + ) & + ) & + /(2.0_pReal*prm%burgers**2.0_pReal*tau_slip_neg & + + prm%omega * prm%B* effectiveLength**2.0_pReal* needsGoodName )**2.0_pReal + dgdot_dtauslip_neg = DotGamma0 * dvel_slip * 0.5_pReal else where significantNegativeTau2 dgdot_dtauslip_neg = 0.0_pReal From d8a7fdd01d9431b22cb4d92d368b9bf9c9003533 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 18:14:54 +0100 Subject: [PATCH 116/147] function description was wrong --- src/plastic_phenopowerlaw.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 602f7701b..347e2d8f8 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -579,8 +579,8 @@ end function plastic_phenopowerlaw_postResults !-------------------------------------------------------------------------------------------------- -!> @brief calculates shear rates on slip systems and derivatives with respect to resolved stress -!> @details Shear rates are calculated only optionally. +!> @brief Shear rates on slip 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 !-------------------------------------------------------------------------------------------------- @@ -655,7 +655,7 @@ end subroutine kinetics_slip !-------------------------------------------------------------------------------------------------- -!> @brief calculates shear rates on twin systems and derivatives with respect to resolved stress. +!> @brief Shear rates on twin systems and their derivatives with respect to resolved stress. ! twinning is assumed to take place only in untwinned volume. !> @details Derivates are calculated only optionally. ! NOTE: Against the common convention, the result (i.e. intent(out)) variables are the last to From b6cb456b2770ea762c352a4e327026688585c8af Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 Dec 2018 18:15:56 +0100 Subject: [PATCH 117/147] function description as for phenopowerlaw --- src/plastic_disloUCLA.f90 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 19d5de6f9..9fb4c9bf7 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -599,9 +599,12 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe end function plastic_disloUCLA_postResults - -!-------------------------------------------------------------------------------------------------- -!> @brief return array of constitutive results +!-------------------------------------------------------------------------------------------------- +!> @brief Shear rates on slip systems, their derivatives with respect to resolved stress and the +! resolved stresss +!> @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 +! have the optional arguments at the end !-------------------------------------------------------------------------------------------------- pure subroutine kinetics(Mp,Temperature,instance,of, & gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg,tau_slip_pos1,tau_slip_neg1) From 226bbad0135c1fd7fed892cd2e3b080321ab9beb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 22 Dec 2018 08:31:13 +0100 Subject: [PATCH 118/147] don't waste character space --- src/plastic_phenopowerlaw.f90 | 65 ++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 347e2d8f8..9ba8dfc01 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -177,20 +177,21 @@ subroutine plastic_phenopowerlaw_init if (phase_plasticity(p) /= PLASTICITY_PHENOPOWERLAW_ID) cycle associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & - stt => state(phase_plasticityInstance(p))) + stt => state(phase_plasticityInstance(p)), & + config => config_phase(p)) - structure = config_phase(p)%getString('lattice_structure') + structure = config%getString('lattice_structure') !-------------------------------------------------------------------------------------------------- ! optional parameters that need to be defined - prm%twinB = config_phase(p)%getFloat('twin_b',defaultVal=1.0_pReal) - prm%twinC = config_phase(p)%getFloat('twin_c',defaultVal=0.0_pReal) - prm%twinD = config_phase(p)%getFloat('twin_d',defaultVal=0.0_pReal) - prm%twinE = config_phase(p)%getFloat('twin_e',defaultVal=0.0_pReal) + prm%twinB = config%getFloat('twin_b',defaultVal=1.0_pReal) + prm%twinC = config%getFloat('twin_c',defaultVal=0.0_pReal) + prm%twinD = config%getFloat('twin_d',defaultVal=0.0_pReal) + prm%twinE = config%getFloat('twin_e',defaultVal=0.0_pReal) - prm%aTolResistance = config_phase(p)%getFloat('atol_resistance',defaultVal=1.0_pReal) - prm%aTolShear = config_phase(p)%getFloat('atol_shear', defaultVal=1.0e-6_pReal) - prm%aTolTwinfrac = config_phase(p)%getFloat('atol_twinfrac', defaultVal=1.0e-6_pReal) + prm%aTolResistance = config%getFloat('atol_resistance',defaultVal=1.0_pReal) + prm%aTolShear = config%getFloat('atol_shear', defaultVal=1.0e-6_pReal) + prm%aTolTwinfrac = config%getFloat('atol_twinfrac', defaultVal=1.0e-6_pReal) ! sanity checks if (prm%aTolResistance <= 0.0_pReal) extmsg = trim(extmsg)//'aTolresistance ' @@ -199,13 +200,13 @@ subroutine plastic_phenopowerlaw_init !-------------------------------------------------------------------------------------------------- ! slip related parameters - prm%Nslip = config_phase(p)%getInts('nslip',defaultVal=emptyIntArray) + prm%Nslip = config%getInts('nslip',defaultVal=emptyIntArray) prm%totalNslip = sum(prm%Nslip) slipActive: if (prm%totalNslip > 0_pInt) then prm%Schmid_slip = lattice_SchmidMatrix_slip(prm%Nslip,structure(1:3),& - config_phase(p)%getFloat('c/a',defaultVal=0.0_pReal)) + config%getFloat('c/a',defaultVal=0.0_pReal)) if(structure=='bcc') then - prm%nonSchmidCoeff = config_phase(p)%getFloats('nonschmid_coefficients',& + prm%nonSchmidCoeff = config%getFloats('nonschmid_coefficients',& defaultVal = emptyRealArray) prm%nonSchmid_pos = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,+1_pInt) prm%nonSchmid_neg = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,-1_pInt) @@ -214,18 +215,18 @@ subroutine plastic_phenopowerlaw_init prm%nonSchmid_neg = prm%Schmid_slip endif prm%interaction_SlipSlip = lattice_interaction_SlipSlip(prm%Nslip, & - config_phase(p)%getFloats('interaction_slipslip'), & + config%getFloats('interaction_slipslip'), & structure(1:3)) - prm%xi_slip_0 = config_phase(p)%getFloats('tau0_slip', requiredSize=size(prm%Nslip)) - prm%xi_slip_sat = config_phase(p)%getFloats('tausat_slip', requiredSize=size(prm%Nslip)) - prm%H_int = config_phase(p)%getFloats('h_int', requiredSize=size(prm%Nslip), & + prm%xi_slip_0 = config%getFloats('tau0_slip', requiredSize=size(prm%Nslip)) + prm%xi_slip_sat = config%getFloats('tausat_slip', requiredSize=size(prm%Nslip)) + prm%H_int = config%getFloats('h_int', requiredSize=size(prm%Nslip), & defaultVal=[(0.0_pReal,i=1_pInt,size(prm%Nslip))]) - prm%gdot0_slip = config_phase(p)%getFloat('gdot0_slip') - prm%n_slip = config_phase(p)%getFloat('n_slip') - prm%a_slip = config_phase(p)%getFloat('a_slip') - prm%h0_SlipSlip = config_phase(p)%getFloat('h0_slipslip') + prm%gdot0_slip = config%getFloat('gdot0_slip') + prm%n_slip = config%getFloat('n_slip') + prm%a_slip = config%getFloat('a_slip') + prm%h0_SlipSlip = config%getFloat('h0_slipslip') ! expand: family => system prm%xi_slip_0 = math_expand(prm%xi_slip_0, prm%Nslip) @@ -245,23 +246,23 @@ subroutine plastic_phenopowerlaw_init !-------------------------------------------------------------------------------------------------- ! twin related parameters - prm%Ntwin = config_phase(p)%getInts('ntwin', defaultVal=emptyIntArray) + prm%Ntwin = config%getInts('ntwin', defaultVal=emptyIntArray) prm%totalNtwin = sum(prm%Ntwin) twinActive: if (prm%totalNtwin > 0_pInt) then prm%Schmid_twin = lattice_SchmidMatrix_twin(prm%Ntwin,structure(1:3),& - config_phase(p)%getFloat('c/a',defaultVal=0.0_pReal)) + config%getFloat('c/a',defaultVal=0.0_pReal)) prm%interaction_TwinTwin = lattice_interaction_TwinTwin(prm%Ntwin,& - config_phase(p)%getFloats('interaction_twintwin'), & + config%getFloats('interaction_twintwin'), & structure(1:3)) prm%gamma_twin_char = lattice_characteristicShear_twin(prm%Ntwin,structure(1:3),& - config_phase(p)%getFloat('c/a')) + config%getFloat('c/a')) - prm%xi_twin_0 = config_phase(p)%getFloats('tau0_twin',requiredSize=size(prm%Ntwin)) + prm%xi_twin_0 = config%getFloats('tau0_twin',requiredSize=size(prm%Ntwin)) - prm%gdot0_twin = config_phase(p)%getFloat('gdot0_twin') - prm%n_twin = config_phase(p)%getFloat('n_twin') - prm%spr = config_phase(p)%getFloat('s_pr') - prm%h0_TwinTwin = config_phase(p)%getFloat('h0_twintwin') + prm%gdot0_twin = config%getFloat('gdot0_twin') + prm%n_twin = config%getFloat('n_twin') + prm%spr = config%getFloat('s_pr') + prm%h0_TwinTwin = config%getFloat('h0_twintwin') ! expand: family => system prm%xi_twin_0 = math_expand(prm%xi_twin_0, prm%Ntwin) @@ -279,10 +280,10 @@ subroutine plastic_phenopowerlaw_init ! slip-twin related parameters slipAndTwinActive: if (prm%totalNslip > 0_pInt .and. prm%totalNtwin > 0_pInt) then prm%interaction_SlipTwin = lattice_interaction_SlipTwin(prm%Nslip,prm%Ntwin,& - config_phase(p)%getFloats('interaction_sliptwin'), & + config%getFloats('interaction_sliptwin'), & structure(1:3)) prm%interaction_TwinSlip = lattice_interaction_TwinSlip(prm%Ntwin,prm%Nslip,& - config_phase(p)%getFloats('interaction_twinslip'), & + config%getFloats('interaction_twinslip'), & structure(1:3)) else slipAndTwinActive allocate(prm%interaction_SlipTwin(prm%totalNslip,prm%TotalNtwin)) ! at least one dimension is 0 @@ -297,7 +298,7 @@ subroutine plastic_phenopowerlaw_init !-------------------------------------------------------------------------------------------------- ! output pararameters - outputs = config_phase(p)%getStrings('(output)',defaultVal=emptyStringArray) + outputs = config%getStrings('(output)',defaultVal=emptyStringArray) allocate(prm%outputID(0)) do i=1_pInt, size(outputs) outputID = undefined_ID From 708fc9f6b339b80c6c07571d0afdd28b65ae2eeb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 22 Dec 2018 08:32:47 +0100 Subject: [PATCH 119/147] not compatible with generalized solution handling --- src/homogenization.f90 | 176 ++--------------------------------------- 1 file changed, 5 insertions(+), 171 deletions(-) diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 82a97dc53..eb002dd60 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -26,9 +26,7 @@ module homogenization homogenization_maxSizePostResults, & thermal_maxSizePostResults, & damage_maxSizePostResults, & - vacancyflux_maxSizePostResults, & - porosity_maxSizePostResults, & - hydrogenflux_maxSizePostResults + porosity_maxSizePostResults real(pReal), dimension(:,:,:,:), allocatable, private :: & materialpoint_subF0, & !< def grad of IP at beginning of homogenization increment @@ -100,13 +98,8 @@ subroutine homogenization_init use damage_none use damage_local use damage_nonlocal - use vacancyflux_isoconc - use vacancyflux_isochempot - use vacancyflux_cahnhilliard use porosity_none use porosity_phasefield - use hydrogenflux_isoconc - use hydrogenflux_cahnhilliard use IO use numerics, only: & worldrank @@ -155,16 +148,6 @@ subroutine homogenization_init if (any(damage_type == DAMAGE_nonlocal_ID)) & call damage_nonlocal_init(FILEUNIT) -!-------------------------------------------------------------------------------------------------- -! parse vacancy transport from config file - call IO_checkAndRewind(FILEUNIT) - if (any(vacancyflux_type == VACANCYFLUX_isoconc_ID)) & - call vacancyflux_isoconc_init() - if (any(vacancyflux_type == VACANCYFLUX_isochempot_ID)) & - call vacancyflux_isochempot_init(FILEUNIT) - if (any(vacancyflux_type == VACANCYFLUX_cahnhilliard_ID)) & - call vacancyflux_cahnhilliard_init(FILEUNIT) - !-------------------------------------------------------------------------------------------------- ! parse porosity from config file call IO_checkAndRewind(FILEUNIT) @@ -173,15 +156,6 @@ subroutine homogenization_init if (any(porosity_type == POROSITY_phasefield_ID)) & call porosity_phasefield_init(FILEUNIT) -!-------------------------------------------------------------------------------------------------- -! parse hydrogen transport from config file - call IO_checkAndRewind(FILEUNIT) - if (any(hydrogenflux_type == HYDROGENFLUX_isoconc_ID)) & - call hydrogenflux_isoconc_init() - if (any(hydrogenflux_type == HYDROGENFLUX_cahnhilliard_ID)) & - call hydrogenflux_cahnhilliard_init(FILEUNIT) - close(FILEUNIT) - !-------------------------------------------------------------------------------------------------- ! write description file for homogenization output mainProcess2: if (worldrank == 0) then @@ -277,35 +251,6 @@ subroutine homogenization_init enddo endif endif - i = vacancyflux_typeInstance(p) ! which instance of this vacancy flux type - valid = .true. ! assume valid - select case(vacancyflux_type(p)) ! split per vacancy flux type - case (VACANCYFLUX_isoconc_ID) - outputName = VACANCYFLUX_isoconc_label - thisNoutput => null() - thisOutput => null() - thisSize => null() - case (VACANCYFLUX_isochempot_ID) - outputName = VACANCYFLUX_isochempot_label - thisNoutput => vacancyflux_isochempot_Noutput - thisOutput => vacancyflux_isochempot_output - thisSize => vacancyflux_isochempot_sizePostResult - case (VACANCYFLUX_cahnhilliard_ID) - outputName = VACANCYFLUX_cahnhilliard_label - thisNoutput => vacancyflux_cahnhilliard_Noutput - thisOutput => vacancyflux_cahnhilliard_output - thisSize => vacancyflux_cahnhilliard_sizePostResult - case default - valid = .false. - end select - if (valid) then - write(FILEUNIT,'(a)') '(vacancyflux)'//char(9)//trim(outputName) - if (vacancyflux_type(p) /= VACANCYFLUX_isoconc_ID) then - do e = 1,thisNoutput(i) - write(FILEUNIT,'(a,i4)') trim(thisOutput(e,i))//char(9),thisSize(e,i) - enddo - endif - endif i = porosity_typeInstance(p) ! which instance of this porosity type valid = .true. ! assume valid select case(porosity_type(p)) ! split per porosity type @@ -330,30 +275,6 @@ subroutine homogenization_init enddo endif endif - i = hydrogenflux_typeInstance(p) ! which instance of this hydrogen flux type - valid = .true. ! assume valid - select case(hydrogenflux_type(p)) ! split per hydrogen flux type - case (HYDROGENFLUX_isoconc_ID) - outputName = HYDROGENFLUX_isoconc_label - thisNoutput => null() - thisOutput => null() - thisSize => null() - case (HYDROGENFLUX_cahnhilliard_ID) - outputName = HYDROGENFLUX_cahnhilliard_label - thisNoutput => hydrogenflux_cahnhilliard_Noutput - thisOutput => hydrogenflux_cahnhilliard_output - thisSize => hydrogenflux_cahnhilliard_sizePostResult - case default - valid = .false. - end select - if (valid) then - write(FILEUNIT,'(a)') '(hydrogenflux)'//char(9)//trim(outputName) - if (hydrogenflux_type(p) /= HYDROGENFLUX_isoconc_ID) then - do e = 1,thisNoutput(i) - write(FILEUNIT,'(a,i4)') trim(thisOutput(e,i))//char(9),thisSize(e,i) - enddo - endif - endif endif enddo close(FILEUNIT) @@ -383,25 +304,19 @@ subroutine homogenization_init homogenization_maxSizePostResults = 0_pInt thermal_maxSizePostResults = 0_pInt damage_maxSizePostResults = 0_pInt - vacancyflux_maxSizePostResults = 0_pInt porosity_maxSizePostResults = 0_pInt - hydrogenflux_maxSizePostResults = 0_pInt do p = 1,size(config_homogenization) homogenization_maxSizePostResults = max(homogenization_maxSizePostResults,homogState (p)%sizePostResults) thermal_maxSizePostResults = max(thermal_maxSizePostResults, thermalState (p)%sizePostResults) damage_maxSizePostResults = max(damage_maxSizePostResults ,damageState (p)%sizePostResults) - vacancyflux_maxSizePostResults = max(vacancyflux_maxSizePostResults ,vacancyfluxState (p)%sizePostResults) porosity_maxSizePostResults = max(porosity_maxSizePostResults ,porosityState (p)%sizePostResults) - hydrogenflux_maxSizePostResults = max(hydrogenflux_maxSizePostResults ,hydrogenfluxState(p)%sizePostResults) enddo materialpoint_sizeResults = 1 & ! grain count + 1 + homogenization_maxSizePostResults & ! homogSize & homogResult + thermal_maxSizePostResults & + damage_maxSizePostResults & - + vacancyflux_maxSizePostResults & + porosity_maxSizePostResults & - + hydrogenflux_maxSizePostResults & + homogenization_maxNgrains * (1 + crystallite_maxSizePostResults & ! crystallite size & crystallite results + 1 + constitutive_plasticity_maxSizePostResults & ! constitutive size & constitutive results + constitutive_source_maxSizePostResults) @@ -460,9 +375,7 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) homogState, & thermalState, & damageState, & - vacancyfluxState, & porosityState, & - hydrogenfluxState, & phase_Nsources, & mappingHomogenization, & phaseAt, phasememberAt, & @@ -569,18 +482,10 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & damageState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal damage state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - vacancyfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - vacancyfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - vacancyfluxState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal vacancy transport state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & porosityState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal porosity state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - hydrogenfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - hydrogenfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - hydrogenfluxState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal hydrogen transport state enddo NiterationHomog = 0_pInt @@ -654,18 +559,10 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & damageState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) ! ...internal damage state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - vacancyfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - vacancyfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - vacancyfluxState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e))! ...internal vacancy transport state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & porosityState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e))! ...internal porosity state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - hydrogenfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - hydrogenfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - hydrogenfluxState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e))! ...internal hydrogen transport state materialpoint_subF0(1:3,1:3,i,e) = materialpoint_subF(1:3,1:3,i,e) ! ...def grad endif steppingNeeded @@ -729,18 +626,10 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & damageState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = & damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal damage state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - vacancyfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - vacancyfluxState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = & - vacancyfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e))! ...internal vacancy transport state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & porosityState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = & porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e))! ...internal porosity state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - hydrogenfluxState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - hydrogenfluxState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = & - hydrogenfluxState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e))! ...internal hydrogen transport state endif endif converged @@ -846,9 +735,7 @@ subroutine materialpoint_postResults homogState, & thermalState, & damageState, & - vacancyfluxState, & porosityState, & - hydrogenfluxState, & plasticState, & sourceState, & material_phase, & @@ -878,9 +765,7 @@ subroutine materialpoint_postResults theSize = homogState (mappingHomogenization(2,i,e))%sizePostResults & + thermalState (mappingHomogenization(2,i,e))%sizePostResults & + damageState (mappingHomogenization(2,i,e))%sizePostResults & - + vacancyfluxState (mappingHomogenization(2,i,e))%sizePostResults & - + porosityState (mappingHomogenization(2,i,e))%sizePostResults & - + hydrogenfluxState(mappingHomogenization(2,i,e))%sizePostResults + + porosityState (mappingHomogenization(2,i,e))%sizePostResults materialpoint_results(thePos+1,i,e) = real(theSize,pReal) ! tell size of homogenization results thePos = thePos + 1_pInt @@ -964,12 +849,10 @@ function homogenization_updateState(ip,el) homogenization_type, & thermal_type, & damage_type, & - vacancyflux_type, & homogenization_maxNgrains, & HOMOGENIZATION_RGC_ID, & THERMAL_adiabatic_ID, & - DAMAGE_local_ID, & - VACANCYFLUX_isochempot_ID + DAMAGE_local_ID use crystallite, only: & crystallite_P, & crystallite_dPdF, & @@ -981,8 +864,6 @@ function homogenization_updateState(ip,el) thermal_adiabatic_updateState use damage_local, only: & damage_local_updateState - use vacancyflux_isochempot, only: & - vacancyflux_isochempot_updateState implicit none integer(pInt), intent(in) :: & @@ -1023,15 +904,6 @@ function homogenization_updateState(ip,el) el) end select chosenDamage - chosenVacancyflux: select case (vacancyflux_type(mesh_element(3,el))) - case (VACANCYFLUX_isochempot_ID) chosenVacancyflux - homogenization_updateState = & - homogenization_updateState .and. & - vacancyflux_isochempot_updateState(materialpoint_subdt(ip,el), & - ip, & - el) - end select chosenVacancyflux - end function homogenization_updateState @@ -1095,15 +967,11 @@ function homogenization_postResults(ip,el) homogState, & thermalState, & damageState, & - vacancyfluxState, & porosityState, & - hydrogenfluxState, & homogenization_type, & thermal_type, & damage_type, & - vacancyflux_type, & porosity_type, & - hydrogenflux_type, & HOMOGENIZATION_NONE_ID, & HOMOGENIZATION_ISOSTRAIN_ID, & HOMOGENIZATION_RGC_ID, & @@ -1113,13 +981,8 @@ function homogenization_postResults(ip,el) DAMAGE_none_ID, & DAMAGE_local_ID, & DAMAGE_nonlocal_ID, & - VACANCYFLUX_isoconc_ID, & - VACANCYFLUX_isochempot_ID, & - VACANCYFLUX_cahnhilliard_ID, & POROSITY_none_ID, & - POROSITY_phasefield_ID, & - HYDROGENFLUX_isoconc_ID, & - HYDROGENFLUX_cahnhilliard_ID + POROSITY_phasefield_ID use homogenization_isostrain, only: & homogenization_isostrain_postResults use homogenization_RGC, only: & @@ -1132,14 +995,8 @@ function homogenization_postResults(ip,el) damage_local_postResults use damage_nonlocal, only: & damage_nonlocal_postResults - use vacancyflux_isochempot, only: & - vacancyflux_isochempot_postResults - use vacancyflux_cahnhilliard, only: & - vacancyflux_cahnhilliard_postResults use porosity_phasefield, only: & porosity_phasefield_postResults - use hydrogenflux_cahnhilliard, only: & - hydrogenflux_cahnhilliard_postResults implicit none integer(pInt), intent(in) :: & @@ -1148,9 +1005,7 @@ function homogenization_postResults(ip,el) real(pReal), dimension( homogState (mappingHomogenization(2,ip,el))%sizePostResults & + thermalState (mappingHomogenization(2,ip,el))%sizePostResults & + damageState (mappingHomogenization(2,ip,el))%sizePostResults & - + vacancyfluxState (mappingHomogenization(2,ip,el))%sizePostResults & - + porosityState (mappingHomogenization(2,ip,el))%sizePostResults & - + hydrogenfluxState(mappingHomogenization(2,ip,el))%sizePostResults) :: & + + porosityState (mappingHomogenization(2,ip,el))%sizePostResults) :: & homogenization_postResults integer(pInt) :: & startPos, endPos @@ -1205,18 +1060,6 @@ function homogenization_postResults(ip,el) damage_nonlocal_postResults(ip, el) end select chosenDamage - startPos = endPos + 1_pInt - endPos = endPos + vacancyfluxState(mappingHomogenization(2,ip,el))%sizePostResults - chosenVacancyflux: select case (vacancyflux_type(mesh_element(3,el))) - case (VACANCYFLUX_isoconc_ID) chosenVacancyflux - - case (VACANCYFLUX_isochempot_ID) chosenVacancyflux - homogenization_postResults(startPos:endPos) = & - vacancyflux_isochempot_postResults(ip, el) - case (VACANCYFLUX_cahnhilliard_ID) chosenVacancyflux - homogenization_postResults(startPos:endPos) = & - vacancyflux_cahnhilliard_postResults(ip, el) - end select chosenVacancyflux startPos = endPos + 1_pInt endPos = endPos + porosityState(mappingHomogenization(2,ip,el))%sizePostResults @@ -1228,15 +1071,6 @@ function homogenization_postResults(ip,el) porosity_phasefield_postResults(ip, el) end select chosenPorosity - startPos = endPos + 1_pInt - endPos = endPos + hydrogenfluxState(mappingHomogenization(2,ip,el))%sizePostResults - chosenHydrogenflux: select case (hydrogenflux_type(mesh_element(3,el))) - case (HYDROGENFLUX_isoconc_ID) chosenHydrogenflux - - case (HYDROGENFLUX_cahnhilliard_ID) chosenHydrogenflux - homogenization_postResults(startPos:endPos) = & - hydrogenflux_cahnhilliard_postResults(ip, el) - end select chosenHydrogenflux end function homogenization_postResults From 1520adb3fb21d86675703db47af610bf98a38006 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 22 Dec 2018 08:37:58 +0100 Subject: [PATCH 120/147] not compatible with generalized solute flux --- src/constitutive.f90 | 73 ++------------------------------------------ 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index 8294047e7..040f3c39e 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -88,14 +88,9 @@ subroutine constitutive_init() SOURCE_damage_isoDuctile_ID, & SOURCE_damage_anisoBrittle_ID, & SOURCE_damage_anisoDuctile_ID, & - SOURCE_vacancy_phenoplasticity_ID, & - SOURCE_vacancy_irradiation_ID, & - SOURCE_vacancy_thermalfluc_ID, & KINEMATICS_cleavage_opening_ID, & KINEMATICS_slipplane_opening_ID, & KINEMATICS_thermal_expansion_ID, & - KINEMATICS_vacancy_strain_ID, & - KINEMATICS_hydrogen_strain_ID, & ELASTICITY_HOOKE_label, & PLASTICITY_NONE_label, & PLASTICITY_ISOTROPIC_label, & @@ -110,9 +105,6 @@ subroutine constitutive_init() SOURCE_damage_isoDuctile_label, & SOURCE_damage_anisoBrittle_label, & SOURCE_damage_anisoDuctile_label, & - SOURCE_vacancy_phenoplasticity_label, & - SOURCE_vacancy_irradiation_label, & - SOURCE_vacancy_thermalfluc_label, & plasticState, & sourceState @@ -129,14 +121,9 @@ subroutine constitutive_init() use source_damage_isoDuctile use source_damage_anisoBrittle use source_damage_anisoDuctile - use source_vacancy_phenoplasticity - use source_vacancy_irradiation - use source_vacancy_thermalfluc use kinematics_cleavage_opening use kinematics_slipplane_opening use kinematics_thermal_expansion - use kinematics_vacancy_strain - use kinematics_hydrogen_strain implicit none integer(pInt), parameter :: FILEUNIT = 204_pInt @@ -179,9 +166,6 @@ subroutine constitutive_init() if (any(phase_source == SOURCE_damage_isoDuctile_ID)) call source_damage_isoDuctile_init(FILEUNIT) if (any(phase_source == SOURCE_damage_anisoBrittle_ID)) call source_damage_anisoBrittle_init(FILEUNIT) if (any(phase_source == SOURCE_damage_anisoDuctile_ID)) call source_damage_anisoDuctile_init(FILEUNIT) - if (any(phase_source == SOURCE_vacancy_phenoplasticity_ID)) call source_vacancy_phenoplasticity_init(FILEUNIT) - if (any(phase_source == SOURCE_vacancy_irradiation_ID)) call source_vacancy_irradiation_init(FILEUNIT) - if (any(phase_source == SOURCE_vacancy_thermalfluc_ID)) call source_vacancy_thermalfluc_init(FILEUNIT) !-------------------------------------------------------------------------------------------------- ! parse kinematic mechanisms from config file @@ -189,8 +173,6 @@ subroutine constitutive_init() if (any(phase_kinematics == KINEMATICS_cleavage_opening_ID)) call kinematics_cleavage_opening_init(FILEUNIT) if (any(phase_kinematics == KINEMATICS_slipplane_opening_ID)) call kinematics_slipplane_opening_init(FILEUNIT) if (any(phase_kinematics == KINEMATICS_thermal_expansion_ID)) call kinematics_thermal_expansion_init(FILEUNIT) - if (any(phase_kinematics == KINEMATICS_vacancy_strain_ID)) call kinematics_vacancy_strain_init(FILEUNIT) - if (any(phase_kinematics == KINEMATICS_hydrogen_strain_ID)) call kinematics_hydrogen_strain_init(FILEUNIT) close(FILEUNIT) call config_deallocate('material.config/phase') @@ -283,21 +265,6 @@ subroutine constitutive_init() outputName = SOURCE_damage_anisoDuctile_label thisOutput => source_damage_anisoDuctile_output thisSize => source_damage_anisoDuctile_sizePostResult - case (SOURCE_vacancy_phenoplasticity_ID) sourceType - ins = source_vacancy_phenoplasticity_instance(ph) - outputName = SOURCE_vacancy_phenoplasticity_label - thisOutput => source_vacancy_phenoplasticity_output - thisSize => source_vacancy_phenoplasticity_sizePostResult - case (SOURCE_vacancy_irradiation_ID) sourceType - ins = source_vacancy_irradiation_instance(ph) - outputName = SOURCE_vacancy_irradiation_label - thisOutput => source_vacancy_irradiation_output - thisSize => source_vacancy_irradiation_sizePostResult - case (SOURCE_vacancy_thermalfluc_ID) sourceType - ins = source_vacancy_thermalfluc_instance(ph) - outputName = SOURCE_vacancy_thermalfluc_label - thisOutput => source_vacancy_thermalfluc_output - thisSize => source_vacancy_thermalfluc_sizePostResult case default sourceType knownSource = .false. end select sourceType @@ -577,9 +544,7 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e PLASTICITY_isotropic_ID, & KINEMATICS_cleavage_opening_ID, & KINEMATICS_slipplane_opening_ID, & - KINEMATICS_thermal_expansion_ID, & - KINEMATICS_vacancy_strain_ID, & - KINEMATICS_hydrogen_strain_ID + KINEMATICS_thermal_expansion_ID use plastic_isotropic, only: & plastic_isotropic_LiAndItsTangent use kinematics_cleavage_opening, only: & @@ -588,10 +553,6 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e kinematics_slipplane_opening_LiAndItsTangent use kinematics_thermal_expansion, only: & kinematics_thermal_expansion_LiAndItsTangent - use kinematics_vacancy_strain, only: & - kinematics_vacancy_strain_LiAndItsTangent - use kinematics_hydrogen_strain, only: & - kinematics_hydrogen_strain_LiAndItsTangent implicit none integer(pInt), intent(in) :: & @@ -644,10 +605,6 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e call kinematics_slipplane_opening_LiAndItsTangent(my_Li, my_dLi_dS, S6, ipc, ip, el) case (KINEMATICS_thermal_expansion_ID) kinematicsType call kinematics_thermal_expansion_LiAndItsTangent(my_Li, my_dLi_dS, ipc, ip, el) - case (KINEMATICS_vacancy_strain_ID) kinematicsType - call kinematics_vacancy_strain_LiAndItsTangent(my_Li, my_dLi_dS, ipc, ip, el) - case (KINEMATICS_hydrogen_strain_ID) kinematicsType - call kinematics_hydrogen_strain_LiAndItsTangent(my_Li, my_dLi_dS, ipc, ip, el) case default kinematicsType my_Li = 0.0_pReal my_dLi_dS = 0.0_pReal @@ -684,15 +641,9 @@ pure function constitutive_initialFi(ipc, ip, el) phase_kinematics, & phase_Nkinematics, & material_phase, & - KINEMATICS_thermal_expansion_ID, & - KINEMATICS_vacancy_strain_ID, & - KINEMATICS_hydrogen_strain_ID + KINEMATICS_thermal_expansion_ID use kinematics_thermal_expansion, only: & kinematics_thermal_expansion_initialStrain - use kinematics_vacancy_strain, only: & - kinematics_vacancy_strain_initialStrain - use kinematics_hydrogen_strain, only: & - kinematics_hydrogen_strain_initialStrain implicit none integer(pInt), intent(in) :: & @@ -711,12 +662,6 @@ pure function constitutive_initialFi(ipc, ip, el) case (KINEMATICS_thermal_expansion_ID) kinematicsType constitutive_initialFi = & constitutive_initialFi + kinematics_thermal_expansion_initialStrain(ipc, ip, el) - case (KINEMATICS_vacancy_strain_ID) kinematicsType - constitutive_initialFi = & - constitutive_initialFi + kinematics_vacancy_strain_initialStrain(ipc, ip, el) - case (KINEMATICS_hydrogen_strain_ID) kinematicsType - constitutive_initialFi = & - constitutive_initialFi + kinematics_hydrogen_strain_initialStrain(ipc, ip, el) end select kinematicsType enddo KinematicsLoop @@ -986,19 +931,13 @@ subroutine constitutive_collectDeltaState(S6, Fe, Fi, ipc, ip, el) material_phase, & PLASTICITY_KINEHARDENING_ID, & PLASTICITY_NONLOCAL_ID, & - SOURCE_damage_isoBrittle_ID, & - SOURCE_vacancy_irradiation_ID, & - SOURCE_vacancy_thermalfluc_ID + SOURCE_damage_isoBrittle_ID use plastic_kinehardening, only: & plastic_kinehardening_deltaState use plastic_nonlocal, only: & plastic_nonlocal_deltaState use source_damage_isoBrittle, only: & source_damage_isoBrittle_deltaState - use source_vacancy_irradiation, only: & - source_vacancy_irradiation_deltaState - use source_vacancy_thermalfluc, only: & - source_vacancy_thermalfluc_deltaState implicit none integer(pInt), intent(in) :: & @@ -1035,12 +974,6 @@ subroutine constitutive_collectDeltaState(S6, Fe, Fi, ipc, ip, el) call source_damage_isoBrittle_deltaState (constitutive_homogenizedC(ipc,ip,el), Fe, & ipc, ip, el) - case (SOURCE_vacancy_irradiation_ID) sourceType - call source_vacancy_irradiation_deltaState(ipc, ip, el) - - case (SOURCE_vacancy_thermalfluc_ID) sourceType - call source_vacancy_thermalfluc_deltaState(ipc, ip, el) - end select sourceType enddo SourceLoop From 13f321d992b0f0f4693a1f9c97be8a154561cd96 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 22 Dec 2018 09:00:57 +0100 Subject: [PATCH 121/147] cleaning almost done --- src/CMakeLists.txt | 30 +------- src/CPFEM.f90 | 4 - src/CPFEM2.f90 | 4 - src/commercialFEM_fileList.f90 | 12 --- src/homogenization.f90 | 80 +------------------- src/material.f90 | 124 ++----------------------------- src/source_damage_isoBrittle.f90 | 10 +-- 7 files changed, 15 insertions(+), 249 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e4462243..a84609087 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -90,9 +90,7 @@ list(APPEND OBJECTFILES $) add_library (KINEMATICS OBJECT "kinematics_cleavage_opening.f90" "kinematics_slipplane_opening.f90" - "kinematics_thermal_expansion.f90" - "kinematics_vacancy_strain.f90" - "kinematics_hydrogen_strain.f90") + "kinematics_thermal_expansion.f90") add_dependencies(KINEMATICS DAMASK_HELPERS) list(APPEND OBJECTFILES $) @@ -102,10 +100,7 @@ add_library (SOURCE OBJECT "source_damage_isoBrittle.f90" "source_damage_isoDuctile.f90" "source_damage_anisoBrittle.f90" - "source_damage_anisoDuctile.f90" - "source_vacancy_phenoplasticity.f90" - "source_vacancy_irradiation.f90" - "source_vacancy_thermalfluc.f90") + "source_damage_anisoDuctile.f90") add_dependencies(SOURCE DAMASK_HELPERS) list(APPEND OBJECTFILES $) @@ -124,25 +119,6 @@ add_library(HOMOGENIZATION OBJECT add_dependencies(HOMOGENIZATION CRYSTALLITE) list(APPEND OBJECTFILES $) -add_library(HYDROGENFLUX OBJECT - "hydrogenflux_isoconc.f90" - "hydrogenflux_cahnhilliard.f90") -add_dependencies(HYDROGENFLUX CRYSTALLITE) -list(APPEND OBJECTFILES $) - -add_library(POROSITY OBJECT - "porosity_none.f90" - "porosity_phasefield.f90") -add_dependencies(POROSITY CRYSTALLITE) -list(APPEND OBJECTFILES $) - -add_library(VACANCYFLUX OBJECT - "vacancyflux_isoconc.f90" - "vacancyflux_isochempot.f90" - "vacancyflux_cahnhilliard.f90") -add_dependencies(VACANCYFLUX CRYSTALLITE) -list(APPEND OBJECTFILES $) - add_library(DAMAGE OBJECT "damage_none.f90" "damage_local.f90" @@ -158,7 +134,7 @@ add_dependencies(THERMAL CRYSTALLITE) list(APPEND OBJECTFILES $) add_library(DAMASK_ENGINE OBJECT "homogenization.f90") -add_dependencies(DAMASK_ENGINE THERMAL DAMAGE VACANCYFLUX POROSITY HYDROGENFLUX HOMOGENIZATION) +add_dependencies(DAMASK_ENGINE THERMAL DAMAGE HOMOGENIZATION) list(APPEND OBJECTFILES $) add_library(DAMASK_CPFE OBJECT "CPFEM2.f90") diff --git a/src/CPFEM.f90 b/src/CPFEM.f90 index 674a557b5..847688d57 100644 --- a/src/CPFEM.f90 +++ b/src/CPFEM.f90 @@ -304,8 +304,6 @@ subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt homogState, & thermalState, & damageState, & - vacancyfluxState, & - hydrogenfluxState, & phaseAt, phasememberAt, & material_phase, & phase_plasticity, & @@ -421,8 +419,6 @@ subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt homogState (homog)%state0 = homogState (homog)%state thermalState (homog)%state0 = thermalState (homog)%state damageState (homog)%state0 = damageState (homog)%state - vacancyfluxState (homog)%state0 = vacancyfluxState (homog)%state - hydrogenfluxState(homog)%state0 = hydrogenfluxState(homog)%state enddo diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index 2aed858a7..29e1ac744 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -203,8 +203,6 @@ subroutine CPFEM_age() homogState, & thermalState, & damageState, & - vacancyfluxState, & - hydrogenfluxState, & material_phase, & phase_plasticity, & phase_Nsources @@ -268,8 +266,6 @@ if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0_pInt) & homogState (homog)%state0 = homogState (homog)%state thermalState (homog)%state0 = thermalState (homog)%state damageState (homog)%state0 = damageState (homog)%state - vacancyfluxState (homog)%state0 = vacancyfluxState (homog)%state - hydrogenfluxState(homog)%state0 = hydrogenfluxState(homog)%state enddo if (restartWrite) then diff --git a/src/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 index 36f0244ef..8d3e9c816 100644 --- a/src/commercialFEM_fileList.f90 +++ b/src/commercialFEM_fileList.f90 @@ -21,14 +21,9 @@ #include "source_damage_isoDuctile.f90" #include "source_damage_anisoBrittle.f90" #include "source_damage_anisoDuctile.f90" -#include "source_vacancy_phenoplasticity.f90" -#include "source_vacancy_irradiation.f90" -#include "source_vacancy_thermalfluc.f90" #include "kinematics_cleavage_opening.f90" #include "kinematics_slipplane_opening.f90" #include "kinematics_thermal_expansion.f90" -#include "kinematics_vacancy_strain.f90" -#include "kinematics_hydrogen_strain.f90" #include "plastic_none.f90" #include "plastic_isotropic.f90" #include "plastic_phenopowerlaw.f90" @@ -47,12 +42,5 @@ #include "damage_none.f90" #include "damage_local.f90" #include "damage_nonlocal.f90" -#include "vacancyflux_isoconc.f90" -#include "vacancyflux_isochempot.f90" -#include "vacancyflux_cahnhilliard.f90" -#include "porosity_none.f90" -#include "porosity_phasefield.f90" -#include "hydrogenflux_isoconc.f90" -#include "hydrogenflux_cahnhilliard.f90" #include "homogenization.f90" #include "CPFEM.f90" diff --git a/src/homogenization.f90 b/src/homogenization.f90 index eb002dd60..4663caa9d 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -25,8 +25,7 @@ module homogenization materialpoint_sizeResults, & homogenization_maxSizePostResults, & thermal_maxSizePostResults, & - damage_maxSizePostResults, & - porosity_maxSizePostResults + damage_maxSizePostResults real(pReal), dimension(:,:,:,:), allocatable, private :: & materialpoint_subF0, & !< def grad of IP at beginning of homogenization increment @@ -98,8 +97,6 @@ subroutine homogenization_init use damage_none use damage_local use damage_nonlocal - use porosity_none - use porosity_phasefield use IO use numerics, only: & worldrank @@ -148,14 +145,6 @@ subroutine homogenization_init if (any(damage_type == DAMAGE_nonlocal_ID)) & call damage_nonlocal_init(FILEUNIT) -!-------------------------------------------------------------------------------------------------- -! parse porosity from config file - call IO_checkAndRewind(FILEUNIT) - if (any(porosity_type == POROSITY_none_ID)) & - call porosity_none_init() - if (any(porosity_type == POROSITY_phasefield_ID)) & - call porosity_phasefield_init(FILEUNIT) - !-------------------------------------------------------------------------------------------------- ! write description file for homogenization output mainProcess2: if (worldrank == 0) then @@ -251,30 +240,6 @@ subroutine homogenization_init enddo endif endif - i = porosity_typeInstance(p) ! which instance of this porosity type - valid = .true. ! assume valid - select case(porosity_type(p)) ! split per porosity type - case (POROSITY_none_ID) - outputName = POROSITY_none_label - thisNoutput => null() - thisOutput => null() - thisSize => null() - case (POROSITY_phasefield_ID) - outputName = POROSITY_phasefield_label - thisNoutput => porosity_phasefield_Noutput - thisOutput => porosity_phasefield_output - thisSize => porosity_phasefield_sizePostResult - case default - valid = .false. - end select - if (valid) then - write(FILEUNIT,'(a)') '(porosity)'//char(9)//trim(outputName) - if (porosity_type(p) /= POROSITY_none_ID) then - do e = 1,thisNoutput(i) - write(FILEUNIT,'(a,i4)') trim(thisOutput(e,i))//char(9),thisSize(e,i) - enddo - endif - endif endif enddo close(FILEUNIT) @@ -304,19 +269,16 @@ subroutine homogenization_init homogenization_maxSizePostResults = 0_pInt thermal_maxSizePostResults = 0_pInt damage_maxSizePostResults = 0_pInt - porosity_maxSizePostResults = 0_pInt do p = 1,size(config_homogenization) homogenization_maxSizePostResults = max(homogenization_maxSizePostResults,homogState (p)%sizePostResults) thermal_maxSizePostResults = max(thermal_maxSizePostResults, thermalState (p)%sizePostResults) damage_maxSizePostResults = max(damage_maxSizePostResults ,damageState (p)%sizePostResults) - porosity_maxSizePostResults = max(porosity_maxSizePostResults ,porosityState (p)%sizePostResults) enddo materialpoint_sizeResults = 1 & ! grain count + 1 + homogenization_maxSizePostResults & ! homogSize & homogResult + thermal_maxSizePostResults & + damage_maxSizePostResults & - + porosity_maxSizePostResults & + homogenization_maxNgrains * (1 + crystallite_maxSizePostResults & ! crystallite size & crystallite results + 1 + constitutive_plasticity_maxSizePostResults & ! constitutive size & constitutive results + constitutive_source_maxSizePostResults) @@ -375,7 +337,6 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) homogState, & thermalState, & damageState, & - porosityState, & phase_Nsources, & mappingHomogenization, & phaseAt, phasememberAt, & @@ -482,10 +443,6 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & damageState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal damage state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - porosityState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal porosity state enddo NiterationHomog = 0_pInt @@ -559,10 +516,6 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & damageState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) ! ...internal damage state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - porosityState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e))! ...internal porosity state materialpoint_subF0(1:3,1:3,i,e) = materialpoint_subF(1:3,1:3,i,e) ! ...def grad endif steppingNeeded @@ -626,10 +579,6 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) damageState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & damageState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = & damageState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal damage state - forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - porosityState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - porosityState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = & - porosityState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e))! ...internal porosity state endif endif converged @@ -735,7 +684,6 @@ subroutine materialpoint_postResults homogState, & thermalState, & damageState, & - porosityState, & plasticState, & sourceState, & material_phase, & @@ -764,8 +712,7 @@ subroutine materialpoint_postResults theSize = homogState (mappingHomogenization(2,i,e))%sizePostResults & + thermalState (mappingHomogenization(2,i,e))%sizePostResults & - + damageState (mappingHomogenization(2,i,e))%sizePostResults & - + porosityState (mappingHomogenization(2,i,e))%sizePostResults + + damageState (mappingHomogenization(2,i,e))%sizePostResults materialpoint_results(thePos+1,i,e) = real(theSize,pReal) ! tell size of homogenization results thePos = thePos + 1_pInt @@ -967,11 +914,9 @@ function homogenization_postResults(ip,el) homogState, & thermalState, & damageState, & - porosityState, & homogenization_type, & thermal_type, & damage_type, & - porosity_type, & HOMOGENIZATION_NONE_ID, & HOMOGENIZATION_ISOSTRAIN_ID, & HOMOGENIZATION_RGC_ID, & @@ -980,9 +925,7 @@ function homogenization_postResults(ip,el) THERMAL_conduction_ID, & DAMAGE_none_ID, & DAMAGE_local_ID, & - DAMAGE_nonlocal_ID, & - POROSITY_none_ID, & - POROSITY_phasefield_ID + DAMAGE_nonlocal_ID use homogenization_isostrain, only: & homogenization_isostrain_postResults use homogenization_RGC, only: & @@ -995,8 +938,6 @@ function homogenization_postResults(ip,el) damage_local_postResults use damage_nonlocal, only: & damage_nonlocal_postResults - use porosity_phasefield, only: & - porosity_phasefield_postResults implicit none integer(pInt), intent(in) :: & @@ -1004,8 +945,7 @@ function homogenization_postResults(ip,el) el !< element number real(pReal), dimension( homogState (mappingHomogenization(2,ip,el))%sizePostResults & + thermalState (mappingHomogenization(2,ip,el))%sizePostResults & - + damageState (mappingHomogenization(2,ip,el))%sizePostResults & - + porosityState (mappingHomogenization(2,ip,el))%sizePostResults) :: & + + damageState (mappingHomogenization(2,ip,el))%sizePostResults) :: & homogenization_postResults integer(pInt) :: & startPos, endPos @@ -1060,18 +1000,6 @@ function homogenization_postResults(ip,el) damage_nonlocal_postResults(ip, el) end select chosenDamage - - startPos = endPos + 1_pInt - endPos = endPos + porosityState(mappingHomogenization(2,ip,el))%sizePostResults - chosenPorosity: select case (porosity_type(mesh_element(3,el))) - case (POROSITY_none_ID) chosenPorosity - - case (POROSITY_phasefield_ID) chosenPorosity - homogenization_postResults(startPos:endPos) = & - porosity_phasefield_postResults(ip, el) - end select chosenPorosity - - end function homogenization_postResults end module homogenization diff --git a/src/material.f90 b/src/material.f90 index c9dd28079..e52312c51 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -36,14 +36,9 @@ module material SOURCE_damage_isoDuctile_label = 'damage_isoductile', & SOURCE_damage_anisoBrittle_label = 'damage_anisobrittle', & SOURCE_damage_anisoDuctile_label = 'damage_anisoductile', & - SOURCE_vacancy_phenoplasticity_label = 'vacancy_phenoplasticity', & - SOURCE_vacancy_irradiation_label = 'vacancy_irradiation', & - SOURCE_vacancy_thermalfluc_label = 'vacancy_thermalfluctuation', & KINEMATICS_thermal_expansion_label = 'thermal_expansion', & KINEMATICS_cleavage_opening_label = 'cleavage_opening', & KINEMATICS_slipplane_opening_label = 'slipplane_opening', & - KINEMATICS_vacancy_strain_label = 'vacancy_strain', & - KINEMATICS_hydrogen_strain_label = 'hydrogen_strain', & STIFFNESS_DEGRADATION_damage_label = 'damage', & STIFFNESS_DEGRADATION_porosity_label = 'porosity', & THERMAL_isothermal_label = 'isothermal', & @@ -52,13 +47,8 @@ module material DAMAGE_none_label = 'none', & DAMAGE_local_label = 'local', & DAMAGE_nonlocal_label = 'nonlocal', & - VACANCYFLUX_isoconc_label = 'isoconcentration', & - VACANCYFLUX_isochempot_label = 'isochemicalpotential', & - VACANCYFLUX_cahnhilliard_label = 'cahnhilliard', & POROSITY_none_label = 'none', & POROSITY_phasefield_label = 'phasefield', & - HYDROGENFLUX_isoconc_label = 'isoconcentration', & - HYDROGENFLUX_cahnhilliard_label = 'cahnhilliard', & HOMOGENIZATION_none_label = 'none', & HOMOGENIZATION_isostrain_label = 'isostrain', & HOMOGENIZATION_rgc_label = 'rgc' @@ -87,19 +77,14 @@ module material SOURCE_damage_isoBrittle_ID, & SOURCE_damage_isoDuctile_ID, & SOURCE_damage_anisoBrittle_ID, & - SOURCE_damage_anisoDuctile_ID, & - SOURCE_vacancy_phenoplasticity_ID, & - SOURCE_vacancy_irradiation_ID, & - SOURCE_vacancy_thermalfluc_ID + SOURCE_damage_anisoDuctile_ID end enum enum, bind(c) enumerator :: KINEMATICS_undefined_ID, & KINEMATICS_cleavage_opening_ID, & KINEMATICS_slipplane_opening_ID, & - KINEMATICS_thermal_expansion_ID, & - KINEMATICS_vacancy_strain_ID, & - KINEMATICS_hydrogen_strain_ID + KINEMATICS_thermal_expansion_ID end enum enum, bind(c) @@ -120,20 +105,11 @@ module material DAMAGE_nonlocal_ID end enum - enum, bind(c) - enumerator :: VACANCYFLUX_isoconc_ID, & - VACANCYFLUX_isochempot_ID, & - VACANCYFLUX_cahnhilliard_ID - end enum - enum, bind(c) enumerator :: POROSITY_none_ID, & POROSITY_phasefield_ID end enum - enum, bind(c) - enumerator :: HYDROGENFLUX_isoconc_ID, & - HYDROGENFLUX_cahnhilliard_ID - end enum + enum, bind(c) enumerator :: HOMOGENIZATION_undefined_ID, & @@ -150,12 +126,8 @@ module material thermal_type !< thermal transport model integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & damage_type !< nonlocal damage model - integer(kind(VACANCYFLUX_isoconc_ID)), dimension(:), allocatable, public, protected :: & - vacancyflux_type !< vacancy transport model integer(kind(POROSITY_none_ID)), dimension(:), allocatable, public, protected :: & porosity_type !< porosity evolution model - integer(kind(HYDROGENFLUX_isoconc_ID)), dimension(:), allocatable, public, protected :: & - hydrogenflux_type !< hydrogen transport model integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable, public, protected :: & phase_source, & !< active sources mechanisms of each phase @@ -181,17 +153,13 @@ module material homogenization_typeInstance, & !< instance of particular type of each homogenization thermal_typeInstance, & !< instance of particular type of each thermal transport damage_typeInstance, & !< instance of particular type of each nonlocal damage - vacancyflux_typeInstance, & !< instance of particular type of each vacancy flux porosity_typeInstance, & !< instance of particular type of each porosity model - hydrogenflux_typeInstance, & !< instance of particular type of each hydrogen flux microstructure_crystallite !< crystallite setting ID of each microstructure ! DEPRECATED !!!! real(pReal), dimension(:), allocatable, public, protected :: & thermal_initialT, & !< initial temperature per each homogenization damage_initialPhi, & !< initial damage per each homogenization - vacancyflux_initialCv, & !< initial vacancy concentration per each homogenization - porosity_initialPhi, & !< initial posority per each homogenization - hydrogenflux_initialCh !< initial hydrogen concentration per each homogenization + porosity_initialPhi !< initial posority per each homogenization ! NEW MAPPINGS integer(pInt), dimension(:), allocatable, public, protected :: & @@ -222,9 +190,7 @@ module material homogState, & thermalState, & damageState, & - vacancyfluxState, & - porosityState, & - hydrogenfluxState + porosityState integer(pInt), dimension(:,:,:), allocatable, public, protected :: & material_texture !< texture (index) of each grain,IP,element @@ -275,19 +241,13 @@ module material type(tHomogMapping), allocatable, dimension(:), public :: & thermalMapping, & !< mapping for thermal state/fields damageMapping, & !< mapping for damage state/fields - vacancyfluxMapping, & !< mapping for vacancy conc state/fields - porosityMapping, & !< mapping for porosity state/fields - hydrogenfluxMapping !< mapping for hydrogen conc state/fields + porosityMapping !< mapping for porosity state/fields type(group_float), allocatable, dimension(:), public :: & temperature, & !< temperature field damage, & !< damage field - vacancyConc, & !< vacancy conc field porosity, & !< porosity field - hydrogenConc, & !< hydrogen conc field - temperatureRate, & !< temperature change rate field - vacancyConcRate, & !< vacancy conc change field - hydrogenConcRate !< hydrogen conc change field + temperatureRate !< temperature change rate field public :: & material_init, & @@ -306,14 +266,9 @@ module material SOURCE_damage_isoDuctile_ID, & SOURCE_damage_anisoBrittle_ID, & SOURCE_damage_anisoDuctile_ID, & - SOURCE_vacancy_phenoplasticity_ID, & - SOURCE_vacancy_irradiation_ID, & - SOURCE_vacancy_thermalfluc_ID, & KINEMATICS_cleavage_opening_ID, & KINEMATICS_slipplane_opening_ID, & KINEMATICS_thermal_expansion_ID, & - KINEMATICS_vacancy_strain_ID, & - KINEMATICS_hydrogen_strain_ID, & STIFFNESS_DEGRADATION_damage_ID, & STIFFNESS_DEGRADATION_porosity_ID, & THERMAL_isothermal_ID, & @@ -322,13 +277,8 @@ module material DAMAGE_none_ID, & DAMAGE_local_ID, & DAMAGE_nonlocal_ID, & - VACANCYFLUX_isoconc_ID, & - VACANCYFLUX_isochempot_ID, & - VACANCYFLUX_cahnhilliard_ID, & POROSITY_none_ID, & POROSITY_phasefield_ID, & - HYDROGENFLUX_isoconc_ID, & - HYDROGENFLUX_cahnhilliard_ID, & HOMOGENIZATION_none_ID, & HOMOGENIZATION_isostrain_ID, & HOMOGENIZATION_RGC_ID @@ -420,25 +370,17 @@ subroutine material_init() allocate(homogState (size(config_homogenization))) allocate(thermalState (size(config_homogenization))) allocate(damageState (size(config_homogenization))) - allocate(vacancyfluxState (size(config_homogenization))) allocate(porosityState (size(config_homogenization))) - allocate(hydrogenfluxState (size(config_homogenization))) allocate(thermalMapping (size(config_homogenization))) allocate(damageMapping (size(config_homogenization))) - allocate(vacancyfluxMapping (size(config_homogenization))) allocate(porosityMapping (size(config_homogenization))) - allocate(hydrogenfluxMapping(size(config_homogenization))) allocate(temperature (size(config_homogenization))) allocate(damage (size(config_homogenization))) - allocate(vacancyConc (size(config_homogenization))) allocate(porosity (size(config_homogenization))) - allocate(hydrogenConc (size(config_homogenization))) allocate(temperatureRate (size(config_homogenization))) - allocate(vacancyConcRate (size(config_homogenization))) - allocate(hydrogenConcRate (size(config_homogenization))) do m = 1_pInt,size(config_microstructure) if(microstructure_crystallite(m) < 1_pInt .or. & @@ -511,17 +453,11 @@ subroutine material_init() do myHomog = 1,size(config_homogenization) thermalMapping (myHomog)%p => mappingHomogenizationConst damageMapping (myHomog)%p => mappingHomogenizationConst - vacancyfluxMapping (myHomog)%p => mappingHomogenizationConst porosityMapping (myHomog)%p => mappingHomogenizationConst - hydrogenfluxMapping(myHomog)%p => mappingHomogenizationConst allocate(temperature (myHomog)%p(1), source=thermal_initialT(myHomog)) allocate(damage (myHomog)%p(1), source=damage_initialPhi(myHomog)) - allocate(vacancyConc (myHomog)%p(1), source=vacancyflux_initialCv(myHomog)) allocate(porosity (myHomog)%p(1), source=porosity_initialPhi(myHomog)) - allocate(hydrogenConc (myHomog)%p(1), source=hydrogenflux_initialCh(myHomog)) allocate(temperatureRate (myHomog)%p(1), source=0.0_pReal) - allocate(vacancyConcRate (myHomog)%p(1), source=0.0_pReal) - allocate(hydrogenConcRate(myHomog)%p(1), source=0.0_pReal) enddo end subroutine material_init @@ -545,23 +481,17 @@ subroutine material_parseHomogenization allocate(homogenization_type(size(config_homogenization)), source=HOMOGENIZATION_undefined_ID) allocate(thermal_type(size(config_homogenization)), source=THERMAL_isothermal_ID) allocate(damage_type (size(config_homogenization)), source=DAMAGE_none_ID) - allocate(vacancyflux_type(size(config_homogenization)), source=VACANCYFLUX_isoconc_ID) allocate(porosity_type (size(config_homogenization)), source=POROSITY_none_ID) - allocate(hydrogenflux_type(size(config_homogenization)), source=HYDROGENFLUX_isoconc_ID) allocate(homogenization_typeInstance(size(config_homogenization)), source=0_pInt) allocate(thermal_typeInstance(size(config_homogenization)), source=0_pInt) allocate(damage_typeInstance(size(config_homogenization)), source=0_pInt) - allocate(vacancyflux_typeInstance(size(config_homogenization)), source=0_pInt) allocate(porosity_typeInstance(size(config_homogenization)), source=0_pInt) - allocate(hydrogenflux_typeInstance(size(config_homogenization)), source=0_pInt) allocate(homogenization_Ngrains(size(config_homogenization)), source=0_pInt) allocate(homogenization_Noutput(size(config_homogenization)), source=0_pInt) allocate(homogenization_active(size(config_homogenization)), source=.false.) !!!!!!!!!!!!!!! allocate(thermal_initialT(size(config_homogenization)), source=300.0_pReal) allocate(damage_initialPhi(size(config_homogenization)), source=1.0_pReal) - allocate(vacancyflux_initialCv(size(config_homogenization)), source=0.0_pReal) allocate(porosity_initialPhi(size(config_homogenization)), source=1.0_pReal) - allocate(hydrogenflux_initialCh(size(config_homogenization)), source=0.0_pReal) forall (h = 1_pInt:size(config_homogenization)) & homogenization_active(h) = any(mesh_homogenizationAt == h) @@ -621,22 +551,7 @@ subroutine material_parseHomogenization endif - if (config_homogenization(h)%keyExists('vacancyflux')) then - vacancyflux_initialCv(h) = config_homogenization(h)%getFloat('cv0',defaultVal=0.0_pReal) - tag = config_homogenization(h)%getString('vacancyflux') - select case (trim(tag)) - case(VACANCYFLUX_isoconc_label) - vacancyflux_type(h) = VACANCYFLUX_isoconc_ID - case(VACANCYFLUX_isochempot_label) - vacancyflux_type(h) = VACANCYFLUX_isochempot_ID - case(VACANCYFLUX_cahnhilliard_label) - vacancyflux_type(h) = VACANCYFLUX_cahnhilliard_ID - case default - call IO_error(500_pInt,ext_msg=trim(tag)) - end select - - endif if (config_homogenization(h)%keyExists('porosity')) then !ToDo? @@ -653,20 +568,7 @@ subroutine material_parseHomogenization endif - if (config_homogenization(h)%keyExists('hydrogenflux')) then - hydrogenflux_initialCh(h) = config_homogenization(h)%getFloat('ch0',defaultVal=0.0_pReal) - tag = config_homogenization(h)%getString('hydrogenflux') - select case (trim(tag)) - case(HYDROGENFLUX_isoconc_label) - hydrogenflux_type(h) = HYDROGENFLUX_isoconc_ID - case(HYDROGENFLUX_cahnhilliard_label) - hydrogenflux_type(h) = HYDROGENFLUX_cahnhilliard_ID - case default - call IO_error(500_pInt,ext_msg=trim(tag)) - end select - - endif enddo @@ -674,9 +576,7 @@ subroutine material_parseHomogenization homogenization_typeInstance(h) = count(homogenization_type(1:h) == homogenization_type(h)) thermal_typeInstance(h) = count(thermal_type (1:h) == thermal_type (h)) damage_typeInstance(h) = count(damage_type (1:h) == damage_type (h)) - vacancyflux_typeInstance(h) = count(vacancyflux_type (1:h) == vacancyflux_type (h)) porosity_typeInstance(h) = count(porosity_type (1:h) == porosity_type (h)) - hydrogenflux_typeInstance(h) = count(hydrogenflux_type (1:h) == hydrogenflux_type (h)) enddo homogenization_maxNgrains = maxval(homogenization_Ngrains,homogenization_active) @@ -866,12 +766,6 @@ subroutine material_parsePhase phase_source(sourceCtr,p) = SOURCE_damage_anisoBrittle_ID case (SOURCE_damage_anisoDuctile_label) phase_source(sourceCtr,p) = SOURCE_damage_anisoDuctile_ID - case (SOURCE_vacancy_phenoplasticity_label) - phase_source(sourceCtr,p) = SOURCE_vacancy_phenoplasticity_ID - case (SOURCE_vacancy_irradiation_label) - phase_source(sourceCtr,p) = SOURCE_vacancy_irradiation_ID - case (SOURCE_vacancy_thermalfluc_label) - phase_source(sourceCtr,p) = SOURCE_vacancy_thermalfluc_ID end select enddo @@ -890,10 +784,6 @@ subroutine material_parsePhase phase_kinematics(kinematicsCtr,p) = KINEMATICS_slipplane_opening_ID case (KINEMATICS_thermal_expansion_label) phase_kinematics(kinematicsCtr,p) = KINEMATICS_thermal_expansion_ID - case (KINEMATICS_vacancy_strain_label) - phase_kinematics(kinematicsCtr,p) = KINEMATICS_vacancy_strain_ID - case (KINEMATICS_hydrogen_strain_label) - phase_kinematics(kinematicsCtr,p) = KINEMATICS_hydrogen_strain_ID end select enddo #if defined(__GFORTRAN__) diff --git a/src/source_damage_isoBrittle.f90 b/src/source_damage_isoBrittle.f90 index 041761afe..fe964d134 100644 --- a/src/source_damage_isoBrittle.f90 +++ b/src/source_damage_isoBrittle.f90 @@ -279,15 +279,7 @@ subroutine source_damage_isoBrittle_deltaState(C, Fe, ipc, ip, el) instance = source_damage_isoBrittle_instance(phase) !< instance of damage_isoBrittle source sourceOffset = source_damage_isoBrittle_offset(phase) - stiffness = C - do mech = 1_pInt, phase_NstiffnessDegradations(phase) - select case(phase_stiffnessDegradation(mech,phase)) - case (STIFFNESS_DEGRADATION_porosity_ID) - stiffness = porosity(material_homog(ip,el))%p(porosityMapping(material_homog(ip,el))%p(ip,el))* & - porosity(material_homog(ip,el))%p(porosityMapping(material_homog(ip,el))%p(ip,el))* & - stiffness - end select - enddo + stiffness = C strain = 0.5_pReal*math_Mandel33to6(math_mul33x33(math_transpose33(Fe),Fe)-math_I3) strainenergy = 2.0_pReal*sum(strain*math_mul66x6(stiffness,strain))/ & From ed79c7f75c9777c92f75838181fcf4a81377a53a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 10:41:11 +0100 Subject: [PATCH 122/147] all not compatible with new structure --- src/constitutive.f90 | 7 +- src/hydrogenflux_cahnhilliard.f90 | 508 --------------------- src/hydrogenflux_isoconc.f90 | 62 --- src/kinematics_hydrogen_strain.f90 | 263 ----------- src/kinematics_vacancy_strain.f90 | 264 ----------- src/material.f90 | 58 +-- src/porosity_none.f90 | 60 --- src/porosity_phasefield.f90 | 448 ------------------ src/source_damage_isoBrittle.f90 | 5 +- src/source_vacancy_irradiation.f90 | 248 ---------- src/source_vacancy_phenoplasticity.f90 | 210 --------- src/source_vacancy_thermalfluc.f90 | 250 ---------- src/vacancyflux_cahnhilliard.f90 | 602 ------------------------- src/vacancyflux_isochempot.f90 | 328 -------------- src/vacancyflux_isoconc.f90 | 62 --- 15 files changed, 6 insertions(+), 3369 deletions(-) delete mode 100644 src/hydrogenflux_cahnhilliard.f90 delete mode 100644 src/hydrogenflux_isoconc.f90 delete mode 100644 src/kinematics_hydrogen_strain.f90 delete mode 100644 src/kinematics_vacancy_strain.f90 delete mode 100644 src/porosity_none.f90 delete mode 100644 src/porosity_phasefield.f90 delete mode 100644 src/source_vacancy_irradiation.f90 delete mode 100644 src/source_vacancy_phenoplasticity.f90 delete mode 100644 src/source_vacancy_thermalfluc.f90 delete mode 100644 src/vacancyflux_cahnhilliard.f90 delete mode 100644 src/vacancyflux_isochempot.f90 delete mode 100644 src/vacancyflux_isoconc.f90 diff --git a/src/constitutive.f90 b/src/constitutive.f90 index 040f3c39e..ce98ced36 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -716,10 +716,7 @@ subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, Fe, Fi, ipc, ip phase_stiffnessDegradation, & damage, & damageMapping, & - porosity, & - porosityMapping, & - STIFFNESS_DEGRADATION_damage_ID, & - STIFFNESS_DEGRADATION_porosity_ID + STIFFNESS_DEGRADATION_damage_ID implicit none integer(pInt), intent(in) :: & @@ -749,8 +746,6 @@ subroutine constitutive_hooke_SandItsTangents(S, dS_dFe, dS_dFi, Fe, Fi, ipc, ip degradationType: select case(phase_stiffnessDegradation(d,material_phase(ipc,ip,el))) case (STIFFNESS_DEGRADATION_damage_ID) degradationType C = C * damage(ho)%p(damageMapping(ho)%p(ip,el))**2_pInt - case (STIFFNESS_DEGRADATION_porosity_ID) degradationType - C = C * porosity(ho)%p(porosityMapping(ho)%p(ip,el))**2_pInt end select degradationType enddo DegradationLoop diff --git a/src/hydrogenflux_cahnhilliard.f90 b/src/hydrogenflux_cahnhilliard.f90 deleted file mode 100644 index 3a42a49e1..000000000 --- a/src/hydrogenflux_cahnhilliard.f90 +++ /dev/null @@ -1,508 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for conservative transport of solute hydrogen -!> @details to be done -!-------------------------------------------------------------------------------------------------- -module hydrogenflux_cahnhilliard - use prec, only: & - pReal, & - pInt - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - hydrogenflux_cahnhilliard_sizePostResults !< cumulative size of post results - - integer(pInt), dimension(:,:), allocatable, target, public :: & - hydrogenflux_cahnhilliard_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - hydrogenflux_cahnhilliard_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - hydrogenflux_cahnhilliard_Noutput !< number of outputs per instance of this damage - - real(pReal), parameter, private :: & - kB = 1.3806488e-23_pReal !< Boltzmann constant in J/Kelvin - - enum, bind(c) - enumerator :: undefined_ID, & - hydrogenConc_ID - end enum - integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & - hydrogenflux_cahnhilliard_outputID !< ID of each post result output - - - public :: & - hydrogenflux_cahnhilliard_init, & - hydrogenflux_cahnhilliard_getMobility33, & - hydrogenflux_cahnhilliard_getDiffusion33, & - hydrogenflux_cahnhilliard_getFormationEnergy, & - hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent, & - hydrogenflux_cahnhilliard_getChemPotAndItsTangent, & - hydrogenflux_cahnhilliard_putHydrogenConcAndItsRate, & - hydrogenflux_cahnhilliard_postResults - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine hydrogenflux_cahnhilliard_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use material, only: & - hydrogenflux_type, & - hydrogenflux_typeInstance, & - homogenization_Noutput, & - HYDROGENFLUX_cahnhilliard_label, & - HYDROGENFLUX_cahnhilliard_ID, & - material_homog, & - mappingHomogenization, & - hydrogenfluxState, & - hydrogenfluxMapping, & - hydrogenConc, & - hydrogenConcRate, & - hydrogenflux_initialCh - use config, only: & - material_partHomogenization, & - material_partPhase - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o - integer(pInt) :: sizeState - integer(pInt) :: NofMyHomog - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- hydrogenflux_'//HYDROGENFLUX_cahnhilliard_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(hydrogenflux_type == HYDROGENFLUX_cahnhilliard_ID),pInt) - if (maxNinstance == 0_pInt) return - - allocate(hydrogenflux_cahnhilliard_sizePostResults(maxNinstance), source=0_pInt) - allocate(hydrogenflux_cahnhilliard_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0_pInt) - allocate(hydrogenflux_cahnhilliard_output (maxval(homogenization_Noutput),maxNinstance)) - hydrogenflux_cahnhilliard_output = '' - allocate(hydrogenflux_cahnhilliard_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID) - allocate(hydrogenflux_cahnhilliard_Noutput (maxNinstance), source=0_pInt) - - rewind(fileUnit) - section = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to - line = IO_read(fileUnit) - enddo - - parsingHomog: do while (trim(line) /= IO_EOF) ! read through sections of homog part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next homog section - section = section + 1_pInt ! advance homog section counter - cycle ! skip to next line - endif - - if (section > 0_pInt ) then; if (hydrogenflux_type(section) == HYDROGENFLUX_cahnhilliard_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - - instance = hydrogenflux_typeInstance(section) ! which instance of my hydrogenflux is present homog - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('(output)') - select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt))) - case ('hydrogenconc') - hydrogenflux_cahnhilliard_Noutput(instance) = hydrogenflux_cahnhilliard_Noutput(instance) + 1_pInt - hydrogenflux_cahnhilliard_outputID(hydrogenflux_cahnhilliard_Noutput(instance),instance) = hydrogenConc_ID - hydrogenflux_cahnhilliard_output(hydrogenflux_cahnhilliard_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - end select - - end select - endif; endif - enddo parsingHomog - - rewind(fileUnit) - section = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partPhase) ! wind forward to - line = IO_read(fileUnit) - enddo - - initializeInstances: do section = 1_pInt, size(hydrogenflux_type) - if (hydrogenflux_type(section) == HYDROGENFLUX_cahnhilliard_ID) then - NofMyHomog=count(material_homog==section) - instance = hydrogenflux_typeInstance(section) - -!-------------------------------------------------------------------------------------------------- -! Determine size of postResults array - outputsLoop: do o = 1_pInt,hydrogenflux_cahnhilliard_Noutput(instance) - select case(hydrogenflux_cahnhilliard_outputID(o,instance)) - case(hydrogenConc_ID) - mySize = 1_pInt - end select - - if (mySize > 0_pInt) then ! any meaningful output found - hydrogenflux_cahnhilliard_sizePostResult(o,instance) = mySize - hydrogenflux_cahnhilliard_sizePostResults(instance) = hydrogenflux_cahnhilliard_sizePostResults(instance) + mySize - endif - enddo outputsLoop - -! allocate state arrays - sizeState = 0_pInt - hydrogenfluxState(section)%sizeState = sizeState - hydrogenfluxState(section)%sizePostResults = hydrogenflux_cahnhilliard_sizePostResults(instance) - allocate(hydrogenfluxState(section)%state0 (sizeState,NofMyHomog)) - allocate(hydrogenfluxState(section)%subState0(sizeState,NofMyHomog)) - allocate(hydrogenfluxState(section)%state (sizeState,NofMyHomog)) - - nullify(hydrogenfluxMapping(section)%p) - hydrogenfluxMapping(section)%p => mappingHomogenization(1,:,:) - deallocate(hydrogenConc (section)%p) - deallocate(hydrogenConcRate(section)%p) - allocate (hydrogenConc (section)%p(NofMyHomog), source=hydrogenflux_initialCh(section)) - allocate (hydrogenConcRate(section)%p(NofMyHomog), source=0.0_pReal) - - endif - - enddo initializeInstances - -end subroutine hydrogenflux_cahnhilliard_init - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized solute mobility tensor in reference configuration -!-------------------------------------------------------------------------------------------------- -function hydrogenflux_cahnhilliard_getMobility33(ip,el) - use lattice, only: & - lattice_hydrogenfluxMobility33 - use material, only: & - homogenization_Ngrains, & - material_phase - use mesh, only: & - mesh_element - use crystallite, only: & - crystallite_push33ToRef - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), dimension(3,3) :: & - hydrogenflux_cahnhilliard_getMobility33 - integer(pInt) :: & - grain - - hydrogenflux_cahnhilliard_getMobility33 = 0.0_pReal - do grain = 1, homogenization_Ngrains(mesh_element(3,el)) - hydrogenflux_cahnhilliard_getMobility33 = hydrogenflux_cahnhilliard_getMobility33 + & - crystallite_push33ToRef(grain,ip,el,lattice_hydrogenfluxMobility33(:,:,material_phase(grain,ip,el))) - enddo - - hydrogenflux_cahnhilliard_getMobility33 = & - hydrogenflux_cahnhilliard_getMobility33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function hydrogenflux_cahnhilliard_getMobility33 - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized solute nonlocal diffusion tensor in reference configuration -!-------------------------------------------------------------------------------------------------- -function hydrogenflux_cahnhilliard_getDiffusion33(ip,el) - use lattice, only: & - lattice_hydrogenfluxDiffusion33 - use material, only: & - homogenization_Ngrains, & - material_phase - use mesh, only: & - mesh_element - use crystallite, only: & - crystallite_push33ToRef - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), dimension(3,3) :: & - hydrogenflux_cahnhilliard_getDiffusion33 - integer(pInt) :: & - grain - - hydrogenflux_cahnhilliard_getDiffusion33 = 0.0_pReal - do grain = 1, homogenization_Ngrains(mesh_element(3,el)) - hydrogenflux_cahnhilliard_getDiffusion33 = hydrogenflux_cahnhilliard_getDiffusion33 + & - crystallite_push33ToRef(grain,ip,el,lattice_hydrogenfluxDiffusion33(:,:,material_phase(grain,ip,el))) - enddo - - hydrogenflux_cahnhilliard_getDiffusion33 = & - hydrogenflux_cahnhilliard_getDiffusion33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function hydrogenflux_cahnhilliard_getDiffusion33 - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized solution energy -!-------------------------------------------------------------------------------------------------- -function hydrogenflux_cahnhilliard_getFormationEnergy(ip,el) - use lattice, only: & - lattice_hydrogenFormationEnergy, & - lattice_hydrogenVol, & - lattice_hydrogenSurfaceEnergy - use material, only: & - homogenization_Ngrains, & - material_phase - use mesh, only: & - mesh_element - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal) :: & - hydrogenflux_cahnhilliard_getFormationEnergy - integer(pInt) :: & - grain - - hydrogenflux_cahnhilliard_getFormationEnergy = 0.0_pReal - do grain = 1, homogenization_Ngrains(mesh_element(3,el)) - hydrogenflux_cahnhilliard_getFormationEnergy = hydrogenflux_cahnhilliard_getFormationEnergy + & - lattice_hydrogenFormationEnergy(material_phase(grain,ip,el))/ & - lattice_hydrogenVol(material_phase(grain,ip,el))/ & - lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el)) - enddo - - hydrogenflux_cahnhilliard_getFormationEnergy = & - hydrogenflux_cahnhilliard_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function hydrogenflux_cahnhilliard_getFormationEnergy - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized hydrogen entropy coefficient -!-------------------------------------------------------------------------------------------------- -function hydrogenflux_cahnhilliard_getEntropicCoeff(ip,el) - use lattice, only: & - lattice_hydrogenVol, & - lattice_hydrogenSurfaceEnergy - use material, only: & - homogenization_Ngrains, & - material_homog, & - material_phase, & - temperature, & - thermalMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal) :: & - hydrogenflux_cahnhilliard_getEntropicCoeff - integer(pInt) :: & - grain - - hydrogenflux_cahnhilliard_getEntropicCoeff = 0.0_pReal - do grain = 1, homogenization_Ngrains(material_homog(ip,el)) - hydrogenflux_cahnhilliard_getEntropicCoeff = hydrogenflux_cahnhilliard_getEntropicCoeff + & - kB/ & - lattice_hydrogenVol(material_phase(grain,ip,el))/ & - lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el)) - enddo - - hydrogenflux_cahnhilliard_getEntropicCoeff = hydrogenflux_cahnhilliard_getEntropicCoeff* & - temperature(material_homog(ip,el))%p(thermalMapping(material_homog(ip,el))%p(ip,el))/ & - real(homogenization_Ngrains(material_homog(ip,el)),pReal) - -end function hydrogenflux_cahnhilliard_getEntropicCoeff - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized kinematic contribution to chemical potential -!-------------------------------------------------------------------------------------------------- -subroutine hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dCh, Ch, ip, el) - use lattice, only: & - lattice_hydrogenSurfaceEnergy - use material, only: & - homogenization_Ngrains, & - material_homog, & - phase_kinematics, & - phase_Nkinematics, & - material_phase, & - KINEMATICS_hydrogen_strain_ID - use crystallite, only: & - crystallite_Tstar_v, & - crystallite_Fi0, & - crystallite_Fi - use kinematics_hydrogen_strain, only: & - kinematics_hydrogen_strain_ChemPotAndItsTangent - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - Ch - real(pReal), intent(out) :: & - KPot, dKPot_dCh - real(pReal) :: & - my_KPot, my_dKPot_dCh - integer(pInt) :: & - grain, kinematics - - KPot = 0.0_pReal - dKPot_dCh = 0.0_pReal - do grain = 1_pInt,homogenization_Ngrains(material_homog(ip,el)) - do kinematics = 1_pInt, phase_Nkinematics(material_phase(grain,ip,el)) - select case (phase_kinematics(kinematics,material_phase(grain,ip,el))) - case (KINEMATICS_hydrogen_strain_ID) - call kinematics_hydrogen_strain_ChemPotAndItsTangent(my_KPot, my_dKPot_dCh, & - crystallite_Tstar_v(1:6,grain,ip,el), & - crystallite_Fi0(1:3,1:3,grain,ip,el), & - crystallite_Fi (1:3,1:3,grain,ip,el), & - grain,ip, el) - - case default - my_KPot = 0.0_pReal - my_dKPot_dCh = 0.0_pReal - - end select - KPot = KPot + my_KPot/lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el)) - dKPot_dCh = dKPot_dCh + my_dKPot_dCh/lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el)) - enddo - enddo - - KPot = KPot/real(homogenization_Ngrains(material_homog(ip,el)),pReal) - dKPot_dCh = dKPot_dCh/real(homogenization_Ngrains(material_homog(ip,el)),pReal) - -end subroutine hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized chemical potential -!-------------------------------------------------------------------------------------------------- -subroutine hydrogenflux_cahnhilliard_getChemPotAndItsTangent(ChemPot,dChemPot_dCh,Ch,ip,el) - use numerics, only: & - hydrogenBoundPenalty, & - hydrogenPolyOrder - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - Ch - real(pReal), intent(out) :: & - ChemPot, & - dChemPot_dCh - real(pReal) :: & - kBT, KPot, dKPot_dCh - integer(pInt) :: & - o - - ChemPot = hydrogenflux_cahnhilliard_getFormationEnergy(ip,el) - dChemPot_dCh = 0.0_pReal - kBT = hydrogenflux_cahnhilliard_getEntropicCoeff(ip,el) - do o = 1_pInt, hydrogenPolyOrder - ChemPot = ChemPot + kBT*((2.0_pReal*Ch - 1.0_pReal)**real(2_pInt*o-1_pInt,pReal))/ & - real(2_pInt*o-1_pInt,pReal) - dChemPot_dCh = dChemPot_dCh + 2.0_pReal*kBT*(2.0_pReal*Ch - 1.0_pReal)**real(2_pInt*o-2_pInt,pReal) - enddo - - call hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dCh, Ch, ip, el) - ChemPot = ChemPot + KPot - dChemPot_dCh = dChemPot_dCh + dKPot_dCh - - if (Ch < 0.0_pReal) then - ChemPot = ChemPot - 3.0_pReal*hydrogenBoundPenalty*Ch*Ch - dChemPot_dCh = dChemPot_dCh - 6.0_pReal*hydrogenBoundPenalty*Ch - elseif (Ch > 1.0_pReal) then - ChemPot = ChemPot + 3.0_pReal*hydrogenBoundPenalty*(1.0_pReal - Ch)*(1.0_pReal - Ch) - dChemPot_dCh = dChemPot_dCh - 6.0_pReal*hydrogenBoundPenalty*(1.0_pReal - Ch) - endif - -end subroutine hydrogenflux_cahnhilliard_getChemPotAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief updates hydrogen concentration with solution from Cahn-Hilliard PDE for solute transport -!-------------------------------------------------------------------------------------------------- -subroutine hydrogenflux_cahnhilliard_putHydrogenConcAndItsRate(Ch,Chdot,ip,el) - use material, only: & - mappingHomogenization, & - hydrogenConc, & - hydrogenConcRate, & - hydrogenfluxMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - Ch, & - Chdot - integer(pInt) :: & - homog, & - offset - - homog = mappingHomogenization(2,ip,el) - offset = hydrogenfluxMapping(homog)%p(ip,el) - hydrogenConc (homog)%p(offset) = Ch - hydrogenConcRate(homog)%p(offset) = Chdot - -end subroutine hydrogenflux_cahnhilliard_putHydrogenConcAndItsRate - -!-------------------------------------------------------------------------------------------------- -!> @brief return array of hydrogen transport results -!-------------------------------------------------------------------------------------------------- -function hydrogenflux_cahnhilliard_postResults(ip,el) - use material, only: & - mappingHomogenization, & - hydrogenflux_typeInstance, & - hydrogenConc, & - hydrogenfluxMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point - el !< element - real(pReal), dimension(hydrogenflux_cahnhilliard_sizePostResults(hydrogenflux_typeInstance(mappingHomogenization(2,ip,el)))) :: & - hydrogenflux_cahnhilliard_postResults - - integer(pInt) :: & - instance, homog, offset, o, c - - homog = mappingHomogenization(2,ip,el) - offset = hydrogenfluxMapping(homog)%p(ip,el) - instance = hydrogenflux_typeInstance(homog) - - c = 0_pInt - hydrogenflux_cahnhilliard_postResults = 0.0_pReal - - do o = 1_pInt,hydrogenflux_cahnhilliard_Noutput(instance) - select case(hydrogenflux_cahnhilliard_outputID(o,instance)) - - case (hydrogenConc_ID) - hydrogenflux_cahnhilliard_postResults(c+1_pInt) = hydrogenConc(homog)%p(offset) - c = c + 1 - end select - enddo -end function hydrogenflux_cahnhilliard_postResults - -end module hydrogenflux_cahnhilliard diff --git a/src/hydrogenflux_isoconc.f90 b/src/hydrogenflux_isoconc.f90 deleted file mode 100644 index 836d29198..000000000 --- a/src/hydrogenflux_isoconc.f90 +++ /dev/null @@ -1,62 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for constant hydrogen concentration -!-------------------------------------------------------------------------------------------------- -module hydrogenflux_isoconc - - implicit none - private - - public :: & - hydrogenflux_isoconc_init - -contains - -!-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields, reads information from material configuration file -!-------------------------------------------------------------------------------------------------- -subroutine hydrogenflux_isoconc_init() -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use prec, only: & - pReal, & - pInt - use IO, only: & - IO_timeStamp - use material - use config - - implicit none - integer(pInt) :: & - homog, & - NofMyHomog - - write(6,'(/,a)') ' <<<+- hydrogenflux_'//HYDROGENFLUX_isoconc_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - initializeInstances: do homog = 1_pInt, material_Nhomogenization - - myhomog: if (hydrogenflux_type(homog) == HYDROGENFLUX_isoconc_ID) then - NofMyHomog = count(material_homog == homog) - hydrogenfluxState(homog)%sizeState = 0_pInt - hydrogenfluxState(homog)%sizePostResults = 0_pInt - allocate(hydrogenfluxState(homog)%state0 (0_pInt,NofMyHomog), source=0.0_pReal) - allocate(hydrogenfluxState(homog)%subState0(0_pInt,NofMyHomog), source=0.0_pReal) - allocate(hydrogenfluxState(homog)%state (0_pInt,NofMyHomog), source=0.0_pReal) - - deallocate(hydrogenConc (homog)%p) - deallocate(hydrogenConcRate(homog)%p) - allocate (hydrogenConc (homog)%p(1), source=hydrogenflux_initialCh(homog)) - allocate (hydrogenConcRate(homog)%p(1), source=0.0_pReal) - - endif myhomog - enddo initializeInstances - - -end subroutine hydrogenflux_isoconc_init - -end module hydrogenflux_isoconc diff --git a/src/kinematics_hydrogen_strain.f90 b/src/kinematics_hydrogen_strain.f90 deleted file mode 100644 index 516ca286f..000000000 --- a/src/kinematics_hydrogen_strain.f90 +++ /dev/null @@ -1,263 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine incorporating kinematics resulting from interstitial hydrogen -!> @details to be done -!-------------------------------------------------------------------------------------------------- -module kinematics_hydrogen_strain - use prec, only: & - pReal, & - pInt - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - kinematics_hydrogen_strain_sizePostResults, & !< cumulative size of post results - kinematics_hydrogen_strain_offset, & !< which kinematics is my current damage mechanism? - kinematics_hydrogen_strain_instance !< instance of damage kinematics mechanism - - integer(pInt), dimension(:,:), allocatable, target, public :: & - kinematics_hydrogen_strain_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - kinematics_hydrogen_strain_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - kinematics_hydrogen_strain_Noutput !< number of outputs per instance of this damage - - real(pReal), dimension(:), allocatable, private :: & - kinematics_hydrogen_strain_coeff - - public :: & - kinematics_hydrogen_strain_init, & - kinematics_hydrogen_strain_initialStrain, & - kinematics_hydrogen_strain_LiAndItsTangent, & - kinematics_hydrogen_strain_ChemPotAndItsTangent - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine kinematics_hydrogen_strain_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use debug, only: & - debug_level,& - debug_constitutive,& - debug_levelBasic - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use material, only: & - phase_kinematics, & - phase_Nkinematics, & - phase_Noutput, & - KINEMATICS_hydrogen_strain_label, & - KINEMATICS_hydrogen_strain_ID - use config, only: & - material_Nphase, & - MATERIAL_partPhase - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,phase,instance,kinematics - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_hydrogen_strain_LABEL//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(phase_kinematics == KINEMATICS_hydrogen_strain_ID),pInt) - if (maxNinstance == 0_pInt) return - - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance - - allocate(kinematics_hydrogen_strain_offset(material_Nphase), source=0_pInt) - allocate(kinematics_hydrogen_strain_instance(material_Nphase), source=0_pInt) - do phase = 1, material_Nphase - kinematics_hydrogen_strain_instance(phase) = count(phase_kinematics(:,1:phase) == kinematics_hydrogen_strain_ID) - do kinematics = 1, phase_Nkinematics(phase) - if (phase_kinematics(kinematics,phase) == kinematics_hydrogen_strain_ID) & - kinematics_hydrogen_strain_offset(phase) = kinematics - enddo - enddo - - allocate(kinematics_hydrogen_strain_sizePostResults(maxNinstance), source=0_pInt) - allocate(kinematics_hydrogen_strain_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) - allocate(kinematics_hydrogen_strain_output(maxval(phase_Noutput),maxNinstance)) - kinematics_hydrogen_strain_output = '' - allocate(kinematics_hydrogen_strain_Noutput(maxNinstance), source=0_pInt) - allocate(kinematics_hydrogen_strain_coeff(maxNinstance), source=0.0_pReal) - - rewind(fileUnit) - phase = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to - line = IO_read(fileUnit) - enddo - - parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next phase section - phase = phase + 1_pInt ! advance phase section counter - cycle ! skip to next line - endif - if (phase > 0_pInt ) then; if (any(phase_kinematics(:,phase) == KINEMATICS_hydrogen_strain_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - instance = kinematics_hydrogen_strain_instance(phase) ! which instance of my damage is present phase - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('hydrogen_strain_coeff') - kinematics_hydrogen_strain_coeff(instance) = IO_floatValue(line,chunkPos,2_pInt) - - end select - endif; endif - enddo parsingFile - -end subroutine kinematics_hydrogen_strain_init - -!-------------------------------------------------------------------------------------------------- -!> @brief report initial hydrogen strain based on current hydrogen conc deviation from -!> equillibrium (0) -!-------------------------------------------------------------------------------------------------- -pure function kinematics_hydrogen_strain_initialStrain(ipc, ip, el) - use math, only: & - math_I3 - use material, only: & - material_phase, & - material_homog, & - hydrogenConc, & - hydrogenfluxMapping - use lattice, only: & - lattice_equilibriumHydrogenConcentration - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), dimension(3,3) :: & - kinematics_hydrogen_strain_initialStrain !< initial thermal strain (should be small strain, though) - integer(pInt) :: & - phase, & - homog, offset, instance - - phase = material_phase(ipc,ip,el) - instance = kinematics_hydrogen_strain_instance(phase) - homog = material_homog(ip,el) - offset = hydrogenfluxMapping(homog)%p(ip,el) - - kinematics_hydrogen_strain_initialStrain = & - (hydrogenConc(homog)%p(offset) - lattice_equilibriumHydrogenConcentration(phase)) * & - kinematics_hydrogen_strain_coeff(instance)* math_I3 - -end function kinematics_hydrogen_strain_initialStrain - -!-------------------------------------------------------------------------------------------------- -!> @brief contains the constitutive equation for calculating the velocity gradient -!-------------------------------------------------------------------------------------------------- -subroutine kinematics_hydrogen_strain_LiAndItsTangent(Li, dLi_dTstar3333, ipc, ip, el) - use material, only: & - material_phase, & - material_homog, & - hydrogenConc, & - hydrogenConcRate, & - hydrogenfluxMapping - use math, only: & - math_I3 - use lattice, only: & - lattice_equilibriumHydrogenConcentration - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), intent(out), dimension(3,3) :: & - Li !< thermal velocity gradient - real(pReal), intent(out), dimension(3,3,3,3) :: & - dLi_dTstar3333 !< derivative of Li with respect to Tstar (4th-order tensor) - integer(pInt) :: & - phase, & - instance, & - homog, offset - real(pReal) :: & - Ch, ChEq, ChDot - - phase = material_phase(ipc,ip,el) - instance = kinematics_hydrogen_strain_instance(phase) - homog = material_homog(ip,el) - offset = hydrogenfluxMapping(homog)%p(ip,el) - Ch = hydrogenConc(homog)%p(offset) - ChDot = hydrogenConcRate(homog)%p(offset) - ChEq = lattice_equilibriumHydrogenConcentration(phase) - - Li = ChDot*math_I3* & - kinematics_hydrogen_strain_coeff(instance)/ & - (1.0_pReal + kinematics_hydrogen_strain_coeff(instance)*(Ch - ChEq)) - dLi_dTstar3333 = 0.0_pReal - -end subroutine kinematics_hydrogen_strain_LiAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief contains the kinematic contribution to hydrogen chemical potential -!-------------------------------------------------------------------------------------------------- -subroutine kinematics_hydrogen_strain_ChemPotAndItsTangent(ChemPot, dChemPot_dCh, Tstar_v, Fi0, Fi, ipc, ip, el) - use material, only: & - material_phase - use math, only: & - math_inv33, & - math_mul33x33, & - math_Mandel6to33, & - math_transpose33 - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), intent(in), dimension(6) :: & - Tstar_v - real(pReal), intent(in), dimension(3,3) :: & - Fi0, Fi - real(pReal), intent(out) :: & - ChemPot, dChemPot_dCh - integer(pInt) :: & - phase, & - instance - - phase = material_phase(ipc,ip,el) - instance = kinematics_hydrogen_strain_instance(phase) - - ChemPot = -kinematics_hydrogen_strain_coeff(instance)* & - sum(math_mul33x33(Fi,math_Mandel6to33(Tstar_v))* & - math_mul33x33(math_mul33x33(Fi,math_inv33(Fi0)),Fi)) - dChemPot_dCh = 0.0_pReal - -end subroutine kinematics_hydrogen_strain_ChemPotAndItsTangent - -end module kinematics_hydrogen_strain diff --git a/src/kinematics_vacancy_strain.f90 b/src/kinematics_vacancy_strain.f90 deleted file mode 100644 index 7ecc7fe6e..000000000 --- a/src/kinematics_vacancy_strain.f90 +++ /dev/null @@ -1,264 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine incorporating kinematics resulting from vacancy point defects -!> @details to be done -!-------------------------------------------------------------------------------------------------- -module kinematics_vacancy_strain - use prec, only: & - pReal, & - pInt - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - kinematics_vacancy_strain_sizePostResults, & !< cumulative size of post results - kinematics_vacancy_strain_offset, & !< which kinematics is my current damage mechanism? - kinematics_vacancy_strain_instance !< instance of damage kinematics mechanism - - integer(pInt), dimension(:,:), allocatable, target, public :: & - kinematics_vacancy_strain_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - kinematics_vacancy_strain_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - kinematics_vacancy_strain_Noutput !< number of outputs per instance of this damage - - real(pReal), dimension(:), allocatable, private :: & - kinematics_vacancy_strain_coeff - - public :: & - kinematics_vacancy_strain_init, & - kinematics_vacancy_strain_initialStrain, & - kinematics_vacancy_strain_LiAndItsTangent, & - kinematics_vacancy_strain_ChemPotAndItsTangent - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine kinematics_vacancy_strain_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use debug, only: & - debug_level,& - debug_constitutive,& - debug_levelBasic - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use material, only: & - phase_kinematics, & - phase_Nkinematics, & - phase_Noutput, & - KINEMATICS_vacancy_strain_label, & - KINEMATICS_vacancy_strain_ID - use config, only: & - material_Nphase, & - MATERIAL_partPhase - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,phase,instance,kinematics - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_vacancy_strain_LABEL//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(phase_kinematics == KINEMATICS_vacancy_strain_ID),pInt) - if (maxNinstance == 0_pInt) return - - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance - - allocate(kinematics_vacancy_strain_offset(material_Nphase), source=0_pInt) - allocate(kinematics_vacancy_strain_instance(material_Nphase), source=0_pInt) - do phase = 1, material_Nphase - kinematics_vacancy_strain_instance(phase) = count(phase_kinematics(:,1:phase) == kinematics_vacancy_strain_ID) - do kinematics = 1, phase_Nkinematics(phase) - if (phase_kinematics(kinematics,phase) == kinematics_vacancy_strain_ID) & - kinematics_vacancy_strain_offset(phase) = kinematics - enddo - enddo - - allocate(kinematics_vacancy_strain_sizePostResults(maxNinstance), source=0_pInt) - allocate(kinematics_vacancy_strain_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) - allocate(kinematics_vacancy_strain_output(maxval(phase_Noutput),maxNinstance)) - kinematics_vacancy_strain_output = '' - allocate(kinematics_vacancy_strain_Noutput(maxNinstance), source=0_pInt) - allocate(kinematics_vacancy_strain_coeff(maxNinstance), source=0.0_pReal) - - rewind(fileUnit) - phase = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to - line = IO_read(fileUnit) - enddo - - parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next phase section - phase = phase + 1_pInt ! advance phase section counter - cycle ! skip to next line - endif - if (phase > 0_pInt ) then; if (any(phase_kinematics(:,phase) == KINEMATICS_vacancy_strain_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - instance = kinematics_vacancy_strain_instance(phase) ! which instance of my damage is present phase - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('vacancy_strain_coeff') - kinematics_vacancy_strain_coeff(instance) = IO_floatValue(line,chunkPos,2_pInt) - - end select - endif; endif - enddo parsingFile - -end subroutine kinematics_vacancy_strain_init - -!-------------------------------------------------------------------------------------------------- -!> @brief report initial vacancy strain based on current vacancy conc deviation from equillibrium -!-------------------------------------------------------------------------------------------------- -pure function kinematics_vacancy_strain_initialStrain(ipc, ip, el) - use math, only: & - math_I3 - use material, only: & - material_phase, & - material_homog, & - vacancyConc, & - vacancyfluxMapping - use lattice, only: & - lattice_equilibriumVacancyConcentration - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), dimension(3,3) :: & - kinematics_vacancy_strain_initialStrain !< initial thermal strain (should be small strain, though) - integer(pInt) :: & - phase, & - homog, offset, instance - - phase = material_phase(ipc,ip,el) - instance = kinematics_vacancy_strain_instance(phase) - homog = material_homog(ip,el) - offset = vacancyfluxMapping(homog)%p(ip,el) - - kinematics_vacancy_strain_initialStrain = & - (vacancyConc(homog)%p(offset) - lattice_equilibriumVacancyConcentration(phase)) * & - kinematics_vacancy_strain_coeff(instance)* math_I3 - -end function kinematics_vacancy_strain_initialStrain - -!-------------------------------------------------------------------------------------------------- -!> @brief contains the constitutive equation for calculating the velocity gradient -!-------------------------------------------------------------------------------------------------- -subroutine kinematics_vacancy_strain_LiAndItsTangent(Li, dLi_dTstar3333, ipc, ip, el) - use material, only: & - material_phase, & - material_homog, & - vacancyConc, & - vacancyConcRate, & - vacancyfluxMapping - use math, only: & - math_I3 - use lattice, only: & - lattice_equilibriumVacancyConcentration - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), intent(out), dimension(3,3) :: & - Li !< thermal velocity gradient - real(pReal), intent(out), dimension(3,3,3,3) :: & - dLi_dTstar3333 !< derivative of Li with respect to Tstar (4th-order tensor) - integer(pInt) :: & - phase, & - instance, & - homog, offset - real(pReal) :: & - Cv, CvEq, CvDot - - phase = material_phase(ipc,ip,el) - instance = kinematics_vacancy_strain_instance(phase) - homog = material_homog(ip,el) - offset = vacancyfluxMapping(homog)%p(ip,el) - - Cv = vacancyConc(homog)%p(offset) - CvDot = vacancyConcRate(homog)%p(offset) - CvEq = lattice_equilibriumvacancyConcentration(phase) - - Li = CvDot*math_I3* & - kinematics_vacancy_strain_coeff(instance)/ & - (1.0_pReal + kinematics_vacancy_strain_coeff(instance)*(Cv - CvEq)) - - dLi_dTstar3333 = 0.0_pReal - -end subroutine kinematics_vacancy_strain_LiAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief contains the kinematic contribution to vacancy chemical potential -!-------------------------------------------------------------------------------------------------- -subroutine kinematics_vacancy_strain_ChemPotAndItsTangent(ChemPot, dChemPot_dCv, Tstar_v, Fi0, Fi, ipc, ip, el) - use material, only: & - material_phase - use math, only: & - math_inv33, & - math_mul33x33, & - math_Mandel6to33, & - math_transpose33 - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), intent(in), dimension(6) :: & - Tstar_v - real(pReal), intent(in), dimension(3,3) :: & - Fi0, Fi - real(pReal), intent(out) :: & - ChemPot, dChemPot_dCv - integer(pInt) :: & - phase, & - instance - - phase = material_phase(ipc,ip,el) - instance = kinematics_vacancy_strain_instance(phase) - - ChemPot = -kinematics_vacancy_strain_coeff(instance)* & - sum(math_mul33x33(Fi,math_Mandel6to33(Tstar_v))* & - math_mul33x33(math_mul33x33(Fi,math_inv33(Fi0)),Fi)) - dChemPot_dCv = 0.0_pReal - -end subroutine kinematics_vacancy_strain_ChemPotAndItsTangent - -end module kinematics_vacancy_strain diff --git a/src/material.f90 b/src/material.f90 index e52312c51..8356f43c7 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -40,15 +40,12 @@ module material KINEMATICS_cleavage_opening_label = 'cleavage_opening', & KINEMATICS_slipplane_opening_label = 'slipplane_opening', & STIFFNESS_DEGRADATION_damage_label = 'damage', & - STIFFNESS_DEGRADATION_porosity_label = 'porosity', & THERMAL_isothermal_label = 'isothermal', & THERMAL_adiabatic_label = 'adiabatic', & THERMAL_conduction_label = 'conduction', & DAMAGE_none_label = 'none', & DAMAGE_local_label = 'local', & DAMAGE_nonlocal_label = 'nonlocal', & - POROSITY_none_label = 'none', & - POROSITY_phasefield_label = 'phasefield', & HOMOGENIZATION_none_label = 'none', & HOMOGENIZATION_isostrain_label = 'isostrain', & HOMOGENIZATION_rgc_label = 'rgc' @@ -89,8 +86,7 @@ module material enum, bind(c) enumerator :: STIFFNESS_DEGRADATION_undefined_ID, & - STIFFNESS_DEGRADATION_damage_ID, & - STIFFNESS_DEGRADATION_porosity_ID + STIFFNESS_DEGRADATION_damage_ID end enum enum, bind(c) @@ -105,12 +101,6 @@ module material DAMAGE_nonlocal_ID end enum - enum, bind(c) - enumerator :: POROSITY_none_ID, & - POROSITY_phasefield_ID - end enum - - enum, bind(c) enumerator :: HOMOGENIZATION_undefined_ID, & HOMOGENIZATION_none_ID, & @@ -126,8 +116,6 @@ module material thermal_type !< thermal transport model integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & damage_type !< nonlocal damage model - integer(kind(POROSITY_none_ID)), dimension(:), allocatable, public, protected :: & - porosity_type !< porosity evolution model integer(kind(SOURCE_undefined_ID)), dimension(:,:), allocatable, public, protected :: & phase_source, & !< active sources mechanisms of each phase @@ -153,13 +141,11 @@ module material homogenization_typeInstance, & !< instance of particular type of each homogenization thermal_typeInstance, & !< instance of particular type of each thermal transport damage_typeInstance, & !< instance of particular type of each nonlocal damage - porosity_typeInstance, & !< instance of particular type of each porosity model microstructure_crystallite !< crystallite setting ID of each microstructure ! DEPRECATED !!!! real(pReal), dimension(:), allocatable, public, protected :: & thermal_initialT, & !< initial temperature per each homogenization - damage_initialPhi, & !< initial damage per each homogenization - porosity_initialPhi !< initial posority per each homogenization + damage_initialPhi !< initial damage per each homogenization ! NEW MAPPINGS integer(pInt), dimension(:), allocatable, public, protected :: & @@ -189,8 +175,7 @@ module material type(tState), allocatable, dimension(:), public :: & homogState, & thermalState, & - damageState, & - porosityState + damageState integer(pInt), dimension(:,:,:), allocatable, public, protected :: & material_texture !< texture (index) of each grain,IP,element @@ -240,13 +225,11 @@ module material type(tHomogMapping), allocatable, dimension(:), public :: & thermalMapping, & !< mapping for thermal state/fields - damageMapping, & !< mapping for damage state/fields - porosityMapping !< mapping for porosity state/fields + damageMapping !< mapping for damage state/fields type(group_float), allocatable, dimension(:), public :: & temperature, & !< temperature field damage, & !< damage field - porosity, & !< porosity field temperatureRate !< temperature change rate field public :: & @@ -270,15 +253,12 @@ module material KINEMATICS_slipplane_opening_ID, & KINEMATICS_thermal_expansion_ID, & STIFFNESS_DEGRADATION_damage_ID, & - STIFFNESS_DEGRADATION_porosity_ID, & THERMAL_isothermal_ID, & THERMAL_adiabatic_ID, & THERMAL_conduction_ID, & DAMAGE_none_ID, & DAMAGE_local_ID, & DAMAGE_nonlocal_ID, & - POROSITY_none_ID, & - POROSITY_phasefield_ID, & HOMOGENIZATION_none_ID, & HOMOGENIZATION_isostrain_ID, & HOMOGENIZATION_RGC_ID @@ -370,15 +350,12 @@ subroutine material_init() allocate(homogState (size(config_homogenization))) allocate(thermalState (size(config_homogenization))) allocate(damageState (size(config_homogenization))) - allocate(porosityState (size(config_homogenization))) allocate(thermalMapping (size(config_homogenization))) allocate(damageMapping (size(config_homogenization))) - allocate(porosityMapping (size(config_homogenization))) allocate(temperature (size(config_homogenization))) allocate(damage (size(config_homogenization))) - allocate(porosity (size(config_homogenization))) allocate(temperatureRate (size(config_homogenization))) @@ -453,10 +430,8 @@ subroutine material_init() do myHomog = 1,size(config_homogenization) thermalMapping (myHomog)%p => mappingHomogenizationConst damageMapping (myHomog)%p => mappingHomogenizationConst - porosityMapping (myHomog)%p => mappingHomogenizationConst allocate(temperature (myHomog)%p(1), source=thermal_initialT(myHomog)) allocate(damage (myHomog)%p(1), source=damage_initialPhi(myHomog)) - allocate(porosity (myHomog)%p(1), source=porosity_initialPhi(myHomog)) allocate(temperatureRate (myHomog)%p(1), source=0.0_pReal) enddo @@ -481,17 +456,14 @@ subroutine material_parseHomogenization allocate(homogenization_type(size(config_homogenization)), source=HOMOGENIZATION_undefined_ID) allocate(thermal_type(size(config_homogenization)), source=THERMAL_isothermal_ID) allocate(damage_type (size(config_homogenization)), source=DAMAGE_none_ID) - allocate(porosity_type (size(config_homogenization)), source=POROSITY_none_ID) allocate(homogenization_typeInstance(size(config_homogenization)), source=0_pInt) allocate(thermal_typeInstance(size(config_homogenization)), source=0_pInt) allocate(damage_typeInstance(size(config_homogenization)), source=0_pInt) - allocate(porosity_typeInstance(size(config_homogenization)), source=0_pInt) allocate(homogenization_Ngrains(size(config_homogenization)), source=0_pInt) allocate(homogenization_Noutput(size(config_homogenization)), source=0_pInt) allocate(homogenization_active(size(config_homogenization)), source=.false.) !!!!!!!!!!!!!!! allocate(thermal_initialT(size(config_homogenization)), source=300.0_pReal) allocate(damage_initialPhi(size(config_homogenization)), source=1.0_pReal) - allocate(porosity_initialPhi(size(config_homogenization)), source=1.0_pReal) forall (h = 1_pInt:size(config_homogenization)) & homogenization_active(h) = any(mesh_homogenizationAt == h) @@ -550,25 +522,6 @@ subroutine material_parseHomogenization end select endif - - - - if (config_homogenization(h)%keyExists('porosity')) then - !ToDo? - - tag = config_homogenization(h)%getString('porosity') - select case (trim(tag)) - case(POROSITY_NONE_label) - porosity_type(h) = POROSITY_none_ID - case(POROSITY_phasefield_label) - porosity_type(h) = POROSITY_phasefield_ID - case default - call IO_error(500_pInt,ext_msg=trim(tag)) - end select - - endif - - enddo @@ -576,7 +529,6 @@ subroutine material_parseHomogenization homogenization_typeInstance(h) = count(homogenization_type(1:h) == homogenization_type(h)) thermal_typeInstance(h) = count(thermal_type (1:h) == thermal_type (h)) damage_typeInstance(h) = count(damage_type (1:h) == damage_type (h)) - porosity_typeInstance(h) = count(porosity_type (1:h) == porosity_type (h)) enddo homogenization_maxNgrains = maxval(homogenization_Ngrains,homogenization_active) @@ -797,8 +749,6 @@ subroutine material_parsePhase select case (trim(str(stiffDegradationCtr))) case (STIFFNESS_DEGRADATION_damage_label) phase_stiffnessDegradation(stiffDegradationCtr,p) = STIFFNESS_DEGRADATION_damage_ID - case (STIFFNESS_DEGRADATION_porosity_label) - phase_stiffnessDegradation(stiffDegradationCtr,p) = STIFFNESS_DEGRADATION_porosity_ID end select enddo enddo diff --git a/src/porosity_none.f90 b/src/porosity_none.f90 deleted file mode 100644 index d8175cd9e..000000000 --- a/src/porosity_none.f90 +++ /dev/null @@ -1,60 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for constant porosity -!-------------------------------------------------------------------------------------------------- -module porosity_none - - implicit none - private - - public :: & - porosity_none_init - -contains - -!-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields, reads information from material configuration file -!-------------------------------------------------------------------------------------------------- -subroutine porosity_none_init() -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use prec, only: & - pReal, & - pInt - use IO, only: & - IO_timeStamp - use material - use config - - implicit none - integer(pInt) :: & - homog, & - NofMyHomog - - write(6,'(/,a)') ' <<<+- porosity_'//POROSITY_none_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - initializeInstances: do homog = 1_pInt, material_Nhomogenization - - myhomog: if (porosity_type(homog) == POROSITY_none_ID) then - NofMyHomog = count(material_homog == homog) - porosityState(homog)%sizeState = 0_pInt - porosityState(homog)%sizePostResults = 0_pInt - allocate(porosityState(homog)%state0 (0_pInt,NofMyHomog), source=0.0_pReal) - allocate(porosityState(homog)%subState0(0_pInt,NofMyHomog), source=0.0_pReal) - allocate(porosityState(homog)%state (0_pInt,NofMyHomog), source=0.0_pReal) - - deallocate(porosity(homog)%p) - allocate (porosity(homog)%p(1), source=porosity_initialPhi(homog)) - - endif myhomog - enddo initializeInstances - - -end subroutine porosity_none_init - -end module porosity_none diff --git a/src/porosity_phasefield.f90 b/src/porosity_phasefield.f90 deleted file mode 100644 index 1975ba64c..000000000 --- a/src/porosity_phasefield.f90 +++ /dev/null @@ -1,448 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for phase field modelling of pore nucleation and growth -!> @details phase field model for pore nucleation and growth based on vacancy clustering -!-------------------------------------------------------------------------------------------------- -module porosity_phasefield - use prec, only: & - pReal, & - pInt - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - porosity_phasefield_sizePostResults !< cumulative size of post results - - integer(pInt), dimension(:,:), allocatable, target, public :: & - porosity_phasefield_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - porosity_phasefield_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - porosity_phasefield_Noutput !< number of outputs per instance of this porosity - - enum, bind(c) - enumerator :: undefined_ID, & - porosity_ID - end enum - integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & - porosity_phasefield_outputID !< ID of each post result output - - - public :: & - porosity_phasefield_init, & - porosity_phasefield_getFormationEnergy, & - porosity_phasefield_getSurfaceEnergy, & - porosity_phasefield_getSourceAndItsTangent, & - porosity_phasefield_getDiffusion33, & - porosity_phasefield_getMobility, & - porosity_phasefield_putPorosity, & - porosity_phasefield_postResults - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine porosity_phasefield_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use material, only: & - porosity_type, & - porosity_typeInstance, & - homogenization_Noutput, & - POROSITY_phasefield_label, & - POROSITY_phasefield_ID, & - material_homog, & - mappingHomogenization, & - porosityState, & - porosityMapping, & - porosity, & - porosity_initialPhi - use config, only: & - material_partHomogenization, & - material_partPhase - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o - integer(pInt) :: sizeState - integer(pInt) :: NofMyHomog - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- porosity_'//POROSITY_phasefield_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(porosity_type == POROSITY_phasefield_ID),pInt) - if (maxNinstance == 0_pInt) return - - allocate(porosity_phasefield_sizePostResults(maxNinstance), source=0_pInt) - allocate(porosity_phasefield_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0_pInt) - allocate(porosity_phasefield_output (maxval(homogenization_Noutput),maxNinstance)) - porosity_phasefield_output = '' - allocate(porosity_phasefield_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID) - allocate(porosity_phasefield_Noutput (maxNinstance), source=0_pInt) - - rewind(fileUnit) - section = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to - line = IO_read(fileUnit) - enddo - - parsingHomog: do while (trim(line) /= IO_EOF) ! read through sections of homog part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next homog section - section = section + 1_pInt ! advance homog section counter - cycle ! skip to next line - endif - - if (section > 0_pInt ) then; if (porosity_type(section) == POROSITY_phasefield_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - - instance = porosity_typeInstance(section) ! which instance of my porosity is present homog - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('(output)') - select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt))) - case ('porosity') - porosity_phasefield_Noutput(instance) = porosity_phasefield_Noutput(instance) + 1_pInt - porosity_phasefield_outputID(porosity_phasefield_Noutput(instance),instance) = porosity_ID - porosity_phasefield_output(porosity_phasefield_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - end select - - end select - endif; endif - enddo parsingHomog - - initializeInstances: do section = 1_pInt, size(porosity_type) - if (porosity_type(section) == POROSITY_phasefield_ID) then - NofMyHomog=count(material_homog==section) - instance = porosity_typeInstance(section) - -!-------------------------------------------------------------------------------------------------- -! Determine size of postResults array - outputsLoop: do o = 1_pInt,porosity_phasefield_Noutput(instance) - select case(porosity_phasefield_outputID(o,instance)) - case(porosity_ID) - mySize = 1_pInt - end select - - if (mySize > 0_pInt) then ! any meaningful output found - porosity_phasefield_sizePostResult(o,instance) = mySize - porosity_phasefield_sizePostResults(instance) = porosity_phasefield_sizePostResults(instance) + mySize - endif - enddo outputsLoop - -! allocate state arrays - sizeState = 0_pInt - porosityState(section)%sizeState = sizeState - porosityState(section)%sizePostResults = porosity_phasefield_sizePostResults(instance) - allocate(porosityState(section)%state0 (sizeState,NofMyHomog)) - allocate(porosityState(section)%subState0(sizeState,NofMyHomog)) - allocate(porosityState(section)%state (sizeState,NofMyHomog)) - - nullify(porosityMapping(section)%p) - porosityMapping(section)%p => mappingHomogenization(1,:,:) - deallocate(porosity(section)%p) - allocate(porosity(section)%p(NofMyHomog), source=porosity_initialPhi(section)) - - endif - - enddo initializeInstances -end subroutine porosity_phasefield_init - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized vacancy formation energy -!-------------------------------------------------------------------------------------------------- -function porosity_phasefield_getFormationEnergy(ip,el) - use lattice, only: & - lattice_vacancyFormationEnergy, & - lattice_vacancyVol - use material, only: & - homogenization_Ngrains, & - material_phase - use mesh, only: & - mesh_element - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal) :: & - porosity_phasefield_getFormationEnergy - integer(pInt) :: & - grain - - porosity_phasefield_getFormationEnergy = 0.0_pReal - do grain = 1, homogenization_Ngrains(mesh_element(3,el)) - porosity_phasefield_getFormationEnergy = porosity_phasefield_getFormationEnergy + & - lattice_vacancyFormationEnergy(material_phase(grain,ip,el))/ & - lattice_vacancyVol(material_phase(grain,ip,el)) - enddo - - porosity_phasefield_getFormationEnergy = & - porosity_phasefield_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function porosity_phasefield_getFormationEnergy - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized pore surface energy (normalized by characteristic length) -!-------------------------------------------------------------------------------------------------- -function porosity_phasefield_getSurfaceEnergy(ip,el) - use lattice, only: & - lattice_vacancySurfaceEnergy - use material, only: & - homogenization_Ngrains, & - material_phase - use mesh, only: & - mesh_element - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal) :: & - porosity_phasefield_getSurfaceEnergy - integer(pInt) :: & - grain - - porosity_phasefield_getSurfaceEnergy = 0.0_pReal - do grain = 1, homogenization_Ngrains(mesh_element(3,el)) - porosity_phasefield_getSurfaceEnergy = porosity_phasefield_getSurfaceEnergy + & - lattice_vacancySurfaceEnergy(material_phase(grain,ip,el)) - enddo - - porosity_phasefield_getSurfaceEnergy = & - porosity_phasefield_getSurfaceEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function porosity_phasefield_getSurfaceEnergy - -!-------------------------------------------------------------------------------------------------- -!> @brief calculates homogenized local driving force for pore nucleation and growth -!-------------------------------------------------------------------------------------------------- -subroutine porosity_phasefield_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el) - use math, only : & - math_mul33x33, & - math_mul66x6, & - math_Mandel33to6, & - math_transpose33, & - math_I3 - use material, only: & - homogenization_Ngrains, & - material_homog, & - material_phase, & - phase_NstiffnessDegradations, & - phase_stiffnessDegradation, & - vacancyConc, & - vacancyfluxMapping, & - damage, & - damageMapping, & - STIFFNESS_DEGRADATION_damage_ID - use crystallite, only: & - crystallite_Fe - use constitutive, only: & - constitutive_homogenizedC - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - phi - integer(pInt) :: & - phase, & - grain, & - homog, & - mech - real(pReal) :: & - phiDot, dPhiDot_dPhi, Cv, W_e, strain(6), C(6,6) - - homog = material_homog(ip,el) - Cv = vacancyConc(homog)%p(vacancyfluxMapping(homog)%p(ip,el)) - - W_e = 0.0_pReal - do grain = 1, homogenization_Ngrains(homog) - phase = material_phase(grain,ip,el) - strain = math_Mandel33to6(math_mul33x33(math_transpose33(crystallite_Fe(1:3,1:3,grain,ip,el)), & - crystallite_Fe(1:3,1:3,grain,ip,el)) - math_I3)/2.0_pReal - C = constitutive_homogenizedC(grain,ip,el) - do mech = 1_pInt, phase_NstiffnessDegradations(phase) - select case(phase_stiffnessDegradation(mech,phase)) - case (STIFFNESS_DEGRADATION_damage_ID) - C = damage(homog)%p(damageMapping(homog)%p(ip,el))* & - damage(homog)%p(damageMapping(homog)%p(ip,el))* & - C - - end select - enddo - W_e = W_e + sum(abs(strain*math_mul66x6(C,strain))) - enddo - W_e = W_e/real(homogenization_Ngrains(homog),pReal) - - phiDot = 2.0_pReal*(1.0_pReal - phi)*(1.0_pReal - Cv)*(1.0_pReal - Cv) - & - 2.0_pReal*phi*(W_e + Cv*porosity_phasefield_getFormationEnergy(ip,el))/ & - porosity_phasefield_getSurfaceEnergy (ip,el) - dPhiDot_dPhi = - 2.0_pReal*(1.0_pReal - Cv)*(1.0_pReal - Cv) & - - 2.0_pReal*(W_e + Cv*porosity_phasefield_getFormationEnergy(ip,el))/ & - porosity_phasefield_getSurfaceEnergy (ip,el) - -end subroutine porosity_phasefield_getSourceAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized nonlocal diffusion tensor in reference configuration -!-------------------------------------------------------------------------------------------------- -function porosity_phasefield_getDiffusion33(ip,el) - use lattice, only: & - lattice_PorosityDiffusion33 - use material, only: & - homogenization_Ngrains, & - material_phase, & - mappingHomogenization - use crystallite, only: & - crystallite_push33ToRef - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), dimension(3,3) :: & - porosity_phasefield_getDiffusion33 - integer(pInt) :: & - homog, & - grain - - homog = mappingHomogenization(2,ip,el) - porosity_phasefield_getDiffusion33 = 0.0_pReal - do grain = 1, homogenization_Ngrains(homog) - porosity_phasefield_getDiffusion33 = porosity_phasefield_getDiffusion33 + & - crystallite_push33ToRef(grain,ip,el,lattice_PorosityDiffusion33(1:3,1:3,material_phase(grain,ip,el))) - enddo - - porosity_phasefield_getDiffusion33 = & - porosity_phasefield_getDiffusion33/real(homogenization_Ngrains(homog),pReal) - -end function porosity_phasefield_getDiffusion33 - -!-------------------------------------------------------------------------------------------------- -!> @brief Returns homogenized phase field mobility -!-------------------------------------------------------------------------------------------------- -real(pReal) function porosity_phasefield_getMobility(ip,el) - use mesh, only: & - mesh_element - use lattice, only: & - lattice_PorosityMobility - use material, only: & - material_phase, & - homogenization_Ngrains - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - integer(pInt) :: & - ipc - - porosity_phasefield_getMobility = 0.0_pReal - - do ipc = 1, homogenization_Ngrains(mesh_element(3,el)) - porosity_phasefield_getMobility = porosity_phasefield_getMobility & - + lattice_PorosityMobility(material_phase(ipc,ip,el)) - enddo - - porosity_phasefield_getMobility = & - porosity_phasefield_getMobility/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function porosity_phasefield_getMobility - -!-------------------------------------------------------------------------------------------------- -!> @brief updates porosity with solution from phasefield PDE -!-------------------------------------------------------------------------------------------------- -subroutine porosity_phasefield_putPorosity(phi,ip,el) - use material, only: & - material_homog, & - porosityMapping, & - porosity - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - phi - integer(pInt) :: & - homog, & - offset - - homog = material_homog(ip,el) - offset = porosityMapping(homog)%p(ip,el) - porosity(homog)%p(offset) = phi - -end subroutine porosity_phasefield_putPorosity - -!-------------------------------------------------------------------------------------------------- -!> @brief return array of porosity results -!-------------------------------------------------------------------------------------------------- -function porosity_phasefield_postResults(ip,el) - use material, only: & - mappingHomogenization, & - porosity_typeInstance, & - porosity - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point - el !< element - real(pReal), dimension(porosity_phasefield_sizePostResults(porosity_typeInstance(mappingHomogenization(2,ip,el)))) :: & - porosity_phasefield_postResults - - integer(pInt) :: & - instance, homog, offset, o, c - - homog = mappingHomogenization(2,ip,el) - offset = mappingHomogenization(1,ip,el) - instance = porosity_typeInstance(homog) - - c = 0_pInt - porosity_phasefield_postResults = 0.0_pReal - - do o = 1_pInt,porosity_phasefield_Noutput(instance) - select case(porosity_phasefield_outputID(o,instance)) - - case (porosity_ID) - porosity_phasefield_postResults(c+1_pInt) = porosity(homog)%p(offset) - c = c + 1 - end select - enddo -end function porosity_phasefield_postResults - -end module porosity_phasefield diff --git a/src/source_damage_isoBrittle.f90 b/src/source_damage_isoBrittle.f90 index fe964d134..5aa3648f3 100644 --- a/src/source_damage_isoBrittle.f90 +++ b/src/source_damage_isoBrittle.f90 @@ -246,10 +246,7 @@ subroutine source_damage_isoBrittle_deltaState(C, Fe, ipc, ip, el) sourceState, & material_homog, & phase_NstiffnessDegradations, & - phase_stiffnessDegradation, & - porosity, & - porosityMapping, & - STIFFNESS_DEGRADATION_porosity_ID + phase_stiffnessDegradation use math, only : & math_mul33x33, & math_mul66x6, & diff --git a/src/source_vacancy_irradiation.f90 b/src/source_vacancy_irradiation.f90 deleted file mode 100644 index 67b4cabcf..000000000 --- a/src/source_vacancy_irradiation.f90 +++ /dev/null @@ -1,248 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for vacancy generation due to irradiation -!> @details to be done -!-------------------------------------------------------------------------------------------------- -module source_vacancy_irradiation - use prec, only: & - pReal, & - pInt - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - source_vacancy_irradiation_sizePostResults, & !< cumulative size of post results - source_vacancy_irradiation_offset, & !< which source is my current damage mechanism? - source_vacancy_irradiation_instance !< instance of damage source mechanism - - integer(pInt), dimension(:,:), allocatable, target, public :: & - source_vacancy_irradiation_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - source_vacancy_irradiation_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - source_vacancy_irradiation_Noutput !< number of outputs per instance of this damage - - real(pReal), dimension(:), allocatable, private :: & - source_vacancy_irradiation_cascadeProb, & - source_vacancy_irradiation_cascadeVolume - - public :: & - source_vacancy_irradiation_init, & - source_vacancy_irradiation_deltaState, & - source_vacancy_irradiation_getRateAndItsTangent - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine source_vacancy_irradiation_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use debug, only: & - debug_level,& - debug_constitutive,& - debug_levelBasic - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use material, only: & - phase_source, & - phase_Nsources, & - phase_Noutput, & - SOURCE_vacancy_irradiation_label, & - SOURCE_vacancy_irradiation_ID, & - material_phase, & - sourceState - use config, only: & - material_Nphase, & - MATERIAL_partPhase - use numerics,only: & - numerics_integrator - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,phase,instance,source,sourceOffset - integer(pInt) :: sizeState, sizeDotState, sizeDeltaState - integer(pInt) :: NofMyPhase - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_irradiation_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(phase_source == SOURCE_vacancy_irradiation_ID),pInt) - if (maxNinstance == 0_pInt) return - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance - - allocate(source_vacancy_irradiation_offset(material_Nphase), source=0_pInt) - allocate(source_vacancy_irradiation_instance(material_Nphase), source=0_pInt) - do phase = 1, material_Nphase - source_vacancy_irradiation_instance(phase) = count(phase_source(:,1:phase) == source_vacancy_irradiation_ID) - do source = 1, phase_Nsources(phase) - if (phase_source(source,phase) == source_vacancy_irradiation_ID) & - source_vacancy_irradiation_offset(phase) = source - enddo - enddo - - allocate(source_vacancy_irradiation_sizePostResults(maxNinstance), source=0_pInt) - allocate(source_vacancy_irradiation_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) - allocate(source_vacancy_irradiation_output(maxval(phase_Noutput),maxNinstance)) - source_vacancy_irradiation_output = '' - allocate(source_vacancy_irradiation_Noutput(maxNinstance), source=0_pInt) - allocate(source_vacancy_irradiation_cascadeProb(maxNinstance), source=0.0_pReal) - allocate(source_vacancy_irradiation_cascadeVolume(maxNinstance), source=0.0_pReal) - - rewind(fileUnit) - phase = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to - line = IO_read(fileUnit) - enddo - - parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next phase section - phase = phase + 1_pInt ! advance phase section counter - cycle ! skip to next line - endif - - if (phase > 0_pInt ) then; if (any(phase_source(:,phase) == SOURCE_vacancy_irradiation_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - - instance = source_vacancy_irradiation_instance(phase) ! which instance of my vacancy is present phase - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('irradiation_cascadeprobability') - source_vacancy_irradiation_cascadeProb(instance) = IO_floatValue(line,chunkPos,2_pInt) - - case ('irradiation_cascadevolume') - source_vacancy_irradiation_cascadeVolume(instance) = IO_floatValue(line,chunkPos,2_pInt) - - end select - endif; endif - enddo parsingFile - - initializeInstances: do phase = 1_pInt, material_Nphase - if (any(phase_source(:,phase) == SOURCE_vacancy_irradiation_ID)) then - NofMyPhase=count(material_phase==phase) - instance = source_vacancy_irradiation_instance(phase) - sourceOffset = source_vacancy_irradiation_offset(phase) - - sizeDotState = 2_pInt - sizeDeltaState = 2_pInt - sizeState = 2_pInt - sourceState(phase)%p(sourceOffset)%sizeState = sizeState - sourceState(phase)%p(sourceOffset)%sizeDotState = sizeDotState - sourceState(phase)%p(sourceOffset)%sizeDeltaState = sizeDeltaState - sourceState(phase)%p(sourceOffset)%sizePostResults = source_vacancy_irradiation_sizePostResults(instance) - allocate(sourceState(phase)%p(sourceOffset)%aTolState (sizeState), source=0.1_pReal) - allocate(sourceState(phase)%p(sourceOffset)%state0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%subState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%state (sizeState,NofMyPhase), source=0.0_pReal) - - allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 1_pInt)) then - allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) - endif - if (any(numerics_integrator == 4_pInt)) & - allocate(sourceState(phase)%p(sourceOffset)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 5_pInt)) & - allocate(sourceState(phase)%p(sourceOffset)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) - - endif - - enddo initializeInstances -end subroutine source_vacancy_irradiation_init - -!-------------------------------------------------------------------------------------------------- -!> @brief calculates derived quantities from state -!-------------------------------------------------------------------------------------------------- -subroutine source_vacancy_irradiation_deltaState(ipc, ip, el) - use material, only: & - phaseAt, phasememberAt, & - sourceState - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element - integer(pInt) :: & - phase, constituent, sourceOffset - real(pReal) :: & - randNo - - phase = phaseAt(ipc,ip,el) - constituent = phasememberAt(ipc,ip,el) - sourceOffset = source_vacancy_irradiation_offset(phase) - - call random_number(randNo) - sourceState(phase)%p(sourceOffset)%deltaState(1,constituent) = & - randNo - sourceState(phase)%p(sourceOffset)%state(1,constituent) - call random_number(randNo) - sourceState(phase)%p(sourceOffset)%deltaState(2,constituent) = & - randNo - sourceState(phase)%p(sourceOffset)%state(2,constituent) - -end subroutine source_vacancy_irradiation_deltaState - -!-------------------------------------------------------------------------------------------------- -!> @brief returns local vacancy generation rate -!-------------------------------------------------------------------------------------------------- -subroutine source_vacancy_irradiation_getRateAndItsTangent(CvDot, dCvDot_dCv, ipc, ip, el) - use material, only: & - phaseAt, phasememberAt, & - sourceState - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), intent(out) :: & - CvDot, dCvDot_dCv - integer(pInt) :: & - instance, phase, constituent, sourceOffset - - phase = phaseAt(ipc,ip,el) - constituent = phasememberAt(ipc,ip,el) - instance = source_vacancy_irradiation_instance(phase) - sourceOffset = source_vacancy_irradiation_offset(phase) - - CvDot = 0.0_pReal - dCvDot_dCv = 0.0_pReal - if (sourceState(phase)%p(sourceOffset)%state0(1,constituent) < source_vacancy_irradiation_cascadeProb(instance)) & - CvDot = sourceState(phase)%p(sourceOffset)%state0(2,constituent)*source_vacancy_irradiation_cascadeVolume(instance) - -end subroutine source_vacancy_irradiation_getRateAndItsTangent - -end module source_vacancy_irradiation diff --git a/src/source_vacancy_phenoplasticity.f90 b/src/source_vacancy_phenoplasticity.f90 deleted file mode 100644 index e20d8ec06..000000000 --- a/src/source_vacancy_phenoplasticity.f90 +++ /dev/null @@ -1,210 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for vacancy generation due to plasticity -!> @details to be done -!-------------------------------------------------------------------------------------------------- -module source_vacancy_phenoplasticity - use prec, only: & - pReal, & - pInt - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - source_vacancy_phenoplasticity_sizePostResults, & !< cumulative size of post results - source_vacancy_phenoplasticity_offset, & !< which source is my current damage mechanism? - source_vacancy_phenoplasticity_instance !< instance of damage source mechanism - - integer(pInt), dimension(:,:), allocatable, target, public :: & - source_vacancy_phenoplasticity_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - source_vacancy_phenoplasticity_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - source_vacancy_phenoplasticity_Noutput !< number of outputs per instance of this damage - - real(pReal), dimension(:), allocatable, private :: & - source_vacancy_phenoplasticity_rateCoeff - - public :: & - source_vacancy_phenoplasticity_init, & - source_vacancy_phenoplasticity_getRateAndItsTangent - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine source_vacancy_phenoplasticity_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use debug, only: & - debug_level,& - debug_constitutive,& - debug_levelBasic - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use material, only: & - phase_source, & - phase_Nsources, & - phase_Noutput, & - SOURCE_vacancy_phenoplasticity_label, & - SOURCE_vacancy_phenoplasticity_ID, & - material_phase, & - sourceState - use config, only: & - material_Nphase, & - MATERIAL_partPhase - use numerics,only: & - numerics_integrator - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,phase,instance,source,sourceOffset - integer(pInt) :: sizeState, sizeDotState, sizeDeltaState - integer(pInt) :: NofMyPhase - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_phenoplasticity_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(phase_source == SOURCE_vacancy_phenoplasticity_ID),pInt) - if (maxNinstance == 0_pInt) return - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance - - allocate(source_vacancy_phenoplasticity_offset(material_Nphase), source=0_pInt) - allocate(source_vacancy_phenoplasticity_instance(material_Nphase), source=0_pInt) - do phase = 1, material_Nphase - source_vacancy_phenoplasticity_instance(phase) = count(phase_source(:,1:phase) == source_vacancy_phenoplasticity_ID) - do source = 1, phase_Nsources(phase) - if (phase_source(source,phase) == source_vacancy_phenoplasticity_ID) & - source_vacancy_phenoplasticity_offset(phase) = source - enddo - enddo - - allocate(source_vacancy_phenoplasticity_sizePostResults(maxNinstance), source=0_pInt) - allocate(source_vacancy_phenoplasticity_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) - allocate(source_vacancy_phenoplasticity_output(maxval(phase_Noutput),maxNinstance)) - source_vacancy_phenoplasticity_output = '' - allocate(source_vacancy_phenoplasticity_Noutput(maxNinstance), source=0_pInt) - allocate(source_vacancy_phenoplasticity_rateCoeff(maxNinstance), source=0.0_pReal) - - rewind(fileUnit) - phase = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to - line = IO_read(fileUnit) - enddo - - parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next phase section - phase = phase + 1_pInt ! advance phase section counter - cycle ! skip to next line - endif - - if (phase > 0_pInt ) then; if (any(phase_source(:,phase) == SOURCE_vacancy_phenoplasticity_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - - instance = source_vacancy_phenoplasticity_instance(phase) ! which instance of my vacancy is present phase - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('phenoplasticity_ratecoeff') - source_vacancy_phenoplasticity_rateCoeff(instance) = IO_floatValue(line,chunkPos,2_pInt) - - end select - endif; endif - enddo parsingFile - - initializeInstances: do phase = 1_pInt, material_Nphase - if (any(phase_source(:,phase) == SOURCE_vacancy_phenoplasticity_ID)) then - NofMyPhase=count(material_phase==phase) - instance = source_vacancy_phenoplasticity_instance(phase) - sourceOffset = source_vacancy_phenoplasticity_offset(phase) - - sizeDotState = 0_pInt - sizeDeltaState = 0_pInt - sizeState = 0_pInt - sourceState(phase)%p(sourceOffset)%sizeState = sizeState - sourceState(phase)%p(sourceOffset)%sizeDotState = sizeDotState - sourceState(phase)%p(sourceOffset)%sizeDeltaState = sizeDeltaState - sourceState(phase)%p(sourceOffset)%sizePostResults = source_vacancy_phenoplasticity_sizePostResults(instance) - allocate(sourceState(phase)%p(sourceOffset)%aTolState (sizeState), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%state0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%subState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%state (sizeState,NofMyPhase), source=0.0_pReal) - - allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 1_pInt)) then - allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) - endif - if (any(numerics_integrator == 4_pInt)) & - allocate(sourceState(phase)%p(sourceOffset)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 5_pInt)) & - allocate(sourceState(phase)%p(sourceOffset)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) - - endif - - enddo initializeInstances -end subroutine source_vacancy_phenoplasticity_init - -!-------------------------------------------------------------------------------------------------- -!> @brief returns local vacancy generation rate -!-------------------------------------------------------------------------------------------------- -subroutine source_vacancy_phenoplasticity_getRateAndItsTangent(CvDot, dCvDot_dCv, ipc, ip, el) - use material, only: & - phaseAt, phasememberAt, & - plasticState - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), intent(out) :: & - CvDot, dCvDot_dCv - integer(pInt) :: & - instance, phase, constituent - - phase = phaseAt(ipc,ip,el) - constituent = phasememberAt(ipc,ip,el) - instance = source_vacancy_phenoplasticity_instance(phase) - - CvDot = & - source_vacancy_phenoplasticity_rateCoeff(instance)* & - sum(plasticState(phase)%slipRate(:,constituent)) - dCvDot_dCv = 0.0_pReal - -end subroutine source_vacancy_phenoplasticity_getRateAndItsTangent - -end module source_vacancy_phenoplasticity diff --git a/src/source_vacancy_thermalfluc.f90 b/src/source_vacancy_thermalfluc.f90 deleted file mode 100644 index cea52aa75..000000000 --- a/src/source_vacancy_thermalfluc.f90 +++ /dev/null @@ -1,250 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for vacancy generation due to thermal fluctuations -!> @details to be done -!-------------------------------------------------------------------------------------------------- -module source_vacancy_thermalfluc - use prec, only: & - pReal, & - pInt - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - source_vacancy_thermalfluc_sizePostResults, & !< cumulative size of post results - source_vacancy_thermalfluc_offset, & !< which source is my current damage mechanism? - source_vacancy_thermalfluc_instance !< instance of damage source mechanism - - integer(pInt), dimension(:,:), allocatable, target, public :: & - source_vacancy_thermalfluc_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - source_vacancy_thermalfluc_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - source_vacancy_thermalfluc_Noutput !< number of outputs per instance of this damage - - real(pReal), dimension(:), allocatable, private :: & - source_vacancy_thermalfluc_amplitude, & - source_vacancy_thermalfluc_normVacancyEnergy - - public :: & - source_vacancy_thermalfluc_init, & - source_vacancy_thermalfluc_deltaState, & - source_vacancy_thermalfluc_getRateAndItsTangent - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine source_vacancy_thermalfluc_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use debug, only: & - debug_level,& - debug_constitutive,& - debug_levelBasic - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use lattice, only: & - lattice_vacancyFormationEnergy - use material, only: & - phase_source, & - phase_Nsources, & - phase_Noutput, & - SOURCE_vacancy_thermalfluc_label, & - SOURCE_vacancy_thermalfluc_ID, & - material_phase, & - sourceState - use config, only: & - material_Nphase, & - MATERIAL_partPhase - use numerics,only: & - numerics_integrator - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,phase,instance,source,sourceOffset - integer(pInt) :: sizeState, sizeDotState, sizeDeltaState - integer(pInt) :: NofMyPhase - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_thermalfluc_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(phase_source == SOURCE_vacancy_thermalfluc_ID),pInt) - if (maxNinstance == 0_pInt) return - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance - - allocate(source_vacancy_thermalfluc_offset(material_Nphase), source=0_pInt) - allocate(source_vacancy_thermalfluc_instance(material_Nphase), source=0_pInt) - do phase = 1, material_Nphase - source_vacancy_thermalfluc_instance(phase) = count(phase_source(:,1:phase) == source_vacancy_thermalfluc_ID) - do source = 1, phase_Nsources(phase) - if (phase_source(source,phase) == source_vacancy_thermalfluc_ID) & - source_vacancy_thermalfluc_offset(phase) = source - enddo - enddo - - allocate(source_vacancy_thermalfluc_sizePostResults(maxNinstance), source=0_pInt) - allocate(source_vacancy_thermalfluc_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0_pInt) - allocate(source_vacancy_thermalfluc_output(maxval(phase_Noutput),maxNinstance)) - source_vacancy_thermalfluc_output = '' - allocate(source_vacancy_thermalfluc_Noutput(maxNinstance), source=0_pInt) - allocate(source_vacancy_thermalfluc_amplitude(maxNinstance), source=0.0_pReal) - allocate(source_vacancy_thermalfluc_normVacancyEnergy(maxNinstance), source=0.0_pReal) - - rewind(fileUnit) - phase = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to - line = IO_read(fileUnit) - enddo - - parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next phase section - phase = phase + 1_pInt ! advance phase section counter - cycle ! skip to next line - endif - - if (phase > 0_pInt ) then; if (any(phase_source(:,phase) == SOURCE_vacancy_thermalfluc_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - - instance = source_vacancy_thermalfluc_instance(phase) ! which instance of my vacancy is present phase - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('thermalfluctuation_amplitude') - source_vacancy_thermalfluc_amplitude(instance) = IO_floatValue(line,chunkPos,2_pInt) - - end select - endif; endif - enddo parsingFile - - initializeInstances: do phase = 1_pInt, material_Nphase - if (any(phase_source(:,phase) == SOURCE_vacancy_thermalfluc_ID)) then - NofMyPhase=count(material_phase==phase) - instance = source_vacancy_thermalfluc_instance(phase) - source_vacancy_thermalfluc_normVacancyEnergy(instance) = & - lattice_vacancyFormationEnergy(phase)/1.3806488e-23_pReal - sourceOffset = source_vacancy_thermalfluc_offset(phase) - - sizeDotState = 1_pInt - sizeDeltaState = 1_pInt - sizeState = 1_pInt - sourceState(phase)%p(sourceOffset)%sizeState = sizeState - sourceState(phase)%p(sourceOffset)%sizeDotState = sizeDotState - sourceState(phase)%p(sourceOffset)%sizeDeltaState = sizeDeltaState - sourceState(phase)%p(sourceOffset)%sizePostResults = source_vacancy_thermalfluc_sizePostResults(instance) - allocate(sourceState(phase)%p(sourceOffset)%aTolState (sizeState), source=0.1_pReal) - allocate(sourceState(phase)%p(sourceOffset)%state0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%subState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%state (sizeState,NofMyPhase), source=0.0_pReal) - - allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 1_pInt)) then - allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) - endif - if (any(numerics_integrator == 4_pInt)) & - allocate(sourceState(phase)%p(sourceOffset)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 5_pInt)) & - allocate(sourceState(phase)%p(sourceOffset)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) - - endif - - enddo initializeInstances -end subroutine source_vacancy_thermalfluc_init - -!-------------------------------------------------------------------------------------------------- -!> @brief calculates derived quantities from state -!-------------------------------------------------------------------------------------------------- -subroutine source_vacancy_thermalfluc_deltaState(ipc, ip, el) - use material, only: & - phaseAt, phasememberAt, & - sourceState - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element - integer(pInt) :: & - phase, constituent, sourceOffset - real(pReal) :: & - randNo - - phase = phaseAt(ipc,ip,el) - constituent = phasememberAt(ipc,ip,el) - sourceOffset = source_vacancy_thermalfluc_offset(phase) - - call random_number(randNo) - sourceState(phase)%p(sourceOffset)%deltaState(1,constituent) = & - randNo - 0.5_pReal - sourceState(phase)%p(sourceOffset)%state(1,constituent) - -end subroutine source_vacancy_thermalfluc_deltaState - -!-------------------------------------------------------------------------------------------------- -!> @brief returns local vacancy generation rate -!-------------------------------------------------------------------------------------------------- -subroutine source_vacancy_thermalfluc_getRateAndItsTangent(CvDot, dCvDot_dCv, ipc, ip, el) - use material, only: & - phaseAt, phasememberAt, & - material_homog, & - temperature, & - thermalMapping, & - sourceState - - implicit none - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - real(pReal), intent(out) :: & - CvDot, dCvDot_dCv - integer(pInt) :: & - instance, phase, constituent, sourceOffset - - phase = phaseAt(ipc,ip,el) - constituent = phasememberAt(ipc,ip,el) - instance = source_vacancy_thermalfluc_instance(phase) - sourceOffset = source_vacancy_thermalfluc_offset(phase) - - CvDot = source_vacancy_thermalfluc_amplitude(instance)* & - sourceState(phase)%p(sourceOffset)%state0(2,constituent)* & - exp(-source_vacancy_thermalfluc_normVacancyEnergy(instance)/ & - temperature(material_homog(ip,el))%p(thermalMapping(material_homog(ip,el))%p(ip,el))) - dCvDot_dCv = 0.0_pReal - -end subroutine source_vacancy_thermalfluc_getRateAndItsTangent - -end module source_vacancy_thermalfluc diff --git a/src/vacancyflux_cahnhilliard.f90 b/src/vacancyflux_cahnhilliard.f90 deleted file mode 100644 index ae5bd1cbc..000000000 --- a/src/vacancyflux_cahnhilliard.f90 +++ /dev/null @@ -1,602 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for conservative transport of vacancy concentration field -!> @details to be done -!-------------------------------------------------------------------------------------------------- -module vacancyflux_cahnhilliard - use prec, only: & - pReal, & - pInt, & - group_float - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - vacancyflux_cahnhilliard_sizePostResults !< cumulative size of post results - - integer(pInt), dimension(:,:), allocatable, target, public :: & - vacancyflux_cahnhilliard_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - vacancyflux_cahnhilliard_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - vacancyflux_cahnhilliard_Noutput !< number of outputs per instance of this damage - - real(pReal), dimension(:), allocatable, private :: & - vacancyflux_cahnhilliard_flucAmplitude - - type(group_float), dimension(:), allocatable, private :: & - vacancyflux_cahnhilliard_thermalFluc - - real(pReal), parameter, private :: & - kB = 1.3806488e-23_pReal !< Boltzmann constant in J/Kelvin - - enum, bind(c) - enumerator :: undefined_ID, & - vacancyConc_ID - end enum - integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & - vacancyflux_cahnhilliard_outputID !< ID of each post result output - - - public :: & - vacancyflux_cahnhilliard_init, & - vacancyflux_cahnhilliard_getSourceAndItsTangent, & - vacancyflux_cahnhilliard_getMobility33, & - vacancyflux_cahnhilliard_getDiffusion33, & - vacancyflux_cahnhilliard_getChemPotAndItsTangent, & - vacancyflux_cahnhilliard_putVacancyConcAndItsRate, & - vacancyflux_cahnhilliard_postResults - private :: & - vacancyflux_cahnhilliard_getFormationEnergy, & - vacancyflux_cahnhilliard_getEntropicCoeff, & - vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine vacancyflux_cahnhilliard_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use material, only: & - vacancyflux_type, & - vacancyflux_typeInstance, & - homogenization_Noutput, & - VACANCYFLUX_cahnhilliard_label, & - VACANCYFLUX_cahnhilliard_ID, & - material_homog, & - mappingHomogenization, & - vacancyfluxState, & - vacancyfluxMapping, & - vacancyConc, & - vacancyConcRate, & - vacancyflux_initialCv - use config, only: & - material_partPhase, & - material_partHomogenization - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o,offset - integer(pInt) :: sizeState - integer(pInt) :: NofMyHomog - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_cahnhilliard_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(vacancyflux_type == VACANCYFLUX_cahnhilliard_ID),pInt) - if (maxNinstance == 0_pInt) return - - allocate(vacancyflux_cahnhilliard_sizePostResults(maxNinstance), source=0_pInt) - allocate(vacancyflux_cahnhilliard_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0_pInt) - allocate(vacancyflux_cahnhilliard_output (maxval(homogenization_Noutput),maxNinstance)) - vacancyflux_cahnhilliard_output = '' - allocate(vacancyflux_cahnhilliard_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID) - allocate(vacancyflux_cahnhilliard_Noutput (maxNinstance), source=0_pInt) - - allocate(vacancyflux_cahnhilliard_flucAmplitude (maxNinstance)) - allocate(vacancyflux_cahnhilliard_thermalFluc (maxNinstance)) - - rewind(fileUnit) - section = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to - line = IO_read(fileUnit) - enddo - - parsingHomog: do while (trim(line) /= IO_EOF) ! read through sections of homog part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next homog section - section = section + 1_pInt ! advance homog section counter - cycle ! skip to next line - endif - - if (section > 0_pInt ) then; if (vacancyflux_type(section) == VACANCYFLUX_cahnhilliard_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - - instance = vacancyflux_typeInstance(section) ! which instance of my vacancyflux is present homog - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('(output)') - select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt))) - case ('vacancyconc') - vacancyflux_cahnhilliard_Noutput(instance) = vacancyflux_cahnhilliard_Noutput(instance) + 1_pInt - vacancyflux_cahnhilliard_outputID(vacancyflux_cahnhilliard_Noutput(instance),instance) = vacancyConc_ID - vacancyflux_cahnhilliard_output(vacancyflux_cahnhilliard_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - end select - - case ('vacancyflux_flucamplitude') - vacancyflux_cahnhilliard_flucAmplitude(instance) = IO_floatValue(line,chunkPos,2_pInt) - - end select - endif; endif - enddo parsingHomog - - initializeInstances: do section = 1_pInt, size(vacancyflux_type) - if (vacancyflux_type(section) == VACANCYFLUX_cahnhilliard_ID) then - NofMyHomog=count(material_homog==section) - instance = vacancyflux_typeInstance(section) - -!-------------------------------------------------------------------------------------------------- -! Determine size of postResults array - outputsLoop: do o = 1_pInt,vacancyflux_cahnhilliard_Noutput(instance) - select case(vacancyflux_cahnhilliard_outputID(o,instance)) - case(vacancyConc_ID) - mySize = 1_pInt - end select - - if (mySize > 0_pInt) then ! any meaningful output found - vacancyflux_cahnhilliard_sizePostResult(o,instance) = mySize - vacancyflux_cahnhilliard_sizePostResults(instance) = vacancyflux_cahnhilliard_sizePostResults(instance) + mySize - endif - enddo outputsLoop - -! allocate state arrays - sizeState = 0_pInt - vacancyfluxState(section)%sizeState = sizeState - vacancyfluxState(section)%sizePostResults = vacancyflux_cahnhilliard_sizePostResults(instance) - allocate(vacancyfluxState(section)%state0 (sizeState,NofMyHomog)) - allocate(vacancyfluxState(section)%subState0(sizeState,NofMyHomog)) - allocate(vacancyfluxState(section)%state (sizeState,NofMyHomog)) - - allocate(vacancyflux_cahnhilliard_thermalFluc(instance)%p(NofMyHomog)) - do offset = 1_pInt, NofMyHomog - call random_number(vacancyflux_cahnhilliard_thermalFluc(instance)%p(offset)) - vacancyflux_cahnhilliard_thermalFluc(instance)%p(offset) = & - 1.0_pReal - & - vacancyflux_cahnhilliard_flucAmplitude(instance)* & - (vacancyflux_cahnhilliard_thermalFluc(instance)%p(offset) - 0.5_pReal) - enddo - - nullify(vacancyfluxMapping(section)%p) - vacancyfluxMapping(section)%p => mappingHomogenization(1,:,:) - deallocate(vacancyConc (section)%p) - allocate (vacancyConc (section)%p(NofMyHomog), source=vacancyflux_initialCv(section)) - deallocate(vacancyConcRate(section)%p) - allocate (vacancyConcRate(section)%p(NofMyHomog), source=0.0_pReal) - - endif - - enddo initializeInstances - -end subroutine vacancyflux_cahnhilliard_init - -!-------------------------------------------------------------------------------------------------- -!> @brief calculates homogenized vacancy driving forces -!-------------------------------------------------------------------------------------------------- -subroutine vacancyflux_cahnhilliard_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv, ip, el) - use material, only: & - homogenization_Ngrains, & - mappingHomogenization, & - phaseAt, & - phase_source, & - phase_Nsources, & - SOURCE_vacancy_phenoplasticity_ID, & - SOURCE_vacancy_irradiation_ID, & - SOURCE_vacancy_thermalfluc_ID - use source_vacancy_phenoplasticity, only: & - source_vacancy_phenoplasticity_getRateAndItsTangent - use source_vacancy_irradiation, only: & - source_vacancy_irradiation_getRateAndItsTangent - use source_vacancy_thermalfluc, only: & - source_vacancy_thermalfluc_getRateAndItsTangent - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - Cv - integer(pInt) :: & - phase, & - grain, & - source - real(pReal) :: & - CvDot, dCvDot_dCv, localCvDot, dLocalCvDot_dCv - - CvDot = 0.0_pReal - dCvDot_dCv = 0.0_pReal - do grain = 1, homogenization_Ngrains(mappingHomogenization(2,ip,el)) - phase = phaseAt(grain,ip,el) - do source = 1_pInt, phase_Nsources(phase) - select case(phase_source(source,phase)) - case (SOURCE_vacancy_phenoplasticity_ID) - call source_vacancy_phenoplasticity_getRateAndItsTangent (localCvDot, dLocalCvDot_dCv, grain, ip, el) - - case (SOURCE_vacancy_irradiation_ID) - call source_vacancy_irradiation_getRateAndItsTangent (localCvDot, dLocalCvDot_dCv, grain, ip, el) - - case (SOURCE_vacancy_thermalfluc_ID) - call source_vacancy_thermalfluc_getRateAndItsTangent(localCvDot, dLocalCvDot_dCv, grain, ip, el) - - end select - CvDot = CvDot + localCvDot - dCvDot_dCv = dCvDot_dCv + dLocalCvDot_dCv - enddo - enddo - - CvDot = CvDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) - dCvDot_dCv = dCvDot_dCv/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) - -end subroutine vacancyflux_cahnhilliard_getSourceAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized vacancy mobility tensor in reference configuration -!-------------------------------------------------------------------------------------------------- -function vacancyflux_cahnhilliard_getMobility33(ip,el) - use lattice, only: & - lattice_vacancyfluxMobility33 - use material, only: & - homogenization_Ngrains, & - material_phase - use mesh, only: & - mesh_element - use crystallite, only: & - crystallite_push33ToRef - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), dimension(3,3) :: & - vacancyflux_cahnhilliard_getMobility33 - integer(pInt) :: & - grain - - vacancyflux_cahnhilliard_getMobility33 = 0.0_pReal - do grain = 1, homogenization_Ngrains(mesh_element(3,el)) - vacancyflux_cahnhilliard_getMobility33 = vacancyflux_cahnhilliard_getMobility33 + & - crystallite_push33ToRef(grain,ip,el,lattice_vacancyfluxMobility33(:,:,material_phase(grain,ip,el))) - enddo - - vacancyflux_cahnhilliard_getMobility33 = & - vacancyflux_cahnhilliard_getMobility33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function vacancyflux_cahnhilliard_getMobility33 - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized vacancy diffusion tensor in reference configuration -!-------------------------------------------------------------------------------------------------- -function vacancyflux_cahnhilliard_getDiffusion33(ip,el) - use lattice, only: & - lattice_vacancyfluxDiffusion33 - use material, only: & - homogenization_Ngrains, & - material_phase - use mesh, only: & - mesh_element - use crystallite, only: & - crystallite_push33ToRef - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), dimension(3,3) :: & - vacancyflux_cahnhilliard_getDiffusion33 - integer(pInt) :: & - grain - - vacancyflux_cahnhilliard_getDiffusion33 = 0.0_pReal - do grain = 1, homogenization_Ngrains(mesh_element(3,el)) - vacancyflux_cahnhilliard_getDiffusion33 = vacancyflux_cahnhilliard_getDiffusion33 + & - crystallite_push33ToRef(grain,ip,el,lattice_vacancyfluxDiffusion33(:,:,material_phase(grain,ip,el))) - enddo - - vacancyflux_cahnhilliard_getDiffusion33 = & - vacancyflux_cahnhilliard_getDiffusion33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function vacancyflux_cahnhilliard_getDiffusion33 - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized vacancy formation energy -!-------------------------------------------------------------------------------------------------- -real(pReal) function vacancyflux_cahnhilliard_getFormationEnergy(ip,el) - use lattice, only: & - lattice_vacancyFormationEnergy, & - lattice_vacancyVol, & - lattice_vacancySurfaceEnergy - use material, only: & - homogenization_Ngrains, & - material_phase - use mesh, only: & - mesh_element - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - integer(pInt) :: & - grain - - vacancyflux_cahnhilliard_getFormationEnergy = 0.0_pReal - do grain = 1, homogenization_Ngrains(mesh_element(3,el)) - vacancyflux_cahnhilliard_getFormationEnergy = vacancyflux_cahnhilliard_getFormationEnergy + & - lattice_vacancyFormationEnergy(material_phase(grain,ip,el))/ & - lattice_vacancyVol(material_phase(grain,ip,el))/ & - lattice_vacancySurfaceEnergy(material_phase(grain,ip,el)) - enddo - - vacancyflux_cahnhilliard_getFormationEnergy = & - vacancyflux_cahnhilliard_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal) - -end function vacancyflux_cahnhilliard_getFormationEnergy - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized vacancy entropy coefficient -!-------------------------------------------------------------------------------------------------- -real(pReal) function vacancyflux_cahnhilliard_getEntropicCoeff(ip,el) - use lattice, only: & - lattice_vacancyVol, & - lattice_vacancySurfaceEnergy - use material, only: & - homogenization_Ngrains, & - material_homog, & - material_phase, & - temperature, & - thermalMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - integer(pInt) :: & - grain - - vacancyflux_cahnhilliard_getEntropicCoeff = 0.0_pReal - do grain = 1, homogenization_Ngrains(material_homog(ip,el)) - vacancyflux_cahnhilliard_getEntropicCoeff = vacancyflux_cahnhilliard_getEntropicCoeff + & - kB/ & - lattice_vacancyVol(material_phase(grain,ip,el))/ & - lattice_vacancySurfaceEnergy(material_phase(grain,ip,el)) - enddo - - vacancyflux_cahnhilliard_getEntropicCoeff = & - vacancyflux_cahnhilliard_getEntropicCoeff* & - temperature(material_homog(ip,el))%p(thermalMapping(material_homog(ip,el))%p(ip,el))/ & - real(homogenization_Ngrains(material_homog(ip,el)),pReal) - -end function vacancyflux_cahnhilliard_getEntropicCoeff - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized kinematic contribution to chemical potential -!-------------------------------------------------------------------------------------------------- -subroutine vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dCv, Cv, ip, el) - use lattice, only: & - lattice_vacancySurfaceEnergy - use material, only: & - homogenization_Ngrains, & - material_homog, & - phase_kinematics, & - phase_Nkinematics, & - material_phase, & - KINEMATICS_vacancy_strain_ID - use crystallite, only: & - crystallite_Tstar_v, & - crystallite_Fi0, & - crystallite_Fi - use kinematics_vacancy_strain, only: & - kinematics_vacancy_strain_ChemPotAndItsTangent - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - Cv - real(pReal), intent(out) :: & - KPot, dKPot_dCv - real(pReal) :: & - my_KPot, my_dKPot_dCv - integer(pInt) :: & - grain, kinematics - - KPot = 0.0_pReal - dKPot_dCv = 0.0_pReal - do grain = 1_pInt,homogenization_Ngrains(material_homog(ip,el)) - do kinematics = 1_pInt, phase_Nkinematics(material_phase(grain,ip,el)) - select case (phase_kinematics(kinematics,material_phase(grain,ip,el))) - case (KINEMATICS_vacancy_strain_ID) - call kinematics_vacancy_strain_ChemPotAndItsTangent(my_KPot, my_dKPot_dCv, & - crystallite_Tstar_v(1:6,grain,ip,el), & - crystallite_Fi0(1:3,1:3,grain,ip,el), & - crystallite_Fi (1:3,1:3,grain,ip,el), & - grain,ip, el) - - case default - my_KPot = 0.0_pReal - my_dKPot_dCv = 0.0_pReal - - end select - KPot = KPot + my_KPot/lattice_vacancySurfaceEnergy(material_phase(grain,ip,el)) - dKPot_dCv = dKPot_dCv + my_dKPot_dCv/lattice_vacancySurfaceEnergy(material_phase(grain,ip,el)) - enddo - enddo - - KPot = KPot/real(homogenization_Ngrains(material_homog(ip,el)),pReal) - dKPot_dCv = dKPot_dCv/real(homogenization_Ngrains(material_homog(ip,el)),pReal) - -end subroutine vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief returns homogenized chemical potential and its tangent -!-------------------------------------------------------------------------------------------------- -subroutine vacancyflux_cahnhilliard_getChemPotAndItsTangent(ChemPot,dChemPot_dCv,Cv,ip,el) - use numerics, only: & - vacancyBoundPenalty, & - vacancyPolyOrder - use material, only: & - mappingHomogenization, & - vacancyflux_typeInstance, & - porosity, & - porosityMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - Cv - real(pReal), intent(out) :: & - ChemPot, & - dChemPot_dCv - real(pReal) :: & - VoidPhaseFrac, kBT, KPot, dKPot_dCv - integer(pInt) :: & - homog, o - - homog = mappingHomogenization(2,ip,el) - VoidPhaseFrac = porosity(homog)%p(porosityMapping(homog)%p(ip,el)) - kBT = vacancyflux_cahnhilliard_getEntropicCoeff(ip,el) - - ChemPot = vacancyflux_cahnhilliard_getFormationEnergy(ip,el) - dChemPot_dCv = 0.0_pReal - do o = 1_pInt, vacancyPolyOrder - ChemPot = ChemPot + kBT*((2.0_pReal*Cv - 1.0_pReal)**real(2_pInt*o-1_pInt,pReal))/ & - real(2_pInt*o-1_pInt,pReal) - dChemPot_dCv = dChemPot_dCv + 2.0_pReal*kBT*(2.0_pReal*Cv - 1.0_pReal)**real(2_pInt*o-2_pInt,pReal) - enddo - - ChemPot = VoidPhaseFrac*VoidPhaseFrac*ChemPot & - - 2.0_pReal*(1.0_pReal - Cv)*(1.0_pReal - VoidPhaseFrac)*(1.0_pReal - VoidPhaseFrac) - - dChemPot_dCv = VoidPhaseFrac*VoidPhaseFrac*dChemPot_dCv & - + 2.0_pReal*(1.0_pReal - VoidPhaseFrac)*(1.0_pReal - VoidPhaseFrac) - - call vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dCv, Cv, ip, el) - ChemPot = ChemPot + KPot - dChemPot_dCv = dChemPot_dCv + dKPot_dCv - - if (Cv < 0.0_pReal) then - ChemPot = ChemPot - 3.0_pReal*vacancyBoundPenalty*Cv*Cv - dChemPot_dCv = dChemPot_dCv - 6.0_pReal*vacancyBoundPenalty*Cv - elseif (Cv > 1.0_pReal) then - ChemPot = ChemPot + 3.0_pReal*vacancyBoundPenalty*(1.0_pReal - Cv)*(1.0_pReal - Cv) - dChemPot_dCv = dChemPot_dCv - 6.0_pReal*vacancyBoundPenalty*(1.0_pReal - Cv) - endif - - ChemPot = ChemPot* & - vacancyflux_cahnhilliard_thermalFluc(vacancyflux_typeInstance(homog))%p(mappingHomogenization(1,ip,el)) - dChemPot_dCv = dChemPot_dCv* & - vacancyflux_cahnhilliard_thermalFluc(vacancyflux_typeInstance(homog))%p(mappingHomogenization(1,ip,el)) - -end subroutine vacancyflux_cahnhilliard_getChemPotAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief updated vacancy concentration and its rate with solution from transport PDE -!-------------------------------------------------------------------------------------------------- -subroutine vacancyflux_cahnhilliard_putVacancyConcAndItsRate(Cv,Cvdot,ip,el) - use material, only: & - mappingHomogenization, & - vacancyConc, & - vacancyConcRate, & - vacancyfluxMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - Cv, & - Cvdot - integer(pInt) :: & - homog, & - offset - - homog = mappingHomogenization(2,ip,el) - offset = vacancyfluxMapping(homog)%p(ip,el) - vacancyConc (homog)%p(offset) = Cv - vacancyConcRate(homog)%p(offset) = Cvdot - -end subroutine vacancyflux_cahnhilliard_putVacancyConcAndItsRate - -!-------------------------------------------------------------------------------------------------- -!> @brief return array of vacancy transport results -!-------------------------------------------------------------------------------------------------- -function vacancyflux_cahnhilliard_postResults(ip,el) - use material, only: & - mappingHomogenization, & - vacancyflux_typeInstance, & - vacancyConc, & - vacancyfluxMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point - el !< element - real(pReal), dimension(vacancyflux_cahnhilliard_sizePostResults(vacancyflux_typeInstance(mappingHomogenization(2,ip,el)))) :: & - vacancyflux_cahnhilliard_postResults - - integer(pInt) :: & - instance, homog, offset, o, c - - homog = mappingHomogenization(2,ip,el) - offset = vacancyfluxMapping(homog)%p(ip,el) - instance = vacancyflux_typeInstance(homog) - - c = 0_pInt - vacancyflux_cahnhilliard_postResults = 0.0_pReal - - do o = 1_pInt,vacancyflux_cahnhilliard_Noutput(instance) - select case(vacancyflux_cahnhilliard_outputID(o,instance)) - - case (vacancyConc_ID) - vacancyflux_cahnhilliard_postResults(c+1_pInt) = vacancyConc(homog)%p(offset) - c = c + 1 - end select - enddo -end function vacancyflux_cahnhilliard_postResults - -end module vacancyflux_cahnhilliard diff --git a/src/vacancyflux_isochempot.f90 b/src/vacancyflux_isochempot.f90 deleted file mode 100644 index 761a0ba22..000000000 --- a/src/vacancyflux_isochempot.f90 +++ /dev/null @@ -1,328 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for locally evolving vacancy concentration -!> @details to be done -!-------------------------------------------------------------------------------------------------- -module vacancyflux_isochempot - use prec, only: & - pReal, & - pInt - - implicit none - private - integer(pInt), dimension(:), allocatable, public, protected :: & - vacancyflux_isochempot_sizePostResults !< cumulative size of post results - - integer(pInt), dimension(:,:), allocatable, target, public :: & - vacancyflux_isochempot_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - vacancyflux_isochempot_output !< name of each post result output - - integer(pInt), dimension(:), allocatable, target, public :: & - vacancyflux_isochempot_Noutput !< number of outputs per instance of this damage - - enum, bind(c) - enumerator :: undefined_ID, & - vacancyconc_ID - end enum - integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & - vacancyflux_isochempot_outputID !< ID of each post result output - - - public :: & - vacancyflux_isochempot_init, & - vacancyflux_isochempot_updateState, & - vacancyflux_isochempot_getSourceAndItsTangent, & - vacancyflux_isochempot_postResults - -contains - - -!-------------------------------------------------------------------------------------------------- -!> @brief module initialization -!> @details reads in material parameters, allocates arrays, and does sanity checks -!-------------------------------------------------------------------------------------------------- -subroutine vacancyflux_isochempot_init(fileUnit) -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use IO, only: & - IO_read, & - IO_lc, & - IO_getTag, & - IO_isBlank, & - IO_stringPos, & - IO_stringValue, & - IO_floatValue, & - IO_intValue, & - IO_warning, & - IO_error, & - IO_timeStamp, & - IO_EOF - use material, only: & - vacancyflux_type, & - vacancyflux_typeInstance, & - homogenization_Noutput, & - VACANCYFLUX_isochempot_label, & - VACANCYFLUX_isochempot_ID, & - material_homog, & - mappingHomogenization, & - vacancyfluxState, & - vacancyfluxMapping, & - vacancyConc, & - vacancyConcRate, & - vacancyflux_initialCv - use config, only: & - material_partHomogenization - - implicit none - integer(pInt), intent(in) :: fileUnit - - integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o - integer(pInt) :: sizeState - integer(pInt) :: NofMyHomog - character(len=65536) :: & - tag = '', & - line = '' - - write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_isochempot_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - maxNinstance = int(count(vacancyflux_type == VACANCYFLUX_isochempot_ID),pInt) - if (maxNinstance == 0_pInt) return - - allocate(vacancyflux_isochempot_sizePostResults(maxNinstance), source=0_pInt) - allocate(vacancyflux_isochempot_sizePostResult (maxval(homogenization_Noutput),maxNinstance),source=0_pInt) - allocate(vacancyflux_isochempot_output (maxval(homogenization_Noutput),maxNinstance)) - vacancyflux_isochempot_output = '' - allocate(vacancyflux_isochempot_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID) - allocate(vacancyflux_isochempot_Noutput (maxNinstance), source=0_pInt) - - rewind(fileUnit) - section = 0_pInt - do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to - line = IO_read(fileUnit) - enddo - - parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of homog part - line = IO_read(fileUnit) - if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part - line = IO_read(fileUnit, .true.) ! reset IO_read - exit - endif - if (IO_getTag(line,'[',']') /= '') then ! next homog section - section = section + 1_pInt ! advance homog section counter - cycle ! skip to next line - endif - - if (section > 0_pInt ) then; if (vacancyflux_type(section) == VACANCYFLUX_isochempot_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - - instance = vacancyflux_typeInstance(section) ! which instance of my vacancyflux is present homog - chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key - select case(tag) - case ('(output)') - select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt))) - case ('vacancyconc') - vacancyflux_isochempot_Noutput(instance) = vacancyflux_isochempot_Noutput(instance) + 1_pInt - vacancyflux_isochempot_outputID(vacancyflux_isochempot_Noutput(instance),instance) = vacancyconc_ID - vacancyflux_isochempot_output(vacancyflux_isochempot_Noutput(instance),instance) = & - IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - end select - - end select - endif; endif - enddo parsingFile - - initializeInstances: do section = 1_pInt, size(vacancyflux_type) - if (vacancyflux_type(section) == VACANCYFLUX_isochempot_ID) then - NofMyHomog=count(material_homog==section) - instance = vacancyflux_typeInstance(section) - -!-------------------------------------------------------------------------------------------------- -! Determine size of postResults array - outputsLoop: do o = 1_pInt,vacancyflux_isochempot_Noutput(instance) - select case(vacancyflux_isochempot_outputID(o,instance)) - case(vacancyconc_ID) - mySize = 1_pInt - end select - - if (mySize > 0_pInt) then ! any meaningful output found - vacancyflux_isochempot_sizePostResult(o,instance) = mySize - vacancyflux_isochempot_sizePostResults(instance) = vacancyflux_isochempot_sizePostResults(instance) + mySize - endif - enddo outputsLoop - -! allocate state arrays - sizeState = 1_pInt - vacancyfluxState(section)%sizeState = sizeState - vacancyfluxState(section)%sizePostResults = vacancyflux_isochempot_sizePostResults(instance) - allocate(vacancyfluxState(section)%state0 (sizeState,NofMyHomog), source=vacancyflux_initialCv(section)) - allocate(vacancyfluxState(section)%subState0(sizeState,NofMyHomog), source=vacancyflux_initialCv(section)) - allocate(vacancyfluxState(section)%state (sizeState,NofMyHomog), source=vacancyflux_initialCv(section)) - - nullify(vacancyfluxMapping(section)%p) - vacancyfluxMapping(section)%p => mappingHomogenization(1,:,:) - deallocate(vacancyConc(section)%p) - vacancyConc(section)%p => vacancyfluxState(section)%state(1,:) - deallocate(vacancyConcRate(section)%p) - allocate(vacancyConcRate(section)%p(NofMyHomog), source=0.0_pReal) - - endif - - enddo initializeInstances -end subroutine vacancyflux_isochempot_init - -!-------------------------------------------------------------------------------------------------- -!> @brief calculates change in vacancy concentration based on local vacancy generation model -!-------------------------------------------------------------------------------------------------- -function vacancyflux_isochempot_updateState(subdt, ip, el) - use numerics, only: & - err_vacancyflux_tolAbs, & - err_vacancyflux_tolRel - use material, only: & - mappingHomogenization, & - vacancyflux_typeInstance, & - vacancyfluxState, & - vacancyConc, & - vacancyConcRate, & - vacancyfluxMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - subdt - logical, dimension(2) :: & - vacancyflux_isochempot_updateState - integer(pInt) :: & - homog, & - offset, & - instance - real(pReal) :: & - Cv, Cvdot, dCvDot_dCv - - homog = mappingHomogenization(2,ip,el) - offset = mappingHomogenization(1,ip,el) - instance = vacancyflux_typeInstance(homog) - - Cv = vacancyfluxState(homog)%subState0(1,offset) - call vacancyflux_isochempot_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv, ip, el) - Cv = Cv + subdt*Cvdot - - vacancyflux_isochempot_updateState = [ abs(Cv - vacancyfluxState(homog)%state(1,offset)) & - <= err_vacancyflux_tolAbs & - .or. abs(Cv - vacancyfluxState(homog)%state(1,offset)) & - <= err_vacancyflux_tolRel*abs(vacancyfluxState(homog)%state(1,offset)), & - .true.] - - vacancyConc (homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = Cv - vacancyConcRate(homog)%p(vacancyfluxMapping(homog)%p(ip,el)) = & - (vacancyfluxState(homog)%state(1,offset) - vacancyfluxState(homog)%subState0(1,offset))/(subdt+tiny(0.0_pReal)) - -end function vacancyflux_isochempot_updateState - -!-------------------------------------------------------------------------------------------------- -!> @brief calculates homogenized vacancy driving forces -!-------------------------------------------------------------------------------------------------- -subroutine vacancyflux_isochempot_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv, ip, el) - use material, only: & - homogenization_Ngrains, & - mappingHomogenization, & - phaseAt, & - phase_source, & - phase_Nsources, & - SOURCE_vacancy_phenoplasticity_ID, & - SOURCE_vacancy_irradiation_ID, & - SOURCE_vacancy_thermalfluc_ID - use source_vacancy_phenoplasticity, only: & - source_vacancy_phenoplasticity_getRateAndItsTangent - use source_vacancy_irradiation, only: & - source_vacancy_irradiation_getRateAndItsTangent - use source_vacancy_thermalfluc, only: & - source_vacancy_thermalfluc_getRateAndItsTangent - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point number - el !< element number - real(pReal), intent(in) :: & - Cv - integer(pInt) :: & - phase, & - grain, & - source - real(pReal) :: & - CvDot, dCvDot_dCv, localCvDot, dLocalCvDot_dCv - - CvDot = 0.0_pReal - dCvDot_dCv = 0.0_pReal - do grain = 1, homogenization_Ngrains(mappingHomogenization(2,ip,el)) - phase = phaseAt(grain,ip,el) - do source = 1_pInt, phase_Nsources(phase) - select case(phase_source(source,phase)) - case (SOURCE_vacancy_phenoplasticity_ID) - call source_vacancy_phenoplasticity_getRateAndItsTangent (localCvDot, dLocalCvDot_dCv, grain, ip, el) - - case (SOURCE_vacancy_irradiation_ID) - call source_vacancy_irradiation_getRateAndItsTangent (localCvDot, dLocalCvDot_dCv, grain, ip, el) - - case (SOURCE_vacancy_thermalfluc_ID) - call source_vacancy_thermalfluc_getRateAndItsTangent(localCvDot, dLocalCvDot_dCv, grain, ip, el) - - end select - CvDot = CvDot + localCvDot - dCvDot_dCv = dCvDot_dCv + dLocalCvDot_dCv - enddo - enddo - - CvDot = CvDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) - dCvDot_dCv = dCvDot_dCv/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) - -end subroutine vacancyflux_isochempot_getSourceAndItsTangent - -!-------------------------------------------------------------------------------------------------- -!> @brief return array of vacancy transport results -!-------------------------------------------------------------------------------------------------- -function vacancyflux_isochempot_postResults(ip,el) - use material, only: & - mappingHomogenization, & - vacancyflux_typeInstance, & - vacancyConc, & - vacancyfluxMapping - - implicit none - integer(pInt), intent(in) :: & - ip, & !< integration point - el !< element - real(pReal), dimension(vacancyflux_isochempot_sizePostResults(vacancyflux_typeInstance(mappingHomogenization(2,ip,el)))) :: & - vacancyflux_isochempot_postResults - - integer(pInt) :: & - instance, homog, offset, o, c - - homog = mappingHomogenization(2,ip,el) - offset = vacancyfluxMapping(homog)%p(ip,el) - instance = vacancyflux_typeInstance(homog) - - c = 0_pInt - vacancyflux_isochempot_postResults = 0.0_pReal - - do o = 1_pInt,vacancyflux_isochempot_Noutput(instance) - select case(vacancyflux_isochempot_outputID(o,instance)) - - case (vacancyconc_ID) - vacancyflux_isochempot_postResults(c+1_pInt) = vacancyConc(homog)%p(offset) - c = c + 1 - end select - enddo -end function vacancyflux_isochempot_postResults - -end module vacancyflux_isochempot diff --git a/src/vacancyflux_isoconc.f90 b/src/vacancyflux_isoconc.f90 deleted file mode 100644 index 135509aa1..000000000 --- a/src/vacancyflux_isoconc.f90 +++ /dev/null @@ -1,62 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for constant vacancy concentration -!-------------------------------------------------------------------------------------------------- -module vacancyflux_isoconc - - implicit none - private - - public :: & - vacancyflux_isoconc_init - -contains - -!-------------------------------------------------------------------------------------------------- -!> @brief allocates all neccessary fields, reads information from material configuration file -!-------------------------------------------------------------------------------------------------- -subroutine vacancyflux_isoconc_init() -#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 - use, intrinsic :: iso_fortran_env, only: & - compiler_version, & - compiler_options -#endif - use prec, only: & - pReal, & - pInt - use IO, only: & - IO_timeStamp - use material - use config - - implicit none - integer(pInt) :: & - homog, & - NofMyHomog - - write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_isoconc_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() -#include "compilation_info.f90" - - initializeInstances: do homog = 1_pInt, material_Nhomogenization - - myhomog: if (vacancyflux_type(homog) == VACANCYFLUX_isoconc_ID) then - NofMyHomog = count(material_homog == homog) - vacancyfluxState(homog)%sizeState = 0_pInt - vacancyfluxState(homog)%sizePostResults = 0_pInt - allocate(vacancyfluxState(homog)%state0 (0_pInt,NofMyHomog)) - allocate(vacancyfluxState(homog)%subState0(0_pInt,NofMyHomog)) - allocate(vacancyfluxState(homog)%state (0_pInt,NofMyHomog)) - - deallocate(vacancyConc (homog)%p) - allocate (vacancyConc (homog)%p(1), source=vacancyflux_initialCv(homog)) - deallocate(vacancyConcRate(homog)%p) - allocate (vacancyConcRate(homog)%p(1), source=0.0_pReal) - - endif myhomog - enddo initializeInstances - - -end subroutine vacancyflux_isoconc_init - -end module vacancyflux_isoconc From c8dc2cb137b5d18b00c3df1b535fb3aa83a8464b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 11:33:27 +0100 Subject: [PATCH 123/147] best practises from phenopowerlaw --- src/plastic_isotropic.f90 | 254 ++++++++++++++++++-------------------- 1 file changed, 118 insertions(+), 136 deletions(-) diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index d65fe583f..da7f5cc0f 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -1,8 +1,8 @@ !-------------------------------------------------------------------------------------------------- !> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for isotropic (ISOTROPIC) plasticity -!> @details Isotropic (ISOTROPIC) Plasticity which resembles the phenopowerlaw plasticity without +!> @brief material subroutine for isotropic plasticity +!> @details Isotropic Plasticity which resembles the phenopowerlaw plasticity without !! resolving the stress on the slip systems. Will give the response of phenopowerlaw for an !! untextured polycrystal !-------------------------------------------------------------------------------------------------- @@ -14,52 +14,51 @@ module plastic_isotropic implicit none private integer(pInt), dimension(:,:), allocatable, target, public :: & - plastic_isotropic_sizePostResult !< size of each post result output + plastic_isotropic_sizePostResult !< size of each post result output character(len=64), dimension(:,:), allocatable, target, public :: & - plastic_isotropic_output !< name of each post result output - integer(pInt), dimension(:), allocatable, target, public :: & - plastic_isotropic_Noutput !< number of outputs per instance + plastic_isotropic_output !< name of each post result output enum, bind(c) - enumerator :: undefined_ID, & - flowstress_ID, & - strainrate_ID + enumerator :: & + undefined_ID, & + flowstress_ID, & + strainrate_ID end enum - type, private :: tParameters !< container type for internal constitutive parameters - integer(kind(undefined_ID)), allocatable, dimension(:) :: & - outputID + type, private :: tParameters real(pReal) :: & - fTaylor, & - tau0, & - gdot0, & - n, & + fTaylor, & !< Taylor factor + tau0, & !< initial critical stress + gdot0, & !< reference strain rate + n, & !< stress exponent h0, & h0_slopeLnRate, & - tausat, & + tausat, & !< maximum critical stress a, & - aTolFlowstress, & - aTolShear, & tausat_SinhFitA, & tausat_SinhFitB, & tausat_SinhFitC, & - tausat_SinhFitD + tausat_SinhFitD, & + aTolFlowstress, & + aTolShear + integer(kind(undefined_ID)), allocatable, dimension(:) :: & + outputID logical :: & dilatation end type - type(tParameters), dimension(:), allocatable, target, private :: param !< containers of constitutive parameters (len Ninstance) + type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance) - type, private :: tIsotropicState !< internal state aliases - real(pReal), pointer, dimension(:) :: & ! scalars along NipcMyInstance + type, private :: tIsotropicState + real(pReal), pointer, dimension(:) :: & flowstress, & accumulatedShear end type - type(tIsotropicState), allocatable, dimension(:), private :: & !< state aliases per instance - state, & - dotState - + type(tIsotropicState), allocatable, dimension(:), private :: & + dotState, & + state + public :: & plastic_isotropic_init, & plastic_isotropic_LpAndItsTangent, & @@ -80,20 +79,21 @@ subroutine plastic_isotropic_init() compiler_version, & compiler_options #endif -use IO use debug, only: & debug_level, & debug_constitutive, & debug_levelBasic - use numerics, only: & - numerics_integrator use math, only: & math_Mandel3333to66, & math_Voigt66to3333 + use IO, only: & + IO_error, & + IO_timeStamp use material, only: & phase_plasticity, & phase_plasticityInstance, & phase_Noutput, & + material_allocatePlasticState, & PLASTICITY_ISOTROPIC_label, & PLASTICITY_ISOTROPIC_ID, & material_phase, & @@ -101,23 +101,22 @@ use IO use config, only: & MATERIAL_partPhase, & config_phase - use lattice implicit none - type(tParameters), pointer :: prm - integer(pInt) :: & - phase, & + p, & instance, & maxNinstance, & sizeDotState, & - sizeState, & - sizeDeltaState + sizeState character(len=65536) :: & extmsg = '' integer(pInt) :: NipcMyPhase,i + integer(kind(undefined_ID)) :: & + outputID !< ID of each post result output + character(len=65536), dimension(:), allocatable :: outputs write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_ISOTROPIC_label//' init -+>>>' @@ -132,117 +131,98 @@ use IO allocate(plastic_isotropic_sizePostResult(maxval(phase_Noutput), maxNinstance),source=0_pInt) allocate(plastic_isotropic_output(maxval(phase_Noutput), maxNinstance)) plastic_isotropic_output = '' - allocate(plastic_isotropic_Noutput(maxNinstance), source=0_pInt) allocate(param(maxNinstance)) ! one container of parameters per instance allocate(state(maxNinstance)) ! internal state aliases allocate(dotState(maxNinstance)) - do phase = 1_pInt, size(phase_plasticityInstance) - if (phase_plasticity(phase) == PLASTICITY_ISOTROPIC_ID) then - instance = phase_plasticityInstance(phase) - prm => param(instance) ! shorthand pointer to parameter object of my constitutive law - prm%tau0 = config_phase(phase)%getFloat('tau0') - prm%tausat = config_phase(phase)%getFloat('tausat') - prm%gdot0 = config_phase(phase)%getFloat('gdot0') - prm%n = config_phase(phase)%getFloat('n') - prm%h0 = config_phase(phase)%getFloat('h0') - prm%fTaylor = config_phase(phase)%getFloat('m') - prm%h0_slopeLnRate = config_phase(phase)%getFloat('h0_slopelnrate', defaultVal=0.0_pReal) - prm%tausat_SinhFitA = config_phase(phase)%getFloat('tausat_sinhfita',defaultVal=0.0_pReal) - prm%tausat_SinhFitB = config_phase(phase)%getFloat('tausat_sinhfitb',defaultVal=0.0_pReal) - prm%tausat_SinhFitC = config_phase(phase)%getFloat('tausat_sinhfitc',defaultVal=0.0_pReal) - prm%tausat_SinhFitD = config_phase(phase)%getFloat('tausat_sinhfitd',defaultVal=0.0_pReal) - prm%a = config_phase(phase)%getFloat('a') - prm%aTolFlowStress = config_phase(phase)%getFloat('atol_flowstress',defaultVal=1.0_pReal) - prm%aTolShear = config_phase(phase)%getFloat('atol_shear',defaultVal=1.0e-6_pReal) - - prm%dilatation = config_phase(phase)%keyExists('/dilatation/') + do p = 1_pInt, size(phase_plasticityInstance) + if (phase_plasticity(p) /= PLASTICITY_ISOTROPIC_ID) cycle + instance = phase_plasticityInstance(p) + associate(prm => param(instance)) + prm%tau0 = config_phase(p)%getFloat('tau0') + prm%tausat = config_phase(p)%getFloat('tausat') + prm%gdot0 = config_phase(p)%getFloat('gdot0') + prm%n = config_phase(p)%getFloat('n') + prm%h0 = config_phase(p)%getFloat('h0') + prm%fTaylor = config_phase(p)%getFloat('m') + prm%h0_slopeLnRate = config_phase(p)%getFloat('h0_slopelnrate', defaultVal=0.0_pReal) + prm%tausat_SinhFitA = config_phase(p)%getFloat('tausat_sinhfita',defaultVal=0.0_pReal) + prm%tausat_SinhFitB = config_phase(p)%getFloat('tausat_sinhfitb',defaultVal=0.0_pReal) + prm%tausat_SinhFitC = config_phase(p)%getFloat('tausat_sinhfitc',defaultVal=0.0_pReal) + prm%tausat_SinhFitD = config_phase(p)%getFloat('tausat_sinhfitd',defaultVal=0.0_pReal) + prm%a = config_phase(p)%getFloat('a') + prm%aTolFlowStress = config_phase(p)%getFloat('atol_flowstress',defaultVal=1.0_pReal) + prm%aTolShear = config_phase(p)%getFloat('atol_shear',defaultVal=1.0e-6_pReal) + + prm%dilatation = config_phase(p)%keyExists('/dilatation/') #if defined(__GFORTRAN__) - outputs = ['GfortranBug86277'] - outputs = config_phase(phase)%getStrings('(output)',defaultVal=outputs) - if (outputs(1) == 'GfortranBug86277') outputs = [character(len=65536)::] + outputs = ['GfortranBug86277'] + outputs = config_phase(p)%getStrings('(output)',defaultVal=outputs) + if (outputs(1) == 'GfortranBug86277') outputs = [character(len=65536)::] #else - outputs = config_phase(phase)%getStrings('(output)',defaultVal=[character(len=65536)::]) + outputs = config_phase(p)%getStrings('(output)',defaultVal=[character(len=65536)::]) #endif - allocate(prm%outputID(0)) - do i=1_pInt, size(outputs) - select case(outputs(i)) - case ('flowstress') - plastic_isotropic_Noutput(instance) = plastic_isotropic_Noutput(instance) + 1_pInt - plastic_isotropic_output(plastic_isotropic_Noutput(instance),instance) = outputs(i) - plasticState(phase)%sizePostResults = plasticState(phase)%sizePostResults + 1_pInt - plastic_isotropic_sizePostResult(i,instance) = 1_pInt - prm%outputID = [prm%outputID,flowstress_ID] - case ('strainrate') - plastic_isotropic_Noutput(instance) = plastic_isotropic_Noutput(instance) + 1_pInt - plastic_isotropic_output(plastic_isotropic_Noutput(instance),instance) = outputs(i) - plasticState(phase)%sizePostResults = & - plasticState(phase)%sizePostResults + 1_pInt - plastic_isotropic_sizePostResult(i,instance) = 1_pInt - prm%outputID = [prm%outputID,strainrate_ID] - end select - enddo + allocate(prm%outputID(0)) + do i=1_pInt, size(outputs) + outputID = undefined_ID + select case(outputs(i)) + case ('flowstress') + outputID = flowstress_ID + case ('strainrate') + outputID = strainrate_ID + end select + + if (outputID /= undefined_ID) then + plastic_isotropic_output(i,phase_plasticityInstance(p)) = outputs(i) + plastic_isotropic_sizePostResult(i,phase_plasticityInstance(p)) = 1_pInt + prm%outputID = [prm%outputID , outputID] + endif + + enddo !-------------------------------------------------------------------------------------------------- ! sanity checks - extmsg = '' - if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//"'aTolShear' " - if (prm%tau0 < 0.0_pReal) extmsg = trim(extmsg)//"'tau0' " - if (prm%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//"'gdot0' " - if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//"'n' " - if (prm%tausat <= prm%tau0) extmsg = trim(extmsg)//"'tausat' " - if (prm%a <= 0.0_pReal) extmsg = trim(extmsg)//"'a' " - if (prm%fTaylor <= 0.0_pReal) extmsg = trim(extmsg)//"'m' " - if (prm%aTolFlowstress <= 0.0_pReal) extmsg = trim(extmsg)//"'atol_flowstress' " - if (extmsg /= '') call IO_error(211_pInt,ip=instance,& - ext_msg=trim(extmsg)//'('//PLASTICITY_ISOTROPIC_label//')') + extmsg = '' + if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//"'aTolShear' " + if (prm%tau0 < 0.0_pReal) extmsg = trim(extmsg)//"'tau0' " + if (prm%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//"'gdot0' " + if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//"'n' " + if (prm%tausat <= prm%tau0) extmsg = trim(extmsg)//"'tausat' " + if (prm%a <= 0.0_pReal) extmsg = trim(extmsg)//"'a' " + if (prm%fTaylor <= 0.0_pReal) extmsg = trim(extmsg)//"'m' " + if (prm%aTolFlowstress <= 0.0_pReal) extmsg = trim(extmsg)//"'atol_flowstress' " + if (extmsg /= '') call IO_error(211_pInt,ip=instance,& + ext_msg=trim(extmsg)//'('//PLASTICITY_ISOTROPIC_label//')') !-------------------------------------------------------------------------------------------------- ! allocate state arrays - NipcMyPhase = count(material_phase == phase) ! number of own material points (including point components ipc) + NipcMyPhase = count(material_phase == p) ! number of own material points (including point components ipc) - sizeDotState = size(["flowstress ","accumulated_shear"]) - sizeDeltaState = 0_pInt ! no sudden jumps in state - sizeState = sizeDotState + sizeDeltaState - plasticState(phase)%sizeState = sizeState - plasticState(phase)%sizeDotState = sizeDotState - plasticState(phase)%sizeDeltaState = sizeDeltaState - plasticState(phase)%nSlip = 1 - allocate(plasticState(phase)%aTolState ( sizeState)) - allocate(plasticState(phase)%state0 ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%partionedState0 ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%subState0 ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%state ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase),source=0.0_pReal) - if (any(numerics_integrator == 1_pInt)) then - allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal) - endif - if (any(numerics_integrator == 4_pInt)) & - allocate(plasticState(phase)%RK4dotState (sizeDotState,NipcMyPhase),source=0.0_pReal) - if (any(numerics_integrator == 5_pInt)) & - allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NipcMyPhase),source=0.0_pReal) + sizeDotState = size(["flowstress ","accumulated_shear"]) + sizeState = sizeDotState + call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & + 1_pInt,0_pInt,0_pInt) + !-------------------------------------------------------------------------------------------------- ! locally defined state aliases and initialization of state0 and aTolState - state(instance)%flowstress => plasticState(phase)%state (1,1:NipcMyPhase) - dotState(instance)%flowstress => plasticState(phase)%dotState (1,1:NipcMyPhase) - plasticState(phase)%state0(1,1:NipcMyPhase) = prm%tau0 - plasticState(phase)%aTolState(1) = prm%aTolFlowstress + state(instance)%flowstress => plasticState(p)%state (1,1:NipcMyPhase) + dotState(instance)%flowstress => plasticState(p)%dotState (1,1:NipcMyPhase) + plasticState(p)%state0(1,1:NipcMyPhase) = prm%tau0 + plasticState(p)%aTolState(1) = prm%aTolFlowstress - state(instance)%accumulatedShear => plasticState(phase)%state (2,1:NipcMyPhase) - dotState(instance)%accumulatedShear => plasticState(phase)%dotState (2,1:NipcMyPhase) - plasticState(phase)%state0 (2,1:NipcMyPhase) = 0.0_pReal - plasticState(phase)%aTolState(2) = prm%aTolShear - ! global alias - plasticState(phase)%slipRate => plasticState(phase)%dotState(2:2,1:NipcMyPhase) - plasticState(phase)%accumulatedSlip => plasticState(phase)%state (2:2,1:NipcMyPhase) + state(instance)%accumulatedShear => plasticState(p)%state (2,1:NipcMyPhase) + dotState(instance)%accumulatedShear => plasticState(p)%dotState (2,1:NipcMyPhase) + plasticState(p)%state0 (2,1:NipcMyPhase) = 0.0_pReal + plasticState(p)%aTolState(2) = prm%aTolShear + ! global alias + plasticState(p)%slipRate => plasticState(p)%dotState(2:2,1:NipcMyPhase) + plasticState(p)%accumulatedSlip => plasticState(p)%state (2:2,1:NipcMyPhase) + end associate -endif enddo end subroutine plastic_isotropic_init @@ -285,7 +265,6 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) ip, & !< integration point el !< element - type(tParameters), pointer :: prm real(pReal), dimension(3,3) :: & Tstar_dev_33 !< deviatoric part of the 2nd Piola Kirchhoff stress tensor as 2nd order tensor @@ -301,7 +280,7 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - prm => param(instance) + associate(prm => param(instance)) Tstar_dev_33 = math_deviatoric33(math_Mandel6to33(Tstar_v)) ! deviatoric part of 2nd Piola-Kirchhoff stress squarenorm_Tstar_dev = math_mul33xx33(Tstar_dev_33,Tstar_dev_33) @@ -338,6 +317,8 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) dLp_dTstar99 = math_Plain3333to99(gamma_dot / prm%fTaylor * & dLp_dTstar_3333 / norm_Tstar_dev) end if + + end associate end subroutine plastic_isotropic_LpAndItsTangent !-------------------------------------------------------------------------------------------------- @@ -366,8 +347,6 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar_3333,Tstar_v,ipc,ip,e ipc, & !< component-ID of integration point ip, & !< integration point el !< element - - type(tParameters), pointer :: prm real(pReal), dimension(3,3) :: & Tstar_sph_33 !< sphiatoric part of the 2nd Piola Kirchhoff stress tensor as 2nd order tensor @@ -381,7 +360,7 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar_3333,Tstar_v,ipc,ip,e of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - prm => param(instance) + associate(prm => param(instance)) Tstar_sph_33 = math_spherical33(math_Mandel6to33(Tstar_v)) ! spherical part of 2nd Piola-Kirchhoff stress squarenorm_Tstar_sph = math_mul33xx33(Tstar_sph_33,Tstar_sph_33) @@ -408,6 +387,8 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar_3333,Tstar_v,ipc,ip,e Li = 0.0_pReal dLi_dTstar_3333 = 0.0_pReal endif + + end associate end subroutine plastic_isotropic_LiAndItsTangent @@ -431,7 +412,6 @@ subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el) ipc, & !< component-ID of integration point ip, & !< integration point el !< element - type(tParameters), pointer :: prm real(pReal), dimension(6) :: & Tstar_dev_v !< deviatoric 2nd Piola Kirchhoff stress tensor in Mandel notation real(pReal) :: & @@ -445,7 +425,7 @@ subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el) of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - prm => param(instance) + associate(prm => param(instance)) !-------------------------------------------------------------------------------------------------- ! norm of (deviatoric) 2nd Piola-Kirchhoff stress @@ -485,6 +465,8 @@ subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el) dotState(instance)%flowstress (of) = hardening * gamma_dot dotState(instance)%accumulatedShear(of) = gamma_dot + + end associate end subroutine plastic_isotropic_dotState @@ -507,8 +489,6 @@ function plastic_isotropic_postResults(Tstar_v,ipc,ip,el) ipc, & !< component-ID of integration point ip, & !< integration point el !< element - - type(tParameters), pointer :: prm real(pReal), dimension(plasticState(material_phase(ipc,ip,el))%sizePostResults) :: & plastic_isotropic_postResults @@ -525,7 +505,7 @@ function plastic_isotropic_postResults(Tstar_v,ipc,ip,el) of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - prm => param(instance) + associate(prm => param(instance)) !-------------------------------------------------------------------------------------------------- ! norm of (deviatoric) 2nd Piola-Kirchhoff stress @@ -540,7 +520,7 @@ function plastic_isotropic_postResults(Tstar_v,ipc,ip,el) c = 0_pInt plastic_isotropic_postResults = 0.0_pReal - outputsLoop: do o = 1_pInt,plastic_isotropic_Noutput(instance) + outputsLoop: do o = 1_pInt,size(prm%outputID) select case(prm%outputID(o)) case (flowstress_ID) plastic_isotropic_postResults(c+1_pInt) = state(instance)%flowstress(of) @@ -553,6 +533,8 @@ function plastic_isotropic_postResults(Tstar_v,ipc,ip,el) c = c + 1_pInt end select enddo outputsLoop + + end associate end function plastic_isotropic_postResults From a992b8b1f5d3b170d2b0a53cb0346e07573b9fb4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 11:41:22 +0100 Subject: [PATCH 124/147] random order caused test to fail rather a workaround, but since HDF5 is coming... --- processing/post/addMises.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/processing/post/addMises.py b/processing/post/addMises.py index 55cf6552e..5a851fc5a 100755 --- a/processing/post/addMises.py +++ b/processing/post/addMises.py @@ -4,6 +4,7 @@ import os,sys,math import numpy as np from optparse import OptionParser +from collections import OrderedDict import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] @@ -63,10 +64,10 @@ for name in filenames: # ------------------------------------------ sanity checks ---------------------------------------- - items = { + items = OrderedDict({ 'strain': {'dim': 9, 'shape': [3,3], 'labels':options.strain, 'active':[], 'column': []}, 'stress': {'dim': 9, 'shape': [3,3], 'labels':options.stress, 'active':[], 'column': []}, - } + }) errors = [] remarks = [] From 8f99f1ce61c4a3d5bbe22e879f8634f96814482b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 12:35:26 +0100 Subject: [PATCH 125/147] avoid conversion 33<->6 3333<->9 --- src/constitutive.f90 | 9 +++-- src/plastic_isotropic.f90 | 81 +++++++++++++++++---------------------- 2 files changed, 41 insertions(+), 49 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index ce98ced36..7d57299ee 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -479,8 +479,7 @@ subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, S6, Fi, ipc, ip, e dLp_dMp = 0.0_pReal case (PLASTICITY_ISOTROPIC_ID) plasticityType - call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp99, math_Mandel33to6(Mp),ipc,ip,el) - dLp_dMp = math_Plain99to3333(dLp_dMp99) ! ToDo: We revert here the last statement in plastic_xx_LpAndItsTanget + call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp,Mp,ipc,ip,el) case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType of = phasememberAt(ipc,ip,el) @@ -527,6 +526,7 @@ end subroutine constitutive_LpAndItsTangents !-------------------------------------------------------------------------------------------------- !> @brief contains the constitutive equation for calculating the velocity gradient +! ToDo: MD: S is Mi? !-------------------------------------------------------------------------------------------------- subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, el) use prec, only: & @@ -535,7 +535,8 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e math_I3, & math_inv33, & math_det33, & - math_mul33x33 + math_mul33x33, & + math_Mandel6to33 use material, only: & phase_plasticity, & material_phase, & @@ -588,7 +589,7 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el))) case (PLASTICITY_isotropic_ID) plasticityType - call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S6, ipc, ip, el) + call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, math_Mandel6to33(S6), ipc, ip, el) case default plasticityType my_Li = 0.0_pReal my_dLi_dS = 0.0_pReal diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index da7f5cc0f..ce748212d 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -231,7 +231,7 @@ end subroutine plastic_isotropic_init !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- -subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) +subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ipc,ip,el) use debug, only: & debug_level, & debug_constitutive, & @@ -242,9 +242,6 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) debug_i, & debug_g use math, only: & - math_mul6x6, & - math_Mandel6to33, & - math_Plain3333to99, & math_deviatoric33, & math_mul33xx33 use material, only: & @@ -253,13 +250,13 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) phase_plasticityInstance implicit none - real(pReal), dimension(3,3), intent(out) :: & + real(pReal), dimension(3,3), intent(out) :: & Lp !< plastic velocity gradient - real(pReal), dimension(9,9), intent(out) :: & - dLp_dTstar99 !< derivative of Lp with respect to 2nd Piola Kirchhoff stress + real(pReal), dimension(3,3,3,3), intent(out) :: & + dLp_dMp !< derivative of Lp with respect to the Mandel stress - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation + real(pReal), dimension(3,3), intent(in) :: & + Mp integer(pInt), intent(in) :: & ipc, & !< component-ID of integration point ip, & !< integration point @@ -267,13 +264,11 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) real(pReal), dimension(3,3) :: & - Tstar_dev_33 !< deviatoric part of the 2nd Piola Kirchhoff stress tensor as 2nd order tensor - real(pReal), dimension(3,3,3,3) :: & - dLp_dTstar_3333 !< derivative of Lp with respect to Tstar as 4th order tensor + Mp_dev !< deviatoric part of the Mandel stress real(pReal) :: & gamma_dot, & !< strainrate - norm_Tstar_dev, & !< euclidean norm of Tstar_dev - squarenorm_Tstar_dev !< square of the euclidean norm of Tstar_dev + norm_Mp_dev, & !< euclidean norm of the Mandel stress + squarenorm_Mp_dev !< square of the euclidean norm of the Mandel stress integer(pInt) :: & instance, of, & k, l, m, n @@ -282,40 +277,38 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) instance = phase_plasticityInstance(material_phase(ipc,ip,el)) associate(prm => param(instance)) - Tstar_dev_33 = math_deviatoric33(math_Mandel6to33(Tstar_v)) ! deviatoric part of 2nd Piola-Kirchhoff stress - squarenorm_Tstar_dev = math_mul33xx33(Tstar_dev_33,Tstar_dev_33) - norm_Tstar_dev = sqrt(squarenorm_Tstar_dev) + Mp_dev = math_deviatoric33(Mp) + squarenorm_Mp_dev = math_mul33xx33(Mp_dev,Mp_dev) + norm_Mp_dev = sqrt(squarenorm_Mp_dev) - if (norm_Tstar_dev <= 0.0_pReal) then ! Tstar == 0 --> both Lp and dLp_dTstar are zero + if (norm_Mp_dev <= 0.0_pReal) then Lp = 0.0_pReal - dLp_dTstar99 = 0.0_pReal + dLp_dMp = 0.0_pReal else gamma_dot = prm%gdot0 & - * ( sqrt(1.5_pReal) * norm_Tstar_dev / prm%fTaylor / state(instance)%flowstress(of) ) & + * ( sqrt(1.5_pReal) * norm_Mp_dev / prm%fTaylor / state(instance)%flowstress(of) ) & **prm%n - Lp = Tstar_dev_33/norm_Tstar_dev * gamma_dot/prm%fTaylor + Lp = Mp_dev/norm_Mp_dev * gamma_dot/prm%fTaylor if (iand(debug_level(debug_constitutive), debug_levelExtensive) /= 0_pInt & .and. ((el == debug_e .and. ip == debug_i .and. ipc == debug_g) & .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt)) then write(6,'(a,i8,1x,i2,1x,i3)') '<< CONST isotropic >> at el ip g ',el,ip,ipc write(6,'(/,a,/,3(12x,3(f12.4,1x)/))') '<< CONST isotropic >> Tstar (dev) / MPa', & - transpose(Tstar_dev_33(1:3,1:3))*1.0e-6_pReal - write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> norm Tstar / MPa', norm_Tstar_dev*1.0e-6_pReal + transpose(Mp_dev)*1.0e-6_pReal + write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> norm Tstar / MPa', norm_Mp_dev*1.0e-6_pReal write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> gdot', gamma_dot end if !-------------------------------------------------------------------------------------------------- ! Calculation of the tangent of Lp forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & - dLp_dTstar_3333(k,l,m,n) = (prm%n-1.0_pReal) * & - Tstar_dev_33(k,l)*Tstar_dev_33(m,n) / squarenorm_Tstar_dev + dLp_dMp(k,l,m,n) = (prm%n-1.0_pReal) * Mp_dev(k,l)*Mp_dev(m,n) / squarenorm_Mp_dev forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) & - dLp_dTstar_3333(k,l,k,l) = dLp_dTstar_3333(k,l,k,l) + 1.0_pReal + dLp_dMp(k,l,k,l) = dLp_dMp(k,l,k,l) + 1.0_pReal forall (k=1_pInt:3_pInt,m=1_pInt:3_pInt) & - dLp_dTstar_3333(k,k,m,m) = dLp_dTstar_3333(k,k,m,m) - 1.0_pReal/3.0_pReal - dLp_dTstar99 = math_Plain3333to99(gamma_dot / prm%fTaylor * & - dLp_dTstar_3333 / norm_Tstar_dev) + dLp_dMp(k,k,m,m) = dLp_dMp(k,k,m,m) - 1.0_pReal/3.0_pReal + dLp_dMp = gamma_dot / prm%fTaylor * dLp_dMp / norm_Mp_dev end if end associate @@ -324,7 +317,7 @@ end subroutine plastic_isotropic_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- -subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar_3333,Tstar_v,ipc,ip,el) +subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,ipc,ip,el) use math, only: & math_mul6x6, & math_Mandel6to33, & @@ -340,16 +333,16 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar_3333,Tstar_v,ipc,ip,e real(pReal), dimension(3,3), intent(out) :: & Li !< plastic velocity gradient real(pReal), dimension(3,3,3,3), intent(out) :: & - dLi_dTstar_3333 !< derivative of Li with respect to Tstar as 4th order tensor - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation + dLi_dTstar !< derivative of Li with respect to Tstar as 4th order tensor + real(pReal), dimension(3,3), intent(in) :: & + Tstar !< 2nd Piola Kirchhoff stress tensor in Mandel notation integer(pInt), intent(in) :: & ipc, & !< component-ID of integration point ip, & !< integration point el !< element real(pReal), dimension(3,3) :: & - Tstar_sph_33 !< sphiatoric part of the 2nd Piola Kirchhoff stress tensor as 2nd order tensor + Tstar_sph !< sphiatoric part of the 2nd Piola Kirchhoff stress tensor as 2nd order tensor real(pReal) :: & gamma_dot, & !< strainrate norm_Tstar_sph, & !< euclidean norm of Tstar_sph @@ -362,30 +355,28 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar_3333,Tstar_v,ipc,ip,e instance = phase_plasticityInstance(material_phase(ipc,ip,el)) associate(prm => param(instance)) - Tstar_sph_33 = math_spherical33(math_Mandel6to33(Tstar_v)) ! spherical part of 2nd Piola-Kirchhoff stress - squarenorm_Tstar_sph = math_mul33xx33(Tstar_sph_33,Tstar_sph_33) + Tstar_sph = math_spherical33(Tstar) + squarenorm_Tstar_sph = math_mul33xx33(Tstar_sph,Tstar_sph) norm_Tstar_sph = sqrt(squarenorm_Tstar_sph) - if (prm%dilatation .and. norm_Tstar_sph > 0.0_pReal) then ! Tstar == 0 or J2 plascitiy --> both Li and dLi_dTstar are zero + if (prm%dilatation .and. norm_Tstar_sph > 0.0_pReal) then ! Tstar == 0 or J2 plascitiy --> both Li and dLi_dTstar are zero gamma_dot = prm%gdot0 & * (sqrt(1.5_pReal) * norm_Tstar_sph / prm%fTaylor / state(instance)%flowstress(of) ) & **prm%n - Li = Tstar_sph_33/norm_Tstar_sph * gamma_dot/prm%fTaylor + Li = Tstar_sph/norm_Tstar_sph * gamma_dot/prm%fTaylor !-------------------------------------------------------------------------------------------------- ! Calculation of the tangent of Li forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & - dLi_dTstar_3333(k,l,m,n) = (prm%n-1.0_pReal) * & - Tstar_sph_33(k,l)*Tstar_sph_33(m,n) / squarenorm_Tstar_sph + dLi_dTstar(k,l,m,n) = (prm%n-1.0_pReal) * Tstar_sph(k,l)*Tstar_sph(m,n) / squarenorm_Tstar_sph forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) & - dLi_dTstar_3333(k,l,k,l) = dLi_dTstar_3333(k,l,k,l) + 1.0_pReal + dLi_dTstar(k,l,k,l) = dLi_dTstar(k,l,k,l) + 1.0_pReal - dLi_dTstar_3333 = gamma_dot / prm%fTaylor * & - dLi_dTstar_3333 / norm_Tstar_sph + dLi_dTstar = gamma_dot / prm%fTaylor * dLi_dTstar / norm_Tstar_sph else - Li = 0.0_pReal - dLi_dTstar_3333 = 0.0_pReal + Li = 0.0_pReal + dLi_dTstar = 0.0_pReal endif end associate From b53cda6411f28dc76c8c5aba019d91561daa3c70 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 14:01:05 +0100 Subject: [PATCH 126/147] figuring out "instance" and "of" centrally --- src/constitutive.f90 | 20 ++++++++++++-------- src/plastic_isotropic.f90 | 37 ++++++++++++++----------------------- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index 7d57299ee..a33570482 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -538,6 +538,9 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e math_mul33x33, & math_Mandel6to33 use material, only: & + phasememberAt, & + phase_plasticity, & + phase_plasticityInstance, & phase_plasticity, & material_phase, & phase_kinematics, & @@ -569,19 +572,18 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e real(pReal), intent(out), dimension(3,3,3,3) :: & dLi_dS, & !< derivative of Li with respect to S dLi_dFi + real(pReal), dimension(3,3) :: & - my_Li !< intermediate velocity gradient - real(pReal), dimension(3,3,3,3) :: & - my_dLi_dS - real(pReal), dimension(3,3) :: & + my_Li, & !< intermediate velocity gradient FiInv, & temp_33 + real(pReal), dimension(3,3,3,3) :: & + my_dLi_dS real(pReal) :: & detFi integer(pInt) :: & - k !< counter in kinematics loop - integer(pInt) :: & - i, j + k, i, j, & + instance, of Li = 0.0_pReal dLi_dS = 0.0_pReal @@ -589,7 +591,9 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, S6, Fi, ipc, ip, e plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el))) case (PLASTICITY_isotropic_ID) plasticityType - call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, math_Mandel6to33(S6), ipc, ip, el) + of = phasememberAt(ipc,ip,el) + instance = phase_plasticityInstance(material_phase(ipc,ip,el)) + call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, math_Mandel6to33(S6),instance,of) case default plasticityType my_Li = 0.0_pReal my_dLi_dS = 0.0_pReal diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index ce748212d..3268c5329 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -314,46 +314,37 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ipc,ip,el) end associate end subroutine plastic_isotropic_LpAndItsTangent + !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- -subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,ipc,ip,el) +subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) use math, only: & - math_mul6x6, & - math_Mandel6to33, & - math_Plain3333to99, & math_spherical33, & math_mul33xx33 - use material, only: & - phasememberAt, & - material_phase, & - phase_plasticityInstance implicit none real(pReal), dimension(3,3), intent(out) :: & - Li !< plastic velocity gradient + Li !< inleastic velocity gradient real(pReal), dimension(3,3,3,3), intent(out) :: & - dLi_dTstar !< derivative of Li with respect to Tstar as 4th order tensor - real(pReal), dimension(3,3), intent(in) :: & - Tstar !< 2nd Piola Kirchhoff stress tensor in Mandel notation - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element + dLi_dTstar !< derivative of Li with respect to the Mandel stress + real(pReal), dimension(3,3), intent(in) :: & + Tstar !< Mandel stress + integer(pInt), intent(in) :: & + instance, & + of + real(pReal), dimension(3,3) :: & - Tstar_sph !< sphiatoric part of the 2nd Piola Kirchhoff stress tensor as 2nd order tensor + Tstar_sph !< sphiatoric part of the Mandel stress real(pReal) :: & gamma_dot, & !< strainrate norm_Tstar_sph, & !< euclidean norm of Tstar_sph squarenorm_Tstar_sph !< square of the euclidean norm of Tstar_sph integer(pInt) :: & - instance, of, & k, l, m, n - of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember - instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - associate(prm => param(instance)) + associate(prm => param(instance), stt => state(instance)) Tstar_sph = math_spherical33(Tstar) squarenorm_Tstar_sph = math_mul33xx33(Tstar_sph,Tstar_sph) @@ -361,8 +352,7 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,ipc,ip,el) if (prm%dilatation .and. norm_Tstar_sph > 0.0_pReal) then ! Tstar == 0 or J2 plascitiy --> both Li and dLi_dTstar are zero gamma_dot = prm%gdot0 & - * (sqrt(1.5_pReal) * norm_Tstar_sph / prm%fTaylor / state(instance)%flowstress(of) ) & - **prm%n + * (sqrt(1.5_pReal) * norm_Tstar_sph / prm%fTaylor / stt%flowstress(of) ) **prm%n Li = Tstar_sph/norm_Tstar_sph * gamma_dot/prm%fTaylor @@ -380,6 +370,7 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,ipc,ip,el) endif end associate + end subroutine plastic_isotropic_LiAndItsTangent From 892ba86d260ae8f6346b472bbdad0c207d7c31b6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 14:37:31 +0100 Subject: [PATCH 127/147] consistent API --- src/constitutive.f90 | 2 +- src/plastic_isotropic.f90 | 68 ++++++++++++++++----------------------- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index a33570482..415e3988c 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -861,7 +861,7 @@ subroutine constitutive_collectDotState(S6, FeArray, Fi, FpArray, subdt, subfrac plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el))) case (PLASTICITY_ISOTROPIC_ID) plasticityType - call plastic_isotropic_dotState (math_Mandel33to6(Mp),ipc,ip,el) + call plastic_isotropic_dotState (Mp,ipc,ip,el) case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType of = phasememberAt(ipc,ip,el) diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index 3268c5329..da5e4475c 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -300,8 +300,7 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ipc,ip,el) write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> norm Tstar / MPa', norm_Mp_dev*1.0e-6_pReal write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> gdot', gamma_dot end if -!-------------------------------------------------------------------------------------------------- -! Calculation of the tangent of Lp + forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dMp(k,l,m,n) = (prm%n-1.0_pReal) * Mp_dev(k,l)*Mp_dev(m,n) / squarenorm_Mp_dev forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) & @@ -312,6 +311,7 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ipc,ip,el) end if end associate + end subroutine plastic_isotropic_LpAndItsTangent @@ -331,7 +331,7 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) real(pReal), dimension(3,3), intent(in) :: & Tstar !< Mandel stress - integer(pInt), intent(in) :: & + integer(pInt), intent(in) :: & instance, & of @@ -350,14 +350,10 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) squarenorm_Tstar_sph = math_mul33xx33(Tstar_sph,Tstar_sph) norm_Tstar_sph = sqrt(squarenorm_Tstar_sph) - if (prm%dilatation .and. norm_Tstar_sph > 0.0_pReal) then ! Tstar == 0 or J2 plascitiy --> both Li and dLi_dTstar are zero - gamma_dot = prm%gdot0 & - * (sqrt(1.5_pReal) * norm_Tstar_sph / prm%fTaylor / stt%flowstress(of) ) **prm%n + if (prm%dilatation .and. norm_Tstar_sph > 0.0_pReal) then ! no stress or J2 plastitiy --> Li and its derivative are zero + gamma_dot = prm%gdot0 * (sqrt(1.5_pReal) * norm_Tstar_sph /(prm%fTaylor*stt%flowstress(of))) **prm%n Li = Tstar_sph/norm_Tstar_sph * gamma_dot/prm%fTaylor - - !-------------------------------------------------------------------------------------------------- - ! Calculation of the tangent of Li forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLi_dTstar(k,l,m,n) = (prm%n-1.0_pReal) * Tstar_sph(k,l)*Tstar_sph(m,n) / squarenorm_Tstar_sph forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) & @@ -365,8 +361,8 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) dLi_dTstar = gamma_dot / prm%fTaylor * dLi_dTstar / norm_Tstar_sph else - Li = 0.0_pReal - dLi_dTstar = 0.0_pReal + Li = 0.0_pReal + dLi_dTstar = 0.0_pReal endif end associate @@ -377,52 +373,46 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) !-------------------------------------------------------------------------------------------------- !> @brief calculates the rate of change of microstructure !-------------------------------------------------------------------------------------------------- -subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el) +subroutine plastic_isotropic_dotState(Mp,ipc,ip,el) use prec, only: & dEq0 use math, only: & - math_mul6x6 + math_mul33xx33, & + math_deviatoric33 use material, only: & phasememberAt, & material_phase, & phase_plasticityInstance implicit none - real(pReal), dimension(6), intent(in):: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation + real(pReal), dimension(3,3), intent(in) :: & + Mp !< Mandel stress integer(pInt), intent(in) :: & ipc, & !< component-ID of integration point ip, & !< integration point el !< element - real(pReal), dimension(6) :: & - Tstar_dev_v !< deviatoric 2nd Piola Kirchhoff stress tensor in Mandel notation real(pReal) :: & gamma_dot, & !< strainrate hardening, & !< hardening coefficient saturation, & !< saturation flowstress - norm_Tstar_v !< euclidean norm of Tstar_dev + norm_Mp !< norm of the Mandel stress integer(pInt) :: & - instance, & !< instance of my instance (unique number of my constitutive model) + instance, & of !< shortcut notation for offset position in state array of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - associate(prm => param(instance)) + associate(prm => param(instance), stt => state(instance), dot => dotState(instance)) !-------------------------------------------------------------------------------------------------- -! norm of (deviatoric) 2nd Piola-Kirchhoff stress +! norm of (deviatoric) Mandel stress if (prm%dilatation) then - norm_Tstar_v = sqrt(math_mul6x6(Tstar_v,Tstar_v)) + norm_Mp = sqrt(math_mul33xx33(Mp,Mp)) else - Tstar_dev_v(1:3) = Tstar_v(1:3) - sum(Tstar_v(1:3))/3.0_pReal - Tstar_dev_v(4:6) = Tstar_v(4:6) - norm_Tstar_v = sqrt(math_mul6x6(Tstar_dev_v,Tstar_dev_v)) - end if -!-------------------------------------------------------------------------------------------------- -! strain rate - gamma_dot = prm%gdot0 * ( sqrt(1.5_pReal) * norm_Tstar_v & - / &!----------------------------------------------------------------------------------- - (prm%fTaylor*state(instance)%flowstress(of) ))**prm%n + norm_Mp = sqrt(math_mul33xx33(math_deviatoric33(Mp),math_deviatoric33(Mp))) + endif + + gamma_dot = prm%gdot0 * (sqrt(1.5_pReal) * norm_Mp /(prm%fTaylor*stt%flowstress(of))) **prm%n !-------------------------------------------------------------------------------------------------- ! hardening coefficient @@ -431,27 +421,25 @@ subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el) saturation = prm%tausat else saturation = prm%tausat & - + asinh( (gamma_dot / prm%tausat_SinhFitA& - )**(1.0_pReal / prm%tausat_SinhFitD)& + + asinh( (gamma_dot / prm%tausat_SinhFitA)**(1.0_pReal / prm%tausat_SinhFitD) & )**(1.0_pReal / prm%tausat_SinhFitC) & - / ( prm%tausat_SinhFitB & - * (gamma_dot / prm%gdot0)**(1.0_pReal / prm%n) & - ) + / prm%tausat_SinhFitB * (gamma_dot / prm%gdot0)**(1.0_pReal / prm%n) endif hardening = ( prm%h0 + prm%h0_slopeLnRate * log(gamma_dot) ) & - * abs( 1.0_pReal - state(instance)%flowstress(of)/saturation )**prm%a & - * sign(1.0_pReal, 1.0_pReal - state(instance)%flowstress(of)/saturation) + * abs( 1.0_pReal - stt%flowstress(of)/saturation )**prm%a & + * sign(1.0_pReal, 1.0_pReal - stt%flowstress(of)/saturation) else hardening = 0.0_pReal endif - dotState(instance)%flowstress (of) = hardening * gamma_dot - dotState(instance)%accumulatedShear(of) = gamma_dot + dot%flowstress (of) = hardening * gamma_dot + dot%accumulatedShear(of) = gamma_dot end associate end subroutine plastic_isotropic_dotState + !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- From e217ce3a25e01047e88e4b043acf51627e596515 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 15:04:04 +0100 Subject: [PATCH 128/147] fixed output and a few more changes following phenopowerlaw --- src/constitutive.f90 | 2 +- src/plastic_isotropic.f90 | 37 ++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index 415e3988c..8ea61e2ae 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -1074,7 +1074,7 @@ function constitutive_postResults(S6, Fi, FeArray, ipc, ip, el) plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el))) case (PLASTICITY_ISOTROPIC_ID) plasticityType constitutive_postResults(startPos:endPos) = & - plastic_isotropic_postResults(S6,ipc,ip,el) + plastic_isotropic_postResults(Mp,ipc,ip,el) case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType of = phasememberAt(ipc,ip,el) diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index da5e4475c..4be7c8e46 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -200,10 +200,11 @@ subroutine plastic_isotropic_init() ! allocate state arrays NipcMyPhase = count(material_phase == p) ! number of own material points (including point components ipc) - sizeDotState = size(["flowstress ","accumulated_shear"]) - sizeState = sizeDotState + sizeDotState = size(["flowstress ","accumulated_shear"]) + sizeState = sizeDotState call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & 1_pInt,0_pInt,0_pInt) + plasticState(p)%sizePostResults = sum(plastic_isotropic_sizePostResult(:,phase_plasticityInstance(p))) !-------------------------------------------------------------------------------------------------- @@ -330,7 +331,7 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) dLi_dTstar !< derivative of Li with respect to the Mandel stress real(pReal), dimension(3,3), intent(in) :: & - Tstar !< Mandel stress + Tstar !< Mandel stress ToDo: Mi? integer(pInt), intent(in) :: & instance, & of @@ -443,9 +444,10 @@ end subroutine plastic_isotropic_dotState !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -function plastic_isotropic_postResults(Tstar_v,ipc,ip,el) +function plastic_isotropic_postResults(Mp,ipc,ip,el) use math, only: & - math_mul6x6 + math_mul33xx33, & + math_deviatoric33 use material, only: & plasticState, & material_phase, & @@ -453,20 +455,19 @@ function plastic_isotropic_postResults(Tstar_v,ipc,ip,el) phase_plasticityInstance implicit none - real(pReal), dimension(6), intent(in) :: & - Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation + real(pReal), dimension(3,3), intent(in) :: & + Mp !< Mandel stress integer(pInt), intent(in) :: & ipc, & !< component-ID of integration point ip, & !< integration point el !< element - real(pReal), dimension(plasticState(material_phase(ipc,ip,el))%sizePostResults) :: & - plastic_isotropic_postResults + real(pReal), dimension(sum(plastic_isotropic_sizePostResult(:,phase_plasticityInstance(material_phase(ipc,ip,el))))) :: & + plastic_isotropic_postResults + - real(pReal), dimension(6) :: & - Tstar_dev_v !< deviatoric 2nd Piola Kirchhoff stress tensor in Mandel notation real(pReal) :: & - norm_Tstar_v ! euclidean norm of Tstar_dev + norm_Mp !< norm of the Mandel stress integer(pInt) :: & instance, & !< instance of my instance (unique number of my constitutive model) of, & !< shortcut notation for offset position in state array @@ -478,14 +479,12 @@ function plastic_isotropic_postResults(Tstar_v,ipc,ip,el) associate(prm => param(instance)) !-------------------------------------------------------------------------------------------------- -! norm of (deviatoric) 2nd Piola-Kirchhoff stress +! norm of (deviatoric) Mandel stress if (prm%dilatation) then - norm_Tstar_v = sqrt(math_mul6x6(Tstar_v,Tstar_v)) + norm_Mp = sqrt(math_mul33xx33(Mp,Mp)) else - Tstar_dev_v(1:3) = Tstar_v(1:3) - sum(Tstar_v(1:3))/3.0_pReal - Tstar_dev_v(4:6) = Tstar_v(4:6) - norm_Tstar_v = sqrt(math_mul6x6(Tstar_dev_v,Tstar_dev_v)) - end if + norm_Mp = sqrt(math_mul33xx33(math_deviatoric33(Mp),math_deviatoric33(Mp))) + endif c = 0_pInt plastic_isotropic_postResults = 0.0_pReal @@ -497,7 +496,7 @@ function plastic_isotropic_postResults(Tstar_v,ipc,ip,el) c = c + 1_pInt case (strainrate_ID) plastic_isotropic_postResults(c+1_pInt) = & - prm%gdot0 * ( sqrt(1.5_pReal) * norm_Tstar_v & + prm%gdot0 * ( sqrt(1.5_pReal) * norm_Mp & / &!---------------------------------------------------------------------------------- (prm%fTaylor * state(instance)%flowstress(of)) ) ** prm%n c = c + 1_pInt From 311b8be715dd6bfbef258b09e9ea35d2d0828cc2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 15:14:43 +0100 Subject: [PATCH 129/147] simplifying --- src/constitutive.f90 | 6 ++-- src/plastic_isotropic.f90 | 67 ++++++++++++----------------------- src/plastic_phenopowerlaw.f90 | 1 - 3 files changed, 26 insertions(+), 48 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index 8ea61e2ae..651ce1cc3 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -861,7 +861,7 @@ subroutine constitutive_collectDotState(S6, FeArray, Fi, FpArray, subdt, subfrac plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el))) case (PLASTICITY_ISOTROPIC_ID) plasticityType - call plastic_isotropic_dotState (Mp,ipc,ip,el) + call plastic_isotropic_dotState (Mp,instance,of) case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType of = phasememberAt(ipc,ip,el) @@ -1073,8 +1073,10 @@ function constitutive_postResults(S6, Fi, FeArray, ipc, ip, el) plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el))) case (PLASTICITY_ISOTROPIC_ID) plasticityType + of = phasememberAt(ipc,ip,el) + instance = phase_plasticityInstance(material_phase(ipc,ip,el)) constitutive_postResults(startPos:endPos) = & - plastic_isotropic_postResults(Mp,ipc,ip,el) + plastic_isotropic_postResults(Mp,instance,of) case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType of = phasememberAt(ipc,ip,el) diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index 4be7c8e46..5196496f3 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -374,35 +374,27 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) !-------------------------------------------------------------------------------------------------- !> @brief calculates the rate of change of microstructure !-------------------------------------------------------------------------------------------------- -subroutine plastic_isotropic_dotState(Mp,ipc,ip,el) +subroutine plastic_isotropic_dotState(Mp,instance,of) use prec, only: & dEq0 use math, only: & math_mul33xx33, & math_deviatoric33 - use material, only: & - phasememberAt, & - material_phase, & - phase_plasticityInstance - + implicit none - real(pReal), dimension(3,3), intent(in) :: & - Mp !< Mandel stress - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element + real(pReal), dimension(3,3), intent(in) :: & + Mp !< Mandel stress + integer(pInt), intent(in) :: & + instance, & + of + real(pReal) :: & gamma_dot, & !< strainrate hardening, & !< hardening coefficient saturation, & !< saturation flowstress norm_Mp !< norm of the Mandel stress - integer(pInt) :: & - instance, & - of !< shortcut notation for offset position in state array - of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember - instance = phase_plasticityInstance(material_phase(ipc,ip,el)) + associate(prm => param(instance), stt => state(instance), dot => dotState(instance)) !-------------------------------------------------------------------------------------------------- @@ -444,39 +436,27 @@ end subroutine plastic_isotropic_dotState !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- -function plastic_isotropic_postResults(Mp,ipc,ip,el) +function plastic_isotropic_postResults(Mp,instance,of) result(postResults) use math, only: & math_mul33xx33, & math_deviatoric33 - use material, only: & - plasticState, & - material_phase, & - phasememberAt, & - phase_plasticityInstance implicit none - real(pReal), dimension(3,3), intent(in) :: & - Mp !< Mandel stress - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element - - real(pReal), dimension(sum(plastic_isotropic_sizePostResult(:,phase_plasticityInstance(material_phase(ipc,ip,el))))) :: & - plastic_isotropic_postResults + real(pReal), dimension(3,3), intent(in) :: & + Mp !< Mandel stress + integer(pInt), intent(in) :: & + instance, & + of + real(pReal), dimension(sum(plastic_isotropic_sizePostResult(:,instance))) :: & + postResults real(pReal) :: & norm_Mp !< norm of the Mandel stress integer(pInt) :: & - instance, & !< instance of my instance (unique number of my constitutive model) - of, & !< shortcut notation for offset position in state array - c, & - o + o,c - of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember - instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - associate(prm => param(instance)) + associate(prm => param(instance), stt => state(instance)) !-------------------------------------------------------------------------------------------------- ! norm of (deviatoric) Mandel stress @@ -487,18 +467,15 @@ function plastic_isotropic_postResults(Mp,ipc,ip,el) endif c = 0_pInt - plastic_isotropic_postResults = 0.0_pReal outputsLoop: do o = 1_pInt,size(prm%outputID) select case(prm%outputID(o)) case (flowstress_ID) - plastic_isotropic_postResults(c+1_pInt) = state(instance)%flowstress(of) + postResults(c+1_pInt) = stt%flowstress(of) c = c + 1_pInt case (strainrate_ID) - plastic_isotropic_postResults(c+1_pInt) = & - prm%gdot0 * ( sqrt(1.5_pReal) * norm_Mp & - / &!---------------------------------------------------------------------------------- - (prm%fTaylor * state(instance)%flowstress(of)) ) ** prm%n + postResults(c+1_pInt) = prm%gdot0 & + * (sqrt(1.5_pReal) * norm_Mp /(prm%fTaylor * stt%flowstress(of)))**prm%n c = c + 1_pInt end select enddo outputsLoop diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 9ba8dfc01..ce4f8b7f0 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -532,7 +532,6 @@ function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) real(pReal), dimension(param(instance)%totalNslip) :: & gdot_slip_pos,gdot_slip_neg - postResults = 0.0_pReal c = 0_pInt associate( prm => param(instance), stt => state(instance)) From 53d2d4e23de46d35b19835e93d78444371252add Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 16:09:51 +0100 Subject: [PATCH 130/147] re-enabled debug output --- src/constitutive.f90 | 4 +- src/plastic_isotropic.f90 | 87 ++++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index 651ce1cc3..cc5c6f3f8 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -479,7 +479,9 @@ subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, S6, Fi, ipc, ip, e dLp_dMp = 0.0_pReal case (PLASTICITY_ISOTROPIC_ID) plasticityType - call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp,Mp,ipc,ip,el) + of = phasememberAt(ipc,ip,el) + instance = phase_plasticityInstance(material_phase(ipc,ip,el)) + call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp,Mp,instance,of) case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType of = phasememberAt(ipc,ip,el) diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index 5196496f3..c55a34419 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -26,7 +26,7 @@ module plastic_isotropic end enum type, private :: tParameters - real(pReal) :: & + real(pReal) :: & fTaylor, & !< Taylor factor tau0, & !< initial critical stress gdot0, & !< reference strain rate @@ -41,9 +41,11 @@ module plastic_isotropic tausat_SinhFitD, & aTolFlowstress, & aTolShear - integer(kind(undefined_ID)), allocatable, dimension(:) :: & + integer(pInt) :: & + of_debug = 0_pInt + integer(kind(undefined_ID)), allocatable, dimension(:) :: & outputID - logical :: & + logical :: & dilatation end type @@ -80,8 +82,14 @@ subroutine plastic_isotropic_init() compiler_options #endif use debug, only: & +#ifdef DEBUG + debug_e, & + debug_i, & + debug_g, & + debug_levelExtensive, & +#endif debug_level, & - debug_constitutive, & + debug_constitutive,& debug_levelBasic use math, only: & math_Mandel3333to66, & @@ -90,6 +98,9 @@ subroutine plastic_isotropic_init() IO_error, & IO_timeStamp use material, only: & +#ifdef DEBUG + phasememberAt, & +#endif phase_plasticity, & phase_plasticityInstance, & phase_Noutput, & @@ -127,7 +138,7 @@ subroutine plastic_isotropic_init() if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance -! public variables + allocate(plastic_isotropic_sizePostResult(maxval(phase_Noutput), maxNinstance),source=0_pInt) allocate(plastic_isotropic_output(maxval(phase_Noutput), maxNinstance)) plastic_isotropic_output = '' @@ -140,6 +151,13 @@ subroutine plastic_isotropic_init() if (phase_plasticity(p) /= PLASTICITY_ISOTROPIC_ID) cycle instance = phase_plasticityInstance(p) associate(prm => param(instance)) + +#ifdef DEBUG + if (p==material_phase(debug_g,debug_i,debug_e)) then + prm%of_debug = phasememberAt(debug_g,debug_i,debug_e) + endif +#endif + prm%tau0 = config_phase(p)%getFloat('tau0') prm%tausat = config_phase(p)%getFloat('tausat') prm%gdot0 = config_phase(p)%getFloat('gdot0') @@ -232,23 +250,17 @@ end subroutine plastic_isotropic_init !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- -subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ipc,ip,el) +subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) +#ifdef DEBUG use debug, only: & debug_level, & - debug_constitutive, & - debug_levelBasic, & + debug_constitutive,& debug_levelExtensive, & - debug_levelSelective, & - debug_e, & - debug_i, & - debug_g + debug_levelSelective +#endif use math, only: & math_deviatoric33, & math_mul33xx33 - use material, only: & - phasememberAt, & - material_phase, & - phase_plasticityInstance implicit none real(pReal), dimension(3,3), intent(out) :: & @@ -257,51 +269,41 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ipc,ip,el) dLp_dMp !< derivative of Lp with respect to the Mandel stress real(pReal), dimension(3,3), intent(in) :: & - Mp + Mp !< Mandel stress integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el !< element + instance, & + of - real(pReal), dimension(3,3) :: & Mp_dev !< deviatoric part of the Mandel stress real(pReal) :: & gamma_dot, & !< strainrate - norm_Mp_dev, & !< euclidean norm of the Mandel stress - squarenorm_Mp_dev !< square of the euclidean norm of the Mandel stress + norm_Mp_dev, & !< norm of the deviatoric part of the Mandel stress + squarenorm_Mp_dev !< square of the norm of the deviatoric part of the Mandel stress integer(pInt) :: & - instance, of, & k, l, m, n - of = phasememberAt(ipc,ip,el) ! phasememberAt should be tackled by material and be renamed to material_phasemember - instance = phase_plasticityInstance(material_phase(ipc,ip,el)) - associate(prm => param(instance)) + associate(prm => param(instance), stt => state(instance)) Mp_dev = math_deviatoric33(Mp) squarenorm_Mp_dev = math_mul33xx33(Mp_dev,Mp_dev) norm_Mp_dev = sqrt(squarenorm_Mp_dev) - if (norm_Mp_dev <= 0.0_pReal) then - Lp = 0.0_pReal - dLp_dMp = 0.0_pReal - else + if (norm_Mp_dev > 0.0_pReal) then gamma_dot = prm%gdot0 & - * ( sqrt(1.5_pReal) * norm_Mp_dev / prm%fTaylor / state(instance)%flowstress(of) ) & + * ( sqrt(1.5_pReal) * norm_Mp_dev / prm%fTaylor / stt%flowstress(of) ) & **prm%n Lp = Mp_dev/norm_Mp_dev * gamma_dot/prm%fTaylor - +#ifdef DEBUG if (iand(debug_level(debug_constitutive), debug_levelExtensive) /= 0_pInt & - .and. ((el == debug_e .and. ip == debug_i .and. ipc == debug_g) & - .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt)) then - write(6,'(a,i8,1x,i2,1x,i3)') '<< CONST isotropic >> at el ip g ',el,ip,ipc + .and. (of == prm%of_debug .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt)) then write(6,'(/,a,/,3(12x,3(f12.4,1x)/))') '<< CONST isotropic >> Tstar (dev) / MPa', & transpose(Mp_dev)*1.0e-6_pReal write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> norm Tstar / MPa', norm_Mp_dev*1.0e-6_pReal write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> gdot', gamma_dot end if - +#endif forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dMp(k,l,m,n) = (prm%n-1.0_pReal) * Mp_dev(k,l)*Mp_dev(m,n) / squarenorm_Mp_dev forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt) & @@ -309,6 +311,9 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ipc,ip,el) forall (k=1_pInt:3_pInt,m=1_pInt:3_pInt) & dLp_dMp(k,k,m,m) = dLp_dMp(k,k,m,m) - 1.0_pReal/3.0_pReal dLp_dMp = gamma_dot / prm%fTaylor * dLp_dMp / norm_Mp_dev + else + Lp = 0.0_pReal + dLp_dMp = 0.0_pReal end if end associate @@ -318,6 +323,7 @@ end subroutine plastic_isotropic_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent +! ToDo: Rename to Tstar to Mi? !-------------------------------------------------------------------------------------------------- subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) use math, only: & @@ -392,13 +398,10 @@ subroutine plastic_isotropic_dotState(Mp,instance,of) gamma_dot, & !< strainrate hardening, & !< hardening coefficient saturation, & !< saturation flowstress - norm_Mp !< norm of the Mandel stress - + norm_Mp !< norm of the (deviatoric) Mandel stress associate(prm => param(instance), stt => state(instance), dot => dotState(instance)) -!-------------------------------------------------------------------------------------------------- -! norm of (deviatoric) Mandel stress if (prm%dilatation) then norm_Mp = sqrt(math_mul33xx33(Mp,Mp)) else @@ -407,8 +410,6 @@ subroutine plastic_isotropic_dotState(Mp,instance,of) gamma_dot = prm%gdot0 * (sqrt(1.5_pReal) * norm_Mp /(prm%fTaylor*stt%flowstress(of))) **prm%n -!-------------------------------------------------------------------------------------------------- -! hardening coefficient if (abs(gamma_dot) > 1e-12_pReal) then if (dEq0(prm%tausat_SinhFitA)) then saturation = prm%tausat From c5dd8d126545a46de6c5642c7ba5e16270d933cf Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 30 Dec 2018 18:11:03 +0100 Subject: [PATCH 131/147] unified style --- src/plastic_isotropic.f90 | 178 +++++++++++++++++----------------- src/plastic_phenopowerlaw.f90 | 31 +++--- 2 files changed, 103 insertions(+), 106 deletions(-) diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index c55a34419..a44681676 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -1,6 +1,7 @@ !-------------------------------------------------------------------------------------------------- !> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH +!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @brief material subroutine for isotropic plasticity !> @details Isotropic Plasticity which resembles the phenopowerlaw plasticity without !! resolving the stress on the slip systems. Will give the response of phenopowerlaw for an @@ -10,15 +11,15 @@ module plastic_isotropic use prec, only: & pReal,& pInt - + implicit none private integer(pInt), dimension(:,:), allocatable, target, public :: & plastic_isotropic_sizePostResult !< size of each post result output character(len=64), dimension(:,:), allocatable, target, public :: & plastic_isotropic_output !< name of each post result output - - enum, bind(c) + + enum, bind(c) enumerator :: & undefined_ID, & flowstress_ID, & @@ -50,9 +51,9 @@ module plastic_isotropic end type type(tParameters), dimension(:), allocatable, private :: param !< containers of constitutive parameters (len Ninstance) - + type, private :: tIsotropicState - real(pReal), pointer, dimension(:) :: & + real(pReal), pointer, dimension(:) :: & flowstress, & accumulatedShear end type @@ -60,8 +61,8 @@ module plastic_isotropic type(tIsotropicState), allocatable, dimension(:), private :: & dotState, & state - - public :: & + + public :: & plastic_isotropic_init, & plastic_isotropic_LpAndItsTangent, & plastic_isotropic_LiAndItsTangent, & @@ -81,6 +82,8 @@ subroutine plastic_isotropic_init() compiler_version, & compiler_options #endif + use prec, only: & + pStringLen use debug, only: & #ifdef DEBUG debug_e, & @@ -91,9 +94,6 @@ subroutine plastic_isotropic_init() debug_level, & debug_constitutive,& debug_levelBasic - use math, only: & - math_Mandel3333to66, & - math_Voigt66to3333 use IO, only: & IO_error, & IO_timeStamp @@ -112,76 +112,94 @@ subroutine plastic_isotropic_init() use config, only: & MATERIAL_partPhase, & config_phase - use lattice + use lattice implicit none - integer(pInt) :: & - p, & - instance, & - maxNinstance, & - sizeDotState, & - sizeState - character(len=65536) :: & - extmsg = '' - integer(pInt) :: NipcMyPhase,i + Ninstance, & + p, i, & + NipcMyPhase, & + sizeState, sizeDotState + + character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::] + integer(kind(undefined_ID)) :: & - outputID !< ID of each post result output + outputID - character(len=65536), dimension(:), allocatable :: outputs + character(len=pStringLen) :: & + extmsg = '' + character(len=65536), dimension(:), allocatable :: & + outputs - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_ISOTROPIC_label//' init -+>>>' + write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_ISOTROPIC_label//' init -+>>>' + write(6,'(/,a)') ' Maiti and Eisenlohr, Scripta Materialia, 145:37-40, 2018' + write(6,'(/,a)') ' https://doi.org/10.1016/j.scriptamat.2017.09.047' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - - maxNinstance = int(count(phase_plasticity == PLASTICITY_ISOTROPIC_ID),pInt) + + Ninstance = int(count(phase_plasticity == PLASTICITY_ISOTROPIC_ID),pInt) if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance + write(6,'(a16,1x,i5,/)') '# instances:',Ninstance - - allocate(plastic_isotropic_sizePostResult(maxval(phase_Noutput), maxNinstance),source=0_pInt) - allocate(plastic_isotropic_output(maxval(phase_Noutput), maxNinstance)) + allocate(plastic_isotropic_sizePostResult(maxval(phase_Noutput), Ninstance),source=0_pInt) + allocate(plastic_isotropic_output(maxval(phase_Noutput), Ninstance)) plastic_isotropic_output = '' - allocate(param(maxNinstance)) ! one container of parameters per instance - allocate(state(maxNinstance)) ! internal state aliases - allocate(dotState(maxNinstance)) + allocate(param(Ninstance)) + allocate(state(Ninstance)) + allocate(dotState(Ninstance)) do p = 1_pInt, size(phase_plasticityInstance) if (phase_plasticity(p) /= PLASTICITY_ISOTROPIC_ID) cycle - instance = phase_plasticityInstance(p) - associate(prm => param(instance)) + associate(prm => param(phase_plasticityInstance(p)), & + dot => dotState(phase_plasticityInstance(p)), & + stt => state(phase_plasticityInstance(p)), & + config => config_phase(p)) #ifdef DEBUG if (p==material_phase(debug_g,debug_i,debug_e)) then - prm%of_debug = phasememberAt(debug_g,debug_i,debug_e) + prm%of_debug = phasememberAt(debug_g,debug_i,debug_e) endif #endif - prm%tau0 = config_phase(p)%getFloat('tau0') - prm%tausat = config_phase(p)%getFloat('tausat') - prm%gdot0 = config_phase(p)%getFloat('gdot0') - prm%n = config_phase(p)%getFloat('n') - prm%h0 = config_phase(p)%getFloat('h0') - prm%fTaylor = config_phase(p)%getFloat('m') - prm%h0_slopeLnRate = config_phase(p)%getFloat('h0_slopelnrate', defaultVal=0.0_pReal) - prm%tausat_SinhFitA = config_phase(p)%getFloat('tausat_sinhfita',defaultVal=0.0_pReal) - prm%tausat_SinhFitB = config_phase(p)%getFloat('tausat_sinhfitb',defaultVal=0.0_pReal) - prm%tausat_SinhFitC = config_phase(p)%getFloat('tausat_sinhfitc',defaultVal=0.0_pReal) - prm%tausat_SinhFitD = config_phase(p)%getFloat('tausat_sinhfitd',defaultVal=0.0_pReal) - prm%a = config_phase(p)%getFloat('a') - prm%aTolFlowStress = config_phase(p)%getFloat('atol_flowstress',defaultVal=1.0_pReal) - prm%aTolShear = config_phase(p)%getFloat('atol_shear',defaultVal=1.0e-6_pReal) + prm%tau0 = config%getFloat('tau0') + prm%tausat = config%getFloat('tausat') + prm%gdot0 = config%getFloat('gdot0') + prm%n = config%getFloat('n') + prm%h0 = config%getFloat('h0') + prm%fTaylor = config%getFloat('m') + prm%h0_slopeLnRate = config%getFloat('h0_slopelnrate', defaultVal=0.0_pReal) + prm%tausat_SinhFitA = config%getFloat('tausat_sinhfita',defaultVal=0.0_pReal) + prm%tausat_SinhFitB = config%getFloat('tausat_sinhfitb',defaultVal=0.0_pReal) + prm%tausat_SinhFitC = config%getFloat('tausat_sinhfitc',defaultVal=0.0_pReal) + prm%tausat_SinhFitD = config%getFloat('tausat_sinhfitd',defaultVal=0.0_pReal) + prm%a = config%getFloat('a') + prm%aTolFlowStress = config%getFloat('atol_flowstress',defaultVal=1.0_pReal) + prm%aTolShear = config%getFloat('atol_shear', defaultVal=1.0e-6_pReal) - prm%dilatation = config_phase(p)%keyExists('/dilatation/') + prm%dilatation = config%keyExists('/dilatation/') -#if defined(__GFORTRAN__) - outputs = ['GfortranBug86277'] - outputs = config_phase(p)%getStrings('(output)',defaultVal=outputs) - if (outputs(1) == 'GfortranBug86277') outputs = [character(len=65536)::] -#else - outputs = config_phase(p)%getStrings('(output)',defaultVal=[character(len=65536)::]) -#endif +!-------------------------------------------------------------------------------------------------- +! sanity checks + extmsg = '' + if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//'aTolShear ' + if (prm%tau0 < 0.0_pReal) extmsg = trim(extmsg)//'tau0 ' + if (prm%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0 ' + if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//'n ' + if (prm%tausat <= prm%tau0) extmsg = trim(extmsg)//'tausat ' + if (prm%a <= 0.0_pReal) extmsg = trim(extmsg)//'a ' + if (prm%fTaylor <= 0.0_pReal) extmsg = trim(extmsg)//'m ' + if (prm%aTolFlowstress <= 0.0_pReal) extmsg = trim(extmsg)//'atol_flowstress ' + if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//'atol_shear ' + +!-------------------------------------------------------------------------------------------------- +! exit if any parameter is out of range + if (extmsg /= '') & + call IO_error(211_pInt,ext_msg=trim(extmsg)//'('//PLASTICITY_ISOTROPIC_label//')') + +!-------------------------------------------------------------------------------------------------- +! output pararameters + outputs = config%getStrings('(output)',defaultVal=emptyStringArray) allocate(prm%outputID(0)) do i=1_pInt, size(outputs) outputID = undefined_ID @@ -198,48 +216,34 @@ subroutine plastic_isotropic_init() prm%outputID = [prm%outputID , outputID] endif - enddo - -!-------------------------------------------------------------------------------------------------- -! sanity checks - extmsg = '' - if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//"'aTolShear' " - if (prm%tau0 < 0.0_pReal) extmsg = trim(extmsg)//"'tau0' " - if (prm%gdot0 <= 0.0_pReal) extmsg = trim(extmsg)//"'gdot0' " - if (prm%n <= 0.0_pReal) extmsg = trim(extmsg)//"'n' " - if (prm%tausat <= prm%tau0) extmsg = trim(extmsg)//"'tausat' " - if (prm%a <= 0.0_pReal) extmsg = trim(extmsg)//"'a' " - if (prm%fTaylor <= 0.0_pReal) extmsg = trim(extmsg)//"'m' " - if (prm%aTolFlowstress <= 0.0_pReal) extmsg = trim(extmsg)//"'atol_flowstress' " - if (extmsg /= '') call IO_error(211_pInt,ip=instance,& - ext_msg=trim(extmsg)//'('//PLASTICITY_ISOTROPIC_label//')') + end do !-------------------------------------------------------------------------------------------------- ! allocate state arrays - NipcMyPhase = count(material_phase == p) ! number of own material points (including point components ipc) + NipcMyPhase = count(material_phase == p) + sizeState = size(["flowstress ","accumulated_shear"]) + sizeDotState = sizeState - sizeDotState = size(["flowstress ","accumulated_shear"]) - sizeState = sizeDotState call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & 1_pInt,0_pInt,0_pInt) plasticState(p)%sizePostResults = sum(plastic_isotropic_sizePostResult(:,phase_plasticityInstance(p))) - !-------------------------------------------------------------------------------------------------- ! locally defined state aliases and initialization of state0 and aTolState - - state(instance)%flowstress => plasticState(p)%state (1,1:NipcMyPhase) - dotState(instance)%flowstress => plasticState(p)%dotState (1,1:NipcMyPhase) - plasticState(p)%state0(1,1:NipcMyPhase) = prm%tau0 + stt%flowstress => plasticState(p)%state (1,1:NipcMyPhase) + stt%flowstress = prm%tau0 + dot%flowstress => plasticState(p)%dotState (1,1:NipcMyPhase) plasticState(p)%aTolState(1) = prm%aTolFlowstress - state(instance)%accumulatedShear => plasticState(p)%state (2,1:NipcMyPhase) - dotState(instance)%accumulatedShear => plasticState(p)%dotState (2,1:NipcMyPhase) - plasticState(p)%state0 (2,1:NipcMyPhase) = 0.0_pReal + stt%accumulatedShear => plasticState(p)%state (2,1:NipcMyPhase) + dot%accumulatedShear => plasticState(p)%dotState (2,1:NipcMyPhase) plasticState(p)%aTolState(2) = prm%aTolShear ! global alias plasticState(p)%slipRate => plasticState(p)%dotState(2:2,1:NipcMyPhase) plasticState(p)%accumulatedSlip => plasticState(p)%state (2:2,1:NipcMyPhase) + + plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + end associate enddo @@ -290,9 +294,7 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) norm_Mp_dev = sqrt(squarenorm_Mp_dev) if (norm_Mp_dev > 0.0_pReal) then - gamma_dot = prm%gdot0 & - * ( sqrt(1.5_pReal) * norm_Mp_dev / prm%fTaylor / stt%flowstress(of) ) & - **prm%n + gamma_dot = prm%gdot0 * (sqrt(1.5_pReal) * norm_Mp_dev/(prm%fTaylor*stt%flowstress(of))) **prm%n Lp = Mp_dev/norm_Mp_dev * gamma_dot/prm%fTaylor #ifdef DEBUG @@ -323,7 +325,7 @@ end subroutine plastic_isotropic_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief calculates plastic velocity gradient and its tangent -! ToDo: Rename to Tstar to Mi? +! ToDo: Rename Tstar to Mi? !-------------------------------------------------------------------------------------------------- subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) use math, only: & @@ -459,8 +461,6 @@ function plastic_isotropic_postResults(Mp,instance,of) result(postResults) associate(prm => param(instance), stt => state(instance)) -!-------------------------------------------------------------------------------------------------- -! norm of (deviatoric) Mandel stress if (prm%dilatation) then norm_Mp = sqrt(math_mul33xx33(Mp,Mp)) else diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index ce4f8b7f0..1e42876f9 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -82,8 +82,7 @@ module plastic_phenopowerlaw xi_slip, & xi_twin, & gamma_slip, & - gamma_twin, & - whole + gamma_twin end type type(tPhenopowerlawState), allocatable, dimension(:), private :: & @@ -95,6 +94,9 @@ module plastic_phenopowerlaw plastic_phenopowerlaw_LpAndItsTangent, & plastic_phenopowerlaw_dotState, & plastic_phenopowerlaw_postResults + private :: & + kinetics_slip, & + kinetics_twin contains @@ -110,8 +112,7 @@ subroutine plastic_phenopowerlaw_init compiler_options #endif use prec, only: & - pStringLen, & - dEq0 + pStringLen use debug, only: & debug_level, & debug_constitutive,& @@ -119,7 +120,6 @@ subroutine plastic_phenopowerlaw_init use math, only: & math_expand use IO, only: & - IO_warning, & IO_error, & IO_timeStamp use material, only: & @@ -149,7 +149,7 @@ subroutine plastic_phenopowerlaw_init character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::] integer(kind(undefined_ID)) :: & - outputID !< ID of each post result output + outputID character(len=pStringLen) :: & structure = '',& @@ -157,7 +157,7 @@ subroutine plastic_phenopowerlaw_init character(len=65536), dimension(:), allocatable :: & outputs - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>' + write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" @@ -207,7 +207,7 @@ subroutine plastic_phenopowerlaw_init config%getFloat('c/a',defaultVal=0.0_pReal)) if(structure=='bcc') then prm%nonSchmidCoeff = config%getFloats('nonschmid_coefficients',& - defaultVal = emptyRealArray) + defaultVal = emptyRealArray) prm%nonSchmid_pos = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,+1_pInt) prm%nonSchmid_neg = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,-1_pInt) else @@ -221,7 +221,7 @@ subroutine plastic_phenopowerlaw_init prm%xi_slip_0 = config%getFloats('tau0_slip', requiredSize=size(prm%Nslip)) prm%xi_slip_sat = config%getFloats('tausat_slip', requiredSize=size(prm%Nslip)) prm%H_int = config%getFloats('h_int', requiredSize=size(prm%Nslip), & - defaultVal=[(0.0_pReal,i=1_pInt,size(prm%Nslip))]) + defaultVal=[(0.0_pReal,i=1_pInt,size(prm%Nslip))]) prm%gdot0_slip = config%getFloat('gdot0_slip') prm%n_slip = config%getFloat('n_slip') @@ -234,9 +234,9 @@ subroutine plastic_phenopowerlaw_init prm%H_int = math_expand(prm%H_int, prm%Nslip) ! sanity checks - if (prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_slip ' - if (dEq0(prm%a_slip)) extmsg = trim(extmsg)//'a_slip ' ! ToDo: negative values ok? - if (dEq0(prm%n_slip)) extmsg = trim(extmsg)//'n_slip ' ! ToDo: negative values ok? + if (prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_slip ' + if (prm%a_slip <= 0.0_pReal) extmsg = trim(extmsg)//'a_slip ' + if (prm%n_slip <= 0.0_pReal) extmsg = trim(extmsg)//'n_slip ' if (any(prm%xi_slip_0 <= 0.0_pReal)) extmsg = trim(extmsg)//'xi_slip_0 ' if (any(prm%xi_slip_sat < prm%xi_slip_0)) extmsg = trim(extmsg)//'xi_slip_sat ' else slipActive @@ -269,7 +269,7 @@ subroutine plastic_phenopowerlaw_init ! sanity checks if (prm%gdot0_twin <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_twin ' - if (dEq0(prm%n_twin)) extmsg = trim(extmsg)//'n_twin ' ! ToDo: negative values ok? + if (prm%n_twin <= 0.0_pReal) extmsg = trim(extmsg)//'n_twin ' else twinActive allocate(prm%interaction_TwinTwin(0,0)) allocate(prm%xi_twin_0(0)) @@ -341,7 +341,7 @@ subroutine plastic_phenopowerlaw_init !-------------------------------------------------------------------------------------------------- ! allocate state arrays - NipcMyPhase = count(material_phase == p) ! number of IPCs containing my phase + NipcMyPhase = count(material_phase == p) sizeState = size(['tau_slip ','gamma_slip']) * prm%TotalNslip & + size(['tau_twin ','gamma_twin']) * prm%TotalNtwin sizeDotState = sizeState @@ -350,7 +350,6 @@ subroutine plastic_phenopowerlaw_init prm%totalNslip,prm%totalNtwin,0_pInt) plasticState(p)%sizePostResults = sum(plastic_phenopowerlaw_sizePostResult(:,phase_plasticityInstance(p))) - !-------------------------------------------------------------------------------------------------- ! locally defined state aliases and initialization of state0 and aTolState startIndex = 1_pInt @@ -383,7 +382,6 @@ subroutine plastic_phenopowerlaw_init plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolShear plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally - dot%whole => plasticState(p)%dotState end associate enddo @@ -469,7 +467,6 @@ subroutine plastic_phenopowerlaw_dotState(Mp,instance,of) associate(prm => param(instance), stt => state(instance), dot => dotState(instance)) - dot%whole(:,of) = 0.0_pReal sumGamma = sum(stt%gamma_slip(:,of)) sumF = sum(stt%gamma_twin(:,of)/prm%gamma_twin_char) From 6f40989465454c4bd78b68b7fe72389ee79528aa Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 31 Dec 2018 07:18:45 +0100 Subject: [PATCH 132/147] order was randomized when creating dict --- processing/post/addMises.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/processing/post/addMises.py b/processing/post/addMises.py index 5a851fc5a..7e757ed9d 100755 --- a/processing/post/addMises.py +++ b/processing/post/addMises.py @@ -64,10 +64,10 @@ for name in filenames: # ------------------------------------------ sanity checks ---------------------------------------- - items = OrderedDict({ - 'strain': {'dim': 9, 'shape': [3,3], 'labels':options.strain, 'active':[], 'column': []}, - 'stress': {'dim': 9, 'shape': [3,3], 'labels':options.stress, 'active':[], 'column': []}, - }) + items = OrderedDict([ + ('strain', {'dim': 9, 'shape': [3,3], 'labels':options.strain, 'active':[], 'column': []}), + ('stress', {'dim': 9, 'shape': [3,3], 'labels':options.stress, 'active':[], 'column': []}) + ]) errors = [] remarks = [] From 835e3f95a5f5e9d2f54f3b36c67bc65b43c3d8ed Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 31 Dec 2018 08:05:56 +0100 Subject: [PATCH 133/147] [skip ci] was not used --- processing/post/addEuclideanDistance.py | 1 - 1 file changed, 1 deletion(-) diff --git a/processing/post/addEuclideanDistance.py b/processing/post/addEuclideanDistance.py index 2e5794e1b..f759b7a8f 100755 --- a/processing/post/addEuclideanDistance.py +++ b/processing/post/addEuclideanDistance.py @@ -149,7 +149,6 @@ for name in filenames: errors = [] remarks = [] - column = {} if not 3 >= table.label_dimension(options.pos) >= 1: errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos)) From 4d0166351ecf9ae3ed151ca1407fd27da0404c45 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 31 Dec 2018 11:35:01 +0100 Subject: [PATCH 134/147] missing initialization caused segmentation fault --- src/constitutive.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index cc5c6f3f8..b20d6e65d 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -863,6 +863,8 @@ subroutine constitutive_collectDotState(S6, FeArray, Fi, FpArray, subdt, subfrac plasticityType: select case (phase_plasticity(material_phase(ipc,ip,el))) case (PLASTICITY_ISOTROPIC_ID) plasticityType + of = phasememberAt(ipc,ip,el) + instance = phase_plasticityInstance(material_phase(ipc,ip,el)) call plastic_isotropic_dotState (Mp,instance,of) case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType From a852729d4d7ce028fbada072add19be878d5ede5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 1 Jan 2019 16:59:35 +0100 Subject: [PATCH 135/147] [skip ci] it's 2019 now --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 630dc3a84..1ab20178c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2011-18 Max-Planck-Institut für Eisenforschung GmbH +Copyright 2011-19 Max-Planck-Institut für Eisenforschung GmbH DAMASK is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From b5d62c8e29a426158ca338458666088015022291 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 3 Jan 2019 11:28:03 -0500 Subject: [PATCH 136/147] [skip ci] print estimated remaining processing time for postResults --- lib/damask/util.py | 13 ++++++++++--- processing/post/postResults.py | 12 ++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/damask/util.py b/lib/damask/util.py index e7d4a16bc..45347ae88 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -134,7 +134,7 @@ class extendableOption(Option): # Print iterations progress # from https://gist.github.com/aubricus/f91fb55dc6ba5557fbab06119420dd6a -def progressBar(iteration, total, prefix='', suffix='', decimals=1, bar_length=100): +def progressBar(iteration, total, start=None, prefix='', suffix='', decimals=1, bar_length=50): """ Call in a loop to create terminal progress bar @@ -146,12 +146,19 @@ def progressBar(iteration, total, prefix='', suffix='', decimals=1, bar_length=1 decimals - Optional : positive number of decimals in percent complete (Int) bar_length - Optional : character length of bar (Int) """ - str_format = "{0:." + str(decimals) + "f}" + import time + + if suffix == '' and start is not None and iteration > 0: + remainder = (total - iteration) * (time.time()-start)/iteration + suffix = '{: 3d}:'.format(int( remainder//3600)) + \ + '{:02d}:'.format(int((remainder//60)%60)) + \ + '{:02d}' .format(int( remainder %60)) + str_format = "{{0:{}.{}f}}".format(decimals+4,decimals) percents = str_format.format(100 * (iteration / float(total))) filled_length = int(round(bar_length * iteration / float(total))) bar = '█' * filled_length + '-' * (bar_length - filled_length) - sys.stderr.write('\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix)), + sys.stderr.write('\r%s |%s| %s %s' % (prefix, bar, percents+'%', suffix)), if iteration == total: sys.stderr.write('\n\n') sys.stderr.flush() diff --git a/processing/post/postResults.py b/processing/post/postResults.py index a5a2669d7..cf4353ac5 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -830,9 +830,10 @@ if options.info: elementsOfNode = {} Nelems = stat['NumberOfElements'] +starttime = time.time() for e in range(Nelems): if options.verbose and Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.progressBar(iteration=e,total=Nelems,prefix='1/3: connecting elements') + damask.util.progressBar(iteration=e,total=Nelems,start=starttime,prefix='1/3: connecting elements') for n in map(p.node_sequence,p.element(e).items): if n not in elementsOfNode: elementsOfNode[n] = [p.element_id(e)] @@ -855,9 +856,10 @@ damask.util.progressBar(iteration=1,total=1,prefix='1/3: connecting elements') if options.nodalScalar: Npoints = stat['NumberOfNodes'] + starttime = time.time() for n in range(Npoints): if options.verbose and Npoints > 100 and e%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.progressBar(iteration=n,total=Npoints,prefix='2/3: scanning nodes ') + damask.util.progressBar(iteration=n,total=Npoints,start=starttime,prefix='2/3: scanning nodes ') myNodeID = p.node_id(n) myNodeCoordinates = [p.node(n).x, p.node(n).y, p.node(n).z] myElemID = 0 @@ -892,9 +894,10 @@ if options.nodalScalar: else: Nelems = stat['NumberOfElements'] + starttime = time.time() for e in range(Nelems): if options.verbose and Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.progressBar(iteration=e,total=Nelems,prefix='2/3: scanning elements ') + damask.util.progressBar(iteration=e,total=Nelems,start=starttime,prefix='2/3: scanning elements ') myElemID = p.element_id(e) myIpCoordinates = ipCoords(p.element(e).type, list(map(lambda node: [node.x, node.y, node.z], list(map(p.node, map(p.node_sequence, p.element(e).items)))))) @@ -1032,10 +1035,11 @@ for incCount,position in enumerate(locations): # walk through locations member = 0 Ngroups = len(groups) + starttime = time.time() for j,group in enumerate(groups): f = incCount*Ngroups + j if options.verbose and (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.progressBar(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ') + damask.util.progressBar(iteration=f,total=Ngroups*Nincs,start=starttime,prefix='3/3: processing points ') N = 0 # group member counter for (e,n,i,g,n_local) in group[1:]: # loop over group members member += 1 From bcd4288f1eba6eba0fe21b35326ed5447415eb69 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 3 Jan 2019 18:25:28 -0500 Subject: [PATCH 137/147] [skip ci] groupTable according to unique values in more than one column --- processing/post/groupTable.py | 44 +++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/processing/post/groupTable.py b/processing/post/groupTable.py index 67d07a7d1..f78566304 100755 --- a/processing/post/groupTable.py +++ b/processing/post/groupTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -21,18 +21,19 @@ scriptID = ' '.join([scriptName,damask.version]) # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Apply a user-specified function to condense all rows for which column 'label' has identical values into a single row. -Output table will contain as many rows as there are different (unique) values in the grouping column. +Apply a user-specified function to condense into a single row all those rows for which columns 'label' have identical values. +Output table will contain as many rows as there are different (unique) values in the grouping column(s). Periodic domain averaging of coordinate values is supported. Examples: For grain averaged values, replace all rows of particular 'texture' with a single row containing their average. -""", version = scriptID) +{name} --label texture --function np.average data.txt +""".format(name = scriptName), version = scriptID) parser.add_option('-l','--label', dest = 'label', - type = 'string', metavar = 'string', - help = 'column label for grouping rows') + action = 'extend', metavar = '', + help = 'column label(s) for grouping rows') parser.add_option('-f','--function', dest = 'function', type = 'string', metavar = 'string', @@ -40,7 +41,7 @@ parser.add_option('-f','--function', parser.add_option('-a','--all', dest = 'all', action = 'store_true', - help = 'apply mapping function also to grouping column') + help = 'apply mapping function also to grouping column(s)') group = OptionGroup(parser, "periodic averaging", "") @@ -57,6 +58,7 @@ parser.add_option_group(group) parser.set_defaults(function = 'np.average', all = False, + label = [], boundary = [0.0, 1.0]) (options,filenames) = parser.parse_args() @@ -71,7 +73,7 @@ try: except: mapFunction = None -if options.label is None: +if options.label is []: parser.error('no grouping column specified.') if not hasattr(mapFunction,'__call__'): parser.error('function "{}" is not callable.'.format(options.function)) @@ -89,13 +91,20 @@ for name in filenames: # ------------------------------------------ sanity checks --------------------------------------- + remarks = [] + errors = [] + table.head_read() - if table.label_dimension(options.label) != 1: - damask.util.croak('column {} is not of scalar dimension.'.format(options.label)) - table.close(dismiss = True) # close ASCIItable and remove empty file + grpColumns = table.label_index(options.label)[::-1] + grpColumns = grpColumns[np.where(grpColumns>=0)] + + if len(grpColumns) == 0: errors.append('no valid grouping column present.') + + if remarks != []: damask.util.croak(remarks) + if errors != []: + damask.util.croak(errors) + table.close(dismiss=True) continue - else: - grpColumn = table.label_index(options.label) # ------------------------------------------ assemble info --------------------------------------- @@ -108,10 +117,9 @@ for name in filenames: indexrange = table.label_indexrange(options.periodic) if options.periodic is not None else [] rows,cols = table.data.shape - table.data = table.data[np.lexsort([table.data[:,grpColumn]])] # sort data by grpColumn - - values,index = np.unique(table.data[:,grpColumn], return_index = True) # unique grpColumn values and their positions - index = np.append(index,rows) # add termination position + table.data = table.data[np.lexsort(table.data[:,grpColumns].T)] # sort data by grpColumn(s) + values,index = np.unique(table.data[:,grpColumns], axis=0, return_index=True) # unique grpColumn values and their positions + index = sorted(np.append(index,rows)) # add termination position grpTable = np.empty((len(values), cols)) # initialize output for i in range(len(values)): # iterate over groups (unique values in grpColumn) @@ -119,7 +127,7 @@ for name in filenames: grpTable[i,indexrange] = \ periodicAverage(table.data[index[i]:index[i+1],indexrange],options.boundary) # apply periodicAverage mapping function - if not options.all: grpTable[i,grpColumn] = table.data[index[i],grpColumn] # restore grouping column value + if not options.all: grpTable[i,grpColumns] = table.data[index[i],grpColumns] # restore grouping column value table.data = grpTable From 3c5df0a4a43f5ddabb0c17a49e50d9474c5cf1ee Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 4 Jan 2019 16:34:04 -0500 Subject: [PATCH 138/147] [skip ci] viewTable acknowledges requested output type(s) --- processing/post/viewTable.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/processing/post/viewTable.py b/processing/post/viewTable.py index c01bdcddb..309f229e1 100755 --- a/processing/post/viewTable.py +++ b/processing/post/viewTable.py @@ -61,7 +61,14 @@ for name in filenames: table = damask.ASCIItable(name = name, buffered = False, labeled = options.labeled, readonly = True) except: continue - damask.util.report(scriptName,name) + details = ', '.join( + (['header'] if options.table else []) + + (['info'] if options.head or options.info else []) + + (['labels'] if options.head or options.labels else []) + + (['data'] if options.data else []) + + [] + ) + damask.util.report(scriptName,name + ('' if details == '' else ' -- '+details)) # ------------------------------------------ output head --------------------------------------- From 2f3b5185623da4fdcadf438e2c7bcb9ae07a7304 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 5 Jan 2019 10:06:37 +0100 Subject: [PATCH 139/147] rename was missing --- src/plastic_none.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plastic_none.f90 b/src/plastic_none.f90 index 5470c4a43..5b5bb49d1 100644 --- a/src/plastic_none.f90 +++ b/src/plastic_none.f90 @@ -48,7 +48,7 @@ subroutine plastic_none_init phase, & NofMyPhase - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONE_label//' init -+>>>' + write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_NONE_label//' init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" From 7768c5874bed4165f2af9de7a980e70e191a8cc3 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 5 Jan 2019 10:41:49 +0100 Subject: [PATCH 140/147] simpler interface for progress bar --- lib/damask/util.py | 37 ++++++++++++++++++++-------------- processing/post/postResults.py | 22 +++++++++----------- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/lib/damask/util.py b/lib/damask/util.py index 45347ae88..5def68bf6 100644 --- a/lib/damask/util.py +++ b/lib/damask/util.py @@ -1,5 +1,5 @@ # -*- coding: UTF-8 no BOM -*- -import sys,time,random,threading,os,subprocess,shlex +import sys,time,random,threading,os,subprocess,shlex,time import numpy as np from optparse import Option @@ -134,7 +134,7 @@ class extendableOption(Option): # Print iterations progress # from https://gist.github.com/aubricus/f91fb55dc6ba5557fbab06119420dd6a -def progressBar(iteration, total, start=None, prefix='', suffix='', decimals=1, bar_length=50): +def progressBar(iteration, total, prefix='', bar_length=50): """ Call in a loop to create terminal progress bar @@ -142,23 +142,30 @@ def progressBar(iteration, total, start=None, prefix='', suffix='', decimals=1, iteration - Required : current iteration (Int) total - Required : total iterations (Int) prefix - Optional : prefix string (Str) - suffix - Optional : suffix string (Str) - decimals - Optional : positive number of decimals in percent complete (Int) bar_length - Optional : character length of bar (Int) """ - import time - if suffix == '' and start is not None and iteration > 0: - remainder = (total - iteration) * (time.time()-start)/iteration - suffix = '{: 3d}:'.format(int( remainder//3600)) + \ - '{:02d}:'.format(int((remainder//60)%60)) + \ - '{:02d}' .format(int( remainder %60)) - str_format = "{{0:{}.{}f}}".format(decimals+4,decimals) - percents = str_format.format(100 * (iteration / float(total))) - filled_length = int(round(bar_length * iteration / float(total))) - bar = '█' * filled_length + '-' * (bar_length - filled_length) + fraction = iteration / float(total) + if not hasattr(progressBar, "last_fraction"): # first call to function + progressBar.start_time = time.time() + progressBar.last_fraction = -1.0 + remaining_time = ' n/a' + else: + if fraction <= progressBar.last_fraction or iteration == 0: # reset: called within a new loop + progressBar.start_time = time.time() + progressBar.last_fraction = -1.0 + remaining_time = ' n/a' + else: + progressBar.last_fraction = fraction + remainder = (total - iteration) * (time.time()-progressBar.start_time)/iteration + remaining_time = '{: 3d}:'.format(int( remainder//3600)) + \ + '{:02d}:'.format(int((remainder//60)%60)) + \ + '{:02d}' .format(int( remainder %60)) - sys.stderr.write('\r%s |%s| %s %s' % (prefix, bar, percents+'%', suffix)), + filled_length = int(round(bar_length * fraction)) + bar = '█' * filled_length + '░' * (bar_length - filled_length) + + sys.stderr.write('\r{} {} {}'.format(prefix, bar, remaining_time)), if iteration == total: sys.stderr.write('\n\n') sys.stderr.flush() diff --git a/processing/post/postResults.py b/processing/post/postResults.py index cf4353ac5..c0885a967 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -830,10 +830,9 @@ if options.info: elementsOfNode = {} Nelems = stat['NumberOfElements'] -starttime = time.time() for e in range(Nelems): - if options.verbose and Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.progressBar(iteration=e,total=Nelems,start=starttime,prefix='1/3: connecting elements') + if options.verbose and Nelems >= 50 and e%(Nelems//50) == 0: # report in 2% steps if possible and avoid modulo by zero + damask.util.progressBar(iteration=e,total=Nelems,prefix='1/3: connecting elements') for n in map(p.node_sequence,p.element(e).items): if n not in elementsOfNode: elementsOfNode[n] = [p.element_id(e)] @@ -856,10 +855,9 @@ damask.util.progressBar(iteration=1,total=1,prefix='1/3: connecting elements') if options.nodalScalar: Npoints = stat['NumberOfNodes'] - starttime = time.time() for n in range(Npoints): - if options.verbose and Npoints > 100 and e%(Npoints//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.progressBar(iteration=n,total=Npoints,start=starttime,prefix='2/3: scanning nodes ') + if options.verbose and Npoints >= 50 and e%(Npoints//50) == 0: # report in 2% steps if possible and avoid modulo by zero + damask.util.progressBar(iteration=n,total=Npoints,prefix='2/3: scanning nodes ') myNodeID = p.node_id(n) myNodeCoordinates = [p.node(n).x, p.node(n).y, p.node(n).z] myElemID = 0 @@ -894,10 +892,9 @@ if options.nodalScalar: else: Nelems = stat['NumberOfElements'] - starttime = time.time() for e in range(Nelems): - if options.verbose and Nelems > 100 and e%(Nelems//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.progressBar(iteration=e,total=Nelems,start=starttime,prefix='2/3: scanning elements ') + if options.verbose and Nelems >= 50 and e%(Nelems//50) == 0: # report in 2% steps if possible and avoid modulo by zero + damask.util.progressBar(iteration=e,total=Nelems,prefix='2/3: scanning elements ') myElemID = p.element_id(e) myIpCoordinates = ipCoords(p.element(e).type, list(map(lambda node: [node.x, node.y, node.z], list(map(p.node, map(p.node_sequence, p.element(e).items)))))) @@ -1035,11 +1032,10 @@ for incCount,position in enumerate(locations): # walk through locations member = 0 Ngroups = len(groups) - starttime = time.time() for j,group in enumerate(groups): f = incCount*Ngroups + j - if options.verbose and (Ngroups*Nincs) > 100 and f%((Ngroups*Nincs)//100) == 0: # report in 1% steps if possible and avoid modulo by zero - damask.util.progressBar(iteration=f,total=Ngroups*Nincs,start=starttime,prefix='3/3: processing points ') + if options.verbose and (Ngroups*Nincs) >= 50 and f%((Ngroups*Nincs)//50) == 0: # report in 2% steps if possible and avoid modulo by zero + damask.util.progressBar(iteration=f,total=Ngroups*Nincs,prefix='3/3: processing points ') N = 0 # group member counter for (e,n,i,g,n_local) in group[1:]: # loop over group members member += 1 @@ -1091,7 +1087,7 @@ for incCount,position in enumerate(locations): # walk through locations ['Crystallite']*len(options.crystalliteResult) + ['Constitutive']*len(options.constitutiveResult) ): - outputIndex = (list(zip(*outputFormat[resultType]['outputs']))[0]).index(label) # find the position of this output in the outputFormat + outputIndex = (list(zip(*outputFormat[resultType]['outputs']))[0]).index(label) # find the position of this output in the outputFormat length = int(outputFormat[resultType]['outputs'][outputIndex][1]) thisHead = heading('_',[[component,''.join( label.split() )] for component in range(int(length>1),length+int(length>1))]) if assembleHeader: header += thisHead From 02ab55d4b3bac57431c91004b31d9fdfdfddb887 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 5 Jan 2019 10:52:39 +0100 Subject: [PATCH 141/147] python reflects content better than lib --- env/DAMASK.csh | 4 ++-- env/DAMASK.sh | 2 +- env/DAMASK.zsh | 2 +- {lib => python}/damask/.gitignore | 0 {lib => python}/damask/__init__.py | 0 {lib => python}/damask/asciitable.py | 0 {lib => python}/damask/colormaps.py | 0 {lib => python}/damask/config/__init__.py | 0 {lib => python}/damask/config/material.py | 0 {lib => python}/damask/environment.py | 0 {lib => python}/damask/geometry/__init__.py | 0 {lib => python}/damask/geometry/geometry.py | 0 {lib => python}/damask/geometry/marc.py | 0 {lib => python}/damask/geometry/spectral.py | 0 {lib => python}/damask/orientation.py | 0 {lib => python}/damask/result.py | 0 {lib => python}/damask/result/marc2vtk.py | 0 {lib => python}/damask/solver/__init__.py | 0 {lib => python}/damask/solver/abaqus.py | 0 {lib => python}/damask/solver/marc.py | 0 {lib => python}/damask/solver/solver.py | 0 {lib => python}/damask/solver/spectral.py | 0 {lib => python}/damask/test/__init__.py | 0 {lib => python}/damask/test/test.py | 0 {lib => python}/damask/util.py | 0 25 files changed, 4 insertions(+), 4 deletions(-) rename {lib => python}/damask/.gitignore (100%) rename {lib => python}/damask/__init__.py (100%) rename {lib => python}/damask/asciitable.py (100%) rename {lib => python}/damask/colormaps.py (100%) rename {lib => python}/damask/config/__init__.py (100%) rename {lib => python}/damask/config/material.py (100%) rename {lib => python}/damask/environment.py (100%) rename {lib => python}/damask/geometry/__init__.py (100%) rename {lib => python}/damask/geometry/geometry.py (100%) rename {lib => python}/damask/geometry/marc.py (100%) rename {lib => python}/damask/geometry/spectral.py (100%) rename {lib => python}/damask/orientation.py (100%) rename {lib => python}/damask/result.py (100%) rename {lib => python}/damask/result/marc2vtk.py (100%) rename {lib => python}/damask/solver/__init__.py (100%) rename {lib => python}/damask/solver/abaqus.py (100%) rename {lib => python}/damask/solver/marc.py (100%) rename {lib => python}/damask/solver/solver.py (100%) rename {lib => python}/damask/solver/spectral.py (100%) rename {lib => python}/damask/test/__init__.py (100%) rename {lib => python}/damask/test/test.py (100%) rename {lib => python}/damask/util.py (100%) diff --git a/env/DAMASK.csh b/env/DAMASK.csh index 6b6c58d9d..1819dd305 100644 --- a/env/DAMASK.csh +++ b/env/DAMASK.csh @@ -64,7 +64,7 @@ endif setenv DAMASK_NUM_THREADS $DAMASK_NUM_THREADS if ( ! $?PYTHONPATH ) then - setenv PYTHONPATH $DAMASK_ROOT/lib + setenv PYTHONPATH $DAMASK_ROOT/python else - setenv PYTHONPATH $DAMASK_ROOT/lib:$PYTHONPATH + setenv PYTHONPATH $DAMASK_ROOT/python:$PYTHONPATH endif diff --git a/env/DAMASK.sh b/env/DAMASK.sh index bd26a3ebb..fa2c8db25 100644 --- a/env/DAMASK.sh +++ b/env/DAMASK.sh @@ -95,7 +95,7 @@ if [ ! -z "$PS1" ]; then fi export DAMASK_NUM_THREADS -export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH +export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN BRANCH; do unset "${var}" diff --git a/env/DAMASK.zsh b/env/DAMASK.zsh index 4d5a1e47d..61b9c89f9 100644 --- a/env/DAMASK.zsh +++ b/env/DAMASK.zsh @@ -88,7 +88,7 @@ if [ ! -z "$PS1" ]; then fi export DAMASK_NUM_THREADS -export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH +export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN BRANCH; do unset "${var}" diff --git a/lib/damask/.gitignore b/python/damask/.gitignore similarity index 100% rename from lib/damask/.gitignore rename to python/damask/.gitignore diff --git a/lib/damask/__init__.py b/python/damask/__init__.py similarity index 100% rename from lib/damask/__init__.py rename to python/damask/__init__.py diff --git a/lib/damask/asciitable.py b/python/damask/asciitable.py similarity index 100% rename from lib/damask/asciitable.py rename to python/damask/asciitable.py diff --git a/lib/damask/colormaps.py b/python/damask/colormaps.py similarity index 100% rename from lib/damask/colormaps.py rename to python/damask/colormaps.py diff --git a/lib/damask/config/__init__.py b/python/damask/config/__init__.py similarity index 100% rename from lib/damask/config/__init__.py rename to python/damask/config/__init__.py diff --git a/lib/damask/config/material.py b/python/damask/config/material.py similarity index 100% rename from lib/damask/config/material.py rename to python/damask/config/material.py diff --git a/lib/damask/environment.py b/python/damask/environment.py similarity index 100% rename from lib/damask/environment.py rename to python/damask/environment.py diff --git a/lib/damask/geometry/__init__.py b/python/damask/geometry/__init__.py similarity index 100% rename from lib/damask/geometry/__init__.py rename to python/damask/geometry/__init__.py diff --git a/lib/damask/geometry/geometry.py b/python/damask/geometry/geometry.py similarity index 100% rename from lib/damask/geometry/geometry.py rename to python/damask/geometry/geometry.py diff --git a/lib/damask/geometry/marc.py b/python/damask/geometry/marc.py similarity index 100% rename from lib/damask/geometry/marc.py rename to python/damask/geometry/marc.py diff --git a/lib/damask/geometry/spectral.py b/python/damask/geometry/spectral.py similarity index 100% rename from lib/damask/geometry/spectral.py rename to python/damask/geometry/spectral.py diff --git a/lib/damask/orientation.py b/python/damask/orientation.py similarity index 100% rename from lib/damask/orientation.py rename to python/damask/orientation.py diff --git a/lib/damask/result.py b/python/damask/result.py similarity index 100% rename from lib/damask/result.py rename to python/damask/result.py diff --git a/lib/damask/result/marc2vtk.py b/python/damask/result/marc2vtk.py similarity index 100% rename from lib/damask/result/marc2vtk.py rename to python/damask/result/marc2vtk.py diff --git a/lib/damask/solver/__init__.py b/python/damask/solver/__init__.py similarity index 100% rename from lib/damask/solver/__init__.py rename to python/damask/solver/__init__.py diff --git a/lib/damask/solver/abaqus.py b/python/damask/solver/abaqus.py similarity index 100% rename from lib/damask/solver/abaqus.py rename to python/damask/solver/abaqus.py diff --git a/lib/damask/solver/marc.py b/python/damask/solver/marc.py similarity index 100% rename from lib/damask/solver/marc.py rename to python/damask/solver/marc.py diff --git a/lib/damask/solver/solver.py b/python/damask/solver/solver.py similarity index 100% rename from lib/damask/solver/solver.py rename to python/damask/solver/solver.py diff --git a/lib/damask/solver/spectral.py b/python/damask/solver/spectral.py similarity index 100% rename from lib/damask/solver/spectral.py rename to python/damask/solver/spectral.py diff --git a/lib/damask/test/__init__.py b/python/damask/test/__init__.py similarity index 100% rename from lib/damask/test/__init__.py rename to python/damask/test/__init__.py diff --git a/lib/damask/test/test.py b/python/damask/test/test.py similarity index 100% rename from lib/damask/test/test.py rename to python/damask/test/test.py diff --git a/lib/damask/util.py b/python/damask/util.py similarity index 100% rename from lib/damask/util.py rename to python/damask/util.py From 45d11f81b08a43d022a6b2e80914c89ff9521efc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 5 Jan 2019 10:55:28 +0100 Subject: [PATCH 142/147] python cleaning --- python/damask/util.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/damask/util.py b/python/damask/util.py index 5def68bf6..a88080df5 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -1,5 +1,5 @@ # -*- coding: UTF-8 no BOM -*- -import sys,time,random,threading,os,subprocess,shlex,time +import sys,time,random,threading,os,subprocess,shlex import numpy as np from optparse import Option @@ -144,7 +144,6 @@ def progressBar(iteration, total, prefix='', bar_length=50): prefix - Optional : prefix string (Str) bar_length - Optional : character length of bar (Int) """ - fraction = iteration / float(total) if not hasattr(progressBar, "last_fraction"): # first call to function progressBar.start_time = time.time() From 4da61a0a5c0301216ae63cf310a47869699f85db Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 5 Jan 2019 19:27:21 +0100 Subject: [PATCH 143/147] [skip ci] updated version information after successful test of v2.0.2-1277-g53bc24cc --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 2ad825361..8d5912448 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1236-g1ef82e35 +v2.0.2-1277-g53bc24cc From dc64841f159b907f491ac0eacf9095e58071750d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 5 Jan 2019 23:33:18 +0100 Subject: [PATCH 144/147] mutual best practise phenopowerlaw <-> disloUCLA --- src/plastic_disloUCLA.f90 | 269 +++++++++++++++++----------------- src/plastic_phenopowerlaw.f90 | 115 +++++++-------- 2 files changed, 194 insertions(+), 190 deletions(-) diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 9fb4c9bf7..f82f54006 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -3,8 +3,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @author David Cereceda, Lawrence Livermore National Laboratory !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine incoprorating dislocation and twinning physics -!> @details to be done +!> @brief crystal plasticity model for bcc metals, especially Tungsten !-------------------------------------------------------------------------------------------------- module plastic_disloUCLA use prec, only: & @@ -15,7 +14,6 @@ module plastic_disloUCLA private integer(pInt), dimension(:,:), allocatable, target, public :: & plastic_disloUCLA_sizePostResult !< size of each post result output - character(len=64), dimension(:,:), allocatable, target, public :: & plastic_disloUCLA_output !< name of each post result output @@ -23,7 +21,8 @@ module plastic_disloUCLA kB = 1.38e-23_pReal !< Boltzmann constant in J/Kelvin enum, bind(c) - enumerator :: undefined_ID, & + enumerator :: & + undefined_ID, & rho_ID, & rhoDip_ID, & shearrate_ID, & @@ -49,6 +48,8 @@ module plastic_disloUCLA minDipDistance, & CLambda, & !< Adj. parameter for distance between 2 forest dislocations atomicVolume, & + tau_Peierls, & + tau0, & !* mobility law parameters H0kp, & !< activation energy for glide [J] v0, & !< dislocation velocity prefactor [m/s] @@ -57,9 +58,7 @@ module plastic_disloUCLA B, & !< friction coefficient kink_height, & !< height of the kink pair w, & !< width of the kink pair - omega, & !< attempt frequency for kink pair nucleation - tau_Peierls, & - tau0 + omega !< attempt frequency for kink pair nucleation real(pReal), allocatable, dimension(:,:) :: & interaction_SlipSlip, & !< slip resistance from slip activity forestProjectionEdge @@ -84,21 +83,19 @@ module plastic_disloUCLA real(pReal), pointer, dimension(:,:) :: & rhoEdge, & rhoEdgeDip, & - accshear_slip, & - whole + accshear_slip end type type, private :: tDisloUCLAdependentState - real(pReal), allocatable, dimension(:,:) :: & + real(pReal), allocatable, dimension(:,:) :: & mfp, & dislocationSpacing, & threshold_stress end type tDisloUCLAdependentState type(tDisloUCLAState ), allocatable, dimension(:), private :: & - state, & - dotState - + dotState, & + state type(tDisloUCLAdependentState), allocatable, dimension(:), private :: & dependentState @@ -139,11 +136,11 @@ subroutine plastic_disloUCLA_init() phase_plasticity, & phase_plasticityInstance, & phase_Noutput, & + material_allocatePlasticState, & PLASTICITY_DISLOUCLA_label, & PLASTICITY_DISLOUCLA_ID, & material_phase, & - plasticState, & - material_allocatePlasticState + plasticState use config, only: & MATERIAL_partPhase, & config_phase @@ -151,31 +148,34 @@ subroutine plastic_disloUCLA_init() implicit none integer(pInt) :: & + index_myFamily, index_otherFamily, & + f,j,k,o, & Ninstance, & - f,j,k,o, i, & - outputSize, & - offset_slip, index_myFamily, index_otherFamily, & - startIndex, endIndex, p, & + p, i, & + NipcMyPhase, outputSize, & sizeState, sizeDotState, & - NipcMyPhase - character(len=pStringLen) :: & - structure = '',& - extmsg = '' - character(len=65536), dimension(:), allocatable :: outputs - integer(kind(undefined_ID)) :: outputID + startIndex, endIndex + integer(pInt), dimension(0), parameter :: emptyIntArray = [integer(pInt)::] real(pReal), dimension(0), parameter :: emptyRealArray = [real(pReal)::] character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::] - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOUCLA_label//' init -+>>>' + integer(kind(undefined_ID)) :: & + outputID + + character(len=pStringLen) :: & + structure = '',& + extmsg = '' + character(len=65536), dimension(:), allocatable :: & + outputs + + write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_DISLOUCLA_label//' init -+>>>' write(6,'(/,a)') ' Cereceda et al., International Journal of Plasticity 78, 2016, 242-256' write(6,'(/,a)') ' http://dx.doi.org/10.1016/j.ijplas.2015.09.002' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" Ninstance = int(count(phase_plasticity == PLASTICITY_DISLOUCLA_ID),pInt) - if (Ninstance == 0_pInt) return - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & write(6,'(a16,1x,i5,/)') '# instances:',Ninstance @@ -194,21 +194,29 @@ subroutine plastic_disloUCLA_init() associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & stt => state(phase_plasticityInstance(p)), & - dst => dependentState(phase_plasticityInstance(p))) + dst => dependentState(phase_plasticityInstance(p)), & + config => config_phase(p)) - structure = config_phase(p)%getString('lattice_structure') + structure = config%getString('lattice_structure') + +!-------------------------------------------------------------------------------------------------- +! optional parameters that need to be defined prm%mu = lattice_mu(p) - prm%aTolRho = config_phase(p)%getFloat('atol_rho') + prm%aTolRho = config%getFloat('atol_rho') + + ! sanity checks + if (prm%aTolRho <= 0.0_pReal) extmsg = trim(extmsg)//' atol_rho' + !-------------------------------------------------------------------------------------------------- ! slip related parameters - prm%Nslip = config_phase(p)%getInts('nslip',defaultVal=emptyIntArray) + prm%Nslip = config%getInts('nslip',defaultVal=emptyIntArray) prm%totalNslip = sum(prm%Nslip) slipActive: if (prm%totalNslip > 0_pInt) then prm%Schmid_slip = lattice_SchmidMatrix_slip(prm%Nslip,structure(1:3),& - config_phase(p)%getFloat('c/a',defaultVal=0.0_pReal)) + config%getFloat('c/a',defaultVal=0.0_pReal)) if(structure=='bcc') then - prm%nonSchmidCoeff = config_phase(p)%getFloats('nonschmid_coefficients',& + prm%nonSchmidCoeff = config%getFloats('nonschmid_coefficients',& defaultVal = emptyRealArray) prm%nonSchmid_pos = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,+1_pInt) prm%nonSchmid_neg = lattice_nonSchmidMatrix(prm%Nslip,prm%nonSchmidCoeff,-1_pInt) @@ -217,32 +225,32 @@ subroutine plastic_disloUCLA_init() prm%nonSchmid_neg = prm%Schmid_slip endif prm%interaction_SlipSlip = lattice_interaction_SlipSlip(prm%Nslip, & - config_phase(p)%getFloats('interaction_slipslip'), & + config%getFloats('interaction_slipslip'), & structure(1:3)) - prm%rho0 = config_phase(p)%getFloats('rhoedge0', requiredShape=shape(prm%Nslip)) - prm%rhoDip0 = config_phase(p)%getFloats('rhoedgedip0', requiredShape=shape(prm%Nslip)) - prm%v0 = config_phase(p)%getFloats('v0', requiredShape=shape(prm%Nslip)) - prm%burgers = config_phase(p)%getFloats('slipburgers', requiredShape=shape(prm%Nslip)) - prm%H0kp = config_phase(p)%getFloats('qedge', requiredShape=shape(prm%Nslip)) + prm%rho0 = config%getFloats('rhoedge0', requiredShape=shape(prm%Nslip)) + prm%rhoDip0 = config%getFloats('rhoedgedip0', requiredShape=shape(prm%Nslip)) + prm%v0 = config%getFloats('v0', requiredShape=shape(prm%Nslip)) + prm%burgers = config%getFloats('slipburgers', requiredShape=shape(prm%Nslip)) + prm%H0kp = config%getFloats('qedge', requiredShape=shape(prm%Nslip)) - prm%clambda = config_phase(p)%getFloats('clambdaslip', requiredShape=shape(prm%Nslip)) - prm%tau_Peierls = config_phase(p)%getFloats('tau_peierls', requiredShape=shape(prm%Nslip)) ! ToDo: Deprecated - prm%p = config_phase(p)%getFloats('p_slip', requiredShape=shape(prm%Nslip), & - defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) - prm%q = config_phase(p)%getFloats('q_slip', requiredShape=shape(prm%Nslip), & - defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) - prm%kink_height = config_phase(p)%getFloats('kink_height', requiredShape=shape(prm%Nslip)) - prm%w = config_phase(p)%getFloats('kink_width', requiredShape=shape(prm%Nslip)) - prm%omega = config_phase(p)%getFloats('omega', requiredShape=shape(prm%Nslip)) - prm%B = config_phase(p)%getFloats('friction_coeff', requiredShape=shape(prm%Nslip)) + prm%clambda = config%getFloats('clambdaslip', requiredShape=shape(prm%Nslip)) + prm%tau_Peierls = config%getFloats('tau_peierls', requiredShape=shape(prm%Nslip)) ! ToDo: Deprecated + prm%p = config%getFloats('p_slip', requiredShape=shape(prm%Nslip), & + defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) + prm%q = config%getFloats('q_slip', requiredShape=shape(prm%Nslip), & + defaultVal=[(1.0_pReal,i=1_pInt,size(prm%Nslip))]) + prm%kink_height = config%getFloats('kink_height', requiredShape=shape(prm%Nslip)) + prm%w = config%getFloats('kink_width', requiredShape=shape(prm%Nslip)) + prm%omega = config%getFloats('omega', requiredShape=shape(prm%Nslip)) + prm%B = config%getFloats('friction_coeff', requiredShape=shape(prm%Nslip)) - prm%SolidSolutionStrength = config_phase(p)%getFloat('solidsolutionstrength') ! ToDo: Deprecated - prm%grainSize = config_phase(p)%getFloat('grainsize') - prm%D0 = config_phase(p)%getFloat('d0') - prm%Qsd = config_phase(p)%getFloat('qsd') - prm%atomicVolume = config_phase(p)%getFloat('catomicvolume') * prm%burgers**3.0_pReal - prm%minDipDistance = config_phase(p)%getFloat('cedgedipmindistance') * prm%burgers - prm%dipoleformation = config_phase(p)%getFloat('dipoleformationfactor') > 0.0_pReal !should be on by default + prm%SolidSolutionStrength = config%getFloat('solidsolutionstrength') ! ToDo: Deprecated + prm%grainSize = config%getFloat('grainsize') + prm%D0 = config%getFloat('d0') + prm%Qsd = config%getFloat('qsd') + prm%atomicVolume = config%getFloat('catomicvolume') * prm%burgers**3.0_pReal + prm%minDipDistance = config%getFloat('cedgedipmindistance') * prm%burgers + prm%dipoleformation = config%getFloat('dipoleformationfactor') > 0.0_pReal !should be on by default, ToDo: change to /key/-key ! expand: family => system prm%rho0 = math_expand(prm%rho0, prm%Nslip) @@ -262,44 +270,38 @@ subroutine plastic_disloUCLA_init() prm%minDipDistance = math_expand(prm%minDipDistance, prm%Nslip) prm%tau0 = prm%tau_peierls + prm%SolidSolutionStrength - ! sanity checks - if (any(prm%rho0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedge0' - if (any(prm%rhoDip0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedgedip0' - if (any(prm%v0 < 0.0_pReal)) extmsg = trim(extmsg)//' v0' - if (any(prm%burgers <= 0.0_pReal)) extmsg = trim(extmsg)//' slipburgers' - if (any(prm%H0kp <= 0.0_pReal)) extmsg = trim(extmsg)//' qedge' - if (any(prm%tau_peierls < 0.0_pReal)) extmsg = trim(extmsg)//' tau_peierls' - - if ( prm%D0 <= 0.0_pReal) extmsg = trim(extmsg)//' d0' - if ( prm%Qsd <= 0.0_pReal) extmsg = trim(extmsg)//' qsd' + if (any(prm%rho0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedge0' + if (any(prm%rhoDip0 < 0.0_pReal)) extmsg = trim(extmsg)//' rhoedgedip0' + if (any(prm%v0 < 0.0_pReal)) extmsg = trim(extmsg)//' v0' + if (any(prm%burgers <= 0.0_pReal)) extmsg = trim(extmsg)//' slipburgers' + if (any(prm%H0kp <= 0.0_pReal)) extmsg = trim(extmsg)//' qedge' + if (any(prm%tau_peierls < 0.0_pReal)) extmsg = trim(extmsg)//' tau_peierls' + if ( prm%D0 <= 0.0_pReal) extmsg = trim(extmsg)//' d0' + if ( prm%Qsd <= 0.0_pReal) extmsg = trim(extmsg)//' qsd' !if (plastic_disloUCLA_CAtomicVolume(instance) <= 0.0_pReal) & ! call IO_error(211_pInt,el=instance,ext_msg='cAtomicVolume ('//PLASTICITY_DISLOUCLA_label//')') - - ! if (plastic_disloUCLA_aTolRho(instance) <= 0.0_pReal) & - ! call IO_error(211_pInt,el=instance,ext_msg='aTolRho ('//PLASTICITY_DISLOUCLA_label//')') - else slipActive allocate(prm%rho0(0)) allocate(prm%rhoDip0(0)) endif slipActive +!-------------------------------------------------------------------------------------------------- +! exit if any parameter is out of range + if (extmsg /= '') & + call IO_error(211_pInt,ext_msg=trim(extmsg)//'('//PLASTICITY_DISLOUCLA_label//')') -#if defined(__GFORTRAN__) - outputs = ['GfortranBug86277'] - outputs = config_phase(p)%getStrings('(output)',defaultVal=outputs) - if (outputs(1) == 'GfortranBug86277') outputs = emptyStringArray -#else - outputs = config_phase(p)%getStrings('(output)',defaultVal=emptyStringArray) -#endif +!-------------------------------------------------------------------------------------------------- +! output pararameters + outputs = config%getStrings('(output)',defaultVal=emptyStringArray) allocate(prm%outputID(0)) - - do i = 1_pInt, size(outputs) + do i=1_pInt, size(outputs) outputID = undefined_ID outputSize = prm%totalNslip select case(trim(outputs(i))) + case ('edge_density') outputID = merge(rho_ID,undefined_ID,prm%totalNslip>0_pInt) case ('dipole_density') @@ -314,6 +316,7 @@ subroutine plastic_disloUCLA_init() outputID = merge(thresholdstress_ID,undefined_ID,prm%totalNslip>0_pInt) case ('edge_dipole_distance') outputID = merge(dipoleDistance_ID,undefined_ID,prm%totalNslip>0_pInt) + end select if (outputID /= undefined_ID) then @@ -322,19 +325,16 @@ subroutine plastic_disloUCLA_init() prm%outputID = [prm%outputID, outputID] endif - enddo - - NipcMyPhase=count(material_phase==p) + end do !-------------------------------------------------------------------------------------------------- ! allocate state arrays - + NipcMyPhase = count(material_phase==p) sizeDotState = int(size(['rhoEdge ','rhoEdgeDip ','accshearslip']),pInt) * prm%totalNslip - sizeState = sizeDotState + sizeState = sizeDotState call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & prm%totalNslip,0_pInt,0_pInt) - plasticState(p)%sizePostResults = sum(plastic_disloUCLA_sizePostResult(:,phase_plasticityInstance(p))) allocate(prm%forestProjectionEdge(prm%totalNslip,prm%totalNslip),source = 0.0_pReal) @@ -353,43 +353,41 @@ subroutine plastic_disloUCLA_init() lattice_st(:,sum(lattice_NslipSystem(1:o-1,p))+k,p))) enddo; enddo enddo slipSystemsLoop - enddo mySlipFamilies + enddo mySlipFamilies - offset_slip = 2_pInt*plasticState(p)%nSlip - plasticState(p)%slipRate => & - plasticState(p)%dotState(offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NipcMyPhase) - plasticState(p)%accumulatedSlip => & - plasticState(p)%state (offset_slip+1:offset_slip+plasticState(p)%nSlip,1:NipcMyPhase) - - startIndex=1_pInt - endIndex=prm%totalNslip +!-------------------------------------------------------------------------------------------------- +! locally defined state aliases and initialization of state0 and aTolState + startIndex = 1_pInt + endIndex = prm%totalNslip stt%rhoEdge=>plasticState(p)%state(startIndex:endIndex,:) stt%rhoEdge= spread(prm%rho0,2,NipcMyPhase) dot%rhoEdge=>plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho - startIndex=endIndex+1_pInt - endIndex=endIndex+prm%totalNslip + startIndex = endIndex + 1_pInt + endIndex = endIndex + prm%totalNslip stt%rhoEdgeDip=>plasticState(p)%state(startIndex:endIndex,:) stt%rhoEdgeDip= spread(prm%rhoDip0,2,NipcMyPhase) dot%rhoEdgeDip=>plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolRho - startIndex=endIndex+1_pInt - endIndex=endIndex+prm%totalNslip + startIndex = endIndex + 1_pInt + endIndex = endIndex + prm%totalNslip stt%accshear_slip=>plasticState(p)%state(startIndex:endIndex,:) dot%accshear_slip=>plasticState(p)%dotState(startIndex:endIndex,:) plasticState(p)%aTolState(startIndex:endIndex) = 1e6_pReal + ! global alias + plasticState(p)%slipRate => plasticState(p)%dotState(startIndex:endIndex,:) + plasticState(p)%accumulatedSlip => plasticState(p)%state(startIndex:endIndex,:) - dot%whole => plasticState(p)%dotState - - - allocate(dst%mfp(prm%totalNslip,NipcMyPhase),source=0.0_pReal) + allocate(dst%mfp(prm%totalNslip,NipcMyPhase), source=0.0_pReal) allocate(dst%dislocationSpacing(prm%totalNslip,NipcMyPhase),source=0.0_pReal) - allocate(dst%threshold_stress(prm%totalNslip,NipcMyPhase),source=0.0_pReal) + allocate(dst%threshold_stress(prm%totalNslip,NipcMyPhase), source=0.0_pReal) plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally + end associate + enddo end subroutine plastic_disloUCLA_init @@ -432,28 +430,30 @@ pure subroutine plastic_disloUCLA_LpAndItsTangent(Lp,dLp_dMp,Mp,Temperature,inst implicit none real(pReal), dimension(3,3), intent(out) :: & - Lp + Lp !< plastic velocity gradient real(pReal), dimension(3,3,3,3), intent(out) :: & - dLp_dMp - - real(pReal), dimension(3,3), intent(in):: & + dLp_dMp !< derivative of Lp with respect to the Mandel stress + + real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress real(pReal), intent(in) :: & temperature !< temperature - integer(pInt), intent(in) :: & - instance, of + integer(pInt), intent(in) :: & + instance, & + of - integer(pInt) :: i,k,l,m,n + integer(pInt) :: & + i,k,l,m,n real(pReal), dimension(param(instance)%totalNslip) :: & - gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg - - associate(prm => param(instance)) + dgdot_dtauslip_pos,dgdot_dtauslip_neg, & + gdot_slip_pos,gdot_slip_neg Lp = 0.0_pReal dLp_dMp = 0.0_pReal + + associate(prm => param(instance)) - call kinetics(Mp,Temperature,instance,of, & - gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) + call kinetics(Mp,Temperature,instance,of,gdot_slip_pos,gdot_slip_neg,dgdot_dtauslip_pos,dgdot_dtauslip_neg) slipSystems: do i = 1_pInt, prm%totalNslip Lp = Lp + (gdot_slip_pos(i)+gdot_slip_neg(i))*prm%Schmid_slip(1:3,1:3,i) forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & @@ -501,7 +501,6 @@ subroutine plastic_disloUCLA_dotState(Mp,Temperature,instance,of) gdot_slip_pos,gdot_slip_neg, & tau_slip_pos1 = tau_slip_pos,tau_slip_neg1 = tau_slip_neg) - dot%whole(:,of) = 0.0_pReal dot%accshear_slip(:,of) = (gdot_slip_pos+gdot_slip_neg) ! ToDo: needs to be abs VacancyDiffusion = prm%D0*exp(-prm%Qsd/(kB*Temperature)) @@ -539,7 +538,7 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe use prec, only: & dEq, dNeq0 use math, only: & - pi, & + PI, & math_mul33xx33 implicit none @@ -557,14 +556,12 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe integer(pInt) :: & o,c,i real(pReal), dimension(param(instance)%totalNslip) :: & - gdot_slip_pos, & - gdot_slip_neg + gdot_slip_pos,gdot_slip_neg + + c = 0_pInt associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) - postResults = 0.0_pReal - c = 0_pInt - outputsLoop: do o = 1_pInt,size(prm%outputID) select case(prm%outputID(o)) @@ -591,14 +588,18 @@ function plastic_disloUCLA_postResults(Mp,Temperature,instance,of) result(postRe endif postResults(c+i)=min(postResults(c+i),dst%mfp(i,of)) enddo + end select c = c + prm%totalNslip + enddo outputsLoop + end associate end function plastic_disloUCLA_postResults + !-------------------------------------------------------------------------------------------------- !> @brief Shear rates on slip systems, their derivatives with respect to resolved stress and the ! resolved stresss @@ -618,23 +619,27 @@ pure subroutine kinetics(Mp,Temperature,instance,of, & implicit none real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress - real(pReal), intent(in) :: & + real(pReal), intent(in) :: & temperature !< temperature - integer(pInt), intent(in) :: & - of, instance + integer(pInt), intent(in) :: & + instance, & + of - integer(pInt) :: & - j - real(pReal), intent(out), dimension(param(instance)%totalNslip) :: & - gdot_slip_pos,gdot_slip_neg - real(pReal), intent(out), optional, dimension(param(instance)%totalNslip) :: & - dgdot_dtauslip_pos,tau_slip_pos1,dgdot_dtauslip_neg,tau_slip_neg1 + real(pReal), intent(out), dimension(param(instance)%totalNslip) :: & + gdot_slip_pos, & + gdot_slip_neg + real(pReal), intent(out), optional, dimension(param(instance)%totalNslip) :: & + dgdot_dtauslip_pos, & + dgdot_dtauslip_neg, & + tau_slip_pos1, & + tau_slip_neg1 real(pReal), dimension(param(instance)%totalNslip) :: & StressRatio, & StressRatio_p,StressRatio_pminus1, & dvel_slip, vel_slip, & tau_slip_pos,tau_slip_neg, & needsGoodName ! ToDo: @Karo: any idea? + integer(pInt) :: j associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 1e42876f9..bc2557503 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -2,12 +2,11 @@ !> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for phenomenological crystal plasticity formulation using a powerlaw -!! fitting +!> @brief phenomenological crystal plasticity formulation using a powerlaw fitting !-------------------------------------------------------------------------------------------------- module plastic_phenopowerlaw use prec, only: & - pReal,& + pReal, & pInt implicit none @@ -100,7 +99,6 @@ module plastic_phenopowerlaw contains - !-------------------------------------------------------------------------------------------------- !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks @@ -194,9 +192,9 @@ subroutine plastic_phenopowerlaw_init prm%aTolTwinfrac = config%getFloat('atol_twinfrac', defaultVal=1.0e-6_pReal) ! sanity checks - if (prm%aTolResistance <= 0.0_pReal) extmsg = trim(extmsg)//'aTolresistance ' - if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//'aTolShear ' - if (prm%aTolTwinfrac <= 0.0_pReal) extmsg = trim(extmsg)//'atoltwinfrac ' + if (prm%aTolResistance <= 0.0_pReal) extmsg = trim(extmsg)//' aTolresistance' + if (prm%aTolShear <= 0.0_pReal) extmsg = trim(extmsg)//' aTolShear' + if (prm%aTolTwinfrac <= 0.0_pReal) extmsg = trim(extmsg)//' atoltwinfrac' !-------------------------------------------------------------------------------------------------- ! slip related parameters @@ -234,11 +232,11 @@ subroutine plastic_phenopowerlaw_init prm%H_int = math_expand(prm%H_int, prm%Nslip) ! sanity checks - if (prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_slip ' - if (prm%a_slip <= 0.0_pReal) extmsg = trim(extmsg)//'a_slip ' - if (prm%n_slip <= 0.0_pReal) extmsg = trim(extmsg)//'n_slip ' - if (any(prm%xi_slip_0 <= 0.0_pReal)) extmsg = trim(extmsg)//'xi_slip_0 ' - if (any(prm%xi_slip_sat < prm%xi_slip_0)) extmsg = trim(extmsg)//'xi_slip_sat ' + if (prm%gdot0_slip <= 0.0_pReal) extmsg = trim(extmsg)//' gdot0_slip' + if (prm%a_slip <= 0.0_pReal) extmsg = trim(extmsg)//' a_slip' + if (prm%n_slip <= 0.0_pReal) extmsg = trim(extmsg)//' n_slip' + if (any(prm%xi_slip_0 <= 0.0_pReal)) extmsg = trim(extmsg)//' xi_slip_0' + if (any(prm%xi_slip_sat < prm%xi_slip_0)) extmsg = trim(extmsg)//' xi_slip_sat' else slipActive allocate(prm%interaction_SlipSlip(0,0)) allocate(prm%xi_slip_0(0)) @@ -268,8 +266,8 @@ subroutine plastic_phenopowerlaw_init prm%xi_twin_0 = math_expand(prm%xi_twin_0, prm%Ntwin) ! sanity checks - if (prm%gdot0_twin <= 0.0_pReal) extmsg = trim(extmsg)//'gdot0_twin ' - if (prm%n_twin <= 0.0_pReal) extmsg = trim(extmsg)//'n_twin ' + if (prm%gdot0_twin <= 0.0_pReal) extmsg = trim(extmsg)//' gdot0_twin' + if (prm%n_twin <= 0.0_pReal) extmsg = trim(extmsg)//' n_twin' else twinActive allocate(prm%interaction_TwinTwin(0,0)) allocate(prm%xi_twin_0(0)) @@ -303,48 +301,49 @@ subroutine plastic_phenopowerlaw_init do i=1_pInt, size(outputs) outputID = undefined_ID select case(outputs(i)) - case ('resistance_slip') - outputID = merge(resistance_slip_ID,undefined_ID,prm%totalNslip>0_pInt) - outputSize = prm%totalNslip - case ('accumulatedshear_slip') - outputID = merge(accumulatedshear_slip_ID,undefined_ID,prm%totalNslip>0_pInt) - outputSize = prm%totalNslip - case ('shearrate_slip') - outputID = merge(shearrate_slip_ID,undefined_ID,prm%totalNslip>0_pInt) - outputSize = prm%totalNslip - case ('resolvedstress_slip') - outputID = merge(resolvedstress_slip_ID,undefined_ID,prm%totalNslip>0_pInt) - outputSize = prm%totalNslip - case ('resistance_twin') - outputID = merge(resistance_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) - outputSize = prm%totalNtwin - case ('accumulatedshear_twin') - outputID = merge(accumulatedshear_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) - outputSize = prm%totalNtwin - case ('shearrate_twin') - outputID = merge(shearrate_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) - outputSize = prm%totalNtwin - case ('resolvedstress_twin') - outputID = merge(resolvedstress_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) - outputSize = prm%totalNtwin + case ('resistance_slip') + outputID = merge(resistance_slip_ID,undefined_ID,prm%totalNslip>0_pInt) + outputSize = prm%totalNslip + case ('accumulatedshear_slip') + outputID = merge(accumulatedshear_slip_ID,undefined_ID,prm%totalNslip>0_pInt) + outputSize = prm%totalNslip + case ('shearrate_slip') + outputID = merge(shearrate_slip_ID,undefined_ID,prm%totalNslip>0_pInt) + outputSize = prm%totalNslip + case ('resolvedstress_slip') + outputID = merge(resolvedstress_slip_ID,undefined_ID,prm%totalNslip>0_pInt) + outputSize = prm%totalNslip - end select + case ('resistance_twin') + outputID = merge(resistance_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) + outputSize = prm%totalNtwin + case ('accumulatedshear_twin') + outputID = merge(accumulatedshear_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) + outputSize = prm%totalNtwin + case ('shearrate_twin') + outputID = merge(shearrate_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) + outputSize = prm%totalNtwin + case ('resolvedstress_twin') + outputID = merge(resolvedstress_twin_ID,undefined_ID,prm%totalNtwin>0_pInt) + outputSize = prm%totalNtwin - if (outputID /= undefined_ID) then - plastic_phenopowerlaw_output(i,phase_plasticityInstance(p)) = outputs(i) - plastic_phenopowerlaw_sizePostResult(i,phase_plasticityInstance(p)) = outputSize - prm%outputID = [prm%outputID , outputID] - endif + end select + + if (outputID /= undefined_ID) then + plastic_phenopowerlaw_output(i,phase_plasticityInstance(p)) = outputs(i) + plastic_phenopowerlaw_sizePostResult(i,phase_plasticityInstance(p)) = outputSize + prm%outputID = [prm%outputID, outputID] + endif end do !-------------------------------------------------------------------------------------------------- ! allocate state arrays NipcMyPhase = count(material_phase == p) - sizeState = size(['tau_slip ','gamma_slip']) * prm%TotalNslip & - + size(['tau_twin ','gamma_twin']) * prm%TotalNtwin - sizeDotState = sizeState + sizeDotState = size(['tau_slip ','gamma_slip']) * prm%TotalNslip & + + size(['tau_twin ','gamma_twin']) * prm%TotalNtwin + sizeState = sizeDotState call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & prm%totalNslip,prm%totalNtwin,0_pInt) @@ -384,6 +383,7 @@ subroutine plastic_phenopowerlaw_init plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally end associate + enddo end subroutine plastic_phenopowerlaw_init @@ -394,7 +394,7 @@ end subroutine plastic_phenopowerlaw_init !> @details asumme that deformation by dislocation glide affects twinned and untwinned volume ! equally (Taylor assumption). Twinning happens only in untwinned volume ( !-------------------------------------------------------------------------------------------------- -subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) +pure subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) implicit none real(pReal), dimension(3,3), intent(out) :: & @@ -515,14 +515,14 @@ function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) math_mul33xx33 implicit none - real(pReal), dimension(3,3), intent(in) :: & + real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress - integer(pInt), intent(in) :: & + integer(pInt), intent(in) :: & instance, & of real(pReal), dimension(sum(plastic_phenopowerlaw_sizePostResult(:,instance))) :: & - postResults + postResults integer(pInt) :: & o,c,i @@ -530,8 +530,8 @@ function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) gdot_slip_pos,gdot_slip_neg c = 0_pInt - - associate( prm => param(instance), stt => state(instance)) + + associate(prm => param(instance), stt => state(instance)) outputsLoop: do o = 1_pInt,size(prm%outputID) select case(prm%outputID(o)) @@ -569,7 +569,7 @@ function plastic_phenopowerlaw_postResults(Mp,instance,of) result(postResults) end select enddo outputsLoop - + end associate end function plastic_phenopowerlaw_postResults @@ -584,7 +584,7 @@ end function plastic_phenopowerlaw_postResults pure subroutine kinetics_slip(Mp,instance,of, & gdot_slip_pos,gdot_slip_neg,dgdot_dtau_slip_pos,dgdot_dtau_slip_neg) use prec, only: & - dNeq0 + dNeq0 use math, only: & math_mul33xx33 @@ -595,13 +595,12 @@ pure subroutine kinetics_slip(Mp,instance,of, & instance, & of - real(pReal), dimension(param(instance)%totalNslip), intent(out) :: & + real(pReal), intent(out), dimension(param(instance)%totalNslip) :: & gdot_slip_pos, & gdot_slip_neg - real(pReal), dimension(param(instance)%totalNslip), intent(out), optional :: & + real(pReal), intent(out), optional, dimension(param(instance)%totalNslip) :: & dgdot_dtau_slip_pos, & dgdot_dtau_slip_neg - real(pReal), dimension(param(instance)%totalNslip) :: & tau_slip_pos, & tau_slip_neg From 77a0cfd7a21b6844cf4a96d1ad149a57b4c7ee8d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 5 Jan 2019 23:41:13 +0100 Subject: [PATCH 145/147] also adjusted plastic_isotropic --- src/plastic_isotropic.f90 | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index a44681676..0e2530abd 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -9,7 +9,7 @@ !-------------------------------------------------------------------------------------------------- module plastic_isotropic use prec, only: & - pReal,& + pReal, & pInt implicit none @@ -71,7 +71,6 @@ module plastic_isotropic contains - !-------------------------------------------------------------------------------------------------- !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks @@ -122,7 +121,7 @@ subroutine plastic_isotropic_init() sizeState, sizeDotState character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::] - + integer(kind(undefined_ID)) :: & outputID @@ -204,16 +203,18 @@ subroutine plastic_isotropic_init() do i=1_pInt, size(outputs) outputID = undefined_ID select case(outputs(i)) + case ('flowstress') outputID = flowstress_ID case ('strainrate') outputID = strainrate_ID + end select - + if (outputID /= undefined_ID) then - plastic_isotropic_output(i,phase_plasticityInstance(p)) = outputs(i) - plastic_isotropic_sizePostResult(i,phase_plasticityInstance(p)) = 1_pInt - prm%outputID = [prm%outputID , outputID] + plastic_isotropic_output(i,phase_plasticityInstance(p)) = outputs(i) + plastic_isotropic_sizePostResult(i,phase_plasticityInstance(p)) = 1_pInt + prm%outputID = [prm%outputID, outputID] endif end do @@ -221,8 +222,8 @@ subroutine plastic_isotropic_init() !-------------------------------------------------------------------------------------------------- ! allocate state arrays NipcMyPhase = count(material_phase == p) - sizeState = size(["flowstress ","accumulated_shear"]) - sizeDotState = sizeState + sizeDotState = size(['flowstress ','accumulated_shear']) + sizeState = sizeDotState call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,0_pInt, & 1_pInt,0_pInt,0_pInt) @@ -243,8 +244,8 @@ subroutine plastic_isotropic_init() plasticState(p)%accumulatedSlip => plasticState(p)%state (2:2,1:NipcMyPhase) plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally - - end associate + + end associate enddo @@ -319,7 +320,7 @@ subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) end if end associate - + end subroutine plastic_isotropic_LpAndItsTangent @@ -373,9 +374,9 @@ subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dTstar,Tstar,instance,of) Li = 0.0_pReal dLi_dTstar = 0.0_pReal endif - + end associate - + end subroutine plastic_isotropic_LiAndItsTangent @@ -471,6 +472,7 @@ function plastic_isotropic_postResults(Mp,instance,of) result(postResults) outputsLoop: do o = 1_pInt,size(prm%outputID) select case(prm%outputID(o)) + case (flowstress_ID) postResults(c+1_pInt) = stt%flowstress(of) c = c + 1_pInt @@ -478,6 +480,7 @@ function plastic_isotropic_postResults(Mp,instance,of) result(postResults) postResults(c+1_pInt) = prm%gdot0 & * (sqrt(1.5_pReal) * norm_Mp /(prm%fTaylor * stt%flowstress(of)))**prm%n c = c + 1_pInt + end select enddo outputsLoop From 19df6f8a71d59c285a24655ef75ac5a3b486db09 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 5 Jan 2019 23:55:10 +0100 Subject: [PATCH 146/147] general polishing --- src/config.f90 | 18 +++++------ src/plastic_disloUCLA.f90 | 4 +-- src/plastic_isotropic.f90 | 6 ++-- src/plastic_none.f90 | 56 ++++++++++++++--------------------- src/plastic_phenopowerlaw.f90 | 4 +-- 5 files changed, 38 insertions(+), 50 deletions(-) diff --git a/src/config.f90 b/src/config.f90 index c7fd95b43..dcc14e015 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -318,7 +318,7 @@ subroutine show(this) do while (associated(item%next)) write(6,'(a)') ' '//trim(item%string%val) item => item%next - end do + enddo end subroutine show @@ -391,7 +391,7 @@ logical function keyExists(this,key) do while (associated(item%next) .and. .not. keyExists) keyExists = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key) item => item%next - end do + enddo end function keyExists @@ -417,7 +417,7 @@ integer(pInt) function countKeys(this,key) if (trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)) & countKeys = countKeys + 1_pInt item => item%next - end do + enddo end function countKeys @@ -451,7 +451,7 @@ real(pReal) function getFloat(this,key,defaultVal) getFloat = IO_FloatValue(item%string%val,item%string%pos,2) endif item => item%next - end do + enddo if (.not. found) call IO_error(140_pInt,ext_msg=key) @@ -487,7 +487,7 @@ integer(pInt) function getInt(this,key,defaultVal) getInt = IO_IntValue(item%string%val,item%string%pos,2) endif item => item%next - end do + enddo if (.not. found) call IO_error(140_pInt,ext_msg=key) @@ -538,7 +538,7 @@ character(len=65536) function getString(this,key,defaultVal,raw) endif endif item => item%next - end do + enddo if (.not. found) call IO_error(140_pInt,ext_msg=key) @@ -584,7 +584,7 @@ function getFloats(this,key,defaultVal,requiredShape,requiredSize) enddo endif item => item%next - end do + enddo if (.not. found) then if (present(defaultVal)) then; getFloats = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif @@ -635,7 +635,7 @@ function getInts(this,key,defaultVal,requiredShape,requiredSize) enddo endif item => item%next - end do + enddo if (.not. found) then if (present(defaultVal)) then; getInts = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif @@ -712,7 +712,7 @@ function getStrings(this,key,defaultVal,requiredShape,raw) endif notAllocated endif item => item%next - end do + enddo if (.not. found) then if (present(defaultVal)) then; getStrings = defaultVal; else; call IO_error(140_pInt,ext_msg=key); endif diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index f82f54006..67adb083b 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -189,7 +189,7 @@ subroutine plastic_disloUCLA_init() allocate(dependentState(Ninstance)) - do p = 1_pInt, size(phase_plasticityInstance) + do p = 1_pInt, size(phase_plasticity) if (phase_plasticity(p) /= PLASTICITY_DISLOUCLA_ID) cycle associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & @@ -325,7 +325,7 @@ subroutine plastic_disloUCLA_init() prm%outputID = [prm%outputID, outputID] endif - end do + enddo !-------------------------------------------------------------------------------------------------- ! allocate state arrays diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index 0e2530abd..c7d92651a 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -91,7 +91,7 @@ subroutine plastic_isotropic_init() debug_levelExtensive, & #endif debug_level, & - debug_constitutive,& + debug_constitutive, & debug_levelBasic use IO, only: & IO_error, & @@ -148,7 +148,7 @@ subroutine plastic_isotropic_init() allocate(state(Ninstance)) allocate(dotState(Ninstance)) - do p = 1_pInt, size(phase_plasticityInstance) + do p = 1_pInt, size(phase_plasticity) if (phase_plasticity(p) /= PLASTICITY_ISOTROPIC_ID) cycle associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & @@ -217,7 +217,7 @@ subroutine plastic_isotropic_init() prm%outputID = [prm%outputID, outputID] endif - end do + enddo !-------------------------------------------------------------------------------------------------- ! allocate state arrays diff --git a/src/plastic_none.f90 b/src/plastic_none.f90 index 5b5bb49d1..2c6ca6e93 100644 --- a/src/plastic_none.f90 +++ b/src/plastic_none.f90 @@ -1,7 +1,8 @@ !-------------------------------------------------------------------------------------------------- !> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for purely elastic material +!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH +!> @brief Dummy plasticity for purely elastic material !-------------------------------------------------------------------------------------------------- module plastic_none @@ -13,7 +14,6 @@ module plastic_none contains - !-------------------------------------------------------------------------------------------------- !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks @@ -32,52 +32,40 @@ subroutine plastic_none_init debug_levelBasic use IO, only: & IO_timeStamp - use numerics, only: & - numerics_integrator use material, only: & phase_plasticity, & + material_allocatePlasticState, & PLASTICITY_NONE_label, & + PLASTICITY_NONE_ID, & material_phase, & - plasticState, & - PLASTICITY_none_ID + plasticState implicit none - integer(pInt) :: & - maxNinstance, & - phase, & - NofMyPhase - + Ninstance, & + p, & + NipcMyPhase + write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_NONE_label//' init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - - maxNinstance = int(count(phase_plasticity == PLASTICITY_none_ID),pInt) + + Ninstance = int(count(phase_plasticity == PLASTICITY_NONE_ID),pInt) if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & - write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance + write(6,'(a16,1x,i5,/)') '# instances:',Ninstance - initializeInstances: do phase = 1_pInt, size(phase_plasticity) - if (phase_plasticity(phase) == PLASTICITY_none_ID) then - NofMyPhase=count(material_phase==phase) + do p = 1_pInt, size(phase_plasticity) + if (phase_plasticity(p) /= PLASTICITY_NONE_ID) cycle - allocate(plasticState(phase)%aTolState (0_pInt)) - allocate(plasticState(phase)%state0 (0_pInt,NofMyPhase)) - allocate(plasticState(phase)%partionedState0 (0_pInt,NofMyPhase)) - allocate(plasticState(phase)%subState0 (0_pInt,NofMyPhase)) - allocate(plasticState(phase)%state (0_pInt,NofMyPhase)) +!-------------------------------------------------------------------------------------------------- +! allocate state arrays + NipcMyPhase = count(material_phase == p) - allocate(plasticState(phase)%dotState (0_pInt,NofMyPhase)) - allocate(plasticState(phase)%deltaState (0_pInt,NofMyPhase)) - if (any(numerics_integrator == 1_pInt)) then - allocate(plasticState(phase)%previousDotState (0_pInt,NofMyPhase)) - allocate(plasticState(phase)%previousDotState2(0_pInt,NofMyPhase)) - endif - if (any(numerics_integrator == 4_pInt)) & - allocate(plasticState(phase)%RK4dotState (0_pInt,NofMyPhase)) - if (any(numerics_integrator == 5_pInt)) & - allocate(plasticState(phase)%RKCK45dotState (6,0_pInt,NofMyPhase)) - endif - enddo initializeInstances + call material_allocatePlasticState(p,NipcMyPhase,0_pInt,0_pInt,0_pInt, & + 0_pInt,0_pInt,0_pInt) + plasticState(p)%sizePostResults = 0_pInt + + enddo end subroutine plastic_none_init diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index bc2557503..82050086e 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -171,7 +171,7 @@ subroutine plastic_phenopowerlaw_init allocate(state(Ninstance)) allocate(dotState(Ninstance)) - do p = 1_pInt, size(phase_plasticityInstance) + do p = 1_pInt, size(phase_plasticity) if (phase_plasticity(p) /= PLASTICITY_PHENOPOWERLAW_ID) cycle associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & @@ -336,7 +336,7 @@ subroutine plastic_phenopowerlaw_init prm%outputID = [prm%outputID, outputID] endif - end do + enddo !-------------------------------------------------------------------------------------------------- ! allocate state arrays From 8277e960c081c62cd9d8fd7aa44edb47be8e35be Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 6 Jan 2019 15:07:50 +0100 Subject: [PATCH 147/147] [skip ci] updated version information after successful test of v2.0.2-1291-g19df6f8a --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8d5912448..6efd0b994 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.2-1277-g53bc24cc +v2.0.2-1291-g19df6f8a