diff --git a/src/fpakc.f90 b/src/fpakc.f90 index 03d0bbb..1224f53 100644 --- a/src/fpakc.f90 +++ b/src/fpakc.f90 @@ -114,6 +114,8 @@ PROGRAM fpakc !$OMP SINGLE tEMField = omp_get_wtime() - tEMField + CALL doAverage(t) + tStep = omp_get_wtime() - tStep !Output data diff --git a/src/modules/moduleAverage.f90 b/src/modules/moduleAverage.f90 index b697389..bbea577 100644 --- a/src/modules/moduleAverage.f90 +++ b/src/modules/moduleAverage.f90 @@ -9,7 +9,7 @@ MODULE moduleAverage !Generic type for average scheme TYPE, PUBLIC:: averageGeneric - INTEGER:: tStart = 0 !Starting iteartion for average scheme + INTEGER:: tStart = 1 !Starting iteartion for average scheme TYPE(averageData), ALLOCATABLE:: mean(:) TYPE(averageData), ALLOCATABLE:: deviation(:) CONTAINS @@ -47,6 +47,8 @@ MODULE moduleAverage END DO ELSEIF (tAverage > 1) THEN + ALLOCATE(newAverage%output(1:nSpecies)) + !Normal average step DO n = 1, mesh%numNodes DO s = 1, nSpecies @@ -58,6 +60,8 @@ MODULE moduleAverage END DO + DEALLOCATE(newAverage%output) + END IF END SUBROUTINE updateAverage diff --git a/src/modules/moduleInput.f90 b/src/modules/moduleInput.f90 index de6cc65..3463f9e 100644 --- a/src/modules/moduleInput.f90 +++ b/src/modules/moduleInput.f90 @@ -75,6 +75,11 @@ MODULE moduleInput CALL readInject(config) CALL checkStatus(config, "readInject") + !Read average scheme + CALL verboseError('Reading average scheme...') + CALL readAverage(config) + CALL checkStatus(config, "readAverage") + !Read parallel parameters CALL verboseError('Reading Parallel configuration...') CALL readParallel(config) @@ -1180,6 +1185,37 @@ MODULE moduleInput END SUBROUTINE readInject + SUBROUTINE readAverage(config) + USE moduleAverage + USE moduleCaseParam, ONLY: tauMin + USE moduleMesh, ONLY: mesh + USE moduleSpecies, ONLY: nSpecies + IMPLICIT NONE + + TYPE(json_file), INTENT(inout):: config + LOGICAL:: found + REAL(8):: tStart + INTEGER:: n + + CALL config%info('average', found) + IF (found) THEN + useAverage = .TRUE. + CALL config%get('average.startTime', tStart, found) + + IF (found) THEN + averageScheme%tStart = INT(tStart / tauMin) + + END IF + ALLOCATE(averageScheme%mean(1:mesh%numNodes)) + DO n = 1, mesh%numNodes + ALLOCATE(averageScheme%mean(n)%output(1:nSpecies)) + + END DO + + END IF + + END SUBROUTINE readAverage + !Reads the velocity distribution functions for each inject SUBROUTINE readVelDistr(config, inj, object) USE moduleErrors