Skip to content

Commit

Permalink
AQ_Sim_2D.cs: Avoid potential issue with negative model-linked water-…
Browse files Browse the repository at this point in the history
…flow values

TVolume.cs Bullet-proof Manning's Volume Calculation
Update of splash form to provide more information and link to help file
Users Manual update to add more info about model linkage and improve formatting
  • Loading branch information
jsclough committed Apr 9, 2024
1 parent d514cce commit 5d168c3
Show file tree
Hide file tree
Showing 19 changed files with 574 additions and 254 deletions.
10 changes: 6 additions & 4 deletions Data.Simulate.AQUATOX/AQ_Sim_2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,8 @@ public void VolFlowFromHAWQS(TVolume TVol, Dictionary<DateTime, HAWQSRCHRow> Thi

foreach (KeyValuePair<DateTime, HAWQSRCHRow> pair in ThisSeg)
{
DischargLoad.list.Add(pair.Key, pair.Value.vals[0] * 86400); //flow from RCH_Daily file -- converted from cms to m3/d
double disch = (pair.Value.vals[0] * 86400 > 0) ? pair.Value.vals[0] * 86400 : 0 ;
DischargLoad.list.Add(pair.Key, disch); //flow from RCH_Daily file -- converted from cms to m3/d
}

TVol.LoadNotes1 = "Flows from HAWQS converted to m3/day";
Expand Down Expand Up @@ -870,7 +871,7 @@ public void VolFlowFromHAWQS(TVolume TVol, Dictionary<DateTime, HAWQSRCHRow> Thi
double COMID_IC = (InitFlow <= 0) ? 0 : ThisSeg[FirstDay].vals[col_OUT] / InitFlow * 0.0115740; // (kg/d) / (m3/s) * (mg/kg * d/s * m3/L)
if (isSED) COMID_IC *= 1000; // sed is in units of tons
if (isCHLA) COMID_IC = COMID_IC * PPhyto.PAlgalRec.Plant_to_Chla.Val / 1.90;
// mg/L OM = mg/L chl-a C to chl-a g OM / g OC
// mg/L OM = mg/L chl-a C to chl-a g OM / g OC

if (SegIndex == 1) TSV.InitialCond = COMID_IC;
else TSV.InitialCond = (COMID_IC + TSV.InitialCond * (SegIndex - 1)) / SegIndex; //Average initial condition for all COMIDs within the WBCOMID
Expand Down Expand Up @@ -1520,7 +1521,7 @@ public string Pass_Data(AQTSim Sim, int SrcID, int ninputs, bool passMass, ref S
{
totOutVol = totOutVol + Convert.ToDouble(its.Data.Values.ElementAt(i)[0]) * 86400; //fixme potential issue if master setup time-step changes or simulation time-period is increased since NWM data gathering
// m3/d m3/d m3/s s/d
frac_this_segment = OutVol / totOutVol;
frac_this_segment = totOutVol > 0 ? OutVol / totOutVol : 1;
}

double InVol = flowLoad.ReturnLoad(AR.dates[i]); // inflow volume to current segment, If velocity is not used, must be estimated as current seg. outflow
Expand All @@ -1543,7 +1544,8 @@ public string Pass_Data(AQTSim Sim, int SrcID, int ninputs, bool passMass, ref S
double otherSegFlows = previous_flows.Values[i]; //sum of other-segment flows into this segment in this time step
double thisSegFlows = OutVol * frac_this_segment; //flows into this segment from passage segment this time step
double totFlows = otherSegFlows + thisSegFlows; //total flows into this segment this time step
newlist.Add(AR.dates[i], (TSV.LoadsRec.Loadings.list.Values[i] * otherSegFlows + AR.concs[iTSV][i] * thisSegFlows) / totFlows); //weighted-averaging second or third inputs by volume of water.
double weightavg = totFlows > 0 ? (TSV.LoadsRec.Loadings.list.Values[i] * otherSegFlows + AR.concs[iTSV][i] * thisSegFlows) / totFlows : 0;
newlist.Add(AR.dates[i], weightavg); //weighted-averaging second or third inputs by volume of water.
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions Data.Simulate.AQUATOX/TVolume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public double Manning_Volume()
// AVERAGE FLOW DISCHARGE
Q = Discharg / 86400.0;
// m3/s // m3/d // s/d

if (Q < 0) Q = 0; //bullet proof 4/4/2024

Width = Location.Locale.SurfArea.Val / (Location.Locale.SiteLength.Val * 1000.0);
// m // sq.m // km // m/km
Y = Math.Pow((Q * Location.ManningCoeff()) / (Math.Sqrt(Location.Locale.Channel_Slope.Val) * Width), 0.6);
Expand Down
727 changes: 507 additions & 220 deletions GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN.htm

Large diffs are not rendered by default.

Binary file modified GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN_files/image002.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN_files/image006.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN_files/image007.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN_files/image008.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN_files/image009.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN_files/image010.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN_files/image011.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GUI/GUI.AQUATOX/Docs/AQUATOX.NET_1.0_UMAN_files/image012.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions GUI/GUI.AQUATOX/MultiSegForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2914,13 +2914,14 @@ void AddHAWQSRchData(long longKey, DateTime dateTimeKey, HAWQSRCHRow data) //ad
else //multi-segment HAWQS Read
{
Dictionary<string, string> WB_JSONs = new Dictionary<string, string>();
if (AQT2D.SN.waterbodies != null) //if there is a NWM lake or reservoir, read volumes and flows from NWM, overland and inflow nutrients will come from HAWQS
if ((AQT2D.SN.waterbodies != null) && //if there is a NWM lake or reservoir, read volumes and flows from NWM, overland and inflow nutrients will come from HAWQS
(AQT2D.SN.waterbodies.wb_table.Length>1))
{
TSafeAddToProcessLog("INPUT: Reading Lake-Reservoir Volumes and flows from NWM");

await Task.Run(() =>
{
for (int i = 1; i < AQT2D.SN.waterbodies.wb_table.Length; i++)
for (int i = 1; i < AQT2D.SN.waterbodies.wb_table.Length; i++) //index 0 is the header
{
string WBString = AQT2D.SN.waterbodies.wb_table[i][0];
string WBJSON = Read_WB_Water_Flows(WBString, true, msj); //daily volumes and flows from NWM
Expand Down
69 changes: 48 additions & 21 deletions GUI/GUI.AQUATOX/Splash.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions GUI/GUI.AQUATOX/Splash.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
using AQUATOX.AQSim_2D;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static AQUATOX.AQSim_2D.AQSim_2D;

Expand Down Expand Up @@ -106,5 +100,11 @@ private void Splash_Shown(object sender, EventArgs e)
Directory.SetCurrentDirectory(exeDirectory);
AQTMainForm.defaultBrowser = Properties.Settings.Default.BrowserExe;
}

private void Help_Button_Click(object sender, EventArgs e)
{
string target = "splash";
AQTMainForm.OpenUrl(target);
}
}
}
2 changes: 1 addition & 1 deletion Web.Services/Web.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<DockerTargetOS>Linux</DockerTargetOS>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down

0 comments on commit 5d168c3

Please sign in to comment.