|
Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
|
Instructions how expand the code base for your own needs.
The model design allows a complete substitution of the herbivore class. If you want to implement a completely new model behaviour, you can derive your new class from Fauna::HerbivoreInterface and write it from scratch. If you want to build upon the base functionality, derive it from Fauna::HerbivoreBase.
Then, derive a new class from Fauna::PopulationInterface to manage and construct your object instances. In Fauna::WorldConstructor::create_populations(), create all instances of that population class for one habitat.
expenditure.components in Fauna::InsfileReader::read_hft(); include it in the error message.A foraging limit constrains the daily uptake of forage mass by a herbivore individual. Foraging limits are implemented as functors (without using the strategy design pattern, though). Which ones are activated is defined by foraging.limits in Fauna::Hft. They are called in Fauna::GetForageDemands::get_max_foraging().
foraging.limits in Fauna::InsfileReader::read_hft()On top of foraging limitations, the daily forage uptake can be constrained by maximum digestive throughput. The implementation is almost parallel to a foraging limit.
digestion.limit from the TOML instruction file in Fauna::InsfileReader::read_hft().A reproduction model defines the offspring per female individual for each simulation day.
reproduction.model from the instruction file in Fauna::InsfileReader::read_hft().In a scenario with multiple forage types, the herbivore decides what to include in its diet. This decision is modelled by an implementation of a so called “diet composer model”: Fauna::DietComposer. You can implement your own model as a new class or a simple function; just call it in Fauna::GetForageDemands::get_diet_composition().
foraging.diet_composer in Fauna::InsfileReader::read_hft().Any death event of an herbivore is modelled by a mortality factor. Whether you want to have herbivores die by for instance disease, drought, or predators, you should create a new mortality factor.
mortality.factors in Fauna::InsfileReader::read_hft().get_all_forage_types(), which is declared in local namespace in forage_types.cpp.merge() method, like Fauna::GrassForage::merge().merge() function in Fauna::HabitatForage::merge().forage.gross_energy.new_forage_type in the TOML file.SimpleHabitat.
digestion.net_energy_model in Fauna::InsfileReader::read_hft().simulation.forage_distribution in Fauna::InsfileReader::read_hft().enum class type for Enum parameters should be declared in parameters.h.output and simulation. You should then write a new private member function similar to Fauna::InsfileReader::read_table_simulation().enum class type for Enum parameters should be declared in hft.h.After separating the megafauna model from LPJ-GUESS into its own library only a minimal set of variables are made available for output. If your variable of interest is already present in Fauna::Output::HabitatData or Fauna::Output::HerbivoreData, then you can skip the first step in the following tutorial.
reset() function.merge() function.examples/megafauna.toml and plotting it in tools/demo_simulator/demo_results.Rmd. In that case the output file needs to be listed as an artifact in .gitlab-ci.yml under the job “demo_simulation”.std::ofstream) for your variable as a private member variable in Fauna::Output::TextTableWriter.The default output format are very simple tab-separated plaintext tables. The class Fauna::Output::TextTableWriter is responsible for this format. However, you can also replace that output format with another one, for instance writing to a NetCDF file or forwarding it to another program or library.
This software documentation is licensed under a Creative Commons Attribution 4.0 International License.