Big one...

I should've commited before, but I wanted to make things compile.

The big change is that I've added a global time step so the parameter
does not need to be passed in each function. This is useful as we are
moving towards using time profiles for boundary conditions and injection
of particles (not in this branch, but in the future and the procedure
will be quite similar)
This commit is contained in:
Jorge Gonzalez 2024-07-12 23:08:19 +02:00
commit ac27725940
14 changed files with 340 additions and 220 deletions

View file

@ -27,7 +27,7 @@ MODULE moduleProbe
CONTAINS
!Functions for probeDistFunc type
SUBROUTINE init(self, id, speciesName, r, v1, v2, v3, points, timeStep)
SUBROUTINE init(self, id, speciesName, r, v1, v2, v3, points, everyTimeStep)
USE moduleCaseParam
USE moduleRefParam
USE moduleSpecies
@ -41,7 +41,7 @@ MODULE moduleProbe
REAL(8), INTENT(in):: r(1:3)
REAL(8), INTENT(in):: v1(1:2), v2(1:2), v3(1:2)
INTEGER, INTENT(in):: points(1:3)
REAL(8), INTENT(in):: timeStep
REAL(8), INTENT(in):: everyTimeStep
INTEGER:: sp, i
REAL(8):: dv(1:3)
@ -91,11 +91,11 @@ MODULE moduleProbe
1:self%nv(3)))
!Number of iterations between output
IF (timeStep == 0.D0) THEN
IF (everyTimeStep == 0.D0) THEN
self%every = 1
ELSE
self%every = NINT(timeStep/ tauMin / ti_ref)
self%every = NINT(everyTimeStep/ tauMin / ti_ref)
END IF
@ -189,13 +189,13 @@ MODULE moduleProbe
END SUBROUTINE calculate
SUBROUTINE output(self, t)
SUBROUTINE output(self)
USE moduleOutput
USE moduleRefParam
USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE
CLASS(probeDistFunc), INTENT(inout):: self
INTEGER, INTENT(in):: t
CHARACTER (LEN=iterationDigits):: tstring
CHARACTER (LEN=3):: pstring
CHARACTER(:), ALLOCATABLE:: filename
@ -204,14 +204,14 @@ MODULE moduleProbe
!Divide by the velocity cube volume
self%f = self%f * self%dvInv
WRITE(tstring, iterationFormat) t
WRITE(tstring, iterationFormat) timeStep
WRITE(pstring, "(I3.3)") self%id
fileName='Probe_' // tstring// '_f_' // pstring // '.dat'
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
OPEN (10, file = path // folder // '/' // fileName)
WRITE(10, "(A1, 1X, A)") "# ", self%species%name
WRITE(10, "(A6, 3(ES15.6E3), A2)") "# r = ", self%r(:)*L_ref, " m"
WRITE(10, "(A6, ES15.6E3, A2)") "# t = ", REAL(t)*tauMin*ti_ref, " s"
WRITE(10, "(A6, ES15.6E3, A2)") "# t = ", REAL(timeStep)*tauMin*ti_ref, " s"
WRITE(10, "(A1, A19, 3(A20))") "#", "v1 (m s^-1)", "v2 (m s^-1)", "v3 (m s^-1)", "f"
DO i = 1, self%nv(1)
DO j = 1, self%nv(2)
@ -252,15 +252,15 @@ MODULE moduleProbe
END SUBROUTINE doProbes
SUBROUTINE outputProbes(t)
SUBROUTINE outputProbes()
USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE
INTEGER, INTENT(in):: t
INTEGER:: i
DO i = 1, nProbes
IF (probe(i)%update) THEN
CALL probe(i)%output(t)
CALL probe(i)%output()
END IF
@ -268,15 +268,15 @@ MODULE moduleProbe
END SUBROUTINE outputProbes
SUBROUTINE resetProbes(t)
SUBROUTINE resetProbes()
USE moduleCaseParam, ONLY: timeStep
IMPLICIT NONE
INTEGER, INTENT(in):: t
INTEGER:: i
DO i = 1, nProbes
probe(i)%f = 0.D0
probe(i)%update = t == tFinal .OR. t == tInitial .OR. MOD(t, probe(i)%every) == 0
probe(i)%update = timeStep == tFinal .OR. timeStep == tInitial .OR. MOD(timeStep, probe(i)%every) == 0
END DO