65 auto edges = get_edges();
67 auto &part_counts = edges.part_counts.indexes;
70 edges.hpart.check_sizes(part_counts);
71 edges.s_j.check_sizes(part_counts);
72 edges.t_j.check_sizes(part_counts);
75 edges.Ttilde_sj.ensure_sizes(part_counts);
77 const Tscal pmass = edges.gpart_mass.value;
79 auto total_specie_count = part_counts.template map<u32>([&](
u64 id,
u32 count) {
86 shamsys::instance::get_compute_scheduler_ptr(),
88 edges.hpart.get_spans(), edges.s_j.get_spans(), edges.t_j.get_spans()},
91 [pmass, ndust = ndust](
93 const Tscal *__restrict hpart,
94 const Tscal *__restrict s_j,
95 const Tscal *__restrict t_j,
96 Tscal *__restrict Ttilde_sj
98 u32 id_a = thread_id / ndust;
99 u32 jdust = thread_id % ndust;
101 Tscal h_a = hpart[id_a];
102 Tscal sj_a = s_j[thread_id];
103 Tscal tj_a = t_j[thread_id];
105 using namespace shamrock::sph;
106 Tscal rho_a = rho_h(pmass, h_a, Kernel::hfactd);
108 auto epsilon = [&](Tscal sj) {
109 return sj * sj / rho_a;
118 Tscal eps_j_a = epsilon(sj_a);
119 Tscal Ttilde_sj_a = eps_j_a * tj_a;
121 for (
u32 k = 0; k < ndust; k++) {
122 Tscal sk_a = s_j[id_a * ndust + k];
123 Tscal tk_a = t_j[id_a * ndust + k];
125 Tscal eps_k_a = epsilon(sk_a);
126 Ttilde_sj_a -= eps_k_a * eps_k_a * tk_a;
133 for (
u32 k = 0; k < ndust; k++) {
134 Tscal sk_a = s_j[id_a * ndust + k];
135 Tscal tk_a = t_j[id_a * ndust + k];
136 Tscal eps_k_a = epsilon(sk_a);
138 sum_Tseps += eps_k_a * tk_a;
140 Tscal Ttilde_sj_a = (tj_a - sum_Tseps) / (1 - sum_eps);
142 Ttilde_sj[thread_id] = Ttilde_sj_a;