diff --git a/doc/user-manual/fpakc_UserManual.pdf b/doc/user-manual/fpakc_UserManual.pdf index 7a7e972..99e12e7 100644 Binary files a/doc/user-manual/fpakc_UserManual.pdf and b/doc/user-manual/fpakc_UserManual.pdf differ diff --git a/doc/user-manual/fpakc_UserManual.tex b/doc/user-manual/fpakc_UserManual.tex index 2c52175..6477cff 100644 --- a/doc/user-manual/fpakc_UserManual.tex +++ b/doc/user-manual/fpakc_UserManual.tex @@ -595,8 +595,13 @@ make Array dimension 'number of species'. Defines the different time steps for each species. Even if all time steps are equal, they need to be defined as an array. - \item \textbf{time}: Real. - Total simulation time in $\unit{s}$. + \item \textbf{finalTime}: Real. + Units of $\unit{s}$. + Final simulation time. + \item \textbf{initialTime}: Real. + Units of $\unit{s}$. + Initial simulation time. + If no value is provided, the initial time is set to $\unit[0]{s}$. \item \textbf{pusher}: Character. Array dimension 'number of species'. Indicates the type of pusher used for each species: diff --git a/src/fpakc.f90 b/src/fpakc.f90 index 4028ba9..308a0b5 100644 --- a/src/fpakc.f90 +++ b/src/fpakc.f90 @@ -11,7 +11,7 @@ PROGRAM fpakc IMPLICIT NONE ! t = time step - INTEGER:: t = 0 + INTEGER:: t ! arg1 = Input argument 1 (input file) CHARACTER(200):: arg1 ! inputFile = path+name of input file @@ -26,6 +26,8 @@ PROGRAM fpakc !Reads the json configuration file CALL readConfig(inputFile) + !Do '0' iteration + t = tInitial !$OMP PARALLEL DEFAULT(SHARED) !$OMP SINGLE @@ -45,7 +47,7 @@ PROGRAM fpakc CALL doOutput(t) CALL verboseError('Starting main loop...') !$OMP PARALLEL DEFAULT(SHARED) - DO t = 1, tmax + DO t = tInitial + 1, tFinal !Insert new particles and push them !$OMP SINGLE tStep = omp_get_wtime() diff --git a/src/modules/mesh/inout/gmsh2/moduleMeshOutputGmsh2.f90 b/src/modules/mesh/inout/gmsh2/moduleMeshOutputGmsh2.f90 index 43b1ef8..92d4a5b 100644 --- a/src/modules/mesh/inout/gmsh2/moduleMeshOutputGmsh2.f90 +++ b/src/modules/mesh/inout/gmsh2/moduleMeshOutputGmsh2.f90 @@ -29,7 +29,7 @@ MODULE moduleMeshOutputGmsh2 WRITE(60, "(A)") '$EndMeshFormat' WRITE(60, "(A)") '$NodeData' WRITE(60, "(A)") '1' - WRITE(60, "(A)") '"Density ' // species(i)%obj%name // ' (m^-3)"' + WRITE(60, "(A)") '"' // species(i)%obj%name // ' density (m^-3)"' WRITE(60, *) 1 WRITE(60, *) time WRITE(60, *) 3 @@ -43,7 +43,7 @@ MODULE moduleMeshOutputGmsh2 WRITE(60, "(A)") '$EndNodeData' WRITE(60, "(A)") '$NodeData' WRITE(60, "(A)") '1' - WRITE(60, "(A)") '"Velocity ' // species(i)%obj%name // ' (m/s)"' + WRITE(60, "(A)") '"' // species(i)%obj%name // ' velocity (m/s)"' WRITE(60, *) 1 WRITE(60, *) time WRITE(60, *) 3 @@ -56,7 +56,7 @@ MODULE moduleMeshOutputGmsh2 WRITE(60, "(A)") '$EndNodeData' WRITE(60, "(A)") '$NodeData' WRITE(60, "(A)") '1' - WRITE(60, "(A)") '"Pressure ' // species(i)%obj%name // ' (Pa)"' + WRITE(60, "(A)") '"' // species(i)%obj%name // ' pressure (Pa)"' WRITE(60, *) 1 WRITE(60, *) time WRITE(60, *) 3 @@ -69,7 +69,7 @@ MODULE moduleMeshOutputGmsh2 WRITE(60, "(A)") '$EndNodeData' WRITE(60, "(A)") '$NodeData' WRITE(60, "(A)") '1' - WRITE(60, "(A)") '"Temperature ' // species(i)%obj%name // ' (K)"' + WRITE(60, "(A)") '"' // species(i)%obj%name // ' temperature (K)"' WRITE(60, *) 1 WRITE(60, *) time WRITE(60, *) 3 diff --git a/src/modules/moduleCaseParam.f90 b/src/modules/moduleCaseParam.f90 index 5f1023a..c8df0e4 100644 --- a/src/modules/moduleCaseParam.f90 +++ b/src/modules/moduleCaseParam.f90 @@ -1,7 +1,7 @@ !Problems of the case MODULE moduleCaseParam - !Maximum number of iterations and number of species - INTEGER:: tmax + !Final and initial iterations + INTEGER:: tFinal, tInitial = 0 REAL(8), ALLOCATABLE:: tau(:) REAL(8):: tauMin diff --git a/src/modules/moduleInput.f90 b/src/modules/moduleInput.f90 index 6841f4f..b63427c 100644 --- a/src/modules/moduleInput.f90 +++ b/src/modules/moduleInput.f90 @@ -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) diff --git a/src/modules/moduleSolver.f90 b/src/modules/moduleSolver.f90 index 84fa4e2..0f78a5e 100644 --- a/src/modules/moduleSolver.f90 +++ b/src/modules/moduleSolver.f90 @@ -833,7 +833,7 @@ MODULE moduleSolver counterOutput = counterOutput + 1 IF (counterOutput >= triggerOutput .OR. & - t == tmax .OR. t == 0) THEN + t == tFinal .OR. t == tInitial) THEN !Resets output counter counterOutput=0 @@ -841,7 +841,7 @@ MODULE moduleSolver CALL mesh%printOutput(t) IF (ASSOCIATED(meshForMCC)) CALL meshForMCC%printColl(t) CALL mesh%printEM(t) - WRITE(*, "(5X,A21,I10,A1,I10)") "t/tmax: ", t, "/", tmax + WRITE(*, "(5X,A21,I10,A1,I10)") "t/tFinal: ", t, "/", tFinal WRITE(*, "(5X,A21,I10)") "Particles: ", nPartOld IF (t == 0) THEN WRITE(*, "(5X,A21,F8.1,A2)") " init time: ", 1.D3*tStep, "ms" @@ -861,7 +861,7 @@ MODULE moduleSolver counterCPUTime = counterCPUTime + 1 IF (counterCPUTime >= triggerCPUTime .OR. & - t == tmax .OR. t == 0) THEN + t == tFinal .OR. t == tInitial) THEN !Reset CPU Time counter counterCPUTime = 0