fixed a potential memory leak for hexagonal structures. added some status output to constitutive_xx
This commit is contained in:
parent
5adcb5e36c
commit
974116808b
|
@ -1056,6 +1056,10 @@ endfunction
|
|||
msg = 'Convergence not reached'
|
||||
case (610)
|
||||
msg = 'Stress loop not converged'
|
||||
|
||||
case (666)
|
||||
msg = 'Memory leak detected'
|
||||
|
||||
case (700)
|
||||
msg = 'Singular matrix in stress iteration'
|
||||
case default
|
||||
|
|
|
@ -55,7 +55,7 @@ subroutine constitutive_init()
|
|||
integer(pInt), parameter :: fileunit = 200
|
||||
integer(pInt) e,i,g,p,myInstance,myNgrains
|
||||
integer(pInt), dimension(:,:), pointer :: thisSize
|
||||
character(64), dimension(:,:), pointer :: thisOutput
|
||||
character(len=64), dimension(:,:), pointer :: thisOutput
|
||||
logical knownConstitution
|
||||
|
||||
if(.not. IO_open_file(fileunit,material_configFile)) call IO_error (100) ! corrupt config file
|
||||
|
@ -65,6 +65,7 @@ subroutine constitutive_init()
|
|||
call constitutive_dislotwin_init(fileunit)
|
||||
call constitutive_nonlocal_init(fileunit)
|
||||
|
||||
|
||||
close(fileunit)
|
||||
|
||||
! write description file for constitutive phase output
|
||||
|
|
|
@ -83,6 +83,9 @@ subroutine constitutive_j2_init(file)
|
|||
maxNinstance = count(phase_constitution == constitutive_j2_label)
|
||||
if (maxNinstance == 0) return
|
||||
|
||||
write(6,'(a16,x,i5)') '# instances:',maxNinstance
|
||||
write(6,*)
|
||||
|
||||
allocate(constitutive_j2_sizeDotState(maxNinstance)) ; constitutive_j2_sizeDotState = 0_pInt
|
||||
allocate(constitutive_j2_sizeState(maxNinstance)) ; constitutive_j2_sizeState = 0_pInt
|
||||
allocate(constitutive_j2_sizePostResults(maxNinstance)); constitutive_j2_sizePostResults = 0_pInt
|
||||
|
|
|
@ -146,10 +146,12 @@ subroutine constitutive_phenopowerlaw_init(file)
|
|||
write(6,*) '$Id$'
|
||||
write(6,*)
|
||||
|
||||
|
||||
maxNinstance = count(phase_constitution == constitutive_phenopowerlaw_label)
|
||||
if (maxNinstance == 0) return
|
||||
|
||||
write(6,'(a16,x,i5)') '# instances:',maxNinstance
|
||||
write(6,*)
|
||||
|
||||
allocate(constitutive_phenopowerlaw_sizeDotState(maxNinstance)) ; constitutive_phenopowerlaw_sizeDotState = 0_pInt
|
||||
allocate(constitutive_phenopowerlaw_sizeState(maxNinstance)) ; constitutive_phenopowerlaw_sizeState = 0_pInt
|
||||
allocate(constitutive_phenopowerlaw_sizePostResults(maxNinstance)); constitutive_phenopowerlaw_sizePostResults = 0_pInt
|
||||
|
@ -217,6 +219,7 @@ subroutine constitutive_phenopowerlaw_init(file)
|
|||
rewind(file)
|
||||
line = ''
|
||||
section = 0
|
||||
|
||||
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
||||
read(file,'(a1024)',END=100) line
|
||||
enddo
|
||||
|
@ -308,6 +311,7 @@ subroutine constitutive_phenopowerlaw_init(file)
|
|||
enddo
|
||||
|
||||
100 do i = 1,maxNinstance
|
||||
|
||||
constitutive_phenopowerlaw_structure(i) = lattice_initializeStructure(constitutive_phenopowerlaw_structureName(i), & ! get structure
|
||||
constitutive_phenopowerlaw_CoverA(i))
|
||||
constitutive_phenopowerlaw_Nslip(:,i) = min(lattice_NslipSystem(:,constitutive_phenopowerlaw_structure(i)),& ! limit active slip systems per family to max
|
||||
|
@ -353,6 +357,7 @@ subroutine constitutive_phenopowerlaw_init(file)
|
|||
constitutive_phenopowerlaw_hardeningMatrix_twinslip = 0.0_pReal
|
||||
constitutive_phenopowerlaw_hardeningMatrix_twintwin = 0.0_pReal
|
||||
|
||||
|
||||
do i = 1,maxNinstance
|
||||
do j = 1,maxval(phase_Noutput)
|
||||
select case(constitutive_phenopowerlaw_output(j,i))
|
||||
|
|
|
@ -666,10 +666,14 @@ subroutine lattice_init()
|
|||
|
||||
if(.not. IO_open_file(fileunit,material_configFile)) call IO_error (100) ! corrupt config file
|
||||
Nsections = IO_countSections(fileunit,material_partPhase)
|
||||
! lattice_Nstructure = 2_pInt + sum(IO_countTagInPart(fileunit,material_partPhase,'covera_ratio',Nsections)) ! fcc + bcc + all hex
|
||||
lattice_Nstructure = Nsections ! most conservative assumption
|
||||
lattice_Nstructure = 2_pInt + sum(IO_countTagInPart(fileunit,material_partPhase,'covera_ratio',Nsections)) ! fcc + bcc + all hex
|
||||
! lattice_Nstructure = Nsections + 2_pInt ! most conservative assumption
|
||||
close(fileunit)
|
||||
|
||||
write(6,'(a16,x,i5)') '# sections:',Nsections
|
||||
write(6,'(a16,x,i5)') '# structures:',lattice_Nstructure
|
||||
write(6,*)
|
||||
|
||||
allocate(lattice_Sslip(3,3,lattice_maxNslip,lattice_Nstructure)); lattice_Sslip = 0.0_pReal
|
||||
allocate(lattice_Sslip_v(6,lattice_maxNslip,lattice_Nstructure)); lattice_Sslip_v = 0.0_pReal
|
||||
allocate(lattice_sd(3,lattice_maxNslip,lattice_Nstructure)); lattice_sd = 0.0_pReal
|
||||
|
@ -703,6 +707,7 @@ function lattice_initializeStructure(struct,CoverA)
|
|||
!**************************************
|
||||
use prec, only: pReal,pInt
|
||||
use math
|
||||
use IO, only: IO_error
|
||||
implicit none
|
||||
|
||||
character(len=*) struct
|
||||
|
@ -821,6 +826,8 @@ function lattice_initializeStructure(struct,CoverA)
|
|||
end select
|
||||
|
||||
if (processMe) then
|
||||
if (myStructure > lattice_Nstructure) &
|
||||
call IO_error(666,0,0,0,'structure index too large') ! check for memory leakage
|
||||
do i = 1,myNslip ! store slip system vectors and Schmid matrix for my structure
|
||||
lattice_sd(:,i,myStructure) = sd(:,i)
|
||||
lattice_st(:,i,myStructure) = st(:,i)
|
||||
|
|
Loading…
Reference in New Issue