From 555ebd6771c8f7111b6f5a6a9289b1c1a24fb272 Mon Sep 17 00:00:00 2001 From: JGonzalez Date: Tue, 31 Mar 2026 18:37:23 +0200 Subject: [PATCH 1/2] Obtain quasi-neutrality by changing the injection flow From d3f1f0808e3cdffc1b9b365239c70fbb23da2bac Mon Sep 17 00:00:00 2001 From: JGonzalez Date: Tue, 31 Mar 2026 19:21:03 +0200 Subject: [PATCH 2/2] Skeleton for new injection type --- src/fpakc.f90 | 3 +++ src/modules/init/moduleInput.f90 | 8 +++++++- src/modules/moduleInject.f90 | 28 +++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/fpakc.f90 b/src/fpakc.f90 index 921d4ac..48c3657 100644 --- a/src/fpakc.f90 +++ b/src/fpakc.f90 @@ -71,6 +71,9 @@ PROGRAM fpakc ! Update EM boundary models call boundariesEM_update() + ! Update injects + call updateInjects + !Checks if a species needs to me moved in this iteration CALL solver%updatePushSpecies() diff --git a/src/modules/init/moduleInput.f90 b/src/modules/init/moduleInput.f90 index 8b7aaff..4f4abae 100644 --- a/src/modules/init/moduleInput.f90 +++ b/src/modules/init/moduleInput.f90 @@ -1432,6 +1432,7 @@ MODULE moduleInput REAL(8), ALLOCATABLE:: temperature(:), normal(:) REAL(8):: flow CHARACTER(:), ALLOCATABLE:: units + character(:), allocatable:: type INTEGER:: physicalSurface INTEGER:: particlesPerEdge INTEGER:: sp @@ -1457,11 +1458,16 @@ MODULE moduleInput END IF CALL config%get(object // '.flow', flow, found) CALL config%get(object // '.units', units, found) + CALL config%get(object // '.type', type, found) + if (.not. found) then + ! If no type is found, assume constant injection of particles + type = 'constant' + end if CALL config%get(object // '.physicalSurface', physicalSurface, found) particlesPerEdge = 0 CALL config%get(object // '.particlesPerEdge', particlesPerEdge, found) - CALL inject(i)%init(i, v, normal, temperature, flow, units, sp, physicalSurface, particlesPerEdge) + CALL inject(i)%init(i, v, normal, temperature, flow, units, type, sp, physicalSurface, particlesPerEdge) CALL readVelDistr(config, inject(i), object) diff --git a/src/modules/moduleInject.f90 b/src/modules/moduleInject.f90 index d22258a..1b64e67 100644 --- a/src/modules/moduleInject.f90 +++ b/src/modules/moduleInject.f90 @@ -14,6 +14,7 @@ MODULE moduleInject LOGICAL:: fixDirection !The injection of particles has a fix direction defined by n INTEGER:: nParticles !Number of particles to introduce each time step CLASS(speciesGeneric), POINTER:: species !Species of injection + character(:), allocatable:: type INTEGER:: nEdges type(meshEdgePointer), allocatable:: edges(:) INTEGER, ALLOCATABLE:: particlesPerEdge(:) ! Particles per edge @@ -31,7 +32,7 @@ MODULE moduleInject CONTAINS !Initialize an injection of particles - SUBROUTINE initInject(self, i, v, n, temperature, flow, units, sp, ps, particlesPerEdge) + SUBROUTINE initInject(self, i, v, n, temperature, flow, units, type, sp, ps, particlesPerEdge) USE moduleMesh USE moduleRefParam USE moduleConstParam @@ -48,6 +49,7 @@ MODULE moduleInject REAL(8):: tauInject REAL(8), INTENT(in):: flow CHARACTER(:), ALLOCATABLE, INTENT(in):: units + character(:), allocatable, intent(in):: type INTEGER:: e REAL(8):: fluxPerStep = 0.D0 @@ -143,6 +145,14 @@ MODULE moduleInject !Scale particles for different species steps IF (self%nParticles == 0) CALL criticalError("The number of particles for inject is 0.", 'initInject') + ! Assign type to inject + select case(type) + case ('constant', 'quasiNeutral') + self%type = type + case default + call criticalError('No injection type ' // type // ' defined', 'initInject') + end select + END SUBROUTINE initInject !Injection of particles @@ -176,6 +186,22 @@ MODULE moduleInject END SUBROUTINE doInjects + ! Update the value of injects + subroutine updateInjects() + implicit none + + integer:: i + + do i = 1, nInject + select case(inject(i)%type) + case ('quasiNeutral') + print*, "Calculating quasi-neutrality" + + end select + end do + + end subroutine updateInjects + SUBROUTINE initVelDistMaxwellian(velDist, temperature, m) IMPLICIT NONE