Functions done

This commit is contained in:
Jorge Gonzalez 2026-04-14 10:37:16 +02:00
commit e06ce499da

View file

@ -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
@ -127,11 +129,27 @@ submodule(moduleMesh) boundaryEM
! Init ! Init
module subroutine initNeumann(self, config, object) module subroutine initNeumann(self, config, object)
use json_module use json_module
use moduleRefParam, only: EF_ref
use moduleErrors, only: criticalError
implicit none implicit none
class(boundaryEMGeneric), allocatable, intent(inout):: self class(boundaryEMGeneric), allocatable, intent(inout):: self
type(json_file), intent(inout):: config type(json_file), intent(inout):: config
character(:), allocatable, intent(in):: object 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 end subroutine initNeumann
@ -141,6 +159,15 @@ submodule(moduleMesh) boundaryEM
class(boundaryEMNeumann), intent(in):: self class(boundaryEMNeumann), intent(in):: self
real(8), intent(inout):: vectorF(:) 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 end subroutine applyNeumann