protected void DetermineHydraulicRadius(IHDReach hdReach, IHDHGridPoint hdhGridPoint)
        {
            _waterLevel = hdhGridPoint.WaterLevelNp1;
            var engineCrossSection = hdhGridPoint.GridPoint.EngineCrossSection;

            _hydraulicRadius = Math.Max(engineCrossSection.GetHydraulicRadius(_waterLevel), MinHydraulicRadius);
        }
        protected void DetermineHydraulicDepth(IHDReach hdReach, IHDHGridPoint hdhGridPoint)
        {
            _waterLevel = hdhGridPoint.WaterLevelNp1;
            var engineCrossSection = hdhGridPoint.GridPoint.EngineCrossSection;
            var area  = engineCrossSection.GetArea(_waterLevel);
            var width = engineCrossSection.GetStorageWidth(_waterLevel);

            _hydraulicDepth = Math.Max(area / width, MinHydraulicDepth);
        }
        protected void DetermineVelocity(IHDReach hdReach, IHDHGridPoint hdhGridPoint)
        {
            var reachIndex         = hdReach.EngineReach.ReachListIndex;
            var velocityCalculator = _velocityDataItem.ReachesData[reachIndex];

            var gridPointIndex = hdhGridPoint.GridPoint.PointIndex;

            _velocity = Math.Max(Math.Abs(velocityCalculator.GetValue(gridPointIndex)), MinVelocity);
        }
Exemple #4
0
 public void UpdatePostHDValues()
 {
     {
         double    sum       = 0;
         EngineNet engineNet = _engineNet;
         for (int i = 0; i < engineNet.Nodes.Count; i++)
         {
             //if (NodesData[i] == null) continue;
             var engineNodeSewer = engineNet.Nodes[i] as EngineNodeVolume;
             if (engineNodeSewer == null)
             {
                 continue;
             }
             IHDNode hdNode = _hdModule.GetNode(engineNodeSewer);
             if (hdNode == null)
             {
                 continue;
             }
             double volume = engineNodeSewer.GetVolume(hdNode.WaterLevelNp1);
             _volPostHd.NodesData[i].Value = volume;
             sum += volume;
         }
         for (int i = 0; i < engineNet.Reaches.Count; i++)
         {
             IEngineDataReach <double> reachData = _volPostHd.ReachesData[i];
             if (reachData == null)
             {
                 continue;
             }
             IHDReach hdReach = _hdModule.GetReach(engineNet.Reaches[i]);
             if (hdReach == null)
             {
                 continue;
             }
             for (int j = 0; j < reachData.IndexList.Length; j++)
             {
                 int           jgp = reachData.IndexList[j];
                 IHDHGridPoint hgp = hdReach.GridPoints[jgp] as IHDHGridPoint;
                 if (hgp == null)
                 {
                     reachData[j] = 0;
                 }
                 else
                 {
                     reachData[j] = hgp.WaterVolumeNp1;
                     sum         += hgp.WaterLevelNp1;
                 }
             }
         }
         // Store total
         GenericData[0] = sum;
     }
 }
 protected override void DetermineStateVariables(IHDReach hdReach, IHDHGridPoint hdhGridPoint)
 {
     DetermineVelocity(hdReach, hdhGridPoint);
 }
 protected override void DetermineStateVariables(IHDReach hdReach, IHDHGridPoint hdhGridPoint)
 {
     DetermineHydraulicDepth(hdReach, hdhGridPoint);
 }
 /// <summary>
 /// Determines the state variables needed for calculation of bed resistance.
 /// </summary>
 protected abstract void DetermineStateVariables(IHDReach hdReach, IHDHGridPoint hdhGridPoint);
Exemple #8
0
 /// <inheritdoc />
 public override void UpdateValues()
 {
     // if pull version, values are extracted when requested, and no action is required here.
     // If not pull, this needs to update the data and store it.
     {
         double    sum       = 0;
         EngineNet engineNet = _engineNet;
         for (int i = 0; i < engineNet.Nodes.Count; i++)
         {
             //if (NodesData[i] == null) continue;
             var engineNodeSewer = engineNet.Nodes[i] as EngineNodeVolume;
             if (engineNodeSewer == null)
             {
                 continue;
             }
             IHDNode hdNode = _hdModule.GetNode(engineNodeSewer);
             if (hdNode == null)
             {
                 continue;
             }
             double volumeN      = _volPostHd.NodesData[i].Value;
             double volumeNp1    = engineNodeSewer.GetVolume(hdNode.WaterLevelNp1);
             double volumechange = volumeNp1 - volumeN;
             sum         += volumechange;
             NodesData[i] = volumechange;
             _volAccumulated.NodesData[i].Value += volumechange;
         }
         for (int i = 0; i < engineNet.Reaches.Count; i++)
         {
             IEngineDataReach <double> reachDataPostHD = _volPostHd.ReachesData[i];
             IEngineDataReach <double> reachDataAcc    = _volAccumulated.ReachesData[i];
             IEngineDataReach <double> reachData       = ReachesData[i];
             if (reachData == null)
             {
                 continue;
             }
             IHDReach hdReach = _hdModule.GetReach(engineNet.Reaches[i]);
             if (hdReach == null)
             {
                 continue;
             }
             for (int j = 0; j < reachData.IndexList.Length; j++)
             {
                 int           jgp = reachData.IndexList[j];
                 IHDHGridPoint hgp = hdReach.GridPoints[jgp] as IHDHGridPoint;
                 if (hgp == null)
                 {
                     reachData[j] = 0;
                 }
                 else
                 {
                     double volumeN      = reachDataPostHD[j];
                     double volumeNp1    = hgp.WaterVolumeNp1;
                     double volumeChange = volumeNp1 - volumeN;
                     sum             += volumeChange;
                     reachData[j]     = volumeChange;
                     reachDataAcc[j] += volumeChange;
                 }
             }
         }
         // Store total
         GenericData[0] = sum;
         _volAccumulated.GenericData[0] += sum;
     }
 }