better encapsulation
inputRead fully parses the input file and gives back the required data
This commit is contained in:
parent
0f77d2efdb
commit
3abb549eab
|
@ -59,28 +59,15 @@ subroutine mesh_init(ip,el)
|
||||||
|
|
||||||
integer, intent(in) :: el, ip
|
integer, intent(in) :: el, ip
|
||||||
|
|
||||||
integer, parameter :: FILEUNIT = 222
|
|
||||||
character(len=pStringLen), dimension(:), allocatable :: inputFile !< file content, separated per lines
|
|
||||||
|
|
||||||
real(pReal), dimension(:,:), allocatable :: &
|
real(pReal), dimension(:,:), allocatable :: &
|
||||||
node0_elem, & !< node x,y,z coordinates (initially!)
|
node0_elem, & !< node x,y,z coordinates (initially!)
|
||||||
node0_cell
|
node0_cell
|
||||||
type(tElement) :: elem
|
type(tElement) :: elem
|
||||||
|
|
||||||
integer :: j, fileFormatVersion, &
|
integer :: nElems
|
||||||
|
|
||||||
nElems, &
|
|
||||||
hypoelasticTableStyle, &
|
|
||||||
initialcondTableStyle
|
|
||||||
integer, dimension(:), allocatable :: &
|
|
||||||
marc_matNumber !< array of material numbers for hypoelastic material (Marc only)
|
|
||||||
integer, dimension(:), allocatable :: &
|
integer, dimension(:), allocatable :: &
|
||||||
microstructureAt, &
|
microstructureAt, &
|
||||||
homogenizationAt
|
homogenizationAt
|
||||||
character(len=64), dimension(:), allocatable :: &
|
|
||||||
nameElemSet
|
|
||||||
integer, dimension(:,:), allocatable :: &
|
|
||||||
mapElemSet !< list of elements in elementSet
|
|
||||||
integer:: &
|
integer:: &
|
||||||
Nnodes !< total number of nodes in mesh
|
Nnodes !< total number of nodes in mesh
|
||||||
|
|
||||||
|
@ -92,46 +79,13 @@ subroutine mesh_init(ip,el)
|
||||||
connectivity_elem
|
connectivity_elem
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- mesh init -+>>>'
|
write(6,'(/,a)') ' <<<+- mesh init -+>>>'
|
||||||
|
|
||||||
mesh_unitlength = numerics_unitlength ! set physical extent of a length unit in mesh
|
mesh_unitlength = numerics_unitlength ! set physical extent of a length unit in mesh
|
||||||
inputFile = IO_read_ASCII(trim(modelName)//trim(InputFileExtension))
|
call inputRead(elem,node0_elem,connectivity_elem,microstructureAt,homogenizationAt)
|
||||||
|
nElems = size(connectivity_elem,2)
|
||||||
|
|
||||||
! parsing Marc input file
|
allocate(mesh_ipCoordinates(3,elem%nIPs,nElems),source=0.0_pReal) ! deprecated
|
||||||
call inputRead_fileFormat(fileFormatVersion,inputFile)
|
|
||||||
call inputRead_tableStyles(initialcondTableStyle,hypoelasticTableStyle,inputFile)
|
|
||||||
if (fileFormatVersion > 12) &
|
|
||||||
call inputRead_matNumber(marc_matNumber,hypoelasticTableStyle,inputFile)
|
|
||||||
call inputRead_NnodesAndElements(nNodes, nElems, inputFile)
|
|
||||||
|
|
||||||
allocate (mesh_mapFEtoCPelem(2,nElems), source = 0)
|
|
||||||
allocate (mesh_mapFEtoCPnode(2,Nnodes), source = 0)
|
|
||||||
|
|
||||||
call IO_open_inputFile(FILEUNIT,modelName)
|
|
||||||
call inputRead_mapElemSets(nameElemSet,mapElemSet,FILEUNIT)
|
|
||||||
call inputRead_mapElems(hypoelasticTableStyle,nameElemSet,mapElemSet,&
|
|
||||||
fileFormatVersion,marc_matNumber,FILEUNIT)
|
|
||||||
|
|
||||||
call inputRead_mapNodes(inputFile)
|
|
||||||
|
|
||||||
call inputRead_elemType(elem,nElems,FILEUNIT)
|
|
||||||
|
|
||||||
call inputRead_elemNodes(node0_elem,Nnodes,inputFile)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
allocate(microstructureAt(nElems), source=0)
|
|
||||||
allocate(homogenizationAt(nElems), source=0)
|
|
||||||
|
|
||||||
connectivity_elem = inputRead_connectivityElem(nElems,elem%nNodes,FILEUNIT)
|
|
||||||
call inputRead_microstructureAndHomogenization(microstructureAt,homogenizationAt, &
|
|
||||||
nElems,elem%nNodes,nameElemSet,mapElemSet,&
|
|
||||||
initialcondTableStyle,FILEUNIT)
|
|
||||||
close (FILEUNIT)
|
|
||||||
|
|
||||||
|
|
||||||
allocate(mesh_ipCoordinates(3,elem%nIPs,nElems),source=0.0_pReal)
|
|
||||||
|
|
||||||
allocate(cellNodeDefinition(elem%nNodes-1))
|
allocate(cellNodeDefinition(elem%nNodes-1))
|
||||||
allocate(connectivity_cell(elem%NcellNodesPerCell,elem%nIPs,nElems))
|
allocate(connectivity_cell(elem%NcellNodesPerCell,elem%nIPs,nElems))
|
||||||
|
@ -144,18 +98,15 @@ subroutine mesh_init(ip,el)
|
||||||
call buildIPcoordinates(ip_reshaped,reshape(connectivity_cell,[elem%NcellNodesPerCell,&
|
call buildIPcoordinates(ip_reshaped,reshape(connectivity_cell,[elem%NcellNodesPerCell,&
|
||||||
elem%nIPs*nElems]),node0_cell)
|
elem%nIPs*nElems]),node0_cell)
|
||||||
|
|
||||||
if (debug_e < 1 .or. debug_e > nElems) &
|
if (debug_e < 1 .or. debug_e > nElems) call IO_error(602,ext_msg='element')
|
||||||
call IO_error(602,ext_msg='element') ! selected element does not exist
|
if (debug_i < 1 .or. debug_i > elem%nIPs) call IO_error(602,ext_msg='IP')
|
||||||
if (debug_i < 1 .or. debug_i > elem%nIPs) &
|
|
||||||
call IO_error(602,ext_msg='IP') ! selected element does not have requested IP
|
|
||||||
|
|
||||||
FEsolving_execElem = [ 1,nElems ] ! parallel loop bounds set to comprise all DAMASK elements
|
FEsolving_execElem = [ 1,nElems ] ! parallel loop bounds set to comprise all DAMASK elements
|
||||||
allocate(FEsolving_execIP(2,nElems), source=1) ! parallel loop bounds set to comprise from first IP...
|
allocate(FEsolving_execIP(2,nElems), source=1) ! parallel loop bounds set to comprise from first IP...
|
||||||
FEsolving_execIP(2,:) = elem%nIPs
|
FEsolving_execIP(2,:) = elem%nIPs
|
||||||
|
|
||||||
allocate(calcMode(elem%nIPs,nElems))
|
allocate(calcMode(elem%nIPs,nElems),source=.false.) ! pretend to have collected what first call is asking (F = I)
|
||||||
calcMode = .false. ! pretend to have collected what first call is asking (F = I)
|
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"
|
|
||||||
|
|
||||||
call discretization_init(microstructureAt,homogenizationAt,&
|
call discretization_init(microstructureAt,homogenizationAt,&
|
||||||
ip_reshaped,&
|
ip_reshaped,&
|
||||||
|
@ -213,7 +164,18 @@ subroutine writeGeometry(elemType, &
|
||||||
end subroutine writeGeometry
|
end subroutine writeGeometry
|
||||||
|
|
||||||
|
|
||||||
subroutine inputRead()
|
subroutine inputRead(elem,node0_elem,connectivity_elem,microstructureAt,homogenizationAt)
|
||||||
|
|
||||||
|
type(tElement), intent(out) :: elem
|
||||||
|
real(pReal), dimension(:,:), allocatable, intent(out) :: &
|
||||||
|
node0_elem !< node x,y,z coordinates (initially!)
|
||||||
|
integer, dimension(:,:), allocatable, intent(out) :: &
|
||||||
|
connectivity_elem
|
||||||
|
|
||||||
|
integer, dimension(:), allocatable, intent(out) :: &
|
||||||
|
microstructureAt, &
|
||||||
|
homogenizationAt
|
||||||
|
|
||||||
|
|
||||||
integer :: &
|
integer :: &
|
||||||
fileFormatVersion, &
|
fileFormatVersion, &
|
||||||
|
@ -242,16 +204,27 @@ subroutine inputRead()
|
||||||
call inputRead_NnodesAndElements(nNodes,nElems,&
|
call inputRead_NnodesAndElements(nNodes,nElems,&
|
||||||
inputFile)
|
inputFile)
|
||||||
|
|
||||||
call IO_open_inputFile(FILEUNIT,modelName)
|
call IO_open_inputFile(FILEUNIT,modelName) ! ToDo: It would be better to use fileContent
|
||||||
|
|
||||||
call inputRead_mapElemSets(nameElemSet,mapElemSet,&
|
call inputRead_mapElemSets(nameElemSet,mapElemSet,&
|
||||||
FILEUNIT)
|
FILEUNIT)
|
||||||
|
|
||||||
allocate (mesh_mapFEtoCPelem(2,nElems), source = 0)
|
allocate (mesh_mapFEtoCPelem(2,nElems), source = 0)
|
||||||
call inputRead_mapElems(hypoelasticTableStyle,nameElemSet,mapElemSet,fileFormatVersion,matNumber,FILEUNIT)
|
call inputRead_mapElems(hypoelasticTableStyle,nameElemSet,mapElemSet,fileFormatVersion,matNumber,FILEUNIT)
|
||||||
|
|
||||||
allocate (mesh_mapFEtoCPnode(2,Nnodes), source = 0)
|
allocate (mesh_mapFEtoCPnode(2,Nnodes), source = 0)
|
||||||
call inputRead_mapNodes(inputFile)
|
call inputRead_mapNodes(inputFile)
|
||||||
|
|
||||||
|
call inputRead_elemType(elem, &
|
||||||
|
nElems,FILEUNIT)
|
||||||
|
call inputRead_elemNodes(node0_elem, &
|
||||||
|
Nnodes,inputFile)
|
||||||
|
|
||||||
|
connectivity_elem = inputRead_connectivityElem(nElems,elem%nNodes,FILEUNIT)
|
||||||
|
|
||||||
|
call inputRead_microstructureAndHomogenization(microstructureAt,homogenizationAt, &
|
||||||
|
nElems,elem%nNodes,nameElemSet,mapElemSet,&
|
||||||
|
initialcondTableStyle,FILEUNIT)
|
||||||
close(FILEUNIT)
|
close(FILEUNIT)
|
||||||
|
|
||||||
end subroutine inputRead
|
end subroutine inputRead
|
||||||
|
@ -704,7 +677,7 @@ function inputRead_connectivityElem(nElem,nNodes,fileUnit)
|
||||||
subroutine inputRead_microstructureAndHomogenization(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(:), allocatable, intent(out) :: &
|
||||||
microstructureAt, &
|
microstructureAt, &
|
||||||
homogenizationAt
|
homogenizationAt
|
||||||
integer, intent(in) :: &
|
integer, intent(in) :: &
|
||||||
|
@ -723,6 +696,10 @@ subroutine inputRead_microstructureAndHomogenization(microstructureAt,homogeniza
|
||||||
integer, dimension(1+nElem) :: contInts
|
integer, dimension(1+nElem) :: contInts
|
||||||
integer :: i,j,t,sv,myVal,e,nNodesAlreadyRead
|
integer :: i,j,t,sv,myVal,e,nNodesAlreadyRead
|
||||||
|
|
||||||
|
|
||||||
|
allocate(microstructureAt(nElem),source=0)
|
||||||
|
allocate(homogenizationAt(nElem),source=0)
|
||||||
|
|
||||||
rewind(fileUnit)
|
rewind(fileUnit)
|
||||||
read (fileUnit,'(A300)',END=630) line
|
read (fileUnit,'(A300)',END=630) line
|
||||||
do
|
do
|
||||||
|
|
Loading…
Reference in New Issue