diff --git a/src/damage_local.f90 b/src/damage_local.f90 index 05d83d029..1c4928fac 100644 --- a/src/damage_local.f90 +++ b/src/damage_local.f90 @@ -143,6 +143,7 @@ function damage_local_updateState(subdt, ip, el) err_damage_tolAbs, & err_damage_tolRel use material, only: & + material_homogenizationAt, & mappingHomogenization, & damageState @@ -160,7 +161,7 @@ function damage_local_updateState(subdt, ip, el) real(pReal) :: & phi, phiDot, dPhiDot_dPhi - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) offset = mappingHomogenization(1,ip,el) phi = damageState(homog)%subState0(1,offset) call damage_local_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el) @@ -182,7 +183,7 @@ end function damage_local_updateState subroutine damage_local_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el) use material, only: & homogenization_Ngrains, & - mappingHomogenization, & + material_homogenizationAt, & phaseAt, & phasememberAt, & phase_source, & @@ -216,7 +217,7 @@ subroutine damage_local_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el phiDot = 0.0_pReal dPhiDot_dPhi = 0.0_pReal - do grain = 1, homogenization_Ngrains(mappingHomogenization(2,ip,el)) + do grain = 1, homogenization_Ngrains(material_homogenizationAt(el)) phase = phaseAt(grain,ip,el) constituent = phasememberAt(grain,ip,el) do source = 1, phase_Nsources(phase) @@ -243,8 +244,8 @@ subroutine damage_local_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el enddo enddo - phiDot = phiDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) - dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) + phiDot = phiDot/real(homogenization_Ngrains(material_homogenizationAt(el)),pReal) + dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Ngrains(material_homogenizationAt(el)),pReal) end subroutine damage_local_getSourceAndItsTangent @@ -253,7 +254,7 @@ end subroutine damage_local_getSourceAndItsTangent !-------------------------------------------------------------------------------------------------- function damage_local_postResults(ip,el) use material, only: & - mappingHomogenization, & + material_homogenizationAt, & damage_typeInstance, & damageMapping, & damage @@ -262,13 +263,13 @@ function damage_local_postResults(ip,el) integer(pInt), intent(in) :: & ip, & !< integration point el !< element - real(pReal), dimension(sum(damage_local_sizePostResult(:,damage_typeInstance(mappingHomogenization(2,ip,el))))) :: & + real(pReal), dimension(sum(damage_local_sizePostResult(:,damage_typeInstance(material_homogenizationAt(el))))) :: & damage_local_postResults integer(pInt) :: & instance, homog, offset, o, c - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) offset = damageMapping(homog)%p(ip,el) instance = damage_typeInstance(homog) associate(prm => param(instance)) diff --git a/src/damage_nonlocal.f90 b/src/damage_nonlocal.f90 index 3bb227e3f..3a2080e84 100644 --- a/src/damage_nonlocal.f90 +++ b/src/damage_nonlocal.f90 @@ -136,7 +136,7 @@ end subroutine damage_nonlocal_init subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el) use material, only: & homogenization_Ngrains, & - mappingHomogenization, & + material_homogenizationAt, & phaseAt, & phasememberAt, & phase_source, & @@ -170,7 +170,7 @@ subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, phiDot = 0.0_pReal dPhiDot_dPhi = 0.0_pReal - do grain = 1, homogenization_Ngrains(mappingHomogenization(2,ip,el)) + do grain = 1, homogenization_Ngrains(material_homogenizationAt(el)) phase = phaseAt(grain,ip,el) constituent = phasememberAt(grain,ip,el) do source = 1, phase_Nsources(phase) @@ -197,8 +197,8 @@ subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, enddo enddo - phiDot = phiDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) - dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) + phiDot = phiDot/real(homogenization_Ngrains(material_homogenizationAt(el)),pReal) + dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Ngrains(material_homogenizationAt(el)),pReal) end subroutine damage_nonlocal_getSourceAndItsTangent @@ -213,7 +213,7 @@ function damage_nonlocal_getDiffusion33(ip,el) use material, only: & homogenization_Ngrains, & material_phase, & - mappingHomogenization + material_homogenizationAt use crystallite, only: & crystallite_push33ToRef @@ -227,7 +227,7 @@ function damage_nonlocal_getDiffusion33(ip,el) homog, & grain - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) damage_nonlocal_getDiffusion33 = 0.0_pReal do grain = 1, homogenization_Ngrains(homog) damage_nonlocal_getDiffusion33 = damage_nonlocal_getDiffusion33 + & @@ -299,7 +299,7 @@ end subroutine damage_nonlocal_putNonLocalDamage !-------------------------------------------------------------------------------------------------- function damage_nonlocal_postResults(ip,el) use material, only: & - mappingHomogenization, & + material_homogenizationAt, & damage_typeInstance, & damageMapping, & damage @@ -308,13 +308,13 @@ function damage_nonlocal_postResults(ip,el) integer(pInt), intent(in) :: & ip, & !< integration point el !< element - real(pReal), dimension(sum(damage_nonlocal_sizePostResult(:,damage_typeInstance(mappingHomogenization(2,ip,el))))) :: & + real(pReal), dimension(sum(damage_nonlocal_sizePostResult(:,damage_typeInstance(material_homogenizationAt(el))))) :: & damage_nonlocal_postResults integer(pInt) :: & instance, homog, offset, o, c - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) offset = damageMapping(homog)%p(ip,el) instance = damage_typeInstance(homog) associate(prm => param(instance)) diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 6d1ffe3e2..06c8bd44c 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -302,6 +302,7 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) thermalState, & damageState, & phase_Nsources, & + material_homogenizationAt, & mappingHomogenization, & phaseAt, phasememberAt, & homogenization_Ngrains @@ -392,17 +393,17 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) materialpoint_requested(i,e) = .true. ! everybody requires calculation endforall forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - homogState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - homogState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - homogState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal homogenization state + homogState(material_homogenizationAt(e))%sizeState > 0_pInt) & + homogState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) = & + homogState(material_homogenizationAt(e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal homogenization state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - thermalState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - thermalState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - thermalState(mappingHomogenization(2,i,e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal thermal state + thermalState(material_homogenizationAt(e))%sizeState > 0_pInt) & + thermalState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) = & + thermalState(material_homogenizationAt(e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal thermal state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - 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 + damageState(material_homogenizationAt(e))%sizeState > 0_pInt) & + damageState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) = & + damageState(material_homogenizationAt(e))%State0( :,mappingHomogenization(1,i,e)) ! ...internal damage state enddo NiterationHomog = 0_pInt @@ -462,17 +463,17 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) enddo forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - homogState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - homogState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - homogState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) ! ...internal homogenization state + homogState(material_homogenizationAt(e))%sizeState > 0_pInt) & + homogState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) = & + homogState(material_homogenizationAt(e))%State( :,mappingHomogenization(1,i,e)) ! ...internal homogenization state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - thermalState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - thermalState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) = & - thermalState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) ! ...internal thermal state + thermalState(material_homogenizationAt(e))%sizeState > 0_pInt) & + thermalState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) = & + thermalState(material_homogenizationAt(e))%State( :,mappingHomogenization(1,i,e)) ! ...internal thermal state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - 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 + damageState(material_homogenizationAt(e))%sizeState > 0_pInt) & + damageState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) = & + damageState(material_homogenizationAt(e))%State( :,mappingHomogenization(1,i,e)) ! ...internal damage state materialpoint_subF0(1:3,1:3,i,e) = materialpoint_subF(1:3,1:3,i,e) ! ...def grad endif steppingNeeded @@ -523,17 +524,17 @@ subroutine materialpoint_stressAndItsTangent(updateJaco,dt) enddo enddo forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - homogState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - homogState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = & - homogState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal homogenization state + homogState(material_homogenizationAt(e))%sizeState > 0_pInt) & + homogState(material_homogenizationAt(e))%State( :,mappingHomogenization(1,i,e)) = & + homogState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal homogenization state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - thermalState(mappingHomogenization(2,i,e))%sizeState > 0_pInt) & - thermalState(mappingHomogenization(2,i,e))%State( :,mappingHomogenization(1,i,e)) = & - thermalState(mappingHomogenization(2,i,e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal thermal state + thermalState(material_homogenizationAt(e))%sizeState > 0_pInt) & + thermalState(material_homogenizationAt(e))%State( :,mappingHomogenization(1,i,e)) = & + thermalState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal thermal state forall(i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), & - 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 + damageState(material_homogenizationAt(e))%sizeState > 0_pInt) & + damageState(material_homogenizationAt(e))%State( :,mappingHomogenization(1,i,e)) = & + damageState(material_homogenizationAt(e))%subState0(:,mappingHomogenization(1,i,e)) ! ...internal damage state endif endif converged @@ -637,7 +638,7 @@ subroutine materialpoint_postResults use mesh, only: & mesh_element use material, only: & - mappingHomogenization, & + material_homogenizationAt, & homogState, & thermalState, & damageState, & @@ -667,9 +668,9 @@ subroutine materialpoint_postResults IpLooping: do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) thePos = 0_pInt - theSize = homogState (mappingHomogenization(2,i,e))%sizePostResults & - + thermalState (mappingHomogenization(2,i,e))%sizePostResults & - + damageState (mappingHomogenization(2,i,e))%sizePostResults + theSize = homogState (material_homogenizationAt(e))%sizePostResults & + + thermalState (material_homogenizationAt(e))%sizePostResults & + + damageState (material_homogenizationAt(e))%sizePostResults materialpoint_results(thePos+1,i,e) = real(theSize,pReal) ! tell size of homogenization results thePos = thePos + 1_pInt @@ -902,9 +903,9 @@ function postResults(ip,el) integer(pInt), intent(in) :: & ip, & !< integration point el !< element number - real(pReal), dimension( homogState (mappingHomogenization(2,ip,el))%sizePostResults & - + thermalState (mappingHomogenization(2,ip,el))%sizePostResults & - + damageState (mappingHomogenization(2,ip,el))%sizePostResults) :: & + real(pReal), dimension( homogState (material_homogenizationAt(el))%sizePostResults & + + thermalState (material_homogenizationAt(el))%sizePostResults & + + damageState (material_homogenizationAt(el))%sizePostResults) :: & postResults integer(pInt) :: & startPos, endPos ,& @@ -913,7 +914,7 @@ function postResults(ip,el) postResults = 0.0_pReal startPos = 1_pInt - endPos = homogState(mappingHomogenization(2,ip,el))%sizePostResults + endPos = homogState(material_homogenizationAt(el))%sizePostResults chosenHomogenization: select case (homogenization_type(mesh_element(3,el))) case (HOMOGENIZATION_RGC_ID) chosenHomogenization @@ -924,22 +925,22 @@ function postResults(ip,el) end select chosenHomogenization startPos = endPos + 1_pInt - endPos = endPos + thermalState(mappingHomogenization(2,ip,el))%sizePostResults + endPos = endPos + thermalState(material_homogenizationAt(el))%sizePostResults chosenThermal: select case (thermal_type(mesh_element(3,el))) case (THERMAL_adiabatic_ID) chosenThermal - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) postResults(startPos:endPos) = & thermal_adiabatic_postResults(homog,thermal_typeInstance(homog),thermalMapping(homog)%p(ip,el)) case (THERMAL_conduction_ID) chosenThermal - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) postResults(startPos:endPos) = & thermal_conduction_postResults(homog,thermal_typeInstance(homog),thermalMapping(homog)%p(ip,el)) end select chosenThermal startPos = endPos + 1_pInt - endPos = endPos + damageState(mappingHomogenization(2,ip,el))%sizePostResults + endPos = endPos + damageState(material_homogenizationAt(el))%sizePostResults chosenDamage: select case (damage_type(mesh_element(3,el))) case (DAMAGE_local_ID) chosenDamage diff --git a/src/material.f90 b/src/material.f90 index 9b2bf0f80..d35cfebd4 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -391,6 +391,8 @@ subroutine material_init() ! END DEPRECATED allocate(material_homogenizationAt,source=theMesh%homogenizationAt) + allocate(material_AggregateAt, source=theMesh%homogenizationAt) + allocate(CounterPhase (size(config_phase)), source=0_pInt) allocate(CounterHomogenization(size(config_homogenization)),source=0_pInt) @@ -399,7 +401,7 @@ subroutine material_init() myHomog = theMesh%homogenizationAt(e) do i = 1_pInt, theMesh%elem%nIPs CounterHomogenization(myHomog) = CounterHomogenization(myHomog) + 1_pInt - mappingHomogenization(1:2,i,e) = [CounterHomogenization(myHomog),myHomog] + mappingHomogenization(1:2,i,e) = [CounterHomogenization(myHomog),huge(1)] do g = 1_pInt,homogenization_Ngrains(myHomog) myPhase = material_phase(g,i,e) CounterPhase(myPhase) = CounterPhase(myPhase)+1_pInt ! not distinguishing between instances of same phase diff --git a/src/spectral_thermal.f90 b/src/spectral_thermal.f90 index 62b03d11f..3e2a4b1f9 100644 --- a/src/spectral_thermal.f90 +++ b/src/spectral_thermal.f90 @@ -61,7 +61,7 @@ subroutine spectral_thermal_init thermal_conduction_getMassDensity, & thermal_conduction_getSpecificHeat use material, only: & - mappingHomogenization, & + material_homogenizationAt, & temperature, & thermalMapping use numerics, only: & @@ -118,8 +118,8 @@ subroutine spectral_thermal_init cell = 0 do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1) cell = cell + 1 - temperature_current(i,j,k) = temperature(mappingHomogenization(2,1,cell))% & - p(thermalMapping(mappingHomogenization(2,1,cell))%p(1,cell)) + temperature_current(i,j,k) = temperature(material_homogenizationAt(cell))% & + p(thermalMapping(material_homogenizationAt(cell))%p(1,cell)) temperature_lastInc(i,j,k) = temperature_current(i,j,k) temperature_stagInc(i,j,k) = temperature_current(i,j,k) enddo; enddo; enddo diff --git a/src/thermal_adiabatic.f90 b/src/thermal_adiabatic.f90 index 003398a90..ce6656188 100644 --- a/src/thermal_adiabatic.f90 +++ b/src/thermal_adiabatic.f90 @@ -166,6 +166,7 @@ end function thermal_adiabatic_updateState subroutine thermal_adiabatic_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el) use material, only: & homogenization_Ngrains, & + material_homogenizationAt, & mappingHomogenization, & phaseAt, & phasememberAt, & @@ -200,7 +201,7 @@ subroutine thermal_adiabatic_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el) source, & constituent - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) instance = thermal_typeInstance(homog) Tdot = 0.0_pReal diff --git a/src/thermal_conduction.f90 b/src/thermal_conduction.f90 index 2611d33b1..20e8bb6a6 100644 --- a/src/thermal_conduction.f90 +++ b/src/thermal_conduction.f90 @@ -119,6 +119,7 @@ end subroutine thermal_conduction_init !-------------------------------------------------------------------------------------------------- subroutine thermal_conduction_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el) use material, only: & + material_homogenizationAt, & homogenization_Ngrains, & mappingHomogenization, & phaseAt, & @@ -155,7 +156,7 @@ subroutine thermal_conduction_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el) source, & constituent - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) offset = mappingHomogenization(1,ip,el) instance = thermal_typeInstance(homog) @@ -302,7 +303,7 @@ end function thermal_conduction_getMassDensity !-------------------------------------------------------------------------------------------------- subroutine thermal_conduction_putTemperatureAndItsRate(T,Tdot,ip,el) use material, only: & - mappingHomogenization, & + material_homogenizationAt, & temperature, & temperatureRate, & thermalMapping @@ -318,7 +319,7 @@ subroutine thermal_conduction_putTemperatureAndItsRate(T,Tdot,ip,el) homog, & offset - homog = mappingHomogenization(2,ip,el) + homog = material_homogenizationAt(el) offset = thermalMapping(homog)%p(ip,el) temperature (homog)%p(offset) = T temperatureRate(homog)%p(offset) = Tdot