Commit b84e0275 authored by Juan Caneses Marin (nfc)'s avatar Juan Caneses Marin (nfc)
Browse files

Still no speed up with Interp1 and diff1 as subroutine functions and...

Still no speed up with Interp1 and diff1 as subroutine functions and DEFAULT(PRIVATE), but physics results are correct
parent 281b0080
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
&in_nml
! Simulation name:
! ===============
in%fileDescriptor = '2021_02_02c',
in%fileDescriptor = '2021_02_03a',

! Magnetic field input data:
! =========================
@@ -12,15 +12,15 @@ in%nz = 501, ! N

! Simulation conditions:
! =====================
in%Nparts = 600000,                                                              ! Total number of particles
in%Nsteps = 500,                                                               ! Total number of time steps
in%Nparts = 50000,                                                              ! Total number of particles
in%Nsteps = 5000,                                                               ! Total number of time steps
in%dt     = 0.5E-7,                                                             ! Time step in [s]
in%zmax = +5.0,
in%zmin = -5.0,
in%threads_request = 24,
in%threads_request = 1,
in%padding = 4,

in%iSave = .false.,
in%iSave = .true.,
in%iPush = .true.,                                                             ! Enable RK4 particle pusher
in%iColl = .false.,                                                             ! Collisions or no collisions
in%iHeat = .false.,                                                            ! Enable RF heating operator
@@ -30,8 +30,8 @@ in%iDrag = .false., !
! Time steps to record:
! ==============
in%jstart = 1,                                                                  ! start frame
in%jend   = 500,                                                               ! end frame
in%jincr  = 10,                                                                 ! increment
in%jend   = 5000,                                                               ! end frame
in%jincr  = 100,                                                                 ! increment

! Collision operator conditions:
! ==============================
+11 −2
Original line number Diff line number Diff line
@@ -211,11 +211,13 @@ CALL OMP_SET_NUM_THREADS(in%threads_request)
! Inititalize zp, kep, xip
! ==============================================================================
kep = 0.; xip = 0.; zp = 0.;
WRITE(*,*) "Initializing PDF..."
!$OMP PARALLEL DO
DO i = 1,in%Nparts
  CALL loadParticles(zp(i,1),kep(i,1),xip(i,1),in)
END DO
!$OMP END PARALLEL DO
WRITE(*,*) "Initialization complete"

! Test initial distribution:
! ==========================================================================
@@ -243,7 +245,11 @@ ostart = OMP_GET_WTIME()
! ==============================================================================
TimeStepping: do j = 1,in%Nsteps

    !$OMP PARALLEL DEFAULT(SHARED) PRIVATE(pcnt1,pcnt2,pcnt3,pcnt4,ecnt1,ecnt2,ecnt3,ecnt4,i,df)
!$OMP PARALLEL DEFAULT(PRIVATE) &
!$OMP SHARED(j,zp,kep,xip,fcurr,fnew,in,ecount1,ecount2,ecount3,ecount4,pcount1,pcount2,pcount3,pcount4) , &
!$OMP& SHARED(spline_ddBz,spline_Bz,spline_Phi)

          ! ! PRIVATE(pcnt1,pcnt2,pcnt3,pcnt4,ecnt1,ecnt2,ecnt3,ecnt4,i,df)

          ! Initialize private particle counters:
          pcnt1 = 0; pcnt2 = 0; pcnt3 = 0; pcnt4 = 0
@@ -258,6 +264,9 @@ TimeStepping: do j = 1,in%Nsteps
              AllParticles: do i = 1,in%Nparts

            		if (j .EQ. 1 .AND. i .EQ. 1) then
	                  WRITE(*,*) "spline_ddBz", spline_ddBz%n
	                  WRITE(*,*) "spline_Phi", spline_Phi%n
	                  WRITE(*,*) "spline_Bz", spline_Bz%n
			  in%threads_given = OMP_GET_NUM_THREADS()
            		  WRITE(*,*) ''
            		  WRITE(*,*) '*********************************************************************'
+8 −6
Original line number Diff line number Diff line
@@ -432,31 +432,33 @@ return
END SUBROUTINE loadParticles

! =======================================================================================================
FUNCTION Interp1(xq, spline0)
REAL(r8) FUNCTION Interp1(xq, spline0)
! =======================================================================================================
  USE local
  USE spline_fits
  USE dataTYP

  IMPLICIT NONE
  TYPE(splTYP) :: spline0
  REAL(r8) :: xq, Interp1, curv2
  REAL(r8) :: xq, curv2

  Interp1 = curv2(xq,spline0%n,spline0%x,spline0%y,spline0%yp,spline0%sigma)
  !Interp1 = 1.

  RETURN
END FUNCTION Interp1

! =======================================================================================================
FUNCTION diff1(xq, spline0)
REAL(r8) FUNCTION diff1(xq, spline0)
! =======================================================================================================
  USE local
  USE spline_fits
  USE dataTYP

  IMPLICIT NONE
  TYPE(splTYP) :: spline0
  REAL(r8) :: xq, diff1, curvd
  REAL(r8) :: xq, curvd

  diff1 = curvd(xq,spline0%n,spline0%x,spline0%y,spline0%yp,spline0%sigma)
 ! diff1 = 0.1

 RETURN
END FUNCTION diff1