Boundaries for EM almost done

This commit is contained in:
Jorge Gonzalez 2026-02-18 13:31:38 +01:00
commit 4c72e68246
9 changed files with 249 additions and 171 deletions

View file

@ -72,9 +72,20 @@ MODULE moduleMesh
TYPE:: meshNodePointer
CLASS(meshNode), POINTER:: obj
CONTAINS
procedure, pass:: meshNodePointer_equal
generic:: operator(==) => meshNodePointer_equal
END TYPE meshNodePointer
interface
module function meshNodePointer_equal(self, other) result(isEqual)
class(meshNodePointer), intent(in):: self, other
logical:: isEqual
end function meshNodePointer_equal
end interface
!Parent of Edge element
TYPE, PUBLIC, ABSTRACT, EXTENDS(meshElement):: meshEdge
!Nomber of nodes in the edge
@ -89,7 +100,6 @@ MODULE moduleMesh
REAL(8):: surface = 0.D0
!Pointer to boundary per species
TYPE(boundaryParticlePointer), allocatable:: boundariesParticle(:)
class(boundaryEMGeneric), pointer:: boundaryEM => null()
!Physical surface for the edge
CONTAINS
!DEFERED PROCEDURES
@ -118,16 +128,17 @@ MODULE moduleMesh
ABSTRACT INTERFACE
!Inits the edge parameters
SUBROUTINE initEdge_interface(self, n, p, bt)
subroutine initEdge_interface(self, n, p, btPart, btEM)
use moduleSpecies, only:nSpecies
IMPORT:: meshEdge
import:: meshEdge
CLASS(meshEdge), INTENT(out):: self
INTEGER, INTENT(in):: n
INTEGER, INTENT(in):: p(:)
INTEGER, INTENT(in):: bt(1:nSpecies)
class(meshEdge), intent(out):: self
integer, intent(in):: n
integer, intent(in):: p(:)
integer, intent(in):: btPart(1:nSpecies)
integer, intent(in):: btEM
END SUBROUTINE initEdge_interface
end subroutine initEdge_interface
!Get nodes index from node
PURE FUNCTION getNodesEdge_interface(self, nNodes) RESULT(n)
@ -799,18 +810,11 @@ MODULE moduleMesh
!Array for linking boundaries
type(boundaryParticleLinking), allocatable, dimension(:):: boundariesParticleLinking
interface
module function physicalSurface_to_id(physicalSurface) result(b)
integer:: physicalSurface
integer:: b
end function physicalSurface_to_id
end interface
! BOUNDARY ELECTROMAGNETIC DEFINITIONS
! Generic type for electromagnetic boundary conditions
type, public, abstract:: boundaryEMGeneric
integer:: n
character(:), allocatable:: name
integer:: nNodes
type(meshNodePointer), allocatable:: nodes(:)
@ -818,6 +822,7 @@ MODULE moduleMesh
contains
procedure, pass:: init => initBoundaryEM
procedure(applyEM_interface), deferred, pass:: apply
procedure, pass:: addNodes
end type boundaryEMGeneric
@ -832,6 +837,12 @@ MODULE moduleMesh
end subroutine initBoundaryEM
module subroutine addNodes(self, nodes)
class(boundaryEMGeneric), intent(inout):: self
type(meshNodePointer), intent(in):: nodes(:)
end subroutine addNodes
end interface
abstract interface
@ -850,7 +861,7 @@ MODULE moduleMesh
class(boundaryEMGeneric), intent(in):: self
end subroutine updateEM_interface
end subroutine updateEM_interface
end interface
@ -894,10 +905,34 @@ MODULE moduleMesh
END TYPE boundaryEMCont
INTEGER:: nBoundaryEM
TYPE(boundaryEMCont), ALLOCATABLE:: boundaryEM(:)
type:: boundaryEMLinking
integer:: physicalSurface
class(boundaryEMGeneric), pointer:: boundary => null()
end type boundaryEMLinking
INTEGER:: nBoundariesEM
TYPE(boundaryEMCont), ALLOCATABLE, target:: boundariesEM(:)
!Information of charge and reference parameters for rho vector
REAL(8), ALLOCATABLE:: qSpecies(:)
! Get ID from array based on physical surface
interface physicalSurface_to_id
module function physicalSurface_to_boundaryParticleId(boundaryArray, physicalSurface) result(b)
type(boundaryParticleLinking):: boundaryArray(:)
integer:: physicalSurface
integer:: b
end function physicalSurface_to_boundaryParticleId
module function physicalSurface_to_boundaryEMId(boundaryArray, physicalSurface) result(b)
type(boundaryEMLinking):: boundaryArray(:)
integer:: physicalSurface
integer:: b
end function physicalSurface_to_boundaryEMId
end interface physicalSurface_to_id
END MODULE moduleMesh