Rewriting surfaces and boundaries
This commit is contained in:
parent
3678942be4
commit
1b32dfdfd6
6 changed files with 170 additions and 152 deletions
|
|
@ -48,6 +48,8 @@ MODULE moduleInput
|
|||
CALL readBoundaryEM(config)
|
||||
CALL checkStatus(config, "readBoundaryEM")
|
||||
|
||||
! Read Physical Surfaces
|
||||
|
||||
!Read Geometry
|
||||
CALL verboseError('Reading Geometry...')
|
||||
CALL readGeometry(config)
|
||||
|
|
@ -812,28 +814,120 @@ MODULE moduleInput
|
|||
|
||||
END DO
|
||||
|
||||
! Link physical surfaces to boundaries
|
||||
call config%info('boundaries.particles.linking', found, n_children = nPhysicalSurfaces)
|
||||
allocate(boundaryParticlesLinking(1:nPhysicalSurfaces))
|
||||
allocate(speciesNames(1:nSpecies))
|
||||
do b = 1, nPhysicalSurfaces
|
||||
write(iString, '(i2)') b
|
||||
object = 'boundary.particles.linking(' // trim(iString) // ')'
|
||||
call config%get(object // '.physicalSurface', boundaryParticlesLinking(b)%physicalSurface, found)
|
||||
call config%get(object // '.model', speciesNames, found)
|
||||
allocate(boundaryParticlesLinking(b)%speciesIndex(1:nSpecies))
|
||||
do s = 1, nSpecies
|
||||
boundaryParticlesLinking(b)%speciesIndex(s) = boundaryParticlesName_to_Index(speciesNames(s))
|
||||
|
||||
end do
|
||||
|
||||
end do
|
||||
|
||||
!Init the list of particles from surfaces
|
||||
CALL OMP_INIT_LOCK(partSurfaces%lock)
|
||||
|
||||
END SUBROUTINE readBoundaryParticle
|
||||
|
||||
SUBROUTINE readBoundaryEM(config)
|
||||
USE moduleMesh
|
||||
USE moduleOutput
|
||||
USE moduleErrors
|
||||
USE moduleEM
|
||||
USE moduleSpecies
|
||||
USE json_module
|
||||
IMPLICIT NONE
|
||||
|
||||
TYPE(json_file), INTENT(inout):: config
|
||||
CHARACTER(:), ALLOCATABLE:: object
|
||||
LOGICAL:: found
|
||||
INTEGER:: b
|
||||
CHARACTER(2):: bString
|
||||
character(len=100), allocatable:: modelName(:)
|
||||
|
||||
CALL config%info('boundaries.EM.models', found, n_children = nBoundariesEM)
|
||||
|
||||
IF (found) THEN
|
||||
ALLOCATE(boundariesEM(1:nBoundariesEM))
|
||||
|
||||
END IF
|
||||
|
||||
do b = 1, nBoundaryEM
|
||||
write(bString, '(I2)') b
|
||||
object = 'boundaries.EM.models(' // TRIM(bString) // ')'
|
||||
|
||||
call boundariesEM(b)%init(config, object, b)
|
||||
|
||||
end do
|
||||
|
||||
! TODO: Move this to the init of species
|
||||
ALLOCATE(qSpecies(1:nSpecies))
|
||||
DO s = 1, nSpecies
|
||||
SELECT TYPE(sp => species(s)%obj)
|
||||
TYPE IS (speciesCharged)
|
||||
qSpecies(s) = sp%q
|
||||
|
||||
CLASS DEFAULT
|
||||
qSpecies(s) = 0.D0
|
||||
|
||||
END SELECT
|
||||
|
||||
END DO
|
||||
|
||||
END SUBROUTINE readBoundaryEM
|
||||
|
||||
subroutine readPhysicalSurfaces(config)
|
||||
use json_module
|
||||
use moduleMesh
|
||||
use moduleErrors
|
||||
implicit none
|
||||
|
||||
type(json_file), intent(inout):: config
|
||||
character(:), allocatable:: object
|
||||
logical:: found
|
||||
integer:: ps
|
||||
character(2):: psString
|
||||
integer:: nParticleModels
|
||||
character(len=100), allocatable:: particleModels(:)
|
||||
character(len=100):: EMModel
|
||||
integer:: s, boundaryIndex
|
||||
|
||||
call config%info('physicalSurfaces', found, n_children = nPhysicalSurfaces)
|
||||
if (found) then
|
||||
allocate(physicalSurfaces(1:nPhysicalSurfaces))
|
||||
|
||||
else
|
||||
call criticalError('No physical surfaces found in the input file', 'readPhysicalSurfaces')
|
||||
|
||||
end if
|
||||
|
||||
do ps = 1, nPhysicalSurfaces
|
||||
write(ps, '(I2)') ps
|
||||
object = 'physicalSurfaces(' // TRIM(bString) // ')'
|
||||
|
||||
call config%get(object // '.index', physicalSurfaces(ps)%index, found)
|
||||
if (.not. found) then
|
||||
call criticalError('Physical surface index not found', 'readPhysicalSurfaces')
|
||||
|
||||
end if
|
||||
|
||||
! Link models for particles
|
||||
call config%info(object // '.particles', found, n_children = nParticleModels)
|
||||
if ((.not. found) .or. &
|
||||
(nParticleModels /= nSpecies)) then
|
||||
call criticalError('Not enough models for particles provided', 'readPhysicalSurfaces')
|
||||
|
||||
end if
|
||||
call config%get(object // '.particles', particleModels, found)
|
||||
allocate(physicalSurfaces(ps)%particles(1:nSpecies))
|
||||
do s = 1, nSpecies
|
||||
boundaryIndex = boundaryParticlesName_to_Index(particleModels(s))
|
||||
physicalSurfaces(ps)%particles(s)%obj => boundaryParticles(boundaryIndex)%obj
|
||||
|
||||
end do
|
||||
|
||||
! Link electromagnetic boundary condition
|
||||
call config%get(object // '.EM', EMModel, found)
|
||||
if (found) then
|
||||
bouondaryIndex = boundaryEMName_to_Index(EMModel)
|
||||
physicalSurfaces(ps)%EM => boundariesEM(boundaryIndex)%obj
|
||||
|
||||
end if
|
||||
|
||||
end do
|
||||
|
||||
end subroutine readPhysicalSurfaces
|
||||
|
||||
!Read the geometry (mesh) for the case
|
||||
SUBROUTINE readGeometry(config)
|
||||
USE moduleMesh
|
||||
|
|
@ -1081,66 +1175,6 @@ MODULE moduleInput
|
|||
|
||||
END SUBROUTINE readProbes
|
||||
|
||||
SUBROUTINE readBoundaryEM(config)
|
||||
USE moduleMesh
|
||||
USE moduleOutput
|
||||
USE moduleErrors
|
||||
USE moduleEM
|
||||
USE moduleSpecies
|
||||
USE json_module
|
||||
IMPLICIT NONE
|
||||
|
||||
TYPE(json_file), INTENT(inout):: config
|
||||
CHARACTER(:), ALLOCATABLE:: object
|
||||
LOGICAL:: found
|
||||
INTEGER:: b
|
||||
CHARACTER(2):: bString
|
||||
character(len=100), allocatable:: modelName(:)
|
||||
|
||||
CALL config%info('boundaries.EM.models', found, n_children = nBoundariesEM)
|
||||
|
||||
IF (found) THEN
|
||||
ALLOCATE(boundariesEM(1:nBoundariesEM))
|
||||
|
||||
END IF
|
||||
|
||||
do b = 1, nBoundaryEM
|
||||
write(bString, '(I2)') b
|
||||
object = 'boundaries.EM.models(' // TRIM(bString) // ')'
|
||||
|
||||
call boundariesEM(b)%init(config, object, b)
|
||||
|
||||
end do
|
||||
|
||||
! Link physical surfaces to boundaries
|
||||
call config%info('boundaries.EM.linking', found, n_children = nPhysicalSurfaces)
|
||||
allocate(boundaryEMLinking(1:nPhysicalSurfaces))
|
||||
allocate(speciesNames(1:nSpecies))
|
||||
do b = 1, nPhysicalSurfaces
|
||||
write(iString, '(i2)') b
|
||||
object = 'boundary.EM.linking(' // trim(iString) // ')'
|
||||
call config%get(object // '.physicalSurface', boundaryEMLinking(b)%physicalSurface, found)
|
||||
call config%get(object // '.model', modelName, found)
|
||||
boundaryEMLinking(b)%model => boundariesEM(boundaryEMName_to_Index(modelName(s)))%obj
|
||||
|
||||
end do
|
||||
|
||||
! TODO: Move this to the init of species
|
||||
ALLOCATE(qSpecies(1:nSpecies))
|
||||
DO s = 1, nSpecies
|
||||
SELECT TYPE(sp => species(s)%obj)
|
||||
TYPE IS (speciesCharged)
|
||||
qSpecies(s) = sp%q
|
||||
|
||||
CLASS DEFAULT
|
||||
qSpecies(s) = 0.D0
|
||||
|
||||
END SELECT
|
||||
|
||||
END DO
|
||||
|
||||
END SUBROUTINE readBoundaryEM
|
||||
|
||||
!Reads the injection of particles from the boundaries
|
||||
SUBROUTINE readInject(config)
|
||||
USE moduleSpecies
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue