-
Notifications
You must be signed in to change notification settings - Fork 24
Modular stellar-evolution framework for Star particles #1962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
markkrumholz
merged 34 commits into
development
from
chong/claude/stellar-evolution-framework
Jun 24, 2026
Merged
Changes from 24 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
d122ce9
docs: design for modular stellar-evolution framework + validation test
chongchonghe 111f503
plan
chongchonghe 45e50d9
feat(particles): add modular stellar-evolution model framework + toy …
chongchonghe 03b30a5
feat(particles): add Star particle type, layout, container, and I/O m…
chongchonghe f85f74d
feat(particles): thread dt through property updates and register Star…
chongchonghe 0417a63
feat(sim): wire Star particle container, init hook, and dt into the u…
chongchonghe 619e146
test(particles): add ParticleStarEvolution toy stellar-evolution vali…
chongchonghe 16b6732
docs: document modular stellar-evolution framework, toy model, and va…
chongchonghe bae9393
refactor(particles): use Particle_Traits for model selection, introdu…
chongchonghe fde2f7e
test(particles): harden ParticleStarEvolution with Bondi-rate assertion
chongchonghe 62c0af5
clean up
chongchonghe 56d4b3c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e20cec6
fix(particles): guard Star specialization with AMREX_SPACEDIM==3
chongchonghe 16110c8
fix: guard ToyStellarModel against NaN from negative mass; update docs
chongchonghe 7bcd3d6
fix(test): use InitFromAsciiFile for Star particle creation
chongchonghe 65fa580
fix(test): mark M0_in_Msun as AMREX_GPU_MANAGED for CUDA builds
chongchonghe 123fecf
fix: guard luminosity writes for Nout==0 and zero-fill extra groups
chongchonghe ffd8aef
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6dc0495
Merge branch 'development' into chong/claude/stellar-evolution-framework
chongchonghe b7b0261
fix: load Star particles from checkpoint instead of reinitializing
chongchonghe 4358d6a
refactor: pass particle state to stellar model evolve() for generality
chongchonghe bec12c8
refactor: pass full particle rdata array to stellar model evolve()
chongchonghe a61e1ec
fix(test): use structured binding for getParticleDataAtLevel
chongchonghe 32582b9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e000081
fix: prevent Sink+Star co-enablement and pass int data to evolve()
chongchonghe 8b7b2a9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6a6bbea
Merge branch 'development' into chong/claude/stellar-evolution-framework
chongchonghe e930c69
forceMaxlevel
chongchonghe 3896f76
fix: integer comp names, drop gpu_tables from Star path, inherit Defa…
chongchonghe c3b5ef9
style: apply pre-commit fixes
chongchonghe 0ab95fa
refactor: unify applyUpdate API, move tables to GPU-managed global
chongchonghe f04c6e4
style: apply pre-commit fixes
chongchonghe f40c38c
fix: inherit Particle_Traits<SubcycleProblem> from DefaultParticleTraits
chongchonghe 97f01c5
Merge branch 'development' into chong/claude/stellar-evolution-framework
chongchonghe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Uniform-grid Bondi accretion onto a single Star particle (toy stellar evolution validation) | ||
| # Domain sized so that r_B ~ 0.1 * dx, putting the accretion in the sub-grid Bondi regime. | ||
|
|
||
| geometry.prob_lo = [-1.2e19, -1.2e19, -1.2e19] | ||
| geometry.prob_hi = [ 1.2e19, 1.2e19, 1.2e19] | ||
| quokka.bc = ["foextrap", "foextrap", "foextrap"] | ||
|
|
||
| amr.n_cell = [64, 64, 64] | ||
| amr.max_level = 0 | ||
| amr.blocking_factor = 16 | ||
| amr.max_grid_size = 32 | ||
|
|
||
| do_reflux = 1 | ||
| do_subcycle = 0 | ||
| do_tracers = 0 | ||
|
|
||
| max_timesteps = 10 | ||
|
|
||
| particles.verbose = 1 | ||
|
|
||
| problem.M0_in_Msun = 0.1 | ||
| problem.rho0 = 1.6726e-24 # ~ m_p (n_H ~ 1) | ||
| problem.t_end_over_t_b = 300.0 | ||
|
|
||
| plotfile_interval = -1 | ||
| checkpoint_interval = -1 | ||
| tiny_profiler.enabled = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 1 | ||
| 0.0 0.0 0.0 1.988409871e+32 0.0 0.0 0.0 0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #ifndef STAR_PARTICLE_INDICES_H_ | ||
| #define STAR_PARTICLE_INDICES_H_ | ||
|
|
||
| #include "AMReX_Enum.H" | ||
|
|
||
| namespace quokka | ||
| { | ||
|
|
||
| // Star particle real-component layout. | ||
| // Every Star particle has StarParticleFixedComps fixed scalars followed by | ||
| // nGroups luminosity slots and model-defined extras (nExtraReal / nExtraInt). | ||
| AMREX_ENUM(StarParticleDataIdx, // NOLINT | ||
| mass, // Mass of the particle | ||
| vx, // Velocity x | ||
| vy, // Velocity y | ||
| vz, // Velocity z | ||
| birth_time, // Simulation time when the particle was created | ||
| mdot, // Current mass accretion rate (set by the accretion module) | ||
| radius, // Stellar radius (set by the stellar-evolution model) | ||
| lum // Base index for luminosity components (MUST be last; expands to lum_0, lum_1, ... for nGroups) | ||
| ); | ||
|
|
||
| constexpr int StarParticleMassIdx = static_cast<int>(StarParticleDataIdx::mass); | ||
| constexpr int StarParticleVxIdx = static_cast<int>(StarParticleDataIdx::vx); | ||
| constexpr int StarParticleVyIdx = static_cast<int>(StarParticleDataIdx::vy); | ||
| constexpr int StarParticleVzIdx = static_cast<int>(StarParticleDataIdx::vz); | ||
| constexpr int StarParticleBirthTimeIdx = static_cast<int>(StarParticleDataIdx::birth_time); | ||
| constexpr int StarParticleMdotIdx = static_cast<int>(StarParticleDataIdx::mdot); | ||
| constexpr int StarParticleRadiusIdx = static_cast<int>(StarParticleDataIdx::radius); | ||
| constexpr int StarParticleLumIdx = static_cast<int>(StarParticleDataIdx::lum); | ||
|
|
||
| static_assert(static_cast<int>(StarParticleDataIdx::lum) == 7); | ||
|
|
||
| // Number of fixed components before the variable-length sections (nGroups + extras). | ||
| constexpr int StarParticleFixedComps = 7; | ||
|
|
||
| } // namespace quokka | ||
|
|
||
| #endif // STAR_PARTICLE_INDICES_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #ifndef STARPARTICLE_RADIATION_HPP_ | ||
| #define STARPARTICLE_RADIATION_HPP_ | ||
|
|
||
| #include "AMReX_Extension.H" | ||
| #include "AMReX_GpuQualifiers.H" | ||
| #include "AMReX_REAL.H" | ||
|
|
||
| #include "particles/particle_radiation.hpp" // LuminosityGpuConstTables | ||
| #include "particles/particle_types.hpp" // StarParticle*Idx, ParticleType, Particle_Traits | ||
|
|
||
| #if AMREX_SPACEDIM == 3 | ||
|
|
||
| namespace quokka | ||
| { | ||
|
|
||
| // Framework dispatcher for per-particle stellar-evolution updates. | ||
| // Passes the full particle real-data array to the model so it can read and | ||
| // modify any component (mass, radius, luminosity groups, etc.). | ||
| class StellarUpdate | ||
| { | ||
| public: | ||
| template <typename problem_t, typename ParticleType, int Nout> | ||
| AMREX_GPU_DEVICE AMREX_FORCE_INLINE static void updateStellarProperties(ParticleType &p, amrex::Real /*current_time*/, amrex::Real dt, | ||
| LuminosityGpuConstTables<Nout> const & /*gpu_tables*/) noexcept | ||
| { | ||
| using Model = typename Particle_Traits<problem_t>::stellar_model; | ||
| Model::evolve(&p.rdata(0), Nout, dt); | ||
|
chongchonghe marked this conversation as resolved.
Outdated
|
||
| } | ||
| }; | ||
|
|
||
| } // namespace quokka | ||
|
|
||
| #endif // AMREX_SPACEDIM == 3 | ||
|
|
||
| #endif // STARPARTICLE_RADIATION_HPP_ | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.