Skeleton of boundaries for EM with new structure for mesh

This commit is contained in:
Jorge Gonzalez 2026-02-17 14:54:22 +01:00
commit 6a7c92f62f
5 changed files with 269 additions and 224 deletions

View file

@ -6,7 +6,7 @@ MODULE moduleMesh
use moduleSpecies, only: nSpecies
IMPLICIT NONE
! Declarations for elements
! MESH ELEMENTS
!Generic mesh element
TYPE, PUBLIC, ABSTRACT:: meshElement
!Index
@ -88,7 +88,8 @@ MODULE moduleMesh
! Surface of edge
REAL(8):: surface = 0.D0
!Pointer to boundary per species
TYPE(boundaryPointer), allocatable:: boundariesParticle(:)
TYPE(boundaryParticlePointer), allocatable:: boundariesParticle(:)
class(boundaryEMGeneric), pointer:: boundaryEM => null()
!Physical surface for the edge
CONTAINS
!DEFERED PROCEDURES
@ -584,36 +585,36 @@ MODULE moduleMesh
!Complete path for the two meshes
CHARACTER(:), ALLOCATABLE:: pathMeshColl, pathMeshParticle
! Boundary Particle Definitions
! BOUNDARY PARTICLE DEFINITIONS
!Generic type for boundaries
TYPE, abstract, PUBLIC:: boundaryGeneric
type, abstract, public:: boundaryParticleGeneric
integer:: n
character(:), allocatable:: name
contains
procedure, pass:: init => initBoundary
procedure(boundary_interface), deferred, pass:: apply
procedure, pass:: init => initBoundaryParticle
procedure(applyParticle_interface), deferred, pass:: apply
END TYPE boundaryGeneric
end type boundaryParticleGeneric
interface
module subroutine initBoundary(self, config, object, b)
module subroutine initBoundaryParticle(self, config, object, b)
use json_module
class(boundaryGeneric), intent(out):: self
class(boundaryParticleGeneric), intent(out):: self
type(json_file), intent(inout):: config
character(:), allocatable, intent(in):: object
integer, intent(in):: b
end subroutine initBoundary
end subroutine initBoundaryParticle
end interface
abstract interface
subroutine boundary_interface(self, edge, part)
subroutine applyParticle_interface(self, edge, part)
use moduleSpecies
import boundaryGeneric, meshEdge
import boundaryParticleGeneric, meshEdge
class(boundaryGeneric), intent(in):: self
class(boundaryParticleGeneric), intent(in):: self
class(meshEdge), intent(inout):: edge
class(particle), intent(inout):: part
@ -622,35 +623,35 @@ MODULE moduleMesh
end interface
!Reflecting boundary
TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryReflection
TYPE, PUBLIC, EXTENDS(boundaryParticleGeneric):: boundaryReflection
CONTAINS
procedure, pass:: apply => reflection
END TYPE boundaryReflection
!Absorption boundary
TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryAbsorption
TYPE, PUBLIC, EXTENDS(boundaryParticleGeneric):: boundaryAbsorption
CONTAINS
procedure, pass:: apply => absorption
END TYPE boundaryAbsorption
!Transparent boundary
TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryTransparent
TYPE, PUBLIC, EXTENDS(boundaryParticleGeneric):: boundaryTransparent
CONTAINS
procedure, pass:: apply => transparent
END TYPE boundaryTransparent
!Symmetry axis
TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryAxis
TYPE, PUBLIC, EXTENDS(boundaryParticleGeneric):: boundaryAxis
CONTAINS
procedure, pass:: apply => axis
END TYPE boundaryAxis
!Wall Temperature boundary
TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryWallTemperature
TYPE, PUBLIC, EXTENDS(boundaryParticleGeneric):: boundaryWallTemperature
!Thermal velocity of the wall: square root(Wall temperature X specific heat)
REAL(8):: vTh
CONTAINS
@ -659,7 +660,7 @@ MODULE moduleMesh
END TYPE boundaryWallTemperature
!Ionization boundary
TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryIonization
TYPE, PUBLIC, EXTENDS(boundaryParticleGeneric):: boundaryIonization
REAL(8):: m0, n0, v0(1:3), vTh !Properties of background neutrals.
CLASS(speciesGeneric), POINTER:: species !Ion species
CLASS(speciesCharged), POINTER:: electronSecondary !Pointer to species considerer as secondary electron
@ -673,7 +674,7 @@ MODULE moduleMesh
END TYPE boundaryIonization
! Ensures quasi-neutrality by changing the reflection coefficient
type, public, extends(boundaryGeneric):: boundaryQuasiNeutrality
type, public, extends(boundaryParticleGeneric):: boundaryQuasiNeutrality
real(8):: alpha ! Reflection parameter
integer, allocatable:: edges(:) !Array with edges
contains
@ -773,17 +774,17 @@ MODULE moduleMesh
end interface
TYPE:: boundaryCont
CLASS(boundaryGeneric), ALLOCATABLE:: obj
TYPE:: boundaryParticleCont
CLASS(boundaryParticleGeneric), ALLOCATABLE:: obj
CONTAINS
END TYPE boundaryCont
END TYPE boundaryParticleCont
type:: boundaryPointer
class(boundaryGeneric), pointer:: obj
type:: boundaryParticlePointer
class(boundaryParticleGeneric), pointer:: obj
contains
end type boundaryPointer
end type boundaryParticlePointer
type boundaryParticleLinking
integer:: physicalSurface
@ -794,7 +795,7 @@ MODULE moduleMesh
!Number of boundaries
INTEGER:: nBoundaries = 0, nPhysicalSurfaces = 0
!Array for boundaries
TYPE(boundaryCont), ALLOCATABLE, TARGET:: boundariesParticle(:)
TYPE(boundaryParticleCont), ALLOCATABLE, TARGET:: boundariesParticle(:)
!Array for linking boundaries
type(boundaryParticleLinking), allocatable, dimension(:):: boundariesParticleLinking
@ -807,4 +808,96 @@ MODULE moduleMesh
end interface
! BOUNDARY ELECTROMAGNETIC DEFINITIONS
! Generic type for electromagnetic boundary conditions
type, public, abstract:: boundaryEMGeneric
integer:: nNodes
type(meshNodePointer), allocatable:: nodes(:)
procedure(updateEM_interface), pointer, pass:: update => null()
contains
procedure, pass:: init => initBoundaryEM
procedure(applyEM_interface), deferred, pass:: apply
end type boundaryEMGeneric
interface
module subroutine initBoundaryEM(self, config, object, b)
use json_module
class(boundaryEMGeneric), intent(out):: self
type(json_file), intent(inout):: config
character(:), allocatable, intent(in):: object
integer, intent(in):: b
end subroutine initBoundaryEM
end interface
abstract interface
! Apply boundary condition to the load vector for the Poission equation
subroutine applyEM_interface(self, vectorF)
import boundaryEMGeneric
class(boundaryEMGeneric), intent(in):: self
real(8), intent(inout):: vectorF(:)
end subroutine applyEM_interface
! Update the values of the boundary condition
subroutine updateEM_interface(self)
import boundaryEMGeneric
class(boundaryEMGeneric), intent(in):: self
end subroutine updateEM_interface
end interface
TYPE, EXTENDS(boundaryEMGeneric):: boundaryEMDirichlet
REAL(8):: potential
CONTAINS
! boundaryEMGeneric DEFERRED PROCEDURES
PROCEDURE, PASS:: apply => applyDirichlet
END TYPE boundaryEMDirichlet
TYPE, EXTENDS(boundaryEMGeneric):: boundaryEMDirichletTime
real(8):: potential
type(table1D):: temporalProfile
contains
! boundaryEMGeneric DEFERRED PROCEDURES
procedure, pass:: apply => applyDirichletTime
END TYPE boundaryEMDirichletTime
interface
module subroutine applyDirichlet(self, vectorF)
class(boundaryEMDirichlet), intent(in):: self
real(8), intent(inout):: vectorF(:)
end subroutine applyDirichlet
module subroutine applyDirichletTime(self, vectorF)
class(boundaryEMDirichletTime), intent(in):: self
real(8), intent(inout):: vectorF(:)
end subroutine applyDirichletTime
end interface
! Container for boundary conditions
TYPE:: boundaryEMCont
CLASS(boundaryEMGeneric), ALLOCATABLE:: obj
END TYPE boundaryEMCont
INTEGER:: nBoundaryEM
TYPE(boundaryEMCont), ALLOCATABLE:: boundaryEM(:)
!Information of charge and reference parameters for rho vector
REAL(8), ALLOCATABLE:: qSpecies(:)
END MODULE moduleMesh