Rework of injection of particles with a special focus in 2DCyl to ensure an homogeneous distribution. #51

Merged
JorgeGonz merged 22 commits from issue/injection2DCyl into development 2024-07-11 18:51:43 +02:00
2 changed files with 6 additions and 4 deletions
Showing only changes of commit e23fc2fc2c - Show all commits

Small progress

I made some small changes to how things are calculated.

I have also discovered that the issue with different density when
changing injection is not related with the node volume but with the way
injection is carried out. When loading particles from a file, all
provide the same density regardless the cell (node) volume.

I am doing testing in 2DCart as it is easier to set up.
Jorge Gonzalez 2024-07-11 11:21:38 +02:00

View file

@ -209,7 +209,7 @@ MODULE moduleMeshOutputVTU
WRITE(fileID,"(8X,A)") '<CellData>'
!Electric field
WRITE(fileID,"(10X,A, A, A)") '<DataArray type="Float64" Name="Electric Field (V m^-1)" NumberOfComponents="3">'
WRITE(fileID, "(6(ES20.6E3))") (self%cells(n)%obj%gatherElectricField(Xi)*EF_ref, n = 1, self%numCells)
WRITE(fileID,"(6(ES20.6E3))") (self%cells(n)%obj%gatherElectricField(Xi)*EF_ref, n = 1, self%numCells)
WRITE(fileID,"(10X,A)") '</DataArray>'
WRITE(fileID,"(8X,A)") '</CellData>'

View file

@ -613,6 +613,7 @@ MODULE moduleMesh
INTEGER:: sp
INTEGER:: i
CLASS(meshNode), POINTER:: node
REAL(8):: pFraction !Particle fraction
cellNodes = self%getNodes(nNodes)
fPsi = self%fPsi(part%Xi, nNodes)
@ -623,10 +624,11 @@ MODULE moduleMesh
DO i = 1, nNodes
node => mesh%nodes(cellNodes(i))%obj
pFraction = fPsi(i)*part%weight
CALL OMP_SET_LOCK(node%lock)
node%output(sp)%den = node%output(sp)%den + part%weight*fPsi(i)
node%output(sp)%mom(:) = node%output(sp)%mom(:) + part%weight*fPsi(i)*part%v(:)
node%output(sp)%tensorS(:,:) = node%output(sp)%tensorS(:,:) + part%weight*fPsi(i)*tensorS
node%output(sp)%den = node%output(sp)%den + pFraction
node%output(sp)%mom(:) = node%output(sp)%mom(:) + pFraction*part%v(:)
node%output(sp)%tensorS(:,:) = node%output(sp)%tensorS(:,:) + pFraction*tensorS
CALL OMP_UNSET_LOCK(node%lock)
END DO