Boundaries (EM and particles) can now be updated at every iteration

This commit is contained in:
Jorge Gonzalez 2026-03-06 20:00:46 +01:00
commit ecb1364d6a
5 changed files with 115 additions and 34 deletions

View file

@ -107,6 +107,8 @@ submodule(moduleMesh) boundaryParticle
boundary%alpha = 0.d0
allocate(boundary%edges(0))
boundary%update => quasiNeutrality_update
end select
end subroutine initQuasiNeutrality
@ -328,24 +330,10 @@ submodule(moduleMesh) boundaryParticle
implicit none
class(boundaryQuasiNeutrality), intent(in):: self
class(meshEdge), intent(inout):: edge
class(particle), intent(inout):: part
real(8), allocatable:: density(:)
class(meshCell), pointer:: cell
real(8):: EF_dir
real(8):: alpha
class(meshEdge), intent(inout):: edge
class(particle), intent(inout):: part
alpha = 0.85d0
if (associated(edge%e1)) then
cell => edge%e1
else
cell => edge%e2
end if
if (random() <= alpha) then
if (random() <= self%alpha) then
call genericReflection(edge, part)
else
@ -355,14 +343,29 @@ submodule(moduleMesh) boundaryParticle
end subroutine quasiNeutrality
subroutine quasiNeutrality_update(self)
implicit none
class(boundaryParticleGeneric), intent(inout):: self
select type(self)
type is(boundaryQuasiNeutrality)
self%alpha = 0.1d0
print *, self%alpha
end select
end subroutine quasiNeutrality_update
! Generic boundary conditions for internal use
module subroutine genericReflection(edge, part)
use moduleCaseParam
use moduleSpecies
implicit none
class(meshEdge), intent(inout):: edge
class(particle), intent(inout):: part
class(meshEdge), intent(inout):: edge
class(particle), intent(inout):: part
!rp = intersection between particle and edge
!rpp = final position of particle
!vpp = final velocity of particle
@ -393,4 +396,19 @@ submodule(moduleMesh) boundaryParticle
end subroutine genericTransparent
module subroutine boundariesParticle_update()
implicit none
integer:: b
do b = 1, nBoundariesParticle
if (associated(boundariesParticle(b)%obj%update)) then
call boundariesParticle(b)%obj%update
end if
end do
end subroutine boundariesParticle_update
end submodule boundaryParticle