The AHA Model  Revision: 12809
Reference implementation 04 (HEDG02_04)
m_body.f90 File Reference

The Body condition and architecture of the AHA Model. More...

Go to the source code of this file.

Data Types

type  the_body::condition
 CONDITION defines the physical condition of the agent More...
 
type  the_body::reproduction
 REPRODUCTION type defines parameters of the reproduction system. More...
 

Modules

module  the_body
 Definition the physical properties and condition of the agent.
 

Functions/Subroutines

elemental real(srp) function the_body::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 the_body::energy_reserve (m, l)
 Calculate the current energy reserves (Fulton condition factor) from body mass and length. More...
 
subroutine the_body::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 the_body::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 the_body::condition_clean_history (this)
 Cleanup the history stack of the body length and mass. More...
 
elemental integer function the_body::condition_age_get (this)
 Get current age. Standard GET-function. More...
 
elemental subroutine the_body::condition_age_reset_zero (this)
 Reset the age of the agent to zero. More...
 
elemental subroutine the_body::condition_age_increment (this, increment)
 Increment the age of the agent by one. More...
 
elemental real(srp) function the_body::condition_energy_current_get (this)
 Get current energy reserves. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_energy_maximum_get (this)
 Get historical maximum of energy reserves. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_body_length_get (this)
 Get current body length. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_control_unsel_get (this)
 Get current value of the control unselected trait. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_body_mass_get (this)
 Get current body mass. Standard GET-function. More...
 
real(srp) function the_body::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 the_body::condition_body_mass_set_update_hist (this, value_set, update_history)
 Set body mass optionally updating the history stack. More...
 
subroutine the_body::condition_body_length_set_update_hist (this, value_set, update_history)
 Set body length optionally updating the history stack. More...
 
elemental real(srp) function the_body::condition_energy_birth_get (this)
 Get historical record of energy reserves at birth. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_body_length_birth_get (this)
 Get historical record of body length at birth. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_body_mass_birth_get (this)
 Get historical record of body mass at birth. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_body_mass_max_get (this)
 Get historcal maximum for body mass. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_smr_get (this)
 Get current smr. Standard GET-function. More...
 
elemental real(srp) function the_body::condition_stomach_content_get (this)
 Get current stomach content. Standard GET-function. More...
 
elemental real(srp) real(srp) function the_body::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 the_body::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 the_body::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 the_body::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 the_body::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 the_body::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 the_body::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 the_body::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 the_body::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 the_body::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 the_body::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 the_body::stomach_content_get_increment (this, stomach_increment)
 Do increment stomach contents with adjusted (fitted) value. More...
 
real(srp) function the_body::body_len_grow_calculate_increment_step (this, mass_increment)
 Calculate body length increment for a time step of the model. More...
 
subroutine the_body::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 the_body::sex_steroids_update_increment (this)
 Update the level of the sex steroids. More...
 
real(srp) function steroid_factor_age ()
 Function calculating the value of the sex steroid increment factor that depends on the agent's age. Calculate the steroid increment factor. It is set as a nonparametric relationship that is set by a linear interpolation LINTERPOL (or DDPINTERPOL) of a parameter grid values. The increment of the sex steroid hormones depends on the age of the agent: it is very slight at the early stage of the ontogeny, i.e. small age, but increase to the end of the agent's lifespan. More...
 
real(srp) function steroid_factor_len ()
 Function calculating the value of the sex steroid increment factor that depends on the agent's body length. Calculate the steroid increment factor. It is set as a nonparametric relationship that is set by a linear interpolation LINTERPOL (or DDPINTERPOL) of a parameter grid values. The increment of the sex steroid hormones depends on the length of the agent: it is very slight in small agents, e.g. at the early stage of the ontogeny, but increases in larger agents up to BODY_LENGTH_MAX. More...
 
elemental logical function the_body::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 the_body::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 the_body::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 the_body::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 $ \Delta S $: More...
 
elemental subroutine the_body::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 the_body::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 the_body::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 the_body::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...
 
pure real(srp) function cost_full (offspring_mass_fact, agent_mass_fact)
 Backend function that is called in the_body::reproduction_cost_energy_dynamic(). Calculate the cost of reproduction as a sum of two components: (a) component that scales with the total mass of the offspring $ \mu $; (b) component that scales with the body mass of the agent $ M $. More...
 
pure real(srp) function cost_residual (offspring_mass_fact, agent_mass_fact)
 Backend function that is called in the_body::reproduction_cost_energy_dynamic(). Calculate the cost of reproduction as a sum of two components: (a) component that scales with the total mass of the offspring $ \mu $; (b) component that scales with the body mass of the agent $ M $. More...
 
real(srp) function the_body::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 the_body::reproduction_init_zero (this)
 Initialise the reproduction object for the agent. Everything is set to zero. More...
 
elemental integer function the_body::reproduction_n_reproductions_get (this)
 Get the number of reproductions for this agent. More...
 
elemental subroutine the_body::reproduction_n_reproductions_set (this, n_repr)
 Set the number of reproductions for the agent. More...
 
elemental integer function the_body::reproduction_n_offspring_get (this)
 Get the number of offspring. More...
 
elemental subroutine the_body::reproduction_n_offspring_set (this, n_offspr)
 Set the number of offspring for the agent. More...
 
subroutine the_body::reproduction_n_increment (this, add_repr, average_mass_offspring)
 Increment the number of reproductions and offspring for this agent. More...
 
integer function the_body::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 the_body::reproduction_ready_steroid_hormones_exceed (this)
 Determine if the agent's hormonal system is ready for reproduction. More...
 
real(srp) function the_body::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 the_body::modname = "(THE_CONDITION)"
 

Detailed Description

The Body condition and architecture of the AHA Model.

Author
Sergey Budaev serge.nosp@m.y.bu.nosp@m.daev@.nosp@m.uib..nosp@m.no
Jarl Giske jarl..nosp@m.gisk.nosp@m.e@uib.nosp@m..no
Date
2016-2017

Definition in file m_body.f90.

Function/Subroutine Documentation

◆ steroid_factor_age()

real(srp) function sex_steroids_update_increment::steroid_factor_age

Function calculating the value of the sex steroid increment factor that depends on the agent's age. Calculate the steroid increment factor. It is set as a nonparametric relationship that is set by a linear interpolation LINTERPOL (or DDPINTERPOL) of a parameter grid values. The increment of the sex steroid hormones depends on the age of the agent: it is very slight at the early stage of the ontogeny, i.e. small age, but increase to the end of the agent's lifespan.

Calculate the steroid increment factor. It is set as a nonparametric relationship that is set by a linear interpolation LINTERPOL (or DDPINTERPOL) of a parameter grid values. The increment of the sex steroid hormones depends on the age of the agent: it is very slight at the early stage of the ontogeny, i.e. small age, but increase to the end of the agent's lifespan.

Interpolation plots can be saved in the debug mode using this plotting command: commondata::debug_interpolate_plot_save().

Warning
Involves huge number of plots, should normally be disabled.

Definition at line 1450 of file m_body.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ steroid_factor_len()

real(srp) function sex_steroids_update_increment::steroid_factor_len

Function calculating the value of the sex steroid increment factor that depends on the agent's body length. Calculate the steroid increment factor. It is set as a nonparametric relationship that is set by a linear interpolation LINTERPOL (or DDPINTERPOL) of a parameter grid values. The increment of the sex steroid hormones depends on the length of the agent: it is very slight in small agents, e.g. at the early stage of the ontogeny, but increases in larger agents up to BODY_LENGTH_MAX.

Calculate the steroid increment factor. It is set as a nonparametric relationship that is set by a linear interpolation LINTERPOL (or DDPINTERPOL) of a parameter grid values. The increment of the sex steroid hormones depends on the length of the agent: it is very slight in small agents, e.g. at the early stage of the ontogeny, but increases in larger agents up to BODY_LENGTH_MAX.

Interpolation plots can be saved in the debug mode using this plotting command: commondata::debug_interpolate_plot_save().

Warning
Involves huge number of plots, should normally be disabled.

Definition at line 1490 of file m_body.f90.

Here is the call graph for this function:

◆ cost_full()

pure real(srp) function reproduction_cost_energy_dynamic::cost_full ( real(srp), intent(in)  offspring_mass_fact,
real(srp), intent(in)  agent_mass_fact 
)

Backend function that is called in the_body::reproduction_cost_energy_dynamic(). Calculate the cost of reproduction as a sum of two components: (a) component that scales with the total mass of the offspring $ \mu $; (b) component that scales with the body mass of the agent $ M $.

\[ C = \mu \cdot \phi + M \cdot \varphi , \]

where $ \phi $ and $ \varphi $ are the scaling factors that are set by the following sex-specific parameter values: Scaling factor of the offspring mass component $ \phi $:

Scaling factor of the agent's body mass component $ \varphi $:

Note
In this version, the cost component that scales with the agent's body mass is calculated from the agent's mass not subtracting the total mass of the offspring: $ M \cdot \varphi $.
Parameters
[in]offspring_mass_factoffspring_mass_fact scaling factor of the offspring mass component $ \phi $:
[in]agent_mass_factagent_mass_fact scaling factor of the agent's body mass component $ \varphi $:
Returns
The cost of reproduction.

Definition at line 1801 of file m_body.f90.

Here is the caller graph for this function:

◆ cost_residual()

pure real(srp) function reproduction_cost_energy_dynamic::cost_residual ( real(srp), intent(in)  offspring_mass_fact,
real(srp), intent(in)  agent_mass_fact 
)

Backend function that is called in the_body::reproduction_cost_energy_dynamic(). Calculate the cost of reproduction as a sum of two components: (a) component that scales with the total mass of the offspring $ \mu $; (b) component that scales with the body mass of the agent $ M $.

\[ C = \mu \cdot \phi + (M - \mu \cdot \phi ) \cdot \varphi , \]

where $ \phi $ and $ \varphi $ are the scaling factors that are set by the following sex-specific parameter values: Scaling factor of the offspring mass component $ \phi $:

Scaling factor of the agent's body mass component $ \varphi $:

Note
In this version, the cost component that scales with the agent's residual body mass is calculated from the agent's mass after subtracting the total mass of the offspring: $ (M - \mu \cdot \phi ) \cdot \varphi $.
Parameters
[in]offspring_mass_factoffspring_mass_fact scaling factor of the offspring mass component $ \phi $:
[in]agent_mass_factagent_mass_fact scaling factor of the agent's body mass component $ \varphi $:
Returns
The cost of reproduction.

Definition at line 1845 of file m_body.f90.