From 73f0fa3abae97a938ff9d5762a8b9ae5d73fc1ca Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Wed, 1 Jul 2020 21:22:05 +0200 Subject: [PATCH] further simplification --- src/constitutive.f90 | 79 +++++------------- src/constitutive_plastic_isotropic.f90 | 64 ++++++++------- src/constitutive_plastic_kinehardening.f90 | 55 ++++++++----- src/constitutive_plastic_nonlocal.f90 | 93 ++++++++++++---------- 4 files changed, 140 insertions(+), 151 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index b07a2b786..cf7f5fa94 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -38,17 +38,13 @@ module constitutive module subroutine plastic_none_init end subroutine plastic_none_init - module subroutine plastic_isotropic_init(debug_constitutive) - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options + module subroutine plastic_isotropic_init end subroutine plastic_isotropic_init module subroutine plastic_phenopowerlaw_init end subroutine plastic_phenopowerlaw_init - module subroutine plastic_kinehardening_init(debug_constitutive) - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options + module subroutine plastic_kinehardening_init end subroutine plastic_kinehardening_init module subroutine plastic_dislotwin_init @@ -57,14 +53,11 @@ module constitutive module subroutine plastic_disloUCLA_init end subroutine plastic_disloUCLA_init - module subroutine plastic_nonlocal_init(debug_constitutive) - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options + module subroutine plastic_nonlocal_init end subroutine plastic_nonlocal_init - module subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of, & - debug_constitutive) + module subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) real(pReal), dimension(3,3), intent(out) :: & Lp !< plastic velocity gradient real(pReal), dimension(3,3,3,3), intent(out) :: & @@ -75,8 +68,6 @@ module constitutive integer, intent(in) :: & instance, & of - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options end subroutine plastic_isotropic_LpAndItsTangent pure module subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) @@ -154,8 +145,7 @@ module constitutive end subroutine plastic_nonlocal_LpAndItsTangent - module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,of, & - debug_constitutive) + module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,of) real(pReal), dimension(3,3), intent(out) :: & Li !< inleastic velocity gradient real(pReal), dimension(3,3,3,3), intent(out) :: & @@ -166,8 +156,6 @@ module constitutive integer, intent(in) :: & instance, & of - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options end subroutine plastic_isotropic_LiAndItsTangent @@ -216,7 +204,7 @@ module constitutive end subroutine plastic_disloUCLA_dotState module subroutine plastic_nonlocal_dotState(Mp, F, Fp, Temperature,timestep, & - instance,of,ip,el,debug_constitutive) + instance,of,ip,el) real(pReal), dimension(3,3), intent(in) ::& Mp !< MandelStress real(pReal), dimension(3,3,homogenization_maxNgrains,discretization_nIP,discretization_nElem), intent(in) :: & @@ -230,8 +218,6 @@ module constitutive of, & ip, & !< current integration point el !< current element number - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options end subroutine plastic_nonlocal_dotState @@ -249,8 +235,7 @@ module constitutive of end subroutine plastic_disloUCLA_dependentState - module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el, & - debug_constitutive) + module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el) real(pReal), dimension(3,3), intent(in) :: & F, & Fp @@ -259,22 +244,18 @@ module constitutive of, & ip, & el - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options end subroutine plastic_nonlocal_dependentState - module subroutine plastic_kinehardening_deltaState(Mp,instance,of,debug_constitutive) + module subroutine plastic_kinehardening_deltaState(Mp,instance,of) real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress integer, intent(in) :: & instance, & of - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options end subroutine plastic_kinehardening_deltaState - module subroutine plastic_nonlocal_deltaState(Mp,instance,of,ip,el,debug_constitutive) + module subroutine plastic_nonlocal_deltaState(Mp,instance,of,ip,el) real(pReal), dimension(3,3), intent(in) :: & Mp integer, intent(in) :: & @@ -282,8 +263,6 @@ module constitutive of, & ip, & el - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options end subroutine plastic_nonlocal_deltaState @@ -362,20 +341,16 @@ subroutine constitutive_init integer :: & ph, & !< counter in phase loop s !< counter in source loop - class(tNode), pointer :: & - debug_constitutive - - debug_constitutive => debug_root%get('constitutuve',defaultVal=emptyList) !-------------------------------------------------------------------------------------------------- ! initialized plasticity if (any(phase_plasticity == PLASTICITY_NONE_ID)) call plastic_none_init - if (any(phase_plasticity == PLASTICITY_ISOTROPIC_ID)) call plastic_isotropic_init(debug_constitutive) + if (any(phase_plasticity == PLASTICITY_ISOTROPIC_ID)) call plastic_isotropic_init if (any(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID)) call plastic_phenopowerlaw_init - if (any(phase_plasticity == PLASTICITY_KINEHARDENING_ID)) call plastic_kinehardening_init(debug_constitutive) + if (any(phase_plasticity == PLASTICITY_KINEHARDENING_ID)) call plastic_kinehardening_init if (any(phase_plasticity == PLASTICITY_DISLOTWIN_ID)) call plastic_dislotwin_init if (any(phase_plasticity == PLASTICITY_DISLOUCLA_ID)) call plastic_disloucla_init if (any(phase_plasticity == PLASTICITY_NONLOCAL_ID)) then - call plastic_nonlocal_init(debug_constitutive) + call plastic_nonlocal_init else call geometry_plastic_nonlocal_disable endif @@ -454,10 +429,7 @@ subroutine constitutive_dependentState(F, Fp, ipc, ip, el) ho, & !< homogenization tme, & !< thermal member position instance, of - class(tNode), pointer :: & - debug_constitutive - debug_constitutive => debug_root%get('constitutive',defaultVal=emptyList) ho = material_homogenizationAt(el) tme = thermalMapping(ho)%p(ip,el) of = material_phasememberAt(ipc,ip,el) @@ -469,7 +441,7 @@ subroutine constitutive_dependentState(F, Fp, ipc, ip, el) case (PLASTICITY_DISLOUCLA_ID) plasticityType call plastic_disloUCLA_dependentState(instance,of) case (PLASTICITY_NONLOCAL_ID) plasticityType - call plastic_nonlocal_dependentState (F,Fp,instance,of,ip,el,debug_constitutive) + call plastic_nonlocal_dependentState (F,Fp,instance,of,ip,el) end select plasticityType end subroutine constitutive_dependentState @@ -503,10 +475,7 @@ subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & tme !< thermal member position integer :: & i, j, instance, of - class(tNode), pointer :: & - debug_constitutive - debug_constitutive => debug_root%get('constitutive',defaultVal=emptyList) ho = material_homogenizationAt(el) tme = thermalMapping(ho)%p(ip,el) @@ -522,7 +491,7 @@ subroutine constitutive_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & dLp_dMp = 0.0_pReal case (PLASTICITY_ISOTROPIC_ID) plasticityType - call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp,Mp,instance,of,debug_constitutive) + call plastic_isotropic_LpAndItsTangent (Lp,dLp_dMp,Mp,instance,of) case (PLASTICITY_PHENOPOWERLAW_ID) plasticityType call plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) @@ -582,11 +551,7 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & integer :: & k, i, j, & instance, of - class(tNode), pointer :: & - debug_constitutive - debug_constitutive => debug_root%get('constitutive',defaultVal=emptyList) - Li = 0.0_pReal dLi_dS = 0.0_pReal dLi_dFi = 0.0_pReal @@ -595,7 +560,7 @@ subroutine constitutive_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & case (PLASTICITY_isotropic_ID) plasticityType of = material_phasememberAt(ipc,ip,el) instance = phase_plasticityInstance(material_phaseAt(ipc,el)) - call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,instance,of,debug_constitutive) + call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,instance,of) case default plasticityType my_Li = 0.0_pReal my_dLi_dS = 0.0_pReal @@ -768,12 +733,8 @@ function constitutive_collectDotState(S, FArray, Fi, FpArray, subdt, ipc, ip, el tme, & !< thermal member position i, & !< counter in source loop instance - class(tNode), pointer :: & - debug_constitutive logical :: broken - debug_constitutive => debug_root%get('constitutive',defaultVal=emptyList) - ho = material_homogenizationAt(el) tme = thermalMapping(ho)%p(ip,el) instance = phase_plasticityInstance(phase) @@ -799,7 +760,7 @@ function constitutive_collectDotState(S, FArray, Fi, FpArray, subdt, ipc, ip, el case (PLASTICITY_NONLOCAL_ID) plasticityType call plastic_nonlocal_dotState (Mp,FArray,FpArray,temperature(ho)%p(tme),subdt, & - instance,of,ip,el,debug_constitutive) + instance,of,ip,el) end select plasticityType broken = any(IEEE_is_NaN(plasticState(phase)%dotState(:,of))) @@ -851,24 +812,20 @@ function constitutive_deltaState(S, Fe, Fi, ipc, ip, el, phase, of) result(broke instance, & myOffset, & mySize - class(tNode), pointer :: & - debug_constitutive logical :: & broken - debug_constitutive => debug_root%get('constitutive',defaultVal=emptyList) - Mp = matmul(matmul(transpose(Fi),Fi),S) instance = phase_plasticityInstance(phase) plasticityType: select case (phase_plasticity(phase)) case (PLASTICITY_KINEHARDENING_ID) plasticityType - call plastic_kinehardening_deltaState(Mp,instance,of,debug_constitutive) + call plastic_kinehardening_deltaState(Mp,instance,of) broken = any(IEEE_is_NaN(plasticState(phase)%deltaState(:,of))) case (PLASTICITY_NONLOCAL_ID) plasticityType - call plastic_nonlocal_deltaState(Mp,instance,of,ip,el,debug_constitutive) + call plastic_nonlocal_deltaState(Mp,instance,of,ip,el) broken = any(IEEE_is_NaN(plasticState(phase)%deltaState(:,of))) case default diff --git a/src/constitutive_plastic_isotropic.f90 b/src/constitutive_plastic_isotropic.f90 index adb293c64..d8b799363 100644 --- a/src/constitutive_plastic_isotropic.f90 +++ b/src/constitutive_plastic_isotropic.f90 @@ -36,6 +36,20 @@ submodule(constitutive) plastic_isotropic gamma end type tIsotropicState +#ifdef DEBUG + type :: tDebugOptions + logical :: & + extensive, & + selective + integer :: & + element, & + ip, & + grain + end type tDebugOptions + + type(tDebugOptions) :: debug + +#endif !-------------------------------------------------------------------------------------------------- ! containers for parameters and state type(tParameters), allocatable, dimension(:) :: param @@ -49,32 +63,36 @@ contains !> @brief Perform module initialization. !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module subroutine plastic_isotropic_init(debug_constitutive) - - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options +module subroutine plastic_isotropic_init integer :: & Ninstance, & p, & NipcMyPhase, & - sizeState, sizeDotState, & - debug_g, & - debug_e, & - debug_i + sizeState, sizeDotState real(pReal) :: & xi_0 !< initial critical stress character(len=pStringLen) :: & extmsg = '' + class(tNode), pointer :: & + debug_constitutive - write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_ISOTROPIC_LABEL//' init -+>>>'; flush(6) + 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' Ninstance = count(phase_plasticity == PLASTICITY_ISOTROPIC_ID) - if (debug_constitutive%contains('basic')) & - write(6,'(a16,1x,i5,/)') '# instances:',Ninstance + write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) + +#ifdef DEBUG + debug_constitutive => debug_root%get('constitutuve', defaultVal=emptyList) + debug%extensive = debug_constitutive%contains('extensive') + debug%selective = debug_constitutive%contains('selective') + debug%element = debug_root%get_asInt('element',defaultVal = 1) + debug%ip = debug_root%get_asInt('integrationpoint',defaultVal = 1) + debug%grain = debug_root%get_asInt('grain',defaultVal = 1) +#endif allocate(param(Ninstance)) allocate(state(Ninstance)) @@ -90,12 +108,8 @@ module subroutine plastic_isotropic_init(debug_constitutive) prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) #ifdef DEBUG - debug_g = debug_root%get_asInt('grain',defaultVal=1) - debug_e = debug_root%get_asInt('element',defaultVal=1) - debug_i = debug_root%get_asInt('integrationpoint',defaultVal=1) - - if (p==material_phaseAt(debug_g,debug_e)) & - prm%of_debug = material_phasememberAt(debug_g,debug_i,debug_e) + if (p==material_phaseAt(debug%grain,debug%element)) & + prm%of_debug = material_phasememberAt(debug%grain,debug%ip,debug%element) #endif xi_0 = config%getFloat('tau0') @@ -160,7 +174,7 @@ end subroutine plastic_isotropic_init !-------------------------------------------------------------------------------------------------- !> @brief Calculate plastic velocity gradient and its tangent. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of,debug_constitutive) +module subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of) real(pReal), dimension(3,3), intent(out) :: & Lp !< plastic velocity gradient @@ -172,8 +186,6 @@ module subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of,de integer, intent(in) :: & instance, & of - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options real(pReal), dimension(3,3) :: & Mp_dev !< deviatoric part of the Mandel stress @@ -195,8 +207,8 @@ module subroutine plastic_isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,instance,of,de Lp = dot_gamma/prm%M * Mp_dev/norm_Mp_dev #ifdef DEBUG - if (debug_constitutive%contains('extensive') & - .and. (of == prm%of_debug .or. .not. debug_constitutive%contains('selective'))) then + if (debug%extensive & + .and. (of == prm%of_debug .or. .not. debug%selective)) 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 @@ -223,7 +235,7 @@ end subroutine plastic_isotropic_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief Calculate inelastic velocity gradient and its tangent. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,of,debug_constitutive) +module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,of) real(pReal), dimension(3,3), intent(out) :: & Li !< inleastic velocity gradient @@ -235,8 +247,6 @@ module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,of,de integer, intent(in) :: & instance, & of - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options real(pReal) :: & tr !< trace of spherical part of Mandel stress (= 3 x pressure) @@ -253,8 +263,8 @@ module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,instance,of,de * tr * abs(tr)**(prm%n-1.0_pReal) #ifdef DEBUG - if (debug_constitutive%contains('extensive') & - .and. (of == prm%of_debug .or. .not. debug_constitutive%contains('selective'))) then + if (debug%extensive & + .and. (of == prm%of_debug .or. .not. debug%selective)) then write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> pressure / MPa', tr/3.0_pReal*1.0e-6_pReal write(6,'(/,a,/,f12.5)') '<< CONST isotropic >> gdot', prm%dot_gamma_0 * (3.0_pReal*prm%M*stt%xi(of))**(-prm%n) & * tr * abs(tr)**(prm%n-1.0_pReal) diff --git a/src/constitutive_plastic_kinehardening.f90 b/src/constitutive_plastic_kinehardening.f90 index 645a3916b..f82b84641 100644 --- a/src/constitutive_plastic_kinehardening.f90 +++ b/src/constitutive_plastic_kinehardening.f90 @@ -43,6 +43,21 @@ submodule(constitutive) plastic_kinehardening accshear !< accumulated (absolute) shear end type tKinehardeningState +#ifdef DEBUG + type :: tDebugOptions + logical :: & + extensive, & + selective + integer :: & + element, & + ip, & + grain + end type tDebugOptions + + type(tDebugOptions) :: debug + +#endif + !-------------------------------------------------------------------------------------------------- ! containers for parameters and state type(tParameters), allocatable, dimension(:) :: param @@ -58,18 +73,14 @@ contains !> @brief Perform module initialization. !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module subroutine plastic_kinehardening_init(debug_constitutive) - - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options +module subroutine plastic_kinehardening_init integer :: & Ninstance, & p, o, & NipcMyPhase, & sizeState, sizeDeltaState, sizeDotState, & - startIndex, endIndex, & - debug_e, debug_i, debug_g + startIndex, endIndex integer, dimension(:), allocatable :: & N_sl real(pReal), dimension(:), allocatable :: & @@ -77,12 +88,22 @@ module subroutine plastic_kinehardening_init(debug_constitutive) a !< non-Schmid coefficients character(len=pStringLen) :: & extmsg = '' + class(tNode), pointer :: & + debug_constitutive - write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_KINEHARDENING_LABEL//' init -+>>>'; flush(6) + write(6,'(/,a)') ' <<<+- plastic_'//PLASTICITY_KINEHARDENING_LABEL//' init -+>>>' Ninstance = count(phase_plasticity == PLASTICITY_KINEHARDENING_ID) - if (debug_constitutive%contains('basic')) & - write(6,'(a16,1x,i5,/)') '# instances:',Ninstance + write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) + +#ifdef DEBUG + debug_constitutive => debug_root%get('constitutuve', defaultVal=emptyList) + debug%extensive = debug_constitutive%contains('extensive') + debug%selective = debug_constitutive%contains('selective') + debug%element = debug_root%get_asInt('element',defaultVal = 1) + debug%ip = debug_root%get_asInt('integrationpoint',defaultVal = 1) + debug%grain = debug_root%get_asInt('grain',defaultVal = 1) +#endif allocate(param(Ninstance)) allocate(state(Ninstance)) @@ -100,12 +121,8 @@ module subroutine plastic_kinehardening_init(debug_constitutive) prm%output = config%getStrings('(output)',defaultVal=emptyStringArray) #ifdef DEBUG - debug_g = debug_root%get_asInt('grain',defaultVal=1) - debug_e = debug_root%get_asInt('element',defaultVal=1) - debug_i = debug_root%get_asInt('integrationpoint',defaultVal=1) - - if (p==material_phaseAt(debug_g,debug_e)) then - prm%of_debug = material_phasememberAt(debug_g,debug_i,debug_e) + if (p==material_phaseAt(debug%grain,debug%element)) then + prm%of_debug = material_phasememberAt(debug%grain,debug%ip,debug%element) endif #endif @@ -316,15 +333,13 @@ end subroutine plastic_kinehardening_dotState !-------------------------------------------------------------------------------------------------- !> @brief Calculate (instantaneous) incremental change of microstructure. !-------------------------------------------------------------------------------------------------- -module subroutine plastic_kinehardening_deltaState(Mp,instance,of,debug_constitutive) +module subroutine plastic_kinehardening_deltaState(Mp,instance,of) real(pReal), dimension(3,3), intent(in) :: & Mp !< Mandel stress integer, intent(in) :: & instance, & of - class(tNode), pointer , intent(in) :: & - debug_constitutive !< pointer to constitutive debug options real(pReal), dimension(param(instance)%sum_N_sl) :: & gdot_pos,gdot_neg, & @@ -338,9 +353,9 @@ module subroutine plastic_kinehardening_deltaState(Mp,instance,of,debug_constitu dEq0(gdot_pos+gdot_neg,1e-10_pReal)) ! current sense of shear direction #ifdef DEBUG - if (debug_constitutive%contains('extensive') & + if (debug%extensive & .and. (of == prm%of_debug & - .or. .not. debug_constitutive%contains('selective'))) then + .or. .not. debug%selective)) then write(6,'(a)') '======= kinehardening delta state =======' write(6,*) sense,state(instance)%sense(:,of) endif diff --git a/src/constitutive_plastic_nonlocal.f90 b/src/constitutive_plastic_nonlocal.f90 index a131f4517..6469a0f87 100644 --- a/src/constitutive_plastic_nonlocal.f90 +++ b/src/constitutive_plastic_nonlocal.f90 @@ -147,6 +147,22 @@ submodule(constitutive) plastic_nonlocal v_scr_neg end type tNonlocalState +#ifdef DEBUG + type :: tDebugOptions + logical :: & + basic, & + extensive, & + selective + integer :: & + element, & + ip, & + grain + end type tDebugOptions + + type(tDebugOptions) :: debug + +#endif + type(tNonlocalState), allocatable, dimension(:) :: & deltaState, & dotState, & @@ -163,10 +179,7 @@ contains !> @brief module initialization !> @details reads in material parameters, allocates arrays, and does sanity checks !-------------------------------------------------------------------------------------------------- -module subroutine plastic_nonlocal_init(debug_constitutive) - - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options +module subroutine plastic_nonlocal_init integer :: & Ninstance, & @@ -181,8 +194,10 @@ module subroutine plastic_nonlocal_init(debug_constitutive) extmsg = '' type(tInitialParameters) :: & ini + class(tNode), pointer :: & + debug_constitutive - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONLOCAL_LABEL//' init -+>>>'; flush(6) + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONLOCAL_LABEL//' init -+>>>' write(6,'(/,a)') ' Reuber et al., Acta Materialia 71:333–348, 2014' write(6,'(a)') ' https://doi.org/10.1016/j.actamat.2014.03.012' @@ -191,8 +206,17 @@ module subroutine plastic_nonlocal_init(debug_constitutive) write(6,'(a)') ' http://publications.rwth-aachen.de/record/229993' Ninstance = count(phase_plasticity == PLASTICITY_NONLOCAL_ID) - if (debug_constitutive%contains('basic')) & - write(6,'(a16,1x,i5,/)') '# instances:',Ninstance + write(6,'(a16,1x,i5,/)') '# instances:',Ninstance; flush(6) + +#ifdef DEBUG + debug_constitutive => debug_root%get('constitutuve', defaultVal=emptyList) + debug%basic = debug_constitutive%contains('basic') + debug%extensive = debug_constitutive%contains('extensive') + debug%selective = debug_constitutive%contains('selective') + debug%element = debug_root%get_asInt('element',defaultVal = 1) + debug%ip = debug_root%get_asInt('integrationpoint',defaultVal = 1) + debug%grain = debug_root%get_asInt('grain',defaultVal = 1) +#endif allocate(param(Ninstance)) allocate(state(Ninstance)) @@ -525,7 +549,7 @@ end subroutine plastic_nonlocal_init !-------------------------------------------------------------------------------------------------- !> @brief calculates quantities characterizing the microstructure !-------------------------------------------------------------------------------------------------- -module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el,debug_constitutive) +module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el) real(pReal), dimension(3,3), intent(in) :: & F, & @@ -535,8 +559,6 @@ module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el,de of, & ip, & el - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options integer :: & no, & !< neighbor offset @@ -546,8 +568,7 @@ module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el,de c, & ! index of dilsocation character (edge, screw) s, & ! slip system index dir, & - n, & - debug_e, debug_i + n real(pReal) :: & FVsize, & nRealNeighbors ! number of really existing neighbors @@ -716,11 +737,9 @@ module subroutine plastic_nonlocal_dependentState(F, Fp, instance, of, ip, el,de endif #ifdef DEBUG - debug_e = debug_root%get_asInt('element',defaultVal=1) - debug_i = debug_root%get_asInt('integrationpoint',defaultVal=1) - if (debug_constitutive%contains('extensive') & - .and. ((debug_e == el .and. debug_i == ip)& - .or. .not. debug_constitutive%contains('selective'))) then + if (debug%extensive & + .and. ((debug%element == el .and. debug%ip == ip)& + .or. .not. debug%selective)) then write(6,'(/,a,i8,1x,i2,1x,i1,/)') '<< CONST >> nonlocal_microstructure at el ip ',el,ip write(6,'(a,/,12x,12(e10.3,1x))') '<< CONST >> rhoForest', stt%rho_forest(:,of) write(6,'(a,/,12x,12(f10.5,1x))') '<< CONST >> tauThreshold / MPa', dst%tau_pass(:,of)*1e-6 @@ -844,7 +863,7 @@ end subroutine plastic_nonlocal_LpAndItsTangent !-------------------------------------------------------------------------------------------------- !> @brief (instantaneous) incremental change of microstructure !-------------------------------------------------------------------------------------------------- -module subroutine plastic_nonlocal_deltaState(Mp,instance,of,ip,el,debug_constitutive) +module subroutine plastic_nonlocal_deltaState(Mp,instance,of,ip,el) real(pReal), dimension(3,3), intent(in) :: & Mp !< MandelStress @@ -853,16 +872,13 @@ module subroutine plastic_nonlocal_deltaState(Mp,instance,of,ip,el,debug_constit of, & !< offset ip, & el - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options integer :: & ph, & !< phase ns, & ! short notation for the total number of active slip systems c, & ! character of dislocation t, & ! type of dislocation - s, & ! index of my current slip system - debug_e, debug_i + s ! index of my current slip system real(pReal), dimension(param(instance)%sum_N_sl,10) :: & deltaRhoRemobilization, & ! density increment by remobilization deltaRhoDipole2SingleStress ! density increment by dipole dissociation (by stress change) @@ -938,11 +954,9 @@ module subroutine plastic_nonlocal_deltaState(Mp,instance,of,ip,el,debug_constit del%rho(:,of) = reshape(deltaRhoRemobilization + deltaRhoDipole2SingleStress, [10*ns]) #ifdef DEBUG - debug_e = debug_root%get_asInt('element',defaultVal=1) - debug_i = debug_root%get_asInt('integrationpoint',defaultVal=1) - if (debug_constitutive%contains('extensive') & - .and. ((debug_e == el .and. debug_i == ip)& - .or. .not. debug_constitutive%contains('selective'))) then + if (debug%extensive & + .and. ((debug%element == el .and. debug%ip == ip)& + .or. .not. debug%selective)) then write(6,'(a,/,8(12x,12(e12.5,1x),/))') '<< CONST >> dislocation remobilization', deltaRhoRemobilization(:,1:8) write(6,'(a,/,10(12x,12(e12.5,1x),/),/)') '<< CONST >> dipole dissociation by stress increase', deltaRhoDipole2SingleStress endif @@ -957,7 +971,7 @@ end subroutine plastic_nonlocal_deltaState !> @brief calculates the rate of change of microstructure !--------------------------------------------------------------------------------------------------- module subroutine plastic_nonlocal_dotState(Mp, F, Fp, Temperature,timestep, & - instance,of,ip,el,debug_constitutive) + instance,of,ip,el) real(pReal), dimension(3,3), intent(in) :: & Mp !< MandelStress @@ -972,16 +986,13 @@ module subroutine plastic_nonlocal_dotState(Mp, F, Fp, Temperature,timestep, & of, & ip, & !< current integration point el !< current element number - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options integer :: & ph, & ns, & !< short notation for the total number of active slip systems c, & !< character of dislocation t, & !< type of dislocation - s, & !< index of my current slip system - debug_e, debug_i + s !< index of my current slip system real(pReal), dimension(param(instance)%sum_N_sl,10) :: & rho, & rho0, & !< dislocation density at beginning of time step @@ -1032,11 +1043,9 @@ module subroutine plastic_nonlocal_dotState(Mp, F, Fp, Temperature,timestep, & gdot = rhoSgl(:,1:4) * v * spread(prm%burgers,2,4) #ifdef DEBUG - debug_e = debug_root%get_asInt('element',defaultVal=1) - debug_i = debug_root%get_asInt('integrationpoint',defaultVal=1) - if (debug_constitutive%contains('basic') & - .and. ((debug_e == el .and. debug_i == ip) & - .or. .not. debug_constitutive%contains('selective') )) then + if (debug%basic & + .and. ((debug%element == el .and. debug%ip == ip) & + .or. .not. debug%selective)) then write(6,'(a,/,10(12x,12(e12.5,1x),/))') '<< CONST >> rho / 1/m^2', rhoSgl, rhoDip write(6,'(a,/,4(12x,12(e12.5,1x),/))') '<< CONST >> gdot / 1/s',gdot endif @@ -1135,7 +1144,7 @@ module subroutine plastic_nonlocal_dotState(Mp, F, Fp, Temperature,timestep, & - rhoDip(s,1) / timestep - rhoDotAthermalAnnihilation(s,9) & - rhoDotSingle2DipoleGlide(s,9)) ! make sure that we do not annihilate more dipoles than we have - rhoDot = rhoDotFlux(F,Fp,timestep, instance,of,ip,el,debug_constitutive) & + rhoDot = rhoDotFlux(F,Fp,timestep, instance,of,ip,el) & + rhoDotMultiplication & + rhoDotSingle2DipoleGlide & + rhoDotAthermalAnnihilation & @@ -1145,7 +1154,7 @@ module subroutine plastic_nonlocal_dotState(Mp, F, Fp, Temperature,timestep, & if ( any(rho(:,mob) + rhoDot(:,1:4) * timestep < -prm%atol_rho) & .or. any(rho(:,dip) + rhoDot(:,9:10) * timestep < -prm%atol_rho)) then #ifdef DEBUG - if (debug_constitutive%contains('extensive')) then + if (debug%extensive) then write(6,'(a,i5,a,i2)') '<< CONST >> evolution rate leads to negative density at el ',el,' ip ',ip write(6,'(a)') '<< CONST >> enforcing cutback !!!' endif @@ -1164,7 +1173,7 @@ end subroutine plastic_nonlocal_dotState !--------------------------------------------------------------------------------------------------- !> @brief calculates the rate of change of microstructure !--------------------------------------------------------------------------------------------------- -function rhoDotFlux(F,Fp,timestep, instance,of,ip,el,debug_constitutive) +function rhoDotFlux(F,Fp,timestep, instance,of,ip,el) real(pReal), dimension(3,3,homogenization_maxNgrains,discretization_nIP,discretization_nElem), intent(in) :: & F, & !< elastic deformation gradient @@ -1176,8 +1185,6 @@ function rhoDotFlux(F,Fp,timestep, instance,of,ip,el,debug_constitutive) of, & ip, & !< current integration point el !< current element number - class(tNode), pointer, intent(in) :: & - debug_constitutive !< pointer to constitutive debug options integer :: & ph, & @@ -1259,7 +1266,7 @@ function rhoDotFlux(F,Fp,timestep, instance,of,ip,el,debug_constitutive) .and. prm%CFLfactor * abs(v0) * timestep & > IPvolume(ip,el) / maxval(IParea(:,ip,el)))) then ! ...with velocity above critical value (we use the reference volume and area for simplicity here) #ifdef DEBUG - if (debug_constitutive%contains('extensive')) then + if (debug%extensive) then write(6,'(a,i5,a,i2)') '<< CONST >> CFL condition not fullfilled at el ',el,' ip ',ip write(6,'(a,e10.3,a,e10.3)') '<< CONST >> velocity is at ', & maxval(abs(v0), abs(gdot) > 0.0_pReal &