Fixed 0D case, reference. Put everything in the moduleOutput
This commit is contained in:
parent
0109dc2f06
commit
76be78c883
12 changed files with 3188 additions and 3095 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
1002
runs/0D_Argon/output/Output_Argon+.csv
Normal file
1002
runs/0D_Argon/output/Output_Argon+.csv
Normal file
File diff suppressed because it is too large
Load diff
1002
runs/0D_Argon/output/Output_Argon.csv
Normal file
1002
runs/0D_Argon/output/Output_Argon.csv
Normal file
File diff suppressed because it is too large
Load diff
1002
runs/0D_Argon/output/Output_Collisions.csv
Normal file
1002
runs/0D_Argon/output/Output_Collisions.csv
Normal file
File diff suppressed because it is too large
Load diff
49
runs/0D_Argon/output/input.json
Normal file
49
runs/0D_Argon/output/input.json
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
runs/0D_Argon/output/reference.csv
Normal file
2
runs/0D_Argon/output/reference.csv
Normal 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
|
||||||
|
|
|
@ -1569,35 +1569,29 @@ 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: path, folder
|
USE moduleOutput, ONLY: createOutputFolder, writeReference, copyFileToOutput, writeCommit
|
||||||
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 EXECUTE_COMMAND_LINE('mkdir ' // path // folder )
|
call createOutputFolder()
|
||||||
!Copies input file to output folder
|
!Copies input file to output folder
|
||||||
CALL EXECUTE_COMMAND_LINE('cp ' // inputFile // ' ' // path // folder)
|
call copyFileToOutput(inputFile)
|
||||||
!Copies particle mesh
|
!Copies particle mesh
|
||||||
IF (mesh%dimen > 0) THEN
|
IF (mesh%dimen > 0) THEN
|
||||||
CALL EXECUTE_COMMAND_LINE('cp ' // pathMeshParticle // ' ' // path // folder)
|
call copyFileToOutput(pathMeshParticle)
|
||||||
IF (doubleMesh) THEN
|
IF (doubleMesh) THEN
|
||||||
CALL EXECUTE_COMMAND_LINE('cp ' // pathMeshColl // ' ' // path // folder)
|
call copyFileToOutput(pathMeshColl)
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
! Write commit of fpakc
|
! Write commit of fpakc
|
||||||
CALL SYSTEM('git rev-parse HEAD > ' // path // folder // '/' // 'fpakc_commit.txt')
|
call writeCommit()
|
||||||
|
|
||||||
! Write file with reference values
|
call writeReference()
|
||||||
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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,18 +50,24 @@ 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='OUTPUT_Collisions.dat'
|
fileName = formatFileName('Output', 'Collisions', 'csv')
|
||||||
IF (timeStep == tInitial) THEN
|
IF (timeStep == tInitial) THEN
|
||||||
OPEN(20, file = generateFilePath(fileName), action = 'write')
|
OPEN(20, file = generateFilePath(fileName), action = 'write')
|
||||||
WRITE(20, "(A1, 14X, A5, A20)") "#","t (s)","collisions"
|
|
||||||
call informFileCreation(fileName)
|
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)
|
CLOSE(20)
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
OPEN(20, file = generateFilePath(fileName), position = 'append', action = 'write')
|
OPEN(20, file = generateFilePath(fileName), position = 'append', action = 'write')
|
||||||
WRITE(20, "("//fmtReal//", 10I20)") REAL(timeStep)*tauMin*ti_ref, (self%cells(1)%obj%tallyColl(k)%tally, k=1,nCollPairs)
|
WRITE(20, "("//fmtColReal//", *("//fmtColInt//"))") 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
|
||||||
|
|
|
||||||
|
|
@ -485,6 +485,7 @@ submodule(moduleMesh) boundaryParticle
|
||||||
integer:: b
|
integer:: b
|
||||||
character(:), allocatable:: fileName
|
character(:), allocatable:: fileName
|
||||||
|
|
||||||
|
if (boundaryParticleOutput) then
|
||||||
fileName = formatFileName(prefix, 'boundariesParticle', 'csv', timeStep)
|
fileName = formatFileName(prefix, 'boundariesParticle', 'csv', timeStep)
|
||||||
call informFileCreation(fileName)
|
call informFileCreation(fileName)
|
||||||
open(fileID_boundaryParticle, file = path // folder // '/' // fileName)
|
open(fileID_boundaryParticle, file = path // folder // '/' // fileName)
|
||||||
|
|
@ -499,6 +500,8 @@ submodule(moduleMesh) boundaryParticle
|
||||||
|
|
||||||
close(fileID_boundaryParticle)
|
close(fileID_boundaryParticle)
|
||||||
|
|
||||||
|
end if
|
||||||
|
|
||||||
end subroutine boundariesParticle_write
|
end subroutine boundariesParticle_write
|
||||||
|
|
||||||
end submodule boundaryParticle
|
end submodule boundaryParticle
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,39 @@
|
||||||
!Contains information about output
|
!Contains information about output
|
||||||
MODULE moduleOutput
|
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
|
||||||
|
|
||||||
!Output for each node
|
!Output for each node
|
||||||
TYPE, PUBLIC:: outputNode
|
TYPE, PUBLIC:: outputNode
|
||||||
|
|
@ -33,36 +66,68 @@ 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.
|
|
||||||
|
|
||||||
! 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
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
@ -213,43 +278,17 @@ MODULE moduleOutput
|
||||||
|
|
||||||
END SUBROUTINE printTime
|
END SUBROUTINE printTime
|
||||||
|
|
||||||
PURE FUNCTION formatFileName(pref, suff, extension, timeStep) RESULT(fileName)
|
! Write file with reference values
|
||||||
IMPLICIT NONE
|
subroutine writeReference()
|
||||||
|
use moduleRefParam
|
||||||
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
|
|
||||||
|
|
||||||
pure function generateFilePath(filename) result(completePath)
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
character(*), intent(in):: fileName
|
open (fileID_reference, file=generateFilePath('reference.csv'))
|
||||||
character(:), allocatable:: completePath
|
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)
|
||||||
|
|
||||||
completePath = path // folder // '/' // fileName
|
end subroutine writeReference
|
||||||
|
|
||||||
end function generateFilePath
|
|
||||||
|
|
||||||
subroutine informFileCreation(filename)
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
character(*), intent(in):: fileName
|
|
||||||
|
|
||||||
write(*, "(6X,A15,A)") "Creating file: ", fileName
|
|
||||||
|
|
||||||
end subroutine informFileCreation
|
|
||||||
|
|
||||||
END MODULE moduleOutput
|
END MODULE moduleOutput
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue