Adding a time step for collisions
A new option has been added in which MCC are computed with its own time step. If no time is provided, then the minimum time step of the simulation is employed.
This commit is contained in:
parent
c6e3238810
commit
b6a7eb9ced
9 changed files with 88 additions and 53 deletions
Binary file not shown.
|
|
@ -29,8 +29,7 @@
|
||||||
\makeglossaries
|
\makeglossaries
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
\newacronym{fpakc}{fpakc}{Finite element PArticle Code}
|
||||||
\newacronym{fpakc}{fpakc}{Finite Element PArticle Code}
|
|
||||||
\newacronym{mpi}{MPI}{Message Passing Interface}
|
\newacronym{mpi}{MPI}{Message Passing Interface}
|
||||||
\newacronym{gpu}{GPU}{Graphics Processing Unit}
|
\newacronym{gpu}{GPU}{Graphics Processing Unit}
|
||||||
\newacronym{cpu}{CPU}{Central Processing Unit}
|
\newacronym{cpu}{CPU}{Central Processing Unit}
|
||||||
|
|
@ -308,7 +307,6 @@ make
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
to compile the code.
|
to compile the code.
|
||||||
If everything is correct, an executable named \textit{fpakc} will be generated.
|
If everything is correct, an executable named \textit{fpakc} will be generated.
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\section{Running the code}
|
\section{Running the code}
|
||||||
To run a case, simply execute:
|
To run a case, simply execute:
|
||||||
|
|
@ -659,6 +657,10 @@ make
|
||||||
The file needs to be located in the folder \textbf{output.folder}.
|
The file needs to be located in the folder \textbf{output.folder}.
|
||||||
If this value is not present, the mesh defined in \textbf{geometry.meshFile} is used for \acrshort{mcc}.
|
If this value is not present, the mesh defined in \textbf{geometry.meshFile} is used for \acrshort{mcc}.
|
||||||
The format of this mesh needs to be the same as the one defined in \textbf{geometry.meshType}.
|
The format of this mesh needs to be the same as the one defined in \textbf{geometry.meshType}.
|
||||||
|
\item \textbf{timeStep}: Real.
|
||||||
|
Units of $\unit{s}$.
|
||||||
|
Time step to calculate MCC.
|
||||||
|
If no time is provided, the minimum time step is used.
|
||||||
\item \textbf{collisions}: Object.
|
\item \textbf{collisions}: Object.
|
||||||
Array.
|
Array.
|
||||||
Contains the different short range interactions (\acrshort{mcc}).
|
Contains the different short range interactions (\acrshort{mcc}).
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ PROGRAM fpakc
|
||||||
tColl = omp_get_wtime()
|
tColl = omp_get_wtime()
|
||||||
!$OMP END SINGLE
|
!$OMP END SINGLE
|
||||||
|
|
||||||
IF (ASSOCIATED(meshForMCC)) CALL meshForMCC%doCollisions()
|
IF (ASSOCIATED(meshForMCC)) CALL meshForMCC%doCollisions(t)
|
||||||
|
|
||||||
!$OMP SINGLE
|
!$OMP SINGLE
|
||||||
tColl = omp_get_wtime() - tColl
|
tColl = omp_get_wtime() - tColl
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ MODULE moduleMeshOutput0D
|
||||||
USE moduleOutput
|
USE moduleOutput
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
|
|
||||||
CLASS(meshGeneric), INTENT(in):: self
|
CLASS(meshGeneric), INTENT(inout):: self
|
||||||
INTEGER, INTENT(in):: t
|
INTEGER, INTENT(in):: t
|
||||||
CHARACTER(:), ALLOCATABLE:: fileName
|
CHARACTER(:), ALLOCATABLE:: fileName
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ MODULE moduleMeshOutput0D
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
OPEN(20, file = path // folder // '/' // fileName, position = 'append', action = 'write')
|
OPEN(20, file = path // folder // '/' // fileName, position = 'append', action = 'write')
|
||||||
WRITE(20, "(ES20.6E3, I20)") REAL(t)*tauMin*ti_ref, mesh%vols(1)%obj%nColl
|
WRITE(20, "(ES20.6E3, I20)") REAL(t)*tauMin*ti_ref, self%vols(1)%obj%nColl
|
||||||
CLOSE(20)
|
CLOSE(20)
|
||||||
|
|
||||||
END SUBROUTINE printColl0D
|
END SUBROUTINE printColl0D
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ MODULE moduleMeshOutputGmsh2
|
||||||
USE moduleOutput
|
USE moduleOutput
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
|
|
||||||
CLASS(meshGeneric), INTENT(in):: self
|
CLASS(meshGeneric), INTENT(inout):: self
|
||||||
INTEGER, INTENT(in):: t
|
INTEGER, INTENT(in):: t
|
||||||
INTEGER:: numEdges
|
INTEGER:: numEdges
|
||||||
INTEGER:: n
|
INTEGER:: n
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ MODULE moduleMesh
|
||||||
SUBROUTINE printColl_interface(self, t)
|
SUBROUTINE printColl_interface(self, t)
|
||||||
IMPORT meshGeneric
|
IMPORT meshGeneric
|
||||||
|
|
||||||
CLASS(meshGeneric), INTENT(in):: self
|
CLASS(meshGeneric), INTENT(inout):: self
|
||||||
INTEGER, INTENT(in):: t
|
INTEGER, INTENT(in):: t
|
||||||
|
|
||||||
END SUBROUTINE printColl_interface
|
END SUBROUTINE printColl_interface
|
||||||
|
|
@ -637,7 +637,7 @@ MODULE moduleMesh
|
||||||
END FUNCTION findCellBrute
|
END FUNCTION findCellBrute
|
||||||
|
|
||||||
!Computes collisions in element
|
!Computes collisions in element
|
||||||
SUBROUTINE doCollisions(self)
|
SUBROUTINE doCollisions(self, t)
|
||||||
USE moduleCollisions
|
USE moduleCollisions
|
||||||
USE moduleSpecies
|
USE moduleSpecies
|
||||||
USE moduleList
|
USE moduleList
|
||||||
|
|
@ -646,6 +646,7 @@ MODULE moduleMesh
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
|
|
||||||
CLASS(meshGeneric), INTENT(inout), TARGET:: self
|
CLASS(meshGeneric), INTENT(inout), TARGET:: self
|
||||||
|
INTEGER, INTENT(in):: t
|
||||||
INTEGER:: e
|
INTEGER:: e
|
||||||
CLASS(meshVol), POINTER:: vol
|
CLASS(meshVol), POINTER:: vol
|
||||||
INTEGER:: nPart !Number of particles inside the cell
|
INTEGER:: nPart !Number of particles inside the cell
|
||||||
|
|
@ -657,14 +658,20 @@ MODULE moduleMesh
|
||||||
REAL(8):: sigmaVrelMaxNew
|
REAL(8):: sigmaVrelMaxNew
|
||||||
TYPE(pointerArray), ALLOCATABLE:: partTemp(:)
|
TYPE(pointerArray), ALLOCATABLE:: partTemp(:)
|
||||||
|
|
||||||
|
IF (MOD(t, everyColl) == 0) THEN
|
||||||
|
!Collisions need to be performed in this iteration
|
||||||
!$OMP DO SCHEDULE(DYNAMIC)
|
!$OMP DO SCHEDULE(DYNAMIC)
|
||||||
DO e=1, self%numVols
|
DO e=1, self%numVols
|
||||||
vol => self%vols(e)%obj
|
vol => self%vols(e)%obj
|
||||||
nPart = vol%listPart_in%amount
|
nPart = vol%listPart_in%amount
|
||||||
|
|
||||||
|
!Resets the number of collisions
|
||||||
|
vol%nColl = 0
|
||||||
|
|
||||||
!Calculates number of collisions if there is more than one particle in the cell
|
!Calculates number of collisions if there is more than one particle in the cell
|
||||||
IF (nPart > 1) THEN
|
IF (nPart > 1) THEN
|
||||||
!Probability of collision
|
!Probability of collision
|
||||||
pMax = vol%totalWeight*vol%sigmaVrelMax*tauMin/vol%volume
|
pMax = vol%totalWeight*vol%sigmaVrelMax*tauColl/vol%volume
|
||||||
|
|
||||||
!Number of collisions in the cell
|
!Number of collisions in the cell
|
||||||
vol%nColl = NINT(REAL(nPart)*pMax*0.5D0)
|
vol%nColl = NINT(REAL(nPart)*pMax*0.5D0)
|
||||||
|
|
@ -701,6 +708,8 @@ MODULE moduleMesh
|
||||||
END DO
|
END DO
|
||||||
!$OMP END DO
|
!$OMP END DO
|
||||||
|
|
||||||
|
END IF
|
||||||
|
|
||||||
END SUBROUTINE doCollisions
|
END SUBROUTINE doCollisions
|
||||||
|
|
||||||
SUBROUTINE doCoulomb(self)
|
SUBROUTINE doCoulomb(self)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ MODULE moduleCaseParam
|
||||||
INTEGER:: tFinal, tInitial = 0
|
INTEGER:: tFinal, tInitial = 0
|
||||||
REAL(8), ALLOCATABLE:: tau(:)
|
REAL(8), ALLOCATABLE:: tau(:)
|
||||||
REAL(8):: tauMin
|
REAL(8):: tauMin
|
||||||
|
REAL(8):: tauColl
|
||||||
|
|
||||||
END MODULE moduleCaseParam
|
END MODULE moduleCaseParam
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ MODULE moduleCollisions
|
||||||
USE moduleSpecies
|
USE moduleSpecies
|
||||||
USE moduleTable
|
USE moduleTable
|
||||||
|
|
||||||
|
!Integer for when collisions are computed
|
||||||
|
INTEGER:: everyColl
|
||||||
|
|
||||||
!Abstract type for collision between two particles
|
!Abstract type for collision between two particles
|
||||||
TYPE, ABSTRACT:: collisionBinary
|
TYPE, ABSTRACT:: collisionBinary
|
||||||
REAL(8):: rMass !Reduced mass
|
REAL(8):: rMass !Reduced mass
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,11 @@ MODULE moduleInput
|
||||||
CALL readSpecies(config)
|
CALL readSpecies(config)
|
||||||
CALL checkStatus(config, "readSpecies")
|
CALL checkStatus(config, "readSpecies")
|
||||||
|
|
||||||
|
!Reads case parameters
|
||||||
|
CALL verboseError('Reading Case parameters...')
|
||||||
|
CALL readCase(config)
|
||||||
|
CALL checkStatus(config, "readCase")
|
||||||
|
|
||||||
!Read interactions between species
|
!Read interactions between species
|
||||||
CALL verboseError('Reading interaction between species...')
|
CALL verboseError('Reading interaction between species...')
|
||||||
CALL readInteractions(config)
|
CALL readInteractions(config)
|
||||||
|
|
@ -55,10 +60,10 @@ MODULE moduleInput
|
||||||
CALL readGeometry(config)
|
CALL readGeometry(config)
|
||||||
CALL checkStatus(config, "readGeometry")
|
CALL checkStatus(config, "readGeometry")
|
||||||
|
|
||||||
!Reads case parameters
|
!Read initial state for species
|
||||||
CALL verboseError('Reading Case parameters...')
|
CALL verboseError('Reading Initial state...')
|
||||||
CALL readCase(config)
|
CALL readInitial(config)
|
||||||
CALL checkStatus(config, "readCase")
|
CALL checkStatus(config, "readInitial")
|
||||||
|
|
||||||
!Read injection of particles
|
!Read injection of particles
|
||||||
CALL verboseError('Reading injection of particles from boundaries...')
|
CALL verboseError('Reading injection of particles from boundaries...')
|
||||||
|
|
@ -233,11 +238,6 @@ MODULE moduleInput
|
||||||
WRITE(tString, '(I1)') iterationDigits
|
WRITE(tString, '(I1)') iterationDigits
|
||||||
iterationFormat = "(I" // tString // "." // tString // ")"
|
iterationFormat = "(I" // tString // "." // tString // ")"
|
||||||
|
|
||||||
!Read initial state for species
|
|
||||||
CALL verboseError('Reading Initial state...')
|
|
||||||
CALL readInitial(config)
|
|
||||||
CALL checkStatus(config, "readInitial")
|
|
||||||
|
|
||||||
END SUBROUTINE readCase
|
END SUBROUTINE readCase
|
||||||
|
|
||||||
!Reads the initial information for the species
|
!Reads the initial information for the species
|
||||||
|
|
@ -558,6 +558,8 @@ MODULE moduleInput
|
||||||
USE moduleCollisions
|
USE moduleCollisions
|
||||||
USE moduleErrors
|
USE moduleErrors
|
||||||
USE moduleMesh
|
USE moduleMesh
|
||||||
|
USE moduleCaseParam
|
||||||
|
USE moduleRefParam
|
||||||
USE OMP_LIB
|
USE OMP_LIB
|
||||||
USE json_module
|
USE json_module
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
|
|
@ -595,6 +597,24 @@ MODULE moduleInput
|
||||||
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
!Reads collision time step
|
||||||
|
CALL config%info('interactions.timeStep', found)
|
||||||
|
IF (found) THEN
|
||||||
|
CALL config%get('interactions.timeStep', tauColl, found)
|
||||||
|
tauColl = tauColl / ti_ref
|
||||||
|
|
||||||
|
ELSE
|
||||||
|
tauColl = tauMin
|
||||||
|
|
||||||
|
END IF
|
||||||
|
|
||||||
|
IF (tauColl < tauMin) THEN
|
||||||
|
CALL criticalError('Collisional time step below minimum time step.', 'readInteractions')
|
||||||
|
|
||||||
|
END IF
|
||||||
|
|
||||||
|
everyColl = NINT(tauColl / tauMin)
|
||||||
|
|
||||||
!Inits the MCC matrix
|
!Inits the MCC matrix
|
||||||
CALL initInteractionMatrix(interactionMatrix)
|
CALL initInteractionMatrix(interactionMatrix)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue