[newchem-cpp] transcribe calc_grain_size_increment_species_1d#507
Conversation
…ion interface/name
…transcribe_calc_grain_size_increment_species_1d
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
…s_1d' of https://github.com/ChristopherBignamini/grackle into newchem-cpp_transcribe_calc_grain_size_increment_species_1d
…transcribe_calc_grain_size_increment_species_1d
…transcribe_calc_grain_size_increment_species_1d
…transcribe_calc_grain_size_increment_species_1d
|
@ChristopherBignamini, I'm not able to push to your branch to update this PR. Can you merge in the latest changes to |
…transcribe_calc_grain_size_increment_species_1d
|
@brittonsmith sure, done! The failure with Pygrackle test suite is due to the missing gold-standard-nccv8 tag |
Oops, thought I pushed that. I've done it now and restarted the tests. |
|
@ChristopherBignamini, @mabruzzo I've take a closer look at the failed tests and the differences are significant for most of the ionic and molecular species, but even the dust temperature is different from the first iteration. I think we'll need a closer look here. |
|
@brittonsmith @mabruzzo it could be my fault, there is a TODO in calc_grain_size_increment_species_1d concerning a manual assignment of the first element of drsp for a specific entry of input the indexes: I added that assignment when I was comparing the numerical values of the various steps with the Fortran version and I found a discrepancy due to that first element, most likely because of the different handling of NaN between C++ and Fortran. By manually setting to zero that element in both the C++ and Fortran versions of the subroutine the numerical results were identical. I tried now to remove that assignment and re-run the pygrackle suite: it still fails but I'm not sure the errors are now acceptable. My apologies. |
|
@ChristopherBignamini, ok the agreement is much better now, on the level of what I see for PRs #519 and #520. I think this would be acceptable for merging. |
mabruzzo
left a comment
There was a problem hiding this comment.
I started to look this over. I hope to circle back and finish up later today, but I wanted to post what I had so far.
I feel pretty strongly that we should rename alsp_data to kappa_data. You can totally feel free to punt on renaming all of the other variables (maybe open an issue to record some of those renaming ideas?)
|
somehow, the comments that apply here, were made on PR #519 |
…transcribe_calc_grain_size_increment_species_1d
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
…transcribe_calc_grain_size_increment_species_1d
…s_1d' of https://github.com/ChristopherBignamini/grackle into newchem-cpp_transcribe_calc_grain_size_increment_species_1d
|
|
||
| namespace grackle::impl { |
There was a problem hiding this comment.
| namespace grackle::impl { | |
| #include "support/config.hpp" | |
| namespace GRIMPL_NAMESPACE_DECL { |
I'm porting over this suggestion from #519 (I fixed the error in the suggestion)
| double* SN_r0sp_data, double bulk_density, double* sigma_per_gas_mass, | ||
| double* kappa_data, int* gr_N, const double* opac_coef_table_data); | ||
|
|
||
| } // namespace grackle::impl |
There was a problem hiding this comment.
| } // namespace grackle::impl | |
| } // namespace GRIMPL_NAMESPACE_DECL |
There was a problem hiding this comment.
I think we need to remove this subroutine now that it has been transcribed
|
|
||
| #include "calc_grain_size_increment_species_1d.hpp" | ||
|
|
||
| void grackle::impl::calc_grain_size_increment_species_1d( |
There was a problem hiding this comment.
| void grackle::impl::calc_grain_size_increment_species_1d( | |
| namespace GRIMPL_NAMESPACE_DECL { | |
| void calc_grain_size_increment_species_1d( |
| } | ||
|
|
||
| return; | ||
| } |
There was a problem hiding this comment.
| } | |
| } | |
| } // namespace GRIMPL_NAMESPACE_DECL |
| /// | ||
| /// @par History | ||
| /// modified: February, 2026 by Christopher Bignamini & Matthew Abruzzo; port to | ||
| /// C++ |
There was a problem hiding this comment.
| /// C++ | |
| /// C++ | |
| /// |
| gr_float* selected_inj_path_metal_densities, const double* SN_fsp, | ||
| double* SN_r0sp_data, double bulk_density, double* sigma_per_gas_mass, |
There was a problem hiding this comment.
can you make double* SN_r0sp_data into const double* SN_r0sp_data?
It might also be nice to rename SN_fsp to initial_species_yield and SN_r0sp_data to initial_size_distribution_moments. But, maybe just making a todo note is adequate? Longer term, I want us to just be able to directly pass in the entire struct of size moment data rather than needing to repack it.
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
255eec6
into
grackle-project:newchem-cpp
Update gold standard for PR #507.
This PR requires some additional work to fix a numerical issue which occurs in a call with j=k=0 and first iteration of i-loop (j=k=1 in Fortran), when coef3 is equal to zero. I temporarily added a line to skip the cubic equation solution in this case and we need to find a final fix.