Reduction in pushing

Reduction in 10-20% of time spend in pushing in 2DCyl thanks to
rewriting fPsi and dPsi.
This commit is contained in:
Jorge Gonzalez 2023-01-05 16:47:13 +01:00
commit 2486ef6316
18 changed files with 1289 additions and 1280 deletions

View file

@ -337,7 +337,7 @@ MODULE moduleInput
!Mean velocity and temperature at particle position
REAL(8):: velocityXi(1:3), temperatureXi
INTEGER:: nNewPart = 0.D0
CLASS(meshVol), POINTER:: vol
CLASS(meshCell), POINTER:: vol
TYPE(particle), POINTER:: partNew
REAL(8):: vTh
TYPE(lNode), POINTER:: partCurr, partNext
@ -356,13 +356,13 @@ MODULE moduleInput
filename = path // spFile
CALL mesh%readInitial(sp, filename, density, velocity, temperature)
!For each volume in the node, create corresponding particles
DO e = 1, mesh%numVols
DO e = 1, mesh%numCells
!Scale variables
!Density at centroid of cell
nodes = mesh%vols(e)%obj%getNodes()
nNodes = SIZE(nodes)
nodes = mesh%cells(e)%obj%getNodes()
nNodes = mesh%cells(e)%obj%nNodes
ALLOCATE(fPsi(1:nNodes))
CALL mesh%vols(e)%obj%fPsi((/0.D0, 0.D0, 0.D0/), fPsi)
fPsi = mesh%cells(e)%obj%fPsi((/0.D0, 0.D0, 0.D0/))
ALLOCATE(source(1:nNodes))
DO j = 1, nNodes
source(j) = density(nodes(j))
@ -371,16 +371,16 @@ MODULE moduleInput
densityCen = DOT_PRODUCT(fPsi, source)
!Calculate number of particles
nNewPart = INT(densityCen * (mesh%vols(e)%obj%volume*Vol_ref) / species(sp)%obj%weight)
nNewPart = INT(densityCen * (mesh%cells(e)%obj%volume*Vol_ref) / species(sp)%obj%weight)
!Allocate new particles
DO p = 1, nNewPart
ALLOCATE(partNew)
partNew%species => species(sp)%obj
partNew%r = mesh%vols(e)%obj%randPos()
partNew%xi = mesh%vols(e)%obj%phy2log(partNew%r)
partNew%r = mesh%cells(e)%obj%randPos()
partNew%xi = mesh%cells(e)%obj%phy2log(partNew%r)
!Get mean velocity at particle position
CALL mesh%vols(e)%obj%fPsi(partNew%xi, fPsi)
fPsi = mesh%cells(e)%obj%fPsi(partNew%xi)
DO j = 1, nNodes
source(j) = velocity(nodes(j), 1)
@ -426,7 +426,7 @@ MODULE moduleInput
CALL partInitial%add(partNew)
!Assign particle to list in volume
vol => meshforMCC%vols(partNew%volColl)%obj
vol => meshforMCC%cells(partNew%volColl)%obj
CALL OMP_SET_LOCK(vol%lock)
CALL vol%listPart_in(sp)%add(partNew)
vol%totalWeight(sp) = vol%totalWeight(sp) + partNew%weight
@ -643,7 +643,7 @@ MODULE moduleInput
REAL(8):: energyThreshold, energyBinding
CHARACTER(:), ALLOCATABLE:: electron
INTEGER:: e
CLASS(meshVol), POINTER:: vol
CLASS(meshCell), POINTER:: vol
!Firstly, checks if the object 'interactions' exists
CALL config%info('interactions', found)
@ -739,8 +739,8 @@ MODULE moduleInput
END DO
!Init the required arrays in each volume to account for MCC.
DO e = 1, meshForMCC%numVols
vol => meshForMCC%vols(e)%obj
DO e = 1, meshForMCC%numCells
vol => meshForMCC%cells(e)%obj
!Allocate Maximum cross section per collision pair and assign the initial collision rate
ALLOCATE(vol%sigmaVrelMax(1:nCollPairs))
@ -930,8 +930,8 @@ MODULE moduleInput
CALL config%get(object // '.volume', volume, found)
!Rescale the volumne
IF (found) THEN
mesh%vols(1)%obj%volume = mesh%vols(1)%obj%volume*volume / Vol_ref
mesh%nodes(1)%obj%v = mesh%vols(1)%obj%volume
mesh%cells(1)%obj%volume = mesh%cells(1)%obj%volume*volume / Vol_ref
mesh%nodes(1)%obj%v = mesh%cells(1)%obj%volume
END IF