Huge improvement in reset (by increasing a little bit push time) using
OMP locks to assign particles to cells in the pushing step. Trying to combine push+reset and collision+scatter did not work.
This commit is contained in:
parent
1686da7694
commit
fd42e0f3f9
7 changed files with 101 additions and 92 deletions
|
|
@ -8,43 +8,43 @@ OBJS = moduleCaseParam.o moduleCompTime.o moduleList.o\
|
|||
all: $(OBJS)
|
||||
|
||||
moduleCollisions.o: moduleTable.o moduleSpecies.o moduleRefParam.o moduleConstParam.o moduleMeshCyl.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleInput.o: moduleParallel.o moduleRefParam.o moduleCaseParam.o moduleSolver.o moduleInject.o moduleBoundary.o moduleMesh.o moduleMeshCylRead.o moduleErrors.o moduleSpecies.o moduleInput.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleInject.o: moduleSpecies.o moduleSolver.o moduleMesh.o moduleMeshCyl.o moduleInject.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleList.o: moduleSpecies.o moduleErrors.o moduleList.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleMesh.o: moduleOutput.o moduleList.o moduleSpecies.o moduleMesh.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleMeshCyl.o: moduleRefParam.o moduleCollisions.o moduleOutput.o moduleMesh.o moduleMeshCyl.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleMeshCylBoundary.o: moduleMeshCyl.o moduleMeshCylBoundary.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleMeshCylRead.o: moduleBoundary.o moduleMeshCyl.o moduleMeshCylBoundary.o moduleMeshCylRead.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleOutput.o: moduleSpecies.o moduleRefParam.o moduleOutput.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleRefParam.o: moduleConstParam.o moduleRefParam.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleSpecies.o: moduleCaseParam.o moduleSpecies.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleSolver.o: moduleSpecies.o moduleRefParam.o moduleMesh.o moduleOutput.o moduleSolver.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
moduleTable.o: moduleErrors.o moduleTable.f95
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f95,$@) -o $(OBJDIR)/$@
|
||||
|
||||
%.o: %.f95
|
||||
$(FC) $(FCFLAGS) -c $< -o $(OBJDIR)/$@
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ MODULE moduleList
|
|||
END TYPE listNode
|
||||
|
||||
CONTAINS
|
||||
!Finalize node
|
||||
!Adds element to list
|
||||
SUBROUTINE addToList(this,part)
|
||||
USE moduleSpecies
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
MODULE moduleMesh
|
||||
USE moduleList
|
||||
USE moduleOutput
|
||||
USE OMP_LIB
|
||||
IMPLICIT NONE
|
||||
|
||||
!Parent of Node element
|
||||
|
|
@ -90,6 +91,8 @@ MODULE moduleMesh
|
|||
REAL(8):: volume = 0.D0
|
||||
!List of particles inside the volume
|
||||
TYPE(listNode):: listPart_in
|
||||
!Lock indicator for listPart_in
|
||||
INTEGER(KIND=OMP_LOCK_KIND):: lock
|
||||
!Number of collisions per volume
|
||||
INTEGER:: nColl = 0
|
||||
CONTAINS
|
||||
|
|
@ -131,7 +134,7 @@ MODULE moduleMesh
|
|||
IMPORT:: meshVol
|
||||
CLASS(meshVol), INTENT(inout):: self
|
||||
CLASS(meshVol), OPTIONAL, INTENT(in):: oldCell
|
||||
CLASS(particle), INTENT(inout):: part
|
||||
CLASS(particle), INTENT(inout), TARGET:: part
|
||||
|
||||
END SUBROUTINE findCell_interface
|
||||
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ MODULE moduleMeshCyl
|
|||
|
||||
self%sigmaVrelMax = sigma_ref/L_ref**2
|
||||
|
||||
CALL OMP_INIT_LOCK(self%lock)
|
||||
|
||||
END SUBROUTINE initVolQuadCyl
|
||||
|
||||
FUNCTION fpsi(xi1,xi2) RESULT(psi)
|
||||
|
|
@ -433,7 +435,7 @@ MODULE moduleMeshCyl
|
|||
|
||||
CLASS(meshVolCylQuad), INTENT(inout):: self
|
||||
CLASS(meshVol), OPTIONAL, INTENT(in):: oldCell
|
||||
CLASS(particle), INTENT(inout):: part
|
||||
CLASS(particle), INTENT(inout), TARGET:: part
|
||||
REAL(8):: xLog(1:2)
|
||||
REAL(8):: xLogArray(1:4)
|
||||
CLASS(*), POINTER:: nextElement
|
||||
|
|
@ -445,9 +447,15 @@ MODULE moduleMeshCyl
|
|||
IF (PRESENT(oldCell)) THEN
|
||||
!If oldCell, recalculate particle weight, as particle has entered a new cell.
|
||||
part%weight = part%weight*oldCell%volume/self%volume
|
||||
|
||||
END IF
|
||||
part%e_p = self%n
|
||||
part%xLog = xLog
|
||||
!Assign particle to listPart_in
|
||||
CALL OMP_SET_LOCK(self%lock)
|
||||
CALL self%listPart_in%add(part)
|
||||
CALL OMP_UNSET_LOCK(self%lock)
|
||||
|
||||
ELSE
|
||||
!If not, searches for a neighbour and repeats the process.
|
||||
xLogArray = (/ -xLog(2), xLog(1), xLog(2), -xLog(1) /)
|
||||
|
|
@ -514,8 +522,6 @@ MODULE moduleMeshCyl
|
|||
|
||||
|
||||
SUBROUTINE collision2DCyl(self)
|
||||
USE moduleRefParam
|
||||
USE moduleConstParam
|
||||
USE moduleCollisions
|
||||
USE moduleSpecies
|
||||
USE moduleList
|
||||
|
|
@ -549,8 +555,11 @@ MODULE moduleMeshCyl
|
|||
|
||||
END DO
|
||||
|
||||
!Update maximum cross section times vrelative per each collision
|
||||
IF (sigmaVrelMaxNew > self%sigmaVrelMax) self%sigmaVrelMax = sigmaVrelMaxNew
|
||||
!Update maximum cross section*v_rel per each collision
|
||||
IF (sigmaVrelMaxNew > self%sigmaVrelMax) THEN
|
||||
self%sigmaVrelMax = sigmaVrelMaxNew
|
||||
|
||||
END IF
|
||||
|
||||
END DO
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
MODULE moduleSolver
|
||||
|
||||
CONTAINS
|
||||
|
||||
SUBROUTINE scatterGrid(meshIn, partArray)
|
||||
USE moduleSpecies
|
||||
USE moduleMesh
|
||||
|
|
@ -53,15 +52,14 @@ MODULE moduleSolver
|
|||
part_temp%v(3) = -sin_alpha*v_p_oh_star(2)+cos_alpha*v_p_oh_star(3)
|
||||
part_temp%pt = part%pt
|
||||
part_temp%e_p = part%e_p
|
||||
!Assign cell to particle
|
||||
!Copy temporal particle to particle
|
||||
part=part_temp
|
||||
|
||||
END SUBROUTINE push
|
||||
|
||||
SUBROUTINE resetParticles(partInj, partOld)
|
||||
USE moduleSpecies
|
||||
USE moduleList
|
||||
USE moduleMesh
|
||||
USE moduleSpecies, ONLY: particle, &
|
||||
n_part_old, n_part_new, nPartInj
|
||||
IMPLICIT NONE
|
||||
|
||||
TYPE(particle), INTENT(in), ALLOCATABLE:: partInj(:)
|
||||
|
|
@ -88,16 +86,15 @@ MODULE moduleSolver
|
|||
!$OMP BARRIER
|
||||
|
||||
!$OMP SINGLE
|
||||
CALL MOVE_ALLOC(part_old, partTemp)
|
||||
CALL MOVE_ALLOC(partOld, partTemp)
|
||||
n_part_new = n_inj_in + n_old_in
|
||||
ALLOCATE(partOld(1:n_part_new))
|
||||
|
||||
nn = 0
|
||||
DO n = 1, nPartInj
|
||||
IF (part_inj(n)%n_in) THEN
|
||||
IF (partInj(n)%n_in) THEN
|
||||
nn = nn + 1
|
||||
part_old(nn) = part_inj(n)
|
||||
CALL mesh%vols(part_old(nn)%e_p)%obj%listPart_in%add(part_old(nn))
|
||||
partOld(nn) = partInj(n)
|
||||
|
||||
END IF
|
||||
|
||||
|
|
@ -107,7 +104,6 @@ MODULE moduleSolver
|
|||
IF (partTemp(n)%n_in) THEN
|
||||
nn = nn + 1
|
||||
partOld(nn) = partTemp(n)
|
||||
CALL mesh%vols(partOld(nn)%e_p)%obj%listPart_in%add(partOld(nn))
|
||||
|
||||
END IF
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue