Working on init for new physical surfaces
This commit is contained in:
parent
1b32dfdfd6
commit
a0d45503f7
6 changed files with 93 additions and 54 deletions
|
|
@ -49,6 +49,9 @@ MODULE moduleInput
|
|||
CALL checkStatus(config, "readBoundaryEM")
|
||||
|
||||
! Read Physical Surfaces
|
||||
call verboseError('Reading Physical Surfaces...')
|
||||
call readPhysicalSurfaces(config)
|
||||
call checkStatus(config, 'readPhysicalSurfaces')
|
||||
|
||||
!Read Geometry
|
||||
CALL verboseError('Reading Geometry...')
|
||||
|
|
@ -895,6 +898,8 @@ MODULE moduleInput
|
|||
write(ps, '(I2)') ps
|
||||
object = 'physicalSurfaces(' // TRIM(bString) // ')'
|
||||
|
||||
allocate(physicalSurfaces(ps)%nodes(0))
|
||||
allocate(physicalSurfaces(ps)%edges(0))
|
||||
call config%get(object // '.index', physicalSurfaces(ps)%index, found)
|
||||
if (.not. found) then
|
||||
call criticalError('Physical surface index not found', 'readPhysicalSurfaces')
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ MODULE moduleMesh3DCart
|
|||
|
||||
!EDGE FUNCTIONS
|
||||
!Init surface element
|
||||
SUBROUTINE initEdge3DCartTria(self, n, p, btPart, btEM)
|
||||
SUBROUTINE initEdge3DCartTria(self, n, p, ps)
|
||||
USE moduleSpecies, only: nSpecies
|
||||
USE moduleErrors
|
||||
USE moduleMath
|
||||
|
|
@ -114,8 +114,8 @@ MODULE moduleMesh3DCart
|
|||
CLASS(meshEdge3DCartTria), INTENT(out):: self
|
||||
INTEGER, INTENT(in):: n
|
||||
INTEGER, INTENT(in):: p(:)
|
||||
INTEGER, INTENT(in):: btPart(1:nSpecies)
|
||||
integer, intent(in):: btEM
|
||||
INTEGER, INTENT(in):: ps
|
||||
integer:: ps_index
|
||||
REAL(8), DIMENSION(1:3):: r1, r2, r3
|
||||
REAL(8), DIMENSION(1:3):: vec1, vec2
|
||||
INTEGER:: s
|
||||
|
|
@ -144,16 +144,8 @@ MODULE moduleMesh3DCart
|
|||
|
||||
self%surface = 1.D0/L_ref**2 !TODO: FIX THIS WHEN MOVING TO 3D
|
||||
|
||||
!Boundary particle linking
|
||||
allocate(self%boundariesParticle(1:nSpecies))
|
||||
!Assign functions to particle boundary
|
||||
do s = 1, nSpecies
|
||||
self%boundariesParticle(s)%obj => boundariesParticle(btPart(s))%obj
|
||||
ps_index = physicalSurface_to_index(ps)
|
||||
|
||||
end do
|
||||
|
||||
! Add nodes to EM boundary
|
||||
call boundariesEMLinking(btEM)%model%addNodes(self%getNodes(self%nNodes))
|
||||
|
||||
END SUBROUTINE initEdge3DCartTria
|
||||
|
||||
|
|
|
|||
|
|
@ -364,12 +364,8 @@ MODULE moduleMeshInputVTU
|
|||
|
||||
END SELECT
|
||||
|
||||
!Associate boundary condition procedure.
|
||||
btPart = physicalSurface_to_id(boundariesParticleLinking, entitiesID(n))
|
||||
btEM = physicalSurface_to_id(boundariesEMLinking, entitiesID(n))
|
||||
|
||||
!Init edge
|
||||
CALL self%edges(e)%obj%init(n, p, boundariesParticleLinking(btPart)%speciesIndex, btEM)
|
||||
CALL self%edges(e)%obj%init(n, p, entitiesID(n))
|
||||
|
||||
DEALLOCATE(p)
|
||||
|
||||
|
|
|
|||
|
|
@ -937,9 +937,27 @@ MODULE moduleMesh
|
|||
class(meshEdgePointer), allocatable:: edges(:)
|
||||
class(boundaryParticlePointer), allocatable:: particles(:)
|
||||
class(boundaryEMGeneric), pointer:: EM => null()
|
||||
contains
|
||||
procedure, pass:: addNode
|
||||
procedure, pass:: addEdge
|
||||
|
||||
end type
|
||||
|
||||
interface
|
||||
module subroutine addNode(self, node)
|
||||
class(physicalSurface), intent(inout):: self
|
||||
integer, intent(in):: node
|
||||
|
||||
end subroutine addNode
|
||||
|
||||
module subroutine addEdge(self, edge)
|
||||
class(physicalSurface), intent(inout):: self
|
||||
integer, intent(in):: edge
|
||||
|
||||
end subroutine addEdge
|
||||
|
||||
end interface
|
||||
|
||||
integer:: nPhysicalSurfaces
|
||||
type(physicalSurface), allocatable:: physicalSurfaces(:)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,42 +24,6 @@ submodule(moduleMesh) boundaryEM
|
|||
|
||||
end function boundaryEMName_to_Index
|
||||
|
||||
subroutine addNodes(self, nodes)
|
||||
implicit none
|
||||
|
||||
class(boundaryEMGeneric), intent(inout):: self
|
||||
integer, intent(in):: nodes(:)
|
||||
integer:: n, nn, nNodes
|
||||
logical:: inArray
|
||||
type(meshNodePointer):: nodeToAdd
|
||||
|
||||
|
||||
nNodes = size(nodes)
|
||||
! Collect all nodes that are not already in the boundary
|
||||
DO n = 1, nNodes
|
||||
nodeToAdd%obj => mesh%nodes(nodes(n))%obj
|
||||
inArray = .false.
|
||||
! I cannot use the procedure 'any' for this
|
||||
do nn = 1 , size(self%nodes)
|
||||
IF (self%nodes(nn) == nodeToAdd) THEN
|
||||
! Node already in array
|
||||
inArray = .true.
|
||||
exit
|
||||
|
||||
end if
|
||||
|
||||
end do
|
||||
|
||||
if (.not. inArray) then
|
||||
! If not, add element to array of nodes
|
||||
self%nodes = [self%nodes, nodeToAdd]
|
||||
|
||||
end if
|
||||
|
||||
end do
|
||||
|
||||
end subroutine addNodes
|
||||
|
||||
module subroutine initBoundaryEM(self, config, object, b)
|
||||
use json_module
|
||||
use moduleErrors
|
||||
|
|
|
|||
|
|
@ -19,4 +19,68 @@ submodule(moduleMesh) surfaces
|
|||
|
||||
end function physicalSurface_to_index
|
||||
|
||||
subroutine addNode(self, node)
|
||||
implicit none
|
||||
|
||||
class(physicalSurface), intent(inout):: self
|
||||
integer, intent(in):: node
|
||||
integer:: n, nn
|
||||
logical:: inArray
|
||||
|
||||
|
||||
associate(nodeToAdd => mesh%nodes(node)%obj)
|
||||
inArray = .false.
|
||||
! I cannot use the procedure 'any' for this
|
||||
do nn = 1 , size(self%nodes)
|
||||
IF (self%nodes(nn)%obj == nodeToAdd) THEN
|
||||
! Node already in array
|
||||
inArray = .true.
|
||||
exit
|
||||
|
||||
end if
|
||||
|
||||
end do
|
||||
|
||||
if (.not. inArray) then
|
||||
! If not, add element to array of nodes
|
||||
self%nodes = [self%nodes, nodeToAdd]
|
||||
|
||||
end if
|
||||
|
||||
end associate
|
||||
|
||||
end subroutine addNode
|
||||
|
||||
subroutine addEdge(self, edge)
|
||||
implicit none
|
||||
|
||||
class(physicalSurface), intent(inout):: self
|
||||
integer, intent(in):: edge
|
||||
integer:: n, nn
|
||||
logical:: inArray
|
||||
|
||||
|
||||
associate(edgeToAdd => mesh%edges(edge)%obj)
|
||||
inArray = .false.
|
||||
! I cannot use the procedure 'any' for this
|
||||
do nn = 1 , size(self%edges)
|
||||
IF (self%edges(nn) == edgeToAdd) THEN
|
||||
! Node already in array
|
||||
inArray = .true.
|
||||
exit
|
||||
|
||||
end if
|
||||
|
||||
end do
|
||||
|
||||
if (.not. inArray) then
|
||||
! If not, add element to array of nodes
|
||||
self%edges = [self%edges, edgeToAdd]
|
||||
|
||||
end if
|
||||
|
||||
end associate
|
||||
|
||||
end subroutine addEdge
|
||||
|
||||
end submodule surfaces
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue