diff --git a/doc/user-manual/fpakc_UserManual.tex b/doc/user-manual/fpakc_UserManual.tex index 5368d1c..c43fb65 100644 --- a/doc/user-manual/fpakc_UserManual.tex +++ b/doc/user-manual/fpakc_UserManual.tex @@ -629,7 +629,8 @@ make \item \textbf{floating}: The potential is adjusted over time to maintain a zero current on the surface, \textit{i. e.}, the surface is \textit{floating}. \textbf{potential}: Real. - Potential for Dirichlet boundary condition. + Initial potential of the surface. + The initial charge value for the simulation will be calculated by the potential times the capacitance. \textbf{capacitance}: Real. Capacitance of the surface in Farads. 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