Time variable Dirichlet condition #52
2 changed files with 21 additions and 11 deletions
Functionality added
Now we have a new boundary condition that can change the value of the potential in a surface based on a file.
commit
2d4b405fb1
|
|
@ -1137,7 +1137,6 @@ MODULE moduleInput
|
||||||
USE moduleOutput
|
USE moduleOutput
|
||||||
USE moduleErrors
|
USE moduleErrors
|
||||||
USE moduleEM
|
USE moduleEM
|
||||||
USE moduleRefParam
|
|
||||||
USE moduleSpecies
|
USE moduleSpecies
|
||||||
USE json_module
|
USE json_module
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
|
|
@ -1148,7 +1147,7 @@ MODULE moduleInput
|
||||||
CHARACTER(:), ALLOCATABLE:: typeEM
|
CHARACTER(:), ALLOCATABLE:: typeEM
|
||||||
REAL(8):: potential
|
REAL(8):: potential
|
||||||
INTEGER:: physicalSurface
|
INTEGER:: physicalSurface
|
||||||
CHARACTER(:), ALLOCATABLE:: temporalProfile
|
CHARACTER(:), ALLOCATABLE:: temporalProfile, temporalProfilePath
|
||||||
INTEGER:: b, s, n, ni
|
INTEGER:: b, s, n, ni
|
||||||
CHARACTER(2):: bString
|
CHARACTER(2):: bString
|
||||||
INTEGER:: info
|
INTEGER:: info
|
||||||
|
|
@ -1156,11 +1155,14 @@ MODULE moduleInput
|
||||||
|
|
||||||
CALL config%info('boundaryEM', found, n_children = nBoundaryEM)
|
CALL config%info('boundaryEM', found, n_children = nBoundaryEM)
|
||||||
|
|
||||||
IF (found) ALLOCATE(boundaryEM(1:nBoundaryEM))
|
IF (found) THEN
|
||||||
|
ALLOCATE(boundaryEM(1:nBoundaryEM))
|
||||||
|
|
||||||
|
END IF
|
||||||
|
|
||||||
DO b = 1, nBoundaryEM
|
DO b = 1, nBoundaryEM
|
||||||
WRITE(bString, '(I2)') b
|
WRITE(bString, '(I2)') b
|
||||||
object = 'boundaryEM(' // trim(bString) // ')'
|
object = 'boundaryEM(' // TRIM(bString) // ')'
|
||||||
|
|
||||||
CALL config%get(object // '.type', typeEM, found)
|
CALL config%get(object // '.type', typeEM, found)
|
||||||
|
|
||||||
|
|
@ -1174,7 +1176,8 @@ MODULE moduleInput
|
||||||
|
|
||||||
CALL config%get(object // '.physicalSurface', physicalSurface, found)
|
CALL config%get(object // '.physicalSurface', physicalSurface, found)
|
||||||
IF (.NOT. found) THEN
|
IF (.NOT. found) THEN
|
||||||
CALL criticalError('Required parameter "physicalSurface" for Dirichlet boundary condition not found', 'readEMBoundary')
|
CALL criticalError('Required parameter "physicalSurface" for Dirichlet boundary condition not found', &
|
||||||
|
'readEMBoundary')
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
|
@ -1183,23 +1186,27 @@ MODULE moduleInput
|
||||||
CASE ("dirichletTime")
|
CASE ("dirichletTime")
|
||||||
CALL config%get(object // '.potential', potential, found)
|
CALL config%get(object // '.potential', potential, found)
|
||||||
IF (.NOT. found) THEN
|
IF (.NOT. found) THEN
|
||||||
CALL criticalError('Required parameter "potential" for Dirichlet boundary condition not found', 'readEMBoundary')
|
CALL criticalError('Required parameter "potential" for Dirichlet Time boundary condition not found', &
|
||||||
|
'readEMBoundary')
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
CALL config%get(object // '.temporalProfile', temporalProfile, found)
|
CALL config%get(object // '.temporalProfile', temporalProfile, found)
|
||||||
IF (.NOT. found) THEN
|
IF (.NOT. found) THEN
|
||||||
CALL criticalError('Required parameter "potential" for Dirichlet boundary condition not found', 'readEMBoundary')
|
CALL criticalError('Required parameter "temporalProfile" for Dirichlet Time boundary condition not found', &
|
||||||
|
'readEMBoundary')
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
temporalProfilePath = path // temporalProfile
|
||||||
|
|
||||||
CALL config%get(object // '.physicalSurface', physicalSurface, found)
|
CALL config%get(object // '.physicalSurface', physicalSurface, found)
|
||||||
IF (.NOT. found) THEN
|
IF (.NOT. found) THEN
|
||||||
CALL criticalError('Required parameter "physicalSurface" for Dirichlet boundary condition not found', 'readEMBoundary')
|
CALL criticalError('Required parameter "physicalSurface" for Dirichlet Time boundary condition not found', &
|
||||||
|
'readEMBoundary')
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
CALL initDirichletTime(boundaryEM(b)%obj, physicalSurface, potential, temporalProfile)
|
CALL initDirichletTime(boundaryEM(b)%obj, physicalSurface, potential, temporalProfilePath)
|
||||||
|
|
||||||
CASE DEFAULT
|
CASE DEFAULT
|
||||||
CALL criticalError('Boundary type ' // typeEM // ' not yet supported', 'readEMBoundary')
|
CALL criticalError('Boundary type ' // typeEM // ' not yet supported', 'readEMBoundary')
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ MODULE moduleEM
|
||||||
! Point boundary to nodes
|
! Point boundary to nodes
|
||||||
nNodes = SIZE(nodes)
|
nNodes = SIZE(nodes)
|
||||||
ALLOCATE(self%nodes(nNodes))
|
ALLOCATE(self%nodes(nNodes))
|
||||||
|
self%nNodes = nNodes
|
||||||
DO n = 1, nNodes
|
DO n = 1, nNodes
|
||||||
self%nodes(n)%obj => mesh%nodes(nodes(n))%obj
|
self%nodes(n)%obj => mesh%nodes(nodes(n))%obj
|
||||||
|
|
||||||
|
|
@ -190,10 +191,13 @@ MODULE moduleEM
|
||||||
|
|
||||||
CLASS(boundaryEMDirichletTime), INTENT(in):: self
|
CLASS(boundaryEMDirichletTime), INTENT(in):: self
|
||||||
REAL(8), INTENT(inout):: vectorF(:)
|
REAL(8), INTENT(inout):: vectorF(:)
|
||||||
|
REAL(8):: timeFactor
|
||||||
INTEGER:: n, ni
|
INTEGER:: n, ni
|
||||||
|
|
||||||
|
timeFactor = self%temporalProfile%get(DBLE(timeStep)*tauMin)
|
||||||
|
|
||||||
DO n = 1, self%nNodes
|
DO n = 1, self%nNodes
|
||||||
self%nodes(n)%obj%emData%phi = self%potential !TODO: Correct for time
|
self%nodes(n)%obj%emData%phi = self%potential * timeFactor
|
||||||
vectorF(self%nodes(n)%obj%n) = self%nodes(n)%obj%emData%phi
|
vectorF(self%nodes(n)%obj%n) = self%nodes(n)%obj%emData%phi
|
||||||
|
|
||||||
END DO
|
END DO
|
||||||
|
|
@ -274,7 +278,6 @@ MODULE moduleEM
|
||||||
ALLOCATE(tempF(1:mesh%numNodes))
|
ALLOCATE(tempF(1:mesh%numNodes))
|
||||||
!$OMP END SINGLE
|
!$OMP END SINGLE
|
||||||
|
|
||||||
!TODO: Is this done every time step??? Then things are gonna be really simple.
|
|
||||||
CALL assembleSourceVector(tempF)
|
CALL assembleSourceVector(tempF)
|
||||||
|
|
||||||
!$OMP SINGLE
|
!$OMP SINGLE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue