예제 #1
0
        public void DeepCloneTest()
        {
            WaterPacket actual = (WaterPacket)WWC.DeepClone();

            Assert.AreEqual(WWC.GetConcentration(Na), actual.GetConcentration(Na));
            Assert.AreEqual(WWC.GetConcentration(Cl), actual.GetConcentration(Cl));

            actual = (WaterPacket)WWC.DeepClone(250);
            Assert.AreEqual(WWC.GetConcentration(Na), actual.GetConcentration(Na), 0.00001);
            Assert.AreEqual(2.5 * 3, actual.Chemicals[Na], 0.00001);
        }
예제 #2
0
        public void RoutingOfRecievedWaterTest()
        {
            Lake S = new Lake("L", 100);

            DateTime Start = new DateTime(2000, 1, 1);

            S.SetState("Initial", Start, new WaterPacket(100));
            Lake storage = new Lake("storage", 10000);

            S.AddDownStreamWaterBody(storage);

            TimeSpan ts = new TimeSpan(1, 0, 0);

            WaterPacket WaterProvider = new WaterPacket(2, 200);

            IWaterPacket actual;

            S.AddWaterPacket(DateTime.Now, DateTime.Now, WaterProvider.DeepClone(200));

            S.Update(S.CurrentTime.Add(ts));

            actual = S.CurrentStoredWater;
            Assert.AreEqual(100, actual.Volume);

            Assert.AreEqual(200, storage.CurrentStoredWater.Volume);
            Assert.AreEqual(200.0 / 300.0, storage.CurrentStoredWater.Composition[2], 0.000001);

            //In the next timestep there will be no water to route
            S.Update(S.CurrentTime.Add(ts));
            Assert.AreEqual(200, storage.CurrentStoredWater.Volume);
            Assert.AreEqual(200.0 / 300.0, storage.CurrentStoredWater.Composition[2], 0.000001);

            Assert.AreEqual(1, S.Output.GetStorageTime(Start, Start.AddHours(2)).TotalHours, 0.001);
        }
예제 #3
0
        public void RoutingOfInflow2()
        {
            Stream S = new Stream("S", 25, 1, 1);

            DateTime Start = DateTime.Now;

            S.SetState("Initial", Start, new WaterPacket(1, 25));

            Stream s2 = new Stream("s2", 50, 1, 1);

            s2.SetState("Initial", Start, new WaterPacket(50));

            Stream s3 = new Stream("s3", 300, 1, 1);

            s3.SetState("Initial", Start, new WaterPacket(300));

            S.AddDownStreamWaterBody(s2);
            s2.AddDownStreamWaterBody(s3);

            SinkSourceBoundary FB = new SinkSourceBoundary(0.0005);

            FB.WaterSample = new WaterPacket(5, 5);

            S.Sources.Add(FB);

            TimeSpan ts = new TimeSpan(1, 0, 0);

            WaterPacket WaterProvider = new WaterPacket(2, 200);

            S.AddWaterPacket(DateTime.Now, DateTime.Now, WaterProvider.DeepClone(200));
            S.Update(S.CurrentTime.Add(ts));
        }
예제 #4
0
        public void RoutingOfInflow()
        {
            Stream   S     = new Stream("S", 10, 1, 1);
            DateTime Start = DateTime.Now;

            S.SetState("Initial", Start, new WaterPacket(1, 10));

            Stream s2 = new Stream("s2", 10, 1, 1);


            Lake Storage = new Lake("storage", 100000);

            S.AddDownStreamWaterBody(s2);
            s2.AddDownStreamWaterBody(Storage);

            SinkSourceBoundary FB = new SinkSourceBoundary(5.0 / 60);

            FB.WaterSample = new WaterPacket(5, 5);

            S.Sources.Add(FB);

            TimeSpan ts = new TimeSpan(0, 1, 0);

            WaterPacket WaterProvider = new WaterPacket(2, 5);

            S.AddWaterPacket(Start, Start.AddDays(1), WaterProvider.DeepClone(15));
            S.Update(S.CurrentTime.Add(ts));
            s2.Update(S.CurrentTime.Add(ts));

            Assert.AreEqual(10, S.CurrentStoredWater.Volume, 0.00001);
            Assert.AreEqual(0.137, S.CurrentStoredWater.Composition[5], 0.001);
            Assert.AreEqual(0.863, S.CurrentStoredWater.Composition[2], 0.001);
            Assert.AreEqual(0.1309, s2.CurrentStoredWater.Composition[1], 0.001);
        }
예제 #5
0
        public void RoutingOfChemical()
        {
            Stream_Accessor s = new Stream_Accessor("s", 100, 1, 1);

            s.SetState("Initial", DateTime.Now, new WaterPacket(100));

            SinkSourceBoundary fb = new SinkSourceBoundary(50);

            s.Sources.Add(fb);
            WaterPacket Wcc = new WaterPacket(50);
            Chemical    c   = ChemicalFactory.Instance.GetChemical(ChemicalNames.Cl);

            Wcc.AddChemical(c, 1);

            fb.WaterSample = Wcc.DeepClone();

            double conc = Wcc.GetConcentration(c);

            Assert.AreEqual(1.0 / 50.0, conc, 0.000001);

            TimeSpan ts = new TimeSpan(0, 0, 1);

            s.Output.LogChemicalConcentration(c);

            s.AddWaterPacket(DateTime.Now, DateTime.Now.AddDays(1), Wcc.DeepClone());
            s.Update(s.CurrentTime.Add(ts));

            WaterPacket WccNew = (WaterPacket)s._waterInStream.Last();

            Assert.AreEqual(64.8721, WccNew.Volume, 0.0001);
            Assert.AreEqual(TimeSpan.FromSeconds(0.5), WccNew.WaterAge);
            Assert.AreEqual(conc, WccNew.GetConcentration(c));

            s.AddWaterPacket(DateTime.Now, DateTime.Now.AddDays(1), Wcc);
            s.Update(s.CurrentTime.Add(TimeSpan.FromDays(1)));

            Assert.AreEqual(0.0042, s.Output.ChemicalsToLog[c].Items[0].Value, 1e-4);
            Assert.AreEqual(0.0078, s.Output.ChemicalsToLog[c].Items[1].Value, 1e-4);
            Assert.AreEqual(conc, s.Output.ChemicalsToLog[c].Items[2].Value);
        }
예제 #6
0
        public void RoutingOfRecievedWaterTest()
        {
            Stream_Accessor S = new Stream_Accessor("S", 25, 1, 1);

            DateTime Start = DateTime.Now;

            S.SetState("Initial", Start, new WaterPacket(1, 25));

            Stream s2 = new Stream("s2", 50, 1, 1);

            s2.SetState("Initial", Start, new WaterPacket(50));

            Stream s3 = new Stream("s3", 300, 1, 1);

            s3.SetState("Initial", Start, new WaterPacket(300));

            S.AddDownStreamWaterBody(s2);
            s2.AddDownStreamWaterBody(s3);

            TimeSpan ts = new TimeSpan(1, 0, 0);

            WaterPacket WaterProvider = new WaterPacket(2, 200);

            S.AddWaterPacket(Start, Start.AddDays(1), WaterProvider.DeepClone(200));



            S.Update(S.CurrentTime.Add(ts));

            Assert.AreEqual(0, S._incomingWater.Count);
            Assert.AreEqual(1, S.CurrentStoredWater.Composition[2]);

            s2.Update(S.CurrentTime.Add(ts));
            s3.Update(S.CurrentTime.Add(ts));

            Assert.AreEqual(1, s2.CurrentStoredWater.Composition[2]);

            //In the next timestep there will be no water to route
            S.Update(S.CurrentTime.Add(ts));
        }
예제 #7
0
    public void TracerTest()
    {
      int count = 3;
      double length = 10870;
      DateTime Start= new DateTime(2000,1,1);

      List<Lake> lakes = NetworkBuilder.CreateConnectedLakes(count);
      
      foreach (Lake L in lakes)
      {
        L.SurfaceArea = XYPolygon.GetSquare(length / count);
        L.Depth = 1;
        L.SetState("Initial",Start, new WaterPacket(L.Volume));
      }
      Chemical c = ChemicalFactory.Instance.GetChemical(ChemicalNames.Cl);

      SinkSourceBoundary fb = new SinkSourceBoundary(10870.0 / (8.49 * 3600));
      fb.WaterSample = new WaterPacket(1);
      lakes.First().Sources.Add(fb);

      WaterPacket plug = new WaterPacket(1);
      plug.AddChemical(c, 10000);
      lakes.First().AddWaterPacket(Start, Start.AddHours(1), plug.DeepClone());

      lakes.First().Output.LogChemicalConcentration(c);

      lakes.Last().Output.LogChemicalConcentration(c);


      Stream us = new Stream("us",1, 1, 1);
      us.Sources.Add(fb);
      Stream s = new Stream("s",1000, 1, 1);

      Lake L2 = new Lake("L2",870);

      Stream s1 = new Stream("s1", 9000, 1, 1);

      s.AddWaterPacket(Start, Start.AddSeconds(1), plug.DeepClone());
      s1.Output.LogChemicalConcentration(c);

      us.AddDownStreamWaterBody(s);
      s.AddDownStreamWaterBody(L2);
      L2.AddDownStreamWaterBody(s1);


      Model m = new Model();
      m._waterBodies.AddRange(lakes.Cast<IWaterBody>());

      m._waterBodies.Add((IWaterBody)us);
      m._waterBodies.Add((IWaterBody)s);
      m._waterBodies.Add((IWaterBody)L2);
      m._waterBodies.Add((IWaterBody)s1);

      m.SetState("Initial", Start, new WaterPacket(1));



      m.MoveInTime(Start.AddHours(15), TimeSpan.FromMinutes(1));

      lakes.Last().Output.Save(@"C:\temp\LastLake.xts");
      s1.Output.Save(@"C:\temp\Stream.xts");


      int n = 15;
      List<IWaterBody> wbs = NetworkBuilder.CreateCombo(n, 10870 / n/2.0);
      foreach (IWaterBody wb in wbs)
      {
        wb.SetState("Initial", Start, new WaterPacket(wb.Volume));
      }

      wbs.First().AddWaterPacket(Start, Start.AddHours(1), plug.DeepClone());
      us.AddDownStreamWaterBody(wbs.First());
      us.RestoreState("Initial");

      m._waterBodies.Clear();
      m._waterBodies.Add(us);
      m._waterBodies.AddRange(wbs);

      m.SetState("Initial", Start, new WaterPacket(1));

      ((Stream)wbs.Last()).Output.LogChemicalConcentration(c);

      m.MoveInTime(Start.AddHours(15), TimeSpan.FromMinutes(1));

      ((Stream)wbs.Last()).Output.Save(@"C:\temp\Stream.xts");
    }
예제 #8
0
    public void TestMethod1()
    {
      Model M = new Model();
      M.Name = "Cook";

      WaterPacket HyporhericWater = new WaterPacket(1);
      HyporhericWater.AddChemical(ChemicalFactory.Instance.GetChemical(ChemicalNames.Radon), 0.6 / HyporhericWater.Volume);

      for (int i = 0; i < 10; i++)
      {
        Lake s1 = new Lake("s" + i, XYPolygon.GetSquare(50 * 2));
        s1.Depth = 0.3;
        StagnantExchangeBoundary seb = new StagnantExchangeBoundary(s1.Volume / 20000);
        seb.WaterSample = HyporhericWater.DeepClone(s1.Area * 0.2 * 0.4);
        seb.Output.LogAllChemicals = true;
        s1.Output.LogAllChemicals = true;
        s1.Sinks.Add(seb);
        s1.Sources.Add(seb);
        if (i > 0)
          M._waterBodies[i - 1].AddDownStreamWaterBody(s1);

        M._waterBodies.Add(s1);
      }

      //Bromide injection
      TimespanSeries ts = new TimespanSeries();
      ts.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 18, 12, 0, 0), 0);
      ts.AddSiValue(new DateTime(2005, 10, 18, 12, 0, 0), new DateTime(2005, 10, 18, 12, 40, 0), 0.001 * 60);
      ts.AddSiValue(new DateTime(2005, 10, 18, 12, 40, 0), DateTime.MaxValue, 0);
      SinkSourceBoundary Bromide = new SinkSourceBoundary(ts);
      WaterPacket P = new WaterPacket(1);
      P.AddChemical(new Chemical("Bromide", 1), 1.13);
      Bromide.WaterSample = P;

      //SF6 injection
      TimespanSeries ts2 = new TimespanSeries();
      ts2.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 15, 12, 0, 0), 0);
      ts2.AddSiValue(new DateTime(2005, 10, 15, 12, 0, 0), new DateTime(2005, 10, 19, 12, 0, 0), 1e-6);
      ts2.AddSiValue(new DateTime(2005, 10, 19, 12, 0, 0), DateTime.MaxValue, 0);
      SinkSourceBoundary SF6 = new SinkSourceBoundary(ts2);
      WaterPacket SF6w = new WaterPacket(1);
      SF6w.AddChemical(new Chemical("SF6", 1), 1.13);
      SF6.WaterSample = SF6w;

      M._waterBodies.First().Sources.Add(Bromide);
      M._waterBodies.First().Sources.Add(SF6);
      M._waterBodies.First().Sources.Add(new SinkSourceBoundary(0.2));

      DateTime Start = new DateTime(2005, 10, 13);
      DateTime End = new DateTime(2005, 10, 19);

      M.SetState("Initial", Start, new WaterPacket(1));

      M.MoveInTime(new DateTime(2005, 10, 18, 12, 0, 0), TimeSpan.FromHours(2));
      M.MoveInTime(new DateTime(2005, 10, 18, 13, 0, 0), TimeSpan.FromHours(0.02));
      M.MoveInTime(End, TimeSpan.FromHours(2));
      M.Save(@"..\..\..\TestData\CookEtAl.xml");

      M.RestoreState("Initial");
      TimespanSeries ts3 = new TimespanSeries();
      ts3.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 16, 12, 0, 0), 0);
      ts3.AddSiValue(new DateTime(2005, 10, 16, 12, 0, 0), new DateTime(2005, 10, 17, 0, 0, 0), 0.4);
      ts3.AddSiValue(new DateTime(2005, 10, 17, 0, 0, 0), DateTime.MaxValue, 0);
      M._waterBodies.First().Sources.Add(new SinkSourceBoundary(ts3));
      M.MoveInTime(new DateTime(2005, 10, 18, 12, 0, 0), TimeSpan.FromHours(2));
      M.MoveInTime(new DateTime(2005, 10, 18, 13, 0, 0), TimeSpan.FromHours(0.02));
      M.MoveInTime(End, TimeSpan.FromHours(2));
      M.Save(@"..\..\..\TestData\CookEtAl2.xml");
    }
예제 #9
0
        public void TestMethod1()
        {
            Lake Gjeller = LakeFactory.GetLake("Gjeller Sø");

            Gjeller.Depth      = 1.2;
            Gjeller.WaterLevel = 0.4;

            WaterPacket GjellerWater = new WaterPacket(1, 1);

            GjellerWater.AddChemical(ChemicalFactory.Instance.GetChemical(ChemicalNames.Cl), 1);

            TimeSeriesGroup climate = TimeSeriesGroupFactory.Create("climate.xts");

            foreach (var I in climate.Items)
            {
                I.ExtrapolationMethod = ExtrapolationMethods.RecycleYear;
                I.AllowExtrapolation  = true;
            }

            EvaporationRateBoundary evap = new EvaporationRateBoundary((TimespanSeries)climate.Items[1]);

            evap.ContactGeometry = Gjeller.Geometry;
            Gjeller.EvaporationBoundaries.Add(evap);

            SinkSourceBoundary precip = new SinkSourceBoundary(climate.Items[0]);

            precip.ContactGeometry = Gjeller.Geometry;
            Gjeller.Precipitation.Add(precip);
            precip.ID          = 2;
            precip.WaterSample = GjellerWater.DeepClone();
            precip.WaterSample.IDForComposition = precip.ID;;

            GroundWaterBoundary GWIN = new GroundWaterBoundary(Gjeller, 1e-5, 2, 0.45, XYPolygon.GetSquare(Gjeller.Area / 2));

            GWIN.WaterSample = GjellerWater.DeepClone();
            GWIN.ID          = 3;
            GWIN.WaterSample.IDForComposition = GWIN.ID;
            GWIN.Name = "Inflow";
            Gjeller.GroundwaterBoundaries.Add(GWIN);

            GroundWaterBoundary GWout = new GroundWaterBoundary(Gjeller, 1e-5, 2, 0.35, XYPolygon.GetSquare(Gjeller.Area / 2));

            GWout.Name = "Outflow";
            Gjeller.GroundwaterBoundaries.Add(GWout);


            TimespanSeries pumping = new TimespanSeries();

            pumping.AddSiValue(new DateTime(1990, 01, 01), new DateTime(2010, 01, 01), 0);
            pumping.AddSiValue(new DateTime(2010, 01, 01), new DateTime(2010, 05, 01), 0.05);
            pumping.AddSiValue(new DateTime(2010, 05, 01), DateTime.Now, 0);


            SinkSourceBoundary DrainageWater = new SinkSourceBoundary(pumping);

            DrainageWater.ID          = 4;
            DrainageWater.WaterSample = GjellerWater.DeepClone();
            DrainageWater.WaterSample.IDForComposition = DrainageWater.ID;
            DrainageWater.Name = "Indpumpet Drænvand";
            Gjeller.Sources.Add(DrainageWater);


            var tsg = TimeSeriesGroupFactory.Create(@"..\..\..\TestData\GjellerObservations.xts");

            foreach (var ts in tsg.Items)
            {
                Chemical c = new Chemical(ts.Name, 1);
                Gjeller.RealData.AddChemicalTimeSeries(c);
                Gjeller.RealData.ChemicalConcentrations[c] = (TimestampSeries)ts;
            }

            Model M = new Model();

            M._waterBodies.Add(Gjeller);
            Gjeller.Output.LogAllChemicals = true;
            Gjeller.Output.LogComposition  = true;

            M.SetState("Initial", new DateTime(1995, 1, 1), GjellerWater);


            M.MoveInTime(DateTime.Now, TimeSpan.FromDays(10));
            M.Save(@"..\..\..\TestData\Gjeller.xml");
        }
예제 #10
0
        public void TracerTest()
        {
            int      count  = 3;
            double   length = 10870;
            DateTime Start  = new DateTime(2000, 1, 1);

            List <Lake> lakes = NetworkBuilder.CreateConnectedLakes(count);

            foreach (Lake L in lakes)
            {
                L.SurfaceArea = XYPolygon.GetSquare(length / count);
                L.Depth       = 1;
                L.SetState("Initial", Start, new WaterPacket(L.Volume));
            }
            Chemical c = ChemicalFactory.Instance.GetChemical(ChemicalNames.Cl);

            SinkSourceBoundary fb = new SinkSourceBoundary(10870.0 / (8.49 * 3600));

            fb.WaterSample = new WaterPacket(1);
            lakes.First().Sources.Add(fb);

            WaterPacket plug = new WaterPacket(1);

            plug.AddChemical(c, 10000);
            lakes.First().AddWaterPacket(Start, Start.AddHours(1), plug.DeepClone());

            lakes.First().Output.LogChemicalConcentration(c);

            lakes.Last().Output.LogChemicalConcentration(c);


            Stream us = new Stream("us", 1, 1, 1);

            us.Sources.Add(fb);
            Stream s = new Stream("s", 1000, 1, 1);

            Lake L2 = new Lake("L2", 870);

            Stream s1 = new Stream("s1", 9000, 1, 1);

            s.AddWaterPacket(Start, Start.AddSeconds(1), plug.DeepClone());
            s1.Output.LogChemicalConcentration(c);

            us.AddDownStreamWaterBody(s);
            s.AddDownStreamWaterBody(L2);
            L2.AddDownStreamWaterBody(s1);


            Model m = new Model();

            m._waterBodies.AddRange(lakes.Cast <IWaterBody>());

            m._waterBodies.Add((IWaterBody)us);
            m._waterBodies.Add((IWaterBody)s);
            m._waterBodies.Add((IWaterBody)L2);
            m._waterBodies.Add((IWaterBody)s1);

            m.SetState("Initial", Start, new WaterPacket(1));



            m.MoveInTime(Start.AddHours(15), TimeSpan.FromMinutes(1));

            lakes.Last().Output.Save(@"C:\temp\LastLake.xts");
            s1.Output.Save(@"C:\temp\Stream.xts");


            int n = 15;
            List <IWaterBody> wbs = NetworkBuilder.CreateCombo(n, 10870 / n / 2.0);

            foreach (IWaterBody wb in wbs)
            {
                wb.SetState("Initial", Start, new WaterPacket(wb.Volume));
            }

            wbs.First().AddWaterPacket(Start, Start.AddHours(1), plug.DeepClone());
            us.AddDownStreamWaterBody(wbs.First());
            us.RestoreState("Initial");

            m._waterBodies.Clear();
            m._waterBodies.Add(us);
            m._waterBodies.AddRange(wbs);

            m.SetState("Initial", Start, new WaterPacket(1));

            ((Stream)wbs.Last()).Output.LogChemicalConcentration(c);

            m.MoveInTime(Start.AddHours(15), TimeSpan.FromMinutes(1));

            ((Stream)wbs.Last()).Output.Save(@"C:\temp\Stream.xts");
        }
예제 #11
0
        public void TestMethod1()
        {
            Lake Hampen = LakeFactory.GetLake("Hampen Sø");

            Hampen.Depth = 3.2e6 / 760000 / 1000;

            DateTime start = new DateTime(2008, 1, 1);
            DateTime end   = new DateTime(2008, 12, 31);

            Assert.AreEqual(Hampen.Area, 722200, 1);

            EvaporationRateBoundary er = new EvaporationRateBoundary(407.0 / 1000 / 365 / 86400);

            er.ContactGeometry = Hampen.Geometry;
            er.Name            = "Fordampning";
            Hampen.EvaporationBoundaries.Add(er);

            SourceBoundary pr = new SourceBoundary(901.0 / 1000 / 365 / 86400);

            pr.ContactGeometry = Hampen.Geometry;
            pr.Name            = "Nedbør";
            Hampen.Precipitation.Add(pr);

            SinkSourceBoundary outlet = new SinkSourceBoundary(-200.0 / 1000 / 365 / 86400);

            outlet.ContactGeometry = Hampen.Geometry;
            outlet.Name            = "Udløb";
            Hampen.Sinks.Add(outlet);

            GroundWaterBoundary gwb = new GroundWaterBoundary();

            gwb.FlowType  = GWType.Flow;
            gwb.Name      = "Ud";
            gwb.WaterFlow = new HydroNumerics.Time.Core.TimespanSeries("inflow", new DateTime(2008, 1, 1), 2, 1, HydroNumerics.Time.Core.TimestepUnit.Years, -294.0 / 1000 / 365 / 86400 * Hampen.Area);
            Hampen.GroundwaterBoundaries.Add(gwb);


            Model m = new Model();

            m._waterBodies.Add(Hampen);

            m.SetState("start", start, new WaterPacket(1));
            m.SimulationStartTime = start;
            m.SimulationEndTime   = end;
            m.MoveInTime(end, TimeSpan.FromDays(30));
            m.Save(@"..\..\..\TestData\Hampen1.xml");

            WaterPacket ChlorideWater = new WaterPacket(1);

            ChlorideWater.SetConcentration(ChemicalNames.Cl, 20);
            ChlorideWater.SetConcentration(ChemicalNames.IsotopeFraction, 4);
            ChlorideWater.SetConcentration(ChemicalNames.Nitrate, 0.2);
            ChlorideWater.SetConcentration(ChemicalNames.Phosphate, 0.02);

            m.SetState("start", start, ChlorideWater);
            Hampen.Output.LogAllChemicals = true;

            double gwinflow = 1000.0;


            gwb.WaterFlow = new HydroNumerics.Time.Core.TimespanSeries("inflow", new DateTime(2008, 1, 1), 2, 1, HydroNumerics.Time.Core.TimestepUnit.Years, -(294.0 + gwinflow) / 1000 / 365 / 86400 * Hampen.Area);

            GroundWaterBoundary gwbin = new GroundWaterBoundary();

            gwbin.FlowType  = GWType.Flow;
            gwbin.WaterFlow = new HydroNumerics.Time.Core.TimespanSeries("inflow", new DateTime(2008, 1, 1), 2, 1, HydroNumerics.Time.Core.TimestepUnit.Years, 0.955 * gwinflow / 1000 / 365 / 86400 * Hampen.Area);
            ChlorideWater.SetConcentration(ChemicalNames.Cl, 30);
            ChlorideWater.SetConcentration(ChemicalNames.IsotopeFraction, 8);
            ChlorideWater.SetConcentration(ChemicalNames.Nitrate, 1.6);
            ChlorideWater.SetConcentration(ChemicalNames.Phosphate, 0.017);
            gwbin.Name        = "Ind Skov";
            gwbin.WaterSample = ChlorideWater.DeepClone();
            Hampen.GroundwaterBoundaries.Add(gwbin);

            GroundWaterBoundary gwbin2 = new GroundWaterBoundary();

            gwbin2.FlowType  = GWType.Flow;
            gwbin2.WaterFlow = new HydroNumerics.Time.Core.TimespanSeries("inflow", new DateTime(2008, 1, 1), 2, 1, HydroNumerics.Time.Core.TimestepUnit.Years, 0.045 * gwinflow / 1000 / 365 / 86400 * Hampen.Area);
            ChlorideWater.SetConcentration(ChemicalNames.Nitrate, 65.3);
            gwbin2.Name        = "Ind Landbrug";
            gwbin2.WaterSample = ChlorideWater.DeepClone();

            Hampen.GroundwaterBoundaries.Add(gwbin2);
            ChlorideWater.SetConcentration(ChemicalNames.Cl, 10);
            ChlorideWater.SetConcentration(ChemicalNames.Phosphate, 0);
            ChlorideWater.SetConcentration(ChemicalNames.Nitrate, 1.7);
            pr.WaterSample = ChlorideWater.DeepClone();

            m.MoveInTime(end, TimeSpan.FromDays(30));
            m.Save(@"..\..\..\TestData\Hampen2.xml");
        }
예제 #12
0
        public void TestMethod1()
        {
            Model M = new Model();

            M.Name = "Cook";

            WaterPacket HyporhericWater = new WaterPacket(1);

            HyporhericWater.AddChemical(ChemicalFactory.Instance.GetChemical(ChemicalNames.Radon), 0.6 / HyporhericWater.Volume);

            for (int i = 0; i < 10; i++)
            {
                Lake s1 = new Lake("s" + i, XYPolygon.GetSquare(50 * 2));
                s1.Depth = 0.3;
                StagnantExchangeBoundary seb = new StagnantExchangeBoundary(s1.Volume / 20000);
                seb.WaterSample            = HyporhericWater.DeepClone(s1.Area * 0.2 * 0.4);
                seb.Output.LogAllChemicals = true;
                s1.Output.LogAllChemicals  = true;
                s1.Sinks.Add(seb);
                s1.Sources.Add(seb);
                if (i > 0)
                {
                    M._waterBodies[i - 1].AddDownStreamWaterBody(s1);
                }

                M._waterBodies.Add(s1);
            }

            //Bromide injection
            TimespanSeries ts = new TimespanSeries();

            ts.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 18, 12, 0, 0), 0);
            ts.AddSiValue(new DateTime(2005, 10, 18, 12, 0, 0), new DateTime(2005, 10, 18, 12, 40, 0), 0.001 * 60);
            ts.AddSiValue(new DateTime(2005, 10, 18, 12, 40, 0), DateTime.MaxValue, 0);
            SinkSourceBoundary Bromide = new SinkSourceBoundary(ts);
            WaterPacket        P       = new WaterPacket(1);

            P.AddChemical(new Chemical("Bromide", 1), 1.13);
            Bromide.WaterSample = P;

            //SF6 injection
            TimespanSeries ts2 = new TimespanSeries();

            ts2.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 15, 12, 0, 0), 0);
            ts2.AddSiValue(new DateTime(2005, 10, 15, 12, 0, 0), new DateTime(2005, 10, 19, 12, 0, 0), 1e-6);
            ts2.AddSiValue(new DateTime(2005, 10, 19, 12, 0, 0), DateTime.MaxValue, 0);
            SinkSourceBoundary SF6  = new SinkSourceBoundary(ts2);
            WaterPacket        SF6w = new WaterPacket(1);

            SF6w.AddChemical(new Chemical("SF6", 1), 1.13);
            SF6.WaterSample = SF6w;

            M._waterBodies.First().Sources.Add(Bromide);
            M._waterBodies.First().Sources.Add(SF6);
            M._waterBodies.First().Sources.Add(new SinkSourceBoundary(0.2));

            DateTime Start = new DateTime(2005, 10, 13);
            DateTime End   = new DateTime(2005, 10, 19);

            M.SetState("Initial", Start, new WaterPacket(1));

            M.MoveInTime(new DateTime(2005, 10, 18, 12, 0, 0), TimeSpan.FromHours(2));
            M.MoveInTime(new DateTime(2005, 10, 18, 13, 0, 0), TimeSpan.FromHours(0.02));
            M.MoveInTime(End, TimeSpan.FromHours(2));
            M.Save(@"..\..\..\TestData\CookEtAl.xml");

            M.RestoreState("Initial");
            TimespanSeries ts3 = new TimespanSeries();

            ts3.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 16, 12, 0, 0), 0);
            ts3.AddSiValue(new DateTime(2005, 10, 16, 12, 0, 0), new DateTime(2005, 10, 17, 0, 0, 0), 0.4);
            ts3.AddSiValue(new DateTime(2005, 10, 17, 0, 0, 0), DateTime.MaxValue, 0);
            M._waterBodies.First().Sources.Add(new SinkSourceBoundary(ts3));
            M.MoveInTime(new DateTime(2005, 10, 18, 12, 0, 0), TimeSpan.FromHours(2));
            M.MoveInTime(new DateTime(2005, 10, 18, 13, 0, 0), TimeSpan.FromHours(0.02));
            M.MoveInTime(End, TimeSpan.FromHours(2));
            M.Save(@"..\..\..\TestData\CookEtAl2.xml");
        }