Commit a83d6cae authored by Domanski, Marian M.'s avatar Domanski, Marian M.

add simulation recorder to simulation run

parent 2b08f6b0
......@@ -7,13 +7,12 @@ from copy import deepcopy
import h5py
import numpy as np
from fluegg.asiancarpeggs import BigheadCarpEggs, GrassCarpEggs, SilverCarpEggs
from fluegg.drift import ConstantDriftingParticle
from fluegg.hydraulics import from_csv
from fluegg.hydraulics import RoughBottomSeriesOfHydraulicCells
from fluegg.resultsrecorder import FullResultsRecorder, QuantileResultsRecorder
from fluegg.simclock import SimulationClock
from fluegg.asiancarpeggs import BigheadCarpEggs
from fluegg.asiancarpeggs import SilverCarpEggs
from fluegg.asiancarpeggs import GrassCarpEggs
from fluegg.drift import ConstantDriftingParticle
from fluegg.transporter import init_transporter
try:
......@@ -107,7 +106,7 @@ class Simulation:
Returns
-------
SimulationResults
Results
"""
self._verify_time_step()
......@@ -122,15 +121,21 @@ class Simulation:
average_temp = self._hydraulic_model.average_temperature()
configuration['temperature'] = average_temp
results_type = configuration.get('results_type', 'full')
if results_type == 'full':
results_class = FullResultsRecorder
else:
results_class = QuantileResultsRecorder
# Initialize simulation results
simulation_results = SimulationResults(
results_recorder = results_class(
self._simclock,
self._particles,
configuration,
self._hydraulic_model)
positions = self._particles.position()
hydraulic_results = self._hydraulic_model.hydraulic_results(positions)
simulation_results.record_result(
results_recorder.record_result(
self._simclock, self._particles, hydraulic_results)
# Run through all time steps
......@@ -154,10 +159,10 @@ class Simulation:
raise e
# record the result in the current state
simulation_results.record_result(
results_recorder.record_result(
self._simclock, self._particles, hydraulic_results)
return simulation_results
return results_recorder.results()
def from_input_dict(d):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment