The AHA Model
Revision: 12809
Reference implementation 04 (HEDG02_04)
|
Definition the physical properties and condition of the agent. More...
Data Types | |
type | condition |
CONDITION defines the physical condition of the agent More... | |
type | reproduction |
REPRODUCTION type defines parameters of the reproduction system. More... | |
Functions/Subroutines | |
elemental real(srp) function | length2mass (k, l) |
This is the function to calculate the body weight from the length and the Fulton condition factor (energy reserves). More... | |
elemental real(srp) function | energy_reserve (m, l) |
Calculate the current energy reserves (Fulton condition factor) from body mass and length. More... | |
subroutine | condition_init_genotype (this) |
Initialise the individual body condition object based on the genome values. Two alleles are selected at random and input into the gamma2gene function to get the initial hormone values rescaled to 0:1. Note that the gamma2gene alleles defining the shape of the gamma function and the half-max effect are selected randomly in this version. Also, polyploid organisms are possible, in such case, two parameters are also randomly defined from a larger set (e.g. from four chromosomes in case of tetraploids). See implementation details and comments for each of the hormones. More... | |
subroutine | birth_mortality_enforce_init_fixed_debug (this) |
This procedure enforces selective mortality of agents at birth to avoid strong selection for energy and length. More... | |
elemental subroutine | condition_clean_history (this) |
Cleanup the history stack of the body length and mass. More... | |
elemental integer function | condition_age_get (this) |
Get current age. Standard GET-function. More... | |
elemental subroutine | condition_age_reset_zero (this) |
Reset the age of the agent to zero. More... | |
elemental subroutine | condition_age_increment (this, increment) |
Increment the age of the agent by one. More... | |
elemental real(srp) function | condition_energy_current_get (this) |
Get current energy reserves. Standard GET-function. More... | |
elemental real(srp) function | condition_energy_maximum_get (this) |
Get historical maximum of energy reserves. Standard GET-function. More... | |
elemental real(srp) function | condition_body_length_get (this) |
Get current body length. Standard GET-function. More... | |
elemental real(srp) function | condition_control_unsel_get (this) |
Get current value of the control unselected trait. Standard GET-function. More... | |
elemental real(srp) function | condition_body_mass_get (this) |
Get current body mass. Standard GET-function. More... | |
real(srp) function | condition_agent_visibility_visual_range (this, object_area, contrast, time_step_model) |
Calculate the visibility range of this agent. Visibility depends on the size of the agent, ambient illumination and agent contrast. Visibility is the distance from which this agent can be seen by a visual object (e.g. predator or conspecific). This function is a wrapper to the the_environment::visual_range() function. More... | |
subroutine | condition_body_mass_set_update_hist (this, value_set, update_history) |
Set body mass optionally updating the history stack. More... | |
subroutine | condition_body_length_set_update_hist (this, value_set, update_history) |
Set body length optionally updating the history stack. More... | |
elemental real(srp) function | condition_energy_birth_get (this) |
Get historical record of energy reserves at birth. Standard GET-function. More... | |
elemental real(srp) function | condition_body_length_birth_get (this) |
Get historical record of body length at birth. Standard GET-function. More... | |
elemental real(srp) function | condition_body_mass_birth_get (this) |
Get historical record of body mass at birth. Standard GET-function. More... | |
elemental real(srp) function | condition_body_mass_max_get (this) |
Get historcal maximum for body mass. Standard GET-function. More... | |
elemental real(srp) function | condition_smr_get (this) |
Get current smr. Standard GET-function. More... | |
elemental real(srp) function | condition_stomach_content_get (this) |
Get current stomach content. Standard GET-function. More... | |
elemental real(srp) real(srp) function | body_mass_processing_cost_calc_v (this, food_gain, distance_food) |
Calculate the basic processing cost of catching a food item with the mass food_gain . More... | |
elemental real(srp) function | condition_cost_swimming_burst (this, distance, exponent) |
The cost of swimming of a specific distance in terms of the actor's body mass. More... | |
elemental real(srp) function | body_mass_processing_cost_calc_o (this, food_obj, distance_food) |
Calculate the basic processing cost of catching a food item with the mass food_gain . More... | |
elemental real(srp) function | stomach_content_food_gain_fitting_v (this, food_gain, food_dist) |
Calculate the value of possible food gain as fitting into the agent's stomach, or the full gain if the food item wholly fits in. More... | |
elemental real(srp) function | stomach_content_food_gain_fitting_o (this, food_obj, food_dist) |
Calculate the value of possible food gain as fitting into the agent's stomach (or full gain if the food item fits wholly). More... | |
elemental real(srp) function | stomach_content_food_gain_non_fit_v (this, food_gain) |
Calculate extra food surplus mass non fitting into the stomach of the agent. More... | |
elemental real(srp) function | stomach_content_food_gain_non_fit_o (this, food_obj) |
Calculate extra food surplus mass non fitting into the stomach of the agent. More... | |
elemental real(srp) function | body_mass_calculate_cost_living_step (this) |
Calculate the cost of living for a single model step. So the agent mass increment per a single model step should subtract this cost. More... | |
elemental subroutine | body_mass_adjust_living_cost_step (this) |
Adjust the body mass at the end of the model step against the cost of living. We do not adjust the cost of living at each food gain as several food items can be consumed by the agent at a single time step of the model. Cost of living is now calculated at the end of the time step of the model. More... | |
elemental subroutine | body_mass_grow_do_calculate (this, food_gain, update_history) |
Do grow body mass based on food gain from a single food item adjusted for cost etc. More... | |
elemental real(srp) function | body_mass_food_processing_cost_factor_smr (this, food_gain) |
The fraction of the cost of the processing of the food item(s) depending on the agent SMR. It is scaled in terms of the ratio of the food item mass to the agent mass. More... | |
elemental subroutine | stomach_content_get_increment (this, stomach_increment) |
Do increment stomach contents with adjusted (fitted) value. More... | |
real(srp) function | body_len_grow_calculate_increment_step (this, mass_increment) |
Calculate body length increment for a time step of the model. More... | |
subroutine | body_len_grow_do_calculate_step (this, mass_increment, update_history) |
Do linear growth for one model step based on the increment function the_body::condition::len_incr(). More... | |
subroutine | sex_steroids_update_increment (this) |
Update the level of the sex steroids. More... | |
elemental logical function | body_mass_is_starvation_check (this) |
Check if the body mass is smaller than the birth body mass or structural body mass. An agent dies of starvation if either of these conditions is met: More... | |
elemental logical function | is_starved (body_mass, stomach_content_mass, body_mass_birth, body_mass_maximum, energy_current, energy_maximum) |
This is the backend logical function that checks if the agent is starved. It is called by the condition::starved_death() => the_body::body_mass_is_starvation_check() procedure. More... | |
elemental subroutine | stomach_content_mass_emptify_step (this) |
Digestion. Stomach contents S(t) is emptied by a constant fraction each time step. More... | |
elemental real(srp) function | stomach_emptify_backend (stomach_content_mass) |
The backend engine for calculating the stomach content mass decrement as a consequence of digestion. Stomach contents S(t) is emptied by a constant fraction each time step : More... | |
elemental subroutine | condition_energy_update_after_growth (this) |
Update the energy reserves of the agent based on its current mass and length. This subroutine should be called after any event that can change the mass or/and length of the agent, e.g. food consumption. More... | |
elemental real(srp) function | cost_swimming_standard (this, steps) |
The standard cost of swimming is a diagnostic function that shows the cost, in units of the body mass, incurred if the agent passes a distance equal to commondata::lifespan units of its body length. More... | |
elemental real(srp) function | reproduction_cost_energy_fix (this) |
Calculate the energetic cost of reproduction in terms of the body mass of the this agent. The energetic cost of reproduction is obtained as a specific fixed fraction of the current body mass of the agent defined by the commondata::reproduction_cost_body_mass parameter. More... | |
real(srp) function | reproduction_cost_energy_dynamic (this) |
Calculate the energetic cost of reproduction in terms of the body mass of the this agent. The energetic cost of reproduction is different in males and females. More... | |
real(srp) function | reproduction_cost_unsuccessful_calc (this, cost_factor) |
Calculate the costs of unsuccessful reproduction. This is calculated as a fraction of the normal cost of reproduction returned by the function reproduction::reproduction_cost() . Reproduction can be unsuccessful for various reasons: insufficient reserves (reproduction results in starvation death) or stochastic no success. More... | |
elemental subroutine | reproduction_init_zero (this) |
Initialise the reproduction object for the agent. Everything is set to zero. More... | |
elemental integer function | reproduction_n_reproductions_get (this) |
Get the number of reproductions for this agent. More... | |
elemental subroutine | reproduction_n_reproductions_set (this, n_repr) |
Set the number of reproductions for the agent. More... | |
elemental integer function | reproduction_n_offspring_get (this) |
Get the number of offspring. More... | |
elemental subroutine | reproduction_n_offspring_set (this, n_offspr) |
Set the number of offspring for the agent. More... | |
subroutine | reproduction_n_increment (this, add_repr, average_mass_offspring) |
Increment the number of reproductions and offspring for this agent. More... | |
integer function | reproduction_n_offspring_calc (this, average_mass_offspr) |
Calculate the number of offspring per a single reproduction as a function of the agent's body mass. More... | |
elemental logical function | reproduction_ready_steroid_hormones_exceed (this) |
Determine if the agent's hormonal system is ready for reproduction. More... | |
real(srp) function | reproduction_mass_offspring_calc (this) |
Calculate the total mass of all offspring produced by this agent during a single reproduction event. More... | |
Variables | |
character(len= *), parameter, private | modname = "(THE_CONDITION)" |
Definition the physical properties and condition of the agent.
This module defines various physical properties of the agent, such as the body size, body mass etc, as well as the condition and basic physiological variables.
elemental real(srp) function the_body::length2mass | ( | real(srp), intent(in) | k, |
real(srp), intent(in) | l | ||
) |
This is the function to calculate the body weight from the length and the Fulton condition factor (energy reserves).
[in] | k,l | condition and body length. |
Body mass is non-genetic, length and initial condition factor are genetically determined. Body mass is calculated initially from the Fulton'scondition factor formula
i.e.
The exponent can be non-cube for non-isometric growth.
Definition at line 308 of file m_body.f90.
elemental real(srp) function the_body::energy_reserve | ( | real(srp), intent(in) | m, |
real(srp), intent(in) | l | ||
) |
Calculate the current energy reserves (Fulton condition factor) from body mass and length.
[in] | m,l | body mass and body length. |
Definition at line 331 of file m_body.f90.
subroutine the_body::condition_init_genotype | ( | class(condition), intent(inout) | this | ) |
Initialise the individual body condition object based on the genome values. Two alleles are selected at random and input into the gamma2gene
function to get the initial hormone values rescaled to 0:1. Note that the gamma2gene
alleles defining the shape of the gamma function and the half-max effect are selected randomly in this version. Also, polyploid organisms are possible, in such case, two parameters are also randomly defined from a larger set (e.g. from four chromosomes in case of tetraploids). See implementation details and comments for each of the hormones.
First, initialise all the physical condition components of the agent, starting from age: age=0 initially.
The energy reserves are set as Gaussian with the mean commondata::energy_init and CV commondata::energy_gerror_cv.
Set the birth energy reserves from the initial current value.
Additionally, update the historical maximum energy value.
The body length is initialised as Gaussian with the mean commondata::body_length_init and cv commondata::body_length_gerror_cv.
BODY_LENGTH_MIN
.Also, body length at birth cannot reach the maximum value BODY_LENGTH_MAX
, if it does occurs, erroneous parameter value was set. This aberrant agent then the_genome::individual_genome::dies().
The historical body length at birth is saved as the_body::condition::body_length_birth.
A control unselected trait is also set from the genome. This trait is not used in any calculations but serves as a control for random or nonrandom genetic drift.
The body mass is determined by the genetically determined energy reserves and the body length (using length2mass
function). Thus, the body mass is non-genetic.
The historical body mass at birth and the maximum body mass ever achieved are saved.
SMR is set from the genome.
However, it must never be lower than commondata::smr_min. Very low values are unrealistic and might crash model.
Stomach contents is initialised as a random Gaussian value, average, units of the body mass with STOMACH_CONTENT_INIT
and coefficient of variation STOMACH_CONTENT_INIT_CV
. Stomach contents also must always be above zero and never exceed the maxstomcap
factor.
Finally, the procedure initialises the history stacks for the body mass and length.
And put the initial birth values of body length and mass into the history stack.
Definition at line 354 of file m_body.f90.
subroutine the_body::birth_mortality_enforce_init_fixed_debug | ( | class(condition), intent(inout) | this | ) |
This procedure enforces selective mortality of agents at birth to avoid strong selection for energy and length.
Definition at line 463 of file m_body.f90.
elemental subroutine the_body::condition_clean_history | ( | class(condition), intent(inout) | this | ) |
Cleanup the history stack of the body length and mass.
Definition at line 489 of file m_body.f90.
elemental integer function the_body::condition_age_get | ( | class(condition), intent(in) | this | ) |
Get current age. Standard GET-function.
Definition at line 502 of file m_body.f90.
elemental subroutine the_body::condition_age_reset_zero | ( | class(condition), intent(inout) | this | ) |
Reset the age of the agent to zero.
Definition at line 513 of file m_body.f90.
elemental subroutine the_body::condition_age_increment | ( | class(condition), intent(inout) | this, |
integer, intent(in), optional | increment | ||
) |
Increment the age of the agent by one.
[in] | increment | increment optional increment for increasing the age of the agent, the default value is 1. |
Definition at line 522 of file m_body.f90.
elemental real(srp) function the_body::condition_energy_current_get | ( | class(condition), intent(in) | this | ) |
Get current energy reserves. Standard GET-function.
Definition at line 538 of file m_body.f90.
elemental real(srp) function the_body::condition_energy_maximum_get | ( | class(condition), intent(in) | this | ) |
Get historical maximum of energy reserves. Standard GET-function.
Definition at line 549 of file m_body.f90.
elemental real(srp) function the_body::condition_body_length_get | ( | class(condition), intent(in) | this | ) |
Get current body length. Standard GET-function.
Definition at line 560 of file m_body.f90.
elemental real(srp) function the_body::condition_control_unsel_get | ( | class(condition), intent(in) | this | ) |
Get current value of the control unselected trait. Standard GET-function.
Definition at line 571 of file m_body.f90.
elemental real(srp) function the_body::condition_body_mass_get | ( | class(condition), intent(in) | this | ) |
Get current body mass. Standard GET-function.
Definition at line 582 of file m_body.f90.
real(srp) function the_body::condition_agent_visibility_visual_range | ( | class(condition), intent(in) | this, |
real(srp), intent(in), optional | object_area, | ||
real(srp), intent(in), optional | contrast, | ||
integer, intent(in), optional | time_step_model | ||
) |
Calculate the visibility range of this agent. Visibility depends on the size of the agent, ambient illumination and agent contrast. Visibility is the distance from which this agent can be seen by a visual object (e.g. predator or conspecific). This function is a wrapper to the the_environment::visual_range() function.
visual_range
procedures use meter for units, this auto-converts to cm. [in] | object_area | object_area optional area of this agent, m. If not provided (normally), is obtained from the body length attribute of the agent (the_body::condition::body_length). |
[in] | contrast | contrast is the inherent visual contrast of the agent. the default contrast of all objects is defined by the commondata::preycontrast_default parameter. |
[in] | time_step_model | optional time step of the model, if absent gets the current time step as defined by the value of commondata::global_time_step_model_current . |
Checks. Check optional object area, the default value, if this parameter is absent, the body side area is calculated from the the_body::condition::body_length attribute of the agent with inline conversion to m. Note that the body side area of a fish object is calculated from the body length using the commondata::length2sidearea_fish() function.
Check optional contrast
parameter. If unset, use global commondata::preycontrast_default
.
Check optional time step parameter. If unset, use global commondata::global_time_step_model_current
.
Calculate ambient illumination / irradiance at the depth of this agent at the given time step using the the_environment::spatial::illumination() method.
Return visual range to see this spatial object: its visibility range by calling the the_environment::visual_range() function.
Definition at line 603 of file m_body.f90.
subroutine the_body::condition_body_mass_set_update_hist | ( | class(condition), intent(inout) | this, |
real(srp), intent(in) | value_set, | ||
logical, intent(in), optional | update_history | ||
) |
Set body mass optionally updating the history stack.
[in] | value_set | value_set, Set the new (overwrite) value of the body mass. |
[in] | update_history | update_history is an optional logical flag to update the body mass history stack, the default is not to update. |
If the value_set
is smaller that the minimum body mass parameter BODY_MASS_MIN
, the body mass is set to this minimum value. This avoids getting the body mass too small or negative. This "set"-procedure, however, does not check if the new value is below the structure mass or any other minimum value that leads to the death of the agent. To check for starvation death, the method condition::starved_death()
=> the_body::body_mass_is_starvation_check()
should be explicitly executed.
Update the body mass history stack if the update_history
is explicitly set to TRUE. The default not to update is used because body mass should normally be updated in parallel with the length, if this is not the case, they will be dis-synchronised within the history stack arrays.
Definition at line 672 of file m_body.f90.
subroutine the_body::condition_body_length_set_update_hist | ( | class(condition), intent(inout) | this, |
real(srp), intent(in) | value_set, | ||
logical, intent(in), optional | update_history | ||
) |
Set body length optionally updating the history stack.
[in] | value_set | value_set, Set the new (overwrite) value of the body length. |
[in] | update_history | update_history is an optional logical flag to update the body length history stack, the default is not to update. |
If the value_set
is smaller that the minimum body length parameter BODY_LENGTH_MIN
or the maximum BODY_LENGTH_MAX
, the length is set to this minimum or maximum value respectively. This avoids setting the body length outside of the normal limits. The function commondata::within()
is called to set the new value.
Update the body length history stack if the update_history
is explicitly set to TRUE. The default not to update is used because body length should normally be updated in parallel with the mass, if this is not the case, they will be dis-synchronised within the history stack arrays.
Definition at line 711 of file m_body.f90.
elemental real(srp) function the_body::condition_energy_birth_get | ( | class(condition), intent(in) | this | ) |
Get historical record of energy reserves at birth. Standard GET-function.
Definition at line 742 of file m_body.f90.
elemental real(srp) function the_body::condition_body_length_birth_get | ( | class(condition), intent(in) | this | ) |
Get historical record of body length at birth. Standard GET-function.
Definition at line 753 of file m_body.f90.
elemental real(srp) function the_body::condition_body_mass_birth_get | ( | class(condition), intent(in) | this | ) |
Get historical record of body mass at birth. Standard GET-function.
Definition at line 764 of file m_body.f90.
elemental real(srp) function the_body::condition_body_mass_max_get | ( | class(condition), intent(in) | this | ) |
Get historcal maximum for body mass. Standard GET-function.
Definition at line 775 of file m_body.f90.
elemental real(srp) function the_body::condition_smr_get | ( | class(condition), intent(in) | this | ) |
Get current smr. Standard GET-function.
Definition at line 786 of file m_body.f90.
elemental real(srp) function the_body::condition_stomach_content_get | ( | class(condition), intent(in) | this | ) |
Get current stomach content. Standard GET-function.
Definition at line 797 of file m_body.f90.
elemental real(srp) real(srp) function the_body::body_mass_processing_cost_calc_v | ( | class(condition), intent(in) | this, |
real(srp), intent(in), optional | food_gain, | ||
real(srp), intent(in), optional | distance_food | ||
) |
Calculate the basic processing cost of catching a food item with the mass food_gain
.
There is a small cost of the food item catching, in terms of the food item mass (proportional cost). So, if the agent does an unsuccessful attempt to catch a food item, the cost still applies. So we subtract it before testing if the agent actually got this food item. Also, there is a fixed minimum capture cost (in terms of the agent body mass), so if the food item is very small, the actual gain can be negative (capture cost exceeds the value of the item).
[in] | distance_food | distance_food distance to the food item. |
First, check the optional distance towards the food item. It is used to calculate the energetic cost of swimming towards the food item.
If the distance to the food item is not provided, we assume it is equal to the agent size (so the relative distance = 1 body size).
The cost of the processing of the food item is a sum of two components:
where is the food gain, is a factor proportional to the food item mass, and is a food processing cost factor that is proportional to the agent's SMR.
Definition at line 819 of file m_body.f90.
elemental real(srp) function the_body::condition_cost_swimming_burst | ( | class(condition), intent(in) | this, |
real(srp), intent(in), optional | distance, | ||
real(srp), intent(in), optional | exponent | ||
) |
The cost of swimming of a specific distance in terms of the actor's body mass.
[in] | distance | the optional distance traversed (absolute distance in real units, cm). If distance is not provided, it is calculated from the latest spatial displacement of the agent using the the_environment::spatial_moving::way() function. |
[in] | exponent | an optional cost exponent parameter. Can be 0.5 (commondata::swimming_cost_exponent_laminar, laminar flow) or 0.6 (commondata::swimming_cost_exponent_turbulent, turbulent flow), the default is set to 0.6. |
SWIM_COST_EXP is the default swimming cost body mass exponent parameter for turbulent flow commondata::swimming_cost_exponent_turbulent = 0.6. For laminar flow, equal to commondata::swimming_cost_exponent_laminar = 0.5. See doi:10.1242/jeb.01484 (https://dx.doi.org/10.1242/jeb.01484).
The cost of swimming (for turbulent flow) is calculated as:
where is the body mass, is a parameter factor defined as commondata::swimming_speed_cost_burst
, is the distance in units of the agent's body length. For laminar flow, the exponent should be 0.5.
exponent
. Definition at line 879 of file m_body.f90.
elemental real(srp) function the_body::body_mass_processing_cost_calc_o | ( | class(condition), intent(in) | this, |
class(food_item), intent(in) | food_obj, | ||
real(srp), intent(in), optional | distance_food | ||
) |
Calculate the basic processing cost of catching a food item with the mass food_gain
.
[in] | food_obj | food item object, of class FOOD_ITEM . |
[in] | distance_food | distance to the food item. |
First, check the optional distance towards the food item. We use it to calculate the energetic cost of swimming towards the food item.
If the distance to the food item is not provided, we assume it is equal to the agent body size (so the relative distance = 1 body size).
The cost of the processing of the food item is a sum of two components:
where is the food gain, is a factor proportional to the food item mass, and is a food processing cost factor that is proportional to the agent's SMR.
Definition at line 934 of file m_body.f90.
elemental real(srp) function the_body::stomach_content_food_gain_fitting_v | ( | class(condition), intent(in) | this, |
real(srp), intent(in), optional | food_gain, | ||
real(srp), intent(in), optional | food_dist | ||
) |
Calculate the value of possible food gain as fitting into the agent's stomach, or the full gain if the food item wholly fits in.
[in] | food_gain | food gain. |
[in] | food_dist | distance to food. |
Check optional food_gain
parameter, set default values. If food gain is not provided, an average/default food item is assumed, defined by FOOD_ITEM_SIZE_DEFAULT
.
Definition at line 988 of file m_body.f90.
elemental real(srp) function the_body::stomach_content_food_gain_fitting_o | ( | class(condition), intent(in) | this, |
class(food_item), intent(in) | food_obj, | ||
real(srp), intent(in), optional | food_dist | ||
) |
Calculate the value of possible food gain as fitting into the agent's stomach (or full gain if the food item fits wholly).
food_process_cost
call. This code is not using the food_fitt_v
scalar-based function above: `if (present(food_dist)) then food_adjusted = food_objget_mass() - thisfood_surplus(food_obj) - & thisfood_process_cost(food_obj, food_dist) else food_adjusted = food_objget_mass() - thisfood_surplus(food_obj) - & thisfood_process_cost(food_obj) end if`
This code uses the food_fitt_v
scalar-based function above to avoid code duplication.
Definition at line 1024 of file m_body.f90.
elemental real(srp) function the_body::stomach_content_food_gain_non_fit_v | ( | class(condition), intent(in) | this, |
real(srp), intent(in), optional | food_gain | ||
) |
Calculate extra food surplus mass non fitting into the stomach of the agent.
Maximum stomach capacity is determined by the factor maxstomcap
in proportion of the body mass. The stomach content cannot surpass maxstomcap
=15% of agent's body mass.
Check optional parameter, set default values.
Get the possible food surplus, the part of the food gain that does not fit into the agent's stomach. If happily fits, takes zero.
Definition at line 1056 of file m_body.f90.
elemental real(srp) function the_body::stomach_content_food_gain_non_fit_o | ( | class(condition), intent(in) | this, |
class(food_item), intent(in) | food_obj | ||
) |
Calculate extra food surplus mass non fitting into the stomach of the agent.
Maximum stomach capacity is determined by the factor maxstomcap
in proportion of the body mass. The stomach content cannot surpass maxstomcap
=15% of agent's body mass.
Get the possible food surplus, the part of the food gain that does not fit into the agent's stomach. If happily fits, takes zero.
Definition at line 1089 of file m_body.f90.
elemental real(srp) function the_body::body_mass_calculate_cost_living_step | ( | class(condition), intent(in) | this | ) |
Calculate the cost of living for a single model step. So the agent mass increment per a single model step should subtract this cost.
The energetic costs is a fraction of body weight and scales to number of time steps :
(eq. 1)
Definition at line 1126 of file m_body.f90.
elemental subroutine the_body::body_mass_adjust_living_cost_step | ( | class(condition), intent(inout) | this | ) |
Adjust the body mass at the end of the model step against the cost of living. We do not adjust the cost of living at each food gain as several food items can be consumed by the agent at a single time step of the model. Cost of living is now calculated at the end of the time step of the model.
Definition at line 1149 of file m_body.f90.
elemental subroutine the_body::body_mass_grow_do_calculate | ( | class(condition), intent(inout) | this, |
real(srp), intent(in) | food_gain, | ||
logical, intent(in), optional | update_history | ||
) |
Do grow body mass based on food gain from a single food item adjusted for cost etc.
[in] | update_history | update_history optional logical flag to enable saving the body mass value to the body mass history stack. |
Add the food increment to the current body mass.
And also update the historical maximum value, if the current exceeds.
Add the current updated body mass to the history stack.
Definition at line 1161 of file m_body.f90.
elemental real(srp) function the_body::body_mass_food_processing_cost_factor_smr | ( | class(condition), intent(in) | this, |
real(srp), intent(in) | food_gain | ||
) |
The fraction of the cost of the processing of the food item(s) depending on the agent SMR. It is scaled in terms of the ratio of the food item mass to the agent mass.
Definition at line 1190 of file m_body.f90.
elemental subroutine the_body::stomach_content_get_increment | ( | class(condition), intent(inout) | this, |
real(srp), intent(in) | stomach_increment | ||
) |
Do increment stomach contents with adjusted (fitted) value.
stomach_increment
should be adjusted for fitting size. This is the actual increment. Stomach content mass is incremented by the stomach_increment
value.
Definition at line 1205 of file m_body.f90.
real(srp) function the_body::body_len_grow_calculate_increment_step | ( | class(condition), intent(in) | this, |
real(srp), intent(in) | mass_increment | ||
) |
Calculate body length increment for a time step of the model.
This function describes linear growth of the agent resulting from food intake. Linear growth increment scales with growth hormone level. The increment in length is weighted by the growth hormone factor that is obtained via interpolation. So, if the agent's growth hormone level is very low, the growth increment factor is near-zero, if growth hormone level is high, the growth increment approaches the maximum value that is proportional to the body mass increment in units of the agent's body mass (growth hormone weighting factor approaches 1.0).
increment_factor_ipoint
is a local parameter showing the linear growth increment factor interpolation point, in the formula below.
If the body mass increment is positive and exceeds fixed threshold MASS_GROWTH_THRESHOLD
, the agent can grow body length. Otherwise, if the mass threshold is not exceeded in MASS_THRESHOLD, the agent does not increase in length. This check is done in the main named if condition block MASS_THRESHOLD
.
increment_factor_ipoint
( ) depending on the agent's current growth hormone level. The function linking growth hormone level and the linear growth increment factor ( ) is represented by this relationship: LINTERPOL
engine is used here instead of non-linear DDPINTERPOL
. This is done because of not well predictable raw values in the grid abscissa; DDPINTERPOL
tends to produce sigmoidal waves here and needs precise tuning of the interpolation grid parameter arraysLINEAR_GROWTH_HORMONE_INCREMENT_FACTOR_CURVE_ABSCISSA
LINEAR_GROWTH_HORMONE_INCREMENT_FACTOR_CURVE_ORDINATE
.where is the body length increment, is the body length, is the growth-hormone-dependent linear growth increment factor, is the body mass increment in units of body mass. So the relative body length increment is proportional to the relative body mass increment.
Definition at line 1229 of file m_body.f90.
subroutine the_body::body_len_grow_do_calculate_step | ( | class(condition), intent(inout) | this, |
real(srp), intent(in) | mass_increment, | ||
logical, intent(in), optional | update_history | ||
) |
Do linear growth for one model step based on the increment function the_body::condition::len_incr().
[in] | update_history | update_history optional logical flag to enable saving the body mass value to the body mass history stack. |
Body length is incremented by a value of the the_body::condition::len_incr() function.
Also, the current updated body length is added to the history stack.
Definition at line 1320 of file m_body.f90.
subroutine the_body::sex_steroids_update_increment | ( | class(condition), intent(inout) | this | ) |
Update the level of the sex steroids.
Sex steroids are incremented each model time step. Testosteron is incremented in males and estrogen, in females. However, such an increment occurs only if there has recently been any body length growth (which occurs only if the food gain exceeds a specific threshold value). The growth increment is calculated as the difference between the current body length and the maximum body length in n
latest historical entries from the length history stack. The n
value is set by the parameter commondata::sex_steroids_check_history.
First, the sex steroid increment factor is calculated using a nonparametric relationship. Calculations can be based either on its link with the age or the body length:
These are the two alternative procedures implemented here.
Next, calculate the past increments of the body length across the body length history stack. If there has been any increment in the body length during the commondata::sex_steroids_check_history latest steps in the history stack and the current length, sex steroids are incremented. If such an increment is zero, sex steroids are not incremented. The length increment over the latest history is calculated as follows:
Finally, do increment the sex steroids depending on the body length (length_increment
) value. Sex steroids get non-zero increment only if there has been some growth of the body length (length_increment>0.0
). Otherwise a previous value is retained.
If there was no growth and the gonadal steroids are not incremented, the current values are still saved in the history stack by calling the_hormones::hormones::hormones_to_history().
Definition at line 1354 of file m_body.f90.
elemental logical function the_body::body_mass_is_starvation_check | ( | class(condition), intent(in) | this | ) |
Check if the body mass is smaller than the birth body mass or structural body mass. An agent dies of starvation if either of these conditions is met:
The the_body::is_starved()
backend function (non-OO) is called to check the starvation condition.
Definition at line 1538 of file m_body.f90.
elemental logical function the_body::is_starved | ( | real(srp), intent(in) | body_mass, |
real(srp), intent(in) | stomach_content_mass, | ||
real(srp), intent(in) | body_mass_birth, | ||
real(srp), intent(in) | body_mass_maximum, | ||
real(srp), intent(in) | energy_current, | ||
real(srp), intent(in) | energy_maximum | ||
) |
This is the backend logical function that checks if the agent is starved. It is called by the condition::starved_death()
=> the_body::body_mass_is_starvation_check()
procedure.
[in] | body_mass | body_mass the current body mass of the agent. |
[in] | stomach_content_mass | stomach_content_mass the mass of the stomach content of the agent. |
[in] | body_mass_birth | body_mass_birth body mass of the agent at birth. |
[in] | body_mass_maximum | body_mass_maximum the historical maximum body mass of the agent. |
[in] | energy_current | energy_current the current level of energy. |
[in] | energy_maximum | energy_maximum the historical maximum level of energy. |
An agent is considered starving to death if either of these conditions is met:
Definition at line 1561 of file m_body.f90.
elemental subroutine the_body::stomach_content_mass_emptify_step | ( | class(condition), intent(inout) | this | ) |
Digestion. Stomach contents S(t) is emptied by a constant fraction each time step.
where is the stomach content emptify factor parameter (commondata::stomach_content_emptify_factor
) and is the lifespan (commondata::lifespan
parameter). The calculation calls the backend function for : the_body::stomach_emptify_backend()
.
Definition at line 1615 of file m_body.f90.
elemental real(srp) function the_body::stomach_emptify_backend | ( | real(srp), intent(in) | stomach_content_mass | ) |
The backend engine for calculating the stomach content mass decrement as a consequence of digestion. Stomach contents S(t) is emptied by a constant fraction each time step :
where is the stomach content emptify factor parameter (commondata::stomach_content_emptify_factor
) and is the lifespan (commondata::lifespan
parameter).
[in] | stomach_content_mass | stomach_content_mass Current mass of the stomach contents. |
Definition at line 1633 of file m_body.f90.
elemental subroutine the_body::condition_energy_update_after_growth | ( | class(condition), intent(inout) | this | ) |
Update the energy reserves of the agent based on its current mass and length. This subroutine should be called after any event that can change the mass or/and length of the agent, e.g. food consumption.
Update the energy reserves. This is done by calling the standard function energy_reserve()
And also update the historical maximum value, if the current energy reserves value exceeds the maximum.
Definition at line 1649 of file m_body.f90.
elemental real(srp) function the_body::cost_swimming_standard | ( | class(condition), intent(in) | this, |
integer, intent(in), optional | steps | ||
) |
The standard cost of swimming is a diagnostic function that shows the cost, in units of the body mass, incurred if the agent passes a distance equal to commondata::lifespan units of its body length.
[in] | steps | steps is the optional number of steps of the agent length the agent walks. Default value is commondata::lifespan (i.e. the whole lifespan). |
Definition at line 1667 of file m_body.f90.
elemental real(srp) function the_body::reproduction_cost_energy_fix | ( | class(reproduction), intent(in) | this | ) |
Calculate the energetic cost of reproduction in terms of the body mass of the this agent. The energetic cost of reproduction is obtained as a specific fixed fraction of the current body mass of the agent defined by the commondata::reproduction_cost_body_mass
parameter.
Definition at line 1703 of file m_body.f90.
real(srp) function the_body::reproduction_cost_energy_dynamic | ( | class(reproduction), intent(in) | this | ) |
Calculate the energetic cost of reproduction in terms of the body mass of the this agent. The energetic cost of reproduction is different in males and females.
First, calculate the overall mass of the offspring that are produced as a result of this reproduction event . This is done using the procedure reproduction::offspring_mass
(=> the_body::reproduction_mass_offspring_calc
). The total mass of the offspring serves as a baseline for calculating the overall cost of reproduction.
Second, calculate the cost of reproduction as a sum of two components:
There are two versions of this function implemented:
cost_full()
where the cost component that scales with the agent's body mass is calculated from the full agent's mass not subtracting the total mass of the offspring:
cost_residual()
where the cost component that scales with the agent's body mass is calculated from the agent's residual body mass after subtracting the total mass of the offspring:
where and are the scaling factors that are set by the following sex-specific parameter values: Scaling factor of the offspring mass component :
commondata::reproduction_cost_offspring_fract_male
;commondata::reproduction_cost_offspring_fract_female
.Scaling factor of the agent's body mass component :
commondata::reproduction_cost_body_mass_factor_male
;commondata::reproduction_cost_body_mass_factor_female
.This allows setting the cost of reproduction in a sex-specific way. For males, for example, the component proportional to the total offspring mass is set to some small value ( , whereas in females, who carry the eggs, this cost is at least equal to the full offspring mass ( ). On the other hand, the cost component that is proportional to the agent body mass can be higher in males that in females due to competition for mates ( ). Various patterns can be implemented by varying the sex-specific scaling parameters and the two versions of the backend procedure (cost_full()
, cost_residual()
).
Definition at line 1716 of file m_body.f90.
real(srp) function the_body::reproduction_cost_unsuccessful_calc | ( | class(reproduction), intent(in) | this, |
real(srp), intent(in), optional | cost_factor | ||
) |
Calculate the costs of unsuccessful reproduction. This is calculated as a fraction of the normal cost of reproduction returned by the function reproduction::reproduction_cost()
. Reproduction can be unsuccessful for various reasons: insufficient reserves (reproduction results in starvation death) or stochastic no success.
[in] | cost_factor | cost_factor Optional cost factor multiplier the normal cost of reproduction is applied to. If absent, the default value set by the commondata::reproduction_cost_unsuccess parameter is used. |
Unsuccessful reproduction attempt results in a cost, in terms of the body mass, that is a fraction of the normal cost of reproduction: the fraction is defined by the parameter commondata::reproduction_cost_unsuccess
in COMMONDATA
. The body mass of the agent is then reduced to take this fraction of the full cost of reproduction. This updated value is saved into the body mass history stack (update_history
parameter is TRUE
).
Definition at line 1877 of file m_body.f90.
elemental subroutine the_body::reproduction_init_zero | ( | class(reproduction), intent(inout) | this | ) |
Initialise the reproduction object for the agent. Everything is set to zero.
Set the total number of reproductions and offspring to zero.
Definition at line 1907 of file m_body.f90.
elemental integer function the_body::reproduction_n_reproductions_get | ( | class(reproduction), intent(in) | this | ) |
Get the number of reproductions for this agent.
Definition at line 1918 of file m_body.f90.
elemental subroutine the_body::reproduction_n_reproductions_set | ( | class(reproduction), intent(inout) | this, |
integer, intent(in) | n_repr | ||
) |
Set the number of reproductions for the agent.
[in] | n_repr | n_repr The total number of reproductions for this agent. |
Definition at line 1929 of file m_body.f90.
elemental integer function the_body::reproduction_n_offspring_get | ( | class(reproduction), intent(in) | this | ) |
Get the number of offspring.
Definition at line 1940 of file m_body.f90.
elemental subroutine the_body::reproduction_n_offspring_set | ( | class(reproduction), intent(inout) | this, |
integer, intent(in) | n_offspr | ||
) |
Set the number of offspring for the agent.
[in] | n_offspr | n_offspr The number of offspring to set for this agent. |
Definition at line 1951 of file m_body.f90.
subroutine the_body::reproduction_n_increment | ( | class(reproduction), intent(inout) | this, |
integer, intent(in), optional | add_repr, | ||
real(srp), intent(in), optional | average_mass_offspring | ||
) |
Increment the number of reproductions and offspring for this agent.
[in] | add_repr | add_repr Increment the total number of reproductions for this agent by this number; if not provided as a dummy parameter assume increment by one. Note: Varying the number of reproductions allows implementation of multiple fertilisations by a male, resulting in add_repr >1 during a single reproduction event, provided several females are present in the male's perception object. This allows modelling sexual asymmetries. |
[in] | average_mass_offspring | average_mass_offspring optional average body mass of the ` offspring. If not provided, back calculated from the Fulton's condition factor and the body length of the agents at init (birth) using the the_body::length2mass() function. |
First, check if the add_repr
increment parameter is provided. If not, set it to the default value = 1.
Second, increment the number of reproductions for this agent (data component, reproduction::n_reproductions
) by the increment parameter.
Third, calculate the number of the offspring that result from this/these reproduction occurrence(s) and increment the lifetime number reproduction::n_offspring
for the agent respectively. The number of offspring is calculated using the function reproduction::offspring_number()
(the_body::reproduction_n_offspring_calc()
). The average mass of the offspring (average_mass_offspring
), if provided, transfers into the above backend function.
Definition at line 1962 of file m_body.f90.
integer function the_body::reproduction_n_offspring_calc | ( | class(reproduction), intent(inout) | this, |
real(srp), intent(in), optional | average_mass_offspr | ||
) |
Calculate the number of offspring per a single reproduction as a function of the agent's body mass.
[in] | average_mass_offspr | average_mass_offspr Optional average body mass of the offspring ( , see below). |
Initially check if the average mass of newborn agents is provided as a dummy parameter to this function call. If not, calculate a guess of the average mass from the Fulton's condition factor and the body length parameters of the agents at init (birth) using the the_body::length2mass()
function.
The number of offspring produced at a single reproduction scales with the body mass of the agent. First, all the offspring comprise the maximum combined fraction of the agent's body mass , this fraction is obtained by a nonparametric relationship defined by the the interpolation grid:
The total mass of the offspring ( ) is calculated in the procedure reproduction::offspring_mass()
(=> the_body::reproduction_mass_offspring_calc()
).
Second, the number of the offspring with the overall mass is calculated as the fraction:
where is the average mass of a single offspring at init (birth). The floor
Fortran intrinsic function is used to calculate the integer value from this ratio. This guarantees that the number of offspring returned is the lowest integer value resulting from the above ratio.
Definition at line 2017 of file m_body.f90.
elemental logical function the_body::reproduction_ready_steroid_hormones_exceed | ( | class(reproduction), intent(in) | this | ) |
Determine if the agent's hormonal system is ready for reproduction.
Determine if the agent's hormonal system is ready for reproduction, that is, its current level of sex steroids exceeds the baseline (initially determined by the genome) by a factor determined by the parameter commondata::sex_steroids_reproduction_threshold:
If the level of sex steroids is insufficient, reproduction is impossible and FALSE is returned.
Definition at line 2073 of file m_body.f90.
real(srp) function the_body::reproduction_mass_offspring_calc | ( | class(reproduction), intent(in) | this | ) |
Calculate the total mass of all offspring produced by this agent during a single reproduction event.
The total mass of all offspring produced at a single reproduction scales with the body mass of the agent and is obtained by a non-parametric relationship involving non-linear interpolation. The combined offspring mass is calculated as a fraction of the agent's body mass using this equation:
where is the fraction coefficient obtained by a nonparametric relationship defined by the the interpolation grid
Interpolation plots can be saved in the debug mode using this plotting command: commondata::debug_interpolate_plot_save()
.
Definition at line 2106 of file m_body.f90.
|
private |
Definition at line 26 of file m_body.f90.