fPsi no longer allocates memory

I noticed that phy2logquad had a lot of overhead. Trying to reducing it
by simplifying calls to fPsi, dPsi and such.

The function for fPsi has been made so no memory is allocated and works
under the assumption that the input array has the right size (1:numNodes)
This commit is contained in:
Jorge Gonzalez 2023-01-01 12:12:06 +01:00
commit 0db76083ec
8 changed files with 408 additions and 409 deletions

View file

@ -361,14 +361,14 @@ MODULE moduleInput
!Density at centroid of cell
nodes = mesh%vols(e)%obj%getNodes()
nNodes = SIZE(nodes)
fPsi = mesh%vols(e)%obj%fPsi((/0.D0, 0.D0, 0.D0/))
ALLOCATE(fPsi(1:nNodes))
CALL mesh%vols(e)%obj%fPsi((/0.D0, 0.D0, 0.D0/), fPsi)
ALLOCATE(source(1:nNodes))
DO j = 1, nNodes
source(j) = density(nodes(j))
END DO
densityCen = DOT_PRODUCT(fPsi, source)
DEALLOCATE(fPsi)
!Calculate number of particles
nNewPart = INT(densityCen * (mesh%vols(e)%obj%volume*Vol_ref) / species(sp)%obj%weight)
@ -380,7 +380,7 @@ MODULE moduleInput
partNew%r = mesh%vols(e)%obj%randPos()
partNew%xi = mesh%vols(e)%obj%phy2log(partNew%r)
!Get mean velocity at particle position
fPsi = mesh%vols(e)%obj%fPsi(partNew%xi)
CALL mesh%vols(e)%obj%fPsi(partNew%xi, fPsi)
DO j = 1, nNodes
source(j) = velocity(nodes(j), 1)