Skip to content

Container for multicomponent salt#5157

Open
svenn-t wants to merge 1 commit into
OPM:masterfrom
svenn-t:saltarray
Open

Container for multicomponent salt#5157
svenn-t wants to merge 1 commit into
OPM:masterfrom
svenn-t:saltarray

Conversation

@svenn-t
Copy link
Copy Markdown
Contributor

@svenn-t svenn-t commented May 19, 2026

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.

@svenn-t svenn-t added the manual:new-feature This is a new feature and should be described in the manual label May 19, 2026
@svenn-t
Copy link
Copy Markdown
Contributor Author

svenn-t commented May 19, 2026

jenkins build this please

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 SaltArray with 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 catagory to category in the return description.
 * @return Cation or anion catagory

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread opm/material/components/SO4Ion.hpp Outdated
Comment thread opm/material/components/ClIon.hpp Outdated
Comment thread opm/common/utility/SaltArray.hpp Outdated
Comment on lines +219 to +226
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;
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment on lines +221 to +225
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;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:new-feature This is a new feature and should be described in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants