28 using Tscal = shambase::VecComponent<Tvec>;
29 using Kernel = SPHKernel<Tscal>;
30 static constexpr Tscal hfactd = Kernel::hfactd;
31 static constexpr Tscal rker2 = Kernel::Rkern * Kernel::Rkern;
38 inline void operator()(
40 const Tvec *__restrict xyz,
41 const Tscal *__restrict hpart,
42 const Tvec *__restrict vxyz,
43 const Tscal *__restrict uint,
44 const Tscal *__restrict omega,
45 const Tscal *__restrict pressure,
46 const Tscal *__restrict cs,
47 const Tscal *__restrict alpha_AV,
48 const Tvec *__restrict B_on_rho,
50 Tvec *__restrict axyz,
51 Tscal *__restrict duint)
const {
53 using namespace shamrock::sph;
57 Tvec xyz_a = xyz[id_a];
58 Tscal h_a = hpart[id_a];
59 Tvec vxyz_a = vxyz[id_a];
60 Tscal u_a = uint[id_a];
61 Tscal omega_a = omega[id_a];
62 Tscal P_a = pressure[id_a];
63 Tscal cs_a = cs[id_a];
64 Tscal alpha_a = alpha_AV[id_a];
66 Tscal rho_a = rho_h(pmass, h_a, hfactd);
67 Tscal rho_a_sq = rho_a * rho_a;
68 Tscal rho_a_inv = 1. / rho_a;
70 Tscal omega_a_rho_a_inv = 1 / (omega_a * rho_a);
72 Tvec B_a = B_on_rho[id_a] * rho_a;
74 Tvec force_pressure = Tvec{0, 0, 0};
75 Tscal tmpdU_pressure = Tscal{0};
77 particle_looper.for_each_object(id_a, [&](
u32 id_b) {
78 Tvec dr = xyz_a - xyz[id_b];
79 Tscal rab2 = sycl::dot(dr, dr);
80 Tscal h_b = hpart[id_b];
82 if (rab2 > h_a * h_a * rker2 && rab2 > h_b * h_b * rker2) {
86 Tvec vxyz_b = vxyz[id_b];
87 const Tscal u_b = uint[id_b];
88 Tscal P_b = pressure[id_b];
89 Tscal omega_b = omega[id_b];
90 const Tscal alpha_b = alpha_AV[id_b];
91 Tscal cs_b = cs[id_b];
93 Tscal rab = sycl::sqrt(rab2);
95 Tscal rho_b = rho_h(pmass, h_b, hfactd);
96 Tvec B_b = B_on_rho[id_b] * rho_b;
98 Tscal Fab_a = Kernel::dW_3d(rab, h_a);
99 Tscal Fab_b = Kernel::dW_3d(rab, h_b);
101 Tvec v_ab = vxyz_a - vxyz_b;
105 Tscal v_ab_r_ab = sycl::dot(v_ab, r_ab_unit);
108 Tscal vsig_a = shamphys::MHD_physics<Tvec, Tscal>::vsig_MHD(
109 v_ab, r_ab_unit, cs_a, B_a, rho_a, mu_0, alpha_a, beta_AV);
110 Tscal vsig_b = shamphys::MHD_physics<Tvec, Tscal>::vsig_MHD(
111 v_ab, r_ab_unit, cs_b, B_b, rho_b, mu_0, alpha_b, beta_AV);
113 Tscal vsig_u = shamrock::sph::vsig_u(P_a, P_b, rho_a, rho_b);
118 add_to_derivs_sph_artif_visco_cond(
143 axyz[id_a] = force_pressure;
144 duint[id_a] = tmpdU_pressure;
154 auto edges = get_edges();
156 auto &part_counts_with_ghost = edges.part_counts_with_ghost.indexes;
157 auto &part_counts = edges.part_counts.indexes;
160 edges.xyz.check_sizes(part_counts_with_ghost);
161 edges.hpart.check_sizes(part_counts_with_ghost);
162 edges.vxyz.check_sizes(part_counts_with_ghost);
163 edges.uint.check_sizes(part_counts_with_ghost);
164 edges.omega.check_sizes(part_counts_with_ghost);
165 edges.pressure.check_sizes(part_counts_with_ghost);
166 edges.cs.check_sizes(part_counts_with_ghost);
167 edges.alpha_AV.check_sizes(part_counts_with_ghost);
168 edges.B_on_rho.check_sizes(part_counts_with_ghost);
171 edges.axyz.ensure_sizes(part_counts);
172 edges.duint.ensure_sizes(part_counts);
174 const Tscal pmass = edges.gpart_mass.data;
175 const Tscal alpha_u = edges.alpha_u.data;
176 const Tscal beta_AV = edges.beta_AV.data;
177 const Tscal mu_0 = edges.mu_0.data;
183 shamsys::instance::get_compute_scheduler_ptr(),
185 edges.xyz.get_spans(),
186 edges.hpart.get_spans(),
187 edges.vxyz.get_spans(),
188 edges.uint.get_spans(),
189 edges.omega.get_spans(),
190 edges.pressure.get_spans(),
191 edges.cs.get_spans(),
192 edges.alpha_AV.get_spans(),
193 edges.B_on_rho.get_spans(),
197 ComputeKernel{pmass, alpha_u, beta_AV, mu_0});