fixed bug in initialization when reading in material.config.
Fortran does not short-circuit, e.g. (if a>0 .and. b(a) ==c) might cause an out-of-bounds error when a=-1 it'll try to access b(-1)!
This commit is contained in:
parent
6f7740a243
commit
296a5040b9
|
@ -156,7 +156,7 @@ integer(pInt), intent(in) :: file
|
||||||
integer(pInt), parameter :: maxNchunks = 21_pInt
|
integer(pInt), parameter :: maxNchunks = 21_pInt
|
||||||
integer(pInt), dimension(1+2*maxNchunks) :: positions
|
integer(pInt), dimension(1+2*maxNchunks) :: positions
|
||||||
integer(pInt), dimension(6) :: configNchunks
|
integer(pInt), dimension(6) :: configNchunks
|
||||||
integer(pInt) :: section, maxNinstance,mySize=0_pInt,myStructure,maxTotalNslip,maxTotalNtwin,&
|
integer(pInt) :: section = 0_pInt, maxNinstance,mySize=0_pInt,myStructure,maxTotalNslip,maxTotalNtwin,&
|
||||||
f,i,j,k,l,m,n,o,p,q,r,s,ns,nt, &
|
f,i,j,k,l,m,n,o,p,q,r,s,ns,nt, &
|
||||||
Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, &
|
Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, &
|
||||||
Nchunks_SlipFamilies, Nchunks_TwinFamilies, &
|
Nchunks_SlipFamilies, Nchunks_TwinFamilies, &
|
||||||
|
@ -289,8 +289,6 @@ allocate(constitutive_dislotwin_sbSv(6,6,homogenization_maxNgrains,mesh_maxNips,
|
||||||
|
|
||||||
!* Readout data from material.config file
|
!* Readout data from material.config file
|
||||||
rewind(file)
|
rewind(file)
|
||||||
line = ''
|
|
||||||
section = 0_pInt
|
|
||||||
|
|
||||||
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
||||||
read(file,'(a1024)',END=100) line
|
read(file,'(a1024)',END=100) line
|
||||||
|
@ -304,7 +302,8 @@ do ! read thru sections of
|
||||||
section = section + 1_pInt ! advance section counter
|
section = section + 1_pInt ! advance section counter
|
||||||
cycle
|
cycle
|
||||||
endif
|
endif
|
||||||
if (section > 0_pInt .and. phase_plasticity(section) == constitutive_dislotwin_label) then ! one of my sections
|
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
||||||
|
if (phase_plasticity(section) == constitutive_dislotwin_LABEL) then ! one of my sections
|
||||||
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
||||||
positions = IO_stringPos(line,maxNchunks)
|
positions = IO_stringPos(line,maxNchunks)
|
||||||
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
||||||
|
@ -447,6 +446,7 @@ do ! read thru sections of
|
||||||
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_dislotwin_label//')')
|
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_dislotwin_label//')')
|
||||||
end select
|
end select
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
100 do i = 1_pInt,maxNinstance
|
100 do i = 1_pInt,maxNinstance
|
||||||
|
|
|
@ -204,7 +204,8 @@ subroutine constitutive_j2_init(myFile)
|
||||||
section = section + 1_pInt ! advance section counter
|
section = section + 1_pInt ! advance section counter
|
||||||
cycle
|
cycle
|
||||||
endif
|
endif
|
||||||
if (section > 0_pInt .and. phase_plasticity(section) == constitutive_j2_label) then ! one of my sections
|
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
||||||
|
if (phase_plasticity(section) == constitutive_j2_LABEL) then ! one of my sections
|
||||||
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
||||||
positions = IO_stringPos(line,maxNchunks)
|
positions = IO_stringPos(line,maxNchunks)
|
||||||
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
||||||
|
@ -264,6 +265,7 @@ subroutine constitutive_j2_init(myFile)
|
||||||
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_j2_label//')')
|
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_j2_label//')')
|
||||||
end select
|
end select
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
100 do i = 1_pInt,maxNinstance ! sanity checks
|
100 do i = 1_pInt,maxNinstance ! sanity checks
|
||||||
|
|
|
@ -130,7 +130,8 @@ subroutine constitutive_none_init(myFile)
|
||||||
section = section + 1_pInt ! advance section counter
|
section = section + 1_pInt ! advance section counter
|
||||||
cycle
|
cycle
|
||||||
endif
|
endif
|
||||||
if (section > 0_pInt .and. phase_plasticity(section) == constitutive_none_label) then ! one of my sections
|
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
||||||
|
if ( phase_plasticity(section) == constitutive_none_LABEL) then ! one of my sections
|
||||||
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
||||||
positions = IO_stringPos(line,MAXNCHUNKS)
|
positions = IO_stringPos(line,MAXNCHUNKS)
|
||||||
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
||||||
|
@ -161,6 +162,7 @@ subroutine constitutive_none_init(myFile)
|
||||||
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_none_label//')')
|
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_none_label//')')
|
||||||
end select
|
end select
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
100 do i = 1_pInt,maxNinstance
|
100 do i = 1_pInt,maxNinstance
|
||||||
|
|
|
@ -258,7 +258,7 @@ integer(pInt), parameter :: maxNchunks = 21_pInt
|
||||||
integer(pInt), &
|
integer(pInt), &
|
||||||
dimension(1_pInt+2_pInt*maxNchunks) :: positions
|
dimension(1_pInt+2_pInt*maxNchunks) :: positions
|
||||||
integer(pInt), dimension(6) :: configNchunks
|
integer(pInt), dimension(6) :: configNchunks
|
||||||
integer(pInt) :: section, &
|
integer(pInt) :: section = 0_pInt, &
|
||||||
maxNinstance, &
|
maxNinstance, &
|
||||||
maxTotalNslip, &
|
maxTotalNslip, &
|
||||||
myStructure, &
|
myStructure, &
|
||||||
|
@ -420,9 +420,6 @@ nonSchmidCoeff = 0.0_pReal
|
||||||
!*** readout data from material.config file
|
!*** readout data from material.config file
|
||||||
|
|
||||||
rewind(myFile)
|
rewind(myFile)
|
||||||
line = ''
|
|
||||||
section = 0_pInt
|
|
||||||
|
|
||||||
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
||||||
read(myFile,'(a1024)',END=100) line
|
read(myFile,'(a1024)',END=100) line
|
||||||
enddo
|
enddo
|
||||||
|
@ -435,7 +432,8 @@ do
|
||||||
section = section + 1_pInt ! advance section counter
|
section = section + 1_pInt ! advance section counter
|
||||||
cycle
|
cycle
|
||||||
endif
|
endif
|
||||||
if (section > 0_pInt .and. phase_plasticity(section) == CONSTITUTIVE_NONLOCAL_LABEL) then ! one of my sections
|
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
||||||
|
if (phase_plasticity(section) == CONSTITUTIVE_NONLOCAL_LABEL) then ! one of my sections
|
||||||
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
||||||
positions = IO_stringPos(line,maxNchunks)
|
positions = IO_stringPos(line,maxNchunks)
|
||||||
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
||||||
|
@ -590,6 +588,7 @@ do
|
||||||
call IO_error(210_pInt,ext_msg=tag//' ('//CONSTITUTIVE_NONLOCAL_LABEL//')')
|
call IO_error(210_pInt,ext_msg=tag//' ('//CONSTITUTIVE_NONLOCAL_LABEL//')')
|
||||||
end select
|
end select
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ subroutine constitutive_phenopowerlaw_init(myFile)
|
||||||
integer(pInt), parameter :: MAXNCHUNKS = lattice_maxNinteraction + 1_pInt
|
integer(pInt), parameter :: MAXNCHUNKS = lattice_maxNinteraction + 1_pInt
|
||||||
integer(pInt), dimension(1+2*MAXNCHUNKS) :: positions
|
integer(pInt), dimension(1+2*MAXNCHUNKS) :: positions
|
||||||
integer(pInt), dimension(6) :: configNchunks
|
integer(pInt), dimension(6) :: configNchunks
|
||||||
integer(pInt) :: section, maxNinstance, i,j,k, f,o, &
|
integer(pInt) :: section = 0_pInt, maxNinstance, i,j,k, f,o, &
|
||||||
Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, &
|
Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, &
|
||||||
Nchunks_SlipFamilies, Nchunks_TwinFamilies, &
|
Nchunks_SlipFamilies, Nchunks_TwinFamilies, &
|
||||||
mySize=0_pInt, myStructure, index_myFamily, index_otherFamily
|
mySize=0_pInt, myStructure, index_myFamily, index_otherFamily
|
||||||
|
@ -239,7 +239,6 @@ subroutine constitutive_phenopowerlaw_init(myFile)
|
||||||
constitutive_phenopowerlaw_nonSchmidCoeff = 0.0_pReal
|
constitutive_phenopowerlaw_nonSchmidCoeff = 0.0_pReal
|
||||||
|
|
||||||
rewind(myFile)
|
rewind(myFile)
|
||||||
section = 0_pInt
|
|
||||||
|
|
||||||
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
||||||
read(myFile,'(a1024)',END=100) line
|
read(myFile,'(a1024)',END=100) line
|
||||||
|
@ -253,7 +252,8 @@ subroutine constitutive_phenopowerlaw_init(myFile)
|
||||||
section = section + 1_pInt ! advance section counter
|
section = section + 1_pInt ! advance section counter
|
||||||
cycle ! skip to next line
|
cycle ! skip to next line
|
||||||
endif
|
endif
|
||||||
if (section > 0_pInt .and. phase_plasticity(section) == constitutive_phenopowerlaw_label) then ! one of my sections
|
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
||||||
|
if (phase_plasticity(section) == constitutive_phenopowerlaw_LABEL) then ! one of my sections
|
||||||
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
||||||
positions = IO_stringPos(line,MAXNCHUNKS)
|
positions = IO_stringPos(line,MAXNCHUNKS)
|
||||||
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
||||||
|
@ -372,6 +372,7 @@ subroutine constitutive_phenopowerlaw_init(myFile)
|
||||||
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_phenopowerlaw_label//')')
|
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_phenopowerlaw_label//')')
|
||||||
end select
|
end select
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
100 do i = 1_pInt,maxNinstance
|
100 do i = 1_pInt,maxNinstance
|
||||||
|
|
|
@ -247,7 +247,7 @@ integer(pInt), intent(in) :: file
|
||||||
integer(pInt), parameter :: maxNchunks = 21_pInt
|
integer(pInt), parameter :: maxNchunks = 21_pInt
|
||||||
integer(pInt), dimension(1_pInt+2_pInt*maxNchunks) :: positions
|
integer(pInt), dimension(1_pInt+2_pInt*maxNchunks) :: positions
|
||||||
integer(pInt), dimension(6) :: configNchunks
|
integer(pInt), dimension(6) :: configNchunks
|
||||||
integer(pInt) :: section,f,i,j,k,l,m,n,o,p,q,r,s,s1,s2,t,t1,t2,ns,nt,&
|
integer(pInt) :: section = 0_pInt,f,i,j,k,l,m,n,o,p,q,r,s,s1,s2,t,t1,t2,ns,nt,&
|
||||||
Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, &
|
Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, &
|
||||||
Nchunks_SlipFamilies, Nchunks_TwinFamilies, &
|
Nchunks_SlipFamilies, Nchunks_TwinFamilies, &
|
||||||
mySize,myStructure,maxTotalNslip,maxTotalNtwin
|
mySize,myStructure,maxTotalNslip,maxTotalNtwin
|
||||||
|
@ -414,8 +414,6 @@ allocate(constitutive_titanmod_interactionTwinTwin(lattice_maxNinteraction,maxNi
|
||||||
|
|
||||||
!* Read data from material.config file
|
!* Read data from material.config file
|
||||||
rewind(file)
|
rewind(file)
|
||||||
line = ''
|
|
||||||
section = 0_pInt
|
|
||||||
|
|
||||||
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
do while (IO_lc(IO_getTag(line,'<','>')) /= 'phase') ! wind forward to <phase>
|
||||||
read(file,'(a1024)',END=100) line
|
read(file,'(a1024)',END=100) line
|
||||||
|
@ -429,7 +427,8 @@ enddo
|
||||||
section = section + 1_pInt ! advance section counter
|
section = section + 1_pInt ! advance section counter
|
||||||
cycle ! skip to next line
|
cycle ! skip to next line
|
||||||
endif
|
endif
|
||||||
if (section > 0_pInt .and. phase_plasticity(section) == constitutive_titanmod_label) then ! one of my sections
|
if (section > 0_pInt ) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
||||||
|
if (phase_plasticity(section) == constitutive_titanmod_LABEL) then ! one of my sections
|
||||||
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
i = phase_plasticityInstance(section) ! which instance of my plasticity is present phase
|
||||||
positions = IO_stringPos(line,maxNchunks)
|
positions = IO_stringPos(line,maxNchunks)
|
||||||
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
||||||
|
@ -626,6 +625,7 @@ enddo
|
||||||
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_titanmod_label//')')
|
call IO_error(210_pInt,ext_msg=tag//' ('//constitutive_titanmod_label//')')
|
||||||
end select
|
end select
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
100 do i = 1_pInt,maxNinstance
|
100 do i = 1_pInt,maxNinstance
|
||||||
|
|
Loading…
Reference in New Issue