From 2aba6faf4086a4c9b9c7558149ef8d135ed25d3a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 3 Feb 2019 12:28:04 +0100 Subject: [PATCH] cleaning and making dependencies clear --- src/mesh_abaqus.f90 | 21 ++++++++++----------- src/mesh_marc.f90 | 21 ++++++++++----------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/mesh_abaqus.f90 b/src/mesh_abaqus.f90 index 05a4a71af..89f0eed06 100644 --- a/src/mesh_abaqus.f90 +++ b/src/mesh_abaqus.f90 @@ -490,7 +490,7 @@ subroutine mesh_init(ip,el) if (myDebug) write(6,'(a)') ' Counted CP sizes'; flush(6) call mesh_abaqus_build_elements(FILEUNIT) if (myDebug) write(6,'(a)') ' Built elements'; flush(6) - call mesh_get_damaskOptions(FILEUNIT) + call mesh_get_damaskOptions(mesh_periodic_surface,FILEUNIT) if (myDebug) write(6,'(a)') ' Got DAMASK options'; flush(6) close (FILEUNIT) @@ -1269,7 +1269,7 @@ end subroutine mesh_abaqus_build_elements !-------------------------------------------------------------------------------------------------- !> @brief get any additional damask options from input file, sets mesh_periodicSurface !-------------------------------------------------------------------------------------------------- -subroutine mesh_get_damaskOptions(fileUnit) +subroutine mesh_get_damaskOptions(periodic_surface,fileUnit) use IO, only: & IO_lc, & @@ -1282,24 +1282,23 @@ use IO, only: & integer(pInt), allocatable, dimension(:) :: chunkPos character(len=300) :: line integer :: myStat - logical :: inPart - integer(pInt) chunk, Nchunks - character(len=300) :: damaskOption, v - character(len=*), parameter :: keyword = '**damask' + integer(pInt) :: chunk, Nchunks + character(len=300) :: v + logical, dimension(3) :: periodic_surface + - mesh_periodicSurface = .false. + periodic_surface = .false. myStat = 0 rewind(fileUnit) do while(myStat == 0) read (fileUnit,'(a300)',iostat=myStat) line chunkPos = IO_stringPos(line) Nchunks = chunkPos(1) - if (IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == keyword .and. Nchunks > 1_pInt) then ! found keyword for damask option and there is at least one more chunk to read - damaskOption = IO_lc(IO_stringValue(line,chunkPos,2_pInt)) - select case(damaskOption) + if (IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == '**damask' .and. Nchunks > 1_pInt) then ! found keyword for damask option and there is at least one more chunk to read + select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt))) case('periodic') ! damask Option that allows to specify periodic fluxes do chunk = 3_pInt,Nchunks ! loop through chunks (skipping the keyword) - v = IO_lc(IO_stringValue(line,chunkPos,chunk)) ! chunk matches keyvalues x,y, or z? + v = IO_lc(IO_stringValue(line,chunkPos,chunk)) ! chunk matches keyvalues x,y, or z? mesh_periodicSurface(1) = mesh_periodicSurface(1) .or. v == 'x' mesh_periodicSurface(2) = mesh_periodicSurface(2) .or. v == 'y' mesh_periodicSurface(3) = mesh_periodicSurface(3) .or. v == 'z' diff --git a/src/mesh_marc.f90 b/src/mesh_marc.f90 index 0421a9452..506f6a107 100644 --- a/src/mesh_marc.f90 +++ b/src/mesh_marc.f90 @@ -484,8 +484,7 @@ subroutine mesh_init(ip,el) allocate(mesh_nameElemSet(mesh_NelemSets)); mesh_nameElemSet = 'n/a' allocate(mesh_mapElemSet(1_pInt+mesh_maxNelemInSet,mesh_NelemSets),source=0_pInt) - call mesh_marc_map_elementSets(mesh_nameElemSet,mesh_mapElemSet,& - mesh_NelemSets,mesh_maxNelemInSet,FILEUNIT) + call mesh_marc_map_elementSets(mesh_nameElemSet,mesh_mapElemSet,FILEUNIT) if (myDebug) write(6,'(a)') ' Mapped element sets'; flush(6) mesh_NcpElems = mesh_marc_count_cpElements(hypoelasticTableStyle,Marc_matNumber,fileFormatVersion,FILEUNIT) @@ -500,6 +499,7 @@ subroutine mesh_init(ip,el) if (myDebug) write(6,'(a)') ' Mapped nodes'; flush(6) call mesh_marc_build_nodes(FILEUNIT) !ToDo: don't work on global variables + mesh_node = mesh_node0 if (myDebug) write(6,'(a)') ' Built nodes'; flush(6) elemType = mesh_marc_count_cpSizes(FILEUNIT) @@ -626,7 +626,7 @@ subroutine mesh_marc_get_tableStyles(initialcond, hypoelastic,fileUnit) !-------------------------------------------------------------------------------------------------- -!> @brief Figures out material number of hypoelastic material and stores it in Marc_matNumber array +!> @brief Figures out material number of hypoelastic material !-------------------------------------------------------------------------------------------------- function mesh_marc_get_matNumber(fileUnit,tableStyle) use IO, only: & @@ -751,7 +751,7 @@ subroutine mesh_marc_count_nodesAndElements(nNodes, nElems, fileUnit) !> @brief map element sets !! allocate globals: mesh_nameElemSet, mesh_mapElemSet !-------------------------------------------------------------------------------------------------- -subroutine mesh_marc_map_elementSets(nameElemSet,mapElemSet,NelemSets,maxNelemInSet,fileUnit) +subroutine mesh_marc_map_elementSets(nameElemSet,mapElemSet,fileUnit) use IO, only: IO_lc, & IO_stringValue, & @@ -759,10 +759,10 @@ subroutine mesh_marc_map_elementSets(nameElemSet,mapElemSet,NelemSets,maxNelemIn IO_continuousIntValues implicit none - integer(pInt), intent(in) :: fileUnit,NelemSets,maxNelemInSet - character(len=64), dimension(mesh_NelemSets), intent(out) :: & + integer(pInt), intent(in) :: fileUnit,NelemSets + character(len=64), dimension(:), intent(out) :: & nameElemSet - integer(pInt), dimension(1_pInt+maxNelemInSet,NelemSets), intent(out) :: & + integer(pInt), dimension(:,:), intent(out) :: & mapElemSet integer(pInt), allocatable, dimension(:) :: chunkPos @@ -779,7 +779,7 @@ subroutine mesh_marc_map_elementSets(nameElemSet,mapElemSet,NelemSets,maxNelemIn (IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'element' ) ) then elemSet = elemSet+1_pInt nameElemSet(elemSet) = trim(IO_stringValue(line,chunkPos,4_pInt)) - mapElemSet(:,elemSet) = IO_continuousIntValues(fileUnit,maxNelemInSet,nameElemSet,mapElemSet,NelemSets) + mapElemSet(:,elemSet) = IO_continuousIntValues(fileUnit,size(mapElemSet,1)-1,nameElemSet,mapElemSet,size(nameElemSet)) endif enddo @@ -860,8 +860,9 @@ subroutine mesh_marc_map_elements(fileUnit) tmp integer(pInt), dimension (1_pInt+mesh_NcpElems) :: contInts - integer(pInt) :: i,cpElem = 0_pInt + integer(pInt) :: i,cpElem + cpElem = 0_pInt contInts = 0_pInt rewind(fileUnit) do @@ -971,8 +972,6 @@ subroutine mesh_marc_build_nodes(fileUnit) integer(pInt) :: i,j,m allocate ( mesh_node0 (3,mesh_Nnodes), source=0.0_pReal) - allocate ( mesh_node (3,mesh_Nnodes), source=0.0_pReal) - rewind(fileUnit) do