@@ -1185,7 +1185,11 @@ namespace {
11851185 std::vector<float > y_coord_{};
11861186 std::vector<float > pressure_{};
11871187 std::vector<float > strength_{};
1188+
11881189 std::vector<float > icd_setting_{};
1190+ std::vector<float > icd_length_{};
1191+ std::vector<float > icd_max_flow_rate_{};
1192+ std::vector<float > icd_flow_scaling_{};
11891193
11901194 void defineBranches (const ::Opm::WellSegments& segments);
11911195
@@ -1237,7 +1241,11 @@ namespace {
12371241 this ->y_coord_ .reserve (nseg);
12381242 this ->pressure_ .reserve (nseg);
12391243 this ->strength_ .reserve (nseg);
1244+
12401245 this ->icd_setting_ .reserve (nseg);
1246+ this ->icd_length_ .reserve (nseg);
1247+ this ->icd_max_flow_rate_ .reserve (nseg);
1248+ this ->icd_flow_scaling_ .reserve (nseg);
12411249 }
12421250
12431251 void SegmentRecord::write (::Opm::EclIO::OutputStream::RFT & rftFile) const
@@ -1269,9 +1277,14 @@ namespace {
12691277
12701278 rftFile.write (" SEGSSTR" , this ->strength_ );
12711279 rftFile.write (" SEGSFOPN" , this ->icd_setting_ );
1280+
12721281 rftFile.write (" SEGBRNO" , this ->branch_id_ );
12731282 rftFile.write (" SEGNXT" , this ->neighbour_id_ );
12741283
1284+ rftFile.write (" SEGLEN" , this ->icd_length_ );
1285+ rftFile.write (" SEGQICD" , this ->icd_max_flow_rate_ );
1286+ rftFile.write (" SEGFSCAL" , this ->icd_flow_scaling_ );
1287+
12751288 rftFile.write (" BRNST" , this ->branch_start_segment_ );
12761289 rftFile.write (" BRNEN" , this ->branch_end_segment_ );
12771290 }
@@ -1422,27 +1435,76 @@ namespace {
14221435 this ->viscosity_ .addSegment (usys, segSol);
14231436 }
14241437
1438+ float icdMaxAbsRate (const ::Opm::SICD & sicd, const ::Opm::UnitSystem& usys)
1439+ {
1440+ return static_cast <float >
1441+ (usys.from_si (::Opm::UnitSystem::measure::geometric_volume_rate,
1442+ sicd.maxAbsoluteRate ().value_or (0.0 )));
1443+ }
1444+
1445+ float icdScalingFactor (const ::Opm::SICD & sicd, const ::Opm::UnitSystem& usys)
1446+ {
1447+ // The scalingFactor's output value depends on the scaling
1448+ // method (item 11 of WSEGAICD/WSEGSICD). If either
1449+ //
1450+ // 1. Item 11 is 1, or
1451+ // 2. Item 11 is negative and the scalingFactor is negative
1452+ //
1453+ // then the scalingFactor is a length and needs unit conversion.
1454+ // Otherwise the scalingFactor is a dimensionless relative measure
1455+ // and does not need unit conversion.
1456+ const auto convertScalingFactor =
1457+ (sicd.methodFlowScaling () == 1 ) ||
1458+ ((sicd.methodFlowScaling () < 0 ) && (sicd.length () < 0.0 ));
1459+
1460+ const auto fscal = convertScalingFactor
1461+ ? usys.from_si (::Opm::UnitSystem::measure::length, sicd.scalingFactor ())
1462+ : sicd.scalingFactor ();
1463+
1464+ return static_cast <float >(fscal);
1465+ }
1466+
14251467 void SegmentRecord::recordAutoICDTypeProperties (const ::Opm::UnitSystem& usys,
14261468 const ::Opm::Segment& segment)
14271469 {
1470+ const auto & aicd = segment.autoICD ();
1471+
14281472 this ->strength_ .push_back (usys.from_si (::Opm::UnitSystem::measure::aicd_strength,
1429- segment. autoICD () .strength ()));
1473+ aicd .strength ()));
14301474 this ->icd_setting_ .push_back (1 .0f );
1475+
1476+ this ->icd_length_ .push_back (usys.from_si (::Opm::UnitSystem::measure::length,
1477+ aicd.length ()));
1478+
1479+ this ->icd_max_flow_rate_ .push_back (icdMaxAbsRate (aicd, usys));
1480+ this ->icd_flow_scaling_ .push_back (icdScalingFactor (aicd, usys));
14311481 }
14321482
14331483 void SegmentRecord::recordRegularTypeProperties ([[maybe_unused]] const ::Opm::UnitSystem& usys,
14341484 [[maybe_unused]] const ::Opm::Segment& segment)
14351485 {
14361486 this ->strength_ .push_back (0 .0f );
14371487 this ->icd_setting_ .push_back (1 .0f );
1488+
1489+ this ->icd_length_ .push_back (0 .0f );
1490+ this ->icd_max_flow_rate_ .push_back (0 .0f );
1491+ this ->icd_flow_scaling_ .push_back (0 .0f );
14381492 }
14391493
14401494 void SegmentRecord::recordSpiralICDTypeProperties (const ::Opm::UnitSystem& usys,
14411495 const ::Opm::Segment& segment)
14421496 {
1497+ const auto & sicd = segment.spiralICD ();
1498+
14431499 this ->strength_ .push_back (usys.from_si (::Opm::UnitSystem::measure::icd_strength,
1444- segment. spiralICD () .strength ()));
1500+ sicd .strength ()));
14451501 this ->icd_setting_ .push_back (1 .0f );
1502+
1503+ this ->icd_length_ .push_back (usys.from_si (::Opm::UnitSystem::measure::length,
1504+ sicd.length ()));
1505+
1506+ this ->icd_max_flow_rate_ .push_back (icdMaxAbsRate (sicd, usys));
1507+ this ->icd_flow_scaling_ .push_back (icdScalingFactor (sicd, usys));
14461508 }
14471509
14481510 double valveMaximumCrossSectionalArea (const ::Opm::Segment& segment)
@@ -1485,6 +1547,10 @@ namespace {
14851547 {
14861548 this ->strength_ .push_back (0 .0f );
14871549 this ->icd_setting_ .push_back (valveICDSetting (segment));
1550+
1551+ this ->icd_length_ .push_back (0 .0f );
1552+ this ->icd_max_flow_rate_ .push_back (0 .0f );
1553+ this ->icd_flow_scaling_ .push_back (0 .0f );
14881554 }
14891555
14901556 // =======================================================================
0 commit comments