Compare commits

...

7 commits

23 changed files with 3315 additions and 3220 deletions

Binary file not shown.

View file

@ -398,6 +398,9 @@ make
Trigger between writings is the same as in \textbf{triggerOutput}.
\item \textbf{EMField}: Logical.
Determines if the electromagnetic field is printed.
\item \textbf{bounraiesParticle}: Logical.
Determines if the properties of the boundaries are written.
\textit{Warning}: Not all particle models produce this output, only those whose properties change during the simulation.
\item \textbf{probes}: Array of objects.
Defines the probes employed for obtaining the distribution function at specific positions.
See Sec.~\ref{sec:probing} for more information.

View file

@ -4,7 +4,7 @@
"path": "./runs/0D_Argon/",
"triggerOutput": 1,
"numColl": true,
"folder": "test"
"folder": "output"
},
"reference": {
"density": 1.0e16,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
"L_ref","v_ref","ti_ref","Vol_ref","EF_ref","Volt_ref","B_ref"
7.433780E-005,1.554141E+003,4.783208E-008,4.107987E-013,1.345150E+004,9.999550E-001,8.655264E+000
1 L_ref v_ref ti_ref Vol_ref EF_ref Volt_ref B_ref
2 7.433780E-005 1.554141E+003 4.783208E-008 4.107987E-013 1.345150E+004 9.999550E-001 8.655264E+000

View file

@ -6,7 +6,6 @@ OBJECTS = $(OBJDIR)/moduleMesh.o $(OBJDIR)/moduleMeshCommon.o $(OBJDIR)/moduleCo
$(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)/moduleCoulomb.o \
$(OBJDIR)/moduleMeshInoutCommon.o \
$(OBJDIR)/moduleMeshInputVTU.o $(OBJDIR)/moduleMeshOutputVTU.o \
$(OBJDIR)/moduleMeshInputGmsh2.o $(OBJDIR)/moduleMeshOutputGmsh2.o \
$(OBJDIR)/moduleMeshInput0D.o $(OBJDIR)/moduleMeshOutput0D.o \

View file

@ -492,6 +492,7 @@ MODULE moduleInput
CALL config%get(object // '.cpuTime', timeOutput, found)
CALL config%get(object // '.numColl', collOutput, found)
CALL config%get(object // '.EMField', emOutput, found)
call config%get(object // '.boundariesParticle', boundaryParticleOutput, found)
CALL config%get(object // '.triggerCPUTime', triggerCPUTime, found)
IF (.NOT. found) THEN
@ -1569,35 +1570,29 @@ MODULE moduleInput
END SUBROUTINE readParallel
SUBROUTINE initOutput(inputFile)
USE moduleRefParam
USE moduleMesh, ONLY: mesh, doubleMesh, pathMeshParticle, pathMeshColl
USE moduleOutput, ONLY: path, folder
USE moduleOutput, ONLY: createOutputFolder, writeReference, copyFileToOutput, writeCommit
IMPLICIT NONE
CHARACTER(:), ALLOCATABLE, INTENT(in):: inputFile
INTEGER:: fileReference = 30
!If everything is correct, creates the output folder
CALL EXECUTE_COMMAND_LINE('mkdir ' // path // folder )
call createOutputFolder()
!Copies input file to output folder
CALL EXECUTE_COMMAND_LINE('cp ' // inputFile // ' ' // path // folder)
call copyFileToOutput(inputFile)
!Copies particle mesh
IF (mesh%dimen > 0) THEN
CALL EXECUTE_COMMAND_LINE('cp ' // pathMeshParticle // ' ' // path // folder)
call copyFileToOutput(pathMeshParticle)
IF (doubleMesh) THEN
CALL EXECUTE_COMMAND_LINE('cp ' // pathMeshColl // ' ' // path // folder)
call copyFileToOutput(pathMeshColl)
END IF
END IF
! Write commit of fpakc
CALL SYSTEM('git rev-parse HEAD > ' // path // folder // '/' // 'fpakc_commit.txt')
call writeCommit()
! Write file with reference values
OPEN (fileReference, file=path // folder // '/' // 'reference.txt')
WRITE(fileReference, "(7(1X,A20))") 'L_ref', 'v_ref', 'ti_ref', 'Vol_ref', 'EF_ref', 'Volt_ref', 'B_ref'
WRITE(fileReference, "(7(1X,ES20.6E3))") L_ref, v_ref, ti_ref, Vol_ref, EF_ref, Volt_ref, B_ref
CLOSE(fileReference)
call writeReference()
END SUBROUTINE initOutput

View file

@ -15,19 +15,21 @@ MODULE moduleMeshOutput0D
CHARACTER(:), ALLOCATABLE:: fileName
DO i = 1, nSpecies
fileName='OUTPUT_' // species(i)%obj%name // '.dat'
fileName = formatFileName('Output', species(i)%obj%name, 'csv')
IF (timeStep == 0) THEN
OPEN(20, file = path // folder // '/' // fileName, action = 'write')
WRITE(20, "(A1, 14X, A5, A20, 40X, A20, 2(A20))") "#","t (s)","density (m^-3)", "velocity (m/s)", &
"pressure (Pa)", "temperature (K)"
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN(20, file = generateFilePath(fileName), action = 'write')
WRITE(20, "(*("//fmtColStr//"))")'"t (s)"','"density (m^-3)"', &
'"velocity (m/s):0"', '"velocity (m/s):1"', '"velocity (m/s):2"', &
'"pressure (Pa)"', &
'"temperature (K)"'
call informFileCreation(fileName)
CLOSE(20)
END IF
OPEN(20, file = path // folder // '/' // fileName, position = 'append', action = 'write')
OPEN(20, file = generateFilePath(fileName), position = 'append', action = 'write')
CALL calculateOutput(self%nodes(1)%obj%output(i), output, self%nodes(1)%obj%v, species(i)%obj)
WRITE(20, "(7(ES20.6E3))") REAL(timeStep)*tauMin*ti_ref, output%density, &
WRITE(20, "(*("//fmtColReal//"))") REAL(timeStep)*tauMin*ti_ref, output%density, &
output%velocity, &
output%pressure, &
output%temperature
@ -49,17 +51,22 @@ MODULE moduleMeshOutput0D
CHARACTER(:), ALLOCATABLE:: fileName
INTEGER:: k
fileName='OUTPUT_Collisions.dat'
fileName = formatFileName('Output', 'Collisions', 'csv')
IF (timeStep == tInitial) THEN
OPEN(20, file = path // folder // '/' // fileName, action = 'write')
WRITE(20, "(A1, 14X, A5, A20)") "#","t (s)","collisions"
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN(20, file = generateFilePath(fileName), action = 'write')
call informFileCreation(fileName)
WRITE(20, "(A,A)", advance='no') "t (s)", ','
do k = 1, nCollPairs-1
write(20, '(A,A,I3,A,A)', advance='no') '"',"pair", k, '"', ','
end do
write(20, "(A,A,I3,A)", advance='no') '"',"pair",k, '"'
CLOSE(20)
END IF
OPEN(20, file = path // folder // '/' // fileName, position = 'append', action = 'write')
WRITE(20, "(ES20.6E3, 10I20)") REAL(timeStep)*tauMin*ti_ref, (self%cells(1)%obj%tallyColl(k)%tally, k=1,nCollPairs)
OPEN(20, file = generateFilePath(fileName), position = 'append', action = 'write')
WRITE(20, "("//fmtColReal//", *("//fmtColInt//"))") REAL(timeStep)*tauMin*ti_ref, (self%cells(1)%obj%tallyColl(k)%tally, k=1,nCollPairs)
CLOSE(20)
END SUBROUTINE printColl0D

View file

@ -16,6 +16,7 @@ MODULE moduleMeshOutputGmsh2
!Node data subroutines
!Header
SUBROUTINE writeGmsh2HeaderNodeData(fileID, title, iteration, time, dimensions, nNodes)
use moduleOutput
IMPLICIT NONE
INTEGER, INTENT(in):: fileID
@ -25,14 +26,14 @@ MODULE moduleMeshOutputGmsh2
WRITE(fileID, "(A)") '$NodeData'
WRITE(fileID, "(I10)") 1
WRITE(fileID, "("//fmtInt//")") 1
WRITE(fileID, "(A1, A, A1)") '"' , title , '"'
WRITE(fileID, "(I10)") 1
WRITE(fileID, "(ES20.6E3)") time
WRITE(fileID, "(I10)") 3
WRITE(fileID, "(I10)") iteration
WRITE(fileID, "(I10)") dimensions
WRITE(fileID, "(I10)") nNodes
WRITE(fileID, "("//fmtInt//")") 1
WRITE(fileID, "("//fmtReal//")") time
WRITE(fileID, "("//fmtInt//")") 3
WRITE(fileID, "("//fmtInt//")") iteration
WRITE(fileID, "("//fmtInt//")") dimensions
WRITE(fileID, "("//fmtInt//")") nNodes
END SUBROUTINE writeGmsh2HeaderNodeData
@ -49,6 +50,7 @@ MODULE moduleMeshOutputGmsh2
!Element data subroutines
!Header
SUBROUTINE writeGmsh2HeaderElementData(fileID, title, iteration, time, dimensions, nVols)
use moduleOutput
IMPLICIT NONE
INTEGER, INTENT(in):: fileID
@ -58,14 +60,14 @@ MODULE moduleMeshOutputGmsh2
WRITE(fileID, "(A)") '$ElementData'
WRITE(fileID, "(I10)") 1
WRITE(fileID, "("//fmtInt//")") 1
WRITE(fileID, "(A1, A, A1)") '"' , title , '"'
WRITE(fileID, "(I10)") 1
WRITE(fileID, "(ES20.6E3)") time
WRITE(fileID, "(I10)") 3
WRITE(fileID, "(I10)") iteration
WRITE(fileID, "(I10)") dimensions
WRITE(fileID, "(I10)") nVols
WRITE(fileID, "("//fmtInt//")") 1
WRITE(fileID, "("//fmtReal//")") time
WRITE(fileID, "("//fmtInt//")") 3
WRITE(fileID, "("//fmtInt//")") iteration
WRITE(fileID, "("//fmtInt//")") dimensions
WRITE(fileID, "("//fmtInt//")") nVols
END SUBROUTINE writeGmsh2HeaderElementData
@ -85,7 +87,6 @@ MODULE moduleMeshOutputGmsh2
USE moduleRefParam
USE moduleSpecies
USE moduleOutput
USE moduleMeshInoutCommon
USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE
@ -99,33 +100,33 @@ MODULE moduleMeshOutputGmsh2
DO i = 1, nSpecies
fileName = formatFileName(prefix, species(i)%obj%name, 'msh', timeStep)
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (60, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
OPEN (60, file = generateFilePath(fileName))
CALL writeGmsh2HeaderMesh(60)
CALL writeGmsh2HeaderNodeData(60, species(i)%obj%name // ' density (m^-3)', timeStep, time, 1, self%numNodes)
DO n=1, self%numNodes
CALL calculateOutput(self%nodes(n)%obj%output(i), output(n), self%nodes(n)%obj%v, species(i)%obj)
WRITE(60, "(I6,ES20.6E3)") n, output(n)%density
WRITE(60, "(I6,"//fmtReal//")") n, output(n)%density
END DO
CALL writeGmsh2FooterNodeData(60)
CALL writeGmsh2HeaderNodeData(60, species(i)%obj%name // ' velocity (m s^-1)', timeStep, time, 3, self%numNodes)
DO n=1, self%numNodes
WRITE(60, "(I6,3(ES20.6E3))") n, output(n)%velocity
WRITE(60, "(I6,3("//fmtReal//"))") n, output(n)%velocity
END DO
CALL writeGmsh2FooterNodeData(60)
CALL writeGmsh2HeaderNodeData(60, species(i)%obj%name // ' Pressure (Pa)', timeStep, time, 1, self%numNodes)
DO n=1, self%numNodes
WRITE(60, "(I6,3(ES20.6E3))") n, output(n)%pressure
WRITE(60, "(I6,3("//fmtReal//"))") n, output(n)%pressure
END DO
CALL writeGmsh2FooterNodeData(60)
CALL writeGmsh2HeaderNodeData(60, species(i)%obj%name // ' Temperature (K)', timeStep, time, 1, self%numNodes)
DO n=1, self%numNodes
WRITE(60, "(I6,3(ES20.6E3))") n, output(n)%temperature
WRITE(60, "(I6,3("//fmtReal//"))") n, output(n)%temperature
END DO
CALL writeGmsh2FooterNodeData(60)
CLOSE (60)
@ -141,7 +142,6 @@ MODULE moduleMeshOutputGmsh2
USE moduleCaseParam
USE moduleCollisions
USE moduleOutput
USE moduleMeshInoutCommon
IMPLICIT NONE
CLASS(meshGeneric), INTENT(in):: self
@ -169,8 +169,8 @@ MODULE moduleMeshOutputGmsh2
time = DBLE(timeStep)*tauMin*ti_ref
fileName = formatFileName(prefix, 'Collisions', 'msh', timeStep)
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (60, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
OPEN (60, file = generateFilePath(fileName))
CALL writeGmsh2HeaderMesh(60)
@ -180,7 +180,7 @@ MODULE moduleMeshOutputGmsh2
title = '"Pair ' // interactionMatrix(k)%sp_i%name // '-' // interactionMatrix(k)%sp_j%name // ' collision ' // cString
CALL writeGmsh2HeaderElementData(60, title, timeStep, time, 1, self%numCells)
DO n=1, self%numCells
WRITE(60, "(I6,I10)") n + numEdges, self%cells(n)%obj%tallyColl(k)%tally(c)
WRITE(60, "(I6,"//fmtInt//")") n + numEdges, self%cells(n)%obj%tallyColl(k)%tally(c)
END DO
CALL writeGmsh2FooterElementData(60)
@ -200,7 +200,6 @@ MODULE moduleMeshOutputGmsh2
USE moduleRefParam
USE moduleCaseParam
USE moduleOutput
USE moduleMeshInoutCommon
IMPLICIT NONE
CLASS(meshParticles), INTENT(in):: self
@ -215,8 +214,8 @@ MODULE moduleMeshOutputGmsh2
time = DBLE(timeStep)*tauMin*ti_ref
fileName = formatFileName(prefix, 'EMField', 'msh', timeStep)
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (20, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
OPEN (20, file = generateFilePath(fileName))
CALL writeGmsh2HeaderMesh(20)
@ -251,7 +250,6 @@ MODULE moduleMeshOutputGmsh2
USE moduleSpecies
USE moduleOutput
USE moduleAverage
USE moduleMeshInoutCommon
IMPLICIT NONE
CLASS(meshParticles), INTENT(in):: self
@ -262,12 +260,12 @@ MODULE moduleMeshOutputGmsh2
DO i = 1, nSpecies
fileName = formatFileName('Average_mean', species(i)%obj%name, 'msh')
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (fileMean, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
OPEN (fileMean, file = generateFilePath(fileName))
fileName = formatFileName('Average_deviation', species(i)%obj%name, 'msh')
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (filedeviation, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
OPEN (filedeviation, file = generateFilePath(fileName))
CALL writeGmsh2HeaderMesh(fileMean)
CALL writeGmsh2HeaderMesh(fileDeviation)
@ -276,9 +274,9 @@ MODULE moduleMeshOutputGmsh2
CALL writeGmsh2HeaderNodeData(fileDeviation, species(i)%obj%name // ' density, sd (m^-3)', 0, 0.D0, 1, self%numNodes)
DO n=1, self%numNodes
CALL calculateOutput(averageScheme(n)%mean%output(i), outputMean(n), self%nodes(n)%obj%v, species(i)%obj)
WRITE(fileMean, "(I6,ES20.6E3)") n, outputMean(n)%density
WRITE(fileMean, "(I6,"//fmtReal//")") n, outputMean(n)%density
CALL calculateOutput(averageScheme(n)%deviation%output(i), outputDeviation(n), self%nodes(n)%obj%v, species(i)%obj)
WRITE(fileDeviation, "(I6,ES20.6E3)") n, outputDeviation(n)%density
WRITE(fileDeviation, "(I6,"//fmtReal//")") n, outputDeviation(n)%density
END DO
CALL writeGmsh2FooterNodeData(fileMean)
CALL writeGmsh2FooterNodeData(fileDeviation)
@ -286,8 +284,8 @@ MODULE moduleMeshOutputGmsh2
CALL writeGmsh2HeaderNodeData(fileMean, species(i)%obj%name // ' velocity, mean (m s^-1)', 0, 0.D0, 3, self%numNodes)
CALL writeGmsh2HeaderNodeData(fileDeviation, species(i)%obj%name // ' velocity, sd (m s^-1)', 0, 0.D0, 3, self%numNodes)
DO n=1, self%numNodes
WRITE(fileMean, "(I6,3(ES20.6E3))") n, outputMean(n)%velocity
WRITE(fileDeviation, "(I6,3(ES20.6E3))") n, outputDeviation(n)%velocity
WRITE(fileMean, "(I6,3("//fmtReal//"))") n, outputMean(n)%velocity
WRITE(fileDeviation, "(I6,3("//fmtReal//"))") n, outputDeviation(n)%velocity
END DO
CALL writeGmsh2FooterNodeData(fileMean)
CALL writeGmsh2FooterNodeData(fileDeviation)
@ -295,8 +293,8 @@ MODULE moduleMeshOutputGmsh2
CALL writeGmsh2HeaderNodeData(fileMean, species(i)%obj%name // ' Pressure, mean (Pa)', 0, 0.D0, 1, self%numNodes)
CALL writeGmsh2HeaderNodeData(fileDeviation, species(i)%obj%name // ' Pressure, sd (Pa)', 0, 0.D0, 1, self%numNodes)
DO n=1, self%numNodes
WRITE(fileMean, "(I6,3(ES20.6E3))") n, outputMean(n)%pressure
WRITE(fileDeviation, "(I6,3(ES20.6E3))") n, outputDeviation(n)%pressure
WRITE(fileMean, "(I6,3("//fmtReal//"))") n, outputMean(n)%pressure
WRITE(fileDeviation, "(I6,3("//fmtReal//"))") n, outputDeviation(n)%pressure
END DO
CALL writeGmsh2FooterNodeData(fileMean)
CALL writeGmsh2FooterNodeData(fileDeviation)
@ -304,8 +302,8 @@ MODULE moduleMeshOutputGmsh2
CALL writeGmsh2HeaderNodeData(fileMean, species(i)%obj%name // ' Temperature, mean (K)', 0, 0.D0, 1, self%numNodes)
CALL writeGmsh2HeaderNodeData(fileDeviation, species(i)%obj%name // ' Temperature, sd (K)', 0, 0.D0, 1, self%numNodes)
DO n=1, self%numNodes
WRITE(fileMean, "(I6,3(ES20.6E3))") n, outputMean(n)%temperature
WRITE(fileDeviation, "(I6,3(ES20.6E3))") n, outputDeviation(n)%temperature
WRITE(fileMean, "(I6,3("//fmtReal//"))") n, outputMean(n)%temperature
WRITE(fileDeviation, "(I6,3("//fmtReal//"))") n, outputDeviation(n)%temperature
END DO
CALL writeGmsh2FooterNodeData(fileMean)
CALL writeGmsh2FooterNodeData(fileDeviation)

View file

@ -1,6 +1,6 @@
all: vtu.o gmsh2.o 0D.o text.o
vtu.o: moduleMeshInoutCommon.o
vtu.o:
$(MAKE) -C vtu all
gmsh2.o:

View file

@ -1,27 +0,0 @@
MODULE moduleMeshInoutCommon
CHARACTER(LEN=4):: prefix = 'Step'
CONTAINS
PURE FUNCTION formatFileName(prefix, suffix, extension, timeStep) RESULT(fileName)
USE moduleOutput
IMPLICIT NONE
CHARACTER(*), INTENT(in):: prefix, suffix, extension
INTEGER, INTENT(in), OPTIONAL:: timeStep
CHARACTER (LEN=iterationDigits):: tString
CHARACTER(:), ALLOCATABLE:: fileName
IF (PRESENT(timeStep)) THEN
WRITE(tString, iterationFormat) timeStep
fileName = prefix // '_' // tString // '_' // suffix // '.' // extension
ELSE
fileName = prefix // '_' // suffix // '.' // extension
END IF
END FUNCTION formatFileName
END MODULE moduleMeshInoutCommon

View file

@ -121,7 +121,6 @@ module moduleMeshOutputText
subroutine printOutputText(self)
use moduleMesh
use moduleSpecies
use moduleMeshInoutCommon
use moduleCaseParam, ONLY: timeStep
implicit none
@ -134,8 +133,8 @@ module moduleMeshOutputText
do s = 1, nSpecies
fileName = formatFileName(prefix, species(s)%obj%name, 'csv', timeStep)
write(*, "(6X,A15,A)") "Creating file: ", fileName
open (fileID, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
open (fileID, file = generateFilePath(fileName))
write(fileID, '(5(A,","),A)') '"Position (m)"', &
'"Density (m^-3)"', &
@ -153,7 +152,6 @@ module moduleMeshOutputText
subroutine printCollText(self)
use moduleMesh
use moduleOutput
use moduleMeshInoutCommon
use moduleCaseParam, only: timeStep
implicit none
@ -167,8 +165,8 @@ module moduleMeshOutputText
if (collOutput) then
fileName = formatFileName(prefix, 'Collisions', 'csv', timeStep)
write(*, "(6X,A15,A)") "Creating file: ", fileName
open (fileID, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
open (fileID, file = generateFilePath(fileName))
write(fileID, '(A)', advance='no') "Cell"
do k = 1, nCollPairs
@ -191,7 +189,6 @@ module moduleMeshOutputText
subroutine printEMText(self)
use moduleMesh
use moduleMeshInoutCommon
use moduleCaseParam, only: timeStep
implicit none
@ -203,8 +200,8 @@ module moduleMeshOutputText
if (emOutput) then
fileName = formatFileName(prefix, 'EMField', 'csv', timeStep)
write(*, "(6X,A15,A)") "Creating file: ", fileName
open (fileID, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
open (fileID, file = generateFilePath(fileName))
write(fileID, '(8(A,","),A)') '"Position (m)"', &
'"Potential (V)"', &
@ -222,7 +219,6 @@ module moduleMeshOutputText
subroutine printAverageText(self)
use moduleMesh
use moduleSpecies
use moduleMeshInoutCommon
implicit none
class(meshParticles), intent(in):: self
@ -235,8 +231,8 @@ module moduleMeshOutputText
do s = 1, nSpecies
fileNameMean = formatFileName('Average_mean', species(s)%obj%name, 'csv')
write(*, "(6X,A15,A)") "Creating file: ", fileNameMean
open (fileIDMean, file = path // folder // '/' // fileNameMean)
call informFileCreation(fileNameMean)
open (fileIDMean, file = generateFilePath(fileNameMean))
write(fileIDMean, '(5(A,","),A)') '"Position (m)"', &
'"Density, mean (m^-3)"', &
@ -244,8 +240,8 @@ module moduleMeshOutputText
'"Temperature, mean (K)"'
fileNameDeviation = formatFileName('Average_deviation', species(s)%obj%name, 'csv')
write(*, "(6X,A15,A)") "Creating file: ", fileNameDeviation
open (fileIDDeviation, file = path // folder // '/' // fileNameDeviation)
call informFileCreation(fileNameDeviation)
open (fileIDDeviation, file = generateFilePath(fileNameDeviation))
write(fileIDDeviation, '(5(A,","),A)') '"Position (m)"', &
'"Density, deviation (m^-3)"', &

View file

@ -12,7 +12,7 @@ MODULE moduleMeshOutputVTU
WRITE(fileID,"(A)") '<?xml version="1.0"?>'
WRITE(fileID,"(2X, A)") '<VTKFile type="UnstructuredGrid">'
WRITE(fileID,"(4X, A)") '<UnstructuredGrid>'
WRITE(fileID,"(6X, A, I10, A, I10, A)") '<Piece NumberOfPoints="', nNodes, '" NumberOfCells="', nCells, '">'
WRITE(fileID,"(6X, A, "//fmtInt//", A, "//fmtInt//", A)") '<Piece NumberOfPoints="', nNodes, '" NumberOfCells="', nCells, '">'
END SUBROUTINE writeHeader
@ -87,14 +87,14 @@ MODULE moduleMeshOutputVTU
!Write nodes coordinates
WRITE(fileID, "(8X, A)") '<Points>'
WRITE(fileID, "(10X,A)") '<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
WRITE(fileID, "(6(ES20.6E3))") (self%nodes(e)%obj%getCoordinates()*L_ref, e = 1, self%numNodes)
WRITE(fileID, "(6("//fmtReal//"))") (self%nodes(e)%obj%getCoordinates()*L_ref, e = 1, self%numNodes)
WRITE(fileID, "(10X, A)") '</DataArray>'
WRITE(fileID, "(8X, A)") '</Points>'
WRITE(fileID, "(8X, A)") '<Cells>'
!Write nodes connectivity of each cell
WRITE(fileID, "(10X,A)") '<DataArray type="Int32" Name="connectivity" format="ascii">'
WRITE(fileID, "(6(I10))") (self%cells(e)%obj%getNodes(self%cells(e)%obj%nNodes) - 1, e = 1, self%numCells) !Array starts on 0
WRITE(fileID, "(6("//fmtInt//"))") (self%cells(e)%obj%getNodes(self%cells(e)%obj%nNodes) - 1, e = 1, self%numCells) !Array starts on 0
WRITE(fileID, "(10X, A)") '</DataArray>'
!Write offset of each cell
offset(1) = self%cells(1)%obj%nNodes
@ -103,7 +103,7 @@ MODULE moduleMeshOutputVTU
offset(e) = offset(e - 1) + self%cells(e)%obj%nNodes
END DO
WRITE(fileID, "(6(I10))") offset
WRITE(fileID, "(6("//fmtInt//"))") offset
WRITE(fileID, "(10X, A)") '</DataArray>'
!Write type of each cell
WRITE(fileID, "(10X,A)") '<DataArray type="Int32" Name="types" format="ascii">'
@ -111,7 +111,7 @@ MODULE moduleMeshOutputVTU
types(e) = getCellType(self%cells(e)%obj)
END DO
WRITE(fileID, "(6(I10))") types
WRITE(fileID, "(6("//fmtInt//"))") types
WRITE(fileID, "(10X, A)") '</DataArray>'
WRITE(fileID, "(8X, A)") '</Cells>'
@ -137,19 +137,19 @@ MODULE moduleMeshOutputVTU
WRITE(fileID,"(8X,A)") '<PointData>'
!Write density
WRITE(fileID,"(10X,A)") '<DataArray type="Float64" Name="Density (m^-3)" NumberOfComponents="1">'
WRITE(fileID,"(6(ES20.6E3))") (output(n)%density, n = 1, self%numNodes)
WRITE(fileID,"(6("//fmtReal//"))") (output(n)%density, n = 1, self%numNodes)
WRITE(fileID,"(10X,A)") '</DataArray>'
!Write velocity
WRITE(fileID,"(10X,A)") '<DataArray type="Float64" Name="Velocity (m s^-1)" NumberOfComponents="3">'
WRITE(fileID,"(6(ES20.6E3))") (output(n)%velocity, n = 1, self%numNodes)
WRITE(fileID,"(6("//fmtReal//"))") (output(n)%velocity, n = 1, self%numNodes)
WRITE(fileID,"(10X,A)") '</DataArray>'
!Write pressure
WRITE(fileID,"(10X,A)") '<DataArray type="Float64" Name="Pressure (Pa)" NumberOfComponents="1">'
WRITE(fileID,"(6(ES20.6E3))") (output(n)%pressure, n = 1, self%numNodes)
WRITE(fileID,"(6("//fmtReal//"))") (output(n)%pressure, n = 1, self%numNodes)
WRITE(fileID,"(10X,A)") '</DataArray>'
!Write temperature
WRITE(fileID,"(10X,A)") '<DataArray type="Float64" Name="Temperature (K)" NumberOfComponents="1">'
WRITE(fileID,"(6(ES20.6E3))") (output(n)%temperature, n = 1, self%numNodes)
WRITE(fileID,"(6("//fmtReal//"))") (output(n)%temperature, n = 1, self%numNodes)
WRITE(fileID,"(10X,A)") '</DataArray>'
!End node data
WRITE(fileID,"(8X,A)") '</PointData>'
@ -173,7 +173,7 @@ MODULE moduleMeshOutputVTU
WRITE(cString, "(I2)") c
title = 'Pair ' // interactionMatrix(k)%sp_i%name // '-' // interactionMatrix(k)%sp_j%name // ' collision ' // cString
WRITE(fileID,"(10X,A, A, A)") '<DataArray type="Float64" Name="',title, '" NumberOfComponents="1">'
WRITE(fileID, "(6(I10))") (self%cells(n)%obj%tallyColl(k)%tally(c), n = 1, self%numCells)
WRITE(fileID, "(6("//fmtInt//"))") (self%cells(n)%obj%tallyColl(k)%tally(c), n = 1, self%numCells)
WRITE(fileID, "(10X, A)") '</DataArray>'
END DO
@ -196,11 +196,11 @@ MODULE moduleMeshOutputVTU
WRITE(fileID,"(8X,A)") '<PointData>'
!Electric potential
WRITE(fileID,"(10X,A)") '<DataArray type="Float64" Name="Potential (V)" NumberOfComponents="1">'
WRITE(fileID,"(6(ES20.6E3))") (self%nodes(n)%obj%emData%phi*Volt_ref, n = 1, self%numNodes)
WRITE(fileID,"(6("//fmtReal//"))") (self%nodes(n)%obj%emData%phi*Volt_ref, n = 1, self%numNodes)
WRITE(fileID,"(10X,A)") '</DataArray>'
!Magnetic Field
WRITE(fileID,"(10X,A)") '<DataArray type="Float64" Name="Magnetic Field (T)" NumberOfComponents="3">'
WRITE(fileID,"(6(ES20.6E3))") (self%nodes(n)%obj%emData%B*B_ref, n = 1, self%numNodes)
WRITE(fileID,"(6("//fmtReal//"))") (self%nodes(n)%obj%emData%B*B_ref, n = 1, self%numNodes)
WRITE(fileID,"(10X,A)") '</DataArray>'
WRITE(fileID,"(8X,A)") '</PointData>'
@ -209,7 +209,7 @@ MODULE moduleMeshOutputVTU
WRITE(fileID,"(8X,A)") '<CellData>'
!Electric field
WRITE(fileID,"(10X,A, A, A)") '<DataArray type="Float64" Name="Electric Field (V m^-1)" NumberOfComponents="3">'
WRITE(fileID,"(6(ES20.6E3))") (self%cells(n)%obj%gatherElectricField(Xi)*EF_ref, n = 1, self%numCells)
WRITE(fileID,"(6("//fmtReal//"))") (self%cells(n)%obj%gatherElectricField(Xi)*EF_ref, n = 1, self%numCells)
WRITE(fileID,"(10X,A)") '</DataArray>'
WRITE(fileID,"(8X,A)") '</CellData>'
@ -221,30 +221,31 @@ MODULE moduleMeshOutputVTU
USE moduleRefParam
IMPLICIT NONE
INTEGER:: fileID
CHARACTER(*):: fileNameStep, fileNameCollection
INTEGER, intent(in):: fileID
CHARACTER(*), intent(in):: fileNameStep, fileNameCollection
IF (timeStep == tInitial) THEN
!Create collection file
WRITE(*, "(6X,A15,A)") "Creating file: ", fileNameCollection
OPEN (fileID + 1, file = path // folder // '/' // fileNameCollection)
call informFileCreation(fileNameCollection)
OPEN (fileID + 1, file = generateFilePath(fileNameCollection))
WRITE (fileID + 1, "(A)") '<VTKFile type="Collection">'
WRITE (fileID + 1, "(2X, A)") '<Collection>'
CLOSE(fileID + 1)
else
OPEN (fileID + 1, file = generateFilePath(fileNameCollection), ACCESS='APPEND')
! Append removing the last two lines that close the <tags>
backspace(fileID + 1)
backspace(fileID + 1)
END IF
!Write iteration file in collection
OPEN (fileID + 1, file = path // folder // '/' // fileNameCollection, ACCESS='APPEND')
WRITE(fileID + 1, "(4X, A, ES20.6E3, A, A, A)") &
WRITE(fileID + 1, "(4X, A, "//fmtReal//", A, A, A)") &
'<DataSet timestep="', DBLE(timeStep)*tauMin*ti_ref,'" file="', fileNameStep,'"/>'
!Close collection file
IF (timeStep == tFinal) THEN
WRITE (fileID + 1, "(2X, A)") '</Collection>'
WRITE (fileID + 1, "(A)") '</VTKFile>'
END IF
CLOSE(fileID + 1)
END SUBROUTINE writeCollection
@ -276,29 +277,29 @@ MODULE moduleMeshOutputVTU
!Write density
WRITE(fileIDMean, "(10X,A)") '<DataArray type="Float64" Name="Density, mean (m^-3)" NumberOfComponents="1">'
WRITE(fileIDDeviation,"(10X,A)") '<DataArray type="Float64" Name="Density, deviation (m^-3)" NumberOfComponents="1">'
WRITE(fileIDMean, "(6(ES20.6E3))") (outputMean(n)%density, n = 1, self%numNodes)
WRITE(fileIDDeviation,"(6(ES20.6E3))") (outputDeviation(n)%density, n = 1, self%numNodes)
WRITE(fileIDMean, "(6("//fmtReal//"))") (outputMean(n)%density, n = 1, self%numNodes)
WRITE(fileIDDeviation,"(6("//fmtReal//"))") (outputDeviation(n)%density, n = 1, self%numNodes)
WRITE(fileIDMean,"(10X,A)") '</DataArray>'
WRITE(fileIDDeviation,"(10X,A)") '</DataArray>'
!Write velocity
WRITE(fileIDMean, "(10X,A)") '<DataArray type="Float64" Name="Velocity, mean (m s^-1)" NumberOfComponents="3">'
WRITE(fileIDDeviation,"(10X,A)") '<DataArray type="Float64" Name="Velocity, deviation (m s^-1)" NumberOfComponents="3">'
WRITE(fileIDMean, "(6(ES20.6E3))") (outputMean(n)%velocity, n = 1, self%numNodes)
WRITE(fileIDDeviation,"(6(ES20.6E3))") (outputDeviation(n)%velocity, n = 1, self%numNodes)
WRITE(fileIDMean, "(6("//fmtReal//"))") (outputMean(n)%velocity, n = 1, self%numNodes)
WRITE(fileIDDeviation,"(6("//fmtReal//"))") (outputDeviation(n)%velocity, n = 1, self%numNodes)
WRITE(fileIDMean, "(10X,A)") '</DataArray>'
WRITE(fileIDDeviation,"(10X,A)") '</DataArray>'
!Write pressure
WRITE(fileIDMean, "(10X,A)") '<DataArray type="Float64" Name="Pressure, mean (Pa)" NumberOfComponents="1">'
WRITE(fileIDDeviation,"(10X,A)") '<DataArray type="Float64" Name="Pressure, deviation (Pa)" NumberOfComponents="1">'
WRITE(fileIDMean, "(6(ES20.6E3))") (outputMean(n)%pressure, n = 1, self%numNodes)
WRITE(fileIDDeviation,"(6(ES20.6E3))") (outputDeviation(n)%pressure, n = 1, self%numNodes)
WRITE(fileIDMean, "(6("//fmtReal//"))") (outputMean(n)%pressure, n = 1, self%numNodes)
WRITE(fileIDDeviation,"(6("//fmtReal//"))") (outputDeviation(n)%pressure, n = 1, self%numNodes)
WRITE(fileIDMean, "(10X,A)") '</DataArray>'
WRITE(fileIDDeviation,"(10X,A)") '</DataArray>'
!Write temperature
WRITE(fileIDMean, "(10X,A)") '<DataArray type="Float64" Name="Temperature, mean (K)" NumberOfComponents="1">'
WRITE(fileIDDeviation,"(10X,A)") '<DataArray type="Float64" Name="Temperature, deviation (K)" NumberOfComponents="1">'
WRITE(fileIDMean, "(6(ES20.6E3))") (outputMean(n)%temperature, n = 1, self%numNodes)
WRITE(fileIDDeviation,"(6(ES20.6E3))") (outputDeviation(n)%temperature, n = 1, self%numNodes)
WRITE(fileIDMean, "(6("//fmtReal//"))") (outputMean(n)%temperature, n = 1, self%numNodes)
WRITE(fileIDDeviation,"(6("//fmtReal//"))") (outputDeviation(n)%temperature, n = 1, self%numNodes)
WRITE(fileIDMean, "(10X,A)") '</DataArray>'
WRITE(fileIDDeviation,"(10X,A)") '</DataArray>'
!End node data
@ -310,7 +311,6 @@ MODULE moduleMeshOutputVTU
SUBROUTINE printOutputVTU(self)
USE moduleMesh
USE moduleSpecies
USE moduleMeshInoutCommon
USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE
@ -322,8 +322,8 @@ MODULE moduleMeshOutputVTU
DO i = 1, nSpecies
fileName = formatFileName(prefix, species(i)%obj%name, 'vtu', timeStep)
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (fileID, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
OPEN (fileID, file = generateFilePath(fileName))
CALL writeHeader(self%numNodes, self%numCells, fileID)
@ -346,7 +346,6 @@ MODULE moduleMeshOutputVTU
SUBROUTINE printCollVTU(self)
USE moduleMesh
USE moduleOutput
USE moduleMeshInoutCommon
USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE
@ -358,8 +357,8 @@ MODULE moduleMeshOutputVTU
IF (collOutput) THEN
fileName = formatFileName(prefix, 'Collisions', 'vtu', timeStep)
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (fileID, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
OPEN (fileID, file = generateFilePath(fileName))
CALL writeHeader(self%numNodes, self%numCells, fileID)
@ -381,7 +380,6 @@ MODULE moduleMeshOutputVTU
SUBROUTINE printEMVTU(self)
USE moduleMesh
USE moduleMeshInoutCommon
USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE
@ -393,8 +391,8 @@ MODULE moduleMeshOutputVTU
IF (emOutput) THEN
fileName = formatFileName(prefix, 'EMField', 'vtu', timeStep)
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (fileID, file = path // folder // '/' // fileName)
call informFileCreation(fileName)
OPEN (fileID, file = generateFilePath(fileName))
CALL writeHeader(self%numNodes, self%numCells, fileID)
@ -416,8 +414,8 @@ MODULE moduleMeshOutputVTU
SUBROUTINE printAverageVTU(self)
USE moduleMesh
use moduleOutput
USE moduleSpecies
USE moduleMeshInoutCommon
IMPLICIT NONE
CLASS(meshParticles), INTENT(in):: self
@ -429,12 +427,12 @@ MODULE moduleMeshOutputVTU
DO i = 1, nSpecies
fileNameMean = formatFileName('Average_mean', species(i)%obj%name, 'vtu')
WRITE(*, "(6X,A15,A)") "Creating file: ", fileNameMean
OPEN (fileIDMean, file = path // folder // '/' // fileNameMean)
call informFileCreation(fileNameMean)
OPEN (fileIDMean, file = generateFilePath(fileNameMean))
fileNameDeviation = formatFileName('Average_deviation', species(i)%obj%name, 'vtu')
WRITE(*, "(6X,A15,A)") "Creating file: ", fileNameDeviation
OPEN (fileIDDeviation, file = path // folder // '/' // fileNameDeviation)
call informFileCreation(fileNameDeviation)
OPEN (fileIDDeviation, file = generateFilePath(fileNameDeviation))
CALL writeHeader(self%numNodes, self%numCells, fileIDMean)
CALL writeHeader(self%numNodes, self%numCells, fileIDDeviation)

View file

@ -4,7 +4,6 @@ MODULE moduleMesh
USE moduleOutput
USE moduleCollisions
use moduleSpecies, only: nSpecies
IMPLICIT NONE
! MESH ELEMENTS
!Generic mesh element
@ -710,10 +709,11 @@ MODULE moduleMesh
end subroutine updateParticle_interface
! Update the values of the particle boundary model
subroutine printParticle_interface(self)
subroutine printParticle_interface(self, fileID)
import boundaryParticleGeneric
class(boundaryParticleGeneric), intent(inout):: self
class(boundaryParticleGeneric), intent(in):: self
integer, intent(in):: fileID
end subroutine printParticle_interface
@ -887,12 +887,16 @@ MODULE moduleMesh
!Array for boundaries
type(boundaryParticleCont), allocatable, target:: boundariesParticle(:)
! Update the particle boundary models
interface
! Update the particle boundary models
module subroutine boundariesParticle_update()
end subroutine boundariesParticle_update
! Write data about particle boundaries
module subroutine boundariesParticle_write()
end subroutine boundariesParticle_write
end interface
! BOUNDARY ELECTROMAGNETIC DEFINITIONS

View file

@ -404,16 +404,21 @@ submodule(moduleMesh) boundaryParticle
end subroutine quasiNeutrality_update
subroutine quasiNeutrality_print(self)
subroutine quasiNeutrality_print(self, fileID)
implicit none
class(boundaryParticleGeneric), intent(inout):: self
print *, 'test'
class(boundaryParticleGeneric), intent(in):: self
integer, intent(in):: fileID
integer:: e
write(fileID, '(A)') self%name
select type(self)
type is(boundaryQuasiNeutrality)
print*, self%alpha
write(fileID, '(A,",",A)') '"Edge id"', '"alpha"'
do e = 1, size(self%edges)
write(fileID, '(I0,",",ES0.6E3)') self%edges(e)%obj%n, self%alpha(self%edges(e)%obj%n)
end do
end select
@ -472,4 +477,31 @@ submodule(moduleMesh) boundaryParticle
end subroutine boundariesParticle_update
module subroutine boundariesParticle_write()
use moduleCaseparam, only: timeStep
use moduleOutput, only:fileID_boundaryParticle, formatFileName, informFileCreation
implicit none
integer:: b
character(:), allocatable:: fileName
if (boundaryParticleOutput) then
fileName = formatFileName(prefix, 'boundariesParticle', 'csv', timeStep)
call informFileCreation(fileName)
open(fileID_boundaryParticle, file = path // folder // '/' // fileName)
do b = 1, nBoundariesParticle
if (associated(boundariesParticle(b)%obj%print)) then
call boundariesParticle(b)%obj%print(fileID_boundaryParticle)
end if
end do
close(fileID_boundaryParticle)
end if
end subroutine boundariesParticle_write
end submodule boundaryParticle

View file

@ -208,7 +208,7 @@ MODULE moduleProbe
WRITE(pstring, "(I3.3)") self%id
fileName='Probe_' // tstring// '_f_' // pstring // '.dat'
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (10, file = path // folder // '/' // fileName)
OPEN (10, file = generateFilePath(fileName))
WRITE(10, "(A1, 1X, A)") "# ", self%species%name
WRITE(10, "(A6, 3(ES15.6E3), A2)") "# r = ", self%r(:)*L_ref, " m"
WRITE(10, "(A6, ES15.6E3, A2)") "# t = ", REAL(timeStep)*tauMin*ti_ref, " s"
@ -216,7 +216,7 @@ MODULE moduleProbe
DO i = 1, self%nv(1)
DO j = 1, self%nv(2)
DO k = 1, self%nv(3)
WRITE(10, "(4(ES20.6E3))") self%vi(i)*v_ref, &
WRITE(10, "(4("//fmtReal//"))") self%vi(i)*v_ref, &
self%vj(j)*v_ref, &
self%vk(k)*v_ref, &
self%f(i, j, k)

View file

@ -1,6 +1,40 @@
!Contains information about output
MODULE moduleOutput
IMPLICIT NONE
! Path and folder for the output
CHARACTER(:), ALLOCATABLE:: path
CHARACTER(:), ALLOCATABLE:: folder
! Number of digits for step files
INTEGER:: iterationDigits
CHARACTER(:), ALLOCATABLE:: iterationFormat
! Triggers and counters for output
INTEGER:: triggerOutput, counterOutput = 0
INTEGER:: triggerCPUTime, counterCPUTime = 0
! logicals to activate file output
LOGICAL:: timeOutput = .FALSE.
LOGICAL:: collOutput = .FALSE.
LOGICAL:: emOutput = .FALSE.
logical:: boundaryParticleOutput = .false.
! Prefix for iteration files
character(len=*), parameter:: prefix = 'Step'
! Column separator
character(len=*), parameter:: colSep = '","'
! General format for file outputs
character(len=*), parameter:: fmtColReal = 'ES0.6E3,:,'//colSep ! Column with real
character(len=*), parameter:: fmtColInt = 'I0,:,'//colSep ! Column with integer
character(len=*), parameter:: fmtColStr = 'A,:,'//colSep ! Column with text
character(len=*), parameter:: fmtReal = 'ES14.6E3' ! Fixed size real
character(len=*), parameter:: fmtInt = 'I14' ! Fixed size real
! File IDs for different input/output
integer, parameter:: fileID_mesh = 10 ! Base id for mesh files
integer, parameter:: fileID_output = 20 ! Base id for species/collisions/EM output
integer, parameter:: fileID_boundaryParticle = 30 ! Particle boundaries
integer, parameter:: fileID_boundaryEM = 31 ! EM boundaries
integer, parameter:: fileID_reference = 40 ! Reference values
integer, parameter:: fileID_time =50 ! Computation time
!Output for each node
TYPE, PUBLIC:: outputNode
@ -33,17 +67,68 @@ MODULE moduleOutput
END TYPE
CHARACTER(:), ALLOCATABLE:: path
CHARACTER(:), ALLOCATABLE:: folder
INTEGER:: iterationDigits
CHARACTER(:), ALLOCATABLE:: iterationFormat
INTEGER:: triggerOutput, counterOutput = 0
INTEGER:: triggerCPUTime, counterCPUTime = 0
LOGICAL:: timeOutput = .FALSE.
LOGICAL:: collOutput = .FALSE.
LOGICAL:: emOutput = .FALSE.
CONTAINS
PURE FUNCTION formatFileName(pref, suff, extension, timeStep) RESULT(fileName)
IMPLICIT NONE
CHARACTER(*), INTENT(in):: pref, suff, extension
INTEGER, INTENT(in), OPTIONAL:: timeStep
CHARACTER (LEN=iterationDigits):: tString
CHARACTER(:), ALLOCATABLE:: fileName
IF (PRESENT(timeStep)) THEN
WRITE(tString, iterationFormat) timeStep
fileName = pref // '_' // tString // '_' // suff // '.' // extension
ELSE
fileName = pref // '_' // suff // '.' // extension
END IF
END FUNCTION formatFileName
subroutine createOutputFolder()
implicit none
call execute_command_line('mkdir ' // path // folder )
end subroutine createOutputFolder
subroutine copyFileToOutput(fileName)
implicit none
character(*), intent(in):: fileName
call execute_command_line('cp ' // fileName // ' ' // path // folder)
end subroutine copyFileToOutput
subroutine writeCommit()
implicit none
call system('git rev-parse HEAD > ' // path // folder // '/' // 'fpakc_commit.txt')
end subroutine writeCommit
pure function generateFilePath(filename) result(completePath)
implicit none
character(*), intent(in):: fileName
character(:), allocatable:: completePath
completePath = path // folder // '/' // fileName
end function generateFilePath
subroutine informFileCreation(filename)
implicit none
character(*), intent(in):: fileName
write(*, "(6X,A15,A)") "Creating file: ", fileName
end subroutine informFileCreation
PURE SUBROUTINE outputNode_equal_outputNode(self, from)
IMPLICIT NONE
@ -159,7 +244,7 @@ MODULE moduleOutput
END SUBROUTINE calculateOutput
SUBROUTINE printTime(first)
SUBROUTINE writeTime(first)
USE moduleSpecies
USE moduleCompTime
USE moduleCaseParam, ONLY: timeStep
@ -168,31 +253,43 @@ MODULE moduleOutput
LOGICAL, INTENT(in), OPTIONAL:: first
CHARACTER(:), ALLOCATABLE:: fileName
fileName = 'cpuTime.dat'
fileName = 'cpuTime.csv'
IF (timeOutput) THEN
IF (PRESENT(first)) THEN
IF (first) THEN
OPEN(20, file = path // folder // '/' // fileName, action = 'write')
WRITE(20, "(A1, 8X, A1, 9X, A1, 7(A20))") "#","t","n","total (s)","push (s)","reset (s)", &
OPEN(fileID_time, file = generateFilePath(fileName), action = 'write')
WRITE(fileID_time, "(*("//fmtColStr//"))") "t","n","total (s)","push (s)","reset (s)", &
"collision (s)","coulomb (s)", &
"weighting (s)","EMField (s)"
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
CLOSE(20)
call informFileCreation(fileName)
CLOSE(fileID_time)
END IF
END IF
OPEN(20, file = path // folder // '/' // fileName, position = 'append', action = 'write')
OPEN(fileID_time, file = generateFilePath(fileName), position = 'append', action = 'write')
WRITE (20, "(I10, I10, 7(ES20.6E3))") timeStep, nPartOld, tStep, tPush, tReset, tColl, tCoul, tWeight, tEMField
WRITE (fileID_time, "(*("//fmtColInt//"),*("//fmtColReal//"))") timeStep, nPartOld, tStep, tPush, tReset, tColl, tCoul, tWeight, tEMField
CLOSE(20)
CLOSE(fileID_time)
END IF
END SUBROUTINE printTime
END SUBROUTINE writeTime
! Write file with reference values
subroutine writeReference()
use moduleRefParam
implicit none
open (fileID_reference, file=generateFilePath('reference.csv'))
write(fileID_reference, "(*("//fmtColStr//"))") '"L_ref"','"v_ref"','"ti_ref"','"Vol_ref"','"EF_ref"','"Volt_ref"','"B_ref"'
write(fileID_reference, "(*("//fmtColReal//"))") L_ref, v_ref, ti_ref, Vol_ref, EF_ref, Volt_ref, B_ref
close(fileID_reference)
end subroutine writeReference
END MODULE moduleOutput

View file

@ -523,8 +523,6 @@ MODULE moduleSolver
USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE
integer:: b ! TEMPORARY
CALL outputProbes()
counterOutput = counterOutput + 1
@ -537,6 +535,10 @@ MODULE moduleSolver
CALL mesh%printOutput()
IF (ASSOCIATED(meshForMCC)) CALL meshForMCC%printColl()
CALL mesh%printEM()
! Output of boundaries
call boundariesParticle_write()
WRITE(*, "(5X,A21,I10,A1,I10)") "t/tFinal: ", timeStep, "/", tFinal
WRITE(*, "(5X,A21,I10)") "Particles: ", nPartOld
IF (timeStep == 0) THEN
@ -553,17 +555,6 @@ MODULE moduleSolver
END IF
WRITE(*,*)
! TEMPORARY
! Output of boundaries. TODO: Move this to mesh module
do b = 1, nBoundariesParticle
if (associated(boundariesParticle(b)%obj%print)) then
print *, b
call boundariesParticle(b)%obj%print()
end if
end do
END IF
counterCPUTime = counterCPUTime + 1
@ -573,7 +564,7 @@ MODULE moduleSolver
!Reset CPU Time counter
counterCPUTime = 0
CALL printTime(timeStep == 0)
CALL writeTime(timeStep == 0)
END IF