Calculating current in node. Maybe it should be on edge. Need to check.

This commit is contained in:
Jorge Gonzalez 2026-04-07 12:28:29 +02:00
commit 40163a0056
2 changed files with 37 additions and 0 deletions

View file

@ -1361,6 +1361,16 @@ MODULE moduleInput
end do
type is(boundaryEMFloating)
! Loop over all physical surfaces
do ps = 1, nPhysicalSurfaces
! If the boundary for the species is linked to the one analysing, add the edges
if (associated(physicalSurfaces(ps)%EM, bound)) then
bound%nodes = [bound%nodes, physicalSurfaces(ps)%nodes]
end if
end do
end select
bound%nNodes = size(bound%nodes)

View file

@ -173,9 +173,36 @@ submodule(moduleMesh) boundaryEM
! Update
subroutine updateFloating(self)
use moduleMesh, only: qSpecies, meshNode
implicit none
class(boundaryEMGeneric), intent(inout):: self
integer:: n, s
integer, allocatable:: nodes(:)
class(meshNode), pointer:: node
real(8):: momNode, momNodeTotal, totalCurrent
totalCurrent = 0.0d0
select type(self)
type is(boundaryEMFloating)
do n = 1, self%nNodes
momNodeTotal = 0.0d0
node => self%nodes(n)%obj
do s = 1, nSpecies
print *, s, node%output(s)%mom
momNode = norm2(node%output(s)%mom)
momNodeTotal = momNodeTotal + qSpecies(s) * momNode
end do
totalCurrent = totalCurrent + momNodeTotal
end do
print *, totalCurrent
end select