Skip to content

[newchem-cpp] Adding dust model with related parameters#511

Open
aqua-hl wants to merge 31 commits intograckle-project:newchem-cppfrom
aqua-hl:harrison-dust-model-new
Open

[newchem-cpp] Adding dust model with related parameters#511
aqua-hl wants to merge 31 commits intograckle-project:newchem-cppfrom
aqua-hl:harrison-dust-model-new

Conversation

@aqua-hl
Copy link
Copy Markdown

@aqua-hl aqua-hl commented Mar 3, 2026

Summary

  • Adds a new dust_model parameter to chemistry_data (default: 0) to select between dust models
    • dust_model = 0: default behavior (runs calc_grain_size_increment_1d as usual)
    • dust_model = 1: Harrison dust model — skips calc_grain_size_increment_1d and uses custom dust growth/destruction routines
  • Implements dust growth (accretion) and dust destruction (SNe shocks + thermal sputtering) in dust_growth_and_destruction.hpp and dust_growth_and_destruction.cpp
  • Adds associated parameters: dust_destruction_eff, sne_coeff, sne_shockspeed, dust_grainsize, dust_growth_densref, dust_growth_tauref, use_sne_field

Key changes

  • src/include/grackle_chemistry_data.h / grackle_chemistry_data_fields.def: new dust_model parameter and dust physics parameters
  • src/clib/dust_growth_and_destruction.cpp/.hpp: dust growth and destruction implementation
  • src/clib/calc_tdust_3d.cpp, cool1d_multi_g.cpp, dust/lookup_dust_rates1d.hpp: guard calc_grain_size_increment_1d calls with dust_model == 0

@aqua-hl aqua-hl changed the title Adding dust model with related parameters [newchem-cpp] Adding dust model with related parameters Mar 3, 2026
@aqua-hl
Copy link
Copy Markdown
Author

aqua-hl commented Mar 5, 2026

Note on solver_method default: The golden standard test answers were generated with solver_method=1, so changing the default causes shape and value mismatches in CI (e.g., freefall-primordial_rate_variants-1-0 produced 5725 vs 5739 timesteps).

Comment on lines +10 to +18
const double k_boltz = 1.3806504e-16;
const double m_proton = 1.67262171e-24;
const double pi_val = 3.141592653589793;
const double sec_per_year = 3.155e7;

const double tiny_value = 1.0e-20;
const double huge_value = 1.0e+20;

const double t_ref = 20;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we redefine constants?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason is that I forgot to remove them. But for sec_per_year, tiny_value, huge_value I don't think they are defined as global variable? And for t_ref, it is a local variable.

Comment thread src/clib/dust/dust_growth_and_destruction.hpp
Comment thread src/clib/solve_rate_cool.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants