Fix an issue and starting to read information from .vtu initial files

For some reason the connectivity for collision meshes was not being
properly assigned.

Also, the first subroutine to read information from .vtu files as
initial states has been added.
It is currently giving wrong results.
This commit is contained in:
Jorge Gonzalez 2023-02-06 19:54:54 +01:00
commit 515e5c7744
2 changed files with 43 additions and 0 deletions

View file

@ -991,6 +991,11 @@ MODULE moduleInput
END SELECT
IF (doubleMesh) THEN
meshColl%connectMesh => mesh%connectMesh
END IF
!Get the format of mesh
CALL config%get(object // '.meshType', meshFormat, found)
SELECT CASE(meshFormat)

View file

@ -508,6 +508,44 @@ MODULE moduleMeshInputVTU
REAL(8), ALLOCATABLE, INTENT(out), DIMENSION(:):: density
REAL(8), ALLOCATABLE, INTENT(out), DIMENSION(:,:):: velocity
REAL(8), ALLOCATABLE, INTENT(out), DIMENSION(:):: temperature
INTEGER:: fileID
CHARACTER(:), ALLOCATABLE:: line
INTEGER:: numNodes
REAL(8), ALLOCATABLE:: velocityBlock(:)
INTEGER:: n
fileID = 10
OPEN(fileID, file = TRIM(filename))
line = findLine(fileID, '<Piece')
CALL getValueFromLine(line, 'NumberOfPoints', numNodes)
!Read the species density
line = findLine(fileID, 'Name="Density')
ALLOCATE(density(1:numNodes))
CALL readDataBlock(fileID, numNodes, density)
REWIND(fileID)
!Read the species velocity
line = findLine(fileID, 'Name="Velocity')
ALLOCATE(velocityBlock(1:3*numNodes))
CALL readDataBlock(fileID, numNodes, velocityBlock)
ALLOCATE(velocity(1:numNodes, 1:3))
DO n = 1, numNodes
velocity(n, 1) = velocityBlock(3*(n-1)+1)
velocity(n, 2) = velocityBlock(3*(n-1)+2)
velocity(n, 3) = velocityBlock(3*(n-1)+3)
END DO
DEALLOCATE(velocityBlock)
REWIND(fileID)
!Read the species temperature
line = findLine(fileID, 'Name="Temperature')
ALLOCATE(temperature(1:numNodes))
CALL readDataBlock(fileID, numNodes, temperature)
REWIND(fileID)
END SUBROUTINE readInitialVTU