Implementation of different time steps per species.

This commit is contained in:
Jorge Gonzalez 2020-12-01 17:37:22 +01:00
commit a5d5ceb53d
8 changed files with 80 additions and 38 deletions

View file

@ -114,7 +114,6 @@ MODULE moduleInput
TYPE(json_file), INTENT(inout):: config
LOGICAL:: found
REAL(8), ALLOCATABLE:: tauSpecies(:)
CHARACTER(:), ALLOCATABLE:: object
REAL(8):: time !simulation time in [t]
CHARACTER(:), ALLOCATABLE:: pusherType, EMType, NAType
@ -127,25 +126,24 @@ MODULE moduleInput
!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))
ALLOCATE(tau(1:nSpecies))
DO i = 1, nTau
WRITE(iString, '(I2)') i
CALL config%get(object // '.tau(' // TRIM(iString) // ')', tauSpecies(i), found)
CALL config%get(object // '.tau(' // TRIM(iString) // ')', tau(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))
tau(nTau+1:nSpecies) = MINVAL(tau(1:nTau))
END IF
!Selects the minimum tau as reference value
tau = MINVAL(tauSpecies)
tauMin = MINVAL(tau)
!Gets the simulation time
CALL config%get(object // '.time', time, found)
IF (.NOT. found) CALL criticalError('Required parameter time not found','readCase')
!Convert simulation time to number of iterations
tmax = INT(time/tau)
tmax = INT(time/tauMin)
!Gest the pusher for each species
CALL config%info(object // '.pusher', found, n_children = nSolver)
@ -158,7 +156,7 @@ MODULE moduleInput
CALL config%get(object // '.pusher(' // TRIM(iString) // ')', pusherType, found)
!Associate the type of solver
CALL solver%pusher(i)%init(pusherType, tau, tauSpecies(i))
CALL solver%pusher(i)%init(pusherType, tauMin, tau(i))
END DO
@ -173,6 +171,7 @@ MODULE moduleInput
!Makes tau non-dimensional
tau = tau / ti_ref
tauMin = tauMin / ti_ref
END SUBROUTINE readCase