Base commit befor trying to use dynamic scheduling to boost parallel
performance.
This commit is contained in:
parent
e14c3ef65b
commit
e44eed8af8
8 changed files with 77 additions and 50 deletions
|
|
@ -11,7 +11,7 @@
|
||||||
"meshFile": "mesh.msh"
|
"meshFile": "mesh.msh"
|
||||||
},
|
},
|
||||||
"species": [
|
"species": [
|
||||||
{"name": "Argon", "type": "neutral", "mass": 6.633e-26, "weight": 5.0e6}
|
{"name": "Argon", "type": "neutral", "mass": 6.633e-26, "weight": 5.0e7}
|
||||||
],
|
],
|
||||||
"boundary": [
|
"boundary": [
|
||||||
{"name": "Injection", "type": "absorption", "physicalSurface": 1},
|
{"name": "Injection", "type": "absorption", "physicalSurface": 1},
|
||||||
|
|
@ -21,17 +21,17 @@
|
||||||
{"name": "Axis", "type": "axis", "physicalSurface": 5}
|
{"name": "Axis", "type": "axis", "physicalSurface": 5}
|
||||||
],
|
],
|
||||||
"inject": [
|
"inject": [
|
||||||
{"name": "Nozzle", "species": "Argon", "flow": 1.0, "units": "sccm", "v": 300.0, "T": [300.0, 300.0, 300.0], "n": [1, 0, 0], "physicalSurface": 1}
|
{"name": "Nozzle", "species": "Argon", "flow": 10.0, "units": "sccm", "v": 300.0, "T": [300.0, 300.0, 300.0], "n": [1, 0, 0], "physicalSurface": 1}
|
||||||
],
|
],
|
||||||
"reference": {
|
"reference": {
|
||||||
"density": 1.0e19,
|
"density": 1.0e20,
|
||||||
"mass": 6.633e-26,
|
"mass": 6.633e-26,
|
||||||
"temperature": 300.0,
|
"temperature": 300.0,
|
||||||
"radius": 1.88e-10
|
"radius": 1.88e-10
|
||||||
},
|
},
|
||||||
"case": {
|
"case": {
|
||||||
"tau": 6.e-7,
|
"tau": 6.e-7,
|
||||||
"time": 3.e-4
|
"time": 3.e-3
|
||||||
},
|
},
|
||||||
"interactions": {
|
"interactions": {
|
||||||
"folderCollisions": "./data/collisions/",
|
"folderCollisions": "./data/collisions/",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
reset
|
reset
|
||||||
set terminal qt enhanced 1 persist size 1800, 400 font "Times ,10"
|
set terminal qt enhanced 1 persist size 1600, 600 font "Times ,10"
|
||||||
|
|
||||||
set style line 1 pt 4 lc rgb "#B50427" #Squares red
|
set style line 1 pt 4 lc rgb "#B50427" #Squares red
|
||||||
set style line 2 pt 6 lc rgb "#3B4CC1" #Circles blue
|
set style line 2 pt 6 lc rgb "#3B4CC1" #Circles blue
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ MODULE moduleBoundary
|
||||||
INTEGER:: id = 0
|
INTEGER:: id = 0
|
||||||
CHARACTER(:), ALLOCATABLE:: name
|
CHARACTER(:), ALLOCATABLE:: name
|
||||||
INTEGER:: physicalSurface = 0
|
INTEGER:: physicalSurface = 0
|
||||||
CHARACTER(:), ALLOCATABLE:: boundaryType !TODO: substitute for extended types
|
CHARACTER(:), ALLOCATABLE:: boundaryType
|
||||||
|
|
||||||
END TYPE boundaryGeneric
|
END TYPE boundaryGeneric
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ MODULE moduleCollisions
|
||||||
USE moduleTable
|
USE moduleTable
|
||||||
|
|
||||||
TYPE, ABSTRACT:: collisionBinary
|
TYPE, ABSTRACT:: collisionBinary
|
||||||
TYPE(table1D):: crossSec
|
REAL(8):: rMass !reduced mass
|
||||||
|
TYPE(table1D):: crossSec !cross section of collision
|
||||||
CONTAINS
|
CONTAINS
|
||||||
PROCEDURE(initBinary_interface), PASS, DEFERRED:: init
|
PROCEDURE(initBinary_interface), PASS, DEFERRED:: init
|
||||||
PROCEDURE(collideBinary_interface), PASS, DEFERRED:: collide
|
PROCEDURE(collideBinary_interface), PASS, DEFERRED:: collide
|
||||||
|
|
@ -10,10 +11,11 @@ MODULE moduleCollisions
|
||||||
END TYPE collisionBinary
|
END TYPE collisionBinary
|
||||||
|
|
||||||
ABSTRACT INTERFACE
|
ABSTRACT INTERFACE
|
||||||
SUBROUTINE initBinary_interface(self, crossSectionFilename)
|
SUBROUTINE initBinary_interface(self, crossSectionFilename, mass_i, mass_j)
|
||||||
IMPORT:: collisionBinary
|
IMPORT:: collisionBinary
|
||||||
CLASS(collisionBinary), INTENT(inout):: self
|
CLASS(collisionBinary), INTENT(inout):: self
|
||||||
CHARACTER(:), ALLOCATABLE, INTENT(in):: crossSectionFilename
|
CHARACTER(:), ALLOCATABLE, INTENT(in):: crossSectionFilename
|
||||||
|
REAL(8), INTENT(in):: mass_i, mass_j
|
||||||
|
|
||||||
END SUBROUTINE
|
END SUBROUTINE
|
||||||
|
|
||||||
|
|
@ -30,19 +32,23 @@ MODULE moduleCollisions
|
||||||
|
|
||||||
END INTERFACE
|
END INTERFACE
|
||||||
|
|
||||||
!Container for collisions
|
!Container for binary collisions
|
||||||
TYPE:: collisionCont
|
TYPE:: collisionCont
|
||||||
CLASS(collisionBinary), ALLOCATABLE:: obj
|
CLASS(collisionBinary), ALLOCATABLE:: obj
|
||||||
|
|
||||||
END TYPE collisionCont
|
END TYPE collisionCont
|
||||||
|
|
||||||
TYPE, EXTENDS(collisionBinary):: collisionBinaryElastic
|
TYPE, EXTENDS(collisionBinary):: collisionBinaryElastic
|
||||||
|
!Weight distribution for Maxwellian function
|
||||||
|
REAL(8):: w_i = (1.D0+DSQRT(3.D0))/2.D0
|
||||||
|
REAL(8):: w_j = (DSQRT(3.D0)-1.D0)/2.D0
|
||||||
CONTAINS
|
CONTAINS
|
||||||
PROCEDURE, PASS:: init => initBinaryElastic
|
PROCEDURE, PASS:: init => initBinaryElastic
|
||||||
PROCEDURE, PASS:: collide => collideBinaryElastic
|
PROCEDURE, PASS:: collide => collideBinaryElastic
|
||||||
|
|
||||||
END TYPE collisionBinaryElastic
|
END TYPE collisionBinaryElastic
|
||||||
|
|
||||||
|
!Type for interaction matrix
|
||||||
TYPE:: interactionsBinary
|
TYPE:: interactionsBinary
|
||||||
INTEGER:: amount
|
INTEGER:: amount
|
||||||
TYPE(collisionCont), ALLOCATABLE:: collisions(:)
|
TYPE(collisionCont), ALLOCATABLE:: collisions(:)
|
||||||
|
|
@ -92,13 +98,14 @@ MODULE moduleCollisions
|
||||||
|
|
||||||
ALLOCATE(self%collisions(1:self%amount))
|
ALLOCATE(self%collisions(1:self%amount))
|
||||||
DO k= 1, self%amount
|
DO k= 1, self%amount
|
||||||
|
!TODO: make type dependent
|
||||||
ALLOCATE(collisionBinaryElastic:: self%collisions(k)%obj)
|
ALLOCATE(collisionBinaryElastic:: self%collisions(k)%obj)
|
||||||
|
|
||||||
END DO
|
END DO
|
||||||
|
|
||||||
END SUBROUTINE initInteractionBinary
|
END SUBROUTINE initInteractionBinary
|
||||||
|
|
||||||
SUBROUTINE initBinaryElastic(self, crossSectionFilename)
|
SUBROUTINE initBinaryElastic(self, crossSectionFilename, mass_i, mass_j)
|
||||||
USE moduleTable
|
USE moduleTable
|
||||||
USE moduleRefParam
|
USE moduleRefParam
|
||||||
USE moduleConstParam
|
USE moduleConstParam
|
||||||
|
|
@ -106,6 +113,7 @@ MODULE moduleCollisions
|
||||||
|
|
||||||
CLASS(collisionBinaryElastic), INTENT(inout):: self
|
CLASS(collisionBinaryElastic), INTENT(inout):: self
|
||||||
CHARACTER(:), ALLOCATABLE, INTENT(in):: crossSectionFilename
|
CHARACTER(:), ALLOCATABLE, INTENT(in):: crossSectionFilename
|
||||||
|
REAL(8), INTENT(in):: mass_i, mass_j
|
||||||
|
|
||||||
!Reads data from file
|
!Reads data from file
|
||||||
CALL self%crossSec%init(crossSectionFilename)
|
CALL self%crossSec%init(crossSectionFilename)
|
||||||
|
|
@ -113,6 +121,9 @@ MODULE moduleCollisions
|
||||||
!Convert to no-dimensional units
|
!Convert to no-dimensional units
|
||||||
CALL self%crossSec%convert(eV2J/(m_ref*v_ref**2), 1.D0/L_ref**2)
|
CALL self%crossSec%convert(eV2J/(m_ref*v_ref**2), 1.D0/L_ref**2)
|
||||||
|
|
||||||
|
!Calculates reduced mass
|
||||||
|
self%rMass = (mass_i*mass_j)/(mass_i+mass_j)
|
||||||
|
|
||||||
END SUBROUTINE
|
END SUBROUTINE
|
||||||
|
|
||||||
SUBROUTINE collideBinaryElastic(self, sigmaVrelMax, sigmaVrelMaxNew, &
|
SUBROUTINE collideBinaryElastic(self, sigmaVrelMax, sigmaVrelMaxNew, &
|
||||||
|
|
@ -128,20 +139,23 @@ MODULE moduleCollisions
|
||||||
TYPE(particle), INTENT(inout):: part_i, part_j
|
TYPE(particle), INTENT(inout):: part_i, part_j
|
||||||
REAL(8):: sigmaVrel
|
REAL(8):: sigmaVrel
|
||||||
REAL(8):: vRel !relative velocity
|
REAL(8):: vRel !relative velocity
|
||||||
|
REAL(8):: eRel !relative energy
|
||||||
REAL(8):: vp_i, vp_j, v_i, v_j !post and pre-collision velocities
|
REAL(8):: vp_i, vp_j, v_i, v_j !post and pre-collision velocities
|
||||||
REAL(8):: alpha
|
REAL(8):: v_ij !sum of velocities modules
|
||||||
|
REAL(8):: alpha !random angle of scattering
|
||||||
|
|
||||||
!v relative (in units of [m][L]^2[s]^-2
|
!eRel (in units of [m][L]^2[s]^-2
|
||||||
vRel = species(1)%obj%m*NORM2(part_i%v - part_j%v)**2
|
vRel = SUM(DABS(part_i%v-part_j%v)) !TODO make function of norm1
|
||||||
sigmaVrel = self%crossSec%get(vRel)*vRel
|
eRel = self%rMass*vRel**2
|
||||||
|
sigmaVrel = self%crossSec%get(eRel)*vRel
|
||||||
sigmaVrelMaxNew = sigmaVrelMaxNew + sigmaVrel
|
sigmaVrelMaxNew = sigmaVrelMaxNew + sigmaVrel
|
||||||
PRINT *, sigmaVrelMaxNew/sigmaVrelMax, RAND()
|
|
||||||
IF (sigmaVrelMaxNew/sigmaVrelMax > RAND()) THEN
|
IF (sigmaVrelMaxNew/sigmaVrelMax > RAND()) THEN
|
||||||
!Applies the collision
|
!Applies the collision
|
||||||
v_i = NORM2(part_i%v)
|
v_i = NORM2(part_i%v)
|
||||||
v_j = NORM2(part_j%v)
|
v_j = NORM2(part_j%v)
|
||||||
vp_j = (v_i + v_j)*(1.D0+DSQRT(3.D0))/2.D0
|
v_ij = v_i+v_j
|
||||||
vp_i = (v_i + v_j)*(DSQRT(3.D0)-1.D0)/2.D0
|
vp_j = v_ij*self%w_i
|
||||||
|
vp_i = v_ij*self%w_j
|
||||||
alpha = PI*RAND()
|
alpha = PI*RAND()
|
||||||
part_i%v(1) = v_i*DCOS(alpha)
|
part_i%v(1) = v_i*DCOS(alpha)
|
||||||
part_i%v(2) = v_i*DSIN(alpha)
|
part_i%v(2) = v_i*DSIN(alpha)
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ MODULE moduleInput
|
||||||
WRITE (kString, '(I2)') k
|
WRITE (kString, '(I2)') k
|
||||||
CALL config%get(object // '.crossSections(' // TRIM(kString)// ')', crossSecFile)
|
CALL config%get(object // '.crossSections(' // TRIM(kString)// ')', crossSecFile)
|
||||||
crossSecFilePath = pathCollisions // crossSecFile
|
crossSecFilePath = pathCollisions // crossSecFile
|
||||||
CALL interactionMatrix(ij)%collisions(k)%obj%init(crossSecFilePath)
|
CALL interactionMatrix(ij)%collisions(k)%obj%init(crossSecFilePath, species(pt_i)%obj%m, species(pt_j)%obj%m)
|
||||||
|
|
||||||
END DO
|
END DO
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ MODULE moduleList
|
||||||
TYPE lNode
|
TYPE lNode
|
||||||
TYPE(particle), POINTER:: part => NULL()
|
TYPE(particle), POINTER:: part => NULL()
|
||||||
TYPE(lNode), POINTER:: next => NULL()
|
TYPE(lNode), POINTER:: next => NULL()
|
||||||
|
|
||||||
END TYPE lNode
|
END TYPE lNode
|
||||||
|
|
||||||
TYPE listNode
|
TYPE listNode
|
||||||
|
|
@ -14,69 +15,74 @@ MODULE moduleList
|
||||||
TYPE(lNode),POINTER:: tail => NULL()
|
TYPE(lNode),POINTER:: tail => NULL()
|
||||||
CONTAINS
|
CONTAINS
|
||||||
PROCEDURE,PASS:: add => addToList
|
PROCEDURE,PASS:: add => addToList
|
||||||
PROCEDURE,PASS:: get => getFromList
|
PROCEDURE,PASS:: convert2Array
|
||||||
PROCEDURE,PASS:: erase => eraseList
|
PROCEDURE,PASS:: erase => eraseList
|
||||||
|
|
||||||
END TYPE listNode
|
END TYPE listNode
|
||||||
|
|
||||||
|
TYPE pointerArray
|
||||||
|
TYPE(particle), POINTER:: part
|
||||||
|
|
||||||
|
END TYPE
|
||||||
|
|
||||||
CONTAINS
|
CONTAINS
|
||||||
!Adds element to list
|
!Adds element to list
|
||||||
SUBROUTINE addToList(this,part)
|
SUBROUTINE addToList(self,part)
|
||||||
USE moduleSpecies
|
USE moduleSpecies
|
||||||
CLASS(listNode), INTENT(inout):: this
|
CLASS(listNode), INTENT(inout):: self
|
||||||
TYPE(particle),INTENT(in), TARGET:: part
|
TYPE(particle),INTENT(in), TARGET:: part
|
||||||
TYPE(lNode),POINTER:: temp
|
TYPE(lNode),POINTER:: temp
|
||||||
|
|
||||||
ALLOCATE(temp)
|
ALLOCATE(temp)
|
||||||
temp%part => part
|
temp%part => part
|
||||||
NULLIFY(temp%next)
|
NULLIFY(temp%next)
|
||||||
this%amount = this%amount + 1
|
self%amount = self%amount + 1
|
||||||
IF (.NOT. ASSOCIATED(this%head)) THEN
|
IF (.NOT. ASSOCIATED(self%head)) THEN
|
||||||
!First element
|
!First element
|
||||||
this%head => temp
|
self%head => temp
|
||||||
this%tail => temp
|
self%tail => temp
|
||||||
ELSE
|
ELSE
|
||||||
!Append element
|
!Append element
|
||||||
this%tail%next => temp
|
self%tail%next => temp
|
||||||
this%tail => temp
|
self%tail => temp
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
END SUBROUTINE addToList
|
END SUBROUTINE addToList
|
||||||
|
|
||||||
FUNCTION getFromList(self, iObj) RESULT(partTemp)
|
FUNCTION convert2Array(self) RESULT(partArray)
|
||||||
use moduleErrors
|
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
|
|
||||||
CLASS(listNode):: self
|
CLASS(listNode), INTENT(in):: self
|
||||||
INTEGER:: iObj
|
TYPE(pointerArray), ALLOCATABLE:: partArray(:)
|
||||||
TYPE(particle), POINTER:: partTemp
|
TYPE(lNode), POINTER:: tempNode
|
||||||
INTEGER:: i
|
INTEGER:: n
|
||||||
TYPE(lNode), POINTER:: nodeTemp
|
|
||||||
|
|
||||||
|
ALLOCATE(partArray(1:self%amount))
|
||||||
IF (iObj > self%amount) CALL criticalError('Accessing to element list outisde range','getFromList')
|
tempNode => self%head
|
||||||
nodeTemp => self%head
|
DO n=1, self%amount
|
||||||
DO i = 1, iObj - 1
|
!Point element in array to element in list
|
||||||
nodeTemp => nodeTemp%next
|
partArray(n)%part => tempNode%part
|
||||||
|
!Go to next element
|
||||||
|
tempNode => tempNode%next
|
||||||
|
|
||||||
END DO
|
END DO
|
||||||
partTemp => nodeTemp%part
|
|
||||||
|
|
||||||
END FUNCTION getFromList
|
END FUNCTION convert2Array
|
||||||
|
|
||||||
!Erase list
|
!Erase list
|
||||||
SUBROUTINE eraseList(this)
|
SUBROUTINE eraseList(self)
|
||||||
CLASS(listNode):: this
|
CLASS(listNode):: self
|
||||||
TYPE(lNode),POINTER:: current, next
|
TYPE(lNode),POINTER:: current, next
|
||||||
|
|
||||||
current => this%head
|
current => self%head
|
||||||
DO WHILE (ASSOCIATED(current))
|
DO WHILE (ASSOCIATED(current))
|
||||||
next => current%next
|
next => current%next
|
||||||
DEALLOCATE(current)
|
DEALLOCATE(current)
|
||||||
current => next
|
current => next
|
||||||
END DO
|
END DO
|
||||||
IF (ASSOCIATED(this%head)) NULLIFY(this%head)
|
IF (ASSOCIATED(self%head)) NULLIFY(self%head)
|
||||||
IF (ASSOCIATED(this%tail)) NULLIFY(this%tail)
|
IF (ASSOCIATED(self%tail)) NULLIFY(self%tail)
|
||||||
this%amount = 0
|
self%amount = 0
|
||||||
END SUBROUTINE eraseList
|
END SUBROUTINE eraseList
|
||||||
|
|
||||||
END MODULE moduleList
|
END MODULE moduleList
|
||||||
|
|
|
||||||
|
|
@ -537,6 +537,7 @@ MODULE moduleMeshCyl
|
||||||
INTEGER:: n !collision
|
INTEGER:: n !collision
|
||||||
INTEGER:: ij, k
|
INTEGER:: ij, k
|
||||||
REAL(8):: sigmaVrelMaxNew
|
REAL(8):: sigmaVrelMaxNew
|
||||||
|
TYPE(pointerArray), ALLOCATABLE:: partTemp(:)
|
||||||
|
|
||||||
self%nColl = 0
|
self%nColl = 0
|
||||||
nPart = self%listPart_in%amount
|
nPart = self%listPart_in%amount
|
||||||
|
|
@ -544,12 +545,18 @@ MODULE moduleMeshCyl
|
||||||
pMax = self%totalWeight*self%sigmaVrelMax*tau/self%volume
|
pMax = self%totalWeight*self%sigmaVrelMax*tau/self%volume
|
||||||
self%nColl = INT(REAL(nPart)*pMax*0.5D0)
|
self%nColl = INT(REAL(nPart)*pMax*0.5D0)
|
||||||
|
|
||||||
|
!Converts the list of particles to an array for easy access
|
||||||
|
IF (self%nColl > 0) THEN
|
||||||
|
partTemp = self%listPart_in%convert2Array()
|
||||||
|
|
||||||
|
END IF
|
||||||
|
|
||||||
DO n = 1, self%nColl
|
DO n = 1, self%nColl
|
||||||
!Select random numbers
|
!Select random numbers
|
||||||
rnd = 1 + FLOOR(nPart*RAND())
|
rnd = 1 + FLOOR(nPart*RAND())
|
||||||
part_i => self%listPart_in%get(rnd)
|
part_i => partTemp(rnd)%part
|
||||||
rnd = 1 + FLOOR(nPart*RAND())
|
rnd = 1 + FLOOR(nPart*RAND())
|
||||||
part_j => self%listPart_in%get(rnd)
|
part_j => partTemp(rnd)%part
|
||||||
ij = interactionIndex(part_i%pt, part_j%pt)
|
ij = interactionIndex(part_i%pt, part_j%pt)
|
||||||
sigmaVrelMaxNew = 0.D0
|
sigmaVrelMaxNew = 0.D0
|
||||||
DO k = 1, interactionMatrix(ij)%amount
|
DO k = 1, interactionMatrix(ij)%amount
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ MODULE moduleSpecies
|
||||||
INTEGER:: nPartOld
|
INTEGER:: nPartOld
|
||||||
INTEGER:: nPartInj
|
INTEGER:: nPartInj
|
||||||
!Arrays that contain the particles
|
!Arrays that contain the particles
|
||||||
TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: partOld
|
TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: partOld !array of particles from previous iteration
|
||||||
TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: partInj !array of inject particles
|
TYPE(particle), ALLOCATABLE, DIMENSION(:), TARGET:: partInj !array of inject particles
|
||||||
|
|
||||||
CONTAINS
|
CONTAINS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue