public void TestEvaporation() { MockSoil soil = new MockSoil(); APSIM.Shared.Soils.Soil soilProperties = Setup(); APSIMReadySoil.Create(soilProperties); MockClock clock = new MockClock(); clock.Today = new DateTime(2015, 6, 1); MockWeather weather = new MockWeather(); weather.MaxT = 30; weather.MinT = 10; weather.Rain = 100; weather.Radn = 25; MockSurfaceOrganicMatter surfaceOrganicMatter = new MockSurfaceOrganicMatter(); surfaceOrganicMatter.Cover = 0.8; List<ICanopy> canopies = new List<ICanopy>(); EvaporationModel evaporation = new EvaporationModel(); SetLink(soil, "properties", soilProperties); SetLink(evaporation, "soil", soil); SetLink(evaporation, "clock", clock); SetLink(evaporation, "weather", weather); SetLink(evaporation, "canopies", canopies); SetLink(evaporation, "surfaceOrganicMatter", surfaceOrganicMatter); // Empty profile. soil.Water = MathUtilities.Multiply(soilProperties.Water.LL15, soilProperties.Water.Thickness); evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 3.00359)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 2.20072)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 1.57064)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 0.96006)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 0.75946)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 0.64851)); soil.Infiltration = 100; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 3.00359)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 2.20072)); }
public void TestEvaporation() { MockSoil soil = new MockSoil(); APSIM.Shared.Soils.Soil soilProperties = Setup(); APSIMReadySoil.Create(soilProperties); MockClock clock = new MockClock(); clock.Today = new DateTime(2015, 6, 1); MockWeather weather = new MockWeather(); weather.MaxT = 30; weather.MinT = 10; weather.Rain = 100; weather.Radn = 25; MockSurfaceOrganicMatter surfaceOrganicMatter = new MockSurfaceOrganicMatter(); surfaceOrganicMatter.Cover = 0.8; List <ICanopy> canopies = new List <ICanopy>(); EvaporationModel evaporation = new EvaporationModel(); SetLink(soil, "properties", soilProperties); SetLink(evaporation, "soil", soil); SetLink(evaporation, "clock", clock); SetLink(evaporation, "weather", weather); SetLink(evaporation, "canopies", canopies); SetLink(evaporation, "surfaceOrganicMatter", surfaceOrganicMatter); // Empty profile. soil.Water = MathUtilities.Multiply(soilProperties.Water.LL15, soilProperties.Water.Thickness); evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 3.00359)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 2.20072)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 1.57064)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 0.96006)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 0.75946)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 0.64851)); soil.Infiltration = 100; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 3.00359)); soil.Infiltration = 0; evaporation.Calculate(); Assert.IsTrue(MathUtilities.FloatsAreEqual(evaporation.Es, 2.20072)); }
public void TestRunoff() { SoilModel soil = new SoilModel(); APSIM.Shared.Soils.Soil soilProperties = Setup(); APSIMReadySoil.Create(soilProperties); MockWeather weather = new MockWeather(); weather.Rain = 100; MockIrrigation irrigation = new MockIrrigation(); irrigation.IrrigationApplied = 0; MockSurfaceOrganicMatter surfaceOrganicMatter = new MockSurfaceOrganicMatter(); surfaceOrganicMatter.Cover = 0.1; CNReductionForCover reductionForCover = new CNReductionForCover(); List<ICanopy> canopies = new List<ICanopy>(); CNReductionForTillage reductionForTillage = new CNReductionForTillage(); RunoffModel runoff = new RunoffModel(); runoff.CN2Bare = 70; // setup links SetLink(soil, "properties", soilProperties); SetLink(soil, "runoffModel", runoff); SetLink(soil, "weather", weather); SetLink(soil, "irrigation", irrigation); SetLink(runoff, "soil", soil); SetLink(runoff, "reductionForCover", reductionForCover); SetLink(runoff, "reductionForTillage", reductionForTillage); SetLink(reductionForCover, "surfaceOrganicMatter", surfaceOrganicMatter); SetLink(reductionForCover, "canopies", canopies); SetLink(reductionForTillage, "weather", weather); // Empty profile. soil.Water = MathUtilities.Multiply(soilProperties.Water.LL15, soilProperties.Water.Thickness); // Profile is empty - should be small amount of runoff. Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 5.60815)); // Full profile - should be a lot more runoff. soil.Water = MathUtilities.Multiply(soilProperties.Water.DUL, soilProperties.Water.Thickness); Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 58.23552)); // Test CN reduction due to canopy. Tests the Curve Number vs Cover graph. // Cover is 10%, reduction is 2.5 surfaceOrganicMatter.Cover = 0.1; Assert.IsTrue(MathUtilities.FloatsAreEqual(reductionForCover.Value, 2.49999)); // Cover is 80%, reduction is 20 surfaceOrganicMatter.Cover = 0.8; Assert.IsTrue(MathUtilities.FloatsAreEqual(reductionForCover.Value, 20.0)); // Test Runoff vs Rainfall graph i.e. effect of different curve numbers. surfaceOrganicMatter.Cover = 0.0; runoff.CN2Bare = 60; Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 48.18584)); runoff.CN2Bare = 75; Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 68.16430)); runoff.CN2Bare = 85; Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 81.15006)); }
public void TestRunoff() { SoilModel soil = new SoilModel(); APSIM.Shared.Soils.Soil soilProperties = Setup(); APSIMReadySoil.Create(soilProperties); MockWeather weather = new MockWeather(); weather.Rain = 100; MockIrrigation irrigation = new MockIrrigation(); irrigation.IrrigationApplied = 0; MockSurfaceOrganicMatter surfaceOrganicMatter = new MockSurfaceOrganicMatter(); surfaceOrganicMatter.Cover = 0.1; CNReductionForCover reductionForCover = new CNReductionForCover(); List <ICanopy> canopies = new List <ICanopy>(); CNReductionForTillage reductionForTillage = new CNReductionForTillage(); RunoffModel runoff = new RunoffModel(); runoff.CN2Bare = 70; // setup links SetLink(soil, "properties", soilProperties); SetLink(soil, "runoffModel", runoff); SetLink(soil, "weather", weather); SetLink(soil, "irrigation", irrigation); SetLink(runoff, "soil", soil); SetLink(runoff, "reductionForCover", reductionForCover); SetLink(runoff, "reductionForTillage", reductionForTillage); SetLink(reductionForCover, "surfaceOrganicMatter", surfaceOrganicMatter); SetLink(reductionForCover, "canopies", canopies); SetLink(reductionForTillage, "weather", weather); // Empty profile. soil.Water = MathUtilities.Multiply(soilProperties.Water.LL15, soilProperties.Water.Thickness); // Profile is empty - should be small amount of runoff. Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 5.60815)); // Full profile - should be a lot more runoff. soil.Water = MathUtilities.Multiply(soilProperties.Water.DUL, soilProperties.Water.Thickness); Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 58.23552)); // Test CN reduction due to canopy. Tests the Curve Number vs Cover graph. // Cover is 10%, reduction is 2.5 surfaceOrganicMatter.Cover = 0.1; Assert.IsTrue(MathUtilities.FloatsAreEqual(reductionForCover.Value, 2.49999)); // Cover is 80%, reduction is 20 surfaceOrganicMatter.Cover = 0.8; Assert.IsTrue(MathUtilities.FloatsAreEqual(reductionForCover.Value, 20.0)); // Test Runoff vs Rainfall graph i.e. effect of different curve numbers. surfaceOrganicMatter.Cover = 0.0; runoff.CN2Bare = 60; Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 48.18584)); runoff.CN2Bare = 75; Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 68.16430)); runoff.CN2Bare = 85; Assert.IsTrue(MathUtilities.FloatsAreEqual(runoff.Value, 81.15006)); }