Compare commits

..

No commits in common. "76be78c883918f767df598a3603023b1c8a6b85f" and "38d1d575cbd64310560a7f21ae7ffa6c318d6a9e" have entirely different histories.

20 changed files with 3195 additions and 3336 deletions

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

@ -1,49 +0,0 @@
{
"output": {
"path": "./runs/0D_Argon/",
"triggerOutput": 1,
"numColl": true,
"folder": "test"
},
"reference": {
"density": 1.0e16,
"mass": 6.633e-26,
"temperature": 11604.0,
"radius": 1.88e-10
},
"geometry": {
"dimension": 0,
"volume": 1e-11
},
"species": [
{"name": "Argon+", "type": "charged", "mass": 6.633e-26, "charge": 1.0, "weight": 1.0e0},
{"name": "Argon", "type": "neutral", "mass": 6.633e-26, "weight": 1.0e0}
],
"solver": {
"tau": [1.0e-3, 1.0e-3],
"finalTime": 1.0e0,
"initial": [
{"species": "Argon+", "file": "Argon+_Initial.dat"},
{"species": "Argon", "file": "Argon_Initial.dat"}
]
},
"interactions": {
"folderCollisions": "./data/collisions/",
"collisions": [
{"species_i": "Argon", "species_j": "Argon",
"cTypes": [
{"type": "elastic", "crossSection": "EL_Ar-Ar.dat"}
]},
{"species_i": "Argon+", "species_j": "Argon",
"cTypes": [
{"type": "elastic", "crossSection": "EL_Ar-Ar.dat"}
]}
]
},
"parallel": {
"OpenMP":{
"nThreads": 4
}
}
}

View file

@ -1,2 +0,0 @@
"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,6 +6,7 @@ OBJECTS = $(OBJDIR)/moduleMesh.o $(OBJDIR)/moduleMeshCommon.o $(OBJDIR)/moduleCo
$(OBJDIR)/moduleCollisions.o $(OBJDIR)/moduleTable.o $(OBJDIR)/moduleParallel.o \ $(OBJDIR)/moduleCollisions.o $(OBJDIR)/moduleTable.o $(OBJDIR)/moduleParallel.o \
$(OBJDIR)/moduleEM.o $(OBJDIR)/moduleRandom.o $(OBJDIR)/moduleMath.o \ $(OBJDIR)/moduleEM.o $(OBJDIR)/moduleRandom.o $(OBJDIR)/moduleMath.o \
$(OBJDIR)/moduleProbe.o $(OBJDIR)/moduleAverage.o $(OBJDIR)/moduleCoulomb.o \ $(OBJDIR)/moduleProbe.o $(OBJDIR)/moduleAverage.o $(OBJDIR)/moduleCoulomb.o \
$(OBJDIR)/moduleMeshInoutCommon.o \
$(OBJDIR)/moduleMeshInputVTU.o $(OBJDIR)/moduleMeshOutputVTU.o \ $(OBJDIR)/moduleMeshInputVTU.o $(OBJDIR)/moduleMeshOutputVTU.o \
$(OBJDIR)/moduleMeshInputGmsh2.o $(OBJDIR)/moduleMeshOutputGmsh2.o \ $(OBJDIR)/moduleMeshInputGmsh2.o $(OBJDIR)/moduleMeshOutputGmsh2.o \
$(OBJDIR)/moduleMeshInput0D.o $(OBJDIR)/moduleMeshOutput0D.o \ $(OBJDIR)/moduleMeshInput0D.o $(OBJDIR)/moduleMeshOutput0D.o \

View file

@ -1569,29 +1569,35 @@ MODULE moduleInput
END SUBROUTINE readParallel END SUBROUTINE readParallel
SUBROUTINE initOutput(inputFile) SUBROUTINE initOutput(inputFile)
USE moduleRefParam
USE moduleMesh, ONLY: mesh, doubleMesh, pathMeshParticle, pathMeshColl USE moduleMesh, ONLY: mesh, doubleMesh, pathMeshParticle, pathMeshColl
USE moduleOutput, ONLY: createOutputFolder, writeReference, copyFileToOutput, writeCommit USE moduleOutput, ONLY: path, folder
IMPLICIT NONE IMPLICIT NONE
CHARACTER(:), ALLOCATABLE, INTENT(in):: inputFile CHARACTER(:), ALLOCATABLE, INTENT(in):: inputFile
INTEGER:: fileReference = 30
!If everything is correct, creates the output folder !If everything is correct, creates the output folder
call createOutputFolder() CALL EXECUTE_COMMAND_LINE('mkdir ' // path // folder )
!Copies input file to output folder !Copies input file to output folder
call copyFileToOutput(inputFile) CALL EXECUTE_COMMAND_LINE('cp ' // inputFile // ' ' // path // folder)
!Copies particle mesh !Copies particle mesh
IF (mesh%dimen > 0) THEN IF (mesh%dimen > 0) THEN
call copyFileToOutput(pathMeshParticle) CALL EXECUTE_COMMAND_LINE('cp ' // pathMeshParticle // ' ' // path // folder)
IF (doubleMesh) THEN IF (doubleMesh) THEN
call copyFileToOutput(pathMeshColl) CALL EXECUTE_COMMAND_LINE('cp ' // pathMeshColl // ' ' // path // folder)
END IF END IF
END IF END IF
! Write commit of fpakc ! Write commit of fpakc
call writeCommit() CALL SYSTEM('git rev-parse HEAD > ' // path // folder // '/' // 'fpakc_commit.txt')
call writeReference() ! 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)
END SUBROUTINE initOutput END SUBROUTINE initOutput

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -404,21 +404,16 @@ submodule(moduleMesh) boundaryParticle
end subroutine quasiNeutrality_update end subroutine quasiNeutrality_update
subroutine quasiNeutrality_print(self, fileID) subroutine quasiNeutrality_print(self)
implicit none implicit none
class(boundaryParticleGeneric), intent(in):: self class(boundaryParticleGeneric), intent(inout):: self
integer, intent(in):: fileID
integer:: e print *, 'test'
write(fileID, '(A)') self%name
select type(self) select type(self)
type is(boundaryQuasiNeutrality) type is(boundaryQuasiNeutrality)
write(fileID, '(A,",",A)') '"Edge id"', '"alpha"' print*, self%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 end select
@ -477,31 +472,4 @@ submodule(moduleMesh) boundaryParticle
end subroutine boundariesParticle_update 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 end submodule boundaryParticle

View file

@ -1,39 +1,6 @@
!Contains information about output !Contains information about output
MODULE moduleOutput MODULE moduleOutput
! Path and folder for the output IMPLICIT NONE
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
!Output for each node !Output for each node
TYPE, PUBLIC:: outputNode TYPE, PUBLIC:: outputNode
@ -66,68 +33,17 @@ MODULE moduleOutput
END TYPE 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 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) PURE SUBROUTINE outputNode_equal_outputNode(self, from)
IMPLICIT NONE IMPLICIT NONE
@ -261,7 +177,7 @@ MODULE moduleOutput
WRITE(20, "(A1, 8X, A1, 9X, A1, 7(A20))") "#","t","n","total (s)","push (s)","reset (s)", & WRITE(20, "(A1, 8X, A1, 9X, A1, 7(A20))") "#","t","n","total (s)","push (s)","reset (s)", &
"collision (s)","coulomb (s)", & "collision (s)","coulomb (s)", &
"weighting (s)","EMField (s)" "weighting (s)","EMField (s)"
call informFileCreation(fileName) WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
CLOSE(20) CLOSE(20)
END IF END IF
@ -278,17 +194,5 @@ MODULE moduleOutput
END SUBROUTINE printTime END SUBROUTINE printTime
! 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 END MODULE moduleOutput

View file

@ -523,6 +523,8 @@ MODULE moduleSolver
USE moduleCaseParam, ONLY: timeStep USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE IMPLICIT NONE
integer:: b ! TEMPORARY
CALL outputProbes() CALL outputProbes()
counterOutput = counterOutput + 1 counterOutput = counterOutput + 1
@ -535,10 +537,6 @@ MODULE moduleSolver
CALL mesh%printOutput() CALL mesh%printOutput()
IF (ASSOCIATED(meshForMCC)) CALL meshForMCC%printColl() IF (ASSOCIATED(meshForMCC)) CALL meshForMCC%printColl()
CALL mesh%printEM() CALL mesh%printEM()
! Output of boundaries. TODO: Add an if
call boundariesParticle_write()
WRITE(*, "(5X,A21,I10,A1,I10)") "t/tFinal: ", timeStep, "/", tFinal WRITE(*, "(5X,A21,I10,A1,I10)") "t/tFinal: ", timeStep, "/", tFinal
WRITE(*, "(5X,A21,I10)") "Particles: ", nPartOld WRITE(*, "(5X,A21,I10)") "Particles: ", nPartOld
IF (timeStep == 0) THEN IF (timeStep == 0) THEN
@ -555,6 +553,17 @@ MODULE moduleSolver
END IF END IF
WRITE(*,*) 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 END IF
counterCPUTime = counterCPUTime + 1 counterCPUTime = counterCPUTime + 1