Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b445db2
Add a CPRW pressure stage to the system solver
hnil Aug 4, 2026
4b5bd0e
Add cell-average well weights and regularise the coarse well diagonal
hnil Aug 4, 2026
e71c16a
Default the CPRW pressure stage to the standard solver's weighting
hnil Aug 4, 2026
04ee763
Share one implementation for the pressure-stage transfers
hnil Aug 4, 2026
9e66699
Sum the coarse well column over all of a well's blocks
hnil Aug 4, 2026
add7a88
Make cellavg the classic per-well weighting, add cellblockavg
hnil Aug 4, 2026
d57761e
Optionally give pressure-controlled wells a trivial coarse equation
hnil Aug 4, 2026
6cf3c31
Add the classic coarse diagonal convention for multisegment wells
hnil Aug 4, 2026
3e8ac72
Dump the fine system on the system-solver path too
hnil Aug 4, 2026
ace1031
Default the CPRW pressure stage to the classic well transfer
hnil Aug 4, 2026
a61a260
Add composable sweep steps for the system preconditioner
hnil Aug 6, 2026
35b9e00
TwoLevelMethodCpr: only resize the work vectors when the type allows it
hnil Aug 6, 2026
c2a5899
Add the general system preconditioner, a two-level method on the system
hnil Aug 6, 2026
daba299
Add --linear-solver=general_system_cpr and general_system_cprw
hnil Aug 6, 2026
e767cf3
Assert the general preconditioner reproduces the fixed one
hnil Aug 6, 2026
3acf44f
Skip the residual updates a sweep never reads again
hnil Aug 6, 2026
22bd29a
Make the response to a changed well structure configurable
hnil Aug 6, 2026
81d3072
PropertyTree: read and write arrays of sub trees
hnil Aug 6, 2026
8786364
Give general_system_cpr a JSON layout shaped like cpr's
hnil Aug 6, 2026
84c601b
Address review: match the shipped well_transfer default in both paths
hnil Aug 11, 2026
8fb69d8
Keep ISTLSolver untouched, and let the coarse-matrix dump fire
hnil Aug 11, 2026
ef7584a
Say that the coarse dump is JSON-only, on purpose
hnil Aug 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ list (APPEND TEST_SOURCE_FILES
tests/test_tpsa_localresidual.cpp
tests/test_tpsa_primaryvariables.cpp
tests/test_vfpproperties.cpp
tests/test_GeneralSystemPreconditioner.cpp
tests/test_SystemCprwPressureStage.cpp
tests/test_WellMatrixMerger.cpp
tests/test_WaterSatfuncConsistencyChecks.cpp
tests/test_wellmodel.cpp
Expand Down Expand Up @@ -691,6 +693,10 @@ list (APPEND TEST_DATA_FILES
tests/options_system_cpr_missing_smoother.json
tests/options_system_cpr_missing_well.json
tests/options_system_cpr_res_precond_not_cpr.json
tests/options_system_cprw_approx_wells.json
tests/options_system_cprw_approx_wells_bad_outer.json
tests/options_system_cprw_complete.json
tests/options_system_cprw_missing_coarsesolver.json
tests/GCONSUMP.DATA
tests/GCONSUMP_COMPLEX.DATA
tests/GROUP_HIGHER_CONSTRAINTS.DATA
Expand Down Expand Up @@ -1123,6 +1129,11 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/linalg/ISTLSolverRuntimeOptionProxy.hpp
opm/simulators/linalg/Preconditioner2InverseOperator.hpp
opm/simulators/linalg/system/MultiComm.hpp
opm/simulators/linalg/system/SystemCprwPressureStage.hpp
opm/simulators/linalg/system/GeneralSystemPreconditioner.hpp
opm/simulators/linalg/system/SystemPreconditionerParts.hpp
opm/simulators/linalg/system/SystemPressureBhpTransferPolicy.hpp
opm/simulators/linalg/system/SystemPreconditionerParts.hpp
opm/simulators/linalg/system/SystemPreconditioner.hpp
opm/simulators/linalg/system/SystemPreconditionerFactory.hpp
opm/simulators/linalg/system/SystemTypes.hpp
Expand Down
2 changes: 2 additions & 0 deletions opm/simulators/linalg/FlowLinearSolverParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ void FlowLinearSolverParameters::registerParameters()
("Scale linear system according to equation scale and primary variable types");
Parameters::Register<Parameters::LinearSolver>
("Configuration of solver. Valid options are: cprw (default), system_cpr (CPU-only), "
"system_cprw (CPU-only, system_cpr with the wells in the pressure stage), "
"general_system_cpr / general_system_cprw (the same composed from named parts), "
"ilu0, dilu, cpr (an alias for cprw), cpr_quasiimpes, "
"cpr_trueimpes, cpr_trueimpesanalytic, amg or hybrid (experimental). "
"Alternatively, you can request a configuration to be read from a "
Expand Down
6 changes: 4 additions & 2 deletions opm/simulators/linalg/ISTLSolverRuntimeOptionProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ class ISTLSolverRuntimeOptionProxy : public AbstractISTLSolver<GetPropType<TypeT
void createSolver(const Simulator& simulator, Args&&... args)
{
auto linSolverConf = Parameters::Get<Parameters::LinearSolver>();
bool useSystemCpr = (linSolverConf == "system_cpr");
bool useSystemCpr = (linSolverConf == "system_cpr") || (linSolverConf == "system_cprw")
|| (linSolverConf == "general_system_cpr") || (linSolverConf == "general_system_cprw");
if (!useSystemCpr && linSolverConf.size() > 5
&& linSolverConf.ends_with(".json")
&& std::filesystem::exists(linSolverConf)) {
try {
PropertyTree prm(linSolverConf);
useSystemCpr = (prm.get<std::string>("preconditioner.type", "") == "system_cpr");
const auto type = prm.get<std::string>("preconditioner.type", "");
useSystemCpr = (type == "system_cpr") || (type == "general_system_cpr");
} catch (...) {}
}
if (useSystemCpr) {
Expand Down
30 changes: 30 additions & 0 deletions opm/simulators/linalg/PropertyTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,36 @@ std::vector<std::string> PropertyTree::get_child_keys() const
return keys;
}

void PropertyTree::put_child_list(const std::string& key,
const std::vector<PropertyTree>& items)
{
// An array is a node whose children all have an empty key.
boost::property_tree::ptree array;
for (const auto& item : items) {
array.push_back(std::make_pair(std::string{}, *item.tree_));
}
tree_->put_child(key, array);
}

std::optional<std::vector<PropertyTree>>
PropertyTree::get_child_list(const std::string& child) const
{
auto subTree = this->tree_->get_child_optional(child);
if (! subTree) {
return std::nullopt;
}

// A JSON array parses to a node whose children all have an empty key, so
// they cannot be reached by name; walk them in order instead.
std::vector<PropertyTree> items;
items.reserve(subTree->size());
for (const auto& item : *subTree) {
items.emplace_back(PropertyTree(item.second));
}

return items;
}

template <typename T>
std::optional<std::vector<T>>
PropertyTree::get_child_items_as_vector(const std::string& child) const
Expand Down
25 changes: 25 additions & 0 deletions opm/simulators/linalg/PropertyTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,31 @@ class PropertyTree
/// \return Vector of strings containing the names of all immediate children
std::vector<std::string> get_child_keys() const;

/// Retrieve a node's children as sub trees, in order.
///
/// For a JSON array of objects. Such an array parses to a node whose
/// children all have an empty key, so they cannot be reached by name and
/// get_child_items_as_vector() cannot read them either -- that one reads
/// scalars.
///
/// \param[in] child Property key. Expected to be in hierarchical
/// notation for subtrees--i.e., using periods ('.') to separate
/// hierarchy levels.
///
/// \return The child sub trees in the order they appear. Nullopt if no
/// node named by \p child exists.
std::optional<std::vector<PropertyTree>>
get_child_list(const std::string& child) const;

/// Store a sequence of sub trees as a JSON array.
///
/// \param[in] key Property key. Expected to be in hierarchical
/// notation for subtrees--i.e., using periods ('.') to separate
/// hierarchy levels.
///
/// \param[in] items Sub trees, stored in the order given.
void put_child_list(const std::string& key, const std::vector<PropertyTree>& items);

/// Retrieve node items as linearised vector.
///
/// Assumes that the node's child is an array type of homongeneous
Expand Down
Loading