From 1839228add4d00a3d5aa7c39a73f5afe6d09469a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 14 Oct 2018 12:27:42 +0200 Subject: [PATCH] sorting new mappings. Needs more work (don't forget https://xkcd.com/927) --- src/material.f90 | 82 ++++++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index c4ed54ddb..1dc5b7a7a 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -169,18 +169,13 @@ module material homogenization_maxNgrains !< max number of grains in any USED homogenization integer(pInt), dimension(:), allocatable, public, protected :: & - material_homogenizationAt, & !< homogenization ID of each element (copy of mesh_homogenizationAt) phase_Nsources, & !< number of source mechanisms active in each phase phase_Nkinematics, & !< number of kinematic mechanisms active in each phase phase_NstiffnessDegradations, & !< number of stiffness degradation mechanisms active in each phase phase_Noutput, & !< number of '(output)' items per phase phase_elasticityInstance, & !< instance of particular elasticity of each phase - phase_plasticityInstance !< instance of particular plasticity of each phase - - integer(pInt), dimension(:), allocatable, public, protected :: & - crystallite_Noutput !< number of '(output)' items per crystallite setting - - integer(pInt), dimension(:), allocatable, public, protected :: & + phase_plasticityInstance, & !< instance of particular plasticity of each phase + crystallite_Noutput, & !< number of '(output)' items per crystallite setting homogenization_Ngrains, & !< number of grains in each homogenization homogenization_Noutput, & !< number of '(output)' items per homogenization homogenization_typeInstance, & !< instance of particular type of each homogenization @@ -189,7 +184,7 @@ module material 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 + microstructure_crystallite !< crystallite setting ID of each microstructure ! DEPRECATED !!!! real(pReal), dimension(:), allocatable, public, protected :: & thermal_initialT, & !< initial temperature per each homogenization @@ -198,12 +193,27 @@ module material porosity_initialPhi, & !< initial posority per each homogenization hydrogenflux_initialCh !< initial hydrogen concentration per each homogenization +! NEW MAPPINGS + integer(pInt), dimension(:), allocatable, public, protected :: & + material_homogenizationAt, & !< homogenization ID of each element (copy of mesh_homogenizationAt) + material_homogenizationMemberAt, & !< position of the element within its homogenization instance + material_aggregateAt, & !< aggregate ID of each element FUTURE USE FOR OUTPUT + material_aggregatMemberAt !< position of the element within its aggregate instance FUTURE USE FOR OUTPUT + integer(pInt), dimension(:,:), allocatable, public, protected :: & + material_phaseAt, & !< phase ID of each element + material_phaseMemberAt, & !< position of the element within its phase instance + material_crystalliteAt, & !< crystallite ID of each element CURRENTLY NOT PER CONSTITUTENT + material_crystalliteMemberAt !< position of the element within its crystallite instance CURRENTLY NOT PER CONSTITUTENT +! END NEW MAPPINGS + +! DEPRECATED: use material_phaseAt integer(pInt), dimension(:,:,:), allocatable, public :: & material_phase !< phase (index) of each grain,IP,element -! BEGIN DEPRECATED: use material_homogenizationAt +! DEPRECATED: use material_homogenizationAt integer(pInt), dimension(:,:), allocatable, public :: & material_homog !< homogenization (index) of each IP,element ! END DEPRECATED + type(tPlasticState), allocatable, dimension(:), public :: & plasticState type(tSourceState), allocatable, dimension(:), public :: & @@ -254,11 +264,13 @@ module material logical, dimension(:), allocatable, private :: & homogenization_active +! BEGIN DEPRECATED integer(pInt), dimension(:,:,:), allocatable, public :: phaseAt !< phase ID of every material point (ipc,ip,el) integer(pInt), dimension(:,:,:), allocatable, public :: phasememberAt !< memberID of given phase at every material point (ipc,ip,el) - integer(pInt), dimension(:,:,:), allocatable, public, target :: mappingCrystallite + integer(pInt), dimension(:,:,:), allocatable, public, target :: mappingHomogenization !< mapping from material points to offset in heterogenous state/field - integer(pInt), dimension(:,:), allocatable, public, target :: mappingHomogenizationConst !< mapping from material points to offset in constant state/field + integer(pInt), dimension(:,:), allocatable, private, target :: mappingHomogenizationConst !< mapping from material points to offset in constant state/field +! END DEPRECATED type(tHomogMapping), allocatable, dimension(:), public :: & thermalMapping, & !< mapping for thermal state/fields @@ -372,11 +384,11 @@ subroutine material_init() integer(pInt) :: & g, & !< grain number i, & !< integration point number - e, & !< element number - phase - integer(pInt), dimension(:), allocatable :: ConstitutivePosition - integer(pInt), dimension(:), allocatable :: CrystallitePosition - integer(pInt), dimension(:), allocatable :: HomogenizationPosition + e !< element number + integer(pInt), dimension(:), allocatable :: & + PhaseCounter, & + CrystalliteCounter, & + HomogenizationCounter myDebug = debug_level(debug_material) @@ -467,30 +479,33 @@ subroutine material_init() call material_populateGrains +! BEGIN DEPRECATED allocate(phaseAt ( homogenization_maxNgrains,mesh_nIPsPerElem,mesh_NcpElems),source=0_pInt) allocate(phasememberAt ( homogenization_maxNgrains,mesh_nIPsPerElem,mesh_NcpElems),source=0_pInt) allocate(mappingHomogenization (2, mesh_nIPsPerElem,mesh_NcpElems),source=0_pInt) - allocate(mappingCrystallite (2,homogenization_maxNgrains, mesh_NcpElems),source=0_pInt) allocate(mappingHomogenizationConst( mesh_nIPsPerElem,mesh_NcpElems),source=1_pInt) +! END DEPRECATED - allocate(ConstitutivePosition (size(config_phase)), source=0_pInt) - allocate(HomogenizationPosition(size(config_homogenization)),source=0_pInt) - allocate(CrystallitePosition (size(config_phase)), source=0_pInt) + allocate(PhaseCounter (size(config_phase)), source=0_pInt) + allocate(HomogenizationCounter(size(config_homogenization)),source=0_pInt) - ElemLoop:do e = 1_pInt,mesh_NcpElems +! BEGIN DEPRECATED + do e = 1_pInt,mesh_NcpElems myHomog = mesh_homogenizationAt(e) - IPloop:do i = 1_pInt, mesh_NipsPerElem - HomogenizationPosition(myHomog) = HomogenizationPosition(myHomog) + 1_pInt - mappingHomogenization(1:2,i,e) = [HomogenizationPosition(myHomog),myHomog] - GrainLoop:do g = 1_pInt,homogenization_Ngrains(myHomog) - phase = material_phase(g,i,e) - ConstitutivePosition(phase) = ConstitutivePosition(phase)+1_pInt ! not distinguishing between instances of same phase - phaseAt(g,i,e) = phase - phasememberAt(g,i,e) = ConstitutivePosition(phase) - enddo GrainLoop - enddo IPloop - enddo ElemLoop + do i = 1_pInt, mesh_NipsPerElem + HomogenizationCounter(myHomog) = HomogenizationCounter(myHomog) + 1_pInt + mappingHomogenization(1:2,i,e) = [HomogenizationCounter(myHomog),myHomog] + do g = 1_pInt,homogenization_Ngrains(myHomog) + myPhase = material_phase(g,i,e) + PhaseCounter(myPhase) = PhaseCounter(myPhase)+1_pInt ! not distinguishing between instances of same phase + phaseAt(g,i,e) = myPhase + phasememberAt(g,i,e) = PhaseCounter(myPhase) + enddo + enddo + enddo +! END DEPRECATED +! REMOVE !!!!! ! hack needed to initialize field values used during constitutive and crystallite initializations do myHomog = 1,size(config_homogenization) thermalMapping (myHomog)%p => mappingHomogenizationConst @@ -507,7 +522,7 @@ subroutine material_init() allocate(vacancyConcRate (myHomog)%p(1), source=0.0_pReal) allocate(hydrogenConcRate(myHomog)%p(1), source=0.0_pReal) enddo - + end subroutine material_init @@ -1122,7 +1137,6 @@ subroutine material_populateGrains allocate(material_volume(homogenization_maxNgrains,mesh_nIPsPerElem,mesh_NcpElems), source=0.0_pReal) allocate(material_phase(homogenization_maxNgrains,mesh_nIPsPerElem,mesh_NcpElems), source=0_pInt) allocate(material_homog(mesh_nIPsPerElem,mesh_NcpElems), source=0_pInt) - allocate(material_homogenizationAt,source=mesh_homogenizationAt) allocate(material_texture(homogenization_maxNgrains,mesh_nIPsPerElem,mesh_NcpElems), source=0_pInt) allocate(material_EulerAngles(3,homogenization_maxNgrains,mesh_nIPsPerElem,mesh_NcpElems),source=0.0_pReal)