Boundaries for EM almost done
This commit is contained in:
parent
6a7c92f62f
commit
4c72e68246
9 changed files with 249 additions and 171 deletions
|
|
@ -38,10 +38,15 @@ MODULE moduleInput
|
|||
CALL readSpecies(config)
|
||||
CALL checkStatus(config, "readSpecies")
|
||||
|
||||
!Read boundaries
|
||||
CALL verboseError('Reading boundary conditions...')
|
||||
CALL readBoundary(config)
|
||||
CALL checkStatus(config, "readBoundary")
|
||||
!Read particle boundaries
|
||||
CALL verboseError('Reading particle boundary conditions...')
|
||||
CALL readBoundaryParticle(config)
|
||||
CALL checkStatus(config, "readBoundaryParticle")
|
||||
|
||||
! read EM boundaries
|
||||
CALL verboseError('Reading EM boundary conditions...')
|
||||
CALL readBoundaryEM(config)
|
||||
CALL checkStatus(config, "readBoundaryEM")
|
||||
|
||||
!Read Geometry
|
||||
CALL verboseError('Reading Geometry...')
|
||||
|
|
@ -254,17 +259,7 @@ MODULE moduleInput
|
|||
IF (found) THEN
|
||||
CALL solver%initEM(EMType)
|
||||
SELECT CASE(EMType)
|
||||
CASE("Electrostatic")
|
||||
!Read BC
|
||||
CALL readEMBoundary(config)
|
||||
|
||||
CASE("ElectrostaticBoltzmann")
|
||||
!Read BC
|
||||
CALL readEMBoundary(config)
|
||||
|
||||
CASE("ConstantB")
|
||||
!Read BC
|
||||
CALL readEMBoundary(config)
|
||||
!Read constant magnetic field
|
||||
DO i = 1, 3
|
||||
WRITE(iString, '(i2)') i
|
||||
|
|
@ -791,7 +786,7 @@ MODULE moduleInput
|
|||
END SUBROUTINE readInteractions
|
||||
|
||||
!Reads boundary conditions for the mesh
|
||||
SUBROUTINE readBoundary(config)
|
||||
SUBROUTINE readBoundaryParticle(config)
|
||||
use moduleMesh
|
||||
USE moduleErrors
|
||||
use moduleSpecies, only: nSpecies
|
||||
|
|
@ -837,7 +832,7 @@ MODULE moduleInput
|
|||
!Init the list of particles from surfaces
|
||||
CALL OMP_INIT_LOCK(partSurfaces%lock)
|
||||
|
||||
END SUBROUTINE readBoundary
|
||||
END SUBROUTINE readBoundaryParticle
|
||||
|
||||
!Read the geometry (mesh) for the case
|
||||
SUBROUTINE readGeometry(config)
|
||||
|
|
@ -1086,7 +1081,7 @@ MODULE moduleInput
|
|||
|
||||
END SUBROUTINE readProbes
|
||||
|
||||
SUBROUTINE readEMBoundary(config)
|
||||
SUBROUTINE readBoundaryEM(config)
|
||||
USE moduleMesh
|
||||
USE moduleOutput
|
||||
USE moduleErrors
|
||||
|
|
@ -1107,68 +1102,22 @@ MODULE moduleInput
|
|||
INTEGER:: info
|
||||
EXTERNAL:: dgetrf
|
||||
|
||||
CALL config%info('boundaryEM', found, n_children = nBoundaryEM)
|
||||
CALL config%info('boundaries.EM.models', found, n_children = nBoundariesEM)
|
||||
|
||||
IF (found) THEN
|
||||
ALLOCATE(boundaryEM(1:nBoundaryEM))
|
||||
ALLOCATE(boundariesEM(1:nBoundariesEM))
|
||||
|
||||
END IF
|
||||
|
||||
DO b = 1, nBoundaryEM
|
||||
WRITE(bString, '(I2)') b
|
||||
object = 'boundaryEM(' // TRIM(bString) // ')'
|
||||
object = 'boundaries.EM.models(' // TRIM(bString) // ')'
|
||||
|
||||
CALL config%get(object // '.type', typeEM, found)
|
||||
call boundariesEM(b)%init(config, object, b)
|
||||
|
||||
SELECT CASE(typeEM)
|
||||
CASE ("dirichlet")
|
||||
CALL config%get(object // '.potential', potential, found)
|
||||
IF (.NOT. found) THEN
|
||||
CALL criticalError('Required parameter "potential" for Dirichlet boundary condition not found', 'readEMBoundary')
|
||||
|
||||
END IF
|
||||
|
||||
CALL config%get(object // '.physicalSurface', physicalSurface, found)
|
||||
IF (.NOT. found) THEN
|
||||
CALL criticalError('Required parameter "physicalSurface" for Dirichlet boundary condition not found', &
|
||||
'readEMBoundary')
|
||||
|
||||
END IF
|
||||
|
||||
CALL initDirichlet(boundaryEM(b)%obj, physicalSurface, potential)
|
||||
|
||||
CASE ("dirichletTime")
|
||||
CALL config%get(object // '.potential', potential, found)
|
||||
IF (.NOT. found) THEN
|
||||
CALL criticalError('Required parameter "potential" for Dirichlet Time boundary condition not found', &
|
||||
'readEMBoundary')
|
||||
|
||||
END IF
|
||||
|
||||
CALL config%get(object // '.temporalProfile', temporalProfile, found)
|
||||
IF (.NOT. found) THEN
|
||||
CALL criticalError('Required parameter "temporalProfile" for Dirichlet Time boundary condition not found', &
|
||||
'readEMBoundary')
|
||||
|
||||
END IF
|
||||
temporalProfilePath = path // temporalProfile
|
||||
|
||||
CALL config%get(object // '.physicalSurface', physicalSurface, found)
|
||||
IF (.NOT. found) THEN
|
||||
CALL criticalError('Required parameter "physicalSurface" for Dirichlet Time boundary condition not found', &
|
||||
'readEMBoundary')
|
||||
|
||||
END IF
|
||||
|
||||
CALL initDirichletTime(boundaryEM(b)%obj, physicalSurface, potential, temporalProfilePath)
|
||||
|
||||
CASE DEFAULT
|
||||
CALL criticalError('Boundary type ' // typeEM // ' not yet supported', 'readEMBoundary')
|
||||
|
||||
END SELECT
|
||||
|
||||
END DO
|
||||
end do
|
||||
|
||||
! TODO: Move this to the init of species
|
||||
ALLOCATE(qSpecies(1:nSpecies))
|
||||
DO s = 1, nSpecies
|
||||
SELECT TYPE(sp => species(s)%obj)
|
||||
|
|
@ -1182,9 +1131,10 @@ MODULE moduleInput
|
|||
|
||||
END DO
|
||||
|
||||
! TODO: Do this after the mesh has been read
|
||||
! Modify K matrix due to boundary conditions
|
||||
DO b = 1, nBoundaryEM
|
||||
SELECT TYPE(boundary => boundaryEM(b)%obj)
|
||||
DO b = 1, nBoundariesEM
|
||||
SELECT TYPE(boundary => boundariesEM(b)%obj)
|
||||
TYPE IS(boundaryEMDirichlet)
|
||||
DO n = 1, boundary%nNodes
|
||||
ni = boundary%nodes(n)%obj%n
|
||||
|
|
@ -1208,11 +1158,11 @@ MODULE moduleInput
|
|||
!Compute the PLU factorization of K once boundary conditions have been read
|
||||
CALL dgetrf(mesh%numNodes, mesh%numNodes, mesh%K, mesh%numNodes, mesh%IPIV, info)
|
||||
IF (info /= 0) THEN
|
||||
CALL criticalError('Factorization of K matrix failed', 'readEMBoundary')
|
||||
CALL criticalError('Factorization of K matrix failed', 'readBoundaryEM')
|
||||
|
||||
END IF
|
||||
|
||||
END SUBROUTINE readEMBoundary
|
||||
END SUBROUTINE readBoundaryEM
|
||||
|
||||
!Reads the injection of particles from the boundaries
|
||||
SUBROUTINE readInject(config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue