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
module SUBROUTINE applyDirichlet(self, vectorF)
USE moduleMesh
IMPLICIT NONE
CLASS(boundaryEMDirichlet), INTENT(in):: self
@ -38,8 +37,11 @@ submodule(moduleMesh) boundaryEM
integer:: n
DO n = 1, self%nNodes
self%nodes(n)%obj%emData%phi = self%potential
vectorF(self%nodes(n)%obj%n) = self%nodes(n)%obj%emData%phi
associate(node => self%nodes(n)%obj)
node%emData%phi = self%potential
vectorF(node%n) = node%emData%phi
end associate
END DO
@ -127,11 +129,27 @@ submodule(moduleMesh) boundaryEM
! 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
@ -141,6 +159,15 @@ submodule(moduleMesh) boundaryEM
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