Beispiel #1
0
        protected override ITime EngineInitialize(List <IArgument> arguments)
        {
            _modelId = (string)base.GetArgumentValueFirstCaptionMatch(
                OmiArguments.ModelID.ToString());

            _simulationStart = (DateTime)base.GetArgumentValueFirstCaptionMatch(
                OmiArguments.SimulationStart.ToString());
            _simulationEnd = (DateTime)base.GetArgumentValueFirstCaptionMatch(
                OmiArguments.SimulationEnd.ToString());

            _gridInfo = new GridInfo(
                (double)base.GetArgumentValueFirstCaptionMatch(OmiArguments.OriginX.ToString()),
                (double)base.GetArgumentValueFirstCaptionMatch(OmiArguments.OriginY.ToString()),
                (double)base.GetArgumentValueFirstCaptionMatch(OmiArguments.CellSize.ToString()),
                (int)base.GetArgumentValueFirstCaptionMatch(OmiArguments.NX.ToString()),
                (int)base.GetArgumentValueFirstCaptionMatch(OmiArguments.NY.ToString()),
                (double)base.GetArgumentValueFirstCaptionMatch(OmiArguments.GridAngle.ToString()));

            FileInfo fileOut = base.GetFirstCaptionMatchArgumentValueAsRootedFileInfo(
                "FileOut");

            _groundWaterLevel = (double)base.GetArgumentValueFirstCaptionMatch(OmiArguments.GroundWaterLevel.ToString());

            _monitorExchangeEvents = (bool)base.GetArgumentValueFirstCaptionMatch(
                OmiArguments.MonitorExchangeEvents.ToString());

            _gwEngine = new Engine(_simulationStart, _simulationEnd, _gridInfo, _groundWaterLevel, fileOut);

            IElementSet elementSet = new Grid(_gridInfo);

            _describes.Caption = _modelId;

            TimeSet timeExtent = new TimeSet();

            timeExtent.TimeHorizon = new Time(_simulationStart, _simulationEnd);

            TimeExtent = timeExtent;

            double[] zeros  = new double[_gridInfo.NumberOfCells];
            double[] levels = new double[_gridInfo.NumberOfCells];

            for (int n = 0; n < _gridInfo.NumberOfCells; ++n)
            {
                zeros[n]  = 0;
                levels[n] = 0;
            }

            double relaxation    = 1;                                  // for linear extrapolation, 1 = None
            double timeTolerance = 1.0 / (24.0 * 60.0 * 60.0 * 100.0); // 1/100th sec

            Targets.Add(new Inflow((Targets.Count + Sources.Count).ToString(),
                                   zeros,
                                   timeTolerance,
                                   new Grid(_gridInfo),
                                   this));

            Sources.Add(new AquiferLevel((Targets.Count + Sources.Count).ToString(),
                                         zeros,
                                         relaxation,
                                         new Grid(_gridInfo),
                                         this));

            Sources.Add(new AquiferStorage((Targets.Count + Sources.Count).ToString(),
                                           zeros,
                                           relaxation,
                                           new Grid(_gridInfo),
                                           this));

            return(new Time(_gwEngine.CurrentTime));
        }
Beispiel #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="gridInfo">DHI.OpenMI.MikeShe.GridInfo Object</param>
 public Grid(GridInfo gridInfo)
 {
     _gridInfo = gridInfo;
     _describable.Description = _gridInfo.ToString();
 }