diff --git a/src/modules/mesh/inout/text/moduleMeshOutputText.f90 b/src/modules/mesh/inout/text/moduleMeshOutputText.f90 index e5ac44d..fb067c3 100644 --- a/src/modules/mesh/inout/text/moduleMeshOutputText.f90 +++ b/src/modules/mesh/inout/text/moduleMeshOutputText.f90 @@ -22,7 +22,6 @@ module moduleMeshOutputText end do - end subroutine writeSpeciesOutput subroutine writeCollOutput(self, fileID) @@ -37,11 +36,35 @@ module moduleMeshOutputText subroutine writeEMOutput(self, fileID) use moduleMesh - use moduleRefParam + use moduleRefParam, only: L_ref, Volt_ref, B_ref, EF_ref implicit none class(meshParticles), intent(in):: self 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 @@ -64,7 +87,10 @@ module moduleMeshOutputText write(*, "(6X,A15,A)") "Creating file: ", fileName open (fileID, file = path // folder // '/' // fileName) - write(fileID, '(5(A,","),A)') 'Position (m)', 'Density (m^-3)', 'Velocity:1 (m s^-1)', 'Velocity:2 (m s^-1)', 'Velocity:3 (m s^-1)', 'Temperature (K)' + 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) @@ -76,17 +102,53 @@ module moduleMeshOutputText subroutine printCollText(self) use moduleMesh + use moduleOutput + use moduleMeshInoutCommon + use moduleCaseParam, only: timeStep implicit none 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 subroutine printEMText(self) use moduleMesh + use moduleMeshInoutCommon + use moduleCaseParam, only: timeStep implicit none 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