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"
|
||||
},
|
||||
"species": [
|
||||
{"name": "Argon", "type": "neutral", "mass": 6.633e-26, "weight": 5.0e6}
|
||||
{"name": "Argon", "type": "neutral", "mass": 6.633e-26, "weight": 5.0e7}
|
||||
],
|
||||
"boundary": [
|
||||
{"name": "Injection", "type": "absorption", "physicalSurface": 1},
|
||||
|
|
@ -21,17 +21,17 @@
|
|||
{"name": "Axis", "type": "axis", "physicalSurface": 5}
|
||||
],
|
||||
"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": {
|
||||
"density": 1.0e19,
|
||||
"density": 1.0e20,
|
||||
"mass": 6.633e-26,
|
||||
"temperature": 300.0,
|
||||
"radius": 1.88e-10
|
||||
},
|
||||
"case": {
|
||||
"tau": 6.e-7,
|
||||
"time": 3.e-4
|
||||
"time": 3.e-3
|
||||
},
|
||||
"interactions": {
|
||||
"folderCollisions": "./data/collisions/",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
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 2 pt 6 lc rgb "#3B4CC1" #Circles blue
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ MODULE moduleBoundary
|
|||
INTEGER:: id = 0
|
||||
CHARACTER(:), ALLOCATABLE:: name
|
||||
INTEGER:: physicalSurface = 0
|
||||
CHARACTER(:), ALLOCATABLE:: boundaryType !TODO: substitute for extended types
|
||||
CHARACTER(:), ALLOCATABLE:: boundaryType
|
||||
|
||||
END TYPE boundaryGeneric
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ MODULE moduleCollisions
|
|||
USE moduleTable
|
||||
|
||||
TYPE, ABSTRACT:: collisionBinary
|
||||
TYPE(table1D):: crossSec
|
||||
REAL(8):: rMass !reduced mass
|
||||
TYPE(table1D):: crossSec !cross section of collision
|
||||
CONTAINS
|
||||
PROCEDURE(initBinary_interface), PASS, DEFERRED:: init
|
||||
PROCEDURE(collideBinary_interface), PASS, DEFERRED:: collide
|
||||
|
|
@ -10,10 +11,11 @@ MODULE moduleCollisions
|
|||
END TYPE collisionBinary
|
||||
|
||||
ABSTRACT INTERFACE
|
||||
SUBROUTINE initBinary_interface(self, crossSectionFilename)
|
||||
SUBROUTINE initBinary_interface(self, crossSectionFilename, mass_i, mass_j)
|
||||
IMPORT:: collisionBinary
|
||||
CLASS(collisionBinary), INTENT(inout):: self
|
||||
CHARACTER(:), ALLOCATABLE, INTENT(in):: crossSectionFilename
|
||||
REAL(8), INTENT(in):: mass_i, mass_j
|
||||
|
||||
END SUBROUTINE
|
||||
|
||||
|
|
@ -30,19 +32,23 @@ MODULE moduleCollisions
|
|||
|
||||
END INTERFACE
|
||||
|
||||
!Container for collisions
|
||||
!Container for binary collisions
|
||||
TYPE:: collisionCont
|
||||
CLASS(collisionBinary), ALLOCATABLE:: obj
|
||||
|
||||
END TYPE collisionCont
|
||||
|
||||
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
|
||||
PROCEDURE, PASS:: init => initBinaryElastic
|
||||
PROCEDURE, PASS:: collide => collideBinaryElastic
|
||||
|
||||
END TYPE collisionBinaryElastic
|
||||
|
||||
!Type for interaction matrix
|
||||
TYPE:: interactionsBinary
|
||||
INTEGER:: amount
|
||||
TYPE(collisionCont), ALLOCATABLE:: collisions(:)
|
||||
|
|
@ -92,13 +98,14 @@ MODULE moduleCollisions
|
|||
|
||||
ALLOCATE(self%collisions(1:self%amount))
|
||||
DO k= 1, self%amount
|
||||
!TODO: make type dependent
|
||||
ALLOCATE(collisionBinaryElastic:: self%collisions(k)%obj)
|
||||
|
||||
END DO
|
||||
|
||||
END SUBROUTINE initInteractionBinary
|
||||
|
||||
SUBROUTINE initBinaryElastic(self, crossSectionFilename)
|
||||
SUBROUTINE initBinaryElastic(self, crossSectionFilename, mass_i, mass_j)
|
||||
USE moduleTable
|
||||
USE moduleRefParam
|
||||
USE moduleConstParam
|
||||
|
|
@ -106,6 +113,7 @@ MODULE moduleCollisions
|
|||
|
||||
CLASS(collisionBinaryElastic), INTENT(inout):: self
|
||||
CHARACTER(:), ALLOCATABLE, INTENT(in):: crossSectionFilename
|
||||
REAL(8), INTENT(in):: mass_i, mass_j
|
||||
|
||||
!Reads data from file
|
||||
CALL self%crossSec%init(crossSectionFilename)
|
||||
|
|
@ -113,6 +121,9 @@ MODULE moduleCollisions
|
|||
!Convert to no-dimensional units
|
||||
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
|
||||
|
||||
SUBROUTINE collideBinaryElastic(self, sigmaVrelMax, sigmaVrelMaxNew, &
|
||||
|
|
@ -128,20 +139,23 @@ MODULE moduleCollisions
|
|||
TYPE(particle), INTENT(inout):: part_i, part_j
|
||||
REAL(8):: sigmaVrel
|
||||
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):: 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
|
||||
vRel = species(1)%obj%m*NORM2(part_i%v - part_j%v)**2
|
||||
sigmaVrel = self%crossSec%get(vRel)*vRel
|
||||
!eRel (in units of [m][L]^2[s]^-2
|
||||
vRel = SUM(DABS(part_i%v-part_j%v)) !TODO make function of norm1
|
||||
eRel = self%rMass*vRel**2
|
||||
sigmaVrel = self%crossSec%get(eRel)*vRel
|
||||
sigmaVrelMaxNew = sigmaVrelMaxNew + sigmaVrel
|
||||
PRINT *, sigmaVrelMaxNew/sigmaVrelMax, RAND()
|
||||
IF (sigmaVrelMaxNew/sigmaVrelMax > RAND()) THEN
|
||||
!Applies the collision
|
||||
v_i = NORM2(part_i%v)
|
||||
v_j = NORM2(part_j%v)
|
||||
vp_j = (v_i + v_j)*(1.D0+DSQRT(3.D0))/2.D0
|
||||
vp_i = (v_i + v_j)*(DSQRT(3.D0)-1.D0)/2.D0
|
||||
v_ij = v_i+v_j
|
||||
vp_j = v_ij*self%w_i
|
||||
vp_i = v_ij*self%w_j
|
||||
alpha = PI*RAND()
|
||||
part_i%v(1) = v_i*DCOS(alpha)
|
||||
part_i%v(2) = v_i*DSIN(alpha)
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ MODULE moduleInput
|
|||
WRITE (kString, '(I2)') k
|
||||
CALL config%get(object // '.crossSections(' // TRIM(kString)// ')', 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
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ MODULE moduleList
|
|||
TYPE lNode
|
||||
TYPE(particle), POINTER:: part => NULL()
|
||||
TYPE(lNode), POINTER:: next => NULL()
|
||||
|
||||
END TYPE lNode
|
||||
|
||||
TYPE listNode
|
||||
|
|
@ -14,69 +15,74 @@ MODULE moduleList
|
|||
TYPE(lNode),POINTER:: tail => NULL()
|
||||
CONTAINS
|
||||
PROCEDURE,PASS:: add => addToList
|
||||
PROCEDURE,PASS:: get => getFromList
|
||||
PROCEDURE,PASS:: convert2Array
|
||||
PROCEDURE,PASS:: erase => eraseList
|
||||
|
||||
END TYPE listNode
|
||||
|
||||
TYPE pointerArray
|
||||
TYPE(particle), POINTER:: part
|
||||
|
||||
END TYPE
|
||||
|
||||
CONTAINS
|
||||
!Adds element to list
|
||||
SUBROUTINE addToList(this,part)
|
||||
SUBROUTINE addToList(self,part)
|
||||
USE moduleSpecies
|
||||
CLASS(listNode), INTENT(inout):: this
|
||||
CLASS(listNode), INTENT(inout):: self
|
||||
TYPE(particle),INTENT(in), TARGET:: part
|
||||
TYPE(lNode),POINTER:: temp
|
||||
|
||||
ALLOCATE(temp)
|
||||
temp%part => part
|
||||
NULLIFY(temp%next)
|
||||
this%amount = this%amount + 1
|
||||
IF (.NOT. ASSOCIATED(this%head)) THEN
|
||||
self%amount = self%amount + 1
|
||||
IF (.NOT. ASSOCIATED(self%head)) THEN
|
||||
!First element
|
||||
this%head => temp
|
||||
this%tail => temp
|
||||
self%head => temp
|
||||
self%tail => temp
|
||||
ELSE
|
||||
!Append element
|
||||
this%tail%next => temp
|
||||
this%tail => temp
|
||||
self%tail%next => temp
|
||||
self%tail => temp
|
||||
END IF
|
||||
|
||||
END SUBROUTINE addToList
|
||||
|
||||
FUNCTION getFromList(self, iObj) RESULT(partTemp)
|
||||
use moduleErrors
|
||||
FUNCTION convert2Array(self) RESULT(partArray)
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(listNode):: self
|
||||
INTEGER:: iObj
|
||||
TYPE(particle), POINTER:: partTemp
|
||||
INTEGER:: i
|
||||
TYPE(lNode), POINTER:: nodeTemp
|
||||
CLASS(listNode), INTENT(in):: self
|
||||
TYPE(pointerArray), ALLOCATABLE:: partArray(:)
|
||||
TYPE(lNode), POINTER:: tempNode
|
||||
INTEGER:: n
|
||||
|
||||
|
||||
IF (iObj > self%amount) CALL criticalError('Accessing to element list outisde range','getFromList')
|
||||
nodeTemp => self%head
|
||||
DO i = 1, iObj - 1
|
||||
nodeTemp => nodeTemp%next
|
||||
ALLOCATE(partArray(1:self%amount))
|
||||
tempNode => self%head
|
||||
DO n=1, self%amount
|
||||
!Point element in array to element in list
|
||||
partArray(n)%part => tempNode%part
|
||||
!Go to next element
|
||||
tempNode => tempNode%next
|
||||
|
||||
END DO
|
||||
partTemp => nodeTemp%part
|
||||
|
||||
END FUNCTION getFromList
|
||||
END FUNCTION convert2Array
|
||||
|
||||
!Erase list
|
||||
SUBROUTINE eraseList(this)
|
||||
CLASS(listNode):: this
|
||||
SUBROUTINE eraseList(self)
|
||||
CLASS(listNode):: self
|
||||
TYPE(lNode),POINTER:: current, next
|
||||
|
||||
current => this%head
|
||||
current => self%head
|
||||
DO WHILE (ASSOCIATED(current))
|
||||
next => current%next
|
||||
DEALLOCATE(current)
|
||||
current => next
|
||||
END DO
|
||||
IF (ASSOCIATED(this%head)) NULLIFY(this%head)
|
||||
IF (ASSOCIATED(this%tail)) NULLIFY(this%tail)
|
||||
this%amount = 0
|
||||
IF (ASSOCIATED(self%head)) NULLIFY(self%head)
|
||||
IF (ASSOCIATED(self%tail)) NULLIFY(self%tail)
|
||||
self%amount = 0
|
||||
END SUBROUTINE eraseList
|
||||
|
||||
END MODULE moduleList
|
||||
|
|
|
|||
|
|
@ -537,6 +537,7 @@ MODULE moduleMeshCyl
|
|||
INTEGER:: n !collision
|
||||
INTEGER:: ij, k
|
||||
REAL(8):: sigmaVrelMaxNew
|
||||
TYPE(pointerArray), ALLOCATABLE:: partTemp(:)
|
||||
|
||||
self%nColl = 0
|
||||
nPart = self%listPart_in%amount
|
||||
|
|
@ -544,12 +545,18 @@ MODULE moduleMeshCyl
|
|||
pMax = self%totalWeight*self%sigmaVrelMax*tau/self%volume
|
||||
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
|
||||
!Select random numbers
|
||||
rnd = 1 + FLOOR(nPart*RAND())
|
||||
part_i => self%listPart_in%get(rnd)
|
||||
part_i => partTemp(rnd)%part
|
||||
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)
|
||||
sigmaVrelMaxNew = 0.D0
|
||||
DO k = 1, interactionMatrix(ij)%amount
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ MODULE moduleSpecies
|
|||
INTEGER:: nPartOld
|
||||
INTEGER:: nPartInj
|
||||
!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
|
||||
|
||||
CONTAINS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue