Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
Tutor

Instructions how expand the code base for your own needs.

Herbivores Tutorials

How to add a new herbivore class

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.

Relationships for a new herbivore type.

How to add a new energy expenditure component

How to add a new foraging limit

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().

How to add a new digestive limit

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.

How to add a new reproduction model

A reproduction model defines the offspring per female individual for each simulation day.

How to add a new diet composer

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().

How to add a new mortality factor

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.

Forage Tutorials

How to add a new forage type

Relationships for a new forage type.

How to change forage net energy content

How to add a new forage distribution algorithm

Parameters Tutorials

How to add a new global parameter

How to add a new HFT parameter

  • Declare a new member variable in Fauna::Hft and initialize it with a valid default value. The enum class type for Enum parameters should be declared in hft.h.
  • Write a validity check in Fauna::Hft::is_valid().
See also
Parameters

Output Tutorials

How to add a new output variable

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.

Note
If you want to add a variable that is not per herbivore mass, you would have to use mass density as weight.

How to write output to another format

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.

See also
Output design

Author
Wolfgang Traylor, Senckenberg BiK-F
Date
2019