Now the initial state has the same format as the mesh file, i.e., is
easy to use a file from a previous run without processing it into a plain text file. Although the previous method presented some updates for 1D small cases, this is quite easy to do with any type of simulations and, in the future, with different mesh formats.
This commit is contained in:
parent
439a45efbf
commit
e25b567d36
10 changed files with 180 additions and 94 deletions
|
|
@ -14,6 +14,7 @@ MODULE moduleMeshInputGmsh2
|
|||
TYPE IS(meshParticles)
|
||||
self%printOutput => printOutputGmsh2
|
||||
self%printEM => printEMGmsh2
|
||||
self%readInitial => readInitialGmsh2
|
||||
|
||||
END SELECT
|
||||
self%readMesh => readGmsh2
|
||||
|
|
@ -288,4 +289,76 @@ MODULE moduleMeshInputGmsh2
|
|||
|
||||
END SUBROUTINE readGmsh2
|
||||
|
||||
!Reads the initial information from an output file for an species
|
||||
SUBROUTINE readInitialGmsh2(sp, filename, density, velocity, temperature)
|
||||
USE moduleRefParam
|
||||
IMPLICIT NONE
|
||||
|
||||
INTEGER, INTENT(in):: sp
|
||||
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:: i, e
|
||||
INTEGER:: numNodes
|
||||
|
||||
OPEN(10, file = TRIM(filename))
|
||||
|
||||
!Skip first lines
|
||||
DO i = 1, 11
|
||||
READ(10, *)
|
||||
|
||||
END DO
|
||||
|
||||
!Reads number of nodes in file
|
||||
READ(10, *) numNodes
|
||||
ALLOCATE(density(1:numNodes))
|
||||
ALLOCATE(velocity(1:numNodes, 1:3))
|
||||
ALLOCATE(temperature(1:numNodes))
|
||||
|
||||
DO i = 1, numNodes
|
||||
!Reads the density
|
||||
READ(10, *), e, density(i)
|
||||
|
||||
END DO
|
||||
|
||||
DO i = 1, 10
|
||||
READ(10, *)
|
||||
|
||||
END DO
|
||||
|
||||
DO i = 1, numNodes
|
||||
!Reads the velocity
|
||||
READ(10, *), e, velocity(i, 1:3)
|
||||
|
||||
END DO
|
||||
|
||||
!Skip uneccessary lines
|
||||
DO i = 1, 10
|
||||
READ(10, *)
|
||||
|
||||
END DO
|
||||
|
||||
!Assign density to nodes
|
||||
DO i = 1, numNodes
|
||||
!Skips pressure
|
||||
READ(10, *)
|
||||
|
||||
END DO
|
||||
|
||||
!Skip uneccessary lines
|
||||
DO i = 1, 10
|
||||
READ(10, *)
|
||||
|
||||
END DO
|
||||
|
||||
!Assign density to nodes
|
||||
DO i = 1, numNodes
|
||||
!Skips pressure
|
||||
READ(10, *) e, temperature(i)
|
||||
|
||||
END DO
|
||||
|
||||
END SUBROUTINE readInitialGmsh2
|
||||
|
||||
END MODULE moduleMeshInputGmsh2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue