EngineNet Class

The EngineNet holds the network that is used for the computations. It is the main entrance to module data/state.

Definition

Namespace: DHI.Mike1D.Engine
Assembly: DHI.Mike1D.Engine (in DHI.Mike1D.Engine.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
public class EngineNet : INetworkGeneric
Inheritance
Object    EngineNet
Implements
INetworkGeneric

Constructors

EngineNet Create empty EngineNet.
EngineNet(StopwatchCollection) Create empty EngineNet. StopwatchCollection will have added child watches used by the EngineNet.

Properties

AdditionalData Internal method. Additional data from the MIKE 1D data object. Set during initialize.
ADModule AD module
AirModule Air module
BaseFilePath Internal method. Base file path of simulation. Set during initialize.
CatchmentModifiers Modifiers for catchment output.

Must be provided before prepare

DataModule DataModule - always present
EngineTime Simulation time. To be elaborated.
HDModule hdModule - must always be present
LTSModule LTS module
MaxNumberOfThreadsUser Maximum number of threads to use.

Using more than one thread may give different results, due change in order of calculations and therefor different rounding errors from simulation to simulation when running multiple threads. If exact same results are required for each simulation, set this to 1.

The number of threads actually used are limited by the smallest of this number, the number of logical processing units (number of CPU cores), the license and the OMP_NUM_THREADS environment variable.

Modules All modules (HD, AD, WQ, ST)
Nodes List of EngineNodes
PauseSimulation If this is true, then the simulation will pause before the next timestep
ProjectionString Returns Projection String.
Reaches List of Engine Reaches
RRModule RRModule, used when running RR+HD in parallel.
RuntimeDiagnostics Diagnostics instance for the engine net. Used during runtime.

Methods

AnyPostIterationEvent Is there a PostIterationEvent
BuildSearchMaps Build search maps. Whenever the list of reaches and nodes are updated, this method must be called to rebuild search maps.
CreateRuntimeDiagnostics Create a runtime Diagnostics instance. This is called from Mike1DController.Prepare()
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
FindAllReaches Finds all the reach that uses the specified name. If none of the reaches contains the location null is returned.
FindNode Find EngineNode based on location.
FindReach(ILocation) Finds the reach that contains the specified location. If none of the reaches contains the location null is returned. If location is exactly on a node, the location can exist on more than one reaches, the first in the list is returned.
FindReach(String) Finds the reach that contains the specified location. If none of the reaches contains the location null is returned. If more than span exist with the same reachId, the first found is returned.
FindReach(ILocation, Double) Finds the reach that contains the specified location. If none of the reaches contains the location null is returned. If location is exactly on a node, the location can exist on more than one reaches, the first in the list is returned.
Finish Finish the simulation
GetComponentConcentration Get an array of all concentrations for all components at the given grid point
GetComponentSourcePoint(EngineNode) Get a source point for component sources.

If no components are included in simulation, or if node is not part of component simulation, null is returned.

GetComponentSourcePoint(EngineReach, Int32) Get a source point for component sources.

The gridPointIndex must match a grid point with volume, i.e. an HGridPoint.

If no components are included in simulation, or if node is not part of component simulation, null is returned.

GetHashCodeServes as the default hash function.
(Inherited from Object)
GetNumberOfThreads Get the number of threads, taking the smallest of: input argument, the "OMP_NUM_THREADS" environment variable and the number of cores on the computer.

If the number of threads is smaller than the number of cores on the computer, and "OMP_NUM_THREADS" is not set, then "OMP_NUM_THREADS" is set to this value.

GetNumberOfThreadsEnvironment Number of threads as defined by the environment variables.
GetSourcePointSurfaceInflow Get a source point for surface inflow for the specified node. The NodeMaxInflowReservoir class collects all inflow from surface and applies a max inflow limit to how much is forwarded to the node. The remainder of the inflow is stored in a reservoir "on top of" the node. When no limit is specified (MaxInflowFromSurface is big), all inflow is added directly to the node.
GetTypeGets the Type of the current instance.
(Inherited from Object)
Initialize In the initialization step, the network is layed out and the engine component is prepared for exchange item inspection.
InitializeModules(HDParameterData, CrossSectionData, TimeStepping, DateTime, DateTime, ADComponentData, Boolean, STData, Boolean, EcoLabData, Boolean, BoundaryData, Int32, StopwatchCollection, StopwatchCollection) Initialize the modules. Called in general initialize step
InitializeModules(HDParameterData, CrossSectionData, TimeStepping, DateTime, DateTime, ADComponentData, Boolean, STData, Boolean, EcoLabData, Boolean, AirParameterData, Boolean, BoundaryData, Int32, StopwatchCollection, StopwatchCollection) Initialize the modules. Called in general initialize step
InitializeThreadPool For threaded domain decomposition, setup thread pool.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
PerformTimeStep Perform a time step. In case of failure, an exception is thrown, usually through the RuntimeDiagnostics.

In case of adaptive time stepping, this method will redo the time step until the requirements are met or the minimum time step length is used.

Prepare Prepares the engine for timestepping. - Creates and prepares resultDataAccess components - Initialize the engine by either reading initial conditions, reading hotstart information, by calculating steady solution or by some combination of these three Prepare() does not have to be called before OpenMI configuration phase.
ReAssignBoundarySource Reassign an open bounadry to a node.
ReleaseLicense Call this to release all licenses after simulation is done.
ResetStopSimulation Calling this function will end the simulation after the current timestep has been completed
RunUntil Performs time steps until the specified time is reached
StopSimulation Calling this function will end the simulation after the current timestep has been completed
ToStringReturns a string that represents the current object.
(Inherited from Object)
TriggerApplyExternalSourcesEvent 
TriggerPostTimeStepEvent Internal trigger method. Do not use!
TriggerSimulationDoneEvent Internal code, do not use

Trigger simulation-done event.

TriggerSpecialEvent Trigger a special event, with the provided id
TryFindReach Finds the reach that contains the specified location. If none of the reaches contains the location null is returned.
Validate Validate whether the EngineNet is in a valid state.

Events

ApplyExternalSourcesEvent An event that is called everytime external sources are to be applied
EvaluateHDImplicitSourcesEvent An event that is called everytime external HD implicit sources are to be evaluated.

The event can be used when an AD component must be applied based on a HD implicit source.

PostIterationEvent An event that is called everytime an iteration was successfully performed.
PostTimeStepEvent An event that is called everytime a timestep was successfully performed.
PreTimeStepEvent An event that is called everytime a timestep is initiated.

Arguments:

  • Time N
  • Time N+1
  • redo-counter, incremented when an adaptive time step is redone. Initially zero.

For adaptive time stepping a timestep can be rejected and recalculated, in which case this event is triggered more than once for the same time step, but with a different end time and the redocounter (third argument) is incremented.

SimulationDoneEvent An event that is called when the simulation is done
SimulationPreparedEvent An event that is called when the simulation has been prepared
SpecialEvent Special events

Fields

StopwatchOverall public because we need to access it to add other timers
StopwatchPostTimeStepEvent public stopwatch for post time step event. When registering to the PostTimeStepEvent, you may also add a child to this stop watch, to detail out the timings.
UseThreadedDomainDecomposition Use Threaded domain decomposition

Extension Methods

AddTimer Add timer to simulation
(Defined by EngineExtensions)
FindReachWithStructure For a given structure, find the reach where it is located. Or null if it is not found.
(Defined by EngineExtensions)
GetClosestDownstreamGridpoint Find the specified type of gridpoint which is closest to the given location downstream.

It is assumed that the EngineReach max and min chainages are containing the given chainage, otherwise null is returned.


(Defined by EngineFindExtensions)
GetClosestUpstreamGridpoint Find the specified type of gridpoint which is closest to the given location upstream.

It is assumed that the EngineReach max and min chainages are containing the given chainage, otherwise null is returned.


(Defined by EngineFindExtensions)

See Also