From a1f94c1e4d8ae8d39aef9bec308d3d4f785415a4 Mon Sep 17 00:00:00 2001 From: JGonzalez Date: Wed, 8 Apr 2026 20:17:49 +0200 Subject: [PATCH] Adjusted initial condition, dimensions of output, and output file header --- src/modules/mesh/moduleMesh@boundaryEM.f90 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/mesh/moduleMesh@boundaryEM.f90 b/src/modules/mesh/moduleMesh@boundaryEM.f90 index 43202b4..c43dd8e 100644 --- a/src/modules/mesh/moduleMesh@boundaryEM.f90 +++ b/src/modules/mesh/moduleMesh@boundaryEM.f90 @@ -159,7 +159,7 @@ submodule(moduleMesh) boundaryEM ! Inverse of non-dimensional capacitance self%invC = 1.0d0 / (capacitance / (eps_0 * L_ref)) - self%charge = 0.0d0 + self%charge = self%potential / self%invC self%update => updateFloating @@ -222,6 +222,9 @@ submodule(moduleMesh) boundaryEM end do mom_center = edge%gatherF(edge%centerXi(), edge%nNodes, mom_nodes) + + ! Only account for charge exiting the surface + mom_center = max(mom_center, 0.0d0) edgeDensityCurrent = edgeDensityCurrent + qSpecies(s) * mom_center @@ -242,7 +245,7 @@ submodule(moduleMesh) boundaryEM subroutine writeFloating(self, fileID) use moduleOutput, only: fmtColReal use moduleConstParam, only: qe - use moduleRefParam, only: Volt_ref + use moduleRefParam, only: Volt_ref, v_ref, n_ref, L_ref, ti_ref implicit none class(boundaryEMGeneric), intent(inout):: self @@ -251,8 +254,8 @@ submodule(moduleMesh) boundaryEM write(fileID, '(A)') self%name select type(self) type is(boundaryEMFloating) - write(fileID, '(A,",",A)') 'Total charge', 'Potential (V)' - write(fileID, '('//fmtColReal//','//fmtColReal//')') self%charge * qe, self%potential * Volt_ref + write(fileID, '(A,",",A)') 'Total charge (C)', 'Potential (V)' + write(fileID, '(*('//fmtColReal//'))') self%charge*qe*v_ref*n_ref*L_ref**2*ti_ref, self%potential * Volt_ref end select