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

Inquiry on Near-Neighbor Interpolation for StructuredDataLookup #6122

Closed
lhy11009 opened this issue Nov 2, 2024 · 5 comments
Closed

Inquiry on Near-Neighbor Interpolation for StructuredDataLookup #6122

lhy11009 opened this issue Nov 2, 2024 · 5 comments

Comments

@lhy11009
Copy link
Contributor

lhy11009 commented Nov 2, 2024

I am currently working on implementing a StructuredDataLookup for determining the most abundant phase under specific (P, T) conditions. Since the most abundant phase is represented as an index (e.g., 0, 1, 2, etc.), interpolating to fractional values like 1.5 is not meaningful. Using linear interpolation could result in blending phase indices, which does not accurately represent the physical system.

Upon reviewing the source code in source/structured_data.cc, I observed that the available interpolation methods—Functions::InterpolatedUniformGridData and Functions::InterpolatedTensorProductGridData—are designed for linear or higher-order interpolation. However, for my application, a near-neighbor interpolation method would be more appropriate.

Would you be able to advise on the most suitable class or approach for implementing near-neighbor interpolation within this framework? Additionally, if existing options are not appropriate, do you suggest any modifications to achieve the desired behavior?

@lhy11009
Copy link
Contributor Author

lhy11009 commented Nov 5, 2024

Hi @gassmoeller , I hope you are doing well. I have a question regarding StructuredDataLookup. The get_interpolation_point_coordinates method is quite useful for returning coordinates, and I have implemented a near-neighbor search based on that. However, I realized that I also need to access the value of the data directly—in my case, the index of the dominant phase.

Currently, it appears that StructuredDataLookup hides the data from users and only provides a "data" object. Specifically, the data[component]->value is defined as an interpolation function for the I-th data column, rather than giving direct access to the data values.

Could you advise on how I might be able to retrieve the data directly in this case?

@gassmoeller
Copy link
Member

Could you provide more details on why you need access to the data directly and what you mean by "data"? The design of the class currently hides the data table on purpose, because it was meant to provide an interpolated approximation of that data table at arbitrary coordinates. If you query the value from the StructuredDataLookup class exactly at the pressure/temperature value that is defined in the table you should get exactly the data value that is in the table, why is that not sufficient?

@lhy11009
Copy link
Contributor Author

lhy11009 commented Nov 5, 2024 via email

@gassmoeller
Copy link
Member

I think this is currently implemented in #6131 and can be closed when that PR is merged.

@lhy11009
Copy link
Contributor Author

Agree, it's very close to be merged, let's just close it here.

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

No branches or pull requests

2 participants