Skip to content

Commit

Permalink
Adding option to ignore sink particles
Browse files Browse the repository at this point in the history
  • Loading branch information
cpinte committed Dec 8, 2023
1 parent ca79819 commit 0939889
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/init_mcfost.f90
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ subroutine set_default_variables()
image_offset_centre(:) = (/0.0,0.0,0.0/)
loverwrite_s12 = .false.
lnot_random_Voronoi = .false.
lignore_sink=.false.

tmp_dir = "./"

Expand Down Expand Up @@ -1463,6 +1464,9 @@ subroutine initialisation_mcfost()
case("-not_random_Voronoi")
i_arg = i_arg + 1
lnot_random_Voronoi = .true.
case("-ignore_sink")
i_arg = i_arg + 1
lignore_sink=.true.
case default
write(*,*) "Error: unknown option: "//trim(s)
write(*,*) "Use 'mcfost -h' to get list of available options"
Expand Down Expand Up @@ -2073,6 +2077,7 @@ subroutine display_help()
write(*,*) " (only works with 1 grain size dump)"
write(*,*) " : -force_Mgas : force the gas mass to be the value given the mcfost parameter file"
write(*,*) " : -not_random_Voronoi : force the particle order to remain the same"
write(*,*) " : -ignore_sink : forces nptmass to 0, ie not stars in mcfost"
write(*,*) ""
write(*,*) "You can find the full documentation at:"
write(*,*) trim(doc_webpage)
Expand Down
2 changes: 1 addition & 1 deletion src/parameters.f90
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ module parametres
logical :: ldelete_inside_rsph, ldelete_outside_rsph, ldelete_above_theta
real(kind=dp) :: ufac_implicit,scale_length_units_factor,scale_mass_units_factor,correct_density_factor_elongated_cells
real(kind=dp) :: SPH_amin, SPH_amax, fluffyness, gap_factor, rsph_min, rsph_max
logical :: lupdate_velocities, lno_vr, lno_vz, lvphi_Kep, lfluffy, lnot_random_Voronoi
logical :: lupdate_velocities, lno_vr, lno_vz, lvphi_Kep, lfluffy, lnot_random_Voronoi, lignore_sink
integer :: isink_centre

! Disk parameters
Expand Down
37 changes: 20 additions & 17 deletions src/read_phantom.f90
Original file line number Diff line number Diff line change
Expand Up @@ -984,23 +984,26 @@ subroutine phantom_2_mcfost(np,nptmass,ntypes,ndusttypes,ldust_moments,n_files,d
ldudt_implicit = .false.
endif

write(*,*) "# Stars/planets:"
n_etoiles_old = n_etoiles
n_etoiles = 0
do i=1,nptmass
n_etoiles = n_etoiles + 1
if (real(xyzmh_ptmass(4,i)) * scale_mass_units_factor > 0.013) then
write(*,*) "Star #", i, "xyz=", real(xyzmh_ptmass(1:3,i) * ulength_au), "au, M=", &
real(xyzmh_ptmass(4,i) * usolarmass), "Msun, Mdot=", &
real(xyzmh_ptmass(16,i) * usolarmass / utime_scaled * year_to_s ), "Msun/yr"
else
write(*,*) "Planet #", i, "xyz=", real(xyzmh_ptmass(1:3,i) * ulength_au), "au, M=", &
real(xyzmh_ptmass(4,i) * GxMsun/GxMjup * usolarmass), "Mjup, Mdot=", &
real(xyzmh_ptmass(16,i) * usolarmass / utime_scaled * year_to_s ), "Msun/yr"
endif
if (i>1) write(*,*) " distance=", real(norm2(xyzmh_ptmass(1:3,i) - xyzmh_ptmass(1:3,1))*ulength_au), "au"
enddo

if (lignore_sink) then
n_etoiles = 0
else
write(*,*) "# Stars/planets:"
n_etoiles_old = n_etoiles
n_etoiles = 0
do i=1,nptmass
n_etoiles = n_etoiles + 1
if (real(xyzmh_ptmass(4,i)) * scale_mass_units_factor > 0.013) then
write(*,*) "Star #", i, "xyz=", real(xyzmh_ptmass(1:3,i) * ulength_au), "au, M=", &
real(xyzmh_ptmass(4,i) * usolarmass), "Msun, Mdot=", &
real(xyzmh_ptmass(16,i) * usolarmass / utime_scaled * year_to_s ), "Msun/yr"
else
write(*,*) "Planet #", i, "xyz=", real(xyzmh_ptmass(1:3,i) * ulength_au), "au, M=", &
real(xyzmh_ptmass(4,i) * GxMsun/GxMjup * usolarmass), "Mjup, Mdot=", &
real(xyzmh_ptmass(16,i) * usolarmass / utime_scaled * year_to_s ), "Msun/yr"
endif
if (i>1) write(*,*) " distance=", real(norm2(xyzmh_ptmass(1:3,i) - xyzmh_ptmass(1:3,1))*ulength_au), "au"
enddo
endif

if (lupdate_velocities) then
if (lno_vz) vz(:) = 0.
Expand Down

0 comments on commit 0939889

Please sign in to comment.