Skip to content

Commit

Permalink
(#450; #55) fix issues in readwrite_dumps with ifort and DEBUG=yes
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljprice committed Jul 10, 2023
1 parent e6319d5 commit b14e87c
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 150 deletions.
1 change: 0 additions & 1 deletion src/main/deriv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ subroutine derivs(icall,npart,nactive,xyzh,vxyzu,fxyzu,fext,divcurlv,divcurlB,&
! set new timestep from Courant/forces condition
!
if (ind_timesteps) then
print*,'dtnew = ',dtmax,nbinmax,2**nbinmax !,dtmax/2**nbinmax
dtnew = dtmax/2.**nbinmax ! minimum timestep over all particles
else
dtnew = min(dtforce,dtcourant,dtrad,dtmax)
Expand Down
20 changes: 15 additions & 5 deletions src/main/part.F90
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ module part
character(len=*), parameter :: vxyzu_label(4) = (/'vx','vy','vz','u '/)
character(len=*), parameter :: Bxyz_label(3) = (/'Bx','By','Bz'/)
character(len=*), parameter :: Bevol_label(4) = (/'Bx/rho','By/rho','Bz/rho','psi '/)
character(len=*), parameter :: alphaind_label(3) = (/'alpha ','alphaloc','div_a '/)

!
!--tracking particle IDs
!
Expand Down Expand Up @@ -120,6 +122,13 @@ module part
character(len=*), parameter :: abundance_label(5) = &
(/'h2ratio','abHIq ','abhpq ','abeq ','abco '/)
#endif
!
!--make a public krome_nmols variable to avoid ifdefs elsewhere
!
#ifndef KROME
integer, parameter :: krome_nmols = 0
#endif

!
!--eos_variables
!
Expand Down Expand Up @@ -438,6 +447,7 @@ module part

private :: hrho4,hrho8,hrho4_pmass,hrho8_pmass,hrhomixed_pmass
private :: get_ntypes_i4,get_ntypes_i8

contains

subroutine allocate_part
Expand Down Expand Up @@ -506,11 +516,11 @@ subroutine allocate_part
call allocate_array('nucleation', nucleation, n_nucleation, maxp_nucleation*inucleation)
call allocate_array('tau', tau, maxp*itau_alloc)
call allocate_array('tau_lucy', tau_lucy, maxp*itauL_alloc)
#ifdef KROME
call allocate_array('abundance', abundance, krome_nmols, maxp_krome)
#else
call allocate_array('abundance', abundance, nabundances, maxp_h2)
#endif
if (use_krome) then
call allocate_array('abundance', abundance, krome_nmols, maxp_krome)
else
call allocate_array('abundance', abundance, nabundances, maxp_h2)
endif
call allocate_array('gamma_chem', gamma_chem, maxp_krome)
call allocate_array('mu_chem', mu_chem, maxp_krome)
call allocate_array('T_gas_cool', T_gas_cool, maxp_krome)
Expand Down
27 changes: 14 additions & 13 deletions src/main/readwrite_dumps_common.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,27 +118,28 @@ end subroutine get_options_from_fileid
!---------------------------------------------------------------
subroutine check_arrays(i1,i2,noffset,npartoftype,npartread,nptmass,nsinkproperties,massoftype,&
alphafile,tfile,phantomdump,got_iphase,got_xyzh,got_vxyzu,got_alpha, &
got_krome_mols,got_krome_gamma,got_krome_mu,got_krome_T,got_x,got_z,got_mu, &
got_krome_mols,got_krome_gamma,got_krome_mu,got_krome_T, &
got_abund,got_dustfrac,got_sink_data,got_sink_vels,got_Bxyz,got_psi,got_dustprop,got_pxyzu,got_VrelVf, &
got_dustgasprop,got_temp,got_raden,got_kappa,got_Tdust,got_nucleation,got_iorig,iphase,&
got_dustgasprop,got_rad,got_radprop,got_Tdust,got_eosvars,got_nucleation,got_iorig,iphase,&
xyzh,vxyzu,pxyzu,alphaind,xyzmh_ptmass,Bevol,iorig,iprint,ierr)
use dim, only:maxp,maxvxyzu,maxalpha,maxBevol,mhd,h2chemistry,use_dustgrowth,gr,&
do_radiation,store_dust_temperature,do_nucleation
use eos, only:ieos,polyk,gamma,eos_is_non_ideal
use part, only:maxphase,isetphase,set_particle_type,igas,ihacc,ihsoft,imacc,ilum,&
xyzmh_ptmass_label,vxyz_ptmass_label,get_pmass,rhoh,dustfrac,ndusttypes,norig
use part, only:maxphase,isetphase,set_particle_type,igas,ihacc,ihsoft,imacc,ilum,ikappa,&
xyzmh_ptmass_label,vxyz_ptmass_label,get_pmass,rhoh,dustfrac,ndusttypes,norig,&
itemp,iX,iZ,imu
use io, only:warning,id,master
use options, only:alpha,use_dustfrac,use_var_comp
use sphNGutils, only:itype_from_sphNG_iphase,isphNG_accreted
use dust_formation, only:init_nucleation
integer, intent(in) :: i1,i2,noffset,npartoftype(:),npartread,nptmass,nsinkproperties
real, intent(in) :: massoftype(:),alphafile,tfile
logical, intent(in) :: phantomdump,got_iphase,got_xyzh(:),got_vxyzu(:),got_alpha,got_dustprop(:)
logical, intent(in) :: got_VrelVf,got_dustgasprop(:),got_x,got_z,got_mu
logical, intent(in) :: phantomdump,got_iphase,got_xyzh(:),got_vxyzu(:),got_alpha(:),got_dustprop(:)
logical, intent(in) :: got_VrelVf,got_dustgasprop(:)
logical, intent(in) :: got_abund(:),got_dustfrac(:),got_sink_data(:),got_sink_vels(:),got_Bxyz(:)
logical, intent(in) :: got_krome_mols(:),got_krome_gamma,got_krome_mu,got_krome_T
logical, intent(in) :: got_psi,got_temp,got_Tdust,got_nucleation(:),got_pxyzu(:),got_raden(:)
logical, intent(in) :: got_kappa,got_iorig
logical, intent(in) :: got_psi,got_Tdust,got_eosvars(:),got_nucleation(:),got_pxyzu(:),got_rad(:)
logical, intent(in) :: got_radprop(:),got_iorig
integer(kind=1), intent(inout) :: iphase(:)
integer(kind=8), intent(inout) :: iorig(:)
real, intent(inout) :: vxyzu(:,:),Bevol(:,:),pxyzu(:,:)
Expand Down Expand Up @@ -247,15 +248,15 @@ subroutine check_arrays(i1,i2,noffset,npartoftype,npartread,nptmass,nsinkpropert
return
endif
#endif
if (eos_is_non_ideal(ieos) .and. .not.got_temp) then
if (eos_is_non_ideal(ieos) .and. .not.got_eosvars(itemp)) then
if (id==master .and. i1==1) write(*,"(/,a,/)") 'WARNING: missing temperature information from file'
endif
use_var_comp = (got_x .and. got_z .and. got_mu)
use_var_comp = (got_eosvars(iX) .and. got_eosvars(iZ) .and. got_eosvars(imu))
if (store_dust_temperature .and. .not.got_Tdust) then
if (id==master .and. i1==1) write(*,"(/,a,/)") 'WARNING: missing dust temperature information from file'
endif
if (maxalpha==maxp) then
if (got_alpha) then
if (got_alpha(1)) then
if (alphafile < 0.99 .and. tfile > 0.) then
if (any(alphaind(1,i1:i2) > 1.0 .or. alphaind(1,i1:i2) < 0.)) then
if (id==master) write(iprint,*) 'ERROR! AV alpha < 0 or alpha > 1 in dump file: using alpha'
Expand Down Expand Up @@ -335,11 +336,11 @@ subroutine check_arrays(i1,i2,noffset,npartoftype,npartread,nptmass,nsinkpropert
! radiation arrays
!
if (do_radiation) then
if (.not.all(got_raden)) then
if (.not.all(got_rad)) then
if (id==master .and. i1==1) write(*,*) 'ERROR: RADIATION=yes but radiation arrays not found in Phantom dump file'
ierr = ierr + 1
endif
if (.not.got_kappa) then
if (.not.got_radprop(ikappa)) then
if (id==master .and. i1==1) write(*,"(/,a,/)") 'WARNING: RADIATION=yes but opacity not found in Phantom dump file'
endif
endif
Expand Down
Loading

0 comments on commit b14e87c

Please sign in to comment.