Skip to content

Commit 2f65823

Browse files
Bugfixes for init conds
1 parent 654e54a commit 2f65823

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/dust/dust.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,11 +1328,7 @@ if(!(gamma_star > -3.001 && gamma_star < -2.999)){ // Guard against gamma_star =
13281328
Real norm_n = stellar_mass_cent * gthr;
13291329
Real norm_d = 4. * Kokkos::numbers::pi * (Kokkos::pow(stellar_density_profile_r_up, gthr) - Kokkos::pow(stellar_density_profile_r_low, gthr));
13301330
norm = norm_n/norm_d;
1331-
1332-
1333-
13341331
} else {
1335-
printf("Doing log routine! \n");
13361332
norm = stellar_mass_cent * 1./ (4. * Kokkos::numbers::pi * Kokkos::log(stellar_density_profile_r_up/stellar_density_profile_r_low));
13371333
}
13381334
// printf("r = %e norm = %e gamma_star = %e stellar_density_profile_r_low =%e stellar_density_profile_r_up=%e stellar_mass_cent=%e\n", r, norm, gamma_star, stellar_density_profile_r_low, stellar_density_profile_r_up, stellar_mass_cent);
@@ -1866,10 +1862,6 @@ for(int gc_i = 0; gc_i < num_grain_compositions; gc_i ++ ){
18661862
total_mass_over_whole_dist_and_comps += (added_silicate_mass * agb_normalised_silicate_mass_distribution_array[gs_i]);
18671863
}
18681864

1869-
1870-
1871-
1872-
18731865
}
18741866
}
18751867

src/pgen/cluster.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,17 +1065,15 @@ void ProblemGenerator(Mesh *pmesh, ParameterInput *pin, MeshData<Real> *md) {
10651065
Real total_mass_C = 0; // Total Mass, not a density
10661066
Real total_mass_S = 0; // Total Mass, not a density
10671067
Real stellar_mass_this_cell = 0;
1068-
Real total_mass_over_whole_dist_and_comps = 0;
1069-
DustCalculateAGBWindContribution(total_mass_C,total_mass_S, total_mass_over_whole_dist_and_comps, stellar_mass_this_cell, b, k, j, i,
1068+
DustCalculateAGBWindContribution(total_mass_C,total_mass_S, total_dust_mass, stellar_mass_this_cell, b, k, j, i,
10701069
cons_pack, DustDevObj, init_run_stellar_injection_time);
10711070
// printf("A) total_mass_C=%e total_mass_S=%e \n",total_mass_C,total_mass_S);
10721071
// insert the amount of dust added by stellar injection, or the minimum amount allowed by the floor:
10731072

10741073

1075-
total_dust_mass = total_mass_C + total_mass_S;
10761074

1077-
if(total_mass_over_whole_dist_and_comps > 1e-50){
1078-
Real renorm_fractor_for_dtgfloor = std::max(total_mass_over_whole_dist_and_comps, dtgfloor*u(IDN, k, j, i)*volume ) / total_mass_over_whole_dist_and_comps;
1075+
if(total_dust_mass > 1e-50){
1076+
Real renorm_fractor_for_dtgfloor = std::max(total_dust_mass, dtgfloor*u(IDN, k, j, i)*volume ) / total_dust_mass;
10791077
total_mass_C *= renorm_fractor_for_dtgfloor;
10801078
total_mass_S *= renorm_fractor_for_dtgfloor;
10811079
//if total_mass_C == 0 or total_mass_S == 0 we are outside range of AGB winds, so need to be clever how we get the S/C ratio
@@ -1087,7 +1085,7 @@ void ProblemGenerator(Mesh *pmesh, ParameterInput *pin, MeshData<Real> *md) {
10871085
total_dust_mass_this_gc_i = total_mass_S;
10881086
}
10891087
} else {
1090-
total_dust_mass_this_gc_i = total_dust_mass; // Only one of these will be non-zero in this case if we only have 1 composition
1088+
total_dust_mass_this_gc_i = total_dust_mass *renorm_fractor_for_dtgfloor; // Only one of these will be non-zero in this case if we only have 1 composition
10911089
}
10921090
} else {
10931091

0 commit comments

Comments
 (0)