Skip to content

Commit

Permalink
(testgrowth) bug fix with testgrowth causing test failure with ifort+…
Browse files Browse the repository at this point in the history
…debugging flags
  • Loading branch information
danieljprice committed Aug 14, 2020
1 parent 1afdd3c commit 74e51d5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 51 deletions.
35 changes: 24 additions & 11 deletions src/main/checksetup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ end subroutine check_setup_growth
subroutine check_setup_dustgrid(nerror,nwarn)
use part, only:grainsize,graindens,ndustsmall,ndustlarge,ndusttypes
use options, only:use_dustfrac
use dim, only:use_dust
use dim, only:use_dust,use_dustgrowth
use units, only:udist
use physcon, only:km
use dust, only:idrag
Expand All @@ -600,24 +600,37 @@ subroutine check_setup_dustgrid(nerror,nwarn)
' not equal to ndusttypes: ',ndusttypes
nerror = nerror + 1
endif
do i=1,ndusttypes
if (idrag == 1 .and. grainsize(i) <= 0.) then
print*,'ERROR: grainsize = ',grainsize(i),' in dust bin ',i
!
! check that grain size array is sensible and non-zero
! except if dustgrowth is switched on, in which case the size defined in
! dustprop should be non-zero
!
if (use_dustgrowth) then
! dust growth not implemented for more than one grain size
if (ndusttypes > 1) then
print*,'ERROR: dust growth requires ndusttypes = 1, but ndusttypes = ',ndusttypes
nerror = nerror + 1
endif
enddo
else
do i=1,ndusttypes
if (idrag == 1 .and. grainsize(i) <= 0.) then
print*,'ERROR: grainsize = ',grainsize(i),' in dust bin ',i
nerror = nerror + 1
endif
enddo
do i=1,ndusttypes
if (idrag == 1 .and. graindens(i) <= 0.) then
print*,'ERROR: graindens = ',graindens(i),' in dust bin ',i
nerror = nerror + 1
endif
enddo
endif
do i=1,ndusttypes
if (grainsize(i) > 10.*km/udist) then
print*,'WARNING: grainsize is HUGE (>10km) in dust bin ',i,': s = ',grainsize(i)*udist/km,' km'
nwarn = nwarn + 1
endif
enddo
do i=1,ndusttypes
if (idrag == 1 .and. graindens(i) <= 0.) then
print*,'ERROR: graindens = ',graindens(i),' in dust bin ',i
nerror = nerror + 1
endif
enddo

end subroutine check_setup_dustgrid

Expand Down
62 changes: 22 additions & 40 deletions src/tests/test_growth.F90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ end subroutine test_growth
subroutine test_farmingbox(ntests,npass,frag,onefluid)
use boundary, only:set_boundary,xmin,xmax,ymin,ymax,zmin,zmax,dxbound,dybound,dzbound
use kernel, only:hfact_default
use part, only:igas,idust,npart,xyzh,vxyzu,npartoftype,massoftype,set_particle_type,&
use part, only:init_part,igas,idust,npart,xyzh,vxyzu,npartoftype,massoftype,set_particle_type,&
fxyzu,fext,Bevol,dBevol,dustprop,ddustprop,&
dustfrac,dustevol,ddustevol,iphase,maxtypes,&
VrelVf,dustgasprop,Omega_k,alphaind,iamtype,&
Expand All @@ -124,46 +124,25 @@ subroutine test_farmingbox(ntests,npass,frag,onefluid)
use viscosity, only:shearparam
use units, only:set_units,udist,unit_density!,unit_velocity
use domain, only:i_belong
use checksetup, only:check_setup

integer, intent(inout) :: ntests,npass
logical, intent(in) :: frag,onefluid

integer(kind=8) :: npartoftypetot(maxtypes)

integer :: nx
integer :: itype
integer :: npart_previous
integer :: i
integer :: j
integer :: nsteps
integer :: modu
integer :: noutputs
integer, allocatable :: ncheck(:)
integer, allocatable :: nerr(:)
real, allocatable :: errmax(:)
integer :: ierr
integer :: iam

logical :: do_output = .false.
real :: deltax
real :: dz
real :: hfact
real :: totmass
real :: rhozero
real :: Stcomp(20000),Stini(20000)
real :: cscomp(20000),tau(20000)
real :: s(20000),time,timelim(20000)
real :: sinit
real :: dens
real :: t
real :: tmax
real :: dt
real :: dtext
real :: dtnew
real :: guillaume
real :: dtgratio
real :: rhog
real :: rhod
integer :: nx,nerror,nwarn
integer :: itype,npart_previous,i,j,nsteps,modu,noutputs
integer :: ncheck(4),nerr(4)
real :: errmax(4)
integer :: ierr,iam

logical :: do_output = .false.
real :: deltax,dz,hfact,totmass,rhozero
real :: Stcomp(20000),Stini(20000)
real :: cscomp(20000),tau(20000)
real :: s(20000),time,timelim(20000)
real :: sinit,dens,t,tmax,dt,dtext,dtnew,guillaume,dtgratio,rhog,rhod

real, parameter :: tolst = 5.e-4
real, parameter :: tolcs = 5.e-4
Expand All @@ -173,6 +152,9 @@ subroutine test_farmingbox(ntests,npass,frag,onefluid)
character(len=15) :: stringfrag
character(len=15) :: stringmethod

! initialise particle arrays to zero
call init_part()

if (frag) then
sinit = 1./udist
gsizemincgs = 1.e-3
Expand All @@ -189,16 +171,13 @@ subroutine test_farmingbox(ntests,npass,frag,onefluid)
stringmethod = "one fluid"
ndustsmall = 1
ndustlarge = 0
allocate(ncheck(2),nerr(2),errmax(2))
dtgratio = 1.e-1
else
use_dustfrac = .false.
stringmethod = "two fluid"
ndustsmall = 0
ndustlarge = 1
allocate(ncheck(4),nerr(4),errmax(4))
endif

dens = 1./unit_density

write(*,*)'--> testing FARMINGBOX using: ',trim(stringfrag),' and ',trim(stringmethod), ' dust method'
Expand Down Expand Up @@ -290,6 +269,11 @@ subroutine test_farmingbox(ntests,npass,frag,onefluid)
massoftype(itype) = dtgratio*totmass/npartoftypetot(itype)
endif

!
! check that particle setup is sensible
!
call check_setup(nerror,nwarn)

!
! runtime parameters
!
Expand Down Expand Up @@ -393,8 +377,6 @@ subroutine test_farmingbox(ntests,npass,frag,onefluid)

call update_test_scores(ntests,nerr,npass)

deallocate(ncheck,nerr,errmax)

end subroutine test_farmingbox

subroutine write_file_err(step,t,xyzh,size,size_exact,St,St_exact,npart,prefix)
Expand Down

0 comments on commit 74e51d5

Please sign in to comment.