Compare commits

..

2 commits

Author SHA1 Message Date
8c8c6409f6 Output for EM
The output for the EM field properties is done.
2026-01-23 12:16:52 +01:00
27158c7c1d Output for species
First output done. Now it is mostly Copy Paste.

There are so many things I need to reform in other parts... Learning new things is awful.
2026-01-22 18:44:25 +01:00
2 changed files with 98 additions and 2 deletions

View file

@ -4,11 +4,23 @@ module moduleMeshOutputText
subroutine writeSpeciesOutput(self, fileID, speciesIndex) subroutine writeSpeciesOutput(self, fileID, speciesIndex)
use moduleMesh use moduleMesh
use moduleOutput use moduleOutput
use moduleRefParam, only: L_ref
implicit none implicit none
class(meshParticles), INTENT(in):: self class(meshParticles), INTENT(in):: self
integer, intent(in):: fileID integer, intent(in):: fileID
integer, intent(in):: speciesIndex integer, intent(in):: speciesIndex
type(outputFormat):: output
real(8):: r(1:3)
integer:: n
do n = 1, self%numNodes
call calculateOutput(self%nodes(n)%obj%output(speciesIndex), output, self%nodes(n)%obj%v, species(speciesIndex)%obj)
r = self%nodes(n)%obj%getCoordinates()
write(fileID, '(5(ES0.6E3,","),ES0.6E3)') r(1)*L_ref, output%density, output%velocity, output%temperature
end do
end subroutine writeSpeciesOutput end subroutine writeSpeciesOutput
@ -24,35 +36,119 @@ module moduleMeshOutputText
subroutine writeEMOutput(self, fileID) subroutine writeEMOutput(self, fileID)
use moduleMesh use moduleMesh
use moduleRefParam use moduleRefParam, only: L_ref, Volt_ref, B_ref, EF_ref
implicit none implicit none
class(meshParticles), intent(in):: self class(meshParticles), intent(in):: self
integer, intent(in):: fileID integer, intent(in):: fileID
integer:: n, c
real(8):: r(1:3), Xi(1:3)
do n = 1, self%numNodes
r = self%nodes(n)%obj%getCoordinates()
if (n == self%numNodes) then
Xi = (/ 1.D0, 0.D0, 0.D0 /)
c = self%numNodes - 1
else
Xi = (/ 0.D0, 0.D0, 0.D0 /)
c = n
end if
associate(output => self%nodes(n)%obj%emData)
write(fileID, '(7(ES0.6E3,","),ES0.6E3)') r(1)*L_ref, &
output%phi*Volt_ref, &
self%cells(c)%obj%gatherElectricField(Xi)*EF_ref, &
output%B*B_ref
end associate
end do
end subroutine writeEMOutput end subroutine writeEMOutput
subroutine printOutputText(self) subroutine printOutputText(self)
use moduleMesh use moduleMesh
use moduleSpecies
use moduleMeshInoutCommon
use moduleCaseParam, ONLY: timeStep
implicit none implicit none
class(meshParticles), intent(in):: self class(meshParticles), intent(in):: self
INTEGER:: s, fileID
character(:), allocatable:: fileName
fileID = 60
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)
write(fileID, '(5(A,","),A)') 'Position (m)', &
'Density (m^-3)', &
'Velocity (m s^-1):0', 'Velocity (m s^-1):1', 'Velocity (m s^-1):2', &
'Temperature (K)'
call writeSpeciesOutput(self, fileID, s)
close(fileID)
end do
end subroutine printOutputText end subroutine printOutputText
subroutine printCollText(self) subroutine printCollText(self)
use moduleMesh use moduleMesh
use moduleOutput
use moduleMeshInoutCommon
use moduleCaseParam, only: timeStep
implicit none implicit none
class(meshGeneric), intent(in):: self class(meshGeneric), intent(in):: self
integer:: fileID
character(:), allocatable:: fileName
fileID = 62
if (collOutput) then
fileName = formatFileName(prefix, 'Collisions', 'csv', timeStep)
write(*, "(6X,A15,A)") "Creating file: ", fileName
open (fileID, file = path // folder // '/' // fileName)
end if
end subroutine printCollText end subroutine printCollText
subroutine printEMText(self) subroutine printEMText(self)
use moduleMesh use moduleMesh
use moduleMeshInoutCommon
use moduleCaseParam, only: timeStep
implicit none implicit none
class(meshParticles), intent(in):: self class(meshParticles), intent(in):: self
integer:: fileID
character(:), allocatable:: fileName
fileID = 64
if (emOutput) then
fileName = formatFileName(prefix, 'EMField', 'csv', timeStep)
write(*, "(6X,A15,A)") "Creating file: ", fileName
open (fileID, file = path // folder // '/' // fileName)
write(fileID, '(8(A,","),A)') 'Position (m)', &
'Potential (V)', &
'Electric Field (V m^-1):0', 'Electric Field (V m^-1):1', 'Electric Field (V m^-1):2', &
'Magnetic Field (T):0', 'Magnetic Field (T):1', 'Magnetic Field (T):2'
call writeEMOutput(self, fileID)
close(fileID)
end if
end subroutine printEMText end subroutine printEMText

View file

@ -11,7 +11,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,ES20.6E3,A)") '<UnstructuredGrid>' WRITE(fileID,"(4X, A)") '<UnstructuredGrid>'
WRITE(fileID,"(6X, A, I10, A, I10, 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