avoid global variables

This commit is contained in:
Martin Diehl 2020-12-23 12:25:56 +01:00
parent fef525aee1
commit b12f882ad4
2 changed files with 23 additions and 32 deletions

View File

@ -72,8 +72,6 @@ module constitutive
real(pReal), dimension(:,:,:,:,:), allocatable, public :: & real(pReal), dimension(:,:,:,:,:), allocatable, public :: &
crystallite_partitionedF !< def grad to be reached at end of homog inc crystallite_partitionedF !< def grad to be reached at end of homog inc
logical, dimension(:,:,:), allocatable, public :: &
crystallite_requested !< used by upper level (homogenization) to request crystallite calculation
logical, dimension(:,:,:), allocatable :: & logical, dimension(:,:,:), allocatable :: &
crystallite_converged !< convergence flag crystallite_converged !< convergence flag
@ -889,7 +887,6 @@ subroutine crystallite_init
allocate(crystallite_orientation(cMax,iMax,eMax)) allocate(crystallite_orientation(cMax,iMax,eMax))
allocate(crystallite_requested(cMax,iMax,eMax), source=.false.)
allocate(crystallite_converged(cMax,iMax,eMax), source=.true.) allocate(crystallite_converged(cMax,iMax,eMax), source=.true.)
num_crystallite => config_numerics%get('crystallite',defaultVal=emptyDict) num_crystallite => config_numerics%get('crystallite',defaultVal=emptyDict)
@ -974,7 +971,6 @@ subroutine crystallite_init
constitutive_mech_partionedFi0(p)%data(1:3,1:3,m) = constitutive_mech_Fi0(p)%data(1:3,1:3,m) constitutive_mech_partionedFi0(p)%data(1:3,1:3,m) = constitutive_mech_Fi0(p)%data(1:3,1:3,m)
constitutive_mech_partionedFp0(p)%data(1:3,1:3,m) = constitutive_mech_Fp0(p)%data(1:3,1:3,m) constitutive_mech_partionedFp0(p)%data(1:3,1:3,m) = constitutive_mech_Fp0(p)%data(1:3,1:3,m)
crystallite_requested(co,ip,el) = .true.
enddo; enddo enddo; enddo
enddo enddo
!$OMP END PARALLEL DO !$OMP END PARALLEL DO
@ -1033,7 +1029,6 @@ function crystallite_stress(co,ip,el)
me = material_phaseMemberAt(co,ip,el) me = material_phaseMemberAt(co,ip,el)
subLi0 = constitutive_mech_partionedLi0(ph)%data(1:3,1:3,me) subLi0 = constitutive_mech_partionedLi0(ph)%data(1:3,1:3,me)
subLp0 = crystallite_partitionedLp0(1:3,1:3,co,ip,el) subLp0 = crystallite_partitionedLp0(1:3,1:3,co,ip,el)
homogenizationRequestsCalculation: if (crystallite_requested(co,ip,el)) then
plasticState (material_phaseAt(co,el))%subState0( :,material_phaseMemberAt(co,ip,el)) = & plasticState (material_phaseAt(co,el))%subState0( :,material_phaseMemberAt(co,ip,el)) = &
plasticState (material_phaseAt(co,el))%partitionedState0(:,material_phaseMemberAt(co,ip,el)) plasticState (material_phaseAt(co,el))%partitionedState0(:,material_phaseMemberAt(co,ip,el))
@ -1048,7 +1043,6 @@ function crystallite_stress(co,ip,el)
crystallite_subStep(co,ip,el) = 1.0_pReal/num%subStepSizeCryst crystallite_subStep(co,ip,el) = 1.0_pReal/num%subStepSizeCryst
todo = .true. todo = .true.
crystallite_converged(co,ip,el) = .false. ! pretend failed step of 1/subStepSizeCryst crystallite_converged(co,ip,el) = .false. ! pretend failed step of 1/subStepSizeCryst
endif homogenizationRequestsCalculation
todo = .true. todo = .true.
NiterationCrystallite = 0 NiterationCrystallite = 0

View File

@ -289,14 +289,11 @@ subroutine materialpoint_stressAndItsTangent(dt)
*(subStep(i,e)+subFrac(i,e)), & *(subStep(i,e)+subFrac(i,e)), &
i,e) i,e)
crystallite_dt(1:myNgrains,i,e) = dt*subStep(i,e) ! propagate materialpoint dt to grains crystallite_dt(1:myNgrains,i,e) = dt*subStep(i,e) ! propagate materialpoint dt to grains
crystallite_requested(1:myNgrains,i,e) = .true. ! request calculation for constituents
else
crystallite_requested(1:myNgrains,i,e) = .false. ! calculation for constituents not required anymore
endif
converged(i,e) = .true. converged(i,e) = .true.
do co = 1, myNgrains do co = 1, myNgrains
converged(i,e) = converged(i,e) .and. crystallite_stress(co,i,e) converged(i,e) = converged(i,e) .and. crystallite_stress(co,i,e)
enddo enddo
endif
if (requested(i,e) .and. .not. doneAndHappy(1,i,e)) then if (requested(i,e) .and. .not. doneAndHappy(1,i,e)) then