Skip to content

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

Open
aqua-hl wants to merge 77 commits into
grackle-project:newchem-cppfrom
aqua-hl:harrison-dust-model-new
Open

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

Conversation

@aqua-hl

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

Copy link
Copy Markdown

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

aqua-hl commented Mar 5, 2026

Copy link
Copy Markdown
Author

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
aqua-hl added 28 commits May 1, 2026 03:46
metal_density now represents total gas-phase metals, with C/O as
subsets (mirroring the dust_density/dust_density_carbon/oxygen pattern).
Drops the add-C/O-into-metal arithmetic throughout cool/temp paths.

Also moves dust_growth_and_destruction.{cpp,hpp} into src/clib/dust/
and removes the dead Fortran source.
Old dust model v1 is superseded; adopt the track branch tree wholesale.
Add missing dust/metal species fields and dust model parameters.
Resolved conflicts: CMakeLists (keep dust sources + api/units.cpp),
cool1d_multi_g/cool_multi_time/calc_temp1d_cloudy (take upstream's
temperature refactor), convenience.py (keep dust species seeding +
upstream helpers). Updated dust header include for moved index_helper.
Adopt the track branch tree wholesale (old dust model v1 superseded).
The source moved to dust/; the duplicate top-level entry broke the
classic make build in CI.
@aqua-hl

aqua-hl commented Jun 12, 2026

Copy link
Copy Markdown
Author

pre-commit.ci autofix

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