The AHA Model  Revision: 12809
Reference implementation 04 (HEDG02_04)
the_body Module Reference

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 $ \Delta S $: 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)"
 

Detailed Description

Definition the physical properties and condition of the agent.

THE_BODY module

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.

Note
Note that the agent has the size property but is nonetheless represented as a single commondata::spatial point for simplicity.

Function/Subroutine Documentation

◆ length2mass()

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

Parameters
[in]k,lcondition and body length.
Returns
Body mass.

Implementation details

Body mass is non-genetic, length and initial condition factor are genetically determined. Body mass is calculated initially from the Fulton'scondition factor formula

\[ K=\frac{M}{L^{3}} , \]

i.e.

\[ M=K L^{3} . \]

The exponent can be non-cube for non-isometric growth.

Note
The "cube law" exponent (3.0 normally), might be redefined here as the LINEAR_GROWTH_EXPONENT parameter constant.

Definition at line 308 of file m_body.f90.

Here is the caller graph for this function:

◆ energy_reserve()

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.

Parameters
[in]m,lbody mass and body length.
Returns
energy reserve available.
Note
The "cube law" exponent (3.0 normally), might be redefined here as the LINEAR_GROWTH_EXPONENT parameter constant.

Definition at line 331 of file m_body.f90.

Here is the caller graph for this function:

◆ condition_init_genotype()

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.

Implementation details

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.

Note
Body length cannot be zero or less than the minimum possible size that is defined by 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.

Note
The body length and mass history stack keeps the latest historical values.

Definition at line 354 of file m_body.f90.

Here is the call graph for this function:

◆ birth_mortality_enforce_init_fixed_debug()

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.

Warning
This is a debug version of the mortality procedure with fixed mortality pattern, final should depend on the statistical properties of the first generation, mean and sd.

Definition at line 463 of file m_body.f90.

◆ condition_clean_history()

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.

◆ condition_age_get()

elemental integer function the_body::condition_age_get ( class(condition), intent(in)  this)

Get current age. Standard GET-function.

Returns
Return the agent's age

Definition at line 502 of file m_body.f90.

◆ condition_age_reset_zero()

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.

◆ condition_age_increment()

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.

Parameters
[in]incrementincrement optional increment for increasing the age of the agent, the default value is 1.

Definition at line 522 of file m_body.f90.

◆ condition_energy_current_get()

elemental real(srp) function the_body::condition_energy_current_get ( class(condition), intent(in)  this)

Get current energy reserves. Standard GET-function.

Returns
Return the agent's energy reserves.

Definition at line 538 of file m_body.f90.

◆ condition_energy_maximum_get()

elemental real(srp) function the_body::condition_energy_maximum_get ( class(condition), intent(in)  this)

Get historical maximum of energy reserves. Standard GET-function.

Returns
Return the agent's maximum energy reserves.

Definition at line 549 of file m_body.f90.

◆ condition_body_length_get()

elemental real(srp) function the_body::condition_body_length_get ( class(condition), intent(in)  this)

Get current body length. Standard GET-function.

Returns
Return the agent's body length.

Definition at line 560 of file m_body.f90.

◆ condition_control_unsel_get()

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.

Returns
Return the agent's control unselected trait value.

Definition at line 571 of file m_body.f90.

◆ condition_body_mass_get()

elemental real(srp) function the_body::condition_body_mass_get ( class(condition), intent(in)  this)

Get current body mass. Standard GET-function.

Returns
Return the agent's body mass.

Definition at line 582 of file m_body.f90.

◆ condition_agent_visibility_visual_range()

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.

Warning
The visual_range procedures use meter for units, this auto-converts to cm.
Cannot implement a generic function accepting also vectors of this objects as only elemental object-bound array functions are allowed by the standard. This function cannot be elemental, so passed-object dummy argument must always be scalar.
Parameters
[in]object_areaobject_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]contrastcontrast 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_modeloptional time step of the model, if absent gets the current time step as defined by the value of commondata::global_time_step_model_current.
Returns
The maximum distance from which this agent can be seen.

Implementation details

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.

Here is the call graph for this function:

◆ condition_body_mass_set_update_hist()

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.

Parameters
[in]value_setvalue_set, Set the new (overwrite) value of the body mass.
[in]update_historyupdate_history is an optional logical flag to update the body mass history stack, the default is not to update.

Implementation details

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.

◆ condition_body_length_set_update_hist()

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.

Parameters
[in]value_setvalue_set, Set the new (overwrite) value of the body length.
[in]update_historyupdate_history is an optional logical flag to update the body length history stack, the default is not to update.

Implementation details

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.

◆ condition_energy_birth_get()

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.

Returns
Return the agent's body length at birth.

Definition at line 742 of file m_body.f90.

◆ condition_body_length_birth_get()

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.

Returns
Return the agent's body length at birth.

Definition at line 753 of file m_body.f90.

◆ condition_body_mass_birth_get()

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.

Returns
Return the agent's body mass at birth.

Definition at line 764 of file m_body.f90.

◆ condition_body_mass_max_get()

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.

Returns
Return the agent's maximum body mass.

Definition at line 775 of file m_body.f90.

◆ condition_smr_get()

elemental real(srp) function the_body::condition_smr_get ( class(condition), intent(in)  this)

Get current smr. Standard GET-function.

Returns
Return the agent's SMR.

Definition at line 786 of file m_body.f90.

◆ condition_stomach_content_get()

elemental real(srp) function the_body::condition_stomach_content_get ( class(condition), intent(in)  this)

Get current stomach content. Standard GET-function.

Returns
Return the agent's stomach content.

Definition at line 797 of file m_body.f90.

◆ body_mass_processing_cost_calc_v()

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

Note
Note that this version accepts the the raw food mass (real value).
Parameters
[in]distance_fooddistance_food distance to the food item.

Implementation details

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:

  1. some small processing cost depending on the food item mass and
  2. the cost of swimming towards the food item depending on the relative distance (distance in terms of the agent body length.

\[ C_{p} = max(\mu \cdot \beta_{fp}, \mu \cdot C_{smr}) + C_{s} , \]

where $ \mu $ is the food gain, $ \beta_{fp} $ is a factor proportional to the food item mass, and $ C_{smr} $ is a food processing cost factor that is proportional to the agent's SMR.

Definition at line 819 of file m_body.f90.

◆ condition_cost_swimming_burst()

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.

Note
Note that power needed to swim is proportional to the body mass with the exponent 0.6 assuming turbulent flow (see doi:10.1242/jeb.01484).
Parameters
[in]distancethe 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]exponentan 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.
Returns
The cost of swimming in terms of the body mass lost.

Notable parameters

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

Implementation details

The cost of swimming (for turbulent flow) is calculated as:

\[ C_{s} = M^{0.6} \cdot \beta \cdot d / L , \]

where $ M $ is the body mass, $ \beta $ is a parameter factor defined as commondata::swimming_speed_cost_burst, $ d / L $ is the distance in units of the agent's body length. For laminar flow, the exponent should be 0.5.

Note
An arbitrary value for the exponent can be provided as the second dummy parameter to this function exponent.
The function the_body::cost_swimming_standard() calculates a diagnostic function, the "standard" cost of swimming.

Definition at line 879 of file m_body.f90.

◆ body_mass_processing_cost_calc_o()

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.

Note
Note that this version accepts the food object not its raw mass.
Parameters
[in]food_objfood item object, of class FOOD_ITEM.
[in]distance_fooddistance to the food item.
Returns
Food processing cost.

Implementation details

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:

  1. some small processing cost depending on the food item mass and
  2. the cost of swimming towards the food item depending on the relative distance (distance in terms of the agent body length.

\[ C_{p} = max(\mu \cdot \beta_{fp}, \mu \cdot C_{smr}) + C_{s} , \]

where $ \mu $ is the food gain, $ \beta_{fp} $ is a factor proportional to the food item mass, and $ C_{smr} $ is a food processing cost factor that is proportional to the agent's SMR.

Note
The calculations are done by the scalar procedure body_mass_processing_cost_calc_v().

Definition at line 934 of file m_body.f90.

◆ stomach_content_food_gain_fitting_v()

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.

Parameters
[in]food_gainfood gain.
[in]food_distdistance to food.
Returns
processing cost.
Note
Note that this version accepts the the raw food mass (real value).
The food fitting is adjusted for the food item processing cost body_mass_processing_cost_calc_v() call.

Implementation details

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.

◆ stomach_content_food_gain_fitting_o()

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

Note
Note that this version accepts the food object not its raw mass.
Note that the food fitting is adjusted for the food item processing cost via 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.

◆ stomach_content_food_gain_non_fit_v()

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.

Note
Note that this version accepts the the raw food mass (real value).

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.

◆ stomach_content_food_gain_non_fit_o()

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.

Note
Note that this version accepts the food object not its raw mass.

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.

◆ body_mass_calculate_cost_living_step()

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.

Note
Should be calculated at the end of model time step.

The energetic costs is a fraction of body weight and scales to number of time steps :

\[ M_{c}= \frac{C B}{\Omega} \]

(eq. 1)

Definition at line 1126 of file m_body.f90.

◆ body_mass_adjust_living_cost_step()

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.

Note
Should be calculated at the end of model time step.

Definition at line 1149 of file m_body.f90.

◆ body_mass_grow_do_calculate()

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.

Note
Can be calculated after consumption of each food item, many times within a single time step of the model.
Parameters
[in]update_historyupdate_history optional logical flag to enable saving the body mass value to the body mass history stack.
Warning
History update is disabled by default because the length and mass histories can be updated separately, so could get not synchronous.

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.

◆ body_mass_food_processing_cost_factor_smr()

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.

◆ stomach_content_get_increment()

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.

Note
Note that the stomach_increment should be adjusted for fitting size. This is the actual increment.

Implementation details

Stomach content mass is incremented by the stomach_increment value.

Definition at line 1205 of file m_body.f90.

◆ body_len_grow_calculate_increment_step()

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

Notable local parameters

increment_factor_ipoint is a local parameter showing the linear growth increment factor interpolation point, $ \vartheta $ in the formula below.

Implementation details

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.

MASS_THRESHOLD block

  • First, we get the interpolation-based growth increment factor increment_factor_ipoint ( $ \vartheta $) depending on the agent's current growth hormone level. The function linking growth hormone level and the linear growth increment factor ( $ \vartheta $) is represented by this relationship:
    Note
    Note that the linear interpolation 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 arrays
    • LINEAR_GROWTH_HORMONE_INCREMENT_FACTOR_CURVE_ABSCISSA
    • LINEAR_GROWTH_HORMONE_INCREMENT_FACTOR_CURVE_ORDINATE.
  • Save the interpolation plot in the debug mode using external command.
    Warning
    Involves huge number of plots, should normally be disabled.
  • Second, The body length increment in units of length $ \frac{\Delta L}{L} $ is proportional to the body mass increment in units of mass: $ \frac{\Delta M}{M} $, however weighted by the linear growth increment factor $ \vartheta $ that depends on the growth hormone and is obtained via interpolation (see above). If the agent's growth hormone level is very low, the growth increment factor is near-zero and linear growth increment is also near-zero. However, if growth hormone level is high, the growth increment weighting factor $ \vartheta $ approaches the maximum value that is proportional to the body mass increment in units of the agent's body mass:

    \[ \Delta L = L \cdot \vartheta \cdot \frac{\Delta M}{M} , \]

    where $ \Delta L $ is the body length increment, $ L $ is the body length, $ \vartheta $ is the growth-hormone-dependent linear growth increment factor, $ \frac{\Delta M}{M} $ is the body mass increment in units of body mass. So the relative body length increment is proportional to the relative body mass increment.
  • If the mass threshold is not exceeded in MASS_THRESHOLD, the agent does not increase in length, the length increment is zero.

Definition at line 1229 of file m_body.f90.

Here is the call graph for this function:

◆ body_len_grow_do_calculate_step()

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

Note
Should be calculated at the end of model time step.
Parameters
[in]update_historyupdate_history optional logical flag to enable saving the body mass value to the body mass history stack.
Warning
History update is disabled by default because the length and mass histories can be updated separately, so could get not synchronous.

Implementation details

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.

◆ sex_steroids_update_increment()

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.

Implementation details

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.

Note
Here implementation is based on steroid_factor_age().

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:

length_increment = &
maxval( [history_array, current_value] ) - &
minval( [history_array, current_value] )

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 the agent is male, testosterone is incremented.
  • If the agent is female, estrogen is incremented.

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.

Here is the call graph for this function:

◆ body_mass_is_starvation_check()

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:

  • its body mass falls below half the birth mass;
  • below the structural mass, which is defined as half the historic maximum body mass of the individual;
  • energy reserves fall below 1/4 of historical maximum value;
  • body mass is below the hard limit BODY_MASS_MIN.
    Returns
    Returns a logical flag: TRUE if starved, FALSE otherwise.

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.

Here is the call graph for this function:

◆ is_starved()

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.

Note
Note that this function is not type-bound (non-OO).
Parameters
[in]body_massbody_mass the current body mass of the agent.
[in]stomach_content_massstomach_content_mass the mass of the stomach content of the agent.
[in]body_mass_birthbody_mass_birth body mass of the agent at birth.
[in]body_mass_maximumbody_mass_maximum the historical maximum body mass of the agent.
[in]energy_currentenergy_current the current level of energy.
[in]energy_maximumenergy_maximum the historical maximum level of energy.
Returns
TRUE if the input conditions make the agent starved to death. Otherwise returns FALSE.

Conditions of severe starvation

An agent is considered starving to death if either of these conditions is met:

  • its body mass falls below half the birth mass;
  • below the structural mass, which is defined as half the historic maximum body mass of the individual;
  • energy reserves fall below 1/4 of historical maximum value;
  • body mass is below the hard limit BODY_MASS_MIN.

Definition at line 1561 of file m_body.f90.

Here is the caller graph for this function:

◆ stomach_content_mass_emptify_step()

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.

\[ S_{t+1} = S_{t} - S_{t} \frac{ K }{\Omega } , \]

where $ K $ is the stomach content emptify factor parameter (commondata::stomach_content_emptify_factor) and $ \Omega $ is the lifespan (commondata::lifespan parameter). The calculation calls the backend function for $ \Delta S = S_{t} \frac{ K }{\Omega } $: the_body::stomach_emptify_backend().

Note
Should be calculated at the end of model time step.

Definition at line 1615 of file m_body.f90.

Here is the call graph for this function:

◆ stomach_emptify_backend()

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 $ \Delta S $:

\[ \Delta S = S_{t} \frac{ K }{\Omega } , \]

where $ K $ is the stomach content emptify factor parameter (commondata::stomach_content_emptify_factor) and $ \Omega $ is the lifespan (commondata::lifespan parameter).

Parameters
[in]stomach_content_massstomach_content_mass Current mass of the stomach contents.
Returns
The decrement value

Definition at line 1633 of file m_body.f90.

Here is the caller graph for this function:

◆ condition_energy_update_after_growth()

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.

Here is the call graph for this function:

◆ cost_swimming_standard()

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.

Parameters
[in]stepssteps is the optional number of steps of the agent length the agent walks. Default value is commondata::lifespan (i.e. the whole lifespan).
Returns
The cost of swimming in terms of the agent's current body mass.

Definition at line 1667 of file m_body.f90.

◆ reproduction_cost_energy_fix()

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.

Returns
Returns the energetic cost of reproduction for the this agent.

Definition at line 1703 of file m_body.f90.

◆ reproduction_cost_energy_dynamic()

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.

Returns
Returns the energetic cost of reproduction for the this agent.

Implementation details

First, calculate the overall mass of the offspring that are produced as a result of this reproduction event $ \mu $. 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:

  • component that scales with the total mass of the offspring $ \mu $;
  • component that scales with the body mass of the agent $ M $.

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:

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

  • 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:

    \[ 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 $:

Notes

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 ( $ \phi \leq 1.0 $, whereas in females, who carry the eggs, this cost is at least equal to the full offspring mass ( $ \phi \geq 1.0 $). 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 ( $ \varphi_{males} \geq \varphi_{females} $). 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.

Here is the call graph for this function:

◆ reproduction_cost_unsuccessful_calc()

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.

Parameters
[in]cost_factorcost_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.
Returns
Returns the energetic cost of unsuccessful reproduction for the 'this' agent.

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.

◆ reproduction_init_zero()

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.

◆ reproduction_n_reproductions_get()

elemental integer function the_body::reproduction_n_reproductions_get ( class(reproduction), intent(in)  this)

Get the number of reproductions for this agent.

Returns
The number of reproductions the agent had.

Definition at line 1918 of file m_body.f90.

◆ reproduction_n_reproductions_set()

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.

Parameters
[in]n_reprn_repr The total number of reproductions for this agent.

Definition at line 1929 of file m_body.f90.

◆ reproduction_n_offspring_get()

elemental integer function the_body::reproduction_n_offspring_get ( class(reproduction), intent(in)  this)

Get the number of offspring.

Returns
The number of offspring the agent had during its lifespan.

Definition at line 1940 of file m_body.f90.

◆ reproduction_n_offspring_set()

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.

Parameters
[in]n_offsprn_offspr The number of offspring to set for this agent.

Definition at line 1951 of file m_body.f90.

◆ reproduction_n_increment()

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.

Parameters
[in]add_repradd_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_offspringaverage_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.

Implementation details

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.

◆ reproduction_n_offspring_calc()

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.

Parameters
[in]average_mass_offspraverage_mass_offspr Optional average body mass of the offspring ( $ \mu_{o} $, see below).
Returns
Returns the number of offspring per single reproduction.

Implementation details

Initially check if the average mass of newborn agents $ \mu_{o} $ 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 $ \phi \cdot M_{agent} $, this fraction $ \phi $ is obtained by a nonparametric relationship defined by the the interpolation grid:

The total mass of the offspring ( $ \phi \cdot M_{agent} $) is calculated in the procedure reproduction::offspring_mass() (=> the_body::reproduction_mass_offspring_calc()).

Second, the number of the offspring with the overall mass $ \phi \cdot M_{agent} $ is calculated as the fraction:

\[ \frac{ \phi \cdot M_{agent} }{ \mu_{o} } , \]

where $ \mu_{o} $ 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.

Here is the call graph for this function:

◆ reproduction_ready_steroid_hormones_exceed()

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.

Returns
TRUE if the agent is ready to reproduce by sufficiently high level of gonadal steroids or FALSE otherwise.

Implementation notes

Determine if the agent's hormonal system is ready for reproduction, that is, its current level of sex steroids $ \sigma_{i} $ exceeds the baseline (initially determined by the genome) $ \sigma_{0} $ by a factor $ \nu $ determined by the parameter commondata::sex_steroids_reproduction_threshold:

\[ \sigma_{i} > \nu \sigma_{0} . \]

If the level of sex steroids is insufficient, reproduction is impossible and FALSE is returned.

Definition at line 2073 of file m_body.f90.

◆ reproduction_mass_offspring_calc()

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.

Returns
Total mass of all offspring produced by the agent during a specific reproduction event.

Implementation details

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 $ M_{agent} $ using this equation:

\[ \phi \cdot M_{agent} , \]

where $ \phi $ 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().

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

Definition at line 2106 of file m_body.f90.

Here is the call graph for this function:

Variable Documentation

◆ modname

character (len=*), parameter, private the_body::modname = "(THE_CONDITION)"
private

Definition at line 26 of file m_body.f90.