Container for multicomponent salt#5157
Conversation
|
jenkins build this please |
There was a problem hiding this comment.
Pull request overview
This PR adds a SaltArray container and ion component definitions to support multicomponent salt handling and unit conversion for future CO2STORE functionality.
Changes:
- Adds ion component headers for Na, K, Ca, Mg, Cl, and SO4.
- Introduces
SaltArraywith indexing, conversion between molality/mass fraction/mole fraction, deck assignment, and cation/anion helpers. - Adds unit tests and registers the new headers/test file in CMake.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
opm/common/utility/SaltArray.hpp |
Defines salt indices, helpers, container behavior, and unit conversions. |
opm/material/components/CaIon.hpp |
Adds calcium ion component properties. |
opm/material/components/ClIon.hpp |
Adds chloride ion component properties. |
opm/material/components/KIon.hpp |
Adds potassium ion component properties. |
opm/material/components/MgIon.hpp |
Adds magnesium ion component properties. |
opm/material/components/NaIon.hpp |
Adds sodium ion component properties. |
opm/material/components/SO4Ion.hpp |
Adds sulfate ion component properties. |
tests/test_SaltArray.cpp |
Adds tests for construction, assignment, conversion, and ion categorization. |
CMakeLists_files.cmake |
Registers the new public headers and test source. |
Comments suppressed due to low confidence (1)
opm/common/utility/SaltArray.hpp:104
- Correct the spelling of
catagorytocategoryin the return description.
* @return Cation or anion catagory
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| void assignFromDeckRecord(const DeckRecord& record) | ||
| { | ||
| assert(record.size() == saltData_.size()); | ||
| for (const auto& item : record) { | ||
| auto recItem = static_cast<T>(item.get<double>(0)); | ||
| auto index = saltIndexFromString(item.name()); | ||
| (*this)[index] = recItem; | ||
| } |
There was a problem hiding this comment.
Test for this function will be done in upcoming PR where the actual keyword is implemented. Alternatively I can remove this function in this PR and add it back when the keyword is actually implemented.
| assert(record.size() == saltData_.size()); | ||
| for (const auto& item : record) { | ||
| auto recItem = static_cast<T>(item.get<double>(0)); | ||
| auto index = saltIndexFromString(item.name()); | ||
| (*this)[index] = recItem; |
There was a problem hiding this comment.
Don't know if I entirely understand this comment. The intention was at least to give error if someone implement a keyword with different size. The saltIndexFromString function will throw if item name is not recognized, as well.
This PR implements a container for storing multicomponent salt (ions) in a specific unit. The implementation includes some convenience functions for useful calculations, especially conversion between different units.
This container will be used to implement multicomponent salts in CO2STORE, which will come in other PRs.