Switching to variable particle weight
I have to change the injection of particles. Each edge will receive a similar number of particles and their weight will change to have a constant density based on the geometry. Still testing.
This commit is contained in:
parent
6b78ae3738
commit
b972120ed5
3 changed files with 18 additions and 27 deletions
|
|
@ -283,6 +283,7 @@ MODULE moduleInject
|
|||
USE moduleMesh
|
||||
USE moduleRandom
|
||||
USE moduleErrors
|
||||
USE moduleRefParam, ONLY: L_ref
|
||||
IMPLICIT NONE
|
||||
|
||||
CLASS(injectGeneric), INTENT(in):: self
|
||||
|
|
@ -312,12 +313,12 @@ MODULE moduleInject
|
|||
|
||||
!$OMP DO
|
||||
DO n = nMin, nMax
|
||||
randomX = randomWeighted(self%cumWeight, self%sumWeight)
|
||||
randomX = random(1, self%nEdges)
|
||||
randomEdge => mesh%edges(self%edges(randomX))%obj
|
||||
!Random position in edge
|
||||
partInj(n)%r = randomEdge%randPos()
|
||||
!Assign weight to particle.
|
||||
partInj(n)%weight = self%species%weight
|
||||
partInj(n)%weight = self%species%weight * sqrt(partInj(n)%r(2) / (0.1D0*L_ref))
|
||||
!Volume associated to the edge:
|
||||
IF (ASSOCIATED(randomEdge%e1)) THEN
|
||||
partInj(n)%cell = randomEdge%e1%n
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue