Skip to content
Merged
Changes from all commits
Commits
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
12 changes: 10 additions & 2 deletions opm/material/fluidsystems/GenericOilGasWaterFluidSystem.hpp
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we at least keep the current assignment if Scalar is double? For instance, something along the lines of

if constexpr (std::is_same_v<Scalar, double>) {
    this->interaction_coefficients_ = ...;
}
else {
    const auto& bic = ...;
    this->interaction_coefficients_.assign(bic.begin(), bic.end());
}

with std::is_same_v<> from the <type_traits> header.

Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
#include <opm/material/fluidsystems/PTFlashParameterCache.hpp> // TODO: this is something else need to check
#include <opm/material/viscositymodels/LBC.hpp>

#include <algorithm>
#include <cassert>
#include <cstddef>
#include <string>
#include <string_view>
#include <type_traits>

#include <fmt/format.h>

Expand Down Expand Up @@ -156,8 +158,14 @@ namespace Opm {
FluidSystem::addComponent(CompParm{names[c], molar_weight[c], critic_temp[c], critic_pressure[c],
critic_volume[c] * 1.e3, acentric_factor[c]});
}
FluidSystem::printComponentParams();
interaction_coefficients_ = comp_config.binaryInteractionCoefficient(0);

const auto& bic = comp_config.binaryInteractionCoefficient(0);
if constexpr (std::is_same_v<Scalar, double>) {
interaction_coefficients_ = bic;
} else {
interaction_coefficients_.resize(bic.size());
std::ranges::copy(bic, interaction_coefficients_.begin());
}

// Init. water pvt from deck
waterPvt_->initFromState(eclState, schedule);
Expand Down