feature/meshText #57

Merged
JGonzalez merged 10 commits from feature/meshText into development 2026-01-23 15:27:27 +01:00
2 changed files with 40 additions and 0 deletions
Showing only changes of commit 1b1a574edc - Show all commits

Read initial

Now we can read an initial condition as we do with other formats.

Only documentation left.
Jorge Gonzalez 2026-01-23 15:04:39 +01:00

View file

@ -182,12 +182,50 @@ module moduleMeshInputText
end subroutine readText end subroutine readText
subroutine readInitialText(filename, density, velocity, temperature) subroutine readInitialText(filename, density, velocity, temperature)
use moduleErrors
implicit none implicit none
character(:), allocatable, intent(in):: filename character(:), allocatable, intent(in):: filename
real(8), allocatable, intent(out), dimension(:):: density real(8), allocatable, intent(out), dimension(:):: density
real(8), allocatable, intent(out), dimension(:,:):: velocity real(8), allocatable, intent(out), dimension(:,:):: velocity
real(8), allocatable, intent(out), dimension(:):: temperature 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 end subroutine readInitialText

View file

@ -548,6 +548,8 @@ MODULE moduleMeshInputVTU
CALL readDataBlock(fileID, numNodes, temperature) CALL readDataBlock(fileID, numNodes, temperature)
REWIND(fileID) REWIND(fileID)
close(fileID)
END SUBROUTINE readInitialVTU END SUBROUTINE readInitialVTU
END MODULE moduleMeshInputVTU END MODULE moduleMeshInputVTU