Code cleanup
This commit is contained in:
parent
3a4bf7413d
commit
5d82ea2ddc
14 changed files with 56 additions and 60 deletions
|
|
@ -509,6 +509,7 @@ MODULE moduleInput
|
|||
USE moduleRefParam
|
||||
USE moduleList
|
||||
USE json_module
|
||||
use moduleMesh, only: qSpecies
|
||||
IMPLICIT NONE
|
||||
|
||||
TYPE(json_file), INTENT(inout):: config
|
||||
|
|
@ -517,7 +518,7 @@ MODULE moduleInput
|
|||
CHARACTER(:), ALLOCATABLE:: speciesType
|
||||
REAL(8):: mass, charge
|
||||
LOGICAL:: found
|
||||
INTEGER:: i
|
||||
INTEGER:: s
|
||||
CHARACTER(:), ALLOCATABLE:: linkName
|
||||
INTEGER:: linkID
|
||||
|
||||
|
|
@ -529,8 +530,8 @@ MODULE moduleInput
|
|||
ALLOCATE(species(1:nSpecies))
|
||||
|
||||
!Reads information of individual species
|
||||
DO i = 1, nSpecies
|
||||
WRITE(iString, '(I2)') i
|
||||
DO s = 1, nSpecies
|
||||
WRITE(iString, '(I2)') s
|
||||
object = 'species(' // TRIM(iString) // ')'
|
||||
CALL config%get(object // '.type', speciesType, found)
|
||||
CALL config%get(object // '.mass', mass, found)
|
||||
|
|
@ -539,12 +540,12 @@ MODULE moduleInput
|
|||
!Allocate species depending on type and assign specific parameters
|
||||
SELECT CASE(speciesType)
|
||||
CASE ("neutral")
|
||||
ALLOCATE(species(i)%obj, source=speciesNeutral())
|
||||
ALLOCATE(species(s)%obj, source=speciesNeutral())
|
||||
|
||||
CASE ("charged")
|
||||
CALL config%get(object // '.charge', charge, found)
|
||||
IF (.NOT. found) CALL criticalError("Required parameter charge not found for species " // object, 'readSpecies')
|
||||
ALLOCATE(species(i)%obj, source=speciesCharged(q = charge, &
|
||||
ALLOCATE(species(s)%obj, source=speciesCharged(q = charge, &
|
||||
qm = charge/mass))
|
||||
|
||||
CASE DEFAULT
|
||||
|
|
@ -552,18 +553,32 @@ MODULE moduleInput
|
|||
|
||||
END SELECT
|
||||
!Assign shared parameters for all species
|
||||
CALL config%get(object // '.name', species(i)%obj%name, found)
|
||||
CALL config%get(object // '.weight', species(i)%obj%weight, found)
|
||||
species(i)%obj%n = i
|
||||
species(i)%obj%m = mass
|
||||
CALL config%get(object // '.name', species(s)%obj%name, found)
|
||||
CALL config%get(object // '.weight', species(s)%obj%weight, found)
|
||||
species(s)%obj%n = s
|
||||
species(s)%obj%m = mass
|
||||
|
||||
END DO
|
||||
|
||||
! Allocate the vector with the species charges for calculating the EM field
|
||||
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
|
||||
|
||||
!Read relations between species
|
||||
DO i = 1, nSpecies
|
||||
WRITE(iString, '(I2)') i
|
||||
DO s = 1, nSpecies
|
||||
WRITE(iString, '(I2)') s
|
||||
object = 'species(' // TRIM(iString) // ')'
|
||||
SELECT TYPE(sp => species(i)%obj)
|
||||
SELECT TYPE(sp => species(s)%obj)
|
||||
TYPE IS (speciesNeutral)
|
||||
!Get species linked ion
|
||||
CALL config%get(object // '.ion', linkName, found)
|
||||
|
|
@ -921,7 +936,7 @@ MODULE moduleInput
|
|||
TYPE(json_file), INTENT(inout):: config
|
||||
CHARACTER(:), ALLOCATABLE:: object
|
||||
LOGICAL:: found
|
||||
INTEGER:: b, s
|
||||
INTEGER:: b
|
||||
CHARACTER(2):: bString
|
||||
character(:), allocatable:: bType
|
||||
|
||||
|
|
@ -976,20 +991,6 @@ MODULE moduleInput
|
|||
|
||||
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)
|
||||
|
|
@ -1081,7 +1082,6 @@ MODULE moduleInput
|
|||
integer:: b, ps, s
|
||||
integer:: e
|
||||
integer:: nVolColl
|
||||
integer:: boundaryIndex
|
||||
|
||||
object = 'geometry'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue