polishing

This commit is contained in:
Martin Diehl 2019-10-14 09:37:31 +02:00
parent 513b1906f6
commit fae4546cfd
1 changed files with 28 additions and 21 deletions

View File

@ -149,7 +149,7 @@ subroutine mesh_init(ip,el)
allocate(cellNodeDefinition(theMesh%elem%nNodes-1)) allocate(cellNodeDefinition(theMesh%elem%nNodes-1))
allocate(connectivity_cell(theMesh%elem%NcellNodesPerCell,theMesh%elem%nIPs,theMesh%nElems)) allocate(connectivity_cell(theMesh%elem%NcellNodesPerCell,theMesh%elem%nIPs,theMesh%nElems))
call buildCells(connectivity_cell,cellNodeDefinition,& call buildCells(connectivity_cell,cellNodeDefinition,&
mesh_Nnodes,theMesh%elem,connectivity_elem) theMesh%elem,connectivity_elem)
allocate(node0_cell(3,maxval(connectivity_cell))) allocate(node0_cell(3,maxval(connectivity_cell)))
call buildCellNodes(node0_cell,& call buildCellNodes(node0_cell,&
cellNodeDefinition,node0_elem) cellNodeDefinition,node0_elem)
@ -683,16 +683,17 @@ subroutine mesh_marc_buildElements2(microstructureAt,homogenizationAt, &
!--------------------------------------------------------------------------------------------------
!> @brief Calculates cell node coordinates from element node coordinates
!--------------------------------------------------------------------------------------------------
subroutine buildCells(connectivity_cell,cellNodeDefinition, & subroutine buildCells(connectivity_cell,cellNodeDefinition, &
nNodes,elem,connectivity_elem) elem,connectivity_elem)
type(tCellNodeDefinition), dimension(:), intent(out) :: cellNodeDefinition type(tCellNodeDefinition), dimension(:), intent(out) :: cellNodeDefinition ! definition of cell nodes for increasing number of parents
integer,dimension(:,:,:),intent(out):: connectivity_cell integer, dimension(:,:,:),intent(out) :: connectivity_cell
integer, intent(in) :: nNodes type(tElement), intent(in) :: elem ! element definition
type(tElement), intent(in) :: elem integer, dimension(:,:), intent(in) :: connectivity_elem ! connectivity of the elements
integer,dimension(:,:), intent(in) :: connectivity_elem
integer,dimension(:), allocatable :: candidates_local integer,dimension(:), allocatable :: candidates_local
integer,dimension(:,:), allocatable :: parentsAndWeights,candidates_global integer,dimension(:,:), allocatable :: parentsAndWeights,candidates_global
@ -718,7 +719,7 @@ subroutine buildCells(connectivity_cell,cellNodeDefinition, &
enddo enddo
enddo enddo
nCellNode = nNodes nCellNode = maxval(connectivity_elem)
!--------------------------------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
! set connectivity of cell nodes that are defined by 2,...,nNodes real nodes ! set connectivity of cell nodes that are defined by 2,...,nNodes real nodes
@ -839,17 +840,20 @@ subroutine buildCells(connectivity_cell,cellNodeDefinition, &
end subroutine buildCells end subroutine buildCells
subroutine buildCellNodes(node_cell,& !--------------------------------------------------------------------------------------------------
!> @brief Calculates cell node coordinates from element node coordinates
!--------------------------------------------------------------------------------------------------
subroutine buildCellNodes(node_cell, &
definition,node_elem) definition,node_elem)
real(pReal), dimension(:,:), intent(out) :: node_cell real(pReal), dimension(:,:), intent(out) :: node_cell !< cell node coordinates
type(tCellNodeDefinition), dimension(:), intent(in) :: definition type(tCellNodeDefinition), dimension(:), intent(in) :: definition !< cell node definition (weights and parents)
real(pReal), dimension(:,:), intent(in) :: node_elem real(pReal), dimension(:,:), intent(in) :: node_elem !< element nodes
integer :: i, j, k, n integer :: i, j, k, n
n = size(node_elem,2) n = size(node_elem,2)
node_cell(:,1:n) = node_elem node_cell(:,1:n) = node_elem !< initial nodes coincide with element nodes
do i = 1, size(cellNodeDefinition,1) do i = 1, size(cellNodeDefinition,1)
do j = 1, size(cellNodeDefinition(i)%parents,1) do j = 1, size(cellNodeDefinition(i)%parents,1)
@ -866,20 +870,23 @@ subroutine buildCellNodes(node_cell,&
end subroutine buildCellNodes end subroutine buildCellNodes
subroutine buildIPcoordinates(IPcoordinates,& !--------------------------------------------------------------------------------------------------
!> @brief Calculates IP coordinates as center of cell
!--------------------------------------------------------------------------------------------------
subroutine buildIPcoordinates(IPcoordinates, &
connectivity_cell,node_cell) connectivity_cell,node_cell)
real(pReal), dimension(:,:), intent(out) :: IPcoordinates real(pReal), dimension(:,:), intent(out):: IPcoordinates !< cell-center/IP coordinates
integer,dimension(:,:), intent(in) :: connectivity_cell !< cell connectivity for each element,ip/cell integer, dimension(:,:), intent(in) :: connectivity_cell !< connectivity for each cell
real(pReal), dimension(:,:), intent(in) :: node_cell real(pReal), dimension(:,:), intent(in) :: node_cell !< cell node coordinates
integer :: i, j integer :: i, n
do i = 1, size(connectivity_cell,2) do i = 1, size(connectivity_cell,2)
IPcoordinates(:,i) = 0.0_pReal IPcoordinates(:,i) = 0.0_pReal
do j = 1, size(connectivity_cell,1) do n = 1, size(connectivity_cell,1)
IPcoordinates(:,i) = IPcoordinates(:,i) & IPcoordinates(:,i) = IPcoordinates(:,i) &
+ node_cell(:,connectivity_cell(j,i)) + node_cell(:,connectivity_cell(n,i))
enddo enddo
IPcoordinates(:,i) = IPcoordinates(:,i)/real(size(connectivity_cell,1),pReal) IPcoordinates(:,i) = IPcoordinates(:,i)/real(size(connectivity_cell,1),pReal)
enddo enddo