I have to change the init of the edges to include the EM boundaries now

This commit is contained in:
Jorge Gonzalez 2026-02-18 13:50:14 +01:00
commit 0379ea42c2
3 changed files with 32 additions and 11 deletions

View file

@ -72,17 +72,25 @@ MODULE moduleMesh
TYPE:: meshNodePointer TYPE:: meshNodePointer
CLASS(meshNode), POINTER:: obj CLASS(meshNode), POINTER:: obj
CONTAINS CONTAINS
procedure, pass:: meshNodePointer_equal procedure, pass:: meshNodePointer_equal_type_type
generic:: operator(==) => meshNodePointer_equal procedure, pass:: meshNodePointer_equal_type_int
generic:: operator(==) => meshNodePointer_equal_type_type, meshNodePointer_equal_type_int
END TYPE meshNodePointer END TYPE meshNodePointer
interface interface
module function meshNodePointer_equal(self, other) result(isEqual) module function meshNodePointer_equal_type_type(self, other) result(isEqual)
class(meshNodePointer), intent(in):: self, other class(meshNodePointer), intent(in):: self, other
logical:: isEqual logical:: isEqual
end function meshNodePointer_equal end function meshNodePointer_equal_type_type
module function meshNodePointer_equal_type_int(self, other) result(isEqual)
class(meshNodePointer), intent(in):: self
integer, intent(in):: other
logical:: isEqual
end function meshNodePointer_equal_type_int
end interface end interface
@ -839,7 +847,7 @@ MODULE moduleMesh
module subroutine addNodes(self, nodes) module subroutine addNodes(self, nodes)
class(boundaryEMGeneric), intent(inout):: self class(boundaryEMGeneric), intent(inout):: self
type(meshNodePointer), intent(in):: nodes(:) integer, intent(in):: nodes(:)
end subroutine addNodes end subroutine addNodes

View file

@ -4,18 +4,20 @@ submodule(moduleMesh) boundaryEM
implicit none implicit none
class(boundaryEMGeneric), intent(inout):: self class(boundaryEMGeneric), intent(inout):: self
type(meshNodePointer), intent(in):: nodes(:) integer, intent(in):: nodes(:)
INTEGER:: n, nn, nNodes integer:: n, nn, nNodes
logical:: inArray logical:: inArray
type(meshNodePointer):: nodeToAdd
nNodes = size(nodes) nNodes = size(nodes)
! Collect all nodes that are not already in the boundary ! Collect all nodes that are not already in the boundary
DO n = 1, nNodes DO n = 1, nNodes
nodeToAdd%obj => mesh%nodes(nodes(n))%obj
inArray = .false. inArray = .false.
! I cannot use the procedure 'any' for this ! I cannot use the procedure 'any' for this
do nn = 1 , size(self%nodes) do nn = 1 , size(self%nodes)
IF (self%nodes(nn) == nodes(n)) THEN IF (self%nodes(nn) == nodeToAdd) THEN
! Node already in array ! Node already in array
inArray = .true. inArray = .true.
exit exit
@ -26,7 +28,7 @@ submodule(moduleMesh) boundaryEM
if (.not. inArray) then if (.not. inArray) then
! If not, add element to array of nodes ! If not, add element to array of nodes
self%nodes = [self%nodes, nodes(n)] self%nodes = [self%nodes, nodeToAdd]
end if end if

View file

@ -18,7 +18,7 @@ submodule(moduleMesh) elements
END SUBROUTINE resetOutput END SUBROUTINE resetOutput
module function meshNodePointer_equal(self, other) result(isEqual) function meshNodePointer_equal_type_type(self, other) result(isEqual)
implicit none implicit none
class(meshNodePointer), intent(in):: self, other class(meshNodePointer), intent(in):: self, other
@ -26,7 +26,18 @@ submodule(moduleMesh) elements
isEqual = self%obj%n == other%obj%n isEqual = self%obj%n == other%obj%n
end function meshNodePointer_equal end function meshNodePointer_equal_type_type
function meshNodePointer_equal_type_int(self, other) result(isEqual)
implicit none
class(meshNodePointer), intent(in):: self
integer, intent(in):: other
logical:: isEqual
isEqual = self%obj%n == other
end function meshNodePointer_equal_type_int
!Constructs the global K matrix !Constructs the global K matrix
PURE module SUBROUTINE constructGlobalK(self) PURE module SUBROUTINE constructGlobalK(self)