Compare commits
4 commits
f349310988
...
3275ccc3c2
| Author | SHA1 | Date | |
|---|---|---|---|
| 3275ccc3c2 | |||
| e06ce499da | |||
| 4da3bf120c | |||
| e5519cee2d |
3 changed files with 83 additions and 6 deletions
|
|
@ -979,6 +979,11 @@ MODULE moduleInput
|
||||||
|
|
||||||
call initDirichletTime(self, config, object)
|
call initDirichletTime(self, config, object)
|
||||||
|
|
||||||
|
case ("neumann")
|
||||||
|
allocate(boundaryEMNeumann:: self)
|
||||||
|
|
||||||
|
call initNeumann(self, config, object)
|
||||||
|
|
||||||
case ("floating")
|
case ("floating")
|
||||||
allocate(boundaryEMFloating:: self)
|
allocate(boundaryEMFloating:: self)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1056,6 +1056,33 @@ MODULE moduleMesh
|
||||||
|
|
||||||
end interface
|
end interface
|
||||||
|
|
||||||
|
! Neumann boundary condition (constant electric field normal to edge)
|
||||||
|
type, extends(boundaryEMGeneric):: boundaryEMNeumann
|
||||||
|
real(8):: electricField ! Electric field normal to the edge
|
||||||
|
contains
|
||||||
|
! boundaryEMGeneric deferred procedures
|
||||||
|
procedure, pass:: apply => applyNeumann
|
||||||
|
|
||||||
|
end type boundaryEMNeumann
|
||||||
|
|
||||||
|
interface
|
||||||
|
module subroutine initNeumann(self, config, object)
|
||||||
|
use json_module
|
||||||
|
|
||||||
|
class(boundaryEMGeneric), allocatable, intent(inout):: self
|
||||||
|
type(json_file), intent(inout):: config
|
||||||
|
character(:), allocatable, intent(in):: object
|
||||||
|
|
||||||
|
end subroutine initNeumann
|
||||||
|
|
||||||
|
module subroutine applyNeumann(self, vectorF)
|
||||||
|
class(boundaryEMNeumann), intent(in):: self
|
||||||
|
real(8), intent(inout):: vectorF(:)
|
||||||
|
|
||||||
|
end subroutine applyNeumann
|
||||||
|
|
||||||
|
end interface
|
||||||
|
|
||||||
! Floating: Floating surface, ie, zero net current
|
! Floating: Floating surface, ie, zero net current
|
||||||
type, extends(boundaryEMGeneric):: boundaryEMFloating
|
type, extends(boundaryEMGeneric):: boundaryEMFloating
|
||||||
real(8):: potential
|
real(8):: potential
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ submodule(moduleMesh) boundaryEM
|
||||||
|
|
||||||
! Apply
|
! Apply
|
||||||
module SUBROUTINE applyDirichlet(self, vectorF)
|
module SUBROUTINE applyDirichlet(self, vectorF)
|
||||||
USE moduleMesh
|
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
|
|
||||||
CLASS(boundaryEMDirichlet), INTENT(in):: self
|
CLASS(boundaryEMDirichlet), INTENT(in):: self
|
||||||
|
|
@ -38,8 +37,11 @@ submodule(moduleMesh) boundaryEM
|
||||||
integer:: n
|
integer:: n
|
||||||
|
|
||||||
DO n = 1, self%nNodes
|
DO n = 1, self%nNodes
|
||||||
self%nodes(n)%obj%emData%phi = self%potential
|
associate(node => self%nodes(n)%obj)
|
||||||
vectorF(self%nodes(n)%obj%n) = self%nodes(n)%obj%emData%phi
|
node%emData%phi = self%potential
|
||||||
|
vectorF(node%n) = node%emData%phi
|
||||||
|
|
||||||
|
end associate
|
||||||
|
|
||||||
END DO
|
END DO
|
||||||
|
|
||||||
|
|
@ -123,6 +125,52 @@ submodule(moduleMesh) boundaryEM
|
||||||
|
|
||||||
end subroutine updateDirichletTime
|
end subroutine updateDirichletTime
|
||||||
|
|
||||||
|
! Neumann constant value
|
||||||
|
! Init
|
||||||
|
module subroutine initNeumann(self, config, object)
|
||||||
|
use json_module
|
||||||
|
use moduleRefParam, only: EF_ref
|
||||||
|
use moduleErrors, only: criticalError
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
class(boundaryEMGeneric), allocatable, intent(inout):: self
|
||||||
|
type(json_file), intent(inout):: config
|
||||||
|
character(:), allocatable, intent(in):: object
|
||||||
|
real(8):: electricField
|
||||||
|
logical:: found
|
||||||
|
|
||||||
|
select type(self)
|
||||||
|
type is(boundaryEMNeumann)
|
||||||
|
call config%get(object // '.electricField', electricField, found)
|
||||||
|
if (.not. found) then
|
||||||
|
call criticalError('Required parameter "electricField" for Neumann boundary condition not found', 'readBoundaryEM')
|
||||||
|
|
||||||
|
end if
|
||||||
|
|
||||||
|
self%electricField = electricField / EF_ref
|
||||||
|
|
||||||
|
end select
|
||||||
|
|
||||||
|
end subroutine initNeumann
|
||||||
|
|
||||||
|
! Apply
|
||||||
|
module subroutine applyNeumann(self, vectorF)
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
class(boundaryEMNeumann), intent(in):: self
|
||||||
|
real(8), intent(inout):: vectorF(:)
|
||||||
|
integer:: n
|
||||||
|
|
||||||
|
do n = 1, self%nNodes
|
||||||
|
associate(node => self%nodes(n)%obj)
|
||||||
|
vectorF(node%n) = vectorF(node%n) + self%electricField
|
||||||
|
|
||||||
|
end associate
|
||||||
|
|
||||||
|
end do
|
||||||
|
|
||||||
|
end subroutine applyNeumann
|
||||||
|
|
||||||
! Floating surface
|
! Floating surface
|
||||||
! Init
|
! Init
|
||||||
module subroutine initFloating(self, config, object)
|
module subroutine initFloating(self, config, object)
|
||||||
|
|
@ -224,9 +272,6 @@ submodule(moduleMesh) boundaryEM
|
||||||
|
|
||||||
mom_center = edge%gatherF(edge%centerXi(), edge%nNodes, mom_nodes)
|
mom_center = edge%gatherF(edge%centerXi(), edge%nNodes, mom_nodes)
|
||||||
|
|
||||||
! Only account for charge exiting the surface
|
|
||||||
mom_center = max(mom_center, 0.0d0)
|
|
||||||
|
|
||||||
edgeDensityCurrent = edgeDensityCurrent + qSpecies(s) * mom_center
|
edgeDensityCurrent = edgeDensityCurrent + qSpecies(s) * mom_center
|
||||||
|
|
||||||
end do
|
end do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue