@@ -419,57 +419,41 @@ void shammodels::sph::modules::ComputeEos<Tvec, SPHKernel>::compute_eos_internal
419419 u32 total_elements
420420 = shambase::get_check_ref (storage.part_counts_with_ghost ).indexes .get (id);
421421
422- // UnitSystem<Tscal> unit1{
423- // si->template get<mega, units::years>(),
424- // si->template get<units::astronomical_unit>(),
425- // si->template get<units::kilogramm>() * sol_mass,
426- // };
427- // m_e = c = 1
428422 using namespace shamunits ;
429423 auto unit_sys = *solver_config.unit_sys ;
430- UnitSystem<Tscal> si{};
431- Constants<Tscal> ctes_si{si};
432- Tscal second = si.template get <units::second>(); // une seconde en secondes..
433- UnitSystem<Tscal> unit2{
434- si.template get <units::second>() / 1e-3 ,
435- si.template get <units::metre>() * (ctes_si.c () * second / 1e-3 ),
436- si.template get <units::kilogramm>() * (ctes_si.electron_mass ()),
437- };
438- Tscal mass
439- = unit_sys.template to <units::kilogramm>() * unit2.template get <units::kilogramm>();
440- Tscal length
441- = unit_sys.template to <units::metre>() * unit2.template get <units::metre>();
442- Tscal time
443- = unit_sys.template to <units::second>() * unit2.template get <units::second>();
444-
445- Tscal betaunit = mass / length / (time * time); // pressure
424+
425+ Tscal mass = unit_sys.template to <units::kilogramm>(); // system mass unit in SI
426+ Tscal length = unit_sys.template to <units::metre>(); // in SI
427+ Tscal time = unit_sys.template to <units::second>(); // in SI
428+
429+ Tscal pressure_unit = mass / length / (time * time);
446430 Tscal density_unit = mass / (length * length * length);
447- Tscal alphabetaunit = sycl::sqrt (betaunit / sycl::rootn (density_unit, 3 ));
431+ Tscal velocity_unit = length / time;
432+
433+ // shamlog_debug_ln("CONSTANTS ??", mass, length, time);
434+ // shamlog_debug_ln("RATIOS ??", pressure_unit, density_unit, velocity_unit);
448435
449- Constants<Tscal> ctes{unit2};
450- const Tscal m_e = ctes.electron_mass ();
451- const Tscal m_p = ctes.proton_mass ();
452- const Tscal h = ctes.h ();
453- const Tscal c = ctes.c ();
454- shamlog_debug_ln (" CONSTANTS ??" , " unit2:" , " m_e" , m_e, " m_p" , m_p, " h" , h, " c" , c);
455- shamlog_debug_ln (" RATIOS ??" , betaunit, alphabetaunit);
436+ // static constexpr Tscal pi = shamunits::pi<Tscal>;
437+ // constexpr Tscal coeff_tpf = 2.04399770085e7; // = h / (mp^(1/3) m_e c) SI
438+ // const Tscal alpha = sycl::rootn(3 / (8 * pi), 3) * coeff_tpf;
439+ // constexpr Tscal coeff_p = 5.73180502079e-9; // = m_e^4c^5/h^3 SI
440+ // constexpr Tscal beta = coeff_p * pi / 3;
441+ // shamlog_debug_ln("COEFFS ??", alpha, beta);
456442
457443 sham::kernel_call (
458444 q,
459445 sham::MultiRef{rho_getter},
460446 sham::MultiRef{buf_P, buf_cs},
461447 total_elements,
462- [mu_e = eos_config->mu_e , unit2, betaunit, alphabetaunit ](
448+ [mu_e = eos_config->mu_e , density_unit, pressure_unit, velocity_unit ](
463449 u32 i, auto rho, Tscal *__restrict P, Tscal *__restrict cs) {
464450 UnitSystem<Tscal> si{};
465451
466452 using namespace shamrock ::sph;
467453 Tscal rho_a = rho (i);
468- auto const res = EOS::pressure_and_soundspeed (mu_e, rho_a, unit2);
469- P[i] = res.pressure / betaunit;
470- cs[i] = res.soundspeed / alphabetaunit;
471- // coeff_p and coeff_fp are in SI and have respectively
472- // density**{-1/3} and pressure dimensions
454+ auto const res = EOS::pressure_and_soundspeed (mu_e, rho_a * density_unit);
455+ P[i] = res.pressure / pressure_unit;
456+ cs[i] = res.soundspeed / velocity_unit;
473457 });
474458 });
475459
0 commit comments