Utopia
2
Framework for studying models of complex & adaptive systems.
|
A very simple geomorphology model. More...
#include <Geomorphology.hh>
Public Types | |
using | Base = Model< Geomorphology, GeomorphologyTypes > |
The base model type. More... | |
using | DataSet = typename Base::DataSet |
Data type for a dataset. More... | |
using | GeomorphologyCellManager = CellManager< CellTraits, Geomorphology > |
The type of the cell manager. More... | |
using | GeomorphologyCellType = GeomorphologyCellManager::Cell |
A cell in the geomorphology model. More... | |
using | GeomorphologyCellIndexType = Utopia::IndexType |
The index type of the Geomorphology cell manager. More... | |
using | GmorphCellContainer = Utopia::CellContainer< GeomorphologyCellType > |
The type of a cell container in the Geomorphology model. More... | |
using | RuleFunc = typename GeomorphologyCellManager::RuleFunc |
Rule function type, extracted from CellManager. More... | |
Public Types inherited from Utopia::Model< Geomorphology, GeomorphologyTypes > | |
using | Config = typename ModelTypes::Config |
Data type that holds the configuration. More... | |
using | DataManager = DataIO::Default::DefaultDataManager< Geomorphology > |
The data manager to use, specialized with the derived model. More... | |
using | DataGroup = typename ModelTypes::DataGroup |
Data type that is used for storing datasets. More... | |
using | DataSet = typename ModelTypes::DataSet |
Data type that is used for storing data. More... | |
using | RNG = typename ModelTypes::RNG |
Data type of the shared RNG. More... | |
using | Space = typename ModelTypes::Space |
Data type of the space this model resides in. More... | |
using | Time = typename ModelTypes::Time |
Data type for the model time. More... | |
using | Monitor = typename ModelTypes::Monitor |
Data type for the monitor. More... | |
using | MonitorManager = typename ModelTypes::MonitorManager |
Data type for the monitor manager. More... | |
using | Level = typename ModelTypes::Level |
Data type for the hierarchical level. More... | |
Public Member Functions | |
template<class ParentModel > | |
Geomorphology (const std::string &name, ParentModel &parent_model, const DataIO::Config &custom_cfg={}) | |
Dataset of watercolumn. More... | |
void | build_network () |
The set of seperately applied rules to build the drainage network. More... | |
void | perform_step () |
Perform step. More... | |
void | monitor () |
Provide monitoring data: tree density and number of clusters. More... | |
void | write_data () |
Write the cell states (aka water content) More... | |
Public Member Functions inherited from Utopia::Model< Geomorphology, GeomorphologyTypes > | |
Model (const std::string &name, const ParentModel &parent_model, const Config &custom_cfg={}, std::tuple< WriterArgs... > w_args={}, const DataIO::Default::DefaultDecidermap< Geomorphology > &w_deciders=DataIO::Default::default_deciders< Geomorphology >, const DataIO::Default::DefaultTriggermap< Geomorphology > &w_triggers=DataIO::Default::default_triggers< Geomorphology >) | |
Constructs a Model instance. More... | |
const std::shared_ptr< Space > & | get_space () const |
Return the space this model resides in. More... | |
Time | get_time () const |
Return the current time of this model. More... | |
Time | get_time_max () const |
Return the maximum time possible for this model. More... | |
Config | get_cfg () const |
Return the config node of this model. More... | |
std::string | get_name () const |
Return the name of this model instance. More... | |
std::string | get_full_name () const |
Return the full name of this model within the model hierarchy. More... | |
std::shared_ptr< DataGroup > | get_hdfgrp () const |
Return a pointer to the HDF group this model stores data in. More... | |
Time | get_write_start () const |
Return the parameter that controls when write_data is called first. More... | |
Time | get_write_every () const |
Return the parameter that controls how often write_data is called. More... | |
DataManager | get_datamanager () const |
return the datamanager More... | |
hsize_t | get_remaining_num_writes () const |
Return the number of remaining write_data calls this model will make. More... | |
std::shared_ptr< RNG > | get_rng () const |
Return a pointer to the shared RNG. More... | |
std::shared_ptr< spdlog::logger > | get_logger () const |
Return a pointer to the logger of this model. More... | |
Monitor | get_monitor () const |
Return the monitor of this model. More... | |
std::shared_ptr< MonitorManager > | get_monitor_manager () const |
Get the monitor manager of the root model. More... | |
Level | get_level () const |
Return the hierarchical level within the model hierarchy. More... | |
virtual void | prolog () |
A function that is called before starting model iteration. More... | |
virtual void | epilog () |
A function that is called after the last iteration of a model. More... | |
void | iterate () |
Iterate one (time) step of this model. More... | |
void | run () |
Run the model from the current time to the maximum time. More... | |
std::shared_ptr< DataSet > | create_dset (const std::string name, const std::shared_ptr< DataGroup > &hdfgrp, std::vector< hsize_t > add_write_shape, const std::size_t compression_level=1, const std::vector< hsize_t > chunksize={}) |
Create a new dataset within the given group. More... | |
std::shared_ptr< DataSet > | create_dset (const std::string name, const std::vector< hsize_t > add_write_shape, const std::size_t compression_level=1, const std::vector< hsize_t > chunksize={}) |
Create a new dataset within the model's base data group. More... | |
std::shared_ptr< DataSet > | create_cm_dset (const std::string name, const CellManager &cm, const std::size_t compression_level=1, const std::vector< hsize_t > chunksize={}) |
Create a dataset storing data from a CellManager. More... | |
std::shared_ptr< DataSet > | create_am_dset (const std::string name, const AgentManager &am, const std::size_t compression_level=1, const std::vector< hsize_t > chunksize={}) |
Create a dataset storing data from a AgentManager. More... | |
Private Member Functions | |
bool | check_eq (const double &a, const double &b) |
Compare two floats for equality. More... | |
template<typename Cell > | |
bool | check_eq_waterline (const Cell &a, const Cell &b) |
Compare the waterline of two cells. More... | |
void | _initialize_cells () |
The initialization of the cells. More... | |
template<typename Cell > | |
Cell | _lowest_grid_neighbor (const Cell &cell) |
Return the lowest cell of the grid-Neighborhood, including cell itself. More... | |
GmorphCellContainer | update_lakesites (GmorphCellContainer &lake, GmorphCellContainer &shore) |
Update the CellContainer of lake and shore clls. More... | |
Private Attributes | |
GeomorphologyCellManager | _cm |
The cell manager for the forest fire model. More... | |
std::normal_distribution | _uplift |
The random uplift as normal distribution. More... | |
double | _stream_power_coef |
The stream power coefficient. More... | |
double | _toppling_frequency |
The frequency of possible toppling events per cell. More... | |
double | _toppling_critical_height |
The critical height difference to trigget a toppling event. More... | |
double | _toppling_slope_reduction_factor |
The factor by which to reduce the slope in a toppling event. More... | |
std::unordered_map< GeomorphologyCellIndexType, std::shared_ptr< GeomorphologyCellType > > | _lowest_neighbors |
const double | _float_precision |
std::uniform_real_distribution | _prob_dist |
precision when comparing floats More... | |
std::shared_ptr< DataSet > | _dset_height |
std::shared_ptr< DataSet > | _dset_drainage_area |
Dataset of rock height. More... | |
std::shared_ptr< DataSet > | _dset_watercolumn |
Dataset of drainage area. More... | |
RuleFunc | uplift_rule |
The rule how to uplift. More... | |
RuleFunc | erode |
The rule how to erode with stream power. More... | |
RuleFunc | toppling |
The rule how to topple / landslide. More... | |
RuleFunc | reset_network |
The rule to reset the drainage network. More... | |
RuleFunc | connect_cells |
Build a rudimentary network. More... | |
RuleFunc | build_lake |
Fill a sink with water. More... | |
RuleFunc | pass_drainage_area |
Make a drainage process from this cell. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Utopia::Model< Geomorphology, GeomorphologyTypes > | |
void | __perform_step () |
Perform the computation of a step. More... | |
void | __monitor () |
Monitor information in the terminal. More... | |
void | __write_data () |
Write data; calls the implementation's write_data method. More... | |
void | __write_initial_state () |
Write the initial state. More... | |
void | increment_time (const Time dt=1) |
Increment time. More... | |
void | __prolog () |
The default prolog of a model. More... | |
void | __epilog () |
The default epilog of a model. More... | |
Geomorphology & | impl () |
cast to the derived class More... | |
const Geomorphology & | impl () const |
const cast to the derived interface More... | |
Protected Attributes inherited from Utopia::Model< Geomorphology, GeomorphologyTypes > | |
const std::string | _name |
Name of the model instance. More... | |
const std::string | _full_name |
The full name within the model hierarchy. More... | |
const Level | _level |
The level within the model hierarchy. More... | |
const Config | _cfg |
Config node belonging to this model instance. More... | |
const std::shared_ptr< RNG > | _rng |
The RNG shared between models. More... | |
const std::shared_ptr< spdlog::logger > | _log |
The (model) logger. More... | |
std::shared_ptr< Space > | _space |
The space this model resides in. More... | |
Time | _time |
Model-internal current time stamp. More... | |
const Time | _time_max |
Model-internal maximum time stamp. More... | |
const std::shared_ptr< DataGroup > | _hdfgrp |
The HDF group this model instance should write its data to. More... | |
const Time | _write_start |
First time at which write_data is called. More... | |
const Time | _write_every |
How often to call write_data from iterate. More... | |
Monitor | _monitor |
The monitor. More... | |
DataManager | _datamanager |
Manager object for handling data output; see DataManager. More... | |
Static Protected Attributes inherited from Utopia::Model< Geomorphology, GeomorphologyTypes > | |
static constexpr WriteMode | _write_mode |
Which data-writing mode the base model should use. More... | |
A very simple geomorphology model.
The base model type.
using Utopia::Models::Geomorphology::Geomorphology::DataSet = typename Base::DataSet |
Data type for a dataset.
The index type of the Geomorphology cell manager.
using Utopia::Models::Geomorphology::Geomorphology::GeomorphologyCellManager = CellManager<CellTraits, Geomorphology> |
The type of the cell manager.
using Utopia::Models::Geomorphology::Geomorphology::GeomorphologyCellType = GeomorphologyCellManager::Cell |
A cell in the geomorphology model.
using Utopia::Models::Geomorphology::Geomorphology::GmorphCellContainer = Utopia::CellContainer<GeomorphologyCellType> |
The type of a cell container in the Geomorphology model.
using Utopia::Models::Geomorphology::Geomorphology::RuleFunc = typename GeomorphologyCellManager::RuleFunc |
Rule function type, extracted from CellManager.
|
inline |
Dataset of watercolumn.
Construct the Geomorphology model
name | Name of this model instance; is used to extract the configuration from the parent model and set up a HDFGroup for this instance |
parent_model | The parent model this model instance resides in |
custom_cfg | A custom configuration to use instead of the one extracted from the parent model using the instance name |
|
inlineprivate |
The initialization of the cells.
Adds the inclination to the cells initial rock height.
Defines the outflow boundary.
Initializes the drainage network and lakes
|
inlineprivate |
Return the lowest cell of the grid-Neighborhood, including cell itself.
|
inline |
The set of seperately applied rules to build the drainage network.
|
inlineprivate |
Compare two floats for equality.
|
inlineprivate |
Compare the waterline of two cells.
|
inline |
Provide monitoring data: tree density and number of clusters.
|
inline |
Perform step.
|
inlineprivate |
Update the CellContainer of lake and shore clls.
lake | Reference to a Container of lake cells. Lake: cells of equal waterline. |
shore | Reference to the Cells neighboring the lake |
\Note updates the shore Container to match the new lake
|
inline |
Write the cell states (aka water content)
The cell height is currently not written out as in the current implementation it does not change over time (erosion is not yet included).
|
private |
The cell manager for the forest fire model.
|
private |
Dataset of rock height.
|
private |
|
private |
Dataset of drainage area.
|
private |
|
private |
|
private |
precision when comparing floats
A re-usable uniform real distribution to evaluate probabilities
|
private |
The stream power coefficient.
|
private |
The critical height difference to trigget a toppling event.
The probability of a toppling event is given as \( p = \Delta h / h_{crit} \), where \( \Delta h \) is the difference in height between a target cell and its highest neighbor.
|
private |
The frequency of possible toppling events per cell.
|
private |
The factor by which to reduce the slope in a toppling event.
The difference in height between the source and target cell of the toppling event is divided by this factor. This amount of rock is removed from the source and added to the target site.
default value: 3.
|
private |
The random uplift as normal distribution.
|
private |
Fill a sink with water.
such that there is a shore cell to the resulting lake that is either outflow or lower than the lakes waterline.
Updates the _lowest_neighbors map for all lake cells to point to the outflow alias a Cell within lake neighboring the lower shore cell.
|
private |
Build a rudimentary network.
Create map: cells to their lowest_neighbor (random choice if multiple). Sinks (no lower neighbor or outflow) map to themselfes.
|
private |
The rule how to erode with stream power.
|
private |
Make a drainage process from this cell.
Pass the cells drainage area through the already drained downstream cells up to an outflow or not already drained cell.
|
private |
The rule to reset the drainage network.
|
private |
The rule how to topple / landslide.
Failure of slope occurs with p = (h_i - h_j) / h_c
On failure slope is reduced to 1/3. of its initial value.
|
private |
The rule how to uplift.