Skip to content

Commit

Permalink
(apr) fixing buildbot failures and slightly better fix for testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
becnealon committed Jul 24, 2024
1 parent cb05be6 commit 365d2d9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
3 changes: 1 addition & 2 deletions build/Makefile_setups
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ ifeq ($(SETUP), galcen)
endif

ifeq ($(SETUP), starcluster)
# Cluster of stars (ptmass)
# Cluster of stars (ptmass)
SETUPFILE= setup_starcluster.f90
KNOWN_SETUP=yes
endif
Expand Down Expand Up @@ -1034,7 +1034,6 @@ ifeq ($(SETUP), testapr)
APR=yes
KNOWN_SETUP=yes
PERIODIC=yes
SETUPFILE= setup_unifdisc.f90
endif

ifeq ($(SETUP), flrw)
Expand Down
1 change: 1 addition & 0 deletions src/setup/set_star_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ subroutine set_star_thermalenergy(ieos,den,pres,r,npts,npart,xyzh,vxyzu,rad,eos_
integer :: i1

i1 = 0
eni = 0. ! to prevent compiler warning
if (present(npin)) i1 = npin ! starting position in particle array

if (do_radiation) then
Expand Down
18 changes: 9 additions & 9 deletions src/setup/setup_wave.f90
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ subroutine setpart(id,npart,npartoftype,xyzh,massoftype,vxyzu,polyk,gamma,hfact,
if (id==master) then
itype = 1
print "(/,a,/)",' >>> Setting up particles for linear wave test <<<'
! call prompt(' enter number of '//trim(labeltype(itype))//' particles in x ',npartx,8,int(maxp/144.))
call prompt(' enter number of '//trim(labeltype(itype))//' particles in x ',npartx,8,int(maxp/144.))
if (use_dust) then
dust_method = 2
dtg = 1.
Expand Down Expand Up @@ -116,7 +116,7 @@ subroutine setpart(id,npart,npartoftype,xyzh,massoftype,vxyzu,polyk,gamma,hfact,
deltax = length/npartx
! try to give y boundary that is a multiple of 6 particle spacings in the low density part
fac = 6.*(int((1.-epsilon(0.))*radkern/6.) + 1)
deltay = xmaxi !fac*deltax*sqrt(0.75)
deltay = fac*deltax*sqrt(0.75)
deltaz = fac*deltax*sqrt(6.)/3.
call set_boundary(xmini,xmaxi,xmini,deltay,-deltaz,deltaz)
!
Expand All @@ -143,18 +143,18 @@ subroutine setpart(id,npart,npartoftype,xyzh,massoftype,vxyzu,polyk,gamma,hfact,
select case (itypes)
case(1)
itype = igas
! if (id==master) call prompt('enter '//trim(labeltype(itype))//&
! ' density (gives particle mass)',rhozero,0.)
if (id==master) call prompt('enter '//trim(labeltype(itype))//&
' density (gives particle mass)',rhozero,0.)

! if (id==master) call prompt('enter sound speed in code units (sets polyk)',cs,0.)
if (id==master) call prompt('enter sound speed in code units (sets polyk)',cs,0.)
if (maxvxyzu < 4) then
call bcast_mpi(cs)
polyk = cs**2
print*,' polyk = ',polyk
else
polyk = 0.
endif
! if (id==master) call prompt('enter perturbation amplitude',ampl)
if (id==master) call prompt('enter perturbation amplitude',ampl)
call bcast_mpi(ampl)
if (use_dustfrac) then
call bcast_mpi(dtg)
Expand Down Expand Up @@ -187,7 +187,7 @@ subroutine setpart(id,npart,npartoftype,xyzh,massoftype,vxyzu,polyk,gamma,hfact,
do i=npart_previous+1,npart
call set_particle_type(i,itype)

vxyzu(1,i) = 0.001 !ampl*sin(kwave*(xyzh(1,i)-xmin))
vxyzu(1,i) = ampl*sin(kwave*(xyzh(1,i)-xmin))
vxyzu(2:3,i) = 0.
!
!--perturb internal energy if not using a polytropic equation of state
Expand Down Expand Up @@ -217,8 +217,8 @@ subroutine setpart(id,npart,npartoftype,xyzh,massoftype,vxyzu,polyk,gamma,hfact,
!
!--add a little perturbation to fake some noise
!
xyzh(1,i) = xyzh(1,i) + 0.0001*(ran2(iseed)-0.5)
xyzh(2,i) = xyzh(2,i) + 0.0001*(ran2(iseed)-0.5)
! xyzh(1,i) = xyzh(1,i) + 0.0001*(ran2(iseed)-0.5)
! xyzh(2,i) = xyzh(2,i) + 0.0001*(ran2(iseed)-0.5)

enddo

Expand Down
16 changes: 11 additions & 5 deletions src/tests/testsuite.F90
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,20 @@ subroutine testsuite(string,first,last,ntests,npass,nfail)
end select
call set_default_options_testsuite(iverbose) ! set defaults

if (use_apr) then
call error(string,'-DAPR not currently compatible with test suite, recompile with APR=no')
return
endif

#ifdef FINVSQRT
call test_math(ntests,npass,usefsqrt,usefinvsqrt)
#endif

!
!--apr test
!
if (use_apr.and.testall) then
write(*,*) '-DAPR not currently compatible with test suite, recompile with APR=no'
return
elseif (use_apr.and.doapr) then
call test_apr(ntests,npass)
endif

!
!--test kernel module
!
Expand Down
9 changes: 5 additions & 4 deletions src/utils/einsteintk_wrapper.f90
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ end subroutine step_et2phantom_MoL
subroutine et2phantom_tmunu()
use part, only:npart,xyzh,vxyzu,fxyzu,fext,divcurlv,divcurlB,&
Bevol,rad,radprop,eos_vars,pxyzu,dens,metrics,tmunus,metricderivs,&
igas,rhoh,alphaind,dvdx,gradh
igas,rhoh,alphaind,dvdx,gradh,apr_level
!use part, only:xyzh,vxyzu,fxyzu,pxyzu,dens,metricderivs, metrics, npart, tmunus,eos_vars
use cons2prim, only: cons2primall
use deriv
Expand All @@ -161,7 +161,7 @@ subroutine et2phantom_tmunu()
!call init_metric(npart,xyzh,metrics)
! Calculate the cons density
call densityiterate(1,npart,npart,xyzh,vxyzu,divcurlv,divcurlB,Bevol,&
stressmax,fxyzu,fext,alphaind,gradh,rad,radprop,dvdx)
stressmax,fxyzu,fext,alphaind,gradh,rad,radprop,dvdx,apr_level)
! Get primative variables for tmunu
call cons2primall(npart,xyzh,metrics,pxyzu,vxyzu,dens,eos_vars)

Expand All @@ -183,7 +183,8 @@ end subroutine et2phantom_tmunu

subroutine phantom2et_consvar()
use part, only:npart,xyzh,vxyzu,fxyzu,fext,divcurlv,divcurlB,&
Bevol,rad,radprop,metrics,igas,rhoh,alphaind,dvdx,gradh
Bevol,rad,radprop,metrics,igas,rhoh,alphaind,dvdx,&
gradh,apr_level
use densityforce, only:densityiterate
use metric_tools, only:init_metric
use linklist, only:set_linklist
Expand All @@ -203,7 +204,7 @@ subroutine phantom2et_consvar()
call init_metric(npart,xyzh,metrics)
! Calculate the cons density
call densityiterate(1,npart,npart,xyzh,vxyzu,divcurlv,divcurlB,Bevol,&
stressmax,fxyzu,fext,alphaind,gradh,rad,radprop,dvdx)
stressmax,fxyzu,fext,alphaind,gradh,rad,radprop,dvdx,apr_level)

! Interpolate density to grid
call phantom2et_rhostar
Expand Down
4 changes: 3 additions & 1 deletion src/utils/utils_disc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ subroutine disc_analysis(xyzh,vxyz,npart,pmass,time,nbin,rmin,rmax,G,M_star,&
write(*,'(a,/)') ' Height of the disc, H, will be calculated the slow way.'
if (allocated(zsetgas)) deallocate(zsetgas)
allocate(myz(npart))
else
allocate(myz(0)) ! to prevent compiler warnings
endif

! Move everything so that the centre of mass is at the origin
Expand Down Expand Up @@ -228,8 +230,8 @@ subroutine disc_analysis(xyzh,vxyz,npart,pmass,time,nbin,rmin,rmax,G,M_star,&
deallocate(zsetgas) ! clean up
else
call calculate_H_slow(nbin,npart,H,mybin,ninbin,myz)
deallocate(myz) ! clean up
endif
deallocate(myz) ! clean up

! Print angular momentum of accreted particles
angtot = sqrt(angx*angx + angy*angy + angz*angz)
Expand Down

0 comments on commit 365d2d9

Please sign in to comment.