feature/meshText #57
2 changed files with 40 additions and 0 deletions
Read initial
Now we can read an initial condition as we do with other formats. Only documentation left.
commit
1b1a574edc
|
|
@ -182,12 +182,50 @@ module moduleMeshInputText
|
|||
end subroutine readText
|
||||
|
||||
subroutine readInitialText(filename, density, velocity, temperature)
|
||||
use moduleErrors
|
||||
implicit none
|
||||
|
||||
character(:), allocatable, intent(in):: filename
|
||||
real(8), allocatable, intent(out), dimension(:):: density
|
||||
real(8), allocatable, intent(out), dimension(:,:):: velocity
|
||||
real(8), allocatable, intent(out), dimension(:):: temperature
|
||||
integer:: fileID, reason
|
||||
character(len=256):: line
|
||||
integer:: nNodes
|
||||
integer:: n
|
||||
|
||||
fileID = 10
|
||||
|
||||
open(fileID, file=trim(filename))
|
||||
|
||||
do
|
||||
read(fileID, *, iostat=reason) line
|
||||
|
||||
if (reason > 0) then
|
||||
call criticalError('Error reading mesh file', 'readText')
|
||||
|
||||
else if (reason < 0) then
|
||||
exit
|
||||
|
||||
else if (len(line) > 0) then
|
||||
nNodes = nNodes + 1
|
||||
|
||||
end if
|
||||
|
||||
end do
|
||||
|
||||
allocate(density(1:nNodes))
|
||||
allocate(velocity(1:nNodes, 1:3))
|
||||
allocate(temperature(1:nNodes))
|
||||
|
||||
rewind(fileID)
|
||||
|
||||
do n = 1, nNodes
|
||||
read(fileID, *) density(n), velocity(n, 1:3), temperature(n)
|
||||
|
||||
end do
|
||||
|
||||
close(fileID)
|
||||
|
||||
end subroutine readInitialText
|
||||
|
||||
|
|
|
|||
|
|
@ -548,6 +548,8 @@ MODULE moduleMeshInputVTU
|
|||
CALL readDataBlock(fileID, numNodes, temperature)
|
||||
REWIND(fileID)
|
||||
|
||||
close(fileID)
|
||||
|
||||
END SUBROUTINE readInitialVTU
|
||||
|
||||
END MODULE moduleMeshInputVTU
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue