Implementation of initial iteration.

An initial simulation time can be provided in the input file. This is
useful when restarting a simulation from a previous file. If no
initial time is provided, the value 0 is used.
This commit is contained in:
Jorge Gonzalez 2021-04-17 10:45:52 +02:00
commit dee860e37b
7 changed files with 38 additions and 26 deletions

View file

@ -22,7 +22,7 @@ MODULE moduleInput
!Loads the config file
CALL verboseError('Loading input file...')
CALL config%load(filename = inputFile)
CALL checkStatus(config, "load")
CALL checkStatus(config, "loading")
!Reads reference parameters
CALL verboseError('Reading Reference parameters...')
@ -151,7 +151,8 @@ MODULE moduleInput
TYPE(json_file), INTENT(inout):: config
LOGICAL:: found
CHARACTER(:), ALLOCATABLE:: object
REAL(8):: time !simulation time in [t]
!simulation final and initial times in [t]
REAL(8):: finalTime, initialTime
CHARACTER(:), ALLOCATABLE:: pusherType, EMType, WSType
INTEGER:: nTau, nSolver
INTEGER:: i
@ -176,11 +177,15 @@ MODULE moduleInput
END IF
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')
!Gets the simulation final time
CALL config%get(object // '.finalTime', finalTime, found)
IF (.NOT. found) CALL criticalError('Required parameter finalTime not found','readCase')
!Convert simulation time to number of iterations
tmax = INT(time/tauMin)
tFinal = INT(finalTime / tauMin)
!Gets the simulation initial time
CALL config%get(object // '.initialTime', initialTime, found)
IF (found) tInitial = INT(initialTime / tauMin)
!Gest the pusher for each species
CALL config%info(object // '.pusher', found, n_children = nSolver)
@ -215,7 +220,7 @@ MODULE moduleInput
tauMin = tauMin / ti_ref
!Sets the format of output files accordint to iteration number
iterationDigits = INT(LOG10(REAL(tmax))) + 1
iterationDigits = INT(LOG10(REAL(tFinal))) + 1
WRITE(tString, '(I1)') iterationDigits
iterationFormat = "(I" // tString // "." // tString // ")"
@ -327,10 +332,10 @@ MODULE moduleInput
temperatureXi = temperatureXi / T_ref
vTh = DSQRT(temperatureXi / species(sp)%obj%m)
partNew%v(1) = velocityXi(1) + vTh*randomMaxwellian()
partNew%v(2) = velocityXi(2) + vTh*randomMaxwellian()
partNew%v(3) = velocityXi(3) + vTh*randomMaxwellian()
partNew%vol = e
partNew%v(1) = velocityXi(1) + vTh*randomMaxwellian()
partNew%v(2) = velocityXi(2) + vTh*randomMaxwellian()
partNew%v(3) = velocityXi(3) + vTh*randomMaxwellian()
partNew%vol = e
IF (ASSOCIATED(meshForMCC, mesh)) THEN
partNew%volColl = partNew%vol
@ -338,8 +343,8 @@ MODULE moduleInput
partNew%volColl = findCellBrute(meshColl, partNew%r)
END IF
partNew%n_in = .TRUE.
partNew%weight = species(sp)%obj%weight
partNew%n_in = .TRUE.
partNew%weight = species(sp)%obj%weight
!If charged species, add qm to particle
SELECT TYPE(sp => species(sp)%obj)
TYPE IS (speciesCharged)