@@ -829,26 +829,27 @@ struct DustDevice {
829829 int only_sputtering_for_debug;
830830 Real whole_box_extent;
831831
832- // AGB vars
833- Real agb_max_radius;
834- Real gamma_star;
835- Real sersic_n;
836- Real sersic_Re;
837- Real stellar_profile_norm;
838- Real stellar_mass_cent;
839- Real stellar_density_profile_r_low;
840- Real stellar_density_profile_r_up;
841- Real dust_return_silicates_mass_fraction_per_megayear;
842- Real dust_return_carbon_mass_fraction_per_megayear;
843- Real code_to_megayear;
844- int carbonaceous_grains;
845- int silicate_grains;
846- ParArray1D<Real> agb_normalised_carbonaceous_mass_distribution_array;
847- ParArray1D<Real> agb_normalised_carbonaceous_number_distribution_array;
848- ParArray1D<Real> agb_normalised_silicate_mass_distribution_array;
849- ParArray1D<Real> agb_normalised_silicate_number_distribution_array;
850- StellarRadialProfile stellar_radial_profile;
851- // fjjcurrent
832+ // AGB vars
833+ Real agb_max_radius;
834+ Real gamma_star;
835+ Real sersic_n;
836+ Real sersic_Re;
837+ Real stellar_profile_norm;
838+ Real stellar_mass_cent;
839+ Real stellar_density_profile_r_low;
840+ Real stellar_density_profile_r_up;
841+ Real dust_return_silicates_mass_fraction_per_megayear;
842+ Real dust_return_carbon_mass_fraction_per_megayear;
843+ Real code_to_megayear;
844+ int carbonaceous_grains;
845+ int silicate_grains;
846+ ParArray1D<Real> agb_normalised_carbonaceous_mass_distribution_array;
847+ ParArray1D<Real> agb_normalised_carbonaceous_number_distribution_array;
848+ ParArray1D<Real> agb_normalised_silicate_mass_distribution_array;
849+ ParArray1D<Real> agb_normalised_silicate_number_distribution_array;
850+ StellarRadialProfile stellar_radial_profile;
851+
852+ // fjjcurrent
852853
853854 // Helper function for calculating the cooling rates for the Linear reconstruction
854855 // method
@@ -1207,7 +1208,6 @@ struct DustDevice {
12071208
12081209
12091210
1210-
12111211
12121212 // top-level function to call for DW dust cooling. Can decide here to do for single size bin or for all bins
12131213 KOKKOS_INLINE_FUNCTION
@@ -1237,6 +1237,9 @@ struct DustDevice {
12371237 integrated_rates
12381238 );
12391239 } else { // over all dust bins
1240+
1241+ // printf("A single_grain_densities.extent(0)=%d grain_midbin_sizes_microm.extent(0)=%d \n ", single_grain_densities.extent(0), grain_midbin_sizes_microm.extent(0));
1242+ KOKKOS_ASSERT (single_grain_densities.extent (0 )*grain_midbin_sizes_microm.extent (0 )>=1 );
12401243 for (int gc_i = 0 ; gc_i < single_grain_densities.extent (0 ); gc_i++){ // loop over grain compositions
12411244 for (int gs_i = 0 ; gs_i < grain_midbin_sizes_microm.extent (0 ); gs_i++){ // loop over grain sizes
12421245 // get correct index into cons_pack subview for this grain type and size bin
@@ -2567,55 +2570,37 @@ void DustFilladotView(const Real temperature, const int gc_i, const int gs_i, co
25672570 DustCalculateAdotPerBin (temperature, rho, DustDevObj, adot_sputter, adot_accretion,
25682571 adot);
25692572
2570- const Real whole_box_extent = DustDevObj.whole_box_extent ;
2571- const auto coords = cons_pack.GetCoords (b);
2572- const auto x = coords.Xc <1 >(i);
2573- const auto y = coords.Xc <2 >(j);
2574- const auto z = coords.Xc <3 >(k);
2575- const auto r = Kokkos::sqrt (x * x + y * y + z * z);
2576- // Check correct signs. Don;t worry too much if very near a boundary, where densities
2577- // might go weird
2578- if (adot_sputter > 0 || adot_sputter != adot_sputter) {
2579- if (std::abs (x) < 0.9 * whole_box_extent && std::abs (y) < 0.9 * whole_box_extent &&
2580- std::abs (z) < 0.9 * whole_box_extent) {
2581- // printf("[FJJ DEBUG] Sputtering is growing grains! x=%e y =%e z=%e r=%e
2582- // whole_box_extent=%e f_sput=%e rho =%e adot_sputter=%e sput_prefac=%e
2583- // sput_dens=%e sput_T=%e \n", x,y,z,r, whole_box_extent, f_sput, rho,
2584- // adot_sputter, sput_prefac, sput_dens, sput_T);
2585- printf (" [FJJ DEBUG] Sputtering is growing grains! x=%e y =%e z=%e "
2586- " whole_box_extent=%e rho =%e\n " ,
2587- x, y, z, whole_box_extent, rho);
2588- }
2589- if (std::abs (x) < 0.9 * whole_box_extent && std::abs (y) < 0.9 * whole_box_extent &&
2590- std::abs (z) < 0.9 * whole_box_extent) { // ignore weird things at box boundary
2591- // e.g. negative densities
2592- printf (" [FJJ DEBUG] Sputtering is growing grains inside of the boundary! x=%e y "
2593- " =%e z=%e whole_box_extent=%e rho =%e temperature=%e\n " ,
2594- x, y, z, whole_box_extent, rho, temperature);
2595- PARTHENON_REQUIRE (adot_sputter <= 0 , " Sputtering is growing grains!" );
2596- PARTHENON_REQUIRE (adot_sputter == adot_sputter, " adot_sputter is nan!" );
2597- }
2598- adot_sputter = 0 .;
2599- adot_accretion = 0 ; // don;t do any dust updates if sputtering already is bad
2600- adot = 0 .;
2601- }
2602- if (adot_accretion < 0 || adot_accretion != adot_accretion) {
2603- if (std::abs (x) < 0.9 * whole_box_extent && std::abs (y) < 0.9 * whole_box_extent &&
2604- std::abs (z) < 0.9 * whole_box_extent) {
2605- printf (" [FJJ DEBUG] Accretion is shrinking grains! x=%e y =%e z=%e r=%e "
2606- " whole_box_extent=%e rho =%e adot_accretion=%e \n " ,
2607- x, y, z, r, whole_box_extent, rho, adot_accretion);
2608- }
2609-
2610- if (std::abs (x) < 0.9 * whole_box_extent && std::abs (y) < 0.9 * whole_box_extent &&
2611- std::abs (z) < 0.9 * whole_box_extent) { // ignore weird things at box boundary
2612- // e.g. negative densities
2613- printf (" [FJJ DEBUG] Accretion is shrinking grains inside of the boundary! x=%e y "
2614- " =%e z=%e r=%e whole_box_extent=%e rho =%e adot_accretion=%e \n " ,
2615- x, y, z, r, whole_box_extent, rho, adot_accretion);
2616- PARTHENON_REQUIRE (adot_accretion >= 0 , " Accretion is shrinking grains!" );
2617- PARTHENON_REQUIRE (adot_accretion == adot_accretion, " adot_sputter is nan!" );
2618- }
2573+ const Real whole_box_extent = DustDevObj.whole_box_extent ;
2574+ const auto coords = cons_pack.GetCoords (b);
2575+ const auto x = coords.Xc <1 >(i);
2576+ const auto y = coords.Xc <2 >(j);
2577+ const auto z = coords.Xc <3 >(k);
2578+ const auto r = Kokkos::sqrt (x * x + y * y + z * z);
2579+ // Check correct signs. Don;t worry too much if very near a boundary, where densities might go weird
2580+ if (adot_sputter > 0 || adot_sputter != adot_sputter){
2581+ if (std::abs (x) < 0.9 *whole_box_extent && std::abs (y) < 0.9 *whole_box_extent && std::abs (z) < 0.9 *whole_box_extent){
2582+ // printf("[FJJ DEBUG] Sputtering is growing grains! x=%e y =%e z=%e r=%e whole_box_extent=%e f_sput=%e rho =%e adot_sputter=%e sput_prefac=%e sput_dens=%e sput_T=%e \n", x,y,z,r, whole_box_extent, f_sput, rho, adot_sputter, sput_prefac, sput_dens, sput_T);
2583+ // printf("[FJJ DEBUG] Sputtering is growing grains! x=%e y =%e z=%e whole_box_extent=%e rho =%e\n", x,y,z, whole_box_extent, rho);
2584+ }
2585+ if (std::abs (x) < 0.9 *whole_box_extent && std::abs (y) < 0.9 *whole_box_extent && std::abs (z) < 0.9 *whole_box_extent){ // ignore weird things at box boundary e.g. negative densities
2586+ // printf("[FJJ DEBUG] Sputtering is growing grains inside of the boundary! x=%e y =%e z=%e whole_box_extent=%e rho =%e temperature=%e\n", x,y,z, whole_box_extent, rho, temperature);
2587+ // PARTHENON_REQUIRE(adot_sputter <= 0 , "Sputtering is growing grains!");
2588+ // PARTHENON_REQUIRE(adot_sputter == adot_sputter , "adot_sputter is nan!");
2589+ }
2590+ adot_sputter = 0 .;
2591+ adot_accretion = 0 ; // don;t do any dust updates if sputtering already is bad
2592+ adot = 0 .;
2593+ }
2594+ if (adot_accretion < 0 || adot_accretion != adot_accretion){
2595+ if (std::abs (x) < 0.9 *whole_box_extent && std::abs (y) < 0.9 *whole_box_extent && std::abs (z) < 0.9 *whole_box_extent){
2596+ // printf("[FJJ DEBUG] Accretion is shrinking grains! x=%e y =%e z=%e r=%e whole_box_extent=%e rho =%e adot_accretion=%e \n", x,y,z,r, whole_box_extent, rho, adot_accretion);
2597+ }
2598+
2599+ if (std::abs (x) < 0.9 *whole_box_extent && std::abs (y) < 0.9 *whole_box_extent && std::abs (z) < 0.9 *whole_box_extent){ // ignore weird things at box boundary e.g. negative densities
2600+ // printf("[FJJ DEBUG] Accretion is shrinking grains inside of the boundary! x=%e y =%e z=%e r=%e whole_box_extent=%e rho =%e adot_accretion=%e \n", x,y,z,r, whole_box_extent, rho, adot_accretion);
2601+ // PARTHENON_REQUIRE(adot_accretion >= 0, "Accretion is shrinking grains!");
2602+ // PARTHENON_REQUIRE(adot_accretion == adot_accretion , "adot_sputter is nan!");
2603+ }
26192604
26202605 adot_sputter = 0 .;
26212606 adot_accretion = 0 ; // don;t do any dust updates if sputtering already is bad
0 commit comments