fixed small bug when calculating mesh_Ncells

This commit is contained in:
Martin Diehl 2013-04-19 12:41:06 +00:00
parent 103c770ee6
commit 4bc5e6717b
1 changed files with 306 additions and 296 deletions

View File

@ -610,6 +610,14 @@ subroutine mesh_init(ip,el)
calcMode(ip,mesh_FEasCP('elem',el)) = .true. ! first ip,el needs to be already pingponged to "calc" calcMode(ip,mesh_FEasCP('elem',el)) = .true. ! first ip,el needs to be already pingponged to "calc"
lastMode = .true. ! and its mode is already known... lastMode = .true. ! and its mode is already known...
!--------------------------------------------------------------------------------------------------
! write description file for constitutive phase output
call IO_write_jobFile(fileunit,'mesh')
write(fileunit,'(a,i)') 'maxNCellNodes ', mesh_maxNcellNodes
write(fileunit,'(a,i)') 'maxNips ', mesh_maxNips
write(fileunit,'(a,i)') 'maxNCellNodes ', mesh_maxNcpElems
close(fileunit)
end subroutine mesh_init end subroutine mesh_init
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -700,8 +708,8 @@ subroutine mesh_build_cells
g = FE_geomtype(t) ! get geometry type g = FE_geomtype(t) ! get geometry type
c = FE_celltype(g) ! get cell type c = FE_celltype(g) ! get cell type
localCellnode2globalCellnode = 0_pInt localCellnode2globalCellnode = 0_pInt
do i = 1_pInt,FE_Nips(g) ! loop over ips=cells in this element
mesh_Ncells = mesh_Ncells + FE_Nips(g) mesh_Ncells = mesh_Ncells + FE_Nips(g)
do i = 1_pInt,FE_Nips(g) ! loop over ips=cells in this element
do n = 1_pInt,FE_NcellnodesPerCell(c) ! loop over cell nodes in this cell do n = 1_pInt,FE_NcellnodesPerCell(c) ! loop over cell nodes in this cell
localCellnodeID = FE_cell(n,i,g) localCellnodeID = FE_cell(n,i,g)
if (localCellnodeID <= FE_NmatchingNodes(g)) then ! this cell node is a matching node if (localCellnodeID <= FE_NmatchingNodes(g)) then ! this cell node is a matching node
@ -3678,25 +3686,25 @@ subroutine mesh_build_ipAreas
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine mesh_build_nodeTwins subroutine mesh_build_nodeTwins
implicit none implicit none
integer(pInt) dir, & ! direction of periodicity integer(pInt) dir, & ! direction of periodicity
node, & node, &
minimumNode, & minimumNode, &
maximumNode, & maximumNode, &
n1, & n1, &
n2 n2
integer(pInt), dimension(mesh_Nnodes+1) :: minimumNodes, maximumNodes ! list of surface nodes (minimum and maximum coordinate value) with first entry giving the number of nodes integer(pInt), dimension(mesh_Nnodes+1) :: minimumNodes, maximumNodes ! list of surface nodes (minimum and maximum coordinate value) with first entry giving the number of nodes
real(pReal) minCoord, maxCoord, & ! extreme positions in one dimension real(pReal) minCoord, maxCoord, & ! extreme positions in one dimension
tolerance ! tolerance below which positions are assumed identical tolerance ! tolerance below which positions are assumed identical
real(pReal), dimension(3) :: distance ! distance between two nodes in all three coordinates real(pReal), dimension(3) :: distance ! distance between two nodes in all three coordinates
logical, dimension(mesh_Nnodes) :: unpaired logical, dimension(mesh_Nnodes) :: unpaired
allocate(mesh_nodeTwins(3,mesh_Nnodes)) allocate(mesh_nodeTwins(3,mesh_Nnodes))
mesh_nodeTwins = 0_pInt mesh_nodeTwins = 0_pInt
tolerance = 0.001_pReal * minval(mesh_ipVolume) ** 0.333_pReal tolerance = 0.001_pReal * minval(mesh_ipVolume) ** 0.333_pReal
do dir = 1_pInt,3_pInt ! check periodicity in directions of x,y,z do dir = 1_pInt,3_pInt ! check periodicity in directions of x,y,z
if (mesh_periodicSurface(dir)) then ! only if periodicity is requested if (mesh_periodicSurface(dir)) then ! only if periodicity is requested
@ -3738,7 +3746,7 @@ do dir = 1_pInt,3_pInt ! check periodicity in
enddo enddo
endif endif
enddo enddo
end subroutine mesh_build_nodeTwins end subroutine mesh_build_nodeTwins
@ -3749,22 +3757,22 @@ end subroutine mesh_build_nodeTwins
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine mesh_build_sharedElems subroutine mesh_build_sharedElems
implicit none implicit none
integer(pint) e, & ! element index integer(pint) e, & ! element index
g, & ! element type g, & ! element type
node, & ! CP node index node, & ! CP node index
n, & ! node index per element n, & ! node index per element
myDim, & ! dimension index myDim, & ! dimension index
nodeTwin ! node twin in the specified dimension nodeTwin ! node twin in the specified dimension
integer(pInt), dimension (mesh_Nnodes) :: node_count integer(pInt), dimension (mesh_Nnodes) :: node_count
integer(pInt), dimension (:), allocatable :: node_seen integer(pInt), dimension (:), allocatable :: node_seen
allocate(node_seen(maxval(FE_NmatchingNodes))) allocate(node_seen(maxval(FE_NmatchingNodes)))
node_count = 0_pInt node_count = 0_pInt
do e = 1_pInt,mesh_NcpElems do e = 1_pInt,mesh_NcpElems
g = FE_geomtype(mesh_element(2,e)) ! get elemGeomType g = FE_geomtype(mesh_element(2,e)) ! get elemGeomType
node_seen = 0_pInt ! reset node duplicates node_seen = 0_pInt ! reset node duplicates
do n = 1_pInt,FE_NmatchingNodes(g) ! check each node of element do n = 1_pInt,FE_NmatchingNodes(g) ! check each node of element
@ -3779,14 +3787,14 @@ do e = 1_pInt,mesh_NcpElems
endif endif
node_seen(n) = node ! remember this node to be counted already node_seen(n) = node ! remember this node to be counted already
enddo enddo
enddo enddo
mesh_maxNsharedElems = int(maxval(node_count),pInt) ! most shared node mesh_maxNsharedElems = int(maxval(node_count),pInt) ! most shared node
allocate(mesh_sharedElem(1+mesh_maxNsharedElems,mesh_Nnodes)) allocate(mesh_sharedElem(1+mesh_maxNsharedElems,mesh_Nnodes))
mesh_sharedElem = 0_pInt mesh_sharedElem = 0_pInt
do e = 1_pInt,mesh_NcpElems do e = 1_pInt,mesh_NcpElems
g = FE_geomtype(mesh_element(2,e)) ! get elemGeomType g = FE_geomtype(mesh_element(2,e)) ! get elemGeomType
node_seen = 0_pInt node_seen = 0_pInt
do n = 1_pInt,FE_NmatchingNodes(g) do n = 1_pInt,FE_NmatchingNodes(g)
@ -3804,9 +3812,9 @@ do e = 1_pInt,mesh_NcpElems
endif endif
node_seen(n) = node node_seen(n) = node
enddo enddo
enddo enddo
deallocate(node_seen) deallocate(node_seen)
end subroutine mesh_build_sharedElems end subroutine mesh_build_sharedElems
@ -3815,11 +3823,11 @@ end subroutine mesh_build_sharedElems
!> @brief build up of IP neighborhood, allocate globals '_ipNeighborhood' !> @brief build up of IP neighborhood, allocate globals '_ipNeighborhood'
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine mesh_build_ipNeighborhood subroutine mesh_build_ipNeighborhood
use math, only: &
math_mul3x3
use math, only: math_mul3x3 implicit none
integer(pInt) :: myElem, & ! my CP element index
implicit none
integer(pInt) myElem, & ! my CP element index
myIP, & myIP, &
myType, & ! my element type myType, & ! my element type
myFace, & myFace, &
@ -3837,16 +3845,16 @@ integer(pInt) myElem, &
neighboringIP, & neighboringIP, &
neighboringElem, & neighboringElem, &
pointingToMe pointingToMe
integer(pInt), dimension(FE_maxmaxNnodesAtIP) :: & integer(pInt), dimension(FE_maxmaxNnodesAtIP) :: &
linkedNodes = 0_pInt, & linkedNodes = 0_pInt, &
matchingNodes matchingNodes
logical checkTwins logical checkTwins
allocate(mesh_ipNeighborhood(3,mesh_maxNipNeighbors,mesh_maxNips,mesh_NcpElems)) allocate(mesh_ipNeighborhood(3,mesh_maxNipNeighbors,mesh_maxNips,mesh_NcpElems))
mesh_ipNeighborhood = 0_pInt mesh_ipNeighborhood = 0_pInt
do myElem = 1_pInt,mesh_NcpElems ! loop over cpElems do myElem = 1_pInt,mesh_NcpElems ! loop over cpElems
myType = FE_geomtype(mesh_element(2,myElem)) ! get elemGeomType myType = FE_geomtype(mesh_element(2,myElem)) ! get elemGeomType
do myIP = 1_pInt,FE_Nips(myType) ! loop over IPs of elem do myIP = 1_pInt,FE_Nips(myType) ! loop over IPs of elem
@ -3901,7 +3909,7 @@ do myElem = 1_pInt,mesh_NcpElems
!*** and try to find an ip with matching nodes !*** and try to find an ip with matching nodes
!*** also try to match with node twins !*** also try to match with node twins
checkCandidateIP: do candidateIP = 1_pInt,FE_Nips(neighboringType) checkCandidateIP: do candidateIP = 1_pInt,FE_Nips(neighboringType)
NmatchingNodes = 0_pInt NmatchingNodes = 0_pInt
matchingNodes = 0_pInt matchingNodes = 0_pInt
do a = 1_pInt,FE_maxNnodesAtIP(neighboringType) ! check each anchor node of that ip do a = 1_pInt,FE_maxNnodesAtIP(neighboringType) ! check each anchor node of that ip
@ -3955,8 +3963,8 @@ checkCandidateIP: do candidateIP = 1_pInt,FE_Nips(neighboringType)
endif ! end of internal/external matching endif ! end of internal/external matching
enddo enddo
enddo enddo
enddo enddo
do myElem = 1_pInt,mesh_NcpElems ! loop over cpElems do myElem = 1_pInt,mesh_NcpElems ! loop over cpElems
myType = FE_geomtype(mesh_element(2,myElem)) ! get elemGeomType myType = FE_geomtype(mesh_element(2,myElem)) ! get elemGeomType
do myIP = 1_pInt,FE_Nips(myType) ! loop over IPs of elem do myIP = 1_pInt,FE_Nips(myType) ! loop over IPs of elem
do neighbor = 1_pInt,FE_NipNeighbors(FE_celltype(myType)) ! loop over neighbors of IP do neighbor = 1_pInt,FE_NipNeighbors(FE_celltype(myType)) ! loop over neighbors of IP
@ -3977,7 +3985,7 @@ do myElem = 1_pInt,mesh_NcpElems
endif endif
enddo enddo
enddo enddo
enddo enddo
end subroutine mesh_build_ipNeighborhood end subroutine mesh_build_ipNeighborhood
@ -3986,14 +3994,16 @@ end subroutine mesh_build_ipNeighborhood
!> @brief write statistics regarding input file parsing to the output file !> @brief write statistics regarding input file parsing to the output file
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine mesh_tell_statistics subroutine mesh_tell_statistics
use math, only: &
use math, only: math_range math_range
use IO, only: IO_error use IO, only: &
use debug, only: debug_level, & IO_error
debug_mesh, & use debug, only: &
debug_levelBasic, & debug_level, &
debug_levelExtensive, & debug_MESH, &
debug_levelSelective, & debug_LEVELBASIC, &
debug_LEVELEXTENSIVE, &
debug_LEVELSELECTIVE, &
debug_e, & debug_e, &
debug_i debug_i