From f655a6fe5cadd6f012726339786b698e6981deb1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 11 Apr 2021 13:55:30 +0200 Subject: [PATCH] store data locally --- src/lattice.f90 | 43 ++++++------------------------------------- src/phase_damage.f90 | 12 +++++++----- src/phase_thermal.f90 | 13 +++++++++---- 3 files changed, 22 insertions(+), 46 deletions(-) diff --git a/src/lattice.f90 b/src/lattice.f90 index 69ee65857..06986b42b 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -398,9 +398,7 @@ module lattice lattice_rho, & lattice_c_p real(pReal), dimension(:,:,:), allocatable, public, protected :: & - lattice_C66, & - lattice_K_T, & - lattice_K_phi + lattice_C66 integer(kind(lattice_UNDEFINED_ID)), dimension(:), allocatable, public, protected :: & lattice_structure ! SHOULD NOT BE PART OF LATTICE END @@ -458,23 +456,19 @@ subroutine lattice_init phases, & phase, & mech, & - elasticity, & - thermal, & - damage + elasticity print'(/,a)', ' <<<+- lattice init -+>>>'; flush(IO_STDOUT) +! SHOULD NOT BE PART OF LATTICE BEGIN + phases => config_material%get('phase') Nphases = phases%length allocate(lattice_structure(Nphases),source = lattice_UNDEFINED_ID) allocate(lattice_C66(6,6,Nphases), source=0.0_pReal) - allocate(lattice_K_T (3,3,Nphases), source=0.0_pReal) - allocate(lattice_K_phi (3,3,Nphases), source=0.0_pReal) - - allocate(lattice_mu_phi,& - lattice_rho,lattice_c_p, & + allocate(lattice_rho, & lattice_mu, lattice_nu,& source=[(0.0_pReal,i=1,Nphases)]) @@ -522,32 +516,7 @@ subroutine lattice_init enddo lattice_rho(ph) = phase%get_asFloat('rho', defaultVal=0.0_pReal) - - ! SHOULD NOT BE PART OF LATTICE BEGIN - - if (phase%contains('thermal')) then - thermal => phase%get('thermal') - lattice_K_T(1,1,ph) = thermal%get_asFloat('K_11',defaultVal=0.0_pReal) - lattice_K_T(2,2,ph) = thermal%get_asFloat('K_22',defaultVal=0.0_pReal) - lattice_K_T(3,3,ph) = thermal%get_asFloat('K_33',defaultVal=0.0_pReal) - lattice_K_T(1:3,1:3,ph) = lattice_applyLatticeSymmetry33(lattice_K_T(1:3,1:3,ph), & - phase%get_asString('lattice')) - lattice_c_p(ph) = thermal%get_asFloat('c_p', defaultVal=0.0_pReal) - endif - - - if (phase%contains('damage')) then - damage => phase%get('damage') - damage => damage%get(1) - lattice_K_phi(1,1,ph) = damage%get_asFloat('D_11',defaultVal=0.0_pReal) - lattice_K_phi(2,2,ph) = damage%get_asFloat('D_22',defaultVal=0.0_pReal) - lattice_K_phi(3,3,ph) = damage%get_asFloat('D_33',defaultVal=0.0_pReal) - lattice_K_phi(1:3,1:3,ph) = lattice_applyLatticeSymmetry33(lattice_K_phi(1:3,1:3,ph), & - phase%get_asString('lattice')) - - lattice_mu_phi(ph) = damage%get_asFloat('M',defaultVal=0.0_pReal) - endif - ! SHOULD NOT BE PART OF LATTICE END +! SHOULD NOT BE PART OF LATTICE END call selfTest diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 9a20030d2..8df2cd5e4 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -131,9 +131,11 @@ module subroutine damage_init if (sources%length == 1) then damage_active = .true. source => sources%get(1) - param(ph)%K(1,1) = source%get_asFloat('K_11',defaultVal=0.0_pReal) - param(ph)%K(2,2) = source%get_asFloat('K_22',defaultVal=0.0_pReal) - param(ph)%K(3,3) = source%get_asFloat('K_33',defaultVal=0.0_pReal) + param(ph)%mu = source%get_asFloat('M',defaultVal=0.0_pReal) + param(ph)%K(1,1) = source%get_asFloat('D_11',defaultVal=0.0_pReal) + param(ph)%K(2,2) = source%get_asFloat('D_22',defaultVal=0.0_pReal) + param(ph)%K(3,3) = source%get_asFloat('D_33',defaultVal=0.0_pReal) + param(ph)%K = lattice_applyLatticeSymmetry33(param(ph)%K,phase%get_asString('lattice')) endif enddo @@ -354,7 +356,7 @@ module function phase_mu_phi(co,ce) result(mu) real(pReal) :: mu - mu = lattice_mu_phi(material_phaseID(co,ce)) + mu = param(material_phaseID(co,ce))%mu end function phase_mu_phi @@ -368,7 +370,7 @@ module function phase_K_phi(co,ce) result(K) real(pReal), dimension(3,3) :: K - K = crystallite_push33ToRef(co,ce,lattice_K_phi(1:3,1:3,material_phaseID(co,ce))) + K = crystallite_push33ToRef(co,ce,param(material_phaseID(co,ce))%K) end function phase_K_phi diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index a0e6adb60..f6d046266 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -100,12 +100,17 @@ module subroutine thermal_init(phases) allocate(current(ph)%dot_T(Nmembers),source=0.0_pReal) phase => phases%get(ph) thermal => phase%get('thermal',defaultVal=emptyDict) - sources => thermal%get('source',defaultVal=emptyList) + param(ph)%C_p = thermal%get_asFloat('c_p',defaultVal=0.0_pReal) + if (param(ph)%C_p <= 0) param(ph)%C_p = thermal%get_asFloat('C_p',defaultVal=0.0_pReal) param(ph)%K(1,1) = thermal%get_asFloat('K_11',defaultVal=0.0_pReal) param(ph)%K(2,2) = thermal%get_asFloat('K_22',defaultVal=0.0_pReal) param(ph)%K(3,3) = thermal%get_asFloat('K_33',defaultVal=0.0_pReal) + param(ph)%K = lattice_applyLatticeSymmetry33(param(ph)%K,phase%get_asString('lattice')) + + sources => thermal%get('source',defaultVal=emptyList) thermal_Nsources(ph) = sources%length allocate(thermalstate(ph)%p(thermal_Nsources(ph))) + enddo allocate(thermal_source(maxval(thermal_Nsources),phases%length), source = THERMAL_UNDEFINED_ID) @@ -193,8 +198,8 @@ module function phase_mu_T(co,ce) result(mu) real(pReal) :: mu - mu = lattice_c_p(material_phaseID(co,ce)) & - * lattice_rho(material_phaseID(co,ce)) + mu = lattice_rho(material_phaseID(co,ce)) & + * param(material_phaseID(co,ce))%C_p end function phase_mu_T @@ -208,7 +213,7 @@ module function phase_K_T(co,ce) result(K) real(pReal), dimension(3,3) :: K - K = crystallite_push33ToRef(co,ce,lattice_K_T(1:3,1:3,material_phaseID(co,ce))) + K = crystallite_push33ToRef(co,ce,param(material_phaseID(co,ce))%K) end function phase_K_T