Skip to content
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

Store species mass fractions as doubles internally instead of floats #19860

Open
JustinPrivitera opened this issue Sep 27, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@JustinPrivitera
Copy link
Member

In my work on Blueprint Species Set Support (#19859), I came across a longstanding bug with species selection.

for (int j = 0 ; j < n_cell_vars ; j++)
{
vtkDataArray *arr = inCD->GetArray(j);
if (arr->GetDataType() != VTK_FLOAT ||
arr->GetNumberOfComponents() != 1)
{
continue;
}

If the input data is not represented as a float, nothing is done. This manifested itself as me turning off species and watching as my mesh variables stayed the same. After speaking to @cyrush, we agreed that we can relax this restriction to allow all kinds of data to be affected by species selection. The next thing we discussed is what to do about the output dataset.

Material interface reconstruction species selection sets the output variable as floats:

vtkFloatArray *var = vtkFloatArray::New();

This is the calculation that determines the result:

var->SetValue(i, specmf * var_in->GetTuple1(i));

specmf is declared as a float:

var->SetValue(i, specmf * var_in->GetTuple1(i));

All of the requisite information here is stored as floats. @cyrush and I discussed changing everything with species to be doubles. That would mean changing how the mass fractions are represented in the species objects, adjusting all calculations here in the MIR species selection, and changing the resulting variable to use doubles instead.

@JustinPrivitera JustinPrivitera added the enhancement New feature or request label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant