better readable

This commit is contained in:
Martin Diehl 2019-10-14 10:36:59 +02:00
parent 57fef8fa57
commit 57af822396
1 changed files with 50 additions and 16 deletions

View File

@ -130,8 +130,8 @@ subroutine mesh_init(ip,el)
allocate(microstructureAt(theMesh%nElems), source=0) allocate(microstructureAt(theMesh%nElems), source=0)
allocate(homogenizationAt(theMesh%nElems), source=0) allocate(homogenizationAt(theMesh%nElems), source=0)
connectivity_elem = mesh_marc_buildElements(mesh_nElems,theMesh%elem%nNodes,FILEUNIT) connectivity_elem = inputRead_connectivityElem(mesh_nElems,theMesh%elem%nNodes,FILEUNIT)
call mesh_marc_buildElements2(microstructureAt,homogenizationAt, & call inputRead_microstructureAndHomogenization(microstructureAt,homogenizationAt, &
mesh_nElems,theMesh%elem%nNodes,mesh_nameElemSet,mesh_mapElemSet,& mesh_nElems,theMesh%elem%nNodes,mesh_nameElemSet,mesh_mapElemSet,&
initialcondTableStyle,FILEUNIT) initialcondTableStyle,FILEUNIT)
close (FILEUNIT) close (FILEUNIT)
@ -169,19 +169,53 @@ subroutine mesh_init(ip,el)
call discretization_init(microstructureAt,homogenizationAt,& call discretization_init(microstructureAt,homogenizationAt,&
ip_reshaped,& ip_reshaped,&
node0_elem) node0_elem)
call writeGeometry(0,connectivity_elem,&
reshape(connectivity_cell,[theMesh%elem%NcellNodesPerCell,theMesh%elem%nIPs*theMesh%nElems]),&
node0_cell,ip_reshaped)
end subroutine mesh_init
subroutine writeGeometry(elemType,connectivity_elem,connectivity_cell,coordinates_nodes,coordinates_points)
integer, intent(in) :: elemType
integer, dimension(:,:), intent(in) :: &
connectivity_elem, &
connectivity_cell
real(pReal), dimension(:,:), intent(in) :: &
coordinates_nodes, &
coordinates_points
integer, dimension(:,:), allocatable :: &
connectivity_temp
real(pReal), dimension(:,:), allocatable :: &
coordinates_temp
#if defined(DAMASK_HDF5) #if defined(DAMASK_HDF5)
call results_openJobFile call results_openJobFile
call HDF5_closeGroup(results_addGroup('geometry')) call HDF5_closeGroup(results_addGroup('geometry'))
call results_writeDataset('geometry',connectivity_elem,'C',&
connectivity_temp = connectivity_elem
call results_writeDataset('geometry',connectivity_temp,'T_e',&
'connectivity of the elements','-') 'connectivity of the elements','-')
call results_writeDataset('geometry',ip_reshaped,'x_c', &
'cell center coordinates','m') connectivity_temp = connectivity_cell
call results_writeDataset('geometry',node0_elem,'x_n', & call results_writeDataset('geometry',connectivity_temp,'T_c', &
'nodal coordinates','m') 'connectivity of the cells','-')
coordinates_temp = coordinates_nodes
call results_writeDataset('geometry',coordinates_temp,'x_n', &
'coordinates of the nodes','m')
coordinates_temp = coordinates_points
call results_writeDataset('geometry',coordinates_temp,'x_p', &
'coordinates of the material points','m')
call results_closeJobFile() call results_closeJobFile()
#endif #endif
end subroutine mesh_init end subroutine writeGeometry
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -565,7 +599,7 @@ end function mapElemtype
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Stores node IDs !> @brief Stores node IDs
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
function mesh_marc_buildElements(nElem,nNodes,fileUnit) function inputRead_connectivityElem(nElem,nNodes,fileUnit)
integer, intent(in) :: & integer, intent(in) :: &
nElem, & nElem, &
@ -573,7 +607,7 @@ function mesh_marc_buildElements(nElem,nNodes,fileUnit)
fileUnit fileUnit
integer, dimension(nElem,nNodes) :: & integer, dimension(nElem,nNodes) :: &
mesh_marc_buildElements inputRead_connectivityElem
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
character(len=300) line character(len=300) line
@ -594,7 +628,7 @@ function mesh_marc_buildElements(nElem,nNodes,fileUnit)
if (e /= 0) then ! disregard non CP elems if (e /= 0) then ! disregard non CP elems
nNodesAlreadyRead = 0 nNodesAlreadyRead = 0
do j = 1,chunkPos(1)-2 do j = 1,chunkPos(1)-2
mesh_marc_buildElements(j,e) = & inputRead_connectivityElem(j,e) = &
mesh_FEasCP('node',IO_IntValue(line,chunkPos,j+2)) mesh_FEasCP('node',IO_IntValue(line,chunkPos,j+2))
enddo enddo
nNodesAlreadyRead = chunkPos(1) - 2 nNodesAlreadyRead = chunkPos(1) - 2
@ -602,7 +636,7 @@ function mesh_marc_buildElements(nElem,nNodes,fileUnit)
read (fileUnit,'(A300)',END=620) line read (fileUnit,'(A300)',END=620) line
chunkPos = IO_stringPos(line) chunkPos = IO_stringPos(line)
do j = 1,chunkPos(1) do j = 1,chunkPos(1)
mesh_marc_buildElements(nNodesAlreadyRead+j,e) = & inputRead_connectivityElem(nNodesAlreadyRead+j,e) = &
mesh_FEasCP('node',IO_IntValue(line,chunkPos,j)) mesh_FEasCP('node',IO_IntValue(line,chunkPos,j))
enddo enddo
nNodesAlreadyRead = nNodesAlreadyRead + chunkPos(1) nNodesAlreadyRead = nNodesAlreadyRead + chunkPos(1)
@ -613,13 +647,13 @@ function mesh_marc_buildElements(nElem,nNodes,fileUnit)
endif endif
enddo enddo
620 end function mesh_marc_buildElements 620 end function inputRead_connectivityElem
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Stores homogenization and microstructure ID !> @brief Stores homogenization and microstructure ID
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine mesh_marc_buildElements2(microstructureAt,homogenizationAt, & subroutine inputRead_microstructureAndHomogenization(microstructureAt,homogenizationAt, &
nElem,nNodes,nameElemSet,mapElemSet,initialcondTableStyle,fileUnit) nElem,nNodes,nameElemSet,mapElemSet,initialcondTableStyle,fileUnit)
integer, dimension(:), intent(out) :: & integer, dimension(:), intent(out) :: &
@ -677,7 +711,7 @@ subroutine mesh_marc_buildElements2(microstructureAt,homogenizationAt, &
endif endif
enddo enddo
630 end subroutine mesh_marc_buildElements2 630 end subroutine inputRead_microstructureAndHomogenization