Skip to content

Commit

Permalink
Merge pull request #1 from ChristopherMayes/main
Browse files Browse the repository at this point in the history
Move main to master
  • Loading branch information
ChristopherMayes authored Mar 18, 2021
2 parents d0ba90a + b06a488 commit 08e9b73
Show file tree
Hide file tree
Showing 6 changed files with 1,329 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/*
*.DS_Store
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if(GetFFTW)
# FFTW3
include(ExternalProject)
ExternalProject_Add(project_fftw
URL http://www.fftw.org/fftw-3.3.7.tar.gz
URL http://www.fftw.org/fftw-3.3.9.tar.gz
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/fftw
CONFIGURE_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/fftw/src/project_fftw/configure --enable-openmp --prefix=<INSTALL_DIR>
BUILD_COMMAND make -j 8
Expand Down
28 changes: 14 additions & 14 deletions code/open_spacecharge_core_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ subroutine osc_freespace_solver(rho,gam0,delta,phi,efield,bfield,nlo,nhi,nlo_gbl
complex(dp), allocatable, dimension(:,:,:) :: crho

integer :: icomp,i,j,k,im1,ip1,jm1,jp1,km1,kp1
real(dp) :: gb0,xfac,yfac,zfac
real(dp) :: beta0,xfac,yfac,zfac
integer :: mprocs,myrank,ierr
real(dp), parameter :: clight=299792458.d0
!
Expand Down Expand Up @@ -124,12 +124,12 @@ subroutine osc_freespace_solver(rho,gam0,delta,phi,efield,bfield,nlo,nhi,nlo_gbl
endif

! set the magnetic field:
gb0=sqrt((gam0+1.d0)*(gam0-1.d0))
beta0=sqrt(1-1/gam0**2)
do k=lbound(phi,3),ubound(phi,3)
do j=lbound(phi,2),ubound(phi,2)
do i=lbound(phi,1),ubound(phi,1)
bfield(i,j,k,1)=-efield(i,j,k,2)/clight/gb0/gam0
bfield(i,j,k,2)= efield(i,j,k,1)/clight/gb0/gam0
bfield(i,j,k,1)=-efield(i,j,k,2)*beta0/clight
bfield(i,j,k,2)= efield(i,j,k,1)*beta0/clight
bfield(i,j,k,3)=0.d0
enddo
enddo
Expand Down Expand Up @@ -554,7 +554,7 @@ subroutine osc_rectpipe_solver(rho,a,b,gam0,delta,umin,phi,efield,bfield,nlo,nhi
integer :: icomp
real(dp), parameter :: clight=299792458.d0
integer :: i,j,k,im1,ip1,jm1,jp1,km1,kp1
real(dp) :: gb0,xfac,yfac,zfac
real(dp) :: beta0,xfac,yfac,zfac

dx=delta(1); dy=delta(2); dz=delta(3)
xmin=umin(1); ymin=umin(2); zmin=umin(3)
Expand Down Expand Up @@ -610,12 +610,12 @@ subroutine osc_rectpipe_solver(rho,a,b,gam0,delta,umin,phi,efield,bfield,nlo,nhi
endif

! set the magnetic field:
gb0=sqrt((gam0+1.d0)*(gam0-1.d0))
beta0=sqrt(1-1/gam0**2)
do k=lbound(phi,3),ubound(phi,3)
do j=lbound(phi,2),ubound(phi,2)
do i=lbound(phi,1),ubound(phi,1)
bfield(i,j,k,1)=-efield(i,j,k,2)/clight/gb0/gam0
bfield(i,j,k,2)= efield(i,j,k,1)/clight/gb0/gam0
bfield(i,j,k,1)=-efield(i,j,k,2)*beta0/clight
bfield(i,j,k,2)= efield(i,j,k,1)*beta0/clight
bfield(i,j,k,3)=0.d0
enddo
enddo
Expand Down Expand Up @@ -924,7 +924,7 @@ subroutine osc_cathodeimages_solver(rho,gam0,umin,delta,phi,efield,bfield,nlo,nh
complex(dp), allocatable, dimension(:,:,:) :: crho

integer :: icomp,i,j,k,im1,ip1,jm1,jp1,km1,kp1
real(dp) :: gb0,xfac,yfac,zfac
real(dp) :: beta0,xfac,yfac,zfac
integer :: mprocs,myrank,ierr
real(dp), parameter :: clight=299792458.d0
!
Expand Down Expand Up @@ -1067,14 +1067,14 @@ subroutine osc_cathodeimages_solver(rho,gam0,umin,delta,phi,efield,bfield,nlo,nh
endif ! idirectfieldcalc

! set the magnetic field:
gb0=sqrt((gam0+1.d0)*(gam0-1.d0))
beta0=sqrt(1-1/gam0**2)
do k=lbound(phi,3),ubound(phi,3)
do j=lbound(phi,2),ubound(phi,2)
do i=lbound(phi,1),ubound(phi,1)
! bfield(i,j,k,1)=-efield(i,j,k,2)/clight/gb0/gam0
! bfield(i,j,k,2)= efield(i,j,k,1)/clight/gb0/gam0
bfield(i,j,k,1)=-(efield(i,j,k,2)+2.d0*efieldimg(i,j,k,2))/clight/gb0/gam0 !I subtracted efieldimg above,
bfield(i,j,k,2)= (efield(i,j,k,1)+2.d0*efieldimg(i,j,k,1))/clight/gb0/gam0 !so add it back 2x to get sum
! bfield(i,j,k,1)=-efield(i,j,k,2)*beta0/clight
! bfield(i,j,k,2)= efield(i,j,k,1)*beta0/clight
bfield(i,j,k,1)=-(efield(i,j,k,2)+2.d0*efieldimg(i,j,k,2))*beta0/clight !I subtracted efieldimg above,
bfield(i,j,k,2)= (efield(i,j,k,1)+2.d0*efieldimg(i,j,k,1))*beta0/clight !so add it back 2x to get sum
bfield(i,j,k,3)=0.d0
enddo
enddo
Expand Down
Loading

0 comments on commit 08e9b73

Please sign in to comment.