Update compute_rho.f90

IF(lsign) moved  out of the loop
This commit is contained in:
Pietro Delugas 2019-11-01 11:48:20 +00:00
parent ea9057e7f4
commit a613d9c089
1 changed files with 19 additions and 10 deletions

View File

@ -26,15 +26,24 @@
! output: the orientation when needed
REAL(DP) :: amag
INTEGER :: ir ! counter on mesh points
!$omp parallel do default(shared) private(ir, amag)
DO ir = 1, nrxx
segni(ir) =1.0_DP
IF (lsign) segni(ir)=SIGN(1.0_DP,rho(ir,2)*ux(1)+rho(ir,3)*ux(2)+rho(ir,4)*ux(3))
amag=SQRT(rho(ir,2)**2+rho(ir,3)**2+rho(ir,4)**2)
rhoout(ir,1)=0.5d0*(rho(ir,1)+segni(ir)*amag)
rhoout(ir,2)=0.5d0*(rho(ir,1)-segni(ir)*amag)
ENDDO
!$omp end parallel do
IF (lsign) THEN
!$omp parallel do default(shared) private(ir, amag)
DO ir = 1, nrxx
segni(ir)=SIGN(1.0_DP,rho(ir,2)*ux(1)+rho(ir,3)*ux(2)+rho(ir,4)*ux(3))
amag=SQRT(rho(ir,2)**2+rho(ir,3)**2+rho(ir,4)**2)
rhoout(ir,1)=0.5d0*(rho(ir,1)+segni(ir)*amag)
rhoout(ir,2)=0.5d0*(rho(ir,1)-segni(ir)*amag)
ENDDO
!$omp end parallel do
ELSE
!$omp parallel do default(shared) private(ir, amag)
DO ir =1, nrxx
segni(ir) = 1.0_DP
amag=SQRT(rho(ir,2)**2+rho(ir,3)**2+rho(ir,4)**2)
rhoout(ir,1)=0.5d0*(rho(ir,1) + amag)
rhoout(ir,2)=0.5d0*(rho(ir,1) - amag)
END DO
!$omp end parallel do
END IF
RETURN
END SUBROUTINE compute_rho