First version of vtu file format
After some testing and making things a bit better and more general, I am
quite happy with the implementation of vtu and it seems that it is
working (at least as good as Gmsh2).
There are some procedures that might be useful for other XML-like
formats that might be moved in the future to the common module (I am
thinking right now in the implementation of a general format like
XDMF3).
This commit is contained in:
parent
e9ac9bdd80
commit
2c55913501
7 changed files with 51 additions and 39 deletions
Binary file not shown.
|
|
@ -448,10 +448,11 @@ make
|
|||
\end{itemize}
|
||||
\item \textbf{meshType}: Character.
|
||||
Format of mesh file.
|
||||
The output will be written in the same format as specified here.
|
||||
Accepted formats are:
|
||||
\begin{itemize}
|
||||
\item \textbf{gmsh2}: \Gls{gmsh} file format in version 2.0.
|
||||
\item \textbf{vtu}: \Gls{vtu} file format.
|
||||
\item \textbf{gmsh2}: \Gls{gmsh} file format in version 2.0. This has to be in ASCII format.
|
||||
\item \textbf{vtu}: \Gls{vtu} file format. This has to be in ASCII format.
|
||||
\end{itemize}
|
||||
\item \textbf{meshFile}: Character.
|
||||
Mesh filename.
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ OBJECTS = $(OBJDIR)/moduleMesh.o $(OBJDIR)/moduleMeshBoundary.o $(OBJDIR)/module
|
|||
$(OBJDIR)/moduleCollisions.o $(OBJDIR)/moduleTable.o $(OBJDIR)/moduleParallel.o \
|
||||
$(OBJDIR)/moduleEM.o $(OBJDIR)/moduleRandom.o $(OBJDIR)/moduleMath.o \
|
||||
$(OBJDIR)/moduleProbe.o $(OBJDIR)/moduleAverage.o \
|
||||
$(OBJDIR)/moduleMeshInoutCommon.o \
|
||||
$(OBJDIR)/moduleMeshInputVTU.o $(OBJDIR)/moduleMeshOutputVTU.o \
|
||||
$(OBJDIR)/moduleMeshInputGmsh2.o $(OBJDIR)/moduleMeshOutputGmsh2.o \
|
||||
$(OBJDIR)/moduleMeshInput0D.o $(OBJDIR)/moduleMeshOutput0D.o \
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ MODULE moduleMeshOutputGmsh2
|
|||
USE moduleRefParam
|
||||
USE moduleSpecies
|
||||
USE moduleOutput
|
||||
USE moduleMeshInoutCommon
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
|
|
@ -93,13 +94,11 @@ MODULE moduleMeshOutputGmsh2
|
|||
TYPE(outputFormat):: output(1:self%numNodes)
|
||||
REAL(8):: time
|
||||
CHARACTER(:), ALLOCATABLE:: fileName
|
||||
CHARACTER (LEN=iterationDigits):: tstring
|
||||
|
||||
time = DBLE(t)*tauMin*ti_ref
|
||||
|
||||
DO i = 1, nSpecies
|
||||
WRITE(tstring, iterationFormat) t
|
||||
fileName= 'OUTPUT_' // tstring// '_' // species(i)%obj%name // '.msh'
|
||||
fileName = formatFileName(prefix, species(i)%obj%name, 'msh', t)
|
||||
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
|
||||
OPEN (60, file = path // folder // '/' // fileName)
|
||||
|
||||
|
|
@ -142,6 +141,7 @@ MODULE moduleMeshOutputGmsh2
|
|||
USE moduleCaseParam
|
||||
USE moduleCollisions
|
||||
USE moduleOutput
|
||||
USE moduleMeshInoutCommon
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshGeneric), INTENT(in):: self
|
||||
|
|
@ -151,7 +151,6 @@ MODULE moduleMeshOutputGmsh2
|
|||
INTEGER:: n
|
||||
REAL(8):: time
|
||||
CHARACTER(:), ALLOCATABLE:: fileName
|
||||
CHARACTER (LEN=iterationDigits):: tString
|
||||
CHARACTER(:), ALLOCATABLE:: title
|
||||
CHARACTER (LEN=2):: cString
|
||||
|
||||
|
|
@ -169,9 +168,8 @@ MODULE moduleMeshOutputGmsh2
|
|||
|
||||
IF (collOutput) THEN
|
||||
time = DBLE(t)*tauMin*ti_ref
|
||||
WRITE(tString, iterationFormat) t
|
||||
|
||||
fileName='OUTPUT_' // tString// '_Collisions.msh'
|
||||
fileName = formatFileName(prefix, 'Collisions', 'msh', t)
|
||||
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
|
||||
OPEN (60, file = path // folder // '/' // fileName)
|
||||
|
||||
|
|
@ -203,6 +201,7 @@ MODULE moduleMeshOutputGmsh2
|
|||
USE moduleRefParam
|
||||
USE moduleCaseParam
|
||||
USE moduleOutput
|
||||
USE moduleMeshInoutCommon
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
|
|
@ -210,16 +209,14 @@ MODULE moduleMeshOutputGmsh2
|
|||
INTEGER:: n, e
|
||||
REAL(8):: time
|
||||
CHARACTER(:), ALLOCATABLE:: fileName
|
||||
CHARACTER (LEN=iterationDigits):: tstring
|
||||
REAL(8):: Xi(1:3)
|
||||
|
||||
Xi = (/ 0.D0, 0.D0, 0.D0 /)
|
||||
|
||||
IF (emOutput) THEN
|
||||
time = DBLE(t)*tauMin*ti_ref
|
||||
WRITE(tstring, iterationFormat) t
|
||||
|
||||
fileName='OUTPUT_' // tstring// '_EMField.msh'
|
||||
fileName = formatFileName(prefix, 'Collisions', 'msh', t)
|
||||
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
|
||||
OPEN (20, file = path // folder // '/' // fileName)
|
||||
|
||||
|
|
@ -256,6 +253,7 @@ MODULE moduleMeshOutputGmsh2
|
|||
USE moduleSpecies
|
||||
USE moduleOutput
|
||||
USE moduleAverage
|
||||
USE moduleMeshInoutCommon
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
|
|
@ -265,11 +263,11 @@ MODULE moduleMeshOutputGmsh2
|
|||
INTEGER:: fileMean=10, fileDeviation=20
|
||||
|
||||
DO i = 1, nSpecies
|
||||
fileName= 'Average_mean_' // species(i)%obj%name // '.msh'
|
||||
fileName = formatFileName('Average_mean', species(i)%obj%name, 'msh')
|
||||
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
|
||||
OPEN (fileMean, file = path // folder // '/' // fileName)
|
||||
|
||||
fileName= 'Average_deviation_' // species(i)%obj%name // '.msh'
|
||||
fileName = formatFileName('Average_deviation', species(i)%obj%name, 'msh')
|
||||
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
|
||||
OPEN (filedeviation, file = path // folder // '/' // fileName)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
all: vtu.o gmsh2.o 0D.o
|
||||
|
||||
vtu.o:
|
||||
vtu.o: moduleMeshInoutCommon.o
|
||||
$(MAKE) -C vtu all
|
||||
|
||||
gmsh2.o:
|
||||
|
|
@ -8,3 +8,6 @@ gmsh2.o:
|
|||
|
||||
0D.o:
|
||||
$(MAKE) -C 0D all
|
||||
|
||||
%.o: %.f90
|
||||
$(FC) $(FCFLAGS) -c $< -o $(OBJDIR)/$@
|
||||
|
|
|
|||
27
src/modules/mesh/inout/moduleMeshInoutCommon.f90
Normal file
27
src/modules/mesh/inout/moduleMeshInoutCommon.f90
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
MODULE moduleMeshInoutCommon
|
||||
|
||||
CHARACTER(LEN=4):: prefix = 'Step'
|
||||
|
||||
CONTAINS
|
||||
PURE FUNCTION formatFileName(prefix, suffix, extension, t) RESULT(fileName)
|
||||
USE moduleOutput
|
||||
IMPLICIT NONE
|
||||
|
||||
CHARACTER(*), INTENT(in):: prefix, suffix, extension
|
||||
INTEGER, INTENT(in), OPTIONAL:: t
|
||||
CHARACTER (LEN=iterationDigits):: tString
|
||||
CHARACTER(:), ALLOCATABLE:: fileName
|
||||
|
||||
IF (PRESENT(t)) THEN
|
||||
WRITE(tString, iterationFormat) t
|
||||
fileName = prefix // '_' // tString // '_' // suffix // '.' // extension
|
||||
|
||||
ELSE
|
||||
fileName = prefix // '_' // suffix // '.' // extension
|
||||
|
||||
END IF
|
||||
|
||||
END FUNCTION formatFileName
|
||||
|
||||
|
||||
END MODULE moduleMeshInoutCommon
|
||||
|
|
@ -1,29 +1,7 @@
|
|||
MODULE moduleMeshOutputVTU
|
||||
|
||||
CHARACTER(LEN=6):: prefix = 'OUTPUT'
|
||||
|
||||
CONTAINS
|
||||
|
||||
PURE FUNCTION formatFileName(prefix, suffix, extension, t) RESULT(fileName)
|
||||
USE moduleOutput
|
||||
IMPLICIT NONE
|
||||
|
||||
CHARACTER(*), INTENT(in):: prefix, suffix, extension
|
||||
INTEGER, INTENT(in), OPTIONAL:: t
|
||||
CHARACTER (LEN=iterationDigits):: tString
|
||||
CHARACTER(:), ALLOCATABLE:: fileName
|
||||
|
||||
IF (PRESENT(t)) THEN
|
||||
WRITE(tString, iterationFormat) t
|
||||
fileName = prefix // '_' // tString // '_' // suffix // '.' // extension
|
||||
|
||||
ELSE
|
||||
fileName = prefix // '_' // suffix // '.' // extension
|
||||
|
||||
END IF
|
||||
|
||||
END FUNCTION formatFileName
|
||||
|
||||
SUBROUTINE writeHeader(nNodes, nCells, fileID)
|
||||
USE moduleMesh
|
||||
IMPLICIT NONE
|
||||
|
|
@ -332,6 +310,7 @@ MODULE moduleMeshOutputVTU
|
|||
SUBROUTINE printOutputVTU(self,t)
|
||||
USE moduleMesh
|
||||
USE moduleSpecies
|
||||
USE moduleMeshInoutCommon
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
|
|
@ -358,7 +337,7 @@ MODULE moduleMeshOutputVTU
|
|||
CLOSE(fileID)
|
||||
|
||||
!Write collection file for time plotting
|
||||
fileNameCollection = formatFileName(prefix, 'Collection_' // species(i)%obj%name, 'pvd')
|
||||
fileNameCollection = formatFileName('Collection', species(i)%obj%name, 'pvd')
|
||||
CALL writeCollection(fileID, t, fileName, filenameCollection)
|
||||
|
||||
END DO
|
||||
|
|
@ -368,6 +347,7 @@ MODULE moduleMeshOutputVTU
|
|||
SUBROUTINE printCollVTU(self,t)
|
||||
USE moduleMesh
|
||||
USE moduleOutput
|
||||
USE moduleMeshInoutCommon
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshGeneric), INTENT(in):: self
|
||||
|
|
@ -395,7 +375,7 @@ MODULE moduleMeshOutputVTU
|
|||
CLOSE(fileID)
|
||||
|
||||
!Write collection file for time plotting
|
||||
fileNameCollection = formatFileName(prefix, 'Collection_Collisions', 'pvd')
|
||||
fileNameCollection = formatFileName('Collection', 'Collisions', 'pvd')
|
||||
CALL writeCollection(fileID, t, fileName, filenameCollection)
|
||||
|
||||
END IF
|
||||
|
|
@ -404,6 +384,7 @@ MODULE moduleMeshOutputVTU
|
|||
|
||||
SUBROUTINE printEMVTU(self, t)
|
||||
USE moduleMesh
|
||||
USE moduleMeshInoutCommon
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
|
|
@ -429,7 +410,7 @@ MODULE moduleMeshOutputVTU
|
|||
CLOSE(fileID)
|
||||
|
||||
!Write collection file for time plotting
|
||||
fileNameCollection = formatFileName(prefix, 'Collection_EMField', 'pvd')
|
||||
fileNameCollection = formatFileName('Collection', 'EMField', 'pvd')
|
||||
CALL writeCollection(fileID, t, fileName, filenameCollection)
|
||||
|
||||
END IF
|
||||
|
|
@ -439,6 +420,7 @@ MODULE moduleMeshOutputVTU
|
|||
SUBROUTINE printAverageVTU(self)
|
||||
USE moduleMesh
|
||||
USE moduleSpecies
|
||||
USE moduleMeshInoutCommon
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue