First implementation of multiple pushers for different species
This commit is contained in:
parent
bf5310c2c3
commit
d0bd6e73ed
7 changed files with 238 additions and 92 deletions
|
|
@ -25,15 +25,15 @@ MODULE moduleInput
|
|||
!Reads reference parameters
|
||||
CALL readReference(config)
|
||||
|
||||
!Reads case parameters
|
||||
CALL readCase(config)
|
||||
|
||||
!Reads output parameters
|
||||
CALL readOutput(config)
|
||||
|
||||
!Read species
|
||||
CALL readSpecies(config)
|
||||
|
||||
!Reads case parameters
|
||||
CALL readCase(config)
|
||||
|
||||
!Read interactions between species
|
||||
CALL readInteractions(config)
|
||||
|
||||
|
|
@ -108,44 +108,69 @@ MODULE moduleInput
|
|||
USE moduleErrors
|
||||
USE moduleCaseParam
|
||||
USE moduleSolver
|
||||
USE moduleSpecies
|
||||
USE json_module
|
||||
IMPLICIT NONE
|
||||
|
||||
TYPE(json_file), INTENT(inout):: config
|
||||
LOGICAL:: found
|
||||
REAL(8), ALLOCATABLE:: tauSpecies(:)
|
||||
CHARACTER(:), ALLOCATABLE:: object
|
||||
REAL(8):: time !simulation time in [t]
|
||||
CHARACTER(:), ALLOCATABLE:: solverType
|
||||
CHARACTER(:), ALLOCATABLE:: pusherType, EMType, NAType
|
||||
INTEGER:: nTau, nSolver
|
||||
INTEGER:: i
|
||||
CHARACTER(2):: iString
|
||||
|
||||
object = 'case'
|
||||
!Time parameters
|
||||
CALL config%get(object // '.tau', tau, found)
|
||||
IF (.NOT. found) CALL criticalError('Required parameter tau not found','readCase')
|
||||
|
||||
!Time parameters
|
||||
CALL config%info(object // '.tau', found, n_children = nTau)
|
||||
IF (.NOT. found .OR. nTau == 0) CALL criticalError('Required parameter tau not found','readCase')
|
||||
ALLOCATE(tauSpecies(1:nSpecies))
|
||||
DO i = 1, nTau
|
||||
WRITE(iString, '(I2)') i
|
||||
CALL config%get(object // '.tau(' // TRIM(iString) // ')', tauSpecies(i), found)
|
||||
|
||||
END DO
|
||||
IF (nTau < nSpecies) THEN
|
||||
CALL warningError('Using minimum time step for some species')
|
||||
tauSpecies(nTau+1:nSpecies) = MINVAL(tauSpecies(1:nTau))
|
||||
|
||||
END IF
|
||||
!Selects the minimum tau as reference value
|
||||
tau = MINVAL(tauSpecies)
|
||||
|
||||
!Gets the simulation time
|
||||
CALL config%get(object // '.time', time, found)
|
||||
IF (.NOT. found) CALL criticalError('Required parameter time not found','readCase')
|
||||
|
||||
CALL config%get(object // '.solver', solverType, found)
|
||||
IF (.NOT. found) CALL criticalError('Required parameter solver not found','readCase')
|
||||
|
||||
!Allocate the type of solver
|
||||
SELECT CASE(solverType)
|
||||
CASE('2DCylNeutral')
|
||||
!Allocate the solver for neutral pusher 2D Cylindrical
|
||||
ALLOCATE(solver, source=solverCylNeutral())
|
||||
|
||||
CASE('2DCylCharged')
|
||||
!Allocate the solver for charged pusher 2D Cylindrical
|
||||
ALLOCATE(solver, source=solverCylCharged())
|
||||
|
||||
CASE DEFAULT
|
||||
CALL criticalError('Solver ' // solverType // ' not found','readCase')
|
||||
|
||||
END SELECT
|
||||
|
||||
!Convert simulation time to number of iterations
|
||||
tmax = INT(time/tau)
|
||||
|
||||
!Gest the pusher for each species
|
||||
CALL config%info(object // '.pusher', found, n_children = nSolver)
|
||||
IF (.NOT. found .OR. nSolver /= nSpecies) CALL criticalError('Required parameter pusher not found','readCase')
|
||||
!Allocates all the pushers for particles
|
||||
ALLOCATE(solver%pusher(1:nSpecies))
|
||||
!Initialize pushers
|
||||
DO i = 1, nSolver
|
||||
WRITE(iString, '(I2)') i
|
||||
CALL config%get(object // '.pusher(' // TRIM(iString) // ')', pusherType, found)
|
||||
|
||||
!Associate the type of solver
|
||||
CALL solver%pusher(i)%init(pusherType, tau, tauSpecies(i))
|
||||
|
||||
END DO
|
||||
|
||||
!Gets the solver for the electromagnetic field
|
||||
CALL config%get(object // '.EMSolver', EMType, found)
|
||||
CALL solver%initEM(EMType)
|
||||
|
||||
!Gest the non-analogue scheme
|
||||
CALL config%get(object // '.NAScheme', NAType, found)
|
||||
CALL solver%initNA(NAType)
|
||||
|
||||
|
||||
!Makes tau non-dimensional
|
||||
tau = tau / ti_ref
|
||||
|
||||
|
|
@ -234,7 +259,7 @@ MODULE moduleInput
|
|||
!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%pt = i
|
||||
species(i)%obj%sp = i
|
||||
species(i)%obj%m = mass
|
||||
|
||||
END DO
|
||||
|
|
@ -462,7 +487,7 @@ MODULE moduleInput
|
|||
REAL(8):: flow
|
||||
CHARACTER(:), ALLOCATABLE:: units
|
||||
INTEGER:: physicalSurface
|
||||
INTEGER:: pt
|
||||
INTEGER:: sp
|
||||
|
||||
CALL config%info('inject', found, n_children = nInject)
|
||||
ALLOCATE(inject(1:nInject))
|
||||
|
|
@ -473,7 +498,7 @@ MODULE moduleInput
|
|||
|
||||
!Find species
|
||||
CALL config%get(object // '.species', speciesName, found)
|
||||
pt = speciesName2Index(speciesName)
|
||||
sp = speciesName2Index(speciesName)
|
||||
|
||||
CALL config%get(object // '.name', name, found)
|
||||
CALL config%get(object // '.v', v, found)
|
||||
|
|
@ -483,7 +508,7 @@ MODULE moduleInput
|
|||
CALL config%get(object // '.units', units, found)
|
||||
CALL config%get(object // '.physicalSurface', physicalSurface, found)
|
||||
|
||||
CALL inject(i)%init(i, v, normal, T, flow, units, pt, physicalSurface)
|
||||
CALL inject(i)%init(i, v, normal, T, flow, units, sp, physicalSurface)
|
||||
|
||||
END DO
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue