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

@ -257,8 +257,8 @@ MODULE moduleMesh
PROCEDURE(detJac_interface), DEFERRED, NOPASS:: detJac
PROCEDURE(invJac_interface), DEFERRED, NOPASS:: invJac
!Procedures to get specific values in the node
PROCEDURE(gatherArray_interface), DEFERRED, PASS:: gatherElectricField
PROCEDURE(gatherArray_interface), DEFERRED, PASS:: gatherMagneticField
PROCEDURE(gatherCellArray_interface), DEFERRED, PASS:: gatherElectricField
PROCEDURE(gatherCellArray_interface), DEFERRED, PASS:: gatherMagneticField
!Compute K and F to solve PDE on the mesh
PROCEDURE(elemK_interface), DEFERRED, PASS:: elemK
PROCEDURE(elemF_interface), DEFERRED, PASS:: elemF
@ -390,13 +390,13 @@ MODULE moduleMesh
END FUNCTION invJac_interface
PURE FUNCTION gatherArray_interface(self, Xi) RESULT(array)
PURE FUNCTION gatherCellArray_interface(self, Xi) RESULT(array)
IMPORT:: meshCell
CLASS(meshCell), INTENT(in):: self
REAL(8), INTENT(in):: Xi(1:3)
REAL(8):: array(1:3)
END FUNCTION gatherArray_interface
END FUNCTION gatherCellArray_interface
PURE FUNCTION elemK_interface(self, nNodes) RESULT(localK)
IMPORT:: meshCell
@ -650,6 +650,7 @@ MODULE moduleMesh
type, abstract, public:: boundaryParticleGeneric
integer:: n
character(:), allocatable:: name
procedure(updateParticle_interface), pointer, pass:: update => null()
contains
procedure(applyParticle_interface), deferred, pass:: apply
@ -698,6 +699,14 @@ MODULE moduleMesh
end subroutine
! Update the values of the particle boundary model
subroutine updateParticle_interface(self)
import boundaryParticleGeneric
class(boundaryParticleGeneric), intent(inout):: self
end subroutine updateParticle_interface
end interface
!Reflecting boundary
@ -754,6 +763,7 @@ MODULE moduleMesh
! Ensures quasi-neutrality by changing the reflection coefficient
type, public, extends(boundaryParticleGeneric):: boundaryQuasiNeutrality
real(8):: alpha ! Reflection parameter
integer:: s_incident ! species index of the incident species
type(meshEdgePointer), allocatable:: edges(:) !Array with edges
contains
procedure, pass:: apply => quasiNeutrality
@ -867,6 +877,14 @@ MODULE moduleMesh
!Array for boundaries
type(boundaryParticleCont), allocatable, target:: boundariesParticle(:)
! Update the particle boundary models
interface
module subroutine boundariesParticle_update()
end subroutine boundariesParticle_update
end interface
! BOUNDARY ELECTROMAGNETIC DEFINITIONS
! Generic type for electromagnetic boundary conditions
type, public, abstract:: boundaryEMGeneric
@ -918,11 +936,11 @@ MODULE moduleMesh
end subroutine applyEM_interface
! Update the values of the boundary condition
! Update the values of the EM boundary model
subroutine updateEM_interface(self)
import boundaryEMGeneric
class(boundaryEMGeneric), intent(in):: self
class(boundaryEMGeneric), intent(inout):: self
end subroutine updateEM_interface
@ -939,6 +957,7 @@ MODULE moduleMesh
TYPE, EXTENDS(boundaryEMGeneric):: boundaryEMDirichletTime
real(8):: potential
real(8):: timeFactor
type(table1D):: temporalProfile
contains
! boundaryEMGeneric DEFERRED PROCEDURES
@ -973,6 +992,14 @@ MODULE moduleMesh
!Information of charge and reference parameters for rho vector
REAL(8), ALLOCATABLE:: qSpecies(:)
! Update the EM boundary models
interface
module subroutine boundariesEM_update()
end subroutine boundariesEM_update
end interface
! PHYSICAL SURFACES LINKING TO MESH ELEMENTS
! Link physical surface to edges
type:: physicalSurface