Merge branch 'Marc-start-material-at-0' into 'development'

0-based indexing in MSC.Marc

See merge request damask/DAMASK!410
This commit is contained in:
Franz Roters 2021-07-15 07:54:17 +00:00
commit 11fa1160e8
3 changed files with 31 additions and 37 deletions

@ -1 +1 @@
Subproject commit 1ca9a0e9f2b333d3244b1ab44480380b3b22bebe Subproject commit 8fec909d1931b092b223b0560dd30c3339c6e5a7

View File

@ -14,7 +14,7 @@ $no list
large stra 2 1 0 0 0 0 0 large stra 2 1 0 0 0 0 0
all points all points
no echo 1 2 3 4 no echo 1 2 3 4
state vars 3 state vars 2
end end
$................... $...................
solver solver
@ -269,7 +269,7 @@ coordinates
163 3.999999999999999+1 9.999999999999996+0-5.000000000000000-1 163 3.999999999999999+1 9.999999999999996+0-5.000000000000000-1
164 3.999999999999999+1 9.999999999999996+0 0.000000000000000+0 164 3.999999999999999+1 9.999999999999996+0 0.000000000000000+0
165 3.999999999999999+1 9.999999999999996+0 5.000000000000000-1 165 3.999999999999999+1 9.999999999999996+0 5.000000000000000-1
define element set Material_Nummer_elements define element set DAMASK_elements
1 to 80 1 to 80
define node set unten_y_nodes define node set unten_y_nodes
2 5 8 11 14 2 5 8 11 14
@ -283,8 +283,6 @@ define node set unten_z_nodes
7 to 9 7 to 9
define node set oben_z_nodes define node set oben_z_nodes
157 to 159 157 to 159
define element set texture_elements
1 to 80
hypoelastic hypoelastic
1 0 1 0 1TKS 0 1 0 1 0 1TKS 0
@ -346,22 +344,14 @@ unten_fest_nodes
oben_ziehen_nodes oben_ziehen_nodes
initial state initial state
2 6 1 0 0 0Material_Nummer 2 6 1 0 0 0DAMASK
1.000000000000000+0 0.000000000000000+0
0 0
1 1
Material_Nummer_elements DAMASK_elements
initial state
3 6 1 0 0 0texture
1.000000000000000+0
0
1
texture_elements
loadcase r-value loadcase r-value
5 5
Material_Nummer DAMASK
texture
unten_z unten_z
unten_y unten_y
unten_fest unten_fest

View File

@ -5,7 +5,7 @@
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Sets up the mesh for the solver MSC.Marc !> @brief Sets up the mesh for the solver MSC.Marc
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module discretization_marc module discretization_Marc
use IO use IO
use prec use prec
use math use math
@ -72,15 +72,12 @@ subroutine discretization_Marc_init
class(tNode), pointer :: & class(tNode), pointer :: &
num_commercialFEM num_commercialFEM
print'(/,a)', ' <<<+- discretization_marc init -+>>>'; flush(6)
!--------------------------------------------------------------------------------- print'(/,a)', ' <<<+- discretization_Marc init -+>>>'; flush(6)
! read debug parameters
debug_e = config_debug%get_asInt('element',defaultVal=1) debug_e = config_debug%get_asInt('element',defaultVal=1)
debug_i = config_debug%get_asInt('integrationpoint',defaultVal=1) debug_i = config_debug%get_asInt('integrationpoint',defaultVal=1)
!--------------------------------------------------------------------------------
! read numerics parameter and do sanity check
num_commercialFEM => config_numerics%get('commercialFEM',defaultVal = emptyDict) num_commercialFEM => config_numerics%get('commercialFEM',defaultVal = emptyDict)
mesh_unitlength = num_commercialFEM%get_asFloat('unitlength',defaultVal=1.0_pReal) ! set physical extent of a length unit in mesh mesh_unitlength = num_commercialFEM%get_asFloat('unitlength',defaultVal=1.0_pReal) ! set physical extent of a length unit in mesh
if (mesh_unitlength <= 0.0_pReal) call IO_error(301,ext_msg='unitlength') if (mesh_unitlength <= 0.0_pReal) call IO_error(301,ext_msg='unitlength')
@ -318,6 +315,7 @@ subroutine inputRead_matNumber(matNumber, &
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i, j, data_blocks, l integer :: i, j, data_blocks, l
do l = 1, size(fileContent) do l = 1, size(fileContent)
chunkPos = IO_stringPos(fileContent(l)) chunkPos = IO_stringPos(fileContent(l))
if(chunkPos(1) < 1) cycle if(chunkPos(1) < 1) cycle
@ -382,6 +380,7 @@ subroutine inputRead_NelemSets(nElemSets,maxNelemInSet,&
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i,l,elemInCurrentSet integer :: i,l,elemInCurrentSet
nElemSets = 0 nElemSets = 0
maxNelemInSet = 0 maxNelemInSet = 0
@ -465,6 +464,7 @@ subroutine inputRead_mapElems(FEM2DAMASK, &
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i,j,l,nNodesAlreadyRead integer :: i,j,l,nNodesAlreadyRead
do l = 1, size(fileContent) do l = 1, size(fileContent)
chunkPos = IO_stringPos(fileContent(l)) chunkPos = IO_stringPos(fileContent(l))
if(chunkPos(1) < 1) cycle if(chunkPos(1) < 1) cycle
@ -508,6 +508,7 @@ subroutine inputRead_mapNodes(FEM2DAMASK, &
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i, l integer :: i, l
do l = 1, size(fileContent) do l = 1, size(fileContent)
chunkPos = IO_stringPos(fileContent(l)) chunkPos = IO_stringPos(fileContent(l))
if(chunkPos(1) < 1) cycle if(chunkPos(1) < 1) cycle
@ -542,6 +543,7 @@ subroutine inputRead_elemNodes(nodes, &
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i,j,m,l integer :: i,j,m,l
allocate(nodes(3,nNode)) allocate(nodes(3,nNode))
do l = 1, size(fileContent) do l = 1, size(fileContent)
@ -551,9 +553,7 @@ subroutine inputRead_elemNodes(nodes, &
chunkPos = [4,1,10,11,30,31,50,51,70] chunkPos = [4,1,10,11,30,31,50,51,70]
do i=1,nNode do i=1,nNode
m = discretization_Marc_FEM2DAMASK_node(IO_intValue(fileContent(l+1+i),chunkPos,1)) m = discretization_Marc_FEM2DAMASK_node(IO_intValue(fileContent(l+1+i),chunkPos,1))
do j = 1,3 nodes(1:3,m) = [(mesh_unitlength * IO_floatValue(fileContent(l+1+i),chunkPos,j+1),j=1,3)]
nodes(j,m) = mesh_unitlength * IO_floatValue(fileContent(l+1+i),chunkPos,j+1)
enddo
enddo enddo
exit exit
endif endif
@ -575,6 +575,7 @@ subroutine inputRead_elemType(elem, &
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i,j,t,l,remainingChunks integer :: i,j,t,l,remainingChunks
t = -1 t = -1
do l = 1, size(fileContent) do l = 1, size(fileContent)
chunkPos = IO_stringPos(fileContent(l)) chunkPos = IO_stringPos(fileContent(l))
@ -664,6 +665,7 @@ function inputRead_connectivityElem(nElem,nNodes,fileContent)
integer, dimension(1+nElem) :: contInts integer, dimension(1+nElem) :: contInts
integer :: i,k,j,t,e,l,nNodesAlreadyRead integer :: i,k,j,t,e,l,nNodesAlreadyRead
do l = 1, size(fileContent) do l = 1, size(fileContent)
chunkPos = IO_stringPos(fileContent(l)) chunkPos = IO_stringPos(fileContent(l))
if(chunkPos(1) < 1) cycle if(chunkPos(1) < 1) cycle
@ -698,6 +700,7 @@ end function inputRead_connectivityElem
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Store material ID !> @brief Store material ID
!> @details 0-based ID in file is converted to 1-based ID used in DAMASK
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine inputRead_material(materialAt,& subroutine inputRead_material(materialAt,&
nElem,nNodes,nameElemSet,mapElemSet,initialcondTableStyle,fileContent) nElem,nNodes,nameElemSet,mapElemSet,initialcondTableStyle,fileContent)
@ -715,10 +718,10 @@ subroutine inputRead_material(materialAt,&
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer, dimension(1+nElem) :: contInts integer, dimension(1+nElem) :: contInts
integer :: i,j,t,sv,myVal,e,nNodesAlreadyRead,l,k,m integer :: i,j,t,sv,ID,e,nNodesAlreadyRead,l,k,m
allocate(materialAt(nElem),source=0) allocate(materialAt(nElem))
do l = 1, size(fileContent) do l = 1, size(fileContent)
chunkPos = IO_stringPos(fileContent(l)) chunkPos = IO_stringPos(fileContent(l))
@ -727,17 +730,17 @@ subroutine inputRead_material(materialAt,&
IO_lc(IO_stringValue(fileContent(l),chunkPos,2)) == 'state') then IO_lc(IO_stringValue(fileContent(l),chunkPos,2)) == 'state') then
k = merge(2,1,initialcondTableStyle == 2) k = merge(2,1,initialcondTableStyle == 2)
chunkPos = IO_stringPos(fileContent(l+k)) chunkPos = IO_stringPos(fileContent(l+k))
sv = IO_IntValue(fileContent(l+k),chunkPos,1) ! figure state variable index sv = IO_IntValue(fileContent(l+k),chunkPos,1) ! # of state variable
if( (sv == 2)) then ! state var 2 is used to identify material from material.yaml if (sv == 2) then ! state var 2 gives material ID
m = 1 m = 1
chunkPos = IO_stringPos(fileContent(l+k+m)) chunkPos = IO_stringPos(fileContent(l+k+m))
do while (scan(IO_stringValue(fileContent(l+k+m),chunkPos,1),'+-',back=.true.)>1) ! is noEfloat value? do while (scan(IO_stringValue(fileContent(l+k+m),chunkPos,1),'+-',back=.true.)>1) ! is noEfloat value?
myVal = nint(IO_floatValue(fileContent(l+k+m),chunkPos,1)) ID = nint(IO_floatValue(fileContent(l+k+m),chunkPos,1))
if (initialcondTableStyle == 2) m = m + 2 if (initialcondTableStyle == 2) m = m + 2
contInts = continuousIntValues(fileContent(l+k+m+1:),nElem,nameElemSet,mapElemSet,size(nameElemSet)) ! get affected elements contInts = continuousIntValues(fileContent(l+k+m+1:),nElem,nameElemSet,mapElemSet,size(nameElemSet)) ! get affected elements
do i = 1,contInts(1) do i = 1,contInts(1)
e = discretization_Marc_FEM2DAMASK_elem(contInts(1+i)) e = discretization_Marc_FEM2DAMASK_elem(contInts(1+i))
materialAt(e) = myVal materialAt(e) = ID + 1
enddo enddo
if (initialcondTableStyle == 0) m = m + 1 if (initialcondTableStyle == 0) m = m + 1
enddo enddo
@ -861,7 +864,7 @@ pure subroutine buildCells(connectivity,definition, &
do while (n+j<= size(candidates_local)*Nelem) do while (n+j<= size(candidates_local)*Nelem)
if (any(candidates_global(1:2*nParentNodes,n+j)/=candidates_global(1:2*nParentNodes,n))) exit if (any(candidates_global(1:2*nParentNodes,n+j)/=candidates_global(1:2*nParentNodes,n))) exit
where (connectivity(:,:,candidates_global(nParentNodes*2+1,n+j)) == -candidates_global(nParentNodes*2+2,n+j)) ! still locally defined where (connectivity(:,:,candidates_global(nParentNodes*2+1,n+j)) == -candidates_global(nParentNodes*2+2,n+j)) ! still locally defined
connectivity(:,:,candidates_global(nParentNodes*2+1,n+j)) = nCellNode + 1 ! gets current new cell node id connectivity(:,:,candidates_global(nParentNodes*2+1,n+j)) = nCellNode + 1 ! get current new cell node id
end where end where
j = j+1 j = j+1
@ -1195,6 +1198,7 @@ logical function containsRange(str,chunkPos)
character(len=*), intent(in) :: str character(len=*), intent(in) :: str
integer, dimension(:), intent(in) :: chunkPos !< positions of start and end of each tag/chunk in given string integer, dimension(:), intent(in) :: chunkPos !< positions of start and end of each tag/chunk in given string
containsRange = .False. containsRange = .False.
if(chunkPos(1) == 3) then if(chunkPos(1) == 3) then
if(IO_lc(IO_stringValue(str,chunkPos,2)) == 'to') containsRange = .True. if(IO_lc(IO_stringValue(str,chunkPos,2)) == 'to') containsRange = .True.
@ -1203,4 +1207,4 @@ logical function containsRange(str,chunkPos)
end function containsRange end function containsRange
end module discretization_marc end module discretization_Marc