Skip to content

Conversation

ChristopherBignamini
Copy link
Contributor

No description provided.

@ChristopherBignamini
Copy link
Contributor Author

pre-commit.ci autofix

@ChristopherBignamini
Copy link
Contributor Author

pre-commit.ci autofix

Comment on lines 343 to 360
iSN0 = my_chemistry->metal_abundances + 1;
for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) {
Ct[i] = my_rates->SN0_XC[iSN0 - 1] * metal(i, j, k);
Ot[i] = my_rates->SN0_XO[iSN0 - 1] * metal(i, j, k);
Mgt[i] = my_rates->SN0_XMg[iSN0 - 1] * metal(i, j, k);
Alt[i] = my_rates->SN0_XAl[iSN0 - 1] * metal(i, j, k);
Sit[i] = my_rates->SN0_XSi[iSN0 - 1] * metal(i, j, k);
St[i] = my_rates->SN0_XS[iSN0 - 1] * metal(i, j, k);
Fet[i] = my_rates->SN0_XFe[iSN0 - 1] * metal(i, j, k);

Cg[i] = my_rates->SN0_fC[iSN0 - 1] * metal(i, j, k);
Og[i] = my_rates->SN0_fO[iSN0 - 1] * metal(i, j, k);
Mgg[i] = my_rates->SN0_fMg[iSN0 - 1] * metal(i, j, k);
Alg[i] = my_rates->SN0_fAl[iSN0 - 1] * metal(i, j, k);
Sig[i] = my_rates->SN0_fSi[iSN0 - 1] * metal(i, j, k);
Sg[i] = my_rates->SN0_fS[iSN0 - 1] * metal(i, j, k);
Feg[i] = my_rates->SN0_fFe[iSN0 - 1] * metal(i, j, k);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that this suggestion properly addresses all relevant off-by-one indexing

Suggested change
iSN0 = my_chemistry->metal_abundances + 1;
for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) {
Ct[i] = my_rates->SN0_XC[iSN0 - 1] * metal(i, j, k);
Ot[i] = my_rates->SN0_XO[iSN0 - 1] * metal(i, j, k);
Mgt[i] = my_rates->SN0_XMg[iSN0 - 1] * metal(i, j, k);
Alt[i] = my_rates->SN0_XAl[iSN0 - 1] * metal(i, j, k);
Sit[i] = my_rates->SN0_XSi[iSN0 - 1] * metal(i, j, k);
St[i] = my_rates->SN0_XS[iSN0 - 1] * metal(i, j, k);
Fet[i] = my_rates->SN0_XFe[iSN0 - 1] * metal(i, j, k);
Cg[i] = my_rates->SN0_fC[iSN0 - 1] * metal(i, j, k);
Og[i] = my_rates->SN0_fO[iSN0 - 1] * metal(i, j, k);
Mgg[i] = my_rates->SN0_fMg[iSN0 - 1] * metal(i, j, k);
Alg[i] = my_rates->SN0_fAl[iSN0 - 1] * metal(i, j, k);
Sig[i] = my_rates->SN0_fSi[iSN0 - 1] * metal(i, j, k);
Sg[i] = my_rates->SN0_fS[iSN0 - 1] * metal(i, j, k);
Feg[i] = my_rates->SN0_fFe[iSN0 - 1] * metal(i, j, k);
}
iSN0 = my_chemistry->metal_abundances;
for (i = my_fields->grid_start[0]; i <= my_fields->grid_end[0]; i++) {
Ct[i] = my_rates->SN0_XC[iSN0] * metal(i, j, k);
Ot[i] = my_rates->SN0_XO[iSN0] * metal(i, j, k);
Mgt[i] = my_rates->SN0_XMg[iSN0] * metal(i, j, k);
Alt[i] = my_rates->SN0_XAl[iSN0] * metal(i, j, k);
Sit[i] = my_rates->SN0_XSi[iSN0] * metal(i, j, k);
St[i] = my_rates->SN0_XS[iSN0] * metal(i, j, k);
Fet[i] = my_rates->SN0_XFe[iSN0] * metal(i, j, k);
Cg[i] = my_rates->SN0_fC[iSN0] * metal(i, j, k);
Og[i] = my_rates->SN0_fO[iSN0] * metal(i, j, k);
Mgg[i] = my_rates->SN0_fMg[iSN0] * metal(i, j, k);
Alg[i] = my_rates->SN0_fAl[iSN0] * metal(i, j, k);
Sig[i] = my_rates->SN0_fSi[iSN0] * metal(i, j, k);
Sg[i] = my_rates->SN0_fS[iSN0] * metal(i, j, k);
Feg[i] = my_rates->SN0_fFe[iSN0] * metal(i, j, k);
}


namespace grackle::impl {

void make_consistent(const int* imetal, const double* dom,
Copy link
Collaborator

Choose a reason for hiding this comment

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

would you mind refactoring so that imetal and dom are passed by value (and not passed by pointer)?

For reference, imetal is a regular integer and dom is a regular double

//===----------------------------------------------------------------------===//
///
/// @file
/// Declares signature of make_consistent_g
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// Declares signature of make_consistent_g
/// Implements the `make_consistent_g` function

Comment on lines 387 to 410
SN_i[1 - 1] = 1;
//_// PORT: SN_metal(:, 1) = metal_loc(:,j,k)
SN_i[2 - 1] = 2;
//_// PORT: SN_metal(:, 2) = metal_C13(:,j,k)
SN_i[3 - 1] = 3;
//_// PORT: SN_metal(:, 3) = metal_C20(:,j,k)
SN_i[4 - 1] = 4;
//_// PORT: SN_metal(:, 4) = metal_C25(:,j,k)
SN_i[5 - 1] = 5;
//_// PORT: SN_metal(:, 5) = metal_C30(:,j,k)
SN_i[6 - 1] = 6;
//_// PORT: SN_metal(:, 6) = metal_F13(:,j,k)
SN_i[7 - 1] = 7;
//_// PORT: SN_metal(:, 7) = metal_F15(:,j,k)
SN_i[8 - 1] = 8;
//_// PORT: SN_metal(:, 8) = metal_F50(:,j,k)
SN_i[9 - 1] = 9;
//_// PORT: SN_metal(:, 9) = metal_F80(:,j,k)
SN_i[10 - 1] = 10;
//_// PORT: SN_metal(:,10) = metal_P170(:,j,k)
SN_i[11 - 1] = 11;
//_// PORT: SN_metal(:,11) = metal_P200(:,j,k)
SN_i[12 - 1] = 12;
//_// PORT: SN_metal(:,12) = metal_Y19(:,j,k)
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a reminder any line that starts with "//_// PORT: " is a line that the transcription script could not transcribe. Consequently, fixing the highlighted region will probably fix the failing tests

# C++ Source (and Private Header Files)
cool_multi_time_g-cpp.C cool_multi_time_g-cpp.h
internal_types.C internal_types.hpp
make_consistent.C make_consistent.hpp
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should probably rename make_consistent.C to make_consistent.cpp. That is the new convention that we're adopting. But, I can fix that later if you prefer

@mabruzzo mabruzzo mentioned this pull request Sep 12, 2025
32 tasks
@ChristopherBignamini
Copy link
Contributor Author

pre-commit.ci autofix

@ChristopherBignamini
Copy link
Contributor Author

pre-commit.ci autofix

@mabruzzo
Copy link
Collaborator

I think the test is failing because you forgot to add make_consistent.lo to src/clib/Make.config.objects

Comment on lines +480 to +487
correctH =
(gr_float)(my_chemistry->HydrogenFractionByMass * metalfree[i] /
totalH[i]); // TODO: which one is correct?
// correctH = (gr_float)(my_chemistry->HydrogenFractionByMass*(1. -
// my_chemistry->DeuteriumToHydrogenRatio)*metalfree[i]/totalH[i]
// );
// // ! GC202005
// //- ! correctH = real(fh*metalfree(i)/totalH(i), RKIND)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's going on here? Did you manually add these comments yourself?

This logic doesn't seem to be present in the original version of the function...

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know that there were some changes to the make_consistent_g at one point. Is there a chance you transcribed an old version of the branch rather than the most recent version?

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